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.

milady

nirholasaab2297ef104
diff --git a/.env.example b/.env.example
index 84ddf6afd..c07acb559 100644
--- a/.env.example
+++ b/.env.example
@@ -46,6 +46,8 @@ VITE_RPM_SUBDOMAIN=demo
# Privy wallet auth (client-side — get app ID from https://dashboard.privy.io)
VITE_PRIVY_APP_ID=
+# Privy app ID (server-side — for verifying identity tokens in /api/auth/privy/verify)
+PRIVY_APP_ID=
# Avaturn (photo-to-avatar pipeline). API key lives server-side; used by
# /api/onboarding/avaturn-session to exchange 3 selfies for a session URL.
@@ -64,3 +66,10 @@ VITE_AVATURN_DEVELOPER_ID=
# Set to "stub" for testing, or a provider name when configured.
# Unset or "none" → API returns 501 regen_unconfigured.
AVATAR_REGEN_PROVIDER=none
+
+# IPFS pinning — used by POST /api/pinning/pin before on-chain registration.
+# Pinata (preferred): get JWT from https://app.pinata.cloud/keys
+PINATA_JWT=
+# Web3.Storage (fallback): get token from https://web3.storage/tokens
+# (legacy v1 API — upload endpoint: https://api.web3.storage/upload)
+WEB3_STORAGE_TOKEN=
diff --git a/api/_lib/env.js b/api/_lib/env.js
index e8c1629ad..004ce678a 100644
--- a/api/_lib/env.js
+++ b/api/_lib/env.js
@@ -97,4 +97,10 @@ export const env = {
get PRIVY_APP_ID() {
return req('PRIVY_APP_ID');
},
+
+ // Mainnet RPC URL for ENS resolution. Falls back to ethers public default provider.
+ // Recommended: set to an Alchemy / Infura URL for reliability.
+ get MAINNET_RPC_URL() {
+ return opt('MAINNET_RPC_URL');
+ },
};
diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.js
index d6f19c309..44377f754 100644
--- a/api/_lib/rate-limit.js
+++ b/api/_lib/rate-limit.js
@@ -71,8 +71,13 @@ export const limits = {
oauthToken: (clientId) =>
getLimiter('oauth:token', { limit: 120, window: '1 m' }).limit(clientId),
upload: (userId) => getLimiter('upload', { limit: 60, window: '1 h' }).limit(userId),
+ avatarPatch: (userId) => getLimiter('avatar:patch', { limit: 20, window: '1 h' }).limit(userId),
+ avatarRollback: (userId) =>
+ getLimiter('avatar:rollback', { limit: 10, window: '1 h' }).limit(userId),
chatUser: (userId) => getLimiter('chat:user', { limit: 20, window: '1 m' }).limit(userId),
chatIp: (ip) => getLimiter('chat:ip', { limit: 40, window: '1 m' }).limit(ip),
+ checkName: (ip) => getLimiter('check-name:ip', { limit: 60, window: '1 m' }).limit(ip),
+ ensResolve: (ip) => getLimiter('ens:resolve:ip', { limit: 60, window: '1 m' }).limit(ip),
widgetWrite: (userId) => getLimiter('widget:write', { limit: 60, window: '1 m' }).limit(userId),
widgetRead: (ip) => getLimiter('widget:read', { limit: 600, window: '1 m' }).limit(ip),
// Per-widget visitor chat. Limit is dynamic — one bucket per (widgetId, perMinute).
@@ -88,6 +93,9 @@ export const limits = {
limit: Math.max(1, Math.min(1000, perMin || 10)),
window: '1 m',
}).limit(agentId),
+ pinUser: (userId) => getLimiter('pin:user', { limit: 30, window: '1 h' }).limit(userId),
+ pinStatusIp: (ip) => getLimiter('pin:status:ip', { limit: 60, window: '1 m' }).limit(ip),
+ agentByAddress: (ip) => getLimiter('agents:by-address', { limit: 120, window: '1 m' }).limit(ip),
};
// Trust only proxy headers that Vercel itself sets and signs. Naively reading
diff --git a/api/a-og.js b/api/a-og.js
index 5ed7713b9..f0466511b 100644
--- a/api/a-og.js
+++ b/api/a-og.js
@@ -20,6 +20,7 @@ export default wrap(async (req, res) => {
const url = new URL(req.url, 'http://x');
const chainId = Number(url.searchParams.get('chain'));
const agentId = url.searchParams.get('id');
+ const format = (url.searchParams.get('format') || '').toLowerCase();
if (!Number.isFinite(chainId) || !agentId) {
return error(res, 400, 'invalid_request', 'chain and id required');
@@ -27,6 +28,33 @@ export default wrap(async (req, res) => {
const agent = await resolveOnChainAgent({ chainId, agentId });
+ if (format === 'json') {
+ const origin = url.searchParams.get('origin') || 'https://3dagent.vercel.app';
+ const pageUrl = `${origin}/a/${chainId}/${agentId}`;
+ const imageUrl = `${origin}/api/a-og?chain=${chainId}&id=${encodeURIComponent(agentId)}`;
+ const status = agent.error && !agent.name ? 404 : 200;
+ res.statusCode = status;
+ res.setHeader('content-type', 'application/json; charset=utf-8');
+ res.setHeader('cache-control', status === 200 ? CACHE_CARD : 'public, max-age=60');
+ res.end(
+ JSON.stringify({
+ title: (agent.name || `Agent #${agentId}`) + ' — 3D Agent',
+ description: agent.description || 'An embodied 3D agent.',
+ image: imageUrl,
+ url: pageUrl,
+ type: 'profile',
+ agent: {
+ name: agent.name || null,
+ slug: `${chainId}/${agentId}`,
+ thumbnailUrl: agent.image || null,
+ chainId: agent.chainId,
+ onChain: true,
+ },
+ }),
+ );
+ return;
+ }
+
// If the manifest has a raw image URL, redirect so the crawler caches
// an actual PNG/JPG (better social preview than SVG text card).
// Only redirect for http(s) URLs — crawlers won't follow ipfs:// or
diff --git a/api/a-page.js b/api/a-page.js
index 4b3e251ae..c975e2739 100644
--- a/api/a-page.js
+++ b/api/a-page.js
@@ -40,7 +40,7 @@ export default wrap(async (req, res) => {
const embedUrl = `${origin}/a/${chainId}/${agentId}/embed`;
const viewerUrl = `${origin}/?agent=agent://${chainId}/${agentId}`;
const ogUrl = `${origin}/api/a-og?chain=${chainId}&id=${encodeURIComponent(agentId)}`;
- const oembedJs = `${origin}/api/oembed?url=${encodeURIComponent(pageUrl)}&format=json`;
+ const oembedJs = `${origin}/api/agent-oembed?url=${encodeURIComponent(pageUrl)}&format=json`;
const title = agent.name || `Agent #${agentId}`;
const chainLabel = agent.chainName || `Chain ${chainId}`;
@@ -106,7 +106,7 @@ function renderHtml(p) {
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="${t} on ${chainL}">
- <meta name="twitter:card" content="player">
+ <meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="${t}">
<meta name="twitter:description" content="${d}">
<meta name="twitter:image" content="${escapeAttr(p.ogUrl)}">
diff --git a/api/agents/by-address/[addr].js b/api/agents/by-address/[addr].js
new file mode 100644
index 000000000..fad0d4cff
--- /dev/null
+++ b/api/agents/by-address/[addr].js
@@ -0,0 +1,162 @@
+// GET /api/agents/by-address/:addr?chainId=<n>
+// Public, rate-limited 120/min per IP.
+// DB-first, then chain fallback via ERC-721 enumerable reads.
+
+import { JsonRpcProvider, Contract } from 'ethers';
+import { sql } from '../../_lib/db.js';
+import { cors, error, json, method, wrap } from '../../_lib/http.js';
+import { limits, clientIp } from '../../_lib/rate-limit.js';
+import { SERVER_CHAIN_META, resolveURI } from '../../_lib/onchain.js';
+
+const ENUM_ABI = [
+ 'function balanceOf(address owner) external view returns (uint256)',
+ 'function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)',
+ 'function tokenURI(uint256 tokenId) external view returns (string)',
+];
+
+// In-memory cache: cacheKey → { expires: ms, agents: [] }
+const _cache = new Map();
+const CACHE_TTL = 60_000;
+const RPC_TIMEOUT = 3_000;
+
+function cacheGet(key) {
+ const entry = _cache.get(key);
+ if (!entry) return null;
+ if (Date.now() > entry.expires) {
+ _cache.delete(key);
+ return null;
+ }
+ return entry.agents;
+}
+
+function cacheSet(key, agents) {
+ _cache.set(key, { expires: Date.now() + CACHE_TTL, agents });
+}
+
+function withTimeout(promise, ms) {
+ return new Promise((resolve, reject) => {
+ const t = setTimeout(() => reject(new Error(`timeout after ${ms}ms`)), ms);
+ Promise.resolve(promise).then(
+ (v) => {
+ clearTimeout(t);
+ resolve(v);
+ },
+ (e) => {
+ clearTimeout(t);
+ reject(e);
+ },
+ );
+ });
+}
+
+async function queryChain(addr, chainId, meta) {
+ let provider;
+ try {
+ provider = new JsonRpcProvider(meta.rpc, chainId, { staticNetwork: true });
+ } catch {
+ return [];
+ }
+
+ const registry = new Contract(meta.registry, ENUM_ABI, provider);
+ let count;
+ try {
+ count = Number(await withTimeout(registry.balanceOf(addr), RPC_TIMEOUT));
+ } catch {
+ return [];
+ }
+
+ if (count === 0) return [];
+
+ const agentIds = await Promise.all(
+ Array.from({ length: count }, (_, i) =>
+ withTimeout(registry.tokenOfOwnerByIndex(addr, BigInt(i)), RPC_TIMEOUT).catch(() => null),
+ ),
+ );
+
+ const results = [];
+ for (const agentId of agentIds) {
+ if (agentId == null) continue;
+ let agentURI = null;
+ try {
+ agentURI = await withTimeout(registry.tokenURI(agentId), RPC_TIMEOUT);
+ } catch {
+ // best-effort — return the entry even without a URI
+ }
+ results.push({
+ id: String(agentId),
+ chainId,
+ agentURI: agentURI || null,
+ manifestUrl: agentURI ? resolveURI(agentURI) : null,
+ onChain: true,
+ source: 'chain',
+ });
+ }
+
+ return results;
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const rl = await limits.agentByAddress(clientIp(req));
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const raw = ((req.query?.addr) || '').trim().toLowerCase();
+ if (!/^0x[a-f0-9]{40}$/.test(raw)) {
+ return error(res, 400, 'validation_error', 'invalid wallet address');
+ }
+
+ const url = new URL(req.url, 'http://x');
+ const filterChainId = url.searchParams.get('chainId')
+ ? Number(url.searchParams.get('chainId'))
+ : null;
+
+ const cacheKey = `${raw}:${filterChainId ?? 'all'}`;
+ const cached = cacheGet(cacheKey);
+ if (cached) return json(res, 200, { agents: cached });
+
+ // Step 2: DB-first — check agent_identities by wallet_address
+ const rows = filterChainId
+ ? await sql`
+ SELECT id, home_url, erc8004_agent_id, chain_id
+ FROM agent_identities
+ WHERE lower(wallet_address) = ${raw}
+ AND chain_id = ${filterChainId}
+ AND deleted_at IS NULL
+ ORDER BY created_at ASC`
+ : await sql`
+ SELECT id, home_url, erc8004_agent_id, chain_id
+ FROM agent_identities
+ WHERE lower(wallet_address) = ${raw}
+ AND deleted_at IS NULL
+ ORDER BY created_at ASC`;
+
+ if (rows.length > 0) {
+ const agents = rows.map((r) => ({
+ id: r.id,
+ chainId: r.chain_id,
+ agentURI: null,
+ manifestUrl: r.home_url || null,
+ onChain: r.erc8004_agent_id != null,
+ source: 'db',
+ }));
+ cacheSet(cacheKey, agents);
+ return json(res, 200, { agents });
+ }
+
+ // Step 3: Chain fallback — enumerate ERC-721 tokens owned by addr
+ const chains = filterChainId
+ ? SERVER_CHAIN_META[filterChainId]
+ ? [{ id: filterChainId, meta: SERVER_CHAIN_META[filterChainId] }]
+ : []
+ : Object.entries(SERVER_CHAIN_META).map(([id, meta]) => ({ id: Number(id), meta }));
+
+ const settled = await Promise.allSettled(
+ chains.map(({ id, meta }) => queryChain(raw, id, meta)),
+ );
+
+ const agents = settled.flatMap((r) => (r.status === 'fulfilled' ? r.value : []));
+ cacheSet(cacheKey, agents);
+ return json(res, 200, { agents });
+});
diff --git a/api/agents/check-name.js b/api/agents/check-name.js
index fdac9b2c2..2c6604490 100644
--- a/api/agents/check-name.js
+++ b/api/agents/check-name.js
@@ -1,29 +1,47 @@
// GET /api/agents/check-name?name=<name>[&agent_id=<excludeId>]
-// Returns { available: boolean } — scoped to the caller's user_id.
+// Returns { available: boolean, reason?: 'taken' | 'invalid' | 'denylisted' }
import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';
-import { sql } from '../_lib/db.js';
+import { sql } from '../_lib/db.js';
import { cors, json, method, wrap, error } from '../_lib/http.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
+const NAME_RE = /^[a-zA-Z0-9_-]{3,32}$/;
+
+const DENYLIST = new Set([
+ 'admin',
+ 'root',
+ 'system',
+ 'anthropic',
+ 'claude',
+ 'openai',
+ 'null',
+ 'undefined',
+ 'test',
+]);
+
export default wrap(async (req, res) => {
if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
if (!method(req, res, ['GET'])) return;
const session = await getSessionUser(req);
- const bearer = session ? null : await authenticateBearer(extractBearer(req));
+ const bearer = session ? null : await authenticateBearer(extractBearer(req));
if (!session && !bearer) return error(res, 401, 'unauthorized', 'sign in required');
const userId = session?.id ?? bearer.userId;
- const rl = await limits.authIp(clientIp(req));
+ const rl = await limits.checkName(clientIp(req));
if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
- const url = new URL(req.url, 'http://x');
- const name = (url.searchParams.get('name') || '').trim();
- const agentId = (url.searchParams.get('agent_id') || '').trim() || null;
+ const url = new URL(req.url, 'http://x');
+ const name = (url.searchParams.get('name') || '').trim();
+ const agentId = (url.searchParams.get('agent_id') || '').trim() || null;
+
+ if (!name) return json(res, 200, { available: false, reason: 'invalid' });
+
+ if (!NAME_RE.test(name)) return json(res, 200, { available: false, reason: 'invalid' });
- if (!name) return error(res, 400, 'validation_error', 'name is required');
- if (name.length > 120) return error(res, 400, 'validation_error', 'name too long');
+ if (DENYLIST.has(name.toLowerCase()))
+ return json(res, 200, { available: false, reason: 'denylisted' });
// Exclude the agent being edited so renaming to the same name is always "available".
const [conflict] = agentId
@@ -41,5 +59,6 @@ export default wrap(async (req, res) => {
AND deleted_at IS NULL
`;
- return json(res, 200, { available: !conflict });
+ if (conflict) return json(res, 200, { available: false, reason: 'taken' });
+ return json(res, 200, { available: true });
});
diff --git a/api/agents/ens/[name].js b/api/agents/ens/[name].js
new file mode 100644
index 000000000..e6944bedc
--- /dev/null
+++ b/api/agents/ens/[name].js
@@ -0,0 +1,105 @@
+// GET /api/agents/ens/:name
+// Resolves an ENS name → address, then looks up agents registered to that address.
+// Public, rate-limited 60/min per IP. ENS → address cached 5 min in-memory.
+
+import { ethers } from 'ethers';
+import { sql } from '../../_lib/db.js';
+import { cors, error, json, method, wrap } from '../../_lib/http.js';
+import { limits, clientIp } from '../../_lib/rate-limit.js';
+import { env } from '../../_lib/env.js';
+
+// Validates "foo.eth", "sub.foo.eth", etc. — each label [a-z0-9-]+, must end with .eth
+const ENS_RE = /^(?:[a-z0-9-]+\.)+eth$/;
+
+// In-memory ENS → address cache. Entry: { address, expiresAt }
+const ensCache = new Map();
+const CACHE_TTL_MS = 5 * 60 * 1000;
+
+function getCached(name) {
+ const entry = ensCache.get(name);
+ if (!entry) return null;
+ if (Date.now() > entry.expiresAt) {
+ ensCache.delete(name);
+ return null;
+ }
+ return entry.address;
+}
+
+function setCached(name, address) {
+ ensCache.set(name, { address, expiresAt: Date.now() + CACHE_TTL_MS });
+}
+
+async function resolveEns(name) {
+ const rpcUrl = env.MAINNET_RPC_URL;
+ const provider = rpcUrl
+ ? new ethers.JsonRpcProvider(rpcUrl)
+ : ethers.getDefaultProvider('mainnet');
+
+ const timeout = new Promise((_, reject) =>
+ setTimeout(() => reject(new Error('ens-timeout')), 3000),
+ );
+ return Promise.race([provider.resolveName(name), timeout]);
+}
+
+async function agentsByAddress(address) {
+ // TODO: dedupe with /api/agents/by-address once that endpoint exists (prompt 19)
+ const rows = await sql`
+ SELECT id, name, description, avatar_id, home_url,
+ erc8004_agent_id, erc8004_registry, chain_id,
+ wallet_address, created_at
+ FROM agent_identities
+ WHERE lower(wallet_address) = ${address.toLowerCase()}
+ AND deleted_at IS NULL
+ ORDER BY created_at ASC`;
+
+ return rows.map((r) => ({
+ id: r.id,
+ name: r.name,
+ description: r.description,
+ avatar_id: r.avatar_id,
+ home_url: r.home_url || `/agent/${r.id}`,
+ erc8004_agent_id: r.erc8004_agent_id != null ? String(r.erc8004_agent_id) : null,
+ erc8004_registry: r.erc8004_registry,
+ chain_id: r.chain_id,
+ wallet_address: r.wallet_address,
+ created_at: r.created_at,
+ }));
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const rl = await limits.ensResolve(clientIp(req));
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const name = (req.query?.name || '').trim().toLowerCase();
+
+ if (!name || !ENS_RE.test(name)) {
+ return error(res, 400, 'validation_error', 'name must be a valid ENS label ending in .eth');
+ }
+
+ // Cache hit
+ let address = getCached(name);
+
+ if (!address) {
+ let resolved;
+ try {
+ resolved = await resolveEns(name);
+ } catch (err) {
+ if (err.message === 'ens-timeout') {
+ return error(res, 503, 'ens_timeout', 'ENS resolution timed out');
+ }
+ return error(res, 503, 'ens_error', 'ENS resolution failed');
+ }
+
+ if (!resolved) return error(res, 404, 'not_found', `${name} does not resolve to an address`);
+
+ address = resolved.toLowerCase();
+ setCached(name, address);
+ }
+
+ const agents = await agentsByAddress(address);
+
+ return json(res, 200, { name, address, agents });
+});
diff --git a/api/auth/session/list.js b/api/auth/session/list.js
new file mode 100644
index 000000000..5e89e709b
--- /dev/null
+++ b/api/auth/session/list.js
@@ -0,0 +1,47 @@
+import { getSessionUser } from '../../_lib/auth.js';
+import { sha256 } from '../../_lib/crypto.js';
+import { sql } from '../../_lib/db.js';
+import { cors, json, error, method, wrap } from '../../_lib/http.js';
+
+// Reads __Host-sid (or legacy sid) from the cookie header.
+function readCookieToken(req) {
+ const cookie = req.headers.cookie || '';
+ const m =
+ cookie.match(/(?:^|;\s*)__Host-sid=([^;]+)/) ||
+ cookie.match(/(?:^|;\s*)sid=([^;]+)/);
+ return m ? decodeURIComponent(m[1]) : null;
+}
+
+// GET /api/auth/session/list
+// Returns all non-revoked sessions for the authenticated user.
+// ipHash is the first 8 hex chars of sha256(ip) — raw IP is never returned.
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const user = await getSessionUser(req);
+ if (!user) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const token = readCookieToken(req);
+ const currentHash = token ? await sha256(token) : null;
+
+ const rows = await sql`
+ select id, created_at, last_seen_at, user_agent, ip, token_hash
+ from sessions
+ where user_id = ${user.id} and revoked_at is null and expires_at > now()
+ order by created_at desc
+ `;
+
+ const sessions = await Promise.all(
+ rows.map(async (s) => ({
+ id: s.id,
+ createdAt: s.created_at,
+ lastUsedAt: s.last_seen_at,
+ userAgent: s.user_agent,
+ ipHash: s.ip ? (await sha256(s.ip)).slice(0, 8) : null,
+ current: currentHash !== null && s.token_hash === currentHash,
+ })),
+ );
+
+ return json(res, 200, { ok: true, sessions });
+});
diff --git a/api/auth/session/refresh.js b/api/auth/session/refresh.js
new file mode 100644
index 000000000..fb277ff4b
--- /dev/null
+++ b/api/auth/session/refresh.js
@@ -0,0 +1,42 @@
+import { getSessionUser, createSession, sessionCookie } from '../../_lib/auth.js';
+import { sha256 } from '../../_lib/crypto.js';
+import { sql } from '../../_lib/db.js';
+import { cors, json, error, method, wrap } from '../../_lib/http.js';
+import { clientIp } from '../../_lib/rate-limit.js';
+
+// Reads __Host-sid (or legacy sid) from the cookie header.
+function readCookieToken(req) {
+ const cookie = req.headers.cookie || '';
+ const m =
+ cookie.match(/(?:^|;\s*)__Host-sid=([^;]+)/) ||
+ cookie.match(/(?:^|;\s*)sid=([^;]+)/);
+ return m ? decodeURIComponent(m[1]) : null;
+}
+
+// POST /api/auth/session/refresh
+// Rotates the current browser session: revokes the old row, issues a fresh one
+// for the same user, and sets a new __Host-sid cookie.
+// Rate limit: no matching preset in limits.* and getLimiter is not exported —
+// skipped; add limits.sessionRefresh(userId) when available.
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const user = await getSessionUser(req);
+ if (!user) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const token = readCookieToken(req);
+ if (!token) return error(res, 401, 'unauthorized', 'no session cookie');
+
+ const oldHash = await sha256(token);
+ await sql`update sessions set revoked_at = now() where token_hash = ${oldHash} and revoked_at is null`;
+
+ const newSecret = await createSession({
+ userId: user.id,
+ userAgent: req.headers['user-agent'] || null,
+ ip: clientIp(req),
+ });
+
+ res.setHeader('set-cookie', sessionCookie(newSecret));
+ return json(res, 200, { ok: true, rotatedAt: new Date().toISOString() });
+});
diff --git a/api/auth/session/revoke.js b/api/auth/session/revoke.js
new file mode 100644
index 000000000..0d2cf7fbb
--- /dev/null
+++ b/api/auth/session/revoke.js
@@ -0,0 +1,39 @@
+import { getSessionUser, sessionCookie } from '../../_lib/auth.js';
+import { sql } from '../../_lib/db.js';
+import { cors, json, error, method, wrap, readJson } from '../../_lib/http.js';
+
+// POST /api/auth/session/revoke
+// Body { sessionId: string } — revoke one session owned by the caller.
+// Body { all: true } — revoke every session (including current); clears cookie.
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const user = await getSessionUser(req);
+ if (!user) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const body = await readJson(req);
+
+ if (body.all === true) {
+ const revoked = await sql`
+ update sessions set revoked_at = now()
+ where user_id = ${user.id} and revoked_at is null
+ returning id
+ `;
+ res.setHeader('set-cookie', sessionCookie('', { clear: true }));
+ return json(res, 200, { ok: true, revoked: revoked.length });
+ }
+
+ if (body.sessionId) {
+ const revoked = await sql`
+ update sessions set revoked_at = now()
+ where id = ${body.sessionId} and user_id = ${user.id} and revoked_at is null
+ returning id
+ `;
+ if (revoked.length === 0)
+ return error(res, 404, 'not_found', 'session not found or already revoked');
+ return json(res, 200, { ok: true, revoked: revoked.length });
+ }
+
+ return error(res, 400, 'validation_error', 'provide sessionId or all: true');
+});
diff --git a/api/avatars/[id].js b/api/avatars/[id].js
index ef30c30e5..7cc21e8e5 100644
--- a/api/avatars/[id].js
+++ b/api/avatars/[id].js
@@ -4,7 +4,10 @@
import { getSessionUser, authenticateBearer, extractBearer, hasScope } from '../_lib/auth.js';
import { getAvatar, updateAvatar, deleteAvatar, resolveAvatarUrl, stripOwnerFor } from '../_lib/avatars.js';
+import { sql } from '../_lib/db.js';
import { cors, json, method, readJson, wrap, error } from '../_lib/http.js';
+import { headObject } from '../_lib/r2.js';
+import { limits } from '../_lib/rate-limit.js';
import { recordEvent } from '../_lib/usage.js';
import { z } from 'zod';
import { avatarVisibility, parse } from '../_lib/validate.js';
@@ -39,7 +42,11 @@ export default wrap(async (req, res) => {
if (auth.source === 'oauth' || auth.source === 'apikey') {
if (!hasScope(auth.scope, 'avatars:write')) return error(res, 403, 'insufficient_scope', 'avatars:write required');
}
- const patch = parse(patchSchema, await readJson(req));
+ const body = await readJson(req);
+ if (body && typeof body.glbUrl === 'string') {
+ return handleGlbPatch(res, auth, id, body.glbUrl);
+ }
+ const patch = parse(patchSchema, body);
const avatar = await updateAvatar({ id, userId: auth.userId, patch });
if (!avatar) return error(res, 404, 'not_found', 'avatar not found or not yours');
return json(res, 200, { avatar });
@@ -54,6 +61,56 @@ export default wrap(async (req, res) => {
return json(res, 200, { ok: true });
});
+const MAX_GLB_BYTES = 25 * 1024 * 1024;
+const VALID_GLB_TYPES = new Set(['model/gltf-binary', 'application/octet-stream']);
+
+async function handleGlbPatch(res, auth, id, glbUrl) {
+ const rl = await limits.avatarPatch(auth.userId);
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many patch requests');
+
+ if (!/^u\/[^/]+\/.+\.glb$/.test(glbUrl)) {
+ return error(res, 400, 'invalid_request', 'glbUrl must be a valid R2 storage key (u/{userId}/...)');
+ }
+ if (!glbUrl.startsWith(`u/${auth.userId}/`)) {
+ return error(res, 403, 'forbidden', 'key does not belong to your storage namespace');
+ }
+
+ const head = await headObject(glbUrl);
+ if (!head) return error(res, 404, 'not_found', 'glb object not found in storage');
+ if (head.ContentLength > MAX_GLB_BYTES) {
+ return error(res, 413, 'payload_too_large', 'glb exceeds 25 MB limit');
+ }
+ if (!VALID_GLB_TYPES.has(head.ContentType)) {
+ return error(res, 415, 'unsupported_media_type', 'content-type must be model/gltf-binary or application/octet-stream');
+ }
+
+ const rows = await sql`select id, owner_id from avatars where id = ${id} and deleted_at is null limit 1`;
+ const avatar = rows[0];
+ if (!avatar) return error(res, 404, 'not_found', 'avatar not found');
+ if (avatar.owner_id !== auth.userId) return error(res, 403, 'forbidden', 'you do not own this avatar');
+
+ try {
+ await sql`insert into avatar_versions (avatar_id, storage_key, created_by) values (${id}, ${glbUrl}, ${auth.userId})`;
+ } catch (e) {
+ if (e?.code === '42P01' || String(e?.message).includes('does not exist')) {
+ console.warn('avatar_versions table missing — skipping version insert');
+ } else {
+ throw e;
+ }
+ }
+
+ const [updated] = await sql`
+ update avatars set storage_key = ${glbUrl}, updated_at = now()
+ where id = ${id} and owner_id = ${auth.userId} and deleted_at is null
+ returning id, storage_key, updated_at
+ `;
+
+ return json(res, 200, {
+ ok: true,
+ avatar: { id: updated.id, currentGlbUrl: updated.storage_key, updatedAt: updated.updated_at },
+ });
+}
+
async function resolveAuth(req) {
const session = await getSessionUser(req);
if (session) return { userId: session.id, source: 'session', scope: 'avatars:read avatars:write avatars:delete' };
diff --git a/api/avatars/[id]/glb-versions.js b/api/avatars/[id]/glb-versions.js
new file mode 100644
index 000000000..3d0151b68
--- /dev/null
+++ b/api/avatars/[id]/glb-versions.js
@@ -0,0 +1,44 @@
+// GET /api/avatars/:id/glb-versions
+// Lists explicit GLB save-back snapshots for an avatar, newest first (limit 50).
+// Requires auth + ownership. Distinct from /versions (parent_avatar_id lineage chain).
+
+import { getSessionUser, authenticateBearer, extractBearer } from '../../_lib/auth.js';
+import { sql } from '../../_lib/db.js';
+import { cors, json, method, wrap, error } from '../../_lib/http.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const id = req.query?.id;
+ if (!id) return error(res, 400, 'invalid_request', 'id required');
+
+ const session = await getSessionUser(req);
+ const bearer = session ? null : await authenticateBearer(extractBearer(req));
+ if (!session && !bearer) return error(res, 401, 'unauthorized', 'sign in required');
+ const userId = session?.id ?? bearer.userId;
+
+ const [avatar] = await sql`
+ select id from avatars
+ where id = ${id} and owner_id = ${userId} and deleted_at is null
+ limit 1
+ `;
+ if (!avatar) return error(res, 404, 'not_found', 'avatar not found');
+
+ const rows = await sql`
+ select id, glb_url, created_at, metadata
+ from avatar_versions
+ where avatar_id = ${id}
+ order by created_at desc
+ limit 50
+ `;
+
+ return json(res, 200, {
+ versions: rows.map((v) => ({
+ id: v.id,
+ glbUrl: v.glb_url,
+ createdAt: v.created_at,
+ metadata: v.metadata ?? null,
+ })),
+ });
+});
diff --git a/api/avatars/[id]/rollback.js b/api/avatars/[id]/rollback.js
new file mode 100644
index 000000000..4c3ecb8e8
--- /dev/null
+++ b/api/avatars/[id]/rollback.js
@@ -0,0 +1,67 @@
+// POST /api/avatars/:id/rollback
+// Restores avatars.storage_key from a saved avatar_versions snapshot,
+// then records the rollback as a new version row.
+// Rate-limited to 10 / hour per user.
+
+import { getSessionUser, authenticateBearer, extractBearer } from '../../_lib/auth.js';
+import { sql } from '../../_lib/db.js';
+import { cors, json, method, readJson, wrap, error } from '../../_lib/http.js';
+import { limits, clientIp } from '../../_lib/rate-limit.js';
+import { z } from 'zod';
+import { parse } from '../../_lib/validate.js';
+
+const bodySchema = z.object({
+ versionId: z.coerce.number().int().positive(),
+});
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const id = req.query?.id;
+ if (!id) return error(res, 400, 'invalid_request', 'id required');
+
+ const session = await getSessionUser(req);
+ const bearer = session ? null : await authenticateBearer(extractBearer(req));
+ if (!session && !bearer) return error(res, 401, 'unauthorized', 'sign in required');
+ const userId = session?.id ?? bearer.userId;
+
+ const rl = await limits.avatarRollback(userId);
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const { versionId } = parse(bodySchema, await readJson(req));
+
+ const [avatar] = await sql`
+ select id from avatars
+ where id = ${id} and owner_id = ${userId} and deleted_at is null
+ limit 1
+ `;
+ if (!avatar) return error(res, 404, 'not_found', 'avatar not found');
+
+ const [ver] = await sql`
+ select id, glb_url from avatar_versions
+ where id = ${versionId} and avatar_id = ${id}
+ limit 1
+ `;
+ if (!ver) return error(res, 404, 'not_found', 'version not found');
+
+ const [updated] = await sql`
+ update avatars
+ set storage_key = ${ver.glb_url}, updated_at = now()
+ where id = ${id} and owner_id = ${userId}
+ returning id, owner_id, slug, name, description, storage_key, size_bytes,
+ content_type, source, visibility, tags, version, created_at, updated_at
+ `;
+
+ await sql`
+ insert into avatar_versions (avatar_id, glb_url, metadata, created_by)
+ values (
+ ${id},
+ ${ver.glb_url},
+ ${JSON.stringify({ rollback_of: versionId })}::jsonb,
+ ${userId}
+ )
+ `;
+
+ return json(res, 200, { ok: true, avatar: updated });
+});
diff --git a/api/lobehub/config.js b/api/lobehub/config.js
new file mode 100644
index 000000000..be5d165f3
--- /dev/null
+++ b/api/lobehub/config.js
@@ -0,0 +1,26 @@
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { json, error, method, wrap } from '../_lib/http.js';
+
+let manifest;
+try {
+ manifest = JSON.parse(
+ readFileSync(join(process.cwd(), 'public/.well-known/lobehub-plugin.json'), 'utf8'),
+ );
+} catch (err) {
+ console.error('[lobehub/config] failed to load lobehub-plugin.json', err);
+}
+
+export default wrap(async (req, res) => {
+ // CORS open so LobeHub marketplace fetcher can read this without credentials.
+ res.setHeader('access-control-allow-origin', '*');
+ res.setHeader('access-control-allow-methods', 'GET,OPTIONS');
+ if (req.method === 'OPTIONS') {
+ res.statusCode = 204;
+ res.end();
+ return;
+ }
+ if (!method(req, res, ['GET'])) return;
+ if (!manifest) return error(res, 500, 'internal_error', 'manifest unavailable');
+ return json(res, 200, manifest, { 'cache-control': 'public, max-age=300' });
+});
diff --git a/api/lobehub/handshake.js b/api/lobehub/handshake.js
new file mode 100644
index 000000000..70a73b3dd
--- /dev/null
+++ b/api/lobehub/handshake.js
@@ -0,0 +1,43 @@
+import { sql } from '../_lib/db.js';
+import { json, error, method, readJson, wrap, cors } from '../_lib/http.js';
+import { limits, clientIp } from '../_lib/rate-limit.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS' })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ // Use widgetRead as the closest public-read preset (600 req/min per IP).
+ const rl = await limits.widgetRead(clientIp(req));
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const body = await readJson(req);
+ const agentId = body?.agentId;
+ const hostOrigin = body?.hostOrigin || null;
+
+ if (!agentId || typeof agentId !== 'string') {
+ return error(res, 400, 'validation_error', 'agentId is required');
+ }
+
+ const [agent] = await sql`
+ SELECT id, name FROM agent_identities
+ WHERE id = ${agentId} AND deleted_at IS NULL
+ `;
+
+ if (!agent) return error(res, 404, 'not_found', 'agent not found');
+
+ // Build allowlist: known LobeHub hosts + caller's host if provided.
+ const allowedHosts = ['chat.lobehub.com', 'lobechat.ai'];
+ if (hostOrigin) {
+ try {
+ allowedHosts.push(new URL(hostOrigin).hostname);
+ } catch {}
+ }
+
+ return json(res, 200, {
+ ok: true,
+ iframeUrl: `https://3dagent.vercel.app/lobehub/iframe/?agent=${encodeURIComponent(agent.id)}`,
+ embedPolicy: {
+ origins: { mode: 'allowlist', hosts: allowedHosts },
+ },
+ });
+});
diff --git a/api/lobehub/manifest.js b/api/lobehub/manifest.js
new file mode 100644
index 000000000..ec059c85d
--- /dev/null
+++ b/api/lobehub/manifest.js
@@ -0,0 +1,17 @@
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { json, error, method, wrap, cors } from '../_lib/http.js';
+
+let manifest;
+try {
+ manifest = JSON.parse(readFileSync(join(process.cwd(), 'public/lobehub/plugin.json'), 'utf8'));
+} catch (err) {
+ console.error('[lobehub/manifest] failed to load plugin.json', err);
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+ if (!manifest) return error(res, 500, 'internal_error', 'manifest unavailable');
+ return json(res, 200, manifest, { 'cache-control': 'public, max-age=300' });
+});
diff --git a/api/pinning/pin.js b/api/pinning/pin.js
new file mode 100644
index 000000000..29a763d9f
--- /dev/null
+++ b/api/pinning/pin.js
@@ -0,0 +1,151 @@
+// POST /api/pinning/pin
+// Pins a manifest or GLB to IPFS via Pinata (preferred) or Web3.Storage (fallback).
+// Auth required. Rate-limited to 30/hour per user.
+
+import { sql } from '../_lib/db.js';
+import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';
+import { cors, json, method, readJson, wrap, error } from '../_lib/http.js';
+import { limits } from '../_lib/rate-limit.js';
+
+const MAX_R2_BYTES = 50 * 1024 * 1024;
+const MAX_DATA_URL_BYTES = 10 * 1024 * 1024;
+
+function isOwnedR2Url(url) {
+ const domain = process.env.S3_PUBLIC_DOMAIN;
+ if (!domain) return false;
+ try {
+ const trimmed = domain.replace(/\/$/, '');
+ return url.startsWith(trimmed + '/');
+ } catch {
+ return false;
+ }
+}
+
+async function pinViaPinata(buf, filename) {
+ const form = new FormData();
+ form.append('file', new Blob([buf]), filename);
+ const resp = await fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', {
+ method: 'POST',
+ headers: { Authorization: `Bearer ${process.env.PINATA_JWT}` },
+ body: form,
+ });
+ if (!resp.ok) {
+ const detail = await resp.text().catch(() => '');
+ throw Object.assign(new Error(`Pinata error ${resp.status}`), { status: 502, detail });
+ }
+ const data = await resp.json();
+ return { cid: data.IpfsHash, provider: 'pinata' };
+}
+
+async function pinViaWeb3Storage(buf, filename) {
+ const resp = await fetch('https://api.web3.storage/upload', {
+ method: 'POST',
+ headers: {
+ Authorization: `Bearer ${process.env.WEB3_STORAGE_TOKEN}`,
+ 'X-NAME': filename,
+ },
+ body: buf,
+ });
+ if (!resp.ok) {
+ const detail = await resp.text().catch(() => '');
+ throw Object.assign(new Error(`Web3.Storage error ${resp.status}`), { status: 502, detail });
+ }
+ const data = await resp.json();
+ return { cid: data.cid, provider: 'web3.storage' };
+}
+
+async function ensurePinsTable() {
+ await sql`
+ create table if not exists pins (
+ id bigserial primary key,
+ user_id text not null,
+ source_url text not null,
+ cid text not null,
+ provider text not null,
+ kind text not null,
+ created_at timestamptz not null default now()
+ )
+ `;
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const session = await getSessionUser(req);
+ const bearer = session ? null : await authenticateBearer(extractBearer(req));
+ if (!session && !bearer) return error(res, 401, 'unauthorized', 'sign in or provide a valid bearer token');
+ const userId = session?.id ?? bearer.userId;
+
+ const rl = await limits.pinUser(userId);
+ if (!rl.success) return error(res, 429, 'rate_limited', 'pinning rate exceeded (30/hour)');
+
+ const body = await readJson(req);
+ const { sourceUrl, kind } = body || {};
+
+ if (!sourceUrl || typeof sourceUrl !== 'string') {
+ return error(res, 400, 'validation_error', 'sourceUrl is required');
+ }
+ if (kind !== 'manifest' && kind !== 'glb') {
+ return error(res, 400, 'validation_error', 'kind must be "manifest" or "glb"');
+ }
+
+ const pinataJwt = process.env.PINATA_JWT;
+ const w3sToken = process.env.WEB3_STORAGE_TOKEN;
+ if (!pinataJwt && !w3sToken) {
+ return error(
+ res,
+ 503,
+ 'pinning_unconfigured',
+ 'no pinning provider configured; set PINATA_JWT or WEB3_STORAGE_TOKEN',
+ );
+ }
+
+ let buf;
+ let filename = kind === 'glb' ? 'avatar.glb' : 'manifest.json';
+
+ if (sourceUrl.startsWith('data:')) {
+ const commaIdx = sourceUrl.indexOf(',');
+ if (commaIdx === -1) return error(res, 400, 'validation_error', 'invalid data: URL');
+ const meta = sourceUrl.slice(0, commaIdx);
+ const payload = sourceUrl.slice(commaIdx + 1);
+ buf = meta.includes('base64')
+ ? Buffer.from(payload, 'base64')
+ : Buffer.from(decodeURIComponent(payload));
+ if (buf.byteLength > MAX_DATA_URL_BYTES) {
+ return error(res, 413, 'payload_too_large', 'data: URL content exceeds 10 MB');
+ }
+ } else {
+ if (!isOwnedR2Url(sourceUrl)) {
+ return error(res, 400, 'validation_error', 'sourceUrl must be an owned R2 URL or a data: URL');
+ }
+ const head = await fetch(sourceUrl, { method: 'HEAD' });
+ if (!head.ok) return error(res, 400, 'validation_error', 'source URL is not accessible');
+ const contentLength = parseInt(head.headers.get('content-length') || '0', 10);
+ if (contentLength > MAX_R2_BYTES) {
+ return error(res, 413, 'payload_too_large', 'source exceeds 50 MB limit');
+ }
+ const fetched = await fetch(sourceUrl);
+ if (!fetched.ok) return error(res, 502, 'fetch_failed', 'failed to fetch source URL');
+ buf = Buffer.from(await fetched.arrayBuffer());
+ const urlPath = new URL(sourceUrl).pathname;
+ filename = urlPath.split('/').pop() || filename;
+ }
+
+ const { cid, provider } = pinataJwt
+ ? await pinViaPinata(buf, filename)
+ : await pinViaWeb3Storage(buf, filename);
+
+ await ensurePinsTable();
+ await sql`
+ insert into pins (user_id, source_url, cid, provider, kind)
+ values (${userId}, ${sourceUrl}, ${cid}, ${provider}, ${kind})
+ `;
+
+ return json(res, 200, {
+ ok: true,
+ cid,
+ gatewayUrl: `https://ipfs.io/ipfs/${cid}`,
+ provider,
+ });
+});
diff --git a/api/pinning/status.js b/api/pinning/status.js
new file mode 100644
index 000000000..84b344997
--- /dev/null
+++ b/api/pinning/status.js
@@ -0,0 +1,72 @@
+// GET /api/pinning/status?cid=...
+// Public endpoint — checks pin status across configured providers.
+// Rate-limited to 60/min per IP.
+
+import { cors, json, method, wrap, error } from '../_lib/http.js';
+import { limits, clientIp } from '../_lib/rate-limit.js';
+
+const CID_RE = /^[a-zA-Z0-9]+$/;
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const ip = clientIp(req);
+ const rl = await limits.pinStatusIp(ip);
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const cid = req.query?.cid || new URL(req.url, 'http://x').searchParams.get('cid');
+ if (!cid || !CID_RE.test(cid)) {
+ return error(res, 400, 'validation_error', 'cid query parameter is required and must be alphanumeric');
+ }
+
+ const pinataJwt = process.env.PINATA_JWT;
+ const w3sToken = process.env.WEB3_STORAGE_TOKEN;
+
+ const checks = [];
+
+ if (pinataJwt) {
+ checks.push(
+ fetch(
+ `https://api.pinata.cloud/data/pinList?hashContains=${encodeURIComponent(cid)}&status=pinned`,
+ { headers: { Authorization: `Bearer ${pinataJwt}` } },
+ )
+ .then(async (r) => {
+ if (!r.ok) return null;
+ const data = await r.json();
+ const pinned = (data.rows || []).some((row) => row.ipfs_pin_hash === cid);
+ return pinned ? 'pinata' : null;
+ })
+ .catch(() => null),
+ );
+ }
+
+ if (w3sToken) {
+ checks.push(
+ fetch(`https://api.web3.storage/status/${encodeURIComponent(cid)}`, {
+ headers: { Authorization: `Bearer ${w3sToken}` },
+ })
+ .then(async (r) => {
+ if (!r.ok) return null;
+ const data = await r.json();
+ return data.cid === cid ? 'web3.storage' : null;
+ })
+ .catch(() => null),
+ );
+ }
+
+ const providerResults = await Promise.all(checks);
+ const activeProviders = providerResults.filter(Boolean);
+ const pinned = activeProviders.length > 0;
+
+ return json(res, 200, {
+ cid,
+ pinned,
+ provider: activeProviders[0] || null,
+ gatewayUrls: [
+ `https://ipfs.io/ipfs/${cid}`,
+ `https://cloudflare-ipfs.com/ipfs/${cid}`,
+ `https://dweb.link/ipfs/${cid}`,
+ ],
+ });
+});
diff --git a/dist-artifact/first-meet/first-meet.js b/dist-artifact/first-meet/first-meet.js
index e2906ca77..084712d47 100644
--- a/dist-artifact/first-meet/first-meet.js
+++ b/dist-artifact/first-meet/first-meet.js
@@ -282,6 +282,7 @@ async function persistState() {
});
// 2. Create or update agent
+ const agentMeta = { voice: state.voice, bodyType: state.bodyType };
if (!state.agent) {
// POST new agent
const res = await fetch('/api/agents', {
@@ -292,6 +293,7 @@ async function persistState() {
name: state.name,
description: state.bio,
avatar_id: state.avatarId,
+ meta: agentMeta,
}),
});
if (!res.ok) throw new Error(`Agent creation failed: ${res.status}`);
@@ -307,6 +309,7 @@ async function persistState() {
name: state.name,
description: state.bio,
avatar_id: state.avatarId,
+ meta: agentMeta,
}),
});
if (!res.ok) throw new Error(`Agent update failed: ${res.status}`);
diff --git a/dist-artifact/lobehub/plugin.json b/dist-artifact/lobehub/plugin.json
new file mode 100644
index 000000000..315832063
--- /dev/null
+++ b/dist-artifact/lobehub/plugin.json
@@ -0,0 +1,98 @@
+{
+ "$schema": "https://lobehub.com/schema/plugin-manifest/v1.json",
+ "identifier": "3d-agent",
+ "version": "0.1.0",
+ "author": "3D Agent",
+ "homepage": "https://3dagent.vercel.app",
+ "meta": {
+ "title": "3D Agent",
+ "description": "Embodied 3D avatar agent with continuous emotion blending. Renders a rigged glTF avatar inside chat, responds with gestures, speech, and on-chain ERC-8004 identity.",
+ "avatar": "https://3dagent.vercel.app/icon.svg",
+ "tags": ["3d", "avatar", "agent", "embodied", "empathy", "erc-8004"]
+ },
+ "ui": {
+ "url": "https://3dagent.vercel.app/lobehub/iframe/",
+ "height": 480
+ },
+ "api": [
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "render_agent",
+ "description": "Mount the 3D avatar for a given agent id. Call this first to bind the iframe to a specific agent before using speak/gesture/emote.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "agentId": {
+ "type": "string",
+ "description": "Agent identity id (UUID) to render."
+ }
+ },
+ "required": ["agentId"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "speak",
+ "description": "Make the avatar speak with optional emotional valence.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "text": {
+ "type": "string",
+ "description": "Text for the avatar to speak aloud."
+ },
+ "sentiment": {
+ "type": "number",
+ "description": "Emotional valence in [-1, 1]. Negative → concern, positive → celebration.",
+ "minimum": -1,
+ "maximum": 1
+ }
+ },
+ "required": ["text"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "gesture",
+ "description": "Trigger a named gesture on the avatar.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Gesture to play.",
+ "enum": ["wave", "nod", "point", "shrug"]
+ },
+ "duration": {
+ "type": "number",
+ "description": "Gesture duration in seconds (optional)."
+ }
+ },
+ "required": ["name"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "emote",
+ "description": "Inject an emotion into the avatar's continuous Empathy Layer blend.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "trigger": {
+ "type": "string",
+ "description": "Emotion to inject.",
+ "enum": ["concern", "celebration", "patience", "curiosity", "empathy"]
+ },
+ "weight": {
+ "type": "number",
+ "description": "Blend weight in [0, 1] (defaults to 1).",
+ "minimum": 0,
+ "maximum": 1
+ }
+ },
+ "required": ["trigger"]
+ }
+ }
+ ],
+ "systemRole": "You have an embodied 3D avatar agent visible in the chat. It displays emotional responses in real time using a continuous Empathy Layer blend. Use render_agent to bind it to a specific agent, speak to give it voice with emotional valence, gesture for physical expression, and emote to inject emotional state directly into its blend."
+}
diff --git a/dist-artifact/reputation/index.html b/dist-artifact/reputation/index.html
index 01f8c0b7b..bb0368c1d 100644
--- a/dist-artifact/reputation/index.html
+++ b/dist-artifact/reputation/index.html
@@ -452,19 +452,19 @@
</main>
<script type="module">
- import { ReputationDashboard } from '/src/reputation-ui.js';
+ import { ReputationDashboard } from '/src/reputation-ui.js';
- function getQueryParam(name) {
- const params = new URLSearchParams(window.location.search);
- return params.get(name);
- }
+ function getQueryParam(name) {
+ const params = new URLSearchParams(window.location.search);
+ return params.get(name);
+ }
- async function init() {
- const agentId = getQueryParam('agent');
- const chainId = getQueryParam('chain');
+ async function init() {
+ const agentId = getQueryParam('agent');
+ const chainId = getQueryParam('chain');
- if (!agentId) {
- document.querySelector('#app').innerHTML = `
+ if (!agentId) {
+ document.querySelector('#app').innerHTML = `
<div class="rep-error">
<h3>Missing agent ID</h3>
<p>URL parameter required: ?agent=&lt;id&gt;&amp;chain=&lt;chainId&gt;</p>
@@ -473,30 +473,30 @@
</p>
</div>
`;
- return;
- }
+ return;
+ }
- const resolvedChainId = chainId ? Number(chainId) : 84532; // Default: Base Sepolia
+ const resolvedChainId = chainId ? Number(chainId) : 84532; // Default: Base Sepolia
- const app = document.querySelector('#app');
- const dashboard = new ReputationDashboard(app, {
- agentId: Number(agentId),
- chainId: resolvedChainId,
- });
+ const app = document.querySelector('#app');
+ const dashboard = new ReputationDashboard(app, {
+ agentId: Number(agentId),
+ chainId: resolvedChainId,
+ });
- await dashboard.load();
- }
+ await dashboard.load();
+ }
- init().catch((err) => {
- console.error('Init failed:', err);
- document.querySelector('#app').innerHTML = `
+ init().catch((err) => {
+ console.error('Init failed:', err);
+ document.querySelector('#app').innerHTML = `
<div class="rep-error">
<h3>Failed to initialize</h3>
<p>${err.message || String(err)}</p>
<button onclick="location.reload()">Retry</button>
</div>
`;
- });
- </script>
+ });
+ </script>
</body>
</html>
diff --git a/dist-lib/.well-known/lobehub-plugin.json b/dist-lib/.well-known/lobehub-plugin.json
new file mode 100644
index 000000000..64bef564b
--- /dev/null
+++ b/dist-lib/.well-known/lobehub-plugin.json
@@ -0,0 +1,95 @@
+{
+ "$schema": "https://lobehub.com/schema/plugin-manifest/v1.json",
+ "identifier": "3d-agent",
+ "version": "1.0.0",
+ "author": "3D Agent",
+ "createdAt": "2026-04-17",
+ "homepage": "https://3dagent.vercel.app",
+ "meta": {
+ "title": "3D Agent",
+ "description": "Embed any on-chain or off-chain 3D agent as an embodied avatar inside your chat.",
+ "avatar": "https://3dagent.vercel.app/favicon.png",
+ "tags": ["3d", "avatar", "embodied-agent", "erc-8004"]
+ },
+ "ui": {
+ "url": "https://3dagent.vercel.app/lobehub/iframe/",
+ "height": 640,
+ "settings": {
+ "agentId": {
+ "type": "string",
+ "title": "Agent ID",
+ "description": "Paste a 3D Agent ID or ENS name"
+ }
+ }
+ },
+ "api": [
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "render_agent",
+ "description": "Mount the 3D avatar for a given agent id.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "agentId": {
+ "type": "string",
+ "description": "Agent identity id (UUID) to render."
+ }
+ },
+ "required": ["agentId"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "speak",
+ "description": "Make the avatar speak with optional emotional valence.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "text": {
+ "type": "string",
+ "description": "Text for the avatar to speak aloud."
+ },
+ "sentiment": {
+ "type": "number",
+ "description": "Emotional valence in [-1, 1].",
+ "minimum": -1,
+ "maximum": 1
+ }
+ },
+ "required": ["text"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "gesture",
+ "description": "Trigger a named gesture on the avatar.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "enum": ["wave", "nod", "point", "shrug"]
+ }
+ },
+ "required": ["name"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "emote",
+ "description": "Inject an emotion into the avatar's Empathy Layer blend.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "trigger": {
+ "type": "string",
+ "enum": ["concern", "celebration", "patience", "curiosity", "empathy"]
+ },
+ "weight": { "type": "number", "minimum": 0, "maximum": 1 }
+ },
+ "required": ["trigger"]
+ }
+ }
+ ],
+ "systemRole": "You have an embodied 3D avatar agent visible in the chat. Use render_agent to bind it to a specific agent, speak to give it voice with emotional valence, gesture for physical expression, and emote to inject emotional state into its blend."
+}
diff --git a/dist-lib/agent-3d.js b/dist-lib/agent-3d.js
index eaa6b600e..845f62cc5 100644
--- a/dist-lib/agent-3d.js
+++ b/dist-lib/agent-3d.js
@@ -1,4 +1,4 @@
-const wa = { ROTATE: 0, DOLLY: 1, PAN: 2 }, Aa = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, $E = 0, Lp = 1, ey = 2, d0 = 1, ty = 2, $i = 3, bs = 0, Vn = 1, Ui = 2, Gs = 0, va = 1, Pp = 2, kp = 3, Up = 4, ny = 5, pr = 100, iy = 101, sy = 102, ry = 103, ay = 104, oy = 200, cy = 201, ly = 202, hy = 203, ld = 204, hd = 205, uy = 206, dy = 207, fy = 208, py = 209, Ay = 210, gy = 211, my = 212, xy = 213, by = 214, ud = 0, dd = 1, fd = 2, Na = 3, pd = 4, Ad = 5, gd = 6, md = 7, hh = 0, Ey = 1, yy = 2, Hs = 0, xd = 1, _y = 2, wy = 3, f0 = 4, vy = 5, Cy = 6, Iy = 7, Op = "attached", Sy = "detached", p0 = 300, Br = 301, Da = 302, Dl = 303, bd = 304, uh = 306, Ws = 1e3, ti = 1001, Ll = 1002, Wn = 1003, A0 = 1004, yo = 1005, Xt = 1006, vl = 1007, hi = 1008, un = 1009, g0 = 1010, m0 = 1011, Qo = 1012, Lf = 1013, Tr = 1014, fn = 1015, Qn = 1016, Pf = 1017, kf = 1018, Go = 1020, x0 = 35902, b0 = 1021, E0 = 1022, pn = 1023, Ho = 1026, zo = 1027, cs = 1028, Uf = 1029, Er = 1030, Of = 1031, Qf = 1033, Cl = 33776, Bo = 33777, Il = 33778, To = 33779, Pl = 35840, Ed = 35841, kl = 35842, yd = 35843, Ul = 36196, Ol = 37492, Ql = 37496, Vo = 37808, _d = 37809, wd = 37810, vd = 37811, Wo = 37812, Cd = 37813, Id = 37814, Sd = 37815, Md = 37816, Bd = 37817, Td = 37818, Rd = 37819, Fd = 37820, Nd = 37821, Ro = 36492, Dd = 36494, Gl = 36495, y0 = 36283, Ld = 36284, Pd = 36285, kd = 36286, _0 = 2200, w0 = 2201, My = 2202, qo = 2300, Ko = 2301, Qh = 2302, ga = 2400, ma = 2401, Hl = 2402, Gf = 2500, By = 2501, Ty = 0, v0 = 1, Ud = 2, Ry = 3200, Fy = 3201, dh = 0, Ny = 1, vi = "", _t = "srgb", An = "srgb-linear", zl = "linear", Rt = "srgb", qr = 7680, Qp = 519, Dy = 512, Ly = 513, Py = 514, C0 = 515, ky = 516, Uy = 517, Oy = 518, Qy = 519, Od = 35044, Gp = "300 es", ls = 2e3, Vl = 2001;
+const va = { ROTATE: 0, DOLLY: 1, PAN: 2 }, ga = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, ey = 0, kp = 1, ty = 2, f0 = 1, ny = 2, es = 3, bs = 0, Wn = 1, Oi = 2, Gs = 0, Ca = 1, Up = 2, Op = 3, Qp = 4, iy = 5, pr = 100, sy = 101, ry = 102, ay = 103, oy = 104, cy = 200, ly = 201, hy = 202, uy = 203, ud = 204, dd = 205, dy = 206, fy = 207, py = 208, Ay = 209, gy = 210, my = 211, xy = 212, by = 213, Ey = 214, fd = 0, pd = 1, Ad = 2, Da = 3, gd = 4, md = 5, xd = 6, bd = 7, dh = 0, yy = 1, _y = 2, Hs = 0, Ed = 1, wy = 2, vy = 3, p0 = 4, Cy = 5, Iy = 6, Sy = 7, Gp = "attached", My = "detached", A0 = 300, Br = 301, La = 302, Pl = 303, yd = 304, fh = 306, Ws = 1e3, ni = 1001, kl = 1002, qn = 1003, g0 = 1004, _o = 1005, Xt = 1006, Il = 1007, ui = 1008, un = 1009, m0 = 1010, x0 = 1011, Go = 1012, kf = 1013, Tr = 1014, fn = 1015, Gn = 1016, Uf = 1017, Of = 1018, Ho = 1020, b0 = 35902, E0 = 1021, y0 = 1022, pn = 1023, zo = 1026, Vo = 1027, cs = 1028, Qf = 1029, Er = 1030, Gf = 1031, Hf = 1033, Sl = 33776, To = 33777, Ml = 33778, Ro = 33779, Ul = 35840, _d = 35841, Ol = 35842, wd = 35843, Ql = 36196, Gl = 37492, Hl = 37496, Wo = 37808, vd = 37809, Cd = 37810, Id = 37811, qo = 37812, Sd = 37813, Md = 37814, Bd = 37815, Td = 37816, Rd = 37817, Fd = 37818, Nd = 37819, Dd = 37820, Ld = 37821, Fo = 36492, Pd = 36494, zl = 36495, _0 = 36283, kd = 36284, Ud = 36285, Od = 36286, w0 = 2200, v0 = 2201, By = 2202, Ko = 2300, jo = 2301, Hh = 2302, ma = 2400, xa = 2401, Vl = 2402, zf = 2500, Ty = 2501, Ry = 0, C0 = 1, Qd = 2, Fy = 3200, Ny = 3201, ph = 0, Dy = 1, Ci = "", _t = "srgb", An = "srgb-linear", Wl = "linear", Rt = "srgb", qr = 7680, Hp = 519, Ly = 512, Py = 513, ky = 514, I0 = 515, Uy = 516, Oy = 517, Qy = 518, Gy = 519, Gd = 35044, zp = "300 es", ls = 2e3, ql = 2001;
class Js {
/**
* Adds the given event listener to the given event type.
@@ -56,69 +56,69 @@ class Js {
}
}
const Rn = ["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"];
-let Hp = 1234567;
-const Fo = Math.PI / 180, La = 180 / Math.PI;
-function Mi() {
+let Vp = 1234567;
+const No = Math.PI / 180, Pa = 180 / Math.PI;
+function Bi() {
const i = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0;
return (Rn[i & 255] + Rn[i >> 8 & 255] + Rn[i >> 16 & 255] + Rn[i >> 24 & 255] + "-" + Rn[e & 255] + Rn[e >> 8 & 255] + "-" + Rn[e >> 16 & 15 | 64] + Rn[e >> 24 & 255] + "-" + Rn[t & 63 | 128] + Rn[t >> 8 & 255] + "-" + Rn[t >> 16 & 255] + Rn[t >> 24 & 255] + Rn[n & 255] + Rn[n >> 8 & 255] + Rn[n >> 16 & 255] + Rn[n >> 24 & 255]).toLowerCase();
}
function ot(i, e, t) {
return Math.max(e, Math.min(t, i));
}
-function Hf(i, e) {
+function Vf(i, e) {
return (i % e + e) % e;
}
-function Gy(i, e, t, n, s) {
+function Hy(i, e, t, n, s) {
return n + (i - e) * (s - n) / (t - e);
}
-function Hy(i, e, t) {
+function zy(i, e, t) {
return i !== e ? (t - i) / (e - i) : 0;
}
-function No(i, e, t) {
+function Do(i, e, t) {
return (1 - t) * i + t * e;
}
-function zy(i, e, t, n) {
- return No(i, e, 1 - Math.exp(-t * n));
+function Vy(i, e, t, n) {
+ return Do(i, e, 1 - Math.exp(-t * n));
}
-function Vy(i, e = 1) {
- return e - Math.abs(Hf(i, e * 2) - e);
+function Wy(i, e = 1) {
+ return e - Math.abs(Vf(i, e * 2) - e);
}
-function Wy(i, e, t) {
+function qy(i, e, t) {
return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * (3 - 2 * i));
}
-function qy(i, e, t) {
+function Ky(i, e, t) {
return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * i * (i * (i * 6 - 15) + 10));
}
-function Ky(i, e) {
+function jy(i, e) {
return i + Math.floor(Math.random() * (e - i + 1));
}
-function jy(i, e) {
+function Xy(i, e) {
return i + Math.random() * (e - i);
}
-function Xy(i) {
- return i * (0.5 - Math.random());
-}
function Yy(i) {
- i !== void 0 && (Hp = i);
- let e = Hp += 1831565813;
- return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
+ return i * (0.5 - Math.random());
}
function Jy(i) {
- return i * Fo;
+ i !== void 0 && (Vp = i);
+ let e = Vp += 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 Zy(i) {
- return i * La;
+ return i * No;
}
function $y(i) {
- return (i & i - 1) === 0 && i !== 0;
+ return i * Pa;
}
function e_(i) {
- return Math.pow(2, Math.ceil(Math.log(i) / Math.LN2));
+ return (i & i - 1) === 0 && i !== 0;
}
function t_(i) {
+ return Math.pow(2, Math.ceil(Math.log(i) / Math.LN2));
+}
+function n_(i) {
return Math.pow(2, Math.floor(Math.log(i) / Math.LN2));
}
-function n_(i, e, t, n, s) {
+function i_(i, e, t, n, s) {
const 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), p = a((n - e) / 2);
switch (s) {
case "XYX":
@@ -143,7 +143,7 @@ function n_(i, e, t, n, s) {
console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + s);
}
}
-function Ci(i, e) {
+function Ii(i, e) {
switch (e.constructor) {
case Float32Array:
return i;
@@ -184,8 +184,8 @@ function Bt(i, e) {
}
}
const Cn = {
- DEG2RAD: Fo,
- RAD2DEG: La,
+ DEG2RAD: No,
+ RAD2DEG: Pa,
/**
* Generate a [UUID]{@link https://en.wikipedia.org/wiki/Universally_unique_identifier}
* (universally unique identifier).
@@ -194,7 +194,7 @@ const Cn = {
* @method
* @return {string} The UUID.
*/
- generateUUID: Mi,
+ generateUUID: Bi,
/**
* Clamps the given value between min and max.
*
@@ -216,7 +216,7 @@ const Cn = {
* @param {number} m - The second parameter.
* @return {number} The Euclidean modulo.
*/
- euclideanModulo: Hf,
+ euclideanModulo: Vf,
/**
* Performs a linear mapping from range `<a1, a2>` to range `<b1, b2>`
* for the given value.
@@ -230,7 +230,7 @@ const Cn = {
* @param {number} b2 - Maximum value for range B.
* @return {number} The mapped value.
*/
- mapLinear: Gy,
+ mapLinear: Hy,
/**
* Returns the percentage in the closed interval `[0, 1]` of the given value
* between the start and end point.
@@ -242,7 +242,7 @@ const Cn = {
* @param {number} value - A value between start and end.
* @return {number} The interpolation factor.
*/
- inverseLerp: Hy,
+ inverseLerp: zy,
/**
* Returns a value linearly interpolated from two known points based on the given interval -
* `t = 0` will return `x` and `t = 1` will return `y`.
@@ -254,7 +254,7 @@ const Cn = {
* @param {number} t - The interpolation factor in the closed interval `[0, 1]`.
* @return {number} The interpolated value.
*/
- lerp: No,
+ lerp: Do,
/**
* Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta
* time to maintain frame rate independent movement. For details, see
@@ -269,7 +269,7 @@ const Cn = {
* @param {number} dt - Delta time in seconds.
* @return {number} The interpolated value.
*/
- damp: zy,
+ damp: Vy,
/**
* Returns a value that alternates between `0` and the given `length` parameter.
*
@@ -279,7 +279,7 @@ const Cn = {
* @param {number} [length=1] - The positive value the function will pingpong to.
* @return {number} The alternated value.
*/
- pingpong: Vy,
+ pingpong: Wy,
/**
* Returns a value in the range `[0,1]` that represents the percentage that `x` has
* moved between `min` and `max`, but smoothed or slowed down the closer `x` is to
@@ -294,7 +294,7 @@ const Cn = {
* @param {number} max - The max value. Any x value above max will be `1`.
* @return {number} The alternated value.
*/
- smoothstep: Wy,
+ smoothstep: qy,
/**
* A [variation on smoothstep]{@link https://en.wikipedia.org/wiki/Smoothstep#Variations}
* that has zero 1st and 2nd order derivatives at x=0 and x=1.
@@ -306,7 +306,7 @@ const Cn = {
* @param {number} max - The max value. Any x value above max will be `1`.
* @return {number} The alternated value.
*/
- smootherstep: qy,
+ smootherstep: Ky,
/**
* Returns a random integer from `<low, high>` interval.
*
@@ -316,7 +316,7 @@ const Cn = {
* @param {number} high - The upper value boundary
* @return {number} A random integer.
*/
- randInt: Ky,
+ randInt: jy,
/**
* Returns a random float from `<low, high>` interval.
*
@@ -326,7 +326,7 @@ const Cn = {
* @param {number} high - The upper value boundary
* @return {number} A random float.
*/
- randFloat: jy,
+ randFloat: Xy,
/**
* Returns a random integer from `<-range/2, range/2>` interval.
*
@@ -335,7 +335,7 @@ const Cn = {
* @param {number} range - Defines the value range.
* @return {number} A random float.
*/
- randFloatSpread: Xy,
+ randFloatSpread: Yy,
/**
* Returns a deterministic pseudo-random float in the interval `[0, 1]`.
*
@@ -344,7 +344,7 @@ const Cn = {
* @param {number} [s] - The integer seed.
* @return {number} A random float.
*/
- seededRandom: Yy,
+ seededRandom: Jy,
/**
* Converts degrees to radians.
*
@@ -353,7 +353,7 @@ const Cn = {
* @param {number} degrees - A value in degrees.
* @return {number} The converted value in radians.
*/
- degToRad: Jy,
+ degToRad: Zy,
/**
* Converts radians to degrees.
*
@@ -362,7 +362,7 @@ const Cn = {
* @param {number} radians - A value in radians.
* @return {number} The converted value in degrees.
*/
- radToDeg: Zy,
+ radToDeg: $y,
/**
* Returns `true` if the given number is a power of two.
*
@@ -371,7 +371,7 @@ const Cn = {
* @param {number} value - The value to check.
* @return {boolean} Whether the given number is a power of two or not.
*/
- isPowerOfTwo: $y,
+ isPowerOfTwo: e_,
/**
* Returns the smallest power of two that is greater than or equal to the given number.
*
@@ -380,7 +380,7 @@ const Cn = {
* @param {number} value - The value to find a POT for.
* @return {number} The smallest power of two that is greater than or equal to the given number.
*/
- ceilPowerOfTwo: e_,
+ ceilPowerOfTwo: t_,
/**
* Returns the largest power of two that is less than or equal to the given number.
*
@@ -389,7 +389,7 @@ const Cn = {
* @param {number} value - The value to find a POT for.
* @return {number} The largest power of two that is less than or equal to the given number.
*/
- floorPowerOfTwo: t_,
+ floorPowerOfTwo: n_,
/**
* Sets the given quaternion from the [Intrinsic Proper Euler Angles]{@link https://en.wikipedia.org/wiki/Euler_angles}
* defined by the given angles and order.
@@ -405,7 +405,7 @@ const Cn = {
* @param {number} c - The rotation applied to the third axis, in radians.
* @param {('XYX'|'XZX'|'YXY'|'YZY'|'ZXZ'|'ZYZ')} order - A string specifying the axes order.
*/
- setQuaternionFromProperEuler: n_,
+ setQuaternionFromProperEuler: i_,
/**
* Normalizes the given value according to the given typed array.
*
@@ -425,7 +425,7 @@ const Cn = {
* @param {TypedArray} array - The typed array that defines the data type of the value.
* @return {number} The denormalize (float) value in the range `[0,1]`.
*/
- denormalize: Ci
+ denormalize: Ii
};
class Ze {
/**
@@ -1199,7 +1199,7 @@ class at {
* @return {Matrix3} A reference to this matrix.
*/
scale(e, t) {
- return this.premultiply(Gh.makeScale(e, t)), this;
+ return this.premultiply(zh.makeScale(e, t)), this;
}
/**
* Rotates this matrix by the given angle.
@@ -1208,7 +1208,7 @@ class at {
* @return {Matrix3} A reference to this matrix.
*/
rotate(e) {
- return this.premultiply(Gh.makeRotation(-e)), this;
+ return this.premultiply(zh.makeRotation(-e)), this;
}
/**
* Translates this matrix by the given scalar values.
@@ -1218,7 +1218,7 @@ class at {
* @return {Matrix3} A reference to this matrix.
*/
translate(e, t) {
- return this.premultiply(Gh.makeTranslation(e, t)), this;
+ return this.premultiply(zh.makeTranslation(e, t)), this;
}
// for 2D Transforms
/**
@@ -1336,24 +1336,24 @@ class at {
return new this.constructor().fromArray(this.elements);
}
}
-const Gh = /* @__PURE__ */ new at();
-function I0(i) {
+const zh = /* @__PURE__ */ new at();
+function S0(i) {
for (let e = i.length - 1; e >= 0; --e)
if (i[e] >= 65535) return !0;
return !1;
}
-function jo(i) {
+function Xo(i) {
return document.createElementNS("http://www.w3.org/1999/xhtml", i);
}
-function i_() {
- const i = jo("canvas");
+function s_() {
+ const i = Xo("canvas");
return i.style.display = "block", i;
}
-const zp = {};
-function Sl(i) {
- i in zp || (zp[i] = !0, console.warn(i));
+const Wp = {};
+function Bl(i) {
+ i in Wp || (Wp[i] = !0, console.warn(i));
}
-function s_(i, e, t) {
+function r_(i, e, t) {
return new Promise(function(n, s) {
function r() {
switch (i.clientWaitSync(e, i.SYNC_FLUSH_COMMANDS_BIT, 0)) {
@@ -1370,15 +1370,15 @@ function s_(i, e, t) {
setTimeout(r, t);
});
}
-function r_(i) {
+function a_(i) {
const e = i.elements;
e[2] = 0.5 * e[2] + 0.5 * e[3], e[6] = 0.5 * e[6] + 0.5 * e[7], e[10] = 0.5 * e[10] + 0.5 * e[11], e[14] = 0.5 * e[14] + 0.5 * e[15];
}
-function a_(i) {
+function o_(i) {
const e = i.elements;
e[11] === -1 ? (e[10] = -e[10] - 1, e[14] = -e[14]) : (e[10] = -e[10], e[14] = -e[14] + 1);
}
-const Vp = /* @__PURE__ */ new at().set(
+const qp = /* @__PURE__ */ new at().set(
0.4123908,
0.3575843,
0.1804808,
@@ -1388,7 +1388,7 @@ const Vp = /* @__PURE__ */ new at().set(
0.0193308,
0.1191948,
0.9505322
-), Wp = /* @__PURE__ */ new at().set(
+), Kp = /* @__PURE__ */ new at().set(
3.2409699,
-1.5373832,
-0.4986108,
@@ -1399,7 +1399,7 @@ const Vp = /* @__PURE__ */ new at().set(
-0.203977,
1.0569715
);
-function o_() {
+function c_() {
const i = {
enabled: !0,
workingColorSpace: An,
@@ -1423,7 +1423,7 @@ function o_() {
*/
spaces: {},
convert: function(s, r, a) {
- return this.enabled === !1 || r === a || !r || !a || (this.spaces[r].transfer === Rt && (s.r = ps(s.r), s.g = ps(s.g), s.b = ps(s.b)), this.spaces[r].primaries !== this.spaces[a].primaries && (s.applyMatrix3(this.spaces[r].toXYZ), s.applyMatrix3(this.spaces[a].fromXYZ)), this.spaces[a].transfer === Rt && (s.r = Ca(s.r), s.g = Ca(s.g), s.b = Ca(s.b))), s;
+ return this.enabled === !1 || r === a || !r || !a || (this.spaces[r].transfer === Rt && (s.r = ps(s.r), s.g = ps(s.g), s.b = ps(s.b)), this.spaces[r].primaries !== this.spaces[a].primaries && (s.applyMatrix3(this.spaces[r].toXYZ), s.applyMatrix3(this.spaces[a].fromXYZ)), this.spaces[a].transfer === Rt && (s.r = Ia(s.r), s.g = Ia(s.g), s.b = Ia(s.b))), s;
},
fromWorkingColorSpace: function(s, r) {
return this.convert(s, this.workingColorSpace, r);
@@ -1435,7 +1435,7 @@ function o_() {
return this.spaces[s].primaries;
},
getTransfer: function(s) {
- return s === vi ? zl : this.spaces[s].transfer;
+ return s === Ci ? Wl : this.spaces[s].transfer;
},
getLuminanceCoefficients: function(s, r = this.workingColorSpace) {
return s.fromArray(this.spaces[r].luminanceCoefficients);
@@ -1458,9 +1458,9 @@ function o_() {
[An]: {
primaries: e,
whitePoint: n,
- transfer: zl,
- toXYZ: Vp,
- fromXYZ: Wp,
+ transfer: Wl,
+ toXYZ: qp,
+ fromXYZ: Kp,
luminanceCoefficients: t,
workingColorSpaceConfig: { unpackColorSpace: _t },
outputColorSpaceConfig: { drawingBufferColorSpace: _t }
@@ -1469,22 +1469,22 @@ function o_() {
primaries: e,
whitePoint: n,
transfer: Rt,
- toXYZ: Vp,
- fromXYZ: Wp,
+ toXYZ: qp,
+ fromXYZ: Kp,
luminanceCoefficients: t,
outputColorSpaceConfig: { drawingBufferColorSpace: _t }
}
}), i;
}
-const rt = /* @__PURE__ */ o_();
+const rt = /* @__PURE__ */ c_();
function ps(i) {
return i < 0.04045 ? i * 0.0773993808 : Math.pow(i * 0.9478672986 + 0.0521327014, 2.4);
}
-function Ca(i) {
+function Ia(i) {
return i < 31308e-7 ? i * 12.92 : 1.055 * Math.pow(i, 0.41666) - 0.055;
}
let Kr;
-class c_ {
+class l_ {
/**
* Returns a data URI containing a representation of the given image.
*
@@ -1499,7 +1499,7 @@ class c_ {
if (e instanceof HTMLCanvasElement)
n = e;
else {
- Kr === void 0 && (Kr = jo("canvas")), Kr.width = e.width, Kr.height = e.height;
+ Kr === void 0 && (Kr = Xo("canvas")), Kr.width = e.width, Kr.height = e.height;
const s = Kr.getContext("2d");
e instanceof ImageData ? s.putImageData(e, 0, 0) : s.drawImage(e, 0, 0, e.width, e.height), n = Kr;
}
@@ -1513,7 +1513,7 @@ class c_ {
*/
static sRGBToLinear(e) {
if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap) {
- const t = jo("canvas");
+ const t = Xo("canvas");
t.width = e.width, t.height = e.height;
const n = t.getContext("2d");
n.drawImage(e, 0, 0, e.width, e.height);
@@ -1534,15 +1534,15 @@ class c_ {
return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
}
}
-let l_ = 0;
-class zf {
+let h_ = 0;
+class Wf {
/**
* Constructs a new video texture.
*
* @param {any} [data=null] - The data definition of a texture.
*/
constructor(e = null) {
- this.isSource = !0, Object.defineProperty(this, "id", { value: l_++ }), this.uuid = Mi(), this.data = e, this.dataReady = !0, this.version = 0;
+ this.isSource = !0, Object.defineProperty(this, "id", { value: h_++ }), this.uuid = Bi(), this.data = e, this.dataReady = !0, this.version = 0;
}
/**
* When the property is set to `true`, the engine allocates the memory
@@ -1576,23 +1576,23 @@ class zf {
if (Array.isArray(s)) {
r = [];
for (let a = 0, o = s.length; a < o; a++)
- s[a].isDataTexture ? r.push(Hh(s[a].image)) : r.push(Hh(s[a]));
+ s[a].isDataTexture ? r.push(Vh(s[a].image)) : r.push(Vh(s[a]));
} else
- r = Hh(s);
+ r = Vh(s);
n.url = r;
}
return t || (e.images[this.uuid] = n), n;
}
}
-function Hh(i) {
- return typeof HTMLImageElement < "u" && i instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && i instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && i instanceof ImageBitmap ? c_.getDataURL(i) : i.data ? {
+function Vh(i) {
+ return typeof HTMLImageElement < "u" && i instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && i instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && i instanceof ImageBitmap ? l_.getDataURL(i) : i.data ? {
data: Array.from(i.data),
width: i.width,
height: i.height,
type: i.data.constructor.name
} : (console.warn("THREE.Texture: Unable to serialize Texture."), {});
}
-let h_ = 0;
+let u_ = 0;
class an extends Js {
/**
* Constructs a new texture.
@@ -1608,8 +1608,8 @@ class an extends Js {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space.
*/
- constructor(e = an.DEFAULT_IMAGE, t = an.DEFAULT_MAPPING, n = ti, s = ti, r = Xt, a = hi, o = pn, c = un, l = an.DEFAULT_ANISOTROPY, h = vi) {
- super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: h_++ }), this.uuid = Mi(), this.name = "", this.source = new zf(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = n, this.wrapT = s, this.magFilter = r, this.minFilter = a, this.anisotropy = l, this.format = o, this.internalFormat = null, this.type = c, this.offset = new Ze(0, 0), this.repeat = new Ze(1, 1), this.center = new Ze(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new at(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = h, this.userData = {}, this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isTextureArray = !1, this.pmremVersion = 0;
+ constructor(e = an.DEFAULT_IMAGE, t = an.DEFAULT_MAPPING, n = ni, s = ni, r = Xt, a = ui, o = pn, c = un, l = an.DEFAULT_ANISOTROPY, h = Ci) {
+ super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: u_++ }), this.uuid = Bi(), this.name = "", this.source = new Wf(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = n, this.wrapT = s, this.magFilter = r, this.minFilter = a, this.anisotropy = l, this.format = o, this.internalFormat = null, this.type = c, this.offset = new Ze(0, 0), this.repeat = new Ze(1, 1), this.center = new Ze(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new at(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = h, this.userData = {}, this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isTextureArray = !1, this.pmremVersion = 0;
}
/**
* The image object holding the texture data.
@@ -1703,16 +1703,16 @@ class an extends Js {
* @return {Vector2} The transformed uv vector.
*/
transformUv(e) {
- if (this.mapping !== p0) return e;
+ if (this.mapping !== A0) return e;
if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)
switch (this.wrapS) {
case Ws:
e.x = e.x - Math.floor(e.x);
break;
- case ti:
+ case ni:
e.x = e.x < 0 ? 0 : 1;
break;
- case Ll:
+ case kl:
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;
}
@@ -1721,10 +1721,10 @@ class an extends Js {
case Ws:
e.y = e.y - Math.floor(e.y);
break;
- case ti:
+ case ni:
e.y = e.y < 0 ? 0 : 1;
break;
- case Ll:
+ case kl:
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;
}
@@ -1755,7 +1755,7 @@ class an extends Js {
}
}
an.DEFAULT_IMAGE = null;
-an.DEFAULT_MAPPING = p0;
+an.DEFAULT_MAPPING = A0;
an.DEFAULT_ANISOTROPY = 1;
class mt {
/**
@@ -2302,7 +2302,7 @@ class mt {
yield this.x, yield this.y, yield this.z, yield this.w;
}
}
-class u_ extends Js {
+class d_ extends Js {
/**
* Render target options.
*
@@ -2418,7 +2418,7 @@ class u_ extends Js {
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;
const s = Object.assign({}, e.textures[t].image);
- this.textures[t].source = new zf(s);
+ this.textures[t].source = new Wf(s);
}
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;
}
@@ -2432,7 +2432,7 @@ class u_ extends Js {
this.dispatchEvent({ type: "dispose" });
}
}
-class Rr extends u_ {
+class Rr extends d_ {
/**
* Constructs a new 3D render target.
*
@@ -2444,7 +2444,7 @@ class Rr extends u_ {
super(e, t, n), this.isWebGLRenderTarget = !0;
}
}
-class S0 extends an {
+class M0 extends an {
/**
* Constructs a new data array texture.
*
@@ -2454,7 +2454,7 @@ class S0 extends an {
* @param {number} [depth=1] - The depth of the texture.
*/
constructor(e = null, t = 1, n = 1, s = 1) {
- super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Wn, this.minFilter = Wn, this.wrapR = ti, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();
+ super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = qn, this.minFilter = qn, this.wrapR = ni, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();
}
/**
* Describes that a specific layer of the texture needs to be updated.
@@ -2475,7 +2475,7 @@ class S0 extends an {
this.layerUpdates.clear();
}
}
-class M0 extends an {
+class B0 extends an {
/**
* Constructs a new data array texture.
*
@@ -2485,7 +2485,7 @@ class M0 extends an {
* @param {number} [depth=1] - The depth of the texture.
*/
constructor(e = null, t = 1, n = 1, s = 1) {
- super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Wn, this.minFilter = Wn, this.wrapR = ti, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
+ super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = qn, this.minFilter = qn, this.wrapR = ni, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}
class Jt {
@@ -3155,7 +3155,7 @@ class G {
* @return {Vector3} A reference to this vector.
*/
applyEuler(e) {
- return this.applyQuaternion(qp.setFromEuler(e));
+ return this.applyQuaternion(jp.setFromEuler(e));
}
/**
* Applies a rotation specified by an axis and an angle to this vector.
@@ -3165,7 +3165,7 @@ class G {
* @return {Vector3} A reference to this vector.
*/
applyAxisAngle(e, t) {
- return this.applyQuaternion(qp.setFromAxisAngle(e, t));
+ return this.applyQuaternion(jp.setFromAxisAngle(e, t));
}
/**
* Multiplies this vector with the given 3x3 matrix.
@@ -3479,7 +3479,7 @@ class G {
* @return {Vector3} A reference to this vector.
*/
projectOnPlane(e) {
- return zh.copy(this).projectOnVector(e), this.sub(zh);
+ return Wh.copy(this).projectOnVector(e), this.sub(Wh);
}
/**
* Reflects this vector off a plane orthogonal to the given normal vector.
@@ -3488,7 +3488,7 @@ class G {
* @return {Vector3} A reference to this vector.
*/
reflect(e) {
- return this.sub(zh.copy(e).multiplyScalar(2 * this.dot(e)));
+ return this.sub(Wh.copy(e).multiplyScalar(2 * this.dot(e)));
}
/**
* Returns the angle between the given vector and this instance in radians.
@@ -3697,8 +3697,8 @@ class G {
yield this.x, yield this.y, yield this.z;
}
}
-const zh = /* @__PURE__ */ new G(), qp = /* @__PURE__ */ new Jt();
-class Hi {
+const Wh = /* @__PURE__ */ new G(), jp = /* @__PURE__ */ new Jt();
+class zi {
/**
* Constructs a new bounding box.
*
@@ -3729,7 +3729,7 @@ class Hi {
setFromArray(e) {
this.makeEmpty();
for (let t = 0, n = e.length; t < n; t += 3)
- this.expandByPoint(gi.fromArray(e, t));
+ this.expandByPoint(mi.fromArray(e, t));
return this;
}
/**
@@ -3742,7 +3742,7 @@ class Hi {
setFromBufferAttribute(e) {
this.makeEmpty();
for (let t = 0, n = e.count; t < n; t++)
- this.expandByPoint(gi.fromBufferAttribute(e, t));
+ this.expandByPoint(mi.fromBufferAttribute(e, t));
return this;
}
/**
@@ -3767,7 +3767,7 @@ class Hi {
* @return {Box3} A reference to this bounding box.
*/
setFromCenterAndSize(e, t) {
- const n = gi.copy(t).multiplyScalar(0.5);
+ const n = mi.copy(t).multiplyScalar(0.5);
return this.min.copy(e).sub(n), this.max.copy(e).add(n), this;
}
/**
@@ -3886,9 +3886,9 @@ class Hi {
const 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, gi) : gi.fromBufferAttribute(r, a), gi.applyMatrix4(e.matrixWorld), this.expandByPoint(gi);
+ e.isMesh === !0 ? e.getVertexPosition(a, mi) : mi.fromBufferAttribute(r, a), mi.applyMatrix4(e.matrixWorld), this.expandByPoint(mi);
else
- e.boundingBox !== void 0 ? (e.boundingBox === null && e.computeBoundingBox(), Ic.copy(e.boundingBox)) : (n.boundingBox === null && n.computeBoundingBox(), Ic.copy(n.boundingBox)), Ic.applyMatrix4(e.matrixWorld), this.union(Ic);
+ e.boundingBox !== void 0 ? (e.boundingBox === null && e.computeBoundingBox(), Sc.copy(e.boundingBox)) : (n.boundingBox === null && n.computeBoundingBox(), Sc.copy(n.boundingBox)), Sc.applyMatrix4(e.matrixWorld), this.union(Sc);
}
const s = e.children;
for (let r = 0, a = s.length; r < a; r++)
@@ -3944,7 +3944,7 @@ class Hi {
* @return {boolean} Whether the given bounding sphere intersects with this bounding box.
*/
intersectsSphere(e) {
- return this.clampPoint(e.center, gi), gi.distanceToSquared(e.center) <= e.radius * e.radius;
+ return this.clampPoint(e.center, mi), mi.distanceToSquared(e.center) <= e.radius * e.radius;
}
/**
* Returns `true` if the given plane intersects with this bounding box.
@@ -3965,7 +3965,7 @@ class Hi {
intersectsTriangle(e) {
if (this.isEmpty())
return !1;
- this.getCenter(io), Sc.subVectors(this.max, io), jr.subVectors(e.a, io), Xr.subVectors(e.b, io), Yr.subVectors(e.c, io), vs.subVectors(Xr, jr), Cs.subVectors(Yr, Xr), nr.subVectors(jr, Yr);
+ this.getCenter(so), Mc.subVectors(this.max, so), jr.subVectors(e.a, so), Xr.subVectors(e.b, so), Yr.subVectors(e.c, so), vs.subVectors(Xr, jr), Cs.subVectors(Yr, Xr), nr.subVectors(jr, Yr);
let t = [
0,
-vs.z,
@@ -3995,7 +3995,7 @@ class Hi {
nr.x,
0
];
- return !Vh(t, jr, Xr, Yr, Sc) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !Vh(t, jr, Xr, Yr, Sc)) ? !1 : (Mc.crossVectors(vs, Cs), t = [Mc.x, Mc.y, Mc.z], Vh(t, jr, Xr, Yr, Sc));
+ return !qh(t, jr, Xr, Yr, Mc) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !qh(t, jr, Xr, Yr, Mc)) ? !1 : (Bc.crossVectors(vs, Cs), t = [Bc.x, Bc.y, Bc.z], qh(t, jr, Xr, Yr, Mc));
}
/**
* Clamps the given point within the bounds of this box.
@@ -4015,7 +4015,7 @@ class Hi {
* @return {number} The euclidean distance.
*/
distanceToPoint(e) {
- return this.clampPoint(e, gi).distanceTo(e);
+ return this.clampPoint(e, mi).distanceTo(e);
}
/**
* Returns a bounding sphere that encloses this bounding box.
@@ -4024,7 +4024,7 @@ class Hi {
* @return {Sphere} The bounding sphere that encloses this bounding box.
*/
getBoundingSphere(e) {
- return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = this.getSize(gi).length() * 0.5), e;
+ return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = this.getSize(mi).length() * 0.5), e;
}
/**
* Computes the intersection of this bounding box and the given one, setting the upper
@@ -4056,7 +4056,7 @@ class Hi {
* @return {Box3} A reference to this bounding box.
*/
applyMatrix4(e) {
- return this.isEmpty() ? this : (Ki[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Ki[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Ki[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Ki[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Ki[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Ki[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Ki[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Ki[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Ki), this);
+ return this.isEmpty() ? this : (ji[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), ji[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), ji[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), ji[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), ji[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), ji[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), ji[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), ji[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(ji), this);
}
/**
* Adds the given offset to both the upper and lower bounds of this bounding box,
@@ -4078,7 +4078,7 @@ class Hi {
return e.min.equals(this.min) && e.max.equals(this.max);
}
}
-const Ki = [
+const ji = [
/* @__PURE__ */ new G(),
/* @__PURE__ */ new G(),
/* @__PURE__ */ new G(),
@@ -4087,8 +4087,8 @@ const Ki = [
/* @__PURE__ */ new G(),
/* @__PURE__ */ new G(),
/* @__PURE__ */ new G()
-], gi = /* @__PURE__ */ new G(), Ic = /* @__PURE__ */ new Hi(), jr = /* @__PURE__ */ new G(), Xr = /* @__PURE__ */ new G(), Yr = /* @__PURE__ */ new G(), vs = /* @__PURE__ */ new G(), Cs = /* @__PURE__ */ new G(), nr = /* @__PURE__ */ new G(), io = /* @__PURE__ */ new G(), Sc = /* @__PURE__ */ new G(), Mc = /* @__PURE__ */ new G(), ir = /* @__PURE__ */ new G();
-function Vh(i, e, t, n, s) {
+], mi = /* @__PURE__ */ new G(), Sc = /* @__PURE__ */ new zi(), jr = /* @__PURE__ */ new G(), Xr = /* @__PURE__ */ new G(), Yr = /* @__PURE__ */ new G(), vs = /* @__PURE__ */ new G(), Cs = /* @__PURE__ */ new G(), nr = /* @__PURE__ */ new G(), so = /* @__PURE__ */ new G(), Mc = /* @__PURE__ */ new G(), Bc = /* @__PURE__ */ new G(), ir = /* @__PURE__ */ new G();
+function qh(i, e, t, n, s) {
for (let r = 0, a = i.length - 3; r <= a; r += 3) {
ir.fromArray(i, r);
const o = s.x * Math.abs(ir.x) + s.y * Math.abs(ir.y) + s.z * Math.abs(ir.z), c = e.dot(ir), l = t.dot(ir), h = n.dot(ir);
@@ -4097,8 +4097,8 @@ function Vh(i, e, t, n, s) {
}
return !0;
}
-const d_ = /* @__PURE__ */ new Hi(), so = /* @__PURE__ */ new G(), Wh = /* @__PURE__ */ new G();
-class zi {
+const f_ = /* @__PURE__ */ new zi(), ro = /* @__PURE__ */ new G(), Kh = /* @__PURE__ */ new G();
+class Vi {
/**
* Constructs a new sphere.
*
@@ -4130,7 +4130,7 @@ class zi {
*/
setFromPoints(e, t) {
const n = this.center;
- t !== void 0 ? n.copy(t) : d_.setFromPoints(e).getCenter(n);
+ t !== void 0 ? n.copy(t) : f_.setFromPoints(e).getCenter(n);
let s = 0;
for (let r = 0, a = e.length; r < a; r++)
s = Math.max(s, n.distanceToSquared(e[r]));
@@ -4262,11 +4262,11 @@ class zi {
expandByPoint(e) {
if (this.isEmpty())
return this.center.copy(e), this.radius = 0, this;
- so.subVectors(e, this.center);
- const t = so.lengthSq();
+ ro.subVectors(e, this.center);
+ const t = ro.lengthSq();
if (t > this.radius * this.radius) {
const n = Math.sqrt(t), s = (n - this.radius) * 0.5;
- this.center.addScaledVector(so, s / n), this.radius += s;
+ this.center.addScaledVector(ro, s / n), this.radius += s;
}
return this;
}
@@ -4277,7 +4277,7 @@ class zi {
* @return {Sphere} A reference to this sphere.
*/
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) : (Wh.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(so.copy(e.center).add(Wh)), this.expandByPoint(so.copy(e.center).sub(Wh))), this);
+ return e.isEmpty() ? this : this.isEmpty() ? (this.copy(e), this) : (this.center.equals(e.center) === !0 ? this.radius = Math.max(this.radius, e.radius) : (Kh.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(ro.copy(e.center).add(Kh)), this.expandByPoint(ro.copy(e.center).sub(Kh))), this);
}
/**
* Returns `true` if this sphere is equal with the given one.
@@ -4297,8 +4297,8 @@ class zi {
return new this.constructor().copy(this);
}
}
-const ji = /* @__PURE__ */ new G(), qh = /* @__PURE__ */ new G(), Bc = /* @__PURE__ */ new G(), Is = /* @__PURE__ */ new G(), Kh = /* @__PURE__ */ new G(), Tc = /* @__PURE__ */ new G(), jh = /* @__PURE__ */ new G();
-class uc {
+const Xi = /* @__PURE__ */ new G(), jh = /* @__PURE__ */ new G(), Tc = /* @__PURE__ */ new G(), Is = /* @__PURE__ */ new G(), Xh = /* @__PURE__ */ new G(), Rc = /* @__PURE__ */ new G(), Yh = /* @__PURE__ */ new G();
+class dc {
/**
* Constructs a new ray.
*
@@ -4353,7 +4353,7 @@ class uc {
* @return {Ray} A reference to this ray.
*/
recast(e) {
- return this.origin.copy(this.at(e, ji)), this;
+ return this.origin.copy(this.at(e, Xi)), this;
}
/**
* Returns the point along this ray that is closest to the given point.
@@ -4383,8 +4383,8 @@ class uc {
* @return {number} The squared distance.
*/
distanceSqToPoint(e) {
- const t = ji.subVectors(e, this.origin).dot(this.direction);
- return t < 0 ? this.origin.distanceToSquared(e) : (ji.copy(this.origin).addScaledVector(this.direction, t), ji.distanceToSquared(e));
+ const t = Xi.subVectors(e, this.origin).dot(this.direction);
+ return t < 0 ? this.origin.distanceToSquared(e) : (Xi.copy(this.origin).addScaledVector(this.direction, t), Xi.distanceToSquared(e));
}
/**
* Returns the squared distance between this ray and the given line segment.
@@ -4396,8 +4396,8 @@ class uc {
* @return {number} The squared distance.
*/
distanceSqToSegment(e, t, n, s) {
- qh.copy(e).add(t).multiplyScalar(0.5), Bc.copy(t).sub(e).normalize(), Is.copy(this.origin).sub(qh);
- const r = e.distanceTo(t) * 0.5, a = -this.direction.dot(Bc), o = Is.dot(this.direction), c = -Is.dot(Bc), l = Is.lengthSq(), h = Math.abs(1 - a * a);
+ jh.copy(e).add(t).multiplyScalar(0.5), Tc.copy(t).sub(e).normalize(), Is.copy(this.origin).sub(jh);
+ const r = e.distanceTo(t) * 0.5, a = -this.direction.dot(Tc), o = Is.dot(this.direction), c = -Is.dot(Tc), l = Is.lengthSq(), h = Math.abs(1 - a * a);
let u, d, f, p;
if (h > 0)
if (u = a * c - o, d = a * o - c, p = r * h, u >= 0)
@@ -4413,7 +4413,7 @@ class uc {
d <= -p ? (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 <= p ? (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), s && s.copy(qh).addScaledVector(Bc, d), f;
+ return n && n.copy(this.origin).addScaledVector(this.direction, u), s && s.copy(jh).addScaledVector(Tc, d), f;
}
/**
* Intersects this ray with the given sphere, returning the intersection
@@ -4424,8 +4424,8 @@ class uc {
* @return {?Vector3} The intersection point.
*/
intersectSphere(e, t) {
- ji.subVectors(e.center, this.origin);
- const n = ji.dot(this.direction), s = ji.dot(ji) - n * n, r = e.radius * e.radius;
+ Xi.subVectors(e.center, this.origin);
+ const n = Xi.dot(this.direction), s = Xi.dot(Xi) - n * n, r = e.radius * e.radius;
if (s > r) return null;
const a = Math.sqrt(r - s), o = n - a, c = n + a;
return c < 0 ? null : o < 0 ? this.at(c, t) : this.at(o, t);
@@ -4495,7 +4495,7 @@ class uc {
* @return {boolean} Whether this ray intersects with the given box or not.
*/
intersectsBox(e) {
- return this.intersectBox(e, ji) !== null;
+ return this.intersectBox(e, Xi) !== null;
}
/**
* Intersects this ray with the given triangle, returning the intersection
@@ -4509,8 +4509,8 @@ class uc {
* @return {?Vector3} The intersection point.
*/
intersectTriangle(e, t, n, s, r) {
- Kh.subVectors(t, e), Tc.subVectors(n, e), jh.crossVectors(Kh, Tc);
- let a = this.direction.dot(jh), o;
+ Xh.subVectors(t, e), Rc.subVectors(n, e), Yh.crossVectors(Xh, Rc);
+ let a = this.direction.dot(Yh), o;
if (a > 0) {
if (s) return null;
o = 1;
@@ -4519,13 +4519,13 @@ class uc {
else
return null;
Is.subVectors(this.origin, e);
- const c = o * this.direction.dot(Tc.crossVectors(Is, Tc));
+ const c = o * this.direction.dot(Rc.crossVectors(Is, Rc));
if (c < 0)
return null;
- const l = o * this.direction.dot(Kh.cross(Is));
+ const l = o * this.direction.dot(Xh.cross(Is));
if (l < 0 || c + l > a)
return null;
- const h = -o * Is.dot(jh);
+ const h = -o * Is.dot(Yh);
return h < 0 ? null : this.at(h / a, r);
}
/**
@@ -4799,7 +4799,7 @@ class Ne {
* @return {Matrix4} A reference to this matrix.
*/
makeRotationFromQuaternion(e) {
- return this.compose(f_, e, p_);
+ return this.compose(p_, e, A_);
}
/**
* Sets the rotation component of the transformation matrix, looking from `eye` towards
@@ -4812,7 +4812,7 @@ class Ne {
*/
lookAt(e, t, n) {
const s = this.elements;
- return Jn.subVectors(e, t), Jn.lengthSq() === 0 && (Jn.z = 1), Jn.normalize(), Ss.crossVectors(n, Jn), Ss.lengthSq() === 0 && (Math.abs(n.z) === 1 ? Jn.x += 1e-4 : Jn.z += 1e-4, Jn.normalize(), Ss.crossVectors(n, Jn)), Ss.normalize(), Rc.crossVectors(Jn, Ss), s[0] = Ss.x, s[4] = Rc.x, s[8] = Jn.x, s[1] = Ss.y, s[5] = Rc.y, s[9] = Jn.y, s[2] = Ss.z, s[6] = Rc.z, s[10] = Jn.z, this;
+ return Zn.subVectors(e, t), Zn.lengthSq() === 0 && (Zn.z = 1), Zn.normalize(), Ss.crossVectors(n, Zn), Ss.lengthSq() === 0 && (Math.abs(n.z) === 1 ? Zn.x += 1e-4 : Zn.z += 1e-4, Zn.normalize(), Ss.crossVectors(n, Zn)), Ss.normalize(), Fc.crossVectors(Zn, Ss), s[0] = Ss.x, s[4] = Fc.x, s[8] = Zn.x, s[1] = Ss.y, s[5] = Fc.y, s[9] = Zn.y, s[2] = Ss.z, s[6] = Fc.z, s[10] = Zn.z, this;
}
/**
* Post-multiplies this matrix by the given 4x4 matrix.
@@ -5170,9 +5170,9 @@ class Ne {
const s = this.elements;
let r = Jr.set(s[0], s[1], s[2]).length();
const a = Jr.set(s[4], s[5], s[6]).length(), o = Jr.set(s[8], s[9], s[10]).length();
- this.determinant() < 0 && (r = -r), e.x = s[12], e.y = s[13], e.z = s[14], mi.copy(this);
+ this.determinant() < 0 && (r = -r), e.x = s[12], e.y = s[13], e.z = s[14], xi.copy(this);
const l = 1 / r, h = 1 / a, u = 1 / o;
- return mi.elements[0] *= l, mi.elements[1] *= l, mi.elements[2] *= l, mi.elements[4] *= h, mi.elements[5] *= h, mi.elements[6] *= h, mi.elements[8] *= u, mi.elements[9] *= u, mi.elements[10] *= u, t.setFromRotationMatrix(mi), n.x = r, n.y = a, n.z = o, this;
+ return xi.elements[0] *= l, xi.elements[1] *= l, xi.elements[2] *= l, xi.elements[4] *= h, xi.elements[5] *= h, xi.elements[6] *= h, xi.elements[8] *= u, xi.elements[9] *= u, xi.elements[10] *= u, t.setFromRotationMatrix(xi), n.x = r, n.y = a, n.z = o, this;
}
/**
* Creates a perspective projection matrix. This is used internally by
@@ -5192,7 +5192,7 @@ class Ne {
let f, p;
if (o === ls)
f = -(a + r) / (a - r), p = -2 * a * r / (a - r);
- else if (o === Vl)
+ else if (o === ql)
f = -a / (a - r), p = -a * r / (a - r);
else
throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + o);
@@ -5216,7 +5216,7 @@ class Ne {
let p, m;
if (o === ls)
p = (a + r) * u, m = -2 * u;
- else if (o === Vl)
+ else if (o === ql)
p = r * u, m = -1 * u;
else
throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + o);
@@ -5259,7 +5259,7 @@ class Ne {
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e;
}
}
-const Jr = /* @__PURE__ */ new G(), mi = /* @__PURE__ */ new Ne(), f_ = /* @__PURE__ */ new G(0, 0, 0), p_ = /* @__PURE__ */ new G(1, 1, 1), Ss = /* @__PURE__ */ new G(), Rc = /* @__PURE__ */ new G(), Jn = /* @__PURE__ */ new G(), Kp = /* @__PURE__ */ new Ne(), jp = /* @__PURE__ */ new Jt();
+const Jr = /* @__PURE__ */ new G(), xi = /* @__PURE__ */ new Ne(), p_ = /* @__PURE__ */ new G(0, 0, 0), A_ = /* @__PURE__ */ new G(1, 1, 1), Ss = /* @__PURE__ */ new G(), Fc = /* @__PURE__ */ new G(), Zn = /* @__PURE__ */ new G(), Xp = /* @__PURE__ */ new Ne(), Yp = /* @__PURE__ */ new Jt();
class dn {
/**
* Constructs a new euler instance.
@@ -5392,7 +5392,7 @@ class dn {
* @return {Euler} A reference to this Euler instance.
*/
setFromQuaternion(e, t, n) {
- return Kp.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Kp, t, n);
+ return Xp.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Xp, t, n);
}
/**
* Sets the angles of this Euler instance from the given vector.
@@ -5415,7 +5415,7 @@ class dn {
* @return {Euler} A reference to this Euler instance.
*/
reorder(e) {
- return jp.setFromEuler(this), this.setFromQuaternion(jp, e);
+ return Yp.setFromEuler(this), this.setFromQuaternion(Yp, e);
}
/**
* Returns `true` if this Euler instance is equal with the given one.
@@ -5458,7 +5458,7 @@ class dn {
}
}
dn.DEFAULT_ORDER = "XYZ";
-class B0 {
+class T0 {
/**
* Constructs a new layers instance, with membership
* initially set to layer `0`.
@@ -5530,14 +5530,14 @@ class B0 {
return (this.mask & (1 << e | 0)) !== 0;
}
}
-let A_ = 0;
-const Xp = /* @__PURE__ */ new G(), Zr = /* @__PURE__ */ new Jt(), Xi = /* @__PURE__ */ new Ne(), Fc = /* @__PURE__ */ new G(), ro = /* @__PURE__ */ new G(), g_ = /* @__PURE__ */ new G(), m_ = /* @__PURE__ */ new Jt(), Yp = /* @__PURE__ */ new G(1, 0, 0), Jp = /* @__PURE__ */ new G(0, 1, 0), Zp = /* @__PURE__ */ new G(0, 0, 1), $p = { type: "added" }, x_ = { type: "removed" }, $r = { type: "childadded", child: null }, Xh = { type: "childremoved", child: null };
+let g_ = 0;
+const Jp = /* @__PURE__ */ new G(), Zr = /* @__PURE__ */ new Jt(), Yi = /* @__PURE__ */ new Ne(), Nc = /* @__PURE__ */ new G(), ao = /* @__PURE__ */ new G(), m_ = /* @__PURE__ */ new G(), x_ = /* @__PURE__ */ new Jt(), Zp = /* @__PURE__ */ new G(1, 0, 0), $p = /* @__PURE__ */ new G(0, 1, 0), eA = /* @__PURE__ */ new G(0, 0, 1), tA = { type: "added" }, b_ = { type: "removed" }, $r = { type: "childadded", child: null }, Jh = { type: "childremoved", child: null };
class Tt extends Js {
/**
* Constructs a new 3D object.
*/
constructor() {
- super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: A_++ }), this.uuid = Mi(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = Tt.DEFAULT_UP.clone();
+ super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: g_++ }), this.uuid = Bi(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = Tt.DEFAULT_UP.clone();
const e = new G(), t = new dn(), n = new Jt(), s = new G(1, 1, 1);
function r() {
n.setFromEuler(t, !1);
@@ -5611,7 +5611,7 @@ class Tt extends Js {
normalMatrix: {
value: new at()
}
- }), this.matrix = new Ne(), this.matrixWorld = new Ne(), this.matrixAutoUpdate = Tt.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new B0(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.customDepthMaterial = void 0, this.customDistanceMaterial = void 0, this.userData = {};
+ }), this.matrix = new Ne(), this.matrixWorld = new Ne(), this.matrixAutoUpdate = Tt.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new T0(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.customDepthMaterial = void 0, this.customDistanceMaterial = void 0, this.userData = {};
}
/**
* A callback that is executed immediately before a 3D object is rendered to a shadow map.
@@ -5742,7 +5742,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
rotateX(e) {
- return this.rotateOnAxis(Yp, e);
+ return this.rotateOnAxis(Zp, e);
}
/**
* Rotates the 3D object around its Y axis in local space.
@@ -5751,7 +5751,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
rotateY(e) {
- return this.rotateOnAxis(Jp, e);
+ return this.rotateOnAxis($p, e);
}
/**
* Rotates the 3D object around its Z axis in local space.
@@ -5760,7 +5760,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
rotateZ(e) {
- return this.rotateOnAxis(Zp, e);
+ return this.rotateOnAxis(eA, e);
}
/**
* Translate the 3D object by a distance along the given axis in local space.
@@ -5770,7 +5770,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
translateOnAxis(e, t) {
- return Xp.copy(e).applyQuaternion(this.quaternion), this.position.add(Xp.multiplyScalar(t)), this;
+ return Jp.copy(e).applyQuaternion(this.quaternion), this.position.add(Jp.multiplyScalar(t)), this;
}
/**
* Translate the 3D object by a distance along its X-axis in local space.
@@ -5779,7 +5779,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
translateX(e) {
- return this.translateOnAxis(Yp, e);
+ return this.translateOnAxis(Zp, e);
}
/**
* Translate the 3D object by a distance along its Y-axis in local space.
@@ -5788,7 +5788,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
translateY(e) {
- return this.translateOnAxis(Jp, e);
+ return this.translateOnAxis($p, e);
}
/**
* Translate the 3D object by a distance along its Z-axis in local space.
@@ -5797,7 +5797,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
translateZ(e) {
- return this.translateOnAxis(Zp, e);
+ return this.translateOnAxis(eA, e);
}
/**
* Converts the given vector from this 3D object's local space to world space.
@@ -5815,7 +5815,7 @@ class Tt extends Js {
* @return {Vector3} The converted vector.
*/
worldToLocal(e) {
- return this.updateWorldMatrix(!0, !1), e.applyMatrix4(Xi.copy(this.matrixWorld).invert());
+ return this.updateWorldMatrix(!0, !1), e.applyMatrix4(Yi.copy(this.matrixWorld).invert());
}
/**
* Rotates the object to face a point in world space.
@@ -5827,9 +5827,9 @@ class Tt extends Js {
* @param {number} [z] - The z coordinate in world space.
*/
lookAt(e, t, n) {
- e.isVector3 ? Fc.copy(e) : Fc.set(e, t, n);
+ e.isVector3 ? Nc.copy(e) : Nc.set(e, t, n);
const s = this.parent;
- this.updateWorldMatrix(!0, !1), ro.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Xi.lookAt(ro, Fc, this.up) : Xi.lookAt(Fc, ro, this.up), this.quaternion.setFromRotationMatrix(Xi), s && (Xi.extractRotation(s.matrixWorld), Zr.setFromRotationMatrix(Xi), this.quaternion.premultiply(Zr.invert()));
+ this.updateWorldMatrix(!0, !1), ao.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Yi.lookAt(ao, Nc, this.up) : Yi.lookAt(Nc, ao, this.up), this.quaternion.setFromRotationMatrix(Yi), s && (Yi.extractRotation(s.matrixWorld), Zr.setFromRotationMatrix(Yi), this.quaternion.premultiply(Zr.invert()));
}
/**
* Adds the given 3D object as a child to this 3D object. An arbitrary number of
@@ -5847,7 +5847,7 @@ class Tt extends Js {
this.add(arguments[t]);
return this;
}
- return e === this ? (console.error("THREE.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($p), $r.child = e, this.dispatchEvent($r), $r.child = null) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this);
+ return e === this ? (console.error("THREE.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(tA), $r.child = e, this.dispatchEvent($r), $r.child = null) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this);
}
/**
* Removes the given 3D object as child from this 3D object.
@@ -5865,7 +5865,7 @@ class Tt extends Js {
return this;
}
const t = this.children.indexOf(e);
- return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(x_), Xh.child = e, this.dispatchEvent(Xh), Xh.child = null), this;
+ return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(b_), Jh.child = e, this.dispatchEvent(Jh), Jh.child = null), this;
}
/**
* Removes this 3D object from its current parent.
@@ -5898,7 +5898,7 @@ class Tt extends Js {
* @return {Object3D} A reference to this instance.
*/
attach(e) {
- return this.updateWorldMatrix(!0, !1), Xi.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), Xi.multiply(e.parent.matrixWorld)), e.applyMatrix4(Xi), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent($p), $r.child = e, this.dispatchEvent($r), $r.child = null, this;
+ return this.updateWorldMatrix(!0, !1), Yi.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), Yi.multiply(e.parent.matrixWorld)), e.applyMatrix4(Yi), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(tA), $r.child = e, this.dispatchEvent($r), $r.child = null, this;
}
/**
* Searches through the 3D object and its children, starting with the 3D object
@@ -5968,7 +5968,7 @@ class Tt extends Js {
* @return {Quaternion} The 3D object's rotation in world space.
*/
getWorldQuaternion(e) {
- return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(ro, e, g_), e;
+ return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(ao, e, m_), e;
}
/**
* Returns a vector representing the scale of the 3D object in world space.
@@ -5977,7 +5977,7 @@ class Tt extends Js {
* @return {Vector3} The 3D object's scale in world space.
*/
getWorldScale(e) {
- return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(ro, m_, e), e;
+ return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(ao, x_, e), e;
}
/**
* Returns a vector representing the ("look") direction of the 3D object in world space.
@@ -6201,8 +6201,8 @@ class Tt extends Js {
Tt.DEFAULT_UP = /* @__PURE__ */ new G(0, 1, 0);
Tt.DEFAULT_MATRIX_AUTO_UPDATE = !0;
Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
-const xi = /* @__PURE__ */ new G(), Yi = /* @__PURE__ */ new G(), Yh = /* @__PURE__ */ new G(), Ji = /* @__PURE__ */ new G(), ea = /* @__PURE__ */ new G(), ta = /* @__PURE__ */ new G(), eA = /* @__PURE__ */ new G(), Jh = /* @__PURE__ */ new G(), Zh = /* @__PURE__ */ new G(), $h = /* @__PURE__ */ new G(), eu = /* @__PURE__ */ new mt(), tu = /* @__PURE__ */ new mt(), nu = /* @__PURE__ */ new mt();
-class Ii {
+const bi = /* @__PURE__ */ new G(), Ji = /* @__PURE__ */ new G(), Zh = /* @__PURE__ */ new G(), Zi = /* @__PURE__ */ new G(), ea = /* @__PURE__ */ new G(), ta = /* @__PURE__ */ new G(), nA = /* @__PURE__ */ new G(), $h = /* @__PURE__ */ new G(), eu = /* @__PURE__ */ new G(), tu = /* @__PURE__ */ new G(), nu = /* @__PURE__ */ new mt(), iu = /* @__PURE__ */ new mt(), su = /* @__PURE__ */ new mt();
+class Si {
/**
* Constructs a new triangle.
*
@@ -6223,7 +6223,7 @@ class Ii {
* @return {Vector3} The triangle's normal.
*/
static getNormal(e, t, n, s) {
- s.subVectors(n, t), xi.subVectors(e, t), s.cross(xi);
+ s.subVectors(n, t), bi.subVectors(e, t), s.cross(bi);
const r = s.lengthSq();
return r > 0 ? s.multiplyScalar(1 / Math.sqrt(r)) : s.set(0, 0, 0);
}
@@ -6239,8 +6239,8 @@ class Ii {
* @return {?Vector3} The barycentric coordinates for the given point
*/
static getBarycoord(e, t, n, s, r) {
- xi.subVectors(s, t), Yi.subVectors(n, t), Yh.subVectors(e, t);
- const a = xi.dot(xi), o = xi.dot(Yi), c = xi.dot(Yh), l = Yi.dot(Yi), h = Yi.dot(Yh), u = a * l - o * o;
+ bi.subVectors(s, t), Ji.subVectors(n, t), Zh.subVectors(e, t);
+ const a = bi.dot(bi), o = bi.dot(Ji), c = bi.dot(Zh), l = Ji.dot(Ji), h = Ji.dot(Zh), u = a * l - o * o;
if (u === 0)
return r.set(0, 0, 0), null;
const d = 1 / u, f = (l * c - o * h) * d, p = (a * h - o * c) * d;
@@ -6258,7 +6258,7 @@ class Ii {
* triangle, lies within the triangle or not.
*/
static containsPoint(e, t, n, s) {
- return this.getBarycoord(e, t, n, s, Ji) === null ? !1 : Ji.x >= 0 && Ji.y >= 0 && Ji.x + Ji.y <= 1;
+ return this.getBarycoord(e, t, n, s, Zi) === null ? !1 : Zi.x >= 0 && Zi.y >= 0 && Zi.x + Zi.y <= 1;
}
/**
* Computes the value barycentrically interpolated for the given point on the
@@ -6275,7 +6275,7 @@ class Ii {
* @return {?Vector3} The interpolated value.
*/
static getInterpolation(e, t, n, s, r, a, o, c) {
- return this.getBarycoord(e, t, n, s, Ji) === 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, Ji.x), c.addScaledVector(a, Ji.y), c.addScaledVector(o, Ji.z), c);
+ return this.getBarycoord(e, t, n, s, Zi) === 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, Zi.x), c.addScaledVector(a, Zi.y), c.addScaledVector(o, Zi.z), c);
}
/**
* Computes the value barycentrically interpolated for the given attribute and indices.
@@ -6289,7 +6289,7 @@ class Ii {
* @return {Vector3} The interpolated attribute value.
*/
static getInterpolatedAttribute(e, t, n, s, r, a) {
- return eu.setScalar(0), tu.setScalar(0), nu.setScalar(0), eu.fromBufferAttribute(e, t), tu.fromBufferAttribute(e, n), nu.fromBufferAttribute(e, s), a.setScalar(0), a.addScaledVector(eu, r.x), a.addScaledVector(tu, r.y), a.addScaledVector(nu, r.z), a;
+ return nu.setScalar(0), iu.setScalar(0), su.setScalar(0), nu.fromBufferAttribute(e, t), iu.fromBufferAttribute(e, n), su.fromBufferAttribute(e, s), a.setScalar(0), a.addScaledVector(nu, r.x), a.addScaledVector(iu, r.y), a.addScaledVector(su, r.z), a;
}
/**
* Returns `true` if the triangle is oriented towards the given direction.
@@ -6301,7 +6301,7 @@ class Ii {
* @return {boolean} Whether the triangle is oriented towards the given direction or not.
*/
static isFrontFacing(e, t, n, s) {
- return xi.subVectors(n, t), Yi.subVectors(e, t), xi.cross(Yi).dot(s) < 0;
+ return bi.subVectors(n, t), Ji.subVectors(e, t), bi.cross(Ji).dot(s) < 0;
}
/**
* Sets the triangle's vertices by copying the given values.
@@ -6361,7 +6361,7 @@ class Ii {
* @return {number} The triangle's area.
*/
getArea() {
- return xi.subVectors(this.c, this.b), Yi.subVectors(this.a, this.b), xi.cross(Yi).length() * 0.5;
+ return bi.subVectors(this.c, this.b), Ji.subVectors(this.a, this.b), bi.cross(Ji).length() * 0.5;
}
/**
* Computes the midpoint of the triangle.
@@ -6379,7 +6379,7 @@ class Ii {
* @return {Vector3} The triangle's normal.
*/
getNormal(e) {
- return Ii.getNormal(this.a, this.b, this.c, e);
+ return Si.getNormal(this.a, this.b, this.c, e);
}
/**
* Computes a plane the triangle lies within.
@@ -6399,7 +6399,7 @@ class Ii {
* @return {?Vector3} The barycentric coordinates for the given point
*/
getBarycoord(e, t) {
- return Ii.getBarycoord(e, this.a, this.b, this.c, t);
+ return Si.getBarycoord(e, this.a, this.b, this.c, t);
}
/**
* Computes the value barycentrically interpolated for the given point on the
@@ -6413,7 +6413,7 @@ class Ii {
* @return {?Vector3} The interpolated value.
*/
getInterpolation(e, t, n, s, r) {
- return Ii.getInterpolation(e, this.a, this.b, this.c, t, n, s, r);
+ return Si.getInterpolation(e, this.a, this.b, this.c, t, n, s, r);
}
/**
* Returns `true` if the given point, when projected onto the plane of the
@@ -6424,7 +6424,7 @@ class Ii {
* triangle, lies within the triangle or not.
*/
containsPoint(e) {
- return Ii.containsPoint(e, this.a, this.b, this.c);
+ return Si.containsPoint(e, this.a, this.b, this.c);
}
/**
* Returns `true` if the triangle is oriented towards the given direction.
@@ -6433,7 +6433,7 @@ class Ii {
* @return {boolean} Whether the triangle is oriented towards the given direction or not.
*/
isFrontFacing(e) {
- return Ii.isFrontFacing(this.a, this.b, this.c, e);
+ return Si.isFrontFacing(this.a, this.b, this.c, e);
}
/**
* Returns `true` if this triangle intersects with the given box.
@@ -6454,19 +6454,19 @@ class Ii {
closestPointToPoint(e, t) {
const n = this.a, s = this.b, r = this.c;
let a, o;
- ea.subVectors(s, n), ta.subVectors(r, n), Jh.subVectors(e, n);
- const c = ea.dot(Jh), l = ta.dot(Jh);
+ ea.subVectors(s, n), ta.subVectors(r, n), $h.subVectors(e, n);
+ const c = ea.dot($h), l = ta.dot($h);
if (c <= 0 && l <= 0)
return t.copy(n);
- Zh.subVectors(e, s);
- const h = ea.dot(Zh), u = ta.dot(Zh);
+ eu.subVectors(e, s);
+ const h = ea.dot(eu), u = ta.dot(eu);
if (h >= 0 && u <= h)
return t.copy(s);
const d = c * u - h * l;
if (d <= 0 && c >= 0 && h <= 0)
return a = c / (c - h), t.copy(n).addScaledVector(ea, a);
- $h.subVectors(e, r);
- const f = ea.dot($h), p = ta.dot($h);
+ tu.subVectors(e, r);
+ const f = ea.dot(tu), p = ta.dot(tu);
if (p >= 0 && f <= p)
return t.copy(r);
const m = f * l - c * p;
@@ -6474,7 +6474,7 @@ class Ii {
return o = l / (l - p), t.copy(n).addScaledVector(ta, o);
const g = h * p - f * u;
if (g <= 0 && u - h >= 0 && f - p >= 0)
- return eA.subVectors(r, s), o = (u - h) / (u - h + (f - p)), t.copy(s).addScaledVector(eA, o);
+ return nA.subVectors(r, s), o = (u - h) / (u - h + (f - p)), t.copy(s).addScaledVector(nA, o);
const A = 1 / (g + m + d);
return a = m * A, o = d * A, t.copy(n).addScaledVector(ea, a).addScaledVector(ta, o);
}
@@ -6488,7 +6488,7 @@ class Ii {
return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);
}
}
-const T0 = {
+const R0 = {
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
@@ -6637,8 +6637,8 @@ const T0 = {
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
-}, Ms = { h: 0, s: 0, l: 0 }, Nc = { h: 0, s: 0, l: 0 };
-function iu(i, e, t) {
+}, Ms = { h: 0, s: 0, l: 0 }, Dc = { h: 0, s: 0, l: 0 };
+function ru(i, e, t) {
return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? i + (e - i) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? i + (e - i) * 6 * (2 / 3 - t) : i;
}
let Le = class {
@@ -6714,11 +6714,11 @@ let Le = class {
* @return {Color} A reference to this color.
*/
setHSL(e, t, n, s = rt.workingColorSpace) {
- if (e = Hf(e, 1), t = ot(t, 0, 1), n = ot(n, 0, 1), t === 0)
+ if (e = Vf(e, 1), t = ot(t, 0, 1), n = ot(n, 0, 1), t === 0)
this.r = this.g = this.b = n;
else {
const r = n <= 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - r;
- this.r = iu(a, r, e + 1 / 3), this.g = iu(a, r, e), this.b = iu(a, r, e - 1 / 3);
+ this.r = ru(a, r, e + 1 / 3), this.g = ru(a, r, e), this.b = ru(a, r, e - 1 / 3);
}
return rt.toWorkingColorSpace(this, s), this;
}
@@ -6801,7 +6801,7 @@ let Le = class {
* @return {Color} A reference to this color.
*/
setColorName(e, t = _t) {
- const n = T0[e.toLowerCase()];
+ const n = R0[e.toLowerCase()];
return n !== void 0 ? this.setHex(n, t) : console.warn("THREE.Color: Unknown color " + e), this;
}
/**
@@ -6839,7 +6839,7 @@ let Le = class {
* @return {Color} A reference to this color.
*/
copyLinearToSRGB(e) {
- return this.r = Ca(e.r), this.g = Ca(e.g), this.b = Ca(e.b), this;
+ return this.r = Ia(e.r), this.g = Ia(e.g), this.b = Ia(e.b), this;
}
/**
* Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`.
@@ -7033,8 +7033,8 @@ let Le = class {
* @return {Color} A reference to this color.
*/
lerpHSL(e, t) {
- this.getHSL(Ms), e.getHSL(Nc);
- const n = No(Ms.h, Nc.h, t), s = No(Ms.s, Nc.s, t), r = No(Ms.l, Nc.l, t);
+ this.getHSL(Ms), e.getHSL(Dc);
+ const n = Do(Ms.h, Dc.h, t), s = Do(Ms.s, Dc.s, t), r = Do(Ms.l, Dc.l, t);
return this.setHSL(n, s, r), this;
}
/**
@@ -7110,14 +7110,14 @@ let Le = class {
}
};
const Fn = /* @__PURE__ */ new Le();
-Le.NAMES = T0;
-let b_ = 0;
-class ui extends Js {
+Le.NAMES = R0;
+let E_ = 0;
+class di extends Js {
/**
* Constructs a new material.
*/
constructor() {
- super(), this.isMaterial = !0, Object.defineProperty(this, "id", { value: b_++ }), this.uuid = Mi(), this.name = "", this.type = "Material", this.blending = va, this.side = bs, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = ld, this.blendDst = hd, this.blendEquation = pr, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new Le(0, 0, 0), this.blendAlpha = 0, this.depthFunc = Na, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = Qp, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = qr, this.stencilZFail = qr, this.stencilZPass = qr, 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;
+ super(), this.isMaterial = !0, Object.defineProperty(this, "id", { value: E_++ }), this.uuid = Bi(), this.name = "", this.type = "Material", this.blending = Ca, this.side = bs, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = ud, this.blendDst = dd, this.blendEquation = pr, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new Le(0, 0, 0), this.blendAlpha = 0, this.depthFunc = Da, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = Hp, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = qr, this.stencilZFail = qr, this.stencilZPass = qr, 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;
}
/**
* Sets the alpha value to be used when running an alpha test. The material
@@ -7216,7 +7216,7 @@ class ui extends Js {
generator: "Material.toJSON"
}
};
- n.uuid = this.uuid, n.type = this.type, this.name !== "" && (n.name = this.name), this.color && this.color.isColor && (n.color = this.color.getHex()), this.roughness !== void 0 && (n.roughness = this.roughness), this.metalness !== void 0 && (n.metalness = this.metalness), this.sheen !== void 0 && (n.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (n.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (n.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1 && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (n.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (n.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (n.shininess = this.shininess), this.clearcoat !== void 0 && (n.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (n.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.dispersion !== void 0 && (n.dispersion = this.dispersion), this.iridescence !== void 0 && (n.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (n.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (n.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (n.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (n.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), this.anisotropy !== void 0 && (n.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (n.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (n.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid, n.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid, n.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid, n.normalMapType = this.normalMapType, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (n.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (n.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (n.combine = this.combine)), this.envMapRotation !== void 0 && (n.envMapRotation = this.envMapRotation.toArray()), this.envMapIntensity !== void 0 && (n.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (n.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (n.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (n.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (n.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (n.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (n.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== 1 / 0 && (n.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (n.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (n.size = this.size), this.shadowSide !== null && (n.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (n.sizeAttenuation = this.sizeAttenuation), this.blending !== va && (n.blending = this.blending), this.side !== bs && (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 !== ld && (n.blendSrc = this.blendSrc), this.blendDst !== hd && (n.blendDst = this.blendDst), this.blendEquation !== pr && (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 !== Na && (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 !== Qp && (n.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (n.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (n.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== qr && (n.stencilFail = this.stencilFail), this.stencilZFail !== qr && (n.stencilZFail = this.stencilZFail), this.stencilZPass !== qr && (n.stencilZPass = this.stencilZPass), this.stencilWrite === !0 && (n.stencilWrite = this.stencilWrite), this.rotation !== void 0 && this.rotation !== 0 && (n.rotation = this.rotation), this.polygonOffset === !0 && (n.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (n.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (n.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth !== void 0 && this.linewidth !== 1 && (n.linewidth = this.linewidth), this.dashSize !== void 0 && (n.dashSize = this.dashSize), this.gapSize !== void 0 && (n.gapSize = this.gapSize), this.scale !== void 0 && (n.scale = this.scale), this.dithering === !0 && (n.dithering = !0), this.alphaTest > 0 && (n.alphaTest = this.alphaTest), this.alphaHash === !0 && (n.alphaHash = !0), this.alphaToCoverage === !0 && (n.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (n.premultipliedAlpha = !0), this.forceSinglePass === !0 && (n.forceSinglePass = !0), this.wireframe === !0 && (n.wireframe = !0), this.wireframeLinewidth > 1 && (n.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (n.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (n.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (n.flatShading = !0), this.visible === !1 && (n.visible = !1), this.toneMapped === !1 && (n.toneMapped = !1), this.fog === !1 && (n.fog = !1), Object.keys(this.userData).length > 0 && (n.userData = this.userData);
+ n.uuid = this.uuid, n.type = this.type, this.name !== "" && (n.name = this.name), this.color && this.color.isColor && (n.color = this.color.getHex()), this.roughness !== void 0 && (n.roughness = this.roughness), this.metalness !== void 0 && (n.metalness = this.metalness), this.sheen !== void 0 && (n.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (n.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (n.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1 && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (n.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (n.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (n.shininess = this.shininess), this.clearcoat !== void 0 && (n.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (n.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.dispersion !== void 0 && (n.dispersion = this.dispersion), this.iridescence !== void 0 && (n.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (n.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (n.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (n.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (n.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), this.anisotropy !== void 0 && (n.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (n.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (n.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid, n.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid, n.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid, n.normalMapType = this.normalMapType, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (n.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (n.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (n.combine = this.combine)), this.envMapRotation !== void 0 && (n.envMapRotation = this.envMapRotation.toArray()), this.envMapIntensity !== void 0 && (n.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (n.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (n.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (n.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (n.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (n.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (n.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== 1 / 0 && (n.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (n.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (n.size = this.size), this.shadowSide !== null && (n.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (n.sizeAttenuation = this.sizeAttenuation), this.blending !== Ca && (n.blending = this.blending), this.side !== bs && (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 !== ud && (n.blendSrc = this.blendSrc), this.blendDst !== dd && (n.blendDst = this.blendDst), this.blendEquation !== pr && (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 !== Da && (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 !== Hp && (n.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (n.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (n.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== qr && (n.stencilFail = this.stencilFail), this.stencilZFail !== qr && (n.stencilZFail = this.stencilZFail), this.stencilZPass !== qr && (n.stencilZPass = this.stencilZPass), this.stencilWrite === !0 && (n.stencilWrite = this.stencilWrite), this.rotation !== void 0 && this.rotation !== 0 && (n.rotation = this.rotation), this.polygonOffset === !0 && (n.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (n.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (n.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth !== void 0 && this.linewidth !== 1 && (n.linewidth = this.linewidth), this.dashSize !== void 0 && (n.dashSize = this.dashSize), this.gapSize !== void 0 && (n.gapSize = this.gapSize), this.scale !== void 0 && (n.scale = this.scale), this.dithering === !0 && (n.dithering = !0), this.alphaTest > 0 && (n.alphaTest = this.alphaTest), this.alphaHash === !0 && (n.alphaHash = !0), this.alphaToCoverage === !0 && (n.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (n.premultipliedAlpha = !0), this.forceSinglePass === !0 && (n.forceSinglePass = !0), this.wireframe === !0 && (n.wireframe = !0), this.wireframeLinewidth > 1 && (n.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (n.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (n.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (n.flatShading = !0), this.visible === !1 && (n.visible = !1), this.toneMapped === !1 && (n.toneMapped = !1), this.fog === !1 && (n.fog = !1), Object.keys(this.userData).length > 0 && (n.userData = this.userData);
function s(r) {
const a = [];
for (const o in r) {
@@ -7278,7 +7278,7 @@ class ui extends Js {
e === !0 && this.version++;
}
}
-class Os extends ui {
+class Os extends di {
/**
* Constructs a new mesh basic material.
*
@@ -7289,14 +7289,14 @@ class Os extends ui {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshBasicMaterial = !0, this.type = "MeshBasicMaterial", this.color = new Le(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new dn(), this.combine = hh, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.fog = !0, this.setValues(e);
+ super(), this.isMeshBasicMaterial = !0, this.type = "MeshBasicMaterial", this.color = new Le(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new dn(), this.combine = dh, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.fog = !0, this.setValues(e);
}
copy(e) {
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.fog = e.fog, this;
}
}
-const ss = /* @__PURE__ */ E_();
-function E_() {
+const rs = /* @__PURE__ */ y_();
+function y_() {
const i = new ArrayBuffer(4), e = new Float32Array(i), t = new Uint32Array(i), n = new Uint32Array(512), s = new Uint32Array(512);
for (let c = 0; c < 256; ++c) {
const l = c - 127;
@@ -7329,16 +7329,16 @@ function E_() {
offsetTable: o
};
}
-function y_(i) {
- Math.abs(i) > 65504 && console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."), i = ot(i, -65504, 65504), ss.floatView[0] = i;
- const e = ss.uint32View[0], t = e >> 23 & 511;
- return ss.baseTable[t] + ((e & 8388607) >> ss.shiftTable[t]);
-}
function __(i) {
+ Math.abs(i) > 65504 && console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."), i = ot(i, -65504, 65504), rs.floatView[0] = i;
+ const e = rs.uint32View[0], t = e >> 23 & 511;
+ return rs.baseTable[t] + ((e & 8388607) >> rs.shiftTable[t]);
+}
+function w_(i) {
const e = i >> 10;
- return ss.uint32View[0] = ss.mantissaTable[ss.offsetTable[e] + (i & 1023)] + ss.exponentTable[e], ss.floatView[0];
+ return rs.uint32View[0] = rs.mantissaTable[rs.offsetTable[e] + (i & 1023)] + rs.exponentTable[e], rs.floatView[0];
}
-class tA {
+class iA {
/**
* Returns a half precision floating point value (FP16) from the given single
* precision floating point value (FP32).
@@ -7347,7 +7347,7 @@ class tA {
* @return {number} The FP16 value.
*/
static toHalfFloat(e) {
- return y_(e);
+ return __(e);
}
/**
* Returns a single precision floating point value (FP32) from the given half
@@ -7357,11 +7357,11 @@ class tA {
* @return {number} The FP32 value.
*/
static fromHalfFloat(e) {
- return __(e);
+ return w_(e);
}
}
-const nn = /* @__PURE__ */ new G(), Dc = /* @__PURE__ */ new Ze();
-let w_ = 0;
+const nn = /* @__PURE__ */ new G(), Lc = /* @__PURE__ */ new Ze();
+let v_ = 0;
class Bn {
/**
* Constructs a new buffer attribute.
@@ -7373,7 +7373,7 @@ class Bn {
constructor(e, t, n = !1) {
if (Array.isArray(e))
throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
- this.isBufferAttribute = !0, Object.defineProperty(this, "id", { value: w_++ }), this.name = "", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = n, this.usage = Od, this.updateRanges = [], this.gpuType = fn, this.version = 0;
+ this.isBufferAttribute = !0, Object.defineProperty(this, "id", { value: v_++ }), this.name = "", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = n, this.usage = Gd, this.updateRanges = [], this.gpuType = fn, this.version = 0;
}
/**
* A callback function that is executed after the renderer has transferred the attribute
@@ -7460,7 +7460,7 @@ class Bn {
applyMatrix3(e) {
if (this.itemSize === 2)
for (let t = 0, n = this.count; t < n; t++)
- Dc.fromBufferAttribute(this, t), Dc.applyMatrix3(e), this.setXY(t, Dc.x, Dc.y);
+ Lc.fromBufferAttribute(this, t), Lc.applyMatrix3(e), this.setXY(t, Lc.x, Lc.y);
else if (this.itemSize === 3)
for (let t = 0, n = this.count; t < n; t++)
nn.fromBufferAttribute(this, t), nn.applyMatrix3(e), this.setXYZ(t, nn.x, nn.y, nn.z);
@@ -7521,7 +7521,7 @@ class Bn {
*/
getComponent(e, t) {
let n = this.array[e * this.itemSize + t];
- return this.normalized && (n = Ci(n, this.array)), n;
+ return this.normalized && (n = Ii(n, this.array)), n;
}
/**
* Sets the given value to the given component of the vector at the given index.
@@ -7542,7 +7542,7 @@ class Bn {
*/
getX(e) {
let t = this.array[e * this.itemSize];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Sets the x component of the vector at the given index.
@@ -7562,7 +7562,7 @@ class Bn {
*/
getY(e) {
let t = this.array[e * this.itemSize + 1];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Sets the y component of the vector at the given index.
@@ -7582,7 +7582,7 @@ class Bn {
*/
getZ(e) {
let t = this.array[e * this.itemSize + 2];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Sets the z component of the vector at the given index.
@@ -7602,7 +7602,7 @@ class Bn {
*/
getW(e) {
let t = this.array[e * this.itemSize + 3];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Sets the w component of the vector at the given index.
@@ -7681,10 +7681,10 @@ class Bn {
array: Array.from(this.array),
normalized: this.normalized
};
- return this.name !== "" && (e.name = this.name), this.usage !== Od && (e.usage = this.usage), e;
+ return this.name !== "" && (e.name = this.name), this.usage !== Gd && (e.usage = this.usage), e;
}
}
-class Vf extends Bn {
+class qf extends Bn {
/**
* Constructs a new buffer attribute.
*
@@ -7696,7 +7696,7 @@ class Vf extends Bn {
super(new Uint16Array(e), t, n);
}
}
-class R0 extends Bn {
+class F0 extends Bn {
/**
* Constructs a new buffer attribute.
*
@@ -7720,14 +7720,14 @@ class en extends Bn {
super(new Float32Array(e), t, n);
}
}
-let v_ = 0;
-const ii = /* @__PURE__ */ new Ne(), su = /* @__PURE__ */ new Tt(), na = /* @__PURE__ */ new G(), Zn = /* @__PURE__ */ new Hi(), ao = /* @__PURE__ */ new Hi(), yn = /* @__PURE__ */ new G();
+let C_ = 0;
+const si = /* @__PURE__ */ new Ne(), au = /* @__PURE__ */ new Tt(), na = /* @__PURE__ */ new G(), $n = /* @__PURE__ */ new zi(), oo = /* @__PURE__ */ new zi(), yn = /* @__PURE__ */ new G();
class Tn extends Js {
/**
* Constructs a new geometry.
*/
constructor() {
- super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { value: v_++ }), this.uuid = Mi(), this.name = "", this.type = "BufferGeometry", this.index = null, this.indirect = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {};
+ super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { value: C_++ }), this.uuid = Bi(), this.name = "", this.type = "BufferGeometry", this.index = null, this.indirect = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {};
}
/**
* Returns the index of this geometry.
@@ -7744,7 +7744,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
setIndex(e) {
- return Array.isArray(e) ? this.index = new (I0(e) ? R0 : Vf)(e, 1) : this.index = e, this;
+ return Array.isArray(e) ? this.index = new (S0(e) ? F0 : qf)(e, 1) : this.index = e, this;
}
/**
* Sets the given indirect attribute to this geometry.
@@ -7856,7 +7856,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
applyQuaternion(e) {
- return ii.makeRotationFromQuaternion(e), this.applyMatrix4(ii), this;
+ return si.makeRotationFromQuaternion(e), this.applyMatrix4(si), this;
}
/**
* Rotates the geometry about the X axis. This is typically done as a one time
@@ -7867,7 +7867,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
rotateX(e) {
- return ii.makeRotationX(e), this.applyMatrix4(ii), this;
+ return si.makeRotationX(e), this.applyMatrix4(si), this;
}
/**
* Rotates the geometry about the Y axis. This is typically done as a one time
@@ -7878,7 +7878,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
rotateY(e) {
- return ii.makeRotationY(e), this.applyMatrix4(ii), this;
+ return si.makeRotationY(e), this.applyMatrix4(si), this;
}
/**
* Rotates the geometry about the Z axis. This is typically done as a one time
@@ -7889,7 +7889,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
rotateZ(e) {
- return ii.makeRotationZ(e), this.applyMatrix4(ii), this;
+ return si.makeRotationZ(e), this.applyMatrix4(si), this;
}
/**
* Translates the geometry. This is typically done as a one time
@@ -7902,7 +7902,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
translate(e, t, n) {
- return ii.makeTranslation(e, t, n), this.applyMatrix4(ii), this;
+ return si.makeTranslation(e, t, n), this.applyMatrix4(si), this;
}
/**
* Scales the geometry. This is typically done as a one time
@@ -7915,7 +7915,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
scale(e, t, n) {
- return ii.makeScale(e, t, n), this.applyMatrix4(ii), this;
+ return si.makeScale(e, t, n), this.applyMatrix4(si), this;
}
/**
* Rotates the geometry to face a point in 3D space. This is typically done as a one time
@@ -7926,7 +7926,7 @@ class Tn extends Js {
* @return {BufferGeometry} A reference to this instance.
*/
lookAt(e) {
- return su.lookAt(e), su.updateMatrix(), this.applyMatrix4(su.matrix), this;
+ return au.lookAt(e), au.updateMatrix(), this.applyMatrix4(au.matrix), this;
}
/**
* Center the geometry based on its bounding box.
@@ -7972,7 +7972,7 @@ class Tn extends Js {
* You may need to recompute the bounding box if the geometry vertices are modified.
*/
computeBoundingBox() {
- this.boundingBox === null && (this.boundingBox = new Hi());
+ this.boundingBox === null && (this.boundingBox = new zi());
const e = this.attributes.position, t = this.morphAttributes.position;
if (e && e.isGLBufferAttribute) {
console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.", this), this.boundingBox.set(
@@ -7985,7 +7985,7 @@ class Tn extends Js {
if (this.boundingBox.setFromBufferAttribute(e), t)
for (let n = 0, s = t.length; n < s; n++) {
const r = t[n];
- Zn.setFromBufferAttribute(r), this.morphTargetsRelative ? (yn.addVectors(this.boundingBox.min, Zn.min), this.boundingBox.expandByPoint(yn), yn.addVectors(this.boundingBox.max, Zn.max), this.boundingBox.expandByPoint(yn)) : (this.boundingBox.expandByPoint(Zn.min), this.boundingBox.expandByPoint(Zn.max));
+ $n.setFromBufferAttribute(r), this.morphTargetsRelative ? (yn.addVectors(this.boundingBox.min, $n.min), this.boundingBox.expandByPoint(yn), yn.addVectors(this.boundingBox.max, $n.max), this.boundingBox.expandByPoint(yn)) : (this.boundingBox.expandByPoint($n.min), this.boundingBox.expandByPoint($n.max));
}
} else
this.boundingBox.makeEmpty();
@@ -7997,7 +7997,7 @@ class Tn extends Js {
* You may need to recompute the bounding sphere if the geometry vertices are modified.
*/
computeBoundingSphere() {
- this.boundingSphere === null && (this.boundingSphere = new zi());
+ this.boundingSphere === null && (this.boundingSphere = new Vi());
const e = this.attributes.position, t = this.morphAttributes.position;
if (e && e.isGLBufferAttribute) {
console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.", this), this.boundingSphere.set(new G(), 1 / 0);
@@ -8005,12 +8005,12 @@ class Tn extends Js {
}
if (e) {
const n = this.boundingSphere.center;
- if (Zn.setFromBufferAttribute(e), t)
+ if ($n.setFromBufferAttribute(e), t)
for (let r = 0, a = t.length; r < a; r++) {
const o = t[r];
- ao.setFromBufferAttribute(o), this.morphTargetsRelative ? (yn.addVectors(Zn.min, ao.min), Zn.expandByPoint(yn), yn.addVectors(Zn.max, ao.max), Zn.expandByPoint(yn)) : (Zn.expandByPoint(ao.min), Zn.expandByPoint(ao.max));
+ oo.setFromBufferAttribute(o), this.morphTargetsRelative ? (yn.addVectors($n.min, oo.min), $n.expandByPoint(yn), yn.addVectors($n.max, oo.max), $n.expandByPoint(yn)) : ($n.expandByPoint(oo.min), $n.expandByPoint(oo.max));
}
- Zn.getCenter(n);
+ $n.getCenter(n);
let s = 0;
for (let r = 0, a = e.count; r < a; r++)
yn.fromBufferAttribute(e, r), s = Math.max(s, n.distanceToSquared(yn));
@@ -8254,7 +8254,7 @@ class Tn extends Js {
this.dispatchEvent({ type: "dispose" });
}
}
-const nA = /* @__PURE__ */ new Ne(), sr = /* @__PURE__ */ new uc(), Lc = /* @__PURE__ */ new zi(), iA = /* @__PURE__ */ new G(), Pc = /* @__PURE__ */ new G(), kc = /* @__PURE__ */ new G(), Uc = /* @__PURE__ */ new G(), ru = /* @__PURE__ */ new G(), Oc = /* @__PURE__ */ new G(), sA = /* @__PURE__ */ new G(), Qc = /* @__PURE__ */ new G();
+const sA = /* @__PURE__ */ new Ne(), sr = /* @__PURE__ */ new dc(), Pc = /* @__PURE__ */ new Vi(), rA = /* @__PURE__ */ new G(), kc = /* @__PURE__ */ new G(), Uc = /* @__PURE__ */ new G(), Oc = /* @__PURE__ */ new G(), ou = /* @__PURE__ */ new G(), Qc = /* @__PURE__ */ new G(), aA = /* @__PURE__ */ new G(), Gc = /* @__PURE__ */ new G();
class Zt extends Tt {
/**
* Constructs a new mesh.
@@ -8298,12 +8298,12 @@ class Zt extends Tt {
t.fromBufferAttribute(s, e);
const o = this.morphTargetInfluences;
if (r && o) {
- Oc.set(0, 0, 0);
+ Qc.set(0, 0, 0);
for (let c = 0, l = r.length; c < l; c++) {
const h = o[c], u = r[c];
- h !== 0 && (ru.fromBufferAttribute(u, e), a ? Oc.addScaledVector(ru, h) : Oc.addScaledVector(ru.sub(t), h));
+ h !== 0 && (ou.fromBufferAttribute(u, e), a ? Qc.addScaledVector(ou, h) : Qc.addScaledVector(ou.sub(t), h));
}
- t.add(Oc);
+ t.add(Qc);
}
return t;
}
@@ -8315,7 +8315,7 @@ class Zt extends Tt {
*/
raycast(e, t) {
const n = this.geometry, s = this.material, r = this.matrixWorld;
- s !== void 0 && (n.boundingSphere === null && n.computeBoundingSphere(), Lc.copy(n.boundingSphere), Lc.applyMatrix4(r), sr.copy(e.ray).recast(e.near), !(Lc.containsPoint(sr.origin) === !1 && (sr.intersectSphere(Lc, iA) === null || sr.origin.distanceToSquared(iA) > (e.far - e.near) ** 2)) && (nA.copy(r).invert(), sr.copy(e.ray).applyMatrix4(nA), !(n.boundingBox !== null && sr.intersectsBox(n.boundingBox) === !1) && this._computeIntersections(e, t, sr)));
+ s !== void 0 && (n.boundingSphere === null && n.computeBoundingSphere(), Pc.copy(n.boundingSphere), Pc.applyMatrix4(r), sr.copy(e.ray).recast(e.near), !(Pc.containsPoint(sr.origin) === !1 && (sr.intersectSphere(Pc, rA) === null || sr.origin.distanceToSquared(rA) > (e.far - e.near) ** 2)) && (sA.copy(r).invert(), sr.copy(e.ray).applyMatrix4(sA), !(n.boundingBox !== null && sr.intersectsBox(n.boundingBox) === !1) && this._computeIntersections(e, t, sr)));
}
_computeIntersections(e, t, n) {
let s;
@@ -8326,14 +8326,14 @@ class Zt extends Tt {
const g = d[p], A = a[g.materialIndex], _ = Math.max(g.start, f.start), x = Math.min(o.count, Math.min(g.start + g.count, f.start + f.count));
for (let E = _, S = x; E < S; E += 3) {
const w = o.getX(E), I = o.getX(E + 1), T = o.getX(E + 2);
- s = Gc(this, A, e, n, l, h, u, w, I, T), s && (s.faceIndex = Math.floor(E / 3), s.face.materialIndex = g.materialIndex, t.push(s));
+ s = Hc(this, A, e, n, l, h, u, w, I, T), s && (s.faceIndex = Math.floor(E / 3), s.face.materialIndex = g.materialIndex, t.push(s));
}
}
else {
const p = Math.max(0, f.start), m = Math.min(o.count, f.start + f.count);
for (let g = p, A = m; g < A; g += 3) {
const _ = o.getX(g), x = o.getX(g + 1), E = o.getX(g + 2);
- s = Gc(this, a, e, n, l, h, u, _, x, E), s && (s.faceIndex = Math.floor(g / 3), t.push(s));
+ s = Hc(this, a, e, n, l, h, u, _, x, E), s && (s.faceIndex = Math.floor(g / 3), t.push(s));
}
}
else if (c !== void 0)
@@ -8342,35 +8342,35 @@ class Zt extends Tt {
const g = d[p], A = a[g.materialIndex], _ = Math.max(g.start, f.start), x = Math.min(c.count, Math.min(g.start + g.count, f.start + f.count));
for (let E = _, S = x; E < S; E += 3) {
const w = E, I = E + 1, T = E + 2;
- s = Gc(this, A, e, n, l, h, u, w, I, T), s && (s.faceIndex = Math.floor(E / 3), s.face.materialIndex = g.materialIndex, t.push(s));
+ s = Hc(this, A, e, n, l, h, u, w, I, T), s && (s.faceIndex = Math.floor(E / 3), s.face.materialIndex = g.materialIndex, t.push(s));
}
}
else {
const p = Math.max(0, f.start), m = Math.min(c.count, f.start + f.count);
for (let g = p, A = m; g < A; g += 3) {
const _ = g, x = g + 1, E = g + 2;
- s = Gc(this, a, e, n, l, h, u, _, x, E), s && (s.faceIndex = Math.floor(g / 3), t.push(s));
+ s = Hc(this, a, e, n, l, h, u, _, x, E), s && (s.faceIndex = Math.floor(g / 3), t.push(s));
}
}
}
}
-function C_(i, e, t, n, s, r, a, o) {
+function I_(i, e, t, n, s, r, a, o) {
let c;
- if (e.side === Vn ? c = n.intersectTriangle(a, r, s, !0, o) : c = n.intersectTriangle(s, r, a, e.side === bs, o), c === null) return null;
- Qc.copy(o), Qc.applyMatrix4(i.matrixWorld);
- const l = t.ray.origin.distanceTo(Qc);
+ if (e.side === Wn ? c = n.intersectTriangle(a, r, s, !0, o) : c = n.intersectTriangle(s, r, a, e.side === bs, o), c === null) return null;
+ Gc.copy(o), Gc.applyMatrix4(i.matrixWorld);
+ const l = t.ray.origin.distanceTo(Gc);
return l < t.near || l > t.far ? null : {
distance: l,
- point: Qc.clone(),
+ point: Gc.clone(),
object: i
};
}
-function Gc(i, e, t, n, s, r, a, o, c, l) {
- i.getVertexPosition(o, Pc), i.getVertexPosition(c, kc), i.getVertexPosition(l, Uc);
- const h = C_(i, e, t, n, Pc, kc, Uc, sA);
+function Hc(i, e, t, n, s, r, a, o, c, l) {
+ i.getVertexPosition(o, kc), i.getVertexPosition(c, Uc), i.getVertexPosition(l, Oc);
+ const h = I_(i, e, t, n, kc, Uc, Oc, aA);
if (h) {
const u = new G();
- Ii.getBarycoord(sA, Pc, kc, Uc, u), s && (h.uv = Ii.getInterpolatedAttribute(s, o, c, l, u, new Ze())), r && (h.uv1 = Ii.getInterpolatedAttribute(r, o, c, l, u, new Ze())), a && (h.normal = Ii.getInterpolatedAttribute(a, o, c, l, u, new G()), h.normal.dot(n.direction) > 0 && h.normal.multiplyScalar(-1));
+ Si.getBarycoord(aA, kc, Uc, Oc, u), s && (h.uv = Si.getInterpolatedAttribute(s, o, c, l, u, new Ze())), r && (h.uv1 = Si.getInterpolatedAttribute(r, o, c, l, u, new Ze())), a && (h.normal = Si.getInterpolatedAttribute(a, o, c, l, u, new G()), h.normal.dot(n.direction) > 0 && h.normal.multiplyScalar(-1));
const d = {
a: o,
b: c,
@@ -8378,11 +8378,11 @@ function Gc(i, e, t, n, s, r, a, o, c, l) {
normal: new G(),
materialIndex: 0
};
- Ii.getNormal(Pc, kc, Uc, d.normal), h.face = d, h.barycoord = u;
+ Si.getNormal(kc, Uc, Oc, d.normal), h.face = d, h.barycoord = u;
}
return h;
}
-class Wa extends Tn {
+class qa extends Tn {
/**
* Constructs a new box geometry.
*
@@ -8437,10 +8437,10 @@ class Wa extends Tn {
* @return {BoxGeometry} A new instance.
*/
static fromJSON(e) {
- return new Wa(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);
+ return new qa(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);
}
}
-function Pa(i) {
+function ka(i) {
const e = {};
for (const t in i) {
e[t] = {};
@@ -8451,32 +8451,32 @@ function Pa(i) {
}
return e;
}
-function Pn(i) {
+function kn(i) {
const e = {};
for (let t = 0; t < i.length; t++) {
- const n = Pa(i[t]);
+ const n = ka(i[t]);
for (const s in n)
e[s] = n[s];
}
return e;
}
-function I_(i) {
+function S_(i) {
const e = [];
for (let t = 0; t < i.length; t++)
e.push(i[t].clone());
return e;
}
-function F0(i) {
+function N0(i) {
const e = i.getRenderTarget();
return e === null ? i.outputColorSpace : e.isXRRenderTarget === !0 ? e.texture.colorSpace : rt.workingColorSpace;
}
-const S_ = { clone: Pa, merge: Pn };
-var M_ = `void main() {
+const M_ = { clone: ka, merge: kn };
+var B_ = `void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-}`, B_ = `void main() {
+}`, T_ = `void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;
-class qs extends ui {
+class qs extends di {
/**
* Constructs a new shader material.
*
@@ -8487,7 +8487,7 @@ class qs extends ui {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isShaderMaterial = !0, this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = M_, this.fragmentShader = B_, this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.forceSinglePass = !0, this.extensions = {
+ super(), this.isShaderMaterial = !0, this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = B_, this.fragmentShader = T_, 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,
// set to use vertex shader clipping
multiDraw: !1
@@ -8499,7 +8499,7 @@ class qs extends ui {
}, 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 = Pa(e.uniforms), this.uniformsGroups = I_(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;
+ return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = ka(e.uniforms), this.uniformsGroups = S_(e.uniformsGroups), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.fog = e.fog, this.lights = e.lights, this.clipping = e.clipping, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this;
}
toJSON(e) {
const t = super.toJSON(e);
@@ -8538,7 +8538,7 @@ class qs extends ui {
return Object.keys(n).length > 0 && (t.extensions = n), t;
}
}
-class N0 extends Tt {
+class D0 extends Tt {
/**
* Constructs a new camera.
*/
@@ -8570,8 +8570,8 @@ class N0 extends Tt {
return new this.constructor().copy(this);
}
}
-const Bs = /* @__PURE__ */ new G(), rA = /* @__PURE__ */ new Ze(), aA = /* @__PURE__ */ new Ze();
-class In extends N0 {
+const Bs = /* @__PURE__ */ new G(), oA = /* @__PURE__ */ new Ze(), cA = /* @__PURE__ */ new Ze();
+class In extends D0 {
/**
* Constructs a new perspective camera.
*
@@ -8596,7 +8596,7 @@ class In extends N0 {
*/
setFocalLength(e) {
const t = 0.5 * this.getFilmHeight() / e;
- this.fov = La * 2 * Math.atan(t), this.updateProjectionMatrix();
+ this.fov = Pa * 2 * Math.atan(t), this.updateProjectionMatrix();
}
/**
* Returns the focal length from the current {@link PerspectiveCamera#fov} and
@@ -8605,7 +8605,7 @@ class In extends N0 {
* @return {number} The computed focal length.
*/
getFocalLength() {
- const e = Math.tan(Fo * 0.5 * this.fov);
+ const e = Math.tan(No * 0.5 * this.fov);
return 0.5 * this.getFilmHeight() / e;
}
/**
@@ -8614,8 +8614,8 @@ class In extends N0 {
* @return {number} The effective FOV.
*/
getEffectiveFOV() {
- return La * 2 * Math.atan(
- Math.tan(Fo * 0.5 * this.fov) / this.zoom
+ return Pa * 2 * Math.atan(
+ Math.tan(No * 0.5 * this.fov) / this.zoom
);
}
/**
@@ -8655,7 +8655,7 @@ class In extends N0 {
* @returns {Vector2} The view size.
*/
getViewSize(e, t) {
- return this.getViewBounds(e, rA, aA), t.subVectors(aA, rA);
+ return this.getViewBounds(e, oA, cA), t.subVectors(cA, oA);
}
/**
* Sets an offset in a larger frustum. This is useful for multi-window or
@@ -8723,7 +8723,7 @@ class In extends N0 {
*/
updateProjectionMatrix() {
const e = this.near;
- let t = e * Math.tan(Fo * 0.5 * this.fov) / this.zoom, n = 2 * t, s = this.aspect * n, r = -0.5 * s;
+ let t = e * Math.tan(No * 0.5 * this.fov) / this.zoom, n = 2 * t, s = this.aspect * n, r = -0.5 * s;
const a = this.view;
if (this.view !== null && this.view.enabled) {
const c = a.fullWidth, l = a.fullHeight;
@@ -8738,7 +8738,7 @@ class In extends N0 {
}
}
const ia = -90, sa = 1;
-class T_ extends Tt {
+class R_ extends Tt {
/**
* Constructs a new cube camera.
*
@@ -8769,7 +8769,7 @@ class T_ extends Tt {
for (const l of t) this.remove(l);
if (e === ls)
n.up.set(0, 1, 0), n.lookAt(1, 0, 0), s.up.set(0, 1, 0), s.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 === Vl)
+ else if (e === ql)
n.up.set(0, -1, 0), n.lookAt(-1, 0, 0), s.up.set(0, -1, 0), s.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);
@@ -8793,7 +8793,7 @@ class T_ extends Tt {
n.texture.generateMipmaps = !1, e.setRenderTarget(n, 0, s), e.render(t, r), e.setRenderTarget(n, 1, s), e.render(t, a), e.setRenderTarget(n, 2, s), e.render(t, o), e.setRenderTarget(n, 3, s), e.render(t, c), e.setRenderTarget(n, 4, s), e.render(t, l), n.texture.generateMipmaps = m, e.setRenderTarget(n, 5, s), e.render(t, h), e.setRenderTarget(u, d, f), e.xr.enabled = p, n.texture.needsPMREMUpdate = !0;
}
}
-class D0 extends an {
+class L0 extends an {
/**
* Constructs a new cube texture.
*
@@ -8823,7 +8823,7 @@ class D0 extends an {
this.image = e;
}
}
-class R_ extends Rr {
+class F_ extends Rr {
/**
* Constructs a new cube render target.
*
@@ -8833,7 +8833,7 @@ class R_ extends Rr {
constructor(e = 1, t = {}) {
super(e, e, t), this.isWebGLCubeRenderTarget = !0;
const n = { width: e, height: e, depth: 1 }, s = [n, n, n, n, n, n];
- this.texture = new D0(s, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.generateMipmaps = t.generateMipmaps !== void 0 ? t.generateMipmaps : !1, this.texture.minFilter = t.minFilter !== void 0 ? t.minFilter : Xt;
+ this.texture = new L0(s, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.generateMipmaps = t.generateMipmaps !== void 0 ? t.generateMipmaps : !1, this.texture.minFilter = t.minFilter !== void 0 ? t.minFilter : Xt;
}
/**
* Converts the given equirectangular texture to a cube map.
@@ -8891,17 +8891,17 @@ class R_ extends Rr {
}
`
)
- }, s = new Wa(5, 5, 5), r = new qs({
+ }, s = new qa(5, 5, 5), r = new qs({
name: "CubemapFromEquirect",
- uniforms: Pa(n.uniforms),
+ uniforms: ka(n.uniforms),
vertexShader: n.vertexShader,
fragmentShader: n.fragmentShader,
- side: Vn,
+ side: Wn,
blending: Gs
});
r.uniforms.tEquirect.value = t;
const a = new Zt(s, r), o = t.minFilter;
- return t.minFilter === hi && (t.minFilter = Xt), new T_(1, 10, this).update(e, a), t.minFilter = o, a.geometry.dispose(), a.material.dispose(), this;
+ return t.minFilter === ui && (t.minFilter = Xt), new R_(1, 10, this).update(e, a), t.minFilter = o, a.geometry.dispose(), a.material.dispose(), this;
}
/**
* Clears this cube render target.
@@ -8923,8 +8923,8 @@ class hs extends Tt {
super(), this.isGroup = !0, this.type = "Group";
}
}
-const F_ = { type: "move" };
-class au {
+const N_ = { type: "move" };
+class cu {
/**
* Constructs a new XR controller.
*/
@@ -9021,7 +9021,7 @@ class au {
}));
} 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));
- o !== null && (s = t.getPose(e.targetRaySpace, n), s === null && r !== null && (s = r), s !== null && (o.matrix.fromArray(s.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, s.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(s.linearVelocity)) : o.hasLinearVelocity = !1, s.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(s.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(F_)));
+ o !== null && (s = t.getPose(e.targetRaySpace, n), s === null && r !== null && (s = r), s !== null && (o.matrix.fromArray(s.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, s.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(s.linearVelocity)) : o.hasLinearVelocity = !1, s.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(s.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(N_)));
}
return o !== null && (o.visible = s !== null), c !== null && (c.visible = r !== null), l !== null && (l.visible = a !== null), this;
}
@@ -9041,7 +9041,7 @@ class au {
return e.joints[t.jointName];
}
}
-class Qd extends Tt {
+class Hd extends Tt {
/**
* Constructs a new scene.
*/
@@ -9056,7 +9056,7 @@ class Qd extends Tt {
return this.fog !== null && (t.object.fog = this.fog.toJSON()), this.backgroundBlurriness > 0 && (t.object.backgroundBlurriness = this.backgroundBlurriness), this.backgroundIntensity !== 1 && (t.object.backgroundIntensity = this.backgroundIntensity), t.object.backgroundRotation = this.backgroundRotation.toArray(), this.environmentIntensity !== 1 && (t.object.environmentIntensity = this.environmentIntensity), t.object.environmentRotation = this.environmentRotation.toArray(), t;
}
}
-class N_ {
+class D_ {
/**
* Constructs a new interleaved buffer.
*
@@ -9064,7 +9064,7 @@ class N_ {
* @param {number} stride - The number of typed-array elements per vertex.
*/
constructor(e, t) {
- this.isInterleavedBuffer = !0, this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = Od, this.updateRanges = [], this.version = 0, this.uuid = Mi();
+ this.isInterleavedBuffer = !0, this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = Gd, this.updateRanges = [], this.version = 0, this.uuid = Bi();
}
/**
* A callback function that is executed after the renderer has transferred the attribute array
@@ -9149,7 +9149,7 @@ class N_ {
* @return {InterleavedBuffer} A clone of this instance.
*/
clone(e) {
- e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Mi()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);
+ e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Bi()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);
const t = new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]), n = new this.constructor(t, this.stride);
return n.setUsage(this.usage), n;
}
@@ -9171,7 +9171,7 @@ class N_ {
* @return {Object} A JSON object representing the serialized interleaved buffer.
*/
toJSON(e) {
- return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Mi()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer))), {
+ return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Bi()), 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,
@@ -9179,8 +9179,8 @@ class N_ {
};
}
}
-const Nn = /* @__PURE__ */ new G();
-class Wf {
+const Dn = /* @__PURE__ */ new G();
+class Kf {
/**
* Constructs a new interleaved buffer attribute.
*
@@ -9229,7 +9229,7 @@ class Wf {
*/
applyMatrix4(e) {
for (let t = 0, n = this.data.count; t < n; t++)
- Nn.fromBufferAttribute(this, t), Nn.applyMatrix4(e), this.setXYZ(t, Nn.x, Nn.y, Nn.z);
+ Dn.fromBufferAttribute(this, t), Dn.applyMatrix4(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);
return this;
}
/**
@@ -9241,7 +9241,7 @@ class Wf {
*/
applyNormalMatrix(e) {
for (let t = 0, n = this.count; t < n; t++)
- Nn.fromBufferAttribute(this, t), Nn.applyNormalMatrix(e), this.setXYZ(t, Nn.x, Nn.y, Nn.z);
+ Dn.fromBufferAttribute(this, t), Dn.applyNormalMatrix(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);
return this;
}
/**
@@ -9253,7 +9253,7 @@ class Wf {
*/
transformDirection(e) {
for (let t = 0, n = this.count; t < n; t++)
- Nn.fromBufferAttribute(this, t), Nn.transformDirection(e), this.setXYZ(t, Nn.x, Nn.y, Nn.z);
+ Dn.fromBufferAttribute(this, t), Dn.transformDirection(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);
return this;
}
/**
@@ -9265,7 +9265,7 @@ class Wf {
*/
getComponent(e, t) {
let n = this.array[e * this.data.stride + this.offset + t];
- return this.normalized && (n = Ci(n, this.array)), n;
+ return this.normalized && (n = Ii(n, this.array)), n;
}
/**
* Sets the given value to the given component of the vector at the given index.
@@ -9326,7 +9326,7 @@ class Wf {
*/
getX(e) {
let t = this.data.array[e * this.data.stride + this.offset];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Returns the y component of the vector at the given index.
@@ -9336,7 +9336,7 @@ class Wf {
*/
getY(e) {
let t = this.data.array[e * this.data.stride + this.offset + 1];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Returns the z component of the vector at the given index.
@@ -9346,7 +9346,7 @@ class Wf {
*/
getZ(e) {
let t = this.data.array[e * this.data.stride + this.offset + 2];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Returns the w component of the vector at the given index.
@@ -9356,7 +9356,7 @@ class Wf {
*/
getW(e) {
let t = this.data.array[e * this.data.stride + this.offset + 3];
- return this.normalized && (t = Ci(t, this.array)), t;
+ return this.normalized && (t = Ii(t, this.array)), t;
}
/**
* Sets the x and y component of the vector at the given index.
@@ -9413,7 +9413,7 @@ class Wf {
}
return new Bn(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 Wf(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
+ return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), new Kf(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
}
/**
* Serializes the buffer attribute into JSON.
@@ -9448,8 +9448,8 @@ class Wf {
};
}
}
-const oA = /* @__PURE__ */ new G(), cA = /* @__PURE__ */ new mt(), lA = /* @__PURE__ */ new mt(), D_ = /* @__PURE__ */ new G(), hA = /* @__PURE__ */ new Ne(), Hc = /* @__PURE__ */ new G(), ou = /* @__PURE__ */ new zi(), uA = /* @__PURE__ */ new Ne(), cu = /* @__PURE__ */ new uc();
-class L0 extends Zt {
+const lA = /* @__PURE__ */ new G(), hA = /* @__PURE__ */ new mt(), uA = /* @__PURE__ */ new mt(), L_ = /* @__PURE__ */ new G(), dA = /* @__PURE__ */ new Ne(), zc = /* @__PURE__ */ new G(), lu = /* @__PURE__ */ new Vi(), fA = /* @__PURE__ */ new Ne(), hu = /* @__PURE__ */ new dc();
+class P0 extends Zt {
/**
* Constructs a new skinned mesh.
*
@@ -9457,7 +9457,7 @@ class L0 extends Zt {
* @param {Material|Array<Material>} [material] - The mesh material.
*/
constructor(e, t) {
- super(e, t), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = Op, this.bindMatrix = new Ne(), this.bindMatrixInverse = new Ne(), this.boundingBox = null, this.boundingSphere = null;
+ super(e, t), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = Gp, this.bindMatrix = new Ne(), this.bindMatrixInverse = new Ne(), this.boundingBox = null, this.boundingSphere = null;
}
/**
* Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}.
@@ -9467,10 +9467,10 @@ class L0 extends Zt {
*/
computeBoundingBox() {
const e = this.geometry;
- this.boundingBox === null && (this.boundingBox = new Hi()), this.boundingBox.makeEmpty();
+ this.boundingBox === null && (this.boundingBox = new zi()), this.boundingBox.makeEmpty();
const t = e.getAttribute("position");
for (let n = 0; n < t.count; n++)
- this.getVertexPosition(n, Hc), this.boundingBox.expandByPoint(Hc);
+ this.getVertexPosition(n, zc), this.boundingBox.expandByPoint(zc);
}
/**
* Computes the bounding sphere of the skinned mesh, and updates {@link SkinnedMesh#boundingSphere}.
@@ -9480,17 +9480,17 @@ class L0 extends Zt {
*/
computeBoundingSphere() {
const e = this.geometry;
- this.boundingSphere === null && (this.boundingSphere = new zi()), this.boundingSphere.makeEmpty();
+ this.boundingSphere === null && (this.boundingSphere = new Vi()), this.boundingSphere.makeEmpty();
const t = e.getAttribute("position");
for (let n = 0; n < t.count; n++)
- this.getVertexPosition(n, Hc), this.boundingSphere.expandByPoint(Hc);
+ this.getVertexPosition(n, zc), this.boundingSphere.expandByPoint(zc);
}
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) {
const n = this.material, s = this.matrixWorld;
- n !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), ou.copy(this.boundingSphere), ou.applyMatrix4(s), e.ray.intersectsSphere(ou) !== !1 && (uA.copy(s).invert(), cu.copy(e.ray).applyMatrix4(uA), !(this.boundingBox !== null && cu.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(e, t, cu)));
+ n !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), lu.copy(this.boundingSphere), lu.applyMatrix4(s), e.ray.intersectsSphere(lu) !== !1 && (fA.copy(s).invert(), hu.copy(e.ray).applyMatrix4(fA), !(this.boundingBox !== null && hu.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(e, t, hu)));
}
getVertexPosition(e, t) {
return super.getVertexPosition(e, t), this.applyBoneTransform(e, t), t;
@@ -9524,7 +9524,7 @@ class L0 extends Zt {
}
}
updateMatrixWorld(e) {
- super.updateMatrixWorld(e), this.bindMode === Op ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === Sy ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode);
+ super.updateMatrixWorld(e), this.bindMode === Gp ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === My ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode);
}
/**
* Applies the bone transform associated with the given index to the given
@@ -9537,18 +9537,18 @@ class L0 extends Zt {
*/
applyBoneTransform(e, t) {
const n = this.skeleton, s = this.geometry;
- cA.fromBufferAttribute(s.attributes.skinIndex, e), lA.fromBufferAttribute(s.attributes.skinWeight, e), oA.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);
+ hA.fromBufferAttribute(s.attributes.skinIndex, e), uA.fromBufferAttribute(s.attributes.skinWeight, e), lA.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);
for (let r = 0; r < 4; r++) {
- const a = lA.getComponent(r);
+ const a = uA.getComponent(r);
if (a !== 0) {
- const o = cA.getComponent(r);
- hA.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(D_.copy(oA).applyMatrix4(hA), a);
+ const o = hA.getComponent(r);
+ dA.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(L_.copy(lA).applyMatrix4(dA), a);
}
}
return t.applyMatrix4(this.bindMatrixInverse);
}
}
-class Wl extends Tt {
+class Kl extends Tt {
/**
* Constructs a new bone.
*/
@@ -9556,7 +9556,7 @@ class Wl extends Tt {
super(), this.isBone = !0, this.type = "Bone";
}
}
-class fh extends an {
+class Ah extends an {
/**
* Constructs a new data texture.
*
@@ -9573,12 +9573,12 @@ class fh extends an {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space.
*/
- constructor(e = null, t = 1, n = 1, s, r, a, o, c, l = Wn, h = Wn, u, d) {
+ constructor(e = null, t = 1, n = 1, s, r, a, o, c, l = qn, h = qn, u, d) {
super(null, a, o, c, l, h, s, r, u, d), this.isDataTexture = !0, this.image = { data: e, width: t, height: n }, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}
-const dA = /* @__PURE__ */ new Ne(), L_ = /* @__PURE__ */ new Ne();
-class ph {
+const pA = /* @__PURE__ */ new Ne(), P_ = /* @__PURE__ */ new Ne();
+class gh {
/**
* Constructs a new skeleton.
*
@@ -9587,7 +9587,7 @@ class ph {
* If not provided, these matrices will be computed automatically via {@link Skeleton#calculateInverses}.
*/
constructor(e = [], t = []) {
- this.uuid = Mi(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.init();
+ this.uuid = Bi(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.init();
}
/**
* Initializes the skeleton. This method gets automatically called by the constructor
@@ -9634,8 +9634,8 @@ class ph {
update() {
const e = this.bones, t = this.boneInverses, n = this.boneMatrices, s = this.boneTexture;
for (let r = 0, a = e.length; r < a; r++) {
- const o = e[r] ? e[r].matrixWorld : L_;
- dA.multiplyMatrices(o, t[r]), dA.toArray(n, r * 16);
+ const o = e[r] ? e[r].matrixWorld : P_;
+ pA.multiplyMatrices(o, t[r]), pA.toArray(n, r * 16);
}
s !== null && (s.needsUpdate = !0);
}
@@ -9645,7 +9645,7 @@ class ph {
* @return {Skeleton} A clone of this instance.
*/
clone() {
- return new ph(this.bones, this.boneInverses);
+ return new gh(this.bones, this.boneInverses);
}
/**
* Computes a data texture for passing bone data to the vertex shader.
@@ -9657,7 +9657,7 @@ class ph {
e = Math.ceil(e / 4) * 4, e = Math.max(e, 4);
const t = new Float32Array(e * e * 4);
t.set(this.boneMatrices);
- const n = new fh(t, e, e, pn, fn);
+ const n = new Ah(t, e, e, pn, fn);
return n.needsUpdate = !0, this.boneMatrices = t, this.boneTexture = n, this;
}
/**
@@ -9693,7 +9693,7 @@ class ph {
for (let n = 0, s = e.bones.length; n < s; n++) {
const r = e.bones[n];
let a = t[r];
- a === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", r), a = new Wl()), this.bones.push(a), this.boneInverses.push(new Ne().fromArray(e.boneInverses[n]));
+ a === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", r), a = new Kl()), this.bones.push(a), this.boneInverses.push(new Ne().fromArray(e.boneInverses[n]));
}
return this.init(), this;
}
@@ -9724,7 +9724,7 @@ class ph {
return e;
}
}
-class Gd extends Bn {
+class zd extends Bn {
/**
* Constructs a new instanced buffer attribute.
*
@@ -9744,8 +9744,8 @@ class Gd extends Bn {
return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e;
}
}
-const ra = /* @__PURE__ */ new Ne(), fA = /* @__PURE__ */ new Ne(), zc = [], pA = /* @__PURE__ */ new Hi(), P_ = /* @__PURE__ */ new Ne(), oo = /* @__PURE__ */ new Zt(), co = /* @__PURE__ */ new zi();
-class P0 extends Zt {
+const ra = /* @__PURE__ */ new Ne(), AA = /* @__PURE__ */ new Ne(), Vc = [], gA = /* @__PURE__ */ new zi(), k_ = /* @__PURE__ */ new Ne(), co = /* @__PURE__ */ new Zt(), lo = /* @__PURE__ */ new Vi();
+class k0 extends Zt {
/**
* Constructs a new instanced mesh.
*
@@ -9754,9 +9754,9 @@ class P0 extends Zt {
* @param {number} count - The number of instances.
*/
constructor(e, t, n) {
- super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new Gd(new Float32Array(n * 16), 16), this.instanceColor = null, this.morphTexture = null, this.count = n, this.boundingBox = null, this.boundingSphere = null;
+ super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new zd(new Float32Array(n * 16), 16), this.instanceColor = null, this.morphTexture = null, this.count = n, this.boundingBox = null, this.boundingSphere = null;
for (let s = 0; s < n; s++)
- this.setMatrixAt(s, P_);
+ this.setMatrixAt(s, k_);
}
/**
* Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}.
@@ -9765,9 +9765,9 @@ class P0 extends Zt {
*/
computeBoundingBox() {
const e = this.geometry, t = this.count;
- this.boundingBox === null && (this.boundingBox = new Hi()), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty();
+ this.boundingBox === null && (this.boundingBox = new zi()), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty();
for (let n = 0; n < t; n++)
- this.getMatrixAt(n, ra), pA.copy(e.boundingBox).applyMatrix4(ra), this.boundingBox.union(pA);
+ this.getMatrixAt(n, ra), gA.copy(e.boundingBox).applyMatrix4(ra), this.boundingBox.union(gA);
}
/**
* Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere}
@@ -9776,9 +9776,9 @@ class P0 extends Zt {
*/
computeBoundingSphere() {
const e = this.geometry, t = this.count;
- this.boundingSphere === null && (this.boundingSphere = new zi()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();
+ this.boundingSphere === null && (this.boundingSphere = new Vi()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();
for (let n = 0; n < t; n++)
- this.getMatrixAt(n, ra), co.copy(e.boundingSphere).applyMatrix4(ra), this.boundingSphere.union(co);
+ this.getMatrixAt(n, ra), lo.copy(e.boundingSphere).applyMatrix4(ra), this.boundingSphere.union(lo);
}
copy(e, t) {
return super.copy(e, t), this.instanceMatrix.copy(e.instanceMatrix), 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;
@@ -9814,14 +9814,14 @@ class P0 extends Zt {
}
raycast(e, t) {
const n = this.matrixWorld, s = this.count;
- if (oo.geometry = this.geometry, oo.material = this.material, oo.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), co.copy(this.boundingSphere), co.applyMatrix4(n), e.ray.intersectsSphere(co) !== !1))
+ if (co.geometry = this.geometry, co.material = this.material, co.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), lo.copy(this.boundingSphere), lo.applyMatrix4(n), e.ray.intersectsSphere(lo) !== !1))
for (let r = 0; r < s; r++) {
- this.getMatrixAt(r, ra), fA.multiplyMatrices(n, ra), oo.matrixWorld = fA, oo.raycast(e, zc);
- for (let a = 0, o = zc.length; a < o; a++) {
- const c = zc[a];
+ this.getMatrixAt(r, ra), AA.multiplyMatrices(n, ra), co.matrixWorld = AA, co.raycast(e, Vc);
+ for (let a = 0, o = Vc.length; a < o; a++) {
+ const c = Vc[a];
c.instanceId = r, c.object = this, t.push(c);
}
- zc.length = 0;
+ Vc.length = 0;
}
}
/**
@@ -9832,7 +9832,7 @@ class P0 extends Zt {
* @param {Color} color - The instance color.
*/
setColorAt(e, t) {
- this.instanceColor === null && (this.instanceColor = new Gd(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3)), t.toArray(this.instanceColor.array, e * 3);
+ this.instanceColor === null && (this.instanceColor = new zd(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3)), t.toArray(this.instanceColor.array, e * 3);
}
/**
* Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
@@ -9854,7 +9854,7 @@ class P0 extends Zt {
*/
setMorphAt(e, t) {
const n = t.morphTargetInfluences, s = n.length + 1;
- this.morphTexture === null && (this.morphTexture = new fh(new Float32Array(s * this.count), s, this.count, cs, fn));
+ this.morphTexture === null && (this.morphTexture = new Ah(new Float32Array(s * this.count), s, this.count, cs, fn));
const r = this.morphTexture.source.data.data;
let a = 0;
for (let l = 0; l < n.length; l++)
@@ -9872,7 +9872,7 @@ class P0 extends Zt {
this.dispatchEvent({ type: "dispose" }), this.morphTexture !== null && (this.morphTexture.dispose(), this.morphTexture = null);
}
}
-const lu = /* @__PURE__ */ new G(), k_ = /* @__PURE__ */ new G(), U_ = /* @__PURE__ */ new at();
+const uu = /* @__PURE__ */ new G(), U_ = /* @__PURE__ */ new G(), O_ = /* @__PURE__ */ new at();
class Us {
/**
* Constructs a new plane.
@@ -9928,7 +9928,7 @@ class Us {
* @return {Plane} A reference to this plane.
*/
setFromCoplanarPoints(e, t, n) {
- const s = lu.subVectors(n, t).cross(k_.subVectors(e, t)).normalize();
+ const s = uu.subVectors(n, t).cross(U_.subVectors(e, t)).normalize();
return this.setFromNormalAndCoplanarPoint(s, e), this;
}
/**
@@ -9995,7 +9995,7 @@ class Us {
* @return {?Vector3} The intersection point.
*/
intersectLine(e, t) {
- const n = e.delta(lu), s = this.normal.dot(n);
+ const n = e.delta(uu), s = this.normal.dot(n);
if (s === 0)
return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null;
const r = -(e.start.dot(this.normal) + this.constant) / s;
@@ -10052,7 +10052,7 @@ class Us {
* @return {Plane} A reference to this plane.
*/
applyMatrix4(e, t) {
- const n = t || U_.getNormalMatrix(e), s = this.coplanarPoint(lu).applyMatrix4(e), r = this.normal.applyMatrix3(n).normalize();
+ const n = t || O_.getNormalMatrix(e), s = this.coplanarPoint(uu).applyMatrix4(e), r = this.normal.applyMatrix3(n).normalize();
return this.constant = -s.dot(r), this;
}
/**
@@ -10083,8 +10083,8 @@ class Us {
return new this.constructor().copy(this);
}
}
-const rr = /* @__PURE__ */ new zi(), Vc = /* @__PURE__ */ new G();
-class qf {
+const rr = /* @__PURE__ */ new Vi(), Wc = /* @__PURE__ */ new G();
+class jf {
/**
* Constructs a new frustum.
*
@@ -10136,7 +10136,7 @@ class qf {
const n = this.planes, s = e.elements, r = s[0], a = s[1], o = s[2], c = s[3], l = s[4], h = s[5], u = s[6], d = s[7], f = s[8], p = s[9], m = s[10], g = s[11], A = s[12], _ = s[13], x = s[14], E = s[15];
if (n[0].setComponents(c - r, d - l, g - f, E - A).normalize(), n[1].setComponents(c + r, d + l, g + f, E + A).normalize(), n[2].setComponents(c + a, d + h, g + p, E + _).normalize(), n[3].setComponents(c - a, d - h, g - p, E - _).normalize(), n[4].setComponents(c - o, d - u, g - m, E - x).normalize(), t === ls)
n[5].setComponents(c + o, d + u, g + m, E + x).normalize();
- else if (t === Vl)
+ else if (t === ql)
n[5].setComponents(o, u, m, x).normalize();
else
throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + t);
@@ -10191,7 +10191,7 @@ class qf {
const t = this.planes;
for (let n = 0; n < 6; n++) {
const s = t[n];
- if (Vc.x = s.normal.x > 0 ? e.max.x : e.min.x, Vc.y = s.normal.y > 0 ? e.max.y : e.min.y, Vc.z = s.normal.z > 0 ? e.max.z : e.min.z, s.distanceToPoint(Vc) < 0)
+ if (Wc.x = s.normal.x > 0 ? e.max.x : e.min.x, Wc.y = s.normal.y > 0 ? e.max.y : e.min.y, Wc.z = s.normal.z > 0 ? e.max.z : e.min.z, s.distanceToPoint(Wc) < 0)
return !1;
}
return !0;
@@ -10218,7 +10218,7 @@ class qf {
return new this.constructor().copy(this);
}
}
-class qa extends ui {
+class Ka extends di {
/**
* Constructs a new line basic material.
*
@@ -10235,15 +10235,15 @@ class qa extends ui {
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.fog = e.fog, this;
}
}
-const ql = /* @__PURE__ */ new G(), Kl = /* @__PURE__ */ new G(), AA = /* @__PURE__ */ new Ne(), lo = /* @__PURE__ */ new uc(), Wc = /* @__PURE__ */ new zi(), hu = /* @__PURE__ */ new G(), gA = /* @__PURE__ */ new G();
-class Ah extends Tt {
+const jl = /* @__PURE__ */ new G(), Xl = /* @__PURE__ */ new G(), mA = /* @__PURE__ */ new Ne(), ho = /* @__PURE__ */ new dc(), qc = /* @__PURE__ */ new Vi(), du = /* @__PURE__ */ new G(), xA = /* @__PURE__ */ new G();
+class mh extends Tt {
/**
* Constructs a new line.
*
* @param {BufferGeometry} [geometry] - The line geometry.
* @param {Material|Array<Material>} [material] - The line material.
*/
- constructor(e = new Tn(), t = new qa()) {
+ constructor(e = new Tn(), t = new Ka()) {
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) {
@@ -10261,7 +10261,7 @@ class Ah extends Tt {
if (e.index === null) {
const t = e.attributes.position, n = [0];
for (let s = 1, r = t.count; s < r; s++)
- ql.fromBufferAttribute(t, s - 1), Kl.fromBufferAttribute(t, s), n[s] = n[s - 1], n[s] += ql.distanceTo(Kl);
+ jl.fromBufferAttribute(t, s - 1), Xl.fromBufferAttribute(t, s), n[s] = n[s - 1], n[s] += jl.distanceTo(Xl);
e.setAttribute("lineDistance", new en(n, 1));
} else
console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
@@ -10275,27 +10275,27 @@ class Ah extends Tt {
*/
raycast(e, t) {
const n = this.geometry, s = this.matrixWorld, r = e.params.Line.threshold, a = n.drawRange;
- if (n.boundingSphere === null && n.computeBoundingSphere(), Wc.copy(n.boundingSphere), Wc.applyMatrix4(s), Wc.radius += r, e.ray.intersectsSphere(Wc) === !1) return;
- AA.copy(s).invert(), lo.copy(e.ray).applyMatrix4(AA);
+ if (n.boundingSphere === null && n.computeBoundingSphere(), qc.copy(n.boundingSphere), qc.applyMatrix4(s), qc.radius += r, e.ray.intersectsSphere(qc) === !1) return;
+ mA.copy(s).invert(), ho.copy(e.ray).applyMatrix4(mA);
const 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) {
const f = Math.max(0, a.start), p = Math.min(h.count, a.start + a.count);
for (let m = f, g = p - 1; m < g; m += l) {
- const A = h.getX(m), _ = h.getX(m + 1), x = qc(this, e, lo, c, A, _, m);
+ const A = h.getX(m), _ = h.getX(m + 1), x = Kc(this, e, ho, c, A, _, m);
x && t.push(x);
}
if (this.isLineLoop) {
- const m = h.getX(p - 1), g = h.getX(f), A = qc(this, e, lo, c, m, g, p - 1);
+ const m = h.getX(p - 1), g = h.getX(f), A = Kc(this, e, ho, c, m, g, p - 1);
A && t.push(A);
}
} else {
const f = Math.max(0, a.start), p = Math.min(d.count, a.start + a.count);
for (let m = f, g = p - 1; m < g; m += l) {
- const A = qc(this, e, lo, c, m, m + 1, m);
+ const A = Kc(this, e, ho, c, m, m + 1, m);
A && t.push(A);
}
if (this.isLineLoop) {
- const m = qc(this, e, lo, c, p - 1, f, p - 1);
+ const m = Kc(this, e, ho, c, p - 1, f, p - 1);
m && t.push(m);
}
}
@@ -10318,17 +10318,17 @@ class Ah extends Tt {
}
}
}
-function qc(i, e, t, n, s, r, a) {
+function Kc(i, e, t, n, s, r, a) {
const o = i.geometry.attributes.position;
- if (ql.fromBufferAttribute(o, s), Kl.fromBufferAttribute(o, r), t.distanceSqToSegment(ql, Kl, hu, gA) > n) return;
- hu.applyMatrix4(i.matrixWorld);
- const l = e.ray.origin.distanceTo(hu);
+ if (jl.fromBufferAttribute(o, s), Xl.fromBufferAttribute(o, r), t.distanceSqToSegment(jl, Xl, du, xA) > n) return;
+ du.applyMatrix4(i.matrixWorld);
+ const l = e.ray.origin.distanceTo(du);
if (!(l < e.near || l > e.far))
return {
distance: l,
// What do we want? intersection point on the ray or on the segment??
// point: raycaster.ray.at( distance ),
- point: gA.clone().applyMatrix4(i.matrixWorld),
+ point: xA.clone().applyMatrix4(i.matrixWorld),
index: a,
face: null,
faceIndex: null,
@@ -10336,8 +10336,8 @@ function qc(i, e, t, n, s, r, a) {
object: i
};
}
-const mA = /* @__PURE__ */ new G(), xA = /* @__PURE__ */ new G();
-class gh extends Ah {
+const bA = /* @__PURE__ */ new G(), EA = /* @__PURE__ */ new G();
+class xh extends mh {
/**
* Constructs a new line segments.
*
@@ -10352,14 +10352,14 @@ class gh extends Ah {
if (e.index === null) {
const t = e.attributes.position, n = [];
for (let s = 0, r = t.count; s < r; s += 2)
- mA.fromBufferAttribute(t, s), xA.fromBufferAttribute(t, s + 1), n[s] = s === 0 ? 0 : n[s - 1], n[s + 1] = n[s] + mA.distanceTo(xA);
+ bA.fromBufferAttribute(t, s), EA.fromBufferAttribute(t, s + 1), n[s] = s === 0 ? 0 : n[s - 1], n[s + 1] = n[s] + bA.distanceTo(EA);
e.setAttribute("lineDistance", new en(n, 1));
} else
console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
return this;
}
}
-class O_ extends Ah {
+class Q_ extends mh {
/**
* Constructs a new line loop.
*
@@ -10370,7 +10370,7 @@ class O_ extends Ah {
super(e, t), this.isLineLoop = !0, this.type = "LineLoop";
}
}
-class Kf extends ui {
+class Xf extends di {
/**
* Constructs a new points material.
*
@@ -10387,15 +10387,15 @@ class Kf extends ui {
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;
}
}
-const bA = /* @__PURE__ */ new Ne(), Hd = /* @__PURE__ */ new uc(), Kc = /* @__PURE__ */ new zi(), jc = /* @__PURE__ */ new G();
-class Q_ extends Tt {
+const yA = /* @__PURE__ */ new Ne(), Vd = /* @__PURE__ */ new dc(), jc = /* @__PURE__ */ new Vi(), Xc = /* @__PURE__ */ new G();
+class G_ extends Tt {
/**
* Constructs a new point cloud.
*
* @param {BufferGeometry} [geometry] - The points geometry.
* @param {Material|Array<Material>} [material] - The points material.
*/
- constructor(e = new Tn(), t = new Kf()) {
+ constructor(e = new Tn(), t = new Xf()) {
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) {
@@ -10409,19 +10409,19 @@ class Q_ extends Tt {
*/
raycast(e, t) {
const n = this.geometry, s = this.matrixWorld, r = e.params.Points.threshold, a = n.drawRange;
- if (n.boundingSphere === null && n.computeBoundingSphere(), Kc.copy(n.boundingSphere), Kc.applyMatrix4(s), Kc.radius += r, e.ray.intersectsSphere(Kc) === !1) return;
- bA.copy(s).invert(), Hd.copy(e.ray).applyMatrix4(bA);
+ if (n.boundingSphere === null && n.computeBoundingSphere(), jc.copy(n.boundingSphere), jc.applyMatrix4(s), jc.radius += r, e.ray.intersectsSphere(jc) === !1) return;
+ yA.copy(s).invert(), Vd.copy(e.ray).applyMatrix4(yA);
const 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) {
const d = Math.max(0, a.start), f = Math.min(l.count, a.start + a.count);
for (let p = d, m = f; p < m; p++) {
const g = l.getX(p);
- jc.fromBufferAttribute(u, g), EA(jc, g, c, s, e, t, this);
+ Xc.fromBufferAttribute(u, g), _A(Xc, g, c, s, e, t, this);
}
} else {
const d = Math.max(0, a.start), f = Math.min(u.count, a.start + a.count);
for (let p = d, m = f; p < m; p++)
- jc.fromBufferAttribute(u, p), EA(jc, p, c, s, e, t, this);
+ Xc.fromBufferAttribute(u, p), _A(Xc, p, c, s, e, t, this);
}
}
/**
@@ -10442,11 +10442,11 @@ class Q_ extends Tt {
}
}
}
-function EA(i, e, t, n, s, r, a) {
- const o = Hd.distanceSqToPoint(i);
+function _A(i, e, t, n, s, r, a) {
+ const o = Vd.distanceSqToPoint(i);
if (o < t) {
const c = new G();
- Hd.closestPointToPoint(i, c), c.applyMatrix4(n);
+ Vd.closestPointToPoint(i, c), c.applyMatrix4(n);
const l = s.ray.origin.distanceTo(c);
if (l < s.near || l > s.far) return;
r.push({
@@ -10461,7 +10461,7 @@ function EA(i, e, t, n, s, r, a) {
});
}
}
-class mh extends an {
+class bh extends an {
/**
* Constructs a new compressed texture.
*
@@ -10483,7 +10483,7 @@ class mh extends an {
super(null, a, o, c, l, h, s, r, u, d), this.isCompressedTexture = !0, this.image = { width: t, height: n }, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1;
}
}
-class G_ extends mh {
+class H_ extends bh {
/**
* Constructs a new compressed array texture.
*
@@ -10496,7 +10496,7 @@ class G_ extends mh {
* @param {number} [type=UnsignedByteType] - The min filter value.
*/
constructor(e, t, n, s, r, a) {
- super(e, t, n, r, a), this.isCompressedArrayTexture = !0, this.image.depth = s, this.wrapR = ti, this.layerUpdates = /* @__PURE__ */ new Set();
+ super(e, t, n, r, a), this.isCompressedArrayTexture = !0, this.image.depth = s, this.wrapR = ni, this.layerUpdates = /* @__PURE__ */ new Set();
}
/**
* Describes that a specific layer of the texture needs to be updated.
@@ -10517,7 +10517,7 @@ class G_ extends mh {
this.layerUpdates.clear();
}
}
-class H_ extends mh {
+class z_ extends bh {
/**
* Constructs a new compressed texture.
*
@@ -10529,7 +10529,7 @@ class H_ extends mh {
super(void 0, e[0].width, e[0].height, t, n, Br), this.isCompressedCubeTexture = !0, this.isCubeTexture = !0, this.image = e;
}
}
-class k0 extends an {
+class U0 extends an {
/**
* Constructs a new depth texture.
*
@@ -10544,20 +10544,20 @@ class k0 extends an {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {number} [format=DepthFormat] - The texture format.
*/
- constructor(e, t, n = Tr, s, r, a, o = Wn, c = Wn, l, h = Ho) {
- if (h !== Ho && h !== zo)
+ constructor(e, t, n = Tr, s, r, a, o = qn, c = qn, l, h = zo) {
+ if (h !== zo && h !== Vo)
throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
super(null, s, r, a, o, c, h, n, l), this.isDepthTexture = !0, this.image = { width: e, height: t }, this.flipY = !1, this.generateMipmaps = !1, this.compareFunction = null;
}
copy(e) {
- return super.copy(e), this.source = new zf(Object.assign({}, e.image)), this.compareFunction = e.compareFunction, this;
+ return super.copy(e), this.source = new Wf(Object.assign({}, e.image)), this.compareFunction = e.compareFunction, this;
}
toJSON(e) {
const t = super.toJSON(e);
return this.compareFunction !== null && (t.compareFunction = this.compareFunction), t;
}
}
-class z_ {
+class V_ {
/**
* Constructs a new curve.
*/
@@ -10791,13 +10791,13 @@ class z_ {
return this.arcLengthDivisions = e.arcLengthDivisions, this;
}
}
-function V_(i, e, t = 2) {
+function W_(i, e, t = 2) {
const n = e && e.length, s = n ? e[0] * t : i.length;
- let r = U0(i, 0, s, t, !0);
+ let r = O0(i, 0, s, t, !0);
const a = [];
if (!r || r.next === r.prev) return a;
let o, c, l;
- if (n && (r = X_(i, e, r, t)), i.length > 80 * t) {
+ if (n && (r = Y_(i, e, r, t)), i.length > 80 * t) {
o = 1 / 0, c = 1 / 0;
let h = -1 / 0, u = -1 / 0;
for (let d = t; d < s; d += t) {
@@ -10806,91 +10806,91 @@ function V_(i, e, t = 2) {
}
l = Math.max(h - o, u - c), l = l !== 0 ? 32767 / l : 0;
}
- return Xo(r, a, t, o, c, l, 0), a;
+ return Yo(r, a, t, o, c, l, 0), a;
}
-function U0(i, e, t, n, s) {
+function O0(i, e, t, n, s) {
let r;
- if (s === aw(i, e, t, n) > 0)
- for (let a = e; a < t; a += n) r = yA(a / n | 0, i[a], i[a + 1], r);
+ if (s === ow(i, e, t, n) > 0)
+ for (let a = e; a < t; a += n) r = wA(a / n | 0, i[a], i[a + 1], r);
else
- for (let a = t - n; a >= e; a -= n) r = yA(a / n | 0, i[a], i[a + 1], r);
- return r && ka(r, r.next) && (Jo(r), r = r.next), r;
+ for (let a = t - n; a >= e; a -= n) r = wA(a / n | 0, i[a], i[a + 1], r);
+ return r && Ua(r, r.next) && (Zo(r), r = r.next), r;
}
function Fr(i, e) {
if (!i) return i;
e || (e = i);
let t = i, n;
do
- if (n = !1, !t.steiner && (ka(t, t.next) || Wt(t.prev, t, t.next) === 0)) {
- if (Jo(t), t = e = t.prev, t === t.next) break;
+ if (n = !1, !t.steiner && (Ua(t, t.next) || Wt(t.prev, t, t.next) === 0)) {
+ if (Zo(t), t = e = t.prev, t === t.next) break;
n = !0;
} else
t = t.next;
while (n || t !== e);
return e;
}
-function Xo(i, e, t, n, s, r, a) {
+function Yo(i, e, t, n, s, r, a) {
if (!i) return;
- !a && r && ew(i, n, s, r);
+ !a && r && tw(i, n, s, r);
let o = i;
for (; i.prev !== i.next; ) {
const c = i.prev, l = i.next;
- if (r ? q_(i, n, s, r) : W_(i)) {
- e.push(c.i, i.i, l.i), Jo(i), i = l.next, o = l.next;
+ if (r ? K_(i, n, s, r) : q_(i)) {
+ e.push(c.i, i.i, l.i), Zo(i), i = l.next, o = l.next;
continue;
}
if (i = l, i === o) {
- a ? a === 1 ? (i = K_(Fr(i), e), Xo(i, e, t, n, s, r, 2)) : a === 2 && j_(i, e, t, n, s, r) : Xo(Fr(i), e, t, n, s, r, 1);
+ a ? a === 1 ? (i = j_(Fr(i), e), Yo(i, e, t, n, s, r, 2)) : a === 2 && X_(i, e, t, n, s, r) : Yo(Fr(i), e, t, n, s, r, 1);
break;
}
}
}
-function W_(i) {
+function q_(i) {
const e = i.prev, t = i, n = i.next;
if (Wt(e, t, n) >= 0) return !1;
const s = e.x, r = t.x, a = n.x, o = e.y, c = t.y, l = n.y, h = Math.min(s, r, a), u = Math.min(o, c, l), d = Math.max(s, r, a), f = Math.max(o, c, l);
let p = n.next;
for (; p !== e; ) {
- if (p.x >= h && p.x <= d && p.y >= u && p.y <= f && _o(s, o, r, c, a, l, p.x, p.y) && Wt(p.prev, p, p.next) >= 0) return !1;
+ if (p.x >= h && p.x <= d && p.y >= u && p.y <= f && wo(s, o, r, c, a, l, p.x, p.y) && Wt(p.prev, p, p.next) >= 0) return !1;
p = p.next;
}
return !0;
}
-function q_(i, e, t, n) {
+function K_(i, e, t, n) {
const s = i.prev, r = i, a = i.next;
if (Wt(s, r, a) >= 0) return !1;
- const o = s.x, c = r.x, l = a.x, h = s.y, u = r.y, d = a.y, f = Math.min(o, c, l), p = Math.min(h, u, d), m = Math.max(o, c, l), g = Math.max(h, u, d), A = zd(f, p, e, t, n), _ = zd(m, g, e, t, n);
+ const o = s.x, c = r.x, l = a.x, h = s.y, u = r.y, d = a.y, f = Math.min(o, c, l), p = Math.min(h, u, d), m = Math.max(o, c, l), g = Math.max(h, u, d), A = Wd(f, p, e, t, n), _ = Wd(m, g, e, t, n);
let x = i.prevZ, E = i.nextZ;
for (; x && x.z >= A && E && E.z <= _; ) {
- if (x.x >= f && x.x <= m && x.y >= p && x.y <= g && x !== s && x !== a && _o(o, h, c, u, l, d, x.x, x.y) && Wt(x.prev, x, x.next) >= 0 || (x = x.prevZ, E.x >= f && E.x <= m && E.y >= p && E.y <= g && E !== s && E !== a && _o(o, h, c, u, l, d, E.x, E.y) && Wt(E.prev, E, E.next) >= 0)) return !1;
+ if (x.x >= f && x.x <= m && x.y >= p && x.y <= g && x !== s && x !== a && wo(o, h, c, u, l, d, x.x, x.y) && Wt(x.prev, x, x.next) >= 0 || (x = x.prevZ, E.x >= f && E.x <= m && E.y >= p && E.y <= g && E !== s && E !== a && wo(o, h, c, u, l, d, E.x, E.y) && Wt(E.prev, E, E.next) >= 0)) return !1;
E = E.nextZ;
}
for (; x && x.z >= A; ) {
- if (x.x >= f && x.x <= m && x.y >= p && x.y <= g && x !== s && x !== a && _o(o, h, c, u, l, d, x.x, x.y) && Wt(x.prev, x, x.next) >= 0) return !1;
+ if (x.x >= f && x.x <= m && x.y >= p && x.y <= g && x !== s && x !== a && wo(o, h, c, u, l, d, x.x, x.y) && Wt(x.prev, x, x.next) >= 0) return !1;
x = x.prevZ;
}
for (; E && E.z <= _; ) {
- if (E.x >= f && E.x <= m && E.y >= p && E.y <= g && E !== s && E !== a && _o(o, h, c, u, l, d, E.x, E.y) && Wt(E.prev, E, E.next) >= 0) return !1;
+ if (E.x >= f && E.x <= m && E.y >= p && E.y <= g && E !== s && E !== a && wo(o, h, c, u, l, d, E.x, E.y) && Wt(E.prev, E, E.next) >= 0) return !1;
E = E.nextZ;
}
return !0;
}
-function K_(i, e) {
+function j_(i, e) {
let t = i;
do {
const n = t.prev, s = t.next.next;
- !ka(n, s) && Q0(n, t, t.next, s) && Yo(n, s) && Yo(s, n) && (e.push(n.i, t.i, s.i), Jo(t), Jo(t.next), t = i = s), t = t.next;
+ !Ua(n, s) && G0(n, t, t.next, s) && Jo(n, s) && Jo(s, n) && (e.push(n.i, t.i, s.i), Zo(t), Zo(t.next), t = i = s), t = t.next;
} while (t !== i);
return Fr(t);
}
-function j_(i, e, t, n, s, r) {
+function X_(i, e, t, n, s, r) {
let a = i;
do {
let o = a.next.next;
for (; o !== a.prev; ) {
- if (a.i !== o.i && iw(a, o)) {
- let c = G0(a, o);
- a = Fr(a, a.next), c = Fr(c, c.next), Xo(a, e, t, n, s, r, 0), Xo(c, e, t, n, s, r, 0);
+ if (a.i !== o.i && sw(a, o)) {
+ let c = H0(a, o);
+ a = Fr(a, a.next), c = Fr(c, c.next), Yo(a, e, t, n, s, r, 0), Yo(c, e, t, n, s, r, 0);
return;
}
o = o.next;
@@ -10898,18 +10898,18 @@ function j_(i, e, t, n, s, r) {
a = a.next;
} while (a !== i);
}
-function X_(i, e, t, n) {
+function Y_(i, e, t, n) {
const s = [];
for (let r = 0, a = e.length; r < a; r++) {
- const o = e[r] * n, c = r < a - 1 ? e[r + 1] * n : i.length, l = U0(i, o, c, n, !1);
- l === l.next && (l.steiner = !0), s.push(nw(l));
+ const o = e[r] * n, c = r < a - 1 ? e[r + 1] * n : i.length, l = O0(i, o, c, n, !1);
+ l === l.next && (l.steiner = !0), s.push(iw(l));
}
- s.sort(Y_);
+ s.sort(J_);
for (let r = 0; r < s.length; r++)
- t = J_(s[r], t);
+ t = Z_(s[r], t);
return t;
}
-function Y_(i, e) {
+function J_(i, e) {
let t = i.x - e.x;
if (t === 0 && (t = i.y - e.y, t === 0)) {
const n = (i.next.y - i.y) / (i.next.x - i.x), s = (e.next.y - e.y) / (e.next.x - e.x);
@@ -10917,20 +10917,20 @@ function Y_(i, e) {
}
return t;
}
-function J_(i, e) {
- const t = Z_(i, e);
+function Z_(i, e) {
+ const t = $_(i, e);
if (!t)
return e;
- const n = G0(t, i);
+ const n = H0(t, i);
return Fr(n, n.next), Fr(t, t.next);
}
-function Z_(i, e) {
+function $_(i, e) {
let t = e;
const n = i.x, s = i.y;
let r = -1 / 0, a;
- if (ka(i, t)) return t;
+ if (Ua(i, t)) return t;
do {
- if (ka(i, t.next)) return t.next;
+ if (Ua(i, t.next)) return t.next;
if (s <= t.y && s >= t.next.y && t.next.y !== t.y) {
const u = t.x + (s - t.y) * (t.next.x - t.x) / (t.next.y - t.y);
if (u <= n && u > r && (r = u, a = t.x < t.next.x ? t : t.next, u === n))
@@ -10943,25 +10943,25 @@ function Z_(i, e) {
let h = 1 / 0;
t = a;
do {
- if (n >= t.x && t.x >= c && n !== t.x && O0(s < l ? n : r, s, c, l, s < l ? r : n, s, t.x, t.y)) {
+ if (n >= t.x && t.x >= c && n !== t.x && Q0(s < l ? n : r, s, c, l, s < l ? r : n, s, t.x, t.y)) {
const u = Math.abs(s - t.y) / (n - t.x);
- Yo(t, i) && (u < h || u === h && (t.x > a.x || t.x === a.x && $_(a, t))) && (a = t, h = u);
+ Jo(t, i) && (u < h || u === h && (t.x > a.x || t.x === a.x && ew(a, t))) && (a = t, h = u);
}
t = t.next;
} while (t !== o);
return a;
}
-function $_(i, e) {
+function ew(i, e) {
return Wt(i.prev, i, e.prev) < 0 && Wt(e.next, i, i.next) < 0;
}
-function ew(i, e, t, n) {
+function tw(i, e, t, n) {
let s = i;
do
- s.z === 0 && (s.z = zd(s.x, s.y, e, t, n)), s.prevZ = s.prev, s.nextZ = s.next, s = s.next;
+ s.z === 0 && (s.z = Wd(s.x, s.y, e, t, n)), s.prevZ = s.prev, s.nextZ = s.next, s = s.next;
while (s !== i);
- s.prevZ.nextZ = null, s.prevZ = null, tw(s);
+ s.prevZ.nextZ = null, s.prevZ = null, nw(s);
}
-function tw(i) {
+function nw(i) {
let e, t = 1;
do {
let n = i, s;
@@ -10981,56 +10981,56 @@ function tw(i) {
} while (e > 1);
return i;
}
-function zd(i, e, t, n, s) {
+function Wd(i, e, t, n, s) {
return i = (i - t) * s | 0, e = (e - n) * s | 0, i = (i | i << 8) & 16711935, i = (i | i << 4) & 252645135, i = (i | i << 2) & 858993459, i = (i | i << 1) & 1431655765, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, i | e << 1;
}
-function nw(i) {
+function iw(i) {
let e = i, t = i;
do
(e.x < t.x || e.x === t.x && e.y < t.y) && (t = e), e = e.next;
while (e !== i);
return t;
}
-function O0(i, e, t, n, s, r, a, o) {
+function Q0(i, e, t, n, s, r, a, o) {
return (s - a) * (e - o) >= (i - a) * (r - o) && (i - a) * (n - o) >= (t - a) * (e - o) && (t - a) * (r - o) >= (s - a) * (n - o);
}
-function _o(i, e, t, n, s, r, a, o) {
- return !(i === a && e === o) && O0(i, e, t, n, s, r, a, o);
+function wo(i, e, t, n, s, r, a, o) {
+ return !(i === a && e === o) && Q0(i, e, t, n, s, r, a, o);
}
-function iw(i, e) {
- return i.next.i !== e.i && i.prev.i !== e.i && !sw(i, e) && // dones't intersect other edges
- (Yo(i, e) && Yo(e, i) && rw(i, e) && // locally visible
+function sw(i, e) {
+ return i.next.i !== e.i && i.prev.i !== e.i && !rw(i, e) && // dones't intersect other edges
+ (Jo(i, e) && Jo(e, i) && aw(i, e) && // locally visible
(Wt(i.prev, i, e.prev) || Wt(i, e.prev, e)) || // does not create opposite-facing sectors
- ka(i, e) && Wt(i.prev, i, i.next) > 0 && Wt(e.prev, e, e.next) > 0);
+ Ua(i, e) && Wt(i.prev, i, i.next) > 0 && Wt(e.prev, e, e.next) > 0);
}
function Wt(i, e, t) {
return (e.y - i.y) * (t.x - e.x) - (e.x - i.x) * (t.y - e.y);
}
-function ka(i, e) {
+function Ua(i, e) {
return i.x === e.x && i.y === e.y;
}
-function Q0(i, e, t, n) {
- const s = Yc(Wt(i, e, t)), r = Yc(Wt(i, e, n)), a = Yc(Wt(t, n, i)), o = Yc(Wt(t, n, e));
- return !!(s !== r && a !== o || s === 0 && Xc(i, t, e) || r === 0 && Xc(i, n, e) || a === 0 && Xc(t, i, n) || o === 0 && Xc(t, e, n));
+function G0(i, e, t, n) {
+ const s = Jc(Wt(i, e, t)), r = Jc(Wt(i, e, n)), a = Jc(Wt(t, n, i)), o = Jc(Wt(t, n, e));
+ return !!(s !== r && a !== o || s === 0 && Yc(i, t, e) || r === 0 && Yc(i, n, e) || a === 0 && Yc(t, i, n) || o === 0 && Yc(t, e, n));
}
-function Xc(i, e, t) {
+function Yc(i, e, t) {
return e.x <= Math.max(i.x, t.x) && e.x >= Math.min(i.x, t.x) && e.y <= Math.max(i.y, t.y) && e.y >= Math.min(i.y, t.y);
}
-function Yc(i) {
+function Jc(i) {
return i > 0 ? 1 : i < 0 ? -1 : 0;
}
-function sw(i, e) {
+function rw(i, e) {
let t = i;
do {
- if (t.i !== i.i && t.next.i !== i.i && t.i !== e.i && t.next.i !== e.i && Q0(t, t.next, i, e)) return !0;
+ if (t.i !== i.i && t.next.i !== i.i && t.i !== e.i && t.next.i !== e.i && G0(t, t.next, i, e)) return !0;
t = t.next;
} while (t !== i);
return !1;
}
-function Yo(i, e) {
+function Jo(i, e) {
return Wt(i.prev, i, i.next) < 0 ? Wt(i, e, i.next) >= 0 && Wt(i, i.prev, e) >= 0 : Wt(i, e, i.prev) < 0 || Wt(i, i.next, e) < 0;
}
-function rw(i, e) {
+function aw(i, e) {
let t = i, n = !1;
const s = (i.x + e.x) / 2, r = (i.y + e.y) / 2;
do
@@ -11038,18 +11038,18 @@ function rw(i, e) {
while (t !== i);
return n;
}
-function G0(i, e) {
- const t = Vd(i.i, i.x, i.y), n = Vd(e.i, e.x, e.y), s = i.next, r = e.prev;
+function H0(i, e) {
+ const t = qd(i.i, i.x, i.y), n = qd(e.i, e.x, e.y), s = i.next, r = e.prev;
return i.next = e, e.prev = i, t.next = s, s.prev = t, n.next = t, t.prev = n, r.next = n, n.prev = r, n;
}
-function yA(i, e, t, n) {
- const s = Vd(i, e, t);
+function wA(i, e, t, n) {
+ const s = qd(i, e, t);
return n ? (s.next = n.next, s.prev = n, n.next.prev = s, n.next = s) : (s.prev = s, s.next = s), s;
}
-function Jo(i) {
+function Zo(i) {
i.next.prev = i.prev, i.prev.next = i.next, i.prevZ && (i.prevZ.nextZ = i.nextZ), i.nextZ && (i.nextZ.prevZ = i.prevZ);
}
-function Vd(i, e, t) {
+function qd(i, e, t) {
return {
i,
// vertex index in coordinates array
@@ -11068,13 +11068,13 @@ function Vd(i, e, t) {
// indicates whether this is a steiner point
};
}
-function aw(i, e, t, n) {
+function ow(i, e, t, n) {
let s = 0;
for (let r = e, a = t - n; r < t; r += n)
s += (i[a] - i[r]) * (i[r + 1] + i[a + 1]), a = r;
return s;
}
-class ow {
+class cw {
/**
* Triangulates the given shape definition by returning an array of triangles.
*
@@ -11085,10 +11085,10 @@ class ow {
* representing vertex indices.
*/
static triangulate(e, t, n = 2) {
- return V_(e, t, n);
+ return W_(e, t, n);
}
}
-class jf {
+class Yf {
/**
* Calculate area of a ( 2D ) contour polygon.
*
@@ -11109,7 +11109,7 @@ class jf {
* @return {boolean} Whether the given contour uses a clockwise winding order or not.
*/
static isClockWise(e) {
- return jf.area(e) < 0;
+ return Yf.area(e) < 0;
}
/**
* Triangulates the given shape definition.
@@ -11120,26 +11120,26 @@ class jf {
*/
static triangulateShape(e, t) {
const n = [], s = [], r = [];
- _A(e), wA(n, e);
+ vA(e), CA(n, e);
let a = e.length;
- t.forEach(_A);
+ t.forEach(vA);
for (let c = 0; c < t.length; c++)
- s.push(a), a += t[c].length, wA(n, t[c]);
- const o = ow.triangulate(n, s);
+ s.push(a), a += t[c].length, CA(n, t[c]);
+ const o = cw.triangulate(n, s);
for (let c = 0; c < o.length; c += 3)
r.push(o.slice(c, c + 3));
return r;
}
}
-function _A(i) {
+function vA(i) {
const e = i.length;
e > 2 && i[e - 1].equals(i[0]) && i.pop();
}
-function wA(i, e) {
+function CA(i, e) {
for (let t = 0; t < e.length; t++)
i.push(e[t].x), i.push(e[t].y);
}
-class xh extends Tn {
+class Eh extends Tn {
/**
* Constructs a new plane geometry.
*
@@ -11181,10 +11181,10 @@ class xh extends Tn {
* @return {PlaneGeometry} A new instance.
*/
static fromJSON(e) {
- return new xh(e.width, e.height, e.widthSegments, e.heightSegments);
+ return new Eh(e.width, e.height, e.widthSegments, e.heightSegments);
}
}
-class Zo extends ui {
+class $o extends di {
/**
* Constructs a new mesh standard material.
*
@@ -11195,13 +11195,13 @@ class Zo extends ui {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshStandardMaterial = !0, this.type = "MeshStandardMaterial", this.defines = { STANDARD: "" }, this.color = new Le(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Le(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = dh, this.normalScale = new Ze(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 dn(), this.envMapIntensity = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e);
+ super(), this.isMeshStandardMaterial = !0, this.type = "MeshStandardMaterial", this.defines = { STANDARD: "" }, this.color = new Le(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Le(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ph, this.normalScale = new Ze(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 dn(), this.envMapIntensity = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e);
}
copy(e) {
return super.copy(e), this.defines = { STANDARD: "" }, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.envMapIntensity = e.envMapIntensity, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this;
}
}
-class Vi extends Zo {
+class Wi extends $o {
/**
* Constructs a new mesh physical material.
*
@@ -11314,7 +11314,7 @@ class Vi extends Zo {
}, this.anisotropy = e.anisotropy, this.anisotropyRotation = e.anisotropyRotation, this.anisotropyMap = e.anisotropyMap, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.dispersion = e.dispersion, this.ior = e.ior, this.iridescence = e.iridescence, this.iridescenceMap = e.iridescenceMap, this.iridescenceIOR = e.iridescenceIOR, this.iridescenceThicknessRange = [...e.iridescenceThicknessRange], this.iridescenceThicknessMap = e.iridescenceThicknessMap, this.sheen = e.sheen, this.sheenColor.copy(e.sheenColor), this.sheenColorMap = e.sheenColorMap, this.sheenRoughness = e.sheenRoughness, this.sheenRoughnessMap = e.sheenRoughnessMap, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this.thickness = e.thickness, this.thicknessMap = e.thicknessMap, this.attenuationDistance = e.attenuationDistance, this.attenuationColor.copy(e.attenuationColor), this.specularIntensity = e.specularIntensity, this.specularIntensityMap = e.specularIntensityMap, this.specularColor.copy(e.specularColor), this.specularColorMap = e.specularColorMap, this;
}
}
-class Jc extends ui {
+class Zc extends di {
/**
* Constructs a new mesh phong material.
*
@@ -11325,13 +11325,13 @@ class Jc extends ui {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshPhongMaterial = !0, this.type = "MeshPhongMaterial", this.color = new Le(16777215), this.specular = new Le(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Le(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = dh, this.normalScale = new Ze(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new dn(), this.combine = hh, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e);
+ super(), this.isMeshPhongMaterial = !0, this.type = "MeshPhongMaterial", this.color = new Le(16777215), this.specular = new Le(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Le(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ph, this.normalScale = new Ze(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new dn(), this.combine = dh, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e);
}
copy(e) {
return super.copy(e), this.color.copy(e.color), this.specular.copy(e.specular), this.shininess = e.shininess, 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.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this;
}
}
-class cw extends ui {
+class lw extends di {
/**
* Constructs a new mesh lambert material.
*
@@ -11342,13 +11342,13 @@ class cw extends ui {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshLambertMaterial = !0, this.type = "MeshLambertMaterial", this.color = new Le(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Le(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = dh, this.normalScale = new Ze(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new dn(), this.combine = hh, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e);
+ super(), this.isMeshLambertMaterial = !0, this.type = "MeshLambertMaterial", this.color = new Le(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Le(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ph, this.normalScale = new Ze(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new dn(), this.combine = dh, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e);
}
copy(e) {
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this;
}
}
-class lw extends ui {
+class hw extends di {
/**
* Constructs a new mesh depth material.
*
@@ -11359,13 +11359,13 @@ class lw extends ui {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = Ry, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e);
+ super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = Fy, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e);
}
copy(e) {
return super.copy(e), this.depthPacking = e.depthPacking, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this;
}
}
-class hw extends ui {
+class uw extends di {
/**
* Constructs a new mesh distance material.
*
@@ -11382,13 +11382,13 @@ class hw extends ui {
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 Zc(i, e) {
+function $c(i, e) {
return !i || i.constructor === e ? i : typeof e.BYTES_PER_ELEMENT == "number" ? new e(i) : Array.prototype.slice.call(i);
}
-function uw(i) {
+function dw(i) {
return ArrayBuffer.isView(i) && !(i instanceof DataView);
}
-function dw(i) {
+function fw(i) {
function e(s, r) {
return i[s] - i[r];
}
@@ -11396,7 +11396,7 @@ function dw(i) {
for (let s = 0; s !== t; ++s) n[s] = s;
return n.sort(e), n;
}
-function vA(i, e, t) {
+function IA(i, e, t) {
const n = i.length, s = new i.constructor(n);
for (let r = 0, a = 0; a !== n; ++r) {
const o = t[r] * e;
@@ -11405,7 +11405,7 @@ function vA(i, e, t) {
}
return s;
}
-function H0(i, e, t, n) {
+function z0(i, e, t, n) {
let s = 1, r = i[0];
for (; r !== void 0 && r[n] === void 0; )
r = i[s++];
@@ -11425,7 +11425,7 @@ function H0(i, e, t, n) {
a = r[n], a !== void 0 && (e.push(r.time), t.push(a)), r = i[s++];
while (r !== void 0);
}
-class dc {
+class fc {
/**
* Constructs a new interpolant.
*
@@ -11534,7 +11534,7 @@ class dc {
intervalChanged_() {
}
}
-class fw extends dc {
+class pw extends fc {
/**
* Constructs a new cubic interpolant.
*
@@ -11545,8 +11545,8 @@ class fw extends dc {
*/
constructor(e, t, n, s) {
super(e, t, n, s), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = {
- endingStart: ga,
- endingEnd: ga
+ endingStart: ma,
+ endingEnd: ma
};
}
intervalChanged_(e, t, n) {
@@ -11554,10 +11554,10 @@ class fw extends dc {
let r = e - 2, a = e + 1, o = s[r], c = s[a];
if (o === void 0)
switch (this.getSettings_().endingStart) {
- case ma:
+ case xa:
r = e, o = 2 * t - n;
break;
- case Hl:
+ case Vl:
r = s.length - 2, o = t + s[r] - s[r + 1];
break;
default:
@@ -11565,10 +11565,10 @@ class fw extends dc {
}
if (c === void 0)
switch (this.getSettings_().endingEnd) {
- case ma:
+ case xa:
a = e, c = 2 * n - t;
break;
- case Hl:
+ case Vl:
a = 1, c = n + s[1] - s[0];
break;
default:
@@ -11584,7 +11584,7 @@ class fw extends dc {
return r;
}
}
-class z0 extends dc {
+class V0 extends fc {
/**
* Constructs a new linear interpolant.
*
@@ -11603,7 +11603,7 @@ class z0 extends dc {
return r;
}
}
-class pw extends dc {
+class Aw extends fc {
/**
* Constructs a new discrete interpolant.
*
@@ -11619,7 +11619,7 @@ class pw extends dc {
return this.copySampleValue_(e - 1);
}
}
-class Bi {
+class Ti {
/**
* Constructs a new keyframe track.
*
@@ -11631,7 +11631,7 @@ class Bi {
constructor(e, t, n, s) {
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 = Zc(t, this.TimeBufferType), this.values = Zc(n, this.ValueBufferType), this.setInterpolation(s || this.DefaultInterpolation);
+ this.name = e, this.times = $c(t, this.TimeBufferType), this.values = $c(n, this.ValueBufferType), this.setInterpolation(s || this.DefaultInterpolation);
}
/**
* Converts the keyframe track to JSON.
@@ -11648,8 +11648,8 @@ class Bi {
else {
n = {
name: e.name,
- times: Zc(e.times, Array),
- values: Zc(e.values, Array)
+ times: $c(e.times, Array),
+ values: $c(e.values, Array)
};
const s = e.getInterpolation();
s !== e.DefaultInterpolation && (n.interpolation = s);
@@ -11664,7 +11664,7 @@ class Bi {
* @return {DiscreteInterpolant} The new interpolant.
*/
InterpolantFactoryMethodDiscrete(e) {
- return new pw(this.times, this.values, this.getValueSize(), e);
+ return new Aw(this.times, this.values, this.getValueSize(), e);
}
/**
* Factory method for creating a new linear interpolant.
@@ -11674,7 +11674,7 @@ class Bi {
* @return {LinearInterpolant} The new interpolant.
*/
InterpolantFactoryMethodLinear(e) {
- return new z0(this.times, this.values, this.getValueSize(), e);
+ return new V0(this.times, this.values, this.getValueSize(), e);
}
/**
* Factory method for creating a new smooth interpolant.
@@ -11684,7 +11684,7 @@ class Bi {
* @return {CubicInterpolant} The new interpolant.
*/
InterpolantFactoryMethodSmooth(e) {
- return new fw(this.times, this.values, this.getValueSize(), e);
+ return new pw(this.times, this.values, this.getValueSize(), e);
}
/**
* Defines the interpolation factor method for this keyframe track.
@@ -11695,13 +11695,13 @@ class Bi {
setInterpolation(e) {
let t;
switch (e) {
- case qo:
+ case Ko:
t = this.InterpolantFactoryMethodDiscrete;
break;
- case Ko:
+ case jo:
t = this.InterpolantFactoryMethodLinear;
break;
- case Qh:
+ case Hh:
t = this.InterpolantFactoryMethodSmooth;
break;
}
@@ -11724,11 +11724,11 @@ class Bi {
getInterpolation() {
switch (this.createInterpolant) {
case this.InterpolantFactoryMethodDiscrete:
- return qo;
- case this.InterpolantFactoryMethodLinear:
return Ko;
+ case this.InterpolantFactoryMethodLinear:
+ return jo;
case this.InterpolantFactoryMethodSmooth:
- return Qh;
+ return Hh;
}
}
/**
@@ -11816,7 +11816,7 @@ class Bi {
}
a = c;
}
- if (s !== void 0 && uw(s))
+ if (s !== void 0 && dw(s))
for (let o = 0, c = s.length; o !== c; ++o) {
const l = s[o];
if (isNaN(l)) {
@@ -11833,7 +11833,7 @@ class Bi {
* @return {AnimationClip} A reference to this animation clip.
*/
optimize() {
- const e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), s = this.getInterpolation() === Qh, r = e.length - 1;
+ const e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), s = this.getInterpolation() === Hh, r = e.length - 1;
let a = 1;
for (let o = 1; o < r; ++o) {
let c = !1;
@@ -11879,11 +11879,11 @@ class Bi {
return s.createInterpolant = this.createInterpolant, s;
}
}
-Bi.prototype.ValueTypeName = "";
-Bi.prototype.TimeBufferType = Float32Array;
-Bi.prototype.ValueBufferType = Float32Array;
-Bi.prototype.DefaultInterpolation = Ko;
-class Ka extends Bi {
+Ti.prototype.ValueTypeName = "";
+Ti.prototype.TimeBufferType = Float32Array;
+Ti.prototype.ValueBufferType = Float32Array;
+Ti.prototype.DefaultInterpolation = jo;
+class ja extends Ti {
/**
* Constructs a new boolean keyframe track.
*
@@ -11898,12 +11898,12 @@ class Ka extends Bi {
super(e, t, n);
}
}
-Ka.prototype.ValueTypeName = "bool";
-Ka.prototype.ValueBufferType = Array;
-Ka.prototype.DefaultInterpolation = qo;
-Ka.prototype.InterpolantFactoryMethodLinear = void 0;
-Ka.prototype.InterpolantFactoryMethodSmooth = void 0;
-class V0 extends Bi {
+ja.prototype.ValueTypeName = "bool";
+ja.prototype.ValueBufferType = Array;
+ja.prototype.DefaultInterpolation = Ko;
+ja.prototype.InterpolantFactoryMethodLinear = void 0;
+ja.prototype.InterpolantFactoryMethodSmooth = void 0;
+class W0 extends Ti {
/**
* Constructs a new color keyframe track.
*
@@ -11916,8 +11916,8 @@ class V0 extends Bi {
super(e, t, n, s);
}
}
-V0.prototype.ValueTypeName = "color";
-class Nr extends Bi {
+W0.prototype.ValueTypeName = "color";
+class Nr extends Ti {
/**
* Constructs a new number keyframe track.
*
@@ -11931,7 +11931,7 @@ class Nr extends Bi {
}
}
Nr.prototype.ValueTypeName = "number";
-class Aw extends dc {
+class gw extends fc {
/**
* Constructs a new SLERP interpolant.
*
@@ -11951,7 +11951,7 @@ class Aw extends dc {
return r;
}
}
-class Ks extends Bi {
+class Ks extends Ti {
/**
* Constructs a new Quaternion keyframe track.
*
@@ -11971,12 +11971,12 @@ class Ks extends Bi {
* @return {QuaternionLinearInterpolant} The new interpolant.
*/
InterpolantFactoryMethodLinear(e) {
- return new Aw(this.times, this.values, this.getValueSize(), e);
+ return new gw(this.times, this.values, this.getValueSize(), e);
}
}
Ks.prototype.ValueTypeName = "quaternion";
Ks.prototype.InterpolantFactoryMethodSmooth = void 0;
-class ja extends Bi {
+class Xa extends Ti {
/**
* Constructs a new string keyframe track.
*
@@ -11991,12 +11991,12 @@ class ja extends Bi {
super(e, t, n);
}
}
-ja.prototype.ValueTypeName = "string";
-ja.prototype.ValueBufferType = Array;
-ja.prototype.DefaultInterpolation = qo;
-ja.prototype.InterpolantFactoryMethodLinear = void 0;
-ja.prototype.InterpolantFactoryMethodSmooth = void 0;
-class Dr extends Bi {
+Xa.prototype.ValueTypeName = "string";
+Xa.prototype.ValueBufferType = Array;
+Xa.prototype.DefaultInterpolation = Ko;
+Xa.prototype.InterpolantFactoryMethodLinear = void 0;
+Xa.prototype.InterpolantFactoryMethodSmooth = void 0;
+class Dr extends Ti {
/**
* Constructs a new vector keyframe track.
*
@@ -12010,7 +12010,7 @@ class Dr extends Bi {
}
}
Dr.prototype.ValueTypeName = "vector";
-class jl {
+class Yl {
/**
* Constructs a new animation clip.
*
@@ -12025,8 +12025,8 @@ class jl {
* @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode=NormalAnimationBlendMode] - Defines how the animation
* is blended/combined when two or more animations are simultaneously played.
*/
- constructor(e = "", t = -1, n = [], s = Gf) {
- this.name = e, this.tracks = n, this.duration = t, this.blendMode = s, this.uuid = Mi(), this.duration < 0 && this.resetDuration();
+ constructor(e = "", t = -1, n = [], s = zf) {
+ this.name = e, this.tracks = n, this.duration = t, this.blendMode = s, this.uuid = Bi(), this.duration < 0 && this.resetDuration();
}
/**
* Factory method for creating an animation clip from the given JSON.
@@ -12038,7 +12038,7 @@ class jl {
static parse(e) {
const t = [], n = e.tracks, s = 1 / (e.fps || 1);
for (let a = 0, o = n.length; a !== o; ++a)
- t.push(mw(n[a]).scale(s));
+ t.push(xw(n[a]).scale(s));
const r = new this(e.name, e.duration, t, e.blendMode);
return r.uuid = e.uuid, r;
}
@@ -12058,7 +12058,7 @@ class jl {
blendMode: e.blendMode
};
for (let r = 0, a = n.length; r !== a; ++r)
- t.push(Bi.toJSON(n[r]));
+ t.push(Ti.toJSON(n[r]));
return s;
}
/**
@@ -12084,8 +12084,8 @@ class jl {
o,
(o + 1) % r
), l.push(0, 1, 0);
- const h = dw(c);
- c = vA(c, 1, h), l = vA(l, 1, h), !s && c[0] === 0 && (c.push(r), l.push(l[0])), a.push(
+ const h = fw(c);
+ c = IA(c, 1, h), l = IA(l, 1, h), !s && c[0] === 0 && (c.push(r), l.push(l[0])), a.push(
new Nr(
".morphTargetInfluences[" + t[o].name + "]",
c,
@@ -12159,7 +12159,7 @@ class jl {
const n = function(u, d, f, p, m) {
if (f.length !== 0) {
const g = [], A = [];
- H0(f, g, A, p), g.length !== 0 && m.push(new u(d, g, A));
+ z0(f, g, A, p), g.length !== 0 && m.push(new u(d, g, A));
}
}, s = [], r = e.name || "default", a = e.fps || 30, o = e.blendMode;
let c = e.length || -1;
@@ -12275,7 +12275,7 @@ class jl {
return this.constructor.toJSON(this);
}
}
-function gw(i) {
+function mw(i) {
switch (i.toLowerCase()) {
case "scalar":
case "double":
@@ -12289,24 +12289,24 @@ function gw(i) {
case "vector4":
return Dr;
case "color":
- return V0;
+ return W0;
case "quaternion":
return Ks;
case "bool":
case "boolean":
- return Ka;
- case "string":
return ja;
+ case "string":
+ return Xa;
}
throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + i);
}
-function mw(i) {
+function xw(i) {
if (i.type === void 0)
throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");
- const e = gw(i.type);
+ const e = mw(i.type);
if (i.times === void 0) {
const t = [], n = [];
- H0(i.keys, t, n, "value"), i.times = t, i.values = n;
+ z0(i.keys, t, n, "value"), i.times = t, i.values = n;
}
return e.parse !== void 0 ? e.parse(i) : new e(i.name, i.times, i.values, i.interpolation);
}
@@ -12366,7 +12366,7 @@ const us = {
this.files = {};
}
};
-class W0 {
+class q0 {
/**
* Constructs a new loading manager.
*
@@ -12403,15 +12403,15 @@ class W0 {
};
}
}
-const xw = /* @__PURE__ */ new W0();
-class fi {
+const bw = /* @__PURE__ */ new q0();
+class pi {
/**
* Constructs a new loader.
*
* @param {LoadingManager} [manager] - The loading manager.
*/
constructor(e) {
- this.manager = e !== void 0 ? e : xw, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
+ this.manager = e !== void 0 ? e : bw, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
}
/**
* This method needs to be implemented by all concrete loaders. It holds the
@@ -12496,14 +12496,14 @@ class fi {
return this.requestHeader = e, this;
}
}
-fi.DEFAULT_MATERIAL_NAME = "__DEFAULT";
-const Zi = {};
-class bw extends Error {
+pi.DEFAULT_MATERIAL_NAME = "__DEFAULT";
+const $i = {};
+class Ew extends Error {
constructor(e, t) {
super(e), this.response = t;
}
}
-class As extends fi {
+class As extends pi {
/**
* Constructs a new file loader.
*
@@ -12528,15 +12528,15 @@ class As extends fi {
return this.manager.itemStart(e), setTimeout(() => {
t && t(r), this.manager.itemEnd(e);
}, 0), r;
- if (Zi[e] !== void 0) {
- Zi[e].push({
+ if ($i[e] !== void 0) {
+ $i[e].push({
onLoad: t,
onProgress: n,
onError: s
});
return;
}
- Zi[e] = [], Zi[e].push({
+ $i[e] = [], $i[e].push({
onLoad: t,
onProgress: n,
onError: s
@@ -12550,7 +12550,7 @@ class As extends fi {
if (l.status === 200 || l.status === 0) {
if (l.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), typeof ReadableStream > "u" || l.body === void 0 || l.body.getReader === void 0)
return l;
- const h = Zi[e], u = l.body.getReader(), d = l.headers.get("X-File-Size") || l.headers.get("Content-Length"), f = d ? parseInt(d) : 0, p = f !== 0;
+ const h = $i[e], u = l.body.getReader(), d = l.headers.get("X-File-Size") || l.headers.get("Content-Length"), f = d ? parseInt(d) : 0, p = f !== 0;
let m = 0;
const g = new ReadableStream({
start(A) {
@@ -12576,7 +12576,7 @@ class As extends fi {
});
return new Response(g);
} else
- throw new bw(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l);
+ throw new Ew(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l);
}).then((l) => {
switch (c) {
case "arraybuffer":
@@ -12597,17 +12597,17 @@ class As extends fi {
}
}).then((l) => {
us.add(e, l);
- const h = Zi[e];
- delete Zi[e];
+ const h = $i[e];
+ delete $i[e];
for (let u = 0, d = h.length; u < d; u++) {
const f = h[u];
f.onLoad && f.onLoad(l);
}
}).catch((l) => {
- const h = Zi[e];
+ const h = $i[e];
if (h === void 0)
throw this.manager.itemError(e), l;
- delete Zi[e];
+ delete $i[e];
for (let u = 0, d = h.length; u < d; u++) {
const f = h[u];
f.onError && f.onError(l);
@@ -12636,7 +12636,7 @@ class As extends fi {
return this.mimeType = e, this;
}
}
-class Ew extends fi {
+class yw extends pi {
/**
* Constructs a new image loader.
*
@@ -12664,7 +12664,7 @@ class Ew extends fi {
return r.manager.itemStart(e), setTimeout(function() {
t && t(a), r.manager.itemEnd(e);
}, 0), a;
- const o = jo("img");
+ const o = Xo("img");
function c() {
h(), us.add(e, this), t && t(this), r.manager.itemEnd(e);
}
@@ -12677,7 +12677,7 @@ class Ew extends fi {
return o.addEventListener("load", c, !1), o.addEventListener("error", l, !1), e.slice(0, 5) !== "data:" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), r.manager.itemStart(e), o.src = e, o;
}
}
-class yw extends fi {
+class _w extends pi {
/**
* Constructs a new data texture loader.
*
@@ -12699,7 +12699,7 @@ class yw extends fi {
* @return {DataTexture} The data texture.
*/
load(e, t, n, s) {
- const r = this, a = new fh(), o = new As(this.manager);
+ const r = this, a = new Ah(), o = new As(this.manager);
return o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(r.withCredentials), o.load(e, function(c) {
let l;
try {
@@ -12712,11 +12712,11 @@ class yw extends fi {
return;
}
}
- l.image !== void 0 ? a.image = l.image : l.data !== void 0 && (a.image.width = l.width, a.image.height = l.height, a.image.data = l.data), a.wrapS = l.wrapS !== void 0 ? l.wrapS : ti, a.wrapT = l.wrapT !== void 0 ? l.wrapT : ti, a.magFilter = l.magFilter !== void 0 ? l.magFilter : Xt, a.minFilter = l.minFilter !== void 0 ? l.minFilter : Xt, a.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.colorSpace !== void 0 && (a.colorSpace = l.colorSpace), l.flipY !== void 0 && (a.flipY = l.flipY), l.format !== void 0 && (a.format = l.format), l.type !== void 0 && (a.type = l.type), l.mipmaps !== void 0 && (a.mipmaps = l.mipmaps, a.minFilter = hi), l.mipmapCount === 1 && (a.minFilter = Xt), l.generateMipmaps !== void 0 && (a.generateMipmaps = l.generateMipmaps), a.needsUpdate = !0, t && t(a, l);
+ l.image !== void 0 ? a.image = l.image : l.data !== void 0 && (a.image.width = l.width, a.image.height = l.height, a.image.data = l.data), a.wrapS = l.wrapS !== void 0 ? l.wrapS : ni, a.wrapT = l.wrapT !== void 0 ? l.wrapT : ni, a.magFilter = l.magFilter !== void 0 ? l.magFilter : Xt, a.minFilter = l.minFilter !== void 0 ? l.minFilter : Xt, a.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.colorSpace !== void 0 && (a.colorSpace = l.colorSpace), l.flipY !== void 0 && (a.flipY = l.flipY), l.format !== void 0 && (a.format = l.format), l.type !== void 0 && (a.type = l.type), l.mipmaps !== void 0 && (a.mipmaps = l.mipmaps, a.minFilter = ui), l.mipmapCount === 1 && (a.minFilter = Xt), l.generateMipmaps !== void 0 && (a.generateMipmaps = l.generateMipmaps), a.needsUpdate = !0, t && t(a, l);
}, n, s), a;
}
}
-class q0 extends fi {
+class K0 extends pi {
/**
* Constructs a new texture loader.
*
@@ -12738,13 +12738,13 @@ class q0 extends fi {
* @return {Texture} The texture.
*/
load(e, t, n, s) {
- const r = new an(), a = new Ew(this.manager);
+ const r = new an(), a = new yw(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, s), r;
}
}
-class fc extends Tt {
+class pc extends Tt {
/**
* Constructs a new light.
*
@@ -12768,7 +12768,7 @@ class fc extends Tt {
return t.object.color = this.color.getHex(), t.object.intensity = this.intensity, this.groundColor !== void 0 && (t.object.groundColor = this.groundColor.getHex()), this.distance !== void 0 && (t.object.distance = this.distance), this.angle !== void 0 && (t.object.angle = this.angle), this.decay !== void 0 && (t.object.decay = this.decay), this.penumbra !== void 0 && (t.object.penumbra = this.penumbra), this.shadow !== void 0 && (t.object.shadow = this.shadow.toJSON()), this.target !== void 0 && (t.object.target = this.target.uuid), t;
}
}
-class _w extends fc {
+class ww extends pc {
/**
* Constructs a new hemisphere light.
*
@@ -12783,15 +12783,15 @@ class _w extends fc {
return super.copy(e, t), this.groundColor.copy(e.groundColor), this;
}
}
-const uu = /* @__PURE__ */ new Ne(), CA = /* @__PURE__ */ new G(), IA = /* @__PURE__ */ new G();
-class Xf {
+const fu = /* @__PURE__ */ new Ne(), SA = /* @__PURE__ */ new G(), MA = /* @__PURE__ */ new G();
+class Jf {
/**
* Constructs a new light shadow.
*
* @param {Camera} camera - The light's view of the world.
*/
constructor(e) {
- this.camera = e, this.intensity = 1, this.bias = 0, this.normalBias = 0, this.radius = 1, this.blurSamples = 8, this.mapSize = new Ze(512, 512), this.mapType = un, this.map = null, this.mapPass = null, this.matrix = new Ne(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new qf(), this._frameExtents = new Ze(1, 1), this._viewportCount = 1, this._viewports = [
+ this.camera = e, this.intensity = 1, this.bias = 0, this.normalBias = 0, this.radius = 1, this.blurSamples = 8, this.mapSize = new Ze(512, 512), this.mapType = un, this.map = null, this.mapPass = null, this.matrix = new Ne(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new jf(), this._frameExtents = new Ze(1, 1), this._viewportCount = 1, this._viewports = [
new mt(0, 0, 1, 1)
];
}
@@ -12819,7 +12819,7 @@ class Xf {
*/
updateMatrices(e) {
const t = this.camera, n = this.matrix;
- CA.setFromMatrixPosition(e.matrixWorld), t.position.copy(CA), IA.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(IA), t.updateMatrixWorld(), uu.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(uu), n.set(
+ SA.setFromMatrixPosition(e.matrixWorld), t.position.copy(SA), MA.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(MA), t.updateMatrixWorld(), fu.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(fu), n.set(
0.5,
0,
0,
@@ -12836,7 +12836,7 @@ class Xf {
0,
0,
1
- ), n.multiply(uu);
+ ), n.multiply(fu);
}
/**
* Returns a viewport definition for the given viewport index.
@@ -12890,7 +12890,7 @@ class Xf {
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;
}
}
-class ww extends Xf {
+class vw extends Jf {
/**
* Constructs a new spot light shadow.
*/
@@ -12898,14 +12898,14 @@ class ww extends Xf {
super(new In(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1;
}
updateMatrices(e) {
- const t = this.camera, n = La * 2 * e.angle * this.focus, s = this.mapSize.width / this.mapSize.height, r = e.distance || t.far;
+ const t = this.camera, n = Pa * 2 * e.angle * this.focus, s = this.mapSize.width / this.mapSize.height, r = e.distance || t.far;
(n !== t.fov || s !== t.aspect || r !== t.far) && (t.fov = n, t.aspect = s, t.far = r, t.updateProjectionMatrix()), super.updateMatrices(e);
}
copy(e) {
return super.copy(e), this.focus = e.focus, this;
}
}
-class K0 extends fc {
+class j0 extends pc {
/**
* Constructs a new spot light.
*
@@ -12917,7 +12917,7 @@ class K0 extends fc {
* @param {number} [decay=2] - The amount the light dims along the distance of the light.
*/
constructor(e, t, n = 0, s = Math.PI / 3, r = 0, a = 2) {
- super(e, t), this.isSpotLight = !0, this.type = "SpotLight", this.position.copy(Tt.DEFAULT_UP), this.updateMatrix(), this.target = new Tt(), this.distance = n, this.angle = s, this.penumbra = r, this.decay = a, this.map = null, this.shadow = new ww();
+ super(e, t), this.isSpotLight = !0, this.type = "SpotLight", this.position.copy(Tt.DEFAULT_UP), this.updateMatrix(), this.target = new Tt(), this.distance = n, this.angle = s, this.penumbra = r, this.decay = a, this.map = null, this.shadow = new vw();
}
/**
* The light's power. Power is the luminous power of the light measured in lumens (lm).
@@ -12938,8 +12938,8 @@ class K0 extends fc {
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.shadow = e.shadow.clone(), this;
}
}
-const SA = /* @__PURE__ */ new Ne(), ho = /* @__PURE__ */ new G(), du = /* @__PURE__ */ new G();
-class vw extends Xf {
+const BA = /* @__PURE__ */ new Ne(), uo = /* @__PURE__ */ new G(), pu = /* @__PURE__ */ new G();
+class Cw extends Jf {
/**
* Constructs a new point light shadow.
*/
@@ -12993,10 +12993,10 @@ class vw extends Xf {
*/
updateMatrices(e, t = 0) {
const n = this.camera, s = this.matrix, r = e.distance || n.far;
- r !== n.far && (n.far = r, n.updateProjectionMatrix()), ho.setFromMatrixPosition(e.matrixWorld), n.position.copy(ho), du.copy(n.position), du.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(du), n.updateMatrixWorld(), s.makeTranslation(-ho.x, -ho.y, -ho.z), SA.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(SA);
+ r !== n.far && (n.far = r, n.updateProjectionMatrix()), uo.setFromMatrixPosition(e.matrixWorld), n.position.copy(uo), pu.copy(n.position), pu.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(pu), n.updateMatrixWorld(), s.makeTranslation(-uo.x, -uo.y, -uo.z), BA.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(BA);
}
}
-class Xl extends fc {
+class Jl extends pc {
/**
* Constructs a new point light.
*
@@ -13006,7 +13006,7 @@ class Xl extends fc {
* @param {number} [decay=2] - The amount the light dims along the distance of the light.
*/
constructor(e, t, n = 0, s = 2) {
- super(e, t), this.isPointLight = !0, this.type = "PointLight", this.distance = n, this.decay = s, this.shadow = new vw();
+ super(e, t), this.isPointLight = !0, this.type = "PointLight", this.distance = n, this.decay = s, this.shadow = new Cw();
}
/**
* The light's power. Power is the luminous power of the light measured in lumens (lm).
@@ -13027,7 +13027,7 @@ class Xl extends fc {
return super.copy(e, t), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this;
}
}
-class Yf extends N0 {
+class Zf extends D0 {
/**
* Constructs a new orthographic camera.
*
@@ -13091,15 +13091,15 @@ class Yf extends N0 {
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;
}
}
-class Cw extends Xf {
+class Iw extends Jf {
/**
* Constructs a new directional light shadow.
*/
constructor() {
- super(new Yf(-5, 5, 5, -5, 0.5, 500)), this.isDirectionalLightShadow = !0;
+ super(new Zf(-5, 5, 5, -5, 0.5, 500)), this.isDirectionalLightShadow = !0;
}
}
-class Jf extends fc {
+class $f extends pc {
/**
* Constructs a new directional light.
*
@@ -13107,7 +13107,7 @@ class Jf extends fc {
* @param {number} [intensity=1] - The light's strength/intensity.
*/
constructor(e, t) {
- super(e, t), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(Tt.DEFAULT_UP), this.updateMatrix(), this.target = new Tt(), this.shadow = new Cw();
+ super(e, t), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(Tt.DEFAULT_UP), this.updateMatrix(), this.target = new Tt(), this.shadow = new Iw();
}
dispose() {
this.shadow.dispose();
@@ -13116,7 +13116,7 @@ class Jf extends fc {
return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;
}
}
-class j0 extends fc {
+class X0 extends pc {
/**
* Constructs a new ambient light.
*
@@ -13151,7 +13151,7 @@ class Cr {
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);
}
}
-class Iw extends fi {
+class Sw extends pi {
/**
* Constructs a new image bitmap loader.
*
@@ -13209,7 +13209,7 @@ class Iw extends fi {
us.add(e, c), r.manager.itemStart(e);
}
}
-class Sw extends In {
+class Mw extends In {
/**
* Constructs a new array camera.
*
@@ -13219,7 +13219,7 @@ class Sw extends In {
super(), this.isArrayCamera = !0, this.isMultiViewCamera = !1, this.cameras = e;
}
}
-class Mw {
+class Bw {
/**
* Constructs a new property mixer.
*
@@ -13354,10 +13354,10 @@ class Mw {
}
}
}
-const Zf = "\\[\\]\\.:\\/", Bw = new RegExp("[" + Zf + "]", "g"), $f = "[^" + Zf + "]", Tw = "[^" + Zf.replace("\\.", "") + "]", Rw = /* @__PURE__ */ /((?:WC+[\/:])*)/.source.replace("WC", $f), Fw = /* @__PURE__ */ /(WCOD+)?/.source.replace("WCOD", Tw), Nw = /* @__PURE__ */ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", $f), Dw = /* @__PURE__ */ /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", $f), Lw = new RegExp(
- "^" + Rw + Fw + Nw + Dw + "$"
-), Pw = ["material", "materials", "bones", "map"];
-class kw {
+const ep = "\\[\\]\\.:\\/", Tw = new RegExp("[" + ep + "]", "g"), tp = "[^" + ep + "]", Rw = "[^" + ep.replace("\\.", "") + "]", Fw = /* @__PURE__ */ /((?:WC+[\/:])*)/.source.replace("WC", tp), Nw = /* @__PURE__ */ /(WCOD+)?/.source.replace("WCOD", Rw), Dw = /* @__PURE__ */ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", tp), Lw = /* @__PURE__ */ /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", tp), Pw = new RegExp(
+ "^" + Fw + Nw + Dw + Lw + "$"
+), kw = ["material", "materials", "bones", "map"];
+class Uw {
constructor(e, t, n) {
const s = n || yt.parseTrackName(t);
this._targetGroup = e, this._bindings = e.subscribe_(t, s);
@@ -13414,7 +13414,7 @@ class yt {
* @return {string} The sanitized node name.
*/
static sanitizeNodeName(e) {
- return e.replace(/\s/g, "_").replace(Bw, "");
+ return e.replace(/\s/g, "_").replace(Tw, "");
}
/**
* Parses the given track name (an object path to an animated property) and
@@ -13435,7 +13435,7 @@ class yt {
* @return {Object} The parsed track name as an object.
*/
static parseTrackName(e) {
- const t = Lw.exec(e);
+ const t = Pw.exec(e);
if (t === null)
throw new Error("PropertyBinding: Cannot parse trackName: " + e);
const n = {
@@ -13449,7 +13449,7 @@ class yt {
}, s = n.nodeName && n.nodeName.lastIndexOf(".");
if (s !== void 0 && s !== -1) {
const r = n.nodeName.substring(s + 1);
- Pw.indexOf(r) !== -1 && (n.nodeName = n.nodeName.substring(0, s), n.objectName = r);
+ kw.indexOf(r) !== -1 && (n.nodeName = n.nodeName.substring(0, s), n.objectName = r);
}
if (n.propertyName === null || n.propertyName.length === 0)
throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e);
@@ -13661,7 +13661,7 @@ class yt {
this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
}
}
-yt.Composite = kw;
+yt.Composite = Uw;
yt.prototype.BindingType = {
Direct: 0,
EntireArray: 1,
@@ -13705,7 +13705,7 @@ yt.prototype.SetterByBindingTypeAndVersioning = [
yt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate
]
];
-class Uw {
+class Ow {
/**
* Constructs a new animation action.
*
@@ -13717,14 +13717,14 @@ class Uw {
constructor(e, t, n = null, s = t.blendMode) {
this._mixer = e, this._clip = t, this._localRoot = n, this.blendMode = s;
const r = t.tracks, a = r.length, o = new Array(a), c = {
- endingStart: ga,
- endingEnd: ga
+ endingStart: ma,
+ endingEnd: ma
};
for (let l = 0; l !== a; ++l) {
const h = r[l].createInterpolant(null);
o[l] = h, 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 = w0, 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;
+ 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 = v0, 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;
}
/**
* Starts the playback of the animation.
@@ -13975,11 +13975,11 @@ class Uw {
if (o > 0) {
const c = this._interpolants, l = this._propertyBindings;
switch (this.blendMode) {
- case By:
+ case Ty:
for (let h = 0, u = c.length; h !== u; ++h)
c[h].evaluate(a), l[h].accumulateAdditive(o);
break;
- case Gf:
+ case zf:
default:
for (let h = 0, u = c.length; h !== u; ++h)
c[h].evaluate(a), l[h].accumulate(s, o);
@@ -14013,10 +14013,10 @@ class Uw {
_updateTime(e) {
const t = this._clip.duration, n = this.loop;
let s = this.time + e, r = this._loopCount;
- const a = n === My;
+ const a = n === By;
if (e === 0)
return r === -1 ? s : a && (r & 1) === 1 ? t - s : s;
- if (n === _0) {
+ if (n === w0) {
r === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1));
e: {
if (s >= t)
@@ -14065,7 +14065,7 @@ class Uw {
}
_setEndings(e, t, n) {
const s = this._interpolantSettings;
- n ? (s.endingStart = ma, s.endingEnd = ma) : (e ? s.endingStart = this.zeroSlopeAtStart ? ma : ga : s.endingStart = Hl, t ? s.endingEnd = this.zeroSlopeAtEnd ? ma : ga : s.endingEnd = Hl);
+ n ? (s.endingStart = xa, s.endingEnd = xa) : (e ? s.endingStart = this.zeroSlopeAtStart ? xa : ma : s.endingStart = Vl, t ? s.endingEnd = this.zeroSlopeAtEnd ? xa : ma : s.endingEnd = Vl);
}
_scheduleFading(e, t, n) {
const s = this._mixer, r = s.time;
@@ -14075,8 +14075,8 @@ class Uw {
return o[0] = r, c[0] = t, o[1] = r + e, c[1] = n, this;
}
}
-const Ow = new Float32Array(1);
-class X0 extends Js {
+const Qw = new Float32Array(1);
+class Y0 extends Js {
/**
* Constructs a new animation mixer.
*
@@ -14100,7 +14100,7 @@ class X0 extends Js {
continue;
}
const m = t && t._propertyBindings[u].binding.parsedPath;
- p = new Mw(
+ p = new Bw(
yt.create(n, f, m),
d.ValueTypeName,
d.getValueSize()
@@ -14231,11 +14231,11 @@ class X0 extends Js {
_lendControlInterpolant() {
const e = this._controlInterpolants, t = this._nActiveControlInterpolants++;
let n = e[t];
- return n === void 0 && (n = new z0(
+ return n === void 0 && (n = new V0(
new Float32Array(2),
new Float32Array(2),
1,
- Ow
+ Qw
), n.__cacheIndex = t, e[t] = n), n;
}
_takeBackControlInterpolant(e) {
@@ -14256,17 +14256,17 @@ class X0 extends Js {
*/
clipAction(e, t, n) {
const s = t || this._root, r = s.uuid;
- let a = typeof e == "string" ? jl.findByName(s, e) : e;
+ let a = typeof e == "string" ? Yl.findByName(s, e) : e;
const o = a !== null ? a.uuid : e, c = this._actionsByClip[o];
let l = null;
- if (n === void 0 && (a !== null ? n = a.blendMode : n = Gf), c !== void 0) {
+ if (n === void 0 && (a !== null ? n = a.blendMode : n = zf), c !== void 0) {
const 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;
- const h = new Uw(this, a, t, n);
+ const h = new Ow(this, a, t, n);
return this._bindAction(h, l), this._addInactiveAction(h, o, r), h;
}
/**
@@ -14277,7 +14277,7 @@ class X0 extends Js {
* @return {?AnimationAction} The animation action. Returns `null` if no action was found.
*/
existingAction(e, t) {
- const n = t || this._root, s = n.uuid, r = typeof e == "string" ? jl.findByName(n, e) : e, a = r ? r.uuid : e, o = this._actionsByClip[a];
+ const n = t || this._root, s = n.uuid, r = typeof e == "string" ? Yl.findByName(n, e) : e, a = r ? r.uuid : e, o = this._actionsByClip[a];
return o !== void 0 && o.actionByRoot[s] || null;
}
/**
@@ -14386,7 +14386,7 @@ class X0 extends Js {
n !== null && (this._deactivateAction(n), this._removeInactiveAction(n));
}
}
-class MA {
+class TA {
/**
* Constructs a new spherical.
*
@@ -14456,8 +14456,8 @@ class MA {
return new this.constructor().copy(this);
}
}
-const Ts = /* @__PURE__ */ new G(), $c = /* @__PURE__ */ new Ne(), fu = /* @__PURE__ */ new Ne();
-class Qw extends gh {
+const Ts = /* @__PURE__ */ new G(), el = /* @__PURE__ */ new Ne(), Au = /* @__PURE__ */ new Ne();
+class Gw extends xh {
/**
* Constructs a new hemisphere light helper.
*
@@ -14465,21 +14465,21 @@ class Qw extends gh {
* can be used if it represents a hierarchy of bones (see {@link Bone}).
*/
constructor(e) {
- const t = Y0(e), n = new Tn(), s = [], r = [], a = new Le(0, 0, 1), o = new Le(0, 1, 0);
+ const t = J0(e), n = new Tn(), s = [], r = [], a = new Le(0, 0, 1), o = new Le(0, 1, 0);
for (let l = 0; l < t.length; l++) {
const h = t[l];
h.parent && h.parent.isBone && (s.push(0, 0, 0), s.push(0, 0, 0), r.push(a.r, a.g, a.b), r.push(o.r, o.g, o.b));
}
n.setAttribute("position", new en(s, 3)), n.setAttribute("color", new en(r, 3));
- const c = new qa({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 });
+ const c = new Ka({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 });
super(n, c), this.isSkeletonHelper = !0, this.type = "SkeletonHelper", this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1;
}
updateMatrixWorld(e) {
const t = this.bones, n = this.geometry, s = n.getAttribute("position");
- fu.copy(this.root.matrixWorld).invert();
+ Au.copy(this.root.matrixWorld).invert();
for (let r = 0, a = 0; r < t.length; r++) {
const o = t[r];
- o.parent && o.parent.isBone && ($c.multiplyMatrices(fu, o.matrixWorld), Ts.setFromMatrixPosition($c), s.setXYZ(a, Ts.x, Ts.y, Ts.z), $c.multiplyMatrices(fu, o.parent.matrixWorld), Ts.setFromMatrixPosition($c), s.setXYZ(a + 1, Ts.x, Ts.y, Ts.z), a += 2);
+ o.parent && o.parent.isBone && (el.multiplyMatrices(Au, o.matrixWorld), Ts.setFromMatrixPosition(el), s.setXYZ(a, Ts.x, Ts.y, Ts.z), el.multiplyMatrices(Au, o.parent.matrixWorld), Ts.setFromMatrixPosition(el), s.setXYZ(a + 1, Ts.x, Ts.y, Ts.z), a += 2);
}
n.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e);
}
@@ -14491,14 +14491,14 @@ class Qw extends gh {
this.geometry.dispose(), this.material.dispose();
}
}
-function Y0(i) {
+function J0(i) {
const e = [];
i.isBone === !0 && e.push(i);
for (let t = 0; t < i.children.length; t++)
- e.push(...Y0(i.children[t]));
+ e.push(...J0(i.children[t]));
return e;
}
-class Gw extends gh {
+class Hw extends xh {
/**
* Constructs a new grid helper.
*
@@ -14517,7 +14517,7 @@ class Gw extends gh {
}
const h = new Tn();
h.setAttribute("position", new en(c, 3)), h.setAttribute("color", new en(l, 3));
- const u = new qa({ vertexColors: !0, toneMapped: !1 });
+ const u = new Ka({ vertexColors: !0, toneMapped: !1 });
super(h, u), this.type = "GridHelper";
}
/**
@@ -14528,7 +14528,7 @@ class Gw extends gh {
this.geometry.dispose(), this.material.dispose();
}
}
-class BA extends gh {
+class RA extends xh {
/**
* Constructs a new axes helper.
*
@@ -14575,7 +14575,7 @@ class BA extends gh {
1
], s = new Tn();
s.setAttribute("position", new en(t, 3)), s.setAttribute("color", new en(n, 3));
- const r = new qa({ vertexColors: !0, toneMapped: !1 });
+ const r = new Ka({ vertexColors: !0, toneMapped: !1 });
super(s, r), this.type = "AxesHelper";
}
/**
@@ -14598,7 +14598,7 @@ class BA extends gh {
this.geometry.dispose(), this.material.dispose();
}
}
-class Hw extends Js {
+class zw extends Js {
/**
* Constructs a new controls instance.
*
@@ -14641,109 +14641,109 @@ class Hw extends Js {
update() {
}
}
-function TA(i, e, t, n) {
- const s = zw(n);
+function FA(i, e, t, n) {
+ const s = Vw(n);
switch (t) {
// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
- case b0:
+ case E0:
return i * e;
case cs:
return i * e / s.components * s.byteLength;
- case Uf:
+ case Qf:
return i * e / s.components * s.byteLength;
case Er:
return i * e * 2 / s.components * s.byteLength;
- case Of:
+ case Gf:
return i * e * 2 / s.components * s.byteLength;
- case E0:
+ case y0:
return i * e * 3 / s.components * s.byteLength;
case pn:
return i * e * 4 / s.components * s.byteLength;
- case Qf:
+ case Hf:
return i * e * 4 / s.components * s.byteLength;
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/
- case Cl:
- case Bo:
- return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;
- case Il:
+ case Sl:
case To:
+ return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;
+ case Ml:
+ case Ro:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/
- case Ed:
- case yd:
+ case _d:
+ case wd:
return Math.max(i, 16) * Math.max(e, 8) / 4;
- case Pl:
- case kl:
- return Math.max(i, 8) * Math.max(e, 8) / 2;
- // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
case Ul:
case Ol:
- return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;
+ return Math.max(i, 8) * Math.max(e, 8) / 2;
+ // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
case Ql:
+ case Gl:
+ return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;
+ case Hl:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
- case Vo:
+ case Wo:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;
- case _d:
+ case vd:
return Math.floor((i + 4) / 5) * Math.floor((e + 3) / 4) * 16;
- case wd:
+ case Cd:
return Math.floor((i + 4) / 5) * Math.floor((e + 4) / 5) * 16;
- case vd:
+ case Id:
return Math.floor((i + 5) / 6) * Math.floor((e + 4) / 5) * 16;
- case Wo:
+ case qo:
return Math.floor((i + 5) / 6) * Math.floor((e + 5) / 6) * 16;
- case Cd:
+ case Sd:
return Math.floor((i + 7) / 8) * Math.floor((e + 4) / 5) * 16;
- case Id:
+ case Md:
return Math.floor((i + 7) / 8) * Math.floor((e + 5) / 6) * 16;
- case Sd:
+ case Bd:
return Math.floor((i + 7) / 8) * Math.floor((e + 7) / 8) * 16;
- case Md:
+ case Td:
return Math.floor((i + 9) / 10) * Math.floor((e + 4) / 5) * 16;
- case Bd:
+ case Rd:
return Math.floor((i + 9) / 10) * Math.floor((e + 5) / 6) * 16;
- case Td:
+ case Fd:
return Math.floor((i + 9) / 10) * Math.floor((e + 7) / 8) * 16;
- case Rd:
+ case Nd:
return Math.floor((i + 9) / 10) * Math.floor((e + 9) / 10) * 16;
- case Fd:
+ case Dd:
return Math.floor((i + 11) / 12) * Math.floor((e + 9) / 10) * 16;
- case Nd:
+ case Ld:
return Math.floor((i + 11) / 12) * Math.floor((e + 11) / 12) * 16;
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/
- case Ro:
- case Dd:
- case Gl:
+ case Fo:
+ case Pd:
+ case zl:
return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/
- case y0:
- case Ld:
- return Math.ceil(i / 4) * Math.ceil(e / 4) * 8;
- case Pd:
+ case _0:
case kd:
+ return Math.ceil(i / 4) * Math.ceil(e / 4) * 8;
+ case Ud:
+ case Od:
return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;
}
throw new Error(
`Unable to determine texture byte length for ${t} format.`
);
}
-function zw(i) {
+function Vw(i) {
switch (i) {
case un:
- case g0:
- return { byteLength: 1, components: 1 };
- case Qo:
case m0:
- case Qn:
+ return { byteLength: 1, components: 1 };
+ case Go:
+ case x0:
+ case Gn:
return { byteLength: 2, components: 1 };
- case Pf:
- case kf:
+ case Uf:
+ case Of:
return { byteLength: 2, components: 4 };
case Tr:
- case Lf:
+ case kf:
case fn:
return { byteLength: 4, components: 1 };
- case x0:
+ case b0:
return { byteLength: 4, components: 3 };
}
throw new Error(`Unknown texture type ${i}.`);
@@ -14752,7 +14752,7 @@ typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEv
revision: "176"
} }));
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "176");
-function J0() {
+function Z0() {
let i = null, e = !1, t = null, n = null;
function s(r, a) {
t(r, a), n = i.requestAnimationFrame(s);
@@ -14772,7 +14772,7 @@ function J0() {
}
};
}
-function Vw(i) {
+function Ww(i) {
const e = /* @__PURE__ */ new WeakMap();
function t(o, c) {
const l = o.array, h = o.usage, u = l.byteLength, d = i.createBuffer();
@@ -14867,9 +14867,9 @@ function Vw(i) {
update: a
};
}
-var Ww = `#ifdef USE_ALPHAHASH
+var qw = `#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
-#endif`, qw = `#ifdef USE_ALPHAHASH
+#endif`, Kw = `#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 ) ) ) );
@@ -14904,20 +14904,20 @@ var Ww = `#ifdef USE_ALPHAHASH
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
-#endif`, Kw = `#ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`, jw = `#ifdef USE_ALPHAMAP
+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
+#endif`, Xw = `#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`, Xw = `#ifdef USE_ALPHATEST
+#endif`, Yw = `#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`, Yw = `#ifdef USE_ALPHATEST
+#endif`, Jw = `#ifdef USE_ALPHATEST
uniform float alphaTest;
-#endif`, Jw = `#ifdef USE_AOMAP
+#endif`, Zw = `#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
@@ -14930,10 +14930,10 @@ var Ww = `#ifdef USE_ALPHAHASH
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
-#endif`, Zw = `#ifdef USE_AOMAP
+#endif`, $w = `#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
-#endif`, $w = `#ifdef USE_BATCHING
+#endif`, ev = `#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
@@ -14967,15 +14967,15 @@ var Ww = `#ifdef USE_ALPHAHASH
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
-#endif`, ev = `#ifdef USE_BATCHING
+#endif`, tv = `#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
-#endif`, tv = `vec3 transformed = vec3( position );
+#endif`, nv = `vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
-#endif`, nv = `vec3 objectNormal = vec3( normal );
+#endif`, iv = `vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
-#endif`, iv = `float G_BlinnPhong_Implicit( ) {
+#endif`, sv = `float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -14989,7 +14989,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
-} // validated`, sv = `#ifdef USE_IRIDESCENCE
+} // validated`, rv = `#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
@@ -15052,7 +15052,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
}
return max( I, vec3( 0.0 ) );
}
-#endif`, rv = `#ifdef USE_BUMPMAP
+#endif`, av = `#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
@@ -15073,7 +15073,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
-#endif`, av = `#if NUM_CLIPPING_PLANES > 0
+#endif`, ov = `#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
@@ -15119,26 +15119,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
if ( clipped ) discard;
#endif
#endif
-#endif`, ov = `#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`, cv = `#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`, lv = `#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+#endif`, hv = `#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
-#endif`, hv = `#if defined( USE_COLOR_ALPHA )
+#endif`, uv = `#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
-#endif`, uv = `#if defined( USE_COLOR_ALPHA )
+#endif`, dv = `#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
-#endif`, dv = `#if defined( USE_COLOR_ALPHA )
+#endif`, fv = `#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
-#endif`, fv = `#if defined( USE_COLOR_ALPHA )
+#endif`, pv = `#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec3( 1.0 );
@@ -15152,7 +15152,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
-#endif`, pv = `#define PI 3.141592653589793
+#endif`, Av = `#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
@@ -15226,7 +15226,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
-} // validated`, Av = `#ifdef ENVMAP_TYPE_CUBE_UV
+} // validated`, gv = `#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
@@ -15319,7 +15319,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
-#endif`, gv = `vec3 transformedNormal = objectNormal;
+#endif`, mv = `vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
@@ -15348,21 +15348,21 @@ transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
-#endif`, mv = `#ifdef USE_DISPLACEMENTMAP
+#endif`, xv = `#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
-#endif`, xv = `#ifdef USE_DISPLACEMENTMAP
+#endif`, bv = `#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
-#endif`, bv = `#ifdef USE_EMISSIVEMAP
+#endif`, Ev = `#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
-#endif`, Ev = `#ifdef USE_EMISSIVEMAP
+#endif`, yv = `#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
-#endif`, yv = "gl_FragColor = linearToOutputTexel( gl_FragColor );", _v = `vec4 LinearTransferOETF( in vec4 value ) {
+#endif`, _v = "gl_FragColor = linearToOutputTexel( gl_FragColor );", wv = `vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -15370,7 +15370,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
-}`, wv = `#ifdef USE_ENVMAP
+}`, vv = `#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
@@ -15399,7 +15399,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
-#endif`, vv = `#ifdef USE_ENVMAP
+#endif`, Cv = `#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
@@ -15409,7 +15409,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform sampler2D envMap;
#endif
-#endif`, Cv = `#ifdef USE_ENVMAP
+#endif`, Iv = `#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
@@ -15420,7 +15420,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
varying vec3 vReflect;
#endif
-#endif`, Iv = `#ifdef USE_ENVMAP
+#endif`, Sv = `#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
@@ -15431,7 +15431,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
varying vec3 vReflect;
uniform float refractionRatio;
#endif
-#endif`, Sv = `#ifdef USE_ENVMAP
+#endif`, Mv = `#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
@@ -15448,18 +15448,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
-#endif`, Mv = `#ifdef USE_FOG
- vFogDepth = - mvPosition.z;
#endif`, Bv = `#ifdef USE_FOG
- varying float vFogDepth;
+ vFogDepth = - mvPosition.z;
#endif`, Tv = `#ifdef USE_FOG
+ varying float vFogDepth;
+#endif`, Rv = `#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`, Rv = `#ifdef USE_FOG
+#endif`, Fv = `#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
@@ -15468,7 +15468,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform float fogNear;
uniform float fogFar;
#endif
-#endif`, Fv = `#ifdef USE_GRADIENTMAP
+#endif`, Nv = `#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -15480,12 +15480,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
-}`, Nv = `#ifdef USE_LIGHTMAP
+}`, Dv = `#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
-#endif`, Dv = `LambertMaterial material;
+#endif`, Lv = `LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
-material.specularStrength = specularStrength;`, Lv = `varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`, Pv = `varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
@@ -15499,7 +15499,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, Pv = `uniform bool receiveShadow;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, kv = `uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
@@ -15615,7 +15615,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
-#endif`, kv = `#ifdef USE_ENVMAP
+#endif`, Uv = `#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -15648,8 +15648,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
#endif
}
#endif
-#endif`, Uv = `ToonMaterial material;
-material.diffuseColor = diffuseColor.rgb;`, Ov = `varying vec3 vViewPosition;
+#endif`, Ov = `ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`, Qv = `varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
@@ -15661,11 +15661,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, Qv = `BlinnPhongMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, Gv = `BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
-material.specularStrength = specularStrength;`, Gv = `varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`, Hv = `varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
@@ -15682,7 +15682,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, Hv = `PhysicalMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, zv = `PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
@@ -15768,7 +15768,7 @@ material.roughness = min( material.roughness, 1.0 );
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
-#endif`, zv = `struct PhysicalMaterial {
+#endif`, Vv = `struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
@@ -16069,7 +16069,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
-}`, Vv = `
+}`, Wv = `
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -16184,7 +16184,7 @@ IncidentLight directLight;
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
-#endif`, Wv = `#if defined( RE_IndirectDiffuse )
+#endif`, qv = `#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -16203,32 +16203,32 @@ IncidentLight directLight;
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
-#endif`, qv = `#if defined( RE_IndirectDiffuse )
+#endif`, Kv = `#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
-#endif`, Kv = `#if defined( USE_LOGDEPTHBUF )
- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`, jv = `#if defined( USE_LOGDEPTHBUF )
+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
+#endif`, Xv = `#if defined( USE_LOGDEPTHBUF )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`, Xv = `#ifdef USE_LOGDEPTHBUF
+#endif`, Yv = `#ifdef USE_LOGDEPTHBUF
varying float vFragDepth;
varying float vIsPerspective;
-#endif`, Yv = `#ifdef USE_LOGDEPTHBUF
+#endif`, Jv = `#ifdef USE_LOGDEPTHBUF
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
-#endif`, Jv = `#ifdef USE_MAP
+#endif`, Zv = `#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
-#endif`, Zv = `#ifdef USE_MAP
+#endif`, $v = `#ifdef USE_MAP
uniform sampler2D map;
-#endif`, $v = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+#endif`, eC = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
@@ -16240,7 +16240,7 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
-#endif`, eC = `#if defined( USE_POINTS_UV )
+#endif`, tC = `#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -16252,19 +16252,19 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`, tC = `float metalnessFactor = metalness;
+#endif`, nC = `float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
-#endif`, nC = `#ifdef USE_METALNESSMAP
+#endif`, iC = `#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
-#endif`, iC = `#ifdef USE_INSTANCING_MORPH
+#endif`, sC = `#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`, sC = `#if defined( USE_MORPHCOLORS )
+#endif`, rC = `#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
@@ -16273,12 +16273,12 @@ IncidentLight directLight;
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
-#endif`, rC = `#ifdef USE_MORPHNORMALS
+#endif`, aC = `#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`, aC = `#ifdef USE_MORPHTARGETS
+#endif`, oC = `#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -16292,12 +16292,12 @@ IncidentLight directLight;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
-#endif`, oC = `#ifdef USE_MORPHTARGETS
+#endif`, cC = `#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`, cC = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#endif`, lC = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
@@ -16338,7 +16338,7 @@ IncidentLight directLight;
tbn2[1] *= faceDirection;
#endif
#endif
-vec3 nonPerturbedNormal = normal;`, lC = `#ifdef USE_NORMALMAP_OBJECTSPACE
+vec3 nonPerturbedNormal = normal;`, hC = `#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
@@ -16353,25 +16353,25 @@ vec3 nonPerturbedNormal = normal;`, lC = `#ifdef USE_NORMALMAP_OBJECTSPACE
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
-#endif`, hC = `#ifndef FLAT_SHADED
+#endif`, uC = `#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`, uC = `#ifndef FLAT_SHADED
+#endif`, dC = `#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`, dC = `#ifndef FLAT_SHADED
+#endif`, fC = `#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
-#endif`, fC = `#ifdef USE_NORMALMAP
+#endif`, pC = `#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
@@ -16393,13 +16393,13 @@ vec3 nonPerturbedNormal = normal;`, lC = `#ifdef USE_NORMALMAP_OBJECTSPACE
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
-#endif`, pC = `#ifdef USE_CLEARCOAT
+#endif`, AC = `#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
-#endif`, AC = `#ifdef USE_CLEARCOAT_NORMALMAP
+#endif`, gC = `#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
-#endif`, gC = `#ifdef USE_CLEARCOATMAP
+#endif`, mC = `#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
@@ -16408,18 +16408,18 @@ vec3 nonPerturbedNormal = normal;`, lC = `#ifdef USE_NORMALMAP_OBJECTSPACE
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
-#endif`, mC = `#ifdef USE_IRIDESCENCEMAP
+#endif`, xC = `#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
-#endif`, xC = `#ifdef OPAQUE
+#endif`, bC = `#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, bC = `vec3 packNormalToRGB( const in vec3 normal ) {
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, EC = `vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -16488,9 +16488,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
-}`, EC = `#ifdef PREMULTIPLIED_ALPHA
+}`, yC = `#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
-#endif`, yC = `vec4 mvPosition = vec4( transformed, 1.0 );
+#endif`, _C = `vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
@@ -16498,22 +16498,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
-gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
+gl_Position = projectionMatrix * mvPosition;`, wC = `#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
-#endif`, wC = `#ifdef DITHERING
+#endif`, vC = `#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`, vC = `float roughnessFactor = roughness;
+#endif`, CC = `float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
-#endif`, CC = `#ifdef USE_ROUGHNESSMAP
+#endif`, IC = `#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
-#endif`, IC = `#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`, SC = `#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
@@ -16699,7 +16699,7 @@ gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
}
return mix( 1.0, shadow, shadowIntensity );
}
-#endif`, SC = `#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`, MC = `#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
@@ -16740,7 +16740,7 @@ gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
-#endif`, MC = `#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+#endif`, BC = `#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
@@ -16772,7 +16772,7 @@ gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
-#endif`, BC = `float getShadowMask() {
+#endif`, TC = `float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
@@ -16804,12 +16804,12 @@ gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
#endif
#endif
return shadow;
-}`, TC = `#ifdef USE_SKINNING
+}`, RC = `#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
-#endif`, RC = `#ifdef USE_SKINNING
+#endif`, FC = `#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
@@ -16824,7 +16824,7 @@ gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
-#endif`, FC = `#ifdef USE_SKINNING
+#endif`, NC = `#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
@@ -16832,7 +16832,7 @@ gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
-#endif`, NC = `#ifdef USE_SKINNING
+#endif`, DC = `#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
@@ -16843,17 +16843,17 @@ gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERING
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
-#endif`, DC = `float specularStrength;
+#endif`, LC = `float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
-#endif`, LC = `#ifdef USE_SPECULARMAP
+#endif`, PC = `#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
-#endif`, PC = `#if defined( TONE_MAPPING )
+#endif`, kC = `#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
-#endif`, kC = `#ifndef saturate
+#endif`, UC = `#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
@@ -16950,7 +16950,7 @@ vec3 NeutralToneMapping( vec3 color ) {
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
-vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSMISSION
+vec3 CustomToneMapping( vec3 color ) { return color; }`, OC = `#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
@@ -16971,7 +16971,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSM
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
-#endif`, OC = `#ifdef USE_TRANSMISSION
+#endif`, QC = `#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
@@ -17097,7 +17097,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSM
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
-#endif`, QC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`, GC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -17167,7 +17167,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSM
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`, GC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`, HC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -17261,7 +17261,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSM
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`, HC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`, zC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
@@ -17332,7 +17332,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSM
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
-#endif`, zC = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+#endif`, VC = `#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;
@@ -17342,12 +17342,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSM
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;
-const VC = `varying vec2 vUv;
+const WC = `varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
-}`, WC = `uniform sampler2D t2D;
+}`, qC = `uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
@@ -17359,14 +17359,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, qC = `varying vec3 vWorldDirection;
+}`, KC = `varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`, KC = `#ifdef ENVMAP_TYPE_CUBE
+}`, jC = `#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
@@ -17389,14 +17389,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, jC = `varying vec3 vWorldDirection;
+}`, XC = `varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`, XC = `uniform samplerCube tCube;
+}`, YC = `uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
@@ -17406,7 +17406,7 @@ void main() {
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, YC = `#include <common>
+}`, JC = `#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
@@ -17433,7 +17433,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
-}`, JC = `#if DEPTH_PACKING == 3200
+}`, ZC = `#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
@@ -17467,7 +17467,7 @@ void main() {
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
-}`, ZC = `#define DISTANCE
+}`, $C = `#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17494,7 +17494,7 @@ void main() {
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
-}`, $C = `#define DISTANCE
+}`, eI = `#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
@@ -17518,13 +17518,13 @@ void main () {
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
-}`, eI = `varying vec3 vWorldDirection;
+}`, tI = `varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
-}`, tI = `uniform sampler2D tEquirect;
+}`, nI = `uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
@@ -17533,7 +17533,7 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, nI = `uniform float scale;
+}`, iI = `uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
@@ -17555,7 +17555,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`, iI = `uniform vec3 diffuse;
+}`, sI = `uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
@@ -17583,7 +17583,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`, sI = `#include <common>
+}`, rI = `#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
@@ -17615,7 +17615,7 @@ void main() {
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
-}`, rI = `uniform vec3 diffuse;
+}`, aI = `uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
@@ -17663,7 +17663,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, aI = `#define LAMBERT
+}`, oI = `#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17702,7 +17702,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, oI = `#define LAMBERT
+}`, cI = `#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -17759,7 +17759,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, cI = `#define MATCAP
+}`, lI = `#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17793,7 +17793,7 @@ void main() {
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
-}`, lI = `#define MATCAP
+}`, hI = `#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
@@ -17839,7 +17839,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, hI = `#define NORMAL
+}`, uI = `#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
@@ -17872,7 +17872,7 @@ void main() {
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
-}`, uI = `#define NORMAL
+}`, dI = `#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
@@ -17894,7 +17894,7 @@ void main() {
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
-}`, dI = `#define PHONG
+}`, fI = `#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17933,7 +17933,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, fI = `#define PHONG
+}`, pI = `#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
@@ -17992,7 +17992,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, pI = `#define STANDARD
+}`, AI = `#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
@@ -18035,7 +18035,7 @@ void main() {
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
-}`, AI = `#define STANDARD
+}`, gI = `#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
@@ -18160,7 +18160,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, gI = `#define TOON
+}`, mI = `#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -18197,7 +18197,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, mI = `#define TOON
+}`, xI = `#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -18250,7 +18250,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, xI = `uniform float size;
+}`, bI = `uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
@@ -18281,7 +18281,7 @@ void main() {
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
-}`, bI = `uniform vec3 diffuse;
+}`, EI = `uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
@@ -18306,7 +18306,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`, EI = `#include <common>
+}`, yI = `#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
@@ -18329,7 +18329,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, yI = `uniform vec3 color;
+}`, _I = `uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
@@ -18345,7 +18345,7 @@ void main() {
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
-}`, _I = `uniform float rotation;
+}`, wI = `uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
@@ -18369,7 +18369,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`, wI = `uniform vec3 diffuse;
+}`, vI = `uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
@@ -18395,147 +18395,147 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
}`, lt = {
- alphahash_fragment: Ww,
- alphahash_pars_fragment: qw,
- alphamap_fragment: Kw,
- alphamap_pars_fragment: jw,
- alphatest_fragment: Xw,
- alphatest_pars_fragment: Yw,
- aomap_fragment: Jw,
- aomap_pars_fragment: Zw,
- batching_pars_vertex: $w,
- batching_vertex: ev,
- begin_vertex: tv,
- beginnormal_vertex: nv,
- bsdfs: iv,
- iridescence_fragment: sv,
- bumpmap_pars_fragment: rv,
- clipping_planes_fragment: av,
- clipping_planes_pars_fragment: ov,
- clipping_planes_pars_vertex: cv,
- clipping_planes_vertex: lv,
- color_fragment: hv,
- color_pars_fragment: uv,
- color_pars_vertex: dv,
- color_vertex: fv,
- common: pv,
- cube_uv_reflection_fragment: Av,
- defaultnormal_vertex: gv,
- displacementmap_pars_vertex: mv,
- displacementmap_vertex: xv,
- emissivemap_fragment: bv,
- emissivemap_pars_fragment: Ev,
- colorspace_fragment: yv,
- colorspace_pars_fragment: _v,
- envmap_fragment: wv,
- envmap_common_pars_fragment: vv,
- envmap_pars_fragment: Cv,
- envmap_pars_vertex: Iv,
- envmap_physical_pars_fragment: kv,
- envmap_vertex: Sv,
- fog_vertex: Mv,
- fog_pars_vertex: Bv,
- fog_fragment: Tv,
- fog_pars_fragment: Rv,
- gradientmap_pars_fragment: Fv,
- lightmap_pars_fragment: Nv,
- lights_lambert_fragment: Dv,
- lights_lambert_pars_fragment: Lv,
- lights_pars_begin: Pv,
- lights_toon_fragment: Uv,
- lights_toon_pars_fragment: Ov,
- lights_phong_fragment: Qv,
- lights_phong_pars_fragment: Gv,
- lights_physical_fragment: Hv,
- lights_physical_pars_fragment: zv,
- lights_fragment_begin: Vv,
- lights_fragment_maps: Wv,
- lights_fragment_end: qv,
- logdepthbuf_fragment: Kv,
- logdepthbuf_pars_fragment: jv,
- logdepthbuf_pars_vertex: Xv,
- logdepthbuf_vertex: Yv,
- map_fragment: Jv,
- map_pars_fragment: Zv,
- map_particle_fragment: $v,
- map_particle_pars_fragment: eC,
- metalnessmap_fragment: tC,
- metalnessmap_pars_fragment: nC,
- morphinstance_vertex: iC,
- morphcolor_vertex: sC,
- morphnormal_vertex: rC,
- morphtarget_pars_vertex: aC,
- morphtarget_vertex: oC,
- normal_fragment_begin: cC,
- normal_fragment_maps: lC,
- normal_pars_fragment: hC,
- normal_pars_vertex: uC,
- normal_vertex: dC,
- normalmap_pars_fragment: fC,
- clearcoat_normal_fragment_begin: pC,
- clearcoat_normal_fragment_maps: AC,
- clearcoat_pars_fragment: gC,
- iridescence_pars_fragment: mC,
- opaque_fragment: xC,
- packing: bC,
- premultiplied_alpha_fragment: EC,
- project_vertex: yC,
- dithering_fragment: _C,
- dithering_pars_fragment: wC,
- roughnessmap_fragment: vC,
- roughnessmap_pars_fragment: CC,
- shadowmap_pars_fragment: IC,
- shadowmap_pars_vertex: SC,
- shadowmap_vertex: MC,
- shadowmask_pars_fragment: BC,
- skinbase_vertex: TC,
- skinning_pars_vertex: RC,
- skinning_vertex: FC,
- skinnormal_vertex: NC,
- specularmap_fragment: DC,
- specularmap_pars_fragment: LC,
- tonemapping_fragment: PC,
- tonemapping_pars_fragment: kC,
- transmission_fragment: UC,
- transmission_pars_fragment: OC,
- uv_pars_fragment: QC,
- uv_pars_vertex: GC,
- uv_vertex: HC,
- worldpos_vertex: zC,
- background_vert: VC,
- background_frag: WC,
- backgroundCube_vert: qC,
- backgroundCube_frag: KC,
- cube_vert: jC,
- cube_frag: XC,
- depth_vert: YC,
- depth_frag: JC,
- distanceRGBA_vert: ZC,
- distanceRGBA_frag: $C,
- equirect_vert: eI,
- equirect_frag: tI,
- linedashed_vert: nI,
- linedashed_frag: iI,
- meshbasic_vert: sI,
- meshbasic_frag: rI,
- meshlambert_vert: aI,
- meshlambert_frag: oI,
- meshmatcap_vert: cI,
- meshmatcap_frag: lI,
- meshnormal_vert: hI,
- meshnormal_frag: uI,
- meshphong_vert: dI,
- meshphong_frag: fI,
- meshphysical_vert: pI,
- meshphysical_frag: AI,
- meshtoon_vert: gI,
- meshtoon_frag: mI,
- points_vert: xI,
- points_frag: bI,
- shadow_vert: EI,
- shadow_frag: yI,
- sprite_vert: _I,
- sprite_frag: wI
+ alphahash_fragment: qw,
+ alphahash_pars_fragment: Kw,
+ alphamap_fragment: jw,
+ alphamap_pars_fragment: Xw,
+ alphatest_fragment: Yw,
+ alphatest_pars_fragment: Jw,
+ aomap_fragment: Zw,
+ aomap_pars_fragment: $w,
+ batching_pars_vertex: ev,
+ batching_vertex: tv,
+ begin_vertex: nv,
+ beginnormal_vertex: iv,
+ bsdfs: sv,
+ iridescence_fragment: rv,
+ bumpmap_pars_fragment: av,
+ clipping_planes_fragment: ov,
+ clipping_planes_pars_fragment: cv,
+ clipping_planes_pars_vertex: lv,
+ clipping_planes_vertex: hv,
+ color_fragment: uv,
+ color_pars_fragment: dv,
+ color_pars_vertex: fv,
+ color_vertex: pv,
+ common: Av,
+ cube_uv_reflection_fragment: gv,
+ defaultnormal_vertex: mv,
+ displacementmap_pars_vertex: xv,
+ displacementmap_vertex: bv,
+ emissivemap_fragment: Ev,
+ emissivemap_pars_fragment: yv,
+ colorspace_fragment: _v,
+ colorspace_pars_fragment: wv,
+ envmap_fragment: vv,
+ envmap_common_pars_fragment: Cv,
+ envmap_pars_fragment: Iv,
+ envmap_pars_vertex: Sv,
+ envmap_physical_pars_fragment: Uv,
+ envmap_vertex: Mv,
+ fog_vertex: Bv,
+ fog_pars_vertex: Tv,
+ fog_fragment: Rv,
+ fog_pars_fragment: Fv,
+ gradientmap_pars_fragment: Nv,
+ lightmap_pars_fragment: Dv,
+ lights_lambert_fragment: Lv,
+ lights_lambert_pars_fragment: Pv,
+ lights_pars_begin: kv,
+ lights_toon_fragment: Ov,
+ lights_toon_pars_fragment: Qv,
+ lights_phong_fragment: Gv,
+ lights_phong_pars_fragment: Hv,
+ lights_physical_fragment: zv,
+ lights_physical_pars_fragment: Vv,
+ lights_fragment_begin: Wv,
+ lights_fragment_maps: qv,
+ lights_fragment_end: Kv,
+ logdepthbuf_fragment: jv,
+ logdepthbuf_pars_fragment: Xv,
+ logdepthbuf_pars_vertex: Yv,
+ logdepthbuf_vertex: Jv,
+ map_fragment: Zv,
+ map_pars_fragment: $v,
+ map_particle_fragment: eC,
+ map_particle_pars_fragment: tC,
+ metalnessmap_fragment: nC,
+ metalnessmap_pars_fragment: iC,
+ morphinstance_vertex: sC,
+ morphcolor_vertex: rC,
+ morphnormal_vertex: aC,
+ morphtarget_pars_vertex: oC,
+ morphtarget_vertex: cC,
+ normal_fragment_begin: lC,
+ normal_fragment_maps: hC,
+ normal_pars_fragment: uC,
+ normal_pars_vertex: dC,
+ normal_vertex: fC,
+ normalmap_pars_fragment: pC,
+ clearcoat_normal_fragment_begin: AC,
+ clearcoat_normal_fragment_maps: gC,
+ clearcoat_pars_fragment: mC,
+ iridescence_pars_fragment: xC,
+ opaque_fragment: bC,
+ packing: EC,
+ premultiplied_alpha_fragment: yC,
+ project_vertex: _C,
+ dithering_fragment: wC,
+ dithering_pars_fragment: vC,
+ roughnessmap_fragment: CC,
+ roughnessmap_pars_fragment: IC,
+ shadowmap_pars_fragment: SC,
+ shadowmap_pars_vertex: MC,
+ shadowmap_vertex: BC,
+ shadowmask_pars_fragment: TC,
+ skinbase_vertex: RC,
+ skinning_pars_vertex: FC,
+ skinning_vertex: NC,
+ skinnormal_vertex: DC,
+ specularmap_fragment: LC,
+ specularmap_pars_fragment: PC,
+ tonemapping_fragment: kC,
+ tonemapping_pars_fragment: UC,
+ transmission_fragment: OC,
+ transmission_pars_fragment: QC,
+ uv_pars_fragment: GC,
+ uv_pars_vertex: HC,
+ uv_vertex: zC,
+ worldpos_vertex: VC,
+ background_vert: WC,
+ background_frag: qC,
+ backgroundCube_vert: KC,
+ backgroundCube_frag: jC,
+ cube_vert: XC,
+ cube_frag: YC,
+ depth_vert: JC,
+ depth_frag: ZC,
+ distanceRGBA_vert: $C,
+ distanceRGBA_frag: eI,
+ equirect_vert: tI,
+ equirect_frag: nI,
+ linedashed_vert: iI,
+ linedashed_frag: sI,
+ meshbasic_vert: rI,
+ meshbasic_frag: aI,
+ meshlambert_vert: oI,
+ meshlambert_frag: cI,
+ meshmatcap_vert: lI,
+ meshmatcap_frag: hI,
+ meshnormal_vert: uI,
+ meshnormal_frag: dI,
+ meshphong_vert: fI,
+ meshphong_frag: pI,
+ meshphysical_vert: AI,
+ meshphysical_frag: gI,
+ meshtoon_vert: mI,
+ meshtoon_frag: xI,
+ points_vert: bI,
+ points_frag: EI,
+ shadow_vert: yI,
+ shadow_frag: _I,
+ sprite_vert: wI,
+ sprite_frag: vI
}, we = {
common: {
diffuse: { value: /* @__PURE__ */ new Le(16777215) },
@@ -18697,9 +18697,9 @@ void main() {
alphaMapTransform: { value: /* @__PURE__ */ new at() },
alphaTest: { value: 0 }
}
-}, ki = {
+}, Ui = {
basic: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.specularmap,
we.envmap,
@@ -18711,7 +18711,7 @@ void main() {
fragmentShader: lt.meshbasic_frag
},
lambert: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.specularmap,
we.envmap,
@@ -18731,7 +18731,7 @@ void main() {
fragmentShader: lt.meshlambert_frag
},
phong: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.specularmap,
we.envmap,
@@ -18753,7 +18753,7 @@ void main() {
fragmentShader: lt.meshphong_frag
},
standard: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.envmap,
we.aomap,
@@ -18777,7 +18777,7 @@ void main() {
fragmentShader: lt.meshphysical_frag
},
toon: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.aomap,
we.lightmap,
@@ -18796,7 +18796,7 @@ void main() {
fragmentShader: lt.meshtoon_frag
},
matcap: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.bumpmap,
we.normalmap,
@@ -18810,7 +18810,7 @@ void main() {
fragmentShader: lt.meshmatcap_frag
},
points: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.points,
we.fog
]),
@@ -18818,7 +18818,7 @@ void main() {
fragmentShader: lt.points_frag
},
dashed: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.fog,
{
@@ -18831,7 +18831,7 @@ void main() {
fragmentShader: lt.linedashed_frag
},
depth: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.displacementmap
]),
@@ -18839,7 +18839,7 @@ void main() {
fragmentShader: lt.depth_frag
},
normal: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.bumpmap,
we.normalmap,
@@ -18852,7 +18852,7 @@ void main() {
fragmentShader: lt.meshnormal_frag
},
sprite: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.sprite,
we.fog
]),
@@ -18896,7 +18896,7 @@ void main() {
fragmentShader: lt.equirect_frag
},
distanceRGBA: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.common,
we.displacementmap,
{
@@ -18909,7 +18909,7 @@ void main() {
fragmentShader: lt.distanceRGBA_frag
},
shadow: {
- uniforms: /* @__PURE__ */ Pn([
+ uniforms: /* @__PURE__ */ kn([
we.lights,
we.fog,
{
@@ -18921,9 +18921,9 @@ void main() {
fragmentShader: lt.shadow_frag
}
};
-ki.physical = {
- uniforms: /* @__PURE__ */ Pn([
- ki.standard.uniforms,
+Ui.physical = {
+ uniforms: /* @__PURE__ */ kn([
+ Ui.standard.uniforms,
{
clearcoat: { value: 0 },
clearcoatMap: { value: null },
@@ -18974,8 +18974,8 @@ ki.physical = {
vertexShader: lt.meshphysical_vert,
fragmentShader: lt.meshphysical_frag
};
-const el = { r: 0, b: 0, g: 0 }, ar = /* @__PURE__ */ new dn(), vI = /* @__PURE__ */ new Ne();
-function CI(i, e, t, n, s, r, a) {
+const tl = { r: 0, b: 0, g: 0 }, ar = /* @__PURE__ */ new dn(), CI = /* @__PURE__ */ new Ne();
+function II(i, e, t, n, s, r, a) {
const o = new Le(0);
let c = r === !0 ? 0 : 1, l, h, u = null, d = 0, f = null;
function p(x) {
@@ -18991,14 +18991,14 @@ function CI(i, e, t, n, s, r, a) {
}
function g(x, E) {
const S = p(E);
- S && (S.isCubeTexture || S.mapping === uh) ? (h === void 0 && (h = new Zt(
- new Wa(1, 1, 1),
+ S && (S.isCubeTexture || S.mapping === fh) ? (h === void 0 && (h = new Zt(
+ new qa(1, 1, 1),
new qs({
name: "BackgroundCubeMaterial",
- uniforms: Pa(ki.backgroundCube.uniforms),
- vertexShader: ki.backgroundCube.vertexShader,
- fragmentShader: ki.backgroundCube.fragmentShader,
- side: Vn,
+ uniforms: ka(Ui.backgroundCube.uniforms),
+ vertexShader: Ui.backgroundCube.vertexShader,
+ fragmentShader: Ui.backgroundCube.fragmentShader,
+ side: Wn,
depthTest: !1,
depthWrite: !1,
fog: !1,
@@ -19010,13 +19010,13 @@ function CI(i, e, t, n, s, r, a) {
get: function() {
return this.uniforms.envMap.value;
}
- }), s.update(h)), ar.copy(E.backgroundRotation), ar.x *= -1, ar.y *= -1, ar.z *= -1, S.isCubeTexture && S.isRenderTargetTexture === !1 && (ar.y *= -1, ar.z *= -1), h.material.uniforms.envMap.value = S, h.material.uniforms.flipEnvMap.value = S.isCubeTexture && S.isRenderTargetTexture === !1 ? -1 : 1, h.material.uniforms.backgroundBlurriness.value = E.backgroundBlurriness, h.material.uniforms.backgroundIntensity.value = E.backgroundIntensity, h.material.uniforms.backgroundRotation.value.setFromMatrix4(vI.makeRotationFromEuler(ar)), h.material.toneMapped = rt.getTransfer(S.colorSpace) !== Rt, (u !== S || d !== S.version || f !== i.toneMapping) && (h.material.needsUpdate = !0, u = S, d = S.version, f = i.toneMapping), h.layers.enableAll(), x.unshift(h, h.geometry, h.material, 0, 0, null)) : S && S.isTexture && (l === void 0 && (l = new Zt(
- new xh(2, 2),
+ }), s.update(h)), ar.copy(E.backgroundRotation), ar.x *= -1, ar.y *= -1, ar.z *= -1, S.isCubeTexture && S.isRenderTargetTexture === !1 && (ar.y *= -1, ar.z *= -1), h.material.uniforms.envMap.value = S, h.material.uniforms.flipEnvMap.value = S.isCubeTexture && S.isRenderTargetTexture === !1 ? -1 : 1, h.material.uniforms.backgroundBlurriness.value = E.backgroundBlurriness, h.material.uniforms.backgroundIntensity.value = E.backgroundIntensity, h.material.uniforms.backgroundRotation.value.setFromMatrix4(CI.makeRotationFromEuler(ar)), h.material.toneMapped = rt.getTransfer(S.colorSpace) !== Rt, (u !== S || d !== S.version || f !== i.toneMapping) && (h.material.needsUpdate = !0, u = S, d = S.version, f = i.toneMapping), h.layers.enableAll(), x.unshift(h, h.geometry, h.material, 0, 0, null)) : S && S.isTexture && (l === void 0 && (l = new Zt(
+ new Eh(2, 2),
new qs({
name: "BackgroundMaterial",
- uniforms: Pa(ki.background.uniforms),
- vertexShader: ki.background.vertexShader,
- fragmentShader: ki.background.fragmentShader,
+ uniforms: ka(Ui.background.uniforms),
+ vertexShader: Ui.background.vertexShader,
+ fragmentShader: Ui.background.fragmentShader,
side: bs,
depthTest: !1,
depthWrite: !1,
@@ -19030,7 +19030,7 @@ function CI(i, e, t, n, s, r, a) {
}), s.update(l)), l.material.uniforms.t2D.value = S, l.material.uniforms.backgroundIntensity.value = E.backgroundIntensity, l.material.toneMapped = rt.getTransfer(S.colorSpace) !== Rt, S.matrixAutoUpdate === !0 && S.updateMatrix(), l.material.uniforms.uvTransform.value.copy(S.matrix), (u !== S || d !== S.version || f !== i.toneMapping) && (l.material.needsUpdate = !0, u = S, d = S.version, f = i.toneMapping), l.layers.enableAll(), x.unshift(l, l.geometry, l.material, 0, 0, null));
}
function A(x, E) {
- x.getRGB(el, F0(i)), n.buffers.color.setClear(el.r, el.g, el.b, E, a);
+ x.getRGB(tl, N0(i)), n.buffers.color.setClear(tl.r, tl.g, tl.b, E, a);
}
function _() {
h !== void 0 && (h.geometry.dispose(), h.material.dispose(), h = void 0), l !== void 0 && (l.geometry.dispose(), l.material.dispose(), l = void 0);
@@ -19053,7 +19053,7 @@ function CI(i, e, t, n, s, r, a) {
dispose: _
};
}
-function II(i, e) {
+function SI(i, e) {
const t = i.getParameter(i.MAX_VERTEX_ATTRIBS), n = {}, s = d(null);
let r = s, a = !1;
function o(v, F, K, q, $) {
@@ -19152,7 +19152,7 @@ function II(i, e) {
if (J === void 0 && (Y === "instanceMatrix" && v.instanceMatrix && (J = v.instanceMatrix), Y === "instanceColor" && v.instanceColor && (J = v.instanceColor)), J !== void 0) {
const ee = J.normalized, ae = J.itemSize, _e = e.get(J);
if (_e === void 0) continue;
- const Me = _e.buffer, se = _e.type, me = _e.bytesPerElement, xe = se === i.INT || se === i.UNSIGNED_INT || J.gpuType === Lf;
+ const Me = _e.buffer, se = _e.type, me = _e.bytesPerElement, xe = se === i.INT || se === i.UNSIGNED_INT || J.gpuType === kf;
if (J.isInterleavedBufferAttribute) {
const be = J.data, Ue = be.stride, et = J.offset;
if (be.isInstancedInterleavedBuffer) {
@@ -19266,7 +19266,7 @@ function II(i, e) {
disableUnusedAttributes: _
};
}
-function SI(i, e, t) {
+function MI(i, e, t) {
let n;
function s(l) {
n = l;
@@ -19301,7 +19301,7 @@ function SI(i, e, t) {
}
this.setMode = s, this.render = r, this.renderInstances = a, this.renderMultiDraw = o, this.renderMultiDrawInstances = c;
}
-function MI(i, e, t, n) {
+function BI(i, e, t, n) {
let s;
function r() {
if (s !== void 0) return s;
@@ -19316,7 +19316,7 @@ function MI(i, e, t, n) {
return !(I !== pn && n.convert(I) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT));
}
function o(I) {
- const T = I === Qn && (e.has("EXT_color_buffer_half_float") || e.has("EXT_color_buffer_float"));
+ const T = I === Gn && (e.has("EXT_color_buffer_half_float") || e.has("EXT_color_buffer_float"));
return !(I !== un && n.convert(I) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)
I !== fn && !T);
}
@@ -19354,7 +19354,7 @@ function MI(i, e, t, n) {
maxSamples: w
};
}
-function BI(i) {
+function TI(i) {
const e = this;
let t = null, n = 0, s = !1, r = !1;
const a = new Us(), o = new at(), c = { value: null, needsUpdate: !1 };
@@ -19400,22 +19400,22 @@ function BI(i) {
return e.numPlanes = m, e.numIntersection = 0, g;
}
}
-function TI(i) {
+function RI(i) {
let e = /* @__PURE__ */ new WeakMap();
function t(a, o) {
- return o === Dl ? a.mapping = Br : o === bd && (a.mapping = Da), a;
+ return o === Pl ? a.mapping = Br : o === yd && (a.mapping = La), a;
}
function n(a) {
if (a && a.isTexture) {
const o = a.mapping;
- if (o === Dl || o === bd)
+ if (o === Pl || o === yd)
if (e.has(a)) {
const c = e.get(a).texture;
return t(c, a.mapping);
} else {
const c = a.image;
if (c && c.height > 0) {
- const l = new R_(c.height);
+ const l = new F_(c.height);
return l.fromEquirectangularTexture(i, a), e.set(a, l), a.addEventListener("dispose", s), t(l.texture, a.mapping);
} else
return null;
@@ -19437,9 +19437,9 @@ function TI(i) {
dispose: r
};
}
-const xa = 4, RA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], Ar = 20, pu = /* @__PURE__ */ new Yf(), FA = /* @__PURE__ */ new Le();
-let Au = null, gu = 0, mu = 0, xu = !1;
-const dr = (1 + Math.sqrt(5)) / 2, aa = 1 / dr, NA = [
+const ba = 4, NA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], Ar = 20, gu = /* @__PURE__ */ new Zf(), DA = /* @__PURE__ */ new Le();
+let mu = null, xu = 0, bu = 0, Eu = !1;
+const dr = (1 + Math.sqrt(5)) / 2, aa = 1 / dr, LA = [
/* @__PURE__ */ new G(-dr, aa, 0),
/* @__PURE__ */ new G(dr, aa, 0),
/* @__PURE__ */ new G(-aa, 0, dr),
@@ -19450,8 +19450,8 @@ const dr = (1 + Math.sqrt(5)) / 2, aa = 1 / dr, NA = [
/* @__PURE__ */ new G(1, 1, -1),
/* @__PURE__ */ new G(-1, 1, 1),
/* @__PURE__ */ new G(1, 1, 1)
-], RI = /* @__PURE__ */ new G();
-class Wd {
+], FI = /* @__PURE__ */ new G();
+class Kd {
/**
* Constructs a new PMREM generator.
*
@@ -19478,9 +19478,9 @@ class Wd {
fromScene(e, t = 0, n = 0.1, s = 100, r = {}) {
const {
size: a = 256,
- position: o = RI
+ position: o = FI
} = r;
- Au = this._renderer.getRenderTarget(), gu = this._renderer.getActiveCubeFace(), mu = this._renderer.getActiveMipmapLevel(), xu = this._renderer.xr.enabled, this._renderer.xr.enabled = !1, this._setSize(a);
+ mu = this._renderer.getRenderTarget(), xu = this._renderer.getActiveCubeFace(), bu = this._renderer.getActiveMipmapLevel(), Eu = this._renderer.xr.enabled, this._renderer.xr.enabled = !1, this._setSize(a);
const c = this._allocateTargets();
return c.depthBuffer = !0, this._sceneToCubeUV(e, n, s, c, o), t > 0 && this._blur(c, 0, 0, t), this._applyPMREM(c), this._cleanup(c), c;
}
@@ -19513,14 +19513,14 @@ class Wd {
* your texture's network fetch for increased concurrency.
*/
compileCubemapShader() {
- this._cubemapMaterial === null && (this._cubemapMaterial = PA(), this._compileMaterial(this._cubemapMaterial));
+ this._cubemapMaterial === null && (this._cubemapMaterial = UA(), this._compileMaterial(this._cubemapMaterial));
}
/**
* Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during
* your texture's network fetch for increased concurrency.
*/
compileEquirectangularShader() {
- this._equirectMaterial === null && (this._equirectMaterial = LA(), this._compileMaterial(this._equirectMaterial));
+ this._equirectMaterial === null && (this._equirectMaterial = kA(), this._compileMaterial(this._equirectMaterial));
}
/**
* Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,
@@ -19540,10 +19540,10 @@ class Wd {
this._lodPlanes[e].dispose();
}
_cleanup(e) {
- this._renderer.setRenderTarget(Au, gu, mu), this._renderer.xr.enabled = xu, e.scissorTest = !1, tl(e, 0, 0, e.width, e.height);
+ this._renderer.setRenderTarget(mu, xu, bu), this._renderer.xr.enabled = Eu, e.scissorTest = !1, nl(e, 0, 0, e.width, e.height);
}
_fromTexture(e, t) {
- e.mapping === Br || e.mapping === Da ? this._setSize(e.image.length === 0 ? 16 : e.image[0].width || e.image[0].image.width) : this._setSize(e.image.width / 4), Au = this._renderer.getRenderTarget(), gu = this._renderer.getActiveCubeFace(), mu = this._renderer.getActiveMipmapLevel(), xu = this._renderer.xr.enabled, this._renderer.xr.enabled = !1;
+ e.mapping === Br || e.mapping === La ? this._setSize(e.image.length === 0 ? 16 : e.image[0].width || e.image[0].image.width) : this._setSize(e.image.width / 4), mu = this._renderer.getRenderTarget(), xu = this._renderer.getActiveCubeFace(), bu = this._renderer.getActiveMipmapLevel(), Eu = this._renderer.xr.enabled, this._renderer.xr.enabled = !1;
const n = t || this._allocateTargets();
return this._textureToCubeUV(e, n), this._applyPMREM(n), this._cleanup(n), n;
}
@@ -19552,56 +19552,56 @@ class Wd {
magFilter: Xt,
minFilter: Xt,
generateMipmaps: !1,
- type: Qn,
+ type: Gn,
format: pn,
colorSpace: An,
depthBuffer: !1
- }, s = DA(e, t, n);
+ }, s = PA(e, t, n);
if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== e || this._pingPongRenderTarget.height !== t) {
- this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = DA(e, t, n);
+ this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = PA(e, t, n);
const { _lodMax: r } = this;
- ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = FI(r)), this._blurMaterial = NI(r, e, t);
+ ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = NI(r)), this._blurMaterial = DI(r, e, t);
}
return s;
}
_compileMaterial(e) {
const t = new Zt(this._lodPlanes[0], e);
- this._renderer.compile(t, pu);
+ this._renderer.compile(t, gu);
}
_sceneToCubeUV(e, t, n, s, r) {
const c = new In(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(FA), u.toneMapping = Hs, u.autoClear = !1;
+ u.getClearColor(DA), u.toneMapping = Hs, u.autoClear = !1;
const p = new Os({
name: "PMREM.Background",
- side: Vn,
+ side: Wn,
depthWrite: !1,
depthTest: !1
- }), m = new Zt(new Wa(), p);
+ }), m = new Zt(new qa(), p);
let g = !1;
const A = e.background;
- A ? A.isColor && (p.color.copy(A), e.background = null, g = !0) : (p.color.copy(FA), g = !0);
+ A ? A.isColor && (p.color.copy(A), e.background = null, g = !0) : (p.color.copy(DA), g = !0);
for (let _ = 0; _ < 6; _++) {
const x = _ % 3;
x === 0 ? (c.up.set(0, l[_], 0), c.position.set(r.x, r.y, r.z), c.lookAt(r.x + h[_], r.y, r.z)) : x === 1 ? (c.up.set(0, 0, l[_]), c.position.set(r.x, r.y, r.z), c.lookAt(r.x, r.y + h[_], r.z)) : (c.up.set(0, l[_], 0), c.position.set(r.x, r.y, r.z), c.lookAt(r.x, r.y, r.z + h[_]));
const E = this._cubeSize;
- tl(s, x * E, _ > 2 ? E : 0, E, E), u.setRenderTarget(s), g && u.render(m, c), u.render(e, c);
+ nl(s, x * E, _ > 2 ? E : 0, E, E), u.setRenderTarget(s), g && u.render(m, c), u.render(e, c);
}
m.geometry.dispose(), m.material.dispose(), u.toneMapping = f, u.autoClear = d, e.background = A;
}
_textureToCubeUV(e, t) {
- const n = this._renderer, s = e.mapping === Br || e.mapping === Da;
- s ? (this._cubemapMaterial === null && (this._cubemapMaterial = PA()), this._cubemapMaterial.uniforms.flipEnvMap.value = e.isRenderTargetTexture === !1 ? -1 : 1) : this._equirectMaterial === null && (this._equirectMaterial = LA());
+ const n = this._renderer, s = e.mapping === Br || e.mapping === La;
+ s ? (this._cubemapMaterial === null && (this._cubemapMaterial = UA()), this._cubemapMaterial.uniforms.flipEnvMap.value = e.isRenderTargetTexture === !1 ? -1 : 1) : this._equirectMaterial === null && (this._equirectMaterial = kA());
const r = s ? this._cubemapMaterial : this._equirectMaterial, a = new Zt(this._lodPlanes[0], r), o = r.uniforms;
o.envMap.value = e;
const c = this._cubeSize;
- tl(t, 0, 0, 3 * c, 2 * c), n.setRenderTarget(t), n.render(a, pu);
+ nl(t, 0, 0, 3 * c, 2 * c), n.setRenderTarget(t), n.render(a, gu);
}
_applyPMREM(e) {
const t = this._renderer, n = t.autoClear;
t.autoClear = !1;
const s = this._lodPlanes.length;
for (let r = 1; r < s; r++) {
- const a = Math.sqrt(this._sigmas[r] * this._sigmas[r] - this._sigmas[r - 1] * this._sigmas[r - 1]), o = NA[(s - r - 1) % NA.length];
+ const a = Math.sqrt(this._sigmas[r] * this._sigmas[r] - this._sigmas[r - 1] * this._sigmas[r - 1]), o = LA[(s - r - 1) % LA.length];
this._blur(e, r - 1, r, a, o);
}
t.autoClear = n;
@@ -19658,19 +19658,19 @@ class Wd {
d.envMap.value = e.texture, d.samples.value = g, d.weights.value = A, d.latitudinal.value = a === "latitudinal", o && (d.poleAxis.value = o);
const { _lodMax: x } = this;
d.dTheta.value = p, d.mipInt.value = x - n;
- const E = this._sizeLods[s], S = 3 * E * (s > x - xa ? s - x + xa : 0), w = 4 * (this._cubeSize - E);
- tl(t, S, w, 3 * E, 2 * E), c.setRenderTarget(t), c.render(u, pu);
+ const E = this._sizeLods[s], S = 3 * E * (s > x - ba ? s - x + ba : 0), w = 4 * (this._cubeSize - E);
+ nl(t, S, w, 3 * E, 2 * E), c.setRenderTarget(t), c.render(u, gu);
}
}
-function FI(i) {
+function NI(i) {
const e = [], t = [], n = [];
let s = i;
- const r = i - xa + 1 + RA.length;
+ const r = i - ba + 1 + NA.length;
for (let a = 0; a < r; a++) {
const o = Math.pow(2, s);
t.push(o);
let c = 1 / o;
- a > i - xa ? c = RA[a - i + xa - 1] : a === 0 && (c = 0), n.push(c);
+ a > i - ba ? c = NA[a - i + ba - 1] : a === 0 && (c = 0), n.push(c);
const l = 1 / (o - 2), h = -l, u = 1 + l, d = [h, h, u, h, u, u, h, h, u, u, h, u], f = 6, p = 6, m = 3, g = 2, A = 1, _ = new Float32Array(m * p * f), x = new Float32Array(g * p * f), E = new Float32Array(A * p * f);
for (let w = 0; w < f; w++) {
const I = w % 3 * 2 / 3 - 1, T = w > 2 ? 0 : -1, C = [
@@ -19698,18 +19698,18 @@ function FI(i) {
E.set(v, A * p * w);
}
const S = new Tn();
- S.setAttribute("position", new Bn(_, m)), S.setAttribute("uv", new Bn(x, g)), S.setAttribute("faceIndex", new Bn(E, A)), e.push(S), s > xa && s--;
+ S.setAttribute("position", new Bn(_, m)), S.setAttribute("uv", new Bn(x, g)), S.setAttribute("faceIndex", new Bn(E, A)), e.push(S), s > ba && s--;
}
return { lodPlanes: e, sizeLods: t, sigmas: n };
}
-function DA(i, e, t) {
+function PA(i, e, t) {
const n = new Rr(i, e, t);
- return n.texture.mapping = uh, n.texture.name = "PMREM.cubeUv", n.scissorTest = !0, n;
+ return n.texture.mapping = fh, n.texture.name = "PMREM.cubeUv", n.scissorTest = !0, n;
}
-function tl(i, e, t, n, s) {
+function nl(i, e, t, n, s) {
i.viewport.set(e, t, n, s), i.scissor.set(e, t, n, s);
}
-function NI(i, e, t) {
+function DI(i, e, t) {
const n = new Float32Array(Ar), s = new G(0, 1, 0);
return new qs({
name: "SphericalGaussianBlur",
@@ -19728,7 +19728,7 @@ function NI(i, e, t) {
mipInt: { value: 0 },
poleAxis: { value: s }
},
- vertexShader: ep(),
+ vertexShader: np(),
fragmentShader: (
/* glsl */
`
@@ -19798,13 +19798,13 @@ function NI(i, e, t) {
depthWrite: !1
});
}
-function LA() {
+function kA() {
return new qs({
name: "EquirectangularToCubeUV",
uniforms: {
envMap: { value: null }
},
- vertexShader: ep(),
+ vertexShader: np(),
fragmentShader: (
/* glsl */
`
@@ -19833,14 +19833,14 @@ function LA() {
depthWrite: !1
});
}
-function PA() {
+function UA() {
return new qs({
name: "CubemapToCubeUV",
uniforms: {
envMap: { value: null },
flipEnvMap: { value: -1 }
},
- vertexShader: ep(),
+ vertexShader: np(),
fragmentShader: (
/* glsl */
`
@@ -19866,7 +19866,7 @@ function PA() {
depthWrite: !1
});
}
-function ep() {
+function np() {
return (
/* glsl */
`
@@ -19927,21 +19927,21 @@ function ep() {
`
);
}
-function DI(i) {
+function LI(i) {
let e = /* @__PURE__ */ new WeakMap(), t = null;
function n(o) {
if (o && o.isTexture) {
- const c = o.mapping, l = c === Dl || c === bd, h = c === Br || c === Da;
+ const c = o.mapping, l = c === Pl || c === yd, h = c === Br || c === La;
if (l || h) {
let u = e.get(o);
const d = u !== void 0 ? u.texture.pmremVersion : 0;
if (o.isRenderTargetTexture && o.pmremVersion !== d)
- return t === null && (t = new Wd(i)), u = l ? t.fromEquirectangular(o, u) : t.fromCubemap(o, u), u.texture.pmremVersion = o.pmremVersion, e.set(o, u), u.texture;
+ return t === null && (t = new Kd(i)), u = l ? t.fromEquirectangular(o, u) : t.fromCubemap(o, u), u.texture.pmremVersion = o.pmremVersion, e.set(o, u), u.texture;
if (u !== void 0)
return u.texture;
{
const f = o.image;
- return l && f && f.height > 0 || h && f && s(f) ? (t === null && (t = new Wd(i)), u = l ? t.fromEquirectangular(o) : t.fromCubemap(o), u.texture.pmremVersion = o.pmremVersion, e.set(o, u), o.addEventListener("dispose", r), u.texture) : null;
+ return l && f && f.height > 0 || h && f && s(f) ? (t === null && (t = new Kd(i)), u = l ? t.fromEquirectangular(o) : t.fromCubemap(o), u.texture.pmremVersion = o.pmremVersion, e.set(o, u), o.addEventListener("dispose", r), u.texture) : null;
}
}
}
@@ -19968,7 +19968,7 @@ function DI(i) {
dispose: a
};
}
-function LI(i) {
+function PI(i) {
const e = {};
function t(n) {
if (e[n] !== void 0)
@@ -20001,11 +20001,11 @@ function LI(i) {
},
get: function(n) {
const s = t(n);
- return s === null && Sl("THREE.WebGLRenderer: " + n + " extension not supported."), s;
+ return s === null && Bl("THREE.WebGLRenderer: " + n + " extension not supported."), s;
}
};
}
-function PI(i, e, t, n) {
+function kI(i, e, t, n) {
const s = {}, r = /* @__PURE__ */ new WeakMap();
function a(u) {
const d = u.target;
@@ -20043,7 +20043,7 @@ function PI(i, e, t, n) {
}
} else
return;
- const g = new (I0(d) ? R0 : Vf)(d, 1);
+ const g = new (S0(d) ? F0 : qf)(d, 1);
g.version = m;
const A = r.get(u);
A && e.remove(A), r.set(u, g);
@@ -20063,7 +20063,7 @@ function PI(i, e, t, n) {
getWireframeAttribute: h
};
}
-function kI(i, e, t) {
+function UI(i, e, t) {
let n;
function s(d) {
n = d;
@@ -20102,7 +20102,7 @@ function kI(i, e, t) {
}
this.setMode = s, this.setIndex = o, this.render = c, this.renderInstances = l, this.renderMultiDraw = h, this.renderMultiDrawInstances = u;
}
-function UI(i) {
+function OI(i) {
const e = {
geometries: 0,
textures: 0
@@ -20147,7 +20147,7 @@ function UI(i) {
update: n
};
}
-function OI(i, e, t) {
+function QI(i, e, t) {
const n = /* @__PURE__ */ new WeakMap(), s = new mt();
function r(a, o, c) {
const l = a.morphTargetInfluences, h = o.morphAttributes.position || o.morphAttributes.normal || o.morphAttributes.color, u = h !== void 0 ? h.length : 0;
@@ -20162,7 +20162,7 @@ function OI(i, e, t) {
f === !0 && (x = 1), p === !0 && (x = 2), m === !0 && (x = 3);
let E = o.attributes.position.count * x, S = 1;
E > e.maxTextureSize && (S = Math.ceil(E / e.maxTextureSize), E = e.maxTextureSize);
- const w = new Float32Array(E * S * 4 * u), I = new S0(w, E, S, u);
+ const w = new Float32Array(E * S * 4 * u), I = new M0(w, E, S, u);
I.type = fn, I.needsUpdate = !0;
const T = x * 4;
for (let v = 0; v < u; v++) {
@@ -20193,7 +20193,7 @@ function OI(i, e, t) {
update: r
};
}
-function QI(i, e, t, n) {
+function GI(i, e, t, n) {
let s = /* @__PURE__ */ new WeakMap();
function r(c) {
const l = n.render.frame, h = c.geometry, u = e.get(c, h);
@@ -20215,13 +20215,13 @@ function QI(i, e, t, n) {
dispose: a
};
}
-const Z0 = /* @__PURE__ */ new an(), kA = /* @__PURE__ */ new k0(1, 1), $0 = /* @__PURE__ */ new S0(), ex = /* @__PURE__ */ new M0(), tx = /* @__PURE__ */ new D0(), UA = [], OA = [], QA = new Float32Array(16), GA = new Float32Array(9), HA = new Float32Array(4);
-function Xa(i, e, t) {
+const $0 = /* @__PURE__ */ new an(), OA = /* @__PURE__ */ new U0(1, 1), ex = /* @__PURE__ */ new M0(), tx = /* @__PURE__ */ new B0(), nx = /* @__PURE__ */ new L0(), QA = [], GA = [], HA = new Float32Array(16), zA = new Float32Array(9), VA = new Float32Array(4);
+function Ya(i, e, t) {
const n = i[0];
if (n <= 0 || n > 0) return i;
const s = e * t;
- let r = UA[s];
- if (r === void 0 && (r = new Float32Array(s), UA[s] = r), e !== 0) {
+ let r = QA[s];
+ if (r === void 0 && (r = new Float32Array(s), QA[s] = r), e !== 0) {
n.toArray(r, 0);
for (let a = 1, o = 0; a !== e; ++a)
o += t, i[a].toArray(r, o);
@@ -20238,18 +20238,18 @@ function mn(i, e) {
for (let t = 0, n = e.length; t < n; t++)
i[t] = e[t];
}
-function bh(i, e) {
- let t = OA[e];
- t === void 0 && (t = new Int32Array(e), OA[e] = t);
+function yh(i, e) {
+ let t = GA[e];
+ t === void 0 && (t = new Int32Array(e), GA[e] = t);
for (let n = 0; n !== e; ++n)
t[n] = i.allocateTextureUnit();
return t;
}
-function GI(i, e) {
+function HI(i, e) {
const t = this.cache;
t[0] !== e && (i.uniform1f(this.addr, e), t[0] = e);
}
-function HI(i, e) {
+function zI(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y) && (i.uniform2f(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y);
@@ -20258,7 +20258,7 @@ function HI(i, e) {
i.uniform2fv(this.addr, e), mn(t, e);
}
}
-function zI(i, e) {
+function VI(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (i.uniform3f(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z);
@@ -20269,7 +20269,7 @@ function zI(i, e) {
i.uniform3fv(this.addr, e), mn(t, e);
}
}
-function VI(i, e) {
+function WI(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (i.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);
@@ -20278,41 +20278,41 @@ function VI(i, e) {
i.uniform4fv(this.addr, e), mn(t, e);
}
}
-function WI(i, e) {
+function qI(i, e) {
const t = this.cache, n = e.elements;
if (n === void 0) {
if (gn(t, e)) return;
i.uniformMatrix2fv(this.addr, !1, e), mn(t, e);
} else {
if (gn(t, n)) return;
- HA.set(n), i.uniformMatrix2fv(this.addr, !1, HA), mn(t, n);
+ VA.set(n), i.uniformMatrix2fv(this.addr, !1, VA), mn(t, n);
}
}
-function qI(i, e) {
+function KI(i, e) {
const t = this.cache, n = e.elements;
if (n === void 0) {
if (gn(t, e)) return;
i.uniformMatrix3fv(this.addr, !1, e), mn(t, e);
} else {
if (gn(t, n)) return;
- GA.set(n), i.uniformMatrix3fv(this.addr, !1, GA), mn(t, n);
+ zA.set(n), i.uniformMatrix3fv(this.addr, !1, zA), mn(t, n);
}
}
-function KI(i, e) {
+function jI(i, e) {
const t = this.cache, n = e.elements;
if (n === void 0) {
if (gn(t, e)) return;
i.uniformMatrix4fv(this.addr, !1, e), mn(t, e);
} else {
if (gn(t, n)) return;
- QA.set(n), i.uniformMatrix4fv(this.addr, !1, QA), mn(t, n);
+ HA.set(n), i.uniformMatrix4fv(this.addr, !1, HA), mn(t, n);
}
}
-function jI(i, e) {
+function XI(i, e) {
const t = this.cache;
t[0] !== e && (i.uniform1i(this.addr, e), t[0] = e);
}
-function XI(i, e) {
+function YI(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y) && (i.uniform2i(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y);
@@ -20321,7 +20321,7 @@ function XI(i, e) {
i.uniform2iv(this.addr, e), mn(t, e);
}
}
-function YI(i, e) {
+function JI(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (i.uniform3i(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z);
@@ -20330,7 +20330,7 @@ function YI(i, e) {
i.uniform3iv(this.addr, e), mn(t, e);
}
}
-function JI(i, e) {
+function ZI(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (i.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);
@@ -20339,11 +20339,11 @@ function JI(i, e) {
i.uniform4iv(this.addr, e), mn(t, e);
}
}
-function ZI(i, e) {
+function $I(i, e) {
const t = this.cache;
t[0] !== e && (i.uniform1ui(this.addr, e), t[0] = e);
}
-function $I(i, e) {
+function eS(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y) && (i.uniform2ui(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y);
@@ -20352,7 +20352,7 @@ function $I(i, e) {
i.uniform2uiv(this.addr, e), mn(t, e);
}
}
-function eS(i, e) {
+function tS(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (i.uniform3ui(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z);
@@ -20361,7 +20361,7 @@ function eS(i, e) {
i.uniform3uiv(this.addr, e), mn(t, e);
}
}
-function tS(i, e) {
+function nS(i, e) {
const t = this.cache;
if (e.x !== void 0)
(t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (i.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);
@@ -20370,74 +20370,74 @@ function tS(i, e) {
i.uniform4uiv(this.addr, e), mn(t, e);
}
}
-function nS(i, e, t) {
+function iS(i, e, t) {
const n = this.cache, s = t.allocateTextureUnit();
n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s);
let r;
- this.type === i.SAMPLER_2D_SHADOW ? (kA.compareFunction = C0, r = kA) : r = Z0, t.setTexture2D(e || r, s);
-}
-function iS(i, e, t) {
- const n = this.cache, s = t.allocateTextureUnit();
- n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture3D(e || ex, s);
+ this.type === i.SAMPLER_2D_SHADOW ? (OA.compareFunction = I0, r = OA) : r = $0, t.setTexture2D(e || r, s);
}
function sS(i, e, t) {
const n = this.cache, s = t.allocateTextureUnit();
- n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTextureCube(e || tx, s);
+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture3D(e || tx, s);
}
function rS(i, e, t) {
const n = this.cache, s = t.allocateTextureUnit();
- n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture2DArray(e || $0, s);
+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTextureCube(e || nx, s);
+}
+function aS(i, e, t) {
+ const n = this.cache, s = t.allocateTextureUnit();
+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture2DArray(e || ex, s);
}
-function aS(i) {
+function oS(i) {
switch (i) {
case 5126:
- return GI;
+ return HI;
// FLOAT
case 35664:
- return HI;
+ return zI;
// _VEC2
case 35665:
- return zI;
+ return VI;
// _VEC3
case 35666:
- return VI;
+ return WI;
// _VEC4
case 35674:
- return WI;
+ return qI;
// _MAT2
case 35675:
- return qI;
+ return KI;
// _MAT3
case 35676:
- return KI;
+ return jI;
// _MAT4
case 5124:
case 35670:
- return jI;
+ return XI;
// INT, BOOL
case 35667:
case 35671:
- return XI;
+ return YI;
// _VEC2
case 35668:
case 35672:
- return YI;
+ return JI;
// _VEC3
case 35669:
case 35673:
- return JI;
+ return ZI;
// _VEC4
case 5125:
- return ZI;
+ return $I;
// UINT
case 36294:
- return $I;
+ return eS;
// _VEC2
case 36295:
- return eS;
+ return tS;
// _VEC3
case 36296:
- return tS;
+ return nS;
// _VEC4
case 35678:
// SAMPLER_2D
@@ -20448,13 +20448,13 @@ function aS(i) {
case 36306:
// UNSIGNED_INT_SAMPLER_2D
case 35682:
- return nS;
+ return iS;
case 35679:
// SAMPLER_3D
case 36299:
// INT_SAMPLER_3D
case 36307:
- return iS;
+ return sS;
case 35680:
// SAMPLER_CUBE
case 36300:
@@ -20462,7 +20462,7 @@ function aS(i) {
case 36308:
// UNSIGNED_INT_SAMPLER_CUBE
case 36293:
- return sS;
+ return rS;
case 36289:
// SAMPLER_2D_ARRAY
case 36303:
@@ -20470,134 +20470,134 @@ function aS(i) {
case 36311:
// UNSIGNED_INT_SAMPLER_2D_ARRAY
case 36292:
- return rS;
+ return aS;
}
}
-function oS(i, e) {
+function cS(i, e) {
i.uniform1fv(this.addr, e);
}
-function cS(i, e) {
- const t = Xa(e, this.size, 2);
+function lS(i, e) {
+ const t = Ya(e, this.size, 2);
i.uniform2fv(this.addr, t);
}
-function lS(i, e) {
- const t = Xa(e, this.size, 3);
+function hS(i, e) {
+ const t = Ya(e, this.size, 3);
i.uniform3fv(this.addr, t);
}
-function hS(i, e) {
- const t = Xa(e, this.size, 4);
+function uS(i, e) {
+ const t = Ya(e, this.size, 4);
i.uniform4fv(this.addr, t);
}
-function uS(i, e) {
- const t = Xa(e, this.size, 4);
+function dS(i, e) {
+ const t = Ya(e, this.size, 4);
i.uniformMatrix2fv(this.addr, !1, t);
}
-function dS(i, e) {
- const t = Xa(e, this.size, 9);
+function fS(i, e) {
+ const t = Ya(e, this.size, 9);
i.uniformMatrix3fv(this.addr, !1, t);
}
-function fS(i, e) {
- const t = Xa(e, this.size, 16);
+function pS(i, e) {
+ const t = Ya(e, this.size, 16);
i.uniformMatrix4fv(this.addr, !1, t);
}
-function pS(i, e) {
+function AS(i, e) {
i.uniform1iv(this.addr, e);
}
-function AS(i, e) {
+function gS(i, e) {
i.uniform2iv(this.addr, e);
}
-function gS(i, e) {
+function mS(i, e) {
i.uniform3iv(this.addr, e);
}
-function mS(i, e) {
+function xS(i, e) {
i.uniform4iv(this.addr, e);
}
-function xS(i, e) {
+function bS(i, e) {
i.uniform1uiv(this.addr, e);
}
-function bS(i, e) {
+function ES(i, e) {
i.uniform2uiv(this.addr, e);
}
-function ES(i, e) {
+function yS(i, e) {
i.uniform3uiv(this.addr, e);
}
-function yS(i, e) {
+function _S(i, e) {
i.uniform4uiv(this.addr, e);
}
-function _S(i, e, t) {
- const n = this.cache, s = e.length, r = bh(t, s);
- gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
- for (let a = 0; a !== s; ++a)
- t.setTexture2D(e[a] || Z0, r[a]);
-}
function wS(i, e, t) {
- const n = this.cache, s = e.length, r = bh(t, s);
+ const n = this.cache, s = e.length, r = yh(t, s);
gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
for (let a = 0; a !== s; ++a)
- t.setTexture3D(e[a] || ex, r[a]);
+ t.setTexture2D(e[a] || $0, r[a]);
}
function vS(i, e, t) {
- const n = this.cache, s = e.length, r = bh(t, s);
+ const n = this.cache, s = e.length, r = yh(t, s);
gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
for (let a = 0; a !== s; ++a)
- t.setTextureCube(e[a] || tx, r[a]);
+ t.setTexture3D(e[a] || tx, r[a]);
}
function CS(i, e, t) {
- const n = this.cache, s = e.length, r = bh(t, s);
+ const n = this.cache, s = e.length, r = yh(t, s);
+ gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
+ for (let a = 0; a !== s; ++a)
+ t.setTextureCube(e[a] || nx, r[a]);
+}
+function IS(i, e, t) {
+ const n = this.cache, s = e.length, r = yh(t, s);
gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
for (let a = 0; a !== s; ++a)
- t.setTexture2DArray(e[a] || $0, r[a]);
+ t.setTexture2DArray(e[a] || ex, r[a]);
}
-function IS(i) {
+function SS(i) {
switch (i) {
case 5126:
- return oS;
+ return cS;
// FLOAT
case 35664:
- return cS;
+ return lS;
// _VEC2
case 35665:
- return lS;
+ return hS;
// _VEC3
case 35666:
- return hS;
+ return uS;
// _VEC4
case 35674:
- return uS;
+ return dS;
// _MAT2
case 35675:
- return dS;
+ return fS;
// _MAT3
case 35676:
- return fS;
+ return pS;
// _MAT4
case 5124:
case 35670:
- return pS;
+ return AS;
// INT, BOOL
case 35667:
case 35671:
- return AS;
+ return gS;
// _VEC2
case 35668:
case 35672:
- return gS;
+ return mS;
// _VEC3
case 35669:
case 35673:
- return mS;
+ return xS;
// _VEC4
case 5125:
- return xS;
+ return bS;
// UINT
case 36294:
- return bS;
+ return ES;
// _VEC2
case 36295:
- return ES;
+ return yS;
// _VEC3
case 36296:
- return yS;
+ return _S;
// _VEC4
case 35678:
// SAMPLER_2D
@@ -20608,13 +20608,13 @@ function IS(i) {
case 36306:
// UNSIGNED_INT_SAMPLER_2D
case 35682:
- return _S;
+ return wS;
case 35679:
// SAMPLER_3D
case 36299:
// INT_SAMPLER_3D
case 36307:
- return wS;
+ return vS;
case 35680:
// SAMPLER_CUBE
case 36300:
@@ -20622,7 +20622,7 @@ function IS(i) {
case 36308:
// UNSIGNED_INT_SAMPLER_CUBE
case 36293:
- return vS;
+ return CS;
case 36289:
// SAMPLER_2D_ARRAY
case 36303:
@@ -20630,20 +20630,20 @@ function IS(i) {
case 36311:
// UNSIGNED_INT_SAMPLER_2D_ARRAY
case 36292:
- return CS;
+ return IS;
}
}
-class SS {
+class MS {
constructor(e, t, n) {
- this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.setValue = aS(t.type);
+ this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.setValue = oS(t.type);
}
}
-class MS {
+class BS {
constructor(e, t, n) {
- this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = IS(t.type);
+ this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = SS(t.type);
}
}
-class BS {
+class TS {
constructor(e) {
this.id = e, this.seq = [], this.map = {};
}
@@ -20655,32 +20655,32 @@ class BS {
}
}
}
-const bu = /(\w+)(\])?(\[|\.)?/g;
-function zA(i, e) {
+const yu = /(\w+)(\])?(\[|\.)?/g;
+function WA(i, e) {
i.seq.push(e), i.map[e.id] = e;
}
-function TS(i, e, t) {
+function RS(i, e, t) {
const n = i.name, s = n.length;
- for (bu.lastIndex = 0; ; ) {
- const r = bu.exec(n), a = bu.lastIndex;
+ for (yu.lastIndex = 0; ; ) {
+ const r = yu.exec(n), a = yu.lastIndex;
let o = r[1];
const c = r[2] === "]", l = r[3];
if (c && (o = o | 0), l === void 0 || l === "[" && a + 2 === s) {
- zA(t, l === void 0 ? new SS(o, i, e) : new MS(o, i, e));
+ WA(t, l === void 0 ? new MS(o, i, e) : new BS(o, i, e));
break;
} else {
let u = t.map[o];
- u === void 0 && (u = new BS(o), zA(t, u)), t = u;
+ u === void 0 && (u = new TS(o), WA(t, u)), t = u;
}
}
}
-class Ml {
+class Tl {
constructor(e, t) {
this.seq = [], this.map = {};
const n = e.getProgramParameter(t, e.ACTIVE_UNIFORMS);
for (let s = 0; s < n; ++s) {
const r = e.getActiveUniform(t, s), a = e.getUniformLocation(t, r.name);
- TS(r, a, this);
+ RS(r, a, this);
}
}
setValue(e, t, n, s) {
@@ -20706,13 +20706,13 @@ class Ml {
return n;
}
}
-function VA(i, e, t) {
+function qA(i, e, t) {
const n = i.createShader(e);
return i.shaderSource(n, t), i.compileShader(n), n;
}
-const RS = 37297;
-let FS = 0;
-function NS(i, e) {
+const FS = 37297;
+let NS = 0;
+function DS(i, e) {
const t = i.split(`
`), n = [], s = Math.max(e - 6, 0), r = Math.min(e + 6, t.length);
for (let a = s; a < r; a++) {
@@ -20722,12 +20722,12 @@ function NS(i, e) {
return n.join(`
`);
}
-const WA = /* @__PURE__ */ new at();
-function DS(i) {
- rt._getMatrix(WA, rt.workingColorSpace, i);
- const e = `mat3( ${WA.elements.map((t) => t.toFixed(4))} )`;
+const KA = /* @__PURE__ */ new at();
+function LS(i) {
+ rt._getMatrix(KA, rt.workingColorSpace, i);
+ const e = `mat3( ${KA.elements.map((t) => t.toFixed(4))} )`;
switch (rt.getTransfer(i)) {
- case zl:
+ case Wl:
return [e, "LinearTransferOETF"];
case Rt:
return [e, "sRGBTransferOETF"];
@@ -20735,7 +20735,7 @@ function DS(i) {
return console.warn("THREE.WebGLProgram: Unsupported color space: ", i), [e, "LinearTransferOETF"];
}
}
-function qA(i, e, t) {
+function jA(i, e, t) {
const n = i.getShaderParameter(e, i.COMPILE_STATUS), s = i.getShaderInfoLog(e).trim();
if (n && s === "") return "";
const r = /ERROR: 0:(\d+)/.exec(s);
@@ -20745,12 +20745,12 @@ function qA(i, e, t) {
` + s + `
-` + NS(i.getShaderSource(e), a);
+` + DS(i.getShaderSource(e), a);
} else
return s;
}
-function LS(i, e) {
- const t = DS(e);
+function PS(i, e) {
+ const t = LS(e);
return [
`vec4 ${i}( vec4 value ) {`,
` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,
@@ -20758,28 +20758,28 @@ function LS(i, e) {
].join(`
`);
}
-function PS(i, e) {
+function kS(i, e) {
let t;
switch (e) {
- case xd:
+ case Ed:
t = "Linear";
break;
- case _y:
+ case wy:
t = "Reinhard";
break;
- case wy:
+ case vy:
t = "Cineon";
break;
- case f0:
+ case p0:
t = "ACESFilmic";
break;
- case Cy:
+ case Iy:
t = "AgX";
break;
- case Iy:
+ case Sy:
t = "Neutral";
break;
- case vy:
+ case Cy:
t = "Custom";
break;
default:
@@ -20787,10 +20787,10 @@ function PS(i, e) {
}
return "vec3 " + i + "( vec3 color ) { return " + t + "ToneMapping( color ); }";
}
-const nl = /* @__PURE__ */ new G();
-function kS() {
- rt.getLuminanceCoefficients(nl);
- const i = nl.x.toFixed(4), e = nl.y.toFixed(4), t = nl.z.toFixed(4);
+const il = /* @__PURE__ */ new G();
+function US() {
+ rt.getLuminanceCoefficients(il);
+ const i = il.x.toFixed(4), e = il.y.toFixed(4), t = il.z.toFixed(4);
return [
"float luminance( const in vec3 rgb ) {",
` const vec3 weights = vec3( ${i}, ${e}, ${t} );`,
@@ -20799,14 +20799,14 @@ function kS() {
].join(`
`);
}
-function US(i) {
+function OS(i) {
return [
i.extensionClipCullDistance ? "#extension GL_ANGLE_clip_cull_distance : require" : "",
i.extensionMultiDraw ? "#extension GL_ANGLE_multi_draw : require" : ""
- ].filter(wo).join(`
+ ].filter(vo).join(`
`);
}
-function OS(i) {
+function QS(i) {
const e = [];
for (const t in i) {
const n = i[t];
@@ -20815,7 +20815,7 @@ function OS(i) {
return e.join(`
`);
}
-function QS(i, e) {
+function GS(i, e) {
const t = {}, n = i.getProgramParameter(e, i.ACTIVE_ATTRIBUTES);
for (let s = 0; s < n; s++) {
const r = i.getActiveAttrib(e, s), a = r.name;
@@ -20828,43 +20828,43 @@ function QS(i, e) {
}
return t;
}
-function wo(i) {
+function vo(i) {
return i !== "";
}
-function KA(i, e) {
+function XA(i, e) {
const t = e.numSpotLightShadows + e.numSpotLightMaps - e.numSpotLightShadowsWithMaps;
return i.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 jA(i, e) {
+function YA(i, e) {
return i.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection);
}
-const GS = /^[ \t]*#include +<([\w\d./]+)>/gm;
-function qd(i) {
- return i.replace(GS, zS);
+const HS = /^[ \t]*#include +<([\w\d./]+)>/gm;
+function jd(i) {
+ return i.replace(HS, VS);
}
-const HS = /* @__PURE__ */ new Map();
-function zS(i, e) {
+const zS = /* @__PURE__ */ new Map();
+function VS(i, e) {
let t = lt[e];
if (t === void 0) {
- const n = HS.get(e);
+ const n = zS.get(e);
if (n !== void 0)
t = lt[n], console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', e, n);
else
throw new Error("Can not resolve #include <" + e + ">");
}
- return qd(t);
+ return jd(t);
}
-const VS = /#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 XA(i) {
- return i.replace(VS, WS);
+const WS = /#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 JA(i) {
+ return i.replace(WS, qS);
}
-function WS(i, e, t, n) {
+function qS(i, e, t, n) {
let s = "";
for (let r = parseInt(e); r < parseInt(t); r++)
s += n.replace(/\[\s*i\s*\]/g, "[ " + r + " ]").replace(/UNROLLED_LOOP_INDEX/g, r);
return s;
}
-function YA(i) {
+function ZA(i) {
let e = `precision ${i.precision} float;
precision ${i.precision} int;
precision ${i.precision} sampler2D;
@@ -20888,70 +20888,70 @@ function YA(i) {
#define MEDIUM_PRECISION` : i.precision === "lowp" && (e += `
#define LOW_PRECISION`), e;
}
-function qS(i) {
+function KS(i) {
let e = "SHADOWMAP_TYPE_BASIC";
- return i.shadowMapType === d0 ? e = "SHADOWMAP_TYPE_PCF" : i.shadowMapType === ty ? e = "SHADOWMAP_TYPE_PCF_SOFT" : i.shadowMapType === $i && (e = "SHADOWMAP_TYPE_VSM"), e;
+ return i.shadowMapType === f0 ? e = "SHADOWMAP_TYPE_PCF" : i.shadowMapType === ny ? e = "SHADOWMAP_TYPE_PCF_SOFT" : i.shadowMapType === es && (e = "SHADOWMAP_TYPE_VSM"), e;
}
-function KS(i) {
+function jS(i) {
let e = "ENVMAP_TYPE_CUBE";
if (i.envMap)
switch (i.envMapMode) {
case Br:
- case Da:
+ case La:
e = "ENVMAP_TYPE_CUBE";
break;
- case uh:
+ case fh:
e = "ENVMAP_TYPE_CUBE_UV";
break;
}
return e;
}
-function jS(i) {
+function XS(i) {
let e = "ENVMAP_MODE_REFLECTION";
- return i.envMap && i.envMapMode === Da && (e = "ENVMAP_MODE_REFRACTION"), e;
+ return i.envMap && i.envMapMode === La && (e = "ENVMAP_MODE_REFRACTION"), e;
}
-function XS(i) {
+function YS(i) {
let e = "ENVMAP_BLENDING_NONE";
if (i.envMap)
switch (i.combine) {
- case hh:
+ case dh:
e = "ENVMAP_BLENDING_MULTIPLY";
break;
- case Ey:
+ case yy:
e = "ENVMAP_BLENDING_MIX";
break;
- case yy:
+ case _y:
e = "ENVMAP_BLENDING_ADD";
break;
}
return e;
}
-function YS(i) {
+function JS(i) {
const e = i.envMapCubeUVHeight;
if (e === null) return null;
const t = Math.log2(e) - 2, n = 1 / e;
return { texelWidth: 1 / (3 * Math.max(Math.pow(2, t), 112)), texelHeight: n, maxMip: t };
}
-function JS(i, e, t, n) {
+function ZS(i, e, t, n) {
const s = i.getContext(), r = t.defines;
let a = t.vertexShader, o = t.fragmentShader;
- const c = qS(t), l = KS(t), h = jS(t), u = XS(t), d = YS(t), f = US(t), p = OS(r), m = s.createProgram();
+ const c = KS(t), l = jS(t), h = XS(t), u = YS(t), d = JS(t), f = OS(t), p = QS(r), m = s.createProgram();
let g, A, _ = t.glslVersion ? "#version " + t.glslVersion + `
` : "";
t.isRawShaderMaterial ? (g = [
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
p
- ].filter(wo).join(`
+ ].filter(vo).join(`
`), g.length > 0 && (g += `
`), A = [
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
p
- ].filter(wo).join(`
+ ].filter(vo).join(`
`), A.length > 0 && (A += `
`)) : (g = [
- YA(t),
+ ZA(t),
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
p,
@@ -21082,9 +21082,9 @@ function JS(i, e, t, n) {
"#endif",
`
`
- ].filter(wo).join(`
+ ].filter(vo).join(`
`), A = [
- YA(t),
+ ZA(t),
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
p,
@@ -21156,18 +21156,18 @@ function JS(i, e, t, n) {
t.toneMapping !== Hs ? "#define TONE_MAPPING" : "",
t.toneMapping !== Hs ? lt.tonemapping_pars_fragment : "",
// this code is required here because it is used by the toneMapping() function defined below
- t.toneMapping !== Hs ? PS("toneMapping", t.toneMapping) : "",
+ t.toneMapping !== Hs ? kS("toneMapping", t.toneMapping) : "",
t.dithering ? "#define DITHERING" : "",
t.opaque ? "#define OPAQUE" : "",
lt.colorspace_pars_fragment,
// this code is required here because it is used by the various encoding/decoding function defined below
- LS("linearToOutputTexel", t.outputColorSpace),
- kS(),
+ PS("linearToOutputTexel", t.outputColorSpace),
+ US(),
t.useDepthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "",
`
`
- ].filter(wo).join(`
-`)), a = qd(a), a = KA(a, t), a = jA(a, t), o = qd(o), o = KA(o, t), o = jA(o, t), a = XA(a), o = XA(o), t.isRawShaderMaterial !== !0 && (_ = `#version 300 es
+ ].filter(vo).join(`
+`)), a = jd(a), a = XA(a, t), a = YA(a, t), o = jd(o), o = XA(o, t), o = YA(o, t), a = JA(a), o = JA(o), t.isRawShaderMaterial !== !0 && (_ = `#version 300 es
`, g = [
f,
"#define attribute in",
@@ -21177,8 +21177,8 @@ function JS(i, e, t, n) {
`) + `
` + g, A = [
"#define varying in",
- t.glslVersion === Gp ? "" : "layout(location = 0) out highp vec4 pc_fragColor;",
- t.glslVersion === Gp ? "" : "#define gl_FragColor pc_fragColor",
+ t.glslVersion === zp ? "" : "layout(location = 0) out highp vec4 pc_fragColor;",
+ t.glslVersion === zp ? "" : "#define gl_FragColor pc_fragColor",
"#define gl_FragDepthEXT gl_FragDepth",
"#define texture2D texture",
"#define textureCube texture",
@@ -21192,7 +21192,7 @@ function JS(i, e, t, n) {
].join(`
`) + `
` + A);
- const x = _ + g + a, E = _ + A + o, S = VA(s, s.VERTEX_SHADER, x), w = VA(s, s.FRAGMENT_SHADER, E);
+ const x = _ + g + a, E = _ + A + o, S = qA(s, s.VERTEX_SHADER, x), w = qA(s, s.FRAGMENT_SHADER, E);
s.attachShader(m, S), s.attachShader(m, w), t.index0AttributeName !== void 0 ? s.bindAttribLocation(m, 0, t.index0AttributeName) : t.morphTargets === !0 && s.bindAttribLocation(m, 0, "position"), s.linkProgram(m);
function I(F) {
if (i.debug.checkShaderErrors) {
@@ -21202,7 +21202,7 @@ function JS(i, e, t, n) {
if (D = !1, typeof i.debug.onShaderError == "function")
i.debug.onShaderError(s, m, S, w);
else {
- const Y = qA(s, S, "vertex"), Q = qA(s, w, "fragment");
+ const Y = jA(s, S, "vertex"), Q = jA(s, w, "fragment");
console.error(
"THREE.WebGLProgram: Shader Error " + s.getError() + " - VALIDATE_STATUS " + s.getProgramParameter(m, s.VALIDATE_STATUS) + `
@@ -21228,7 +21228,7 @@ Program Info Log: ` + K + `
}
});
}
- s.deleteShader(S), s.deleteShader(w), T = new Ml(s, m), C = QS(s, m);
+ s.deleteShader(S), s.deleteShader(w), T = new Tl(s, m), C = GS(s, m);
}
let T;
this.getUniforms = function() {
@@ -21240,13 +21240,13 @@ Program Info Log: ` + K + `
};
let v = t.rendererExtensionParallelShaderCompile === !1;
return this.isReady = function() {
- return v === !1 && (v = s.getProgramParameter(m, RS)), v;
+ return v === !1 && (v = s.getProgramParameter(m, FS)), v;
}, this.destroy = function() {
n.releaseStatesOfProgram(this), s.deleteProgram(m), this.program = void 0;
- }, this.type = t.shaderType, this.name = t.shaderName, this.id = FS++, this.cacheKey = e, this.usedTimes = 1, this.program = m, this.vertexShader = S, this.fragmentShader = w, this;
+ }, this.type = t.shaderType, this.name = t.shaderName, this.id = NS++, this.cacheKey = e, this.usedTimes = 1, this.program = m, this.vertexShader = S, this.fragmentShader = w, this;
}
-let ZS = 0;
-class $S {
+let $S = 0;
+class e1 {
constructor() {
this.shaderCache = /* @__PURE__ */ new Map(), this.materialCache = /* @__PURE__ */ new Map();
}
@@ -21277,16 +21277,16 @@ class $S {
_getShaderStage(e) {
const t = this.shaderCache;
let n = t.get(e);
- return n === void 0 && (n = new e1(e), t.set(e, n)), n;
+ return n === void 0 && (n = new t1(e), t.set(e, n)), n;
}
}
-class e1 {
+class t1 {
constructor(e) {
- this.id = ZS++, this.code = e, this.usedTimes = 0;
+ this.id = $S++, this.code = e, this.usedTimes = 0;
}
}
-function t1(i, e, t, n, s, r, a) {
- const o = new B0(), c = new $S(), l = /* @__PURE__ */ new Set(), h = [], u = s.logarithmicDepthBuffer, d = s.vertexTextures;
+function n1(i, e, t, n, s, r, a) {
+ const o = new T0(), c = new e1(), l = /* @__PURE__ */ new Set(), h = [], u = s.logarithmicDepthBuffer, d = s.vertexTextures;
let f = s.precision;
const p = {
MeshDepthMaterial: "depth",
@@ -21309,14 +21309,14 @@ function t1(i, e, t, n, s, r, a) {
return l.add(C), C === 0 ? "uv" : `uv${C}`;
}
function g(C, v, F, K, q) {
- const $ = K.fog, D = q.geometry, O = C.isMeshStandardMaterial ? K.environment : null, Y = (C.isMeshStandardMaterial ? t : e).get(C.envMap || O), Q = Y && Y.mapping === uh ? Y.image.height : null, J = p[C.type];
+ const $ = K.fog, D = q.geometry, O = C.isMeshStandardMaterial ? K.environment : null, Y = (C.isMeshStandardMaterial ? t : e).get(C.envMap || O), Q = Y && Y.mapping === fh ? Y.image.height : null, J = p[C.type];
C.precision !== null && (f = s.getMaxPrecision(C.precision), f !== C.precision && console.warn("THREE.WebGLProgram.getParameters:", C.precision, "not supported, using", f, "instead."));
const ee = D.morphAttributes.position || D.morphAttributes.normal || D.morphAttributes.color, ae = ee !== void 0 ? ee.length : 0;
let _e = 0;
D.morphAttributes.position !== void 0 && (_e = 1), D.morphAttributes.normal !== void 0 && (_e = 2), D.morphAttributes.color !== void 0 && (_e = 3);
let Me, se, me, xe;
if (J) {
- const Ct = ki[J];
+ const Ct = Ui[J];
Me = Ct.vertexShader, se = Ct.fragmentShader;
} else
Me = C.vertexShader, se = C.fragmentShader, c.update(C), me = c.getVertexShaderID(C), xe = c.getFragmentShaderID(C);
@@ -21354,8 +21354,8 @@ function t1(i, e, t, n, s, r, a) {
normalMap: gt,
displacementMap: d && We,
emissiveMap: Dt,
- normalMapObjectSpace: gt && C.normalMapType === Ny,
- normalMapTangentSpace: gt && C.normalMapType === dh,
+ normalMapObjectSpace: gt && C.normalMapType === Dy,
+ normalMapTangentSpace: gt && C.normalMapType === ph,
metalnessMap: ze,
roughnessMap: L,
anisotropy: M,
@@ -21378,7 +21378,7 @@ function t1(i, e, t, n, s, r, a) {
transmissionMap: W,
thicknessMap: ne,
gradientMap: re,
- opaque: C.transparent === !1 && C.blending === va && C.alphaToCoverage === !1,
+ opaque: C.transparent === !1 && C.blending === Ca && C.alphaToCoverage === !1,
alphaMap: de,
alphaTest: Se,
alphaHash: Ce,
@@ -21445,8 +21445,8 @@ function t1(i, e, t, n, s, r, a) {
decodeVideoTexture: St && C.map.isVideoTexture === !0 && rt.getTransfer(C.map.colorSpace) === Rt,
decodeVideoTextureEmissive: Dt && C.emissiveMap.isVideoTexture === !0 && rt.getTransfer(C.emissiveMap.colorSpace) === Rt,
premultipliedAlpha: C.premultipliedAlpha,
- doubleSided: C.side === Ui,
- flipSided: C.side === Vn,
+ doubleSided: C.side === Oi,
+ flipSided: C.side === Wn,
useDepthPacking: C.depthPacking >= 0,
depthPacking: C.depthPacking || 0,
index0AttributeName: C.index0AttributeName,
@@ -21474,8 +21474,8 @@ function t1(i, e, t, n, s, r, a) {
const v = p[C.type];
let F;
if (v) {
- const K = ki[v];
- F = S_.clone(K.uniforms);
+ const K = Ui[v];
+ F = M_.clone(K.uniforms);
} else
F = C.uniforms;
return F;
@@ -21489,7 +21489,7 @@ function t1(i, e, t, n, s, r, a) {
break;
}
}
- return F === void 0 && (F = new JS(i, v, C, r), h.push(F)), F;
+ return F === void 0 && (F = new ZS(i, v, C, r), h.push(F)), F;
}
function w(C) {
if (--C.usedTimes === 0) {
@@ -21515,7 +21515,7 @@ function t1(i, e, t, n, s, r, a) {
dispose: T
};
}
-function n1() {
+function i1() {
let i = /* @__PURE__ */ new WeakMap();
function e(a) {
return i.has(a);
@@ -21541,13 +21541,13 @@ function n1() {
dispose: r
};
}
-function i1(i, e) {
+function s1(i, e) {
return i.groupOrder !== e.groupOrder ? i.groupOrder - e.groupOrder : i.renderOrder !== e.renderOrder ? i.renderOrder - e.renderOrder : i.material.id !== e.material.id ? i.material.id - e.material.id : i.z !== e.z ? i.z - e.z : i.id - e.id;
}
-function JA(i, e) {
+function $A(i, e) {
return i.groupOrder !== e.groupOrder ? i.groupOrder - e.groupOrder : i.renderOrder !== e.renderOrder ? i.renderOrder - e.renderOrder : i.z !== e.z ? e.z - i.z : i.id - e.id;
}
-function ZA() {
+function eg() {
const i = [];
let e = 0;
const t = [], n = [], s = [];
@@ -21576,7 +21576,7 @@ function ZA() {
f.transmission > 0 ? n.unshift(A) : f.transparent === !0 ? s.unshift(A) : t.unshift(A);
}
function l(u, d) {
- t.length > 1 && t.sort(u || i1), n.length > 1 && n.sort(d || JA), s.length > 1 && s.sort(d || JA);
+ t.length > 1 && t.sort(u || s1), n.length > 1 && n.sort(d || $A), s.length > 1 && s.sort(d || $A);
}
function h() {
for (let u = e, d = i.length; u < d; u++) {
@@ -21596,12 +21596,12 @@ function ZA() {
sort: l
};
}
-function s1() {
+function r1() {
let i = /* @__PURE__ */ new WeakMap();
function e(n, s) {
const r = i.get(n);
let a;
- return r === void 0 ? (a = new ZA(), i.set(n, [a])) : s >= r.length ? (a = new ZA(), r.push(a)) : a = r[s], a;
+ return r === void 0 ? (a = new eg(), i.set(n, [a])) : s >= r.length ? (a = new eg(), r.push(a)) : a = r[s], a;
}
function t() {
i = /* @__PURE__ */ new WeakMap();
@@ -21611,7 +21611,7 @@ function s1() {
dispose: t
};
}
-function r1() {
+function a1() {
const i = {};
return {
get: function(e) {
@@ -21664,7 +21664,7 @@ function r1() {
}
};
}
-function a1() {
+function o1() {
const i = {};
return {
get: function(e) {
@@ -21706,12 +21706,12 @@ function a1() {
}
};
}
-let o1 = 0;
-function c1(i, e) {
+let c1 = 0;
+function l1(i, e) {
return (e.castShadow ? 2 : 0) - (i.castShadow ? 2 : 0) + (e.map ? 1 : 0) - (i.map ? 1 : 0);
}
-function l1(i) {
- const e = new r1(), t = a1(), n = {
+function h1(i) {
+ const e = new a1(), t = o1(), n = {
version: 0,
hash: {
directionalLength: -1,
@@ -21753,7 +21753,7 @@ function l1(i) {
let h = 0, u = 0, d = 0;
for (let C = 0; C < 9; C++) n.probe[C].set(0, 0, 0);
let f = 0, p = 0, m = 0, g = 0, A = 0, _ = 0, x = 0, E = 0, S = 0, w = 0, I = 0;
- l.sort(c1);
+ l.sort(l1);
for (let C = 0, v = l.length; C < v; C++) {
const F = l[C], K = F.color, q = F.intensity, $ = F.distance, D = F.shadow && F.shadow.map ? F.shadow.map.texture : null;
if (F.isAmbientLight)
@@ -21795,7 +21795,7 @@ function l1(i) {
}
g > 0 && (i.has("OES_texture_float_linear") === !0 ? (n.rectAreaLTC1 = we.LTC_FLOAT_1, n.rectAreaLTC2 = we.LTC_FLOAT_2) : (n.rectAreaLTC1 = we.LTC_HALF_1, n.rectAreaLTC2 = we.LTC_HALF_2)), n.ambient[0] = h, n.ambient[1] = u, n.ambient[2] = d;
const T = n.hash;
- (T.directionalLength !== f || T.pointLength !== p || T.spotLength !== m || T.rectAreaLength !== g || T.hemiLength !== A || T.numDirectionalShadows !== _ || T.numPointShadows !== x || T.numSpotShadows !== E || T.numSpotMaps !== S || T.numLightProbes !== I) && (n.directional.length = f, n.spot.length = m, n.rectArea.length = g, n.point.length = p, n.hemi.length = A, n.directionalShadow.length = _, n.directionalShadowMap.length = _, n.pointShadow.length = x, n.pointShadowMap.length = x, n.spotShadow.length = E, n.spotShadowMap.length = E, n.directionalShadowMatrix.length = _, n.pointShadowMatrix.length = x, n.spotLightMatrix.length = E + S - w, n.spotLightMap.length = S, n.numSpotLightShadowsWithMaps = w, n.numLightProbes = I, T.directionalLength = f, T.pointLength = p, T.spotLength = m, T.rectAreaLength = g, T.hemiLength = A, T.numDirectionalShadows = _, T.numPointShadows = x, T.numSpotShadows = E, T.numSpotMaps = S, T.numLightProbes = I, n.version = o1++);
+ (T.directionalLength !== f || T.pointLength !== p || T.spotLength !== m || T.rectAreaLength !== g || T.hemiLength !== A || T.numDirectionalShadows !== _ || T.numPointShadows !== x || T.numSpotShadows !== E || T.numSpotMaps !== S || T.numLightProbes !== I) && (n.directional.length = f, n.spot.length = m, n.rectArea.length = g, n.point.length = p, n.hemi.length = A, n.directionalShadow.length = _, n.directionalShadowMap.length = _, n.pointShadow.length = x, n.pointShadowMap.length = x, n.spotShadow.length = E, n.spotShadowMap.length = E, n.directionalShadowMatrix.length = _, n.pointShadowMatrix.length = x, n.spotLightMatrix.length = E + S - w, n.spotLightMap.length = S, n.numSpotLightShadowsWithMaps = w, n.numLightProbes = I, T.directionalLength = f, T.pointLength = p, T.spotLength = m, T.rectAreaLength = g, T.hemiLength = A, T.numDirectionalShadows = _, T.numPointShadows = x, T.numSpotShadows = E, T.numSpotMaps = S, T.numLightProbes = I, n.version = c1++);
}
function c(l, h) {
let u = 0, d = 0, f = 0, p = 0, m = 0;
@@ -21826,8 +21826,8 @@ function l1(i) {
state: n
};
}
-function $A(i) {
- const e = new l1(i), t = [], n = [];
+function tg(i) {
+ const e = new h1(i), t = [], n = [];
function s(h) {
l.camera = h, t.length = 0, n.length = 0;
}
@@ -21859,12 +21859,12 @@ function $A(i) {
pushShadow: a
};
}
-function h1(i) {
+function u1(i) {
let e = /* @__PURE__ */ new WeakMap();
function t(s, r = 0) {
const a = e.get(s);
let o;
- return a === void 0 ? (o = new $A(i), e.set(s, [o])) : r >= a.length ? (o = new $A(i), a.push(o)) : o = a[r], o;
+ return a === void 0 ? (o = new tg(i), e.set(s, [o])) : r >= a.length ? (o = new tg(i), a.push(o)) : o = a[r], o;
}
function n() {
e = /* @__PURE__ */ new WeakMap();
@@ -21874,9 +21874,9 @@ function h1(i) {
dispose: n
};
}
-const u1 = `void main() {
+const d1 = `void main() {
gl_Position = vec4( position, 1.0 );
-}`, d1 = `uniform sampler2D shadow_pass;
+}`, f1 = `uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
@@ -21903,9 +21903,9 @@ void main() {
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;
-function f1(i, e, t) {
- let n = new qf();
- const s = new Ze(), r = new Ze(), a = new mt(), o = new lw({ depthPacking: Fy }), c = new hw(), l = {}, h = t.maxTextureSize, u = { [bs]: Vn, [Vn]: bs, [Ui]: Ui }, d = new qs({
+function p1(i, e, t) {
+ let n = new jf();
+ const s = new Ze(), r = new Ze(), a = new mt(), o = new hw({ depthPacking: Ny }), c = new uw(), l = {}, h = t.maxTextureSize, u = { [bs]: Wn, [Wn]: bs, [Oi]: Oi }, d = new qs({
defines: {
VSM_SAMPLES: 8
},
@@ -21914,8 +21914,8 @@ function f1(i, e, t) {
resolution: { value: new Ze() },
radius: { value: 4 }
},
- vertexShader: u1,
- fragmentShader: d1
+ vertexShader: d1,
+ fragmentShader: f1
}), f = d.clone();
f.defines.HORIZONTAL_PASS = 1;
const p = new Tn();
@@ -21927,13 +21927,13 @@ function f1(i, e, t) {
)
);
const m = new Zt(p, d), g = this;
- this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = d0;
+ this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = f0;
let A = this.type;
this.render = function(w, I, T) {
if (g.enabled === !1 || g.autoUpdate === !1 && g.needsUpdate === !1 || w.length === 0) return;
const C = i.getRenderTarget(), v = i.getActiveCubeFace(), F = i.getActiveMipmapLevel(), K = i.state;
K.setBlending(Gs), K.buffers.color.setClear(1, 1, 1, 1), K.buffers.depth.setTest(!0), K.setScissorTest(!1);
- const q = A !== $i && this.type === $i, $ = A === $i && this.type !== $i;
+ const q = A !== es && this.type === es, $ = A === es && this.type !== es;
for (let D = 0, O = w.length; D < O; D++) {
const Y = w[D], Q = Y.shadow;
if (Q === void 0) {
@@ -21944,7 +21944,7 @@ function f1(i, e, t) {
s.copy(Q.mapSize);
const J = Q.getFrameExtents();
if (s.multiply(J), r.copy(Q.mapSize), (s.x > h || s.y > h) && (s.x > h && (r.x = Math.floor(h / J.x), s.x = r.x * J.x, Q.mapSize.x = r.x), s.y > h && (r.y = Math.floor(h / J.y), s.y = r.y * J.y, Q.mapSize.y = r.y)), Q.map === null || q === !0 || $ === !0) {
- const ae = this.type !== $i ? { minFilter: Wn, magFilter: Wn } : {};
+ const ae = this.type !== es ? { minFilter: qn, magFilter: qn } : {};
Q.map !== null && Q.map.dispose(), Q.map = new Rr(s.x, s.y, ae), Q.map.texture.name = Y.name + ".shadowMap", Q.camera.updateProjectionMatrix();
}
i.setRenderTarget(Q.map), i.clear();
@@ -21958,7 +21958,7 @@ function f1(i, e, t) {
r.y * _e.w
), K.viewport(a), Q.updateMatrices(Y, ae), n = Q.getFrustum(), E(I, T, Q.camera, Y, this.type);
}
- Q.isPointLightShadow !== !0 && this.type === $i && _(Q, T), Q.needsUpdate = !1;
+ Q.isPointLightShadow !== !0 && this.type === es && _(Q, T), Q.needsUpdate = !1;
}
A = this.type, g.needsUpdate = !1, i.setRenderTarget(C, v, F);
};
@@ -21978,7 +21978,7 @@ function f1(i, e, t) {
let D = $[q];
D === void 0 && (D = v.clone(), $[q] = D, I.addEventListener("dispose", S)), v = D;
}
- if (v.visible = I.visible, v.wireframe = I.wireframe, C === $i ? v.side = I.shadowSide !== null ? I.shadowSide : I.side : v.side = I.shadowSide !== null ? I.shadowSide : u[I.side], v.alphaMap = I.alphaMap, v.alphaTest = I.alphaToCoverage === !0 ? 0.5 : I.alphaTest, v.map = I.map, v.clipShadows = I.clipShadows, v.clippingPlanes = I.clippingPlanes, v.clipIntersection = I.clipIntersection, v.displacementMap = I.displacementMap, v.displacementScale = I.displacementScale, v.displacementBias = I.displacementBias, v.wireframeLinewidth = I.wireframeLinewidth, v.linewidth = I.linewidth, T.isPointLight === !0 && v.isMeshDistanceMaterial === !0) {
+ if (v.visible = I.visible, v.wireframe = I.wireframe, C === es ? v.side = I.shadowSide !== null ? I.shadowSide : I.side : v.side = I.shadowSide !== null ? I.shadowSide : u[I.side], v.alphaMap = I.alphaMap, v.alphaTest = I.alphaToCoverage === !0 ? 0.5 : I.alphaTest, v.map = I.map, v.clipShadows = I.clipShadows, v.clippingPlanes = I.clippingPlanes, v.clipIntersection = I.clipIntersection, v.displacementMap = I.displacementMap, v.displacementScale = I.displacementScale, v.displacementBias = I.displacementBias, v.wireframeLinewidth = I.wireframeLinewidth, v.linewidth = I.linewidth, T.isPointLight === !0 && v.isMeshDistanceMaterial === !0) {
const K = i.properties.get(v);
K.light = T;
}
@@ -21986,7 +21986,7 @@ function f1(i, e, t) {
}
function E(w, I, T, C, v) {
if (w.visible === !1) return;
- if (w.layers.test(I.layers) && (w.isMesh || w.isLine || w.isPoints) && (w.castShadow || w.receiveShadow && v === $i) && (!w.frustumCulled || n.intersectsObject(w))) {
+ if (w.layers.test(I.layers) && (w.isMesh || w.isLine || w.isPoints) && (w.castShadow || w.receiveShadow && v === es) && (!w.frustumCulled || n.intersectsObject(w))) {
w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse, w.matrixWorld);
const q = e.update(w), $ = w.material;
if (Array.isArray($)) {
@@ -22015,17 +22015,17 @@ function f1(i, e, t) {
}
}
}
-const p1 = {
- [ud]: dd,
- [fd]: gd,
- [pd]: md,
- [Na]: Ad,
- [dd]: ud,
- [gd]: fd,
- [md]: pd,
- [Ad]: Na
+const A1 = {
+ [fd]: pd,
+ [Ad]: xd,
+ [gd]: bd,
+ [Da]: md,
+ [pd]: fd,
+ [xd]: Ad,
+ [bd]: gd,
+ [md]: Da
};
-function A1(i, e) {
+function g1(i, e) {
function t() {
let W = !1;
const ne = new mt();
@@ -22067,30 +22067,30 @@ function A1(i, e) {
re !== Ce && !W && (i.depthMask(Ce), re = Ce);
},
setFunc: function(Ce) {
- if (ne && (Ce = p1[Ce]), de !== Ce) {
+ if (ne && (Ce = A1[Ce]), de !== Ce) {
switch (Ce) {
- case ud:
+ case fd:
i.depthFunc(i.NEVER);
break;
- case dd:
+ case pd:
i.depthFunc(i.ALWAYS);
break;
- case fd:
+ case Ad:
i.depthFunc(i.LESS);
break;
- case Na:
+ case Da:
i.depthFunc(i.LEQUAL);
break;
- case pd:
+ case gd:
i.depthFunc(i.EQUAL);
break;
- case Ad:
+ case md:
i.depthFunc(i.GEQUAL);
break;
- case gd:
+ case xd:
i.depthFunc(i.GREATER);
break;
- case md:
+ case bd:
i.depthFunc(i.NOTEQUAL);
break;
default:
@@ -22119,11 +22119,11 @@ function A1(i, e) {
setMask: function(Ct) {
ne !== Ct && !W && (i.stencilMask(Ct), ne = Ct);
},
- setFunc: function(Ct, Yn, Ai) {
- (re !== Ct || de !== Yn || Se !== Ai) && (i.stencilFunc(Ct, Yn, Ai), re = Ct, de = Yn, Se = Ai);
+ setFunc: function(Ct, Jn, gi) {
+ (re !== Ct || de !== Jn || Se !== gi) && (i.stencilFunc(Ct, Jn, gi), re = Ct, de = Jn, Se = gi);
},
- setOp: function(Ct, Yn, Ai) {
- (Ce !== Ct || it !== Yn || Qt !== Ai) && (i.stencilOp(Ct, Yn, Ai), Ce = Ct, it = Yn, Qt = Ai);
+ setOp: function(Ct, Jn, gi) {
+ (Ce !== Ct || it !== Jn || Qt !== gi) && (i.stencilOp(Ct, Jn, gi), Ce = Ct, it = Jn, Qt = gi);
},
setLocked: function(Ct) {
W = Ct;
@@ -22152,7 +22152,7 @@ function A1(i, e) {
return Ce;
}
const xe = {};
- xe[i.TEXTURE_2D] = me(i.TEXTURE_2D, i.TEXTURE_2D, 1), xe[i.TEXTURE_CUBE_MAP] = me(i.TEXTURE_CUBE_MAP, i.TEXTURE_CUBE_MAP_POSITIVE_X, 6), xe[i.TEXTURE_2D_ARRAY] = me(i.TEXTURE_2D_ARRAY, i.TEXTURE_2D_ARRAY, 1, 1), xe[i.TEXTURE_3D] = me(i.TEXTURE_3D, i.TEXTURE_3D, 1, 1), r.setClear(0, 0, 0, 1), a.setClear(1), o.setClear(0), be(i.DEPTH_TEST), a.setFunc(Na), pt(!1), gt(Lp), be(i.CULL_FACE), H(Gs);
+ xe[i.TEXTURE_2D] = me(i.TEXTURE_2D, i.TEXTURE_2D, 1), xe[i.TEXTURE_CUBE_MAP] = me(i.TEXTURE_CUBE_MAP, i.TEXTURE_CUBE_MAP_POSITIVE_X, 6), xe[i.TEXTURE_2D_ARRAY] = me(i.TEXTURE_2D_ARRAY, i.TEXTURE_2D_ARRAY, 1, 1), xe[i.TEXTURE_3D] = me(i.TEXTURE_3D, i.TEXTURE_3D, 1, 1), r.setClear(0, 0, 0, 1), a.setClear(1), o.setClear(0), be(i.DEPTH_TEST), a.setFunc(Da), pt(!1), gt(kp), be(i.CULL_FACE), H(Gs);
function be(W) {
h[W] !== !0 && (i.enable(W), h[W] = !0);
}
@@ -22181,46 +22181,46 @@ function A1(i, e) {
}
const ht = {
[pr]: i.FUNC_ADD,
- [iy]: i.FUNC_SUBTRACT,
- [sy]: i.FUNC_REVERSE_SUBTRACT
+ [sy]: i.FUNC_SUBTRACT,
+ [ry]: i.FUNC_REVERSE_SUBTRACT
};
- ht[ry] = i.MIN, ht[ay] = i.MAX;
+ ht[ay] = i.MIN, ht[oy] = i.MAX;
const $e = {
- [oy]: i.ZERO,
- [cy]: i.ONE,
- [ly]: i.SRC_COLOR,
- [ld]: i.SRC_ALPHA,
- [Ay]: i.SRC_ALPHA_SATURATE,
- [fy]: i.DST_COLOR,
- [uy]: i.DST_ALPHA,
- [hy]: i.ONE_MINUS_SRC_COLOR,
- [hd]: i.ONE_MINUS_SRC_ALPHA,
- [py]: i.ONE_MINUS_DST_COLOR,
- [dy]: i.ONE_MINUS_DST_ALPHA,
- [gy]: i.CONSTANT_COLOR,
- [my]: i.ONE_MINUS_CONSTANT_COLOR,
- [xy]: i.CONSTANT_ALPHA,
- [by]: i.ONE_MINUS_CONSTANT_ALPHA
+ [cy]: i.ZERO,
+ [ly]: i.ONE,
+ [hy]: i.SRC_COLOR,
+ [ud]: i.SRC_ALPHA,
+ [gy]: i.SRC_ALPHA_SATURATE,
+ [py]: i.DST_COLOR,
+ [dy]: i.DST_ALPHA,
+ [uy]: i.ONE_MINUS_SRC_COLOR,
+ [dd]: i.ONE_MINUS_SRC_ALPHA,
+ [Ay]: i.ONE_MINUS_DST_COLOR,
+ [fy]: i.ONE_MINUS_DST_ALPHA,
+ [my]: i.CONSTANT_COLOR,
+ [xy]: i.ONE_MINUS_CONSTANT_COLOR,
+ [by]: i.CONSTANT_ALPHA,
+ [Ey]: i.ONE_MINUS_CONSTANT_ALPHA
};
function H(W, ne, re, de, Se, Ce, it, Qt, bn, Ct) {
if (W === Gs) {
m === !0 && (Ue(i.BLEND), m = !1);
return;
}
- if (m === !1 && (be(i.BLEND), m = !0), W !== ny) {
+ if (m === !1 && (be(i.BLEND), m = !0), W !== iy) {
if (W !== g || Ct !== C) {
if ((A !== pr || E !== pr) && (i.blendEquation(i.FUNC_ADD), A = pr, E = pr), Ct)
switch (W) {
- case va:
+ case Ca:
i.blendFuncSeparate(i.ONE, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);
break;
- case Pp:
+ case Up:
i.blendFunc(i.ONE, i.ONE);
break;
- case kp:
+ case Op:
i.blendFuncSeparate(i.ZERO, i.ONE_MINUS_SRC_COLOR, i.ZERO, i.ONE);
break;
- case Up:
+ case Qp:
i.blendFuncSeparate(i.ZERO, i.SRC_COLOR, i.ZERO, i.SRC_ALPHA);
break;
default:
@@ -22229,16 +22229,16 @@ function A1(i, e) {
}
else
switch (W) {
- case va:
+ case Ca:
i.blendFuncSeparate(i.SRC_ALPHA, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);
break;
- case Pp:
+ case Up:
i.blendFunc(i.SRC_ALPHA, i.ONE);
break;
- case kp:
+ case Op:
i.blendFuncSeparate(i.ZERO, i.ONE_MINUS_SRC_COLOR, i.ZERO, i.ONE);
break;
- case Up:
+ case Qp:
i.blendFunc(i.ZERO, i.SRC_COLOR);
break;
default:
@@ -22252,9 +22252,9 @@ function A1(i, e) {
Se = Se || ne, Ce = Ce || re, it = it || de, (ne !== A || Se !== E) && (i.blendEquationSeparate(ht[ne], ht[Se]), A = ne, E = Se), (re !== _ || de !== x || Ce !== S || it !== w) && (i.blendFuncSeparate($e[re], $e[de], $e[Ce], $e[it]), _ = re, x = de, S = Ce, w = it), (Qt.equals(I) === !1 || bn !== T) && (i.blendColor(Qt.r, Qt.g, Qt.b, bn), I.copy(Qt), T = bn), g = W, C = !1;
}
function xn(W, ne) {
- W.side === Ui ? Ue(i.CULL_FACE) : be(i.CULL_FACE);
- let re = W.side === Vn;
- ne && (re = !re), pt(re), W.blending === va && W.transparent === !1 ? H(Gs) : H(W.blending, W.blendEquation, W.blendSrc, W.blendDst, W.blendEquationAlpha, W.blendSrcAlpha, W.blendDstAlpha, W.blendColor, W.blendAlpha, W.premultipliedAlpha), a.setFunc(W.depthFunc), a.setTest(W.depthTest), a.setMask(W.depthWrite), r.setMask(W.colorWrite);
+ W.side === Oi ? Ue(i.CULL_FACE) : be(i.CULL_FACE);
+ let re = W.side === Wn;
+ ne && (re = !re), pt(re), W.blending === Ca && W.transparent === !1 ? H(Gs) : H(W.blending, W.blendEquation, W.blendSrc, W.blendDst, W.blendEquationAlpha, W.blendSrcAlpha, W.blendDstAlpha, W.blendColor, W.blendAlpha, W.premultipliedAlpha), a.setFunc(W.depthFunc), a.setTest(W.depthTest), a.setMask(W.depthWrite), r.setMask(W.colorWrite);
const de = W.stencilWrite;
o.setTest(de), de && (o.setMask(W.stencilWriteMask), o.setFunc(W.stencilFunc, W.stencilRef, W.stencilFuncMask), o.setOp(W.stencilFail, W.stencilZFail, W.stencilZPass)), Dt(W.polygonOffset, W.polygonOffsetFactor, W.polygonOffsetUnits), W.alphaToCoverage === !0 ? be(i.SAMPLE_ALPHA_TO_COVERAGE) : Ue(i.SAMPLE_ALPHA_TO_COVERAGE);
}
@@ -22262,7 +22262,7 @@ function A1(i, e) {
v !== W && (W ? i.frontFace(i.CW) : i.frontFace(i.CCW), v = W);
}
function gt(W) {
- W !== $E ? (be(i.CULL_FACE), W !== F && (W === Lp ? i.cullFace(i.BACK) : W === ey ? i.cullFace(i.FRONT) : i.cullFace(i.FRONT_AND_BACK))) : Ue(i.CULL_FACE), F = W;
+ W !== ey ? (be(i.CULL_FACE), W !== F && (W === kp ? i.cullFace(i.BACK) : W === ty ? i.cullFace(i.FRONT) : i.cullFace(i.FRONT_AND_BACK))) : Ue(i.CULL_FACE), F = W;
}
function We(W) {
W !== K && (O && i.lineWidth(W), K = W);
@@ -22412,7 +22412,7 @@ function A1(i, e) {
reset: nt
};
}
-function g1(i, e, t, n, s, r, a) {
+function m1(i, e, t, n, s, r, a) {
const 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 Ze(), h = /* @__PURE__ */ new WeakMap();
let u;
const d = /* @__PURE__ */ new WeakMap();
@@ -22425,7 +22425,7 @@ function g1(i, e, t, n, s, r, a) {
return f ? (
// eslint-disable-next-line compat/compat
new OffscreenCanvas(L, M)
- ) : jo("canvas");
+ ) : Xo("canvas");
}
function m(L, M, Z) {
let le = 1;
@@ -22456,17 +22456,17 @@ function g1(i, e, t, n, s, r, a) {
}
let oe = M;
if (M === i.RED && (Z === i.FLOAT && (oe = i.R32F), Z === i.HALF_FLOAT && (oe = i.R16F), Z === i.UNSIGNED_BYTE && (oe = i.R8)), M === i.RED_INTEGER && (Z === i.UNSIGNED_BYTE && (oe = i.R8UI), Z === i.UNSIGNED_SHORT && (oe = i.R16UI), Z === i.UNSIGNED_INT && (oe = i.R32UI), Z === i.BYTE && (oe = i.R8I), Z === i.SHORT && (oe = i.R16I), Z === i.INT && (oe = i.R32I)), M === i.RG && (Z === i.FLOAT && (oe = i.RG32F), Z === i.HALF_FLOAT && (oe = i.RG16F), Z === i.UNSIGNED_BYTE && (oe = i.RG8)), M === i.RG_INTEGER && (Z === i.UNSIGNED_BYTE && (oe = i.RG8UI), Z === i.UNSIGNED_SHORT && (oe = i.RG16UI), Z === i.UNSIGNED_INT && (oe = i.RG32UI), Z === i.BYTE && (oe = i.RG8I), Z === i.SHORT && (oe = i.RG16I), Z === i.INT && (oe = i.RG32I)), M === i.RGB_INTEGER && (Z === i.UNSIGNED_BYTE && (oe = i.RGB8UI), Z === i.UNSIGNED_SHORT && (oe = i.RGB16UI), Z === i.UNSIGNED_INT && (oe = i.RGB32UI), Z === i.BYTE && (oe = i.RGB8I), Z === i.SHORT && (oe = i.RGB16I), Z === i.INT && (oe = i.RGB32I)), M === i.RGBA_INTEGER && (Z === i.UNSIGNED_BYTE && (oe = i.RGBA8UI), Z === i.UNSIGNED_SHORT && (oe = i.RGBA16UI), Z === i.UNSIGNED_INT && (oe = i.RGBA32UI), Z === i.BYTE && (oe = i.RGBA8I), Z === i.SHORT && (oe = i.RGBA16I), Z === i.INT && (oe = i.RGBA32I)), M === i.RGB && Z === i.UNSIGNED_INT_5_9_9_9_REV && (oe = i.RGB9_E5), M === i.RGBA) {
- const Qe = pe ? zl : rt.getTransfer(le);
+ const Qe = pe ? Wl : rt.getTransfer(le);
Z === i.FLOAT && (oe = i.RGBA32F), Z === i.HALF_FLOAT && (oe = i.RGBA16F), Z === i.UNSIGNED_BYTE && (oe = Qe === Rt ? i.SRGB8_ALPHA8 : i.RGBA8), Z === i.UNSIGNED_SHORT_4_4_4_4 && (oe = i.RGBA4), Z === i.UNSIGNED_SHORT_5_5_5_1 && (oe = i.RGB5_A1);
}
return (oe === i.R16F || oe === i.R32F || oe === i.RG16F || oe === i.RG32F || oe === i.RGBA16F || oe === i.RGBA32F) && e.get("EXT_color_buffer_float"), oe;
}
function E(L, M) {
let Z;
- return L ? M === null || M === Tr || M === Go ? Z = i.DEPTH24_STENCIL8 : M === fn ? Z = i.DEPTH32F_STENCIL8 : M === Qo && (Z = i.DEPTH24_STENCIL8, console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : M === null || M === Tr || M === Go ? Z = i.DEPTH_COMPONENT24 : M === fn ? Z = i.DEPTH_COMPONENT32F : M === Qo && (Z = i.DEPTH_COMPONENT16), Z;
+ return L ? M === null || M === Tr || M === Ho ? Z = i.DEPTH24_STENCIL8 : M === fn ? Z = i.DEPTH32F_STENCIL8 : M === Go && (Z = i.DEPTH24_STENCIL8, console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : M === null || M === Tr || M === Ho ? Z = i.DEPTH_COMPONENT24 : M === fn ? Z = i.DEPTH_COMPONENT32F : M === Go && (Z = i.DEPTH_COMPONENT16), Z;
}
function S(L, M) {
- return g(L) === !0 || L.isFramebufferTexture && L.minFilter !== Wn && L.minFilter !== Xt ? Math.log2(Math.max(M.width, M.height)) + 1 : L.mipmaps !== void 0 && L.mipmaps.length > 0 ? L.mipmaps.length : L.isCompressedTexture && Array.isArray(L.image) ? M.mipmaps.length : 1;
+ return g(L) === !0 || L.isFramebufferTexture && L.minFilter !== qn && L.minFilter !== Xt ? Math.log2(Math.max(M.width, M.height)) + 1 : L.mipmaps !== void 0 && L.mipmaps.length > 0 ? L.mipmaps.length : L.isCompressedTexture && Array.isArray(L.image) ? M.mipmaps.length : 1;
}
function w(L) {
const M = L.target;
@@ -22572,28 +22572,28 @@ function g1(i, e, t, n, s, r, a) {
}
const J = {
[Ws]: i.REPEAT,
- [ti]: i.CLAMP_TO_EDGE,
- [Ll]: i.MIRRORED_REPEAT
+ [ni]: i.CLAMP_TO_EDGE,
+ [kl]: i.MIRRORED_REPEAT
}, ee = {
- [Wn]: i.NEAREST,
- [A0]: i.NEAREST_MIPMAP_NEAREST,
- [yo]: i.NEAREST_MIPMAP_LINEAR,
+ [qn]: i.NEAREST,
+ [g0]: i.NEAREST_MIPMAP_NEAREST,
+ [_o]: i.NEAREST_MIPMAP_LINEAR,
[Xt]: i.LINEAR,
- [vl]: i.LINEAR_MIPMAP_NEAREST,
- [hi]: i.LINEAR_MIPMAP_LINEAR
+ [Il]: i.LINEAR_MIPMAP_NEAREST,
+ [ui]: i.LINEAR_MIPMAP_LINEAR
}, ae = {
- [Dy]: i.NEVER,
- [Qy]: i.ALWAYS,
- [Ly]: i.LESS,
- [C0]: i.LEQUAL,
- [Py]: i.EQUAL,
- [Oy]: i.GEQUAL,
- [ky]: i.GREATER,
- [Uy]: i.NOTEQUAL
+ [Ly]: i.NEVER,
+ [Gy]: i.ALWAYS,
+ [Py]: i.LESS,
+ [I0]: i.LEQUAL,
+ [ky]: i.EQUAL,
+ [Qy]: i.GEQUAL,
+ [Uy]: i.GREATER,
+ [Oy]: i.NOTEQUAL
};
function _e(L, M) {
- if (M.type === fn && e.has("OES_texture_float_linear") === !1 && (M.magFilter === Xt || M.magFilter === vl || M.magFilter === yo || M.magFilter === hi || M.minFilter === Xt || M.minFilter === vl || M.minFilter === yo || M.minFilter === hi) && console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), i.texParameteri(L, i.TEXTURE_WRAP_S, J[M.wrapS]), i.texParameteri(L, i.TEXTURE_WRAP_T, J[M.wrapT]), (L === i.TEXTURE_3D || L === i.TEXTURE_2D_ARRAY) && i.texParameteri(L, i.TEXTURE_WRAP_R, J[M.wrapR]), i.texParameteri(L, i.TEXTURE_MAG_FILTER, ee[M.magFilter]), i.texParameteri(L, i.TEXTURE_MIN_FILTER, ee[M.minFilter]), M.compareFunction && (i.texParameteri(L, i.TEXTURE_COMPARE_MODE, i.COMPARE_REF_TO_TEXTURE), i.texParameteri(L, i.TEXTURE_COMPARE_FUNC, ae[M.compareFunction])), e.has("EXT_texture_filter_anisotropic") === !0) {
- if (M.magFilter === Wn || M.minFilter !== yo && M.minFilter !== hi || M.type === fn && e.has("OES_texture_float_linear") === !1) return;
+ if (M.type === fn && e.has("OES_texture_float_linear") === !1 && (M.magFilter === Xt || M.magFilter === Il || M.magFilter === _o || M.magFilter === ui || M.minFilter === Xt || M.minFilter === Il || M.minFilter === _o || M.minFilter === ui) && console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), i.texParameteri(L, i.TEXTURE_WRAP_S, J[M.wrapS]), i.texParameteri(L, i.TEXTURE_WRAP_T, J[M.wrapT]), (L === i.TEXTURE_3D || L === i.TEXTURE_2D_ARRAY) && i.texParameteri(L, i.TEXTURE_WRAP_R, J[M.wrapR]), i.texParameteri(L, i.TEXTURE_MAG_FILTER, ee[M.magFilter]), i.texParameteri(L, i.TEXTURE_MIN_FILTER, ee[M.minFilter]), M.compareFunction && (i.texParameteri(L, i.TEXTURE_COMPARE_MODE, i.COMPARE_REF_TO_TEXTURE), i.texParameteri(L, i.TEXTURE_COMPARE_FUNC, ae[M.compareFunction])), e.has("EXT_texture_filter_anisotropic") === !0) {
+ if (M.magFilter === qn || M.minFilter !== _o && M.minFilter !== ui || M.type === fn && e.has("OES_texture_float_linear") === !1) return;
if (M.anisotropy > 1 || n.get(M).__currentAnisotropy) {
const Z = e.get("EXT_texture_filter_anisotropic");
i.texParameterf(L, Z.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(M.anisotropy, s.getMaxAnisotropy())), n.get(M).__currentAnisotropy = M.anisotropy;
@@ -22625,7 +22625,7 @@ function g1(i, e, t, n, s, r, a) {
const Qe = n.get(oe);
if (oe.version !== Qe.__version || pe === !0) {
t.activeTexture(i.TEXTURE0 + Z);
- const ve = rt.getPrimaries(rt.workingColorSpace), qe = M.colorSpace === vi ? null : rt.getPrimaries(M.colorSpace), Je = M.colorSpace === vi || ve === qe ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
+ const ve = rt.getPrimaries(rt.workingColorSpace), qe = M.colorSpace === Ci ? null : rt.getPrimaries(M.colorSpace), Je = M.colorSpace === Ci || ve === qe ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, M.flipY), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, M.premultiplyAlpha), i.pixelStorei(i.UNPACK_ALIGNMENT, M.unpackAlignment), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, Je);
let Ee = m(M.image, !1, s.maxTextureSize);
Ee = Dt(M, Ee);
@@ -22635,7 +22635,7 @@ function g1(i, e, t, n, s, r, a) {
let Be;
const tt = M.mipmaps, Ke = M.isVideoTexture !== !0, nt = Qe.__version === void 0 || pe === !0, W = oe.dataReady, ne = S(M, Ee);
if (M.isDepthTexture)
- Ge = E(M.format === zo, M.type), nt && (Ke ? t.texStorage2D(i.TEXTURE_2D, 1, Ge, Ee.width, Ee.height) : t.texImage2D(i.TEXTURE_2D, 0, Ge, Ee.width, Ee.height, 0, Re, Oe, null));
+ Ge = E(M.format === Vo, M.type), nt && (Ke ? t.texStorage2D(i.TEXTURE_2D, 1, Ge, Ee.width, Ee.height) : t.texImage2D(i.TEXTURE_2D, 0, Ge, Ee.width, Ee.height, 0, Re, Oe, null));
else if (M.isDataTexture)
if (tt.length > 0) {
Ke && nt && t.texStorage2D(i.TEXTURE_2D, ne, Ge, tt[0].width, tt[0].height);
@@ -22653,7 +22653,7 @@ function g1(i, e, t, n, s, r, a) {
if (Ke) {
if (W)
if (M.layerUpdates.size > 0) {
- const Se = TA(Be.width, Be.height, M.format, M.type);
+ const Se = FA(Be.width, Be.height, M.format, M.type);
for (const Ce of M.layerUpdates) {
const it = Be.data.subarray(
Ce * Se / Be.data.BYTES_PER_ELEMENT,
@@ -22679,7 +22679,7 @@ function g1(i, e, t, n, s, r, a) {
if (Ke) {
if (nt && t.texStorage3D(i.TEXTURE_2D_ARRAY, ne, Ge, Ee.width, Ee.height, Ee.depth), W)
if (M.layerUpdates.size > 0) {
- const re = TA(Ee.width, Ee.height, M.format, M.type);
+ const re = FA(Ee.width, Ee.height, M.format, M.type);
for (const de of M.layerUpdates) {
const Se = Ee.data.subarray(
de * re / Ee.data.BYTES_PER_ELEMENT,
@@ -22730,7 +22730,7 @@ function g1(i, e, t, n, s, r, a) {
const oe = n.get(pe);
if (pe.version !== oe.__version || le === !0) {
t.activeTexture(i.TEXTURE0 + Z);
- const Qe = rt.getPrimaries(rt.workingColorSpace), ve = M.colorSpace === vi ? null : rt.getPrimaries(M.colorSpace), qe = M.colorSpace === vi || Qe === ve ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
+ const Qe = rt.getPrimaries(rt.workingColorSpace), ve = M.colorSpace === Ci ? null : rt.getPrimaries(M.colorSpace), qe = M.colorSpace === Ci || Qe === ve ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, M.flipY), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, M.premultiplyAlpha), i.pixelStorei(i.UNPACK_ALIGNMENT, M.unpackAlignment), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, qe);
const Je = M.isCompressedTexture || M.image[0].isCompressedTexture, Ee = M.image[0] && M.image[0].isDataTexture, Re = [];
for (let de = 0; de < 6; de++)
@@ -22801,9 +22801,9 @@ function g1(i, e, t, n, s, r, a) {
const le = n.get(M.depthTexture);
le.__renderTarget = M, (!le.__webglTexture || M.depthTexture.image.width !== M.width || M.depthTexture.image.height !== M.height) && (M.depthTexture.image.width = M.width, M.depthTexture.image.height = M.height, M.depthTexture.needsUpdate = !0), D(M.depthTexture, 0);
const pe = le.__webglTexture, oe = pt(M);
- if (M.depthTexture.format === Ho)
+ if (M.depthTexture.format === zo)
gt(M) ? o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER, i.DEPTH_ATTACHMENT, i.TEXTURE_2D, pe, 0, oe) : i.framebufferTexture2D(i.FRAMEBUFFER, i.DEPTH_ATTACHMENT, i.TEXTURE_2D, pe, 0);
- else if (M.depthTexture.format === zo)
+ else if (M.depthTexture.format === Vo)
gt(M) ? o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER, i.DEPTH_STENCIL_ATTACHMENT, i.TEXTURE_2D, pe, 0, oe) : i.framebufferTexture2D(i.FRAMEBUFFER, i.DEPTH_STENCIL_ATTACHMENT, i.TEXTURE_2D, pe, 0);
else
throw new Error("Unknown depthTexture format");
@@ -22967,111 +22967,111 @@ function g1(i, e, t, n, s, r, a) {
}
function Dt(L, M) {
const Z = L.colorSpace, le = L.format, pe = L.type;
- return L.isCompressedTexture === !0 || L.isVideoTexture === !0 || Z !== An && Z !== vi && (rt.getTransfer(Z) === Rt ? (le !== pn || pe !== un) && console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : console.error("THREE.WebGLTextures: Unsupported texture color space:", Z)), M;
+ return L.isCompressedTexture === !0 || L.isVideoTexture === !0 || Z !== An && Z !== Ci && (rt.getTransfer(Z) === Rt ? (le !== pn || pe !== un) && console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : console.error("THREE.WebGLTextures: Unsupported texture color space:", Z)), M;
}
function ze(L) {
return typeof HTMLImageElement < "u" && L instanceof HTMLImageElement ? (l.width = L.naturalWidth || L.width, l.height = L.naturalHeight || L.height) : typeof VideoFrame < "u" && L instanceof VideoFrame ? (l.width = L.displayWidth, l.height = L.displayHeight) : (l.width = L.width, l.height = L.height), l;
}
this.allocateTextureUnit = q, this.resetTextureUnits = K, this.setTexture2D = D, this.setTexture2DArray = O, this.setTexture3D = Y, this.setTextureCube = Q, this.rebindTextures = He, this.setupRenderTarget = St, this.updateRenderTargetMipmap = ht, this.updateMultisampleRenderTarget = xn, this.setupDepthRenderbuffer = et, this.setupFrameBufferTexture = xe, this.useMultisampledRTT = gt;
}
-function m1(i, e) {
- function t(n, s = vi) {
+function x1(i, e) {
+ function t(n, s = Ci) {
let r;
const a = rt.getTransfer(s);
if (n === un) return i.UNSIGNED_BYTE;
- if (n === Pf) return i.UNSIGNED_SHORT_4_4_4_4;
- if (n === kf) return i.UNSIGNED_SHORT_5_5_5_1;
- if (n === x0) return i.UNSIGNED_INT_5_9_9_9_REV;
- if (n === g0) return i.BYTE;
- if (n === m0) return i.SHORT;
- if (n === Qo) return i.UNSIGNED_SHORT;
- if (n === Lf) return i.INT;
+ if (n === Uf) return i.UNSIGNED_SHORT_4_4_4_4;
+ if (n === Of) return i.UNSIGNED_SHORT_5_5_5_1;
+ if (n === b0) return i.UNSIGNED_INT_5_9_9_9_REV;
+ if (n === m0) return i.BYTE;
+ if (n === x0) return i.SHORT;
+ if (n === Go) return i.UNSIGNED_SHORT;
+ if (n === kf) return i.INT;
if (n === Tr) return i.UNSIGNED_INT;
if (n === fn) return i.FLOAT;
- if (n === Qn) return i.HALF_FLOAT;
- if (n === b0) return i.ALPHA;
- if (n === E0) return i.RGB;
+ if (n === Gn) return i.HALF_FLOAT;
+ if (n === E0) return i.ALPHA;
+ if (n === y0) return i.RGB;
if (n === pn) return i.RGBA;
- if (n === Ho) return i.DEPTH_COMPONENT;
- if (n === zo) return i.DEPTH_STENCIL;
+ if (n === zo) return i.DEPTH_COMPONENT;
+ if (n === Vo) return i.DEPTH_STENCIL;
if (n === cs) return i.RED;
- if (n === Uf) return i.RED_INTEGER;
+ if (n === Qf) return i.RED_INTEGER;
if (n === Er) return i.RG;
- if (n === Of) return i.RG_INTEGER;
- if (n === Qf) return i.RGBA_INTEGER;
- if (n === Cl || n === Bo || n === Il || n === To)
+ if (n === Gf) return i.RG_INTEGER;
+ if (n === Hf) return i.RGBA_INTEGER;
+ if (n === Sl || n === To || n === Ml || n === Ro)
if (a === Rt)
if (r = e.get("WEBGL_compressed_texture_s3tc_srgb"), r !== null) {
- if (n === Cl) return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;
- if (n === Bo) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
- if (n === Il) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
- if (n === To) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
+ if (n === Sl) return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;
+ if (n === To) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
+ if (n === Ml) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
+ if (n === Ro) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
} else
return null;
else if (r = e.get("WEBGL_compressed_texture_s3tc"), r !== null) {
- if (n === Cl) return r.COMPRESSED_RGB_S3TC_DXT1_EXT;
- if (n === Bo) return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;
- if (n === Il) return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;
- if (n === To) return r.COMPRESSED_RGBA_S3TC_DXT5_EXT;
+ if (n === Sl) return r.COMPRESSED_RGB_S3TC_DXT1_EXT;
+ if (n === To) return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;
+ if (n === Ml) return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;
+ if (n === Ro) return r.COMPRESSED_RGBA_S3TC_DXT5_EXT;
} else
return null;
- if (n === Pl || n === Ed || n === kl || n === yd)
+ if (n === Ul || n === _d || n === Ol || n === wd)
if (r = e.get("WEBGL_compressed_texture_pvrtc"), r !== null) {
- if (n === Pl) return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
- if (n === Ed) return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
- if (n === kl) return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
- if (n === yd) return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
+ if (n === Ul) return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
+ if (n === _d) return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
+ if (n === Ol) return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
+ if (n === wd) return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
} else
return null;
- if (n === Ul || n === Ol || n === Ql)
+ if (n === Ql || n === Gl || n === Hl)
if (r = e.get("WEBGL_compressed_texture_etc"), r !== null) {
- if (n === Ul || n === Ol) return a === Rt ? r.COMPRESSED_SRGB8_ETC2 : r.COMPRESSED_RGB8_ETC2;
- if (n === Ql) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : r.COMPRESSED_RGBA8_ETC2_EAC;
+ if (n === Ql || n === Gl) return a === Rt ? r.COMPRESSED_SRGB8_ETC2 : r.COMPRESSED_RGB8_ETC2;
+ if (n === Hl) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : r.COMPRESSED_RGBA8_ETC2_EAC;
} else
return null;
- if (n === Vo || n === _d || n === wd || n === vd || n === Wo || n === Cd || n === Id || n === Sd || n === Md || n === Bd || n === Td || n === Rd || n === Fd || n === Nd)
+ if (n === Wo || n === vd || n === Cd || n === Id || n === qo || n === Sd || n === Md || n === Bd || n === Td || n === Rd || n === Fd || n === Nd || n === Dd || n === Ld)
if (r = e.get("WEBGL_compressed_texture_astc"), r !== null) {
- if (n === Vo) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : r.COMPRESSED_RGBA_ASTC_4x4_KHR;
- if (n === _d) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : r.COMPRESSED_RGBA_ASTC_5x4_KHR;
- if (n === wd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : r.COMPRESSED_RGBA_ASTC_5x5_KHR;
- if (n === vd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : r.COMPRESSED_RGBA_ASTC_6x5_KHR;
- if (n === Wo) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : r.COMPRESSED_RGBA_ASTC_6x6_KHR;
- if (n === Cd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : r.COMPRESSED_RGBA_ASTC_8x5_KHR;
- if (n === Id) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : r.COMPRESSED_RGBA_ASTC_8x6_KHR;
- if (n === Sd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : r.COMPRESSED_RGBA_ASTC_8x8_KHR;
- if (n === Md) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : r.COMPRESSED_RGBA_ASTC_10x5_KHR;
- if (n === Bd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : r.COMPRESSED_RGBA_ASTC_10x6_KHR;
- if (n === Td) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : r.COMPRESSED_RGBA_ASTC_10x8_KHR;
- if (n === Rd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : r.COMPRESSED_RGBA_ASTC_10x10_KHR;
- if (n === Fd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : r.COMPRESSED_RGBA_ASTC_12x10_KHR;
- if (n === Nd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : r.COMPRESSED_RGBA_ASTC_12x12_KHR;
+ if (n === Wo) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : r.COMPRESSED_RGBA_ASTC_4x4_KHR;
+ if (n === vd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : r.COMPRESSED_RGBA_ASTC_5x4_KHR;
+ if (n === Cd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : r.COMPRESSED_RGBA_ASTC_5x5_KHR;
+ if (n === Id) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : r.COMPRESSED_RGBA_ASTC_6x5_KHR;
+ if (n === qo) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : r.COMPRESSED_RGBA_ASTC_6x6_KHR;
+ if (n === Sd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : r.COMPRESSED_RGBA_ASTC_8x5_KHR;
+ if (n === Md) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : r.COMPRESSED_RGBA_ASTC_8x6_KHR;
+ if (n === Bd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : r.COMPRESSED_RGBA_ASTC_8x8_KHR;
+ if (n === Td) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : r.COMPRESSED_RGBA_ASTC_10x5_KHR;
+ if (n === Rd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : r.COMPRESSED_RGBA_ASTC_10x6_KHR;
+ if (n === Fd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : r.COMPRESSED_RGBA_ASTC_10x8_KHR;
+ if (n === Nd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : r.COMPRESSED_RGBA_ASTC_10x10_KHR;
+ if (n === Dd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : r.COMPRESSED_RGBA_ASTC_12x10_KHR;
+ if (n === Ld) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : r.COMPRESSED_RGBA_ASTC_12x12_KHR;
} else
return null;
- if (n === Ro || n === Dd || n === Gl)
+ if (n === Fo || n === Pd || n === zl)
if (r = e.get("EXT_texture_compression_bptc"), r !== null) {
- if (n === Ro) return a === Rt ? r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : r.COMPRESSED_RGBA_BPTC_UNORM_EXT;
- if (n === Dd) return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
- if (n === Gl) return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
+ if (n === Fo) return a === Rt ? r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : r.COMPRESSED_RGBA_BPTC_UNORM_EXT;
+ if (n === Pd) return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
+ if (n === zl) return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
} else
return null;
- if (n === y0 || n === Ld || n === Pd || n === kd)
+ if (n === _0 || n === kd || n === Ud || n === Od)
if (r = e.get("EXT_texture_compression_rgtc"), r !== null) {
- if (n === Ro) return r.COMPRESSED_RED_RGTC1_EXT;
- if (n === Ld) return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;
- if (n === Pd) return r.COMPRESSED_RED_GREEN_RGTC2_EXT;
- if (n === kd) return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
+ if (n === Fo) return r.COMPRESSED_RED_RGTC1_EXT;
+ if (n === kd) return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;
+ if (n === Ud) return r.COMPRESSED_RED_GREEN_RGTC2_EXT;
+ if (n === Od) return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
} else
return null;
- return n === Go ? i.UNSIGNED_INT_24_8 : i[n] !== void 0 ? i[n] : null;
+ return n === Ho ? i.UNSIGNED_INT_24_8 : i[n] !== void 0 ? i[n] : null;
}
return { convert: t };
}
-const x1 = `
+const b1 = `
void main() {
gl_Position = vec4( position, 1.0 );
-}`, b1 = `
+}`, E1 = `
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
@@ -23091,7 +23091,7 @@ void main() {
}
}`;
-class E1 {
+class y1 {
/**
* Constructs a new depth sensing module.
*/
@@ -23120,15 +23120,15 @@ class E1 {
getMesh(e) {
if (this.texture !== null && this.mesh === null) {
const t = e.cameras[0].viewport, n = new qs({
- vertexShader: x1,
- fragmentShader: b1,
+ vertexShader: b1,
+ fragmentShader: E1,
uniforms: {
depthColor: { value: this.texture },
depthWidth: { value: t.z },
depthHeight: { value: t.w }
}
});
- this.mesh = new Zt(new xh(20, 20), n);
+ this.mesh = new Zt(new Eh(20, 20), n);
}
return this.mesh;
}
@@ -23147,7 +23147,7 @@ class E1 {
return this.texture;
}
}
-class y1 extends Js {
+class _1 extends Js {
/**
* Constructs a new WebGL renderer.
*
@@ -23158,7 +23158,7 @@ class y1 extends Js {
super();
const n = this;
let s = null, r = 1, a = null, o = "local-floor", c = 1, l = null, h = null, u = null, d = null, f = null, p = null;
- const m = new E1(), g = t.getContextAttributes();
+ const m = new y1(), g = t.getContextAttributes();
let A = null, _ = null;
const x = [], E = [], S = new Ze();
let w = null;
@@ -23166,17 +23166,17 @@ class y1 extends Js {
I.viewport = new mt();
const T = new In();
T.viewport = new mt();
- const C = [I, T], v = new Sw();
+ const C = [I, T], v = new Mw();
let F = null, K = null;
this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(se) {
let me = x[se];
- return me === void 0 && (me = new au(), x[se] = me), me.getTargetRaySpace();
+ return me === void 0 && (me = new cu(), x[se] = me), me.getTargetRaySpace();
}, this.getControllerGrip = function(se) {
let me = x[se];
- return me === void 0 && (me = new au(), x[se] = me), me.getGripSpace();
+ return me === void 0 && (me = new cu(), x[se] = me), me.getGripSpace();
}, this.getHand = function(se) {
let me = x[se];
- return me === void 0 && (me = new au(), x[se] = me), me.getHandSpace();
+ return me === void 0 && (me = new cu(), x[se] = me), me.getHandSpace();
};
function q(se) {
const me = E.indexOf(se.inputSource);
@@ -23213,7 +23213,7 @@ class y1 extends Js {
if (s = se, s !== null) {
if (A = e.getRenderTarget(), s.addEventListener("select", q), s.addEventListener("selectstart", q), s.addEventListener("selectend", q), s.addEventListener("squeeze", q), s.addEventListener("squeezestart", q), s.addEventListener("squeezeend", q), s.addEventListener("end", $), s.addEventListener("inputsourceschange", D), g.xrCompatible !== !0 && await t.makeXRCompatible(), w = e.getPixelRatio(), e.getSize(S), typeof XRWebGLBinding < "u" && "createProjectionLayer" in XRWebGLBinding.prototype) {
let xe = null, be = null, Ue = null;
- g.depth && (Ue = g.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, xe = g.stencil ? zo : Ho, be = g.stencil ? Go : Tr);
+ g.depth && (Ue = g.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, xe = g.stencil ? Vo : zo, be = g.stencil ? Ho : Tr);
const et = {
colorFormat: t.RGBA8,
depthFormat: Ue,
@@ -23225,7 +23225,7 @@ class y1 extends Js {
{
format: pn,
type: un,
- depthTexture: new k0(d.textureWidth, d.textureHeight, be, void 0, void 0, void 0, void 0, void 0, void 0, xe),
+ depthTexture: new U0(d.textureWidth, d.textureHeight, be, void 0, void 0, void 0, void 0, void 0, void 0, xe),
stencilBuffer: g.stencil,
colorSpace: e.outputColorSpace,
samples: g.antialias ? 4 : 0,
@@ -23313,7 +23313,7 @@ class y1 extends Js {
Ue.length === 2 ? Q(v, I, T) : v.projectionMatrix.copy(I.projectionMatrix), ee(se, v, be);
};
function ee(se, me, xe) {
- xe === null ? se.matrix.copy(me.matrixWorld) : (se.matrix.copy(xe.matrixWorld), se.matrix.invert(), se.matrix.multiply(me.matrixWorld)), se.matrix.decompose(se.position, se.quaternion, se.scale), se.updateMatrixWorld(!0), se.projectionMatrix.copy(me.projectionMatrix), se.projectionMatrixInverse.copy(me.projectionMatrixInverse), se.isPerspectiveCamera && (se.fov = La * 2 * Math.atan(1 / se.projectionMatrix.elements[5]), se.zoom = 1);
+ xe === null ? se.matrix.copy(me.matrixWorld) : (se.matrix.copy(xe.matrixWorld), se.matrix.invert(), se.matrix.multiply(me.matrixWorld)), se.matrix.decompose(se.position, se.quaternion, se.scale), se.updateMatrixWorld(!0), se.projectionMatrix.copy(me.projectionMatrix), se.projectionMatrixInverse.copy(me.projectionMatrixInverse), se.isPerspectiveCamera && (se.fov = Pa * 2 * Math.atan(1 / se.projectionMatrix.elements[5]), se.zoom = 1);
}
this.getCamera = function() {
return v;
@@ -23362,28 +23362,28 @@ class y1 extends Js {
}
ae && ae(se, me), me.detectedPlanes && n.dispatchEvent({ type: "planesdetected", data: me }), p = null;
}
- const Me = new J0();
+ const Me = new Z0();
Me.setAnimationLoop(_e), this.setAnimationLoop = function(se) {
ae = se;
}, this.dispose = function() {
};
}
}
-const or = /* @__PURE__ */ new dn(), _1 = /* @__PURE__ */ new Ne();
-function w1(i, e) {
+const or = /* @__PURE__ */ new dn(), w1 = /* @__PURE__ */ new Ne();
+function v1(i, e) {
function t(g, A) {
g.matrixAutoUpdate === !0 && g.updateMatrix(), A.value.copy(g.matrix);
}
function n(g, A) {
- A.color.getRGB(g.fogColor.value, F0(i)), A.isFog ? (g.fogNear.value = A.near, g.fogFar.value = A.far) : A.isFogExp2 && (g.fogDensity.value = A.density);
+ A.color.getRGB(g.fogColor.value, N0(i)), A.isFog ? (g.fogNear.value = A.near, g.fogFar.value = A.far) : A.isFogExp2 && (g.fogDensity.value = A.density);
}
function s(g, A, _, x, E) {
A.isMeshBasicMaterial || A.isMeshLambertMaterial ? r(g, A) : A.isMeshToonMaterial ? (r(g, A), u(g, A)) : A.isMeshPhongMaterial ? (r(g, A), h(g, A)) : A.isMeshStandardMaterial ? (r(g, A), d(g, A), A.isMeshPhysicalMaterial && f(g, A, E)) : A.isMeshMatcapMaterial ? (r(g, A), p(g, A)) : A.isMeshDepthMaterial ? r(g, A) : A.isMeshDistanceMaterial ? (r(g, A), m(g, A)) : A.isMeshNormalMaterial ? r(g, A) : A.isLineBasicMaterial ? (a(g, A), A.isLineDashedMaterial && o(g, A)) : A.isPointsMaterial ? c(g, A, _, x) : A.isSpriteMaterial ? l(g, A) : A.isShadowMaterial ? (g.color.value.copy(A.color), g.opacity.value = A.opacity) : A.isShaderMaterial && (A.uniformsNeedUpdate = !1);
}
function r(g, A) {
- g.opacity.value = A.opacity, A.color && g.diffuse.value.copy(A.color), A.emissive && g.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity), A.map && (g.map.value = A.map, t(A.map, g.mapTransform)), A.alphaMap && (g.alphaMap.value = A.alphaMap, t(A.alphaMap, g.alphaMapTransform)), A.bumpMap && (g.bumpMap.value = A.bumpMap, t(A.bumpMap, g.bumpMapTransform), g.bumpScale.value = A.bumpScale, A.side === Vn && (g.bumpScale.value *= -1)), A.normalMap && (g.normalMap.value = A.normalMap, t(A.normalMap, g.normalMapTransform), g.normalScale.value.copy(A.normalScale), A.side === Vn && g.normalScale.value.negate()), A.displacementMap && (g.displacementMap.value = A.displacementMap, t(A.displacementMap, g.displacementMapTransform), g.displacementScale.value = A.displacementScale, g.displacementBias.value = A.displacementBias), A.emissiveMap && (g.emissiveMap.value = A.emissiveMap, t(A.emissiveMap, g.emissiveMapTransform)), A.specularMap && (g.specularMap.value = A.specularMap, t(A.specularMap, g.specularMapTransform)), A.alphaTest > 0 && (g.alphaTest.value = A.alphaTest);
+ g.opacity.value = A.opacity, A.color && g.diffuse.value.copy(A.color), A.emissive && g.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity), A.map && (g.map.value = A.map, t(A.map, g.mapTransform)), A.alphaMap && (g.alphaMap.value = A.alphaMap, t(A.alphaMap, g.alphaMapTransform)), A.bumpMap && (g.bumpMap.value = A.bumpMap, t(A.bumpMap, g.bumpMapTransform), g.bumpScale.value = A.bumpScale, A.side === Wn && (g.bumpScale.value *= -1)), A.normalMap && (g.normalMap.value = A.normalMap, t(A.normalMap, g.normalMapTransform), g.normalScale.value.copy(A.normalScale), A.side === Wn && g.normalScale.value.negate()), A.displacementMap && (g.displacementMap.value = A.displacementMap, t(A.displacementMap, g.displacementMapTransform), g.displacementScale.value = A.displacementScale, g.displacementBias.value = A.displacementBias), A.emissiveMap && (g.emissiveMap.value = A.emissiveMap, t(A.emissiveMap, g.emissiveMapTransform)), A.specularMap && (g.specularMap.value = A.specularMap, t(A.specularMap, g.specularMapTransform)), A.alphaTest > 0 && (g.alphaTest.value = A.alphaTest);
const _ = e.get(A), x = _.envMap, E = _.envMapRotation;
- x && (g.envMap.value = x, or.copy(E), or.x *= -1, or.y *= -1, or.z *= -1, x.isCubeTexture && x.isRenderTargetTexture === !1 && (or.y *= -1, or.z *= -1), g.envMapRotation.value.setFromMatrix4(_1.makeRotationFromEuler(or)), g.flipEnvMap.value = x.isCubeTexture && x.isRenderTargetTexture === !1 ? -1 : 1, g.reflectivity.value = A.reflectivity, g.ior.value = A.ior, g.refractionRatio.value = A.refractionRatio), A.lightMap && (g.lightMap.value = A.lightMap, g.lightMapIntensity.value = A.lightMapIntensity, t(A.lightMap, g.lightMapTransform)), A.aoMap && (g.aoMap.value = A.aoMap, g.aoMapIntensity.value = A.aoMapIntensity, t(A.aoMap, g.aoMapTransform));
+ x && (g.envMap.value = x, or.copy(E), or.x *= -1, or.y *= -1, or.z *= -1, x.isCubeTexture && x.isRenderTargetTexture === !1 && (or.y *= -1, or.z *= -1), g.envMapRotation.value.setFromMatrix4(w1.makeRotationFromEuler(or)), g.flipEnvMap.value = x.isCubeTexture && x.isRenderTargetTexture === !1 ? -1 : 1, g.reflectivity.value = A.reflectivity, g.ior.value = A.ior, g.refractionRatio.value = A.refractionRatio), A.lightMap && (g.lightMap.value = A.lightMap, g.lightMapIntensity.value = A.lightMapIntensity, t(A.lightMap, g.lightMapTransform)), A.aoMap && (g.aoMap.value = A.aoMap, g.aoMapIntensity.value = A.aoMapIntensity, t(A.aoMap, g.aoMapTransform));
}
function a(g, A) {
g.diffuse.value.copy(A.color), g.opacity.value = A.opacity, A.map && (g.map.value = A.map, t(A.map, g.mapTransform));
@@ -23407,7 +23407,7 @@ function w1(i, e) {
g.metalness.value = A.metalness, A.metalnessMap && (g.metalnessMap.value = A.metalnessMap, t(A.metalnessMap, g.metalnessMapTransform)), g.roughness.value = A.roughness, A.roughnessMap && (g.roughnessMap.value = A.roughnessMap, t(A.roughnessMap, g.roughnessMapTransform)), A.envMap && (g.envMapIntensity.value = A.envMapIntensity);
}
function f(g, A, _) {
- g.ior.value = A.ior, A.sheen > 0 && (g.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen), g.sheenRoughness.value = A.sheenRoughness, A.sheenColorMap && (g.sheenColorMap.value = A.sheenColorMap, t(A.sheenColorMap, g.sheenColorMapTransform)), A.sheenRoughnessMap && (g.sheenRoughnessMap.value = A.sheenRoughnessMap, t(A.sheenRoughnessMap, g.sheenRoughnessMapTransform))), A.clearcoat > 0 && (g.clearcoat.value = A.clearcoat, g.clearcoatRoughness.value = A.clearcoatRoughness, A.clearcoatMap && (g.clearcoatMap.value = A.clearcoatMap, t(A.clearcoatMap, g.clearcoatMapTransform)), A.clearcoatRoughnessMap && (g.clearcoatRoughnessMap.value = A.clearcoatRoughnessMap, t(A.clearcoatRoughnessMap, g.clearcoatRoughnessMapTransform)), A.clearcoatNormalMap && (g.clearcoatNormalMap.value = A.clearcoatNormalMap, t(A.clearcoatNormalMap, g.clearcoatNormalMapTransform), g.clearcoatNormalScale.value.copy(A.clearcoatNormalScale), A.side === Vn && g.clearcoatNormalScale.value.negate())), A.dispersion > 0 && (g.dispersion.value = A.dispersion), A.iridescence > 0 && (g.iridescence.value = A.iridescence, g.iridescenceIOR.value = A.iridescenceIOR, g.iridescenceThicknessMinimum.value = A.iridescenceThicknessRange[0], g.iridescenceThicknessMaximum.value = A.iridescenceThicknessRange[1], A.iridescenceMap && (g.iridescenceMap.value = A.iridescenceMap, t(A.iridescenceMap, g.iridescenceMapTransform)), A.iridescenceThicknessMap && (g.iridescenceThicknessMap.value = A.iridescenceThicknessMap, t(A.iridescenceThicknessMap, g.iridescenceThicknessMapTransform))), A.transmission > 0 && (g.transmission.value = A.transmission, g.transmissionSamplerMap.value = _.texture, g.transmissionSamplerSize.value.set(_.width, _.height), A.transmissionMap && (g.transmissionMap.value = A.transmissionMap, t(A.transmissionMap, g.transmissionMapTransform)), g.thickness.value = A.thickness, A.thicknessMap && (g.thicknessMap.value = A.thicknessMap, t(A.thicknessMap, g.thicknessMapTransform)), g.attenuationDistance.value = A.attenuationDistance, g.attenuationColor.value.copy(A.attenuationColor)), A.anisotropy > 0 && (g.anisotropyVector.value.set(A.anisotropy * Math.cos(A.anisotropyRotation), A.anisotropy * Math.sin(A.anisotropyRotation)), A.anisotropyMap && (g.anisotropyMap.value = A.anisotropyMap, t(A.anisotropyMap, g.anisotropyMapTransform))), g.specularIntensity.value = A.specularIntensity, g.specularColor.value.copy(A.specularColor), A.specularColorMap && (g.specularColorMap.value = A.specularColorMap, t(A.specularColorMap, g.specularColorMapTransform)), A.specularIntensityMap && (g.specularIntensityMap.value = A.specularIntensityMap, t(A.specularIntensityMap, g.specularIntensityMapTransform));
+ g.ior.value = A.ior, A.sheen > 0 && (g.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen), g.sheenRoughness.value = A.sheenRoughness, A.sheenColorMap && (g.sheenColorMap.value = A.sheenColorMap, t(A.sheenColorMap, g.sheenColorMapTransform)), A.sheenRoughnessMap && (g.sheenRoughnessMap.value = A.sheenRoughnessMap, t(A.sheenRoughnessMap, g.sheenRoughnessMapTransform))), A.clearcoat > 0 && (g.clearcoat.value = A.clearcoat, g.clearcoatRoughness.value = A.clearcoatRoughness, A.clearcoatMap && (g.clearcoatMap.value = A.clearcoatMap, t(A.clearcoatMap, g.clearcoatMapTransform)), A.clearcoatRoughnessMap && (g.clearcoatRoughnessMap.value = A.clearcoatRoughnessMap, t(A.clearcoatRoughnessMap, g.clearcoatRoughnessMapTransform)), A.clearcoatNormalMap && (g.clearcoatNormalMap.value = A.clearcoatNormalMap, t(A.clearcoatNormalMap, g.clearcoatNormalMapTransform), g.clearcoatNormalScale.value.copy(A.clearcoatNormalScale), A.side === Wn && g.clearcoatNormalScale.value.negate())), A.dispersion > 0 && (g.dispersion.value = A.dispersion), A.iridescence > 0 && (g.iridescence.value = A.iridescence, g.iridescenceIOR.value = A.iridescenceIOR, g.iridescenceThicknessMinimum.value = A.iridescenceThicknessRange[0], g.iridescenceThicknessMaximum.value = A.iridescenceThicknessRange[1], A.iridescenceMap && (g.iridescenceMap.value = A.iridescenceMap, t(A.iridescenceMap, g.iridescenceMapTransform)), A.iridescenceThicknessMap && (g.iridescenceThicknessMap.value = A.iridescenceThicknessMap, t(A.iridescenceThicknessMap, g.iridescenceThicknessMapTransform))), A.transmission > 0 && (g.transmission.value = A.transmission, g.transmissionSamplerMap.value = _.texture, g.transmissionSamplerSize.value.set(_.width, _.height), A.transmissionMap && (g.transmissionMap.value = A.transmissionMap, t(A.transmissionMap, g.transmissionMapTransform)), g.thickness.value = A.thickness, A.thicknessMap && (g.thicknessMap.value = A.thicknessMap, t(A.thicknessMap, g.thicknessMapTransform)), g.attenuationDistance.value = A.attenuationDistance, g.attenuationColor.value.copy(A.attenuationColor)), A.anisotropy > 0 && (g.anisotropyVector.value.set(A.anisotropy * Math.cos(A.anisotropyRotation), A.anisotropy * Math.sin(A.anisotropyRotation)), A.anisotropyMap && (g.anisotropyMap.value = A.anisotropyMap, t(A.anisotropyMap, g.anisotropyMapTransform))), g.specularIntensity.value = A.specularIntensity, g.specularColor.value.copy(A.specularColor), A.specularColorMap && (g.specularColorMap.value = A.specularColorMap, t(A.specularColorMap, g.specularColorMapTransform)), A.specularIntensityMap && (g.specularIntensityMap.value = A.specularIntensityMap, t(A.specularIntensityMap, g.specularIntensityMapTransform));
}
function p(g, A) {
A.matcap && (g.matcap.value = A.matcap);
@@ -23421,7 +23421,7 @@ function w1(i, e) {
refreshMaterialUniforms: s
};
}
-function v1(i, e, t, n) {
+function C1(i, e, t, n) {
let s = {}, r = {}, a = [];
const o = i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);
function c(_, x) {
@@ -23525,7 +23525,7 @@ function v1(i, e, t, n) {
dispose: A
};
}
-class eg {
+class ng {
/**
* Constructs a new WebGL renderer.
*
@@ -23533,7 +23533,7 @@ class eg {
*/
constructor(e = {}) {
const {
- canvas: t = i_(),
+ canvas: t = s_(),
context: n = null,
depth: s = !0,
stencil: r = !1,
@@ -23578,7 +23578,7 @@ class eg {
let D = 0, O = t.width, Y = t.height, Q = 1, J = null, ee = null;
const ae = new mt(0, 0, O, Y), _e = new mt(0, 0, O, Y);
let Me = !1;
- const se = new qf();
+ const se = new jf();
let me = !1, xe = !1;
const be = new Ne(), Ue = new Ne(), et = new G(), He = new mt(), St = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 };
let ht = !1;
@@ -23610,10 +23610,10 @@ class eg {
}
let pt, gt, We, Dt, ze, L, M, Z, le, pe, oe, Qe, ve, qe, Je, Ee, Re, Oe, Ge, Be, tt, Ke, nt, W;
function ne() {
- pt = new LI(H), pt.init(), Ke = new m1(H, pt), gt = new MI(H, pt, e, Ke), We = new A1(H, pt), gt.reverseDepthBuffer && d && We.buffers.depth.setReversed(!0), Dt = new UI(H), ze = new n1(), L = new g1(H, pt, We, ze, gt, Ke, Dt), M = new TI(E), Z = new DI(E), le = new Vw(H), nt = new II(H, le), pe = new PI(H, le, Dt, nt), oe = new QI(H, pe, le, Dt), Ge = new OI(H, gt, L), Ee = new BI(ze), Qe = new t1(E, M, Z, pt, gt, nt, Ee), ve = new w1(E, ze), qe = new s1(), Je = new h1(pt), Oe = new CI(E, M, Z, We, oe, f, c), Re = new f1(E, oe, gt), W = new v1(H, Dt, gt, We), Be = new SI(H, pt, Dt), tt = new kI(H, pt, Dt), Dt.programs = Qe.programs, E.capabilities = gt, E.extensions = pt, E.properties = ze, E.renderLists = qe, E.shadowMap = Re, E.state = We, E.info = Dt;
+ pt = new PI(H), pt.init(), Ke = new x1(H, pt), gt = new BI(H, pt, e, Ke), We = new g1(H, pt), gt.reverseDepthBuffer && d && We.buffers.depth.setReversed(!0), Dt = new OI(H), ze = new i1(), L = new m1(H, pt, We, ze, gt, Ke, Dt), M = new RI(E), Z = new LI(E), le = new Ww(H), nt = new SI(H, le), pe = new kI(H, le, Dt, nt), oe = new GI(H, pe, le, Dt), Ge = new QI(H, gt, L), Ee = new TI(ze), Qe = new n1(E, M, Z, pt, gt, nt, Ee), ve = new v1(E, ze), qe = new r1(), Je = new u1(pt), Oe = new II(E, M, Z, We, oe, f, c), Re = new p1(E, oe, gt), W = new C1(H, Dt, gt, We), Be = new MI(H, pt, Dt), tt = new UI(H, pt, Dt), Dt.programs = Qe.programs, E.capabilities = gt, E.extensions = pt, E.properties = ze, E.renderLists = qe, E.shadowMap = Re, E.state = We, E.info = Dt;
}
ne();
- const re = new y1(E, H);
+ const re = new _1(E, H);
this.xr = re, this.getContext = function() {
return H;
}, this.getContextAttributes = function() {
@@ -23672,10 +23672,10 @@ class eg {
let P = !1;
if (T !== null) {
const z = T.texture.format;
- P = z === Qf || z === Of || z === Uf;
+ P = z === Hf || z === Gf || z === Qf;
}
if (P) {
- const z = T.texture.type, j = z === un || z === Tr || z === Qo || z === Go || z === Pf || z === kf, X = Oe.getClearColor(), ie = Oe.getClearAlpha(), he = X.r, ce = X.g, fe = X.b;
+ const z = T.texture.type, j = z === un || z === Tr || z === Go || z === Ho || z === Uf || z === Of, X = Oe.getClearColor(), ie = Oe.getClearAlpha(), he = X.r, ce = X.g, fe = X.b;
j ? (p[0] = he, p[1] = ce, p[2] = fe, p[3] = ie, H.clearBufferuiv(H.COLOR, 0, p)) : (m[0] = he, m[1] = ce, m[2] = fe, m[3] = ie, H.clearBufferiv(H.COLOR, 0, m));
} else
U |= H.COLOR_BUFFER_BIT;
@@ -23688,7 +23688,7 @@ class eg {
}, this.clearStencil = function() {
this.clear(!1, !1, !0);
}, this.dispose = function() {
- t.removeEventListener("webglcontextlost", de, !1), t.removeEventListener("webglcontextrestored", Se, !1), t.removeEventListener("webglcontextcreationerror", Ce, !1), Oe.dispose(), qe.dispose(), Je.dispose(), ze.dispose(), M.dispose(), Z.dispose(), oe.dispose(), nt.dispose(), W.dispose(), Qe.dispose(), re.dispose(), re.removeEventListener("sessionstart", _c), re.removeEventListener("sessionend", wc), Wi.stop();
+ t.removeEventListener("webglcontextlost", de, !1), t.removeEventListener("webglcontextrestored", Se, !1), t.removeEventListener("webglcontextcreationerror", Ce, !1), Oe.dispose(), qe.dispose(), Je.dispose(), ze.dispose(), M.dispose(), Z.dispose(), oe.dispose(), nt.dispose(), W.dispose(), Qe.dispose(), re.dispose(), re.removeEventListener("sessionstart", wc), re.removeEventListener("sessionend", vc), qi.stop();
};
function de(y) {
y.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), S = !0;
@@ -23716,7 +23716,7 @@ class eg {
}
this.renderBufferDirect = function(y, R, N, U, P, z) {
R === null && (R = St);
- const j = P.isMesh && P.matrixWorld.determinant() < 0, X = Uh(y, R, N, U, P);
+ const j = P.isMesh && P.matrixWorld.determinant() < 0, X = Qh(y, R, N, U, P);
We.setMaterial(U, j);
let ie = N.index, he = 1;
if (U.wireframe === !0) {
@@ -23738,7 +23738,7 @@ class eg {
} else P.isPoints ? Ve.setMode(H.POINTS) : P.isSprite && Ve.setMode(H.TRIANGLES);
if (P.isBatchedMesh)
if (P._multiDrawInstances !== null)
- Sl("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."), Ve.renderMultiDrawInstances(P._multiDrawStarts, P._multiDrawCounts, P._multiDrawCount, P._multiDrawInstances);
+ Bl("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."), Ve.renderMultiDrawInstances(P._multiDrawStarts, P._multiDrawCounts, P._multiDrawCount, P._multiDrawInstances);
else if (pt.get("WEBGL_multi_draw"))
Ve.renderMultiDraw(P._multiDrawStarts, P._multiDrawCounts, P._multiDrawCount);
else {
@@ -23755,7 +23755,7 @@ class eg {
Ve.render(Ae, Pe);
};
function Ct(y, R, N) {
- y.transparent === !0 && y.side === Ui && y.forceSinglePass === !1 ? (y.side = Vn, y.needsUpdate = !0, Wr(y, R, N), y.side = bs, y.needsUpdate = !0, Wr(y, R, N), y.side = Ui) : Wr(y, R, N);
+ y.transparent === !0 && y.side === Oi && y.forceSinglePass === !1 ? (y.side = Wn, y.needsUpdate = !0, Wr(y, R, N), y.side = bs, y.needsUpdate = !0, Wr(y, R, N), y.side = Oi) : Wr(y, R, N);
}
this.compile = function(y, R, N = null) {
N === null && (N = y), A = Je.get(N), A.init(R), x.push(A), N.traverseVisible(function(P) {
@@ -23792,20 +23792,20 @@ class eg {
pt.get("KHR_parallel_shader_compile") !== null ? z() : setTimeout(z, 10);
});
};
- let Yn = null;
- function Ai(y) {
- Yn && Yn(y);
- }
- function _c() {
- Wi.stop();
+ let Jn = null;
+ function gi(y) {
+ Jn && Jn(y);
}
function wc() {
- Wi.start();
+ qi.stop();
}
- const Wi = new J0();
- Wi.setAnimationLoop(Ai), typeof self < "u" && Wi.setContext(self), this.setAnimationLoop = function(y) {
- Yn = y, re.setAnimationLoop(y), y === null ? Wi.stop() : Wi.start();
- }, re.addEventListener("sessionstart", _c), re.addEventListener("sessionend", wc), this.render = function(y, R) {
+ function vc() {
+ qi.start();
+ }
+ const qi = new Z0();
+ qi.setAnimationLoop(gi), typeof self < "u" && qi.setContext(self), this.setAnimationLoop = function(y) {
+ Jn = y, re.setAnimationLoop(y), y === null ? qi.stop() : qi.start();
+ }, re.addEventListener("sessionstart", wc), re.addEventListener("sessionend", vc), this.render = function(y, R) {
if (R !== void 0 && R.isCamera !== !0) {
console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
return;
@@ -23813,9 +23813,9 @@ class eg {
if (S === !0) return;
if (y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), R.parent === null && R.matrixWorldAutoUpdate === !0 && R.updateMatrixWorld(), re.enabled === !0 && re.isPresenting === !0 && (re.cameraAutoUpdate === !0 && re.updateCamera(R), R = re.getCamera()), y.isScene === !0 && y.onBeforeRender(E, y, R, T), A = Je.get(y, x.length), A.init(R), x.push(A), Ue.multiplyMatrices(R.projectionMatrix, R.matrixWorldInverse), se.setFromProjectionMatrix(Ue), xe = this.localClippingEnabled, me = Ee.init(this.clippingPlanes, xe), g = qe.get(y, _.length), g.init(), _.push(g), re.enabled === !0 && re.isPresenting === !0) {
const z = E.xr.getDepthSensingMesh();
- z !== null && $a(z, R, -1 / 0, E.sortObjects);
+ z !== null && eo(z, R, -1 / 0, E.sortObjects);
}
- $a(y, R, 0, E.sortObjects), g.finish(), E.sortObjects === !0 && g.sort(J, ee), ht = re.enabled === !1 || re.isPresenting === !1 || re.hasDepthSensing() === !1, ht && Oe.addToRenderList(g, y), this.info.render.frame++, me === !0 && Ee.beginShadows();
+ eo(y, R, 0, E.sortObjects), g.finish(), E.sortObjects === !0 && g.sort(J, ee), ht = re.enabled === !1 || re.isPresenting === !1 || re.hasDepthSensing() === !1, ht && Oe.addToRenderList(g, y), this.info.render.frame++, me === !0 && Ee.beginShadows();
const N = A.state.shadowsArray;
Re.render(N, y, R), me === !0 && Ee.endShadows(), this.info.autoReset === !0 && this.info.reset();
const U = g.opaque, P = g.transmissive;
@@ -23824,18 +23824,18 @@ class eg {
if (P.length > 0)
for (let j = 0, X = z.length; j < X; j++) {
const ie = z[j];
- vc(U, P, y, ie);
+ Cc(U, P, y, ie);
}
ht && Oe.render(y);
for (let j = 0, X = z.length; j < X; j++) {
const ie = z[j];
- eo(g, y, ie, ie.viewport);
+ to(g, y, ie, ie.viewport);
}
} else
- P.length > 0 && vc(U, P, y, R), ht && Oe.render(y), eo(g, y, R);
+ P.length > 0 && Cc(U, P, y, R), ht && Oe.render(y), to(g, y, R);
T !== null && I === 0 && (L.updateMultisampleRenderTarget(T), L.updateRenderTargetMipmap(T)), y.isScene === !0 && y.onAfterRender(E, y, R), nt.resetDefaultState(), C = -1, v = null, x.pop(), x.length > 0 ? (A = x[x.length - 1], me === !0 && Ee.setGlobalState(E.clippingPlanes, A.state.camera)) : A = null, _.pop(), _.length > 0 ? g = _[_.length - 1] : g = null;
};
- function $a(y, R, N, U) {
+ function eo(y, R, N, U) {
if (y.visible === !1) return;
if (y.layers.test(R.layers)) {
if (y.isGroup)
@@ -23863,19 +23863,19 @@ class eg {
}
const z = y.children;
for (let j = 0, X = z.length; j < X; j++)
- $a(z[j], R, N, U);
+ eo(z[j], R, N, U);
}
- function eo(y, R, N, U) {
+ function to(y, R, N, U) {
const P = y.opaque, z = y.transmissive, j = y.transparent;
A.setupLightsView(N), me === !0 && Ee.setGlobalState(E.clippingPlanes, N), U && We.viewport(F.copy(U)), P.length > 0 && Vr(P, R, N), z.length > 0 && Vr(z, R, N), j.length > 0 && Vr(j, R, N), We.buffers.depth.setTest(!0), We.buffers.depth.setMask(!0), We.buffers.color.setMask(!0), We.setPolygonOffset(!1);
}
- function vc(y, R, N, U) {
+ function Cc(y, R, N, U) {
if ((N.isScene === !0 ? N.overrideMaterial : null) !== null)
return;
A.state.transmissionRenderTarget[U.id] === void 0 && (A.state.transmissionRenderTarget[U.id] = new Rr(1, 1, {
generateMipmaps: !0,
- type: pt.has("EXT_color_buffer_half_float") || pt.has("EXT_color_buffer_float") ? Qn : un,
- minFilter: hi,
+ type: pt.has("EXT_color_buffer_half_float") || pt.has("EXT_color_buffer_float") ? Gn : un,
+ minFilter: ui,
samples: 4,
stencilBuffer: r,
resolveDepthBuffer: !1,
@@ -23893,9 +23893,9 @@ class eg {
let ce = !1;
for (let fe = 0, Ae = R.length; fe < Ae; fe++) {
const ye = R[fe], Pe = ye.object, je = ye.geometry, Ve = ye.material, Fe = ye.group;
- if (Ve.side === Ui && Pe.layers.test(U.layers)) {
+ if (Ve.side === Oi && Pe.layers.test(U.layers)) {
const st = Ve.side;
- Ve.side = Vn, Ve.needsUpdate = !0, Cc(Pe, N, U, je, Ve, Fe), Ve.side = st, Ve.needsUpdate = !0, ce = !0;
+ Ve.side = Wn, Ve.needsUpdate = !0, Ic(Pe, N, U, je, Ve, Fe), Ve.side = st, Ve.needsUpdate = !0, ce = !0;
}
}
ce === !0 && (L.updateMultisampleRenderTarget(z), L.updateRenderTargetMipmap(z));
@@ -23907,11 +23907,11 @@ class eg {
for (let P = 0, z = y.length; P < z; P++) {
const j = y[P], X = j.object, ie = j.geometry, he = j.group;
let ce = j.material;
- ce.allowOverride === !0 && U !== null && (ce = U), X.layers.test(N.layers) && Cc(X, R, N, ie, ce, he);
+ ce.allowOverride === !0 && U !== null && (ce = U), X.layers.test(N.layers) && Ic(X, R, N, ie, ce, he);
}
}
- function Cc(y, R, N, U, P, z) {
- y.onBeforeRender(E, R, N, U, P, z), y.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse, y.matrixWorld), y.normalMatrix.getNormalMatrix(y.modelViewMatrix), P.onBeforeRender(E, R, N, U, y, z), P.transparent === !0 && P.side === Ui && P.forceSinglePass === !1 ? (P.side = Vn, P.needsUpdate = !0, E.renderBufferDirect(N, R, U, P, y, z), P.side = bs, P.needsUpdate = !0, E.renderBufferDirect(N, R, U, P, y, z), P.side = Ui) : E.renderBufferDirect(N, R, U, P, y, z), y.onAfterRender(E, R, N, U, P, z);
+ function Ic(y, R, N, U, P, z) {
+ y.onBeforeRender(E, R, N, U, P, z), y.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse, y.matrixWorld), y.normalMatrix.getNormalMatrix(y.modelViewMatrix), P.onBeforeRender(E, R, N, U, y, z), P.transparent === !0 && P.side === Oi && P.forceSinglePass === !1 ? (P.side = Wn, P.needsUpdate = !0, E.renderBufferDirect(N, R, U, P, y, z), P.side = bs, P.needsUpdate = !0, E.renderBufferDirect(N, R, U, P, y, z), P.side = Oi) : E.renderBufferDirect(N, R, U, P, y, z), y.onAfterRender(E, R, N, U, P, z);
}
function Wr(y, R, N) {
R.isScene !== !0 && (R = St);
@@ -23921,24 +23921,24 @@ class eg {
let ce = he.get(ie);
if (ce !== void 0) {
if (U.currentProgram === ce && U.lightsStateVersion === j)
- return no(y, X), ce;
+ return io(y, X), ce;
} else
X.uniforms = Qe.getUniforms(y), y.onBeforeCompile(X, E), ce = Qe.acquireProgram(X, ie), he.set(ie, ce), U.uniforms = X.uniforms;
const fe = U.uniforms;
- return (!y.isShaderMaterial && !y.isRawShaderMaterial || y.clipping === !0) && (fe.clippingPlanes = Ee.uniform), no(y, X), U.needsLights = ws(y), U.lightsStateVersion = j, U.needsLights && (fe.ambientLightColor.value = P.state.ambient, fe.lightProbe.value = P.state.probe, fe.directionalLights.value = P.state.directional, fe.directionalLightShadows.value = P.state.directionalShadow, fe.spotLights.value = P.state.spot, fe.spotLightShadows.value = P.state.spotShadow, fe.rectAreaLights.value = P.state.rectArea, fe.ltc_1.value = P.state.rectAreaLTC1, fe.ltc_2.value = P.state.rectAreaLTC2, fe.pointLights.value = P.state.point, fe.pointLightShadows.value = P.state.pointShadow, fe.hemisphereLights.value = P.state.hemi, fe.directionalShadowMap.value = P.state.directionalShadowMap, fe.directionalShadowMatrix.value = P.state.directionalShadowMatrix, fe.spotShadowMap.value = P.state.spotShadowMap, fe.spotLightMatrix.value = P.state.spotLightMatrix, fe.spotLightMap.value = P.state.spotLightMap, fe.pointShadowMap.value = P.state.pointShadowMap, fe.pointShadowMatrix.value = P.state.pointShadowMatrix), U.currentProgram = ce, U.uniformsList = null, ce;
+ return (!y.isShaderMaterial && !y.isRawShaderMaterial || y.clipping === !0) && (fe.clippingPlanes = Ee.uniform), io(y, X), U.needsLights = ws(y), U.lightsStateVersion = j, U.needsLights && (fe.ambientLightColor.value = P.state.ambient, fe.lightProbe.value = P.state.probe, fe.directionalLights.value = P.state.directional, fe.directionalLightShadows.value = P.state.directionalShadow, fe.spotLights.value = P.state.spot, fe.spotLightShadows.value = P.state.spotShadow, fe.rectAreaLights.value = P.state.rectArea, fe.ltc_1.value = P.state.rectAreaLTC1, fe.ltc_2.value = P.state.rectAreaLTC2, fe.pointLights.value = P.state.point, fe.pointLightShadows.value = P.state.pointShadow, fe.hemisphereLights.value = P.state.hemi, fe.directionalShadowMap.value = P.state.directionalShadowMap, fe.directionalShadowMatrix.value = P.state.directionalShadowMatrix, fe.spotShadowMap.value = P.state.spotShadowMap, fe.spotLightMatrix.value = P.state.spotLightMatrix, fe.spotLightMap.value = P.state.spotLightMap, fe.pointShadowMap.value = P.state.pointShadowMap, fe.pointShadowMatrix.value = P.state.pointShadowMatrix), U.currentProgram = ce, U.uniformsList = null, ce;
}
- function to(y) {
+ function no(y) {
if (y.uniformsList === null) {
const R = y.currentProgram.getUniforms();
- y.uniformsList = Ml.seqWithValue(R.seq, y.uniforms);
+ y.uniformsList = Tl.seqWithValue(R.seq, y.uniforms);
}
return y.uniformsList;
}
- function no(y, R) {
+ function io(y, R) {
const N = ze.get(y);
N.outputColorSpace = R.outputColorSpace, N.batching = R.batching, N.batchingColor = R.batchingColor, N.instancing = R.instancing, N.instancingColor = R.instancingColor, N.instancingMorph = R.instancingMorph, N.skinning = R.skinning, N.morphTargets = R.morphTargets, N.morphNormals = R.morphNormals, N.morphColors = R.morphColors, N.morphTargetsCount = R.morphTargetsCount, N.numClippingPlanes = R.numClippingPlanes, N.numIntersection = R.numClipIntersection, N.vertexAlphas = R.vertexAlphas, N.vertexTangents = R.vertexTangents, N.toneMapping = R.toneMapping;
}
- function Uh(y, R, N, U, P) {
+ function Qh(y, R, N, U, P) {
R.isScene !== !0 && (R = St), L.resetTextureUnits();
const z = R.fog, j = U.isMeshStandardMaterial ? R.environment : null, X = T === null ? E.outputColorSpace : T.isXRRenderTarget === !0 ? T.texture.colorSpace : An, ie = (U.isMeshStandardMaterial ? Z : M).get(U.envMap || j), he = U.vertexColors === !0 && !!N.attributes.color && N.attributes.color.itemSize === 4, ce = !!N.attributes.tangent && (!!U.normalMap || U.anisotropy > 0), fe = !!N.morphAttributes.position, Ae = !!N.morphAttributes.normal, ye = !!N.morphAttributes.color;
let Pe = Hs;
@@ -23955,7 +23955,7 @@ class eg {
let on = !1, wt = !1, xt = !1;
const Xe = It.getUniforms(), qt = Fe.uniforms;
if (We.useProgram(It.program) && (on = !0, wt = !0, xt = !0), U.id !== C && (C = U.id, wt = !0), on || v !== y) {
- We.buffers.depth.getReversed() ? (be.copy(y.projectionMatrix), r_(be), a_(be), Xe.setValue(H, "projectionMatrix", be)) : Xe.setValue(H, "projectionMatrix", y.projectionMatrix), Xe.setValue(H, "viewMatrix", y.matrixWorldInverse);
+ We.buffers.depth.getReversed() ? (be.copy(y.projectionMatrix), a_(be), o_(be), Xe.setValue(H, "projectionMatrix", be)) : Xe.setValue(H, "projectionMatrix", y.projectionMatrix), Xe.setValue(H, "viewMatrix", y.matrixWorldInverse);
const cn = Xe.map.cameraPosition;
cn !== void 0 && cn.setValue(H, et.setFromMatrixPosition(y.matrixWorld)), gt.logarithmicDepthBuffer && Xe.setValue(
H,
@@ -23970,16 +23970,16 @@ class eg {
}
P.isBatchedMesh && (Xe.setOptional(H, P, "batchingTexture"), Xe.setValue(H, "batchingTexture", P._matricesTexture, L), Xe.setOptional(H, P, "batchingIdTexture"), Xe.setValue(H, "batchingIdTexture", P._indirectTexture, L), Xe.setOptional(H, P, "batchingColorTexture"), P._colorsTexture !== null && Xe.setValue(H, "batchingColorTexture", P._colorsTexture, L));
const En = N.morphAttributes;
- if ((En.position !== void 0 || En.normal !== void 0 || En.color !== void 0) && Ge.update(P, N, It), (wt || Fe.receiveShadow !== P.receiveShadow) && (Fe.receiveShadow = P.receiveShadow, Xe.setValue(H, "receiveShadow", P.receiveShadow)), U.isMeshGouraudMaterial && U.envMap !== null && (qt.envMap.value = ie, qt.flipEnvMap.value = ie.isCubeTexture && ie.isRenderTargetTexture === !1 ? -1 : 1), U.isMeshStandardMaterial && U.envMap === null && R.environment !== null && (qt.envMapIntensity.value = R.environmentIntensity), wt && (Xe.setValue(H, "toneMappingExposure", E.toneMappingExposure), Fe.needsLights && qi(qt, xt), z && U.fog === !0 && ve.refreshFogUniforms(qt, z), ve.refreshMaterialUniforms(qt, U, Q, Y, A.state.transmissionRenderTarget[y.id]), Ml.upload(H, to(Fe), qt, L)), U.isShaderMaterial && U.uniformsNeedUpdate === !0 && (Ml.upload(H, to(Fe), qt, L), U.uniformsNeedUpdate = !1), U.isSpriteMaterial && Xe.setValue(H, "center", P.center), Xe.setValue(H, "modelViewMatrix", P.modelViewMatrix), Xe.setValue(H, "normalMatrix", P.normalMatrix), Xe.setValue(H, "modelMatrix", P.matrixWorld), U.isShaderMaterial || U.isRawShaderMaterial) {
+ if ((En.position !== void 0 || En.normal !== void 0 || En.color !== void 0) && Ge.update(P, N, It), (wt || Fe.receiveShadow !== P.receiveShadow) && (Fe.receiveShadow = P.receiveShadow, Xe.setValue(H, "receiveShadow", P.receiveShadow)), U.isMeshGouraudMaterial && U.envMap !== null && (qt.envMap.value = ie, qt.flipEnvMap.value = ie.isCubeTexture && ie.isRenderTargetTexture === !1 ? -1 : 1), U.isMeshStandardMaterial && U.envMap === null && R.environment !== null && (qt.envMapIntensity.value = R.environmentIntensity), wt && (Xe.setValue(H, "toneMappingExposure", E.toneMappingExposure), Fe.needsLights && Ki(qt, xt), z && U.fog === !0 && ve.refreshFogUniforms(qt, z), ve.refreshMaterialUniforms(qt, U, Q, Y, A.state.transmissionRenderTarget[y.id]), Tl.upload(H, no(Fe), qt, L)), U.isShaderMaterial && U.uniformsNeedUpdate === !0 && (Tl.upload(H, no(Fe), qt, L), U.uniformsNeedUpdate = !1), U.isSpriteMaterial && Xe.setValue(H, "center", P.center), Xe.setValue(H, "modelViewMatrix", P.modelViewMatrix), Xe.setValue(H, "normalMatrix", P.normalMatrix), Xe.setValue(H, "modelMatrix", P.matrixWorld), U.isShaderMaterial || U.isRawShaderMaterial) {
const Lt = U.uniformsGroups;
- for (let cn = 0, Oh = Lt.length; cn < Oh; cn++) {
+ for (let cn = 0, Gh = Lt.length; cn < Gh; cn++) {
const tr = Lt[cn];
W.update(tr, It), W.bind(tr, It);
}
}
return It;
}
- function qi(y, R) {
+ function Ki(y, R) {
y.ambientLightColor.needsUpdate = R, y.lightProbe.needsUpdate = R, y.directionalLights.needsUpdate = R, y.directionalLightShadows.needsUpdate = R, y.pointLights.needsUpdate = R, y.pointLightShadows.needsUpdate = R, y.spotLights.needsUpdate = R, y.spotLightShadows.needsUpdate = R, y.rectAreaLights.needsUpdate = R, y.hemisphereLights.needsUpdate = R;
}
function ws(y) {
@@ -24076,7 +24076,7 @@ class eg {
const Ae = T !== null ? ze.get(T).__webglFramebuffer : null;
We.bindFramebuffer(H.FRAMEBUFFER, Ae);
const ye = H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE, 0);
- return H.flush(), await s_(H, ye, 4), H.bindBuffer(H.PIXEL_PACK_BUFFER, fe), H.getBufferSubData(H.PIXEL_PACK_BUFFER, 0, z), H.deleteBuffer(fe), H.deleteSync(ye), z;
+ return H.flush(), await r_(H, ye, 4), H.bindBuffer(H.PIXEL_PACK_BUFFER, fe), H.getBufferSubData(H.PIXEL_PACK_BUFFER, 0, z), H.deleteBuffer(fe), H.deleteSync(ye), z;
} else
throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");
}, this.copyFramebufferToTexture = function(y, R = null, N = 0) {
@@ -24085,7 +24085,7 @@ class eg {
};
const B = H.createFramebuffer(), k = H.createFramebuffer();
this.copyTextureToTexture = function(y, R, N = null, U = null, P = 0, z = null) {
- z === null && (P !== 0 ? (Sl("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."), z = P, P = 0) : z = 0);
+ z === null && (P !== 0 ? (Bl("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."), z = P, P = 0) : z = 0);
let j, X, ie, he, ce, fe, Ae, ye, Pe;
const je = y.isCompressedTexture ? y.mipmaps[z] : y.image;
if (N !== null)
@@ -24102,8 +24102,8 @@ class eg {
H.pixelStorei(H.UNPACK_ROW_LENGTH, je.width), H.pixelStorei(H.UNPACK_IMAGE_HEIGHT, je.height), H.pixelStorei(H.UNPACK_SKIP_PIXELS, he), H.pixelStorei(H.UNPACK_SKIP_ROWS, ce), H.pixelStorei(H.UNPACK_SKIP_IMAGES, fe);
const Xe = y.isDataArrayTexture || y.isData3DTexture, qt = R.isDataArrayTexture || R.isData3DTexture;
if (y.isDepthTexture) {
- const En = ze.get(y), Lt = ze.get(R), cn = ze.get(En.__renderTarget), Oh = ze.get(Lt.__renderTarget);
- We.bindFramebuffer(H.READ_FRAMEBUFFER, cn.__webglFramebuffer), We.bindFramebuffer(H.DRAW_FRAMEBUFFER, Oh.__webglFramebuffer);
+ const En = ze.get(y), Lt = ze.get(R), cn = ze.get(En.__renderTarget), Gh = ze.get(Lt.__renderTarget);
+ We.bindFramebuffer(H.READ_FRAMEBUFFER, cn.__webglFramebuffer), We.bindFramebuffer(H.DRAW_FRAMEBUFFER, Gh.__webglFramebuffer);
for (let tr = 0; tr < ie; tr++)
Xe && (H.framebufferTextureLayer(H.READ_FRAMEBUFFER, H.COLOR_ATTACHMENT0, ze.get(y).__webglTexture, P, fe + tr), H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER, H.COLOR_ATTACHMENT0, ze.get(R).__webglTexture, z, Pe + tr)), H.blitFramebuffer(he, ce, j, X, Ae, ye, j, X, H.DEPTH_BUFFER_BIT, H.NEAREST);
We.bindFramebuffer(H.READ_FRAMEBUFFER, null), We.bindFramebuffer(H.DRAW_FRAMEBUFFER, null);
@@ -24117,7 +24117,7 @@ class eg {
qt ? y.isDataTexture || y.isData3DTexture ? H.texSubImage3D(st, z, Ae, ye, Pe, j, X, ie, Ve, Fe, je.data) : R.isCompressedArrayTexture ? H.compressedTexSubImage3D(st, z, Ae, ye, Pe, j, X, ie, Ve, je.data) : H.texSubImage3D(st, z, Ae, ye, Pe, j, X, ie, Ve, Fe, je) : y.isDataTexture ? H.texSubImage2D(H.TEXTURE_2D, z, Ae, ye, j, X, Ve, Fe, je.data) : y.isCompressedTexture ? H.compressedTexSubImage2D(H.TEXTURE_2D, z, Ae, ye, je.width, je.height, Ve, je.data) : H.texSubImage2D(H.TEXTURE_2D, z, Ae, ye, j, X, Ve, Fe, je);
H.pixelStorei(H.UNPACK_ROW_LENGTH, ke), H.pixelStorei(H.UNPACK_IMAGE_HEIGHT, It), H.pixelStorei(H.UNPACK_SKIP_PIXELS, on), H.pixelStorei(H.UNPACK_SKIP_ROWS, wt), H.pixelStorei(H.UNPACK_SKIP_IMAGES, xt), z === 0 && R.generateMipmaps && H.generateMipmap(st), We.unbindTexture();
}, this.copyTextureToTexture3D = function(y, R, N = null, U = null, P = 0) {
- return Sl('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'), this.copyTextureToTexture(y, R, N, U, P);
+ return Bl('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'), this.copyTextureToTexture(y, R, N, U, P);
}, this.initRenderTarget = function(y) {
ze.get(y).__webglFramebuffer === void 0 && L.setupRenderTarget(y);
}, this.initTexture = function(y) {
@@ -24153,7 +24153,7 @@ class eg {
t.drawingBufferColorSpace = rt._getDrawingBufferColorSpace(e), t.unpackColorSpace = rt._getUnpackColorSpace();
}
}
-var Do = function() {
+var Lo = function() {
var i = 0, e = document.createElement("div");
e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e.addEventListener("click", function(h) {
h.preventDefault(), n(++i % e.children.length);
@@ -24166,9 +24166,9 @@ var Do = function() {
e.children[u].style.display = u === h ? "block" : "none";
i = h;
}
- var s = (performance || Date).now(), r = s, a = 0, o = t(new Do.Panel("FPS", "#0ff", "#002")), c = t(new Do.Panel("MS", "#0f0", "#020"));
+ var s = (performance || Date).now(), r = s, a = 0, o = t(new Lo.Panel("FPS", "#0ff", "#002")), c = t(new Lo.Panel("MS", "#0f0", "#020"));
if (self.performance && self.performance.memory)
- var l = t(new Do.Panel("MB", "#f08", "#201"));
+ var l = t(new Lo.Panel("MB", "#f08", "#201"));
return n(0), {
REVISION: 16,
dom: e,
@@ -24194,7 +24194,7 @@ var Do = function() {
setMode: n
};
};
-Do.Panel = function(i, e, t) {
+Lo.Panel = function(i, e, t) {
var n = 1 / 0, s = 0, r = Math.round, a = r(window.devicePixelRatio || 1), o = 80 * a, c = 48 * a, l = 3 * a, h = 2 * a, u = 3 * a, d = 15 * a, f = 74 * a, p = 30 * a, m = document.createElement("canvas");
m.width = o, m.height = c, m.style.cssText = "width:80px;height:48px";
var g = m.getContext("2d");
@@ -24205,10 +24205,10 @@ Do.Panel = function(i, e, t) {
}
};
};
-function tg(i, e) {
- if (e === Ty)
+function ig(i, e) {
+ if (e === Ry)
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), i;
- if (e === Ud || e === v0) {
+ if (e === Qd || e === C0) {
let t = i.getIndex();
if (t === null) {
const a = [], o = i.getAttribute("position");
@@ -24220,7 +24220,7 @@ function tg(i, e) {
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), i;
}
const n = t.count - 2, s = [];
- if (e === Ud)
+ if (e === Qd)
for (let a = 1; a <= n; a++)
s.push(t.getX(0)), s.push(t.getX(a)), s.push(t.getX(a + 1));
else
@@ -24232,7 +24232,7 @@ function tg(i, e) {
} else
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), i;
}
-class tp extends fi {
+class ip extends pi {
/**
* Constructs a new glTF loader.
*
@@ -24240,39 +24240,39 @@ class tp extends fi {
*/
constructor(e) {
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
- return new B1(t);
- }), this.register(function(t) {
return new T1(t);
}), this.register(function(t) {
- return new O1(t);
+ return new R1(t);
}), this.register(function(t) {
return new Q1(t);
}), this.register(function(t) {
return new G1(t);
}), this.register(function(t) {
- return new F1(t);
+ return new H1(t);
}), this.register(function(t) {
return new N1(t);
}), this.register(function(t) {
return new D1(t);
}), this.register(function(t) {
return new L1(t);
- }), this.register(function(t) {
- return new M1(t);
}), this.register(function(t) {
return new P1(t);
}), this.register(function(t) {
- return new R1(t);
- }), this.register(function(t) {
- return new U1(t);
+ return new B1(t);
}), this.register(function(t) {
return new k1(t);
}), this.register(function(t) {
- return new I1(t);
+ return new F1(t);
}), this.register(function(t) {
- return new H1(t);
+ return new O1(t);
+ }), this.register(function(t) {
+ return new U1(t);
+ }), this.register(function(t) {
+ return new S1(t);
}), this.register(function(t) {
return new z1(t);
+ }), this.register(function(t) {
+ return new V1(t);
});
}
/**
@@ -24372,9 +24372,9 @@ class tp extends fi {
if (typeof e == "string")
r = JSON.parse(e);
else if (e instanceof ArrayBuffer)
- if (c.decode(new Uint8Array(e, 0, 4)) === nx) {
+ if (c.decode(new Uint8Array(e, 0, 4)) === ix) {
try {
- a[At.KHR_BINARY_GLTF] = new V1(e);
+ a[At.KHR_BINARY_GLTF] = new W1(e);
} catch (u) {
s && s(u);
return;
@@ -24388,7 +24388,7 @@ class tp extends fi {
s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
return;
}
- const l = new iM(r, {
+ const l = new sM(r, {
path: t || this.resourcePath || "",
crossOrigin: this.crossOrigin,
requestHeader: this.requestHeader,
@@ -24406,16 +24406,16 @@ class tp extends fi {
const u = r.extensionsUsed[h], d = r.extensionsRequired || [];
switch (u) {
case At.KHR_MATERIALS_UNLIT:
- a[u] = new S1();
+ a[u] = new M1();
break;
case At.KHR_DRACO_MESH_COMPRESSION:
- a[u] = new W1(r, this.dracoLoader);
+ a[u] = new q1(r, this.dracoLoader);
break;
case At.KHR_TEXTURE_TRANSFORM:
- a[u] = new q1();
+ a[u] = new K1();
break;
case At.KHR_MESH_QUANTIZATION:
- a[u] = new K1();
+ a[u] = new j1();
break;
default:
d.indexOf(u) >= 0 && o[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
@@ -24438,7 +24438,7 @@ class tp extends fi {
});
}
}
-function C1() {
+function I1() {
let i = {};
return {
get: function(e) {
@@ -24479,7 +24479,7 @@ const At = {
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
};
-class I1 {
+class S1 {
constructor(e) {
this.parser = e, this.name = At.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
}
@@ -24501,18 +24501,18 @@ class I1 {
const u = c.range !== void 0 ? c.range : 0;
switch (c.type) {
case "directional":
- l = new Jf(h), l.target.position.set(0, 0, -1), l.add(l.target);
+ l = new $f(h), l.target.position.set(0, 0, -1), l.add(l.target);
break;
case "point":
- l = new Xl(h), l.distance = u;
+ l = new Jl(h), l.distance = u;
break;
case "spot":
- l = new K0(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);
+ l = new j0(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), ts(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
+ return l.position.set(0, 0, 0), ns(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
}
getDependency(e, t) {
if (e === "light")
@@ -24525,7 +24525,7 @@ class I1 {
});
}
}
-class S1 {
+class M1 {
constructor() {
this.name = At.KHR_MATERIALS_UNLIT;
}
@@ -24546,7 +24546,7 @@ class S1 {
return Promise.all(s);
}
}
-class M1 {
+class B1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_EMISSIVE_STRENGTH;
}
@@ -24558,13 +24558,13 @@ class M1 {
return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
}
}
-class B1 {
+class T1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_CLEARCOAT;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24578,13 +24578,13 @@ class B1 {
return Promise.all(r);
}
}
-class T1 {
+class R1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_DISPERSION;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const s = this.parser.json.materials[e];
@@ -24594,13 +24594,13 @@ class T1 {
return t.dispersion = r.dispersion !== void 0 ? r.dispersion : 0, Promise.resolve();
}
}
-class R1 {
+class F1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_IRIDESCENCE;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24610,13 +24610,13 @@ class R1 {
return a.iridescenceFactor !== void 0 && (t.iridescence = a.iridescenceFactor), a.iridescenceTexture !== void 0 && r.push(n.assignTexture(t, "iridescenceMap", a.iridescenceTexture)), a.iridescenceIor !== void 0 && (t.iridescenceIOR = a.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), a.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = a.iridescenceThicknessMinimum), a.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = a.iridescenceThicknessMaximum), a.iridescenceThicknessTexture !== void 0 && r.push(n.assignTexture(t, "iridescenceThicknessMap", a.iridescenceThicknessTexture)), Promise.all(r);
}
}
-class F1 {
+class N1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_SHEEN;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24632,13 +24632,13 @@ class F1 {
return a.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = a.sheenRoughnessFactor), a.sheenColorTexture !== void 0 && r.push(n.assignTexture(t, "sheenColorMap", a.sheenColorTexture, _t)), a.sheenRoughnessTexture !== void 0 && r.push(n.assignTexture(t, "sheenRoughnessMap", a.sheenRoughnessTexture)), Promise.all(r);
}
}
-class N1 {
+class D1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_TRANSMISSION;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24648,13 +24648,13 @@ class N1 {
return a.transmissionFactor !== void 0 && (t.transmission = a.transmissionFactor), a.transmissionTexture !== void 0 && r.push(n.assignTexture(t, "transmissionMap", a.transmissionTexture)), Promise.all(r);
}
}
-class D1 {
+class L1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_VOLUME;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24666,13 +24666,13 @@ class D1 {
return t.attenuationColor = new Le().setRGB(o[0], o[1], o[2], An), Promise.all(r);
}
}
-class L1 {
+class P1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_IOR;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const s = this.parser.json.materials[e];
@@ -24682,13 +24682,13 @@ class L1 {
return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
}
}
-class P1 {
+class k1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_SPECULAR;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24700,13 +24700,13 @@ class P1 {
return t.specularColor = new Le().setRGB(o[0], o[1], o[2], An), a.specularColorTexture !== void 0 && r.push(n.assignTexture(t, "specularColorMap", a.specularColorTexture, _t)), Promise.all(r);
}
}
-class k1 {
+class U1 {
constructor(e) {
this.parser = e, this.name = At.EXT_MATERIALS_BUMP;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24716,13 +24716,13 @@ class k1 {
return t.bumpScale = a.bumpFactor !== void 0 ? a.bumpFactor : 1, a.bumpTexture !== void 0 && r.push(n.assignTexture(t, "bumpMap", a.bumpTexture)), Promise.all(r);
}
}
-class U1 {
+class O1 {
constructor(e) {
this.parser = e, this.name = At.KHR_MATERIALS_ANISOTROPY;
}
getMaterialType(e) {
const n = this.parser.json.materials[e];
- return !n.extensions || !n.extensions[this.name] ? null : Vi;
+ return !n.extensions || !n.extensions[this.name] ? null : Wi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24732,7 +24732,7 @@ class U1 {
return a.anisotropyStrength !== void 0 && (t.anisotropy = a.anisotropyStrength), a.anisotropyRotation !== void 0 && (t.anisotropyRotation = a.anisotropyRotation), a.anisotropyTexture !== void 0 && r.push(n.assignTexture(t, "anisotropyMap", a.anisotropyTexture)), Promise.all(r);
}
}
-class O1 {
+class Q1 {
constructor(e) {
this.parser = e, this.name = At.KHR_TEXTURE_BASISU;
}
@@ -24749,7 +24749,7 @@ class O1 {
return t.loadTextureImage(e, r.source, a);
}
}
-class Q1 {
+class G1 {
constructor(e) {
this.parser = e, this.name = At.EXT_TEXTURE_WEBP;
}
@@ -24766,7 +24766,7 @@ class Q1 {
return n.loadTextureImage(e, a.source, c);
}
}
-class G1 {
+class H1 {
constructor(e) {
this.parser = e, this.name = At.EXT_TEXTURE_AVIF;
}
@@ -24783,7 +24783,7 @@ class G1 {
return n.loadTextureImage(e, a.source, c);
}
}
-class H1 {
+class z1 {
constructor(e) {
this.name = At.EXT_MESHOPT_COMPRESSION, this.parser = e;
}
@@ -24809,7 +24809,7 @@ class H1 {
return null;
}
}
-class z1 {
+class V1 {
constructor(e) {
this.name = At.EXT_MESH_GPU_INSTANCING, this.parser = e;
}
@@ -24819,7 +24819,7 @@ class z1 {
return null;
const s = t.meshes[n.mesh];
for (const l of s.primitives)
- if (l.mode !== ri.TRIANGLES && l.mode !== ri.TRIANGLE_STRIP && l.mode !== ri.TRIANGLE_FAN && l.mode !== void 0)
+ if (l.mode !== ai.TRIANGLES && l.mode !== ai.TRIANGLE_STRIP && l.mode !== ai.TRIANGLE_FAN && l.mode !== void 0)
return null;
const a = n.extensions[this.name].attributes, o = [], c = {};
for (const l in a)
@@ -24827,13 +24827,13 @@ class z1 {
return o.length < 1 ? null : (o.push(this.parser.createNodeMesh(e)), Promise.all(o).then((l) => {
const h = l.pop(), u = h.isGroup ? h.children : [h], d = l[0].count, f = [];
for (const p of u) {
- const m = new Ne(), g = new G(), A = new Jt(), _ = new G(1, 1, 1), x = new P0(p.geometry, p.material, d);
+ const m = new Ne(), g = new G(), A = new Jt(), _ = new G(1, 1, 1), x = new k0(p.geometry, p.material, d);
for (let E = 0; E < d; E++)
c.TRANSLATION && g.fromBufferAttribute(c.TRANSLATION, E), c.ROTATION && A.fromBufferAttribute(c.ROTATION, E), c.SCALE && _.fromBufferAttribute(c.SCALE, E), x.setMatrixAt(E, m.compose(g, A, _));
for (const E in c)
if (E === "_COLOR_0") {
const S = c[E];
- x.instanceColor = new Gd(S.array, S.itemSize, S.normalized);
+ x.instanceColor = new zd(S.array, S.itemSize, S.normalized);
} else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E, c[E]);
Tt.prototype.copy.call(x, p), this.parser.assignFinalMaterial(x), f.push(x);
}
@@ -24841,30 +24841,30 @@ class z1 {
}));
}
}
-const nx = "glTF", uo = 12, ng = { JSON: 1313821514, BIN: 5130562 };
-class V1 {
+const ix = "glTF", fo = 12, sg = { JSON: 1313821514, BIN: 5130562 };
+class W1 {
constructor(e) {
this.name = At.KHR_BINARY_GLTF, this.content = null, this.body = null;
- const t = new DataView(e, 0, uo), n = new TextDecoder();
+ const t = new DataView(e, 0, fo), 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 !== nx)
+ }, this.header.magic !== ix)
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
if (this.header.version < 2)
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
- const s = this.header.length - uo, r = new DataView(e, uo);
+ const s = this.header.length - fo, r = new DataView(e, fo);
let a = 0;
for (; a < s; ) {
const o = r.getUint32(a, !0);
a += 4;
const c = r.getUint32(a, !0);
- if (a += 4, c === ng.JSON) {
- const l = new Uint8Array(e, uo + a, o);
+ if (a += 4, c === sg.JSON) {
+ const l = new Uint8Array(e, fo + a, o);
this.content = n.decode(l);
- } else if (c === ng.BIN) {
- const l = uo + a;
+ } else if (c === sg.BIN) {
+ const l = fo + a;
this.body = e.slice(l, l + o);
}
a += o;
@@ -24873,7 +24873,7 @@ class V1 {
throw new Error("THREE.GLTFLoader: JSON content not found.");
}
}
-class W1 {
+class q1 {
constructor(e, t) {
if (!t)
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
@@ -24882,13 +24882,13 @@ class W1 {
decodePrimitive(e, t) {
const n = this.json, s = this.dracoLoader, r = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, c = {}, l = {};
for (const h in a) {
- const u = Kd[h] || h.toLowerCase();
+ const u = Xd[h] || h.toLowerCase();
o[u] = a[h];
}
for (const h in e.attributes) {
- const u = Kd[h] || h.toLowerCase();
+ const u = Xd[h] || h.toLowerCase();
if (a[h] !== void 0) {
- const d = n.accessors[e.attributes[h]], f = Ia[d.componentType];
+ const d = n.accessors[e.attributes[h]], f = Sa[d.componentType];
l[u] = f.name, c[u] = d.normalized === !0;
}
}
@@ -24905,7 +24905,7 @@ class W1 {
});
}
}
-class q1 {
+class K1 {
constructor() {
this.name = At.KHR_TEXTURE_TRANSFORM;
}
@@ -24913,12 +24913,12 @@ class q1 {
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;
}
}
-class K1 {
+class j1 {
constructor() {
this.name = At.KHR_MESH_QUANTIZATION;
}
}
-class ix extends dc {
+class sx extends fc {
constructor(e, t, n, s) {
super(e, t, n, s);
}
@@ -24937,14 +24937,14 @@ class ix extends dc {
return r;
}
}
-const j1 = new Jt();
-class X1 extends ix {
+const X1 = new Jt();
+class Y1 extends sx {
interpolate_(e, t, n, s) {
const r = super.interpolate_(e, t, n, s);
- return j1.fromArray(r).normalize().toArray(r), r;
+ return X1.fromArray(r).normalize().toArray(r), r;
}
}
-const ri = {
+const ai = {
POINTS: 0,
LINES: 1,
LINE_LOOP: 2,
@@ -24952,25 +24952,25 @@ const ri = {
TRIANGLES: 4,
TRIANGLE_STRIP: 5,
TRIANGLE_FAN: 6
-}, Ia = {
+}, Sa = {
5120: Int8Array,
5121: Uint8Array,
5122: Int16Array,
5123: Uint16Array,
5125: Uint32Array,
5126: Float32Array
-}, ig = {
- 9728: Wn,
+}, rg = {
+ 9728: qn,
9729: Xt,
- 9984: A0,
- 9985: vl,
- 9986: yo,
- 9987: hi
-}, sg = {
- 33071: ti,
- 33648: Ll,
+ 9984: g0,
+ 9985: Il,
+ 9986: _o,
+ 9987: ui
+}, ag = {
+ 33071: ni,
+ 33648: kl,
10497: Ws
-}, Eu = {
+}, _u = {
SCALAR: 1,
VEC2: 2,
VEC3: 3,
@@ -24978,7 +24978,7 @@ const ri = {
MAT2: 4,
MAT3: 9,
MAT4: 16
-}, Kd = {
+}, Xd = {
POSITION: "position",
NORMAL: "normal",
TANGENT: "tangent",
@@ -24994,19 +24994,19 @@ const ri = {
translation: "position",
rotation: "quaternion",
weights: "morphTargetInfluences"
-}, Y1 = {
+}, J1 = {
CUBICSPLINE: void 0,
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
// keyframe track will be initialized with a default interpolation type, then modified.
- LINEAR: Ko,
- STEP: qo
-}, yu = {
+ LINEAR: jo,
+ STEP: Ko
+}, wu = {
OPAQUE: "OPAQUE",
MASK: "MASK",
BLEND: "BLEND"
};
-function J1(i) {
- return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new Zo({
+function Z1(i) {
+ return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new $o({
color: 16777215,
emissive: 0,
metalness: 1,
@@ -25020,10 +25020,10 @@ function cr(i, e, t) {
for (const n in t.extensions)
i[n] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[n] = t.extensions[n]);
}
-function ts(i, e) {
+function ns(i, e) {
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(i.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
}
-function Z1(i, e, t) {
+function $1(i, e, t) {
let n = !1, s = !1, r = !1;
for (let l = 0, h = e.length; l < h; l++) {
const u = e[l];
@@ -25055,7 +25055,7 @@ function Z1(i, e, t) {
return n && (i.morphAttributes.position = h), s && (i.morphAttributes.normal = u), r && (i.morphAttributes.color = d), i.morphTargetsRelative = !0, i;
});
}
-function $1(i, e) {
+function eM(i, e) {
if (i.updateMorphTargets(), e.weights !== void 0)
for (let t = 0, n = e.weights.length; t < n; t++)
i.morphTargetInfluences[t] = e.weights[t];
@@ -25069,22 +25069,22 @@ function $1(i, e) {
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
}
}
-function eM(i) {
+function tM(i) {
let e;
const t = i.extensions && i.extensions[At.KHR_DRACO_MESH_COMPRESSION];
- if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + _u(t.attributes) : e = i.indices + ":" + _u(i.attributes) + ":" + i.mode, i.targets !== void 0)
+ if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + vu(t.attributes) : e = i.indices + ":" + vu(i.attributes) + ":" + i.mode, i.targets !== void 0)
for (let n = 0, s = i.targets.length; n < s; n++)
- e += ":" + _u(i.targets[n]);
+ e += ":" + vu(i.targets[n]);
return e;
}
-function _u(i) {
+function vu(i) {
let e = "";
const t = Object.keys(i).sort();
for (let n = 0, s = t.length; n < s; n++)
e += t[n] + ":" + i[t[n]] + ";";
return e;
}
-function jd(i) {
+function Yd(i) {
switch (i) {
case Int8Array:
return 1 / 127;
@@ -25098,13 +25098,13 @@ function jd(i) {
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
}
}
-function tM(i) {
+function nM(i) {
return i.search(/\.jpe?g($|\?)/i) > 0 || i.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : i.search(/\.webp($|\?)/i) > 0 || i.search(/^data\:image\/webp/) === 0 ? "image/webp" : i.search(/\.ktx2($|\?)/i) > 0 || i.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
}
-const nM = new Ne();
-class iM {
+const iM = new Ne();
+class sM {
constructor(e = {}, t = {}) {
- this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new C1(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new I1(), this.associations = /* @__PURE__ */ 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, s = -1, r = !1, a = -1;
if (typeof navigator < "u") {
const o = navigator.userAgent;
@@ -25112,7 +25112,7 @@ class iM {
const c = o.match(/Version\/(\d+)/);
s = 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 && s < 17 || r && a < 98 ? this.textureLoader = new q0(this.options.manager) : this.textureLoader = new Iw(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new As(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
+ typeof createImageBitmap > "u" || n && s < 17 || r && a < 98 ? this.textureLoader = new K0(this.options.manager) : this.textureLoader = new Sw(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new As(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
}
setExtensions(e) {
this.extensions = e;
@@ -25142,7 +25142,7 @@ class iM {
parser: n,
userData: {}
};
- return cr(r, o, s), ts(o, s), Promise.all(n._invokeAll(function(c) {
+ return cr(r, o, s), ns(o, s), Promise.all(n._invokeAll(function(c) {
return c.afterRoot && c.afterRoot(o);
})).then(function() {
for (const c of o.scenes)
@@ -25352,21 +25352,21 @@ class iM {
loadAccessor(e) {
const t = this, n = this.json, s = this.json.accessors[e];
if (s.bufferView === void 0 && s.sparse === void 0) {
- const a = Eu[s.type], o = Ia[s.componentType], c = s.normalized === !0, l = new o(s.count * a);
+ const a = _u[s.type], o = Sa[s.componentType], c = s.normalized === !0, l = new o(s.count * a);
return Promise.resolve(new Bn(l, a, c));
}
const r = [];
return s.bufferView !== void 0 ? r.push(this.getDependency("bufferView", s.bufferView)) : r.push(null), s.sparse !== void 0 && (r.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(r).then(function(a) {
- const o = a[0], c = Eu[s.type], l = Ia[s.componentType], h = l.BYTES_PER_ELEMENT, u = h * c, d = s.byteOffset || 0, f = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
+ const o = a[0], c = _u[s.type], l = Sa[s.componentType], h = l.BYTES_PER_ELEMENT, u = h * c, d = s.byteOffset || 0, f = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
let m, g;
if (f && f !== u) {
const A = Math.floor(d / f), _ = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + A + ":" + s.count;
let x = t.cache.get(_);
- x || (m = new l(o, A * f, s.count * f / h), x = new N_(m, f / h), t.cache.add(_, x)), g = new Wf(x, c, d % f / h, p);
+ x || (m = new l(o, A * f, s.count * f / h), x = new D_(m, f / h), t.cache.add(_, x)), g = new Kf(x, c, d % f / h, p);
} else
o === null ? m = new l(s.count * c) : m = new l(o, d, s.count * c), g = new Bn(m, c, p);
if (s.sparse !== void 0) {
- const A = Eu.SCALAR, _ = Ia[s.sparse.indices.componentType], x = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, S = new _(a[1], x, s.sparse.count * A), w = new l(a[2], E, s.sparse.count * c);
+ const A = _u.SCALAR, _ = Sa[s.sparse.indices.componentType], x = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, S = new _(a[1], x, s.sparse.count * A), w = new l(a[2], E, s.sparse.count * c);
o !== null && (g = new Bn(g.array.slice(), g.itemSize, g.normalized)), g.normalized = !1;
for (let I = 0, T = S.length; I < T; I++) {
const C = S[I];
@@ -25400,7 +25400,7 @@ class iM {
const 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);
const d = (r.samplers || {})[a.sampler] || {};
- return h.magFilter = ig[d.magFilter] || Xt, h.minFilter = ig[d.minFilter] || hi, h.wrapS = sg[d.wrapS] || Ws, h.wrapT = sg[d.wrapT] || Ws, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== Wn && h.minFilter !== Xt, s.associations.set(h, { textures: e }), h;
+ return h.magFilter = rg[d.magFilter] || Xt, h.minFilter = rg[d.minFilter] || ui, h.wrapS = ag[d.wrapS] || Ws, h.wrapT = ag[d.wrapT] || Ws, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== qn && h.minFilter !== Xt, s.associations.set(h, { textures: e }), h;
}).catch(function() {
return null;
});
@@ -25429,7 +25429,7 @@ class iM {
}), t.load(Cr.resolveURL(u, r.path), p, void 0, f);
});
}).then(function(u) {
- return l === !0 && o.revokeObjectURL(c), ts(u, a), u.userData.mimeType = a.mimeType || tM(a.uri), u;
+ return l === !0 && o.revokeObjectURL(c), ns(u, a), u.userData.mimeType = a.mimeType || nM(a.uri), u;
}).catch(function(u) {
throw console.error("THREE.GLTFLoader: Couldn't load texture", c), u;
});
@@ -25476,11 +25476,11 @@ class iM {
if (e.isPoints) {
const o = "PointsMaterial:" + n.uuid;
let c = this.cache.get(o);
- c || (c = new Kf(), ui.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, c.sizeAttenuation = !1, this.cache.add(o, c)), n = c;
+ c || (c = new Xf(), di.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) {
const o = "LineBasicMaterial:" + n.uuid;
let c = this.cache.get(o);
- c || (c = new qa(), ui.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, this.cache.add(o, c)), n = c;
+ c || (c = new Ka(), di.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, this.cache.add(o, c)), n = c;
}
if (s || r || a) {
let o = "ClonedMaterial:" + n.uuid + ":";
@@ -25491,7 +25491,7 @@ class iM {
e.material = n;
}
getMaterialType() {
- return Zo;
+ return $o;
}
/**
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
@@ -25519,9 +25519,9 @@ class iM {
return d.extendMaterialParams && d.extendMaterialParams(e, o);
})));
}
- r.doubleSided === !0 && (o.side = Ui);
- const h = r.alphaMode || yu.OPAQUE;
- if (h === yu.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, h === yu.MASK && (o.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && a !== Os && (l.push(t.assignTexture(o, "normalMap", r.normalTexture)), o.normalScale = new Ze(1, 1), r.normalTexture.scale !== void 0)) {
+ r.doubleSided === !0 && (o.side = Oi);
+ const h = r.alphaMode || wu.OPAQUE;
+ if (h === wu.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, h === wu.MASK && (o.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && a !== Os && (l.push(t.assignTexture(o, "normalMap", r.normalTexture)), o.normalScale = new Ze(1, 1), r.normalTexture.scale !== void 0)) {
const u = r.normalTexture.scale;
o.normalScale.set(u, u);
}
@@ -25531,7 +25531,7 @@ class iM {
}
return r.emissiveTexture !== void 0 && a !== Os && l.push(t.assignTexture(o, "emissiveMap", r.emissiveTexture, _t)), Promise.all(l).then(function() {
const u = new a(o);
- return r.name && (u.name = r.name), ts(u, r), t.associations.set(u, { materials: e }), r.extensions && cr(s, u, r), u;
+ return r.name && (u.name = r.name), ns(u, r), t.associations.set(u, { materials: e }), r.extensions && cr(s, u, r), u;
});
}
/**
@@ -25558,17 +25558,17 @@ class iM {
const t = this, n = this.extensions, s = this.primitiveCache;
function r(o) {
return n[At.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o, t).then(function(c) {
- return rg(c, o, t);
+ return og(c, o, t);
});
}
const a = [];
for (let o = 0, c = e.length; o < c; o++) {
- const l = e[o], h = eM(l), u = s[h];
+ const l = e[o], h = tM(l), u = s[h];
if (u)
a.push(u.promise);
else {
let d;
- l.extensions && l.extensions[At.KHR_DRACO_MESH_COMPRESSION] ? d = r(l) : d = rg(new Tn(), l, t), s[h] = { primitive: l, promise: d }, a.push(d);
+ l.extensions && l.extensions[At.KHR_DRACO_MESH_COMPRESSION] ? d = r(l) : d = og(new Tn(), l, t), s[h] = { primitive: l, promise: d }, a.push(d);
}
}
return Promise.all(a);
@@ -25583,7 +25583,7 @@ class iM {
loadMesh(e) {
const t = this, n = this.json, s = this.extensions, r = n.meshes[e], a = r.primitives, o = [];
for (let c = 0, l = a.length; c < l; c++) {
- const h = a[c].material === void 0 ? J1(this.cache) : this.getDependency("material", a[c].material);
+ const h = a[c].material === void 0 ? Z1(this.cache) : this.getDependency("material", a[c].material);
o.push(h);
}
return o.push(t.loadGeometries(a)), Promise.all(o).then(function(c) {
@@ -25592,19 +25592,19 @@ class iM {
const m = h[f], g = a[f];
let A;
const _ = l[f];
- if (g.mode === ri.TRIANGLES || g.mode === ri.TRIANGLE_STRIP || g.mode === ri.TRIANGLE_FAN || g.mode === void 0)
- A = r.isSkinnedMesh === !0 ? new L0(m, _) : new Zt(m, _), A.isSkinnedMesh === !0 && A.normalizeSkinWeights(), g.mode === ri.TRIANGLE_STRIP ? A.geometry = tg(A.geometry, v0) : g.mode === ri.TRIANGLE_FAN && (A.geometry = tg(A.geometry, Ud));
- else if (g.mode === ri.LINES)
- A = new gh(m, _);
- else if (g.mode === ri.LINE_STRIP)
- A = new Ah(m, _);
- else if (g.mode === ri.LINE_LOOP)
- A = new O_(m, _);
- else if (g.mode === ri.POINTS)
+ if (g.mode === ai.TRIANGLES || g.mode === ai.TRIANGLE_STRIP || g.mode === ai.TRIANGLE_FAN || g.mode === void 0)
+ A = r.isSkinnedMesh === !0 ? new P0(m, _) : new Zt(m, _), A.isSkinnedMesh === !0 && A.normalizeSkinWeights(), g.mode === ai.TRIANGLE_STRIP ? A.geometry = ig(A.geometry, C0) : g.mode === ai.TRIANGLE_FAN && (A.geometry = ig(A.geometry, Qd));
+ else if (g.mode === ai.LINES)
+ A = new xh(m, _);
+ else if (g.mode === ai.LINE_STRIP)
+ A = new mh(m, _);
+ else if (g.mode === ai.LINE_LOOP)
A = new Q_(m, _);
+ else if (g.mode === ai.POINTS)
+ A = new G_(m, _);
else
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + g.mode);
- Object.keys(A.geometry.morphAttributes).length > 0 && $1(A, r), A.name = t.createUniqueName(r.name || "mesh_" + e), ts(A, r), g.extensions && cr(s, A, g), t.assignFinalMaterial(A), u.push(A);
+ Object.keys(A.geometry.morphAttributes).length > 0 && eM(A, r), A.name = t.createUniqueName(r.name || "mesh_" + e), ns(A, r), g.extensions && cr(s, A, g), t.assignFinalMaterial(A), u.push(A);
}
for (let f = 0, p = u.length; f < p; f++)
t.associations.set(u[f], {
@@ -25634,7 +25634,7 @@ class iM {
console.warn("THREE.GLTFLoader: Missing camera parameters.");
return;
}
- return n.type === "perspective" ? t = new In(Cn.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new Yf(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), ts(t, n), Promise.resolve(t);
+ return n.type === "perspective" ? t = new In(Cn.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new Zf(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), ns(t, n), Promise.resolve(t);
}
/**
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -25658,7 +25658,7 @@ class iM {
} else
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
}
- return new ph(o, c);
+ return new gh(o, c);
});
}
/**
@@ -25691,7 +25691,7 @@ class iM {
for (let v = 0; v < C.length; v++)
A.push(C[v]);
}
- return new jl(r, void 0, A);
+ return new Yl(r, void 0, A);
});
}
createNodeMesh(e) {
@@ -25724,7 +25724,7 @@ class iM {
]).then(function(l) {
const h = l[0], u = l[1], d = l[2];
d !== null && h.traverse(function(f) {
- f.isSkinnedMesh && f.bind(d, nM);
+ f.isSkinnedMesh && f.bind(d, iM);
});
for (let f = 0, p = u.length; f < p; f++)
h.add(u[f]);
@@ -25748,10 +25748,10 @@ class iM {
o.push(l);
}), this.nodeCache[e] = Promise.all(o).then(function(l) {
let h;
- if (r.isBone === !0 ? h = new Wl() : l.length > 1 ? h = new hs() : l.length === 1 ? h = l[0] : h = new Tt(), h !== l[0])
+ if (r.isBone === !0 ? h = new Kl() : l.length > 1 ? h = new hs() : l.length === 1 ? h = l[0] : h = new Tt(), 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), ts(h, r), r.extensions && cr(n, h, r), r.matrix !== void 0) {
+ if (r.name && (h.userData.name = r.name, h.name = a), ns(h, r), r.extensions && cr(n, h, r), r.matrix !== void 0) {
const u = new Ne();
u.fromArray(r.matrix), h.applyMatrix4(u);
} else
@@ -25768,7 +25768,7 @@ class iM {
*/
loadScene(e) {
const t = this.extensions, n = this.json.scenes[e], s = this, r = new hs();
- n.name && (r.name = s.createUniqueName(n.name)), ts(r, n), n.extensions && cr(t, r, n);
+ n.name && (r.name = s.createUniqueName(n.name)), ns(r, n), n.extensions && cr(t, r, n);
const a = n.nodes || [], o = [];
for (let c = 0, l = a.length; c < l; c++)
o.push(s.getDependency("node", a[c]));
@@ -25778,7 +25778,7 @@ class iM {
const l = (h) => {
const u = /* @__PURE__ */ new Map();
for (const [d, f] of s.associations)
- (d instanceof ui || d instanceof an) && u.set(d, f);
+ (d instanceof di || d instanceof an) && u.set(d, f);
return h.traverse((d) => {
const f = s.associations.get(d);
f != null && u.set(d, f);
@@ -25808,7 +25808,7 @@ class iM {
n.itemSize === 1 ? l = Nr : l = Dr;
break;
}
- const h = s.interpolation !== void 0 ? Y1[s.interpolation] : Ko, u = this._getArrayFromAccessor(n);
+ const h = s.interpolation !== void 0 ? J1[s.interpolation] : jo, u = this._getArrayFromAccessor(n);
for (let d = 0, f = c.length; d < f; d++) {
const p = new l(
c[d] + "." + Rs[r.path],
@@ -25823,7 +25823,7 @@ class iM {
_getArrayFromAccessor(e) {
let t = e.array;
if (e.normalized) {
- const n = jd(t.constructor), s = new Float32Array(t.length);
+ const n = Yd(t.constructor), s = new Float32Array(t.length);
for (let r = 0, a = t.length; r < a; r++)
s[r] = t[r] * n;
t = s;
@@ -25832,13 +25832,13 @@ class iM {
}
_createCubicSplineTrackInterpolant(e) {
e.createInterpolant = function(n) {
- const s = this instanceof Ks ? X1 : ix;
+ const s = this instanceof Ks ? Y1 : sx;
return new s(this.times, this.values, this.getValueSize() / 3, n);
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
}
}
-function sM(i, e, t) {
- const n = e.attributes, s = new Hi();
+function rM(i, e, t) {
+ const n = e.attributes, s = new zi();
if (n.POSITION !== void 0) {
const o = t.json.accessors[n.POSITION], c = o.min, l = o.max;
if (c !== void 0 && l !== void 0) {
@@ -25846,7 +25846,7 @@ function sM(i, e, t) {
new G(c[0], c[1], c[2]),
new G(l[0], l[1], l[2])
), o.normalized) {
- const h = jd(Ia[o.componentType]);
+ const h = Yd(Sa[o.componentType]);
s.min.multiplyScalar(h), s.max.multiplyScalar(h);
}
} else {
@@ -25864,7 +25864,7 @@ function sM(i, e, t) {
const d = t.json.accessors[u.POSITION], f = d.min, p = d.max;
if (f !== void 0 && p !== void 0) {
if (c.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), d.normalized) {
- const m = jd(Ia[d.componentType]);
+ const m = Yd(Sa[d.componentType]);
c.multiplyScalar(m);
}
o.max(c);
@@ -25875,10 +25875,10 @@ function sM(i, e, t) {
s.expandByVector(o);
}
i.boundingBox = s;
- const a = new zi();
+ const a = new Vi();
s.getCenter(a.center), a.radius = s.min.distanceTo(s.max) / 2, i.boundingSphere = a;
}
-function rg(i, e, t) {
+function og(i, e, t) {
const n = e.attributes, s = [];
function r(a, o) {
return t.getDependency("accessor", a).then(function(c) {
@@ -25886,7 +25886,7 @@ function rg(i, e, t) {
});
}
for (const a in n) {
- const o = Kd[a] || a.toLowerCase();
+ const o = Xd[a] || a.toLowerCase();
o in i.attributes || s.push(r(n[a], o));
}
if (e.indices !== void 0 && !i.index) {
@@ -25895,11 +25895,11 @@ function rg(i, e, t) {
});
s.push(a);
}
- return rt.workingColorSpace !== An && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${rt.workingColorSpace}" not supported.`), ts(i, e), sM(i, e, t), Promise.all(s).then(function() {
- return e.targets !== void 0 ? Z1(i, e.targets, t) : i;
+ return rt.workingColorSpace !== An && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${rt.workingColorSpace}" not supported.`), ns(i, e), rM(i, e, t), Promise.all(s).then(function() {
+ return e.targets !== void 0 ? $1(i, e.targets, t) : i;
});
}
-var rM = (function() {
+var aM = (function() {
var i = "b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok: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;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb", e = "b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjj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sxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb", 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 {
@@ -25995,7 +25995,7 @@ var rM = (function() {
}
};
})();
-const ag = { type: "change" }, np = { type: "start" }, sx = { type: "end" }, il = new uc(), og = new Us(), aM = Math.cos(70 * Cn.DEG2RAD), ln = new G(), qn = 2 * Math.PI, Ft = {
+const cg = { type: "change" }, sp = { type: "start" }, rx = { type: "end" }, sl = new dc(), lg = new Us(), oM = Math.cos(70 * Cn.DEG2RAD), ln = new G(), Kn = 2 * Math.PI, Ft = {
NONE: -1,
ROTATE: 0,
DOLLY: 1,
@@ -26004,8 +26004,8 @@ const ag = { type: "change" }, np = { type: "start" }, sx = { type: "end" }, il
TOUCH_PAN: 4,
TOUCH_DOLLY_PAN: 5,
TOUCH_DOLLY_ROTATE: 6
-}, wu = 1e-6;
-class oM extends Hw {
+}, Cu = 1e-6;
+class cM extends zw {
/**
* Constructs a new controls instance.
*
@@ -26013,7 +26013,7 @@ class oM extends Hw {
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
*/
constructor(e, t = null) {
- super(e, t), this.state = Ft.NONE, this.target = new G(), this.cursor = new G(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: wa.ROTATE, MIDDLE: wa.DOLLY, RIGHT: wa.PAN }, this.touches = { ONE: Aa.ROTATE, TWO: Aa.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new G(), this._lastQuaternion = new Jt(), this._lastTargetPosition = new G(), this._quat = new Jt().setFromUnitVectors(e.up, new G(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new MA(), this._sphericalDelta = new MA(), this._scale = 1, this._panOffset = new G(), this._rotateStart = new Ze(), this._rotateEnd = new Ze(), this._rotateDelta = new Ze(), this._panStart = new Ze(), this._panEnd = new Ze(), this._panDelta = new Ze(), this._dollyStart = new Ze(), this._dollyEnd = new Ze(), this._dollyDelta = new Ze(), this._dollyDirection = new G(), this._mouse = new Ze(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = lM.bind(this), this._onPointerDown = cM.bind(this), this._onPointerUp = hM.bind(this), this._onContextMenu = mM.bind(this), this._onMouseWheel = fM.bind(this), this._onKeyDown = pM.bind(this), this._onTouchStart = AM.bind(this), this._onTouchMove = gM.bind(this), this._onMouseDown = uM.bind(this), this._onMouseMove = dM.bind(this), this._interceptControlDown = xM.bind(this), this._interceptControlUp = bM.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
+ super(e, t), this.state = Ft.NONE, this.target = new G(), this.cursor = new G(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: va.ROTATE, MIDDLE: va.DOLLY, RIGHT: va.PAN }, this.touches = { ONE: ga.ROTATE, TWO: ga.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new G(), this._lastQuaternion = new Jt(), this._lastTargetPosition = new G(), this._quat = new Jt().setFromUnitVectors(e.up, new G(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new TA(), this._sphericalDelta = new TA(), this._scale = 1, this._panOffset = new G(), this._rotateStart = new Ze(), this._rotateEnd = new Ze(), this._rotateDelta = new Ze(), this._panStart = new Ze(), this._panEnd = new Ze(), this._panDelta = new Ze(), this._dollyStart = new Ze(), this._dollyEnd = new Ze(), this._dollyDelta = new Ze(), this._dollyDirection = new G(), this._mouse = new Ze(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = hM.bind(this), this._onPointerDown = lM.bind(this), this._onPointerUp = uM.bind(this), this._onContextMenu = xM.bind(this), this._onMouseWheel = pM.bind(this), this._onKeyDown = AM.bind(this), this._onTouchStart = gM.bind(this), this._onTouchMove = mM.bind(this), this._onMouseDown = dM.bind(this), this._onMouseMove = fM.bind(this), this._interceptControlDown = bM.bind(this), this._interceptControlUp = EM.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
}
connect(e) {
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
@@ -26074,13 +26074,13 @@ class oM extends Hw {
* was called, or the initial state.
*/
reset() {
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(ag), this.update(), this.state = Ft.NONE;
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(cg), this.update(), this.state = Ft.NONE;
}
update(e = null) {
const t = this.object.position;
ln.copy(t).sub(this.target), ln.applyQuaternion(this._quat), this._spherical.setFromVector3(ln), this.autoRotate && this.state === Ft.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
let n = this.minAzimuthAngle, s = this.maxAzimuthAngle;
- isFinite(n) && isFinite(s) && (n < -Math.PI ? n += qn : n > Math.PI && (n -= qn), s < -Math.PI ? s += qn : s > Math.PI && (s -= qn), n <= s ? this._spherical.theta = Math.max(n, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + s) / 2 ? Math.max(n, this._spherical.theta) : Math.min(s, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
+ isFinite(n) && isFinite(s) && (n < -Math.PI ? n += Kn : n > Math.PI && (n -= Kn), s < -Math.PI ? s += Kn : s > Math.PI && (s -= Kn), n <= s ? this._spherical.theta = Math.max(n, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + s) / 2 ? Math.max(n, this._spherical.theta) : Math.min(s, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
let r = !1;
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
this._spherical.radius = this._clampDistance(this._spherical.radius);
@@ -26104,15 +26104,15 @@ class oM extends Hw {
l.unproject(this.object), this.object.position.sub(l).add(o), this.object.updateMatrixWorld(), a = ln.length();
} else
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
- a !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position) : (il.origin.copy(this.object.position), il.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(il.direction)) < aM ? this.object.lookAt(this.target) : (og.setFromNormalAndCoplanarPoint(this.object.up, this.target), il.intersectPlane(og, this.target))));
+ a !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position) : (sl.origin.copy(this.object.position), sl.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(sl.direction)) < oM ? this.object.lookAt(this.target) : (lg.setFromNormalAndCoplanarPoint(this.object.up, this.target), sl.intersectPlane(lg, this.target))));
} else if (this.object.isOrthographicCamera) {
const a = this.object.zoom;
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), a !== this.object.zoom && (this.object.updateProjectionMatrix(), r = !0);
}
- return this._scale = 1, this._performCursorZoom = !1, r || this._lastPosition.distanceToSquared(this.object.position) > wu || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > wu || this._lastTargetPosition.distanceToSquared(this.target) > wu ? (this.dispatchEvent(ag), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
+ return this._scale = 1, this._performCursorZoom = !1, r || this._lastPosition.distanceToSquared(this.object.position) > Cu || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Cu || this._lastTargetPosition.distanceToSquared(this.target) > Cu ? (this.dispatchEvent(cg), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
}
_getAutoRotationAngle(e) {
- return e !== null ? qn / 60 * this.autoRotateSpeed * e : qn / 60 / 60 * this.autoRotateSpeed;
+ return e !== null ? Kn / 60 * this.autoRotateSpeed * e : Kn / 60 / 60 * this.autoRotateSpeed;
}
_getZoomScale(e) {
const t = Math.abs(e * 0.01);
@@ -26171,7 +26171,7 @@ class oM extends Hw {
_handleMouseMoveRotate(e) {
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
const t = this.domElement;
- this._rotateLeft(qn * this._rotateDelta.x / t.clientHeight), this._rotateUp(qn * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
+ this._rotateLeft(Kn * this._rotateDelta.x / t.clientHeight), this._rotateUp(Kn * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
}
_handleMouseMoveDolly(e) {
this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
@@ -26186,16 +26186,16 @@ class oM extends Hw {
let t = !1;
switch (e.code) {
case this.keys.UP:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(Kn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
break;
case this.keys.BOTTOM:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-Kn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
break;
case this.keys.LEFT:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(Kn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
break;
case this.keys.RIGHT:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-Kn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
break;
}
t && (e.preventDefault(), this.update());
@@ -26235,7 +26235,7 @@ class oM extends Hw {
}
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
const t = this.domElement;
- this._rotateLeft(qn * this._rotateDelta.x / t.clientHeight), this._rotateUp(qn * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
+ this._rotateLeft(Kn * this._rotateDelta.x / t.clientHeight), this._rotateUp(Kn * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
}
_handleTouchMovePan(e) {
if (this._pointers.length === 1)
@@ -26301,16 +26301,16 @@ class oM extends Hw {
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
}
}
-function cM(i) {
+function lM(i) {
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(i.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(i) && (this._addPointer(i), i.pointerType === "touch" ? this._onTouchStart(i) : this._onMouseDown(i)));
}
-function lM(i) {
+function hM(i) {
this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
}
-function hM(i) {
+function uM(i) {
switch (this._removePointer(i), this._pointers.length) {
case 0:
- this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(sx), this.state = Ft.NONE;
+ this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(rx), this.state = Ft.NONE;
break;
case 1:
const e = this._pointers[0], t = this._pointerPositions[e];
@@ -26318,7 +26318,7 @@ function hM(i) {
break;
}
}
-function uM(i) {
+function dM(i) {
let e;
switch (i.button) {
case 0:
@@ -26334,11 +26334,11 @@ function uM(i) {
e = -1;
}
switch (e) {
- case wa.DOLLY:
+ case va.DOLLY:
if (this.enableZoom === !1) return;
this._handleMouseDownDolly(i), this.state = Ft.DOLLY;
break;
- case wa.ROTATE:
+ case va.ROTATE:
if (i.ctrlKey || i.metaKey || i.shiftKey) {
if (this.enablePan === !1) return;
this._handleMouseDownPan(i), this.state = Ft.PAN;
@@ -26347,7 +26347,7 @@ function uM(i) {
this._handleMouseDownRotate(i), this.state = Ft.ROTATE;
}
break;
- case wa.PAN:
+ case va.PAN:
if (i.ctrlKey || i.metaKey || i.shiftKey) {
if (this.enableRotate === !1) return;
this._handleMouseDownRotate(i), this.state = Ft.ROTATE;
@@ -26359,9 +26359,9 @@ function uM(i) {
default:
this.state = Ft.NONE;
}
- this.state !== Ft.NONE && this.dispatchEvent(np);
+ this.state !== Ft.NONE && this.dispatchEvent(sp);
}
-function dM(i) {
+function fM(i) {
switch (this.state) {
case Ft.ROTATE:
if (this.enableRotate === !1) return;
@@ -26377,21 +26377,21 @@ function dM(i) {
break;
}
}
-function fM(i) {
- this.enabled === !1 || this.enableZoom === !1 || this.state !== Ft.NONE || (i.preventDefault(), this.dispatchEvent(np), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(sx));
-}
function pM(i) {
- this.enabled !== !1 && this._handleKeyDown(i);
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== Ft.NONE || (i.preventDefault(), this.dispatchEvent(sp), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(rx));
}
function AM(i) {
+ this.enabled !== !1 && this._handleKeyDown(i);
+}
+function gM(i) {
switch (this._trackPointer(i), this._pointers.length) {
case 1:
switch (this.touches.ONE) {
- case Aa.ROTATE:
+ case ga.ROTATE:
if (this.enableRotate === !1) return;
this._handleTouchStartRotate(i), this.state = Ft.TOUCH_ROTATE;
break;
- case Aa.PAN:
+ case ga.PAN:
if (this.enablePan === !1) return;
this._handleTouchStartPan(i), this.state = Ft.TOUCH_PAN;
break;
@@ -26401,11 +26401,11 @@ function AM(i) {
break;
case 2:
switch (this.touches.TWO) {
- case Aa.DOLLY_PAN:
+ case ga.DOLLY_PAN:
if (this.enableZoom === !1 && this.enablePan === !1) return;
this._handleTouchStartDollyPan(i), this.state = Ft.TOUCH_DOLLY_PAN;
break;
- case Aa.DOLLY_ROTATE:
+ case ga.DOLLY_ROTATE:
if (this.enableZoom === !1 && this.enableRotate === !1) return;
this._handleTouchStartDollyRotate(i), this.state = Ft.TOUCH_DOLLY_ROTATE;
break;
@@ -26416,9 +26416,9 @@ function AM(i) {
default:
this.state = Ft.NONE;
}
- this.state !== Ft.NONE && this.dispatchEvent(np);
+ this.state !== Ft.NONE && this.dispatchEvent(sp);
}
-function gM(i) {
+function mM(i) {
switch (this._trackPointer(i), this.state) {
case Ft.TOUCH_ROTATE:
if (this.enableRotate === !1) return;
@@ -26440,25 +26440,25 @@ function gM(i) {
this.state = Ft.NONE;
}
}
-function mM(i) {
+function xM(i) {
this.enabled !== !1 && i.preventDefault();
}
-function xM(i) {
+function bM(i) {
i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
}
-function bM(i) {
+function EM(i) {
i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
}
-class EM extends Qd {
+class yM extends Hd {
constructor() {
super();
- const e = new Wa();
+ const e = new qa();
e.deleteAttribute("uv");
- const t = new Zo({ side: Vn }), n = new Zo(), s = new Xl(16777215, 900, 28, 2);
+ const t = new $o({ side: Wn }), n = new $o(), s = new Jl(16777215, 900, 28, 2);
s.position.set(0.418, 16.199, 0.3), this.add(s);
const r = new Zt(e, t);
r.position.set(-0.757, 13.219, 0.717), r.scale.set(31.713, 28.305, 28.591), this.add(r);
- const a = new P0(e, n, 6), o = new Tt();
+ const a = new k0(e, n, 6), o = new Tt();
o.position.set(-10.906, 2.009, 1.846), o.rotation.set(0, -0.195, 0), o.scale.set(2.328, 7.905, 4.651), o.updateMatrix(), a.setMatrixAt(0, o.matrix), o.position.set(-5.607, -0.754, -0.758), o.rotation.set(0, 0.994, 0), o.scale.set(1.97, 1.534, 3.955), o.updateMatrix(), a.setMatrixAt(1, o.matrix), o.position.set(6.167, 0.857, 7.803), o.rotation.set(0, 0.561, 0), o.scale.set(3.927, 6.285, 3.687), o.updateMatrix(), a.setMatrixAt(2, o.matrix), o.position.set(-2.017, 0.018, 6.124), o.rotation.set(0, 0.333, 0), o.scale.set(2.002, 4.566, 2.064), o.updateMatrix(), a.setMatrixAt(3, o.matrix), o.position.set(2.291, -0.756, -2.621), o.rotation.set(0, -0.286, 0), o.scale.set(1.546, 1.552, 1.496), o.updateMatrix(), a.setMatrixAt(4, o.matrix), o.position.set(-2.193, -0.369, -5.547), o.rotation.set(0, 0.516, 0), o.scale.set(3.875, 3.487, 2.986), o.updateMatrix(), a.setMatrixAt(5, o.matrix), this.add(a);
const c = new Zt(e, oa(50));
c.position.set(-16.116, 14.37, 8.208), c.scale.set(0.1, 2.428, 2.739), this.add(c);
@@ -26490,13 +26490,13 @@ function oa(i) {
const e = new Os();
return e.color.setScalar(i), e;
}
-function yM(i) {
+function _M(i) {
if (!(typeof window > "u")) {
var e = document.createElement("style");
return e.setAttribute("type", "text/css"), e.innerHTML = i, document.head.appendChild(e), i;
}
}
-function ba(i, e) {
+function Ea(i, e) {
var t = i.__state.conversionName.toString(), n = Math.round(i.r), s = Math.round(i.g), r = Math.round(i.b), a = i.a, o = Math.round(i.h), c = i.s.toFixed(1), l = i.v.toFixed(1);
if (e || t === "THREE_CHAR_HEX" || t === "SIX_CHAR_HEX") {
for (var h = i.hex.toString(16); h.length < 6; )
@@ -26524,10 +26524,10 @@ function ba(i, e) {
}
return "unknown format";
}
-var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
+var hg = Array.prototype.forEach, po = Array.prototype.slice, ue = {
BREAK: {},
extend: function(e) {
- return this.each(fo.call(arguments, 1), function(t) {
+ return this.each(po.call(arguments, 1), function(t) {
var n = this.isObject(t) ? Object.keys(t) : [];
n.forEach((function(s) {
this.isUndefined(t[s]) || (e[s] = t[s]);
@@ -26535,7 +26535,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
}, this), e;
},
defaults: function(e) {
- return this.each(fo.call(arguments, 1), function(t) {
+ return this.each(po.call(arguments, 1), function(t) {
var n = this.isObject(t) ? Object.keys(t) : [];
n.forEach((function(s) {
this.isUndefined(e[s]) && (e[s] = t[s]);
@@ -26543,16 +26543,16 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
}, this), e;
},
compose: function() {
- var e = fo.call(arguments);
+ var e = po.call(arguments);
return function() {
- for (var t = fo.call(arguments), n = e.length - 1; n >= 0; n--)
+ for (var t = po.call(arguments), n = e.length - 1; n >= 0; n--)
t = [e[n].apply(this, t)];
return t[0];
};
},
each: function(e, t, n) {
if (e) {
- if (cg && e.forEach && e.forEach === cg)
+ if (hg && e.forEach && e.forEach === hg)
e.forEach(t, n);
else if (e.length === e.length + 0) {
var s = void 0, r = void 0;
@@ -26580,7 +26580,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
};
},
toArray: function(e) {
- return e.toArray ? e.toArray() : fo.call(e);
+ return e.toArray ? e.toArray() : po.call(e);
},
isUndefined: function(e) {
return e === void 0;
@@ -26616,7 +26616,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
isFunction: function(e) {
return e instanceof Function;
}
-}, _M = [
+}, wM = [
{
litmus: ue.isString,
conversions: {
@@ -26628,7 +26628,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
hex: parseInt("0x" + t[1].toString() + t[1].toString() + t[2].toString() + t[2].toString() + t[3].toString() + t[3].toString(), 0)
};
},
- write: ba
+ write: Ea
},
SIX_CHAR_HEX: {
read: function(e) {
@@ -26638,7 +26638,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
hex: parseInt("0x" + t[1].toString(), 0)
};
},
- write: ba
+ write: Ea
},
CSS_RGB: {
read: function(e) {
@@ -26650,7 +26650,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
b: parseFloat(t[3])
};
},
- write: ba
+ write: Ea
},
CSS_RGBA: {
read: function(e) {
@@ -26663,7 +26663,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
a: parseFloat(t[4])
};
},
- write: ba
+ write: Ea
}
}
},
@@ -26793,17 +26793,17 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
}
}
}
-], po = void 0, sl = void 0, Xd = function() {
- sl = !1;
+], Ao = void 0, rl = void 0, Jd = function() {
+ rl = !1;
var e = arguments.length > 1 ? ue.toArray(arguments) : arguments[0];
- return ue.each(_M, function(t) {
+ return ue.each(wM, function(t) {
if (t.litmus(e))
return ue.each(t.conversions, function(n, s) {
- if (po = n.read(e), sl === !1 && po !== !1)
- return sl = po, po.conversionName = s, po.conversion = n, ue.BREAK;
+ if (Ao = n.read(e), rl === !1 && Ao !== !1)
+ return rl = Ao, Ao.conversionName = s, Ao.conversion = n, ue.BREAK;
}), ue.BREAK;
- }), sl;
-}, lg = void 0, Yl = {
+ }), rl;
+}, ug = void 0, Zl = {
hsv_to_rgb: function(e, t, n) {
var s = Math.floor(e / 60) % 6, r = e / 60 - Math.floor(e / 60), a = n * (1 - t), o = n * (1 - r * t), c = n * (1 - (1 - r) * t), l = [[n, c, a], [o, n, a], [a, n, c], [a, o, n], [c, a, n], [n, a, o]][s];
return {
@@ -26836,16 +26836,16 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
return e >> t * 8 & 255;
},
hex_with_component: function(e, t, n) {
- return n << (lg = t * 8) | e & ~(255 << lg);
+ return n << (ug = t * 8) | e & ~(255 << ug);
}
-}, wM = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
+}, vM = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
return typeof i;
} : function(i) {
return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
-}, Ti = function(i, e) {
+}, Ri = function(i, e) {
if (!(i instanceof e))
throw new TypeError("Cannot call a class as a function");
-}, Ri = /* @__PURE__ */ (function() {
+}, Fi = /* @__PURE__ */ (function() {
function i(e, t) {
for (var n = 0; n < t.length; n++) {
var s = t[n];
@@ -26884,19 +26884,19 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
return e && (typeof e == "object" || typeof e == "function") ? e : i;
}, vn = (function() {
function i() {
- if (Ti(this, i), this.__state = Xd.apply(this, arguments), this.__state === !1)
+ if (Ri(this, i), this.__state = Jd.apply(this, arguments), this.__state === !1)
throw new Error("Failed to interpret color arguments");
this.__state.a = this.__state.a || 1;
}
- return Ri(i, [{
+ return Fi(i, [{
key: "toString",
value: function() {
- return ba(this);
+ return Ea(this);
}
}, {
key: "toHexString",
value: function() {
- return ba(this, !0);
+ return Ea(this, !0);
}
}, {
key: "toOriginal",
@@ -26905,7 +26905,7 @@ var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {
}
}]), i;
})();
-function ip(i, e, t) {
+function rp(i, e, t) {
Object.defineProperty(i, e, {
get: function() {
return this.__state.space === "RGB" ? this.__state[e] : (vn.recalculateRGB(this, e, t), this.__state[e]);
@@ -26915,7 +26915,7 @@ function ip(i, e, t) {
}
});
}
-function sp(i, e) {
+function ap(i, e) {
Object.defineProperty(i, e, {
get: function() {
return this.__state.space === "HSV" ? this.__state[e] : (vn.recalculateHSV(this), this.__state[e]);
@@ -26927,26 +26927,26 @@ function sp(i, e) {
}
vn.recalculateRGB = function(i, e, t) {
if (i.__state.space === "HEX")
- i.__state[e] = Yl.component_from_hex(i.__state.hex, t);
+ i.__state[e] = Zl.component_from_hex(i.__state.hex, t);
else if (i.__state.space === "HSV")
- ue.extend(i.__state, Yl.hsv_to_rgb(i.__state.h, i.__state.s, i.__state.v));
+ ue.extend(i.__state, Zl.hsv_to_rgb(i.__state.h, i.__state.s, i.__state.v));
else
throw new Error("Corrupted color state");
};
vn.recalculateHSV = function(i) {
- var e = Yl.rgb_to_hsv(i.r, i.g, i.b);
+ var e = Zl.rgb_to_hsv(i.r, i.g, i.b);
ue.extend(i.__state, {
s: e.s,
v: e.v
}), ue.isNaN(e.h) ? ue.isUndefined(i.__state.h) && (i.__state.h = 0) : i.__state.h = e.h;
};
vn.COMPONENTS = ["r", "g", "b", "h", "s", "v", "hex", "a"];
-ip(vn.prototype, "r", 2);
-ip(vn.prototype, "g", 1);
-ip(vn.prototype, "b", 0);
-sp(vn.prototype, "h");
-sp(vn.prototype, "s");
-sp(vn.prototype, "v");
+rp(vn.prototype, "r", 2);
+rp(vn.prototype, "g", 1);
+rp(vn.prototype, "b", 0);
+ap(vn.prototype, "h");
+ap(vn.prototype, "s");
+ap(vn.prototype, "v");
Object.defineProperty(vn.prototype, "a", {
get: function() {
return this.__state.a;
@@ -26957,7 +26957,7 @@ Object.defineProperty(vn.prototype, "a", {
});
Object.defineProperty(vn.prototype, "hex", {
get: function() {
- return this.__state.space !== "HEX" && (this.__state.hex = Yl.rgb_to_hex(this.r, this.g, this.b), this.__state.space = "HEX"), this.__state.hex;
+ return this.__state.space !== "HEX" && (this.__state.hex = Zl.rgb_to_hex(this.r, this.g, this.b), this.__state.space = "HEX"), this.__state.hex;
},
set: function(e) {
this.__state.space = "HEX", this.__state.hex = e;
@@ -26965,9 +26965,9 @@ Object.defineProperty(vn.prototype, "hex", {
});
var Gr = (function() {
function i(e, t) {
- Ti(this, i), this.initialValue = e[t], this.domElement = document.createElement("div"), this.object = e, this.property = t, this.__onChange = void 0, this.__onFinishChange = void 0;
+ Ri(this, i), this.initialValue = e[t], this.domElement = document.createElement("div"), this.object = e, this.property = t, this.__onChange = void 0, this.__onFinishChange = void 0;
}
- return Ri(i, [{
+ return Fi(i, [{
key: "onChange",
value: function(t) {
return this.__onChange = t, this;
@@ -26998,21 +26998,21 @@ var Gr = (function() {
return this.initialValue !== this.getValue();
}
}]), i;
-})(), vM = {
+})(), CM = {
HTMLEvents: ["change"],
MouseEvents: ["click", "mousemove", "mousedown", "mouseup", "mouseover"],
KeyboardEvents: ["keydown"]
-}, rx = {};
-ue.each(vM, function(i, e) {
+}, ax = {};
+ue.each(CM, function(i, e) {
ue.each(i, function(t) {
- rx[t] = e;
+ ax[t] = e;
});
});
-var CM = /(\d+(\.\d+)?)px/;
-function Ni(i) {
+var IM = /(\d+(\.\d+)?)px/;
+function Di(i) {
if (i === "0" || ue.isUndefined(i))
return 0;
- var e = i.match(CM);
+ var e = i.match(IM);
return ue.isNull(e) ? 0 : parseFloat(e[1]);
}
var te = {
@@ -27027,7 +27027,7 @@ var te = {
ue.isUndefined(r) && (r = !0), ue.isUndefined(s) && (s = !0), e.style.position = "absolute", r && (e.style.left = 0, e.style.right = 0), s && (e.style.top = 0, e.style.bottom = 0);
},
fakeEvent: function(e, t, n, s) {
- var r = n || {}, a = rx[t];
+ var r = n || {}, a = ax[t];
if (!a)
throw new Error("Event type " + t + " not supported.");
var o = document.createEvent(a);
@@ -27107,11 +27107,11 @@ var te = {
},
getWidth: function(e) {
var t = getComputedStyle(e);
- return Ni(t["border-left-width"]) + Ni(t["border-right-width"]) + Ni(t["padding-left"]) + Ni(t["padding-right"]) + Ni(t.width);
+ return Di(t["border-left-width"]) + Di(t["border-right-width"]) + Di(t["padding-left"]) + Di(t["padding-right"]) + Di(t.width);
},
getHeight: function(e) {
var t = getComputedStyle(e);
- return Ni(t["border-top-width"]) + Ni(t["border-bottom-width"]) + Ni(t["padding-top"]) + Ni(t["padding-bottom"]) + Ni(t.height);
+ return Di(t["border-top-width"]) + Di(t["border-bottom-width"]) + Di(t["padding-top"]) + Di(t["padding-bottom"]) + Di(t.height);
},
getOffset: function(e) {
var t = e, n = { left: 0, top: 0 };
@@ -27124,10 +27124,10 @@ var te = {
isActive: function(e) {
return e === document.activeElement && (e.type || e.href);
}
-}, ax = (function(i) {
+}, ox = (function(i) {
Zs(e, i);
function e(t, n) {
- Ti(this, e);
+ Ri(this, e);
var s = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;
s.__prev = s.getValue(), s.__checkbox = document.createElement("input"), s.__checkbox.setAttribute("type", "checkbox");
function a() {
@@ -27135,7 +27135,7 @@ var te = {
}
return te.bind(s.__checkbox, "change", a, !1), s.domElement.appendChild(s.__checkbox), s.updateDisplay(), s;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "setValue",
value: function(n) {
var s = js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, n);
@@ -27147,10 +27147,10 @@ var te = {
return this.getValue() === !0 ? (this.__checkbox.setAttribute("checked", "checked"), this.__checkbox.checked = !0, this.__prev = !0) : (this.__checkbox.checked = !1, this.__prev = !1), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);
}
}]), e;
-})(Gr), IM = (function(i) {
+})(Gr), SM = (function(i) {
Zs(e, i);
function e(t, n, s) {
- Ti(this, e);
+ Ri(this, e);
var r = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), a = s, o = r;
if (r.__select = document.createElement("select"), ue.isArray(a)) {
var c = {};
@@ -27166,7 +27166,7 @@ var te = {
o.setValue(l);
}), r.domElement.appendChild(r.__select), r;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "setValue",
value: function(n) {
var s = js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, n);
@@ -27178,10 +27178,10 @@ var te = {
return te.isActive(this.__select) ? this : (this.__select.value = this.getValue(), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this));
}
}]), e;
-})(Gr), SM = (function(i) {
+})(Gr), MM = (function(i) {
Zs(e, i);
function e(t, n) {
- Ti(this, e);
+ Ri(this, e);
var s = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;
function a() {
r.setValue(r.__input.value);
@@ -27193,25 +27193,25 @@ var te = {
c.keyCode === 13 && this.blur();
}), s.updateDisplay(), s.domElement.appendChild(s.__input), s;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "updateDisplay",
value: function() {
return te.isActive(this.__input) || (this.__input.value = this.getValue()), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);
}
}]), e;
})(Gr);
-function hg(i) {
+function dg(i) {
var e = i.toString();
return e.indexOf(".") > -1 ? e.length - e.indexOf(".") - 1 : 0;
}
-var ox = (function(i) {
+var cx = (function(i) {
Zs(e, i);
function e(t, n, s) {
- Ti(this, e);
+ Ri(this, e);
var r = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), a = s || {};
- return r.__min = a.min, r.__max = a.max, r.__step = a.step, ue.isUndefined(r.__step) ? r.initialValue === 0 ? r.__impliedStep = 1 : r.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(r.initialValue)) / Math.LN10)) / 10 : r.__impliedStep = r.__step, r.__precision = hg(r.__impliedStep), r;
+ return r.__min = a.min, r.__max = a.max, r.__step = a.step, ue.isUndefined(r.__step) ? r.initialValue === 0 ? r.__impliedStep = 1 : r.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(r.initialValue)) / Math.LN10)) / 10 : r.__impliedStep = r.__step, r.__precision = dg(r.__impliedStep), r;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "setValue",
value: function(n) {
var s = n;
@@ -27230,18 +27230,18 @@ var ox = (function(i) {
}, {
key: "step",
value: function(n) {
- return this.__step = n, this.__impliedStep = n, this.__precision = hg(n), this;
+ return this.__step = n, this.__impliedStep = n, this.__precision = dg(n), this;
}
}]), e;
})(Gr);
-function MM(i, e) {
+function BM(i, e) {
var t = Math.pow(10, e);
return Math.round(i * t) / t;
}
-var Jl = (function(i) {
+var $l = (function(i) {
Zs(e, i);
function e(t, n, s) {
- Ti(this, e);
+ Ri(this, e);
var r = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n, s));
r.__truncationSuspended = !1;
var a = r, o = void 0;
@@ -27269,20 +27269,20 @@ var Jl = (function(i) {
p.keyCode === 13 && (a.__truncationSuspended = !0, this.blur(), a.__truncationSuspended = !1, l());
}), r.updateDisplay(), r.domElement.appendChild(r.__input), r;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "updateDisplay",
value: function() {
- return this.__input.value = this.__truncationSuspended ? this.getValue() : MM(this.getValue(), this.__precision), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);
+ return this.__input.value = this.__truncationSuspended ? this.getValue() : BM(this.getValue(), this.__precision), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);
}
}]), e;
-})(ox);
-function ug(i, e, t, n, s) {
+})(cx);
+function fg(i, e, t, n, s) {
return n + (s - n) * ((i - e) / (t - e));
}
-var Yd = (function(i) {
+var Zd = (function(i) {
Zs(e, i);
function e(t, n, s, r, a) {
- Ti(this, e);
+ Ri(this, e);
var o = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n, { min: s, max: r, step: a })), c = o;
o.__background = document.createElement("div"), o.__foreground = document.createElement("div"), te.bind(o.__background, "mousedown", l), te.bind(o.__background, "touchstart", d), te.addClass(o.__background, "slider"), te.addClass(o.__foreground, "slider-fg");
function l(m) {
@@ -27291,7 +27291,7 @@ var Yd = (function(i) {
function h(m) {
m.preventDefault();
var g = c.__background.getBoundingClientRect();
- return c.setValue(ug(m.clientX, g.left, g.right, c.__min, c.__max)), !1;
+ return c.setValue(fg(m.clientX, g.left, g.right, c.__min, c.__max)), !1;
}
function u() {
te.unbind(window, "mousemove", h), te.unbind(window, "mouseup", u), c.__onFinishChange && c.__onFinishChange.call(c, c.getValue());
@@ -27301,39 +27301,39 @@ var Yd = (function(i) {
}
function f(m) {
var g = m.touches[0].clientX, A = c.__background.getBoundingClientRect();
- c.setValue(ug(g, A.left, A.right, c.__min, c.__max));
+ c.setValue(fg(g, A.left, A.right, c.__min, c.__max));
}
function p() {
te.unbind(window, "touchmove", f), te.unbind(window, "touchend", p), c.__onFinishChange && c.__onFinishChange.call(c, c.getValue());
}
return o.updateDisplay(), o.__background.appendChild(o.__foreground), o.domElement.appendChild(o.__background), o;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "updateDisplay",
value: function() {
var n = (this.getValue() - this.__min) / (this.__max - this.__min);
return this.__foreground.style.width = n * 100 + "%", js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);
}
}]), e;
-})(ox), cx = (function(i) {
+})(cx), lx = (function(i) {
Zs(e, i);
function e(t, n, s) {
- Ti(this, e);
+ Ri(this, e);
var r = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), a = r;
return r.__button = document.createElement("div"), r.__button.innerHTML = s === void 0 ? "Fire" : s, te.bind(r.__button, "click", function(o) {
return o.preventDefault(), a.fire(), !1;
}), te.addClass(r.__button, "button"), r.domElement.appendChild(r.__button), r;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "fire",
value: function() {
this.__onChange && this.__onChange.call(this), this.getValue().call(this.object), this.__onFinishChange && this.__onFinishChange.call(this, this.getValue());
}
}]), e;
-})(Gr), Jd = (function(i) {
+})(Gr), $d = (function(i) {
Zs(e, i);
function e(t, n) {
- Ti(this, e);
+ Ri(this, e);
var s = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n));
s.__color = new vn(s.getValue()), s.__temp = new vn(0);
var r = s;
@@ -27380,7 +27380,7 @@ var Yd = (function(i) {
width: "100%",
height: "100%",
background: "none"
- }), dg(a, "top", "rgba(0,0,0,0)", "#000"), ue.extend(s.__hue_field.style, {
+ }), pg(a, "top", "rgba(0,0,0,0)", "#000"), ue.extend(s.__hue_field.style, {
width: "15px",
height: "100px",
border: "1px solid #555",
@@ -27388,7 +27388,7 @@ var Yd = (function(i) {
position: "absolute",
top: "3px",
right: "3px"
- }), TM(s.__hue_field), ue.extend(s.__input.style, {
+ }), RM(s.__hue_field), ue.extend(s.__input.style, {
outline: "none",
textAlign: "center",
color: "#fff",
@@ -27409,7 +27409,7 @@ var Yd = (function(i) {
te.unbind(window, "mousemove", p), te.unbind(window, "touchmove", p), te.unbind(window, "mouseup", h), te.unbind(window, "touchend", h), d();
}
function u() {
- var m = Xd(this.value);
+ var m = Jd(this.value);
m !== !1 ? (r.__color.__state = m, r.setValue(r.__color.toOriginal())) : this.value = r.__color.toString();
}
function d() {
@@ -27428,10 +27428,10 @@ var Yd = (function(i) {
}
return s;
}
- return Ri(e, [{
+ return Fi(e, [{
key: "updateDisplay",
value: function() {
- var n = Xd(this.getValue());
+ var n = Jd(this.getValue());
if (n !== !1) {
var s = !1;
ue.each(vn.COMPONENTS, function(o) {
@@ -27446,23 +27446,23 @@ var Yd = (function(i) {
marginTop: 100 * (1 - this.__color.v) - 7 + "px",
backgroundColor: this.__temp.toHexString(),
border: this.__field_knob_border + "rgb(" + r + "," + r + "," + r + ")"
- }), this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + "px", this.__temp.s = 1, this.__temp.v = 1, dg(this.__saturation_field, "left", "#fff", this.__temp.toHexString()), this.__input.value = this.__color.toString(), ue.extend(this.__input.style, {
+ }), this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + "px", this.__temp.s = 1, this.__temp.v = 1, pg(this.__saturation_field, "left", "#fff", this.__temp.toHexString()), this.__input.value = this.__color.toString(), ue.extend(this.__input.style, {
backgroundColor: this.__color.toHexString(),
color: "rgb(" + r + "," + r + "," + r + ")",
textShadow: this.__input_textShadow + "rgba(" + a + "," + a + "," + a + ",.7)"
});
}
}]), e;
-})(Gr), BM = ["-moz-", "-o-", "-webkit-", "-ms-", ""];
-function dg(i, e, t, n) {
- i.style.background = "", ue.each(BM, function(s) {
+})(Gr), TM = ["-moz-", "-o-", "-webkit-", "-ms-", ""];
+function pg(i, e, t, n) {
+ i.style.background = "", ue.each(TM, function(s) {
i.style.cssText += "background: " + s + "linear-gradient(" + e + ", " + t + " 0%, " + n + " 100%); ";
});
}
-function TM(i) {
+function RM(i) {
i.style.background = "", i.style.cssText += "background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);", i.style.cssText += "background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", i.style.cssText += "background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", i.style.cssText += "background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", i.style.cssText += "background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
}
-var RM = {
+var FM = {
load: function(e, t) {
var n = t || document, s = n.createElement("link");
s.type = "text/css", s.rel = "stylesheet", s.href = e, n.getElementsByTagName("head")[0].appendChild(s);
@@ -27476,7 +27476,7 @@ var RM = {
} catch {
}
}
-}, FM = `<div id="dg-save" class="dg dialogue">
+}, NM = `<div id="dg-save" class="dg dialogue">
Here's the new load parameter for your <code>GUI</code>'s constructor:
@@ -27496,16 +27496,16 @@ var RM = {
</div>
-</div>`, NM = function(e, t) {
+</div>`, DM = function(e, t) {
var n = e[t];
- return ue.isArray(arguments[2]) || ue.isObject(arguments[2]) ? new IM(e, t, arguments[2]) : ue.isNumber(n) ? ue.isNumber(arguments[2]) && ue.isNumber(arguments[3]) ? ue.isNumber(arguments[4]) ? new Yd(e, t, arguments[2], arguments[3], arguments[4]) : new Yd(e, t, arguments[2], arguments[3]) : ue.isNumber(arguments[4]) ? new Jl(e, t, { min: arguments[2], max: arguments[3], step: arguments[4] }) : new Jl(e, t, { min: arguments[2], max: arguments[3] }) : ue.isString(n) ? new SM(e, t) : ue.isFunction(n) ? new cx(e, t, "") : ue.isBoolean(n) ? new ax(e, t) : null;
+ return ue.isArray(arguments[2]) || ue.isObject(arguments[2]) ? new SM(e, t, arguments[2]) : ue.isNumber(n) ? ue.isNumber(arguments[2]) && ue.isNumber(arguments[3]) ? ue.isNumber(arguments[4]) ? new Zd(e, t, arguments[2], arguments[3], arguments[4]) : new Zd(e, t, arguments[2], arguments[3]) : ue.isNumber(arguments[4]) ? new $l(e, t, { min: arguments[2], max: arguments[3], step: arguments[4] }) : new $l(e, t, { min: arguments[2], max: arguments[3] }) : ue.isString(n) ? new MM(e, t) : ue.isFunction(n) ? new lx(e, t, "") : ue.isBoolean(n) ? new ox(e, t) : null;
};
-function DM(i) {
+function LM(i) {
setTimeout(i, 1e3 / 60);
}
-var LM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || DM, PM = (function() {
+var PM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || LM, kM = (function() {
function i() {
- Ti(this, i), this.backgroundElement = document.createElement("div"), ue.extend(this.backgroundElement.style, {
+ Ri(this, i), this.backgroundElement = document.createElement("div"), ue.extend(this.backgroundElement.style, {
backgroundColor: "rgba(0,0,0,0.8)",
top: 0,
left: 0,
@@ -27527,7 +27527,7 @@ var LM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || w
e.hide();
});
}
- return Ri(i, [{
+ return Fi(i, [{
key: "show",
value: function() {
var t = this;
@@ -27549,26 +27549,26 @@ var LM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || w
this.domElement.style.left = window.innerWidth / 2 - te.getWidth(this.domElement) / 2 + "px", this.domElement.style.top = window.innerHeight / 2 - te.getHeight(this.domElement) / 2 + "px";
}
}]), i;
-})(), kM = yM(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
+})(), UM = _M(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
`);
-RM.inject(kM);
-var fg = "dg", pg = 72, Ag = 20, $o = "Default", vo = (function() {
+FM.inject(UM);
+var Ag = "dg", gg = 72, mg = 20, ec = "Default", Co = (function() {
try {
return !!window.localStorage;
} catch {
return !1;
}
-})(), Lo = void 0, gg = !0, da = void 0, vu = !1, lx = [], kt = function i(e) {
+})(), Po = void 0, xg = !0, fa = void 0, Iu = !1, hx = [], kt = function i(e) {
var t = this, n = e || {};
- this.domElement = document.createElement("div"), this.__ul = document.createElement("ul"), this.domElement.appendChild(this.__ul), te.addClass(this.domElement, fg), this.__folders = {}, this.__controllers = [], this.__rememberedObjects = [], this.__rememberedObjectIndecesToControllers = [], this.__listening = [], n = ue.defaults(n, {
+ this.domElement = document.createElement("div"), this.__ul = document.createElement("ul"), this.domElement.appendChild(this.__ul), te.addClass(this.domElement, Ag), this.__folders = {}, this.__controllers = [], this.__rememberedObjects = [], this.__rememberedObjectIndecesToControllers = [], this.__listening = [], n = ue.defaults(n, {
closeOnTop: !1,
autoPlace: !0,
width: i.DEFAULT_WIDTH
}), n = ue.defaults(n, {
resizable: n.autoPlace,
hideable: n.autoPlace
- }), ue.isUndefined(n.load) ? n.load = { preset: $o } : n.preset && (n.load.preset = n.preset), ue.isUndefined(n.parent) && n.hideable && lx.push(this), n.resizable = ue.isUndefined(n.parent) && n.resizable, n.autoPlace && ue.isUndefined(n.scrollable) && (n.scrollable = !0);
- var s = vo && localStorage.getItem(fa(this, "isLocal")) === "true", r = void 0, a = void 0;
+ }), ue.isUndefined(n.load) ? n.load = { preset: ec } : n.preset && (n.load.preset = n.preset), ue.isUndefined(n.parent) && n.hideable && hx.push(this), n.resizable = ue.isUndefined(n.parent) && n.resizable, n.autoPlace && ue.isUndefined(n.scrollable) && (n.scrollable = !0);
+ var s = Co && localStorage.getItem(pa(this, "isLocal")) === "true", r = void 0, a = void 0;
if (Object.defineProperties(
this,
{
@@ -27597,7 +27597,7 @@ var fg = "dg", pg = 72, Ag = 20, $o = "Default", vo = (function() {
return t.parent ? t.getRoot().preset : n.load.preset;
},
set: function(d) {
- t.parent ? t.getRoot().preset = d : n.load.preset = d, GM(this), t.revert();
+ t.parent ? t.getRoot().preset = d : n.load.preset = d, HM(this), t.revert();
}
},
width: {
@@ -27605,7 +27605,7 @@ var fg = "dg", pg = 72, Ag = 20, $o = "Default", vo = (function() {
return n.width;
},
set: function(d) {
- n.width = d, ef(t, d);
+ n.width = d, nf(t, d);
}
},
name: {
@@ -27634,14 +27634,14 @@ var fg = "dg", pg = 72, Ag = 20, $o = "Default", vo = (function() {
return s;
},
set: function(d) {
- vo && (s = d, d ? te.bind(window, "unload", r) : te.unbind(window, "unload", r), localStorage.setItem(fa(t, "isLocal"), d));
+ Co && (s = d, d ? te.bind(window, "unload", r) : te.unbind(window, "unload", r), localStorage.setItem(pa(t, "isLocal"), d));
}
}
}
), ue.isUndefined(n.parent)) {
- if (this.closed = n.closed || !1, te.addClass(this.domElement, i.CLASS_MAIN), te.makeSelectable(this.domElement, !1), vo && s) {
+ if (this.closed = n.closed || !1, te.addClass(this.domElement, i.CLASS_MAIN), te.makeSelectable(this.domElement, !1), Co && s) {
t.useLocalStorage = !0;
- var o = localStorage.getItem(fa(this, "gui"));
+ var o = localStorage.getItem(pa(this, "gui"));
o && (n.load = JSON.parse(o));
}
this.__closeButton = document.createElement("div"), this.__closeButton.innerHTML = i.TEXT_CLOSED, te.addClass(this.__closeButton, i.CLASS_CLOSE_BUTTON), n.closeOnTop ? (te.addClass(this.__closeButton, i.CLASS_CLOSE_TOP), this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0])) : (te.addClass(this.__closeButton, i.CLASS_CLOSE_BOTTOM), this.domElement.appendChild(this.__closeButton)), te.bind(this.__closeButton, "click", function() {
@@ -27650,16 +27650,16 @@ var fg = "dg", pg = 72, Ag = 20, $o = "Default", vo = (function() {
} else {
n.closed === void 0 && (n.closed = !0);
var c = document.createTextNode(n.name);
- te.addClass(c, "controller-name"), a = rp(t, c);
+ te.addClass(c, "controller-name"), a = op(t, c);
var l = function(d) {
return d.preventDefault(), t.closed = !t.closed, !1;
};
te.addClass(this.__ul, i.CLASS_CLOSED), te.addClass(a, "title"), te.bind(a, "click", l), n.closed || (this.closed = !1);
}
- n.autoPlace && (ue.isUndefined(n.parent) && (gg && (da = document.createElement("div"), te.addClass(da, fg), te.addClass(da, i.CLASS_AUTO_PLACE_CONTAINER), document.body.appendChild(da), gg = !1), da.appendChild(this.domElement), te.addClass(this.domElement, i.CLASS_AUTO_PLACE)), this.parent || ef(t, n.width)), this.__resizeHandler = function() {
+ n.autoPlace && (ue.isUndefined(n.parent) && (xg && (fa = document.createElement("div"), te.addClass(fa, Ag), te.addClass(fa, i.CLASS_AUTO_PLACE_CONTAINER), document.body.appendChild(fa), xg = !1), fa.appendChild(this.domElement), te.addClass(this.domElement, i.CLASS_AUTO_PLACE)), this.parent || nf(t, n.width)), this.__resizeHandler = function() {
t.onResizeDebounced();
- }, te.bind(window, "resize", this.__resizeHandler), te.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler), te.bind(this.__ul, "transitionend", this.__resizeHandler), te.bind(this.__ul, "oTransitionEnd", this.__resizeHandler), this.onResize(), n.resizable && QM(this), r = function() {
- vo && localStorage.getItem(fa(t, "isLocal")) === "true" && localStorage.setItem(fa(t, "gui"), JSON.stringify(t.getSaveObject()));
+ }, te.bind(window, "resize", this.__resizeHandler), te.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler), te.bind(this.__ul, "transitionend", this.__resizeHandler), te.bind(this.__ul, "oTransitionEnd", this.__resizeHandler), this.onResize(), n.resizable && GM(this), r = function() {
+ Co && localStorage.getItem(pa(t, "isLocal")) === "true" && localStorage.setItem(pa(t, "gui"), JSON.stringify(t.getSaveObject()));
}, this.saveToLocalStorageIfPossible = r;
function h() {
var u = t.getRoot();
@@ -27670,8 +27670,8 @@ var fg = "dg", pg = 72, Ag = 20, $o = "Default", vo = (function() {
n.parent || h();
};
kt.toggleHide = function() {
- vu = !vu, ue.each(lx, function(i) {
- i.domElement.style.display = vu ? "none" : "";
+ Iu = !Iu, ue.each(hx, function(i) {
+ i.domElement.style.display = Iu ? "none" : "";
});
};
kt.CLASS_AUTO_PLACE = "a";
@@ -27688,19 +27688,19 @@ kt.DEFAULT_WIDTH = 245;
kt.TEXT_CLOSED = "Close Controls";
kt.TEXT_OPEN = "Open Controls";
kt._keydownHandler = function(i) {
- document.activeElement.type !== "text" && (i.which === pg || i.keyCode === pg) && kt.toggleHide();
+ document.activeElement.type !== "text" && (i.which === gg || i.keyCode === gg) && kt.toggleHide();
};
te.bind(window, "keydown", kt._keydownHandler, !1);
ue.extend(
kt.prototype,
{
add: function(e, t) {
- return Po(this, e, t, {
+ return ko(this, e, t, {
factoryArgs: Array.prototype.slice.call(arguments, 2)
});
},
addColor: function(e, t) {
- return Po(this, e, t, {
+ return ko(this, e, t, {
color: !0
});
},
@@ -27714,11 +27714,11 @@ ue.extend(
destroy: function() {
if (this.parent)
throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");
- this.autoPlace && da.removeChild(this.domElement);
+ this.autoPlace && fa.removeChild(this.domElement);
var e = this;
ue.each(this.__folders, function(t) {
e.removeFolder(t);
- }), te.unbind(window, "keydown", kt._keydownHandler, !1), mg(this);
+ }), te.unbind(window, "keydown", kt._keydownHandler, !1), bg(this);
},
addFolder: function(e) {
if (this.__folders[e] !== void 0)
@@ -27727,11 +27727,11 @@ ue.extend(
t.autoPlace = this.autoPlace, this.load && this.load.folders && this.load.folders[e] && (t.closed = this.load.folders[e].closed, t.load = this.load.folders[e]);
var n = new kt(t);
this.__folders[e] = n;
- var s = rp(this, n.domElement);
+ var s = op(this, n.domElement);
return te.addClass(s, "folder"), n;
},
removeFolder: function(e) {
- this.__ul.removeChild(e.domElement.parentElement), delete this.__folders[e.name], this.load && this.load.folders && this.load.folders[e.name] && delete this.load.folders[e.name], mg(e);
+ this.__ul.removeChild(e.domElement.parentElement), delete this.__folders[e.name], this.load && this.load.folders && this.load.folders[e.name] && delete this.load.folders[e.name], bg(e);
var t = this;
ue.each(e.__folders, function(n) {
e.removeFolder(n);
@@ -27757,7 +27757,7 @@ ue.extend(
var t = te.getOffset(e.__ul).top, n = 0;
ue.each(e.__ul.childNodes, function(s) {
e.autoPlace && s === e.__save_row || (n += te.getHeight(s));
- }), window.innerHeight - t - Ag < n ? (te.addClass(e.domElement, kt.CLASS_TOO_TALL), e.__ul.style.height = window.innerHeight - t - Ag + "px") : (te.removeClass(e.domElement, kt.CLASS_TOO_TALL), e.__ul.style.height = "auto");
+ }), window.innerHeight - t - mg < n ? (te.addClass(e.domElement, kt.CLASS_TOO_TALL), e.__ul.style.height = window.innerHeight - t - mg + "px") : (te.removeClass(e.domElement, kt.CLASS_TOO_TALL), e.__ul.style.height = "auto");
}
e.__resize_handle && ue.defer(function() {
e.__resize_handle.style.height = e.__ul.offsetHeight + "px";
@@ -27767,12 +27767,12 @@ ue.extend(
this.onResize();
}, 50),
remember: function() {
- if (ue.isUndefined(Lo) && (Lo = new PM(), Lo.domElement.innerHTML = FM), this.parent)
+ if (ue.isUndefined(Po) && (Po = new kM(), Po.domElement.innerHTML = NM), this.parent)
throw new Error("You can only call remember on a top level GUI.");
var e = this;
ue.each(Array.prototype.slice.call(arguments), function(t) {
- e.__rememberedObjects.length === 0 && OM(e), e.__rememberedObjects.indexOf(t) === -1 && e.__rememberedObjects.push(t);
- }), this.autoPlace && ef(this, this.width);
+ e.__rememberedObjects.length === 0 && QM(e), e.__rememberedObjects.indexOf(t) === -1 && e.__rememberedObjects.push(t);
+ }), this.autoPlace && nf(this, this.width);
},
getRoot: function() {
for (var e = this; e.parent; )
@@ -27781,26 +27781,26 @@ ue.extend(
},
getSaveObject: function() {
var e = this.load;
- return e.closed = this.closed, this.__rememberedObjects.length > 0 && (e.preset = this.preset, e.remembered || (e.remembered = {}), e.remembered[this.preset] = rl(this)), e.folders = {}, ue.each(this.__folders, function(t, n) {
+ return e.closed = this.closed, this.__rememberedObjects.length > 0 && (e.preset = this.preset, e.remembered || (e.remembered = {}), e.remembered[this.preset] = al(this)), e.folders = {}, ue.each(this.__folders, function(t, n) {
e.folders[n] = t.getSaveObject();
}), e;
},
save: function() {
- this.load.remembered || (this.load.remembered = {}), this.load.remembered[this.preset] = rl(this), Zd(this, !1), this.saveToLocalStorageIfPossible();
+ this.load.remembered || (this.load.remembered = {}), this.load.remembered[this.preset] = al(this), ef(this, !1), this.saveToLocalStorageIfPossible();
},
saveAs: function(e) {
- this.load.remembered || (this.load.remembered = {}, this.load.remembered[$o] = rl(this, !0)), this.load.remembered[e] = rl(this), this.preset = e, $d(this, e, !0), this.saveToLocalStorageIfPossible();
+ this.load.remembered || (this.load.remembered = {}, this.load.remembered[ec] = al(this, !0)), this.load.remembered[e] = al(this), this.preset = e, tf(this, e, !0), this.saveToLocalStorageIfPossible();
},
revert: function(e) {
ue.each(this.__controllers, function(t) {
- this.getRoot().load.remembered ? hx(e || this.getRoot(), t) : t.setValue(t.initialValue), t.__onFinishChange && t.__onFinishChange.call(t, t.getValue());
+ this.getRoot().load.remembered ? ux(e || this.getRoot(), t) : t.setValue(t.initialValue), t.__onFinishChange && t.__onFinishChange.call(t, t.getValue());
}, this), ue.each(this.__folders, function(t) {
t.revert(t);
- }), e || Zd(this.getRoot(), !1);
+ }), e || ef(this.getRoot(), !1);
},
listen: function(e) {
var t = this.__listening.length === 0;
- this.__listening.push(e), t && ux(this.__listening);
+ this.__listening.push(e), t && dx(this.__listening);
},
updateDisplay: function() {
ue.each(this.__controllers, function(e) {
@@ -27811,30 +27811,30 @@ ue.extend(
}
}
);
-function rp(i, e, t) {
+function op(i, e, t) {
var n = document.createElement("li");
return e && n.appendChild(e), t ? i.__ul.insertBefore(n, t) : i.__ul.appendChild(n), i.onResize(), n;
}
-function mg(i) {
+function bg(i) {
te.unbind(window, "resize", i.__resizeHandler), i.saveToLocalStorageIfPossible && te.unbind(window, "unload", i.saveToLocalStorageIfPossible);
}
-function Zd(i, e) {
+function ef(i, e) {
var t = i.__preset_select[i.__preset_select.selectedIndex];
e ? t.innerHTML = t.value + "*" : t.innerHTML = t.value;
}
-function UM(i, e, t) {
+function OM(i, e, t) {
if (t.__li = e, t.__gui = i, ue.extend(t, {
options: function(a) {
if (arguments.length > 1) {
var o = t.__li.nextElementSibling;
- return t.remove(), Po(i, t.object, t.property, {
+ return t.remove(), ko(i, t.object, t.property, {
before: o,
factoryArgs: [ue.toArray(arguments)]
});
}
if (ue.isArray(a) || ue.isObject(a)) {
var c = t.__li.nextElementSibling;
- return t.remove(), Po(i, t.object, t.property, {
+ return t.remove(), ko(i, t.object, t.property, {
before: c,
factoryArgs: [a]
});
@@ -27849,8 +27849,8 @@ function UM(i, e, t) {
remove: function() {
return t.__gui.remove(t), t;
}
- }), t instanceof Yd) {
- var n = new Jl(t.object, t.property, { min: t.__min, max: t.__max, step: t.__step });
+ }), t instanceof Zd) {
+ var n = new $l(t.object, t.property, { min: t.__min, max: t.__max, step: t.__step });
ue.each(["updateDisplay", "onChange", "onFinishChange", "step", "min", "max"], function(r) {
var a = t[r], o = n[r];
t[r] = n[r] = function() {
@@ -27858,12 +27858,12 @@ function UM(i, e, t) {
return o.apply(n, c), a.apply(t, c);
};
}), te.addClass(e, "has-slider"), t.domElement.insertBefore(n.domElement, t.domElement.firstElementChild);
- } else if (t instanceof Jl) {
+ } else if (t instanceof $l) {
var s = function(a) {
if (ue.isNumber(t.__min) && ue.isNumber(t.__max)) {
var o = t.__li.firstElementChild.firstElementChild.innerHTML, c = t.__gui.__listening.indexOf(t) > -1;
t.remove();
- var l = Po(i, t.object, t.property, {
+ var l = ko(i, t.object, t.property, {
before: t.__li.nextElementSibling,
factoryArgs: [t.__min, t.__max, t.__step]
});
@@ -27872,24 +27872,24 @@ function UM(i, e, t) {
return a;
};
t.min = ue.compose(s, t.min), t.max = ue.compose(s, t.max);
- } else t instanceof ax ? (te.bind(e, "click", function() {
+ } else t instanceof ox ? (te.bind(e, "click", function() {
te.fakeEvent(t.__checkbox, "click");
}), te.bind(t.__checkbox, "click", function(r) {
r.stopPropagation();
- })) : t instanceof cx ? (te.bind(e, "click", function() {
+ })) : t instanceof lx ? (te.bind(e, "click", function() {
te.fakeEvent(t.__button, "click");
}), te.bind(e, "mouseover", function() {
te.addClass(t.__button, "hover");
}), te.bind(e, "mouseout", function() {
te.removeClass(t.__button, "hover");
- })) : t instanceof Jd && (te.addClass(e, "color"), t.updateDisplay = ue.compose(function(r) {
+ })) : t instanceof $d && (te.addClass(e, "color"), t.updateDisplay = ue.compose(function(r) {
return e.style.borderLeftColor = t.__color.toString(), r;
}, t.updateDisplay), t.updateDisplay());
t.setValue = ue.compose(function(r) {
- return i.getRoot().__preset_select && t.isModified() && Zd(i.getRoot(), !0), r;
+ return i.getRoot().__preset_select && t.isModified() && ef(i.getRoot(), !0), r;
}, t.setValue);
}
-function hx(i, e) {
+function ux(i, e) {
var t = i.getRoot(), n = t.__rememberedObjects.indexOf(e.object);
if (n !== -1) {
var s = t.__rememberedObjectIndecesToControllers[n];
@@ -27897,8 +27897,8 @@ function hx(i, e) {
var r = t.load.remembered, a = void 0;
if (r[i.preset])
a = r[i.preset];
- else if (r[$o])
- a = r[$o];
+ else if (r[ec])
+ a = r[ec];
else
return;
if (a[n] && a[n][e.property] !== void 0) {
@@ -27908,35 +27908,35 @@ function hx(i, e) {
}
}
}
-function Po(i, e, t, n) {
+function ko(i, e, t, n) {
if (e[t] === void 0)
throw new Error('Object "' + e + '" has no property "' + t + '"');
var s = void 0;
if (n.color)
- s = new Jd(e, t);
+ s = new $d(e, t);
else {
var r = [e, t].concat(n.factoryArgs);
- s = NM.apply(i, r);
+ s = DM.apply(i, r);
}
- n.before instanceof Gr && (n.before = n.before.__li), hx(i, s), te.addClass(s.domElement, "c");
+ n.before instanceof Gr && (n.before = n.before.__li), ux(i, s), te.addClass(s.domElement, "c");
var a = document.createElement("span");
te.addClass(a, "property-name"), a.innerHTML = s.property;
var o = document.createElement("div");
o.appendChild(a), o.appendChild(s.domElement);
- var c = rp(i, o, n.before);
- return te.addClass(c, kt.CLASS_CONTROLLER_ROW), s instanceof Jd ? te.addClass(c, "color") : te.addClass(c, wM(s.getValue())), UM(i, c, s), i.__controllers.push(s), s;
+ var c = op(i, o, n.before);
+ return te.addClass(c, kt.CLASS_CONTROLLER_ROW), s instanceof $d ? te.addClass(c, "color") : te.addClass(c, vM(s.getValue())), OM(i, c, s), i.__controllers.push(s), s;
}
-function fa(i, e) {
+function pa(i, e) {
return document.location.href + "." + e;
}
-function $d(i, e, t) {
+function tf(i, e, t) {
var n = document.createElement("option");
n.innerHTML = e, n.value = e, i.__preset_select.appendChild(n), t && (i.__preset_select.selectedIndex = i.__preset_select.length - 1);
}
-function xg(i, e) {
+function Eg(i, e) {
e.style.display = i.useLocalStorage ? "block" : "none";
}
-function OM(i) {
+function QM(i) {
var e = i.__save_row = document.createElement("li");
te.addClass(i.domElement, "has-save"), i.__ul.insertBefore(e, i.__ul.firstChild), te.addClass(e, "save-row");
var t = document.createElement("span");
@@ -27949,22 +27949,22 @@ function OM(i) {
r.innerHTML = "Revert", te.addClass(r, "button"), te.addClass(r, "revert");
var a = i.__preset_select = document.createElement("select");
if (i.load && i.load.remembered ? ue.each(i.load.remembered, function(u, d) {
- $d(i, d, d === i.preset);
- }) : $d(i, $o, !1), te.bind(a, "change", function() {
+ tf(i, d, d === i.preset);
+ }) : tf(i, ec, !1), te.bind(a, "change", function() {
for (var u = 0; u < i.__preset_select.length; u++)
i.__preset_select[u].innerHTML = i.__preset_select[u].value;
i.preset = this.value;
- }), e.appendChild(a), e.appendChild(t), e.appendChild(n), e.appendChild(s), e.appendChild(r), vo) {
+ }), e.appendChild(a), e.appendChild(t), e.appendChild(n), e.appendChild(s), e.appendChild(r), Co) {
var o = document.getElementById("dg-local-explain"), c = document.getElementById("dg-local-storage"), l = document.getElementById("dg-save-locally");
- l.style.display = "block", localStorage.getItem(fa(i, "isLocal")) === "true" && c.setAttribute("checked", "checked"), xg(i, o), te.bind(c, "change", function() {
- i.useLocalStorage = !i.useLocalStorage, xg(i, o);
+ l.style.display = "block", localStorage.getItem(pa(i, "isLocal")) === "true" && c.setAttribute("checked", "checked"), Eg(i, o), te.bind(c, "change", function() {
+ i.useLocalStorage = !i.useLocalStorage, Eg(i, o);
});
}
var h = document.getElementById("dg-new-constructor");
te.bind(h, "keydown", function(u) {
- u.metaKey && (u.which === 67 || u.keyCode === 67) && Lo.hide();
+ u.metaKey && (u.which === 67 || u.keyCode === 67) && Po.hide();
}), te.bind(t, "click", function() {
- h.innerHTML = JSON.stringify(i.getSaveObject(), void 0, 2), Lo.show(), h.focus(), h.select();
+ h.innerHTML = JSON.stringify(i.getSaveObject(), void 0, 2), Po.show(), h.focus(), h.select();
}), te.bind(n, "click", function() {
i.save();
}), te.bind(s, "click", function() {
@@ -27974,7 +27974,7 @@ function OM(i) {
i.revert();
});
}
-function QM(i) {
+function GM(i) {
var e = void 0;
i.__resize_handle = document.createElement("div"), ue.extend(i.__resize_handle.style, {
width: "6px",
@@ -27994,10 +27994,10 @@ function QM(i) {
}
te.bind(i.__resize_handle, "mousedown", s), te.bind(i.__closeButton, "mousedown", s), i.domElement.insertBefore(i.__resize_handle, i.domElement.firstElementChild);
}
-function ef(i, e) {
+function nf(i, e) {
i.domElement.style.width = e + "px", i.__save_row && i.autoPlace && (i.__save_row.style.width = e + "px"), i.__closeButton && (i.__closeButton.style.width = e + "px");
}
-function rl(i, e) {
+function al(i, e) {
var t = {};
return ue.each(i.__rememberedObjects, function(n, s) {
var r = {}, a = i.__rememberedObjectIndecesToControllers[s];
@@ -28006,19 +28006,19 @@ function rl(i, e) {
}), t[s] = r;
}), t;
}
-function GM(i) {
+function HM(i) {
for (var e = 0; e < i.__preset_select.length; e++)
i.__preset_select[e].value === i.preset && (i.__preset_select.selectedIndex = e);
}
-function ux(i) {
- i.length !== 0 && LM.call(window, function() {
- ux(i);
+function dx(i) {
+ i.length !== 0 && PM.call(window, function() {
+ dx(i);
}), ue.each(i, function(e) {
e.updateDisplay();
});
}
-var HM = kt;
-const al = [
+var zM = kt;
+const ol = [
{
id: "",
name: "None",
@@ -28042,7 +28042,7 @@ const al = [
path: "https://storage.googleapis.com/donmccurdy-static/footprint_court_2k.exr",
format: ".exr"
}
-], zM = [
+], VM = [
"BN",
"BN",
"BN",
@@ -28299,7 +28299,7 @@ const al = [
"L",
"L",
"L"
-], bg = [
+], yg = [
[697, 698, "ON"],
[706, 719, "ON"],
[722, 735, "ON"],
@@ -29015,12 +29015,12 @@ const al = [
[1048574, 1048575, "BN"],
[1114110, 1114111, "BN"]
];
-function VM(i) {
+function WM(i) {
if (i <= 255)
- return zM[i];
- let e = 0, t = bg.length - 1;
+ return VM[i];
+ let e = 0, t = yg.length - 1;
for (; e <= t; ) {
- const n = e + t >> 1, s = bg[n];
+ const n = e + t >> 1, s = yg[n];
if (i < s[0]) {
t = n - 1;
continue;
@@ -29033,7 +29033,7 @@ function VM(i) {
}
return "L";
}
-function WM(i) {
+function qM(i) {
const e = i.length;
if (e === 0)
return null;
@@ -29046,7 +29046,7 @@ function WM(i) {
const p = i.charCodeAt(l + 1);
p >= 56320 && p <= 57343 && (u = (h - 55296 << 10) + (p - 56320) + 65536, d = 2);
}
- const f = VM(u);
+ const f = WM(u);
(f === "R" || f === "AL" || f === "AN") && (n = !0);
for (let p = 0; p < d; p++)
t[l + p] = f;
@@ -29120,8 +29120,8 @@ function WM(i) {
}
return r;
}
-function qM(i, e) {
- const t = WM(i);
+function KM(i, e) {
+ const t = qM(i);
if (t === null)
return null;
const n = new Int8Array(e.length);
@@ -29129,32 +29129,32 @@ function qM(i, e) {
n[s] = t[e[s]];
return n;
}
-const KM = /[ \t\n\r\f]+/g, jM = /[\t\n\r\f]| {2,}|^ | $/;
-function XM(i) {
+const jM = /[ \t\n\r\f]+/g, XM = /[\t\n\r\f]| {2,}|^ | $/;
+function YM(i) {
const e = i ?? "normal";
return e === "pre-wrap" ? { mode: e, preserveOrdinarySpaces: !0, preserveHardBreaks: !0 } : { mode: e, preserveOrdinarySpaces: !1, preserveHardBreaks: !1 };
}
-function YM(i) {
- if (!jM.test(i))
+function JM(i) {
+ if (!XM.test(i))
return i;
- let e = i.replace(KM, " ");
+ let e = i.replace(jM, " ");
return e.charCodeAt(0) === 32 && (e = e.slice(1)), e.length > 0 && e.charCodeAt(e.length - 1) === 32 && (e = e.slice(0, -1)), e;
}
-function JM(i) {
+function ZM(i) {
return /[\r\f]/.test(i) ? i.replace(/\r\n/g, `
`).replace(/[\r\f]/g, `
`) : i.replace(/\r\n/g, `
`);
}
-let Cu = null, ZM;
-function $M() {
- return Cu === null && (Cu = new Intl.Segmenter(ZM, { granularity: "word" })), Cu;
+let Su = null, $M;
+function eB() {
+ return Su === null && (Su = new Intl.Segmenter($M, { granularity: "word" })), Su;
}
-const eB = new RegExp("\\p{Script=Arabic}", "u"), Eh = new RegExp("\\p{M}", "u"), dx = new RegExp("\\p{Nd}", "u");
-function Eg(i) {
- return eB.test(i);
+const tB = new RegExp("\\p{Script=Arabic}", "u"), _h = new RegExp("\\p{M}", "u"), fx = new RegExp("\\p{Nd}", "u");
+function _g(i) {
+ return tB.test(i);
}
-function yg(i) {
+function wg(i) {
return i >= 19968 && i <= 40959 || i >= 13312 && i <= 19903 || i >= 131072 && i <= 173791 || i >= 173824 && i <= 177983 || i >= 177984 && i <= 178207 || i >= 178208 && i <= 183983 || i >= 183984 && i <= 191471 || i >= 191472 && i <= 192093 || i >= 194560 && i <= 195103 || i >= 196608 && i <= 201551 || i >= 201552 && i <= 205743 || i >= 205744 && i <= 210041 || i >= 63744 && i <= 64255 || i >= 12288 && i <= 12351 || i >= 12352 && i <= 12447 || i >= 12448 && i <= 12543 || i >= 44032 && i <= 55215 || i >= 65280 && i <= 65519;
}
function Lr(i) {
@@ -29165,39 +29165,39 @@ function Lr(i) {
const n = i.charCodeAt(e + 1);
if (n >= 56320 && n <= 57343) {
const s = (t - 55296 << 10) + (n - 56320) + 65536;
- if (yg(s))
+ if (wg(s))
return !0;
e++;
continue;
}
}
- if (yg(t))
+ if (wg(t))
return !0;
}
}
return !1;
}
-function tB(i) {
- const e = _h(i);
- return e !== null && (ap.has(e) || Pr.has(e));
+function nB(i) {
+ const e = vh(i);
+ return e !== null && (cp.has(e) || Pr.has(e));
}
-const nB = /* @__PURE__ */ new Set([
+const iB = /* @__PURE__ */ new Set([
" ",
" ",
"⁠",
"\uFEFF"
]);
-function iB(i) {
- return Lr(i);
-}
function sB(i) {
- const e = _h(i);
- return e !== null && nB.has(e);
+ return Lr(i);
}
function rB(i) {
- return !tB(i) && !sB(i);
+ const e = vh(i);
+ return e !== null && iB.has(e);
}
-const ap = /* @__PURE__ */ new Set([
+function aB(i) {
+ return !nB(i) && !rB(i);
+}
+const cp = /* @__PURE__ */ new Set([
",",
".",
"!",
@@ -29224,7 +29224,7 @@ const ap = /* @__PURE__ */ new Set([
"ゞ",
"ヽ",
"ヾ"
-]), yh = /* @__PURE__ */ new Set([
+]), wh = /* @__PURE__ */ new Set([
'"',
"(",
"[",
@@ -29243,7 +29243,7 @@ const ap = /* @__PURE__ */ new Set([
"〖",
"〘",
"〚"
-]), op = /* @__PURE__ */ new Set([
+]), lp = /* @__PURE__ */ new Set([
"'",
"’"
]), Pr = /* @__PURE__ */ new Set([
@@ -29273,14 +29273,14 @@ const ap = /* @__PURE__ */ new Set([
"»",
"›",
"…"
-]), aB = /* @__PURE__ */ new Set([
+]), oB = /* @__PURE__ */ new Set([
":",
".",
"،",
"؛"
-]), oB = /* @__PURE__ */ new Set([
- "၏"
]), cB = /* @__PURE__ */ new Set([
+ "၏"
+]), lB = /* @__PURE__ */ new Set([
"”",
"’",
"»",
@@ -29293,8 +29293,8 @@ const ap = /* @__PURE__ */ new Set([
"〕",
")"
]);
-function lB(i) {
- if (cp(i))
+function hB(i) {
+ if (hp(i))
return !0;
let e = !1;
for (const t of i) {
@@ -29302,30 +29302,30 @@ function lB(i) {
e = !0;
continue;
}
- if (!(e && Eh.test(t)))
+ if (!(e && _h.test(t)))
return !1;
}
return e;
}
-function hB(i) {
+function uB(i) {
for (const e of i)
- if (!ap.has(e) && !Pr.has(e))
+ if (!cp.has(e) && !Pr.has(e))
return !1;
return i.length > 0;
}
-function uB(i) {
- if (cp(i))
+function dB(i) {
+ if (hp(i))
return !0;
for (const e of i)
- if (!yh.has(e) && !op.has(e) && !Eh.test(e))
+ if (!wh.has(e) && !lp.has(e) && !_h.test(e))
return !1;
return i.length > 0;
}
-function cp(i) {
+function hp(i) {
let e = !1;
for (const t of i)
- if (!(t === "\\" || Eh.test(t))) {
- if (yh.has(t) || Pr.has(t) || op.has(t)) {
+ if (!(t === "\\" || _h.test(t))) {
+ if (wh.has(t) || Pr.has(t) || lp.has(t)) {
e = !0;
continue;
}
@@ -29333,7 +29333,7 @@ function cp(i) {
}
return e;
}
-function fx(i, e) {
+function px(i, e) {
const t = e - 1;
if (t <= 0)
return Math.max(t, 0);
@@ -29346,22 +29346,22 @@ function fx(i, e) {
const r = i.charCodeAt(s);
return r >= 55296 && r <= 56319 ? s : t;
}
-function _h(i) {
+function vh(i) {
if (i.length === 0)
return null;
- const e = fx(i, i.length);
+ const e = px(i, i.length);
return i.slice(e);
}
-function dB(i) {
+function fB(i) {
const e = Array.from(i);
let t = e.length;
for (; t > 0; ) {
const n = e[t - 1];
- if (Eh.test(n)) {
+ if (_h.test(n)) {
t--;
continue;
}
- if (yh.has(n) || op.has(n)) {
+ if (wh.has(n) || lp.has(n)) {
t--;
continue;
}
@@ -29372,10 +29372,10 @@ function dB(i) {
tail: e.slice(t).join("")
};
}
-function fB(i, e, t) {
+function pB(i, e, t) {
return t === "text" && !e && i.length === 1 && i !== "-" && i !== "—" ? i : null;
}
-function _g(i, e, t, n) {
+function vg(i, e, t, n) {
const s = e[n], r = i[n];
if (s == null)
return r;
@@ -29385,24 +29385,24 @@ function _g(i, e, t, n) {
const o = s.repeat(a);
return i[n] = o, o;
}
-function wg(i, e) {
- return i && e !== null && aB.has(e);
-}
-function pB(i) {
- const e = _h(i);
- return e !== null && oB.has(e);
+function Cg(i, e) {
+ return i && e !== null && oB.has(e);
}
function AB(i) {
+ const e = vh(i);
+ return e !== null && cB.has(e);
+}
+function gB(i) {
if (i.length < 2 || i[0] !== " ")
return null;
const e = i.slice(1);
return new RegExp("^\\p{M}+$", "u").test(e) ? { space: " ", marks: e } : null;
}
-function tf(i) {
+function sf(i) {
let e = i.length;
for (; e > 0; ) {
- const t = fx(i, e), n = i.slice(t, e);
- if (cB.has(n))
+ const t = px(i, e), n = i.slice(t, e);
+ if (lB.has(n))
return !0;
if (!Pr.has(n))
return !1;
@@ -29410,7 +29410,7 @@ function tf(i) {
}
return !1;
}
-function gB(i, e) {
+function mB(i, e) {
if (e.preserveOrdinarySpaces || e.preserveHardBreaks) {
if (i === " ")
return "preserved-space";
@@ -29422,66 +29422,66 @@ function gB(i, e) {
}
return i === " " ? "space" : i === " " || i === " " || i === "⁠" || i === "\uFEFF" ? "glue" : i === "​" ? "zero-width-break" : i === "­" ? "soft-hyphen" : "text";
}
-const mB = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;
-function di(i) {
+const xB = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;
+function fi(i) {
return i.length === 1 ? i[0] : i.join("");
}
-function xB(i, e) {
+function bB(i, e) {
const t = [];
for (let n = i.length - 1; n >= 0; n--)
t.push(i[n]);
- return t.push(e), di(t);
+ return t.push(e), fi(t);
}
-function bB(i, e, t, n) {
- if (!mB.test(i))
+function EB(i, e, t, n) {
+ if (!xB.test(i))
return [{ text: i, isWordLike: e, kind: "text", start: t }];
const s = [];
let r = null, a = [], o = t, c = !1, l = 0;
for (const h of i) {
- const u = gB(h, n), d = u === "text" && e;
+ const u = mB(h, n), d = u === "text" && e;
if (r !== null && u === r && d === c) {
a.push(h), l += h.length;
continue;
}
r !== null && s.push({
- text: di(a),
+ text: fi(a),
isWordLike: c,
kind: r,
start: o
}), r = u, a = [h], o = t + l, c = d, l += h.length;
}
return r !== null && s.push({
- text: di(a),
+ text: fi(a),
isWordLike: c,
kind: r,
start: o
}), s;
}
-function nf(i) {
+function rf(i) {
return i === "space" || i === "preserved-space" || i === "zero-width-break" || i === "hard-break";
}
-const EB = /^[A-Za-z][A-Za-z0-9+.-]*:$/;
-function yB(i, e) {
+const yB = /^[A-Za-z][A-Za-z0-9+.-]*:$/;
+function _B(i, e) {
const t = i.texts[e];
- return t.startsWith("www.") ? !0 : EB.test(t) && e + 1 < i.len && i.kinds[e + 1] === "text" && i.texts[e + 1] === "//";
+ return t.startsWith("www.") ? !0 : yB.test(t) && e + 1 < i.len && i.kinds[e + 1] === "text" && i.texts[e + 1] === "//";
}
-function _B(i) {
+function wB(i) {
return i.includes("?") && (i.includes("://") || i.startsWith("www."));
}
-function wB(i) {
+function vB(i) {
const e = i.texts.slice(), t = i.isWordLike.slice(), n = i.kinds.slice(), s = i.starts.slice();
for (let a = 0; a < i.len; a++) {
- if (n[a] !== "text" || !yB(i, a))
+ if (n[a] !== "text" || !_B(i, a))
continue;
const o = [e[a]];
let c = a + 1;
- for (; c < i.len && !nf(n[c]); ) {
+ for (; c < i.len && !rf(n[c]); ) {
o.push(e[c]), t[a] = !0;
const l = e[c].includes("?");
if (n[c] = "text", e[c] = "", c++, l)
break;
}
- e[a] = di(o);
+ e[a] = fi(o);
}
let r = 0;
for (let a = 0; a < e.length; a++) {
@@ -29496,20 +29496,20 @@ function wB(i) {
starts: s
};
}
-function vB(i) {
+function CB(i) {
const e = [], t = [], n = [], s = [];
for (let r = 0; r < i.len; r++) {
const a = i.texts[r];
- if (e.push(a), t.push(i.isWordLike[r]), n.push(i.kinds[r]), s.push(i.starts[r]), !_B(a))
+ if (e.push(a), t.push(i.isWordLike[r]), n.push(i.kinds[r]), s.push(i.starts[r]), !wB(a))
continue;
const o = r + 1;
- if (o >= i.len || nf(i.kinds[o]))
+ if (o >= i.len || rf(i.kinds[o]))
continue;
const c = [], l = i.starts[o];
let h = o;
- for (; h < i.len && !nf(i.kinds[h]); )
+ for (; h < i.len && !rf(i.kinds[h]); )
c.push(i.texts[h]), h++;
- c.length > 0 && (e.push(di(c)), t.push(!0), n.push("text"), s.push(l), r = h - 1);
+ c.length > 0 && (e.push(fi(c)), t.push(!0), n.push("text"), s.push(l), r = h - 1);
}
return {
len: e.length,
@@ -29519,7 +29519,7 @@ function vB(i) {
starts: s
};
}
-const CB = /* @__PURE__ */ new Set([
+const IB = /* @__PURE__ */ new Set([
":",
"-",
"/",
@@ -29529,31 +29529,31 @@ const CB = /* @__PURE__ */ new Set([
"+",
"–",
"—"
-]), vg = /^[A-Za-z0-9_]+[,:;]*$/, Cg = /[,:;]+$/;
-function px(i) {
+]), Ig = /^[A-Za-z0-9_]+[,:;]*$/, Sg = /[,:;]+$/;
+function Ax(i) {
for (const e of i)
- if (dx.test(e))
+ if (fx.test(e))
return !0;
return !1;
}
-function Zl(i) {
+function eh(i) {
if (i.length === 0)
return !1;
for (const e of i)
- if (!(dx.test(e) || CB.has(e)))
+ if (!(fx.test(e) || IB.has(e)))
return !1;
return !0;
}
-function IB(i) {
+function SB(i) {
const e = [], t = [], n = [], s = [];
for (let r = 0; r < i.len; r++) {
const a = i.texts[r], o = i.kinds[r];
- if (o === "text" && Zl(a) && px(a)) {
+ if (o === "text" && eh(a) && Ax(a)) {
const c = [a];
let l = r + 1;
- for (; l < i.len && i.kinds[l] === "text" && Zl(i.texts[l]); )
+ for (; l < i.len && i.kinds[l] === "text" && eh(i.texts[l]); )
c.push(i.texts[l]), l++;
- e.push(di(c)), t.push(!0), n.push("text"), s.push(i.starts[r]), r = l - 1;
+ e.push(fi(c)), t.push(!0), n.push("text"), s.push(i.starts[r]), r = l - 1;
continue;
}
e.push(a), t.push(i.isWordLike[r]), n.push(o), s.push(i.starts[r]);
@@ -29566,18 +29566,18 @@ function IB(i) {
starts: s
};
}
-function SB(i) {
+function MB(i) {
const e = [], t = [], n = [], s = [];
for (let r = 0; r < i.len; r++) {
const a = i.texts[r], o = i.kinds[r], c = i.isWordLike[r];
- if (o === "text" && c && vg.test(a)) {
+ if (o === "text" && c && Ig.test(a)) {
const l = [a];
- let h = Cg.test(a), u = r + 1;
- for (; h && u < i.len && i.kinds[u] === "text" && i.isWordLike[u] && vg.test(i.texts[u]); ) {
+ let h = Sg.test(a), u = r + 1;
+ for (; h && u < i.len && i.kinds[u] === "text" && i.isWordLike[u] && Ig.test(i.texts[u]); ) {
const d = i.texts[u];
- l.push(d), h = Cg.test(d), u++;
+ l.push(d), h = Sg.test(d), u++;
}
- e.push(di(l)), t.push(!0), n.push("text"), s.push(i.starts[r]), r = u - 1;
+ e.push(fi(l)), t.push(!0), n.push("text"), s.push(i.starts[r]), r = u - 1;
continue;
}
e.push(a), t.push(c), n.push(o), s.push(i.starts[r]);
@@ -29590,7 +29590,7 @@ function SB(i) {
starts: s
};
}
-function MB(i) {
+function BB(i) {
const e = [], t = [], n = [], s = [];
for (let r = 0; r < i.len; r++) {
const a = i.texts[r];
@@ -29601,7 +29601,7 @@ function MB(i) {
const h = o[l];
if (!c)
break;
- (h.length === 0 || !px(h) || !Zl(h)) && (c = !1);
+ (h.length === 0 || !Ax(h) || !eh(h)) && (c = !1);
}
if (c) {
let l = 0;
@@ -29622,7 +29622,7 @@ function MB(i) {
starts: s
};
}
-function BB(i) {
+function TB(i) {
const e = [], t = [], n = [], s = [];
let r = 0;
for (; r < i.len; ) {
@@ -29632,7 +29632,7 @@ function BB(i) {
const h = [a[0]], u = l;
for (r++; r < i.len && i.kinds[r] === "glue"; )
h.push(i.texts[r]), r++;
- const d = di(h);
+ const d = fi(h);
if (r < i.len && i.kinds[r] === "text")
a[0] = d, a.push(i.texts[r]), o = i.isWordLike[r], c = "text", l = u, r++;
else {
@@ -29646,14 +29646,14 @@ function BB(i) {
const h = [];
for (; r < i.len && i.kinds[r] === "glue"; )
h.push(i.texts[r]), r++;
- const u = di(h);
+ const u = fi(h);
if (r < i.len && i.kinds[r] === "text") {
a.push(u, i.texts[r]), o = o || i.isWordLike[r], r++;
continue;
}
a.push(u);
}
- e.push(di(a)), t.push(o), n.push(c), s.push(l);
+ e.push(fi(a)), t.push(o), n.push(c), s.push(l);
}
return {
len: e.length,
@@ -29663,12 +29663,12 @@ function BB(i) {
starts: s
};
}
-function TB(i) {
+function RB(i) {
const e = i.texts.slice(), t = i.isWordLike.slice(), n = i.kinds.slice(), s = i.starts.slice();
for (let r = 0; r < e.length - 1; r++) {
if (n[r] !== "text" || n[r + 1] !== "text" || !Lr(e[r]) || !Lr(e[r + 1]))
continue;
- const a = dB(e[r]);
+ const a = fB(e[r]);
a !== null && (e[r] = a.head, e[r + 1] = a.tail + e[r + 1], s[r + 1] = s[r] + a.head.length);
}
return {
@@ -29679,35 +29679,35 @@ function TB(i) {
starts: s
};
}
-function Ig(i, e, t) {
- const n = $M();
+function Mg(i, e, t) {
+ const n = eB();
let s = 0;
const r = [], a = [], o = [], c = [], l = [], h = [], u = [], d = [], f = [], p = [], m = [], g = [];
for (const w of n.segment(i))
- for (const I of bB(w.segment, w.isWordLike ?? !1, w.index, t)) {
+ for (const I of EB(w.segment, w.isWordLike ?? !1, w.index, t)) {
let O = function() {
h[D] !== null && (a[D] = [
- _g(r, h, u, D)
- ], h[D] = null), a[D].push(I.text), o[D] = o[D] || I.isWordLike, d[D] = d[D] || v, f[D] = f[D] || F, p[D] = q, m[D] = $, g[D] = wg(f[D], K);
+ vg(r, h, u, D)
+ ], h[D] = null), a[D].push(I.text), o[D] = o[D] || I.isWordLike, d[D] = d[D] || v, f[D] = f[D] || F, p[D] = q, m[D] = $, g[D] = Cg(f[D], K);
};
- const T = I.kind === "text", C = fB(I.text, I.isWordLike, I.kind), v = Lr(I.text), F = Eg(I.text), K = _h(I.text), q = tf(I.text), $ = pB(I.text), D = s - 1;
- e.carryCJKAfterClosingQuote && T && s > 0 && c[D] === "text" && v && d[D] && p[D] || T && s > 0 && c[D] === "text" && hB(I.text) && d[D] || T && s > 0 && c[D] === "text" && m[D] ? O() : T && s > 0 && c[D] === "text" && I.isWordLike && F && g[D] ? (O(), o[D] = !0) : C !== null && s > 0 && c[D] === "text" && h[D] === C ? u[D] = (u[D] ?? 1) + 1 : T && !I.isWordLike && s > 0 && c[D] === "text" && (lB(I.text) || I.text === "-" && o[D]) ? O() : (r[s] = I.text, a[s] = [I.text], o[s] = I.isWordLike, c[s] = I.kind, l[s] = I.start, h[s] = C, u[s] = C === null ? 0 : 1, d[s] = v, f[s] = F, p[s] = q, m[s] = $, g[s] = wg(F, K), s++);
+ const T = I.kind === "text", C = pB(I.text, I.isWordLike, I.kind), v = Lr(I.text), F = _g(I.text), K = vh(I.text), q = sf(I.text), $ = AB(I.text), D = s - 1;
+ e.carryCJKAfterClosingQuote && T && s > 0 && c[D] === "text" && v && d[D] && p[D] || T && s > 0 && c[D] === "text" && uB(I.text) && d[D] || T && s > 0 && c[D] === "text" && m[D] ? O() : T && s > 0 && c[D] === "text" && I.isWordLike && F && g[D] ? (O(), o[D] = !0) : C !== null && s > 0 && c[D] === "text" && h[D] === C ? u[D] = (u[D] ?? 1) + 1 : T && !I.isWordLike && s > 0 && c[D] === "text" && (hB(I.text) || I.text === "-" && o[D]) ? O() : (r[s] = I.text, a[s] = [I.text], o[s] = I.isWordLike, c[s] = I.kind, l[s] = I.start, h[s] = C, u[s] = C === null ? 0 : 1, d[s] = v, f[s] = F, p[s] = q, m[s] = $, g[s] = Cg(F, K), s++);
}
for (let w = 0; w < s; w++) {
if (h[w] !== null) {
- r[w] = _g(r, h, u, w);
+ r[w] = vg(r, h, u, w);
continue;
}
- r[w] = di(a[w]);
+ r[w] = fi(a[w]);
}
for (let w = 1; w < s; w++)
- c[w] === "text" && !o[w] && cp(r[w]) && c[w - 1] === "text" && (r[w - 1] += r[w], o[w - 1] = o[w - 1] || o[w], r[w] = "");
+ c[w] === "text" && !o[w] && hp(r[w]) && c[w - 1] === "text" && (r[w - 1] += r[w], o[w - 1] = o[w - 1] || o[w], r[w] = "");
const A = Array.from({ length: s }, () => null);
let _ = -1;
for (let w = s - 1; w >= 0; w--) {
const I = r[w];
if (I.length !== 0) {
- if (c[w] === "text" && !o[w] && uB(I) && _ >= 0 && c[_] === "text") {
+ if (c[w] === "text" && !o[w] && dB(I) && _ >= 0 && c[_] === "text") {
const T = A[_] ?? [];
T.push(I), A[_] = T, l[_] = l[w], r[w] = "";
continue;
@@ -29717,7 +29717,7 @@ function Ig(i, e, t) {
}
for (let w = 0; w < s; w++) {
const I = A[w];
- I != null && (r[w] = xB(I, r[w]));
+ I != null && (r[w] = bB(I, r[w]));
}
let x = 0;
for (let w = 0; w < s; w++) {
@@ -29725,20 +29725,20 @@ function Ig(i, e, t) {
I.length !== 0 && (x !== w && (r[x] = I, o[x] = o[w], c[x] = c[w], l[x] = l[w]), x++);
}
r.length = x, o.length = x, c.length = x, l.length = x;
- const E = BB({
+ const E = TB({
len: x,
texts: r,
isWordLike: o,
kinds: c,
starts: l
- }), S = TB(SB(MB(IB(vB(wB(E))))));
+ }), S = RB(MB(BB(SB(CB(vB(E))))));
for (let w = 0; w < S.len - 1; w++) {
- const I = AB(S.texts[w]);
- I !== null && (S.kinds[w] !== "space" && S.kinds[w] !== "preserved-space" || S.kinds[w + 1] !== "text" || !Eg(S.texts[w + 1]) || (S.texts[w] = I.space, S.isWordLike[w] = !1, S.kinds[w] = S.kinds[w] === "preserved-space" ? "preserved-space" : "space", S.texts[w + 1] = I.marks + S.texts[w + 1], S.starts[w + 1] = S.starts[w] + I.space.length));
+ const I = gB(S.texts[w]);
+ I !== null && (S.kinds[w] !== "space" && S.kinds[w] !== "preserved-space" || S.kinds[w + 1] !== "text" || !_g(S.texts[w + 1]) || (S.texts[w] = I.space, S.isWordLike[w] = !1, S.kinds[w] = S.kinds[w] === "preserved-space" ? "preserved-space" : "space", S.texts[w + 1] = I.marks + S.texts[w + 1], S.starts[w + 1] = S.starts[w] + I.space.length));
}
return S;
}
-function RB(i, e) {
+function FB(i, e) {
if (i.len === 0)
return [];
if (!e.preserveHardBreaks)
@@ -29761,18 +29761,18 @@ function RB(i, e) {
consumedEndSegmentIndex: i.len
}), t;
}
-function FB(i) {
+function NB(i) {
if (i.len <= 1)
return i;
const e = [], t = [], n = [], s = [];
let r = null, a = !1, o = 0, c = !1, l = !1;
function h() {
- r !== null && (e.push(di(r)), t.push(a), n.push("text"), s.push(o), r = null);
+ r !== null && (e.push(fi(r)), t.push(a), n.push("text"), s.push(o), r = null);
}
for (let u = 0; u < i.len; u++) {
const d = i.texts[u], f = i.kinds[u], p = i.isWordLike[u], m = i.starts[u];
if (f === "text") {
- const g = iB(d), A = rB(d);
+ const g = sB(d), A = aB(d);
if (r !== null && c && l) {
r.push(d), a = a || p, c = c || g, l = A;
continue;
@@ -29790,8 +29790,8 @@ function FB(i) {
starts: s
};
}
-function NB(i, e, t = "normal", n = "normal") {
- const s = XM(t), r = s.mode === "pre-wrap" ? JM(i) : YM(i);
+function DB(i, e, t = "normal", n = "normal") {
+ const s = YM(t), r = s.mode === "pre-wrap" ? ZM(i) : JM(i);
if (r.length === 0)
return {
normalized: r,
@@ -29802,20 +29802,20 @@ function NB(i, e, t = "normal", n = "normal") {
kinds: [],
starts: []
};
- const a = n === "keep-all" ? FB(Ig(r, e, s)) : Ig(r, e, s);
+ const a = n === "keep-all" ? NB(Mg(r, e, s)) : Mg(r, e, s);
return {
normalized: r,
- chunks: RB(a, s),
+ chunks: FB(a, s),
...a
};
}
let ca = null;
-const Sg = /* @__PURE__ */ new Map();
+const Bg = /* @__PURE__ */ new Map();
let la = null;
-const DB = 96, LB = new RegExp("\\p{Emoji_Presentation}", "u"), PB = /[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;
-let Iu = null;
-const Mg = /* @__PURE__ */ new Map();
-function lp() {
+const LB = 96, PB = new RegExp("\\p{Emoji_Presentation}", "u"), kB = /[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;
+let Mu = null;
+const Tg = /* @__PURE__ */ new Map();
+function up() {
if (ca !== null)
return ca;
if (typeof OffscreenCanvas < "u")
@@ -29824,18 +29824,18 @@ function lp() {
return ca = document.createElement("canvas").getContext("2d"), ca;
throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.");
}
-function kB(i) {
- let e = Sg.get(i);
- return e || (e = /* @__PURE__ */ new Map(), Sg.set(i, e)), e;
+function UB(i) {
+ let e = Bg.get(i);
+ return e || (e = /* @__PURE__ */ new Map(), Bg.set(i, e)), e;
}
function Qs(i, e) {
let t = e.get(i);
return t === void 0 && (t = {
- width: lp().measureText(i).width,
+ width: up().measureText(i).width,
containsCJK: Lr(i)
}, e.set(i, t)), t;
}
-function Ya() {
+function Ja() {
if (la !== null)
return la;
if (typeof navigator > "u")
@@ -29853,24 +29853,24 @@ function Ya() {
preferEarlySoftHyphenBreak: t
}, la;
}
-function UB(i) {
+function OB(i) {
const e = i.match(/(\d+(?:\.\d+)?)\s*px/);
return e ? parseFloat(e[1]) : 16;
}
-function Ax() {
- return Iu === null && (Iu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Iu;
-}
-function OB(i) {
- return LB.test(i) || i.includes("️");
+function gx() {
+ return Mu === null && (Mu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Mu;
}
function QB(i) {
- return PB.test(i);
+ return PB.test(i) || i.includes("️");
+}
+function GB(i) {
+ return kB.test(i);
}
-function GB(i, e) {
- let t = Mg.get(i);
+function HB(i, e) {
+ let t = Tg.get(i);
if (t !== void 0)
return t;
- const n = lp();
+ const n = up();
n.font = i;
const s = n.measureText("😀").width;
if (t = 0, s > e + 0.5 && typeof document < "u" && document.body !== null) {
@@ -29879,25 +29879,25 @@ function GB(i, e) {
const a = r.getBoundingClientRect().width;
document.body.removeChild(r), s - a > 0.5 && (t = s - a);
}
- return Mg.set(i, t), t;
+ return Tg.set(i, t), t;
}
-function HB(i) {
+function zB(i) {
let e = 0;
- const t = Ax();
+ const t = gx();
for (const n of t.segment(i))
- OB(n.segment) && e++;
+ QB(n.segment) && e++;
return e;
}
-function zB(i, e) {
- return e.emojiCount === void 0 && (e.emojiCount = HB(i)), e.emojiCount;
+function VB(i, e) {
+ return e.emojiCount === void 0 && (e.emojiCount = zB(i)), e.emojiCount;
}
function yr(i, e, t) {
- return t === 0 ? e.width : e.width - zB(i, e) * t;
+ return t === 0 ? e.width : e.width - VB(i, e) * t;
}
-function VB(i, e, t, n, s) {
+function WB(i, e, t, n, s) {
if (e.breakableFitAdvances !== void 0)
return e.breakableFitAdvances;
- const r = Ax(), a = [];
+ const r = gx(), a = [];
for (const h of r.segment(i))
a.push(h.segment);
if (a.length <= 1)
@@ -29910,7 +29910,7 @@ function VB(i, e, t, n, s) {
}
return e.breakableFitAdvances = h, e.breakableFitAdvances;
}
- if (s === "pair-context" || a.length > DB) {
+ if (s === "pair-context" || a.length > LB) {
const h = [];
let u = null, d = 0;
for (const f of a) {
@@ -29934,13 +29934,13 @@ function VB(i, e, t, n, s) {
}
return e.breakableFitAdvances = o, e.breakableFitAdvances;
}
-function WB(i, e) {
- const t = lp();
+function qB(i, e) {
+ const t = up();
t.font = i;
- const n = kB(i), s = UB(i), r = e ? GB(i, s) : 0;
+ const n = UB(i), s = OB(i), r = e ? HB(i, s) : 0;
return { cache: n, fontSize: s, emojiCorrection: r };
}
-function qB(i, e) {
+function KB(i, e) {
for (; e < i.widths.length; ) {
const t = i.kinds[e];
if (t !== "space" && t !== "zero-width-break" && t !== "soft-hyphen")
@@ -29949,13 +29949,13 @@ function qB(i, e) {
}
return e;
}
-function gx(i, e) {
+function mx(i, e) {
if (e <= 0)
return 0;
const t = i % e;
return Math.abs(t) <= 1e-6 ? e : e - t;
}
-function mx(i, e, t, n, s) {
+function xx(i, e, t, n, s) {
let r = 0, a = e;
for (; r < i.length; ) {
const o = a + i[r];
@@ -29965,7 +29965,7 @@ function mx(i, e, t, n, s) {
}
return { fitCount: r, fittedWidth: a };
}
-function KB(i, e) {
+function jB(i, e) {
let t = 0, n = i.chunks.length;
for (; t < n; ) {
const s = Math.floor((t + n) / 2);
@@ -29973,7 +29973,7 @@ function KB(i, e) {
}
return t < i.chunks.length ? t : -1;
}
-function xx(i, e, t) {
+function bx(i, e, t) {
let n = t.segmentIndex;
if (t.graphemeIndex > 0)
return e;
@@ -29988,28 +29988,28 @@ function xx(i, e, t) {
}
return s.consumedEndSegmentIndex >= i.widths.length ? -1 : (t.segmentIndex = s.consumedEndSegmentIndex, t.graphemeIndex = 0, e + 1);
}
-function hp(i, e) {
+function dp(i, e) {
if (e.segmentIndex >= i.widths.length)
return -1;
- const t = KB(i, e.segmentIndex);
- return t < 0 ? -1 : xx(i, t, e);
+ const t = jB(i, e.segmentIndex);
+ return t < 0 ? -1 : bx(i, t, e);
}
-function jB(i, e, t) {
+function XB(i, e, t) {
if (t.segmentIndex >= i.widths.length)
return -1;
let n = e;
for (; n < i.chunks.length && t.segmentIndex >= i.chunks[n].consumedEndSegmentIndex; )
n++;
- return n >= i.chunks.length ? -1 : xx(i, n, t);
+ return n >= i.chunks.length ? -1 : bx(i, n, t);
}
-function XB(i, e) {
- return i.simpleLineWalkFastPath ? bx(i, e) : up(i, e);
+function YB(i, e) {
+ return i.simpleLineWalkFastPath ? Ex(i, e) : fp(i, e);
}
-function bx(i, e, t) {
+function Ex(i, e, t) {
const { widths: n, kinds: s, breakableFitAdvances: r } = i;
if (n.length === 0)
return 0;
- const o = Ya().lineFitEpsilon, c = e + o;
+ const o = Ja().lineFitEpsilon, c = e + o;
let l = 0, h = 0, u = !1, d = 0, f = 0, p = 0, m = 0, g = -1, A = 0;
function _() {
g = -1, A = 0;
@@ -30045,7 +30045,7 @@ function bx(i, e, t) {
u && p === C && m === F.length && (p = C + 1, m = 0);
}
let T = 0;
- for (; T < n.length && !(!u && (T = qB(i, T), T >= n.length)); ) {
+ for (; T < n.length && !(!u && (T = KB(i, T), T >= n.length)); ) {
const C = n[T], v = s[T], F = v === "space" || v === "preserved-space" || v === "tab" || v === "zero-width-break" || v === "soft-hyphen";
if (!u) {
C > e && r[T] !== null ? I(T, 0) : E(T, C), F && (g = T + 1, A = h - C), T++;
@@ -30075,13 +30075,13 @@ function bx(i, e, t) {
}
return u && x(), l;
}
-function up(i, e, t) {
+function fp(i, e, t) {
if (i.simpleLineWalkFastPath)
- return bx(i, e, t);
+ return Ex(i, e, t);
const { widths: n, lineEndFitAdvances: s, lineEndPaintAdvances: r, kinds: a, breakableFitAdvances: o, discretionaryHyphenWidth: c, tabStopAdvance: l, chunks: h } = i;
if (n.length === 0 || h.length === 0)
return 0;
- const u = Ya(), d = u.lineFitEpsilon, f = e + d;
+ const u = Ja(), d = u.lineFitEpsilon, f = e + d;
let p = 0, m = 0, g = !1, A = 0, _ = 0, x = 0, E = 0, S = -1, w = 0, I = 0, T = null;
function C() {
S = -1, w = 0, I = 0, T = null;
@@ -30128,7 +30128,7 @@ function up(i, e, t) {
const J = o[Q];
if (J == null)
return !1;
- const { fitCount: ee, fittedWidth: ae } = mx(J, m, e, d, c);
+ const { fitCount: ee, fittedWidth: ae } = xx(J, m, e, d, c);
return ee === 0 ? !1 : (m = ae, x = Q, E = ee, C(), ee === J.length ? (x = Q + 1, E = 0, !0) : (v(Q, ee, ae + c), D(Q, ee), !0));
}
function Y(Q) {
@@ -30149,7 +30149,7 @@ function up(i, e, t) {
g = !1, m = 0, A = J.startSegmentIndex, _ = 0, x = J.startSegmentIndex, E = 0, C();
let ee = J.startSegmentIndex;
for (; ee < J.endSegmentIndex; ) {
- const ae = a[ee], _e = ae === "space" || ae === "preserved-space" || ae === "tab" || ae === "zero-width-break" || ae === "soft-hyphen", Me = ae === "tab" ? gx(m, l) : n[ee];
+ const ae = a[ee], _e = ae === "space" || ae === "preserved-space" || ae === "tab" || ae === "zero-width-break" || ae === "soft-hyphen", Me = ae === "tab" ? mx(m, l) : n[ee];
if (ae === "soft-hyphen") {
g && (x = ee + 1, E = 0, S = ee + 1, w = m + c, I = m + c, T = ae), ee++;
continue;
@@ -30197,11 +30197,11 @@ function up(i, e, t) {
}
return p;
}
-function dp(i, e, t, n) {
+function pp(i, e, t, n) {
const s = i.chunks[t];
if (s.startSegmentIndex === s.endSegmentIndex)
return e.segmentIndex = s.consumedEndSegmentIndex, e.graphemeIndex = 0, 0;
- const { widths: r, lineEndFitAdvances: a, lineEndPaintAdvances: o, kinds: c, breakableFitAdvances: l, discretionaryHyphenWidth: h, tabStopAdvance: u } = i, d = Ya(), f = d.lineFitEpsilon, p = n + f;
+ const { widths: r, lineEndFitAdvances: a, lineEndPaintAdvances: o, kinds: c, breakableFitAdvances: l, discretionaryHyphenWidth: h, tabStopAdvance: u } = i, d = Ja(), f = d.lineFitEpsilon, p = n + f;
let m = 0, g = !1, A = e.segmentIndex, _ = e.graphemeIndex, x = -1, E = 0, S = 0, w = null;
function I() {
x = -1, E = 0, S = 0, w = null;
@@ -30247,7 +30247,7 @@ function dp(i, e, t, n) {
return null;
const O = l[D] ?? null;
if (O !== null) {
- const { fitCount: Y, fittedWidth: Q } = mx(O, m, n, f, h);
+ const { fitCount: Y, fittedWidth: Q } = xx(O, m, n, f, h);
if (Y === O.length)
return m = Q, A = D + 1, _ = 0, I(), null;
if (Y > 0)
@@ -30256,7 +30256,7 @@ function dp(i, e, t, n) {
return E <= p ? T(x, 0, S) : null;
}
for (let D = e.segmentIndex; D < s.endSegmentIndex; D++) {
- const O = c[D], Y = O === "space" || O === "preserved-space" || O === "tab" || O === "zero-width-break" || O === "soft-hyphen", Q = D === e.segmentIndex ? e.graphemeIndex : 0, J = O === "tab" ? gx(m, u) : r[D];
+ const O = c[D], Y = O === "space" || O === "preserved-space" || O === "tab" || O === "zero-width-break" || O === "soft-hyphen", Q = D === e.segmentIndex ? e.graphemeIndex : 0, J = O === "tab" ? mx(m, u) : r[D];
if (O === "soft-hyphen" && Q === 0) {
g && (A = D + 1, _ = 0, x = D + 1, E = m + h, S = m + h, w = O);
continue;
@@ -30300,8 +30300,8 @@ function dp(i, e, t, n) {
}
return x === s.consumedEndSegmentIndex && _ === 0 ? T(s.consumedEndSegmentIndex, 0, S) : T(s.consumedEndSegmentIndex, 0, m);
}
-function Ex(i, e, t) {
- const { widths: n, kinds: s, breakableFitAdvances: r } = i, o = Ya().lineFitEpsilon, c = t + o;
+function yx(i, e, t) {
+ const { widths: n, kinds: s, breakableFitAdvances: r } = i, o = Ja().lineFitEpsilon, c = t + o;
let l = 0, h = !1, u = e.segmentIndex, d = e.graphemeIndex, f = -1, p = 0;
for (let m = e.segmentIndex; m < n.length; m++) {
const g = n[m], A = s[m], _ = A === "space" || A === "preserved-space" || A === "tab" || A === "zero-width-break" || A === "soft-hyphen", x = m === e.segmentIndex ? e.graphemeIndex : 0, E = r[m];
@@ -30327,14 +30327,14 @@ function Ex(i, e, t) {
}
return h ? (e.segmentIndex = u, e.graphemeIndex = d, l) : null;
}
-function sf(i, e, t) {
+function af(i, e, t) {
const n = {
segmentIndex: e.segmentIndex,
graphemeIndex: e.graphemeIndex
- }, s = hp(i, n);
+ }, s = dp(i, n);
if (s < 0)
return null;
- const r = n.segmentIndex, a = n.graphemeIndex, o = i.simpleLineWalkFastPath ? Ex(i, n, t) : dp(i, n, s, t);
+ const r = n.segmentIndex, a = n.graphemeIndex, o = i.simpleLineWalkFastPath ? yx(i, n, t) : pp(i, n, s, t);
return o === null ? null : {
startSegmentIndex: r,
startGraphemeIndex: a,
@@ -30343,11 +30343,11 @@ function sf(i, e, t) {
width: o
};
}
-function YB(i, e, t) {
- const n = hp(i, e);
- return n < 0 ? null : i.simpleLineWalkFastPath ? Ex(i, e, t) : dp(i, e, n, t);
+function JB(i, e, t) {
+ const n = dp(i, e);
+ return n < 0 ? null : i.simpleLineWalkFastPath ? yx(i, e, t) : pp(i, e, n, t);
}
-function JB(i, e) {
+function ZB(i, e) {
if (i.widths.length === 0)
return {
lineCount: 0,
@@ -30359,15 +30359,15 @@ function JB(i, e) {
};
let n = 0, s = 0;
if (!i.simpleLineWalkFastPath) {
- let r = hp(i, t);
+ let r = dp(i, t);
for (; r >= 0; ) {
- const a = dp(i, t, r, e);
+ const a = pp(i, t, r, e);
if (a === null)
return {
lineCount: n,
maxLineWidth: s
};
- n++, a > s && (s = a), r = jB(i, r, t);
+ n++, a > s && (s = a), r = XB(i, r, t);
}
return {
lineCount: n,
@@ -30375,7 +30375,7 @@ function JB(i, e) {
};
}
for (; ; ) {
- const r = YB(i, t, e);
+ const r = JB(i, t, e);
if (r === null)
return {
lineCount: n,
@@ -30384,11 +30384,11 @@ function JB(i, e) {
n++, r > s && (s = r);
}
}
-let Su = null, Bg = /* @__PURE__ */ new WeakMap();
-function yx() {
- return Su === null && (Su = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Su;
+let Bu = null, Rg = /* @__PURE__ */ new WeakMap();
+function _x() {
+ return Bu === null && (Bu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Bu;
}
-function ZB(i) {
+function $B(i) {
return i ? {
widths: [],
lineEndFitAdvances: [],
@@ -30414,7 +30414,7 @@ function ZB(i) {
chunks: []
};
}
-function $B(i, e) {
+function eT(i, e) {
const t = [];
let n = [], s = 0, r = !1, a = !1, o = !1;
function c() {
@@ -30424,20 +30424,20 @@ function $B(i, e) {
}), n = [], r = !1, a = !1, o = !1);
}
function l(u, d, f) {
- n = [u], s = d, r = f, a = tf(u), o = yh.has(u);
+ n = [u], s = d, r = f, a = sf(u), o = wh.has(u);
}
function h(u, d) {
n.push(u), r = r || d;
- const f = tf(u);
+ const f = sf(u);
u.length === 1 && Pr.has(u) ? a = a || f : a = f, o = !1;
}
- for (const u of yx().segment(i)) {
+ for (const u of _x().segment(i)) {
const d = u.segment, f = Lr(d);
if (n.length === 0) {
l(d, u.index, f);
continue;
}
- if (o || ap.has(d) || Pr.has(d) || e.carryCJKAfterClosingQuote && f && a) {
+ if (o || cp.has(d) || Pr.has(d) || e.carryCJKAfterClosingQuote && f && a) {
h(d, f);
continue;
}
@@ -30449,10 +30449,10 @@ function $B(i, e) {
}
return c(), t;
}
-function eT(i, e, t, n) {
- const s = Ya(), { cache: r, emojiCorrection: a } = WB(e, QB(i.normalized)), o = yr("-", Qs("-", r), a), l = yr(" ", Qs(" ", r), a) * 8;
+function tT(i, e, t, n) {
+ const s = Ja(), { cache: r, emojiCorrection: a } = qB(e, GB(i.normalized)), o = yr("-", Qs("-", r), a), l = yr(" ", Qs(" ", r), a) * 8;
if (i.len === 0)
- return ZB(t);
+ return $B(t);
const h = [], u = [], d = [], f = [];
let p = i.chunks.length <= 1;
const m = t ? [] : null, g = [], A = t ? [] : null, _ = Array.from({ length: i.len });
@@ -30463,8 +30463,8 @@ function eT(i, e, t, n) {
const K = Qs(I, r), q = yr(I, K, a), $ = T === "space" || T === "preserved-space" || T === "zero-width-break" ? 0 : q, D = T === "space" || T === "zero-width-break" ? 0 : q;
if (F && v && I.length > 1) {
let O = "sum-graphemes";
- Zl(I) ? O = "pair-context" : s.preferPrefixWidthsForBreakableRuns && (O = "segment-prefixes");
- const Y = VB(I, K, r, a, O);
+ eh(I) ? O = "pair-context" : s.preferPrefixWidthsForBreakableRuns && (O = "segment-prefixes");
+ const Y = WB(I, K, r, a, O);
x(I, q, $, D, T, C, Y);
return;
}
@@ -30487,7 +30487,7 @@ function eT(i, e, t, n) {
}
const K = Qs(T, r);
if (v === "text" && K.containsCJK) {
- const $ = $B(T, s);
+ const $ = eT(T, s);
for (let D = 0; D < $.length; D++) {
const O = $[D];
E(O.text, "text", F + O.start, C, !Lr(O.text));
@@ -30496,7 +30496,7 @@ function eT(i, e, t, n) {
}
E(T, v, F, C, !0);
}
- const S = tT(i.chunks, _, h.length), w = m === null ? null : qM(i.normalized, m);
+ const S = nT(i.chunks, _, h.length), w = m === null ? null : KM(i.normalized, m);
return A !== null ? {
widths: h,
lineEndFitAdvances: u,
@@ -30522,7 +30522,7 @@ function eT(i, e, t, n) {
chunks: S
};
}
-function tT(i, e, t) {
+function nT(i, e, t) {
const n = [];
for (let s = 0; s < i.length; s++) {
const r = i[s], a = r.startSegmentIndex < e.length ? e[r.startSegmentIndex] : t, o = r.endSegmentIndex < e.length ? e[r.endSegmentIndex] : t, c = r.consumedEndSegmentIndex < e.length ? e[r.consumedEndSegmentIndex] : t;
@@ -30534,47 +30534,47 @@ function tT(i, e, t) {
}
return n;
}
-function _x(i, e, t, n) {
- const r = NB(i, Ya(), n?.whiteSpace, "normal");
- return eT(r, e, t);
+function wx(i, e, t, n) {
+ const r = DB(i, Ja(), n?.whiteSpace, "normal");
+ return tT(r, e, t);
}
-function ol(i, e, t) {
- return _x(i, e, !1, t);
+function cl(i, e, t) {
+ return wx(i, e, !1, t);
}
-function $l(i, e, t) {
- return _x(i, e, !0, t);
+function th(i, e, t) {
+ return wx(i, e, !0, t);
}
-function nT(i, e, t) {
- const n = XB(i, e);
+function iT(i, e, t) {
+ const n = YB(i, e);
return { lineCount: n, height: n * t };
}
-function Tg(i, e, t) {
+function Fg(i, e, t) {
let n = t.get(i);
if (n !== void 0)
return n;
n = [];
- const s = yx();
+ const s = _x();
for (const r of s.segment(e[i]))
n.push(r.segment);
return t.set(i, n), n;
}
-function wx(i) {
- let e = Bg.get(i);
- return e !== void 0 || (e = /* @__PURE__ */ new Map(), Bg.set(i, e)), e;
+function vx(i) {
+ let e = Rg.get(i);
+ return e !== void 0 || (e = /* @__PURE__ */ new Map(), Rg.set(i, e)), e;
}
-function iT(i, e, t, n) {
+function sT(i, e, t, n) {
return n > 0 && i[n - 1] === "soft-hyphen" && !(e === n && t > 0);
}
-function sT(i, e, t, n, s, r, a) {
+function rT(i, e, t, n, s, r, a) {
let o = "";
- const c = iT(e, n, s, r);
+ const c = sT(e, n, s, r);
for (let l = n; l < r; l++)
- e[l] === "soft-hyphen" || e[l] === "hard-break" || (l === n && s > 0 ? o += Tg(l, i, t).slice(s).join("") : o += i[l]);
- return a > 0 ? (c && (o += "-"), o += Tg(r, i, t).slice(n === r ? s : 0, a).join("")) : c && (o += "-"), o;
+ e[l] === "soft-hyphen" || e[l] === "hard-break" || (l === n && s > 0 ? o += Fg(l, i, t).slice(s).join("") : o += i[l]);
+ return a > 0 ? (c && (o += "-"), o += Fg(r, i, t).slice(n === r ? s : 0, a).join("")) : c && (o += "-"), o;
}
-function vx(i, e, t, n, s, r, a) {
+function Cx(i, e, t, n, s, r, a) {
return {
- text: sT(i.segments, i.kinds, e, n, s, r, a),
+ text: rT(i.segments, i.kinds, e, n, s, r, a),
width: t,
start: {
segmentIndex: n,
@@ -30586,10 +30586,10 @@ function vx(i, e, t, n, s, r, a) {
}
};
}
-function rT(i, e, t) {
- return vx(i, e, t.width, t.startSegmentIndex, t.startGraphemeIndex, t.endSegmentIndex, t.endGraphemeIndex);
+function aT(i, e, t) {
+ return Cx(i, e, t.width, t.startSegmentIndex, t.startGraphemeIndex, t.endSegmentIndex, t.endGraphemeIndex);
}
-function aT(i) {
+function oT(i) {
return {
width: i.width,
start: {
@@ -30602,76 +30602,76 @@ function aT(i) {
}
};
}
-function oT(i, e) {
- return vx(i, wx(i), e.width, e.start.segmentIndex, e.start.graphemeIndex, e.end.segmentIndex, e.end.graphemeIndex);
+function cT(i, e) {
+ return Cx(i, vx(i), e.width, e.start.segmentIndex, e.start.graphemeIndex, e.end.segmentIndex, e.end.graphemeIndex);
}
-function cT(i, e, t) {
- return i.widths.length === 0 ? 0 : up(i, e, (n) => {
- t(aT(n));
+function lT(i, e, t) {
+ return i.widths.length === 0 ? 0 : fp(i, e, (n) => {
+ t(oT(n));
});
}
-function Mu(i, e) {
- return JB(i, e);
+function Tu(i, e) {
+ return ZB(i, e);
}
-function Rg(i) {
+function Ng(i) {
let e = 0;
- return cT(i, Number.POSITIVE_INFINITY, (t) => {
+ return lT(i, Number.POSITIVE_INFINITY, (t) => {
t.width > e && (e = t.width);
}), e;
}
-function lT(i, e, t) {
+function hT(i, e, t) {
const n = [];
if (i.widths.length === 0)
return { lineCount: 0, height: 0, lines: n };
- const s = wx(i), r = up(i, e, (a) => {
- n.push(rT(i, s, a));
+ const s = vx(i), r = fp(i, e, (a) => {
+ n.push(aT(i, s, a));
});
return { lineCount: r, height: r * t, lines: n };
}
-const hT = /[ \t\n\f\r]+/, Fg = /^[ \t\n\f\r]+/, Ng = /[ \t\n\f\r]+$/, Bl = { segmentIndex: 0, graphemeIndex: 0 }, Cx = {
+const uT = /[ \t\n\f\r]+/, Dg = /^[ \t\n\f\r]+/, Lg = /[ \t\n\f\r]+$/, Rl = { segmentIndex: 0, graphemeIndex: 0 }, Ix = {
itemIndex: 0,
segmentIndex: 0,
graphemeIndex: 0
};
-function Bu(i) {
+function Ru(i) {
return {
segmentIndex: i.segmentIndex,
graphemeIndex: i.graphemeIndex
};
}
-function Dg(i) {
+function Pg(i) {
return i.segmentIndex === 0 && i.graphemeIndex === 0;
}
-function cl(i, e) {
+function ll(i, e) {
const t = e.get(i);
if (t !== void 0)
return t;
- const n = Rg($l("A A", i)), s = Rg($l("AA", i)), r = Math.max(0, n - s);
+ const n = Ng(th("A A", i)), s = Ng(th("AA", i)), r = Math.max(0, n - s);
return e.set(i, r), r;
}
-function uT(i) {
- const e = sf(i, Bl, Number.POSITIVE_INFINITY);
+function dT(i) {
+ const e = af(i, Rl, Number.POSITIVE_INFINITY);
return e === null ? null : {
endGraphemeIndex: e.endGraphemeIndex,
endSegmentIndex: e.endSegmentIndex,
width: e.width
};
}
-function dT(i, e) {
+function fT(i, e) {
return i === 0 && e > 0;
}
-function Ix(i) {
+function Sx(i) {
const e = [], t = Array.from({ length: i.length }), n = /* @__PURE__ */ new Map();
let s = 0;
for (let r = 0; r < i.length; r++) {
- const a = i[r], o = Fg.test(a.text), c = Ng.test(a.text), l = a.text.replace(Fg, "").replace(Ng, "");
+ const a = i[r], o = Dg.test(a.text), c = Lg.test(a.text), l = a.text.replace(Dg, "").replace(Lg, "");
if (l.length === 0) {
- hT.test(a.text) && s === 0 && (s = cl(a.font, n));
+ uT.test(a.text) && s === 0 && (s = ll(a.font, n));
continue;
}
- const h = s > 0 ? s : o ? cl(a.font, n) : 0, u = $l(l, a.font), d = uT(u);
+ const h = s > 0 ? s : o ? ll(a.font, n) : 0, u = th(l, a.font), d = dT(u);
if (d === null) {
- s = c ? cl(a.font, n) : 0;
+ s = c ? ll(a.font, n) : 0;
continue;
}
const f = {
@@ -30684,14 +30684,14 @@ function Ix(i) {
prepared: u,
sourceItemIndex: r
};
- e.push(f), t[r] = f, s = c ? cl(a.font, n) : 0;
+ e.push(f), t[r] = f, s = c ? ll(a.font, n) : 0;
}
return {
items: e,
itemsBySourceItemIndex: t
};
}
-function fT(i, e, t, n) {
+function pT(i, e, t, n) {
if (i.items.length === 0 || t.itemIndex >= i.items.length)
return null;
const s = Math.max(1, e);
@@ -30702,11 +30702,11 @@ function fT(i, e, t, n) {
};
e: for (; o < i.items.length; ) {
const l = i.items[o];
- if (!Dg(c) && c.segmentIndex === l.endSegmentIndex && c.graphemeIndex === l.endGraphemeIndex) {
+ if (!Pg(c) && c.segmentIndex === l.endSegmentIndex && c.graphemeIndex === l.endGraphemeIndex) {
o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
}
- const h = r === 0 ? 0 : l.gapBefore, u = Dg(c);
+ const h = r === 0 ? 0 : l.gapBefore, u = Pg(c);
if (l.break === "never") {
if (!u) {
o++, c.segmentIndex = 0, c.graphemeIndex = 0;
@@ -30715,7 +30715,7 @@ function fT(i, e, t, n) {
const m = l.naturalWidth + l.extraWidth, g = h + m;
if (r > 0 && g > a)
break e;
- n?.(l, h, m, Bu(Bl), {
+ n?.(l, h, m, Ru(Rl), {
segmentIndex: l.endSegmentIndex,
graphemeIndex: l.endGraphemeIndex
}), r += g, a = Math.max(0, s - r), o++, c.segmentIndex = 0, c.graphemeIndex = 0;
@@ -30727,14 +30727,14 @@ function fT(i, e, t, n) {
if (u) {
const m = d + l.naturalWidth;
if (m <= a) {
- n?.(l, h, l.naturalWidth + l.extraWidth, Bu(Bl), {
+ n?.(l, h, l.naturalWidth + l.extraWidth, Ru(Rl), {
segmentIndex: l.endSegmentIndex,
graphemeIndex: l.endGraphemeIndex
}), r += m, a = Math.max(0, s - r), o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
}
}
- const f = Math.max(1, a - d), p = sf(l.prepared, c, f);
+ const f = Math.max(1, a - d), p = af(l.prepared, c, f);
if (p === null) {
o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
@@ -30743,12 +30743,12 @@ function fT(i, e, t, n) {
o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
}
- if (r > 0 && u && h > 0 && dT(p.endSegmentIndex, p.endGraphemeIndex)) {
- const m = sf(l.prepared, Bl, Math.max(1, s - l.extraWidth));
+ if (r > 0 && u && h > 0 && fT(p.endSegmentIndex, p.endGraphemeIndex)) {
+ const m = af(l.prepared, Rl, Math.max(1, s - l.extraWidth));
if (m !== null && (m.endSegmentIndex > p.endSegmentIndex || m.endSegmentIndex === p.endSegmentIndex && m.endGraphemeIndex > p.endGraphemeIndex))
break e;
}
- if (n?.(l, h, p.width + l.extraWidth, Bu(c), {
+ if (n?.(l, h, p.width + l.extraWidth, Ru(c), {
segmentIndex: p.endSegmentIndex,
graphemeIndex: p.endGraphemeIndex
}), r += h + p.width + l.extraWidth, a = Math.max(0, s - r), p.endSegmentIndex === l.endSegmentIndex && p.endGraphemeIndex === l.endGraphemeIndex) {
@@ -30760,12 +30760,12 @@ function fT(i, e, t, n) {
}
return r === 0 ? null : (t.itemIndex = o, t.segmentIndex = c.segmentIndex, t.graphemeIndex = c.graphemeIndex, r);
}
-function pT(i, e, t = Cx) {
+function AT(i, e, t = Ix) {
const n = i, s = {
itemIndex: t.itemIndex,
segmentIndex: t.segmentIndex,
graphemeIndex: t.graphemeIndex
- }, r = [], a = fT(n, e, s, (o, c, l, h, u) => {
+ }, r = [], a = pT(n, e, s, (o, c, l, h, u) => {
r.push({
itemIndex: o.sourceItemIndex,
gapBefore: c,
@@ -30780,14 +30780,14 @@ function pT(i, e, t = Cx) {
end: s
};
}
-function AT(i, e) {
- return oT(i.prepared, {
+function gT(i, e) {
+ return cT(i.prepared, {
width: e.occupiedWidth - i.extraWidth,
start: e.start,
end: e.end
}).text;
}
-function Sx(i, e) {
+function Mx(i, e) {
const t = i;
return {
fragments: e.fragments.map((n) => {
@@ -30796,24 +30796,24 @@ function Sx(i, e) {
throw new Error("Missing rich-text inline item for fragment");
return {
...n,
- text: AT(s, n)
+ text: gT(s, n)
};
}),
width: e.width,
end: e.end
};
}
-function Mx(i, e, t) {
- let n = 0, s = Cx;
+function Bx(i, e, t) {
+ let n = 0, s = Ix;
for (; ; ) {
- const r = pT(i, e, s);
+ const r = AT(i, e, s);
if (r === null)
return n;
t(r), n++, s = r.end;
}
}
-const Lg = "500 14px Inter, sans-serif", Tu = "600 10px Inter, sans-serif", Ru = "300 13px Inter, sans-serif", Pg = "600 10px Inter, sans-serif", kg = "300 12px Inter, sans-serif", Ao = 18, ll = 16, hn = 16, Di = 6, Ug = 12, hl = Math.min(window.devicePixelRatio || 1, 2), gT = "rgba(0, 0, 0, 0.75)", mT = "rgba(255, 255, 255, 0.08)", xT = "rgba(255, 255, 255, 0.9)", bT = "rgba(255, 255, 255, 0.30)", ET = "rgba(255, 255, 255, 0.85)", Og = "rgba(255, 255, 255, 0.08)", yT = "rgba(255, 255, 255, 0.45)", _T = "rgba(255, 255, 255, 0.08)", wT = "rgba(255, 255, 255, 0.7)";
-function vT(i) {
+const kg = "500 14px Inter, sans-serif", Fu = "600 10px Inter, sans-serif", Nu = "300 13px Inter, sans-serif", Ug = "600 10px Inter, sans-serif", Og = "300 12px Inter, sans-serif", go = 18, hl = 16, hn = 16, Li = 6, Qg = 12, ul = Math.min(window.devicePixelRatio || 1, 2), mT = "rgba(0, 0, 0, 0.75)", xT = "rgba(255, 255, 255, 0.08)", bT = "rgba(255, 255, 255, 0.9)", ET = "rgba(255, 255, 255, 0.30)", yT = "rgba(255, 255, 255, 0.85)", Gg = "rgba(255, 255, 255, 0.08)", _T = "rgba(255, 255, 255, 0.45)", wT = "rgba(255, 255, 255, 0.08)", vT = "rgba(255, 255, 255, 0.7)";
+function CT(i) {
let e = 0, t = 0, n = 0;
const s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
let o = !1, c = !1;
@@ -30840,29 +30840,29 @@ function vT(i) {
hasMorphs: c
};
}
-function go(i) {
+function mo(i) {
return i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString();
}
-function CT(i, e) {
+function IT(i, e) {
const t = [];
return i.hasSkinning && t.push("skinned"), i.hasMorphs && t.push("morph targets"), e && e.length > 0 && t.push(`${e.length} animation${e.length > 1 ? "s" : ""}`), i.materialTypes.length > 0 && t.push(i.materialTypes.join(", ")), t.length > 0 ? t.join(" · ") : "";
}
-function IT(i, e, t) {
- const n = vT(e), s = CT(n, t), r = [
- { label: "MESHES", value: go(n.meshes) },
- { label: "VERTICES", value: go(n.vertices) },
- { label: "TRIANGLES", value: go(n.triangles) },
- { label: "MATERIALS", value: go(n.materials) },
- { label: "TEXTURES", value: go(n.textures) }
+function ST(i, e, t) {
+ const n = CT(e), s = IT(n, t), r = [
+ { label: "MESHES", value: mo(n.meshes) },
+ { label: "VERTICES", value: mo(n.vertices) },
+ { label: "TRIANGLES", value: mo(n.triangles) },
+ { label: "MATERIALS", value: mo(n.materials) },
+ { label: "TEXTURES", value: mo(n.textures) }
];
t && t.length > 0 && r.push({ label: "ANIMATIONS", value: t.length.toString() });
const a = [];
n.materialTypes.forEach((w) => a.push(w)), n.hasSkinning && a.push("Skinned"), n.hasMorphs && a.push("Morph"), t && t.length > 0 && a.push("Animated");
- const o = 200, c = ol("Model Info", Lg), l = nT(c, o, Ao + 2), h = r.map((w) => {
+ const o = 200, c = cl("Model Info", kg), l = iT(c, o, go + 2), h = r.map((w) => {
const I = [
- { text: w.label + " ", font: Tu },
- { text: w.value, font: Ru }
- ], T = Ix(I), C = ol(w.label, Tu), v = Mu(C, o), F = ol(w.value, Ru), K = Mu(F, o);
+ { text: w.label + " ", font: Fu },
+ { text: w.value, font: Nu }
+ ], T = Sx(I), C = cl(w.label, Fu), v = Tu(C, o), F = cl(w.value, Nu), K = Tu(F, o);
return {
...w,
labelWidth: v.maxLineWidth,
@@ -30870,12 +30870,12 @@ function IT(i, e, t) {
richPrepared: T
};
}), u = a.map((w) => {
- const I = ol(w, Pg), T = Mu(I, 300);
- return { text: w, width: T.maxLineWidth + Ug };
+ const I = cl(w, Ug), T = Tu(I, 300);
+ return { text: w, width: T.maxLineWidth + Qg };
});
let d = [], f = 0;
if (s) {
- const w = $l(s, kg), I = lT(w, o - hn, Ao);
+ const w = th(s, Og), I = hT(w, o - hn, go);
d = I.lines, f = I.height;
}
const p = Math.max(
@@ -30887,28 +30887,28 @@ function IT(i, e, t) {
let w = 0, I = 1;
u.forEach((T) => {
w > 0 && w + T.width > m - hn * 2 && (I++, w = 0), w += T.width + 6;
- }), g = I * (ll + 6) + Di;
+ }), g = I * (hl + 6) + Li;
}
- const A = hn + l.height + Di + // title
- Di + // separator
- h.length * (Ao + Di) + // stat rows
+ const A = hn + l.height + Li + // title
+ Li + // separator
+ h.length * (go + Li) + // stat rows
g + // chips
- (f > 0 ? Di + f : 0) + // description
+ (f > 0 ? Li + f : 0) + // description
hn, _ = document.createElement("canvas");
- _.width = m * hl, _.height = A * hl, _.style.width = m + "px", _.style.height = A + "px";
+ _.width = m * ul, _.height = A * ul, _.style.width = m + "px", _.style.height = A + "px";
const x = _.getContext("2d");
- x.scale(hl, hl), x.fillStyle = gT, Fu(x, 0, 0, m, A, 10), x.fill(), x.strokeStyle = mT, x.lineWidth = 1, Fu(x, 0.5, 0.5, m - 1, A - 1, 10), x.stroke();
+ x.scale(ul, ul), x.fillStyle = mT, Du(x, 0, 0, m, A, 10), x.fill(), x.strokeStyle = xT, x.lineWidth = 1, Du(x, 0.5, 0.5, m - 1, A - 1, 10), x.stroke();
let E = hn;
- if (x.font = Lg, x.fillStyle = xT, x.textBaseline = "top", x.fillText("Model Info", hn, E), E += l.height + Di, x.strokeStyle = Og, x.beginPath(), x.moveTo(hn, E), x.lineTo(m - hn, E), x.stroke(), E += Di, h.forEach((w) => {
- x.font = Tu, x.fillStyle = bT, x.textAlign = "left", x.fillText(w.label, hn, E), x.font = Ru, x.fillStyle = ET, x.textAlign = "right", x.fillText(w.value, m - hn, E), x.textAlign = "left", E += Ao + Di;
+ if (x.font = kg, x.fillStyle = bT, x.textBaseline = "top", x.fillText("Model Info", hn, E), E += l.height + Li, x.strokeStyle = Gg, x.beginPath(), x.moveTo(hn, E), x.lineTo(m - hn, E), x.stroke(), E += Li, h.forEach((w) => {
+ x.font = Fu, x.fillStyle = ET, x.textAlign = "left", x.fillText(w.label, hn, E), x.font = Nu, x.fillStyle = yT, x.textAlign = "right", x.fillText(w.value, m - hn, E), x.textAlign = "left", E += go + Li;
}), u.length > 0) {
let w = hn;
u.forEach((I) => {
- w > hn && w + I.width > m - hn && (w = hn, E += ll + 6), x.fillStyle = _T, Fu(x, w, E, I.width, ll, 4), x.fill(), x.font = Pg, x.fillStyle = wT, x.textBaseline = "top", x.fillText(I.text, w + Ug / 2, E + 3), w += I.width + 6;
- }), E += ll + Di + 4;
+ w > hn && w + I.width > m - hn && (w = hn, E += hl + 6), x.fillStyle = wT, Du(x, w, E, I.width, hl, 4), x.fill(), x.font = Ug, x.fillStyle = vT, x.textBaseline = "top", x.fillText(I.text, w + Qg / 2, E + 3), w += I.width + 6;
+ }), E += hl + Li + 4;
}
- d.length > 0 && (x.strokeStyle = Og, x.beginPath(), x.moveTo(hn, E), x.lineTo(m - hn, E), x.stroke(), E += Di, x.font = kg, x.fillStyle = yT, x.textBaseline = "top", d.forEach((w) => {
- x.fillText(w.text, hn, E), E += Ao;
+ d.length > 0 && (x.strokeStyle = Gg, x.beginPath(), x.moveTo(hn, E), x.lineTo(m - hn, E), x.stroke(), E += Li, x.font = Og, x.fillStyle = _T, x.textBaseline = "top", d.forEach((w) => {
+ x.fillText(w.text, hn, E), E += go;
}));
const S = document.createElement("div");
return S.classList.add("model-info"), S.appendChild(_), i.appendChild(S), {
@@ -30919,25 +30919,25 @@ function IT(i, e, t) {
}
};
}
-function Fu(i, e, t, n, s, r) {
+function Du(i, e, t, n, s, r) {
i.beginPath(), i.moveTo(e + r, t), i.lineTo(e + n - r, t), i.quadraticCurveTo(e + n, t, e + n, t + r), i.lineTo(e + n, t + s - r), i.quadraticCurveTo(e + n, t + s, e + n - r, t + s), i.lineTo(e + r, t + s), i.quadraticCurveTo(e, t + s, e, t + s - r), i.lineTo(e, t + r), i.quadraticCurveTo(e, t, e + r, t), i.closePath();
}
-const ST = "500 11px Inter, sans-serif", Qg = "300 10px Inter, sans-serif", rf = 10, Bx = 6, Tx = 14, ul = Math.min(window.devicePixelRatio || 1, 2), MT = 8;
-function BT(i) {
+const MT = "500 11px Inter, sans-serif", Hg = "300 10px Inter, sans-serif", of = 10, Tx = 6, Rx = 14, dl = Math.min(window.devicePixelRatio || 1, 2), BT = 8;
+function TT(i) {
const e = [];
return i.traverse((t) => {
- if (e.length >= MT || !t.isMesh || !t.name || t.name.startsWith("_")) return;
+ if (e.length >= BT || !t.isMesh || !t.name || t.name.startsWith("_")) return;
const n = t.geometry, s = Array.isArray(t.material) ? t.material[0] : t.material, r = n && n.attributes.position ? n.attributes.position.count : 0, a = s ? s.type.replace("Material", "") : "", o = [
- { text: t.name, font: ST }
+ { text: t.name, font: MT }
];
- r > 0 && o.push({ text: " " + RT(r) + " verts", font: Qg }), a && o.push({ text: " " + a, font: Qg });
- const c = Ix(o);
+ r > 0 && o.push({ text: " " + FT(r) + " verts", font: Hg }), a && o.push({ text: " " + a, font: Hg });
+ const c = Sx(o);
let l = 0, h = 0;
- Mx(c, 300, (m) => {
- const g = Sx(c, m);
+ Bx(c, 300, (m) => {
+ const g = Mx(c, m);
l = Math.max(l, g.width), h++;
});
- const u = l + rf * 2, d = h * Tx + Bx * 2;
+ const u = l + of * 2, d = h * Rx + Tx * 2;
n && n.computeBoundingBox();
const f = n ? n.boundingBox : null, p = new G();
f ? (f.getCenter(p), p.applyMatrix4(t.matrixWorld)) : t.getWorldPosition(p), e.push({
@@ -30952,30 +30952,30 @@ function BT(i) {
});
}), e;
}
-function TT(i) {
+function RT(i) {
const { labelWidth: e, labelHeight: t, items: n, prepared: s } = i, r = document.createElement("canvas");
- r.width = e * ul, r.height = t * ul, r.style.width = e + "px", r.style.height = t + "px";
+ r.width = e * dl, r.height = t * dl, r.style.width = e + "px", r.style.height = t + "px";
const a = r.getContext("2d");
- a.scale(ul, ul), a.fillStyle = "rgba(0, 0, 0, 0.8)", Gg(a, 0, 0, e, t, 6), a.fill(), a.strokeStyle = "rgba(255, 255, 255, 0.1)", a.lineWidth = 1, Gg(a, 0.5, 0.5, e - 1, t - 1, 6), a.stroke(), a.textBaseline = "top";
- let o = Bx;
- return Mx(s, e - rf * 2, (c) => {
- const l = Sx(s, c);
- let h = rf;
+ a.scale(dl, dl), a.fillStyle = "rgba(0, 0, 0, 0.8)", zg(a, 0, 0, e, t, 6), a.fill(), a.strokeStyle = "rgba(255, 255, 255, 0.1)", a.lineWidth = 1, zg(a, 0.5, 0.5, e - 1, t - 1, 6), a.stroke(), a.textBaseline = "top";
+ let o = Tx;
+ return Bx(s, e - of * 2, (c) => {
+ const l = Mx(s, c);
+ let h = of;
l.fragments.forEach((u) => {
h += u.gapBefore;
const d = n[u.itemIndex];
a.font = d.font, a.fillStyle = u.itemIndex === 0 ? "rgba(255, 255, 255, 0.9)" : "rgba(255, 255, 255, 0.45)", a.fillText(u.text, h, o), h += u.occupiedWidth;
- }), o += Tx;
+ }), o += Rx;
}), r;
}
-function RT(i) {
+function FT(i) {
return i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString();
}
-function Gg(i, e, t, n, s, r) {
+function zg(i, e, t, n, s, r) {
i.beginPath(), i.moveTo(e + r, t), i.lineTo(e + n - r, t), i.quadraticCurveTo(e + n, t, e + n, t + r), i.lineTo(e + n, t + s - r), i.quadraticCurveTo(e + n, t + s, e + n - r, t + s), i.lineTo(e + r, t + s), i.quadraticCurveTo(e, t + s, e, t + s - r), i.lineTo(e, t + r), i.quadraticCurveTo(e, t, e + r, t), i.closePath();
}
-const Nu = /* @__PURE__ */ new WeakMap();
-class FT extends fi {
+const Lu = /* @__PURE__ */ new WeakMap();
+class NT extends pi {
/**
* Constructs a new Draco loader.
*
@@ -31061,8 +31061,8 @@ class FT extends fi {
}
decodeGeometry(e, t) {
const n = JSON.stringify(t);
- if (Nu.has(e)) {
- const c = Nu.get(e);
+ if (Lu.has(e)) {
+ const c = Lu.get(e);
if (c.key === n)
return c.promise;
if (e.byteLength === 0)
@@ -31076,7 +31076,7 @@ class FT extends fi {
}))).then((c) => this._createGeometry(c.geometry));
return o.catch(() => !0).then(() => {
s && r && this._releaseTask(s, r);
- }), Nu.set(e, {
+ }), Lu.set(e, {
key: n,
promise: o
}), o;
@@ -31111,7 +31111,7 @@ class FT extends fi {
return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((n) => {
const s = n[0];
e || (this.decoderConfig.wasmBinary = n[1]);
- const r = NT.toString(), a = [
+ const r = DT.toString(), a = [
"/* draco decoder */",
s,
"",
@@ -31159,7 +31159,7 @@ class FT extends fi {
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
}
}
-function NT() {
+function DT() {
let i, e;
onmessage = function(a) {
const o = a.data;
@@ -31249,7 +31249,7 @@ function NT() {
}
}
}
-class DT {
+class LT {
/**
* Constructs a new Worker pool.
*
@@ -31315,13 +31315,13 @@ class DT {
this.workers.forEach((e) => e.terminate()), this.workersResolve.length = 0, this.workers.length = 0, this.queue.length = 0, this.workerStatus = 0;
}
}
-const LT = 0, Hg = 2, PT = 1, zg = 2, kT = 0, UT = 1, OT = 10, QT = 0, Rx = 9, Fx = 15, Nx = 16, Dx = 22, Lx = 37, Px = 43, kx = 76, Ux = 83, Ox = 97, Qx = 100, Gx = 103, Hx = 109, zx = 165, Vx = 166, fp = 1000066e3;
-class GT {
+const PT = 0, Vg = 2, kT = 1, Wg = 2, UT = 0, OT = 1, QT = 10, GT = 0, Fx = 9, Nx = 15, Dx = 16, Lx = 22, Px = 37, kx = 43, Ux = 76, Ox = 83, Qx = 97, Gx = 100, Hx = 103, zx = 109, Vx = 165, Wx = 166, Ap = 1000066e3;
+class HT {
constructor() {
this.vkFormat = 0, this.typeSize = 1, this.pixelWidth = 0, this.pixelHeight = 0, this.pixelDepth = 0, this.layerCount = 0, this.faceCount = 1, this.supercompressionScheme = 0, this.levels = [], this.dataFormatDescriptor = [{ vendorId: 0, descriptorType: 0, descriptorBlockSize: 0, versionNumber: 2, colorModel: 0, colorPrimaries: 1, transferFunction: 2, flags: 0, texelBlockDimension: [0, 0, 0, 0], bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0], samples: [] }], this.keyValue = {}, this.globalData = null;
}
}
-class mo {
+class xo {
constructor(e, t, n, s) {
this._dataView = void 0, this._littleEndian = void 0, this._offset = void 0, this._dataView = new DataView(e.buffer, e.byteOffset + t, n), this._littleEndian = s, this._offset = 0;
}
@@ -31360,69 +31360,69 @@ class mo {
return s < e && this._offset++, new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + n, s);
}
}
-const Dn = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
-function Vg(i) {
+const Ln = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
+function qg(i) {
return new TextDecoder().decode(i);
}
-function HT(i) {
- const e = new Uint8Array(i.buffer, i.byteOffset, Dn.length);
- if (e[0] !== Dn[0] || e[1] !== Dn[1] || e[2] !== Dn[2] || e[3] !== Dn[3] || e[4] !== Dn[4] || e[5] !== Dn[5] || e[6] !== Dn[6] || e[7] !== Dn[7] || e[8] !== Dn[8] || e[9] !== Dn[9] || e[10] !== Dn[10] || e[11] !== Dn[11]) throw new Error("Missing KTX 2.0 identifier.");
- const t = new GT(), n = 17 * Uint32Array.BYTES_PER_ELEMENT, s = new mo(i, Dn.length, n, !0);
+function zT(i) {
+ const e = new Uint8Array(i.buffer, i.byteOffset, Ln.length);
+ if (e[0] !== Ln[0] || e[1] !== Ln[1] || e[2] !== Ln[2] || e[3] !== Ln[3] || e[4] !== Ln[4] || e[5] !== Ln[5] || e[6] !== Ln[6] || e[7] !== Ln[7] || e[8] !== Ln[8] || e[9] !== Ln[9] || e[10] !== Ln[10] || e[11] !== Ln[11]) throw new Error("Missing KTX 2.0 identifier.");
+ const t = new HT(), n = 17 * Uint32Array.BYTES_PER_ELEMENT, s = new xo(i, Ln.length, n, !0);
t.vkFormat = s._nextUint32(), t.typeSize = s._nextUint32(), t.pixelWidth = s._nextUint32(), t.pixelHeight = s._nextUint32(), t.pixelDepth = s._nextUint32(), t.layerCount = s._nextUint32(), t.faceCount = s._nextUint32();
const r = s._nextUint32();
t.supercompressionScheme = s._nextUint32();
- const a = s._nextUint32(), o = s._nextUint32(), c = s._nextUint32(), l = s._nextUint32(), h = s._nextUint64(), u = s._nextUint64(), d = new mo(i, Dn.length + n, 3 * r * 8, !0);
+ const a = s._nextUint32(), o = s._nextUint32(), c = s._nextUint32(), l = s._nextUint32(), h = s._nextUint64(), u = s._nextUint64(), d = new xo(i, Ln.length + n, 3 * r * 8, !0);
for (let Y = 0; Y < r; Y++) t.levels.push({ levelData: new Uint8Array(i.buffer, i.byteOffset + d._nextUint64(), d._nextUint64()), uncompressedByteLength: d._nextUint64() });
- const f = new mo(i, a, o, !0), p = { vendorId: f._skip(4)._nextUint16(), descriptorType: f._nextUint16(), versionNumber: f._nextUint16(), descriptorBlockSize: f._nextUint16(), colorModel: f._nextUint8(), colorPrimaries: f._nextUint8(), transferFunction: f._nextUint8(), flags: f._nextUint8(), texelBlockDimension: [f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8()], bytesPlane: [f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8()], samples: [] }, m = (p.descriptorBlockSize / 4 - 6) / 4;
+ const f = new xo(i, a, o, !0), p = { vendorId: f._skip(4)._nextUint16(), descriptorType: f._nextUint16(), versionNumber: f._nextUint16(), descriptorBlockSize: f._nextUint16(), colorModel: f._nextUint8(), colorPrimaries: f._nextUint8(), transferFunction: f._nextUint8(), flags: f._nextUint8(), texelBlockDimension: [f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8()], bytesPlane: [f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8()], samples: [] }, m = (p.descriptorBlockSize / 4 - 6) / 4;
for (let Y = 0; Y < m; Y++) {
const Q = { bitOffset: f._nextUint16(), bitLength: f._nextUint8(), channelType: f._nextUint8(), samplePosition: [f._nextUint8(), f._nextUint8(), f._nextUint8(), f._nextUint8()], sampleLower: -1 / 0, sampleUpper: 1 / 0 };
64 & Q.channelType ? (Q.sampleLower = f._nextInt32(), Q.sampleUpper = f._nextInt32()) : (Q.sampleLower = f._nextUint32(), Q.sampleUpper = f._nextUint32()), p.samples[Y] = Q;
}
t.dataFormatDescriptor.length = 0, t.dataFormatDescriptor.push(p);
- const g = new mo(i, c, l, !0);
+ const g = new xo(i, c, l, !0);
for (; g._offset < l; ) {
- const Y = g._nextUint32(), Q = g._scan(Y), J = Vg(Q);
+ const Y = g._nextUint32(), Q = g._scan(Y), J = qg(Q);
if (t.keyValue[J] = g._nextUint8Array(Y - Q.byteLength - 1), J.match(/^ktx/i)) {
- const ee = Vg(t.keyValue[J]);
+ const ee = qg(t.keyValue[J]);
t.keyValue[J] = ee.substring(0, ee.lastIndexOf("\0"));
}
g._skip(Y % 4 ? 4 - Y % 4 : 0);
}
if (u <= 0) return t;
- const A = new mo(i, h, u, !0), _ = A._nextUint16(), x = A._nextUint16(), E = A._nextUint32(), S = A._nextUint32(), w = A._nextUint32(), I = A._nextUint32(), T = [];
+ const A = new xo(i, h, u, !0), _ = A._nextUint16(), x = A._nextUint16(), E = A._nextUint32(), S = A._nextUint32(), w = A._nextUint32(), I = A._nextUint32(), T = [];
for (let Y = 0; Y < r; Y++) T.push({ imageFlags: A._nextUint32(), rgbSliceByteOffset: A._nextUint32(), rgbSliceByteLength: A._nextUint32(), alphaSliceByteOffset: A._nextUint32(), alphaSliceByteLength: A._nextUint32() });
const C = h + A._offset, v = C + E, F = v + S, K = F + w, q = new Uint8Array(i.buffer, i.byteOffset + C, E), $ = new Uint8Array(i.buffer, i.byteOffset + v, S), D = new Uint8Array(i.buffer, i.byteOffset + F, w), O = new Uint8Array(i.buffer, i.byteOffset + K, I);
return t.globalData = { endpointCount: _, selectorCount: x, imageDescs: T, endpointsData: q, selectorsData: $, tablesData: D, extendedData: O }, t;
}
-let Du, es, af;
-const Lu = { env: { emscripten_notify_memory_growth: function(i) {
- af = new Uint8Array(es.exports.memory.buffer);
+let Pu, ts, cf;
+const ku = { env: { emscripten_notify_memory_growth: function(i) {
+ cf = new Uint8Array(ts.exports.memory.buffer);
} } };
-class zT {
+class VT {
init() {
- return Du || (Du = typeof fetch < "u" ? fetch("data:application/wasm;base64," + Wg).then((e) => e.arrayBuffer()).then((e) => WebAssembly.instantiate(e, Lu)).then(this._init) : WebAssembly.instantiate(Buffer.from(Wg, "base64"), Lu).then(this._init), Du);
+ return Pu || (Pu = typeof fetch < "u" ? fetch("data:application/wasm;base64," + Kg).then((e) => e.arrayBuffer()).then((e) => WebAssembly.instantiate(e, ku)).then(this._init) : WebAssembly.instantiate(Buffer.from(Kg, "base64"), ku).then(this._init), Pu);
}
_init(e) {
- es = e.instance, Lu.env.emscripten_notify_memory_growth(0);
+ ts = e.instance, ku.env.emscripten_notify_memory_growth(0);
}
decode(e, t = 0) {
- if (!es) throw new Error("ZSTDDecoder: Await .init() before decoding.");
- const n = e.byteLength, s = es.exports.malloc(n);
- af.set(e, s), t = t || Number(es.exports.ZSTD_findDecompressedSize(s, n));
- const r = es.exports.malloc(t), a = es.exports.ZSTD_decompress(r, t, s, n), o = af.slice(r, r + a);
- return es.exports.free(s), es.exports.free(r), o;
+ if (!ts) throw new Error("ZSTDDecoder: Await .init() before decoding.");
+ const n = e.byteLength, s = ts.exports.malloc(n);
+ cf.set(e, s), t = t || Number(ts.exports.ZSTD_findDecompressedSize(s, n));
+ const r = ts.exports.malloc(t), a = ts.exports.ZSTD_decompress(r, t, s, n), o = cf.slice(r, r + a);
+ return ts.exports.free(s), ts.exports.free(r), o;
}
}
-const Wg = "AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwI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oAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFB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kdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUE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AB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ", VT = "display-p3", WT = "display-p3-linear", Pu = /* @__PURE__ */ new WeakMap();
-let ku = 0, Uu;
-class oi extends fi {
+const Kg = "AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAg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QCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2Agw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CACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBI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iADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgU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IAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggAC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AAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ", WT = "display-p3", qT = "display-p3-linear", Uu = /* @__PURE__ */ new WeakMap();
+let Ou = 0, Qu;
+class ci extends pi {
/**
* Constructs a new KTX2 loader.
*
* @param {LoadingManager} [manager] - The loading manager.
*/
constructor(e) {
- super(e), this.transcoderPath = "", this.transcoderBinary = null, this.transcoderPending = null, this.workerPool = new DT(), this.workerSourceURL = "", this.workerConfig = null, typeof MSC_TRANSCODER < "u" && console.warn(
+ super(e), this.transcoderPath = "", this.transcoderBinary = null, this.transcoderPending = null, this.workerPool = new LT(), this.workerSourceURL = "", this.workerConfig = null, typeof MSC_TRANSCODER < "u" && console.warn(
'THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'
);
}
@@ -31501,12 +31501,12 @@ class oi extends fi {
n.setPath(this.transcoderPath), n.setResponseType("arraybuffer"), n.setWithCredentials(this.withCredentials);
const s = n.loadAsync("basis_transcoder.wasm");
this.transcoderPending = Promise.all([t, s]).then(([r, a]) => {
- const o = oi.BasisWorker.toString(), c = [
+ const o = ci.BasisWorker.toString(), c = [
"/* constants */",
- "let _EngineFormat = " + JSON.stringify(oi.EngineFormat),
- "let _EngineType = " + JSON.stringify(oi.EngineType),
- "let _TranscoderFormat = " + JSON.stringify(oi.TranscoderFormat),
- "let _BasisFormat = " + JSON.stringify(oi.BasisFormat),
+ "let _EngineFormat = " + JSON.stringify(ci.EngineFormat),
+ "let _EngineType = " + JSON.stringify(ci.EngineType),
+ "let _TranscoderFormat = " + JSON.stringify(ci.TranscoderFormat),
+ "let _BasisFormat = " + JSON.stringify(ci.BasisFormat),
"/* basis_transcoder.js */",
r,
"/* worker */",
@@ -31517,9 +31517,9 @@ class oi extends fi {
const l = new Worker(this.workerSourceURL), h = this.transcoderBinary.slice(0);
return l.postMessage({ type: "init", config: this.workerConfig, transcoderBinary: h }, [h]), l;
});
- }), ku > 0 && console.warn(
+ }), Ou > 0 && console.warn(
"THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."
- ), ku++;
+ ), Ou++;
}
return this.transcoderPending;
}
@@ -31551,8 +31551,8 @@ class oi extends fi {
parse(e, t, n) {
if (this.workerConfig === null)
throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
- if (Pu.has(e))
- return Pu.get(e).promise.then(t).catch(n);
+ if (Uu.has(e))
+ return Uu.get(e).promise.then(t).catch(n);
this._createTexture(e).then((s) => t ? t(s) : null).catch(n);
}
_createTextureFrom(e, t) {
@@ -31560,12 +31560,12 @@ class oi extends fi {
if (n === "error") return Promise.reject(s);
let u;
if (t.faceCount === 6)
- u = new H_(r, c, l);
+ u = new z_(r, c, l);
else {
const d = r[0].mipmaps;
- u = t.layerCount > 1 ? new G_(d, a, o, t.layerCount, c, l) : new mh(d, a, o, c, l);
+ u = t.layerCount > 1 ? new H_(d, a, o, t.layerCount, c, l) : new bh(d, a, o, c, l);
}
- return u.minFilter = r[0].mipmaps.length === 1 ? Xt : hi, u.magFilter = Xt, u.generateMipmaps = !1, u.needsUpdate = !0, u.colorSpace = Wx(t), u.premultiplyAlpha = !!(h & PT), u;
+ return u.minFilter = r[0].mipmaps.length === 1 ? Xt : ui, u.magFilter = Xt, u.generateMipmaps = !1, u.needsUpdate = !0, u.colorSpace = qx(t), u.premultiplyAlpha = !!(h & kT), u;
}
/**
* @private
@@ -31574,26 +31574,26 @@ class oi extends fi {
* @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
*/
async _createTexture(e, t = {}) {
- const n = HT(new Uint8Array(e)), s = n.vkFormat === fp && n.dataFormatDescriptor[0].colorModel === 167;
- if (!(n.vkFormat === QT || s && !this.workerConfig.astcHDRSupported))
- return KT(n);
+ const n = zT(new Uint8Array(e)), s = n.vkFormat === Ap && n.dataFormatDescriptor[0].colorModel === 167;
+ if (!(n.vkFormat === GT || s && !this.workerConfig.astcHDRSupported))
+ return jT(n);
const a = t, o = this.init().then(() => this.workerPool.postMessage({ type: "transcode", buffer: e, taskConfig: a }, [e])).then((c) => this._createTextureFrom(c.data, n));
- return Pu.set(e, { promise: o }), o;
+ return Uu.set(e, { promise: o }), o;
}
/**
* Frees internal resources. This method should be called
* when the loader is no longer required.
*/
dispose() {
- this.workerPool.dispose(), this.workerSourceURL && URL.revokeObjectURL(this.workerSourceURL), ku--;
+ this.workerPool.dispose(), this.workerSourceURL && URL.revokeObjectURL(this.workerSourceURL), Ou--;
}
}
-oi.BasisFormat = {
+ci.BasisFormat = {
ETC1S: 0,
UASTC: 1,
UASTC_HDR: 2
};
-oi.TranscoderFormat = {
+ci.TranscoderFormat = {
ETC1: 0,
ETC2: 1,
BC1: 2,
@@ -31615,25 +31615,25 @@ oi.TranscoderFormat = {
RGB_HALF: 24,
RGBA_HALF: 25
};
-oi.EngineFormat = {
+ci.EngineFormat = {
RGBAFormat: pn,
- RGBA_ASTC_4x4_Format: Vo,
- RGB_BPTC_UNSIGNED_Format: Gl,
- RGBA_BPTC_Format: Ro,
- RGBA_ETC2_EAC_Format: Ql,
- RGBA_PVRTC_4BPPV1_Format: kl,
- RGBA_S3TC_DXT5_Format: To,
- RGB_ETC1_Format: Ul,
- RGB_ETC2_Format: Ol,
- RGB_PVRTC_4BPPV1_Format: Pl,
- RGBA_S3TC_DXT1_Format: Bo
+ RGBA_ASTC_4x4_Format: Wo,
+ RGB_BPTC_UNSIGNED_Format: zl,
+ RGBA_BPTC_Format: Fo,
+ RGBA_ETC2_EAC_Format: Hl,
+ RGBA_PVRTC_4BPPV1_Format: Ol,
+ RGBA_S3TC_DXT5_Format: Ro,
+ RGB_ETC1_Format: Ql,
+ RGB_ETC2_Format: Gl,
+ RGB_PVRTC_4BPPV1_Format: Ul,
+ RGBA_S3TC_DXT1_Format: To
};
-oi.EngineType = {
+ci.EngineType = {
UnsignedByteType: un,
- HalfFloatType: Qn,
+ HalfFloatType: Gn,
FloatType: fn
};
-oi.BasisWorker = function() {
+ci.BasisWorker = function() {
let i, e, t;
const n = _EngineFormat, s = _EngineType, r = _TranscoderFormat, a = _BasisFormat;
self.addEventListener("message", function(p) {
@@ -31830,64 +31830,64 @@ oi.BasisWorker = function() {
return g;
}
};
-const qT = /* @__PURE__ */ new Set([pn, Er, cs]), Ou = {
- [Hx]: pn,
- [Ox]: pn,
- [Lx]: pn,
+const KT = /* @__PURE__ */ new Set([pn, Er, cs]), Gu = {
+ [zx]: pn,
+ [Qx]: pn,
[Px]: pn,
- [Gx]: Er,
- [Ux]: Er,
- [Nx]: Er,
+ [kx]: pn,
+ [Hx]: Er,
+ [Ox]: Er,
[Dx]: Er,
- [Qx]: cs,
- [kx]: cs,
+ [Lx]: Er,
+ [Gx]: cs,
+ [Ux]: cs,
+ [Nx]: cs,
[Fx]: cs,
- [Rx]: cs,
- [fp]: Vo,
- [Vx]: Wo,
- [zx]: Wo
-}, Qu = {
+ [Ap]: Wo,
+ [Wx]: qo,
+ [Vx]: qo
+}, Hu = {
+ [zx]: fn,
+ [Qx]: Gn,
+ [Px]: un,
+ [kx]: un,
[Hx]: fn,
- [Ox]: Qn,
+ [Ox]: Gn,
+ [Dx]: un,
[Lx]: un,
- [Px]: un,
[Gx]: fn,
- [Ux]: Qn,
+ [Ux]: Gn,
[Nx]: un,
- [Dx]: un,
- [Qx]: fn,
- [kx]: Qn,
[Fx]: un,
- [Rx]: un,
- [fp]: Qn,
- [Vx]: un,
- [zx]: un
+ [Ap]: Gn,
+ [Wx]: un,
+ [Vx]: un
};
-async function KT(i) {
+async function jT(i) {
const { vkFormat: e } = i;
- if (Ou[e] === void 0)
+ if (Gu[e] === void 0)
throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");
let t;
- i.supercompressionScheme === Hg && (Uu || (Uu = new Promise(async (r) => {
- const a = new zT();
+ i.supercompressionScheme === Vg && (Qu || (Qu = new Promise(async (r) => {
+ const a = new VT();
await a.init(), r(a);
- })), t = await Uu);
+ })), t = await Qu);
const n = [];
for (let r = 0; r < i.levels.length; r++) {
const a = Math.max(1, i.pixelWidth >> r), o = Math.max(1, i.pixelHeight >> r), c = i.pixelDepth ? Math.max(1, i.pixelDepth >> r) : 0, l = i.levels[r];
let h;
- if (i.supercompressionScheme === LT)
+ if (i.supercompressionScheme === PT)
h = l.levelData;
- else if (i.supercompressionScheme === Hg)
+ else if (i.supercompressionScheme === Vg)
h = t.decode(l.levelData, l.uncompressedByteLength);
else
throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");
let u;
- Qu[e] === fn ? u = new Float32Array(
+ Hu[e] === fn ? u = new Float32Array(
h.buffer,
h.byteOffset,
h.byteLength / Float32Array.BYTES_PER_ELEMENT
- ) : Qu[e] === Qn ? u = new Uint16Array(
+ ) : Hu[e] === Gn ? u = new Uint16Array(
h.buffer,
h.byteOffset,
h.byteLength / Uint16Array.BYTES_PER_ELEMENT
@@ -31899,24 +31899,24 @@ async function KT(i) {
});
}
let s;
- if (qT.has(Ou[e]))
- s = i.pixelDepth === 0 ? new fh(n[0].data, i.pixelWidth, i.pixelHeight) : new M0(n[0].data, i.pixelWidth, i.pixelHeight, i.pixelDepth);
+ if (KT.has(Gu[e]))
+ s = i.pixelDepth === 0 ? new Ah(n[0].data, i.pixelWidth, i.pixelHeight) : new B0(n[0].data, i.pixelWidth, i.pixelHeight, i.pixelDepth);
else {
if (i.pixelDepth > 0) throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");
- s = new mh(n, i.pixelWidth, i.pixelHeight), s.minFilter = n.length === 1 ? Xt : hi, s.magFilter = Xt;
+ s = new bh(n, i.pixelWidth, i.pixelHeight), s.minFilter = n.length === 1 ? Xt : ui, s.magFilter = Xt;
}
- return s.mipmaps = n, s.type = Qu[e], s.format = Ou[e], s.colorSpace = Wx(i), s.needsUpdate = !0, Promise.resolve(s);
+ return s.mipmaps = n, s.type = Hu[e], s.format = Gu[e], s.colorSpace = qx(i), s.needsUpdate = !0, Promise.resolve(s);
}
-function Wx(i) {
+function qx(i) {
const e = i.dataFormatDescriptor[0];
- return e.colorPrimaries === UT ? e.transferFunction === zg ? _t : An : e.colorPrimaries === OT ? e.transferFunction === zg ? VT : WT : (e.colorPrimaries === kT || console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`), vi);
+ return e.colorPrimaries === OT ? e.transferFunction === Wg ? _t : An : e.colorPrimaries === QT ? e.transferFunction === Wg ? WT : qT : (e.colorPrimaries === UT || console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`), Ci);
}
-const dl = "[default]", of = { ASSET_GENERATOR: "assetgenerator" }, eh = new W0(), qx = "https://unpkg.com/[email protected]", jT = new FT(eh).setDecoderPath(
- `${qx}/examples/jsm/libs/draco/gltf/`
-), XT = new oi(eh).setTranscoderPath(
- `${qx}/examples/jsm/libs/basis/`
+const fl = "[default]", lf = { ASSET_GENERATOR: "assetgenerator" }, nh = new q0(), Kx = "https://unpkg.com/[email protected]", XT = new NT(nh).setDecoderPath(
+ `${Kx}/examples/jsm/libs/draco/gltf/`
+), YT = new ci(nh).setTranscoderPath(
+ `${Kx}/examples/jsm/libs/basis/`
);
-function qg(i, e) {
+function jg(i, e) {
const t = /* @__PURE__ */ new Set();
i.traverse((n) => {
if (!n.geometry) return;
@@ -31925,22 +31925,22 @@ function qg(i, e) {
});
});
}
-function YT(i) {
+function JT(i) {
const { state: e, options: t } = i;
- if (t.preset === of.ASSET_GENERATOR) {
- const r = new _w();
+ if (t.preset === lf.ASSET_GENERATOR) {
+ const r = new ww();
r.name = "hemi_light", i.scene.add(r), i.lights.push(r);
return;
}
- const n = new j0(e.ambientColor, e.ambientIntensity);
+ const n = new X0(e.ambientColor, e.ambientIntensity);
n.name = "ambient_light", i.defaultCamera.add(n);
- const s = new Jf(e.directColor, e.directIntensity);
+ const s = new $f(e.directColor, e.directIntensity);
s.position.set(0.5, 0, 0.866), s.name = "main_light", i.defaultCamera.add(s), i.lights.push(n, s);
}
-function JT(i) {
+function ZT(i) {
i.lights.forEach((e) => e.parent.remove(e)), i.lights.length = 0;
}
-var ci = Uint8Array, Ea = Uint16Array, ZT = Int32Array, Kx = new ci([
+var li = Uint8Array, ya = Uint16Array, $T = Int32Array, jx = new li([
0,
0,
0,
@@ -31975,7 +31975,7 @@ var ci = Uint8Array, Ea = Uint16Array, ZT = Int32Array, Kx = new ci([
0,
/* impossible */
0
-]), jx = new ci([
+]), Xx = new li([
0,
0,
0,
@@ -32009,65 +32009,65 @@ var ci = Uint8Array, Ea = Uint16Array, ZT = Int32Array, Kx = new ci([
/* unused */
0,
0
-]), $T = new ci([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Xx = function(i, e) {
- for (var t = new Ea(31), n = 0; n < 31; ++n)
+]), eR = new li([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Yx = function(i, e) {
+ for (var t = new ya(31), n = 0; n < 31; ++n)
t[n] = e += 1 << i[n - 1];
- for (var s = new ZT(t[30]), n = 1; n < 30; ++n)
+ for (var s = new $T(t[30]), n = 1; n < 30; ++n)
for (var r = t[n]; r < t[n + 1]; ++r)
s[r] = r - t[n] << 5 | n;
return { b: t, r: s };
-}, Yx = Xx(Kx, 2), Jx = Yx.b, eR = Yx.r;
-Jx[28] = 258, eR[258] = 28;
-var tR = Xx(jx, 0), nR = tR.b, cf = new Ea(32768);
+}, Jx = Yx(jx, 2), Zx = Jx.b, tR = Jx.r;
+Zx[28] = 258, tR[258] = 28;
+var nR = Yx(Xx, 0), iR = nR.b, hf = new ya(32768);
for (var Ot = 0; Ot < 32768; ++Ot) {
var Fs = (Ot & 43690) >> 1 | (Ot & 21845) << 1;
- Fs = (Fs & 52428) >> 2 | (Fs & 13107) << 2, Fs = (Fs & 61680) >> 4 | (Fs & 3855) << 4, cf[Ot] = ((Fs & 65280) >> 8 | (Fs & 255) << 8) >> 1;
+ Fs = (Fs & 52428) >> 2 | (Fs & 13107) << 2, Fs = (Fs & 61680) >> 4 | (Fs & 3855) << 4, hf[Ot] = ((Fs & 65280) >> 8 | (Fs & 255) << 8) >> 1;
}
-var ko = (function(i, e, t) {
- for (var n = i.length, s = 0, r = new Ea(e); s < n; ++s)
+var Uo = (function(i, e, t) {
+ for (var n = i.length, s = 0, r = new ya(e); s < n; ++s)
i[s] && ++r[i[s] - 1];
- var a = new Ea(e);
+ var a = new ya(e);
for (s = 1; s < e; ++s)
a[s] = a[s - 1] + r[s - 1] << 1;
var o;
if (t) {
- o = new Ea(1 << e);
+ o = new ya(1 << e);
var c = 15 - e;
for (s = 0; s < n; ++s)
if (i[s])
for (var l = s << 4 | i[s], h = e - i[s], u = a[i[s] - 1]++ << h, d = u | (1 << h) - 1; u <= d; ++u)
- o[cf[u] >> c] = l;
+ o[hf[u] >> c] = l;
} else
- for (o = new Ea(n), s = 0; s < n; ++s)
- i[s] && (o[s] = cf[a[i[s] - 1]++] >> 15 - i[s]);
+ for (o = new ya(n), s = 0; s < n; ++s)
+ i[s] && (o[s] = hf[a[i[s] - 1]++] >> 15 - i[s]);
return o;
-}), pc = new ci(288);
+}), Ac = new li(288);
for (var Ot = 0; Ot < 144; ++Ot)
- pc[Ot] = 8;
+ Ac[Ot] = 8;
for (var Ot = 144; Ot < 256; ++Ot)
- pc[Ot] = 9;
+ Ac[Ot] = 9;
for (var Ot = 256; Ot < 280; ++Ot)
- pc[Ot] = 7;
+ Ac[Ot] = 7;
for (var Ot = 280; Ot < 288; ++Ot)
- pc[Ot] = 8;
-var Zx = new ci(32);
+ Ac[Ot] = 8;
+var $x = new li(32);
for (var Ot = 0; Ot < 32; ++Ot)
- Zx[Ot] = 5;
-var iR = /* @__PURE__ */ ko(pc, 9, 1), sR = /* @__PURE__ */ ko(Zx, 5, 1), Gu = function(i) {
+ $x[Ot] = 5;
+var sR = /* @__PURE__ */ Uo(Ac, 9, 1), rR = /* @__PURE__ */ Uo($x, 5, 1), zu = function(i) {
for (var e = i[0], t = 1; t < i.length; ++t)
i[t] > e && (e = i[t]);
return e;
-}, bi = function(i, e, t) {
+}, Ei = function(i, e, t) {
var n = e / 8 | 0;
return (i[n] | i[n + 1] << 8) >> (e & 7) & t;
-}, Hu = function(i, e) {
+}, Vu = function(i, e) {
var t = e / 8 | 0;
return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7);
-}, rR = function(i) {
+}, aR = function(i) {
return (i + 7) / 8 | 0;
-}, aR = function(i, e, t) {
- return (t == null || t > i.length) && (t = i.length), new ci(i.subarray(e, t));
-}, oR = [
+}, oR = function(i, e, t) {
+ return (t == null || t > i.length) && (t = i.length), new li(i.subarray(e, t));
+}, cR = [
"unexpected EOF",
"invalid block type",
"invalid length/literal",
@@ -32083,75 +32083,75 @@ var iR = /* @__PURE__ */ ko(pc, 9, 1), sR = /* @__PURE__ */ ko(Zx, 5, 1), Gu = f
"stream finishing",
"invalid zip data"
// determined by unknown compression method
-], Ei = function(i, e, t) {
- var n = new Error(e || oR[i]);
- if (n.code = i, Error.captureStackTrace && Error.captureStackTrace(n, Ei), !t)
+], yi = function(i, e, t) {
+ var n = new Error(e || cR[i]);
+ if (n.code = i, Error.captureStackTrace && Error.captureStackTrace(n, yi), !t)
throw n;
return n;
-}, cR = function(i, e, t, n) {
+}, lR = function(i, e, t, n) {
var s = i.length, r = 0;
if (!s || e.f && !e.l)
- return t || new ci(0);
+ return t || new li(0);
var a = !t, o = a || e.i != 2, c = e.i;
- a && (t = new ci(s * 3));
+ a && (t = new li(s * 3));
var l = function(St) {
var ht = t.length;
if (St > ht) {
- var $e = new ci(Math.max(ht * 2, St));
+ var $e = new li(Math.max(ht * 2, St));
$e.set(t), t = $e;
}
}, h = e.f || 0, u = e.p || 0, d = e.b || 0, f = e.l, p = e.d, m = e.m, g = e.n, A = s * 8;
do {
if (!f) {
- h = bi(i, u, 1);
- var _ = bi(i, u + 1, 3);
+ h = Ei(i, u, 1);
+ var _ = Ei(i, u + 1, 3);
if (u += 3, _)
if (_ == 1)
- f = iR, p = sR, m = 9, g = 5;
+ f = sR, p = rR, m = 9, g = 5;
else if (_ == 2) {
- var w = bi(i, u, 31) + 257, I = bi(i, u + 10, 15) + 4, T = w + bi(i, u + 5, 31) + 1;
+ var w = Ei(i, u, 31) + 257, I = Ei(i, u + 10, 15) + 4, T = w + Ei(i, u + 5, 31) + 1;
u += 14;
- for (var C = new ci(T), v = new ci(19), F = 0; F < I; ++F)
- v[$T[F]] = bi(i, u + F * 3, 7);
+ for (var C = new li(T), v = new li(19), F = 0; F < I; ++F)
+ v[eR[F]] = Ei(i, u + F * 3, 7);
u += I * 3;
- for (var K = Gu(v), q = (1 << K) - 1, $ = ko(v, K, 1), F = 0; F < T; ) {
- var D = $[bi(i, u, q)];
+ for (var K = zu(v), q = (1 << K) - 1, $ = Uo(v, K, 1), F = 0; F < T; ) {
+ var D = $[Ei(i, u, q)];
u += D & 15;
var x = D >> 4;
if (x < 16)
C[F++] = x;
else {
var O = 0, Y = 0;
- for (x == 16 ? (Y = 3 + bi(i, u, 3), u += 2, O = C[F - 1]) : x == 17 ? (Y = 3 + bi(i, u, 7), u += 3) : x == 18 && (Y = 11 + bi(i, u, 127), u += 7); Y--; )
+ for (x == 16 ? (Y = 3 + Ei(i, u, 3), u += 2, O = C[F - 1]) : x == 17 ? (Y = 3 + Ei(i, u, 7), u += 3) : x == 18 && (Y = 11 + Ei(i, u, 127), u += 7); Y--; )
C[F++] = O;
}
}
var Q = C.subarray(0, w), J = C.subarray(w);
- m = Gu(Q), g = Gu(J), f = ko(Q, m, 1), p = ko(J, g, 1);
+ m = zu(Q), g = zu(J), f = Uo(Q, m, 1), p = Uo(J, g, 1);
} else
- Ei(1);
+ yi(1);
else {
- var x = rR(u) + 4, E = i[x - 4] | i[x - 3] << 8, S = x + E;
+ var x = aR(u) + 4, E = i[x - 4] | i[x - 3] << 8, S = x + E;
if (S > s) {
- c && Ei(0);
+ c && yi(0);
break;
}
o && l(d + E), t.set(i.subarray(x, S), d), e.b = d += E, e.p = u = S * 8, e.f = h;
continue;
}
if (u > A) {
- c && Ei(0);
+ c && yi(0);
break;
}
}
o && l(d + 131072);
for (var ee = (1 << m) - 1, ae = (1 << g) - 1, _e = u; ; _e = u) {
- var O = f[Hu(i, u) & ee], Me = O >> 4;
+ var O = f[Vu(i, u) & ee], Me = O >> 4;
if (u += O & 15, u > A) {
- c && Ei(0);
+ c && yi(0);
break;
}
- if (O || Ei(2), Me < 256)
+ if (O || yi(2), Me < 256)
t[d++] = Me;
else if (Me == 256) {
_e = u, f = null;
@@ -32159,25 +32159,25 @@ var iR = /* @__PURE__ */ ko(pc, 9, 1), sR = /* @__PURE__ */ ko(Zx, 5, 1), Gu = f
} else {
var se = Me - 254;
if (Me > 264) {
- var F = Me - 257, me = Kx[F];
- se = bi(i, u, (1 << me) - 1) + Jx[F], u += me;
+ var F = Me - 257, me = jx[F];
+ se = Ei(i, u, (1 << me) - 1) + Zx[F], u += me;
}
- var xe = p[Hu(i, u) & ae], be = xe >> 4;
- xe || Ei(3), u += xe & 15;
- var J = nR[be];
+ var xe = p[Vu(i, u) & ae], be = xe >> 4;
+ xe || yi(3), u += xe & 15;
+ var J = iR[be];
if (be > 3) {
- var me = jx[be];
- J += Hu(i, u) & (1 << me) - 1, u += me;
+ var me = Xx[be];
+ J += Vu(i, u) & (1 << me) - 1, u += me;
}
if (u > A) {
- c && Ei(0);
+ c && yi(0);
break;
}
o && l(d + 131072);
var Ue = d + se;
if (d < J) {
var et = r - J, He = Math.min(J, Ue);
- for (et + d < 0 && Ei(3); d < He; ++d)
+ for (et + d < 0 && yi(3); d < He; ++d)
t[d] = n[et + d];
}
for (; d < Ue; ++d)
@@ -32186,26 +32186,26 @@ var iR = /* @__PURE__ */ ko(pc, 9, 1), sR = /* @__PURE__ */ ko(Zx, 5, 1), Gu = f
}
e.l = f, e.p = _e, e.b = d, e.f = h, f && (h = 1, e.m = m, e.d = p, e.n = g);
} while (!h);
- return d != t.length && a ? aR(t, 0, d) : t.subarray(0, d);
-}, lR = /* @__PURE__ */ new ci(0), hR = function(i, e) {
- return ((i[0] & 15) != 8 || i[0] >> 4 > 7 || (i[0] << 8 | i[1]) % 31) && Ei(6, "invalid zlib data"), (i[1] >> 5 & 1) == 1 && Ei(6, "invalid zlib data: " + (i[1] & 32 ? "need" : "unexpected") + " dictionary"), (i[1] >> 3 & 4) + 2;
+ return d != t.length && a ? oR(t, 0, d) : t.subarray(0, d);
+}, hR = /* @__PURE__ */ new li(0), uR = function(i, e) {
+ return ((i[0] & 15) != 8 || i[0] >> 4 > 7 || (i[0] << 8 | i[1]) % 31) && yi(6, "invalid zlib data"), (i[1] >> 5 & 1) == 1 && yi(6, "invalid zlib data: " + (i[1] & 32 ? "need" : "unexpected") + " dictionary"), (i[1] >> 3 & 4) + 2;
};
-function Co(i, e) {
- return cR(i.subarray(hR(i), -4), { i: 2 }, e, e);
+function Io(i, e) {
+ return lR(i.subarray(uR(i), -4), { i: 2 }, e, e);
}
-var uR = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), dR = 0;
+var dR = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), fR = 0;
try {
- uR.decode(lR, { stream: !0 }), dR = 1;
+ dR.decode(hR, { stream: !0 }), fR = 1;
} catch {
}
-class fR extends yw {
+class pR extends _w {
/**
* Constructs a new EXR loader.
*
* @param {LoadingManager} [manager] - The loading manager.
*/
constructor(e) {
- super(e), this.type = Qn;
+ super(e), this.type = Gn;
}
/**
* Parses the given EXR texture data.
@@ -32537,7 +32537,7 @@ class fR extends yw {
}
function L(b, B, k) {
for (let y = 0; y < 64; ++y)
- B[k + y] = tA.toHalfFloat(M(b[y]));
+ B[k + y] = iA.toHalfFloat(M(b[y]));
}
function M(b) {
return b <= 1 ? Math.sign(b) * Math.pow(Math.abs(b), 2.2) : Math.sign(b) * Math.pow(C, Math.abs(b) - 1);
@@ -32550,7 +32550,7 @@ class fR extends yw {
return $e(k), H(k, y), new DataView(y.buffer);
}
function pe(b) {
- const B = b.array.slice(b.offset.value, b.offset.value + b.size), k = Co(B), y = new Uint8Array(k.length);
+ const B = b.array.slice(b.offset.value, b.offset.value + b.size), k = Io(B), y = new Uint8Array(k.length);
return $e(k), H(k, y), new DataView(y.buffer);
}
function oe(b) {
@@ -32591,7 +32591,7 @@ class fR extends yw {
return new DataView(ce.buffer);
}
function Qe(b) {
- const B = b.array.slice(b.offset.value, b.offset.value + b.size), k = Co(B), y = b.inputChannels.length * b.lines * b.columns * b.totalBytes, R = new ArrayBuffer(y), N = new DataView(R);
+ const B = b.array.slice(b.offset.value, b.offset.value + b.size), k = Io(B), y = b.inputChannels.length * b.lines * b.columns * b.totalBytes, R = new ArrayBuffer(y), N = new DataView(R);
let U = 0, P = 0;
const z = new Array(4);
for (let j = 0; j < b.lines; j++)
@@ -32631,7 +32631,7 @@ class fR extends yw {
acCompression: Ke(B, k)
};
if (R.version < 2)
- throw new Error("EXRLoader.parse: " + qi.compression + " version " + R.version + " is unsupported");
+ throw new Error("EXRLoader.parse: " + Ki.compression + " version " + R.version + " is unsupported");
const N = new Array();
let U = re(B, k) - 2;
for (; U > 0; ) {
@@ -32643,7 +32643,7 @@ class fR extends yw {
compression: Pe
}), U -= Ae.length + 3;
}
- const P = qi.channels, z = new Array(b.inputChannels.length);
+ const P = Ki.channels, z = new Array(b.inputChannels.length);
for (let Ae = 0; Ae < b.inputChannels.length; ++Ae) {
const ye = z[Ae] = {}, Pe = P[Ae];
ye.name = Pe.name, ye.compression = 0, ye.decoded = !1, ye.type = Pe.pixelType, ye.pLinear = Pe.pLinear, ye.width = b.columns, ye.height = b.lines;
@@ -32665,7 +32665,7 @@ class fR extends yw {
X = new Uint16Array(R.totalAcUncompressedCount), St(b.array, B, k, R.acCompressedSize, X, R.totalAcUncompressedCount);
break;
case 1:
- const Ae = b.array.slice(k.value, k.value + R.totalAcUncompressedCount), ye = Co(Ae);
+ const Ae = b.array.slice(k.value, k.value + R.totalAcUncompressedCount), ye = Io(Ae);
X = new Uint16Array(ye.buffer), k.value += R.totalAcUncompressedCount;
break;
}
@@ -32678,7 +32678,7 @@ class fR extends yw {
ie = new Uint16Array(pe(Ae).buffer), k.value += R.dcCompressedSize;
}
if (R.rleRawSize > 0) {
- const Ae = b.array.slice(k.value, k.value + R.rleCompressedSize), ye = Co(Ae);
+ const Ae = b.array.slice(k.value, k.value + R.rleCompressedSize), ye = Io(Ae);
he = xn(ye.buffer), k.value += R.rleCompressedSize;
}
let ce = 0;
@@ -32761,7 +32761,7 @@ class fR extends yw {
return B.value += 4, k;
}
function W(b, B) {
- return tA.toHalfFloat(nt(b, B));
+ return iA.toHalfFloat(nt(b, B));
}
function ne(b) {
const B = (b & 31744) >> 10, k = b & 1023;
@@ -32828,7 +32828,7 @@ class fR extends yw {
], y = tt(b, B);
return k[y];
}
- function Yn(b, B) {
+ function Jn(b, B) {
const k = [
"ONE_LEVEL",
"MIPMAP_LEVELS",
@@ -32844,15 +32844,15 @@ class fR extends yw {
roundingMode: y[U >> 4]
};
}
- function Ai(b, B) {
+ function gi(b, B) {
const k = nt(b, B), y = nt(b, B);
return [k, y];
}
- function _c(b, B) {
+ function wc(b, B) {
const k = nt(b, B), y = nt(b, B), R = nt(b, B);
return [k, y, R];
}
- function wc(b, B, k, y, R) {
+ function vc(b, B, k, y, R) {
if (y === "string" || y === "stringvector" || y === "iccProfile")
return Je(B, k, R);
if (y === "chlist")
@@ -32866,15 +32866,15 @@ class fR extends yw {
if (y === "envmap")
return Ct(b, k);
if (y === "tiledesc")
- return Yn(b, k);
+ return Jn(b, k);
if (y === "lineOrder")
return bn(b, k);
if (y === "float")
return nt(b, k);
if (y === "v2f")
- return Ai(b, k);
+ return gi(b, k);
if (y === "v3f")
- return _c(b, k);
+ return wc(b, k);
if (y === "int")
return Oe(b, k);
if (y === "rational")
@@ -32885,25 +32885,25 @@ class fR extends yw {
return k.value += R, "skipped";
k.value += R;
}
- function Wi(b, B) {
+ function qi(b, B) {
const k = Math.log2(b);
return B == "ROUND_DOWN" ? Math.floor(k) : Math.ceil(k);
}
- function $a(b, B, k) {
+ function eo(b, B, k) {
let y = 0;
switch (b.levelMode) {
case "ONE_LEVEL":
y = 1;
break;
case "MIPMAP_LEVELS":
- y = Wi(Math.max(B, k), b.roundingMode) + 1;
+ y = qi(Math.max(B, k), b.roundingMode) + 1;
break;
case "RIPMAP_LEVELS":
throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.");
}
return y;
}
- function eo(b, B, k, y) {
+ function to(b, B, k, y) {
const R = new Array(b);
for (let N = 0; N < b; N++) {
const U = 1 << N;
@@ -32914,7 +32914,7 @@ class fR extends yw {
}
return R;
}
- function vc() {
+ function Cc() {
const b = this, B = b.offset, k = { value: 0 };
for (let y = 0; y < b.tileCount; y++) {
const R = Oe(b.viewer, B), N = Oe(b.viewer, B);
@@ -32926,7 +32926,7 @@ class fR extends yw {
for (let ie = 0; ie < b.lines; ie++) {
const he = ie * b.columns * b.totalBytes;
for (let ce = 0; ce < b.inputChannels.length; ce++) {
- const fe = qi.channels[ce].name, Ae = b.channelByteOffsets[fe] * b.columns, ye = b.decodeChannels[fe];
+ const fe = Ki.channels[ce].name, Ae = b.channelByteOffsets[fe] * b.columns, ye = b.decodeChannels[fe];
if (ye === void 0) continue;
k.value = he + Ae;
const Pe = (b.height - (1 + P + ie)) * b.outLineWidth;
@@ -32941,7 +32941,7 @@ class fR extends yw {
function Vr() {
const b = this, B = b.offset, k = { value: 0 };
for (let y = 0; y < b.height / b.blockHeight; y++) {
- const R = Oe(b.viewer, B) - qi.dataWindow.yMin;
+ const R = Oe(b.viewer, B) - Ki.dataWindow.yMin;
b.size = Ge(b.viewer, B), b.lines = R + b.blockHeight > b.height ? b.height - R : b.blockHeight;
const N = b.columns * b.totalBytes, P = b.size < b.lines * N ? b.uncompress(b) : Z(b);
B.value += b.size;
@@ -32950,7 +32950,7 @@ class fR extends yw {
if (X >= b.height) continue;
const ie = z * N, he = (b.height - 1 - X) * b.outLineWidth;
for (let ce = 0; ce < b.inputChannels.length; ce++) {
- const fe = qi.channels[ce].name, Ae = b.channelByteOffsets[fe] * b.columns, ye = b.decodeChannels[fe];
+ const fe = Ki.channels[ce].name, Ae = b.channelByteOffsets[fe] * b.columns, ye = b.decodeChannels[fe];
if (ye !== void 0) {
k.value = ie + Ae;
for (let Pe = 0; Pe < b.columns; Pe++) {
@@ -32962,7 +32962,7 @@ class fR extends yw {
}
}
}
- function Cc(b, B, k) {
+ function Ic(b, B, k) {
const y = {};
if (b.getUint32(0, !0) != 20000630)
throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");
@@ -32980,7 +32980,7 @@ class fR extends yw {
if (U === "")
N = !1;
else {
- const P = qe(B, k), z = Ge(b, k), j = wc(b, B, k, P, z);
+ const P = qe(B, k), z = Ge(b, k), j = vc(b, B, k, P, z);
j === void 0 ? console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`) : y[U] = j;
}
}
@@ -33058,7 +33058,7 @@ class fR extends yw {
case fn:
N.getter = de;
break;
- case Qn:
+ case Gn:
N.getter = re;
break;
}
@@ -33067,7 +33067,7 @@ class fR extends yw {
case fn:
N.getter = nt;
break;
- case Qn:
+ case Gn:
N.getter = W;
}
else
@@ -33078,7 +33078,7 @@ class fR extends yw {
case fn:
N.byteArray = new Float32Array(z), P && N.byteArray.fill(1, 0, z);
break;
- case Qn:
+ case Gn:
N.byteArray = new Uint16Array(z), P && N.byteArray.fill(15360, 0, z);
break;
default:
@@ -33088,15 +33088,15 @@ class fR extends yw {
let j = 0;
for (const X of b.channels)
N.decodeChannels[X.name] !== void 0 && (N.channelByteOffsets[X.name] = j), j += X.pixelType * 2;
- if (N.totalBytes = j, N.outLineWidth = N.width * N.outputChannels, b.lineOrder === "INCREASING_Y" ? N.scanOrder = (X) => X : N.scanOrder = (X) => N.height - 1 - X, N.outputChannels == 4 ? (N.format = pn, N.colorSpace = An) : (N.format = cs, N.colorSpace = vi), b.spec.singleTile) {
+ if (N.totalBytes = j, N.outLineWidth = N.width * N.outputChannels, b.lineOrder === "INCREASING_Y" ? N.scanOrder = (X) => X : N.scanOrder = (X) => N.height - 1 - X, N.outputChannels == 4 ? (N.format = pn, N.colorSpace = An) : (N.format = cs, N.colorSpace = Ci), b.spec.singleTile) {
N.blockHeight = b.tiles.ySize, N.blockWidth = b.tiles.xSize;
- const X = $a(b.tiles, N.width, N.height), ie = eo(X, N.width, b.tiles.xSize, b.tiles.roundingMode), he = eo(X, N.height, b.tiles.ySize, b.tiles.roundingMode);
+ const X = eo(b.tiles, N.width, N.height), ie = to(X, N.width, b.tiles.xSize, b.tiles.roundingMode), he = to(X, N.height, b.tiles.ySize, b.tiles.roundingMode);
N.tileCount = ie[0] * he[0];
for (let ce = 0; ce < X; ce++)
for (let fe = 0; fe < he[ce]; fe++)
for (let Ae = 0; Ae < ie[ce]; Ae++)
Ke(B, y);
- N.decode = vc.bind(N);
+ N.decode = Cc.bind(N);
} else {
N.blockWidth = N.width;
const X = Math.ceil(N.height / N.blockHeight);
@@ -33106,9 +33106,9 @@ class fR extends yw {
}
return N;
}
- const to = { value: 0 }, no = new DataView(e), Uh = new Uint8Array(e), qi = Cc(no, e, to), ws = Wr(qi, no, Uh, to, this.type);
+ const no = { value: 0 }, io = new DataView(e), Qh = new Uint8Array(e), Ki = Ic(io, e, no), ws = Wr(Ki, io, Qh, no, this.type);
return ws.decode(), {
- header: qi,
+ header: Ki,
width: ws.width,
height: ws.height,
data: ws.byteArray,
@@ -33133,10 +33133,10 @@ class fR extends yw {
return super.load(e, r, n, s);
}
}
-function pR(i, e) {
+function AR(i, e) {
const { id: t, path: n } = e;
return t === "neutral" ? Promise.resolve({ envMap: i.neutralEnvironment }) : t === "" ? Promise.resolve({ envMap: null }) : new Promise((s, r) => {
- new fR().load(
+ new pR().load(
n,
(a) => {
const o = i.pmremGenerator.fromEquirectangular(a).texture;
@@ -33147,26 +33147,26 @@ function pR(i, e) {
);
});
}
-function AR(i) {
+function gR(i) {
i.renderer.render(i.scene, i.activeCamera), i.renderer.domElement.toBlob((e) => {
if (!e) return;
const t = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), n = URL.createObjectURL(e), s = document.createElement("a");
s.download = `3d-screenshot-${t}.png`, s.href = n, s.click(), URL.revokeObjectURL(n);
- }, "image/png"), gR(i);
+ }, "image/png"), mR(i);
}
-function gR(i) {
+function mR(i) {
const e = document.createElement("div");
e.className = "screenshot-flash", i.el.appendChild(e), e.addEventListener("animationend", () => e.remove());
}
-function mR(i, e) {
- i.mixer && (i.mixer.stopAllAction(), i.mixer.uncacheRoot(i.mixer.getRoot()), i.mixer = null), i.clips = e, e.length && (i.mixer = new X0(i.content));
+function xR(i, e) {
+ i.mixer && (i.mixer.stopAllAction(), i.mixer.uncacheRoot(i.mixer.getRoot()), i.mixer = null), i.clips = e, e.length && (i.mixer = new Y0(i.content));
}
-function xR(i) {
+function bR(i) {
i.clips.forEach((e) => {
i.mixer.clipAction(e).reset().play(), i.state.actionStates[e.name] = !0;
}), i.invalidate();
}
-function $x(i, e, t) {
+function eb(i, e, t) {
const n = t.length - i - 1;
if (e >= t[n])
return n - 1;
@@ -33177,7 +33177,7 @@ function $x(i, e, t) {
e < t[a] ? r = a : s = a, a = Math.floor((s + r) / 2);
return a;
}
-function bR(i, e, t, n) {
+function ER(i, e, t, n) {
const s = [], r = [], a = [];
s[0] = 1;
for (let o = 1; o <= t; ++o) {
@@ -33191,15 +33191,15 @@ function bR(i, e, t, n) {
}
return s;
}
-function ER(i, e, t, n) {
- const s = $x(i, n, e), r = bR(s, n, i, e), a = new mt(0, 0, 0, 0);
+function yR(i, e, t, n) {
+ const s = eb(i, n, e), r = ER(s, n, i, e), a = new mt(0, 0, 0, 0);
for (let o = 0; o <= i; ++o) {
const c = t[s - i + o], l = r[o], h = c.w * l;
a.x += c.x * h, a.y += c.y * h, a.z += c.z * h, a.w += c.w * l;
}
return a;
}
-function yR(i, e, t, n, s) {
+function _R(i, e, t, n, s) {
const r = [];
for (let u = 0; u <= t; ++u)
r[u] = 0;
@@ -33250,8 +33250,8 @@ function yR(i, e, t, n, s) {
}
return a;
}
-function _R(i, e, t, n, s) {
- const r = s < i ? s : i, a = [], o = $x(i, n, e), c = yR(o, n, i, r, e), l = [];
+function wR(i, e, t, n, s) {
+ const r = s < i ? s : i, a = [], o = eb(i, n, e), c = _R(o, n, i, r, e), l = [];
for (let h = 0; h < t.length; ++h) {
const u = t[h].clone(), d = u.w;
u.x *= d, u.y *= d, u.z *= d, l[h] = u;
@@ -33266,7 +33266,7 @@ function _R(i, e, t, n, s) {
a[h] = new mt(0, 0, 0);
return a;
}
-function wR(i, e) {
+function vR(i, e) {
let t = 1;
for (let s = 2; s <= i; ++s)
t *= s;
@@ -33277,7 +33277,7 @@ function wR(i, e) {
n *= s;
return t / n;
}
-function vR(i) {
+function CR(i) {
const e = i.length, t = [], n = [];
for (let r = 0; r < e; ++r) {
const a = i[r];
@@ -33287,16 +33287,16 @@ function vR(i) {
for (let r = 0; r < e; ++r) {
const a = t[r].clone();
for (let o = 1; o <= r; ++o)
- a.sub(s[r - o].clone().multiplyScalar(wR(r, o) * n[o]));
+ a.sub(s[r - o].clone().multiplyScalar(vR(r, o) * n[o]));
s[r] = a.divideScalar(n[0]);
}
return s;
}
-function CR(i, e, t, n, s) {
- const r = _R(i, e, t, n, s);
- return vR(r);
+function IR(i, e, t, n, s) {
+ const r = wR(i, e, t, n, s);
+ return CR(r);
}
-class IR extends z_ {
+class SR extends V_ {
/**
* Constructs a new NURBS curve.
*
@@ -33323,7 +33323,7 @@ class IR extends z_ {
* @return {Vector3} The position on the curve.
*/
getPoint(e, t = new G()) {
- const n = t, s = this.knots[this.startKnot] + e * (this.knots[this.endKnot] - this.knots[this.startKnot]), r = ER(this.degree, this.knots, this.controlPoints, s);
+ const n = t, s = this.knots[this.startKnot] + e * (this.knots[this.endKnot] - this.knots[this.startKnot]), r = yR(this.degree, this.knots, this.controlPoints, s);
return r.w !== 1 && r.divideScalar(r.w), n.set(r.x, r.y, r.z);
}
/**
@@ -33334,7 +33334,7 @@ class IR extends z_ {
* @return {Vector3} The tangent vector.
*/
getTangent(e, t = new G()) {
- const n = t, s = this.knots[0] + e * (this.knots[this.knots.length - 1] - this.knots[0]), r = CR(this.degree, this.knots, this.controlPoints, s, 1);
+ const n = t, s = this.knots[0] + e * (this.knots[this.knots.length - 1] - this.knots[0]), r = IR(this.degree, this.knots, this.controlPoints, s, 1);
return n.copy(r[1]).normalize(), n;
}
toJSON() {
@@ -33345,8 +33345,8 @@ class IR extends z_ {
return super.fromJSON(e), this.degree = e.degree, this.knots = [...e.knots], this.controlPoints = e.controlPoints.map((t) => new mt(t[0], t[1], t[2], t[3])), this.startKnot = e.startKnot, this.endKnot = e.endKnot, this;
}
}
-let ut, Yt, kn;
-class SR extends fi {
+let ut, Yt, Un;
+class MR extends pi {
/**
* Constructs a new FBX loader.
*
@@ -33382,28 +33382,28 @@ class SR extends fi {
* @return {Group} An object representing the parsed asset.
*/
parse(e, t) {
- if (NR(e))
- ut = new FR().parse(e);
+ if (DR(e))
+ ut = new NR().parse(e);
else {
- const s = nb(e);
- if (!DR(s))
+ const s = ib(e);
+ if (!LR(s))
throw new Error("THREE.FBXLoader: Unknown format.");
- if (jg(s) < 7e3)
- throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + jg(s));
- ut = new RR().parse(s);
+ if (Yg(s) < 7e3)
+ throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + Yg(s));
+ ut = new FR().parse(s);
}
- const n = new q0(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
- return new MR(n, this.manager).parse(ut);
+ const n = new K0(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
+ return new BR(n, this.manager).parse(ut);
}
}
-class MR {
+class BR {
constructor(e, t) {
this.textureLoader = e, this.manager = t;
}
parse() {
Yt = this.parseConnections();
- const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), s = this.parseDeformers(), r = new BR().parse(s);
- return this.parseScene(s, r, n), kn;
+ const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), s = this.parseDeformers(), r = new TR().parse(s);
+ return this.parseScene(s, r, n), Un;
}
// Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
// and details the connection type
@@ -33499,7 +33499,7 @@ class MR {
const n = this.loadTexture(e, t);
n.ID = e.id, n.name = e.attrName;
const s = e.WrapModeU, r = e.WrapModeV, a = s !== void 0 ? s.value : 0, o = r !== void 0 ? r.value : 0;
- if (n.wrapS = a === 0 ? Ws : ti, n.wrapT = o === 0 ? Ws : ti, "Scaling" in e) {
+ if (n.wrapS = a === 0 ? Ws : ni, n.wrapT = o === 0 ? Ws : ni, "Scaling" in e) {
const c = e.Scaling.value;
n.repeat.x = c[0], n.repeat.y = c[1];
}
@@ -33548,13 +33548,13 @@ class MR {
let o;
switch (r.toLowerCase()) {
case "phong":
- o = new Jc();
+ o = new Zc();
break;
case "lambert":
- o = new cw();
+ o = new lw();
break;
default:
- console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', r), o = new Jc();
+ console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', r), o = new Zc();
break;
}
return o.setValues(a), o.name = s, o;
@@ -33589,7 +33589,7 @@ class MR {
s.normalMap = r.getTexture(t, a.ID);
break;
case "ReflectionColor":
- s.envMap = r.getTexture(t, a.ID), s.envMap !== void 0 && (s.envMap.mapping = Dl, s.envMap.colorSpace = _t);
+ s.envMap = r.getTexture(t, a.ID), s.envMap !== void 0 && (s.envMap.mapping = Pl, s.envMap.colorSpace = _t);
break;
case "SpecularColor":
s.specularMap = r.getTexture(t, a.ID), s.specularMap !== void 0 && (s.specularMap.colorSpace = _t);
@@ -33675,23 +33675,23 @@ class MR {
}
// create the main Group() to be returned by the loader
parseScene(e, t, n) {
- kn = new hs();
+ Un = new hs();
const s = this.parseModels(e.skeletons, t, n), r = ut.Objects.Model, a = this;
s.forEach(function(c) {
const l = r[c.ID];
a.setLookAtProperties(c, l), Yt.get(c.ID).parents.forEach(function(u) {
const d = s.get(u.ID);
d !== void 0 && d.add(c);
- }), c.parent === null && kn.add(c);
- }), this.bindSkeleton(e.skeletons, t, s), this.addGlobalSceneSettings(), kn.traverse(function(c) {
+ }), c.parent === null && Un.add(c);
+ }), this.bindSkeleton(e.skeletons, t, s), this.addGlobalSceneSettings(), Un.traverse(function(c) {
if (c.userData.transformData) {
c.parent && (c.userData.transformData.parentMatrix = c.parent.matrix, c.userData.transformData.parentMatrixWorld = c.parent.matrixWorld);
- const l = tb(c.userData.transformData);
+ const l = nb(c.userData.transformData);
c.applyMatrix4(l), c.updateWorldMatrix();
}
});
- const o = new TR().parse();
- kn.children.length === 1 && kn.children[0].isGroup && (kn.children[0].animations = o, kn = kn.children[0]), kn.animations = o;
+ const o = new RR().parse();
+ Un.children.length === 1 && Un.children[0].isGroup && (Un.children[0].animations = o, Un = Un.children[0]), Un.animations = o;
}
// parse nodes in FBXTree.Objects.Model
parseModels(e, t, n) {
@@ -33715,7 +33715,7 @@ class MR {
break;
case "LimbNode":
case "Root":
- h = new Wl();
+ h = new Kl();
break;
default:
h = new hs();
@@ -33735,7 +33735,7 @@ class MR {
c.rawBones.forEach(function(l, h) {
if (l.ID === a.ID) {
const u = r;
- r = new Wl(), r.matrixWorld.copy(l.transformLink), r.name = s ? yt.sanitizeNodeName(s) : "", r.userData.originalName = s, r.ID = n, c.bones[h] = r, u !== null && r.add(u);
+ r = new Kl(), r.matrixWorld.copy(l.transformLink), r.name = s ? yt.sanitizeNodeName(s) : "", r.userData.originalName = s, r.ID = n, c.bones[h] = r, u !== null && r.add(u);
}
});
}
@@ -33796,19 +33796,19 @@ class MR {
const c = 1;
switch (s) {
case 0:
- t = new Xl(r, a, o, c);
+ t = new Jl(r, a, o, c);
break;
case 1:
- t = new Jf(r, a);
+ t = new $f(r, a);
break;
case 2:
let l = Math.PI / 3;
n.InnerAngle !== void 0 && (l = Cn.degToRad(n.InnerAngle.value));
let h = 0;
- n.OuterAngle !== void 0 && (h = Cn.degToRad(n.OuterAngle.value), h = Math.max(h, 1)), t = new K0(r, a, o, l, h, c);
+ n.OuterAngle !== void 0 && (h = Cn.degToRad(n.OuterAngle.value), h = Math.max(h, 1)), t = new j0(r, a, o, l, h, c);
break;
default:
- console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new Xl(r, a);
+ console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new Jl(r, a);
break;
}
n.CastShadows !== void 0 && n.CastShadows.value === 1 && (t.castShadow = !0);
@@ -33820,8 +33820,8 @@ class MR {
const o = [];
if (e.children.forEach(function(c) {
t.has(c.ID) && (r = t.get(c.ID)), n.has(c.ID) && o.push(n.get(c.ID));
- }), o.length > 1 ? a = o : o.length > 0 ? a = o[0] : (a = new Jc({
- name: fi.DEFAULT_MATERIAL_NAME,
+ }), o.length > 1 ? a = o : o.length > 0 ? a = o[0] : (a = new Zc({
+ name: pi.DEFAULT_MATERIAL_NAME,
color: 13421772
}), o.push(a)), "color" in r.attributes && o.forEach(function(c) {
c.vertexColors = !0;
@@ -33832,26 +33832,26 @@ class MR {
(u.materialIndex < 0 || u.materialIndex >= o.length) && (u.materialIndex = o.length, c = !0);
}
if (c) {
- const l = new Jc();
+ const l = new Zc();
o.push(l);
}
}
- return r.FBX_Deformer ? (s = new L0(r, a), s.normalizeSkinWeights()) : s = new Zt(r, a), s;
+ return r.FBX_Deformer ? (s = new P0(r, a), s.normalizeSkinWeights()) : s = new Zt(r, a), s;
}
createCurve(e, t) {
const n = e.children.reduce(function(r, a) {
return t.has(a.ID) && (r = t.get(a.ID)), r;
- }, null), s = new qa({
- name: fi.DEFAULT_MATERIAL_NAME,
+ }, null), s = new Ka({
+ name: pi.DEFAULT_MATERIAL_NAME,
color: 3342591,
linewidth: 1
});
- return new Ah(n, s);
+ return new mh(n, s);
}
// parse the model node for transform data
getTransformData(e, t) {
const n = {};
- "InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder = ec(t.RotationOrder.value) : n.eulerOrder = ec(0), "Lcl_Translation" in t && (n.translation = t.Lcl_Translation.value), "PreRotation" in t && (n.preRotation = t.PreRotation.value), "Lcl_Rotation" in t && (n.rotation = t.Lcl_Rotation.value), "PostRotation" in t && (n.postRotation = t.PostRotation.value), "Lcl_Scaling" in t && (n.scale = t.Lcl_Scaling.value), "ScalingOffset" in t && (n.scalingOffset = t.ScalingOffset.value), "ScalingPivot" in t && (n.scalingPivot = t.ScalingPivot.value), "RotationOffset" in t && (n.rotationOffset = t.RotationOffset.value), "RotationPivot" in t && (n.rotationPivot = t.RotationPivot.value), e.userData.transformData = n;
+ "InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder = tc(t.RotationOrder.value) : n.eulerOrder = tc(0), "Lcl_Translation" in t && (n.translation = t.Lcl_Translation.value), "PreRotation" in t && (n.preRotation = t.PreRotation.value), "Lcl_Rotation" in t && (n.rotation = t.Lcl_Rotation.value), "PostRotation" in t && (n.postRotation = t.PostRotation.value), "Lcl_Scaling" in t && (n.scale = t.Lcl_Scaling.value), "ScalingOffset" in t && (n.scalingOffset = t.ScalingOffset.value), "ScalingPivot" in t && (n.scalingPivot = t.ScalingPivot.value), "RotationOffset" in t && (n.rotationOffset = t.RotationOffset.value), "RotationPivot" in t && (n.rotationPivot = t.RotationPivot.value), e.userData.transformData = n;
}
setLookAtProperties(e, t) {
"LookAtProperty" in t && Yt.get(e.ID).children.forEach(function(s) {
@@ -33859,7 +33859,7 @@ class MR {
const r = ut.Objects.Model[s.ID];
if ("Lcl_Translation" in r) {
const a = r.Lcl_Translation.value;
- e.target !== void 0 ? (e.target.position.fromArray(a), kn.add(e.target)) : e.lookAt(new G().fromArray(a));
+ e.target !== void 0 ? (e.target.position.fromArray(a), Un.add(e.target)) : e.lookAt(new G().fromArray(a));
}
}
});
@@ -33872,7 +33872,7 @@ class MR {
if (t.has(c.ID)) {
const l = c.ID;
Yt.get(l).parents.forEach(function(u) {
- n.has(u.ID) && n.get(u.ID).bind(new ph(a.bones), s[u.ID]);
+ n.has(u.ID) && n.get(u.ID).bind(new gh(a.bones), s[u.ID]);
});
}
});
@@ -33898,14 +33898,14 @@ class MR {
const e = ut.GlobalSettings.AmbientColor.value, t = e[0], n = e[1], s = e[2];
if (t !== 0 || n !== 0 || s !== 0) {
const r = new Le().setRGB(t, n, s, _t);
- kn.add(new j0(r, 1));
+ Un.add(new X0(r, 1));
}
}
- "UnitScaleFactor" in ut.GlobalSettings && (kn.userData.unitScaleFactor = ut.GlobalSettings.UnitScaleFactor.value);
+ "UnitScaleFactor" in ut.GlobalSettings && (Un.userData.unitScaleFactor = ut.GlobalSettings.UnitScaleFactor.value);
}
}
}
-class BR {
+class TR {
constructor() {
this.negativeMaterialIndices = !1;
}
@@ -33943,8 +33943,8 @@ class BR {
n.morphTargets[u.ID] !== void 0 && r.push(n.morphTargets[u.ID]);
});
const c = a[0], l = {};
- "RotationOrder" in c && (l.eulerOrder = ec(c.RotationOrder.value)), "InheritType" in c && (l.inheritType = parseInt(c.InheritType.value)), "GeometricTranslation" in c && (l.translation = c.GeometricTranslation.value), "GeometricRotation" in c && (l.rotation = c.GeometricRotation.value), "GeometricScaling" in c && (l.scale = c.GeometricScaling.value);
- const h = tb(l);
+ "RotationOrder" in c && (l.eulerOrder = tc(c.RotationOrder.value)), "InheritType" in c && (l.inheritType = parseInt(c.InheritType.value)), "GeometricTranslation" in c && (l.translation = c.GeometricTranslation.value), "GeometricRotation" in c && (l.rotation = c.GeometricRotation.value), "GeometricScaling" in c && (l.scale = c.GeometricScaling.value);
+ const h = nb(l);
return this.genGeometry(t, o, r, h);
}
// Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
@@ -33952,7 +33952,7 @@ class BR {
const r = new Tn();
e.attrName && (r.name = e.attrName);
const a = this.parseGeoNode(e, t), o = this.genBuffers(a), c = new en(o.vertex, 3);
- if (c.applyMatrix4(s), r.setAttribute("position", c), o.colors.length > 0 && r.setAttribute("color", new en(o.colors, 3)), t && (r.setAttribute("skinIndex", new Vf(o.weightsIndices, 4)), r.setAttribute("skinWeight", new en(o.vertexWeights, 4)), r.FBX_Deformer = t), o.normal.length > 0) {
+ if (c.applyMatrix4(s), r.setAttribute("position", c), o.colors.length > 0 && r.setAttribute("color", new en(o.colors, 3)), t && (r.setAttribute("skinIndex", new qf(o.weightsIndices, 4)), r.setAttribute("skinWeight", new en(o.vertexWeights, 4)), r.FBX_Deformer = t), o.normal.length > 0) {
const l = new at().getNormalMatrix(s), h = new en(o.normal, 3);
h.applyNormalMatrix(l), r.setAttribute("normal", h);
}
@@ -34005,7 +34005,7 @@ class BR {
f < 0 && (f = f ^ -1, g = !0);
let A = [], _ = [];
if (a.push(f * 3, f * 3 + 1, f * 3 + 2), e.color) {
- const x = fl(p, n, f, e.color);
+ const x = pl(p, n, f, e.color);
c.push(x[0], x[1], x[2]);
}
if (e.skeleton) {
@@ -34031,11 +34031,11 @@ class BR {
h.push(_[x]), u.push(A[x]);
}
if (e.normal) {
- const x = fl(p, n, f, e.normal);
+ const x = pl(p, n, f, e.normal);
o.push(x[0], x[1], x[2]);
}
- e.material && e.material.mappingType !== "AllSame" && (m = fl(p, n, f, e.material)[0], m < 0 && (d.negativeMaterialIndices = !0, m = 0)), e.uv && e.uv.forEach(function(x, E) {
- const S = fl(p, n, f, x);
+ e.material && e.material.mappingType !== "AllSame" && (m = pl(p, n, f, e.material)[0], m < 0 && (d.negativeMaterialIndices = !0, m = 0)), e.uv && e.uv.forEach(function(x, E) {
+ const S = pl(p, n, f, x);
l[E] === void 0 && (l[E] = []), l[E].push(S[0]), l[E].push(S[1]);
}), s++, g && (d.genFace(t, e, a, m, o, c, l, h, u, s), n++, s = 0, a = [], o = [], c = [], l = [], h = [], u = []);
}), t;
@@ -34079,7 +34079,7 @@ class BR {
const { tangent: p, bitangent: m } = this.getNormalTangentAndBitangent(d), g = [];
for (const A of d)
g.push(this.flattenVertex(A, p, m));
- u = jf.triangulateShape(g, []);
+ u = Yf.triangulateShape(g, []);
} else
u = [[0, 1, 2]];
for (const [d, f, p] of u)
@@ -34192,11 +34192,11 @@ class BR {
for (let u = 0; u < n; ++u)
r.push(r[u]);
}
- const h = new IR(n, s, r, o, c).getPoints(r.length * 12);
+ const h = new SR(n, s, r, o, c).getPoints(r.length * 12);
return new Tn().setFromPoints(h);
}
}
-class TR {
+class RR {
// take raw animation clips and turn them into three.js animation clips
parse() {
const e = [], t = this.parseClips();
@@ -34240,7 +34240,7 @@ class TR {
for (const n in t) {
const s = {
id: t[n].id,
- times: t[n].KeyTime.a.map(LR),
+ times: t[n].KeyTime.a.map(PR),
values: t[n].KeyValueFloat.a
}, r = Yt.get(s.id);
if (r !== void 0) {
@@ -34277,7 +34277,7 @@ class TR {
initialRotation: [0, 0, 0],
initialScale: [1, 1, 1]
};
- kn.traverse(function(p) {
+ Un.traverse(function(p) {
p.ID === d.id && (f.transform = p.matrix, p.userData.transformData && (f.eulerOrder = p.userData.transformData.eulerOrder));
}), f.transform || (f.transform = new Ne()), "PreRotation" in d && (f.preRotation = d.PreRotation.value), "PostRotation" in d && (f.postRotation = d.PostRotation.value), r[l] = f;
}
@@ -34320,7 +34320,7 @@ class TR {
const n = this;
return e.layer.forEach(function(s) {
t = t.concat(n.generateTracks(s));
- }), new jl(e.name, -1, t);
+ }), new Yl(e.name, -1, t);
}
generateTracks(e) {
const t = [];
@@ -34353,7 +34353,7 @@ class TR {
const d = this.interpolateRotations(t.x, t.y, t.z, r);
a = d[0], o = d[1];
}
- const c = ec(0);
+ const c = tc(0);
n !== void 0 && (n = n.map(Cn.degToRad), n.push(c), n = new dn().fromArray(n), n = new Jt().setFromEuler(n)), s !== void 0 && (s = s.map(Cn.degToRad), s.push(c), s = new dn().fromArray(s), s = new Jt().setFromEuler(s).invert());
const l = new Jt(), h = new dn(), u = [];
if (!o || !a) return new Ks(e + ".quaternion", [0], [0]);
@@ -34367,7 +34367,7 @@ class TR {
generateMorphTrack(e) {
const t = e.DeformPercent.curves.morph, n = t.values.map(function(r) {
return r / 100;
- }), s = kn.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];
+ }), s = Un.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];
return new Nr(e.modelName + ".morphTargetInfluences[" + s + "]", t.times, n);
}
// For all animated objects, times are defined separately for each axis
@@ -34449,7 +34449,7 @@ class TR {
return [r, a];
}
}
-class RR {
+class FR {
getPrevNode() {
return this.nodeStack[this.currentIndent - 2];
}
@@ -34469,7 +34469,7 @@ class RR {
this.currentProp = e, this.currentPropName = t;
}
parse(e) {
- this.currentIndent = 0, this.allNodes = new eb(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
+ this.currentIndent = 0, this.allNodes = new tb(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
const t = this, n = e.split(/[\r\n]+/);
return n.forEach(function(s, r) {
const a = s.match(/^[\s\t]*;/), o = s.match(/^[\s\t]*$/);
@@ -34503,13 +34503,13 @@ class RR {
let u = r.split(",").slice(3);
u = u.map(function(d) {
return d.trim().replace(/^"/, "");
- }), s = "connections", r = [l, h], kR(r, u), a[s] === void 0 && (a[s] = []);
+ }), s = "connections", r = [l, h], UR(r, u), a[s] === void 0 && (a[s] = []);
}
- s === "Node" && (a.id = r), s in a && Array.isArray(a[s]) ? a[s].push(r) : s !== "a" ? a[s] = r : a.a = r, this.setCurrentProp(a, s), s === "a" && r.slice(-1) !== "," && (a.a = Vu(r));
+ s === "Node" && (a.id = r), s in a && Array.isArray(a[s]) ? a[s].push(r) : s !== "a" ? a[s] = r : a.a = r, this.setCurrentProp(a, s), s === "a" && r.slice(-1) !== "," && (a.a = qu(r));
}
parseNodePropertyContinued(e) {
const t = this.getCurrentNode();
- t.a += e, e.slice(-1) !== "," && (t.a = Vu(t.a));
+ t.a += e, e.slice(-1) !== "," && (t.a = qu(t.a));
}
// parse "Property70"
parseNodeSpecialProperty(e, t, n) {
@@ -34533,7 +34533,7 @@ class RR {
case "Lcl_Translation":
case "Lcl_Rotation":
case "Lcl_Scaling":
- l = Vu(l);
+ l = qu(l);
break;
}
this.getPrevNode()[r] = {
@@ -34544,14 +34544,14 @@ class RR {
}, this.setCurrentProp(this.getPrevNode(), r);
}
}
-class FR {
+class NR {
parse(e) {
- const t = new Kg(e);
+ const t = new Xg(e);
t.skip(23);
const n = t.getUint32();
if (n < 6400)
throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + n);
- const s = new eb();
+ const s = new tb();
for (; !this.endOfContent(t); ) {
const r = this.parseNode(t, n);
r !== null && s.add(r.name, r);
@@ -34648,7 +34648,7 @@ class FR {
case "l":
return e.getInt64Array(s);
}
- const o = Co(new Uint8Array(e.getArrayBuffer(a))), c = new Kg(o.buffer);
+ const o = Io(new Uint8Array(e.getArrayBuffer(a))), c = new Xg(o.buffer);
switch (t) {
case "b":
case "c":
@@ -34669,7 +34669,7 @@ class FR {
}
}
}
-class Kg {
+class Xg {
constructor(e, t) {
this.dv = new DataView(e), this.offset = 0, this.littleEndian = t !== void 0 ? t : !0, this._textDecoder = new TextDecoder();
}
@@ -34768,16 +34768,16 @@ class Kg {
return s >= 0 && (n = new Uint8Array(this.dv.buffer, t, s)), this._textDecoder.decode(n);
}
}
-class eb {
+class tb {
add(e, t) {
this[e] = t;
}
}
-function NR(i) {
+function DR(i) {
const e = "Kaydara FBX Binary \0";
- return i.byteLength >= e.length && e === nb(i, 0, e.length);
+ return i.byteLength >= e.length && e === ib(i, 0, e.length);
}
-function DR(i) {
+function LR(i) {
const e = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
let t = 0;
function n(s) {
@@ -34789,17 +34789,17 @@ function DR(i) {
return !1;
return !0;
}
-function jg(i) {
+function Yg(i) {
const e = /FBXVersion: (\d+)/, t = i.match(e);
if (t)
return parseInt(t[1]);
throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
}
-function LR(i) {
+function PR(i) {
return i / 46186158e3;
}
-const PR = [];
-function fl(i, e, t, n) {
+const kR = [];
+function pl(i, e, t, n) {
let s;
switch (n.mappingType) {
case "ByPolygonVertex":
@@ -34819,24 +34819,24 @@ function fl(i, e, t, n) {
}
n.referenceType === "IndexToDirect" && (s = n.indices[s]);
const r = s * n.dataSize, a = r + n.dataSize;
- return UR(PR, n.buffer, r, a);
+ return OR(kR, n.buffer, r, a);
}
-const zu = new dn(), ha = new G();
-function tb(i) {
+const Wu = new dn(), ha = new G();
+function nb(i) {
const e = new Ne(), t = new Ne(), n = new Ne(), s = new Ne(), r = new Ne(), a = new Ne(), o = new Ne(), c = new Ne(), l = new Ne(), h = new Ne(), u = new Ne(), d = new Ne(), f = i.inheritType ? i.inheritType : 0;
i.translation && e.setPosition(ha.fromArray(i.translation));
- const p = ec(0);
+ const p = tc(0);
if (i.preRotation) {
const F = i.preRotation.map(Cn.degToRad);
- F.push(p), t.makeRotationFromEuler(zu.fromArray(F));
+ F.push(p), t.makeRotationFromEuler(Wu.fromArray(F));
}
if (i.rotation) {
const F = i.rotation.map(Cn.degToRad);
- F.push(i.eulerOrder || p), n.makeRotationFromEuler(zu.fromArray(F));
+ F.push(i.eulerOrder || p), n.makeRotationFromEuler(Wu.fromArray(F));
}
if (i.postRotation) {
const F = i.postRotation.map(Cn.degToRad);
- F.push(p), s.makeRotationFromEuler(zu.fromArray(F)), s.invert();
+ F.push(p), s.makeRotationFromEuler(Wu.fromArray(F)), s.invert();
}
i.scale && r.scale(ha.fromArray(i.scale)), i.scalingOffset && o.setPosition(ha.fromArray(i.scalingOffset)), i.scalingPivot && a.setPosition(ha.fromArray(i.scalingPivot)), i.rotationOffset && c.setPosition(ha.fromArray(i.rotationOffset)), i.rotationPivot && l.setPosition(ha.fromArray(i.rotationPivot)), i.parentMatrixWorld && (u.copy(i.parentMatrix), h.copy(i.parentMatrixWorld));
const m = t.clone().multiply(n).multiply(s), g = new Ne();
@@ -34857,7 +34857,7 @@ function tb(i) {
const C = new Ne().copyPosition(T), v = h.clone().multiply(C);
return d.copyPosition(v), T = d.clone().multiply(S), T.premultiply(h.invert()), T;
}
-function ec(i) {
+function tc(i) {
i = i || 0;
const e = [
"ZYX",
@@ -34876,27 +34876,27 @@ function ec(i) {
];
return i === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), e[0]) : e[i];
}
-function Vu(i) {
+function qu(i) {
return i.split(",").map(function(t) {
return parseFloat(t);
});
}
-function nb(i, e, t) {
+function ib(i, e, t) {
return e === void 0 && (e = 0), t === void 0 && (t = i.byteLength), new TextDecoder().decode(new Uint8Array(i, e, t));
}
-function kR(i, e) {
+function UR(i, e) {
for (let t = 0, n = i.length, s = e.length; t < s; t++, n++)
i[n] = e[t];
}
-function UR(i, e, t, n) {
+function OR(i, e, t, n) {
for (let s = t, r = 0; s < n; s++, r++)
i[r] = e[s];
return i;
}
-const OR = 0.35;
-class QR {
+const QR = 0.35;
+class GR {
constructor() {
- this.model = null, this.mixer = null, this.clips = /* @__PURE__ */ new Map(), this.actions = /* @__PURE__ */ new Map(), this.currentName = null, this.currentAction = null, this.loader = new tp(), this.fbxLoader = new SR(), this.onChange = null, this._gltfCache = /* @__PURE__ */ new Map(), this._animationDefs = [];
+ this.model = null, this.mixer = null, this.clips = /* @__PURE__ */ new Map(), this.actions = /* @__PURE__ */ new Map(), this.currentName = null, this.currentAction = null, this.loader = new ip(), this.fbxLoader = new MR(), this.onChange = null, this._gltfCache = /* @__PURE__ */ new Map(), this._animationDefs = [];
}
/**
* Attach the manager to a loaded model. Creates a new mixer.
@@ -34904,7 +34904,7 @@ class QR {
* @param {THREE.Object3D} model
*/
attach(e) {
- this.detach(), this.model = e, this.mixer = new X0(e), this.actions.clear(), this.currentAction = null, this.currentName = null;
+ this.detach(), this.model = e, this.mixer = new Y0(e), this.actions.clear(), this.currentAction = null, this.currentName = null;
for (const [t, n] of this.clips) {
const s = this._retargetClip(n, t), r = this.mixer.clipAction(s);
r.enabled = !0, this.actions.set(t, r);
@@ -34957,7 +34957,7 @@ class QR {
throw new Error(`No animation found in ${t}`);
if (r = r.clone(), r.name = e, this.clips.set(e, r), this.model && this.mixer) {
const a = this._retargetClip(r, e), o = this.mixer.clipAction(a);
- o.enabled = !0, o.setLoop(n.loop === !1 ? _0 : w0), n.loop === !1 && (o.clampWhenFinished = !0), this.actions.set(e, o);
+ o.enabled = !0, o.setLoop(n.loop === !1 ? w0 : v0), n.loop === !1 && (o.clampWhenFinished = !0), this.actions.set(e, o);
}
return r;
}
@@ -34996,7 +34996,7 @@ class QR {
* @param {string} name
* @param {number} [duration] - Crossfade duration in seconds
*/
- crossfadeTo(e, t = OR) {
+ crossfadeTo(e, t = QR) {
if (e === this.currentName) return;
const n = this.actions.get(e);
if (!n) {
@@ -35094,14 +35094,14 @@ class QR {
}
}
us.enabled = !0;
-class ib {
+class sb {
constructor(e, t) {
- this.el = e, this.options = t, this.lights = [], this.content = null, this.mixer = null, this.clips = [], this.gui = null, this.animationManager = new QR(), this._animPanelEl = null, this.state = {
- environment: t.preset === of.ASSET_GENERATOR ? al.find((r) => r.id === "footprint-court").name : al[1].name,
+ this.el = e, this.options = t, this.lights = [], this.content = null, this.mixer = null, this.clips = [], this.gui = null, this.animationManager = new GR(), this._animPanelEl = null, this.state = {
+ environment: t.preset === lf.ASSET_GENERATOR ? ol.find((r) => r.id === "footprint-court").name : ol[1].name,
background: !1,
playbackSpeed: 1,
actionStates: {},
- camera: dl,
+ camera: fl,
wireframe: !1,
skeleton: !1,
grid: !1,
@@ -35109,7 +35109,7 @@ class ib {
// Lights
punctualLights: !0,
exposure: 0,
- toneMapping: xd,
+ toneMapping: Ed,
ambientIntensity: 0.3,
ambientColor: "#FFFFFF",
directIntensity: 0.8 * Math.PI,
@@ -35123,9 +35123,9 @@ class ib {
showLabels: !1,
// Avatar follow mode
followMode: "mouse"
- }, this.prevTime = 0, this.stats = new Do(), this.stats.dom.height = "48px", [].forEach.call(this.stats.dom.children, (r) => r.style.display = ""), this.backgroundColor = new Le(this.state.bgColor), this.scene = new Qd(), this.scene.background = this.backgroundColor;
- const n = t.preset === of.ASSET_GENERATOR ? 0.8 * 180 / Math.PI : 60, s = e.clientWidth / e.clientHeight;
- this.defaultCamera = new In(n, s, 0.01, 1e3), this.activeCamera = this.defaultCamera, this.scene.add(this.defaultCamera), this.renderer = window.renderer = new eg({ antialias: !0, alpha: !0 }), this.renderer.setClearColor(0, 1), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)), this.renderer.setSize(e.clientWidth, e.clientHeight), this.pmremGenerator = new Wd(this.renderer), this.pmremGenerator.compileEquirectangularShader(), this.neutralEnvironment = this.pmremGenerator.fromScene(new EM()).texture, this.controls = new oM(this.defaultCamera, this.renderer.domElement), this.controls.screenSpacePanning = !0, this._onControlsChange = () => this.invalidate(), this.controls.addEventListener("change", this._onControlsChange), this.el.appendChild(this.renderer.domElement), this.cameraCtrl = null, this.cameraFolder = null, this.animFolder = null, this.animCtrls = [], this.morphFolder = null, this.morphCtrls = [], this.skeletonHelpers = [], this.gridHelper = null, this.axesHelper = null, this.modelInfo = null, this.annotationEls = [], this._tempVec = new G(), this.addAxesHelper(), this.addGUI(), t.kiosk && this.gui.close(), this.animate = this.animate.bind(this), this._rafId = null, this._visible = !0, this._tabVisible = !document.hidden, this._disposed = !1, this._loadedEnvironment = null, this._guiWrap = null, this._needsRender = !0, this._animating = !1, this._onVisibilityChange = () => {
+ }, this.prevTime = 0, this.stats = new Lo(), this.stats.dom.height = "48px", [].forEach.call(this.stats.dom.children, (r) => r.style.display = ""), this.backgroundColor = new Le(this.state.bgColor), this.scene = new Hd(), this.scene.background = this.backgroundColor;
+ const n = t.preset === lf.ASSET_GENERATOR ? 0.8 * 180 / Math.PI : 60, s = e.clientWidth / e.clientHeight;
+ this.defaultCamera = new In(n, s, 0.01, 1e3), this.activeCamera = this.defaultCamera, this.scene.add(this.defaultCamera), this.renderer = window.renderer = new ng({ antialias: !0, alpha: !0 }), this.renderer.setClearColor(0, 1), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)), this.renderer.setSize(e.clientWidth, e.clientHeight), this.pmremGenerator = new Kd(this.renderer), this.pmremGenerator.compileEquirectangularShader(), this.neutralEnvironment = this.pmremGenerator.fromScene(new yM()).texture, this.controls = new cM(this.defaultCamera, this.renderer.domElement), this.controls.screenSpacePanning = !0, this._onControlsChange = () => this.invalidate(), this.controls.addEventListener("change", this._onControlsChange), this.el.appendChild(this.renderer.domElement), this.cameraCtrl = null, this.cameraFolder = null, this.animFolder = null, this.animCtrls = [], this.morphFolder = null, this.morphCtrls = [], this.skeletonHelpers = [], this.gridHelper = null, this.axesHelper = null, this.modelInfo = null, this.annotationEls = [], this._tempVec = new G(), this.addAxesHelper(), this.addGUI(), t.kiosk && this.gui.close(), this.animate = this.animate.bind(this), this._rafId = null, this._visible = !0, this._tabVisible = !document.hidden, this._disposed = !1, this._loadedEnvironment = null, this._guiWrap = null, this._needsRender = !0, this._animating = !1, this._onVisibilityChange = () => {
const r = !this._tabVisible;
this._tabVisible = !document.hidden, r && this._tabVisible && (this._needsRender = !0), this._updateRenderLoop();
}, document.addEventListener("visibilitychange", this._onVisibilityChange), typeof IntersectionObserver < "u" && (this._intersectionObserver = new IntersectionObserver(
@@ -35172,7 +35172,7 @@ class ib {
this.renderer.render(this.scene, this.activeCamera), this.state.grid && (this.axesCamera.position.copy(this.defaultCamera.position), this.axesCamera.lookAt(this.axesScene.position), this.axesRenderer.render(this.axesScene, this.axesCamera)), this.projectAnnotations();
}
takeScreenshot() {
- AR(this);
+ gR(this);
}
resize() {
const { clientHeight: e, clientWidth: t } = this.el;
@@ -35181,7 +35181,7 @@ class ib {
load(e, t, n) {
const s = Cr.extractUrlBase(e);
return new Promise((r, a) => {
- eh.setURLModifier((l, h) => {
+ nh.setURLModifier((l, h) => {
const u = t + decodeURI(l).replace(s, "").replace(/^(\.?\/)/, "");
if (n.has(u)) {
const d = n.get(u), f = URL.createObjectURL(d);
@@ -35189,7 +35189,7 @@ class ib {
}
return (h || "") + l;
});
- const o = new tp(eh).setCrossOrigin("anonymous").setDRACOLoader(jT).setKTX2Loader(XT.detectSupport(this.renderer)).setMeshoptDecoder(rM), c = [];
+ const o = new ip(nh).setCrossOrigin("anonymous").setDRACOLoader(XT).setKTX2Loader(YT.detectSupport(this.renderer)).setMeshoptDecoder(aM), c = [];
o.load(
e,
(l) => {
@@ -35212,46 +35212,46 @@ class ib {
*/
setContent(e, t) {
this.clear(), e.updateMatrixWorld();
- const n = new Hi().setFromObject(e), s = n.getSize(new G()).length(), r = n.getCenter(new G());
- this.controls.reset(), e.position.x -= r.x, e.position.y -= r.y, e.position.z -= r.z, this.controls.maxDistance = s * 10, this.defaultCamera.near = s / 100, this.defaultCamera.far = s * 100, this.defaultCamera.updateProjectionMatrix(), this.options.cameraPosition ? (this.defaultCamera.position.fromArray(this.options.cameraPosition), this.defaultCamera.lookAt(new G())) : (this.defaultCamera.position.copy(r), this.defaultCamera.position.x += s / 2, this.defaultCamera.position.y += s / 5, this.defaultCamera.position.z += s / 2, this.defaultCamera.lookAt(r)), this.setCamera(dl), this.axesCamera.position.copy(this.defaultCamera.position), this.axesCamera.lookAt(this.axesScene.position), this.axesCamera.near = s / 100, this.axesCamera.far = s * 100, this.axesCamera.updateProjectionMatrix(), this.axesCorner.scale.set(s, s, s), this.controls.saveState(), this.scene.add(e), this.content = e, this.state.punctualLights = !0, this.content.traverse((a) => {
+ const n = new zi().setFromObject(e), s = n.getSize(new G()).length(), r = n.getCenter(new G());
+ this.controls.reset(), e.position.x -= r.x, e.position.y -= r.y, e.position.z -= r.z, this.controls.maxDistance = s * 10, this.defaultCamera.near = s / 100, this.defaultCamera.far = s * 100, this.defaultCamera.updateProjectionMatrix(), this.options.cameraPosition ? (this.defaultCamera.position.fromArray(this.options.cameraPosition), this.defaultCamera.lookAt(new G())) : (this.defaultCamera.position.copy(r), this.defaultCamera.position.x += s / 2, this.defaultCamera.position.y += s / 5, this.defaultCamera.position.z += s / 2, this.defaultCamera.lookAt(r)), this.setCamera(fl), this.axesCamera.position.copy(this.defaultCamera.position), this.axesCamera.lookAt(this.axesScene.position), this.axesCamera.near = s / 100, this.axesCamera.far = s * 100, this.axesCamera.updateProjectionMatrix(), this.axesCorner.scale.set(s, s, s), this.controls.saveState(), this.scene.add(e), this.content = e, this.state.punctualLights = !0, this.content.traverse((a) => {
a.isLight && (this.state.punctualLights = !1);
}), this.setClips(t), this.animationManager.attach(this.content), this._setupAnimationPanel(), this.updateLights(), this.updateGUI(), this.updateEnvironment(), this.updateDisplay(), this.updateModelInfo(e, t), this.updateAnnotations(), window.VIEWER.scene = this.content, this.invalidate();
}
setClips(e) {
- mR(this, e);
+ xR(this, e);
}
playAllClips() {
- xR(this);
+ bR(this);
}
/**
* @param {string} name
*/
setCamera(e) {
- e === dl ? (this.controls.enabled = !0, this.activeCamera = this.defaultCamera) : (this.controls.enabled = !1, this.content.traverse((t) => {
+ e === fl ? (this.controls.enabled = !0, this.activeCamera = this.defaultCamera) : (this.controls.enabled = !1, this.content.traverse((t) => {
t.isCamera && t.name === e && (this.activeCamera = t);
})), this.invalidate();
}
updateLights() {
const e = this.state, t = this.lights;
- e.punctualLights && !t.length ? YT(this) : !e.punctualLights && t.length && JT(this), this.renderer.toneMapping = Number(e.toneMapping), this.renderer.toneMappingExposure = Math.pow(2, e.exposure), t.length === 2 && (t[0].intensity = e.ambientIntensity, t[0].color.set(e.ambientColor), t[1].intensity = e.directIntensity, t[1].color.set(e.directColor)), this.invalidate();
+ e.punctualLights && !t.length ? JT(this) : !e.punctualLights && t.length && ZT(this), this.renderer.toneMapping = Number(e.toneMapping), this.renderer.toneMappingExposure = Math.pow(2, e.exposure), t.length === 2 && (t[0].intensity = e.ambientIntensity, t[0].color.set(e.ambientColor), t[1].intensity = e.directIntensity, t[1].color.set(e.directColor)), this.invalidate();
}
updateEnvironment() {
- const e = al.filter(
+ const e = ol.filter(
(t) => t.name === this.state.environment
)[0];
- pR(this, e).then(({ envMap: t }) => {
+ AR(this, e).then(({ envMap: t }) => {
this._disposed || !this.scene || (this.scene.environment = t, this.scene.background = this.state.transparentBg ? null : this.state.background ? t : this.backgroundColor, this.invalidate());
});
}
updateDisplay() {
- this.skeletonHelpers.length && this.skeletonHelpers.forEach((e) => this.scene.remove(e)), qg(this.content, (e) => {
- e.wireframe = this.state.wireframe, e instanceof Kf && (e.size = this.state.pointSize);
+ this.skeletonHelpers.length && this.skeletonHelpers.forEach((e) => this.scene.remove(e)), jg(this.content, (e) => {
+ e.wireframe = this.state.wireframe, e instanceof Xf && (e.size = this.state.pointSize);
}), this.content.traverse((e) => {
if (e.geometry && e.skeleton && this.state.skeleton) {
- const t = new Qw(e.skeleton.bones[0].parent);
+ const t = new Gw(e.skeleton.bones[0].parent);
t.material.linewidth = 3, this.scene.add(t), this.skeletonHelpers.push(t);
}
- }), this.state.grid !== !!this.gridHelper && (this.state.grid ? (this.gridHelper = new Gw(), this.axesHelper = new BA(), this.axesHelper.renderOrder = 999, this.axesHelper.onBeforeRender = (e) => e.clearDepth(), this.scene.add(this.gridHelper), this.scene.add(this.axesHelper)) : (this.scene.remove(this.gridHelper), this.scene.remove(this.axesHelper), this.gridHelper = null, this.axesHelper = null, this.axesRenderer.clear())), this.controls.autoRotate = this.state.autoRotate, this.invalidate();
+ }), this.state.grid !== !!this.gridHelper && (this.state.grid ? (this.gridHelper = new Hw(), this.axesHelper = new RA(), this.axesHelper.renderOrder = 999, this.axesHelper.onBeforeRender = (e) => e.clearDepth(), this.scene.add(this.gridHelper), this.scene.add(this.axesHelper)) : (this.scene.remove(this.gridHelper), this.scene.remove(this.axesHelper), this.gridHelper = null, this.axesHelper = null, this.axesRenderer.clear())), this.controls.autoRotate = this.state.autoRotate, this.invalidate();
}
updateBackground() {
this.backgroundColor.set(this.state.bgColor), this.state.transparentBg ? (this.scene.background = null, this.renderer.setClearColor(0, 0)) : (this.scene.background = this.backgroundColor, this.renderer.setClearColor(0, 1), this.updateEnvironment()), this.invalidate();
@@ -35270,12 +35270,12 @@ class ib {
* See: https://stackoverflow.com/q/16226693/1314762
*/
updateModelInfo(e, t) {
- this.modelInfo && (this.modelInfo.remove(), this.modelInfo = null), this.state.showInfo && e && (this.modelInfo = IT(this.el, e, t));
+ this.modelInfo && (this.modelInfo.remove(), this.modelInfo = null), this.state.showInfo && e && (this.modelInfo = ST(this.el, e, t));
}
updateAnnotations() {
if (this.annotationEls.forEach((t) => t.el.remove()), this.annotationEls = [], !this.state.showLabels || !this.content) return;
- BT(this.content).forEach((t) => {
- const n = TT(t), s = document.createElement("div");
+ TT(this.content).forEach((t) => {
+ const n = RT(t), s = document.createElement("div");
s.classList.add("annotation-label"), s.appendChild(n), this.el.appendChild(s), this.annotationEls.push({ el: s, position: t.position });
}), this.invalidate();
}
@@ -35294,10 +35294,10 @@ class ib {
addAxesHelper() {
this.axesDiv = document.createElement("div"), this.el.appendChild(this.axesDiv), this.axesDiv.classList.add("axes");
const { clientWidth: e, clientHeight: t } = this.axesDiv;
- this.axesScene = new Qd(), this.axesCamera = new In(50, e / t, 0.1, 10), this.axesScene.add(this.axesCamera), this.axesRenderer = new eg({ alpha: !0 }), this.axesRenderer.setPixelRatio(window.devicePixelRatio), this.axesRenderer.setSize(this.axesDiv.clientWidth, this.axesDiv.clientHeight), this.axesCamera.up = this.defaultCamera.up, this.axesCorner = new BA(5), this.axesScene.add(this.axesCorner), this.axesDiv.appendChild(this.axesRenderer.domElement);
+ this.axesScene = new Hd(), this.axesCamera = new In(50, e / t, 0.1, 10), this.axesScene.add(this.axesCamera), this.axesRenderer = new ng({ alpha: !0 }), this.axesRenderer.setPixelRatio(window.devicePixelRatio), this.axesRenderer.setSize(this.axesDiv.clientWidth, this.axesDiv.clientHeight), this.axesCamera.up = this.defaultCamera.up, this.axesCorner = new RA(5), this.axesScene.add(this.axesCorner), this.axesDiv.appendChild(this.axesRenderer.domElement);
}
addGUI() {
- const e = window.innerWidth <= 700, t = this.gui = new HM({
+ const e = window.innerWidth <= 700, t = this.gui = new zM({
autoPlace: !1,
width: e ? 220 : 260,
hideable: !0
@@ -35307,11 +35307,11 @@ class ib {
p.add(
this.state,
"environment",
- al.map((w) => w.name)
+ ol.map((w) => w.name)
).onChange(() => this.updateEnvironment()), [
p.add(this.state, "toneMapping", {
- Linear: xd,
- "ACES Filmic": f0
+ Linear: Ed,
+ "ACES Filmic": p0
}),
p.add(this.state, "exposure", -10, 10, 0.01),
p.add(this.state, "punctualLights").listen(),
@@ -35340,7 +35340,7 @@ class ib {
n.geometry && n.morphTargetInfluences && t.push(n), n.isCamera && (n.name = n.name || `VIEWER__camera_${e.length + 1}`, e.push(n.name));
}), e.length) {
this.cameraFolder.domElement.style.display = "", this.cameraCtrl && this.cameraCtrl.remove();
- const n = [dl].concat(e);
+ const n = [fl].concat(e);
this.cameraCtrl = this.cameraFolder.add(this.state, "camera", n), this.cameraCtrl.onChange((s) => this.setCamera(s));
}
if (t.length && (this.morphFolder.domElement.style.display = "", t.forEach((n) => {
@@ -35453,7 +35453,7 @@ class ib {
clear() {
this.content && (this.animationManager.detach(), this._animPanelEl && (this._animPanelEl.remove(), this._animPanelEl = null), this.modelInfo && (this.modelInfo.remove(), this.modelInfo = null), this.annotationEls.forEach((e) => e.el.remove()), this.annotationEls = [], this.scene.remove(this.content), this.content.traverse((e) => {
e.geometry && e.geometry.dispose();
- }), qg(this.content, (e) => {
+ }), jg(this.content, (e) => {
for (const t in e)
t !== "envMap" && e[t] && e[t].isTexture && e[t].dispose();
}), this.content = null, this._disposed || this.invalidate());
@@ -35471,7 +35471,7 @@ class ib {
}
}
}
-class GR {
+class HR {
constructor({
model: e = "claude-opus-4-6",
proxyURL: t,
@@ -35529,7 +35529,7 @@ class GR {
return { role: "assistant", content: n };
}
}
-class HR {
+class zR {
// Used when brain.provider === "none" — skills drive the agent.
async complete() {
return { text: "", toolCalls: [], stopReason: "end_turn" };
@@ -35541,13 +35541,13 @@ class HR {
return { role: "assistant", content: e || "" };
}
}
-function zR(i = {}) {
+function VR(i = {}) {
const e = i.provider || "anthropic";
- if (e === "anthropic") return new GR(i);
- if (e === "none") return new HR();
+ if (e === "anthropic") return new HR(i);
+ if (e === "none") return new zR();
throw new Error(`Unsupported provider: ${e}. Supported: anthropic, none`);
}
-class VR {
+class WR {
constructor({ voiceId: e = "default", rate: t = 1, pitch: n = 1, lang: s = "en-US" } = {}) {
this.voiceId = e, this.rate = t, this.pitch = n, this.lang = s, this._queue = [], this._speaking = !1;
}
@@ -35582,7 +35582,7 @@ class VR {
return e.find((t) => t.lang?.startsWith(this.lang.slice(0, 2))) || null;
}
}
-class WR {
+class qR {
constructor({ language: e = "en-US", continuous: t = !1, interimResults: n = !0 } = {}) {
this.language = e, this.continuous = t, this.interimResults = n, this._recognition = null, this._listening = !1;
}
@@ -35622,7 +35622,7 @@ class WR {
return this._listening;
}
}
-class qR {
+class KR {
constructor({
voiceId: e,
modelId: t = "eleven_turbo_v2_5",
@@ -35779,20 +35779,20 @@ class qR {
this._startedFired = !1;
}
}
-function KR(i = {}) {
+function jR(i = {}) {
const e = i.provider || "browser";
if (e === "none") return null;
- if (e === "browser") return new VR(i);
- if (e === "elevenlabs") return new qR(i);
+ if (e === "browser") return new WR(i);
+ if (e === "elevenlabs") return new KR(i);
throw new Error(`TTS provider "${e}" not implemented yet`);
}
-function jR(i = {}) {
+function XR(i = {}) {
const e = i.provider || "browser";
if (e === "none") return null;
- if (e === "browser") return new WR(i);
+ if (e === "browser") return new qR(i);
throw new Error(`STT provider "${e}" not implemented yet`);
}
-const Xg = [
+const Jg = [
{
name: "wave",
description: "Wave at the user. Use for greetings, farewells, or acknowledgments.",
@@ -35867,7 +35867,7 @@ const Xg = [
required: ["key", "name", "description", "type", "body"]
}
}
-], XR = [
+], YR = [
{
name: "observe_agents",
description: "List the other agents currently sharing this stage, with their names and positions.",
@@ -35885,7 +35885,7 @@ const Xg = [
required: ["agentId", "text"]
}
}
-], YR = {
+], JR = {
async wave(i, e) {
const t = i.duration_ms || 1500;
return await e.viewer.playAnimationByHint?.("wave", { duration: t }), e.memory.note("waved", { duration_ms: t }), { ok: !0 };
@@ -35919,13 +35919,13 @@ const Xg = [
const s = e.agentId || "anon";
return e.stage.broadcast(s, { kind: "direct", to: t, text: n }), e.stage.routeMessage(s, t, n);
}
-}, JR = 8;
-class ZR extends EventTarget {
+}, ZR = 8;
+class $R extends EventTarget {
constructor({ manifest: e, viewer: t, memory: n, skills: s, providerConfig: r = {}, voiceConfig: a = {}, stage: o = null, agentId: c = null } = {}) {
- super(), this.manifest = e || {}, this.viewer = t, this.memory = n, this.skills = s, this.stage = o, this.agentId = c, this.provider = zR({
+ super(), this.manifest = e || {}, this.viewer = t, this.memory = n, this.skills = s, this.stage = o, this.agentId = c, this.provider = VR({
...this.manifest.brain,
...r
- }), this.tts = KR({ ...this.manifest.voice?.tts, ...a.tts }), this.stt = jR({ ...this.manifest.voice?.stt, ...a.stt }), this.messages = [], this._busy = !1;
+ }), this.tts = jR({ ...this.manifest.voice?.tts, ...a.tts }), this.stt = XR({ ...this.manifest.voice?.stt, ...a.stt }), this.messages = [], this._busy = !1;
}
get systemPrompt() {
const e = [];
@@ -35938,7 +35938,7 @@ class ZR extends EventTarget {
</memory>`), this.skills && e.push(this.skills.systemPrompt()), e.join("");
}
get tools() {
- const e = new Set(this.manifest.tools || Xg.map((r) => r.name)), t = Xg.filter((r) => e.has(r.name)), n = this.skills ? this.skills.allTools() : [], s = this.stage ? XR : [];
+ const e = new Set(this.manifest.tools || Jg.map((r) => r.name)), t = Jg.filter((r) => e.has(r.name)), n = this.skills ? this.skills.allTools() : [], s = this.stage ? YR : [];
return [...t, ...s, ...n];
}
async send(e, { voice: t = !1 } = {}) {
@@ -35957,7 +35957,7 @@ class ZR extends EventTarget {
}
async _loop() {
let e = 0, t = "";
- for (; e++ < JR; ) {
+ for (; e++ < ZR; ) {
const n = await this.provider.complete({
system: this.systemPrompt,
messages: this.messages,
@@ -35993,7 +35993,7 @@ class ZR extends EventTarget {
async _dispatchTool(e) {
const t = this._context(), n = this.skills?.findSkillForTool(e.name);
if (n) return n.invoke(e.name, e.input, t);
- const s = YR[e.name];
+ const s = JR[e.name];
if (!s) throw new Error(`Unknown tool: ${e.name}`);
return s(e.input, t);
}
@@ -36042,22 +36042,22 @@ class ZR extends EventTarget {
this.pause(), this.messages = [];
}
}
-const lf = [
+const uf = [
"https://dweb.link/ipfs/",
"https://cloudflare-ipfs.com/ipfs/",
"https://ipfs.io/ipfs/"
-], $R = "https://arweave.net/";
+], eF = "https://arweave.net/";
function Xs(i, e = 0) {
if (!i) return i;
const t = i.match(/^ipfs:\/\/(.+)$/i);
if (t)
- return lf[e % lf.length] + t[1];
+ return uf[e % uf.length] + t[1];
const n = i.match(/^ar:\/\/(.+)$/i);
- return n ? $R + n[1] : i;
+ return n ? eF + n[1] : i;
}
-async function eF(i) {
+async function tF(i) {
let e;
- for (let t = 0; t < lf.length; t++) {
+ for (let t = 0; t < uf.length; t++) {
const n = Xs(i, t);
try {
const s = await fetch(n);
@@ -36068,7 +36068,7 @@ async function eF(i) {
}
throw e || new Error("All IPFS gateways failed for " + i);
}
-const tF = {
+const nF = {
idle: "idle",
wave: "reaction",
nod: "reaction",
@@ -36080,10 +36080,10 @@ const tF = {
point: "reaction",
shrug: "defeated"
};
-function nF(i, e) {
- return e && e[i] ? e[i] : tF[i] ?? i;
+function iF(i, e) {
+ return e && e[i] ? e[i] : nF[i] ?? i;
}
-const Yg = {
+const Zg = {
neutral: {
/* reset all */
},
@@ -36093,9 +36093,9 @@ const Yg = {
confused: { browInnerUp: 0.5, browOuterUpL: 0.4, mouthPressL: 0.3, mouthPressR: 0.3 },
focused: { browDownL: 0.4, browDownR: 0.4, eyeSquintL: 0.3, eyeSquintR: 0.3 }
};
-class iF {
+class sF {
constructor(e) {
- this.viewer = e, this._loader = new tp(), this._userTarget = new G(0, 1.6, 2), this._animationMap = {}, this._group = null, this._groupMixer = null, this._groupClips = null, this._mixerHook = null;
+ this.viewer = e, this._loader = new ip(), this._userTarget = new G(0, 1.6, 2), this._animationMap = {}, this._group = null, this._groupMixer = null, this._groupClips = null, this._mixerHook = null;
}
// Expose the underlying Three.js handles skills may need
get scene() {
@@ -36143,7 +36143,7 @@ class iF {
* @returns {string}
*/
resolveAnimationSlot(e) {
- return nF(e, this._animationMap);
+ return iF(e, this._animationMap);
}
// Delegate raw load for ad-hoc cases
async load(e, t = "", n = /* @__PURE__ */ new Map()) {
@@ -36227,7 +36227,7 @@ class iF {
}
// --- Expression (morph targets) ---
setExpression(e, t = 1) {
- const n = Yg[e] || Yg.neutral;
+ const n = Zg[e] || Zg.neutral;
this.viewer.content && (this.viewer.content.traverse((s) => {
if (!(!s.morphTargetDictionary || !s.morphTargetInfluences)) {
for (let r = 0; r < s.morphTargetInfluences.length; r++)
@@ -36267,7 +36267,7 @@ class iF {
return this.clips.find((s) => s.name.toLowerCase() === n) || this.clips.find((s) => s.name.toLowerCase().includes(n));
}
}
-const sF = `// Sandbox worker — executes skill handlers in an isolated Web Worker scope.
+const rF = `// Sandbox worker — executes skill handlers in an isolated Web Worker scope.
// No DOM, no window, no document. Only ctx.* and native worker APIs.
/** @type {Map<string, object>} skillURI → module exports */
@@ -36436,55 +36436,55 @@ function _handleResponse({ requestId, result, error }) {
}
}
`;
-let li = null, Sa = null;
-const Ma = /* @__PURE__ */ new Map(), tc = /* @__PURE__ */ new Map(), zs = /* @__PURE__ */ new Map(), wh = /* @__PURE__ */ new Map();
-let rF = 0, aF = 0;
-function Jg(i) {
+let hi = null, Ma = null;
+const Ba = /* @__PURE__ */ new Map(), nc = /* @__PURE__ */ new Map(), zs = /* @__PURE__ */ new Map(), Ch = /* @__PURE__ */ new Map();
+let aF = 0, oF = 0;
+function $g(i) {
if (i == null) return null;
- const e = `@h:${++rF}`;
- return wh.set(e, i), e;
-}
-function oF(i) {
- return typeof i == "string" && i.startsWith("@h:") ? wh.get(i) ?? i : i;
+ const e = `@h:${++aF}`;
+ return Ch.set(e, i), e;
}
function cF(i) {
- return Array.isArray(i) ? i.map(oF) : i;
+ return typeof i == "string" && i.startsWith("@h:") ? Ch.get(i) ?? i : i;
+}
+function lF(i) {
+ return Array.isArray(i) ? i.map(cF) : i;
}
-function sb() {
- if (!li) {
- if (!Sa) {
- const i = new Blob([sF], { type: "text/javascript" });
- Sa = URL.createObjectURL(i);
+function rb() {
+ if (!hi) {
+ if (!Ma) {
+ const i = new Blob([rF], { type: "text/javascript" });
+ Ma = URL.createObjectURL(i);
}
- li = new Worker(Sa), li.onmessage = hF, li.onerror = lF;
+ hi = new Worker(Ma), hi.onmessage = uF, hi.onerror = hF;
}
- return li;
+ return hi;
}
-function lF(i) {
- console.error("[sandbox] worker crashed:", i), li = null, Ma.clear(), tc.clear(), wh.clear();
+function hF(i) {
+ console.error("[sandbox] worker crashed:", i), hi = null, Ba.clear(), nc.clear(), Ch.clear();
for (const [, e] of zs) e.reject(new Error("Sandbox worker crashed"));
zs.clear();
}
-function hF({ data: i }) {
+function uF({ data: i }) {
switch (i.type) {
case "install-ack": {
- const e = tc.get(i.skillURI);
- tc.delete(i.skillURI), i.ok ? e?.resolve() : (Ma.delete(i.skillURI), e?.reject(new Error(i.error || "Install failed")));
+ const e = nc.get(i.skillURI);
+ nc.delete(i.skillURI), i.ok ? e?.resolve() : (Ba.delete(i.skillURI), e?.reject(new Error(i.error || "Install failed")));
break;
}
case "request": {
const { invocationId: e, requestId: t, method: n, args: s } = i, r = zs.get(e);
if (!r) {
- li?.postMessage({
+ hi?.postMessage({
type: "response",
requestId: t,
error: "No active invocation"
});
return;
}
- uF(n, s, r.mainCtx).then(
- (a) => li?.postMessage({ type: "response", requestId: t, result: a ?? null }),
- (a) => li?.postMessage({
+ dF(n, s, r.mainCtx).then(
+ (a) => hi?.postMessage({ type: "response", requestId: t, result: a ?? null }),
+ (a) => hi?.postMessage({
type: "response",
requestId: t,
error: a.message || String(a)
@@ -36500,8 +36500,8 @@ function hF({ data: i }) {
}
}
}
-async function uF(i, e, t) {
- const n = cF(e);
+async function dF(i, e, t) {
+ const n = lF(e);
switch (i) {
// viewer
case "viewer.play":
@@ -36535,11 +36535,11 @@ async function uF(i, e, t) {
// asset loading — results stored as handles because they're non-serializable
case "loadClip": {
const s = await t.loadClip?.(n[0]);
- return Jg(s);
+ return $g(s);
}
case "loadGLB": {
const s = await t.loadGLB?.(n[0]);
- return Jg(s);
+ return $g(s);
}
// speech
case "speak":
@@ -36553,16 +36553,16 @@ async function uF(i, e, t) {
throw new Error(`Unknown ctx method: ${i}`);
}
}
-async function dF(i, e) {
- if (Ma.has(i)) return Ma.get(i);
+async function fF(i, e) {
+ if (Ba.has(i)) return Ba.get(i);
const t = new Promise((n, s) => {
- tc.set(i, { resolve: n, reject: s });
+ nc.set(i, { resolve: n, reject: s });
});
- return Ma.set(i, t), sb().postMessage({ type: "install", skillURI: i, handlersSrc: e }), t;
+ return Ba.set(i, t), rb().postMessage({ type: "install", skillURI: i, handlersSrc: e }), t;
}
-async function fF(i, e, t, n, s) {
- await dF(i, n);
- const r = ++aF, a = sb();
+async function pF(i, e, t, n, s) {
+ await fF(i, n);
+ const r = ++oF, a = rb();
return new Promise((o, c) => {
zs.set(r, { resolve: o, reject: c, mainCtx: s }), a.postMessage({
type: "invoke",
@@ -36574,20 +36574,20 @@ async function fF(i, e, t, n, s) {
});
});
}
-function pF() {
- if (li) {
- li.terminate(), li = null, Sa && (URL.revokeObjectURL(Sa), Sa = null), Ma.clear(), tc.clear(), wh.clear();
+function AF() {
+ if (hi) {
+ hi.terminate(), hi = null, Ma && (URL.revokeObjectURL(Ma), Ma = null), Ba.clear(), nc.clear(), Ch.clear();
for (const [, i] of zs) i.reject(new Error("Sandbox terminated"));
zs.clear();
}
}
-function AF() {
- return { invoke: fF, terminate: pF };
+function gF() {
+ return { invoke: pF, terminate: AF };
}
-function gF(i, e) {
+function mF(i, e) {
return /^([a-z]+:|\/)/i.test(e) ? e : (i.endsWith("/") || (i += "/"), i + e);
}
-class mF {
+class xF {
constructor({ uri: e, manifest: t, instructions: n, tools: s, handlers: r, handlersSrc: a }) {
this.uri = e, this.manifest = t, this.name = t.name, this.version = t.version, this.instructions = n, this.tools = s || [], this.handlers = r || {}, this.handlersSrc = a || null;
}
@@ -36601,7 +36601,7 @@ class mF {
}
if (!this.handlersSrc)
throw new Error(`Skill "${this.name}" has no handler source for tool "${e}"`);
- return AF().invoke(this.uri, e, t, this.handlersSrc, s);
+ return gF().invoke(this.uri, e, t, this.handlersSrc, s);
}
systemPromptFragment() {
return this.instructions ? `
@@ -36611,7 +36611,7 @@ ${this.instructions}
</skill>` : "";
}
}
-class xF {
+class bF {
constructor({ fetchFn: e = fetch.bind(globalThis), trust: t = "owned-only", ownerAddress: n } = {}) {
this.fetchFn = e, this.trust = t, this.ownerAddress = n?.toLowerCase(), this.skills = /* @__PURE__ */ new Map();
}
@@ -36624,7 +36624,7 @@ class xF {
this._fetchText(`${n}SKILL.md`).catch(() => ""),
this._fetchJSON(`${n}tools.json`).catch(() => ({ tools: [] })),
r ? this._fetchHandlers(`${n}handlers.js`).catch(() => null) : this._fetchHandlersSrc(`${n}handlers.js`).catch(() => null)
- ]), l = new mF({
+ ]), l = new xF({
uri: n,
manifest: s,
instructions: a,
@@ -36665,7 +36665,7 @@ class xF {
}
_resolveBundleURI(e, t) {
let n = e;
- return !/^([a-z]+:|\/)/i.test(e) && t && (n = gF(t, e)), n.endsWith("/") || (n += "/"), (n.startsWith("ipfs://") || n.startsWith("ar://")) && (n = Xs(n)), n;
+ return !/^([a-z]+:|\/)/i.test(e) && t && (n = mF(t, e)), n.endsWith("/") || (n += "/"), (n.startsWith("ipfs://") || n.startsWith("ar://")) && (n = Xs(n)), n;
}
async _fetchJSON(e) {
const t = await this.fetchFn(e);
@@ -36705,9 +36705,9 @@ class xF {
}
}
}
-const bF = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
-function pl(i) {
- const e = i.match(bF);
+const EF = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
+function Al(i) {
+ const e = i.match(EF);
if (!e) return { meta: {}, body: i };
const t = {};
for (const n of e[1].split(`
@@ -36717,32 +36717,32 @@ function pl(i) {
}
return { meta: t, body: e[2] };
}
-function EF(i, e) {
+function yF(i, e) {
const t = ["---"];
for (const [n, s] of Object.entries(i)) t.push(`${n}: ${s}`);
return t.push("---", "", e), t.join(`
`);
}
-class Pi {
+class ki {
constructor({ mode: e = "local", namespace: t, index: n = {}, files: s = {}, timeline: r = [] } = {}) {
this.mode = e, this.namespace = t, this.files = new Map(Object.entries(s)), this.timeline = r, this.indexText = n.text || "", this._dirty = !1;
}
static async load({ mode: e = "local", namespace: t, manifestURI: n, fetchFn: s }) {
- if (e === "none") return new Pi({ mode: "none", namespace: t });
- if (e === "local") return Pi._loadLocal(t);
+ if (e === "none") return new ki({ mode: "none", namespace: t });
+ if (e === "local") return ki._loadLocal(t);
if (e === "ipfs" || e === "encrypted-ipfs")
- return Pi._loadIPFS({ mode: e, namespace: t, manifestURI: n, fetchFn: s });
+ return ki._loadIPFS({ mode: e, namespace: t, manifestURI: n, fetchFn: s });
throw new Error(`Unknown memory mode: ${e}`);
}
static _loadLocal(e) {
const t = `agent:${e}:memory`;
try {
const n = localStorage.getItem(t);
- if (!n) return new Pi({ mode: "local", namespace: e });
+ if (!n) return new ki({ mode: "local", namespace: e });
const s = JSON.parse(n);
- return new Pi({ mode: "local", namespace: e, ...s });
+ return new ki({ mode: "local", namespace: e, ...s });
} catch {
- return new Pi({ mode: "local", namespace: e });
+ return new ki({ mode: "local", namespace: e });
}
}
static async _loadIPFS({ mode: e, namespace: t, manifestURI: n, fetchFn: s }) {
@@ -36758,18 +36758,18 @@ class Pi {
} catch {
}
}
- return new Pi({ mode: e, namespace: t, index: { text: o }, files: c });
+ return new ki({ mode: e, namespace: t, index: { text: o }, files: c });
} catch {
- return new Pi({ mode: e, namespace: t });
+ return new ki({ mode: e, namespace: t });
}
}
read(e) {
const t = e.endsWith(".md") ? e : `${e}.md`, n = this.files.get(t);
- return n ? pl(n) : null;
+ return n ? Al(n) : null;
}
write(e, { name: t, description: n, type: s, body: r, decay: a }) {
- const o = e.endsWith(".md") ? e : `${e}.md`, c = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), l = this.files.get(o), h = l && pl(l).meta.created || c, u = { name: t, description: n, type: s, created: h, updated: c };
- a && (u.decay = a), this.files.set(o, EF(u, r || "")), this._rebuildIndex(), this._dirty = !0, this._persist();
+ const o = e.endsWith(".md") ? e : `${e}.md`, c = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), l = this.files.get(o), h = l && Al(l).meta.created || c, u = { name: t, description: n, type: s, created: h, updated: c };
+ a && (u.decay = a), this.files.set(o, yF(u, r || "")), this._rebuildIndex(), this._dirty = !0, this._persist();
}
note(e, t) {
const n = { ts: (/* @__PURE__ */ new Date()).toISOString(), type: e, ...t };
@@ -36778,7 +36778,7 @@ class Pi {
async recall(e, { limit: t = 5 } = {}) {
const n = e.toLowerCase(), s = [];
for (const [r, a] of this.files) {
- const { meta: o, body: c } = pl(a), l = `${o.name || ""} ${o.description || ""} ${c}`.toLowerCase();
+ const { meta: o, body: c } = Al(a), l = `${o.name || ""} ${o.description || ""} ${c}`.toLowerCase();
l.includes(n) && s.push({ file: r, meta: o, body: c, score: l.split(n).length - 1 });
}
return s.sort((r, a) => a.score - r.score).slice(0, t);
@@ -36786,7 +36786,7 @@ class Pi {
_rebuildIndex() {
const e = { user: [], feedback: [], project: [], reference: [] };
for (const [s, r] of this.files) {
- const { meta: a } = pl(r), o = a.type || "user";
+ const { meta: a } = Al(r), o = a.type || "user";
e[o] || (e[o] = []), e[o].push({ file: s, name: a.name || s, description: a.description || "" });
}
const t = ["# Memory", ""], n = { user: "## User", feedback: "## Feedback", project: "## Project", reference: "## Reference" };
@@ -36849,8 +36849,8 @@ class Pi {
this._rebuildIndex(), this._persist();
}
}
-const yF = "6.16.0";
-function _F(i, e, t) {
+const _F = "6.16.0";
+function wF(i, e, t) {
const n = e.split("|").map((r) => r.trim());
for (let r = 0; r < n.length; r++)
switch (e) {
@@ -36866,7 +36866,7 @@ function _F(i, e, t) {
const s = new Error(`invalid value for type ${e}`);
throw s.code = "INVALID_ARGUMENT", s.argument = `value.${t}`, s.value = i, s;
}
-async function Un(i) {
+async function On(i) {
const e = Object.keys(i);
return (await Promise.all(e.map((n) => Promise.resolve(i[n])))).reduce((n, s, r) => (n[e[r]] = s, n), {});
}
@@ -36874,10 +36874,10 @@ function Ye(i, e, t) {
for (let n in e) {
let s = e[n];
const r = t ? t[n] : null;
- r && _F(s, r, n), Object.defineProperty(i, n, { enumerable: !0, value: s, writable: !1 });
+ r && wF(s, r, n), Object.defineProperty(i, n, { enumerable: !0, value: s, writable: !1 });
}
}
-function ya(i, e) {
+function _a(i, e) {
if (i == null)
return "null";
if (e == null && (e = /* @__PURE__ */ new Set()), typeof i == "object") {
@@ -36886,7 +36886,7 @@ function ya(i, e) {
e.add(i);
}
if (Array.isArray(i))
- return "[ " + i.map((t) => ya(t, e)).join(", ") + " ]";
+ return "[ " + i.map((t) => _a(t, e)).join(", ") + " ]";
if (i instanceof Uint8Array) {
const t = "0123456789abcdef";
let n = "0x";
@@ -36895,7 +36895,7 @@ function ya(i, e) {
return n;
}
if (typeof i == "object" && typeof i.toJSON == "function")
- return ya(i.toJSON(), e);
+ return _a(i.toJSON(), e);
switch (typeof i) {
case "boolean":
case "number":
@@ -36907,7 +36907,7 @@ function ya(i, e) {
return JSON.stringify(i);
case "object": {
const t = Object.keys(i);
- return t.sort(), "{ " + t.map((n) => `${ya(n, e)}: ${ya(i[n], e)}`).join(", ") + " }";
+ return t.sort(), "{ " + t.map((n) => `${_a(n, e)}: ${_a(i[n], e)}`).join(", ") + " }";
}
}
return "[ COULD NOT SERIALIZE ]";
@@ -36915,7 +36915,7 @@ function ya(i, e) {
function Mn(i, e) {
return i && i.code === e;
}
-function pp(i) {
+function gp(i) {
return Mn(i, "CALL_EXCEPTION");
}
function Gt(i, e, t) {
@@ -36924,15 +36924,15 @@ function Gt(i, e, t) {
const r = [];
if (t) {
if ("message" in t || "code" in t || "name" in t)
- throw new Error(`value will overwrite populated values: ${ya(t)}`);
+ throw new Error(`value will overwrite populated values: ${_a(t)}`);
for (const a in t) {
if (a === "shortMessage")
continue;
const o = t[a];
- r.push(a + "=" + ya(o));
+ r.push(a + "=" + _a(o));
}
}
- r.push(`code=${e}`), r.push(`version=${yF}`), r.length && (i += " (" + r.join(", ") + ")");
+ r.push(`code=${e}`), r.push(`version=${_F}`), r.length && (i += " (" + r.join(", ") + ")");
}
let s;
switch (e) {
@@ -36955,7 +36955,7 @@ function ge(i, e, t, n) {
function V(i, e, t, n) {
ge(i, e, "INVALID_ARGUMENT", { argument: t, value: n });
}
-function rb(i, e, t) {
+function ab(i, e, t) {
t == null && (t = ""), t && (t = ": " + t), ge(i >= e, "missing argument" + t, "MISSING_ARGUMENT", {
count: i,
expectedCount: e
@@ -36975,7 +36975,7 @@ function rb(i, e, t) {
}
return i;
}, []);
-function vh(i, e, t) {
+function Ih(i, e, t) {
if (t == null && (t = ""), i !== e) {
let n = t, s = "new";
t && (n += ".", s += " " + t), ge(!1, `private constructor; use ${n}from* methods`, "UNSUPPORTED_OPERATION", {
@@ -36983,7 +36983,7 @@ function vh(i, e, t) {
});
}
}
-function ab(i, e, t) {
+function ob(i, e, t) {
if (i instanceof Uint8Array)
return t ? new Uint8Array(i) : i;
if (typeof i == "string" && i.length % 2 === 0 && i.match(/^0x[0-9a-f]*$/i)) {
@@ -36996,31 +36996,31 @@ function ab(i, e, t) {
V(!1, "invalid BytesLike value", e || "value", i);
}
function dt(i, e) {
- return ab(i, e, !1);
+ return ob(i, e, !1);
}
-function On(i, e) {
- return ab(i, e, !0);
+function Qn(i, e) {
+ return ob(i, e, !0);
}
function Ut(i, e) {
return !(typeof i != "string" || !i.match(/^0x[0-9A-Fa-f]*$/) || typeof e == "number" && i.length !== 2 + 2 * e || e === !0 && i.length % 2 !== 0);
}
-function Ap(i) {
+function mp(i) {
return Ut(i, !0) || i instanceof Uint8Array;
}
-const Zg = "0123456789abcdef";
+const em = "0123456789abcdef";
function Ie(i) {
const e = dt(i);
let t = "0x";
for (let n = 0; n < e.length; n++) {
const s = e[n];
- t += Zg[(s & 240) >> 4] + Zg[s & 15];
+ t += em[(s & 240) >> 4] + em[s & 15];
}
return t;
}
function Ht(i) {
return "0x" + i.map((e) => Ie(e).substring(2)).join("");
}
-function Ba(i) {
+function Ta(i) {
return Ut(i, !0) ? (i.length - 2) / 2 : dt(i).length;
}
function Kt(i, e, t) {
@@ -37031,7 +37031,7 @@ function Kt(i, e, t) {
offset: t
}), Ie(n.slice(e ?? 0, t ?? n.length));
}
-function ob(i, e, t) {
+function cb(i, e, t) {
const n = dt(i);
ge(e >= n.length, "padding exceeds data length", "BUFFER_OVERRUN", {
buffer: new Uint8Array(n),
@@ -37042,35 +37042,35 @@ function ob(i, e, t) {
return s.fill(0), t ? s.set(n, e - n.length) : s.set(n, 0), Ie(s);
}
function Es(i, e) {
- return ob(i, e, !0);
-}
-function wF(i, e) {
- return ob(i, e, !1);
+ return cb(i, e, !0);
}
-const Ac = BigInt(0), Si = BigInt(1), _a = 9007199254740991;
function vF(i, e) {
- const t = Ch(i, "value"), n = BigInt(ft(e, "width"));
- if (ge(t >> n === Ac, "overflow", "NUMERIC_FAULT", {
+ return cb(i, e, !1);
+}
+const gc = BigInt(0), Mi = BigInt(1), wa = 9007199254740991;
+function CF(i, e) {
+ const t = Sh(i, "value"), n = BigInt(ft(e, "width"));
+ if (ge(t >> n === gc, "overflow", "NUMERIC_FAULT", {
operation: "fromTwos",
fault: "overflow",
value: i
- }), t >> n - Si) {
- const s = (Si << n) - Si;
- return -((~t & s) + Si);
+ }), t >> n - Mi) {
+ const s = (Mi << n) - Mi;
+ return -((~t & s) + Mi);
}
return t;
}
-function cb(i, e) {
+function lb(i, e) {
let t = De(i, "value");
- const n = BigInt(ft(e, "width")), s = Si << n - Si;
- if (t < Ac) {
+ const n = BigInt(ft(e, "width")), s = Mi << n - Mi;
+ if (t < gc) {
t = -t, ge(t <= s, "too low", "NUMERIC_FAULT", {
operation: "toTwos",
fault: "overflow",
value: i
});
- const r = (Si << n) - Si;
- return (~t & r) + Si;
+ const r = (Mi << n) - Mi;
+ return (~t & r) + Mi;
} else
ge(t < s, "too high", "NUMERIC_FAULT", {
operation: "toTwos",
@@ -37079,16 +37079,16 @@ function cb(i, e) {
});
return t;
}
-function Io(i, e) {
- const t = Ch(i, "value"), n = BigInt(ft(e, "bits"));
- return t & (Si << n) - Si;
+function So(i, e) {
+ const t = Sh(i, "value"), n = BigInt(ft(e, "bits"));
+ return t & (Mi << n) - Mi;
}
function De(i, e) {
switch (typeof i) {
case "bigint":
return i;
case "number":
- return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -_a && i <= _a, "overflow", e || "value", i), BigInt(i);
+ return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -wa && i <= wa, "overflow", e || "value", i), BigInt(i);
case "string":
try {
if (i === "")
@@ -37100,20 +37100,20 @@ function De(i, e) {
}
V(!1, "invalid BigNumberish value", e || "value", i);
}
-function Ch(i, e) {
+function Sh(i, e) {
const t = De(i, e);
- return ge(t >= Ac, "unsigned value cannot be negative", "NUMERIC_FAULT", {
+ return ge(t >= gc, "unsigned value cannot be negative", "NUMERIC_FAULT", {
fault: "overflow",
operation: "getUint",
value: i
}), t;
}
-const $g = "0123456789abcdef";
-function gp(i) {
+const tm = "0123456789abcdef";
+function xp(i) {
if (i instanceof Uint8Array) {
let e = "0x0";
for (const t of i)
- e += $g[t >> 4], e += $g[t & 15];
+ e += tm[t >> 4], e += tm[t & 15];
return BigInt(e);
}
return De(i);
@@ -37121,9 +37121,9 @@ function gp(i) {
function ft(i, e) {
switch (typeof i) {
case "bigint":
- return V(i >= -_a && i <= _a, "overflow", e || "value", i), Number(i);
+ return V(i >= -wa && i <= wa, "overflow", e || "value", i), Number(i);
case "number":
- return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -_a && i <= _a, "overflow", e || "value", i), i;
+ return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -wa && i <= wa, "overflow", e || "value", i), i;
case "string":
try {
if (i === "")
@@ -37135,17 +37135,17 @@ function ft(i, e) {
}
V(!1, "invalid numeric value", e || "value", i);
}
-function CF(i) {
- return ft(gp(i));
+function IF(i) {
+ return ft(xp(i));
}
function Ys(i, e) {
- const t = Ch(i, "value");
+ const t = Sh(i, "value");
let n = t.toString(16);
if (e == null)
n.length % 2 && (n = "0" + n);
else {
const s = ft(e, "width");
- if (s === 0 && t === Ac)
+ if (s === 0 && t === gc)
return "0x";
for (ge(s * 2 >= n.length, `value exceeds width (${s} bytes)`, "NUMERIC_FAULT", {
operation: "toBeHex",
@@ -37157,8 +37157,8 @@ function Ys(i, e) {
return "0x" + n;
}
function rn(i, e) {
- const t = Ch(i, "value");
- if (t === Ac)
+ const t = Sh(i, "value");
+ if (t === gc)
return new Uint8Array(0);
let n = t.toString(16);
n.length % 2 && (n = "0" + n);
@@ -37169,39 +37169,39 @@ function rn(i, e) {
}
return s;
}
-function wi(i) {
- let e = Ie(Ap(i) ? i : rn(i)).substring(2);
+function vi(i) {
+ let e = Ie(mp(i) ? i : rn(i)).substring(2);
for (; e.startsWith("0"); )
e = e.substring(1);
return e === "" && (e = "0"), "0x" + e;
}
-const em = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+const nm = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
BigInt(0);
-const tm = BigInt(58);
-function IF(i) {
+const im = BigInt(58);
+function SF(i) {
const e = dt(i);
- let t = gp(e), n = "";
+ let t = xp(e), n = "";
for (; t; )
- n = em[Number(t % tm)] + n, t /= tm;
+ n = nm[Number(t % im)] + n, t /= im;
for (let s = 0; s < e.length && !e[s]; s++)
- n = em[0] + n;
+ n = nm[0] + n;
return n;
}
-function SF(i) {
+function MF(i) {
i = atob(i);
const e = new Uint8Array(i.length);
for (let t = 0; t < i.length; t++)
e[t] = i.charCodeAt(t);
return dt(e);
}
-function MF(i) {
+function BF(i) {
const e = dt(i);
let t = "";
for (let n = 0; n < e.length; n++)
t += String.fromCharCode(e[n]);
return btoa(t);
}
-class lb {
+class hb {
/**
* The event filter.
*/
@@ -37225,10 +37225,10 @@ class lb {
this.#e != null && await this.emitter.off(this.filter, this.#e);
}
}
-function BF(i, e, t, n, s) {
+function TF(i, e, t, n, s) {
V(!1, `invalid codepoint at offset ${e}; ${i}`, "bytes", t);
}
-function hb(i, e, t, n, s) {
+function ub(i, e, t, n, s) {
if (i === "BAD_PREFIX" || i === "UNEXPECTED_CONTINUE") {
let r = 0;
for (let a = e + 1; a < t.length && t[a] >> 6 === 2; a++)
@@ -37237,16 +37237,16 @@ function hb(i, e, t, n, s) {
}
return i === "OVERRUN" ? t.length - e - 1 : 0;
}
-function TF(i, e, t, n, s) {
- return i === "OVERLONG" ? (V(typeof s == "number", "invalid bad code point for replacement", "badCodepoint", s), n.push(s), 0) : (n.push(65533), hb(i, e, t));
+function RF(i, e, t, n, s) {
+ return i === "OVERLONG" ? (V(typeof s == "number", "invalid bad code point for replacement", "badCodepoint", s), n.push(s), 0) : (n.push(65533), ub(i, e, t));
}
-const RF = Object.freeze({
- error: BF,
- ignore: hb,
- replace: TF
+const FF = Object.freeze({
+ error: TF,
+ ignore: ub,
+ replace: RF
});
-function FF(i, e) {
- e == null && (e = RF.error);
+function NF(i, e) {
+ e == null && (e = FF.error);
const t = dt(i, "bytes"), n = [];
let s = 0;
for (; s < t.length; ) {
@@ -37317,13 +37317,13 @@ function gs(i, e) {
}
return new Uint8Array(t);
}
-function NF(i) {
+function DF(i) {
return i.map((e) => e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10 & 1023) + 55296, (e & 1023) + 56320))).join("");
}
-function th(i, e) {
- return NF(FF(i, e));
+function ih(i, e) {
+ return DF(NF(i, e));
}
-function ub(i) {
+function db(i) {
async function e(t, n) {
ge(n == null || !n.cancelled, "request cancelled before sending", "CANCELLED");
const s = t.url.split(":")[0].toLowerCase();
@@ -37367,44 +37367,44 @@ function ub(i) {
}
return e;
}
-const DF = 12, LF = 250;
-let nm = ub();
-const PF = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"), kF = new RegExp("^ipfs://(ipfs/)?(.*)$", "i");
-let Wu = !1;
-async function db(i, e) {
+const LF = 12, PF = 250;
+let sm = db();
+const kF = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"), UF = new RegExp("^ipfs://(ipfs/)?(.*)$", "i");
+let Ku = !1;
+async function fb(i, e) {
try {
- const t = i.match(PF);
+ const t = i.match(kF);
if (!t)
throw new Error("invalid data");
return new Vs(200, "OK", {
"content-type": t[1] || "text/plain"
- }, t[2] ? SF(t[3]) : OF(t[3]));
+ }, t[2] ? MF(t[3]) : QF(t[3]));
} catch {
- return new Vs(599, "BAD REQUEST (invalid data: URI)", {}, null, new Gi(i));
+ return new Vs(599, "BAD REQUEST (invalid data: URI)", {}, null, new Hi(i));
}
}
-function fb(i) {
+function pb(i) {
async function e(t, n) {
try {
- const s = t.match(kF);
+ const s = t.match(UF);
if (!s)
throw new Error("invalid link");
- return new Gi(`${i}${s[2]}`);
+ return new Hi(`${i}${s[2]}`);
} catch {
- return new Vs(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new Gi(t));
+ return new Vs(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new Hi(t));
}
}
return e;
}
-const Al = {
- data: db,
- ipfs: fb("https://gateway.ipfs.io/ipfs/")
-}, pb = /* @__PURE__ */ new WeakMap();
-class UF {
+const gl = {
+ data: fb,
+ ipfs: pb("https://gateway.ipfs.io/ipfs/")
+}, Ab = /* @__PURE__ */ new WeakMap();
+class OF {
#e;
#t;
constructor(e) {
- this.#e = [], this.#t = !1, pb.set(e, () => {
+ this.#e = [], this.#t = !1, Ab.set(e, () => {
if (!this.#t) {
this.#t = !0;
for (const t of this.#e)
@@ -37427,12 +37427,12 @@ class UF {
ge(!this.cancelled, "cancelled", "CANCELLED", {});
}
}
-function gl(i) {
+function ml(i) {
if (i == null)
throw new Error("missing signal; should not happen");
return i.checkSignal(), i;
}
-class Gi {
+class Hi {
#e;
#t;
#n;
@@ -37520,7 +37520,7 @@ class Gi {
*/
get headers() {
const e = Object.assign({}, this.#n);
- return this.#f && (e.authorization = `Basic ${MF(gs(this.#f))}`), this.allowGzip && (e["accept-encoding"] = "gzip"), e["content-type"] == null && this.#o && (e["content-type"] = this.#o), this.body && (e["content-length"] = String(this.body.length)), e;
+ return this.#f && (e.authorization = `Basic ${BF(gs(this.#f))}`), this.allowGzip && (e["accept-encoding"] = "gzip"), e["content-type"] == null && this.#o && (e["content-type"] = this.#o), this.body && (e["content-length"] = String(this.body.length)), e;
}
/**
* Get the header for %%key%%, ignoring case.
@@ -37655,7 +37655,7 @@ class Gi {
* configurege a proxy or other agent.
*/
get getUrlFunc() {
- return this.#u || nm;
+ return this.#u || sm;
}
set getUrlFunc(e) {
this.#u = e;
@@ -37668,8 +37668,8 @@ class Gi {
*/
constructor(e) {
this.#a = String(e), this.#e = !1, this.#t = !0, this.#n = {}, this.#i = "", this.#s = 3e5, this.#h = {
- slotInterval: LF,
- maxAttempts: DF
+ slotInterval: PF,
+ maxAttempts: LF
}, this.#u = null;
}
toString() {
@@ -37685,19 +37685,19 @@ class Gi {
async #d(e, t, n, s, r) {
if (e >= this.#h.maxAttempts)
return r.makeServerError("exceeded maximum retry limit");
- ge(im() <= t, "timeout", "TIMEOUT", {
+ ge(rm() <= t, "timeout", "TIMEOUT", {
operation: "request.send",
reason: "timeout",
request: s
- }), n > 0 && await QF(n);
+ }), n > 0 && await GF(n);
let a = this.clone();
const o = (a.url.split(":")[0] || "").toLowerCase();
- if (o in Al) {
- const h = await Al[o](a.url, gl(s.#c));
+ if (o in gl) {
+ const h = await gl[o](a.url, ml(s.#c));
if (h instanceof Vs) {
let u = h;
if (this.processFunc) {
- gl(s.#c);
+ ml(s.#c);
try {
u = await this.processFunc(a, u);
} catch (d) {
@@ -37709,7 +37709,7 @@ class Gi {
a = h;
}
this.preflightFunc && (a = await this.preflightFunc(a));
- const c = await this.getUrlFunc(a, gl(s.#c));
+ const c = await this.getUrlFunc(a, ml(s.#c));
let l = new Vs(c.statusCode, c.statusMessage, c.headers, c.body, s);
if (l.statusCode === 301 || l.statusCode === 302) {
try {
@@ -37724,7 +37724,7 @@ class Gi {
return typeof h == "string" && h.match(/^[1-9][0-9]*$/) && (u = parseInt(h)), a.clone().#d(e + 1, t, u, s, l);
}
if (this.processFunc) {
- gl(s.#c);
+ ml(s.#c);
try {
l = await this.processFunc(a, l);
} catch (h) {
@@ -37739,7 +37739,7 @@ class Gi {
* Resolves to the response by sending the request.
*/
send() {
- return ge(this.#c == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }), this.#c = new UF(this), this.#d(0, im() + this.timeout, 0, this, new Vs(0, "", {}, null, this));
+ return ge(this.#c == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }), this.#c = new OF(this), this.#d(0, rm() + this.timeout, 0, this, new Vs(0, "", {}, null, this));
}
/**
* Cancels the inflight response, causing a ``CANCELLED``
@@ -37747,7 +37747,7 @@ class Gi {
*/
cancel() {
ge(this.#c != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" });
- const e = pb.get(this);
+ const e = Ab.get(this);
if (!e)
throw new Error("missing signal; should not happen");
e();
@@ -37761,14 +37761,14 @@ class Gi {
ge(this.method === "GET" && (t !== "https" || n !== "http") && e.match(/^https?:/), "unsupported redirect", "UNSUPPORTED_OPERATION", {
operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`
});
- const s = new Gi(e);
+ const s = new Hi(e);
return s.method = "GET", s.allowGzip = this.allowGzip, s.timeout = this.timeout, s.#n = Object.assign({}, this.#n), this.#r && (s.#r = new Uint8Array(this.#r)), s.#o = this.#o, s;
}
/**
* Create a new copy of this request.
*/
clone() {
- const e = new Gi(this.url);
+ const e = new Hi(this.url);
return e.#i = this.#i, this.#r && (e.#r = this.#r), e.#o = this.#o, e.#n = Object.assign({}, this.#n), e.#f = this.#f, this.allowGzip && (e.allowGzip = !0), e.timeout = this.timeout, this.allowInsecureAuthentication && (e.allowInsecureAuthentication = !0), e.#l = this.#l, e.#p = this.#p, e.#A = this.#A, e.#h = Object.assign({}, this.#h), e.#u = this.#u, e;
}
/**
@@ -37776,13 +37776,13 @@ class Gi {
* registration.
*/
static lockConfig() {
- Wu = !0;
+ Ku = !0;
}
/**
* Get the current Gateway function for %%scheme%%.
*/
static getGateway(e) {
- return Al[e.toLowerCase()] || null;
+ return gl[e.toLowerCase()] || null;
}
/**
* Use the %%func%% when fetching URIs using %%scheme%%.
@@ -37795,9 +37795,9 @@ class Gi {
static registerGateway(e, t) {
if (e = e.toLowerCase(), e === "http" || e === "https")
throw new Error(`cannot intercept ${e}; use registerGetUrl`);
- if (Wu)
+ if (Ku)
throw new Error("gateways locked");
- Al[e] = t;
+ gl[e] = t;
}
/**
* Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.
@@ -37808,9 +37808,9 @@ class Gi {
* throws.
*/
static registerGetUrl(e) {
- if (Wu)
+ if (Ku)
throw new Error("gateways locked");
- nm = e;
+ sm = e;
}
/**
* Creates a getUrl function that fetches content from HTTP and
@@ -37824,7 +37824,7 @@ class Gi {
* content.
*/
static createGetUrlFunc(e) {
- return ub(e);
+ return db(e);
}
/**
* Creates a function that can "fetch" data URIs.
@@ -37836,7 +37836,7 @@ class Gi {
* be useful in a wrapper to perfom custom data URI functionality.
*/
static createDataGateway() {
- return db;
+ return fb;
}
/**
* Creates a function that will fetch IPFS (unvalidated) from
@@ -37846,7 +37846,7 @@ class Gi {
* ``"https:/\/gateway.ipfs.io/ipfs/"``.
*/
static createIpfsGatewayFunc(e) {
- return fb(e);
+ return pb(e);
}
}
class Vs {
@@ -37891,7 +37891,7 @@ class Vs {
*/
get bodyText() {
try {
- return this.#i == null ? "" : th(this.#i);
+ return this.#i == null ? "" : ih(this.#i);
} catch {
ge(!1, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", {
operation: "bodyText",
@@ -37991,7 +37991,7 @@ class Vs {
this.request && (n = this.request.url);
let s = null;
try {
- this.#i && (s = th(this.#i));
+ this.#i && (s = ih(this.#i));
} catch {
}
ge(!1, e, "SERVER_ERROR", {
@@ -38006,31 +38006,31 @@ class Vs {
});
}
}
-function im() {
+function rm() {
return (/* @__PURE__ */ new Date()).getTime();
}
-function OF(i) {
+function QF(i) {
return gs(i.replace(/%([0-9a-f][0-9a-f])/gi, (e, t) => String.fromCharCode(parseInt(t, 16))));
}
-function QF(i) {
+function GF(i) {
return new Promise((e) => setTimeout(e, i));
}
-function GF(i) {
+function HF(i) {
let e = i.toString(16);
for (; e.length < 2; )
e = "0" + e;
return "0x" + e;
}
-function sm(i, e, t) {
+function am(i, e, t) {
let n = 0;
for (let s = 0; s < t; s++)
n = n * 256 + i[e + s];
return n;
}
-function rm(i, e, t, n) {
+function om(i, e, t, n) {
const s = [];
for (; t < e + 1 + n; ) {
- const r = Ab(i, t);
+ const r = gb(i, t);
s.push(r.result), t += r.consumed, ge(t <= e + 1 + n, "child data too short", "BUFFER_OVERRUN", {
buffer: i,
length: n,
@@ -38039,7 +38039,7 @@ function rm(i, e, t, n) {
}
return { consumed: 1 + n, result: s };
}
-function Ab(i, e) {
+function gb(i, e) {
ge(i.length !== 0, "data too short", "BUFFER_OVERRUN", {
buffer: i,
length: 0,
@@ -38055,15 +38055,15 @@ function Ab(i, e) {
if (i[e] >= 248) {
const n = i[e] - 247;
t(e + 1 + n);
- const s = sm(i, e + 1, n);
- return t(e + 1 + n + s), rm(i, e, e + 1 + n, n + s);
+ const s = am(i, e + 1, n);
+ return t(e + 1 + n + s), om(i, e, e + 1 + n, n + s);
} else if (i[e] >= 192) {
const n = i[e] - 192;
- return t(e + 1 + n), rm(i, e, e + 1, n);
+ return t(e + 1 + n), om(i, e, e + 1, n);
} else if (i[e] >= 184) {
const n = i[e] - 183;
t(e + 1 + n);
- const s = sm(i, e + 1, n);
+ const s = am(i, e + 1, n);
t(e + 1 + n + s);
const r = Ie(i.slice(e + 1 + n, e + 1 + n + s));
return { consumed: 1 + n + s, result: r };
@@ -38073,26 +38073,26 @@ function Ab(i, e) {
const s = Ie(i.slice(e + 1, e + 1 + n));
return { consumed: 1 + n, result: s };
}
- return { consumed: 1, result: GF(i[e]) };
+ return { consumed: 1, result: HF(i[e]) };
}
-function gc(i) {
- const e = dt(i, "data"), t = Ab(e, 0);
+function mc(i) {
+ const e = dt(i, "data"), t = gb(e, 0);
return V(t.consumed === e.length, "unexpected junk after rlp payload", "data", i), t.result;
}
-function am(i) {
+function cm(i) {
const e = [];
for (; i; )
e.unshift(i & 255), i >>= 8;
return e;
}
-function gb(i) {
+function mb(i) {
if (Array.isArray(i)) {
let n = [];
if (i.forEach(function(r) {
- n = n.concat(gb(r));
+ n = n.concat(mb(r));
}), n.length <= 55)
return n.unshift(192 + n.length), n;
- const s = am(n.length);
+ const s = cm(n.length);
return s.unshift(247 + s.length), s.concat(n);
}
const e = Array.prototype.slice.call(dt(i, "object"));
@@ -38100,31 +38100,31 @@ function gb(i) {
return e;
if (e.length <= 55)
return e.unshift(128 + e.length), e;
- const t = am(e.length);
+ const t = cm(e.length);
return t.unshift(183 + t.length), t.concat(e);
}
-const om = "0123456789abcdef";
+const lm = "0123456789abcdef";
function ms(i) {
let e = "0x";
- for (const t of gb(i))
- e += om[t >> 4], e += om[t & 15];
+ for (const t of mb(i))
+ e += lm[t >> 4], e += lm[t & 15];
return e;
}
-const Gn = 32, hf = new Uint8Array(Gn), HF = ["then"], ml = {}, mb = /* @__PURE__ */ new WeakMap();
+const Hn = 32, df = new Uint8Array(Hn), zF = ["then"], xl = {}, xb = /* @__PURE__ */ new WeakMap();
function gr(i) {
- return mb.get(i);
+ return xb.get(i);
}
-function cm(i, e) {
- mb.set(i, e);
+function hm(i, e) {
+ xb.set(i, e);
}
-function xo(i, e) {
+function bo(i, e) {
const t = new Error(`deferred error during ABI decoding triggered accessing ${i}`);
throw t.error = e, t;
}
-function uf(i, e, t) {
- return i.indexOf(null) >= 0 ? e.map((n, s) => n instanceof ds ? uf(gr(n), n, t) : n) : i.reduce((n, s, r) => {
+function ff(i, e, t) {
+ return i.indexOf(null) >= 0 ? e.map((n, s) => n instanceof ds ? ff(gr(n), n, t) : n) : i.reduce((n, s, r) => {
let a = e.getValue(s);
- return s in n || (t && a instanceof ds && (a = uf(gr(a), a, t)), n[s] = a), n;
+ return s in n || (t && a instanceof ds && (a = ff(gr(a), a, t)), n[s] = a), n;
}, {});
}
class ds extends Array {
@@ -38138,11 +38138,11 @@ class ds extends Array {
constructor(...e) {
const t = e[0];
let n = e[1], s = (e[2] || []).slice(), r = !0;
- t !== ml && (n = e, s = [], r = !1), super(n.length), n.forEach((c, l) => {
+ t !== xl && (n = e, s = [], r = !1), super(n.length), n.forEach((c, l) => {
this[l] = c;
});
const a = s.reduce((c, l) => (typeof l == "string" && c.set(l, (c.get(l) || 0) + 1), c), /* @__PURE__ */ new Map());
- if (cm(this, Object.freeze(n.map((c, l) => {
+ if (hm(this, Object.freeze(n.map((c, l) => {
const h = s[l];
return h != null && a.get(h) === 1 ? h : null;
}))), this.#e = [], this.#e == null && this.#e, !r)
@@ -38156,9 +38156,9 @@ class ds extends Array {
if (d < 0 || d >= this.length)
throw new RangeError("out of result range");
const f = c[d];
- return f instanceof Error && xo(`index ${d}`, f), f;
+ return f instanceof Error && bo(`index ${d}`, f), f;
}
- if (HF.indexOf(l) >= 0)
+ if (zF.indexOf(l) >= 0)
return Reflect.get(c, l, h);
const u = c[l];
if (u instanceof Function)
@@ -38171,7 +38171,7 @@ class ds extends Array {
return Reflect.get(c, l, h);
}
});
- return cm(o, gr(this)), o;
+ return hm(o, gr(this)), o;
}
/**
* Returns the Result as a normal Array. If %%deep%%, any children
@@ -38183,7 +38183,7 @@ class ds extends Array {
toArray(e) {
const t = [];
return this.forEach((n, s) => {
- n instanceof Error && xo(`index ${s}`, n), e && n instanceof ds && (n = n.toArray(e)), t.push(n);
+ n instanceof Error && bo(`index ${s}`, n), e && n instanceof ds && (n = n.toArray(e)), t.push(n);
}), t;
}
/**
@@ -38198,7 +38198,7 @@ class ds extends Array {
const t = gr(this);
return t.reduce((n, s, r) => (ge(s != null, `value at index ${r} unnamed`, "UNSUPPORTED_OPERATION", {
operation: "toObject()"
- }), uf(t, this, e)), {});
+ }), ff(t, this, e)), {});
}
/**
* @_ignore
@@ -38208,7 +38208,7 @@ class ds extends Array {
const n = gr(this), s = [], r = [];
for (let a = e; a < t; a++)
s.push(this[a]), r.push(n[a]);
- return new ds(ml, s, r);
+ return new ds(xl, s, r);
}
/**
* @_ignore
@@ -38217,9 +38217,9 @@ class ds extends Array {
const n = gr(this), s = [], r = [];
for (let a = 0; a < this.length; a++) {
const o = this[a];
- o instanceof Error && xo(`index ${a}`, o), e.call(t, o, a, this) && (s.push(o), r.push(n[a]));
+ o instanceof Error && bo(`index ${a}`, o), e.call(t, o, a, this) && (s.push(o), r.push(n[a]));
}
- return new ds(ml, s, r);
+ return new ds(xl, s, r);
}
/**
* @_ignore
@@ -38228,7 +38228,7 @@ class ds extends Array {
const n = [];
for (let s = 0; s < this.length; s++) {
const r = this[s];
- r instanceof Error && xo(`index ${s}`, r), n.push(e.call(t, r, s, this));
+ r instanceof Error && bo(`index ${s}`, r), n.push(e.call(t, r, s, this));
}
return n;
}
@@ -38245,19 +38245,19 @@ class ds extends Array {
if (t === -1)
return;
const n = this[t];
- return n instanceof Error && xo(`property ${JSON.stringify(e)}`, n.error), n;
+ return n instanceof Error && bo(`property ${JSON.stringify(e)}`, n.error), n;
}
/**
* Creates a new [[Result]] for %%items%% with each entry
* also accessible by its corresponding name in %%keys%%.
*/
static fromItems(e, t) {
- return new ds(ml, e, t);
+ return new ds(xl, e, t);
}
}
-function lm(i) {
+function um(i) {
let e = rn(i);
- return ge(e.length <= Gn, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: e, length: Gn, offset: e.length }), e.length !== Gn && (e = On(Ht([hf.slice(e.length % Gn), e]))), e;
+ return ge(e.length <= Hn, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: e, length: Hn, offset: e.length }), e.length !== Hn && (e = Qn(Ht([df.slice(e.length % Hn), e]))), e;
}
class _s {
// The coder name:
@@ -38285,7 +38285,7 @@ class _s {
V(!1, e, this.localName, t);
}
}
-class df {
+class pf {
// An array of WordSize lengthed objects to concatenation
#e;
#t;
@@ -38302,28 +38302,28 @@ class df {
return this.#e.push(e), this.#t += e.length, e.length;
}
appendWriter(e) {
- return this.#n(On(e.data));
+ return this.#n(Qn(e.data));
}
// Arrayish item; pad on the right to *nearest* WordSize
writeBytes(e) {
- let t = On(e);
- const n = t.length % Gn;
- return n && (t = On(Ht([t, hf.slice(n)]))), this.#n(t);
+ let t = Qn(e);
+ const n = t.length % Hn;
+ return n && (t = Qn(Ht([t, df.slice(n)]))), this.#n(t);
}
// Numeric item; pad on the left *to* WordSize
writeValue(e) {
- return this.#n(lm(e));
+ return this.#n(um(e));
}
// Inserts a numeric place-holder, returning a callback that can
// be used to asjust the value later
writeUpdatableValue() {
const e = this.#e.length;
- return this.#e.push(hf), this.#t += Gn, (t) => {
- this.#e[e] = lm(t);
+ return this.#e.push(df), this.#t += Hn, (t) => {
+ this.#e[e] = um(t);
};
}
}
-class mp {
+class bp {
// Allows incomplete unpadded data to be read; otherwise an error
// is raised if attempting to overrun the buffer. This is required
// to deal with an old Solidity bug, in which event data for
@@ -38335,7 +38335,7 @@ class mp {
#i;
#s;
constructor(e, t, n) {
- Ye(this, { allowLoose: !!t }), this.#e = On(e), this.#n = 0, this.#i = null, this.#s = n ?? 1024, this.#t = 0;
+ Ye(this, { allowLoose: !!t }), this.#e = Qn(e), this.#n = 0, this.#i = null, this.#s = n ?? 1024, this.#t = 0;
}
get data() {
return Ie(this.#e);
@@ -38353,7 +38353,7 @@ class mp {
if (this.#i)
return this.#i.#a(e);
this.#n += e, ge(this.#s < 1 || this.#n <= this.#s * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
- buffer: On(this.#e),
+ buffer: Qn(this.#e),
offset: this.#t,
length: e,
info: {
@@ -38363,16 +38363,16 @@ class mp {
});
}
#r(e, t, n) {
- let s = Math.ceil(t / Gn) * Gn;
+ let s = Math.ceil(t / Hn) * Hn;
return this.#t + s > this.#e.length && (this.allowLoose && n && this.#t + t <= this.#e.length ? s = t : ge(!1, "data out-of-bounds", "BUFFER_OVERRUN", {
- buffer: On(this.#e),
+ buffer: Qn(this.#e),
length: this.#e.length,
offset: this.#t + s
})), this.#e.slice(this.#t, this.#t + s);
}
// Create a sub-reader with the same underlying data, but offset
subReader(e) {
- const t = new mp(this.#e.slice(this.#t + e), this.allowLoose, this.#s);
+ const t = new bp(this.#e.slice(this.#t + e), this.allowLoose, this.#s);
return t.#i = this, t;
}
// Read bytes
@@ -38382,81 +38382,81 @@ class mp {
}
// Read a numeric values
readValue() {
- return gp(this.readBytes(Gn));
+ return xp(this.readBytes(Hn));
}
readIndex() {
- return CF(this.readBytes(Gn));
+ return IF(this.readBytes(Hn));
}
}
-function nh(i) {
+function sh(i) {
if (!Number.isSafeInteger(i) || i < 0)
throw new Error(`Wrong positive integer: ${i}`);
}
-function xp(i, ...e) {
+function Ep(i, ...e) {
if (!(i instanceof Uint8Array))
throw new Error("Expected Uint8Array");
if (e.length > 0 && !e.includes(i.length))
throw new Error(`Expected Uint8Array of length ${e}, not of length=${i.length}`);
}
-function zF(i) {
+function VF(i) {
if (typeof i != "function" || typeof i.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
- nh(i.outputLen), nh(i.blockLen);
+ sh(i.outputLen), sh(i.blockLen);
}
-function Ua(i, e = !0) {
+function Oa(i, e = !0) {
if (i.destroyed)
throw new Error("Hash instance has been destroyed");
if (e && i.finished)
throw new Error("Hash#digest() has already been called");
}
-function xb(i, e) {
- xp(i);
+function bb(i, e) {
+ Ep(i);
const t = e.outputLen;
if (i.length < t)
throw new Error(`digestInto() expects output buffer of length at least ${t}`);
}
-const qu = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
-const bb = (i) => i instanceof Uint8Array, VF = (i) => new Uint32Array(i.buffer, i.byteOffset, Math.floor(i.byteLength / 4)), Ku = (i) => new DataView(i.buffer, i.byteOffset, i.byteLength), Li = (i, e) => i << 32 - e | i >>> e, WF = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
-if (!WF)
+const ju = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
+const Eb = (i) => i instanceof Uint8Array, WF = (i) => new Uint32Array(i.buffer, i.byteOffset, Math.floor(i.byteLength / 4)), Xu = (i) => new DataView(i.buffer, i.byteOffset, i.byteLength), Pi = (i, e) => i << 32 - e | i >>> e, qF = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
+if (!qF)
throw new Error("Non little-endian hardware is not supported");
-function qF(i) {
+function KF(i) {
if (typeof i != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof i}`);
return new Uint8Array(new TextEncoder().encode(i));
}
-function Ih(i) {
- if (typeof i == "string" && (i = qF(i)), !bb(i))
+function Mh(i) {
+ if (typeof i == "string" && (i = KF(i)), !Eb(i))
throw new Error(`expected Uint8Array, got ${typeof i}`);
return i;
}
-function KF(...i) {
+function jF(...i) {
const e = new Uint8Array(i.reduce((n, s) => n + s.length, 0));
let t = 0;
return i.forEach((n) => {
- if (!bb(n))
+ if (!Eb(n))
throw new Error("Uint8Array expected");
e.set(n, t), t += n.length;
}), e;
}
-class bp {
+class yp {
// Safe version that clones internal state
clone() {
return this._cloneInto();
}
}
-function Ep(i) {
- const e = (n) => i().update(Ih(n)).digest(), t = i();
+function _p(i) {
+ const e = (n) => i().update(Mh(n)).digest(), t = i();
return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => i(), e;
}
-function jF(i = 32) {
- if (qu && typeof qu.getRandomValues == "function")
- return qu.getRandomValues(new Uint8Array(i));
+function XF(i = 32) {
+ if (ju && typeof ju.getRandomValues == "function")
+ return ju.getRandomValues(new Uint8Array(i));
throw new Error("crypto.getRandomValues must be defined");
}
-class Eb extends bp {
+class yb extends yp {
constructor(e, t) {
- super(), this.finished = !1, this.destroyed = !1, zF(e);
- const n = Ih(t);
+ super(), this.finished = !1, this.destroyed = !1, VF(e);
+ const n = Mh(t);
if (this.iHash = e.create(), typeof this.iHash.update != "function")
throw new Error("Expected instance of class which extends utils.Hash");
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
@@ -38470,10 +38470,10 @@ class Eb extends bp {
this.oHash.update(r), r.fill(0);
}
update(e) {
- return Ua(this), this.iHash.update(e), this;
+ return Oa(this), this.iHash.update(e), this;
}
digestInto(e) {
- Ua(this), xp(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
+ Oa(this), Ep(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
}
digest() {
const e = new Uint8Array(this.oHash.outputLen);
@@ -38488,27 +38488,27 @@ class Eb extends bp {
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
}
}
-const yb = (i, e, t) => new Eb(i, e).update(t).digest();
-yb.create = (i, e) => new Eb(i, e);
-function XF(i, e, t, n) {
+const _b = (i, e, t) => new yb(i, e).update(t).digest();
+_b.create = (i, e) => new yb(i, e);
+function YF(i, e, t, n) {
if (typeof i.setBigUint64 == "function")
return i.setBigUint64(e, t, n);
const s = BigInt(32), r = BigInt(4294967295), a = Number(t >> s & r), o = Number(t & r), c = n ? 4 : 0, l = n ? 0 : 4;
i.setUint32(e + c, a, n), i.setUint32(e + l, o, n);
}
-class _b extends bp {
+class wb extends yp {
constructor(e, t, n, s) {
- super(), this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = s, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Ku(this.buffer);
+ super(), this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = s, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Xu(this.buffer);
}
update(e) {
- Ua(this);
+ Oa(this);
const { view: t, buffer: n, blockLen: s } = this;
- e = Ih(e);
+ e = Mh(e);
const r = e.length;
for (let a = 0; a < r; ) {
const o = Math.min(s - this.pos, r - a);
if (o === s) {
- const c = Ku(e);
+ const c = Xu(e);
for (; s <= r - a; a += s)
this.process(c, a);
continue;
@@ -38518,14 +38518,14 @@ class _b extends bp {
return this.length += e.length, this.roundClean(), this;
}
digestInto(e) {
- Ua(this), xb(e, this), this.finished = !0;
+ Oa(this), bb(e, this), this.finished = !0;
const { buffer: t, view: n, blockLen: s, isLE: r } = this;
let { pos: a } = this;
t[a++] = 128, this.buffer.subarray(a).fill(0), this.padOffset > s - a && (this.process(n, 0), a = 0);
for (let u = a; u < s; u++)
t[u] = 0;
- XF(n, s - 8, BigInt(this.length * 8), r), this.process(n, 0);
- const o = Ku(e), c = this.outputLen;
+ YF(n, s - 8, BigInt(this.length * 8), r), this.process(n, 0);
+ const o = Xu(e), c = this.outputLen;
if (c % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const l = c / 4, h = this.get();
@@ -38546,7 +38546,7 @@ class _b extends bp {
return e.length = s, e.pos = o, e.finished = r, e.destroyed = a, s % t && e.buffer.set(n), e;
}
}
-const YF = (i, e, t) => i & e ^ ~i & t, JF = (i, e, t) => i & e ^ i & t ^ e & t, ZF = /* @__PURE__ */ new Uint32Array([
+const JF = (i, e, t) => i & e ^ ~i & t, ZF = (i, e, t) => i & e ^ i & t ^ e & t, $F = /* @__PURE__ */ new Uint32Array([
1116352408,
1899447441,
3049323471,
@@ -38621,7 +38621,7 @@ const YF = (i, e, t) => i & e ^ ~i & t, JF = (i, e, t) => i & e ^ i & t ^ e & t,
528734635,
1541459225
]), Ds = /* @__PURE__ */ new Uint32Array(64);
-class $F extends _b {
+class eN extends wb {
constructor() {
super(64, 32, 8, !1), this.A = Ns[0] | 0, this.B = Ns[1] | 0, this.C = Ns[2] | 0, this.D = Ns[3] | 0, this.E = Ns[4] | 0, this.F = Ns[5] | 0, this.G = Ns[6] | 0, this.H = Ns[7] | 0;
}
@@ -38637,12 +38637,12 @@ class $F extends _b {
for (let u = 0; u < 16; u++, t += 4)
Ds[u] = e.getUint32(t, !1);
for (let u = 16; u < 64; u++) {
- const d = Ds[u - 15], f = Ds[u - 2], p = Li(d, 7) ^ Li(d, 18) ^ d >>> 3, m = Li(f, 17) ^ Li(f, 19) ^ f >>> 10;
+ const d = Ds[u - 15], f = Ds[u - 2], p = Pi(d, 7) ^ Pi(d, 18) ^ d >>> 3, m = Pi(f, 17) ^ Pi(f, 19) ^ f >>> 10;
Ds[u] = m + Ds[u - 7] + p + Ds[u - 16] | 0;
}
let { A: n, B: s, C: r, D: a, E: o, F: c, G: l, H: h } = this;
for (let u = 0; u < 64; u++) {
- const d = Li(o, 6) ^ Li(o, 11) ^ Li(o, 25), f = h + d + YF(o, c, l) + ZF[u] + Ds[u] | 0, m = (Li(n, 2) ^ Li(n, 13) ^ Li(n, 22)) + JF(n, s, r) | 0;
+ const d = Pi(o, 6) ^ Pi(o, 11) ^ Pi(o, 25), f = h + d + JF(o, c, l) + $F[u] + Ds[u] | 0, m = (Pi(n, 2) ^ Pi(n, 13) ^ Pi(n, 22)) + ZF(n, s, r) | 0;
h = l, l = c, c = o, o = a + f | 0, a = r, r = s, s = n, n = f + m | 0;
}
n = n + this.A | 0, s = s + this.B | 0, r = r + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, h = h + this.H | 0, this.set(n, s, r, a, o, c, l, h);
@@ -38654,47 +38654,47 @@ class $F extends _b {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
}
-const wb = /* @__PURE__ */ Ep(() => new $F()), xl = /* @__PURE__ */ BigInt(2 ** 32 - 1), ff = /* @__PURE__ */ BigInt(32);
-function vb(i, e = !1) {
- return e ? { h: Number(i & xl), l: Number(i >> ff & xl) } : { h: Number(i >> ff & xl) | 0, l: Number(i & xl) | 0 };
-}
+const vb = /* @__PURE__ */ _p(() => new eN()), bl = /* @__PURE__ */ BigInt(2 ** 32 - 1), Af = /* @__PURE__ */ BigInt(32);
function Cb(i, e = !1) {
+ return e ? { h: Number(i & bl), l: Number(i >> Af & bl) } : { h: Number(i >> Af & bl) | 0, l: Number(i & bl) | 0 };
+}
+function Ib(i, e = !1) {
let t = new Uint32Array(i.length), n = new Uint32Array(i.length);
for (let s = 0; s < i.length; s++) {
- const { h: r, l: a } = vb(i[s], e);
+ const { h: r, l: a } = Cb(i[s], e);
[t[s], n[s]] = [r, a];
}
return [t, n];
}
-const eN = (i, e) => BigInt(i >>> 0) << ff | BigInt(e >>> 0), tN = (i, e, t) => i >>> t, nN = (i, e, t) => i << 32 - t | e >>> t, iN = (i, e, t) => i >>> t | e << 32 - t, sN = (i, e, t) => i << 32 - t | e >>> t, rN = (i, e, t) => i << 64 - t | e >>> t - 32, aN = (i, e, t) => i >>> t - 32 | e << 64 - t, oN = (i, e) => e, cN = (i, e) => i, Ib = (i, e, t) => i << t | e >>> 32 - t, Sb = (i, e, t) => e << t | i >>> 32 - t, Mb = (i, e, t) => e << t - 32 | i >>> 64 - t, Bb = (i, e, t) => i << t - 32 | e >>> 64 - t;
-function lN(i, e, t, n) {
+const tN = (i, e) => BigInt(i >>> 0) << Af | BigInt(e >>> 0), nN = (i, e, t) => i >>> t, iN = (i, e, t) => i << 32 - t | e >>> t, sN = (i, e, t) => i >>> t | e << 32 - t, rN = (i, e, t) => i << 32 - t | e >>> t, aN = (i, e, t) => i << 64 - t | e >>> t - 32, oN = (i, e, t) => i >>> t - 32 | e << 64 - t, cN = (i, e) => e, lN = (i, e) => i, Sb = (i, e, t) => i << t | e >>> 32 - t, Mb = (i, e, t) => e << t | i >>> 32 - t, Bb = (i, e, t) => e << t - 32 | i >>> 64 - t, Tb = (i, e, t) => i << t - 32 | e >>> 64 - t;
+function hN(i, e, t, n) {
const s = (e >>> 0) + (n >>> 0);
return { h: i + t + (s / 2 ** 32 | 0) | 0, l: s | 0 };
}
-const hN = (i, e, t) => (i >>> 0) + (e >>> 0) + (t >>> 0), uN = (i, e, t, n) => e + t + n + (i / 2 ** 32 | 0) | 0, dN = (i, e, t, n) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0), fN = (i, e, t, n, s) => e + t + n + s + (i / 2 ** 32 | 0) | 0, pN = (i, e, t, n, s) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0) + (s >>> 0), AN = (i, e, t, n, s, r) => e + t + n + s + r + (i / 2 ** 32 | 0) | 0, ct = {
- fromBig: vb,
- split: Cb,
- toBig: eN,
- shrSH: tN,
- shrSL: nN,
- rotrSH: iN,
- rotrSL: sN,
- rotrBH: rN,
- rotrBL: aN,
- rotr32H: oN,
- rotr32L: cN,
- rotlSH: Ib,
- rotlSL: Sb,
- rotlBH: Mb,
- rotlBL: Bb,
- add: lN,
- add3L: hN,
- add3H: uN,
- add4L: dN,
- add4H: fN,
- add5H: AN,
- add5L: pN
-}, [gN, mN] = ct.split([
+const uN = (i, e, t) => (i >>> 0) + (e >>> 0) + (t >>> 0), dN = (i, e, t, n) => e + t + n + (i / 2 ** 32 | 0) | 0, fN = (i, e, t, n) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0), pN = (i, e, t, n, s) => e + t + n + s + (i / 2 ** 32 | 0) | 0, AN = (i, e, t, n, s) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0) + (s >>> 0), gN = (i, e, t, n, s, r) => e + t + n + s + r + (i / 2 ** 32 | 0) | 0, ct = {
+ fromBig: Cb,
+ split: Ib,
+ toBig: tN,
+ shrSH: nN,
+ shrSL: iN,
+ rotrSH: sN,
+ rotrSL: rN,
+ rotrBH: aN,
+ rotrBL: oN,
+ rotr32H: cN,
+ rotr32L: lN,
+ rotlSH: Sb,
+ rotlSL: Mb,
+ rotlBH: Bb,
+ rotlBL: Tb,
+ add: hN,
+ add3L: uN,
+ add3H: dN,
+ add4L: fN,
+ add4H: pN,
+ add5H: gN,
+ add5L: AN
+}, [mN, xN] = ct.split([
"0x428a2f98d728ae22",
"0x7137449123ef65cd",
"0xb5c0fbcfec4d3b2f",
@@ -38776,7 +38776,7 @@ const hN = (i, e, t) => (i >>> 0) + (e >>> 0) + (t >>> 0), uN = (i, e, t, n) =>
"0x5fcb6fab3ad6faec",
"0x6c44198c4a475817"
].map((i) => BigInt(i))), Ls = /* @__PURE__ */ new Uint32Array(80), Ps = /* @__PURE__ */ new Uint32Array(80);
-class xN extends _b {
+class bN extends wb {
constructor() {
super(128, 64, 16, !1), this.Ah = 1779033703, this.Al = -205731576, this.Bh = -1150833019, this.Bl = -2067093701, this.Ch = 1013904242, this.Cl = -23791573, this.Dh = -1521486534, this.Dl = 1595750129, this.Eh = 1359893119, this.El = -1377402159, this.Fh = -1694144372, this.Fl = 725511199, this.Gh = 528734635, this.Gl = -79577749, this.Hh = 1541459225, this.Hl = 327033209;
}
@@ -38798,7 +38798,7 @@ class xN extends _b {
}
let { Ah: n, Al: s, Bh: r, Bl: a, Ch: o, Cl: c, Dh: l, Dl: h, Eh: u, El: d, Fh: f, Fl: p, Gh: m, Gl: g, Hh: A, Hl: _ } = this;
for (let x = 0; x < 80; x++) {
- const E = ct.rotrSH(u, d, 14) ^ ct.rotrSH(u, d, 18) ^ ct.rotrBH(u, d, 41), S = ct.rotrSL(u, d, 14) ^ ct.rotrSL(u, d, 18) ^ ct.rotrBL(u, d, 41), w = u & f ^ ~u & m, I = d & p ^ ~d & g, T = ct.add5L(_, S, I, mN[x], Ps[x]), C = ct.add5H(T, A, E, w, gN[x], Ls[x]), v = T | 0, F = ct.rotrSH(n, s, 28) ^ ct.rotrBH(n, s, 34) ^ ct.rotrBH(n, s, 39), K = ct.rotrSL(n, s, 28) ^ ct.rotrBL(n, s, 34) ^ ct.rotrBL(n, s, 39), q = n & r ^ n & o ^ r & o, $ = s & a ^ s & c ^ a & c;
+ const E = ct.rotrSH(u, d, 14) ^ ct.rotrSH(u, d, 18) ^ ct.rotrBH(u, d, 41), S = ct.rotrSL(u, d, 14) ^ ct.rotrSL(u, d, 18) ^ ct.rotrBL(u, d, 41), w = u & f ^ ~u & m, I = d & p ^ ~d & g, T = ct.add5L(_, S, I, xN[x], Ps[x]), C = ct.add5H(T, A, E, w, mN[x], Ls[x]), v = T | 0, F = ct.rotrSH(n, s, 28) ^ ct.rotrBH(n, s, 34) ^ ct.rotrBH(n, s, 39), K = ct.rotrSL(n, s, 28) ^ ct.rotrBL(n, s, 34) ^ ct.rotrBL(n, s, 39), q = n & r ^ n & o ^ r & o, $ = s & a ^ s & c ^ a & c;
A = m | 0, _ = g | 0, m = f | 0, g = p | 0, f = u | 0, p = d | 0, { h: u, l: d } = ct.add(l | 0, h | 0, C | 0, v | 0), l = o | 0, h = c | 0, o = r | 0, c = a | 0, r = n | 0, a = s | 0;
const D = ct.add3L(v, K, $);
n = ct.add3H(D, C, F, q), s = D | 0;
@@ -38812,8 +38812,8 @@ class xN extends _b {
this.buffer.fill(0), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
}
-const bN = /* @__PURE__ */ Ep(() => new xN());
-function EN() {
+const EN = /* @__PURE__ */ _p(() => new bN());
+function yN() {
if (typeof self < "u")
return self;
if (typeof window < "u")
@@ -38822,39 +38822,39 @@ function EN() {
return global;
throw new Error("unable to locate global object");
}
-const hm = EN();
-hm.crypto || hm.msCrypto;
-function yN(i) {
+const dm = yN();
+dm.crypto || dm.msCrypto;
+function _N(i) {
switch (i) {
case "sha256":
- return wb.create();
+ return vb.create();
case "sha512":
- return bN.create();
+ return EN.create();
}
V(!1, "invalid hashing algorithm name", "algorithm", i);
}
-const [Tb, Rb, Fb] = [[], [], []], _N = /* @__PURE__ */ BigInt(0), bo = /* @__PURE__ */ BigInt(1), wN = /* @__PURE__ */ BigInt(2), vN = /* @__PURE__ */ BigInt(7), CN = /* @__PURE__ */ BigInt(256), IN = /* @__PURE__ */ BigInt(113);
-for (let i = 0, e = bo, t = 1, n = 0; i < 24; i++) {
- [t, n] = [n, (2 * t + 3 * n) % 5], Tb.push(2 * (5 * n + t)), Rb.push((i + 1) * (i + 2) / 2 % 64);
- let s = _N;
+const [Rb, Fb, Nb] = [[], [], []], wN = /* @__PURE__ */ BigInt(0), Eo = /* @__PURE__ */ BigInt(1), vN = /* @__PURE__ */ BigInt(2), CN = /* @__PURE__ */ BigInt(7), IN = /* @__PURE__ */ BigInt(256), SN = /* @__PURE__ */ BigInt(113);
+for (let i = 0, e = Eo, t = 1, n = 0; i < 24; i++) {
+ [t, n] = [n, (2 * t + 3 * n) % 5], Rb.push(2 * (5 * n + t)), Fb.push((i + 1) * (i + 2) / 2 % 64);
+ let s = wN;
for (let r = 0; r < 7; r++)
- e = (e << bo ^ (e >> vN) * IN) % CN, e & wN && (s ^= bo << (bo << /* @__PURE__ */ BigInt(r)) - bo);
- Fb.push(s);
+ e = (e << Eo ^ (e >> CN) * SN) % IN, e & vN && (s ^= Eo << (Eo << /* @__PURE__ */ BigInt(r)) - Eo);
+ Nb.push(s);
}
-const [SN, MN] = /* @__PURE__ */ Cb(Fb, !0), um = (i, e, t) => t > 32 ? Mb(i, e, t) : Ib(i, e, t), dm = (i, e, t) => t > 32 ? Bb(i, e, t) : Sb(i, e, t);
-function BN(i, e = 24) {
+const [MN, BN] = /* @__PURE__ */ Ib(Nb, !0), fm = (i, e, t) => t > 32 ? Bb(i, e, t) : Sb(i, e, t), pm = (i, e, t) => t > 32 ? Tb(i, e, t) : Mb(i, e, t);
+function TN(i, e = 24) {
const t = new Uint32Array(10);
for (let n = 24 - e; n < 24; n++) {
for (let a = 0; a < 10; a++)
t[a] = i[a] ^ i[a + 10] ^ i[a + 20] ^ i[a + 30] ^ i[a + 40];
for (let a = 0; a < 10; a += 2) {
- const o = (a + 8) % 10, c = (a + 2) % 10, l = t[c], h = t[c + 1], u = um(l, h, 1) ^ t[o], d = dm(l, h, 1) ^ t[o + 1];
+ const o = (a + 8) % 10, c = (a + 2) % 10, l = t[c], h = t[c + 1], u = fm(l, h, 1) ^ t[o], d = pm(l, h, 1) ^ t[o + 1];
for (let f = 0; f < 50; f += 10)
i[a + f] ^= u, i[a + f + 1] ^= d;
}
let s = i[2], r = i[3];
for (let a = 0; a < 24; a++) {
- const o = Rb[a], c = um(s, r, o), l = dm(s, r, o), h = Tb[a];
+ const o = Fb[a], c = fm(s, r, o), l = pm(s, r, o), h = Rb[a];
s = i[h], r = i[h + 1], i[h] = c, i[h + 1] = l;
}
for (let a = 0; a < 50; a += 10) {
@@ -38863,24 +38863,24 @@ function BN(i, e = 24) {
for (let o = 0; o < 10; o++)
i[a + o] ^= ~t[(o + 2) % 10] & t[(o + 4) % 10];
}
- i[0] ^= SN[n], i[1] ^= MN[n];
+ i[0] ^= MN[n], i[1] ^= BN[n];
}
t.fill(0);
}
-class yp extends bp {
+class wp extends yp {
// NOTE: we accept arguments in bytes instead of bits here.
constructor(e, t, n, s = !1, r = 24) {
- if (super(), this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = s, this.rounds = r, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, nh(n), 0 >= this.blockLen || this.blockLen >= 200)
+ if (super(), this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = s, this.rounds = r, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, sh(n), 0 >= this.blockLen || this.blockLen >= 200)
throw new Error("Sha3 supports only keccak-f1600 function");
- this.state = new Uint8Array(200), this.state32 = VF(this.state);
+ this.state = new Uint8Array(200), this.state32 = WF(this.state);
}
keccak() {
- BN(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
+ TN(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
}
update(e) {
- Ua(this);
+ Oa(this);
const { blockLen: t, state: n } = this;
- e = Ih(e);
+ e = Mh(e);
const s = e.length;
for (let r = 0; r < s; ) {
const a = Math.min(t - this.pos, s - r);
@@ -38898,7 +38898,7 @@ class yp extends bp {
e[n] ^= t, (t & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
}
writeInto(e) {
- Ua(this, !1), xp(e), this.finish();
+ Oa(this, !1), Ep(e), this.finish();
const t = this.state, { blockLen: n } = this;
for (let s = 0, r = e.length; s < r; ) {
this.posOut >= n && this.keccak();
@@ -38913,10 +38913,10 @@ class yp extends bp {
return this.writeInto(e);
}
xof(e) {
- return nh(e), this.xofInto(new Uint8Array(e));
+ return sh(e), this.xofInto(new Uint8Array(e));
}
digestInto(e) {
- if (xb(e, this), this.finished)
+ if (bb(e, this), this.finished)
throw new Error("digest() was already called");
return this.writeInto(e), this.destroy(), e;
}
@@ -38928,64 +38928,64 @@ class yp extends bp {
}
_cloneInto(e) {
const { blockLen: t, suffix: n, outputLen: s, rounds: r, enableXOF: a } = this;
- return e || (e = new yp(t, n, s, a, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = n, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
+ return e || (e = new wp(t, n, s, a, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = n, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
}
}
-const TN = (i, e, t) => Ep(() => new yp(e, i, t)), RN = /* @__PURE__ */ TN(1, 136, 256 / 8);
-let Nb = !1;
-const Db = function(i) {
- return RN(i);
+const RN = (i, e, t) => _p(() => new wp(e, i, t)), FN = /* @__PURE__ */ RN(1, 136, 256 / 8);
+let Db = !1;
+const Lb = function(i) {
+ return FN(i);
};
-let Lb = Db;
+let Pb = Lb;
function sn(i) {
const e = dt(i, "data");
- return Ie(Lb(e));
+ return Ie(Pb(e));
}
-sn._ = Db;
+sn._ = Lb;
sn.lock = function() {
- Nb = !0;
+ Db = !0;
};
sn.register = function(i) {
- if (Nb)
+ if (Db)
throw new TypeError("keccak256 is locked");
- Lb = i;
+ Pb = i;
};
Object.freeze(sn);
-const Pb = function(i) {
- return yN("sha256").update(i).digest();
+const kb = function(i) {
+ return _N("sha256").update(i).digest();
};
-let kb = Pb, Ub = !1;
-function Ja(i) {
+let Ub = kb, Ob = !1;
+function Za(i) {
const e = dt(i, "data");
- return Ie(kb(e));
+ return Ie(Ub(e));
}
-Ja._ = Pb;
-Ja.lock = function() {
- Ub = !0;
+Za._ = kb;
+Za.lock = function() {
+ Ob = !0;
};
-Ja.register = function(i) {
- if (Ub)
+Za.register = function(i) {
+ if (Ob)
throw new Error("sha256 is locked");
- kb = i;
+ Ub = i;
};
-Object.freeze(Ja);
-Object.freeze(Ja);
+Object.freeze(Za);
+Object.freeze(Za);
BigInt(0);
-const FN = BigInt(1), NN = BigInt(2), Sh = (i) => i instanceof Uint8Array, DN = /* @__PURE__ */ Array.from({ length: 256 }, (i, e) => e.toString(16).padStart(2, "0"));
-function Oa(i) {
- if (!Sh(i))
+const NN = BigInt(1), DN = BigInt(2), Bh = (i) => i instanceof Uint8Array, LN = /* @__PURE__ */ Array.from({ length: 256 }, (i, e) => e.toString(16).padStart(2, "0"));
+function Qa(i) {
+ if (!Bh(i))
throw new Error("Uint8Array expected");
let e = "";
for (let t = 0; t < i.length; t++)
- e += DN[i[t]];
+ e += LN[i[t]];
return e;
}
-function _p(i) {
+function vp(i) {
if (typeof i != "string")
throw new Error("hex string expected, got " + typeof i);
return BigInt(i === "" ? "0" : `0x${i}`);
}
-function nc(i) {
+function ic(i) {
if (typeof i != "string")
throw new Error("hex string expected, got " + typeof i);
const e = i.length;
@@ -39001,28 +39001,28 @@ function nc(i) {
return t;
}
function Ir(i) {
- return _p(Oa(i));
+ return vp(Qa(i));
}
-function wp(i) {
- if (!Sh(i))
+function Cp(i) {
+ if (!Bh(i))
throw new Error("Uint8Array expected");
- return _p(Oa(Uint8Array.from(i).reverse()));
+ return vp(Qa(Uint8Array.from(i).reverse()));
}
-function Qa(i, e) {
- return nc(i.toString(16).padStart(e * 2, "0"));
+function Ga(i, e) {
+ return ic(i.toString(16).padStart(e * 2, "0"));
}
-function vp(i, e) {
- return Qa(i, e).reverse();
+function Ip(i, e) {
+ return Ga(i, e).reverse();
}
-function yi(i, e, t) {
+function _i(i, e, t) {
let n;
if (typeof e == "string")
try {
- n = nc(e);
+ n = ic(e);
} catch (r) {
throw new Error(`${i} must be valid hex string, got "${e}". Cause: ${r}`);
}
- else if (Sh(e))
+ else if (Bh(e))
n = Uint8Array.from(e);
else
throw new Error(`${i} must be hex string or Uint8Array`);
@@ -39031,28 +39031,28 @@ function yi(i, e, t) {
throw new Error(`${i} expected ${t} bytes, got ${s}`);
return n;
}
-function ic(...i) {
+function sc(...i) {
const e = new Uint8Array(i.reduce((n, s) => n + s.length, 0));
let t = 0;
return i.forEach((n) => {
- if (!Sh(n))
+ if (!Bh(n))
throw new Error("Uint8Array expected");
e.set(n, t), t += n.length;
}), e;
}
-const Cp = (i) => (NN << BigInt(i - 1)) - FN, ju = (i) => new Uint8Array(i), fm = (i) => Uint8Array.from(i);
-function Ob(i, e, t) {
+const Sp = (i) => (DN << BigInt(i - 1)) - NN, Yu = (i) => new Uint8Array(i), Am = (i) => Uint8Array.from(i);
+function Qb(i, e, t) {
if (typeof i != "number" || i < 2)
throw new Error("hashLen must be a number");
if (typeof e != "number" || e < 2)
throw new Error("qByteLen must be a number");
if (typeof t != "function")
throw new Error("hmacFn must be a function");
- let n = ju(i), s = ju(i), r = 0;
+ let n = Yu(i), s = Yu(i), r = 0;
const a = () => {
n.fill(1), s.fill(0), r = 0;
- }, o = (...u) => t(s, n, ...u), c = (u = ju()) => {
- s = o(fm([0]), u), n = o(), u.length !== 0 && (s = o(fm([1]), u), n = o());
+ }, o = (...u) => t(s, n, ...u), c = (u = Yu()) => {
+ s = o(Am([0]), u), n = o(), u.length !== 0 && (s = o(Am([1]), u), n = o());
}, l = () => {
if (r++ >= 1e3)
throw new Error("drbg: tried 1000 values");
@@ -39063,7 +39063,7 @@ function Ob(i, e, t) {
const f = n.slice();
d.push(f), u += n.length;
}
- return ic(...d);
+ return sc(...d);
};
return (u, d) => {
a(), c(u);
@@ -39073,7 +39073,7 @@ function Ob(i, e, t) {
return a(), f;
};
}
-const LN = {
+const PN = {
bigint: (i) => typeof i == "bigint",
function: (i) => typeof i == "function",
boolean: (i) => typeof i == "boolean",
@@ -39084,9 +39084,9 @@ const LN = {
field: (i, e) => e.Fp.isValid(i),
hash: (i) => typeof i == "function" && Number.isSafeInteger(i.outputLen)
};
-function mc(i, e, t = {}) {
+function xc(i, e, t = {}) {
const n = (s, r, a) => {
- const o = LN[r];
+ const o = PN[r];
if (typeof o != "function")
throw new Error(`Invalid validator "${r}", expected function`);
const c = i[s];
@@ -39099,29 +39099,29 @@ function mc(i, e, t = {}) {
n(s, r, !0);
return i;
}
-const PN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
+const kN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
- bitMask: Cp,
- bytesToHex: Oa,
+ bitMask: Sp,
+ bytesToHex: Qa,
bytesToNumberBE: Ir,
- bytesToNumberLE: wp,
- concatBytes: ic,
- createHmacDrbg: Ob,
- ensureBytes: yi,
- hexToBytes: nc,
- hexToNumber: _p,
- numberToBytesBE: Qa,
- numberToBytesLE: vp,
- validateObject: mc
+ bytesToNumberLE: Cp,
+ concatBytes: sc,
+ createHmacDrbg: Qb,
+ ensureBytes: _i,
+ hexToBytes: ic,
+ hexToNumber: vp,
+ numberToBytesBE: Ga,
+ numberToBytesLE: Ip,
+ validateObject: xc
}, Symbol.toStringTag, { value: "Module" }));
-const wn = BigInt(0), tn = BigInt(1), mr = BigInt(2), kN = BigInt(3), pf = BigInt(4), pm = BigInt(5), Am = BigInt(8);
+const wn = BigInt(0), tn = BigInt(1), mr = BigInt(2), UN = BigInt(3), gf = BigInt(4), gm = BigInt(5), mm = BigInt(8);
BigInt(9);
BigInt(16);
-function Kn(i, e) {
+function jn(i, e) {
const t = i % e;
return t >= wn ? t : e + t;
}
-function UN(i, e, t) {
+function ON(i, e, t) {
if (t <= wn || e < wn)
throw new Error("Expected power/modulo > 0");
if (t === tn)
@@ -39131,33 +39131,33 @@ function UN(i, e, t) {
e & tn && (n = n * i % t), i = i * i % t, e >>= tn;
return n;
}
-function si(i, e, t) {
+function ri(i, e, t) {
let n = i;
for (; e-- > wn; )
n *= n, n %= t;
return n;
}
-function Af(i, e) {
+function mf(i, e) {
if (i === wn || e <= wn)
throw new Error(`invert: expected positive integers, got n=${i} mod=${e}`);
- let t = Kn(i, e), n = e, s = wn, r = tn;
+ let t = jn(i, e), n = e, s = wn, r = tn;
for (; t !== wn; ) {
const o = n / t, c = n % t, l = s - r * o;
n = t, t = c, s = r, r = l;
}
if (n !== tn)
throw new Error("invert: does not exist");
- return Kn(s, e);
+ return jn(s, e);
}
-function ON(i) {
+function QN(i) {
const e = (i - tn) / mr;
let t, n, s;
for (t = i - tn, n = 0; t % mr === wn; t /= mr, n++)
;
- for (s = mr; s < i && UN(s, e, i) !== i - tn; s++)
+ for (s = mr; s < i && ON(s, e, i) !== i - tn; s++)
;
if (n === 1) {
- const a = (i + tn) / pf;
+ const a = (i + tn) / gf;
return function(c, l) {
const h = c.pow(l, a);
if (!c.eql(c.sqr(h), l))
@@ -39182,9 +39182,9 @@ function ON(i) {
return u;
};
}
-function QN(i) {
- if (i % pf === kN) {
- const e = (i + tn) / pf;
+function GN(i) {
+ if (i % gf === UN) {
+ const e = (i + tn) / gf;
return function(n, s) {
const r = n.pow(s, e);
if (!n.eql(n.sqr(r), s))
@@ -39192,8 +39192,8 @@ function QN(i) {
return r;
};
}
- if (i % Am === pm) {
- const e = (i - pm) / Am;
+ if (i % mm === gm) {
+ const e = (i - gm) / mm;
return function(n, s) {
const r = n.mul(s, mr), a = n.pow(r, e), o = n.mul(s, a), c = n.mul(n.mul(o, mr), a), l = n.mul(o, n.sub(c, n.ONE));
if (!n.eql(n.sqr(l), s))
@@ -39201,9 +39201,9 @@ function QN(i) {
return l;
};
}
- return ON(i);
+ return QN(i);
}
-const GN = [
+const HN = [
"create",
"isValid",
"is0",
@@ -39222,16 +39222,16 @@ const GN = [
"mulN",
"sqrN"
];
-function HN(i) {
+function zN(i) {
const e = {
ORDER: "bigint",
MASK: "bigint",
BYTES: "isSafeInteger",
BITS: "isSafeInteger"
- }, t = GN.reduce((n, s) => (n[s] = "function", n), e);
- return mc(i, t);
+ }, t = HN.reduce((n, s) => (n[s] = "function", n), e);
+ return xc(i, t);
}
-function zN(i, e, t) {
+function VN(i, e, t) {
if (t < wn)
throw new Error("Expected power > 0");
if (t === wn)
@@ -39243,28 +39243,28 @@ function zN(i, e, t) {
t & tn && (n = i.mul(n, s)), s = i.sqr(s), t >>= tn;
return n;
}
-function VN(i, e) {
+function WN(i, e) {
const t = new Array(e.length), n = e.reduce((r, a, o) => i.is0(a) ? r : (t[o] = r, i.mul(r, a)), i.ONE), s = i.inv(n);
return e.reduceRight((r, a, o) => i.is0(a) ? r : (t[o] = i.mul(r, t[o]), i.mul(r, a)), s), t;
}
-function Qb(i, e) {
+function Gb(i, e) {
const t = e !== void 0 ? e : i.toString(2).length, n = Math.ceil(t / 8);
return { nBitLength: t, nByteLength: n };
}
-function WN(i, e, t = !1, n = {}) {
+function qN(i, e, t = !1, n = {}) {
if (i <= wn)
throw new Error(`Expected Field ORDER > 0, got ${i}`);
- const { nBitLength: s, nByteLength: r } = Qb(i, e);
+ const { nBitLength: s, nByteLength: r } = Gb(i, e);
if (r > 2048)
throw new Error("Field lengths over 2048 bytes are not supported");
- const a = QN(i), o = Object.freeze({
+ const a = GN(i), o = Object.freeze({
ORDER: i,
BITS: s,
BYTES: r,
- MASK: Cp(s),
+ MASK: Sp(s),
ZERO: wn,
ONE: tn,
- create: (c) => Kn(c, i),
+ create: (c) => jn(c, i),
isValid: (c) => {
if (typeof c != "bigint")
throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);
@@ -39272,53 +39272,53 @@ function WN(i, e, t = !1, n = {}) {
},
is0: (c) => c === wn,
isOdd: (c) => (c & tn) === tn,
- neg: (c) => Kn(-c, i),
+ neg: (c) => jn(-c, i),
eql: (c, l) => c === l,
- sqr: (c) => Kn(c * c, i),
- add: (c, l) => Kn(c + l, i),
- sub: (c, l) => Kn(c - l, i),
- mul: (c, l) => Kn(c * l, i),
- pow: (c, l) => zN(o, c, l),
- div: (c, l) => Kn(c * Af(l, i), i),
+ sqr: (c) => jn(c * c, i),
+ add: (c, l) => jn(c + l, i),
+ sub: (c, l) => jn(c - l, i),
+ mul: (c, l) => jn(c * l, i),
+ pow: (c, l) => VN(o, c, l),
+ div: (c, l) => jn(c * mf(l, i), i),
// Same as above, but doesn't normalize
sqrN: (c) => c * c,
addN: (c, l) => c + l,
subN: (c, l) => c - l,
mulN: (c, l) => c * l,
- inv: (c) => Af(c, i),
+ inv: (c) => mf(c, i),
sqrt: n.sqrt || ((c) => a(o, c)),
- invertBatch: (c) => VN(o, c),
+ invertBatch: (c) => WN(o, c),
// TODO: do we really need constant cmov?
// We don't have const-time bigints anyway, so probably will be not very useful
cmov: (c, l, h) => h ? l : c,
- toBytes: (c) => t ? vp(c, r) : Qa(c, r),
+ toBytes: (c) => t ? Ip(c, r) : Ga(c, r),
fromBytes: (c) => {
if (c.length !== r)
throw new Error(`Fp.fromBytes: expected ${r}, got ${c.length}`);
- return t ? wp(c) : Ir(c);
+ return t ? Cp(c) : Ir(c);
}
});
return Object.freeze(o);
}
-function Gb(i) {
+function Hb(i) {
if (typeof i != "bigint")
throw new Error("field order must be bigint");
const e = i.toString(2).length;
return Math.ceil(e / 8);
}
-function Hb(i) {
- const e = Gb(i);
+function zb(i) {
+ const e = Hb(i);
return e + Math.ceil(e / 2);
}
-function qN(i, e, t = !1) {
- const n = i.length, s = Gb(e), r = Hb(e);
+function KN(i, e, t = !1) {
+ const n = i.length, s = Hb(e), r = zb(e);
if (n < 16 || n < r || n > 1024)
throw new Error(`expected ${r}-1024 bytes of input, got ${n}`);
- const a = t ? Ir(i) : wp(i), o = Kn(a, e - tn) + tn;
- return t ? vp(o, s) : Qa(o, s);
+ const a = t ? Ir(i) : Cp(i), o = jn(a, e - tn) + tn;
+ return t ? Ip(o, s) : Ga(o, s);
}
-const KN = BigInt(0), Xu = BigInt(1);
-function jN(i, e) {
+const jN = BigInt(0), Ju = BigInt(1);
+function XN(i, e) {
const t = (s, r) => {
const a = r.negate();
return s ? a : r;
@@ -39331,8 +39331,8 @@ function jN(i, e) {
// non-const time multiplication ladder
unsafeLadder(s, r) {
let a = i.ZERO, o = s;
- for (; r > KN; )
- r & Xu && (a = a.add(o)), o = o.double(), r >>= Xu;
+ for (; r > jN; )
+ r & Ju && (a = a.add(o)), o = o.double(), r >>= Ju;
return a;
},
/**
@@ -39370,7 +39370,7 @@ function jN(i, e) {
for (let p = 0; p < o; p++) {
const m = p * c;
let g = Number(a & u);
- a >>= f, g > c && (g -= d, a += Xu);
+ a >>= f, g > c && (g -= d, a += Ju);
const A = m, _ = m + Math.abs(g) - 1, x = p % 2 !== 0, E = g < 0;
g === 0 ? h = h.add(t(x, r[A])) : l = l.add(t(E, r[_]));
}
@@ -39383,8 +39383,8 @@ function jN(i, e) {
}
};
}
-function zb(i) {
- return HN(i.Fp), mc(i, {
+function Vb(i) {
+ return zN(i.Fp), xc(i, {
n: "bigint",
h: "bigint",
Gx: "field",
@@ -39393,14 +39393,14 @@ function zb(i) {
nBitLength: "isSafeInteger",
nByteLength: "isSafeInteger"
}), Object.freeze({
- ...Qb(i.n, i.nBitLength),
+ ...Gb(i.n, i.nBitLength),
...i,
p: i.Fp.ORDER
});
}
-function XN(i) {
- const e = zb(i);
- mc(e, {
+function YN(i) {
+ const e = Vb(i);
+ xc(e, {
a: "field",
b: "field"
}, {
@@ -39421,7 +39421,7 @@ function XN(i) {
}
return Object.freeze({ ...e });
}
-const { bytesToNumberBE: YN, hexToBytes: JN } = PN, _r = {
+const { bytesToNumberBE: JN, hexToBytes: ZN } = kN, _r = {
// asn.1 DER encoding utils
Err: class extends Error {
constructor(e = "") {
@@ -39439,10 +39439,10 @@ const { bytesToNumberBE: YN, hexToBytes: JN } = PN, _r = {
throw new e("Invalid signature integer: negative");
if (n[0] === 0 && !(n[1] & 128))
throw new e("Invalid signature integer: unnecessary leading zero");
- return { d: YN(n), l: i.subarray(t + 2) };
+ return { d: JN(n), l: i.subarray(t + 2) };
},
toSig(i) {
- const { Err: e } = _r, t = typeof i == "string" ? JN(i) : i;
+ const { Err: e } = _r, t = typeof i == "string" ? ZN(i) : i;
if (!(t instanceof Uint8Array))
throw new Error("ui8a expected");
let n = t.length;
@@ -39462,14 +39462,14 @@ const { bytesToNumberBE: YN, hexToBytes: JN } = PN, _r = {
}, n = e(t(i.s)), s = e(t(i.r)), r = n.length / 2, a = s.length / 2, o = t(r), c = t(a);
return `30${t(a + r + 4)}02${c}${s}02${o}${n}`;
}
-}, rs = BigInt(0), ai = BigInt(1);
+}, as = BigInt(0), oi = BigInt(1);
BigInt(2);
-const gm = BigInt(3);
+const xm = BigInt(3);
BigInt(4);
-function ZN(i) {
- const e = XN(i), { Fp: t } = e, n = e.toBytes || ((p, m, g) => {
+function $N(i) {
+ const e = YN(i), { Fp: t } = e, n = e.toBytes || ((p, m, g) => {
const A = m.toAffine();
- return ic(Uint8Array.from([4]), t.toBytes(A.x), t.toBytes(A.y));
+ return sc(Uint8Array.from([4]), t.toBytes(A.x), t.toBytes(A.y));
}), s = e.fromBytes || ((p) => {
const m = p.subarray(1), g = t.fromBytes(m.subarray(0, t.BYTES)), A = t.fromBytes(m.subarray(t.BYTES, 2 * t.BYTES));
return { x: g, y: A };
@@ -39481,7 +39481,7 @@ function ZN(i) {
if (!t.eql(t.sqr(e.Gy), r(e.Gx)))
throw new Error("bad generator point: equation left != right");
function a(p) {
- return typeof p == "bigint" && rs < p && p < e.n;
+ return typeof p == "bigint" && as < p && p < e.n;
}
function o(p) {
if (!a(p))
@@ -39490,17 +39490,17 @@ function ZN(i) {
function c(p) {
const { allowedPrivateKeyLengths: m, nByteLength: g, wrapPrivateKey: A, n: _ } = e;
if (m && typeof p != "bigint") {
- if (p instanceof Uint8Array && (p = Oa(p)), typeof p != "string" || !m.includes(p.length))
+ if (p instanceof Uint8Array && (p = Qa(p)), typeof p != "string" || !m.includes(p.length))
throw new Error("Invalid key");
p = p.padStart(g * 2, "0");
}
let x;
try {
- x = typeof p == "bigint" ? p : Ir(yi("private key", p, g));
+ x = typeof p == "bigint" ? p : Ir(_i("private key", p, g));
} catch {
throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`);
}
- return A && (x = Kn(x, _)), o(x), x;
+ return A && (x = jn(x, _)), o(x), x;
}
const l = /* @__PURE__ */ new Map();
function h(p) {
@@ -39548,7 +39548,7 @@ function ZN(i) {
* @param hex short/long ECDSA hex
*/
static fromHex(m) {
- const g = u.fromAffine(s(yi("pointHex", m)));
+ const g = u.fromAffine(s(_i("pointHex", m)));
return g.assertValidity(), g;
}
// Multiplies generator point by privateKey.
@@ -39600,7 +39600,7 @@ function ZN(i) {
// https://eprint.iacr.org/2015/1060, algorithm 3
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
double() {
- const { a: m, b: g } = e, A = t.mul(g, gm), { px: _, py: x, pz: E } = this;
+ const { a: m, b: g } = e, A = t.mul(g, xm), { px: _, py: x, pz: E } = this;
let S = t.ZERO, w = t.ZERO, I = t.ZERO, T = t.mul(_, _), C = t.mul(x, x), v = t.mul(E, E), F = t.mul(_, x);
return F = t.add(F, F), I = t.mul(_, E), I = t.add(I, I), S = t.mul(m, I), w = t.mul(A, v), w = t.add(S, w), S = t.sub(C, w), w = t.add(C, w), w = t.mul(S, w), S = t.mul(F, S), I = t.mul(A, I), v = t.mul(m, v), F = t.sub(T, v), F = t.mul(m, F), F = t.add(F, I), I = t.add(T, T), T = t.add(I, T), T = t.add(T, v), T = t.mul(T, F), w = t.add(w, T), v = t.mul(x, E), v = t.add(v, v), T = t.mul(v, F), S = t.sub(S, T), I = t.mul(v, C), I = t.add(I, I), I = t.add(I, I), new u(S, w, I);
}
@@ -39612,7 +39612,7 @@ function ZN(i) {
h(m);
const { px: g, py: A, pz: _ } = this, { px: x, py: E, pz: S } = m;
let w = t.ZERO, I = t.ZERO, T = t.ZERO;
- const C = e.a, v = t.mul(e.b, gm);
+ const C = e.a, v = t.mul(e.b, xm);
let F = t.mul(g, x), K = t.mul(A, E), q = t.mul(_, S), $ = t.add(g, A), D = t.add(x, E);
$ = t.mul($, D), D = t.add(F, K), $ = t.sub($, D), D = t.add(g, _);
let O = t.add(x, S);
@@ -39637,16 +39637,16 @@ function ZN(i) {
*/
multiplyUnsafe(m) {
const g = u.ZERO;
- if (m === rs)
+ if (m === as)
return g;
- if (o(m), m === ai)
+ if (o(m), m === oi)
return this;
const { endo: A } = e;
if (!A)
return f.unsafeLadder(this, m);
let { k1neg: _, k1: x, k2neg: E, k2: S } = A.splitScalar(m), w = g, I = g, T = this;
- for (; x > rs || S > rs; )
- x & ai && (w = w.add(T)), S & ai && (I = I.add(T)), T = T.double(), x >>= ai, S >>= ai;
+ for (; x > as || S > as; )
+ x & oi && (w = w.add(T)), S & oi && (I = I.add(T)), T = T.double(), x >>= oi, S >>= oi;
return _ && (w = w.negate()), E && (I = I.negate()), I = new u(t.mul(I.px, A.beta), I.py, I.pz), w.add(I);
}
/**
@@ -39679,7 +39679,7 @@ function ZN(i) {
* @returns non-zero affine point
*/
multiplyAndAddUnsafe(m, g, A) {
- const _ = u.BASE, x = (S, w) => w === rs || w === ai || !S.equals(_) ? S.multiplyUnsafe(w) : S.multiply(w), E = x(this, g).add(x(m, A));
+ const _ = u.BASE, x = (S, w) => w === as || w === oi || !S.equals(_) ? S.multiplyUnsafe(w) : S.multiply(w), E = x(this, g).add(x(m, A));
return E.is0() ? void 0 : E;
}
// Converts Projective point to affine (x, y) coordinates.
@@ -39697,7 +39697,7 @@ function ZN(i) {
}
isTorsionFree() {
const { h: m, isTorsionFree: g } = e;
- if (m === ai)
+ if (m === oi)
return !0;
if (g)
return g(u, this);
@@ -39705,17 +39705,17 @@ function ZN(i) {
}
clearCofactor() {
const { h: m, clearCofactor: g } = e;
- return m === ai ? this : g ? g(u, this) : this.multiplyUnsafe(e.h);
+ return m === oi ? this : g ? g(u, this) : this.multiplyUnsafe(e.h);
}
toRawBytes(m = !0) {
return this.assertValidity(), n(u, this, m);
}
toHex(m = !0) {
- return Oa(this.toRawBytes(m));
+ return Qa(this.toRawBytes(m));
}
}
u.BASE = new u(e.Gx, e.Gy, t.ONE), u.ZERO = new u(t.ZERO, t.ONE, t.ZERO);
- const d = e.nBitLength, f = jN(u, e.endo ? Math.ceil(d / 2) : d);
+ const d = e.nBitLength, f = XN(u, e.endo ? Math.ceil(d / 2) : d);
return {
CURVE: e,
ProjectivePoint: u,
@@ -39724,9 +39724,9 @@ function ZN(i) {
isWithinCurveOrder: a
};
}
-function $N(i) {
- const e = zb(i);
- return mc(e, {
+function eD(i) {
+ const e = Vb(i);
+ return xc(e, {
hash: "hash",
hmac: "function",
randomBytes: "function"
@@ -39736,21 +39736,21 @@ function $N(i) {
lowS: "boolean"
}), Object.freeze({ lowS: !0, ...e });
}
-function eD(i) {
- const e = $N(i), { Fp: t, n } = e, s = t.BYTES + 1, r = 2 * t.BYTES + 1;
+function tD(i) {
+ const e = eD(i), { Fp: t, n } = e, s = t.BYTES + 1, r = 2 * t.BYTES + 1;
function a(D) {
- return rs < D && D < t.ORDER;
+ return as < D && D < t.ORDER;
}
function o(D) {
- return Kn(D, n);
+ return jn(D, n);
}
function c(D) {
- return Af(D, n);
+ return mf(D, n);
}
- const { ProjectivePoint: l, normPrivateKeyToScalar: h, weierstrassEquation: u, isWithinCurveOrder: d } = ZN({
+ const { ProjectivePoint: l, normPrivateKeyToScalar: h, weierstrassEquation: u, isWithinCurveOrder: d } = $N({
...e,
toBytes(D, O, Y) {
- const Q = O.toAffine(), J = t.toBytes(Q.x), ee = ic;
+ const Q = O.toAffine(), J = t.toBytes(Q.x), ee = sc;
return Y ? ee(Uint8Array.from([O.hasEvenY() ? 2 : 3]), J) : ee(Uint8Array.from([4]), J, t.toBytes(Q.y));
},
fromBytes(D) {
@@ -39761,7 +39761,7 @@ function eD(i) {
throw new Error("Point is not on curve");
const ee = u(J);
let ae = t.sqrt(ee);
- const _e = (ae & ai) === ai;
+ const _e = (ae & oi) === oi;
return (Y & 1) === 1 !== _e && (ae = t.neg(ae)), { x: J, y: ae };
} else if (O === r && Y === 4) {
const J = t.fromBytes(Q.subarray(0, t.BYTES)), ee = t.fromBytes(Q.subarray(t.BYTES, 2 * t.BYTES));
@@ -39769,9 +39769,9 @@ function eD(i) {
} else
throw new Error(`Point of length ${O} was invalid. Expected ${s} compressed bytes or ${r} uncompressed bytes`);
}
- }), f = (D) => Oa(Qa(D, e.nByteLength));
+ }), f = (D) => Qa(Ga(D, e.nByteLength));
function p(D) {
- const O = n >> ai;
+ const O = n >> oi;
return D > O;
}
function m(D) {
@@ -39785,12 +39785,12 @@ function eD(i) {
// pair (bytes of r, bytes of s)
static fromCompact(O) {
const Y = e.nByteLength;
- return O = yi("compactSignature", O, Y * 2), new A(g(O, 0, Y), g(O, Y, 2 * Y));
+ return O = _i("compactSignature", O, Y * 2), new A(g(O, 0, Y), g(O, Y, 2 * Y));
}
// DER encoded ECDSA signature
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
static fromDER(O) {
- const { r: Y, s: Q } = _r.toSig(yi("DER", O));
+ const { r: Y, s: Q } = _r.toSig(_i("DER", O));
return new A(Y, Q);
}
assertValidity() {
@@ -39803,7 +39803,7 @@ function eD(i) {
return new A(this.r, this.s, O);
}
recoverPublicKey(O) {
- const { r: Y, s: Q, recovery: J } = this, ee = I(yi("msgHash", O));
+ const { r: Y, s: Q, recovery: J } = this, ee = I(_i("msgHash", O));
if (J == null || ![0, 1, 2, 3].includes(J))
throw new Error("recovery id invalid");
const ae = J === 2 || J === 3 ? Y + e.n : Y;
@@ -39823,14 +39823,14 @@ function eD(i) {
}
// DER-encoded
toDERRawBytes() {
- return nc(this.toDERHex());
+ return ic(this.toDERHex());
}
toDERHex() {
return _r.hexFromSig({ r: this.r, s: this.s });
}
// padded bytes of r, then padded bytes of s
toCompactRawBytes() {
- return nc(this.toCompactHex());
+ return ic(this.toCompactHex());
}
toCompactHex() {
return f(this.r) + f(this.s);
@@ -39850,8 +39850,8 @@ function eD(i) {
* (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
*/
randomPrivateKey: () => {
- const D = Hb(e.n);
- return qN(e.randomBytes(D), e.n);
+ const D = zb(e.n);
+ return KN(e.randomBytes(D), e.n);
},
/**
* Creates precompute table for an arbitrary EC point. Makes point "cached".
@@ -39884,37 +39884,37 @@ function eD(i) {
return Y > 0 ? O >> BigInt(Y) : O;
}, I = e.bits2int_modN || function(D) {
return o(w(D));
- }, T = Cp(e.nBitLength);
+ }, T = Sp(e.nBitLength);
function C(D) {
if (typeof D != "bigint")
throw new Error("bigint expected");
- if (!(rs <= D && D < T))
+ if (!(as <= D && D < T))
throw new Error(`bigint expected < 2^${e.nBitLength}`);
- return Qa(D, e.nByteLength);
+ return Ga(D, e.nByteLength);
}
function v(D, O, Y = F) {
if (["recovered", "canonical"].some((et) => et in Y))
throw new Error("sign() legacy options not supported");
const { hash: Q, randomBytes: J } = e;
let { lowS: ee, prehash: ae, extraEntropy: _e } = Y;
- ee == null && (ee = !0), D = yi("msgHash", D), ae && (D = yi("prehashed msgHash", Q(D)));
+ ee == null && (ee = !0), D = _i("msgHash", D), ae && (D = _i("prehashed msgHash", Q(D)));
const Me = I(D), se = h(O), me = [C(se), C(Me)];
if (_e != null) {
const et = _e === !0 ? J(t.BYTES) : _e;
- me.push(yi("extraEntropy", et));
+ me.push(_i("extraEntropy", et));
}
- const xe = ic(...me), be = Me;
+ const xe = sc(...me), be = Me;
function Ue(et) {
const He = w(et);
if (!d(He))
return;
const St = c(He), ht = l.BASE.multiply(He).toAffine(), $e = o(ht.x);
- if ($e === rs)
+ if ($e === as)
return;
const H = o(St * o(be + $e * se));
- if (H === rs)
+ if (H === as)
return;
- let xn = (ht.x === $e ? 0 : 2) | Number(ht.y & ai), pt = H;
+ let xn = (ht.x === $e ? 0 : 2) | Number(ht.y & oi), pt = H;
return ee && p(H) && (pt = m(H), xn ^= 1), new A($e, pt, xn);
}
return { seed: xe, k2sig: Ue };
@@ -39922,12 +39922,12 @@ function eD(i) {
const F = { lowS: e.lowS, prehash: !1 }, K = { lowS: e.lowS, prehash: !1 };
function q(D, O, Y = F) {
const { seed: Q, k2sig: J } = v(D, O, Y), ee = e;
- return Ob(ee.hash.outputLen, ee.nByteLength, ee.hmac)(Q, J);
+ return Qb(ee.hash.outputLen, ee.nByteLength, ee.hmac)(Q, J);
}
l.BASE._setWindowSize(8);
function $(D, O, Y, Q = K) {
const J = D;
- if (O = yi("msgHash", O), Y = yi("publicKey", Y), "strict" in Q)
+ if (O = _i("msgHash", O), Y = _i("publicKey", Y), "strict" in Q)
throw new Error("options.strict was renamed to lowS");
const { lowS: ee, prehash: ae } = Q;
let _e, Me;
@@ -39968,29 +39968,29 @@ function eD(i) {
utils: _
};
}
-function tD(i) {
+function nD(i) {
return {
hash: i,
- hmac: (e, ...t) => yb(i, e, KF(...t)),
- randomBytes: jF
+ hmac: (e, ...t) => _b(i, e, jF(...t)),
+ randomBytes: XF
};
}
-function nD(i, e) {
- const t = (n) => eD({ ...i, ...tD(n) });
+function iD(i, e) {
+ const t = (n) => tD({ ...i, ...nD(n) });
return Object.freeze({ ...t(e), create: t });
}
-const Vb = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), mm = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), iD = BigInt(1), gf = BigInt(2), xm = (i, e) => (i + e / gf) / e;
-function sD(i) {
- const e = Vb, t = BigInt(3), n = BigInt(6), s = BigInt(11), r = BigInt(22), a = BigInt(23), o = BigInt(44), c = BigInt(88), l = i * i * i % e, h = l * l * i % e, u = si(h, t, e) * h % e, d = si(u, t, e) * h % e, f = si(d, gf, e) * l % e, p = si(f, s, e) * f % e, m = si(p, r, e) * p % e, g = si(m, o, e) * m % e, A = si(g, c, e) * g % e, _ = si(A, o, e) * m % e, x = si(_, t, e) * h % e, E = si(x, a, e) * p % e, S = si(E, n, e) * l % e, w = si(S, gf, e);
- if (!mf.eql(mf.sqr(w), i))
+const Wb = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), bm = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), sD = BigInt(1), xf = BigInt(2), Em = (i, e) => (i + e / xf) / e;
+function rD(i) {
+ const e = Wb, t = BigInt(3), n = BigInt(6), s = BigInt(11), r = BigInt(22), a = BigInt(23), o = BigInt(44), c = BigInt(88), l = i * i * i % e, h = l * l * i % e, u = ri(h, t, e) * h % e, d = ri(u, t, e) * h % e, f = ri(d, xf, e) * l % e, p = ri(f, s, e) * f % e, m = ri(p, r, e) * p % e, g = ri(m, o, e) * m % e, A = ri(g, c, e) * g % e, _ = ri(A, o, e) * m % e, x = ri(_, t, e) * h % e, E = ri(x, a, e) * p % e, S = ri(E, n, e) * l % e, w = ri(S, xf, e);
+ if (!bf.eql(bf.sqr(w), i))
throw new Error("Cannot find square root");
return w;
}
-const mf = WN(Vb, void 0, void 0, { sqrt: sD }), ks = nD({
+const bf = qN(Wb, void 0, void 0, { sqrt: rD }), ks = iD({
a: BigInt(0),
b: BigInt(7),
- Fp: mf,
- n: mm,
+ Fp: bf,
+ n: bm,
// Base point (x, y) aka generator point
Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
@@ -40005,19 +40005,19 @@ const mf = WN(Vb, void 0, void 0, { sqrt: sD }), ks = nD({
endo: {
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
splitScalar: (i) => {
- const e = mm, t = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), n = -iD * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), s = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), r = t, a = BigInt("0x100000000000000000000000000000000"), o = xm(r * i, e), c = xm(-n * i, e);
- let l = Kn(i - o * t - c * s, e), h = Kn(-o * n - c * r, e);
+ const e = bm, t = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), n = -sD * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), s = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), r = t, a = BigInt("0x100000000000000000000000000000000"), o = Em(r * i, e), c = Em(-n * i, e);
+ let l = jn(i - o * t - c * s, e), h = jn(-o * n - c * r, e);
const u = l > a, d = h > a;
if (u && (l = e - l), d && (h = e - h), l > a || h > a)
throw new Error("splitScalar: Endomorphism failed, k=" + i);
return { k1neg: u, k1: l, k2neg: d, k2: h };
}
}
-}, wb);
+}, vb);
BigInt(0);
ks.ProjectivePoint;
-const sc = "0x0000000000000000000000000000000000000000", bm = "0x0000000000000000000000000000000000000000000000000000000000000000", Em = BigInt(0), ym = BigInt(1), xf = BigInt(2), _m = BigInt(27), wm = BigInt(28), bl = BigInt(35), Wb = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), rD = Wb / xf, aD = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), lr = {};
-function Yu(i) {
+const rc = "0x0000000000000000000000000000000000000000", ym = "0x0000000000000000000000000000000000000000000000000000000000000000", _m = BigInt(0), wm = BigInt(1), Ef = BigInt(2), vm = BigInt(27), Cm = BigInt(28), El = BigInt(35), qb = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), aD = qb / Ef, oD = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), lr = {};
+function Zu(i) {
return Es(rn(i), 32);
}
class zt {
@@ -40035,7 +40035,7 @@ class zt {
return this.#e;
}
set r(e) {
- V(Ba(e) === 32, "invalid r", "value", e), this.#e = Ie(e);
+ V(Ta(e) === 32, "invalid r", "value", e), this.#e = Ie(e);
}
/**
* The ``s`` value for a signature.
@@ -40044,7 +40044,7 @@ class zt {
return V(parseInt(this.#t.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#t), this.#t;
}
set s(e) {
- V(Ba(e) === 32, "invalid s", "value", e), this.#t = Ie(e);
+ V(Ta(e) === 32, "invalid s", "value", e), this.#t = Ie(e);
}
/**
* Return the s value, unchecked for EIP-2 compliance.
@@ -40061,7 +40061,7 @@ class zt {
* Returns true if the Signature is valid for [[link-eip-2]] signatures.
*/
isValid() {
- return BigInt(this.#t) <= rD;
+ return BigInt(this.#t) <= aD;
}
/**
* The ``v`` value for a signature.
@@ -40127,7 +40127,7 @@ class zt {
* @private
*/
constructor(e, t, n, s) {
- vh(e, lr, "Signature"), this.#e = t, this.#t = n, this.#n = s, this.#i = null;
+ Ih(e, lr, "Signature"), this.#e = t, this.#t = n, this.#n = s, this.#i = null;
}
/**
* Returns the canonical signature.
@@ -40139,7 +40139,7 @@ class zt {
getCanonical() {
if (this.isValid())
return this;
- const e = Wb - BigInt(this._s), t = 55 - this.v, n = new zt(lr, this.r, Yu(e), t);
+ const e = qb - BigInt(this._s), t = 55 - this.v, n = new zt(lr, this.r, Zu(e), t);
return this.networkV && (n.#i = this.networkV), n;
}
/**
@@ -40162,7 +40162,7 @@ class zt {
v: this.v
};
}
- [aD]() {
+ [oD]() {
return this.toString();
}
toString() {
@@ -40180,7 +40180,7 @@ class zt {
*/
static getChainId(e) {
const t = De(e, "v");
- return t == _m || t == wm ? Em : (V(t >= bl, "invalid EIP-155 v", "v", e), (t - bl) / xf);
+ return t == vm || t == Cm ? _m : (V(t >= El, "invalid EIP-155 v", "v", e), (t - El) / Ef);
}
/**
* Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
@@ -40197,7 +40197,7 @@ class zt {
*
*/
static getChainIdV(e, t) {
- return De(e) * xf + BigInt(35 + t - 27);
+ return De(e) * Ef + BigInt(35 + t - 27);
}
/**
* Compute the normalized legacy transaction ``v`` from a ``yParirty``,
@@ -40222,7 +40222,7 @@ class zt {
*/
static getNormalizedV(e) {
const t = De(e);
- return t === Em || t === _m ? 27 : t === ym || t === wm ? 28 : (V(t >= bl, "invalid v", "v", e), t & ym ? 27 : 28);
+ return t === _m || t === vm ? 27 : t === wm || t === Cm ? 28 : (V(t >= El, "invalid v", "v", e), t & wm ? 27 : 28);
}
/**
* Creates a new [[Signature]].
@@ -40237,7 +40237,7 @@ class zt {
V(l, h, "signature", e);
}
if (e == null)
- return new zt(lr, bm, bm, 27);
+ return new zt(lr, ym, ym, 27);
if (typeof e == "string") {
const l = dt(e, "signature");
if (l.length === 64) {
@@ -40254,9 +40254,9 @@ class zt {
return e.clone();
const n = e.r;
t(n != null, "missing r");
- const s = Yu(n), r = (function(l, h) {
+ const s = Zu(n), r = (function(l, h) {
if (l != null)
- return Yu(l);
+ return Zu(l);
if (h != null) {
t(Ut(h, 32), "invalid yParityAndS");
const u = dt(h);
@@ -40267,7 +40267,7 @@ class zt {
if (l != null) {
const d = De(l);
return {
- networkV: d >= bl ? d : void 0,
+ networkV: d >= El ? d : void 0,
v: zt.getNormalizedV(d)
};
}
@@ -40287,13 +40287,13 @@ class zt {
return a && (c.#i = a), t(e.yParity == null || ft(e.yParity, "sig.yParity") === c.yParity, "yParity mismatch"), t(e.yParityAndS == null || e.yParityAndS === c.yParityAndS, "yParityAndS mismatch"), c;
}
}
-class as {
+class os {
#e;
/**
* Creates a new **SigningKey** for %%privateKey%%.
*/
constructor(e) {
- V(Ba(e) === 32, "invalid private key", "privateKey", "[REDACTED]"), this.#e = Ie(e);
+ V(Ta(e) === 32, "invalid private key", "privateKey", "[REDACTED]"), this.#e = Ie(e);
}
/**
* The private key.
@@ -40308,7 +40308,7 @@ class as {
* characters long (the ``0x`` prefix and 130 hexadecimal nibbles).
*/
get publicKey() {
- return as.computePublicKey(this.#e);
+ return os.computePublicKey(this.#e);
}
/**
* The compressed public key.
@@ -40318,14 +40318,14 @@ class as {
* nibbles)
*/
get compressedPublicKey() {
- return as.computePublicKey(this.#e, !0);
+ return os.computePublicKey(this.#e, !0);
}
/**
* Return the signature of the signed %%digest%%.
*/
sign(e) {
- V(Ba(e) === 32, "invalid digest length", "digest", e);
- const t = ks.sign(On(e), On(this.#e), {
+ V(Ta(e) === 32, "invalid digest length", "digest", e);
+ const t = ks.sign(Qn(e), Qn(this.#e), {
lowS: !0
});
return zt.from({
@@ -40357,8 +40357,8 @@ class as {
* //_result:
*/
computeSharedSecret(e) {
- const t = as.computePublicKey(e);
- return Ie(ks.getSharedSecret(On(this.#e), dt(t), !1));
+ const t = os.computePublicKey(e);
+ return Ie(ks.getSharedSecret(Qn(this.#e), dt(t), !1));
}
/**
* Compute the public key for %%key%%, optionally %%compressed%%.
@@ -40417,11 +40417,11 @@ class as {
*
*/
static recoverPublicKey(e, t) {
- V(Ba(e) === 32, "invalid digest length", "digest", e);
+ V(Ta(e) === 32, "invalid digest length", "digest", e);
const n = zt.from(t);
- let s = ks.Signature.fromCompact(On(Ht([n.r, n.s])));
+ let s = ks.Signature.fromCompact(Qn(Ht([n.r, n.s])));
s = s.addRecoveryBit(n.yParity);
- const r = s.recoverPublicKey(On(e));
+ const r = s.recoverPublicKey(Qn(e));
return V(r != null, "invalid signature for digest", "signature", t), "0x" + r.toHex(!1);
}
/**
@@ -40435,12 +40435,12 @@ class as {
* addresses from parent public keys and chain codes.
*/
static addPoints(e, t, n) {
- const s = ks.ProjectivePoint.fromHex(as.computePublicKey(e).substring(2)), r = ks.ProjectivePoint.fromHex(as.computePublicKey(t).substring(2));
+ const s = ks.ProjectivePoint.fromHex(os.computePublicKey(e).substring(2)), r = ks.ProjectivePoint.fromHex(os.computePublicKey(t).substring(2));
return "0x" + s.add(r).toHex(!!n);
}
}
-const oD = BigInt(0), cD = BigInt(36);
-function vm(i) {
+const cD = BigInt(0), lD = BigInt(36);
+function Im(i) {
i = i.toLowerCase();
const e = i.substring(2).split(""), t = new Uint8Array(40);
for (let s = 0; s < 40; s++)
@@ -40450,17 +40450,17 @@ function vm(i) {
n[s >> 1] >> 4 >= 8 && (e[s] = e[s].toUpperCase()), (n[s >> 1] & 15) >= 8 && (e[s + 1] = e[s + 1].toUpperCase());
return "0x" + e.join("");
}
-const Ip = {};
+const Mp = {};
for (let i = 0; i < 10; i++)
- Ip[String(i)] = String(i);
+ Mp[String(i)] = String(i);
for (let i = 0; i < 26; i++)
- Ip[String.fromCharCode(65 + i)] = String(10 + i);
-const Cm = 15;
-function lD(i) {
+ Mp[String.fromCharCode(65 + i)] = String(10 + i);
+const Sm = 15;
+function hD(i) {
i = i.toUpperCase(), i = i.substring(4) + i.substring(0, 2) + "00";
- let e = i.split("").map((n) => Ip[n]).join("");
- for (; e.length >= Cm; ) {
- let n = e.substring(0, Cm);
+ let e = i.split("").map((n) => Mp[n]).join("");
+ for (; e.length >= Sm; ) {
+ let n = e.substring(0, Sm);
e = parseInt(n, 10) % 97 + e.substring(n.length);
}
let t = String(98 - parseInt(e, 10) % 97);
@@ -40468,7 +40468,7 @@ function lD(i) {
t = "0" + t;
return t;
}
-const hD = (function() {
+const uD = (function() {
const i = {};
for (let e = 0; e < 36; e++) {
const t = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
@@ -40476,58 +40476,58 @@ const hD = (function() {
}
return i;
})();
-function uD(i) {
+function dD(i) {
i = i.toLowerCase();
- let e = oD;
+ let e = cD;
for (let t = 0; t < i.length; t++)
- e = e * cD + hD[i[t]];
+ e = e * lD + uD[i[t]];
return e;
}
function Mt(i) {
if (V(typeof i == "string", "invalid address", "address", i), i.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
i.startsWith("0x") || (i = "0x" + i);
- const e = vm(i);
+ const e = Im(i);
return V(!i.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || e === i, "bad address checksum", "address", i), e;
}
if (i.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
- V(i.substring(2, 4) === lD(i), "bad icap checksum", "address", i);
- let e = uD(i.substring(4)).toString(16);
+ V(i.substring(2, 4) === hD(i), "bad icap checksum", "address", i);
+ let e = dD(i.substring(4)).toString(16);
for (; e.length < 40; )
e = "0" + e;
- return vm("0x" + e);
+ return Im("0x" + e);
}
V(!1, "invalid address", "address", i);
}
-function dD(i) {
+function fD(i) {
const e = Mt(i.from);
let n = De(i.nonce, "tx.nonce").toString(16);
return n === "0" ? n = "0x" : n.length % 2 ? n = "0x0" + n : n = "0x" + n, Mt(Kt(sn(ms([e, n])), 12));
}
-function qb(i) {
+function Kb(i) {
return i && typeof i.getAddress == "function";
}
-async function Ju(i, e) {
+async function $u(i, e) {
const t = await e;
return (t == null || t === "0x0000000000000000000000000000000000000000") && (ge(typeof i != "string", "unconfigured name", "UNCONFIGURED_NAME", { value: i }), V(!1, "invalid AddressLike value; did not resolve to a value address", "target", i)), Mt(t);
}
-function Hn(i, e) {
+function zn(i, e) {
if (typeof i == "string")
- return i.match(/^0x[0-9a-f]{40}$/i) ? Mt(i) : (ge(e != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }), Ju(i, e.resolveName(i)));
- if (qb(i))
- return Ju(i, i.getAddress());
+ return i.match(/^0x[0-9a-f]{40}$/i) ? Mt(i) : (ge(e != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }), $u(i, e.resolveName(i)));
+ if (Kb(i))
+ return $u(i, i.getAddress());
if (i && typeof i.then == "function")
- return Ju(i, i);
+ return $u(i, i);
V(!1, "unsupported addressable value", "target", i);
}
-const ns = {};
+const is = {};
function Te(i, e) {
let t = !1;
- return e < 0 && (t = !0, e *= -1), new jt(ns, `${t ? "" : "u"}int${e}`, i, { signed: t, width: e });
+ return e < 0 && (t = !0, e *= -1), new jt(is, `${t ? "" : "u"}int${e}`, i, { signed: t, width: e });
}
function vt(i, e) {
- return new jt(ns, `bytes${e || ""}`, i, { size: e });
+ return new jt(is, `bytes${e || ""}`, i, { size: e });
}
-const Im = /* @__PURE__ */ Symbol.for("_ethers_typed");
+const Mm = /* @__PURE__ */ Symbol.for("_ethers_typed");
class jt {
/**
* The type, as a Solidity-compatible type.
@@ -40546,7 +40546,7 @@ class jt {
* @_ignore:
*/
constructor(e, t, n, s) {
- s == null && (s = null), vh(ns, e, "Typed"), Ye(this, { _typedSymbol: Im, type: t, value: n }), this.#e = s, this.format();
+ s == null && (s = null), Ih(is, e, "Typed"), Ye(this, { _typedSymbol: Mm, type: t, value: n }), this.#e = s, this.format();
}
/**
* Format the type as a Human-Readable type.
@@ -40620,7 +40620,7 @@ class jt {
* Returns a new **Typed** of %%type%% with the %%value%%.
*/
static from(e, t) {
- return new jt(ns, e, t);
+ return new jt(is, e, t);
}
/**
* Return a new ``uint8`` type for %%v%%.
@@ -41214,25 +41214,25 @@ class jt {
* Return a new ``address`` type for %%v%%.
*/
static address(e) {
- return new jt(ns, "address", e);
+ return new jt(is, "address", e);
}
/**
* Return a new ``bool`` type for %%v%%.
*/
static bool(e) {
- return new jt(ns, "bool", !!e);
+ return new jt(is, "bool", !!e);
}
/**
* Return a new ``bytes`` type for %%v%%.
*/
static bytes(e) {
- return new jt(ns, "bytes", e);
+ return new jt(is, "bytes", e);
}
/**
* Return a new ``string`` type for %%v%%.
*/
static string(e) {
- return new jt(ns, "string", e);
+ return new jt(is, "string", e);
}
/**
* Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.
@@ -41250,13 +41250,13 @@ class jt {
* Return a new ``uint8`` type for %%v%%.
*/
static overrides(e) {
- return new jt(ns, "overrides", Object.assign({}, e));
+ return new jt(is, "overrides", Object.assign({}, e));
}
/**
* Returns true only if %%value%% is a [[Typed]] instance.
*/
static isTyped(e) {
- return e && typeof e == "object" && "_typedSymbol" in e && e._typedSymbol === Im;
+ return e && typeof e == "object" && "_typedSymbol" in e && e._typedSymbol === Mm;
}
/**
* If the value is a [[Typed]] instance, validates the underlying value
@@ -41274,7 +41274,7 @@ class jt {
return e;
}
}
-class fD extends _s {
+class pD extends _s {
constructor(e) {
super("address", "address", e, !1);
}
@@ -41294,7 +41294,7 @@ class fD extends _s {
return Mt(Ys(e.readValue(), 20));
}
}
-class pD extends _s {
+class AD extends _s {
coder;
constructor(e) {
super(e.name, e.type, "_", e.dynamic), this.coder = e;
@@ -41309,7 +41309,7 @@ class pD extends _s {
return this.coder.decode(e);
}
}
-function Kb(i, e, t) {
+function jb(i, e, t) {
let n = [];
if (Array.isArray(t))
n = t;
@@ -41322,7 +41322,7 @@ function Kb(i, e, t) {
} else
V(!1, "invalid tuple value", "tuple", t);
V(e.length === n.length, "types/value length mismatch", "tuple", t);
- let s = new df(), r = new df(), a = [];
+ let s = new pf(), r = new pf(), a = [];
e.forEach((c, l) => {
let h = n[l];
if (c.dynamic) {
@@ -41340,7 +41340,7 @@ function Kb(i, e, t) {
let o = i.appendWriter(s);
return o += i.appendWriter(r), o;
}
-function jb(i, e) {
+function Xb(i, e) {
let t = [], n = [], s = i.subReader(0);
return e.forEach((r) => {
let a = null;
@@ -41366,7 +41366,7 @@ function jb(i, e) {
t.push(a), n.push(r.localName || null);
}), ds.fromItems(t, n);
}
-class AD extends _s {
+class gD extends _s {
coder;
length;
constructor(e, t, n) {
@@ -41383,22 +41383,22 @@ class AD extends _s {
const n = jt.dereference(t, "array");
Array.isArray(n) || this._throwError("expected array value", n);
let s = this.length;
- s === -1 && (s = n.length, e.writeValue(n.length)), rb(n.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
+ s === -1 && (s = n.length, e.writeValue(n.length)), ab(n.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
let r = [];
for (let a = 0; a < n.length; a++)
r.push(this.coder);
- return Kb(e, r, n);
+ return jb(e, r, n);
}
decode(e) {
let t = this.length;
- t === -1 && (t = e.readIndex(), ge(t * Gn <= e.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: e.bytes, offset: t * Gn, length: e.dataLength }));
+ t === -1 && (t = e.readIndex(), ge(t * Hn <= e.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: e.bytes, offset: t * Hn, length: e.dataLength }));
let n = [];
for (let s = 0; s < t; s++)
- n.push(new pD(this.coder));
- return jb(e, n);
+ n.push(new AD(this.coder));
+ return Xb(e, n);
}
}
-class gD extends _s {
+class mD extends _s {
constructor(e) {
super("bool", "bool", e, !1);
}
@@ -41413,7 +41413,7 @@ class gD extends _s {
return !!e.readValue();
}
}
-class Xb extends _s {
+class Yb extends _s {
constructor(e, t) {
super(e, e, t, !0);
}
@@ -41421,7 +41421,7 @@ class Xb extends _s {
return "0x";
}
encode(e, t) {
- t = On(t);
+ t = Qn(t);
let n = e.writeValue(t.length);
return n += e.writeBytes(t), n;
}
@@ -41429,7 +41429,7 @@ class Xb extends _s {
return e.readBytes(e.readIndex(), !0);
}
}
-class mD extends Xb {
+class xD extends Yb {
constructor(e) {
super("bytes", e);
}
@@ -41437,7 +41437,7 @@ class mD extends Xb {
return Ie(super.decode(e));
}
}
-class xD extends _s {
+class bD extends _s {
size;
constructor(e, t) {
let n = "bytes" + String(e);
@@ -41447,15 +41447,15 @@ class xD extends _s {
return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2);
}
encode(e, t) {
- let n = On(jt.dereference(t, this.type));
+ let n = Qn(jt.dereference(t, this.type));
return n.length !== this.size && this._throwError("incorrect data length", t), e.writeBytes(n);
}
decode(e) {
return Ie(e.readBytes(this.size));
}
}
-const bD = new Uint8Array([]);
-class ED extends _s {
+const ED = new Uint8Array([]);
+class yD extends _s {
constructor(e) {
super("null", "", e, !1);
}
@@ -41463,14 +41463,14 @@ class ED extends _s {
return null;
}
encode(e, t) {
- return t != null && this._throwError("not null", t), e.writeBytes(bD);
+ return t != null && this._throwError("not null", t), e.writeBytes(ED);
}
decode(e) {
return e.readBytes(0), null;
}
}
-const yD = BigInt(0), _D = BigInt(1), wD = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
-class vD extends _s {
+const _D = BigInt(0), wD = BigInt(1), vD = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
+class CD extends _s {
size;
signed;
constructor(e, t, n) {
@@ -41481,19 +41481,19 @@ class vD extends _s {
return 0;
}
encode(e, t) {
- let n = De(jt.dereference(t, this.type)), s = Io(wD, Gn * 8);
+ let n = De(jt.dereference(t, this.type)), s = So(vD, Hn * 8);
if (this.signed) {
- let r = Io(s, this.size * 8 - 1);
- (n > r || n < -(r + _D)) && this._throwError("value out-of-bounds", t), n = cb(n, 8 * Gn);
- } else (n < yD || n > Io(s, this.size * 8)) && this._throwError("value out-of-bounds", t);
+ let r = So(s, this.size * 8 - 1);
+ (n > r || n < -(r + wD)) && this._throwError("value out-of-bounds", t), n = lb(n, 8 * Hn);
+ } else (n < _D || n > So(s, this.size * 8)) && this._throwError("value out-of-bounds", t);
return e.writeValue(n);
}
decode(e) {
- let t = Io(e.readValue(), this.size * 8);
- return this.signed && (t = vF(t, this.size * 8)), t;
+ let t = So(e.readValue(), this.size * 8);
+ return this.signed && (t = CF(t, this.size * 8)), t;
}
}
-class CD extends Xb {
+class ID extends Yb {
constructor(e) {
super("string", e);
}
@@ -41504,10 +41504,10 @@ class CD extends Xb {
return super.encode(e, gs(jt.dereference(t, "string")));
}
decode(e) {
- return th(super.decode(e));
+ return ih(super.decode(e));
}
}
-class El extends _s {
+class yl extends _s {
coders;
constructor(e, t) {
let n = !1;
@@ -41534,13 +41534,13 @@ class El extends _s {
}
encode(e, t) {
const n = jt.dereference(t, "tuple");
- return Kb(e, this.coders, n);
+ return jb(e, this.coders, n);
}
decode(e) {
- return jb(e, this.coders);
+ return Xb(e, this.coders);
}
}
-function Zu(i, e) {
+function ed(i, e) {
return {
address: Mt(i),
storageKeys: e.map((t, n) => (V(Ut(t, 32), "invalid slot", `storageKeys[${n}]`, t), t.toLowerCase()))
@@ -41548,15 +41548,15 @@ function Zu(i, e) {
}
function Hr(i) {
if (Array.isArray(i))
- return i.map((t, n) => Array.isArray(t) ? (V(t.length === 2, "invalid slot set", `value[${n}]`, t), Zu(t[0], t[1])) : (V(t != null && typeof t == "object", "invalid address-slot set", "value", i), Zu(t.address, t.storageKeys)));
+ return i.map((t, n) => Array.isArray(t) ? (V(t.length === 2, "invalid slot set", `value[${n}]`, t), ed(t[0], t[1])) : (V(t != null && typeof t == "object", "invalid address-slot set", "value", i), ed(t.address, t.storageKeys)));
V(i != null && typeof i == "object", "invalid access list", "value", i);
const e = Object.keys(i).map((t) => {
const n = i[t].reduce((s, r) => (s[r] = !0, s), {});
- return Zu(t, Object.keys(n).sort());
+ return ed(t, Object.keys(n).sort());
});
return e.sort((t, n) => t.address.localeCompare(n.address)), e;
}
-function Yb(i) {
+function Jb(i) {
return {
address: Mt(i.address),
nonce: De(i.nonce != null ? i.nonce : 0),
@@ -41564,15 +41564,15 @@ function Yb(i) {
signature: zt.from(i.signature)
};
}
-function ID(i) {
+function SD(i) {
let e;
- return typeof i == "string" ? e = as.computePublicKey(i, !1) : e = i.publicKey, Mt(sn("0x" + e.substring(4)).substring(26));
+ return typeof i == "string" ? e = os.computePublicKey(i, !1) : e = i.publicKey, Mt(sn("0x" + e.substring(4)).substring(26));
}
-function SD(i, e) {
- return ID(as.recoverPublicKey(i, e));
+function MD(i, e) {
+ return SD(os.recoverPublicKey(i, e));
}
-const _n = BigInt(0), MD = BigInt(2), BD = BigInt(27), TD = BigInt(28), RD = BigInt(35), FD = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), ND = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), $u = 4096 * 32, Tl = 128;
-function DD(i) {
+const _n = BigInt(0), BD = BigInt(2), TD = BigInt(27), RD = BigInt(28), FD = BigInt(35), ND = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), DD = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), td = 4096 * 32, Fl = 128;
+function LD(i) {
return { blobToKzgCommitment: (n) => {
if ("computeBlobProof" in i) {
if ("blobToKzgCommitment" in i && typeof i.blobToKzgCommitment == "function")
@@ -41592,23 +41592,23 @@ function DD(i) {
V(!1, "unsupported KZG library", "kzg", i);
} };
}
-function Sm(i, e) {
+function Bm(i, e) {
let t = i.toString(16);
for (; t.length < 2; )
t = "0" + t;
- return t += Ja(e).substring(4), "0x" + t;
+ return t += Za(e).substring(4), "0x" + t;
}
-function Za(i) {
+function $a(i) {
return i === "0x" ? null : Mt(i);
}
-function Mh(i, e) {
+function Th(i, e) {
try {
return Hr(i);
} catch (t) {
V(!1, t.message, e, i);
}
}
-function LD(i, e) {
+function PD(i, e) {
try {
if (!Array.isArray(i))
throw new Error("authorizationList: invalid array");
@@ -41622,7 +41622,7 @@ function LD(i, e) {
if (!s[1])
throw new Error(`authorization[${n}]: null address`);
t.push({
- address: Za(s[1]),
+ address: $a(s[1]),
nonce: Nt(s[2], "nonce"),
chainId: Nt(s[0], "chainId"),
signature: zt.from({
@@ -41644,16 +41644,16 @@ function Nt(i, e) {
if (i === "0x")
return _n;
const t = De(i, e);
- return V(t <= FD, "value exceeds uint size", e, t), t;
+ return V(t <= ND, "value exceeds uint size", e, t), t;
}
function Et(i, e) {
const t = De(i, "value"), n = rn(t);
return V(n.length <= 32, "value too large", `tx.${e}`, t), n;
}
-function Bh(i) {
+function Rh(i) {
return Hr(i).map((e) => [e.address, e.storageKeys]);
}
-function PD(i) {
+function kD(i) {
return i.map((e) => [
Et(e.chainId, "chainId"),
e.address,
@@ -41663,21 +41663,21 @@ function PD(i) {
rn(e.signature._s)
]);
}
-function kD(i, e) {
+function UD(i, e) {
V(Array.isArray(i), `invalid ${e}`, "value", i);
for (let t = 0; t < i.length; t++)
V(Ut(i[t], 32), "invalid ${ param } hash", `value[${t}]`, i[t]);
return i;
}
-function UD(i) {
- const e = gc(i);
+function OD(i) {
+ const e = mc(i);
V(Array.isArray(e) && (e.length === 9 || e.length === 6), "invalid field count for legacy transaction", "data", i);
const t = {
type: 0,
nonce: zr(e[0], "nonce"),
gasPrice: Nt(e[1], "gasPrice"),
gasLimit: Nt(e[2], "gasLimit"),
- to: Za(e[3]),
+ to: $a(e[3]),
value: Nt(e[4], "value"),
data: Ie(e[5]),
chainId: _n
@@ -41688,8 +41688,8 @@ function UD(i) {
if (s === _n && r === _n)
t.chainId = n;
else {
- let a = (n - RD) / MD;
- a < _n && (a = _n), t.chainId = a, V(a !== _n || n === BD || n === TD, "non-canonical legacy v", "v", e[6]), t.signature = zt.from({
+ let a = (n - FD) / BD;
+ a < _n && (a = _n), t.chainId = a, V(a !== _n || n === TD || n === RD, "non-canonical legacy v", "v", e[6]), t.signature = zt.from({
r: Es(e[7], 32),
s: Es(e[8], 32),
v: n
@@ -41697,7 +41697,7 @@ function UD(i) {
}
return t;
}
-function OD(i, e) {
+function QD(i, e) {
const t = [
Et(i.nonce, "nonce"),
Et(i.gasPrice || 0, "gasPrice"),
@@ -41718,7 +41718,7 @@ function OD(i, e) {
let s = BigInt(27 + e.yParity);
return n !== _n ? s = zt.getChainIdV(n, e.v) : BigInt(e.v) !== s && V(!1, "tx.chainId/sig.v mismatch", "sig", e), t.push(rn(s)), t.push(rn(e.r)), t.push(rn(e._s)), ms(t);
}
-function Th(i, e) {
+function Fh(i, e) {
let t;
try {
if (t = zr(e[0], "yParity"), t !== 0 && t !== 1)
@@ -41729,8 +41729,8 @@ function Th(i, e) {
const n = Es(e[1], 32), s = Es(e[2], 32), r = zt.from({ r: n, s, yParity: t });
i.signature = r;
}
-function QD(i) {
- const e = gc(dt(i).slice(1));
+function GD(i) {
+ const e = mc(dt(i).slice(1));
V(Array.isArray(e) && (e.length === 9 || e.length === 12), "invalid field count for transaction type: 2", "data", Ie(i));
const t = {
type: 2,
@@ -41740,14 +41740,14 @@ function QD(i) {
maxFeePerGas: Nt(e[3], "maxFeePerGas"),
gasPrice: null,
gasLimit: Nt(e[4], "gasLimit"),
- to: Za(e[5]),
+ to: $a(e[5]),
value: Nt(e[6], "value"),
data: Ie(e[7]),
- accessList: Mh(e[8], "accessList")
+ accessList: Th(e[8], "accessList")
};
- return e.length === 9 || Th(t, e.slice(9)), t;
+ return e.length === 9 || Fh(t, e.slice(9)), t;
}
-function GD(i, e) {
+function HD(i, e) {
const t = [
Et(i.chainId, "chainId"),
Et(i.nonce, "nonce"),
@@ -41757,12 +41757,12 @@ function GD(i, e) {
i.to || "0x",
Et(i.value, "value"),
i.data,
- Bh(i.accessList || [])
+ Rh(i.accessList || [])
];
return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Ht(["0x02", ms(t)]);
}
-function HD(i) {
- const e = gc(dt(i).slice(1));
+function zD(i) {
+ const e = mc(dt(i).slice(1));
V(Array.isArray(e) && (e.length === 8 || e.length === 11), "invalid field count for transaction type: 1", "data", Ie(i));
const t = {
type: 1,
@@ -41770,14 +41770,14 @@ function HD(i) {
nonce: zr(e[1], "nonce"),
gasPrice: Nt(e[2], "gasPrice"),
gasLimit: Nt(e[3], "gasLimit"),
- to: Za(e[4]),
+ to: $a(e[4]),
value: Nt(e[5], "value"),
data: Ie(e[6]),
- accessList: Mh(e[7], "accessList")
+ accessList: Th(e[7], "accessList")
};
- return e.length === 8 || Th(t, e.slice(8)), t;
+ return e.length === 8 || Fh(t, e.slice(8)), t;
}
-function zD(i, e) {
+function VD(i, e) {
const t = [
Et(i.chainId, "chainId"),
Et(i.nonce, "nonce"),
@@ -41786,12 +41786,12 @@ function zD(i, e) {
i.to || "0x",
Et(i.value, "value"),
i.data,
- Bh(i.accessList || [])
+ Rh(i.accessList || [])
];
return e && (t.push(Et(e.yParity, "recoveryParam")), t.push(rn(e.r)), t.push(rn(e.s))), Ht(["0x01", ms(t)]);
}
-function VD(i) {
- let e = gc(dt(i).slice(1)), t = "3", n = null, s = null;
+function WD(i) {
+ let e = mc(dt(i).slice(1)), t = "3", n = null, s = null;
if (e.length === 4 && Array.isArray(e[0])) {
t = "3 (network format)";
const a = e[1], o = e[2], c = e[3];
@@ -41806,11 +41806,11 @@ function VD(i) {
} else if (e.length === 5 && Array.isArray(e[0])) {
t = "3 (EIP-7594 network format)", n = ft(e[1]);
const a = e[2], o = e[3], c = e[4];
- V(n === 1, `unsupported EIP-7594 network format version: ${n}`, "fields[1]", n), V(Array.isArray(a), "invalid EIP-7594 network format: blobs not an array", "fields[2]", a), V(Array.isArray(o), "invalid EIP-7594 network format: commitments not an array", "fields[3]", o), V(Array.isArray(c), "invalid EIP-7594 network format: proofs not an array", "fields[4]", c), V(a.length === o.length, "invalid network format: blobs/commitments length mismatch", "fields", e), V(a.length * Tl === c.length, "invalid network format: blobs/proofs length mismatch", "fields", e), s = [];
+ V(n === 1, `unsupported EIP-7594 network format version: ${n}`, "fields[1]", n), V(Array.isArray(a), "invalid EIP-7594 network format: blobs not an array", "fields[2]", a), V(Array.isArray(o), "invalid EIP-7594 network format: commitments not an array", "fields[3]", o), V(Array.isArray(c), "invalid EIP-7594 network format: proofs not an array", "fields[4]", c), V(a.length === o.length, "invalid network format: blobs/commitments length mismatch", "fields", e), V(a.length * Fl === c.length, "invalid network format: blobs/proofs length mismatch", "fields", e), s = [];
for (let l = 0; l < a.length; l++) {
const h = [];
- for (let u = 0; u < Tl; u++)
- h.push(c[l * Tl + u]);
+ for (let u = 0; u < Fl; u++)
+ h.push(c[l * Fl + u]);
s.push({
data: a[l],
commitment: o[l],
@@ -41828,10 +41828,10 @@ function VD(i) {
maxFeePerGas: Nt(e[3], "maxFeePerGas"),
gasPrice: null,
gasLimit: Nt(e[4], "gasLimit"),
- to: Za(e[5]),
+ to: $a(e[5]),
value: Nt(e[6], "value"),
data: Ie(e[7]),
- accessList: Mh(e[8], "accessList"),
+ accessList: Th(e[8], "accessList"),
maxFeePerBlobGas: Nt(e[9], "maxFeePerBlobGas"),
blobVersionedHashes: e[10],
blobWrapperVersion: n
@@ -41839,27 +41839,27 @@ function VD(i) {
s && (r.blobs = s), V(r.to != null, `invalid address for transaction type: ${t}`, "data", i), V(Array.isArray(r.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", i);
for (let a = 0; a < r.blobVersionedHashes.length; a++)
V(Ut(r.blobVersionedHashes[a], 32), `invalid blobVersionedHash at index ${a}: must be length 32`, "data", i);
- return e.length === 11 || Th(r, e.slice(11)), r;
+ return e.length === 11 || Fh(r, e.slice(11)), r;
}
-function WD(i, e, t) {
+function qD(i, e, t) {
const n = [
Et(i.chainId, "chainId"),
Et(i.nonce, "nonce"),
Et(i.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
Et(i.maxFeePerGas || 0, "maxFeePerGas"),
Et(i.gasLimit, "gasLimit"),
- i.to || sc,
+ i.to || rc,
Et(i.value, "value"),
i.data,
- Bh(i.accessList || []),
+ Rh(i.accessList || []),
Et(i.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),
- kD(i.blobVersionedHashes || [], "blobVersionedHashes")
+ UD(i.blobVersionedHashes || [], "blobVersionedHashes")
];
if (e && (n.push(Et(e.yParity, "yParity")), n.push(rn(e.r)), n.push(rn(e.s)), t)) {
if (i.blobWrapperVersion != null) {
const s = rn(i.blobWrapperVersion), r = [];
for (const { proof: a } of t) {
- const o = dt(a), c = o.length / Tl;
+ const o = dt(a), c = o.length / Fl;
for (let l = 0; l < o.length; l += c)
r.push(o.subarray(l, l + c));
}
@@ -41886,8 +41886,8 @@ function WD(i, e, t) {
}
return Ht(["0x03", ms(n)]);
}
-function qD(i) {
- const e = gc(dt(i).slice(1));
+function KD(i) {
+ const e = mc(dt(i).slice(1));
V(Array.isArray(e) && (e.length === 10 || e.length === 13), "invalid field count for transaction type: 4", "data", Ie(i));
const t = {
type: 4,
@@ -41897,15 +41897,15 @@ function qD(i) {
maxFeePerGas: Nt(e[3], "maxFeePerGas"),
gasPrice: null,
gasLimit: Nt(e[4], "gasLimit"),
- to: Za(e[5]),
+ to: $a(e[5]),
value: Nt(e[6], "value"),
data: Ie(e[7]),
- accessList: Mh(e[8], "accessList"),
- authorizationList: LD(e[9], "authorizationList")
+ accessList: Th(e[8], "accessList"),
+ authorizationList: PD(e[9], "authorizationList")
};
- return e.length === 10 || Th(t, e.slice(10)), t;
+ return e.length === 10 || Fh(t, e.slice(10)), t;
}
-function KD(i, e) {
+function jD(i, e) {
const t = [
Et(i.chainId, "chainId"),
Et(i.nonce, "nonce"),
@@ -41915,12 +41915,12 @@ function KD(i, e) {
i.to || "0x",
Et(i.value, "value"),
i.data,
- Bh(i.accessList || []),
- PD(i.authorizationList || [])
+ Rh(i.accessList || []),
+ kD(i.authorizationList || [])
];
return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Ht(["0x04", ms(t)]);
}
-class _i {
+class wi {
#e;
#t;
#n;
@@ -42005,7 +42005,7 @@ class _i {
*/
get to() {
const e = this.#t;
- return e == null && this.type === 3 ? sc : e;
+ return e == null && this.type === 3 ? rc : e;
}
set to(e) {
this.#t = e == null ? null : Mt(e);
@@ -42130,7 +42130,7 @@ class _i {
return e == null && this.type === 4 ? [] : e;
}
set authorizationList(e) {
- this.#x = e == null ? null : e.map((t) => Yb(t));
+ this.#x = e == null ? null : e.map((t) => Jb(t));
}
/**
* The max fee per blob gas for Cancun transactions.
@@ -42196,13 +42196,13 @@ class _i {
const t = [], n = [];
for (let s = 0; s < e.length; s++) {
const r = e[s];
- if (Ap(r)) {
+ if (mp(r)) {
ge(this.#u, "adding a raw blob requires a KZG library", "UNSUPPORTED_OPERATION", {
operation: "set blobs()"
});
let a = dt(r);
- if (V(a.length <= $u, "blob is too large", `blobs[${s}]`, r), a.length !== $u) {
- const l = new Uint8Array($u);
+ if (V(a.length <= td, "blob is too large", `blobs[${s}]`, r), a.length !== td) {
+ const l = new Uint8Array(td);
l.set(a), a = l;
}
const o = this.#u.blobToKzgCommitment(a), c = Ie(this.#u.computeBlobKzgProof(a, o));
@@ -42210,10 +42210,10 @@ class _i {
data: Ie(a),
commitment: Ie(o),
proof: c
- }), n.push(Sm(1, o));
+ }), n.push(Bm(1, o));
} else {
const a = Ie(r.data), o = Ie(r.commitment), c = Ie(r.proof);
- t.push({ data: a, commitment: o, proof: c }), n.push(Sm(1, o));
+ t.push({ data: a, commitment: o, proof: c }), n.push(Bm(1, o));
}
}
this.#d = t, this.#h = n;
@@ -42222,7 +42222,7 @@ class _i {
return this.#u;
}
set kzg(e) {
- e == null ? this.#u = null : this.#u = DD(e);
+ e == null ? this.#u = null : this.#u = LD(e);
}
get blobWrapperVersion() {
return this.#g;
@@ -42255,13 +42255,13 @@ class _i {
* The sending address, if signed. Otherwise, ``null``.
*/
get from() {
- return this.signature == null ? null : SD(this.unsignedHash, this.signature.getCanonical());
+ return this.signature == null ? null : MD(this.unsignedHash, this.signature.getCanonical());
}
/**
* The public key of the sender, if signed. Otherwise, ``null``.
*/
get fromPublicKey() {
- return this.signature == null ? null : as.recoverPublicKey(this.unsignedHash, this.signature.getCanonical());
+ return this.signature == null ? null : os.recoverPublicKey(this.unsignedHash, this.signature.getCanonical());
}
/**
* Returns true if signed.
@@ -42277,15 +42277,15 @@ class _i {
const n = e ? this.signature : null;
switch (this.inferType()) {
case 0:
- return OD(this, n);
+ return QD(this, n);
case 1:
- return zD(this, n);
+ return VD(this, n);
case 2:
- return GD(this, n);
+ return HD(this, n);
case 3:
- return WD(this, n, t ? this.blobs : null);
+ return qD(this, n, t ? this.blobs : null);
case 4:
- return KD(this, n);
+ return jD(this, n);
}
ge(!1, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" });
}
@@ -42369,7 +42369,7 @@ class _i {
* Create a copy of this transaciton.
*/
clone() {
- return _i.from(this);
+ return wi.from(this);
}
/**
* Return a JSON-friendly object.
@@ -42392,7 +42392,7 @@ class _i {
accessList: this.accessList
};
}
- [ND]() {
+ [DD]() {
return this.toString();
}
toString() {
@@ -42418,33 +42418,33 @@ class _i {
*/
static from(e) {
if (e == null)
- return new _i();
+ return new wi();
if (typeof e == "string") {
const n = dt(e);
if (n[0] >= 127)
- return _i.from(UD(n));
+ return wi.from(OD(n));
switch (n[0]) {
case 1:
- return _i.from(HD(n));
+ return wi.from(zD(n));
case 2:
- return _i.from(QD(n));
+ return wi.from(GD(n));
case 3:
- return _i.from(VD(n));
+ return wi.from(WD(n));
case 4:
- return _i.from(qD(n));
+ return wi.from(KD(n));
}
ge(!1, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" });
}
- const t = new _i();
+ const t = new wi();
return e.type != null && (t.type = e.type), e.to != null && (t.to = e.to), e.nonce != null && (t.nonce = e.nonce), e.gasLimit != null && (t.gasLimit = e.gasLimit), e.gasPrice != null && (t.gasPrice = e.gasPrice), e.maxPriorityFeePerGas != null && (t.maxPriorityFeePerGas = e.maxPriorityFeePerGas), e.maxFeePerGas != null && (t.maxFeePerGas = e.maxFeePerGas), e.maxFeePerBlobGas != null && (t.maxFeePerBlobGas = e.maxFeePerBlobGas), e.data != null && (t.data = e.data), e.value != null && (t.value = e.value), e.chainId != null && (t.chainId = e.chainId), e.signature != null && (t.signature = zt.from(e.signature)), e.accessList != null && (t.accessList = e.accessList), e.authorizationList != null && (t.authorizationList = e.authorizationList), e.blobVersionedHashes != null && (t.blobVersionedHashes = e.blobVersionedHashes), e.kzg != null && (t.kzg = e.kzg), e.blobWrapperVersion != null && (t.blobWrapperVersion = e.blobWrapperVersion), e.blobs != null && (t.blobs = e.blobs), e.hash != null && (V(t.isSigned(), "unsigned transaction cannot define '.hash'", "tx", e), V(t.hash === e.hash, "hash mismatch", "tx", e)), e.from != null && (V(t.isSigned(), "unsigned transaction cannot define '.from'", "tx", e), V(t.from.toLowerCase() === (e.from || "").toLowerCase(), "from mismatch", "tx", e)), t;
}
}
function kr(i) {
return sn(gs(i));
}
-var jD = "AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXq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LQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";
-const Mm = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]), Bm = 4;
-function XD(i) {
+var XD = "AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NE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YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";
+const Tm = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]), Rm = 4;
+function YD(i) {
let e = 0;
function t() {
return i[e++] << 8 | i[e++];
@@ -42491,14 +42491,14 @@ function XD(i) {
}
});
}
-function YD(i) {
+function JD(i) {
let e = 0;
return () => i[e++];
}
-function Jb(i) {
- return YD(XD(JD(i)));
+function Zb(i) {
+ return JD(YD(ZD(i)));
}
-function JD(i) {
+function ZD(i) {
let e = [];
[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s, r) => e[s.charCodeAt(0)] = r);
let t = i.length, n = new Uint8Array(6 * t >> 3);
@@ -42506,15 +42506,15 @@ function JD(i) {
o = o << 6 | e[i.charCodeAt(s)], a += 6, a >= 8 && (n[r++] = o >> (a -= 8));
return n;
}
-function ZD(i) {
+function $D(i) {
return i & 1 ? ~i >> 1 : i >> 1;
}
-function $D(i, e) {
+function eL(i, e) {
let t = Array(i);
- for (let n = 0, s = 0; n < i; n++) t[n] = s += ZD(e());
+ for (let n = 0, s = 0; n < i; n++) t[n] = s += $D(e());
return t;
}
-function rc(i, e = 0) {
+function ac(i, e = 0) {
let t = [];
for (; ; ) {
let n = i(), s = i();
@@ -42526,27 +42526,27 @@ function rc(i, e = 0) {
}
return t;
}
-function Zb(i) {
- return ac(() => {
- let e = rc(i);
+function $b(i) {
+ return oc(() => {
+ let e = ac(i);
if (e.length) return e;
});
}
-function $b(i) {
+function eE(i) {
let e = [];
for (; ; ) {
let t = i();
if (t == 0) break;
- e.push(eL(t, i));
+ e.push(tL(t, i));
}
for (; ; ) {
let t = i() - 1;
if (t < 0) break;
- e.push(tL(t, i));
+ e.push(nL(t, i));
}
return e.flat();
}
-function ac(i) {
+function oc(i) {
let e = [];
for (; ; ) {
let t = i(e.length);
@@ -42555,15 +42555,15 @@ function ac(i) {
}
return e;
}
-function eE(i, e, t) {
+function tE(i, e, t) {
let n = Array(i).fill().map(() => []);
for (let s = 0; s < e; s++)
- $D(i, t).forEach((r, a) => n[a].push(r));
+ eL(i, t).forEach((r, a) => n[a].push(r));
return n;
}
-function eL(i, e) {
- let t = 1 + e(), n = e(), s = ac(e);
- return eE(s.length, 1 + i, e).flatMap((a, o) => {
+function tL(i, e) {
+ let t = 1 + e(), n = e(), s = oc(e);
+ return tE(s.length, 1 + i, e).flatMap((a, o) => {
let [c, ...l] = a;
return Array(s[o]).fill().map((h, u) => {
let d = u * n;
@@ -42571,16 +42571,16 @@ function eL(i, e) {
});
});
}
-function tL(i, e) {
+function nL(i, e) {
let t = 1 + e();
- return eE(t, 1 + i, e).map((s) => [s[0], s.slice(1)]);
+ return tE(t, 1 + i, e).map((s) => [s[0], s.slice(1)]);
}
-function nL(i) {
- let e = [], t = rc(i);
+function iL(i) {
+ let e = [], t = ac(i);
return s(n([]), []), e;
function n(r) {
- let a = i(), o = ac(() => {
- let c = rc(i).map((l) => t[l]);
+ let a = i(), o = oc(() => {
+ let c = ac(i).map((l) => t[l]);
if (c.length) return n(c);
});
return { S: a, B: o, Q: r };
@@ -42594,13 +42594,13 @@ function nL(i) {
}
}
}
-function iL(i) {
+function sL(i) {
return i.toString(16).toUpperCase().padStart(2, "0");
}
-function tE(i) {
- return `{${iL(i)}}`;
+function nE(i) {
+ return `{${sL(i)}}`;
}
-function sL(i) {
+function rL(i) {
let e = [];
for (let t = 0, n = i.length; t < n; ) {
let s = i.codePointAt(t);
@@ -42608,7 +42608,7 @@ function sL(i) {
}
return e;
}
-function Ga(i) {
+function Ha(i) {
let t = i.length;
if (t < 4096) return String.fromCodePoint(...i);
let n = [];
@@ -42616,69 +42616,69 @@ function Ga(i) {
n.push(String.fromCodePoint(...i.slice(s, s += 4096)));
return n.join("");
}
-function rL(i, e) {
+function aL(i, e) {
let t = i.length, n = t - e.length;
for (let s = 0; n == 0 && s < t; s++) n = i[s] - e[s];
return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ch, lL = cc + cL, hL = rh + iE, uL = ah + sE, dL = oh + za;
+function Mo(i) {
return i >> 24 & 255;
}
-function sE(i) {
+function rE(i) {
return i & 16777215;
}
-let bf, Tm, Ef, Rl;
-function dL() {
- let i = Jb(aL);
- bf = new Map(Zb(i).flatMap((e, t) => e.map((n) => [n, t + 1 << 24]))), Tm = new Set(rc(i)), Ef = /* @__PURE__ */ new Map(), Rl = /* @__PURE__ */ new Map();
- for (let [e, t] of $b(i)) {
- if (!Tm.has(e) && t.length == 2) {
- let [n, s] = t, r = Rl.get(n);
- r || (r = /* @__PURE__ */ new Map(), Rl.set(n, r)), r.set(s, e);
+let yf, Fm, _f, Nl;
+function fL() {
+ let i = Zb(oL);
+ yf = new Map($b(i).flatMap((e, t) => e.map((n) => [n, t + 1 << 24]))), Fm = new Set(ac(i)), _f = /* @__PURE__ */ new Map(), Nl = /* @__PURE__ */ new Map();
+ for (let [e, t] of eE(i)) {
+ if (!Fm.has(e) && t.length == 2) {
+ let [n, s] = t, r = Nl.get(n);
+ r || (r = /* @__PURE__ */ new Map(), Nl.set(n, r)), r.set(s, e);
}
- Ef.set(e, t.reverse());
+ _f.set(e, t.reverse());
}
}
-function rE(i) {
- return i >= oc && i < cL;
+function aE(i) {
+ return i >= cc && i < lL;
}
-function fL(i, e) {
- if (i >= ih && i < lL && e >= sh && e < hL)
- return oc + (i - ih) * ah + (e - sh) * Ha;
- if (rE(i) && e > rh && e < uL && (i - oc) % Ha == 0)
- return i + (e - rh);
+function pL(i, e) {
+ if (i >= rh && i < hL && e >= ah && e < uL)
+ return cc + (i - rh) * ch + (e - ah) * za;
+ if (aE(i) && e > oh && e < dL && (i - cc) % za == 0)
+ return i + (e - oh);
{
- let t = Rl.get(i);
+ let t = Nl.get(i);
return t && (t = t.get(e), t) ? t : -1;
}
}
-function aE(i) {
- bf || dL();
+function oE(i) {
+ yf || fL();
let e = [], t = [], n = !1;
function s(r) {
- let a = bf.get(r);
+ let a = yf.get(r);
a && (n = !0, r |= a), e.push(r);
}
for (let r of i)
for (; ; ) {
if (r < 128)
e.push(r);
- else if (rE(r)) {
- let a = r - oc, o = a / ah | 0, c = a % ah / Ha | 0, l = a % Ha;
- s(ih + o), s(sh + c), l > 0 && s(rh + l);
+ else if (aE(r)) {
+ let a = r - cc, o = a / ch | 0, c = a % ch / za | 0, l = a % za;
+ s(rh + o), s(ah + c), l > 0 && s(oh + l);
} else {
- let a = Ef.get(r);
+ let a = _f.get(r);
a ? t.push(...a) : s(r);
}
if (!t.length) break;
r = t.pop();
}
if (n && e.length > 1) {
- let r = So(e[0]);
+ let r = Mo(e[0]);
for (let a = 1; a < e.length; a++) {
- let o = So(e[a]);
+ let o = Mo(e[a]);
if (o == 0 || r <= o) {
r = o;
continue;
@@ -42686,76 +42686,76 @@ function aE(i) {
let c = a - 1;
for (; ; ) {
let l = e[c + 1];
- if (e[c + 1] = e[c], e[c] = l, !c || (r = So(e[--c]), r <= o)) break;
+ if (e[c + 1] = e[c], e[c] = l, !c || (r = Mo(e[--c]), r <= o)) break;
}
- r = So(e[a]);
+ r = Mo(e[a]);
}
}
return e;
}
-function pL(i) {
+function AL(i) {
let e = [], t = [], n = -1, s = 0;
for (let r of i) {
- let a = So(r), o = sE(r);
+ let a = Mo(r), o = rE(r);
if (n == -1)
a == 0 ? n = o : e.push(o);
else if (s > 0 && s >= a)
a == 0 ? (e.push(n, ...t), t.length = 0, n = o) : t.push(o), s = a;
else {
- let c = fL(n, o);
+ let c = pL(n, o);
c >= 0 ? n = c : s == 0 && a == 0 ? (e.push(n), n = o) : (t.push(o), s = a);
}
}
return n >= 0 && e.push(n, ...t), e;
}
-function oE(i) {
- return aE(i).map(sE);
+function cE(i) {
+ return oE(i).map(rE);
}
-function AL(i) {
- return pL(aE(i));
+function gL(i) {
+ return AL(oE(i));
}
-const Rm = 45, cE = ".", lE = 65039, hE = 1, oh = (i) => Array.from(i);
-function cc(i, e) {
+const Nm = 45, lE = ".", hE = 65039, uE = 1, lh = (i) => Array.from(i);
+function lc(i, e) {
return i.P.has(e) || i.Q.has(e);
}
-class gL extends Array {
+class mL extends Array {
get is_emoji() {
return !0;
}
// free tagging system
}
-let yf, uE, wr, _f, dE, Ta, ed, pa, fr, Fm, wf;
-function Sp() {
- if (yf) return;
- let i = Jb(jD);
- const e = () => rc(i), t = () => new Set(e()), n = (h, u) => u.forEach((d) => h.add(d));
- yf = new Map($b(i)), uE = t(), wr = e(), _f = new Set(e().map((h) => wr[h])), wr = new Set(wr), dE = t(), t();
- let s = Zb(i), r = i();
+let wf, dE, wr, vf, fE, Ra, nd, Aa, fr, Dm, Cf;
+function Bp() {
+ if (wf) return;
+ let i = Zb(XD);
+ const e = () => ac(i), t = () => new Set(e()), n = (h, u) => u.forEach((d) => h.add(d));
+ wf = new Map(eE(i)), dE = t(), wr = e(), vf = new Set(e().map((h) => wr[h])), wr = new Set(wr), fE = t(), t();
+ let s = $b(i), r = i();
const a = () => {
let h = /* @__PURE__ */ new Set();
return e().forEach((u) => n(h, s[u])), n(h, e()), h;
};
- Ta = ac((h) => {
- let u = ac(i).map((d) => d + 96);
+ Ra = oc((h) => {
+ let u = oc(i).map((d) => d + 96);
if (u.length) {
let d = h >= r;
- u[0] -= 32, u = Ga(u), d && (u = `Restricted[${u}]`);
+ u[0] -= 32, u = Ha(u), d && (u = `Restricted[${u}]`);
let f = a(), p = a(), m = !i();
return { N: u, P: f, Q: p, M: m, R: d };
}
- }), ed = t(), pa = /* @__PURE__ */ new Map();
- let o = e().concat(oh(ed)).sort((h, u) => h - u);
+ }), nd = t(), Aa = /* @__PURE__ */ new Map();
+ let o = e().concat(lh(nd)).sort((h, u) => h - u);
o.forEach((h, u) => {
let d = i(), f = o[u] = d ? o[u - d] : { V: [], M: /* @__PURE__ */ new Map() };
- f.V.push(h), ed.has(h) || pa.set(h, f);
+ f.V.push(h), nd.has(h) || Aa.set(h, f);
});
- for (let { V: h, M: u } of new Set(pa.values())) {
+ for (let { V: h, M: u } of new Set(Aa.values())) {
let d = [];
for (let p of h) {
- let m = Ta.filter((A) => cc(A, p)), g = d.find(({ G: A }) => m.some((_) => A.has(_)));
+ let m = Ra.filter((A) => lc(A, p)), g = d.find(({ G: A }) => m.some((_) => A.has(_)));
g || (g = { G: /* @__PURE__ */ new Set(), V: [] }, d.push(g)), g.V.push(p), n(g.G, m);
}
- let f = d.flatMap((p) => oh(p.G));
+ let f = d.flatMap((p) => lh(p.G));
for (let { G: p, V: m } of d) {
let g = new Set(f.filter((A) => !p.has(A)));
for (let A of m)
@@ -42765,106 +42765,106 @@ function Sp() {
fr = /* @__PURE__ */ new Set();
let c = /* @__PURE__ */ new Set();
const l = (h) => fr.has(h) ? c.add(h) : fr.add(h);
- for (let h of Ta) {
+ for (let h of Ra) {
for (let u of h.P) l(u);
for (let u of h.Q) l(u);
}
for (let h of fr)
- !pa.has(h) && !c.has(h) && pa.set(h, hE);
- n(fr, oE(fr)), Fm = nL(i).map((h) => gL.from(h)).sort(rL), wf = /* @__PURE__ */ new Map();
- for (let h of Fm) {
- let u = [wf];
+ !Aa.has(h) && !c.has(h) && Aa.set(h, uE);
+ n(fr, cE(fr)), Dm = iL(i).map((h) => mL.from(h)).sort(aL), Cf = /* @__PURE__ */ new Map();
+ for (let h of Dm) {
+ let u = [Cf];
for (let d of h) {
let f = u.map((p) => {
let m = p.get(d);
return m || (m = /* @__PURE__ */ new Map(), p.set(d, m)), m;
});
- d === lE ? u.push(...f) : u = f;
+ d === hE ? u.push(...f) : u = f;
}
for (let d of u)
d.V = h;
}
}
-function Mp(i) {
- return (fE(i) ? "" : `${Bp(Rh([i]))} `) + tE(i);
+function Tp(i) {
+ return (pE(i) ? "" : `${Rp(Nh([i]))} `) + nE(i);
}
-function Bp(i) {
+function Rp(i) {
return `"${i}"‎`;
}
-function mL(i) {
- if (i.length >= 4 && i[2] == Rm && i[3] == Rm)
- throw new Error(`invalid label extension: "${Ga(i.slice(0, 4))}"`);
-}
function xL(i) {
+ if (i.length >= 4 && i[2] == Nm && i[3] == Nm)
+ throw new Error(`invalid label extension: "${Ha(i.slice(0, 4))}"`);
+}
+function bL(i) {
for (let t = i.lastIndexOf(95); t > 0; )
if (i[--t] !== 95)
throw new Error("underscore allowed only at start");
}
-function bL(i) {
- let e = i[0], t = Mm.get(e);
- if (t) throw Uo(`leading ${t}`);
+function EL(i) {
+ let e = i[0], t = Tm.get(e);
+ if (t) throw Oo(`leading ${t}`);
let n = i.length, s = -1;
for (let r = 1; r < n; r++) {
e = i[r];
- let a = Mm.get(e);
+ let a = Tm.get(e);
if (a) {
- if (s == r) throw Uo(`${t} + ${a}`);
+ if (s == r) throw Oo(`${t} + ${a}`);
s = r + 1, t = a;
}
}
- if (s == n) throw Uo(`trailing ${t}`);
+ if (s == n) throw Oo(`trailing ${t}`);
}
-function Rh(i, e = 1 / 0, t = tE) {
+function Nh(i, e = 1 / 0, t = nE) {
let n = [];
- EL(i[0]) && n.push("◌"), i.length > e && (e >>= 1, i = [...i.slice(0, e), 8230, ...i.slice(-e)]);
+ yL(i[0]) && n.push("◌"), i.length > e && (e >>= 1, i = [...i.slice(0, e), 8230, ...i.slice(-e)]);
let s = 0, r = i.length;
for (let a = 0; a < r; a++) {
let o = i[a];
- fE(o) && (n.push(Ga(i.slice(s, a))), n.push(t(o)), s = a + 1);
+ pE(o) && (n.push(Ha(i.slice(s, a))), n.push(t(o)), s = a + 1);
}
- return n.push(Ga(i.slice(s, r))), n.join("");
+ return n.push(Ha(i.slice(s, r))), n.join("");
}
-function EL(i) {
- return Sp(), wr.has(i);
+function yL(i) {
+ return Bp(), wr.has(i);
}
-function fE(i) {
- return Sp(), dE.has(i);
+function pE(i) {
+ return Bp(), fE.has(i);
}
-function yL(i) {
- return CL(_L(i, AL, ML));
+function _L(i) {
+ return IL(wL(i, gL, BL));
}
-function _L(i, e, t) {
+function wL(i, e, t) {
if (!i) return [];
- Sp();
+ Bp();
let n = 0;
- return i.split(cE).map((s) => {
- let r = sL(s), a = {
+ return i.split(lE).map((s) => {
+ let r = rL(s), a = {
input: r,
offset: n
// codepoint, not substring!
};
n += r.length + 1;
try {
- let o = a.tokens = SL(r, e, t), c = o.length, l;
+ let o = a.tokens = ML(r, e, t), c = o.length, l;
if (!c)
throw new Error("empty label");
let h = a.output = o.flat();
- if (xL(h), !(a.emoji = c > 1 || o[0].is_emoji) && h.every((d) => d < 128))
- mL(h), l = "ASCII";
+ if (bL(h), !(a.emoji = c > 1 || o[0].is_emoji) && h.every((d) => d < 128))
+ xL(h), l = "ASCII";
else {
let d = o.flatMap((f) => f.is_emoji ? [] : f);
if (!d.length)
l = "Emoji";
else {
- if (wr.has(h[0])) throw Uo("leading combining mark");
+ if (wr.has(h[0])) throw Oo("leading combining mark");
for (let m = 1; m < c; m++) {
let g = o[m];
if (!g.is_emoji && wr.has(g[0]))
- throw Uo(`emoji + combining mark: "${Ga(o[m - 1])} + ${Rh([g[0]])}"`);
+ throw Oo(`emoji + combining mark: "${Ha(o[m - 1])} + ${Nh([g[0]])}"`);
}
- bL(h);
- let f = oh(new Set(d)), [p] = vL(f);
- IL(p, d), wL(p, f), l = p.N;
+ EL(h);
+ let f = lh(new Set(d)), [p] = CL(f);
+ SL(p, d), vL(p, f), l = p.N;
}
}
a.type = l;
@@ -42874,75 +42874,75 @@ function _L(i, e, t) {
return a;
});
}
-function wL(i, e) {
+function vL(i, e) {
let t, n = [];
for (let s of e) {
- let r = pa.get(s);
- if (r === hE) return;
+ let r = Aa.get(s);
+ if (r === uE) return;
if (r) {
let a = r.M.get(s);
- if (t = t ? t.filter((o) => a.has(o)) : oh(a), !t.length) return;
+ if (t = t ? t.filter((o) => a.has(o)) : lh(a), !t.length) return;
} else
n.push(s);
}
if (t) {
for (let s of t)
- if (n.every((r) => cc(s, r)))
+ if (n.every((r) => lc(s, r)))
throw new Error(`whole-script confusable: ${i.N}/${s.N}`);
}
}
-function vL(i) {
- let e = Ta;
+function CL(i) {
+ let e = Ra;
for (let t of i) {
- let n = e.filter((s) => cc(s, t));
+ let n = e.filter((s) => lc(s, t));
if (!n.length)
- throw Ta.some((s) => cc(s, t)) ? AE(e[0], t) : pE(t);
+ throw Ra.some((s) => lc(s, t)) ? gE(e[0], t) : AE(t);
if (e = n, n.length == 1) break;
}
return e;
}
-function CL(i) {
+function IL(i) {
return i.map(({ input: e, error: t, output: n }) => {
if (t) {
let s = t.message;
- throw new Error(i.length == 1 ? s : `Invalid label ${Bp(Rh(e, 63))}: ${s}`);
+ throw new Error(i.length == 1 ? s : `Invalid label ${Rp(Nh(e, 63))}: ${s}`);
}
- return Ga(n);
- }).join(cE);
+ return Ha(n);
+ }).join(lE);
}
-function pE(i) {
- return new Error(`disallowed character: ${Mp(i)}`);
+function AE(i) {
+ return new Error(`disallowed character: ${Tp(i)}`);
}
-function AE(i, e) {
- let t = Mp(e), n = Ta.find((s) => s.P.has(e));
+function gE(i, e) {
+ let t = Tp(e), n = Ra.find((s) => s.P.has(e));
return n && (t = `${n.N} ${t}`), new Error(`illegal mixture: ${i.N} + ${t}`);
}
-function Uo(i) {
+function Oo(i) {
return new Error(`illegal placement: ${i}`);
}
-function IL(i, e) {
+function SL(i, e) {
for (let t of e)
- if (!cc(i, t))
- throw AE(i, t);
+ if (!lc(i, t))
+ throw gE(i, t);
if (i.M) {
- let t = oE(e);
+ let t = cE(e);
for (let n = 1, s = t.length; n < s; n++)
- if (_f.has(t[n])) {
+ if (vf.has(t[n])) {
let r = n + 1;
- for (let a; r < s && _f.has(a = t[r]); r++)
+ for (let a; r < s && vf.has(a = t[r]); r++)
for (let o = n; o < r; o++)
if (t[o] == a)
- throw new Error(`duplicate non-spacing marks: ${Mp(a)}`);
- if (r - n > Bm)
- throw new Error(`excessive non-spacing marks: ${Bp(Rh(t.slice(n - 1, r)))} (${r - n}/${Bm})`);
+ throw new Error(`duplicate non-spacing marks: ${Tp(a)}`);
+ if (r - n > Rm)
+ throw new Error(`excessive non-spacing marks: ${Rp(Nh(t.slice(n - 1, r)))} (${r - n}/${Rm})`);
n = r;
}
}
}
-function SL(i, e, t) {
+function ML(i, e, t) {
let n = [], s = [];
for (i = i.slice().reverse(); i.length; ) {
- let r = BL(i);
+ let r = TL(i);
if (r)
s.length && (n.push(e(s)), s = []), n.push(t(r));
else {
@@ -42950,97 +42950,97 @@ function SL(i, e, t) {
if (fr.has(a))
s.push(a);
else {
- let o = yf.get(a);
+ let o = wf.get(a);
if (o)
s.push(...o);
- else if (!uE.has(a))
- throw pE(a);
+ else if (!dE.has(a))
+ throw AE(a);
}
}
}
return s.length && n.push(e(s)), n;
}
-function ML(i) {
- return i.filter((e) => e != lE);
+function BL(i) {
+ return i.filter((e) => e != hE);
}
-function BL(i, e) {
- let t = wf, n, s = i.length;
+function TL(i, e) {
+ let t = Cf, n, s = i.length;
for (; s && (t = t.get(i[--s]), !!t); ) {
let { V: r } = t;
r && (n = r, i.length = s);
}
return n;
}
-const gE = new Uint8Array(32);
-gE.fill(0);
-function Nm(i) {
+const mE = new Uint8Array(32);
+mE.fill(0);
+function Lm(i) {
return V(i.length !== 0, "invalid ENS name; empty component", "comp", i), i;
}
-function mE(i) {
- const e = gs(TL(i)), t = [];
+function xE(i) {
+ const e = gs(RL(i)), t = [];
if (i.length === 0)
return t;
let n = 0;
for (let s = 0; s < e.length; s++)
- e[s] === 46 && (t.push(Nm(e.slice(n, s))), n = s + 1);
- return V(n < e.length, "invalid ENS name; empty component", "name", i), t.push(Nm(e.slice(n))), t;
+ e[s] === 46 && (t.push(Lm(e.slice(n, s))), n = s + 1);
+ return V(n < e.length, "invalid ENS name; empty component", "name", i), t.push(Lm(e.slice(n))), t;
}
-function TL(i) {
+function RL(i) {
try {
if (i.length === 0)
throw new Error("empty label");
- return yL(i);
+ return _L(i);
} catch (e) {
V(!1, `invalid ENS name (${e.message})`, "name", i);
}
}
-function vf(i) {
+function If(i) {
V(typeof i == "string", "invalid ENS name; not a string", "name", i), V(i.length, "invalid ENS name (empty label)", "name", i);
- let e = gE;
- const t = mE(i);
+ let e = mE;
+ const t = xE(i);
for (; t.length; )
e = sn(Ht([e, sn(t.pop())]));
return Ie(e);
}
-function RL(i, e) {
+function FL(i, e) {
const t = e;
- return V(t <= 255, "DNS encoded label cannot exceed 255", "length", t), Ie(Ht(mE(i).map((n) => {
+ return V(t <= 255, "DNS encoded label cannot exceed 255", "length", t), Ie(Ht(xE(i).map((n) => {
V(n.length <= t, `label ${JSON.stringify(i)} exceeds ${t} bytes`, "name", i);
const s = new Uint8Array(n.length + 1);
return s.set(n, 1), s[0] = s.length - 1, s;
}))) + "00";
}
-const xE = new Uint8Array(32);
-xE.fill(0);
-const FL = BigInt(-1), bE = BigInt(0), EE = BigInt(1), NL = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
-function DL(i) {
+const bE = new Uint8Array(32);
+bE.fill(0);
+const NL = BigInt(-1), EE = BigInt(0), yE = BigInt(1), DL = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
+function LL(i) {
const e = dt(i), t = e.length % 32;
- return t ? Ht([e, xE.slice(t)]) : Ie(e);
+ return t ? Ht([e, bE.slice(t)]) : Ie(e);
}
-const LL = Ys(EE, 32), PL = Ys(bE, 32), Dm = {
+const PL = Ys(yE, 32), kL = Ys(EE, 32), Pm = {
name: "string",
version: "string",
chainId: "uint256",
verifyingContract: "address",
salt: "bytes32"
-}, td = [
+}, id = [
"name",
"version",
"chainId",
"verifyingContract",
"salt"
];
-function Lm(i) {
+function km(i) {
return function(e) {
return V(typeof e == "string", `invalid domain value for ${JSON.stringify(i)}`, `domain.${i}`, e), e;
};
}
-const kL = {
- name: Lm("name"),
- version: Lm("version"),
+const UL = {
+ name: km("name"),
+ version: km("version"),
chainId: function(i) {
const e = De(i, "domain.chainId");
- return V(e >= 0, "invalid chain ID", "domain.chainId", i), Number.isSafeInteger(e) ? Number(e) : wi(e);
+ return V(e >= 0, "invalid chain ID", "domain.chainId", i), Number.isSafeInteger(e) ? Number(e) : vi(e);
},
verifyingContract: function(i) {
try {
@@ -43054,16 +43054,16 @@ const kL = {
return V(e.length === 32, 'invalid domain value "salt"', "domain.salt", i), Ie(e);
}
};
-function nd(i) {
+function sd(i) {
{
const e = i.match(/^(u?)int(\d+)$/);
if (e) {
const t = e[1] === "", n = parseInt(e[2]);
V(n % 8 === 0 && n !== 0 && n <= 256 && e[2] === String(n), "invalid numeric width", "type", i);
- const s = Io(NL, t ? n - 1 : n), r = t ? (s + EE) * FL : bE;
+ const s = So(DL, t ? n - 1 : n), r = t ? (s + yE) * NL : EE;
return function(a) {
const o = De(a, "value");
- return V(o >= r && o <= s, `value out-of-bounds for ${i}`, "value", o), Ys(t ? cb(o, 256) : o, 32);
+ return V(o >= r && o <= s, `value out-of-bounds for ${i}`, "value", o), Ys(t ? lb(o, 256) : o, 32);
};
}
}
@@ -43073,7 +43073,7 @@ function nd(i) {
const t = parseInt(e[1]);
return V(t !== 0 && t <= 32 && e[1] === String(t), "invalid bytes width", "type", i), function(n) {
const s = dt(n);
- return V(s.length === t, `invalid length for ${i}`, "value", n), DL(n);
+ return V(s.length === t, `invalid length for ${i}`, "value", n), LL(n);
};
}
}
@@ -43084,7 +43084,7 @@ function nd(i) {
};
case "bool":
return function(e) {
- return e ? LL : PL;
+ return e ? PL : kL;
};
case "bytes":
return function(e) {
@@ -43097,10 +43097,10 @@ function nd(i) {
}
return null;
}
-function Pm(i, e) {
+function Um(i, e) {
return `${i}(${e.map(({ name: t, type: n }) => n + " " + t).join(",")})`;
}
-function yl(i) {
+function _l(i) {
const e = i.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);
return e ? {
base: e[1],
@@ -43112,7 +43112,7 @@ function yl(i) {
}
} : { base: i };
}
-class $n {
+class ei {
/**
* The primary type for the structured [[types]].
*
@@ -43143,7 +43143,7 @@ class $n {
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = {};
Object.keys(e).forEach((c) => {
r[c] = e[c].map(({ name: l, type: h }) => {
- let { base: u, index: d } = yl(h);
+ let { base: u, index: d } = _l(h);
return u === "int" && !e.int && (u = "int256"), u === "uint" && !e.uint && (u = "uint256"), { name: l, type: u + (d || "") };
}), t.set(c, /* @__PURE__ */ new Set()), n.set(c, []), s.set(c, /* @__PURE__ */ new Set());
}), this.#e = JSON.stringify(r);
@@ -43151,8 +43151,8 @@ class $n {
const l = /* @__PURE__ */ new Set();
for (const h of r[c]) {
V(!l.has(h.name), `duplicate variable name ${JSON.stringify(h.name)} in ${JSON.stringify(c)}`, "types", e), l.add(h.name);
- const u = yl(h.type).base;
- V(u !== c, `circular type reference to ${JSON.stringify(u)}`, "types", e), !nd(u) && (V(n.has(u), `unknown type ${JSON.stringify(u)}`, "types", e), n.get(u).push(c), t.get(c).add(u));
+ const u = _l(h.type).base;
+ V(u !== c, `circular type reference to ${JSON.stringify(u)}`, "types", e), !sd(u) && (V(n.has(u), `unknown type ${JSON.stringify(u)}`, "types", e), n.get(u).push(c), t.get(c).add(u));
}
}
const a = Array.from(n.keys()).filter((c) => n.get(c).length === 0);
@@ -43170,7 +43170,7 @@ class $n {
o(this.primaryType, /* @__PURE__ */ new Set());
for (const [c, l] of s) {
const h = Array.from(l);
- h.sort(), this.#t.set(c, Pm(c, r[c]) + h.map((u) => Pm(u, r[u])).join(""));
+ h.sort(), this.#t.set(c, Um(c, r[c]) + h.map((u) => Um(u, r[u])).join(""));
}
}
/**
@@ -43182,11 +43182,11 @@ class $n {
}
#i(e) {
{
- const s = nd(e);
+ const s = sd(e);
if (s)
return s;
}
- const t = yl(e).array;
+ const t = _l(e).array;
if (t) {
const s = t.prefix, r = this.getEncoder(s);
return (a) => {
@@ -43243,9 +43243,9 @@ class $n {
* @_ignore:
*/
_visit(e, t, n) {
- if (nd(e))
+ if (sd(e))
return n(e, t);
- const s = yl(e).array;
+ const s = _l(e).array;
if (s)
return V(s.count === -1 || s.count === t.length, `array length mismatch; expected length ${s.count}`, "value", t), t.map((a) => this._visit(s.prefix, a, n));
const r = this.types[e];
@@ -43267,19 +43267,19 @@ class $n {
* Create a new **TypedDataEncoder** for %%types%%.
*/
static from(e) {
- return new $n(e);
+ return new ei(e);
}
/**
* Return the primary type for %%types%%.
*/
static getPrimaryType(e) {
- return $n.from(e).primaryType;
+ return ei.from(e).primaryType;
}
/**
* Return the hashed struct for %%value%% using %%types%% and %%name%%.
*/
static hashStruct(e, t, n) {
- return $n.from(t).hashStruct(e, n);
+ return ei.from(t).hashStruct(e, n);
}
/**
* Return the domain hash for %%domain%%.
@@ -43289,10 +43289,10 @@ class $n {
for (const n in e) {
if (e[n] == null)
continue;
- const s = Dm[n];
+ const s = Pm[n];
V(s, `invalid typed-data domain key: ${JSON.stringify(n)}`, "domain", e), t.push({ name: n, type: s });
}
- return t.sort((n, s) => td.indexOf(n.name) - td.indexOf(s.name)), $n.hashStruct("EIP712Domain", { EIP712Domain: t }, e);
+ return t.sort((n, s) => id.indexOf(n.name) - id.indexOf(s.name)), ei.hashStruct("EIP712Domain", { EIP712Domain: t }, e);
}
/**
* Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
@@ -43300,15 +43300,15 @@ class $n {
static encode(e, t, n) {
return Ht([
"0x1901",
- $n.hashDomain(e),
- $n.from(t).hash(n)
+ ei.hashDomain(e),
+ ei.from(t).hash(n)
]);
}
/**
* Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
*/
static hash(e, t, n) {
- return sn($n.encode(e, t, n));
+ return sn(ei.encode(e, t, n));
}
// Replaces all address types with ENS names with their looked up address
/**
@@ -43321,7 +43321,7 @@ class $n {
e[o] == null && delete e[o];
const r = {};
e.verifyingContract && !Ut(e.verifyingContract, 20) && (r[e.verifyingContract] = "0x");
- const a = $n.from(t);
+ const a = ei.from(t);
a.visit(n, (o, c) => (o === "address" && !Ut(c, 20) && (r[c] = "0x"), c));
for (const o in r)
r[o] = await s(o);
@@ -43332,13 +43332,13 @@ class $n {
* the JSON-RPC [[link-eip-712]] method.
*/
static getPayload(e, t, n) {
- $n.hashDomain(e);
+ ei.hashDomain(e);
const s = {}, r = [];
- td.forEach((c) => {
+ id.forEach((c) => {
const l = e[c];
- l != null && (s[c] = kL[c](l), r.push({ name: c, type: Dm[c] }));
+ l != null && (s[c] = UL[c](l), r.push({ name: c, type: Pm[c] }));
});
- const a = $n.from(t);
+ const a = ei.from(t);
t = a.types;
const o = Object.assign({}, t);
return V(o.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", t), o.EIP712Domain = r, a.encode(n), {
@@ -43363,19 +43363,19 @@ class $n {
};
}
}
-function zn(i) {
+function Vn(i) {
const e = /* @__PURE__ */ new Set();
return i.forEach((t) => e.add(t)), Object.freeze(e);
}
-const UL = "external public payable override", OL = zn(UL.split(" ")), yE = "constant external internal payable private public pure view override", QL = zn(yE.split(" ")), _E = "constructor error event fallback function receive struct", wE = zn(_E.split(" ")), vE = "calldata memory storage payable indexed", GL = zn(vE.split(" ")), HL = "tuple returns", zL = [_E, vE, HL, yE].join(" "), VL = zn(zL.split(" ")), WL = {
+const OL = "external public payable override", QL = Vn(OL.split(" ")), _E = "constant external internal payable private public pure view override", GL = Vn(_E.split(" ")), wE = "constructor error event fallback function receive struct", vE = Vn(wE.split(" ")), CE = "calldata memory storage payable indexed", HL = Vn(CE.split(" ")), zL = "tuple returns", VL = [wE, CE, zL, _E].join(" "), WL = Vn(VL.split(" ")), qL = {
"(": "OPEN_PAREN",
")": "CLOSE_PAREN",
"[": "OPEN_BRACKET",
"]": "CLOSE_BRACKET",
",": "COMMA",
"@": "AT"
-}, qL = new RegExp("^(\\s*)"), KL = new RegExp("^([0-9]+)"), jL = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), CE = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), IE = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
-class pi {
+}, KL = new RegExp("^(\\s*)"), jL = new RegExp("^([0-9]+)"), XL = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), IE = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), SE = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
+class Ai {
#e;
#t;
get offset() {
@@ -43388,13 +43388,13 @@ class pi {
this.#e = 0, this.#t = e.slice();
}
clone() {
- return new pi(this.#t);
+ return new Ai(this.#t);
}
reset() {
this.#e = 0;
}
#n(e = 0, t = 0) {
- return new pi(this.#t.slice(e, t).map((n) => Object.freeze(Object.assign({}, n, {
+ return new Ai(this.#t.slice(e, t).map((n) => Object.freeze(Object.assign({}, n, {
match: n.match - e,
linkBack: n.linkBack - e,
linkNext: n.linkNext - e
@@ -43474,11 +43474,11 @@ function er(i) {
};
let n = [], s = [], r = 0;
for (; r < i.length; ) {
- let a = i.substring(r), o = a.match(qL);
+ let a = i.substring(r), o = a.match(KL);
o && (r += o[1].length, a = i.substring(r));
const c = { depth: n.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset: r, value: -1 };
e.push(c);
- let l = WL[a[0]] || "";
+ let l = qL[a[0]] || "";
if (l) {
if (c.type = l, c.text = a[0], r++, l === "OPEN_PAREN")
n.push(e.length - 1), s.push(e.length - 1);
@@ -43500,35 +43500,35 @@ function er(i) {
}
continue;
}
- if (o = a.match(jL), o) {
- if (c.text = o[1], r += c.text.length, VL.has(c.text)) {
+ if (o = a.match(XL), o) {
+ if (c.text = o[1], r += c.text.length, WL.has(c.text)) {
c.type = "KEYWORD";
continue;
}
- if (c.text.match(IE)) {
+ if (c.text.match(SE)) {
c.type = "TYPE";
continue;
}
c.type = "ID";
continue;
}
- if (o = a.match(KL), o) {
+ if (o = a.match(jL), o) {
c.text = o[1], c.type = "NUMBER", r += c.text.length;
continue;
}
throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${r}`);
}
- return new pi(e.map((a) => Object.freeze(a)));
+ return new Ai(e.map((a) => Object.freeze(a)));
}
-function km(i, e) {
+function Om(i, e) {
let t = [];
for (const n in e.keys())
i.has(n) && t.push(n);
if (t.length > 1)
throw new Error(`conflicting types: ${t.join(", ")}`);
}
-function Fh(i, e) {
- if (e.peekKeyword(wE)) {
+function Dh(i, e) {
+ if (e.peekKeyword(vE)) {
const t = e.pop().text;
if (t !== i)
throw new Error(`expected ${i}, got ${t}`);
@@ -43547,14 +43547,14 @@ function ys(i, e) {
}
return Object.freeze(t);
}
-function SE(i) {
- let e = ys(i, QL);
- return km(e, zn("constant payable nonpayable".split(" "))), km(e, zn("pure view payable nonpayable".split(" "))), e.has("view") ? "view" : e.has("pure") ? "pure" : e.has("payable") ? "payable" : e.has("nonpayable") ? "nonpayable" : e.has("constant") ? "view" : "nonpayable";
+function ME(i) {
+ let e = ys(i, GL);
+ return Om(e, Vn("constant payable nonpayable".split(" "))), Om(e, Vn("pure view payable nonpayable".split(" "))), e.has("view") ? "view" : e.has("pure") ? "pure" : e.has("payable") ? "payable" : e.has("nonpayable") ? "nonpayable" : e.has("constant") ? "view" : "nonpayable";
}
function xs(i, e) {
return i.popParams().map((t) => Pt.from(t, e));
}
-function ME(i) {
+function BE(i) {
if (i.peekType("AT")) {
if (i.pop(), i.peekType("NUMBER"))
return De(i.pop().text);
@@ -43566,9 +43566,9 @@ function Ur(i) {
if (i.length)
throw new Error(`unexpected tokens at offset ${i.offset}: ${i.toString()}`);
}
-const XL = new RegExp(/^(.*)\[([0-9]*)\]$/);
-function Um(i) {
- const e = i.match(IE);
+const YL = new RegExp(/^(.*)\[([0-9]*)\]$/);
+function Qm(i) {
+ const e = i.match(SE);
if (V(e, "invalid type", "type", i), i === "uint")
return "uint256";
if (i === "int")
@@ -43582,7 +43582,7 @@ function Um(i) {
}
return i;
}
-const Vt = {}, Xn = /* @__PURE__ */ Symbol.for("_ethers_internal"), Om = "_ParamTypeInternal", Qm = "_ErrorInternal", Gm = "_EventInternal", Hm = "_ConstructorInternal", zm = "_FallbackInternal", Vm = "_FunctionInternal", Wm = "_StructInternal";
+const Vt = {}, Yn = /* @__PURE__ */ Symbol.for("_ethers_internal"), Gm = "_ParamTypeInternal", Hm = "_ErrorInternal", zm = "_EventInternal", Vm = "_ConstructorInternal", Wm = "_FallbackInternal", qm = "_FunctionInternal", Km = "_StructInternal";
class Pt {
/**
* The local name of the parameter (or ``""`` if unbound)
@@ -43625,7 +43625,7 @@ class Pt {
* @private
*/
constructor(e, t, n, s, r, a, o, c) {
- if (vh(e, Vt, "ParamType"), Object.defineProperty(this, Xn, { value: Om }), a && (a = Object.freeze(a.slice())), s === "array") {
+ if (Ih(e, Vt, "ParamType"), Object.defineProperty(this, Yn, { value: Gm }), a && (a = Object.freeze(a.slice())), s === "array") {
if (o == null || c == null)
throw new Error("");
} else if (o != null || c != null)
@@ -43794,16 +43794,16 @@ class Pt {
} catch {
V(!1, "invalid param type", "obj", e);
}
- else if (e instanceof pi) {
+ else if (e instanceof Ai) {
let o = "", c = "", l = null;
- ys(e, zn(["tuple"])).has("tuple") || e.peekType("OPEN_PAREN") ? (c = "tuple", l = e.popParams().map((m) => Pt.from(m)), o = `tuple(${l.map((m) => m.format()).join(",")})`) : (o = Um(e.popType("TYPE")), c = o);
+ ys(e, Vn(["tuple"])).has("tuple") || e.peekType("OPEN_PAREN") ? (c = "tuple", l = e.popParams().map((m) => Pt.from(m)), o = `tuple(${l.map((m) => m.format()).join(",")})`) : (o = Qm(e.popType("TYPE")), c = o);
let h = null, u = null;
for (; e.length && e.peekType("BRACKET"); ) {
const m = e.pop();
h = new Pt(Vt, "", o, c, null, l, u, h), u = m.value, o += m.text, c = "array", l = null;
}
let d = null;
- if (ys(e, GL).has("indexed")) {
+ if (ys(e, HL).has("indexed")) {
if (!t)
throw new Error("");
d = !0;
@@ -43814,10 +43814,10 @@ class Pt {
return new Pt(Vt, p, o, c, d, l, u, h);
}
const n = e.name;
- V(!n || typeof n == "string" && n.match(CE), "invalid name", "obj.name", n);
+ V(!n || typeof n == "string" && n.match(IE), "invalid name", "obj.name", n);
let s = e.indexed;
s != null && (V(t, "parameter cannot be indexed", "obj.indexed", e.indexed), s = !!s);
- let r = e.type, a = r.match(XL);
+ let r = e.type, a = r.match(YL);
if (a) {
const o = parseInt(a[2] || "-1"), c = Pt.from({
type: a[1],
@@ -43835,13 +43835,13 @@ class Pt {
const o = e.components != null ? e.components.map((l) => Pt.from(l)) : null;
return new Pt(Vt, n || "", r, "tuple", s, o, null, null);
}
- return r = Um(e.type), new Pt(Vt, n || "", r, r, s, null, null, null);
+ return r = Qm(e.type), new Pt(Vt, n || "", r, r, s, null, null, null);
}
/**
* Returns true if %%value%% is a **ParamType**.
*/
static isParamType(e) {
- return e && e[Xn] === Om;
+ return e && e[Yn] === Gm;
}
}
class Or {
@@ -43857,7 +43857,7 @@ class Or {
* @private
*/
constructor(e, t, n) {
- vh(e, Vt, "Fragment"), n = Object.freeze(n.slice()), Ye(this, { type: t, inputs: n });
+ Ih(e, Vt, "Fragment"), n = Object.freeze(n.slice()), Ye(this, { type: t, inputs: n });
}
/**
* Creates a new **Fragment** for %%obj%%, wich can be any supported
@@ -43871,19 +43871,19 @@ class Or {
}
return Or.from(er(e));
}
- if (e instanceof pi)
- switch (e.peekKeyword(wE)) {
+ if (e instanceof Ai)
+ switch (e.peekKeyword(vE)) {
case "constructor":
return fs.from(e);
case "error":
- return jn.from(e);
+ return Xn.from(e);
case "event":
- return Oi.from(e);
+ return Qi.from(e);
case "fallback":
case "receive":
- return is.from(e);
+ return ss.from(e);
case "function":
- return Qi.from(e);
+ return Gi.from(e);
case "struct":
return Sr.from(e);
}
@@ -43892,14 +43892,14 @@ class Or {
case "constructor":
return fs.from(e);
case "error":
- return jn.from(e);
+ return Xn.from(e);
case "event":
- return Oi.from(e);
+ return Qi.from(e);
case "fallback":
case "receive":
- return is.from(e);
+ return ss.from(e);
case "function":
- return Qi.from(e);
+ return Gi.from(e);
case "struct":
return Sr.from(e);
}
@@ -43919,19 +43919,19 @@ class Or {
* Returns true if %%value%% is an [[ErrorFragment]].
*/
static isError(e) {
- return jn.isFragment(e);
+ return Xn.isFragment(e);
}
/**
* Returns true if %%value%% is an [[EventFragment]].
*/
static isEvent(e) {
- return Oi.isFragment(e);
+ return Qi.isFragment(e);
}
/**
* Returns true if %%value%% is a [[FunctionFragment]].
*/
static isFunction(e) {
- return Qi.isFragment(e);
+ return Gi.isFragment(e);
}
/**
* Returns true if %%value%% is a [[StructFragment]].
@@ -43940,7 +43940,7 @@ class Or {
return Sr.isFragment(e);
}
}
-class Nh extends Or {
+class Lh extends Or {
/**
* The name of the fragment.
*/
@@ -43949,18 +43949,18 @@ class Nh extends Or {
* @private
*/
constructor(e, t, n, s) {
- super(e, t, s), V(typeof n == "string" && n.match(CE), "invalid identifier", "name", n), s = Object.freeze(s.slice()), Ye(this, { name: n });
+ super(e, t, s), V(typeof n == "string" && n.match(IE), "invalid identifier", "name", n), s = Object.freeze(s.slice()), Ye(this, { name: n });
}
}
-function lc(i, e) {
+function hc(i, e) {
return "(" + e.map((t) => t.format(i)).join(i === "full" ? ", " : ",") + ")";
}
-class jn extends Nh {
+class Xn extends Lh {
/**
* @private
*/
constructor(e, t, n) {
- super(e, "error", t, n), Object.defineProperty(this, Xn, { value: Qm });
+ super(e, "error", t, n), Object.defineProperty(this, Yn, { value: Hm });
}
/**
* The Custom Error selector.
@@ -43979,31 +43979,31 @@ class jn extends Nh {
inputs: this.inputs.map((n) => JSON.parse(n.format(e)))
});
const t = [];
- return e !== "sighash" && t.push("error"), t.push(this.name + lc(e, this.inputs)), t.join(" ");
+ return e !== "sighash" && t.push("error"), t.push(this.name + hc(e, this.inputs)), t.join(" ");
}
/**
* Returns a new **ErrorFragment** for %%obj%%.
*/
static from(e) {
- if (jn.isFragment(e))
+ if (Xn.isFragment(e))
return e;
if (typeof e == "string")
- return jn.from(er(e));
- if (e instanceof pi) {
- const t = Fh("error", e), n = xs(e);
- return Ur(e), new jn(Vt, t, n);
+ return Xn.from(er(e));
+ if (e instanceof Ai) {
+ const t = Dh("error", e), n = xs(e);
+ return Ur(e), new Xn(Vt, t, n);
}
- return new jn(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);
+ return new Xn(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);
}
/**
* Returns ``true`` and provides a type guard if %%value%% is an
* **ErrorFragment**.
*/
static isFragment(e) {
- return e && e[Xn] === Qm;
+ return e && e[Yn] === Hm;
}
}
-class Oi extends Nh {
+class Qi extends Lh {
/**
* Whether this event is anonymous.
*/
@@ -44012,7 +44012,7 @@ class Oi extends Nh {
* @private
*/
constructor(e, t, n, s) {
- super(e, "event", t, n), Object.defineProperty(this, Xn, { value: Gm }), Ye(this, { anonymous: s });
+ super(e, "event", t, n), Object.defineProperty(this, Yn, { value: zm }), Ye(this, { anonymous: s });
}
/**
* The Event topic hash.
@@ -44032,38 +44032,38 @@ class Oi extends Nh {
inputs: this.inputs.map((n) => JSON.parse(n.format(e)))
});
const t = [];
- return e !== "sighash" && t.push("event"), t.push(this.name + lc(e, this.inputs)), e !== "sighash" && this.anonymous && t.push("anonymous"), t.join(" ");
+ return e !== "sighash" && t.push("event"), t.push(this.name + hc(e, this.inputs)), e !== "sighash" && this.anonymous && t.push("anonymous"), t.join(" ");
}
/**
* Return the topic hash for an event with %%name%% and %%params%%.
*/
static getTopicHash(e, t) {
- return t = (t || []).map((s) => Pt.from(s)), new Oi(Vt, e, t, !1).topicHash;
+ return t = (t || []).map((s) => Pt.from(s)), new Qi(Vt, e, t, !1).topicHash;
}
/**
* Returns a new **EventFragment** for %%obj%%.
*/
static from(e) {
- if (Oi.isFragment(e))
+ if (Qi.isFragment(e))
return e;
if (typeof e == "string")
try {
- return Oi.from(er(e));
+ return Qi.from(er(e));
} catch {
V(!1, "invalid event fragment", "obj", e);
}
- else if (e instanceof pi) {
- const t = Fh("event", e), n = xs(e, !0), s = !!ys(e, zn(["anonymous"])).has("anonymous");
- return Ur(e), new Oi(Vt, t, n, s);
+ else if (e instanceof Ai) {
+ const t = Dh("event", e), n = xs(e, !0), s = !!ys(e, Vn(["anonymous"])).has("anonymous");
+ return Ur(e), new Qi(Vt, t, n, s);
}
- return new Oi(Vt, e.name, e.inputs ? e.inputs.map((t) => Pt.from(t, !0)) : [], !!e.anonymous);
+ return new Qi(Vt, e.name, e.inputs ? e.inputs.map((t) => Pt.from(t, !0)) : [], !!e.anonymous);
}
/**
* Returns ``true`` and provides a type guard if %%value%% is an
* **EventFragment**.
*/
static isFragment(e) {
- return e && e[Xn] === Gm;
+ return e && e[Yn] === zm;
}
}
class fs extends Or {
@@ -44079,7 +44079,7 @@ class fs extends Or {
* @private
*/
constructor(e, t, n, s, r) {
- super(e, t, n), Object.defineProperty(this, Xn, { value: Hm }), Ye(this, { payable: s, gas: r });
+ super(e, t, n), Object.defineProperty(this, Yn, { value: Vm }), Ye(this, { payable: s, gas: r });
}
/**
* Returns a string representation of this constructor as %%format%%.
@@ -44093,7 +44093,7 @@ class fs extends Or {
gas: this.gas != null ? this.gas : void 0,
inputs: this.inputs.map((n) => JSON.parse(n.format(e)))
});
- const t = [`constructor${lc(e, this.inputs)}`];
+ const t = [`constructor${hc(e, this.inputs)}`];
return this.payable && t.push("payable"), this.gas != null && t.push(`@${this.gas.toString()}`), t.join(" ");
}
/**
@@ -44108,9 +44108,9 @@ class fs extends Or {
} catch {
V(!1, "invalid constuctor fragment", "obj", e);
}
- else if (e instanceof pi) {
- ys(e, zn(["constructor"]));
- const t = xs(e), n = !!ys(e, OL).has("payable"), s = ME(e);
+ else if (e instanceof Ai) {
+ ys(e, Vn(["constructor"]));
+ const t = xs(e), n = !!ys(e, QL).has("payable"), s = BE(e);
return Ur(e), new fs(Vt, "constructor", t, n, s);
}
return new fs(Vt, "constructor", e.inputs ? e.inputs.map(Pt.from) : [], !!e.payable, e.gas != null ? e.gas : null);
@@ -44120,16 +44120,16 @@ class fs extends Or {
* **ConstructorFragment**.
*/
static isFragment(e) {
- return e && e[Xn] === Hm;
+ return e && e[Yn] === Vm;
}
}
-class is extends Or {
+class ss extends Or {
/**
* If the function can be sent value during invocation.
*/
payable;
constructor(e, t, n) {
- super(e, "fallback", t), Object.defineProperty(this, Xn, { value: zm }), Ye(this, { payable: n });
+ super(e, "fallback", t), Object.defineProperty(this, Yn, { value: Wm }), Ye(this, { payable: n });
}
/**
* Returns a string representation of this fallback as %%format%%.
@@ -44146,34 +44146,34 @@ class is extends Or {
* Returns a new **FallbackFragment** for %%obj%%.
*/
static from(e) {
- if (is.isFragment(e))
+ if (ss.isFragment(e))
return e;
if (typeof e == "string")
try {
- return is.from(er(e));
+ return ss.from(er(e));
} catch {
V(!1, "invalid fallback fragment", "obj", e);
}
- else if (e instanceof pi) {
- const t = e.toString(), n = e.peekKeyword(zn(["fallback", "receive"]));
- if (V(n, "type must be fallback or receive", "obj", t), e.popKeyword(zn(["fallback", "receive"])) === "receive") {
+ else if (e instanceof Ai) {
+ const t = e.toString(), n = e.peekKeyword(Vn(["fallback", "receive"]));
+ if (V(n, "type must be fallback or receive", "obj", t), e.popKeyword(Vn(["fallback", "receive"])) === "receive") {
const o = xs(e);
- return V(o.length === 0, "receive cannot have arguments", "obj.inputs", o), ys(e, zn(["payable"])), Ur(e), new is(Vt, [], !0);
+ return V(o.length === 0, "receive cannot have arguments", "obj.inputs", o), ys(e, Vn(["payable"])), Ur(e), new ss(Vt, [], !0);
}
let r = xs(e);
r.length ? V(r.length === 1 && r[0].type === "bytes", "invalid fallback inputs", "obj.inputs", r.map((o) => o.format("minimal")).join(", ")) : r = [Pt.from("bytes")];
- const a = SE(e);
- if (V(a === "nonpayable" || a === "payable", "fallback cannot be constants", "obj.stateMutability", a), ys(e, zn(["returns"])).has("returns")) {
+ const a = ME(e);
+ if (V(a === "nonpayable" || a === "payable", "fallback cannot be constants", "obj.stateMutability", a), ys(e, Vn(["returns"])).has("returns")) {
const o = xs(e);
V(o.length === 1 && o[0].type === "bytes", "invalid fallback outputs", "obj.outputs", o.map((c) => c.format("minimal")).join(", "));
}
- return Ur(e), new is(Vt, r, a === "payable");
+ return Ur(e), new ss(Vt, r, a === "payable");
}
if (e.type === "receive")
- return new is(Vt, [], !0);
+ return new ss(Vt, [], !0);
if (e.type === "fallback") {
const t = [Pt.from("bytes")], n = e.stateMutability === "payable";
- return new is(Vt, t, n);
+ return new ss(Vt, t, n);
}
V(!1, "invalid fallback description", "obj", e);
}
@@ -44182,10 +44182,10 @@ class is extends Or {
* **FallbackFragment**.
*/
static isFragment(e) {
- return e && e[Xn] === zm;
+ return e && e[Yn] === Wm;
}
}
-class Qi extends Nh {
+class Gi extends Lh {
/**
* If the function is constant (e.g. ``pure`` or ``view`` functions).
*/
@@ -44211,7 +44211,7 @@ class Qi extends Nh {
* @private
*/
constructor(e, t, n, s, r, a) {
- super(e, "function", t, s), Object.defineProperty(this, Xn, { value: Vm }), r = Object.freeze(r.slice()), Ye(this, { constant: n === "view" || n === "pure", gas: a, outputs: r, payable: n === "payable", stateMutability: n });
+ super(e, "function", t, s), Object.defineProperty(this, Yn, { value: qm }), r = Object.freeze(r.slice()), Ye(this, { constant: n === "view" || n === "pure", gas: a, outputs: r, payable: n === "payable", stateMutability: n });
}
/**
* The Function selector.
@@ -44235,50 +44235,50 @@ class Qi extends Nh {
outputs: this.outputs.map((n) => JSON.parse(n.format(e)))
});
const t = [];
- return e !== "sighash" && t.push("function"), t.push(this.name + lc(e, this.inputs)), e !== "sighash" && (this.stateMutability !== "nonpayable" && t.push(this.stateMutability), this.outputs && this.outputs.length && (t.push("returns"), t.push(lc(e, this.outputs))), this.gas != null && t.push(`@${this.gas.toString()}`)), t.join(" ");
+ return e !== "sighash" && t.push("function"), t.push(this.name + hc(e, this.inputs)), e !== "sighash" && (this.stateMutability !== "nonpayable" && t.push(this.stateMutability), this.outputs && this.outputs.length && (t.push("returns"), t.push(hc(e, this.outputs))), this.gas != null && t.push(`@${this.gas.toString()}`)), t.join(" ");
}
/**
* Return the selector for a function with %%name%% and %%params%%.
*/
static getSelector(e, t) {
- return t = (t || []).map((s) => Pt.from(s)), new Qi(Vt, e, "view", t, [], null).selector;
+ return t = (t || []).map((s) => Pt.from(s)), new Gi(Vt, e, "view", t, [], null).selector;
}
/**
* Returns a new **FunctionFragment** for %%obj%%.
*/
static from(e) {
- if (Qi.isFragment(e))
+ if (Gi.isFragment(e))
return e;
if (typeof e == "string")
try {
- return Qi.from(er(e));
+ return Gi.from(er(e));
} catch {
V(!1, "invalid function fragment", "obj", e);
}
- else if (e instanceof pi) {
- const n = Fh("function", e), s = xs(e), r = SE(e);
+ else if (e instanceof Ai) {
+ const n = Dh("function", e), s = xs(e), r = ME(e);
let a = [];
- ys(e, zn(["returns"])).has("returns") && (a = xs(e));
- const o = ME(e);
- return Ur(e), new Qi(Vt, n, r, s, a, o);
+ ys(e, Vn(["returns"])).has("returns") && (a = xs(e));
+ const o = BE(e);
+ return Ur(e), new Gi(Vt, n, r, s, a, o);
}
let t = e.stateMutability;
- return t == null && (t = "payable", typeof e.constant == "boolean" ? (t = "view", e.constant || (t = "payable", typeof e.payable == "boolean" && !e.payable && (t = "nonpayable"))) : typeof e.payable == "boolean" && !e.payable && (t = "nonpayable")), new Qi(Vt, e.name, t, e.inputs ? e.inputs.map(Pt.from) : [], e.outputs ? e.outputs.map(Pt.from) : [], e.gas != null ? e.gas : null);
+ return t == null && (t = "payable", typeof e.constant == "boolean" ? (t = "view", e.constant || (t = "payable", typeof e.payable == "boolean" && !e.payable && (t = "nonpayable"))) : typeof e.payable == "boolean" && !e.payable && (t = "nonpayable")), new Gi(Vt, e.name, t, e.inputs ? e.inputs.map(Pt.from) : [], e.outputs ? e.outputs.map(Pt.from) : [], e.gas != null ? e.gas : null);
}
/**
* Returns ``true`` and provides a type guard if %%value%% is a
* **FunctionFragment**.
*/
static isFragment(e) {
- return e && e[Xn] === Vm;
+ return e && e[Yn] === qm;
}
}
-class Sr extends Nh {
+class Sr extends Lh {
/**
* @private
*/
constructor(e, t, n) {
- super(e, "struct", t, n), Object.defineProperty(this, Xn, { value: Wm });
+ super(e, "struct", t, n), Object.defineProperty(this, Yn, { value: Km });
}
/**
* Returns a string representation of this struct as %%format%%.
@@ -44296,8 +44296,8 @@ class Sr extends Nh {
} catch {
V(!1, "invalid struct fragment", "obj", e);
}
- else if (e instanceof pi) {
- const t = Fh("struct", e), n = xs(e);
+ else if (e instanceof Ai) {
+ const t = Dh("struct", e), n = xs(e);
return Ur(e), new Sr(Vt, t, n);
}
return new Sr(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);
@@ -44308,23 +44308,23 @@ class Sr extends Nh {
* **StructFragment**.
*/
static isFragment(e) {
- return e && e[Xn] === Wm;
- }
-}
-const Fi = /* @__PURE__ */ new Map();
-Fi.set(0, "GENERIC_PANIC");
-Fi.set(1, "ASSERT_FALSE");
-Fi.set(17, "OVERFLOW");
-Fi.set(18, "DIVIDE_BY_ZERO");
-Fi.set(33, "ENUM_RANGE_ERROR");
-Fi.set(34, "BAD_STORAGE_DATA");
-Fi.set(49, "STACK_UNDERFLOW");
-Fi.set(50, "ARRAY_RANGE_ERROR");
-Fi.set(65, "OUT_OF_MEMORY");
-Fi.set(81, "UNINITIALIZED_FUNCTION_CALL");
-const YL = new RegExp(/^bytes([0-9]*)$/), JL = new RegExp(/^(u?int)([0-9]*)$/);
-let id = null, qm = 1024;
-function ZL(i, e, t, n) {
+ return e && e[Yn] === Km;
+ }
+}
+const Ni = /* @__PURE__ */ new Map();
+Ni.set(0, "GENERIC_PANIC");
+Ni.set(1, "ASSERT_FALSE");
+Ni.set(17, "OVERFLOW");
+Ni.set(18, "DIVIDE_BY_ZERO");
+Ni.set(33, "ENUM_RANGE_ERROR");
+Ni.set(34, "BAD_STORAGE_DATA");
+Ni.set(49, "STACK_UNDERFLOW");
+Ni.set(50, "ARRAY_RANGE_ERROR");
+Ni.set(65, "OUT_OF_MEMORY");
+Ni.set(81, "UNINITIALIZED_FUNCTION_CALL");
+const JL = new RegExp(/^bytes([0-9]*)$/), ZL = new RegExp(/^(u?int)([0-9]*)$/);
+let rd = null, jm = 1024;
+function $L(i, e, t, n) {
let s = "missing revert data", r = null;
const a = null;
let o = null;
@@ -44352,7 +44352,7 @@ function ZL(i, e, t, n) {
signature: "Panic(uint256)",
name: "Panic",
args: [h]
- }, r = `Panic due to ${Fi.get(h) || "UNKNOWN"}(${h})`, s += `: ${r}`;
+ }, r = `Panic due to ${Ni.get(h) || "UNKNOWN"}(${h})`, s += `: ${r}`;
} catch {
s += " (could not decode panic code)";
}
@@ -44372,32 +44372,32 @@ function ZL(i, e, t, n) {
revert: o
});
}
-class za {
+class Va {
#e(e) {
if (e.isArray())
- return new AD(this.#e(e.arrayChildren), e.arrayLength, e.name);
+ return new gD(this.#e(e.arrayChildren), e.arrayLength, e.name);
if (e.isTuple())
- return new El(e.components.map((n) => this.#e(n)), e.name);
+ return new yl(e.components.map((n) => this.#e(n)), e.name);
switch (e.baseType) {
case "address":
- return new fD(e.name);
+ return new pD(e.name);
case "bool":
- return new gD(e.name);
+ return new mD(e.name);
case "string":
- return new CD(e.name);
+ return new ID(e.name);
case "bytes":
- return new mD(e.name);
+ return new xD(e.name);
case "":
- return new ED(e.name);
+ return new yD(e.name);
}
- let t = e.type.match(JL);
+ let t = e.type.match(ZL);
if (t) {
let n = parseInt(t[2] || "256");
- return V(n !== 0 && n <= 256 && n % 8 === 0, "invalid " + t[1] + " bit length", "param", e), new vD(n / 8, t[1] === "int", e.name);
+ return V(n !== 0 && n <= 256 && n % 8 === 0, "invalid " + t[1] + " bit length", "param", e), new CD(n / 8, t[1] === "int", e.name);
}
- if (t = e.type.match(YL), t) {
+ if (t = e.type.match(JL), t) {
let n = parseInt(t[1]);
- return V(n !== 0 && n <= 32, "invalid bytes length", "param", e), new xD(n, e.name);
+ return V(n !== 0 && n <= 32, "invalid bytes length", "param", e), new bD(n, e.name);
}
V(!1, "invalid type", "type", e.type);
}
@@ -44409,7 +44409,7 @@ class za {
*/
getDefaultValue(e) {
const t = e.map((s) => this.#e(Pt.from(s)));
- return new El(t, "_").defaultValue();
+ return new yl(t, "_").defaultValue();
}
/**
* Encode the %%values%% as the %%types%% into ABI data.
@@ -44417,8 +44417,8 @@ class za {
* @returns DataHexstring
*/
encode(e, t) {
- rb(t.length, e.length, "types/values length mismatch");
- const n = e.map((a) => this.#e(Pt.from(a))), s = new El(n, "_"), r = new df();
+ ab(t.length, e.length, "types/values length mismatch");
+ const n = e.map((a) => this.#e(Pt.from(a))), s = new yl(n, "_"), r = new pf();
return s.encode(r, t), r.data;
}
/**
@@ -44430,10 +44430,10 @@ class za {
*/
decode(e, t, n) {
const s = e.map((a) => this.#e(Pt.from(a)));
- return new El(s, "_").decode(new mp(t, n, qm));
+ return new yl(s, "_").decode(new bp(t, n, jm));
}
static _setDefaultMaxInflation(e) {
- V(typeof e == "number" && Number.isInteger(e), "invalid defaultMaxInflation factor", "value", e), qm = e;
+ V(typeof e == "number" && Number.isInteger(e), "invalid defaultMaxInflation factor", "value", e), jm = e;
}
/**
* Returns the shared singleton instance of a default [[AbiCoder]].
@@ -44441,7 +44441,7 @@ class za {
* On the first call, the instance is created internally.
*/
static defaultAbiCoder() {
- return id == null && (id = new za()), id;
+ return rd == null && (rd = new Va()), rd;
}
/**
* Returns an ethers-compatible [[CallExceptionError]] Error for the given
@@ -44449,10 +44449,10 @@ class za {
* the Transaction %%tx%%.
*/
static getBuiltinCallException(e, t, n) {
- return ZL(e, t, n, za.defaultAbiCoder());
+ return $L(e, t, n, Va.defaultAbiCoder());
}
}
-class $L {
+class e2 {
/**
* The matching fragment for the ``topic0``.
*/
@@ -44487,7 +44487,7 @@ class $L {
});
}
}
-class e2 {
+class t2 {
/**
* The matching fragment from the transaction ``data``.
*/
@@ -44527,7 +44527,7 @@ class e2 {
});
}
}
-class t2 {
+class n2 {
/**
* The matching fragment.
*/
@@ -44562,7 +44562,7 @@ class t2 {
});
}
}
-class Km {
+class Xm {
/**
* The ``keccak256`` of the value logged.
*/
@@ -44586,7 +44586,7 @@ class Km {
Ye(this, { hash: e, _isIndexed: !0 });
}
}
-const jm = {
+const Ym = {
0: "generic panic",
1: "assert(false)",
17: "arithmetic overflow",
@@ -44597,7 +44597,7 @@ const jm = {
50: "out-of-bounds access of an array or bytesN",
65: "out of memory",
81: "uninitialized function"
-}, Xm = {
+}, Jm = {
"0x08c379a0": {
signature: "Error(string)",
name: "Error",
@@ -44610,7 +44610,7 @@ const jm = {
inputs: ["uint256"],
reason: (i) => {
let e = "unknown panic code";
- return i >= 0 && i <= 255 && jm[i.toString()] && (e = jm[i.toString()]), `reverted with panic code 0x${i.toString(16)} (${e})`;
+ return i >= 0 && i <= 255 && Ym[i.toString()] && (e = Ym[i.toString()]), `reverted with panic code 0x${i.toString(16)} (${e})`;
}
}
};
@@ -44706,7 +44706,7 @@ class xr {
* data.
*/
getAbiCoder() {
- return za.defaultAbiCoder();
+ return Va.defaultAbiCoder();
}
// Find a function definition by any means necessary (unless it is ambiguous)
#s(e, t, n) {
@@ -44761,7 +44761,7 @@ class xr {
}
return r[0];
}
- const s = this.#n.get(Qi.from(e).format());
+ const s = this.#n.get(Gi.from(e).format());
return s || null;
}
/**
@@ -44842,7 +44842,7 @@ class xr {
}
return r[0];
}
- const s = this.#t.get(Oi.from(e).format());
+ const s = this.#t.get(Qi.from(e).format());
return s || null;
}
/**
@@ -44900,8 +44900,8 @@ class xr {
getError(e, t) {
if (Ut(e)) {
const s = e.toLowerCase();
- if (Xm[s])
- return jn.from(Xm[s].signature);
+ if (Jm[s])
+ return Xn.from(Jm[s].signature);
for (const r of this.#e.values())
if (s === r.selector)
return r;
@@ -44915,17 +44915,17 @@ class xr {
/* fix:) */
)[0] === e && s.push(a);
if (s.length === 0)
- return e === "Error" ? jn.from("error Error(string)") : e === "Panic" ? jn.from("error Panic(uint256)") : null;
+ return e === "Error" ? Xn.from("error Error(string)") : e === "Panic" ? Xn.from("error Panic(uint256)") : null;
if (s.length > 1) {
const r = s.map((a) => JSON.stringify(a.format())).join(", ");
V(!1, `ambiguous error description (i.e. ${r})`, "name", e);
}
return s[0];
}
- if (e = jn.from(e).format(), e === "Error(string)")
- return jn.from("error Error(string)");
+ if (e = Xn.from(e).format(), e === "Error(string)")
+ return Xn.from("error Error(string)");
if (e === "Panic(uint256)")
- return jn.from("error Panic(uint256)");
+ return Xn.from("error Panic(uint256)");
const n = this.#e.get(e);
return n || null;
}
@@ -45060,7 +45060,7 @@ class xr {
V(r, "unknown function", "fragment", e), e = r;
}
let n = "invalid length for result data";
- const s = On(t);
+ const s = Qn(t);
if (s.length % 32 === 0)
try {
return this.#i.decode(e.outputs, s);
@@ -45073,7 +45073,7 @@ class xr {
});
}
makeError(e, t) {
- const n = dt(e, "data"), s = za.getBuiltinCallException("call", t, n);
+ const n = dt(e, "data"), s = Va.getBuiltinCallException("call", t, n);
if (s.message.startsWith("execution reverted (unknown custom error)")) {
const o = Ie(n.slice(0, 4)), c = this.getError(o);
if (c)
@@ -45149,7 +45149,7 @@ class xr {
ge(t.length <= e.inputs.length, `too many arguments for ${e.format()}`, "UNEXPECTED_ARGUMENT", { count: t.length, expectedCount: e.inputs.length });
const n = [];
e.anonymous || n.push(e.topicHash);
- const s = (r, a) => r.type === "string" ? kr(a) : r.type === "bytes" ? sn(Ie(a)) : (r.type === "bool" && typeof a == "boolean" ? a = a ? "0x01" : "0x00" : r.type.match(/^u?int/) ? a = Ys(a) : r.type.match(/^bytes/) ? a = wF(a, 32) : r.type === "address" && this.#i.encode(["address"], [a]), Es(Ie(a), 32));
+ const s = (r, a) => r.type === "string" ? kr(a) : r.type === "bytes" ? sn(Ie(a)) : (r.type === "bool" && typeof a == "boolean" ? a = a ? "0x01" : "0x00" : r.type.match(/^u?int/) ? a = Ys(a) : r.type.match(/^bytes/) ? a = vF(a, 32) : r.type === "address" && this.#i.encode(["address"], [a]), Es(Ie(a), 32));
for (t.forEach((r, a) => {
const o = e.inputs[a];
if (!o.indexed) {
@@ -45206,9 +45206,9 @@ class xr {
let m = null;
if (f.indexed)
if (o == null)
- m = new Km(null);
+ m = new Xm(null);
else if (a[p])
- m = new Km(o[d++]);
+ m = new Xm(o[d++]);
else
try {
m = o[d++];
@@ -45235,7 +45235,7 @@ class xr {
if (!s)
return null;
const r = this.#i.decode(s.inputs, t.slice(4));
- return new e2(s, s.selector, r, n);
+ return new t2(s, s.selector, r, n);
}
parseCallResult(e) {
throw new Error("@TODO");
@@ -45248,7 +45248,7 @@ class xr {
*/
parseLog(e) {
const t = this.getEvent(e.topics[0]);
- return !t || t.anonymous ? null : new $L(t, t.topicHash, this.decodeEventLog(t, e.data, e.topics));
+ return !t || t.anonymous ? null : new e2(t, t.topicHash, this.decodeEventLog(t, e.data, e.topics));
}
/**
* Parses a revert data, finding the matching error and extracts
@@ -45261,7 +45261,7 @@ class xr {
if (!n)
return null;
const s = this.#i.decode(n.inputs, Kt(t, 4));
- return new t2(n, n.selector, s);
+ return new n2(n, n.selector, s);
}
/**
* Creates a new [[Interface]] from the ABI %%value%%.
@@ -45273,14 +45273,14 @@ class xr {
return e instanceof xr ? e : typeof e == "string" ? new xr(JSON.parse(e)) : typeof e.formatJson == "function" ? new xr(e.formatJson()) : typeof e.format == "function" ? new xr(e.format("json")) : new xr(e);
}
}
-const BE = BigInt(0);
-function Ra(i) {
+const TE = BigInt(0);
+function Fa(i) {
return i ?? null;
}
function $t(i) {
return i == null ? null : i.toString();
}
-class Ym {
+class Zm {
/**
* The gas price for legacy networks.
*/
@@ -45314,9 +45314,9 @@ class Ym {
*/
constructor(e, t, n) {
Ye(this, {
- gasPrice: Ra(e),
- maxFeePerGas: Ra(t),
- maxPriorityFeePerGas: Ra(n)
+ gasPrice: Fa(e),
+ maxFeePerGas: Fa(t),
+ maxPriorityFeePerGas: Fa(n)
});
}
/**
@@ -45332,7 +45332,7 @@ class Ym {
};
}
}
-function ch(i) {
+function hh(i) {
const e = {};
i.to && (e.to = i.to), i.from && (e.from = i.from), i.data && (e.data = Ie(i.data));
const t = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);
@@ -45341,9 +45341,9 @@ function ch(i) {
const n = "type,nonce".split(/,/);
for (const s of n)
!(s in i) || i[s] == null || (e[s] = ft(i[s], `request.${s}`));
- return i.accessList && (e.accessList = Hr(i.accessList)), i.authorizationList && (e.authorizationList = i.authorizationList.slice()), "blockTag" in i && (e.blockTag = i.blockTag), "enableCcipRead" in i && (e.enableCcipRead = !!i.enableCcipRead), "customData" in i && (e.customData = i.customData), "blobVersionedHashes" in i && i.blobVersionedHashes && (e.blobVersionedHashes = i.blobVersionedHashes.slice()), "kzg" in i && (e.kzg = i.kzg), "blobWrapperVersion" in i && (e.blobWrapperVersion = i.blobWrapperVersion), "blobs" in i && i.blobs && (e.blobs = i.blobs.map((s) => Ap(s) ? Ie(s) : Object.assign({}, s))), e;
+ return i.accessList && (e.accessList = Hr(i.accessList)), i.authorizationList && (e.authorizationList = i.authorizationList.slice()), "blockTag" in i && (e.blockTag = i.blockTag), "enableCcipRead" in i && (e.enableCcipRead = !!i.enableCcipRead), "customData" in i && (e.customData = i.customData), "blobVersionedHashes" in i && i.blobVersionedHashes && (e.blobVersionedHashes = i.blobVersionedHashes.slice()), "kzg" in i && (e.kzg = i.kzg), "blobWrapperVersion" in i && (e.blobWrapperVersion = i.blobWrapperVersion), "blobs" in i && i.blobs && (e.blobs = i.blobs.map((s) => mp(s) ? Ie(s) : Object.assign({}, s))), e;
}
-class n2 {
+class i2 {
/**
* The provider connected to the block used to fetch additional details
* if necessary.
@@ -45449,9 +45449,9 @@ class n2 {
* low-level library.
*/
constructor(e, t) {
- this.#e = e.transactions.map((n) => typeof n != "string" ? new bc(n, t) : n), Ye(this, {
+ this.#e = e.transactions.map((n) => typeof n != "string" ? new Ec(n, t) : n), Ye(this, {
provider: t,
- hash: Ra(e.hash),
+ hash: Fa(e.hash),
number: e.number,
timestamp: e.timestamp,
parentHash: e.parentHash,
@@ -45463,9 +45463,9 @@ class n2 {
blobGasUsed: e.blobGasUsed,
excessBlobGas: e.excessBlobGas,
miner: e.miner,
- prevRandao: Ra(e.prevRandao),
+ prevRandao: Fa(e.prevRandao),
extraData: e.extraData,
- baseFeePerGas: Ra(e.baseFeePerGas),
+ baseFeePerGas: Fa(e.baseFeePerGas),
stateRoot: e.stateRoot,
receiptsRoot: e.receiptsRoot
});
@@ -45601,10 +45601,10 @@ class n2 {
orphanedEvent() {
if (!this.isMined())
throw new Error("");
- return i2(this);
+ return s2(this);
}
}
-class xc {
+class bc {
/**
* The provider connected to the log used to fetch additional details
* if necessary.
@@ -45721,10 +45721,10 @@ class xc {
* @_ignore:
*/
removedEvent() {
- return s2(this);
+ return r2(this);
}
}
-class TE {
+class RE {
/**
* The provider connected to the log used to fetch additional details
* if necessary.
@@ -45825,8 +45825,8 @@ class TE {
* @_ignore:
*/
constructor(e, t) {
- this.#e = Object.freeze(e.logs.map((s) => new xc(s, t)));
- let n = BE;
+ this.#e = Object.freeze(e.logs.map((s) => new bc(s, t)));
+ let n = TE;
e.effectiveGasPrice != null ? n = e.effectiveGasPrice : e.gasPrice != null && (n = e.gasPrice), Ye(this, {
provider: t,
to: e.to,
@@ -45948,16 +45948,16 @@ class TE {
* @_ignore:
*/
removedEvent() {
- return FE(this);
+ return NE(this);
}
/**
* @_ignore:
*/
reorderedEvent(e) {
- return ge(!e || e.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }), RE(this, e);
+ return ge(!e || e.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }), FE(this, e);
}
}
-class bc {
+class Ec {
/**
* The provider this is connected to, which will influence how its
* methods will resolve its async inspection methods.
@@ -46142,7 +46142,7 @@ class bc {
*/
async confirmations() {
if (this.blockNumber == null) {
- const { tx: t, blockNumber: n } = await Un({
+ const { tx: t, blockNumber: n } = await On({
tx: this.getTransaction(),
blockNumber: this.provider.getBlockNumber()
});
@@ -46165,7 +46165,7 @@ class bc {
const c = async () => {
if (o)
return null;
- const { blockNumber: d, nonce: f } = await Un({
+ const { blockNumber: d, nonce: f } = await On({
blockNumber: this.provider.getBlockNumber(),
nonce: this.provider.getTransactionCount(this.from)
});
@@ -46195,7 +46195,7 @@ class bc {
if (_ == null || d - _.blockNumber + 1 < n)
return;
let x = "replaced";
- A.data === this.data && A.to === this.to && A.value === this.value ? x = "repriced" : A.data === "0x" && A.from === A.to && A.value === BE && (x = "cancelled"), ge(!1, "transaction was replaced", "TRANSACTION_REPLACED", {
+ A.data === this.data && A.to === this.to && A.value === this.value ? x = "repriced" : A.data === "0x" && A.from === A.to && A.value === TE && (x = "cancelled"), ge(!1, "transaction was replaced", "TRANSACTION_REPLACED", {
cancelled: x === "replaced" || x === "cancelled",
reason: x,
replacement: A.replaceableTransaction(r),
@@ -46331,14 +46331,14 @@ class bc {
* that evict this transaction.
*/
removedEvent() {
- return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), FE(this);
+ return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), NE(this);
}
/**
* Returns a filter which can be used to listen for orphan events
* that re-order this event against %%other%%.
*/
reorderedEvent(e) {
- return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), ge(!e || e.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), RE(this, e);
+ return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), ge(!e || e.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), FE(this, e);
}
/**
* Returns a new TransactionResponse instance which has the ability to
@@ -46351,20 +46351,20 @@ class bc {
*/
replaceableTransaction(e) {
V(Number.isInteger(e) && e >= 0, "invalid startBlock", "startBlock", e);
- const t = new bc(this, this.provider);
+ const t = new Ec(this, this.provider);
return t.#e = e, t;
}
}
-function i2(i) {
+function s2(i) {
return { orphan: "drop-block", hash: i.hash, number: i.number };
}
-function RE(i, e) {
+function FE(i, e) {
return { orphan: "reorder-transaction", tx: i, other: e };
}
-function FE(i) {
+function NE(i) {
return { orphan: "drop-transaction", tx: i };
}
-function s2(i) {
+function r2(i) {
return { orphan: "drop-log", log: {
transactionHash: i.transactionHash,
blockHash: i.blockHash,
@@ -46375,7 +46375,7 @@ function s2(i) {
index: i.index
} };
}
-class Tp extends xc {
+class Fp extends bc {
/**
* The Contract Interface.
*/
@@ -46409,7 +46409,7 @@ class Tp extends xc {
return this.fragment.format();
}
}
-class NE extends xc {
+class DE extends bc {
/**
* The error encounted when trying to decode the log.
*/
@@ -46421,7 +46421,7 @@ class NE extends xc {
super(e, e.provider), Ye(this, { error: t });
}
}
-class r2 extends TE {
+class a2 extends RE {
#e;
/**
* @_ignore:
@@ -46438,15 +46438,15 @@ class r2 extends TE {
const t = e.topics.length ? this.#e.getEvent(e.topics[0]) : null;
if (t)
try {
- return new Tp(e, this.#e, t);
+ return new Fp(e, this.#e, t);
} catch (n) {
- return new NE(e, n);
+ return new DE(e, n);
}
return e;
});
}
}
-class Rp extends bc {
+class Np extends Ec {
#e;
/**
* @_ignore:
@@ -46465,10 +46465,10 @@ class Rp extends bc {
*/
async wait(e, t) {
const n = await super.wait(e, t);
- return n == null ? null : new r2(this.#e, this.provider, n);
+ return n == null ? null : new a2(this.#e, this.provider, n);
}
}
-class DE extends lb {
+class LE extends hb {
/**
* The log with no matching events.
*/
@@ -46498,12 +46498,12 @@ class DE extends lb {
return await this.log.getTransactionReceipt();
}
}
-class a2 extends DE {
+class o2 extends LE {
/**
* @_ignore:
*/
constructor(e, t, n, s, r) {
- super(e, t, n, new Tp(r, e.interface, s));
+ super(e, t, n, new Fp(r, e.interface, s));
const a = e.interface.decodeEventLog(s, this.log.data, this.log.topics);
Ye(this, { args: a, fragment: s });
}
@@ -46520,36 +46520,36 @@ class a2 extends DE {
return this.fragment.format();
}
}
-const Jm = BigInt(0);
-function LE(i) {
+const $m = BigInt(0);
+function PE(i) {
return i && typeof i.call == "function";
}
-function PE(i) {
+function kE(i) {
return i && typeof i.estimateGas == "function";
}
-function Dh(i) {
+function Ph(i) {
return i && typeof i.resolveName == "function";
}
-function kE(i) {
+function UE(i) {
return i && typeof i.sendTransaction == "function";
}
-function UE(i) {
+function OE(i) {
if (i != null) {
- if (Dh(i))
+ if (Ph(i))
return i;
if (i.provider)
return i.provider;
}
}
-class o2 {
+class c2 {
#e;
fragment;
constructor(e, t, n) {
if (Ye(this, { fragment: t }), t.inputs.length < n.length)
throw new Error("too many arguments");
- const s = Qr(e.runner, "resolveName"), r = Dh(s) ? s : null;
+ const s = Qr(e.runner, "resolveName"), r = Ph(s) ? s : null;
this.#e = (async function() {
- const a = await Promise.all(t.inputs.map((o, c) => n[c] == null ? null : o.walkAsync(n[c], (h, u) => h === "address" ? Array.isArray(u) ? Promise.all(u.map((d) => Hn(d, r))) : Hn(u, r) : u)));
+ const a = await Promise.all(t.inputs.map((o, c) => n[c] == null ? null : o.walkAsync(n[c], (h, u) => h === "address" ? Array.isArray(u) ? Promise.all(u.map((d) => zn(d, r))) : zn(u, r) : u)));
return e.interface.encodeFilterTopics(t, a);
})();
}
@@ -46563,41 +46563,41 @@ function Qr(i, e) {
function vr(i) {
return i == null ? null : i.provider || null;
}
-async function OE(i, e) {
+async function QE(i, e) {
const t = jt.dereference(i, "overrides");
V(typeof t == "object", "invalid overrides parameter", "overrides", i);
- const n = ch(t);
+ const n = hh(t);
return V(n.to == null || (e || []).indexOf("to") >= 0, "cannot override to", "overrides.to", n.to), V(n.data == null || (e || []).indexOf("data") >= 0, "cannot override data", "overrides.data", n.data), n.from && (n.from = n.from), n;
}
-async function c2(i, e, t) {
- const n = Qr(i, "resolveName"), s = Dh(n) ? n : null;
- return await Promise.all(e.map((r, a) => r.walkAsync(t[a], (o, c) => (c = jt.dereference(c, o), o === "address" ? Hn(c, s) : c))));
+async function l2(i, e, t) {
+ const n = Qr(i, "resolveName"), s = Ph(n) ? n : null;
+ return await Promise.all(e.map((r, a) => r.walkAsync(t[a], (o, c) => (c = jt.dereference(c, o), o === "address" ? zn(c, s) : c))));
}
-function l2(i) {
+function h2(i) {
const e = async function(a) {
- const o = await OE(a, ["data"]);
- o.to = await i.getAddress(), o.from && (o.from = await Hn(o.from, UE(i.runner)));
- const c = i.interface, l = De(o.value || Jm, "overrides.value") === Jm, h = (o.data || "0x") === "0x";
+ const o = await QE(a, ["data"]);
+ o.to = await i.getAddress(), o.from && (o.from = await zn(o.from, OE(i.runner)));
+ const c = i.interface, l = De(o.value || $m, "overrides.value") === $m, h = (o.data || "0x") === "0x";
c.fallback && !c.fallback.payable && c.receive && !h && !l && V(!1, "cannot send data to receive or send value to non-payable fallback", "overrides", a), V(c.fallback || h, "cannot send data to receive-only contract", "overrides.data", o.data);
const u = c.receive || c.fallback && c.fallback.payable;
return V(u || l, "cannot send value to non-payable fallback", "overrides.value", o.value), V(c.fallback || h, "cannot send data to receive-only contract", "overrides.data", o.data), o;
}, t = async function(a) {
const o = Qr(i.runner, "call");
- ge(LE(o), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
+ ge(PE(o), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
const c = await e(a);
try {
return await o.call(c);
} catch (l) {
- throw pp(l) && l.data ? i.interface.makeError(l.data, c) : l;
+ throw gp(l) && l.data ? i.interface.makeError(l.data, c) : l;
}
}, n = async function(a) {
const o = i.runner;
- ge(kE(o), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
+ ge(UE(o), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
const c = await o.sendTransaction(await e(a)), l = vr(i.runner);
- return new Rp(i.interface, l, c);
+ return new Np(i.interface, l, c);
}, s = async function(a) {
const o = Qr(i.runner, "estimateGas");
- return ge(PE(o), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await o.estimateGas(await e(a));
+ return ge(kE(o), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await o.estimateGas(await e(a));
}, r = async (a) => await n(a);
return Ye(r, {
_contract: i,
@@ -46607,7 +46607,7 @@ function l2(i) {
staticCall: t
}), r;
}
-function h2(i, e) {
+function u2(i, e) {
const t = function(...l) {
const h = i.interface.getFunction(e, l);
return ge(h, "no matching fragment", "UNSUPPORTED_OPERATION", {
@@ -46617,10 +46617,10 @@ function h2(i, e) {
}, n = async function(...l) {
const h = t(...l);
let u = {};
- if (h.inputs.length + 1 === l.length && (u = await OE(l.pop()), u.from && (u.from = await Hn(u.from, UE(i.runner)))), h.inputs.length !== l.length)
+ if (h.inputs.length + 1 === l.length && (u = await QE(l.pop()), u.from && (u.from = await zn(u.from, OE(i.runner)))), h.inputs.length !== l.length)
throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");
- const d = await c2(i.runner, h.inputs, l);
- return Object.assign({}, u, await Un({
+ const d = await l2(i.runner, h.inputs, l);
+ return Object.assign({}, u, await On({
to: i.getAddress(),
data: i.interface.encodeFunctionData(h, d)
}));
@@ -46629,21 +46629,21 @@ function h2(i, e) {
return h.length === 1 ? h[0] : h;
}, r = async function(...l) {
const h = i.runner;
- ge(kE(h), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
+ ge(UE(h), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
const u = await h.sendTransaction(await n(...l)), d = vr(i.runner);
- return new Rp(i.interface, d, u);
+ return new Np(i.interface, d, u);
}, a = async function(...l) {
const h = Qr(i.runner, "estimateGas");
- return ge(PE(h), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await h.estimateGas(await n(...l));
+ return ge(kE(h), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await h.estimateGas(await n(...l));
}, o = async function(...l) {
const h = Qr(i.runner, "call");
- ge(LE(h), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
+ ge(PE(h), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
const u = await n(...l);
let d = "0x";
try {
d = await h.call(u);
} catch (p) {
- throw pp(p) && p.data ? i.interface.makeError(p.data, u) : p;
+ throw gp(p) && p.data ? i.interface.makeError(p.data, u) : p;
}
const f = t(...l);
return i.interface.decodeFunctionResult(f, d);
@@ -46670,7 +46670,7 @@ function h2(i, e) {
}
}), c;
}
-function u2(i, e) {
+function d2(i, e) {
const t = function(...s) {
const r = i.interface.getEvent(e, s);
return ge(r, "no matching fragment", "UNSUPPORTED_OPERATION", {
@@ -46678,7 +46678,7 @@ function u2(i, e) {
info: { key: e, args: s }
}), r;
}, n = function(...s) {
- return new o2(i, t(...s), s);
+ return new c2(i, t(...s), s);
};
return Ye(n, {
name: i.interface.getEventName(e),
@@ -46697,17 +46697,17 @@ function u2(i, e) {
}
}), n;
}
-const lh = /* @__PURE__ */ Symbol.for("_ethersInternal_contract"), QE = /* @__PURE__ */ new WeakMap();
-function d2(i, e) {
- QE.set(i[lh], e);
+const uh = /* @__PURE__ */ Symbol.for("_ethersInternal_contract"), GE = /* @__PURE__ */ new WeakMap();
+function f2(i, e) {
+ GE.set(i[uh], e);
}
-function ei(i) {
- return QE.get(i[lh]);
+function ti(i) {
+ return GE.get(i[uh]);
}
-function f2(i) {
+function p2(i) {
return i && typeof i == "object" && "getTopicFilter" in i && typeof i.getTopicFilter == "function" && i.fragment;
}
-async function Fp(i, e) {
+async function Dp(i, e) {
let t, n = null;
if (Array.isArray(e)) {
const r = function(a) {
@@ -46717,7 +46717,7 @@ async function Fp(i, e) {
return V(o, "unknown fragment", "name", a), o.topicHash;
};
t = e.map((a) => a == null ? null : Array.isArray(a) ? a.map(r) : r(a));
- } else e === "*" ? t = [null] : typeof e == "string" ? Ut(e, 32) ? t = [e] : (n = i.interface.getEvent(e), V(n, "unknown fragment", "event", e), t = [n.topicHash]) : f2(e) ? t = await e.getTopicFilter() : "fragment" in e ? (n = e.fragment, t = [n.topicHash]) : V(!1, "unknown event name", "event", e);
+ } else e === "*" ? t = [null] : typeof e == "string" ? Ut(e, 32) ? t = [e] : (n = i.interface.getEvent(e), V(n, "unknown fragment", "event", e), t = [n.topicHash]) : p2(e) ? t = await e.getTopicFilter() : "fragment" in e ? (n = e.fragment, t = [n.topicHash]) : V(!1, "unknown event name", "event", e);
t = t.map((r) => {
if (r == null)
return null;
@@ -46730,14 +46730,14 @@ async function Fp(i, e) {
const s = t.map((r) => r == null ? "null" : Array.isArray(r) ? r.join("|") : r).join("&");
return { fragment: n, tag: s, topics: t };
}
-async function Mo(i, e) {
- const { subs: t } = ei(i);
- return t.get((await Fp(i, e)).tag) || null;
+async function Bo(i, e) {
+ const { subs: t } = ti(i);
+ return t.get((await Dp(i, e)).tag) || null;
}
-async function Zm(i, e, t) {
+async function e0(i, e, t) {
const n = vr(i.runner);
ge(n, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation: e });
- const { fragment: s, tag: r, topics: a } = await Fp(i, t), { addr: o, subs: c } = ei(i);
+ const { fragment: s, tag: r, topics: a } = await Dp(i, t), { addr: o, subs: c } = ti(i);
let l = c.get(r);
if (!l) {
const u = { address: o || i, topics: a }, d = (g) => {
@@ -46749,9 +46749,9 @@ async function Zm(i, e, t) {
}
if (A) {
const _ = A, x = s ? i.interface.decodeEventLog(s, g.data, g.topics) : [];
- If(i, t, x, (E) => new a2(i, E, t, _, g));
+ Mf(i, t, x, (E) => new o2(i, E, t, _, g));
} else
- If(i, t, [], (_) => new DE(i, _, t, g));
+ Mf(i, t, [], (_) => new LE(i, _, t, g));
};
let f = [];
l = { tag: r, listeners: [], start: () => {
@@ -46765,10 +46765,10 @@ async function Zm(i, e, t) {
}
return l;
}
-let Cf = Promise.resolve();
-async function p2(i, e, t, n) {
- await Cf;
- const s = await Mo(i, e);
+let Sf = Promise.resolve();
+async function A2(i, e, t, n) {
+ await Sf;
+ const s = await Bo(i, e);
if (!s)
return !1;
const r = s.listeners.length;
@@ -46780,18 +46780,18 @@ async function p2(i, e, t, n) {
} catch {
}
return !o;
- }), s.listeners.length === 0 && (s.stop(), ei(i).subs.delete(s.tag)), r > 0;
+ }), s.listeners.length === 0 && (s.stop(), ti(i).subs.delete(s.tag)), r > 0;
}
-async function If(i, e, t, n) {
+async function Mf(i, e, t, n) {
try {
- await Cf;
+ await Sf;
} catch {
}
- const s = p2(i, e, t, n);
- return Cf = s, await s;
+ const s = A2(i, e, t, n);
+ return Sf = s, await s;
}
-const _l = ["then"];
-class Oo {
+const wl = ["then"];
+class Qo {
/**
* The target to connect to.
*
@@ -46819,7 +46819,7 @@ class Oo {
/**
* @_ignore:
*/
- [lh];
+ [uh];
/**
* The fallback or receive function if any.
*/
@@ -46830,13 +46830,13 @@ class Oo {
* of.
*/
constructor(e, t, n, s) {
- V(typeof e == "string" || qb(e), "invalid value for Contract target", "target", e), n == null && (n = null);
+ V(typeof e == "string" || Kb(e), "invalid value for Contract target", "target", e), n == null && (n = null);
const r = xr.from(t);
- Ye(this, { target: e, runner: n, interface: r }), Object.defineProperty(this, lh, { value: {} });
+ Ye(this, { target: e, runner: n, interface: r }), Object.defineProperty(this, uh, { value: {} });
let a, o = null, c = null;
if (s) {
const u = vr(n);
- c = new Rp(this.interface, u, s);
+ c = new Np(this.interface, u, s);
}
let l = /* @__PURE__ */ new Map();
if (typeof e == "string")
@@ -46844,7 +46844,7 @@ class Oo {
o = e, a = Promise.resolve(e);
else {
const u = Qr(n, "resolveName");
- if (!Dh(u))
+ if (!Ph(u))
throw Gt("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", {
operation: "resolveName"
});
@@ -46853,19 +46853,19 @@ class Oo {
throw Gt("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", {
value: e
});
- return ei(this).addr = d, d;
+ return ti(this).addr = d, d;
});
}
else
a = e.getAddress().then((u) => {
if (u == null)
throw new Error("TODO");
- return ei(this).addr = u, u;
+ return ti(this).addr = u, u;
});
- d2(this, { addrPromise: a, addr: o, deployTx: c, subs: l });
+ f2(this, { addrPromise: a, addr: o, deployTx: c, subs: l });
const h = new Proxy({}, {
get: (u, d, f) => {
- if (typeof d == "symbol" || _l.indexOf(d) >= 0)
+ if (typeof d == "symbol" || wl.indexOf(d) >= 0)
return Reflect.get(u, d, f);
try {
return this.getEvent(d);
@@ -46874,13 +46874,13 @@ class Oo {
throw p;
}
},
- has: (u, d) => _l.indexOf(d) >= 0 ? Reflect.has(u, d) : Reflect.has(u, d) || this.interface.hasEvent(String(d))
+ has: (u, d) => wl.indexOf(d) >= 0 ? Reflect.has(u, d) : Reflect.has(u, d) || this.interface.hasEvent(String(d))
});
return Ye(this, { filters: h }), Ye(this, {
- fallback: r.receive || r.fallback ? l2(this) : null
+ fallback: r.receive || r.fallback ? h2(this) : null
}), new Proxy(this, {
get: (u, d, f) => {
- if (typeof d == "symbol" || d in u || _l.indexOf(d) >= 0)
+ if (typeof d == "symbol" || d in u || wl.indexOf(d) >= 0)
return Reflect.get(u, d, f);
try {
return u.getFunction(d);
@@ -46889,7 +46889,7 @@ class Oo {
throw p;
}
},
- has: (u, d) => typeof d == "symbol" || d in u || _l.indexOf(d) >= 0 ? Reflect.has(u, d) : u.interface.hasFunction(d)
+ has: (u, d) => typeof d == "symbol" || d in u || wl.indexOf(d) >= 0 ? Reflect.has(u, d) : u.interface.hasFunction(d)
});
}
/**
@@ -46897,20 +46897,20 @@ class Oo {
* a different %%runner%%.
*/
connect(e) {
- return new Oo(this.target, this.interface, e);
+ return new Qo(this.target, this.interface, e);
}
/**
* Return a new Contract instance with the same ABI and runner, but
* a different %%target%%.
*/
attach(e) {
- return new Oo(e, this.interface, this.runner);
+ return new Qo(e, this.interface, this.runner);
}
/**
* Return the resolved address of this Contract.
*/
async getAddress() {
- return await ei(this).addrPromise;
+ return await ti(this).addrPromise;
}
/**
* Return the deployed bytecode or null if no bytecode is found.
@@ -46952,7 +46952,7 @@ class Oo {
* [[ContractFactory]].
*/
deploymentTransaction() {
- return ei(this).deployTx;
+ return ti(this).deployTx;
}
/**
* Return the function for a given name. This is useful when a contract
@@ -46960,7 +46960,7 @@ class Oo {
* when using a Contract programmatically.
*/
getFunction(e) {
- return typeof e != "string" && (e = e.format()), h2(this, e);
+ return typeof e != "string" && (e = e.format()), u2(this, e);
}
/**
* Return the event for a given name. This is useful when a contract
@@ -46968,7 +46968,7 @@ class Oo {
* when using a Contract programmatically.
*/
getEvent(e) {
- return typeof e != "string" && (e = e.format()), u2(this, e);
+ return typeof e != "string" && (e = e.format()), d2(this, e);
}
/**
* @_ignore:
@@ -46998,7 +46998,7 @@ class Oo {
*/
async queryFilter(e, t, n) {
t == null && (t = 0), n == null && (n = "latest");
- const { addr: s, addrPromise: r } = ei(this), a = s || await r, { fragment: o, topics: c } = await Fp(this, e), l = { address: a, topics: c, fromBlock: t, toBlock: n }, h = vr(this.runner);
+ const { addr: s, addrPromise: r } = ti(this), a = s || await r, { fragment: o, topics: c } = await Dp(this, e), l = { address: a, topics: c, fromBlock: t, toBlock: n }, h = vr(this.runner);
return ge(h, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }), (await h.getLogs(l)).map((u) => {
let d = o;
if (d == null)
@@ -47008,18 +47008,18 @@ class Oo {
}
if (d)
try {
- return new Tp(u, this.interface, d);
+ return new Fp(u, this.interface, d);
} catch (f) {
- return new NE(u, f);
+ return new DE(u, f);
}
- return new xc(u, h);
+ return new bc(u, h);
});
}
/**
* Add an event %%listener%% for the %%event%%.
*/
async on(e, t) {
- const n = await Zm(this, "on", e);
+ const n = await e0(this, "on", e);
return n.listeners.push({ listener: t, once: !1 }), n.start(), this;
}
/**
@@ -47027,7 +47027,7 @@ class Oo {
* after it is fired once.
*/
async once(e, t) {
- const n = await Zm(this, "once", e);
+ const n = await e0(this, "once", e);
return n.listeners.push({ listener: t, once: !0 }), n.start(), this;
}
/**
@@ -47036,7 +47036,7 @@ class Oo {
* Resolves to ``true`` if any listeners were called.
*/
async emit(e, ...t) {
- return await If(this, e, t, null);
+ return await Mf(this, e, t, null);
}
/**
* Resolves to the number of listeners of %%event%% or the total number
@@ -47044,10 +47044,10 @@ class Oo {
*/
async listenerCount(e) {
if (e) {
- const s = await Mo(this, e);
+ const s = await Bo(this, e);
return s ? s.listeners.length : 0;
}
- const { subs: t } = ei(this);
+ const { subs: t } = ti(this);
let n = 0;
for (const { listeners: s } of t.values())
n += s.length;
@@ -47059,10 +47059,10 @@ class Oo {
*/
async listeners(e) {
if (e) {
- const s = await Mo(this, e);
+ const s = await Bo(this, e);
return s ? s.listeners.map(({ listener: r }) => r) : [];
}
- const { subs: t } = ei(this);
+ const { subs: t } = ti(this);
let n = [];
for (const { listeners: s } of t.values())
n = n.concat(s.map(({ listener: r }) => r));
@@ -47073,14 +47073,14 @@ class Oo {
* all listeners if unspecified.
*/
async off(e, t) {
- const n = await Mo(this, e);
+ const n = await Bo(this, e);
if (!n)
return this;
if (t) {
const s = n.listeners.map(({ listener: r }) => r).indexOf(t);
s >= 0 && n.listeners.splice(s, 1);
}
- return (t == null || n.listeners.length === 0) && (n.stop(), ei(this).subs.delete(n.tag)), this;
+ return (t == null || n.listeners.length === 0) && (n.stop(), ti(this).subs.delete(n.tag)), this;
}
/**
* Remove all the listeners for %%event%% or remove all listeners if
@@ -47088,12 +47088,12 @@ class Oo {
*/
async removeAllListeners(e) {
if (e) {
- const t = await Mo(this, e);
+ const t = await Bo(this, e);
if (!t)
return this;
- t.stop(), ei(this).subs.delete(t.tag);
+ t.stop(), ti(this).subs.delete(t.tag);
} else {
- const { subs: t } = ei(this);
+ const { subs: t } = ti(this);
for (const { tag: n, stop: s } of t.values())
s(), t.delete(n);
}
@@ -47115,7 +47115,7 @@ class Oo {
* Create a new Class for the %%abi%%.
*/
static buildClass(e) {
- class t extends Oo {
+ class t extends Qo {
constructor(s, r = null) {
super(s, e, r);
}
@@ -47129,15 +47129,15 @@ class Oo {
return n == null && (n = null), new this(e, t, n);
}
}
-function A2() {
- return Oo;
+function g2() {
+ return Qo;
}
-class Mr extends A2() {
+class Mr extends g2() {
}
-function sd(i) {
+function ad(i) {
return i.match(/^ipfs:\/\/ipfs\//i) ? i = i.substring(12) : i.match(/^ipfs:\/\//i) ? i = i.substring(7) : V(!1, "unsupported IPFS format", "link", i), `https://gateway.ipfs.io/ipfs/${i}`;
}
-class g2 {
+class m2 {
/**
* The name.
*/
@@ -47170,13 +47170,13 @@ class g2 {
throw new Error("unsupported coin");
}
}
-const GE = new RegExp("^(ipfs)://(.*)$", "i"), $m = [
+const HE = new RegExp("^(ipfs)://(.*)$", "i"), t0 = [
new RegExp("^(https)://(.*)$", "i"),
new RegExp("^(data):(.*)$", "i"),
- GE,
+ HE,
new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i")
];
-class Fa {
+class Na {
/**
* The connected provider.
*/
@@ -47219,12 +47219,12 @@ class Fa {
async #n(e, t) {
t = (t || []).slice();
const n = this.#t.interface;
- t.unshift(vf(this.name));
+ t.unshift(If(this.name));
let s = null;
await this.supportsWildcard() && (s = n.getFunction(e), ge(s, "missing fragment", "UNKNOWN_ERROR", {
info: { funcName: e }
}), t = [
- RL(this.name, 255),
+ FL(this.name, 255),
n.encodeFunctionData(s, t)
], e = "resolve(bytes,bytes)"), t.push({
enableCcipRead: !0
@@ -47246,7 +47246,7 @@ class Fa {
if (e == null && (e = 60), e === 60)
try {
const r = await this.#n("addr(bytes32)");
- return r == null || r === sc ? null : r;
+ return r == null || r === rc ? null : r;
} catch (r) {
if (Mn(r, "CALL_EXCEPTION"))
return null;
@@ -47260,7 +47260,7 @@ class Fa {
}
let t = null;
for (const r of this.provider.plugins)
- if (r instanceof g2 && r.supportsCoinType(e)) {
+ if (r instanceof m2 && r.supportsCoinType(e)) {
t = r;
break;
}
@@ -47296,7 +47296,7 @@ class Fa {
if (t) {
const s = t[1] === "e3010170" ? "ipfs" : "ipns", r = parseInt(t[4], 16);
if (t[5].length === r * 2)
- return `${s}://${IF("0x" + t[2])}`;
+ return `${s}://${SF("0x" + t[2])}`;
}
const n = e.match(/^0xe40101fa011b20([0-9a-f]*)$/);
if (n && n[1].length === 64)
@@ -47332,8 +47332,8 @@ class Fa {
if (t == null)
return e.push({ type: "!avatar", value: "" }), { url: null, linkage: e };
e.push({ type: "avatar", value: t });
- for (let n = 0; n < $m.length; n++) {
- const s = t.match($m[n]);
+ for (let n = 0; n < t0.length; n++) {
+ const s = t.match(t0[n]);
if (s == null)
continue;
const r = s[1].toLowerCase();
@@ -47342,7 +47342,7 @@ class Fa {
case "data":
return e.push({ type: "url", value: t }), { linkage: e, url: t };
case "ipfs": {
- const a = sd(t);
+ const a = ad(t);
return e.push({ type: "ipfs", value: t }), e.push({ type: "url", value: a }), { linkage: e, url: a };
}
case "erc721":
@@ -47377,9 +47377,9 @@ class Fa {
let u = await h[a](l);
if (u == null || u === "0x")
return e.push({ type: "!metadata-url", value: "" }), { url: null, linkage: e };
- e.push({ type: "metadata-url-base", value: u }), r === "erc1155" && (u = u.replace("{id}", Ys(l, 32).substring(2)), e.push({ type: "metadata-url-expanded", value: u })), u.match(/^ipfs:/i) && (u = sd(u)), e.push({ type: "metadata-url", value: u });
+ e.push({ type: "metadata-url-base", value: u }), r === "erc1155" && (u = u.replace("{id}", Ys(l, 32).substring(2)), e.push({ type: "metadata-url-expanded", value: u })), u.match(/^ipfs:/i) && (u = ad(u)), e.push({ type: "metadata-url", value: u });
let d = {};
- const f = await new Gi(u).send();
+ const f = await new Hi(u).send();
f.assertOk();
try {
d = f.bodyJson;
@@ -47399,9 +47399,9 @@ class Fa {
if (typeof p != "string")
return e.push({ type: "!imageUrl", value: "" }), { url: null, linkage: e };
if (!p.match(/^(https:\/\/|data:)/i)) {
- if (p.match(GE) == null)
+ if (p.match(HE) == null)
return e.push({ type: "!imageUrl-ipfs", value: p }), { url: null, linkage: e };
- e.push({ type: "imageUrl-ipfs", value: p }), p = sd(p);
+ e.push({ type: "imageUrl-ipfs", value: p }), p = ad(p);
}
return e.push({ type: "url", value: p }), { linkage: e, url: p };
}
@@ -47419,14 +47419,14 @@ class Fa {
}), n.address;
}
static async #i(e, t) {
- const n = await Fa.getEnsAddress(e);
+ const n = await Na.getEnsAddress(e);
try {
const r = await new Mr(n, [
"function resolver(bytes32) view returns (address)"
- ], e).resolver(vf(t), {
+ ], e).resolver(If(t), {
enableCcipRead: !0
});
- return r === sc ? null : r;
+ return r === rc ? null : r;
} catch (s) {
throw s;
}
@@ -47441,22 +47441,22 @@ class Fa {
for (; ; ) {
if (n === "" || n === "." || t !== "eth" && n === "eth")
return null;
- const s = await Fa.#i(e, n);
+ const s = await Na.#i(e, n);
if (s != null) {
- const r = new Fa(e, s, t);
+ const r = new Na(e, s, t);
return n !== t && !await r.supportsWildcard() ? null : r;
}
n = n.split(".").slice(1).join(".");
}
}
}
-const e0 = BigInt(0);
+const n0 = BigInt(0);
function bt(i, e) {
return (function(t) {
return t == null ? e : i(t);
});
}
-function hc(i, e) {
+function uc(i, e) {
return ((t) => {
if (e && t == null)
return null;
@@ -47465,7 +47465,7 @@ function hc(i, e) {
return t.map((n) => i(n));
});
}
-function Ec(i, e) {
+function yc(i, e) {
return ((t) => {
const n = {};
for (const s in i) {
@@ -47488,7 +47488,7 @@ function Ec(i, e) {
return n;
});
}
-function m2(i) {
+function x2(i) {
switch (i) {
case !0:
case "true":
@@ -47499,35 +47499,35 @@ function m2(i) {
}
V(!1, `invalid boolean; ${JSON.stringify(i)}`, "value", i);
}
-function Va(i) {
+function Wa(i) {
return V(Ut(i, !0), "invalid data", "value", i), i;
}
function Sn(i) {
return V(Ut(i, 32), "invalid hash", "value", i), i;
}
-const x2 = Ec({
+const b2 = yc({
address: Mt,
blockHash: Sn,
blockNumber: ft,
- data: Va,
+ data: Wa,
index: ft,
- removed: bt(m2, !1),
- topics: hc(Sn),
+ removed: bt(x2, !1),
+ topics: uc(Sn),
transactionHash: Sn,
transactionIndex: ft
}, {
index: ["logIndex"]
});
-function b2(i) {
- return x2(i);
+function E2(i) {
+ return b2(i);
}
-const E2 = Ec({
+const y2 = yc({
hash: bt(Sn),
parentHash: Sn,
parentBeaconBlockRoot: bt(Sn, null),
number: ft,
timestamp: ft,
- nonce: bt(Va),
+ nonce: bt(Wa),
difficulty: De,
gasLimit: De,
gasUsed: De,
@@ -47537,31 +47537,31 @@ const E2 = Ec({
excessBlobGas: bt(De, null),
miner: bt(Mt),
prevRandao: bt(Sn, null),
- extraData: Va,
+ extraData: Wa,
baseFeePerGas: bt(De)
}, {
prevRandao: ["mixHash"]
});
-function y2(i) {
- const e = E2(i);
- return e.transactions = i.transactions.map((t) => typeof t == "string" ? t : HE(t)), e;
+function _2(i) {
+ const e = y2(i);
+ return e.transactions = i.transactions.map((t) => typeof t == "string" ? t : zE(t)), e;
}
-const _2 = Ec({
+const w2 = yc({
transactionIndex: ft,
blockNumber: ft,
transactionHash: Sn,
address: Mt,
- topics: hc(Sn),
- data: Va,
+ topics: uc(Sn),
+ data: Wa,
index: ft,
blockHash: Sn
}, {
index: ["logIndex"]
});
-function w2(i) {
- return _2(i);
+function v2(i) {
+ return w2(i);
}
-const v2 = Ec({
+const C2 = yc({
to: bt(Mt, null),
from: bt(Mt, null),
contractAddress: bt(Mt, null),
@@ -47570,10 +47570,10 @@ const v2 = Ec({
root: bt(Ie),
gasUsed: De,
blobGasUsed: bt(De, null),
- logsBloom: bt(Va),
+ logsBloom: bt(Wa),
blockHash: Sn,
hash: Sn,
- logs: hc(w2),
+ logs: uc(v2),
blockNumber: ft,
//confirmations: allowNull(getNumber, null),
cumulativeGasUsed: De,
@@ -47586,19 +47586,19 @@ const v2 = Ec({
hash: ["transactionHash"],
index: ["transactionIndex"]
});
-function C2(i) {
- return v2(i);
+function I2(i) {
+ return C2(i);
}
-function HE(i) {
- i.to && De(i.to) === e0 && (i.to = "0x0000000000000000000000000000000000000000");
- const e = Ec({
+function zE(i) {
+ i.to && De(i.to) === n0 && (i.to = "0x0000000000000000000000000000000000000000");
+ const e = yc({
hash: Sn,
// Some nodes do not return this, usually test nodes (like Ganache)
index: bt(ft, void 0),
type: (t) => t === "0x" || t == null ? 0 : ft(t),
accessList: bt(Hr, null),
- blobVersionedHashes: bt(hc(Sn, !0), null),
- authorizationList: bt(hc((t) => {
+ blobVersionedHashes: bt(uc(Sn, !0), null),
+ authorizationList: bt(uc((t) => {
let n;
if (t.signature)
n = t.signature;
@@ -47626,7 +47626,7 @@ function HE(i) {
to: bt(Mt, null),
value: De,
nonce: ft,
- data: Va,
+ data: Wa,
creates: bt(Mt, null),
chainId: bt(De, null)
}, {
@@ -47634,14 +47634,14 @@ function HE(i) {
gasLimit: ["gas"],
index: ["transactionIndex"]
})(i);
- if (e.to == null && e.creates == null && (e.creates = dD(e)), (i.type === 1 || i.type === 2) && i.accessList == null && (e.accessList = []), i.signature ? e.signature = zt.from(i.signature) : e.signature = zt.from(i), e.chainId == null) {
+ if (e.to == null && e.creates == null && (e.creates = fD(e)), (i.type === 1 || i.type === 2) && i.accessList == null && (e.accessList = []), i.signature ? e.signature = zt.from(i.signature) : e.signature = zt.from(i), e.chainId == null) {
const t = e.signature.legacyChainId;
t != null && (e.chainId = t);
}
- return e.blockHash && De(e.blockHash) === e0 && (e.blockHash = null), e;
+ return e.blockHash && De(e.blockHash) === n0 && (e.blockHash = null), e;
}
-const I2 = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
-class yc {
+const S2 = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
+class _c {
/**
* The name of the plugin.
*
@@ -47659,10 +47659,10 @@ class yc {
* Creates a copy of this plugin.
*/
clone() {
- return new yc(this.name);
+ return new _c(this.name);
}
}
-class Lh extends yc {
+class kh extends _c {
/**
* The block number to treat these values as valid from.
*
@@ -47709,10 +47709,10 @@ class Lh extends yc {
s("txBase", 21e3), s("txCreate", 32e3), s("txDataZero", 4), s("txDataNonzero", 16), s("txAccessListStorageKey", 1900), s("txAccessListAddress", 2400), Ye(this, n);
}
clone() {
- return new Lh(this.effectiveBlock, this);
+ return new kh(this.effectiveBlock, this);
}
}
-class Ph extends yc {
+class Uh extends _c {
/**
* The ENS Registrty Contract address.
*/
@@ -47728,15 +47728,15 @@ class Ph extends yc {
*/
constructor(e, t) {
super("org.ethers.plugins.network.Ens"), Ye(this, {
- address: e || I2,
+ address: e || S2,
targetNetwork: t ?? 1
});
}
clone() {
- return new Ph(this.address, this.targetNetwork);
+ return new Uh(this.address, this.targetNetwork);
}
}
-class S2 extends yc {
+class M2 extends _c {
#e;
#t;
/**
@@ -47763,8 +47763,8 @@ class S2 extends yc {
return this;
}
}
-const rd = /* @__PURE__ */ new Map();
-class ni {
+const od = /* @__PURE__ */ new Map();
+class ii {
#e;
#t;
#n;
@@ -47871,7 +47871,7 @@ class ni {
* Create a copy of this Network.
*/
clone() {
- const e = new ni(this.name, this.chainId);
+ const e = new ii(this.name, this.chainId);
return this.plugins.forEach((t) => {
e.attachPlugin(t.clone());
}), e;
@@ -47883,7 +47883,7 @@ class ni {
* values.
*/
computeIntrinsicGas(e) {
- const t = this.getPlugin("org.ethers.plugins.network.GasCost") || new Lh();
+ const t = this.getPlugin("org.ethers.plugins.network.GasCost") || new kh();
let n = t.txBase;
if (e.to == null && (n += t.txCreate), e.data)
for (let s = 2; s < e.data.length; s += 2)
@@ -47899,22 +47899,22 @@ class ni {
* Returns a new Network for the %%network%% name or chainId.
*/
static from(e) {
- if (M2(), e == null)
- return ni.from("mainnet");
+ if (B2(), e == null)
+ return ii.from("mainnet");
if (typeof e == "number" && (e = BigInt(e)), typeof e == "string" || typeof e == "bigint") {
- const t = rd.get(e);
+ const t = od.get(e);
if (t)
return t();
if (typeof e == "bigint")
- return new ni("unknown", e);
+ return new ii("unknown", e);
V(!1, "unknown network", "network", e);
}
if (typeof e.clone == "function")
return e.clone();
if (typeof e == "object") {
V(typeof e.name == "string" && typeof e.chainId == "number", "invalid network object name or chainId", "network", e);
- const t = new ni(e.name, e.chainId);
- return (e.ensAddress || e.ensNetwork != null) && t.attachPlugin(new Ph(e.ensAddress, e.ensNetwork)), t;
+ const t = new ii(e.name, e.chainId);
+ return (e.ensAddress || e.ensNetwork != null) && t.attachPlugin(new Uh(e.ensAddress, e.ensNetwork)), t;
}
V(!1, "invalid network", "network", e);
}
@@ -47924,11 +47924,11 @@ class ni {
*/
static register(e, t) {
typeof e == "number" && (e = BigInt(e));
- const n = rd.get(e);
- n && V(!1, `conflicting network for ${JSON.stringify(n.name)}`, "nameOrChainId", e), rd.set(e, t);
+ const n = od.get(e);
+ n && V(!1, `conflicting network for ${JSON.stringify(n.name)}`, "nameOrChainId", e), od.set(e, t);
}
}
-function t0(i, e) {
+function i0(i, e) {
const t = String(i);
if (!t.match(/^[0-9.]+$/))
throw new Error(`invalid gwei value: ${i}`);
@@ -47943,8 +47943,8 @@ function t0(i, e) {
}
return BigInt(n[0] + n[1]);
}
-function n0(i) {
- return new S2(i, async (e, t, n) => {
+function s0(i) {
+ return new M2(i, async (e, t, n) => {
n.setHeader("User-Agent", "ethers");
let s;
try {
@@ -47956,28 +47956,28 @@ function n0(i) {
const o = s.bodyJson.standard;
return {
gasPrice: a.gasPrice,
- maxFeePerGas: t0(o.maxFee, 9),
- maxPriorityFeePerGas: t0(o.maxPriorityFee, 9)
+ maxFeePerGas: i0(o.maxFee, 9),
+ maxPriorityFeePerGas: i0(o.maxPriorityFee, 9)
};
} catch (r) {
ge(!1, `error encountered with polygon gas station (${JSON.stringify(n.url)})`, "SERVER_ERROR", { request: n, response: s, error: r });
}
});
}
-let i0 = !1;
-function M2() {
- if (i0)
+let r0 = !1;
+function B2() {
+ if (r0)
return;
- i0 = !0;
+ r0 = !0;
function i(e, t, n) {
const s = function() {
- const r = new ni(e, t);
- return n.ensNetwork != null && r.attachPlugin(new Ph(null, n.ensNetwork)), r.attachPlugin(new Lh()), (n.plugins || []).forEach((a) => {
+ const r = new ii(e, t);
+ return n.ensNetwork != null && r.attachPlugin(new Uh(null, n.ensNetwork)), r.attachPlugin(new kh()), (n.plugins || []).forEach((a) => {
r.attachPlugin(a);
}), r;
};
- ni.register(e, s), ni.register(t, s), n.altNames && n.altNames.forEach((r) => {
- ni.register(r, s);
+ ii.register(e, s), ii.register(t, s), n.altNames && n.altNames.forEach((r) => {
+ ii.register(r, s);
});
}
i("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }), i("ropsten", 3, { ensNetwork: 3 }), i("rinkeby", 4, { ensNetwork: 4 }), i("goerli", 5, { ensNetwork: 5 }), i("kovan", 42, { ensNetwork: 42 }), i("sepolia", 11155111, { ensNetwork: 11155111 }), i("holesky", 17e3, { ensNetwork: 17e3 }), i("classic", 61, {}), i("classicKotti", 6, {}), i("arbitrum", 42161, {
@@ -47985,22 +47985,22 @@ function M2() {
}), i("arbitrum-goerli", 421613, {}), i("arbitrum-sepolia", 421614, {}), i("base", 8453, { ensNetwork: 1 }), i("base-goerli", 84531, {}), i("base-sepolia", 84532, {}), i("bnb", 56, { ensNetwork: 1 }), i("bnbt", 97, {}), i("filecoin", 314, {}), i("filecoin-calibration", 314159, {}), i("linea", 59144, { ensNetwork: 1 }), i("linea-goerli", 59140, {}), i("linea-sepolia", 59141, {}), i("matic", 137, {
ensNetwork: 1,
plugins: [
- n0("https://gasstation.polygon.technology/v2")
+ s0("https://gasstation.polygon.technology/v2")
]
}), i("matic-amoy", 80002, {}), i("matic-mumbai", 80001, {
altNames: ["maticMumbai", "maticmum"],
plugins: [
- n0("https://gasstation-testnet.polygon.technology/v2")
+ s0("https://gasstation-testnet.polygon.technology/v2")
]
}), i("optimism", 10, {
ensNetwork: 1,
plugins: []
}), i("optimism-goerli", 420, {}), i("optimism-sepolia", 11155420, {}), i("xdai", 100, { ensNetwork: 1 });
}
-function Sf(i) {
+function Bf(i) {
return JSON.parse(JSON.stringify(i));
}
-class B2 {
+class T2 {
#e;
#t;
#n;
@@ -48054,7 +48054,7 @@ class B2 {
this.start();
}
}
-class Np {
+class Lp {
#e;
#t;
#n;
@@ -48085,7 +48085,7 @@ class Np {
this.start();
}
}
-class T2 extends Np {
+class R2 extends Lp {
#e;
#t;
constructor(e, t) {
@@ -48099,16 +48099,16 @@ class T2 extends Np {
n != null && (this.#t === -2 ? this.#t = n.number : n.number > this.#t && (t.emit(this.#e, n.number), this.#t = n.number));
}
}
-class R2 extends Np {
+class F2 extends Lp {
#e;
constructor(e, t) {
- super(e), this.#e = Sf(t);
+ super(e), this.#e = Bf(t);
}
async _poll(e, t) {
throw new Error("@TODO");
}
}
-class F2 extends Np {
+class N2 extends Lp {
#e;
/**
* Create a new **PollingTransactionSubscriber** attached to
@@ -48122,7 +48122,7 @@ class F2 extends Np {
n && t.emit(this.#e, n);
}
}
-class Dp {
+class Pp {
#e;
#t;
#n;
@@ -48135,12 +48135,12 @@ class Dp {
* %%provider%%, listening for %%filter%%.
*/
constructor(e, t) {
- this.#e = e, this.#t = Sf(t), this.#n = this.#a.bind(this), this.#i = !1, this.#s = -2;
+ this.#e = e, this.#t = Bf(t), this.#n = this.#a.bind(this), this.#i = !1, this.#s = -2;
}
async #a(e) {
if (this.#s === -2)
return;
- const t = Sf(this.#t);
+ const t = Bf(this.#t);
t.fromBlock = this.#s + 1, t.toBlock = e;
const n = await this.#e.getLogs(t);
if (n.length === 0) {
@@ -48165,11 +48165,11 @@ class Dp {
this.start();
}
}
-const N2 = BigInt(2), D2 = 10;
-function wl(i) {
+const D2 = BigInt(2), L2 = 10;
+function vl(i) {
return i && typeof i.then == "function";
}
-function Fl(i, e) {
+function Dl(i, e) {
return i + ":" + JSON.stringify(e, (t, n) => {
if (n == null)
return "null";
@@ -48184,7 +48184,7 @@ function Fl(i, e) {
return n;
});
}
-class zE {
+class VE {
/**
* The name fof the event.
*/
@@ -48204,13 +48204,13 @@ class zE {
resume() {
}
}
-function L2(i) {
+function P2(i) {
return JSON.parse(JSON.stringify(i));
}
-function Mf(i) {
+function Tf(i) {
return i = Array.from(new Set(i).values()), i.sort(), i;
}
-async function ad(i, e) {
+async function cd(i, e) {
if (i == null)
throw new Error("invalid event");
if (Array.isArray(i) && (i = { topics: i }), typeof i == "string")
@@ -48226,36 +48226,36 @@ async function ad(i, e) {
}
if (Ut(i, 32)) {
const t = i.toLowerCase();
- return { type: "transaction", tag: Fl("tx", { hash: t }), hash: t };
+ return { type: "transaction", tag: Dl("tx", { hash: t }), hash: t };
}
if (i.orphan) {
const t = i;
- return { type: "orphan", tag: Fl("orphan", t), filter: L2(t) };
+ return { type: "orphan", tag: Dl("orphan", t), filter: P2(t) };
}
if (i.address || i.topics) {
const t = i, n = {
- topics: (t.topics || []).map((s) => s == null ? null : Array.isArray(s) ? Mf(s.map((r) => r.toLowerCase())) : s.toLowerCase())
+ topics: (t.topics || []).map((s) => s == null ? null : Array.isArray(s) ? Tf(s.map((r) => r.toLowerCase())) : s.toLowerCase())
};
if (t.address) {
const s = [], r = [], a = (o) => {
Ut(o) ? s.push(o) : r.push((async () => {
- s.push(await Hn(o, e));
+ s.push(await zn(o, e));
})());
};
- Array.isArray(t.address) ? t.address.forEach(a) : a(t.address), r.length && await Promise.all(r), n.address = Mf(s.map((o) => o.toLowerCase()));
+ Array.isArray(t.address) ? t.address.forEach(a) : a(t.address), r.length && await Promise.all(r), n.address = Tf(s.map((o) => o.toLowerCase()));
}
- return { filter: n, tag: Fl("event", n), type: "event" };
+ return { filter: n, tag: Dl("event", n), type: "event" };
}
V(!1, "unknown ProviderEvent", "event", i);
}
-function od() {
+function ld() {
return (/* @__PURE__ */ new Date()).getTime();
}
-const P2 = {
+const k2 = {
cacheTimeout: 250,
pollingInterval: 4e3
};
-class k2 {
+class U2 {
#e;
#t;
// null=unpaused, true=paused+dropWhilePaused, false=paused
@@ -48276,10 +48276,10 @@ class k2 {
* [[Network]] if necessary.
*/
constructor(e, t) {
- if (this.#A = Object.assign({}, P2, t || {}), e === "any")
+ if (this.#A = Object.assign({}, k2, t || {}), e === "any")
this.#a = !0, this.#s = null;
else if (e) {
- const n = ni.from(e);
+ const n = ii.from(e);
this.#a = !1, this.#s = Promise.resolve(n), setTimeout(() => {
this.emit("network", n, null);
}, 0);
@@ -48332,7 +48332,7 @@ class k2 {
const t = this.#A.cacheTimeout;
if (t < 0)
return await this._perform(e);
- const n = Fl(e.method, e);
+ const n = Dl(e.method, e);
let s = this.#r.get(n);
return s || (s = this._perform(e), this.#r.set(n, s), setTimeout(() => {
this.#r.get(n) === s && this.#r.delete(n);
@@ -48346,7 +48346,7 @@ class k2 {
return null;
const s = e.to.toLowerCase(), r = t.toLowerCase(), a = [];
for (let o = 0; o < n.length; o++) {
- const c = n[o], l = c.replace("{sender}", s).replace("{data}", r), h = new Gi(l);
+ const c = n[o], l = c.replace("{sender}", s).replace("{data}", r), h = new Hi(l);
c.indexOf("{data}") === -1 && (h.body = { data: r, sender: s }), this.emit("debug", { action: "sendCcipReadFetchRequest", request: h, index: o, urls: n });
let u = "unknown error", d;
try {
@@ -48376,7 +48376,7 @@ class k2 {
* sub-class of [[Block]].
*/
_wrapBlock(e, t) {
- return new n2(y2(e), this);
+ return new i2(_2(e), this);
}
/**
* Provides the opportunity for a sub-class to wrap a log before
@@ -48384,7 +48384,7 @@ class k2 {
* sub-class of [[Log]].
*/
_wrapLog(e, t) {
- return new xc(b2(e), this);
+ return new bc(E2(e), this);
}
/**
* Provides the opportunity for a sub-class to wrap a transaction
@@ -48392,7 +48392,7 @@ class k2 {
* alternate sub-class of [[TransactionReceipt]].
*/
_wrapTransactionReceipt(e, t) {
- return new TE(C2(e), this);
+ return new RE(I2(e), this);
}
/**
* Provides the opportunity for a sub-class to wrap a transaction
@@ -48400,7 +48400,7 @@ class k2 {
* alternate sub-class of [[TransactionResponse]].
*/
_wrapTransactionResponse(e, t) {
- return new bc(HE(e), this);
+ return new Ec(zE(e), this);
}
/**
* Resolves to the Network, forcing a network detection using whatever
@@ -48436,7 +48436,7 @@ class k2 {
* address.
*/
_getAddress(e) {
- return Hn(e, this);
+ return zn(e, this);
}
/**
* Returns or resolves to a valid block tag for %%blockTag%%, resolving
@@ -48455,9 +48455,9 @@ class k2 {
return e;
}
if (Ut(e))
- return Ut(e, 32) ? e : wi(e);
+ return Ut(e, 32) ? e : vi(e);
if (typeof e == "bigint" && (e = ft(e, "blockTag")), typeof e == "number")
- return e >= 0 ? wi(e) : this.#o >= 0 ? wi(this.#o + e) : this.getBlockNumber().then((t) => wi(t + e));
+ return e >= 0 ? vi(e) : this.#o >= 0 ? vi(this.#o + e) : this.getBlockNumber().then((t) => vi(t + e));
V(!1, "invalid blockTag", "blockTag", e);
}
/**
@@ -48466,7 +48466,7 @@ class k2 {
* filter.
*/
_getFilter(e) {
- const t = (e.topics || []).map((c) => c == null ? null : Array.isArray(c) ? Mf(c.map((l) => l.toLowerCase())) : c.toLowerCase()), n = "blockHash" in e ? e.blockHash : void 0, s = (c, l, h) => {
+ const t = (e.topics || []).map((c) => c == null ? null : Array.isArray(c) ? Tf(c.map((l) => l.toLowerCase())) : c.toLowerCase()), n = "blockHash" in e ? e.blockHash : void 0, s = (c, l, h) => {
let u;
switch (c.length) {
case 0:
@@ -48500,17 +48500,17 @@ class k2 {
* transaction.
*/
_getTransactionRequest(e) {
- const t = ch(e), n = [];
+ const t = hh(e), n = [];
if (["to", "from"].forEach((s) => {
if (t[s] == null)
return;
- const r = Hn(t[s], this);
- wl(r) ? n.push((async function() {
+ const r = zn(t[s], this);
+ vl(r) ? n.push((async function() {
t[s] = await r;
})()) : t[s] = r;
}), t.blockTag != null) {
const s = this._getBlockTag(t.blockTag);
- wl(s) ? n.push((async function() {
+ vl(s) ? n.push((async function() {
t.blockTag = await s;
})()) : t.blockTag = s;
}
@@ -48541,7 +48541,7 @@ class k2 {
}
async getFeeData() {
const e = await this.getNetwork(), t = async () => {
- const { _block: s, gasPrice: r, priorityFee: a } = await Un({
+ const { _block: s, gasPrice: r, priorityFee: a } = await On({
_block: this.#x("latest", !1),
gasPrice: (async () => {
try {
@@ -48562,35 +48562,35 @@ class k2 {
});
let o = null, c = null;
const l = this._wrapBlock(s, e);
- return l && l.baseFeePerGas && (c = a ?? BigInt("1000000000"), o = l.baseFeePerGas * N2 + c), new Ym(r, o, c);
+ return l && l.baseFeePerGas && (c = a ?? BigInt("1000000000"), o = l.baseFeePerGas * D2 + c), new Zm(r, o, c);
}, n = e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");
if (n) {
- const s = new Gi(n.url), r = await n.processFunc(t, this, s);
- return new Ym(r.gasPrice, r.maxFeePerGas, r.maxPriorityFeePerGas);
+ const s = new Hi(n.url), r = await n.processFunc(t, this, s);
+ return new Zm(r.gasPrice, r.maxFeePerGas, r.maxPriorityFeePerGas);
}
return await t();
}
async estimateGas(e) {
let t = this._getTransactionRequest(e);
- return wl(t) && (t = await t), De(await this.#c({
+ return vl(t) && (t = await t), De(await this.#c({
method: "estimateGas",
transaction: t
}), "%response");
}
async #h(e, t, n) {
- ge(n < D2, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
+ ge(n < L2, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
reason: "TOO_MANY_REDIRECTS",
transaction: Object.assign({}, e, { blockTag: t, enableCcipRead: !0 })
});
- const s = ch(e);
+ const s = hh(e);
try {
return Ie(await this._perform({ method: "call", transaction: s, blockTag: t }));
} catch (r) {
- if (!this.disableCcipRead && pp(r) && r.data && n >= 0 && t === "latest" && s.to != null && Kt(r.data, 0, 4) === "0x556f1830") {
- const a = r.data, o = await Hn(s.to, this);
+ if (!this.disableCcipRead && gp(r) && r.data && n >= 0 && t === "latest" && s.to != null && Kt(r.data, 0, 4) === "0x556f1830") {
+ const a = r.data, o = await zn(s.to, this);
let c;
try {
- c = H2(Kt(r.data, 4));
+ c = z2(Kt(r.data, 4));
} catch (u) {
ge(!1, u.message, "OFFCHAIN_FAULT", {
reason: "BAD_DATA",
@@ -48618,7 +48618,7 @@ class k2 {
});
const h = {
to: o,
- data: Ht([c.selector, G2([l, c.extraData])])
+ data: Ht([c.selector, H2([l, c.extraData])])
};
this.emit("debug", { action: "sendCcipReadCall", transaction: h });
try {
@@ -48632,14 +48632,14 @@ class k2 {
}
}
async #u(e) {
- const { value: t } = await Un({
+ const { value: t } = await On({
network: this.getNetwork(),
value: e
});
return t;
}
async call(e) {
- const { tx: t, blockTag: n } = await Un({
+ const { tx: t, blockTag: n } = await On({
tx: this._getTransactionRequest(e),
blockTag: this._getBlockTag(e.blockTag)
});
@@ -48665,14 +48665,14 @@ class k2 {
}
// Write
async broadcastTransaction(e) {
- const { blockNumber: t, hash: n, network: s } = await Un({
+ const { blockNumber: t, hash: n, network: s } = await On({
blockNumber: this.getBlockNumber(),
hash: this._perform({
method: "broadcastTransaction",
signedTransaction: e
}),
network: this.getNetwork()
- }), r = _i.from(e);
+ }), r = wi.from(e);
if (r.hash !== n)
throw new Error("@TODO: the returned hash did not match");
return this._wrapTransactionResponse(r, s).replaceableTransaction(t);
@@ -48693,21 +48693,21 @@ class k2 {
}
// Queries
async getBlock(e, t) {
- const { network: n, params: s } = await Un({
+ const { network: n, params: s } = await On({
network: this.getNetwork(),
params: this.#x(e, !!t)
});
return s == null ? null : this._wrapBlock(s, n);
}
async getTransaction(e) {
- const { network: t, params: n } = await Un({
+ const { network: t, params: n } = await On({
network: this.getNetwork(),
params: this.#c({ method: "getTransaction", hash: e })
});
return n == null ? null : this._wrapTransactionResponse(n, t);
}
async getTransactionReceipt(e) {
- const { network: t, params: n } = await Un({
+ const { network: t, params: n } = await On({
network: this.getNetwork(),
params: this.#c({ method: "getTransactionReceipt", hash: e })
});
@@ -48722,7 +48722,7 @@ class k2 {
return this._wrapTransactionReceipt(n, t);
}
async getTransactionResult(e) {
- const { result: t } = await Un({
+ const { result: t } = await On({
network: this.getNetwork(),
result: this.#c({ method: "getTransactionResult", hash: e })
});
@@ -48731,8 +48731,8 @@ class k2 {
// Bloom-filter Queries
async getLogs(e) {
let t = this._getFilter(e);
- wl(t) && (t = await t);
- const { network: n, params: s } = await Un({
+ vl(t) && (t = await t);
+ const { network: n, params: s } = await On({
network: this.getNetwork(),
params: this.#c({ method: "getLogs", filter: t })
});
@@ -48745,7 +48745,7 @@ class k2 {
});
}
async getResolver(e) {
- return await Fa.fromName(this, e);
+ return await Na.fromName(this, e);
}
async getAvatar(e) {
const t = await this.getResolver(e);
@@ -48757,12 +48757,12 @@ class k2 {
}
async lookupAddress(e) {
e = Mt(e);
- const t = vf(e.substring(2).toLowerCase() + ".addr.reverse");
+ const t = If(e.substring(2).toLowerCase() + ".addr.reverse");
try {
- const n = await Fa.getEnsAddress(this), r = await new Mr(n, [
+ const n = await Na.getEnsAddress(this), r = await new Mr(n, [
"function resolver(bytes32) view returns (address)"
], this).resolver(t);
- if (r == null || r === sc)
+ if (r == null || r === rc)
return null;
const o = await new Mr(r, [
"function name(bytes32) view returns (string)"
@@ -48825,7 +48825,7 @@ class k2 {
this.#l.set(n, { timer: null, func: s, time: t });
else {
const r = setTimeout(s, t);
- this.#l.set(n, { timer: r, func: s, time: od() });
+ this.#l.set(n, { timer: r, func: s, time: ld() });
}
return n;
}
@@ -48845,20 +48845,20 @@ class k2 {
case "debug":
case "error":
case "network":
- return new zE(e.type);
+ return new VE(e.type);
case "block": {
- const t = new B2(this);
+ const t = new T2(this);
return t.pollingInterval = this.pollingInterval, t;
}
case "safe":
case "finalized":
- return new T2(this, e.type);
+ return new R2(this, e.type);
case "event":
- return new Dp(this, e.filter);
+ return new Pp(this, e.filter);
case "transaction":
- return new F2(this, e.hash);
+ return new N2(this, e.hash);
case "orphan":
- return new R2(this, e.filter);
+ return new F2(this, e.filter);
}
throw new Error(`unsupported event: ${e.type}`);
}
@@ -48879,11 +48879,11 @@ class k2 {
}
}
async #g(e, t) {
- let n = await ad(e, this);
- return n.type === "event" && t && t.length > 0 && t[0].removed === !0 && (n = await ad({ orphan: "drop-log", log: t[0] }, this)), this.#e.get(n.tag) || null;
+ let n = await cd(e, this);
+ return n.type === "event" && t && t.length > 0 && t[0].removed === !0 && (n = await cd({ orphan: "drop-log", log: t[0] }, this)), this.#e.get(n.tag) || null;
}
async #m(e) {
- const t = await ad(e, this), n = t.tag;
+ const t = await cd(e, this), n = t.tag;
let s = this.#e.get(n);
return s || (s = { subscriber: this._getSubscriber(t), tag: n, addressableMap: /* @__PURE__ */ new WeakMap(), nameMap: /* @__PURE__ */ new Map(), started: !1, listeners: [] }, this.#e.set(n, s)), s;
}
@@ -48901,7 +48901,7 @@ class k2 {
return !1;
const s = n.listeners.length;
return n.listeners = n.listeners.filter(({ listener: r, once: a }) => {
- const o = new lb(this, a ? null : r, e);
+ const o = new hb(this, a ? null : r, e);
try {
r.call(this, ...t, o);
} catch {
@@ -49010,7 +49010,7 @@ class k2 {
}
this._forEachSubscriber((t) => t.pause(e)), this.#n = !!e;
for (const t of this.#l.values())
- t.timer && clearTimeout(t.timer), t.time = od() - t.time;
+ t.timer && clearTimeout(t.timer), t.time = ld() - t.time;
}
/**
* Resume the provider.
@@ -49020,21 +49020,21 @@ class k2 {
this._forEachSubscriber((e) => e.resume()), this.#n = null;
for (const e of this.#l.values()) {
let t = e.time;
- t < 0 && (t = 0), e.time = od(), setTimeout(e.func, t);
+ t < 0 && (t = 0), e.time = ld(), setTimeout(e.func, t);
}
}
}
}
-function U2(i, e) {
+function O2(i, e) {
try {
- const t = Bf(i, e);
+ const t = Rf(i, e);
if (t)
- return th(t);
+ return ih(t);
} catch {
}
return null;
}
-function Bf(i, e) {
+function Rf(i, e) {
if (i === "0x")
return null;
try {
@@ -49044,33 +49044,33 @@ function Bf(i, e) {
}
return null;
}
-function s0(i) {
+function a0(i) {
const e = rn(i);
if (e.length > 32)
throw new Error("internal; should not happen");
const t = new Uint8Array(32);
return t.set(e, 32 - e.length), t;
}
-function O2(i) {
+function Q2(i) {
if (i.length % 32 === 0)
return i;
const e = new Uint8Array(Math.ceil(i.length / 32) * 32);
return e.set(i), e;
}
-const Q2 = new Uint8Array([]);
-function G2(i) {
+const G2 = new Uint8Array([]);
+function H2(i) {
const e = [];
let t = 0;
for (let n = 0; n < i.length; n++)
- e.push(Q2), t += 32;
+ e.push(G2), t += 32;
for (let n = 0; n < i.length; n++) {
const s = dt(i[n]);
- e[n] = s0(t), e.push(s0(s.length)), e.push(O2(s)), t += 32 + Math.ceil(s.length / 32) * 32;
+ e[n] = a0(t), e.push(a0(s.length)), e.push(Q2(s)), t += 32 + Math.ceil(s.length / 32) * 32;
}
return Ht(e);
}
-const r0 = "0x0000000000000000000000000000000000000000000000000000000000000000";
-function H2(i) {
+const o0 = "0x0000000000000000000000000000000000000000000000000000000000000000";
+function z2(i) {
const e = {
sender: "",
urls: [],
@@ -49079,17 +49079,17 @@ function H2(i) {
extraData: "",
errorArgs: []
};
- ge(Ba(i) >= 160, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {
+ ge(Ta(i) >= 160, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {
reason: "insufficient OffchainLookup data"
});
const t = Kt(i, 0, 32);
- ge(Kt(t, 0, 12) === Kt(r0, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {
+ ge(Kt(t, 0, 12) === Kt(o0, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {
reason: "corrupt OffchainLookup sender"
}), e.sender = Kt(t, 12);
try {
const n = [], s = ft(Kt(i, 32, 64)), r = ft(Kt(i, s, s + 32)), a = Kt(i, s + 32);
for (let o = 0; o < r; o++) {
- const c = U2(a, o * 32);
+ const c = O2(a, o * 32);
if (c == null)
throw new Error("abort");
n.push(c);
@@ -49101,7 +49101,7 @@ function H2(i) {
});
}
try {
- const n = Bf(i, 64);
+ const n = Rf(i, 64);
if (n == null)
throw new Error("abort");
e.calldata = n;
@@ -49110,11 +49110,11 @@ function H2(i) {
reason: "corrupt OffchainLookup calldata"
});
}
- ge(Kt(i, 100, 128) === Kt(r0, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {
+ ge(Kt(i, 100, 128) === Kt(o0, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {
reason: "corrupt OffchainLookup callbaackSelector"
}), e.selector = Kt(i, 96, 100);
try {
- const n = Bf(i, 128);
+ const n = Rf(i, 128);
if (n == null)
throw new Error("abort");
e.extraData = n;
@@ -49130,19 +49130,19 @@ function hr(i, e) {
return i.provider;
ge(!1, "missing provider", "UNSUPPORTED_OPERATION", { operation: e });
}
-async function a0(i, e) {
- let t = ch(e);
- if (t.to != null && (t.to = Hn(t.to, i)), t.from != null) {
+async function c0(i, e) {
+ let t = hh(e);
+ if (t.to != null && (t.to = zn(t.to, i)), t.from != null) {
const n = t.from;
t.from = Promise.all([
i.getAddress(),
- Hn(n, i)
+ zn(n, i)
]).then(([s, r]) => (V(s.toLowerCase() === r.toLowerCase(), "transaction from mismatch", "tx.from", r), s));
} else
t.from = i.getAddress();
- return await Un(t);
+ return await On(t);
}
-class z2 {
+class V2 {
/**
* The provider this signer is connected to.
*/
@@ -49157,10 +49157,10 @@ class z2 {
return hr(this, "getTransactionCount").getTransactionCount(await this.getAddress(), e);
}
async populateCall(e) {
- return await a0(this, e);
+ return await c0(this, e);
}
async populateTransaction(e) {
- const t = hr(this, "populateTransaction"), n = await a0(this, e);
+ const t = hr(this, "populateTransaction"), n = await c0(this, e);
n.nonce == null && (n.nonce = await this.getNonce("pending")), n.gasLimit == null && (n.gasLimit = await this.estimateGas(n));
const s = await this.provider.getNetwork();
if (n.chainId != null) {
@@ -49192,7 +49192,7 @@ class z2 {
});
else (n.type === 2 || n.type === 3 || n.type === 4) && (n.maxFeePerGas == null && (n.maxFeePerGas = a.maxFeePerGas), n.maxPriorityFeePerGas == null && (n.maxPriorityFeePerGas = a.maxPriorityFeePerGas));
}
- return await Un(n);
+ return await On(n);
}
async populateAuthorization(e) {
const t = Object.assign({}, e);
@@ -49210,7 +49210,7 @@ class z2 {
async sendTransaction(e) {
const t = hr(this, "sendTransaction"), n = await this.populateTransaction(e);
delete n.from;
- const s = _i.from(n);
+ const s = wi.from(n);
return await t.broadcastTransaction(await this.signTransaction(s));
}
// @TODO: in v7 move this to be abstract
@@ -49218,10 +49218,10 @@ class z2 {
ge(!1, "authorization not implemented for this signer", "UNSUPPORTED_OPERATION", { operation: "authorize" });
}
}
-function V2(i) {
+function W2(i) {
return JSON.parse(JSON.stringify(i));
}
-class VE {
+class WE {
#e;
#t;
#n;
@@ -49299,17 +49299,17 @@ class VE {
this.start();
}
}
-class W2 extends VE {
+class q2 extends WE {
#e;
/**
* Creates a new **FilterIdEventSubscriber** attached to %%provider%%
* listening for %%filter%%.
*/
constructor(e, t) {
- super(e), this.#e = V2(t);
+ super(e), this.#e = W2(t);
}
_recover(e) {
- return new Dp(e, this.#e);
+ return new Pp(e, this.#e);
}
async _subscribe(e) {
return await e.send("eth_newFilter", [this.#e]);
@@ -49319,7 +49319,7 @@ class W2 extends VE {
e.emit(this.#e, e._wrapLog(n, e._network));
}
}
-class q2 extends VE {
+class K2 extends WE {
async _subscribe(e) {
return await e.send("eth_newPendingTransactionFilter", []);
}
@@ -49328,17 +49328,17 @@ class q2 extends VE {
e.emit("pending", n);
}
}
-const K2 = "bigint,boolean,function,number,string,symbol".split(/,/g);
-function Nl(i) {
- if (i == null || K2.indexOf(typeof i) >= 0 || typeof i.getAddress == "function")
+const j2 = "bigint,boolean,function,number,string,symbol".split(/,/g);
+function Ll(i) {
+ if (i == null || j2.indexOf(typeof i) >= 0 || typeof i.getAddress == "function")
return i;
if (Array.isArray(i))
- return i.map(Nl);
+ return i.map(Ll);
if (typeof i == "object")
return Object.keys(i).reduce((e, t) => (e[t] = i[t], e), {});
throw new Error(`should not happen: ${i} (${typeof i})`);
}
-function j2(i) {
+function X2(i) {
return new Promise((e) => {
setTimeout(e, i);
});
@@ -49346,10 +49346,10 @@ function j2(i) {
function ua(i) {
return i && i.toLowerCase();
}
-function o0(i) {
+function l0(i) {
return i && typeof i.pollingInterval == "number";
}
-const WE = {
+const qE = {
polling: !1,
staticNetwork: null,
batchStallTime: 10,
@@ -49358,7 +49358,7 @@ const WE = {
cacheTimeout: 250,
pollingInterval: 4e3
};
-class cd extends z2 {
+class hd extends V2 {
address;
constructor(e, t) {
super(e), t = Mt(t), Ye(this, { address: t });
@@ -49378,11 +49378,11 @@ class cd extends z2 {
// Returns just the hash of the transaction after sent, which is what
// the bare JSON-RPC API does;
async sendUncheckedTransaction(e) {
- const t = Nl(e), n = [];
+ const t = Ll(e), n = [];
if (t.from) {
const r = t.from;
n.push((async () => {
- const a = await Hn(r, this.provider);
+ const a = await zn(r, this.provider);
V(a != null && a.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", e), t.from = a;
})());
} else
@@ -49392,7 +49392,7 @@ class cd extends z2 {
})()), t.to != null) {
const r = t.to;
n.push((async () => {
- t.to = await Hn(r, this.provider);
+ t.to = await zn(r, this.provider);
})());
}
n.length && await Promise.all(n);
@@ -49430,9 +49430,9 @@ class cd extends z2 {
});
}
async signTransaction(e) {
- const t = Nl(e);
+ const t = Ll(e);
if (t.from) {
- const s = await Hn(t.from, this.provider);
+ const s = await zn(t.from, this.provider);
V(s != null && s.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", e), t.from = s;
} else
t.from = this.address;
@@ -49447,13 +49447,13 @@ class cd extends z2 {
]);
}
async signTypedData(e, t, n) {
- const s = Nl(n), r = await $n.resolveNames(e, t, s, async (a) => {
- const o = await Hn(a);
+ const s = Ll(n), r = await ei.resolveNames(e, t, s, async (a) => {
+ const o = await zn(a);
return V(o != null, "TypedData does not support null address", "value", a), o;
});
return await this.provider.send("eth_signTypedData_v4", [
this.address.toLowerCase(),
- JSON.stringify($n.getPayload(r.domain, t, r.value))
+ JSON.stringify(ei.getPayload(r.domain, t, r.value))
]);
}
async unlock(e) {
@@ -49472,7 +49472,7 @@ class cd extends z2 {
]);
}
}
-class X2 extends k2 {
+class Y2 extends U2 {
#e;
// The next ID to use for the JSON-RPC ID field
#t;
@@ -49532,7 +49532,7 @@ class X2 extends k2 {
}, e);
}
constructor(e, t) {
- super(e, t), this.#t = 1, this.#e = Object.assign({}, WE, t || {}), this.#n = [], this.#i = null, this.#a = null, this.#r = null;
+ super(e, t), this.#t = 1, this.#e = Object.assign({}, qE, t || {}), this.#n = [], this.#i = null, this.#a = null, this.#r = null;
{
let s = null;
const r = new Promise((a) => {
@@ -49541,7 +49541,7 @@ class X2 extends k2 {
this.#s = { promise: r, resolve: s };
}
const n = this._getOption("staticNetwork");
- typeof n == "boolean" ? (V(!n || e !== "any", "staticNetwork cannot be used on special network 'any'", "options", t), n && e != null && (this.#a = ni.from(e))) : n && (V(e == null || n.matches(e), "staticNetwork MUST match network object", "options", t), this.#a = n);
+ typeof n == "boolean" ? (V(!n || e !== "any", "staticNetwork cannot be used on special network 'any'", "options", t), n && e != null && (this.#a = ii.from(e))) : n && (V(e == null || n.matches(e), "staticNetwork MUST match network object", "options", t), this.#a = n);
}
/**
* Returns the value associated with the option %%key%%.
@@ -49594,7 +49594,7 @@ class X2 extends k2 {
return e;
return this.#r ? await this.#r : this.ready ? (this.#r = (async () => {
try {
- const t = ni.from(De(await this.send("eth_chainId", [])));
+ const t = ii.from(De(await this.send("eth_chainId", [])));
return this.#r = null, t;
} catch (t) {
throw this.#r = null, t;
@@ -49614,7 +49614,7 @@ class X2 extends k2 {
throw this.#r = null, this.emit("debug", { action: "receiveRpcError", error: s }), s;
}
if (this.emit("debug", { action: "receiveRpcResult", result: n }), "result" in n)
- return ni.from(De(n.result));
+ return ii.from(De(n.result));
throw this.getRpcError(t, n);
})(), await this.#r);
}
@@ -49633,7 +49633,7 @@ class X2 extends k2 {
} catch (e) {
if (this.destroyed)
break;
- console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"), this.emit("error", Gt("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error: e } })), await j2(1e3);
+ console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"), this.emit("error", Gt("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error: e } })), await X2(1e3);
}
this.#o();
})());
@@ -49654,7 +49654,7 @@ class X2 extends k2 {
* subscription management.
*/
_getSubscriber(e) {
- return e.type === "pending" ? new q2(this) : e.type === "event" ? this._getOption("polling") ? new Dp(this, e.filter) : new W2(this, e.filter) : e.type === "orphan" && e.filter.orphan === "drop-log" ? new zE("orphan") : super._getSubscriber(e);
+ return e.type === "pending" ? new K2(this) : e.type === "event" ? this._getOption("polling") ? new Pp(this, e.filter) : new q2(this, e.filter) : e.type === "orphan" && e.filter.orphan === "drop-log" ? new VE("orphan") : super._getSubscriber(e);
}
/**
* Returns true only if the [[_start]] has been called.
@@ -49673,18 +49673,18 @@ class X2 extends k2 {
if (e[n] == null)
return;
let s = n;
- n === "gasLimit" && (s = "gas"), t[s] = wi(De(e[n], `tx.${n}`));
+ n === "gasLimit" && (s = "gas"), t[s] = vi(De(e[n], `tx.${n}`));
}), ["from", "to", "data"].forEach((n) => {
e[n] != null && (t[n] = Ie(e[n]));
}), e.accessList && (t.accessList = Hr(e.accessList)), e.blobVersionedHashes && (t.blobVersionedHashes = e.blobVersionedHashes.map((n) => n.toLowerCase())), e.authorizationList && (t.authorizationList = e.authorizationList.map((n) => {
- const s = Yb(n);
+ const s = Jb(n);
return {
address: s.address,
- nonce: wi(s.nonce),
- chainId: wi(s.chainId),
- yParity: wi(s.signature.yParity),
- r: wi(s.signature.r),
- s: wi(s.signature.s)
+ nonce: vi(s.nonce),
+ chainId: vi(s.chainId),
+ yParity: vi(s.signature.yParity),
+ r: vi(s.signature.r),
+ s: vi(s.signature.s)
};
})), t;
}
@@ -49790,10 +49790,10 @@ class X2 extends k2 {
});
}
if (n === "eth_call" || n === "eth_estimateGas") {
- const o = Tf(s), c = za.getBuiltinCallException(n === "eth_call" ? "call" : "estimateGas", e.params[0], o ? o.data : null);
+ const o = Ff(s), c = Va.getBuiltinCallException(n === "eth_call" ? "call" : "estimateGas", e.params[0], o ? o.data : null);
return c.info = { error: s, payload: e }, c;
}
- const r = JSON.stringify(Y2(s));
+ const r = JSON.stringify(J2(s));
if (typeof s.message == "string" && s.message.match(/user denied|ethers-user-denied/i))
return Gt("user rejected action", "ACTION_REJECTED", {
action: {
@@ -49875,20 +49875,20 @@ class X2 extends k2 {
const s = await t;
if (e >= s.length)
throw new Error("no such account");
- return new cd(this, s[e]);
+ return new hd(this, s[e]);
}
- const { accounts: n } = await Un({
+ const { accounts: n } = await On({
network: this.getNetwork(),
accounts: t
});
e = Mt(e);
for (const s of n)
if (Mt(s) === e)
- return new cd(this, e);
+ return new hd(this, e);
throw new Error("invalid account");
}
async listAccounts() {
- return (await this.send("eth_accounts", [])).map((t) => new cd(this, t));
+ return (await this.send("eth_accounts", [])).map((t) => new hd(this, t));
}
destroy() {
this.#i && (clearTimeout(this.#i), this.#i = null);
@@ -49897,16 +49897,16 @@ class X2 extends k2 {
this.#n = [], super.destroy();
}
}
-class qE extends X2 {
+class KE extends Y2 {
#e;
constructor(e, t) {
super(e, t);
let n = this._getOption("pollingInterval");
- n == null && (n = WE.pollingInterval), this.#e = n;
+ n == null && (n = qE.pollingInterval), this.#e = n;
}
_getSubscriber(e) {
const t = super._getSubscriber(e);
- return o0(t) && (t.pollingInterval = this.#e), t;
+ return l0(t) && (t.pollingInterval = this.#e), t;
}
/**
* The polling interval (default: 4000 ms)
@@ -49918,14 +49918,14 @@ class qE extends X2 {
if (!Number.isInteger(e) || e < 0)
throw new Error("invalid interval");
this.#e = e, this._forEachSubscriber((t) => {
- o0(t) && (t.pollingInterval = this.#e);
+ l0(t) && (t.pollingInterval = this.#e);
});
}
}
-class KE extends qE {
+class jE extends KE {
#e;
constructor(e, t, n) {
- e == null && (e = "http://localhost:8545"), super(t, n), typeof e == "string" ? this.#e = new Gi(e) : this.#e = e.clone();
+ e == null && (e = "http://localhost:8545"), super(t, n), typeof e == "string" ? this.#e = new Hi(e) : this.#e = e.clone();
}
_getConnection() {
return this.#e.clone();
@@ -49942,14 +49942,14 @@ class KE extends qE {
return Array.isArray(s) || (s = [s]), s;
}
}
-function Tf(i) {
+function Ff(i) {
if (i == null)
return null;
if (typeof i.message == "string" && i.message.match(/revert/i) && Ut(i.data))
return { message: i.message, data: i.data };
if (typeof i == "object") {
for (const e in i) {
- const t = Tf(i[e]);
+ const t = Ff(i[e]);
if (t)
return t;
}
@@ -49957,28 +49957,28 @@ function Tf(i) {
}
if (typeof i == "string")
try {
- return Tf(JSON.parse(i));
+ return Ff(JSON.parse(i));
} catch {
}
return null;
}
-function Rf(i, e) {
+function Nf(i, e) {
if (i != null) {
if (typeof i.message == "string" && e.push(i.message), typeof i == "object")
for (const t in i)
- Rf(i[t], e);
+ Nf(i[t], e);
if (typeof i == "string")
try {
- return Rf(JSON.parse(i), e);
+ return Nf(JSON.parse(i), e);
} catch {
}
}
}
-function Y2(i) {
+function J2(i) {
const e = [];
- return Rf(i, e), e;
+ return Nf(i, e), e;
}
-class br extends qE {
+class br extends KE {
#e;
#t;
/**
@@ -50103,7 +50103,7 @@ class br extends qE {
});
}
}
-const jE = [
+const XE = [
// --- Registration ---
"function register() external returns (uint256 agentId)",
"function register(string agentURI) external returns (uint256 agentId)",
@@ -50137,42 +50137,42 @@ const jE = [
identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e",
reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713",
validationRegistry: "0x8004Cb1BF31DAf7788923b405b754f57acEB4272"
-}, Ln = {
+}, Pn = {
identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",
validationRegistry: ""
// not yet deployed on mainnet
-}, kh = {
+}, Oh = {
// Mainnets
- 1: Ln,
+ 1: Pn,
// Ethereum
- 10: Ln,
+ 10: Pn,
// Optimism
- 56: Ln,
+ 56: Pn,
// BSC
- 100: Ln,
+ 100: Pn,
// Gnosis
- 137: Ln,
+ 137: Pn,
// Polygon
- 250: Ln,
+ 250: Pn,
// Fantom
- 324: Ln,
+ 324: Pn,
// zkSync Era
- 1284: Ln,
+ 1284: Pn,
// Moonbeam
- 5e3: Ln,
+ 5e3: Pn,
// Mantle
- 8453: Ln,
+ 8453: Pn,
// Base
- 42161: Ln,
+ 42161: Pn,
// Arbitrum One
- 42220: Ln,
+ 42220: Pn,
// Celo
- 43114: Ln,
+ 43114: Pn,
// Avalanche
- 59144: Ln,
+ 59144: Pn,
// Linea
- 534352: Ln,
+ 534352: Pn,
// Scroll
// Testnets
97: ur,
@@ -50190,10 +50190,10 @@ const jE = [
43113: ur
// Avalanche Fuji
};
-function J2(i, e) {
+function Z2(i, e) {
return `eip155:${i}:${e}`;
}
-const XE = {
+const YE = {
// ── Mainnets ──────────────────────────────────────────────────────────
1: { name: "Ethereum", shortName: "ETH", currency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpcUrl: "https://ethereum-rpc.publicnode.com", explorer: "https://etherscan.io", testnet: !1 },
10: { name: "Optimism", shortName: "OP", currency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpcUrl: "https://mainnet.optimism.io", explorer: "https://optimistic.etherscan.io", testnet: !1 },
@@ -50219,27 +50219,27 @@ const XE = {
80002: { name: "Polygon Amoy", shortName: "Amoy", currency: { name: "POL", symbol: "POL", decimals: 18 }, rpcUrl: "https://rpc-amoy.polygon.technology", explorer: "https://amoy.polygonscan.com", testnet: !0 },
43113: { name: "Avalanche Fuji", shortName: "Fuji", currency: { name: "Avax", symbol: "AVAX", decimals: 18 }, rpcUrl: "https://api.avax-test.network/ext/bc/C/rpc", explorer: "https://testnet.snowtrace.io", testnet: !0 }
};
-function Z2(i, e) {
+function $2(i, e) {
if (e) return new br(e);
- const t = XE[i];
+ const t = YE[i];
if (!t) throw new Error(`No RPC configured for chainId ${i}`);
- return new KE(t.rpcUrl, i);
+ return new jE(t.rpcUrl, i);
}
-function $2(i, e) {
- const t = kh[i];
+function eP(i, e) {
+ const t = Oh[i];
if (!t || !t.identityRegistry)
throw new Error(`No Identity Registry for chainId ${i}`);
- const n = Z2(i, e);
- return new Mr(t.identityRegistry, jE, n);
+ const n = $2(i, e);
+ return new Mr(t.identityRegistry, XE, n);
}
-async function eP({ chainId: i, agentId: e, ethProvider: t }) {
- const n = $2(i, t), [s, r] = await Promise.all([
+async function tP({ chainId: i, agentId: e, ethProvider: t }) {
+ const n = eP(i, t), [s, r] = await Promise.all([
n.ownerOf(e).catch(() => null),
n.tokenURI(e).catch(() => null)
]);
return { agentId: BigInt(e), owner: s, uri: r };
}
-function YE(i) {
+function JE(i) {
if (!i || typeof i != "object") return null;
const e = Array.isArray(i.services) ? i.services : [];
for (const n of e) {
@@ -50252,7 +50252,7 @@ function YE(i) {
const t = String(i.image || "").trim();
return /\.(glb|gltf)(\?|#|$)/i.test(t) ? t : null;
}
-async function tP(i) {
+async function nP(i) {
if (!i) return { ok: !1, error: "empty uri" };
if (i.startsWith("data:"))
try {
@@ -50272,42 +50272,42 @@ async function tP(i) {
return { ok: !1, error: t.message, resolvedUrl: e };
}
}
-const nP = {
+const iP = {
base: 8453,
"base-mainnet": 8453,
"base-sepolia": 84532,
ethereum: 1,
mainnet: 1
-}, iP = {
+}, sP = {
8453: "https://mainnet.base.org",
84532: "https://sepolia.base.org",
1: "https://eth.llamarpc.com"
};
-async function c0(i, { rpcURL: e, registry: t } = {}) {
+async function Cl(i, { rpcURL: e, registry: t } = {}) {
if (!i) throw new Error("loadManifest: source required");
if (i.startsWith("agent://"))
- return sP(i, { rpcURL: e, registryOverride: t });
+ return rP(i, { rpcURL: e, registryOverride: t });
if (i.startsWith("ipfs://") || i.startsWith("ar://")) {
- const n = Xs(i), s = await Ff(n);
- return Nf(s, { baseURI: Df(n) });
+ const n = Xs(i), s = await Df(n);
+ return Lf(s, { baseURI: Pf(n) });
}
if (i.startsWith("http")) {
- const n = await Ff(i);
- return Nf(n, { baseURI: Df(i) });
+ const n = await Df(i);
+ return Lf(n, { baseURI: Pf(i) });
}
throw new Error(`Unsupported manifest source: ${i}`);
}
-async function sP(i, { rpcURL: e, registryOverride: t }) {
+async function rP(i, { rpcURL: e, registryOverride: t }) {
const n = i.match(/^agent:\/\/([^/]+)\/(\d+)$/);
if (!n) throw new Error(`Malformed agent URI: ${i}`);
- const [, s, r] = n, a = nP[s.toLowerCase()] || Number(s);
+ const [, s, r] = n, a = iP[s.toLowerCase()] || Number(s);
if (!a) throw new Error(`Unknown chain: ${s}`);
- const o = kh[a], c = t || o?.identityRegistry;
+ const o = Oh[a], c = t || o?.identityRegistry;
if (!c)
throw new Error(`No registry deployed on chain ${a}. Pass registry= override.`);
- const l = new KE(e || iP[a]), h = new Mr(c, jE, l), u = BigInt(r), d = await h.tokenURI(u);
+ const l = new jE(e || sP[a]), h = new Mr(c, XE, l), u = BigInt(r), d = await h.tokenURI(u);
if (!d) throw new Error(`Agent ${r} on chain ${a} has no URI`);
- const f = Xs(d), p = await Ff(f), m = Nf(p, { baseURI: Df(f) });
+ const f = Xs(d), p = await Df(f), m = Lf(p, { baseURI: Pf(f) });
return m.id = {
...m.id,
chain: s,
@@ -50316,23 +50316,23 @@ async function sP(i, { rpcURL: e, registryOverride: t }) {
agentId: r
}, m;
}
-async function Ff(i) {
+async function Df(i) {
let e;
try {
e = await fetch(i);
} catch {
- e = await eF(i);
+ e = await tF(i);
}
if (!e.ok) throw new Error(`Manifest fetch failed: ${i} (${e.status})`);
return e.json();
}
-function Nf(i, { baseURI: e = "" } = {}) {
+function Lf(i, { baseURI: e = "" } = {}) {
if (i.spec && i.spec.startsWith("agent-manifest/")) {
const t = { ...i, _baseURI: e };
return t.body = t.body || {}, !t.body.uri && t.image && (t.body.uri = t.image), t;
}
if (i.type && i.type.includes("eip-8004")) {
- const t = i.registrations?.[0] || {}, n = YE(i);
+ const t = i.registrations?.[0] || {}, n = JE(i);
return {
spec: "agent-manifest/0.1",
_baseURI: e,
@@ -50370,11 +50370,11 @@ function Nf(i, { baseURI: e = "" } = {}) {
version: i.version || "0.1.0"
};
}
-function Df(i) {
+function Pf(i) {
const e = i.lastIndexOf("/");
return e >= 0 ? i.slice(0, e + 1) : i;
}
-async function rP(i, e) {
+async function aP(i, e) {
if (!i._baseURI) return null;
try {
const t = new URL(e, i._baseURI).href, n = await fetch(t);
@@ -50383,39 +50383,72 @@ async function rP(i, e) {
return null;
}
}
-class os extends Error {
+class Nn extends Error {
constructor(e, t, { status: n } = {}) {
super(t), this.name = "AgentResolveError", this.code = e, n !== void 0 && (this.status = n);
}
}
-async function l0(i, { fetchFn: e }) {
+async function h0(i, { fetchFn: e }) {
let t;
try {
t = await e(i, { credentials: "include" });
} catch (n) {
- throw new os("network", `network error fetching ${i}: ${n.message || n}`);
+ throw new Nn("network", `network error fetching ${i}: ${n.message || n}`);
}
if (t.status === 401 || t.status === 403)
- throw new os("unauthorized", `unauthorized fetching ${i} (${t.status})`, { status: t.status });
+ throw new Nn("unauthorized", `unauthorized fetching ${i} (${t.status})`, { status: t.status });
if (t.status === 404)
- throw new os("not_found", `resource not found: ${i}`, { status: 404 });
+ throw new Nn("not_found", `resource not found: ${i}`, { status: 404 });
if (!t.ok)
- throw new os("network", `request failed: ${i} (${t.status})`, { status: t.status });
+ throw new Nn("network", `request failed: ${i} (${t.status})`, { status: t.status });
try {
return await t.json();
} catch (n) {
- throw new os("network", `invalid JSON from ${i}: ${n.message || n}`);
+ throw new Nn("network", `invalid JSON from ${i}: ${n.message || n}`);
+ }
+}
+const da = /* @__PURE__ */ new Map(), oP = 100;
+async function cP(i, e) {
+ if (!i) throw new Nn("not-found", "agentId required");
+ if (da.has(i)) return da.get(i);
+ const t = typeof location < "u" ? location.origin : "", n = `${t}/api/agents/${encodeURIComponent(i)}`;
+ let s;
+ try {
+ s = await fetch(n, { credentials: "include", signal: e });
+ } catch (c) {
+ throw c?.name === "AbortError" ? c : new Nn("network", `network error fetching ${n}: ${c.message || c}`);
+ }
+ if (s.status === 404)
+ throw new Nn("not-found", `agent ${i} not found`, { status: 404 });
+ if (s.status === 401 || s.status === 403)
+ throw new Nn("unauthorized", `unauthorized (${s.status})`, { status: s.status });
+ if (!s.ok)
+ throw new Nn("network", `request failed (${s.status})`, { status: s.status });
+ let r;
+ try {
+ r = await s.json();
+ } catch {
+ throw new Nn("network", `invalid JSON from ${n}`);
}
+ const a = r?.agent?.manifestUrl ?? null;
+ let o = null;
+ if (a)
+ try {
+ o = new URL(a, t).href;
+ } catch {
+ o = a;
+ }
+ return da.size >= oP && da.delete(da.keys().next().value), da.set(i, o), o;
}
-async function aP(i, { origin: e = typeof location < "u" ? location.origin : "", fetchFn: t = fetch } = {}) {
- if (!i) throw new os("not_found", "agentId required");
- const n = t.bind(typeof globalThis < "u" ? globalThis : void 0), r = (await l0(`${e}/api/agents/${encodeURIComponent(i)}`, { fetchFn: n }))?.agent;
- if (!r) throw new os("not_found", `agent ${i} not found`);
+async function lP(i, { origin: e = typeof location < "u" ? location.origin : "", fetchFn: t = fetch } = {}) {
+ if (!i) throw new Nn("not_found", "agentId required");
+ const n = t.bind(typeof globalThis < "u" ? globalThis : void 0), r = (await h0(`${e}/api/agents/${encodeURIComponent(i)}`, { fetchFn: n }))?.agent;
+ if (!r) throw new Nn("not_found", `agent ${i} not found`);
if (!r.avatar_id)
- throw new os("no_avatar", `agent ${i} has no avatar bound`);
- const o = (await l0(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`, { fetchFn: n }))?.avatar;
+ throw new Nn("no_avatar", `agent ${i} has no avatar bound`);
+ const o = (await h0(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`, { fetchFn: n }))?.avatar;
if (!o || !o.url)
- throw new os("no_avatar", `avatar ${r.avatar_id} has no url`);
+ throw new Nn("no_avatar", `avatar ${r.avatar_id} has no url`);
const c = Array.isArray(r.skills) ? r.skills.map((l) => typeof l == "string" ? { name: l } : l).filter(Boolean) : [];
return {
spec: "agent-manifest/0.1",
@@ -50438,7 +50471,7 @@ async function aP(i, { origin: e = typeof location < "u" ? location.origin : "",
_source: "agent-id"
};
}
-function JE(i) {
+function ZE(i) {
if (!i) return null;
if (typeof i == "object")
return i.chainId && i.agentId !== void 0 ? {
@@ -50451,41 +50484,41 @@ function JE(i) {
let t = e.match(/^eip155:(\d+):(0x[0-9a-fA-F]{40}):(\d+)$/);
return t ? { chainId: Number(t[1]), registry: t[2], agentId: t[3] } : (t = e.match(/^eip155:(\d+)\/erc721:(0x[0-9a-fA-F]{40})\/(\d+)$/), t ? { chainId: Number(t[1]), registry: t[2], agentId: t[3] } : (t = e.match(/^onchain:(\d+):(\d+)$/), t ? { chainId: Number(t[1]), agentId: t[2] } : (t = e.match(/^agent:\/\/(\d+)\/(\d+)$/), t ? { chainId: Number(t[1]), agentId: t[2] } : (t = e.match(/^\/?a\/(\d+)\/(\d+)(?:\/(embed))?\/?$/), t ? { chainId: Number(t[1]), agentId: t[2] } : (t = e.match(/^\/?a\/(\d+)\/(0x[0-9a-fA-F]{40})\/(\d+)\/?$/), t ? { chainId: Number(t[1]), registry: t[2], agentId: t[3] } : null)))));
}
-function oP(i) {
- const e = i.registry || kh[i.chainId]?.identityRegistry;
+function hP(i) {
+ const e = i.registry || Oh[i.chainId]?.identityRegistry;
return e ? `eip155:${i.chainId}:${e}:${i.agentId}` : `onchain:${i.chainId}:${i.agentId}`;
}
-function cP(i, { embed: e = !1, origin: t } = {}) {
+function uP(i, { embed: e = !1, origin: t } = {}) {
return `${t || (typeof location < "u" ? location.origin : "")}/a/${i.chainId}/${i.agentId}${e ? "/embed" : ""}`;
}
-const lP = [
+const dP = [
"https://ipfs.io/ipfs/",
"https://dweb.link/ipfs/",
"https://cloudflare-ipfs.com/ipfs/",
"https://gateway.pinata.cloud/ipfs/"
-], hP = "https://arweave.net/";
-function h0(i) {
- return i ? i.startsWith("ipfs://") ? lP[0] + i.slice(7) : i.startsWith("ar://") ? hP + i.slice(5) : i : "";
+], fP = "https://arweave.net/";
+function u0(i) {
+ return i ? i.startsWith("ipfs://") ? dP[0] + i.slice(7) : i.startsWith("ar://") ? fP + i.slice(5) : i : "";
}
-const Eo = /* @__PURE__ */ new Map();
-function uP(i) {
+const yo = /* @__PURE__ */ new Map();
+function pP(i) {
return `${i.chainId}:${i.agentId}`;
}
-async function dP(i, { ethProvider: e, fresh: t = !1 } = {}) {
- const n = JE(i);
+async function AP(i, { ethProvider: e, fresh: t = !1 } = {}) {
+ const n = ZE(i);
if (!n) throw new Error(`Unrecognised agent reference: ${i}`);
const s = {
chainId: n.chainId,
agentId: String(n.agentId),
- registry: n.registry || kh[n.chainId]?.identityRegistry || null
+ registry: n.registry || Oh[n.chainId]?.identityRegistry || null
};
if (!s.registry) throw new Error(`No registry deployed on chain ${s.chainId}`);
- const r = uP(s);
- if (!t && Eo.has(r)) return Eo.get(r);
- const a = XE[s.chainId] || null, o = {
+ const r = pP(s);
+ if (!t && yo.has(r)) return yo.get(r);
+ const a = YE[s.chainId] || null, o = {
ref: s,
- caip: oP(s),
- publicUrl: typeof location < "u" ? cP(s) : `/a/${s.chainId}/${s.agentId}`,
+ caip: hP(s),
+ publicUrl: typeof location < "u" ? uP(s) : `/a/${s.chainId}/${s.agentId}`,
chain: a ? { name: a.name, testnet: !!a.testnet, explorer: a.explorer } : null,
onchain: { owner: null, uri: null },
metadata: null,
@@ -50497,28 +50530,28 @@ async function dP(i, { ethProvider: e, fresh: t = !1 } = {}) {
services: []
};
try {
- const { owner: c, uri: l } = await eP({
+ const { owner: c, uri: l } = await tP({
chainId: s.chainId,
agentId: s.agentId,
ethProvider: e
});
if (o.onchain = { owner: c, uri: l }, !l)
- return o.error = "agentURI not set", Eo.set(r, o), o;
- const h = await tP(l);
+ return o.error = "agentURI not set", yo.set(r, o), o;
+ const h = await nP(l);
if (!h.ok)
- return o.error = h.error, o.metadataUrl = h.resolvedUrl || null, Eo.set(r, o), o;
+ return o.error = h.error, o.metadataUrl = h.resolvedUrl || null, yo.set(r, o), o;
const u = h.data;
- o.metadata = u, o.metadataUrl = h.resolvedUrl || null, o.name = u?.name && String(u.name) || o.name, o.description = u?.description && String(u.description) || "", o.image = u?.image ? String(u.image) : null, o.services = Array.isArray(u?.services) ? u.services : [], o.glbUrl = YE(u);
+ o.metadata = u, o.metadataUrl = h.resolvedUrl || null, o.name = u?.name && String(u.name) || o.name, o.description = u?.description && String(u.description) || "", o.image = u?.image ? String(u.image) : null, o.services = Array.isArray(u?.services) ? u.services : [], o.glbUrl = JE(u);
} catch (c) {
o.error = c.message || String(c);
}
- return Eo.set(r, o), o;
+ return yo.set(r, o), o;
}
-function fP(i) {
- const e = Array.isArray(i.services) ? i.services : [], t = e.find((a) => /brain|llm|chat/i.test(a?.name || a?.type || "")), n = e.filter((a) => /skill/i.test(a?.name || a?.type || "")), s = i.glbUrl ? h0(i.glbUrl) : "", r = i.image ? h0(i.image) : "";
+function gP(i) {
+ const e = Array.isArray(i.services) ? i.services : [], t = e.find((a) => /brain|llm|chat/i.test(a?.name || a?.type || "")), n = e.filter((a) => /skill/i.test(a?.name || a?.type || "")), s = i.glbUrl ? u0(i.glbUrl) : "", r = i.image ? u0(i.image) : "";
return {
spec: "agent-manifest/0.1",
- _baseURI: i.metadataUrl ? pP(i.metadataUrl) : "",
+ _baseURI: i.metadataUrl ? mP(i.metadataUrl) : "",
_source: "erc8004-resolver",
id: {
agentId: i.ref.agentId,
@@ -50527,7 +50560,7 @@ function fP(i) {
owner: i.onchain.owner || void 0,
walletAddress: i.onchain.owner || void 0,
caip: i.caip,
- agentRegistry: J2(i.ref.chainId, i.ref.registry)
+ agentRegistry: Z2(i.ref.chainId, i.ref.registry)
},
name: i.name,
description: i.description,
@@ -50544,18 +50577,18 @@ function fP(i) {
embedPolicy: i.metadata?.embedPolicy || null
};
}
-function pP(i) {
+function mP(i) {
const e = i.lastIndexOf("/");
return e >= 0 ? i.slice(0, e + 1) : i;
}
-const AP = ["inline", "floating", "section", "fullscreen"], u0 = (() => {
+const xP = ["inline", "floating", "section", "fullscreen"], d0 = (() => {
try {
return new URL(import.meta.url).origin;
} catch {
return "";
}
})();
-function gP(i, e, t = []) {
+function bP(i, e, t = []) {
if (!i) return !1;
let n;
try {
@@ -50570,7 +50603,7 @@ function gP(i, e, t = []) {
});
return r === "allowlist" ? a : !a;
}
-const mP = `
+const EP = `
:host {
display: block;
position: relative;
@@ -50723,7 +50756,7 @@ const mP = `
padding: 8px 14px;
border-radius: 999px;
}
- .error {
+ .error, .agent-3d-error {
position: absolute;
inset: 16px;
display: grid;
@@ -50735,7 +50768,7 @@ const mP = `
font: 14px var(--agent-chat-font);
}
`;
-class ZE extends HTMLElement {
+class $E extends HTMLElement {
static get observedAttributes() {
return [
"src",
@@ -50753,7 +50786,7 @@ class ZE extends HTMLElement {
];
}
constructor() {
- super(), this.attachShadow({ mode: "open" }), this._viewer = null, this._scene = null, this._runtime = null, this._memory = null, this._skills = null, this._manifest = null, this._mounted = !1, this._booting = !1, this._listening = !1, this._pillActive = !1, this._mqNarrow = null, this._mqNarrowHandler = null, this._ro = null, this._outsideTapHandler = null;
+ super(), this.attachShadow({ mode: "open" }), this._viewer = null, this._scene = null, this._runtime = null, this._memory = null, this._skills = null, this._manifest = null, this._mounted = !1, this._booting = !1, this._listening = !1, this._pillActive = !1, this._mqNarrow = null, this._mqNarrowHandler = null, this._ro = null, this._outsideTapHandler = null, this._autoResolvedManifest = !1, this._suppressAttrChange = !1;
}
connectedCallback() {
this._renderShell(), this._applyLayout(), this._setupResponsive(), this._observeViewport(), this.hasAttribute("eager") && this._boot();
@@ -50762,11 +50795,11 @@ class ZE extends HTMLElement {
this._teardown();
}
attributeChangedCallback(e, t, n) {
- this._mounted && (["mode", "position", "width", "height", "responsive"].includes(e) && this._applyLayout(), ["src", "manifest", "body", "agent-id"].includes(e) && (this._teardown(), this._boot()));
+ !this._mounted || this._suppressAttrChange || (["mode", "position", "width", "height", "responsive"].includes(e) && this._applyLayout(), ["src", "manifest", "body", "agent-id"].includes(e) && (this._teardown(), this._boot()));
}
_renderShell() {
const e = document.createElement("style");
- e.textContent = mP, this.shadowRoot.appendChild(e);
+ e.textContent = EP, this.shadowRoot.appendChild(e);
const t = document.createElement("div");
t.className = "stage", t.part = "stage", this.shadowRoot.appendChild(t), this._stageEl = t;
const n = document.createElement("div");
@@ -50813,7 +50846,7 @@ class ZE extends HTMLElement {
}
_applyLayout() {
const e = this.getAttribute("mode") || "inline";
- if (!AP.includes(e)) return;
+ if (!xP.includes(e)) return;
const t = this._isResponsive();
if (e === "floating") {
if (!this._pillActive) {
@@ -50898,8 +50931,8 @@ class ZE extends HTMLElement {
if (this._manifest = e, this.dispatchEvent(
new CustomEvent("agent:load-progress", { detail: { phase: "manifest", pct: 0.3 } })
), typeof e.brain?.instructions == "string" && e.brain.instructions.endsWith(".md")) {
- const l = await rP(e, e.brain.instructions);
- l && (e.instructions = xP(l));
+ const l = await aP(e, e.brain.instructions);
+ l && (e.instructions = yP(l));
} else e.brain?.instructions && (e.instructions = e.brain.instructions);
const t = (() => {
const l = this.getAttribute("agent-id") || e.id?.agentId || "";
@@ -50907,7 +50940,7 @@ class ZE extends HTMLElement {
})();
if (t)
try {
- const l = u0 || window.location.origin, h = await fetch(
+ const l = d0 || window.location.origin, h = await fetch(
`${l}/api/agents/${t}/embed-policy`,
{ credentials: "omit" }
);
@@ -50922,7 +50955,7 @@ class ZE extends HTMLElement {
return;
}
const d = ["3dagent.vercel.app", "localhost"], f = window.location.origin;
- if (!f.startsWith("http://localhost") && !gP(f, u, d)) {
+ if (!f.startsWith("http://localhost") && !bP(f, u, d)) {
this._fail(
"embed_denied_origin",
`This agent isn't permitted on ${f}.`
@@ -50937,21 +50970,21 @@ class ZE extends HTMLElement {
this.dispatchEvent(
new CustomEvent("agent:load-progress", { detail: { phase: "body", pct: 0.45 } })
);
- const n = new ib(this._stageEl, { kiosk: this.hasAttribute("kiosk") });
+ const n = new sb(this._stageEl, { kiosk: this.hasAttribute("kiosk") });
this._viewer = n;
const s = Xs(e.body?.uri);
- s && await n.load(s, "", /* @__PURE__ */ new Map()), this._scene = new iF(n), this.dispatchEvent(
+ s && await n.load(s, "", /* @__PURE__ */ new Map()), this._scene = new sF(n), this.dispatchEvent(
new CustomEvent("agent:load-progress", { detail: { phase: "memory", pct: 0.6 } })
);
const r = e.id?.agentId || this.getAttribute("memory-key") || e.name || "anon";
- this._memory = await Pi.load({
+ this._memory = await ki.load({
mode: this.getAttribute("memory") || e.memory?.mode || "local",
namespace: r,
manifestURI: e._baseURI + "manifest.json",
fetchFn: fetch.bind(globalThis)
}), this.dispatchEvent(
new CustomEvent("agent:load-progress", { detail: { phase: "skills", pct: 0.75 } })
- ), this._skills = new xF({
+ ), this._skills = new bF({
trust: this.getAttribute("skill-trust") || "owned-only",
ownerAddress: e.id?.owner
});
@@ -50976,9 +51009,9 @@ class ZE extends HTMLElement {
apiKey: this.getAttribute("api-key") || void 0,
proxyURL: this.getAttribute("key-proxy") || void 0,
agentId: t || void 0,
- apiOrigin: u0 || window.location.origin
+ apiOrigin: d0 || window.location.origin
}, c = this._parseTTSAttribute();
- c && (e.voice = e.voice || {}, e.voice.tts = { ...e.voice.tts || {}, ...c }), this._runtime = new ZR({
+ c && (e.voice = e.voice || {}, e.voice.tts = { ...e.voice.tts || {}, ...c }), this._runtime = new $R({
manifest: e,
viewer: this._scene,
memory: this._memory,
@@ -51008,7 +51041,12 @@ class ZE extends HTMLElement {
})
);
} catch (e) {
- console.error("[agent-3d] boot failed", e), this._loadingEl.hidden = !0, this._showError(e), this.dispatchEvent(
+ if (console.error("[agent-3d] boot failed", e), this._loadingEl.hidden = !0, e instanceof Nn && e.code === "not-found") {
+ const t = document.createElement("div");
+ t.className = "agent-3d-error", t.textContent = "Agent not found", this.shadowRoot.appendChild(t);
+ } else
+ this._showError(e);
+ this.dispatchEvent(
new CustomEvent("agent:error", {
detail: { phase: "boot", error: e },
bubbles: !0,
@@ -51023,7 +51061,7 @@ class ZE extends HTMLElement {
async _resolveManifest() {
const e = this.getAttribute("src"), t = this.getAttribute("manifest"), n = this.getAttribute("body"), s = this.getAttribute("agent-id"), r = this.getAttribute("chain-id");
if (e)
- return s && console.warn("[agent-3d] both src and agent-id provided; using src"), c0(e, {
+ return s && console.warn("[agent-3d] both src and agent-id provided; using src"), Cl(e, {
rpcURL: this.getAttribute("rpc-url"),
registry: this.getAttribute("registry")
});
@@ -51032,16 +51070,18 @@ class ZE extends HTMLElement {
chainId: Number(r),
agentId: s,
registry: this.getAttribute("registry") || void 0
- } : s, o = JE(a);
+ } : s, o = ZE(a);
if (o) {
- const c = await dP(o);
- if (c.error && !c.glbUrl)
- throw new Error(`On-chain resolve failed: ${c.error}`);
- return fP(c);
+ const l = await AP(o);
+ if (l.error && !l.glbUrl)
+ throw new Error(`On-chain resolve failed: ${l.error}`);
+ return gP(l);
}
- return aP(s);
+ if (t) return Cl(t);
+ const c = await cP(s);
+ return c ? (this._autoResolvedManifest = !0, this.setAttribute("manifest", c), Cl(c)) : lP(s);
}
- if (t) return c0(t);
+ if (t) return Cl(t);
if (n) {
const a = this.getAttribute("instructions");
return {
@@ -51102,6 +51142,15 @@ class ZE extends HTMLElement {
}
}
_teardown() {
+ if (this._autoResolvedManifest) {
+ this._suppressAttrChange = !0;
+ try {
+ this.removeAttribute("manifest");
+ } finally {
+ this._suppressAttrChange = !1;
+ }
+ this._autoResolvedManifest = !1;
+ }
try {
this._io?.disconnect();
} catch {
@@ -51189,12 +51238,12 @@ class ZE extends HTMLElement {
});
}
}
-function xP(i) {
+function yP(i) {
const e = i.match(/^---\n[\s\S]*?\n---\n?([\s\S]*)$/);
return e ? e[1] : i;
}
-customElements.get("agent-3d") || customElements.define("agent-3d", ZE);
-const bP = ["row", "circle", "freeform"], EP = `
+customElements.get("agent-3d") || customElements.define("agent-3d", $E);
+const _P = ["row", "circle", "freeform"], wP = `
:host {
display: block;
position: relative;
@@ -51215,7 +51264,7 @@ const bP = ["row", "circle", "freeform"], EP = `
pointer-events: none;
}
`;
-class yP extends HTMLElement {
+class vP extends HTMLElement {
static get observedAttributes() {
return ["formation"];
}
@@ -51242,14 +51291,14 @@ class yP extends HTMLElement {
}
get formation() {
const e = this.getAttribute("formation") || "row";
- return bP.includes(e) ? e : "row";
+ return _P.includes(e) ? e : "row";
}
get viewer() {
return this._viewer;
}
_renderShell() {
const e = document.createElement("style");
- e.textContent = EP, this.shadowRoot.appendChild(e);
+ e.textContent = wP, this.shadowRoot.appendChild(e);
const t = document.createElement("div");
t.className = "stage-canvas", t.part = "stage", this.shadowRoot.appendChild(t), this._canvasBox = t;
const n = document.createElement("slot");
@@ -51257,7 +51306,7 @@ class yP extends HTMLElement {
}
_initViewer() {
if (!this._initialized) {
- this._viewer = new ib(this._canvasBox, { kiosk: !0 }), this._viewer.defaultCamera.position.set(0, 1.55, 3.4), this._viewer.defaultCamera.lookAt(0, 1.2, 0), this._viewer.controls.target.set(0, 1.2, 0), this._viewer.controls.update();
+ this._viewer = new sb(this._canvasBox, { kiosk: !0 }), this._viewer.defaultCamera.position.set(0, 1.55, 3.4), this._viewer.defaultCamera.lookAt(0, 1.2, 0), this._viewer.controls.target.set(0, 1.2, 0), this._viewer.controls.update();
try {
this._viewer.updateLights?.();
} catch {
@@ -51286,7 +51335,7 @@ class yP extends HTMLElement {
this._viewer?.scene.remove(n.group);
} catch {
}
- _P(n.group), this._repositionAll(), this.dispatchEvent(new CustomEvent("stage:agent-left", {
+ CP(n.group), this._repositionAll(), this.dispatchEvent(new CustomEvent("stage:agent-left", {
detail: { agentId: n.id, element: n.element },
bubbles: !0,
composed: !0
@@ -51380,7 +51429,7 @@ class yP extends HTMLElement {
};
}
}
-function _P(i) {
+function CP(i) {
i.traverse((e) => {
if (e.geometry)
try {
@@ -51406,23 +51455,23 @@ function _P(i) {
}
}), i.parent && i.parent.remove(i);
}
-customElements.get("agent-stage") || customElements.define("agent-stage", yP);
-const CP = (i = "agent-3d") => {
- customElements.get(i) || customElements.define(i, ZE);
+customElements.get("agent-stage") || customElements.define("agent-stage", vP);
+const MP = (i = "agent-3d") => {
+ customElements.get(i) || customElements.define(i, $E);
};
export {
- ZE as Agent3DElement,
- yP as AgentStageElement,
- Pi as Memory,
- ZR as Runtime,
- iF as SceneController,
- mF as Skill,
- xF as SkillRegistry,
- ib as Viewer,
- CP as defineElement,
- rP as fetchRelative,
- eF as fetchWithFallback,
- c0 as loadManifest,
- Nf as normalize,
+ $E as Agent3DElement,
+ vP as AgentStageElement,
+ ki as Memory,
+ $R as Runtime,
+ sF as SceneController,
+ xF as Skill,
+ bF as SkillRegistry,
+ sb as Viewer,
+ MP as defineElement,
+ aP as fetchRelative,
+ tF as fetchWithFallback,
+ Cl as loadManifest,
+ Lf as normalize,
Xs as resolveURI
};
diff --git a/dist-lib/agent-3d.umd.cjs b/dist-lib/agent-3d.umd.cjs
index 232cdd613..3cf254075 100644
--- a/dist-lib/agent-3d.umd.cjs
+++ b/dist-lib/agent-3d.umd.cjs
@@ -1,8 +1,8 @@
-(function(on,nr){typeof exports=="object"&&typeof module<"u"?nr(exports):typeof define=="function"&&define.amd?define(["exports"],nr):(on=typeof globalThis<"u"?globalThis:on||self,nr(on.Agent3D={}))})(this,(function(on){"use strict";var nr=typeof document<"u"?document.currentScript:null;const vc="176",qr={ROTATE:0,DOLLY:1,PAN:2},Kr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ly=0,Gp=1,hy=2,Hp=1,uy=2,qi=3,Ki=0,Dn=1,Li=2,Cs=0,jr=1,zp=2,Vp=3,Wp=4,dy=5,ir=100,fy=101,py=102,Ay=103,gy=104,my=200,xy=201,by=202,Ey=203,Hh=204,zh=205,yy=206,_y=207,wy=208,vy=209,Cy=210,Iy=211,Sy=212,My=213,By=214,Vh=0,Wh=1,qh=2,Xr=3,Kh=4,jh=5,Xh=6,Yh=7,Cc=0,Ty=1,Ry=2,Is=0,Jh=1,Fy=2,Ny=3,qp=4,Dy=5,Ly=6,Py=7,Kp="attached",ky="detached",jp=300,sr=301,Yr=302,Ic=303,Zh=304,Sc=306,Ss=1e3,Jn=1001,Mc=1002,Ln=1003,Xp=1004,to=1005,qt=1006,Bc=1007,si=1008,cn=1009,Yp=1010,Jp=1011,no=1012,$h=1013,rr=1014,ln=1015,Pn=1016,eu=1017,tu=1018,io=1020,Zp=35902,$p=1021,eA=1022,hn=1023,so=1026,ro=1027,ji=1028,nu=1029,ar=1030,iu=1031,su=1033,Tc=33776,ao=33777,Rc=33778,oo=33779,Fc=35840,ru=35841,Nc=35842,au=35843,Dc=36196,Lc=37492,Pc=37496,co=37808,ou=37809,cu=37810,lu=37811,lo=37812,hu=37813,uu=37814,du=37815,fu=37816,pu=37817,Au=37818,gu=37819,mu=37820,xu=37821,ho=36492,bu=36494,kc=36495,tA=36283,Eu=36284,yu=36285,_u=36286,nA=2200,iA=2201,Uy=2202,uo=2300,fo=2301,wu=2302,Jr=2400,Zr=2401,Uc=2402,vu=2500,Oy=2501,Qy=0,sA=1,Cu=2,Gy=3200,Hy=3201,Oc=0,zy=1,gi="",yt="srgb",un="srgb-linear",Qc="linear",Rt="srgb",$r=7680,rA=519,Vy=512,Wy=513,qy=514,aA=515,Ky=516,jy=517,Xy=518,Yy=519,Iu=35044,oA="300 es",Xi=2e3,Gc=2001;class Ms{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const s=n[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,e);e.target=null}}}const Fn=["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"];let cA=1234567;const po=Math.PI/180,ea=180/Math.PI;function mi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Fn[i&255]+Fn[i>>8&255]+Fn[i>>16&255]+Fn[i>>24&255]+"-"+Fn[e&255]+Fn[e>>8&255]+"-"+Fn[e>>16&15|64]+Fn[e>>24&255]+"-"+Fn[t&63|128]+Fn[t>>8&255]+"-"+Fn[t>>16&255]+Fn[t>>24&255]+Fn[n&255]+Fn[n>>8&255]+Fn[n>>16&255]+Fn[n>>24&255]).toLowerCase()}function at(i,e,t){return Math.max(e,Math.min(t,i))}function Su(i,e){return(i%e+e)%e}function Jy(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function Zy(i,e,t){return i!==e?(t-i)/(e-i):0}function Ao(i,e,t){return(1-t)*i+t*e}function $y(i,e,t,n){return Ao(i,e,1-Math.exp(-t*n))}function e_(i,e=1){return e-Math.abs(Su(i,e*2)-e)}function t_(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function n_(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function i_(i,e){return i+Math.floor(Math.random()*(e-i+1))}function s_(i,e){return i+Math.random()*(e-i)}function r_(i){return i*(.5-Math.random())}function a_(i){i!==void 0&&(cA=i);let e=cA+=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 o_(i){return i*po}function c_(i){return i*ea}function l_(i){return(i&i-1)===0&&i!==0}function h_(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function u_(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function d_(i,e,t,n,s){const 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),p=a((n-e)/2);switch(s){case"XYX":i.set(o*h,c*u,c*d,o*l);break;case"YZY":i.set(c*d,o*h,c*u,o*l);break;case"ZXZ":i.set(c*u,c*d,o*h,o*l);break;case"XZX":i.set(o*h,c*p,c*f,o*l);break;case"YXY":i.set(c*f,o*h,c*p,o*l);break;case"ZYZ":i.set(c*p,c*f,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function xi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Bt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const In={DEG2RAD:po,RAD2DEG:ea,generateUUID:mi,clamp:at,euclideanModulo:Su,mapLinear:Jy,inverseLerp:Zy,lerp:Ao,damp:$y,pingpong:e_,smoothstep:t_,smootherstep:n_,randInt:i_,randFloat:s_,randFloatSpread:r_,seededRandom:a_,degToRad:o_,radToDeg:c_,isPowerOfTwo:l_,ceilPowerOfTwo:h_,floorPowerOfTwo:u_,setQuaternionFromProperEuler:d_,normalize:Bt,denormalize:xi};class Je{constructor(e=0,t=0){Je.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[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=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(at(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),s=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*s+e.x,this.y=r*s+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ot{constructor(e,t,n,s,r,a,o,c,l){ot.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,a,o,c,l)}set(e,t,n,s,r,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=s,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){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,s=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],p=n[8],m=s[0],g=s[3],A=s[6],_=s[1],x=s[4],E=s[7],S=s[2],w=s[5],I=s[8];return r[0]=a*m+o*_+c*S,r[3]=a*g+o*x+c*w,r[6]=a*A+o*E+c*I,r[1]=l*m+h*_+u*S,r[4]=l*g+h*x+u*w,r[7]=l*A+h*E+u*I,r[2]=d*m+f*_+p*S,r[5]=d*g+f*x+p*w,r[8]=d*A+f*E+p*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],s=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+s*r*l-s*a*c}invert(){const e=this.elements,t=e[0],n=e[1],s=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,p=t*u+n*d+s*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=u*m,e[1]=(s*l-h*n)*m,e[2]=(o*n-s*a)*m,e[3]=d*m,e[4]=(h*t-s*c)*m,e[5]=(s*r-o*t)*m,e[6]=f*m,e[7]=(n*c-l*t)*m,e[8]=(a*t-n*r)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,r,a,o){const c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-s*l,s*c,-s*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Mu.makeScale(e,t)),this}rotate(e){return this.premultiply(Mu.makeRotation(-e)),this}translate(e,t){return this.premultiply(Mu.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Mu=new ot;function lA(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function go(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function f_(){const i=go("canvas");return i.style.display="block",i}const hA={};function Hc(i){i in hA||(hA[i]=!0,console.warn(i))}function p_(i,e,t){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}function A_(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function g_(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const uA=new ot().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),dA=new ot().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function m_(){const i={enabled:!0,workingColorSpace:un,spaces:{},convert:function(s,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Rt&&(s.r=Yi(s.r),s.g=Yi(s.g),s.b=Yi(s.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Rt&&(s.r=ta(s.r),s.g=ta(s.g),s.b=ta(s.b))),s},fromWorkingColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},toWorkingColorSpace:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===gi?Qc:this.spaces[s].transfer},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,a){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[un]:{primaries:e,whitePoint:n,transfer:Qc,toXYZ:uA,fromXYZ:dA,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:yt},outputColorSpaceConfig:{drawingBufferColorSpace:yt}},[yt]:{primaries:e,whitePoint:n,transfer:Rt,toXYZ:uA,fromXYZ:dA,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:yt}}}),i}const tt=m_();function Yi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ta(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let na;class x_{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{na===void 0&&(na=go("canvas")),na.width=e.width,na.height=e.height;const s=na.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=na}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){const t=go("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const s=n.getImageData(0,0,e.width,e.height),r=s.data;for(let a=0;a<r.length;a++)r[a]=Yi(r[a]/255)*255;return n.putImageData(s,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Yi(t[n]/255)*255):t[n]=Yi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let b_=0;class Bu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:b_++}),this.uuid=mi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let a=0,o=s.length;a<o;a++)s[a].isDataTexture?r.push(Tu(s[a].image)):r.push(Tu(s[a]))}else r=Tu(s);n.url=r}return t||(e.images[this.uuid]=n),n}}function Tu(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?x_.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let E_=0;class nn extends Ms{constructor(e=nn.DEFAULT_IMAGE,t=nn.DEFAULT_MAPPING,n=Jn,s=Jn,r=qt,a=si,o=hn,c=cn,l=nn.DEFAULT_ANISOTROPY,h=gi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:E_++}),this.uuid=mi(),this.name="",this.source=new Bu(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Je(0,0),this.repeat=new Je(1,1),this.center=new Je(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ot,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isTextureArray=e.isTextureArray,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==jp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ss:e.x=e.x-Math.floor(e.x);break;case Jn:e.x=e.x<0?0:1;break;case Mc: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 Ss:e.y=e.y-Math.floor(e.y);break;case Jn:e.y=e.y<0?0:1;break;case Mc: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++}}nn.DEFAULT_IMAGE=null,nn.DEFAULT_MAPPING=jp,nn.DEFAULT_ANISOTROPY=1;class gt{constructor(e=0,t=0,n=0,s=1){gt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=s}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,s){return this.x=e,this.y=t,this.z=n,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,s=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*s+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*s+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*s+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*s+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);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,s,r;const c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],p=c[9],m=c[2],g=c[6],A=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-m)<.01&&Math.abs(p-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+m)<.1&&Math.abs(p+g)<.1&&Math.abs(l+f+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(l+1)/2,E=(f+1)/2,S=(A+1)/2,w=(h+d)/4,I=(u+m)/4,T=(p+g)/4;return x>E&&x>S?x<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(x),s=w/n,r=I/n):E>S?E<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(E),n=w/s,r=T/s):S<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(S),n=I/r,s=T/r),this.set(n,s,r,t),this}let _=Math.sqrt((g-p)*(g-p)+(u-m)*(u-m)+(d-h)*(d-h));return Math.abs(_)<.001&&(_=1),this.x=(g-p)/_,this.y=(u-m)/_,this.z=(d-h)/_,this.w=Math.acos((l+f+A-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this.z=at(this.z,e.z,t.z),this.w=at(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this.z=at(this.z,e,t),this.w=at(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class y_ extends Ms{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth?n.depth:1,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t);const s={width:e,height:t,depth:this.depth};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},n);const r=new nn(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const 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.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}get texture(){return this.textures[0]}set texture(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 s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=n;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;const s=Object.assign({},e.textures[t].image);this.textures[t].source=new Bu(s)}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}dispose(){this.dispatchEvent({type:"dispose"})}}class or extends y_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class fA extends nn{constructor(e=null,t=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Ln,this.minFilter=Ln,this.wrapR=Jn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class pA extends nn{constructor(e=null,t=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Ln,this.minFilter=Ln,this.wrapR=Jn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Yt{constructor(e=0,t=0,n=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=s}static slerpFlat(e,t,n,s,r,a,o){let c=n[s+0],l=n[s+1],h=n[s+2],u=n[s+3];const d=r[a+0],f=r[a+1],p=r[a+2],m=r[a+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||c!==d||l!==f||h!==p){let g=1-o;const A=c*d+l*f+h*p+u*m,_=A>=0?1:-1,x=1-A*A;if(x>Number.EPSILON){const S=Math.sqrt(x),w=Math.atan2(S,A*_);g=Math.sin(g*w)/S,o=Math.sin(o*w)/S}const E=o*_;if(c=c*g+d*E,l=l*g+f*E,h=h*g+p*E,u=u*g+m*E,g===1-o){const S=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=S,l*=S,h*=S,u*=S}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,s,r,a){const o=n[s],c=n[s+1],l=n[s+2],h=n[s+3],u=r[a],d=r[a+1],f=r[a+2],p=r[a+3];return e[t]=o*p+h*u+c*f-l*d,e[t+1]=c*p+h*d+l*u-o*f,e[t+2]=l*p+h*f+o*d-c*u,e[t+3]=h*p-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,s){return this._x=e,this._y=t,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,s=e._y,r=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(s/2),u=o(r/2),d=c(n/2),f=c(s/2),p=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u-d*f*p;break;case"YXZ":this._x=d*h*u+l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u+d*f*p;break;case"ZXY":this._x=d*h*u-l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u-d*f*p;break;case"ZYX":this._x=d*h*u-l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u+d*f*p;break;case"YZX":this._x=d*h*u+l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u-d*f*p;break;case"XZY":this._x=d*h*u-l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u+d*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,s=Math.sin(n);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],s=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){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(r-l)*f,this._z=(a-s)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-c)/f,this._x=.25*f,this._y=(s+a)/f,this._z=(r+l)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(r-l)/f,this._x=(s+a)/f,this._y=.25*f,this._z=(c+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-s)/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<Number.EPSILON?(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(at(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const s=Math.min(1,t/n);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,s=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+s*l-r*c,this._y=s*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-s*o,this._w=a*h-n*o-s*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,s=this._y,r=this._z,a=this._w;let o=a*e._w+n*e._x+s*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=s,this._z=r,this;const c=1-o*o;if(c<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*s+t*this._y,this._z=f*r+t*this._z,this.normalize(),this}const l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=s*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class G{constructor(e=0,t=0,n=0){G.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(AA.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(AA.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*s,this.y=r[1]*t+r[4]*n+r[7]*s,this.z=r[2]*t+r[5]*n+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,s=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*s+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*s+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*s+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,s=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*s-o*n),h=2*(o*t-r*s),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=s+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){const t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*s,this.y=r[1]*t+r[5]*n+r[9]*s,this.z=r[2]*t+r[6]*n+r[10]*s,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=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this.z=at(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this.z=at(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,s=e.y,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=s*c-r*o,this.y=r*a-n*c,this.z=n*o-s*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ru.copy(this).projectOnVector(e),this.sub(Ru)}reflect(e){return this.sub(Ru.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(at(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,s=this.z-e.z;return t*t+n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const s=Math.sin(t)*e;return this.x=s*Math.sin(n),this.y=Math.cos(t)*e,this.z=s*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ru=new G,AA=new Yt;class Pi{constructor(e=new G(1/0,1/0,1/0),t=new G(-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(bi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(bi.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){const n=bi.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);const n=e.geometry;if(n!==void 0){const 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,bi):bi.fromBufferAttribute(r,a),bi.applyMatrix4(e.matrixWorld),this.expandByPoint(bi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),zc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),zc.copy(n.boundingBox)),zc.applyMatrix4(e.matrixWorld),this.union(zc)}const s=e.children;for(let r=0,a=s.length;r<a;r++)this.expandByObject(s[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,bi),bi.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(mo),Vc.subVectors(this.max,mo),ia.subVectors(e.a,mo),sa.subVectors(e.b,mo),ra.subVectors(e.c,mo),Bs.subVectors(sa,ia),Ts.subVectors(ra,sa),cr.subVectors(ia,ra);let t=[0,-Bs.z,Bs.y,0,-Ts.z,Ts.y,0,-cr.z,cr.y,Bs.z,0,-Bs.x,Ts.z,0,-Ts.x,cr.z,0,-cr.x,-Bs.y,Bs.x,0,-Ts.y,Ts.x,0,-cr.y,cr.x,0];return!Fu(t,ia,sa,ra,Vc)||(t=[1,0,0,0,1,0,0,0,1],!Fu(t,ia,sa,ra,Vc))?!1:(Wc.crossVectors(Bs,Ts),t=[Wc.x,Wc.y,Wc.z],Fu(t,ia,sa,ra,Vc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,bi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(bi).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:(Ji[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ji[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ji[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ji[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ji[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ji[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ji[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ji[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ji),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ji=[new G,new G,new G,new G,new G,new G,new G,new G],bi=new G,zc=new Pi,ia=new G,sa=new G,ra=new G,Bs=new G,Ts=new G,cr=new G,mo=new G,Vc=new G,Wc=new G,lr=new G;function Fu(i,e,t,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){lr.fromArray(i,r);const o=s.x*Math.abs(lr.x)+s.y*Math.abs(lr.y)+s.z*Math.abs(lr.z),c=e.dot(lr),l=t.dot(lr),h=n.dot(lr);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const __=new Pi,xo=new G,Nu=new G;class ki{constructor(e=new G,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):__.setFromPoints(e).getCenter(n);let s=0;for(let r=0,a=e.length;r<a;r++)s=Math.max(s,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),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){const 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){const 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;xo.subVectors(e,this.center);const t=xo.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(xo,s/n),this.radius+=s}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):(Nu.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(xo.copy(e.center).add(Nu)),this.expandByPoint(xo.copy(e.center).sub(Nu))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Zi=new G,Du=new G,qc=new G,Rs=new G,Lu=new G,Kc=new G,Pu=new G;class bo{constructor(e=new G,t=new G(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,Zi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Zi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zi.copy(this.origin).addScaledVector(this.direction,t),Zi.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){Du.copy(e).add(t).multiplyScalar(.5),qc.copy(t).sub(e).normalize(),Rs.copy(this.origin).sub(Du);const r=e.distanceTo(t)*.5,a=-this.direction.dot(qc),o=Rs.dot(this.direction),c=-Rs.dot(qc),l=Rs.lengthSq(),h=Math.abs(1-a*a);let u,d,f,p;if(h>0)if(u=a*c-o,d=a*o-c,p=r*h,u>=0)if(d>=-p)if(d<=p){const m=1/h;u*=m,d*=m,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<=-p?(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<=p?(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),s&&s.copy(Du).addScaledVector(qc,d),f}intersectSphere(e,t){Zi.subVectors(e.center,this.origin);const n=Zi.dot(this.direction),s=Zi.dot(Zi)-n*n,r=e.radius*e.radius;if(s>r)return null;const a=Math.sqrt(r-s),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,s,r,a,o,c;const 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,s=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,s=(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>s||((r>n||isNaN(n))&&(n=r),(a<s||isNaN(s))&&(s=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>s)||((o>n||n!==n)&&(n=o),(c<s||s!==s)&&(s=c),s<0)?null:this.at(n>=0?n:s,t)}intersectsBox(e){return this.intersectBox(e,Zi)!==null}intersectTriangle(e,t,n,s,r){Lu.subVectors(t,e),Kc.subVectors(n,e),Pu.crossVectors(Lu,Kc);let a=this.direction.dot(Pu),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Rs.subVectors(this.origin,e);const c=o*this.direction.dot(Kc.crossVectors(Rs,Kc));if(c<0)return null;const l=o*this.direction.dot(Lu.cross(Rs));if(l<0||c+l>a)return null;const h=-o*Rs.dot(Pu);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)}}class Re{constructor(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g){Re.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g)}set(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g){const A=this.elements;return A[0]=e,A[4]=t,A[8]=n,A[12]=s,A[1]=r,A[5]=a,A[9]=o,A[13]=c,A[2]=l,A[6]=h,A[10]=u,A[14]=d,A[3]=f,A[7]=p,A[11]=m,A[15]=g,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 Re().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,s=1/aa.setFromMatrixColumn(e,0).length(),r=1/aa.setFromMatrixColumn(e,1).length(),a=1/aa.setFromMatrixColumn(e,2).length();return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,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){const t=this.elements,n=e.x,s=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(s),l=Math.sin(s),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const d=a*h,f=a*u,p=o*h,m=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+p*l,t[5]=d-m*l,t[9]=-o*c,t[2]=m-d*l,t[6]=p+f*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*h,f=c*u,p=l*h,m=l*u;t[0]=d+m*o,t[4]=p*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-p,t[6]=m+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*h,f=c*u,p=l*h,m=l*u;t[0]=d-m*o,t[4]=-a*u,t[8]=p+f*o,t[1]=f+p*o,t[5]=a*h,t[9]=m-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*h,f=a*u,p=o*h,m=o*u;t[0]=c*h,t[4]=p*l-f,t[8]=d*l+m,t[1]=c*u,t[5]=m*l+d,t[9]=f*l-p,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,f=a*l,p=o*c,m=o*l;t[0]=c*h,t[4]=m-d*u,t[8]=p*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+p,t[10]=d-m*u}else if(e.order==="XZY"){const d=a*c,f=a*l,p=o*c,m=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+m,t[5]=a*h,t[9]=f*u-p,t[2]=p*u-f,t[6]=o*h,t[10]=m*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(w_,e,v_)}lookAt(e,t,n){const s=this.elements;return Zn.subVectors(e,t),Zn.lengthSq()===0&&(Zn.z=1),Zn.normalize(),Fs.crossVectors(n,Zn),Fs.lengthSq()===0&&(Math.abs(n.z)===1?Zn.x+=1e-4:Zn.z+=1e-4,Zn.normalize(),Fs.crossVectors(n,Zn)),Fs.normalize(),jc.crossVectors(Zn,Fs),s[0]=Fs.x,s[4]=jc.x,s[8]=Zn.x,s[1]=Fs.y,s[5]=jc.y,s[9]=Zn.y,s[2]=Fs.z,s[6]=jc.z,s[10]=Zn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,s=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],p=n[2],m=n[6],g=n[10],A=n[14],_=n[3],x=n[7],E=n[11],S=n[15],w=s[0],I=s[4],T=s[8],C=s[12],v=s[1],F=s[5],K=s[9],q=s[13],$=s[2],D=s[6],O=s[10],Y=s[14],Q=s[3],J=s[7],ee=s[11],ae=s[15];return r[0]=a*w+o*v+c*$+l*Q,r[4]=a*I+o*F+c*D+l*J,r[8]=a*T+o*K+c*O+l*ee,r[12]=a*C+o*q+c*Y+l*ae,r[1]=h*w+u*v+d*$+f*Q,r[5]=h*I+u*F+d*D+f*J,r[9]=h*T+u*K+d*O+f*ee,r[13]=h*C+u*q+d*Y+f*ae,r[2]=p*w+m*v+g*$+A*Q,r[6]=p*I+m*F+g*D+A*J,r[10]=p*T+m*K+g*O+A*ee,r[14]=p*C+m*q+g*Y+A*ae,r[3]=_*w+x*v+E*$+S*Q,r[7]=_*I+x*F+E*D+S*J,r[11]=_*T+x*K+E*O+S*ee,r[15]=_*C+x*q+E*Y+S*ae,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],s=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],p=e[3],m=e[7],g=e[11],A=e[15];return p*(+r*c*u-s*l*u-r*o*d+n*l*d+s*o*f-n*c*f)+m*(+t*c*f-t*l*d+r*a*d-s*a*f+s*l*h-r*c*h)+g*(+t*l*u-t*o*f-r*a*u+n*a*f+r*o*h-n*l*h)+A*(-s*o*h-t*c*u+t*o*d+s*a*u-n*a*d+n*c*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],s=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],p=e[12],m=e[13],g=e[14],A=e[15],_=u*g*l-m*d*l+m*c*f-o*g*f-u*c*A+o*d*A,x=p*d*l-h*g*l-p*c*f+a*g*f+h*c*A-a*d*A,E=h*m*l-p*u*l+p*o*f-a*m*f-h*o*A+a*u*A,S=p*u*c-h*m*c-p*o*d+a*m*d+h*o*g-a*u*g,w=t*_+n*x+s*E+r*S;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/w;return e[0]=_*I,e[1]=(m*d*r-u*g*r-m*s*f+n*g*f+u*s*A-n*d*A)*I,e[2]=(o*g*r-m*c*r+m*s*l-n*g*l-o*s*A+n*c*A)*I,e[3]=(u*c*r-o*d*r-u*s*l+n*d*l+o*s*f-n*c*f)*I,e[4]=x*I,e[5]=(h*g*r-p*d*r+p*s*f-t*g*f-h*s*A+t*d*A)*I,e[6]=(p*c*r-a*g*r-p*s*l+t*g*l+a*s*A-t*c*A)*I,e[7]=(a*d*r-h*c*r+h*s*l-t*d*l-a*s*f+t*c*f)*I,e[8]=E*I,e[9]=(p*u*r-h*m*r-p*n*f+t*m*f+h*n*A-t*u*A)*I,e[10]=(a*m*r-p*o*r+p*n*l-t*m*l-a*n*A+t*o*A)*I,e[11]=(h*o*r-a*u*r-h*n*l+t*u*l+a*n*f-t*o*f)*I,e[12]=S*I,e[13]=(h*m*s-p*u*s+p*n*d-t*m*d-h*n*g+t*u*g)*I,e[14]=(p*o*s-a*m*s-p*n*c+t*m*c+a*n*g-t*o*g)*I,e[15]=(a*u*s-h*o*s+h*n*c-t*u*c-a*n*d+t*o*d)*I,this}scale(e){const t=this.elements,n=e.x,s=e.y,r=e.z;return t[0]*=n,t[4]*=s,t[8]*=r,t[1]*=n,t[5]*=s,t[9]*=r,t[2]*=n,t[6]*=s,t[10]*=r,t[3]*=n,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,s))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),s=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-s*c,l*c+s*o,0,l*o+s*c,h*o+n,h*c-s*a,0,l*c-s*o,h*c+s*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,s,r,a){return this.set(1,n,r,0,e,1,a,0,t,s,1,0,0,0,0,1),this}compose(e,t,n){const s=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,p=r*u,m=a*h,g=a*u,A=o*u,_=c*l,x=c*h,E=c*u,S=n.x,w=n.y,I=n.z;return s[0]=(1-(m+A))*S,s[1]=(f+E)*S,s[2]=(p-x)*S,s[3]=0,s[4]=(f-E)*w,s[5]=(1-(d+A))*w,s[6]=(g+_)*w,s[7]=0,s[8]=(p+x)*I,s[9]=(g-_)*I,s[10]=(1-(d+m))*I,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,n){const s=this.elements;let r=aa.set(s[0],s[1],s[2]).length();const a=aa.set(s[4],s[5],s[6]).length(),o=aa.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Ei.copy(this);const l=1/r,h=1/a,u=1/o;return Ei.elements[0]*=l,Ei.elements[1]*=l,Ei.elements[2]*=l,Ei.elements[4]*=h,Ei.elements[5]*=h,Ei.elements[6]*=h,Ei.elements[8]*=u,Ei.elements[9]*=u,Ei.elements[10]*=u,t.setFromRotationMatrix(Ei),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,s,r,a,o=Xi){const c=this.elements,l=2*r/(t-e),h=2*r/(n-s),u=(t+e)/(t-e),d=(n+s)/(n-s);let f,p;if(o===Xi)f=-(a+r)/(a-r),p=-2*a*r/(a-r);else if(o===Gc)f=-a/(a-r),p=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=f,c[14]=p,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,s,r,a,o=Xi){const c=this.elements,l=1/(t-e),h=1/(n-s),u=1/(a-r),d=(t+e)*l,f=(n+s)*h;let p,m;if(o===Xi)p=(a+r)*u,m=-2*u;else if(o===Gc)p=r*u,m=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-f,c[2]=0,c[6]=0,c[10]=m,c[14]=-p,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let s=0;s<16;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const aa=new G,Ei=new Re,w_=new G(0,0,0),v_=new G(1,1,1),Fs=new G,jc=new G,Zn=new G,gA=new Re,mA=new Yt;class dn{constructor(e=0,t=0,n=0,s=dn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=s}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,s=this._order){return this._x=e,this._y=t,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const s=e.elements,r=s[0],a=s[4],o=s[8],c=s[1],l=s[5],h=s[9],u=s[2],d=s[6],f=s[10];switch(t){case"XYZ":this._y=Math.asin(at(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(-at(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(at(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(-at(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(at(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(-at(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:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return gA.makeRotationFromQuaternion(e),this.setFromRotationMatrix(gA,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return mA.setFromEuler(this),this.setFromQuaternion(mA,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}}dn.DEFAULT_ORDER="XYZ";class xA{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}}let C_=0;const bA=new G,oa=new Yt,$i=new Re,Xc=new G,Eo=new G,I_=new G,S_=new Yt,EA=new G(1,0,0),yA=new G(0,1,0),_A=new G(0,0,1),wA={type:"added"},M_={type:"removed"},ca={type:"childadded",child:null},ku={type:"childremoved",child:null};class Tt extends Ms{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:C_++}),this.uuid=mi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Tt.DEFAULT_UP.clone();const e=new G,t=new dn,n=new Yt,s=new G(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:s},modelViewMatrix:{value:new Re},normalMatrix:{value:new ot}}),this.matrix=new Re,this.matrixWorld=new Re,this.matrixAutoUpdate=Tt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xA,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.multiply(oa),this}rotateOnWorldAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.premultiply(oa),this}rotateX(e){return this.rotateOnAxis(EA,e)}rotateY(e){return this.rotateOnAxis(yA,e)}rotateZ(e){return this.rotateOnAxis(_A,e)}translateOnAxis(e,t){return bA.copy(e).applyQuaternion(this.quaternion),this.position.add(bA.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(EA,e)}translateY(e){return this.translateOnAxis(yA,e)}translateZ(e){return this.translateOnAxis(_A,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4($i.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Xc.copy(e):Xc.set(e,t,n);const s=this.parent;this.updateWorldMatrix(!0,!1),Eo.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$i.lookAt(Eo,Xc,this.up):$i.lookAt(Xc,Eo,this.up),this.quaternion.setFromRotationMatrix($i),s&&($i.extractRotation(s.matrixWorld),oa.setFromRotationMatrix($i),this.quaternion.premultiply(oa.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.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(wA),ca.child=e,this.dispatchEvent(ca),ca.child=null):console.error("THREE.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}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(M_),ku.child=e,this.dispatchEvent(ku),ku.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),$i.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),$i.multiply(e.parent.matrixWorld)),e.applyMatrix4($i),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(wA),ca.child=e,this.dispatchEvent(ca),ca.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,s=this.children.length;n<s;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const s=this.children;for(let r=0,a=s.length;r<a;r++)s[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(Eo,e,I_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Eo,S_,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const 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){const s=this.children;for(let r=0,a=s.length;r<a;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?{min:o.boundingBox.min.toArray(),max:o.boundingBox.max.toArray()}:void 0,boundingSphere:o.boundingSphere?{radius:o.boundingSphere.radius,center:o.boundingSphere.center.toArray()}:void 0})),s.instanceInfo=this._instanceInfo.map(o=>({...o})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()}));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?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));s.material=o}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let o=0;o<this.children.length;o++)s.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];s.animations.push(r(e.animations,c))}}if(t){const 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),p=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),p.length>0&&(n.nodes=p)}return n.object=s,n;function a(o){const c=[];for(const l in o){const 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.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const s=e.children[n];this.add(s.clone())}return this}}Tt.DEFAULT_UP=new G(0,1,0),Tt.DEFAULT_MATRIX_AUTO_UPDATE=!0,Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const yi=new G,es=new G,Uu=new G,ts=new G,la=new G,ha=new G,vA=new G,Ou=new G,Qu=new G,Gu=new G,Hu=new gt,zu=new gt,Vu=new gt;class _i{constructor(e=new G,t=new G,n=new G){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,s){s.subVectors(n,t),yi.subVectors(e,t),s.cross(yi);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,n,s,r){yi.subVectors(s,t),es.subVectors(n,t),Uu.subVectors(e,t);const a=yi.dot(yi),o=yi.dot(es),c=yi.dot(Uu),l=es.dot(es),h=es.dot(Uu),u=a*l-o*o;if(u===0)return r.set(0,0,0),null;const d=1/u,f=(l*c-o*h)*d,p=(a*h-o*c)*d;return r.set(1-f-p,p,f)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,ts)===null?!1:ts.x>=0&&ts.y>=0&&ts.x+ts.y<=1}static getInterpolation(e,t,n,s,r,a,o,c){return this.getBarycoord(e,t,n,s,ts)===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,ts.x),c.addScaledVector(a,ts.y),c.addScaledVector(o,ts.z),c)}static getInterpolatedAttribute(e,t,n,s,r,a){return Hu.setScalar(0),zu.setScalar(0),Vu.setScalar(0),Hu.fromBufferAttribute(e,t),zu.fromBufferAttribute(e,n),Vu.fromBufferAttribute(e,s),a.setScalar(0),a.addScaledVector(Hu,r.x),a.addScaledVector(zu,r.y),a.addScaledVector(Vu,r.z),a}static isFrontFacing(e,t,n,s){return yi.subVectors(n,t),es.subVectors(e,t),yi.cross(es).dot(s)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,s){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,n,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,s),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 yi.subVectors(this.c,this.b),es.subVectors(this.a,this.b),yi.cross(es).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return _i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return _i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,r){return _i.getInterpolation(e,this.a,this.b,this.c,t,n,s,r)}containsPoint(e){return _i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return _i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,s=this.b,r=this.c;let a,o;la.subVectors(s,n),ha.subVectors(r,n),Ou.subVectors(e,n);const c=la.dot(Ou),l=ha.dot(Ou);if(c<=0&&l<=0)return t.copy(n);Qu.subVectors(e,s);const h=la.dot(Qu),u=ha.dot(Qu);if(h>=0&&u<=h)return t.copy(s);const d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(la,a);Gu.subVectors(e,r);const f=la.dot(Gu),p=ha.dot(Gu);if(p>=0&&f<=p)return t.copy(r);const m=f*l-c*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(ha,o);const g=h*p-f*u;if(g<=0&&u-h>=0&&f-p>=0)return vA.subVectors(r,s),o=(u-h)/(u-h+(f-p)),t.copy(s).addScaledVector(vA,o);const A=1/(g+m+d);return a=m*A,o=d*A,t.copy(n).addScaledVector(la,a).addScaledVector(ha,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const CA={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},Ns={h:0,s:0,l:0},Yc={h:0,s:0,l:0};function Wu(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let Fe=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){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=yt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,s=tt.workingColorSpace){return this.r=e,this.g=t,this.b=n,tt.toWorkingColorSpace(this,s),this}setHSL(e,t,n,s=tt.workingColorSpace){if(e=Su(e,1),t=at(t,0,1),n=at(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=Wu(a,r,e+1/3),this.g=Wu(a,r,e),this.b=Wu(a,r,e-1/3)}return tt.toWorkingColorSpace(this,s),this}setStyle(e,t=yt){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=s[1],o=s[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:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[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);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=yt){const n=CA[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Yi(e.r),this.g=Yi(e.g),this.b=Yi(e.b),this}copyLinearToSRGB(e){return this.r=ta(e.r),this.g=ta(e.g),this.b=ta(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yt){return tt.fromWorkingColorSpace(Nn.copy(this),e),Math.round(at(Nn.r*255,0,255))*65536+Math.round(at(Nn.g*255,0,255))*256+Math.round(at(Nn.b*255,0,255))}getHexString(e=yt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tt.workingColorSpace){tt.fromWorkingColorSpace(Nn.copy(this),t);const n=Nn.r,s=Nn.g,r=Nn.b,a=Math.max(n,s,r),o=Math.min(n,s,r);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(s-r)/u+(s<r?6:0);break;case s:c=(r-n)/u+2;break;case r:c=(n-s)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=tt.workingColorSpace){return tt.fromWorkingColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=yt){tt.fromWorkingColorSpace(Nn.copy(this),e);const t=Nn.r,n=Nn.g,s=Nn.b;return e!==yt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(e,t,n){return this.getHSL(Ns),this.setHSL(Ns.h+e,Ns.s+t,Ns.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(Ns),e.getHSL(Yc);const n=Ao(Ns.h,Yc.h,t),s=Ao(Ns.s,Yc.s,t),r=Ao(Ns.l,Yc.l,t);return this.setHSL(n,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*s,this.g=r[1]*t+r[4]*n+r[7]*s,this.b=r[2]*t+r[5]*n+r[8]*s,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}};const Nn=new Fe;Fe.NAMES=CA;let B_=0;class ri extends Ms{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:B_++}),this.uuid=mi(),this.name="",this.type="Material",this.blending=jr,this.side=Ki,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Hh,this.blendDst=zh,this.blendEquation=ir,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Fe(0,0,0),this.blendAlpha=0,this.depthFunc=Xr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=rA,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$r,this.stencilZFail=$r,this.stencilZPass=$r,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(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==jr&&(n.blending=this.blending),this.side!==Ki&&(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!==Hh&&(n.blendSrc=this.blendSrc),this.blendDst!==zh&&(n.blendDst=this.blendDst),this.blendEquation!==ir&&(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!==Xr&&(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!==rA&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==$r&&(n.stencilFail=this.stencilFail),this.stencilZFail!==$r&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==$r&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){const a=[];for(const o in r){const c=r[o];delete c.metadata,a.push(c)}return a}if(t){const r=s(e.textures),a=s(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;const t=e.clippingPlanes;let n=null;if(t!==null){const s=t.length;n=new Array(s);for(let r=0;r!==s;++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.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++}}class Ds extends ri{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Fe(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 dn,this.combine=Cc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ns=T_();function T_(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),s=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,s[c]=24,s[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,s[c]=-l-1,s[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,s[c]=13,s[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,s[c]=24,s[c|256]=24):(n[c]=31744,n[c|256]=64512,s[c]=13,s[c|256]=13)}const r=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,h=0;for(;(l&8388608)===0;)l<<=1,h-=8388608;l&=-8388609,h+=947912704,r[c]=l|h}for(let c=1024;c<2048;++c)r[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)a[c]=c<<23;a[31]=1199570944,a[32]=2147483648;for(let c=33;c<63;++c)a[c]=2147483648+(c-32<<23);a[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(o[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:s,mantissaTable:r,exponentTable:a,offsetTable:o}}function R_(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=at(i,-65504,65504),ns.floatView[0]=i;const e=ns.uint32View[0],t=e>>23&511;return ns.baseTable[t]+((e&8388607)>>ns.shiftTable[t])}function F_(i){const e=i>>10;return ns.uint32View[0]=ns.mantissaTable[ns.offsetTable[e]+(i&1023)]+ns.exponentTable[e],ns.floatView[0]}class IA{static toHalfFloat(e){return R_(e)}static fromHalfFloat(e){return F_(e)}}const sn=new G,Jc=new Je;let N_=0;class Sn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:N_++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Iu,this.updateRanges=[],this.gpuType=ln,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 s=0,r=this.itemSize;s<r;s++)this.array[e+s]=t.array[n+s];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++)Jc.fromBufferAttribute(this,t),Jc.applyMatrix3(e),this.setXY(t,Jc.x,Jc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyMatrix3(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyMatrix4(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyNormalMatrix(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.transformDirection(e),this.setXYZ(t,sn.x,sn.y,sn.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=xi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Bt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=xi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=xi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Bt(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=xi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Bt(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=xi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,s){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array),r=Bt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,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(){const 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!==Iu&&(e.usage=this.usage),e}}class qu extends Sn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class SA extends Sn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Jt extends Sn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let D_=0;const ai=new Re,Ku=new Tt,ua=new G,$n=new Pi,yo=new Pi,bn=new G;class Mn extends Ms{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:D_++}),this.uuid=mi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(lA(e)?SA:qu)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,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){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new ot().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ai.makeRotationFromQuaternion(e),this.applyMatrix4(ai),this}rotateX(e){return ai.makeRotationX(e),this.applyMatrix4(ai),this}rotateY(e){return ai.makeRotationY(e),this.applyMatrix4(ai),this}rotateZ(e){return ai.makeRotationZ(e),this.applyMatrix4(ai),this}translate(e,t,n){return ai.makeTranslation(e,t,n),this.applyMatrix4(ai),this}scale(e,t,n){return ai.makeScale(e,t,n),this.applyMatrix4(ai),this}lookAt(e){return Ku.lookAt(e),Ku.updateMatrix(),this.applyMatrix4(Ku.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ua).negate(),this.translate(ua.x,ua.y,ua.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let s=0,r=e.length;s<r;s++){const a=e[s];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Jt(n,3))}else{const n=Math.min(e.length,t.count);for(let s=0;s<n;s++){const r=e[s];t.setXYZ(s,r.x,r.y,r.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Pi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new G(-1/0,-1/0,-1/0),new G(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n<s;n++){const r=t[n];$n.setFromBufferAttribute(r),this.morphTargetsRelative?(bn.addVectors(this.boundingBox.min,$n.min),this.boundingBox.expandByPoint(bn),bn.addVectors(this.boundingBox.max,$n.max),this.boundingBox.expandByPoint(bn)):(this.boundingBox.expandByPoint($n.min),this.boundingBox.expandByPoint($n.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 ki);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new G,1/0);return}if(e){const n=this.boundingSphere.center;if($n.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];yo.setFromBufferAttribute(o),this.morphTargetsRelative?(bn.addVectors($n.min,yo.min),$n.expandByPoint(bn),bn.addVectors($n.max,yo.max),$n.expandByPoint(bn)):($n.expandByPoint(yo.min),$n.expandByPoint(yo.max))}$n.getCenter(n);let s=0;for(let r=0,a=e.count;r<a;r++)bn.fromBufferAttribute(e,r),s=Math.max(s,n.distanceToSquared(bn));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)bn.fromBufferAttribute(o,l),c&&(ua.fromBufferAttribute(e,l),bn.add(ua)),s=Math.max(s,n.distanceToSquared(bn))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,s=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Sn(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let T=0;T<n.count;T++)o[T]=new G,c[T]=new G;const l=new G,h=new G,u=new G,d=new Je,f=new Je,p=new Je,m=new G,g=new G;function A(T,C,v){l.fromBufferAttribute(n,T),h.fromBufferAttribute(n,C),u.fromBufferAttribute(n,v),d.fromBufferAttribute(r,T),f.fromBufferAttribute(r,C),p.fromBufferAttribute(r,v),h.sub(l),u.sub(l),f.sub(d),p.sub(d);const F=1/(f.x*p.y-p.x*f.y);isFinite(F)&&(m.copy(h).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(F),g.copy(u).multiplyScalar(f.x).addScaledVector(h,-p.x).multiplyScalar(F),o[T].add(m),o[C].add(m),o[v].add(m),c[T].add(g),c[C].add(g),c[v].add(g))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let T=0,C=_.length;T<C;++T){const v=_[T],F=v.start,K=v.count;for(let q=F,$=F+K;q<$;q+=3)A(e.getX(q+0),e.getX(q+1),e.getX(q+2))}const x=new G,E=new G,S=new G,w=new G;function I(T){S.fromBufferAttribute(s,T),w.copy(S);const C=o[T];x.copy(C),x.sub(S.multiplyScalar(S.dot(C))).normalize(),E.crossVectors(w,C);const F=E.dot(c[T])<0?-1:1;a.setXYZW(T,x.x,x.y,x.z,F)}for(let T=0,C=_.length;T<C;++T){const v=_[T],F=v.start,K=v.count;for(let q=F,$=F+K;q<$;q+=3)I(e.getX(q+0)),I(e.getX(q+1)),I(e.getX(q+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Sn(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);const s=new G,r=new G,a=new G,o=new G,c=new G,l=new G,h=new G,u=new G;if(e)for(let d=0,f=e.count;d<f;d+=3){const p=e.getX(d+0),m=e.getX(d+1),g=e.getX(d+2);s.fromBufferAttribute(t,p),r.fromBufferAttribute(t,m),a.fromBufferAttribute(t,g),h.subVectors(a,r),u.subVectors(s,r),h.cross(u),o.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),l.fromBufferAttribute(n,g),o.add(h),c.add(h),l.add(h),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,c.x,c.y,c.z),n.setXYZ(g,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)s.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,r),u.subVectors(s,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(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)bn.fromBufferAttribute(e,t),bn.normalize(),e.setXYZ(t,bn.x,bn.y,bn.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h);let f=0,p=0;for(let m=0,g=c.length;m<g;m++){o.isInterleavedBufferAttribute?f=c[m]*o.data.stride+o.offset:f=c[m]*h;for(let A=0;A<h;A++)d[p++]=l[f++]}return new Sn(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Mn,n=this.index.array,s=this.attributes;for(const o in s){const c=s[o],l=e(c,n);t.setAttribute(o,l)}const r=this.morphAttributes;for(const o in r){const c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){const d=l[h],f=e(d,n);c.push(f)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){const f=l[u];h.push(f.toJSON(e.data))}h.length>0&&(s[c]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const s=e.attributes;for(const l in s){const h=s[l];this.setAttribute(l,h.clone(t))}const r=e.morphAttributes;for(const l in r){const 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;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const 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"})}}const MA=new Re,hr=new bo,Zc=new ki,BA=new G,$c=new G,el=new G,tl=new G,ju=new G,nl=new G,TA=new G,il=new G;class Zt extends Tt{constructor(e=new Mn,t=new Ds){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){const o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(s,e);const o=this.morphTargetInfluences;if(r&&o){nl.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const h=o[c],u=r[c];h!==0&&(ju.fromBufferAttribute(u,e),a?nl.addScaledVector(ju,h):nl.addScaledVector(ju.sub(t),h))}t.add(nl)}return t}raycast(e,t){const n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Zc.copy(n.boundingSphere),Zc.applyMatrix4(r),hr.copy(e.ray).recast(e.near),!(Zc.containsPoint(hr.origin)===!1&&(hr.intersectSphere(Zc,BA)===null||hr.origin.distanceToSquared(BA)>(e.far-e.near)**2))&&(MA.copy(r).invert(),hr.copy(e.ray).applyMatrix4(MA),!(n.boundingBox!==null&&hr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,hr)))}_computeIntersections(e,t,n){let s;const 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 p=0,m=d.length;p<m;p++){const g=d[p],A=a[g.materialIndex],_=Math.max(g.start,f.start),x=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let E=_,S=x;E<S;E+=3){const w=o.getX(E),I=o.getX(E+1),T=o.getX(E+2);s=sl(this,A,e,n,l,h,u,w,I,T),s&&(s.faceIndex=Math.floor(E/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{const p=Math.max(0,f.start),m=Math.min(o.count,f.start+f.count);for(let g=p,A=m;g<A;g+=3){const _=o.getX(g),x=o.getX(g+1),E=o.getX(g+2);s=sl(this,a,e,n,l,h,u,_,x,E),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}else if(c!==void 0)if(Array.isArray(a))for(let p=0,m=d.length;p<m;p++){const g=d[p],A=a[g.materialIndex],_=Math.max(g.start,f.start),x=Math.min(c.count,Math.min(g.start+g.count,f.start+f.count));for(let E=_,S=x;E<S;E+=3){const w=E,I=E+1,T=E+2;s=sl(this,A,e,n,l,h,u,w,I,T),s&&(s.faceIndex=Math.floor(E/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{const p=Math.max(0,f.start),m=Math.min(c.count,f.start+f.count);for(let g=p,A=m;g<A;g+=3){const _=g,x=g+1,E=g+2;s=sl(this,a,e,n,l,h,u,_,x,E),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}}}function L_(i,e,t,n,s,r,a,o){let c;if(e.side===Dn?c=n.intersectTriangle(a,r,s,!0,o):c=n.intersectTriangle(s,r,a,e.side===Ki,o),c===null)return null;il.copy(o),il.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(il);return l<t.near||l>t.far?null:{distance:l,point:il.clone(),object:i}}function sl(i,e,t,n,s,r,a,o,c,l){i.getVertexPosition(o,$c),i.getVertexPosition(c,el),i.getVertexPosition(l,tl);const h=L_(i,e,t,n,$c,el,tl,TA);if(h){const u=new G;_i.getBarycoord(TA,$c,el,tl,u),s&&(h.uv=_i.getInterpolatedAttribute(s,o,c,l,u,new Je)),r&&(h.uv1=_i.getInterpolatedAttribute(r,o,c,l,u,new Je)),a&&(h.normal=_i.getInterpolatedAttribute(a,o,c,l,u,new G),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new G,materialIndex:0};_i.getNormal($c,el,tl,d.normal),h.face=d,h.barycoord=u}return h}class da extends Mn{constructor(e=1,t=1,n=1,s=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:s,heightSegments:r,depthSegments:a};const o=this;s=Math.floor(s),r=Math.floor(r),a=Math.floor(a);const c=[],l=[],h=[],u=[];let d=0,f=0;p("z","y","x",-1,-1,n,t,e,a,r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,s,a,2),p("x","z","y",1,-1,e,n,-t,s,a,3),p("x","y","z",1,-1,e,t,n,s,r,4),p("x","y","z",-1,-1,e,t,-n,s,r,5),this.setIndex(c),this.setAttribute("position",new Jt(l,3)),this.setAttribute("normal",new Jt(h,3)),this.setAttribute("uv",new Jt(u,2));function p(m,g,A,_,x,E,S,w,I,T,C){const v=E/I,F=S/T,K=E/2,q=S/2,$=w/2,D=I+1,O=T+1;let Y=0,Q=0;const J=new G;for(let ee=0;ee<O;ee++){const ae=ee*F-q;for(let _e=0;_e<D;_e++){const Me=_e*v-K;J[m]=Me*_,J[g]=ae*x,J[A]=$,l.push(J.x,J.y,J.z),J[m]=0,J[g]=0,J[A]=w>0?1:-1,h.push(J.x,J.y,J.z),u.push(_e/I),u.push(1-ee/T),Y+=1}}for(let ee=0;ee<T;ee++)for(let ae=0;ae<I;ae++){const _e=d+ae+D*ee,Me=d+ae+D*(ee+1),se=d+(ae+1)+D*(ee+1),me=d+(ae+1)+D*ee;c.push(_e,Me,me),c.push(Me,se,me),Q+=6}o.addGroup(f,Q,C),f+=Q,d+=Y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new da(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function fa(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const s=i[t][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=s.clone():Array.isArray(s)?e[t][n]=s.slice():e[t][n]=s}}return e}function kn(i){const e={};for(let t=0;t<i.length;t++){const n=fa(i[t]);for(const s in n)e[s]=n[s]}return e}function P_(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function RA(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:tt.workingColorSpace}const k_={clone:fa,merge:kn};var U_=`void main() {
+(function(on,nr){typeof exports=="object"&&typeof module<"u"?nr(exports):typeof define=="function"&&define.amd?define(["exports"],nr):(on=typeof globalThis<"u"?globalThis:on||self,nr(on.Agent3D={}))})(this,(function(on){"use strict";var nr=typeof document<"u"?document.currentScript:null;const Ic="176",qr={ROTATE:0,DOLLY:1,PAN:2},Kr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},hy=0,Hp=1,uy=2,zp=1,dy=2,Ki=3,ji=0,Ln=1,Pi=2,Cs=0,jr=1,Vp=2,Wp=3,qp=4,fy=5,ir=100,py=101,Ay=102,gy=103,my=104,xy=200,by=201,Ey=202,yy=203,Vh=204,Wh=205,_y=206,wy=207,vy=208,Cy=209,Iy=210,Sy=211,My=212,By=213,Ty=214,qh=0,Kh=1,jh=2,Xr=3,Xh=4,Yh=5,Jh=6,Zh=7,Sc=0,Ry=1,Fy=2,Is=0,$h=1,Ny=2,Dy=3,Kp=4,Ly=5,Py=6,ky=7,jp="attached",Uy="detached",Xp=300,sr=301,Yr=302,Mc=303,eu=304,Bc=306,Ss=1e3,Zn=1001,Tc=1002,Pn=1003,Yp=1004,no=1005,qt=1006,Rc=1007,ri=1008,cn=1009,Jp=1010,Zp=1011,io=1012,tu=1013,rr=1014,ln=1015,kn=1016,nu=1017,iu=1018,so=1020,$p=35902,eA=1021,tA=1022,hn=1023,ro=1026,ao=1027,Xi=1028,su=1029,ar=1030,ru=1031,au=1033,Fc=33776,oo=33777,Nc=33778,co=33779,Dc=35840,ou=35841,Lc=35842,cu=35843,Pc=36196,kc=37492,Uc=37496,lo=37808,lu=37809,hu=37810,uu=37811,ho=37812,du=37813,fu=37814,pu=37815,Au=37816,gu=37817,mu=37818,xu=37819,bu=37820,Eu=37821,uo=36492,yu=36494,Oc=36495,nA=36283,_u=36284,wu=36285,vu=36286,iA=2200,sA=2201,Oy=2202,fo=2300,po=2301,Cu=2302,Jr=2400,Zr=2401,Qc=2402,Iu=2500,Qy=2501,Gy=0,rA=1,Su=2,Hy=3200,zy=3201,Gc=0,Vy=1,mi="",yt="srgb",un="srgb-linear",Hc="linear",Rt="srgb",$r=7680,aA=519,Wy=512,qy=513,Ky=514,oA=515,jy=516,Xy=517,Yy=518,Jy=519,Mu=35044,cA="300 es",Yi=2e3,zc=2001;class Ms{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const s=n[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,e);e.target=null}}}const Fn=["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"];let lA=1234567;const Ao=Math.PI/180,ea=180/Math.PI;function xi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Fn[i&255]+Fn[i>>8&255]+Fn[i>>16&255]+Fn[i>>24&255]+"-"+Fn[e&255]+Fn[e>>8&255]+"-"+Fn[e>>16&15|64]+Fn[e>>24&255]+"-"+Fn[t&63|128]+Fn[t>>8&255]+"-"+Fn[t>>16&255]+Fn[t>>24&255]+Fn[n&255]+Fn[n>>8&255]+Fn[n>>16&255]+Fn[n>>24&255]).toLowerCase()}function at(i,e,t){return Math.max(e,Math.min(t,i))}function Bu(i,e){return(i%e+e)%e}function Zy(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function $y(i,e,t){return i!==e?(t-i)/(e-i):0}function go(i,e,t){return(1-t)*i+t*e}function e_(i,e,t,n){return go(i,e,1-Math.exp(-t*n))}function t_(i,e=1){return e-Math.abs(Bu(i,e*2)-e)}function n_(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function i_(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function s_(i,e){return i+Math.floor(Math.random()*(e-i+1))}function r_(i,e){return i+Math.random()*(e-i)}function a_(i){return i*(.5-Math.random())}function o_(i){i!==void 0&&(lA=i);let e=lA+=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 c_(i){return i*Ao}function l_(i){return i*ea}function h_(i){return(i&i-1)===0&&i!==0}function u_(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function d_(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function f_(i,e,t,n,s){const 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),p=a((n-e)/2);switch(s){case"XYX":i.set(o*h,c*u,c*d,o*l);break;case"YZY":i.set(c*d,o*h,c*u,o*l);break;case"ZXZ":i.set(c*u,c*d,o*h,o*l);break;case"XZX":i.set(o*h,c*p,c*f,o*l);break;case"YXY":i.set(c*f,o*h,c*p,o*l);break;case"ZYZ":i.set(c*p,c*f,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function bi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Bt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const In={DEG2RAD:Ao,RAD2DEG:ea,generateUUID:xi,clamp:at,euclideanModulo:Bu,mapLinear:Zy,inverseLerp:$y,lerp:go,damp:e_,pingpong:t_,smoothstep:n_,smootherstep:i_,randInt:s_,randFloat:r_,randFloatSpread:a_,seededRandom:o_,degToRad:c_,radToDeg:l_,isPowerOfTwo:h_,ceilPowerOfTwo:u_,floorPowerOfTwo:d_,setQuaternionFromProperEuler:f_,normalize:Bt,denormalize:bi};class Je{constructor(e=0,t=0){Je.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[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=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(at(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),s=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*s+e.x,this.y=r*s+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ot{constructor(e,t,n,s,r,a,o,c,l){ot.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,a,o,c,l)}set(e,t,n,s,r,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=s,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){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,s=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],p=n[8],m=s[0],g=s[3],A=s[6],_=s[1],x=s[4],E=s[7],S=s[2],w=s[5],I=s[8];return r[0]=a*m+o*_+c*S,r[3]=a*g+o*x+c*w,r[6]=a*A+o*E+c*I,r[1]=l*m+h*_+u*S,r[4]=l*g+h*x+u*w,r[7]=l*A+h*E+u*I,r[2]=d*m+f*_+p*S,r[5]=d*g+f*x+p*w,r[8]=d*A+f*E+p*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],s=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+s*r*l-s*a*c}invert(){const e=this.elements,t=e[0],n=e[1],s=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,p=t*u+n*d+s*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=u*m,e[1]=(s*l-h*n)*m,e[2]=(o*n-s*a)*m,e[3]=d*m,e[4]=(h*t-s*c)*m,e[5]=(s*r-o*t)*m,e[6]=f*m,e[7]=(n*c-l*t)*m,e[8]=(a*t-n*r)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,r,a,o){const c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-s*l,s*c,-s*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Tu.makeScale(e,t)),this}rotate(e){return this.premultiply(Tu.makeRotation(-e)),this}translate(e,t){return this.premultiply(Tu.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Tu=new ot;function hA(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function mo(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function p_(){const i=mo("canvas");return i.style.display="block",i}const uA={};function Vc(i){i in uA||(uA[i]=!0,console.warn(i))}function A_(i,e,t){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}function g_(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function m_(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const dA=new ot().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),fA=new ot().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function x_(){const i={enabled:!0,workingColorSpace:un,spaces:{},convert:function(s,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Rt&&(s.r=Ji(s.r),s.g=Ji(s.g),s.b=Ji(s.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Rt&&(s.r=ta(s.r),s.g=ta(s.g),s.b=ta(s.b))),s},fromWorkingColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},toWorkingColorSpace:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===mi?Hc:this.spaces[s].transfer},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,a){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[un]:{primaries:e,whitePoint:n,transfer:Hc,toXYZ:dA,fromXYZ:fA,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:yt},outputColorSpaceConfig:{drawingBufferColorSpace:yt}},[yt]:{primaries:e,whitePoint:n,transfer:Rt,toXYZ:dA,fromXYZ:fA,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:yt}}}),i}const tt=x_();function Ji(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ta(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let na;class b_{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{na===void 0&&(na=mo("canvas")),na.width=e.width,na.height=e.height;const s=na.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=na}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){const t=mo("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const s=n.getImageData(0,0,e.width,e.height),r=s.data;for(let a=0;a<r.length;a++)r[a]=Ji(r[a]/255)*255;return n.putImageData(s,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Ji(t[n]/255)*255):t[n]=Ji(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let E_=0;class Ru{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:E_++}),this.uuid=xi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let a=0,o=s.length;a<o;a++)s[a].isDataTexture?r.push(Fu(s[a].image)):r.push(Fu(s[a]))}else r=Fu(s);n.url=r}return t||(e.images[this.uuid]=n),n}}function Fu(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?b_.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let y_=0;class nn extends Ms{constructor(e=nn.DEFAULT_IMAGE,t=nn.DEFAULT_MAPPING,n=Zn,s=Zn,r=qt,a=ri,o=hn,c=cn,l=nn.DEFAULT_ANISOTROPY,h=mi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:y_++}),this.uuid=xi(),this.name="",this.source=new Ru(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Je(0,0),this.repeat=new Je(1,1),this.center=new Je(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ot,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isTextureArray=e.isTextureArray,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Xp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ss:e.x=e.x-Math.floor(e.x);break;case Zn:e.x=e.x<0?0:1;break;case Tc: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 Ss:e.y=e.y-Math.floor(e.y);break;case Zn:e.y=e.y<0?0:1;break;case Tc: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++}}nn.DEFAULT_IMAGE=null,nn.DEFAULT_MAPPING=Xp,nn.DEFAULT_ANISOTROPY=1;class gt{constructor(e=0,t=0,n=0,s=1){gt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=s}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,s){return this.x=e,this.y=t,this.z=n,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,s=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*s+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*s+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*s+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*s+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);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,s,r;const c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],p=c[9],m=c[2],g=c[6],A=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-m)<.01&&Math.abs(p-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+m)<.1&&Math.abs(p+g)<.1&&Math.abs(l+f+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(l+1)/2,E=(f+1)/2,S=(A+1)/2,w=(h+d)/4,I=(u+m)/4,T=(p+g)/4;return x>E&&x>S?x<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(x),s=w/n,r=I/n):E>S?E<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(E),n=w/s,r=T/s):S<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(S),n=I/r,s=T/r),this.set(n,s,r,t),this}let _=Math.sqrt((g-p)*(g-p)+(u-m)*(u-m)+(d-h)*(d-h));return Math.abs(_)<.001&&(_=1),this.x=(g-p)/_,this.y=(u-m)/_,this.z=(d-h)/_,this.w=Math.acos((l+f+A-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this.z=at(this.z,e.z,t.z),this.w=at(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this.z=at(this.z,e,t),this.w=at(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class __ extends Ms{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth?n.depth:1,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t);const s={width:e,height:t,depth:this.depth};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},n);const r=new nn(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const 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.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}get texture(){return this.textures[0]}set texture(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 s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=n;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;const s=Object.assign({},e.textures[t].image);this.textures[t].source=new Ru(s)}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}dispose(){this.dispatchEvent({type:"dispose"})}}class or extends __{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class pA extends nn{constructor(e=null,t=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Pn,this.minFilter=Pn,this.wrapR=Zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class AA extends nn{constructor(e=null,t=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Pn,this.minFilter=Pn,this.wrapR=Zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Yt{constructor(e=0,t=0,n=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=s}static slerpFlat(e,t,n,s,r,a,o){let c=n[s+0],l=n[s+1],h=n[s+2],u=n[s+3];const d=r[a+0],f=r[a+1],p=r[a+2],m=r[a+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||c!==d||l!==f||h!==p){let g=1-o;const A=c*d+l*f+h*p+u*m,_=A>=0?1:-1,x=1-A*A;if(x>Number.EPSILON){const S=Math.sqrt(x),w=Math.atan2(S,A*_);g=Math.sin(g*w)/S,o=Math.sin(o*w)/S}const E=o*_;if(c=c*g+d*E,l=l*g+f*E,h=h*g+p*E,u=u*g+m*E,g===1-o){const S=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=S,l*=S,h*=S,u*=S}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,s,r,a){const o=n[s],c=n[s+1],l=n[s+2],h=n[s+3],u=r[a],d=r[a+1],f=r[a+2],p=r[a+3];return e[t]=o*p+h*u+c*f-l*d,e[t+1]=c*p+h*d+l*u-o*f,e[t+2]=l*p+h*f+o*d-c*u,e[t+3]=h*p-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,s){return this._x=e,this._y=t,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,s=e._y,r=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(s/2),u=o(r/2),d=c(n/2),f=c(s/2),p=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u-d*f*p;break;case"YXZ":this._x=d*h*u+l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u+d*f*p;break;case"ZXY":this._x=d*h*u-l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u-d*f*p;break;case"ZYX":this._x=d*h*u-l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u+d*f*p;break;case"YZX":this._x=d*h*u+l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u-d*f*p;break;case"XZY":this._x=d*h*u-l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u+d*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,s=Math.sin(n);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],s=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){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(r-l)*f,this._z=(a-s)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-c)/f,this._x=.25*f,this._y=(s+a)/f,this._z=(r+l)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(r-l)/f,this._x=(s+a)/f,this._y=.25*f,this._z=(c+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-s)/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<Number.EPSILON?(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(at(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const s=Math.min(1,t/n);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,s=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+s*l-r*c,this._y=s*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-s*o,this._w=a*h-n*o-s*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,s=this._y,r=this._z,a=this._w;let o=a*e._w+n*e._x+s*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=s,this._z=r,this;const c=1-o*o;if(c<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*s+t*this._y,this._z=f*r+t*this._z,this.normalize(),this}const l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=s*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class G{constructor(e=0,t=0,n=0){G.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(gA.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(gA.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*s,this.y=r[1]*t+r[4]*n+r[7]*s,this.z=r[2]*t+r[5]*n+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,s=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*s+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*s+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*s+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,s=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*s-o*n),h=2*(o*t-r*s),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=s+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){const t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*s,this.y=r[1]*t+r[5]*n+r[9]*s,this.z=r[2]*t+r[6]*n+r[10]*s,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=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this.z=at(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this.z=at(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,s=e.y,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=s*c-r*o,this.y=r*a-n*c,this.z=n*o-s*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Nu.copy(this).projectOnVector(e),this.sub(Nu)}reflect(e){return this.sub(Nu.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(at(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,s=this.z-e.z;return t*t+n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const s=Math.sin(t)*e;return this.x=s*Math.sin(n),this.y=Math.cos(t)*e,this.z=s*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Nu=new G,gA=new Yt;class ki{constructor(e=new G(1/0,1/0,1/0),t=new G(-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(Ei.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ei.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){const n=Ei.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);const n=e.geometry;if(n!==void 0){const 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,Ei):Ei.fromBufferAttribute(r,a),Ei.applyMatrix4(e.matrixWorld),this.expandByPoint(Ei);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Wc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Wc.copy(n.boundingBox)),Wc.applyMatrix4(e.matrixWorld),this.union(Wc)}const s=e.children;for(let r=0,a=s.length;r<a;r++)this.expandByObject(s[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,Ei),Ei.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(xo),qc.subVectors(this.max,xo),ia.subVectors(e.a,xo),sa.subVectors(e.b,xo),ra.subVectors(e.c,xo),Bs.subVectors(sa,ia),Ts.subVectors(ra,sa),cr.subVectors(ia,ra);let t=[0,-Bs.z,Bs.y,0,-Ts.z,Ts.y,0,-cr.z,cr.y,Bs.z,0,-Bs.x,Ts.z,0,-Ts.x,cr.z,0,-cr.x,-Bs.y,Bs.x,0,-Ts.y,Ts.x,0,-cr.y,cr.x,0];return!Du(t,ia,sa,ra,qc)||(t=[1,0,0,0,1,0,0,0,1],!Du(t,ia,sa,ra,qc))?!1:(Kc.crossVectors(Bs,Ts),t=[Kc.x,Kc.y,Kc.z],Du(t,ia,sa,ra,qc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ei).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ei).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:(Zi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Zi=[new G,new G,new G,new G,new G,new G,new G,new G],Ei=new G,Wc=new ki,ia=new G,sa=new G,ra=new G,Bs=new G,Ts=new G,cr=new G,xo=new G,qc=new G,Kc=new G,lr=new G;function Du(i,e,t,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){lr.fromArray(i,r);const o=s.x*Math.abs(lr.x)+s.y*Math.abs(lr.y)+s.z*Math.abs(lr.z),c=e.dot(lr),l=t.dot(lr),h=n.dot(lr);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const w_=new ki,bo=new G,Lu=new G;class Ui{constructor(e=new G,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):w_.setFromPoints(e).getCenter(n);let s=0;for(let r=0,a=e.length;r<a;r++)s=Math.max(s,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),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){const 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){const 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;bo.subVectors(e,this.center);const t=bo.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(bo,s/n),this.radius+=s}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):(Lu.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(bo.copy(e.center).add(Lu)),this.expandByPoint(bo.copy(e.center).sub(Lu))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const $i=new G,Pu=new G,jc=new G,Rs=new G,ku=new G,Xc=new G,Uu=new G;class Eo{constructor(e=new G,t=new G(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,$i)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$i.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($i.copy(this.origin).addScaledVector(this.direction,t),$i.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){Pu.copy(e).add(t).multiplyScalar(.5),jc.copy(t).sub(e).normalize(),Rs.copy(this.origin).sub(Pu);const r=e.distanceTo(t)*.5,a=-this.direction.dot(jc),o=Rs.dot(this.direction),c=-Rs.dot(jc),l=Rs.lengthSq(),h=Math.abs(1-a*a);let u,d,f,p;if(h>0)if(u=a*c-o,d=a*o-c,p=r*h,u>=0)if(d>=-p)if(d<=p){const m=1/h;u*=m,d*=m,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<=-p?(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<=p?(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),s&&s.copy(Pu).addScaledVector(jc,d),f}intersectSphere(e,t){$i.subVectors(e.center,this.origin);const n=$i.dot(this.direction),s=$i.dot($i)-n*n,r=e.radius*e.radius;if(s>r)return null;const a=Math.sqrt(r-s),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,s,r,a,o,c;const 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,s=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,s=(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>s||((r>n||isNaN(n))&&(n=r),(a<s||isNaN(s))&&(s=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>s)||((o>n||n!==n)&&(n=o),(c<s||s!==s)&&(s=c),s<0)?null:this.at(n>=0?n:s,t)}intersectsBox(e){return this.intersectBox(e,$i)!==null}intersectTriangle(e,t,n,s,r){ku.subVectors(t,e),Xc.subVectors(n,e),Uu.crossVectors(ku,Xc);let a=this.direction.dot(Uu),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Rs.subVectors(this.origin,e);const c=o*this.direction.dot(Xc.crossVectors(Rs,Xc));if(c<0)return null;const l=o*this.direction.dot(ku.cross(Rs));if(l<0||c+l>a)return null;const h=-o*Rs.dot(Uu);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)}}class Re{constructor(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g){Re.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g)}set(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g){const A=this.elements;return A[0]=e,A[4]=t,A[8]=n,A[12]=s,A[1]=r,A[5]=a,A[9]=o,A[13]=c,A[2]=l,A[6]=h,A[10]=u,A[14]=d,A[3]=f,A[7]=p,A[11]=m,A[15]=g,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 Re().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,s=1/aa.setFromMatrixColumn(e,0).length(),r=1/aa.setFromMatrixColumn(e,1).length(),a=1/aa.setFromMatrixColumn(e,2).length();return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,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){const t=this.elements,n=e.x,s=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(s),l=Math.sin(s),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const d=a*h,f=a*u,p=o*h,m=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+p*l,t[5]=d-m*l,t[9]=-o*c,t[2]=m-d*l,t[6]=p+f*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*h,f=c*u,p=l*h,m=l*u;t[0]=d+m*o,t[4]=p*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-p,t[6]=m+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*h,f=c*u,p=l*h,m=l*u;t[0]=d-m*o,t[4]=-a*u,t[8]=p+f*o,t[1]=f+p*o,t[5]=a*h,t[9]=m-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*h,f=a*u,p=o*h,m=o*u;t[0]=c*h,t[4]=p*l-f,t[8]=d*l+m,t[1]=c*u,t[5]=m*l+d,t[9]=f*l-p,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,f=a*l,p=o*c,m=o*l;t[0]=c*h,t[4]=m-d*u,t[8]=p*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+p,t[10]=d-m*u}else if(e.order==="XZY"){const d=a*c,f=a*l,p=o*c,m=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+m,t[5]=a*h,t[9]=f*u-p,t[2]=p*u-f,t[6]=o*h,t[10]=m*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(v_,e,C_)}lookAt(e,t,n){const s=this.elements;return $n.subVectors(e,t),$n.lengthSq()===0&&($n.z=1),$n.normalize(),Fs.crossVectors(n,$n),Fs.lengthSq()===0&&(Math.abs(n.z)===1?$n.x+=1e-4:$n.z+=1e-4,$n.normalize(),Fs.crossVectors(n,$n)),Fs.normalize(),Yc.crossVectors($n,Fs),s[0]=Fs.x,s[4]=Yc.x,s[8]=$n.x,s[1]=Fs.y,s[5]=Yc.y,s[9]=$n.y,s[2]=Fs.z,s[6]=Yc.z,s[10]=$n.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,s=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],p=n[2],m=n[6],g=n[10],A=n[14],_=n[3],x=n[7],E=n[11],S=n[15],w=s[0],I=s[4],T=s[8],C=s[12],v=s[1],F=s[5],K=s[9],q=s[13],$=s[2],D=s[6],O=s[10],Y=s[14],Q=s[3],J=s[7],ee=s[11],ae=s[15];return r[0]=a*w+o*v+c*$+l*Q,r[4]=a*I+o*F+c*D+l*J,r[8]=a*T+o*K+c*O+l*ee,r[12]=a*C+o*q+c*Y+l*ae,r[1]=h*w+u*v+d*$+f*Q,r[5]=h*I+u*F+d*D+f*J,r[9]=h*T+u*K+d*O+f*ee,r[13]=h*C+u*q+d*Y+f*ae,r[2]=p*w+m*v+g*$+A*Q,r[6]=p*I+m*F+g*D+A*J,r[10]=p*T+m*K+g*O+A*ee,r[14]=p*C+m*q+g*Y+A*ae,r[3]=_*w+x*v+E*$+S*Q,r[7]=_*I+x*F+E*D+S*J,r[11]=_*T+x*K+E*O+S*ee,r[15]=_*C+x*q+E*Y+S*ae,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],s=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],p=e[3],m=e[7],g=e[11],A=e[15];return p*(+r*c*u-s*l*u-r*o*d+n*l*d+s*o*f-n*c*f)+m*(+t*c*f-t*l*d+r*a*d-s*a*f+s*l*h-r*c*h)+g*(+t*l*u-t*o*f-r*a*u+n*a*f+r*o*h-n*l*h)+A*(-s*o*h-t*c*u+t*o*d+s*a*u-n*a*d+n*c*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],s=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],p=e[12],m=e[13],g=e[14],A=e[15],_=u*g*l-m*d*l+m*c*f-o*g*f-u*c*A+o*d*A,x=p*d*l-h*g*l-p*c*f+a*g*f+h*c*A-a*d*A,E=h*m*l-p*u*l+p*o*f-a*m*f-h*o*A+a*u*A,S=p*u*c-h*m*c-p*o*d+a*m*d+h*o*g-a*u*g,w=t*_+n*x+s*E+r*S;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/w;return e[0]=_*I,e[1]=(m*d*r-u*g*r-m*s*f+n*g*f+u*s*A-n*d*A)*I,e[2]=(o*g*r-m*c*r+m*s*l-n*g*l-o*s*A+n*c*A)*I,e[3]=(u*c*r-o*d*r-u*s*l+n*d*l+o*s*f-n*c*f)*I,e[4]=x*I,e[5]=(h*g*r-p*d*r+p*s*f-t*g*f-h*s*A+t*d*A)*I,e[6]=(p*c*r-a*g*r-p*s*l+t*g*l+a*s*A-t*c*A)*I,e[7]=(a*d*r-h*c*r+h*s*l-t*d*l-a*s*f+t*c*f)*I,e[8]=E*I,e[9]=(p*u*r-h*m*r-p*n*f+t*m*f+h*n*A-t*u*A)*I,e[10]=(a*m*r-p*o*r+p*n*l-t*m*l-a*n*A+t*o*A)*I,e[11]=(h*o*r-a*u*r-h*n*l+t*u*l+a*n*f-t*o*f)*I,e[12]=S*I,e[13]=(h*m*s-p*u*s+p*n*d-t*m*d-h*n*g+t*u*g)*I,e[14]=(p*o*s-a*m*s-p*n*c+t*m*c+a*n*g-t*o*g)*I,e[15]=(a*u*s-h*o*s+h*n*c-t*u*c-a*n*d+t*o*d)*I,this}scale(e){const t=this.elements,n=e.x,s=e.y,r=e.z;return t[0]*=n,t[4]*=s,t[8]*=r,t[1]*=n,t[5]*=s,t[9]*=r,t[2]*=n,t[6]*=s,t[10]*=r,t[3]*=n,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,s))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),s=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-s*c,l*c+s*o,0,l*o+s*c,h*o+n,h*c-s*a,0,l*c-s*o,h*c+s*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,s,r,a){return this.set(1,n,r,0,e,1,a,0,t,s,1,0,0,0,0,1),this}compose(e,t,n){const s=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,p=r*u,m=a*h,g=a*u,A=o*u,_=c*l,x=c*h,E=c*u,S=n.x,w=n.y,I=n.z;return s[0]=(1-(m+A))*S,s[1]=(f+E)*S,s[2]=(p-x)*S,s[3]=0,s[4]=(f-E)*w,s[5]=(1-(d+A))*w,s[6]=(g+_)*w,s[7]=0,s[8]=(p+x)*I,s[9]=(g-_)*I,s[10]=(1-(d+m))*I,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,n){const s=this.elements;let r=aa.set(s[0],s[1],s[2]).length();const a=aa.set(s[4],s[5],s[6]).length(),o=aa.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],yi.copy(this);const l=1/r,h=1/a,u=1/o;return yi.elements[0]*=l,yi.elements[1]*=l,yi.elements[2]*=l,yi.elements[4]*=h,yi.elements[5]*=h,yi.elements[6]*=h,yi.elements[8]*=u,yi.elements[9]*=u,yi.elements[10]*=u,t.setFromRotationMatrix(yi),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,s,r,a,o=Yi){const c=this.elements,l=2*r/(t-e),h=2*r/(n-s),u=(t+e)/(t-e),d=(n+s)/(n-s);let f,p;if(o===Yi)f=-(a+r)/(a-r),p=-2*a*r/(a-r);else if(o===zc)f=-a/(a-r),p=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=f,c[14]=p,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,s,r,a,o=Yi){const c=this.elements,l=1/(t-e),h=1/(n-s),u=1/(a-r),d=(t+e)*l,f=(n+s)*h;let p,m;if(o===Yi)p=(a+r)*u,m=-2*u;else if(o===zc)p=r*u,m=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-f,c[2]=0,c[6]=0,c[10]=m,c[14]=-p,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let s=0;s<16;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const aa=new G,yi=new Re,v_=new G(0,0,0),C_=new G(1,1,1),Fs=new G,Yc=new G,$n=new G,mA=new Re,xA=new Yt;class dn{constructor(e=0,t=0,n=0,s=dn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=s}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,s=this._order){return this._x=e,this._y=t,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const s=e.elements,r=s[0],a=s[4],o=s[8],c=s[1],l=s[5],h=s[9],u=s[2],d=s[6],f=s[10];switch(t){case"XYZ":this._y=Math.asin(at(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(-at(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(at(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(-at(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(at(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(-at(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:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return mA.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mA,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return xA.setFromEuler(this),this.setFromQuaternion(xA,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}}dn.DEFAULT_ORDER="XYZ";class bA{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}}let I_=0;const EA=new G,oa=new Yt,es=new Re,Jc=new G,yo=new G,S_=new G,M_=new Yt,yA=new G(1,0,0),_A=new G(0,1,0),wA=new G(0,0,1),vA={type:"added"},B_={type:"removed"},ca={type:"childadded",child:null},Ou={type:"childremoved",child:null};class Tt extends Ms{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:I_++}),this.uuid=xi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Tt.DEFAULT_UP.clone();const e=new G,t=new dn,n=new Yt,s=new G(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:s},modelViewMatrix:{value:new Re},normalMatrix:{value:new ot}}),this.matrix=new Re,this.matrixWorld=new Re,this.matrixAutoUpdate=Tt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new bA,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.multiply(oa),this}rotateOnWorldAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.premultiply(oa),this}rotateX(e){return this.rotateOnAxis(yA,e)}rotateY(e){return this.rotateOnAxis(_A,e)}rotateZ(e){return this.rotateOnAxis(wA,e)}translateOnAxis(e,t){return EA.copy(e).applyQuaternion(this.quaternion),this.position.add(EA.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(yA,e)}translateY(e){return this.translateOnAxis(_A,e)}translateZ(e){return this.translateOnAxis(wA,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(es.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Jc.copy(e):Jc.set(e,t,n);const s=this.parent;this.updateWorldMatrix(!0,!1),yo.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?es.lookAt(yo,Jc,this.up):es.lookAt(Jc,yo,this.up),this.quaternion.setFromRotationMatrix(es),s&&(es.extractRotation(s.matrixWorld),oa.setFromRotationMatrix(es),this.quaternion.premultiply(oa.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.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(vA),ca.child=e,this.dispatchEvent(ca),ca.child=null):console.error("THREE.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}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(B_),Ou.child=e,this.dispatchEvent(Ou),Ou.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),es.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),es.multiply(e.parent.matrixWorld)),e.applyMatrix4(es),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(vA),ca.child=e,this.dispatchEvent(ca),ca.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,s=this.children.length;n<s;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const s=this.children;for(let r=0,a=s.length;r<a;r++)s[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(yo,e,S_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yo,M_,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const 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){const s=this.children;for(let r=0,a=s.length;r<a;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?{min:o.boundingBox.min.toArray(),max:o.boundingBox.max.toArray()}:void 0,boundingSphere:o.boundingSphere?{radius:o.boundingSphere.radius,center:o.boundingSphere.center.toArray()}:void 0})),s.instanceInfo=this._instanceInfo.map(o=>({...o})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()}));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?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));s.material=o}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let o=0;o<this.children.length;o++)s.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];s.animations.push(r(e.animations,c))}}if(t){const 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),p=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),p.length>0&&(n.nodes=p)}return n.object=s,n;function a(o){const c=[];for(const l in o){const 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.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const s=e.children[n];this.add(s.clone())}return this}}Tt.DEFAULT_UP=new G(0,1,0),Tt.DEFAULT_MATRIX_AUTO_UPDATE=!0,Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const _i=new G,ts=new G,Qu=new G,ns=new G,la=new G,ha=new G,CA=new G,Gu=new G,Hu=new G,zu=new G,Vu=new gt,Wu=new gt,qu=new gt;class wi{constructor(e=new G,t=new G,n=new G){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,s){s.subVectors(n,t),_i.subVectors(e,t),s.cross(_i);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,n,s,r){_i.subVectors(s,t),ts.subVectors(n,t),Qu.subVectors(e,t);const a=_i.dot(_i),o=_i.dot(ts),c=_i.dot(Qu),l=ts.dot(ts),h=ts.dot(Qu),u=a*l-o*o;if(u===0)return r.set(0,0,0),null;const d=1/u,f=(l*c-o*h)*d,p=(a*h-o*c)*d;return r.set(1-f-p,p,f)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,ns)===null?!1:ns.x>=0&&ns.y>=0&&ns.x+ns.y<=1}static getInterpolation(e,t,n,s,r,a,o,c){return this.getBarycoord(e,t,n,s,ns)===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,ns.x),c.addScaledVector(a,ns.y),c.addScaledVector(o,ns.z),c)}static getInterpolatedAttribute(e,t,n,s,r,a){return Vu.setScalar(0),Wu.setScalar(0),qu.setScalar(0),Vu.fromBufferAttribute(e,t),Wu.fromBufferAttribute(e,n),qu.fromBufferAttribute(e,s),a.setScalar(0),a.addScaledVector(Vu,r.x),a.addScaledVector(Wu,r.y),a.addScaledVector(qu,r.z),a}static isFrontFacing(e,t,n,s){return _i.subVectors(n,t),ts.subVectors(e,t),_i.cross(ts).dot(s)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,s){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,n,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,s),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 _i.subVectors(this.c,this.b),ts.subVectors(this.a,this.b),_i.cross(ts).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return wi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return wi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,r){return wi.getInterpolation(e,this.a,this.b,this.c,t,n,s,r)}containsPoint(e){return wi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return wi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,s=this.b,r=this.c;let a,o;la.subVectors(s,n),ha.subVectors(r,n),Gu.subVectors(e,n);const c=la.dot(Gu),l=ha.dot(Gu);if(c<=0&&l<=0)return t.copy(n);Hu.subVectors(e,s);const h=la.dot(Hu),u=ha.dot(Hu);if(h>=0&&u<=h)return t.copy(s);const d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(la,a);zu.subVectors(e,r);const f=la.dot(zu),p=ha.dot(zu);if(p>=0&&f<=p)return t.copy(r);const m=f*l-c*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(ha,o);const g=h*p-f*u;if(g<=0&&u-h>=0&&f-p>=0)return CA.subVectors(r,s),o=(u-h)/(u-h+(f-p)),t.copy(s).addScaledVector(CA,o);const A=1/(g+m+d);return a=m*A,o=d*A,t.copy(n).addScaledVector(la,a).addScaledVector(ha,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const IA={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},Ns={h:0,s:0,l:0},Zc={h:0,s:0,l:0};function Ku(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let Fe=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){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=yt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,s=tt.workingColorSpace){return this.r=e,this.g=t,this.b=n,tt.toWorkingColorSpace(this,s),this}setHSL(e,t,n,s=tt.workingColorSpace){if(e=Bu(e,1),t=at(t,0,1),n=at(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=Ku(a,r,e+1/3),this.g=Ku(a,r,e),this.b=Ku(a,r,e-1/3)}return tt.toWorkingColorSpace(this,s),this}setStyle(e,t=yt){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=s[1],o=s[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:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[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);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=yt){const n=IA[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ji(e.r),this.g=Ji(e.g),this.b=Ji(e.b),this}copyLinearToSRGB(e){return this.r=ta(e.r),this.g=ta(e.g),this.b=ta(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yt){return tt.fromWorkingColorSpace(Nn.copy(this),e),Math.round(at(Nn.r*255,0,255))*65536+Math.round(at(Nn.g*255,0,255))*256+Math.round(at(Nn.b*255,0,255))}getHexString(e=yt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tt.workingColorSpace){tt.fromWorkingColorSpace(Nn.copy(this),t);const n=Nn.r,s=Nn.g,r=Nn.b,a=Math.max(n,s,r),o=Math.min(n,s,r);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(s-r)/u+(s<r?6:0);break;case s:c=(r-n)/u+2;break;case r:c=(n-s)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=tt.workingColorSpace){return tt.fromWorkingColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=yt){tt.fromWorkingColorSpace(Nn.copy(this),e);const t=Nn.r,n=Nn.g,s=Nn.b;return e!==yt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(e,t,n){return this.getHSL(Ns),this.setHSL(Ns.h+e,Ns.s+t,Ns.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(Ns),e.getHSL(Zc);const n=go(Ns.h,Zc.h,t),s=go(Ns.s,Zc.s,t),r=go(Ns.l,Zc.l,t);return this.setHSL(n,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*s,this.g=r[1]*t+r[4]*n+r[7]*s,this.b=r[2]*t+r[5]*n+r[8]*s,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}};const Nn=new Fe;Fe.NAMES=IA;let T_=0;class ai extends Ms{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:T_++}),this.uuid=xi(),this.name="",this.type="Material",this.blending=jr,this.side=ji,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Vh,this.blendDst=Wh,this.blendEquation=ir,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Fe(0,0,0),this.blendAlpha=0,this.depthFunc=Xr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=aA,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$r,this.stencilZFail=$r,this.stencilZPass=$r,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(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==jr&&(n.blending=this.blending),this.side!==ji&&(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!==Vh&&(n.blendSrc=this.blendSrc),this.blendDst!==Wh&&(n.blendDst=this.blendDst),this.blendEquation!==ir&&(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!==Xr&&(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!==aA&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==$r&&(n.stencilFail=this.stencilFail),this.stencilZFail!==$r&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==$r&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){const a=[];for(const o in r){const c=r[o];delete c.metadata,a.push(c)}return a}if(t){const r=s(e.textures),a=s(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;const t=e.clippingPlanes;let n=null;if(t!==null){const s=t.length;n=new Array(s);for(let r=0;r!==s;++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.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++}}class Ds extends ai{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Fe(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 dn,this.combine=Sc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const is=R_();function R_(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),s=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,s[c]=24,s[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,s[c]=-l-1,s[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,s[c]=13,s[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,s[c]=24,s[c|256]=24):(n[c]=31744,n[c|256]=64512,s[c]=13,s[c|256]=13)}const r=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,h=0;for(;(l&8388608)===0;)l<<=1,h-=8388608;l&=-8388609,h+=947912704,r[c]=l|h}for(let c=1024;c<2048;++c)r[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)a[c]=c<<23;a[31]=1199570944,a[32]=2147483648;for(let c=33;c<63;++c)a[c]=2147483648+(c-32<<23);a[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(o[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:s,mantissaTable:r,exponentTable:a,offsetTable:o}}function F_(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=at(i,-65504,65504),is.floatView[0]=i;const e=is.uint32View[0],t=e>>23&511;return is.baseTable[t]+((e&8388607)>>is.shiftTable[t])}function N_(i){const e=i>>10;return is.uint32View[0]=is.mantissaTable[is.offsetTable[e]+(i&1023)]+is.exponentTable[e],is.floatView[0]}class SA{static toHalfFloat(e){return F_(e)}static fromHalfFloat(e){return N_(e)}}const sn=new G,$c=new Je;let D_=0;class Sn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:D_++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Mu,this.updateRanges=[],this.gpuType=ln,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 s=0,r=this.itemSize;s<r;s++)this.array[e+s]=t.array[n+s];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++)$c.fromBufferAttribute(this,t),$c.applyMatrix3(e),this.setXY(t,$c.x,$c.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyMatrix3(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyMatrix4(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyNormalMatrix(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.transformDirection(e),this.setXYZ(t,sn.x,sn.y,sn.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=bi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Bt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=bi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=bi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Bt(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=bi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Bt(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=bi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,s){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array),r=Bt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,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(){const 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!==Mu&&(e.usage=this.usage),e}}class ju extends Sn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class MA extends Sn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Jt extends Sn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let L_=0;const oi=new Re,Xu=new Tt,ua=new G,ei=new ki,_o=new ki,bn=new G;class Mn extends Ms{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:L_++}),this.uuid=xi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(hA(e)?MA:ju)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,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){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new ot().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return oi.makeRotationFromQuaternion(e),this.applyMatrix4(oi),this}rotateX(e){return oi.makeRotationX(e),this.applyMatrix4(oi),this}rotateY(e){return oi.makeRotationY(e),this.applyMatrix4(oi),this}rotateZ(e){return oi.makeRotationZ(e),this.applyMatrix4(oi),this}translate(e,t,n){return oi.makeTranslation(e,t,n),this.applyMatrix4(oi),this}scale(e,t,n){return oi.makeScale(e,t,n),this.applyMatrix4(oi),this}lookAt(e){return Xu.lookAt(e),Xu.updateMatrix(),this.applyMatrix4(Xu.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ua).negate(),this.translate(ua.x,ua.y,ua.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let s=0,r=e.length;s<r;s++){const a=e[s];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Jt(n,3))}else{const n=Math.min(e.length,t.count);for(let s=0;s<n;s++){const r=e[s];t.setXYZ(s,r.x,r.y,r.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ki);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new G(-1/0,-1/0,-1/0),new G(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n<s;n++){const r=t[n];ei.setFromBufferAttribute(r),this.morphTargetsRelative?(bn.addVectors(this.boundingBox.min,ei.min),this.boundingBox.expandByPoint(bn),bn.addVectors(this.boundingBox.max,ei.max),this.boundingBox.expandByPoint(bn)):(this.boundingBox.expandByPoint(ei.min),this.boundingBox.expandByPoint(ei.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 Ui);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new G,1/0);return}if(e){const n=this.boundingSphere.center;if(ei.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];_o.setFromBufferAttribute(o),this.morphTargetsRelative?(bn.addVectors(ei.min,_o.min),ei.expandByPoint(bn),bn.addVectors(ei.max,_o.max),ei.expandByPoint(bn)):(ei.expandByPoint(_o.min),ei.expandByPoint(_o.max))}ei.getCenter(n);let s=0;for(let r=0,a=e.count;r<a;r++)bn.fromBufferAttribute(e,r),s=Math.max(s,n.distanceToSquared(bn));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)bn.fromBufferAttribute(o,l),c&&(ua.fromBufferAttribute(e,l),bn.add(ua)),s=Math.max(s,n.distanceToSquared(bn))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,s=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Sn(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let T=0;T<n.count;T++)o[T]=new G,c[T]=new G;const l=new G,h=new G,u=new G,d=new Je,f=new Je,p=new Je,m=new G,g=new G;function A(T,C,v){l.fromBufferAttribute(n,T),h.fromBufferAttribute(n,C),u.fromBufferAttribute(n,v),d.fromBufferAttribute(r,T),f.fromBufferAttribute(r,C),p.fromBufferAttribute(r,v),h.sub(l),u.sub(l),f.sub(d),p.sub(d);const F=1/(f.x*p.y-p.x*f.y);isFinite(F)&&(m.copy(h).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(F),g.copy(u).multiplyScalar(f.x).addScaledVector(h,-p.x).multiplyScalar(F),o[T].add(m),o[C].add(m),o[v].add(m),c[T].add(g),c[C].add(g),c[v].add(g))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let T=0,C=_.length;T<C;++T){const v=_[T],F=v.start,K=v.count;for(let q=F,$=F+K;q<$;q+=3)A(e.getX(q+0),e.getX(q+1),e.getX(q+2))}const x=new G,E=new G,S=new G,w=new G;function I(T){S.fromBufferAttribute(s,T),w.copy(S);const C=o[T];x.copy(C),x.sub(S.multiplyScalar(S.dot(C))).normalize(),E.crossVectors(w,C);const F=E.dot(c[T])<0?-1:1;a.setXYZW(T,x.x,x.y,x.z,F)}for(let T=0,C=_.length;T<C;++T){const v=_[T],F=v.start,K=v.count;for(let q=F,$=F+K;q<$;q+=3)I(e.getX(q+0)),I(e.getX(q+1)),I(e.getX(q+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Sn(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);const s=new G,r=new G,a=new G,o=new G,c=new G,l=new G,h=new G,u=new G;if(e)for(let d=0,f=e.count;d<f;d+=3){const p=e.getX(d+0),m=e.getX(d+1),g=e.getX(d+2);s.fromBufferAttribute(t,p),r.fromBufferAttribute(t,m),a.fromBufferAttribute(t,g),h.subVectors(a,r),u.subVectors(s,r),h.cross(u),o.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),l.fromBufferAttribute(n,g),o.add(h),c.add(h),l.add(h),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,c.x,c.y,c.z),n.setXYZ(g,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)s.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,r),u.subVectors(s,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(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)bn.fromBufferAttribute(e,t),bn.normalize(),e.setXYZ(t,bn.x,bn.y,bn.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h);let f=0,p=0;for(let m=0,g=c.length;m<g;m++){o.isInterleavedBufferAttribute?f=c[m]*o.data.stride+o.offset:f=c[m]*h;for(let A=0;A<h;A++)d[p++]=l[f++]}return new Sn(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Mn,n=this.index.array,s=this.attributes;for(const o in s){const c=s[o],l=e(c,n);t.setAttribute(o,l)}const r=this.morphAttributes;for(const o in r){const c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){const d=l[h],f=e(d,n);c.push(f)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){const f=l[u];h.push(f.toJSON(e.data))}h.length>0&&(s[c]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const s=e.attributes;for(const l in s){const h=s[l];this.setAttribute(l,h.clone(t))}const r=e.morphAttributes;for(const l in r){const 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;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const 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"})}}const BA=new Re,hr=new Eo,el=new Ui,TA=new G,tl=new G,nl=new G,il=new G,Yu=new G,sl=new G,RA=new G,rl=new G;class Zt extends Tt{constructor(e=new Mn,t=new Ds){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){const o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(s,e);const o=this.morphTargetInfluences;if(r&&o){sl.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const h=o[c],u=r[c];h!==0&&(Yu.fromBufferAttribute(u,e),a?sl.addScaledVector(Yu,h):sl.addScaledVector(Yu.sub(t),h))}t.add(sl)}return t}raycast(e,t){const n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),el.copy(n.boundingSphere),el.applyMatrix4(r),hr.copy(e.ray).recast(e.near),!(el.containsPoint(hr.origin)===!1&&(hr.intersectSphere(el,TA)===null||hr.origin.distanceToSquared(TA)>(e.far-e.near)**2))&&(BA.copy(r).invert(),hr.copy(e.ray).applyMatrix4(BA),!(n.boundingBox!==null&&hr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,hr)))}_computeIntersections(e,t,n){let s;const 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 p=0,m=d.length;p<m;p++){const g=d[p],A=a[g.materialIndex],_=Math.max(g.start,f.start),x=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let E=_,S=x;E<S;E+=3){const w=o.getX(E),I=o.getX(E+1),T=o.getX(E+2);s=al(this,A,e,n,l,h,u,w,I,T),s&&(s.faceIndex=Math.floor(E/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{const p=Math.max(0,f.start),m=Math.min(o.count,f.start+f.count);for(let g=p,A=m;g<A;g+=3){const _=o.getX(g),x=o.getX(g+1),E=o.getX(g+2);s=al(this,a,e,n,l,h,u,_,x,E),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}else if(c!==void 0)if(Array.isArray(a))for(let p=0,m=d.length;p<m;p++){const g=d[p],A=a[g.materialIndex],_=Math.max(g.start,f.start),x=Math.min(c.count,Math.min(g.start+g.count,f.start+f.count));for(let E=_,S=x;E<S;E+=3){const w=E,I=E+1,T=E+2;s=al(this,A,e,n,l,h,u,w,I,T),s&&(s.faceIndex=Math.floor(E/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{const p=Math.max(0,f.start),m=Math.min(c.count,f.start+f.count);for(let g=p,A=m;g<A;g+=3){const _=g,x=g+1,E=g+2;s=al(this,a,e,n,l,h,u,_,x,E),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}}}function P_(i,e,t,n,s,r,a,o){let c;if(e.side===Ln?c=n.intersectTriangle(a,r,s,!0,o):c=n.intersectTriangle(s,r,a,e.side===ji,o),c===null)return null;rl.copy(o),rl.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(rl);return l<t.near||l>t.far?null:{distance:l,point:rl.clone(),object:i}}function al(i,e,t,n,s,r,a,o,c,l){i.getVertexPosition(o,tl),i.getVertexPosition(c,nl),i.getVertexPosition(l,il);const h=P_(i,e,t,n,tl,nl,il,RA);if(h){const u=new G;wi.getBarycoord(RA,tl,nl,il,u),s&&(h.uv=wi.getInterpolatedAttribute(s,o,c,l,u,new Je)),r&&(h.uv1=wi.getInterpolatedAttribute(r,o,c,l,u,new Je)),a&&(h.normal=wi.getInterpolatedAttribute(a,o,c,l,u,new G),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new G,materialIndex:0};wi.getNormal(tl,nl,il,d.normal),h.face=d,h.barycoord=u}return h}class da extends Mn{constructor(e=1,t=1,n=1,s=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:s,heightSegments:r,depthSegments:a};const o=this;s=Math.floor(s),r=Math.floor(r),a=Math.floor(a);const c=[],l=[],h=[],u=[];let d=0,f=0;p("z","y","x",-1,-1,n,t,e,a,r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,s,a,2),p("x","z","y",1,-1,e,n,-t,s,a,3),p("x","y","z",1,-1,e,t,n,s,r,4),p("x","y","z",-1,-1,e,t,-n,s,r,5),this.setIndex(c),this.setAttribute("position",new Jt(l,3)),this.setAttribute("normal",new Jt(h,3)),this.setAttribute("uv",new Jt(u,2));function p(m,g,A,_,x,E,S,w,I,T,C){const v=E/I,F=S/T,K=E/2,q=S/2,$=w/2,D=I+1,O=T+1;let Y=0,Q=0;const J=new G;for(let ee=0;ee<O;ee++){const ae=ee*F-q;for(let _e=0;_e<D;_e++){const Me=_e*v-K;J[m]=Me*_,J[g]=ae*x,J[A]=$,l.push(J.x,J.y,J.z),J[m]=0,J[g]=0,J[A]=w>0?1:-1,h.push(J.x,J.y,J.z),u.push(_e/I),u.push(1-ee/T),Y+=1}}for(let ee=0;ee<T;ee++)for(let ae=0;ae<I;ae++){const _e=d+ae+D*ee,Me=d+ae+D*(ee+1),se=d+(ae+1)+D*(ee+1),me=d+(ae+1)+D*ee;c.push(_e,Me,me),c.push(Me,se,me),Q+=6}o.addGroup(f,Q,C),f+=Q,d+=Y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new da(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function fa(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const s=i[t][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=s.clone():Array.isArray(s)?e[t][n]=s.slice():e[t][n]=s}}return e}function Un(i){const e={};for(let t=0;t<i.length;t++){const n=fa(i[t]);for(const s in n)e[s]=n[s]}return e}function k_(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function FA(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:tt.workingColorSpace}const U_={clone:fa,merge:Un};var O_=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-}`,O_=`void main() {
+}`,Q_=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
-}`;class Ls extends ri{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=U_,this.fragmentShader=O_,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=fa(e.uniforms),this.uniformsGroups=P_(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const a=this.uniforms[s].value;a&&a.isTexture?t.uniforms[s]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[s]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[s]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[s]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[s]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[s]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[s]={type:"m4",value:a.toArray()}:t.uniforms[s]={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;const n={};for(const s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class FA extends Tt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Re,this.projectionMatrix=new Re,this.projectionMatrixInverse=new Re,this.coordinateSystem=Xi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ps=new G,NA=new Je,DA=new Je;class Bn extends FA{constructor(e=50,t=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ea*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(po*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ea*2*Math.atan(Math.tan(po*.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){Ps.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ps.x,Ps.y).multiplyScalar(-e/Ps.z),Ps.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ps.x,Ps.y).multiplyScalar(-e/Ps.z)}getViewSize(e,t){return this.getViewBounds(e,NA,DA),t.subVectors(DA,NA)}setViewOffset(e,t,n,s,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=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(po*.5*this.fov)/this.zoom,n=2*t,s=this.aspect*n,r=-.5*s;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*s/c,t-=a.offsetY*n/l,s*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const pa=-90,Aa=1;class Q_ extends Tt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Bn(pa,Aa,e,t);s.layers=this.layers,this.add(s);const r=new Bn(pa,Aa,e,t);r.layers=this.layers,this.add(r);const a=new Bn(pa,Aa,e,t);a.layers=this.layers,this.add(a);const o=new Bn(pa,Aa,e,t);o.layers=this.layers,this.add(o);const c=new Bn(pa,Aa,e,t);c.layers=this.layers,this.add(c);const l=new Bn(pa,Aa,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,s,r,a,o,c]=t;for(const l of t)this.remove(l);if(e===Xi)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.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===Gc)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.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(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,s),e.render(t,r),e.setRenderTarget(n,1,s),e.render(t,a),e.setRenderTarget(n,2,s),e.render(t,o),e.setRenderTarget(n,3,s),e.render(t,c),e.setRenderTarget(n,4,s),e.render(t,l),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,s),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class LA extends nn{constructor(e=[],t=sr,n,s,r,a,o,c,l,h){super(e,t,n,s,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class G_ extends or{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];this.texture=new LA(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:qt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
+}`;class Ls extends ai{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=O_,this.fragmentShader=Q_,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=fa(e.uniforms),this.uniformsGroups=k_(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const a=this.uniforms[s].value;a&&a.isTexture?t.uniforms[s]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[s]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[s]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[s]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[s]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[s]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[s]={type:"m4",value:a.toArray()}:t.uniforms[s]={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;const n={};for(const s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class NA extends Tt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Re,this.projectionMatrix=new Re,this.projectionMatrixInverse=new Re,this.coordinateSystem=Yi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ps=new G,DA=new Je,LA=new Je;class Bn extends NA{constructor(e=50,t=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ea*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ao*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ea*2*Math.atan(Math.tan(Ao*.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){Ps.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ps.x,Ps.y).multiplyScalar(-e/Ps.z),Ps.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ps.x,Ps.y).multiplyScalar(-e/Ps.z)}getViewSize(e,t){return this.getViewBounds(e,DA,LA),t.subVectors(LA,DA)}setViewOffset(e,t,n,s,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=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ao*.5*this.fov)/this.zoom,n=2*t,s=this.aspect*n,r=-.5*s;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*s/c,t-=a.offsetY*n/l,s*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const pa=-90,Aa=1;class G_ extends Tt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Bn(pa,Aa,e,t);s.layers=this.layers,this.add(s);const r=new Bn(pa,Aa,e,t);r.layers=this.layers,this.add(r);const a=new Bn(pa,Aa,e,t);a.layers=this.layers,this.add(a);const o=new Bn(pa,Aa,e,t);o.layers=this.layers,this.add(o);const c=new Bn(pa,Aa,e,t);c.layers=this.layers,this.add(c);const l=new Bn(pa,Aa,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,s,r,a,o,c]=t;for(const l of t)this.remove(l);if(e===Yi)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.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===zc)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.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(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,s),e.render(t,r),e.setRenderTarget(n,1,s),e.render(t,a),e.setRenderTarget(n,2,s),e.render(t,o),e.setRenderTarget(n,3,s),e.render(t,c),e.setRenderTarget(n,4,s),e.render(t,l),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,s),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class PA extends nn{constructor(e=[],t=sr,n,s,r,a,o,c,l,h){super(e,t,n,s,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class H_ extends or{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];this.texture=new PA(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:qt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
@@ -37,9 +37,9 @@
gl_FragColor = texture2D( tEquirect, sampleUV );
}
- `},s=new da(5,5,5),r=new Ls({name:"CubemapFromEquirect",uniforms:fa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Dn,blending:Cs});r.uniforms.tEquirect.value=t;const a=new Zt(s,r),o=t.minFilter;return t.minFilter===si&&(t.minFilter=qt),new Q_(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,s=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,s);e.setRenderTarget(r)}}class is extends Tt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const H_={type:"move"};class Xu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new is,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 is,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new is,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let s=null,r=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,n),A=this._getHandJoint(l,m);g!==null&&(A.matrix.fromArray(g.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=g.radius),A.visible=g!==null}const h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,p=.005;l.inputState.pinching&&d>f+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-p&&(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));o!==null&&(s=t.getPose(e.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(H_)))}return o!==null&&(o.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new is;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Yu extends Tt{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 dn,this.environmentIntensity=1,this.environmentRotation=new dn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class z_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Iu,this.updateRanges=[],this.version=0,this.uuid=mi()}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 s=0,r=this.stride;s<r;s++)this.array[e+s]=t.array[n+s];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=mi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const 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=mi()),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}}}const Un=new G;class Ju{constructor(e,t,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=s}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++)Un.fromBufferAttribute(this,t),Un.applyMatrix4(e),this.setXYZ(t,Un.x,Un.y,Un.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Un.fromBufferAttribute(this,t),Un.applyNormalMatrix(e),this.setXYZ(t,Un.x,Un.y,Un.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Un.fromBufferAttribute(this,t),Un.transformDirection(e),this.setXYZ(t,Un.x,Un.y,Un.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=xi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Bt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Bt(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=xi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=xi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=xi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=xi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array),r=Bt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}return new Sn(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 Ju(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+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}}}const PA=new G,kA=new gt,UA=new gt,V_=new G,OA=new Re,rl=new G,Zu=new ki,QA=new Re,$u=new bo;class GA extends Zt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Kp,this.bindMatrix=new Re,this.bindMatrixInverse=new Re,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Pi),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,rl),this.boundingBox.expandByPoint(rl)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ki),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,rl),this.boundingSphere.expandByPoint(rl)}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){const n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Zu.copy(this.boundingSphere),Zu.applyMatrix4(s),e.ray.intersectsSphere(Zu)!==!1&&(QA.copy(s).invert(),$u.copy(e.ray).applyMatrix4(QA),!(this.boundingBox!==null&&$u.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,$u)))}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(){const e=new gt,t=this.geometry.attributes.skinWeight;for(let n=0,s=t.count;n<s;n++){e.fromBufferAttribute(t,n);const 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===Kp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ky?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,s=this.geometry;kA.fromBufferAttribute(s.attributes.skinIndex,e),UA.fromBufferAttribute(s.attributes.skinWeight,e),PA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=UA.getComponent(r);if(a!==0){const o=kA.getComponent(r);OA.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(V_.copy(PA).applyMatrix4(OA),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class al extends Tt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ol extends nn{constructor(e=null,t=1,n=1,s,r,a,o,c,l=Ln,h=Ln,u,d){super(null,a,o,c,l,h,s,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const HA=new Re,W_=new Re;class cl{constructor(e=[],t=[]){this.uuid=mi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const 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){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new Re)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Re;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++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const 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(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let r=0,a=e.length;r<a;r++){const o=e[r]?e[r].matrixWorld:W_;HA.multiplyMatrices(o,t[r]),HA.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new cl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ol(t,e,e,hn,ln);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const s=this.bones[t];if(s.name===e)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,s=e.bones.length;n<s;n++){const r=e.bones[n];let a=t[r];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new al),this.bones.push(a),this.boneInverses.push(new Re().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let s=0,r=t.length;s<r;s++){const a=t[s];e.bones.push(a.uuid);const o=n[s];e.boneInverses.push(o.toArray())}return e}}class ed extends Sn{constructor(e,t,n,s=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ga=new Re,zA=new Re,ll=[],VA=new Pi,q_=new Re,_o=new Zt,wo=new ki;class WA extends Zt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ed(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,q_)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Pi),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ga),VA.copy(e.boundingBox).applyMatrix4(ga),this.boundingBox.union(VA)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ki),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ga),wo.copy(e.boundingSphere).applyMatrix4(ga),this.boundingSphere.union(wo)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),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){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,s=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let o=0;o<n.length;o++)n[o]=s[a+o]}raycast(e,t){const n=this.matrixWorld,s=this.count;if(_o.geometry=this.geometry,_o.material=this.material,_o.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),wo.copy(this.boundingSphere),wo.applyMatrix4(n),e.ray.intersectsSphere(wo)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,ga),zA.multiplyMatrices(n,ga),_o.matrixWorld=zA,_o.raycast(e,ll);for(let a=0,o=ll.length;a<o;a++){const c=ll[a];c.instanceId=r,c.object=this,t.push(c)}ll.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new ed(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new ol(new Float32Array(s*this.count),s,this.count,ji,ln));const r=this.morphTexture.source.data.data;let a=0;for(let l=0;l<n.length;l++)a+=n[l];const o=this.geometry.morphTargetsRelative?1:1-a,c=s*e;r[c]=o,r.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const td=new G,K_=new G,j_=new ot;class ks{constructor(e=new G(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,s){return this.normal.set(e,t,n),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const s=td.subVectors(n,t).cross(K_.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(td),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||j_.getNormalMatrix(e),s=this.coplanarPoint(td).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.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)}}const ur=new ki,hl=new G;class nd{constructor(e=new ks,t=new ks,n=new ks,s=new ks,r=new ks,a=new ks){this.planes=[e,t,n,s,r,a]}set(e,t,n,s,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(s),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Xi){const n=this.planes,s=e.elements,r=s[0],a=s[1],o=s[2],c=s[3],l=s[4],h=s[5],u=s[6],d=s[7],f=s[8],p=s[9],m=s[10],g=s[11],A=s[12],_=s[13],x=s[14],E=s[15];if(n[0].setComponents(c-r,d-l,g-f,E-A).normalize(),n[1].setComponents(c+r,d+l,g+f,E+A).normalize(),n[2].setComponents(c+a,d+h,g+p,E+_).normalize(),n[3].setComponents(c-a,d-h,g-p,E-_).normalize(),n[4].setComponents(c-o,d-u,g-m,E-x).normalize(),t===Xi)n[5].setComponents(c+o,d+u,g+m,E+x).normalize();else if(t===Gc)n[5].setComponents(o,u,m,x).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(),ur.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ur.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ur)}intersectsSprite(e){return ur.center.set(0,0,0),ur.radius=.7071067811865476,ur.applyMatrix4(e.matrixWorld),this.intersectsSphere(ur)}intersectsSphere(e){const t=this.planes,n=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const s=t[n];if(hl.x=s.normal.x>0?e.max.x:e.min.x,hl.y=s.normal.y>0?e.max.y:e.min.y,hl.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(hl)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ma extends ri{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Fe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ul=new G,dl=new G,qA=new Re,vo=new bo,fl=new ki,id=new G,KA=new G;class pl extends Tt{constructor(e=new Mn,t=new ma){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(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let s=1,r=t.count;s<r;s++)ul.fromBufferAttribute(t,s-1),dl.fromBufferAttribute(t,s),n[s]=n[s-1],n[s]+=ul.distanceTo(dl);e.setAttribute("lineDistance",new Jt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fl.copy(n.boundingSphere),fl.applyMatrix4(s),fl.radius+=r,e.ray.intersectsSphere(fl)===!1)return;qA.copy(s).invert(),vo.copy(e.ray).applyMatrix4(qA);const 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){const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let m=f,g=p-1;m<g;m+=l){const A=h.getX(m),_=h.getX(m+1),x=Al(this,e,vo,c,A,_,m);x&&t.push(x)}if(this.isLineLoop){const m=h.getX(p-1),g=h.getX(f),A=Al(this,e,vo,c,m,g,p-1);A&&t.push(A)}}else{const f=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let m=f,g=p-1;m<g;m+=l){const A=Al(this,e,vo,c,m,m+1,m);A&&t.push(A)}if(this.isLineLoop){const m=Al(this,e,vo,c,p-1,f,p-1);m&&t.push(m)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){const o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Al(i,e,t,n,s,r,a){const o=i.geometry.attributes.position;if(ul.fromBufferAttribute(o,s),dl.fromBufferAttribute(o,r),t.distanceSqToSegment(ul,dl,id,KA)>n)return;id.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(id);if(!(l<e.near||l>e.far))return{distance:l,point:KA.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const jA=new G,XA=new G;class gl extends pl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let s=0,r=t.count;s<r;s+=2)jA.fromBufferAttribute(t,s),XA.fromBufferAttribute(t,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+jA.distanceTo(XA);e.setAttribute("lineDistance",new Jt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class X_ extends pl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class sd extends ri{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Fe(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}}const YA=new Re,rd=new bo,ml=new ki,xl=new G;class Y_ extends Tt{constructor(e=new Mn,t=new sd){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){const n=this.geometry,s=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ml.copy(n.boundingSphere),ml.applyMatrix4(s),ml.radius+=r,e.ray.intersectsSphere(ml)===!1)return;YA.copy(s).invert(),rd.copy(e.ray).applyMatrix4(YA);const 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){const d=Math.max(0,a.start),f=Math.min(l.count,a.start+a.count);for(let p=d,m=f;p<m;p++){const g=l.getX(p);xl.fromBufferAttribute(u,g),JA(xl,g,c,s,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let p=d,m=f;p<m;p++)xl.fromBufferAttribute(u,p),JA(xl,p,c,s,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){const o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function JA(i,e,t,n,s,r,a){const o=rd.distanceSqToPoint(i);if(o<t){const c=new G;rd.closestPointToPoint(i,c),c.applyMatrix4(n);const l=s.ray.origin.distanceTo(c);if(l<s.near||l>s.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class bl extends nn{constructor(e,t,n,s,r,a,o,c,l,h,u,d){super(null,a,o,c,l,h,s,r,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class J_ extends bl{constructor(e,t,n,s,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=Jn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Z_ extends bl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,sr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class ZA extends nn{constructor(e,t,n=rr,s,r,a,o=Ln,c=Ln,l,h=so){if(h!==so&&h!==ro)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,s,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Bu(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $_{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,s=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(s),t.push(r),s=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let s=0;const r=n.length;let a;t?a=t:a=e*n[r-1];let o=0,c=r-1,l;for(;o<=c;)if(s=Math.floor(o+(c-o)/2),l=n[s]-a,l<0)o=s+1;else if(l>0)c=s-1;else{c=s;break}if(s=c,n[s]===a)return s/(r-1);const h=n[s],d=n[s+1]-h,f=(a-h)/d;return(s+f)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);const a=this.getPoint(s),o=this.getPoint(r),c=t||(a.isVector2?new Je:new G);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new G,s=[],r=[],a=[],o=new G,c=new Re;for(let f=0;f<=e;f++){const p=f/e;s[f]=this.getTangentAt(p,new G)}r[0]=new G,a[0]=new G;let l=Number.MAX_VALUE;const h=Math.abs(s[0].x),u=Math.abs(s[0].y),d=Math.abs(s[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(s[0],n).normalize(),r[0].crossVectors(s[0],o),a[0].crossVectors(s[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(s[f-1],s[f]),o.length()>Number.EPSILON){o.normalize();const p=Math.acos(at(s[f-1].dot(s[f]),-1,1));r[f].applyMatrix4(c.makeRotationAxis(o,p))}a[f].crossVectors(s[f],r[f])}if(t===!0){let f=Math.acos(at(r[0].dot(r[e]),-1,1));f/=e,s[0].dot(o.crossVectors(r[0],r[e]))>0&&(f=-f);for(let p=1;p<=e;p++)r[p].applyMatrix4(c.makeRotationAxis(s[p],f*p)),a[p].crossVectors(s[p],r[p])}return{tangents:s,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}function ew(i,e,t=2){const n=e&&e.length,s=n?e[0]*t:i.length;let r=$A(i,0,s,t,!0);const a=[];if(!r||r.next===r.prev)return a;let o,c,l;if(n&&(r=rw(i,e,r,t)),i.length>80*t){o=1/0,c=1/0;let h=-1/0,u=-1/0;for(let d=t;d<s;d+=t){const f=i[d],p=i[d+1];f<o&&(o=f),p<c&&(c=p),f>h&&(h=f),p>u&&(u=p)}l=Math.max(h-o,u-c),l=l!==0?32767/l:0}return Co(r,a,t,o,c,l,0),a}function $A(i,e,t,n,s){let r;if(s===gw(i,e,t,n)>0)for(let a=e;a<t;a+=n)r=ig(a/n|0,i[a],i[a+1],r);else for(let a=t-n;a>=e;a-=n)r=ig(a/n|0,i[a],i[a+1],r);return r&&xa(r,r.next)&&(Mo(r),r=r.next),r}function dr(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(xa(t,t.next)||zt(t.prev,t,t.next)===0)){if(Mo(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Co(i,e,t,n,s,r,a){if(!i)return;!a&&r&&hw(i,n,s,r);let o=i;for(;i.prev!==i.next;){const c=i.prev,l=i.next;if(r?nw(i,n,s,r):tw(i)){e.push(c.i,i.i,l.i),Mo(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=iw(dr(i),e),Co(i,e,t,n,s,r,2)):a===2&&sw(i,e,t,n,s,r):Co(dr(i),e,t,n,s,r,1);break}}}function tw(i){const e=i.prev,t=i,n=i.next;if(zt(e,t,n)>=0)return!1;const s=e.x,r=t.x,a=n.x,o=e.y,c=t.y,l=n.y,h=Math.min(s,r,a),u=Math.min(o,c,l),d=Math.max(s,r,a),f=Math.max(o,c,l);let p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&Io(s,o,r,c,a,l,p.x,p.y)&&zt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function nw(i,e,t,n){const s=i.prev,r=i,a=i.next;if(zt(s,r,a)>=0)return!1;const o=s.x,c=r.x,l=a.x,h=s.y,u=r.y,d=a.y,f=Math.min(o,c,l),p=Math.min(h,u,d),m=Math.max(o,c,l),g=Math.max(h,u,d),A=ad(f,p,e,t,n),_=ad(m,g,e,t,n);let x=i.prevZ,E=i.nextZ;for(;x&&x.z>=A&&E&&E.z<=_;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==a&&Io(o,h,c,u,l,d,x.x,x.y)&&zt(x.prev,x,x.next)>=0||(x=x.prevZ,E.x>=f&&E.x<=m&&E.y>=p&&E.y<=g&&E!==s&&E!==a&&Io(o,h,c,u,l,d,E.x,E.y)&&zt(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;x&&x.z>=A;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==a&&Io(o,h,c,u,l,d,x.x,x.y)&&zt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;E&&E.z<=_;){if(E.x>=f&&E.x<=m&&E.y>=p&&E.y<=g&&E!==s&&E!==a&&Io(o,h,c,u,l,d,E.x,E.y)&&zt(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function iw(i,e){let t=i;do{const n=t.prev,s=t.next.next;!xa(n,s)&&tg(n,t,t.next,s)&&So(n,s)&&So(s,n)&&(e.push(n.i,t.i,s.i),Mo(t),Mo(t.next),t=i=s),t=t.next}while(t!==i);return dr(t)}function sw(i,e,t,n,s,r){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&fw(a,o)){let c=ng(a,o);a=dr(a,a.next),c=dr(c,c.next),Co(a,e,t,n,s,r,0),Co(c,e,t,n,s,r,0);return}o=o.next}a=a.next}while(a!==i)}function rw(i,e,t,n){const s=[];for(let r=0,a=e.length;r<a;r++){const o=e[r]*n,c=r<a-1?e[r+1]*n:i.length,l=$A(i,o,c,n,!1);l===l.next&&(l.steiner=!0),s.push(dw(l))}s.sort(aw);for(let r=0;r<s.length;r++)t=ow(s[r],t);return t}function aw(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=n-s}return t}function ow(i,e){const t=cw(i,e);if(!t)return e;const n=ng(t,i);return dr(n,n.next),dr(t,t.next)}function cw(i,e){let t=e;const n=i.x,s=i.y;let r=-1/0,a;if(xa(i,t))return t;do{if(xa(i,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const u=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>r&&(r=u,a=t.x<t.next.x?t:t.next,u===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,c=a.x,l=a.y;let h=1/0;t=a;do{if(n>=t.x&&t.x>=c&&n!==t.x&&eg(s<l?n:r,s,c,l,s<l?r:n,s,t.x,t.y)){const u=Math.abs(s-t.y)/(n-t.x);So(t,i)&&(u<h||u===h&&(t.x>a.x||t.x===a.x&&lw(a,t)))&&(a=t,h=u)}t=t.next}while(t!==o);return a}function lw(i,e){return zt(i.prev,i,e.prev)<0&&zt(e.next,i,i.next)<0}function hw(i,e,t,n){let s=i;do s.z===0&&(s.z=ad(s.x,s.y,e,t,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,uw(s)}function uw(i){let e,t=1;do{let n=i,s;i=null;let r=null;for(e=0;n;){e++;let a=n,o=0;for(let l=0;l<t&&(o++,a=a.nextZ,!!a);l++);let c=t;for(;o>0||c>0&&a;)o!==0&&(c===0||!a||n.z<=a.z)?(s=n,n=n.nextZ,o--):(s=a,a=a.nextZ,c--),r?r.nextZ=s:i=s,s.prevZ=r,r=s;n=a}r.nextZ=null,t*=2}while(e>1);return i}function ad(i,e,t,n,s){return i=(i-t)*s|0,e=(e-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function dw(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function eg(i,e,t,n,s,r,a,o){return(s-a)*(e-o)>=(i-a)*(r-o)&&(i-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(r-o)>=(s-a)*(n-o)}function Io(i,e,t,n,s,r,a,o){return!(i===a&&e===o)&&eg(i,e,t,n,s,r,a,o)}function fw(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!pw(i,e)&&(So(i,e)&&So(e,i)&&Aw(i,e)&&(zt(i.prev,i,e.prev)||zt(i,e.prev,e))||xa(i,e)&&zt(i.prev,i,i.next)>0&&zt(e.prev,e,e.next)>0)}function zt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function xa(i,e){return i.x===e.x&&i.y===e.y}function tg(i,e,t,n){const s=yl(zt(i,e,t)),r=yl(zt(i,e,n)),a=yl(zt(t,n,i)),o=yl(zt(t,n,e));return!!(s!==r&&a!==o||s===0&&El(i,t,e)||r===0&&El(i,n,e)||a===0&&El(t,i,n)||o===0&&El(t,e,n))}function El(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function yl(i){return i>0?1:i<0?-1:0}function pw(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&tg(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function So(i,e){return zt(i.prev,i,i.next)<0?zt(i,e,i.next)>=0&&zt(i,i.prev,e)>=0:zt(i,e,i.prev)<0||zt(i,i.next,e)<0}function Aw(i,e){let t=i,n=!1;const s=(i.x+e.x)/2,r=(i.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function ng(i,e){const t=od(i.i,i.x,i.y),n=od(e.i,e.x,e.y),s=i.next,r=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function ig(i,e,t,n){const s=od(i,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Mo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function od(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function gw(i,e,t,n){let s=0;for(let r=e,a=t-n;r<t;r+=n)s+=(i[a]-i[r])*(i[r+1]+i[a+1]),a=r;return s}class mw{static triangulate(e,t,n=2){return ew(e,t,n)}}class cd{static area(e){const t=e.length;let n=0;for(let s=t-1,r=0;r<t;s=r++)n+=e[s].x*e[r].y-e[r].x*e[s].y;return n*.5}static isClockWise(e){return cd.area(e)<0}static triangulateShape(e,t){const n=[],s=[],r=[];sg(e),rg(n,e);let a=e.length;t.forEach(sg);for(let c=0;c<t.length;c++)s.push(a),a+=t[c].length,rg(n,t[c]);const o=mw.triangulate(n,s);for(let c=0;c<o.length;c+=3)r.push(o.slice(c,c+3));return r}}function sg(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function rg(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class _l extends Mn{constructor(e=1,t=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:s};const r=e/2,a=t/2,o=Math.floor(n),c=Math.floor(s),l=o+1,h=c+1,u=e/o,d=t/c,f=[],p=[],m=[],g=[];for(let A=0;A<h;A++){const _=A*d-a;for(let x=0;x<l;x++){const E=x*u-r;p.push(E,-_,0),m.push(0,0,1),g.push(x/o),g.push(1-A/c)}}for(let A=0;A<c;A++)for(let _=0;_<o;_++){const x=_+l*A,E=_+l*(A+1),S=_+1+l*(A+1),w=_+1+l*A;f.push(x,E,w),f.push(E,S,w)}this.setIndex(f),this.setAttribute("position",new Jt(p,3)),this.setAttribute("normal",new Jt(m,3)),this.setAttribute("uv",new Jt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _l(e.width,e.height,e.widthSegments,e.heightSegments)}}class Bo extends ri{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Fe(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 Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oc,this.normalScale=new Je(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 dn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ui extends Bo{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 Je(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return at(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 Fe(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 Fe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Fe(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}}class wl extends ri{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Fe(16777215),this.specular=new Fe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oc,this.normalScale=new Je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new dn,this.combine=Cc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,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.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class xw extends ri{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Fe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oc,this.normalScale=new Je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new dn,this.combine=Cc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(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.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class bw extends ri{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Gy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Ew extends ri{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 vl(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function yw(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function _w(i){function e(s,r){return i[s]-i[r]}const t=i.length,n=new Array(t);for(let s=0;s!==t;++s)n[s]=s;return n.sort(e),n}function ag(i,e,t){const n=i.length,s=new i.constructor(n);for(let r=0,a=0;a!==n;++r){const o=t[r]*e;for(let c=0;c!==e;++c)s[a++]=i[o+c]}return s}function og(i,e,t,n){let s=1,r=i[0];for(;r!==void 0&&r[n]===void 0;)r=i[s++];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=i[s++];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=i[s++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=i[s++];while(r!==void 0)}class To{constructor(e,t,n,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,s=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<s)){for(let o=n+2;;){if(s===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=s,s=t[++n],e<s)break t}a=t.length;break n}if(!(e>=r)){const 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(s=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(s=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s;for(let a=0;a!==s;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ww extends To{constructor(e,t,n,s){super(e,t,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Jr,endingEnd:Jr}}intervalChanged_(e,t,n){const s=this.parameterPositions;let r=e-2,a=e+1,o=s[r],c=s[a];if(o===void 0)switch(this.getSettings_().endingStart){case Zr:r=e,o=2*t-n;break;case Uc:r=s.length-2,o=t+s[r]-s[r+1];break;default:r=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Zr:a=e,c=2*n-t;break;case Uc:a=1,c=n+s[1]-s[0];break;default:a=e-1,c=t}const 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,s){const 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,p=(n-t)/(s-t),m=p*p,g=m*p,A=-d*g+2*d*m-d*p,_=(1+d)*g+(-1.5-2*d)*m+(-.5+d)*p+1,x=(-1-f)*g+(1.5+f)*m+.5*p,E=f*g-f*m;for(let S=0;S!==o;++S)r[S]=A*a[h+S]+_*a[l+S]+x*a[c+S]+E*a[u+S];return r}}class cg extends To{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(s-t),u=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*u+a[c+d]*h;return r}}class vw extends To{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class wi{constructor(e,t,n,s){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=vl(t,this.TimeBufferType),this.values=vl(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:vl(e.times,Array),values:vl(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(n.interpolation=s)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new vw(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new cg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ww(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case uo:t=this.InterpolantFactoryMethodDiscrete;break;case fo:t=this.InterpolantFactoryMethodLinear;break;case wu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const 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 console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return uo;case this.InterpolantFactoryMethodLinear:return fo;case this.InterpolantFactoryMethodSmooth:return wu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]*=e}return this}trim(e,t){const n=this.times,s=n.length;let r=0,a=s-1;for(;r!==s&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==s){r>=a&&(a=Math.max(a,1),r=a-1);const o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,s=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){const c=n[o];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(s!==void 0&&yw(s))for(let o=0,c=s.length;o!==c;++o){const l=s[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===wu,r=e.length-1;let a=1;for(let o=1;o<r;++o){let c=!1;const l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(s)c=!0;else{const u=o*n,d=u-n,f=u+n;for(let p=0;p!==n;++p){const m=t[u+p];if(m!==t[d+p]||m!==t[f+p]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];const 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(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,s=new n(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}wi.prototype.ValueTypeName="",wi.prototype.TimeBufferType=Float32Array,wi.prototype.ValueBufferType=Float32Array,wi.prototype.DefaultInterpolation=fo;class ba extends wi{constructor(e,t,n){super(e,t,n)}}ba.prototype.ValueTypeName="bool",ba.prototype.ValueBufferType=Array,ba.prototype.DefaultInterpolation=uo,ba.prototype.InterpolantFactoryMethodLinear=void 0,ba.prototype.InterpolantFactoryMethodSmooth=void 0;class lg extends wi{constructor(e,t,n,s){super(e,t,n,s)}}lg.prototype.ValueTypeName="color";class fr extends wi{constructor(e,t,n,s){super(e,t,n,s)}}fr.prototype.ValueTypeName="number";class Cw extends To{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(s-t);let l=e*o;for(let h=l+o;l!==h;l+=4)Yt.slerpFlat(r,0,a,l-o,a,l,c);return r}}class Us extends wi{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new Cw(this.times,this.values,this.getValueSize(),e)}}Us.prototype.ValueTypeName="quaternion",Us.prototype.InterpolantFactoryMethodSmooth=void 0;class Ea extends wi{constructor(e,t,n){super(e,t,n)}}Ea.prototype.ValueTypeName="string",Ea.prototype.ValueBufferType=Array,Ea.prototype.DefaultInterpolation=uo,Ea.prototype.InterpolantFactoryMethodLinear=void 0,Ea.prototype.InterpolantFactoryMethodSmooth=void 0;class pr extends wi{constructor(e,t,n,s){super(e,t,n,s)}}pr.prototype.ValueTypeName="vector";class Cl{constructor(e="",t=-1,n=[],s=vu){this.name=e,this.tracks=n,this.duration=t,this.blendMode=s,this.uuid=mi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,s=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Sw(n[a]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,a=n.length;r!==a;++r)t.push(wi.toJSON(n[r]));return s}static CreateFromMorphTargetSequence(e,t,n,s){const 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);const h=_w(c);c=ag(c,1,h),l=ag(l,1,h),!s&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new fr(".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)){const s=e;n=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===t)return n[s];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const s={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){const l=e[o],h=l.name.match(r);if(h&&h.length>1){const u=h[1];let d=s[u];d||(s[u]=d=[]),d.push(l)}}const a=[];for(const o in s)a.push(this.CreateFromMorphTargetSequence(o,s[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,p,m){if(f.length!==0){const g=[],A=[];og(f,g,A,p),g.length!==0&&m.push(new u(d,g,A))}},s=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let p;for(p=0;p<d.length;p++)if(d[p].morphTargets)for(let m=0;m<d[p].morphTargets.length;m++)f[d[p].morphTargets[m]]=-1;for(const m in f){const g=[],A=[];for(let _=0;_!==d[p].morphTargets.length;++_){const x=d[p];g.push(x.time),A.push(x.morphTarget===m?1:0)}s.push(new fr(".morphTargetInfluence["+m+"]",g,A))}c=f.length*a}else{const f=".bones["+t[u].name+"]";n(pr,f+".position",d,"pos",s),n(Us,f+".quaternion",d,"rot",s),n(pr,f+".scale",d,"scl",s)}}return s.length===0?null:new this(r,c,s,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,s=e.length;n!==s;++n){const 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(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Iw(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return fr;case"vector":case"vector2":case"vector3":case"vector4":return pr;case"color":return lg;case"quaternion":return Us;case"bool":case"boolean":return ba;case"string":return Ea}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function Sw(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Iw(i.type);if(i.times===void 0){const t=[],n=[];og(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const ss={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class hg{constructor(e,t,n){const s=this;let r=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,r===!1&&s.onStart!==void 0&&s.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,s.onProgress!==void 0&&s.onProgress(h,a,o),a===o&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.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){const 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){const f=l[u],p=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return p}return null}}}const Mw=new hg;class oi{constructor(e){this.manager=e!==void 0?e:Mw,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(s,r){n.load(e,s,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}}oi.DEFAULT_MATERIAL_NAME="__DEFAULT";const rs={};class Bw extends Error{constructor(e,t){super(e),this.response=t}}class as extends oi{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=ss.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(rs[e]!==void 0){rs[e].push({onLoad:t,onProgress:n,onError:s});return}rs[e]=[],rs[e].push({onLoad:t,onProgress:n,onError:s});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const h=rs[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,p=f!==0;let m=0;const g=new ReadableStream({start(A){_();function _(){u.read().then(({done:x,value:E})=>{if(x)A.close();else{m+=E.byteLength;const S=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:f});for(let w=0,I=h.length;w<I;w++){const T=h[w];T.onProgress&&T.onProgress(S)}A.enqueue(E),_()}},x=>{A.error(x)})}}});return new Response(g)}else throw new Bw(`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();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(p=>f.decode(p))}}}).then(l=>{ss.add(e,l);const h=rs[e];delete rs[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{const h=rs[e];if(h===void 0)throw this.manager.itemError(e),l;delete rs[e];for(let u=0,d=h.length;u<d;u++){const 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}}class Tw extends oi{constructor(e){super(e)}load(e,t,n,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=ss.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o=go("img");function c(){h(),ss.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(u){h(),s&&s(u),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),r.manager.itemStart(e),o.src=e,o}}class Rw extends oi{constructor(e){super(e)}load(e,t,n,s){const r=this,a=new ol,o=new as(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,function(c){let l;try{l=r.parse(c)}catch(h){if(s!==void 0)s(h);else{console.error(h);return}}l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:Jn,a.wrapT=l.wrapT!==void 0?l.wrapT:Jn,a.magFilter=l.magFilter!==void 0?l.magFilter:qt,a.minFilter=l.minFilter!==void 0?l.minFilter:qt,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(a.colorSpace=l.colorSpace),l.flipY!==void 0&&(a.flipY=l.flipY),l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps,a.minFilter=si),l.mipmapCount===1&&(a.minFilter=qt),l.generateMipmaps!==void 0&&(a.generateMipmaps=l.generateMipmaps),a.needsUpdate=!0,t&&t(a,l)},n,s),a}}class ug extends oi{constructor(e){super(e)}load(e,t,n,s){const r=new nn,a=new Tw(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,s),r}}class Ro extends Tt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Fe(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class Fw extends Ro{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Tt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Fe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const ld=new Re,dg=new G,fg=new G;class hd{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Je(512,512),this.mapType=cn,this.map=null,this.mapPass=null,this.matrix=new Re,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new nd,this._frameExtents=new Je(1,1),this._viewportCount=1,this._viewports=[new gt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;dg.setFromMatrixPosition(e.matrixWorld),t.position.copy(dg),fg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(fg),t.updateMatrixWorld(),ld.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ld),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(ld)}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}clone(){return new this.constructor().copy(this)}toJSON(){const 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}}class Nw extends hd{constructor(){super(new Bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ea*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class pg extends Ro{constructor(e,t,n=0,s=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Tt.DEFAULT_UP),this.updateMatrix(),this.target=new Tt,this.distance=n,this.angle=s,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Nw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const Ag=new Re,Fo=new G,ud=new G;class Dw extends hd{constructor(){super(new Bn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Je(4,2),this._viewportCount=6,this._viewports=[new gt(2,1,1,1),new gt(0,1,1,1),new gt(3,1,1,1),new gt(1,1,1,1),new gt(3,0,1,1),new gt(1,0,1,1)],this._cubeDirections=[new G(1,0,0),new G(-1,0,0),new G(0,0,1),new G(0,0,-1),new G(0,1,0),new G(0,-1,0)],this._cubeUps=[new G(0,1,0),new G(0,1,0),new G(0,1,0),new G(0,1,0),new G(0,0,1),new G(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,s=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Fo.setFromMatrixPosition(e.matrixWorld),n.position.copy(Fo),ud.copy(n.position),ud.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ud),n.updateMatrixWorld(),s.makeTranslation(-Fo.x,-Fo.y,-Fo.z),Ag.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ag)}}class Il extends Ro{constructor(e,t,n=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new Dw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class dd extends FA{constructor(e=-1,t=1,n=1,s=-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=s,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,s,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=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=s+t,c=s-t;if(this.view!==null&&this.view.enabled){const 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.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Lw extends hd{constructor(){super(new dd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class fd extends Ro{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Tt.DEFAULT_UP),this.updateMatrix(),this.target=new Tt,this.shadow=new Lw}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class gg extends Ro{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ar{static extractUrlBase(e){const 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)}}class Pw extends oi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=ss.get(e);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(l=>{t&&t(l),r.manager.itemEnd(e)}).catch(l=>{s&&s(l)});return}return setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const 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){return ss.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){s&&s(l),ss.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});ss.add(e,c),r.manager.itemStart(e)}}class kw extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Uw{constructor(e,t,n){this.binding=e,this.valueSize=n;let s,r,a;switch(t){case"quaternion":s=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:s=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=s,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){const n=this.buffer,s=this.valueSize,r=e*s+s;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==s;++o)n[r+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,r,0,o,s)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,s=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,s,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,s=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,s,c,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,s,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,s=n*this._origIndex;e.getValue(t,s);for(let r=n,a=s;r!==a;++r)t[r]=t[s+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const 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(){const 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,s,r){if(s>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,s){Yt.slerpFlat(e,t,e,t,e,n,s)}_slerpAdditive(e,t,n,s,r){const a=this._workIndex*r;Yt.multiplyQuaternionsFlat(e,a,e,t,e,n),Yt.slerpFlat(e,t,e,t,e,a,s)}_lerp(e,t,n,s,r){const a=1-s;for(let o=0;o!==r;++o){const c=t+o;e[c]=e[c]*a+e[n+o]*s}}_lerpAdditive(e,t,n,s,r){for(let a=0;a!==r;++a){const o=t+a;e[o]=e[o]+e[n+a]*s}}}const pd="\\[\\]\\.:\\/",Ow=new RegExp("["+pd+"]","g"),Ad="[^"+pd+"]",Qw="[^"+pd.replace("\\.","")+"]",Gw=/((?:WC+[\/:])*)/.source.replace("WC",Ad),Hw=/(WCOD+)?/.source.replace("WCOD",Qw),zw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ad),Vw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ad),Ww=new RegExp("^"+Gw+Hw+zw+Vw+"$"),qw=["material","materials","bones","map"];class Kw{constructor(e,t,n){const s=n||_t.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class _t{constructor(e,t,n){this.path=t,this.parsedPath=n||_t.parseTrackName(t),this.node=_t.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 _t.Composite(e,t,n):new _t(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Ow,"")}static parseTrackName(e){const t=Ww.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=n.nodeName.substring(s+1);qw.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),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){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let a=0;a<r.length;a++){const o=r[a];if(o.name===t||o.uuid===t)return o;const c=n(o.children);if(c)return c}return null},s=n(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)e[t++]=n[s]}_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){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=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;const t=this.parsedPath,n=t.objectName,s=t.propertyName;let r=t.propertyIndex;if(e||(e=_t.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.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){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const a=e[s];if(a===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+s+" 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(s==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.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=s;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}}_t.Composite=Kw,_t.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},_t.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},_t.prototype.GetterByBindingType=[_t.prototype._getValue_direct,_t.prototype._getValue_array,_t.prototype._getValue_arrayElement,_t.prototype._getValue_toArray],_t.prototype.SetterByBindingTypeAndVersioning=[[_t.prototype._setValue_direct,_t.prototype._setValue_direct_setNeedsUpdate,_t.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[_t.prototype._setValue_array,_t.prototype._setValue_array_setNeedsUpdate,_t.prototype._setValue_array_setMatrixWorldNeedsUpdate],[_t.prototype._setValue_arrayElement,_t.prototype._setValue_arrayElement_setNeedsUpdate,_t.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[_t.prototype._setValue_fromArray,_t.prototype._setValue_fromArray_setNeedsUpdate,_t.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class jw{constructor(e,t,n=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=s;const r=t.tracks,a=r.length,o=new Array(a),c={endingStart:Jr,endingEnd:Jr};for(let l=0;l!==a;++l){const h=r[l].createInterpolant(null);o[l]=h,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=iA,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){const s=this._clip.duration,r=e._clip.duration,a=r/s,o=s/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(){const 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){const s=this._mixer,r=s.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=s._lendControlInterpolant(),this._timeScaleInterpolant=o);const c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){const 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,s){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Oy:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case vu:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(s,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const s=n.evaluate(e)[0];t*=s,e>n.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const s=n.evaluate(e)[0];t*=s,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let s=this.time+e,r=this._loopCount;const a=n===Uy;if(e===0)return r===-1?s:a&&(r&1)===1?t-s:s;if(n===nA){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,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)),s>=t||s<0){const o=Math.floor(s/t);s-=t*o,r+=Math.abs(o);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=s;if(a&&(r&1)===1)return t-s}return s}_setEndings(e,t,n){const s=this._interpolantSettings;n?(s.endingStart=Zr,s.endingEnd=Zr):(e?s.endingStart=this.zeroSlopeAtStart?Zr:Jr:s.endingStart=Uc,t?s.endingEnd=this.zeroSlopeAtEnd?Zr:Jr:s.endingEnd=Uc)}_scheduleFading(e,t,n){const s=this._mixer,r=s.time;let a=this._weightInterpolant;a===null&&(a=s._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=n,this}}const Xw=new Float32Array(1);class mg extends Ms{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,s=e._clip.tracks,r=s.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){const d=s[u],f=d.name;let p=h[f];if(p!==void 0)++p.referenceCount,a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,c,f));continue}const m=t&&t._propertyBindings[u].binding.parsedPath;p=new Uw(_t.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,c,f),a[u]=p}o[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,n)}const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const 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;const 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){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const s=this._actions,r=this._actionsByClip;let a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=s.length,s.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],s=e._cacheIndex;n._cacheIndex=s,t[s]=n,t.pop(),e._cacheIndex=null;const 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;const u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],c.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,s=this._nActiveActions++,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,s=--this._nActiveActions,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const s=this._bindingsByRootAndName,r=this._bindings;let a=s[t];a===void 0&&(a={},s[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,s=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[s],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[s]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,s=this._nActiveBindings++,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,s=--this._nActiveBindings,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new cg(new Float32Array(2),new Float32Array(2),1,Xw),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,s=--this._nActiveControlInterpolants,r=t[s];e.__cacheIndex=s,t[s]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const s=t||this._root,r=s.uuid;let a=typeof e=="string"?Cl.findByName(s,e):e;const o=a!==null?a.uuid:e,c=this._actionsByClip[o];let l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=vu),c!==void 0){const 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;const h=new jw(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(e,t){const n=t||this._root,s=n.uuid,r=typeof e=="string"?Cl.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[s]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,s=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(s,e,r,a);const 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){const t=this._actions,n=e.uuid,s=this._actionsByClip,r=s[n];if(r!==void 0){const a=r.knownActions;for(let o=0,c=a.length;o!==c;++o){const l=a[o];this._deactivateAction(l);const 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 s[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const s=this._bindingsByRootAndName,r=s[t];if(r!==void 0)for(const a in r){const o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class xg{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=at(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(at(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Os=new G,Sl=new Re,gd=new Re;class Yw extends gl{constructor(e){const t=bg(e),n=new Mn,s=[],r=[],a=new Fe(0,0,1),o=new Fe(0,1,0);for(let l=0;l<t.length;l++){const h=t[l];h.parent&&h.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new Jt(s,3)),n.setAttribute("color",new Jt(r,3));const c=new ma({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,s=n.getAttribute("position");gd.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<t.length;r++){const o=t[r];o.parent&&o.parent.isBone&&(Sl.multiplyMatrices(gd,o.matrixWorld),Os.setFromMatrixPosition(Sl),s.setXYZ(a,Os.x,Os.y,Os.z),Sl.multiplyMatrices(gd,o.parent.matrixWorld),Os.setFromMatrixPosition(Sl),s.setXYZ(a+1,Os.x,Os.y,Os.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function bg(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push(...bg(i.children[t]));return e}class Jw extends gl{constructor(e=10,t=10,n=4473924,s=8947848){n=new Fe(n),s=new Fe(s);const r=t/2,a=e/t,o=e/2,c=[],l=[];for(let d=0,f=0,p=-o;d<=t;d++,p+=a){c.push(-o,0,p,o,0,p),c.push(p,0,-o,p,0,o);const m=d===r?n:s;m.toArray(l,f),f+=3,m.toArray(l,f),f+=3,m.toArray(l,f),f+=3,m.toArray(l,f),f+=3}const h=new Mn;h.setAttribute("position",new Jt(c,3)),h.setAttribute("color",new Jt(l,3));const u=new ma({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Eg extends gl{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Mn;s.setAttribute("position",new Jt(t,3)),s.setAttribute("color",new Jt(n,3));const r=new ma({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,t,n){const s=new Fe,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(t),s.toArray(r,6),s.toArray(r,9),s.set(n),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Zw extends Ms{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function yg(i,e,t,n){const s=$w(n);switch(t){case $p:return i*e;case ji:return i*e/s.components*s.byteLength;case nu:return i*e/s.components*s.byteLength;case ar:return i*e*2/s.components*s.byteLength;case iu:return i*e*2/s.components*s.byteLength;case eA:return i*e*3/s.components*s.byteLength;case hn:return i*e*4/s.components*s.byteLength;case su:return i*e*4/s.components*s.byteLength;case Tc:case ao:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Rc:case oo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ru:case au:return Math.max(i,16)*Math.max(e,8)/4;case Fc:case Nc:return Math.max(i,8)*Math.max(e,8)/2;case Dc:case Lc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Pc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case co:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ou:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case cu:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case lu:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case lo:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case hu:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case uu:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case du:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case fu:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case pu:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Au:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case gu:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case mu:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case xu:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case ho:case bu:case kc:return Math.ceil(i/4)*Math.ceil(e/4)*16;case tA:case Eu:return Math.ceil(i/4)*Math.ceil(e/4)*8;case yu:case _u:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function $w(i){switch(i){case cn:case Yp:return{byteLength:1,components:1};case no:case Jp:case Pn:return{byteLength:2,components:1};case eu:case tu:return{byteLength:2,components:4};case rr:case $h:case ln:return{byteLength:4,components:1};case Zp:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:vc}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=vc);function _g(){let i=null,e=!1,t=null,n=null;function s(r,a){t(r,a),n=i.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(s),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){i=r}}}function ev(i){const e=new WeakMap;function t(o,c){const l=o.array,h=o.usage,u=l.byteLength,d=i.createBuffer();i.bindBuffer(c,d),i.bufferData(c,l,h),o.onUploadCallback();let f;if(l instanceof Float32Array)f=i.FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=i.HALF_FLOAT:f=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=i.SHORT;else if(l instanceof Uint32Array)f=i.UNSIGNED_INT;else if(l instanceof Int32Array)f=i.INT;else if(l instanceof Int8Array)f=i.BYTE;else if(l instanceof Uint8Array)f=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=i.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){const h=c.array,u=c.updateRanges;if(i.bindBuffer(l,o),u.length===0)i.bufferSubData(l,0,h);else{u.sort((f,p)=>f.start-p.start);let d=0;for(let f=1;f<u.length;f++){const p=u[d],m=u[f];m.start<=p.start+p.count+1?p.count=Math.max(p.count,m.start+m.count-p.start):(++d,u[d]=m)}u.length=d+1;for(let f=0,p=u.length;f<p;f++){const m=u[f];i.bufferSubData(l,m.start*h.BYTES_PER_ELEMENT,h,m.start,m.count)}c.clearUpdateRanges()}c.onUploadCallback()}function s(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(i.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const 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}const 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:s,remove:r,update:a}}var tv=`#ifdef USE_ALPHAHASH
+ `},s=new da(5,5,5),r=new Ls({name:"CubemapFromEquirect",uniforms:fa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ln,blending:Cs});r.uniforms.tEquirect.value=t;const a=new Zt(s,r),o=t.minFilter;return t.minFilter===ri&&(t.minFilter=qt),new G_(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,s=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,s);e.setRenderTarget(r)}}class ss extends Tt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const z_={type:"move"};class Ju{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ss,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 ss,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ss,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let s=null,r=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,n),A=this._getHandJoint(l,m);g!==null&&(A.matrix.fromArray(g.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=g.radius),A.visible=g!==null}const h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,p=.005;l.inputState.pinching&&d>f+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-p&&(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));o!==null&&(s=t.getPose(e.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(z_)))}return o!==null&&(o.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ss;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Zu extends Tt{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 dn,this.environmentIntensity=1,this.environmentRotation=new dn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class V_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Mu,this.updateRanges=[],this.version=0,this.uuid=xi()}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 s=0,r=this.stride;s<r;s++)this.array[e+s]=t.array[n+s];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=xi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const 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=xi()),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}}}const On=new G;class $u{constructor(e,t,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=s}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++)On.fromBufferAttribute(this,t),On.applyMatrix4(e),this.setXYZ(t,On.x,On.y,On.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)On.fromBufferAttribute(this,t),On.applyNormalMatrix(e),this.setXYZ(t,On.x,On.y,On.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)On.fromBufferAttribute(this,t),On.transformDirection(e),this.setXYZ(t,On.x,On.y,On.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=bi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Bt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Bt(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=bi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=bi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=bi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=bi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),s=Bt(s,this.array),r=Bt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}return new Sn(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 $u(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+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}}}const kA=new G,UA=new gt,OA=new gt,W_=new G,QA=new Re,ol=new G,ed=new Ui,GA=new Re,td=new Eo;class HA extends Zt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=jp,this.bindMatrix=new Re,this.bindMatrixInverse=new Re,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ki),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ol),this.boundingBox.expandByPoint(ol)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Ui),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ol),this.boundingSphere.expandByPoint(ol)}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){const n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ed.copy(this.boundingSphere),ed.applyMatrix4(s),e.ray.intersectsSphere(ed)!==!1&&(GA.copy(s).invert(),td.copy(e.ray).applyMatrix4(GA),!(this.boundingBox!==null&&td.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,td)))}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(){const e=new gt,t=this.geometry.attributes.skinWeight;for(let n=0,s=t.count;n<s;n++){e.fromBufferAttribute(t,n);const 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===jp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Uy?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,s=this.geometry;UA.fromBufferAttribute(s.attributes.skinIndex,e),OA.fromBufferAttribute(s.attributes.skinWeight,e),kA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=OA.getComponent(r);if(a!==0){const o=UA.getComponent(r);QA.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(W_.copy(kA).applyMatrix4(QA),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class cl extends Tt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ll extends nn{constructor(e=null,t=1,n=1,s,r,a,o,c,l=Pn,h=Pn,u,d){super(null,a,o,c,l,h,s,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const zA=new Re,q_=new Re;class hl{constructor(e=[],t=[]){this.uuid=xi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const 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){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new Re)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Re;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++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const 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(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let r=0,a=e.length;r<a;r++){const o=e[r]?e[r].matrixWorld:q_;zA.multiplyMatrices(o,t[r]),zA.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new hl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ll(t,e,e,hn,ln);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const s=this.bones[t];if(s.name===e)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,s=e.bones.length;n<s;n++){const r=e.bones[n];let a=t[r];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new cl),this.bones.push(a),this.boneInverses.push(new Re().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let s=0,r=t.length;s<r;s++){const a=t[s];e.bones.push(a.uuid);const o=n[s];e.boneInverses.push(o.toArray())}return e}}class nd extends Sn{constructor(e,t,n,s=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ga=new Re,VA=new Re,ul=[],WA=new ki,K_=new Re,wo=new Zt,vo=new Ui;class qA extends Zt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new nd(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,K_)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ki),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ga),WA.copy(e.boundingBox).applyMatrix4(ga),this.boundingBox.union(WA)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Ui),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ga),vo.copy(e.boundingSphere).applyMatrix4(ga),this.boundingSphere.union(vo)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),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){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,s=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let o=0;o<n.length;o++)n[o]=s[a+o]}raycast(e,t){const n=this.matrixWorld,s=this.count;if(wo.geometry=this.geometry,wo.material=this.material,wo.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),vo.copy(this.boundingSphere),vo.applyMatrix4(n),e.ray.intersectsSphere(vo)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,ga),VA.multiplyMatrices(n,ga),wo.matrixWorld=VA,wo.raycast(e,ul);for(let a=0,o=ul.length;a<o;a++){const c=ul[a];c.instanceId=r,c.object=this,t.push(c)}ul.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new nd(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new ll(new Float32Array(s*this.count),s,this.count,Xi,ln));const r=this.morphTexture.source.data.data;let a=0;for(let l=0;l<n.length;l++)a+=n[l];const o=this.geometry.morphTargetsRelative?1:1-a,c=s*e;r[c]=o,r.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const id=new G,j_=new G,X_=new ot;class ks{constructor(e=new G(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,s){return this.normal.set(e,t,n),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const s=id.subVectors(n,t).cross(j_.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(id),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||X_.getNormalMatrix(e),s=this.coplanarPoint(id).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.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)}}const ur=new Ui,dl=new G;class sd{constructor(e=new ks,t=new ks,n=new ks,s=new ks,r=new ks,a=new ks){this.planes=[e,t,n,s,r,a]}set(e,t,n,s,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(s),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Yi){const n=this.planes,s=e.elements,r=s[0],a=s[1],o=s[2],c=s[3],l=s[4],h=s[5],u=s[6],d=s[7],f=s[8],p=s[9],m=s[10],g=s[11],A=s[12],_=s[13],x=s[14],E=s[15];if(n[0].setComponents(c-r,d-l,g-f,E-A).normalize(),n[1].setComponents(c+r,d+l,g+f,E+A).normalize(),n[2].setComponents(c+a,d+h,g+p,E+_).normalize(),n[3].setComponents(c-a,d-h,g-p,E-_).normalize(),n[4].setComponents(c-o,d-u,g-m,E-x).normalize(),t===Yi)n[5].setComponents(c+o,d+u,g+m,E+x).normalize();else if(t===zc)n[5].setComponents(o,u,m,x).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(),ur.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ur.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ur)}intersectsSprite(e){return ur.center.set(0,0,0),ur.radius=.7071067811865476,ur.applyMatrix4(e.matrixWorld),this.intersectsSphere(ur)}intersectsSphere(e){const t=this.planes,n=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const s=t[n];if(dl.x=s.normal.x>0?e.max.x:e.min.x,dl.y=s.normal.y>0?e.max.y:e.min.y,dl.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(dl)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ma extends ai{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Fe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const fl=new G,pl=new G,KA=new Re,Co=new Eo,Al=new Ui,rd=new G,jA=new G;class gl extends Tt{constructor(e=new Mn,t=new ma){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(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let s=1,r=t.count;s<r;s++)fl.fromBufferAttribute(t,s-1),pl.fromBufferAttribute(t,s),n[s]=n[s-1],n[s]+=fl.distanceTo(pl);e.setAttribute("lineDistance",new Jt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Al.copy(n.boundingSphere),Al.applyMatrix4(s),Al.radius+=r,e.ray.intersectsSphere(Al)===!1)return;KA.copy(s).invert(),Co.copy(e.ray).applyMatrix4(KA);const 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){const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let m=f,g=p-1;m<g;m+=l){const A=h.getX(m),_=h.getX(m+1),x=ml(this,e,Co,c,A,_,m);x&&t.push(x)}if(this.isLineLoop){const m=h.getX(p-1),g=h.getX(f),A=ml(this,e,Co,c,m,g,p-1);A&&t.push(A)}}else{const f=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let m=f,g=p-1;m<g;m+=l){const A=ml(this,e,Co,c,m,m+1,m);A&&t.push(A)}if(this.isLineLoop){const m=ml(this,e,Co,c,p-1,f,p-1);m&&t.push(m)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){const o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function ml(i,e,t,n,s,r,a){const o=i.geometry.attributes.position;if(fl.fromBufferAttribute(o,s),pl.fromBufferAttribute(o,r),t.distanceSqToSegment(fl,pl,rd,jA)>n)return;rd.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(rd);if(!(l<e.near||l>e.far))return{distance:l,point:jA.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const XA=new G,YA=new G;class xl extends gl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let s=0,r=t.count;s<r;s+=2)XA.fromBufferAttribute(t,s),YA.fromBufferAttribute(t,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+XA.distanceTo(YA);e.setAttribute("lineDistance",new Jt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Y_ extends gl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class ad extends ai{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Fe(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}}const JA=new Re,od=new Eo,bl=new Ui,El=new G;class J_ extends Tt{constructor(e=new Mn,t=new ad){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){const n=this.geometry,s=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),bl.copy(n.boundingSphere),bl.applyMatrix4(s),bl.radius+=r,e.ray.intersectsSphere(bl)===!1)return;JA.copy(s).invert(),od.copy(e.ray).applyMatrix4(JA);const 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){const d=Math.max(0,a.start),f=Math.min(l.count,a.start+a.count);for(let p=d,m=f;p<m;p++){const g=l.getX(p);El.fromBufferAttribute(u,g),ZA(El,g,c,s,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let p=d,m=f;p<m;p++)El.fromBufferAttribute(u,p),ZA(El,p,c,s,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){const o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function ZA(i,e,t,n,s,r,a){const o=od.distanceSqToPoint(i);if(o<t){const c=new G;od.closestPointToPoint(i,c),c.applyMatrix4(n);const l=s.ray.origin.distanceTo(c);if(l<s.near||l>s.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class yl extends nn{constructor(e,t,n,s,r,a,o,c,l,h,u,d){super(null,a,o,c,l,h,s,r,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Z_ extends yl{constructor(e,t,n,s,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=Zn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $_ extends yl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,sr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class $A extends nn{constructor(e,t,n=rr,s,r,a,o=Pn,c=Pn,l,h=ro){if(h!==ro&&h!==ao)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,s,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ru(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class ew{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,s=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(s),t.push(r),s=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let s=0;const r=n.length;let a;t?a=t:a=e*n[r-1];let o=0,c=r-1,l;for(;o<=c;)if(s=Math.floor(o+(c-o)/2),l=n[s]-a,l<0)o=s+1;else if(l>0)c=s-1;else{c=s;break}if(s=c,n[s]===a)return s/(r-1);const h=n[s],d=n[s+1]-h,f=(a-h)/d;return(s+f)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);const a=this.getPoint(s),o=this.getPoint(r),c=t||(a.isVector2?new Je:new G);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new G,s=[],r=[],a=[],o=new G,c=new Re;for(let f=0;f<=e;f++){const p=f/e;s[f]=this.getTangentAt(p,new G)}r[0]=new G,a[0]=new G;let l=Number.MAX_VALUE;const h=Math.abs(s[0].x),u=Math.abs(s[0].y),d=Math.abs(s[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(s[0],n).normalize(),r[0].crossVectors(s[0],o),a[0].crossVectors(s[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(s[f-1],s[f]),o.length()>Number.EPSILON){o.normalize();const p=Math.acos(at(s[f-1].dot(s[f]),-1,1));r[f].applyMatrix4(c.makeRotationAxis(o,p))}a[f].crossVectors(s[f],r[f])}if(t===!0){let f=Math.acos(at(r[0].dot(r[e]),-1,1));f/=e,s[0].dot(o.crossVectors(r[0],r[e]))>0&&(f=-f);for(let p=1;p<=e;p++)r[p].applyMatrix4(c.makeRotationAxis(s[p],f*p)),a[p].crossVectors(s[p],r[p])}return{tangents:s,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}function tw(i,e,t=2){const n=e&&e.length,s=n?e[0]*t:i.length;let r=eg(i,0,s,t,!0);const a=[];if(!r||r.next===r.prev)return a;let o,c,l;if(n&&(r=aw(i,e,r,t)),i.length>80*t){o=1/0,c=1/0;let h=-1/0,u=-1/0;for(let d=t;d<s;d+=t){const f=i[d],p=i[d+1];f<o&&(o=f),p<c&&(c=p),f>h&&(h=f),p>u&&(u=p)}l=Math.max(h-o,u-c),l=l!==0?32767/l:0}return Io(r,a,t,o,c,l,0),a}function eg(i,e,t,n,s){let r;if(s===mw(i,e,t,n)>0)for(let a=e;a<t;a+=n)r=sg(a/n|0,i[a],i[a+1],r);else for(let a=t-n;a>=e;a-=n)r=sg(a/n|0,i[a],i[a+1],r);return r&&xa(r,r.next)&&(Bo(r),r=r.next),r}function dr(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(xa(t,t.next)||zt(t.prev,t,t.next)===0)){if(Bo(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Io(i,e,t,n,s,r,a){if(!i)return;!a&&r&&uw(i,n,s,r);let o=i;for(;i.prev!==i.next;){const c=i.prev,l=i.next;if(r?iw(i,n,s,r):nw(i)){e.push(c.i,i.i,l.i),Bo(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=sw(dr(i),e),Io(i,e,t,n,s,r,2)):a===2&&rw(i,e,t,n,s,r):Io(dr(i),e,t,n,s,r,1);break}}}function nw(i){const e=i.prev,t=i,n=i.next;if(zt(e,t,n)>=0)return!1;const s=e.x,r=t.x,a=n.x,o=e.y,c=t.y,l=n.y,h=Math.min(s,r,a),u=Math.min(o,c,l),d=Math.max(s,r,a),f=Math.max(o,c,l);let p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&So(s,o,r,c,a,l,p.x,p.y)&&zt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function iw(i,e,t,n){const s=i.prev,r=i,a=i.next;if(zt(s,r,a)>=0)return!1;const o=s.x,c=r.x,l=a.x,h=s.y,u=r.y,d=a.y,f=Math.min(o,c,l),p=Math.min(h,u,d),m=Math.max(o,c,l),g=Math.max(h,u,d),A=cd(f,p,e,t,n),_=cd(m,g,e,t,n);let x=i.prevZ,E=i.nextZ;for(;x&&x.z>=A&&E&&E.z<=_;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==a&&So(o,h,c,u,l,d,x.x,x.y)&&zt(x.prev,x,x.next)>=0||(x=x.prevZ,E.x>=f&&E.x<=m&&E.y>=p&&E.y<=g&&E!==s&&E!==a&&So(o,h,c,u,l,d,E.x,E.y)&&zt(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;x&&x.z>=A;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==a&&So(o,h,c,u,l,d,x.x,x.y)&&zt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;E&&E.z<=_;){if(E.x>=f&&E.x<=m&&E.y>=p&&E.y<=g&&E!==s&&E!==a&&So(o,h,c,u,l,d,E.x,E.y)&&zt(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function sw(i,e){let t=i;do{const n=t.prev,s=t.next.next;!xa(n,s)&&ng(n,t,t.next,s)&&Mo(n,s)&&Mo(s,n)&&(e.push(n.i,t.i,s.i),Bo(t),Bo(t.next),t=i=s),t=t.next}while(t!==i);return dr(t)}function rw(i,e,t,n,s,r){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&pw(a,o)){let c=ig(a,o);a=dr(a,a.next),c=dr(c,c.next),Io(a,e,t,n,s,r,0),Io(c,e,t,n,s,r,0);return}o=o.next}a=a.next}while(a!==i)}function aw(i,e,t,n){const s=[];for(let r=0,a=e.length;r<a;r++){const o=e[r]*n,c=r<a-1?e[r+1]*n:i.length,l=eg(i,o,c,n,!1);l===l.next&&(l.steiner=!0),s.push(fw(l))}s.sort(ow);for(let r=0;r<s.length;r++)t=cw(s[r],t);return t}function ow(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=n-s}return t}function cw(i,e){const t=lw(i,e);if(!t)return e;const n=ig(t,i);return dr(n,n.next),dr(t,t.next)}function lw(i,e){let t=e;const n=i.x,s=i.y;let r=-1/0,a;if(xa(i,t))return t;do{if(xa(i,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const u=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>r&&(r=u,a=t.x<t.next.x?t:t.next,u===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,c=a.x,l=a.y;let h=1/0;t=a;do{if(n>=t.x&&t.x>=c&&n!==t.x&&tg(s<l?n:r,s,c,l,s<l?r:n,s,t.x,t.y)){const u=Math.abs(s-t.y)/(n-t.x);Mo(t,i)&&(u<h||u===h&&(t.x>a.x||t.x===a.x&&hw(a,t)))&&(a=t,h=u)}t=t.next}while(t!==o);return a}function hw(i,e){return zt(i.prev,i,e.prev)<0&&zt(e.next,i,i.next)<0}function uw(i,e,t,n){let s=i;do s.z===0&&(s.z=cd(s.x,s.y,e,t,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,dw(s)}function dw(i){let e,t=1;do{let n=i,s;i=null;let r=null;for(e=0;n;){e++;let a=n,o=0;for(let l=0;l<t&&(o++,a=a.nextZ,!!a);l++);let c=t;for(;o>0||c>0&&a;)o!==0&&(c===0||!a||n.z<=a.z)?(s=n,n=n.nextZ,o--):(s=a,a=a.nextZ,c--),r?r.nextZ=s:i=s,s.prevZ=r,r=s;n=a}r.nextZ=null,t*=2}while(e>1);return i}function cd(i,e,t,n,s){return i=(i-t)*s|0,e=(e-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function fw(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function tg(i,e,t,n,s,r,a,o){return(s-a)*(e-o)>=(i-a)*(r-o)&&(i-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(r-o)>=(s-a)*(n-o)}function So(i,e,t,n,s,r,a,o){return!(i===a&&e===o)&&tg(i,e,t,n,s,r,a,o)}function pw(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Aw(i,e)&&(Mo(i,e)&&Mo(e,i)&&gw(i,e)&&(zt(i.prev,i,e.prev)||zt(i,e.prev,e))||xa(i,e)&&zt(i.prev,i,i.next)>0&&zt(e.prev,e,e.next)>0)}function zt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function xa(i,e){return i.x===e.x&&i.y===e.y}function ng(i,e,t,n){const s=wl(zt(i,e,t)),r=wl(zt(i,e,n)),a=wl(zt(t,n,i)),o=wl(zt(t,n,e));return!!(s!==r&&a!==o||s===0&&_l(i,t,e)||r===0&&_l(i,n,e)||a===0&&_l(t,i,n)||o===0&&_l(t,e,n))}function _l(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function wl(i){return i>0?1:i<0?-1:0}function Aw(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&ng(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Mo(i,e){return zt(i.prev,i,i.next)<0?zt(i,e,i.next)>=0&&zt(i,i.prev,e)>=0:zt(i,e,i.prev)<0||zt(i,i.next,e)<0}function gw(i,e){let t=i,n=!1;const s=(i.x+e.x)/2,r=(i.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function ig(i,e){const t=ld(i.i,i.x,i.y),n=ld(e.i,e.x,e.y),s=i.next,r=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function sg(i,e,t,n){const s=ld(i,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Bo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function ld(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function mw(i,e,t,n){let s=0;for(let r=e,a=t-n;r<t;r+=n)s+=(i[a]-i[r])*(i[r+1]+i[a+1]),a=r;return s}class xw{static triangulate(e,t,n=2){return tw(e,t,n)}}class hd{static area(e){const t=e.length;let n=0;for(let s=t-1,r=0;r<t;s=r++)n+=e[s].x*e[r].y-e[r].x*e[s].y;return n*.5}static isClockWise(e){return hd.area(e)<0}static triangulateShape(e,t){const n=[],s=[],r=[];rg(e),ag(n,e);let a=e.length;t.forEach(rg);for(let c=0;c<t.length;c++)s.push(a),a+=t[c].length,ag(n,t[c]);const o=xw.triangulate(n,s);for(let c=0;c<o.length;c+=3)r.push(o.slice(c,c+3));return r}}function rg(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function ag(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class vl extends Mn{constructor(e=1,t=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:s};const r=e/2,a=t/2,o=Math.floor(n),c=Math.floor(s),l=o+1,h=c+1,u=e/o,d=t/c,f=[],p=[],m=[],g=[];for(let A=0;A<h;A++){const _=A*d-a;for(let x=0;x<l;x++){const E=x*u-r;p.push(E,-_,0),m.push(0,0,1),g.push(x/o),g.push(1-A/c)}}for(let A=0;A<c;A++)for(let _=0;_<o;_++){const x=_+l*A,E=_+l*(A+1),S=_+1+l*(A+1),w=_+1+l*A;f.push(x,E,w),f.push(E,S,w)}this.setIndex(f),this.setAttribute("position",new Jt(p,3)),this.setAttribute("normal",new Jt(m,3)),this.setAttribute("uv",new Jt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vl(e.width,e.height,e.widthSegments,e.heightSegments)}}class To extends ai{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Fe(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 Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gc,this.normalScale=new Je(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 dn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Oi extends To{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 Je(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return at(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 Fe(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 Fe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Fe(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}}class Cl extends ai{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Fe(16777215),this.specular=new Fe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gc,this.normalScale=new Je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new dn,this.combine=Sc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,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.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class bw extends ai{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Fe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gc,this.normalScale=new Je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new dn,this.combine=Sc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(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.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ew extends ai{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Hy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class yw extends ai{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 Il(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function _w(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ww(i){function e(s,r){return i[s]-i[r]}const t=i.length,n=new Array(t);for(let s=0;s!==t;++s)n[s]=s;return n.sort(e),n}function og(i,e,t){const n=i.length,s=new i.constructor(n);for(let r=0,a=0;a!==n;++r){const o=t[r]*e;for(let c=0;c!==e;++c)s[a++]=i[o+c]}return s}function cg(i,e,t,n){let s=1,r=i[0];for(;r!==void 0&&r[n]===void 0;)r=i[s++];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=i[s++];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=i[s++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=i[s++];while(r!==void 0)}class Ro{constructor(e,t,n,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,s=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<s)){for(let o=n+2;;){if(s===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=s,s=t[++n],e<s)break t}a=t.length;break n}if(!(e>=r)){const 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(s=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(s=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s;for(let a=0;a!==s;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class vw extends Ro{constructor(e,t,n,s){super(e,t,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Jr,endingEnd:Jr}}intervalChanged_(e,t,n){const s=this.parameterPositions;let r=e-2,a=e+1,o=s[r],c=s[a];if(o===void 0)switch(this.getSettings_().endingStart){case Zr:r=e,o=2*t-n;break;case Qc:r=s.length-2,o=t+s[r]-s[r+1];break;default:r=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Zr:a=e,c=2*n-t;break;case Qc:a=1,c=n+s[1]-s[0];break;default:a=e-1,c=t}const 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,s){const 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,p=(n-t)/(s-t),m=p*p,g=m*p,A=-d*g+2*d*m-d*p,_=(1+d)*g+(-1.5-2*d)*m+(-.5+d)*p+1,x=(-1-f)*g+(1.5+f)*m+.5*p,E=f*g-f*m;for(let S=0;S!==o;++S)r[S]=A*a[h+S]+_*a[l+S]+x*a[c+S]+E*a[u+S];return r}}class lg extends Ro{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(s-t),u=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*u+a[c+d]*h;return r}}class Cw extends Ro{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class vi{constructor(e,t,n,s){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=Il(t,this.TimeBufferType),this.values=Il(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Il(e.times,Array),values:Il(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(n.interpolation=s)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Cw(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new lg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new vw(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case fo:t=this.InterpolantFactoryMethodDiscrete;break;case po:t=this.InterpolantFactoryMethodLinear;break;case Cu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const 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 console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return fo;case this.InterpolantFactoryMethodLinear:return po;case this.InterpolantFactoryMethodSmooth:return Cu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]*=e}return this}trim(e,t){const n=this.times,s=n.length;let r=0,a=s-1;for(;r!==s&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==s){r>=a&&(a=Math.max(a,1),r=a-1);const o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,s=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){const c=n[o];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(s!==void 0&&_w(s))for(let o=0,c=s.length;o!==c;++o){const l=s[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===Cu,r=e.length-1;let a=1;for(let o=1;o<r;++o){let c=!1;const l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(s)c=!0;else{const u=o*n,d=u-n,f=u+n;for(let p=0;p!==n;++p){const m=t[u+p];if(m!==t[d+p]||m!==t[f+p]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];const 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(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,s=new n(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}vi.prototype.ValueTypeName="",vi.prototype.TimeBufferType=Float32Array,vi.prototype.ValueBufferType=Float32Array,vi.prototype.DefaultInterpolation=po;class ba extends vi{constructor(e,t,n){super(e,t,n)}}ba.prototype.ValueTypeName="bool",ba.prototype.ValueBufferType=Array,ba.prototype.DefaultInterpolation=fo,ba.prototype.InterpolantFactoryMethodLinear=void 0,ba.prototype.InterpolantFactoryMethodSmooth=void 0;class hg extends vi{constructor(e,t,n,s){super(e,t,n,s)}}hg.prototype.ValueTypeName="color";class fr extends vi{constructor(e,t,n,s){super(e,t,n,s)}}fr.prototype.ValueTypeName="number";class Iw extends Ro{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(s-t);let l=e*o;for(let h=l+o;l!==h;l+=4)Yt.slerpFlat(r,0,a,l-o,a,l,c);return r}}class Us extends vi{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new Iw(this.times,this.values,this.getValueSize(),e)}}Us.prototype.ValueTypeName="quaternion",Us.prototype.InterpolantFactoryMethodSmooth=void 0;class Ea extends vi{constructor(e,t,n){super(e,t,n)}}Ea.prototype.ValueTypeName="string",Ea.prototype.ValueBufferType=Array,Ea.prototype.DefaultInterpolation=fo,Ea.prototype.InterpolantFactoryMethodLinear=void 0,Ea.prototype.InterpolantFactoryMethodSmooth=void 0;class pr extends vi{constructor(e,t,n,s){super(e,t,n,s)}}pr.prototype.ValueTypeName="vector";class Sl{constructor(e="",t=-1,n=[],s=Iu){this.name=e,this.tracks=n,this.duration=t,this.blendMode=s,this.uuid=xi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,s=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Mw(n[a]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,a=n.length;r!==a;++r)t.push(vi.toJSON(n[r]));return s}static CreateFromMorphTargetSequence(e,t,n,s){const 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);const h=ww(c);c=og(c,1,h),l=og(l,1,h),!s&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new fr(".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)){const s=e;n=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===t)return n[s];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const s={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){const l=e[o],h=l.name.match(r);if(h&&h.length>1){const u=h[1];let d=s[u];d||(s[u]=d=[]),d.push(l)}}const a=[];for(const o in s)a.push(this.CreateFromMorphTargetSequence(o,s[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,p,m){if(f.length!==0){const g=[],A=[];cg(f,g,A,p),g.length!==0&&m.push(new u(d,g,A))}},s=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let p;for(p=0;p<d.length;p++)if(d[p].morphTargets)for(let m=0;m<d[p].morphTargets.length;m++)f[d[p].morphTargets[m]]=-1;for(const m in f){const g=[],A=[];for(let _=0;_!==d[p].morphTargets.length;++_){const x=d[p];g.push(x.time),A.push(x.morphTarget===m?1:0)}s.push(new fr(".morphTargetInfluence["+m+"]",g,A))}c=f.length*a}else{const f=".bones["+t[u].name+"]";n(pr,f+".position",d,"pos",s),n(Us,f+".quaternion",d,"rot",s),n(pr,f+".scale",d,"scl",s)}}return s.length===0?null:new this(r,c,s,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,s=e.length;n!==s;++n){const 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(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Sw(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return fr;case"vector":case"vector2":case"vector3":case"vector4":return pr;case"color":return hg;case"quaternion":return Us;case"bool":case"boolean":return ba;case"string":return Ea}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function Mw(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Sw(i.type);if(i.times===void 0){const t=[],n=[];cg(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const rs={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class ug{constructor(e,t,n){const s=this;let r=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,r===!1&&s.onStart!==void 0&&s.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,s.onProgress!==void 0&&s.onProgress(h,a,o),a===o&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.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){const 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){const f=l[u],p=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return p}return null}}}const Bw=new ug;class ci{constructor(e){this.manager=e!==void 0?e:Bw,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(s,r){n.load(e,s,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}}ci.DEFAULT_MATERIAL_NAME="__DEFAULT";const as={};class Tw extends Error{constructor(e,t){super(e),this.response=t}}class os extends ci{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=rs.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(as[e]!==void 0){as[e].push({onLoad:t,onProgress:n,onError:s});return}as[e]=[],as[e].push({onLoad:t,onProgress:n,onError:s});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const h=as[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,p=f!==0;let m=0;const g=new ReadableStream({start(A){_();function _(){u.read().then(({done:x,value:E})=>{if(x)A.close();else{m+=E.byteLength;const S=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:f});for(let w=0,I=h.length;w<I;w++){const T=h[w];T.onProgress&&T.onProgress(S)}A.enqueue(E),_()}},x=>{A.error(x)})}}});return new Response(g)}else throw new Tw(`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();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(p=>f.decode(p))}}}).then(l=>{rs.add(e,l);const h=as[e];delete as[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{const h=as[e];if(h===void 0)throw this.manager.itemError(e),l;delete as[e];for(let u=0,d=h.length;u<d;u++){const 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}}class Rw extends ci{constructor(e){super(e)}load(e,t,n,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=rs.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o=mo("img");function c(){h(),rs.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(u){h(),s&&s(u),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),r.manager.itemStart(e),o.src=e,o}}class Fw extends ci{constructor(e){super(e)}load(e,t,n,s){const r=this,a=new ll,o=new os(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,function(c){let l;try{l=r.parse(c)}catch(h){if(s!==void 0)s(h);else{console.error(h);return}}l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:Zn,a.wrapT=l.wrapT!==void 0?l.wrapT:Zn,a.magFilter=l.magFilter!==void 0?l.magFilter:qt,a.minFilter=l.minFilter!==void 0?l.minFilter:qt,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(a.colorSpace=l.colorSpace),l.flipY!==void 0&&(a.flipY=l.flipY),l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps,a.minFilter=ri),l.mipmapCount===1&&(a.minFilter=qt),l.generateMipmaps!==void 0&&(a.generateMipmaps=l.generateMipmaps),a.needsUpdate=!0,t&&t(a,l)},n,s),a}}class dg extends ci{constructor(e){super(e)}load(e,t,n,s){const r=new nn,a=new Rw(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,s),r}}class Fo extends Tt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Fe(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class Nw extends Fo{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Tt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Fe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const ud=new Re,fg=new G,pg=new G;class dd{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Je(512,512),this.mapType=cn,this.map=null,this.mapPass=null,this.matrix=new Re,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new sd,this._frameExtents=new Je(1,1),this._viewportCount=1,this._viewports=[new gt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;fg.setFromMatrixPosition(e.matrixWorld),t.position.copy(fg),pg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(pg),t.updateMatrixWorld(),ud.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ud),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(ud)}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}clone(){return new this.constructor().copy(this)}toJSON(){const 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}}class Dw extends dd{constructor(){super(new Bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ea*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Ag extends Fo{constructor(e,t,n=0,s=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Tt.DEFAULT_UP),this.updateMatrix(),this.target=new Tt,this.distance=n,this.angle=s,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Dw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const gg=new Re,No=new G,fd=new G;class Lw extends dd{constructor(){super(new Bn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Je(4,2),this._viewportCount=6,this._viewports=[new gt(2,1,1,1),new gt(0,1,1,1),new gt(3,1,1,1),new gt(1,1,1,1),new gt(3,0,1,1),new gt(1,0,1,1)],this._cubeDirections=[new G(1,0,0),new G(-1,0,0),new G(0,0,1),new G(0,0,-1),new G(0,1,0),new G(0,-1,0)],this._cubeUps=[new G(0,1,0),new G(0,1,0),new G(0,1,0),new G(0,1,0),new G(0,0,1),new G(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,s=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),No.setFromMatrixPosition(e.matrixWorld),n.position.copy(No),fd.copy(n.position),fd.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(fd),n.updateMatrixWorld(),s.makeTranslation(-No.x,-No.y,-No.z),gg.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gg)}}class Ml extends Fo{constructor(e,t,n=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new Lw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class pd extends NA{constructor(e=-1,t=1,n=1,s=-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=s,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,s,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=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=s+t,c=s-t;if(this.view!==null&&this.view.enabled){const 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.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Pw extends dd{constructor(){super(new pd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ad extends Fo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Tt.DEFAULT_UP),this.updateMatrix(),this.target=new Tt,this.shadow=new Pw}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class mg extends Fo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ar{static extractUrlBase(e){const 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)}}class kw extends ci{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=rs.get(e);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(l=>{t&&t(l),r.manager.itemEnd(e)}).catch(l=>{s&&s(l)});return}return setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const 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){return rs.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){s&&s(l),rs.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});rs.add(e,c),r.manager.itemStart(e)}}class Uw extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ow{constructor(e,t,n){this.binding=e,this.valueSize=n;let s,r,a;switch(t){case"quaternion":s=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:s=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=s,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){const n=this.buffer,s=this.valueSize,r=e*s+s;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==s;++o)n[r+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,r,0,o,s)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,s=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,s,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,s=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,s,c,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,s,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,s=n*this._origIndex;e.getValue(t,s);for(let r=n,a=s;r!==a;++r)t[r]=t[s+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const 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(){const 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,s,r){if(s>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,s){Yt.slerpFlat(e,t,e,t,e,n,s)}_slerpAdditive(e,t,n,s,r){const a=this._workIndex*r;Yt.multiplyQuaternionsFlat(e,a,e,t,e,n),Yt.slerpFlat(e,t,e,t,e,a,s)}_lerp(e,t,n,s,r){const a=1-s;for(let o=0;o!==r;++o){const c=t+o;e[c]=e[c]*a+e[n+o]*s}}_lerpAdditive(e,t,n,s,r){for(let a=0;a!==r;++a){const o=t+a;e[o]=e[o]+e[n+a]*s}}}const gd="\\[\\]\\.:\\/",Qw=new RegExp("["+gd+"]","g"),md="[^"+gd+"]",Gw="[^"+gd.replace("\\.","")+"]",Hw=/((?:WC+[\/:])*)/.source.replace("WC",md),zw=/(WCOD+)?/.source.replace("WCOD",Gw),Vw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",md),Ww=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",md),qw=new RegExp("^"+Hw+zw+Vw+Ww+"$"),Kw=["material","materials","bones","map"];class jw{constructor(e,t,n){const s=n||_t.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class _t{constructor(e,t,n){this.path=t,this.parsedPath=n||_t.parseTrackName(t),this.node=_t.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 _t.Composite(e,t,n):new _t(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Qw,"")}static parseTrackName(e){const t=qw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=n.nodeName.substring(s+1);Kw.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),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){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let a=0;a<r.length;a++){const o=r[a];if(o.name===t||o.uuid===t)return o;const c=n(o.children);if(c)return c}return null},s=n(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)e[t++]=n[s]}_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){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=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;const t=this.parsedPath,n=t.objectName,s=t.propertyName;let r=t.propertyIndex;if(e||(e=_t.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.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){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const a=e[s];if(a===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+s+" 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(s==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.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=s;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}}_t.Composite=jw,_t.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},_t.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},_t.prototype.GetterByBindingType=[_t.prototype._getValue_direct,_t.prototype._getValue_array,_t.prototype._getValue_arrayElement,_t.prototype._getValue_toArray],_t.prototype.SetterByBindingTypeAndVersioning=[[_t.prototype._setValue_direct,_t.prototype._setValue_direct_setNeedsUpdate,_t.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[_t.prototype._setValue_array,_t.prototype._setValue_array_setNeedsUpdate,_t.prototype._setValue_array_setMatrixWorldNeedsUpdate],[_t.prototype._setValue_arrayElement,_t.prototype._setValue_arrayElement_setNeedsUpdate,_t.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[_t.prototype._setValue_fromArray,_t.prototype._setValue_fromArray_setNeedsUpdate,_t.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Xw{constructor(e,t,n=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=s;const r=t.tracks,a=r.length,o=new Array(a),c={endingStart:Jr,endingEnd:Jr};for(let l=0;l!==a;++l){const h=r[l].createInterpolant(null);o[l]=h,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=sA,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){const s=this._clip.duration,r=e._clip.duration,a=r/s,o=s/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(){const 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){const s=this._mixer,r=s.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=s._lendControlInterpolant(),this._timeScaleInterpolant=o);const c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){const 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,s){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Qy:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Iu:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(s,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const s=n.evaluate(e)[0];t*=s,e>n.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const s=n.evaluate(e)[0];t*=s,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let s=this.time+e,r=this._loopCount;const a=n===Oy;if(e===0)return r===-1?s:a&&(r&1)===1?t-s:s;if(n===iA){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,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)),s>=t||s<0){const o=Math.floor(s/t);s-=t*o,r+=Math.abs(o);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=s;if(a&&(r&1)===1)return t-s}return s}_setEndings(e,t,n){const s=this._interpolantSettings;n?(s.endingStart=Zr,s.endingEnd=Zr):(e?s.endingStart=this.zeroSlopeAtStart?Zr:Jr:s.endingStart=Qc,t?s.endingEnd=this.zeroSlopeAtEnd?Zr:Jr:s.endingEnd=Qc)}_scheduleFading(e,t,n){const s=this._mixer,r=s.time;let a=this._weightInterpolant;a===null&&(a=s._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=n,this}}const Yw=new Float32Array(1);class xg extends Ms{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,s=e._clip.tracks,r=s.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){const d=s[u],f=d.name;let p=h[f];if(p!==void 0)++p.referenceCount,a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,c,f));continue}const m=t&&t._propertyBindings[u].binding.parsedPath;p=new Ow(_t.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,c,f),a[u]=p}o[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,n)}const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const 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;const 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){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const s=this._actions,r=this._actionsByClip;let a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=s.length,s.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],s=e._cacheIndex;n._cacheIndex=s,t[s]=n,t.pop(),e._cacheIndex=null;const 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;const u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],c.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,s=this._nActiveActions++,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,s=--this._nActiveActions,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const s=this._bindingsByRootAndName,r=this._bindings;let a=s[t];a===void 0&&(a={},s[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,s=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[s],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[s]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,s=this._nActiveBindings++,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,s=--this._nActiveBindings,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new lg(new Float32Array(2),new Float32Array(2),1,Yw),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,s=--this._nActiveControlInterpolants,r=t[s];e.__cacheIndex=s,t[s]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const s=t||this._root,r=s.uuid;let a=typeof e=="string"?Sl.findByName(s,e):e;const o=a!==null?a.uuid:e,c=this._actionsByClip[o];let l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Iu),c!==void 0){const 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;const h=new Xw(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(e,t){const n=t||this._root,s=n.uuid,r=typeof e=="string"?Sl.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[s]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,s=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(s,e,r,a);const 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){const t=this._actions,n=e.uuid,s=this._actionsByClip,r=s[n];if(r!==void 0){const a=r.knownActions;for(let o=0,c=a.length;o!==c;++o){const l=a[o];this._deactivateAction(l);const 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 s[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const s=this._bindingsByRootAndName,r=s[t];if(r!==void 0)for(const a in r){const o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class bg{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=at(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(at(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Os=new G,Bl=new Re,xd=new Re;class Jw extends xl{constructor(e){const t=Eg(e),n=new Mn,s=[],r=[],a=new Fe(0,0,1),o=new Fe(0,1,0);for(let l=0;l<t.length;l++){const h=t[l];h.parent&&h.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new Jt(s,3)),n.setAttribute("color",new Jt(r,3));const c=new ma({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,s=n.getAttribute("position");xd.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<t.length;r++){const o=t[r];o.parent&&o.parent.isBone&&(Bl.multiplyMatrices(xd,o.matrixWorld),Os.setFromMatrixPosition(Bl),s.setXYZ(a,Os.x,Os.y,Os.z),Bl.multiplyMatrices(xd,o.parent.matrixWorld),Os.setFromMatrixPosition(Bl),s.setXYZ(a+1,Os.x,Os.y,Os.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Eg(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push(...Eg(i.children[t]));return e}class Zw extends xl{constructor(e=10,t=10,n=4473924,s=8947848){n=new Fe(n),s=new Fe(s);const r=t/2,a=e/t,o=e/2,c=[],l=[];for(let d=0,f=0,p=-o;d<=t;d++,p+=a){c.push(-o,0,p,o,0,p),c.push(p,0,-o,p,0,o);const m=d===r?n:s;m.toArray(l,f),f+=3,m.toArray(l,f),f+=3,m.toArray(l,f),f+=3,m.toArray(l,f),f+=3}const h=new Mn;h.setAttribute("position",new Jt(c,3)),h.setAttribute("color",new Jt(l,3));const u=new ma({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class yg extends xl{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Mn;s.setAttribute("position",new Jt(t,3)),s.setAttribute("color",new Jt(n,3));const r=new ma({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,t,n){const s=new Fe,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(t),s.toArray(r,6),s.toArray(r,9),s.set(n),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class $w extends Ms{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function _g(i,e,t,n){const s=ev(n);switch(t){case eA:return i*e;case Xi:return i*e/s.components*s.byteLength;case su:return i*e/s.components*s.byteLength;case ar:return i*e*2/s.components*s.byteLength;case ru:return i*e*2/s.components*s.byteLength;case tA:return i*e*3/s.components*s.byteLength;case hn:return i*e*4/s.components*s.byteLength;case au:return i*e*4/s.components*s.byteLength;case Fc:case oo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Nc:case co:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ou:case cu:return Math.max(i,16)*Math.max(e,8)/4;case Dc:case Lc:return Math.max(i,8)*Math.max(e,8)/2;case Pc:case kc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Uc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case lo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case lu:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case hu:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case uu:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case ho:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case du:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case fu:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case pu:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Au:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case gu:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case mu:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case xu:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case bu:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Eu:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case uo:case yu:case Oc:return Math.ceil(i/4)*Math.ceil(e/4)*16;case nA:case _u:return Math.ceil(i/4)*Math.ceil(e/4)*8;case wu:case vu:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function ev(i){switch(i){case cn:case Jp:return{byteLength:1,components:1};case io:case Zp:case kn:return{byteLength:2,components:1};case nu:case iu:return{byteLength:2,components:4};case rr:case tu:case ln:return{byteLength:4,components:1};case $p:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ic}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ic);function wg(){let i=null,e=!1,t=null,n=null;function s(r,a){t(r,a),n=i.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(s),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){i=r}}}function tv(i){const e=new WeakMap;function t(o,c){const l=o.array,h=o.usage,u=l.byteLength,d=i.createBuffer();i.bindBuffer(c,d),i.bufferData(c,l,h),o.onUploadCallback();let f;if(l instanceof Float32Array)f=i.FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=i.HALF_FLOAT:f=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=i.SHORT;else if(l instanceof Uint32Array)f=i.UNSIGNED_INT;else if(l instanceof Int32Array)f=i.INT;else if(l instanceof Int8Array)f=i.BYTE;else if(l instanceof Uint8Array)f=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=i.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){const h=c.array,u=c.updateRanges;if(i.bindBuffer(l,o),u.length===0)i.bufferSubData(l,0,h);else{u.sort((f,p)=>f.start-p.start);let d=0;for(let f=1;f<u.length;f++){const p=u[d],m=u[f];m.start<=p.start+p.count+1?p.count=Math.max(p.count,m.start+m.count-p.start):(++d,u[d]=m)}u.length=d+1;for(let f=0,p=u.length;f<p;f++){const m=u[f];i.bufferSubData(l,m.start*h.BYTES_PER_ELEMENT,h,m.start,m.count)}c.clearUpdateRanges()}c.onUploadCallback()}function s(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(i.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const 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}const 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:s,remove:r,update:a}}var nv=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
-#endif`,nv=`#ifdef USE_ALPHAHASH
+#endif`,iv=`#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 ) ) ) );
@@ -74,20 +74,20 @@
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
-#endif`,iv=`#ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,sv=`#ifdef USE_ALPHAMAP
+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
+#endif`,rv=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,rv=`#ifdef USE_ALPHATEST
+#endif`,av=`#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`,av=`#ifdef USE_ALPHATEST
+#endif`,ov=`#ifdef USE_ALPHATEST
uniform float alphaTest;
-#endif`,ov=`#ifdef USE_AOMAP
+#endif`,cv=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
@@ -100,10 +100,10 @@
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
-#endif`,cv=`#ifdef USE_AOMAP
+#endif`,lv=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
-#endif`,lv=`#ifdef USE_BATCHING
+#endif`,hv=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
@@ -137,15 +137,15 @@
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
-#endif`,hv=`#ifdef USE_BATCHING
+#endif`,uv=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
-#endif`,uv=`vec3 transformed = vec3( position );
+#endif`,dv=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
-#endif`,dv=`vec3 objectNormal = vec3( normal );
+#endif`,fv=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
-#endif`,fv=`float G_BlinnPhong_Implicit( ) {
+#endif`,pv=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -159,7 +159,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
-} // validated`,pv=`#ifdef USE_IRIDESCENCE
+} // validated`,Av=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
@@ -222,7 +222,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
}
return max( I, vec3( 0.0 ) );
}
-#endif`,Av=`#ifdef USE_BUMPMAP
+#endif`,gv=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
@@ -243,7 +243,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
-#endif`,gv=`#if NUM_CLIPPING_PLANES > 0
+#endif`,mv=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
@@ -289,26 +289,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
if ( clipped ) discard;
#endif
#endif
-#endif`,mv=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,xv=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,bv=`#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+#endif`,Ev=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
-#endif`,Ev=`#if defined( USE_COLOR_ALPHA )
+#endif`,yv=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
-#endif`,yv=`#if defined( USE_COLOR_ALPHA )
+#endif`,_v=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
-#endif`,_v=`#if defined( USE_COLOR_ALPHA )
+#endif`,wv=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
-#endif`,wv=`#if defined( USE_COLOR_ALPHA )
+#endif`,vv=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec3( 1.0 );
@@ -322,7 +322,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
-#endif`,vv=`#define PI 3.141592653589793
+#endif`,Cv=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
@@ -396,7 +396,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
-} // validated`,Cv=`#ifdef ENVMAP_TYPE_CUBE_UV
+} // validated`,Iv=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
@@ -489,7 +489,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
-#endif`,Iv=`vec3 transformedNormal = objectNormal;
+#endif`,Sv=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
@@ -518,21 +518,21 @@ transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
-#endif`,Sv=`#ifdef USE_DISPLACEMENTMAP
+#endif`,Mv=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
-#endif`,Mv=`#ifdef USE_DISPLACEMENTMAP
+#endif`,Bv=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
-#endif`,Bv=`#ifdef USE_EMISSIVEMAP
+#endif`,Tv=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
-#endif`,Tv=`#ifdef USE_EMISSIVEMAP
+#endif`,Rv=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
-#endif`,Rv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Fv=`vec4 LinearTransferOETF( in vec4 value ) {
+#endif`,Fv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Nv=`vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -540,7 +540,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
-}`,Nv=`#ifdef USE_ENVMAP
+}`,Dv=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
@@ -569,7 +569,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
-#endif`,Dv=`#ifdef USE_ENVMAP
+#endif`,Lv=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
@@ -579,7 +579,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform sampler2D envMap;
#endif
-#endif`,Lv=`#ifdef USE_ENVMAP
+#endif`,Pv=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
@@ -590,7 +590,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
varying vec3 vReflect;
#endif
-#endif`,Pv=`#ifdef USE_ENVMAP
+#endif`,kv=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
@@ -601,7 +601,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
varying vec3 vReflect;
uniform float refractionRatio;
#endif
-#endif`,kv=`#ifdef USE_ENVMAP
+#endif`,Uv=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
@@ -618,18 +618,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
-#endif`,Uv=`#ifdef USE_FOG
- vFogDepth = - mvPosition.z;
#endif`,Ov=`#ifdef USE_FOG
- varying float vFogDepth;
+ vFogDepth = - mvPosition.z;
#endif`,Qv=`#ifdef USE_FOG
+ varying float vFogDepth;
+#endif`,Gv=`#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`,Gv=`#ifdef USE_FOG
+#endif`,Hv=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
@@ -638,7 +638,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform float fogNear;
uniform float fogFar;
#endif
-#endif`,Hv=`#ifdef USE_GRADIENTMAP
+#endif`,zv=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -650,12 +650,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
-}`,zv=`#ifdef USE_LIGHTMAP
+}`,Vv=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
-#endif`,Vv=`LambertMaterial material;
+#endif`,Wv=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
-material.specularStrength = specularStrength;`,Wv=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,qv=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
@@ -669,7 +669,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,qv=`uniform bool receiveShadow;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Kv=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
@@ -785,7 +785,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
-#endif`,Kv=`#ifdef USE_ENVMAP
+#endif`,jv=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -818,8 +818,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
#endif
}
#endif
-#endif`,jv=`ToonMaterial material;
-material.diffuseColor = diffuseColor.rgb;`,Xv=`varying vec3 vViewPosition;
+#endif`,Xv=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,Yv=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
@@ -831,11 +831,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Yv=`BlinnPhongMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Jv=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
-material.specularStrength = specularStrength;`,Jv=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,Zv=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
@@ -852,7 +852,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Zv=`PhysicalMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,$v=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
@@ -938,7 +938,7 @@ material.roughness = min( material.roughness, 1.0 );
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
-#endif`,$v=`struct PhysicalMaterial {
+#endif`,eC=`struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
@@ -1239,7 +1239,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
-}`,eC=`
+}`,tC=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1354,7 +1354,7 @@ IncidentLight directLight;
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
-#endif`,tC=`#if defined( RE_IndirectDiffuse )
+#endif`,nC=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1373,32 +1373,32 @@ IncidentLight directLight;
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
-#endif`,nC=`#if defined( RE_IndirectDiffuse )
+#endif`,iC=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
-#endif`,iC=`#if defined( USE_LOGDEPTHBUF )
- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,sC=`#if defined( USE_LOGDEPTHBUF )
+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
+#endif`,rC=`#if defined( USE_LOGDEPTHBUF )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,rC=`#ifdef USE_LOGDEPTHBUF
+#endif`,aC=`#ifdef USE_LOGDEPTHBUF
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,aC=`#ifdef USE_LOGDEPTHBUF
+#endif`,oC=`#ifdef USE_LOGDEPTHBUF
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
-#endif`,oC=`#ifdef USE_MAP
+#endif`,cC=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
-#endif`,cC=`#ifdef USE_MAP
+#endif`,lC=`#ifdef USE_MAP
uniform sampler2D map;
-#endif`,lC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+#endif`,hC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
@@ -1410,7 +1410,7 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
-#endif`,hC=`#if defined( USE_POINTS_UV )
+#endif`,uC=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1422,19 +1422,19 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,uC=`float metalnessFactor = metalness;
+#endif`,dC=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
-#endif`,dC=`#ifdef USE_METALNESSMAP
+#endif`,fC=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
-#endif`,fC=`#ifdef USE_INSTANCING_MORPH
+#endif`,pC=`#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`,pC=`#if defined( USE_MORPHCOLORS )
+#endif`,AC=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
@@ -1443,12 +1443,12 @@ IncidentLight directLight;
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
-#endif`,AC=`#ifdef USE_MORPHNORMALS
+#endif`,gC=`#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`,gC=`#ifdef USE_MORPHTARGETS
+#endif`,mC=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1462,12 +1462,12 @@ IncidentLight directLight;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
-#endif`,mC=`#ifdef USE_MORPHTARGETS
+#endif`,xC=`#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`,xC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#endif`,bC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
@@ -1508,7 +1508,7 @@ IncidentLight directLight;
tbn2[1] *= faceDirection;
#endif
#endif
-vec3 nonPerturbedNormal = normal;`,bC=`#ifdef USE_NORMALMAP_OBJECTSPACE
+vec3 nonPerturbedNormal = normal;`,EC=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
@@ -1523,25 +1523,25 @@ vec3 nonPerturbedNormal = normal;`,bC=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
-#endif`,EC=`#ifndef FLAT_SHADED
+#endif`,yC=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,yC=`#ifndef FLAT_SHADED
+#endif`,_C=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,_C=`#ifndef FLAT_SHADED
+#endif`,wC=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
-#endif`,wC=`#ifdef USE_NORMALMAP
+#endif`,vC=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
@@ -1563,13 +1563,13 @@ vec3 nonPerturbedNormal = normal;`,bC=`#ifdef USE_NORMALMAP_OBJECTSPACE
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
-#endif`,vC=`#ifdef USE_CLEARCOAT
+#endif`,CC=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
-#endif`,CC=`#ifdef USE_CLEARCOAT_NORMALMAP
+#endif`,IC=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
-#endif`,IC=`#ifdef USE_CLEARCOATMAP
+#endif`,SC=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
@@ -1578,18 +1578,18 @@ vec3 nonPerturbedNormal = normal;`,bC=`#ifdef USE_NORMALMAP_OBJECTSPACE
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
-#endif`,SC=`#ifdef USE_IRIDESCENCEMAP
+#endif`,MC=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
-#endif`,MC=`#ifdef OPAQUE
+#endif`,BC=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,BC=`vec3 packNormalToRGB( const in vec3 normal ) {
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,TC=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1658,9 +1658,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
-}`,TC=`#ifdef PREMULTIPLIED_ALPHA
+}`,RC=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
-#endif`,RC=`vec4 mvPosition = vec4( transformed, 1.0 );
+#endif`,FC=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
@@ -1668,22 +1668,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
-gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
+gl_Position = projectionMatrix * mvPosition;`,NC=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
-#endif`,NC=`#ifdef DITHERING
+#endif`,DC=`#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`,DC=`float roughnessFactor = roughness;
+#endif`,LC=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
-#endif`,LC=`#ifdef USE_ROUGHNESSMAP
+#endif`,PC=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
-#endif`,PC=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,kC=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
@@ -1869,7 +1869,7 @@ gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
}
return mix( 1.0, shadow, shadowIntensity );
}
-#endif`,kC=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,UC=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
@@ -1910,7 +1910,7 @@ gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
-#endif`,UC=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+#endif`,OC=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
@@ -1942,7 +1942,7 @@ gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
-#endif`,OC=`float getShadowMask() {
+#endif`,QC=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
@@ -1974,12 +1974,12 @@ gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
#endif
#endif
return shadow;
-}`,QC=`#ifdef USE_SKINNING
+}`,GC=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
-#endif`,GC=`#ifdef USE_SKINNING
+#endif`,HC=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
@@ -1994,7 +1994,7 @@ gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
-#endif`,HC=`#ifdef USE_SKINNING
+#endif`,zC=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2002,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
-#endif`,zC=`#ifdef USE_SKINNING
+#endif`,VC=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
@@ -2013,17 +2013,17 @@ gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERING
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
-#endif`,VC=`float specularStrength;
+#endif`,WC=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
-#endif`,WC=`#ifdef USE_SPECULARMAP
+#endif`,qC=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
-#endif`,qC=`#if defined( TONE_MAPPING )
+#endif`,KC=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
-#endif`,KC=`#ifndef saturate
+#endif`,jC=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
@@ -2120,7 +2120,7 @@ vec3 NeutralToneMapping( vec3 color ) {
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
-vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISSION
+vec3 CustomToneMapping( vec3 color ) { return color; }`,XC=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
@@ -2141,7 +2141,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISS
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
-#endif`,XC=`#ifdef USE_TRANSMISSION
+#endif`,YC=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
@@ -2267,7 +2267,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISS
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
-#endif`,YC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,JC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2337,7 +2337,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,JC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,ZC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2431,7 +2431,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,ZC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,$C=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
@@ -2502,7 +2502,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISS
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
-#endif`,$C=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+#endif`,eI=`#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;
@@ -2511,7 +2511,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISS
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
-#endif`;const ct={alphahash_fragment:tv,alphahash_pars_fragment:nv,alphamap_fragment:iv,alphamap_pars_fragment:sv,alphatest_fragment:rv,alphatest_pars_fragment:av,aomap_fragment:ov,aomap_pars_fragment:cv,batching_pars_vertex:lv,batching_vertex:hv,begin_vertex:uv,beginnormal_vertex:dv,bsdfs:fv,iridescence_fragment:pv,bumpmap_pars_fragment:Av,clipping_planes_fragment:gv,clipping_planes_pars_fragment:mv,clipping_planes_pars_vertex:xv,clipping_planes_vertex:bv,color_fragment:Ev,color_pars_fragment:yv,color_pars_vertex:_v,color_vertex:wv,common:vv,cube_uv_reflection_fragment:Cv,defaultnormal_vertex:Iv,displacementmap_pars_vertex:Sv,displacementmap_vertex:Mv,emissivemap_fragment:Bv,emissivemap_pars_fragment:Tv,colorspace_fragment:Rv,colorspace_pars_fragment:Fv,envmap_fragment:Nv,envmap_common_pars_fragment:Dv,envmap_pars_fragment:Lv,envmap_pars_vertex:Pv,envmap_physical_pars_fragment:Kv,envmap_vertex:kv,fog_vertex:Uv,fog_pars_vertex:Ov,fog_fragment:Qv,fog_pars_fragment:Gv,gradientmap_pars_fragment:Hv,lightmap_pars_fragment:zv,lights_lambert_fragment:Vv,lights_lambert_pars_fragment:Wv,lights_pars_begin:qv,lights_toon_fragment:jv,lights_toon_pars_fragment:Xv,lights_phong_fragment:Yv,lights_phong_pars_fragment:Jv,lights_physical_fragment:Zv,lights_physical_pars_fragment:$v,lights_fragment_begin:eC,lights_fragment_maps:tC,lights_fragment_end:nC,logdepthbuf_fragment:iC,logdepthbuf_pars_fragment:sC,logdepthbuf_pars_vertex:rC,logdepthbuf_vertex:aC,map_fragment:oC,map_pars_fragment:cC,map_particle_fragment:lC,map_particle_pars_fragment:hC,metalnessmap_fragment:uC,metalnessmap_pars_fragment:dC,morphinstance_vertex:fC,morphcolor_vertex:pC,morphnormal_vertex:AC,morphtarget_pars_vertex:gC,morphtarget_vertex:mC,normal_fragment_begin:xC,normal_fragment_maps:bC,normal_pars_fragment:EC,normal_pars_vertex:yC,normal_vertex:_C,normalmap_pars_fragment:wC,clearcoat_normal_fragment_begin:vC,clearcoat_normal_fragment_maps:CC,clearcoat_pars_fragment:IC,iridescence_pars_fragment:SC,opaque_fragment:MC,packing:BC,premultiplied_alpha_fragment:TC,project_vertex:RC,dithering_fragment:FC,dithering_pars_fragment:NC,roughnessmap_fragment:DC,roughnessmap_pars_fragment:LC,shadowmap_pars_fragment:PC,shadowmap_pars_vertex:kC,shadowmap_vertex:UC,shadowmask_pars_fragment:OC,skinbase_vertex:QC,skinning_pars_vertex:GC,skinning_vertex:HC,skinnormal_vertex:zC,specularmap_fragment:VC,specularmap_pars_fragment:WC,tonemapping_fragment:qC,tonemapping_pars_fragment:KC,transmission_fragment:jC,transmission_pars_fragment:XC,uv_pars_fragment:YC,uv_pars_vertex:JC,uv_vertex:ZC,worldpos_vertex:$C,background_vert:`varying vec2 vUv;
+#endif`;const ct={alphahash_fragment:nv,alphahash_pars_fragment:iv,alphamap_fragment:sv,alphamap_pars_fragment:rv,alphatest_fragment:av,alphatest_pars_fragment:ov,aomap_fragment:cv,aomap_pars_fragment:lv,batching_pars_vertex:hv,batching_vertex:uv,begin_vertex:dv,beginnormal_vertex:fv,bsdfs:pv,iridescence_fragment:Av,bumpmap_pars_fragment:gv,clipping_planes_fragment:mv,clipping_planes_pars_fragment:xv,clipping_planes_pars_vertex:bv,clipping_planes_vertex:Ev,color_fragment:yv,color_pars_fragment:_v,color_pars_vertex:wv,color_vertex:vv,common:Cv,cube_uv_reflection_fragment:Iv,defaultnormal_vertex:Sv,displacementmap_pars_vertex:Mv,displacementmap_vertex:Bv,emissivemap_fragment:Tv,emissivemap_pars_fragment:Rv,colorspace_fragment:Fv,colorspace_pars_fragment:Nv,envmap_fragment:Dv,envmap_common_pars_fragment:Lv,envmap_pars_fragment:Pv,envmap_pars_vertex:kv,envmap_physical_pars_fragment:jv,envmap_vertex:Uv,fog_vertex:Ov,fog_pars_vertex:Qv,fog_fragment:Gv,fog_pars_fragment:Hv,gradientmap_pars_fragment:zv,lightmap_pars_fragment:Vv,lights_lambert_fragment:Wv,lights_lambert_pars_fragment:qv,lights_pars_begin:Kv,lights_toon_fragment:Xv,lights_toon_pars_fragment:Yv,lights_phong_fragment:Jv,lights_phong_pars_fragment:Zv,lights_physical_fragment:$v,lights_physical_pars_fragment:eC,lights_fragment_begin:tC,lights_fragment_maps:nC,lights_fragment_end:iC,logdepthbuf_fragment:sC,logdepthbuf_pars_fragment:rC,logdepthbuf_pars_vertex:aC,logdepthbuf_vertex:oC,map_fragment:cC,map_pars_fragment:lC,map_particle_fragment:hC,map_particle_pars_fragment:uC,metalnessmap_fragment:dC,metalnessmap_pars_fragment:fC,morphinstance_vertex:pC,morphcolor_vertex:AC,morphnormal_vertex:gC,morphtarget_pars_vertex:mC,morphtarget_vertex:xC,normal_fragment_begin:bC,normal_fragment_maps:EC,normal_pars_fragment:yC,normal_pars_vertex:_C,normal_vertex:wC,normalmap_pars_fragment:vC,clearcoat_normal_fragment_begin:CC,clearcoat_normal_fragment_maps:IC,clearcoat_pars_fragment:SC,iridescence_pars_fragment:MC,opaque_fragment:BC,packing:TC,premultiplied_alpha_fragment:RC,project_vertex:FC,dithering_fragment:NC,dithering_pars_fragment:DC,roughnessmap_fragment:LC,roughnessmap_pars_fragment:PC,shadowmap_pars_fragment:kC,shadowmap_pars_vertex:UC,shadowmap_vertex:OC,shadowmask_pars_fragment:QC,skinbase_vertex:GC,skinning_pars_vertex:HC,skinning_vertex:zC,skinnormal_vertex:VC,specularmap_fragment:WC,specularmap_pars_fragment:qC,tonemapping_fragment:KC,tonemapping_pars_fragment:jC,transmission_fragment:XC,transmission_pars_fragment:YC,uv_pars_fragment:JC,uv_pars_vertex:ZC,uv_vertex:$C,worldpos_vertex:eI,background_vert:`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
@@ -3563,7 +3563,7 @@ void main() {
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
-}`},we={common:{diffuse:{value:new Fe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ot},alphaMap:{value:null},alphaMapTransform:{value:new ot},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ot}},envmap:{envMap:{value:null},envMapRotation:{value:new ot},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ot}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ot}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ot},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ot},normalScale:{value:new Je(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ot},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ot}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ot}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ot}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Fe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Fe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ot},alphaTest:{value:0},uvTransform:{value:new ot}},sprite:{diffuse:{value:new Fe(16777215)},opacity:{value:1},center:{value:new Je(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ot},alphaMap:{value:null},alphaMapTransform:{value:new ot},alphaTest:{value:0}}},Oi={basic:{uniforms:kn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:ct.meshbasic_vert,fragmentShader:ct.meshbasic_frag},lambert:{uniforms:kn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Fe(0)}}]),vertexShader:ct.meshlambert_vert,fragmentShader:ct.meshlambert_frag},phong:{uniforms:kn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Fe(0)},specular:{value:new Fe(1118481)},shininess:{value:30}}]),vertexShader:ct.meshphong_vert,fragmentShader:ct.meshphong_frag},standard:{uniforms:kn([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new Fe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag},toon:{uniforms:kn([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new Fe(0)}}]),vertexShader:ct.meshtoon_vert,fragmentShader:ct.meshtoon_frag},matcap:{uniforms:kn([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:ct.meshmatcap_vert,fragmentShader:ct.meshmatcap_frag},points:{uniforms:kn([we.points,we.fog]),vertexShader:ct.points_vert,fragmentShader:ct.points_frag},dashed:{uniforms:kn([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ct.linedashed_vert,fragmentShader:ct.linedashed_frag},depth:{uniforms:kn([we.common,we.displacementmap]),vertexShader:ct.depth_vert,fragmentShader:ct.depth_frag},normal:{uniforms:kn([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:ct.meshnormal_vert,fragmentShader:ct.meshnormal_frag},sprite:{uniforms:kn([we.sprite,we.fog]),vertexShader:ct.sprite_vert,fragmentShader:ct.sprite_frag},background:{uniforms:{uvTransform:{value:new ot},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ct.background_vert,fragmentShader:ct.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ot}},vertexShader:ct.backgroundCube_vert,fragmentShader:ct.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ct.cube_vert,fragmentShader:ct.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ct.equirect_vert,fragmentShader:ct.equirect_frag},distanceRGBA:{uniforms:kn([we.common,we.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ct.distanceRGBA_vert,fragmentShader:ct.distanceRGBA_frag},shadow:{uniforms:kn([we.lights,we.fog,{color:{value:new Fe(0)},opacity:{value:1}}]),vertexShader:ct.shadow_vert,fragmentShader:ct.shadow_frag}};Oi.physical={uniforms:kn([Oi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ot},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ot},clearcoatNormalScale:{value:new Je(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ot},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ot},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ot},sheen:{value:0},sheenColor:{value:new Fe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ot},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ot},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ot},transmissionSamplerSize:{value:new Je},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ot},attenuationDistance:{value:0},attenuationColor:{value:new Fe(0)},specularColor:{value:new Fe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ot},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ot},anisotropyVector:{value:new Je},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ot}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag};const Ml={r:0,b:0,g:0},gr=new dn,eI=new Re;function tI(i,e,t,n,s,r,a){const o=new Fe(0);let c=r===!0?0:1,l,h,u=null,d=0,f=null;function p(x){let E=x.isScene===!0?x.background:null;return E&&E.isTexture&&(E=(x.backgroundBlurriness>0?t:e).get(E)),E}function m(x){let E=!1;const S=p(x);S===null?A(o,c):S&&S.isColor&&(A(S,1),E=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,a):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function g(x,E){const S=p(E);S&&(S.isCubeTexture||S.mapping===Sc)?(h===void 0&&(h=new Zt(new da(1,1,1),new Ls({name:"BackgroundCubeMaterial",uniforms:fa(Oi.backgroundCube.uniforms),vertexShader:Oi.backgroundCube.vertexShader,fragmentShader:Oi.backgroundCube.fragmentShader,side:Dn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(w,I,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),gr.copy(E.backgroundRotation),gr.x*=-1,gr.y*=-1,gr.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(gr.y*=-1,gr.z*=-1),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(eI.makeRotationFromEuler(gr)),h.material.toneMapped=tt.getTransfer(S.colorSpace)!==Rt,(u!==S||d!==S.version||f!==i.toneMapping)&&(h.material.needsUpdate=!0,u=S,d=S.version,f=i.toneMapping),h.layers.enableAll(),x.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(l===void 0&&(l=new Zt(new _l(2,2),new Ls({name:"BackgroundMaterial",uniforms:fa(Oi.background.uniforms),vertexShader:Oi.background.vertexShader,fragmentShader:Oi.background.fragmentShader,side:Ki,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=S,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.toneMapped=tt.getTransfer(S.colorSpace)!==Rt,S.matrixAutoUpdate===!0&&S.updateMatrix(),l.material.uniforms.uvTransform.value.copy(S.matrix),(u!==S||d!==S.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=S,d=S.version,f=i.toneMapping),l.layers.enableAll(),x.unshift(l,l.geometry,l.material,0,0,null))}function A(x,E){x.getRGB(Ml,RA(i)),n.buffers.color.setClear(Ml.r,Ml.g,Ml.b,E,a)}function _(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(x,E=1){o.set(x),c=E,A(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(x){c=x,A(o,c)},render:m,addToRenderList:g,dispose:_}}function nI(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=d(null);let r=s,a=!1;function o(v,F,K,q,$){let D=!1;const O=u(q,K,F);r!==O&&(r=O,l(r.object)),D=f(v,q,K,$),D&&p(v,q,K,$),$!==null&&e.update($,i.ELEMENT_ARRAY_BUFFER),(D||a)&&(a=!1,E(v,F,K,q),$!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get($).buffer))}function c(){return i.createVertexArray()}function l(v){return i.bindVertexArray(v)}function h(v){return i.deleteVertexArray(v)}function u(v,F,K){const q=K.wireframe===!0;let $=n[v.id];$===void 0&&($={},n[v.id]=$);let D=$[F.id];D===void 0&&(D={},$[F.id]=D);let O=D[q];return O===void 0&&(O=d(c()),D[q]=O),O}function d(v){const F=[],K=[],q=[];for(let $=0;$<t;$++)F[$]=0,K[$]=0,q[$]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:K,attributeDivisors:q,object:v,attributes:{},index:null}}function f(v,F,K,q){const $=r.attributes,D=F.attributes;let O=0;const Y=K.getAttributes();for(const Q in Y)if(Y[Q].location>=0){const ee=$[Q];let ae=D[Q];if(ae===void 0&&(Q==="instanceMatrix"&&v.instanceMatrix&&(ae=v.instanceMatrix),Q==="instanceColor"&&v.instanceColor&&(ae=v.instanceColor)),ee===void 0||ee.attribute!==ae||ae&&ee.data!==ae.data)return!0;O++}return r.attributesNum!==O||r.index!==q}function p(v,F,K,q){const $={},D=F.attributes;let O=0;const Y=K.getAttributes();for(const Q in Y)if(Y[Q].location>=0){let ee=D[Q];ee===void 0&&(Q==="instanceMatrix"&&v.instanceMatrix&&(ee=v.instanceMatrix),Q==="instanceColor"&&v.instanceColor&&(ee=v.instanceColor));const ae={};ae.attribute=ee,ee&&ee.data&&(ae.data=ee.data),$[Q]=ae,O++}r.attributes=$,r.attributesNum=O,r.index=q}function m(){const v=r.newAttributes;for(let F=0,K=v.length;F<K;F++)v[F]=0}function g(v){A(v,0)}function A(v,F){const K=r.newAttributes,q=r.enabledAttributes,$=r.attributeDivisors;K[v]=1,q[v]===0&&(i.enableVertexAttribArray(v),q[v]=1),$[v]!==F&&(i.vertexAttribDivisor(v,F),$[v]=F)}function _(){const v=r.newAttributes,F=r.enabledAttributes;for(let K=0,q=F.length;K<q;K++)F[K]!==v[K]&&(i.disableVertexAttribArray(K),F[K]=0)}function x(v,F,K,q,$,D,O){O===!0?i.vertexAttribIPointer(v,F,K,$,D):i.vertexAttribPointer(v,F,K,q,$,D)}function E(v,F,K,q){m();const $=q.attributes,D=K.getAttributes(),O=F.defaultAttributeValues;for(const Y in D){const Q=D[Y];if(Q.location>=0){let J=$[Y];if(J===void 0&&(Y==="instanceMatrix"&&v.instanceMatrix&&(J=v.instanceMatrix),Y==="instanceColor"&&v.instanceColor&&(J=v.instanceColor)),J!==void 0){const ee=J.normalized,ae=J.itemSize,_e=e.get(J);if(_e===void 0)continue;const Me=_e.buffer,se=_e.type,me=_e.bytesPerElement,xe=se===i.INT||se===i.UNSIGNED_INT||J.gpuType===$h;if(J.isInterleavedBufferAttribute){const be=J.data,Ue=be.stride,et=J.offset;if(be.isInstancedInterleavedBuffer){for(let He=0;He<Q.locationSize;He++)A(Q.location+He,be.meshPerAttribute);v.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let He=0;He<Q.locationSize;He++)g(Q.location+He);i.bindBuffer(i.ARRAY_BUFFER,Me);for(let He=0;He<Q.locationSize;He++)x(Q.location+He,ae/Q.locationSize,se,ee,Ue*me,(et+ae/Q.locationSize*He)*me,xe)}else{if(J.isInstancedBufferAttribute){for(let be=0;be<Q.locationSize;be++)A(Q.location+be,J.meshPerAttribute);v.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let be=0;be<Q.locationSize;be++)g(Q.location+be);i.bindBuffer(i.ARRAY_BUFFER,Me);for(let be=0;be<Q.locationSize;be++)x(Q.location+be,ae/Q.locationSize,se,ee,ae*me,ae/Q.locationSize*be*me,xe)}}else if(O!==void 0){const ee=O[Y];if(ee!==void 0)switch(ee.length){case 2:i.vertexAttrib2fv(Q.location,ee);break;case 3:i.vertexAttrib3fv(Q.location,ee);break;case 4:i.vertexAttrib4fv(Q.location,ee);break;default:i.vertexAttrib1fv(Q.location,ee)}}}}_()}function S(){T();for(const v in n){const F=n[v];for(const K in F){const q=F[K];for(const $ in q)h(q[$].object),delete q[$];delete F[K]}delete n[v]}}function w(v){if(n[v.id]===void 0)return;const F=n[v.id];for(const K in F){const q=F[K];for(const $ in q)h(q[$].object),delete q[$];delete F[K]}delete n[v.id]}function I(v){for(const F in n){const K=n[F];if(K[v.id]===void 0)continue;const q=K[v.id];for(const $ in q)h(q[$].object),delete q[$];delete K[v.id]}}function T(){C(),a=!0,r!==s&&(r=s,l(r.object))}function C(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:o,reset:T,resetDefaultState:C,dispose:S,releaseStatesOfGeometry:w,releaseStatesOfProgram:I,initAttributes:m,enableAttribute:g,disableUnusedAttributes:_}}function iI(i,e,t){let n;function s(l){n=l}function r(l,h){i.drawArrays(n,l,h),t.update(h,n,1)}function a(l,h,u){u!==0&&(i.drawArraysInstanced(n,l,h,u),t.update(h,n,u))}function o(l,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,u);let f=0;for(let p=0;p<u;p++)f+=h[p];t.update(f,n,1)}function c(l,h,u,d){if(u===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let p=0;p<l.length;p++)a(l[p],h[p],d[p]);else{f.multiDrawArraysInstancedWEBGL(n,l,0,h,0,d,0,u);let p=0;for(let m=0;m<u;m++)p+=h[m]*d[m];t.update(p,n,1)}}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function sI(i,e,t,n){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");s=i.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(I){return!(I!==hn&&n.convert(I)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(I){const T=I===Pn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==cn&&n.convert(I)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==ln&&!T)}function c(I){if(I==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const h=c(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const u=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),A=i.getParameter(i.MAX_VERTEX_ATTRIBS),_=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),x=i.getParameter(i.MAX_VARYING_VECTORS),E=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:u,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:g,maxAttributes:A,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:E,vertexTextures:S,maxSamples:w}}function rI(i){const e=this;let t=null,n=0,s=!1,r=!1;const a=new ks,o=new ot,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||s;return s=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){const p=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,A=i.get(u);if(!s||p===null||p.length===0||r&&!g)r?h(null):l();else{const _=r?0:n,x=_*4;let E=A.clippingState||null;c.value=E,E=h(p,d,x,f);for(let S=0;S!==x;++S)E[S]=t[S];A.clippingState=E,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=_}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,p){const m=u!==null?u.length:0;let g=null;if(m!==0){if(g=c.value,p!==!0||g===null){const A=f+m*4,_=d.matrixWorldInverse;o.getNormalMatrix(_),(g===null||g.length<A)&&(g=new Float32Array(A));for(let x=0,E=f;x!==m;++x,E+=4)a.copy(u[x]).applyMatrix4(_,o),a.normal.toArray(g,E),g[E+3]=a.constant}c.value=g,c.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,g}}function aI(i){let e=new WeakMap;function t(a,o){return o===Ic?a.mapping=sr:o===Zh&&(a.mapping=Yr),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Ic||o===Zh)if(e.has(a)){const c=e.get(a).texture;return t(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new G_(c.height);return l.fromEquirectangularTexture(i,a),e.set(a,l),a.addEventListener("dispose",s),t(l.texture,a.mapping)}else return null}}return a}function s(a){const o=a.target;o.removeEventListener("dispose",s);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}const ya=4,wg=[.125,.215,.35,.446,.526,.582],mr=20,md=new dd,vg=new Fe;let xd=null,bd=0,Ed=0,yd=!1;const xr=(1+Math.sqrt(5))/2,_a=1/xr,Cg=[new G(-xr,_a,0),new G(xr,_a,0),new G(-_a,0,xr),new G(_a,0,xr),new G(0,xr,-_a),new G(0,xr,_a),new G(-1,1,-1),new G(1,1,-1),new G(-1,1,1),new G(1,1,1)],oI=new G;class _d{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,s=100,r={}){const{size:a=256,position:o=oI}=r;xd=this._renderer.getRenderTarget(),bd=this._renderer.getActiveCubeFace(),Ed=this._renderer.getActiveMipmapLevel(),yd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,s,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=Mg(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Sg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(xd,bd,Ed),this._renderer.xr.enabled=yd,e.scissorTest=!1,Bl(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===sr||e.mapping===Yr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),xd=this._renderer.getRenderTarget(),bd=this._renderer.getActiveCubeFace(),Ed=this._renderer.getActiveMipmapLevel(),yd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:qt,minFilter:qt,generateMipmaps:!1,type:Pn,format:hn,colorSpace:un,depthBuffer:!1},s=Ig(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ig(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=cI(r)),this._blurMaterial=lI(r,e,t)}return s}_compileMaterial(e){const t=new Zt(this._lodPlanes[0],e);this._renderer.compile(t,md)}_sceneToCubeUV(e,t,n,s,r){const c=new Bn(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(vg),u.toneMapping=Is,u.autoClear=!1;const p=new Ds({name:"PMREM.Background",side:Dn,depthWrite:!1,depthTest:!1}),m=new Zt(new da,p);let g=!1;const A=e.background;A?A.isColor&&(p.color.copy(A),e.background=null,g=!0):(p.color.copy(vg),g=!0);for(let _=0;_<6;_++){const x=_%3;x===0?(c.up.set(0,l[_],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[_],r.y,r.z)):x===1?(c.up.set(0,0,l[_]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[_],r.z)):(c.up.set(0,l[_],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[_]));const E=this._cubeSize;Bl(s,x*E,_>2?E:0,E,E),u.setRenderTarget(s),g&&u.render(m,c),u.render(e,c)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=A}_textureToCubeUV(e,t){const n=this._renderer,s=e.mapping===sr||e.mapping===Yr;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Mg()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Sg());const r=s?this._cubemapMaterial:this._equirectMaterial,a=new Zt(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=e;const c=this._cubeSize;Bl(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,md)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const s=this._lodPlanes.length;for(let r=1;r<s;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=Cg[(s-r-1)%Cg.length];this._blur(e,r-1,r,a,o)}t.autoClear=n}_blur(e,t,n,s,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,s,"latitudinal",r),this._halfBlur(a,e,n,n,s,"longitudinal",r)}_halfBlur(e,t,n,s,r,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new Zt(this._lodPlanes[s],l),d=l.uniforms,f=this._sizeLods[n]-1,p=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*mr-1),m=r/p,g=isFinite(r)?1+Math.floor(h*m):mr;g>mr&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${mr}`);const A=[];let _=0;for(let I=0;I<mr;++I){const T=I/m,C=Math.exp(-T*T/2);A.push(C),I===0?_+=C:I<g&&(_+=2*C)}for(let I=0;I<A.length;I++)A[I]=A[I]/_;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=A,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:x}=this;d.dTheta.value=p,d.mipInt.value=x-n;const E=this._sizeLods[s],S=3*E*(s>x-ya?s-x+ya:0),w=4*(this._cubeSize-E);Bl(t,S,w,3*E,2*E),c.setRenderTarget(t),c.render(u,md)}}function cI(i){const e=[],t=[],n=[];let s=i;const r=i-ya+1+wg.length;for(let a=0;a<r;a++){const o=Math.pow(2,s);t.push(o);let c=1/o;a>i-ya?c=wg[a-i+ya-1]:a===0&&(c=0),n.push(c);const l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,p=6,m=3,g=2,A=1,_=new Float32Array(m*p*f),x=new Float32Array(g*p*f),E=new Float32Array(A*p*f);for(let w=0;w<f;w++){const I=w%3*2/3-1,T=w>2?0:-1,C=[I,T,0,I+2/3,T,0,I+2/3,T+1,0,I,T,0,I+2/3,T+1,0,I,T+1,0];_.set(C,m*p*w),x.set(d,g*p*w);const v=[w,w,w,w,w,w];E.set(v,A*p*w)}const S=new Mn;S.setAttribute("position",new Sn(_,m)),S.setAttribute("uv",new Sn(x,g)),S.setAttribute("faceIndex",new Sn(E,A)),e.push(S),s>ya&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Ig(i,e,t){const n=new or(i,e,t);return n.texture.mapping=Sc,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Bl(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function lI(i,e,t){const n=new Float32Array(mr),s=new G(0,1,0);return new Ls({name:"SphericalGaussianBlur",defines:{n:mr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:wd(),fragmentShader:`
+}`},we={common:{diffuse:{value:new Fe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ot},alphaMap:{value:null},alphaMapTransform:{value:new ot},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ot}},envmap:{envMap:{value:null},envMapRotation:{value:new ot},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ot}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ot}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ot},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ot},normalScale:{value:new Je(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ot},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ot}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ot}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ot}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Fe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Fe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ot},alphaTest:{value:0},uvTransform:{value:new ot}},sprite:{diffuse:{value:new Fe(16777215)},opacity:{value:1},center:{value:new Je(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ot},alphaMap:{value:null},alphaMapTransform:{value:new ot},alphaTest:{value:0}}},Qi={basic:{uniforms:Un([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:ct.meshbasic_vert,fragmentShader:ct.meshbasic_frag},lambert:{uniforms:Un([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Fe(0)}}]),vertexShader:ct.meshlambert_vert,fragmentShader:ct.meshlambert_frag},phong:{uniforms:Un([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Fe(0)},specular:{value:new Fe(1118481)},shininess:{value:30}}]),vertexShader:ct.meshphong_vert,fragmentShader:ct.meshphong_frag},standard:{uniforms:Un([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new Fe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag},toon:{uniforms:Un([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new Fe(0)}}]),vertexShader:ct.meshtoon_vert,fragmentShader:ct.meshtoon_frag},matcap:{uniforms:Un([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:ct.meshmatcap_vert,fragmentShader:ct.meshmatcap_frag},points:{uniforms:Un([we.points,we.fog]),vertexShader:ct.points_vert,fragmentShader:ct.points_frag},dashed:{uniforms:Un([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ct.linedashed_vert,fragmentShader:ct.linedashed_frag},depth:{uniforms:Un([we.common,we.displacementmap]),vertexShader:ct.depth_vert,fragmentShader:ct.depth_frag},normal:{uniforms:Un([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:ct.meshnormal_vert,fragmentShader:ct.meshnormal_frag},sprite:{uniforms:Un([we.sprite,we.fog]),vertexShader:ct.sprite_vert,fragmentShader:ct.sprite_frag},background:{uniforms:{uvTransform:{value:new ot},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ct.background_vert,fragmentShader:ct.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ot}},vertexShader:ct.backgroundCube_vert,fragmentShader:ct.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ct.cube_vert,fragmentShader:ct.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ct.equirect_vert,fragmentShader:ct.equirect_frag},distanceRGBA:{uniforms:Un([we.common,we.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ct.distanceRGBA_vert,fragmentShader:ct.distanceRGBA_frag},shadow:{uniforms:Un([we.lights,we.fog,{color:{value:new Fe(0)},opacity:{value:1}}]),vertexShader:ct.shadow_vert,fragmentShader:ct.shadow_frag}};Qi.physical={uniforms:Un([Qi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ot},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ot},clearcoatNormalScale:{value:new Je(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ot},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ot},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ot},sheen:{value:0},sheenColor:{value:new Fe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ot},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ot},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ot},transmissionSamplerSize:{value:new Je},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ot},attenuationDistance:{value:0},attenuationColor:{value:new Fe(0)},specularColor:{value:new Fe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ot},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ot},anisotropyVector:{value:new Je},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ot}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag};const Tl={r:0,b:0,g:0},gr=new dn,tI=new Re;function nI(i,e,t,n,s,r,a){const o=new Fe(0);let c=r===!0?0:1,l,h,u=null,d=0,f=null;function p(x){let E=x.isScene===!0?x.background:null;return E&&E.isTexture&&(E=(x.backgroundBlurriness>0?t:e).get(E)),E}function m(x){let E=!1;const S=p(x);S===null?A(o,c):S&&S.isColor&&(A(S,1),E=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,a):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function g(x,E){const S=p(E);S&&(S.isCubeTexture||S.mapping===Bc)?(h===void 0&&(h=new Zt(new da(1,1,1),new Ls({name:"BackgroundCubeMaterial",uniforms:fa(Qi.backgroundCube.uniforms),vertexShader:Qi.backgroundCube.vertexShader,fragmentShader:Qi.backgroundCube.fragmentShader,side:Ln,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(w,I,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),gr.copy(E.backgroundRotation),gr.x*=-1,gr.y*=-1,gr.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(gr.y*=-1,gr.z*=-1),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(tI.makeRotationFromEuler(gr)),h.material.toneMapped=tt.getTransfer(S.colorSpace)!==Rt,(u!==S||d!==S.version||f!==i.toneMapping)&&(h.material.needsUpdate=!0,u=S,d=S.version,f=i.toneMapping),h.layers.enableAll(),x.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(l===void 0&&(l=new Zt(new vl(2,2),new Ls({name:"BackgroundMaterial",uniforms:fa(Qi.background.uniforms),vertexShader:Qi.background.vertexShader,fragmentShader:Qi.background.fragmentShader,side:ji,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=S,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.toneMapped=tt.getTransfer(S.colorSpace)!==Rt,S.matrixAutoUpdate===!0&&S.updateMatrix(),l.material.uniforms.uvTransform.value.copy(S.matrix),(u!==S||d!==S.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=S,d=S.version,f=i.toneMapping),l.layers.enableAll(),x.unshift(l,l.geometry,l.material,0,0,null))}function A(x,E){x.getRGB(Tl,FA(i)),n.buffers.color.setClear(Tl.r,Tl.g,Tl.b,E,a)}function _(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(x,E=1){o.set(x),c=E,A(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(x){c=x,A(o,c)},render:m,addToRenderList:g,dispose:_}}function iI(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=d(null);let r=s,a=!1;function o(v,F,K,q,$){let D=!1;const O=u(q,K,F);r!==O&&(r=O,l(r.object)),D=f(v,q,K,$),D&&p(v,q,K,$),$!==null&&e.update($,i.ELEMENT_ARRAY_BUFFER),(D||a)&&(a=!1,E(v,F,K,q),$!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get($).buffer))}function c(){return i.createVertexArray()}function l(v){return i.bindVertexArray(v)}function h(v){return i.deleteVertexArray(v)}function u(v,F,K){const q=K.wireframe===!0;let $=n[v.id];$===void 0&&($={},n[v.id]=$);let D=$[F.id];D===void 0&&(D={},$[F.id]=D);let O=D[q];return O===void 0&&(O=d(c()),D[q]=O),O}function d(v){const F=[],K=[],q=[];for(let $=0;$<t;$++)F[$]=0,K[$]=0,q[$]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:K,attributeDivisors:q,object:v,attributes:{},index:null}}function f(v,F,K,q){const $=r.attributes,D=F.attributes;let O=0;const Y=K.getAttributes();for(const Q in Y)if(Y[Q].location>=0){const ee=$[Q];let ae=D[Q];if(ae===void 0&&(Q==="instanceMatrix"&&v.instanceMatrix&&(ae=v.instanceMatrix),Q==="instanceColor"&&v.instanceColor&&(ae=v.instanceColor)),ee===void 0||ee.attribute!==ae||ae&&ee.data!==ae.data)return!0;O++}return r.attributesNum!==O||r.index!==q}function p(v,F,K,q){const $={},D=F.attributes;let O=0;const Y=K.getAttributes();for(const Q in Y)if(Y[Q].location>=0){let ee=D[Q];ee===void 0&&(Q==="instanceMatrix"&&v.instanceMatrix&&(ee=v.instanceMatrix),Q==="instanceColor"&&v.instanceColor&&(ee=v.instanceColor));const ae={};ae.attribute=ee,ee&&ee.data&&(ae.data=ee.data),$[Q]=ae,O++}r.attributes=$,r.attributesNum=O,r.index=q}function m(){const v=r.newAttributes;for(let F=0,K=v.length;F<K;F++)v[F]=0}function g(v){A(v,0)}function A(v,F){const K=r.newAttributes,q=r.enabledAttributes,$=r.attributeDivisors;K[v]=1,q[v]===0&&(i.enableVertexAttribArray(v),q[v]=1),$[v]!==F&&(i.vertexAttribDivisor(v,F),$[v]=F)}function _(){const v=r.newAttributes,F=r.enabledAttributes;for(let K=0,q=F.length;K<q;K++)F[K]!==v[K]&&(i.disableVertexAttribArray(K),F[K]=0)}function x(v,F,K,q,$,D,O){O===!0?i.vertexAttribIPointer(v,F,K,$,D):i.vertexAttribPointer(v,F,K,q,$,D)}function E(v,F,K,q){m();const $=q.attributes,D=K.getAttributes(),O=F.defaultAttributeValues;for(const Y in D){const Q=D[Y];if(Q.location>=0){let J=$[Y];if(J===void 0&&(Y==="instanceMatrix"&&v.instanceMatrix&&(J=v.instanceMatrix),Y==="instanceColor"&&v.instanceColor&&(J=v.instanceColor)),J!==void 0){const ee=J.normalized,ae=J.itemSize,_e=e.get(J);if(_e===void 0)continue;const Me=_e.buffer,se=_e.type,me=_e.bytesPerElement,xe=se===i.INT||se===i.UNSIGNED_INT||J.gpuType===tu;if(J.isInterleavedBufferAttribute){const be=J.data,Ue=be.stride,et=J.offset;if(be.isInstancedInterleavedBuffer){for(let He=0;He<Q.locationSize;He++)A(Q.location+He,be.meshPerAttribute);v.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let He=0;He<Q.locationSize;He++)g(Q.location+He);i.bindBuffer(i.ARRAY_BUFFER,Me);for(let He=0;He<Q.locationSize;He++)x(Q.location+He,ae/Q.locationSize,se,ee,Ue*me,(et+ae/Q.locationSize*He)*me,xe)}else{if(J.isInstancedBufferAttribute){for(let be=0;be<Q.locationSize;be++)A(Q.location+be,J.meshPerAttribute);v.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let be=0;be<Q.locationSize;be++)g(Q.location+be);i.bindBuffer(i.ARRAY_BUFFER,Me);for(let be=0;be<Q.locationSize;be++)x(Q.location+be,ae/Q.locationSize,se,ee,ae*me,ae/Q.locationSize*be*me,xe)}}else if(O!==void 0){const ee=O[Y];if(ee!==void 0)switch(ee.length){case 2:i.vertexAttrib2fv(Q.location,ee);break;case 3:i.vertexAttrib3fv(Q.location,ee);break;case 4:i.vertexAttrib4fv(Q.location,ee);break;default:i.vertexAttrib1fv(Q.location,ee)}}}}_()}function S(){T();for(const v in n){const F=n[v];for(const K in F){const q=F[K];for(const $ in q)h(q[$].object),delete q[$];delete F[K]}delete n[v]}}function w(v){if(n[v.id]===void 0)return;const F=n[v.id];for(const K in F){const q=F[K];for(const $ in q)h(q[$].object),delete q[$];delete F[K]}delete n[v.id]}function I(v){for(const F in n){const K=n[F];if(K[v.id]===void 0)continue;const q=K[v.id];for(const $ in q)h(q[$].object),delete q[$];delete K[v.id]}}function T(){C(),a=!0,r!==s&&(r=s,l(r.object))}function C(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:o,reset:T,resetDefaultState:C,dispose:S,releaseStatesOfGeometry:w,releaseStatesOfProgram:I,initAttributes:m,enableAttribute:g,disableUnusedAttributes:_}}function sI(i,e,t){let n;function s(l){n=l}function r(l,h){i.drawArrays(n,l,h),t.update(h,n,1)}function a(l,h,u){u!==0&&(i.drawArraysInstanced(n,l,h,u),t.update(h,n,u))}function o(l,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,u);let f=0;for(let p=0;p<u;p++)f+=h[p];t.update(f,n,1)}function c(l,h,u,d){if(u===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let p=0;p<l.length;p++)a(l[p],h[p],d[p]);else{f.multiDrawArraysInstancedWEBGL(n,l,0,h,0,d,0,u);let p=0;for(let m=0;m<u;m++)p+=h[m]*d[m];t.update(p,n,1)}}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function rI(i,e,t,n){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");s=i.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(I){return!(I!==hn&&n.convert(I)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(I){const T=I===kn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==cn&&n.convert(I)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==ln&&!T)}function c(I){if(I==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const h=c(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const u=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),A=i.getParameter(i.MAX_VERTEX_ATTRIBS),_=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),x=i.getParameter(i.MAX_VARYING_VECTORS),E=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:u,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:g,maxAttributes:A,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:E,vertexTextures:S,maxSamples:w}}function aI(i){const e=this;let t=null,n=0,s=!1,r=!1;const a=new ks,o=new ot,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||s;return s=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){const p=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,A=i.get(u);if(!s||p===null||p.length===0||r&&!g)r?h(null):l();else{const _=r?0:n,x=_*4;let E=A.clippingState||null;c.value=E,E=h(p,d,x,f);for(let S=0;S!==x;++S)E[S]=t[S];A.clippingState=E,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=_}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,p){const m=u!==null?u.length:0;let g=null;if(m!==0){if(g=c.value,p!==!0||g===null){const A=f+m*4,_=d.matrixWorldInverse;o.getNormalMatrix(_),(g===null||g.length<A)&&(g=new Float32Array(A));for(let x=0,E=f;x!==m;++x,E+=4)a.copy(u[x]).applyMatrix4(_,o),a.normal.toArray(g,E),g[E+3]=a.constant}c.value=g,c.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,g}}function oI(i){let e=new WeakMap;function t(a,o){return o===Mc?a.mapping=sr:o===eu&&(a.mapping=Yr),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Mc||o===eu)if(e.has(a)){const c=e.get(a).texture;return t(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new H_(c.height);return l.fromEquirectangularTexture(i,a),e.set(a,l),a.addEventListener("dispose",s),t(l.texture,a.mapping)}else return null}}return a}function s(a){const o=a.target;o.removeEventListener("dispose",s);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}const ya=4,vg=[.125,.215,.35,.446,.526,.582],mr=20,bd=new pd,Cg=new Fe;let Ed=null,yd=0,_d=0,wd=!1;const xr=(1+Math.sqrt(5))/2,_a=1/xr,Ig=[new G(-xr,_a,0),new G(xr,_a,0),new G(-_a,0,xr),new G(_a,0,xr),new G(0,xr,-_a),new G(0,xr,_a),new G(-1,1,-1),new G(1,1,-1),new G(-1,1,1),new G(1,1,1)],cI=new G;class vd{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,s=100,r={}){const{size:a=256,position:o=cI}=r;Ed=this._renderer.getRenderTarget(),yd=this._renderer.getActiveCubeFace(),_d=this._renderer.getActiveMipmapLevel(),wd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,s,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=Bg(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Mg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Ed,yd,_d),this._renderer.xr.enabled=wd,e.scissorTest=!1,Rl(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===sr||e.mapping===Yr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ed=this._renderer.getRenderTarget(),yd=this._renderer.getActiveCubeFace(),_d=this._renderer.getActiveMipmapLevel(),wd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:qt,minFilter:qt,generateMipmaps:!1,type:kn,format:hn,colorSpace:un,depthBuffer:!1},s=Sg(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Sg(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=lI(r)),this._blurMaterial=hI(r,e,t)}return s}_compileMaterial(e){const t=new Zt(this._lodPlanes[0],e);this._renderer.compile(t,bd)}_sceneToCubeUV(e,t,n,s,r){const c=new Bn(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(Cg),u.toneMapping=Is,u.autoClear=!1;const p=new Ds({name:"PMREM.Background",side:Ln,depthWrite:!1,depthTest:!1}),m=new Zt(new da,p);let g=!1;const A=e.background;A?A.isColor&&(p.color.copy(A),e.background=null,g=!0):(p.color.copy(Cg),g=!0);for(let _=0;_<6;_++){const x=_%3;x===0?(c.up.set(0,l[_],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[_],r.y,r.z)):x===1?(c.up.set(0,0,l[_]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[_],r.z)):(c.up.set(0,l[_],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[_]));const E=this._cubeSize;Rl(s,x*E,_>2?E:0,E,E),u.setRenderTarget(s),g&&u.render(m,c),u.render(e,c)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=A}_textureToCubeUV(e,t){const n=this._renderer,s=e.mapping===sr||e.mapping===Yr;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Bg()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Mg());const r=s?this._cubemapMaterial:this._equirectMaterial,a=new Zt(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=e;const c=this._cubeSize;Rl(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,bd)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const s=this._lodPlanes.length;for(let r=1;r<s;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=Ig[(s-r-1)%Ig.length];this._blur(e,r-1,r,a,o)}t.autoClear=n}_blur(e,t,n,s,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,s,"latitudinal",r),this._halfBlur(a,e,n,n,s,"longitudinal",r)}_halfBlur(e,t,n,s,r,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new Zt(this._lodPlanes[s],l),d=l.uniforms,f=this._sizeLods[n]-1,p=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*mr-1),m=r/p,g=isFinite(r)?1+Math.floor(h*m):mr;g>mr&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${mr}`);const A=[];let _=0;for(let I=0;I<mr;++I){const T=I/m,C=Math.exp(-T*T/2);A.push(C),I===0?_+=C:I<g&&(_+=2*C)}for(let I=0;I<A.length;I++)A[I]=A[I]/_;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=A,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:x}=this;d.dTheta.value=p,d.mipInt.value=x-n;const E=this._sizeLods[s],S=3*E*(s>x-ya?s-x+ya:0),w=4*(this._cubeSize-E);Rl(t,S,w,3*E,2*E),c.setRenderTarget(t),c.render(u,bd)}}function lI(i){const e=[],t=[],n=[];let s=i;const r=i-ya+1+vg.length;for(let a=0;a<r;a++){const o=Math.pow(2,s);t.push(o);let c=1/o;a>i-ya?c=vg[a-i+ya-1]:a===0&&(c=0),n.push(c);const l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,p=6,m=3,g=2,A=1,_=new Float32Array(m*p*f),x=new Float32Array(g*p*f),E=new Float32Array(A*p*f);for(let w=0;w<f;w++){const I=w%3*2/3-1,T=w>2?0:-1,C=[I,T,0,I+2/3,T,0,I+2/3,T+1,0,I,T,0,I+2/3,T+1,0,I,T+1,0];_.set(C,m*p*w),x.set(d,g*p*w);const v=[w,w,w,w,w,w];E.set(v,A*p*w)}const S=new Mn;S.setAttribute("position",new Sn(_,m)),S.setAttribute("uv",new Sn(x,g)),S.setAttribute("faceIndex",new Sn(E,A)),e.push(S),s>ya&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Sg(i,e,t){const n=new or(i,e,t);return n.texture.mapping=Bc,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Rl(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function hI(i,e,t){const n=new Float32Array(mr),s=new G(0,1,0);return new Ls({name:"SphericalGaussianBlur",defines:{n:mr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Cd(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3623,7 +3623,7 @@ void main() {
}
}
- `,blending:Cs,depthTest:!1,depthWrite:!1})}function Sg(){return new Ls({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:wd(),fragmentShader:`
+ `,blending:Cs,depthTest:!1,depthWrite:!1})}function Mg(){return new Ls({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Cd(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3642,7 +3642,7 @@ void main() {
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
- `,blending:Cs,depthTest:!1,depthWrite:!1})}function Mg(){return new Ls({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:wd(),fragmentShader:`
+ `,blending:Cs,depthTest:!1,depthWrite:!1})}function Bg(){return new Ls({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Cd(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3658,7 +3658,7 @@ void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
- `,blending:Cs,depthTest:!1,depthWrite:!1})}function wd(){return`
+ `,blending:Cs,depthTest:!1,depthWrite:!1})}function Cd(){return`
precision mediump float;
precision mediump int;
@@ -3713,17 +3713,17 @@ void main() {
gl_Position = vec4( position, 1.0 );
}
- `}function hI(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===Ic||c===Zh,h=c===sr||c===Yr;if(l||h){let u=e.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new _d(i)),u=l?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const f=o.image;return l&&f&&f.height>0||h&&f&&s(f)?(t===null&&(t=new _d(i)),u=l?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",r),u.texture):null}}}return o}function s(o){let c=0;const l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function r(o){const c=o.target;c.removeEventListener("dispose",r);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function uI(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let s;switch(n){case"WEBGL_depth_texture":s=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=i.getExtension(n)}return e[n]=s,s}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){const s=t(n);return s===null&&Hc("THREE.WebGLRenderer: "+n+" extension not supported."),s}}}function dI(i,e,t,n){const s={},r=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const p in d.attributes)e.remove(d.attributes[p]);d.removeEventListener("dispose",a),delete s[d.id];const 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 s[d.id]===!0||(d.addEventListener("dispose",a),s[d.id]=!0,t.memory.geometries++),d}function c(u){const d=u.attributes;for(const f in d)e.update(d[f],i.ARRAY_BUFFER)}function l(u){const d=[],f=u.index,p=u.attributes.position;let m=0;if(f!==null){const _=f.array;m=f.version;for(let x=0,E=_.length;x<E;x+=3){const S=_[x+0],w=_[x+1],I=_[x+2];d.push(S,w,w,I,I,S)}}else if(p!==void 0){const _=p.array;m=p.version;for(let x=0,E=_.length/3-1;x<E;x+=3){const S=x+0,w=x+1,I=x+2;d.push(S,w,w,I,I,S)}}else return;const g=new(lA(d)?SA:qu)(d,1);g.version=m;const A=r.get(u);A&&e.remove(A),r.set(u,g)}function h(u){const d=r.get(u);if(d){const 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 fI(i,e,t){let n;function s(d){n=d}let r,a;function o(d){r=d.type,a=d.bytesPerElement}function c(d,f){i.drawElements(n,f,r,d*a),t.update(f,n,1)}function l(d,f,p){p!==0&&(i.drawElementsInstanced(n,f,r,d*a,p),t.update(f,n,p))}function h(d,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,r,d,0,p);let g=0;for(let A=0;A<p;A++)g+=f[A];t.update(g,n,1)}function u(d,f,p,m){if(p===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let A=0;A<d.length;A++)l(d[A]/a,f[A],m[A]);else{g.multiDrawElementsInstancedWEBGL(n,f,0,r,d,0,m,0,p);let A=0;for(let _=0;_<p;_++)A+=f[_]*m[_];t.update(A,n,1)}}this.setMode=s,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function pI(i){const 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 i.TRIANGLES:t.triangles+=o*(r/3);break;case i.LINES:t.lines+=o*(r/2);break;case i.LINE_STRIP:t.lines+=o*(r-1);break;case i.LINE_LOOP:t.lines+=o*r;break;case i.POINTS:t.points+=o*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:n}}function AI(i,e,t){const n=new WeakMap,s=new gt;function r(a,o,c){const l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let C=function(){I.dispose(),n.delete(o),o.removeEventListener("dispose",C)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,p=o.morphAttributes.normal!==void 0,m=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],A=o.morphAttributes.normal||[],_=o.morphAttributes.color||[];let x=0;f===!0&&(x=1),p===!0&&(x=2),m===!0&&(x=3);let E=o.attributes.position.count*x,S=1;E>e.maxTextureSize&&(S=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const w=new Float32Array(E*S*4*u),I=new fA(w,E,S,u);I.type=ln,I.needsUpdate=!0;const T=x*4;for(let v=0;v<u;v++){const F=g[v],K=A[v],q=_[v],$=E*S*4*v;for(let D=0;D<F.count;D++){const O=D*T;f===!0&&(s.fromBufferAttribute(F,D),w[$+O+0]=s.x,w[$+O+1]=s.y,w[$+O+2]=s.z,w[$+O+3]=0),p===!0&&(s.fromBufferAttribute(K,D),w[$+O+4]=s.x,w[$+O+5]=s.y,w[$+O+6]=s.z,w[$+O+7]=0),m===!0&&(s.fromBufferAttribute(q,D),w[$+O+8]=s.x,w[$+O+9]=s.y,w[$+O+10]=s.z,w[$+O+11]=q.itemSize===4?s.w:1)}}d={count:u,texture:I,size:new Je(E,S)},n.set(o,d),o.addEventListener("dispose",C)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let f=0;for(let m=0;m<l.length;m++)f+=l[m];const p=o.morphTargetsRelative?1:1-f;c.getUniforms().setValue(i,"morphTargetBaseInfluence",p),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:r}}function gI(i,e,t,n){let s=new WeakMap;function r(c){const l=n.render.frame,h=c.geometry,u=e.get(c,h);if(s.get(u)!==l&&(e.update(u),s.set(u,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),s.get(c)!==l&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;s.get(d)!==l&&(d.update(),s.set(d,l))}return u}function a(){s=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:r,dispose:a}}const Bg=new nn,Tg=new ZA(1,1),Rg=new fA,Fg=new pA,Ng=new LA,Dg=[],Lg=[],Pg=new Float32Array(16),kg=new Float32Array(9),Ug=new Float32Array(4);function wa(i,e,t){const n=i[0];if(n<=0||n>0)return i;const s=e*t;let r=Dg[s];if(r===void 0&&(r=new Float32Array(s),Dg[s]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(r,o)}return r}function fn(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function pn(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Tl(i,e){let t=Lg[e];t===void 0&&(t=new Int32Array(e),Lg[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function mI(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function xI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(fn(t,e))return;i.uniform2fv(this.addr,e),pn(t,e)}}function bI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.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)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(fn(t,e))return;i.uniform3fv(this.addr,e),pn(t,e)}}function EI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.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(fn(t,e))return;i.uniform4fv(this.addr,e),pn(t,e)}}function yI(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(fn(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),pn(t,e)}else{if(fn(t,n))return;Ug.set(n),i.uniformMatrix2fv(this.addr,!1,Ug),pn(t,n)}}function _I(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(fn(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),pn(t,e)}else{if(fn(t,n))return;kg.set(n),i.uniformMatrix3fv(this.addr,!1,kg),pn(t,n)}}function wI(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(fn(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),pn(t,e)}else{if(fn(t,n))return;Pg.set(n),i.uniformMatrix4fv(this.addr,!1,Pg),pn(t,n)}}function vI(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function CI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(fn(t,e))return;i.uniform2iv(this.addr,e),pn(t,e)}}function II(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(fn(t,e))return;i.uniform3iv(this.addr,e),pn(t,e)}}function SI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.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(fn(t,e))return;i.uniform4iv(this.addr,e),pn(t,e)}}function MI(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function BI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(fn(t,e))return;i.uniform2uiv(this.addr,e),pn(t,e)}}function TI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(fn(t,e))return;i.uniform3uiv(this.addr,e),pn(t,e)}}function RI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.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(fn(t,e))return;i.uniform4uiv(this.addr,e),pn(t,e)}}function FI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(Tg.compareFunction=aA,r=Tg):r=Bg,t.setTexture2D(e||r,s)}function NI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture3D(e||Fg,s)}function DI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTextureCube(e||Ng,s)}function LI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture2DArray(e||Rg,s)}function PI(i){switch(i){case 5126:return mI;case 35664:return xI;case 35665:return bI;case 35666:return EI;case 35674:return yI;case 35675:return _I;case 35676:return wI;case 5124:case 35670:return vI;case 35667:case 35671:return CI;case 35668:case 35672:return II;case 35669:case 35673:return SI;case 5125:return MI;case 36294:return BI;case 36295:return TI;case 36296:return RI;case 35678:case 36198:case 36298:case 36306:case 35682:return FI;case 35679:case 36299:case 36307:return NI;case 35680:case 36300:case 36308:case 36293:return DI;case 36289:case 36303:case 36311:case 36292:return LI}}function kI(i,e){i.uniform1fv(this.addr,e)}function UI(i,e){const t=wa(e,this.size,2);i.uniform2fv(this.addr,t)}function OI(i,e){const t=wa(e,this.size,3);i.uniform3fv(this.addr,t)}function QI(i,e){const t=wa(e,this.size,4);i.uniform4fv(this.addr,t)}function GI(i,e){const t=wa(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function HI(i,e){const t=wa(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function zI(i,e){const t=wa(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function VI(i,e){i.uniform1iv(this.addr,e)}function WI(i,e){i.uniform2iv(this.addr,e)}function qI(i,e){i.uniform3iv(this.addr,e)}function KI(i,e){i.uniform4iv(this.addr,e)}function jI(i,e){i.uniform1uiv(this.addr,e)}function XI(i,e){i.uniform2uiv(this.addr,e)}function YI(i,e){i.uniform3uiv(this.addr,e)}function JI(i,e){i.uniform4uiv(this.addr,e)}function ZI(i,e,t){const n=this.cache,s=e.length,r=Tl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture2D(e[a]||Bg,r[a])}function $I(i,e,t){const n=this.cache,s=e.length,r=Tl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture3D(e[a]||Fg,r[a])}function eS(i,e,t){const n=this.cache,s=e.length,r=Tl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTextureCube(e[a]||Ng,r[a])}function tS(i,e,t){const n=this.cache,s=e.length,r=Tl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture2DArray(e[a]||Rg,r[a])}function nS(i){switch(i){case 5126:return kI;case 35664:return UI;case 35665:return OI;case 35666:return QI;case 35674:return GI;case 35675:return HI;case 35676:return zI;case 5124:case 35670:return VI;case 35667:case 35671:return WI;case 35668:case 35672:return qI;case 35669:case 35673:return KI;case 5125:return jI;case 36294:return XI;case 36295:return YI;case 36296:return JI;case 35678:case 36198:case 36298:case 36306:case 35682:return ZI;case 35679:case 36299:case 36307:return $I;case 35680:case 36300:case 36308:case 36293:return eS;case 36289:case 36303:case 36311:case 36292:return tS}}class iS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=PI(t.type)}}class sS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=nS(t.type)}}class rS{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const s=this.seq;for(let r=0,a=s.length;r!==a;++r){const o=s[r];o.setValue(e,t[o.id],n)}}}const vd=/(\w+)(\])?(\[|\.)?/g;function Og(i,e){i.seq.push(e),i.map[e.id]=e}function aS(i,e,t){const n=i.name,s=n.length;for(vd.lastIndex=0;;){const r=vd.exec(n),a=vd.lastIndex;let o=r[1];const c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===s){Og(t,l===void 0?new iS(o,i,e):new sS(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new rS(o),Og(t,u)),t=u}}}class Rl{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){const r=e.getActiveUniform(t,s),a=e.getUniformLocation(t,r.name);aS(r,a,this)}}setValue(e,t,n,s){const r=this.map[t];r!==void 0&&r.setValue(e,n,s)}setOptional(e,t,n){const s=t[n];s!==void 0&&this.setValue(e,n,s)}static upload(e,t,n,s){for(let r=0,a=t.length;r!==a;++r){const o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,s)}}static seqWithValue(e,t){const n=[];for(let s=0,r=e.length;s!==r;++s){const a=e[s];a.id in t&&n.push(a)}return n}}function Qg(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const oS=37297;let cS=0;function lS(i,e){const t=i.split(`
+ `}function uI(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===Mc||c===eu,h=c===sr||c===Yr;if(l||h){let u=e.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new vd(i)),u=l?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const f=o.image;return l&&f&&f.height>0||h&&f&&s(f)?(t===null&&(t=new vd(i)),u=l?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",r),u.texture):null}}}return o}function s(o){let c=0;const l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function r(o){const c=o.target;c.removeEventListener("dispose",r);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function dI(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let s;switch(n){case"WEBGL_depth_texture":s=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=i.getExtension(n)}return e[n]=s,s}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){const s=t(n);return s===null&&Vc("THREE.WebGLRenderer: "+n+" extension not supported."),s}}}function fI(i,e,t,n){const s={},r=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const p in d.attributes)e.remove(d.attributes[p]);d.removeEventListener("dispose",a),delete s[d.id];const 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 s[d.id]===!0||(d.addEventListener("dispose",a),s[d.id]=!0,t.memory.geometries++),d}function c(u){const d=u.attributes;for(const f in d)e.update(d[f],i.ARRAY_BUFFER)}function l(u){const d=[],f=u.index,p=u.attributes.position;let m=0;if(f!==null){const _=f.array;m=f.version;for(let x=0,E=_.length;x<E;x+=3){const S=_[x+0],w=_[x+1],I=_[x+2];d.push(S,w,w,I,I,S)}}else if(p!==void 0){const _=p.array;m=p.version;for(let x=0,E=_.length/3-1;x<E;x+=3){const S=x+0,w=x+1,I=x+2;d.push(S,w,w,I,I,S)}}else return;const g=new(hA(d)?MA:ju)(d,1);g.version=m;const A=r.get(u);A&&e.remove(A),r.set(u,g)}function h(u){const d=r.get(u);if(d){const 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 pI(i,e,t){let n;function s(d){n=d}let r,a;function o(d){r=d.type,a=d.bytesPerElement}function c(d,f){i.drawElements(n,f,r,d*a),t.update(f,n,1)}function l(d,f,p){p!==0&&(i.drawElementsInstanced(n,f,r,d*a,p),t.update(f,n,p))}function h(d,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,r,d,0,p);let g=0;for(let A=0;A<p;A++)g+=f[A];t.update(g,n,1)}function u(d,f,p,m){if(p===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let A=0;A<d.length;A++)l(d[A]/a,f[A],m[A]);else{g.multiDrawElementsInstancedWEBGL(n,f,0,r,d,0,m,0,p);let A=0;for(let _=0;_<p;_++)A+=f[_]*m[_];t.update(A,n,1)}}this.setMode=s,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function AI(i){const 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 i.TRIANGLES:t.triangles+=o*(r/3);break;case i.LINES:t.lines+=o*(r/2);break;case i.LINE_STRIP:t.lines+=o*(r-1);break;case i.LINE_LOOP:t.lines+=o*r;break;case i.POINTS:t.points+=o*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:n}}function gI(i,e,t){const n=new WeakMap,s=new gt;function r(a,o,c){const l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let C=function(){I.dispose(),n.delete(o),o.removeEventListener("dispose",C)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,p=o.morphAttributes.normal!==void 0,m=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],A=o.morphAttributes.normal||[],_=o.morphAttributes.color||[];let x=0;f===!0&&(x=1),p===!0&&(x=2),m===!0&&(x=3);let E=o.attributes.position.count*x,S=1;E>e.maxTextureSize&&(S=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const w=new Float32Array(E*S*4*u),I=new pA(w,E,S,u);I.type=ln,I.needsUpdate=!0;const T=x*4;for(let v=0;v<u;v++){const F=g[v],K=A[v],q=_[v],$=E*S*4*v;for(let D=0;D<F.count;D++){const O=D*T;f===!0&&(s.fromBufferAttribute(F,D),w[$+O+0]=s.x,w[$+O+1]=s.y,w[$+O+2]=s.z,w[$+O+3]=0),p===!0&&(s.fromBufferAttribute(K,D),w[$+O+4]=s.x,w[$+O+5]=s.y,w[$+O+6]=s.z,w[$+O+7]=0),m===!0&&(s.fromBufferAttribute(q,D),w[$+O+8]=s.x,w[$+O+9]=s.y,w[$+O+10]=s.z,w[$+O+11]=q.itemSize===4?s.w:1)}}d={count:u,texture:I,size:new Je(E,S)},n.set(o,d),o.addEventListener("dispose",C)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let f=0;for(let m=0;m<l.length;m++)f+=l[m];const p=o.morphTargetsRelative?1:1-f;c.getUniforms().setValue(i,"morphTargetBaseInfluence",p),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:r}}function mI(i,e,t,n){let s=new WeakMap;function r(c){const l=n.render.frame,h=c.geometry,u=e.get(c,h);if(s.get(u)!==l&&(e.update(u),s.set(u,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),s.get(c)!==l&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;s.get(d)!==l&&(d.update(),s.set(d,l))}return u}function a(){s=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:r,dispose:a}}const Tg=new nn,Rg=new $A(1,1),Fg=new pA,Ng=new AA,Dg=new PA,Lg=[],Pg=[],kg=new Float32Array(16),Ug=new Float32Array(9),Og=new Float32Array(4);function wa(i,e,t){const n=i[0];if(n<=0||n>0)return i;const s=e*t;let r=Lg[s];if(r===void 0&&(r=new Float32Array(s),Lg[s]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(r,o)}return r}function fn(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function pn(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Fl(i,e){let t=Pg[e];t===void 0&&(t=new Int32Array(e),Pg[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function xI(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function bI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(fn(t,e))return;i.uniform2fv(this.addr,e),pn(t,e)}}function EI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.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)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(fn(t,e))return;i.uniform3fv(this.addr,e),pn(t,e)}}function yI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.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(fn(t,e))return;i.uniform4fv(this.addr,e),pn(t,e)}}function _I(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(fn(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),pn(t,e)}else{if(fn(t,n))return;Og.set(n),i.uniformMatrix2fv(this.addr,!1,Og),pn(t,n)}}function wI(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(fn(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),pn(t,e)}else{if(fn(t,n))return;Ug.set(n),i.uniformMatrix3fv(this.addr,!1,Ug),pn(t,n)}}function vI(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(fn(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),pn(t,e)}else{if(fn(t,n))return;kg.set(n),i.uniformMatrix4fv(this.addr,!1,kg),pn(t,n)}}function CI(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function II(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(fn(t,e))return;i.uniform2iv(this.addr,e),pn(t,e)}}function SI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(fn(t,e))return;i.uniform3iv(this.addr,e),pn(t,e)}}function MI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.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(fn(t,e))return;i.uniform4iv(this.addr,e),pn(t,e)}}function BI(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function TI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(fn(t,e))return;i.uniform2uiv(this.addr,e),pn(t,e)}}function RI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(fn(t,e))return;i.uniform3uiv(this.addr,e),pn(t,e)}}function FI(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.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(fn(t,e))return;i.uniform4uiv(this.addr,e),pn(t,e)}}function NI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(Rg.compareFunction=oA,r=Rg):r=Tg,t.setTexture2D(e||r,s)}function DI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture3D(e||Ng,s)}function LI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTextureCube(e||Dg,s)}function PI(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture2DArray(e||Fg,s)}function kI(i){switch(i){case 5126:return xI;case 35664:return bI;case 35665:return EI;case 35666:return yI;case 35674:return _I;case 35675:return wI;case 35676:return vI;case 5124:case 35670:return CI;case 35667:case 35671:return II;case 35668:case 35672:return SI;case 35669:case 35673:return MI;case 5125:return BI;case 36294:return TI;case 36295:return RI;case 36296:return FI;case 35678:case 36198:case 36298:case 36306:case 35682:return NI;case 35679:case 36299:case 36307:return DI;case 35680:case 36300:case 36308:case 36293:return LI;case 36289:case 36303:case 36311:case 36292:return PI}}function UI(i,e){i.uniform1fv(this.addr,e)}function OI(i,e){const t=wa(e,this.size,2);i.uniform2fv(this.addr,t)}function QI(i,e){const t=wa(e,this.size,3);i.uniform3fv(this.addr,t)}function GI(i,e){const t=wa(e,this.size,4);i.uniform4fv(this.addr,t)}function HI(i,e){const t=wa(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function zI(i,e){const t=wa(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function VI(i,e){const t=wa(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function WI(i,e){i.uniform1iv(this.addr,e)}function qI(i,e){i.uniform2iv(this.addr,e)}function KI(i,e){i.uniform3iv(this.addr,e)}function jI(i,e){i.uniform4iv(this.addr,e)}function XI(i,e){i.uniform1uiv(this.addr,e)}function YI(i,e){i.uniform2uiv(this.addr,e)}function JI(i,e){i.uniform3uiv(this.addr,e)}function ZI(i,e){i.uniform4uiv(this.addr,e)}function $I(i,e,t){const n=this.cache,s=e.length,r=Fl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture2D(e[a]||Tg,r[a])}function eS(i,e,t){const n=this.cache,s=e.length,r=Fl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture3D(e[a]||Ng,r[a])}function tS(i,e,t){const n=this.cache,s=e.length,r=Fl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTextureCube(e[a]||Dg,r[a])}function nS(i,e,t){const n=this.cache,s=e.length,r=Fl(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture2DArray(e[a]||Fg,r[a])}function iS(i){switch(i){case 5126:return UI;case 35664:return OI;case 35665:return QI;case 35666:return GI;case 35674:return HI;case 35675:return zI;case 35676:return VI;case 5124:case 35670:return WI;case 35667:case 35671:return qI;case 35668:case 35672:return KI;case 35669:case 35673:return jI;case 5125:return XI;case 36294:return YI;case 36295:return JI;case 36296:return ZI;case 35678:case 36198:case 36298:case 36306:case 35682:return $I;case 35679:case 36299:case 36307:return eS;case 35680:case 36300:case 36308:case 36293:return tS;case 36289:case 36303:case 36311:case 36292:return nS}}class sS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=kI(t.type)}}class rS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=iS(t.type)}}class aS{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const s=this.seq;for(let r=0,a=s.length;r!==a;++r){const o=s[r];o.setValue(e,t[o.id],n)}}}const Id=/(\w+)(\])?(\[|\.)?/g;function Qg(i,e){i.seq.push(e),i.map[e.id]=e}function oS(i,e,t){const n=i.name,s=n.length;for(Id.lastIndex=0;;){const r=Id.exec(n),a=Id.lastIndex;let o=r[1];const c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===s){Qg(t,l===void 0?new sS(o,i,e):new rS(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new aS(o),Qg(t,u)),t=u}}}class Nl{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){const r=e.getActiveUniform(t,s),a=e.getUniformLocation(t,r.name);oS(r,a,this)}}setValue(e,t,n,s){const r=this.map[t];r!==void 0&&r.setValue(e,n,s)}setOptional(e,t,n){const s=t[n];s!==void 0&&this.setValue(e,n,s)}static upload(e,t,n,s){for(let r=0,a=t.length;r!==a;++r){const o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,s)}}static seqWithValue(e,t){const n=[];for(let s=0,r=e.length;s!==r;++s){const a=e[s];a.id in t&&n.push(a)}return n}}function Gg(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const cS=37297;let lS=0;function hS(i,e){const t=i.split(`
`),n=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=s;a<r;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
-`)}const Gg=new ot;function hS(i){tt._getMatrix(Gg,tt.workingColorSpace,i);const e=`mat3( ${Gg.elements.map(t=>t.toFixed(4))} )`;switch(tt.getTransfer(i)){case Qc:return[e,"LinearTransferOETF"];case Rt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Hg(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=i.getShaderInfoLog(e).trim();if(n&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const a=parseInt(r[1]);return t.toUpperCase()+`
+`)}const Hg=new ot;function uS(i){tt._getMatrix(Hg,tt.workingColorSpace,i);const e=`mat3( ${Hg.elements.map(t=>t.toFixed(4))} )`;switch(tt.getTransfer(i)){case Hc:return[e,"LinearTransferOETF"];case Rt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function zg(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=i.getShaderInfoLog(e).trim();if(n&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const a=parseInt(r[1]);return t.toUpperCase()+`
`+s+`
-`+lS(i.getShaderSource(e),a)}else return s}function uS(i,e){const t=hS(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
-`)}function dS(i,e){let t;switch(e){case Jh:t="Linear";break;case Fy:t="Reinhard";break;case Ny:t="Cineon";break;case qp:t="ACESFilmic";break;case Ly:t="AgX";break;case Py:t="Neutral";break;case Dy:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Fl=new G;function fS(){tt.getLuminanceCoefficients(Fl);const i=Fl.x.toFixed(4),e=Fl.y.toFixed(4),t=Fl.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
-`)}function pS(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(No).join(`
-`)}function AS(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
-`)}function gS(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const r=i.getActiveAttrib(e,s),a=r.name;let o=1;r.type===i.FLOAT_MAT2&&(o=2),r.type===i.FLOAT_MAT3&&(o=3),r.type===i.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function No(i){return i!==""}function zg(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.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 Vg(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const mS=/^[ \t]*#include +<([\w\d./]+)>/gm;function Cd(i){return i.replace(mS,bS)}const xS=new Map;function bS(i,e){let t=ct[e];if(t===void 0){const n=xS.get(e);if(n!==void 0)t=ct[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Cd(t)}const ES=/#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 Wg(i){return i.replace(ES,yS)}function yS(i,e,t,n){let s="";for(let r=parseInt(e);r<parseInt(t);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function qg(i){let e=`precision ${i.precision} float;
+`+hS(i.getShaderSource(e),a)}else return s}function dS(i,e){const t=uS(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
+`)}function fS(i,e){let t;switch(e){case $h:t="Linear";break;case Ny:t="Reinhard";break;case Dy:t="Cineon";break;case Kp:t="ACESFilmic";break;case Py:t="AgX";break;case ky:t="Neutral";break;case Ly:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Dl=new G;function pS(){tt.getLuminanceCoefficients(Dl);const i=Dl.x.toFixed(4),e=Dl.y.toFixed(4),t=Dl.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
+`)}function AS(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Do).join(`
+`)}function gS(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
+`)}function mS(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const r=i.getActiveAttrib(e,s),a=r.name;let o=1;r.type===i.FLOAT_MAT2&&(o=2),r.type===i.FLOAT_MAT3&&(o=3),r.type===i.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Do(i){return i!==""}function Vg(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.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 Wg(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const xS=/^[ \t]*#include +<([\w\d./]+)>/gm;function Sd(i){return i.replace(xS,ES)}const bS=new Map;function ES(i,e){let t=ct[e];if(t===void 0){const n=bS.get(e);if(n!==void 0)t=ct[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Sd(t)}const yS=/#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 qg(i){return i.replace(yS,_S)}function _S(i,e,t,n){let s="";for(let r=parseInt(e);r<parseInt(t);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function Kg(i){let e=`precision ${i.precision} float;
precision ${i.precision} int;
precision ${i.precision} sampler2D;
precision ${i.precision} samplerCube;
@@ -3743,30 +3743,30 @@ void main() {
`;return i.precision==="highp"?e+=`
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
-#define LOW_PRECISION`),e}function _S(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Hp?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===uy?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===qi&&(e="SHADOWMAP_TYPE_VSM"),e}function wS(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case sr:case Yr:e="ENVMAP_TYPE_CUBE";break;case Sc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function vS(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===Yr&&(e="ENVMAP_MODE_REFRACTION"),e}function CS(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Cc:e="ENVMAP_BLENDING_MULTIPLY";break;case Ty:e="ENVMAP_BLENDING_MIX";break;case Ry:e="ENVMAP_BLENDING_ADD";break}return e}function IS(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function SS(i,e,t,n){const s=i.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=_S(t),l=wS(t),h=vS(t),u=CS(t),d=IS(t),f=pS(t),p=AS(r),m=s.createProgram();let g,A,_=t.glslVersion?"#version "+t.glslVersion+`
-`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(No).join(`
+#define LOW_PRECISION`),e}function wS(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===zp?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===dy?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Ki&&(e="SHADOWMAP_TYPE_VSM"),e}function vS(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case sr:case Yr:e="ENVMAP_TYPE_CUBE";break;case Bc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function CS(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===Yr&&(e="ENVMAP_MODE_REFRACTION"),e}function IS(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Sc:e="ENVMAP_BLENDING_MULTIPLY";break;case Ry:e="ENVMAP_BLENDING_MIX";break;case Fy:e="ENVMAP_BLENDING_ADD";break}return e}function SS(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function MS(i,e,t,n){const s=i.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=wS(t),l=vS(t),h=CS(t),u=IS(t),d=SS(t),f=AS(t),p=gS(r),m=s.createProgram();let g,A,_=t.glslVersion?"#version "+t.glslVersion+`
+`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Do).join(`
`),g.length>0&&(g+=`
-`),A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(No).join(`
+`),A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Do).join(`
`),A.length>0&&(A+=`
-`)):(g=[qg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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.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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
-`].filter(No).join(`
-`),A=[qg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Is?"#define TONE_MAPPING":"",t.toneMapping!==Is?ct.tonemapping_pars_fragment:"",t.toneMapping!==Is?dS("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ct.colorspace_pars_fragment,uS("linearToOutputTexel",t.outputColorSpace),fS(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
-`].filter(No).join(`
-`)),a=Cd(a),a=zg(a,t),a=Vg(a,t),o=Cd(o),o=zg(o,t),o=Vg(o,t),a=Wg(a),o=Wg(o),t.isRawShaderMaterial!==!0&&(_=`#version 300 es
+`)):(g=[Kg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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.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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
+`].filter(Do).join(`
+`),A=[Kg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Is?"#define TONE_MAPPING":"",t.toneMapping!==Is?ct.tonemapping_pars_fragment:"",t.toneMapping!==Is?fS("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ct.colorspace_pars_fragment,dS("linearToOutputTexel",t.outputColorSpace),pS(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
+`].filter(Do).join(`
+`)),a=Sd(a),a=Vg(a,t),a=Wg(a,t),o=Sd(o),o=Vg(o,t),o=Wg(o,t),a=qg(a),o=qg(o),t.isRawShaderMaterial!==!0&&(_=`#version 300 es
`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
-`+g,A=["#define varying in",t.glslVersion===oA?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===oA?"":"#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(`
+`+g,A=["#define varying in",t.glslVersion===cA?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===cA?"":"#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(`
`)+`
-`+A);const x=_+g+a,E=_+A+o,S=Qg(s,s.VERTEX_SHADER,x),w=Qg(s,s.FRAGMENT_SHADER,E);s.attachShader(m,S),s.attachShader(m,w),t.index0AttributeName!==void 0?s.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(m,0,"position"),s.linkProgram(m);function I(F){if(i.debug.checkShaderErrors){const K=s.getProgramInfoLog(m).trim(),q=s.getShaderInfoLog(S).trim(),$=s.getShaderInfoLog(w).trim();let D=!0,O=!0;if(s.getProgramParameter(m,s.LINK_STATUS)===!1)if(D=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,m,S,w);else{const Y=Hg(s,S,"vertex"),Q=Hg(s,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(m,s.VALIDATE_STATUS)+`
+`+A);const x=_+g+a,E=_+A+o,S=Gg(s,s.VERTEX_SHADER,x),w=Gg(s,s.FRAGMENT_SHADER,E);s.attachShader(m,S),s.attachShader(m,w),t.index0AttributeName!==void 0?s.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(m,0,"position"),s.linkProgram(m);function I(F){if(i.debug.checkShaderErrors){const K=s.getProgramInfoLog(m).trim(),q=s.getShaderInfoLog(S).trim(),$=s.getShaderInfoLog(w).trim();let D=!0,O=!0;if(s.getProgramParameter(m,s.LINK_STATUS)===!1)if(D=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,m,S,w);else{const Y=zg(s,S,"vertex"),Q=zg(s,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(m,s.VALIDATE_STATUS)+`
Material Name: `+F.name+`
Material Type: `+F.type+`
Program Info Log: `+K+`
`+Y+`
-`+Q)}else K!==""?console.warn("THREE.WebGLProgram: Program Info Log:",K):(q===""||$==="")&&(O=!1);O&&(F.diagnostics={runnable:D,programLog:K,vertexShader:{log:q,prefix:g},fragmentShader:{log:$,prefix:A}})}s.deleteShader(S),s.deleteShader(w),T=new Rl(s,m),C=gS(s,m)}let T;this.getUniforms=function(){return T===void 0&&I(this),T};let C;this.getAttributes=function(){return C===void 0&&I(this),C};let v=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return v===!1&&(v=s.getProgramParameter(m,oS)),v},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=cS++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}let MS=0;class BS{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(s)===!1&&(a.add(s),s.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new TS(e),t.set(e,n)),n}}class TS{constructor(e){this.id=MS++,this.code=e,this.usedTimes=0}}function RS(i,e,t,n,s,r,a){const o=new xA,c=new BS,l=new Set,h=[],u=s.logarithmicDepthBuffer,d=s.vertexTextures;let f=s.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(C){return l.add(C),C===0?"uv":`uv${C}`}function g(C,v,F,K,q){const $=K.fog,D=q.geometry,O=C.isMeshStandardMaterial?K.environment:null,Y=(C.isMeshStandardMaterial?t:e).get(C.envMap||O),Q=Y&&Y.mapping===Sc?Y.image.height:null,J=p[C.type];C.precision!==null&&(f=s.getMaxPrecision(C.precision),f!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",f,"instead."));const ee=D.morphAttributes.position||D.morphAttributes.normal||D.morphAttributes.color,ae=ee!==void 0?ee.length:0;let _e=0;D.morphAttributes.position!==void 0&&(_e=1),D.morphAttributes.normal!==void 0&&(_e=2),D.morphAttributes.color!==void 0&&(_e=3);let Me,se,me,xe;if(J){const Ct=Oi[J];Me=Ct.vertexShader,se=Ct.fragmentShader}else Me=C.vertexShader,se=C.fragmentShader,c.update(C),me=c.getVertexShaderID(C),xe=c.getFragmentShaderID(C);const be=i.getRenderTarget(),Ue=i.state.buffers.depth.getReversed(),et=q.isInstancedMesh===!0,He=q.isBatchedMesh===!0,Mt=!!C.map,ft=!!C.matcap,$e=!!Y,H=!!C.aoMap,wn=!!C.lightMap,pt=!!C.bumpMap,mt=!!C.normalMap,We=!!C.displacementMap,Dt=!!C.emissiveMap,ze=!!C.metalnessMap,L=!!C.roughnessMap,M=C.anisotropy>0,Z=C.clearcoat>0,le=C.dispersion>0,Ae=C.iridescence>0,oe=C.sheen>0,Qe=C.transmission>0,ve=M&&!!C.anisotropyMap,qe=Z&&!!C.clearcoatMap,Ze=Z&&!!C.clearcoatNormalMap,Ee=Z&&!!C.clearcoatRoughnessMap,De=Ae&&!!C.iridescenceMap,Oe=Ae&&!!C.iridescenceThicknessMap,Ge=oe&&!!C.sheenColorMap,Te=oe&&!!C.sheenRoughnessMap,nt=!!C.specularMap,Ke=!!C.specularColorMap,it=!!C.specularIntensityMap,W=Qe&&!!C.transmissionMap,ne=Qe&&!!C.thicknessMap,re=!!C.gradientMap,de=!!C.alphaMap,Se=C.alphaTest>0,Ie=!!C.alphaHash,st=!!C.extensions;let Ht=Is;C.toneMapped&&(be===null||be.isXRRenderTarget===!0)&&(Ht=i.toneMapping);const vn={shaderID:J,shaderType:C.type,shaderName:C.name,vertexShader:Me,fragmentShader:se,defines:C.defines,customVertexShaderID:me,customFragmentShaderID:xe,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:f,batching:He,batchingColor:He&&q._colorsTexture!==null,instancing:et,instancingColor:et&&q.instanceColor!==null,instancingMorph:et&&q.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:be===null?i.outputColorSpace:be.isXRRenderTarget===!0?be.texture.colorSpace:un,alphaToCoverage:!!C.alphaToCoverage,map:Mt,matcap:ft,envMap:$e,envMapMode:$e&&Y.mapping,envMapCubeUVHeight:Q,aoMap:H,lightMap:wn,bumpMap:pt,normalMap:mt,displacementMap:d&&We,emissiveMap:Dt,normalMapObjectSpace:mt&&C.normalMapType===zy,normalMapTangentSpace:mt&&C.normalMapType===Oc,metalnessMap:ze,roughnessMap:L,anisotropy:M,anisotropyMap:ve,clearcoat:Z,clearcoatMap:qe,clearcoatNormalMap:Ze,clearcoatRoughnessMap:Ee,dispersion:le,iridescence:Ae,iridescenceMap:De,iridescenceThicknessMap:Oe,sheen:oe,sheenColorMap:Ge,sheenRoughnessMap:Te,specularMap:nt,specularColorMap:Ke,specularIntensityMap:it,transmission:Qe,transmissionMap:W,thicknessMap:ne,gradientMap:re,opaque:C.transparent===!1&&C.blending===jr&&C.alphaToCoverage===!1,alphaMap:de,alphaTest:Se,alphaHash:Ie,combine:C.combine,mapUv:Mt&&m(C.map.channel),aoMapUv:H&&m(C.aoMap.channel),lightMapUv:wn&&m(C.lightMap.channel),bumpMapUv:pt&&m(C.bumpMap.channel),normalMapUv:mt&&m(C.normalMap.channel),displacementMapUv:We&&m(C.displacementMap.channel),emissiveMapUv:Dt&&m(C.emissiveMap.channel),metalnessMapUv:ze&&m(C.metalnessMap.channel),roughnessMapUv:L&&m(C.roughnessMap.channel),anisotropyMapUv:ve&&m(C.anisotropyMap.channel),clearcoatMapUv:qe&&m(C.clearcoatMap.channel),clearcoatNormalMapUv:Ze&&m(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ee&&m(C.clearcoatRoughnessMap.channel),iridescenceMapUv:De&&m(C.iridescenceMap.channel),iridescenceThicknessMapUv:Oe&&m(C.iridescenceThicknessMap.channel),sheenColorMapUv:Ge&&m(C.sheenColorMap.channel),sheenRoughnessMapUv:Te&&m(C.sheenRoughnessMap.channel),specularMapUv:nt&&m(C.specularMap.channel),specularColorMapUv:Ke&&m(C.specularColorMap.channel),specularIntensityMapUv:it&&m(C.specularIntensityMap.channel),transmissionMapUv:W&&m(C.transmissionMap.channel),thicknessMapUv:ne&&m(C.thicknessMap.channel),alphaMapUv:de&&m(C.alphaMap.channel),vertexTangents:!!D.attributes.tangent&&(mt||M),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!D.attributes.color&&D.attributes.color.itemSize===4,pointsUvs:q.isPoints===!0&&!!D.attributes.uv&&(Mt||de),fog:!!$,useFog:C.fog===!0,fogExp2:!!$&&$.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:Ue,skinning:q.isSkinnedMesh===!0,morphTargets:D.morphAttributes.position!==void 0,morphNormals:D.morphAttributes.normal!==void 0,morphColors:D.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:_e,numDirLights:v.directional.length,numPointLights:v.point.length,numSpotLights:v.spot.length,numSpotLightMaps:v.spotLightMap.length,numRectAreaLights:v.rectArea.length,numHemiLights:v.hemi.length,numDirLightShadows:v.directionalShadowMap.length,numPointLightShadows:v.pointShadowMap.length,numSpotLightShadows:v.spotShadowMap.length,numSpotLightShadowsWithMaps:v.numSpotLightShadowsWithMaps,numLightProbes:v.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:Ht,decodeVideoTexture:Mt&&C.map.isVideoTexture===!0&&tt.getTransfer(C.map.colorSpace)===Rt,decodeVideoTextureEmissive:Dt&&C.emissiveMap.isVideoTexture===!0&&tt.getTransfer(C.emissiveMap.colorSpace)===Rt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Li,flipSided:C.side===Dn,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:st&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(st&&C.extensions.multiDraw===!0||He)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return vn.vertexUv1s=l.has(1),vn.vertexUv2s=l.has(2),vn.vertexUv3s=l.has(3),l.clear(),vn}function A(C){const v=[];if(C.shaderID?v.push(C.shaderID):(v.push(C.customVertexShaderID),v.push(C.customFragmentShaderID)),C.defines!==void 0)for(const F in C.defines)v.push(F),v.push(C.defines[F]);return C.isRawShaderMaterial===!1&&(_(v,C),x(v,C),v.push(i.outputColorSpace)),v.push(C.customProgramCacheKey),v.join()}function _(C,v){C.push(v.precision),C.push(v.outputColorSpace),C.push(v.envMapMode),C.push(v.envMapCubeUVHeight),C.push(v.mapUv),C.push(v.alphaMapUv),C.push(v.lightMapUv),C.push(v.aoMapUv),C.push(v.bumpMapUv),C.push(v.normalMapUv),C.push(v.displacementMapUv),C.push(v.emissiveMapUv),C.push(v.metalnessMapUv),C.push(v.roughnessMapUv),C.push(v.anisotropyMapUv),C.push(v.clearcoatMapUv),C.push(v.clearcoatNormalMapUv),C.push(v.clearcoatRoughnessMapUv),C.push(v.iridescenceMapUv),C.push(v.iridescenceThicknessMapUv),C.push(v.sheenColorMapUv),C.push(v.sheenRoughnessMapUv),C.push(v.specularMapUv),C.push(v.specularColorMapUv),C.push(v.specularIntensityMapUv),C.push(v.transmissionMapUv),C.push(v.thicknessMapUv),C.push(v.combine),C.push(v.fogExp2),C.push(v.sizeAttenuation),C.push(v.morphTargetsCount),C.push(v.morphAttributeCount),C.push(v.numDirLights),C.push(v.numPointLights),C.push(v.numSpotLights),C.push(v.numSpotLightMaps),C.push(v.numHemiLights),C.push(v.numRectAreaLights),C.push(v.numDirLightShadows),C.push(v.numPointLightShadows),C.push(v.numSpotLightShadows),C.push(v.numSpotLightShadowsWithMaps),C.push(v.numLightProbes),C.push(v.shadowMapType),C.push(v.toneMapping),C.push(v.numClippingPlanes),C.push(v.numClipIntersection),C.push(v.depthPacking)}function x(C,v){o.disableAll(),v.supportsVertexTextures&&o.enable(0),v.instancing&&o.enable(1),v.instancingColor&&o.enable(2),v.instancingMorph&&o.enable(3),v.matcap&&o.enable(4),v.envMap&&o.enable(5),v.normalMapObjectSpace&&o.enable(6),v.normalMapTangentSpace&&o.enable(7),v.clearcoat&&o.enable(8),v.iridescence&&o.enable(9),v.alphaTest&&o.enable(10),v.vertexColors&&o.enable(11),v.vertexAlphas&&o.enable(12),v.vertexUv1s&&o.enable(13),v.vertexUv2s&&o.enable(14),v.vertexUv3s&&o.enable(15),v.vertexTangents&&o.enable(16),v.anisotropy&&o.enable(17),v.alphaHash&&o.enable(18),v.batching&&o.enable(19),v.dispersion&&o.enable(20),v.batchingColor&&o.enable(21),C.push(o.mask),o.disableAll(),v.fog&&o.enable(0),v.useFog&&o.enable(1),v.flatShading&&o.enable(2),v.logarithmicDepthBuffer&&o.enable(3),v.reverseDepthBuffer&&o.enable(4),v.skinning&&o.enable(5),v.morphTargets&&o.enable(6),v.morphNormals&&o.enable(7),v.morphColors&&o.enable(8),v.premultipliedAlpha&&o.enable(9),v.shadowMapEnabled&&o.enable(10),v.doubleSided&&o.enable(11),v.flipSided&&o.enable(12),v.useDepthPacking&&o.enable(13),v.dithering&&o.enable(14),v.transmission&&o.enable(15),v.sheen&&o.enable(16),v.opaque&&o.enable(17),v.pointsUvs&&o.enable(18),v.decodeVideoTexture&&o.enable(19),v.decodeVideoTextureEmissive&&o.enable(20),v.alphaToCoverage&&o.enable(21),C.push(o.mask)}function E(C){const v=p[C.type];let F;if(v){const K=Oi[v];F=k_.clone(K.uniforms)}else F=C.uniforms;return F}function S(C,v){let F;for(let K=0,q=h.length;K<q;K++){const $=h[K];if($.cacheKey===v){F=$,++F.usedTimes;break}}return F===void 0&&(F=new SS(i,v,C,r),h.push(F)),F}function w(C){if(--C.usedTimes===0){const v=h.indexOf(C);h[v]=h[h.length-1],h.pop(),C.destroy()}}function I(C){c.remove(C)}function T(){c.dispose()}return{getParameters:g,getProgramCacheKey:A,getUniforms:E,acquireProgram:S,releaseProgram:w,releaseShaderCache:I,programs:h,dispose:T}}function FS(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function s(a,o,c){i.get(a)[o]=c}function r(){i=new WeakMap}return{has:e,get:t,remove:n,update:s,dispose:r}}function NS(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Kg(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function jg(){const i=[];let e=0;const t=[],n=[],s=[];function r(){e=0,t.length=0,n.length=0,s.length=0}function a(u,d,f,p,m,g){let A=i[e];return A===void 0?(A={id:u.id,object:u,geometry:d,material:f,groupOrder:p,renderOrder:u.renderOrder,z:m,group:g},i[e]=A):(A.id=u.id,A.object=u,A.geometry=d,A.material=f,A.groupOrder=p,A.renderOrder=u.renderOrder,A.z=m,A.group=g),e++,A}function o(u,d,f,p,m,g){const A=a(u,d,f,p,m,g);f.transmission>0?n.push(A):f.transparent===!0?s.push(A):t.push(A)}function c(u,d,f,p,m,g){const A=a(u,d,f,p,m,g);f.transmission>0?n.unshift(A):f.transparent===!0?s.unshift(A):t.unshift(A)}function l(u,d){t.length>1&&t.sort(u||NS),n.length>1&&n.sort(d||Kg),s.length>1&&s.sort(d||Kg)}function h(){for(let u=e,d=i.length;u<d;u++){const f=i[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:s,init:r,push:o,unshift:c,finish:h,sort:l}}function DS(){let i=new WeakMap;function e(n,s){const r=i.get(n);let a;return r===void 0?(a=new jg,i.set(n,[a])):s>=r.length?(a=new jg,r.push(a)):a=r[s],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function LS(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new G,color:new Fe};break;case"SpotLight":t={position:new G,direction:new G,color:new Fe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new Fe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new Fe,groundColor:new Fe};break;case"RectAreaLight":t={color:new Fe,position:new G,halfWidth:new G,halfHeight:new G};break}return i[e.id]=t,t}}}function PS(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let kS=0;function US(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function OS(i){const e=new LS,t=PS(),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 G);const s=new G,r=new Re,a=new Re;function o(l){let h=0,u=0,d=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let f=0,p=0,m=0,g=0,A=0,_=0,x=0,E=0,S=0,w=0,I=0;l.sort(US);for(let C=0,v=l.length;C<v;C++){const F=l[C],K=F.color,q=F.intensity,$=F.distance,D=F.shadow&&F.shadow.map?F.shadow.map.texture:null;if(F.isAmbientLight)h+=K.r*q,u+=K.g*q,d+=K.b*q;else if(F.isLightProbe){for(let O=0;O<9;O++)n.probe[O].addScaledVector(F.sh.coefficients[O],q);I++}else if(F.isDirectionalLight){const O=e.get(F);if(O.color.copy(F.color).multiplyScalar(F.intensity),F.castShadow){const Y=F.shadow,Q=t.get(F);Q.shadowIntensity=Y.intensity,Q.shadowBias=Y.bias,Q.shadowNormalBias=Y.normalBias,Q.shadowRadius=Y.radius,Q.shadowMapSize=Y.mapSize,n.directionalShadow[f]=Q,n.directionalShadowMap[f]=D,n.directionalShadowMatrix[f]=F.shadow.matrix,_++}n.directional[f]=O,f++}else if(F.isSpotLight){const O=e.get(F);O.position.setFromMatrixPosition(F.matrixWorld),O.color.copy(K).multiplyScalar(q),O.distance=$,O.coneCos=Math.cos(F.angle),O.penumbraCos=Math.cos(F.angle*(1-F.penumbra)),O.decay=F.decay,n.spot[m]=O;const Y=F.shadow;if(F.map&&(n.spotLightMap[S]=F.map,S++,Y.updateMatrices(F),F.castShadow&&w++),n.spotLightMatrix[m]=Y.matrix,F.castShadow){const Q=t.get(F);Q.shadowIntensity=Y.intensity,Q.shadowBias=Y.bias,Q.shadowNormalBias=Y.normalBias,Q.shadowRadius=Y.radius,Q.shadowMapSize=Y.mapSize,n.spotShadow[m]=Q,n.spotShadowMap[m]=D,E++}m++}else if(F.isRectAreaLight){const O=e.get(F);O.color.copy(K).multiplyScalar(q),O.halfWidth.set(F.width*.5,0,0),O.halfHeight.set(0,F.height*.5,0),n.rectArea[g]=O,g++}else if(F.isPointLight){const O=e.get(F);if(O.color.copy(F.color).multiplyScalar(F.intensity),O.distance=F.distance,O.decay=F.decay,F.castShadow){const Y=F.shadow,Q=t.get(F);Q.shadowIntensity=Y.intensity,Q.shadowBias=Y.bias,Q.shadowNormalBias=Y.normalBias,Q.shadowRadius=Y.radius,Q.shadowMapSize=Y.mapSize,Q.shadowCameraNear=Y.camera.near,Q.shadowCameraFar=Y.camera.far,n.pointShadow[p]=Q,n.pointShadowMap[p]=D,n.pointShadowMatrix[p]=F.shadow.matrix,x++}n.point[p]=O,p++}else if(F.isHemisphereLight){const O=e.get(F);O.skyColor.copy(F.color).multiplyScalar(q),O.groundColor.copy(F.groundColor).multiplyScalar(q),n.hemi[A]=O,A++}}g>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=we.LTC_FLOAT_1,n.rectAreaLTC2=we.LTC_FLOAT_2):(n.rectAreaLTC1=we.LTC_HALF_1,n.rectAreaLTC2=we.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const T=n.hash;(T.directionalLength!==f||T.pointLength!==p||T.spotLength!==m||T.rectAreaLength!==g||T.hemiLength!==A||T.numDirectionalShadows!==_||T.numPointShadows!==x||T.numSpotShadows!==E||T.numSpotMaps!==S||T.numLightProbes!==I)&&(n.directional.length=f,n.spot.length=m,n.rectArea.length=g,n.point.length=p,n.hemi.length=A,n.directionalShadow.length=_,n.directionalShadowMap.length=_,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=E,n.spotShadowMap.length=E,n.directionalShadowMatrix.length=_,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=E+S-w,n.spotLightMap.length=S,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=I,T.directionalLength=f,T.pointLength=p,T.spotLength=m,T.rectAreaLength=g,T.hemiLength=A,T.numDirectionalShadows=_,T.numPointShadows=x,T.numSpotShadows=E,T.numSpotMaps=S,T.numLightProbes=I,n.version=kS++)}function c(l,h){let u=0,d=0,f=0,p=0,m=0;const g=h.matrixWorldInverse;for(let A=0,_=l.length;A<_;A++){const x=l[A];if(x.isDirectionalLight){const E=n.directional[u];E.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(g),u++}else if(x.isSpotLight){const E=n.spot[f];E.position.setFromMatrixPosition(x.matrixWorld),E.position.applyMatrix4(g),E.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(g),f++}else if(x.isRectAreaLight){const E=n.rectArea[p];E.position.setFromMatrixPosition(x.matrixWorld),E.position.applyMatrix4(g),a.identity(),r.copy(x.matrixWorld),r.premultiply(g),a.extractRotation(r),E.halfWidth.set(x.width*.5,0,0),E.halfHeight.set(0,x.height*.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),p++}else if(x.isPointLight){const E=n.point[d];E.position.setFromMatrixPosition(x.matrixWorld),E.position.applyMatrix4(g),d++}else if(x.isHemisphereLight){const E=n.hemi[m];E.direction.setFromMatrixPosition(x.matrixWorld),E.direction.transformDirection(g),m++}}}return{setup:o,setupView:c,state:n}}function Xg(i){const e=new OS(i),t=[],n=[];function s(h){l.camera=h,t.length=0,n.length=0}function r(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function c(h){e.setupView(t,h)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:l,setupLights:o,setupLightsView:c,pushLight:r,pushShadow:a}}function QS(i){let e=new WeakMap;function t(s,r=0){const a=e.get(s);let o;return a===void 0?(o=new Xg(i),e.set(s,[o])):r>=a.length?(o=new Xg(i),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const GS=`void main() {
+`+Q)}else K!==""?console.warn("THREE.WebGLProgram: Program Info Log:",K):(q===""||$==="")&&(O=!1);O&&(F.diagnostics={runnable:D,programLog:K,vertexShader:{log:q,prefix:g},fragmentShader:{log:$,prefix:A}})}s.deleteShader(S),s.deleteShader(w),T=new Nl(s,m),C=mS(s,m)}let T;this.getUniforms=function(){return T===void 0&&I(this),T};let C;this.getAttributes=function(){return C===void 0&&I(this),C};let v=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return v===!1&&(v=s.getProgramParameter(m,cS)),v},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=lS++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}let BS=0;class TS{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(s)===!1&&(a.add(s),s.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new RS(e),t.set(e,n)),n}}class RS{constructor(e){this.id=BS++,this.code=e,this.usedTimes=0}}function FS(i,e,t,n,s,r,a){const o=new bA,c=new TS,l=new Set,h=[],u=s.logarithmicDepthBuffer,d=s.vertexTextures;let f=s.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(C){return l.add(C),C===0?"uv":`uv${C}`}function g(C,v,F,K,q){const $=K.fog,D=q.geometry,O=C.isMeshStandardMaterial?K.environment:null,Y=(C.isMeshStandardMaterial?t:e).get(C.envMap||O),Q=Y&&Y.mapping===Bc?Y.image.height:null,J=p[C.type];C.precision!==null&&(f=s.getMaxPrecision(C.precision),f!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",f,"instead."));const ee=D.morphAttributes.position||D.morphAttributes.normal||D.morphAttributes.color,ae=ee!==void 0?ee.length:0;let _e=0;D.morphAttributes.position!==void 0&&(_e=1),D.morphAttributes.normal!==void 0&&(_e=2),D.morphAttributes.color!==void 0&&(_e=3);let Me,se,me,xe;if(J){const Ct=Qi[J];Me=Ct.vertexShader,se=Ct.fragmentShader}else Me=C.vertexShader,se=C.fragmentShader,c.update(C),me=c.getVertexShaderID(C),xe=c.getFragmentShaderID(C);const be=i.getRenderTarget(),Ue=i.state.buffers.depth.getReversed(),et=q.isInstancedMesh===!0,He=q.isBatchedMesh===!0,Mt=!!C.map,ft=!!C.matcap,$e=!!Y,H=!!C.aoMap,wn=!!C.lightMap,pt=!!C.bumpMap,mt=!!C.normalMap,We=!!C.displacementMap,Dt=!!C.emissiveMap,ze=!!C.metalnessMap,L=!!C.roughnessMap,M=C.anisotropy>0,Z=C.clearcoat>0,le=C.dispersion>0,Ae=C.iridescence>0,oe=C.sheen>0,Qe=C.transmission>0,ve=M&&!!C.anisotropyMap,qe=Z&&!!C.clearcoatMap,Ze=Z&&!!C.clearcoatNormalMap,Ee=Z&&!!C.clearcoatRoughnessMap,De=Ae&&!!C.iridescenceMap,Oe=Ae&&!!C.iridescenceThicknessMap,Ge=oe&&!!C.sheenColorMap,Te=oe&&!!C.sheenRoughnessMap,nt=!!C.specularMap,Ke=!!C.specularColorMap,it=!!C.specularIntensityMap,W=Qe&&!!C.transmissionMap,ne=Qe&&!!C.thicknessMap,re=!!C.gradientMap,de=!!C.alphaMap,Se=C.alphaTest>0,Ie=!!C.alphaHash,st=!!C.extensions;let Ht=Is;C.toneMapped&&(be===null||be.isXRRenderTarget===!0)&&(Ht=i.toneMapping);const vn={shaderID:J,shaderType:C.type,shaderName:C.name,vertexShader:Me,fragmentShader:se,defines:C.defines,customVertexShaderID:me,customFragmentShaderID:xe,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:f,batching:He,batchingColor:He&&q._colorsTexture!==null,instancing:et,instancingColor:et&&q.instanceColor!==null,instancingMorph:et&&q.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:be===null?i.outputColorSpace:be.isXRRenderTarget===!0?be.texture.colorSpace:un,alphaToCoverage:!!C.alphaToCoverage,map:Mt,matcap:ft,envMap:$e,envMapMode:$e&&Y.mapping,envMapCubeUVHeight:Q,aoMap:H,lightMap:wn,bumpMap:pt,normalMap:mt,displacementMap:d&&We,emissiveMap:Dt,normalMapObjectSpace:mt&&C.normalMapType===Vy,normalMapTangentSpace:mt&&C.normalMapType===Gc,metalnessMap:ze,roughnessMap:L,anisotropy:M,anisotropyMap:ve,clearcoat:Z,clearcoatMap:qe,clearcoatNormalMap:Ze,clearcoatRoughnessMap:Ee,dispersion:le,iridescence:Ae,iridescenceMap:De,iridescenceThicknessMap:Oe,sheen:oe,sheenColorMap:Ge,sheenRoughnessMap:Te,specularMap:nt,specularColorMap:Ke,specularIntensityMap:it,transmission:Qe,transmissionMap:W,thicknessMap:ne,gradientMap:re,opaque:C.transparent===!1&&C.blending===jr&&C.alphaToCoverage===!1,alphaMap:de,alphaTest:Se,alphaHash:Ie,combine:C.combine,mapUv:Mt&&m(C.map.channel),aoMapUv:H&&m(C.aoMap.channel),lightMapUv:wn&&m(C.lightMap.channel),bumpMapUv:pt&&m(C.bumpMap.channel),normalMapUv:mt&&m(C.normalMap.channel),displacementMapUv:We&&m(C.displacementMap.channel),emissiveMapUv:Dt&&m(C.emissiveMap.channel),metalnessMapUv:ze&&m(C.metalnessMap.channel),roughnessMapUv:L&&m(C.roughnessMap.channel),anisotropyMapUv:ve&&m(C.anisotropyMap.channel),clearcoatMapUv:qe&&m(C.clearcoatMap.channel),clearcoatNormalMapUv:Ze&&m(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ee&&m(C.clearcoatRoughnessMap.channel),iridescenceMapUv:De&&m(C.iridescenceMap.channel),iridescenceThicknessMapUv:Oe&&m(C.iridescenceThicknessMap.channel),sheenColorMapUv:Ge&&m(C.sheenColorMap.channel),sheenRoughnessMapUv:Te&&m(C.sheenRoughnessMap.channel),specularMapUv:nt&&m(C.specularMap.channel),specularColorMapUv:Ke&&m(C.specularColorMap.channel),specularIntensityMapUv:it&&m(C.specularIntensityMap.channel),transmissionMapUv:W&&m(C.transmissionMap.channel),thicknessMapUv:ne&&m(C.thicknessMap.channel),alphaMapUv:de&&m(C.alphaMap.channel),vertexTangents:!!D.attributes.tangent&&(mt||M),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!D.attributes.color&&D.attributes.color.itemSize===4,pointsUvs:q.isPoints===!0&&!!D.attributes.uv&&(Mt||de),fog:!!$,useFog:C.fog===!0,fogExp2:!!$&&$.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:Ue,skinning:q.isSkinnedMesh===!0,morphTargets:D.morphAttributes.position!==void 0,morphNormals:D.morphAttributes.normal!==void 0,morphColors:D.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:_e,numDirLights:v.directional.length,numPointLights:v.point.length,numSpotLights:v.spot.length,numSpotLightMaps:v.spotLightMap.length,numRectAreaLights:v.rectArea.length,numHemiLights:v.hemi.length,numDirLightShadows:v.directionalShadowMap.length,numPointLightShadows:v.pointShadowMap.length,numSpotLightShadows:v.spotShadowMap.length,numSpotLightShadowsWithMaps:v.numSpotLightShadowsWithMaps,numLightProbes:v.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:Ht,decodeVideoTexture:Mt&&C.map.isVideoTexture===!0&&tt.getTransfer(C.map.colorSpace)===Rt,decodeVideoTextureEmissive:Dt&&C.emissiveMap.isVideoTexture===!0&&tt.getTransfer(C.emissiveMap.colorSpace)===Rt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Pi,flipSided:C.side===Ln,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:st&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(st&&C.extensions.multiDraw===!0||He)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return vn.vertexUv1s=l.has(1),vn.vertexUv2s=l.has(2),vn.vertexUv3s=l.has(3),l.clear(),vn}function A(C){const v=[];if(C.shaderID?v.push(C.shaderID):(v.push(C.customVertexShaderID),v.push(C.customFragmentShaderID)),C.defines!==void 0)for(const F in C.defines)v.push(F),v.push(C.defines[F]);return C.isRawShaderMaterial===!1&&(_(v,C),x(v,C),v.push(i.outputColorSpace)),v.push(C.customProgramCacheKey),v.join()}function _(C,v){C.push(v.precision),C.push(v.outputColorSpace),C.push(v.envMapMode),C.push(v.envMapCubeUVHeight),C.push(v.mapUv),C.push(v.alphaMapUv),C.push(v.lightMapUv),C.push(v.aoMapUv),C.push(v.bumpMapUv),C.push(v.normalMapUv),C.push(v.displacementMapUv),C.push(v.emissiveMapUv),C.push(v.metalnessMapUv),C.push(v.roughnessMapUv),C.push(v.anisotropyMapUv),C.push(v.clearcoatMapUv),C.push(v.clearcoatNormalMapUv),C.push(v.clearcoatRoughnessMapUv),C.push(v.iridescenceMapUv),C.push(v.iridescenceThicknessMapUv),C.push(v.sheenColorMapUv),C.push(v.sheenRoughnessMapUv),C.push(v.specularMapUv),C.push(v.specularColorMapUv),C.push(v.specularIntensityMapUv),C.push(v.transmissionMapUv),C.push(v.thicknessMapUv),C.push(v.combine),C.push(v.fogExp2),C.push(v.sizeAttenuation),C.push(v.morphTargetsCount),C.push(v.morphAttributeCount),C.push(v.numDirLights),C.push(v.numPointLights),C.push(v.numSpotLights),C.push(v.numSpotLightMaps),C.push(v.numHemiLights),C.push(v.numRectAreaLights),C.push(v.numDirLightShadows),C.push(v.numPointLightShadows),C.push(v.numSpotLightShadows),C.push(v.numSpotLightShadowsWithMaps),C.push(v.numLightProbes),C.push(v.shadowMapType),C.push(v.toneMapping),C.push(v.numClippingPlanes),C.push(v.numClipIntersection),C.push(v.depthPacking)}function x(C,v){o.disableAll(),v.supportsVertexTextures&&o.enable(0),v.instancing&&o.enable(1),v.instancingColor&&o.enable(2),v.instancingMorph&&o.enable(3),v.matcap&&o.enable(4),v.envMap&&o.enable(5),v.normalMapObjectSpace&&o.enable(6),v.normalMapTangentSpace&&o.enable(7),v.clearcoat&&o.enable(8),v.iridescence&&o.enable(9),v.alphaTest&&o.enable(10),v.vertexColors&&o.enable(11),v.vertexAlphas&&o.enable(12),v.vertexUv1s&&o.enable(13),v.vertexUv2s&&o.enable(14),v.vertexUv3s&&o.enable(15),v.vertexTangents&&o.enable(16),v.anisotropy&&o.enable(17),v.alphaHash&&o.enable(18),v.batching&&o.enable(19),v.dispersion&&o.enable(20),v.batchingColor&&o.enable(21),C.push(o.mask),o.disableAll(),v.fog&&o.enable(0),v.useFog&&o.enable(1),v.flatShading&&o.enable(2),v.logarithmicDepthBuffer&&o.enable(3),v.reverseDepthBuffer&&o.enable(4),v.skinning&&o.enable(5),v.morphTargets&&o.enable(6),v.morphNormals&&o.enable(7),v.morphColors&&o.enable(8),v.premultipliedAlpha&&o.enable(9),v.shadowMapEnabled&&o.enable(10),v.doubleSided&&o.enable(11),v.flipSided&&o.enable(12),v.useDepthPacking&&o.enable(13),v.dithering&&o.enable(14),v.transmission&&o.enable(15),v.sheen&&o.enable(16),v.opaque&&o.enable(17),v.pointsUvs&&o.enable(18),v.decodeVideoTexture&&o.enable(19),v.decodeVideoTextureEmissive&&o.enable(20),v.alphaToCoverage&&o.enable(21),C.push(o.mask)}function E(C){const v=p[C.type];let F;if(v){const K=Qi[v];F=U_.clone(K.uniforms)}else F=C.uniforms;return F}function S(C,v){let F;for(let K=0,q=h.length;K<q;K++){const $=h[K];if($.cacheKey===v){F=$,++F.usedTimes;break}}return F===void 0&&(F=new MS(i,v,C,r),h.push(F)),F}function w(C){if(--C.usedTimes===0){const v=h.indexOf(C);h[v]=h[h.length-1],h.pop(),C.destroy()}}function I(C){c.remove(C)}function T(){c.dispose()}return{getParameters:g,getProgramCacheKey:A,getUniforms:E,acquireProgram:S,releaseProgram:w,releaseShaderCache:I,programs:h,dispose:T}}function NS(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function s(a,o,c){i.get(a)[o]=c}function r(){i=new WeakMap}return{has:e,get:t,remove:n,update:s,dispose:r}}function DS(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function jg(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Xg(){const i=[];let e=0;const t=[],n=[],s=[];function r(){e=0,t.length=0,n.length=0,s.length=0}function a(u,d,f,p,m,g){let A=i[e];return A===void 0?(A={id:u.id,object:u,geometry:d,material:f,groupOrder:p,renderOrder:u.renderOrder,z:m,group:g},i[e]=A):(A.id=u.id,A.object=u,A.geometry=d,A.material=f,A.groupOrder=p,A.renderOrder=u.renderOrder,A.z=m,A.group=g),e++,A}function o(u,d,f,p,m,g){const A=a(u,d,f,p,m,g);f.transmission>0?n.push(A):f.transparent===!0?s.push(A):t.push(A)}function c(u,d,f,p,m,g){const A=a(u,d,f,p,m,g);f.transmission>0?n.unshift(A):f.transparent===!0?s.unshift(A):t.unshift(A)}function l(u,d){t.length>1&&t.sort(u||DS),n.length>1&&n.sort(d||jg),s.length>1&&s.sort(d||jg)}function h(){for(let u=e,d=i.length;u<d;u++){const f=i[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:s,init:r,push:o,unshift:c,finish:h,sort:l}}function LS(){let i=new WeakMap;function e(n,s){const r=i.get(n);let a;return r===void 0?(a=new Xg,i.set(n,[a])):s>=r.length?(a=new Xg,r.push(a)):a=r[s],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function PS(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new G,color:new Fe};break;case"SpotLight":t={position:new G,direction:new G,color:new Fe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new Fe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new Fe,groundColor:new Fe};break;case"RectAreaLight":t={color:new Fe,position:new G,halfWidth:new G,halfHeight:new G};break}return i[e.id]=t,t}}}function kS(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let US=0;function OS(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function QS(i){const e=new PS,t=kS(),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 G);const s=new G,r=new Re,a=new Re;function o(l){let h=0,u=0,d=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let f=0,p=0,m=0,g=0,A=0,_=0,x=0,E=0,S=0,w=0,I=0;l.sort(OS);for(let C=0,v=l.length;C<v;C++){const F=l[C],K=F.color,q=F.intensity,$=F.distance,D=F.shadow&&F.shadow.map?F.shadow.map.texture:null;if(F.isAmbientLight)h+=K.r*q,u+=K.g*q,d+=K.b*q;else if(F.isLightProbe){for(let O=0;O<9;O++)n.probe[O].addScaledVector(F.sh.coefficients[O],q);I++}else if(F.isDirectionalLight){const O=e.get(F);if(O.color.copy(F.color).multiplyScalar(F.intensity),F.castShadow){const Y=F.shadow,Q=t.get(F);Q.shadowIntensity=Y.intensity,Q.shadowBias=Y.bias,Q.shadowNormalBias=Y.normalBias,Q.shadowRadius=Y.radius,Q.shadowMapSize=Y.mapSize,n.directionalShadow[f]=Q,n.directionalShadowMap[f]=D,n.directionalShadowMatrix[f]=F.shadow.matrix,_++}n.directional[f]=O,f++}else if(F.isSpotLight){const O=e.get(F);O.position.setFromMatrixPosition(F.matrixWorld),O.color.copy(K).multiplyScalar(q),O.distance=$,O.coneCos=Math.cos(F.angle),O.penumbraCos=Math.cos(F.angle*(1-F.penumbra)),O.decay=F.decay,n.spot[m]=O;const Y=F.shadow;if(F.map&&(n.spotLightMap[S]=F.map,S++,Y.updateMatrices(F),F.castShadow&&w++),n.spotLightMatrix[m]=Y.matrix,F.castShadow){const Q=t.get(F);Q.shadowIntensity=Y.intensity,Q.shadowBias=Y.bias,Q.shadowNormalBias=Y.normalBias,Q.shadowRadius=Y.radius,Q.shadowMapSize=Y.mapSize,n.spotShadow[m]=Q,n.spotShadowMap[m]=D,E++}m++}else if(F.isRectAreaLight){const O=e.get(F);O.color.copy(K).multiplyScalar(q),O.halfWidth.set(F.width*.5,0,0),O.halfHeight.set(0,F.height*.5,0),n.rectArea[g]=O,g++}else if(F.isPointLight){const O=e.get(F);if(O.color.copy(F.color).multiplyScalar(F.intensity),O.distance=F.distance,O.decay=F.decay,F.castShadow){const Y=F.shadow,Q=t.get(F);Q.shadowIntensity=Y.intensity,Q.shadowBias=Y.bias,Q.shadowNormalBias=Y.normalBias,Q.shadowRadius=Y.radius,Q.shadowMapSize=Y.mapSize,Q.shadowCameraNear=Y.camera.near,Q.shadowCameraFar=Y.camera.far,n.pointShadow[p]=Q,n.pointShadowMap[p]=D,n.pointShadowMatrix[p]=F.shadow.matrix,x++}n.point[p]=O,p++}else if(F.isHemisphereLight){const O=e.get(F);O.skyColor.copy(F.color).multiplyScalar(q),O.groundColor.copy(F.groundColor).multiplyScalar(q),n.hemi[A]=O,A++}}g>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=we.LTC_FLOAT_1,n.rectAreaLTC2=we.LTC_FLOAT_2):(n.rectAreaLTC1=we.LTC_HALF_1,n.rectAreaLTC2=we.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const T=n.hash;(T.directionalLength!==f||T.pointLength!==p||T.spotLength!==m||T.rectAreaLength!==g||T.hemiLength!==A||T.numDirectionalShadows!==_||T.numPointShadows!==x||T.numSpotShadows!==E||T.numSpotMaps!==S||T.numLightProbes!==I)&&(n.directional.length=f,n.spot.length=m,n.rectArea.length=g,n.point.length=p,n.hemi.length=A,n.directionalShadow.length=_,n.directionalShadowMap.length=_,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=E,n.spotShadowMap.length=E,n.directionalShadowMatrix.length=_,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=E+S-w,n.spotLightMap.length=S,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=I,T.directionalLength=f,T.pointLength=p,T.spotLength=m,T.rectAreaLength=g,T.hemiLength=A,T.numDirectionalShadows=_,T.numPointShadows=x,T.numSpotShadows=E,T.numSpotMaps=S,T.numLightProbes=I,n.version=US++)}function c(l,h){let u=0,d=0,f=0,p=0,m=0;const g=h.matrixWorldInverse;for(let A=0,_=l.length;A<_;A++){const x=l[A];if(x.isDirectionalLight){const E=n.directional[u];E.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(g),u++}else if(x.isSpotLight){const E=n.spot[f];E.position.setFromMatrixPosition(x.matrixWorld),E.position.applyMatrix4(g),E.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(g),f++}else if(x.isRectAreaLight){const E=n.rectArea[p];E.position.setFromMatrixPosition(x.matrixWorld),E.position.applyMatrix4(g),a.identity(),r.copy(x.matrixWorld),r.premultiply(g),a.extractRotation(r),E.halfWidth.set(x.width*.5,0,0),E.halfHeight.set(0,x.height*.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),p++}else if(x.isPointLight){const E=n.point[d];E.position.setFromMatrixPosition(x.matrixWorld),E.position.applyMatrix4(g),d++}else if(x.isHemisphereLight){const E=n.hemi[m];E.direction.setFromMatrixPosition(x.matrixWorld),E.direction.transformDirection(g),m++}}}return{setup:o,setupView:c,state:n}}function Yg(i){const e=new QS(i),t=[],n=[];function s(h){l.camera=h,t.length=0,n.length=0}function r(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function c(h){e.setupView(t,h)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:l,setupLights:o,setupLightsView:c,pushLight:r,pushShadow:a}}function GS(i){let e=new WeakMap;function t(s,r=0){const a=e.get(s);let o;return a===void 0?(o=new Yg(i),e.set(s,[o])):r>=a.length?(o=new Yg(i),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const HS=`void main() {
gl_Position = vec4( position, 1.0 );
-}`,HS=`uniform sampler2D shadow_pass;
+}`,zS=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
@@ -3792,12 +3792,12 @@ void main() {
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
-}`;function zS(i,e,t){let n=new nd;const s=new Je,r=new Je,a=new gt,o=new bw({depthPacking:Hy}),c=new Ew,l={},h=t.maxTextureSize,u={[Ki]:Dn,[Dn]:Ki,[Li]:Li},d=new Ls({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Je},radius:{value:4}},vertexShader:GS,fragmentShader:HS}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new Mn;p.setAttribute("position",new Sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Zt(p,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Hp;let A=this.type;this.render=function(w,I,T){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;const C=i.getRenderTarget(),v=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),K=i.state;K.setBlending(Cs),K.buffers.color.setClear(1,1,1,1),K.buffers.depth.setTest(!0),K.setScissorTest(!1);const q=A!==qi&&this.type===qi,$=A===qi&&this.type!==qi;for(let D=0,O=w.length;D<O;D++){const Y=w[D],Q=Y.shadow;if(Q===void 0){console.warn("THREE.WebGLShadowMap:",Y,"has no shadow.");continue}if(Q.autoUpdate===!1&&Q.needsUpdate===!1)continue;s.copy(Q.mapSize);const J=Q.getFrameExtents();if(s.multiply(J),r.copy(Q.mapSize),(s.x>h||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/J.x),s.x=r.x*J.x,Q.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/J.y),s.y=r.y*J.y,Q.mapSize.y=r.y)),Q.map===null||q===!0||$===!0){const ae=this.type!==qi?{minFilter:Ln,magFilter:Ln}:{};Q.map!==null&&Q.map.dispose(),Q.map=new or(s.x,s.y,ae),Q.map.texture.name=Y.name+".shadowMap",Q.camera.updateProjectionMatrix()}i.setRenderTarget(Q.map),i.clear();const ee=Q.getViewportCount();for(let ae=0;ae<ee;ae++){const _e=Q.getViewport(ae);a.set(r.x*_e.x,r.y*_e.y,r.x*_e.z,r.y*_e.w),K.viewport(a),Q.updateMatrices(Y,ae),n=Q.getFrustum(),E(I,T,Q.camera,Y,this.type)}Q.isPointLightShadow!==!0&&this.type===qi&&_(Q,T),Q.needsUpdate=!1}A=this.type,g.needsUpdate=!1,i.setRenderTarget(C,v,F)};function _(w,I){const T=e.update(m);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,f.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new or(s.x,s.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(I,null,T,d,m,null),f.uniforms.shadow_pass.value=w.mapPass.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(I,null,T,f,m,null)}function x(w,I,T,C){let v=null;const F=T.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(F!==void 0)v=F;else if(v=T.isPointLight===!0?c:o,i.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const K=v.uuid,q=I.uuid;let $=l[K];$===void 0&&($={},l[K]=$);let D=$[q];D===void 0&&(D=v.clone(),$[q]=D,I.addEventListener("dispose",S)),v=D}if(v.visible=I.visible,v.wireframe=I.wireframe,C===qi?v.side=I.shadowSide!==null?I.shadowSide:I.side:v.side=I.shadowSide!==null?I.shadowSide:u[I.side],v.alphaMap=I.alphaMap,v.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,v.map=I.map,v.clipShadows=I.clipShadows,v.clippingPlanes=I.clippingPlanes,v.clipIntersection=I.clipIntersection,v.displacementMap=I.displacementMap,v.displacementScale=I.displacementScale,v.displacementBias=I.displacementBias,v.wireframeLinewidth=I.wireframeLinewidth,v.linewidth=I.linewidth,T.isPointLight===!0&&v.isMeshDistanceMaterial===!0){const K=i.properties.get(v);K.light=T}return v}function E(w,I,T,C,v){if(w.visible===!1)return;if(w.layers.test(I.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&v===qi)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,w.matrixWorld);const q=e.update(w),$=w.material;if(Array.isArray($)){const D=q.groups;for(let O=0,Y=D.length;O<Y;O++){const Q=D[O],J=$[Q.materialIndex];if(J&&J.visible){const ee=x(w,J,C,v);w.onBeforeShadow(i,w,I,T,q,ee,Q),i.renderBufferDirect(T,null,q,ee,w,Q),w.onAfterShadow(i,w,I,T,q,ee,Q)}}}else if($.visible){const D=x(w,$,C,v);w.onBeforeShadow(i,w,I,T,q,D,null),i.renderBufferDirect(T,null,q,D,w,null),w.onAfterShadow(i,w,I,T,q,D,null)}}const K=w.children;for(let q=0,$=K.length;q<$;q++)E(K[q],I,T,C,v)}function S(w){w.target.removeEventListener("dispose",S);for(const T in l){const C=l[T],v=w.target.uuid;v in C&&(C[v].dispose(),delete C[v])}}}const VS={[Vh]:Wh,[qh]:Xh,[Kh]:Yh,[Xr]:jh,[Wh]:Vh,[Xh]:qh,[Yh]:Kh,[jh]:Xr};function WS(i,e){function t(){let W=!1;const ne=new gt;let re=null;const de=new gt(0,0,0,0);return{setMask:function(Se){re!==Se&&!W&&(i.colorMask(Se,Se,Se,Se),re=Se)},setLocked:function(Se){W=Se},setClear:function(Se,Ie,st,Ht,vn){vn===!0&&(Se*=Ht,Ie*=Ht,st*=Ht),ne.set(Se,Ie,st,Ht),de.equals(ne)===!1&&(i.clearColor(Se,Ie,st,Ht),de.copy(ne))},reset:function(){W=!1,re=null,de.set(-1,0,0,0)}}}function n(){let W=!1,ne=!1,re=null,de=null,Se=null;return{setReversed:function(Ie){if(ne!==Ie){const st=e.get("EXT_clip_control");Ie?st.clipControlEXT(st.LOWER_LEFT_EXT,st.ZERO_TO_ONE_EXT):st.clipControlEXT(st.LOWER_LEFT_EXT,st.NEGATIVE_ONE_TO_ONE_EXT),ne=Ie;const Ht=Se;Se=null,this.setClear(Ht)}},getReversed:function(){return ne},setTest:function(Ie){Ie?be(i.DEPTH_TEST):Ue(i.DEPTH_TEST)},setMask:function(Ie){re!==Ie&&!W&&(i.depthMask(Ie),re=Ie)},setFunc:function(Ie){if(ne&&(Ie=VS[Ie]),de!==Ie){switch(Ie){case Vh:i.depthFunc(i.NEVER);break;case Wh:i.depthFunc(i.ALWAYS);break;case qh:i.depthFunc(i.LESS);break;case Xr:i.depthFunc(i.LEQUAL);break;case Kh:i.depthFunc(i.EQUAL);break;case jh:i.depthFunc(i.GEQUAL);break;case Xh:i.depthFunc(i.GREATER);break;case Yh:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}de=Ie}},setLocked:function(Ie){W=Ie},setClear:function(Ie){Se!==Ie&&(ne&&(Ie=1-Ie),i.clearDepth(Ie),Se=Ie)},reset:function(){W=!1,re=null,de=null,Se=null,ne=!1}}}function s(){let W=!1,ne=null,re=null,de=null,Se=null,Ie=null,st=null,Ht=null,vn=null;return{setTest:function(Ct){W||(Ct?be(i.STENCIL_TEST):Ue(i.STENCIL_TEST))},setMask:function(Ct){ne!==Ct&&!W&&(i.stencilMask(Ct),ne=Ct)},setFunc:function(Ct,ii,Di){(re!==Ct||de!==ii||Se!==Di)&&(i.stencilFunc(Ct,ii,Di),re=Ct,de=ii,Se=Di)},setOp:function(Ct,ii,Di){(Ie!==Ct||st!==ii||Ht!==Di)&&(i.stencilOp(Ct,ii,Di),Ie=Ct,st=ii,Ht=Di)},setLocked:function(Ct){W=Ct},setClear:function(Ct){vn!==Ct&&(i.clearStencil(Ct),vn=Ct)},reset:function(){W=!1,ne=null,re=null,de=null,Se=null,Ie=null,st=null,Ht=null,vn=null}}}const r=new t,a=new n,o=new s,c=new WeakMap,l=new WeakMap;let h={},u={},d=new WeakMap,f=[],p=null,m=!1,g=null,A=null,_=null,x=null,E=null,S=null,w=null,I=new Fe(0,0,0),T=0,C=!1,v=null,F=null,K=null,q=null,$=null;const D=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let O=!1,Y=0;const Q=i.getParameter(i.VERSION);Q.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(Q)[1]),O=Y>=1):Q.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),O=Y>=2);let J=null,ee={};const ae=i.getParameter(i.SCISSOR_BOX),_e=i.getParameter(i.VIEWPORT),Me=new gt().fromArray(ae),se=new gt().fromArray(_e);function me(W,ne,re,de){const Se=new Uint8Array(4),Ie=i.createTexture();i.bindTexture(W,Ie),i.texParameteri(W,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(W,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let st=0;st<re;st++)W===i.TEXTURE_3D||W===i.TEXTURE_2D_ARRAY?i.texImage3D(ne,0,i.RGBA,1,1,de,0,i.RGBA,i.UNSIGNED_BYTE,Se):i.texImage2D(ne+st,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Se);return Ie}const xe={};xe[i.TEXTURE_2D]=me(i.TEXTURE_2D,i.TEXTURE_2D,1),xe[i.TEXTURE_CUBE_MAP]=me(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),xe[i.TEXTURE_2D_ARRAY]=me(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),xe[i.TEXTURE_3D]=me(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),be(i.DEPTH_TEST),a.setFunc(Xr),pt(!1),mt(Gp),be(i.CULL_FACE),H(Cs);function be(W){h[W]!==!0&&(i.enable(W),h[W]=!0)}function Ue(W){h[W]!==!1&&(i.disable(W),h[W]=!1)}function et(W,ne){return u[W]!==ne?(i.bindFramebuffer(W,ne),u[W]=ne,W===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=ne),W===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=ne),!0):!1}function He(W,ne){let re=f,de=!1;if(W){re=d.get(ne),re===void 0&&(re=[],d.set(ne,re));const Se=W.textures;if(re.length!==Se.length||re[0]!==i.COLOR_ATTACHMENT0){for(let Ie=0,st=Se.length;Ie<st;Ie++)re[Ie]=i.COLOR_ATTACHMENT0+Ie;re.length=Se.length,de=!0}}else re[0]!==i.BACK&&(re[0]=i.BACK,de=!0);de&&i.drawBuffers(re)}function Mt(W){return p!==W?(i.useProgram(W),p=W,!0):!1}const ft={[ir]:i.FUNC_ADD,[fy]:i.FUNC_SUBTRACT,[py]:i.FUNC_REVERSE_SUBTRACT};ft[Ay]=i.MIN,ft[gy]=i.MAX;const $e={[my]:i.ZERO,[xy]:i.ONE,[by]:i.SRC_COLOR,[Hh]:i.SRC_ALPHA,[Cy]:i.SRC_ALPHA_SATURATE,[wy]:i.DST_COLOR,[yy]:i.DST_ALPHA,[Ey]:i.ONE_MINUS_SRC_COLOR,[zh]:i.ONE_MINUS_SRC_ALPHA,[vy]:i.ONE_MINUS_DST_COLOR,[_y]:i.ONE_MINUS_DST_ALPHA,[Iy]:i.CONSTANT_COLOR,[Sy]:i.ONE_MINUS_CONSTANT_COLOR,[My]:i.CONSTANT_ALPHA,[By]:i.ONE_MINUS_CONSTANT_ALPHA};function H(W,ne,re,de,Se,Ie,st,Ht,vn,Ct){if(W===Cs){m===!0&&(Ue(i.BLEND),m=!1);return}if(m===!1&&(be(i.BLEND),m=!0),W!==dy){if(W!==g||Ct!==C){if((A!==ir||E!==ir)&&(i.blendEquation(i.FUNC_ADD),A=ir,E=ir),Ct)switch(W){case jr:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zp:i.blendFunc(i.ONE,i.ONE);break;case Vp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Wp:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}else switch(W){case jr:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zp:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Vp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Wp:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}_=null,x=null,S=null,w=null,I.set(0,0,0),T=0,g=W,C=Ct}return}Se=Se||ne,Ie=Ie||re,st=st||de,(ne!==A||Se!==E)&&(i.blendEquationSeparate(ft[ne],ft[Se]),A=ne,E=Se),(re!==_||de!==x||Ie!==S||st!==w)&&(i.blendFuncSeparate($e[re],$e[de],$e[Ie],$e[st]),_=re,x=de,S=Ie,w=st),(Ht.equals(I)===!1||vn!==T)&&(i.blendColor(Ht.r,Ht.g,Ht.b,vn),I.copy(Ht),T=vn),g=W,C=!1}function wn(W,ne){W.side===Li?Ue(i.CULL_FACE):be(i.CULL_FACE);let re=W.side===Dn;ne&&(re=!re),pt(re),W.blending===jr&&W.transparent===!1?H(Cs):H(W.blending,W.blendEquation,W.blendSrc,W.blendDst,W.blendEquationAlpha,W.blendSrcAlpha,W.blendDstAlpha,W.blendColor,W.blendAlpha,W.premultipliedAlpha),a.setFunc(W.depthFunc),a.setTest(W.depthTest),a.setMask(W.depthWrite),r.setMask(W.colorWrite);const de=W.stencilWrite;o.setTest(de),de&&(o.setMask(W.stencilWriteMask),o.setFunc(W.stencilFunc,W.stencilRef,W.stencilFuncMask),o.setOp(W.stencilFail,W.stencilZFail,W.stencilZPass)),Dt(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),W.alphaToCoverage===!0?be(i.SAMPLE_ALPHA_TO_COVERAGE):Ue(i.SAMPLE_ALPHA_TO_COVERAGE)}function pt(W){v!==W&&(W?i.frontFace(i.CW):i.frontFace(i.CCW),v=W)}function mt(W){W!==ly?(be(i.CULL_FACE),W!==F&&(W===Gp?i.cullFace(i.BACK):W===hy?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ue(i.CULL_FACE),F=W}function We(W){W!==K&&(O&&i.lineWidth(W),K=W)}function Dt(W,ne,re){W?(be(i.POLYGON_OFFSET_FILL),(q!==ne||$!==re)&&(i.polygonOffset(ne,re),q=ne,$=re)):Ue(i.POLYGON_OFFSET_FILL)}function ze(W){W?be(i.SCISSOR_TEST):Ue(i.SCISSOR_TEST)}function L(W){W===void 0&&(W=i.TEXTURE0+D-1),J!==W&&(i.activeTexture(W),J=W)}function M(W,ne,re){re===void 0&&(J===null?re=i.TEXTURE0+D-1:re=J);let de=ee[re];de===void 0&&(de={type:void 0,texture:void 0},ee[re]=de),(de.type!==W||de.texture!==ne)&&(J!==re&&(i.activeTexture(re),J=re),i.bindTexture(W,ne||xe[W]),de.type=W,de.texture=ne)}function Z(){const W=ee[J];W!==void 0&&W.type!==void 0&&(i.bindTexture(W.type,null),W.type=void 0,W.texture=void 0)}function le(){try{i.compressedTexImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ae(){try{i.compressedTexImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function oe(){try{i.texSubImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Qe(){try{i.texSubImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function ve(){try{i.compressedTexSubImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function qe(){try{i.compressedTexSubImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ze(){try{i.texStorage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ee(){try{i.texStorage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function De(){try{i.texImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Oe(){try{i.texImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ge(W){Me.equals(W)===!1&&(i.scissor(W.x,W.y,W.z,W.w),Me.copy(W))}function Te(W){se.equals(W)===!1&&(i.viewport(W.x,W.y,W.z,W.w),se.copy(W))}function nt(W,ne){let re=l.get(ne);re===void 0&&(re=new WeakMap,l.set(ne,re));let de=re.get(W);de===void 0&&(de=i.getUniformBlockIndex(ne,W.name),re.set(W,de))}function Ke(W,ne){const de=l.get(ne).get(W);c.get(ne)!==de&&(i.uniformBlockBinding(ne,de,W.__bindingPointIndex),c.set(ne,de))}function it(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},J=null,ee={},u={},d=new WeakMap,f=[],p=null,m=!1,g=null,A=null,_=null,x=null,E=null,S=null,w=null,I=new Fe(0,0,0),T=0,C=!1,v=null,F=null,K=null,q=null,$=null,Me.set(0,0,i.canvas.width,i.canvas.height),se.set(0,0,i.canvas.width,i.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:be,disable:Ue,bindFramebuffer:et,drawBuffers:He,useProgram:Mt,setBlending:H,setMaterial:wn,setFlipSided:pt,setCullFace:mt,setLineWidth:We,setPolygonOffset:Dt,setScissorTest:ze,activeTexture:L,bindTexture:M,unbindTexture:Z,compressedTexImage2D:le,compressedTexImage3D:Ae,texImage2D:De,texImage3D:Oe,updateUBOMapping:nt,uniformBlockBinding:Ke,texStorage2D:Ze,texStorage3D:Ee,texSubImage2D:oe,texSubImage3D:Qe,compressedTexSubImage2D:ve,compressedTexSubImage3D:qe,scissor:Ge,viewport:Te,reset:it}}function qS(i,e,t,n,s,r,a){const 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 Je,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(L,M){return f?new OffscreenCanvas(L,M):go("canvas")}function m(L,M,Z){let le=1;const Ae=ze(L);if((Ae.width>Z||Ae.height>Z)&&(le=Z/Math.max(Ae.width,Ae.height)),le<1)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap||typeof VideoFrame<"u"&&L instanceof VideoFrame){const oe=Math.floor(le*Ae.width),Qe=Math.floor(le*Ae.height);u===void 0&&(u=p(oe,Qe));const ve=M?p(oe,Qe):u;return ve.width=oe,ve.height=Qe,ve.getContext("2d").drawImage(L,0,0,oe,Qe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+oe+"x"+Qe+")."),ve}else return"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),L;return L}function g(L){return L.generateMipmaps}function A(L){i.generateMipmap(L)}function _(L){return L.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:L.isWebGL3DRenderTarget?i.TEXTURE_3D:L.isWebGLArrayRenderTarget||L.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function x(L,M,Z,le,Ae=!1){if(L!==null){if(i[L]!==void 0)return i[L];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let oe=M;if(M===i.RED&&(Z===i.FLOAT&&(oe=i.R32F),Z===i.HALF_FLOAT&&(oe=i.R16F),Z===i.UNSIGNED_BYTE&&(oe=i.R8)),M===i.RED_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.R8UI),Z===i.UNSIGNED_SHORT&&(oe=i.R16UI),Z===i.UNSIGNED_INT&&(oe=i.R32UI),Z===i.BYTE&&(oe=i.R8I),Z===i.SHORT&&(oe=i.R16I),Z===i.INT&&(oe=i.R32I)),M===i.RG&&(Z===i.FLOAT&&(oe=i.RG32F),Z===i.HALF_FLOAT&&(oe=i.RG16F),Z===i.UNSIGNED_BYTE&&(oe=i.RG8)),M===i.RG_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RG8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RG16UI),Z===i.UNSIGNED_INT&&(oe=i.RG32UI),Z===i.BYTE&&(oe=i.RG8I),Z===i.SHORT&&(oe=i.RG16I),Z===i.INT&&(oe=i.RG32I)),M===i.RGB_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RGB8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RGB16UI),Z===i.UNSIGNED_INT&&(oe=i.RGB32UI),Z===i.BYTE&&(oe=i.RGB8I),Z===i.SHORT&&(oe=i.RGB16I),Z===i.INT&&(oe=i.RGB32I)),M===i.RGBA_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RGBA8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RGBA16UI),Z===i.UNSIGNED_INT&&(oe=i.RGBA32UI),Z===i.BYTE&&(oe=i.RGBA8I),Z===i.SHORT&&(oe=i.RGBA16I),Z===i.INT&&(oe=i.RGBA32I)),M===i.RGB&&Z===i.UNSIGNED_INT_5_9_9_9_REV&&(oe=i.RGB9_E5),M===i.RGBA){const Qe=Ae?Qc:tt.getTransfer(le);Z===i.FLOAT&&(oe=i.RGBA32F),Z===i.HALF_FLOAT&&(oe=i.RGBA16F),Z===i.UNSIGNED_BYTE&&(oe=Qe===Rt?i.SRGB8_ALPHA8:i.RGBA8),Z===i.UNSIGNED_SHORT_4_4_4_4&&(oe=i.RGBA4),Z===i.UNSIGNED_SHORT_5_5_5_1&&(oe=i.RGB5_A1)}return(oe===i.R16F||oe===i.R32F||oe===i.RG16F||oe===i.RG32F||oe===i.RGBA16F||oe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),oe}function E(L,M){let Z;return L?M===null||M===rr||M===io?Z=i.DEPTH24_STENCIL8:M===ln?Z=i.DEPTH32F_STENCIL8:M===no&&(Z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===rr||M===io?Z=i.DEPTH_COMPONENT24:M===ln?Z=i.DEPTH_COMPONENT32F:M===no&&(Z=i.DEPTH_COMPONENT16),Z}function S(L,M){return g(L)===!0||L.isFramebufferTexture&&L.minFilter!==Ln&&L.minFilter!==qt?Math.log2(Math.max(M.width,M.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?M.mipmaps.length:1}function w(L){const M=L.target;M.removeEventListener("dispose",w),T(M),M.isVideoTexture&&h.delete(M)}function I(L){const M=L.target;M.removeEventListener("dispose",I),v(M)}function T(L){const M=n.get(L);if(M.__webglInit===void 0)return;const Z=L.source,le=d.get(Z);if(le){const Ae=le[M.__cacheKey];Ae.usedTimes--,Ae.usedTimes===0&&C(L),Object.keys(le).length===0&&d.delete(Z)}n.remove(L)}function C(L){const M=n.get(L);i.deleteTexture(M.__webglTexture);const Z=L.source,le=d.get(Z);delete le[M.__cacheKey],a.memory.textures--}function v(L){const M=n.get(L);if(L.depthTexture&&(L.depthTexture.dispose(),n.remove(L.depthTexture)),L.isWebGLCubeRenderTarget)for(let le=0;le<6;le++){if(Array.isArray(M.__webglFramebuffer[le]))for(let Ae=0;Ae<M.__webglFramebuffer[le].length;Ae++)i.deleteFramebuffer(M.__webglFramebuffer[le][Ae]);else i.deleteFramebuffer(M.__webglFramebuffer[le]);M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer[le])}else{if(Array.isArray(M.__webglFramebuffer))for(let le=0;le<M.__webglFramebuffer.length;le++)i.deleteFramebuffer(M.__webglFramebuffer[le]);else i.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&i.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let le=0;le<M.__webglColorRenderbuffer.length;le++)M.__webglColorRenderbuffer[le]&&i.deleteRenderbuffer(M.__webglColorRenderbuffer[le]);M.__webglDepthRenderbuffer&&i.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const Z=L.textures;for(let le=0,Ae=Z.length;le<Ae;le++){const oe=n.get(Z[le]);oe.__webglTexture&&(i.deleteTexture(oe.__webglTexture),a.memory.textures--),n.remove(Z[le])}n.remove(L)}let F=0;function K(){F=0}function q(){const L=F;return L>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+s.maxTextures),F+=1,L}function $(L){const M=[];return M.push(L.wrapS),M.push(L.wrapT),M.push(L.wrapR||0),M.push(L.magFilter),M.push(L.minFilter),M.push(L.anisotropy),M.push(L.internalFormat),M.push(L.format),M.push(L.type),M.push(L.generateMipmaps),M.push(L.premultiplyAlpha),M.push(L.flipY),M.push(L.unpackAlignment),M.push(L.colorSpace),M.join()}function D(L,M){const Z=n.get(L);if(L.isVideoTexture&&We(L),L.isRenderTargetTexture===!1&&L.version>0&&Z.__version!==L.version){const le=L.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{se(Z,L,M);return}}t.bindTexture(i.TEXTURE_2D,Z.__webglTexture,i.TEXTURE0+M)}function O(L,M){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){se(Z,L,M);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Z.__webglTexture,i.TEXTURE0+M)}function Y(L,M){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){se(Z,L,M);return}t.bindTexture(i.TEXTURE_3D,Z.__webglTexture,i.TEXTURE0+M)}function Q(L,M){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){me(Z,L,M);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture,i.TEXTURE0+M)}const J={[Ss]:i.REPEAT,[Jn]:i.CLAMP_TO_EDGE,[Mc]:i.MIRRORED_REPEAT},ee={[Ln]:i.NEAREST,[Xp]:i.NEAREST_MIPMAP_NEAREST,[to]:i.NEAREST_MIPMAP_LINEAR,[qt]:i.LINEAR,[Bc]:i.LINEAR_MIPMAP_NEAREST,[si]:i.LINEAR_MIPMAP_LINEAR},ae={[Vy]:i.NEVER,[Yy]:i.ALWAYS,[Wy]:i.LESS,[aA]:i.LEQUAL,[qy]:i.EQUAL,[Xy]:i.GEQUAL,[Ky]:i.GREATER,[jy]:i.NOTEQUAL};function _e(L,M){if(M.type===ln&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===qt||M.magFilter===Bc||M.magFilter===to||M.magFilter===si||M.minFilter===qt||M.minFilter===Bc||M.minFilter===to||M.minFilter===si)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(L,i.TEXTURE_WRAP_S,J[M.wrapS]),i.texParameteri(L,i.TEXTURE_WRAP_T,J[M.wrapT]),(L===i.TEXTURE_3D||L===i.TEXTURE_2D_ARRAY)&&i.texParameteri(L,i.TEXTURE_WRAP_R,J[M.wrapR]),i.texParameteri(L,i.TEXTURE_MAG_FILTER,ee[M.magFilter]),i.texParameteri(L,i.TEXTURE_MIN_FILTER,ee[M.minFilter]),M.compareFunction&&(i.texParameteri(L,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(L,i.TEXTURE_COMPARE_FUNC,ae[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===Ln||M.minFilter!==to&&M.minFilter!==si||M.type===ln&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){const Z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(L,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,s.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function Me(L,M){let Z=!1;L.__webglInit===void 0&&(L.__webglInit=!0,M.addEventListener("dispose",w));const le=M.source;let Ae=d.get(le);Ae===void 0&&(Ae={},d.set(le,Ae));const oe=$(M);if(oe!==L.__cacheKey){Ae[oe]===void 0&&(Ae[oe]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Z=!0),Ae[oe].usedTimes++;const Qe=Ae[L.__cacheKey];Qe!==void 0&&(Ae[L.__cacheKey].usedTimes--,Qe.usedTimes===0&&C(M)),L.__cacheKey=oe,L.__webglTexture=Ae[oe].texture}return Z}function se(L,M,Z){let le=i.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(le=i.TEXTURE_2D_ARRAY),M.isData3DTexture&&(le=i.TEXTURE_3D);const Ae=Me(L,M),oe=M.source;t.bindTexture(le,L.__webglTexture,i.TEXTURE0+Z);const Qe=n.get(oe);if(oe.version!==Qe.__version||Ae===!0){t.activeTexture(i.TEXTURE0+Z);const ve=tt.getPrimaries(tt.workingColorSpace),qe=M.colorSpace===gi?null:tt.getPrimaries(M.colorSpace),Ze=M.colorSpace===gi||ve===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ze);let Ee=m(M.image,!1,s.maxTextureSize);Ee=Dt(M,Ee);const De=r.convert(M.format,M.colorSpace),Oe=r.convert(M.type);let Ge=x(M.internalFormat,De,Oe,M.colorSpace,M.isVideoTexture);_e(le,M);let Te;const nt=M.mipmaps,Ke=M.isVideoTexture!==!0,it=Qe.__version===void 0||Ae===!0,W=oe.dataReady,ne=S(M,Ee);if(M.isDepthTexture)Ge=E(M.format===ro,M.type),it&&(Ke?t.texStorage2D(i.TEXTURE_2D,1,Ge,Ee.width,Ee.height):t.texImage2D(i.TEXTURE_2D,0,Ge,Ee.width,Ee.height,0,De,Oe,null));else if(M.isDataTexture)if(nt.length>0){Ke&&it&&t.texStorage2D(i.TEXTURE_2D,ne,Ge,nt[0].width,nt[0].height);for(let re=0,de=nt.length;re<de;re++)Te=nt[re],Ke?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,De,Oe,Te.data):t.texImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,De,Oe,Te.data);M.generateMipmaps=!1}else Ke?(it&&t.texStorage2D(i.TEXTURE_2D,ne,Ge,Ee.width,Ee.height),W&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Ee.width,Ee.height,De,Oe,Ee.data)):t.texImage2D(i.TEXTURE_2D,0,Ge,Ee.width,Ee.height,0,De,Oe,Ee.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){Ke&&it&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Ge,nt[0].width,nt[0].height,Ee.depth);for(let re=0,de=nt.length;re<de;re++)if(Te=nt[re],M.format!==hn)if(De!==null)if(Ke){if(W)if(M.layerUpdates.size>0){const Se=yg(Te.width,Te.height,M.format,M.type);for(const Ie of M.layerUpdates){const st=Te.data.subarray(Ie*Se/Te.data.BYTES_PER_ELEMENT,(Ie+1)*Se/Te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,Ie,Te.width,Te.height,1,De,st)}M.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,Te.width,Te.height,Ee.depth,De,Te.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,re,Ge,Te.width,Te.height,Ee.depth,0,Te.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ke?W&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,Te.width,Te.height,Ee.depth,De,Oe,Te.data):t.texImage3D(i.TEXTURE_2D_ARRAY,re,Ge,Te.width,Te.height,Ee.depth,0,De,Oe,Te.data)}else{Ke&&it&&t.texStorage2D(i.TEXTURE_2D,ne,Ge,nt[0].width,nt[0].height);for(let re=0,de=nt.length;re<de;re++)Te=nt[re],M.format!==hn?De!==null?Ke?W&&t.compressedTexSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,De,Te.data):t.compressedTexImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ke?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,De,Oe,Te.data):t.texImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,De,Oe,Te.data)}else if(M.isDataArrayTexture)if(Ke){if(it&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Ge,Ee.width,Ee.height,Ee.depth),W)if(M.layerUpdates.size>0){const re=yg(Ee.width,Ee.height,M.format,M.type);for(const de of M.layerUpdates){const Se=Ee.data.subarray(de*re/Ee.data.BYTES_PER_ELEMENT,(de+1)*re/Ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,de,Ee.width,Ee.height,1,De,Oe,Se)}M.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ee.width,Ee.height,Ee.depth,De,Oe,Ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ge,Ee.width,Ee.height,Ee.depth,0,De,Oe,Ee.data);else if(M.isData3DTexture)Ke?(it&&t.texStorage3D(i.TEXTURE_3D,ne,Ge,Ee.width,Ee.height,Ee.depth),W&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ee.width,Ee.height,Ee.depth,De,Oe,Ee.data)):t.texImage3D(i.TEXTURE_3D,0,Ge,Ee.width,Ee.height,Ee.depth,0,De,Oe,Ee.data);else if(M.isFramebufferTexture){if(it)if(Ke)t.texStorage2D(i.TEXTURE_2D,ne,Ge,Ee.width,Ee.height);else{let re=Ee.width,de=Ee.height;for(let Se=0;Se<ne;Se++)t.texImage2D(i.TEXTURE_2D,Se,Ge,re,de,0,De,Oe,null),re>>=1,de>>=1}}else if(nt.length>0){if(Ke&&it){const re=ze(nt[0]);t.texStorage2D(i.TEXTURE_2D,ne,Ge,re.width,re.height)}for(let re=0,de=nt.length;re<de;re++)Te=nt[re],Ke?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,De,Oe,Te):t.texImage2D(i.TEXTURE_2D,re,Ge,De,Oe,Te);M.generateMipmaps=!1}else if(Ke){if(it){const re=ze(Ee);t.texStorage2D(i.TEXTURE_2D,ne,Ge,re.width,re.height)}W&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,De,Oe,Ee)}else t.texImage2D(i.TEXTURE_2D,0,Ge,De,Oe,Ee);g(M)&&A(le),Qe.__version=oe.version,M.onUpdate&&M.onUpdate(M)}L.__version=M.version}function me(L,M,Z){if(M.image.length!==6)return;const le=Me(L,M),Ae=M.source;t.bindTexture(i.TEXTURE_CUBE_MAP,L.__webglTexture,i.TEXTURE0+Z);const oe=n.get(Ae);if(Ae.version!==oe.__version||le===!0){t.activeTexture(i.TEXTURE0+Z);const Qe=tt.getPrimaries(tt.workingColorSpace),ve=M.colorSpace===gi?null:tt.getPrimaries(M.colorSpace),qe=M.colorSpace===gi||Qe===ve?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe);const Ze=M.isCompressedTexture||M.image[0].isCompressedTexture,Ee=M.image[0]&&M.image[0].isDataTexture,De=[];for(let de=0;de<6;de++)!Ze&&!Ee?De[de]=m(M.image[de],!0,s.maxCubemapSize):De[de]=Ee?M.image[de].image:M.image[de],De[de]=Dt(M,De[de]);const Oe=De[0],Ge=r.convert(M.format,M.colorSpace),Te=r.convert(M.type),nt=x(M.internalFormat,Ge,Te,M.colorSpace),Ke=M.isVideoTexture!==!0,it=oe.__version===void 0||le===!0,W=Ae.dataReady;let ne=S(M,Oe);_e(i.TEXTURE_CUBE_MAP,M);let re;if(Ze){Ke&&it&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,nt,Oe.width,Oe.height);for(let de=0;de<6;de++){re=De[de].mipmaps;for(let Se=0;Se<re.length;Se++){const Ie=re[Se];M.format!==hn?Ge!==null?Ke?W&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,0,0,Ie.width,Ie.height,Ge,Ie.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,nt,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,0,0,Ie.width,Ie.height,Ge,Te,Ie.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,nt,Ie.width,Ie.height,0,Ge,Te,Ie.data)}}}else{if(re=M.mipmaps,Ke&&it){re.length>0&&ne++;const de=ze(De[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,nt,de.width,de.height)}for(let de=0;de<6;de++)if(Ee){Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,De[de].width,De[de].height,Ge,Te,De[de].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,nt,De[de].width,De[de].height,0,Ge,Te,De[de].data);for(let Se=0;Se<re.length;Se++){const st=re[Se].image[de].image;Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,0,0,st.width,st.height,Ge,Te,st.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,nt,st.width,st.height,0,Ge,Te,st.data)}}else{Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ge,Te,De[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,nt,Ge,Te,De[de]);for(let Se=0;Se<re.length;Se++){const Ie=re[Se];Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,0,0,Ge,Te,Ie.image[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,nt,Ge,Te,Ie.image[de])}}}g(M)&&A(i.TEXTURE_CUBE_MAP),oe.__version=Ae.version,M.onUpdate&&M.onUpdate(M)}L.__version=M.version}function xe(L,M,Z,le,Ae,oe){const Qe=r.convert(Z.format,Z.colorSpace),ve=r.convert(Z.type),qe=x(Z.internalFormat,Qe,ve,Z.colorSpace),Ze=n.get(M),Ee=n.get(Z);if(Ee.__renderTarget=M,!Ze.__hasExternalTextures){const De=Math.max(1,M.width>>oe),Oe=Math.max(1,M.height>>oe);Ae===i.TEXTURE_3D||Ae===i.TEXTURE_2D_ARRAY?t.texImage3D(Ae,oe,qe,De,Oe,M.depth,0,Qe,ve,null):t.texImage2D(Ae,oe,qe,De,Oe,0,Qe,ve,null)}t.bindFramebuffer(i.FRAMEBUFFER,L),mt(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,le,Ae,Ee.__webglTexture,0,pt(M)):(Ae===i.TEXTURE_2D||Ae>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ae<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,le,Ae,Ee.__webglTexture,oe),t.bindFramebuffer(i.FRAMEBUFFER,null)}function be(L,M,Z){if(i.bindRenderbuffer(i.RENDERBUFFER,L),M.depthBuffer){const le=M.depthTexture,Ae=le&&le.isDepthTexture?le.type:null,oe=E(M.stencilBuffer,Ae),Qe=M.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ve=pt(M);mt(M)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ve,oe,M.width,M.height):Z?i.renderbufferStorageMultisample(i.RENDERBUFFER,ve,oe,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,oe,M.width,M.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Qe,i.RENDERBUFFER,L)}else{const le=M.textures;for(let Ae=0;Ae<le.length;Ae++){const oe=le[Ae],Qe=r.convert(oe.format,oe.colorSpace),ve=r.convert(oe.type),qe=x(oe.internalFormat,Qe,ve,oe.colorSpace),Ze=pt(M);Z&&mt(M)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ze,qe,M.width,M.height):mt(M)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ze,qe,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,qe,M.width,M.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ue(L,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,L),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const le=n.get(M.depthTexture);le.__renderTarget=M,(!le.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),D(M.depthTexture,0);const Ae=le.__webglTexture,oe=pt(M);if(M.depthTexture.format===so)mt(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Ae,0,oe):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Ae,0);else if(M.depthTexture.format===ro)mt(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Ae,0,oe):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Ae,0);else throw new Error("Unknown depthTexture format")}function et(L){const M=n.get(L),Z=L.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==L.depthTexture){const le=L.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),le){const Ae=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,le.removeEventListener("dispose",Ae)};le.addEventListener("dispose",Ae),M.__depthDisposeCallback=Ae}M.__boundDepthTexture=le}if(L.depthTexture&&!M.__autoAllocateDepthBuffer){if(Z)throw new Error("target.depthTexture not supported in Cube render targets");const le=L.texture.mipmaps;le&&le.length>0?Ue(M.__webglFramebuffer[0],L):Ue(M.__webglFramebuffer,L)}else if(Z){M.__webglDepthbuffer=[];for(let le=0;le<6;le++)if(t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[le]),M.__webglDepthbuffer[le]===void 0)M.__webglDepthbuffer[le]=i.createRenderbuffer(),be(M.__webglDepthbuffer[le],L,!1);else{const Ae=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=M.__webglDepthbuffer[le];i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ae,i.RENDERBUFFER,oe)}}else{const le=L.texture.mipmaps;if(le&&le.length>0?t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=i.createRenderbuffer(),be(M.__webglDepthbuffer,L,!1);else{const Ae=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=M.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ae,i.RENDERBUFFER,oe)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function He(L,M,Z){const le=n.get(L);M!==void 0&&xe(le.__webglFramebuffer,L,L.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Z!==void 0&&et(L)}function Mt(L){const M=L.texture,Z=n.get(L),le=n.get(M);L.addEventListener("dispose",I);const Ae=L.textures,oe=L.isWebGLCubeRenderTarget===!0,Qe=Ae.length>1;if(Qe||(le.__webglTexture===void 0&&(le.__webglTexture=i.createTexture()),le.__version=M.version,a.memory.textures++),oe){Z.__webglFramebuffer=[];for(let ve=0;ve<6;ve++)if(M.mipmaps&&M.mipmaps.length>0){Z.__webglFramebuffer[ve]=[];for(let qe=0;qe<M.mipmaps.length;qe++)Z.__webglFramebuffer[ve][qe]=i.createFramebuffer()}else Z.__webglFramebuffer[ve]=i.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){Z.__webglFramebuffer=[];for(let ve=0;ve<M.mipmaps.length;ve++)Z.__webglFramebuffer[ve]=i.createFramebuffer()}else Z.__webglFramebuffer=i.createFramebuffer();if(Qe)for(let ve=0,qe=Ae.length;ve<qe;ve++){const Ze=n.get(Ae[ve]);Ze.__webglTexture===void 0&&(Ze.__webglTexture=i.createTexture(),a.memory.textures++)}if(L.samples>0&&mt(L)===!1){Z.__webglMultisampledFramebuffer=i.createFramebuffer(),Z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let ve=0;ve<Ae.length;ve++){const qe=Ae[ve];Z.__webglColorRenderbuffer[ve]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Z.__webglColorRenderbuffer[ve]);const Ze=r.convert(qe.format,qe.colorSpace),Ee=r.convert(qe.type),De=x(qe.internalFormat,Ze,Ee,qe.colorSpace,L.isXRRenderTarget===!0),Oe=pt(L);i.renderbufferStorageMultisample(i.RENDERBUFFER,Oe,De,L.width,L.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ve,i.RENDERBUFFER,Z.__webglColorRenderbuffer[ve])}i.bindRenderbuffer(i.RENDERBUFFER,null),L.depthBuffer&&(Z.__webglDepthRenderbuffer=i.createRenderbuffer(),be(Z.__webglDepthRenderbuffer,L,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(oe){t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture),_e(i.TEXTURE_CUBE_MAP,M);for(let ve=0;ve<6;ve++)if(M.mipmaps&&M.mipmaps.length>0)for(let qe=0;qe<M.mipmaps.length;qe++)xe(Z.__webglFramebuffer[ve][qe],L,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,qe);else xe(Z.__webglFramebuffer[ve],L,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0);g(M)&&A(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Qe){for(let ve=0,qe=Ae.length;ve<qe;ve++){const Ze=Ae[ve],Ee=n.get(Ze);t.bindTexture(i.TEXTURE_2D,Ee.__webglTexture),_e(i.TEXTURE_2D,Ze),xe(Z.__webglFramebuffer,L,Ze,i.COLOR_ATTACHMENT0+ve,i.TEXTURE_2D,0),g(Ze)&&A(i.TEXTURE_2D)}t.unbindTexture()}else{let ve=i.TEXTURE_2D;if((L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(ve=L.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ve,le.__webglTexture),_e(ve,M),M.mipmaps&&M.mipmaps.length>0)for(let qe=0;qe<M.mipmaps.length;qe++)xe(Z.__webglFramebuffer[qe],L,M,i.COLOR_ATTACHMENT0,ve,qe);else xe(Z.__webglFramebuffer,L,M,i.COLOR_ATTACHMENT0,ve,0);g(M)&&A(ve),t.unbindTexture()}L.depthBuffer&&et(L)}function ft(L){const M=L.textures;for(let Z=0,le=M.length;Z<le;Z++){const Ae=M[Z];if(g(Ae)){const oe=_(L),Qe=n.get(Ae).__webglTexture;t.bindTexture(oe,Qe),A(oe),t.unbindTexture()}}}const $e=[],H=[];function wn(L){if(L.samples>0){if(mt(L)===!1){const M=L.textures,Z=L.width,le=L.height;let Ae=i.COLOR_BUFFER_BIT;const oe=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Qe=n.get(L),ve=M.length>1;if(ve)for(let Ze=0;Ze<M.length;Ze++)t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Qe.__webglMultisampledFramebuffer);const qe=L.texture.mipmaps;qe&&qe.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Qe.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Qe.__webglFramebuffer);for(let Ze=0;Ze<M.length;Ze++){if(L.resolveDepthBuffer&&(L.depthBuffer&&(Ae|=i.DEPTH_BUFFER_BIT),L.stencilBuffer&&L.resolveStencilBuffer&&(Ae|=i.STENCIL_BUFFER_BIT)),ve){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Qe.__webglColorRenderbuffer[Ze]);const Ee=n.get(M[Ze]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Ee,0)}i.blitFramebuffer(0,0,Z,le,0,0,Z,le,Ae,i.NEAREST),c===!0&&($e.length=0,H.length=0,$e.push(i.COLOR_ATTACHMENT0+Ze),L.depthBuffer&&L.resolveDepthBuffer===!1&&($e.push(oe),H.push(oe),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,H)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,$e))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ve)for(let Ze=0;Ze<M.length;Ze++){t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.RENDERBUFFER,Qe.__webglColorRenderbuffer[Ze]);const Ee=n.get(M[Ze]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.TEXTURE_2D,Ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Qe.__webglMultisampledFramebuffer)}else if(L.depthBuffer&&L.resolveDepthBuffer===!1&&c){const M=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[M])}}}function pt(L){return Math.min(s.maxSamples,L.samples)}function mt(L){const M=n.get(L);return L.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function We(L){const M=a.render.frame;h.get(L)!==M&&(h.set(L,M),L.update())}function Dt(L,M){const Z=L.colorSpace,le=L.format,Ae=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||Z!==un&&Z!==gi&&(tt.getTransfer(Z)===Rt?(le!==hn||Ae!==cn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Z)),M}function ze(L){return typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement?(l.width=L.naturalWidth||L.width,l.height=L.naturalHeight||L.height):typeof VideoFrame<"u"&&L instanceof VideoFrame?(l.width=L.displayWidth,l.height=L.displayHeight):(l.width=L.width,l.height=L.height),l}this.allocateTextureUnit=q,this.resetTextureUnits=K,this.setTexture2D=D,this.setTexture2DArray=O,this.setTexture3D=Y,this.setTextureCube=Q,this.rebindTextures=He,this.setupRenderTarget=Mt,this.updateRenderTargetMipmap=ft,this.updateMultisampleRenderTarget=wn,this.setupDepthRenderbuffer=et,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=mt}function KS(i,e){function t(n,s=gi){let r;const a=tt.getTransfer(s);if(n===cn)return i.UNSIGNED_BYTE;if(n===eu)return i.UNSIGNED_SHORT_4_4_4_4;if(n===tu)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Zp)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Yp)return i.BYTE;if(n===Jp)return i.SHORT;if(n===no)return i.UNSIGNED_SHORT;if(n===$h)return i.INT;if(n===rr)return i.UNSIGNED_INT;if(n===ln)return i.FLOAT;if(n===Pn)return i.HALF_FLOAT;if(n===$p)return i.ALPHA;if(n===eA)return i.RGB;if(n===hn)return i.RGBA;if(n===so)return i.DEPTH_COMPONENT;if(n===ro)return i.DEPTH_STENCIL;if(n===ji)return i.RED;if(n===nu)return i.RED_INTEGER;if(n===ar)return i.RG;if(n===iu)return i.RG_INTEGER;if(n===su)return i.RGBA_INTEGER;if(n===Tc||n===ao||n===Rc||n===oo)if(a===Rt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Tc)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ao)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Rc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===oo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Tc)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ao)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Rc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===oo)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Fc||n===ru||n===Nc||n===au)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Fc)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ru)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Nc)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===au)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Dc||n===Lc||n===Pc)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Dc||n===Lc)return a===Rt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Pc)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===co||n===ou||n===cu||n===lu||n===lo||n===hu||n===uu||n===du||n===fu||n===pu||n===Au||n===gu||n===mu||n===xu)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===co)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ou)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===cu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===lu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===lo)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===hu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===uu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===du)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===fu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===pu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Au)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===gu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===mu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===xu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===ho||n===bu||n===kc)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===ho)return a===Rt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===bu)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===kc)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===tA||n===Eu||n===yu||n===_u)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===ho)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Eu)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===yu)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===_u)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===io?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const jS=`
+}`;function VS(i,e,t){let n=new sd;const s=new Je,r=new Je,a=new gt,o=new Ew({depthPacking:zy}),c=new yw,l={},h=t.maxTextureSize,u={[ji]:Ln,[Ln]:ji,[Pi]:Pi},d=new Ls({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Je},radius:{value:4}},vertexShader:HS,fragmentShader:zS}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new Mn;p.setAttribute("position",new Sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Zt(p,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zp;let A=this.type;this.render=function(w,I,T){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;const C=i.getRenderTarget(),v=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),K=i.state;K.setBlending(Cs),K.buffers.color.setClear(1,1,1,1),K.buffers.depth.setTest(!0),K.setScissorTest(!1);const q=A!==Ki&&this.type===Ki,$=A===Ki&&this.type!==Ki;for(let D=0,O=w.length;D<O;D++){const Y=w[D],Q=Y.shadow;if(Q===void 0){console.warn("THREE.WebGLShadowMap:",Y,"has no shadow.");continue}if(Q.autoUpdate===!1&&Q.needsUpdate===!1)continue;s.copy(Q.mapSize);const J=Q.getFrameExtents();if(s.multiply(J),r.copy(Q.mapSize),(s.x>h||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/J.x),s.x=r.x*J.x,Q.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/J.y),s.y=r.y*J.y,Q.mapSize.y=r.y)),Q.map===null||q===!0||$===!0){const ae=this.type!==Ki?{minFilter:Pn,magFilter:Pn}:{};Q.map!==null&&Q.map.dispose(),Q.map=new or(s.x,s.y,ae),Q.map.texture.name=Y.name+".shadowMap",Q.camera.updateProjectionMatrix()}i.setRenderTarget(Q.map),i.clear();const ee=Q.getViewportCount();for(let ae=0;ae<ee;ae++){const _e=Q.getViewport(ae);a.set(r.x*_e.x,r.y*_e.y,r.x*_e.z,r.y*_e.w),K.viewport(a),Q.updateMatrices(Y,ae),n=Q.getFrustum(),E(I,T,Q.camera,Y,this.type)}Q.isPointLightShadow!==!0&&this.type===Ki&&_(Q,T),Q.needsUpdate=!1}A=this.type,g.needsUpdate=!1,i.setRenderTarget(C,v,F)};function _(w,I){const T=e.update(m);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,f.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new or(s.x,s.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(I,null,T,d,m,null),f.uniforms.shadow_pass.value=w.mapPass.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(I,null,T,f,m,null)}function x(w,I,T,C){let v=null;const F=T.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(F!==void 0)v=F;else if(v=T.isPointLight===!0?c:o,i.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const K=v.uuid,q=I.uuid;let $=l[K];$===void 0&&($={},l[K]=$);let D=$[q];D===void 0&&(D=v.clone(),$[q]=D,I.addEventListener("dispose",S)),v=D}if(v.visible=I.visible,v.wireframe=I.wireframe,C===Ki?v.side=I.shadowSide!==null?I.shadowSide:I.side:v.side=I.shadowSide!==null?I.shadowSide:u[I.side],v.alphaMap=I.alphaMap,v.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,v.map=I.map,v.clipShadows=I.clipShadows,v.clippingPlanes=I.clippingPlanes,v.clipIntersection=I.clipIntersection,v.displacementMap=I.displacementMap,v.displacementScale=I.displacementScale,v.displacementBias=I.displacementBias,v.wireframeLinewidth=I.wireframeLinewidth,v.linewidth=I.linewidth,T.isPointLight===!0&&v.isMeshDistanceMaterial===!0){const K=i.properties.get(v);K.light=T}return v}function E(w,I,T,C,v){if(w.visible===!1)return;if(w.layers.test(I.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&v===Ki)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,w.matrixWorld);const q=e.update(w),$=w.material;if(Array.isArray($)){const D=q.groups;for(let O=0,Y=D.length;O<Y;O++){const Q=D[O],J=$[Q.materialIndex];if(J&&J.visible){const ee=x(w,J,C,v);w.onBeforeShadow(i,w,I,T,q,ee,Q),i.renderBufferDirect(T,null,q,ee,w,Q),w.onAfterShadow(i,w,I,T,q,ee,Q)}}}else if($.visible){const D=x(w,$,C,v);w.onBeforeShadow(i,w,I,T,q,D,null),i.renderBufferDirect(T,null,q,D,w,null),w.onAfterShadow(i,w,I,T,q,D,null)}}const K=w.children;for(let q=0,$=K.length;q<$;q++)E(K[q],I,T,C,v)}function S(w){w.target.removeEventListener("dispose",S);for(const T in l){const C=l[T],v=w.target.uuid;v in C&&(C[v].dispose(),delete C[v])}}}const WS={[qh]:Kh,[jh]:Jh,[Xh]:Zh,[Xr]:Yh,[Kh]:qh,[Jh]:jh,[Zh]:Xh,[Yh]:Xr};function qS(i,e){function t(){let W=!1;const ne=new gt;let re=null;const de=new gt(0,0,0,0);return{setMask:function(Se){re!==Se&&!W&&(i.colorMask(Se,Se,Se,Se),re=Se)},setLocked:function(Se){W=Se},setClear:function(Se,Ie,st,Ht,vn){vn===!0&&(Se*=Ht,Ie*=Ht,st*=Ht),ne.set(Se,Ie,st,Ht),de.equals(ne)===!1&&(i.clearColor(Se,Ie,st,Ht),de.copy(ne))},reset:function(){W=!1,re=null,de.set(-1,0,0,0)}}}function n(){let W=!1,ne=!1,re=null,de=null,Se=null;return{setReversed:function(Ie){if(ne!==Ie){const st=e.get("EXT_clip_control");Ie?st.clipControlEXT(st.LOWER_LEFT_EXT,st.ZERO_TO_ONE_EXT):st.clipControlEXT(st.LOWER_LEFT_EXT,st.NEGATIVE_ONE_TO_ONE_EXT),ne=Ie;const Ht=Se;Se=null,this.setClear(Ht)}},getReversed:function(){return ne},setTest:function(Ie){Ie?be(i.DEPTH_TEST):Ue(i.DEPTH_TEST)},setMask:function(Ie){re!==Ie&&!W&&(i.depthMask(Ie),re=Ie)},setFunc:function(Ie){if(ne&&(Ie=WS[Ie]),de!==Ie){switch(Ie){case qh:i.depthFunc(i.NEVER);break;case Kh:i.depthFunc(i.ALWAYS);break;case jh:i.depthFunc(i.LESS);break;case Xr:i.depthFunc(i.LEQUAL);break;case Xh:i.depthFunc(i.EQUAL);break;case Yh:i.depthFunc(i.GEQUAL);break;case Jh:i.depthFunc(i.GREATER);break;case Zh:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}de=Ie}},setLocked:function(Ie){W=Ie},setClear:function(Ie){Se!==Ie&&(ne&&(Ie=1-Ie),i.clearDepth(Ie),Se=Ie)},reset:function(){W=!1,re=null,de=null,Se=null,ne=!1}}}function s(){let W=!1,ne=null,re=null,de=null,Se=null,Ie=null,st=null,Ht=null,vn=null;return{setTest:function(Ct){W||(Ct?be(i.STENCIL_TEST):Ue(i.STENCIL_TEST))},setMask:function(Ct){ne!==Ct&&!W&&(i.stencilMask(Ct),ne=Ct)},setFunc:function(Ct,si,Li){(re!==Ct||de!==si||Se!==Li)&&(i.stencilFunc(Ct,si,Li),re=Ct,de=si,Se=Li)},setOp:function(Ct,si,Li){(Ie!==Ct||st!==si||Ht!==Li)&&(i.stencilOp(Ct,si,Li),Ie=Ct,st=si,Ht=Li)},setLocked:function(Ct){W=Ct},setClear:function(Ct){vn!==Ct&&(i.clearStencil(Ct),vn=Ct)},reset:function(){W=!1,ne=null,re=null,de=null,Se=null,Ie=null,st=null,Ht=null,vn=null}}}const r=new t,a=new n,o=new s,c=new WeakMap,l=new WeakMap;let h={},u={},d=new WeakMap,f=[],p=null,m=!1,g=null,A=null,_=null,x=null,E=null,S=null,w=null,I=new Fe(0,0,0),T=0,C=!1,v=null,F=null,K=null,q=null,$=null;const D=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let O=!1,Y=0;const Q=i.getParameter(i.VERSION);Q.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(Q)[1]),O=Y>=1):Q.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),O=Y>=2);let J=null,ee={};const ae=i.getParameter(i.SCISSOR_BOX),_e=i.getParameter(i.VIEWPORT),Me=new gt().fromArray(ae),se=new gt().fromArray(_e);function me(W,ne,re,de){const Se=new Uint8Array(4),Ie=i.createTexture();i.bindTexture(W,Ie),i.texParameteri(W,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(W,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let st=0;st<re;st++)W===i.TEXTURE_3D||W===i.TEXTURE_2D_ARRAY?i.texImage3D(ne,0,i.RGBA,1,1,de,0,i.RGBA,i.UNSIGNED_BYTE,Se):i.texImage2D(ne+st,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Se);return Ie}const xe={};xe[i.TEXTURE_2D]=me(i.TEXTURE_2D,i.TEXTURE_2D,1),xe[i.TEXTURE_CUBE_MAP]=me(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),xe[i.TEXTURE_2D_ARRAY]=me(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),xe[i.TEXTURE_3D]=me(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),be(i.DEPTH_TEST),a.setFunc(Xr),pt(!1),mt(Hp),be(i.CULL_FACE),H(Cs);function be(W){h[W]!==!0&&(i.enable(W),h[W]=!0)}function Ue(W){h[W]!==!1&&(i.disable(W),h[W]=!1)}function et(W,ne){return u[W]!==ne?(i.bindFramebuffer(W,ne),u[W]=ne,W===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=ne),W===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=ne),!0):!1}function He(W,ne){let re=f,de=!1;if(W){re=d.get(ne),re===void 0&&(re=[],d.set(ne,re));const Se=W.textures;if(re.length!==Se.length||re[0]!==i.COLOR_ATTACHMENT0){for(let Ie=0,st=Se.length;Ie<st;Ie++)re[Ie]=i.COLOR_ATTACHMENT0+Ie;re.length=Se.length,de=!0}}else re[0]!==i.BACK&&(re[0]=i.BACK,de=!0);de&&i.drawBuffers(re)}function Mt(W){return p!==W?(i.useProgram(W),p=W,!0):!1}const ft={[ir]:i.FUNC_ADD,[py]:i.FUNC_SUBTRACT,[Ay]:i.FUNC_REVERSE_SUBTRACT};ft[gy]=i.MIN,ft[my]=i.MAX;const $e={[xy]:i.ZERO,[by]:i.ONE,[Ey]:i.SRC_COLOR,[Vh]:i.SRC_ALPHA,[Iy]:i.SRC_ALPHA_SATURATE,[vy]:i.DST_COLOR,[_y]:i.DST_ALPHA,[yy]:i.ONE_MINUS_SRC_COLOR,[Wh]:i.ONE_MINUS_SRC_ALPHA,[Cy]:i.ONE_MINUS_DST_COLOR,[wy]:i.ONE_MINUS_DST_ALPHA,[Sy]:i.CONSTANT_COLOR,[My]:i.ONE_MINUS_CONSTANT_COLOR,[By]:i.CONSTANT_ALPHA,[Ty]:i.ONE_MINUS_CONSTANT_ALPHA};function H(W,ne,re,de,Se,Ie,st,Ht,vn,Ct){if(W===Cs){m===!0&&(Ue(i.BLEND),m=!1);return}if(m===!1&&(be(i.BLEND),m=!0),W!==fy){if(W!==g||Ct!==C){if((A!==ir||E!==ir)&&(i.blendEquation(i.FUNC_ADD),A=ir,E=ir),Ct)switch(W){case jr:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Vp:i.blendFunc(i.ONE,i.ONE);break;case Wp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case qp:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}else switch(W){case jr:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Vp:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Wp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case qp:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}_=null,x=null,S=null,w=null,I.set(0,0,0),T=0,g=W,C=Ct}return}Se=Se||ne,Ie=Ie||re,st=st||de,(ne!==A||Se!==E)&&(i.blendEquationSeparate(ft[ne],ft[Se]),A=ne,E=Se),(re!==_||de!==x||Ie!==S||st!==w)&&(i.blendFuncSeparate($e[re],$e[de],$e[Ie],$e[st]),_=re,x=de,S=Ie,w=st),(Ht.equals(I)===!1||vn!==T)&&(i.blendColor(Ht.r,Ht.g,Ht.b,vn),I.copy(Ht),T=vn),g=W,C=!1}function wn(W,ne){W.side===Pi?Ue(i.CULL_FACE):be(i.CULL_FACE);let re=W.side===Ln;ne&&(re=!re),pt(re),W.blending===jr&&W.transparent===!1?H(Cs):H(W.blending,W.blendEquation,W.blendSrc,W.blendDst,W.blendEquationAlpha,W.blendSrcAlpha,W.blendDstAlpha,W.blendColor,W.blendAlpha,W.premultipliedAlpha),a.setFunc(W.depthFunc),a.setTest(W.depthTest),a.setMask(W.depthWrite),r.setMask(W.colorWrite);const de=W.stencilWrite;o.setTest(de),de&&(o.setMask(W.stencilWriteMask),o.setFunc(W.stencilFunc,W.stencilRef,W.stencilFuncMask),o.setOp(W.stencilFail,W.stencilZFail,W.stencilZPass)),Dt(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),W.alphaToCoverage===!0?be(i.SAMPLE_ALPHA_TO_COVERAGE):Ue(i.SAMPLE_ALPHA_TO_COVERAGE)}function pt(W){v!==W&&(W?i.frontFace(i.CW):i.frontFace(i.CCW),v=W)}function mt(W){W!==hy?(be(i.CULL_FACE),W!==F&&(W===Hp?i.cullFace(i.BACK):W===uy?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ue(i.CULL_FACE),F=W}function We(W){W!==K&&(O&&i.lineWidth(W),K=W)}function Dt(W,ne,re){W?(be(i.POLYGON_OFFSET_FILL),(q!==ne||$!==re)&&(i.polygonOffset(ne,re),q=ne,$=re)):Ue(i.POLYGON_OFFSET_FILL)}function ze(W){W?be(i.SCISSOR_TEST):Ue(i.SCISSOR_TEST)}function L(W){W===void 0&&(W=i.TEXTURE0+D-1),J!==W&&(i.activeTexture(W),J=W)}function M(W,ne,re){re===void 0&&(J===null?re=i.TEXTURE0+D-1:re=J);let de=ee[re];de===void 0&&(de={type:void 0,texture:void 0},ee[re]=de),(de.type!==W||de.texture!==ne)&&(J!==re&&(i.activeTexture(re),J=re),i.bindTexture(W,ne||xe[W]),de.type=W,de.texture=ne)}function Z(){const W=ee[J];W!==void 0&&W.type!==void 0&&(i.bindTexture(W.type,null),W.type=void 0,W.texture=void 0)}function le(){try{i.compressedTexImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ae(){try{i.compressedTexImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function oe(){try{i.texSubImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Qe(){try{i.texSubImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function ve(){try{i.compressedTexSubImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function qe(){try{i.compressedTexSubImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ze(){try{i.texStorage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ee(){try{i.texStorage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function De(){try{i.texImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Oe(){try{i.texImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ge(W){Me.equals(W)===!1&&(i.scissor(W.x,W.y,W.z,W.w),Me.copy(W))}function Te(W){se.equals(W)===!1&&(i.viewport(W.x,W.y,W.z,W.w),se.copy(W))}function nt(W,ne){let re=l.get(ne);re===void 0&&(re=new WeakMap,l.set(ne,re));let de=re.get(W);de===void 0&&(de=i.getUniformBlockIndex(ne,W.name),re.set(W,de))}function Ke(W,ne){const de=l.get(ne).get(W);c.get(ne)!==de&&(i.uniformBlockBinding(ne,de,W.__bindingPointIndex),c.set(ne,de))}function it(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},J=null,ee={},u={},d=new WeakMap,f=[],p=null,m=!1,g=null,A=null,_=null,x=null,E=null,S=null,w=null,I=new Fe(0,0,0),T=0,C=!1,v=null,F=null,K=null,q=null,$=null,Me.set(0,0,i.canvas.width,i.canvas.height),se.set(0,0,i.canvas.width,i.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:be,disable:Ue,bindFramebuffer:et,drawBuffers:He,useProgram:Mt,setBlending:H,setMaterial:wn,setFlipSided:pt,setCullFace:mt,setLineWidth:We,setPolygonOffset:Dt,setScissorTest:ze,activeTexture:L,bindTexture:M,unbindTexture:Z,compressedTexImage2D:le,compressedTexImage3D:Ae,texImage2D:De,texImage3D:Oe,updateUBOMapping:nt,uniformBlockBinding:Ke,texStorage2D:Ze,texStorage3D:Ee,texSubImage2D:oe,texSubImage3D:Qe,compressedTexSubImage2D:ve,compressedTexSubImage3D:qe,scissor:Ge,viewport:Te,reset:it}}function KS(i,e,t,n,s,r,a){const 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 Je,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(L,M){return f?new OffscreenCanvas(L,M):mo("canvas")}function m(L,M,Z){let le=1;const Ae=ze(L);if((Ae.width>Z||Ae.height>Z)&&(le=Z/Math.max(Ae.width,Ae.height)),le<1)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap||typeof VideoFrame<"u"&&L instanceof VideoFrame){const oe=Math.floor(le*Ae.width),Qe=Math.floor(le*Ae.height);u===void 0&&(u=p(oe,Qe));const ve=M?p(oe,Qe):u;return ve.width=oe,ve.height=Qe,ve.getContext("2d").drawImage(L,0,0,oe,Qe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+oe+"x"+Qe+")."),ve}else return"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),L;return L}function g(L){return L.generateMipmaps}function A(L){i.generateMipmap(L)}function _(L){return L.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:L.isWebGL3DRenderTarget?i.TEXTURE_3D:L.isWebGLArrayRenderTarget||L.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function x(L,M,Z,le,Ae=!1){if(L!==null){if(i[L]!==void 0)return i[L];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let oe=M;if(M===i.RED&&(Z===i.FLOAT&&(oe=i.R32F),Z===i.HALF_FLOAT&&(oe=i.R16F),Z===i.UNSIGNED_BYTE&&(oe=i.R8)),M===i.RED_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.R8UI),Z===i.UNSIGNED_SHORT&&(oe=i.R16UI),Z===i.UNSIGNED_INT&&(oe=i.R32UI),Z===i.BYTE&&(oe=i.R8I),Z===i.SHORT&&(oe=i.R16I),Z===i.INT&&(oe=i.R32I)),M===i.RG&&(Z===i.FLOAT&&(oe=i.RG32F),Z===i.HALF_FLOAT&&(oe=i.RG16F),Z===i.UNSIGNED_BYTE&&(oe=i.RG8)),M===i.RG_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RG8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RG16UI),Z===i.UNSIGNED_INT&&(oe=i.RG32UI),Z===i.BYTE&&(oe=i.RG8I),Z===i.SHORT&&(oe=i.RG16I),Z===i.INT&&(oe=i.RG32I)),M===i.RGB_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RGB8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RGB16UI),Z===i.UNSIGNED_INT&&(oe=i.RGB32UI),Z===i.BYTE&&(oe=i.RGB8I),Z===i.SHORT&&(oe=i.RGB16I),Z===i.INT&&(oe=i.RGB32I)),M===i.RGBA_INTEGER&&(Z===i.UNSIGNED_BYTE&&(oe=i.RGBA8UI),Z===i.UNSIGNED_SHORT&&(oe=i.RGBA16UI),Z===i.UNSIGNED_INT&&(oe=i.RGBA32UI),Z===i.BYTE&&(oe=i.RGBA8I),Z===i.SHORT&&(oe=i.RGBA16I),Z===i.INT&&(oe=i.RGBA32I)),M===i.RGB&&Z===i.UNSIGNED_INT_5_9_9_9_REV&&(oe=i.RGB9_E5),M===i.RGBA){const Qe=Ae?Hc:tt.getTransfer(le);Z===i.FLOAT&&(oe=i.RGBA32F),Z===i.HALF_FLOAT&&(oe=i.RGBA16F),Z===i.UNSIGNED_BYTE&&(oe=Qe===Rt?i.SRGB8_ALPHA8:i.RGBA8),Z===i.UNSIGNED_SHORT_4_4_4_4&&(oe=i.RGBA4),Z===i.UNSIGNED_SHORT_5_5_5_1&&(oe=i.RGB5_A1)}return(oe===i.R16F||oe===i.R32F||oe===i.RG16F||oe===i.RG32F||oe===i.RGBA16F||oe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),oe}function E(L,M){let Z;return L?M===null||M===rr||M===so?Z=i.DEPTH24_STENCIL8:M===ln?Z=i.DEPTH32F_STENCIL8:M===io&&(Z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===rr||M===so?Z=i.DEPTH_COMPONENT24:M===ln?Z=i.DEPTH_COMPONENT32F:M===io&&(Z=i.DEPTH_COMPONENT16),Z}function S(L,M){return g(L)===!0||L.isFramebufferTexture&&L.minFilter!==Pn&&L.minFilter!==qt?Math.log2(Math.max(M.width,M.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?M.mipmaps.length:1}function w(L){const M=L.target;M.removeEventListener("dispose",w),T(M),M.isVideoTexture&&h.delete(M)}function I(L){const M=L.target;M.removeEventListener("dispose",I),v(M)}function T(L){const M=n.get(L);if(M.__webglInit===void 0)return;const Z=L.source,le=d.get(Z);if(le){const Ae=le[M.__cacheKey];Ae.usedTimes--,Ae.usedTimes===0&&C(L),Object.keys(le).length===0&&d.delete(Z)}n.remove(L)}function C(L){const M=n.get(L);i.deleteTexture(M.__webglTexture);const Z=L.source,le=d.get(Z);delete le[M.__cacheKey],a.memory.textures--}function v(L){const M=n.get(L);if(L.depthTexture&&(L.depthTexture.dispose(),n.remove(L.depthTexture)),L.isWebGLCubeRenderTarget)for(let le=0;le<6;le++){if(Array.isArray(M.__webglFramebuffer[le]))for(let Ae=0;Ae<M.__webglFramebuffer[le].length;Ae++)i.deleteFramebuffer(M.__webglFramebuffer[le][Ae]);else i.deleteFramebuffer(M.__webglFramebuffer[le]);M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer[le])}else{if(Array.isArray(M.__webglFramebuffer))for(let le=0;le<M.__webglFramebuffer.length;le++)i.deleteFramebuffer(M.__webglFramebuffer[le]);else i.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&i.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let le=0;le<M.__webglColorRenderbuffer.length;le++)M.__webglColorRenderbuffer[le]&&i.deleteRenderbuffer(M.__webglColorRenderbuffer[le]);M.__webglDepthRenderbuffer&&i.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const Z=L.textures;for(let le=0,Ae=Z.length;le<Ae;le++){const oe=n.get(Z[le]);oe.__webglTexture&&(i.deleteTexture(oe.__webglTexture),a.memory.textures--),n.remove(Z[le])}n.remove(L)}let F=0;function K(){F=0}function q(){const L=F;return L>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+s.maxTextures),F+=1,L}function $(L){const M=[];return M.push(L.wrapS),M.push(L.wrapT),M.push(L.wrapR||0),M.push(L.magFilter),M.push(L.minFilter),M.push(L.anisotropy),M.push(L.internalFormat),M.push(L.format),M.push(L.type),M.push(L.generateMipmaps),M.push(L.premultiplyAlpha),M.push(L.flipY),M.push(L.unpackAlignment),M.push(L.colorSpace),M.join()}function D(L,M){const Z=n.get(L);if(L.isVideoTexture&&We(L),L.isRenderTargetTexture===!1&&L.version>0&&Z.__version!==L.version){const le=L.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{se(Z,L,M);return}}t.bindTexture(i.TEXTURE_2D,Z.__webglTexture,i.TEXTURE0+M)}function O(L,M){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){se(Z,L,M);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Z.__webglTexture,i.TEXTURE0+M)}function Y(L,M){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){se(Z,L,M);return}t.bindTexture(i.TEXTURE_3D,Z.__webglTexture,i.TEXTURE0+M)}function Q(L,M){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){me(Z,L,M);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture,i.TEXTURE0+M)}const J={[Ss]:i.REPEAT,[Zn]:i.CLAMP_TO_EDGE,[Tc]:i.MIRRORED_REPEAT},ee={[Pn]:i.NEAREST,[Yp]:i.NEAREST_MIPMAP_NEAREST,[no]:i.NEAREST_MIPMAP_LINEAR,[qt]:i.LINEAR,[Rc]:i.LINEAR_MIPMAP_NEAREST,[ri]:i.LINEAR_MIPMAP_LINEAR},ae={[Wy]:i.NEVER,[Jy]:i.ALWAYS,[qy]:i.LESS,[oA]:i.LEQUAL,[Ky]:i.EQUAL,[Yy]:i.GEQUAL,[jy]:i.GREATER,[Xy]:i.NOTEQUAL};function _e(L,M){if(M.type===ln&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===qt||M.magFilter===Rc||M.magFilter===no||M.magFilter===ri||M.minFilter===qt||M.minFilter===Rc||M.minFilter===no||M.minFilter===ri)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(L,i.TEXTURE_WRAP_S,J[M.wrapS]),i.texParameteri(L,i.TEXTURE_WRAP_T,J[M.wrapT]),(L===i.TEXTURE_3D||L===i.TEXTURE_2D_ARRAY)&&i.texParameteri(L,i.TEXTURE_WRAP_R,J[M.wrapR]),i.texParameteri(L,i.TEXTURE_MAG_FILTER,ee[M.magFilter]),i.texParameteri(L,i.TEXTURE_MIN_FILTER,ee[M.minFilter]),M.compareFunction&&(i.texParameteri(L,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(L,i.TEXTURE_COMPARE_FUNC,ae[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===Pn||M.minFilter!==no&&M.minFilter!==ri||M.type===ln&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){const Z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(L,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,s.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function Me(L,M){let Z=!1;L.__webglInit===void 0&&(L.__webglInit=!0,M.addEventListener("dispose",w));const le=M.source;let Ae=d.get(le);Ae===void 0&&(Ae={},d.set(le,Ae));const oe=$(M);if(oe!==L.__cacheKey){Ae[oe]===void 0&&(Ae[oe]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Z=!0),Ae[oe].usedTimes++;const Qe=Ae[L.__cacheKey];Qe!==void 0&&(Ae[L.__cacheKey].usedTimes--,Qe.usedTimes===0&&C(M)),L.__cacheKey=oe,L.__webglTexture=Ae[oe].texture}return Z}function se(L,M,Z){let le=i.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(le=i.TEXTURE_2D_ARRAY),M.isData3DTexture&&(le=i.TEXTURE_3D);const Ae=Me(L,M),oe=M.source;t.bindTexture(le,L.__webglTexture,i.TEXTURE0+Z);const Qe=n.get(oe);if(oe.version!==Qe.__version||Ae===!0){t.activeTexture(i.TEXTURE0+Z);const ve=tt.getPrimaries(tt.workingColorSpace),qe=M.colorSpace===mi?null:tt.getPrimaries(M.colorSpace),Ze=M.colorSpace===mi||ve===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ze);let Ee=m(M.image,!1,s.maxTextureSize);Ee=Dt(M,Ee);const De=r.convert(M.format,M.colorSpace),Oe=r.convert(M.type);let Ge=x(M.internalFormat,De,Oe,M.colorSpace,M.isVideoTexture);_e(le,M);let Te;const nt=M.mipmaps,Ke=M.isVideoTexture!==!0,it=Qe.__version===void 0||Ae===!0,W=oe.dataReady,ne=S(M,Ee);if(M.isDepthTexture)Ge=E(M.format===ao,M.type),it&&(Ke?t.texStorage2D(i.TEXTURE_2D,1,Ge,Ee.width,Ee.height):t.texImage2D(i.TEXTURE_2D,0,Ge,Ee.width,Ee.height,0,De,Oe,null));else if(M.isDataTexture)if(nt.length>0){Ke&&it&&t.texStorage2D(i.TEXTURE_2D,ne,Ge,nt[0].width,nt[0].height);for(let re=0,de=nt.length;re<de;re++)Te=nt[re],Ke?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,De,Oe,Te.data):t.texImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,De,Oe,Te.data);M.generateMipmaps=!1}else Ke?(it&&t.texStorage2D(i.TEXTURE_2D,ne,Ge,Ee.width,Ee.height),W&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Ee.width,Ee.height,De,Oe,Ee.data)):t.texImage2D(i.TEXTURE_2D,0,Ge,Ee.width,Ee.height,0,De,Oe,Ee.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){Ke&&it&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Ge,nt[0].width,nt[0].height,Ee.depth);for(let re=0,de=nt.length;re<de;re++)if(Te=nt[re],M.format!==hn)if(De!==null)if(Ke){if(W)if(M.layerUpdates.size>0){const Se=_g(Te.width,Te.height,M.format,M.type);for(const Ie of M.layerUpdates){const st=Te.data.subarray(Ie*Se/Te.data.BYTES_PER_ELEMENT,(Ie+1)*Se/Te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,Ie,Te.width,Te.height,1,De,st)}M.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,Te.width,Te.height,Ee.depth,De,Te.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,re,Ge,Te.width,Te.height,Ee.depth,0,Te.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ke?W&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,Te.width,Te.height,Ee.depth,De,Oe,Te.data):t.texImage3D(i.TEXTURE_2D_ARRAY,re,Ge,Te.width,Te.height,Ee.depth,0,De,Oe,Te.data)}else{Ke&&it&&t.texStorage2D(i.TEXTURE_2D,ne,Ge,nt[0].width,nt[0].height);for(let re=0,de=nt.length;re<de;re++)Te=nt[re],M.format!==hn?De!==null?Ke?W&&t.compressedTexSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,De,Te.data):t.compressedTexImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ke?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,De,Oe,Te.data):t.texImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,De,Oe,Te.data)}else if(M.isDataArrayTexture)if(Ke){if(it&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Ge,Ee.width,Ee.height,Ee.depth),W)if(M.layerUpdates.size>0){const re=_g(Ee.width,Ee.height,M.format,M.type);for(const de of M.layerUpdates){const Se=Ee.data.subarray(de*re/Ee.data.BYTES_PER_ELEMENT,(de+1)*re/Ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,de,Ee.width,Ee.height,1,De,Oe,Se)}M.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ee.width,Ee.height,Ee.depth,De,Oe,Ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ge,Ee.width,Ee.height,Ee.depth,0,De,Oe,Ee.data);else if(M.isData3DTexture)Ke?(it&&t.texStorage3D(i.TEXTURE_3D,ne,Ge,Ee.width,Ee.height,Ee.depth),W&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ee.width,Ee.height,Ee.depth,De,Oe,Ee.data)):t.texImage3D(i.TEXTURE_3D,0,Ge,Ee.width,Ee.height,Ee.depth,0,De,Oe,Ee.data);else if(M.isFramebufferTexture){if(it)if(Ke)t.texStorage2D(i.TEXTURE_2D,ne,Ge,Ee.width,Ee.height);else{let re=Ee.width,de=Ee.height;for(let Se=0;Se<ne;Se++)t.texImage2D(i.TEXTURE_2D,Se,Ge,re,de,0,De,Oe,null),re>>=1,de>>=1}}else if(nt.length>0){if(Ke&&it){const re=ze(nt[0]);t.texStorage2D(i.TEXTURE_2D,ne,Ge,re.width,re.height)}for(let re=0,de=nt.length;re<de;re++)Te=nt[re],Ke?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,De,Oe,Te):t.texImage2D(i.TEXTURE_2D,re,Ge,De,Oe,Te);M.generateMipmaps=!1}else if(Ke){if(it){const re=ze(Ee);t.texStorage2D(i.TEXTURE_2D,ne,Ge,re.width,re.height)}W&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,De,Oe,Ee)}else t.texImage2D(i.TEXTURE_2D,0,Ge,De,Oe,Ee);g(M)&&A(le),Qe.__version=oe.version,M.onUpdate&&M.onUpdate(M)}L.__version=M.version}function me(L,M,Z){if(M.image.length!==6)return;const le=Me(L,M),Ae=M.source;t.bindTexture(i.TEXTURE_CUBE_MAP,L.__webglTexture,i.TEXTURE0+Z);const oe=n.get(Ae);if(Ae.version!==oe.__version||le===!0){t.activeTexture(i.TEXTURE0+Z);const Qe=tt.getPrimaries(tt.workingColorSpace),ve=M.colorSpace===mi?null:tt.getPrimaries(M.colorSpace),qe=M.colorSpace===mi||Qe===ve?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe);const Ze=M.isCompressedTexture||M.image[0].isCompressedTexture,Ee=M.image[0]&&M.image[0].isDataTexture,De=[];for(let de=0;de<6;de++)!Ze&&!Ee?De[de]=m(M.image[de],!0,s.maxCubemapSize):De[de]=Ee?M.image[de].image:M.image[de],De[de]=Dt(M,De[de]);const Oe=De[0],Ge=r.convert(M.format,M.colorSpace),Te=r.convert(M.type),nt=x(M.internalFormat,Ge,Te,M.colorSpace),Ke=M.isVideoTexture!==!0,it=oe.__version===void 0||le===!0,W=Ae.dataReady;let ne=S(M,Oe);_e(i.TEXTURE_CUBE_MAP,M);let re;if(Ze){Ke&&it&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,nt,Oe.width,Oe.height);for(let de=0;de<6;de++){re=De[de].mipmaps;for(let Se=0;Se<re.length;Se++){const Ie=re[Se];M.format!==hn?Ge!==null?Ke?W&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,0,0,Ie.width,Ie.height,Ge,Ie.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,nt,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,0,0,Ie.width,Ie.height,Ge,Te,Ie.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se,nt,Ie.width,Ie.height,0,Ge,Te,Ie.data)}}}else{if(re=M.mipmaps,Ke&&it){re.length>0&&ne++;const de=ze(De[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,nt,de.width,de.height)}for(let de=0;de<6;de++)if(Ee){Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,De[de].width,De[de].height,Ge,Te,De[de].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,nt,De[de].width,De[de].height,0,Ge,Te,De[de].data);for(let Se=0;Se<re.length;Se++){const st=re[Se].image[de].image;Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,0,0,st.width,st.height,Ge,Te,st.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,nt,st.width,st.height,0,Ge,Te,st.data)}}else{Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ge,Te,De[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,nt,Ge,Te,De[de]);for(let Se=0;Se<re.length;Se++){const Ie=re[Se];Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,0,0,Ge,Te,Ie.image[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Se+1,nt,Ge,Te,Ie.image[de])}}}g(M)&&A(i.TEXTURE_CUBE_MAP),oe.__version=Ae.version,M.onUpdate&&M.onUpdate(M)}L.__version=M.version}function xe(L,M,Z,le,Ae,oe){const Qe=r.convert(Z.format,Z.colorSpace),ve=r.convert(Z.type),qe=x(Z.internalFormat,Qe,ve,Z.colorSpace),Ze=n.get(M),Ee=n.get(Z);if(Ee.__renderTarget=M,!Ze.__hasExternalTextures){const De=Math.max(1,M.width>>oe),Oe=Math.max(1,M.height>>oe);Ae===i.TEXTURE_3D||Ae===i.TEXTURE_2D_ARRAY?t.texImage3D(Ae,oe,qe,De,Oe,M.depth,0,Qe,ve,null):t.texImage2D(Ae,oe,qe,De,Oe,0,Qe,ve,null)}t.bindFramebuffer(i.FRAMEBUFFER,L),mt(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,le,Ae,Ee.__webglTexture,0,pt(M)):(Ae===i.TEXTURE_2D||Ae>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ae<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,le,Ae,Ee.__webglTexture,oe),t.bindFramebuffer(i.FRAMEBUFFER,null)}function be(L,M,Z){if(i.bindRenderbuffer(i.RENDERBUFFER,L),M.depthBuffer){const le=M.depthTexture,Ae=le&&le.isDepthTexture?le.type:null,oe=E(M.stencilBuffer,Ae),Qe=M.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ve=pt(M);mt(M)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ve,oe,M.width,M.height):Z?i.renderbufferStorageMultisample(i.RENDERBUFFER,ve,oe,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,oe,M.width,M.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Qe,i.RENDERBUFFER,L)}else{const le=M.textures;for(let Ae=0;Ae<le.length;Ae++){const oe=le[Ae],Qe=r.convert(oe.format,oe.colorSpace),ve=r.convert(oe.type),qe=x(oe.internalFormat,Qe,ve,oe.colorSpace),Ze=pt(M);Z&&mt(M)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ze,qe,M.width,M.height):mt(M)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ze,qe,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,qe,M.width,M.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ue(L,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,L),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const le=n.get(M.depthTexture);le.__renderTarget=M,(!le.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),D(M.depthTexture,0);const Ae=le.__webglTexture,oe=pt(M);if(M.depthTexture.format===ro)mt(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Ae,0,oe):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Ae,0);else if(M.depthTexture.format===ao)mt(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Ae,0,oe):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Ae,0);else throw new Error("Unknown depthTexture format")}function et(L){const M=n.get(L),Z=L.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==L.depthTexture){const le=L.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),le){const Ae=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,le.removeEventListener("dispose",Ae)};le.addEventListener("dispose",Ae),M.__depthDisposeCallback=Ae}M.__boundDepthTexture=le}if(L.depthTexture&&!M.__autoAllocateDepthBuffer){if(Z)throw new Error("target.depthTexture not supported in Cube render targets");const le=L.texture.mipmaps;le&&le.length>0?Ue(M.__webglFramebuffer[0],L):Ue(M.__webglFramebuffer,L)}else if(Z){M.__webglDepthbuffer=[];for(let le=0;le<6;le++)if(t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[le]),M.__webglDepthbuffer[le]===void 0)M.__webglDepthbuffer[le]=i.createRenderbuffer(),be(M.__webglDepthbuffer[le],L,!1);else{const Ae=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=M.__webglDepthbuffer[le];i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ae,i.RENDERBUFFER,oe)}}else{const le=L.texture.mipmaps;if(le&&le.length>0?t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=i.createRenderbuffer(),be(M.__webglDepthbuffer,L,!1);else{const Ae=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=M.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ae,i.RENDERBUFFER,oe)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function He(L,M,Z){const le=n.get(L);M!==void 0&&xe(le.__webglFramebuffer,L,L.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Z!==void 0&&et(L)}function Mt(L){const M=L.texture,Z=n.get(L),le=n.get(M);L.addEventListener("dispose",I);const Ae=L.textures,oe=L.isWebGLCubeRenderTarget===!0,Qe=Ae.length>1;if(Qe||(le.__webglTexture===void 0&&(le.__webglTexture=i.createTexture()),le.__version=M.version,a.memory.textures++),oe){Z.__webglFramebuffer=[];for(let ve=0;ve<6;ve++)if(M.mipmaps&&M.mipmaps.length>0){Z.__webglFramebuffer[ve]=[];for(let qe=0;qe<M.mipmaps.length;qe++)Z.__webglFramebuffer[ve][qe]=i.createFramebuffer()}else Z.__webglFramebuffer[ve]=i.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){Z.__webglFramebuffer=[];for(let ve=0;ve<M.mipmaps.length;ve++)Z.__webglFramebuffer[ve]=i.createFramebuffer()}else Z.__webglFramebuffer=i.createFramebuffer();if(Qe)for(let ve=0,qe=Ae.length;ve<qe;ve++){const Ze=n.get(Ae[ve]);Ze.__webglTexture===void 0&&(Ze.__webglTexture=i.createTexture(),a.memory.textures++)}if(L.samples>0&&mt(L)===!1){Z.__webglMultisampledFramebuffer=i.createFramebuffer(),Z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let ve=0;ve<Ae.length;ve++){const qe=Ae[ve];Z.__webglColorRenderbuffer[ve]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Z.__webglColorRenderbuffer[ve]);const Ze=r.convert(qe.format,qe.colorSpace),Ee=r.convert(qe.type),De=x(qe.internalFormat,Ze,Ee,qe.colorSpace,L.isXRRenderTarget===!0),Oe=pt(L);i.renderbufferStorageMultisample(i.RENDERBUFFER,Oe,De,L.width,L.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ve,i.RENDERBUFFER,Z.__webglColorRenderbuffer[ve])}i.bindRenderbuffer(i.RENDERBUFFER,null),L.depthBuffer&&(Z.__webglDepthRenderbuffer=i.createRenderbuffer(),be(Z.__webglDepthRenderbuffer,L,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(oe){t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture),_e(i.TEXTURE_CUBE_MAP,M);for(let ve=0;ve<6;ve++)if(M.mipmaps&&M.mipmaps.length>0)for(let qe=0;qe<M.mipmaps.length;qe++)xe(Z.__webglFramebuffer[ve][qe],L,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,qe);else xe(Z.__webglFramebuffer[ve],L,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0);g(M)&&A(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Qe){for(let ve=0,qe=Ae.length;ve<qe;ve++){const Ze=Ae[ve],Ee=n.get(Ze);t.bindTexture(i.TEXTURE_2D,Ee.__webglTexture),_e(i.TEXTURE_2D,Ze),xe(Z.__webglFramebuffer,L,Ze,i.COLOR_ATTACHMENT0+ve,i.TEXTURE_2D,0),g(Ze)&&A(i.TEXTURE_2D)}t.unbindTexture()}else{let ve=i.TEXTURE_2D;if((L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(ve=L.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ve,le.__webglTexture),_e(ve,M),M.mipmaps&&M.mipmaps.length>0)for(let qe=0;qe<M.mipmaps.length;qe++)xe(Z.__webglFramebuffer[qe],L,M,i.COLOR_ATTACHMENT0,ve,qe);else xe(Z.__webglFramebuffer,L,M,i.COLOR_ATTACHMENT0,ve,0);g(M)&&A(ve),t.unbindTexture()}L.depthBuffer&&et(L)}function ft(L){const M=L.textures;for(let Z=0,le=M.length;Z<le;Z++){const Ae=M[Z];if(g(Ae)){const oe=_(L),Qe=n.get(Ae).__webglTexture;t.bindTexture(oe,Qe),A(oe),t.unbindTexture()}}}const $e=[],H=[];function wn(L){if(L.samples>0){if(mt(L)===!1){const M=L.textures,Z=L.width,le=L.height;let Ae=i.COLOR_BUFFER_BIT;const oe=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Qe=n.get(L),ve=M.length>1;if(ve)for(let Ze=0;Ze<M.length;Ze++)t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Qe.__webglMultisampledFramebuffer);const qe=L.texture.mipmaps;qe&&qe.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Qe.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Qe.__webglFramebuffer);for(let Ze=0;Ze<M.length;Ze++){if(L.resolveDepthBuffer&&(L.depthBuffer&&(Ae|=i.DEPTH_BUFFER_BIT),L.stencilBuffer&&L.resolveStencilBuffer&&(Ae|=i.STENCIL_BUFFER_BIT)),ve){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Qe.__webglColorRenderbuffer[Ze]);const Ee=n.get(M[Ze]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Ee,0)}i.blitFramebuffer(0,0,Z,le,0,0,Z,le,Ae,i.NEAREST),c===!0&&($e.length=0,H.length=0,$e.push(i.COLOR_ATTACHMENT0+Ze),L.depthBuffer&&L.resolveDepthBuffer===!1&&($e.push(oe),H.push(oe),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,H)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,$e))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ve)for(let Ze=0;Ze<M.length;Ze++){t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.RENDERBUFFER,Qe.__webglColorRenderbuffer[Ze]);const Ee=n.get(M[Ze]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Qe.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ze,i.TEXTURE_2D,Ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Qe.__webglMultisampledFramebuffer)}else if(L.depthBuffer&&L.resolveDepthBuffer===!1&&c){const M=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[M])}}}function pt(L){return Math.min(s.maxSamples,L.samples)}function mt(L){const M=n.get(L);return L.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function We(L){const M=a.render.frame;h.get(L)!==M&&(h.set(L,M),L.update())}function Dt(L,M){const Z=L.colorSpace,le=L.format,Ae=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||Z!==un&&Z!==mi&&(tt.getTransfer(Z)===Rt?(le!==hn||Ae!==cn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Z)),M}function ze(L){return typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement?(l.width=L.naturalWidth||L.width,l.height=L.naturalHeight||L.height):typeof VideoFrame<"u"&&L instanceof VideoFrame?(l.width=L.displayWidth,l.height=L.displayHeight):(l.width=L.width,l.height=L.height),l}this.allocateTextureUnit=q,this.resetTextureUnits=K,this.setTexture2D=D,this.setTexture2DArray=O,this.setTexture3D=Y,this.setTextureCube=Q,this.rebindTextures=He,this.setupRenderTarget=Mt,this.updateRenderTargetMipmap=ft,this.updateMultisampleRenderTarget=wn,this.setupDepthRenderbuffer=et,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=mt}function jS(i,e){function t(n,s=mi){let r;const a=tt.getTransfer(s);if(n===cn)return i.UNSIGNED_BYTE;if(n===nu)return i.UNSIGNED_SHORT_4_4_4_4;if(n===iu)return i.UNSIGNED_SHORT_5_5_5_1;if(n===$p)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Jp)return i.BYTE;if(n===Zp)return i.SHORT;if(n===io)return i.UNSIGNED_SHORT;if(n===tu)return i.INT;if(n===rr)return i.UNSIGNED_INT;if(n===ln)return i.FLOAT;if(n===kn)return i.HALF_FLOAT;if(n===eA)return i.ALPHA;if(n===tA)return i.RGB;if(n===hn)return i.RGBA;if(n===ro)return i.DEPTH_COMPONENT;if(n===ao)return i.DEPTH_STENCIL;if(n===Xi)return i.RED;if(n===su)return i.RED_INTEGER;if(n===ar)return i.RG;if(n===ru)return i.RG_INTEGER;if(n===au)return i.RGBA_INTEGER;if(n===Fc||n===oo||n===Nc||n===co)if(a===Rt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Fc)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===oo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Nc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===co)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Fc)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===oo)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Nc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===co)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Dc||n===ou||n===Lc||n===cu)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Dc)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ou)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Lc)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===cu)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Pc||n===kc||n===Uc)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Pc||n===kc)return a===Rt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Uc)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===lo||n===lu||n===hu||n===uu||n===ho||n===du||n===fu||n===pu||n===Au||n===gu||n===mu||n===xu||n===bu||n===Eu)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===lo)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===lu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===hu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===uu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ho)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===du)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===fu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===pu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Au)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===gu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===mu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===xu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===bu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Eu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===uo||n===yu||n===Oc)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===uo)return a===Rt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===yu)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Oc)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===nA||n===_u||n===wu||n===vu)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===uo)return r.COMPRESSED_RED_RGTC1_EXT;if(n===_u)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===wu)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===vu)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===so?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const XS=`
void main() {
gl_Position = vec4( position, 1.0 );
-}`,XS=`
+}`,YS=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
@@ -3816,7 +3816,7 @@ void main() {
}
-}`;class YS{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const s=new nn,r=e.properties.get(s);r.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Ls({vertexShader:jS,fragmentShader:XS,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Zt(new _l(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class JS extends Ms{constructor(e,t){super();const n=this;let s=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,p=null;const m=new YS,g=t.getContextAttributes();let A=null,_=null;const x=[],E=[],S=new Je;let w=null;const I=new Bn;I.viewport=new gt;const T=new Bn;T.viewport=new gt;const C=[I,T],v=new kw;let F=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let me=x[se];return me===void 0&&(me=new Xu,x[se]=me),me.getTargetRaySpace()},this.getControllerGrip=function(se){let me=x[se];return me===void 0&&(me=new Xu,x[se]=me),me.getGripSpace()},this.getHand=function(se){let me=x[se];return me===void 0&&(me=new Xu,x[se]=me),me.getHandSpace()};function q(se){const me=E.indexOf(se.inputSource);if(me===-1)return;const xe=x[me];xe!==void 0&&(xe.update(se.inputSource,se.frame,l||a),xe.dispatchEvent({type:se.type,data:se.inputSource}))}function $(){s.removeEventListener("select",q),s.removeEventListener("selectstart",q),s.removeEventListener("selectend",q),s.removeEventListener("squeeze",q),s.removeEventListener("squeezestart",q),s.removeEventListener("squeezeend",q),s.removeEventListener("end",$),s.removeEventListener("inputsourceschange",D);for(let se=0;se<x.length;se++){const me=E[se];me!==null&&(E[se]=null,x[se].disconnect(me))}F=null,K=null,m.reset(),e.setRenderTarget(A),f=null,d=null,u=null,s=null,_=null,Me.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(se){r=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(se){o=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(se){l=se},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return s},this.setSession=async function(se){if(s=se,s!==null){if(A=e.getRenderTarget(),s.addEventListener("select",q),s.addEventListener("selectstart",q),s.addEventListener("selectend",q),s.addEventListener("squeeze",q),s.addEventListener("squeezestart",q),s.addEventListener("squeezeend",q),s.addEventListener("end",$),s.addEventListener("inputsourceschange",D),g.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(S),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let xe=null,be=null,Ue=null;g.depth&&(Ue=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,xe=g.stencil?ro:so,be=g.stencil?io:rr);const et={colorFormat:t.RGBA8,depthFormat:Ue,scaleFactor:r};u=new XRWebGLBinding(s,t),d=u.createProjectionLayer(et),s.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),_=new or(d.textureWidth,d.textureHeight,{format:hn,type:cn,depthTexture:new ZA(d.textureWidth,d.textureHeight,be,void 0,void 0,void 0,void 0,void 0,void 0,xe),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const xe={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(s,t,xe),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),_=new or(f.framebufferWidth,f.framebufferHeight,{format:hn,type:cn,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}_.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await s.requestReferenceSpace(o),Me.setContext(s),Me.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function D(se){for(let me=0;me<se.removed.length;me++){const xe=se.removed[me],be=E.indexOf(xe);be>=0&&(E[be]=null,x[be].disconnect(xe))}for(let me=0;me<se.added.length;me++){const xe=se.added[me];let be=E.indexOf(xe);if(be===-1){for(let et=0;et<x.length;et++)if(et>=E.length){E.push(xe),be=et;break}else if(E[et]===null){E[et]=xe,be=et;break}if(be===-1)break}const Ue=x[be];Ue&&Ue.connect(xe)}}const O=new G,Y=new G;function Q(se,me,xe){O.setFromMatrixPosition(me.matrixWorld),Y.setFromMatrixPosition(xe.matrixWorld);const be=O.distanceTo(Y),Ue=me.projectionMatrix.elements,et=xe.projectionMatrix.elements,He=Ue[14]/(Ue[10]-1),Mt=Ue[14]/(Ue[10]+1),ft=(Ue[9]+1)/Ue[5],$e=(Ue[9]-1)/Ue[5],H=(Ue[8]-1)/Ue[0],wn=(et[8]+1)/et[0],pt=He*H,mt=He*wn,We=be/(-H+wn),Dt=We*-H;if(me.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Dt),se.translateZ(We),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),Ue[10]===-1)se.projectionMatrix.copy(me.projectionMatrix),se.projectionMatrixInverse.copy(me.projectionMatrixInverse);else{const ze=He+We,L=Mt+We,M=pt-Dt,Z=mt+(be-Dt),le=ft*Mt/L*ze,Ae=$e*Mt/L*ze;se.projectionMatrix.makePerspective(M,Z,le,Ae,ze,L),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}}function J(se,me){me===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(me.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(s===null)return;let me=se.near,xe=se.far;m.texture!==null&&(m.depthNear>0&&(me=m.depthNear),m.depthFar>0&&(xe=m.depthFar)),v.near=T.near=I.near=me,v.far=T.far=I.far=xe,(F!==v.near||K!==v.far)&&(s.updateRenderState({depthNear:v.near,depthFar:v.far}),F=v.near,K=v.far),I.layers.mask=se.layers.mask|2,T.layers.mask=se.layers.mask|4,v.layers.mask=I.layers.mask|T.layers.mask;const be=se.parent,Ue=v.cameras;J(v,be);for(let et=0;et<Ue.length;et++)J(Ue[et],be);Ue.length===2?Q(v,I,T):v.projectionMatrix.copy(I.projectionMatrix),ee(se,v,be)};function ee(se,me,xe){xe===null?se.matrix.copy(me.matrixWorld):(se.matrix.copy(xe.matrixWorld),se.matrix.invert(),se.matrix.multiply(me.matrixWorld)),se.matrix.decompose(se.position,se.quaternion,se.scale),se.updateMatrixWorld(!0),se.projectionMatrix.copy(me.projectionMatrix),se.projectionMatrixInverse.copy(me.projectionMatrixInverse),se.isPerspectiveCamera&&(se.fov=ea*2*Math.atan(1/se.projectionMatrix.elements[5]),se.zoom=1)}this.getCamera=function(){return v},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(se){c=se,d!==null&&(d.fixedFoveation=se),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=se)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(v)};let ae=null;function _e(se,me){if(h=me.getViewerPose(l||a),p=me,h!==null){const xe=h.views;f!==null&&(e.setRenderTargetFramebuffer(_,f.framebuffer),e.setRenderTarget(_));let be=!1;xe.length!==v.cameras.length&&(v.cameras.length=0,be=!0);for(let He=0;He<xe.length;He++){const Mt=xe[He];let ft=null;if(f!==null)ft=f.getViewport(Mt);else{const H=u.getViewSubImage(d,Mt);ft=H.viewport,He===0&&(e.setRenderTargetTextures(_,H.colorTexture,H.depthStencilTexture),e.setRenderTarget(_))}let $e=C[He];$e===void 0&&($e=new Bn,$e.layers.enable(He),$e.viewport=new gt,C[He]=$e),$e.matrix.fromArray(Mt.transform.matrix),$e.matrix.decompose($e.position,$e.quaternion,$e.scale),$e.projectionMatrix.fromArray(Mt.projectionMatrix),$e.projectionMatrixInverse.copy($e.projectionMatrix).invert(),$e.viewport.set(ft.x,ft.y,ft.width,ft.height),He===0&&(v.matrix.copy($e.matrix),v.matrix.decompose(v.position,v.quaternion,v.scale)),be===!0&&v.cameras.push($e)}const Ue=s.enabledFeatures;if(Ue&&Ue.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&u){const He=u.getDepthInformation(xe[0]);He&&He.isValid&&He.texture&&m.init(e,He,s.renderState)}}for(let xe=0;xe<x.length;xe++){const be=E[xe],Ue=x[xe];be!==null&&Ue!==void 0&&Ue.update(be,me,l||a)}ae&&ae(se,me),me.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:me}),p=null}const Me=new _g;Me.setAnimationLoop(_e),this.setAnimationLoop=function(se){ae=se},this.dispose=function(){}}}const br=new dn,ZS=new Re;function $S(i,e){function t(g,A){g.matrixAutoUpdate===!0&&g.updateMatrix(),A.value.copy(g.matrix)}function n(g,A){A.color.getRGB(g.fogColor.value,RA(i)),A.isFog?(g.fogNear.value=A.near,g.fogFar.value=A.far):A.isFogExp2&&(g.fogDensity.value=A.density)}function s(g,A,_,x,E){A.isMeshBasicMaterial||A.isMeshLambertMaterial?r(g,A):A.isMeshToonMaterial?(r(g,A),u(g,A)):A.isMeshPhongMaterial?(r(g,A),h(g,A)):A.isMeshStandardMaterial?(r(g,A),d(g,A),A.isMeshPhysicalMaterial&&f(g,A,E)):A.isMeshMatcapMaterial?(r(g,A),p(g,A)):A.isMeshDepthMaterial?r(g,A):A.isMeshDistanceMaterial?(r(g,A),m(g,A)):A.isMeshNormalMaterial?r(g,A):A.isLineBasicMaterial?(a(g,A),A.isLineDashedMaterial&&o(g,A)):A.isPointsMaterial?c(g,A,_,x):A.isSpriteMaterial?l(g,A):A.isShadowMaterial?(g.color.value.copy(A.color),g.opacity.value=A.opacity):A.isShaderMaterial&&(A.uniformsNeedUpdate=!1)}function r(g,A){g.opacity.value=A.opacity,A.color&&g.diffuse.value.copy(A.color),A.emissive&&g.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity),A.map&&(g.map.value=A.map,t(A.map,g.mapTransform)),A.alphaMap&&(g.alphaMap.value=A.alphaMap,t(A.alphaMap,g.alphaMapTransform)),A.bumpMap&&(g.bumpMap.value=A.bumpMap,t(A.bumpMap,g.bumpMapTransform),g.bumpScale.value=A.bumpScale,A.side===Dn&&(g.bumpScale.value*=-1)),A.normalMap&&(g.normalMap.value=A.normalMap,t(A.normalMap,g.normalMapTransform),g.normalScale.value.copy(A.normalScale),A.side===Dn&&g.normalScale.value.negate()),A.displacementMap&&(g.displacementMap.value=A.displacementMap,t(A.displacementMap,g.displacementMapTransform),g.displacementScale.value=A.displacementScale,g.displacementBias.value=A.displacementBias),A.emissiveMap&&(g.emissiveMap.value=A.emissiveMap,t(A.emissiveMap,g.emissiveMapTransform)),A.specularMap&&(g.specularMap.value=A.specularMap,t(A.specularMap,g.specularMapTransform)),A.alphaTest>0&&(g.alphaTest.value=A.alphaTest);const _=e.get(A),x=_.envMap,E=_.envMapRotation;x&&(g.envMap.value=x,br.copy(E),br.x*=-1,br.y*=-1,br.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(br.y*=-1,br.z*=-1),g.envMapRotation.value.setFromMatrix4(ZS.makeRotationFromEuler(br)),g.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=A.reflectivity,g.ior.value=A.ior,g.refractionRatio.value=A.refractionRatio),A.lightMap&&(g.lightMap.value=A.lightMap,g.lightMapIntensity.value=A.lightMapIntensity,t(A.lightMap,g.lightMapTransform)),A.aoMap&&(g.aoMap.value=A.aoMap,g.aoMapIntensity.value=A.aoMapIntensity,t(A.aoMap,g.aoMapTransform))}function a(g,A){g.diffuse.value.copy(A.color),g.opacity.value=A.opacity,A.map&&(g.map.value=A.map,t(A.map,g.mapTransform))}function o(g,A){g.dashSize.value=A.dashSize,g.totalSize.value=A.dashSize+A.gapSize,g.scale.value=A.scale}function c(g,A,_,x){g.diffuse.value.copy(A.color),g.opacity.value=A.opacity,g.size.value=A.size*_,g.scale.value=x*.5,A.map&&(g.map.value=A.map,t(A.map,g.uvTransform)),A.alphaMap&&(g.alphaMap.value=A.alphaMap,t(A.alphaMap,g.alphaMapTransform)),A.alphaTest>0&&(g.alphaTest.value=A.alphaTest)}function l(g,A){g.diffuse.value.copy(A.color),g.opacity.value=A.opacity,g.rotation.value=A.rotation,A.map&&(g.map.value=A.map,t(A.map,g.mapTransform)),A.alphaMap&&(g.alphaMap.value=A.alphaMap,t(A.alphaMap,g.alphaMapTransform)),A.alphaTest>0&&(g.alphaTest.value=A.alphaTest)}function h(g,A){g.specular.value.copy(A.specular),g.shininess.value=Math.max(A.shininess,1e-4)}function u(g,A){A.gradientMap&&(g.gradientMap.value=A.gradientMap)}function d(g,A){g.metalness.value=A.metalness,A.metalnessMap&&(g.metalnessMap.value=A.metalnessMap,t(A.metalnessMap,g.metalnessMapTransform)),g.roughness.value=A.roughness,A.roughnessMap&&(g.roughnessMap.value=A.roughnessMap,t(A.roughnessMap,g.roughnessMapTransform)),A.envMap&&(g.envMapIntensity.value=A.envMapIntensity)}function f(g,A,_){g.ior.value=A.ior,A.sheen>0&&(g.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen),g.sheenRoughness.value=A.sheenRoughness,A.sheenColorMap&&(g.sheenColorMap.value=A.sheenColorMap,t(A.sheenColorMap,g.sheenColorMapTransform)),A.sheenRoughnessMap&&(g.sheenRoughnessMap.value=A.sheenRoughnessMap,t(A.sheenRoughnessMap,g.sheenRoughnessMapTransform))),A.clearcoat>0&&(g.clearcoat.value=A.clearcoat,g.clearcoatRoughness.value=A.clearcoatRoughness,A.clearcoatMap&&(g.clearcoatMap.value=A.clearcoatMap,t(A.clearcoatMap,g.clearcoatMapTransform)),A.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=A.clearcoatRoughnessMap,t(A.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),A.clearcoatNormalMap&&(g.clearcoatNormalMap.value=A.clearcoatNormalMap,t(A.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(A.clearcoatNormalScale),A.side===Dn&&g.clearcoatNormalScale.value.negate())),A.dispersion>0&&(g.dispersion.value=A.dispersion),A.iridescence>0&&(g.iridescence.value=A.iridescence,g.iridescenceIOR.value=A.iridescenceIOR,g.iridescenceThicknessMinimum.value=A.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=A.iridescenceThicknessRange[1],A.iridescenceMap&&(g.iridescenceMap.value=A.iridescenceMap,t(A.iridescenceMap,g.iridescenceMapTransform)),A.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=A.iridescenceThicknessMap,t(A.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),A.transmission>0&&(g.transmission.value=A.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),A.transmissionMap&&(g.transmissionMap.value=A.transmissionMap,t(A.transmissionMap,g.transmissionMapTransform)),g.thickness.value=A.thickness,A.thicknessMap&&(g.thicknessMap.value=A.thicknessMap,t(A.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=A.attenuationDistance,g.attenuationColor.value.copy(A.attenuationColor)),A.anisotropy>0&&(g.anisotropyVector.value.set(A.anisotropy*Math.cos(A.anisotropyRotation),A.anisotropy*Math.sin(A.anisotropyRotation)),A.anisotropyMap&&(g.anisotropyMap.value=A.anisotropyMap,t(A.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=A.specularIntensity,g.specularColor.value.copy(A.specularColor),A.specularColorMap&&(g.specularColorMap.value=A.specularColorMap,t(A.specularColorMap,g.specularColorMapTransform)),A.specularIntensityMap&&(g.specularIntensityMap.value=A.specularIntensityMap,t(A.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,A){A.matcap&&(g.matcap.value=A.matcap)}function m(g,A){const _=e.get(A).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function e1(i,e,t,n){let s={},r={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(_,x){const E=x.program;n.uniformBlockBinding(_,E)}function l(_,x){let E=s[_.id];E===void 0&&(p(_),E=h(_),s[_.id]=E,_.addEventListener("dispose",g));const S=x.program;n.updateUBOMapping(_,S);const w=e.render.frame;r[_.id]!==w&&(d(_),r[_.id]=w)}function h(_){const x=u();_.__bindingPointIndex=x;const E=i.createBuffer(),S=_.__size,w=_.usage;return i.bindBuffer(i.UNIFORM_BUFFER,E),i.bufferData(i.UNIFORM_BUFFER,S,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,E),E}function u(){for(let _=0;_<o;_++)if(a.indexOf(_)===-1)return a.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(_){const x=s[_.id],E=_.uniforms,S=_.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let w=0,I=E.length;w<I;w++){const T=Array.isArray(E[w])?E[w]:[E[w]];for(let C=0,v=T.length;C<v;C++){const F=T[C];if(f(F,w,C,S)===!0){const K=F.__offset,q=Array.isArray(F.value)?F.value:[F.value];let $=0;for(let D=0;D<q.length;D++){const O=q[D],Y=m(O);typeof O=="number"||typeof O=="boolean"?(F.__data[0]=O,i.bufferSubData(i.UNIFORM_BUFFER,K+$,F.__data)):O.isMatrix3?(F.__data[0]=O.elements[0],F.__data[1]=O.elements[1],F.__data[2]=O.elements[2],F.__data[3]=0,F.__data[4]=O.elements[3],F.__data[5]=O.elements[4],F.__data[6]=O.elements[5],F.__data[7]=0,F.__data[8]=O.elements[6],F.__data[9]=O.elements[7],F.__data[10]=O.elements[8],F.__data[11]=0):(O.toArray(F.__data,$),$+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,K,F.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function f(_,x,E,S){const w=_.value,I=x+"_"+E;if(S[I]===void 0)return typeof w=="number"||typeof w=="boolean"?S[I]=w:S[I]=w.clone(),!0;{const T=S[I];if(typeof w=="number"||typeof w=="boolean"){if(T!==w)return S[I]=w,!0}else if(T.equals(w)===!1)return T.copy(w),!0}return!1}function p(_){const x=_.uniforms;let E=0;const S=16;for(let I=0,T=x.length;I<T;I++){const C=Array.isArray(x[I])?x[I]:[x[I]];for(let v=0,F=C.length;v<F;v++){const K=C[v],q=Array.isArray(K.value)?K.value:[K.value];for(let $=0,D=q.length;$<D;$++){const O=q[$],Y=m(O),Q=E%S,J=Q%Y.boundary,ee=Q+J;E+=J,ee!==0&&S-ee<Y.storage&&(E+=S-ee),K.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=E,E+=Y.storage}}}const w=E%S;return w>0&&(E+=S-w),_.__size=E,_.__cache={},this}function m(_){const x={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),x}function g(_){const x=_.target;x.removeEventListener("dispose",g);const E=a.indexOf(x.__bindingPointIndex);a.splice(E,1),i.deleteBuffer(s[x.id]),delete s[x.id],delete r[x.id]}function A(){for(const _ in s)i.deleteBuffer(s[_]);a=[],s={},r={}}return{bind:c,update:l,dispose:A}}class Yg{constructor(e={}){const{canvas:t=f_(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const p=new Uint32Array(4),m=new Int32Array(4);let g=null,A=null;const _=[],x=[];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=Is,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let S=!1;this._outputColorSpace=yt;let w=0,I=0,T=null,C=-1,v=null;const F=new gt,K=new gt;let q=null;const $=new Fe(0);let D=0,O=t.width,Y=t.height,Q=1,J=null,ee=null;const ae=new gt(0,0,O,Y),_e=new gt(0,0,O,Y);let Me=!1;const se=new nd;let me=!1,xe=!1;const be=new Re,Ue=new Re,et=new G,He=new gt,Mt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ft=!1;function $e(){return T===null?Q:1}let H=n;function wn(y,R){return t.getContext(y,R)}try{const y={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${vc}`),t.addEventListener("webglcontextlost",de,!1),t.addEventListener("webglcontextrestored",Se,!1),t.addEventListener("webglcontextcreationerror",Ie,!1),H===null){const R="webgl2";if(H=wn(R,y),H===null)throw wn(R)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(y){throw console.error("THREE.WebGLRenderer: "+y.message),y}let pt,mt,We,Dt,ze,L,M,Z,le,Ae,oe,Qe,ve,qe,Ze,Ee,De,Oe,Ge,Te,nt,Ke,it,W;function ne(){pt=new uI(H),pt.init(),Ke=new KS(H,pt),mt=new sI(H,pt,e,Ke),We=new WS(H,pt),mt.reverseDepthBuffer&&d&&We.buffers.depth.setReversed(!0),Dt=new pI(H),ze=new FS,L=new qS(H,pt,We,ze,mt,Ke,Dt),M=new aI(E),Z=new hI(E),le=new ev(H),it=new nI(H,le),Ae=new dI(H,le,Dt,it),oe=new gI(H,Ae,le,Dt),Ge=new AI(H,mt,L),Ee=new rI(ze),Qe=new RS(E,M,Z,pt,mt,it,Ee),ve=new $S(E,ze),qe=new DS,Ze=new QS(pt),Oe=new tI(E,M,Z,We,oe,f,c),De=new zS(E,oe,mt),W=new e1(H,Dt,mt,We),Te=new iI(H,pt,Dt),nt=new fI(H,pt,Dt),Dt.programs=Qe.programs,E.capabilities=mt,E.extensions=pt,E.properties=ze,E.renderLists=qe,E.shadowMap=De,E.state=We,E.info=Dt}ne();const re=new JS(E,H);this.xr=re,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const y=pt.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=pt.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return Q},this.setPixelRatio=function(y){y!==void 0&&(Q=y,this.setSize(O,Y,!1))},this.getSize=function(y){return y.set(O,Y)},this.setSize=function(y,R,N=!0){if(re.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}O=y,Y=R,t.width=Math.floor(y*Q),t.height=Math.floor(R*Q),N===!0&&(t.style.width=y+"px",t.style.height=R+"px"),this.setViewport(0,0,y,R)},this.getDrawingBufferSize=function(y){return y.set(O*Q,Y*Q).floor()},this.setDrawingBufferSize=function(y,R,N){O=y,Y=R,Q=N,t.width=Math.floor(y*N),t.height=Math.floor(R*N),this.setViewport(0,0,y,R)},this.getCurrentViewport=function(y){return y.copy(F)},this.getViewport=function(y){return y.copy(ae)},this.setViewport=function(y,R,N,U){y.isVector4?ae.set(y.x,y.y,y.z,y.w):ae.set(y,R,N,U),We.viewport(F.copy(ae).multiplyScalar(Q).round())},this.getScissor=function(y){return y.copy(_e)},this.setScissor=function(y,R,N,U){y.isVector4?_e.set(y.x,y.y,y.z,y.w):_e.set(y,R,N,U),We.scissor(K.copy(_e).multiplyScalar(Q).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(y){We.setScissorTest(Me=y)},this.setOpaqueSort=function(y){J=y},this.setTransparentSort=function(y){ee=y},this.getClearColor=function(y){return y.copy(Oe.getClearColor())},this.setClearColor=function(){Oe.setClearColor(...arguments)},this.getClearAlpha=function(){return Oe.getClearAlpha()},this.setClearAlpha=function(){Oe.setClearAlpha(...arguments)},this.clear=function(y=!0,R=!0,N=!0){let U=0;if(y){let P=!1;if(T!==null){const z=T.texture.format;P=z===su||z===iu||z===nu}if(P){const z=T.texture.type,j=z===cn||z===rr||z===no||z===io||z===eu||z===tu,X=Oe.getClearColor(),ie=Oe.getClearAlpha(),he=X.r,ce=X.g,fe=X.b;j?(p[0]=he,p[1]=ce,p[2]=fe,p[3]=ie,H.clearBufferuiv(H.COLOR,0,p)):(m[0]=he,m[1]=ce,m[2]=fe,m[3]=ie,H.clearBufferiv(H.COLOR,0,m))}else U|=H.COLOR_BUFFER_BIT}R&&(U|=H.DEPTH_BUFFER_BIT),N&&(U|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(U)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",de,!1),t.removeEventListener("webglcontextrestored",Se,!1),t.removeEventListener("webglcontextcreationerror",Ie,!1),Oe.dispose(),qe.dispose(),Ze.dispose(),ze.dispose(),M.dispose(),Z.dispose(),oe.dispose(),it.dispose(),W.dispose(),Qe.dispose(),re.dispose(),re.removeEventListener("sessionstart",Uh),re.removeEventListener("sessionend",Oh),ws.stop()};function de(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function Se(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;const y=Dt.autoReset,R=De.enabled,N=De.autoUpdate,U=De.needsUpdate,P=De.type;ne(),Dt.autoReset=y,De.enabled=R,De.autoUpdate=N,De.needsUpdate=U,De.type=P}function Ie(y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function st(y){const R=y.target;R.removeEventListener("dispose",st),Ht(R)}function Ht(y){vn(y),ze.remove(y)}function vn(y){const R=ze.get(y).programs;R!==void 0&&(R.forEach(function(N){Qe.releaseProgram(N)}),y.isShaderMaterial&&Qe.releaseShaderCache(y))}this.renderBufferDirect=function(y,R,N,U,P,z){R===null&&(R=Mt);const j=P.isMesh&&P.matrixWorld.determinant()<0,X=Op(y,R,N,U,P);We.setMaterial(U,j);let ie=N.index,he=1;if(U.wireframe===!0){if(ie=Ae.getWireframeAttribute(N),ie===void 0)return;he=2}const ce=N.drawRange,fe=N.attributes.position;let ge=ce.start*he,ye=(ce.start+ce.count)*he;z!==null&&(ge=Math.max(ge,z.start*he),ye=Math.min(ye,(z.start+z.count)*he)),ie!==null?(ge=Math.max(ge,0),ye=Math.min(ye,ie.count)):fe!=null&&(ge=Math.max(ge,0),ye=Math.min(ye,fe.count));const Pe=ye-ge;if(Pe<0||Pe===1/0)return;it.setup(P,U,X,N,ie);let je,Ve=Te;if(ie!==null&&(je=le.get(ie),Ve=nt,Ve.setIndex(je)),P.isMesh)U.wireframe===!0?(We.setLineWidth(U.wireframeLinewidth*$e()),Ve.setMode(H.LINES)):Ve.setMode(H.TRIANGLES);else if(P.isLine){let Le=U.linewidth;Le===void 0&&(Le=1),We.setLineWidth(Le*$e()),P.isLineSegments?Ve.setMode(H.LINES):P.isLineLoop?Ve.setMode(H.LINE_LOOP):Ve.setMode(H.LINE_STRIP)}else P.isPoints?Ve.setMode(H.POINTS):P.isSprite&&Ve.setMode(H.TRIANGLES);if(P.isBatchedMesh)if(P._multiDrawInstances!==null)Hc("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Ve.renderMultiDrawInstances(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount,P._multiDrawInstances);else if(pt.get("WEBGL_multi_draw"))Ve.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else{const Le=P._multiDrawStarts,rt=P._multiDrawCounts,ke=P._multiDrawCount,It=ie?le.get(ie).bytesPerElement:1,mn=ze.get(U).currentProgram.getUniforms();for(let vt=0;vt<ke;vt++)mn.setValue(H,"_gl_DrawID",vt),Ve.render(Le[vt]/It,rt[vt])}else if(P.isInstancedMesh)Ve.renderInstances(ge,Pe,P.count);else if(N.isInstancedBufferGeometry){const Le=N._maxInstanceCount!==void 0?N._maxInstanceCount:1/0,rt=Math.min(N.instanceCount,Le);Ve.renderInstances(ge,Pe,rt)}else Ve.render(ge,Pe)};function Ct(y,R,N){y.transparent===!0&&y.side===Li&&y.forceSinglePass===!1?(y.side=Dn,y.needsUpdate=!0,eo(y,R,N),y.side=Ki,y.needsUpdate=!0,eo(y,R,N),y.side=Li):eo(y,R,N)}this.compile=function(y,R,N=null){N===null&&(N=y),A=Ze.get(N),A.init(R),x.push(A),N.traverseVisible(function(P){P.isLight&&P.layers.test(R.layers)&&(A.pushLight(P),P.castShadow&&A.pushShadow(P))}),y!==N&&y.traverseVisible(function(P){P.isLight&&P.layers.test(R.layers)&&(A.pushLight(P),P.castShadow&&A.pushShadow(P))}),A.setupLights();const U=new Set;return y.traverse(function(P){if(!(P.isMesh||P.isPoints||P.isLine||P.isSprite))return;const z=P.material;if(z)if(Array.isArray(z))for(let j=0;j<z.length;j++){const X=z[j];Ct(X,N,P),U.add(X)}else Ct(z,N,P),U.add(z)}),A=x.pop(),U},this.compileAsync=function(y,R,N=null){const U=this.compile(y,R,N);return new Promise(P=>{function z(){if(U.forEach(function(j){ze.get(j).currentProgram.isReady()&&U.delete(j)}),U.size===0){P(y);return}setTimeout(z,10)}pt.get("KHR_parallel_shader_compile")!==null?z():setTimeout(z,10)})};let ii=null;function Di(y){ii&&ii(y)}function Uh(){ws.stop()}function Oh(){ws.start()}const ws=new _g;ws.setAnimationLoop(Di),typeof self<"u"&&ws.setContext(self),this.setAnimationLoop=function(y){ii=y,re.setAnimationLoop(y),y===null?ws.stop():ws.start()},re.addEventListener("sessionstart",Uh),re.addEventListener("sessionend",Oh),this.render=function(y,R){if(R!==void 0&&R.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;if(y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),R.parent===null&&R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),re.enabled===!0&&re.isPresenting===!0&&(re.cameraAutoUpdate===!0&&re.updateCamera(R),R=re.getCamera()),y.isScene===!0&&y.onBeforeRender(E,y,R,T),A=Ze.get(y,x.length),A.init(R),x.push(A),Ue.multiplyMatrices(R.projectionMatrix,R.matrixWorldInverse),se.setFromProjectionMatrix(Ue),xe=this.localClippingEnabled,me=Ee.init(this.clippingPlanes,xe),g=qe.get(y,_.length),g.init(),_.push(g),re.enabled===!0&&re.isPresenting===!0){const z=E.xr.getDepthSensingMesh();z!==null&&Ec(z,R,-1/0,E.sortObjects)}Ec(y,R,0,E.sortObjects),g.finish(),E.sortObjects===!0&&g.sort(J,ee),ft=re.enabled===!1||re.isPresenting===!1||re.hasDepthSensing()===!1,ft&&Oe.addToRenderList(g,y),this.info.render.frame++,me===!0&&Ee.beginShadows();const N=A.state.shadowsArray;De.render(N,y,R),me===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();const U=g.opaque,P=g.transmissive;if(A.setupLights(),R.isArrayCamera){const z=R.cameras;if(P.length>0)for(let j=0,X=z.length;j<X;j++){const ie=z[j];Qh(U,P,y,ie)}ft&&Oe.render(y);for(let j=0,X=z.length;j<X;j++){const ie=z[j];yc(g,y,ie,ie.viewport)}}else P.length>0&&Qh(U,P,y,R),ft&&Oe.render(y),yc(g,y,R);T!==null&&I===0&&(L.updateMultisampleRenderTarget(T),L.updateRenderTargetMipmap(T)),y.isScene===!0&&y.onAfterRender(E,y,R),it.resetDefaultState(),C=-1,v=null,x.pop(),x.length>0?(A=x[x.length-1],me===!0&&Ee.setGlobalState(E.clippingPlanes,A.state.camera)):A=null,_.pop(),_.length>0?g=_[_.length-1]:g=null};function Ec(y,R,N,U){if(y.visible===!1)return;if(y.layers.test(R.layers)){if(y.isGroup)N=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(R);else if(y.isLight)A.pushLight(y),y.castShadow&&A.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||se.intersectsSprite(y)){U&&He.setFromMatrixPosition(y.matrixWorld).applyMatrix4(Ue);const j=oe.update(y),X=y.material;X.visible&&g.push(y,j,X,N,He.z,null)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||se.intersectsObject(y))){const j=oe.update(y),X=y.material;if(U&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),He.copy(y.boundingSphere.center)):(j.boundingSphere===null&&j.computeBoundingSphere(),He.copy(j.boundingSphere.center)),He.applyMatrix4(y.matrixWorld).applyMatrix4(Ue)),Array.isArray(X)){const ie=j.groups;for(let he=0,ce=ie.length;he<ce;he++){const fe=ie[he],ge=X[fe.materialIndex];ge&&ge.visible&&g.push(y,j,ge,N,He.z,fe)}}else X.visible&&g.push(y,j,X,N,He.z,null)}}const z=y.children;for(let j=0,X=z.length;j<X;j++)Ec(z[j],R,N,U)}function yc(y,R,N,U){const P=y.opaque,z=y.transmissive,j=y.transparent;A.setupLightsView(N),me===!0&&Ee.setGlobalState(E.clippingPlanes,N),U&&We.viewport(F.copy(U)),P.length>0&&$a(P,R,N),z.length>0&&$a(z,R,N),j.length>0&&$a(j,R,N),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1)}function Qh(y,R,N,U){if((N.isScene===!0?N.overrideMaterial:null)!==null)return;A.state.transmissionRenderTarget[U.id]===void 0&&(A.state.transmissionRenderTarget[U.id]=new or(1,1,{generateMipmaps:!0,type:pt.has("EXT_color_buffer_half_float")||pt.has("EXT_color_buffer_float")?Pn:cn,minFilter:si,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:tt.workingColorSpace}));const z=A.state.transmissionRenderTarget[U.id],j=U.viewport||F;z.setSize(j.z*E.transmissionResolutionScale,j.w*E.transmissionResolutionScale);const X=E.getRenderTarget();E.setRenderTarget(z),E.getClearColor($),D=E.getClearAlpha(),D<1&&E.setClearColor(16777215,.5),E.clear(),ft&&Oe.render(N);const ie=E.toneMapping;E.toneMapping=Is;const he=U.viewport;if(U.viewport!==void 0&&(U.viewport=void 0),A.setupLightsView(U),me===!0&&Ee.setGlobalState(E.clippingPlanes,U),$a(y,N,U),L.updateMultisampleRenderTarget(z),L.updateRenderTargetMipmap(z),pt.has("WEBGL_multisampled_render_to_texture")===!1){let ce=!1;for(let fe=0,ge=R.length;fe<ge;fe++){const ye=R[fe],Pe=ye.object,je=ye.geometry,Ve=ye.material,Le=ye.group;if(Ve.side===Li&&Pe.layers.test(U.layers)){const rt=Ve.side;Ve.side=Dn,Ve.needsUpdate=!0,Gh(Pe,N,U,je,Ve,Le),Ve.side=rt,Ve.needsUpdate=!0,ce=!0}}ce===!0&&(L.updateMultisampleRenderTarget(z),L.updateRenderTargetMipmap(z))}E.setRenderTarget(X),E.setClearColor($,D),he!==void 0&&(U.viewport=he),E.toneMapping=ie}function $a(y,R,N){const U=R.isScene===!0?R.overrideMaterial:null;for(let P=0,z=y.length;P<z;P++){const j=y[P],X=j.object,ie=j.geometry,he=j.group;let ce=j.material;ce.allowOverride===!0&&U!==null&&(ce=U),X.layers.test(N.layers)&&Gh(X,R,N,ie,ce,he)}}function Gh(y,R,N,U,P,z){y.onBeforeRender(E,R,N,U,P,z),y.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),P.onBeforeRender(E,R,N,U,y,z),P.transparent===!0&&P.side===Li&&P.forceSinglePass===!1?(P.side=Dn,P.needsUpdate=!0,E.renderBufferDirect(N,R,U,P,y,z),P.side=Ki,P.needsUpdate=!0,E.renderBufferDirect(N,R,U,P,y,z),P.side=Li):E.renderBufferDirect(N,R,U,P,y,z),y.onAfterRender(E,R,N,U,P,z)}function eo(y,R,N){R.isScene!==!0&&(R=Mt);const U=ze.get(y),P=A.state.lights,z=A.state.shadowsArray,j=P.state.version,X=Qe.getParameters(y,P.state,z,R,N),ie=Qe.getProgramCacheKey(X);let he=U.programs;U.environment=y.isMeshStandardMaterial?R.environment:null,U.fog=R.fog,U.envMap=(y.isMeshStandardMaterial?Z:M).get(y.envMap||U.environment),U.envMapRotation=U.environment!==null&&y.envMap===null?R.environmentRotation:y.envMapRotation,he===void 0&&(y.addEventListener("dispose",st),he=new Map,U.programs=he);let ce=he.get(ie);if(ce!==void 0){if(U.currentProgram===ce&&U.lightsStateVersion===j)return wc(y,X),ce}else X.uniforms=Qe.getUniforms(y),y.onBeforeCompile(X,E),ce=Qe.acquireProgram(X,ie),he.set(ie,ce),U.uniforms=X.uniforms;const fe=U.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(fe.clippingPlanes=Ee.uniform),wc(y,X),U.needsLights=tr(y),U.lightsStateVersion=j,U.needsLights&&(fe.ambientLightColor.value=P.state.ambient,fe.lightProbe.value=P.state.probe,fe.directionalLights.value=P.state.directional,fe.directionalLightShadows.value=P.state.directionalShadow,fe.spotLights.value=P.state.spot,fe.spotLightShadows.value=P.state.spotShadow,fe.rectAreaLights.value=P.state.rectArea,fe.ltc_1.value=P.state.rectAreaLTC1,fe.ltc_2.value=P.state.rectAreaLTC2,fe.pointLights.value=P.state.point,fe.pointLightShadows.value=P.state.pointShadow,fe.hemisphereLights.value=P.state.hemi,fe.directionalShadowMap.value=P.state.directionalShadowMap,fe.directionalShadowMatrix.value=P.state.directionalShadowMatrix,fe.spotShadowMap.value=P.state.spotShadowMap,fe.spotLightMatrix.value=P.state.spotLightMatrix,fe.spotLightMap.value=P.state.spotLightMap,fe.pointShadowMap.value=P.state.pointShadowMap,fe.pointShadowMatrix.value=P.state.pointShadowMatrix),U.currentProgram=ce,U.uniformsList=null,ce}function _c(y){if(y.uniformsList===null){const R=y.currentProgram.getUniforms();y.uniformsList=Rl.seqWithValue(R.seq,y.uniforms)}return y.uniformsList}function wc(y,R){const N=ze.get(y);N.outputColorSpace=R.outputColorSpace,N.batching=R.batching,N.batchingColor=R.batchingColor,N.instancing=R.instancing,N.instancingColor=R.instancingColor,N.instancingMorph=R.instancingMorph,N.skinning=R.skinning,N.morphTargets=R.morphTargets,N.morphNormals=R.morphNormals,N.morphColors=R.morphColors,N.morphTargetsCount=R.morphTargetsCount,N.numClippingPlanes=R.numClippingPlanes,N.numIntersection=R.numClipIntersection,N.vertexAlphas=R.vertexAlphas,N.vertexTangents=R.vertexTangents,N.toneMapping=R.toneMapping}function Op(y,R,N,U,P){R.isScene!==!0&&(R=Mt),L.resetTextureUnits();const z=R.fog,j=U.isMeshStandardMaterial?R.environment:null,X=T===null?E.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:un,ie=(U.isMeshStandardMaterial?Z:M).get(U.envMap||j),he=U.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,ce=!!N.attributes.tangent&&(!!U.normalMap||U.anisotropy>0),fe=!!N.morphAttributes.position,ge=!!N.morphAttributes.normal,ye=!!N.morphAttributes.color;let Pe=Is;U.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(Pe=E.toneMapping);const je=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,Ve=je!==void 0?je.length:0,Le=ze.get(U),rt=A.state.lights;if(me===!0&&(xe===!0||y!==v)){const Ut=y===v&&U.id===C;Ee.setState(U,y,Ut)}let ke=!1;U.version===Le.__version?(Le.needsLights&&Le.lightsStateVersion!==rt.state.version||Le.outputColorSpace!==X||P.isBatchedMesh&&Le.batching===!1||!P.isBatchedMesh&&Le.batching===!0||P.isBatchedMesh&&Le.batchingColor===!0&&P.colorTexture===null||P.isBatchedMesh&&Le.batchingColor===!1&&P.colorTexture!==null||P.isInstancedMesh&&Le.instancing===!1||!P.isInstancedMesh&&Le.instancing===!0||P.isSkinnedMesh&&Le.skinning===!1||!P.isSkinnedMesh&&Le.skinning===!0||P.isInstancedMesh&&Le.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&Le.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&Le.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&Le.instancingMorph===!1&&P.morphTexture!==null||Le.envMap!==ie||U.fog===!0&&Le.fog!==z||Le.numClippingPlanes!==void 0&&(Le.numClippingPlanes!==Ee.numPlanes||Le.numIntersection!==Ee.numIntersection)||Le.vertexAlphas!==he||Le.vertexTangents!==ce||Le.morphTargets!==fe||Le.morphNormals!==ge||Le.morphColors!==ye||Le.toneMapping!==Pe||Le.morphTargetsCount!==Ve)&&(ke=!0):(ke=!0,Le.__version=U.version);let It=Le.currentProgram;ke===!0&&(It=eo(U,R,P));let mn=!1,vt=!1,Et=!1;const Xe=It.getUniforms(),Xt=Le.uniforms;if(We.useProgram(It.program)&&(mn=!0,vt=!0,Et=!0),U.id!==C&&(C=U.id,vt=!0),mn||v!==y){We.buffers.depth.getReversed()?(be.copy(y.projectionMatrix),A_(be),g_(be),Xe.setValue(H,"projectionMatrix",be)):Xe.setValue(H,"projectionMatrix",y.projectionMatrix),Xe.setValue(H,"viewMatrix",y.matrixWorldInverse);const xn=Xe.map.cameraPosition;xn!==void 0&&xn.setValue(H,et.setFromMatrixPosition(y.matrixWorld)),mt.logarithmicDepthBuffer&&Xe.setValue(H,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&Xe.setValue(H,"isOrthographic",y.isOrthographicCamera===!0),v!==y&&(v=y,vt=!0,Et=!0)}if(P.isSkinnedMesh){Xe.setOptional(H,P,"bindMatrix"),Xe.setOptional(H,P,"bindMatrixInverse");const Ut=P.skeleton;Ut&&(Ut.boneTexture===null&&Ut.computeBoneTexture(),Xe.setValue(H,"boneTexture",Ut.boneTexture,L))}P.isBatchedMesh&&(Xe.setOptional(H,P,"batchingTexture"),Xe.setValue(H,"batchingTexture",P._matricesTexture,L),Xe.setOptional(H,P,"batchingIdTexture"),Xe.setValue(H,"batchingIdTexture",P._indirectTexture,L),Xe.setOptional(H,P,"batchingColorTexture"),P._colorsTexture!==null&&Xe.setValue(H,"batchingColorTexture",P._colorsTexture,L));const Cn=N.morphAttributes;if((Cn.position!==void 0||Cn.normal!==void 0||Cn.color!==void 0)&&Ge.update(P,N,It),(vt||Le.receiveShadow!==P.receiveShadow)&&(Le.receiveShadow=P.receiveShadow,Xe.setValue(H,"receiveShadow",P.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(Xt.envMap.value=ie,Xt.flipEnvMap.value=ie.isCubeTexture&&ie.isRenderTargetTexture===!1?-1:1),U.isMeshStandardMaterial&&U.envMap===null&&R.environment!==null&&(Xt.envMapIntensity.value=R.environmentIntensity),vt&&(Xe.setValue(H,"toneMappingExposure",E.toneMappingExposure),Le.needsLights&&vs(Xt,Et),z&&U.fog===!0&&ve.refreshFogUniforms(Xt,z),ve.refreshMaterialUniforms(Xt,U,Q,Y,A.state.transmissionRenderTarget[y.id]),Rl.upload(H,_c(Le),Xt,L)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(Rl.upload(H,_c(Le),Xt,L),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&Xe.setValue(H,"center",P.center),Xe.setValue(H,"modelViewMatrix",P.modelViewMatrix),Xe.setValue(H,"normalMatrix",P.normalMatrix),Xe.setValue(H,"modelMatrix",P.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const Ut=U.uniformsGroups;for(let xn=0,Qp=Ut.length;xn<Qp;xn++){const Wr=Ut[xn];W.update(Wr,It),W.bind(Wr,It)}}return It}function vs(y,R){y.ambientLightColor.needsUpdate=R,y.lightProbe.needsUpdate=R,y.directionalLights.needsUpdate=R,y.directionalLightShadows.needsUpdate=R,y.pointLights.needsUpdate=R,y.pointLightShadows.needsUpdate=R,y.spotLights.needsUpdate=R,y.spotLightShadows.needsUpdate=R,y.rectAreaLights.needsUpdate=R,y.hemisphereLights.needsUpdate=R}function tr(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(y,R,N){const U=ze.get(y);U.__autoAllocateDepthBuffer=y.resolveDepthBuffer===!1,U.__autoAllocateDepthBuffer===!1&&(U.__useRenderToTexture=!1),ze.get(y.texture).__webglTexture=R,ze.get(y.depthTexture).__webglTexture=U.__autoAllocateDepthBuffer?void 0:N,U.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(y,R){const N=ze.get(y);N.__webglFramebuffer=R,N.__useDefaultFramebuffer=R===void 0};const b=H.createFramebuffer();this.setRenderTarget=function(y,R=0,N=0){T=y,w=R,I=N;let U=!0,P=null,z=!1,j=!1;if(y){const ie=ze.get(y);if(ie.__useDefaultFramebuffer!==void 0)We.bindFramebuffer(H.FRAMEBUFFER,null),U=!1;else if(ie.__webglFramebuffer===void 0)L.setupRenderTarget(y);else if(ie.__hasExternalTextures)L.rebindTextures(y,ze.get(y.texture).__webglTexture,ze.get(y.depthTexture).__webglTexture);else if(y.depthBuffer){const fe=y.depthTexture;if(ie.__boundDepthTexture!==fe){if(fe!==null&&ze.has(fe)&&(y.width!==fe.image.width||y.height!==fe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");L.setupDepthRenderbuffer(y)}}const he=y.texture;(he.isData3DTexture||he.isDataArrayTexture||he.isCompressedArrayTexture)&&(j=!0);const ce=ze.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(ce[R])?P=ce[R][N]:P=ce[R],z=!0):y.samples>0&&L.useMultisampledRTT(y)===!1?P=ze.get(y).__webglMultisampledFramebuffer:Array.isArray(ce)?P=ce[N]:P=ce,F.copy(y.viewport),K.copy(y.scissor),q=y.scissorTest}else F.copy(ae).multiplyScalar(Q).floor(),K.copy(_e).multiplyScalar(Q).floor(),q=Me;if(N!==0&&(P=b),We.bindFramebuffer(H.FRAMEBUFFER,P)&&U&&We.drawBuffers(y,P),We.viewport(F),We.scissor(K),We.setScissorTest(q),z){const ie=ze.get(y.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+R,ie.__webglTexture,N)}else if(j){const ie=ze.get(y.texture),he=R;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,ie.__webglTexture,N,he)}else if(y!==null&&N!==0){const ie=ze.get(y.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,ie.__webglTexture,N)}C=-1},this.readRenderTargetPixels=function(y,R,N,U,P,z,j){if(!(y&&y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let X=ze.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&j!==void 0&&(X=X[j]),X){We.bindFramebuffer(H.FRAMEBUFFER,X);try{const ie=y.texture,he=ie.format,ce=ie.type;if(!mt.textureFormatReadable(he)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!mt.textureTypeReadable(ce)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}R>=0&&R<=y.width-U&&N>=0&&N<=y.height-P&&H.readPixels(R,N,U,P,Ke.convert(he),Ke.convert(ce),z)}finally{const ie=T!==null?ze.get(T).__webglFramebuffer:null;We.bindFramebuffer(H.FRAMEBUFFER,ie)}}},this.readRenderTargetPixelsAsync=async function(y,R,N,U,P,z,j){if(!(y&&y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let X=ze.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&j!==void 0&&(X=X[j]),X)if(R>=0&&R<=y.width-U&&N>=0&&N<=y.height-P){We.bindFramebuffer(H.FRAMEBUFFER,X);const ie=y.texture,he=ie.format,ce=ie.type;if(!mt.textureFormatReadable(he))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!mt.textureTypeReadable(ce))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const fe=H.createBuffer();H.bindBuffer(H.PIXEL_PACK_BUFFER,fe),H.bufferData(H.PIXEL_PACK_BUFFER,z.byteLength,H.STREAM_READ),H.readPixels(R,N,U,P,Ke.convert(he),Ke.convert(ce),0);const ge=T!==null?ze.get(T).__webglFramebuffer:null;We.bindFramebuffer(H.FRAMEBUFFER,ge);const ye=H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE,0);return H.flush(),await p_(H,ye,4),H.bindBuffer(H.PIXEL_PACK_BUFFER,fe),H.getBufferSubData(H.PIXEL_PACK_BUFFER,0,z),H.deleteBuffer(fe),H.deleteSync(ye),z}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(y,R=null,N=0){const U=Math.pow(2,-N),P=Math.floor(y.image.width*U),z=Math.floor(y.image.height*U),j=R!==null?R.x:0,X=R!==null?R.y:0;L.setTexture2D(y,0),H.copyTexSubImage2D(H.TEXTURE_2D,N,0,0,j,X,P,z),We.unbindTexture()};const B=H.createFramebuffer(),k=H.createFramebuffer();this.copyTextureToTexture=function(y,R,N=null,U=null,P=0,z=null){z===null&&(P!==0?(Hc("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),z=P,P=0):z=0);let j,X,ie,he,ce,fe,ge,ye,Pe;const je=y.isCompressedTexture?y.mipmaps[z]:y.image;if(N!==null)j=N.max.x-N.min.x,X=N.max.y-N.min.y,ie=N.isBox3?N.max.z-N.min.z:1,he=N.min.x,ce=N.min.y,fe=N.isBox3?N.min.z:0;else{const Cn=Math.pow(2,-P);j=Math.floor(je.width*Cn),X=Math.floor(je.height*Cn),y.isDataArrayTexture?ie=je.depth:y.isData3DTexture?ie=Math.floor(je.depth*Cn):ie=1,he=0,ce=0,fe=0}U!==null?(ge=U.x,ye=U.y,Pe=U.z):(ge=0,ye=0,Pe=0);const Ve=Ke.convert(R.format),Le=Ke.convert(R.type);let rt;R.isData3DTexture?(L.setTexture3D(R,0),rt=H.TEXTURE_3D):R.isDataArrayTexture||R.isCompressedArrayTexture?(L.setTexture2DArray(R,0),rt=H.TEXTURE_2D_ARRAY):(L.setTexture2D(R,0),rt=H.TEXTURE_2D),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,R.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,R.unpackAlignment);const ke=H.getParameter(H.UNPACK_ROW_LENGTH),It=H.getParameter(H.UNPACK_IMAGE_HEIGHT),mn=H.getParameter(H.UNPACK_SKIP_PIXELS),vt=H.getParameter(H.UNPACK_SKIP_ROWS),Et=H.getParameter(H.UNPACK_SKIP_IMAGES);H.pixelStorei(H.UNPACK_ROW_LENGTH,je.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,je.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,he),H.pixelStorei(H.UNPACK_SKIP_ROWS,ce),H.pixelStorei(H.UNPACK_SKIP_IMAGES,fe);const Xe=y.isDataArrayTexture||y.isData3DTexture,Xt=R.isDataArrayTexture||R.isData3DTexture;if(y.isDepthTexture){const Cn=ze.get(y),Ut=ze.get(R),xn=ze.get(Cn.__renderTarget),Qp=ze.get(Ut.__renderTarget);We.bindFramebuffer(H.READ_FRAMEBUFFER,xn.__webglFramebuffer),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,Qp.__webglFramebuffer);for(let Wr=0;Wr<ie;Wr++)Xe&&(H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,ze.get(y).__webglTexture,P,fe+Wr),H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,ze.get(R).__webglTexture,z,Pe+Wr)),H.blitFramebuffer(he,ce,j,X,ge,ye,j,X,H.DEPTH_BUFFER_BIT,H.NEAREST);We.bindFramebuffer(H.READ_FRAMEBUFFER,null),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else if(P!==0||y.isRenderTargetTexture||ze.has(y)){const Cn=ze.get(y),Ut=ze.get(R);We.bindFramebuffer(H.READ_FRAMEBUFFER,B),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,k);for(let xn=0;xn<ie;xn++)Xe?H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,Cn.__webglTexture,P,fe+xn):H.framebufferTexture2D(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Cn.__webglTexture,P),Xt?H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,Ut.__webglTexture,z,Pe+xn):H.framebufferTexture2D(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Ut.__webglTexture,z),P!==0?H.blitFramebuffer(he,ce,j,X,ge,ye,j,X,H.COLOR_BUFFER_BIT,H.NEAREST):Xt?H.copyTexSubImage3D(rt,z,ge,ye,Pe+xn,he,ce,j,X):H.copyTexSubImage2D(rt,z,ge,ye,he,ce,j,X);We.bindFramebuffer(H.READ_FRAMEBUFFER,null),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else Xt?y.isDataTexture||y.isData3DTexture?H.texSubImage3D(rt,z,ge,ye,Pe,j,X,ie,Ve,Le,je.data):R.isCompressedArrayTexture?H.compressedTexSubImage3D(rt,z,ge,ye,Pe,j,X,ie,Ve,je.data):H.texSubImage3D(rt,z,ge,ye,Pe,j,X,ie,Ve,Le,je):y.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,z,ge,ye,j,X,Ve,Le,je.data):y.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,z,ge,ye,je.width,je.height,Ve,je.data):H.texSubImage2D(H.TEXTURE_2D,z,ge,ye,j,X,Ve,Le,je);H.pixelStorei(H.UNPACK_ROW_LENGTH,ke),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,It),H.pixelStorei(H.UNPACK_SKIP_PIXELS,mn),H.pixelStorei(H.UNPACK_SKIP_ROWS,vt),H.pixelStorei(H.UNPACK_SKIP_IMAGES,Et),z===0&&R.generateMipmaps&&H.generateMipmap(rt),We.unbindTexture()},this.copyTextureToTexture3D=function(y,R,N=null,U=null,P=0){return Hc('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(y,R,N,U,P)},this.initRenderTarget=function(y){ze.get(y).__webglFramebuffer===void 0&&L.setupRenderTarget(y)},this.initTexture=function(y){y.isCubeTexture?L.setTextureCube(y,0):y.isData3DTexture?L.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?L.setTexture2DArray(y,0):L.setTexture2D(y,0),We.unbindTexture()},this.resetState=function(){w=0,I=0,T=null,We.reset(),it.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Xi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=tt._getDrawingBufferColorSpace(e),t.unpackColorSpace=tt._getUnpackColorSpace()}}var Do=function(){var i=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(h){h.preventDefault(),n(++i%e.children.length)},!1);function t(h){return e.appendChild(h.dom),h}function n(h){for(var u=0;u<e.children.length;u++)e.children[u].style.display=u===h?"block":"none";i=h}var s=(performance||Date).now(),r=s,a=0,o=t(new Do.Panel("FPS","#0ff","#002")),c=t(new Do.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new Do.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:e,addPanel:t,showPanel:n,begin:function(){s=(performance||Date).now()},end:function(){a++;var h=(performance||Date).now();if(c.update(h-s,200),h>=r+1e3&&(o.update(a*1e3/(h-r),100),r=h,a=0,l)){var u=performance.memory;l.update(u.usedJSHeapSize/1048576,u.jsHeapSizeLimit/1048576)}return h},update:function(){s=this.end()},domElement:e,setMode:n}};Do.Panel=function(i,e,t){var n=1/0,s=0,r=Math.round,a=r(window.devicePixelRatio||1),o=80*a,c=48*a,l=3*a,h=2*a,u=3*a,d=15*a,f=74*a,p=30*a,m=document.createElement("canvas");m.width=o,m.height=c,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*a+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=t,g.fillRect(0,0,o,c),g.fillStyle=e,g.fillText(i,l,h),g.fillRect(u,d,f,p),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(u,d,f,p),{dom:m,update:function(A,_){n=Math.min(n,A),s=Math.max(s,A),g.fillStyle=t,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=e,g.fillText(r(A)+" "+i+" ("+r(n)+"-"+r(s)+")",l,h),g.drawImage(m,u+a,d,f-a,p,u,d,f-a,p),g.fillRect(u+f-a,d,a,p),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(u+f-a,d,a,r((1-A/_)*p))}}};function Jg(i,e){if(e===Qy)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===Cu||e===sA){let t=i.getIndex();if(t===null){const a=[],o=i.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);i.setIndex(a),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,s=[];if(e===Cu)for(let a=1;a<=n;a++)s.push(t.getX(0)),s.push(t.getX(a)),s.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(s.push(t.getX(a)),s.push(t.getX(a+1)),s.push(t.getX(a+2))):(s.push(t.getX(a+2)),s.push(t.getX(a+1)),s.push(t.getX(a)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=i.clone();return r.setIndex(s),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}class Id extends oi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new r1(t)}),this.register(function(t){return new a1(t)}),this.register(function(t){return new A1(t)}),this.register(function(t){return new g1(t)}),this.register(function(t){return new m1(t)}),this.register(function(t){return new c1(t)}),this.register(function(t){return new l1(t)}),this.register(function(t){return new h1(t)}),this.register(function(t){return new u1(t)}),this.register(function(t){return new s1(t)}),this.register(function(t){return new d1(t)}),this.register(function(t){return new o1(t)}),this.register(function(t){return new p1(t)}),this.register(function(t){return new f1(t)}),this.register(function(t){return new n1(t)}),this.register(function(t){return new x1(t)}),this.register(function(t){return new b1(t)})}load(e,t,n,s){const r=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=Ar.extractUrlBase(e);a=Ar.resolveURL(l,this.path)}else a=Ar.extractUrlBase(e);this.manager.itemStart(e);const o=function(l){s?s(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new as(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,s){let r;const 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))===Zg){try{a[At.KHR_BINARY_GLTF]=new E1(e)}catch(u){s&&s(u);return}r=JSON.parse(a[At.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new N1(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++){const 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){const u=r.extensionsUsed[h],d=r.extensionsRequired||[];switch(u){case At.KHR_MATERIALS_UNLIT:a[u]=new i1;break;case At.KHR_DRACO_MESH_COMPRESSION:a[u]=new y1(r,this.dracoLoader);break;case At.KHR_TEXTURE_TRANSFORM:a[u]=new _1;break;case At.KHR_MESH_QUANTIZATION:a[u]=new w1;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,s)}parseAsync(e,t){const n=this;return new Promise(function(s,r){n.parse(e,t,s,r)})}}function t1(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}const At={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",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class n1{constructor(e){this.parser=e,this.name=At.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){const 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){const t=this.parser,n="light:"+e;let s=t.cache.get(n);if(s)return s;const r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let l;const h=new Fe(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],un);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new fd(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Il(h),l.distance=u;break;case"spot":l=new pg(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),os(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(l),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const 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)})}}class i1{constructor(){this.name=At.KHR_MATERIALS_UNLIT}getMaterialType(){return Ds}extendParams(e,t,n){const s=[];e.color=new Fe(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],un),e.opacity=a[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",r.baseColorTexture,yt))}return Promise.all(s)}}class s1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class r1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Je(o,o)}return Promise.all(r)}}class a1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class o1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class c1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Fe(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=s.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],un)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,yt)),a.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class l1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class h1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new Fe().setRGB(o[0],o[1],o[2],un),Promise.all(r)}}class u1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class d1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new Fe().setRGB(o[0],o[1],o[2],un),a.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,yt)),Promise.all(r)}}class f1{constructor(e){this.parser=e,this.name=At.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class p1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ui}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class A1{constructor(e){this.parser=e,this.name=At.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const r=s.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)}}class g1{constructor(e){this.parser=e,this.name=At.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=s.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class m1{constructor(e){this.parser=e,this.name=At.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=s.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class x1{constructor(e){this.name=At.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.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){const c=s.byteOffset||0,l=s.byteLength||0,h=s.count,u=s.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,s.mode,s.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(f),h,u,d,s.mode,s.filter),f})})}else return null}}class b1{constructor(e){this.name=At.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=t.meshes[n.mesh];for(const l of s.primitives)if(l.mode!==ci.TRIANGLES&&l.mode!==ci.TRIANGLE_STRIP&&l.mode!==ci.TRIANGLE_FAN&&l.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],c={};for(const 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=>{const h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,f=[];for(const p of u){const m=new Re,g=new G,A=new Yt,_=new G(1,1,1),x=new WA(p.geometry,p.material,d);for(let E=0;E<d;E++)c.TRANSLATION&&g.fromBufferAttribute(c.TRANSLATION,E),c.ROTATION&&A.fromBufferAttribute(c.ROTATION,E),c.SCALE&&_.fromBufferAttribute(c.SCALE,E),x.setMatrixAt(E,m.compose(g,A,_));for(const E in c)if(E==="_COLOR_0"){const S=c[E];x.instanceColor=new ed(S.array,S.itemSize,S.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,c[E]);Tt.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),f.push(x)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}}const Zg="glTF",Lo=12,$g={JSON:1313821514,BIN:5130562};class E1{constructor(e){this.name=At.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Lo),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!==Zg)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-Lo,r=new DataView(e,Lo);let a=0;for(;a<s;){const o=r.getUint32(a,!0);a+=4;const c=r.getUint32(a,!0);if(a+=4,c===$g.JSON){const l=new Uint8Array(e,Lo+a,o);this.content=n.decode(l)}else if(c===$g.BIN){const l=Lo+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class y1{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=At.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,s=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(const h in a){const u=Md[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=Md[h]||h.toLowerCase();if(a[h]!==void 0){const d=n.accessors[e.attributes[h]],f=va[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){s.decodeDracoFile(h,function(f){for(const p in f.attributes){const m=f.attributes[p],g=c[p];g!==void 0&&(m.normalized=g)}u(f)},o,l,un,d)})})}}class _1{constructor(){this.name=At.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}}class w1{constructor(){this.name=At.KHR_MESH_QUANTIZATION}}class em extends To{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let a=0;a!==s;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,s){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=s-t,u=(n-t)/h,d=u*u,f=d*u,p=e*l,m=p-l,g=-2*f+3*d,A=f-d,_=1-g,x=A-d+u;for(let E=0;E!==o;E++){const S=a[m+E+o],w=a[m+E+c]*h,I=a[p+E+o],T=a[p+E]*h;r[E]=_*S+x*w+g*I+A*T}return r}}const v1=new Yt;class C1 extends em{interpolate_(e,t,n,s){const r=super.interpolate_(e,t,n,s);return v1.fromArray(r).normalize().toArray(r),r}}const ci={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},va={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},tm={9728:Ln,9729:qt,9984:Xp,9985:Bc,9986:to,9987:si},nm={33071:Jn,33648:Mc,10497:Ss},Sd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Md={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"},Qs={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},I1={CUBICSPLINE:void 0,LINEAR:fo,STEP:uo},Bd={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function S1(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new Bo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ki})),i.DefaultMaterial}function Er(i,e,t){for(const n in t.extensions)i[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function os(i,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(i.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function M1(i,e,t){let n=!1,s=!1,r=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(s=!0),u.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(i);const a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(n){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):i.attributes.position;a.push(d)}if(s){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):i.attributes.normal;o.push(d)}if(r){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):i.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],d=l[2];return n&&(i.morphAttributes.position=h),s&&(i.morphAttributes.normal=u),r&&(i.morphAttributes.color=d),i.morphTargetsRelative=!0,i})}function B1(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)i.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function T1(i){let e;const t=i.extensions&&i.extensions[At.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Td(t.attributes):e=i.indices+":"+Td(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,s=i.targets.length;n<s;n++)e+=":"+Td(i.targets[n]);return e}function Td(i){let e="";const t=Object.keys(i).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+i[t[n]]+";";return e}function Rd(i){switch(i){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 R1(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const F1=new Re;class N1{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new t1,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,s=-1,r=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const c=o.match(/Version\/(\d+)/);s=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&&s<17||r&&a<98?this.textureLoader=new ug(this.options.manager):this.textureLoader=new Pw(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new as(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){const n=this,s=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){const o={scene:a[0][s.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:s.asset,parser:n,userData:{}};return Er(r,o,s),os(o,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(const c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const a=t[s].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let s=0,r=e.length;s<r;s++){const a=e[s];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;const s=n.clone(),r=(a,o)=>{const c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(const[l,h]of a.children.entries())r(h,o.children[l])};return r(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const s=e(t[n]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let s=0;s<t.length;s++){const r=e(t[s]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const 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[At.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(r,a){n.load(Ar.resolveURL(t.uri,s.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const s=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const a=Sd[s.type],o=va[s.componentType],c=s.normalized===!0,l=new o(s.count*a);return Promise.resolve(new Sn(l,a,c))}const r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(a){const o=a[0],c=Sd[s.type],l=va[s.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=s.byteOffset||0,f=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,p=s.normalized===!0;let m,g;if(f&&f!==u){const A=Math.floor(d/f),_="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+A+":"+s.count;let x=t.cache.get(_);x||(m=new l(o,A*f,s.count*f/h),x=new z_(m,f/h),t.cache.add(_,x)),g=new Ju(x,c,d%f/h,p)}else o===null?m=new l(s.count*c):m=new l(o,d,s.count*c),g=new Sn(m,c,p);if(s.sparse!==void 0){const A=Sd.SCALAR,_=va[s.sparse.indices.componentType],x=s.sparse.indices.byteOffset||0,E=s.sparse.values.byteOffset||0,S=new _(a[1],x,s.sparse.count*A),w=new l(a[2],E,s.sparse.count*c);o!==null&&(g=new Sn(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let I=0,T=S.length;I<T;I++){const C=S[I];if(g.setX(C,w[I*c]),c>=2&&g.setY(C,w[I*c+1]),c>=3&&g.setZ(C,w[I*c+2]),c>=4&&g.setW(C,w[I*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=p}return g})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,a=t.images[r];let o=this.textureLoader;if(a.uri){const c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){const s=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];const 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);const d=(r.samplers||{})[a.sampler]||{};return h.magFilter=tm[d.magFilter]||qt,h.minFilter=tm[d.minFilter]||si,h.wrapS=nm[d.wrapS]||Ss,h.wrapT=nm[d.wrapT]||Ss,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Ln&&h.minFilter!==qt,s.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=s.images[e],o=self.URL||self.webkitURL;let c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;const 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");const h=Promise.resolve(c).then(function(u){return new Promise(function(d,f){let p=d;t.isImageBitmapLoader===!0&&(p=function(m){const g=new nn(m);g.needsUpdate=!0,d(g)}),t.load(Ar.resolveURL(u,r.path),p,void 0,f)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),os(u,a),u.userData.mimeType=a.mimeType||R1(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,s){const 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[At.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[At.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=r.associations.get(a);a=r.extensions[At.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,c)}}return s!==void 0&&(a.colorSpace=s),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new sd,ri.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){const o="LineBasicMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new ma,ri.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(s||r||a){let o="ClonedMaterial:"+n.uuid+":";s&&(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),s&&(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 Bo}loadMaterial(e){const t=this,n=this.json,s=this.extensions,r=n.materials[e];let a;const o={},c=r.extensions||{},l=[];if(c[At.KHR_MATERIALS_UNLIT]){const u=s[At.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{const u=r.pbrMetallicRoughness||{};if(o.color=new Fe(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],un),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,yt)),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=Li);const h=r.alphaMode||Bd.OPAQUE;if(h===Bd.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Bd.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==Ds&&(l.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Je(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==Ds&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==Ds){const u=r.emissiveFactor;o.emissive=new Fe().setRGB(u[0],u[1],u[2],un)}return r.emissiveTexture!==void 0&&a!==Ds&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,yt)),Promise.all(l).then(function(){const u=new a(o);return r.name&&(u.name=r.name),os(u,r),t.associations.set(u,{materials:e}),r.extensions&&Er(s,u,r),u})}createUniqueName(e){const t=_t.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,s=this.primitiveCache;function r(o){return n[At.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return im(c,o,t)})}const a=[];for(let o=0,c=e.length;o<c;o++){const l=e[o],h=T1(l),u=s[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[At.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=im(new Mn,l,t),s[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,s=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let c=0,l=a.length;c<l;c++){const h=a[c].material===void 0?S1(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let f=0,p=h.length;f<p;f++){const m=h[f],g=a[f];let A;const _=l[f];if(g.mode===ci.TRIANGLES||g.mode===ci.TRIANGLE_STRIP||g.mode===ci.TRIANGLE_FAN||g.mode===void 0)A=r.isSkinnedMesh===!0?new GA(m,_):new Zt(m,_),A.isSkinnedMesh===!0&&A.normalizeSkinWeights(),g.mode===ci.TRIANGLE_STRIP?A.geometry=Jg(A.geometry,sA):g.mode===ci.TRIANGLE_FAN&&(A.geometry=Jg(A.geometry,Cu));else if(g.mode===ci.LINES)A=new gl(m,_);else if(g.mode===ci.LINE_STRIP)A=new pl(m,_);else if(g.mode===ci.LINE_LOOP)A=new X_(m,_);else if(g.mode===ci.POINTS)A=new Y_(m,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(A.geometry.morphAttributes).length>0&&B1(A,r),A.name=t.createUniqueName(r.name||"mesh_"+e),os(A,r),g.extensions&&Er(s,A,g),t.assignFinalMaterial(A),u.push(A)}for(let f=0,p=u.length;f<p;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return r.extensions&&Er(s,u[0],r),u[0];const d=new is;r.extensions&&Er(s,d,r),t.associations.set(d,{meshes:e});for(let f=0,p=u.length;f<p;f++)d.add(u[f]);return d})}loadCamera(e){let t;const n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Bn(In.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new dd(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),os(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,r=t.joints.length;s<r;s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const r=s.pop(),a=s,o=[],c=[];for(let l=0,h=a.length;l<h;l++){const u=a[l];if(u){o.push(u);const d=new Re;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 cl(o,c)})}loadAnimation(e){const t=this.json,n=this,s=t.animations[e],r=s.name?s.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=s.channels.length;u<d;u++){const f=s.channels[u],p=s.samplers[f.sampler],m=f.target,g=m.node,A=s.parameters!==void 0?s.parameters[p.input]:p.input,_=s.parameters!==void 0?s.parameters[p.output]:p.output;m.node!==void 0&&(a.push(this.getDependency("node",g)),o.push(this.getDependency("accessor",A)),c.push(this.getDependency("accessor",_)),l.push(p),h.push(m))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const d=u[0],f=u[1],p=u[2],m=u[3],g=u[4],A=[];for(let _=0,x=d.length;_<x;_++){const E=d[_],S=f[_],w=p[_],I=m[_],T=g[_];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();const C=n._createAnimationTracks(E,S,w,I,T);if(C)for(let v=0;v<C.length;v++)A.push(C[v])}return new Cl(r,void 0,A)})}createNodeMesh(e){const t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(r){const a=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=s.weights.length;c<l;c++)o.morphTargetInfluences[c]=s.weights[c]}),a})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=s.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(a),c]).then(function(l){const h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,F1)});for(let f=0,p=u.length;f<p;f++)h.add(u[f]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],a=r.name?s.createUniqueName(r.name):"",o=[],c=s._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),r.camera!==void 0&&o.push(s.getDependency("camera",r.camera).then(function(l){return s._getNodeRef(s.cameraCache,r.camera,l)})),s._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 al:l.length>1?h=new is:l.length===1?h=l[0]:h=new Tt,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),os(h,r),r.extensions&&Er(n,h,r),r.matrix!==void 0){const u=new Re;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);return s.associations.has(h)||s.associations.set(h,{}),s.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],s=this,r=new is;n.name&&(r.name=s.createUniqueName(n.name)),os(r,n),n.extensions&&Er(t,r,n);const a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(s.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++)r.add(c[h]);const l=h=>{const u=new Map;for(const[d,f]of s.associations)(d instanceof ri||d instanceof nn)&&u.set(d,f);return h.traverse(d=>{const f=s.associations.get(d);f!=null&&u.set(d,f)}),u};return s.associations=l(r),r})}_createAnimationTracks(e,t,n,s,r){const a=[],o=e.name?e.name:e.uuid,c=[];Qs[r.path]===Qs.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(Qs[r.path]){case Qs.weights:l=fr;break;case Qs.rotation:l=Us;break;case Qs.translation:case Qs.scale:l=pr;break;default:n.itemSize===1?l=fr:l=pr;break}const h=s.interpolation!==void 0?I1[s.interpolation]:fo,u=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d<f;d++){const p=new l(c[d]+"."+Qs[r.path],t.array,u,h);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(p),a.push(p)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Rd(t.constructor),s=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)s[r]=t[r]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const s=this instanceof Us?C1:em;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function D1(i,e,t){const n=e.attributes,s=new Pi;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(s.set(new G(c[0],c[1],c[2]),new G(l[0],l[1],l[2])),o.normalized){const h=Rd(va[o.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const o=new G,c=new G;for(let l=0,h=r.length;l<h;l++){const u=r[l];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){const m=Rd(va[d.componentType]);c.multiplyScalar(m)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(o)}i.boundingBox=s;const a=new ki;s.getCenter(a.center),a.radius=s.min.distanceTo(s.max)/2,i.boundingSphere=a}function im(i,e,t){const n=e.attributes,s=[];function r(a,o){return t.getDependency("accessor",a).then(function(c){i.setAttribute(o,c)})}for(const a in n){const o=Md[a]||a.toLowerCase();o in i.attributes||s.push(r(n[a],o))}if(e.indices!==void 0&&!i.index){const a=t.getDependency("accessor",e.indices).then(function(o){i.setIndex(o)});s.push(a)}return tt.workingColorSpace!==un&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${tt.workingColorSpace}" not supported.`),os(i,e),D1(i,e,t),Promise.all(s).then(function(){return e.targets!==void 0?M1(i,e.targets,t):i})}var L1=(function(){var i="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok: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;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",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 s=WebAssembly.validate(t)?e:i,r,a=WebAssembly.instantiate(o(s),{}).then(function(A){r=A.instance,r.exports.__wasm_call_ctors()});function o(A){for(var _=new Uint8Array(A.length),x=0;x<A.length;++x){var E=A.charCodeAt(x);_[x]=E>96?E-97:E>64?E-39:E+4}for(var S=0,x=0;x<A.length;++x)_[S++]=_[x]<60?n[_[x]]:(_[x]-60)*64+_[++x];return _.buffer.slice(0,S)}function c(A,_,x,E,S,w){var I=r.exports.sbrk,T=x+3&-4,C=I(T*E),v=I(S.length),F=new Uint8Array(r.exports.memory.buffer);F.set(S,v);var K=A(C,x,E,v,S.length);if(K==0&&w&&w(C,T,E),_.set(F.subarray(C,C+x*E)),I(C-I(0)),K!=0)throw new Error("Malformed buffer data: "+K)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;function f(A){var _={object:new Worker(A),pending:0,requests:{}};return _.object.onmessage=function(x){var E=x.data;_.pending-=E.count,_.requests[E.id][E.action](E.value),delete _.requests[E.id]},_}function p(A){for(var _="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(o(s))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+c.toString()+g.toString(),x=new Blob([_],{type:"text/javascript"}),E=URL.createObjectURL(x),S=0;S<A;++S)u[S]=f(E);URL.revokeObjectURL(E)}function m(A,_,x,E,S){for(var w=u[0],I=1;I<u.length;++I)u[I].pending<w.pending&&(w=u[I]);return new Promise(function(T,C){var v=new Uint8Array(x),F=d++;w.pending+=A,w.requests[F]={resolve:T,reject:C},w.object.postMessage({id:F,count:A,size:_,source:v,mode:E,filter:S},[v.buffer])})}function g(A){a.then(function(){var _=A.data;try{var x=new Uint8Array(_.count*_.size);c(r.exports[_.mode],x,_.count,_.size,_.source,r.exports[_.filter]),self.postMessage({id:_.id,count:_.count,action:"resolve",value:x},[x.buffer])}catch(E){self.postMessage({id:_.id,count:_.count,action:"reject",value:E})}})}return{ready:a,supported:!0,useWorkers:function(A){p(A)},decodeVertexBuffer:function(A,_,x,E,S){c(r.exports.meshopt_decodeVertexBuffer,A,_,x,E,r.exports[l[S]])},decodeIndexBuffer:function(A,_,x,E){c(r.exports.meshopt_decodeIndexBuffer,A,_,x,E)},decodeIndexSequence:function(A,_,x,E){c(r.exports.meshopt_decodeIndexSequence,A,_,x,E)},decodeGltfBuffer:function(A,_,x,E,S,w){c(r.exports[h[S]],A,_,x,E,r.exports[l[w]])},decodeGltfBufferAsync:function(A,_,x,E,S){return u.length>0?m(A,_,x,h[E],l[S]):a.then(function(){var w=new Uint8Array(A*_);return c(r.exports[h[E]],w,A,_,x,r.exports[l[S]]),w})}}})();const sm={type:"change"},Fd={type:"start"},rm={type:"end"},Nl=new bo,am=new ks,P1=Math.cos(70*In.DEG2RAD),An=new G,Kn=2*Math.PI,Ft={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Nd=1e-6;class k1 extends Zw{constructor(e,t=null){super(e,t),this.state=Ft.NONE,this.target=new G,this.cursor=new G,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qr.ROTATE,MIDDLE:qr.DOLLY,RIGHT:qr.PAN},this.touches={ONE:Kr.ROTATE,TWO:Kr.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new G,this._lastQuaternion=new Yt,this._lastTargetPosition=new G,this._quat=new Yt().setFromUnitVectors(e.up,new G(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new xg,this._sphericalDelta=new xg,this._scale=1,this._panOffset=new G,this._rotateStart=new Je,this._rotateEnd=new Je,this._rotateDelta=new Je,this._panStart=new Je,this._panEnd=new Je,this._panDelta=new Je,this._dollyStart=new Je,this._dollyEnd=new Je,this._dollyDelta=new Je,this._dollyDirection=new G,this._mouse=new Je,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=O1.bind(this),this._onPointerDown=U1.bind(this),this._onPointerUp=Q1.bind(this),this._onContextMenu=K1.bind(this),this._onMouseWheel=z1.bind(this),this._onKeyDown=V1.bind(this),this._onTouchStart=W1.bind(this),this._onTouchMove=q1.bind(this),this._onMouseDown=G1.bind(this),this._onMouseMove=H1.bind(this),this._interceptControlDown=j1.bind(this),this._interceptControlUp=X1.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(sm),this.update(),this.state=Ft.NONE}update(e=null){const t=this.object.position;An.copy(t).sub(this.target),An.applyQuaternion(this._quat),this._spherical.setFromVector3(An),this.autoRotate&&this.state===Ft.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(n)&&isFinite(s)&&(n<-Math.PI?n+=Kn:n>Math.PI&&(n-=Kn),s<-Math.PI?s+=Kn:s>Math.PI&&(s-=Kn),n<=s?this._spherical.theta=Math.max(n,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+s)/2?Math.max(n,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(An.setFromSpherical(this._spherical),An.applyQuaternion(this._quatInverse),t.copy(this.target).add(An),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=An.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){const o=new G(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;const l=new G(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=An.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Nl.origin.copy(this.object.position),Nl.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Nl.direction))<P1?this.object.lookAt(this.target):(am.setFromNormalAndCoplanarPoint(this.object.up,this.target),Nl.intersectPlane(am,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Nd||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Nd||this._lastTargetPosition.distanceToSquared(this.target)>Nd?(this.dispatchEvent(sm),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Kn/60*this.autoRotateSpeed*e:Kn/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){An.setFromMatrixColumn(t,0),An.multiplyScalar(-e),this._panOffset.add(An)}_panUp(e,t){this.screenSpacePanning===!0?An.setFromMatrixColumn(t,1):(An.setFromMatrixColumn(t,0),An.crossVectors(this.object.up,An)),An.multiplyScalar(e),this._panOffset.add(An)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;An.copy(s).sub(this.target);let r=An.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),s=e-n.left,r=t-n.top,a=n.width,o=n.height;this._mouse.x=s/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Kn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Kn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Kn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Kn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Kn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Kn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._rotateStart.set(n,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panStart.set(n,s)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),s=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Kn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Kn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panEnd.set(n,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Je,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function U1(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function O1(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function Q1(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(rm),this.state=Ft.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function G1(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Ft.DOLLY;break;case qr.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ft.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ft.ROTATE}break;case qr.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ft.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ft.PAN}break;default:this.state=Ft.NONE}this.state!==Ft.NONE&&this.dispatchEvent(Fd)}function H1(i){switch(this.state){case Ft.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Ft.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Ft.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function z1(i){this.enabled===!1||this.enableZoom===!1||this.state!==Ft.NONE||(i.preventDefault(),this.dispatchEvent(Fd),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(rm))}function V1(i){this.enabled!==!1&&this._handleKeyDown(i)}function W1(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Kr.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Ft.TOUCH_ROTATE;break;case Kr.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Ft.TOUCH_PAN;break;default:this.state=Ft.NONE}break;case 2:switch(this.touches.TWO){case Kr.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Ft.TOUCH_DOLLY_PAN;break;case Kr.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Ft.TOUCH_DOLLY_ROTATE;break;default:this.state=Ft.NONE}break;default:this.state=Ft.NONE}this.state!==Ft.NONE&&this.dispatchEvent(Fd)}function q1(i){switch(this._trackPointer(i),this.state){case Ft.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Ft.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Ft.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Ft.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Ft.NONE}}function K1(i){this.enabled!==!1&&i.preventDefault()}function j1(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function X1(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class Y1 extends Yu{constructor(){super();const e=new da;e.deleteAttribute("uv");const t=new Bo({side:Dn}),n=new Bo,s=new Il(16777215,900,28,2);s.position.set(.418,16.199,.3),this.add(s);const r=new Zt(e,t);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const a=new WA(e,n,6),o=new Tt;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);const c=new Zt(e,Ca(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);const l=new Zt(e,Ca(50));l.position.set(-16.109,18.021,-8.207),l.scale.set(.1,2.425,2.751),this.add(l);const h=new Zt(e,Ca(17));h.position.set(14.904,12.198,-1.832),h.scale.set(.15,4.265,6.331),this.add(h);const u=new Zt(e,Ca(43));u.position.set(-.462,8.89,14.52),u.scale.set(4.38,5.441,.088),this.add(u);const d=new Zt(e,Ca(20));d.position.set(3.235,11.486,-12.541),d.scale.set(2.5,2,.1),this.add(d);const f=new Zt(e,Ca(100));f.position.set(0,20,0),f.scale.set(1,.1,1),this.add(f)}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}}function Ca(i){const e=new Ds;return e.color.setScalar(i),e}function J1(i){if(!(typeof window>"u")){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=i,document.head.appendChild(e),i}}function Ia(i,e){var t=i.__state.conversionName.toString(),n=Math.round(i.r),s=Math.round(i.g),r=Math.round(i.b),a=i.a,o=Math.round(i.h),c=i.s.toFixed(1),l=i.v.toFixed(1);if(e||t==="THREE_CHAR_HEX"||t==="SIX_CHAR_HEX"){for(var h=i.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}else{if(t==="CSS_RGB")return"rgb("+n+","+s+","+r+")";if(t==="CSS_RGBA")return"rgba("+n+","+s+","+r+","+a+")";if(t==="HEX")return"0x"+i.hex.toString(16);if(t==="RGB_ARRAY")return"["+n+","+s+","+r+"]";if(t==="RGBA_ARRAY")return"["+n+","+s+","+r+","+a+"]";if(t==="RGB_OBJ")return"{r:"+n+",g:"+s+",b:"+r+"}";if(t==="RGBA_OBJ")return"{r:"+n+",g:"+s+",b:"+r+",a:"+a+"}";if(t==="HSV_OBJ")return"{h:"+o+",s:"+c+",v:"+l+"}";if(t==="HSVA_OBJ")return"{h:"+o+",s:"+c+",v:"+l+",a:"+a+"}"}return"unknown format"}var om=Array.prototype.forEach,Po=Array.prototype.slice,ue={BREAK:{},extend:function(e){return this.each(Po.call(arguments,1),function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach((function(s){this.isUndefined(t[s])||(e[s]=t[s])}).bind(this))},this),e},defaults:function(e){return this.each(Po.call(arguments,1),function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach((function(s){this.isUndefined(e[s])&&(e[s]=t[s])}).bind(this))},this),e},compose:function(){var e=Po.call(arguments);return function(){for(var t=Po.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e){if(om&&e.forEach&&e.forEach===om)e.forEach(t,n);else if(e.length===e.length+0){var s=void 0,r=void 0;for(s=0,r=e.length;s<r;s++)if(s in e&&t.call(n,e[s],s)===this.BREAK)return}else for(var a in e)if(t.call(n,e[a],a)===this.BREAK)return}},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var s=void 0;return function(){var r=this,a=arguments;function o(){s=null,n||e.apply(r,a)}var c=n||!s;clearTimeout(s),s=setTimeout(o,t),c&&e.apply(r,a)}},toArray:function(e){return e.toArray?e.toArray():Po.call(e)},isUndefined:function(e){return e===void 0},isNull:function(e){return e===null},isNaN:(function(i){function e(t){return i.apply(this,arguments)}return e.toString=function(){return i.toString()},e})(function(i){return isNaN(i)}),isArray:Array.isArray||function(i){return i.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return e===!1||e===!0},isFunction:function(e){return e instanceof Function}},Z1=[{litmus:ue.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return t===null?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:Ia},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return t===null?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:Ia},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t===null?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:Ia},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t===null?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:Ia}}},{litmus:ue.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:ue.isArray,conversions:{RGB_ARRAY:{read:function(e){return e.length!==3?!1:{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return e.length!==4?!1:{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:ue.isObject,conversions:{RGBA_OBJ:{read:function(e){return ue.isNumber(e.r)&&ue.isNumber(e.g)&&ue.isNumber(e.b)&&ue.isNumber(e.a)?{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return ue.isNumber(e.r)&&ue.isNumber(e.g)&&ue.isNumber(e.b)?{space:"RGB",r:e.r,g:e.g,b:e.b}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return ue.isNumber(e.h)&&ue.isNumber(e.s)&&ue.isNumber(e.v)&&ue.isNumber(e.a)?{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return ue.isNumber(e.h)&&ue.isNumber(e.s)&&ue.isNumber(e.v)?{space:"HSV",h:e.h,s:e.s,v:e.v}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],ko=void 0,Dl=void 0,Dd=function(){Dl=!1;var e=arguments.length>1?ue.toArray(arguments):arguments[0];return ue.each(Z1,function(t){if(t.litmus(e))return ue.each(t.conversions,function(n,s){if(ko=n.read(e),Dl===!1&&ko!==!1)return Dl=ko,ko.conversionName=s,ko.conversion=n,ue.BREAK}),ue.BREAK}),Dl},cm=void 0,Ll={hsv_to_rgb:function(e,t,n){var s=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),a=n*(1-t),o=n*(1-r*t),c=n*(1-(1-r)*t),l=[[n,c,a],[o,n,a],[a,n,c],[a,o,n],[c,a,n],[n,a,o]][s];return{r:l[0]*255,g:l[1]*255,b:l[2]*255}},rgb_to_hsv:function(e,t,n){var s=Math.min(e,t,n),r=Math.max(e,t,n),a=r-s,o=void 0,c=void 0;if(r!==0)c=a/r;else return{h:NaN,s:0,v:0};return e===r?o=(t-n)/a:t===r?o=2+(n-e)/a:o=4+(e-t)/a,o/=6,o<0&&(o+=1),{h:o*360,s:c,v:r/255}},rgb_to_hex:function(e,t,n){var s=this.hex_with_component(0,2,e);return s=this.hex_with_component(s,1,t),s=this.hex_with_component(s,0,n),s},component_from_hex:function(e,t){return e>>t*8&255},hex_with_component:function(e,t,n){return n<<(cm=t*8)|e&~(255<<cm)}},$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},vi=function(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")},Ci=(function(){function i(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}})(),Gs=function i(e,t,n){e===null&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,t);if(s===void 0){var r=Object.getPrototypeOf(e);return r===null?void 0:i(r,t,n)}else{if("value"in s)return s.value;var a=s.get;return a===void 0?void 0:a.call(n)}},Hs=function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(i,e):i.__proto__=e)},zs=function(i,e){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:i},En=(function(){function i(){if(vi(this,i),this.__state=Dd.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return Ci(i,[{key:"toString",value:function(){return Ia(this)}},{key:"toHexString",value:function(){return Ia(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),i})();function Ld(i,e,t){Object.defineProperty(i,e,{get:function(){return this.__state.space==="RGB"?this.__state[e]:(En.recalculateRGB(this,e,t),this.__state[e])},set:function(s){this.__state.space!=="RGB"&&(En.recalculateRGB(this,e,t),this.__state.space="RGB"),this.__state[e]=s}})}function Pd(i,e){Object.defineProperty(i,e,{get:function(){return this.__state.space==="HSV"?this.__state[e]:(En.recalculateHSV(this),this.__state[e])},set:function(n){this.__state.space!=="HSV"&&(En.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=n}})}En.recalculateRGB=function(i,e,t){if(i.__state.space==="HEX")i.__state[e]=Ll.component_from_hex(i.__state.hex,t);else if(i.__state.space==="HSV")ue.extend(i.__state,Ll.hsv_to_rgb(i.__state.h,i.__state.s,i.__state.v));else throw new Error("Corrupted color state")},En.recalculateHSV=function(i){var e=Ll.rgb_to_hsv(i.r,i.g,i.b);ue.extend(i.__state,{s:e.s,v:e.v}),ue.isNaN(e.h)?ue.isUndefined(i.__state.h)&&(i.__state.h=0):i.__state.h=e.h},En.COMPONENTS=["r","g","b","h","s","v","hex","a"],Ld(En.prototype,"r",2),Ld(En.prototype,"g",1),Ld(En.prototype,"b",0),Pd(En.prototype,"h"),Pd(En.prototype,"s"),Pd(En.prototype,"v"),Object.defineProperty(En.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(En.prototype,"hex",{get:function(){return this.__state.space!=="HEX"&&(this.__state.hex=Ll.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var yr=(function(){function i(e,t){vi(this,i),this.initialValue=e[t],this.domElement=document.createElement("div"),this.object=e,this.property=t,this.__onChange=void 0,this.__onFinishChange=void 0}return Ci(i,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),i})(),eM={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},lm={};ue.each(eM,function(i,e){ue.each(i,function(t){lm[t]=e})});var tM=/(\d+(\.\d+)?)px/;function Qi(i){if(i==="0"||ue.isUndefined(i))return 0;var e=i.match(tM);return ue.isNull(e)?0:parseFloat(e[1])}var te={makeSelectable:function(e,t){e===void 0||e.style===void 0||(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var s=n,r=t;ue.isUndefined(r)&&(r=!0),ue.isUndefined(s)&&(s=!0),e.style.position="absolute",r&&(e.style.left=0,e.style.right=0),s&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,s){var r=n||{},a=lm[t];if(!a)throw new Error("Event type "+t+" not supported.");var o=document.createEvent(a);switch(a){case"MouseEvents":{var c=r.x||r.clientX||0,l=r.y||r.clientY||0;o.initMouseEvent(t,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,c,l,!1,!1,!1,!1,0,null);break}case"KeyboardEvents":{var h=o.initKeyboardEvent||o.initKeyEvent;ue.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(t,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break}default:{o.initEvent(t,r.bubbles||!1,r.cancelable||!0);break}}ue.defaults(o,s),e.dispatchEvent(o)},bind:function(e,t,n,s){var r=s||!1;return e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on"+t,n),te},unbind:function(e,t,n,s){var r=s||!1;return e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent&&e.detachEvent("on"+t,n),te},addClass:function(e,t){if(e.className===void 0)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);n.indexOf(t)===-1&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return te},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),s=n.indexOf(t);s!==-1&&(n.splice(s,1),e.className=n.join(" "))}else e.className=void 0;return te},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return Qi(t["border-left-width"])+Qi(t["border-right-width"])+Qi(t["padding-left"])+Qi(t["padding-right"])+Qi(t.width)},getHeight:function(e){var t=getComputedStyle(e);return Qi(t["border-top-width"])+Qi(t["border-bottom-width"])+Qi(t["padding-top"])+Qi(t["padding-bottom"])+Qi(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},hm=(function(i){Hs(e,i);function e(t,n){vi(this,e);var s=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=s;s.__prev=s.getValue(),s.__checkbox=document.createElement("input"),s.__checkbox.setAttribute("type","checkbox");function a(){r.setValue(!r.__prev)}return te.bind(s.__checkbox,"change",a,!1),s.domElement.appendChild(s.__checkbox),s.updateDisplay(),s}return Ci(e,[{key:"setValue",value:function(n){var s=Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),s}},{key:"updateDisplay",value:function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(yr),nM=(function(i){Hs(e,i);function e(t,n,s){vi(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=s,o=r;if(r.__select=document.createElement("select"),ue.isArray(a)){var c={};ue.each(a,function(l){c[l]=l}),a=c}return ue.each(a,function(l,h){var u=document.createElement("option");u.innerHTML=h,u.setAttribute("value",l),o.__select.appendChild(u)}),r.updateDisplay(),te.bind(r.__select,"change",function(){var l=this.options[this.selectedIndex].value;o.setValue(l)}),r.domElement.appendChild(r.__select),r}return Ci(e,[{key:"setValue",value:function(n){var s=Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),s}},{key:"updateDisplay",value:function(){return te.isActive(this.__select)?this:(this.__select.value=this.getValue(),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e})(yr),iM=(function(i){Hs(e,i);function e(t,n){vi(this,e);var s=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=s;function a(){r.setValue(r.__input.value)}function o(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}return s.__input=document.createElement("input"),s.__input.setAttribute("type","text"),te.bind(s.__input,"keyup",a),te.bind(s.__input,"change",a),te.bind(s.__input,"blur",o),te.bind(s.__input,"keydown",function(c){c.keyCode===13&&this.blur()}),s.updateDisplay(),s.domElement.appendChild(s.__input),s}return Ci(e,[{key:"updateDisplay",value:function(){return te.isActive(this.__input)||(this.__input.value=this.getValue()),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(yr);function um(i){var e=i.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var dm=(function(i){Hs(e,i);function e(t,n,s){vi(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=s||{};return r.__min=a.min,r.__max=a.max,r.__step=a.step,ue.isUndefined(r.__step)?r.initialValue===0?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=um(r.__impliedStep),r}return Ci(e,[{key:"setValue",value:function(n){var s=n;return this.__min!==void 0&&s<this.__min?s=this.__min:this.__max!==void 0&&s>this.__max&&(s=this.__max),this.__step!==void 0&&s%this.__step!==0&&(s=Math.round(s/this.__step)*this.__step),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,s)}},{key:"min",value:function(n){return this.__min=n,this}},{key:"max",value:function(n){return this.__max=n,this}},{key:"step",value:function(n){return this.__step=n,this.__impliedStep=n,this.__precision=um(n),this}}]),e})(yr);function sM(i,e){var t=Math.pow(10,e);return Math.round(i*t)/t}var Pl=(function(i){Hs(e,i);function e(t,n,s){vi(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,s));r.__truncationSuspended=!1;var a=r,o=void 0;function c(){var p=parseFloat(a.__input.value);ue.isNaN(p)||a.setValue(p)}function l(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(){l()}function u(p){var m=o-p.clientY;a.setValue(a.getValue()+m*a.__impliedStep),o=p.clientY}function d(){te.unbind(window,"mousemove",u),te.unbind(window,"mouseup",d),l()}function f(p){te.bind(window,"mousemove",u),te.bind(window,"mouseup",d),o=p.clientY}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),te.bind(r.__input,"change",c),te.bind(r.__input,"blur",h),te.bind(r.__input,"mousedown",f),te.bind(r.__input,"keydown",function(p){p.keyCode===13&&(a.__truncationSuspended=!0,this.blur(),a.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return Ci(e,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():sM(this.getValue(),this.__precision),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(dm);function fm(i,e,t,n,s){return n+(s-n)*((i-e)/(t-e))}var kd=(function(i){Hs(e,i);function e(t,n,s,r,a){vi(this,e);var o=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:s,max:r,step:a})),c=o;o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),te.bind(o.__background,"mousedown",l),te.bind(o.__background,"touchstart",d),te.addClass(o.__background,"slider"),te.addClass(o.__foreground,"slider-fg");function l(m){document.activeElement.blur(),te.bind(window,"mousemove",h),te.bind(window,"mouseup",u),h(m)}function h(m){m.preventDefault();var g=c.__background.getBoundingClientRect();return c.setValue(fm(m.clientX,g.left,g.right,c.__min,c.__max)),!1}function u(){te.unbind(window,"mousemove",h),te.unbind(window,"mouseup",u),c.__onFinishChange&&c.__onFinishChange.call(c,c.getValue())}function d(m){m.touches.length===1&&(te.bind(window,"touchmove",f),te.bind(window,"touchend",p),f(m))}function f(m){var g=m.touches[0].clientX,A=c.__background.getBoundingClientRect();c.setValue(fm(g,A.left,A.right,c.__min,c.__max))}function p(){te.unbind(window,"touchmove",f),te.unbind(window,"touchend",p),c.__onFinishChange&&c.__onFinishChange.call(c,c.getValue())}return o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return Ci(e,[{key:"updateDisplay",value:function(){var n=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=n*100+"%",Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(dm),pm=(function(i){Hs(e,i);function e(t,n,s){vi(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=r;return r.__button=document.createElement("div"),r.__button.innerHTML=s===void 0?"Fire":s,te.bind(r.__button,"click",function(o){return o.preventDefault(),a.fire(),!1}),te.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return Ci(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e})(yr),Ud=(function(i){Hs(e,i);function e(t,n){vi(this,e);var s=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));s.__color=new En(s.getValue()),s.__temp=new En(0);var r=s;s.domElement=document.createElement("div"),te.makeSelectable(s.domElement,!1),s.__selector=document.createElement("div"),s.__selector.className="selector",s.__saturation_field=document.createElement("div"),s.__saturation_field.className="saturation-field",s.__field_knob=document.createElement("div"),s.__field_knob.className="field-knob",s.__field_knob_border="2px solid ",s.__hue_knob=document.createElement("div"),s.__hue_knob.className="hue-knob",s.__hue_field=document.createElement("div"),s.__hue_field.className="hue-field",s.__input=document.createElement("input"),s.__input.type="text",s.__input_textShadow="0 1px 1px ",te.bind(s.__input,"keydown",function(m){m.keyCode===13&&u.call(this)}),te.bind(s.__input,"blur",u),te.bind(s.__selector,"mousedown",function(){te.addClass(this,"drag").bind(window,"mouseup",function(){te.removeClass(r.__selector,"drag")})}),te.bind(s.__selector,"touchstart",function(){te.addClass(this,"drag").bind(window,"touchend",function(){te.removeClass(r.__selector,"drag")})});var a=document.createElement("div");ue.extend(s.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),ue.extend(s.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:s.__field_knob_border+(s.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),ue.extend(s.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),ue.extend(s.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),ue.extend(a.style,{width:"100%",height:"100%",background:"none"}),Am(a,"top","rgba(0,0,0,0)","#000"),ue.extend(s.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),aM(s.__hue_field),ue.extend(s.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:s.__input_textShadow+"rgba(0,0,0,0.7)"}),te.bind(s.__saturation_field,"mousedown",o),te.bind(s.__saturation_field,"touchstart",o),te.bind(s.__field_knob,"mousedown",o),te.bind(s.__field_knob,"touchstart",o),te.bind(s.__hue_field,"mousedown",c),te.bind(s.__hue_field,"touchstart",c);function o(m){f(m),te.bind(window,"mousemove",f),te.bind(window,"touchmove",f),te.bind(window,"mouseup",l),te.bind(window,"touchend",l)}function c(m){p(m),te.bind(window,"mousemove",p),te.bind(window,"touchmove",p),te.bind(window,"mouseup",h),te.bind(window,"touchend",h)}function l(){te.unbind(window,"mousemove",f),te.unbind(window,"touchmove",f),te.unbind(window,"mouseup",l),te.unbind(window,"touchend",l),d()}function h(){te.unbind(window,"mousemove",p),te.unbind(window,"touchmove",p),te.unbind(window,"mouseup",h),te.unbind(window,"touchend",h),d()}function u(){var m=Dd(this.value);m!==!1?(r.__color.__state=m,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}s.__saturation_field.appendChild(a),s.__selector.appendChild(s.__field_knob),s.__selector.appendChild(s.__saturation_field),s.__selector.appendChild(s.__hue_field),s.__hue_field.appendChild(s.__hue_knob),s.domElement.appendChild(s.__input),s.domElement.appendChild(s.__selector),s.updateDisplay();function f(m){m.type.indexOf("touch")===-1&&m.preventDefault();var g=r.__saturation_field.getBoundingClientRect(),A=m.touches&&m.touches[0]||m,_=A.clientX,x=A.clientY,E=(_-g.left)/(g.right-g.left),S=1-(x-g.top)/(g.bottom-g.top);return S>1?S=1:S<0&&(S=0),E>1?E=1:E<0&&(E=0),r.__color.v=S,r.__color.s=E,r.setValue(r.__color.toOriginal()),!1}function p(m){m.type.indexOf("touch")===-1&&m.preventDefault();var g=r.__hue_field.getBoundingClientRect(),A=m.touches&&m.touches[0]||m,_=A.clientY,x=1-(_-g.top)/(g.bottom-g.top);return x>1?x=1:x<0&&(x=0),r.__color.h=x*360,r.setValue(r.__color.toOriginal()),!1}return s}return Ci(e,[{key:"updateDisplay",value:function(){var n=Dd(this.getValue());if(n!==!1){var s=!1;ue.each(En.COMPONENTS,function(o){if(!ue.isUndefined(n[o])&&!ue.isUndefined(this.__color.__state[o])&&n[o]!==this.__color.__state[o])return s=!0,{}},this),s&&ue.extend(this.__color.__state,n)}ue.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var r=this.__color.v<.5||this.__color.s>.5?255:0,a=255-r;ue.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+r+","+r+","+r+")"}),this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px",this.__temp.s=1,this.__temp.v=1,Am(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),ue.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+r+","+r+","+r+")",textShadow:this.__input_textShadow+"rgba("+a+","+a+","+a+",.7)"})}}]),e})(yr),rM=["-moz-","-o-","-webkit-","-ms-",""];function Am(i,e,t,n){i.style.background="",ue.each(rM,function(s){i.style.cssText+="background: "+s+"linear-gradient("+e+", "+t+" 0%, "+n+" 100%); "})}function aM(i){i.style.background="",i.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",i.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var oM={load:function(e,t){var n=t||document,s=n.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e,n.getElementsByTagName("head")[0].appendChild(s)},inject:function(e,t){var n=t||document,s=document.createElement("style");s.type="text/css",s.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(s)}catch{}}},cM=`<div id="dg-save" class="dg dialogue">
+}`;class JS{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const s=new nn,r=e.properties.get(s);r.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Ls({vertexShader:XS,fragmentShader:YS,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Zt(new vl(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ZS extends Ms{constructor(e,t){super();const n=this;let s=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,p=null;const m=new JS,g=t.getContextAttributes();let A=null,_=null;const x=[],E=[],S=new Je;let w=null;const I=new Bn;I.viewport=new gt;const T=new Bn;T.viewport=new gt;const C=[I,T],v=new Uw;let F=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let me=x[se];return me===void 0&&(me=new Ju,x[se]=me),me.getTargetRaySpace()},this.getControllerGrip=function(se){let me=x[se];return me===void 0&&(me=new Ju,x[se]=me),me.getGripSpace()},this.getHand=function(se){let me=x[se];return me===void 0&&(me=new Ju,x[se]=me),me.getHandSpace()};function q(se){const me=E.indexOf(se.inputSource);if(me===-1)return;const xe=x[me];xe!==void 0&&(xe.update(se.inputSource,se.frame,l||a),xe.dispatchEvent({type:se.type,data:se.inputSource}))}function $(){s.removeEventListener("select",q),s.removeEventListener("selectstart",q),s.removeEventListener("selectend",q),s.removeEventListener("squeeze",q),s.removeEventListener("squeezestart",q),s.removeEventListener("squeezeend",q),s.removeEventListener("end",$),s.removeEventListener("inputsourceschange",D);for(let se=0;se<x.length;se++){const me=E[se];me!==null&&(E[se]=null,x[se].disconnect(me))}F=null,K=null,m.reset(),e.setRenderTarget(A),f=null,d=null,u=null,s=null,_=null,Me.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(se){r=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(se){o=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(se){l=se},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return s},this.setSession=async function(se){if(s=se,s!==null){if(A=e.getRenderTarget(),s.addEventListener("select",q),s.addEventListener("selectstart",q),s.addEventListener("selectend",q),s.addEventListener("squeeze",q),s.addEventListener("squeezestart",q),s.addEventListener("squeezeend",q),s.addEventListener("end",$),s.addEventListener("inputsourceschange",D),g.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(S),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let xe=null,be=null,Ue=null;g.depth&&(Ue=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,xe=g.stencil?ao:ro,be=g.stencil?so:rr);const et={colorFormat:t.RGBA8,depthFormat:Ue,scaleFactor:r};u=new XRWebGLBinding(s,t),d=u.createProjectionLayer(et),s.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),_=new or(d.textureWidth,d.textureHeight,{format:hn,type:cn,depthTexture:new $A(d.textureWidth,d.textureHeight,be,void 0,void 0,void 0,void 0,void 0,void 0,xe),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const xe={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(s,t,xe),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),_=new or(f.framebufferWidth,f.framebufferHeight,{format:hn,type:cn,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}_.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await s.requestReferenceSpace(o),Me.setContext(s),Me.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function D(se){for(let me=0;me<se.removed.length;me++){const xe=se.removed[me],be=E.indexOf(xe);be>=0&&(E[be]=null,x[be].disconnect(xe))}for(let me=0;me<se.added.length;me++){const xe=se.added[me];let be=E.indexOf(xe);if(be===-1){for(let et=0;et<x.length;et++)if(et>=E.length){E.push(xe),be=et;break}else if(E[et]===null){E[et]=xe,be=et;break}if(be===-1)break}const Ue=x[be];Ue&&Ue.connect(xe)}}const O=new G,Y=new G;function Q(se,me,xe){O.setFromMatrixPosition(me.matrixWorld),Y.setFromMatrixPosition(xe.matrixWorld);const be=O.distanceTo(Y),Ue=me.projectionMatrix.elements,et=xe.projectionMatrix.elements,He=Ue[14]/(Ue[10]-1),Mt=Ue[14]/(Ue[10]+1),ft=(Ue[9]+1)/Ue[5],$e=(Ue[9]-1)/Ue[5],H=(Ue[8]-1)/Ue[0],wn=(et[8]+1)/et[0],pt=He*H,mt=He*wn,We=be/(-H+wn),Dt=We*-H;if(me.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Dt),se.translateZ(We),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),Ue[10]===-1)se.projectionMatrix.copy(me.projectionMatrix),se.projectionMatrixInverse.copy(me.projectionMatrixInverse);else{const ze=He+We,L=Mt+We,M=pt-Dt,Z=mt+(be-Dt),le=ft*Mt/L*ze,Ae=$e*Mt/L*ze;se.projectionMatrix.makePerspective(M,Z,le,Ae,ze,L),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}}function J(se,me){me===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(me.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(s===null)return;let me=se.near,xe=se.far;m.texture!==null&&(m.depthNear>0&&(me=m.depthNear),m.depthFar>0&&(xe=m.depthFar)),v.near=T.near=I.near=me,v.far=T.far=I.far=xe,(F!==v.near||K!==v.far)&&(s.updateRenderState({depthNear:v.near,depthFar:v.far}),F=v.near,K=v.far),I.layers.mask=se.layers.mask|2,T.layers.mask=se.layers.mask|4,v.layers.mask=I.layers.mask|T.layers.mask;const be=se.parent,Ue=v.cameras;J(v,be);for(let et=0;et<Ue.length;et++)J(Ue[et],be);Ue.length===2?Q(v,I,T):v.projectionMatrix.copy(I.projectionMatrix),ee(se,v,be)};function ee(se,me,xe){xe===null?se.matrix.copy(me.matrixWorld):(se.matrix.copy(xe.matrixWorld),se.matrix.invert(),se.matrix.multiply(me.matrixWorld)),se.matrix.decompose(se.position,se.quaternion,se.scale),se.updateMatrixWorld(!0),se.projectionMatrix.copy(me.projectionMatrix),se.projectionMatrixInverse.copy(me.projectionMatrixInverse),se.isPerspectiveCamera&&(se.fov=ea*2*Math.atan(1/se.projectionMatrix.elements[5]),se.zoom=1)}this.getCamera=function(){return v},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(se){c=se,d!==null&&(d.fixedFoveation=se),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=se)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(v)};let ae=null;function _e(se,me){if(h=me.getViewerPose(l||a),p=me,h!==null){const xe=h.views;f!==null&&(e.setRenderTargetFramebuffer(_,f.framebuffer),e.setRenderTarget(_));let be=!1;xe.length!==v.cameras.length&&(v.cameras.length=0,be=!0);for(let He=0;He<xe.length;He++){const Mt=xe[He];let ft=null;if(f!==null)ft=f.getViewport(Mt);else{const H=u.getViewSubImage(d,Mt);ft=H.viewport,He===0&&(e.setRenderTargetTextures(_,H.colorTexture,H.depthStencilTexture),e.setRenderTarget(_))}let $e=C[He];$e===void 0&&($e=new Bn,$e.layers.enable(He),$e.viewport=new gt,C[He]=$e),$e.matrix.fromArray(Mt.transform.matrix),$e.matrix.decompose($e.position,$e.quaternion,$e.scale),$e.projectionMatrix.fromArray(Mt.projectionMatrix),$e.projectionMatrixInverse.copy($e.projectionMatrix).invert(),$e.viewport.set(ft.x,ft.y,ft.width,ft.height),He===0&&(v.matrix.copy($e.matrix),v.matrix.decompose(v.position,v.quaternion,v.scale)),be===!0&&v.cameras.push($e)}const Ue=s.enabledFeatures;if(Ue&&Ue.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&u){const He=u.getDepthInformation(xe[0]);He&&He.isValid&&He.texture&&m.init(e,He,s.renderState)}}for(let xe=0;xe<x.length;xe++){const be=E[xe],Ue=x[xe];be!==null&&Ue!==void 0&&Ue.update(be,me,l||a)}ae&&ae(se,me),me.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:me}),p=null}const Me=new wg;Me.setAnimationLoop(_e),this.setAnimationLoop=function(se){ae=se},this.dispose=function(){}}}const br=new dn,$S=new Re;function e1(i,e){function t(g,A){g.matrixAutoUpdate===!0&&g.updateMatrix(),A.value.copy(g.matrix)}function n(g,A){A.color.getRGB(g.fogColor.value,FA(i)),A.isFog?(g.fogNear.value=A.near,g.fogFar.value=A.far):A.isFogExp2&&(g.fogDensity.value=A.density)}function s(g,A,_,x,E){A.isMeshBasicMaterial||A.isMeshLambertMaterial?r(g,A):A.isMeshToonMaterial?(r(g,A),u(g,A)):A.isMeshPhongMaterial?(r(g,A),h(g,A)):A.isMeshStandardMaterial?(r(g,A),d(g,A),A.isMeshPhysicalMaterial&&f(g,A,E)):A.isMeshMatcapMaterial?(r(g,A),p(g,A)):A.isMeshDepthMaterial?r(g,A):A.isMeshDistanceMaterial?(r(g,A),m(g,A)):A.isMeshNormalMaterial?r(g,A):A.isLineBasicMaterial?(a(g,A),A.isLineDashedMaterial&&o(g,A)):A.isPointsMaterial?c(g,A,_,x):A.isSpriteMaterial?l(g,A):A.isShadowMaterial?(g.color.value.copy(A.color),g.opacity.value=A.opacity):A.isShaderMaterial&&(A.uniformsNeedUpdate=!1)}function r(g,A){g.opacity.value=A.opacity,A.color&&g.diffuse.value.copy(A.color),A.emissive&&g.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity),A.map&&(g.map.value=A.map,t(A.map,g.mapTransform)),A.alphaMap&&(g.alphaMap.value=A.alphaMap,t(A.alphaMap,g.alphaMapTransform)),A.bumpMap&&(g.bumpMap.value=A.bumpMap,t(A.bumpMap,g.bumpMapTransform),g.bumpScale.value=A.bumpScale,A.side===Ln&&(g.bumpScale.value*=-1)),A.normalMap&&(g.normalMap.value=A.normalMap,t(A.normalMap,g.normalMapTransform),g.normalScale.value.copy(A.normalScale),A.side===Ln&&g.normalScale.value.negate()),A.displacementMap&&(g.displacementMap.value=A.displacementMap,t(A.displacementMap,g.displacementMapTransform),g.displacementScale.value=A.displacementScale,g.displacementBias.value=A.displacementBias),A.emissiveMap&&(g.emissiveMap.value=A.emissiveMap,t(A.emissiveMap,g.emissiveMapTransform)),A.specularMap&&(g.specularMap.value=A.specularMap,t(A.specularMap,g.specularMapTransform)),A.alphaTest>0&&(g.alphaTest.value=A.alphaTest);const _=e.get(A),x=_.envMap,E=_.envMapRotation;x&&(g.envMap.value=x,br.copy(E),br.x*=-1,br.y*=-1,br.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(br.y*=-1,br.z*=-1),g.envMapRotation.value.setFromMatrix4($S.makeRotationFromEuler(br)),g.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=A.reflectivity,g.ior.value=A.ior,g.refractionRatio.value=A.refractionRatio),A.lightMap&&(g.lightMap.value=A.lightMap,g.lightMapIntensity.value=A.lightMapIntensity,t(A.lightMap,g.lightMapTransform)),A.aoMap&&(g.aoMap.value=A.aoMap,g.aoMapIntensity.value=A.aoMapIntensity,t(A.aoMap,g.aoMapTransform))}function a(g,A){g.diffuse.value.copy(A.color),g.opacity.value=A.opacity,A.map&&(g.map.value=A.map,t(A.map,g.mapTransform))}function o(g,A){g.dashSize.value=A.dashSize,g.totalSize.value=A.dashSize+A.gapSize,g.scale.value=A.scale}function c(g,A,_,x){g.diffuse.value.copy(A.color),g.opacity.value=A.opacity,g.size.value=A.size*_,g.scale.value=x*.5,A.map&&(g.map.value=A.map,t(A.map,g.uvTransform)),A.alphaMap&&(g.alphaMap.value=A.alphaMap,t(A.alphaMap,g.alphaMapTransform)),A.alphaTest>0&&(g.alphaTest.value=A.alphaTest)}function l(g,A){g.diffuse.value.copy(A.color),g.opacity.value=A.opacity,g.rotation.value=A.rotation,A.map&&(g.map.value=A.map,t(A.map,g.mapTransform)),A.alphaMap&&(g.alphaMap.value=A.alphaMap,t(A.alphaMap,g.alphaMapTransform)),A.alphaTest>0&&(g.alphaTest.value=A.alphaTest)}function h(g,A){g.specular.value.copy(A.specular),g.shininess.value=Math.max(A.shininess,1e-4)}function u(g,A){A.gradientMap&&(g.gradientMap.value=A.gradientMap)}function d(g,A){g.metalness.value=A.metalness,A.metalnessMap&&(g.metalnessMap.value=A.metalnessMap,t(A.metalnessMap,g.metalnessMapTransform)),g.roughness.value=A.roughness,A.roughnessMap&&(g.roughnessMap.value=A.roughnessMap,t(A.roughnessMap,g.roughnessMapTransform)),A.envMap&&(g.envMapIntensity.value=A.envMapIntensity)}function f(g,A,_){g.ior.value=A.ior,A.sheen>0&&(g.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen),g.sheenRoughness.value=A.sheenRoughness,A.sheenColorMap&&(g.sheenColorMap.value=A.sheenColorMap,t(A.sheenColorMap,g.sheenColorMapTransform)),A.sheenRoughnessMap&&(g.sheenRoughnessMap.value=A.sheenRoughnessMap,t(A.sheenRoughnessMap,g.sheenRoughnessMapTransform))),A.clearcoat>0&&(g.clearcoat.value=A.clearcoat,g.clearcoatRoughness.value=A.clearcoatRoughness,A.clearcoatMap&&(g.clearcoatMap.value=A.clearcoatMap,t(A.clearcoatMap,g.clearcoatMapTransform)),A.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=A.clearcoatRoughnessMap,t(A.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),A.clearcoatNormalMap&&(g.clearcoatNormalMap.value=A.clearcoatNormalMap,t(A.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(A.clearcoatNormalScale),A.side===Ln&&g.clearcoatNormalScale.value.negate())),A.dispersion>0&&(g.dispersion.value=A.dispersion),A.iridescence>0&&(g.iridescence.value=A.iridescence,g.iridescenceIOR.value=A.iridescenceIOR,g.iridescenceThicknessMinimum.value=A.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=A.iridescenceThicknessRange[1],A.iridescenceMap&&(g.iridescenceMap.value=A.iridescenceMap,t(A.iridescenceMap,g.iridescenceMapTransform)),A.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=A.iridescenceThicknessMap,t(A.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),A.transmission>0&&(g.transmission.value=A.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),A.transmissionMap&&(g.transmissionMap.value=A.transmissionMap,t(A.transmissionMap,g.transmissionMapTransform)),g.thickness.value=A.thickness,A.thicknessMap&&(g.thicknessMap.value=A.thicknessMap,t(A.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=A.attenuationDistance,g.attenuationColor.value.copy(A.attenuationColor)),A.anisotropy>0&&(g.anisotropyVector.value.set(A.anisotropy*Math.cos(A.anisotropyRotation),A.anisotropy*Math.sin(A.anisotropyRotation)),A.anisotropyMap&&(g.anisotropyMap.value=A.anisotropyMap,t(A.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=A.specularIntensity,g.specularColor.value.copy(A.specularColor),A.specularColorMap&&(g.specularColorMap.value=A.specularColorMap,t(A.specularColorMap,g.specularColorMapTransform)),A.specularIntensityMap&&(g.specularIntensityMap.value=A.specularIntensityMap,t(A.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,A){A.matcap&&(g.matcap.value=A.matcap)}function m(g,A){const _=e.get(A).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function t1(i,e,t,n){let s={},r={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(_,x){const E=x.program;n.uniformBlockBinding(_,E)}function l(_,x){let E=s[_.id];E===void 0&&(p(_),E=h(_),s[_.id]=E,_.addEventListener("dispose",g));const S=x.program;n.updateUBOMapping(_,S);const w=e.render.frame;r[_.id]!==w&&(d(_),r[_.id]=w)}function h(_){const x=u();_.__bindingPointIndex=x;const E=i.createBuffer(),S=_.__size,w=_.usage;return i.bindBuffer(i.UNIFORM_BUFFER,E),i.bufferData(i.UNIFORM_BUFFER,S,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,E),E}function u(){for(let _=0;_<o;_++)if(a.indexOf(_)===-1)return a.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(_){const x=s[_.id],E=_.uniforms,S=_.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let w=0,I=E.length;w<I;w++){const T=Array.isArray(E[w])?E[w]:[E[w]];for(let C=0,v=T.length;C<v;C++){const F=T[C];if(f(F,w,C,S)===!0){const K=F.__offset,q=Array.isArray(F.value)?F.value:[F.value];let $=0;for(let D=0;D<q.length;D++){const O=q[D],Y=m(O);typeof O=="number"||typeof O=="boolean"?(F.__data[0]=O,i.bufferSubData(i.UNIFORM_BUFFER,K+$,F.__data)):O.isMatrix3?(F.__data[0]=O.elements[0],F.__data[1]=O.elements[1],F.__data[2]=O.elements[2],F.__data[3]=0,F.__data[4]=O.elements[3],F.__data[5]=O.elements[4],F.__data[6]=O.elements[5],F.__data[7]=0,F.__data[8]=O.elements[6],F.__data[9]=O.elements[7],F.__data[10]=O.elements[8],F.__data[11]=0):(O.toArray(F.__data,$),$+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,K,F.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function f(_,x,E,S){const w=_.value,I=x+"_"+E;if(S[I]===void 0)return typeof w=="number"||typeof w=="boolean"?S[I]=w:S[I]=w.clone(),!0;{const T=S[I];if(typeof w=="number"||typeof w=="boolean"){if(T!==w)return S[I]=w,!0}else if(T.equals(w)===!1)return T.copy(w),!0}return!1}function p(_){const x=_.uniforms;let E=0;const S=16;for(let I=0,T=x.length;I<T;I++){const C=Array.isArray(x[I])?x[I]:[x[I]];for(let v=0,F=C.length;v<F;v++){const K=C[v],q=Array.isArray(K.value)?K.value:[K.value];for(let $=0,D=q.length;$<D;$++){const O=q[$],Y=m(O),Q=E%S,J=Q%Y.boundary,ee=Q+J;E+=J,ee!==0&&S-ee<Y.storage&&(E+=S-ee),K.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=E,E+=Y.storage}}}const w=E%S;return w>0&&(E+=S-w),_.__size=E,_.__cache={},this}function m(_){const x={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),x}function g(_){const x=_.target;x.removeEventListener("dispose",g);const E=a.indexOf(x.__bindingPointIndex);a.splice(E,1),i.deleteBuffer(s[x.id]),delete s[x.id],delete r[x.id]}function A(){for(const _ in s)i.deleteBuffer(s[_]);a=[],s={},r={}}return{bind:c,update:l,dispose:A}}class Jg{constructor(e={}){const{canvas:t=p_(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const p=new Uint32Array(4),m=new Int32Array(4);let g=null,A=null;const _=[],x=[];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=Is,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let S=!1;this._outputColorSpace=yt;let w=0,I=0,T=null,C=-1,v=null;const F=new gt,K=new gt;let q=null;const $=new Fe(0);let D=0,O=t.width,Y=t.height,Q=1,J=null,ee=null;const ae=new gt(0,0,O,Y),_e=new gt(0,0,O,Y);let Me=!1;const se=new sd;let me=!1,xe=!1;const be=new Re,Ue=new Re,et=new G,He=new gt,Mt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ft=!1;function $e(){return T===null?Q:1}let H=n;function wn(y,R){return t.getContext(y,R)}try{const y={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ic}`),t.addEventListener("webglcontextlost",de,!1),t.addEventListener("webglcontextrestored",Se,!1),t.addEventListener("webglcontextcreationerror",Ie,!1),H===null){const R="webgl2";if(H=wn(R,y),H===null)throw wn(R)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(y){throw console.error("THREE.WebGLRenderer: "+y.message),y}let pt,mt,We,Dt,ze,L,M,Z,le,Ae,oe,Qe,ve,qe,Ze,Ee,De,Oe,Ge,Te,nt,Ke,it,W;function ne(){pt=new dI(H),pt.init(),Ke=new jS(H,pt),mt=new rI(H,pt,e,Ke),We=new qS(H,pt),mt.reverseDepthBuffer&&d&&We.buffers.depth.setReversed(!0),Dt=new AI(H),ze=new NS,L=new KS(H,pt,We,ze,mt,Ke,Dt),M=new oI(E),Z=new uI(E),le=new tv(H),it=new iI(H,le),Ae=new fI(H,le,Dt,it),oe=new mI(H,Ae,le,Dt),Ge=new gI(H,mt,L),Ee=new aI(ze),Qe=new FS(E,M,Z,pt,mt,it,Ee),ve=new e1(E,ze),qe=new LS,Ze=new GS(pt),Oe=new nI(E,M,Z,We,oe,f,c),De=new VS(E,oe,mt),W=new t1(H,Dt,mt,We),Te=new sI(H,pt,Dt),nt=new pI(H,pt,Dt),Dt.programs=Qe.programs,E.capabilities=mt,E.extensions=pt,E.properties=ze,E.renderLists=qe,E.shadowMap=De,E.state=We,E.info=Dt}ne();const re=new ZS(E,H);this.xr=re,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const y=pt.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=pt.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return Q},this.setPixelRatio=function(y){y!==void 0&&(Q=y,this.setSize(O,Y,!1))},this.getSize=function(y){return y.set(O,Y)},this.setSize=function(y,R,N=!0){if(re.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}O=y,Y=R,t.width=Math.floor(y*Q),t.height=Math.floor(R*Q),N===!0&&(t.style.width=y+"px",t.style.height=R+"px"),this.setViewport(0,0,y,R)},this.getDrawingBufferSize=function(y){return y.set(O*Q,Y*Q).floor()},this.setDrawingBufferSize=function(y,R,N){O=y,Y=R,Q=N,t.width=Math.floor(y*N),t.height=Math.floor(R*N),this.setViewport(0,0,y,R)},this.getCurrentViewport=function(y){return y.copy(F)},this.getViewport=function(y){return y.copy(ae)},this.setViewport=function(y,R,N,U){y.isVector4?ae.set(y.x,y.y,y.z,y.w):ae.set(y,R,N,U),We.viewport(F.copy(ae).multiplyScalar(Q).round())},this.getScissor=function(y){return y.copy(_e)},this.setScissor=function(y,R,N,U){y.isVector4?_e.set(y.x,y.y,y.z,y.w):_e.set(y,R,N,U),We.scissor(K.copy(_e).multiplyScalar(Q).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(y){We.setScissorTest(Me=y)},this.setOpaqueSort=function(y){J=y},this.setTransparentSort=function(y){ee=y},this.getClearColor=function(y){return y.copy(Oe.getClearColor())},this.setClearColor=function(){Oe.setClearColor(...arguments)},this.getClearAlpha=function(){return Oe.getClearAlpha()},this.setClearAlpha=function(){Oe.setClearAlpha(...arguments)},this.clear=function(y=!0,R=!0,N=!0){let U=0;if(y){let P=!1;if(T!==null){const z=T.texture.format;P=z===au||z===ru||z===su}if(P){const z=T.texture.type,j=z===cn||z===rr||z===io||z===so||z===nu||z===iu,X=Oe.getClearColor(),ie=Oe.getClearAlpha(),he=X.r,ce=X.g,fe=X.b;j?(p[0]=he,p[1]=ce,p[2]=fe,p[3]=ie,H.clearBufferuiv(H.COLOR,0,p)):(m[0]=he,m[1]=ce,m[2]=fe,m[3]=ie,H.clearBufferiv(H.COLOR,0,m))}else U|=H.COLOR_BUFFER_BIT}R&&(U|=H.DEPTH_BUFFER_BIT),N&&(U|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(U)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",de,!1),t.removeEventListener("webglcontextrestored",Se,!1),t.removeEventListener("webglcontextcreationerror",Ie,!1),Oe.dispose(),qe.dispose(),Ze.dispose(),ze.dispose(),M.dispose(),Z.dispose(),oe.dispose(),it.dispose(),W.dispose(),Qe.dispose(),re.dispose(),re.removeEventListener("sessionstart",Qh),re.removeEventListener("sessionend",Gh),ws.stop()};function de(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function Se(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;const y=Dt.autoReset,R=De.enabled,N=De.autoUpdate,U=De.needsUpdate,P=De.type;ne(),Dt.autoReset=y,De.enabled=R,De.autoUpdate=N,De.needsUpdate=U,De.type=P}function Ie(y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function st(y){const R=y.target;R.removeEventListener("dispose",st),Ht(R)}function Ht(y){vn(y),ze.remove(y)}function vn(y){const R=ze.get(y).programs;R!==void 0&&(R.forEach(function(N){Qe.releaseProgram(N)}),y.isShaderMaterial&&Qe.releaseShaderCache(y))}this.renderBufferDirect=function(y,R,N,U,P,z){R===null&&(R=Mt);const j=P.isMesh&&P.matrixWorld.determinant()<0,X=Qp(y,R,N,U,P);We.setMaterial(U,j);let ie=N.index,he=1;if(U.wireframe===!0){if(ie=Ae.getWireframeAttribute(N),ie===void 0)return;he=2}const ce=N.drawRange,fe=N.attributes.position;let ge=ce.start*he,ye=(ce.start+ce.count)*he;z!==null&&(ge=Math.max(ge,z.start*he),ye=Math.min(ye,(z.start+z.count)*he)),ie!==null?(ge=Math.max(ge,0),ye=Math.min(ye,ie.count)):fe!=null&&(ge=Math.max(ge,0),ye=Math.min(ye,fe.count));const Pe=ye-ge;if(Pe<0||Pe===1/0)return;it.setup(P,U,X,N,ie);let je,Ve=Te;if(ie!==null&&(je=le.get(ie),Ve=nt,Ve.setIndex(je)),P.isMesh)U.wireframe===!0?(We.setLineWidth(U.wireframeLinewidth*$e()),Ve.setMode(H.LINES)):Ve.setMode(H.TRIANGLES);else if(P.isLine){let Le=U.linewidth;Le===void 0&&(Le=1),We.setLineWidth(Le*$e()),P.isLineSegments?Ve.setMode(H.LINES):P.isLineLoop?Ve.setMode(H.LINE_LOOP):Ve.setMode(H.LINE_STRIP)}else P.isPoints?Ve.setMode(H.POINTS):P.isSprite&&Ve.setMode(H.TRIANGLES);if(P.isBatchedMesh)if(P._multiDrawInstances!==null)Vc("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Ve.renderMultiDrawInstances(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount,P._multiDrawInstances);else if(pt.get("WEBGL_multi_draw"))Ve.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else{const Le=P._multiDrawStarts,rt=P._multiDrawCounts,ke=P._multiDrawCount,It=ie?le.get(ie).bytesPerElement:1,mn=ze.get(U).currentProgram.getUniforms();for(let vt=0;vt<ke;vt++)mn.setValue(H,"_gl_DrawID",vt),Ve.render(Le[vt]/It,rt[vt])}else if(P.isInstancedMesh)Ve.renderInstances(ge,Pe,P.count);else if(N.isInstancedBufferGeometry){const Le=N._maxInstanceCount!==void 0?N._maxInstanceCount:1/0,rt=Math.min(N.instanceCount,Le);Ve.renderInstances(ge,Pe,rt)}else Ve.render(ge,Pe)};function Ct(y,R,N){y.transparent===!0&&y.side===Pi&&y.forceSinglePass===!1?(y.side=Ln,y.needsUpdate=!0,to(y,R,N),y.side=ji,y.needsUpdate=!0,to(y,R,N),y.side=Pi):to(y,R,N)}this.compile=function(y,R,N=null){N===null&&(N=y),A=Ze.get(N),A.init(R),x.push(A),N.traverseVisible(function(P){P.isLight&&P.layers.test(R.layers)&&(A.pushLight(P),P.castShadow&&A.pushShadow(P))}),y!==N&&y.traverseVisible(function(P){P.isLight&&P.layers.test(R.layers)&&(A.pushLight(P),P.castShadow&&A.pushShadow(P))}),A.setupLights();const U=new Set;return y.traverse(function(P){if(!(P.isMesh||P.isPoints||P.isLine||P.isSprite))return;const z=P.material;if(z)if(Array.isArray(z))for(let j=0;j<z.length;j++){const X=z[j];Ct(X,N,P),U.add(X)}else Ct(z,N,P),U.add(z)}),A=x.pop(),U},this.compileAsync=function(y,R,N=null){const U=this.compile(y,R,N);return new Promise(P=>{function z(){if(U.forEach(function(j){ze.get(j).currentProgram.isReady()&&U.delete(j)}),U.size===0){P(y);return}setTimeout(z,10)}pt.get("KHR_parallel_shader_compile")!==null?z():setTimeout(z,10)})};let si=null;function Li(y){si&&si(y)}function Qh(){ws.stop()}function Gh(){ws.start()}const ws=new wg;ws.setAnimationLoop(Li),typeof self<"u"&&ws.setContext(self),this.setAnimationLoop=function(y){si=y,re.setAnimationLoop(y),y===null?ws.stop():ws.start()},re.addEventListener("sessionstart",Qh),re.addEventListener("sessionend",Gh),this.render=function(y,R){if(R!==void 0&&R.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;if(y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),R.parent===null&&R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),re.enabled===!0&&re.isPresenting===!0&&(re.cameraAutoUpdate===!0&&re.updateCamera(R),R=re.getCamera()),y.isScene===!0&&y.onBeforeRender(E,y,R,T),A=Ze.get(y,x.length),A.init(R),x.push(A),Ue.multiplyMatrices(R.projectionMatrix,R.matrixWorldInverse),se.setFromProjectionMatrix(Ue),xe=this.localClippingEnabled,me=Ee.init(this.clippingPlanes,xe),g=qe.get(y,_.length),g.init(),_.push(g),re.enabled===!0&&re.isPresenting===!0){const z=E.xr.getDepthSensingMesh();z!==null&&_c(z,R,-1/0,E.sortObjects)}_c(y,R,0,E.sortObjects),g.finish(),E.sortObjects===!0&&g.sort(J,ee),ft=re.enabled===!1||re.isPresenting===!1||re.hasDepthSensing()===!1,ft&&Oe.addToRenderList(g,y),this.info.render.frame++,me===!0&&Ee.beginShadows();const N=A.state.shadowsArray;De.render(N,y,R),me===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();const U=g.opaque,P=g.transmissive;if(A.setupLights(),R.isArrayCamera){const z=R.cameras;if(P.length>0)for(let j=0,X=z.length;j<X;j++){const ie=z[j];Hh(U,P,y,ie)}ft&&Oe.render(y);for(let j=0,X=z.length;j<X;j++){const ie=z[j];wc(g,y,ie,ie.viewport)}}else P.length>0&&Hh(U,P,y,R),ft&&Oe.render(y),wc(g,y,R);T!==null&&I===0&&(L.updateMultisampleRenderTarget(T),L.updateRenderTargetMipmap(T)),y.isScene===!0&&y.onAfterRender(E,y,R),it.resetDefaultState(),C=-1,v=null,x.pop(),x.length>0?(A=x[x.length-1],me===!0&&Ee.setGlobalState(E.clippingPlanes,A.state.camera)):A=null,_.pop(),_.length>0?g=_[_.length-1]:g=null};function _c(y,R,N,U){if(y.visible===!1)return;if(y.layers.test(R.layers)){if(y.isGroup)N=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(R);else if(y.isLight)A.pushLight(y),y.castShadow&&A.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||se.intersectsSprite(y)){U&&He.setFromMatrixPosition(y.matrixWorld).applyMatrix4(Ue);const j=oe.update(y),X=y.material;X.visible&&g.push(y,j,X,N,He.z,null)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||se.intersectsObject(y))){const j=oe.update(y),X=y.material;if(U&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),He.copy(y.boundingSphere.center)):(j.boundingSphere===null&&j.computeBoundingSphere(),He.copy(j.boundingSphere.center)),He.applyMatrix4(y.matrixWorld).applyMatrix4(Ue)),Array.isArray(X)){const ie=j.groups;for(let he=0,ce=ie.length;he<ce;he++){const fe=ie[he],ge=X[fe.materialIndex];ge&&ge.visible&&g.push(y,j,ge,N,He.z,fe)}}else X.visible&&g.push(y,j,X,N,He.z,null)}}const z=y.children;for(let j=0,X=z.length;j<X;j++)_c(z[j],R,N,U)}function wc(y,R,N,U){const P=y.opaque,z=y.transmissive,j=y.transparent;A.setupLightsView(N),me===!0&&Ee.setGlobalState(E.clippingPlanes,N),U&&We.viewport(F.copy(U)),P.length>0&&eo(P,R,N),z.length>0&&eo(z,R,N),j.length>0&&eo(j,R,N),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1)}function Hh(y,R,N,U){if((N.isScene===!0?N.overrideMaterial:null)!==null)return;A.state.transmissionRenderTarget[U.id]===void 0&&(A.state.transmissionRenderTarget[U.id]=new or(1,1,{generateMipmaps:!0,type:pt.has("EXT_color_buffer_half_float")||pt.has("EXT_color_buffer_float")?kn:cn,minFilter:ri,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:tt.workingColorSpace}));const z=A.state.transmissionRenderTarget[U.id],j=U.viewport||F;z.setSize(j.z*E.transmissionResolutionScale,j.w*E.transmissionResolutionScale);const X=E.getRenderTarget();E.setRenderTarget(z),E.getClearColor($),D=E.getClearAlpha(),D<1&&E.setClearColor(16777215,.5),E.clear(),ft&&Oe.render(N);const ie=E.toneMapping;E.toneMapping=Is;const he=U.viewport;if(U.viewport!==void 0&&(U.viewport=void 0),A.setupLightsView(U),me===!0&&Ee.setGlobalState(E.clippingPlanes,U),eo(y,N,U),L.updateMultisampleRenderTarget(z),L.updateRenderTargetMipmap(z),pt.has("WEBGL_multisampled_render_to_texture")===!1){let ce=!1;for(let fe=0,ge=R.length;fe<ge;fe++){const ye=R[fe],Pe=ye.object,je=ye.geometry,Ve=ye.material,Le=ye.group;if(Ve.side===Pi&&Pe.layers.test(U.layers)){const rt=Ve.side;Ve.side=Ln,Ve.needsUpdate=!0,zh(Pe,N,U,je,Ve,Le),Ve.side=rt,Ve.needsUpdate=!0,ce=!0}}ce===!0&&(L.updateMultisampleRenderTarget(z),L.updateRenderTargetMipmap(z))}E.setRenderTarget(X),E.setClearColor($,D),he!==void 0&&(U.viewport=he),E.toneMapping=ie}function eo(y,R,N){const U=R.isScene===!0?R.overrideMaterial:null;for(let P=0,z=y.length;P<z;P++){const j=y[P],X=j.object,ie=j.geometry,he=j.group;let ce=j.material;ce.allowOverride===!0&&U!==null&&(ce=U),X.layers.test(N.layers)&&zh(X,R,N,ie,ce,he)}}function zh(y,R,N,U,P,z){y.onBeforeRender(E,R,N,U,P,z),y.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),P.onBeforeRender(E,R,N,U,y,z),P.transparent===!0&&P.side===Pi&&P.forceSinglePass===!1?(P.side=Ln,P.needsUpdate=!0,E.renderBufferDirect(N,R,U,P,y,z),P.side=ji,P.needsUpdate=!0,E.renderBufferDirect(N,R,U,P,y,z),P.side=Pi):E.renderBufferDirect(N,R,U,P,y,z),y.onAfterRender(E,R,N,U,P,z)}function to(y,R,N){R.isScene!==!0&&(R=Mt);const U=ze.get(y),P=A.state.lights,z=A.state.shadowsArray,j=P.state.version,X=Qe.getParameters(y,P.state,z,R,N),ie=Qe.getProgramCacheKey(X);let he=U.programs;U.environment=y.isMeshStandardMaterial?R.environment:null,U.fog=R.fog,U.envMap=(y.isMeshStandardMaterial?Z:M).get(y.envMap||U.environment),U.envMapRotation=U.environment!==null&&y.envMap===null?R.environmentRotation:y.envMapRotation,he===void 0&&(y.addEventListener("dispose",st),he=new Map,U.programs=he);let ce=he.get(ie);if(ce!==void 0){if(U.currentProgram===ce&&U.lightsStateVersion===j)return Cc(y,X),ce}else X.uniforms=Qe.getUniforms(y),y.onBeforeCompile(X,E),ce=Qe.acquireProgram(X,ie),he.set(ie,ce),U.uniforms=X.uniforms;const fe=U.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(fe.clippingPlanes=Ee.uniform),Cc(y,X),U.needsLights=tr(y),U.lightsStateVersion=j,U.needsLights&&(fe.ambientLightColor.value=P.state.ambient,fe.lightProbe.value=P.state.probe,fe.directionalLights.value=P.state.directional,fe.directionalLightShadows.value=P.state.directionalShadow,fe.spotLights.value=P.state.spot,fe.spotLightShadows.value=P.state.spotShadow,fe.rectAreaLights.value=P.state.rectArea,fe.ltc_1.value=P.state.rectAreaLTC1,fe.ltc_2.value=P.state.rectAreaLTC2,fe.pointLights.value=P.state.point,fe.pointLightShadows.value=P.state.pointShadow,fe.hemisphereLights.value=P.state.hemi,fe.directionalShadowMap.value=P.state.directionalShadowMap,fe.directionalShadowMatrix.value=P.state.directionalShadowMatrix,fe.spotShadowMap.value=P.state.spotShadowMap,fe.spotLightMatrix.value=P.state.spotLightMatrix,fe.spotLightMap.value=P.state.spotLightMap,fe.pointShadowMap.value=P.state.pointShadowMap,fe.pointShadowMatrix.value=P.state.pointShadowMatrix),U.currentProgram=ce,U.uniformsList=null,ce}function vc(y){if(y.uniformsList===null){const R=y.currentProgram.getUniforms();y.uniformsList=Nl.seqWithValue(R.seq,y.uniforms)}return y.uniformsList}function Cc(y,R){const N=ze.get(y);N.outputColorSpace=R.outputColorSpace,N.batching=R.batching,N.batchingColor=R.batchingColor,N.instancing=R.instancing,N.instancingColor=R.instancingColor,N.instancingMorph=R.instancingMorph,N.skinning=R.skinning,N.morphTargets=R.morphTargets,N.morphNormals=R.morphNormals,N.morphColors=R.morphColors,N.morphTargetsCount=R.morphTargetsCount,N.numClippingPlanes=R.numClippingPlanes,N.numIntersection=R.numClipIntersection,N.vertexAlphas=R.vertexAlphas,N.vertexTangents=R.vertexTangents,N.toneMapping=R.toneMapping}function Qp(y,R,N,U,P){R.isScene!==!0&&(R=Mt),L.resetTextureUnits();const z=R.fog,j=U.isMeshStandardMaterial?R.environment:null,X=T===null?E.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:un,ie=(U.isMeshStandardMaterial?Z:M).get(U.envMap||j),he=U.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,ce=!!N.attributes.tangent&&(!!U.normalMap||U.anisotropy>0),fe=!!N.morphAttributes.position,ge=!!N.morphAttributes.normal,ye=!!N.morphAttributes.color;let Pe=Is;U.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(Pe=E.toneMapping);const je=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,Ve=je!==void 0?je.length:0,Le=ze.get(U),rt=A.state.lights;if(me===!0&&(xe===!0||y!==v)){const Ut=y===v&&U.id===C;Ee.setState(U,y,Ut)}let ke=!1;U.version===Le.__version?(Le.needsLights&&Le.lightsStateVersion!==rt.state.version||Le.outputColorSpace!==X||P.isBatchedMesh&&Le.batching===!1||!P.isBatchedMesh&&Le.batching===!0||P.isBatchedMesh&&Le.batchingColor===!0&&P.colorTexture===null||P.isBatchedMesh&&Le.batchingColor===!1&&P.colorTexture!==null||P.isInstancedMesh&&Le.instancing===!1||!P.isInstancedMesh&&Le.instancing===!0||P.isSkinnedMesh&&Le.skinning===!1||!P.isSkinnedMesh&&Le.skinning===!0||P.isInstancedMesh&&Le.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&Le.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&Le.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&Le.instancingMorph===!1&&P.morphTexture!==null||Le.envMap!==ie||U.fog===!0&&Le.fog!==z||Le.numClippingPlanes!==void 0&&(Le.numClippingPlanes!==Ee.numPlanes||Le.numIntersection!==Ee.numIntersection)||Le.vertexAlphas!==he||Le.vertexTangents!==ce||Le.morphTargets!==fe||Le.morphNormals!==ge||Le.morphColors!==ye||Le.toneMapping!==Pe||Le.morphTargetsCount!==Ve)&&(ke=!0):(ke=!0,Le.__version=U.version);let It=Le.currentProgram;ke===!0&&(It=to(U,R,P));let mn=!1,vt=!1,Et=!1;const Xe=It.getUniforms(),Xt=Le.uniforms;if(We.useProgram(It.program)&&(mn=!0,vt=!0,Et=!0),U.id!==C&&(C=U.id,vt=!0),mn||v!==y){We.buffers.depth.getReversed()?(be.copy(y.projectionMatrix),g_(be),m_(be),Xe.setValue(H,"projectionMatrix",be)):Xe.setValue(H,"projectionMatrix",y.projectionMatrix),Xe.setValue(H,"viewMatrix",y.matrixWorldInverse);const xn=Xe.map.cameraPosition;xn!==void 0&&xn.setValue(H,et.setFromMatrixPosition(y.matrixWorld)),mt.logarithmicDepthBuffer&&Xe.setValue(H,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&Xe.setValue(H,"isOrthographic",y.isOrthographicCamera===!0),v!==y&&(v=y,vt=!0,Et=!0)}if(P.isSkinnedMesh){Xe.setOptional(H,P,"bindMatrix"),Xe.setOptional(H,P,"bindMatrixInverse");const Ut=P.skeleton;Ut&&(Ut.boneTexture===null&&Ut.computeBoneTexture(),Xe.setValue(H,"boneTexture",Ut.boneTexture,L))}P.isBatchedMesh&&(Xe.setOptional(H,P,"batchingTexture"),Xe.setValue(H,"batchingTexture",P._matricesTexture,L),Xe.setOptional(H,P,"batchingIdTexture"),Xe.setValue(H,"batchingIdTexture",P._indirectTexture,L),Xe.setOptional(H,P,"batchingColorTexture"),P._colorsTexture!==null&&Xe.setValue(H,"batchingColorTexture",P._colorsTexture,L));const Cn=N.morphAttributes;if((Cn.position!==void 0||Cn.normal!==void 0||Cn.color!==void 0)&&Ge.update(P,N,It),(vt||Le.receiveShadow!==P.receiveShadow)&&(Le.receiveShadow=P.receiveShadow,Xe.setValue(H,"receiveShadow",P.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(Xt.envMap.value=ie,Xt.flipEnvMap.value=ie.isCubeTexture&&ie.isRenderTargetTexture===!1?-1:1),U.isMeshStandardMaterial&&U.envMap===null&&R.environment!==null&&(Xt.envMapIntensity.value=R.environmentIntensity),vt&&(Xe.setValue(H,"toneMappingExposure",E.toneMappingExposure),Le.needsLights&&vs(Xt,Et),z&&U.fog===!0&&ve.refreshFogUniforms(Xt,z),ve.refreshMaterialUniforms(Xt,U,Q,Y,A.state.transmissionRenderTarget[y.id]),Nl.upload(H,vc(Le),Xt,L)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(Nl.upload(H,vc(Le),Xt,L),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&Xe.setValue(H,"center",P.center),Xe.setValue(H,"modelViewMatrix",P.modelViewMatrix),Xe.setValue(H,"normalMatrix",P.normalMatrix),Xe.setValue(H,"modelMatrix",P.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const Ut=U.uniformsGroups;for(let xn=0,Gp=Ut.length;xn<Gp;xn++){const Wr=Ut[xn];W.update(Wr,It),W.bind(Wr,It)}}return It}function vs(y,R){y.ambientLightColor.needsUpdate=R,y.lightProbe.needsUpdate=R,y.directionalLights.needsUpdate=R,y.directionalLightShadows.needsUpdate=R,y.pointLights.needsUpdate=R,y.pointLightShadows.needsUpdate=R,y.spotLights.needsUpdate=R,y.spotLightShadows.needsUpdate=R,y.rectAreaLights.needsUpdate=R,y.hemisphereLights.needsUpdate=R}function tr(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(y,R,N){const U=ze.get(y);U.__autoAllocateDepthBuffer=y.resolveDepthBuffer===!1,U.__autoAllocateDepthBuffer===!1&&(U.__useRenderToTexture=!1),ze.get(y.texture).__webglTexture=R,ze.get(y.depthTexture).__webglTexture=U.__autoAllocateDepthBuffer?void 0:N,U.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(y,R){const N=ze.get(y);N.__webglFramebuffer=R,N.__useDefaultFramebuffer=R===void 0};const b=H.createFramebuffer();this.setRenderTarget=function(y,R=0,N=0){T=y,w=R,I=N;let U=!0,P=null,z=!1,j=!1;if(y){const ie=ze.get(y);if(ie.__useDefaultFramebuffer!==void 0)We.bindFramebuffer(H.FRAMEBUFFER,null),U=!1;else if(ie.__webglFramebuffer===void 0)L.setupRenderTarget(y);else if(ie.__hasExternalTextures)L.rebindTextures(y,ze.get(y.texture).__webglTexture,ze.get(y.depthTexture).__webglTexture);else if(y.depthBuffer){const fe=y.depthTexture;if(ie.__boundDepthTexture!==fe){if(fe!==null&&ze.has(fe)&&(y.width!==fe.image.width||y.height!==fe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");L.setupDepthRenderbuffer(y)}}const he=y.texture;(he.isData3DTexture||he.isDataArrayTexture||he.isCompressedArrayTexture)&&(j=!0);const ce=ze.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(ce[R])?P=ce[R][N]:P=ce[R],z=!0):y.samples>0&&L.useMultisampledRTT(y)===!1?P=ze.get(y).__webglMultisampledFramebuffer:Array.isArray(ce)?P=ce[N]:P=ce,F.copy(y.viewport),K.copy(y.scissor),q=y.scissorTest}else F.copy(ae).multiplyScalar(Q).floor(),K.copy(_e).multiplyScalar(Q).floor(),q=Me;if(N!==0&&(P=b),We.bindFramebuffer(H.FRAMEBUFFER,P)&&U&&We.drawBuffers(y,P),We.viewport(F),We.scissor(K),We.setScissorTest(q),z){const ie=ze.get(y.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+R,ie.__webglTexture,N)}else if(j){const ie=ze.get(y.texture),he=R;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,ie.__webglTexture,N,he)}else if(y!==null&&N!==0){const ie=ze.get(y.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,ie.__webglTexture,N)}C=-1},this.readRenderTargetPixels=function(y,R,N,U,P,z,j){if(!(y&&y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let X=ze.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&j!==void 0&&(X=X[j]),X){We.bindFramebuffer(H.FRAMEBUFFER,X);try{const ie=y.texture,he=ie.format,ce=ie.type;if(!mt.textureFormatReadable(he)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!mt.textureTypeReadable(ce)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}R>=0&&R<=y.width-U&&N>=0&&N<=y.height-P&&H.readPixels(R,N,U,P,Ke.convert(he),Ke.convert(ce),z)}finally{const ie=T!==null?ze.get(T).__webglFramebuffer:null;We.bindFramebuffer(H.FRAMEBUFFER,ie)}}},this.readRenderTargetPixelsAsync=async function(y,R,N,U,P,z,j){if(!(y&&y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let X=ze.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&j!==void 0&&(X=X[j]),X)if(R>=0&&R<=y.width-U&&N>=0&&N<=y.height-P){We.bindFramebuffer(H.FRAMEBUFFER,X);const ie=y.texture,he=ie.format,ce=ie.type;if(!mt.textureFormatReadable(he))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!mt.textureTypeReadable(ce))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const fe=H.createBuffer();H.bindBuffer(H.PIXEL_PACK_BUFFER,fe),H.bufferData(H.PIXEL_PACK_BUFFER,z.byteLength,H.STREAM_READ),H.readPixels(R,N,U,P,Ke.convert(he),Ke.convert(ce),0);const ge=T!==null?ze.get(T).__webglFramebuffer:null;We.bindFramebuffer(H.FRAMEBUFFER,ge);const ye=H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE,0);return H.flush(),await A_(H,ye,4),H.bindBuffer(H.PIXEL_PACK_BUFFER,fe),H.getBufferSubData(H.PIXEL_PACK_BUFFER,0,z),H.deleteBuffer(fe),H.deleteSync(ye),z}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(y,R=null,N=0){const U=Math.pow(2,-N),P=Math.floor(y.image.width*U),z=Math.floor(y.image.height*U),j=R!==null?R.x:0,X=R!==null?R.y:0;L.setTexture2D(y,0),H.copyTexSubImage2D(H.TEXTURE_2D,N,0,0,j,X,P,z),We.unbindTexture()};const B=H.createFramebuffer(),k=H.createFramebuffer();this.copyTextureToTexture=function(y,R,N=null,U=null,P=0,z=null){z===null&&(P!==0?(Vc("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),z=P,P=0):z=0);let j,X,ie,he,ce,fe,ge,ye,Pe;const je=y.isCompressedTexture?y.mipmaps[z]:y.image;if(N!==null)j=N.max.x-N.min.x,X=N.max.y-N.min.y,ie=N.isBox3?N.max.z-N.min.z:1,he=N.min.x,ce=N.min.y,fe=N.isBox3?N.min.z:0;else{const Cn=Math.pow(2,-P);j=Math.floor(je.width*Cn),X=Math.floor(je.height*Cn),y.isDataArrayTexture?ie=je.depth:y.isData3DTexture?ie=Math.floor(je.depth*Cn):ie=1,he=0,ce=0,fe=0}U!==null?(ge=U.x,ye=U.y,Pe=U.z):(ge=0,ye=0,Pe=0);const Ve=Ke.convert(R.format),Le=Ke.convert(R.type);let rt;R.isData3DTexture?(L.setTexture3D(R,0),rt=H.TEXTURE_3D):R.isDataArrayTexture||R.isCompressedArrayTexture?(L.setTexture2DArray(R,0),rt=H.TEXTURE_2D_ARRAY):(L.setTexture2D(R,0),rt=H.TEXTURE_2D),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,R.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,R.unpackAlignment);const ke=H.getParameter(H.UNPACK_ROW_LENGTH),It=H.getParameter(H.UNPACK_IMAGE_HEIGHT),mn=H.getParameter(H.UNPACK_SKIP_PIXELS),vt=H.getParameter(H.UNPACK_SKIP_ROWS),Et=H.getParameter(H.UNPACK_SKIP_IMAGES);H.pixelStorei(H.UNPACK_ROW_LENGTH,je.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,je.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,he),H.pixelStorei(H.UNPACK_SKIP_ROWS,ce),H.pixelStorei(H.UNPACK_SKIP_IMAGES,fe);const Xe=y.isDataArrayTexture||y.isData3DTexture,Xt=R.isDataArrayTexture||R.isData3DTexture;if(y.isDepthTexture){const Cn=ze.get(y),Ut=ze.get(R),xn=ze.get(Cn.__renderTarget),Gp=ze.get(Ut.__renderTarget);We.bindFramebuffer(H.READ_FRAMEBUFFER,xn.__webglFramebuffer),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,Gp.__webglFramebuffer);for(let Wr=0;Wr<ie;Wr++)Xe&&(H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,ze.get(y).__webglTexture,P,fe+Wr),H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,ze.get(R).__webglTexture,z,Pe+Wr)),H.blitFramebuffer(he,ce,j,X,ge,ye,j,X,H.DEPTH_BUFFER_BIT,H.NEAREST);We.bindFramebuffer(H.READ_FRAMEBUFFER,null),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else if(P!==0||y.isRenderTargetTexture||ze.has(y)){const Cn=ze.get(y),Ut=ze.get(R);We.bindFramebuffer(H.READ_FRAMEBUFFER,B),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,k);for(let xn=0;xn<ie;xn++)Xe?H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,Cn.__webglTexture,P,fe+xn):H.framebufferTexture2D(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Cn.__webglTexture,P),Xt?H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,Ut.__webglTexture,z,Pe+xn):H.framebufferTexture2D(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Ut.__webglTexture,z),P!==0?H.blitFramebuffer(he,ce,j,X,ge,ye,j,X,H.COLOR_BUFFER_BIT,H.NEAREST):Xt?H.copyTexSubImage3D(rt,z,ge,ye,Pe+xn,he,ce,j,X):H.copyTexSubImage2D(rt,z,ge,ye,he,ce,j,X);We.bindFramebuffer(H.READ_FRAMEBUFFER,null),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else Xt?y.isDataTexture||y.isData3DTexture?H.texSubImage3D(rt,z,ge,ye,Pe,j,X,ie,Ve,Le,je.data):R.isCompressedArrayTexture?H.compressedTexSubImage3D(rt,z,ge,ye,Pe,j,X,ie,Ve,je.data):H.texSubImage3D(rt,z,ge,ye,Pe,j,X,ie,Ve,Le,je):y.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,z,ge,ye,j,X,Ve,Le,je.data):y.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,z,ge,ye,je.width,je.height,Ve,je.data):H.texSubImage2D(H.TEXTURE_2D,z,ge,ye,j,X,Ve,Le,je);H.pixelStorei(H.UNPACK_ROW_LENGTH,ke),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,It),H.pixelStorei(H.UNPACK_SKIP_PIXELS,mn),H.pixelStorei(H.UNPACK_SKIP_ROWS,vt),H.pixelStorei(H.UNPACK_SKIP_IMAGES,Et),z===0&&R.generateMipmaps&&H.generateMipmap(rt),We.unbindTexture()},this.copyTextureToTexture3D=function(y,R,N=null,U=null,P=0){return Vc('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(y,R,N,U,P)},this.initRenderTarget=function(y){ze.get(y).__webglFramebuffer===void 0&&L.setupRenderTarget(y)},this.initTexture=function(y){y.isCubeTexture?L.setTextureCube(y,0):y.isData3DTexture?L.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?L.setTexture2DArray(y,0):L.setTexture2D(y,0),We.unbindTexture()},this.resetState=function(){w=0,I=0,T=null,We.reset(),it.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Yi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=tt._getDrawingBufferColorSpace(e),t.unpackColorSpace=tt._getUnpackColorSpace()}}var Lo=function(){var i=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(h){h.preventDefault(),n(++i%e.children.length)},!1);function t(h){return e.appendChild(h.dom),h}function n(h){for(var u=0;u<e.children.length;u++)e.children[u].style.display=u===h?"block":"none";i=h}var s=(performance||Date).now(),r=s,a=0,o=t(new Lo.Panel("FPS","#0ff","#002")),c=t(new Lo.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new Lo.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:e,addPanel:t,showPanel:n,begin:function(){s=(performance||Date).now()},end:function(){a++;var h=(performance||Date).now();if(c.update(h-s,200),h>=r+1e3&&(o.update(a*1e3/(h-r),100),r=h,a=0,l)){var u=performance.memory;l.update(u.usedJSHeapSize/1048576,u.jsHeapSizeLimit/1048576)}return h},update:function(){s=this.end()},domElement:e,setMode:n}};Lo.Panel=function(i,e,t){var n=1/0,s=0,r=Math.round,a=r(window.devicePixelRatio||1),o=80*a,c=48*a,l=3*a,h=2*a,u=3*a,d=15*a,f=74*a,p=30*a,m=document.createElement("canvas");m.width=o,m.height=c,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*a+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=t,g.fillRect(0,0,o,c),g.fillStyle=e,g.fillText(i,l,h),g.fillRect(u,d,f,p),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(u,d,f,p),{dom:m,update:function(A,_){n=Math.min(n,A),s=Math.max(s,A),g.fillStyle=t,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=e,g.fillText(r(A)+" "+i+" ("+r(n)+"-"+r(s)+")",l,h),g.drawImage(m,u+a,d,f-a,p,u,d,f-a,p),g.fillRect(u+f-a,d,a,p),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(u+f-a,d,a,r((1-A/_)*p))}}};function Zg(i,e){if(e===Gy)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===Su||e===rA){let t=i.getIndex();if(t===null){const a=[],o=i.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);i.setIndex(a),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,s=[];if(e===Su)for(let a=1;a<=n;a++)s.push(t.getX(0)),s.push(t.getX(a)),s.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(s.push(t.getX(a)),s.push(t.getX(a+1)),s.push(t.getX(a+2))):(s.push(t.getX(a+2)),s.push(t.getX(a+1)),s.push(t.getX(a)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=i.clone();return r.setIndex(s),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}class Md extends ci{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new a1(t)}),this.register(function(t){return new o1(t)}),this.register(function(t){return new g1(t)}),this.register(function(t){return new m1(t)}),this.register(function(t){return new x1(t)}),this.register(function(t){return new l1(t)}),this.register(function(t){return new h1(t)}),this.register(function(t){return new u1(t)}),this.register(function(t){return new d1(t)}),this.register(function(t){return new r1(t)}),this.register(function(t){return new f1(t)}),this.register(function(t){return new c1(t)}),this.register(function(t){return new A1(t)}),this.register(function(t){return new p1(t)}),this.register(function(t){return new i1(t)}),this.register(function(t){return new b1(t)}),this.register(function(t){return new E1(t)})}load(e,t,n,s){const r=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=Ar.extractUrlBase(e);a=Ar.resolveURL(l,this.path)}else a=Ar.extractUrlBase(e);this.manager.itemStart(e);const o=function(l){s?s(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new os(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,s){let r;const 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))===$g){try{a[At.KHR_BINARY_GLTF]=new y1(e)}catch(u){s&&s(u);return}r=JSON.parse(a[At.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new D1(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++){const 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){const u=r.extensionsUsed[h],d=r.extensionsRequired||[];switch(u){case At.KHR_MATERIALS_UNLIT:a[u]=new s1;break;case At.KHR_DRACO_MESH_COMPRESSION:a[u]=new _1(r,this.dracoLoader);break;case At.KHR_TEXTURE_TRANSFORM:a[u]=new w1;break;case At.KHR_MESH_QUANTIZATION:a[u]=new v1;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,s)}parseAsync(e,t){const n=this;return new Promise(function(s,r){n.parse(e,t,s,r)})}}function n1(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}const At={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",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class i1{constructor(e){this.parser=e,this.name=At.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){const 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){const t=this.parser,n="light:"+e;let s=t.cache.get(n);if(s)return s;const r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let l;const h=new Fe(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],un);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new Ad(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Ml(h),l.distance=u;break;case"spot":l=new Ag(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),cs(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(l),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const 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)})}}class s1{constructor(){this.name=At.KHR_MATERIALS_UNLIT}getMaterialType(){return Ds}extendParams(e,t,n){const s=[];e.color=new Fe(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],un),e.opacity=a[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",r.baseColorTexture,yt))}return Promise.all(s)}}class r1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class a1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Je(o,o)}return Promise.all(r)}}class o1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class c1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class l1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Fe(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=s.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],un)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,yt)),a.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class h1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class u1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new Fe().setRGB(o[0],o[1],o[2],un),Promise.all(r)}}class d1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class f1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new Fe().setRGB(o[0],o[1],o[2],un),a.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,yt)),Promise.all(r)}}class p1{constructor(e){this.parser=e,this.name=At.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class A1{constructor(e){this.parser=e,this.name=At.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Oi}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],a=s.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class g1{constructor(e){this.parser=e,this.name=At.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const r=s.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)}}class m1{constructor(e){this.parser=e,this.name=At.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=s.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class x1{constructor(e){this.parser=e,this.name=At.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=s.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class b1{constructor(e){this.name=At.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.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){const c=s.byteOffset||0,l=s.byteLength||0,h=s.count,u=s.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,s.mode,s.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(f),h,u,d,s.mode,s.filter),f})})}else return null}}class E1{constructor(e){this.name=At.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=t.meshes[n.mesh];for(const l of s.primitives)if(l.mode!==li.TRIANGLES&&l.mode!==li.TRIANGLE_STRIP&&l.mode!==li.TRIANGLE_FAN&&l.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],c={};for(const 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=>{const h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,f=[];for(const p of u){const m=new Re,g=new G,A=new Yt,_=new G(1,1,1),x=new qA(p.geometry,p.material,d);for(let E=0;E<d;E++)c.TRANSLATION&&g.fromBufferAttribute(c.TRANSLATION,E),c.ROTATION&&A.fromBufferAttribute(c.ROTATION,E),c.SCALE&&_.fromBufferAttribute(c.SCALE,E),x.setMatrixAt(E,m.compose(g,A,_));for(const E in c)if(E==="_COLOR_0"){const S=c[E];x.instanceColor=new nd(S.array,S.itemSize,S.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,c[E]);Tt.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),f.push(x)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}}const $g="glTF",Po=12,em={JSON:1313821514,BIN:5130562};class y1{constructor(e){this.name=At.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Po),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!==$g)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-Po,r=new DataView(e,Po);let a=0;for(;a<s;){const o=r.getUint32(a,!0);a+=4;const c=r.getUint32(a,!0);if(a+=4,c===em.JSON){const l=new Uint8Array(e,Po+a,o);this.content=n.decode(l)}else if(c===em.BIN){const l=Po+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class _1{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=At.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,s=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(const h in a){const u=Td[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=Td[h]||h.toLowerCase();if(a[h]!==void 0){const d=n.accessors[e.attributes[h]],f=va[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){s.decodeDracoFile(h,function(f){for(const p in f.attributes){const m=f.attributes[p],g=c[p];g!==void 0&&(m.normalized=g)}u(f)},o,l,un,d)})})}}class w1{constructor(){this.name=At.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}}class v1{constructor(){this.name=At.KHR_MESH_QUANTIZATION}}class tm extends Ro{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let a=0;a!==s;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,s){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=s-t,u=(n-t)/h,d=u*u,f=d*u,p=e*l,m=p-l,g=-2*f+3*d,A=f-d,_=1-g,x=A-d+u;for(let E=0;E!==o;E++){const S=a[m+E+o],w=a[m+E+c]*h,I=a[p+E+o],T=a[p+E]*h;r[E]=_*S+x*w+g*I+A*T}return r}}const C1=new Yt;class I1 extends tm{interpolate_(e,t,n,s){const r=super.interpolate_(e,t,n,s);return C1.fromArray(r).normalize().toArray(r),r}}const li={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},va={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},nm={9728:Pn,9729:qt,9984:Yp,9985:Rc,9986:no,9987:ri},im={33071:Zn,33648:Tc,10497:Ss},Bd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Td={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"},Qs={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},S1={CUBICSPLINE:void 0,LINEAR:po,STEP:fo},Rd={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function M1(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new To({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ji})),i.DefaultMaterial}function Er(i,e,t){for(const n in t.extensions)i[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function cs(i,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(i.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function B1(i,e,t){let n=!1,s=!1,r=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(s=!0),u.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(i);const a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(n){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):i.attributes.position;a.push(d)}if(s){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):i.attributes.normal;o.push(d)}if(r){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):i.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],d=l[2];return n&&(i.morphAttributes.position=h),s&&(i.morphAttributes.normal=u),r&&(i.morphAttributes.color=d),i.morphTargetsRelative=!0,i})}function T1(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)i.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function R1(i){let e;const t=i.extensions&&i.extensions[At.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Fd(t.attributes):e=i.indices+":"+Fd(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,s=i.targets.length;n<s;n++)e+=":"+Fd(i.targets[n]);return e}function Fd(i){let e="";const t=Object.keys(i).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+i[t[n]]+";";return e}function Nd(i){switch(i){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 F1(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const N1=new Re;class D1{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new n1,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,s=-1,r=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const c=o.match(/Version\/(\d+)/);s=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&&s<17||r&&a<98?this.textureLoader=new dg(this.options.manager):this.textureLoader=new kw(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new os(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){const n=this,s=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){const o={scene:a[0][s.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:s.asset,parser:n,userData:{}};return Er(r,o,s),cs(o,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(const c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const a=t[s].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let s=0,r=e.length;s<r;s++){const a=e[s];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;const s=n.clone(),r=(a,o)=>{const c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(const[l,h]of a.children.entries())r(h,o.children[l])};return r(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const s=e(t[n]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let s=0;s<t.length;s++){const r=e(t[s]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const 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[At.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(r,a){n.load(Ar.resolveURL(t.uri,s.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const s=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const a=Bd[s.type],o=va[s.componentType],c=s.normalized===!0,l=new o(s.count*a);return Promise.resolve(new Sn(l,a,c))}const r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(a){const o=a[0],c=Bd[s.type],l=va[s.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=s.byteOffset||0,f=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,p=s.normalized===!0;let m,g;if(f&&f!==u){const A=Math.floor(d/f),_="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+A+":"+s.count;let x=t.cache.get(_);x||(m=new l(o,A*f,s.count*f/h),x=new V_(m,f/h),t.cache.add(_,x)),g=new $u(x,c,d%f/h,p)}else o===null?m=new l(s.count*c):m=new l(o,d,s.count*c),g=new Sn(m,c,p);if(s.sparse!==void 0){const A=Bd.SCALAR,_=va[s.sparse.indices.componentType],x=s.sparse.indices.byteOffset||0,E=s.sparse.values.byteOffset||0,S=new _(a[1],x,s.sparse.count*A),w=new l(a[2],E,s.sparse.count*c);o!==null&&(g=new Sn(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let I=0,T=S.length;I<T;I++){const C=S[I];if(g.setX(C,w[I*c]),c>=2&&g.setY(C,w[I*c+1]),c>=3&&g.setZ(C,w[I*c+2]),c>=4&&g.setW(C,w[I*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=p}return g})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,a=t.images[r];let o=this.textureLoader;if(a.uri){const c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){const s=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];const 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);const d=(r.samplers||{})[a.sampler]||{};return h.magFilter=nm[d.magFilter]||qt,h.minFilter=nm[d.minFilter]||ri,h.wrapS=im[d.wrapS]||Ss,h.wrapT=im[d.wrapT]||Ss,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Pn&&h.minFilter!==qt,s.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=s.images[e],o=self.URL||self.webkitURL;let c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;const 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");const h=Promise.resolve(c).then(function(u){return new Promise(function(d,f){let p=d;t.isImageBitmapLoader===!0&&(p=function(m){const g=new nn(m);g.needsUpdate=!0,d(g)}),t.load(Ar.resolveURL(u,r.path),p,void 0,f)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),cs(u,a),u.userData.mimeType=a.mimeType||F1(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,s){const 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[At.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[At.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=r.associations.get(a);a=r.extensions[At.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,c)}}return s!==void 0&&(a.colorSpace=s),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new ad,ai.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){const o="LineBasicMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new ma,ai.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(s||r||a){let o="ClonedMaterial:"+n.uuid+":";s&&(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),s&&(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 To}loadMaterial(e){const t=this,n=this.json,s=this.extensions,r=n.materials[e];let a;const o={},c=r.extensions||{},l=[];if(c[At.KHR_MATERIALS_UNLIT]){const u=s[At.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{const u=r.pbrMetallicRoughness||{};if(o.color=new Fe(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],un),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,yt)),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=Pi);const h=r.alphaMode||Rd.OPAQUE;if(h===Rd.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Rd.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==Ds&&(l.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Je(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==Ds&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==Ds){const u=r.emissiveFactor;o.emissive=new Fe().setRGB(u[0],u[1],u[2],un)}return r.emissiveTexture!==void 0&&a!==Ds&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,yt)),Promise.all(l).then(function(){const u=new a(o);return r.name&&(u.name=r.name),cs(u,r),t.associations.set(u,{materials:e}),r.extensions&&Er(s,u,r),u})}createUniqueName(e){const t=_t.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,s=this.primitiveCache;function r(o){return n[At.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return sm(c,o,t)})}const a=[];for(let o=0,c=e.length;o<c;o++){const l=e[o],h=R1(l),u=s[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[At.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=sm(new Mn,l,t),s[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,s=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let c=0,l=a.length;c<l;c++){const h=a[c].material===void 0?M1(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let f=0,p=h.length;f<p;f++){const m=h[f],g=a[f];let A;const _=l[f];if(g.mode===li.TRIANGLES||g.mode===li.TRIANGLE_STRIP||g.mode===li.TRIANGLE_FAN||g.mode===void 0)A=r.isSkinnedMesh===!0?new HA(m,_):new Zt(m,_),A.isSkinnedMesh===!0&&A.normalizeSkinWeights(),g.mode===li.TRIANGLE_STRIP?A.geometry=Zg(A.geometry,rA):g.mode===li.TRIANGLE_FAN&&(A.geometry=Zg(A.geometry,Su));else if(g.mode===li.LINES)A=new xl(m,_);else if(g.mode===li.LINE_STRIP)A=new gl(m,_);else if(g.mode===li.LINE_LOOP)A=new Y_(m,_);else if(g.mode===li.POINTS)A=new J_(m,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(A.geometry.morphAttributes).length>0&&T1(A,r),A.name=t.createUniqueName(r.name||"mesh_"+e),cs(A,r),g.extensions&&Er(s,A,g),t.assignFinalMaterial(A),u.push(A)}for(let f=0,p=u.length;f<p;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return r.extensions&&Er(s,u[0],r),u[0];const d=new ss;r.extensions&&Er(s,d,r),t.associations.set(d,{meshes:e});for(let f=0,p=u.length;f<p;f++)d.add(u[f]);return d})}loadCamera(e){let t;const n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Bn(In.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new pd(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),cs(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,r=t.joints.length;s<r;s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const r=s.pop(),a=s,o=[],c=[];for(let l=0,h=a.length;l<h;l++){const u=a[l];if(u){o.push(u);const d=new Re;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 hl(o,c)})}loadAnimation(e){const t=this.json,n=this,s=t.animations[e],r=s.name?s.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=s.channels.length;u<d;u++){const f=s.channels[u],p=s.samplers[f.sampler],m=f.target,g=m.node,A=s.parameters!==void 0?s.parameters[p.input]:p.input,_=s.parameters!==void 0?s.parameters[p.output]:p.output;m.node!==void 0&&(a.push(this.getDependency("node",g)),o.push(this.getDependency("accessor",A)),c.push(this.getDependency("accessor",_)),l.push(p),h.push(m))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const d=u[0],f=u[1],p=u[2],m=u[3],g=u[4],A=[];for(let _=0,x=d.length;_<x;_++){const E=d[_],S=f[_],w=p[_],I=m[_],T=g[_];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();const C=n._createAnimationTracks(E,S,w,I,T);if(C)for(let v=0;v<C.length;v++)A.push(C[v])}return new Sl(r,void 0,A)})}createNodeMesh(e){const t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(r){const a=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=s.weights.length;c<l;c++)o.morphTargetInfluences[c]=s.weights[c]}),a})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=s.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(a),c]).then(function(l){const h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,N1)});for(let f=0,p=u.length;f<p;f++)h.add(u[f]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],a=r.name?s.createUniqueName(r.name):"",o=[],c=s._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),r.camera!==void 0&&o.push(s.getDependency("camera",r.camera).then(function(l){return s._getNodeRef(s.cameraCache,r.camera,l)})),s._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 cl:l.length>1?h=new ss:l.length===1?h=l[0]:h=new Tt,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),cs(h,r),r.extensions&&Er(n,h,r),r.matrix!==void 0){const u=new Re;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);return s.associations.has(h)||s.associations.set(h,{}),s.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],s=this,r=new ss;n.name&&(r.name=s.createUniqueName(n.name)),cs(r,n),n.extensions&&Er(t,r,n);const a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(s.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++)r.add(c[h]);const l=h=>{const u=new Map;for(const[d,f]of s.associations)(d instanceof ai||d instanceof nn)&&u.set(d,f);return h.traverse(d=>{const f=s.associations.get(d);f!=null&&u.set(d,f)}),u};return s.associations=l(r),r})}_createAnimationTracks(e,t,n,s,r){const a=[],o=e.name?e.name:e.uuid,c=[];Qs[r.path]===Qs.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(Qs[r.path]){case Qs.weights:l=fr;break;case Qs.rotation:l=Us;break;case Qs.translation:case Qs.scale:l=pr;break;default:n.itemSize===1?l=fr:l=pr;break}const h=s.interpolation!==void 0?S1[s.interpolation]:po,u=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d<f;d++){const p=new l(c[d]+"."+Qs[r.path],t.array,u,h);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(p),a.push(p)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Nd(t.constructor),s=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)s[r]=t[r]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const s=this instanceof Us?I1:tm;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function L1(i,e,t){const n=e.attributes,s=new ki;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(s.set(new G(c[0],c[1],c[2]),new G(l[0],l[1],l[2])),o.normalized){const h=Nd(va[o.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const o=new G,c=new G;for(let l=0,h=r.length;l<h;l++){const u=r[l];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){const m=Nd(va[d.componentType]);c.multiplyScalar(m)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(o)}i.boundingBox=s;const a=new Ui;s.getCenter(a.center),a.radius=s.min.distanceTo(s.max)/2,i.boundingSphere=a}function sm(i,e,t){const n=e.attributes,s=[];function r(a,o){return t.getDependency("accessor",a).then(function(c){i.setAttribute(o,c)})}for(const a in n){const o=Td[a]||a.toLowerCase();o in i.attributes||s.push(r(n[a],o))}if(e.indices!==void 0&&!i.index){const a=t.getDependency("accessor",e.indices).then(function(o){i.setIndex(o)});s.push(a)}return tt.workingColorSpace!==un&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${tt.workingColorSpace}" not supported.`),cs(i,e),L1(i,e,t),Promise.all(s).then(function(){return e.targets!==void 0?B1(i,e.targets,t):i})}var P1=(function(){var i="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok: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;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",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 s=WebAssembly.validate(t)?e:i,r,a=WebAssembly.instantiate(o(s),{}).then(function(A){r=A.instance,r.exports.__wasm_call_ctors()});function o(A){for(var _=new Uint8Array(A.length),x=0;x<A.length;++x){var E=A.charCodeAt(x);_[x]=E>96?E-97:E>64?E-39:E+4}for(var S=0,x=0;x<A.length;++x)_[S++]=_[x]<60?n[_[x]]:(_[x]-60)*64+_[++x];return _.buffer.slice(0,S)}function c(A,_,x,E,S,w){var I=r.exports.sbrk,T=x+3&-4,C=I(T*E),v=I(S.length),F=new Uint8Array(r.exports.memory.buffer);F.set(S,v);var K=A(C,x,E,v,S.length);if(K==0&&w&&w(C,T,E),_.set(F.subarray(C,C+x*E)),I(C-I(0)),K!=0)throw new Error("Malformed buffer data: "+K)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;function f(A){var _={object:new Worker(A),pending:0,requests:{}};return _.object.onmessage=function(x){var E=x.data;_.pending-=E.count,_.requests[E.id][E.action](E.value),delete _.requests[E.id]},_}function p(A){for(var _="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(o(s))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+c.toString()+g.toString(),x=new Blob([_],{type:"text/javascript"}),E=URL.createObjectURL(x),S=0;S<A;++S)u[S]=f(E);URL.revokeObjectURL(E)}function m(A,_,x,E,S){for(var w=u[0],I=1;I<u.length;++I)u[I].pending<w.pending&&(w=u[I]);return new Promise(function(T,C){var v=new Uint8Array(x),F=d++;w.pending+=A,w.requests[F]={resolve:T,reject:C},w.object.postMessage({id:F,count:A,size:_,source:v,mode:E,filter:S},[v.buffer])})}function g(A){a.then(function(){var _=A.data;try{var x=new Uint8Array(_.count*_.size);c(r.exports[_.mode],x,_.count,_.size,_.source,r.exports[_.filter]),self.postMessage({id:_.id,count:_.count,action:"resolve",value:x},[x.buffer])}catch(E){self.postMessage({id:_.id,count:_.count,action:"reject",value:E})}})}return{ready:a,supported:!0,useWorkers:function(A){p(A)},decodeVertexBuffer:function(A,_,x,E,S){c(r.exports.meshopt_decodeVertexBuffer,A,_,x,E,r.exports[l[S]])},decodeIndexBuffer:function(A,_,x,E){c(r.exports.meshopt_decodeIndexBuffer,A,_,x,E)},decodeIndexSequence:function(A,_,x,E){c(r.exports.meshopt_decodeIndexSequence,A,_,x,E)},decodeGltfBuffer:function(A,_,x,E,S,w){c(r.exports[h[S]],A,_,x,E,r.exports[l[w]])},decodeGltfBufferAsync:function(A,_,x,E,S){return u.length>0?m(A,_,x,h[E],l[S]):a.then(function(){var w=new Uint8Array(A*_);return c(r.exports[h[E]],w,A,_,x,r.exports[l[S]]),w})}}})();const rm={type:"change"},Dd={type:"start"},am={type:"end"},Ll=new Eo,om=new ks,k1=Math.cos(70*In.DEG2RAD),An=new G,jn=2*Math.PI,Ft={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Ld=1e-6;class U1 extends $w{constructor(e,t=null){super(e,t),this.state=Ft.NONE,this.target=new G,this.cursor=new G,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qr.ROTATE,MIDDLE:qr.DOLLY,RIGHT:qr.PAN},this.touches={ONE:Kr.ROTATE,TWO:Kr.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new G,this._lastQuaternion=new Yt,this._lastTargetPosition=new G,this._quat=new Yt().setFromUnitVectors(e.up,new G(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new bg,this._sphericalDelta=new bg,this._scale=1,this._panOffset=new G,this._rotateStart=new Je,this._rotateEnd=new Je,this._rotateDelta=new Je,this._panStart=new Je,this._panEnd=new Je,this._panDelta=new Je,this._dollyStart=new Je,this._dollyEnd=new Je,this._dollyDelta=new Je,this._dollyDirection=new G,this._mouse=new Je,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Q1.bind(this),this._onPointerDown=O1.bind(this),this._onPointerUp=G1.bind(this),this._onContextMenu=j1.bind(this),this._onMouseWheel=V1.bind(this),this._onKeyDown=W1.bind(this),this._onTouchStart=q1.bind(this),this._onTouchMove=K1.bind(this),this._onMouseDown=H1.bind(this),this._onMouseMove=z1.bind(this),this._interceptControlDown=X1.bind(this),this._interceptControlUp=Y1.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(rm),this.update(),this.state=Ft.NONE}update(e=null){const t=this.object.position;An.copy(t).sub(this.target),An.applyQuaternion(this._quat),this._spherical.setFromVector3(An),this.autoRotate&&this.state===Ft.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(n)&&isFinite(s)&&(n<-Math.PI?n+=jn:n>Math.PI&&(n-=jn),s<-Math.PI?s+=jn:s>Math.PI&&(s-=jn),n<=s?this._spherical.theta=Math.max(n,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+s)/2?Math.max(n,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(An.setFromSpherical(this._spherical),An.applyQuaternion(this._quatInverse),t.copy(this.target).add(An),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=An.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){const o=new G(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;const l=new G(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=An.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Ll.origin.copy(this.object.position),Ll.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Ll.direction))<k1?this.object.lookAt(this.target):(om.setFromNormalAndCoplanarPoint(this.object.up,this.target),Ll.intersectPlane(om,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Ld||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ld||this._lastTargetPosition.distanceToSquared(this.target)>Ld?(this.dispatchEvent(rm),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?jn/60*this.autoRotateSpeed*e:jn/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){An.setFromMatrixColumn(t,0),An.multiplyScalar(-e),this._panOffset.add(An)}_panUp(e,t){this.screenSpacePanning===!0?An.setFromMatrixColumn(t,1):(An.setFromMatrixColumn(t,0),An.crossVectors(this.object.up,An)),An.multiplyScalar(e),this._panOffset.add(An)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;An.copy(s).sub(this.target);let r=An.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),s=e-n.left,r=t-n.top,a=n.width,o=n.height;this._mouse.x=s/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(jn*this._rotateDelta.x/t.clientHeight),this._rotateUp(jn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(jn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-jn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(jn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-jn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._rotateStart.set(n,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panStart.set(n,s)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),s=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(jn*this._rotateDelta.x/t.clientHeight),this._rotateUp(jn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panEnd.set(n,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Je,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function O1(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function Q1(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function G1(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(am),this.state=Ft.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function H1(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Ft.DOLLY;break;case qr.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ft.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ft.ROTATE}break;case qr.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ft.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ft.PAN}break;default:this.state=Ft.NONE}this.state!==Ft.NONE&&this.dispatchEvent(Dd)}function z1(i){switch(this.state){case Ft.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Ft.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Ft.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function V1(i){this.enabled===!1||this.enableZoom===!1||this.state!==Ft.NONE||(i.preventDefault(),this.dispatchEvent(Dd),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(am))}function W1(i){this.enabled!==!1&&this._handleKeyDown(i)}function q1(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Kr.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Ft.TOUCH_ROTATE;break;case Kr.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Ft.TOUCH_PAN;break;default:this.state=Ft.NONE}break;case 2:switch(this.touches.TWO){case Kr.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Ft.TOUCH_DOLLY_PAN;break;case Kr.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Ft.TOUCH_DOLLY_ROTATE;break;default:this.state=Ft.NONE}break;default:this.state=Ft.NONE}this.state!==Ft.NONE&&this.dispatchEvent(Dd)}function K1(i){switch(this._trackPointer(i),this.state){case Ft.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Ft.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Ft.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Ft.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Ft.NONE}}function j1(i){this.enabled!==!1&&i.preventDefault()}function X1(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Y1(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class J1 extends Zu{constructor(){super();const e=new da;e.deleteAttribute("uv");const t=new To({side:Ln}),n=new To,s=new Ml(16777215,900,28,2);s.position.set(.418,16.199,.3),this.add(s);const r=new Zt(e,t);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const a=new qA(e,n,6),o=new Tt;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);const c=new Zt(e,Ca(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);const l=new Zt(e,Ca(50));l.position.set(-16.109,18.021,-8.207),l.scale.set(.1,2.425,2.751),this.add(l);const h=new Zt(e,Ca(17));h.position.set(14.904,12.198,-1.832),h.scale.set(.15,4.265,6.331),this.add(h);const u=new Zt(e,Ca(43));u.position.set(-.462,8.89,14.52),u.scale.set(4.38,5.441,.088),this.add(u);const d=new Zt(e,Ca(20));d.position.set(3.235,11.486,-12.541),d.scale.set(2.5,2,.1),this.add(d);const f=new Zt(e,Ca(100));f.position.set(0,20,0),f.scale.set(1,.1,1),this.add(f)}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}}function Ca(i){const e=new Ds;return e.color.setScalar(i),e}function Z1(i){if(!(typeof window>"u")){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=i,document.head.appendChild(e),i}}function Ia(i,e){var t=i.__state.conversionName.toString(),n=Math.round(i.r),s=Math.round(i.g),r=Math.round(i.b),a=i.a,o=Math.round(i.h),c=i.s.toFixed(1),l=i.v.toFixed(1);if(e||t==="THREE_CHAR_HEX"||t==="SIX_CHAR_HEX"){for(var h=i.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}else{if(t==="CSS_RGB")return"rgb("+n+","+s+","+r+")";if(t==="CSS_RGBA")return"rgba("+n+","+s+","+r+","+a+")";if(t==="HEX")return"0x"+i.hex.toString(16);if(t==="RGB_ARRAY")return"["+n+","+s+","+r+"]";if(t==="RGBA_ARRAY")return"["+n+","+s+","+r+","+a+"]";if(t==="RGB_OBJ")return"{r:"+n+",g:"+s+",b:"+r+"}";if(t==="RGBA_OBJ")return"{r:"+n+",g:"+s+",b:"+r+",a:"+a+"}";if(t==="HSV_OBJ")return"{h:"+o+",s:"+c+",v:"+l+"}";if(t==="HSVA_OBJ")return"{h:"+o+",s:"+c+",v:"+l+",a:"+a+"}"}return"unknown format"}var cm=Array.prototype.forEach,ko=Array.prototype.slice,ue={BREAK:{},extend:function(e){return this.each(ko.call(arguments,1),function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach((function(s){this.isUndefined(t[s])||(e[s]=t[s])}).bind(this))},this),e},defaults:function(e){return this.each(ko.call(arguments,1),function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach((function(s){this.isUndefined(e[s])&&(e[s]=t[s])}).bind(this))},this),e},compose:function(){var e=ko.call(arguments);return function(){for(var t=ko.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e){if(cm&&e.forEach&&e.forEach===cm)e.forEach(t,n);else if(e.length===e.length+0){var s=void 0,r=void 0;for(s=0,r=e.length;s<r;s++)if(s in e&&t.call(n,e[s],s)===this.BREAK)return}else for(var a in e)if(t.call(n,e[a],a)===this.BREAK)return}},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var s=void 0;return function(){var r=this,a=arguments;function o(){s=null,n||e.apply(r,a)}var c=n||!s;clearTimeout(s),s=setTimeout(o,t),c&&e.apply(r,a)}},toArray:function(e){return e.toArray?e.toArray():ko.call(e)},isUndefined:function(e){return e===void 0},isNull:function(e){return e===null},isNaN:(function(i){function e(t){return i.apply(this,arguments)}return e.toString=function(){return i.toString()},e})(function(i){return isNaN(i)}),isArray:Array.isArray||function(i){return i.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return e===!1||e===!0},isFunction:function(e){return e instanceof Function}},$1=[{litmus:ue.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return t===null?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:Ia},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return t===null?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:Ia},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t===null?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:Ia},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t===null?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:Ia}}},{litmus:ue.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:ue.isArray,conversions:{RGB_ARRAY:{read:function(e){return e.length!==3?!1:{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return e.length!==4?!1:{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:ue.isObject,conversions:{RGBA_OBJ:{read:function(e){return ue.isNumber(e.r)&&ue.isNumber(e.g)&&ue.isNumber(e.b)&&ue.isNumber(e.a)?{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return ue.isNumber(e.r)&&ue.isNumber(e.g)&&ue.isNumber(e.b)?{space:"RGB",r:e.r,g:e.g,b:e.b}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return ue.isNumber(e.h)&&ue.isNumber(e.s)&&ue.isNumber(e.v)&&ue.isNumber(e.a)?{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return ue.isNumber(e.h)&&ue.isNumber(e.s)&&ue.isNumber(e.v)?{space:"HSV",h:e.h,s:e.s,v:e.v}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],Uo=void 0,Pl=void 0,Pd=function(){Pl=!1;var e=arguments.length>1?ue.toArray(arguments):arguments[0];return ue.each($1,function(t){if(t.litmus(e))return ue.each(t.conversions,function(n,s){if(Uo=n.read(e),Pl===!1&&Uo!==!1)return Pl=Uo,Uo.conversionName=s,Uo.conversion=n,ue.BREAK}),ue.BREAK}),Pl},lm=void 0,kl={hsv_to_rgb:function(e,t,n){var s=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),a=n*(1-t),o=n*(1-r*t),c=n*(1-(1-r)*t),l=[[n,c,a],[o,n,a],[a,n,c],[a,o,n],[c,a,n],[n,a,o]][s];return{r:l[0]*255,g:l[1]*255,b:l[2]*255}},rgb_to_hsv:function(e,t,n){var s=Math.min(e,t,n),r=Math.max(e,t,n),a=r-s,o=void 0,c=void 0;if(r!==0)c=a/r;else return{h:NaN,s:0,v:0};return e===r?o=(t-n)/a:t===r?o=2+(n-e)/a:o=4+(e-t)/a,o/=6,o<0&&(o+=1),{h:o*360,s:c,v:r/255}},rgb_to_hex:function(e,t,n){var s=this.hex_with_component(0,2,e);return s=this.hex_with_component(s,1,t),s=this.hex_with_component(s,0,n),s},component_from_hex:function(e,t){return e>>t*8&255},hex_with_component:function(e,t,n){return n<<(lm=t*8)|e&~(255<<lm)}},eM=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},Ci=function(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")},Ii=(function(){function i(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}})(),Gs=function i(e,t,n){e===null&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,t);if(s===void 0){var r=Object.getPrototypeOf(e);return r===null?void 0:i(r,t,n)}else{if("value"in s)return s.value;var a=s.get;return a===void 0?void 0:a.call(n)}},Hs=function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(i,e):i.__proto__=e)},zs=function(i,e){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:i},En=(function(){function i(){if(Ci(this,i),this.__state=Pd.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return Ii(i,[{key:"toString",value:function(){return Ia(this)}},{key:"toHexString",value:function(){return Ia(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),i})();function kd(i,e,t){Object.defineProperty(i,e,{get:function(){return this.__state.space==="RGB"?this.__state[e]:(En.recalculateRGB(this,e,t),this.__state[e])},set:function(s){this.__state.space!=="RGB"&&(En.recalculateRGB(this,e,t),this.__state.space="RGB"),this.__state[e]=s}})}function Ud(i,e){Object.defineProperty(i,e,{get:function(){return this.__state.space==="HSV"?this.__state[e]:(En.recalculateHSV(this),this.__state[e])},set:function(n){this.__state.space!=="HSV"&&(En.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=n}})}En.recalculateRGB=function(i,e,t){if(i.__state.space==="HEX")i.__state[e]=kl.component_from_hex(i.__state.hex,t);else if(i.__state.space==="HSV")ue.extend(i.__state,kl.hsv_to_rgb(i.__state.h,i.__state.s,i.__state.v));else throw new Error("Corrupted color state")},En.recalculateHSV=function(i){var e=kl.rgb_to_hsv(i.r,i.g,i.b);ue.extend(i.__state,{s:e.s,v:e.v}),ue.isNaN(e.h)?ue.isUndefined(i.__state.h)&&(i.__state.h=0):i.__state.h=e.h},En.COMPONENTS=["r","g","b","h","s","v","hex","a"],kd(En.prototype,"r",2),kd(En.prototype,"g",1),kd(En.prototype,"b",0),Ud(En.prototype,"h"),Ud(En.prototype,"s"),Ud(En.prototype,"v"),Object.defineProperty(En.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(En.prototype,"hex",{get:function(){return this.__state.space!=="HEX"&&(this.__state.hex=kl.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var yr=(function(){function i(e,t){Ci(this,i),this.initialValue=e[t],this.domElement=document.createElement("div"),this.object=e,this.property=t,this.__onChange=void 0,this.__onFinishChange=void 0}return Ii(i,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),i})(),tM={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},hm={};ue.each(tM,function(i,e){ue.each(i,function(t){hm[t]=e})});var nM=/(\d+(\.\d+)?)px/;function Gi(i){if(i==="0"||ue.isUndefined(i))return 0;var e=i.match(nM);return ue.isNull(e)?0:parseFloat(e[1])}var te={makeSelectable:function(e,t){e===void 0||e.style===void 0||(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var s=n,r=t;ue.isUndefined(r)&&(r=!0),ue.isUndefined(s)&&(s=!0),e.style.position="absolute",r&&(e.style.left=0,e.style.right=0),s&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,s){var r=n||{},a=hm[t];if(!a)throw new Error("Event type "+t+" not supported.");var o=document.createEvent(a);switch(a){case"MouseEvents":{var c=r.x||r.clientX||0,l=r.y||r.clientY||0;o.initMouseEvent(t,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,c,l,!1,!1,!1,!1,0,null);break}case"KeyboardEvents":{var h=o.initKeyboardEvent||o.initKeyEvent;ue.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(t,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break}default:{o.initEvent(t,r.bubbles||!1,r.cancelable||!0);break}}ue.defaults(o,s),e.dispatchEvent(o)},bind:function(e,t,n,s){var r=s||!1;return e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on"+t,n),te},unbind:function(e,t,n,s){var r=s||!1;return e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent&&e.detachEvent("on"+t,n),te},addClass:function(e,t){if(e.className===void 0)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);n.indexOf(t)===-1&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return te},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),s=n.indexOf(t);s!==-1&&(n.splice(s,1),e.className=n.join(" "))}else e.className=void 0;return te},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return Gi(t["border-left-width"])+Gi(t["border-right-width"])+Gi(t["padding-left"])+Gi(t["padding-right"])+Gi(t.width)},getHeight:function(e){var t=getComputedStyle(e);return Gi(t["border-top-width"])+Gi(t["border-bottom-width"])+Gi(t["padding-top"])+Gi(t["padding-bottom"])+Gi(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},um=(function(i){Hs(e,i);function e(t,n){Ci(this,e);var s=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=s;s.__prev=s.getValue(),s.__checkbox=document.createElement("input"),s.__checkbox.setAttribute("type","checkbox");function a(){r.setValue(!r.__prev)}return te.bind(s.__checkbox,"change",a,!1),s.domElement.appendChild(s.__checkbox),s.updateDisplay(),s}return Ii(e,[{key:"setValue",value:function(n){var s=Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),s}},{key:"updateDisplay",value:function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(yr),iM=(function(i){Hs(e,i);function e(t,n,s){Ci(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=s,o=r;if(r.__select=document.createElement("select"),ue.isArray(a)){var c={};ue.each(a,function(l){c[l]=l}),a=c}return ue.each(a,function(l,h){var u=document.createElement("option");u.innerHTML=h,u.setAttribute("value",l),o.__select.appendChild(u)}),r.updateDisplay(),te.bind(r.__select,"change",function(){var l=this.options[this.selectedIndex].value;o.setValue(l)}),r.domElement.appendChild(r.__select),r}return Ii(e,[{key:"setValue",value:function(n){var s=Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),s}},{key:"updateDisplay",value:function(){return te.isActive(this.__select)?this:(this.__select.value=this.getValue(),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e})(yr),sM=(function(i){Hs(e,i);function e(t,n){Ci(this,e);var s=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=s;function a(){r.setValue(r.__input.value)}function o(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}return s.__input=document.createElement("input"),s.__input.setAttribute("type","text"),te.bind(s.__input,"keyup",a),te.bind(s.__input,"change",a),te.bind(s.__input,"blur",o),te.bind(s.__input,"keydown",function(c){c.keyCode===13&&this.blur()}),s.updateDisplay(),s.domElement.appendChild(s.__input),s}return Ii(e,[{key:"updateDisplay",value:function(){return te.isActive(this.__input)||(this.__input.value=this.getValue()),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(yr);function dm(i){var e=i.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var fm=(function(i){Hs(e,i);function e(t,n,s){Ci(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=s||{};return r.__min=a.min,r.__max=a.max,r.__step=a.step,ue.isUndefined(r.__step)?r.initialValue===0?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=dm(r.__impliedStep),r}return Ii(e,[{key:"setValue",value:function(n){var s=n;return this.__min!==void 0&&s<this.__min?s=this.__min:this.__max!==void 0&&s>this.__max&&(s=this.__max),this.__step!==void 0&&s%this.__step!==0&&(s=Math.round(s/this.__step)*this.__step),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,s)}},{key:"min",value:function(n){return this.__min=n,this}},{key:"max",value:function(n){return this.__max=n,this}},{key:"step",value:function(n){return this.__step=n,this.__impliedStep=n,this.__precision=dm(n),this}}]),e})(yr);function rM(i,e){var t=Math.pow(10,e);return Math.round(i*t)/t}var Ul=(function(i){Hs(e,i);function e(t,n,s){Ci(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,s));r.__truncationSuspended=!1;var a=r,o=void 0;function c(){var p=parseFloat(a.__input.value);ue.isNaN(p)||a.setValue(p)}function l(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(){l()}function u(p){var m=o-p.clientY;a.setValue(a.getValue()+m*a.__impliedStep),o=p.clientY}function d(){te.unbind(window,"mousemove",u),te.unbind(window,"mouseup",d),l()}function f(p){te.bind(window,"mousemove",u),te.bind(window,"mouseup",d),o=p.clientY}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),te.bind(r.__input,"change",c),te.bind(r.__input,"blur",h),te.bind(r.__input,"mousedown",f),te.bind(r.__input,"keydown",function(p){p.keyCode===13&&(a.__truncationSuspended=!0,this.blur(),a.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return Ii(e,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():rM(this.getValue(),this.__precision),Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(fm);function pm(i,e,t,n,s){return n+(s-n)*((i-e)/(t-e))}var Od=(function(i){Hs(e,i);function e(t,n,s,r,a){Ci(this,e);var o=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:s,max:r,step:a})),c=o;o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),te.bind(o.__background,"mousedown",l),te.bind(o.__background,"touchstart",d),te.addClass(o.__background,"slider"),te.addClass(o.__foreground,"slider-fg");function l(m){document.activeElement.blur(),te.bind(window,"mousemove",h),te.bind(window,"mouseup",u),h(m)}function h(m){m.preventDefault();var g=c.__background.getBoundingClientRect();return c.setValue(pm(m.clientX,g.left,g.right,c.__min,c.__max)),!1}function u(){te.unbind(window,"mousemove",h),te.unbind(window,"mouseup",u),c.__onFinishChange&&c.__onFinishChange.call(c,c.getValue())}function d(m){m.touches.length===1&&(te.bind(window,"touchmove",f),te.bind(window,"touchend",p),f(m))}function f(m){var g=m.touches[0].clientX,A=c.__background.getBoundingClientRect();c.setValue(pm(g,A.left,A.right,c.__min,c.__max))}function p(){te.unbind(window,"touchmove",f),te.unbind(window,"touchend",p),c.__onFinishChange&&c.__onFinishChange.call(c,c.getValue())}return o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return Ii(e,[{key:"updateDisplay",value:function(){var n=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=n*100+"%",Gs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(fm),Am=(function(i){Hs(e,i);function e(t,n,s){Ci(this,e);var r=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=r;return r.__button=document.createElement("div"),r.__button.innerHTML=s===void 0?"Fire":s,te.bind(r.__button,"click",function(o){return o.preventDefault(),a.fire(),!1}),te.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return Ii(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e})(yr),Qd=(function(i){Hs(e,i);function e(t,n){Ci(this,e);var s=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));s.__color=new En(s.getValue()),s.__temp=new En(0);var r=s;s.domElement=document.createElement("div"),te.makeSelectable(s.domElement,!1),s.__selector=document.createElement("div"),s.__selector.className="selector",s.__saturation_field=document.createElement("div"),s.__saturation_field.className="saturation-field",s.__field_knob=document.createElement("div"),s.__field_knob.className="field-knob",s.__field_knob_border="2px solid ",s.__hue_knob=document.createElement("div"),s.__hue_knob.className="hue-knob",s.__hue_field=document.createElement("div"),s.__hue_field.className="hue-field",s.__input=document.createElement("input"),s.__input.type="text",s.__input_textShadow="0 1px 1px ",te.bind(s.__input,"keydown",function(m){m.keyCode===13&&u.call(this)}),te.bind(s.__input,"blur",u),te.bind(s.__selector,"mousedown",function(){te.addClass(this,"drag").bind(window,"mouseup",function(){te.removeClass(r.__selector,"drag")})}),te.bind(s.__selector,"touchstart",function(){te.addClass(this,"drag").bind(window,"touchend",function(){te.removeClass(r.__selector,"drag")})});var a=document.createElement("div");ue.extend(s.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),ue.extend(s.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:s.__field_knob_border+(s.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),ue.extend(s.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),ue.extend(s.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),ue.extend(a.style,{width:"100%",height:"100%",background:"none"}),gm(a,"top","rgba(0,0,0,0)","#000"),ue.extend(s.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),oM(s.__hue_field),ue.extend(s.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:s.__input_textShadow+"rgba(0,0,0,0.7)"}),te.bind(s.__saturation_field,"mousedown",o),te.bind(s.__saturation_field,"touchstart",o),te.bind(s.__field_knob,"mousedown",o),te.bind(s.__field_knob,"touchstart",o),te.bind(s.__hue_field,"mousedown",c),te.bind(s.__hue_field,"touchstart",c);function o(m){f(m),te.bind(window,"mousemove",f),te.bind(window,"touchmove",f),te.bind(window,"mouseup",l),te.bind(window,"touchend",l)}function c(m){p(m),te.bind(window,"mousemove",p),te.bind(window,"touchmove",p),te.bind(window,"mouseup",h),te.bind(window,"touchend",h)}function l(){te.unbind(window,"mousemove",f),te.unbind(window,"touchmove",f),te.unbind(window,"mouseup",l),te.unbind(window,"touchend",l),d()}function h(){te.unbind(window,"mousemove",p),te.unbind(window,"touchmove",p),te.unbind(window,"mouseup",h),te.unbind(window,"touchend",h),d()}function u(){var m=Pd(this.value);m!==!1?(r.__color.__state=m,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}s.__saturation_field.appendChild(a),s.__selector.appendChild(s.__field_knob),s.__selector.appendChild(s.__saturation_field),s.__selector.appendChild(s.__hue_field),s.__hue_field.appendChild(s.__hue_knob),s.domElement.appendChild(s.__input),s.domElement.appendChild(s.__selector),s.updateDisplay();function f(m){m.type.indexOf("touch")===-1&&m.preventDefault();var g=r.__saturation_field.getBoundingClientRect(),A=m.touches&&m.touches[0]||m,_=A.clientX,x=A.clientY,E=(_-g.left)/(g.right-g.left),S=1-(x-g.top)/(g.bottom-g.top);return S>1?S=1:S<0&&(S=0),E>1?E=1:E<0&&(E=0),r.__color.v=S,r.__color.s=E,r.setValue(r.__color.toOriginal()),!1}function p(m){m.type.indexOf("touch")===-1&&m.preventDefault();var g=r.__hue_field.getBoundingClientRect(),A=m.touches&&m.touches[0]||m,_=A.clientY,x=1-(_-g.top)/(g.bottom-g.top);return x>1?x=1:x<0&&(x=0),r.__color.h=x*360,r.setValue(r.__color.toOriginal()),!1}return s}return Ii(e,[{key:"updateDisplay",value:function(){var n=Pd(this.getValue());if(n!==!1){var s=!1;ue.each(En.COMPONENTS,function(o){if(!ue.isUndefined(n[o])&&!ue.isUndefined(this.__color.__state[o])&&n[o]!==this.__color.__state[o])return s=!0,{}},this),s&&ue.extend(this.__color.__state,n)}ue.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var r=this.__color.v<.5||this.__color.s>.5?255:0,a=255-r;ue.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+r+","+r+","+r+")"}),this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px",this.__temp.s=1,this.__temp.v=1,gm(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),ue.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+r+","+r+","+r+")",textShadow:this.__input_textShadow+"rgba("+a+","+a+","+a+",.7)"})}}]),e})(yr),aM=["-moz-","-o-","-webkit-","-ms-",""];function gm(i,e,t,n){i.style.background="",ue.each(aM,function(s){i.style.cssText+="background: "+s+"linear-gradient("+e+", "+t+" 0%, "+n+" 100%); "})}function oM(i){i.style.background="",i.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",i.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var cM={load:function(e,t){var n=t||document,s=n.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e,n.getElementsByTagName("head")[0].appendChild(s)},inject:function(e,t){var n=t||document,s=document.createElement("style");s.type="text/css",s.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(s)}catch{}}},lM=`<div id="dg-save" class="dg dialogue">
Here's the new load parameter for your <code>GUI</code>'s constructor:
@@ -3836,18 +3836,18 @@ void main() {
</div>
-</div>`,lM=function(e,t){var n=e[t];return ue.isArray(arguments[2])||ue.isObject(arguments[2])?new nM(e,t,arguments[2]):ue.isNumber(n)?ue.isNumber(arguments[2])&&ue.isNumber(arguments[3])?ue.isNumber(arguments[4])?new kd(e,t,arguments[2],arguments[3],arguments[4]):new kd(e,t,arguments[2],arguments[3]):ue.isNumber(arguments[4])?new Pl(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Pl(e,t,{min:arguments[2],max:arguments[3]}):ue.isString(n)?new iM(e,t):ue.isFunction(n)?new pm(e,t,""):ue.isBoolean(n)?new hm(e,t):null};function hM(i){setTimeout(i,1e3/60)}var uM=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||hM,dM=(function(){function i(){vi(this,i),this.backgroundElement=document.createElement("div"),ue.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),te.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),ue.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;te.bind(this.backgroundElement,"click",function(){e.hide()})}return Ci(i,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),ue.defer(function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var t=this,n=function s(){t.domElement.style.display="none",t.backgroundElement.style.display="none",te.unbind(t.domElement,"webkitTransitionEnd",s),te.unbind(t.domElement,"transitionend",s),te.unbind(t.domElement,"oTransitionEnd",s)};te.bind(this.domElement,"webkitTransitionEnd",n),te.bind(this.domElement,"transitionend",n),te.bind(this.domElement,"oTransitionEnd",n),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-te.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-te.getHeight(this.domElement)/2+"px"}}]),i})(),fM=J1(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
-`);oM.inject(fM);var gm="dg",mm=72,xm=20,Uo="Default",Oo=(function(){try{return!!window.localStorage}catch{return!1}})(),Qo=void 0,bm=!0,Sa=void 0,Od=!1,Em=[],Lt=function i(e){var t=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),te.addClass(this.domElement,gm),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=ue.defaults(n,{closeOnTop:!1,autoPlace:!0,width:i.DEFAULT_WIDTH}),n=ue.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),ue.isUndefined(n.load)?n.load={preset:Uo}:n.preset&&(n.load.preset=n.preset),ue.isUndefined(n.parent)&&n.hideable&&Em.push(this),n.resizable=ue.isUndefined(n.parent)&&n.resizable,n.autoPlace&&ue.isUndefined(n.scrollable)&&(n.scrollable=!0);var s=Oo&&localStorage.getItem(Ma(this,"isLocal"))==="true",r=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return t.parent?t.getRoot().preset:n.load.preset},set:function(d){t.parent?t.getRoot().preset=d:n.load.preset=d,mM(this),t.revert()}},width:{get:function(){return n.width},set:function(d){n.width=d,zd(t,d)}},name:{get:function(){return n.name},set:function(d){n.name=d,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(d){n.closed=d,n.closed?te.addClass(t.__ul,i.CLASS_CLOSED):te.removeClass(t.__ul,i.CLASS_CLOSED),this.onResize(),t.__closeButton&&(t.__closeButton.innerHTML=d?i.TEXT_OPEN:i.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return s},set:function(d){Oo&&(s=d,d?te.bind(window,"unload",r):te.unbind(window,"unload",r),localStorage.setItem(Ma(t,"isLocal"),d))}}}),ue.isUndefined(n.parent)){if(this.closed=n.closed||!1,te.addClass(this.domElement,i.CLASS_MAIN),te.makeSelectable(this.domElement,!1),Oo&&s){t.useLocalStorage=!0;var o=localStorage.getItem(Ma(this,"gui"));o&&(n.load=JSON.parse(o))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=i.TEXT_CLOSED,te.addClass(this.__closeButton,i.CLASS_CLOSE_BUTTON),n.closeOnTop?(te.addClass(this.__closeButton,i.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(te.addClass(this.__closeButton,i.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),te.bind(this.__closeButton,"click",function(){t.closed=!t.closed})}else{n.closed===void 0&&(n.closed=!0);var c=document.createTextNode(n.name);te.addClass(c,"controller-name"),a=Qd(t,c);var l=function(d){return d.preventDefault(),t.closed=!t.closed,!1};te.addClass(this.__ul,i.CLASS_CLOSED),te.addClass(a,"title"),te.bind(a,"click",l),n.closed||(this.closed=!1)}n.autoPlace&&(ue.isUndefined(n.parent)&&(bm&&(Sa=document.createElement("div"),te.addClass(Sa,gm),te.addClass(Sa,i.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(Sa),bm=!1),Sa.appendChild(this.domElement),te.addClass(this.domElement,i.CLASS_AUTO_PLACE)),this.parent||zd(t,n.width)),this.__resizeHandler=function(){t.onResizeDebounced()},te.bind(window,"resize",this.__resizeHandler),te.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),te.bind(this.__ul,"transitionend",this.__resizeHandler),te.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&gM(this),r=function(){Oo&&localStorage.getItem(Ma(t,"isLocal"))==="true"&&localStorage.setItem(Ma(t,"gui"),JSON.stringify(t.getSaveObject()))},this.saveToLocalStorageIfPossible=r;function h(){var u=t.getRoot();u.width+=1,ue.defer(function(){u.width-=1})}n.parent||h()};Lt.toggleHide=function(){Od=!Od,ue.each(Em,function(i){i.domElement.style.display=Od?"none":""})},Lt.CLASS_AUTO_PLACE="a",Lt.CLASS_AUTO_PLACE_CONTAINER="ac",Lt.CLASS_MAIN="main",Lt.CLASS_CONTROLLER_ROW="cr",Lt.CLASS_TOO_TALL="taller-than-window",Lt.CLASS_CLOSED="closed",Lt.CLASS_CLOSE_BUTTON="close-button",Lt.CLASS_CLOSE_TOP="close-top",Lt.CLASS_CLOSE_BOTTOM="close-bottom",Lt.CLASS_DRAG="drag",Lt.DEFAULT_WIDTH=245,Lt.TEXT_CLOSED="Close Controls",Lt.TEXT_OPEN="Open Controls",Lt._keydownHandler=function(i){document.activeElement.type!=="text"&&(i.which===mm||i.keyCode===mm)&&Lt.toggleHide()},te.bind(window,"keydown",Lt._keydownHandler,!1),ue.extend(Lt.prototype,{add:function(e,t){return Go(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return Go(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;ue.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&Sa.removeChild(this.domElement);var e=this;ue.each(this.__folders,function(t){e.removeFolder(t)}),te.unbind(window,"keydown",Lt._keydownHandler,!1),ym(this)},addFolder:function(e){if(this.__folders[e]!==void 0)throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new Lt(t);this.__folders[e]=n;var s=Qd(this,n.domElement);return te.addClass(s,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],ym(e);var t=this;ue.each(e.__folders,function(n){e.removeFolder(n)}),ue.defer(function(){t.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=te.getOffset(e.__ul).top,n=0;ue.each(e.__ul.childNodes,function(s){e.autoPlace&&s===e.__save_row||(n+=te.getHeight(s))}),window.innerHeight-t-xm<n?(te.addClass(e.domElement,Lt.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-xm+"px"):(te.removeClass(e.domElement,Lt.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&ue.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:ue.debounce(function(){this.onResize()},50),remember:function(){if(ue.isUndefined(Qo)&&(Qo=new dM,Qo.domElement.innerHTML=cM),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;ue.each(Array.prototype.slice.call(arguments),function(t){e.__rememberedObjects.length===0&&AM(e),e.__rememberedObjects.indexOf(t)===-1&&e.__rememberedObjects.push(t)}),this.autoPlace&&zd(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=kl(this)),e.folders={},ue.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=kl(this),Gd(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Uo]=kl(this,!0)),this.load.remembered[e]=kl(this),this.preset=e,Hd(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){ue.each(this.__controllers,function(t){this.getRoot().load.remembered?_m(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),ue.each(this.__folders,function(t){t.revert(t)}),e||Gd(this.getRoot(),!1)},listen:function(e){var t=this.__listening.length===0;this.__listening.push(e),t&&vm(this.__listening)},updateDisplay:function(){ue.each(this.__controllers,function(e){e.updateDisplay()}),ue.each(this.__folders,function(e){e.updateDisplay()})}});function Qd(i,e,t){var n=document.createElement("li");return e&&n.appendChild(e),t?i.__ul.insertBefore(n,t):i.__ul.appendChild(n),i.onResize(),n}function ym(i){te.unbind(window,"resize",i.__resizeHandler),i.saveToLocalStorageIfPossible&&te.unbind(window,"unload",i.saveToLocalStorageIfPossible)}function Gd(i,e){var t=i.__preset_select[i.__preset_select.selectedIndex];e?t.innerHTML=t.value+"*":t.innerHTML=t.value}function pM(i,e,t){if(t.__li=e,t.__gui=i,ue.extend(t,{options:function(a){if(arguments.length>1){var o=t.__li.nextElementSibling;return t.remove(),Go(i,t.object,t.property,{before:o,factoryArgs:[ue.toArray(arguments)]})}if(ue.isArray(a)||ue.isObject(a)){var c=t.__li.nextElementSibling;return t.remove(),Go(i,t.object,t.property,{before:c,factoryArgs:[a]})}},name:function(a){return t.__li.firstElementChild.firstElementChild.innerHTML=a,t},listen:function(){return t.__gui.listen(t),t},remove:function(){return t.__gui.remove(t),t}}),t instanceof kd){var n=new Pl(t.object,t.property,{min:t.__min,max:t.__max,step:t.__step});ue.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(r){var a=t[r],o=n[r];t[r]=n[r]=function(){var c=Array.prototype.slice.call(arguments);return o.apply(n,c),a.apply(t,c)}}),te.addClass(e,"has-slider"),t.domElement.insertBefore(n.domElement,t.domElement.firstElementChild)}else if(t instanceof Pl){var s=function(a){if(ue.isNumber(t.__min)&&ue.isNumber(t.__max)){var o=t.__li.firstElementChild.firstElementChild.innerHTML,c=t.__gui.__listening.indexOf(t)>-1;t.remove();var l=Go(i,t.object,t.property,{before:t.__li.nextElementSibling,factoryArgs:[t.__min,t.__max,t.__step]});return l.name(o),c&&l.listen(),l}return a};t.min=ue.compose(s,t.min),t.max=ue.compose(s,t.max)}else t instanceof hm?(te.bind(e,"click",function(){te.fakeEvent(t.__checkbox,"click")}),te.bind(t.__checkbox,"click",function(r){r.stopPropagation()})):t instanceof pm?(te.bind(e,"click",function(){te.fakeEvent(t.__button,"click")}),te.bind(e,"mouseover",function(){te.addClass(t.__button,"hover")}),te.bind(e,"mouseout",function(){te.removeClass(t.__button,"hover")})):t instanceof Ud&&(te.addClass(e,"color"),t.updateDisplay=ue.compose(function(r){return e.style.borderLeftColor=t.__color.toString(),r},t.updateDisplay),t.updateDisplay());t.setValue=ue.compose(function(r){return i.getRoot().__preset_select&&t.isModified()&&Gd(i.getRoot(),!0),r},t.setValue)}function _m(i,e){var t=i.getRoot(),n=t.__rememberedObjects.indexOf(e.object);if(n!==-1){var s=t.__rememberedObjectIndecesToControllers[n];if(s===void 0&&(s={},t.__rememberedObjectIndecesToControllers[n]=s),s[e.property]=e,t.load&&t.load.remembered){var r=t.load.remembered,a=void 0;if(r[i.preset])a=r[i.preset];else if(r[Uo])a=r[Uo];else return;if(a[n]&&a[n][e.property]!==void 0){var o=a[n][e.property];e.initialValue=o,e.setValue(o)}}}}function Go(i,e,t,n){if(e[t]===void 0)throw new Error('Object "'+e+'" has no property "'+t+'"');var s=void 0;if(n.color)s=new Ud(e,t);else{var r=[e,t].concat(n.factoryArgs);s=lM.apply(i,r)}n.before instanceof yr&&(n.before=n.before.__li),_m(i,s),te.addClass(s.domElement,"c");var a=document.createElement("span");te.addClass(a,"property-name"),a.innerHTML=s.property;var o=document.createElement("div");o.appendChild(a),o.appendChild(s.domElement);var c=Qd(i,o,n.before);return te.addClass(c,Lt.CLASS_CONTROLLER_ROW),s instanceof Ud?te.addClass(c,"color"):te.addClass(c,$1(s.getValue())),pM(i,c,s),i.__controllers.push(s),s}function Ma(i,e){return document.location.href+"."+e}function Hd(i,e,t){var n=document.createElement("option");n.innerHTML=e,n.value=e,i.__preset_select.appendChild(n),t&&(i.__preset_select.selectedIndex=i.__preset_select.length-1)}function wm(i,e){e.style.display=i.useLocalStorage?"block":"none"}function AM(i){var e=i.__save_row=document.createElement("li");te.addClass(i.domElement,"has-save"),i.__ul.insertBefore(e,i.__ul.firstChild),te.addClass(e,"save-row");var t=document.createElement("span");t.innerHTML="&nbsp;",te.addClass(t,"button gears");var n=document.createElement("span");n.innerHTML="Save",te.addClass(n,"button"),te.addClass(n,"save");var s=document.createElement("span");s.innerHTML="New",te.addClass(s,"button"),te.addClass(s,"save-as");var r=document.createElement("span");r.innerHTML="Revert",te.addClass(r,"button"),te.addClass(r,"revert");var a=i.__preset_select=document.createElement("select");if(i.load&&i.load.remembered?ue.each(i.load.remembered,function(u,d){Hd(i,d,d===i.preset)}):Hd(i,Uo,!1),te.bind(a,"change",function(){for(var u=0;u<i.__preset_select.length;u++)i.__preset_select[u].innerHTML=i.__preset_select[u].value;i.preset=this.value}),e.appendChild(a),e.appendChild(t),e.appendChild(n),e.appendChild(s),e.appendChild(r),Oo){var o=document.getElementById("dg-local-explain"),c=document.getElementById("dg-local-storage"),l=document.getElementById("dg-save-locally");l.style.display="block",localStorage.getItem(Ma(i,"isLocal"))==="true"&&c.setAttribute("checked","checked"),wm(i,o),te.bind(c,"change",function(){i.useLocalStorage=!i.useLocalStorage,wm(i,o)})}var h=document.getElementById("dg-new-constructor");te.bind(h,"keydown",function(u){u.metaKey&&(u.which===67||u.keyCode===67)&&Qo.hide()}),te.bind(t,"click",function(){h.innerHTML=JSON.stringify(i.getSaveObject(),void 0,2),Qo.show(),h.focus(),h.select()}),te.bind(n,"click",function(){i.save()}),te.bind(s,"click",function(){var u=prompt("Enter a new preset name.");u&&i.saveAs(u)}),te.bind(r,"click",function(){i.revert()})}function gM(i){var e=void 0;i.__resize_handle=document.createElement("div"),ue.extend(i.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});function t(r){return r.preventDefault(),i.width+=e-r.clientX,i.onResize(),e=r.clientX,!1}function n(){te.removeClass(i.__closeButton,Lt.CLASS_DRAG),te.unbind(window,"mousemove",t),te.unbind(window,"mouseup",n)}function s(r){return r.preventDefault(),e=r.clientX,te.addClass(i.__closeButton,Lt.CLASS_DRAG),te.bind(window,"mousemove",t),te.bind(window,"mouseup",n),!1}te.bind(i.__resize_handle,"mousedown",s),te.bind(i.__closeButton,"mousedown",s),i.domElement.insertBefore(i.__resize_handle,i.domElement.firstElementChild)}function zd(i,e){i.domElement.style.width=e+"px",i.__save_row&&i.autoPlace&&(i.__save_row.style.width=e+"px"),i.__closeButton&&(i.__closeButton.style.width=e+"px")}function kl(i,e){var t={};return ue.each(i.__rememberedObjects,function(n,s){var r={},a=i.__rememberedObjectIndecesToControllers[s];ue.each(a,function(o,c){r[c]=e?o.initialValue:o.getValue()}),t[s]=r}),t}function mM(i){for(var e=0;e<i.__preset_select.length;e++)i.__preset_select[e].value===i.preset&&(i.__preset_select.selectedIndex=e)}function vm(i){i.length!==0&&uM.call(window,function(){vm(i)}),ue.each(i,function(e){e.updateDisplay()})}var xM=Lt;const Ul=[{id:"",name:"None",path:null},{id:"neutral",name:"Neutral",path:null},{id:"venice-sunset",name:"Venice Sunset",path:"https://storage.googleapis.com/donmccurdy-static/venice_sunset_1k.exr",format:".exr"},{id:"footprint-court",name:"Footprint Court (HDR Labs)",path:"https://storage.googleapis.com/donmccurdy-static/footprint_court_2k.exr",format:".exr"}],bM=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],Cm=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function EM(i){if(i<=255)return bM[i];let e=0,t=Cm.length-1;for(;e<=t;){const n=e+t>>1,s=Cm[n];if(i<s[0]){t=n-1;continue}if(i>s[1]){e=n+1;continue}return s[2]}return"L"}function yM(i){const e=i.length;if(e===0)return null;const t=new Array(e);let n=!1;for(let l=0;l<e;){const h=i.charCodeAt(l);let u=h,d=1;if(h>=55296&&h<=56319&&l+1<e){const p=i.charCodeAt(l+1);p>=56320&&p<=57343&&(u=(h-55296<<10)+(p-56320)+65536,d=2)}const f=EM(u);(f==="R"||f==="AL"||f==="AN")&&(n=!0);for(let p=0;p<d;p++)t[l+p]=f;l+=d}if(!n)return null;let s=0;for(let l=0;l<e;l++){const h=t[l];if(h==="L"){s=0;break}if(h==="R"||h==="AL"){s=1;break}}const r=new Int8Array(e);for(let l=0;l<e;l++)r[l]=s;const a=s&1?"R":"L",o=a;let c=o;for(let l=0;l<e;l++)t[l]==="NSM"?t[l]=c:c=t[l];c=o;for(let l=0;l<e;l++){const h=t[l];h==="EN"?t[l]=c==="AL"?"AN":"EN":(h==="R"||h==="L"||h==="AL")&&(c=h)}for(let l=0;l<e;l++)t[l]==="AL"&&(t[l]="R");for(let l=1;l<e-1;l++)t[l]==="ES"&&t[l-1]==="EN"&&t[l+1]==="EN"&&(t[l]="EN"),t[l]==="CS"&&(t[l-1]==="EN"||t[l-1]==="AN")&&t[l+1]===t[l-1]&&(t[l]=t[l-1]);for(let l=0;l<e;l++){if(t[l]!=="EN")continue;let h;for(h=l-1;h>=0&&t[h]==="ET";h--)t[h]="EN";for(h=l+1;h<e&&t[h]==="ET";h++)t[h]="EN"}for(let l=0;l<e;l++){const h=t[l];(h==="WS"||h==="ES"||h==="ET"||h==="CS")&&(t[l]="ON")}c=o;for(let l=0;l<e;l++){const h=t[l];h==="EN"?t[l]=c==="L"?"L":"EN":(h==="R"||h==="L")&&(c=h)}for(let l=0;l<e;l++){if(t[l]!=="ON")continue;let h=l+1;for(;h<e&&t[h]==="ON";)h++;const u=l>0?t[l-1]:o,d=h<e?t[h]:o,f=u!=="L"?"R":"L";if(f===(d!=="L"?"R":"L"))for(let m=l;m<h;m++)t[m]=f;l=h-1}for(let l=0;l<e;l++)t[l]==="ON"&&(t[l]=a);for(let l=0;l<e;l++){const h=t[l];(r[l]&1)===0?h==="R"?r[l]++:(h==="AN"||h==="EN")&&(r[l]+=2):(h==="L"||h==="AN"||h==="EN")&&r[l]++}return r}function _M(i,e){const t=yM(i);if(t===null)return null;const n=new Int8Array(e.length);for(let s=0;s<e.length;s++)n[s]=t[e[s]];return n}const wM=/[ \t\n\r\f]+/g,vM=/[\t\n\r\f]| {2,}|^ | $/;function CM(i){const e=i??"normal";return e==="pre-wrap"?{mode:e,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:e,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function IM(i){if(!vM.test(i))return i;let e=i.replace(wM," ");return e.charCodeAt(0)===32&&(e=e.slice(1)),e.length>0&&e.charCodeAt(e.length-1)===32&&(e=e.slice(0,-1)),e}function SM(i){return/[\r\f]/.test(i)?i.replace(/\r\n/g,`
+</div>`,hM=function(e,t){var n=e[t];return ue.isArray(arguments[2])||ue.isObject(arguments[2])?new iM(e,t,arguments[2]):ue.isNumber(n)?ue.isNumber(arguments[2])&&ue.isNumber(arguments[3])?ue.isNumber(arguments[4])?new Od(e,t,arguments[2],arguments[3],arguments[4]):new Od(e,t,arguments[2],arguments[3]):ue.isNumber(arguments[4])?new Ul(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Ul(e,t,{min:arguments[2],max:arguments[3]}):ue.isString(n)?new sM(e,t):ue.isFunction(n)?new Am(e,t,""):ue.isBoolean(n)?new um(e,t):null};function uM(i){setTimeout(i,1e3/60)}var dM=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||uM,fM=(function(){function i(){Ci(this,i),this.backgroundElement=document.createElement("div"),ue.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),te.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),ue.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;te.bind(this.backgroundElement,"click",function(){e.hide()})}return Ii(i,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),ue.defer(function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var t=this,n=function s(){t.domElement.style.display="none",t.backgroundElement.style.display="none",te.unbind(t.domElement,"webkitTransitionEnd",s),te.unbind(t.domElement,"transitionend",s),te.unbind(t.domElement,"oTransitionEnd",s)};te.bind(this.domElement,"webkitTransitionEnd",n),te.bind(this.domElement,"transitionend",n),te.bind(this.domElement,"oTransitionEnd",n),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-te.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-te.getHeight(this.domElement)/2+"px"}}]),i})(),pM=Z1(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
+`);cM.inject(pM);var mm="dg",xm=72,bm=20,Oo="Default",Qo=(function(){try{return!!window.localStorage}catch{return!1}})(),Go=void 0,Em=!0,Sa=void 0,Gd=!1,ym=[],Lt=function i(e){var t=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),te.addClass(this.domElement,mm),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=ue.defaults(n,{closeOnTop:!1,autoPlace:!0,width:i.DEFAULT_WIDTH}),n=ue.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),ue.isUndefined(n.load)?n.load={preset:Oo}:n.preset&&(n.load.preset=n.preset),ue.isUndefined(n.parent)&&n.hideable&&ym.push(this),n.resizable=ue.isUndefined(n.parent)&&n.resizable,n.autoPlace&&ue.isUndefined(n.scrollable)&&(n.scrollable=!0);var s=Qo&&localStorage.getItem(Ma(this,"isLocal"))==="true",r=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return t.parent?t.getRoot().preset:n.load.preset},set:function(d){t.parent?t.getRoot().preset=d:n.load.preset=d,xM(this),t.revert()}},width:{get:function(){return n.width},set:function(d){n.width=d,Wd(t,d)}},name:{get:function(){return n.name},set:function(d){n.name=d,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(d){n.closed=d,n.closed?te.addClass(t.__ul,i.CLASS_CLOSED):te.removeClass(t.__ul,i.CLASS_CLOSED),this.onResize(),t.__closeButton&&(t.__closeButton.innerHTML=d?i.TEXT_OPEN:i.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return s},set:function(d){Qo&&(s=d,d?te.bind(window,"unload",r):te.unbind(window,"unload",r),localStorage.setItem(Ma(t,"isLocal"),d))}}}),ue.isUndefined(n.parent)){if(this.closed=n.closed||!1,te.addClass(this.domElement,i.CLASS_MAIN),te.makeSelectable(this.domElement,!1),Qo&&s){t.useLocalStorage=!0;var o=localStorage.getItem(Ma(this,"gui"));o&&(n.load=JSON.parse(o))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=i.TEXT_CLOSED,te.addClass(this.__closeButton,i.CLASS_CLOSE_BUTTON),n.closeOnTop?(te.addClass(this.__closeButton,i.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(te.addClass(this.__closeButton,i.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),te.bind(this.__closeButton,"click",function(){t.closed=!t.closed})}else{n.closed===void 0&&(n.closed=!0);var c=document.createTextNode(n.name);te.addClass(c,"controller-name"),a=Hd(t,c);var l=function(d){return d.preventDefault(),t.closed=!t.closed,!1};te.addClass(this.__ul,i.CLASS_CLOSED),te.addClass(a,"title"),te.bind(a,"click",l),n.closed||(this.closed=!1)}n.autoPlace&&(ue.isUndefined(n.parent)&&(Em&&(Sa=document.createElement("div"),te.addClass(Sa,mm),te.addClass(Sa,i.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(Sa),Em=!1),Sa.appendChild(this.domElement),te.addClass(this.domElement,i.CLASS_AUTO_PLACE)),this.parent||Wd(t,n.width)),this.__resizeHandler=function(){t.onResizeDebounced()},te.bind(window,"resize",this.__resizeHandler),te.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),te.bind(this.__ul,"transitionend",this.__resizeHandler),te.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&mM(this),r=function(){Qo&&localStorage.getItem(Ma(t,"isLocal"))==="true"&&localStorage.setItem(Ma(t,"gui"),JSON.stringify(t.getSaveObject()))},this.saveToLocalStorageIfPossible=r;function h(){var u=t.getRoot();u.width+=1,ue.defer(function(){u.width-=1})}n.parent||h()};Lt.toggleHide=function(){Gd=!Gd,ue.each(ym,function(i){i.domElement.style.display=Gd?"none":""})},Lt.CLASS_AUTO_PLACE="a",Lt.CLASS_AUTO_PLACE_CONTAINER="ac",Lt.CLASS_MAIN="main",Lt.CLASS_CONTROLLER_ROW="cr",Lt.CLASS_TOO_TALL="taller-than-window",Lt.CLASS_CLOSED="closed",Lt.CLASS_CLOSE_BUTTON="close-button",Lt.CLASS_CLOSE_TOP="close-top",Lt.CLASS_CLOSE_BOTTOM="close-bottom",Lt.CLASS_DRAG="drag",Lt.DEFAULT_WIDTH=245,Lt.TEXT_CLOSED="Close Controls",Lt.TEXT_OPEN="Open Controls",Lt._keydownHandler=function(i){document.activeElement.type!=="text"&&(i.which===xm||i.keyCode===xm)&&Lt.toggleHide()},te.bind(window,"keydown",Lt._keydownHandler,!1),ue.extend(Lt.prototype,{add:function(e,t){return Ho(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return Ho(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;ue.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&Sa.removeChild(this.domElement);var e=this;ue.each(this.__folders,function(t){e.removeFolder(t)}),te.unbind(window,"keydown",Lt._keydownHandler,!1),_m(this)},addFolder:function(e){if(this.__folders[e]!==void 0)throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new Lt(t);this.__folders[e]=n;var s=Hd(this,n.domElement);return te.addClass(s,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],_m(e);var t=this;ue.each(e.__folders,function(n){e.removeFolder(n)}),ue.defer(function(){t.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=te.getOffset(e.__ul).top,n=0;ue.each(e.__ul.childNodes,function(s){e.autoPlace&&s===e.__save_row||(n+=te.getHeight(s))}),window.innerHeight-t-bm<n?(te.addClass(e.domElement,Lt.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-bm+"px"):(te.removeClass(e.domElement,Lt.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&ue.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:ue.debounce(function(){this.onResize()},50),remember:function(){if(ue.isUndefined(Go)&&(Go=new fM,Go.domElement.innerHTML=lM),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;ue.each(Array.prototype.slice.call(arguments),function(t){e.__rememberedObjects.length===0&&gM(e),e.__rememberedObjects.indexOf(t)===-1&&e.__rememberedObjects.push(t)}),this.autoPlace&&Wd(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=Ol(this)),e.folders={},ue.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Ol(this),zd(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Oo]=Ol(this,!0)),this.load.remembered[e]=Ol(this),this.preset=e,Vd(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){ue.each(this.__controllers,function(t){this.getRoot().load.remembered?wm(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),ue.each(this.__folders,function(t){t.revert(t)}),e||zd(this.getRoot(),!1)},listen:function(e){var t=this.__listening.length===0;this.__listening.push(e),t&&Cm(this.__listening)},updateDisplay:function(){ue.each(this.__controllers,function(e){e.updateDisplay()}),ue.each(this.__folders,function(e){e.updateDisplay()})}});function Hd(i,e,t){var n=document.createElement("li");return e&&n.appendChild(e),t?i.__ul.insertBefore(n,t):i.__ul.appendChild(n),i.onResize(),n}function _m(i){te.unbind(window,"resize",i.__resizeHandler),i.saveToLocalStorageIfPossible&&te.unbind(window,"unload",i.saveToLocalStorageIfPossible)}function zd(i,e){var t=i.__preset_select[i.__preset_select.selectedIndex];e?t.innerHTML=t.value+"*":t.innerHTML=t.value}function AM(i,e,t){if(t.__li=e,t.__gui=i,ue.extend(t,{options:function(a){if(arguments.length>1){var o=t.__li.nextElementSibling;return t.remove(),Ho(i,t.object,t.property,{before:o,factoryArgs:[ue.toArray(arguments)]})}if(ue.isArray(a)||ue.isObject(a)){var c=t.__li.nextElementSibling;return t.remove(),Ho(i,t.object,t.property,{before:c,factoryArgs:[a]})}},name:function(a){return t.__li.firstElementChild.firstElementChild.innerHTML=a,t},listen:function(){return t.__gui.listen(t),t},remove:function(){return t.__gui.remove(t),t}}),t instanceof Od){var n=new Ul(t.object,t.property,{min:t.__min,max:t.__max,step:t.__step});ue.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(r){var a=t[r],o=n[r];t[r]=n[r]=function(){var c=Array.prototype.slice.call(arguments);return o.apply(n,c),a.apply(t,c)}}),te.addClass(e,"has-slider"),t.domElement.insertBefore(n.domElement,t.domElement.firstElementChild)}else if(t instanceof Ul){var s=function(a){if(ue.isNumber(t.__min)&&ue.isNumber(t.__max)){var o=t.__li.firstElementChild.firstElementChild.innerHTML,c=t.__gui.__listening.indexOf(t)>-1;t.remove();var l=Ho(i,t.object,t.property,{before:t.__li.nextElementSibling,factoryArgs:[t.__min,t.__max,t.__step]});return l.name(o),c&&l.listen(),l}return a};t.min=ue.compose(s,t.min),t.max=ue.compose(s,t.max)}else t instanceof um?(te.bind(e,"click",function(){te.fakeEvent(t.__checkbox,"click")}),te.bind(t.__checkbox,"click",function(r){r.stopPropagation()})):t instanceof Am?(te.bind(e,"click",function(){te.fakeEvent(t.__button,"click")}),te.bind(e,"mouseover",function(){te.addClass(t.__button,"hover")}),te.bind(e,"mouseout",function(){te.removeClass(t.__button,"hover")})):t instanceof Qd&&(te.addClass(e,"color"),t.updateDisplay=ue.compose(function(r){return e.style.borderLeftColor=t.__color.toString(),r},t.updateDisplay),t.updateDisplay());t.setValue=ue.compose(function(r){return i.getRoot().__preset_select&&t.isModified()&&zd(i.getRoot(),!0),r},t.setValue)}function wm(i,e){var t=i.getRoot(),n=t.__rememberedObjects.indexOf(e.object);if(n!==-1){var s=t.__rememberedObjectIndecesToControllers[n];if(s===void 0&&(s={},t.__rememberedObjectIndecesToControllers[n]=s),s[e.property]=e,t.load&&t.load.remembered){var r=t.load.remembered,a=void 0;if(r[i.preset])a=r[i.preset];else if(r[Oo])a=r[Oo];else return;if(a[n]&&a[n][e.property]!==void 0){var o=a[n][e.property];e.initialValue=o,e.setValue(o)}}}}function Ho(i,e,t,n){if(e[t]===void 0)throw new Error('Object "'+e+'" has no property "'+t+'"');var s=void 0;if(n.color)s=new Qd(e,t);else{var r=[e,t].concat(n.factoryArgs);s=hM.apply(i,r)}n.before instanceof yr&&(n.before=n.before.__li),wm(i,s),te.addClass(s.domElement,"c");var a=document.createElement("span");te.addClass(a,"property-name"),a.innerHTML=s.property;var o=document.createElement("div");o.appendChild(a),o.appendChild(s.domElement);var c=Hd(i,o,n.before);return te.addClass(c,Lt.CLASS_CONTROLLER_ROW),s instanceof Qd?te.addClass(c,"color"):te.addClass(c,eM(s.getValue())),AM(i,c,s),i.__controllers.push(s),s}function Ma(i,e){return document.location.href+"."+e}function Vd(i,e,t){var n=document.createElement("option");n.innerHTML=e,n.value=e,i.__preset_select.appendChild(n),t&&(i.__preset_select.selectedIndex=i.__preset_select.length-1)}function vm(i,e){e.style.display=i.useLocalStorage?"block":"none"}function gM(i){var e=i.__save_row=document.createElement("li");te.addClass(i.domElement,"has-save"),i.__ul.insertBefore(e,i.__ul.firstChild),te.addClass(e,"save-row");var t=document.createElement("span");t.innerHTML="&nbsp;",te.addClass(t,"button gears");var n=document.createElement("span");n.innerHTML="Save",te.addClass(n,"button"),te.addClass(n,"save");var s=document.createElement("span");s.innerHTML="New",te.addClass(s,"button"),te.addClass(s,"save-as");var r=document.createElement("span");r.innerHTML="Revert",te.addClass(r,"button"),te.addClass(r,"revert");var a=i.__preset_select=document.createElement("select");if(i.load&&i.load.remembered?ue.each(i.load.remembered,function(u,d){Vd(i,d,d===i.preset)}):Vd(i,Oo,!1),te.bind(a,"change",function(){for(var u=0;u<i.__preset_select.length;u++)i.__preset_select[u].innerHTML=i.__preset_select[u].value;i.preset=this.value}),e.appendChild(a),e.appendChild(t),e.appendChild(n),e.appendChild(s),e.appendChild(r),Qo){var o=document.getElementById("dg-local-explain"),c=document.getElementById("dg-local-storage"),l=document.getElementById("dg-save-locally");l.style.display="block",localStorage.getItem(Ma(i,"isLocal"))==="true"&&c.setAttribute("checked","checked"),vm(i,o),te.bind(c,"change",function(){i.useLocalStorage=!i.useLocalStorage,vm(i,o)})}var h=document.getElementById("dg-new-constructor");te.bind(h,"keydown",function(u){u.metaKey&&(u.which===67||u.keyCode===67)&&Go.hide()}),te.bind(t,"click",function(){h.innerHTML=JSON.stringify(i.getSaveObject(),void 0,2),Go.show(),h.focus(),h.select()}),te.bind(n,"click",function(){i.save()}),te.bind(s,"click",function(){var u=prompt("Enter a new preset name.");u&&i.saveAs(u)}),te.bind(r,"click",function(){i.revert()})}function mM(i){var e=void 0;i.__resize_handle=document.createElement("div"),ue.extend(i.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});function t(r){return r.preventDefault(),i.width+=e-r.clientX,i.onResize(),e=r.clientX,!1}function n(){te.removeClass(i.__closeButton,Lt.CLASS_DRAG),te.unbind(window,"mousemove",t),te.unbind(window,"mouseup",n)}function s(r){return r.preventDefault(),e=r.clientX,te.addClass(i.__closeButton,Lt.CLASS_DRAG),te.bind(window,"mousemove",t),te.bind(window,"mouseup",n),!1}te.bind(i.__resize_handle,"mousedown",s),te.bind(i.__closeButton,"mousedown",s),i.domElement.insertBefore(i.__resize_handle,i.domElement.firstElementChild)}function Wd(i,e){i.domElement.style.width=e+"px",i.__save_row&&i.autoPlace&&(i.__save_row.style.width=e+"px"),i.__closeButton&&(i.__closeButton.style.width=e+"px")}function Ol(i,e){var t={};return ue.each(i.__rememberedObjects,function(n,s){var r={},a=i.__rememberedObjectIndecesToControllers[s];ue.each(a,function(o,c){r[c]=e?o.initialValue:o.getValue()}),t[s]=r}),t}function xM(i){for(var e=0;e<i.__preset_select.length;e++)i.__preset_select[e].value===i.preset&&(i.__preset_select.selectedIndex=e)}function Cm(i){i.length!==0&&dM.call(window,function(){Cm(i)}),ue.each(i,function(e){e.updateDisplay()})}var bM=Lt;const Ql=[{id:"",name:"None",path:null},{id:"neutral",name:"Neutral",path:null},{id:"venice-sunset",name:"Venice Sunset",path:"https://storage.googleapis.com/donmccurdy-static/venice_sunset_1k.exr",format:".exr"},{id:"footprint-court",name:"Footprint Court (HDR Labs)",path:"https://storage.googleapis.com/donmccurdy-static/footprint_court_2k.exr",format:".exr"}],EM=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],Im=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function yM(i){if(i<=255)return EM[i];let e=0,t=Im.length-1;for(;e<=t;){const n=e+t>>1,s=Im[n];if(i<s[0]){t=n-1;continue}if(i>s[1]){e=n+1;continue}return s[2]}return"L"}function _M(i){const e=i.length;if(e===0)return null;const t=new Array(e);let n=!1;for(let l=0;l<e;){const h=i.charCodeAt(l);let u=h,d=1;if(h>=55296&&h<=56319&&l+1<e){const p=i.charCodeAt(l+1);p>=56320&&p<=57343&&(u=(h-55296<<10)+(p-56320)+65536,d=2)}const f=yM(u);(f==="R"||f==="AL"||f==="AN")&&(n=!0);for(let p=0;p<d;p++)t[l+p]=f;l+=d}if(!n)return null;let s=0;for(let l=0;l<e;l++){const h=t[l];if(h==="L"){s=0;break}if(h==="R"||h==="AL"){s=1;break}}const r=new Int8Array(e);for(let l=0;l<e;l++)r[l]=s;const a=s&1?"R":"L",o=a;let c=o;for(let l=0;l<e;l++)t[l]==="NSM"?t[l]=c:c=t[l];c=o;for(let l=0;l<e;l++){const h=t[l];h==="EN"?t[l]=c==="AL"?"AN":"EN":(h==="R"||h==="L"||h==="AL")&&(c=h)}for(let l=0;l<e;l++)t[l]==="AL"&&(t[l]="R");for(let l=1;l<e-1;l++)t[l]==="ES"&&t[l-1]==="EN"&&t[l+1]==="EN"&&(t[l]="EN"),t[l]==="CS"&&(t[l-1]==="EN"||t[l-1]==="AN")&&t[l+1]===t[l-1]&&(t[l]=t[l-1]);for(let l=0;l<e;l++){if(t[l]!=="EN")continue;let h;for(h=l-1;h>=0&&t[h]==="ET";h--)t[h]="EN";for(h=l+1;h<e&&t[h]==="ET";h++)t[h]="EN"}for(let l=0;l<e;l++){const h=t[l];(h==="WS"||h==="ES"||h==="ET"||h==="CS")&&(t[l]="ON")}c=o;for(let l=0;l<e;l++){const h=t[l];h==="EN"?t[l]=c==="L"?"L":"EN":(h==="R"||h==="L")&&(c=h)}for(let l=0;l<e;l++){if(t[l]!=="ON")continue;let h=l+1;for(;h<e&&t[h]==="ON";)h++;const u=l>0?t[l-1]:o,d=h<e?t[h]:o,f=u!=="L"?"R":"L";if(f===(d!=="L"?"R":"L"))for(let m=l;m<h;m++)t[m]=f;l=h-1}for(let l=0;l<e;l++)t[l]==="ON"&&(t[l]=a);for(let l=0;l<e;l++){const h=t[l];(r[l]&1)===0?h==="R"?r[l]++:(h==="AN"||h==="EN")&&(r[l]+=2):(h==="L"||h==="AN"||h==="EN")&&r[l]++}return r}function wM(i,e){const t=_M(i);if(t===null)return null;const n=new Int8Array(e.length);for(let s=0;s<e.length;s++)n[s]=t[e[s]];return n}const vM=/[ \t\n\r\f]+/g,CM=/[\t\n\r\f]| {2,}|^ | $/;function IM(i){const e=i??"normal";return e==="pre-wrap"?{mode:e,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:e,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function SM(i){if(!CM.test(i))return i;let e=i.replace(vM," ");return e.charCodeAt(0)===32&&(e=e.slice(1)),e.length>0&&e.charCodeAt(e.length-1)===32&&(e=e.slice(0,-1)),e}function MM(i){return/[\r\f]/.test(i)?i.replace(/\r\n/g,`
`).replace(/[\r\f]/g,`
`):i.replace(/\r\n/g,`
-`)}let Vd=null,MM;function BM(){return Vd===null&&(Vd=new Intl.Segmenter(MM,{granularity:"word"})),Vd}const TM=new RegExp("\\p{Script=Arabic}","u"),Ol=new RegExp("\\p{M}","u"),Im=new RegExp("\\p{Nd}","u");function Sm(i){return TM.test(i)}function Mm(i){return i>=19968&&i<=40959||i>=13312&&i<=19903||i>=131072&&i<=173791||i>=173824&&i<=177983||i>=177984&&i<=178207||i>=178208&&i<=183983||i>=183984&&i<=191471||i>=191472&&i<=192093||i>=194560&&i<=195103||i>=196608&&i<=201551||i>=201552&&i<=205743||i>=205744&&i<=210041||i>=63744&&i<=64255||i>=12288&&i<=12351||i>=12352&&i<=12447||i>=12448&&i<=12543||i>=44032&&i<=55215||i>=65280&&i<=65519}function _r(i){for(let e=0;e<i.length;e++){const t=i.charCodeAt(e);if(!(t<12288)){if(t>=55296&&t<=56319&&e+1<i.length){const n=i.charCodeAt(e+1);if(n>=56320&&n<=57343){const s=(t-55296<<10)+(n-56320)+65536;if(Mm(s))return!0;e++;continue}}if(Mm(t))return!0}}return!1}function RM(i){const e=Gl(i);return e!==null&&(Wd.has(e)||wr.has(e))}const FM=new Set([" "," ","⁠","\uFEFF"]);function NM(i){return _r(i)}function DM(i){const e=Gl(i);return e!==null&&FM.has(e)}function LM(i){return!RM(i)&&!DM(i)}const Wd=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),Ql=new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),qd=new Set(["'","’"]),wr=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),PM=new Set([":",".","،","؛"]),kM=new Set(["၏"]),UM=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function OM(i){if(Kd(i))return!0;let e=!1;for(const t of i){if(wr.has(t)){e=!0;continue}if(!(e&&Ol.test(t)))return!1}return e}function QM(i){for(const e of i)if(!Wd.has(e)&&!wr.has(e))return!1;return i.length>0}function GM(i){if(Kd(i))return!0;for(const e of i)if(!Ql.has(e)&&!qd.has(e)&&!Ol.test(e))return!1;return i.length>0}function Kd(i){let e=!1;for(const t of i)if(!(t==="\\"||Ol.test(t))){if(Ql.has(t)||wr.has(t)||qd.has(t)){e=!0;continue}return!1}return e}function Bm(i,e){const t=e-1;if(t<=0)return Math.max(t,0);const n=i.charCodeAt(t);if(n<56320||n>57343)return t;const s=t-1;if(s<0)return t;const r=i.charCodeAt(s);return r>=55296&&r<=56319?s:t}function Gl(i){if(i.length===0)return null;const e=Bm(i,i.length);return i.slice(e)}function HM(i){const e=Array.from(i);let t=e.length;for(;t>0;){const n=e[t-1];if(Ol.test(n)){t--;continue}if(Ql.has(n)||qd.has(n)){t--;continue}break}return t<=0||t===e.length?null:{head:e.slice(0,t).join(""),tail:e.slice(t).join("")}}function zM(i,e,t){return t==="text"&&!e&&i.length===1&&i!=="-"&&i!=="—"?i:null}function Tm(i,e,t,n){const s=e[n],r=i[n];if(s==null)return r;const a=t[n];if(r.length===a)return r;const o=s.repeat(a);return i[n]=o,o}function Rm(i,e){return i&&e!==null&&PM.has(e)}function VM(i){const e=Gl(i);return e!==null&&kM.has(e)}function WM(i){if(i.length<2||i[0]!==" ")return null;const e=i.slice(1);return new RegExp("^\\p{M}+$","u").test(e)?{space:" ",marks:e}:null}function jd(i){let e=i.length;for(;e>0;){const t=Bm(i,e),n=i.slice(t,e);if(UM.has(n))return!0;if(!wr.has(n))return!1;e=t}return!1}function qM(i,e){if(e.preserveOrdinarySpaces||e.preserveHardBreaks){if(i===" ")return"preserved-space";if(i===" ")return"tab";if(e.preserveHardBreaks&&i===`
-`)return"hard-break"}return i===" "?"space":i===" "||i===" "||i==="⁠"||i==="\uFEFF"?"glue":i==="​"?"zero-width-break":i==="­"?"soft-hyphen":"text"}const KM=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function li(i){return i.length===1?i[0]:i.join("")}function jM(i,e){const t=[];for(let n=i.length-1;n>=0;n--)t.push(i[n]);return t.push(e),li(t)}function XM(i,e,t,n){if(!KM.test(i))return[{text:i,isWordLike:e,kind:"text",start:t}];const s=[];let r=null,a=[],o=t,c=!1,l=0;for(const h of i){const u=qM(h,n),d=u==="text"&&e;if(r!==null&&u===r&&d===c){a.push(h),l+=h.length;continue}r!==null&&s.push({text:li(a),isWordLike:c,kind:r,start:o}),r=u,a=[h],o=t+l,c=d,l+=h.length}return r!==null&&s.push({text:li(a),isWordLike:c,kind:r,start:o}),s}function Xd(i){return i==="space"||i==="preserved-space"||i==="zero-width-break"||i==="hard-break"}const YM=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function JM(i,e){const t=i.texts[e];return t.startsWith("www.")?!0:YM.test(t)&&e+1<i.len&&i.kinds[e+1]==="text"&&i.texts[e+1]==="//"}function ZM(i){return i.includes("?")&&(i.includes("://")||i.startsWith("www."))}function $M(i){const e=i.texts.slice(),t=i.isWordLike.slice(),n=i.kinds.slice(),s=i.starts.slice();for(let a=0;a<i.len;a++){if(n[a]!=="text"||!JM(i,a))continue;const o=[e[a]];let c=a+1;for(;c<i.len&&!Xd(n[c]);){o.push(e[c]),t[a]=!0;const l=e[c].includes("?");if(n[c]="text",e[c]="",c++,l)break}e[a]=li(o)}let r=0;for(let a=0;a<e.length;a++){const o=e[a];o.length!==0&&(r!==a&&(e[r]=o,t[r]=t[a],n[r]=n[a],s[r]=s[a]),r++)}return e.length=r,t.length=r,n.length=r,s.length=r,{len:r,texts:e,isWordLike:t,kinds:n,starts:s}}function eB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r];if(e.push(a),t.push(i.isWordLike[r]),n.push(i.kinds[r]),s.push(i.starts[r]),!ZM(a))continue;const o=r+1;if(o>=i.len||Xd(i.kinds[o]))continue;const c=[],l=i.starts[o];let h=o;for(;h<i.len&&!Xd(i.kinds[h]);)c.push(i.texts[h]),h++;c.length>0&&(e.push(li(c)),t.push(!0),n.push("text"),s.push(l),r=h-1)}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}const tB=new Set([":","-","/","×",",",".","+","–","—"]),Fm=/^[A-Za-z0-9_]+[,:;]*$/,Nm=/[,:;]+$/;function Dm(i){for(const e of i)if(Im.test(e))return!0;return!1}function Hl(i){if(i.length===0)return!1;for(const e of i)if(!(Im.test(e)||tB.has(e)))return!1;return!0}function nB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r],o=i.kinds[r];if(o==="text"&&Hl(a)&&Dm(a)){const c=[a];let l=r+1;for(;l<i.len&&i.kinds[l]==="text"&&Hl(i.texts[l]);)c.push(i.texts[l]),l++;e.push(li(c)),t.push(!0),n.push("text"),s.push(i.starts[r]),r=l-1;continue}e.push(a),t.push(i.isWordLike[r]),n.push(o),s.push(i.starts[r])}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function iB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r],o=i.kinds[r],c=i.isWordLike[r];if(o==="text"&&c&&Fm.test(a)){const l=[a];let h=Nm.test(a),u=r+1;for(;h&&u<i.len&&i.kinds[u]==="text"&&i.isWordLike[u]&&Fm.test(i.texts[u]);){const d=i.texts[u];l.push(d),h=Nm.test(d),u++}e.push(li(l)),t.push(!0),n.push("text"),s.push(i.starts[r]),r=u-1;continue}e.push(a),t.push(c),n.push(o),s.push(i.starts[r])}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function sB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r];if(i.kinds[r]==="text"&&a.includes("-")){const o=a.split("-");let c=o.length>1;for(let l=0;l<o.length;l++){const h=o[l];if(!c)break;(h.length===0||!Dm(h)||!Hl(h))&&(c=!1)}if(c){let l=0;for(let h=0;h<o.length;h++){const u=o[h],d=h<o.length-1?`${u}-`:u;e.push(d),t.push(!0),n.push("text"),s.push(i.starts[r]+l),l+=d.length}continue}}e.push(a),t.push(i.isWordLike[r]),n.push(i.kinds[r]),s.push(i.starts[r])}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function rB(i){const e=[],t=[],n=[],s=[];let r=0;for(;r<i.len;){const a=[i.texts[r]];let o=i.isWordLike[r],c=i.kinds[r],l=i.starts[r];if(c==="glue"){const h=[a[0]],u=l;for(r++;r<i.len&&i.kinds[r]==="glue";)h.push(i.texts[r]),r++;const d=li(h);if(r<i.len&&i.kinds[r]==="text")a[0]=d,a.push(i.texts[r]),o=i.isWordLike[r],c="text",l=u,r++;else{e.push(d),t.push(!1),n.push("glue"),s.push(u);continue}}else r++;if(c==="text")for(;r<i.len&&i.kinds[r]==="glue";){const h=[];for(;r<i.len&&i.kinds[r]==="glue";)h.push(i.texts[r]),r++;const u=li(h);if(r<i.len&&i.kinds[r]==="text"){a.push(u,i.texts[r]),o=o||i.isWordLike[r],r++;continue}a.push(u)}e.push(li(a)),t.push(o),n.push(c),s.push(l)}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function aB(i){const e=i.texts.slice(),t=i.isWordLike.slice(),n=i.kinds.slice(),s=i.starts.slice();for(let r=0;r<e.length-1;r++){if(n[r]!=="text"||n[r+1]!=="text"||!_r(e[r])||!_r(e[r+1]))continue;const a=HM(e[r]);a!==null&&(e[r]=a.head,e[r+1]=a.tail+e[r+1],s[r+1]=s[r]+a.head.length)}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function Lm(i,e,t){const n=BM();let s=0;const r=[],a=[],o=[],c=[],l=[],h=[],u=[],d=[],f=[],p=[],m=[],g=[];for(const w of n.segment(i))for(const I of XM(w.segment,w.isWordLike??!1,w.index,t)){let O=function(){h[D]!==null&&(a[D]=[Tm(r,h,u,D)],h[D]=null),a[D].push(I.text),o[D]=o[D]||I.isWordLike,d[D]=d[D]||v,f[D]=f[D]||F,p[D]=q,m[D]=$,g[D]=Rm(f[D],K)};const T=I.kind==="text",C=zM(I.text,I.isWordLike,I.kind),v=_r(I.text),F=Sm(I.text),K=Gl(I.text),q=jd(I.text),$=VM(I.text),D=s-1;e.carryCJKAfterClosingQuote&&T&&s>0&&c[D]==="text"&&v&&d[D]&&p[D]||T&&s>0&&c[D]==="text"&&QM(I.text)&&d[D]||T&&s>0&&c[D]==="text"&&m[D]?O():T&&s>0&&c[D]==="text"&&I.isWordLike&&F&&g[D]?(O(),o[D]=!0):C!==null&&s>0&&c[D]==="text"&&h[D]===C?u[D]=(u[D]??1)+1:T&&!I.isWordLike&&s>0&&c[D]==="text"&&(OM(I.text)||I.text==="-"&&o[D])?O():(r[s]=I.text,a[s]=[I.text],o[s]=I.isWordLike,c[s]=I.kind,l[s]=I.start,h[s]=C,u[s]=C===null?0:1,d[s]=v,f[s]=F,p[s]=q,m[s]=$,g[s]=Rm(F,K),s++)}for(let w=0;w<s;w++){if(h[w]!==null){r[w]=Tm(r,h,u,w);continue}r[w]=li(a[w])}for(let w=1;w<s;w++)c[w]==="text"&&!o[w]&&Kd(r[w])&&c[w-1]==="text"&&(r[w-1]+=r[w],o[w-1]=o[w-1]||o[w],r[w]="");const A=Array.from({length:s},()=>null);let _=-1;for(let w=s-1;w>=0;w--){const I=r[w];if(I.length!==0){if(c[w]==="text"&&!o[w]&&GM(I)&&_>=0&&c[_]==="text"){const T=A[_]??[];T.push(I),A[_]=T,l[_]=l[w],r[w]="";continue}_=w}}for(let w=0;w<s;w++){const I=A[w];I!=null&&(r[w]=jM(I,r[w]))}let x=0;for(let w=0;w<s;w++){const I=r[w];I.length!==0&&(x!==w&&(r[x]=I,o[x]=o[w],c[x]=c[w],l[x]=l[w]),x++)}r.length=x,o.length=x,c.length=x,l.length=x;const E=rB({len:x,texts:r,isWordLike:o,kinds:c,starts:l}),S=aB(iB(sB(nB(eB($M(E))))));for(let w=0;w<S.len-1;w++){const I=WM(S.texts[w]);I!==null&&(S.kinds[w]!=="space"&&S.kinds[w]!=="preserved-space"||S.kinds[w+1]!=="text"||!Sm(S.texts[w+1])||(S.texts[w]=I.space,S.isWordLike[w]=!1,S.kinds[w]=S.kinds[w]==="preserved-space"?"preserved-space":"space",S.texts[w+1]=I.marks+S.texts[w+1],S.starts[w+1]=S.starts[w]+I.space.length))}return S}function oB(i,e){if(i.len===0)return[];if(!e.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:i.len,consumedEndSegmentIndex:i.len}];const t=[];let n=0;for(let s=0;s<i.len;s++)i.kinds[s]==="hard-break"&&(t.push({startSegmentIndex:n,endSegmentIndex:s,consumedEndSegmentIndex:s+1}),n=s+1);return n<i.len&&t.push({startSegmentIndex:n,endSegmentIndex:i.len,consumedEndSegmentIndex:i.len}),t}function cB(i){if(i.len<=1)return i;const e=[],t=[],n=[],s=[];let r=null,a=!1,o=0,c=!1,l=!1;function h(){r!==null&&(e.push(li(r)),t.push(a),n.push("text"),s.push(o),r=null)}for(let u=0;u<i.len;u++){const d=i.texts[u],f=i.kinds[u],p=i.isWordLike[u],m=i.starts[u];if(f==="text"){const g=NM(d),A=LM(d);if(r!==null&&c&&l){r.push(d),a=a||p,c=c||g,l=A;continue}h(),r=[d],a=p,o=m,c=g,l=A;continue}h(),e.push(d),t.push(p),n.push(f),s.push(m)}return h(),{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function lB(i,e,t="normal",n="normal"){const s=CM(t),r=s.mode==="pre-wrap"?SM(i):IM(i);if(r.length===0)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const a=n==="keep-all"?cB(Lm(r,e,s)):Lm(r,e,s);return{normalized:r,chunks:oB(a,s),...a}}let Ba=null;const Pm=new Map;let Ta=null;const hB=96,uB=new RegExp("\\p{Emoji_Presentation}","u"),dB=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Yd=null;const km=new Map;function Jd(){if(Ba!==null)return Ba;if(typeof OffscreenCanvas<"u")return Ba=new OffscreenCanvas(1,1).getContext("2d"),Ba;if(typeof document<"u")return Ba=document.createElement("canvas").getContext("2d"),Ba;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function fB(i){let e=Pm.get(i);return e||(e=new Map,Pm.set(i,e)),e}function Vs(i,e){let t=e.get(i);return t===void 0&&(t={width:Jd().measureText(i).width,containsCJK:_r(i)},e.set(i,t)),t}function Ra(){if(Ta!==null)return Ta;if(typeof navigator>"u")return Ta={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ta;const i=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&i.includes("Safari/")&&!i.includes("Chrome/")&&!i.includes("Chromium/")&&!i.includes("CriOS/")&&!i.includes("FxiOS/")&&!i.includes("EdgiOS/"),n=i.includes("Chrome/")||i.includes("Chromium/")||i.includes("CriOS/")||i.includes("Edg/");return Ta={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},Ta}function pB(i){const e=i.match(/(\d+(?:\.\d+)?)\s*px/);return e?parseFloat(e[1]):16}function Um(){return Yd===null&&(Yd=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Yd}function AB(i){return uB.test(i)||i.includes("️")}function gB(i){return dB.test(i)}function mB(i,e){let t=km.get(i);if(t!==void 0)return t;const n=Jd();n.font=i;const s=n.measureText("😀").width;if(t=0,s>e+.5&&typeof document<"u"&&document.body!==null){const r=document.createElement("span");r.style.font=i,r.style.display="inline-block",r.style.visibility="hidden",r.style.position="absolute",r.textContent="😀",document.body.appendChild(r);const a=r.getBoundingClientRect().width;document.body.removeChild(r),s-a>.5&&(t=s-a)}return km.set(i,t),t}function xB(i){let e=0;const t=Um();for(const n of t.segment(i))AB(n.segment)&&e++;return e}function bB(i,e){return e.emojiCount===void 0&&(e.emojiCount=xB(i)),e.emojiCount}function vr(i,e,t){return t===0?e.width:e.width-bB(i,e)*t}function EB(i,e,t,n,s){if(e.breakableFitAdvances!==void 0)return e.breakableFitAdvances;const r=Um(),a=[];for(const h of r.segment(i))a.push(h.segment);if(a.length<=1)return e.breakableFitAdvances=null,e.breakableFitAdvances;if(s==="sum-graphemes"){const h=[];for(const u of a){const d=Vs(u,t);h.push(vr(u,d,n))}return e.breakableFitAdvances=h,e.breakableFitAdvances}if(s==="pair-context"||a.length>hB){const h=[];let u=null,d=0;for(const f of a){const p=Vs(f,t),m=vr(f,p,n);if(u===null)h.push(m);else{const g=u+f,A=Vs(g,t);h.push(vr(g,A,n)-d)}u=f,d=m}return e.breakableFitAdvances=h,e.breakableFitAdvances}const o=[];let c="",l=0;for(const h of a){c+=h;const u=Vs(c,t),d=vr(c,u,n);o.push(d-l),l=d}return e.breakableFitAdvances=o,e.breakableFitAdvances}function yB(i,e){const t=Jd();t.font=i;const n=fB(i),s=pB(i),r=e?mB(i,s):0;return{cache:n,fontSize:s,emojiCorrection:r}}function _B(i,e){for(;e<i.widths.length;){const t=i.kinds[e];if(t!=="space"&&t!=="zero-width-break"&&t!=="soft-hyphen")break;e++}return e}function Om(i,e){if(e<=0)return 0;const t=i%e;return Math.abs(t)<=1e-6?e:e-t}function Qm(i,e,t,n,s){let r=0,a=e;for(;r<i.length;){const o=a+i[r];if((r+1<i.length?o+s:o)>t+n)break;a=o,r++}return{fitCount:r,fittedWidth:a}}function wB(i,e){let t=0,n=i.chunks.length;for(;t<n;){const s=Math.floor((t+n)/2);e<i.chunks[s].consumedEndSegmentIndex?n=s:t=s+1}return t<i.chunks.length?t:-1}function Gm(i,e,t){let n=t.segmentIndex;if(t.graphemeIndex>0)return e;const s=i.chunks[e];if(s.startSegmentIndex===s.endSegmentIndex&&n===s.startSegmentIndex)return t.segmentIndex=n,t.graphemeIndex=0,e;for(n<s.startSegmentIndex&&(n=s.startSegmentIndex);n<s.endSegmentIndex;){const r=i.kinds[n];if(r!=="space"&&r!=="zero-width-break"&&r!=="soft-hyphen")return t.segmentIndex=n,t.graphemeIndex=0,e;n++}return s.consumedEndSegmentIndex>=i.widths.length?-1:(t.segmentIndex=s.consumedEndSegmentIndex,t.graphemeIndex=0,e+1)}function Zd(i,e){if(e.segmentIndex>=i.widths.length)return-1;const t=wB(i,e.segmentIndex);return t<0?-1:Gm(i,t,e)}function vB(i,e,t){if(t.segmentIndex>=i.widths.length)return-1;let n=e;for(;n<i.chunks.length&&t.segmentIndex>=i.chunks[n].consumedEndSegmentIndex;)n++;return n>=i.chunks.length?-1:Gm(i,n,t)}function CB(i,e){return i.simpleLineWalkFastPath?Hm(i,e):$d(i,e)}function Hm(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i;if(n.length===0)return 0;const o=Ra().lineFitEpsilon,c=e+o;let l=0,h=0,u=!1,d=0,f=0,p=0,m=0,g=-1,A=0;function _(){g=-1,A=0}function x(C=p,v=m,F=h){l++,t?.({startSegmentIndex:d,startGraphemeIndex:f,endSegmentIndex:C,endGraphemeIndex:v,width:F}),h=0,u=!1,_()}function E(C,v){u=!0,d=C,f=0,p=C+1,m=0,h=v}function S(C,v,F){u=!0,d=C,f=v,p=C,m=v+1,h=F}function w(C,v){if(!u){E(C,v);return}h+=v,p=C+1,m=0}function I(C,v){const F=r[C];for(let K=v;K<F.length;K++){const q=F[K];u?h+q>c?(x(),S(C,K,q)):(h+=q,p=C,m=K+1):S(C,K,q)}u&&p===C&&m===F.length&&(p=C+1,m=0)}let T=0;for(;T<n.length&&!(!u&&(T=_B(i,T),T>=n.length));){const C=n[T],v=s[T],F=v==="space"||v==="preserved-space"||v==="tab"||v==="zero-width-break"||v==="soft-hyphen";if(!u){C>e&&r[T]!==null?I(T,0):E(T,C),F&&(g=T+1,A=h-C),T++;continue}if(h+C>c){if(F){w(T,C),x(T+1,0,h-C),T++;continue}if(g>=0){if(p>g||p===g&&m>0){x();continue}x(g,0,A);continue}if(C>e&&r[T]!==null){x(),I(T,0),T++;continue}x();continue}w(T,C),F&&(g=T+1,A=h-C),T++}return u&&x(),l}function $d(i,e,t){if(i.simpleLineWalkFastPath)return Hm(i,e,t);const{widths:n,lineEndFitAdvances:s,lineEndPaintAdvances:r,kinds:a,breakableFitAdvances:o,discretionaryHyphenWidth:c,tabStopAdvance:l,chunks:h}=i;if(n.length===0||h.length===0)return 0;const u=Ra(),d=u.lineFitEpsilon,f=e+d;let p=0,m=0,g=!1,A=0,_=0,x=0,E=0,S=-1,w=0,I=0,T=null;function C(){S=-1,w=0,I=0,T=null}function v(Q=x,J=E,ee=m){p++,t?.({startSegmentIndex:A,startGraphemeIndex:_,endSegmentIndex:Q,endGraphemeIndex:J,width:ee}),m=0,g=!1,C()}function F(Q,J){g=!0,A=Q,_=0,x=Q+1,E=0,m=J}function K(Q,J,ee){g=!0,A=Q,_=J,x=Q,E=J+1,m=ee}function q(Q,J){if(!g){F(Q,J);return}m+=J,x=Q+1,E=0}function $(Q,J,ee,ae){if(!J)return;const _e=Q==="tab"?0:s[ee],Me=Q==="tab"?ae:r[ee];S=ee+1,w=m-ae+_e,I=m-ae+Me,T=Q}function D(Q,J){const ee=o[Q];for(let ae=J;ae<ee.length;ae++){const _e=ee[ae];g?m+_e>f?(v(),K(Q,ae,_e)):(m+=_e,x=Q,E=ae+1):K(Q,ae,_e)}g&&x===Q&&E===ee.length&&(x=Q+1,E=0)}function O(Q){if(T!=="soft-hyphen")return!1;const J=o[Q];if(J==null)return!1;const{fitCount:ee,fittedWidth:ae}=Qm(J,m,e,d,c);return ee===0?!1:(m=ae,x=Q,E=ee,C(),ee===J.length?(x=Q+1,E=0,!0):(v(Q,ee,ae+c),D(Q,ee),!0))}function Y(Q){p++,t?.({startSegmentIndex:Q.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:Q.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),C()}for(let Q=0;Q<h.length;Q++){const J=h[Q];if(J.startSegmentIndex===J.endSegmentIndex){Y(J);continue}g=!1,m=0,A=J.startSegmentIndex,_=0,x=J.startSegmentIndex,E=0,C();let ee=J.startSegmentIndex;for(;ee<J.endSegmentIndex;){const ae=a[ee],_e=ae==="space"||ae==="preserved-space"||ae==="tab"||ae==="zero-width-break"||ae==="soft-hyphen",Me=ae==="tab"?Om(m,l):n[ee];if(ae==="soft-hyphen"){g&&(x=ee+1,E=0,S=ee+1,w=m+c,I=m+c,T=ae),ee++;continue}if(!g){Me>e&&o[ee]!==null?D(ee,0):F(ee,Me),$(ae,_e,ee,Me),ee++;continue}if(m+Me>f){const me=m+(ae==="tab"?0:s[ee]),xe=m+(ae==="tab"?Me:r[ee]);if(T==="soft-hyphen"&&u.preferEarlySoftHyphenBreak&&w<=f){v(S,0,I);continue}if(T==="soft-hyphen"&&O(ee)){ee++;continue}if(_e&&me<=f){q(ee,Me),v(ee+1,0,xe),ee++;continue}if(S>=0&&w<=f){if(x>S||x===S&&E>0){v();continue}const be=S;v(be,0,I),ee=be;continue}if(Me>e&&o[ee]!==null){v(),D(ee,0),ee++;continue}v();continue}q(ee,Me),$(ae,_e,ee,Me),ee++}if(g){const ae=S===J.consumedEndSegmentIndex?I:m;v(J.consumedEndSegmentIndex,0,ae)}}return p}function ef(i,e,t,n){const s=i.chunks[t];if(s.startSegmentIndex===s.endSegmentIndex)return e.segmentIndex=s.consumedEndSegmentIndex,e.graphemeIndex=0,0;const{widths:r,lineEndFitAdvances:a,lineEndPaintAdvances:o,kinds:c,breakableFitAdvances:l,discretionaryHyphenWidth:h,tabStopAdvance:u}=i,d=Ra(),f=d.lineFitEpsilon,p=n+f;let m=0,g=!1,A=e.segmentIndex,_=e.graphemeIndex,x=-1,E=0,S=0,w=null;function I(){x=-1,E=0,S=0,w=null}function T(D=A,O=_,Y=m){return g?(e.segmentIndex=D,e.graphemeIndex=O,Y):null}function C(D,O){g=!0,A=D+1,_=0,m=O}function v(D,O,Y){g=!0,A=D,_=O+1,m=Y}function F(D,O){if(!g){C(D,O);return}m+=O,A=D+1,_=0}function K(D,O,Y,Q){if(!O)return;const J=D==="tab"?0:a[Y],ee=D==="tab"?Q:o[Y];x=Y+1,E=m-Q+J,S=m-Q+ee,w=D}function q(D,O){const Y=l[D];for(let Q=O;Q<Y.length;Q++){const J=Y[Q];if(!g)v(D,Q,J);else{if(m+J>p)return T();m+=J,A=D,_=Q+1}}return g&&A===D&&_===Y.length&&(A=D+1,_=0),null}function $(D){if(w!=="soft-hyphen"||x<0)return null;const O=l[D]??null;if(O!==null){const{fitCount:Y,fittedWidth:Q}=Qm(O,m,n,f,h);if(Y===O.length)return m=Q,A=D+1,_=0,I(),null;if(Y>0)return T(D,Y,Q+h)}return E<=p?T(x,0,S):null}for(let D=e.segmentIndex;D<s.endSegmentIndex;D++){const O=c[D],Y=O==="space"||O==="preserved-space"||O==="tab"||O==="zero-width-break"||O==="soft-hyphen",Q=D===e.segmentIndex?e.graphemeIndex:0,J=O==="tab"?Om(m,u):r[D];if(O==="soft-hyphen"&&Q===0){g&&(A=D+1,_=0,x=D+1,E=m+h,S=m+h,w=O);continue}if(!g){if(Q>0){const ae=q(D,Q);if(ae!==null)return ae}else if(J>n&&l[D]!==null){const ae=q(D,0);if(ae!==null)return ae}else C(D,J);K(O,Y,D,J);continue}if(m+J>p){const ae=m+(O==="tab"?0:a[D]),_e=m+(O==="tab"?J:o[D]);if(w==="soft-hyphen"&&d.preferEarlySoftHyphenBreak&&E<=p)return T(x,0,S);const Me=$(D);if(Me!==null)return Me;if(Y&&ae<=p)return F(D,J),T(D+1,0,_e);if(x>=0&&E<=p)return A>x||A===x&&_>0?T():T(x,0,S);if(J>n&&l[D]!==null){const se=T();if(se!==null)return se;const me=q(D,0);if(me!==null)return me}return T()}F(D,J),K(O,Y,D,J)}return x===s.consumedEndSegmentIndex&&_===0?T(s.consumedEndSegmentIndex,0,S):T(s.consumedEndSegmentIndex,0,m)}function zm(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i,o=Ra().lineFitEpsilon,c=t+o;let l=0,h=!1,u=e.segmentIndex,d=e.graphemeIndex,f=-1,p=0;for(let m=e.segmentIndex;m<n.length;m++){const g=n[m],A=s[m],_=A==="space"||A==="preserved-space"||A==="tab"||A==="zero-width-break"||A==="soft-hyphen",x=m===e.segmentIndex?e.graphemeIndex:0,E=r[m];if(!h){if(x>0||g>t&&E!==null){const S=E,w=S[x];h=!0,l=w,u=m,d=x+1;for(let I=x+1;I<S.length;I++){const T=S[I];if(l+T>c)return e.segmentIndex=u,e.graphemeIndex=d,l;l+=T,u=m,d=I+1}u===m&&d===S.length&&(u=m+1,d=0)}else h=!0,l=g,u=m+1,d=0;_&&(f=m+1,p=l-g);continue}if(l+g>c)return _?(e.segmentIndex=m+1,e.graphemeIndex=0,l):f>=0?u>f||u===f&&d>0?(e.segmentIndex=u,e.graphemeIndex=d,l):(e.segmentIndex=f,e.graphemeIndex=0,p):(e.segmentIndex=u,e.graphemeIndex=d,l);l+=g,u=m+1,d=0,_&&(f=m+1,p=l-g)}return h?(e.segmentIndex=u,e.graphemeIndex=d,l):null}function tf(i,e,t){const n={segmentIndex:e.segmentIndex,graphemeIndex:e.graphemeIndex},s=Zd(i,n);if(s<0)return null;const r=n.segmentIndex,a=n.graphemeIndex,o=i.simpleLineWalkFastPath?zm(i,n,t):ef(i,n,s,t);return o===null?null:{startSegmentIndex:r,startGraphemeIndex:a,endSegmentIndex:n.segmentIndex,endGraphemeIndex:n.graphemeIndex,width:o}}function IB(i,e,t){const n=Zd(i,e);return n<0?null:i.simpleLineWalkFastPath?zm(i,e,t):ef(i,e,n,t)}function SB(i,e){if(i.widths.length===0)return{lineCount:0,maxLineWidth:0};const t={segmentIndex:0,graphemeIndex:0};let n=0,s=0;if(!i.simpleLineWalkFastPath){let r=Zd(i,t);for(;r>=0;){const a=ef(i,t,r,e);if(a===null)return{lineCount:n,maxLineWidth:s};n++,a>s&&(s=a),r=vB(i,r,t)}return{lineCount:n,maxLineWidth:s}}for(;;){const r=IB(i,t,e);if(r===null)return{lineCount:n,maxLineWidth:s};n++,r>s&&(s=r)}}let nf=null,Vm=new WeakMap;function Wm(){return nf===null&&(nf=new Intl.Segmenter(void 0,{granularity:"grapheme"})),nf}function MB(i){return i?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function BB(i,e){const t=[];let n=[],s=0,r=!1,a=!1,o=!1;function c(){n.length!==0&&(t.push({text:n.length===1?n[0]:n.join(""),start:s}),n=[],r=!1,a=!1,o=!1)}function l(u,d,f){n=[u],s=d,r=f,a=jd(u),o=Ql.has(u)}function h(u,d){n.push(u),r=r||d;const f=jd(u);u.length===1&&wr.has(u)?a=a||f:a=f,o=!1}for(const u of Wm().segment(i)){const d=u.segment,f=_r(d);if(n.length===0){l(d,u.index,f);continue}if(o||Wd.has(d)||wr.has(d)||e.carryCJKAfterClosingQuote&&f&&a){h(d,f);continue}if(!r&&!f){h(d,f);continue}c(),l(d,u.index,f)}return c(),t}function TB(i,e,t,n){const s=Ra(),{cache:r,emojiCorrection:a}=yB(e,gB(i.normalized)),o=vr("-",Vs("-",r),a),l=vr(" ",Vs(" ",r),a)*8;if(i.len===0)return MB(t);const h=[],u=[],d=[],f=[];let p=i.chunks.length<=1;const m=t?[]:null,g=[],A=t?[]:null,_=Array.from({length:i.len});function x(I,T,C,v,F,K,q){F!=="text"&&F!=="space"&&F!=="zero-width-break"&&(p=!1),h.push(T),u.push(C),d.push(v),f.push(F),m?.push(K),g.push(q),A!==null&&A.push(I)}function E(I,T,C,v,F){const K=Vs(I,r),q=vr(I,K,a),$=T==="space"||T==="preserved-space"||T==="zero-width-break"?0:q,D=T==="space"||T==="zero-width-break"?0:q;if(F&&v&&I.length>1){let O="sum-graphemes";Hl(I)?O="pair-context":s.preferPrefixWidthsForBreakableRuns&&(O="segment-prefixes");const Y=EB(I,K,r,a,O);x(I,q,$,D,T,C,Y);return}x(I,q,$,D,T,C,null)}for(let I=0;I<i.len;I++){_[I]=h.length;const T=i.texts[I],C=i.isWordLike[I],v=i.kinds[I],F=i.starts[I];if(v==="soft-hyphen"){x(T,0,o,o,v,F,null);continue}if(v==="hard-break"){x(T,0,0,0,v,F,null);continue}if(v==="tab"){x(T,0,0,0,v,F,null);continue}const K=Vs(T,r);if(v==="text"&&K.containsCJK){const $=BB(T,s);for(let D=0;D<$.length;D++){const O=$[D];E(O.text,"text",F+O.start,C,!_r(O.text))}continue}E(T,v,F,C,!0)}const S=RB(i.chunks,_,h.length),w=m===null?null:_M(i.normalized,m);return A!==null?{widths:h,lineEndFitAdvances:u,lineEndPaintAdvances:d,kinds:f,simpleLineWalkFastPath:p,segLevels:w,breakableFitAdvances:g,discretionaryHyphenWidth:o,tabStopAdvance:l,chunks:S,segments:A}:{widths:h,lineEndFitAdvances:u,lineEndPaintAdvances:d,kinds:f,simpleLineWalkFastPath:p,segLevels:w,breakableFitAdvances:g,discretionaryHyphenWidth:o,tabStopAdvance:l,chunks:S}}function RB(i,e,t){const n=[];for(let s=0;s<i.length;s++){const r=i[s],a=r.startSegmentIndex<e.length?e[r.startSegmentIndex]:t,o=r.endSegmentIndex<e.length?e[r.endSegmentIndex]:t,c=r.consumedEndSegmentIndex<e.length?e[r.consumedEndSegmentIndex]:t;n.push({startSegmentIndex:a,endSegmentIndex:o,consumedEndSegmentIndex:c})}return n}function qm(i,e,t,n){const r=lB(i,Ra(),n?.whiteSpace,"normal");return TB(r,e,t)}function zl(i,e,t){return qm(i,e,!1,t)}function Vl(i,e,t){return qm(i,e,!0,t)}function mP(i){return i}function FB(i,e,t){const n=CB(i,e);return{lineCount:n,height:n*t}}function Km(i,e,t){let n=t.get(i);if(n!==void 0)return n;n=[];const s=Wm();for(const r of s.segment(e[i]))n.push(r.segment);return t.set(i,n),n}function jm(i){let e=Vm.get(i);return e!==void 0||(e=new Map,Vm.set(i,e)),e}function NB(i,e,t,n){return n>0&&i[n-1]==="soft-hyphen"&&!(e===n&&t>0)}function DB(i,e,t,n,s,r,a){let o="";const c=NB(e,n,s,r);for(let l=n;l<r;l++)e[l]==="soft-hyphen"||e[l]==="hard-break"||(l===n&&s>0?o+=Km(l,i,t).slice(s).join(""):o+=i[l]);return a>0?(c&&(o+="-"),o+=Km(r,i,t).slice(n===r?s:0,a).join("")):c&&(o+="-"),o}function Xm(i,e,t,n,s,r,a){return{text:DB(i.segments,i.kinds,e,n,s,r,a),width:t,start:{segmentIndex:n,graphemeIndex:s},end:{segmentIndex:r,graphemeIndex:a}}}function LB(i,e,t){return Xm(i,e,t.width,t.startSegmentIndex,t.startGraphemeIndex,t.endSegmentIndex,t.endGraphemeIndex)}function PB(i){return{width:i.width,start:{segmentIndex:i.startSegmentIndex,graphemeIndex:i.startGraphemeIndex},end:{segmentIndex:i.endSegmentIndex,graphemeIndex:i.endGraphemeIndex}}}function kB(i,e){return Xm(i,jm(i),e.width,e.start.segmentIndex,e.start.graphemeIndex,e.end.segmentIndex,e.end.graphemeIndex)}function UB(i,e,t){return i.widths.length===0?0:$d(i,e,n=>{t(PB(n))})}function sf(i,e){return SB(i,e)}function Ym(i){let e=0;return UB(i,Number.POSITIVE_INFINITY,t=>{t.width>e&&(e=t.width)}),e}function OB(i,e,t){const n=[];if(i.widths.length===0)return{lineCount:0,height:0,lines:n};const s=jm(i),r=$d(i,e,a=>{n.push(LB(i,s,a))});return{lineCount:r,height:r*t,lines:n}}const QB=/[ \t\n\f\r]+/,Jm=/^[ \t\n\f\r]+/,Zm=/[ \t\n\f\r]+$/,Wl={segmentIndex:0,graphemeIndex:0},$m={itemIndex:0,segmentIndex:0,graphemeIndex:0};function xP(i){return i}function rf(i){return{segmentIndex:i.segmentIndex,graphemeIndex:i.graphemeIndex}}function e0(i){return i.segmentIndex===0&&i.graphemeIndex===0}function ql(i,e){const t=e.get(i);if(t!==void 0)return t;const n=Ym(Vl("A A",i)),s=Ym(Vl("AA",i)),r=Math.max(0,n-s);return e.set(i,r),r}function GB(i){const e=tf(i,Wl,Number.POSITIVE_INFINITY);return e===null?null:{endGraphemeIndex:e.endGraphemeIndex,endSegmentIndex:e.endSegmentIndex,width:e.width}}function HB(i,e){return i===0&&e>0}function t0(i){const e=[],t=Array.from({length:i.length}),n=new Map;let s=0;for(let r=0;r<i.length;r++){const a=i[r],o=Jm.test(a.text),c=Zm.test(a.text),l=a.text.replace(Jm,"").replace(Zm,"");if(l.length===0){QB.test(a.text)&&s===0&&(s=ql(a.font,n));continue}const h=s>0?s:o?ql(a.font,n):0,u=Vl(l,a.font),d=GB(u);if(d===null){s=c?ql(a.font,n):0;continue}const f={break:a.break??"normal",endGraphemeIndex:d.endGraphemeIndex,endSegmentIndex:d.endSegmentIndex,extraWidth:a.extraWidth??0,gapBefore:h,naturalWidth:d.width,prepared:u,sourceItemIndex:r};e.push(f),t[r]=f,s=c?ql(a.font,n):0}return{items:e,itemsBySourceItemIndex:t}}function zB(i,e,t,n){if(i.items.length===0||t.itemIndex>=i.items.length)return null;const s=Math.max(1,e);let r=0,a=s,o=t.itemIndex;const c={segmentIndex:t.segmentIndex,graphemeIndex:t.graphemeIndex};e:for(;o<i.items.length;){const l=i.items[o];if(!e0(c)&&c.segmentIndex===l.endSegmentIndex&&c.graphemeIndex===l.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}const h=r===0?0:l.gapBefore,u=e0(c);if(l.break==="never"){if(!u){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}const m=l.naturalWidth+l.extraWidth,g=h+m;if(r>0&&g>a)break e;n?.(l,h,m,rf(Wl),{segmentIndex:l.endSegmentIndex,graphemeIndex:l.endGraphemeIndex}),r+=g,a=Math.max(0,s-r),o++,c.segmentIndex=0,c.graphemeIndex=0;continue}const d=h+l.extraWidth;if(r>0&&d>=a)break e;if(u){const m=d+l.naturalWidth;if(m<=a){n?.(l,h,l.naturalWidth+l.extraWidth,rf(Wl),{segmentIndex:l.endSegmentIndex,graphemeIndex:l.endGraphemeIndex}),r+=m,a=Math.max(0,s-r),o++,c.segmentIndex=0,c.graphemeIndex=0;continue}}const f=Math.max(1,a-d),p=tf(l.prepared,c,f);if(p===null){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}if(c.segmentIndex===p.endSegmentIndex&&c.graphemeIndex===p.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}if(r>0&&u&&h>0&&HB(p.endSegmentIndex,p.endGraphemeIndex)){const m=tf(l.prepared,Wl,Math.max(1,s-l.extraWidth));if(m!==null&&(m.endSegmentIndex>p.endSegmentIndex||m.endSegmentIndex===p.endSegmentIndex&&m.endGraphemeIndex>p.endGraphemeIndex))break e}if(n?.(l,h,p.width+l.extraWidth,rf(c),{segmentIndex:p.endSegmentIndex,graphemeIndex:p.endGraphemeIndex}),r+=h+p.width+l.extraWidth,a=Math.max(0,s-r),p.endSegmentIndex===l.endSegmentIndex&&p.endGraphemeIndex===l.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}c.segmentIndex=p.endSegmentIndex,c.graphemeIndex=p.endGraphemeIndex;break}return r===0?null:(t.itemIndex=o,t.segmentIndex=c.segmentIndex,t.graphemeIndex=c.graphemeIndex,r)}function VB(i,e,t=$m){const n=i,s={itemIndex:t.itemIndex,segmentIndex:t.segmentIndex,graphemeIndex:t.graphemeIndex},r=[],a=zB(n,e,s,(o,c,l,h,u)=>{r.push({itemIndex:o.sourceItemIndex,gapBefore:c,occupiedWidth:l,start:h,end:u})});return a===null?null:{fragments:r,width:a,end:s}}function WB(i,e){return kB(i.prepared,{width:e.occupiedWidth-i.extraWidth,start:e.start,end:e.end}).text}function n0(i,e){const t=i;return{fragments:e.fragments.map(n=>{const s=t.itemsBySourceItemIndex[n.itemIndex];if(s===void 0)throw new Error("Missing rich-text inline item for fragment");return{...n,text:WB(s,n)}}),width:e.width,end:e.end}}function i0(i,e,t){let n=0,s=$m;for(;;){const r=VB(i,e,s);if(r===null)return n;t(r),n++,s=r.end}}const s0="500 14px Inter, sans-serif",af="600 10px Inter, sans-serif",of="300 13px Inter, sans-serif",r0="600 10px Inter, sans-serif",a0="300 12px Inter, sans-serif",Ho=18,Kl=16,gn=16,Gi=6,o0=12,jl=Math.min(window.devicePixelRatio||1,2),qB="rgba(0, 0, 0, 0.75)",KB="rgba(255, 255, 255, 0.08)",jB="rgba(255, 255, 255, 0.9)",XB="rgba(255, 255, 255, 0.30)",YB="rgba(255, 255, 255, 0.85)",c0="rgba(255, 255, 255, 0.08)",JB="rgba(255, 255, 255, 0.45)",ZB="rgba(255, 255, 255, 0.08)",$B="rgba(255, 255, 255, 0.7)";function eT(i){let e=0,t=0,n=0;const s=new Set,r=new Set,a=new Set;let o=!1,c=!1;return i.traverse(l=>{if(l.isMesh||l.isPoints||l.isLine){n++;const h=l.geometry;h&&(h.index?t+=h.index.count/3:h.attributes.position&&(t+=h.attributes.position.count/3),h.attributes.position&&(e+=h.attributes.position.count)),l.skeleton&&(o=!0),l.morphTargetInfluences&&l.morphTargetInfluences.length>0&&(c=!0),(Array.isArray(l.material)?l.material:[l.material]).forEach(d=>{if(d){s.add(d.uuid),a.add(d.type.replace("Material",""));for(const f in d)d[f]&&d[f].isTexture&&r.add(d[f].uuid)}})}}),{vertices:e,triangles:Math.floor(t),meshes:n,materials:s.size,textures:r.size,materialTypes:Array.from(a),hasSkinning:o,hasMorphs:c}}function zo(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function tT(i,e){const t=[];return i.hasSkinning&&t.push("skinned"),i.hasMorphs&&t.push("morph targets"),e&&e.length>0&&t.push(`${e.length} animation${e.length>1?"s":""}`),i.materialTypes.length>0&&t.push(i.materialTypes.join(", ")),t.length>0?t.join(" · "):""}function nT(i,e,t){const n=eT(e),s=tT(n,t),r=[{label:"MESHES",value:zo(n.meshes)},{label:"VERTICES",value:zo(n.vertices)},{label:"TRIANGLES",value:zo(n.triangles)},{label:"MATERIALS",value:zo(n.materials)},{label:"TEXTURES",value:zo(n.textures)}];t&&t.length>0&&r.push({label:"ANIMATIONS",value:t.length.toString()});const a=[];n.materialTypes.forEach(w=>a.push(w)),n.hasSkinning&&a.push("Skinned"),n.hasMorphs&&a.push("Morph"),t&&t.length>0&&a.push("Animated");const o=200,c=zl("Model Info",s0),l=FB(c,o,Ho+2),h=r.map(w=>{const I=[{text:w.label+" ",font:af},{text:w.value,font:of}],T=t0(I),C=zl(w.label,af),v=sf(C,o),F=zl(w.value,of),K=sf(F,o);return{...w,labelWidth:v.maxLineWidth,valueWidth:K.maxLineWidth,richPrepared:T}}),u=a.map(w=>{const I=zl(w,r0),T=sf(I,300);return{text:w,width:T.maxLineWidth+o0}});let d=[],f=0;if(s){const w=Vl(s,a0),I=OB(w,o-gn,Ho);d=I.lines,f=I.height}const p=Math.max(l.width+gn*2,...h.map(w=>w.labelWidth+w.valueWidth+gn*3)),m=Math.max(p,180);let g=0;if(u.length>0){let w=0,I=1;u.forEach(T=>{w>0&&w+T.width>m-gn*2&&(I++,w=0),w+=T.width+6}),g=I*(Kl+6)+Gi}const A=gn+l.height+Gi+Gi+h.length*(Ho+Gi)+g+(f>0?Gi+f:0)+gn,_=document.createElement("canvas");_.width=m*jl,_.height=A*jl,_.style.width=m+"px",_.style.height=A+"px";const x=_.getContext("2d");x.scale(jl,jl),x.fillStyle=qB,cf(x,0,0,m,A,10),x.fill(),x.strokeStyle=KB,x.lineWidth=1,cf(x,.5,.5,m-1,A-1,10),x.stroke();let E=gn;if(x.font=s0,x.fillStyle=jB,x.textBaseline="top",x.fillText("Model Info",gn,E),E+=l.height+Gi,x.strokeStyle=c0,x.beginPath(),x.moveTo(gn,E),x.lineTo(m-gn,E),x.stroke(),E+=Gi,h.forEach(w=>{x.font=af,x.fillStyle=XB,x.textAlign="left",x.fillText(w.label,gn,E),x.font=of,x.fillStyle=YB,x.textAlign="right",x.fillText(w.value,m-gn,E),x.textAlign="left",E+=Ho+Gi}),u.length>0){let w=gn;u.forEach(I=>{w>gn&&w+I.width>m-gn&&(w=gn,E+=Kl+6),x.fillStyle=ZB,cf(x,w,E,I.width,Kl,4),x.fill(),x.font=r0,x.fillStyle=$B,x.textBaseline="top",x.fillText(I.text,w+o0/2,E+3),w+=I.width+6}),E+=Kl+Gi+4}d.length>0&&(x.strokeStyle=c0,x.beginPath(),x.moveTo(gn,E),x.lineTo(m-gn,E),x.stroke(),E+=Gi,x.font=a0,x.fillStyle=JB,x.textBaseline="top",d.forEach(w=>{x.fillText(w.text,gn,E),E+=Ho}));const S=document.createElement("div");return S.classList.add("model-info"),S.appendChild(_),i.appendChild(S),{el:S,canvas:_,remove(){S.remove()}}}function cf(i,e,t,n,s,r){i.beginPath(),i.moveTo(e+r,t),i.lineTo(e+n-r,t),i.quadraticCurveTo(e+n,t,e+n,t+r),i.lineTo(e+n,t+s-r),i.quadraticCurveTo(e+n,t+s,e+n-r,t+s),i.lineTo(e+r,t+s),i.quadraticCurveTo(e,t+s,e,t+s-r),i.lineTo(e,t+r),i.quadraticCurveTo(e,t,e+r,t),i.closePath()}const iT="500 11px Inter, sans-serif",l0="300 10px Inter, sans-serif",lf=10,h0=6,u0=14,Xl=Math.min(window.devicePixelRatio||1,2),sT=8;function rT(i){const e=[];return i.traverse(t=>{if(e.length>=sT||!t.isMesh||!t.name||t.name.startsWith("_"))return;const n=t.geometry,s=Array.isArray(t.material)?t.material[0]:t.material,r=n&&n.attributes.position?n.attributes.position.count:0,a=s?s.type.replace("Material",""):"",o=[{text:t.name,font:iT}];r>0&&o.push({text:" "+oT(r)+" verts",font:l0}),a&&o.push({text:" "+a,font:l0});const c=t0(o);let l=0,h=0;i0(c,300,m=>{const g=n0(c,m);l=Math.max(l,g.width),h++});const u=l+lf*2,d=h*u0+h0*2;n&&n.computeBoundingBox();const f=n?n.boundingBox:null,p=new G;f?(f.getCenter(p),p.applyMatrix4(t.matrixWorld)):t.getWorldPosition(p),e.push({name:t.name,items:o,prepared:c,labelWidth:u,labelHeight:d,position:p,vertCount:r,matType:a})}),e}function aT(i){const{labelWidth:e,labelHeight:t,items:n,prepared:s}=i,r=document.createElement("canvas");r.width=e*Xl,r.height=t*Xl,r.style.width=e+"px",r.style.height=t+"px";const a=r.getContext("2d");a.scale(Xl,Xl),a.fillStyle="rgba(0, 0, 0, 0.8)",d0(a,0,0,e,t,6),a.fill(),a.strokeStyle="rgba(255, 255, 255, 0.1)",a.lineWidth=1,d0(a,.5,.5,e-1,t-1,6),a.stroke(),a.textBaseline="top";let o=h0;return i0(s,e-lf*2,c=>{const l=n0(s,c);let h=lf;l.fragments.forEach(u=>{h+=u.gapBefore;const d=n[u.itemIndex];a.font=d.font,a.fillStyle=u.itemIndex===0?"rgba(255, 255, 255, 0.9)":"rgba(255, 255, 255, 0.45)",a.fillText(u.text,h,o),h+=u.occupiedWidth}),o+=u0}),r}function oT(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function d0(i,e,t,n,s,r){i.beginPath(),i.moveTo(e+r,t),i.lineTo(e+n-r,t),i.quadraticCurveTo(e+n,t,e+n,t+r),i.lineTo(e+n,t+s-r),i.quadraticCurveTo(e+n,t+s,e+n-r,t+s),i.lineTo(e+r,t+s),i.quadraticCurveTo(e,t+s,e,t+s-r),i.lineTo(e,t+r),i.quadraticCurveTo(e,t,e+r,t),i.closePath()}const hf=new WeakMap;class cT extends oi{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,s){const r=new as(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,a=>{this.parse(a,t,s)},n,s)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,yt,n).catch(n)}decodeDracoFile(e,t,n,s,r=un,a=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(hf.has(e)){const c=hf.get(e);if(c.key===n)return c.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const r=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(r,a).then(c=>(s=c,new Promise((l,h)=>{s._callbacks[r]={resolve:l,reject:h},s.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return o.catch(()=>!0).then(()=>{s&&r&&this._releaseTask(s,r)}),hf.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new Mn;e.index&&t.setIndex(new Sn(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],r=s.name,a=s.array,o=s.itemSize,c=new Sn(a,o);r==="color"&&(this._assignVertexColorSpace(c,s.vertexColorSpace),c.normalized=!(a instanceof Float32Array)),t.setAttribute(r,c)}return t}_assignVertexColorSpace(e,t){if(t!==yt)return;const n=new Fe;for(let s=0,r=e.count;s<r;s++)n.fromBufferAttribute(e,s),tt.toWorkingColorSpace(n,yt),e.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new as(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,r)=>{n.load(e,s,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const r=lT.toString(),a=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
-`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(r){const a=r.data;switch(a.type){case"decode":s._callbacks[a.id].resolve(a);break;case"error":s._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,r){return s._taskLoad>r._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function lT(){let i,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":i=o.decoderConfig,e=new Promise(function(h){i.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(i)});break;case"decode":const c=o.buffer,l=o.taskConfig;e.then(h=>{const u=h.draco,d=new u.Decoder;try{const f=t(u,d,new Int8Array(c),l),p=f.attributes.map(m=>m.array.buffer);f.index&&p.push(f.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:f},p)}catch(f){console.error(f),self.postMessage({type:"error",id:o.id,error:f.message})}finally{u.destroy(d)}});break}};function t(a,o,c,l){const h=l.attributeIDs,u=l.attributeTypes;let d,f;const p=o.GetEncodedGeometryType(c);if(p===a.TRIANGULAR_MESH)d=new a.Mesh,f=o.DecodeArrayToMesh(c,c.byteLength,d);else if(p===a.POINT_CLOUD)d=new a.PointCloud,f=o.DecodeArrayToPointCloud(c,c.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const m={index:null,attributes:[]};for(const g in h){const A=self[u[g]];let _,x;if(l.useUniqueIDs)x=h[g],_=o.GetAttributeByUniqueId(d,x);else{if(x=o.GetAttributeId(d,a[h[g]]),x===-1)continue;_=o.GetAttribute(d,x)}const E=s(a,o,d,g,A,_);g==="color"&&(E.vertexColorSpace=l.vertexColorSpace),m.attributes.push(E)}return p===a.TRIANGULAR_MESH&&(m.index=n(a,o,d)),a.destroy(d),m}function n(a,o,c){const h=c.num_faces()*3,u=h*4,d=a._malloc(u);o.GetTrianglesUInt32Array(c,u,d);const f=new Uint32Array(a.HEAPF32.buffer,d,h).slice();return a._free(d),{array:f,itemSize:1}}function s(a,o,c,l,h,u){const d=u.num_components(),p=c.num_points()*d,m=p*h.BYTES_PER_ELEMENT,g=r(a,h),A=a._malloc(m);o.GetAttributeDataArrayForAllPoints(c,u,g,m,A);const _=new h(a.HEAPF32.buffer,A,p).slice();return a._free(A),{name:l,array:_,itemSize:d}}function r(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}class hT{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:s,msg:r,transfer:a}=this.queue.shift();this.workersResolve[e]=s,this.workers[e].postMessage(r,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const s=this._getIdleWorker();s!==-1?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=n,this.workers[s].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const uT=0,f0=2,dT=1,p0=2,fT=0,pT=1,AT=10,gT=0,A0=9,g0=15,m0=16,x0=22,b0=37,E0=43,y0=76,_0=83,w0=97,v0=100,C0=103,I0=109,S0=165,M0=166,uf=1000066e3;class mT{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Vo{constructor(e,t,n,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){t===void 0&&(t=0);const n=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,s)}}const On=[171,75,84,88,32,50,48,187,13,10,26,10];function B0(i){return new TextDecoder().decode(i)}function xT(i){const e=new Uint8Array(i.buffer,i.byteOffset,On.length);if(e[0]!==On[0]||e[1]!==On[1]||e[2]!==On[2]||e[3]!==On[3]||e[4]!==On[4]||e[5]!==On[5]||e[6]!==On[6]||e[7]!==On[7]||e[8]!==On[8]||e[9]!==On[9]||e[10]!==On[10]||e[11]!==On[11])throw new Error("Missing KTX 2.0 identifier.");const t=new mT,n=17*Uint32Array.BYTES_PER_ELEMENT,s=new Vo(i,On.length,n,!0);t.vkFormat=s._nextUint32(),t.typeSize=s._nextUint32(),t.pixelWidth=s._nextUint32(),t.pixelHeight=s._nextUint32(),t.pixelDepth=s._nextUint32(),t.layerCount=s._nextUint32(),t.faceCount=s._nextUint32();const r=s._nextUint32();t.supercompressionScheme=s._nextUint32();const a=s._nextUint32(),o=s._nextUint32(),c=s._nextUint32(),l=s._nextUint32(),h=s._nextUint64(),u=s._nextUint64(),d=new Vo(i,On.length+n,3*r*8,!0);for(let Y=0;Y<r;Y++)t.levels.push({levelData:new Uint8Array(i.buffer,i.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const f=new Vo(i,a,o,!0),p={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},m=(p.descriptorBlockSize/4-6)/4;for(let Y=0;Y<m;Y++){const Q={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&Q.channelType?(Q.sampleLower=f._nextInt32(),Q.sampleUpper=f._nextInt32()):(Q.sampleLower=f._nextUint32(),Q.sampleUpper=f._nextUint32()),p.samples[Y]=Q}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(p);const g=new Vo(i,c,l,!0);for(;g._offset<l;){const Y=g._nextUint32(),Q=g._scan(Y),J=B0(Q);if(t.keyValue[J]=g._nextUint8Array(Y-Q.byteLength-1),J.match(/^ktx/i)){const ee=B0(t.keyValue[J]);t.keyValue[J]=ee.substring(0,ee.lastIndexOf("\0"))}g._skip(Y%4?4-Y%4:0)}if(u<=0)return t;const A=new Vo(i,h,u,!0),_=A._nextUint16(),x=A._nextUint16(),E=A._nextUint32(),S=A._nextUint32(),w=A._nextUint32(),I=A._nextUint32(),T=[];for(let Y=0;Y<r;Y++)T.push({imageFlags:A._nextUint32(),rgbSliceByteOffset:A._nextUint32(),rgbSliceByteLength:A._nextUint32(),alphaSliceByteOffset:A._nextUint32(),alphaSliceByteLength:A._nextUint32()});const C=h+A._offset,v=C+E,F=v+S,K=F+w,q=new Uint8Array(i.buffer,i.byteOffset+C,E),$=new Uint8Array(i.buffer,i.byteOffset+v,S),D=new Uint8Array(i.buffer,i.byteOffset+F,w),O=new Uint8Array(i.buffer,i.byteOffset+K,I);return t.globalData={endpointCount:_,selectorCount:x,imageDescs:T,endpointsData:q,selectorsData:$,tablesData:D,extendedData:O},t}let df,cs,ff;const pf={env:{emscripten_notify_memory_growth:function(i){ff=new Uint8Array(cs.exports.memory.buffer)}}};class bT{init(){return df||(df=typeof fetch<"u"?fetch("data:application/wasm;base64,"+T0).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,pf)).then(this._init):WebAssembly.instantiate(Buffer.from(T0,"base64"),pf).then(this._init),df)}_init(e){cs=e.instance,pf.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!cs)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,s=cs.exports.malloc(n);ff.set(e,s),t=t||Number(cs.exports.ZSTD_findDecompressedSize(s,n));const r=cs.exports.malloc(t),a=cs.exports.ZSTD_decompress(r,t,s,n),o=ff.slice(r,r+a);return cs.exports.free(s),cs.exports.free(r),o}}const T0="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAU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xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQ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ADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAI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AA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",ET="display-p3",yT="display-p3-linear",Af=new WeakMap;let gf=0,mf;class hi extends oi{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new hT,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new as(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new as(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const s=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then(([r,a])=>{const o=hi.BasisWorker.toString(),c=["/* constants */","let _EngineFormat = "+JSON.stringify(hi.EngineFormat),"let _EngineType = "+JSON.stringify(hi.EngineType),"let _TranscoderFormat = "+JSON.stringify(hi.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(hi.BasisFormat),"/* basis_transcoder.js */",r,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
-`);this.workerSourceURL=URL.createObjectURL(new Blob([c])),this.transcoderBinary=a,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),h=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:h},[h]),l})}),gf>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),gf++}return this.transcoderPending}load(e,t,n,s){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new as(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,a=>{this.parse(a,t,s)},n,s)}parse(e,t,n){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(Af.has(e))return Af.get(e).promise.then(t).catch(n);this._createTexture(e).then(s=>t?t(s):null).catch(n)}_createTextureFrom(e,t){const{type:n,error:s,data:{faces:r,width:a,height:o,format:c,type:l,dfdFlags:h}}=e;if(n==="error")return Promise.reject(s);let u;if(t.faceCount===6)u=new Z_(r,c,l);else{const d=r[0].mipmaps;u=t.layerCount>1?new J_(d,a,o,t.layerCount,c,l):new bl(d,a,o,c,l)}return u.minFilter=r[0].mipmaps.length===1?qt:si,u.magFilter=qt,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=R0(t),u.premultiplyAlpha=!!(h&dT),u}async _createTexture(e,t={}){const n=xT(new Uint8Array(e)),s=n.vkFormat===uf&&n.dataFormatDescriptor[0].colorModel===167;if(!(n.vkFormat===gT||s&&!this.workerConfig.astcHDRSupported))return wT(n);const a=t,o=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:a},[e])).then(c=>this._createTextureFrom(c.data,n));return Af.set(e,{promise:o}),o}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),gf--}}hi.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},hi.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},hi.EngineFormat={RGBAFormat:hn,RGBA_ASTC_4x4_Format:co,RGB_BPTC_UNSIGNED_Format:kc,RGBA_BPTC_Format:ho,RGBA_ETC2_EAC_Format:Pc,RGBA_PVRTC_4BPPV1_Format:Nc,RGBA_S3TC_DXT5_Format:oo,RGB_ETC1_Format:Dc,RGB_ETC2_Format:Lc,RGB_PVRTC_4BPPV1_Format:Fc,RGBA_S3TC_DXT1_Format:ao},hi.EngineType={UnsignedByteType:cn,HalfFloatType:Pn,FloatType:ln},hi.BasisWorker=function(){let i,e,t;const n=_EngineFormat,s=_EngineType,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(p){const m=p.data;switch(m.type){case"init":i=m.config,o(m.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:g,buffers:A,width:_,height:x,hasAlpha:E,format:S,type:w,dfdFlags:I}=c(m.buffer);self.postMessage({type:"transcode",id:m.id,data:{faces:g,width:_,height:x,hasAlpha:E,format:S,type:w,dfdFlags:I}},A)}catch(g){console.error(g),self.postMessage({type:"error",id:m.id,error:g.message})}});break}});function o(p){e=new Promise(m=>{t={wasmBinary:p,onRuntimeInitialized:m},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function c(p){const m=new t.KTX2File(new Uint8Array(p));function g(){m.close(),m.delete()}if(!m.isValid())throw g(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let A;if(m.isUASTC())A=a.UASTC;else if(m.isETC1S())A=a.ETC1S;else if(m.isHDR())A=a.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const _=m.getWidth(),x=m.getHeight(),E=m.getLayers()||1,S=m.getLevels(),w=m.getFaces(),I=m.getHasAlpha(),T=m.getDFDFlags(),{transcoderFormat:C,engineFormat:v,engineType:F}=u(A,_,x,I);if(!_||!x||!S)throw g(),new Error("THREE.KTX2Loader: Invalid texture");if(!m.startTranscoding())throw g(),new Error("THREE.KTX2Loader: .startTranscoding failed");const K=[],q=[];for(let $=0;$<w;$++){const D=[];for(let O=0;O<S;O++){const Y=[];let Q,J;for(let ae=0;ae<E;ae++){const _e=m.getImageLevelInfo(O,ae,$);$===0&&O===0&&ae===0&&(_e.origWidth%4!==0||_e.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),S>1?(Q=_e.origWidth,J=_e.origHeight):(Q=_e.width,J=_e.height);let Me=new Uint8Array(m.getImageTranscodedSizeInBytes(O,ae,0,C));const se=m.transcodeImage(Me,O,ae,$,C,0,-1,-1);if(F===s.HalfFloatType&&(Me=new Uint16Array(Me.buffer,Me.byteOffset,Me.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!se)throw g(),new Error("THREE.KTX2Loader: .transcodeImage failed.");Y.push(Me)}const ee=f(Y);D.push({data:ee,width:Q,height:J}),q.push(ee.buffer)}K.push({mipmaps:D,width:_,height:x,format:v,type:F})}return g(),{faces:K,buffers:q,width:_,height:x,hasAlpha:I,dfdFlags:T,format:v,type:F}}const l=[{if:"astcSupported",basisFormat:[a.UASTC],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],engineType:[s.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],engineType:[s.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.BC1,r.BC3],engineFormat:[n.RGBA_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],engineType:[s.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],engineType:[s.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.ETC1],engineFormat:[n.RGB_ETC1_Format],engineType:[s.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],engineType:[s.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[a.UASTC_HDR],transcoderFormat:[r.BC6H],engineFormat:[n.RGB_BPTC_UNSIGNED_Format],engineType:[s.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.RGBA32,r.RGBA32],engineFormat:[n.RGBAFormat,n.RGBAFormat],engineType:[s.UnsignedByteType,s.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[a.UASTC_HDR],transcoderFormat:[r.RGBA_HALF],engineFormat:[n.RGBAFormat],engineType:[s.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],h={[a.ETC1S]:l.filter(p=>p.basisFormat.includes(a.ETC1S)).sort((p,m)=>p.priorityUASTC-m.priorityUASTC),[a.UASTC]:l.filter(p=>p.basisFormat.includes(a.UASTC)).sort((p,m)=>p.priorityUASTC-m.priorityUASTC),[a.UASTC_HDR]:l.filter(p=>p.basisFormat.includes(a.UASTC_HDR)).sort((p,m)=>p.priorityHDR-m.priorityHDR)};function u(p,m,g,A){const _=h[p];for(let x=0;x<_.length;x++){const E=_[x];if(E.if&&!i[E.if]||!E.basisFormat.includes(p)||A&&E.transcoderFormat.length<2||E.needsPowerOfTwo&&!(d(m)&&d(g)))continue;const S=E.transcoderFormat[A?1:0],w=E.engineFormat[A?1:0],I=E.engineType[0];return{transcoderFormat:S,engineFormat:w,engineType:I}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function d(p){return p<=2?!0:(p&p-1)===0&&p!==0}function f(p){if(p.length===1)return p[0];let m=0;for(let _=0;_<p.length;_++){const x=p[_];m+=x.byteLength}const g=new Uint8Array(m);let A=0;for(let _=0;_<p.length;_++){const x=p[_];g.set(x,A),A+=x.byteLength}return g}};const _T=new Set([hn,ar,ji]),xf={[I0]:hn,[w0]:hn,[b0]:hn,[E0]:hn,[C0]:ar,[_0]:ar,[m0]:ar,[x0]:ar,[v0]:ji,[y0]:ji,[g0]:ji,[A0]:ji,[uf]:co,[M0]:lo,[S0]:lo},bf={[I0]:ln,[w0]:Pn,[b0]:cn,[E0]:cn,[C0]:ln,[_0]:Pn,[m0]:cn,[x0]:cn,[v0]:ln,[y0]:Pn,[g0]:cn,[A0]:cn,[uf]:Pn,[M0]:cn,[S0]:cn};async function wT(i){const{vkFormat:e}=i;if(xf[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;i.supercompressionScheme===f0&&(mf||(mf=new Promise(async r=>{const a=new bT;await a.init(),r(a)})),t=await mf);const n=[];for(let r=0;r<i.levels.length;r++){const a=Math.max(1,i.pixelWidth>>r),o=Math.max(1,i.pixelHeight>>r),c=i.pixelDepth?Math.max(1,i.pixelDepth>>r):0,l=i.levels[r];let h;if(i.supercompressionScheme===uT)h=l.levelData;else if(i.supercompressionScheme===f0)h=t.decode(l.levelData,l.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let u;bf[e]===ln?u=new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):bf[e]===Pn?u=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):u=h,n.push({data:u,width:a,height:o,depth:c})}let s;if(_T.has(xf[e]))s=i.pixelDepth===0?new ol(n[0].data,i.pixelWidth,i.pixelHeight):new pA(n[0].data,i.pixelWidth,i.pixelHeight,i.pixelDepth);else{if(i.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new bl(n,i.pixelWidth,i.pixelHeight),s.minFilter=n.length===1?qt:si,s.magFilter=qt}return s.mipmaps=n,s.type=bf[e],s.format=xf[e],s.colorSpace=R0(i),s.needsUpdate=!0,Promise.resolve(s)}function R0(i){const e=i.dataFormatDescriptor[0];return e.colorPrimaries===pT?e.transferFunction===p0?yt:un:e.colorPrimaries===AT?e.transferFunction===p0?ET:yT:(e.colorPrimaries===fT||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),gi)}const Yl="[default]",Ef={ASSET_GENERATOR:"assetgenerator"},Jl=new hg,F0=`https://unpkg.com/three@0.${vc}.x`,vT=new cT(Jl).setDecoderPath(`${F0}/examples/jsm/libs/draco/gltf/`),CT=new hi(Jl).setTranscoderPath(`${F0}/examples/jsm/libs/basis/`);function N0(i,e){const t=new Set;i.traverse(n=>{if(!n.geometry)return;(Array.isArray(n.material)?n.material:[n.material]).forEach(r=>{r&&!t.has(r.uuid)&&(t.add(r.uuid),e(r))})})}function IT(i){const{state:e,options:t}=i;if(t.preset===Ef.ASSET_GENERATOR){const r=new Fw;r.name="hemi_light",i.scene.add(r),i.lights.push(r);return}const n=new gg(e.ambientColor,e.ambientIntensity);n.name="ambient_light",i.defaultCamera.add(n);const s=new fd(e.directColor,e.directIntensity);s.position.set(.5,0,.866),s.name="main_light",i.defaultCamera.add(s),i.lights.push(n,s)}function ST(i){i.lights.forEach(e=>e.parent.remove(e)),i.lights.length=0}var ui=Uint8Array,Fa=Uint16Array,MT=Int32Array,D0=new ui([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),L0=new ui([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),BT=new ui([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),P0=function(i,e){for(var t=new Fa(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var s=new MT(t[30]),n=1;n<30;++n)for(var r=t[n];r<t[n+1];++r)s[r]=r-t[n]<<5|n;return{b:t,r:s}},k0=P0(D0,2),U0=k0.b,TT=k0.r;U0[28]=258,TT[258]=28;for(var RT=P0(L0,0),FT=RT.b,yf=new Fa(32768),Ot=0;Ot<32768;++Ot){var Ws=(Ot&43690)>>1|(Ot&21845)<<1;Ws=(Ws&52428)>>2|(Ws&13107)<<2,Ws=(Ws&61680)>>4|(Ws&3855)<<4,yf[Ot]=((Ws&65280)>>8|(Ws&255)<<8)>>1}for(var Wo=(function(i,e,t){for(var n=i.length,s=0,r=new Fa(e);s<n;++s)i[s]&&++r[i[s]-1];var a=new Fa(e);for(s=1;s<e;++s)a[s]=a[s-1]+r[s-1]<<1;var o;if(t){o=new Fa(1<<e);var c=15-e;for(s=0;s<n;++s)if(i[s])for(var l=s<<4|i[s],h=e-i[s],u=a[i[s]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)o[yf[u]>>c]=l}else for(o=new Fa(n),s=0;s<n;++s)i[s]&&(o[s]=yf[a[i[s]-1]++]>>15-i[s]);return o}),qo=new ui(288),Ot=0;Ot<144;++Ot)qo[Ot]=8;for(var Ot=144;Ot<256;++Ot)qo[Ot]=9;for(var Ot=256;Ot<280;++Ot)qo[Ot]=7;for(var Ot=280;Ot<288;++Ot)qo[Ot]=8;for(var O0=new ui(32),Ot=0;Ot<32;++Ot)O0[Ot]=5;var NT=Wo(qo,9,1),DT=Wo(O0,5,1),_f=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Ii=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},wf=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},LT=function(i){return(i+7)/8|0},PT=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new ui(i.subarray(e,t))},kT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Si=function(i,e,t){var n=new Error(e||kT[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Si),!t)throw n;return n},UT=function(i,e,t,n){var s=i.length,r=0;if(!s||e.f&&!e.l)return t||new ui(0);var a=!t,o=a||e.i!=2,c=e.i;a&&(t=new ui(s*3));var l=function(Mt){var ft=t.length;if(Mt>ft){var $e=new ui(Math.max(ft*2,Mt));$e.set(t),t=$e}},h=e.f||0,u=e.p||0,d=e.b||0,f=e.l,p=e.d,m=e.m,g=e.n,A=s*8;do{if(!f){h=Ii(i,u,1);var _=Ii(i,u+1,3);if(u+=3,_)if(_==1)f=NT,p=DT,m=9,g=5;else if(_==2){var w=Ii(i,u,31)+257,I=Ii(i,u+10,15)+4,T=w+Ii(i,u+5,31)+1;u+=14;for(var C=new ui(T),v=new ui(19),F=0;F<I;++F)v[BT[F]]=Ii(i,u+F*3,7);u+=I*3;for(var K=_f(v),q=(1<<K)-1,$=Wo(v,K,1),F=0;F<T;){var D=$[Ii(i,u,q)];u+=D&15;var x=D>>4;if(x<16)C[F++]=x;else{var O=0,Y=0;for(x==16?(Y=3+Ii(i,u,3),u+=2,O=C[F-1]):x==17?(Y=3+Ii(i,u,7),u+=3):x==18&&(Y=11+Ii(i,u,127),u+=7);Y--;)C[F++]=O}}var Q=C.subarray(0,w),J=C.subarray(w);m=_f(Q),g=_f(J),f=Wo(Q,m,1),p=Wo(J,g,1)}else Si(1);else{var x=LT(u)+4,E=i[x-4]|i[x-3]<<8,S=x+E;if(S>s){c&&Si(0);break}o&&l(d+E),t.set(i.subarray(x,S),d),e.b=d+=E,e.p=u=S*8,e.f=h;continue}if(u>A){c&&Si(0);break}}o&&l(d+131072);for(var ee=(1<<m)-1,ae=(1<<g)-1,_e=u;;_e=u){var O=f[wf(i,u)&ee],Me=O>>4;if(u+=O&15,u>A){c&&Si(0);break}if(O||Si(2),Me<256)t[d++]=Me;else if(Me==256){_e=u,f=null;break}else{var se=Me-254;if(Me>264){var F=Me-257,me=D0[F];se=Ii(i,u,(1<<me)-1)+U0[F],u+=me}var xe=p[wf(i,u)&ae],be=xe>>4;xe||Si(3),u+=xe&15;var J=FT[be];if(be>3){var me=L0[be];J+=wf(i,u)&(1<<me)-1,u+=me}if(u>A){c&&Si(0);break}o&&l(d+131072);var Ue=d+se;if(d<J){var et=r-J,He=Math.min(J,Ue);for(et+d<0&&Si(3);d<He;++d)t[d]=n[et+d]}for(;d<Ue;++d)t[d]=t[d-J]}}e.l=f,e.p=_e,e.b=d,e.f=h,f&&(h=1,e.m=m,e.d=p,e.n=g)}while(!h);return d!=t.length&&a?PT(t,0,d):t.subarray(0,d)},OT=new ui(0),QT=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Si(6,"invalid zlib data"),(i[1]>>5&1)==1&&Si(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ko(i,e){return UT(i.subarray(QT(i),-4),{i:2},e,e)}var GT=typeof TextDecoder<"u"&&new TextDecoder,HT=0;try{GT.decode(OT,{stream:!0}),HT=1}catch{}class zT extends Rw{constructor(e){super(e),this.type=Pn}parse(e){const C=Math.pow(2.7182818,2.2);function v(b,B){let k=0;for(let R=0;R<65536;++R)(R==0||b[R>>3]&1<<(R&7))&&(B[k++]=R);const y=k-1;for(;k<65536;)B[k++]=0;return y}function F(b){for(let B=0;B<16384;B++)b[B]={},b[B].len=0,b[B].lit=0,b[B].p=null}const K={l:0,c:0,lc:0};function q(b,B,k,y,R){for(;k<b;)B=B<<8|Te(y,R),k+=8;k-=b,K.l=B>>k&(1<<b)-1,K.c=B,K.lc=k}const $=new Array(59);function D(b){for(let k=0;k<=58;++k)$[k]=0;for(let k=0;k<65537;++k)$[b[k]]+=1;let B=0;for(let k=58;k>0;--k){const y=B+$[k]>>1;$[k]=B,B=y}for(let k=0;k<65537;++k){const y=b[k];y>0&&(b[k]=y|$[y]++<<6)}}function O(b,B,k,y,R,N){const U=B;let P=0,z=0;for(;y<=R;y++){if(U.value-B.value>k)return!1;q(6,P,z,b,U);const j=K.l;if(P=K.c,z=K.lc,N[y]=j,j==63){if(U.value-B.value>k)throw new Error("Something wrong with hufUnpackEncTable");q(8,P,z,b,U);let X=K.l+6;if(P=K.c,z=K.lc,y+X>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;X--;)N[y++]=0;y--}else if(j>=59){let X=j-59+2;if(y+X>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;X--;)N[y++]=0;y--}}D(N)}function Y(b){return b&63}function Q(b){return b>>6}function J(b,B,k,y){for(;B<=k;B++){const R=Q(b[B]),N=Y(b[B]);if(R>>N)throw new Error("Invalid table entry");if(N>14){const U=y[R>>N-14];if(U.len)throw new Error("Invalid table entry");if(U.lit++,U.p){const P=U.p;U.p=new Array(U.lit);for(let z=0;z<U.lit-1;++z)U.p[z]=P[z]}else U.p=new Array(1);U.p[U.lit-1]=B}else if(N){let U=0;for(let P=1<<14-N;P>0;P--){const z=y[(R<<14-N)+U];if(z.len||z.p)throw new Error("Invalid table entry");z.len=N,z.lit=B,U++}}}return!0}const ee={c:0,lc:0};function ae(b,B,k,y){b=b<<8|Te(k,y),B+=8,ee.c=b,ee.lc=B}const _e={c:0,lc:0};function Me(b,B,k,y,R,N,U,P,z){if(b==B){y<8&&(ae(k,y,R,N),k=ee.c,y=ee.lc),y-=8;let j=k>>y;if(j=new Uint8Array([j])[0],P.value+j>z)return!1;const X=U[P.value-1];for(;j-- >0;)U[P.value++]=X}else if(P.value<z)U[P.value++]=b;else return!1;_e.c=k,_e.lc=y}function se(b){return b&65535}function me(b){const B=se(b);return B>32767?B-65536:B}const xe={a:0,b:0};function be(b,B){const k=me(b),R=me(B),N=k+(R&1)+(R>>1),U=N,P=N-R;xe.a=U,xe.b=P}function Ue(b,B){const k=se(b),y=se(B),R=k-(y>>1)&65535,N=y+R-32768&65535;xe.a=N,xe.b=R}function et(b,B,k,y,R,N,U){const P=U<16384,z=k>R?R:k;let j=1,X,ie;for(;j<=z;)j<<=1;for(j>>=1,X=j,j>>=1;j>=1;){ie=0;const he=ie+N*(R-X),ce=N*j,fe=N*X,ge=y*j,ye=y*X;let Pe,je,Ve,Le;for(;ie<=he;ie+=fe){let rt=ie;const ke=ie+y*(k-X);for(;rt<=ke;rt+=ye){const It=rt+ge,mn=rt+ce,vt=mn+ge;P?(be(b[rt+B],b[mn+B]),Pe=xe.a,Ve=xe.b,be(b[It+B],b[vt+B]),je=xe.a,Le=xe.b,be(Pe,je),b[rt+B]=xe.a,b[It+B]=xe.b,be(Ve,Le),b[mn+B]=xe.a,b[vt+B]=xe.b):(Ue(b[rt+B],b[mn+B]),Pe=xe.a,Ve=xe.b,Ue(b[It+B],b[vt+B]),je=xe.a,Le=xe.b,Ue(Pe,je),b[rt+B]=xe.a,b[It+B]=xe.b,Ue(Ve,Le),b[mn+B]=xe.a,b[vt+B]=xe.b)}if(k&j){const It=rt+ce;P?be(b[rt+B],b[It+B]):Ue(b[rt+B],b[It+B]),Pe=xe.a,b[It+B]=xe.b,b[rt+B]=Pe}}if(R&j){let rt=ie;const ke=ie+y*(k-X);for(;rt<=ke;rt+=ye){const It=rt+ge;P?be(b[rt+B],b[It+B]):Ue(b[rt+B],b[It+B]),Pe=xe.a,b[It+B]=xe.b,b[rt+B]=Pe}}X=j,j>>=1}return ie}function He(b,B,k,y,R,N,U,P,z){let j=0,X=0;const ie=U,he=Math.trunc(y.value+(R+7)/8);for(;y.value<he;)for(ae(j,X,k,y),j=ee.c,X=ee.lc;X>=14;){const fe=j>>X-14&16383,ge=B[fe];if(ge.len)X-=ge.len,Me(ge.lit,N,j,X,k,y,P,z,ie),j=_e.c,X=_e.lc;else{if(!ge.p)throw new Error("hufDecode issues");let ye;for(ye=0;ye<ge.lit;ye++){const Pe=Y(b[ge.p[ye]]);for(;X<Pe&&y.value<he;)ae(j,X,k,y),j=ee.c,X=ee.lc;if(X>=Pe&&Q(b[ge.p[ye]])==(j>>X-Pe&(1<<Pe)-1)){X-=Pe,Me(ge.p[ye],N,j,X,k,y,P,z,ie),j=_e.c,X=_e.lc;break}}if(ye==ge.lit)throw new Error("hufDecode issues")}}const ce=8-R&7;for(j>>=ce,X-=ce;X>0;){const fe=B[j<<14-X&16383];if(fe.len)X-=fe.len,Me(fe.lit,N,j,X,k,y,P,z,ie),j=_e.c,X=_e.lc;else throw new Error("hufDecode issues")}return!0}function Mt(b,B,k,y,R,N){const U={value:0},P=k.value,z=Ge(B,k),j=Ge(B,k);k.value+=4;const X=Ge(B,k);if(k.value+=4,z<0||z>=65537||j<0||j>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const ie=new Array(65537),he=new Array(16384);F(he);const ce=y-(k.value-P);if(O(b,k,ce,z,j,ie),X>8*(y-(k.value-P)))throw new Error("Something wrong with hufUncompress");J(ie,z,j,he),He(ie,he,b,k,X,j,N,R,U)}function ft(b,B,k){for(let y=0;y<k;++y)B[y]=b[B[y]]}function $e(b){for(let B=1;B<b.length;B++){const k=b[B-1]+b[B]-128;b[B]=k}}function H(b,B){let k=0,y=Math.floor((b.length+1)/2),R=0;const N=b.length-1;for(;!(R>N||(B[R++]=b[k++],R>N));)B[R++]=b[y++]}function wn(b){let B=b.byteLength;const k=new Array;let y=0;const R=new DataView(b);for(;B>0;){const N=R.getInt8(y++);if(N<0){const U=-N;B-=U+1;for(let P=0;P<U;P++)k.push(R.getUint8(y++))}else{const U=N;B-=2;const P=R.getUint8(y++);for(let z=0;z<U+1;z++)k.push(P)}}return k}function pt(b,B,k,y,R,N){let U=new DataView(N.buffer);const P=k[b.idx[0]].width,z=k[b.idx[0]].height,j=3,X=Math.floor(P/8),ie=Math.ceil(P/8),he=Math.ceil(z/8),ce=P-(ie-1)*8,fe=z-(he-1)*8,ge={value:0},ye=new Array(j),Pe=new Array(j),je=new Array(j),Ve=new Array(j),Le=new Array(j);for(let ke=0;ke<j;++ke)Le[ke]=B[b.idx[ke]],ye[ke]=ke<1?0:ye[ke-1]+ie*he,Pe[ke]=new Float32Array(64),je[ke]=new Uint16Array(64),Ve[ke]=new Uint16Array(ie*64);for(let ke=0;ke<he;++ke){let It=8;ke==he-1&&(It=fe);let mn=8;for(let Et=0;Et<ie;++Et){Et==ie-1&&(mn=ce);for(let Xe=0;Xe<j;++Xe)je[Xe].fill(0),je[Xe][0]=R[ye[Xe]++],mt(ge,y,je[Xe]),We(je[Xe],Pe[Xe]),Dt(Pe[Xe]);ze(Pe);for(let Xe=0;Xe<j;++Xe)L(Pe[Xe],Ve[Xe],Et*64)}let vt=0;for(let Et=0;Et<j;++Et){const Xe=k[b.idx[Et]].type;for(let Xt=8*ke;Xt<8*ke+It;++Xt){vt=Le[Et][Xt];for(let Cn=0;Cn<X;++Cn){const Ut=Cn*64+(Xt&7)*8;U.setUint16(vt+0*Xe,Ve[Et][Ut+0],!0),U.setUint16(vt+2*Xe,Ve[Et][Ut+1],!0),U.setUint16(vt+4*Xe,Ve[Et][Ut+2],!0),U.setUint16(vt+6*Xe,Ve[Et][Ut+3],!0),U.setUint16(vt+8*Xe,Ve[Et][Ut+4],!0),U.setUint16(vt+10*Xe,Ve[Et][Ut+5],!0),U.setUint16(vt+12*Xe,Ve[Et][Ut+6],!0),U.setUint16(vt+14*Xe,Ve[Et][Ut+7],!0),vt+=16*Xe}}if(X!=ie)for(let Xt=8*ke;Xt<8*ke+It;++Xt){const Cn=Le[Et][Xt]+8*X*2*Xe,Ut=X*64+(Xt&7)*8;for(let xn=0;xn<mn;++xn)U.setUint16(Cn+xn*2*Xe,Ve[Et][Ut+xn],!0)}}}const rt=new Uint16Array(P);U=new DataView(N.buffer);for(let ke=0;ke<j;++ke){k[b.idx[ke]].decoded=!0;const It=k[b.idx[ke]].type;if(k[ke].type==2)for(let mn=0;mn<z;++mn){const vt=Le[ke][mn];for(let Et=0;Et<P;++Et)rt[Et]=U.getUint16(vt+Et*2*It,!0);for(let Et=0;Et<P;++Et)U.setFloat32(vt+Et*2*It,ne(rt[Et]),!0)}}}function mt(b,B,k){let y,R=1;for(;R<64;)y=B[b.value],y==65280?R=64:y>>8==255?R+=y&255:(k[R]=y,R++),b.value++}function We(b,B){B[0]=ne(b[0]),B[1]=ne(b[1]),B[2]=ne(b[5]),B[3]=ne(b[6]),B[4]=ne(b[14]),B[5]=ne(b[15]),B[6]=ne(b[27]),B[7]=ne(b[28]),B[8]=ne(b[2]),B[9]=ne(b[4]),B[10]=ne(b[7]),B[11]=ne(b[13]),B[12]=ne(b[16]),B[13]=ne(b[26]),B[14]=ne(b[29]),B[15]=ne(b[42]),B[16]=ne(b[3]),B[17]=ne(b[8]),B[18]=ne(b[12]),B[19]=ne(b[17]),B[20]=ne(b[25]),B[21]=ne(b[30]),B[22]=ne(b[41]),B[23]=ne(b[43]),B[24]=ne(b[9]),B[25]=ne(b[11]),B[26]=ne(b[18]),B[27]=ne(b[24]),B[28]=ne(b[31]),B[29]=ne(b[40]),B[30]=ne(b[44]),B[31]=ne(b[53]),B[32]=ne(b[10]),B[33]=ne(b[19]),B[34]=ne(b[23]),B[35]=ne(b[32]),B[36]=ne(b[39]),B[37]=ne(b[45]),B[38]=ne(b[52]),B[39]=ne(b[54]),B[40]=ne(b[20]),B[41]=ne(b[22]),B[42]=ne(b[33]),B[43]=ne(b[38]),B[44]=ne(b[46]),B[45]=ne(b[51]),B[46]=ne(b[55]),B[47]=ne(b[60]),B[48]=ne(b[21]),B[49]=ne(b[34]),B[50]=ne(b[37]),B[51]=ne(b[47]),B[52]=ne(b[50]),B[53]=ne(b[56]),B[54]=ne(b[59]),B[55]=ne(b[61]),B[56]=ne(b[35]),B[57]=ne(b[36]),B[58]=ne(b[48]),B[59]=ne(b[49]),B[60]=ne(b[57]),B[61]=ne(b[58]),B[62]=ne(b[62]),B[63]=ne(b[63])}function Dt(b){const B=.5*Math.cos(.7853975),k=.5*Math.cos(3.14159/16),y=.5*Math.cos(3.14159/8),R=.5*Math.cos(3*3.14159/16),N=.5*Math.cos(5*3.14159/16),U=.5*Math.cos(3*3.14159/8),P=.5*Math.cos(7*3.14159/16),z=new Array(4),j=new Array(4),X=new Array(4),ie=new Array(4);for(let he=0;he<8;++he){const ce=he*8;z[0]=y*b[ce+2],z[1]=U*b[ce+2],z[2]=y*b[ce+6],z[3]=U*b[ce+6],j[0]=k*b[ce+1]+R*b[ce+3]+N*b[ce+5]+P*b[ce+7],j[1]=R*b[ce+1]-P*b[ce+3]-k*b[ce+5]-N*b[ce+7],j[2]=N*b[ce+1]-k*b[ce+3]+P*b[ce+5]+R*b[ce+7],j[3]=P*b[ce+1]-N*b[ce+3]+R*b[ce+5]-k*b[ce+7],X[0]=B*(b[ce+0]+b[ce+4]),X[3]=B*(b[ce+0]-b[ce+4]),X[1]=z[0]+z[3],X[2]=z[1]-z[2],ie[0]=X[0]+X[1],ie[1]=X[3]+X[2],ie[2]=X[3]-X[2],ie[3]=X[0]-X[1],b[ce+0]=ie[0]+j[0],b[ce+1]=ie[1]+j[1],b[ce+2]=ie[2]+j[2],b[ce+3]=ie[3]+j[3],b[ce+4]=ie[3]-j[3],b[ce+5]=ie[2]-j[2],b[ce+6]=ie[1]-j[1],b[ce+7]=ie[0]-j[0]}for(let he=0;he<8;++he)z[0]=y*b[16+he],z[1]=U*b[16+he],z[2]=y*b[48+he],z[3]=U*b[48+he],j[0]=k*b[8+he]+R*b[24+he]+N*b[40+he]+P*b[56+he],j[1]=R*b[8+he]-P*b[24+he]-k*b[40+he]-N*b[56+he],j[2]=N*b[8+he]-k*b[24+he]+P*b[40+he]+R*b[56+he],j[3]=P*b[8+he]-N*b[24+he]+R*b[40+he]-k*b[56+he],X[0]=B*(b[he]+b[32+he]),X[3]=B*(b[he]-b[32+he]),X[1]=z[0]+z[3],X[2]=z[1]-z[2],ie[0]=X[0]+X[1],ie[1]=X[3]+X[2],ie[2]=X[3]-X[2],ie[3]=X[0]-X[1],b[0+he]=ie[0]+j[0],b[8+he]=ie[1]+j[1],b[16+he]=ie[2]+j[2],b[24+he]=ie[3]+j[3],b[32+he]=ie[3]-j[3],b[40+he]=ie[2]-j[2],b[48+he]=ie[1]-j[1],b[56+he]=ie[0]-j[0]}function ze(b){for(let B=0;B<64;++B){const k=b[0][B],y=b[1][B],R=b[2][B];b[0][B]=k+1.5747*R,b[1][B]=k-.1873*y-.4682*R,b[2][B]=k+1.8556*y}}function L(b,B,k){for(let y=0;y<64;++y)B[k+y]=IA.toHalfFloat(M(b[y]))}function M(b){return b<=1?Math.sign(b)*Math.pow(Math.abs(b),2.2):Math.sign(b)*Math.pow(C,Math.abs(b)-1)}function Z(b){return new DataView(b.array.buffer,b.offset.value,b.size)}function le(b){const B=b.viewer.buffer.slice(b.offset.value,b.offset.value+b.size),k=new Uint8Array(wn(B)),y=new Uint8Array(k.length);return $e(k),H(k,y),new DataView(y.buffer)}function Ae(b){const B=b.array.slice(b.offset.value,b.offset.value+b.size),k=Ko(B),y=new Uint8Array(k.length);return $e(k),H(k,y),new DataView(y.buffer)}function oe(b){const B=b.viewer,k={value:b.offset.value},y=new Uint16Array(b.columns*b.lines*(b.inputChannels.length*b.type)),R=new Uint8Array(8192);let N=0;const U=new Array(b.inputChannels.length);for(let fe=0,ge=b.inputChannels.length;fe<ge;fe++)U[fe]={},U[fe].start=N,U[fe].end=U[fe].start,U[fe].nx=b.columns,U[fe].ny=b.lines,U[fe].size=b.type,N+=U[fe].nx*U[fe].ny*U[fe].size;const P=re(B,k),z=re(B,k);if(z>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(P<=z)for(let fe=0;fe<z-P+1;fe++)R[fe+P]=nt(B,k);const j=new Uint16Array(65536),X=v(R,j),ie=Ge(B,k);Mt(b.array,B,k,ie,y,N);for(let fe=0;fe<b.inputChannels.length;++fe){const ge=U[fe];for(let ye=0;ye<U[fe].size;++ye)et(y,ge.start+ye,ge.nx,ge.size,ge.ny,ge.nx*ge.size,X)}ft(j,y,N);let he=0;const ce=new Uint8Array(y.buffer.byteLength);for(let fe=0;fe<b.lines;fe++)for(let ge=0;ge<b.inputChannels.length;ge++){const ye=U[ge],Pe=ye.nx*ye.size,je=new Uint8Array(y.buffer,ye.end*2,Pe*2);ce.set(je,he),he+=Pe*2,ye.end+=Pe}return new DataView(ce.buffer)}function Qe(b){const B=b.array.slice(b.offset.value,b.offset.value+b.size),k=Ko(B),y=b.inputChannels.length*b.lines*b.columns*b.totalBytes,R=new ArrayBuffer(y),N=new DataView(R);let U=0,P=0;const z=new Array(4);for(let j=0;j<b.lines;j++)for(let X=0;X<b.inputChannels.length;X++){let ie=0;switch(b.inputChannels[X].pixelType){case 1:z[0]=U,z[1]=z[0]+b.columns,U=z[1]+b.columns;for(let ce=0;ce<b.columns;++ce){const fe=k[z[0]++]<<8|k[z[1]++];ie+=fe,N.setUint16(P,ie,!0),P+=2}break;case 2:z[0]=U,z[1]=z[0]+b.columns,z[2]=z[1]+b.columns,U=z[2]+b.columns;for(let ce=0;ce<b.columns;++ce){const fe=k[z[0]++]<<24|k[z[1]++]<<16|k[z[2]++]<<8;ie+=fe,N.setUint32(P,ie,!0),P+=4}break}}return N}function ve(b){const B=b.viewer,k={value:b.offset.value},y=new Uint8Array(b.columns*b.lines*(b.inputChannels.length*b.type*2)),R={version:Ke(B,k),unknownUncompressedSize:Ke(B,k),unknownCompressedSize:Ke(B,k),acCompressedSize:Ke(B,k),dcCompressedSize:Ke(B,k),rleCompressedSize:Ke(B,k),rleUncompressedSize:Ke(B,k),rleRawSize:Ke(B,k),totalAcUncompressedCount:Ke(B,k),totalDcUncompressedCount:Ke(B,k),acCompression:Ke(B,k)};if(R.version<2)throw new Error("EXRLoader.parse: "+vs.compression+" version "+R.version+" is unsupported");const N=new Array;let U=re(B,k)-2;for(;U>0;){const ge=qe(B.buffer,k),ye=nt(B,k),Pe=ye>>2&3,je=(ye>>4)-1,Ve=new Int8Array([je])[0],Le=nt(B,k);N.push({name:ge,index:Ve,type:Le,compression:Pe}),U-=ge.length+3}const P=vs.channels,z=new Array(b.inputChannels.length);for(let ge=0;ge<b.inputChannels.length;++ge){const ye=z[ge]={},Pe=P[ge];ye.name=Pe.name,ye.compression=0,ye.decoded=!1,ye.type=Pe.pixelType,ye.pLinear=Pe.pLinear,ye.width=b.columns,ye.height=b.lines}const j={idx:new Array(3)};for(let ge=0;ge<b.inputChannels.length;++ge){const ye=z[ge];for(let Pe=0;Pe<N.length;++Pe){const je=N[Pe];ye.name==je.name&&(ye.compression=je.compression,je.index>=0&&(j.idx[je.index]=ge),ye.offset=ge)}}let X,ie,he;if(R.acCompressedSize>0)switch(R.acCompression){case 0:X=new Uint16Array(R.totalAcUncompressedCount),Mt(b.array,B,k,R.acCompressedSize,X,R.totalAcUncompressedCount);break;case 1:const ge=b.array.slice(k.value,k.value+R.totalAcUncompressedCount),ye=Ko(ge);X=new Uint16Array(ye.buffer),k.value+=R.totalAcUncompressedCount;break}if(R.dcCompressedSize>0){const ge={array:b.array,offset:k,size:R.dcCompressedSize};ie=new Uint16Array(Ae(ge).buffer),k.value+=R.dcCompressedSize}if(R.rleRawSize>0){const ge=b.array.slice(k.value,k.value+R.rleCompressedSize),ye=Ko(ge);he=wn(ye.buffer),k.value+=R.rleCompressedSize}let ce=0;const fe=new Array(z.length);for(let ge=0;ge<fe.length;++ge)fe[ge]=new Array;for(let ge=0;ge<b.lines;++ge)for(let ye=0;ye<z.length;++ye)fe[ye].push(ce),ce+=z[ye].width*b.type*2;pt(j,fe,z,X,ie,y);for(let ge=0;ge<z.length;++ge){const ye=z[ge];if(!ye.decoded)switch(ye.compression){case 2:let Pe=0,je=0;for(let Ve=0;Ve<b.lines;++Ve){let Le=fe[ge][Pe];for(let rt=0;rt<ye.width;++rt){for(let ke=0;ke<2*ye.type;++ke)y[Le++]=he[je+ke*ye.width*ye.height];je++}Pe++}break;default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(y.buffer)}function qe(b,B){const k=new Uint8Array(b);let y=0;for(;k[B.value+y]!=0;)y+=1;const R=new TextDecoder().decode(k.slice(B.value,B.value+y));return B.value=B.value+y+1,R}function Ze(b,B,k){const y=new TextDecoder().decode(new Uint8Array(b).slice(B.value,B.value+k));return B.value=B.value+k,y}function Ee(b,B){const k=Oe(b,B),y=Ge(b,B);return[k,y]}function De(b,B){const k=Ge(b,B),y=Ge(b,B);return[k,y]}function Oe(b,B){const k=b.getInt32(B.value,!0);return B.value=B.value+4,k}function Ge(b,B){const k=b.getUint32(B.value,!0);return B.value=B.value+4,k}function Te(b,B){const k=b[B.value];return B.value=B.value+1,k}function nt(b,B){const k=b.getUint8(B.value);return B.value=B.value+1,k}const Ke=function(b,B){let k;return"getBigInt64"in DataView.prototype?k=Number(b.getBigInt64(B.value,!0)):k=b.getUint32(B.value+4,!0)+Number(b.getUint32(B.value,!0)<<32),B.value+=8,k};function it(b,B){const k=b.getFloat32(B.value,!0);return B.value+=4,k}function W(b,B){return IA.toHalfFloat(it(b,B))}function ne(b){const B=(b&31744)>>10,k=b&1023;return(b>>15?-1:1)*(B?B===31?k?NaN:1/0:Math.pow(2,B-15)*(1+k/1024):6103515625e-14*(k/1024))}function re(b,B){const k=b.getUint16(B.value,!0);return B.value+=2,k}function de(b,B){return ne(re(b,B))}function Se(b,B,k,y){const R=k.value,N=[];for(;k.value<R+y-1;){const U=qe(B,k),P=Oe(b,k),z=nt(b,k);k.value+=3;const j=Oe(b,k),X=Oe(b,k);N.push({name:U,pixelType:P,pLinear:z,xSampling:j,ySampling:X})}return k.value+=1,N}function Ie(b,B){const k=it(b,B),y=it(b,B),R=it(b,B),N=it(b,B),U=it(b,B),P=it(b,B),z=it(b,B),j=it(b,B);return{redX:k,redY:y,greenX:R,greenY:N,blueX:U,blueY:P,whiteX:z,whiteY:j}}function st(b,B){const k=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],y=nt(b,B);return k[y]}function Ht(b,B){const k=Oe(b,B),y=Oe(b,B),R=Oe(b,B),N=Oe(b,B);return{xMin:k,yMin:y,xMax:R,yMax:N}}function vn(b,B){const k=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],y=nt(b,B);return k[y]}function Ct(b,B){const k=["ENVMAP_LATLONG","ENVMAP_CUBE"],y=nt(b,B);return k[y]}function ii(b,B){const k=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],y=["ROUND_DOWN","ROUND_UP"],R=Ge(b,B),N=Ge(b,B),U=nt(b,B);return{xSize:R,ySize:N,levelMode:k[U&15],roundingMode:y[U>>4]}}function Di(b,B){const k=it(b,B),y=it(b,B);return[k,y]}function Uh(b,B){const k=it(b,B),y=it(b,B),R=it(b,B);return[k,y,R]}function Oh(b,B,k,y,R){if(y==="string"||y==="stringvector"||y==="iccProfile")return Ze(B,k,R);if(y==="chlist")return Se(b,B,k,R);if(y==="chromaticities")return Ie(b,k);if(y==="compression")return st(b,k);if(y==="box2i")return Ht(b,k);if(y==="envmap")return Ct(b,k);if(y==="tiledesc")return ii(b,k);if(y==="lineOrder")return vn(b,k);if(y==="float")return it(b,k);if(y==="v2f")return Di(b,k);if(y==="v3f")return Uh(b,k);if(y==="int")return Oe(b,k);if(y==="rational")return Ee(b,k);if(y==="timecode")return De(b,k);if(y==="preview")return k.value+=R,"skipped";k.value+=R}function ws(b,B){const k=Math.log2(b);return B=="ROUND_DOWN"?Math.floor(k):Math.ceil(k)}function Ec(b,B,k){let y=0;switch(b.levelMode){case"ONE_LEVEL":y=1;break;case"MIPMAP_LEVELS":y=ws(Math.max(B,k),b.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return y}function yc(b,B,k,y){const R=new Array(b);for(let N=0;N<b;N++){const U=1<<N;let P=B/U|0;y=="ROUND_UP"&&P*U<B&&(P+=1);const z=Math.max(P,1);R[N]=(z+k-1)/k|0}return R}function Qh(){const b=this,B=b.offset,k={value:0};for(let y=0;y<b.tileCount;y++){const R=Oe(b.viewer,B),N=Oe(b.viewer,B);B.value+=8,b.size=Ge(b.viewer,B);const U=R*b.blockWidth,P=N*b.blockHeight;b.columns=U+b.blockWidth>b.width?b.width-U:b.blockWidth,b.lines=P+b.blockHeight>b.height?b.height-P:b.blockHeight;const z=b.columns*b.totalBytes,X=b.size<b.lines*z?b.uncompress(b):Z(b);B.value+=b.size;for(let ie=0;ie<b.lines;ie++){const he=ie*b.columns*b.totalBytes;for(let ce=0;ce<b.inputChannels.length;ce++){const fe=vs.channels[ce].name,ge=b.channelByteOffsets[fe]*b.columns,ye=b.decodeChannels[fe];if(ye===void 0)continue;k.value=he+ge;const Pe=(b.height-(1+P+ie))*b.outLineWidth;for(let je=0;je<b.columns;je++){const Ve=Pe+(je+U)*b.outputChannels+ye;b.byteArray[Ve]=b.getter(X,k)}}}}}function $a(){const b=this,B=b.offset,k={value:0};for(let y=0;y<b.height/b.blockHeight;y++){const R=Oe(b.viewer,B)-vs.dataWindow.yMin;b.size=Ge(b.viewer,B),b.lines=R+b.blockHeight>b.height?b.height-R:b.blockHeight;const N=b.columns*b.totalBytes,P=b.size<b.lines*N?b.uncompress(b):Z(b);B.value+=b.size;for(let z=0;z<b.blockHeight;z++){const j=y*b.blockHeight,X=z+b.scanOrder(j);if(X>=b.height)continue;const ie=z*N,he=(b.height-1-X)*b.outLineWidth;for(let ce=0;ce<b.inputChannels.length;ce++){const fe=vs.channels[ce].name,ge=b.channelByteOffsets[fe]*b.columns,ye=b.decodeChannels[fe];if(ye!==void 0){k.value=ie+ge;for(let Pe=0;Pe<b.columns;Pe++){const je=he+Pe*b.outputChannels+ye;b.byteArray[je]=b.getter(P,k)}}}}}}function Gh(b,B,k){const y={};if(b.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");y.version=b.getUint8(4);const R=b.getUint8(5);y.spec={singleTile:!!(R&2),longName:!!(R&4),deepFormat:!!(R&8),multiPart:!!(R&16)},k.value=8;let N=!0;for(;N;){const U=qe(B,k);if(U==="")N=!1;else{const P=qe(B,k),z=Ge(b,k),j=Oh(b,B,k,P,z);j===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`):y[U]=j}}if((R&-7)!=0)throw console.error("THREE.EXRHeader:",y),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return y}function eo(b,B,k,y,R){const N={size:0,viewer:B,array:k,offset:y,width:b.dataWindow.xMax-b.dataWindow.xMin+1,height:b.dataWindow.yMax-b.dataWindow.yMin+1,inputChannels:b.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:un};switch(b.compression){case"NO_COMPRESSION":N.blockHeight=1,N.uncompress=Z;break;case"RLE_COMPRESSION":N.blockHeight=1,N.uncompress=le;break;case"ZIPS_COMPRESSION":N.blockHeight=1,N.uncompress=Ae;break;case"ZIP_COMPRESSION":N.blockHeight=16,N.uncompress=Ae;break;case"PIZ_COMPRESSION":N.blockHeight=32,N.uncompress=oe;break;case"PXR24_COMPRESSION":N.blockHeight=16,N.uncompress=Qe;break;case"DWAA_COMPRESSION":N.blockHeight=32,N.uncompress=ve;break;case"DWAB_COMPRESSION":N.blockHeight=256,N.uncompress=ve;break;default:throw new Error("EXRLoader.parse: "+b.compression+" is unsupported")}const U={};for(const X of b.channels)switch(X.name){case"Y":case"R":case"G":case"B":case"A":U[X.name]=!0,N.type=X.pixelType}let P=!1;if(U.R&&U.G&&U.B)P=!U.A,N.outputChannels=4,N.decodeChannels={R:0,G:1,B:2,A:3};else if(U.Y)N.outputChannels=1,N.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(N.type==1)switch(R){case ln:N.getter=de;break;case Pn:N.getter=re;break}else if(N.type==2)switch(R){case ln:N.getter=it;break;case Pn:N.getter=W}else throw new Error("EXRLoader.parse: unsupported pixelType "+N.type+" for "+b.compression+".");N.columns=N.width;const z=N.width*N.height*N.outputChannels;switch(R){case ln:N.byteArray=new Float32Array(z),P&&N.byteArray.fill(1,0,z);break;case Pn:N.byteArray=new Uint16Array(z),P&&N.byteArray.fill(15360,0,z);break;default:console.error("THREE.EXRLoader: unsupported type: ",R);break}let j=0;for(const X of b.channels)N.decodeChannels[X.name]!==void 0&&(N.channelByteOffsets[X.name]=j),j+=X.pixelType*2;if(N.totalBytes=j,N.outLineWidth=N.width*N.outputChannels,b.lineOrder==="INCREASING_Y"?N.scanOrder=X=>X:N.scanOrder=X=>N.height-1-X,N.outputChannels==4?(N.format=hn,N.colorSpace=un):(N.format=ji,N.colorSpace=gi),b.spec.singleTile){N.blockHeight=b.tiles.ySize,N.blockWidth=b.tiles.xSize;const X=Ec(b.tiles,N.width,N.height),ie=yc(X,N.width,b.tiles.xSize,b.tiles.roundingMode),he=yc(X,N.height,b.tiles.ySize,b.tiles.roundingMode);N.tileCount=ie[0]*he[0];for(let ce=0;ce<X;ce++)for(let fe=0;fe<he[ce];fe++)for(let ge=0;ge<ie[ce];ge++)Ke(B,y);N.decode=Qh.bind(N)}else{N.blockWidth=N.width;const X=Math.ceil(N.height/N.blockHeight);for(let ie=0;ie<X;ie++)Ke(B,y);N.decode=$a.bind(N)}return N}const _c={value:0},wc=new DataView(e),Op=new Uint8Array(e),vs=Gh(wc,e,_c),tr=eo(vs,wc,Op,_c,this.type);return tr.decode(),{header:vs,width:tr.width,height:tr.height,data:tr.byteArray,format:tr.format,colorSpace:tr.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,s){function r(a,o){a.colorSpace=o.colorSpace,a.minFilter=qt,a.magFilter=qt,a.generateMipmaps=!1,a.flipY=!1,t&&t(a,o)}return super.load(e,r,n,s)}}function VT(i,e){const{id:t,path:n}=e;return t==="neutral"?Promise.resolve({envMap:i.neutralEnvironment}):t===""?Promise.resolve({envMap:null}):new Promise((s,r)=>{new zT().load(n,a=>{const o=i.pmremGenerator.fromEquirectangular(a).texture;a.dispose(),i._loadedEnvironment&&i._loadedEnvironment!==o&&i._loadedEnvironment.dispose(),i._loadedEnvironment=o,s({envMap:o})},void 0,r)})}function WT(i){i.renderer.render(i.scene,i.activeCamera),i.renderer.domElement.toBlob(e=>{if(!e)return;const t=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),n=URL.createObjectURL(e),s=document.createElement("a");s.download=`3d-screenshot-${t}.png`,s.href=n,s.click(),URL.revokeObjectURL(n)},"image/png"),qT(i)}function qT(i){const e=document.createElement("div");e.className="screenshot-flash",i.el.appendChild(e),e.addEventListener("animationend",()=>e.remove())}function KT(i,e){i.mixer&&(i.mixer.stopAllAction(),i.mixer.uncacheRoot(i.mixer.getRoot()),i.mixer=null),i.clips=e,e.length&&(i.mixer=new mg(i.content))}function jT(i){i.clips.forEach(e=>{i.mixer.clipAction(e).reset().play(),i.state.actionStates[e.name]=!0}),i.invalidate()}function Q0(i,e,t){const n=t.length-i-1;if(e>=t[n])return n-1;if(e<=t[i])return i;let s=i,r=n,a=Math.floor((s+r)/2);for(;e<t[a]||e>=t[a+1];)e<t[a]?r=a:s=a,a=Math.floor((s+r)/2);return a}function XT(i,e,t,n){const s=[],r=[],a=[];s[0]=1;for(let o=1;o<=t;++o){r[o]=e-n[i+1-o],a[o]=n[i+o]-e;let c=0;for(let l=0;l<o;++l){const h=a[l+1],u=r[o-l],d=s[l]/(h+u);s[l]=c+h*d,c=u*d}s[o]=c}return s}function YT(i,e,t,n){const s=Q0(i,n,e),r=XT(s,n,i,e),a=new gt(0,0,0,0);for(let o=0;o<=i;++o){const c=t[s-i+o],l=r[o],h=c.w*l;a.x+=c.x*h,a.y+=c.y*h,a.z+=c.z*h,a.w+=c.w*l}return a}function JT(i,e,t,n,s){const r=[];for(let u=0;u<=t;++u)r[u]=0;const a=[];for(let u=0;u<=n;++u)a[u]=r.slice(0);const o=[];for(let u=0;u<=t;++u)o[u]=r.slice(0);o[0][0]=1;const c=r.slice(0),l=r.slice(0);for(let u=1;u<=t;++u){c[u]=e-s[i+1-u],l[u]=s[i+u]-e;let d=0;for(let f=0;f<u;++f){const p=l[f+1],m=c[u-f];o[u][f]=p+m;const g=o[f][u-1]/o[u][f];o[f][u]=d+p*g,d=m*g}o[u][u]=d}for(let u=0;u<=t;++u)a[0][u]=o[u][t];for(let u=0;u<=t;++u){let d=0,f=1;const p=[];for(let m=0;m<=t;++m)p[m]=r.slice(0);p[0][0]=1;for(let m=1;m<=n;++m){let g=0;const A=u-m,_=t-m;u>=m&&(p[f][0]=p[d][0]/o[_+1][A],g=p[f][0]*o[A][_]);const x=A>=-1?1:-A,E=u-1<=_?m-1:t-u;for(let w=x;w<=E;++w)p[f][w]=(p[d][w]-p[d][w-1])/o[_+1][A+w],g+=p[f][w]*o[A+w][_];u<=_&&(p[f][m]=-p[d][m-1]/o[_+1][u],g+=p[f][m]*o[u][_]),a[m][u]=g;const S=d;d=f,f=S}}let h=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)a[u][d]*=h;h*=t-u}return a}function ZT(i,e,t,n,s){const r=s<i?s:i,a=[],o=Q0(i,n,e),c=JT(o,n,i,r,e),l=[];for(let h=0;h<t.length;++h){const u=t[h].clone(),d=u.w;u.x*=d,u.y*=d,u.z*=d,l[h]=u}for(let h=0;h<=r;++h){const u=l[o-i].clone().multiplyScalar(c[h][0]);for(let d=1;d<=i;++d)u.add(l[o-i+d].clone().multiplyScalar(c[h][d]));a[h]=u}for(let h=r+1;h<=s+1;++h)a[h]=new gt(0,0,0);return a}function $T(i,e){let t=1;for(let s=2;s<=i;++s)t*=s;let n=1;for(let s=2;s<=e;++s)n*=s;for(let s=2;s<=i-e;++s)n*=s;return t/n}function eR(i){const e=i.length,t=[],n=[];for(let r=0;r<e;++r){const a=i[r];t[r]=new G(a.x,a.y,a.z),n[r]=a.w}const s=[];for(let r=0;r<e;++r){const a=t[r].clone();for(let o=1;o<=r;++o)a.sub(s[r-o].clone().multiplyScalar($T(r,o)*n[o]));s[r]=a.divideScalar(n[0])}return s}function tR(i,e,t,n,s){const r=ZT(i,e,t,n,s);return eR(r)}class nR extends $_{constructor(e,t,n,s,r){super();const a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=s||0,this.endKnot=r||a;for(let c=0;c<o;++c){const l=n[c];this.controlPoints[c]=new gt(l.x,l.y,l.z,l.w)}}getPoint(e,t=new G){const n=t,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=YT(this.degree,this.knots,this.controlPoints,s);return r.w!==1&&r.divideScalar(r.w),n.set(r.x,r.y,r.z)}getTangent(e,t=new G){const n=t,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=tR(this.degree,this.knots,this.controlPoints,s,1);return n.copy(r[1]).normalize(),n}toJSON(){const e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=>t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>new gt(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}}let ht,$t,Qn;class iR extends oi{constructor(e){super(e)}load(e,t,n,s){const r=this,a=r.path===""?Ar.extractUrlBase(e):r.path,o=new as(this.manager);o.setPath(r.path),o.setResponseType("arraybuffer"),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(c){try{t(r.parse(c,a))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},n,s)}parse(e,t){if(lR(e))ht=new cR().parse(e);else{const s=W0(e);if(!hR(s))throw new Error("THREE.FBXLoader: Unknown format.");if(z0(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+z0(s));ht=new oR().parse(s)}const n=new ug(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new sR(n,this.manager).parse(ht)}}class sR{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){$t=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),s=this.parseDeformers(),r=new rR().parse(s);return this.parseScene(s,r,n),Qn}parseConnections(){const e=new Map;return"Connections"in ht&&ht.Connections.connections.forEach(function(n){const s=n[0],r=n[1],a=n[2];e.has(s)||e.set(s,{parents:[],children:[]});const o={ID:r,relationship:a};e.get(s).parents.push(o),e.has(r)||e.set(r,{parents:[],children:[]});const c={ID:s,relationship:a};e.get(r).children.push(c)}),e}parseImages(){const e={},t={};if("Video"in ht.Objects){const n=ht.Objects.Video;for(const s in n){const r=n[s],a=parseInt(s);if(e[a]=r.RelativeFilename||r.Filename,"Content"in r){const o=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,c=typeof r.Content=="string"&&r.Content!=="";if(o||c){const l=this.parseImage(n[s]);t[r.RelativeFilename||r.Filename]=l}}}}for(const n in e){const s=e[n];t[s]!==void 0?e[n]=t[s]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,s=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(s){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:console.warn('FBXLoader: Image type "'+s+'" is not supported.');return}if(typeof t=="string")return"data:"+r+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in ht.Objects){const n=ht.Objects.Texture;for(const s in n){const r=this.parseTexture(n[s],e);t.set(parseInt(s),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const s=e.WrapModeU,r=e.WrapModeV,a=s!==void 0?s.value:0,o=r!==void 0?r.value:0;if(n.wrapS=a===0?Ss:Jn,n.wrapT=o===0?Ss:Jn,"Scaling"in e){const c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}if("Translation"in e){const c=e.Translation.value;n.offset.x=c[0],n.offset.y=c[1]}return n}loadTexture(e,t){const n=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),s=e.FileName.split(".").pop().toLowerCase(),r=n.has(s)?this.manager.getHandler(`.${s}`):this.textureLoader;if(!r)return console.warn(`FBXLoader: ${s.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new nn;const a=r.path;a||r.setPath(this.textureLoader.path);const o=$t.get(e.id).children;let c;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(c=t[o[0].ID],(c.indexOf("blob:")===0||c.indexOf("data:")===0)&&r.setPath(void 0));const l=r.load(c);return r.setPath(a),l}parseMaterials(e){const t=new Map;if("Material"in ht.Objects){const n=ht.Objects.Material;for(const s in n){const r=this.parseMaterial(n[s],e);r!==null&&t.set(parseInt(s),r)}}return t}parseMaterial(e,t){const n=e.id,s=e.attrName;let r=e.ShadingModel;if(typeof r=="object"&&(r=r.value),!$t.has(n))return null;const a=this.parseParameters(e,t,n);let o;switch(r.toLowerCase()){case"phong":o=new wl;break;case"lambert":o=new xw;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),o=new wl;break}return o.setValues(a),o.name=s,o}parseParameters(e,t,n){const s={};e.BumpFactor&&(s.bumpScale=e.BumpFactor.value),e.Diffuse?s.color=tt.toWorkingColorSpace(new Fe().fromArray(e.Diffuse.value),yt):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(s.color=tt.toWorkingColorSpace(new Fe().fromArray(e.DiffuseColor.value),yt)),e.DisplacementFactor&&(s.displacementScale=e.DisplacementFactor.value),e.Emissive?s.emissive=tt.toWorkingColorSpace(new Fe().fromArray(e.Emissive.value),yt):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(s.emissive=tt.toWorkingColorSpace(new Fe().fromArray(e.EmissiveColor.value),yt)),e.EmissiveFactor&&(s.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),s.opacity=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0),(s.opacity===1||s.opacity===0)&&(s.opacity=e.Opacity?parseFloat(e.Opacity.value):null,s.opacity===null&&(s.opacity=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),s.opacity<1&&(s.transparent=!0),e.ReflectionFactor&&(s.reflectivity=e.ReflectionFactor.value),e.Shininess&&(s.shininess=e.Shininess.value),e.Specular?s.specular=tt.toWorkingColorSpace(new Fe().fromArray(e.Specular.value),yt):e.SpecularColor&&e.SpecularColor.type==="Color"&&(s.specular=tt.toWorkingColorSpace(new Fe().fromArray(e.SpecularColor.value),yt));const r=this;return $t.get(n).children.forEach(function(a){const o=a.relationship;switch(o){case"Bump":s.bumpMap=r.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":s.aoMap=r.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":s.map=r.getTexture(t,a.ID),s.map!==void 0&&(s.map.colorSpace=yt);break;case"DisplacementColor":s.displacementMap=r.getTexture(t,a.ID);break;case"EmissiveColor":s.emissiveMap=r.getTexture(t,a.ID),s.emissiveMap!==void 0&&(s.emissiveMap.colorSpace=yt);break;case"NormalMap":case"Maya|TEX_normal_map":s.normalMap=r.getTexture(t,a.ID);break;case"ReflectionColor":s.envMap=r.getTexture(t,a.ID),s.envMap!==void 0&&(s.envMap.mapping=Ic,s.envMap.colorSpace=yt);break;case"SpecularColor":s.specularMap=r.getTexture(t,a.ID),s.specularMap!==void 0&&(s.specularMap.colorSpace=yt);break;case"TransparentColor":case"TransparencyFactor":s.alphaMap=r.getTexture(t,a.ID),s.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",o);break}}),s}getTexture(e,t){return"LayeredTexture"in ht.Objects&&t in ht.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=$t.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ht.Objects){const n=ht.Objects.Deformer;for(const s in n){const r=n[s],a=$t.get(parseInt(s));if(r.attrType==="Skin"){const o=this.parseSkeleton(a,n);o.ID=s,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[s]=o}else if(r.attrType==="BlendShape"){const o={id:s};o.rawTargets=this.parseMorphTargets(a,n),o.id=s,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[s]=o}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(s){const r=t[s.ID];if(r.attrType!=="Cluster")return;const a={ID:s.ID,indices:[],weights:[],transformLink:new Re().fromArray(r.TransformLink.a)};"Indexes"in r&&(a.indices=r.Indexes.a,a.weights=r.Weights.a),n.push(a)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let s=0;s<e.children.length;s++){const r=e.children[s],a=t[r.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;o.geoID=$t.get(parseInt(r.ID)).children.filter(function(c){return c.relationship===void 0})[0].ID,n.push(o)}return n}parseScene(e,t,n){Qn=new is;const s=this.parseModels(e.skeletons,t,n),r=ht.Objects.Model,a=this;s.forEach(function(c){const l=r[c.ID];a.setLookAtProperties(c,l),$t.get(c.ID).parents.forEach(function(u){const d=s.get(u.ID);d!==void 0&&d.add(c)}),c.parent===null&&Qn.add(c)}),this.bindSkeleton(e.skeletons,t,s),this.addGlobalSceneSettings(),Qn.traverse(function(c){if(c.userData.transformData){c.parent&&(c.userData.transformData.parentMatrix=c.parent.matrix,c.userData.transformData.parentMatrixWorld=c.parent.matrixWorld);const l=V0(c.userData.transformData);c.applyMatrix4(l),c.updateWorldMatrix()}});const o=new aR().parse();Qn.children.length===1&&Qn.children[0].isGroup&&(Qn.children[0].animations=o,Qn=Qn.children[0]),Qn.animations=o}parseModels(e,t,n){const s=new Map,r=ht.Objects.Model;for(const a in r){const o=parseInt(a),c=r[a],l=$t.get(o);let h=this.buildSkeleton(l,e,o,c.attrName);if(!h){switch(c.attrType){case"Camera":h=this.createCamera(l);break;case"Light":h=this.createLight(l);break;case"Mesh":h=this.createMesh(l,t,n);break;case"NurbsCurve":h=this.createCurve(l,t);break;case"LimbNode":case"Root":h=new al;break;default:h=new is;break}h.name=c.attrName?_t.sanitizeNodeName(c.attrName):"",h.userData.originalName=c.attrName,h.ID=o}this.getTransformData(h,c),s.set(o,h)}return s}buildSkeleton(e,t,n,s){let r=null;return e.parents.forEach(function(a){for(const o in t){const c=t[o];c.rawBones.forEach(function(l,h){if(l.ID===a.ID){const u=r;r=new al,r.matrixWorld.copy(l.transformLink),r.name=s?_t.sanitizeNodeName(s):"",r.userData.originalName=s,r.ID=n,c.bones[h]=r,u!==null&&r.add(u)}})}}),r}createCamera(e){let t,n;if(e.children.forEach(function(s){const r=ht.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new Tt;else{let s=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(s=1);let r=1;n.NearPlane!==void 0&&(r=n.NearPlane.value/1e3);let a=1e3;n.FarPlane!==void 0&&(a=n.FarPlane.value/1e3);let o=window.innerWidth,c=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(o=n.AspectWidth.value,c=n.AspectHeight.value);const l=o/c;let h=45;n.FieldOfView!==void 0&&(h=n.FieldOfView.value);const u=n.FocalLength?n.FocalLength.value:null;switch(s){case 0:t=new Bn(h,l,r,a),u!==null&&t.setFocalLength(u);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new Tt;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),t=new Tt;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(s){const r=ht.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new Tt;else{let s;n.LightType===void 0?s=0:s=n.LightType.value;let r=16777215;n.Color!==void 0&&(r=tt.toWorkingColorSpace(new Fe().fromArray(n.Color.value),yt));let a=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(a=0);let o=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?o=0:o=n.FarAttenuationEnd.value);const c=1;switch(s){case 0:t=new Il(r,a,o,c);break;case 1:t=new fd(r,a);break;case 2:let l=Math.PI/3;n.InnerAngle!==void 0&&(l=In.degToRad(n.InnerAngle.value));let h=0;n.OuterAngle!==void 0&&(h=In.degToRad(n.OuterAngle.value),h=Math.max(h,1)),t=new pg(r,a,o,l,h,c);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new Il(r,a);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let s,r=null,a=null;const o=[];if(e.children.forEach(function(c){t.has(c.ID)&&(r=t.get(c.ID)),n.has(c.ID)&&o.push(n.get(c.ID))}),o.length>1?a=o:o.length>0?a=o[0]:(a=new wl({name:oi.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),"color"in r.attributes&&o.forEach(function(c){c.vertexColors=!0}),r.groups.length>0){let c=!1;for(let l=0,h=r.groups.length;l<h;l++){const u=r.groups[l];(u.materialIndex<0||u.materialIndex>=o.length)&&(u.materialIndex=o.length,c=!0)}if(c){const l=new wl;o.push(l)}}return r.FBX_Deformer?(s=new GA(r,a),s.normalizeSkinWeights()):s=new Zt(r,a),s}createCurve(e,t){const n=e.children.reduce(function(r,a){return t.has(a.ID)&&(r=t.get(a.ID)),r},null),s=new ma({name:oi.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new pl(n,s)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=jo(t.RotationOrder.value):n.eulerOrder=jo(0),"Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&$t.get(e.ID).children.forEach(function(s){if(s.relationship==="LookAtProperty"){const r=ht.Objects.Model[s.ID];if("Lcl_Translation"in r){const a=r.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),Qn.add(e.target)):e.lookAt(new G().fromArray(a))}}})}bindSkeleton(e,t,n){const s=this.parsePoseNodes();for(const r in e){const a=e[r];$t.get(parseInt(a.ID)).parents.forEach(function(c){if(t.has(c.ID)){const l=c.ID;$t.get(l).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new cl(a.bones),s[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in ht.Objects){const t=ht.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const s=t[n].PoseNode;Array.isArray(s)?s.forEach(function(r){e[r.Node]=new Re().fromArray(r.Matrix.a)}):e[s.Node]=new Re().fromArray(s.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in ht){if("AmbientColor"in ht.GlobalSettings){const e=ht.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],s=e[2];if(t!==0||n!==0||s!==0){const r=new Fe().setRGB(t,n,s,yt);Qn.add(new gg(r,1))}}"UnitScaleFactor"in ht.GlobalSettings&&(Qn.userData.unitScaleFactor=ht.GlobalSettings.UnitScaleFactor.value)}}}class rR{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in ht.Objects){const n=ht.Objects.Geometry;for(const s in n){const r=$t.get(parseInt(s)),a=this.parseGeometry(r,n[s],e);t.set(parseInt(s),a)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const s=n.skeletons,r=[],a=e.parents.map(function(u){return ht.Objects.Model[u.ID]});if(a.length===0)return;const o=e.children.reduce(function(u,d){return s[d.ID]!==void 0&&(u=s[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&r.push(n.morphTargets[u.ID])});const c=a[0],l={};"RotationOrder"in c&&(l.eulerOrder=jo(c.RotationOrder.value)),"InheritType"in c&&(l.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(l.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(l.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(l.scale=c.GeometricScaling.value);const h=V0(l);return this.genGeometry(t,o,r,h)}genGeometry(e,t,n,s){const r=new Mn;e.attrName&&(r.name=e.attrName);const a=this.parseGeoNode(e,t),o=this.genBuffers(a),c=new Jt(o.vertex,3);if(c.applyMatrix4(s),r.setAttribute("position",c),o.colors.length>0&&r.setAttribute("color",new Jt(o.colors,3)),t&&(r.setAttribute("skinIndex",new qu(o.weightsIndices,4)),r.setAttribute("skinWeight",new Jt(o.vertexWeights,4)),r.FBX_Deformer=t),o.normal.length>0){const l=new ot().getNormalMatrix(s),h=new Jt(o.normal,3);h.applyNormalMatrix(l),r.setAttribute("normal",h)}if(o.uvs.forEach(function(l,h){const u=h===0?"uv":`uv${h}`;r.setAttribute(u,new Jt(o.uvs[h],2))}),a.material&&a.material.mappingType!=="AllSame"){let l=o.materialIndex[0],h=0;if(o.materialIndex.forEach(function(u,d){u!==l&&(r.addGroup(h,d-h,l),l=u,h=d)}),r.groups.length>0){const u=r.groups[r.groups.length-1],d=u.start+u.count;d!==o.materialIndex.length&&r.addGroup(d,o.materialIndex.length-d,l)}r.groups.length===0&&r.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(r,e,n,s),r}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let s=0;for(;e.LayerElementUV[s];)e.LayerElementUV[s].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[s])),s++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(s,r){s.indices.forEach(function(a,o){n.weightTable[a]===void 0&&(n.weightTable[a]=[]),n.weightTable[a].push({id:r,weight:s.weights[o]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,s=0,r=!1,a=[],o=[],c=[],l=[],h=[],u=[];const d=this;return e.vertexIndices.forEach(function(f,p){let m,g=!1;f<0&&(f=f^-1,g=!0);let A=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){const x=Zl(p,n,f,e.color);c.push(x[0],x[1],x[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(x){_.push(x.weight),A.push(x.id)}),_.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const x=[0,0,0,0],E=[0,0,0,0];_.forEach(function(S,w){let I=S,T=A[w];E.forEach(function(C,v,F){if(I>C){F[v]=I,I=C;const K=x[v];x[v]=T,T=K}})}),A=x,_=E}for(;_.length<4;)_.push(0),A.push(0);for(let x=0;x<4;++x)h.push(_[x]),u.push(A[x])}if(e.normal){const x=Zl(p,n,f,e.normal);o.push(x[0],x[1],x[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=Zl(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(x,E){const S=Zl(p,n,f,x);l[E]===void 0&&(l[E]=[]),l[E].push(S[0]),l[E].push(S[1])}),s++,g&&(d.genFace(t,e,a,m,o,c,l,h,u,s),n++,s=0,a=[],o=[],c=[],l=[],h=[],u=[])}),t}getNormalNewell(e){const t=new G(0,0,0);for(let n=0;n<e.length;n++){const s=e[n],r=e[(n+1)%e.length];t.x+=(s.y-r.y)*(s.z+r.z),t.y+=(s.z-r.z)*(s.x+r.x),t.z+=(s.x-r.x)*(s.y+r.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),s=(Math.abs(t.z)>.5?new G(0,1,0):new G(0,0,1)).cross(t).normalize(),r=t.clone().cross(s).normalize();return{normal:t,tangent:s,bitangent:r}}flattenVertex(e,t,n){return new Je(e.dot(t),e.dot(n))}genFace(e,t,n,s,r,a,o,c,l,h){let u;if(h>3){const d=[],f=t.baseVertexPositions||t.vertexPositions;for(let A=0;A<n.length;A+=3)d.push(new G(f[n[A]],f[n[A+1]],f[n[A+2]]));const{tangent:p,bitangent:m}=this.getNormalTangentAndBitangent(d),g=[];for(const A of d)g.push(this.flattenVertex(A,p,m));u=cd.triangulateShape(g,[])}else u=[[0,1,2]];for(const[d,f,p]of u)e.vertex.push(t.vertexPositions[n[d*3]]),e.vertex.push(t.vertexPositions[n[d*3+1]]),e.vertex.push(t.vertexPositions[n[d*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),e.vertex.push(t.vertexPositions[n[p*3]]),e.vertex.push(t.vertexPositions[n[p*3+1]]),e.vertex.push(t.vertexPositions[n[p*3+2]]),t.skeleton&&(e.vertexWeights.push(c[d*4]),e.vertexWeights.push(c[d*4+1]),e.vertexWeights.push(c[d*4+2]),e.vertexWeights.push(c[d*4+3]),e.vertexWeights.push(c[f*4]),e.vertexWeights.push(c[f*4+1]),e.vertexWeights.push(c[f*4+2]),e.vertexWeights.push(c[f*4+3]),e.vertexWeights.push(c[p*4]),e.vertexWeights.push(c[p*4+1]),e.vertexWeights.push(c[p*4+2]),e.vertexWeights.push(c[p*4+3]),e.weightsIndices.push(l[d*4]),e.weightsIndices.push(l[d*4+1]),e.weightsIndices.push(l[d*4+2]),e.weightsIndices.push(l[d*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3]),e.weightsIndices.push(l[p*4]),e.weightsIndices.push(l[p*4+1]),e.weightsIndices.push(l[p*4+2]),e.weightsIndices.push(l[p*4+3])),t.color&&(e.colors.push(a[d*3]),e.colors.push(a[d*3+1]),e.colors.push(a[d*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2]),e.colors.push(a[p*3]),e.colors.push(a[p*3+1]),e.colors.push(a[p*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(s),e.materialIndex.push(s),e.materialIndex.push(s)),t.normal&&(e.normal.push(r[d*3]),e.normal.push(r[d*3+1]),e.normal.push(r[d*3+2]),e.normal.push(r[f*3]),e.normal.push(r[f*3+1]),e.normal.push(r[f*3+2]),e.normal.push(r[p*3]),e.normal.push(r[p*3+1]),e.normal.push(r[p*3+2])),t.uv&&t.uv.forEach(function(m,g){e.uvs[g]===void 0&&(e.uvs[g]=[]),e.uvs[g].push(o[g][d*2]),e.uvs[g].push(o[g][d*2+1]),e.uvs[g].push(o[g][f*2]),e.uvs[g].push(o[g][f*2+1]),e.uvs[g].push(o[g][p*2]),e.uvs[g].push(o[g][p*2+1])})}addMorphTargets(e,t,n,s){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach(function(a){a.rawTargets.forEach(function(o){const c=ht.Objects.Geometry[o.geoID];c!==void 0&&r.genMorphGeometry(e,t,c,s,o.name)})})}genMorphGeometry(e,t,n,s,r){const a=t.Vertices!==void 0?t.Vertices.a:[],o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],c=n.Vertices!==void 0?n.Vertices.a:[],l=n.Indexes!==void 0?n.Indexes.a:[],h=e.attributes.position.count*3,u=new Float32Array(h);for(let m=0;m<l.length;m++){const g=l[m]*3;u[g]=c[m*3],u[g+1]=c[m*3+1],u[g+2]=c[m*3+2]}const d={vertexIndices:o,vertexPositions:u,baseVertexPositions:a},f=this.genBuffers(d),p=new Jt(f.vertex,3);p.name=r||n.attrName,p.applyMatrix4(s),e.morphAttributes.position.push(p)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Normals.a;let r=[];return n==="IndexToDirect"&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:s,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.UV.a;let r=[];return n==="IndexToDirect"&&(r=e.UVIndex.a),{dataSize:2,buffer:s,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Colors.a;let r=[];n==="IndexToDirect"&&(r=e.ColorIndex.a);for(let a=0,o=new Fe;a<s.length;a+=4)o.fromArray(s,a),tt.toWorkingColorSpace(o,yt),o.toArray(s,a);return{dataSize:4,buffer:s,indices:r,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const s=e.Materials.a,r=[];for(let a=0;a<s.length;++a)r.push(a);return{dataSize:1,buffer:s,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Mn;const n=t-1,s=e.KnotVector.a,r=[],a=e.Points.a;for(let u=0,d=a.length;u<d;u+=4)r.push(new gt().fromArray(a,u));let o,c;if(e.Form==="Closed")r.push(r[0]);else if(e.Form==="Periodic"){o=n,c=s.length-1-o;for(let u=0;u<n;++u)r.push(r[u])}const h=new nR(n,s,r,o,c).getPoints(r.length*12);return new Mn().setFromPoints(h)}}class aR{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const s=t[n],r=this.addClip(s);e.push(r)}return e}parseClips(){if(ht.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=ht.Objects.AnimationCurveNode,t=new Map;for(const n in e){const s=e[n];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){const r={id:s.id,attr:s.attrName,curves:{}};t.set(r.id,r)}}return t}parseAnimationCurves(e){const t=ht.Objects.AnimationCurve;for(const n in t){const s={id:t[n].id,times:t[n].KeyTime.a.map(uR),values:t[n].KeyValueFloat.a},r=$t.get(s.id);if(r!==void 0){const a=r.parents[0].ID,o=r.parents[0].relationship;o.match(/X/)?e.get(a).curves.x=s:o.match(/Y/)?e.get(a).curves.y=s:o.match(/Z/)?e.get(a).curves.z=s:o.match(/DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=s)}}}parseAnimationLayers(e){const t=ht.Objects.AnimationLayer,n=new Map;for(const s in t){const r=[],a=$t.get(parseInt(s));a!==void 0&&(a.children.forEach(function(c,l){if(e.has(c.ID)){const h=e.get(c.ID);if(h.curves.x!==void 0||h.curves.y!==void 0||h.curves.z!==void 0){if(r[l]===void 0){const u=$t.get(c.ID).parents.filter(function(d){return d.relationship!==void 0})[0].ID;if(u!==void 0){const d=ht.Objects.Model[u.toString()];if(d===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",c);return}const f={modelName:d.attrName?_t.sanitizeNodeName(d.attrName):"",ID:d.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Qn.traverse(function(p){p.ID===d.id&&(f.transform=p.matrix,p.userData.transformData&&(f.eulerOrder=p.userData.transformData.eulerOrder))}),f.transform||(f.transform=new Re),"PreRotation"in d&&(f.preRotation=d.PreRotation.value),"PostRotation"in d&&(f.postRotation=d.PostRotation.value),r[l]=f}}r[l]&&(r[l][h.attr]=h)}else if(h.curves.morph!==void 0){if(r[l]===void 0){const u=$t.get(c.ID).parents.filter(function(A){return A.relationship!==void 0})[0].ID,d=$t.get(u).parents[0].ID,f=$t.get(d).parents[0].ID,p=$t.get(f).parents[0].ID,m=ht.Objects.Model[p],g={modelName:m.attrName?_t.sanitizeNodeName(m.attrName):"",morphName:ht.Objects.Deformer[u].attrName};r[l]=g}r[l][h.attr]=h}}}),n.set(parseInt(s),r))}return n}parseAnimStacks(e){const t=ht.Objects.AnimationStack,n={};for(const s in t){const r=$t.get(parseInt(s)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(r[0].ID);n[s]={name:t[s].attrName,layer:a}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(s){t=t.concat(n.generateTracks(s))}),new Cl(e.name,-1,t)}generateTracks(e){const t=[];let n=new G,s=new G;if(e.transform&&e.transform.decompose(n,new Yt,s),n=n.toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const r=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");r!==void 0&&t.push(r)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const r=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);r!==void 0&&t.push(r)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const r=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");r!==void 0&&t.push(r)}if(e.DeformPercent!==void 0){const r=this.generateMorphTrack(e);r!==void 0&&t.push(r)}return t}generateVectorTrack(e,t,n,s){const r=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(r,t,n);return new pr(e+"."+s,r,a)}generateRotationTrack(e,t,n,s,r){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const d=this.interpolateRotations(t.x,t.y,t.z,r);a=d[0],o=d[1]}const c=jo(0);n!==void 0&&(n=n.map(In.degToRad),n.push(c),n=new dn().fromArray(n),n=new Yt().setFromEuler(n)),s!==void 0&&(s=s.map(In.degToRad),s.push(c),s=new dn().fromArray(s),s=new Yt().setFromEuler(s).invert());const l=new Yt,h=new dn,u=[];if(!o||!a)return new Us(e+".quaternion",[0],[0]);for(let d=0;d<o.length;d+=3)h.set(o[d],o[d+1],o[d+2],r),l.setFromEuler(h),n!==void 0&&l.premultiply(n),s!==void 0&&l.multiply(s),d>2&&new Yt().fromArray(u,(d-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(u,d/3*4);return new Us(e+".quaternion",a,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(r){return r/100}),s=Qn.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new fr(e.modelName+".morphTargetInfluences["+s+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,s){return n-s}),t.length>1){let n=1,s=t[0];for(let r=1;r<t.length;r++){const a=t[r];a!==s&&(t[n]=a,s=a,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const s=n,r=[];let a=-1,o=-1,c=-1;return e.forEach(function(l){if(t.x&&(a=t.x.times.indexOf(l)),t.y&&(o=t.y.times.indexOf(l)),t.z&&(c=t.z.times.indexOf(l)),a!==-1){const h=t.x.values[a];r.push(h),s[0]=h}else r.push(s[0]);if(o!==-1){const h=t.y.values[o];r.push(h),s[1]=h}else r.push(s[1]);if(c!==-1){const h=t.z.values[c];r.push(h),s[2]=h}else r.push(s[2])}),r}interpolateRotations(e,t,n,s){const r=[],a=[];r.push(e.times[0]),a.push(In.degToRad(e.values[0])),a.push(In.degToRad(t.values[0])),a.push(In.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){const c=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))continue;const l=c.map(In.degToRad),h=[e.values[o],t.values[o],n.values[o]];if(isNaN(h[0])||isNaN(h[1])||isNaN(h[2]))continue;const u=h.map(In.degToRad),d=[h[0]-c[0],h[1]-c[1],h[2]-c[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){const m=Math.max(...f)/180,g=new dn(...l,s),A=new dn(...u,s),_=new Yt().setFromEuler(g),x=new Yt().setFromEuler(A);_.dot(x)&&x.set(-x.x,-x.y,-x.z,-x.w);const E=e.times[o-1],S=e.times[o]-E,w=new Yt,I=new dn;for(let T=0;T<1;T+=1/m)w.copy(_.clone().slerp(x.clone(),T)),r.push(E+T*S),I.setFromQuaternion(w,s),a.push(I.x),a.push(I.y),a.push(I.z)}else r.push(e.times[o]),a.push(In.degToRad(e.values[o])),a.push(In.degToRad(t.values[o])),a.push(In.degToRad(n.values[o]))}return[r,a]}}class oR{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new H0,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(s,r){const a=s.match(/^[\s\t]*;/),o=s.match(/^[\s\t]*$/);if(a||o)return;const c=s.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),l=s.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),h=s.match("^\\t{"+(t.currentIndent-1)+"}}");c?t.parseNodeBegin(s,c):l?t.parseNodeProperty(s,l,n[++r]):h?t.popStack():s.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(s)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),s=t[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),r={name:n},a=this.parseNodeAttr(s),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,r):n in o?(n==="PoseNode"?o.PoseNode.push(r):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==""&&(o[n][a.id]=r)):typeof a.id=="number"?(o[n]={},o[n][a.id]=r):n!=="Properties70"&&(n==="PoseNode"?o[n]=[r]:o[n]=r),typeof a.id=="number"&&(r.id=a.id),a.name!==""&&(r.attrName=a.name),a.type!==""&&(r.attrType=a.type),this.pushStack(r)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",s="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),s=e[2]),{id:t,name:n,type:s}}parseNodeProperty(e,t,n){let s=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();s==="Content"&&r===","&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,s,r);return}if(s==="C"){const c=r.split(",").slice(1),l=parseInt(c[0]),h=parseInt(c[1]);let u=r.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),s="connections",r=[l,h],fR(r,u),a[s]===void 0&&(a[s]=[])}s==="Node"&&(a.id=r),s in a&&Array.isArray(a[s])?a[s].push(r):s!=="a"?a[s]=r:a.a=r,this.setCurrentProp(a,s),s==="a"&&r.slice(-1)!==","&&(a.a=Cf(r))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Cf(t.a))}parseNodeSpecialProperty(e,t,n){const s=n.split('",').map(function(h){return h.trim().replace(/^\"/,"").replace(/\s/,"_")}),r=s[0],a=s[1],o=s[2],c=s[3];let l=s[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=Cf(l);break}this.getPrevNode()[r]={type:a,type2:o,flag:c,value:l},this.setCurrentProp(this.getPrevNode(),r)}}class cR{parse(e){const t=new G0(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const s=new H0;for(;!this.endOfContent(t);){const r=this.parseNode(t,n);r!==null&&s.add(r.name,r)}return s}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},s=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),o=e.getString(a);if(s===0)return null;const c=[];for(let d=0;d<r;d++)c.push(this.parseProperty(e));const l=c.length>0?c[0]:"",h=c.length>1?c[1]:"",u=c.length>2?c[2]:"";for(n.singleProperty=r===1&&e.getOffset()===s;s>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(o,n,d)}return n.propertyList=c,typeof l=="number"&&(n.id=l),h!==""&&(n.attrName=h),u!==""&&(n.attrType=u),o!==""&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const s=n.propertyList[0];Array.isArray(s)?(t[n.name]=n,n.a=s):t[n.name]=s}else if(e==="Connections"&&n.name==="C"){const s=[];n.propertyList.forEach(function(r,a){a!==0&&s.push(r)}),t.connections===void 0&&(t.connections=[]),t.connections.push(s)}else if(n.name==="Properties70")Object.keys(n).forEach(function(r){t[r]=n[r]});else if(e==="Properties70"&&n.name==="P"){let s=n.propertyList[0],r=n.propertyList[1];const a=n.propertyList[2],o=n.propertyList[3];let c;s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),r==="Color"||r==="ColorRGB"||r==="Vector"||r==="Vector3D"||r.indexOf("Lcl_")===0?c=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:c=n.propertyList[4],t[s]={type:r,type2:a,flag:o,value:c}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const s=e.getUint32(),r=e.getUint32(),a=e.getUint32();if(r===0)switch(t){case"b":case"c":return e.getBooleanArray(s);case"d":return e.getFloat64Array(s);case"f":return e.getFloat32Array(s);case"i":return e.getInt32Array(s);case"l":return e.getInt64Array(s)}const o=Ko(new Uint8Array(e.getArrayBuffer(a))),c=new G0(o.buffer);switch(t){case"b":case"c":return c.getBooleanArray(s);case"d":return c.getFloat64Array(s);case"f":return c.getFloat32Array(s);case"i":return c.getInt32Array(s);case"l":return c.getInt64Array(s)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class G0{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const s=n.indexOf(0);return s>=0&&(n=new Uint8Array(this.dv.buffer,t,s)),this._textDecoder.decode(n)}}class H0{add(e,t){this[e]=t}}function lR(i){const e="Kaydara FBX Binary \0";return i.byteLength>=e.length&&e===W0(i,0,e.length)}function hR(i){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(s){const r=i[s-1];return i=i.slice(t+s),t++,r}for(let s=0;s<e.length;++s)if(n(1)===e[s])return!1;return!0}function z0(i){const e=/FBXVersion: (\d+)/,t=i.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function uR(i){return i/46186158e3}const dR=[];function Zl(i,e,t,n){let s;switch(n.mappingType){case"ByPolygonVertex":s=i;break;case"ByPolygon":s=e;break;case"ByVertice":s=t;break;case"AllSame":s=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(s=n.indices[s]);const r=s*n.dataSize,a=r+n.dataSize;return pR(dR,n.buffer,r,a)}const vf=new dn,Na=new G;function V0(i){const e=new Re,t=new Re,n=new Re,s=new Re,r=new Re,a=new Re,o=new Re,c=new Re,l=new Re,h=new Re,u=new Re,d=new Re,f=i.inheritType?i.inheritType:0;i.translation&&e.setPosition(Na.fromArray(i.translation));const p=jo(0);if(i.preRotation){const F=i.preRotation.map(In.degToRad);F.push(p),t.makeRotationFromEuler(vf.fromArray(F))}if(i.rotation){const F=i.rotation.map(In.degToRad);F.push(i.eulerOrder||p),n.makeRotationFromEuler(vf.fromArray(F))}if(i.postRotation){const F=i.postRotation.map(In.degToRad);F.push(p),s.makeRotationFromEuler(vf.fromArray(F)),s.invert()}i.scale&&r.scale(Na.fromArray(i.scale)),i.scalingOffset&&o.setPosition(Na.fromArray(i.scalingOffset)),i.scalingPivot&&a.setPosition(Na.fromArray(i.scalingPivot)),i.rotationOffset&&c.setPosition(Na.fromArray(i.rotationOffset)),i.rotationPivot&&l.setPosition(Na.fromArray(i.rotationPivot)),i.parentMatrixWorld&&(u.copy(i.parentMatrix),h.copy(i.parentMatrixWorld));const m=t.clone().multiply(n).multiply(s),g=new Re;g.extractRotation(h);const A=new Re;A.copyPosition(h);const _=A.clone().invert().multiply(h),x=g.clone().invert().multiply(_),E=r,S=new Re;if(f===0)S.copy(g).multiply(m).multiply(x).multiply(E);else if(f===1)S.copy(g).multiply(x).multiply(m).multiply(E);else{const K=new Re().scale(new G().setFromMatrixScale(u)).clone().invert(),q=x.clone().multiply(K);S.copy(g).multiply(m).multiply(q).multiply(E)}const w=l.clone().invert(),I=a.clone().invert();let T=e.clone().multiply(c).multiply(l).multiply(t).multiply(n).multiply(s).multiply(w).multiply(o).multiply(a).multiply(r).multiply(I);const C=new Re().copyPosition(T),v=h.clone().multiply(C);return d.copyPosition(v),T=d.clone().multiply(S),T.premultiply(h.invert()),T}function jo(i){i=i||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return i===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[i]}function Cf(i){return i.split(",").map(function(t){return parseFloat(t)})}function W0(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=i.byteLength),new TextDecoder().decode(new Uint8Array(i,e,t))}function fR(i,e){for(let t=0,n=i.length,s=e.length;t<s;t++,n++)i[n]=e[t]}function pR(i,e,t,n){for(let s=t,r=0;s<n;s++,r++)i[r]=e[s];return i}const AR=.35;class gR{constructor(){this.model=null,this.mixer=null,this.clips=new Map,this.actions=new Map,this.currentName=null,this.currentAction=null,this.loader=new Id,this.fbxLoader=new iR,this.onChange=null,this._gltfCache=new Map,this._animationDefs=[]}attach(e){this.detach(),this.model=e,this.mixer=new mg(e),this.actions.clear(),this.currentAction=null,this.currentName=null;for(const[t,n]of this.clips){const s=this._retargetClip(n,t),r=this.mixer.clipAction(s);r.enabled=!0,this.actions.set(t,r)}}detach(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null),this.model=null,this.actions.clear(),this.currentAction=null,this.currentName=null}setAnimationDefs(e){this._animationDefs=e}getAnimationDefs(){return this._animationDefs}async loadAnimation(e,t,n={}){if(this.clips.has(e))return this.clips.get(e);let s;if(this._gltfCache.has(t))s=this._gltfCache.get(t);else{const a=t.toLowerCase().endsWith(".fbx");s=(await new Promise((c,l)=>{(a?this.fbxLoader:this.loader).load(t,c,void 0,l)})).animations||[],this._gltfCache.set(t,s)}let r;if(n.clipName?(r=s.find(a=>a.name===n.clipName),r||(console.warn(`[AnimationManager] Clip "${n.clipName}" not found in ${t}, using first clip`),r=s[0])):r=s[0],!r)throw new Error(`No animation found in ${t}`);if(r=r.clone(),r.name=e,this.clips.set(e,r),this.model&&this.mixer){const a=this._retargetClip(r,e),o=this.mixer.clipAction(a);o.enabled=!0,o.setLoop(n.loop===!1?nA:iA),n.loop===!1&&(o.clampWhenFinished=!0),this.actions.set(e,o)}return r}async loadAll(){const e=this._animationDefs.map(async t=>{try{await this.loadAnimation(t.name,t.url,{loop:t.loop!==!1,clipName:t.clipName})}catch(n){console.warn(`[AnimationManager] Failed to load "${t.name}" from ${t.url}:`,n)}});await Promise.all(e)}play(e){const t=this.actions.get(e);if(!t){console.warn(`[AnimationManager] Animation "${e}" not loaded`);return}this.currentAction&&this.currentAction!==t&&this.currentAction.fadeOut(.01),t.reset().fadeIn(.01).play(),this.currentAction=t,this.currentName=e,this.onChange&&this.onChange(e)}crossfadeTo(e,t=AR){if(e===this.currentName)return;const n=this.actions.get(e);if(!n){console.warn(`[AnimationManager] Animation "${e}" not loaded`);return}n.reset(),n.play(),this.currentAction?this.currentAction.crossFadeTo(n,t,!0):n.fadeIn(t),this.currentAction=n,this.currentName=e,this.onChange&&this.onChange(e)}stopAll(){this.mixer&&this.mixer.stopAllAction(),this.currentAction=null,this.currentName=null,this.onChange&&this.onChange(null)}update(e){this.mixer&&this.mixer.update(e)}_retargetClip(e,t){if(!this.model)return e;const n=new Set;if(this.model.traverse(l=>{l.isBone&&n.add(l.name)}),n.size===0)return e;const s=new Set;for(const l of e.tracks){const h=l.name.split(".")[0];s.add(h)}let r=0;for(const l of s)n.has(l)&&r++;if(r/s.size>.5)return e;const a=this._buildBoneNameMap(n,s);if(!a)return e;const o=e.tracks.map(l=>{const h=l.name.split("."),u=h[0],d=h.slice(1).join("."),f=a.get(u);if(!f)return null;const p=l.clone();return p.name=`${f}.${d}`,p}).filter(Boolean),c=e.clone();return c.tracks=o,c}_buildBoneNameMap(e,t){const n=new Map,s=[...e],r=[...t],a=h=>h.replace(/^mixamorig\d*[_:]?/i,"").replace(/^Armature[_/]?/i,""),o=new Map(s.map(h=>[a(h),h]));let c=0;for(const h of r){const u=a(h);o.has(u)&&(n.set(h,o.get(u)),c++)}if(c/r.length>.5)return n;const l=new Map(s.map(h=>[h.toLowerCase(),h]));n.clear(),c=0;for(const h of r)l.has(h.toLowerCase())&&(n.set(h,l.get(h.toLowerCase())),c++);return c/r.length>.5?n:null}getLoadedNames(){return[...this.clips.keys()]}isLoaded(e){return this.clips.has(e)}dispose(){this.detach(),this.clips.clear(),this._gltfCache.clear(),this._animationDefs=[]}}ss.enabled=!0;class If{constructor(e,t){this.el=e,this.options=t,this.lights=[],this.content=null,this.mixer=null,this.clips=[],this.gui=null,this.animationManager=new gR,this._animPanelEl=null,this.state={environment:t.preset===Ef.ASSET_GENERATOR?Ul.find(r=>r.id==="footprint-court").name:Ul[1].name,background:!1,playbackSpeed:1,actionStates:{},camera:Yl,wireframe:!1,skeleton:!1,grid:!1,autoRotate:!1,punctualLights:!0,exposure:0,toneMapping:Jh,ambientIntensity:.3,ambientColor:"#FFFFFF",directIntensity:.8*Math.PI,directColor:"#FFFFFF",bgColor:"#000000",transparentBg:!1,pointSize:1,showInfo:!0,showLabels:!1,followMode:"mouse"},this.prevTime=0,this.stats=new Do,this.stats.dom.height="48px",[].forEach.call(this.stats.dom.children,r=>r.style.display=""),this.backgroundColor=new Fe(this.state.bgColor),this.scene=new Yu,this.scene.background=this.backgroundColor;const n=t.preset===Ef.ASSET_GENERATOR?.8*180/Math.PI:60,s=e.clientWidth/e.clientHeight;this.defaultCamera=new Bn(n,s,.01,1e3),this.activeCamera=this.defaultCamera,this.scene.add(this.defaultCamera),this.renderer=window.renderer=new Yg({antialias:!0,alpha:!0}),this.renderer.setClearColor(0,1),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.renderer.setSize(e.clientWidth,e.clientHeight),this.pmremGenerator=new _d(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.neutralEnvironment=this.pmremGenerator.fromScene(new Y1).texture,this.controls=new k1(this.defaultCamera,this.renderer.domElement),this.controls.screenSpacePanning=!0,this._onControlsChange=()=>this.invalidate(),this.controls.addEventListener("change",this._onControlsChange),this.el.appendChild(this.renderer.domElement),this.cameraCtrl=null,this.cameraFolder=null,this.animFolder=null,this.animCtrls=[],this.morphFolder=null,this.morphCtrls=[],this.skeletonHelpers=[],this.gridHelper=null,this.axesHelper=null,this.modelInfo=null,this.annotationEls=[],this._tempVec=new G,this.addAxesHelper(),this.addGUI(),t.kiosk&&this.gui.close(),this.animate=this.animate.bind(this),this._rafId=null,this._visible=!0,this._tabVisible=!document.hidden,this._disposed=!1,this._loadedEnvironment=null,this._guiWrap=null,this._needsRender=!0,this._animating=!1,this._onVisibilityChange=()=>{const r=!this._tabVisible;this._tabVisible=!document.hidden,r&&this._tabVisible&&(this._needsRender=!0),this._updateRenderLoop()},document.addEventListener("visibilitychange",this._onVisibilityChange),typeof IntersectionObserver<"u"&&(this._intersectionObserver=new IntersectionObserver(r=>{const a=!this._visible;this._visible=r[r.length-1].isIntersecting,a&&this._visible&&(this._needsRender=!0),this._updateRenderLoop()},{threshold:0}),this._intersectionObserver.observe(this.el)),this._onResize=this.resize.bind(this),this._onKeyDown=r=>{(r.key==="p"||r.key==="P")&&!this.isInputFocused()&&this.takeScreenshot()},this._updateRenderLoop(),window.addEventListener("resize",this._onResize,!1),window.addEventListener("keydown",this._onKeyDown)}invalidate(){this._disposed||(this._needsRender=!0,this._updateRenderLoop())}_recomputeAnimating(){let e=!1;if(this.state&&this.state.autoRotate&&(e=!0),!e&&this.mixer&&this.state){for(const t in this.state.actionStates)if(this.state.actionStates[t]){e=!0;break}}!e&&this.animationManager.currentAction&&(e=!0),this._animating=e}_updateRenderLoop(){if(this._disposed)return;const e=this._visible&&this._tabVisible;e&&(this._needsRender||this._animating)&&this._rafId===null?(this.prevTime=performance.now(),this._rafId=requestAnimationFrame(this.animate)):!e&&this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}animate(e){const t=(e-this.prevTime)/1e3;if(this.prevTime=e,this._recomputeAnimating(),this.controls.update(),this.stats.update(),this.mixer&&this.mixer.update(t),this.animationManager.update(t),this._afterAnimateHooks)for(let n=0;n<this._afterAnimateHooks.length;n++)this._afterAnimateHooks[n](t);this.render(),this._needsRender=!1,this._animating&&this._visible&&this._tabVisible&&!this._disposed?this._rafId=requestAnimationFrame(this.animate):this._rafId=null}isInputFocused(){const e=document.activeElement;return e&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}render(){this.renderer.render(this.scene,this.activeCamera),this.state.grid&&(this.axesCamera.position.copy(this.defaultCamera.position),this.axesCamera.lookAt(this.axesScene.position),this.axesRenderer.render(this.axesScene,this.axesCamera)),this.projectAnnotations()}takeScreenshot(){WT(this)}resize(){const{clientHeight:e,clientWidth:t}=this.el;this.defaultCamera.aspect=t/e,this.defaultCamera.updateProjectionMatrix(),this.renderer.setSize(t,e),this.axesCamera.aspect=this.axesDiv.clientWidth/this.axesDiv.clientHeight,this.axesCamera.updateProjectionMatrix(),this.axesRenderer.setSize(this.axesDiv.clientWidth,this.axesDiv.clientHeight),this.invalidate()}load(e,t,n){const s=Ar.extractUrlBase(e);return new Promise((r,a)=>{Jl.setURLModifier((l,h)=>{const u=t+decodeURI(l).replace(s,"").replace(/^(\.?\/)/,"");if(n.has(u)){const d=n.get(u),f=URL.createObjectURL(d);return c.push(f),f}return(h||"")+l});const o=new Id(Jl).setCrossOrigin("anonymous").setDRACOLoader(vT).setKTX2Loader(CT.detectSupport(this.renderer)).setMeshoptDecoder(L1),c=[];o.load(e,l=>{window.VIEWER.json=l;const h=l.scene||l.scenes[0],u=l.animations||[];if(!h)throw new Error("This model contains no scene, and cannot be viewed here. However, it may contain individual 3D resources.");this.setContent(h,u),c.forEach(URL.revokeObjectURL),r(l)},void 0,a)})}setContent(e,t){this.clear(),e.updateMatrixWorld();const n=new Pi().setFromObject(e),s=n.getSize(new G).length(),r=n.getCenter(new G);this.controls.reset(),e.position.x-=r.x,e.position.y-=r.y,e.position.z-=r.z,this.controls.maxDistance=s*10,this.defaultCamera.near=s/100,this.defaultCamera.far=s*100,this.defaultCamera.updateProjectionMatrix(),this.options.cameraPosition?(this.defaultCamera.position.fromArray(this.options.cameraPosition),this.defaultCamera.lookAt(new G)):(this.defaultCamera.position.copy(r),this.defaultCamera.position.x+=s/2,this.defaultCamera.position.y+=s/5,this.defaultCamera.position.z+=s/2,this.defaultCamera.lookAt(r)),this.setCamera(Yl),this.axesCamera.position.copy(this.defaultCamera.position),this.axesCamera.lookAt(this.axesScene.position),this.axesCamera.near=s/100,this.axesCamera.far=s*100,this.axesCamera.updateProjectionMatrix(),this.axesCorner.scale.set(s,s,s),this.controls.saveState(),this.scene.add(e),this.content=e,this.state.punctualLights=!0,this.content.traverse(a=>{a.isLight&&(this.state.punctualLights=!1)}),this.setClips(t),this.animationManager.attach(this.content),this._setupAnimationPanel(),this.updateLights(),this.updateGUI(),this.updateEnvironment(),this.updateDisplay(),this.updateModelInfo(e,t),this.updateAnnotations(),window.VIEWER.scene=this.content,this.invalidate()}setClips(e){KT(this,e)}playAllClips(){jT(this)}setCamera(e){e===Yl?(this.controls.enabled=!0,this.activeCamera=this.defaultCamera):(this.controls.enabled=!1,this.content.traverse(t=>{t.isCamera&&t.name===e&&(this.activeCamera=t)})),this.invalidate()}updateLights(){const e=this.state,t=this.lights;e.punctualLights&&!t.length?IT(this):!e.punctualLights&&t.length&&ST(this),this.renderer.toneMapping=Number(e.toneMapping),this.renderer.toneMappingExposure=Math.pow(2,e.exposure),t.length===2&&(t[0].intensity=e.ambientIntensity,t[0].color.set(e.ambientColor),t[1].intensity=e.directIntensity,t[1].color.set(e.directColor)),this.invalidate()}updateEnvironment(){const e=Ul.filter(t=>t.name===this.state.environment)[0];VT(this,e).then(({envMap:t})=>{this._disposed||!this.scene||(this.scene.environment=t,this.scene.background=this.state.transparentBg?null:this.state.background?t:this.backgroundColor,this.invalidate())})}updateDisplay(){this.skeletonHelpers.length&&this.skeletonHelpers.forEach(e=>this.scene.remove(e)),N0(this.content,e=>{e.wireframe=this.state.wireframe,e instanceof sd&&(e.size=this.state.pointSize)}),this.content.traverse(e=>{if(e.geometry&&e.skeleton&&this.state.skeleton){const t=new Yw(e.skeleton.bones[0].parent);t.material.linewidth=3,this.scene.add(t),this.skeletonHelpers.push(t)}}),this.state.grid!==!!this.gridHelper&&(this.state.grid?(this.gridHelper=new Jw,this.axesHelper=new Eg,this.axesHelper.renderOrder=999,this.axesHelper.onBeforeRender=e=>e.clearDepth(),this.scene.add(this.gridHelper),this.scene.add(this.axesHelper)):(this.scene.remove(this.gridHelper),this.scene.remove(this.axesHelper),this.gridHelper=null,this.axesHelper=null,this.axesRenderer.clear())),this.controls.autoRotate=this.state.autoRotate,this.invalidate()}updateBackground(){this.backgroundColor.set(this.state.bgColor),this.state.transparentBg?(this.scene.background=null,this.renderer.setClearColor(0,0)):(this.scene.background=this.backgroundColor,this.renderer.setClearColor(0,1),this.updateEnvironment()),this.invalidate()}setBackgroundColor(e){this.state.bgColor=typeof e=="string"?e:"#"+e.toString(16).padStart(6,"0"),this.state.transparentBg=!1,this.updateBackground()}updateModelInfo(e,t){this.modelInfo&&(this.modelInfo.remove(),this.modelInfo=null),this.state.showInfo&&e&&(this.modelInfo=nT(this.el,e,t))}updateAnnotations(){if(this.annotationEls.forEach(t=>t.el.remove()),this.annotationEls=[],!this.state.showLabels||!this.content)return;rT(this.content).forEach(t=>{const n=aT(t),s=document.createElement("div");s.classList.add("annotation-label"),s.appendChild(n),this.el.appendChild(s),this.annotationEls.push({el:s,position:t.position})}),this.invalidate()}projectAnnotations(){if(this.annotationEls.length===0)return;const e=this.el.clientWidth,t=this.el.clientHeight,n=e/2,s=t/2,r=this._tempVec;this.annotationEls.forEach(({el:a,position:o})=>{if(r.copy(o),r.project(this.activeCamera),r.z>1){a.style.display="none";return}const c=r.x*n+n,l=-(r.y*s)+s;a.style.display="",a.style.left=c+"px",a.style.top=l+"px"})}addAxesHelper(){this.axesDiv=document.createElement("div"),this.el.appendChild(this.axesDiv),this.axesDiv.classList.add("axes");const{clientWidth:e,clientHeight:t}=this.axesDiv;this.axesScene=new Yu,this.axesCamera=new Bn(50,e/t,.1,10),this.axesScene.add(this.axesCamera),this.axesRenderer=new Yg({alpha:!0}),this.axesRenderer.setPixelRatio(window.devicePixelRatio),this.axesRenderer.setSize(this.axesDiv.clientWidth,this.axesDiv.clientHeight),this.axesCamera.up=this.defaultCamera.up,this.axesCorner=new Eg(5),this.axesScene.add(this.axesCorner),this.axesDiv.appendChild(this.axesRenderer.domElement)}addGUI(){const e=window.innerWidth<=700,t=this.gui=new xM({autoPlace:!1,width:e?220:260,hideable:!0}),n=t.addFolder("Display");n.add(this.state,"background").onChange(()=>this.updateEnvironment()),n.add(this.state,"autoRotate").onChange(()=>this.updateDisplay()),n.add(this.state,"wireframe").onChange(()=>this.updateDisplay()),n.add(this.state,"skeleton").onChange(()=>this.updateDisplay()),n.add(this.state,"grid").onChange(()=>this.updateDisplay()),n.add(this.controls,"screenSpacePanning"),n.add(this.state,"pointSize",1,16).onChange(()=>this.updateDisplay()),n.add(this.state,"transparentBg").name("transparent bg").onChange(()=>this.updateBackground()),n.addColor(this.state,"bgColor").onChange(()=>this.updateBackground()),n.add({screenshot:()=>this.takeScreenshot()},"screenshot").name("Screenshot [P]"),n.add(this.state,"showInfo").name("model info").onChange(()=>this.updateModelInfo(this.content,this.clips)),n.add(this.state,"showLabels").name("mesh labels").onChange(()=>this.updateAnnotations());const p=t.addFolder("Lighting");p.add(this.state,"environment",Ul.map(w=>w.name)).onChange(()=>this.updateEnvironment()),[p.add(this.state,"toneMapping",{Linear:Jh,"ACES Filmic":qp}),p.add(this.state,"exposure",-10,10,.01),p.add(this.state,"punctualLights").listen(),p.add(this.state,"ambientIntensity",0,2),p.addColor(this.state,"ambientColor"),p.add(this.state,"directIntensity",0,4),p.addColor(this.state,"directColor")].forEach(w=>w.onChange(()=>this.updateLights())),this.animFolder=t.addFolder("Animation"),this.animFolder.domElement.style.display="none",this.animFolder.add(this.state,"playbackSpeed",0,1).onChange(w=>{this.mixer&&(this.mixer.timeScale=w)}),this.animFolder.add({playAll:()=>this.playAllClips()},"playAll"),this.morphFolder=t.addFolder("Morph Targets"),this.morphFolder.domElement.style.display="none",this.cameraFolder=t.addFolder("Cameras"),this.cameraFolder.domElement.style.display="none",t.addFolder("Agent").add(this.state,"followMode",{None:"none","Follow Mouse":"mouse","Follow Keystrokes":"keystrokes"}).name("follow mode");const _=t.addFolder("Performance"),x=document.createElement("li");this.stats.dom.style.position="static",x.appendChild(this.stats.dom),x.classList.add("gui-stats"),_.__ul.appendChild(x);const E=document.createElement("div");this.el.appendChild(E),E.classList.add("gui-wrap"),E.classList.add("gui-wrap--hidden"),E.appendChild(t.domElement),this._guiWrap=E;const S=document.createElement("button");S.className="gui-toggle",S.setAttribute("title","Toggle advanced controls"),S.setAttribute("aria-label","Toggle advanced controls"),S.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-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 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 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 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg><span class="gui-toggle__label">Controls</span>',S.addEventListener("click",()=>{const w=E.classList.toggle("gui-wrap--hidden");S.classList.toggle("gui-toggle--active",!w)}),this.el.appendChild(S),this._guiToggle=S,e?t.close():t.open()}updateGUI(){this.cameraFolder.domElement.style.display="none",this.morphCtrls.forEach(n=>n.remove()),this.morphCtrls.length=0,this.morphFolder.domElement.style.display="none",this.animCtrls.forEach(n=>n.remove()),this.animCtrls.length=0,this.animFolder.domElement.style.display="none";const e=[],t=[];if(this.content.traverse(n=>{n.geometry&&n.morphTargetInfluences&&t.push(n),n.isCamera&&(n.name=n.name||`VIEWER__camera_${e.length+1}`,e.push(n.name))}),e.length){this.cameraFolder.domElement.style.display="",this.cameraCtrl&&this.cameraCtrl.remove();const n=[Yl].concat(e);this.cameraCtrl=this.cameraFolder.add(this.state,"camera",n),this.cameraCtrl.onChange(s=>this.setCamera(s))}if(t.length&&(this.morphFolder.domElement.style.display="",t.forEach(n=>{if(n.morphTargetInfluences.length){const s=this.morphFolder.add({name:n.name||"Untitled"},"name");this.morphCtrls.push(s)}for(let s=0;s<n.morphTargetInfluences.length;s++){const r=this.morphFolder.add(n.morphTargetInfluences,s,0,1,.01).listen();Object.keys(n.morphTargetDictionary).forEach(a=>{a&&n.morphTargetDictionary[a]===s&&r.name(a)}),this.morphCtrls.push(r)}})),this.clips.length){this.animFolder.domElement.style.display="";const n=this.state.actionStates={};this.clips.forEach((s,r)=>{s.name=`${r+1}. ${s.name}`;let a;r===0?(n[s.name]=!0,a=this.mixer.clipAction(s),a.play()):n[s.name]=!1;const o=this.animFolder.add(n,s.name).listen();o.onChange(c=>{a=a||this.mixer.clipAction(s),a.setEffectiveTimeScale(1),c?a.play():a.stop(),this.invalidate()}),this.animCtrls.push(o)})}}setAnimationDefs(e){this.animationManager.setAnimationDefs(e),this.content&&this._setupAnimationPanel()}_setupAnimationPanel(){this._animPanelEl&&(this._animPanelEl.remove(),this._animPanelEl=null);const e=this.animationManager.getAnimationDefs();if(e.length===0)return;let t=!1;if(this.content.traverse(s=>{s.isSkinnedMesh&&(t=!0)}),!t)return;const n=document.createElement("div");n.className="anim-panel",n.innerHTML='<div class="anim-panel__header"><span class="anim-panel__title">Animations</span><button class="anim-panel__stop" title="Stop all">⏹</button></div><div class="anim-panel__grid"></div>',this.el.appendChild(n),this._animPanelEl=n,this._renderAnimButtons(),this.animationManager.loadAll().then(()=>{if(this._renderAnimButtons(),!this.animationManager.currentName&&e.length>0){const s=e[0].name;this.animationManager.isLoaded(s)&&(this.animationManager.play(s),this._renderAnimButtons(),this.invalidate(),this._recomputeAnimating(),this._updateRenderLoop())}}),n.querySelector(".anim-panel__stop").addEventListener("click",()=>{this.animationManager.stopAll(),this._renderAnimButtons(),this.invalidate()}),this.animationManager.onChange=()=>{this._renderAnimButtons()}}_renderAnimButtons(){if(!this._animPanelEl)return;const e=this._animPanelEl.querySelector(".anim-panel__grid"),t=this.animationManager.getAnimationDefs(),n=this.animationManager.currentName,s={idle:"🧍",breathing:"🧍",standing:"🧍",walking:"🚶",walk:"🚶",running:"🏃",run:"🏃",waving:"👋",wave:"👋",dancing:"💃",dance:"💃",sitting:"🪑",sit:"🪑",jumping:"🦘",jump:"🦘",talking:"🗣️",talk:"🗣️",clapping:"👏",clap:"👏",punching:"👊",punch:"👊",kicking:"🦵",kick:"🦵"};e.innerHTML=t.map((r,a)=>{const o=this.animationManager.isLoaded(r.name),c=n===r.name,l=r.icon||s[r.name.toLowerCase()]||"▶",h=r.label||r.name.charAt(0).toUpperCase()+r.name.slice(1),u=a<9?a+1:"";return'<button class="anim-btn'+(c?" anim-btn--active":"")+(o?"":" anim-btn--loading")+'" data-anim="'+r.name+'" title="'+h+(u?" — press "+u:"")+'"'+(o?"":" disabled")+">"+(u?'<span class="anim-btn__key">'+u+"</span>":"")+'<span class="anim-btn__icon">'+l+'</span><span class="anim-btn__label">'+h+"</span></button>"}).join(""),e.querySelectorAll(".anim-btn:not([disabled])").forEach(r=>{r.addEventListener("click",()=>{const a=r.dataset.anim;this.animationManager.crossfadeTo(a),this.invalidate(),this._recomputeAnimating(),this._updateRenderLoop()})}),this._onAnimHotkey||(this._onAnimHotkey=r=>{if(r.target&&/INPUT|TEXTAREA|SELECT/.test(r.target.tagName)||r.metaKey||r.ctrlKey||r.altKey)return;const a=parseInt(r.key,10);if(!a||a<1||a>9)return;const c=this.animationManager.getAnimationDefs()[a-1];!c||!this.animationManager.isLoaded(c.name)||(this.animationManager.crossfadeTo(c.name),this.invalidate(),this._recomputeAnimating(),this._updateRenderLoop())},document.addEventListener("keydown",this._onAnimHotkey))}clear(){this.content&&(this.animationManager.detach(),this._animPanelEl&&(this._animPanelEl.remove(),this._animPanelEl=null),this.modelInfo&&(this.modelInfo.remove(),this.modelInfo=null),this.annotationEls.forEach(e=>e.el.remove()),this.annotationEls=[],this.scene.remove(this.content),this.content.traverse(e=>{e.geometry&&e.geometry.dispose()}),N0(this.content,e=>{for(const t in e)t!=="envMap"&&e[t]&&e[t].isTexture&&e[t].dispose()}),this.content=null,this._disposed||this.invalidate())}dispose(){if(!this._disposed){if(this._disposed=!0,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._onResize,!1),window.removeEventListener("keydown",this._onKeyDown),this._onAnimHotkey&&(document.removeEventListener("keydown",this._onAnimHotkey),this._onAnimHotkey=null),this._intersectionObserver&&(this._intersectionObserver.disconnect(),this._intersectionObserver=null),this.clear(),this.mixer){this.mixer.stopAllAction();const e=this.mixer.getRoot();e&&this.mixer.uncacheRoot(e),this.mixer=null}this.clips=[],this.animationManager.dispose(),this._animPanelEl&&(this._animPanelEl.remove(),this._animPanelEl=null),this.skeletonHelpers.length&&(this.skeletonHelpers.forEach(e=>{this.scene.remove(e),e.dispose?.()}),this.skeletonHelpers.length=0),this.gridHelper&&(this.scene.remove(this.gridHelper),this.gridHelper.geometry?.dispose(),this.gridHelper.material?.dispose(),this.gridHelper=null),this.axesHelper&&(this.scene.remove(this.axesHelper),this.axesHelper.geometry?.dispose(),this.axesHelper.material?.dispose(),this.axesHelper=null),this.axesCorner&&(this.axesScene?.remove(this.axesCorner),this.axesCorner.geometry?.dispose(),this.axesCorner.material?.dispose(),this.axesCorner=null),this.lights.forEach(e=>e.parent?.remove(e)),this.lights=[],this.annotationEls.length&&(this.annotationEls.forEach(e=>e.el.remove()),this.annotationEls=[]),this.modelInfo&&(this.modelInfo.remove(),this.modelInfo=null),this.gui&&(this.gui.destroy(),this.gui=null),this._guiWrap&&(this._guiWrap.remove(),this._guiWrap=null),this._guiToggle&&(this._guiToggle.remove(),this._guiToggle=null),this.stats?.dom&&this.stats.dom.remove(),this.controls&&(this._onControlsChange&&(this.controls.removeEventListener("change",this._onControlsChange),this._onControlsChange=null),this.controls.dispose(),this.controls=null),this._loadedEnvironment&&(this._loadedEnvironment.dispose(),this._loadedEnvironment=null),this.neutralEnvironment&&(this.neutralEnvironment.dispose(),this.neutralEnvironment=null),this.scene&&(this.scene.environment=null,this.scene.background=null),this.pmremGenerator&&(this.pmremGenerator.dispose(),this.pmremGenerator=null),this.axesRenderer&&(this.axesRenderer.dispose(),this.axesRenderer.forceContextLoss?.(),this.axesRenderer.domElement?.remove(),this.axesRenderer=null),this.axesDiv&&(this.axesDiv.remove(),this.axesDiv=null),this.axesScene=null,this.axesCamera=null,this.renderer&&(this.renderer.dispose(),this.renderer.forceContextLoss?.(),this.renderer.domElement?.remove(),window.renderer===this.renderer&&(window.renderer=null),this.renderer=null),this.scene=null,this.content=null,this.activeCamera=null,this.defaultCamera=null,this._afterAnimateHooks=null}}}class mR{constructor({model:e="claude-opus-4-6",proxyURL:t,apiKey:n,agentId:s,apiOrigin:r,temperature:a=.7,maxTokens:o=4096,thinking:c="auto"}={}){this.model=e,this.apiKey=n,this.temperature=a,this.maxTokens=o,this.thinking=c,t?this.proxyURL=t:!n&&s&&r?this.proxyURL=`${r}/api/llm/anthropic?agent=${encodeURIComponent(s)}`:this.proxyURL=null}async complete({system:e,messages:t,tools:n}){const s={model:this.model,max_tokens:this.maxTokens,temperature:this.temperature,system:e,messages:t};n&&n.length&&(s.tools=n),this.thinking==="always"&&(s.thinking={type:"enabled",budget_tokens:2048});const r=this.proxyURL||"https://api.anthropic.com/v1/messages",a={"content-type":"application/json"};this.apiKey&&(a["x-api-key"]=this.apiKey,a["anthropic-version"]="2023-06-01",a["anthropic-dangerous-direct-browser-access"]="true");const o=await fetch(r,{method:"POST",headers:a,body:JSON.stringify(s)});if(!o.ok){const l=await o.text();throw new Error(`Anthropic ${o.status}: ${l}`)}const c=await o.json();return this._normalize(c)}_normalize(e){const t={text:"",toolCalls:[],thinking:"",stopReason:e.stop_reason};for(const n of e.content||[])n.type==="text"?t.text+=n.text:n.type==="thinking"?t.thinking+=n.thinking||"":n.type==="tool_use"&&t.toolCalls.push({id:n.id,name:n.name,input:n.input});return t}formatToolResults(e){return{role:"user",content:e.map(t=>({type:"tool_result",tool_use_id:t.id,content:typeof t.output=="string"?t.output:JSON.stringify(t.output),is_error:!!t.isError}))}}formatAssistantWithToolCalls(e,t){const n=[];e&&n.push({type:"text",text:e});for(const s of t)n.push({type:"tool_use",id:s.id,name:s.name,input:s.input});return{role:"assistant",content:n}}}class xR{async complete(){return{text:"",toolCalls:[],stopReason:"end_turn"}}formatToolResults(){return{role:"user",content:[]}}formatAssistantWithToolCalls(e){return{role:"assistant",content:e||""}}}function bR(i={}){const e=i.provider||"anthropic";if(e==="anthropic")return new mR(i);if(e==="none")return new xR;throw new Error(`Unsupported provider: ${e}. Supported: anthropic, none`)}class ER{constructor({voiceId:e="default",rate:t=1,pitch:n=1,lang:s="en-US"}={}){this.voiceId=e,this.rate=t,this.pitch=n,this.lang=s,this._queue=[],this._speaking=!1}async speak(e,{onStart:t,onEnd:n}={}){if("speechSynthesis"in window)return new Promise(s=>{const r=new SpeechSynthesisUtterance(e);r.rate=this.rate,r.pitch=this.pitch,r.lang=this.lang;const a=this._pickVoice();a&&(r.voice=a),r.onstart=()=>{this._speaking=!0,t?.()},r.onend=()=>{this._speaking=!1,n?.(),s()},r.onerror=()=>{this._speaking=!1,s()},window.speechSynthesis.speak(r)})}cancel(){"speechSynthesis"in window&&window.speechSynthesis.cancel(),this._speaking=!1}get speaking(){return this._speaking}_pickVoice(){if(!("speechSynthesis"in window))return null;const e=window.speechSynthesis.getVoices();if(this.voiceId&&this.voiceId!=="default"){const t=e.find(n=>n.name===this.voiceId||n.voiceURI===this.voiceId);if(t)return t}return e.find(t=>t.lang?.startsWith(this.lang.slice(0,2)))||null}}class yR{constructor({language:e="en-US",continuous:t=!1,interimResults:n=!0}={}){this.language=e,this.continuous=t,this.interimResults=n,this._recognition=null,this._listening=!1}_ensure(){if(this._recognition)return this._recognition;const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e)return null;const t=new e;return t.lang=this.language,t.continuous=this.continuous,t.interimResults=this.interimResults,this._recognition=t,t}async listen({onInterim:e,onFinal:t}={}){const n=this._ensure();if(!n)throw new Error("SpeechRecognition unavailable in this browser");return new Promise((s,r)=>{let a="";n.onresult=o=>{for(let c=o.resultIndex;c<o.results.length;c++){const l=o.results[c],h=l[0].transcript;l.isFinal?(a+=h,t?.(h)):e?.(h)}},n.onerror=o=>{this._listening=!1,r(o.error)},n.onend=()=>{this._listening=!1,s(a.trim())},this._listening=!0;try{n.start()}catch(o){this._listening=!1,r(o)}})}stop(){this._recognition&&this._listening&&this._recognition.stop()}get listening(){return this._listening}}class _R{constructor({voiceId:e,modelId:t="eleven_turbo_v2_5",apiKey:n=null,proxyURL:s=null,rate:r=1,pitch:a=1,lang:o="en-US",stability:c=.5,similarityBoost:l=.75,useSpeakerBoost:h=!0}={}){if(!e)throw new Error("ElevenLabsTTS requires voiceId");this.voiceId=e,this.modelId=t,this.apiKey=n,this.proxyURL=s,this.rate=r,this.pitch=a,this.lang=o,this.stability=c,this.similarityBoost=l,this.useSpeakerBoost=h,this._speaking=!1,this._abort=null,this._audio=null,this._mediaSourceURL=null,this._onEnd=null}async speak(e,{onStart:t,onEnd:n}={}){if(this.cancel(),!e)return;this._abort=new AbortController,this._speaking=!0;const s=this.proxyURL||`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(this.voiceId)}/stream`,r={"content-type":"application/json",accept:"audio/mpeg"};!this.proxyURL&&this.apiKey&&(r["xi-api-key"]=this.apiKey);const a=Math.min(1.5,Math.max(.5,this.rate)),o=Math.min(1,Math.max(0,(a-.5)/1)),c=JSON.stringify({text:e,model_id:this.modelId,voice_settings:{stability:this.stability,similarity_boost:this.similarityBoost,style:o,use_speaker_boost:this.useSpeakerBoost},voiceId:this.voiceId,modelId:this.modelId});let l;try{l=await fetch(s,{method:"POST",headers:r,body:c,signal:this._abort.signal})}catch(d){if(this._speaking=!1,d.name==="AbortError")return;throw d}if(!l.ok)throw this._speaking=!1,new Error(`ElevenLabs TTS HTTP ${l.status}`);const h=typeof MediaSource<"u"&&MediaSource.isTypeSupported("audio/mpeg"),u=d=>{this._startedFired||(this._startedFired=!0,d?.())};return this._startedFired=!1,new Promise(d=>{this._onEnd=()=>{this._speaking=!1,this._cleanupAudio(),n?.(),this._onEnd=null,d()};const f=()=>{this._onEnd&&this._onEnd()};h&&l.body?this._playStreamingMSE(l.body,()=>u(t),f):this._playBuffered(l,()=>u(t),f)})}cancel(){if(this._abort){try{this._abort.abort()}catch{}this._abort=null}this._cleanupAudio(),this._speaking=!1,this._onEnd&&this._onEnd()}get speaking(){return this._speaking}_playStreamingMSE(e,t,n){const s=new MediaSource;this._mediaSourceURL=URL.createObjectURL(s);const r=new Audio(this._mediaSourceURL);this._audio=r,r.preload="auto",r.addEventListener("playing",t,{once:!0}),r.addEventListener("ended",()=>this._onEnd?.(),{once:!0}),r.addEventListener("error",()=>n?.(),{once:!0}),s.addEventListener("sourceopen",async()=>{let a;try{a=s.addSourceBuffer("audio/mpeg")}catch{n?.();return}const o=e.getReader(),c=[];let l=!0;const h=()=>{if(!l||a.updating)return;const u=c.shift();if(u)try{a.appendBuffer(u)}catch{l=!1;try{s.endOfStream()}catch{}}};a.addEventListener("updateend",h);try{for(;l;){const{value:u,done:d}=await o.read();if(d){l=!1;const f=()=>{if(a.updating||c.length)setTimeout(f,30);else try{s.endOfStream()}catch{}};f();break}c.push(u),h()}}catch(u){u.name!=="AbortError"&&n?.()}}),r.play().catch(n)}async _playBuffered(e,t,n){try{const s=await e.blob(),r=URL.createObjectURL(s);this._mediaSourceURL=r;const a=new Audio(r);this._audio=a,a.addEventListener("playing",t,{once:!0}),a.addEventListener("ended",()=>this._onEnd?.(),{once:!0}),a.addEventListener("error",()=>n?.(),{once:!0}),await a.play()}catch(s){s.name!=="AbortError"&&n?.()}}_cleanupAudio(){if(this._audio){try{this._audio.pause()}catch{}this._audio.src="",this._audio=null}if(this._mediaSourceURL){try{URL.revokeObjectURL(this._mediaSourceURL)}catch{}this._mediaSourceURL=null}this._startedFired=!1}}function wR(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new ER(i);if(e==="elevenlabs")return new _R(i);throw new Error(`TTS provider "${e}" not implemented yet`)}function vR(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new yR(i);throw new Error(`STT provider "${e}" not implemented yet`)}const q0=[{name:"wave",description:"Wave at the user. Use for greetings, farewells, or acknowledgments.",input_schema:{type:"object",properties:{duration_ms:{type:"integer",minimum:500,maximum:5e3,default:1500}}}},{name:"lookAt",description:"Direct the agent's gaze toward a target.",input_schema:{type:"object",properties:{target:{type:"string",enum:["user","camera","center"],description:"Where to look"}},required:["target"]}},{name:"play_clip",description:"Play a named animation clip from the loaded body.",input_schema:{type:"object",properties:{name:{type:"string"},loop:{type:"boolean",default:!1},fade_ms:{type:"integer",default:200}},required:["name"]}},{name:"setExpression",description:"Set facial expression via morph target preset.",input_schema:{type:"object",properties:{preset:{type:"string",enum:["neutral","happy","sad","surprised","confused","focused"]},intensity:{type:"number",minimum:0,maximum:1,default:1}},required:["preset"]}},{name:"speak",description:"Say something out loud via TTS. Use this instead of plain text when voice is on.",input_schema:{type:"object",properties:{text:{type:"string"}},required:["text"]}},{name:"remember",description:"Save a durable memory about the user, a feedback rule, a project fact, or a reference.",input_schema:{type:"object",properties:{key:{type:"string",description:'short snake_case filename, e.g. "user_role"'},name:{type:"string"},description:{type:"string"},type:{type:"string",enum:["user","feedback","project","reference"]},body:{type:"string"}},required:["key","name","description","type","body"]}}],CR=[{name:"observe_agents",description:"List the other agents currently sharing this stage, with their names and positions.",input_schema:{type:"object",properties:{}}},{name:"say_to_agent",description:"Send a message to another agent on the same stage. The target agent will receive it as a user turn and reply in their own chat chrome.",input_schema:{type:"object",properties:{agentId:{type:"string",description:"Target agent id as returned by observe_agents."},text:{type:"string"}},required:["agentId","text"]}}],IR={async wave(i,e){const t=i.duration_ms||1500;return await e.viewer.playAnimationByHint?.("wave",{duration:t}),e.memory.note("waved",{duration_ms:t}),{ok:!0}},async lookAt(i,e){const t=i.target||"user";return e.viewer.lookAt?.(t),{ok:!0,target:t}},async play_clip(i,e){const{name:t,loop:n=!1,fade_ms:s=200}=i,r=e.viewer.resolveAnimationSlot?.(t)??t;return e.viewer.playClipByName?.(r,{loop:n,fade_ms:s})?{ok:!0,name:t,resolved:r}:(r!==t&&console.warn(`[play_clip] slot "${t}" → "${r}" not found in library`),{ok:!1,error:`No clip named "${r}"`})},async setExpression(i,e){const{preset:t,intensity:n=1}=i;return e.viewer.setExpression?.(t,n),{ok:!0,preset:t}},async speak(i,e){return await e.speak(i.text),{ok:!0}},async remember(i,e){const{key:t,name:n,description:s,type:r,body:a}=i;return e.memory.write(t,{name:n,description:s,type:r,body:a}),{ok:!0,saved:t}},async observe_agents(i,e){return e.stage?{ok:!0,agents:e.stage.getAgents().filter(n=>n.agentId!==e.agentId).map(({agentId:n,name:s,position:r})=>({agentId:n,name:s,position:r}))}:{ok:!1,error:"not on a stage"}},async say_to_agent(i,e){if(!e.stage)return{ok:!1,error:"not on a stage"};const{agentId:t,text:n}=i;if(!t||!n)return{ok:!1,error:"agentId and text required"};const s=e.agentId||"anon";return e.stage.broadcast(s,{kind:"direct",to:t,text:n}),e.stage.routeMessage(s,t,n)}},SR=8;class K0 extends EventTarget{constructor({manifest:e,viewer:t,memory:n,skills:s,providerConfig:r={},voiceConfig:a={},stage:o=null,agentId:c=null}={}){super(),this.manifest=e||{},this.viewer=t,this.memory=n,this.skills=s,this.stage=o,this.agentId=c,this.provider=bR({...this.manifest.brain,...r}),this.tts=wR({...this.manifest.voice?.tts,...a.tts}),this.stt=vR({...this.manifest.voice?.stt,...a.stt}),this.messages=[],this._busy=!1}get systemPrompt(){const e=[];return this.manifest.instructions&&e.push(this.manifest.instructions),this.memory&&e.push(`
+`)}let qd=null,BM;function TM(){return qd===null&&(qd=new Intl.Segmenter(BM,{granularity:"word"})),qd}const RM=new RegExp("\\p{Script=Arabic}","u"),Gl=new RegExp("\\p{M}","u"),Sm=new RegExp("\\p{Nd}","u");function Mm(i){return RM.test(i)}function Bm(i){return i>=19968&&i<=40959||i>=13312&&i<=19903||i>=131072&&i<=173791||i>=173824&&i<=177983||i>=177984&&i<=178207||i>=178208&&i<=183983||i>=183984&&i<=191471||i>=191472&&i<=192093||i>=194560&&i<=195103||i>=196608&&i<=201551||i>=201552&&i<=205743||i>=205744&&i<=210041||i>=63744&&i<=64255||i>=12288&&i<=12351||i>=12352&&i<=12447||i>=12448&&i<=12543||i>=44032&&i<=55215||i>=65280&&i<=65519}function _r(i){for(let e=0;e<i.length;e++){const t=i.charCodeAt(e);if(!(t<12288)){if(t>=55296&&t<=56319&&e+1<i.length){const n=i.charCodeAt(e+1);if(n>=56320&&n<=57343){const s=(t-55296<<10)+(n-56320)+65536;if(Bm(s))return!0;e++;continue}}if(Bm(t))return!0}}return!1}function FM(i){const e=zl(i);return e!==null&&(Kd.has(e)||wr.has(e))}const NM=new Set([" "," ","⁠","\uFEFF"]);function DM(i){return _r(i)}function LM(i){const e=zl(i);return e!==null&&NM.has(e)}function PM(i){return!FM(i)&&!LM(i)}const Kd=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),Hl=new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),jd=new Set(["'","’"]),wr=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),kM=new Set([":",".","،","؛"]),UM=new Set(["၏"]),OM=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function QM(i){if(Xd(i))return!0;let e=!1;for(const t of i){if(wr.has(t)){e=!0;continue}if(!(e&&Gl.test(t)))return!1}return e}function GM(i){for(const e of i)if(!Kd.has(e)&&!wr.has(e))return!1;return i.length>0}function HM(i){if(Xd(i))return!0;for(const e of i)if(!Hl.has(e)&&!jd.has(e)&&!Gl.test(e))return!1;return i.length>0}function Xd(i){let e=!1;for(const t of i)if(!(t==="\\"||Gl.test(t))){if(Hl.has(t)||wr.has(t)||jd.has(t)){e=!0;continue}return!1}return e}function Tm(i,e){const t=e-1;if(t<=0)return Math.max(t,0);const n=i.charCodeAt(t);if(n<56320||n>57343)return t;const s=t-1;if(s<0)return t;const r=i.charCodeAt(s);return r>=55296&&r<=56319?s:t}function zl(i){if(i.length===0)return null;const e=Tm(i,i.length);return i.slice(e)}function zM(i){const e=Array.from(i);let t=e.length;for(;t>0;){const n=e[t-1];if(Gl.test(n)){t--;continue}if(Hl.has(n)||jd.has(n)){t--;continue}break}return t<=0||t===e.length?null:{head:e.slice(0,t).join(""),tail:e.slice(t).join("")}}function VM(i,e,t){return t==="text"&&!e&&i.length===1&&i!=="-"&&i!=="—"?i:null}function Rm(i,e,t,n){const s=e[n],r=i[n];if(s==null)return r;const a=t[n];if(r.length===a)return r;const o=s.repeat(a);return i[n]=o,o}function Fm(i,e){return i&&e!==null&&kM.has(e)}function WM(i){const e=zl(i);return e!==null&&UM.has(e)}function qM(i){if(i.length<2||i[0]!==" ")return null;const e=i.slice(1);return new RegExp("^\\p{M}+$","u").test(e)?{space:" ",marks:e}:null}function Yd(i){let e=i.length;for(;e>0;){const t=Tm(i,e),n=i.slice(t,e);if(OM.has(n))return!0;if(!wr.has(n))return!1;e=t}return!1}function KM(i,e){if(e.preserveOrdinarySpaces||e.preserveHardBreaks){if(i===" ")return"preserved-space";if(i===" ")return"tab";if(e.preserveHardBreaks&&i===`
+`)return"hard-break"}return i===" "?"space":i===" "||i===" "||i==="⁠"||i==="\uFEFF"?"glue":i==="​"?"zero-width-break":i==="­"?"soft-hyphen":"text"}const jM=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function hi(i){return i.length===1?i[0]:i.join("")}function XM(i,e){const t=[];for(let n=i.length-1;n>=0;n--)t.push(i[n]);return t.push(e),hi(t)}function YM(i,e,t,n){if(!jM.test(i))return[{text:i,isWordLike:e,kind:"text",start:t}];const s=[];let r=null,a=[],o=t,c=!1,l=0;for(const h of i){const u=KM(h,n),d=u==="text"&&e;if(r!==null&&u===r&&d===c){a.push(h),l+=h.length;continue}r!==null&&s.push({text:hi(a),isWordLike:c,kind:r,start:o}),r=u,a=[h],o=t+l,c=d,l+=h.length}return r!==null&&s.push({text:hi(a),isWordLike:c,kind:r,start:o}),s}function Jd(i){return i==="space"||i==="preserved-space"||i==="zero-width-break"||i==="hard-break"}const JM=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function ZM(i,e){const t=i.texts[e];return t.startsWith("www.")?!0:JM.test(t)&&e+1<i.len&&i.kinds[e+1]==="text"&&i.texts[e+1]==="//"}function $M(i){return i.includes("?")&&(i.includes("://")||i.startsWith("www."))}function eB(i){const e=i.texts.slice(),t=i.isWordLike.slice(),n=i.kinds.slice(),s=i.starts.slice();for(let a=0;a<i.len;a++){if(n[a]!=="text"||!ZM(i,a))continue;const o=[e[a]];let c=a+1;for(;c<i.len&&!Jd(n[c]);){o.push(e[c]),t[a]=!0;const l=e[c].includes("?");if(n[c]="text",e[c]="",c++,l)break}e[a]=hi(o)}let r=0;for(let a=0;a<e.length;a++){const o=e[a];o.length!==0&&(r!==a&&(e[r]=o,t[r]=t[a],n[r]=n[a],s[r]=s[a]),r++)}return e.length=r,t.length=r,n.length=r,s.length=r,{len:r,texts:e,isWordLike:t,kinds:n,starts:s}}function tB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r];if(e.push(a),t.push(i.isWordLike[r]),n.push(i.kinds[r]),s.push(i.starts[r]),!$M(a))continue;const o=r+1;if(o>=i.len||Jd(i.kinds[o]))continue;const c=[],l=i.starts[o];let h=o;for(;h<i.len&&!Jd(i.kinds[h]);)c.push(i.texts[h]),h++;c.length>0&&(e.push(hi(c)),t.push(!0),n.push("text"),s.push(l),r=h-1)}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}const nB=new Set([":","-","/","×",",",".","+","–","—"]),Nm=/^[A-Za-z0-9_]+[,:;]*$/,Dm=/[,:;]+$/;function Lm(i){for(const e of i)if(Sm.test(e))return!0;return!1}function Vl(i){if(i.length===0)return!1;for(const e of i)if(!(Sm.test(e)||nB.has(e)))return!1;return!0}function iB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r],o=i.kinds[r];if(o==="text"&&Vl(a)&&Lm(a)){const c=[a];let l=r+1;for(;l<i.len&&i.kinds[l]==="text"&&Vl(i.texts[l]);)c.push(i.texts[l]),l++;e.push(hi(c)),t.push(!0),n.push("text"),s.push(i.starts[r]),r=l-1;continue}e.push(a),t.push(i.isWordLike[r]),n.push(o),s.push(i.starts[r])}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function sB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r],o=i.kinds[r],c=i.isWordLike[r];if(o==="text"&&c&&Nm.test(a)){const l=[a];let h=Dm.test(a),u=r+1;for(;h&&u<i.len&&i.kinds[u]==="text"&&i.isWordLike[u]&&Nm.test(i.texts[u]);){const d=i.texts[u];l.push(d),h=Dm.test(d),u++}e.push(hi(l)),t.push(!0),n.push("text"),s.push(i.starts[r]),r=u-1;continue}e.push(a),t.push(c),n.push(o),s.push(i.starts[r])}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function rB(i){const e=[],t=[],n=[],s=[];for(let r=0;r<i.len;r++){const a=i.texts[r];if(i.kinds[r]==="text"&&a.includes("-")){const o=a.split("-");let c=o.length>1;for(let l=0;l<o.length;l++){const h=o[l];if(!c)break;(h.length===0||!Lm(h)||!Vl(h))&&(c=!1)}if(c){let l=0;for(let h=0;h<o.length;h++){const u=o[h],d=h<o.length-1?`${u}-`:u;e.push(d),t.push(!0),n.push("text"),s.push(i.starts[r]+l),l+=d.length}continue}}e.push(a),t.push(i.isWordLike[r]),n.push(i.kinds[r]),s.push(i.starts[r])}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function aB(i){const e=[],t=[],n=[],s=[];let r=0;for(;r<i.len;){const a=[i.texts[r]];let o=i.isWordLike[r],c=i.kinds[r],l=i.starts[r];if(c==="glue"){const h=[a[0]],u=l;for(r++;r<i.len&&i.kinds[r]==="glue";)h.push(i.texts[r]),r++;const d=hi(h);if(r<i.len&&i.kinds[r]==="text")a[0]=d,a.push(i.texts[r]),o=i.isWordLike[r],c="text",l=u,r++;else{e.push(d),t.push(!1),n.push("glue"),s.push(u);continue}}else r++;if(c==="text")for(;r<i.len&&i.kinds[r]==="glue";){const h=[];for(;r<i.len&&i.kinds[r]==="glue";)h.push(i.texts[r]),r++;const u=hi(h);if(r<i.len&&i.kinds[r]==="text"){a.push(u,i.texts[r]),o=o||i.isWordLike[r],r++;continue}a.push(u)}e.push(hi(a)),t.push(o),n.push(c),s.push(l)}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function oB(i){const e=i.texts.slice(),t=i.isWordLike.slice(),n=i.kinds.slice(),s=i.starts.slice();for(let r=0;r<e.length-1;r++){if(n[r]!=="text"||n[r+1]!=="text"||!_r(e[r])||!_r(e[r+1]))continue;const a=zM(e[r]);a!==null&&(e[r]=a.head,e[r+1]=a.tail+e[r+1],s[r+1]=s[r]+a.head.length)}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function Pm(i,e,t){const n=TM();let s=0;const r=[],a=[],o=[],c=[],l=[],h=[],u=[],d=[],f=[],p=[],m=[],g=[];for(const w of n.segment(i))for(const I of YM(w.segment,w.isWordLike??!1,w.index,t)){let O=function(){h[D]!==null&&(a[D]=[Rm(r,h,u,D)],h[D]=null),a[D].push(I.text),o[D]=o[D]||I.isWordLike,d[D]=d[D]||v,f[D]=f[D]||F,p[D]=q,m[D]=$,g[D]=Fm(f[D],K)};const T=I.kind==="text",C=VM(I.text,I.isWordLike,I.kind),v=_r(I.text),F=Mm(I.text),K=zl(I.text),q=Yd(I.text),$=WM(I.text),D=s-1;e.carryCJKAfterClosingQuote&&T&&s>0&&c[D]==="text"&&v&&d[D]&&p[D]||T&&s>0&&c[D]==="text"&&GM(I.text)&&d[D]||T&&s>0&&c[D]==="text"&&m[D]?O():T&&s>0&&c[D]==="text"&&I.isWordLike&&F&&g[D]?(O(),o[D]=!0):C!==null&&s>0&&c[D]==="text"&&h[D]===C?u[D]=(u[D]??1)+1:T&&!I.isWordLike&&s>0&&c[D]==="text"&&(QM(I.text)||I.text==="-"&&o[D])?O():(r[s]=I.text,a[s]=[I.text],o[s]=I.isWordLike,c[s]=I.kind,l[s]=I.start,h[s]=C,u[s]=C===null?0:1,d[s]=v,f[s]=F,p[s]=q,m[s]=$,g[s]=Fm(F,K),s++)}for(let w=0;w<s;w++){if(h[w]!==null){r[w]=Rm(r,h,u,w);continue}r[w]=hi(a[w])}for(let w=1;w<s;w++)c[w]==="text"&&!o[w]&&Xd(r[w])&&c[w-1]==="text"&&(r[w-1]+=r[w],o[w-1]=o[w-1]||o[w],r[w]="");const A=Array.from({length:s},()=>null);let _=-1;for(let w=s-1;w>=0;w--){const I=r[w];if(I.length!==0){if(c[w]==="text"&&!o[w]&&HM(I)&&_>=0&&c[_]==="text"){const T=A[_]??[];T.push(I),A[_]=T,l[_]=l[w],r[w]="";continue}_=w}}for(let w=0;w<s;w++){const I=A[w];I!=null&&(r[w]=XM(I,r[w]))}let x=0;for(let w=0;w<s;w++){const I=r[w];I.length!==0&&(x!==w&&(r[x]=I,o[x]=o[w],c[x]=c[w],l[x]=l[w]),x++)}r.length=x,o.length=x,c.length=x,l.length=x;const E=aB({len:x,texts:r,isWordLike:o,kinds:c,starts:l}),S=oB(sB(rB(iB(tB(eB(E))))));for(let w=0;w<S.len-1;w++){const I=qM(S.texts[w]);I!==null&&(S.kinds[w]!=="space"&&S.kinds[w]!=="preserved-space"||S.kinds[w+1]!=="text"||!Mm(S.texts[w+1])||(S.texts[w]=I.space,S.isWordLike[w]=!1,S.kinds[w]=S.kinds[w]==="preserved-space"?"preserved-space":"space",S.texts[w+1]=I.marks+S.texts[w+1],S.starts[w+1]=S.starts[w]+I.space.length))}return S}function cB(i,e){if(i.len===0)return[];if(!e.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:i.len,consumedEndSegmentIndex:i.len}];const t=[];let n=0;for(let s=0;s<i.len;s++)i.kinds[s]==="hard-break"&&(t.push({startSegmentIndex:n,endSegmentIndex:s,consumedEndSegmentIndex:s+1}),n=s+1);return n<i.len&&t.push({startSegmentIndex:n,endSegmentIndex:i.len,consumedEndSegmentIndex:i.len}),t}function lB(i){if(i.len<=1)return i;const e=[],t=[],n=[],s=[];let r=null,a=!1,o=0,c=!1,l=!1;function h(){r!==null&&(e.push(hi(r)),t.push(a),n.push("text"),s.push(o),r=null)}for(let u=0;u<i.len;u++){const d=i.texts[u],f=i.kinds[u],p=i.isWordLike[u],m=i.starts[u];if(f==="text"){const g=DM(d),A=PM(d);if(r!==null&&c&&l){r.push(d),a=a||p,c=c||g,l=A;continue}h(),r=[d],a=p,o=m,c=g,l=A;continue}h(),e.push(d),t.push(p),n.push(f),s.push(m)}return h(),{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function hB(i,e,t="normal",n="normal"){const s=IM(t),r=s.mode==="pre-wrap"?MM(i):SM(i);if(r.length===0)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const a=n==="keep-all"?lB(Pm(r,e,s)):Pm(r,e,s);return{normalized:r,chunks:cB(a,s),...a}}let Ba=null;const km=new Map;let Ta=null;const uB=96,dB=new RegExp("\\p{Emoji_Presentation}","u"),fB=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Zd=null;const Um=new Map;function $d(){if(Ba!==null)return Ba;if(typeof OffscreenCanvas<"u")return Ba=new OffscreenCanvas(1,1).getContext("2d"),Ba;if(typeof document<"u")return Ba=document.createElement("canvas").getContext("2d"),Ba;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function pB(i){let e=km.get(i);return e||(e=new Map,km.set(i,e)),e}function Vs(i,e){let t=e.get(i);return t===void 0&&(t={width:$d().measureText(i).width,containsCJK:_r(i)},e.set(i,t)),t}function Ra(){if(Ta!==null)return Ta;if(typeof navigator>"u")return Ta={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ta;const i=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&i.includes("Safari/")&&!i.includes("Chrome/")&&!i.includes("Chromium/")&&!i.includes("CriOS/")&&!i.includes("FxiOS/")&&!i.includes("EdgiOS/"),n=i.includes("Chrome/")||i.includes("Chromium/")||i.includes("CriOS/")||i.includes("Edg/");return Ta={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},Ta}function AB(i){const e=i.match(/(\d+(?:\.\d+)?)\s*px/);return e?parseFloat(e[1]):16}function Om(){return Zd===null&&(Zd=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Zd}function gB(i){return dB.test(i)||i.includes("️")}function mB(i){return fB.test(i)}function xB(i,e){let t=Um.get(i);if(t!==void 0)return t;const n=$d();n.font=i;const s=n.measureText("😀").width;if(t=0,s>e+.5&&typeof document<"u"&&document.body!==null){const r=document.createElement("span");r.style.font=i,r.style.display="inline-block",r.style.visibility="hidden",r.style.position="absolute",r.textContent="😀",document.body.appendChild(r);const a=r.getBoundingClientRect().width;document.body.removeChild(r),s-a>.5&&(t=s-a)}return Um.set(i,t),t}function bB(i){let e=0;const t=Om();for(const n of t.segment(i))gB(n.segment)&&e++;return e}function EB(i,e){return e.emojiCount===void 0&&(e.emojiCount=bB(i)),e.emojiCount}function vr(i,e,t){return t===0?e.width:e.width-EB(i,e)*t}function yB(i,e,t,n,s){if(e.breakableFitAdvances!==void 0)return e.breakableFitAdvances;const r=Om(),a=[];for(const h of r.segment(i))a.push(h.segment);if(a.length<=1)return e.breakableFitAdvances=null,e.breakableFitAdvances;if(s==="sum-graphemes"){const h=[];for(const u of a){const d=Vs(u,t);h.push(vr(u,d,n))}return e.breakableFitAdvances=h,e.breakableFitAdvances}if(s==="pair-context"||a.length>uB){const h=[];let u=null,d=0;for(const f of a){const p=Vs(f,t),m=vr(f,p,n);if(u===null)h.push(m);else{const g=u+f,A=Vs(g,t);h.push(vr(g,A,n)-d)}u=f,d=m}return e.breakableFitAdvances=h,e.breakableFitAdvances}const o=[];let c="",l=0;for(const h of a){c+=h;const u=Vs(c,t),d=vr(c,u,n);o.push(d-l),l=d}return e.breakableFitAdvances=o,e.breakableFitAdvances}function _B(i,e){const t=$d();t.font=i;const n=pB(i),s=AB(i),r=e?xB(i,s):0;return{cache:n,fontSize:s,emojiCorrection:r}}function wB(i,e){for(;e<i.widths.length;){const t=i.kinds[e];if(t!=="space"&&t!=="zero-width-break"&&t!=="soft-hyphen")break;e++}return e}function Qm(i,e){if(e<=0)return 0;const t=i%e;return Math.abs(t)<=1e-6?e:e-t}function Gm(i,e,t,n,s){let r=0,a=e;for(;r<i.length;){const o=a+i[r];if((r+1<i.length?o+s:o)>t+n)break;a=o,r++}return{fitCount:r,fittedWidth:a}}function vB(i,e){let t=0,n=i.chunks.length;for(;t<n;){const s=Math.floor((t+n)/2);e<i.chunks[s].consumedEndSegmentIndex?n=s:t=s+1}return t<i.chunks.length?t:-1}function Hm(i,e,t){let n=t.segmentIndex;if(t.graphemeIndex>0)return e;const s=i.chunks[e];if(s.startSegmentIndex===s.endSegmentIndex&&n===s.startSegmentIndex)return t.segmentIndex=n,t.graphemeIndex=0,e;for(n<s.startSegmentIndex&&(n=s.startSegmentIndex);n<s.endSegmentIndex;){const r=i.kinds[n];if(r!=="space"&&r!=="zero-width-break"&&r!=="soft-hyphen")return t.segmentIndex=n,t.graphemeIndex=0,e;n++}return s.consumedEndSegmentIndex>=i.widths.length?-1:(t.segmentIndex=s.consumedEndSegmentIndex,t.graphemeIndex=0,e+1)}function ef(i,e){if(e.segmentIndex>=i.widths.length)return-1;const t=vB(i,e.segmentIndex);return t<0?-1:Hm(i,t,e)}function CB(i,e,t){if(t.segmentIndex>=i.widths.length)return-1;let n=e;for(;n<i.chunks.length&&t.segmentIndex>=i.chunks[n].consumedEndSegmentIndex;)n++;return n>=i.chunks.length?-1:Hm(i,n,t)}function IB(i,e){return i.simpleLineWalkFastPath?zm(i,e):tf(i,e)}function zm(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i;if(n.length===0)return 0;const o=Ra().lineFitEpsilon,c=e+o;let l=0,h=0,u=!1,d=0,f=0,p=0,m=0,g=-1,A=0;function _(){g=-1,A=0}function x(C=p,v=m,F=h){l++,t?.({startSegmentIndex:d,startGraphemeIndex:f,endSegmentIndex:C,endGraphemeIndex:v,width:F}),h=0,u=!1,_()}function E(C,v){u=!0,d=C,f=0,p=C+1,m=0,h=v}function S(C,v,F){u=!0,d=C,f=v,p=C,m=v+1,h=F}function w(C,v){if(!u){E(C,v);return}h+=v,p=C+1,m=0}function I(C,v){const F=r[C];for(let K=v;K<F.length;K++){const q=F[K];u?h+q>c?(x(),S(C,K,q)):(h+=q,p=C,m=K+1):S(C,K,q)}u&&p===C&&m===F.length&&(p=C+1,m=0)}let T=0;for(;T<n.length&&!(!u&&(T=wB(i,T),T>=n.length));){const C=n[T],v=s[T],F=v==="space"||v==="preserved-space"||v==="tab"||v==="zero-width-break"||v==="soft-hyphen";if(!u){C>e&&r[T]!==null?I(T,0):E(T,C),F&&(g=T+1,A=h-C),T++;continue}if(h+C>c){if(F){w(T,C),x(T+1,0,h-C),T++;continue}if(g>=0){if(p>g||p===g&&m>0){x();continue}x(g,0,A);continue}if(C>e&&r[T]!==null){x(),I(T,0),T++;continue}x();continue}w(T,C),F&&(g=T+1,A=h-C),T++}return u&&x(),l}function tf(i,e,t){if(i.simpleLineWalkFastPath)return zm(i,e,t);const{widths:n,lineEndFitAdvances:s,lineEndPaintAdvances:r,kinds:a,breakableFitAdvances:o,discretionaryHyphenWidth:c,tabStopAdvance:l,chunks:h}=i;if(n.length===0||h.length===0)return 0;const u=Ra(),d=u.lineFitEpsilon,f=e+d;let p=0,m=0,g=!1,A=0,_=0,x=0,E=0,S=-1,w=0,I=0,T=null;function C(){S=-1,w=0,I=0,T=null}function v(Q=x,J=E,ee=m){p++,t?.({startSegmentIndex:A,startGraphemeIndex:_,endSegmentIndex:Q,endGraphemeIndex:J,width:ee}),m=0,g=!1,C()}function F(Q,J){g=!0,A=Q,_=0,x=Q+1,E=0,m=J}function K(Q,J,ee){g=!0,A=Q,_=J,x=Q,E=J+1,m=ee}function q(Q,J){if(!g){F(Q,J);return}m+=J,x=Q+1,E=0}function $(Q,J,ee,ae){if(!J)return;const _e=Q==="tab"?0:s[ee],Me=Q==="tab"?ae:r[ee];S=ee+1,w=m-ae+_e,I=m-ae+Me,T=Q}function D(Q,J){const ee=o[Q];for(let ae=J;ae<ee.length;ae++){const _e=ee[ae];g?m+_e>f?(v(),K(Q,ae,_e)):(m+=_e,x=Q,E=ae+1):K(Q,ae,_e)}g&&x===Q&&E===ee.length&&(x=Q+1,E=0)}function O(Q){if(T!=="soft-hyphen")return!1;const J=o[Q];if(J==null)return!1;const{fitCount:ee,fittedWidth:ae}=Gm(J,m,e,d,c);return ee===0?!1:(m=ae,x=Q,E=ee,C(),ee===J.length?(x=Q+1,E=0,!0):(v(Q,ee,ae+c),D(Q,ee),!0))}function Y(Q){p++,t?.({startSegmentIndex:Q.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:Q.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),C()}for(let Q=0;Q<h.length;Q++){const J=h[Q];if(J.startSegmentIndex===J.endSegmentIndex){Y(J);continue}g=!1,m=0,A=J.startSegmentIndex,_=0,x=J.startSegmentIndex,E=0,C();let ee=J.startSegmentIndex;for(;ee<J.endSegmentIndex;){const ae=a[ee],_e=ae==="space"||ae==="preserved-space"||ae==="tab"||ae==="zero-width-break"||ae==="soft-hyphen",Me=ae==="tab"?Qm(m,l):n[ee];if(ae==="soft-hyphen"){g&&(x=ee+1,E=0,S=ee+1,w=m+c,I=m+c,T=ae),ee++;continue}if(!g){Me>e&&o[ee]!==null?D(ee,0):F(ee,Me),$(ae,_e,ee,Me),ee++;continue}if(m+Me>f){const me=m+(ae==="tab"?0:s[ee]),xe=m+(ae==="tab"?Me:r[ee]);if(T==="soft-hyphen"&&u.preferEarlySoftHyphenBreak&&w<=f){v(S,0,I);continue}if(T==="soft-hyphen"&&O(ee)){ee++;continue}if(_e&&me<=f){q(ee,Me),v(ee+1,0,xe),ee++;continue}if(S>=0&&w<=f){if(x>S||x===S&&E>0){v();continue}const be=S;v(be,0,I),ee=be;continue}if(Me>e&&o[ee]!==null){v(),D(ee,0),ee++;continue}v();continue}q(ee,Me),$(ae,_e,ee,Me),ee++}if(g){const ae=S===J.consumedEndSegmentIndex?I:m;v(J.consumedEndSegmentIndex,0,ae)}}return p}function nf(i,e,t,n){const s=i.chunks[t];if(s.startSegmentIndex===s.endSegmentIndex)return e.segmentIndex=s.consumedEndSegmentIndex,e.graphemeIndex=0,0;const{widths:r,lineEndFitAdvances:a,lineEndPaintAdvances:o,kinds:c,breakableFitAdvances:l,discretionaryHyphenWidth:h,tabStopAdvance:u}=i,d=Ra(),f=d.lineFitEpsilon,p=n+f;let m=0,g=!1,A=e.segmentIndex,_=e.graphemeIndex,x=-1,E=0,S=0,w=null;function I(){x=-1,E=0,S=0,w=null}function T(D=A,O=_,Y=m){return g?(e.segmentIndex=D,e.graphemeIndex=O,Y):null}function C(D,O){g=!0,A=D+1,_=0,m=O}function v(D,O,Y){g=!0,A=D,_=O+1,m=Y}function F(D,O){if(!g){C(D,O);return}m+=O,A=D+1,_=0}function K(D,O,Y,Q){if(!O)return;const J=D==="tab"?0:a[Y],ee=D==="tab"?Q:o[Y];x=Y+1,E=m-Q+J,S=m-Q+ee,w=D}function q(D,O){const Y=l[D];for(let Q=O;Q<Y.length;Q++){const J=Y[Q];if(!g)v(D,Q,J);else{if(m+J>p)return T();m+=J,A=D,_=Q+1}}return g&&A===D&&_===Y.length&&(A=D+1,_=0),null}function $(D){if(w!=="soft-hyphen"||x<0)return null;const O=l[D]??null;if(O!==null){const{fitCount:Y,fittedWidth:Q}=Gm(O,m,n,f,h);if(Y===O.length)return m=Q,A=D+1,_=0,I(),null;if(Y>0)return T(D,Y,Q+h)}return E<=p?T(x,0,S):null}for(let D=e.segmentIndex;D<s.endSegmentIndex;D++){const O=c[D],Y=O==="space"||O==="preserved-space"||O==="tab"||O==="zero-width-break"||O==="soft-hyphen",Q=D===e.segmentIndex?e.graphemeIndex:0,J=O==="tab"?Qm(m,u):r[D];if(O==="soft-hyphen"&&Q===0){g&&(A=D+1,_=0,x=D+1,E=m+h,S=m+h,w=O);continue}if(!g){if(Q>0){const ae=q(D,Q);if(ae!==null)return ae}else if(J>n&&l[D]!==null){const ae=q(D,0);if(ae!==null)return ae}else C(D,J);K(O,Y,D,J);continue}if(m+J>p){const ae=m+(O==="tab"?0:a[D]),_e=m+(O==="tab"?J:o[D]);if(w==="soft-hyphen"&&d.preferEarlySoftHyphenBreak&&E<=p)return T(x,0,S);const Me=$(D);if(Me!==null)return Me;if(Y&&ae<=p)return F(D,J),T(D+1,0,_e);if(x>=0&&E<=p)return A>x||A===x&&_>0?T():T(x,0,S);if(J>n&&l[D]!==null){const se=T();if(se!==null)return se;const me=q(D,0);if(me!==null)return me}return T()}F(D,J),K(O,Y,D,J)}return x===s.consumedEndSegmentIndex&&_===0?T(s.consumedEndSegmentIndex,0,S):T(s.consumedEndSegmentIndex,0,m)}function Vm(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i,o=Ra().lineFitEpsilon,c=t+o;let l=0,h=!1,u=e.segmentIndex,d=e.graphemeIndex,f=-1,p=0;for(let m=e.segmentIndex;m<n.length;m++){const g=n[m],A=s[m],_=A==="space"||A==="preserved-space"||A==="tab"||A==="zero-width-break"||A==="soft-hyphen",x=m===e.segmentIndex?e.graphemeIndex:0,E=r[m];if(!h){if(x>0||g>t&&E!==null){const S=E,w=S[x];h=!0,l=w,u=m,d=x+1;for(let I=x+1;I<S.length;I++){const T=S[I];if(l+T>c)return e.segmentIndex=u,e.graphemeIndex=d,l;l+=T,u=m,d=I+1}u===m&&d===S.length&&(u=m+1,d=0)}else h=!0,l=g,u=m+1,d=0;_&&(f=m+1,p=l-g);continue}if(l+g>c)return _?(e.segmentIndex=m+1,e.graphemeIndex=0,l):f>=0?u>f||u===f&&d>0?(e.segmentIndex=u,e.graphemeIndex=d,l):(e.segmentIndex=f,e.graphemeIndex=0,p):(e.segmentIndex=u,e.graphemeIndex=d,l);l+=g,u=m+1,d=0,_&&(f=m+1,p=l-g)}return h?(e.segmentIndex=u,e.graphemeIndex=d,l):null}function sf(i,e,t){const n={segmentIndex:e.segmentIndex,graphemeIndex:e.graphemeIndex},s=ef(i,n);if(s<0)return null;const r=n.segmentIndex,a=n.graphemeIndex,o=i.simpleLineWalkFastPath?Vm(i,n,t):nf(i,n,s,t);return o===null?null:{startSegmentIndex:r,startGraphemeIndex:a,endSegmentIndex:n.segmentIndex,endGraphemeIndex:n.graphemeIndex,width:o}}function SB(i,e,t){const n=ef(i,e);return n<0?null:i.simpleLineWalkFastPath?Vm(i,e,t):nf(i,e,n,t)}function MB(i,e){if(i.widths.length===0)return{lineCount:0,maxLineWidth:0};const t={segmentIndex:0,graphemeIndex:0};let n=0,s=0;if(!i.simpleLineWalkFastPath){let r=ef(i,t);for(;r>=0;){const a=nf(i,t,r,e);if(a===null)return{lineCount:n,maxLineWidth:s};n++,a>s&&(s=a),r=CB(i,r,t)}return{lineCount:n,maxLineWidth:s}}for(;;){const r=SB(i,t,e);if(r===null)return{lineCount:n,maxLineWidth:s};n++,r>s&&(s=r)}}let rf=null,Wm=new WeakMap;function qm(){return rf===null&&(rf=new Intl.Segmenter(void 0,{granularity:"grapheme"})),rf}function BB(i){return i?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function TB(i,e){const t=[];let n=[],s=0,r=!1,a=!1,o=!1;function c(){n.length!==0&&(t.push({text:n.length===1?n[0]:n.join(""),start:s}),n=[],r=!1,a=!1,o=!1)}function l(u,d,f){n=[u],s=d,r=f,a=Yd(u),o=Hl.has(u)}function h(u,d){n.push(u),r=r||d;const f=Yd(u);u.length===1&&wr.has(u)?a=a||f:a=f,o=!1}for(const u of qm().segment(i)){const d=u.segment,f=_r(d);if(n.length===0){l(d,u.index,f);continue}if(o||Kd.has(d)||wr.has(d)||e.carryCJKAfterClosingQuote&&f&&a){h(d,f);continue}if(!r&&!f){h(d,f);continue}c(),l(d,u.index,f)}return c(),t}function RB(i,e,t,n){const s=Ra(),{cache:r,emojiCorrection:a}=_B(e,mB(i.normalized)),o=vr("-",Vs("-",r),a),l=vr(" ",Vs(" ",r),a)*8;if(i.len===0)return BB(t);const h=[],u=[],d=[],f=[];let p=i.chunks.length<=1;const m=t?[]:null,g=[],A=t?[]:null,_=Array.from({length:i.len});function x(I,T,C,v,F,K,q){F!=="text"&&F!=="space"&&F!=="zero-width-break"&&(p=!1),h.push(T),u.push(C),d.push(v),f.push(F),m?.push(K),g.push(q),A!==null&&A.push(I)}function E(I,T,C,v,F){const K=Vs(I,r),q=vr(I,K,a),$=T==="space"||T==="preserved-space"||T==="zero-width-break"?0:q,D=T==="space"||T==="zero-width-break"?0:q;if(F&&v&&I.length>1){let O="sum-graphemes";Vl(I)?O="pair-context":s.preferPrefixWidthsForBreakableRuns&&(O="segment-prefixes");const Y=yB(I,K,r,a,O);x(I,q,$,D,T,C,Y);return}x(I,q,$,D,T,C,null)}for(let I=0;I<i.len;I++){_[I]=h.length;const T=i.texts[I],C=i.isWordLike[I],v=i.kinds[I],F=i.starts[I];if(v==="soft-hyphen"){x(T,0,o,o,v,F,null);continue}if(v==="hard-break"){x(T,0,0,0,v,F,null);continue}if(v==="tab"){x(T,0,0,0,v,F,null);continue}const K=Vs(T,r);if(v==="text"&&K.containsCJK){const $=TB(T,s);for(let D=0;D<$.length;D++){const O=$[D];E(O.text,"text",F+O.start,C,!_r(O.text))}continue}E(T,v,F,C,!0)}const S=FB(i.chunks,_,h.length),w=m===null?null:wM(i.normalized,m);return A!==null?{widths:h,lineEndFitAdvances:u,lineEndPaintAdvances:d,kinds:f,simpleLineWalkFastPath:p,segLevels:w,breakableFitAdvances:g,discretionaryHyphenWidth:o,tabStopAdvance:l,chunks:S,segments:A}:{widths:h,lineEndFitAdvances:u,lineEndPaintAdvances:d,kinds:f,simpleLineWalkFastPath:p,segLevels:w,breakableFitAdvances:g,discretionaryHyphenWidth:o,tabStopAdvance:l,chunks:S}}function FB(i,e,t){const n=[];for(let s=0;s<i.length;s++){const r=i[s],a=r.startSegmentIndex<e.length?e[r.startSegmentIndex]:t,o=r.endSegmentIndex<e.length?e[r.endSegmentIndex]:t,c=r.consumedEndSegmentIndex<e.length?e[r.consumedEndSegmentIndex]:t;n.push({startSegmentIndex:a,endSegmentIndex:o,consumedEndSegmentIndex:c})}return n}function Km(i,e,t,n){const r=hB(i,Ra(),n?.whiteSpace,"normal");return RB(r,e,t)}function Wl(i,e,t){return Km(i,e,!1,t)}function ql(i,e,t){return Km(i,e,!0,t)}function EP(i){return i}function NB(i,e,t){const n=IB(i,e);return{lineCount:n,height:n*t}}function jm(i,e,t){let n=t.get(i);if(n!==void 0)return n;n=[];const s=qm();for(const r of s.segment(e[i]))n.push(r.segment);return t.set(i,n),n}function Xm(i){let e=Wm.get(i);return e!==void 0||(e=new Map,Wm.set(i,e)),e}function DB(i,e,t,n){return n>0&&i[n-1]==="soft-hyphen"&&!(e===n&&t>0)}function LB(i,e,t,n,s,r,a){let o="";const c=DB(e,n,s,r);for(let l=n;l<r;l++)e[l]==="soft-hyphen"||e[l]==="hard-break"||(l===n&&s>0?o+=jm(l,i,t).slice(s).join(""):o+=i[l]);return a>0?(c&&(o+="-"),o+=jm(r,i,t).slice(n===r?s:0,a).join("")):c&&(o+="-"),o}function Ym(i,e,t,n,s,r,a){return{text:LB(i.segments,i.kinds,e,n,s,r,a),width:t,start:{segmentIndex:n,graphemeIndex:s},end:{segmentIndex:r,graphemeIndex:a}}}function PB(i,e,t){return Ym(i,e,t.width,t.startSegmentIndex,t.startGraphemeIndex,t.endSegmentIndex,t.endGraphemeIndex)}function kB(i){return{width:i.width,start:{segmentIndex:i.startSegmentIndex,graphemeIndex:i.startGraphemeIndex},end:{segmentIndex:i.endSegmentIndex,graphemeIndex:i.endGraphemeIndex}}}function UB(i,e){return Ym(i,Xm(i),e.width,e.start.segmentIndex,e.start.graphemeIndex,e.end.segmentIndex,e.end.graphemeIndex)}function OB(i,e,t){return i.widths.length===0?0:tf(i,e,n=>{t(kB(n))})}function af(i,e){return MB(i,e)}function Jm(i){let e=0;return OB(i,Number.POSITIVE_INFINITY,t=>{t.width>e&&(e=t.width)}),e}function QB(i,e,t){const n=[];if(i.widths.length===0)return{lineCount:0,height:0,lines:n};const s=Xm(i),r=tf(i,e,a=>{n.push(PB(i,s,a))});return{lineCount:r,height:r*t,lines:n}}const GB=/[ \t\n\f\r]+/,Zm=/^[ \t\n\f\r]+/,$m=/[ \t\n\f\r]+$/,Kl={segmentIndex:0,graphemeIndex:0},e0={itemIndex:0,segmentIndex:0,graphemeIndex:0};function yP(i){return i}function of(i){return{segmentIndex:i.segmentIndex,graphemeIndex:i.graphemeIndex}}function t0(i){return i.segmentIndex===0&&i.graphemeIndex===0}function jl(i,e){const t=e.get(i);if(t!==void 0)return t;const n=Jm(ql("A A",i)),s=Jm(ql("AA",i)),r=Math.max(0,n-s);return e.set(i,r),r}function HB(i){const e=sf(i,Kl,Number.POSITIVE_INFINITY);return e===null?null:{endGraphemeIndex:e.endGraphemeIndex,endSegmentIndex:e.endSegmentIndex,width:e.width}}function zB(i,e){return i===0&&e>0}function n0(i){const e=[],t=Array.from({length:i.length}),n=new Map;let s=0;for(let r=0;r<i.length;r++){const a=i[r],o=Zm.test(a.text),c=$m.test(a.text),l=a.text.replace(Zm,"").replace($m,"");if(l.length===0){GB.test(a.text)&&s===0&&(s=jl(a.font,n));continue}const h=s>0?s:o?jl(a.font,n):0,u=ql(l,a.font),d=HB(u);if(d===null){s=c?jl(a.font,n):0;continue}const f={break:a.break??"normal",endGraphemeIndex:d.endGraphemeIndex,endSegmentIndex:d.endSegmentIndex,extraWidth:a.extraWidth??0,gapBefore:h,naturalWidth:d.width,prepared:u,sourceItemIndex:r};e.push(f),t[r]=f,s=c?jl(a.font,n):0}return{items:e,itemsBySourceItemIndex:t}}function VB(i,e,t,n){if(i.items.length===0||t.itemIndex>=i.items.length)return null;const s=Math.max(1,e);let r=0,a=s,o=t.itemIndex;const c={segmentIndex:t.segmentIndex,graphemeIndex:t.graphemeIndex};e:for(;o<i.items.length;){const l=i.items[o];if(!t0(c)&&c.segmentIndex===l.endSegmentIndex&&c.graphemeIndex===l.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}const h=r===0?0:l.gapBefore,u=t0(c);if(l.break==="never"){if(!u){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}const m=l.naturalWidth+l.extraWidth,g=h+m;if(r>0&&g>a)break e;n?.(l,h,m,of(Kl),{segmentIndex:l.endSegmentIndex,graphemeIndex:l.endGraphemeIndex}),r+=g,a=Math.max(0,s-r),o++,c.segmentIndex=0,c.graphemeIndex=0;continue}const d=h+l.extraWidth;if(r>0&&d>=a)break e;if(u){const m=d+l.naturalWidth;if(m<=a){n?.(l,h,l.naturalWidth+l.extraWidth,of(Kl),{segmentIndex:l.endSegmentIndex,graphemeIndex:l.endGraphemeIndex}),r+=m,a=Math.max(0,s-r),o++,c.segmentIndex=0,c.graphemeIndex=0;continue}}const f=Math.max(1,a-d),p=sf(l.prepared,c,f);if(p===null){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}if(c.segmentIndex===p.endSegmentIndex&&c.graphemeIndex===p.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}if(r>0&&u&&h>0&&zB(p.endSegmentIndex,p.endGraphemeIndex)){const m=sf(l.prepared,Kl,Math.max(1,s-l.extraWidth));if(m!==null&&(m.endSegmentIndex>p.endSegmentIndex||m.endSegmentIndex===p.endSegmentIndex&&m.endGraphemeIndex>p.endGraphemeIndex))break e}if(n?.(l,h,p.width+l.extraWidth,of(c),{segmentIndex:p.endSegmentIndex,graphemeIndex:p.endGraphemeIndex}),r+=h+p.width+l.extraWidth,a=Math.max(0,s-r),p.endSegmentIndex===l.endSegmentIndex&&p.endGraphemeIndex===l.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}c.segmentIndex=p.endSegmentIndex,c.graphemeIndex=p.endGraphemeIndex;break}return r===0?null:(t.itemIndex=o,t.segmentIndex=c.segmentIndex,t.graphemeIndex=c.graphemeIndex,r)}function WB(i,e,t=e0){const n=i,s={itemIndex:t.itemIndex,segmentIndex:t.segmentIndex,graphemeIndex:t.graphemeIndex},r=[],a=VB(n,e,s,(o,c,l,h,u)=>{r.push({itemIndex:o.sourceItemIndex,gapBefore:c,occupiedWidth:l,start:h,end:u})});return a===null?null:{fragments:r,width:a,end:s}}function qB(i,e){return UB(i.prepared,{width:e.occupiedWidth-i.extraWidth,start:e.start,end:e.end}).text}function i0(i,e){const t=i;return{fragments:e.fragments.map(n=>{const s=t.itemsBySourceItemIndex[n.itemIndex];if(s===void 0)throw new Error("Missing rich-text inline item for fragment");return{...n,text:qB(s,n)}}),width:e.width,end:e.end}}function s0(i,e,t){let n=0,s=e0;for(;;){const r=WB(i,e,s);if(r===null)return n;t(r),n++,s=r.end}}const r0="500 14px Inter, sans-serif",cf="600 10px Inter, sans-serif",lf="300 13px Inter, sans-serif",a0="600 10px Inter, sans-serif",o0="300 12px Inter, sans-serif",zo=18,Xl=16,gn=16,Hi=6,c0=12,Yl=Math.min(window.devicePixelRatio||1,2),KB="rgba(0, 0, 0, 0.75)",jB="rgba(255, 255, 255, 0.08)",XB="rgba(255, 255, 255, 0.9)",YB="rgba(255, 255, 255, 0.30)",JB="rgba(255, 255, 255, 0.85)",l0="rgba(255, 255, 255, 0.08)",ZB="rgba(255, 255, 255, 0.45)",$B="rgba(255, 255, 255, 0.08)",eT="rgba(255, 255, 255, 0.7)";function tT(i){let e=0,t=0,n=0;const s=new Set,r=new Set,a=new Set;let o=!1,c=!1;return i.traverse(l=>{if(l.isMesh||l.isPoints||l.isLine){n++;const h=l.geometry;h&&(h.index?t+=h.index.count/3:h.attributes.position&&(t+=h.attributes.position.count/3),h.attributes.position&&(e+=h.attributes.position.count)),l.skeleton&&(o=!0),l.morphTargetInfluences&&l.morphTargetInfluences.length>0&&(c=!0),(Array.isArray(l.material)?l.material:[l.material]).forEach(d=>{if(d){s.add(d.uuid),a.add(d.type.replace("Material",""));for(const f in d)d[f]&&d[f].isTexture&&r.add(d[f].uuid)}})}}),{vertices:e,triangles:Math.floor(t),meshes:n,materials:s.size,textures:r.size,materialTypes:Array.from(a),hasSkinning:o,hasMorphs:c}}function Vo(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function nT(i,e){const t=[];return i.hasSkinning&&t.push("skinned"),i.hasMorphs&&t.push("morph targets"),e&&e.length>0&&t.push(`${e.length} animation${e.length>1?"s":""}`),i.materialTypes.length>0&&t.push(i.materialTypes.join(", ")),t.length>0?t.join(" · "):""}function iT(i,e,t){const n=tT(e),s=nT(n,t),r=[{label:"MESHES",value:Vo(n.meshes)},{label:"VERTICES",value:Vo(n.vertices)},{label:"TRIANGLES",value:Vo(n.triangles)},{label:"MATERIALS",value:Vo(n.materials)},{label:"TEXTURES",value:Vo(n.textures)}];t&&t.length>0&&r.push({label:"ANIMATIONS",value:t.length.toString()});const a=[];n.materialTypes.forEach(w=>a.push(w)),n.hasSkinning&&a.push("Skinned"),n.hasMorphs&&a.push("Morph"),t&&t.length>0&&a.push("Animated");const o=200,c=Wl("Model Info",r0),l=NB(c,o,zo+2),h=r.map(w=>{const I=[{text:w.label+" ",font:cf},{text:w.value,font:lf}],T=n0(I),C=Wl(w.label,cf),v=af(C,o),F=Wl(w.value,lf),K=af(F,o);return{...w,labelWidth:v.maxLineWidth,valueWidth:K.maxLineWidth,richPrepared:T}}),u=a.map(w=>{const I=Wl(w,a0),T=af(I,300);return{text:w,width:T.maxLineWidth+c0}});let d=[],f=0;if(s){const w=ql(s,o0),I=QB(w,o-gn,zo);d=I.lines,f=I.height}const p=Math.max(l.width+gn*2,...h.map(w=>w.labelWidth+w.valueWidth+gn*3)),m=Math.max(p,180);let g=0;if(u.length>0){let w=0,I=1;u.forEach(T=>{w>0&&w+T.width>m-gn*2&&(I++,w=0),w+=T.width+6}),g=I*(Xl+6)+Hi}const A=gn+l.height+Hi+Hi+h.length*(zo+Hi)+g+(f>0?Hi+f:0)+gn,_=document.createElement("canvas");_.width=m*Yl,_.height=A*Yl,_.style.width=m+"px",_.style.height=A+"px";const x=_.getContext("2d");x.scale(Yl,Yl),x.fillStyle=KB,hf(x,0,0,m,A,10),x.fill(),x.strokeStyle=jB,x.lineWidth=1,hf(x,.5,.5,m-1,A-1,10),x.stroke();let E=gn;if(x.font=r0,x.fillStyle=XB,x.textBaseline="top",x.fillText("Model Info",gn,E),E+=l.height+Hi,x.strokeStyle=l0,x.beginPath(),x.moveTo(gn,E),x.lineTo(m-gn,E),x.stroke(),E+=Hi,h.forEach(w=>{x.font=cf,x.fillStyle=YB,x.textAlign="left",x.fillText(w.label,gn,E),x.font=lf,x.fillStyle=JB,x.textAlign="right",x.fillText(w.value,m-gn,E),x.textAlign="left",E+=zo+Hi}),u.length>0){let w=gn;u.forEach(I=>{w>gn&&w+I.width>m-gn&&(w=gn,E+=Xl+6),x.fillStyle=$B,hf(x,w,E,I.width,Xl,4),x.fill(),x.font=a0,x.fillStyle=eT,x.textBaseline="top",x.fillText(I.text,w+c0/2,E+3),w+=I.width+6}),E+=Xl+Hi+4}d.length>0&&(x.strokeStyle=l0,x.beginPath(),x.moveTo(gn,E),x.lineTo(m-gn,E),x.stroke(),E+=Hi,x.font=o0,x.fillStyle=ZB,x.textBaseline="top",d.forEach(w=>{x.fillText(w.text,gn,E),E+=zo}));const S=document.createElement("div");return S.classList.add("model-info"),S.appendChild(_),i.appendChild(S),{el:S,canvas:_,remove(){S.remove()}}}function hf(i,e,t,n,s,r){i.beginPath(),i.moveTo(e+r,t),i.lineTo(e+n-r,t),i.quadraticCurveTo(e+n,t,e+n,t+r),i.lineTo(e+n,t+s-r),i.quadraticCurveTo(e+n,t+s,e+n-r,t+s),i.lineTo(e+r,t+s),i.quadraticCurveTo(e,t+s,e,t+s-r),i.lineTo(e,t+r),i.quadraticCurveTo(e,t,e+r,t),i.closePath()}const sT="500 11px Inter, sans-serif",h0="300 10px Inter, sans-serif",uf=10,u0=6,d0=14,Jl=Math.min(window.devicePixelRatio||1,2),rT=8;function aT(i){const e=[];return i.traverse(t=>{if(e.length>=rT||!t.isMesh||!t.name||t.name.startsWith("_"))return;const n=t.geometry,s=Array.isArray(t.material)?t.material[0]:t.material,r=n&&n.attributes.position?n.attributes.position.count:0,a=s?s.type.replace("Material",""):"",o=[{text:t.name,font:sT}];r>0&&o.push({text:" "+cT(r)+" verts",font:h0}),a&&o.push({text:" "+a,font:h0});const c=n0(o);let l=0,h=0;s0(c,300,m=>{const g=i0(c,m);l=Math.max(l,g.width),h++});const u=l+uf*2,d=h*d0+u0*2;n&&n.computeBoundingBox();const f=n?n.boundingBox:null,p=new G;f?(f.getCenter(p),p.applyMatrix4(t.matrixWorld)):t.getWorldPosition(p),e.push({name:t.name,items:o,prepared:c,labelWidth:u,labelHeight:d,position:p,vertCount:r,matType:a})}),e}function oT(i){const{labelWidth:e,labelHeight:t,items:n,prepared:s}=i,r=document.createElement("canvas");r.width=e*Jl,r.height=t*Jl,r.style.width=e+"px",r.style.height=t+"px";const a=r.getContext("2d");a.scale(Jl,Jl),a.fillStyle="rgba(0, 0, 0, 0.8)",f0(a,0,0,e,t,6),a.fill(),a.strokeStyle="rgba(255, 255, 255, 0.1)",a.lineWidth=1,f0(a,.5,.5,e-1,t-1,6),a.stroke(),a.textBaseline="top";let o=u0;return s0(s,e-uf*2,c=>{const l=i0(s,c);let h=uf;l.fragments.forEach(u=>{h+=u.gapBefore;const d=n[u.itemIndex];a.font=d.font,a.fillStyle=u.itemIndex===0?"rgba(255, 255, 255, 0.9)":"rgba(255, 255, 255, 0.45)",a.fillText(u.text,h,o),h+=u.occupiedWidth}),o+=d0}),r}function cT(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function f0(i,e,t,n,s,r){i.beginPath(),i.moveTo(e+r,t),i.lineTo(e+n-r,t),i.quadraticCurveTo(e+n,t,e+n,t+r),i.lineTo(e+n,t+s-r),i.quadraticCurveTo(e+n,t+s,e+n-r,t+s),i.lineTo(e+r,t+s),i.quadraticCurveTo(e,t+s,e,t+s-r),i.lineTo(e,t+r),i.quadraticCurveTo(e,t,e+r,t),i.closePath()}const df=new WeakMap;class lT extends ci{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,s){const r=new os(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,a=>{this.parse(a,t,s)},n,s)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,yt,n).catch(n)}decodeDracoFile(e,t,n,s,r=un,a=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(df.has(e)){const c=df.get(e);if(c.key===n)return c.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const r=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(r,a).then(c=>(s=c,new Promise((l,h)=>{s._callbacks[r]={resolve:l,reject:h},s.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return o.catch(()=>!0).then(()=>{s&&r&&this._releaseTask(s,r)}),df.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new Mn;e.index&&t.setIndex(new Sn(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],r=s.name,a=s.array,o=s.itemSize,c=new Sn(a,o);r==="color"&&(this._assignVertexColorSpace(c,s.vertexColorSpace),c.normalized=!(a instanceof Float32Array)),t.setAttribute(r,c)}return t}_assignVertexColorSpace(e,t){if(t!==yt)return;const n=new Fe;for(let s=0,r=e.count;s<r;s++)n.fromBufferAttribute(e,s),tt.toWorkingColorSpace(n,yt),e.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new os(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,r)=>{n.load(e,s,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const r=hT.toString(),a=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
+`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(r){const a=r.data;switch(a.type){case"decode":s._callbacks[a.id].resolve(a);break;case"error":s._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,r){return s._taskLoad>r._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function hT(){let i,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":i=o.decoderConfig,e=new Promise(function(h){i.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(i)});break;case"decode":const c=o.buffer,l=o.taskConfig;e.then(h=>{const u=h.draco,d=new u.Decoder;try{const f=t(u,d,new Int8Array(c),l),p=f.attributes.map(m=>m.array.buffer);f.index&&p.push(f.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:f},p)}catch(f){console.error(f),self.postMessage({type:"error",id:o.id,error:f.message})}finally{u.destroy(d)}});break}};function t(a,o,c,l){const h=l.attributeIDs,u=l.attributeTypes;let d,f;const p=o.GetEncodedGeometryType(c);if(p===a.TRIANGULAR_MESH)d=new a.Mesh,f=o.DecodeArrayToMesh(c,c.byteLength,d);else if(p===a.POINT_CLOUD)d=new a.PointCloud,f=o.DecodeArrayToPointCloud(c,c.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const m={index:null,attributes:[]};for(const g in h){const A=self[u[g]];let _,x;if(l.useUniqueIDs)x=h[g],_=o.GetAttributeByUniqueId(d,x);else{if(x=o.GetAttributeId(d,a[h[g]]),x===-1)continue;_=o.GetAttribute(d,x)}const E=s(a,o,d,g,A,_);g==="color"&&(E.vertexColorSpace=l.vertexColorSpace),m.attributes.push(E)}return p===a.TRIANGULAR_MESH&&(m.index=n(a,o,d)),a.destroy(d),m}function n(a,o,c){const h=c.num_faces()*3,u=h*4,d=a._malloc(u);o.GetTrianglesUInt32Array(c,u,d);const f=new Uint32Array(a.HEAPF32.buffer,d,h).slice();return a._free(d),{array:f,itemSize:1}}function s(a,o,c,l,h,u){const d=u.num_components(),p=c.num_points()*d,m=p*h.BYTES_PER_ELEMENT,g=r(a,h),A=a._malloc(m);o.GetAttributeDataArrayForAllPoints(c,u,g,m,A);const _=new h(a.HEAPF32.buffer,A,p).slice();return a._free(A),{name:l,array:_,itemSize:d}}function r(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}class uT{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:s,msg:r,transfer:a}=this.queue.shift();this.workersResolve[e]=s,this.workers[e].postMessage(r,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const s=this._getIdleWorker();s!==-1?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=n,this.workers[s].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const dT=0,p0=2,fT=1,A0=2,pT=0,AT=1,gT=10,mT=0,g0=9,m0=15,x0=16,b0=22,E0=37,y0=43,_0=76,w0=83,v0=97,C0=100,I0=103,S0=109,M0=165,B0=166,ff=1000066e3;class xT{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Wo{constructor(e,t,n,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){t===void 0&&(t=0);const n=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,s)}}const Qn=[171,75,84,88,32,50,48,187,13,10,26,10];function T0(i){return new TextDecoder().decode(i)}function bT(i){const e=new Uint8Array(i.buffer,i.byteOffset,Qn.length);if(e[0]!==Qn[0]||e[1]!==Qn[1]||e[2]!==Qn[2]||e[3]!==Qn[3]||e[4]!==Qn[4]||e[5]!==Qn[5]||e[6]!==Qn[6]||e[7]!==Qn[7]||e[8]!==Qn[8]||e[9]!==Qn[9]||e[10]!==Qn[10]||e[11]!==Qn[11])throw new Error("Missing KTX 2.0 identifier.");const t=new xT,n=17*Uint32Array.BYTES_PER_ELEMENT,s=new Wo(i,Qn.length,n,!0);t.vkFormat=s._nextUint32(),t.typeSize=s._nextUint32(),t.pixelWidth=s._nextUint32(),t.pixelHeight=s._nextUint32(),t.pixelDepth=s._nextUint32(),t.layerCount=s._nextUint32(),t.faceCount=s._nextUint32();const r=s._nextUint32();t.supercompressionScheme=s._nextUint32();const a=s._nextUint32(),o=s._nextUint32(),c=s._nextUint32(),l=s._nextUint32(),h=s._nextUint64(),u=s._nextUint64(),d=new Wo(i,Qn.length+n,3*r*8,!0);for(let Y=0;Y<r;Y++)t.levels.push({levelData:new Uint8Array(i.buffer,i.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const f=new Wo(i,a,o,!0),p={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},m=(p.descriptorBlockSize/4-6)/4;for(let Y=0;Y<m;Y++){const Q={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&Q.channelType?(Q.sampleLower=f._nextInt32(),Q.sampleUpper=f._nextInt32()):(Q.sampleLower=f._nextUint32(),Q.sampleUpper=f._nextUint32()),p.samples[Y]=Q}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(p);const g=new Wo(i,c,l,!0);for(;g._offset<l;){const Y=g._nextUint32(),Q=g._scan(Y),J=T0(Q);if(t.keyValue[J]=g._nextUint8Array(Y-Q.byteLength-1),J.match(/^ktx/i)){const ee=T0(t.keyValue[J]);t.keyValue[J]=ee.substring(0,ee.lastIndexOf("\0"))}g._skip(Y%4?4-Y%4:0)}if(u<=0)return t;const A=new Wo(i,h,u,!0),_=A._nextUint16(),x=A._nextUint16(),E=A._nextUint32(),S=A._nextUint32(),w=A._nextUint32(),I=A._nextUint32(),T=[];for(let Y=0;Y<r;Y++)T.push({imageFlags:A._nextUint32(),rgbSliceByteOffset:A._nextUint32(),rgbSliceByteLength:A._nextUint32(),alphaSliceByteOffset:A._nextUint32(),alphaSliceByteLength:A._nextUint32()});const C=h+A._offset,v=C+E,F=v+S,K=F+w,q=new Uint8Array(i.buffer,i.byteOffset+C,E),$=new Uint8Array(i.buffer,i.byteOffset+v,S),D=new Uint8Array(i.buffer,i.byteOffset+F,w),O=new Uint8Array(i.buffer,i.byteOffset+K,I);return t.globalData={endpointCount:_,selectorCount:x,imageDescs:T,endpointsData:q,selectorsData:$,tablesData:D,extendedData:O},t}let pf,ls,Af;const gf={env:{emscripten_notify_memory_growth:function(i){Af=new Uint8Array(ls.exports.memory.buffer)}}};class ET{init(){return pf||(pf=typeof fetch<"u"?fetch("data:application/wasm;base64,"+R0).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,gf)).then(this._init):WebAssembly.instantiate(Buffer.from(R0,"base64"),gf).then(this._init),pf)}_init(e){ls=e.instance,gf.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!ls)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,s=ls.exports.malloc(n);Af.set(e,s),t=t||Number(ls.exports.ZSTD_findDecompressedSize(s,n));const r=ls.exports.malloc(t),a=ls.exports.ZSTD_decompress(r,t,s,n),o=Af.slice(r,r+a);return ls.exports.free(s),ls.exports.free(r),o}}const R0="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKA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ABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGCh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DAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFI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AslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWs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QsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK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QAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",yT="display-p3",_T="display-p3-linear",mf=new WeakMap;let xf=0,bf;class ui extends ci{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new uT,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new os(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new os(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const s=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then(([r,a])=>{const o=ui.BasisWorker.toString(),c=["/* constants */","let _EngineFormat = "+JSON.stringify(ui.EngineFormat),"let _EngineType = "+JSON.stringify(ui.EngineType),"let _TranscoderFormat = "+JSON.stringify(ui.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(ui.BasisFormat),"/* basis_transcoder.js */",r,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
+`);this.workerSourceURL=URL.createObjectURL(new Blob([c])),this.transcoderBinary=a,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),h=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:h},[h]),l})}),xf>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),xf++}return this.transcoderPending}load(e,t,n,s){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new os(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,a=>{this.parse(a,t,s)},n,s)}parse(e,t,n){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(mf.has(e))return mf.get(e).promise.then(t).catch(n);this._createTexture(e).then(s=>t?t(s):null).catch(n)}_createTextureFrom(e,t){const{type:n,error:s,data:{faces:r,width:a,height:o,format:c,type:l,dfdFlags:h}}=e;if(n==="error")return Promise.reject(s);let u;if(t.faceCount===6)u=new $_(r,c,l);else{const d=r[0].mipmaps;u=t.layerCount>1?new Z_(d,a,o,t.layerCount,c,l):new yl(d,a,o,c,l)}return u.minFilter=r[0].mipmaps.length===1?qt:ri,u.magFilter=qt,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=F0(t),u.premultiplyAlpha=!!(h&fT),u}async _createTexture(e,t={}){const n=bT(new Uint8Array(e)),s=n.vkFormat===ff&&n.dataFormatDescriptor[0].colorModel===167;if(!(n.vkFormat===mT||s&&!this.workerConfig.astcHDRSupported))return vT(n);const a=t,o=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:a},[e])).then(c=>this._createTextureFrom(c.data,n));return mf.set(e,{promise:o}),o}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),xf--}}ui.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},ui.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},ui.EngineFormat={RGBAFormat:hn,RGBA_ASTC_4x4_Format:lo,RGB_BPTC_UNSIGNED_Format:Oc,RGBA_BPTC_Format:uo,RGBA_ETC2_EAC_Format:Uc,RGBA_PVRTC_4BPPV1_Format:Lc,RGBA_S3TC_DXT5_Format:co,RGB_ETC1_Format:Pc,RGB_ETC2_Format:kc,RGB_PVRTC_4BPPV1_Format:Dc,RGBA_S3TC_DXT1_Format:oo},ui.EngineType={UnsignedByteType:cn,HalfFloatType:kn,FloatType:ln},ui.BasisWorker=function(){let i,e,t;const n=_EngineFormat,s=_EngineType,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(p){const m=p.data;switch(m.type){case"init":i=m.config,o(m.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:g,buffers:A,width:_,height:x,hasAlpha:E,format:S,type:w,dfdFlags:I}=c(m.buffer);self.postMessage({type:"transcode",id:m.id,data:{faces:g,width:_,height:x,hasAlpha:E,format:S,type:w,dfdFlags:I}},A)}catch(g){console.error(g),self.postMessage({type:"error",id:m.id,error:g.message})}});break}});function o(p){e=new Promise(m=>{t={wasmBinary:p,onRuntimeInitialized:m},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function c(p){const m=new t.KTX2File(new Uint8Array(p));function g(){m.close(),m.delete()}if(!m.isValid())throw g(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let A;if(m.isUASTC())A=a.UASTC;else if(m.isETC1S())A=a.ETC1S;else if(m.isHDR())A=a.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const _=m.getWidth(),x=m.getHeight(),E=m.getLayers()||1,S=m.getLevels(),w=m.getFaces(),I=m.getHasAlpha(),T=m.getDFDFlags(),{transcoderFormat:C,engineFormat:v,engineType:F}=u(A,_,x,I);if(!_||!x||!S)throw g(),new Error("THREE.KTX2Loader: Invalid texture");if(!m.startTranscoding())throw g(),new Error("THREE.KTX2Loader: .startTranscoding failed");const K=[],q=[];for(let $=0;$<w;$++){const D=[];for(let O=0;O<S;O++){const Y=[];let Q,J;for(let ae=0;ae<E;ae++){const _e=m.getImageLevelInfo(O,ae,$);$===0&&O===0&&ae===0&&(_e.origWidth%4!==0||_e.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),S>1?(Q=_e.origWidth,J=_e.origHeight):(Q=_e.width,J=_e.height);let Me=new Uint8Array(m.getImageTranscodedSizeInBytes(O,ae,0,C));const se=m.transcodeImage(Me,O,ae,$,C,0,-1,-1);if(F===s.HalfFloatType&&(Me=new Uint16Array(Me.buffer,Me.byteOffset,Me.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!se)throw g(),new Error("THREE.KTX2Loader: .transcodeImage failed.");Y.push(Me)}const ee=f(Y);D.push({data:ee,width:Q,height:J}),q.push(ee.buffer)}K.push({mipmaps:D,width:_,height:x,format:v,type:F})}return g(),{faces:K,buffers:q,width:_,height:x,hasAlpha:I,dfdFlags:T,format:v,type:F}}const l=[{if:"astcSupported",basisFormat:[a.UASTC],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],engineType:[s.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],engineType:[s.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.BC1,r.BC3],engineFormat:[n.RGBA_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],engineType:[s.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],engineType:[s.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.ETC1],engineFormat:[n.RGB_ETC1_Format],engineType:[s.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],engineType:[s.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[a.UASTC_HDR],transcoderFormat:[r.BC6H],engineFormat:[n.RGB_BPTC_UNSIGNED_Format],engineType:[s.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[r.RGBA32,r.RGBA32],engineFormat:[n.RGBAFormat,n.RGBAFormat],engineType:[s.UnsignedByteType,s.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[a.UASTC_HDR],transcoderFormat:[r.RGBA_HALF],engineFormat:[n.RGBAFormat],engineType:[s.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],h={[a.ETC1S]:l.filter(p=>p.basisFormat.includes(a.ETC1S)).sort((p,m)=>p.priorityUASTC-m.priorityUASTC),[a.UASTC]:l.filter(p=>p.basisFormat.includes(a.UASTC)).sort((p,m)=>p.priorityUASTC-m.priorityUASTC),[a.UASTC_HDR]:l.filter(p=>p.basisFormat.includes(a.UASTC_HDR)).sort((p,m)=>p.priorityHDR-m.priorityHDR)};function u(p,m,g,A){const _=h[p];for(let x=0;x<_.length;x++){const E=_[x];if(E.if&&!i[E.if]||!E.basisFormat.includes(p)||A&&E.transcoderFormat.length<2||E.needsPowerOfTwo&&!(d(m)&&d(g)))continue;const S=E.transcoderFormat[A?1:0],w=E.engineFormat[A?1:0],I=E.engineType[0];return{transcoderFormat:S,engineFormat:w,engineType:I}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function d(p){return p<=2?!0:(p&p-1)===0&&p!==0}function f(p){if(p.length===1)return p[0];let m=0;for(let _=0;_<p.length;_++){const x=p[_];m+=x.byteLength}const g=new Uint8Array(m);let A=0;for(let _=0;_<p.length;_++){const x=p[_];g.set(x,A),A+=x.byteLength}return g}};const wT=new Set([hn,ar,Xi]),Ef={[S0]:hn,[v0]:hn,[E0]:hn,[y0]:hn,[I0]:ar,[w0]:ar,[x0]:ar,[b0]:ar,[C0]:Xi,[_0]:Xi,[m0]:Xi,[g0]:Xi,[ff]:lo,[B0]:ho,[M0]:ho},yf={[S0]:ln,[v0]:kn,[E0]:cn,[y0]:cn,[I0]:ln,[w0]:kn,[x0]:cn,[b0]:cn,[C0]:ln,[_0]:kn,[m0]:cn,[g0]:cn,[ff]:kn,[B0]:cn,[M0]:cn};async function vT(i){const{vkFormat:e}=i;if(Ef[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;i.supercompressionScheme===p0&&(bf||(bf=new Promise(async r=>{const a=new ET;await a.init(),r(a)})),t=await bf);const n=[];for(let r=0;r<i.levels.length;r++){const a=Math.max(1,i.pixelWidth>>r),o=Math.max(1,i.pixelHeight>>r),c=i.pixelDepth?Math.max(1,i.pixelDepth>>r):0,l=i.levels[r];let h;if(i.supercompressionScheme===dT)h=l.levelData;else if(i.supercompressionScheme===p0)h=t.decode(l.levelData,l.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let u;yf[e]===ln?u=new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):yf[e]===kn?u=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):u=h,n.push({data:u,width:a,height:o,depth:c})}let s;if(wT.has(Ef[e]))s=i.pixelDepth===0?new ll(n[0].data,i.pixelWidth,i.pixelHeight):new AA(n[0].data,i.pixelWidth,i.pixelHeight,i.pixelDepth);else{if(i.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new yl(n,i.pixelWidth,i.pixelHeight),s.minFilter=n.length===1?qt:ri,s.magFilter=qt}return s.mipmaps=n,s.type=yf[e],s.format=Ef[e],s.colorSpace=F0(i),s.needsUpdate=!0,Promise.resolve(s)}function F0(i){const e=i.dataFormatDescriptor[0];return e.colorPrimaries===AT?e.transferFunction===A0?yt:un:e.colorPrimaries===gT?e.transferFunction===A0?yT:_T:(e.colorPrimaries===pT||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),mi)}const Zl="[default]",_f={ASSET_GENERATOR:"assetgenerator"},$l=new ug,N0=`https://unpkg.com/three@0.${Ic}.x`,CT=new lT($l).setDecoderPath(`${N0}/examples/jsm/libs/draco/gltf/`),IT=new ui($l).setTranscoderPath(`${N0}/examples/jsm/libs/basis/`);function D0(i,e){const t=new Set;i.traverse(n=>{if(!n.geometry)return;(Array.isArray(n.material)?n.material:[n.material]).forEach(r=>{r&&!t.has(r.uuid)&&(t.add(r.uuid),e(r))})})}function ST(i){const{state:e,options:t}=i;if(t.preset===_f.ASSET_GENERATOR){const r=new Nw;r.name="hemi_light",i.scene.add(r),i.lights.push(r);return}const n=new mg(e.ambientColor,e.ambientIntensity);n.name="ambient_light",i.defaultCamera.add(n);const s=new Ad(e.directColor,e.directIntensity);s.position.set(.5,0,.866),s.name="main_light",i.defaultCamera.add(s),i.lights.push(n,s)}function MT(i){i.lights.forEach(e=>e.parent.remove(e)),i.lights.length=0}var di=Uint8Array,Fa=Uint16Array,BT=Int32Array,L0=new di([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),P0=new di([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),TT=new di([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),k0=function(i,e){for(var t=new Fa(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var s=new BT(t[30]),n=1;n<30;++n)for(var r=t[n];r<t[n+1];++r)s[r]=r-t[n]<<5|n;return{b:t,r:s}},U0=k0(L0,2),O0=U0.b,RT=U0.r;O0[28]=258,RT[258]=28;for(var FT=k0(P0,0),NT=FT.b,wf=new Fa(32768),Ot=0;Ot<32768;++Ot){var Ws=(Ot&43690)>>1|(Ot&21845)<<1;Ws=(Ws&52428)>>2|(Ws&13107)<<2,Ws=(Ws&61680)>>4|(Ws&3855)<<4,wf[Ot]=((Ws&65280)>>8|(Ws&255)<<8)>>1}for(var qo=(function(i,e,t){for(var n=i.length,s=0,r=new Fa(e);s<n;++s)i[s]&&++r[i[s]-1];var a=new Fa(e);for(s=1;s<e;++s)a[s]=a[s-1]+r[s-1]<<1;var o;if(t){o=new Fa(1<<e);var c=15-e;for(s=0;s<n;++s)if(i[s])for(var l=s<<4|i[s],h=e-i[s],u=a[i[s]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)o[wf[u]>>c]=l}else for(o=new Fa(n),s=0;s<n;++s)i[s]&&(o[s]=wf[a[i[s]-1]++]>>15-i[s]);return o}),Ko=new di(288),Ot=0;Ot<144;++Ot)Ko[Ot]=8;for(var Ot=144;Ot<256;++Ot)Ko[Ot]=9;for(var Ot=256;Ot<280;++Ot)Ko[Ot]=7;for(var Ot=280;Ot<288;++Ot)Ko[Ot]=8;for(var Q0=new di(32),Ot=0;Ot<32;++Ot)Q0[Ot]=5;var DT=qo(Ko,9,1),LT=qo(Q0,5,1),vf=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Si=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},Cf=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},PT=function(i){return(i+7)/8|0},kT=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new di(i.subarray(e,t))},UT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Mi=function(i,e,t){var n=new Error(e||UT[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Mi),!t)throw n;return n},OT=function(i,e,t,n){var s=i.length,r=0;if(!s||e.f&&!e.l)return t||new di(0);var a=!t,o=a||e.i!=2,c=e.i;a&&(t=new di(s*3));var l=function(Mt){var ft=t.length;if(Mt>ft){var $e=new di(Math.max(ft*2,Mt));$e.set(t),t=$e}},h=e.f||0,u=e.p||0,d=e.b||0,f=e.l,p=e.d,m=e.m,g=e.n,A=s*8;do{if(!f){h=Si(i,u,1);var _=Si(i,u+1,3);if(u+=3,_)if(_==1)f=DT,p=LT,m=9,g=5;else if(_==2){var w=Si(i,u,31)+257,I=Si(i,u+10,15)+4,T=w+Si(i,u+5,31)+1;u+=14;for(var C=new di(T),v=new di(19),F=0;F<I;++F)v[TT[F]]=Si(i,u+F*3,7);u+=I*3;for(var K=vf(v),q=(1<<K)-1,$=qo(v,K,1),F=0;F<T;){var D=$[Si(i,u,q)];u+=D&15;var x=D>>4;if(x<16)C[F++]=x;else{var O=0,Y=0;for(x==16?(Y=3+Si(i,u,3),u+=2,O=C[F-1]):x==17?(Y=3+Si(i,u,7),u+=3):x==18&&(Y=11+Si(i,u,127),u+=7);Y--;)C[F++]=O}}var Q=C.subarray(0,w),J=C.subarray(w);m=vf(Q),g=vf(J),f=qo(Q,m,1),p=qo(J,g,1)}else Mi(1);else{var x=PT(u)+4,E=i[x-4]|i[x-3]<<8,S=x+E;if(S>s){c&&Mi(0);break}o&&l(d+E),t.set(i.subarray(x,S),d),e.b=d+=E,e.p=u=S*8,e.f=h;continue}if(u>A){c&&Mi(0);break}}o&&l(d+131072);for(var ee=(1<<m)-1,ae=(1<<g)-1,_e=u;;_e=u){var O=f[Cf(i,u)&ee],Me=O>>4;if(u+=O&15,u>A){c&&Mi(0);break}if(O||Mi(2),Me<256)t[d++]=Me;else if(Me==256){_e=u,f=null;break}else{var se=Me-254;if(Me>264){var F=Me-257,me=L0[F];se=Si(i,u,(1<<me)-1)+O0[F],u+=me}var xe=p[Cf(i,u)&ae],be=xe>>4;xe||Mi(3),u+=xe&15;var J=NT[be];if(be>3){var me=P0[be];J+=Cf(i,u)&(1<<me)-1,u+=me}if(u>A){c&&Mi(0);break}o&&l(d+131072);var Ue=d+se;if(d<J){var et=r-J,He=Math.min(J,Ue);for(et+d<0&&Mi(3);d<He;++d)t[d]=n[et+d]}for(;d<Ue;++d)t[d]=t[d-J]}}e.l=f,e.p=_e,e.b=d,e.f=h,f&&(h=1,e.m=m,e.d=p,e.n=g)}while(!h);return d!=t.length&&a?kT(t,0,d):t.subarray(0,d)},QT=new di(0),GT=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Mi(6,"invalid zlib data"),(i[1]>>5&1)==1&&Mi(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function jo(i,e){return OT(i.subarray(GT(i),-4),{i:2},e,e)}var HT=typeof TextDecoder<"u"&&new TextDecoder,zT=0;try{HT.decode(QT,{stream:!0}),zT=1}catch{}class VT extends Fw{constructor(e){super(e),this.type=kn}parse(e){const C=Math.pow(2.7182818,2.2);function v(b,B){let k=0;for(let R=0;R<65536;++R)(R==0||b[R>>3]&1<<(R&7))&&(B[k++]=R);const y=k-1;for(;k<65536;)B[k++]=0;return y}function F(b){for(let B=0;B<16384;B++)b[B]={},b[B].len=0,b[B].lit=0,b[B].p=null}const K={l:0,c:0,lc:0};function q(b,B,k,y,R){for(;k<b;)B=B<<8|Te(y,R),k+=8;k-=b,K.l=B>>k&(1<<b)-1,K.c=B,K.lc=k}const $=new Array(59);function D(b){for(let k=0;k<=58;++k)$[k]=0;for(let k=0;k<65537;++k)$[b[k]]+=1;let B=0;for(let k=58;k>0;--k){const y=B+$[k]>>1;$[k]=B,B=y}for(let k=0;k<65537;++k){const y=b[k];y>0&&(b[k]=y|$[y]++<<6)}}function O(b,B,k,y,R,N){const U=B;let P=0,z=0;for(;y<=R;y++){if(U.value-B.value>k)return!1;q(6,P,z,b,U);const j=K.l;if(P=K.c,z=K.lc,N[y]=j,j==63){if(U.value-B.value>k)throw new Error("Something wrong with hufUnpackEncTable");q(8,P,z,b,U);let X=K.l+6;if(P=K.c,z=K.lc,y+X>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;X--;)N[y++]=0;y--}else if(j>=59){let X=j-59+2;if(y+X>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;X--;)N[y++]=0;y--}}D(N)}function Y(b){return b&63}function Q(b){return b>>6}function J(b,B,k,y){for(;B<=k;B++){const R=Q(b[B]),N=Y(b[B]);if(R>>N)throw new Error("Invalid table entry");if(N>14){const U=y[R>>N-14];if(U.len)throw new Error("Invalid table entry");if(U.lit++,U.p){const P=U.p;U.p=new Array(U.lit);for(let z=0;z<U.lit-1;++z)U.p[z]=P[z]}else U.p=new Array(1);U.p[U.lit-1]=B}else if(N){let U=0;for(let P=1<<14-N;P>0;P--){const z=y[(R<<14-N)+U];if(z.len||z.p)throw new Error("Invalid table entry");z.len=N,z.lit=B,U++}}}return!0}const ee={c:0,lc:0};function ae(b,B,k,y){b=b<<8|Te(k,y),B+=8,ee.c=b,ee.lc=B}const _e={c:0,lc:0};function Me(b,B,k,y,R,N,U,P,z){if(b==B){y<8&&(ae(k,y,R,N),k=ee.c,y=ee.lc),y-=8;let j=k>>y;if(j=new Uint8Array([j])[0],P.value+j>z)return!1;const X=U[P.value-1];for(;j-- >0;)U[P.value++]=X}else if(P.value<z)U[P.value++]=b;else return!1;_e.c=k,_e.lc=y}function se(b){return b&65535}function me(b){const B=se(b);return B>32767?B-65536:B}const xe={a:0,b:0};function be(b,B){const k=me(b),R=me(B),N=k+(R&1)+(R>>1),U=N,P=N-R;xe.a=U,xe.b=P}function Ue(b,B){const k=se(b),y=se(B),R=k-(y>>1)&65535,N=y+R-32768&65535;xe.a=N,xe.b=R}function et(b,B,k,y,R,N,U){const P=U<16384,z=k>R?R:k;let j=1,X,ie;for(;j<=z;)j<<=1;for(j>>=1,X=j,j>>=1;j>=1;){ie=0;const he=ie+N*(R-X),ce=N*j,fe=N*X,ge=y*j,ye=y*X;let Pe,je,Ve,Le;for(;ie<=he;ie+=fe){let rt=ie;const ke=ie+y*(k-X);for(;rt<=ke;rt+=ye){const It=rt+ge,mn=rt+ce,vt=mn+ge;P?(be(b[rt+B],b[mn+B]),Pe=xe.a,Ve=xe.b,be(b[It+B],b[vt+B]),je=xe.a,Le=xe.b,be(Pe,je),b[rt+B]=xe.a,b[It+B]=xe.b,be(Ve,Le),b[mn+B]=xe.a,b[vt+B]=xe.b):(Ue(b[rt+B],b[mn+B]),Pe=xe.a,Ve=xe.b,Ue(b[It+B],b[vt+B]),je=xe.a,Le=xe.b,Ue(Pe,je),b[rt+B]=xe.a,b[It+B]=xe.b,Ue(Ve,Le),b[mn+B]=xe.a,b[vt+B]=xe.b)}if(k&j){const It=rt+ce;P?be(b[rt+B],b[It+B]):Ue(b[rt+B],b[It+B]),Pe=xe.a,b[It+B]=xe.b,b[rt+B]=Pe}}if(R&j){let rt=ie;const ke=ie+y*(k-X);for(;rt<=ke;rt+=ye){const It=rt+ge;P?be(b[rt+B],b[It+B]):Ue(b[rt+B],b[It+B]),Pe=xe.a,b[It+B]=xe.b,b[rt+B]=Pe}}X=j,j>>=1}return ie}function He(b,B,k,y,R,N,U,P,z){let j=0,X=0;const ie=U,he=Math.trunc(y.value+(R+7)/8);for(;y.value<he;)for(ae(j,X,k,y),j=ee.c,X=ee.lc;X>=14;){const fe=j>>X-14&16383,ge=B[fe];if(ge.len)X-=ge.len,Me(ge.lit,N,j,X,k,y,P,z,ie),j=_e.c,X=_e.lc;else{if(!ge.p)throw new Error("hufDecode issues");let ye;for(ye=0;ye<ge.lit;ye++){const Pe=Y(b[ge.p[ye]]);for(;X<Pe&&y.value<he;)ae(j,X,k,y),j=ee.c,X=ee.lc;if(X>=Pe&&Q(b[ge.p[ye]])==(j>>X-Pe&(1<<Pe)-1)){X-=Pe,Me(ge.p[ye],N,j,X,k,y,P,z,ie),j=_e.c,X=_e.lc;break}}if(ye==ge.lit)throw new Error("hufDecode issues")}}const ce=8-R&7;for(j>>=ce,X-=ce;X>0;){const fe=B[j<<14-X&16383];if(fe.len)X-=fe.len,Me(fe.lit,N,j,X,k,y,P,z,ie),j=_e.c,X=_e.lc;else throw new Error("hufDecode issues")}return!0}function Mt(b,B,k,y,R,N){const U={value:0},P=k.value,z=Ge(B,k),j=Ge(B,k);k.value+=4;const X=Ge(B,k);if(k.value+=4,z<0||z>=65537||j<0||j>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const ie=new Array(65537),he=new Array(16384);F(he);const ce=y-(k.value-P);if(O(b,k,ce,z,j,ie),X>8*(y-(k.value-P)))throw new Error("Something wrong with hufUncompress");J(ie,z,j,he),He(ie,he,b,k,X,j,N,R,U)}function ft(b,B,k){for(let y=0;y<k;++y)B[y]=b[B[y]]}function $e(b){for(let B=1;B<b.length;B++){const k=b[B-1]+b[B]-128;b[B]=k}}function H(b,B){let k=0,y=Math.floor((b.length+1)/2),R=0;const N=b.length-1;for(;!(R>N||(B[R++]=b[k++],R>N));)B[R++]=b[y++]}function wn(b){let B=b.byteLength;const k=new Array;let y=0;const R=new DataView(b);for(;B>0;){const N=R.getInt8(y++);if(N<0){const U=-N;B-=U+1;for(let P=0;P<U;P++)k.push(R.getUint8(y++))}else{const U=N;B-=2;const P=R.getUint8(y++);for(let z=0;z<U+1;z++)k.push(P)}}return k}function pt(b,B,k,y,R,N){let U=new DataView(N.buffer);const P=k[b.idx[0]].width,z=k[b.idx[0]].height,j=3,X=Math.floor(P/8),ie=Math.ceil(P/8),he=Math.ceil(z/8),ce=P-(ie-1)*8,fe=z-(he-1)*8,ge={value:0},ye=new Array(j),Pe=new Array(j),je=new Array(j),Ve=new Array(j),Le=new Array(j);for(let ke=0;ke<j;++ke)Le[ke]=B[b.idx[ke]],ye[ke]=ke<1?0:ye[ke-1]+ie*he,Pe[ke]=new Float32Array(64),je[ke]=new Uint16Array(64),Ve[ke]=new Uint16Array(ie*64);for(let ke=0;ke<he;++ke){let It=8;ke==he-1&&(It=fe);let mn=8;for(let Et=0;Et<ie;++Et){Et==ie-1&&(mn=ce);for(let Xe=0;Xe<j;++Xe)je[Xe].fill(0),je[Xe][0]=R[ye[Xe]++],mt(ge,y,je[Xe]),We(je[Xe],Pe[Xe]),Dt(Pe[Xe]);ze(Pe);for(let Xe=0;Xe<j;++Xe)L(Pe[Xe],Ve[Xe],Et*64)}let vt=0;for(let Et=0;Et<j;++Et){const Xe=k[b.idx[Et]].type;for(let Xt=8*ke;Xt<8*ke+It;++Xt){vt=Le[Et][Xt];for(let Cn=0;Cn<X;++Cn){const Ut=Cn*64+(Xt&7)*8;U.setUint16(vt+0*Xe,Ve[Et][Ut+0],!0),U.setUint16(vt+2*Xe,Ve[Et][Ut+1],!0),U.setUint16(vt+4*Xe,Ve[Et][Ut+2],!0),U.setUint16(vt+6*Xe,Ve[Et][Ut+3],!0),U.setUint16(vt+8*Xe,Ve[Et][Ut+4],!0),U.setUint16(vt+10*Xe,Ve[Et][Ut+5],!0),U.setUint16(vt+12*Xe,Ve[Et][Ut+6],!0),U.setUint16(vt+14*Xe,Ve[Et][Ut+7],!0),vt+=16*Xe}}if(X!=ie)for(let Xt=8*ke;Xt<8*ke+It;++Xt){const Cn=Le[Et][Xt]+8*X*2*Xe,Ut=X*64+(Xt&7)*8;for(let xn=0;xn<mn;++xn)U.setUint16(Cn+xn*2*Xe,Ve[Et][Ut+xn],!0)}}}const rt=new Uint16Array(P);U=new DataView(N.buffer);for(let ke=0;ke<j;++ke){k[b.idx[ke]].decoded=!0;const It=k[b.idx[ke]].type;if(k[ke].type==2)for(let mn=0;mn<z;++mn){const vt=Le[ke][mn];for(let Et=0;Et<P;++Et)rt[Et]=U.getUint16(vt+Et*2*It,!0);for(let Et=0;Et<P;++Et)U.setFloat32(vt+Et*2*It,ne(rt[Et]),!0)}}}function mt(b,B,k){let y,R=1;for(;R<64;)y=B[b.value],y==65280?R=64:y>>8==255?R+=y&255:(k[R]=y,R++),b.value++}function We(b,B){B[0]=ne(b[0]),B[1]=ne(b[1]),B[2]=ne(b[5]),B[3]=ne(b[6]),B[4]=ne(b[14]),B[5]=ne(b[15]),B[6]=ne(b[27]),B[7]=ne(b[28]),B[8]=ne(b[2]),B[9]=ne(b[4]),B[10]=ne(b[7]),B[11]=ne(b[13]),B[12]=ne(b[16]),B[13]=ne(b[26]),B[14]=ne(b[29]),B[15]=ne(b[42]),B[16]=ne(b[3]),B[17]=ne(b[8]),B[18]=ne(b[12]),B[19]=ne(b[17]),B[20]=ne(b[25]),B[21]=ne(b[30]),B[22]=ne(b[41]),B[23]=ne(b[43]),B[24]=ne(b[9]),B[25]=ne(b[11]),B[26]=ne(b[18]),B[27]=ne(b[24]),B[28]=ne(b[31]),B[29]=ne(b[40]),B[30]=ne(b[44]),B[31]=ne(b[53]),B[32]=ne(b[10]),B[33]=ne(b[19]),B[34]=ne(b[23]),B[35]=ne(b[32]),B[36]=ne(b[39]),B[37]=ne(b[45]),B[38]=ne(b[52]),B[39]=ne(b[54]),B[40]=ne(b[20]),B[41]=ne(b[22]),B[42]=ne(b[33]),B[43]=ne(b[38]),B[44]=ne(b[46]),B[45]=ne(b[51]),B[46]=ne(b[55]),B[47]=ne(b[60]),B[48]=ne(b[21]),B[49]=ne(b[34]),B[50]=ne(b[37]),B[51]=ne(b[47]),B[52]=ne(b[50]),B[53]=ne(b[56]),B[54]=ne(b[59]),B[55]=ne(b[61]),B[56]=ne(b[35]),B[57]=ne(b[36]),B[58]=ne(b[48]),B[59]=ne(b[49]),B[60]=ne(b[57]),B[61]=ne(b[58]),B[62]=ne(b[62]),B[63]=ne(b[63])}function Dt(b){const B=.5*Math.cos(.7853975),k=.5*Math.cos(3.14159/16),y=.5*Math.cos(3.14159/8),R=.5*Math.cos(3*3.14159/16),N=.5*Math.cos(5*3.14159/16),U=.5*Math.cos(3*3.14159/8),P=.5*Math.cos(7*3.14159/16),z=new Array(4),j=new Array(4),X=new Array(4),ie=new Array(4);for(let he=0;he<8;++he){const ce=he*8;z[0]=y*b[ce+2],z[1]=U*b[ce+2],z[2]=y*b[ce+6],z[3]=U*b[ce+6],j[0]=k*b[ce+1]+R*b[ce+3]+N*b[ce+5]+P*b[ce+7],j[1]=R*b[ce+1]-P*b[ce+3]-k*b[ce+5]-N*b[ce+7],j[2]=N*b[ce+1]-k*b[ce+3]+P*b[ce+5]+R*b[ce+7],j[3]=P*b[ce+1]-N*b[ce+3]+R*b[ce+5]-k*b[ce+7],X[0]=B*(b[ce+0]+b[ce+4]),X[3]=B*(b[ce+0]-b[ce+4]),X[1]=z[0]+z[3],X[2]=z[1]-z[2],ie[0]=X[0]+X[1],ie[1]=X[3]+X[2],ie[2]=X[3]-X[2],ie[3]=X[0]-X[1],b[ce+0]=ie[0]+j[0],b[ce+1]=ie[1]+j[1],b[ce+2]=ie[2]+j[2],b[ce+3]=ie[3]+j[3],b[ce+4]=ie[3]-j[3],b[ce+5]=ie[2]-j[2],b[ce+6]=ie[1]-j[1],b[ce+7]=ie[0]-j[0]}for(let he=0;he<8;++he)z[0]=y*b[16+he],z[1]=U*b[16+he],z[2]=y*b[48+he],z[3]=U*b[48+he],j[0]=k*b[8+he]+R*b[24+he]+N*b[40+he]+P*b[56+he],j[1]=R*b[8+he]-P*b[24+he]-k*b[40+he]-N*b[56+he],j[2]=N*b[8+he]-k*b[24+he]+P*b[40+he]+R*b[56+he],j[3]=P*b[8+he]-N*b[24+he]+R*b[40+he]-k*b[56+he],X[0]=B*(b[he]+b[32+he]),X[3]=B*(b[he]-b[32+he]),X[1]=z[0]+z[3],X[2]=z[1]-z[2],ie[0]=X[0]+X[1],ie[1]=X[3]+X[2],ie[2]=X[3]-X[2],ie[3]=X[0]-X[1],b[0+he]=ie[0]+j[0],b[8+he]=ie[1]+j[1],b[16+he]=ie[2]+j[2],b[24+he]=ie[3]+j[3],b[32+he]=ie[3]-j[3],b[40+he]=ie[2]-j[2],b[48+he]=ie[1]-j[1],b[56+he]=ie[0]-j[0]}function ze(b){for(let B=0;B<64;++B){const k=b[0][B],y=b[1][B],R=b[2][B];b[0][B]=k+1.5747*R,b[1][B]=k-.1873*y-.4682*R,b[2][B]=k+1.8556*y}}function L(b,B,k){for(let y=0;y<64;++y)B[k+y]=SA.toHalfFloat(M(b[y]))}function M(b){return b<=1?Math.sign(b)*Math.pow(Math.abs(b),2.2):Math.sign(b)*Math.pow(C,Math.abs(b)-1)}function Z(b){return new DataView(b.array.buffer,b.offset.value,b.size)}function le(b){const B=b.viewer.buffer.slice(b.offset.value,b.offset.value+b.size),k=new Uint8Array(wn(B)),y=new Uint8Array(k.length);return $e(k),H(k,y),new DataView(y.buffer)}function Ae(b){const B=b.array.slice(b.offset.value,b.offset.value+b.size),k=jo(B),y=new Uint8Array(k.length);return $e(k),H(k,y),new DataView(y.buffer)}function oe(b){const B=b.viewer,k={value:b.offset.value},y=new Uint16Array(b.columns*b.lines*(b.inputChannels.length*b.type)),R=new Uint8Array(8192);let N=0;const U=new Array(b.inputChannels.length);for(let fe=0,ge=b.inputChannels.length;fe<ge;fe++)U[fe]={},U[fe].start=N,U[fe].end=U[fe].start,U[fe].nx=b.columns,U[fe].ny=b.lines,U[fe].size=b.type,N+=U[fe].nx*U[fe].ny*U[fe].size;const P=re(B,k),z=re(B,k);if(z>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(P<=z)for(let fe=0;fe<z-P+1;fe++)R[fe+P]=nt(B,k);const j=new Uint16Array(65536),X=v(R,j),ie=Ge(B,k);Mt(b.array,B,k,ie,y,N);for(let fe=0;fe<b.inputChannels.length;++fe){const ge=U[fe];for(let ye=0;ye<U[fe].size;++ye)et(y,ge.start+ye,ge.nx,ge.size,ge.ny,ge.nx*ge.size,X)}ft(j,y,N);let he=0;const ce=new Uint8Array(y.buffer.byteLength);for(let fe=0;fe<b.lines;fe++)for(let ge=0;ge<b.inputChannels.length;ge++){const ye=U[ge],Pe=ye.nx*ye.size,je=new Uint8Array(y.buffer,ye.end*2,Pe*2);ce.set(je,he),he+=Pe*2,ye.end+=Pe}return new DataView(ce.buffer)}function Qe(b){const B=b.array.slice(b.offset.value,b.offset.value+b.size),k=jo(B),y=b.inputChannels.length*b.lines*b.columns*b.totalBytes,R=new ArrayBuffer(y),N=new DataView(R);let U=0,P=0;const z=new Array(4);for(let j=0;j<b.lines;j++)for(let X=0;X<b.inputChannels.length;X++){let ie=0;switch(b.inputChannels[X].pixelType){case 1:z[0]=U,z[1]=z[0]+b.columns,U=z[1]+b.columns;for(let ce=0;ce<b.columns;++ce){const fe=k[z[0]++]<<8|k[z[1]++];ie+=fe,N.setUint16(P,ie,!0),P+=2}break;case 2:z[0]=U,z[1]=z[0]+b.columns,z[2]=z[1]+b.columns,U=z[2]+b.columns;for(let ce=0;ce<b.columns;++ce){const fe=k[z[0]++]<<24|k[z[1]++]<<16|k[z[2]++]<<8;ie+=fe,N.setUint32(P,ie,!0),P+=4}break}}return N}function ve(b){const B=b.viewer,k={value:b.offset.value},y=new Uint8Array(b.columns*b.lines*(b.inputChannels.length*b.type*2)),R={version:Ke(B,k),unknownUncompressedSize:Ke(B,k),unknownCompressedSize:Ke(B,k),acCompressedSize:Ke(B,k),dcCompressedSize:Ke(B,k),rleCompressedSize:Ke(B,k),rleUncompressedSize:Ke(B,k),rleRawSize:Ke(B,k),totalAcUncompressedCount:Ke(B,k),totalDcUncompressedCount:Ke(B,k),acCompression:Ke(B,k)};if(R.version<2)throw new Error("EXRLoader.parse: "+vs.compression+" version "+R.version+" is unsupported");const N=new Array;let U=re(B,k)-2;for(;U>0;){const ge=qe(B.buffer,k),ye=nt(B,k),Pe=ye>>2&3,je=(ye>>4)-1,Ve=new Int8Array([je])[0],Le=nt(B,k);N.push({name:ge,index:Ve,type:Le,compression:Pe}),U-=ge.length+3}const P=vs.channels,z=new Array(b.inputChannels.length);for(let ge=0;ge<b.inputChannels.length;++ge){const ye=z[ge]={},Pe=P[ge];ye.name=Pe.name,ye.compression=0,ye.decoded=!1,ye.type=Pe.pixelType,ye.pLinear=Pe.pLinear,ye.width=b.columns,ye.height=b.lines}const j={idx:new Array(3)};for(let ge=0;ge<b.inputChannels.length;++ge){const ye=z[ge];for(let Pe=0;Pe<N.length;++Pe){const je=N[Pe];ye.name==je.name&&(ye.compression=je.compression,je.index>=0&&(j.idx[je.index]=ge),ye.offset=ge)}}let X,ie,he;if(R.acCompressedSize>0)switch(R.acCompression){case 0:X=new Uint16Array(R.totalAcUncompressedCount),Mt(b.array,B,k,R.acCompressedSize,X,R.totalAcUncompressedCount);break;case 1:const ge=b.array.slice(k.value,k.value+R.totalAcUncompressedCount),ye=jo(ge);X=new Uint16Array(ye.buffer),k.value+=R.totalAcUncompressedCount;break}if(R.dcCompressedSize>0){const ge={array:b.array,offset:k,size:R.dcCompressedSize};ie=new Uint16Array(Ae(ge).buffer),k.value+=R.dcCompressedSize}if(R.rleRawSize>0){const ge=b.array.slice(k.value,k.value+R.rleCompressedSize),ye=jo(ge);he=wn(ye.buffer),k.value+=R.rleCompressedSize}let ce=0;const fe=new Array(z.length);for(let ge=0;ge<fe.length;++ge)fe[ge]=new Array;for(let ge=0;ge<b.lines;++ge)for(let ye=0;ye<z.length;++ye)fe[ye].push(ce),ce+=z[ye].width*b.type*2;pt(j,fe,z,X,ie,y);for(let ge=0;ge<z.length;++ge){const ye=z[ge];if(!ye.decoded)switch(ye.compression){case 2:let Pe=0,je=0;for(let Ve=0;Ve<b.lines;++Ve){let Le=fe[ge][Pe];for(let rt=0;rt<ye.width;++rt){for(let ke=0;ke<2*ye.type;++ke)y[Le++]=he[je+ke*ye.width*ye.height];je++}Pe++}break;default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(y.buffer)}function qe(b,B){const k=new Uint8Array(b);let y=0;for(;k[B.value+y]!=0;)y+=1;const R=new TextDecoder().decode(k.slice(B.value,B.value+y));return B.value=B.value+y+1,R}function Ze(b,B,k){const y=new TextDecoder().decode(new Uint8Array(b).slice(B.value,B.value+k));return B.value=B.value+k,y}function Ee(b,B){const k=Oe(b,B),y=Ge(b,B);return[k,y]}function De(b,B){const k=Ge(b,B),y=Ge(b,B);return[k,y]}function Oe(b,B){const k=b.getInt32(B.value,!0);return B.value=B.value+4,k}function Ge(b,B){const k=b.getUint32(B.value,!0);return B.value=B.value+4,k}function Te(b,B){const k=b[B.value];return B.value=B.value+1,k}function nt(b,B){const k=b.getUint8(B.value);return B.value=B.value+1,k}const Ke=function(b,B){let k;return"getBigInt64"in DataView.prototype?k=Number(b.getBigInt64(B.value,!0)):k=b.getUint32(B.value+4,!0)+Number(b.getUint32(B.value,!0)<<32),B.value+=8,k};function it(b,B){const k=b.getFloat32(B.value,!0);return B.value+=4,k}function W(b,B){return SA.toHalfFloat(it(b,B))}function ne(b){const B=(b&31744)>>10,k=b&1023;return(b>>15?-1:1)*(B?B===31?k?NaN:1/0:Math.pow(2,B-15)*(1+k/1024):6103515625e-14*(k/1024))}function re(b,B){const k=b.getUint16(B.value,!0);return B.value+=2,k}function de(b,B){return ne(re(b,B))}function Se(b,B,k,y){const R=k.value,N=[];for(;k.value<R+y-1;){const U=qe(B,k),P=Oe(b,k),z=nt(b,k);k.value+=3;const j=Oe(b,k),X=Oe(b,k);N.push({name:U,pixelType:P,pLinear:z,xSampling:j,ySampling:X})}return k.value+=1,N}function Ie(b,B){const k=it(b,B),y=it(b,B),R=it(b,B),N=it(b,B),U=it(b,B),P=it(b,B),z=it(b,B),j=it(b,B);return{redX:k,redY:y,greenX:R,greenY:N,blueX:U,blueY:P,whiteX:z,whiteY:j}}function st(b,B){const k=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],y=nt(b,B);return k[y]}function Ht(b,B){const k=Oe(b,B),y=Oe(b,B),R=Oe(b,B),N=Oe(b,B);return{xMin:k,yMin:y,xMax:R,yMax:N}}function vn(b,B){const k=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],y=nt(b,B);return k[y]}function Ct(b,B){const k=["ENVMAP_LATLONG","ENVMAP_CUBE"],y=nt(b,B);return k[y]}function si(b,B){const k=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],y=["ROUND_DOWN","ROUND_UP"],R=Ge(b,B),N=Ge(b,B),U=nt(b,B);return{xSize:R,ySize:N,levelMode:k[U&15],roundingMode:y[U>>4]}}function Li(b,B){const k=it(b,B),y=it(b,B);return[k,y]}function Qh(b,B){const k=it(b,B),y=it(b,B),R=it(b,B);return[k,y,R]}function Gh(b,B,k,y,R){if(y==="string"||y==="stringvector"||y==="iccProfile")return Ze(B,k,R);if(y==="chlist")return Se(b,B,k,R);if(y==="chromaticities")return Ie(b,k);if(y==="compression")return st(b,k);if(y==="box2i")return Ht(b,k);if(y==="envmap")return Ct(b,k);if(y==="tiledesc")return si(b,k);if(y==="lineOrder")return vn(b,k);if(y==="float")return it(b,k);if(y==="v2f")return Li(b,k);if(y==="v3f")return Qh(b,k);if(y==="int")return Oe(b,k);if(y==="rational")return Ee(b,k);if(y==="timecode")return De(b,k);if(y==="preview")return k.value+=R,"skipped";k.value+=R}function ws(b,B){const k=Math.log2(b);return B=="ROUND_DOWN"?Math.floor(k):Math.ceil(k)}function _c(b,B,k){let y=0;switch(b.levelMode){case"ONE_LEVEL":y=1;break;case"MIPMAP_LEVELS":y=ws(Math.max(B,k),b.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return y}function wc(b,B,k,y){const R=new Array(b);for(let N=0;N<b;N++){const U=1<<N;let P=B/U|0;y=="ROUND_UP"&&P*U<B&&(P+=1);const z=Math.max(P,1);R[N]=(z+k-1)/k|0}return R}function Hh(){const b=this,B=b.offset,k={value:0};for(let y=0;y<b.tileCount;y++){const R=Oe(b.viewer,B),N=Oe(b.viewer,B);B.value+=8,b.size=Ge(b.viewer,B);const U=R*b.blockWidth,P=N*b.blockHeight;b.columns=U+b.blockWidth>b.width?b.width-U:b.blockWidth,b.lines=P+b.blockHeight>b.height?b.height-P:b.blockHeight;const z=b.columns*b.totalBytes,X=b.size<b.lines*z?b.uncompress(b):Z(b);B.value+=b.size;for(let ie=0;ie<b.lines;ie++){const he=ie*b.columns*b.totalBytes;for(let ce=0;ce<b.inputChannels.length;ce++){const fe=vs.channels[ce].name,ge=b.channelByteOffsets[fe]*b.columns,ye=b.decodeChannels[fe];if(ye===void 0)continue;k.value=he+ge;const Pe=(b.height-(1+P+ie))*b.outLineWidth;for(let je=0;je<b.columns;je++){const Ve=Pe+(je+U)*b.outputChannels+ye;b.byteArray[Ve]=b.getter(X,k)}}}}}function eo(){const b=this,B=b.offset,k={value:0};for(let y=0;y<b.height/b.blockHeight;y++){const R=Oe(b.viewer,B)-vs.dataWindow.yMin;b.size=Ge(b.viewer,B),b.lines=R+b.blockHeight>b.height?b.height-R:b.blockHeight;const N=b.columns*b.totalBytes,P=b.size<b.lines*N?b.uncompress(b):Z(b);B.value+=b.size;for(let z=0;z<b.blockHeight;z++){const j=y*b.blockHeight,X=z+b.scanOrder(j);if(X>=b.height)continue;const ie=z*N,he=(b.height-1-X)*b.outLineWidth;for(let ce=0;ce<b.inputChannels.length;ce++){const fe=vs.channels[ce].name,ge=b.channelByteOffsets[fe]*b.columns,ye=b.decodeChannels[fe];if(ye!==void 0){k.value=ie+ge;for(let Pe=0;Pe<b.columns;Pe++){const je=he+Pe*b.outputChannels+ye;b.byteArray[je]=b.getter(P,k)}}}}}}function zh(b,B,k){const y={};if(b.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");y.version=b.getUint8(4);const R=b.getUint8(5);y.spec={singleTile:!!(R&2),longName:!!(R&4),deepFormat:!!(R&8),multiPart:!!(R&16)},k.value=8;let N=!0;for(;N;){const U=qe(B,k);if(U==="")N=!1;else{const P=qe(B,k),z=Ge(b,k),j=Gh(b,B,k,P,z);j===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`):y[U]=j}}if((R&-7)!=0)throw console.error("THREE.EXRHeader:",y),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return y}function to(b,B,k,y,R){const N={size:0,viewer:B,array:k,offset:y,width:b.dataWindow.xMax-b.dataWindow.xMin+1,height:b.dataWindow.yMax-b.dataWindow.yMin+1,inputChannels:b.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:un};switch(b.compression){case"NO_COMPRESSION":N.blockHeight=1,N.uncompress=Z;break;case"RLE_COMPRESSION":N.blockHeight=1,N.uncompress=le;break;case"ZIPS_COMPRESSION":N.blockHeight=1,N.uncompress=Ae;break;case"ZIP_COMPRESSION":N.blockHeight=16,N.uncompress=Ae;break;case"PIZ_COMPRESSION":N.blockHeight=32,N.uncompress=oe;break;case"PXR24_COMPRESSION":N.blockHeight=16,N.uncompress=Qe;break;case"DWAA_COMPRESSION":N.blockHeight=32,N.uncompress=ve;break;case"DWAB_COMPRESSION":N.blockHeight=256,N.uncompress=ve;break;default:throw new Error("EXRLoader.parse: "+b.compression+" is unsupported")}const U={};for(const X of b.channels)switch(X.name){case"Y":case"R":case"G":case"B":case"A":U[X.name]=!0,N.type=X.pixelType}let P=!1;if(U.R&&U.G&&U.B)P=!U.A,N.outputChannels=4,N.decodeChannels={R:0,G:1,B:2,A:3};else if(U.Y)N.outputChannels=1,N.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(N.type==1)switch(R){case ln:N.getter=de;break;case kn:N.getter=re;break}else if(N.type==2)switch(R){case ln:N.getter=it;break;case kn:N.getter=W}else throw new Error("EXRLoader.parse: unsupported pixelType "+N.type+" for "+b.compression+".");N.columns=N.width;const z=N.width*N.height*N.outputChannels;switch(R){case ln:N.byteArray=new Float32Array(z),P&&N.byteArray.fill(1,0,z);break;case kn:N.byteArray=new Uint16Array(z),P&&N.byteArray.fill(15360,0,z);break;default:console.error("THREE.EXRLoader: unsupported type: ",R);break}let j=0;for(const X of b.channels)N.decodeChannels[X.name]!==void 0&&(N.channelByteOffsets[X.name]=j),j+=X.pixelType*2;if(N.totalBytes=j,N.outLineWidth=N.width*N.outputChannels,b.lineOrder==="INCREASING_Y"?N.scanOrder=X=>X:N.scanOrder=X=>N.height-1-X,N.outputChannels==4?(N.format=hn,N.colorSpace=un):(N.format=Xi,N.colorSpace=mi),b.spec.singleTile){N.blockHeight=b.tiles.ySize,N.blockWidth=b.tiles.xSize;const X=_c(b.tiles,N.width,N.height),ie=wc(X,N.width,b.tiles.xSize,b.tiles.roundingMode),he=wc(X,N.height,b.tiles.ySize,b.tiles.roundingMode);N.tileCount=ie[0]*he[0];for(let ce=0;ce<X;ce++)for(let fe=0;fe<he[ce];fe++)for(let ge=0;ge<ie[ce];ge++)Ke(B,y);N.decode=Hh.bind(N)}else{N.blockWidth=N.width;const X=Math.ceil(N.height/N.blockHeight);for(let ie=0;ie<X;ie++)Ke(B,y);N.decode=eo.bind(N)}return N}const vc={value:0},Cc=new DataView(e),Qp=new Uint8Array(e),vs=zh(Cc,e,vc),tr=to(vs,Cc,Qp,vc,this.type);return tr.decode(),{header:vs,width:tr.width,height:tr.height,data:tr.byteArray,format:tr.format,colorSpace:tr.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,s){function r(a,o){a.colorSpace=o.colorSpace,a.minFilter=qt,a.magFilter=qt,a.generateMipmaps=!1,a.flipY=!1,t&&t(a,o)}return super.load(e,r,n,s)}}function WT(i,e){const{id:t,path:n}=e;return t==="neutral"?Promise.resolve({envMap:i.neutralEnvironment}):t===""?Promise.resolve({envMap:null}):new Promise((s,r)=>{new VT().load(n,a=>{const o=i.pmremGenerator.fromEquirectangular(a).texture;a.dispose(),i._loadedEnvironment&&i._loadedEnvironment!==o&&i._loadedEnvironment.dispose(),i._loadedEnvironment=o,s({envMap:o})},void 0,r)})}function qT(i){i.renderer.render(i.scene,i.activeCamera),i.renderer.domElement.toBlob(e=>{if(!e)return;const t=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),n=URL.createObjectURL(e),s=document.createElement("a");s.download=`3d-screenshot-${t}.png`,s.href=n,s.click(),URL.revokeObjectURL(n)},"image/png"),KT(i)}function KT(i){const e=document.createElement("div");e.className="screenshot-flash",i.el.appendChild(e),e.addEventListener("animationend",()=>e.remove())}function jT(i,e){i.mixer&&(i.mixer.stopAllAction(),i.mixer.uncacheRoot(i.mixer.getRoot()),i.mixer=null),i.clips=e,e.length&&(i.mixer=new xg(i.content))}function XT(i){i.clips.forEach(e=>{i.mixer.clipAction(e).reset().play(),i.state.actionStates[e.name]=!0}),i.invalidate()}function G0(i,e,t){const n=t.length-i-1;if(e>=t[n])return n-1;if(e<=t[i])return i;let s=i,r=n,a=Math.floor((s+r)/2);for(;e<t[a]||e>=t[a+1];)e<t[a]?r=a:s=a,a=Math.floor((s+r)/2);return a}function YT(i,e,t,n){const s=[],r=[],a=[];s[0]=1;for(let o=1;o<=t;++o){r[o]=e-n[i+1-o],a[o]=n[i+o]-e;let c=0;for(let l=0;l<o;++l){const h=a[l+1],u=r[o-l],d=s[l]/(h+u);s[l]=c+h*d,c=u*d}s[o]=c}return s}function JT(i,e,t,n){const s=G0(i,n,e),r=YT(s,n,i,e),a=new gt(0,0,0,0);for(let o=0;o<=i;++o){const c=t[s-i+o],l=r[o],h=c.w*l;a.x+=c.x*h,a.y+=c.y*h,a.z+=c.z*h,a.w+=c.w*l}return a}function ZT(i,e,t,n,s){const r=[];for(let u=0;u<=t;++u)r[u]=0;const a=[];for(let u=0;u<=n;++u)a[u]=r.slice(0);const o=[];for(let u=0;u<=t;++u)o[u]=r.slice(0);o[0][0]=1;const c=r.slice(0),l=r.slice(0);for(let u=1;u<=t;++u){c[u]=e-s[i+1-u],l[u]=s[i+u]-e;let d=0;for(let f=0;f<u;++f){const p=l[f+1],m=c[u-f];o[u][f]=p+m;const g=o[f][u-1]/o[u][f];o[f][u]=d+p*g,d=m*g}o[u][u]=d}for(let u=0;u<=t;++u)a[0][u]=o[u][t];for(let u=0;u<=t;++u){let d=0,f=1;const p=[];for(let m=0;m<=t;++m)p[m]=r.slice(0);p[0][0]=1;for(let m=1;m<=n;++m){let g=0;const A=u-m,_=t-m;u>=m&&(p[f][0]=p[d][0]/o[_+1][A],g=p[f][0]*o[A][_]);const x=A>=-1?1:-A,E=u-1<=_?m-1:t-u;for(let w=x;w<=E;++w)p[f][w]=(p[d][w]-p[d][w-1])/o[_+1][A+w],g+=p[f][w]*o[A+w][_];u<=_&&(p[f][m]=-p[d][m-1]/o[_+1][u],g+=p[f][m]*o[u][_]),a[m][u]=g;const S=d;d=f,f=S}}let h=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)a[u][d]*=h;h*=t-u}return a}function $T(i,e,t,n,s){const r=s<i?s:i,a=[],o=G0(i,n,e),c=ZT(o,n,i,r,e),l=[];for(let h=0;h<t.length;++h){const u=t[h].clone(),d=u.w;u.x*=d,u.y*=d,u.z*=d,l[h]=u}for(let h=0;h<=r;++h){const u=l[o-i].clone().multiplyScalar(c[h][0]);for(let d=1;d<=i;++d)u.add(l[o-i+d].clone().multiplyScalar(c[h][d]));a[h]=u}for(let h=r+1;h<=s+1;++h)a[h]=new gt(0,0,0);return a}function eR(i,e){let t=1;for(let s=2;s<=i;++s)t*=s;let n=1;for(let s=2;s<=e;++s)n*=s;for(let s=2;s<=i-e;++s)n*=s;return t/n}function tR(i){const e=i.length,t=[],n=[];for(let r=0;r<e;++r){const a=i[r];t[r]=new G(a.x,a.y,a.z),n[r]=a.w}const s=[];for(let r=0;r<e;++r){const a=t[r].clone();for(let o=1;o<=r;++o)a.sub(s[r-o].clone().multiplyScalar(eR(r,o)*n[o]));s[r]=a.divideScalar(n[0])}return s}function nR(i,e,t,n,s){const r=$T(i,e,t,n,s);return tR(r)}class iR extends ew{constructor(e,t,n,s,r){super();const a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=s||0,this.endKnot=r||a;for(let c=0;c<o;++c){const l=n[c];this.controlPoints[c]=new gt(l.x,l.y,l.z,l.w)}}getPoint(e,t=new G){const n=t,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=JT(this.degree,this.knots,this.controlPoints,s);return r.w!==1&&r.divideScalar(r.w),n.set(r.x,r.y,r.z)}getTangent(e,t=new G){const n=t,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=nR(this.degree,this.knots,this.controlPoints,s,1);return n.copy(r[1]).normalize(),n}toJSON(){const e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=>t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>new gt(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}}let ht,$t,Gn;class sR extends ci{constructor(e){super(e)}load(e,t,n,s){const r=this,a=r.path===""?Ar.extractUrlBase(e):r.path,o=new os(this.manager);o.setPath(r.path),o.setResponseType("arraybuffer"),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(c){try{t(r.parse(c,a))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},n,s)}parse(e,t){if(hR(e))ht=new lR().parse(e);else{const s=q0(e);if(!uR(s))throw new Error("THREE.FBXLoader: Unknown format.");if(V0(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+V0(s));ht=new cR().parse(s)}const n=new dg(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new rR(n,this.manager).parse(ht)}}class rR{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){$t=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),s=this.parseDeformers(),r=new aR().parse(s);return this.parseScene(s,r,n),Gn}parseConnections(){const e=new Map;return"Connections"in ht&&ht.Connections.connections.forEach(function(n){const s=n[0],r=n[1],a=n[2];e.has(s)||e.set(s,{parents:[],children:[]});const o={ID:r,relationship:a};e.get(s).parents.push(o),e.has(r)||e.set(r,{parents:[],children:[]});const c={ID:s,relationship:a};e.get(r).children.push(c)}),e}parseImages(){const e={},t={};if("Video"in ht.Objects){const n=ht.Objects.Video;for(const s in n){const r=n[s],a=parseInt(s);if(e[a]=r.RelativeFilename||r.Filename,"Content"in r){const o=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,c=typeof r.Content=="string"&&r.Content!=="";if(o||c){const l=this.parseImage(n[s]);t[r.RelativeFilename||r.Filename]=l}}}}for(const n in e){const s=e[n];t[s]!==void 0?e[n]=t[s]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,s=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(s){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:console.warn('FBXLoader: Image type "'+s+'" is not supported.');return}if(typeof t=="string")return"data:"+r+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in ht.Objects){const n=ht.Objects.Texture;for(const s in n){const r=this.parseTexture(n[s],e);t.set(parseInt(s),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const s=e.WrapModeU,r=e.WrapModeV,a=s!==void 0?s.value:0,o=r!==void 0?r.value:0;if(n.wrapS=a===0?Ss:Zn,n.wrapT=o===0?Ss:Zn,"Scaling"in e){const c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}if("Translation"in e){const c=e.Translation.value;n.offset.x=c[0],n.offset.y=c[1]}return n}loadTexture(e,t){const n=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),s=e.FileName.split(".").pop().toLowerCase(),r=n.has(s)?this.manager.getHandler(`.${s}`):this.textureLoader;if(!r)return console.warn(`FBXLoader: ${s.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new nn;const a=r.path;a||r.setPath(this.textureLoader.path);const o=$t.get(e.id).children;let c;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(c=t[o[0].ID],(c.indexOf("blob:")===0||c.indexOf("data:")===0)&&r.setPath(void 0));const l=r.load(c);return r.setPath(a),l}parseMaterials(e){const t=new Map;if("Material"in ht.Objects){const n=ht.Objects.Material;for(const s in n){const r=this.parseMaterial(n[s],e);r!==null&&t.set(parseInt(s),r)}}return t}parseMaterial(e,t){const n=e.id,s=e.attrName;let r=e.ShadingModel;if(typeof r=="object"&&(r=r.value),!$t.has(n))return null;const a=this.parseParameters(e,t,n);let o;switch(r.toLowerCase()){case"phong":o=new Cl;break;case"lambert":o=new bw;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),o=new Cl;break}return o.setValues(a),o.name=s,o}parseParameters(e,t,n){const s={};e.BumpFactor&&(s.bumpScale=e.BumpFactor.value),e.Diffuse?s.color=tt.toWorkingColorSpace(new Fe().fromArray(e.Diffuse.value),yt):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(s.color=tt.toWorkingColorSpace(new Fe().fromArray(e.DiffuseColor.value),yt)),e.DisplacementFactor&&(s.displacementScale=e.DisplacementFactor.value),e.Emissive?s.emissive=tt.toWorkingColorSpace(new Fe().fromArray(e.Emissive.value),yt):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(s.emissive=tt.toWorkingColorSpace(new Fe().fromArray(e.EmissiveColor.value),yt)),e.EmissiveFactor&&(s.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),s.opacity=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0),(s.opacity===1||s.opacity===0)&&(s.opacity=e.Opacity?parseFloat(e.Opacity.value):null,s.opacity===null&&(s.opacity=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),s.opacity<1&&(s.transparent=!0),e.ReflectionFactor&&(s.reflectivity=e.ReflectionFactor.value),e.Shininess&&(s.shininess=e.Shininess.value),e.Specular?s.specular=tt.toWorkingColorSpace(new Fe().fromArray(e.Specular.value),yt):e.SpecularColor&&e.SpecularColor.type==="Color"&&(s.specular=tt.toWorkingColorSpace(new Fe().fromArray(e.SpecularColor.value),yt));const r=this;return $t.get(n).children.forEach(function(a){const o=a.relationship;switch(o){case"Bump":s.bumpMap=r.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":s.aoMap=r.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":s.map=r.getTexture(t,a.ID),s.map!==void 0&&(s.map.colorSpace=yt);break;case"DisplacementColor":s.displacementMap=r.getTexture(t,a.ID);break;case"EmissiveColor":s.emissiveMap=r.getTexture(t,a.ID),s.emissiveMap!==void 0&&(s.emissiveMap.colorSpace=yt);break;case"NormalMap":case"Maya|TEX_normal_map":s.normalMap=r.getTexture(t,a.ID);break;case"ReflectionColor":s.envMap=r.getTexture(t,a.ID),s.envMap!==void 0&&(s.envMap.mapping=Mc,s.envMap.colorSpace=yt);break;case"SpecularColor":s.specularMap=r.getTexture(t,a.ID),s.specularMap!==void 0&&(s.specularMap.colorSpace=yt);break;case"TransparentColor":case"TransparencyFactor":s.alphaMap=r.getTexture(t,a.ID),s.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",o);break}}),s}getTexture(e,t){return"LayeredTexture"in ht.Objects&&t in ht.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=$t.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ht.Objects){const n=ht.Objects.Deformer;for(const s in n){const r=n[s],a=$t.get(parseInt(s));if(r.attrType==="Skin"){const o=this.parseSkeleton(a,n);o.ID=s,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[s]=o}else if(r.attrType==="BlendShape"){const o={id:s};o.rawTargets=this.parseMorphTargets(a,n),o.id=s,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[s]=o}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(s){const r=t[s.ID];if(r.attrType!=="Cluster")return;const a={ID:s.ID,indices:[],weights:[],transformLink:new Re().fromArray(r.TransformLink.a)};"Indexes"in r&&(a.indices=r.Indexes.a,a.weights=r.Weights.a),n.push(a)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let s=0;s<e.children.length;s++){const r=e.children[s],a=t[r.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;o.geoID=$t.get(parseInt(r.ID)).children.filter(function(c){return c.relationship===void 0})[0].ID,n.push(o)}return n}parseScene(e,t,n){Gn=new ss;const s=this.parseModels(e.skeletons,t,n),r=ht.Objects.Model,a=this;s.forEach(function(c){const l=r[c.ID];a.setLookAtProperties(c,l),$t.get(c.ID).parents.forEach(function(u){const d=s.get(u.ID);d!==void 0&&d.add(c)}),c.parent===null&&Gn.add(c)}),this.bindSkeleton(e.skeletons,t,s),this.addGlobalSceneSettings(),Gn.traverse(function(c){if(c.userData.transformData){c.parent&&(c.userData.transformData.parentMatrix=c.parent.matrix,c.userData.transformData.parentMatrixWorld=c.parent.matrixWorld);const l=W0(c.userData.transformData);c.applyMatrix4(l),c.updateWorldMatrix()}});const o=new oR().parse();Gn.children.length===1&&Gn.children[0].isGroup&&(Gn.children[0].animations=o,Gn=Gn.children[0]),Gn.animations=o}parseModels(e,t,n){const s=new Map,r=ht.Objects.Model;for(const a in r){const o=parseInt(a),c=r[a],l=$t.get(o);let h=this.buildSkeleton(l,e,o,c.attrName);if(!h){switch(c.attrType){case"Camera":h=this.createCamera(l);break;case"Light":h=this.createLight(l);break;case"Mesh":h=this.createMesh(l,t,n);break;case"NurbsCurve":h=this.createCurve(l,t);break;case"LimbNode":case"Root":h=new cl;break;default:h=new ss;break}h.name=c.attrName?_t.sanitizeNodeName(c.attrName):"",h.userData.originalName=c.attrName,h.ID=o}this.getTransformData(h,c),s.set(o,h)}return s}buildSkeleton(e,t,n,s){let r=null;return e.parents.forEach(function(a){for(const o in t){const c=t[o];c.rawBones.forEach(function(l,h){if(l.ID===a.ID){const u=r;r=new cl,r.matrixWorld.copy(l.transformLink),r.name=s?_t.sanitizeNodeName(s):"",r.userData.originalName=s,r.ID=n,c.bones[h]=r,u!==null&&r.add(u)}})}}),r}createCamera(e){let t,n;if(e.children.forEach(function(s){const r=ht.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new Tt;else{let s=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(s=1);let r=1;n.NearPlane!==void 0&&(r=n.NearPlane.value/1e3);let a=1e3;n.FarPlane!==void 0&&(a=n.FarPlane.value/1e3);let o=window.innerWidth,c=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(o=n.AspectWidth.value,c=n.AspectHeight.value);const l=o/c;let h=45;n.FieldOfView!==void 0&&(h=n.FieldOfView.value);const u=n.FocalLength?n.FocalLength.value:null;switch(s){case 0:t=new Bn(h,l,r,a),u!==null&&t.setFocalLength(u);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new Tt;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),t=new Tt;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(s){const r=ht.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new Tt;else{let s;n.LightType===void 0?s=0:s=n.LightType.value;let r=16777215;n.Color!==void 0&&(r=tt.toWorkingColorSpace(new Fe().fromArray(n.Color.value),yt));let a=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(a=0);let o=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?o=0:o=n.FarAttenuationEnd.value);const c=1;switch(s){case 0:t=new Ml(r,a,o,c);break;case 1:t=new Ad(r,a);break;case 2:let l=Math.PI/3;n.InnerAngle!==void 0&&(l=In.degToRad(n.InnerAngle.value));let h=0;n.OuterAngle!==void 0&&(h=In.degToRad(n.OuterAngle.value),h=Math.max(h,1)),t=new Ag(r,a,o,l,h,c);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new Ml(r,a);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let s,r=null,a=null;const o=[];if(e.children.forEach(function(c){t.has(c.ID)&&(r=t.get(c.ID)),n.has(c.ID)&&o.push(n.get(c.ID))}),o.length>1?a=o:o.length>0?a=o[0]:(a=new Cl({name:ci.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),"color"in r.attributes&&o.forEach(function(c){c.vertexColors=!0}),r.groups.length>0){let c=!1;for(let l=0,h=r.groups.length;l<h;l++){const u=r.groups[l];(u.materialIndex<0||u.materialIndex>=o.length)&&(u.materialIndex=o.length,c=!0)}if(c){const l=new Cl;o.push(l)}}return r.FBX_Deformer?(s=new HA(r,a),s.normalizeSkinWeights()):s=new Zt(r,a),s}createCurve(e,t){const n=e.children.reduce(function(r,a){return t.has(a.ID)&&(r=t.get(a.ID)),r},null),s=new ma({name:ci.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new gl(n,s)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Xo(t.RotationOrder.value):n.eulerOrder=Xo(0),"Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&$t.get(e.ID).children.forEach(function(s){if(s.relationship==="LookAtProperty"){const r=ht.Objects.Model[s.ID];if("Lcl_Translation"in r){const a=r.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),Gn.add(e.target)):e.lookAt(new G().fromArray(a))}}})}bindSkeleton(e,t,n){const s=this.parsePoseNodes();for(const r in e){const a=e[r];$t.get(parseInt(a.ID)).parents.forEach(function(c){if(t.has(c.ID)){const l=c.ID;$t.get(l).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new hl(a.bones),s[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in ht.Objects){const t=ht.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const s=t[n].PoseNode;Array.isArray(s)?s.forEach(function(r){e[r.Node]=new Re().fromArray(r.Matrix.a)}):e[s.Node]=new Re().fromArray(s.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in ht){if("AmbientColor"in ht.GlobalSettings){const e=ht.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],s=e[2];if(t!==0||n!==0||s!==0){const r=new Fe().setRGB(t,n,s,yt);Gn.add(new mg(r,1))}}"UnitScaleFactor"in ht.GlobalSettings&&(Gn.userData.unitScaleFactor=ht.GlobalSettings.UnitScaleFactor.value)}}}class aR{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in ht.Objects){const n=ht.Objects.Geometry;for(const s in n){const r=$t.get(parseInt(s)),a=this.parseGeometry(r,n[s],e);t.set(parseInt(s),a)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const s=n.skeletons,r=[],a=e.parents.map(function(u){return ht.Objects.Model[u.ID]});if(a.length===0)return;const o=e.children.reduce(function(u,d){return s[d.ID]!==void 0&&(u=s[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&r.push(n.morphTargets[u.ID])});const c=a[0],l={};"RotationOrder"in c&&(l.eulerOrder=Xo(c.RotationOrder.value)),"InheritType"in c&&(l.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(l.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(l.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(l.scale=c.GeometricScaling.value);const h=W0(l);return this.genGeometry(t,o,r,h)}genGeometry(e,t,n,s){const r=new Mn;e.attrName&&(r.name=e.attrName);const a=this.parseGeoNode(e,t),o=this.genBuffers(a),c=new Jt(o.vertex,3);if(c.applyMatrix4(s),r.setAttribute("position",c),o.colors.length>0&&r.setAttribute("color",new Jt(o.colors,3)),t&&(r.setAttribute("skinIndex",new ju(o.weightsIndices,4)),r.setAttribute("skinWeight",new Jt(o.vertexWeights,4)),r.FBX_Deformer=t),o.normal.length>0){const l=new ot().getNormalMatrix(s),h=new Jt(o.normal,3);h.applyNormalMatrix(l),r.setAttribute("normal",h)}if(o.uvs.forEach(function(l,h){const u=h===0?"uv":`uv${h}`;r.setAttribute(u,new Jt(o.uvs[h],2))}),a.material&&a.material.mappingType!=="AllSame"){let l=o.materialIndex[0],h=0;if(o.materialIndex.forEach(function(u,d){u!==l&&(r.addGroup(h,d-h,l),l=u,h=d)}),r.groups.length>0){const u=r.groups[r.groups.length-1],d=u.start+u.count;d!==o.materialIndex.length&&r.addGroup(d,o.materialIndex.length-d,l)}r.groups.length===0&&r.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(r,e,n,s),r}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let s=0;for(;e.LayerElementUV[s];)e.LayerElementUV[s].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[s])),s++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(s,r){s.indices.forEach(function(a,o){n.weightTable[a]===void 0&&(n.weightTable[a]=[]),n.weightTable[a].push({id:r,weight:s.weights[o]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,s=0,r=!1,a=[],o=[],c=[],l=[],h=[],u=[];const d=this;return e.vertexIndices.forEach(function(f,p){let m,g=!1;f<0&&(f=f^-1,g=!0);let A=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){const x=eh(p,n,f,e.color);c.push(x[0],x[1],x[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(x){_.push(x.weight),A.push(x.id)}),_.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const x=[0,0,0,0],E=[0,0,0,0];_.forEach(function(S,w){let I=S,T=A[w];E.forEach(function(C,v,F){if(I>C){F[v]=I,I=C;const K=x[v];x[v]=T,T=K}})}),A=x,_=E}for(;_.length<4;)_.push(0),A.push(0);for(let x=0;x<4;++x)h.push(_[x]),u.push(A[x])}if(e.normal){const x=eh(p,n,f,e.normal);o.push(x[0],x[1],x[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=eh(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(x,E){const S=eh(p,n,f,x);l[E]===void 0&&(l[E]=[]),l[E].push(S[0]),l[E].push(S[1])}),s++,g&&(d.genFace(t,e,a,m,o,c,l,h,u,s),n++,s=0,a=[],o=[],c=[],l=[],h=[],u=[])}),t}getNormalNewell(e){const t=new G(0,0,0);for(let n=0;n<e.length;n++){const s=e[n],r=e[(n+1)%e.length];t.x+=(s.y-r.y)*(s.z+r.z),t.y+=(s.z-r.z)*(s.x+r.x),t.z+=(s.x-r.x)*(s.y+r.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),s=(Math.abs(t.z)>.5?new G(0,1,0):new G(0,0,1)).cross(t).normalize(),r=t.clone().cross(s).normalize();return{normal:t,tangent:s,bitangent:r}}flattenVertex(e,t,n){return new Je(e.dot(t),e.dot(n))}genFace(e,t,n,s,r,a,o,c,l,h){let u;if(h>3){const d=[],f=t.baseVertexPositions||t.vertexPositions;for(let A=0;A<n.length;A+=3)d.push(new G(f[n[A]],f[n[A+1]],f[n[A+2]]));const{tangent:p,bitangent:m}=this.getNormalTangentAndBitangent(d),g=[];for(const A of d)g.push(this.flattenVertex(A,p,m));u=hd.triangulateShape(g,[])}else u=[[0,1,2]];for(const[d,f,p]of u)e.vertex.push(t.vertexPositions[n[d*3]]),e.vertex.push(t.vertexPositions[n[d*3+1]]),e.vertex.push(t.vertexPositions[n[d*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),e.vertex.push(t.vertexPositions[n[p*3]]),e.vertex.push(t.vertexPositions[n[p*3+1]]),e.vertex.push(t.vertexPositions[n[p*3+2]]),t.skeleton&&(e.vertexWeights.push(c[d*4]),e.vertexWeights.push(c[d*4+1]),e.vertexWeights.push(c[d*4+2]),e.vertexWeights.push(c[d*4+3]),e.vertexWeights.push(c[f*4]),e.vertexWeights.push(c[f*4+1]),e.vertexWeights.push(c[f*4+2]),e.vertexWeights.push(c[f*4+3]),e.vertexWeights.push(c[p*4]),e.vertexWeights.push(c[p*4+1]),e.vertexWeights.push(c[p*4+2]),e.vertexWeights.push(c[p*4+3]),e.weightsIndices.push(l[d*4]),e.weightsIndices.push(l[d*4+1]),e.weightsIndices.push(l[d*4+2]),e.weightsIndices.push(l[d*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3]),e.weightsIndices.push(l[p*4]),e.weightsIndices.push(l[p*4+1]),e.weightsIndices.push(l[p*4+2]),e.weightsIndices.push(l[p*4+3])),t.color&&(e.colors.push(a[d*3]),e.colors.push(a[d*3+1]),e.colors.push(a[d*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2]),e.colors.push(a[p*3]),e.colors.push(a[p*3+1]),e.colors.push(a[p*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(s),e.materialIndex.push(s),e.materialIndex.push(s)),t.normal&&(e.normal.push(r[d*3]),e.normal.push(r[d*3+1]),e.normal.push(r[d*3+2]),e.normal.push(r[f*3]),e.normal.push(r[f*3+1]),e.normal.push(r[f*3+2]),e.normal.push(r[p*3]),e.normal.push(r[p*3+1]),e.normal.push(r[p*3+2])),t.uv&&t.uv.forEach(function(m,g){e.uvs[g]===void 0&&(e.uvs[g]=[]),e.uvs[g].push(o[g][d*2]),e.uvs[g].push(o[g][d*2+1]),e.uvs[g].push(o[g][f*2]),e.uvs[g].push(o[g][f*2+1]),e.uvs[g].push(o[g][p*2]),e.uvs[g].push(o[g][p*2+1])})}addMorphTargets(e,t,n,s){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach(function(a){a.rawTargets.forEach(function(o){const c=ht.Objects.Geometry[o.geoID];c!==void 0&&r.genMorphGeometry(e,t,c,s,o.name)})})}genMorphGeometry(e,t,n,s,r){const a=t.Vertices!==void 0?t.Vertices.a:[],o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],c=n.Vertices!==void 0?n.Vertices.a:[],l=n.Indexes!==void 0?n.Indexes.a:[],h=e.attributes.position.count*3,u=new Float32Array(h);for(let m=0;m<l.length;m++){const g=l[m]*3;u[g]=c[m*3],u[g+1]=c[m*3+1],u[g+2]=c[m*3+2]}const d={vertexIndices:o,vertexPositions:u,baseVertexPositions:a},f=this.genBuffers(d),p=new Jt(f.vertex,3);p.name=r||n.attrName,p.applyMatrix4(s),e.morphAttributes.position.push(p)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Normals.a;let r=[];return n==="IndexToDirect"&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:s,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.UV.a;let r=[];return n==="IndexToDirect"&&(r=e.UVIndex.a),{dataSize:2,buffer:s,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Colors.a;let r=[];n==="IndexToDirect"&&(r=e.ColorIndex.a);for(let a=0,o=new Fe;a<s.length;a+=4)o.fromArray(s,a),tt.toWorkingColorSpace(o,yt),o.toArray(s,a);return{dataSize:4,buffer:s,indices:r,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const s=e.Materials.a,r=[];for(let a=0;a<s.length;++a)r.push(a);return{dataSize:1,buffer:s,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Mn;const n=t-1,s=e.KnotVector.a,r=[],a=e.Points.a;for(let u=0,d=a.length;u<d;u+=4)r.push(new gt().fromArray(a,u));let o,c;if(e.Form==="Closed")r.push(r[0]);else if(e.Form==="Periodic"){o=n,c=s.length-1-o;for(let u=0;u<n;++u)r.push(r[u])}const h=new iR(n,s,r,o,c).getPoints(r.length*12);return new Mn().setFromPoints(h)}}class oR{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const s=t[n],r=this.addClip(s);e.push(r)}return e}parseClips(){if(ht.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=ht.Objects.AnimationCurveNode,t=new Map;for(const n in e){const s=e[n];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){const r={id:s.id,attr:s.attrName,curves:{}};t.set(r.id,r)}}return t}parseAnimationCurves(e){const t=ht.Objects.AnimationCurve;for(const n in t){const s={id:t[n].id,times:t[n].KeyTime.a.map(dR),values:t[n].KeyValueFloat.a},r=$t.get(s.id);if(r!==void 0){const a=r.parents[0].ID,o=r.parents[0].relationship;o.match(/X/)?e.get(a).curves.x=s:o.match(/Y/)?e.get(a).curves.y=s:o.match(/Z/)?e.get(a).curves.z=s:o.match(/DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=s)}}}parseAnimationLayers(e){const t=ht.Objects.AnimationLayer,n=new Map;for(const s in t){const r=[],a=$t.get(parseInt(s));a!==void 0&&(a.children.forEach(function(c,l){if(e.has(c.ID)){const h=e.get(c.ID);if(h.curves.x!==void 0||h.curves.y!==void 0||h.curves.z!==void 0){if(r[l]===void 0){const u=$t.get(c.ID).parents.filter(function(d){return d.relationship!==void 0})[0].ID;if(u!==void 0){const d=ht.Objects.Model[u.toString()];if(d===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",c);return}const f={modelName:d.attrName?_t.sanitizeNodeName(d.attrName):"",ID:d.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Gn.traverse(function(p){p.ID===d.id&&(f.transform=p.matrix,p.userData.transformData&&(f.eulerOrder=p.userData.transformData.eulerOrder))}),f.transform||(f.transform=new Re),"PreRotation"in d&&(f.preRotation=d.PreRotation.value),"PostRotation"in d&&(f.postRotation=d.PostRotation.value),r[l]=f}}r[l]&&(r[l][h.attr]=h)}else if(h.curves.morph!==void 0){if(r[l]===void 0){const u=$t.get(c.ID).parents.filter(function(A){return A.relationship!==void 0})[0].ID,d=$t.get(u).parents[0].ID,f=$t.get(d).parents[0].ID,p=$t.get(f).parents[0].ID,m=ht.Objects.Model[p],g={modelName:m.attrName?_t.sanitizeNodeName(m.attrName):"",morphName:ht.Objects.Deformer[u].attrName};r[l]=g}r[l][h.attr]=h}}}),n.set(parseInt(s),r))}return n}parseAnimStacks(e){const t=ht.Objects.AnimationStack,n={};for(const s in t){const r=$t.get(parseInt(s)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(r[0].ID);n[s]={name:t[s].attrName,layer:a}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(s){t=t.concat(n.generateTracks(s))}),new Sl(e.name,-1,t)}generateTracks(e){const t=[];let n=new G,s=new G;if(e.transform&&e.transform.decompose(n,new Yt,s),n=n.toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const r=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");r!==void 0&&t.push(r)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const r=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);r!==void 0&&t.push(r)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const r=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");r!==void 0&&t.push(r)}if(e.DeformPercent!==void 0){const r=this.generateMorphTrack(e);r!==void 0&&t.push(r)}return t}generateVectorTrack(e,t,n,s){const r=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(r,t,n);return new pr(e+"."+s,r,a)}generateRotationTrack(e,t,n,s,r){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const d=this.interpolateRotations(t.x,t.y,t.z,r);a=d[0],o=d[1]}const c=Xo(0);n!==void 0&&(n=n.map(In.degToRad),n.push(c),n=new dn().fromArray(n),n=new Yt().setFromEuler(n)),s!==void 0&&(s=s.map(In.degToRad),s.push(c),s=new dn().fromArray(s),s=new Yt().setFromEuler(s).invert());const l=new Yt,h=new dn,u=[];if(!o||!a)return new Us(e+".quaternion",[0],[0]);for(let d=0;d<o.length;d+=3)h.set(o[d],o[d+1],o[d+2],r),l.setFromEuler(h),n!==void 0&&l.premultiply(n),s!==void 0&&l.multiply(s),d>2&&new Yt().fromArray(u,(d-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(u,d/3*4);return new Us(e+".quaternion",a,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(r){return r/100}),s=Gn.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new fr(e.modelName+".morphTargetInfluences["+s+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,s){return n-s}),t.length>1){let n=1,s=t[0];for(let r=1;r<t.length;r++){const a=t[r];a!==s&&(t[n]=a,s=a,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const s=n,r=[];let a=-1,o=-1,c=-1;return e.forEach(function(l){if(t.x&&(a=t.x.times.indexOf(l)),t.y&&(o=t.y.times.indexOf(l)),t.z&&(c=t.z.times.indexOf(l)),a!==-1){const h=t.x.values[a];r.push(h),s[0]=h}else r.push(s[0]);if(o!==-1){const h=t.y.values[o];r.push(h),s[1]=h}else r.push(s[1]);if(c!==-1){const h=t.z.values[c];r.push(h),s[2]=h}else r.push(s[2])}),r}interpolateRotations(e,t,n,s){const r=[],a=[];r.push(e.times[0]),a.push(In.degToRad(e.values[0])),a.push(In.degToRad(t.values[0])),a.push(In.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){const c=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))continue;const l=c.map(In.degToRad),h=[e.values[o],t.values[o],n.values[o]];if(isNaN(h[0])||isNaN(h[1])||isNaN(h[2]))continue;const u=h.map(In.degToRad),d=[h[0]-c[0],h[1]-c[1],h[2]-c[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){const m=Math.max(...f)/180,g=new dn(...l,s),A=new dn(...u,s),_=new Yt().setFromEuler(g),x=new Yt().setFromEuler(A);_.dot(x)&&x.set(-x.x,-x.y,-x.z,-x.w);const E=e.times[o-1],S=e.times[o]-E,w=new Yt,I=new dn;for(let T=0;T<1;T+=1/m)w.copy(_.clone().slerp(x.clone(),T)),r.push(E+T*S),I.setFromQuaternion(w,s),a.push(I.x),a.push(I.y),a.push(I.z)}else r.push(e.times[o]),a.push(In.degToRad(e.values[o])),a.push(In.degToRad(t.values[o])),a.push(In.degToRad(n.values[o]))}return[r,a]}}class cR{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new z0,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(s,r){const a=s.match(/^[\s\t]*;/),o=s.match(/^[\s\t]*$/);if(a||o)return;const c=s.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),l=s.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),h=s.match("^\\t{"+(t.currentIndent-1)+"}}");c?t.parseNodeBegin(s,c):l?t.parseNodeProperty(s,l,n[++r]):h?t.popStack():s.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(s)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),s=t[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),r={name:n},a=this.parseNodeAttr(s),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,r):n in o?(n==="PoseNode"?o.PoseNode.push(r):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==""&&(o[n][a.id]=r)):typeof a.id=="number"?(o[n]={},o[n][a.id]=r):n!=="Properties70"&&(n==="PoseNode"?o[n]=[r]:o[n]=r),typeof a.id=="number"&&(r.id=a.id),a.name!==""&&(r.attrName=a.name),a.type!==""&&(r.attrType=a.type),this.pushStack(r)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",s="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),s=e[2]),{id:t,name:n,type:s}}parseNodeProperty(e,t,n){let s=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();s==="Content"&&r===","&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,s,r);return}if(s==="C"){const c=r.split(",").slice(1),l=parseInt(c[0]),h=parseInt(c[1]);let u=r.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),s="connections",r=[l,h],pR(r,u),a[s]===void 0&&(a[s]=[])}s==="Node"&&(a.id=r),s in a&&Array.isArray(a[s])?a[s].push(r):s!=="a"?a[s]=r:a.a=r,this.setCurrentProp(a,s),s==="a"&&r.slice(-1)!==","&&(a.a=Sf(r))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Sf(t.a))}parseNodeSpecialProperty(e,t,n){const s=n.split('",').map(function(h){return h.trim().replace(/^\"/,"").replace(/\s/,"_")}),r=s[0],a=s[1],o=s[2],c=s[3];let l=s[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=Sf(l);break}this.getPrevNode()[r]={type:a,type2:o,flag:c,value:l},this.setCurrentProp(this.getPrevNode(),r)}}class lR{parse(e){const t=new H0(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const s=new z0;for(;!this.endOfContent(t);){const r=this.parseNode(t,n);r!==null&&s.add(r.name,r)}return s}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},s=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),o=e.getString(a);if(s===0)return null;const c=[];for(let d=0;d<r;d++)c.push(this.parseProperty(e));const l=c.length>0?c[0]:"",h=c.length>1?c[1]:"",u=c.length>2?c[2]:"";for(n.singleProperty=r===1&&e.getOffset()===s;s>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(o,n,d)}return n.propertyList=c,typeof l=="number"&&(n.id=l),h!==""&&(n.attrName=h),u!==""&&(n.attrType=u),o!==""&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const s=n.propertyList[0];Array.isArray(s)?(t[n.name]=n,n.a=s):t[n.name]=s}else if(e==="Connections"&&n.name==="C"){const s=[];n.propertyList.forEach(function(r,a){a!==0&&s.push(r)}),t.connections===void 0&&(t.connections=[]),t.connections.push(s)}else if(n.name==="Properties70")Object.keys(n).forEach(function(r){t[r]=n[r]});else if(e==="Properties70"&&n.name==="P"){let s=n.propertyList[0],r=n.propertyList[1];const a=n.propertyList[2],o=n.propertyList[3];let c;s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),r==="Color"||r==="ColorRGB"||r==="Vector"||r==="Vector3D"||r.indexOf("Lcl_")===0?c=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:c=n.propertyList[4],t[s]={type:r,type2:a,flag:o,value:c}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const s=e.getUint32(),r=e.getUint32(),a=e.getUint32();if(r===0)switch(t){case"b":case"c":return e.getBooleanArray(s);case"d":return e.getFloat64Array(s);case"f":return e.getFloat32Array(s);case"i":return e.getInt32Array(s);case"l":return e.getInt64Array(s)}const o=jo(new Uint8Array(e.getArrayBuffer(a))),c=new H0(o.buffer);switch(t){case"b":case"c":return c.getBooleanArray(s);case"d":return c.getFloat64Array(s);case"f":return c.getFloat32Array(s);case"i":return c.getInt32Array(s);case"l":return c.getInt64Array(s)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class H0{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const s=n.indexOf(0);return s>=0&&(n=new Uint8Array(this.dv.buffer,t,s)),this._textDecoder.decode(n)}}class z0{add(e,t){this[e]=t}}function hR(i){const e="Kaydara FBX Binary \0";return i.byteLength>=e.length&&e===q0(i,0,e.length)}function uR(i){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(s){const r=i[s-1];return i=i.slice(t+s),t++,r}for(let s=0;s<e.length;++s)if(n(1)===e[s])return!1;return!0}function V0(i){const e=/FBXVersion: (\d+)/,t=i.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function dR(i){return i/46186158e3}const fR=[];function eh(i,e,t,n){let s;switch(n.mappingType){case"ByPolygonVertex":s=i;break;case"ByPolygon":s=e;break;case"ByVertice":s=t;break;case"AllSame":s=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(s=n.indices[s]);const r=s*n.dataSize,a=r+n.dataSize;return AR(fR,n.buffer,r,a)}const If=new dn,Na=new G;function W0(i){const e=new Re,t=new Re,n=new Re,s=new Re,r=new Re,a=new Re,o=new Re,c=new Re,l=new Re,h=new Re,u=new Re,d=new Re,f=i.inheritType?i.inheritType:0;i.translation&&e.setPosition(Na.fromArray(i.translation));const p=Xo(0);if(i.preRotation){const F=i.preRotation.map(In.degToRad);F.push(p),t.makeRotationFromEuler(If.fromArray(F))}if(i.rotation){const F=i.rotation.map(In.degToRad);F.push(i.eulerOrder||p),n.makeRotationFromEuler(If.fromArray(F))}if(i.postRotation){const F=i.postRotation.map(In.degToRad);F.push(p),s.makeRotationFromEuler(If.fromArray(F)),s.invert()}i.scale&&r.scale(Na.fromArray(i.scale)),i.scalingOffset&&o.setPosition(Na.fromArray(i.scalingOffset)),i.scalingPivot&&a.setPosition(Na.fromArray(i.scalingPivot)),i.rotationOffset&&c.setPosition(Na.fromArray(i.rotationOffset)),i.rotationPivot&&l.setPosition(Na.fromArray(i.rotationPivot)),i.parentMatrixWorld&&(u.copy(i.parentMatrix),h.copy(i.parentMatrixWorld));const m=t.clone().multiply(n).multiply(s),g=new Re;g.extractRotation(h);const A=new Re;A.copyPosition(h);const _=A.clone().invert().multiply(h),x=g.clone().invert().multiply(_),E=r,S=new Re;if(f===0)S.copy(g).multiply(m).multiply(x).multiply(E);else if(f===1)S.copy(g).multiply(x).multiply(m).multiply(E);else{const K=new Re().scale(new G().setFromMatrixScale(u)).clone().invert(),q=x.clone().multiply(K);S.copy(g).multiply(m).multiply(q).multiply(E)}const w=l.clone().invert(),I=a.clone().invert();let T=e.clone().multiply(c).multiply(l).multiply(t).multiply(n).multiply(s).multiply(w).multiply(o).multiply(a).multiply(r).multiply(I);const C=new Re().copyPosition(T),v=h.clone().multiply(C);return d.copyPosition(v),T=d.clone().multiply(S),T.premultiply(h.invert()),T}function Xo(i){i=i||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return i===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[i]}function Sf(i){return i.split(",").map(function(t){return parseFloat(t)})}function q0(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=i.byteLength),new TextDecoder().decode(new Uint8Array(i,e,t))}function pR(i,e){for(let t=0,n=i.length,s=e.length;t<s;t++,n++)i[n]=e[t]}function AR(i,e,t,n){for(let s=t,r=0;s<n;s++,r++)i[r]=e[s];return i}const gR=.35;class mR{constructor(){this.model=null,this.mixer=null,this.clips=new Map,this.actions=new Map,this.currentName=null,this.currentAction=null,this.loader=new Md,this.fbxLoader=new sR,this.onChange=null,this._gltfCache=new Map,this._animationDefs=[]}attach(e){this.detach(),this.model=e,this.mixer=new xg(e),this.actions.clear(),this.currentAction=null,this.currentName=null;for(const[t,n]of this.clips){const s=this._retargetClip(n,t),r=this.mixer.clipAction(s);r.enabled=!0,this.actions.set(t,r)}}detach(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null),this.model=null,this.actions.clear(),this.currentAction=null,this.currentName=null}setAnimationDefs(e){this._animationDefs=e}getAnimationDefs(){return this._animationDefs}async loadAnimation(e,t,n={}){if(this.clips.has(e))return this.clips.get(e);let s;if(this._gltfCache.has(t))s=this._gltfCache.get(t);else{const a=t.toLowerCase().endsWith(".fbx");s=(await new Promise((c,l)=>{(a?this.fbxLoader:this.loader).load(t,c,void 0,l)})).animations||[],this._gltfCache.set(t,s)}let r;if(n.clipName?(r=s.find(a=>a.name===n.clipName),r||(console.warn(`[AnimationManager] Clip "${n.clipName}" not found in ${t}, using first clip`),r=s[0])):r=s[0],!r)throw new Error(`No animation found in ${t}`);if(r=r.clone(),r.name=e,this.clips.set(e,r),this.model&&this.mixer){const a=this._retargetClip(r,e),o=this.mixer.clipAction(a);o.enabled=!0,o.setLoop(n.loop===!1?iA:sA),n.loop===!1&&(o.clampWhenFinished=!0),this.actions.set(e,o)}return r}async loadAll(){const e=this._animationDefs.map(async t=>{try{await this.loadAnimation(t.name,t.url,{loop:t.loop!==!1,clipName:t.clipName})}catch(n){console.warn(`[AnimationManager] Failed to load "${t.name}" from ${t.url}:`,n)}});await Promise.all(e)}play(e){const t=this.actions.get(e);if(!t){console.warn(`[AnimationManager] Animation "${e}" not loaded`);return}this.currentAction&&this.currentAction!==t&&this.currentAction.fadeOut(.01),t.reset().fadeIn(.01).play(),this.currentAction=t,this.currentName=e,this.onChange&&this.onChange(e)}crossfadeTo(e,t=gR){if(e===this.currentName)return;const n=this.actions.get(e);if(!n){console.warn(`[AnimationManager] Animation "${e}" not loaded`);return}n.reset(),n.play(),this.currentAction?this.currentAction.crossFadeTo(n,t,!0):n.fadeIn(t),this.currentAction=n,this.currentName=e,this.onChange&&this.onChange(e)}stopAll(){this.mixer&&this.mixer.stopAllAction(),this.currentAction=null,this.currentName=null,this.onChange&&this.onChange(null)}update(e){this.mixer&&this.mixer.update(e)}_retargetClip(e,t){if(!this.model)return e;const n=new Set;if(this.model.traverse(l=>{l.isBone&&n.add(l.name)}),n.size===0)return e;const s=new Set;for(const l of e.tracks){const h=l.name.split(".")[0];s.add(h)}let r=0;for(const l of s)n.has(l)&&r++;if(r/s.size>.5)return e;const a=this._buildBoneNameMap(n,s);if(!a)return e;const o=e.tracks.map(l=>{const h=l.name.split("."),u=h[0],d=h.slice(1).join("."),f=a.get(u);if(!f)return null;const p=l.clone();return p.name=`${f}.${d}`,p}).filter(Boolean),c=e.clone();return c.tracks=o,c}_buildBoneNameMap(e,t){const n=new Map,s=[...e],r=[...t],a=h=>h.replace(/^mixamorig\d*[_:]?/i,"").replace(/^Armature[_/]?/i,""),o=new Map(s.map(h=>[a(h),h]));let c=0;for(const h of r){const u=a(h);o.has(u)&&(n.set(h,o.get(u)),c++)}if(c/r.length>.5)return n;const l=new Map(s.map(h=>[h.toLowerCase(),h]));n.clear(),c=0;for(const h of r)l.has(h.toLowerCase())&&(n.set(h,l.get(h.toLowerCase())),c++);return c/r.length>.5?n:null}getLoadedNames(){return[...this.clips.keys()]}isLoaded(e){return this.clips.has(e)}dispose(){this.detach(),this.clips.clear(),this._gltfCache.clear(),this._animationDefs=[]}}rs.enabled=!0;class Mf{constructor(e,t){this.el=e,this.options=t,this.lights=[],this.content=null,this.mixer=null,this.clips=[],this.gui=null,this.animationManager=new mR,this._animPanelEl=null,this.state={environment:t.preset===_f.ASSET_GENERATOR?Ql.find(r=>r.id==="footprint-court").name:Ql[1].name,background:!1,playbackSpeed:1,actionStates:{},camera:Zl,wireframe:!1,skeleton:!1,grid:!1,autoRotate:!1,punctualLights:!0,exposure:0,toneMapping:$h,ambientIntensity:.3,ambientColor:"#FFFFFF",directIntensity:.8*Math.PI,directColor:"#FFFFFF",bgColor:"#000000",transparentBg:!1,pointSize:1,showInfo:!0,showLabels:!1,followMode:"mouse"},this.prevTime=0,this.stats=new Lo,this.stats.dom.height="48px",[].forEach.call(this.stats.dom.children,r=>r.style.display=""),this.backgroundColor=new Fe(this.state.bgColor),this.scene=new Zu,this.scene.background=this.backgroundColor;const n=t.preset===_f.ASSET_GENERATOR?.8*180/Math.PI:60,s=e.clientWidth/e.clientHeight;this.defaultCamera=new Bn(n,s,.01,1e3),this.activeCamera=this.defaultCamera,this.scene.add(this.defaultCamera),this.renderer=window.renderer=new Jg({antialias:!0,alpha:!0}),this.renderer.setClearColor(0,1),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.renderer.setSize(e.clientWidth,e.clientHeight),this.pmremGenerator=new vd(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.neutralEnvironment=this.pmremGenerator.fromScene(new J1).texture,this.controls=new U1(this.defaultCamera,this.renderer.domElement),this.controls.screenSpacePanning=!0,this._onControlsChange=()=>this.invalidate(),this.controls.addEventListener("change",this._onControlsChange),this.el.appendChild(this.renderer.domElement),this.cameraCtrl=null,this.cameraFolder=null,this.animFolder=null,this.animCtrls=[],this.morphFolder=null,this.morphCtrls=[],this.skeletonHelpers=[],this.gridHelper=null,this.axesHelper=null,this.modelInfo=null,this.annotationEls=[],this._tempVec=new G,this.addAxesHelper(),this.addGUI(),t.kiosk&&this.gui.close(),this.animate=this.animate.bind(this),this._rafId=null,this._visible=!0,this._tabVisible=!document.hidden,this._disposed=!1,this._loadedEnvironment=null,this._guiWrap=null,this._needsRender=!0,this._animating=!1,this._onVisibilityChange=()=>{const r=!this._tabVisible;this._tabVisible=!document.hidden,r&&this._tabVisible&&(this._needsRender=!0),this._updateRenderLoop()},document.addEventListener("visibilitychange",this._onVisibilityChange),typeof IntersectionObserver<"u"&&(this._intersectionObserver=new IntersectionObserver(r=>{const a=!this._visible;this._visible=r[r.length-1].isIntersecting,a&&this._visible&&(this._needsRender=!0),this._updateRenderLoop()},{threshold:0}),this._intersectionObserver.observe(this.el)),this._onResize=this.resize.bind(this),this._onKeyDown=r=>{(r.key==="p"||r.key==="P")&&!this.isInputFocused()&&this.takeScreenshot()},this._updateRenderLoop(),window.addEventListener("resize",this._onResize,!1),window.addEventListener("keydown",this._onKeyDown)}invalidate(){this._disposed||(this._needsRender=!0,this._updateRenderLoop())}_recomputeAnimating(){let e=!1;if(this.state&&this.state.autoRotate&&(e=!0),!e&&this.mixer&&this.state){for(const t in this.state.actionStates)if(this.state.actionStates[t]){e=!0;break}}!e&&this.animationManager.currentAction&&(e=!0),this._animating=e}_updateRenderLoop(){if(this._disposed)return;const e=this._visible&&this._tabVisible;e&&(this._needsRender||this._animating)&&this._rafId===null?(this.prevTime=performance.now(),this._rafId=requestAnimationFrame(this.animate)):!e&&this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}animate(e){const t=(e-this.prevTime)/1e3;if(this.prevTime=e,this._recomputeAnimating(),this.controls.update(),this.stats.update(),this.mixer&&this.mixer.update(t),this.animationManager.update(t),this._afterAnimateHooks)for(let n=0;n<this._afterAnimateHooks.length;n++)this._afterAnimateHooks[n](t);this.render(),this._needsRender=!1,this._animating&&this._visible&&this._tabVisible&&!this._disposed?this._rafId=requestAnimationFrame(this.animate):this._rafId=null}isInputFocused(){const e=document.activeElement;return e&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}render(){this.renderer.render(this.scene,this.activeCamera),this.state.grid&&(this.axesCamera.position.copy(this.defaultCamera.position),this.axesCamera.lookAt(this.axesScene.position),this.axesRenderer.render(this.axesScene,this.axesCamera)),this.projectAnnotations()}takeScreenshot(){qT(this)}resize(){const{clientHeight:e,clientWidth:t}=this.el;this.defaultCamera.aspect=t/e,this.defaultCamera.updateProjectionMatrix(),this.renderer.setSize(t,e),this.axesCamera.aspect=this.axesDiv.clientWidth/this.axesDiv.clientHeight,this.axesCamera.updateProjectionMatrix(),this.axesRenderer.setSize(this.axesDiv.clientWidth,this.axesDiv.clientHeight),this.invalidate()}load(e,t,n){const s=Ar.extractUrlBase(e);return new Promise((r,a)=>{$l.setURLModifier((l,h)=>{const u=t+decodeURI(l).replace(s,"").replace(/^(\.?\/)/,"");if(n.has(u)){const d=n.get(u),f=URL.createObjectURL(d);return c.push(f),f}return(h||"")+l});const o=new Md($l).setCrossOrigin("anonymous").setDRACOLoader(CT).setKTX2Loader(IT.detectSupport(this.renderer)).setMeshoptDecoder(P1),c=[];o.load(e,l=>{window.VIEWER.json=l;const h=l.scene||l.scenes[0],u=l.animations||[];if(!h)throw new Error("This model contains no scene, and cannot be viewed here. However, it may contain individual 3D resources.");this.setContent(h,u),c.forEach(URL.revokeObjectURL),r(l)},void 0,a)})}setContent(e,t){this.clear(),e.updateMatrixWorld();const n=new ki().setFromObject(e),s=n.getSize(new G).length(),r=n.getCenter(new G);this.controls.reset(),e.position.x-=r.x,e.position.y-=r.y,e.position.z-=r.z,this.controls.maxDistance=s*10,this.defaultCamera.near=s/100,this.defaultCamera.far=s*100,this.defaultCamera.updateProjectionMatrix(),this.options.cameraPosition?(this.defaultCamera.position.fromArray(this.options.cameraPosition),this.defaultCamera.lookAt(new G)):(this.defaultCamera.position.copy(r),this.defaultCamera.position.x+=s/2,this.defaultCamera.position.y+=s/5,this.defaultCamera.position.z+=s/2,this.defaultCamera.lookAt(r)),this.setCamera(Zl),this.axesCamera.position.copy(this.defaultCamera.position),this.axesCamera.lookAt(this.axesScene.position),this.axesCamera.near=s/100,this.axesCamera.far=s*100,this.axesCamera.updateProjectionMatrix(),this.axesCorner.scale.set(s,s,s),this.controls.saveState(),this.scene.add(e),this.content=e,this.state.punctualLights=!0,this.content.traverse(a=>{a.isLight&&(this.state.punctualLights=!1)}),this.setClips(t),this.animationManager.attach(this.content),this._setupAnimationPanel(),this.updateLights(),this.updateGUI(),this.updateEnvironment(),this.updateDisplay(),this.updateModelInfo(e,t),this.updateAnnotations(),window.VIEWER.scene=this.content,this.invalidate()}setClips(e){jT(this,e)}playAllClips(){XT(this)}setCamera(e){e===Zl?(this.controls.enabled=!0,this.activeCamera=this.defaultCamera):(this.controls.enabled=!1,this.content.traverse(t=>{t.isCamera&&t.name===e&&(this.activeCamera=t)})),this.invalidate()}updateLights(){const e=this.state,t=this.lights;e.punctualLights&&!t.length?ST(this):!e.punctualLights&&t.length&&MT(this),this.renderer.toneMapping=Number(e.toneMapping),this.renderer.toneMappingExposure=Math.pow(2,e.exposure),t.length===2&&(t[0].intensity=e.ambientIntensity,t[0].color.set(e.ambientColor),t[1].intensity=e.directIntensity,t[1].color.set(e.directColor)),this.invalidate()}updateEnvironment(){const e=Ql.filter(t=>t.name===this.state.environment)[0];WT(this,e).then(({envMap:t})=>{this._disposed||!this.scene||(this.scene.environment=t,this.scene.background=this.state.transparentBg?null:this.state.background?t:this.backgroundColor,this.invalidate())})}updateDisplay(){this.skeletonHelpers.length&&this.skeletonHelpers.forEach(e=>this.scene.remove(e)),D0(this.content,e=>{e.wireframe=this.state.wireframe,e instanceof ad&&(e.size=this.state.pointSize)}),this.content.traverse(e=>{if(e.geometry&&e.skeleton&&this.state.skeleton){const t=new Jw(e.skeleton.bones[0].parent);t.material.linewidth=3,this.scene.add(t),this.skeletonHelpers.push(t)}}),this.state.grid!==!!this.gridHelper&&(this.state.grid?(this.gridHelper=new Zw,this.axesHelper=new yg,this.axesHelper.renderOrder=999,this.axesHelper.onBeforeRender=e=>e.clearDepth(),this.scene.add(this.gridHelper),this.scene.add(this.axesHelper)):(this.scene.remove(this.gridHelper),this.scene.remove(this.axesHelper),this.gridHelper=null,this.axesHelper=null,this.axesRenderer.clear())),this.controls.autoRotate=this.state.autoRotate,this.invalidate()}updateBackground(){this.backgroundColor.set(this.state.bgColor),this.state.transparentBg?(this.scene.background=null,this.renderer.setClearColor(0,0)):(this.scene.background=this.backgroundColor,this.renderer.setClearColor(0,1),this.updateEnvironment()),this.invalidate()}setBackgroundColor(e){this.state.bgColor=typeof e=="string"?e:"#"+e.toString(16).padStart(6,"0"),this.state.transparentBg=!1,this.updateBackground()}updateModelInfo(e,t){this.modelInfo&&(this.modelInfo.remove(),this.modelInfo=null),this.state.showInfo&&e&&(this.modelInfo=iT(this.el,e,t))}updateAnnotations(){if(this.annotationEls.forEach(t=>t.el.remove()),this.annotationEls=[],!this.state.showLabels||!this.content)return;aT(this.content).forEach(t=>{const n=oT(t),s=document.createElement("div");s.classList.add("annotation-label"),s.appendChild(n),this.el.appendChild(s),this.annotationEls.push({el:s,position:t.position})}),this.invalidate()}projectAnnotations(){if(this.annotationEls.length===0)return;const e=this.el.clientWidth,t=this.el.clientHeight,n=e/2,s=t/2,r=this._tempVec;this.annotationEls.forEach(({el:a,position:o})=>{if(r.copy(o),r.project(this.activeCamera),r.z>1){a.style.display="none";return}const c=r.x*n+n,l=-(r.y*s)+s;a.style.display="",a.style.left=c+"px",a.style.top=l+"px"})}addAxesHelper(){this.axesDiv=document.createElement("div"),this.el.appendChild(this.axesDiv),this.axesDiv.classList.add("axes");const{clientWidth:e,clientHeight:t}=this.axesDiv;this.axesScene=new Zu,this.axesCamera=new Bn(50,e/t,.1,10),this.axesScene.add(this.axesCamera),this.axesRenderer=new Jg({alpha:!0}),this.axesRenderer.setPixelRatio(window.devicePixelRatio),this.axesRenderer.setSize(this.axesDiv.clientWidth,this.axesDiv.clientHeight),this.axesCamera.up=this.defaultCamera.up,this.axesCorner=new yg(5),this.axesScene.add(this.axesCorner),this.axesDiv.appendChild(this.axesRenderer.domElement)}addGUI(){const e=window.innerWidth<=700,t=this.gui=new bM({autoPlace:!1,width:e?220:260,hideable:!0}),n=t.addFolder("Display");n.add(this.state,"background").onChange(()=>this.updateEnvironment()),n.add(this.state,"autoRotate").onChange(()=>this.updateDisplay()),n.add(this.state,"wireframe").onChange(()=>this.updateDisplay()),n.add(this.state,"skeleton").onChange(()=>this.updateDisplay()),n.add(this.state,"grid").onChange(()=>this.updateDisplay()),n.add(this.controls,"screenSpacePanning"),n.add(this.state,"pointSize",1,16).onChange(()=>this.updateDisplay()),n.add(this.state,"transparentBg").name("transparent bg").onChange(()=>this.updateBackground()),n.addColor(this.state,"bgColor").onChange(()=>this.updateBackground()),n.add({screenshot:()=>this.takeScreenshot()},"screenshot").name("Screenshot [P]"),n.add(this.state,"showInfo").name("model info").onChange(()=>this.updateModelInfo(this.content,this.clips)),n.add(this.state,"showLabels").name("mesh labels").onChange(()=>this.updateAnnotations());const p=t.addFolder("Lighting");p.add(this.state,"environment",Ql.map(w=>w.name)).onChange(()=>this.updateEnvironment()),[p.add(this.state,"toneMapping",{Linear:$h,"ACES Filmic":Kp}),p.add(this.state,"exposure",-10,10,.01),p.add(this.state,"punctualLights").listen(),p.add(this.state,"ambientIntensity",0,2),p.addColor(this.state,"ambientColor"),p.add(this.state,"directIntensity",0,4),p.addColor(this.state,"directColor")].forEach(w=>w.onChange(()=>this.updateLights())),this.animFolder=t.addFolder("Animation"),this.animFolder.domElement.style.display="none",this.animFolder.add(this.state,"playbackSpeed",0,1).onChange(w=>{this.mixer&&(this.mixer.timeScale=w)}),this.animFolder.add({playAll:()=>this.playAllClips()},"playAll"),this.morphFolder=t.addFolder("Morph Targets"),this.morphFolder.domElement.style.display="none",this.cameraFolder=t.addFolder("Cameras"),this.cameraFolder.domElement.style.display="none",t.addFolder("Agent").add(this.state,"followMode",{None:"none","Follow Mouse":"mouse","Follow Keystrokes":"keystrokes"}).name("follow mode");const _=t.addFolder("Performance"),x=document.createElement("li");this.stats.dom.style.position="static",x.appendChild(this.stats.dom),x.classList.add("gui-stats"),_.__ul.appendChild(x);const E=document.createElement("div");this.el.appendChild(E),E.classList.add("gui-wrap"),E.classList.add("gui-wrap--hidden"),E.appendChild(t.domElement),this._guiWrap=E;const S=document.createElement("button");S.className="gui-toggle",S.setAttribute("title","Toggle advanced controls"),S.setAttribute("aria-label","Toggle advanced controls"),S.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-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 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 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 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg><span class="gui-toggle__label">Controls</span>',S.addEventListener("click",()=>{const w=E.classList.toggle("gui-wrap--hidden");S.classList.toggle("gui-toggle--active",!w)}),this.el.appendChild(S),this._guiToggle=S,e?t.close():t.open()}updateGUI(){this.cameraFolder.domElement.style.display="none",this.morphCtrls.forEach(n=>n.remove()),this.morphCtrls.length=0,this.morphFolder.domElement.style.display="none",this.animCtrls.forEach(n=>n.remove()),this.animCtrls.length=0,this.animFolder.domElement.style.display="none";const e=[],t=[];if(this.content.traverse(n=>{n.geometry&&n.morphTargetInfluences&&t.push(n),n.isCamera&&(n.name=n.name||`VIEWER__camera_${e.length+1}`,e.push(n.name))}),e.length){this.cameraFolder.domElement.style.display="",this.cameraCtrl&&this.cameraCtrl.remove();const n=[Zl].concat(e);this.cameraCtrl=this.cameraFolder.add(this.state,"camera",n),this.cameraCtrl.onChange(s=>this.setCamera(s))}if(t.length&&(this.morphFolder.domElement.style.display="",t.forEach(n=>{if(n.morphTargetInfluences.length){const s=this.morphFolder.add({name:n.name||"Untitled"},"name");this.morphCtrls.push(s)}for(let s=0;s<n.morphTargetInfluences.length;s++){const r=this.morphFolder.add(n.morphTargetInfluences,s,0,1,.01).listen();Object.keys(n.morphTargetDictionary).forEach(a=>{a&&n.morphTargetDictionary[a]===s&&r.name(a)}),this.morphCtrls.push(r)}})),this.clips.length){this.animFolder.domElement.style.display="";const n=this.state.actionStates={};this.clips.forEach((s,r)=>{s.name=`${r+1}. ${s.name}`;let a;r===0?(n[s.name]=!0,a=this.mixer.clipAction(s),a.play()):n[s.name]=!1;const o=this.animFolder.add(n,s.name).listen();o.onChange(c=>{a=a||this.mixer.clipAction(s),a.setEffectiveTimeScale(1),c?a.play():a.stop(),this.invalidate()}),this.animCtrls.push(o)})}}setAnimationDefs(e){this.animationManager.setAnimationDefs(e),this.content&&this._setupAnimationPanel()}_setupAnimationPanel(){this._animPanelEl&&(this._animPanelEl.remove(),this._animPanelEl=null);const e=this.animationManager.getAnimationDefs();if(e.length===0)return;let t=!1;if(this.content.traverse(s=>{s.isSkinnedMesh&&(t=!0)}),!t)return;const n=document.createElement("div");n.className="anim-panel",n.innerHTML='<div class="anim-panel__header"><span class="anim-panel__title">Animations</span><button class="anim-panel__stop" title="Stop all">⏹</button></div><div class="anim-panel__grid"></div>',this.el.appendChild(n),this._animPanelEl=n,this._renderAnimButtons(),this.animationManager.loadAll().then(()=>{if(this._renderAnimButtons(),!this.animationManager.currentName&&e.length>0){const s=e[0].name;this.animationManager.isLoaded(s)&&(this.animationManager.play(s),this._renderAnimButtons(),this.invalidate(),this._recomputeAnimating(),this._updateRenderLoop())}}),n.querySelector(".anim-panel__stop").addEventListener("click",()=>{this.animationManager.stopAll(),this._renderAnimButtons(),this.invalidate()}),this.animationManager.onChange=()=>{this._renderAnimButtons()}}_renderAnimButtons(){if(!this._animPanelEl)return;const e=this._animPanelEl.querySelector(".anim-panel__grid"),t=this.animationManager.getAnimationDefs(),n=this.animationManager.currentName,s={idle:"🧍",breathing:"🧍",standing:"🧍",walking:"🚶",walk:"🚶",running:"🏃",run:"🏃",waving:"👋",wave:"👋",dancing:"💃",dance:"💃",sitting:"🪑",sit:"🪑",jumping:"🦘",jump:"🦘",talking:"🗣️",talk:"🗣️",clapping:"👏",clap:"👏",punching:"👊",punch:"👊",kicking:"🦵",kick:"🦵"};e.innerHTML=t.map((r,a)=>{const o=this.animationManager.isLoaded(r.name),c=n===r.name,l=r.icon||s[r.name.toLowerCase()]||"▶",h=r.label||r.name.charAt(0).toUpperCase()+r.name.slice(1),u=a<9?a+1:"";return'<button class="anim-btn'+(c?" anim-btn--active":"")+(o?"":" anim-btn--loading")+'" data-anim="'+r.name+'" title="'+h+(u?" — press "+u:"")+'"'+(o?"":" disabled")+">"+(u?'<span class="anim-btn__key">'+u+"</span>":"")+'<span class="anim-btn__icon">'+l+'</span><span class="anim-btn__label">'+h+"</span></button>"}).join(""),e.querySelectorAll(".anim-btn:not([disabled])").forEach(r=>{r.addEventListener("click",()=>{const a=r.dataset.anim;this.animationManager.crossfadeTo(a),this.invalidate(),this._recomputeAnimating(),this._updateRenderLoop()})}),this._onAnimHotkey||(this._onAnimHotkey=r=>{if(r.target&&/INPUT|TEXTAREA|SELECT/.test(r.target.tagName)||r.metaKey||r.ctrlKey||r.altKey)return;const a=parseInt(r.key,10);if(!a||a<1||a>9)return;const c=this.animationManager.getAnimationDefs()[a-1];!c||!this.animationManager.isLoaded(c.name)||(this.animationManager.crossfadeTo(c.name),this.invalidate(),this._recomputeAnimating(),this._updateRenderLoop())},document.addEventListener("keydown",this._onAnimHotkey))}clear(){this.content&&(this.animationManager.detach(),this._animPanelEl&&(this._animPanelEl.remove(),this._animPanelEl=null),this.modelInfo&&(this.modelInfo.remove(),this.modelInfo=null),this.annotationEls.forEach(e=>e.el.remove()),this.annotationEls=[],this.scene.remove(this.content),this.content.traverse(e=>{e.geometry&&e.geometry.dispose()}),D0(this.content,e=>{for(const t in e)t!=="envMap"&&e[t]&&e[t].isTexture&&e[t].dispose()}),this.content=null,this._disposed||this.invalidate())}dispose(){if(!this._disposed){if(this._disposed=!0,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._onResize,!1),window.removeEventListener("keydown",this._onKeyDown),this._onAnimHotkey&&(document.removeEventListener("keydown",this._onAnimHotkey),this._onAnimHotkey=null),this._intersectionObserver&&(this._intersectionObserver.disconnect(),this._intersectionObserver=null),this.clear(),this.mixer){this.mixer.stopAllAction();const e=this.mixer.getRoot();e&&this.mixer.uncacheRoot(e),this.mixer=null}this.clips=[],this.animationManager.dispose(),this._animPanelEl&&(this._animPanelEl.remove(),this._animPanelEl=null),this.skeletonHelpers.length&&(this.skeletonHelpers.forEach(e=>{this.scene.remove(e),e.dispose?.()}),this.skeletonHelpers.length=0),this.gridHelper&&(this.scene.remove(this.gridHelper),this.gridHelper.geometry?.dispose(),this.gridHelper.material?.dispose(),this.gridHelper=null),this.axesHelper&&(this.scene.remove(this.axesHelper),this.axesHelper.geometry?.dispose(),this.axesHelper.material?.dispose(),this.axesHelper=null),this.axesCorner&&(this.axesScene?.remove(this.axesCorner),this.axesCorner.geometry?.dispose(),this.axesCorner.material?.dispose(),this.axesCorner=null),this.lights.forEach(e=>e.parent?.remove(e)),this.lights=[],this.annotationEls.length&&(this.annotationEls.forEach(e=>e.el.remove()),this.annotationEls=[]),this.modelInfo&&(this.modelInfo.remove(),this.modelInfo=null),this.gui&&(this.gui.destroy(),this.gui=null),this._guiWrap&&(this._guiWrap.remove(),this._guiWrap=null),this._guiToggle&&(this._guiToggle.remove(),this._guiToggle=null),this.stats?.dom&&this.stats.dom.remove(),this.controls&&(this._onControlsChange&&(this.controls.removeEventListener("change",this._onControlsChange),this._onControlsChange=null),this.controls.dispose(),this.controls=null),this._loadedEnvironment&&(this._loadedEnvironment.dispose(),this._loadedEnvironment=null),this.neutralEnvironment&&(this.neutralEnvironment.dispose(),this.neutralEnvironment=null),this.scene&&(this.scene.environment=null,this.scene.background=null),this.pmremGenerator&&(this.pmremGenerator.dispose(),this.pmremGenerator=null),this.axesRenderer&&(this.axesRenderer.dispose(),this.axesRenderer.forceContextLoss?.(),this.axesRenderer.domElement?.remove(),this.axesRenderer=null),this.axesDiv&&(this.axesDiv.remove(),this.axesDiv=null),this.axesScene=null,this.axesCamera=null,this.renderer&&(this.renderer.dispose(),this.renderer.forceContextLoss?.(),this.renderer.domElement?.remove(),window.renderer===this.renderer&&(window.renderer=null),this.renderer=null),this.scene=null,this.content=null,this.activeCamera=null,this.defaultCamera=null,this._afterAnimateHooks=null}}}class xR{constructor({model:e="claude-opus-4-6",proxyURL:t,apiKey:n,agentId:s,apiOrigin:r,temperature:a=.7,maxTokens:o=4096,thinking:c="auto"}={}){this.model=e,this.apiKey=n,this.temperature=a,this.maxTokens=o,this.thinking=c,t?this.proxyURL=t:!n&&s&&r?this.proxyURL=`${r}/api/llm/anthropic?agent=${encodeURIComponent(s)}`:this.proxyURL=null}async complete({system:e,messages:t,tools:n}){const s={model:this.model,max_tokens:this.maxTokens,temperature:this.temperature,system:e,messages:t};n&&n.length&&(s.tools=n),this.thinking==="always"&&(s.thinking={type:"enabled",budget_tokens:2048});const r=this.proxyURL||"https://api.anthropic.com/v1/messages",a={"content-type":"application/json"};this.apiKey&&(a["x-api-key"]=this.apiKey,a["anthropic-version"]="2023-06-01",a["anthropic-dangerous-direct-browser-access"]="true");const o=await fetch(r,{method:"POST",headers:a,body:JSON.stringify(s)});if(!o.ok){const l=await o.text();throw new Error(`Anthropic ${o.status}: ${l}`)}const c=await o.json();return this._normalize(c)}_normalize(e){const t={text:"",toolCalls:[],thinking:"",stopReason:e.stop_reason};for(const n of e.content||[])n.type==="text"?t.text+=n.text:n.type==="thinking"?t.thinking+=n.thinking||"":n.type==="tool_use"&&t.toolCalls.push({id:n.id,name:n.name,input:n.input});return t}formatToolResults(e){return{role:"user",content:e.map(t=>({type:"tool_result",tool_use_id:t.id,content:typeof t.output=="string"?t.output:JSON.stringify(t.output),is_error:!!t.isError}))}}formatAssistantWithToolCalls(e,t){const n=[];e&&n.push({type:"text",text:e});for(const s of t)n.push({type:"tool_use",id:s.id,name:s.name,input:s.input});return{role:"assistant",content:n}}}class bR{async complete(){return{text:"",toolCalls:[],stopReason:"end_turn"}}formatToolResults(){return{role:"user",content:[]}}formatAssistantWithToolCalls(e){return{role:"assistant",content:e||""}}}function ER(i={}){const e=i.provider||"anthropic";if(e==="anthropic")return new xR(i);if(e==="none")return new bR;throw new Error(`Unsupported provider: ${e}. Supported: anthropic, none`)}class yR{constructor({voiceId:e="default",rate:t=1,pitch:n=1,lang:s="en-US"}={}){this.voiceId=e,this.rate=t,this.pitch=n,this.lang=s,this._queue=[],this._speaking=!1}async speak(e,{onStart:t,onEnd:n}={}){if("speechSynthesis"in window)return new Promise(s=>{const r=new SpeechSynthesisUtterance(e);r.rate=this.rate,r.pitch=this.pitch,r.lang=this.lang;const a=this._pickVoice();a&&(r.voice=a),r.onstart=()=>{this._speaking=!0,t?.()},r.onend=()=>{this._speaking=!1,n?.(),s()},r.onerror=()=>{this._speaking=!1,s()},window.speechSynthesis.speak(r)})}cancel(){"speechSynthesis"in window&&window.speechSynthesis.cancel(),this._speaking=!1}get speaking(){return this._speaking}_pickVoice(){if(!("speechSynthesis"in window))return null;const e=window.speechSynthesis.getVoices();if(this.voiceId&&this.voiceId!=="default"){const t=e.find(n=>n.name===this.voiceId||n.voiceURI===this.voiceId);if(t)return t}return e.find(t=>t.lang?.startsWith(this.lang.slice(0,2)))||null}}class _R{constructor({language:e="en-US",continuous:t=!1,interimResults:n=!0}={}){this.language=e,this.continuous=t,this.interimResults=n,this._recognition=null,this._listening=!1}_ensure(){if(this._recognition)return this._recognition;const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e)return null;const t=new e;return t.lang=this.language,t.continuous=this.continuous,t.interimResults=this.interimResults,this._recognition=t,t}async listen({onInterim:e,onFinal:t}={}){const n=this._ensure();if(!n)throw new Error("SpeechRecognition unavailable in this browser");return new Promise((s,r)=>{let a="";n.onresult=o=>{for(let c=o.resultIndex;c<o.results.length;c++){const l=o.results[c],h=l[0].transcript;l.isFinal?(a+=h,t?.(h)):e?.(h)}},n.onerror=o=>{this._listening=!1,r(o.error)},n.onend=()=>{this._listening=!1,s(a.trim())},this._listening=!0;try{n.start()}catch(o){this._listening=!1,r(o)}})}stop(){this._recognition&&this._listening&&this._recognition.stop()}get listening(){return this._listening}}class wR{constructor({voiceId:e,modelId:t="eleven_turbo_v2_5",apiKey:n=null,proxyURL:s=null,rate:r=1,pitch:a=1,lang:o="en-US",stability:c=.5,similarityBoost:l=.75,useSpeakerBoost:h=!0}={}){if(!e)throw new Error("ElevenLabsTTS requires voiceId");this.voiceId=e,this.modelId=t,this.apiKey=n,this.proxyURL=s,this.rate=r,this.pitch=a,this.lang=o,this.stability=c,this.similarityBoost=l,this.useSpeakerBoost=h,this._speaking=!1,this._abort=null,this._audio=null,this._mediaSourceURL=null,this._onEnd=null}async speak(e,{onStart:t,onEnd:n}={}){if(this.cancel(),!e)return;this._abort=new AbortController,this._speaking=!0;const s=this.proxyURL||`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(this.voiceId)}/stream`,r={"content-type":"application/json",accept:"audio/mpeg"};!this.proxyURL&&this.apiKey&&(r["xi-api-key"]=this.apiKey);const a=Math.min(1.5,Math.max(.5,this.rate)),o=Math.min(1,Math.max(0,(a-.5)/1)),c=JSON.stringify({text:e,model_id:this.modelId,voice_settings:{stability:this.stability,similarity_boost:this.similarityBoost,style:o,use_speaker_boost:this.useSpeakerBoost},voiceId:this.voiceId,modelId:this.modelId});let l;try{l=await fetch(s,{method:"POST",headers:r,body:c,signal:this._abort.signal})}catch(d){if(this._speaking=!1,d.name==="AbortError")return;throw d}if(!l.ok)throw this._speaking=!1,new Error(`ElevenLabs TTS HTTP ${l.status}`);const h=typeof MediaSource<"u"&&MediaSource.isTypeSupported("audio/mpeg"),u=d=>{this._startedFired||(this._startedFired=!0,d?.())};return this._startedFired=!1,new Promise(d=>{this._onEnd=()=>{this._speaking=!1,this._cleanupAudio(),n?.(),this._onEnd=null,d()};const f=()=>{this._onEnd&&this._onEnd()};h&&l.body?this._playStreamingMSE(l.body,()=>u(t),f):this._playBuffered(l,()=>u(t),f)})}cancel(){if(this._abort){try{this._abort.abort()}catch{}this._abort=null}this._cleanupAudio(),this._speaking=!1,this._onEnd&&this._onEnd()}get speaking(){return this._speaking}_playStreamingMSE(e,t,n){const s=new MediaSource;this._mediaSourceURL=URL.createObjectURL(s);const r=new Audio(this._mediaSourceURL);this._audio=r,r.preload="auto",r.addEventListener("playing",t,{once:!0}),r.addEventListener("ended",()=>this._onEnd?.(),{once:!0}),r.addEventListener("error",()=>n?.(),{once:!0}),s.addEventListener("sourceopen",async()=>{let a;try{a=s.addSourceBuffer("audio/mpeg")}catch{n?.();return}const o=e.getReader(),c=[];let l=!0;const h=()=>{if(!l||a.updating)return;const u=c.shift();if(u)try{a.appendBuffer(u)}catch{l=!1;try{s.endOfStream()}catch{}}};a.addEventListener("updateend",h);try{for(;l;){const{value:u,done:d}=await o.read();if(d){l=!1;const f=()=>{if(a.updating||c.length)setTimeout(f,30);else try{s.endOfStream()}catch{}};f();break}c.push(u),h()}}catch(u){u.name!=="AbortError"&&n?.()}}),r.play().catch(n)}async _playBuffered(e,t,n){try{const s=await e.blob(),r=URL.createObjectURL(s);this._mediaSourceURL=r;const a=new Audio(r);this._audio=a,a.addEventListener("playing",t,{once:!0}),a.addEventListener("ended",()=>this._onEnd?.(),{once:!0}),a.addEventListener("error",()=>n?.(),{once:!0}),await a.play()}catch(s){s.name!=="AbortError"&&n?.()}}_cleanupAudio(){if(this._audio){try{this._audio.pause()}catch{}this._audio.src="",this._audio=null}if(this._mediaSourceURL){try{URL.revokeObjectURL(this._mediaSourceURL)}catch{}this._mediaSourceURL=null}this._startedFired=!1}}function vR(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new yR(i);if(e==="elevenlabs")return new wR(i);throw new Error(`TTS provider "${e}" not implemented yet`)}function CR(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new _R(i);throw new Error(`STT provider "${e}" not implemented yet`)}const K0=[{name:"wave",description:"Wave at the user. Use for greetings, farewells, or acknowledgments.",input_schema:{type:"object",properties:{duration_ms:{type:"integer",minimum:500,maximum:5e3,default:1500}}}},{name:"lookAt",description:"Direct the agent's gaze toward a target.",input_schema:{type:"object",properties:{target:{type:"string",enum:["user","camera","center"],description:"Where to look"}},required:["target"]}},{name:"play_clip",description:"Play a named animation clip from the loaded body.",input_schema:{type:"object",properties:{name:{type:"string"},loop:{type:"boolean",default:!1},fade_ms:{type:"integer",default:200}},required:["name"]}},{name:"setExpression",description:"Set facial expression via morph target preset.",input_schema:{type:"object",properties:{preset:{type:"string",enum:["neutral","happy","sad","surprised","confused","focused"]},intensity:{type:"number",minimum:0,maximum:1,default:1}},required:["preset"]}},{name:"speak",description:"Say something out loud via TTS. Use this instead of plain text when voice is on.",input_schema:{type:"object",properties:{text:{type:"string"}},required:["text"]}},{name:"remember",description:"Save a durable memory about the user, a feedback rule, a project fact, or a reference.",input_schema:{type:"object",properties:{key:{type:"string",description:'short snake_case filename, e.g. "user_role"'},name:{type:"string"},description:{type:"string"},type:{type:"string",enum:["user","feedback","project","reference"]},body:{type:"string"}},required:["key","name","description","type","body"]}}],IR=[{name:"observe_agents",description:"List the other agents currently sharing this stage, with their names and positions.",input_schema:{type:"object",properties:{}}},{name:"say_to_agent",description:"Send a message to another agent on the same stage. The target agent will receive it as a user turn and reply in their own chat chrome.",input_schema:{type:"object",properties:{agentId:{type:"string",description:"Target agent id as returned by observe_agents."},text:{type:"string"}},required:["agentId","text"]}}],SR={async wave(i,e){const t=i.duration_ms||1500;return await e.viewer.playAnimationByHint?.("wave",{duration:t}),e.memory.note("waved",{duration_ms:t}),{ok:!0}},async lookAt(i,e){const t=i.target||"user";return e.viewer.lookAt?.(t),{ok:!0,target:t}},async play_clip(i,e){const{name:t,loop:n=!1,fade_ms:s=200}=i,r=e.viewer.resolveAnimationSlot?.(t)??t;return e.viewer.playClipByName?.(r,{loop:n,fade_ms:s})?{ok:!0,name:t,resolved:r}:(r!==t&&console.warn(`[play_clip] slot "${t}" → "${r}" not found in library`),{ok:!1,error:`No clip named "${r}"`})},async setExpression(i,e){const{preset:t,intensity:n=1}=i;return e.viewer.setExpression?.(t,n),{ok:!0,preset:t}},async speak(i,e){return await e.speak(i.text),{ok:!0}},async remember(i,e){const{key:t,name:n,description:s,type:r,body:a}=i;return e.memory.write(t,{name:n,description:s,type:r,body:a}),{ok:!0,saved:t}},async observe_agents(i,e){return e.stage?{ok:!0,agents:e.stage.getAgents().filter(n=>n.agentId!==e.agentId).map(({agentId:n,name:s,position:r})=>({agentId:n,name:s,position:r}))}:{ok:!1,error:"not on a stage"}},async say_to_agent(i,e){if(!e.stage)return{ok:!1,error:"not on a stage"};const{agentId:t,text:n}=i;if(!t||!n)return{ok:!1,error:"agentId and text required"};const s=e.agentId||"anon";return e.stage.broadcast(s,{kind:"direct",to:t,text:n}),e.stage.routeMessage(s,t,n)}},MR=8;class j0 extends EventTarget{constructor({manifest:e,viewer:t,memory:n,skills:s,providerConfig:r={},voiceConfig:a={},stage:o=null,agentId:c=null}={}){super(),this.manifest=e||{},this.viewer=t,this.memory=n,this.skills=s,this.stage=o,this.agentId=c,this.provider=ER({...this.manifest.brain,...r}),this.tts=vR({...this.manifest.voice?.tts,...a.tts}),this.stt=CR({...this.manifest.voice?.stt,...a.stt}),this.messages=[],this._busy=!1}get systemPrompt(){const e=[];return this.manifest.instructions&&e.push(this.manifest.instructions),this.memory&&e.push(`
<memory>
`+this.memory.contextBlock({maxTokens:this.manifest.memory?.maxTokens||8192})+`
-</memory>`),this.skills&&e.push(this.skills.systemPrompt()),e.join("")}get tools(){const e=new Set(this.manifest.tools||q0.map(r=>r.name)),t=q0.filter(r=>e.has(r.name)),n=this.skills?this.skills.allTools():[],s=this.stage?CR:[];return[...t,...s,...n]}async send(e,{voice:t=!1}={}){if(this._busy)throw new Error("Runtime busy — wait for current turn to finish");this._busy=!0;try{this.memory?.note("user_said",{text:e}),this.messages.push({role:"user",content:e}),this.dispatchEvent(new CustomEvent("brain:message",{detail:{role:"user",content:e}}));const n=await this._loop();return t&&n.text&&this.tts&&(this.dispatchEvent(new CustomEvent("voice:speech-start",{detail:{text:n.text}})),await this.tts.speak(n.text),this.dispatchEvent(new CustomEvent("voice:speech-end",{}))),n}finally{this._busy=!1}}async _loop(){let e=0,t="";for(;e++<SR;){const n=await this.provider.complete({system:this.systemPrompt,messages:this.messages,tools:this.tools});if(n.thinking&&this.dispatchEvent(new CustomEvent("brain:thinking",{detail:{content:n.thinking}})),!n.toolCalls.length){t=n.text,this.messages.push({role:"assistant",content:n.text}),this.dispatchEvent(new CustomEvent("brain:message",{detail:{role:"assistant",content:n.text}}));break}this.messages.push(this.provider.formatAssistantWithToolCalls(n.text,n.toolCalls)),n.text&&this.dispatchEvent(new CustomEvent("brain:message",{detail:{role:"assistant",content:n.text}}));const s=[];for(const r of n.toolCalls){let a,o=!1;try{a=await this._dispatchTool(r)}catch(c){a={error:c.message||String(c)},o=!0}this.dispatchEvent(new CustomEvent("skill:tool-called",{detail:{tool:r.name,args:r.input,result:a}})),s.push({id:r.id,output:a,isError:o})}this.messages.push(this.provider.formatToolResults(s))}return{text:t}}async _dispatchTool(e){const t=this._context(),n=this.skills?.findSkillForTool(e.name);if(n)return n.invoke(e.name,e.input,t);const s=IR[e.name];if(!s)throw new Error(`Unknown tool: ${e.name}`);return s(e.input,t)}_context(){return this.skills,{viewer:this.viewer,memory:this.memory,llm:{complete:(e,t)=>this.provider.complete({system:t?.system||"",messages:[{role:"user",content:e}],tools:t?.tools})},speak:async e=>{this.tts&&(this.dispatchEvent(new CustomEvent("voice:speech-start",{detail:{text:e}})),await this.tts.speak(e),this.dispatchEvent(new CustomEvent("voice:speech-end",{})))},listen:e=>this.stt?.listen(e),fetch:(e,t)=>fetch(e,t),loadGLB:async e=>this.viewer.loadGLB?.(e),loadClip:async e=>this.viewer.loadClip?.(e),loadJSON:async e=>(await fetch(e)).json(),call:async(e,t)=>this._dispatchTool({name:e,input:t}),stage:this.stage,agentId:this.agentId}}async listen({onInterim:e,onFinal:t}={}){if(!this.stt)throw new Error("STT not configured");return this.dispatchEvent(new CustomEvent("voice:listen-start",{})),await this.stt.listen({onInterim:s=>{this.dispatchEvent(new CustomEvent("voice:transcript",{detail:{text:s,final:!1}})),e?.(s)},onFinal:s=>{this.dispatchEvent(new CustomEvent("voice:transcript",{detail:{text:s,final:!0}})),t?.(s)}})}clearConversation(){this.messages=[]}pause(){this.tts?.cancel(),this.stt?.stop()}destroy(){this.pause(),this.messages=[]}}const Sf=["https://dweb.link/ipfs/","https://cloudflare-ipfs.com/ipfs/","https://ipfs.io/ipfs/"],MR="https://arweave.net/";function ls(i,e=0){if(!i)return i;const t=i.match(/^ipfs:\/\/(.+)$/i);if(t)return Sf[e%Sf.length]+t[1];const n=i.match(/^ar:\/\/(.+)$/i);return n?MR+n[1]:i}async function j0(i){let e;for(let t=0;t<Sf.length;t++){const n=ls(i,t);try{const s=await fetch(n);if(s.ok)return s}catch(s){e=s}}throw e||new Error("All IPFS gateways failed for "+i)}const BR={idle:"idle",wave:"reaction",nod:"reaction",shake:"angry",think:"pray",celebrate:"celebrate",concern:"defeated",bow:"sitclap",point:"reaction",shrug:"defeated"};function TR(i,e){return e&&e[i]?e[i]:BR[i]??i}const X0={neutral:{},happy:{mouthSmile:1,browInnerUp:.3,cheekSquintL:.4,cheekSquintR:.4},sad:{mouthFrownL:.8,mouthFrownR:.8,browDownL:.6,browDownR:.6},surprised:{jawOpen:.5,eyeWideL:.8,eyeWideR:.8,browInnerUp:.9},confused:{browInnerUp:.5,browOuterUpL:.4,mouthPressL:.3,mouthPressR:.3},focused:{browDownL:.4,browDownR:.4,eyeSquintL:.3,eyeSquintR:.3}};class Y0{constructor(e){this.viewer=e,this._loader=new Id,this._userTarget=new G(0,1.6,2),this._animationMap={},this._group=null,this._groupMixer=null,this._groupClips=null,this._mixerHook=null}get scene(){return this.viewer.scene}get mixer(){return this._groupMixer||this.viewer.mixer}get clips(){return this._groupClips||this.viewer.clips||[]}get content(){return this._group||this.viewer.content}setGroup(e,{mixer:t=null,clips:n=null}={}){this._group=e,this._groupMixer=t,this._groupClips=n,t&&(this._mixerHook=s=>{t.update(s),this.viewer._animating=!0,this.viewer.invalidate()},this._addHook(this._mixerHook))}dispose(){if(this._mixerHook&&this._removeHook(this._mixerHook),this._groupMixer){try{this._groupMixer.stopAllAction()}catch{}try{this._groupMixer.uncacheRoot(this._group)}catch{}}this._mixerHook=null,this._groupMixer=null,this._groupClips=null,this._group=null}setAnimationMap(e){this._animationMap=e||{}}resolveAnimationSlot(e){return TR(e,this._animationMap)}async load(e,t="",n=new Map){return this.viewer.load(e,t,n)}playClipByName(e,{loop:t=!1,fade_ms:n=200}={}){const s=this._findClip(e),r=this.mixer;if(s&&r){const o=r.clipAction(s);return o.reset(),o.setLoop(t?2201:2200),o.clampWhenFinished=!t,o.fadeIn(n/1e3),o.play(),this._group||(this.viewer.state.actionStates[s.name]=!0),this.viewer._animating=!0,this.viewer.invalidate(),!0}const a=this.viewer?.animationManager;return a?.isLoaded(e)?(t?a.crossfadeTo(e,n/1e3):a.play(e),!0):!1}playAnimationByHint(e,t){const n=e.toLowerCase(),s=this.clips.find(a=>a.name.toLowerCase().includes(n));if(s)return this.playClipByName(s.name,t);const r=this.viewer?.animationManager;if(r){for(const a of r.clips.keys())if(a.toLowerCase().includes(n))return this.playClipByName(a,t)}return!1}stopClip(e){const t=this.mixer;if(!t)return;const n=e?this._findClip(e):null;if(n){const s=t.existingAction(n);s&&s.fadeOut(.2),this._group||(this.viewer.state.actionStates[n.name]=!1)}else if(t.stopAllAction(),!this._group)for(const s in this.viewer.state.actionStates)this.viewer.state.actionStates[s]=!1;this.viewer.invalidate()}async play(e,t){if(typeof e=="string")return this.playClipByName(e,t);const n=this.mixer;if(!n||!e)return!1;const s=n.clipAction(e);return s.reset(),s.fadeIn(t?.blend??.2),s.play(),this.viewer._animating=!0,this.viewer.invalidate(),!0}async loadClip(e){const t=ls(e);return new Promise((n,s)=>{this._loader.load(t,r=>n(r.animations?.[0]||null),void 0,s)})}async loadGLB(e){const t=ls(e);return new Promise((n,s)=>{this._loader.load(t,n,void 0,s)})}lookAt(e){const t=this._resolveTarget(e);if(!t||!this.viewer.content)return;const n=this._findBone(["Head","head","mixamorigHead"]);n?n.lookAt(t):this.viewer.content.lookAt(t.x,this.viewer.content.position.y,t.z),this.viewer.invalidate()}_resolveTarget(e){return e instanceof G?e:e==="camera"?this.viewer.activeCamera.position.clone():e==="center"?new G(0,1,0):e==="user"?this.viewer.renderer?.xr?.isPresenting?this.viewer.renderer.xr.getCamera().position.clone():this._userTarget.clone():null}_findBone(e){if(!this.viewer.content)return null;let t=null;return this.viewer.content.traverse(n=>{t||n.isBone&&e.includes(n.name)&&(t=n)}),t}setExpression(e,t=1){const n=X0[e]||X0.neutral;this.viewer.content&&(this.viewer.content.traverse(s=>{if(!(!s.morphTargetDictionary||!s.morphTargetInfluences)){for(let r=0;r<s.morphTargetInfluences.length;r++)s.morphTargetInfluences[r]=0;for(const[r,a]of Object.entries(n)){const o=s.morphTargetDictionary[r];o!==void 0&&(s.morphTargetInfluences[o]=a*t)}}}),this.viewer.invalidate())}moveTo(e,{duration:t=600}={}){if(!this.viewer.content)return;const n=this.viewer.content.position.clone(),s=new G(e.x||0,e.y||n.y,e.z||0),r=performance.now(),a=o=>{const c=performance.now()-r,l=Math.min(c/t,1),h=l<.5?2*l*l:1-Math.pow(-2*l+2,2)/2;this.viewer.content.position.lerpVectors(n,s,h),this.viewer.invalidate(),l>=1&&this._removeHook(a)};this._addHook(a)}_addHook(e){this.viewer._afterAnimateHooks||(this.viewer._afterAnimateHooks=[]),this.viewer._afterAnimateHooks.push(e),this.viewer._animating=!0,this.viewer.invalidate()}_removeHook(e){const t=this.viewer._afterAnimateHooks;if(!t)return;const n=t.indexOf(e);n>=0&&t.splice(n,1)}_findClip(e){if(!this.clips.length)return null;const t=this.clips.find(s=>s.name===e);if(t)return t;const n=e.toLowerCase();return this.clips.find(s=>s.name.toLowerCase()===n)||this.clips.find(s=>s.name.toLowerCase().includes(n))}}const RR=`// Sandbox worker — executes skill handlers in an isolated Web Worker scope.
+</memory>`),this.skills&&e.push(this.skills.systemPrompt()),e.join("")}get tools(){const e=new Set(this.manifest.tools||K0.map(r=>r.name)),t=K0.filter(r=>e.has(r.name)),n=this.skills?this.skills.allTools():[],s=this.stage?IR:[];return[...t,...s,...n]}async send(e,{voice:t=!1}={}){if(this._busy)throw new Error("Runtime busy — wait for current turn to finish");this._busy=!0;try{this.memory?.note("user_said",{text:e}),this.messages.push({role:"user",content:e}),this.dispatchEvent(new CustomEvent("brain:message",{detail:{role:"user",content:e}}));const n=await this._loop();return t&&n.text&&this.tts&&(this.dispatchEvent(new CustomEvent("voice:speech-start",{detail:{text:n.text}})),await this.tts.speak(n.text),this.dispatchEvent(new CustomEvent("voice:speech-end",{}))),n}finally{this._busy=!1}}async _loop(){let e=0,t="";for(;e++<MR;){const n=await this.provider.complete({system:this.systemPrompt,messages:this.messages,tools:this.tools});if(n.thinking&&this.dispatchEvent(new CustomEvent("brain:thinking",{detail:{content:n.thinking}})),!n.toolCalls.length){t=n.text,this.messages.push({role:"assistant",content:n.text}),this.dispatchEvent(new CustomEvent("brain:message",{detail:{role:"assistant",content:n.text}}));break}this.messages.push(this.provider.formatAssistantWithToolCalls(n.text,n.toolCalls)),n.text&&this.dispatchEvent(new CustomEvent("brain:message",{detail:{role:"assistant",content:n.text}}));const s=[];for(const r of n.toolCalls){let a,o=!1;try{a=await this._dispatchTool(r)}catch(c){a={error:c.message||String(c)},o=!0}this.dispatchEvent(new CustomEvent("skill:tool-called",{detail:{tool:r.name,args:r.input,result:a}})),s.push({id:r.id,output:a,isError:o})}this.messages.push(this.provider.formatToolResults(s))}return{text:t}}async _dispatchTool(e){const t=this._context(),n=this.skills?.findSkillForTool(e.name);if(n)return n.invoke(e.name,e.input,t);const s=SR[e.name];if(!s)throw new Error(`Unknown tool: ${e.name}`);return s(e.input,t)}_context(){return this.skills,{viewer:this.viewer,memory:this.memory,llm:{complete:(e,t)=>this.provider.complete({system:t?.system||"",messages:[{role:"user",content:e}],tools:t?.tools})},speak:async e=>{this.tts&&(this.dispatchEvent(new CustomEvent("voice:speech-start",{detail:{text:e}})),await this.tts.speak(e),this.dispatchEvent(new CustomEvent("voice:speech-end",{})))},listen:e=>this.stt?.listen(e),fetch:(e,t)=>fetch(e,t),loadGLB:async e=>this.viewer.loadGLB?.(e),loadClip:async e=>this.viewer.loadClip?.(e),loadJSON:async e=>(await fetch(e)).json(),call:async(e,t)=>this._dispatchTool({name:e,input:t}),stage:this.stage,agentId:this.agentId}}async listen({onInterim:e,onFinal:t}={}){if(!this.stt)throw new Error("STT not configured");return this.dispatchEvent(new CustomEvent("voice:listen-start",{})),await this.stt.listen({onInterim:s=>{this.dispatchEvent(new CustomEvent("voice:transcript",{detail:{text:s,final:!1}})),e?.(s)},onFinal:s=>{this.dispatchEvent(new CustomEvent("voice:transcript",{detail:{text:s,final:!0}})),t?.(s)}})}clearConversation(){this.messages=[]}pause(){this.tts?.cancel(),this.stt?.stop()}destroy(){this.pause(),this.messages=[]}}const Bf=["https://dweb.link/ipfs/","https://cloudflare-ipfs.com/ipfs/","https://ipfs.io/ipfs/"],BR="https://arweave.net/";function hs(i,e=0){if(!i)return i;const t=i.match(/^ipfs:\/\/(.+)$/i);if(t)return Bf[e%Bf.length]+t[1];const n=i.match(/^ar:\/\/(.+)$/i);return n?BR+n[1]:i}async function X0(i){let e;for(let t=0;t<Bf.length;t++){const n=hs(i,t);try{const s=await fetch(n);if(s.ok)return s}catch(s){e=s}}throw e||new Error("All IPFS gateways failed for "+i)}const TR={idle:"idle",wave:"reaction",nod:"reaction",shake:"angry",think:"pray",celebrate:"celebrate",concern:"defeated",bow:"sitclap",point:"reaction",shrug:"defeated"};function RR(i,e){return e&&e[i]?e[i]:TR[i]??i}const Y0={neutral:{},happy:{mouthSmile:1,browInnerUp:.3,cheekSquintL:.4,cheekSquintR:.4},sad:{mouthFrownL:.8,mouthFrownR:.8,browDownL:.6,browDownR:.6},surprised:{jawOpen:.5,eyeWideL:.8,eyeWideR:.8,browInnerUp:.9},confused:{browInnerUp:.5,browOuterUpL:.4,mouthPressL:.3,mouthPressR:.3},focused:{browDownL:.4,browDownR:.4,eyeSquintL:.3,eyeSquintR:.3}};class J0{constructor(e){this.viewer=e,this._loader=new Md,this._userTarget=new G(0,1.6,2),this._animationMap={},this._group=null,this._groupMixer=null,this._groupClips=null,this._mixerHook=null}get scene(){return this.viewer.scene}get mixer(){return this._groupMixer||this.viewer.mixer}get clips(){return this._groupClips||this.viewer.clips||[]}get content(){return this._group||this.viewer.content}setGroup(e,{mixer:t=null,clips:n=null}={}){this._group=e,this._groupMixer=t,this._groupClips=n,t&&(this._mixerHook=s=>{t.update(s),this.viewer._animating=!0,this.viewer.invalidate()},this._addHook(this._mixerHook))}dispose(){if(this._mixerHook&&this._removeHook(this._mixerHook),this._groupMixer){try{this._groupMixer.stopAllAction()}catch{}try{this._groupMixer.uncacheRoot(this._group)}catch{}}this._mixerHook=null,this._groupMixer=null,this._groupClips=null,this._group=null}setAnimationMap(e){this._animationMap=e||{}}resolveAnimationSlot(e){return RR(e,this._animationMap)}async load(e,t="",n=new Map){return this.viewer.load(e,t,n)}playClipByName(e,{loop:t=!1,fade_ms:n=200}={}){const s=this._findClip(e),r=this.mixer;if(s&&r){const o=r.clipAction(s);return o.reset(),o.setLoop(t?2201:2200),o.clampWhenFinished=!t,o.fadeIn(n/1e3),o.play(),this._group||(this.viewer.state.actionStates[s.name]=!0),this.viewer._animating=!0,this.viewer.invalidate(),!0}const a=this.viewer?.animationManager;return a?.isLoaded(e)?(t?a.crossfadeTo(e,n/1e3):a.play(e),!0):!1}playAnimationByHint(e,t){const n=e.toLowerCase(),s=this.clips.find(a=>a.name.toLowerCase().includes(n));if(s)return this.playClipByName(s.name,t);const r=this.viewer?.animationManager;if(r){for(const a of r.clips.keys())if(a.toLowerCase().includes(n))return this.playClipByName(a,t)}return!1}stopClip(e){const t=this.mixer;if(!t)return;const n=e?this._findClip(e):null;if(n){const s=t.existingAction(n);s&&s.fadeOut(.2),this._group||(this.viewer.state.actionStates[n.name]=!1)}else if(t.stopAllAction(),!this._group)for(const s in this.viewer.state.actionStates)this.viewer.state.actionStates[s]=!1;this.viewer.invalidate()}async play(e,t){if(typeof e=="string")return this.playClipByName(e,t);const n=this.mixer;if(!n||!e)return!1;const s=n.clipAction(e);return s.reset(),s.fadeIn(t?.blend??.2),s.play(),this.viewer._animating=!0,this.viewer.invalidate(),!0}async loadClip(e){const t=hs(e);return new Promise((n,s)=>{this._loader.load(t,r=>n(r.animations?.[0]||null),void 0,s)})}async loadGLB(e){const t=hs(e);return new Promise((n,s)=>{this._loader.load(t,n,void 0,s)})}lookAt(e){const t=this._resolveTarget(e);if(!t||!this.viewer.content)return;const n=this._findBone(["Head","head","mixamorigHead"]);n?n.lookAt(t):this.viewer.content.lookAt(t.x,this.viewer.content.position.y,t.z),this.viewer.invalidate()}_resolveTarget(e){return e instanceof G?e:e==="camera"?this.viewer.activeCamera.position.clone():e==="center"?new G(0,1,0):e==="user"?this.viewer.renderer?.xr?.isPresenting?this.viewer.renderer.xr.getCamera().position.clone():this._userTarget.clone():null}_findBone(e){if(!this.viewer.content)return null;let t=null;return this.viewer.content.traverse(n=>{t||n.isBone&&e.includes(n.name)&&(t=n)}),t}setExpression(e,t=1){const n=Y0[e]||Y0.neutral;this.viewer.content&&(this.viewer.content.traverse(s=>{if(!(!s.morphTargetDictionary||!s.morphTargetInfluences)){for(let r=0;r<s.morphTargetInfluences.length;r++)s.morphTargetInfluences[r]=0;for(const[r,a]of Object.entries(n)){const o=s.morphTargetDictionary[r];o!==void 0&&(s.morphTargetInfluences[o]=a*t)}}}),this.viewer.invalidate())}moveTo(e,{duration:t=600}={}){if(!this.viewer.content)return;const n=this.viewer.content.position.clone(),s=new G(e.x||0,e.y||n.y,e.z||0),r=performance.now(),a=o=>{const c=performance.now()-r,l=Math.min(c/t,1),h=l<.5?2*l*l:1-Math.pow(-2*l+2,2)/2;this.viewer.content.position.lerpVectors(n,s,h),this.viewer.invalidate(),l>=1&&this._removeHook(a)};this._addHook(a)}_addHook(e){this.viewer._afterAnimateHooks||(this.viewer._afterAnimateHooks=[]),this.viewer._afterAnimateHooks.push(e),this.viewer._animating=!0,this.viewer.invalidate()}_removeHook(e){const t=this.viewer._afterAnimateHooks;if(!t)return;const n=t.indexOf(e);n>=0&&t.splice(n,1)}_findClip(e){if(!this.clips.length)return null;const t=this.clips.find(s=>s.name===e);if(t)return t;const n=e.toLowerCase();return this.clips.find(s=>s.name.toLowerCase()===n)||this.clips.find(s=>s.name.toLowerCase().includes(n))}}const FR=`// Sandbox worker — executes skill handlers in an isolated Web Worker scope.
// No DOM, no window, no document. Only ctx.* and native worker APIs.
/** @type {Map<string, object>} skillURI → module exports */
@@ -4015,17 +4015,17 @@ function _handleResponse({ requestId, result, error }) {
pending.resolve(result);
}
}
-`;let di=null,Da=null;const La=new Map,Xo=new Map,qs=new Map,$l=new Map;let FR=0,NR=0;function J0(i){if(i==null)return null;const e=`@h:${++FR}`;return $l.set(e,i),e}function DR(i){return typeof i=="string"&&i.startsWith("@h:")?$l.get(i)??i:i}function LR(i){return Array.isArray(i)?i.map(DR):i}function Z0(){if(!di){if(!Da){const i=new Blob([RR],{type:"text/javascript"});Da=URL.createObjectURL(i)}di=new Worker(Da),di.onmessage=kR,di.onerror=PR}return di}function PR(i){console.error("[sandbox] worker crashed:",i),di=null,La.clear(),Xo.clear(),$l.clear();for(const[,e]of qs)e.reject(new Error("Sandbox worker crashed"));qs.clear()}function kR({data:i}){switch(i.type){case"install-ack":{const e=Xo.get(i.skillURI);Xo.delete(i.skillURI),i.ok?e?.resolve():(La.delete(i.skillURI),e?.reject(new Error(i.error||"Install failed")));break}case"request":{const{invocationId:e,requestId:t,method:n,args:s}=i,r=qs.get(e);if(!r){di?.postMessage({type:"response",requestId:t,error:"No active invocation"});return}UR(n,s,r.mainCtx).then(a=>di?.postMessage({type:"response",requestId:t,result:a??null}),a=>di?.postMessage({type:"response",requestId:t,error:a.message||String(a)}));break}case"invoke-result":{const{invocationId:e,result:t,error:n}=i,s=qs.get(e);if(!s)return;qs.delete(e),n!==void 0?s.reject(new Error(n)):s.resolve(t);break}}}async function UR(i,e,t){const n=LR(e);switch(i){case"viewer.play":return t.viewer?.play?.(n[0],n[1]);case"viewer.stop":return t.viewer?.stop?.(n[0]);case"viewer.setExpression":return t.viewer?.setExpression?.(n[0],n[1]);case"viewer.lookAt":return t.viewer?.lookAt?.(n[0]);case"viewer.moveTo":return t.viewer?.moveTo?.(n[0],n[1]);case"viewer.playAnimationByHint":return t.viewer?.playAnimationByHint?.(n[0],n[1]);case"viewer.playClipByName":return t.viewer?.playClipByName?.(n[0],n[1]);case"memory.read":return t.memory?.read?.(n[0]);case"memory.write":return t.memory?.write?.(n[0],n[1]);case"memory.note":return t.memory?.note?.(n[0],n[1]);case"memory.recall":return t.memory?.recall?.(n[0]);case"llm.complete":return t.llm?.complete?.(n[0],n[1]);case"llm.embed":return t.llm?.embed?.(n[0]);case"loadClip":{const s=await t.loadClip?.(n[0]);return J0(s)}case"loadGLB":{const s=await t.loadGLB?.(n[0]);return J0(s)}case"speak":return t.speak?.(n[0]);case"listen":return t.listen?.(n[0]);case"call":return t.call?.(n[0],n[1]);default:throw new Error(`Unknown ctx method: ${i}`)}}async function OR(i,e){if(La.has(i))return La.get(i);const t=new Promise((n,s)=>{Xo.set(i,{resolve:n,reject:s})});return La.set(i,t),Z0().postMessage({type:"install",skillURI:i,handlersSrc:e}),t}async function QR(i,e,t,n,s){await OR(i,n);const r=++NR,a=Z0();return new Promise((o,c)=>{qs.set(r,{resolve:o,reject:c,mainCtx:s}),a.postMessage({type:"invoke",invocationId:r,skillURI:i,toolName:e,args:t,skillBaseURI:s.skillBaseURI||i})})}function GR(){if(di){di.terminate(),di=null,Da&&(URL.revokeObjectURL(Da),Da=null),La.clear(),Xo.clear(),$l.clear();for(const[,i]of qs)i.reject(new Error("Sandbox terminated"));qs.clear()}}function HR(){return{invoke:QR,terminate:GR}}function zR(i,e){return/^([a-z]+:|\/)/i.test(e)?e:(i.endsWith("/")||(i+="/"),i+e)}class $0{constructor({uri:e,manifest:t,instructions:n,tools:s,handlers:r,handlersSrc:a}){this.uri=e,this.manifest=t,this.name=t.name,this.version=t.version,this.instructions=n,this.tools=s||[],this.handlers=r||{},this.handlersSrc=a||null}async invoke(e,t,n){const s={...n,skillBaseURI:this.uri};if(this.manifest.sandboxPolicy==="trusted-main-thread"){const r=this.handlers[e];if(!r)throw new Error(`Skill "${this.name}" has no handler for tool "${e}"`);return r(t,s)}if(!this.handlersSrc)throw new Error(`Skill "${this.name}" has no handler source for tool "${e}"`);return HR().invoke(this.uri,e,t,this.handlersSrc,s)}systemPromptFragment(){return this.instructions?`
+`;let fi=null,Da=null;const La=new Map,Yo=new Map,qs=new Map,th=new Map;let NR=0,DR=0;function Z0(i){if(i==null)return null;const e=`@h:${++NR}`;return th.set(e,i),e}function LR(i){return typeof i=="string"&&i.startsWith("@h:")?th.get(i)??i:i}function PR(i){return Array.isArray(i)?i.map(LR):i}function $0(){if(!fi){if(!Da){const i=new Blob([FR],{type:"text/javascript"});Da=URL.createObjectURL(i)}fi=new Worker(Da),fi.onmessage=UR,fi.onerror=kR}return fi}function kR(i){console.error("[sandbox] worker crashed:",i),fi=null,La.clear(),Yo.clear(),th.clear();for(const[,e]of qs)e.reject(new Error("Sandbox worker crashed"));qs.clear()}function UR({data:i}){switch(i.type){case"install-ack":{const e=Yo.get(i.skillURI);Yo.delete(i.skillURI),i.ok?e?.resolve():(La.delete(i.skillURI),e?.reject(new Error(i.error||"Install failed")));break}case"request":{const{invocationId:e,requestId:t,method:n,args:s}=i,r=qs.get(e);if(!r){fi?.postMessage({type:"response",requestId:t,error:"No active invocation"});return}OR(n,s,r.mainCtx).then(a=>fi?.postMessage({type:"response",requestId:t,result:a??null}),a=>fi?.postMessage({type:"response",requestId:t,error:a.message||String(a)}));break}case"invoke-result":{const{invocationId:e,result:t,error:n}=i,s=qs.get(e);if(!s)return;qs.delete(e),n!==void 0?s.reject(new Error(n)):s.resolve(t);break}}}async function OR(i,e,t){const n=PR(e);switch(i){case"viewer.play":return t.viewer?.play?.(n[0],n[1]);case"viewer.stop":return t.viewer?.stop?.(n[0]);case"viewer.setExpression":return t.viewer?.setExpression?.(n[0],n[1]);case"viewer.lookAt":return t.viewer?.lookAt?.(n[0]);case"viewer.moveTo":return t.viewer?.moveTo?.(n[0],n[1]);case"viewer.playAnimationByHint":return t.viewer?.playAnimationByHint?.(n[0],n[1]);case"viewer.playClipByName":return t.viewer?.playClipByName?.(n[0],n[1]);case"memory.read":return t.memory?.read?.(n[0]);case"memory.write":return t.memory?.write?.(n[0],n[1]);case"memory.note":return t.memory?.note?.(n[0],n[1]);case"memory.recall":return t.memory?.recall?.(n[0]);case"llm.complete":return t.llm?.complete?.(n[0],n[1]);case"llm.embed":return t.llm?.embed?.(n[0]);case"loadClip":{const s=await t.loadClip?.(n[0]);return Z0(s)}case"loadGLB":{const s=await t.loadGLB?.(n[0]);return Z0(s)}case"speak":return t.speak?.(n[0]);case"listen":return t.listen?.(n[0]);case"call":return t.call?.(n[0],n[1]);default:throw new Error(`Unknown ctx method: ${i}`)}}async function QR(i,e){if(La.has(i))return La.get(i);const t=new Promise((n,s)=>{Yo.set(i,{resolve:n,reject:s})});return La.set(i,t),$0().postMessage({type:"install",skillURI:i,handlersSrc:e}),t}async function GR(i,e,t,n,s){await QR(i,n);const r=++DR,a=$0();return new Promise((o,c)=>{qs.set(r,{resolve:o,reject:c,mainCtx:s}),a.postMessage({type:"invoke",invocationId:r,skillURI:i,toolName:e,args:t,skillBaseURI:s.skillBaseURI||i})})}function HR(){if(fi){fi.terminate(),fi=null,Da&&(URL.revokeObjectURL(Da),Da=null),La.clear(),Yo.clear(),th.clear();for(const[,i]of qs)i.reject(new Error("Sandbox terminated"));qs.clear()}}function zR(){return{invoke:GR,terminate:HR}}function VR(i,e){return/^([a-z]+:|\/)/i.test(e)?e:(i.endsWith("/")||(i+="/"),i+e)}class ex{constructor({uri:e,manifest:t,instructions:n,tools:s,handlers:r,handlersSrc:a}){this.uri=e,this.manifest=t,this.name=t.name,this.version=t.version,this.instructions=n,this.tools=s||[],this.handlers=r||{},this.handlersSrc=a||null}async invoke(e,t,n){const s={...n,skillBaseURI:this.uri};if(this.manifest.sandboxPolicy==="trusted-main-thread"){const r=this.handlers[e];if(!r)throw new Error(`Skill "${this.name}" has no handler for tool "${e}"`);return r(t,s)}if(!this.handlersSrc)throw new Error(`Skill "${this.name}" has no handler source for tool "${e}"`);return zR().invoke(this.uri,e,t,this.handlersSrc,s)}systemPromptFragment(){return this.instructions?`
<skill name="${this.name}" version="${this.version}">
${this.instructions}
-</skill>`:""}}class ex{constructor({fetchFn:e=fetch.bind(globalThis),trust:t="owned-only",ownerAddress:n}={}){this.fetchFn=e,this.trust=t,this.ownerAddress=n?.toLowerCase(),this.skills=new Map}async install(e,{bundleBase:t}={}){const n=this._resolveBundleURI(e.uri,t);if(this.skills.has(n))return this.skills.get(n);const s=await this._fetchJSON(`${n}manifest.json`);this._enforceTrust(s);const r=s.sandboxPolicy==="trusted-main-thread",[a,o,c]=await Promise.all([this._fetchText(`${n}SKILL.md`).catch(()=>""),this._fetchJSON(`${n}tools.json`).catch(()=>({tools:[]})),r?this._fetchHandlers(`${n}handlers.js`).catch(()=>null):this._fetchHandlersSrc(`${n}handlers.js`).catch(()=>null)]),l=new $0({uri:n,manifest:s,instructions:a,tools:o.tools||[],handlers:r?c||{}:{},handlersSrc:r?null:c});if(s.dependencies)for(const[h,u]of Object.entries(s.dependencies))await this.install({uri:h,version:u});return this.skills.set(n,l),l}uninstall(e){for(const[t,n]of this.skills)if(n.name===e)return this.skills.delete(t),!0;return!1}all(){return Array.from(this.skills.values())}allTools(){const e=new Map;for(const t of this.skills.values())for(const n of t.tools)e.has(n.name)&&console.warn(`[skills] tool "${n.name}" overridden by skill "${t.name}"`),e.set(n.name,{...n,_skill:t.name});return Array.from(e.values())}findSkillForTool(e){for(const t of this.skills.values())if(t.tools.some(n=>n.name===e))return t;return null}systemPrompt(){return this.all().map(e=>e.systemPromptFragment()).join("")}_resolveBundleURI(e,t){let n=e;return!/^([a-z]+:|\/)/i.test(e)&&t&&(n=zR(t,e)),n.endsWith("/")||(n+="/"),(n.startsWith("ipfs://")||n.startsWith("ar://"))&&(n=ls(n)),n}async _fetchJSON(e){const t=await this.fetchFn(e);if(!t.ok)throw new Error(`Fetch failed: ${e} (${t.status})`);return t.json()}async _fetchText(e){const t=await this.fetchFn(e);if(!t.ok)throw new Error(`Fetch failed: ${e} (${t.status})`);return t.text()}async _fetchHandlers(e){try{return await import(e)}catch(t){return console.warn(`[skills] handlers load failed: ${e}`,t),null}}async _fetchHandlersSrc(e){const t=await this.fetchFn(e);if(!t.ok)throw new Error(`Fetch failed: ${e} (${t.status})`);return t.text()}_enforceTrust(e){if(this.trust!=="any"){if(this.trust==="owned-only"){const t=(e.author||"").toLowerCase();if(t&&this.ownerAddress&&t!==this.ownerAddress)throw new Error(`Skill "${e.name}" author ${t} not trusted under owned-only policy`)}this.trust}}}const VR=/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;function eh(i){const e=i.match(VR);if(!e)return{meta:{},body:i};const t={};for(const n of e[1].split(`
-`)){const[s,...r]=n.split(":");s&&(t[s.trim()]=r.join(":").trim())}return{meta:t,body:e[2]}}function WR(i,e){const t=["---"];for(const[n,s]of Object.entries(i))t.push(`${n}: ${s}`);return t.push("---","",e),t.join(`
-`)}class Mi{constructor({mode:e="local",namespace:t,index:n={},files:s={},timeline:r=[]}={}){this.mode=e,this.namespace=t,this.files=new Map(Object.entries(s)),this.timeline=r,this.indexText=n.text||"",this._dirty=!1}static async load({mode:e="local",namespace:t,manifestURI:n,fetchFn:s}){if(e==="none")return new Mi({mode:"none",namespace:t});if(e==="local")return Mi._loadLocal(t);if(e==="ipfs"||e==="encrypted-ipfs")return Mi._loadIPFS({mode:e,namespace:t,manifestURI:n,fetchFn:s});throw new Error(`Unknown memory mode: ${e}`)}static _loadLocal(e){const t=`agent:${e}:memory`;try{const n=localStorage.getItem(t);if(!n)return new Mi({mode:"local",namespace:e});const s=JSON.parse(n);return new Mi({mode:"local",namespace:e,...s})}catch{return new Mi({mode:"local",namespace:e})}}static async _loadIPFS({mode:e,namespace:t,manifestURI:n,fetchFn:s}){const r=n.replace(/manifest\.json$/,"");try{const a=await s(`${r}memory/MEMORY.md`),o=a.ok?await a.text():"",c={},l=/\[([^\]]+)\]\(([^)]+\.md)\)/g;let h;for(;h=l.exec(o);){const u=h[2];try{const d=await s(`${r}memory/${u}`);d.ok&&(c[u]=await d.text())}catch{}}return new Mi({mode:e,namespace:t,index:{text:o},files:c})}catch{return new Mi({mode:e,namespace:t})}}read(e){const t=e.endsWith(".md")?e:`${e}.md`,n=this.files.get(t);return n?eh(n):null}write(e,{name:t,description:n,type:s,body:r,decay:a}){const o=e.endsWith(".md")?e:`${e}.md`,c=new Date().toISOString().slice(0,10),l=this.files.get(o),h=l&&eh(l).meta.created||c,u={name:t,description:n,type:s,created:h,updated:c};a&&(u.decay=a),this.files.set(o,WR(u,r||"")),this._rebuildIndex(),this._dirty=!0,this._persist()}note(e,t){const n={ts:new Date().toISOString(),type:e,...t};this.timeline.push(n),this.timeline.length>1e3&&(this.timeline=this.timeline.slice(-1e3)),this._dirty=!0,this._persist()}async recall(e,{limit:t=5}={}){const n=e.toLowerCase(),s=[];for(const[r,a]of this.files){const{meta:o,body:c}=eh(a),l=`${o.name||""} ${o.description||""} ${c}`.toLowerCase();l.includes(n)&&s.push({file:r,meta:o,body:c,score:l.split(n).length-1})}return s.sort((r,a)=>a.score-r.score).slice(0,t)}_rebuildIndex(){const e={user:[],feedback:[],project:[],reference:[]};for(const[s,r]of this.files){const{meta:a}=eh(r),o=a.type||"user";e[o]||(e[o]=[]),e[o].push({file:s,name:a.name||s,description:a.description||""})}const t=["# Memory",""],n={user:"## User",feedback:"## Feedback",project:"## Project",reference:"## Reference"};for(const[s,r]of Object.entries(e))if(r.length){t.push(n[s]||`## ${s}`);for(const a of r)t.push(`- [${a.name}](${a.file}) — ${a.description}`);t.push("")}this.indexText=t.join(`
+</skill>`:""}}class tx{constructor({fetchFn:e=fetch.bind(globalThis),trust:t="owned-only",ownerAddress:n}={}){this.fetchFn=e,this.trust=t,this.ownerAddress=n?.toLowerCase(),this.skills=new Map}async install(e,{bundleBase:t}={}){const n=this._resolveBundleURI(e.uri,t);if(this.skills.has(n))return this.skills.get(n);const s=await this._fetchJSON(`${n}manifest.json`);this._enforceTrust(s);const r=s.sandboxPolicy==="trusted-main-thread",[a,o,c]=await Promise.all([this._fetchText(`${n}SKILL.md`).catch(()=>""),this._fetchJSON(`${n}tools.json`).catch(()=>({tools:[]})),r?this._fetchHandlers(`${n}handlers.js`).catch(()=>null):this._fetchHandlersSrc(`${n}handlers.js`).catch(()=>null)]),l=new ex({uri:n,manifest:s,instructions:a,tools:o.tools||[],handlers:r?c||{}:{},handlersSrc:r?null:c});if(s.dependencies)for(const[h,u]of Object.entries(s.dependencies))await this.install({uri:h,version:u});return this.skills.set(n,l),l}uninstall(e){for(const[t,n]of this.skills)if(n.name===e)return this.skills.delete(t),!0;return!1}all(){return Array.from(this.skills.values())}allTools(){const e=new Map;for(const t of this.skills.values())for(const n of t.tools)e.has(n.name)&&console.warn(`[skills] tool "${n.name}" overridden by skill "${t.name}"`),e.set(n.name,{...n,_skill:t.name});return Array.from(e.values())}findSkillForTool(e){for(const t of this.skills.values())if(t.tools.some(n=>n.name===e))return t;return null}systemPrompt(){return this.all().map(e=>e.systemPromptFragment()).join("")}_resolveBundleURI(e,t){let n=e;return!/^([a-z]+:|\/)/i.test(e)&&t&&(n=VR(t,e)),n.endsWith("/")||(n+="/"),(n.startsWith("ipfs://")||n.startsWith("ar://"))&&(n=hs(n)),n}async _fetchJSON(e){const t=await this.fetchFn(e);if(!t.ok)throw new Error(`Fetch failed: ${e} (${t.status})`);return t.json()}async _fetchText(e){const t=await this.fetchFn(e);if(!t.ok)throw new Error(`Fetch failed: ${e} (${t.status})`);return t.text()}async _fetchHandlers(e){try{return await import(e)}catch(t){return console.warn(`[skills] handlers load failed: ${e}`,t),null}}async _fetchHandlersSrc(e){const t=await this.fetchFn(e);if(!t.ok)throw new Error(`Fetch failed: ${e} (${t.status})`);return t.text()}_enforceTrust(e){if(this.trust!=="any"){if(this.trust==="owned-only"){const t=(e.author||"").toLowerCase();if(t&&this.ownerAddress&&t!==this.ownerAddress)throw new Error(`Skill "${e.name}" author ${t} not trusted under owned-only policy`)}this.trust}}}const WR=/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;function nh(i){const e=i.match(WR);if(!e)return{meta:{},body:i};const t={};for(const n of e[1].split(`
+`)){const[s,...r]=n.split(":");s&&(t[s.trim()]=r.join(":").trim())}return{meta:t,body:e[2]}}function qR(i,e){const t=["---"];for(const[n,s]of Object.entries(i))t.push(`${n}: ${s}`);return t.push("---","",e),t.join(`
+`)}class Bi{constructor({mode:e="local",namespace:t,index:n={},files:s={},timeline:r=[]}={}){this.mode=e,this.namespace=t,this.files=new Map(Object.entries(s)),this.timeline=r,this.indexText=n.text||"",this._dirty=!1}static async load({mode:e="local",namespace:t,manifestURI:n,fetchFn:s}){if(e==="none")return new Bi({mode:"none",namespace:t});if(e==="local")return Bi._loadLocal(t);if(e==="ipfs"||e==="encrypted-ipfs")return Bi._loadIPFS({mode:e,namespace:t,manifestURI:n,fetchFn:s});throw new Error(`Unknown memory mode: ${e}`)}static _loadLocal(e){const t=`agent:${e}:memory`;try{const n=localStorage.getItem(t);if(!n)return new Bi({mode:"local",namespace:e});const s=JSON.parse(n);return new Bi({mode:"local",namespace:e,...s})}catch{return new Bi({mode:"local",namespace:e})}}static async _loadIPFS({mode:e,namespace:t,manifestURI:n,fetchFn:s}){const r=n.replace(/manifest\.json$/,"");try{const a=await s(`${r}memory/MEMORY.md`),o=a.ok?await a.text():"",c={},l=/\[([^\]]+)\]\(([^)]+\.md)\)/g;let h;for(;h=l.exec(o);){const u=h[2];try{const d=await s(`${r}memory/${u}`);d.ok&&(c[u]=await d.text())}catch{}}return new Bi({mode:e,namespace:t,index:{text:o},files:c})}catch{return new Bi({mode:e,namespace:t})}}read(e){const t=e.endsWith(".md")?e:`${e}.md`,n=this.files.get(t);return n?nh(n):null}write(e,{name:t,description:n,type:s,body:r,decay:a}){const o=e.endsWith(".md")?e:`${e}.md`,c=new Date().toISOString().slice(0,10),l=this.files.get(o),h=l&&nh(l).meta.created||c,u={name:t,description:n,type:s,created:h,updated:c};a&&(u.decay=a),this.files.set(o,qR(u,r||"")),this._rebuildIndex(),this._dirty=!0,this._persist()}note(e,t){const n={ts:new Date().toISOString(),type:e,...t};this.timeline.push(n),this.timeline.length>1e3&&(this.timeline=this.timeline.slice(-1e3)),this._dirty=!0,this._persist()}async recall(e,{limit:t=5}={}){const n=e.toLowerCase(),s=[];for(const[r,a]of this.files){const{meta:o,body:c}=nh(a),l=`${o.name||""} ${o.description||""} ${c}`.toLowerCase();l.includes(n)&&s.push({file:r,meta:o,body:c,score:l.split(n).length-1})}return s.sort((r,a)=>a.score-r.score).slice(0,t)}_rebuildIndex(){const e={user:[],feedback:[],project:[],reference:[]};for(const[s,r]of this.files){const{meta:a}=nh(r),o=a.type||"user";e[o]||(e[o]=[]),e[o].push({file:s,name:a.name||s,description:a.description||""})}const t=["# Memory",""],n={user:"## User",feedback:"## Feedback",project:"## Project",reference:"## Reference"};for(const[s,r]of Object.entries(e))if(r.length){t.push(n[s]||`## ${s}`);for(const a of r)t.push(`- [${a.name}](${a.file}) — ${a.description}`);t.push("")}this.indexText=t.join(`
`)}_persist(){if(this.mode!=="local"||!this.namespace)return;const e=`agent:${this.namespace}:memory`,t={index:{text:this.indexText},files:Object.fromEntries(this.files),timeline:this.timeline.slice(-200)};try{localStorage.setItem(e,JSON.stringify(t))}catch(n){console.warn("[memory] persist failed",n)}}contextBlock({maxTokens:e=8192}={}){const t=e*4,n=["# Agent Memory","",this.indexText];let s=n.join(`
`).length;for(const[r,a]of this.files){if(s+a.length>t)break;n.push("",`## ${r}`,a),s+=a.length}if(this.timeline.length){const a=this.timeline.slice(-20).map(o=>JSON.stringify(o)).join(`
`);s+a.length<t&&n.push("","## Recent timeline","```",a,"```")}return n.join(`
-`)}async export(){return{version:"memory/0.1",index:this.indexText,files:Object.fromEntries(this.files),timeline:this.timeline}}async import(e,{strategy:t="merge"}={}){if(t==="replace")this.files=new Map(Object.entries(e.files||{})),this.timeline=e.timeline||[];else{for(const[n,s]of Object.entries(e.files||{}))this.files.has(n)||this.files.set(n,s);this.timeline=[...this.timeline,...e.timeline||[]].slice(-1e3)}this._rebuildIndex(),this._persist()}}const qR="6.16.0";function KR(i,e,t){const n=e.split("|").map(r=>r.trim());for(let r=0;r<n.length;r++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof i===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=i,s}async function Gn(i){const e=Object.keys(i);return(await Promise.all(e.map(n=>Promise.resolve(i[n])))).reduce((n,s,r)=>(n[e[r]]=s,n),{})}function Ye(i,e,t){for(let n in e){let s=e[n];const r=t?t[n]:null;r&&KR(s,r,n),Object.defineProperty(i,n,{enumerable:!0,value:s,writable:!1})}}function Pa(i,e){if(i==null)return"null";if(e==null&&(e=new Set),typeof i=="object"){if(e.has(i))return"[Circular]";e.add(i)}if(Array.isArray(i))return"[ "+i.map(t=>Pa(t,e)).join(", ")+" ]";if(i instanceof Uint8Array){const t="0123456789abcdef";let n="0x";for(let s=0;s<i.length;s++)n+=t[i[s]>>4],n+=t[i[s]&15];return n}if(typeof i=="object"&&typeof i.toJSON=="function")return Pa(i.toJSON(),e);switch(typeof i){case"boolean":case"number":case"symbol":return i.toString();case"bigint":return BigInt(i).toString();case"string":return JSON.stringify(i);case"object":{const t=Object.keys(i);return t.sort(),"{ "+t.map(n=>`${Pa(n,e)}: ${Pa(i[n],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Tn(i,e){return i&&i.code===e}function Mf(i){return Tn(i,"CALL_EXCEPTION")}function Qt(i,e,t){let n=i;{const r=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${Pa(t)}`);for(const a in t){if(a==="shortMessage")continue;const o=t[a];r.push(a+"="+Pa(o))}}r.push(`code=${e}`),r.push(`version=${qR}`),r.length&&(i+=" ("+r.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(i);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(i);break;default:s=new Error(i)}return Ye(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&Ye(s,{shortMessage:n}),s}function pe(i,e,t,n){if(!i)throw Qt(e,t,n)}function V(i,e,t,n){pe(i,e,"INVALID_ARGUMENT",{argument:t,value:n})}function tx(i,e,t){t==null&&(t=""),t&&(t=": "+t),pe(i>=e,"missing argument"+t,"MISSING_ARGUMENT",{count:i,expectedCount:e}),pe(i<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:i,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((i,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");i.push(e)}catch{}return i},[]);function th(i,e,t){if(t==null&&(t=""),i!==e){let n=t,s="new";t&&(n+=".",s+=" "+t),pe(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function nx(i,e,t){if(i instanceof Uint8Array)return t?new Uint8Array(i):i;if(typeof i=="string"&&i.length%2===0&&i.match(/^0x[0-9a-f]*$/i)){const n=new Uint8Array((i.length-2)/2);let s=2;for(let r=0;r<n.length;r++)n[r]=parseInt(i.substring(s,s+2),16),s+=2;return n}V(!1,"invalid BytesLike value",e||"value",i)}function ut(i,e){return nx(i,e,!1)}function Hn(i,e){return nx(i,e,!0)}function Pt(i,e){return!(typeof i!="string"||!i.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&i.length!==2+2*e||e===!0&&i.length%2!==0)}function Bf(i){return Pt(i,!0)||i instanceof Uint8Array}const ix="0123456789abcdef";function Ce(i){const e=ut(i);let t="0x";for(let n=0;n<e.length;n++){const s=e[n];t+=ix[(s&240)>>4]+ix[s&15]}return t}function Gt(i){return"0x"+i.map(e=>Ce(e).substring(2)).join("")}function ka(i){return Pt(i,!0)?(i.length-2)/2:ut(i).length}function Kt(i,e,t){const n=ut(i);return t!=null&&t>n.length&&pe(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:t}),Ce(n.slice(e??0,t??n.length))}function sx(i,e,t){const n=ut(i);pe(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),t?s.set(n,e-n.length):s.set(n,0),Ce(s)}function hs(i,e){return sx(i,e,!0)}function jR(i,e){return sx(i,e,!1)}const Yo=BigInt(0),Bi=BigInt(1),Ua=9007199254740991;function XR(i,e){const t=nh(i,"value"),n=BigInt(dt(e,"width"));if(pe(t>>n===Yo,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:i}),t>>n-Bi){const s=(Bi<<n)-Bi;return-((~t&s)+Bi)}return t}function rx(i,e){let t=Ne(i,"value");const n=BigInt(dt(e,"width")),s=Bi<<n-Bi;if(t<Yo){t=-t,pe(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:i});const r=(Bi<<n)-Bi;return(~t&r)+Bi}else pe(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:i});return t}function Jo(i,e){const t=nh(i,"value"),n=BigInt(dt(e,"bits"));return t&(Bi<<n)-Bi}function Ne(i,e){switch(typeof i){case"bigint":return i;case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-Ua&&i<=Ua,"overflow",e||"value",i),BigInt(i);case"string":try{if(i==="")throw new Error("empty string");return i[0]==="-"&&i[1]!=="-"?-BigInt(i.substring(1)):BigInt(i)}catch(t){V(!1,`invalid BigNumberish string: ${t.message}`,e||"value",i)}}V(!1,"invalid BigNumberish value",e||"value",i)}function nh(i,e){const t=Ne(i,e);return pe(t>=Yo,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:i}),t}const ax="0123456789abcdef";function Tf(i){if(i instanceof Uint8Array){let e="0x0";for(const t of i)e+=ax[t>>4],e+=ax[t&15];return BigInt(e)}return Ne(i)}function dt(i,e){switch(typeof i){case"bigint":return V(i>=-Ua&&i<=Ua,"overflow",e||"value",i),Number(i);case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-Ua&&i<=Ua,"overflow",e||"value",i),i;case"string":try{if(i==="")throw new Error("empty string");return dt(BigInt(i),e)}catch(t){V(!1,`invalid numeric string: ${t.message}`,e||"value",i)}}V(!1,"invalid numeric value",e||"value",i)}function YR(i){return dt(Tf(i))}function Ks(i,e){const t=nh(i,"value");let n=t.toString(16);if(e==null)n.length%2&&(n="0"+n);else{const s=dt(e,"width");if(s===0&&t===Yo)return"0x";for(pe(s*2>=n.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:i});n.length<s*2;)n="0"+n}return"0x"+n}function rn(i,e){const t=nh(i,"value");if(t===Yo)return new Uint8Array(0);let n=t.toString(16);n.length%2&&(n="0"+n);const s=new Uint8Array(n.length/2);for(let r=0;r<s.length;r++){const a=r*2;s[r]=parseInt(n.substring(a,a+2),16)}return s}function Ti(i){let e=Ce(Bf(i)?i:rn(i)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const ox="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const cx=BigInt(58);function JR(i){const e=ut(i);let t=Tf(e),n="";for(;t;)n=ox[Number(t%cx)]+n,t/=cx;for(let s=0;s<e.length&&!e[s];s++)n=ox[0]+n;return n}function ZR(i){i=atob(i);const e=new Uint8Array(i.length);for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return ut(e)}function $R(i){const e=ut(i);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}class lx{filter;emitter;#e;constructor(e,t,n){this.#e=t,Ye(this,{emitter:e,filter:n})}async removeListener(){this.#e!=null&&await this.emitter.off(this.filter,this.#e)}}function eF(i,e,t,n,s){V(!1,`invalid codepoint at offset ${e}; ${i}`,"bytes",t)}function hx(i,e,t,n,s){if(i==="BAD_PREFIX"||i==="UNEXPECTED_CONTINUE"){let r=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)r++;return r}return i==="OVERRUN"?t.length-e-1:0}function tF(i,e,t,n,s){return i==="OVERLONG"?(V(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),n.push(s),0):(n.push(65533),hx(i,e,t))}const nF=Object.freeze({error:eF,ignore:hx,replace:tF});function iF(i,e){e==null&&(e=nF.error);const t=ut(i,"bytes"),n=[];let s=0;for(;s<t.length;){const r=t[s++];if(r>>7===0){n.push(r);continue}let a=null,o=null;if((r&224)===192)a=1,o=127;else if((r&240)===224)a=2,o=2047;else if((r&248)===240)a=3,o=65535;else{(r&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,t,n):s+=e("BAD_PREFIX",s-1,t,n);continue}if(s-1+a>=t.length){s+=e("OVERRUN",s-1,t,n);continue}let c=r&(1<<8-a-1)-1;for(let l=0;l<a;l++){let h=t[s];if((h&192)!=128){s+=e("MISSING_CONTINUE",s,t,n),c=null;break}c=c<<6|h&63,s++}if(c!==null){if(c>1114111){s+=e("OUT_OF_RANGE",s-1-a,t,n,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-a,t,n,c);continue}if(c<=o){s+=e("OVERLONG",s-1-a,t,n,c);continue}n.push(c)}}return n}function us(i,e){V(typeof i=="string","invalid string value","str",i);let t=[];for(let n=0;n<i.length;n++){const s=i.charCodeAt(n);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){n++;const r=i.charCodeAt(n);V(n<i.length&&(r&64512)===56320,"invalid surrogate pair","str",i);const a=65536+((s&1023)<<10)+(r&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function sF(i){return i.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function ih(i,e){return sF(iF(i,e))}function ux(i){async function e(t,n){pe(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const s=t.url.split(":")[0].toLowerCase();pe(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),pe(s==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let r=null;const a=new AbortController,o=setTimeout(()=>{r=Qt("request timeout","TIMEOUT"),a.abort()},t.timeout);n&&n.addListener(()=>{r=Qt("request cancelled","CANCELLED"),a.abort()});const c=Object.assign({},i,{method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:a.signal});let l;try{l=await fetch(t.url,c)}catch(f){throw clearTimeout(o),r||f}clearTimeout(o);const h={};l.headers.forEach((f,p)=>{h[p.toLowerCase()]=f});const u=await l.arrayBuffer(),d=u==null?null:new Uint8Array(u);return{statusCode:l.status,statusMessage:l.statusText,headers:h,body:d}}return e}const rF=12,aF=250;let dx=ux();const oF=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),cF=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Rf=!1;async function fx(i,e){try{const t=i.match(oF);if(!t)throw new Error("invalid data");return new js(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?ZR(t[3]):hF(t[3]))}catch{return new js(599,"BAD REQUEST (invalid data: URI)",{},null,new Hi(i))}}function px(i){async function e(t,n){try{const s=t.match(cF);if(!s)throw new Error("invalid link");return new Hi(`${i}${s[2]}`)}catch{return new js(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Hi(t))}}return e}const sh={data:fx,ipfs:px("https://gateway.ipfs.io/ipfs/")},Ax=new WeakMap;class lF{#e;#t;constructor(e){this.#e=[],this.#t=!1,Ax.set(e,()=>{if(!this.#t){this.#t=!0;for(const t of this.#e)setTimeout(()=>{t()},0);this.#e=[]}})}addListener(e){pe(!this.#t,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#e.push(e)}get cancelled(){return this.#t}checkSignal(){pe(!this.cancelled,"cancelled","CANCELLED",{})}}function rh(i){if(i==null)throw new Error("missing signal; should not happen");return i.checkSignal(),i}class Hi{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;#c;#h;#u;get url(){return this.#a}set url(e){this.#a=String(e)}get body(){return this.#r==null?null:new Uint8Array(this.#r)}set body(e){if(e==null)this.#r=void 0,this.#o=void 0;else if(typeof e=="string")this.#r=us(e),this.#o="text/plain";else if(e instanceof Uint8Array)this.#r=e,this.#o="application/octet-stream";else if(typeof e=="object")this.#r=us(JSON.stringify(e)),this.#o="application/json";else throw new Error("invalid body")}hasBody(){return this.#r!=null}get method(){return this.#i?this.#i:this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),this.#i=String(e).toUpperCase()}get headers(){const e=Object.assign({},this.#n);return this.#f&&(e.authorization=`Basic ${$R(us(this.#f))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&this.#o&&(e["content-type"]=this.#o),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){this.#n[String(e).toLowerCase()]=String(t)}clearHeaders(){this.#n={}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let n=0;return{next:()=>{if(n<t.length){const s=t[n++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#f||null}setCredentials(e,t){V(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#f=`${e}:${t}`}get allowGzip(){return this.#t}set allowGzip(e){this.#t=!!e}get allowInsecureAuthentication(){return!!this.#e}set allowInsecureAuthentication(e){this.#e=!!e}get timeout(){return this.#s}set timeout(e){V(e>=0,"timeout must be non-zero","timeout",e),this.#s=e}get preflightFunc(){return this.#l||null}set preflightFunc(e){this.#l=e}get processFunc(){return this.#p||null}set processFunc(e){this.#p=e}get retryFunc(){return this.#A||null}set retryFunc(e){this.#A=e}get getUrlFunc(){return this.#u||dx}set getUrlFunc(e){this.#u=e}constructor(e){this.#a=String(e),this.#e=!1,this.#t=!0,this.#n={},this.#i="",this.#s=3e5,this.#h={slotInterval:aF,maxAttempts:rF},this.#u=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#r?Ce(this.#r):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(this.#h.slotInterval=e.slotInterval),e.maxAttempts!=null&&(this.#h.maxAttempts=e.maxAttempts)}async#d(e,t,n,s,r){if(e>=this.#h.maxAttempts)return r.makeServerError("exceeded maximum retry limit");pe(gx()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),n>0&&await uF(n);let a=this.clone();const o=(a.url.split(":")[0]||"").toLowerCase();if(o in sh){const h=await sh[o](a.url,rh(s.#c));if(h instanceof js){let u=h;if(this.processFunc){rh(s.#c);try{u=await this.processFunc(a,u)}catch(d){(d.throttle==null||typeof d.stall!="number")&&u.makeServerError("error in post-processing function",d).assertOk()}}return u}a=h}this.preflightFunc&&(a=await this.preflightFunc(a));const c=await this.getUrlFunc(a,rh(s.#c));let l=new js(c.statusCode,c.statusMessage,c.headers,c.body,s);if(l.statusCode===301||l.statusCode===302){try{const h=l.headers.location||"";return a.redirect(h).#d(e+1,t,0,s,l)}catch{}return l}else if(l.statusCode===429&&(this.retryFunc==null||await this.retryFunc(a,l,e))){const h=l.headers["retry-after"];let u=this.#h.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(u=parseInt(h)),a.clone().#d(e+1,t,u,s,l)}if(this.processFunc){rh(s.#c);try{l=await this.processFunc(a,l)}catch(h){(h.throttle==null||typeof h.stall!="number")&&l.makeServerError("error in post-processing function",h).assertOk();let u=this.#h.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(u=h.stall),a.clone().#d(e+1,t,u,s,l)}}return l}send(){return pe(this.#c==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#c=new lF(this),this.#d(0,gx()+this.timeout,0,this,new js(0,"",{},null,this))}cancel(){pe(this.#c!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=Ax.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();pe(this.method==="GET"&&(t!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new Hi(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,s.#n=Object.assign({},this.#n),this.#r&&(s.#r=new Uint8Array(this.#r)),s.#o=this.#o,s}clone(){const e=new Hi(this.url);return e.#i=this.#i,this.#r&&(e.#r=this.#r),e.#o=this.#o,e.#n=Object.assign({},this.#n),e.#f=this.#f,this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),e.#l=this.#l,e.#p=this.#p,e.#A=this.#A,e.#h=Object.assign({},this.#h),e.#u=this.#u,e}static lockConfig(){Rf=!0}static getGateway(e){return sh[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(Rf)throw new Error("gateways locked");sh[e]=t}static registerGetUrl(e){if(Rf)throw new Error("gateways locked");dx=e}static createGetUrlFunc(e){return ux(e)}static createDataGateway(){return fx}static createIpfsGatewayFunc(e){return px(e)}}class js{#e;#t;#n;#i;#s;#a;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#i?Ce(this.#i):"null"}>`}get statusCode(){return this.#e}get statusMessage(){return this.#t}get headers(){return Object.assign({},this.#n)}get body(){return this.#i==null?null:new Uint8Array(this.#i)}get bodyText(){try{return this.#i==null?"":ih(this.#i)}catch{pe(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{pe(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let n=0;return{next:()=>{if(n<t.length){const s=t[n++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}constructor(e,t,n,s,r){this.#e=e,this.#t=t,this.#n=Object.keys(n).reduce((a,o)=>(a[o.toLowerCase()]=String(n[o]),a),{}),this.#i=s==null?null:new Uint8Array(s),this.#s=r||null,this.#a={message:""}}makeServerError(e,t){let n;e?n=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,n=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new js(599,n,this.headers,this.body,this.#s||void 0);return s.#a={message:e,error:t},s}throwThrottleError(e,t){t==null?t=-1:V(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const n=new Error(e||"throttling requests");throw Ye(n,{stall:t,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return this.#i!=null}get request(){return this.#s}ok(){return this.#a.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=this.#a;e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let s=null;try{this.#i&&(s=ih(this.#i))}catch{}pe(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:n,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function gx(){return new Date().getTime()}function hF(i){return us(i.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function uF(i){return new Promise(e=>setTimeout(e,i))}function dF(i){let e=i.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function mx(i,e,t){let n=0;for(let s=0;s<t;s++)n=n*256+i[e+s];return n}function xx(i,e,t,n){const s=[];for(;t<e+1+n;){const r=bx(i,t);s.push(r.result),t+=r.consumed,pe(t<=e+1+n,"child data too short","BUFFER_OVERRUN",{buffer:i,length:n,offset:e})}return{consumed:1+n,result:s}}function bx(i,e){pe(i.length!==0,"data too short","BUFFER_OVERRUN",{buffer:i,length:0,offset:1});const t=n=>{pe(n<=i.length,"data short segment too short","BUFFER_OVERRUN",{buffer:i,length:i.length,offset:n})};if(i[e]>=248){const n=i[e]-247;t(e+1+n);const s=mx(i,e+1,n);return t(e+1+n+s),xx(i,e,e+1+n,n+s)}else if(i[e]>=192){const n=i[e]-192;return t(e+1+n),xx(i,e,e+1,n)}else if(i[e]>=184){const n=i[e]-183;t(e+1+n);const s=mx(i,e+1,n);t(e+1+n+s);const r=Ce(i.slice(e+1+n,e+1+n+s));return{consumed:1+n+s,result:r}}else if(i[e]>=128){const n=i[e]-128;t(e+1+n);const s=Ce(i.slice(e+1,e+1+n));return{consumed:1+n,result:s}}return{consumed:1,result:dF(i[e])}}function Zo(i){const e=ut(i,"data"),t=bx(e,0);return V(t.consumed===e.length,"unexpected junk after rlp payload","data",i),t.result}function Ex(i){const e=[];for(;i;)e.unshift(i&255),i>>=8;return e}function yx(i){if(Array.isArray(i)){let n=[];if(i.forEach(function(r){n=n.concat(yx(r))}),n.length<=55)return n.unshift(192+n.length),n;const s=Ex(n.length);return s.unshift(247+s.length),s.concat(n)}const e=Array.prototype.slice.call(ut(i,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=Ex(e.length);return t.unshift(183+t.length),t.concat(e)}const _x="0123456789abcdef";function ds(i){let e="0x";for(const t of yx(i))e+=_x[t>>4],e+=_x[t&15];return e}const zn=32,Ff=new Uint8Array(zn),fF=["then"],ah={},wx=new WeakMap;function Cr(i){return wx.get(i)}function vx(i,e){wx.set(i,e)}function $o(i,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${i}`);throw t.error=e,t}function Nf(i,e,t){return i.indexOf(null)>=0?e.map((n,s)=>n instanceof fs?Nf(Cr(n),n,t):n):i.reduce((n,s,r)=>{let a=e.getValue(s);return s in n||(t&&a instanceof fs&&(a=Nf(Cr(a),a,t)),n[s]=a),n},{})}class fs extends Array{#e;constructor(...e){const t=e[0];let n=e[1],s=(e[2]||[]).slice(),r=!0;t!==ah&&(n=e,s=[],r=!1),super(n.length),n.forEach((c,l)=>{this[l]=c});const a=s.reduce((c,l)=>(typeof l=="string"&&c.set(l,(c.get(l)||0)+1),c),new Map);if(vx(this,Object.freeze(n.map((c,l)=>{const h=s[l];return h!=null&&a.get(h)===1?h:null}))),this.#e=[],this.#e==null&&this.#e,!r)return;Object.freeze(this);const o=new Proxy(this,{get:(c,l,h)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){const d=dt(l,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const f=c[d];return f instanceof Error&&$o(`index ${d}`,f),f}if(fF.indexOf(l)>=0)return Reflect.get(c,l,h);const u=c[l];if(u instanceof Function)return function(...d){return u.apply(this===h?c:this,d)};if(!(l in c))return c.getValue.apply(this===h?c:this,[l])}return Reflect.get(c,l,h)}});return vx(o,Cr(this)),o}toArray(e){const t=[];return this.forEach((n,s)=>{n instanceof Error&&$o(`index ${s}`,n),e&&n instanceof fs&&(n=n.toArray(e)),t.push(n)}),t}toObject(e){const t=Cr(this);return t.reduce((n,s,r)=>(pe(s!=null,`value at index ${r} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Nf(t,this,e)),{})}slice(e,t){e==null&&(e=0),e<0&&(e+=this.length,e<0&&(e=0)),t==null&&(t=this.length),t<0&&(t+=this.length,t<0&&(t=0)),t>this.length&&(t=this.length);const n=Cr(this),s=[],r=[];for(let a=e;a<t;a++)s.push(this[a]),r.push(n[a]);return new fs(ah,s,r)}filter(e,t){const n=Cr(this),s=[],r=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&$o(`index ${a}`,o),e.call(t,o,a,this)&&(s.push(o),r.push(n[a]))}return new fs(ah,s,r)}map(e,t){const n=[];for(let s=0;s<this.length;s++){const r=this[s];r instanceof Error&&$o(`index ${s}`,r),n.push(e.call(t,r,s,this))}return n}getValue(e){const t=Cr(this).indexOf(e);if(t===-1)return;const n=this[t];return n instanceof Error&&$o(`property ${JSON.stringify(e)}`,n.error),n}static fromItems(e,t){return new fs(ah,e,t)}}function Cx(i){let e=rn(i);return pe(e.length<=zn,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:zn,offset:e.length}),e.length!==zn&&(e=Hn(Gt([Ff.slice(e.length%zn),e]))),e}class ps{name;type;localName;dynamic;constructor(e,t,n,s){Ye(this,{name:e,type:t,localName:n,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){V(!1,e,this.localName,t)}}class Df{#e;#t;constructor(){this.#e=[],this.#t=0}get data(){return Gt(this.#e)}get length(){return this.#t}#n(e){return this.#e.push(e),this.#t+=e.length,e.length}appendWriter(e){return this.#n(Hn(e.data))}writeBytes(e){let t=Hn(e);const n=t.length%zn;return n&&(t=Hn(Gt([t,Ff.slice(n)]))),this.#n(t)}writeValue(e){return this.#n(Cx(e))}writeUpdatableValue(){const e=this.#e.length;return this.#e.push(Ff),this.#t+=zn,t=>{this.#e[e]=Cx(t)}}}class Lf{allowLoose;#e;#t;#n;#i;#s;constructor(e,t,n){Ye(this,{allowLoose:!!t}),this.#e=Hn(e),this.#n=0,this.#i=null,this.#s=n??1024,this.#t=0}get data(){return Ce(this.#e)}get dataLength(){return this.#e.length}get consumed(){return this.#t}get bytes(){return new Uint8Array(this.#e)}#a(e){if(this.#i)return this.#i.#a(e);this.#n+=e,pe(this.#s<1||this.#n<=this.#s*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Hn(this.#e),offset:this.#t,length:e,info:{bytesRead:this.#n,dataLength:this.dataLength}})}#r(e,t,n){let s=Math.ceil(t/zn)*zn;return this.#t+s>this.#e.length&&(this.allowLoose&&n&&this.#t+t<=this.#e.length?s=t:pe(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Hn(this.#e),length:this.#e.length,offset:this.#t+s})),this.#e.slice(this.#t,this.#t+s)}subReader(e){const t=new Lf(this.#e.slice(this.#t+e),this.allowLoose,this.#s);return t.#i=this,t}readBytes(e,t){let n=this.#r(0,e,!!t);return this.#a(e),this.#t+=n.length,n.slice(0,e)}readValue(){return Tf(this.readBytes(zn))}readIndex(){return YR(this.readBytes(zn))}}function oh(i){if(!Number.isSafeInteger(i)||i<0)throw new Error(`Wrong positive integer: ${i}`)}function Pf(i,...e){if(!(i instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(i.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${i.length}`)}function pF(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");oh(i.outputLen),oh(i.blockLen)}function Oa(i,e=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(e&&i.finished)throw new Error("Hash#digest() has already been called")}function Ix(i,e){Pf(i);const t=e.outputLen;if(i.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const kf=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;const Sx=i=>i instanceof Uint8Array,AF=i=>new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)),Uf=i=>new DataView(i.buffer,i.byteOffset,i.byteLength),zi=(i,e)=>i<<32-e|i>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function gF(i){if(typeof i!="string")throw new Error(`utf8ToBytes expected string, got ${typeof i}`);return new Uint8Array(new TextEncoder().encode(i))}function ch(i){if(typeof i=="string"&&(i=gF(i)),!Sx(i))throw new Error(`expected Uint8Array, got ${typeof i}`);return i}function mF(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!Sx(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}class Of{clone(){return this._cloneInto()}}function Qf(i){const e=n=>i().update(ch(n)).digest(),t=i();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>i(),e}function xF(i=32){if(kf&&typeof kf.getRandomValues=="function")return kf.getRandomValues(new Uint8Array(i));throw new Error("crypto.getRandomValues must be defined")}class Mx extends Of{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,pF(e);const n=ch(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,r=new Uint8Array(s);r.set(n.length>s?e.create().update(n).digest():n);for(let a=0;a<r.length;a++)r[a]^=54;this.iHash.update(r),this.oHash=e.create();for(let a=0;a<r.length;a++)r[a]^=106;this.oHash.update(r),r.fill(0)}update(e){return Oa(this),this.iHash.update(e),this}digestInto(e){Oa(this),Pf(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:s,destroyed:r,blockLen:a,outputLen:o}=this;return e=e,e.finished=s,e.destroyed=r,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Bx=(i,e,t)=>new Mx(i,e).update(t).digest();Bx.create=(i,e)=>new Mx(i,e);function bF(i,e,t,n){if(typeof i.setBigUint64=="function")return i.setBigUint64(e,t,n);const s=BigInt(32),r=BigInt(4294967295),a=Number(t>>s&r),o=Number(t&r),c=n?4:0,l=n?0:4;i.setUint32(e+c,a,n),i.setUint32(e+l,o,n)}class Tx extends Of{constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Uf(this.buffer)}update(e){Oa(this);const{view:t,buffer:n,blockLen:s}=this;e=ch(e);const r=e.length;for(let a=0;a<r;){const o=Math.min(s-this.pos,r-a);if(o===s){const c=Uf(e);for(;s<=r-a;a+=s)this.process(c,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Oa(this),Ix(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:s,isLE:r}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(n,0),a=0);for(let u=a;u<s;u++)t[u]=0;bF(n,s-8,BigInt(this.length*8),r),this.process(n,0);const o=Uf(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)o.setUint32(4*u,h[u],r)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:s,finished:r,destroyed:a,pos:o}=this;return e.length=s,e.pos=o,e.finished=r,e.destroyed=a,s%t&&e.buffer.set(n),e}}const EF=(i,e,t)=>i&e^~i&t,yF=(i,e,t)=>i&e^i&t^e&t,_F=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Xs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ys=new Uint32Array(64);class wF extends Tx{constructor(){super(64,32,8,!1),this.A=Xs[0]|0,this.B=Xs[1]|0,this.C=Xs[2]|0,this.D=Xs[3]|0,this.E=Xs[4]|0,this.F=Xs[5]|0,this.G=Xs[6]|0,this.H=Xs[7]|0}get(){const{A:e,B:t,C:n,D:s,E:r,F:a,G:o,H:c}=this;return[e,t,n,s,r,a,o,c]}set(e,t,n,s,r,a,o,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=r|0,this.F=a|0,this.G=o|0,this.H=c|0}process(e,t){for(let u=0;u<16;u++,t+=4)Ys[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const d=Ys[u-15],f=Ys[u-2],p=zi(d,7)^zi(d,18)^d>>>3,m=zi(f,17)^zi(f,19)^f>>>10;Ys[u]=m+Ys[u-7]+p+Ys[u-16]|0}let{A:n,B:s,C:r,D:a,E:o,F:c,G:l,H:h}=this;for(let u=0;u<64;u++){const d=zi(o,6)^zi(o,11)^zi(o,25),f=h+d+EF(o,c,l)+_F[u]+Ys[u]|0,m=(zi(n,2)^zi(n,13)^zi(n,22))+yF(n,s,r)|0;h=l,l=c,c=o,o=a+f|0,a=r,r=s,s=n,n=f+m|0}n=n+this.A|0,s=s+this.B|0,r=r+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(n,s,r,a,o,c,l,h)}roundClean(){Ys.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Rx=Qf(()=>new wF),lh=BigInt(2**32-1),Gf=BigInt(32);function Fx(i,e=!1){return e?{h:Number(i&lh),l:Number(i>>Gf&lh)}:{h:Number(i>>Gf&lh)|0,l:Number(i&lh)|0}}function Nx(i,e=!1){let t=new Uint32Array(i.length),n=new Uint32Array(i.length);for(let s=0;s<i.length;s++){const{h:r,l:a}=Fx(i[s],e);[t[s],n[s]]=[r,a]}return[t,n]}const vF=(i,e)=>BigInt(i>>>0)<<Gf|BigInt(e>>>0),CF=(i,e,t)=>i>>>t,IF=(i,e,t)=>i<<32-t|e>>>t,SF=(i,e,t)=>i>>>t|e<<32-t,MF=(i,e,t)=>i<<32-t|e>>>t,BF=(i,e,t)=>i<<64-t|e>>>t-32,TF=(i,e,t)=>i>>>t-32|e<<64-t,RF=(i,e)=>e,FF=(i,e)=>i,Dx=(i,e,t)=>i<<t|e>>>32-t,Lx=(i,e,t)=>e<<t|i>>>32-t,Px=(i,e,t)=>e<<t-32|i>>>64-t,kx=(i,e,t)=>i<<t-32|e>>>64-t;function NF(i,e,t,n){const s=(e>>>0)+(n>>>0);return{h:i+t+(s/2**32|0)|0,l:s|0}}const lt={fromBig:Fx,split:Nx,toBig:vF,shrSH:CF,shrSL:IF,rotrSH:SF,rotrSL:MF,rotrBH:BF,rotrBL:TF,rotr32H:RF,rotr32L:FF,rotlSH:Dx,rotlSL:Lx,rotlBH:Px,rotlBL:kx,add:NF,add3L:(i,e,t)=>(i>>>0)+(e>>>0)+(t>>>0),add3H:(i,e,t,n)=>e+t+n+(i/2**32|0)|0,add4L:(i,e,t,n)=>(i>>>0)+(e>>>0)+(t>>>0)+(n>>>0),add4H:(i,e,t,n,s)=>e+t+n+s+(i/2**32|0)|0,add5H:(i,e,t,n,s,r)=>e+t+n+s+r+(i/2**32|0)|0,add5L:(i,e,t,n,s)=>(i>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0)},[DF,LF]=lt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(i=>BigInt(i))),Js=new Uint32Array(80),Zs=new Uint32Array(80);class PF extends Tx{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:s,Ch:r,Cl:a,Dh:o,Dl:c,Eh:l,El:h,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:g}=this;return[e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g]}set(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=r|0,this.Cl=a|0,this.Dh=o|0,this.Dl=c|0,this.Eh=l|0,this.El=h|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(e,t){for(let x=0;x<16;x++,t+=4)Js[x]=e.getUint32(t),Zs[x]=e.getUint32(t+=4);for(let x=16;x<80;x++){const E=Js[x-15]|0,S=Zs[x-15]|0,w=lt.rotrSH(E,S,1)^lt.rotrSH(E,S,8)^lt.shrSH(E,S,7),I=lt.rotrSL(E,S,1)^lt.rotrSL(E,S,8)^lt.shrSL(E,S,7),T=Js[x-2]|0,C=Zs[x-2]|0,v=lt.rotrSH(T,C,19)^lt.rotrBH(T,C,61)^lt.shrSH(T,C,6),F=lt.rotrSL(T,C,19)^lt.rotrBL(T,C,61)^lt.shrSL(T,C,6),K=lt.add4L(I,F,Zs[x-7],Zs[x-16]),q=lt.add4H(K,w,v,Js[x-7],Js[x-16]);Js[x]=q|0,Zs[x]=K|0}let{Ah:n,Al:s,Bh:r,Bl:a,Ch:o,Cl:c,Dh:l,Dl:h,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:g,Hh:A,Hl:_}=this;for(let x=0;x<80;x++){const E=lt.rotrSH(u,d,14)^lt.rotrSH(u,d,18)^lt.rotrBH(u,d,41),S=lt.rotrSL(u,d,14)^lt.rotrSL(u,d,18)^lt.rotrBL(u,d,41),w=u&f^~u&m,I=d&p^~d&g,T=lt.add5L(_,S,I,LF[x],Zs[x]),C=lt.add5H(T,A,E,w,DF[x],Js[x]),v=T|0,F=lt.rotrSH(n,s,28)^lt.rotrBH(n,s,34)^lt.rotrBH(n,s,39),K=lt.rotrSL(n,s,28)^lt.rotrBL(n,s,34)^lt.rotrBL(n,s,39),q=n&r^n&o^r&o,$=s&a^s&c^a&c;A=m|0,_=g|0,m=f|0,g=p|0,f=u|0,p=d|0,{h:u,l:d}=lt.add(l|0,h|0,C|0,v|0),l=o|0,h=c|0,o=r|0,c=a|0,r=n|0,a=s|0;const D=lt.add3L(v,K,$);n=lt.add3H(D,C,F,q),s=D|0}({h:n,l:s}=lt.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:r,l:a}=lt.add(this.Bh|0,this.Bl|0,r|0,a|0),{h:o,l:c}=lt.add(this.Ch|0,this.Cl|0,o|0,c|0),{h:l,l:h}=lt.add(this.Dh|0,this.Dl|0,l|0,h|0),{h:u,l:d}=lt.add(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=lt.add(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:g}=lt.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:A,l:_}=lt.add(this.Hh|0,this.Hl|0,A|0,_|0),this.set(n,s,r,a,o,c,l,h,u,d,f,p,m,g,A,_)}roundClean(){Js.fill(0),Zs.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const kF=Qf(()=>new PF);function UF(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const Ux=UF();Ux.crypto||Ux.msCrypto;function OF(i){switch(i){case"sha256":return Rx.create();case"sha512":return kF.create()}V(!1,"invalid hashing algorithm name","algorithm",i)}const[Ox,Qx,Gx]=[[],[],[]],QF=BigInt(0),ec=BigInt(1),GF=BigInt(2),HF=BigInt(7),zF=BigInt(256),VF=BigInt(113);for(let i=0,e=ec,t=1,n=0;i<24;i++){[t,n]=[n,(2*t+3*n)%5],Ox.push(2*(5*n+t)),Qx.push((i+1)*(i+2)/2%64);let s=QF;for(let r=0;r<7;r++)e=(e<<ec^(e>>HF)*VF)%zF,e&GF&&(s^=ec<<(ec<<BigInt(r))-ec);Gx.push(s)}const[WF,qF]=Nx(Gx,!0),Hx=(i,e,t)=>t>32?Px(i,e,t):Dx(i,e,t),zx=(i,e,t)=>t>32?kx(i,e,t):Lx(i,e,t);function KF(i,e=24){const t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)t[a]=i[a]^i[a+10]^i[a+20]^i[a+30]^i[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,l=t[c],h=t[c+1],u=Hx(l,h,1)^t[o],d=zx(l,h,1)^t[o+1];for(let f=0;f<50;f+=10)i[a+f]^=u,i[a+f+1]^=d}let s=i[2],r=i[3];for(let a=0;a<24;a++){const o=Qx[a],c=Hx(s,r,o),l=zx(s,r,o),h=Ox[a];s=i[h],r=i[h+1],i[h]=c,i[h+1]=l}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)t[o]=i[a+o];for(let o=0;o<10;o++)i[a+o]^=~t[(o+2)%10]&t[(o+4)%10]}i[0]^=WF[n],i[1]^=qF[n]}t.fill(0)}class Hf extends Of{constructor(e,t,n,s=!1,r=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=s,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,oh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=AF(this.state)}keccak(){KF(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Oa(this);const{blockLen:t,state:n}=this;e=ch(e);const s=e.length;for(let r=0;r<s;){const a=Math.min(t-this.pos,s-r);for(let o=0;o<a;o++)n[this.pos++]^=e[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:s}=this;e[n]^=t,(t&128)!==0&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Oa(this,!1),Pf(e),this.finish();const t=this.state,{blockLen:n}=this;for(let s=0,r=e.length;s<r;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,r-s);e.set(t.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return oh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ix(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:s,rounds:r,enableXOF:a}=this;return e||(e=new Hf(t,n,s,a,r)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=r,e.suffix=n,e.outputLen=s,e.enableXOF=a,e.destroyed=this.destroyed,e}}const jF=((i,e,t)=>Qf(()=>new Hf(e,i,t)))(1,136,256/8);let Vx=!1;const Wx=function(i){return jF(i)};let qx=Wx;function an(i){const e=ut(i,"data");return Ce(qx(e))}an._=Wx,an.lock=function(){Vx=!0},an.register=function(i){if(Vx)throw new TypeError("keccak256 is locked");qx=i},Object.freeze(an);const Kx=function(i){return OF("sha256").update(i).digest()};let jx=Kx,Xx=!1;function Qa(i){const e=ut(i,"data");return Ce(jx(e))}Qa._=Kx,Qa.lock=function(){Xx=!0},Qa.register=function(i){if(Xx)throw new Error("sha256 is locked");jx=i},Object.freeze(Qa),Object.freeze(Qa);BigInt(0);const XF=BigInt(1),YF=BigInt(2),hh=i=>i instanceof Uint8Array,JF=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ga(i){if(!hh(i))throw new Error("Uint8Array expected");let e="";for(let t=0;t<i.length;t++)e+=JF[i[t]];return e}function zf(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return BigInt(i===""?"0":`0x${i}`)}function tc(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);const e=i.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const t=new Uint8Array(e/2);for(let n=0;n<t.length;n++){const s=n*2,r=i.slice(s,s+2),a=Number.parseInt(r,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");t[n]=a}return t}function Ir(i){return zf(Ga(i))}function Vf(i){if(!hh(i))throw new Error("Uint8Array expected");return zf(Ga(Uint8Array.from(i).reverse()))}function Ha(i,e){return tc(i.toString(16).padStart(e*2,"0"))}function Wf(i,e){return Ha(i,e).reverse()}function Ri(i,e,t){let n;if(typeof e=="string")try{n=tc(e)}catch(r){throw new Error(`${i} must be valid hex string, got "${e}". Cause: ${r}`)}else if(hh(e))n=Uint8Array.from(e);else throw new Error(`${i} must be hex string or Uint8Array`);const s=n.length;if(typeof t=="number"&&s!==t)throw new Error(`${i} expected ${t} bytes, got ${s}`);return n}function nc(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!hh(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}const qf=i=>(YF<<BigInt(i-1))-XF,Kf=i=>new Uint8Array(i),Yx=i=>Uint8Array.from(i);function Jx(i,e,t){if(typeof i!="number"||i<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Kf(i),s=Kf(i),r=0;const a=()=>{n.fill(1),s.fill(0),r=0},o=(...u)=>t(s,n,...u),c=(u=Kf())=>{s=o(Yx([0]),u),n=o(),u.length!==0&&(s=o(Yx([1]),u),n=o())},l=()=>{if(r++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<e;){n=o();const f=n.slice();d.push(f),u+=n.length}return nc(...d)};return(u,d)=>{a(),c(u);let f;for(;!(f=d(l()));)c();return a(),f}}const ZF={bigint:i=>typeof i=="bigint",function:i=>typeof i=="function",boolean:i=>typeof i=="boolean",string:i=>typeof i=="string",stringOrUint8Array:i=>typeof i=="string"||i instanceof Uint8Array,isSafeInteger:i=>Number.isSafeInteger(i),array:i=>Array.isArray(i),field:(i,e)=>e.Fp.isValid(i),hash:i=>typeof i=="function"&&Number.isSafeInteger(i.outputLen)};function ic(i,e,t={}){const n=(s,r,a)=>{const o=ZF[r];if(typeof o!="function")throw new Error(`Invalid validator "${r}", expected function`);const c=i[s];if(!(a&&c===void 0)&&!o(c,i))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${r}`)};for(const[s,r]of Object.entries(e))n(s,r,!1);for(const[s,r]of Object.entries(t))n(s,r,!0);return i}const $F=Object.freeze(Object.defineProperty({__proto__:null,bitMask:qf,bytesToHex:Ga,bytesToNumberBE:Ir,bytesToNumberLE:Vf,concatBytes:nc,createHmacDrbg:Jx,ensureBytes:Ri,hexToBytes:tc,hexToNumber:zf,numberToBytesBE:Ha,numberToBytesLE:Wf,validateObject:ic},Symbol.toStringTag,{value:"Module"}));const yn=BigInt(0),en=BigInt(1),Sr=BigInt(2),eN=BigInt(3),jf=BigInt(4),Zx=BigInt(5),$x=BigInt(8);BigInt(9),BigInt(16);function jn(i,e){const t=i%e;return t>=yn?t:e+t}function tN(i,e,t){if(t<=yn||e<yn)throw new Error("Expected power/modulo > 0");if(t===en)return yn;let n=en;for(;e>yn;)e&en&&(n=n*i%t),i=i*i%t,e>>=en;return n}function fi(i,e,t){let n=i;for(;e-- >yn;)n*=n,n%=t;return n}function Xf(i,e){if(i===yn||e<=yn)throw new Error(`invert: expected positive integers, got n=${i} mod=${e}`);let t=jn(i,e),n=e,s=yn,r=en;for(;t!==yn;){const o=n/t,c=n%t,l=s-r*o;n=t,t=c,s=r,r=l}if(n!==en)throw new Error("invert: does not exist");return jn(s,e)}function nN(i){const e=(i-en)/Sr;let t,n,s;for(t=i-en,n=0;t%Sr===yn;t/=Sr,n++);for(s=Sr;s<i&&tN(s,e,i)!==i-en;s++);if(n===1){const a=(i+en)/jf;return function(c,l){const h=c.pow(l,a);if(!c.eql(c.sqr(h),l))throw new Error("Cannot find square root");return h}}const r=(t+en)/Sr;return function(o,c){if(o.pow(c,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let l=n,h=o.pow(o.mul(o.ONE,s),t),u=o.pow(c,r),d=o.pow(c,t);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let f=1;for(let m=o.sqr(d);f<l&&!o.eql(m,o.ONE);f++)m=o.sqr(m);const p=o.pow(h,en<<BigInt(l-f-1));h=o.sqr(p),u=o.mul(u,p),d=o.mul(d,h),l=f}return u}}function iN(i){if(i%jf===eN){const e=(i+en)/jf;return function(n,s){const r=n.pow(s,e);if(!n.eql(n.sqr(r),s))throw new Error("Cannot find square root");return r}}if(i%$x===Zx){const e=(i-Zx)/$x;return function(n,s){const r=n.mul(s,Sr),a=n.pow(r,e),o=n.mul(s,a),c=n.mul(n.mul(o,Sr),a),l=n.mul(o,n.sub(c,n.ONE));if(!n.eql(n.sqr(l),s))throw new Error("Cannot find square root");return l}}return nN(i)}const sN=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function rN(i){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=sN.reduce((n,s)=>(n[s]="function",n),e);return ic(i,t)}function aN(i,e,t){if(t<yn)throw new Error("Expected power > 0");if(t===yn)return i.ONE;if(t===en)return e;let n=i.ONE,s=e;for(;t>yn;)t&en&&(n=i.mul(n,s)),s=i.sqr(s),t>>=en;return n}function oN(i,e){const t=new Array(e.length),n=e.reduce((r,a,o)=>i.is0(a)?r:(t[o]=r,i.mul(r,a)),i.ONE),s=i.inv(n);return e.reduceRight((r,a,o)=>i.is0(a)?r:(t[o]=i.mul(r,t[o]),i.mul(r,a)),s),t}function eb(i,e){const t=e!==void 0?e:i.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function cN(i,e,t=!1,n={}){if(i<=yn)throw new Error(`Expected Field ORDER > 0, got ${i}`);const{nBitLength:s,nByteLength:r}=eb(i,e);if(r>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=iN(i),o=Object.freeze({ORDER:i,BITS:s,BYTES:r,MASK:qf(s),ZERO:yn,ONE:en,create:c=>jn(c,i),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return yn<=c&&c<i},is0:c=>c===yn,isOdd:c=>(c&en)===en,neg:c=>jn(-c,i),eql:(c,l)=>c===l,sqr:c=>jn(c*c,i),add:(c,l)=>jn(c+l,i),sub:(c,l)=>jn(c-l,i),mul:(c,l)=>jn(c*l,i),pow:(c,l)=>aN(o,c,l),div:(c,l)=>jn(c*Xf(l,i),i),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>Xf(c,i),sqrt:n.sqrt||(c=>a(o,c)),invertBatch:c=>oN(o,c),cmov:(c,l,h)=>h?l:c,toBytes:c=>t?Wf(c,r):Ha(c,r),fromBytes:c=>{if(c.length!==r)throw new Error(`Fp.fromBytes: expected ${r}, got ${c.length}`);return t?Vf(c):Ir(c)}});return Object.freeze(o)}function tb(i){if(typeof i!="bigint")throw new Error("field order must be bigint");const e=i.toString(2).length;return Math.ceil(e/8)}function nb(i){const e=tb(i);return e+Math.ceil(e/2)}function lN(i,e,t=!1){const n=i.length,s=tb(e),r=nb(e);if(n<16||n<r||n>1024)throw new Error(`expected ${r}-1024 bytes of input, got ${n}`);const a=t?Ir(i):Vf(i),o=jn(a,e-en)+en;return t?Wf(o,s):Ha(o,s)}const hN=BigInt(0),Yf=BigInt(1);function uN(i,e){const t=(s,r)=>{const a=r.negate();return s?a:r},n=s=>{const r=Math.ceil(e/s)+1,a=2**(s-1);return{windows:r,windowSize:a}};return{constTimeNegate:t,unsafeLadder(s,r){let a=i.ZERO,o=s;for(;r>hN;)r&Yf&&(a=a.add(o)),o=o.double(),r>>=Yf;return a},precomputeWindow(s,r){const{windows:a,windowSize:o}=n(r),c=[];let l=s,h=l;for(let u=0;u<a;u++){h=l,c.push(h);for(let d=1;d<o;d++)h=h.add(l),c.push(h);l=h.double()}return c},wNAF(s,r,a){const{windows:o,windowSize:c}=n(s);let l=i.ZERO,h=i.BASE;const u=BigInt(2**s-1),d=2**s,f=BigInt(s);for(let p=0;p<o;p++){const m=p*c;let g=Number(a&u);a>>=f,g>c&&(g-=d,a+=Yf);const A=m,_=m+Math.abs(g)-1,x=p%2!==0,E=g<0;g===0?h=h.add(t(x,r[A])):l=l.add(t(E,r[_]))}return{p:l,f:h}},wNAFCached(s,r,a,o){const c=s._WINDOW_SIZE||1;let l=r.get(s);return l||(l=this.precomputeWindow(s,c),c!==1&&r.set(s,o(l))),this.wNAF(c,l,a)}}}function ib(i){return rN(i.Fp),ic(i,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...eb(i.n,i.nBitLength),...i,p:i.Fp.ORDER})}function dN(i){const e=ib(i);ic(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:n,a:s}=e;if(t){if(!n.eql(s,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:fN,hexToBytes:pN}=$F,Mr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(i){const{Err:e}=Mr;if(i.length<2||i[0]!==2)throw new e("Invalid signature integer tag");const t=i[1],n=i.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:fN(n),l:i.subarray(t+2)}},toSig(i){const{Err:e}=Mr,t=typeof i=="string"?pN(i):i;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:s,l:r}=Mr._parseInt(t.subarray(2)),{d:a,l:o}=Mr._parseInt(r);if(o.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:a}},hexFromSig(i){const e=l=>Number.parseInt(l[0],16)&8?"00"+l:l,t=l=>{const h=l.toString(16);return h.length&1?`0${h}`:h},n=e(t(i.s)),s=e(t(i.r)),r=n.length/2,a=s.length/2,o=t(r),c=t(a);return`30${t(a+r+4)}02${c}${s}02${o}${n}`}},As=BigInt(0),pi=BigInt(1);BigInt(2);const sb=BigInt(3);BigInt(4);function AN(i){const e=dN(i),{Fp:t}=e,n=e.toBytes||((p,m,g)=>{const A=m.toAffine();return nc(Uint8Array.from([4]),t.toBytes(A.x),t.toBytes(A.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),g=t.fromBytes(m.subarray(0,t.BYTES)),A=t.fromBytes(m.subarray(t.BYTES,2*t.BYTES));return{x:g,y:A}});function r(p){const{a:m,b:g}=e,A=t.sqr(p),_=t.mul(A,p);return t.add(t.add(_,t.mul(p,m)),g)}if(!t.eql(t.sqr(e.Gy),r(e.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return typeof p=="bigint"&&As<p&&p<e.n}function o(p){if(!a(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(p){const{allowedPrivateKeyLengths:m,nByteLength:g,wrapPrivateKey:A,n:_}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=Ga(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(g*2,"0")}let x;try{x=typeof p=="bigint"?p:Ir(Ri("private key",p,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`)}return A&&(x=jn(x,_)),o(x),x}const l=new Map;function h(p){if(!(p instanceof u))throw new Error("ProjectivePoint expected")}class u{constructor(m,g,A){if(this.px=m,this.py=g,this.pz=A,m==null||!t.isValid(m))throw new Error("x required");if(g==null||!t.isValid(g))throw new Error("y required");if(A==null||!t.isValid(A))throw new Error("z required")}static fromAffine(m){const{x:g,y:A}=m||{};if(!m||!t.isValid(g)||!t.isValid(A))throw new Error("invalid affine point");if(m instanceof u)throw new Error("projective point not allowed");const _=x=>t.eql(x,t.ZERO);return _(g)&&_(A)?u.ZERO:new u(g,A,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const g=t.invertBatch(m.map(A=>A.pz));return m.map((A,_)=>A.toAffine(g[_])).map(u.fromAffine)}static fromHex(m){const g=u.fromAffine(s(Ri("pointHex",m)));return g.assertValidity(),g}static fromPrivateKey(m){return u.BASE.multiply(c(m))}_setWindowSize(m){this._WINDOW_SIZE=m,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:g}=this.toAffine();if(!t.isValid(m)||!t.isValid(g))throw new Error("bad point: x or y not FE");const A=t.sqr(g),_=r(m);if(!t.eql(A,_))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(t.isOdd)return!t.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){h(m);const{px:g,py:A,pz:_}=this,{px:x,py:E,pz:S}=m,w=t.eql(t.mul(g,S),t.mul(x,_)),I=t.eql(t.mul(A,S),t.mul(E,_));return w&&I}negate(){return new u(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,A=t.mul(g,sb),{px:_,py:x,pz:E}=this;let S=t.ZERO,w=t.ZERO,I=t.ZERO,T=t.mul(_,_),C=t.mul(x,x),v=t.mul(E,E),F=t.mul(_,x);return F=t.add(F,F),I=t.mul(_,E),I=t.add(I,I),S=t.mul(m,I),w=t.mul(A,v),w=t.add(S,w),S=t.sub(C,w),w=t.add(C,w),w=t.mul(S,w),S=t.mul(F,S),I=t.mul(A,I),v=t.mul(m,v),F=t.sub(T,v),F=t.mul(m,F),F=t.add(F,I),I=t.add(T,T),T=t.add(I,T),T=t.add(T,v),T=t.mul(T,F),w=t.add(w,T),v=t.mul(x,E),v=t.add(v,v),T=t.mul(v,F),S=t.sub(S,T),I=t.mul(v,C),I=t.add(I,I),I=t.add(I,I),new u(S,w,I)}add(m){h(m);const{px:g,py:A,pz:_}=this,{px:x,py:E,pz:S}=m;let w=t.ZERO,I=t.ZERO,T=t.ZERO;const C=e.a,v=t.mul(e.b,sb);let F=t.mul(g,x),K=t.mul(A,E),q=t.mul(_,S),$=t.add(g,A),D=t.add(x,E);$=t.mul($,D),D=t.add(F,K),$=t.sub($,D),D=t.add(g,_);let O=t.add(x,S);return D=t.mul(D,O),O=t.add(F,q),D=t.sub(D,O),O=t.add(A,_),w=t.add(E,S),O=t.mul(O,w),w=t.add(K,q),O=t.sub(O,w),T=t.mul(C,D),w=t.mul(v,q),T=t.add(w,T),w=t.sub(K,T),T=t.add(K,T),I=t.mul(w,T),K=t.add(F,F),K=t.add(K,F),q=t.mul(C,q),D=t.mul(v,D),K=t.add(K,q),q=t.sub(F,q),q=t.mul(C,q),D=t.add(D,q),F=t.mul(K,D),I=t.add(I,F),F=t.mul(O,D),w=t.mul($,w),w=t.sub(w,F),F=t.mul($,K),T=t.mul(O,T),T=t.add(T,F),new u(w,I,T)}subtract(m){return this.add(m.negate())}is0(){return this.equals(u.ZERO)}wNAF(m){return f.wNAFCached(this,l,m,g=>{const A=t.invertBatch(g.map(_=>_.pz));return g.map((_,x)=>_.toAffine(A[x])).map(u.fromAffine)})}multiplyUnsafe(m){const g=u.ZERO;if(m===As)return g;if(o(m),m===pi)return this;const{endo:A}=e;if(!A)return f.unsafeLadder(this,m);let{k1neg:_,k1:x,k2neg:E,k2:S}=A.splitScalar(m),w=g,I=g,T=this;for(;x>As||S>As;)x&pi&&(w=w.add(T)),S&pi&&(I=I.add(T)),T=T.double(),x>>=pi,S>>=pi;return _&&(w=w.negate()),E&&(I=I.negate()),I=new u(t.mul(I.px,A.beta),I.py,I.pz),w.add(I)}multiply(m){o(m);let g=m,A,_;const{endo:x}=e;if(x){const{k1neg:E,k1:S,k2neg:w,k2:I}=x.splitScalar(g);let{p:T,f:C}=this.wNAF(S),{p:v,f:F}=this.wNAF(I);T=f.constTimeNegate(E,T),v=f.constTimeNegate(w,v),v=new u(t.mul(v.px,x.beta),v.py,v.pz),A=T.add(v),_=C.add(F)}else{const{p:E,f:S}=this.wNAF(g);A=E,_=S}return u.normalizeZ([A,_])[0]}multiplyAndAddUnsafe(m,g,A){const _=u.BASE,x=(S,w)=>w===As||w===pi||!S.equals(_)?S.multiplyUnsafe(w):S.multiply(w),E=x(this,g).add(x(m,A));return E.is0()?void 0:E}toAffine(m){const{px:g,py:A,pz:_}=this,x=this.is0();m==null&&(m=x?t.ONE:t.inv(_));const E=t.mul(g,m),S=t.mul(A,m),w=t.mul(_,m);if(x)return{x:t.ZERO,y:t.ZERO};if(!t.eql(w,t.ONE))throw new Error("invZ was invalid");return{x:E,y:S}}isTorsionFree(){const{h:m,isTorsionFree:g}=e;if(m===pi)return!0;if(g)return g(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:g}=e;return m===pi?this:g?g(u,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),n(u,this,m)}toHex(m=!0){return Ga(this.toRawBytes(m))}}u.BASE=new u(e.Gx,e.Gy,t.ONE),u.ZERO=new u(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,f=uN(u,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:r,isWithinCurveOrder:a}}function gN(i){const e=ib(i);return ic(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function mN(i){const e=gN(i),{Fp:t,n}=e,s=t.BYTES+1,r=2*t.BYTES+1;function a(D){return As<D&&D<t.ORDER}function o(D){return jn(D,n)}function c(D){return Xf(D,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:h,weierstrassEquation:u,isWithinCurveOrder:d}=AN({...e,toBytes(D,O,Y){const Q=O.toAffine(),J=t.toBytes(Q.x),ee=nc;return Y?ee(Uint8Array.from([O.hasEvenY()?2:3]),J):ee(Uint8Array.from([4]),J,t.toBytes(Q.y))},fromBytes(D){const O=D.length,Y=D[0],Q=D.subarray(1);if(O===s&&(Y===2||Y===3)){const J=Ir(Q);if(!a(J))throw new Error("Point is not on curve");const ee=u(J);let ae=t.sqrt(ee);const _e=(ae&pi)===pi;return(Y&1)===1!==_e&&(ae=t.neg(ae)),{x:J,y:ae}}else if(O===r&&Y===4){const J=t.fromBytes(Q.subarray(0,t.BYTES)),ee=t.fromBytes(Q.subarray(t.BYTES,2*t.BYTES));return{x:J,y:ee}}else throw new Error(`Point of length ${O} was invalid. Expected ${s} compressed bytes or ${r} uncompressed bytes`)}}),f=D=>Ga(Ha(D,e.nByteLength));function p(D){const O=n>>pi;return D>O}function m(D){return p(D)?o(-D):D}const g=(D,O,Y)=>Ir(D.slice(O,Y));class A{constructor(O,Y,Q){this.r=O,this.s=Y,this.recovery=Q,this.assertValidity()}static fromCompact(O){const Y=e.nByteLength;return O=Ri("compactSignature",O,Y*2),new A(g(O,0,Y),g(O,Y,2*Y))}static fromDER(O){const{r:Y,s:Q}=Mr.toSig(Ri("DER",O));return new A(Y,Q)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(O){return new A(this.r,this.s,O)}recoverPublicKey(O){const{r:Y,s:Q,recovery:J}=this,ee=I(Ri("msgHash",O));if(J==null||![0,1,2,3].includes(J))throw new Error("recovery id invalid");const ae=J===2||J===3?Y+e.n:Y;if(ae>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const _e=(J&1)===0?"02":"03",Me=l.fromHex(_e+f(ae)),se=c(ae),me=o(-ee*se),xe=o(Q*se),be=l.BASE.multiplyAndAddUnsafe(Me,me,xe);if(!be)throw new Error("point at infinify");return be.assertValidity(),be}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return tc(this.toDERHex())}toDERHex(){return Mr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return tc(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const _={isValidPrivateKey(D){try{return h(D),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const D=nb(e.n);return lN(e.randomBytes(D),e.n)},precompute(D=8,O=l.BASE){return O._setWindowSize(D),O.multiply(BigInt(3)),O}};function x(D,O=!0){return l.fromPrivateKey(D).toRawBytes(O)}function E(D){const O=D instanceof Uint8Array,Y=typeof D=="string",Q=(O||Y)&&D.length;return O?Q===s||Q===r:Y?Q===2*s||Q===2*r:D instanceof l}function S(D,O,Y=!0){if(E(D))throw new Error("first arg must be private key");if(!E(O))throw new Error("second arg must be public key");return l.fromHex(O).multiply(h(D)).toRawBytes(Y)}const w=e.bits2int||function(D){const O=Ir(D),Y=D.length*8-e.nBitLength;return Y>0?O>>BigInt(Y):O},I=e.bits2int_modN||function(D){return o(w(D))},T=qf(e.nBitLength);function C(D){if(typeof D!="bigint")throw new Error("bigint expected");if(!(As<=D&&D<T))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Ha(D,e.nByteLength)}function v(D,O,Y=F){if(["recovered","canonical"].some(et=>et in Y))throw new Error("sign() legacy options not supported");const{hash:Q,randomBytes:J}=e;let{lowS:ee,prehash:ae,extraEntropy:_e}=Y;ee==null&&(ee=!0),D=Ri("msgHash",D),ae&&(D=Ri("prehashed msgHash",Q(D)));const Me=I(D),se=h(O),me=[C(se),C(Me)];if(_e!=null){const et=_e===!0?J(t.BYTES):_e;me.push(Ri("extraEntropy",et))}const xe=nc(...me),be=Me;function Ue(et){const He=w(et);if(!d(He))return;const Mt=c(He),ft=l.BASE.multiply(He).toAffine(),$e=o(ft.x);if($e===As)return;const H=o(Mt*o(be+$e*se));if(H===As)return;let wn=(ft.x===$e?0:2)|Number(ft.y&pi),pt=H;return ee&&p(H)&&(pt=m(H),wn^=1),new A($e,pt,wn)}return{seed:xe,k2sig:Ue}}const F={lowS:e.lowS,prehash:!1},K={lowS:e.lowS,prehash:!1};function q(D,O,Y=F){const{seed:Q,k2sig:J}=v(D,O,Y),ee=e;return Jx(ee.hash.outputLen,ee.nByteLength,ee.hmac)(Q,J)}l.BASE._setWindowSize(8);function $(D,O,Y,Q=K){const J=D;if(O=Ri("msgHash",O),Y=Ri("publicKey",Y),"strict"in Q)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:ae}=Q;let _e,Me;try{if(typeof J=="string"||J instanceof Uint8Array)try{_e=A.fromDER(J)}catch(ft){if(!(ft instanceof Mr.Err))throw ft;_e=A.fromCompact(J)}else if(typeof J=="object"&&typeof J.r=="bigint"&&typeof J.s=="bigint"){const{r:ft,s:$e}=J;_e=new A(ft,$e)}else throw new Error("PARSE");Me=l.fromHex(Y)}catch(ft){if(ft.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&_e.hasHighS())return!1;ae&&(O=e.hash(O));const{r:se,s:me}=_e,xe=I(O),be=c(me),Ue=o(xe*be),et=o(se*be),He=l.BASE.multiplyAndAddUnsafe(Me,Ue,et)?.toAffine();return He?o(He.x)===se:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:S,sign:q,verify:$,ProjectivePoint:l,Signature:A,utils:_}}function xN(i){return{hash:i,hmac:(e,...t)=>Bx(i,e,mF(...t)),randomBytes:xF}}function bN(i,e){const t=n=>mN({...i,...xN(n)});return Object.freeze({...t(e),create:t})}const rb=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ab=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),EN=BigInt(1),Jf=BigInt(2),ob=(i,e)=>(i+e/Jf)/e;function yN(i){const e=rb,t=BigInt(3),n=BigInt(6),s=BigInt(11),r=BigInt(22),a=BigInt(23),o=BigInt(44),c=BigInt(88),l=i*i*i%e,h=l*l*i%e,u=fi(h,t,e)*h%e,d=fi(u,t,e)*h%e,f=fi(d,Jf,e)*l%e,p=fi(f,s,e)*f%e,m=fi(p,r,e)*p%e,g=fi(m,o,e)*m%e,A=fi(g,c,e)*g%e,_=fi(A,o,e)*m%e,x=fi(_,t,e)*h%e,E=fi(x,a,e)*p%e,S=fi(E,n,e)*l%e,w=fi(S,Jf,e);if(!Zf.eql(Zf.sqr(w),i))throw new Error("Cannot find square root");return w}const Zf=cN(rb,void 0,void 0,{sqrt:yN}),$s=bN({a:BigInt(0),b:BigInt(7),Fp:Zf,n:ab,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:i=>{const e=ab,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-EN*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),r=t,a=BigInt("0x100000000000000000000000000000000"),o=ob(r*i,e),c=ob(-n*i,e);let l=jn(i-o*t-c*s,e),h=jn(-o*n-c*r,e);const u=l>a,d=h>a;if(u&&(l=e-l),d&&(h=e-h),l>a||h>a)throw new Error("splitScalar: Endomorphism failed, k="+i);return{k1neg:u,k1:l,k2neg:d,k2:h}}}},Rx);BigInt(0),$s.ProjectivePoint;const sc="0x0000000000000000000000000000000000000000",cb="0x0000000000000000000000000000000000000000000000000000000000000000",lb=BigInt(0),hb=BigInt(1),$f=BigInt(2),ub=BigInt(27),db=BigInt(28),uh=BigInt(35),fb=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_N=fb/$f,wN=Symbol.for("nodejs.util.inspect.custom"),Br={};function ep(i){return hs(rn(i),32)}class Vt{#e;#t;#n;#i;get r(){return this.#e}set r(e){V(ka(e)===32,"invalid r","value",e),this.#e=Ce(e)}get s(){return V(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){V(ka(e)===32,"invalid s","value",e),this.#t=Ce(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=_N}get v(){return this.#n}set v(e){const t=dt(e,"value");V(t===27||t===28,"invalid v","v",e),this.#n=t}get networkV(){return this.#i}get legacyChainId(){const e=this.networkV;return e==null?null:Vt.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ut(this.s);return this.yParity&&(e[0]|=128),Ce(e)}get compactSerialized(){return Gt([this.r,this.yParityAndS])}get serialized(){return Gt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,n,s){th(e,Br,"Signature"),this.#e=t,this.#t=n,this.#n=s,this.#i=null}getCanonical(){if(this.isValid())return this;const e=fb-BigInt(this._s),t=55-this.v,n=new Vt(Br,this.r,ep(e),t);return this.networkV&&(n.#i=this.networkV),n}clone(){const e=new Vt(Br,this.r,this._s,this.v);return this.networkV&&(e.#i=this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this._s,v:this.v}}[wN](){return this.toString()}toString(){return this.isValid()?`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`:`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`}static getChainId(e){const t=Ne(e,"v");return t==ub||t==db?lb:(V(t>=uh,"invalid EIP-155 v","v",e),(t-uh)/$f)}static getChainIdV(e,t){return Ne(e)*$f+BigInt(35+t-27)}static getNormalizedV(e){const t=Ne(e);return t===lb||t===ub?27:t===hb||t===db?28:(V(t>=uh,"invalid v","v",e),t&hb?27:28)}static from(e){function t(l,h){V(l,h,"signature",e)}if(e==null)return new Vt(Br,cb,cb,27);if(typeof e=="string"){const l=ut(e,"signature");if(l.length===64){const h=Ce(l.slice(0,32)),u=l.slice(32,64),d=u[0]&128?28:27;return u[0]&=127,new Vt(Br,h,Ce(u),d)}if(l.length===65){const h=Ce(l.slice(0,32)),u=Ce(l.slice(32,64)),d=Vt.getNormalizedV(l[64]);return new Vt(Br,h,u,d)}t(!1,"invalid raw signature length")}if(e instanceof Vt)return e.clone();const n=e.r;t(n!=null,"missing r");const s=ep(n),r=(function(l,h){if(l!=null)return ep(l);if(h!=null){t(Pt(h,32),"invalid yParityAndS");const u=ut(h);return u[0]&=127,Ce(u)}t(!1,"missing s")})(e.s,e.yParityAndS),{networkV:a,v:o}=(function(l,h,u){if(l!=null){const d=Ne(l);return{networkV:d>=uh?d:void 0,v:Vt.getNormalizedV(d)}}if(h!=null)return t(Pt(h,32),"invalid yParityAndS"),{v:ut(h)[0]&128?28:27};if(u!=null){switch(dt(u,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")})(e.v,e.yParityAndS,e.yParity),c=new Vt(Br,s,r,o);return a&&(c.#i=a),t(e.yParity==null||dt(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}}class gs{#e;constructor(e){V(ka(e)===32,"invalid private key","privateKey","[REDACTED]"),this.#e=Ce(e)}get privateKey(){return this.#e}get publicKey(){return gs.computePublicKey(this.#e)}get compressedPublicKey(){return gs.computePublicKey(this.#e,!0)}sign(e){V(ka(e)===32,"invalid digest length","digest",e);const t=$s.sign(Hn(e),Hn(this.#e),{lowS:!0});return Vt.from({r:Ks(t.r,32),s:Ks(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=gs.computePublicKey(e);return Ce($s.getSharedSecret(Hn(this.#e),ut(t),!1))}static computePublicKey(e,t){let n=ut(e,"key");if(n.length===32){const r=$s.getPublicKey(n,!!t);return Ce(r)}if(n.length===64){const r=new Uint8Array(65);r[0]=4,r.set(n,1),n=r}const s=$s.ProjectivePoint.fromHex(n);return Ce(s.toRawBytes(t))}static recoverPublicKey(e,t){V(ka(e)===32,"invalid digest length","digest",e);const n=Vt.from(t);let s=$s.Signature.fromCompact(Hn(Gt([n.r,n.s])));s=s.addRecoveryBit(n.yParity);const r=s.recoverPublicKey(Hn(e));return V(r!=null,"invalid signature for digest","signature",t),"0x"+r.toHex(!1)}static addPoints(e,t,n){const s=$s.ProjectivePoint.fromHex(gs.computePublicKey(e).substring(2)),r=$s.ProjectivePoint.fromHex(gs.computePublicKey(t).substring(2));return"0x"+s.add(r).toHex(!!n)}}const vN=BigInt(0),CN=BigInt(36);function pb(i){i=i.toLowerCase();const e=i.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const n=ut(an(t));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(n[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const tp={};for(let i=0;i<10;i++)tp[String(i)]=String(i);for(let i=0;i<26;i++)tp[String.fromCharCode(65+i)]=String(10+i);const Ab=15;function IN(i){i=i.toUpperCase(),i=i.substring(4)+i.substring(0,2)+"00";let e=i.split("").map(n=>tp[n]).join("");for(;e.length>=Ab;){let n=e.substring(0,Ab);e=parseInt(n,10)%97+e.substring(n.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const SN=(function(){const i={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];i[t]=BigInt(e)}return i})();function MN(i){i=i.toLowerCase();let e=vN;for(let t=0;t<i.length;t++)e=e*CN+SN[i[t]];return e}function St(i){if(V(typeof i=="string","invalid address","address",i),i.match(/^(0x)?[0-9a-fA-F]{40}$/)){i.startsWith("0x")||(i="0x"+i);const e=pb(i);return V(!i.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===i,"bad address checksum","address",i),e}if(i.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){V(i.substring(2,4)===IN(i),"bad icap checksum","address",i);let e=MN(i.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return pb("0x"+e)}V(!1,"invalid address","address",i)}function BN(i){const e=St(i.from);let n=Ne(i.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,St(Kt(an(ds([e,n])),12))}function gb(i){return i&&typeof i.getAddress=="function"}async function np(i,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(pe(typeof i!="string","unconfigured name","UNCONFIGURED_NAME",{value:i}),V(!1,"invalid AddressLike value; did not resolve to a value address","target",i)),St(t)}function Vn(i,e){if(typeof i=="string")return i.match(/^0x[0-9a-f]{40}$/i)?St(i):(pe(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),np(i,e.resolveName(i)));if(gb(i))return np(i,i.getAddress());if(i&&typeof i.then=="function")return np(i,i);V(!1,"unsupported addressable value","target",i)}const ms={};function Be(i,e){let t=!1;return e<0&&(t=!0,e*=-1),new jt(ms,`${t?"":"u"}int${e}`,i,{signed:t,width:e})}function wt(i,e){return new jt(ms,`bytes${e||""}`,i,{size:e})}const mb=Symbol.for("_ethers_typed");class jt{type;value;#e;_typedSymbol;constructor(e,t,n,s){s==null&&(s=null),th(ms,e,"Typed"),Ye(this,{_typedSymbol:mb,type:t,value:n}),this.#e=s,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#e}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#e===!0?-1:this.#e===!1?this.value.length:null}static from(e,t){return new jt(ms,e,t)}static uint8(e){return Be(e,8)}static uint16(e){return Be(e,16)}static uint24(e){return Be(e,24)}static uint32(e){return Be(e,32)}static uint40(e){return Be(e,40)}static uint48(e){return Be(e,48)}static uint56(e){return Be(e,56)}static uint64(e){return Be(e,64)}static uint72(e){return Be(e,72)}static uint80(e){return Be(e,80)}static uint88(e){return Be(e,88)}static uint96(e){return Be(e,96)}static uint104(e){return Be(e,104)}static uint112(e){return Be(e,112)}static uint120(e){return Be(e,120)}static uint128(e){return Be(e,128)}static uint136(e){return Be(e,136)}static uint144(e){return Be(e,144)}static uint152(e){return Be(e,152)}static uint160(e){return Be(e,160)}static uint168(e){return Be(e,168)}static uint176(e){return Be(e,176)}static uint184(e){return Be(e,184)}static uint192(e){return Be(e,192)}static uint200(e){return Be(e,200)}static uint208(e){return Be(e,208)}static uint216(e){return Be(e,216)}static uint224(e){return Be(e,224)}static uint232(e){return Be(e,232)}static uint240(e){return Be(e,240)}static uint248(e){return Be(e,248)}static uint256(e){return Be(e,256)}static uint(e){return Be(e,256)}static int8(e){return Be(e,-8)}static int16(e){return Be(e,-16)}static int24(e){return Be(e,-24)}static int32(e){return Be(e,-32)}static int40(e){return Be(e,-40)}static int48(e){return Be(e,-48)}static int56(e){return Be(e,-56)}static int64(e){return Be(e,-64)}static int72(e){return Be(e,-72)}static int80(e){return Be(e,-80)}static int88(e){return Be(e,-88)}static int96(e){return Be(e,-96)}static int104(e){return Be(e,-104)}static int112(e){return Be(e,-112)}static int120(e){return Be(e,-120)}static int128(e){return Be(e,-128)}static int136(e){return Be(e,-136)}static int144(e){return Be(e,-144)}static int152(e){return Be(e,-152)}static int160(e){return Be(e,-160)}static int168(e){return Be(e,-168)}static int176(e){return Be(e,-176)}static int184(e){return Be(e,-184)}static int192(e){return Be(e,-192)}static int200(e){return Be(e,-200)}static int208(e){return Be(e,-208)}static int216(e){return Be(e,-216)}static int224(e){return Be(e,-224)}static int232(e){return Be(e,-232)}static int240(e){return Be(e,-240)}static int248(e){return Be(e,-248)}static int256(e){return Be(e,-256)}static int(e){return Be(e,-256)}static bytes1(e){return wt(e,1)}static bytes2(e){return wt(e,2)}static bytes3(e){return wt(e,3)}static bytes4(e){return wt(e,4)}static bytes5(e){return wt(e,5)}static bytes6(e){return wt(e,6)}static bytes7(e){return wt(e,7)}static bytes8(e){return wt(e,8)}static bytes9(e){return wt(e,9)}static bytes10(e){return wt(e,10)}static bytes11(e){return wt(e,11)}static bytes12(e){return wt(e,12)}static bytes13(e){return wt(e,13)}static bytes14(e){return wt(e,14)}static bytes15(e){return wt(e,15)}static bytes16(e){return wt(e,16)}static bytes17(e){return wt(e,17)}static bytes18(e){return wt(e,18)}static bytes19(e){return wt(e,19)}static bytes20(e){return wt(e,20)}static bytes21(e){return wt(e,21)}static bytes22(e){return wt(e,22)}static bytes23(e){return wt(e,23)}static bytes24(e){return wt(e,24)}static bytes25(e){return wt(e,25)}static bytes26(e){return wt(e,26)}static bytes27(e){return wt(e,27)}static bytes28(e){return wt(e,28)}static bytes29(e){return wt(e,29)}static bytes30(e){return wt(e,30)}static bytes31(e){return wt(e,31)}static bytes32(e){return wt(e,32)}static address(e){return new jt(ms,"address",e)}static bool(e){return new jt(ms,"bool",!!e)}static bytes(e){return new jt(ms,"bytes",e)}static string(e){return new jt(ms,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new jt(ms,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===mb}static dereference(e,t){if(jt.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}}class TN extends ps{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=jt.dereference(t,"string");try{n=St(n)}catch(s){return this._throwError(s.message,t)}return e.writeValue(n)}decode(e){return St(Ks(e.readValue(),20))}}class RN extends ps{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}function xb(i,e,t){let n=[];if(Array.isArray(t))n=t;else if(t&&typeof t=="object"){let c={};n=e.map(l=>{const h=l.localName;return pe(h,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),pe(!c[h],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),c[h]=!0,t[h]})}else V(!1,"invalid tuple value","tuple",t);V(e.length===n.length,"types/value length mismatch","tuple",t);let s=new Df,r=new Df,a=[];e.forEach((c,l)=>{let h=n[l];if(c.dynamic){let u=r.length;c.encode(r,h);let d=s.writeUpdatableValue();a.push(f=>{d(f+u)})}else c.encode(s,h)}),a.forEach(c=>{c(s.length)});let o=i.appendWriter(s);return o+=i.appendWriter(r),o}function bb(i,e){let t=[],n=[],s=i.subReader(0);return e.forEach(r=>{let a=null;if(r.dynamic){let o=i.readIndex(),c=s.subReader(o);try{a=r.decode(c)}catch(l){if(Tn(l,"BUFFER_OVERRUN"))throw l;a=l,a.baseType=r.name,a.name=r.localName,a.type=r.type}}else try{a=r.decode(i)}catch(o){if(Tn(o,"BUFFER_OVERRUN"))throw o;a=o,a.baseType=r.name,a.name=r.localName,a.type=r.type}if(a==null)throw new Error("investigate");t.push(a),n.push(r.localName||null)}),fs.fromItems(t,n)}class FN extends ps{coder;length;constructor(e,t,n){const s=e.type+"["+(t>=0?t:"")+"]",r=t===-1||e.dynamic;super("array",s,n,r),Ye(this,{coder:e,length:t})}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){const n=jt.dereference(t,"array");Array.isArray(n)||this._throwError("expected array value",n);let s=this.length;s===-1&&(s=n.length,e.writeValue(n.length)),tx(n.length,s,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let a=0;a<n.length;a++)r.push(this.coder);return xb(e,r,n)}decode(e){let t=this.length;t===-1&&(t=e.readIndex(),pe(t*zn<=e.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:e.bytes,offset:t*zn,length:e.dataLength}));let n=[];for(let s=0;s<t;s++)n.push(new RN(this.coder));return bb(e,n)}}class NN extends ps{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const n=jt.dereference(t,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class Eb extends ps{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Hn(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class DN extends Eb{constructor(e){super("bytes",e)}decode(e){return Ce(super.decode(e))}}class LN extends ps{size;constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),Ye(this,{size:e},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,t){let n=Hn(jt.dereference(t,this.type));return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return Ce(e.readBytes(this.size))}}const PN=new Uint8Array([]);class kN extends ps{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(PN)}decode(e){return e.readBytes(0),null}}const UN=BigInt(0),ON=BigInt(1),QN=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class GN extends ps{size;signed;constructor(e,t,n){const s=(t?"int":"uint")+e*8;super(s,s,n,!1),Ye(this,{size:e,signed:t},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(e,t){let n=Ne(jt.dereference(t,this.type)),s=Jo(QN,zn*8);if(this.signed){let r=Jo(s,this.size*8-1);(n>r||n<-(r+ON))&&this._throwError("value out-of-bounds",t),n=rx(n,8*zn)}else(n<UN||n>Jo(s,this.size*8))&&this._throwError("value out-of-bounds",t);return e.writeValue(n)}decode(e){let t=Jo(e.readValue(),this.size*8);return this.signed&&(t=XR(t,this.size*8)),t}}class HN extends Eb{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,us(jt.dereference(t,"string")))}decode(e){return ih(super.decode(e))}}class dh extends ps{coders;constructor(e,t){let n=!1;const s=[];e.forEach(a=>{a.dynamic&&(n=!0),s.push(a.type)});const r="tuple("+s.join(",")+")";super("tuple",r,t,n),Ye(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const t=this.coders.reduce((n,s)=>{const r=s.localName;return r&&(n[r]||(n[r]=0),n[r]++),n},{});return this.coders.forEach((n,s)=>{let r=n.localName;!r||t[r]!==1||(r==="length"&&(r="_length"),e[r]==null&&(e[r]=e[s]))}),Object.freeze(e)}encode(e,t){const n=jt.dereference(t,"tuple");return xb(e,this.coders,n)}decode(e){return bb(e,this.coders)}}function ip(i,e){return{address:St(i),storageKeys:e.map((t,n)=>(V(Pt(t,32),"invalid slot",`storageKeys[${n}]`,t),t.toLowerCase()))}}function Tr(i){if(Array.isArray(i))return i.map((t,n)=>Array.isArray(t)?(V(t.length===2,"invalid slot set",`value[${n}]`,t),ip(t[0],t[1])):(V(t!=null&&typeof t=="object","invalid address-slot set","value",i),ip(t.address,t.storageKeys)));V(i!=null&&typeof i=="object","invalid access list","value",i);const e=Object.keys(i).map(t=>{const n=i[t].reduce((s,r)=>(s[r]=!0,s),{});return ip(t,Object.keys(n).sort())});return e.sort((t,n)=>t.address.localeCompare(n.address)),e}function yb(i){return{address:St(i.address),nonce:Ne(i.nonce!=null?i.nonce:0),chainId:Ne(i.chainId!=null?i.chainId:0),signature:Vt.from(i.signature)}}function zN(i){let e;return typeof i=="string"?e=gs.computePublicKey(i,!1):e=i.publicKey,St(an("0x"+e.substring(4)).substring(26))}function VN(i,e){return zN(gs.recoverPublicKey(i,e))}const _n=BigInt(0),WN=BigInt(2),qN=BigInt(27),KN=BigInt(28),jN=BigInt(35),XN=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),YN=Symbol.for("nodejs.util.inspect.custom"),sp=4096*32,fh=128;function JN(i){return{blobToKzgCommitment:n=>{if("computeBlobProof"in i){if("blobToKzgCommitment"in i&&typeof i.blobToKzgCommitment=="function")return ut(i.blobToKzgCommitment(Ce(n)))}else if("blobToKzgCommitment"in i&&typeof i.blobToKzgCommitment=="function")return ut(i.blobToKzgCommitment(n));if("blobToKZGCommitment"in i&&typeof i.blobToKZGCommitment=="function")return ut(i.blobToKZGCommitment(Ce(n)));V(!1,"unsupported KZG library","kzg",i)},computeBlobKzgProof:(n,s)=>{if("computeBlobProof"in i&&typeof i.computeBlobProof=="function")return ut(i.computeBlobProof(Ce(n),Ce(s)));if("computeBlobKzgProof"in i&&typeof i.computeBlobKzgProof=="function")return i.computeBlobKzgProof(n,s);if("computeBlobKZGProof"in i&&typeof i.computeBlobKZGProof=="function")return ut(i.computeBlobKZGProof(Ce(n),Ce(s)));V(!1,"unsupported KZG library","kzg",i)}}}function _b(i,e){let t=i.toString(16);for(;t.length<2;)t="0"+t;return t+=Qa(e).substring(4),"0x"+t}function za(i){return i==="0x"?null:St(i)}function ph(i,e){try{return Tr(i)}catch(t){V(!1,t.message,e,i)}}function ZN(i,e){try{if(!Array.isArray(i))throw new Error("authorizationList: invalid array");const t=[];for(let n=0;n<i.length;n++){const s=i[n];if(!Array.isArray(s))throw new Error(`authorization[${n}]: invalid array`);if(s.length!==6)throw new Error(`authorization[${n}]: wrong length`);if(!s[1])throw new Error(`authorization[${n}]: null address`);t.push({address:za(s[1]),nonce:Nt(s[2],"nonce"),chainId:Nt(s[0],"chainId"),signature:Vt.from({yParity:Rr(s[3],"yParity"),r:hs(s[4],32),s:hs(s[5],32)})})}return t}catch(t){V(!1,t.message,e,i)}}function Rr(i,e){return i==="0x"?0:dt(i,e)}function Nt(i,e){if(i==="0x")return _n;const t=Ne(i,e);return V(t<=XN,"value exceeds uint size",e,t),t}function xt(i,e){const t=Ne(i,"value"),n=rn(t);return V(n.length<=32,"value too large",`tx.${e}`,t),n}function Ah(i){return Tr(i).map(e=>[e.address,e.storageKeys])}function $N(i){return i.map(e=>[xt(e.chainId,"chainId"),e.address,xt(e.nonce,"nonce"),xt(e.signature.yParity,"yParity"),rn(e.signature.r),rn(e.signature._s)])}function eD(i,e){V(Array.isArray(i),`invalid ${e}`,"value",i);for(let t=0;t<i.length;t++)V(Pt(i[t],32),"invalid ${ param } hash",`value[${t}]`,i[t]);return i}function tD(i){const e=Zo(i);V(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",i);const t={type:0,nonce:Rr(e[0],"nonce"),gasPrice:Nt(e[1],"gasPrice"),gasLimit:Nt(e[2],"gasLimit"),to:za(e[3]),value:Nt(e[4],"value"),data:Ce(e[5]),chainId:_n};if(e.length===6)return t;const n=Nt(e[6],"v"),s=Nt(e[7],"r"),r=Nt(e[8],"s");if(s===_n&&r===_n)t.chainId=n;else{let a=(n-jN)/WN;a<_n&&(a=_n),t.chainId=a,V(a!==_n||n===qN||n===KN,"non-canonical legacy v","v",e[6]),t.signature=Vt.from({r:hs(e[7],32),s:hs(e[8],32),v:n})}return t}function nD(i,e){const t=[xt(i.nonce,"nonce"),xt(i.gasPrice||0,"gasPrice"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data];let n=_n;if(i.chainId!=_n)n=Ne(i.chainId,"tx.chainId"),V(!e||e.networkV==null||e.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",e);else if(i.signature){const r=i.signature.legacyChainId;r!=null&&(n=r)}if(!e)return n!==_n&&(t.push(rn(n)),t.push("0x"),t.push("0x")),ds(t);let s=BigInt(27+e.yParity);return n!==_n?s=Vt.getChainIdV(n,e.v):BigInt(e.v)!==s&&V(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(rn(s)),t.push(rn(e.r)),t.push(rn(e._s)),ds(t)}function gh(i,e){let t;try{if(t=Rr(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{V(!1,"invalid yParity","yParity",e[0])}const n=hs(e[1],32),s=hs(e[2],32),r=Vt.from({r:n,s,yParity:t});i.signature=r}function iD(i){const e=Zo(ut(i).slice(1));V(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Ce(i));const t={type:2,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),maxPriorityFeePerGas:Nt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Nt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Nt(e[4],"gasLimit"),to:za(e[5]),value:Nt(e[6],"value"),data:Ce(e[7]),accessList:ph(e[8],"accessList")};return e.length===9||gh(t,e.slice(9)),t}function sD(i,e){const t=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),xt(i.maxFeePerGas||0,"maxFeePerGas"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data,Ah(i.accessList||[])];return e&&(t.push(xt(e.yParity,"yParity")),t.push(rn(e.r)),t.push(rn(e.s))),Gt(["0x02",ds(t)])}function rD(i){const e=Zo(ut(i).slice(1));V(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Ce(i));const t={type:1,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),gasPrice:Nt(e[2],"gasPrice"),gasLimit:Nt(e[3],"gasLimit"),to:za(e[4]),value:Nt(e[5],"value"),data:Ce(e[6]),accessList:ph(e[7],"accessList")};return e.length===8||gh(t,e.slice(8)),t}function aD(i,e){const t=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.gasPrice||0,"gasPrice"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data,Ah(i.accessList||[])];return e&&(t.push(xt(e.yParity,"recoveryParam")),t.push(rn(e.r)),t.push(rn(e.s))),Gt(["0x01",ds(t)])}function oD(i){let e=Zo(ut(i).slice(1)),t="3",n=null,s=null;if(e.length===4&&Array.isArray(e[0])){t="3 (network format)";const a=e[1],o=e[2],c=e[3];V(Array.isArray(a),"invalid network format: blobs not an array","fields[1]",a),V(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),V(Array.isArray(c),"invalid network format: proofs not an array","fields[3]",c),V(a.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),V(a.length===c.length,"invalid network format: blobs/proofs length mismatch","fields",e),s=[];for(let l=0;l<e[1].length;l++)s.push({data:a[l],commitment:o[l],proof:c[l]});e=e[0]}else if(e.length===5&&Array.isArray(e[0])){t="3 (EIP-7594 network format)",n=dt(e[1]);const a=e[2],o=e[3],c=e[4];V(n===1,`unsupported EIP-7594 network format version: ${n}`,"fields[1]",n),V(Array.isArray(a),"invalid EIP-7594 network format: blobs not an array","fields[2]",a),V(Array.isArray(o),"invalid EIP-7594 network format: commitments not an array","fields[3]",o),V(Array.isArray(c),"invalid EIP-7594 network format: proofs not an array","fields[4]",c),V(a.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),V(a.length*fh===c.length,"invalid network format: blobs/proofs length mismatch","fields",e),s=[];for(let l=0;l<a.length;l++){const h=[];for(let u=0;u<fh;u++)h.push(c[l*fh+u]);s.push({data:a[l],commitment:o[l],proof:Gt(h)})}e=e[0]}V(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${t}`,"data",Ce(i));const r={type:3,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),maxPriorityFeePerGas:Nt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Nt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Nt(e[4],"gasLimit"),to:za(e[5]),value:Nt(e[6],"value"),data:Ce(e[7]),accessList:ph(e[8],"accessList"),maxFeePerBlobGas:Nt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10],blobWrapperVersion:n};s&&(r.blobs=s),V(r.to!=null,`invalid address for transaction type: ${t}`,"data",i),V(Array.isArray(r.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",i);for(let a=0;a<r.blobVersionedHashes.length;a++)V(Pt(r.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",i);return e.length===11||gh(r,e.slice(11)),r}function cD(i,e,t){const n=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),xt(i.maxFeePerGas||0,"maxFeePerGas"),xt(i.gasLimit,"gasLimit"),i.to||sc,xt(i.value,"value"),i.data,Ah(i.accessList||[]),xt(i.maxFeePerBlobGas||0,"maxFeePerBlobGas"),eD(i.blobVersionedHashes||[],"blobVersionedHashes")];if(e&&(n.push(xt(e.yParity,"yParity")),n.push(rn(e.r)),n.push(rn(e.s)),t)){if(i.blobWrapperVersion!=null){const s=rn(i.blobWrapperVersion),r=[];for(const{proof:a}of t){const o=ut(a),c=o.length/fh;for(let l=0;l<o.length;l+=c)r.push(o.subarray(l,l+c))}return Gt(["0x03",ds([n,s,t.map(a=>a.data),t.map(a=>a.commitment),r])])}return Gt(["0x03",ds([n,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])])}return Gt(["0x03",ds(n)])}function lD(i){const e=Zo(ut(i).slice(1));V(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",Ce(i));const t={type:4,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),maxPriorityFeePerGas:Nt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Nt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Nt(e[4],"gasLimit"),to:za(e[5]),value:Nt(e[6],"value"),data:Ce(e[7]),accessList:ph(e[8],"accessList"),authorizationList:ZN(e[9],"authorizationList")};return e.length===10||gh(t,e.slice(10)),t}function hD(i,e){const t=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),xt(i.maxFeePerGas||0,"maxFeePerGas"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data,Ah(i.accessList||[]),$N(i.authorizationList||[])];return e&&(t.push(xt(e.yParity,"yParity")),t.push(rn(e.r)),t.push(rn(e.s))),Gt(["0x04",ds(t)])}class Fi{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;#c;#h;#u;#d;#x;#g;get type(){return this.#e}set type(e){switch(e){case null:this.#e=null;break;case 0:case"legacy":this.#e=0;break;case 1:case"berlin":case"eip-2930":this.#e=1;break;case 2:case"london":case"eip-1559":this.#e=2;break;case 3:case"cancun":case"eip-4844":this.#e=3;break;case 4:case"pectra":case"eip-7702":this.#e=4;break;default:V(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const e=this.#t;return e==null&&this.type===3?sc:e}set to(e){this.#t=e==null?null:St(e)}get nonce(){return this.#i}set nonce(e){this.#i=dt(e,"value")}get gasLimit(){return this.#s}set gasLimit(e){this.#s=Ne(e)}get gasPrice(){const e=this.#a;return e==null&&(this.type===0||this.type===1)?_n:e}set gasPrice(e){this.#a=e==null?null:Ne(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#r;return e??(this.type===2||this.type===3?_n:null)}set maxPriorityFeePerGas(e){this.#r=e==null?null:Ne(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#o;return e??(this.type===2||this.type===3?_n:null)}set maxFeePerGas(e){this.#o=e==null?null:Ne(e,"maxFeePerGas")}get data(){return this.#n}set data(e){this.#n=Ce(e)}get value(){return this.#f}set value(e){this.#f=Ne(e,"value")}get chainId(){return this.#l}set chainId(e){this.#l=Ne(e)}get signature(){return this.#p||null}set signature(e){this.#p=e==null?null:Vt.from(e)}isValid(){const e=this.signature;if(e&&!e.isValid())return!1;const t=this.authorizationList;if(t){for(const n of t)if(!n.signature.isValid())return!1}return!0}get accessList(){const e=this.#A||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){this.#A=e==null?null:Tr(e)}get authorizationList(){const e=this.#x||null;return e==null&&this.type===4?[]:e}set authorizationList(e){this.#x=e==null?null:e.map(t=>yb(t))}get maxFeePerBlobGas(){const e=this.#c;return e==null&&this.type===3?_n:e}set maxFeePerBlobGas(e){this.#c=e==null?null:Ne(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#h;return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){V(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)V(Pt(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}this.#h=e}get blobs(){return this.#d==null?null:this.#d.map(e=>Object.assign({},e))}set blobs(e){if(e==null){this.#d=null;return}const t=[],n=[];for(let s=0;s<e.length;s++){const r=e[s];if(Bf(r)){pe(this.#u,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let a=ut(r);if(V(a.length<=sp,"blob is too large",`blobs[${s}]`,r),a.length!==sp){const l=new Uint8Array(sp);l.set(a),a=l}const o=this.#u.blobToKzgCommitment(a),c=Ce(this.#u.computeBlobKzgProof(a,o));t.push({data:Ce(a),commitment:Ce(o),proof:c}),n.push(_b(1,o))}else{const a=Ce(r.data),o=Ce(r.commitment),c=Ce(r.proof);t.push({data:a,commitment:o,proof:c}),n.push(_b(1,o))}}this.#d=t,this.#h=n}get kzg(){return this.#u}set kzg(e){e==null?this.#u=null:this.#u=JN(e)}get blobWrapperVersion(){return this.#g}set blobWrapperVersion(e){this.#g=e}constructor(){this.#e=null,this.#t=null,this.#i=0,this.#s=_n,this.#a=null,this.#r=null,this.#o=null,this.#n="0x",this.#f=_n,this.#l=_n,this.#p=null,this.#A=null,this.#c=null,this.#h=null,this.#u=null,this.#d=null,this.#x=null,this.#g=null}get hash(){return this.signature==null?null:an(this.#m(!0,!1))}get unsignedHash(){return an(this.unsignedSerialized)}get from(){return this.signature==null?null:VN(this.unsignedHash,this.signature.getCanonical())}get fromPublicKey(){return this.signature==null?null:gs.recoverPublicKey(this.unsignedHash,this.signature.getCanonical())}isSigned(){return this.signature!=null}#m(e,t){pe(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return nD(this,n);case 1:return aD(this,n);case 2:return sD(this,n);case 3:return cD(this,n,t?this.blobs:null);case 4:return hD(this,n)}pe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#m(!0,!0)}get unsignedSerialized(){return this.#m(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,s=this.#c!=null||this.#h;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&pe(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),pe(!t||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),pe(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const r=[];return this.type!=null?r.push(this.type):this.authorizationList&&this.authorizationList.length?r.push(4):t?r.push(2):e?(r.push(1),n||r.push(0)):n?(r.push(1),r.push(2)):(s&&this.to||(r.push(0),r.push(1),r.push(2)),r.push(3)),r.sort(),r}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Fi.from(this)}toJSON(){const e=t=>t==null?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}[YN](){return this.toString()}toString(){const e=[],t=s=>{let r=this[s];typeof r=="string"&&(r=JSON.stringify(r)),e.push(`${s}: ${r}`)};this.type&&t("type"),t("to"),t("data"),t("nonce"),t("gasLimit"),t("value"),this.chainId!=null&&t("chainId"),this.signature&&(t("from"),e.push(`signature: ${this.signature.toString()}`));const n=this.authorizationList;if(n){const s=[];for(const r of n){const a=[];a.push(`address: ${JSON.stringify(r.address)}`),r.nonce!=null&&a.push(`nonce: ${r.nonce}`),r.chainId!=null&&a.push(`chainId: ${r.chainId}`),r.signature&&a.push(`signature: ${r.signature.toString()}`),s.push(`Authorization { ${a.join(", ")} }`)}e.push(`authorizations: [ ${s.join(", ")} ]`)}return`Transaction { ${e.join(", ")} }`}static from(e){if(e==null)return new Fi;if(typeof e=="string"){const n=ut(e);if(n[0]>=127)return Fi.from(tD(n));switch(n[0]){case 1:return Fi.from(rD(n));case 2:return Fi.from(iD(n));case 3:return Fi.from(oD(n));case 4:return Fi.from(lD(n))}pe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Fi;return e.type!=null&&(t.type=e.type),e.to!=null&&(t.to=e.to),e.nonce!=null&&(t.nonce=e.nonce),e.gasLimit!=null&&(t.gasLimit=e.gasLimit),e.gasPrice!=null&&(t.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(t.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(t.data=e.data),e.value!=null&&(t.value=e.value),e.chainId!=null&&(t.chainId=e.chainId),e.signature!=null&&(t.signature=Vt.from(e.signature)),e.accessList!=null&&(t.accessList=e.accessList),e.authorizationList!=null&&(t.authorizationList=e.authorizationList),e.blobVersionedHashes!=null&&(t.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(t.kzg=e.kzg),e.blobWrapperVersion!=null&&(t.blobWrapperVersion=e.blobWrapperVersion),e.blobs!=null&&(t.blobs=e.blobs),e.hash!=null&&(V(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),V(t.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(V(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),V(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}}function Fr(i){return an(us(i))}var uD="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhE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WkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const wb=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),vb=4;function dD(i){let e=0;function t(){return i[e++]<<8|i[e++]}let n=t(),s=1,r=[0,1];for(let S=1;S<n;S++)r.push(s+=t());let a=t(),o=e;e+=a;let c=0,l=0;function h(){return c==0&&(l=l<<8|i[e++],c=8),l>>--c&1}const u=31,d=2**u,f=d>>>1,p=f>>1,m=d-1;let g=0;for(let S=0;S<u;S++)g=g<<1|h();let A=[],_=0,x=d;for(;;){let S=Math.floor(((g-_+1)*s-1)/x),w=0,I=n;for(;I-w>1;){let v=w+I>>>1;S<r[v]?I=v:w=v}if(w==0)break;A.push(w);let T=_+Math.floor(x*r[w]/s),C=_+Math.floor(x*r[w+1]/s)-1;for(;((T^C)&f)==0;)g=g<<1&m|h(),T=T<<1&m,C=C<<1&m|1;for(;T&~C&p;)g=g&f|g<<1&m>>>1|h(),T=T<<1^f,C=(C^f)<<1|f|1;_=T,x=1+C-T}let E=n-4;return A.map(S=>{switch(S-E){case 3:return E+65792+(i[o++]<<16|i[o++]<<8|i[o++]);case 2:return E+256+(i[o++]<<8|i[o++]);case 1:return E+i[o++];default:return S-1}})}function fD(i){let e=0;return()=>i[e++]}function Cb(i){return fD(dD(pD(i)))}function pD(i){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,r)=>e[s.charCodeAt(0)]=r);let t=i.length,n=new Uint8Array(6*t>>3);for(let s=0,r=0,a=0,o=0;s<t;s++)o=o<<6|e[i.charCodeAt(s)],a+=6,a>=8&&(n[r++]=o>>(a-=8));return n}function AD(i){return i&1?~i>>1:i>>1}function gD(i,e){let t=Array(i);for(let n=0,s=0;n<i;n++)t[n]=s+=AD(e());return t}function rc(i,e=0){let t=[];for(;;){let n=i(),s=i();if(!s)break;e+=n;for(let r=0;r<s;r++)t.push(e+r);e+=s+1}return t}function Ib(i){return ac(()=>{let e=rc(i);if(e.length)return e})}function Sb(i){let e=[];for(;;){let t=i();if(t==0)break;e.push(mD(t,i))}for(;;){let t=i()-1;if(t<0)break;e.push(xD(t,i))}return e.flat()}function ac(i){let e=[];for(;;){let t=i(e.length);if(!t)break;e.push(t)}return e}function Mb(i,e,t){let n=Array(i).fill().map(()=>[]);for(let s=0;s<e;s++)gD(i,t).forEach((r,a)=>n[a].push(r));return n}function mD(i,e){let t=1+e(),n=e(),s=ac(e);return Mb(s.length,1+i,e).flatMap((a,o)=>{let[c,...l]=a;return Array(s[o]).fill().map((h,u)=>{let d=u*n;return[c+u*t,l.map(f=>f+d)]})})}function xD(i,e){let t=1+e();return Mb(t,1+i,e).map(s=>[s[0],s.slice(1)])}function bD(i){let e=[],t=rc(i);return s(n([]),[]),e;function n(r){let a=i(),o=ac(()=>{let c=rc(i).map(l=>t[l]);if(c.length)return n(c)});return{S:a,B:o,Q:r}}function s({S:r,B:a},o,c){if(!(r&4&&c===o[o.length-1])){r&2&&(c=o[o.length-1]),r&1&&e.push(o);for(let l of a)for(let h of l.Q)s(l,[...o,h],c)}}}function ED(i){return i.toString(16).toUpperCase().padStart(2,"0")}function Bb(i){return`{${ED(i)}}`}function yD(i){let e=[];for(let t=0,n=i.length;t<n;){let s=i.codePointAt(t);t+=s<65536?1:2,e.push(s)}return e}function Va(i){let t=i.length;if(t<4096)return String.fromCodePoint(...i);let n=[];for(let s=0;s<t;)n.push(String.fromCodePoint(...i.slice(s,s+=4096)));return n.join("")}function _D(i,e){let t=i.length,n=t-e.length;for(let s=0;n==0&&s<t;s++)n=i[s]-e[s];return n}var wD="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsV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Kg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";const oc=44032,mh=4352,xh=4449,bh=4519,Tb=19,Rb=21,Wa=28,Eh=Rb*Wa,vD=Tb*Eh,CD=oc+vD,ID=mh+Tb,SD=xh+Rb,MD=bh+Wa;function cc(i){return i>>24&255}function Fb(i){return i&16777215}let rp,Nb,ap,yh;function BD(){let i=Cb(wD);rp=new Map(Ib(i).flatMap((e,t)=>e.map(n=>[n,t+1<<24]))),Nb=new Set(rc(i)),ap=new Map,yh=new Map;for(let[e,t]of Sb(i)){if(!Nb.has(e)&&t.length==2){let[n,s]=t,r=yh.get(n);r||(r=new Map,yh.set(n,r)),r.set(s,e)}ap.set(e,t.reverse())}}function Db(i){return i>=oc&&i<CD}function TD(i,e){if(i>=mh&&i<ID&&e>=xh&&e<SD)return oc+(i-mh)*Eh+(e-xh)*Wa;if(Db(i)&&e>bh&&e<MD&&(i-oc)%Wa==0)return i+(e-bh);{let t=yh.get(i);return t&&(t=t.get(e),t)?t:-1}}function Lb(i){rp||BD();let e=[],t=[],n=!1;function s(r){let a=rp.get(r);a&&(n=!0,r|=a),e.push(r)}for(let r of i)for(;;){if(r<128)e.push(r);else if(Db(r)){let a=r-oc,o=a/Eh|0,c=a%Eh/Wa|0,l=a%Wa;s(mh+o),s(xh+c),l>0&&s(bh+l)}else{let a=ap.get(r);a?t.push(...a):s(r)}if(!t.length)break;r=t.pop()}if(n&&e.length>1){let r=cc(e[0]);for(let a=1;a<e.length;a++){let o=cc(e[a]);if(o==0||r<=o){r=o;continue}let c=a-1;for(;;){let l=e[c+1];if(e[c+1]=e[c],e[c]=l,!c||(r=cc(e[--c]),r<=o))break}r=cc(e[a])}}return e}function RD(i){let e=[],t=[],n=-1,s=0;for(let r of i){let a=cc(r),o=Fb(r);if(n==-1)a==0?n=o:e.push(o);else if(s>0&&s>=a)a==0?(e.push(n,...t),t.length=0,n=o):t.push(o),s=a;else{let c=TD(n,o);c>=0?n=c:s==0&&a==0?(e.push(n),n=o):(t.push(o),s=a)}}return n>=0&&e.push(n,...t),e}function Pb(i){return Lb(i).map(Fb)}function FD(i){return RD(Lb(i))}const kb=45,Ub=".",Ob=65039,Qb=1,_h=i=>Array.from(i);function lc(i,e){return i.P.has(e)||i.Q.has(e)}class ND extends Array{get is_emoji(){return!0}}let op,Gb,Nr,cp,Hb,qa,lp,Ka,Dr,zb,hp;function up(){if(op)return;let i=Cb(uD);const e=()=>rc(i),t=()=>new Set(e()),n=(h,u)=>u.forEach(d=>h.add(d));op=new Map(Sb(i)),Gb=t(),Nr=e(),cp=new Set(e().map(h=>Nr[h])),Nr=new Set(Nr),Hb=t(),t();let s=Ib(i),r=i();const a=()=>{let h=new Set;return e().forEach(u=>n(h,s[u])),n(h,e()),h};qa=ac(h=>{let u=ac(i).map(d=>d+96);if(u.length){let d=h>=r;u[0]-=32,u=Va(u),d&&(u=`Restricted[${u}]`);let f=a(),p=a(),m=!i();return{N:u,P:f,Q:p,M:m,R:d}}}),lp=t(),Ka=new Map;let o=e().concat(_h(lp)).sort((h,u)=>h-u);o.forEach((h,u)=>{let d=i(),f=o[u]=d?o[u-d]:{V:[],M:new Map};f.V.push(h),lp.has(h)||Ka.set(h,f)});for(let{V:h,M:u}of new Set(Ka.values())){let d=[];for(let p of h){let m=qa.filter(A=>lc(A,p)),g=d.find(({G:A})=>m.some(_=>A.has(_)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),n(g.G,m)}let f=d.flatMap(p=>_h(p.G));for(let{G:p,V:m}of d){let g=new Set(f.filter(A=>!p.has(A)));for(let A of m)u.set(A,g)}}Dr=new Set;let c=new Set;const l=h=>Dr.has(h)?c.add(h):Dr.add(h);for(let h of qa){for(let u of h.P)l(u);for(let u of h.Q)l(u)}for(let h of Dr)!Ka.has(h)&&!c.has(h)&&Ka.set(h,Qb);n(Dr,Pb(Dr)),zb=bD(i).map(h=>ND.from(h)).sort(_D),hp=new Map;for(let h of zb){let u=[hp];for(let d of h){let f=u.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===Ob?u.push(...f):u=f}for(let d of u)d.V=h}}function dp(i){return(Vb(i)?"":`${fp(wh([i]))} `)+Bb(i)}function fp(i){return`"${i}"‎`}function DD(i){if(i.length>=4&&i[2]==kb&&i[3]==kb)throw new Error(`invalid label extension: "${Va(i.slice(0,4))}"`)}function LD(i){for(let t=i.lastIndexOf(95);t>0;)if(i[--t]!==95)throw new Error("underscore allowed only at start")}function PD(i){let e=i[0],t=wb.get(e);if(t)throw hc(`leading ${t}`);let n=i.length,s=-1;for(let r=1;r<n;r++){e=i[r];let a=wb.get(e);if(a){if(s==r)throw hc(`${t} + ${a}`);s=r+1,t=a}}if(s==n)throw hc(`trailing ${t}`)}function wh(i,e=1/0,t=Bb){let n=[];kD(i[0])&&n.push("◌"),i.length>e&&(e>>=1,i=[...i.slice(0,e),8230,...i.slice(-e)]);let s=0,r=i.length;for(let a=0;a<r;a++){let o=i[a];Vb(o)&&(n.push(Va(i.slice(s,a))),n.push(t(o)),s=a+1)}return n.push(Va(i.slice(s,r))),n.join("")}function kD(i){return up(),Nr.has(i)}function Vb(i){return up(),Hb.has(i)}function UD(i){return HD(OD(i,FD,WD))}function OD(i,e,t){if(!i)return[];up();let n=0;return i.split(Ub).map(s=>{let r=yD(s),a={input:r,offset:n};n+=r.length+1;try{let o=a.tokens=VD(r,e,t),c=o.length,l;if(!c)throw new Error("empty label");let h=a.output=o.flat();if(LD(h),!(a.emoji=c>1||o[0].is_emoji)&&h.every(d=>d<128))DD(h),l="ASCII";else{let d=o.flatMap(f=>f.is_emoji?[]:f);if(!d.length)l="Emoji";else{if(Nr.has(h[0]))throw hc("leading combining mark");for(let m=1;m<c;m++){let g=o[m];if(!g.is_emoji&&Nr.has(g[0]))throw hc(`emoji + combining mark: "${Va(o[m-1])} + ${wh([g[0]])}"`)}PD(h);let f=_h(new Set(d)),[p]=GD(f);zD(p,d),QD(p,f),l=p.N}}a.type=l}catch(o){a.error=o}return a})}function QD(i,e){let t,n=[];for(let s of e){let r=Ka.get(s);if(r===Qb)return;if(r){let a=r.M.get(s);if(t=t?t.filter(o=>a.has(o)):_h(a),!t.length)return}else n.push(s)}if(t){for(let s of t)if(n.every(r=>lc(s,r)))throw new Error(`whole-script confusable: ${i.N}/${s.N}`)}}function GD(i){let e=qa;for(let t of i){let n=e.filter(s=>lc(s,t));if(!n.length)throw qa.some(s=>lc(s,t))?qb(e[0],t):Wb(t);if(e=n,n.length==1)break}return e}function HD(i){return i.map(({input:e,error:t,output:n})=>{if(t){let s=t.message;throw new Error(i.length==1?s:`Invalid label ${fp(wh(e,63))}: ${s}`)}return Va(n)}).join(Ub)}function Wb(i){return new Error(`disallowed character: ${dp(i)}`)}function qb(i,e){let t=dp(e),n=qa.find(s=>s.P.has(e));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${i.N} + ${t}`)}function hc(i){return new Error(`illegal placement: ${i}`)}function zD(i,e){for(let t of e)if(!lc(i,t))throw qb(i,t);if(i.M){let t=Pb(e);for(let n=1,s=t.length;n<s;n++)if(cp.has(t[n])){let r=n+1;for(let a;r<s&&cp.has(a=t[r]);r++)for(let o=n;o<r;o++)if(t[o]==a)throw new Error(`duplicate non-spacing marks: ${dp(a)}`);if(r-n>vb)throw new Error(`excessive non-spacing marks: ${fp(wh(t.slice(n-1,r)))} (${r-n}/${vb})`);n=r}}}function VD(i,e,t){let n=[],s=[];for(i=i.slice().reverse();i.length;){let r=qD(i);if(r)s.length&&(n.push(e(s)),s=[]),n.push(t(r));else{let a=i.pop();if(Dr.has(a))s.push(a);else{let o=op.get(a);if(o)s.push(...o);else if(!Gb.has(a))throw Wb(a)}}}return s.length&&n.push(e(s)),n}function WD(i){return i.filter(e=>e!=Ob)}function qD(i,e){let t=hp,n,s=i.length;for(;s&&(t=t.get(i[--s]),!!t);){let{V:r}=t;r&&(n=r,i.length=s)}return n}const Kb=new Uint8Array(32);Kb.fill(0);function jb(i){return V(i.length!==0,"invalid ENS name; empty component","comp",i),i}function Xb(i){const e=us(KD(i)),t=[];if(i.length===0)return t;let n=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(jb(e.slice(n,s))),n=s+1);return V(n<e.length,"invalid ENS name; empty component","name",i),t.push(jb(e.slice(n))),t}function KD(i){try{if(i.length===0)throw new Error("empty label");return UD(i)}catch(e){V(!1,`invalid ENS name (${e.message})`,"name",i)}}function pp(i){V(typeof i=="string","invalid ENS name; not a string","name",i),V(i.length,"invalid ENS name (empty label)","name",i);let e=Kb;const t=Xb(i);for(;t.length;)e=an(Gt([e,an(t.pop())]));return Ce(e)}function jD(i,e){const t=e;return V(t<=255,"DNS encoded label cannot exceed 255","length",t),Ce(Gt(Xb(i).map(n=>{V(n.length<=t,`label ${JSON.stringify(i)} exceeds ${t} bytes`,"name",i);const s=new Uint8Array(n.length+1);return s.set(n,1),s[0]=s.length-1,s})))+"00"}const Yb=new Uint8Array(32);Yb.fill(0);const XD=BigInt(-1),Jb=BigInt(0),Zb=BigInt(1),YD=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function JD(i){const e=ut(i),t=e.length%32;return t?Gt([e,Yb.slice(t)]):Ce(e)}const ZD=Ks(Zb,32),$D=Ks(Jb,32),$b={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Ap=["name","version","chainId","verifyingContract","salt"];function eE(i){return function(e){return V(typeof e=="string",`invalid domain value for ${JSON.stringify(i)}`,`domain.${i}`,e),e}}const eL={name:eE("name"),version:eE("version"),chainId:function(i){const e=Ne(i,"domain.chainId");return V(e>=0,"invalid chain ID","domain.chainId",i),Number.isSafeInteger(e)?Number(e):Ti(e)},verifyingContract:function(i){try{return St(i).toLowerCase()}catch{}V(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",i)},salt:function(i){const e=ut(i,"domain.salt");return V(e.length===32,'invalid domain value "salt"',"domain.salt",i),Ce(e)}};function gp(i){{const e=i.match(/^(u?)int(\d+)$/);if(e){const t=e[1]==="",n=parseInt(e[2]);V(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",i);const s=Jo(YD,t?n-1:n),r=t?(s+Zb)*XD:Jb;return function(a){const o=Ne(a,"value");return V(o>=r&&o<=s,`value out-of-bounds for ${i}`,"value",o),Ks(t?rx(o,256):o,32)}}}{const e=i.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return V(t!==0&&t<=32&&e[1]===String(t),"invalid bytes width","type",i),function(n){const s=ut(n);return V(s.length===t,`invalid length for ${i}`,"value",n),JD(n)}}}switch(i){case"address":return function(e){return hs(St(e),32)};case"bool":return function(e){return e?ZD:$D};case"bytes":return function(e){return an(e)};case"string":return function(e){return Fr(e)}}return null}function tE(i,e){return`${i}(${e.map(({name:t,type:n})=>n+" "+t).join(",")})`}function vh(i){const e=i.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:i}}class ei{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#n;constructor(e){this.#t=new Map,this.#n=new Map;const t=new Map,n=new Map,s=new Map,r={};Object.keys(e).forEach(c=>{r[c]=e[c].map(({name:l,type:h})=>{let{base:u,index:d}=vh(h);return u==="int"&&!e.int&&(u="int256"),u==="uint"&&!e.uint&&(u="uint256"),{name:l,type:u+(d||"")}}),t.set(c,new Set),n.set(c,[]),s.set(c,new Set)}),this.#e=JSON.stringify(r);for(const c in r){const l=new Set;for(const h of r[c]){V(!l.has(h.name),`duplicate variable name ${JSON.stringify(h.name)} in ${JSON.stringify(c)}`,"types",e),l.add(h.name);const u=vh(h.type).base;V(u!==c,`circular type reference to ${JSON.stringify(u)}`,"types",e),!gp(u)&&(V(n.has(u),`unknown type ${JSON.stringify(u)}`,"types",e),n.get(u).push(c),t.get(c).add(u))}}const a=Array.from(n.keys()).filter(c=>n.get(c).length===0);V(a.length!==0,"missing primary type","types",e),V(a.length===1,`ambiguous primary types or unused types: ${a.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),Ye(this,{primaryType:a[0]});function o(c,l){V(!l.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),l.add(c);for(const h of t.get(c))if(n.has(h)){o(h,l);for(const u of l)s.get(u).add(h)}l.delete(c)}o(this.primaryType,new Set);for(const[c,l]of s){const h=Array.from(l);h.sort(),this.#t.set(c,tE(c,r[c])+h.map(u=>tE(u,r[u])).join(""))}}getEncoder(e){let t=this.#n.get(e);return t||(t=this.#i(e),this.#n.set(e,t)),t}#i(e){{const s=gp(e);if(s)return s}const t=vh(e).array;if(t){const s=t.prefix,r=this.getEncoder(s);return a=>{V(t.count===-1||t.count===a.length,`array length mismatch; expected length ${t.count}`,"value",a);let o=a.map(r);return this.#t.has(s)&&(o=o.map(an)),an(Gt(o))}}const n=this.types[e];if(n){const s=Fr(this.#t.get(e));return r=>{const a=n.map(({name:o,type:c})=>{const l=this.getEncoder(c)(r[o]);return this.#t.has(c)?an(l):l});return a.unshift(s),Gt(a)}}V(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const t=this.#t.get(e);return V(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return an(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(gp(e))return n(e,t);const s=vh(e).array;if(s)return V(s.count===-1||s.count===t.length,`array length mismatch; expected length ${s.count}`,"value",t),t.map(a=>this._visit(s.prefix,a,n));const r=this.types[e];if(r)return r.reduce((a,{name:o,type:c})=>(a[o]=this._visit(c,t[o],n),a),{});V(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ei(e)}static getPrimaryType(e){return ei.from(e).primaryType}static hashStruct(e,t,n){return ei.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){if(e[n]==null)continue;const s=$b[n];V(s,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:s})}return t.sort((n,s)=>Ap.indexOf(n.name)-Ap.indexOf(s.name)),ei.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return Gt(["0x1901",ei.hashDomain(e),ei.from(t).hash(n)])}static hash(e,t,n){return an(ei.encode(e,t,n))}static async resolveNames(e,t,n,s){e=Object.assign({},e);for(const o in e)e[o]==null&&delete e[o];const r={};e.verifyingContract&&!Pt(e.verifyingContract,20)&&(r[e.verifyingContract]="0x");const a=ei.from(t);a.visit(n,(o,c)=>(o==="address"&&!Pt(c,20)&&(r[c]="0x"),c));for(const o in r)r[o]=await s(o);return e.verifyingContract&&r[e.verifyingContract]&&(e.verifyingContract=r[e.verifyingContract]),n=a.visit(n,(o,c)=>o==="address"&&r[c]?r[c]:c),{domain:e,value:n}}static getPayload(e,t,n){ei.hashDomain(e);const s={},r=[];Ap.forEach(c=>{const l=e[c];l!=null&&(s[c]=eL[c](l),r.push({name:c,type:$b[c]}))});const a=ei.from(t);t=a.types;const o=Object.assign({},t);return V(o.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),o.EIP712Domain=r,a.encode(n),{types:o,domain:s,primaryType:a.primaryType,message:a.visit(n,(c,l)=>{if(c.match(/^bytes(\d*)/))return Ce(ut(l));if(c.match(/^u?int/))return Ne(l).toString();switch(c){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return V(typeof l=="string","invalid string","value",l),l}V(!1,"unsupported type","type",c)})}}}function Wn(i){const e=new Set;return i.forEach(t=>e.add(t)),Object.freeze(e)}const tL=Wn("external public payable override".split(" ")),nE="constant external internal payable private public pure view override",nL=Wn(nE.split(" ")),iE="constructor error event fallback function receive struct",sE=Wn(iE.split(" ")),rE="calldata memory storage payable indexed",iL=Wn(rE.split(" ")),sL=[iE,rE,"tuple returns",nE].join(" "),rL=Wn(sL.split(" ")),aL={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},oL=new RegExp("^(\\s*)"),cL=new RegExp("^([0-9]+)"),lL=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),aE=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),oE=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class Ai{#e;#t;get offset(){return this.#e}get length(){return this.#t.length-this.#e}constructor(e){this.#e=0,this.#t=e.slice()}clone(){return new Ai(this.#t)}reset(){this.#e=0}#n(e=0,t=0){return new Ai(this.#t.slice(e,t).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=this.#n(this.#e+1,e.match+1);return this.#e=e.match+1,t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;this.#e<e.match-1;){const n=this.peek().linkNext;t.push(this.#n(this.#e+1,n)),this.#e=n}return this.#e=e.match+1,t}peek(){if(this.#e>=this.#t.length)throw new Error("out-of-bounds");return this.#t[this.#e]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return this.#e++,e}toString(){const e=[];for(let t=this.#e;t<this.#t.length;t++){const n=this.#t[t];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}}function er(i){const e=[],t=a=>{const o=r<i.length?JSON.stringify(i[r]):"$EOI";throw new Error(`invalid token ${o} at ${r}: ${a}`)};let n=[],s=[],r=0;for(;r<i.length;){let a=i.substring(r),o=a.match(oL);o&&(r+=o[1].length,a=i.substring(r));const c={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:r,value:-1};e.push(c);let l=aL[a[0]]||"";if(l){if(c.type=l,c.text=a[0],r++,l==="OPEN_PAREN")n.push(e.length-1),s.push(e.length-1);else if(l=="CLOSE_PAREN")n.length===0&&t("no matching open bracket"),c.match=n.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if(l==="COMMA")c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(l==="OPEN_BRACKET")c.type="BRACKET";else if(l==="CLOSE_BRACKET"){let h=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const u=e.pop().text;h=u+h,e[e.length-1].value=dt(u)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=h}continue}if(o=a.match(lL),o){if(c.text=o[1],r+=c.text.length,rL.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(oE)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match(cL),o){c.text=o[1],c.type="NUMBER",r+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${r}`)}return new Ai(e.map(a=>Object.freeze(a)))}function cE(i,e){let t=[];for(const n in e.keys())i.has(n)&&t.push(n);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Ch(i,e){if(e.peekKeyword(sE)){const t=e.pop().text;if(t!==i)throw new Error(`expected ${i}, got ${t}`)}return e.popType("ID")}function xs(i,e){const t=new Set;for(;;){const n=i.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(i.pop(),t.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);t.add(n)}return Object.freeze(t)}function lE(i){let e=xs(i,nL);return cE(e,Wn("constant payable nonpayable".split(" "))),cE(e,Wn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function bs(i,e){return i.popParams().map(t=>kt.from(t,e))}function hE(i){if(i.peekType("AT")){if(i.pop(),i.peekType("NUMBER"))return Ne(i.pop().text);throw new Error("invalid gas")}return null}function Lr(i){if(i.length)throw new Error(`unexpected tokens at offset ${i.offset}: ${i.toString()}`)}const hL=new RegExp(/^(.*)\[([0-9]*)\]$/);function uE(i){const e=i.match(oE);if(V(e,"invalid type","type",i),i==="uint")return"uint256";if(i==="int")return"int256";if(e[2]){const t=parseInt(e[2]);V(t!==0&&t<=32,"invalid bytes length","type",i)}else if(e[3]){const t=parseInt(e[3]);V(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",i)}return i}const Wt={},Xn=Symbol.for("_ethers_internal"),dE="_ParamTypeInternal",fE="_ErrorInternal",pE="_EventInternal",AE="_ConstructorInternal",gE="_FallbackInternal",mE="_FunctionInternal",xE="_StructInternal";class kt{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,n,s,r,a,o,c){if(th(e,Wt,"ParamType"),Object.defineProperty(this,Xn,{value:dE}),a&&(a=Object.freeze(a.slice())),s==="array"){if(o==null||c==null)throw new Error("")}else if(o!=null||c!=null)throw new Error("");if(s==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");Ye(this,{name:t,type:n,baseType:s,indexed:r,components:a,arrayLength:o,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const r=JSON.parse(this.arrayChildren.format("json"));return r.name=n,r.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(r)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(r=>JSON.parse(r.format(e)))),JSON.stringify(s)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(s=>n.arrayChildren.walk(s,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((s,r)=>n.components[r].walk(s,t))}return t(this.type,e)}#e(e,t,n,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,o=t.slice();o.forEach((c,l)=>{a.#e(e,c,n,h=>{o[l]=h})}),s(o);return}if(this.isTuple()){const a=this.components;let o;if(Array.isArray(t))o=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");o=a.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in t))throw new Error(`missing value for component ${c.name}`);return t[c.name]})}if(o.length!==this.components.length)throw new Error("array is wrong length");o.forEach((c,l)=>{a[l].#e(e,c,n,h=>{o[l]=h})}),s(o);return}const r=n(this.type,t);r.then?e.push((async function(){s(await r)})()):s(r)}async walkAsync(e,t){const n=[],s=[e];return this.#e(n,e,t,r=>{s[0]=r}),n.length&&await Promise.all(n),s[0]}static from(e,t){if(kt.isParamType(e))return e;if(typeof e=="string")try{return kt.from(er(e),t)}catch{V(!1,"invalid param type","obj",e)}else if(e instanceof Ai){let o="",c="",l=null;xs(e,Wn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",l=e.popParams().map(m=>kt.from(m)),o=`tuple(${l.map(m=>m.format()).join(",")})`):(o=uE(e.popType("TYPE")),c=o);let h=null,u=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();h=new kt(Wt,"",o,c,null,l,u,h),u=m.value,o+=m.text,c="array",l=null}let d=null;if(xs(e,iL).has("indexed")){if(!t)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new kt(Wt,p,o,c,d,l,u,h)}const n=e.name;V(!n||typeof n=="string"&&n.match(aE),"invalid name","obj.name",n);let s=e.indexed;s!=null&&(V(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let r=e.type,a=r.match(hL);if(a){const o=parseInt(a[2]||"-1"),c=kt.from({type:a[1],components:e.components});return new kt(Wt,n||"",r,"array",s,null,o,c)}if(r==="tuple"||r.startsWith("tuple(")||r.startsWith("(")){const o=e.components!=null?e.components.map(l=>kt.from(l)):null;return new kt(Wt,n||"",r,"tuple",s,o,null,null)}return r=uE(e.type),new kt(Wt,n||"",r,r,s,null,null,null)}static isParamType(e){return e&&e[Xn]===dE}}class Pr{type;inputs;constructor(e,t,n){th(e,Wt,"Fragment"),n=Object.freeze(n.slice()),Ye(this,{type:t,inputs:n})}static from(e){if(typeof e=="string"){try{Pr.from(JSON.parse(e))}catch{}return Pr.from(er(e))}if(e instanceof Ai)switch(e.peekKeyword(sE)){case"constructor":return Es.from(e);case"error":return Yn.from(e);case"event":return Vi.from(e);case"fallback":case"receive":return ys.from(e);case"function":return Wi.from(e);case"struct":return kr.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Es.from(e);case"error":return Yn.from(e);case"event":return Vi.from(e);case"fallback":case"receive":return ys.from(e);case"function":return Wi.from(e);case"struct":return kr.from(e)}pe(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}V(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Es.isFragment(e)}static isError(e){return Yn.isFragment(e)}static isEvent(e){return Vi.isFragment(e)}static isFunction(e){return Wi.isFragment(e)}static isStruct(e){return kr.isFragment(e)}}class Ih extends Pr{name;constructor(e,t,n,s){super(e,t,s),V(typeof n=="string"&&n.match(aE),"invalid identifier","name",n),s=Object.freeze(s.slice()),Ye(this,{name:n})}}function uc(i,e){return"("+e.map(t=>t.format(i)).join(i==="full"?", ":",")+")"}class Yn extends Ih{constructor(e,t,n){super(e,"error",t,n),Object.defineProperty(this,Xn,{value:fE})}get selector(){return Fr(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+uc(e,this.inputs)),t.join(" ")}static from(e){if(Yn.isFragment(e))return e;if(typeof e=="string")return Yn.from(er(e));if(e instanceof Ai){const t=Ch("error",e),n=bs(e);return Lr(e),new Yn(Wt,t,n)}return new Yn(Wt,e.name,e.inputs?e.inputs.map(kt.from):[])}static isFragment(e){return e&&e[Xn]===fE}}class Vi extends Ih{anonymous;constructor(e,t,n,s){super(e,"event",t,n),Object.defineProperty(this,Xn,{value:pE}),Ye(this,{anonymous:s})}get topicHash(){return Fr(this.format("sighash"))}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("event"),t.push(this.name+uc(e,this.inputs)),e!=="sighash"&&this.anonymous&&t.push("anonymous"),t.join(" ")}static getTopicHash(e,t){return t=(t||[]).map(s=>kt.from(s)),new Vi(Wt,e,t,!1).topicHash}static from(e){if(Vi.isFragment(e))return e;if(typeof e=="string")try{return Vi.from(er(e))}catch{V(!1,"invalid event fragment","obj",e)}else if(e instanceof Ai){const t=Ch("event",e),n=bs(e,!0),s=!!xs(e,Wn(["anonymous"])).has("anonymous");return Lr(e),new Vi(Wt,t,n,s)}return new Vi(Wt,e.name,e.inputs?e.inputs.map(t=>kt.from(t,!0)):[],!!e.anonymous)}static isFragment(e){return e&&e[Xn]===pE}}class Es extends Pr{payable;gas;constructor(e,t,n,s,r){super(e,t,n),Object.defineProperty(this,Xn,{value:AE}),Ye(this,{payable:s,gas:r})}format(e){if(pe(e!=null&&e!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),e==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[`constructor${uc(e,this.inputs)}`];return this.payable&&t.push("payable"),this.gas!=null&&t.push(`@${this.gas.toString()}`),t.join(" ")}static from(e){if(Es.isFragment(e))return e;if(typeof e=="string")try{return Es.from(er(e))}catch{V(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof Ai){xs(e,Wn(["constructor"]));const t=bs(e),n=!!xs(e,tL).has("payable"),s=hE(e);return Lr(e),new Es(Wt,"constructor",t,n,s)}return new Es(Wt,"constructor",e.inputs?e.inputs.map(kt.from):[],!!e.payable,e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[Xn]===AE}}class ys extends Pr{payable;constructor(e,t,n){super(e,"fallback",t),Object.defineProperty(this,Xn,{value:gE}),Ye(this,{payable:n})}format(e){const t=this.inputs.length===0?"receive":"fallback";if(e==="json"){const n=this.payable?"payable":"nonpayable";return JSON.stringify({type:t,stateMutability:n})}return`${t}()${this.payable?" payable":""}`}static from(e){if(ys.isFragment(e))return e;if(typeof e=="string")try{return ys.from(er(e))}catch{V(!1,"invalid fallback fragment","obj",e)}else if(e instanceof Ai){const t=e.toString(),n=e.peekKeyword(Wn(["fallback","receive"]));if(V(n,"type must be fallback or receive","obj",t),e.popKeyword(Wn(["fallback","receive"]))==="receive"){const o=bs(e);return V(o.length===0,"receive cannot have arguments","obj.inputs",o),xs(e,Wn(["payable"])),Lr(e),new ys(Wt,[],!0)}let r=bs(e);r.length?V(r.length===1&&r[0].type==="bytes","invalid fallback inputs","obj.inputs",r.map(o=>o.format("minimal")).join(", ")):r=[kt.from("bytes")];const a=lE(e);if(V(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),xs(e,Wn(["returns"])).has("returns")){const o=bs(e);V(o.length===1&&o[0].type==="bytes","invalid fallback outputs","obj.outputs",o.map(c=>c.format("minimal")).join(", "))}return Lr(e),new ys(Wt,r,a==="payable")}if(e.type==="receive")return new ys(Wt,[],!0);if(e.type==="fallback"){const t=[kt.from("bytes")],n=e.stateMutability==="payable";return new ys(Wt,t,n)}V(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[Xn]===gE}}class Wi extends Ih{constant;outputs;stateMutability;payable;gas;constructor(e,t,n,s,r,a){super(e,"function",t,s),Object.defineProperty(this,Xn,{value:mE}),r=Object.freeze(r.slice()),Ye(this,{constant:n==="view"||n==="pure",gas:a,outputs:r,payable:n==="payable",stateMutability:n})}get selector(){return Fr(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("function"),t.push(this.name+uc(e,this.inputs)),e!=="sighash"&&(this.stateMutability!=="nonpayable"&&t.push(this.stateMutability),this.outputs&&this.outputs.length&&(t.push("returns"),t.push(uc(e,this.outputs))),this.gas!=null&&t.push(`@${this.gas.toString()}`)),t.join(" ")}static getSelector(e,t){return t=(t||[]).map(s=>kt.from(s)),new Wi(Wt,e,"view",t,[],null).selector}static from(e){if(Wi.isFragment(e))return e;if(typeof e=="string")try{return Wi.from(er(e))}catch{V(!1,"invalid function fragment","obj",e)}else if(e instanceof Ai){const n=Ch("function",e),s=bs(e),r=lE(e);let a=[];xs(e,Wn(["returns"])).has("returns")&&(a=bs(e));const o=hE(e);return Lr(e),new Wi(Wt,n,r,s,a,o)}let t=e.stateMutability;return t==null&&(t="payable",typeof e.constant=="boolean"?(t="view",e.constant||(t="payable",typeof e.payable=="boolean"&&!e.payable&&(t="nonpayable"))):typeof e.payable=="boolean"&&!e.payable&&(t="nonpayable")),new Wi(Wt,e.name,t,e.inputs?e.inputs.map(kt.from):[],e.outputs?e.outputs.map(kt.from):[],e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[Xn]===mE}}class kr extends Ih{constructor(e,t,n){super(e,"struct",t,n),Object.defineProperty(this,Xn,{value:xE})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return kr.from(er(e))}catch{V(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ai){const t=Ch("struct",e),n=bs(e);return Lr(e),new kr(Wt,t,n)}return new kr(Wt,e.name,e.inputs?e.inputs.map(kt.from):[])}static isFragment(e){return e&&e[Xn]===xE}}const Ni=new Map;Ni.set(0,"GENERIC_PANIC"),Ni.set(1,"ASSERT_FALSE"),Ni.set(17,"OVERFLOW"),Ni.set(18,"DIVIDE_BY_ZERO"),Ni.set(33,"ENUM_RANGE_ERROR"),Ni.set(34,"BAD_STORAGE_DATA"),Ni.set(49,"STACK_UNDERFLOW"),Ni.set(50,"ARRAY_RANGE_ERROR"),Ni.set(65,"OUT_OF_MEMORY"),Ni.set(81,"UNINITIALIZED_FUNCTION_CALL");const uL=new RegExp(/^bytes([0-9]*)$/),dL=new RegExp(/^(u?int)([0-9]*)$/);let mp=null,bE=1024;function fL(i,e,t,n){let s="missing revert data",r=null;const a=null;let o=null;if(t){s="execution reverted";const l=ut(t);if(t=Ce(t),l.length===0)s+=" (no data present; likely require(false) occurred",r="require(false)";else if(l.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Ce(l.slice(0,4))==="0x08c379a0")try{r=n.decode(["string"],l.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[r]},s+=`: ${JSON.stringify(r)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(Ce(l.slice(0,4))==="0x4e487b71")try{const h=Number(n.decode(["uint256"],l.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[h]},r=`Panic due to ${Ni.get(h)||"UNKNOWN"}(${h})`,s+=`: ${r}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?St(e.to):null,data:e.data||"0x"};return e.from&&(c.from=St(e.from)),Qt(s,"CALL_EXCEPTION",{action:i,data:t,reason:r,transaction:c,invocation:a,revert:o})}class ja{#e(e){if(e.isArray())return new FN(this.#e(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new dh(e.components.map(n=>this.#e(n)),e.name);switch(e.baseType){case"address":return new TN(e.name);case"bool":return new NN(e.name);case"string":return new HN(e.name);case"bytes":return new DN(e.name);case"":return new kN(e.name)}let t=e.type.match(dL);if(t){let n=parseInt(t[2]||"256");return V(n!==0&&n<=256&&n%8===0,"invalid "+t[1]+" bit length","param",e),new GN(n/8,t[1]==="int",e.name)}if(t=e.type.match(uL),t){let n=parseInt(t[1]);return V(n!==0&&n<=32,"invalid bytes length","param",e),new LN(n,e.name)}V(!1,"invalid type","type",e.type)}getDefaultValue(e){const t=e.map(s=>this.#e(kt.from(s)));return new dh(t,"_").defaultValue()}encode(e,t){tx(t.length,e.length,"types/values length mismatch");const n=e.map(a=>this.#e(kt.from(a))),s=new dh(n,"_"),r=new Df;return s.encode(r,t),r.data}decode(e,t,n){const s=e.map(a=>this.#e(kt.from(a)));return new dh(s,"_").decode(new Lf(t,n,bE))}static _setDefaultMaxInflation(e){V(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),bE=e}static defaultAbiCoder(){return mp==null&&(mp=new ja),mp}static getBuiltinCallException(e,t,n){return fL(e,t,n,ja.defaultAbiCoder())}}class pL{fragment;name;signature;topic;args;constructor(e,t,n){const s=e.name,r=e.format();Ye(this,{fragment:e,name:s,signature:r,topic:t,args:n})}}class AL{fragment;name;args;signature;selector;value;constructor(e,t,n,s){const r=e.name,a=e.format();Ye(this,{fragment:e,name:r,args:n,signature:a,selector:t,value:s})}}class gL{fragment;name;args;signature;selector;constructor(e,t,n){const s=e.name,r=e.format();Ye(this,{fragment:e,name:s,args:n,signature:r,selector:t})}}class EE{hash;_isIndexed;static isIndexed(e){return!!(e&&e._isIndexed)}constructor(e){Ye(this,{hash:e,_isIndexed:!0})}}const yE={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},_E={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:i=>`reverted with reason string ${JSON.stringify(i)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:i=>{let e="unknown panic code";return i>=0&&i<=255&&yE[i.toString()]&&(e=yE[i.toString()]),`reverted with panic code 0x${i.toString(16)} (${e})`}}};class Ur{fragments;deploy;fallback;receive;#e;#t;#n;#i;constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,this.#n=new Map,this.#e=new Map,this.#t=new Map;const n=[];for(const a of t)try{n.push(Pr.from(a))}catch(o){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,o.message)}Ye(this,{fragments:Object.freeze(n)});let s=null,r=!1;this.#i=this.getAbiCoder(),this.fragments.forEach((a,o)=>{let c;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ye(this,{deploy:a});return;case"fallback":a.inputs.length===0?r=!0:(V(!s||a.payable!==s.payable,"conflicting fallback fragments",`fragments[${o}]`,a),s=a,r=s.payable);return;case"function":c=this.#n;break;case"event":c=this.#t;break;case"error":c=this.#e;break;default:return}const l=a.format();c.has(l)||c.set(l,a)}),this.deploy||Ye(this,{deploy:Es.from("constructor()")}),Ye(this,{fallback:s,receive:r})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return ja.defaultAbiCoder()}#s(e,t,n){if(Pt(e)){const r=e.toLowerCase();for(const a of this.#n.values())if(r===a.selector)return a;return null}if(e.indexOf("(")===-1){const r=[];for(const[a,o]of this.#n)a.split("(")[0]===e&&r.push(o);if(t){const a=t.length>0?t[t.length-1]:null;let o=t.length,c=!0;jt.isTyped(a)&&a.type==="overrides"&&(c=!1,o--);for(let l=r.length-1;l>=0;l--){const h=r[l].inputs.length;h!==o&&(!c||h!==o-1)&&r.splice(l,1)}for(let l=r.length-1;l>=0;l--){const h=r[l].inputs;for(let u=0;u<t.length;u++)if(jt.isTyped(t[u])){if(u>=h.length){if(t[u].type==="overrides")continue;r.splice(l,1);break}if(t[u].type!==h[u].baseType){r.splice(l,1);break}}}}if(r.length===1&&t&&t.length!==r[0].inputs.length){const a=t[t.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&r.splice(0,1)}if(r.length===0)return null;if(r.length>1&&n){const a=r.map(o=>JSON.stringify(o.format())).join(", ");V(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return r[0]}const s=this.#n.get(Wi.from(e).format());return s||null}getFunctionName(e){const t=this.#s(e,null,!1);return V(t,"no matching function","key",e),t.name}hasFunction(e){return!!this.#s(e,null,!1)}getFunction(e,t){return this.#s(e,t||null,!0)}forEachFunction(e){const t=Array.from(this.#n.keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(this.#n.get(s),n)}}#a(e,t,n){if(Pt(e)){const r=e.toLowerCase();for(const a of this.#t.values())if(r===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const r=[];for(const[a,o]of this.#t)a.split("(")[0]===e&&r.push(o);if(t){for(let a=r.length-1;a>=0;a--)r[a].inputs.length<t.length&&r.splice(a,1);for(let a=r.length-1;a>=0;a--){const o=r[a].inputs;for(let c=0;c<t.length;c++)if(jt.isTyped(t[c])&&t[c].type!==o[c].baseType){r.splice(a,1);break}}}if(r.length===0)return null;if(r.length>1&&n){const a=r.map(o=>JSON.stringify(o.format())).join(", ");V(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return r[0]}const s=this.#t.get(Vi.from(e).format());return s||null}getEventName(e){const t=this.#a(e,null,!1);return V(t,"no matching event","key",e),t.name}hasEvent(e){return!!this.#a(e,null,!1)}getEvent(e,t){return this.#a(e,t||null,!0)}forEachEvent(e){const t=Array.from(this.#t.keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(this.#t.get(s),n)}}getError(e,t){if(Pt(e)){const s=e.toLowerCase();if(_E[s])return Yn.from(_E[s].signature);for(const r of this.#e.values())if(s===r.selector)return r;return null}if(e.indexOf("(")===-1){const s=[];for(const[r,a]of this.#e)r.split("(")[0]===e&&s.push(a);if(s.length===0)return e==="Error"?Yn.from("error Error(string)"):e==="Panic"?Yn.from("error Panic(uint256)"):null;if(s.length>1){const r=s.map(a=>JSON.stringify(a.format())).join(", ");V(!1,`ambiguous error description (i.e. ${r})`,"name",e)}return s[0]}if(e=Yn.from(e).format(),e==="Error(string)")return Yn.from("error Error(string)");if(e==="Panic(uint256)")return Yn.from("error Panic(uint256)");const n=this.#e.get(e);return n||null}forEachError(e){const t=Array.from(this.#e.keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(this.#e.get(s),n)}}_decodeParams(e,t){return this.#i.decode(e,t)}_encodeParams(e,t){return this.#i.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);V(n,"unknown error","fragment",e),e=n}return V(Kt(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Kt(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);V(n,"unknown error","fragment",e),e=n}return Gt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);V(n,"unknown function","fragment",e),e=n}return V(Kt(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Kt(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);V(n,"unknown function","fragment",e),e=n}return Gt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){if(typeof e=="string"){const r=this.getFunction(e);V(r,"unknown function","fragment",e),e=r}let n="invalid length for result data";const s=Hn(t);if(s.length%32===0)try{return this.#i.decode(e.outputs,s)}catch{n="could not decode result data"}pe(!1,n,"BAD_DATA",{value:Ce(s),info:{method:e.name,signature:e.format()}})}makeError(e,t){const n=ut(e,"data"),s=ja.getBuiltinCallException("call",t,n);if(s.message.startsWith("execution reverted (unknown custom error)")){const o=Ce(n.slice(0,4)),c=this.getError(o);if(c)try{const l=this.#i.decode(c.inputs,n.slice(4));s.revert={name:c.name,signature:c.format(),args:l},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const a=this.parseTransaction(t);return a&&(s.invocation={method:a.name,signature:a.signature,args:a.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const n=this.getFunction(e);V(n,"unknown function","fragment",e),e=n}return Ce(this.#i.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const r=this.getEvent(e);V(r,"unknown event","eventFragment",e),e=r}pe(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const n=[];e.anonymous||n.push(e.topicHash);const s=(r,a)=>r.type==="string"?Fr(a):r.type==="bytes"?an(Ce(a)):(r.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":r.type.match(/^u?int/)?a=Ks(a):r.type.match(/^bytes/)?a=jR(a,32):r.type==="address"&&this.#i.encode(["address"],[a]),hs(Ce(a),32));for(t.forEach((r,a)=>{const o=e.inputs[a];if(!o.indexed){V(r==null,"cannot filter non-indexed parameters; must be null","contract."+o.name,r);return}r==null?n.push(null):o.baseType==="array"||o.baseType==="tuple"?V(!1,"filtering with tuples or arrays not supported","contract."+o.name,r):Array.isArray(r)?n.push(r.map(c=>s(o,c))):n.push(s(o,r))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,t){if(typeof e=="string"){const a=this.getEvent(e);V(a,"unknown event","eventFragment",e),e=a}const n=[],s=[],r=[];return e.anonymous||n.push(e.topicHash),V(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((a,o)=>{const c=t[o];if(a.indexed)if(a.type==="string")n.push(Fr(c));else if(a.type==="bytes")n.push(an(c));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(this.#i.encode([a.type],[c]))}else s.push(a),r.push(c)}),{data:this.#i.encode(s,r),topics:n}}decodeEventLog(e,t,n){if(typeof e=="string"){const f=this.getEvent(e);V(f,"unknown event","eventFragment",e),e=f}if(n!=null&&!e.anonymous){const f=e.topicHash;V(Pt(n[0],32)&&n[0].toLowerCase()===f,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const s=[],r=[],a=[];e.inputs.forEach((f,p)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(s.push(kt.from({type:"bytes32",name:f.name})),a.push(!0)):(s.push(f),a.push(!1)):(r.push(f),a.push(!1))});const o=n!=null?this.#i.decode(s,Gt(n)):null,c=this.#i.decode(r,t,!0),l=[],h=[];let u=0,d=0;return e.inputs.forEach((f,p)=>{let m=null;if(f.indexed)if(o==null)m=new EE(null);else if(a[p])m=new EE(o[d++]);else try{m=o[d++]}catch(g){m=g}else try{m=c[u++]}catch(g){m=g}l.push(m),h.push(f.name||null)}),fs.fromItems(l,h)}parseTransaction(e){const t=ut(e.data,"tx.data"),n=Ne(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Ce(t.slice(0,4)));if(!s)return null;const r=this.#i.decode(s.inputs,t.slice(4));return new AL(s,s.selector,r,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new pL(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=Ce(e),n=this.getError(Kt(t,0,4));if(!n)return null;const s=this.#i.decode(n.inputs,Kt(t,4));return new gL(n,n.selector,s)}static from(e){return e instanceof Ur?e:typeof e=="string"?new Ur(JSON.parse(e)):typeof e.formatJson=="function"?new Ur(e.formatJson()):typeof e.format=="function"?new Ur(e.format("json")):new Ur(e)}}const wE=BigInt(0);function Xa(i){return i??null}function tn(i){return i==null?null:i.toString()}class vE{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,t,n){Ye(this,{gasPrice:Xa(e),maxFeePerGas:Xa(t),maxPriorityFeePerGas:Xa(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:tn(e),maxFeePerGas:tn(t),maxPriorityFeePerGas:tn(n)}}}function Sh(i){const e={};i.to&&(e.to=i.to),i.from&&(e.from=i.from),i.data&&(e.data=Ce(i.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in i)||i[s]==null||(e[s]=Ne(i[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in i)||i[s]==null||(e[s]=dt(i[s],`request.${s}`));return i.accessList&&(e.accessList=Tr(i.accessList)),i.authorizationList&&(e.authorizationList=i.authorizationList.slice()),"blockTag"in i&&(e.blockTag=i.blockTag),"enableCcipRead"in i&&(e.enableCcipRead=!!i.enableCcipRead),"customData"in i&&(e.customData=i.customData),"blobVersionedHashes"in i&&i.blobVersionedHashes&&(e.blobVersionedHashes=i.blobVersionedHashes.slice()),"kzg"in i&&(e.kzg=i.kzg),"blobWrapperVersion"in i&&(e.blobWrapperVersion=i.blobWrapperVersion),"blobs"in i&&i.blobs&&(e.blobs=i.blobs.map(s=>Bf(s)?Ce(s):Object.assign({},s))),e}class mL{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#e;constructor(e,t){this.#e=e.transactions.map(n=>typeof n!="string"?new fc(n,t):n),Ye(this,{provider:t,hash:Xa(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Xa(e.prevRandao),extraData:e.extraData,baseFeePerGas:Xa(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return this.#e.map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=this.#e.slice();return e.length===0?[]:(pe(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:t,extraData:n,gasLimit:s,gasUsed:r,hash:a,miner:o,prevRandao:c,nonce:l,number:h,parentHash:u,parentBeaconBlockRoot:d,stateRoot:f,receiptsRoot:p,timestamp:m,transactions:g}=this;return{_type:"Block",baseFeePerGas:tn(e),difficulty:tn(t),extraData:n,gasLimit:tn(s),gasUsed:tn(r),blobGasUsed:tn(this.blobGasUsed),excessBlobGas:tn(this.excessBlobGas),hash:a,miner:o,prevRandao:c,nonce:l,number:h,parentHash:u,timestamp:m,parentBeaconBlockRoot:d,stateRoot:f,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>e<this.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#e.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let t;if(typeof e=="number")t=this.#e[e];else{const n=e.toLowerCase();for(const s of this.#e)if(typeof s=="string"){if(s!==n)continue;t=s;break}else{if(s.hash!==n)continue;t=s;break}}if(t==null)throw new Error("no such tx");return typeof t=="string"?await this.provider.getTransaction(t):t}getPrefetchedTransaction(e){const t=this.prefetchedTransactions;if(typeof e=="number")return t[e];e=e.toLowerCase();for(const n of t)if(n.hash===e)return n;V(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return xL(this)}}class dc{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(e,t){this.provider=t;const n=Object.freeze(e.topics.slice());Ye(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:n,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:n,data:s,index:r,removed:a,topics:o,transactionHash:c,transactionIndex:l}=this;return{_type:"log",address:e,blockHash:t,blockNumber:n,data:s,index:r,removed:a,topics:o,transactionHash:c,transactionIndex:l}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return pe(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return pe(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return pe(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return bL(this)}}class CE{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#e;constructor(e,t){this.#e=Object.freeze(e.logs.map(s=>new dc(s,t)));let n=wE;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Ye(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return this.#e}toJSON(){const{to:e,from:t,contractAddress:n,hash:s,index:r,blockHash:a,blockNumber:o,logsBloom:c,logs:l,status:h,root:u}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:o,contractAddress:n,cumulativeGasUsed:tn(this.cumulativeGasUsed),from:t,gasPrice:tn(this.gasPrice),blobGasUsed:tn(this.blobGasUsed),blobGasPrice:tn(this.blobGasPrice),gasUsed:tn(this.gasUsed),hash:s,index:r,logs:l,logsBloom:c,root:u,status:h,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return SE(this)}reorderedEvent(e){return pe(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),IE(this,e)}}class fc{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;authorizationList;#e;constructor(e,t){this.provider=t,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,this.authorizationList=e.authorizationList!=null?e.authorizationList:null,this.#e=-1}toJSON(){const{blockNumber:e,blockHash:t,index:n,hash:s,type:r,to:a,from:o,nonce:c,data:l,signature:h,accessList:u,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:u,blockNumber:e,blockHash:t,blobVersionedHashes:d,chainId:tn(this.chainId),data:l,from:o,gasLimit:tn(this.gasLimit),gasPrice:tn(this.gasPrice),hash:s,maxFeePerGas:tn(this.maxFeePerGas),maxPriorityFeePerGas:tn(this.maxPriorityFeePerGas),maxFeePerBlobGas:tn(this.maxFeePerBlobGas),nonce:c,signature:h,to:a,index:n,type:r,value:tn(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const n=await this.getTransaction();n&&(e=n.blockNumber)}if(e==null)return null;const t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:n}=await Gn({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:n-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const n=e??1,s=t??0;let r=this.#e,a=-1,o=r===-1;const c=async()=>{if(o)return null;const{blockNumber:d,nonce:f}=await Gn({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(f<this.nonce){r=d;return}if(o)return null;const p=await this.getTransaction();if(!(p&&p.blockNumber!=null))for(a===-1&&(a=r-3,a<this.#e&&(a=this.#e));a<=d;){if(o)return null;const m=await this.provider.getBlock(a,!0);if(m==null)return;for(const g of m)if(g===this.hash)return;for(let g=0;g<m.length;g++){const A=await m.getTransaction(g);if(A.from===this.from&&A.nonce===this.nonce){if(o)return null;const _=await this.provider.getTransactionReceipt(A.hash);if(_==null||d-_.blockNumber+1<n)return;let x="replaced";A.data===this.data&&A.to===this.to&&A.value===this.value?x="repriced":A.data==="0x"&&A.from===A.to&&A.value===wE&&(x="cancelled"),pe(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:x==="replaced"||x==="cancelled",reason:x,replacement:A.replaceableTransaction(r),hash:A.hash,receipt:_})}}a++}},l=d=>{if(d==null||d.status!==0)return d;pe(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},h=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(h);if(h){if(n===1||await h.confirmations()>=n)return l(h)}else if(await c(),n===0)return null;return await new Promise((d,f)=>{const p=[],m=()=>{p.forEach(A=>A())};if(p.push(()=>{o=!0}),s>0){const A=setTimeout(()=>{m(),f(Qt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(A)})}const g=async A=>{if(await A.confirmations()>=n){m();try{d(l(A))}catch(_){f(_)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),r>=0){const A=async()=>{try{await c()}catch(_){if(Tn(_,"TRANSACTION_REPLACED")){m(),f(_);return}}o||this.provider.once("block",A)};p.push(()=>{this.provider.off("block",A)}),this.provider.once("block",A)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return pe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),SE(this)}reorderedEvent(e){return pe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),pe(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),IE(this,e)}replaceableTransaction(e){V(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new fc(this,this.provider);return t.#e=e,t}}function xL(i){return{orphan:"drop-block",hash:i.hash,number:i.number}}function IE(i,e){return{orphan:"reorder-transaction",tx:i,other:e}}function SE(i){return{orphan:"drop-transaction",tx:i}}function bL(i){return{orphan:"drop-log",log:{transactionHash:i.transactionHash,blockHash:i.blockHash,blockNumber:i.blockNumber,address:i.address,data:i.data,topics:Object.freeze(i.topics.slice()),index:i.index}}}class xp extends dc{interface;fragment;args;constructor(e,t,n){super(e,e.provider);const s=t.decodeEventLog(n,e.data,e.topics);Ye(this,{args:s,fragment:n,interface:t})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class ME extends dc{error;constructor(e,t){super(e,e.provider),Ye(this,{error:t})}}class EL extends CE{#e;constructor(e,t,n){super(n,t),this.#e=e}get logs(){return super.logs.map(e=>{const t=e.topics.length?this.#e.getEvent(e.topics[0]):null;if(t)try{return new xp(e,this.#e,t)}catch(n){return new ME(e,n)}return e})}}class bp extends fc{#e;constructor(e,t,n){super(n,t),this.#e=e}async wait(e,t){const n=await super.wait(e,t);return n==null?null:new EL(this.#e,this.provider,n)}}class BE extends lx{log;constructor(e,t,n,s){super(e,t,n),Ye(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class yL extends BE{constructor(e,t,n,s,r){super(e,t,n,new xp(r,e.interface,s));const a=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Ye(this,{args:a,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const TE=BigInt(0);function RE(i){return i&&typeof i.call=="function"}function FE(i){return i&&typeof i.estimateGas=="function"}function Mh(i){return i&&typeof i.resolveName=="function"}function NE(i){return i&&typeof i.sendTransaction=="function"}function DE(i){if(i!=null){if(Mh(i))return i;if(i.provider)return i.provider}}class _L{#e;fragment;constructor(e,t,n){if(Ye(this,{fragment:t}),t.inputs.length<n.length)throw new Error("too many arguments");const s=Or(e.runner,"resolveName"),r=Mh(s)?s:null;this.#e=(async function(){const a=await Promise.all(t.inputs.map((o,c)=>n[c]==null?null:o.walkAsync(n[c],(h,u)=>h==="address"?Array.isArray(u)?Promise.all(u.map(d=>Vn(d,r))):Vn(u,r):u)));return e.interface.encodeFilterTopics(t,a)})()}getTopicFilter(){return this.#e}}function Or(i,e){return i==null?null:typeof i[e]=="function"?i:i.provider&&typeof i.provider[e]=="function"?i.provider:null}function Qr(i){return i==null?null:i.provider||null}async function LE(i,e){const t=jt.dereference(i,"overrides");V(typeof t=="object","invalid overrides parameter","overrides",i);const n=Sh(t);return V(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),V(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function wL(i,e,t){const n=Or(i,"resolveName"),s=Mh(n)?n:null;return await Promise.all(e.map((r,a)=>r.walkAsync(t[a],(o,c)=>(c=jt.dereference(c,o),o==="address"?Vn(c,s):c))))}function vL(i){const e=async function(a){const o=await LE(a,["data"]);o.to=await i.getAddress(),o.from&&(o.from=await Vn(o.from,DE(i.runner)));const c=i.interface,l=Ne(o.value||TE,"overrides.value")===TE,h=(o.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!h&&!l&&V(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),V(c.fallback||h,"cannot send data to receive-only contract","overrides.data",o.data);const u=c.receive||c.fallback&&c.fallback.payable;return V(u||l,"cannot send value to non-payable fallback","overrides.value",o.value),V(c.fallback||h,"cannot send data to receive-only contract","overrides.data",o.data),o},t=async function(a){const o=Or(i.runner,"call");pe(RE(o),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(a);try{return await o.call(c)}catch(l){throw Mf(l)&&l.data?i.interface.makeError(l.data,c):l}},n=async function(a){const o=i.runner;pe(NE(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),l=Qr(i.runner);return new bp(i.interface,l,c)},s=async function(a){const o=Or(i.runner,"estimateGas");return pe(FE(o),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await o.estimateGas(await e(a))},r=async a=>await n(a);return Ye(r,{_contract:i,estimateGas:s,populateTransaction:e,send:n,staticCall:t}),r}function CL(i,e){const t=function(...l){const h=i.interface.getFunction(e,l);return pe(h,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:l}}),h},n=async function(...l){const h=t(...l);let u={};if(h.inputs.length+1===l.length&&(u=await LE(l.pop()),u.from&&(u.from=await Vn(u.from,DE(i.runner)))),h.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await wL(i.runner,h.inputs,l);return Object.assign({},u,await Gn({to:i.getAddress(),data:i.interface.encodeFunctionData(h,d)}))},s=async function(...l){const h=await o(...l);return h.length===1?h[0]:h},r=async function(...l){const h=i.runner;pe(NE(h),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const u=await h.sendTransaction(await n(...l)),d=Qr(i.runner);return new bp(i.interface,d,u)},a=async function(...l){const h=Or(i.runner,"estimateGas");return pe(FE(h),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await h.estimateGas(await n(...l))},o=async function(...l){const h=Or(i.runner,"call");pe(RE(h),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const u=await n(...l);let d="0x";try{d=await h.call(u)}catch(p){throw Mf(p)&&p.data?i.interface.makeError(p.data,u):p}const f=t(...l);return i.interface.decodeFunctionResult(f,d)},c=async(...l)=>t(...l).constant?await s(...l):await r(...l);return Ye(c,{name:i.interface.getFunctionName(e),_contract:i,_key:e,getFragment:t,estimateGas:a,populateTransaction:n,send:r,staticCall:s,staticCallResult:o}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=i.interface.getFunction(e);return pe(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),l}}),c}function IL(i,e){const t=function(...s){const r=i.interface.getEvent(e,s);return pe(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),r},n=function(...s){return new _L(i,t(...s),s)};return Ye(n,{name:i.interface.getEventName(e),_contract:i,_key:e,getFragment:t}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=i.interface.getEvent(e);return pe(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),n}const Bh=Symbol.for("_ethersInternal_contract"),PE=new WeakMap;function SL(i,e){PE.set(i[Bh],e)}function ti(i){return PE.get(i[Bh])}function ML(i){return i&&typeof i=="object"&&"getTopicFilter"in i&&typeof i.getTopicFilter=="function"&&i.fragment}async function Ep(i,e){let t,n=null;if(Array.isArray(e)){const r=function(a){if(Pt(a,32))return a;const o=i.interface.getEvent(a);return V(o,"unknown fragment","name",a),o.topicHash};t=e.map(a=>a==null?null:Array.isArray(a)?a.map(r):r(a))}else e==="*"?t=[null]:typeof e=="string"?Pt(e,32)?t=[e]:(n=i.interface.getEvent(e),V(n,"unknown fragment","event",e),t=[n.topicHash]):ML(e)?t=await e.getTopicFilter():"fragment"in e?(n=e.fragment,t=[n.topicHash]):V(!1,"unknown event name","event",e);t=t.map(r=>{if(r==null)return null;if(Array.isArray(r)){const a=Array.from(new Set(r.map(o=>o.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return r.toLowerCase()});const s=t.map(r=>r==null?"null":Array.isArray(r)?r.join("|"):r).join("&");return{fragment:n,tag:s,topics:t}}async function pc(i,e){const{subs:t}=ti(i);return t.get((await Ep(i,e)).tag)||null}async function kE(i,e,t){const n=Qr(i.runner);pe(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:r,topics:a}=await Ep(i,t),{addr:o,subs:c}=ti(i);let l=c.get(r);if(!l){const u={address:o||i,topics:a},d=g=>{let A=s;if(A==null)try{A=i.interface.getEvent(g.topics[0])}catch{}if(A){const _=A,x=s?i.interface.decodeEventLog(s,g.data,g.topics):[];_p(i,t,x,E=>new yL(i,E,t,_,g))}else _p(i,t,[],_=>new BE(i,_,t,g))};let f=[];l={tag:r,listeners:[],start:()=>{f.length||f.push(n.on(u,d))},stop:async()=>{if(f.length==0)return;let g=f;f=[],await Promise.all(g),n.off(u,d)}},c.set(r,l)}return l}let yp=Promise.resolve();async function BL(i,e,t,n){await yp;const s=await pc(i,e);if(!s)return!1;const r=s.listeners.length;return s.listeners=s.listeners.filter(({listener:a,once:o})=>{const c=Array.from(t);n&&c.push(n(o?null:a));try{a.call(i,...c)}catch{}return!o}),s.listeners.length===0&&(s.stop(),ti(i).subs.delete(s.tag)),r>0}async function _p(i,e,t,n){try{await yp}catch{}const s=BL(i,e,t,n);return yp=s,await s}const Th=["then"];class Ac{target;interface;runner;filters;[Bh];fallback;constructor(e,t,n,s){V(typeof e=="string"||gb(e),"invalid value for Contract target","target",e),n==null&&(n=null);const r=Ur.from(t);Ye(this,{target:e,runner:n,interface:r}),Object.defineProperty(this,Bh,{value:{}});let a,o=null,c=null;if(s){const u=Qr(n);c=new bp(this.interface,u,s)}let l=new Map;if(typeof e=="string")if(Pt(e))o=e,a=Promise.resolve(e);else{const u=Or(n,"resolveName");if(!Mh(u))throw Qt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=u.resolveName(e).then(d=>{if(d==null)throw Qt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return ti(this).addr=d,d})}else a=e.getAddress().then(u=>{if(u==null)throw new Error("TODO");return ti(this).addr=u,u});SL(this,{addrPromise:a,addr:o,deployTx:c,subs:l});const h=new Proxy({},{get:(u,d,f)=>{if(typeof d=="symbol"||Th.indexOf(d)>=0)return Reflect.get(u,d,f);try{return this.getEvent(d)}catch(p){if(!Tn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(u,d)=>Th.indexOf(d)>=0?Reflect.has(u,d):Reflect.has(u,d)||this.interface.hasEvent(String(d))});return Ye(this,{filters:h}),Ye(this,{fallback:r.receive||r.fallback?vL(this):null}),new Proxy(this,{get:(u,d,f)=>{if(typeof d=="symbol"||d in u||Th.indexOf(d)>=0)return Reflect.get(u,d,f);try{return u.getFunction(d)}catch(p){if(!Tn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(u,d)=>typeof d=="symbol"||d in u||Th.indexOf(d)>=0?Reflect.has(u,d):u.interface.hasFunction(d)})}connect(e){return new Ac(this.target,this.interface,e)}attach(e){return new Ac(e,this.interface,this.runner)}async getAddress(){return await ti(this).addrPromise}async getDeployedCode(){const e=Qr(this.runner);pe(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=Qr(this.runner);return pe(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,r)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);n.once("block",a)}catch(o){r(o)}};a()})}deploymentTransaction(){return ti(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),CL(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),IL(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,n){t==null&&(t=0),n==null&&(n="latest");const{addr:s,addrPromise:r}=ti(this),a=s||await r,{fragment:o,topics:c}=await Ep(this,e),l={address:a,topics:c,fromBlock:t,toBlock:n},h=Qr(this.runner);return pe(h,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await h.getLogs(l)).map(u=>{let d=o;if(d==null)try{d=this.interface.getEvent(u.topics[0])}catch{}if(d)try{return new xp(u,this.interface,d)}catch(f){return new ME(u,f)}return new dc(u,h)})}async on(e,t){const n=await kE(this,"on",e);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(e,t){const n=await kE(this,"once",e);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(e,...t){return await _p(this,e,t,null)}async listenerCount(e){if(e){const s=await pc(this,e);return s?s.listeners.length:0}const{subs:t}=ti(this);let n=0;for(const{listeners:s}of t.values())n+=s.length;return n}async listeners(e){if(e){const s=await pc(this,e);return s?s.listeners.map(({listener:r})=>r):[]}const{subs:t}=ti(this);let n=[];for(const{listeners:s}of t.values())n=n.concat(s.map(({listener:r})=>r));return n}async off(e,t){const n=await pc(this,e);if(!n)return this;if(t){const s=n.listeners.map(({listener:r})=>r).indexOf(t);s>=0&&n.listeners.splice(s,1)}return(t==null||n.listeners.length===0)&&(n.stop(),ti(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const t=await pc(this,e);if(!t)return this;t.stop(),ti(this).subs.delete(t.tag)}else{const{subs:t}=ti(this);for(const{tag:n,stop:s}of t.values())s(),t.delete(n)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends Ac{constructor(s,r=null){super(s,e,r)}}return t}static from(e,t,n){return n==null&&(n=null),new this(e,t,n)}}function TL(){return Ac}class Gr extends TL(){}function wp(i){return i.match(/^ipfs:\/\/ipfs\//i)?i=i.substring(12):i.match(/^ipfs:\/\//i)?i=i.substring(7):V(!1,"unsupported IPFS format","link",i),`https://gateway.ipfs.io/ipfs/${i}`}class RL{name;constructor(e){Ye(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,t){throw new Error("unsupported coin")}async decodeAddress(e,t){throw new Error("unsupported coin")}}const UE=new RegExp("^(ipfs)://(.*)$","i"),OE=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),UE,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class Ya{provider;address;name;#e;#t;constructor(e,t,n){Ye(this,{provider:e,address:t,name:n}),this.#e=null,this.#t=new Gr(t,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e)}async supportsWildcard(){return this.#e==null&&(this.#e=(async()=>{try{return await this.#t.supportsInterface("0x9061b923")}catch(e){if(Tn(e,"CALL_EXCEPTION"))return!1;throw this.#e=null,e}})()),await this.#e}async#n(e,t){t=(t||[]).slice();const n=this.#t.interface;t.unshift(pp(this.name));let s=null;await this.supportsWildcard()&&(s=n.getFunction(e),pe(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[jD(this.name,255),n.encodeFunctionData(s,t)],e="resolve(bytes,bytes)"),t.push({enableCcipRead:!0});try{const r=await this.#t[e](...t);return s?n.decodeFunctionResult(s,r)[0]:r}catch(r){if(!Tn(r,"CALL_EXCEPTION"))throw r}return null}async getAddress(e){if(e==null&&(e=60),e===60)try{const r=await this.#n("addr(bytes32)");return r==null||r===sc?null:r}catch(r){if(Tn(r,"CALL_EXCEPTION"))return null;throw r}if(e>=0&&e<2147483648){let r=e+2147483648;const a=await this.#n("addr(bytes32,uint)",[r]);if(Pt(a,20))return St(a)}let t=null;for(const r of this.provider.plugins)if(r instanceof RL&&r.supportsCoinType(e)){t=r;break}if(t==null)return null;const n=await this.#n("addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const s=await t.decodeAddress(e,n);if(s!=null)return s;pe(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const t=await this.#n("text(bytes32,string)",[e]);return t==null||t==="0x"?null:t}async getContentHash(){const e=await this.#n("contenthash(bytes32)");if(e==null||e==="0x")return null;const t=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const s=t[1]==="e3010170"?"ipfs":"ipns",r=parseInt(t[4],16);if(t[5].length===r*2)return`${s}://${JR("0x"+t[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;pe(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const t=await this.getText("avatar");if(t==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:t});for(let n=0;n<OE.length;n++){const s=t.match(OE[n]);if(s==null)continue;const r=s[1].toLowerCase();switch(r){case"https":case"data":return e.push({type:"url",value:t}),{linkage:e,url:t};case"ipfs":{const a=wp(t);return e.push({type:"ipfs",value:t}),e.push({type:"url",value:a}),{linkage:e,url:a}}case"erc721":case"erc1155":{const a=r==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:r,value:t});const o=await this.getAddress();if(o==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const c=(s[2]||"").split("/");if(c.length!==2)return e.push({type:`!${r}caip`,value:s[2]||""}),{url:null,linkage:e};const l=c[1],h=new Gr(c[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(r==="erc721"){const m=await h.ownerOf(l);if(o!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(r==="erc1155"){const m=await h.balanceOf(o,l);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let u=await h[a](l);if(u==null||u==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:u}),r==="erc1155"&&(u=u.replace("{id}",Ks(l,32).substring(2)),e.push({type:"metadata-url-expanded",value:u})),u.match(/^ipfs:/i)&&(u=wp(u)),e.push({type:"metadata-url",value:u});let d={};const f=await new Hi(u).send();f.assertOk();try{d=f.bodyJson}catch{try{e.push({type:"!metadata",value:f.bodyText})}catch{const A=f.body;return A&&e.push({type:"!metadata",value:Ce(A)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!d)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(d)});let p=d.image;if(typeof p!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(UE)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=wp(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const t=await e.getNetwork(),n=t.getPlugin("org.ethers.plugins.network.Ens");return pe(n,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:t}}),n.address}static async#i(e,t){const n=await Ya.getEnsAddress(e);try{const r=await new Gr(n,["function resolver(bytes32) view returns (address)"],e).resolver(pp(t),{enableCcipRead:!0});return r===sc?null:r}catch(s){throw s}return null}static async fromName(e,t){let n=t;for(;;){if(n===""||n==="."||t!=="eth"&&n==="eth")return null;const s=await Ya.#i(e,n);if(s!=null){const r=new Ya(e,s,t);return n!==t&&!await r.supportsWildcard()?null:r}n=n.split(".").slice(1).join(".")}}}const QE=BigInt(0);function bt(i,e){return(function(t){return t==null?e:i(t)})}function gc(i,e){return(t=>{if(e&&t==null)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map(n=>i(n))})}function mc(i,e){return(t=>{const n={};for(const s in i){let r=s;if(e&&s in e&&!(r in t)){for(const a of e[s])if(a in t){r=a;break}}try{const a=i[s](t[r]);a!==void 0&&(n[s]=a)}catch(a){const o=a instanceof Error?a.message:"not-an-error";pe(!1,`invalid value for value.${s} (${o})`,"BAD_DATA",{value:t})}}return n})}function FL(i){switch(i){case!0:case"true":return!0;case!1:case"false":return!1}V(!1,`invalid boolean; ${JSON.stringify(i)}`,"value",i)}function Ja(i){return V(Pt(i,!0),"invalid data","value",i),i}function Rn(i){return V(Pt(i,32),"invalid hash","value",i),i}const NL=mc({address:St,blockHash:Rn,blockNumber:dt,data:Ja,index:dt,removed:bt(FL,!1),topics:gc(Rn),transactionHash:Rn,transactionIndex:dt},{index:["logIndex"]});function DL(i){return NL(i)}const LL=mc({hash:bt(Rn),parentHash:Rn,parentBeaconBlockRoot:bt(Rn,null),number:dt,timestamp:dt,nonce:bt(Ja),difficulty:Ne,gasLimit:Ne,gasUsed:Ne,stateRoot:bt(Rn,null),receiptsRoot:bt(Rn,null),blobGasUsed:bt(Ne,null),excessBlobGas:bt(Ne,null),miner:bt(St),prevRandao:bt(Rn,null),extraData:Ja,baseFeePerGas:bt(Ne)},{prevRandao:["mixHash"]});function PL(i){const e=LL(i);return e.transactions=i.transactions.map(t=>typeof t=="string"?t:GE(t)),e}const kL=mc({transactionIndex:dt,blockNumber:dt,transactionHash:Rn,address:St,topics:gc(Rn),data:Ja,index:dt,blockHash:Rn},{index:["logIndex"]});function UL(i){return kL(i)}const OL=mc({to:bt(St,null),from:bt(St,null),contractAddress:bt(St,null),index:dt,root:bt(Ce),gasUsed:Ne,blobGasUsed:bt(Ne,null),logsBloom:bt(Ja),blockHash:Rn,hash:Rn,logs:gc(UL),blockNumber:dt,cumulativeGasUsed:Ne,effectiveGasPrice:bt(Ne),blobGasPrice:bt(Ne,null),status:bt(dt),type:bt(dt,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function QL(i){return OL(i)}function GE(i){i.to&&Ne(i.to)===QE&&(i.to="0x0000000000000000000000000000000000000000");const e=mc({hash:Rn,index:bt(dt,void 0),type:t=>t==="0x"||t==null?0:dt(t),accessList:bt(Tr,null),blobVersionedHashes:bt(gc(Rn,!0),null),authorizationList:bt(gc(t=>{let n;if(t.signature)n=t.signature;else{let s=t.yParity;s==="0x1b"?s=0:s==="0x1c"&&(s=1),n=Object.assign({},t,{yParity:s})}return{address:St(t.address),chainId:Ne(t.chainId),nonce:Ne(t.nonce),signature:Vt.from(n)}},!1),null),blockHash:bt(Rn,null),blockNumber:bt(dt,null),transactionIndex:bt(dt,null),from:St,gasPrice:bt(Ne),maxPriorityFeePerGas:bt(Ne),maxFeePerGas:bt(Ne),maxFeePerBlobGas:bt(Ne,null),gasLimit:Ne,to:bt(St,null),value:Ne,nonce:dt,data:Ja,creates:bt(St,null),chainId:bt(Ne,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(i);if(e.to==null&&e.creates==null&&(e.creates=BN(e)),(i.type===1||i.type===2)&&i.accessList==null&&(e.accessList=[]),i.signature?e.signature=Vt.from(i.signature):e.signature=Vt.from(i),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&Ne(e.blockHash)===QE&&(e.blockHash=null),e}const GL="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class xc{name;constructor(e){Ye(this,{name:e})}clone(){return new xc(this.name)}}class Rh extends xc{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(e,t){e==null&&(e=0),super(`org.ethers.network.plugins.GasCost#${e||0}`);const n={effectiveBlock:e};function s(r,a){let o=(t||{})[r];o==null&&(o=a),V(typeof o=="number",`invalud value for ${r}`,"costs",t),n[r]=o}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),Ye(this,n)}clone(){return new Rh(this.effectiveBlock,this)}}class Fh extends xc{address;targetNetwork;constructor(e,t){super("org.ethers.plugins.network.Ens"),Ye(this,{address:e||GL,targetNetwork:t??1})}clone(){return new Fh(this.address,this.targetNetwork)}}class HL extends xc{#e;#t;get url(){return this.#e}get processFunc(){return this.#t}constructor(e,t){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#e=e,this.#t=t}clone(){return this}}const vp=new Map;class ni{#e;#t;#n;constructor(e,t){this.#e=e,this.#t=Ne(t),this.#n=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#e}set name(e){this.#e=e}get chainId(){return this.#t}set chainId(e){this.#t=Ne(e,"chainId")}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Ne(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Ne(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Ne(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(this.#n.values())}attachPlugin(e){if(this.#n.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#n.set(e.name,e.clone()),this}getPlugin(e){return this.#n.get(e)||null}getPlugins(e){return this.plugins.filter(t=>t.name.split("#")[0]===e)}clone(){const e=new ni(this.name,this.chainId);return this.plugins.forEach(t=>{e.attachPlugin(t.clone())}),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new Rh;let n=t.txBase;if(e.to==null&&(n+=t.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?n+=t.txDataZero:n+=t.txDataNonzero;if(e.accessList){const s=Tr(e.accessList);for(const r in s)n+=t.txAccessListAddress+t.txAccessListStorageKey*s[r].storageKeys.length}return n}static from(e){if(zL(),e==null)return ni.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=vp.get(e);if(t)return t();if(typeof e=="bigint")return new ni("unknown",e);V(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){V(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const t=new ni(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new Fh(e.ensAddress,e.ensNetwork)),t}V(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const n=vp.get(e);n&&V(!1,`conflicting network for ${JSON.stringify(n.name)}`,"nameOrChainId",e),vp.set(e,t)}}function HE(i,e){const t=String(i);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${i}`);const n=t.split(".");if(n.length===1&&n.push(""),n.length!==2)throw new Error(`invalid gwei value: ${i}`);for(;n[1].length<e;)n[1]+="0";if(n[1].length>9){let s=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||s++,n[1]=s.toString()}return BigInt(n[0]+n[1])}function zE(i){return new HL(i,async(e,t,n)=>{n.setHeader("User-Agent","ethers");let s;try{const[r,a]=await Promise.all([n.send(),e()]);s=r;const o=s.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:HE(o.maxFee,9),maxPriorityFeePerGas:HE(o.maxPriorityFee,9)}}catch(r){pe(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:s,error:r})}})}let VE=!1;function zL(){if(VE)return;VE=!0;function i(e,t,n){const s=function(){const r=new ni(e,t);return n.ensNetwork!=null&&r.attachPlugin(new Fh(null,n.ensNetwork)),r.attachPlugin(new Rh),(n.plugins||[]).forEach(a=>{r.attachPlugin(a)}),r};ni.register(e,s),ni.register(t,s),n.altNames&&n.altNames.forEach(r=>{ni.register(r,s)})}i("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),i("ropsten",3,{ensNetwork:3}),i("rinkeby",4,{ensNetwork:4}),i("goerli",5,{ensNetwork:5}),i("kovan",42,{ensNetwork:42}),i("sepolia",11155111,{ensNetwork:11155111}),i("holesky",17e3,{ensNetwork:17e3}),i("classic",61,{}),i("classicKotti",6,{}),i("arbitrum",42161,{ensNetwork:1}),i("arbitrum-goerli",421613,{}),i("arbitrum-sepolia",421614,{}),i("base",8453,{ensNetwork:1}),i("base-goerli",84531,{}),i("base-sepolia",84532,{}),i("bnb",56,{ensNetwork:1}),i("bnbt",97,{}),i("filecoin",314,{}),i("filecoin-calibration",314159,{}),i("linea",59144,{ensNetwork:1}),i("linea-goerli",59140,{}),i("linea-sepolia",59141,{}),i("matic",137,{ensNetwork:1,plugins:[zE("https://gasstation.polygon.technology/v2")]}),i("matic-amoy",80002,{}),i("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[zE("https://gasstation-testnet.polygon.technology/v2")]}),i("optimism",10,{ensNetwork:1,plugins:[]}),i("optimism-goerli",420,{}),i("optimism-sepolia",11155420,{}),i("xdai",100,{ensNetwork:1})}function Cp(i){return JSON.parse(JSON.stringify(i))}class VL{#e;#t;#n;#i;constructor(e){this.#e=e,this.#t=null,this.#n=4e3,this.#i=-2}get pollingInterval(){return this.#n}set pollingInterval(e){this.#n=e}async#s(){try{const e=await this.#e.getBlockNumber();if(this.#i===-2){this.#i=e;return}if(e!==this.#i){for(let t=this.#i+1;t<=e;t++){if(this.#t==null)return;await this.#e.emit("block",t)}this.#i=e}}catch{}this.#t!=null&&(this.#t=this.#e._setTimeout(this.#s.bind(this),this.#n))}start(){this.#t||(this.#t=this.#e._setTimeout(this.#s.bind(this),this.#n),this.#s())}stop(){this.#t&&(this.#e._clearTimeout(this.#t),this.#t=null)}pause(e){this.stop(),e&&(this.#i=-2)}resume(){this.start()}}class Ip{#e;#t;#n;constructor(e){this.#e=e,this.#n=!1,this.#t=t=>{this._poll(t,this.#e)}}async _poll(e,t){throw new Error("sub-classes must override this")}start(){this.#n||(this.#n=!0,this.#t(-2),this.#e.on("block",this.#t))}stop(){this.#n&&(this.#n=!1,this.#e.off("block",this.#t))}pause(e){this.stop()}resume(){this.start()}}class WL extends Ip{#e;#t;constructor(e,t){super(e),this.#e=t,this.#t=-2}pause(e){e&&(this.#t=-2),super.pause(e)}async _poll(e,t){const n=await t.getBlock(this.#e);n!=null&&(this.#t===-2?this.#t=n.number:n.number>this.#t&&(t.emit(this.#e,n.number),this.#t=n.number))}}class qL extends Ip{#e;constructor(e,t){super(e),this.#e=Cp(t)}async _poll(e,t){throw new Error("@TODO")}}class KL extends Ip{#e;constructor(e,t){super(e),this.#e=t}async _poll(e,t){const n=await t.getTransactionReceipt(this.#e);n&&t.emit(this.#e,n)}}class Sp{#e;#t;#n;#i;#s;constructor(e,t){this.#e=e,this.#t=Cp(t),this.#n=this.#a.bind(this),this.#i=!1,this.#s=-2}async#a(e){if(this.#s===-2)return;const t=Cp(this.#t);t.fromBlock=this.#s+1,t.toBlock=e;const n=await this.#e.getLogs(t);if(n.length===0){this.#s<e-60&&(this.#s=e-60);return}for(const s of n)this.#e.emit(this.#t,s),this.#s=s.blockNumber}start(){this.#i||(this.#i=!0,this.#s===-2&&this.#e.getBlockNumber().then(e=>{this.#s=e}),this.#e.on("block",this.#n))}stop(){this.#i&&(this.#i=!1,this.#e.off("block",this.#n))}pause(e){this.stop(),e&&(this.#s=-2)}resume(){this.start()}}const jL=BigInt(2),XL=10;function Nh(i){return i&&typeof i.then=="function"}function Dh(i,e){return i+":"+JSON.stringify(e,(t,n)=>{if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const s=Object.keys(n);return s.sort(),s.reduce((r,a)=>(r[a]=n[a],r),{})}return n})}class WE{name;constructor(e){Ye(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function YL(i){return JSON.parse(JSON.stringify(i))}function Mp(i){return i=Array.from(new Set(i).values()),i.sort(),i}async function Bp(i,e){if(i==null)throw new Error("invalid event");if(Array.isArray(i)&&(i={topics:i}),typeof i=="string")switch(i){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:i,tag:i}}if(Pt(i,32)){const t=i.toLowerCase();return{type:"transaction",tag:Dh("tx",{hash:t}),hash:t}}if(i.orphan){const t=i;return{type:"orphan",tag:Dh("orphan",t),filter:YL(t)}}if(i.address||i.topics){const t=i,n={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?Mp(s.map(r=>r.toLowerCase())):s.toLowerCase())};if(t.address){const s=[],r=[],a=o=>{Pt(o)?s.push(o):r.push((async()=>{s.push(await Vn(o,e))})())};Array.isArray(t.address)?t.address.forEach(a):a(t.address),r.length&&await Promise.all(r),n.address=Mp(s.map(o=>o.toLowerCase()))}return{filter:n,tag:Dh("event",n),type:"event"}}V(!1,"unknown ProviderEvent","event",i)}function Tp(){return new Date().getTime()}const JL={cacheTimeout:250,pollingInterval:4e3};class ZL{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;constructor(e,t){if(this.#A=Object.assign({},JL,t||{}),e==="any")this.#a=!0,this.#s=null;else if(e){const n=ni.from(e);this.#a=!1,this.#s=Promise.resolve(n),setTimeout(()=>{this.emit("network",n,null)},0)}else this.#a=!1,this.#s=null;this.#o=-1,this.#r=new Map,this.#e=new Map,this.#t=new Map,this.#n=null,this.#i=!1,this.#f=1,this.#l=new Map,this.#p=!1}get pollingInterval(){return this.#A.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#t.values())}attachPlugin(e){if(this.#t.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#t.set(e.name,e.connect(this)),this}getPlugin(e){return this.#t.get(e)||null}get disableCcipRead(){return this.#p}set disableCcipRead(e){this.#p=!!e}async#c(e){const t=this.#A.cacheTimeout;if(t<0)return await this._perform(e);const n=Dh(e.method,e);let s=this.#r.get(n);return s||(s=this._perform(e),this.#r.set(n,s),setTimeout(()=>{this.#r.get(n)===s&&this.#r.delete(n)},t)),await s}async ccipReadFetch(e,t,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const s=e.to.toLowerCase(),r=t.toLowerCase(),a=[];for(let o=0;o<n.length;o++){const c=n[o],l=c.replace("{sender}",s).replace("{data}",r),h=new Hi(l);c.indexOf("{data}")===-1&&(h.body={data:r,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:h,index:o,urls:n});let u="unknown error",d;try{d=await h.send()}catch(f){a.push(f.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:h,result:{error:f}});continue}try{const f=d.bodyJson;if(f.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:h,result:f}),f.data;f.message&&(u=f.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:h,result:f})}catch{}pe(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${u}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:u}}),a.push(u)}pe(!1,`error encountered during CCIP fetch: ${a.map(o=>JSON.stringify(o)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:a}})}_wrapBlock(e,t){return new mL(PL(e),this)}_wrapLog(e,t){return new dc(DL(e),this)}_wrapTransactionReceipt(e,t){return new CE(QL(e),this)}_wrapTransactionResponse(e,t){return new fc(GE(e),this)}_detectNetwork(){pe(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){pe(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=dt(await this.#c({method:"getBlockNumber"}),"%response");return this.#o>=0&&(this.#o=e),e}_getAddress(e){return Vn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Pt(e))return Pt(e,32)?e:Ti(e);if(typeof e=="bigint"&&(e=dt(e,"blockTag")),typeof e=="number")return e>=0?Ti(e):this.#o>=0?Ti(this.#o+e):this.getBlockNumber().then(t=>Ti(t+e));V(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?Mp(c.map(l=>l.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,s=(c,l,h)=>{let u;switch(c.length){case 0:break;case 1:u=c[0];break;default:c.sort(),u=c}if(n&&(l!=null||h!=null))throw new Error("invalid filter");const d={};return u&&(d.address=u),t.length&&(d.topics=t),l&&(d.fromBlock=l),h&&(d.toBlock=h),n&&(d.blockHash=n),d};let r=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)r.push(this._getAddress(c));else r.push(this._getAddress(e.address));let a;"fromBlock"in e&&(a=this._getBlockTag(e.fromBlock));let o;return"toBlock"in e&&(o=this._getBlockTag(e.toBlock)),r.filter(c=>typeof c!="string").length||a!=null&&typeof a!="string"||o!=null&&typeof o!="string"?Promise.all([Promise.all(r),a,o]).then(c=>s(c[0],c[1],c[2])):s(r,a,o)}_getTransactionRequest(e){const t=Sh(e),n=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const r=Vn(t[s],this);Nh(r)?n.push((async function(){t[s]=await r})()):t[s]=r}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);Nh(s)?n.push((async function(){t.blockTag=await s})()):t.blockTag=s}return n.length?(async function(){return await Promise.all(n),t})():t}async getNetwork(){if(this.#s==null){const s=(async()=>{try{const r=await this._detectNetwork();return this.emit("network",r,null),r}catch(r){throw this.#s===s&&(this.#s=null),r}})();return this.#s=s,(await s).clone()}const e=this.#s,[t,n]=await Promise.all([e,this._detectNetwork()]);return t.chainId!==n.chainId&&(this.#a?(this.emit("network",n,t),this.#s===e&&(this.#s=Promise.resolve(n))):pe(!1,`network changed: ${t.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const e=await this.getNetwork(),t=async()=>{const{_block:s,gasPrice:r,priorityFee:a}=await Gn({_block:this.#x("latest",!1),gasPrice:(async()=>{try{const h=await this.#c({method:"getGasPrice"});return Ne(h,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const h=await this.#c({method:"getPriorityFee"});return Ne(h,"%response")}catch{}return null})()});let o=null,c=null;const l=this._wrapBlock(s,e);return l&&l.baseFeePerGas&&(c=a??BigInt("1000000000"),o=l.baseFeePerGas*jL+c),new vE(r,o,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const s=new Hi(n.url),r=await n.processFunc(t,this,s);return new vE(r.gasPrice,r.maxFeePerGas,r.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return Nh(t)&&(t=await t),Ne(await this.#c({method:"estimateGas",transaction:t}),"%response")}async#h(e,t,n){pe(n<XL,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=Sh(e);try{return Ce(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(r){if(!this.disableCcipRead&&Mf(r)&&r.data&&n>=0&&t==="latest"&&s.to!=null&&Kt(r.data,0,4)==="0x556f1830"){const a=r.data,o=await Vn(s.to,this);let c;try{c=i2(Kt(r.data,4))}catch(u){pe(!1,u.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:a}})}pe(c.sender.toLowerCase()===o.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:a,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const l=await this.ccipReadFetch(s,c.calldata,c.urls);pe(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:r.data,errorArgs:c.errorArgs}});const h={to:o,data:Gt([c.selector,n2([l,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:h});try{const u=await this.#h(h,t,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},h),result:u}),u}catch(u){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},h),error:u}),u}}throw r}}async#u(e){const{value:t}=await Gn({network:this.getNetwork(),value:e});return t}async call(e){const{tx:t,blockTag:n}=await Gn({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await this.#u(this.#h(t,n,e.enableCcipRead?0:-1))}async#d(e,t,n){let s=this._getAddress(t),r=this._getBlockTag(n);return(typeof s!="string"||typeof r!="string")&&([s,r]=await Promise.all([s,r])),await this.#u(this.#c(Object.assign(e,{address:s,blockTag:r})))}async getBalance(e,t){return Ne(await this.#d({method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return dt(await this.#d({method:"getTransactionCount"},e,t),"%response")}async getCode(e,t){return Ce(await this.#d({method:"getCode"},e,t))}async getStorage(e,t,n){const s=Ne(t,"position");return Ce(await this.#d({method:"getStorage",position:s},e,n))}async broadcastTransaction(e){const{blockNumber:t,hash:n,network:s}=await Gn({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),r=Fi.from(e);if(r.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(r,s).replaceableTransaction(t)}async#x(e,t){if(Pt(e,32))return await this.#c({method:"getBlock",blockHash:e,includeTransactions:t});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await this.#c({method:"getBlock",blockTag:n,includeTransactions:t})}async getBlock(e,t){const{network:n,params:s}=await Gn({network:this.getNetwork(),params:this.#x(e,!!t)});return s==null?null:this._wrapBlock(s,n)}async getTransaction(e){const{network:t,params:n}=await Gn({network:this.getNetwork(),params:this.#c({method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,t)}async getTransactionReceipt(e){const{network:t,params:n}=await Gn({network:this.getNetwork(),params:this.#c({method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const s=await this.#c({method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(n,t)}async getTransactionResult(e){const{result:t}=await Gn({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:e})});return t==null?null:Ce(t)}async getLogs(e){let t=this._getFilter(e);Nh(t)&&(t=await t);const{network:n,params:s}=await Gn({network:this.getNetwork(),params:this.#c({method:"getLogs",filter:t})});return s.map(r=>this._wrapLog(r,n))}_getProvider(e){pe(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Ya.fromName(this,e)}async getAvatar(e){const t=await this.getResolver(e);return t?await t.getAvatar():null}async resolveName(e){const t=await this.getResolver(e);return t?await t.getAddress():null}async lookupAddress(e){e=St(e);const t=pp(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await Ya.getEnsAddress(this),r=await new Gr(n,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(r==null||r===sc)return null;const o=await new Gr(r,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(o)!==e?null:o}catch(n){if(Tn(n,"BAD_DATA")&&n.value==="0x"||Tn(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,t,n){const s=t??1;return s===0?this.getTransactionReceipt(e):new Promise(async(r,a)=>{let o=null;const c=(async l=>{try{const h=await this.getTransactionReceipt(e);if(h!=null&&l-h.blockNumber+1>=s){r(h),o&&(clearTimeout(o),o=null);return}}catch(h){console.log("EEE",h)}this.once("block",c)});n!=null&&(o=setTimeout(()=>{o!=null&&(o=null,this.off("block",c),a(Qt("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){pe(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const t=this.#l.get(e);t&&(t.timer&&clearTimeout(t.timer),this.#l.delete(e))}_setTimeout(e,t){t==null&&(t=0);const n=this.#f++,s=()=>{this.#l.delete(n),e()};if(this.paused)this.#l.set(n,{timer:null,func:s,time:t});else{const r=setTimeout(s,t);this.#l.set(n,{timer:r,func:s,time:Tp()})}return n}_forEachSubscriber(e){for(const t of this.#e.values())e(t.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new WE(e.type);case"block":{const t=new VL(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new WL(this,e.type);case"event":return new Sp(this,e.filter);case"transaction":return new KL(this,e.hash);case"orphan":return new qL(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,t){for(const n of this.#e.values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=t,n.started&&t.start(),this.#n!=null&&t.pause(this.#n);break}}async#g(e,t){let n=await Bp(e,this);return n.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(n=await Bp({orphan:"drop-log",log:t[0]},this)),this.#e.get(n.tag)||null}async#m(e){const t=await Bp(e,this),n=t.tag;let s=this.#e.get(n);return s||(s={subscriber:this._getSubscriber(t),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#e.set(n,s)),s}async on(e,t){const n=await this.#m(e);return n.listeners.push({listener:t,once:!1}),n.started||(n.subscriber.start(),n.started=!0,this.#n!=null&&n.subscriber.pause(this.#n)),this}async once(e,t){const n=await this.#m(e);return n.listeners.push({listener:t,once:!0}),n.started||(n.subscriber.start(),n.started=!0,this.#n!=null&&n.subscriber.pause(this.#n)),this}async emit(e,...t){const n=await this.#g(e,t);if(!n||n.listeners.length===0)return!1;const s=n.listeners.length;return n.listeners=n.listeners.filter(({listener:r,once:a})=>{const o=new lx(this,a?null:r,e);try{r.call(this,...t,o)}catch{}return!a}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),this.#e.delete(n.tag)),s>0}async listenerCount(e){if(e){const n=await this.#g(e);return n?n.listeners.length:0}let t=0;for(const{listeners:n}of this.#e.values())t+=n.length;return t}async listeners(e){if(e){const n=await this.#g(e);return n?n.listeners.map(({listener:s})=>s):[]}let t=[];for(const{listeners:n}of this.#e.values())t=t.concat(n.map(({listener:s})=>s));return t}async off(e,t){const n=await this.#g(e);if(!n)return this;if(t){const s=n.listeners.map(({listener:r})=>r).indexOf(t);s>=0&&n.listeners.splice(s,1)}return(!t||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),this.#e.delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:t,started:n,subscriber:s}=await this.#m(e);n&&s.stop(),this.#e.delete(t)}else for(const[t,{started:n,subscriber:s}]of this.#e)n&&s.stop(),this.#e.delete(t);return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return this.off(e,t)}get destroyed(){return this.#i}destroy(){this.removeAllListeners();for(const e of this.#l.keys())this._clearTimeout(e);this.#i=!0}get paused(){return this.#n!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(this.#o=-1,this.#n!=null){if(this.#n==!!e)return;pe(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(e)),this.#n=!!e;for(const t of this.#l.values())t.timer&&clearTimeout(t.timer),t.time=Tp()-t.time}resume(){if(this.#n!=null){this._forEachSubscriber(e=>e.resume()),this.#n=null;for(const e of this.#l.values()){let t=e.time;t<0&&(t=0),e.time=Tp(),setTimeout(e.func,t)}}}}function $L(i,e){try{const t=Rp(i,e);if(t)return ih(t)}catch{}return null}function Rp(i,e){if(i==="0x")return null;try{const t=dt(Kt(i,e,e+32)),n=dt(Kt(i,t,t+32));return Kt(i,t+32,t+32+n)}catch{}return null}function qE(i){const e=rn(i);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function e2(i){if(i.length%32===0)return i;const e=new Uint8Array(Math.ceil(i.length/32)*32);return e.set(i),e}const t2=new Uint8Array([]);function n2(i){const e=[];let t=0;for(let n=0;n<i.length;n++)e.push(t2),t+=32;for(let n=0;n<i.length;n++){const s=ut(i[n]);e[n]=qE(t),e.push(qE(s.length)),e.push(e2(s)),t+=32+Math.ceil(s.length/32)*32}return Gt(e)}const KE="0x0000000000000000000000000000000000000000000000000000000000000000";function i2(i){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};pe(ka(i)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Kt(i,0,32);pe(Kt(t,0,12)===Kt(KE,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Kt(t,12);try{const n=[],s=dt(Kt(i,32,64)),r=dt(Kt(i,s,s+32)),a=Kt(i,s+32);for(let o=0;o<r;o++){const c=$L(a,o*32);if(c==null)throw new Error("abort");n.push(c)}e.urls=n}catch{pe(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const n=Rp(i,64);if(n==null)throw new Error("abort");e.calldata=n}catch{pe(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}pe(Kt(i,100,128)===Kt(KE,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Kt(i,96,100);try{const n=Rp(i,128);if(n==null)throw new Error("abort");e.extraData=n}catch{pe(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(n=>e[n]),e}function Hr(i,e){if(i.provider)return i.provider;pe(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function jE(i,e){let t=Sh(e);if(t.to!=null&&(t.to=Vn(t.to,i)),t.from!=null){const n=t.from;t.from=Promise.all([i.getAddress(),Vn(n,i)]).then(([s,r])=>(V(s.toLowerCase()===r.toLowerCase(),"transaction from mismatch","tx.from",r),s))}else t.from=i.getAddress();return await Gn(t)}class s2{provider;constructor(e){Ye(this,{provider:e||null})}async getNonce(e){return Hr(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await jE(this,e)}async populateTransaction(e){const t=Hr(this,"populateTransaction"),n=await jE(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const s=await this.provider.getNetwork();if(n.chainId!=null){const a=Ne(n.chainId);V(a===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=s.chainId;const r=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||r)?V(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&r&&V(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const a=await t.getFeeData();pe(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice)}else{const a=await t.getFeeData();if(n.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(n.authorizationList&&n.authorizationList.length?n.type=4:n.type=2,n.gasPrice!=null){const o=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=o,n.maxPriorityFeePerGas=o}else n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(pe(!r,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice),n.type=0):pe(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3||n.type===4)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await Gn(n)}async populateAuthorization(e){const t=Object.assign({},e);return t.chainId==null&&(t.chainId=(await Hr(this,"getNetwork").getNetwork()).chainId),t.nonce==null&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return Hr(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Hr(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Hr(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=Hr(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const s=Fi.from(n);return await t.broadcastTransaction(await this.signTransaction(s))}authorize(e){pe(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}function r2(i){return JSON.parse(JSON.stringify(i))}class XE{#e;#t;#n;#i;#s;#a;constructor(e){this.#e=e,this.#t=null,this.#n=this.#r.bind(this),this.#i=!1,this.#s=null,this.#a=!1}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}async#r(e){try{this.#t==null&&(this.#t=this._subscribe(this.#e));let t=null;try{t=await this.#t}catch(r){if(!Tn(r,"UNSUPPORTED_OPERATION")||r.operation!=="eth_newFilter")throw r}if(t==null){this.#t=null,this.#e._recoverSubscriber(this,this._recover(this.#e));return}const n=await this.#e.getNetwork();if(this.#s||(this.#s=n),this.#s.chainId!==n.chainId)throw new Error("chaid changed");if(this.#a)return;const s=await this.#e.send("eth_getFilterChanges",[t]);await this._emitResults(this.#e,s)}catch(t){console.log("@TODO",t)}this.#e.once("block",this.#n)}#o(){const e=this.#t;e&&(this.#t=null,e.then(t=>{this.#e.destroyed||this.#e.send("eth_uninstallFilter",[t])}))}start(){this.#i||(this.#i=!0,this.#r(-2))}stop(){this.#i&&(this.#i=!1,this.#a=!0,this.#o(),this.#e.off("block",this.#n))}pause(e){e&&this.#o(),this.#e.off("block",this.#n)}resume(){this.start()}}class a2 extends XE{#e;constructor(e,t){super(e),this.#e=r2(t)}_recover(e){return new Sp(e,this.#e)}async _subscribe(e){return await e.send("eth_newFilter",[this.#e])}async _emitResults(e,t){for(const n of t)e.emit(this.#e,e._wrapLog(n,e._network))}}class o2 extends XE{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const n of t)e.emit("pending",n)}}const c2="bigint,boolean,function,number,string,symbol".split(/,/g);function Lh(i){if(i==null||c2.indexOf(typeof i)>=0||typeof i.getAddress=="function")return i;if(Array.isArray(i))return i.map(Lh);if(typeof i=="object")return Object.keys(i).reduce((e,t)=>(e[t]=i[t],e),{});throw new Error(`should not happen: ${i} (${typeof i})`)}function l2(i){return new Promise(e=>{setTimeout(e,i)})}function Za(i){return i&&i.toLowerCase()}function YE(i){return i&&typeof i.pollingInterval=="number"}const JE={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Fp extends s2{address;constructor(e,t){super(e),t=St(t),Ye(this,{address:t})}connect(e){pe(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(e){return await this.populateCall(e)}async sendUncheckedTransaction(e){const t=Lh(e),n=[];if(t.from){const r=t.from;n.push((async()=>{const a=await Vn(r,this.provider);V(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),t.from=a})())}else t.from=this.address;if(t.gasLimit==null&&n.push((async()=>{t.gasLimit=await this.provider.estimateGas({...t,from:this.address})})()),t.to!=null){const r=t.to;n.push((async()=>{t.to=await Vn(r,this.provider)})())}n.length&&await Promise.all(n);const s=this.provider.getRpcTransaction(t);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(e){const t=await this.provider.getBlockNumber(),n=await this.sendUncheckedTransaction(e);return await new Promise((s,r)=>{const a=[1e3,100];let o=0;const c=async()=>{try{const l=await this.provider.getTransaction(n);if(l!=null){s(l.replaceableTransaction(t));return}}catch(l){if(Tn(l,"CANCELLED")||Tn(l,"BAD_DATA")||Tn(l,"NETWORK_ERROR")||Tn(l,"UNSUPPORTED_OPERATION")){l.info==null&&(l.info={}),l.info.sendTransactionHash=n,r(l);return}if(Tn(l,"INVALID_ARGUMENT")&&(o++,l.info==null&&(l.info={}),l.info.sendTransactionHash=n,o>10)){r(l);return}this.provider.emit("error",Qt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:l}))}this.provider._setTimeout(()=>{c()},a.pop()||4e3)};c()})}async signTransaction(e){const t=Lh(e);if(t.from){const s=await Vn(t.from,this.provider);V(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),t.from=s}else t.from=this.address;const n=this.provider.getRpcTransaction(t);return await this.provider.send("eth_signTransaction",[n])}async signMessage(e){const t=typeof e=="string"?us(e):e;return await this.provider.send("personal_sign",[Ce(t),this.address.toLowerCase()])}async signTypedData(e,t,n){const s=Lh(n),r=await ei.resolveNames(e,t,s,async a=>{const o=await Vn(a);return V(o!=null,"TypedData does not support null address","value",a),o});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(ei.getPayload(r.domain,t,r.value))])}async unlock(e){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),e,null])}async _legacySignMessage(e){const t=typeof e=="string"?us(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ce(t)])}}class h2 extends ZL{#e;#t;#n;#i;#s;#a;#r;#o(){if(this.#i)return;const e=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#i=setTimeout(()=>{this.#i=null;const t=this.#n;for(this.#n=[];t.length;){const n=[t.shift()];for(;t.length&&n.length!==this.#e.batchMaxCount;)if(n.push(t.shift()),JSON.stringify(n.map(r=>r.payload)).length>this.#e.batchMaxSize){t.unshift(n.pop());break}(async()=>{const s=n.length===1?n[0].payload:n.map(r=>r.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const r=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:r});for(const{resolve:a,reject:o,payload:c}of n){if(this.destroyed){o(Qt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:c.method}));continue}const l=r.filter(h=>h.id===c.id)[0];if(l==null){const h=Qt("missing response for request","BAD_DATA",{value:r,info:{payload:c}});this.emit("error",h),o(h);continue}if("error"in l){o(this.getRpcError(c,l));continue}a(l.result)}}catch(r){this.emit("debug",{action:"receiveRpcError",error:r});for(const{reject:a}of n)a(r)}})()}},e)}constructor(e,t){super(e,t),this.#t=1,this.#e=Object.assign({},JE,t||{}),this.#n=[],this.#i=null,this.#a=null,this.#r=null;{let s=null;const r=new Promise(a=>{s=a});this.#s={promise:r,resolve:s}}const n=this._getOption("staticNetwork");typeof n=="boolean"?(V(!n||e!=="any","staticNetwork cannot be used on special network 'any'","options",t),n&&e!=null&&(this.#a=ni.from(e))):n&&(V(e==null||n.matches(e),"staticNetwork MUST match network object","options",t),this.#a=n)}_getOption(e){return this.#e[e]}get _network(){return pe(this.#a,"network is not available yet","NETWORK_ERROR"),this.#a}async _perform(e){if(e.method==="call"||e.method==="estimateGas"){let n=e.transaction;if(n&&n.type!=null&&Ne(n.type)&&n.maxFeePerGas==null&&n.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(e=Object.assign({},e,{transaction:Object.assign({},n,{type:void 0})}))}}const t=this.getRpcRequest(e);return t!=null?await this.send(t.method,t.args):super._perform(e)}async _detectNetwork(){const e=this._getOption("staticNetwork");if(e)if(e===!0){if(this.#a)return this.#a}else return e;return this.#r?await this.#r:this.ready?(this.#r=(async()=>{try{const t=ni.from(Ne(await this.send("eth_chainId",[])));return this.#r=null,t}catch(t){throw this.#r=null,t}})(),await this.#r):(this.#r=(async()=>{const t={id:this.#t++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:t});let n;try{n=(await this._send(t))[0],this.#r=null}catch(s){throw this.#r=null,this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:n}),"result"in n)return ni.from(Ne(n.result));throw this.getRpcError(t,n)})(),await this.#r)}_start(){this.#s==null||this.#s.resolve==null||(this.#s.resolve(),this.#s=null,(async()=>{for(;this.#a==null&&!this.destroyed;)try{this.#a=await this._detectNetwork()}catch(e){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Qt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:e}})),await l2(1e3)}this.#o()})())}async _waitUntilReady(){if(this.#s!=null)return await this.#s.promise}_getSubscriber(e){return e.type==="pending"?new o2(this):e.type==="event"?this._getOption("polling")?new Sp(this,e.filter):new a2(this,e.filter):e.type==="orphan"&&e.filter.orphan==="drop-log"?new WE("orphan"):super._getSubscriber(e)}get ready(){return this.#s==null}getRpcTransaction(e){const t={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(n=>{if(e[n]==null)return;let s=n;n==="gasLimit"&&(s="gas"),t[s]=Ti(Ne(e[n],`tx.${n}`))}),["from","to","data"].forEach(n=>{e[n]!=null&&(t[n]=Ce(e[n]))}),e.accessList&&(t.accessList=Tr(e.accessList)),e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.map(n=>n.toLowerCase())),e.authorizationList&&(t.authorizationList=e.authorizationList.map(n=>{const s=yb(n);return{address:s.address,nonce:Ti(s.nonce),chainId:Ti(s.chainId),yParity:Ti(s.signature.yParity),r:Ti(s.signature.r),s:Ti(s.signature.s)}})),t}getRpcRequest(e){switch(e.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Za(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Za(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[Za(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Za(e.address),"0x"+e.position.toString(16),e.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[e.signedTransaction]};case"getBlock":if("blockTag"in e)return{method:"eth_getBlockByNumber",args:[e.blockTag,!!e.includeTransactions]};if("blockHash"in e)return{method:"eth_getBlockByHash",args:[e.blockHash,!!e.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[e.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[e.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(e.transaction),e.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(e.transaction)]};case"getLogs":return e.filter&&e.filter.address!=null&&(Array.isArray(e.filter.address)?e.filter.address=e.filter.address.map(Za):e.filter.address=Za(e.filter.address)),{method:"eth_getLogs",args:[e.filter]}}return null}getRpcError(e,t){const{method:n}=e,{error:s}=t;if(n==="eth_estimateGas"&&s.message){const o=s.message;if(!o.match(/revert/i)&&o.match(/insufficient funds/i))return Qt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:e.params[0],info:{payload:e,error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return Qt("nonce has already been used","NONCE_EXPIRED",{transaction:e.params[0],info:{payload:e,error:s}})}if(n==="eth_call"||n==="eth_estimateGas"){const o=Np(s),c=ja.getBuiltinCallException(n==="eth_call"?"call":"estimateGas",e.params[0],o?o.data:null);return c.info={error:s,payload:e},c}const r=JSON.stringify(u2(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return Qt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[n]||"unknown",reason:"rejected",info:{payload:e,error:s}});if(n==="eth_sendRawTransaction"||n==="eth_sendTransaction"){const o=e.params[0];if(r.match(/insufficient funds|base fee exceeds gas limit/i))return Qt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o,info:{error:s}});if(r.match(/nonce/i)&&r.match(/too low/i))return Qt("nonce has already been used","NONCE_EXPIRED",{transaction:o,info:{error:s}});if(r.match(/replacement transaction/i)&&r.match(/underpriced/i))return Qt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o,info:{error:s}});if(r.match(/only replay-protected/i))return Qt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:n,info:{transaction:o,info:{error:s}}})}let a=!!r.match(/the method .* does not exist/i);return a||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(a=!0),a?Qt("unsupported operation","UNSUPPORTED_OPERATION",{operation:e.method,info:{error:s,payload:e}}):Qt("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:e})}send(e,t){if(this.destroyed)return Promise.reject(Qt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e}));const n=this.#t++,s=new Promise((r,a)=>{this.#n.push({resolve:r,reject:a,payload:{method:e,params:t,id:n,jsonrpc:"2.0"}})});return this.#o(),s}async getSigner(e){e==null&&(e=0);const t=this.send("eth_accounts",[]);if(typeof e=="number"){const s=await t;if(e>=s.length)throw new Error("no such account");return new Fp(this,s[e])}const{accounts:n}=await Gn({network:this.getNetwork(),accounts:t});e=St(e);for(const s of n)if(St(s)===e)return new Fp(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(t=>new Fp(this,t))}destroy(){this.#i&&(clearTimeout(this.#i),this.#i=null);for(const{payload:e,reject:t}of this.#n)t(Qt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e.method}));this.#n=[],super.destroy()}}class ZE extends h2{#e;constructor(e,t){super(e,t);let n=this._getOption("pollingInterval");n==null&&(n=JE.pollingInterval),this.#e=n}_getSubscriber(e){const t=super._getSubscriber(e);return YE(t)&&(t.pollingInterval=this.#e),t}get pollingInterval(){return this.#e}set pollingInterval(e){if(!Number.isInteger(e)||e<0)throw new Error("invalid interval");this.#e=e,this._forEachSubscriber(t=>{YE(t)&&(t.pollingInterval=this.#e)})}}class $E extends ZE{#e;constructor(e,t,n){e==null&&(e="http://localhost:8545"),super(t,n),typeof e=="string"?this.#e=new Hi(e):this.#e=e.clone()}_getConnection(){return this.#e.clone()}async send(e,t){return await this._start(),await super.send(e,t)}async _send(e){const t=this._getConnection();t.body=JSON.stringify(e),t.setHeader("content-type","application/json");const n=await t.send();n.assertOk();let s=n.bodyJson;return Array.isArray(s)||(s=[s]),s}}function Np(i){if(i==null)return null;if(typeof i.message=="string"&&i.message.match(/revert/i)&&Pt(i.data))return{message:i.message,data:i.data};if(typeof i=="object"){for(const e in i){const t=Np(i[e]);if(t)return t}return null}if(typeof i=="string")try{return Np(JSON.parse(i))}catch{}return null}function Dp(i,e){if(i!=null){if(typeof i.message=="string"&&e.push(i.message),typeof i=="object")for(const t in i)Dp(i[t],e);if(typeof i=="string")try{return Dp(JSON.parse(i),e)}catch{}}}function u2(i){const e=[];return Dp(i,e),e}class zr extends ZE{#e;#t;constructor(e,t,n){const s=Object.assign({},n??{},{batchMaxCount:1});V(e&&e.request,"invalid EIP-1193 provider","ethereum",e),super(t,s),this.#t=null,n&&n.providerInfo&&(this.#t=n.providerInfo),this.#e=async(r,a)=>{const o={method:r,params:a};this.emit("debug",{action:"sendEip1193Request",payload:o});try{const c=await e.request(o);return this.emit("debug",{action:"receiveEip1193Result",result:c}),c}catch(c){const l=new Error(c.message);throw l.code=c.code,l.data=c.data,l.payload=o,this.emit("debug",{action:"receiveEip1193Error",error:l}),l}}}get providerInfo(){return this.#t}async send(e,t){return await this._start(),await super.send(e,t)}async _send(e){V(!Array.isArray(e),"EIP-1193 does not support batch request","payload",e);try{const t=await this.#e(e.method,e.params||[]);return[{id:e.id,result:t}]}catch(t){return[{id:e.id,error:{code:t.code,data:t.data,message:t.message}}]}}getRpcError(e,t){switch(t=JSON.parse(JSON.stringify(t)),t.error.code||-1){case 4001:t.error.message=`ethers-user-denied: ${t.error.message}`;break;case 4200:t.error.message=`ethers-unsupported: ${t.error.message}`;break}return super.getRpcError(e,t)}async hasSigner(e){e==null&&(e=0);const t=await this.send("eth_accounts",[]);return typeof e=="number"?t.length>e:(e=e.toLowerCase(),t.filter(n=>n.toLowerCase()===e).length!==0)}async getSigner(e){if(e==null&&(e=0),!await this.hasSigner(e))try{await this.#e("eth_requestAccounts",[])}catch(t){const n=t.payload;throw this.getRpcError(n,{id:n.id,error:t})}return await super.getSigner(e)}static async discover(e){if(e==null&&(e={}),e.provider)return new zr(e.provider);const t=e.window?e.window:typeof window<"u"?window:null;if(t==null)return null;const n=e.anyProvider;if(n&&t.ethereum)return new zr(t.ethereum);if(!("addEventListener"in t&&"dispatchEvent"in t&&"removeEventListener"in t))return null;const s=e.timeout?e.timeout:300;return s===0?null:await new Promise((r,a)=>{let o=[];const c=u=>{o.push(u.detail),n&&l()},l=()=>{if(clearTimeout(h),o.length)if(e&&e.filter){const u=e.filter(o.map(d=>Object.assign({},d.info)));if(u==null)r(null);else if(u instanceof zr)r(u);else{let d=null;if(u.uuid&&(d=o.filter(p=>u.uuid===p.info.uuid)[0]),d){const{provider:f,info:p}=d;r(new zr(f,void 0,{providerInfo:p}))}else a(Qt("filter returned unknown info","UNSUPPORTED_OPERATION",{value:u}))}}else{const{provider:u,info:d}=o[0];r(new zr(u,void 0,{providerInfo:d}))}else r(null);t.removeEventListener("eip6963:announceProvider",c)},h=setTimeout(()=>{l()},s);t.addEventListener("eip6963:announceProvider",c),t.dispatchEvent(new Event("eip6963:requestProvider"))})}}const ey=["function register() external returns (uint256 agentId)","function register(string agentURI) external returns (uint256 agentId)","function register(string agentURI, tuple(string metadataKey, bytes metadataValue)[] metadata) external returns (uint256 agentId)","function setAgentURI(uint256 agentId, string newURI) external","function tokenURI(uint256 tokenId) external view returns (string)","function setMetadata(uint256 agentId, string metadataKey, bytes metadataValue) external","function getMetadata(uint256 agentId, string metadataKey) external view returns (bytes)","function getAgentWallet(uint256 agentId) external view returns (address)","function ownerOf(uint256 tokenId) external view returns (address)","function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function totalSupply() external view returns (uint256)","function name() external view returns (string)","function symbol() external view returns (string)","function getVersion() external pure returns (string)","function transferFrom(address from, address to, uint256 tokenId) external","function safeTransferFrom(address from, address to, uint256 tokenId) external","function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external","function approve(address to, uint256 tokenId) external","function setApprovalForAll(address operator, bool approved) external","event Registered(uint256 indexed agentId, string agentURI, address indexed owner)","event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"],Vr={identityRegistry:"0x8004A818BFB912233c491871b3d84c89A494BD9e",reputationRegistry:"0x8004B663056A597Dffe9eCcC1965A193B7388713",validationRegistry:"0x8004Cb1BF31DAf7788923b405b754f57acEB4272"},qn={identityRegistry:"0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",reputationRegistry:"0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",validationRegistry:""},Ph={1:qn,10:qn,56:qn,100:qn,137:qn,250:qn,324:qn,1284:qn,5e3:qn,8453:qn,42161:qn,42220:qn,43114:qn,59144:qn,534352:qn,97:Vr,11155111:Vr,84532:Vr,421614:Vr,11155420:Vr,80002:Vr,43113:Vr};function d2(i,e){return`eip155:${i}:${e}`}const ty={1:{name:"Ethereum",shortName:"ETH",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://ethereum-rpc.publicnode.com",explorer:"https://etherscan.io",testnet:!1},10:{name:"Optimism",shortName:"OP",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://mainnet.optimism.io",explorer:"https://optimistic.etherscan.io",testnet:!1},56:{name:"BNB Chain",shortName:"BSC",currency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrl:"https://bsc-dataseed.bnbchain.org",explorer:"https://bscscan.com",testnet:!1},100:{name:"Gnosis",shortName:"GNO",currency:{name:"xDAI",symbol:"xDAI",decimals:18},rpcUrl:"https://rpc.gnosischain.com",explorer:"https://gnosisscan.io",testnet:!1},137:{name:"Polygon",shortName:"POL",currency:{name:"POL",symbol:"POL",decimals:18},rpcUrl:"https://polygon-rpc.com",explorer:"https://polygonscan.com",testnet:!1},250:{name:"Fantom",shortName:"FTM",currency:{name:"Fantom",symbol:"FTM",decimals:18},rpcUrl:"https://rpc.ftm.tools",explorer:"https://ftmscan.com",testnet:!1},324:{name:"zkSync Era",shortName:"zkSync",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://mainnet.era.zksync.io",explorer:"https://explorer.zksync.io",testnet:!1},1284:{name:"Moonbeam",shortName:"GLMR",currency:{name:"Glimmer",symbol:"GLMR",decimals:18},rpcUrl:"https://rpc.api.moonbeam.network",explorer:"https://moonbeam.moonscan.io",testnet:!1},5e3:{name:"Mantle",shortName:"MNT",currency:{name:"Mantle",symbol:"MNT",decimals:18},rpcUrl:"https://rpc.mantle.xyz",explorer:"https://explorer.mantle.xyz",testnet:!1},8453:{name:"Base",shortName:"Base",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://mainnet.base.org",explorer:"https://basescan.org",testnet:!1},42161:{name:"Arbitrum One",shortName:"ARB",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://arb1.arbitrum.io/rpc",explorer:"https://arbiscan.io",testnet:!1},42220:{name:"Celo",shortName:"CELO",currency:{name:"Celo",symbol:"CELO",decimals:18},rpcUrl:"https://forno.celo.org",explorer:"https://celoscan.io",testnet:!1},43114:{name:"Avalanche",shortName:"AVAX",currency:{name:"Avax",symbol:"AVAX",decimals:18},rpcUrl:"https://api.avax.network/ext/bc/C/rpc",explorer:"https://snowtrace.io",testnet:!1},59144:{name:"Linea",shortName:"Linea",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://rpc.linea.build",explorer:"https://lineascan.build",testnet:!1},534352:{name:"Scroll",shortName:"Scroll",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://rpc.scroll.io",explorer:"https://scrollscan.com",testnet:!1},97:{name:"BSC Testnet",shortName:"BSCt",currency:{name:"tBNB",symbol:"tBNB",decimals:18},rpcUrl:"https://bsc-testnet-rpc.publicnode.com",explorer:"https://testnet.bscscan.com",testnet:!0},11155111:{name:"Ethereum Sepolia",shortName:"Sep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://ethereum-sepolia-rpc.publicnode.com",explorer:"https://sepolia.etherscan.io",testnet:!0},84532:{name:"Base Sepolia",shortName:"BaseSep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://sepolia.base.org",explorer:"https://sepolia.basescan.org",testnet:!0},421614:{name:"Arbitrum Sepolia",shortName:"ArbSep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://sepolia-rollup.arbitrum.io/rpc",explorer:"https://sepolia.arbiscan.io",testnet:!0},11155420:{name:"Optimism Sepolia",shortName:"OpSep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://sepolia.optimism.io",explorer:"https://sepolia-optimism.etherscan.io",testnet:!0},80002:{name:"Polygon Amoy",shortName:"Amoy",currency:{name:"POL",symbol:"POL",decimals:18},rpcUrl:"https://rpc-amoy.polygon.technology",explorer:"https://amoy.polygonscan.com",testnet:!0},43113:{name:"Avalanche Fuji",shortName:"Fuji",currency:{name:"Avax",symbol:"AVAX",decimals:18},rpcUrl:"https://api.avax-test.network/ext/bc/C/rpc",explorer:"https://testnet.snowtrace.io",testnet:!0}};function f2(i,e){if(e)return new zr(e);const t=ty[i];if(!t)throw new Error(`No RPC configured for chainId ${i}`);return new $E(t.rpcUrl,i)}function p2(i,e){const t=Ph[i];if(!t||!t.identityRegistry)throw new Error(`No Identity Registry for chainId ${i}`);const n=f2(i,e);return new Gr(t.identityRegistry,ey,n)}async function A2({chainId:i,agentId:e,ethProvider:t}){const n=p2(i,t),[s,r]=await Promise.all([n.ownerOf(e).catch(()=>null),n.tokenURI(e).catch(()=>null)]);return{agentId:BigInt(e),owner:s,uri:r}}function ny(i){if(!i||typeof i!="object")return null;const e=Array.isArray(i.services)?i.services:[];for(const n of e){if(!n||typeof n!="object")continue;const s=String(n.endpoint||"").trim();if(!s)continue;const r=String(n.name||"").toLowerCase(),a=String(n.version||"").toLowerCase();if(r==="avatar"||r==="avatar-3d"||a.startsWith("gltf")||/\.(glb|gltf)(\?|#|$)/i.test(s))return s}const t=String(i.image||"").trim();return/\.(glb|gltf)(\?|#|$)/i.test(t)?t:null}async function g2(i){if(!i)return{ok:!1,error:"empty uri"};if(i.startsWith("data:"))try{const t=i.match(/^data:application\/json(?:;base64)?,(.*)$/);if(!t)return{ok:!1,error:"unsupported data URI"};const n=/;base64,/.test(i)?atob(t[1]):decodeURIComponent(t[1]);return{ok:!0,data:JSON.parse(n),resolvedUrl:i}}catch(t){return{ok:!1,error:"data URI parse failed: "+t.message}}let e=i;i.startsWith("ipfs://")?e="https://ipfs.io/ipfs/"+i.slice(7):i.startsWith("ar://")&&(e="https://arweave.net/"+i.slice(5));try{const t=await fetch(e);return t.ok?{ok:!0,data:await t.json(),resolvedUrl:e}:{ok:!1,error:`HTTP ${t.status}`,resolvedUrl:e}}catch(t){return{ok:!1,error:t.message,resolvedUrl:e}}}const m2={base:8453,"base-mainnet":8453,"base-sepolia":84532,ethereum:1,mainnet:1},x2={8453:"https://mainnet.base.org",84532:"https://sepolia.base.org",1:"https://eth.llamarpc.com"};async function Lp(i,{rpcURL:e,registry:t}={}){if(!i)throw new Error("loadManifest: source required");if(i.startsWith("agent://"))return b2(i,{rpcURL:e,registryOverride:t});if(i.startsWith("ipfs://")||i.startsWith("ar://")){const n=ls(i),s=await Pp(n);return kh(s,{baseURI:kp(n)})}if(i.startsWith("http")){const n=await Pp(i);return kh(n,{baseURI:kp(i)})}throw new Error(`Unsupported manifest source: ${i}`)}async function b2(i,{rpcURL:e,registryOverride:t}){const n=i.match(/^agent:\/\/([^/]+)\/(\d+)$/);if(!n)throw new Error(`Malformed agent URI: ${i}`);const[,s,r]=n,a=m2[s.toLowerCase()]||Number(s);if(!a)throw new Error(`Unknown chain: ${s}`);const o=Ph[a],c=t||o?.identityRegistry;if(!c)throw new Error(`No registry deployed on chain ${a}. Pass registry= override.`);const l=new $E(e||x2[a]),h=new Gr(c,ey,l),u=BigInt(r),d=await h.tokenURI(u);if(!d)throw new Error(`Agent ${r} on chain ${a} has no URI`);const f=ls(d),p=await Pp(f),m=kh(p,{baseURI:kp(f)});return m.id={...m.id,chain:s,chainId:a,registry:c,agentId:r},m}async function Pp(i){let e;try{e=await fetch(i)}catch{e=await j0(i)}if(!e.ok)throw new Error(`Manifest fetch failed: ${i} (${e.status})`);return e.json()}function kh(i,{baseURI:e=""}={}){if(i.spec&&i.spec.startsWith("agent-manifest/")){const t={...i,_baseURI:e};return t.body=t.body||{},!t.body.uri&&t.image&&(t.body.uri=t.image),t}if(i.type&&i.type.includes("eip-8004")){const t=i.registrations?.[0]||{},n=ny(i);return{spec:"agent-manifest/0.1",_baseURI:e,_source:"erc8004-registration",id:{agentId:t.agentId?.toString()},name:i.name,description:i.description,image:i.image,body:{uri:ls(n||i.image||""),format:"gltf-binary"},brain:{provider:"none"},voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:[],memory:{mode:"local"},tools:["wave","lookAt","play_clip","setExpression"],version:"0.1.0",services:Array.isArray(i.services)?i.services:[],x402Support:!!i.x402Support,embedPolicy:i.embedPolicy||null}}return{spec:"agent-manifest/0.1",_baseURI:e,name:i.name||"Unnamed agent",description:i.description||"",body:{uri:i.body?.uri||i.image||i.model||"",format:i.body?.format||"gltf-binary"},brain:i.brain||{provider:"none"},voice:i.voice||{tts:{provider:"browser"},stt:{provider:"browser"}},skills:i.skills||[],memory:i.memory||{mode:"local"},tools:i.tools||["wave","lookAt","play_clip","setExpression"],version:i.version||"0.1.0"}}function kp(i){const e=i.lastIndexOf("/");return e>=0?i.slice(0,e+1):i}async function iy(i,e){if(!i._baseURI)return null;try{const t=new URL(e,i._baseURI).href,n=await fetch(t);return n.ok?n.text():null}catch{return null}}class _s extends Error{constructor(e,t,{status:n}={}){super(t),this.name="AgentResolveError",this.code=e,n!==void 0&&(this.status=n)}}async function sy(i,{fetchFn:e}){let t;try{t=await e(i,{credentials:"include"})}catch(n){throw new _s("network",`network error fetching ${i}: ${n.message||n}`)}if(t.status===401||t.status===403)throw new _s("unauthorized",`unauthorized fetching ${i} (${t.status})`,{status:t.status});if(t.status===404)throw new _s("not_found",`resource not found: ${i}`,{status:404});if(!t.ok)throw new _s("network",`request failed: ${i} (${t.status})`,{status:t.status});try{return await t.json()}catch(n){throw new _s("network",`invalid JSON from ${i}: ${n.message||n}`)}}async function E2(i,{origin:e=typeof location<"u"?location.origin:"",fetchFn:t=fetch}={}){if(!i)throw new _s("not_found","agentId required");const n=t.bind(typeof globalThis<"u"?globalThis:void 0),r=(await sy(`${e}/api/agents/${encodeURIComponent(i)}`,{fetchFn:n}))?.agent;if(!r)throw new _s("not_found",`agent ${i} not found`);if(!r.avatar_id)throw new _s("no_avatar",`agent ${i} has no avatar bound`);const o=(await sy(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`,{fetchFn:n}))?.avatar;if(!o||!o.url)throw new _s("no_avatar",`avatar ${r.avatar_id} has no url`);const c=Array.isArray(r.skills)?r.skills.map(l=>typeof l=="string"?{name:l}:l).filter(Boolean):[];return{spec:"agent-manifest/0.1",name:r.name||"Agent",description:r.description||"",id:{agentId:r.id,owner:r.wallet_address,chainId:r.chain_id,walletAddress:r.wallet_address},body:{uri:o.url,format:"gltf-binary"},brain:{},voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:c,memory:{mode:"remote",namespace:r.id},tools:["wave","lookAt","play_clip","setExpression","speak","remember"],version:"0.1.0",_baseURI:`${e}/agent/${r.id}/`,_source:"agent-id"}}function ry(i){if(!i)return null;if(typeof i=="object")return i.chainId&&i.agentId!==void 0?{chainId:Number(i.chainId),agentId:String(i.agentId),registry:i.registry||void 0}:null;const e=String(i).trim();if(!e)return null;let t=e.match(/^eip155:(\d+):(0x[0-9a-fA-F]{40}):(\d+)$/);return t?{chainId:Number(t[1]),registry:t[2],agentId:t[3]}:(t=e.match(/^eip155:(\d+)\/erc721:(0x[0-9a-fA-F]{40})\/(\d+)$/),t?{chainId:Number(t[1]),registry:t[2],agentId:t[3]}:(t=e.match(/^onchain:(\d+):(\d+)$/),t?{chainId:Number(t[1]),agentId:t[2]}:(t=e.match(/^agent:\/\/(\d+)\/(\d+)$/),t?{chainId:Number(t[1]),agentId:t[2]}:(t=e.match(/^\/?a\/(\d+)\/(\d+)(?:\/(embed))?\/?$/),t?{chainId:Number(t[1]),agentId:t[2]}:(t=e.match(/^\/?a\/(\d+)\/(0x[0-9a-fA-F]{40})\/(\d+)\/?$/),t?{chainId:Number(t[1]),registry:t[2],agentId:t[3]}:null)))))}function y2(i){const e=i.registry||Ph[i.chainId]?.identityRegistry;return e?`eip155:${i.chainId}:${e}:${i.agentId}`:`onchain:${i.chainId}:${i.agentId}`}function _2(i,{embed:e=!1,origin:t}={}){return`${t||(typeof location<"u"?location.origin:"")}/a/${i.chainId}/${i.agentId}${e?"/embed":""}`}const w2=["https://ipfs.io/ipfs/","https://dweb.link/ipfs/","https://cloudflare-ipfs.com/ipfs/","https://gateway.pinata.cloud/ipfs/"],v2="https://arweave.net/";function ay(i){return i?i.startsWith("ipfs://")?w2[0]+i.slice(7):i.startsWith("ar://")?v2+i.slice(5):i:""}const bc=new Map;function C2(i){return`${i.chainId}:${i.agentId}`}async function I2(i,{ethProvider:e,fresh:t=!1}={}){const n=ry(i);if(!n)throw new Error(`Unrecognised agent reference: ${i}`);const s={chainId:n.chainId,agentId:String(n.agentId),registry:n.registry||Ph[n.chainId]?.identityRegistry||null};if(!s.registry)throw new Error(`No registry deployed on chain ${s.chainId}`);const r=C2(s);if(!t&&bc.has(r))return bc.get(r);const a=ty[s.chainId]||null,o={ref:s,caip:y2(s),publicUrl:typeof location<"u"?_2(s):`/a/${s.chainId}/${s.agentId}`,chain:a?{name:a.name,testnet:!!a.testnet,explorer:a.explorer}:null,onchain:{owner:null,uri:null},metadata:null,metadataUrl:null,image:null,glbUrl:null,name:`Agent #${s.agentId}`,description:"",services:[]};try{const{owner:c,uri:l}=await A2({chainId:s.chainId,agentId:s.agentId,ethProvider:e});if(o.onchain={owner:c,uri:l},!l)return o.error="agentURI not set",bc.set(r,o),o;const h=await g2(l);if(!h.ok)return o.error=h.error,o.metadataUrl=h.resolvedUrl||null,bc.set(r,o),o;const u=h.data;o.metadata=u,o.metadataUrl=h.resolvedUrl||null,o.name=u?.name&&String(u.name)||o.name,o.description=u?.description&&String(u.description)||"",o.image=u?.image?String(u.image):null,o.services=Array.isArray(u?.services)?u.services:[],o.glbUrl=ny(u)}catch(c){o.error=c.message||String(c)}return bc.set(r,o),o}function S2(i){const e=Array.isArray(i.services)?i.services:[],t=e.find(a=>/brain|llm|chat/i.test(a?.name||a?.type||"")),n=e.filter(a=>/skill/i.test(a?.name||a?.type||"")),s=i.glbUrl?ay(i.glbUrl):"",r=i.image?ay(i.image):"";return{spec:"agent-manifest/0.1",_baseURI:i.metadataUrl?M2(i.metadataUrl):"",_source:"erc8004-resolver",id:{agentId:i.ref.agentId,chainId:i.ref.chainId,registry:i.ref.registry,owner:i.onchain.owner||void 0,walletAddress:i.onchain.owner||void 0,caip:i.caip,agentRegistry:d2(i.ref.chainId,i.ref.registry)},name:i.name,description:i.description,image:r,body:{uri:s||r,format:"gltf-binary"},brain:t?{provider:"remote",endpoint:t.endpoint}:{provider:"none"},voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:n.map(a=>({name:a.name,uri:a.endpoint})),memory:{mode:"local",namespace:i.caip},tools:["wave","lookAt","play_clip","setExpression"],version:"0.1.0",services:e,x402Support:!!(i.metadata?.x402Support||i.metadata?.x402),embedPolicy:i.metadata?.embedPolicy||null}}function M2(i){const e=i.lastIndexOf("/");return e>=0?i.slice(0,e+1):i}const B2=["inline","floating","section","fullscreen"],oy=(()=>{try{return new URL(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:nr&&nr.tagName.toUpperCase()==="SCRIPT"&&nr.src||new URL("agent-3d.umd.cjs",document.baseURI).href).origin}catch{return""}})();function T2(i,e,t=[]){if(!i)return!1;let n;try{n=new URL(i).hostname.toLowerCase()}catch{return!1}if(t.some(o=>n===o||n.endsWith("."+o)))return!0;const s=e?.origins?.hosts??[],r=e?.origins?.mode??"allowlist",a=s.some(o=>{const c=o.toLowerCase();return c.startsWith("*.")?n.endsWith(c.slice(1))&&n!==c.slice(2):n===c});return r==="allowlist"?a:!a}const R2=`
+`)}async export(){return{version:"memory/0.1",index:this.indexText,files:Object.fromEntries(this.files),timeline:this.timeline}}async import(e,{strategy:t="merge"}={}){if(t==="replace")this.files=new Map(Object.entries(e.files||{})),this.timeline=e.timeline||[];else{for(const[n,s]of Object.entries(e.files||{}))this.files.has(n)||this.files.set(n,s);this.timeline=[...this.timeline,...e.timeline||[]].slice(-1e3)}this._rebuildIndex(),this._persist()}}const KR="6.16.0";function jR(i,e,t){const n=e.split("|").map(r=>r.trim());for(let r=0;r<n.length;r++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof i===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=i,s}async function Hn(i){const e=Object.keys(i);return(await Promise.all(e.map(n=>Promise.resolve(i[n])))).reduce((n,s,r)=>(n[e[r]]=s,n),{})}function Ye(i,e,t){for(let n in e){let s=e[n];const r=t?t[n]:null;r&&jR(s,r,n),Object.defineProperty(i,n,{enumerable:!0,value:s,writable:!1})}}function Pa(i,e){if(i==null)return"null";if(e==null&&(e=new Set),typeof i=="object"){if(e.has(i))return"[Circular]";e.add(i)}if(Array.isArray(i))return"[ "+i.map(t=>Pa(t,e)).join(", ")+" ]";if(i instanceof Uint8Array){const t="0123456789abcdef";let n="0x";for(let s=0;s<i.length;s++)n+=t[i[s]>>4],n+=t[i[s]&15];return n}if(typeof i=="object"&&typeof i.toJSON=="function")return Pa(i.toJSON(),e);switch(typeof i){case"boolean":case"number":case"symbol":return i.toString();case"bigint":return BigInt(i).toString();case"string":return JSON.stringify(i);case"object":{const t=Object.keys(i);return t.sort(),"{ "+t.map(n=>`${Pa(n,e)}: ${Pa(i[n],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Tn(i,e){return i&&i.code===e}function Tf(i){return Tn(i,"CALL_EXCEPTION")}function Qt(i,e,t){let n=i;{const r=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${Pa(t)}`);for(const a in t){if(a==="shortMessage")continue;const o=t[a];r.push(a+"="+Pa(o))}}r.push(`code=${e}`),r.push(`version=${KR}`),r.length&&(i+=" ("+r.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(i);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(i);break;default:s=new Error(i)}return Ye(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&Ye(s,{shortMessage:n}),s}function pe(i,e,t,n){if(!i)throw Qt(e,t,n)}function V(i,e,t,n){pe(i,e,"INVALID_ARGUMENT",{argument:t,value:n})}function nx(i,e,t){t==null&&(t=""),t&&(t=": "+t),pe(i>=e,"missing argument"+t,"MISSING_ARGUMENT",{count:i,expectedCount:e}),pe(i<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:i,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((i,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");i.push(e)}catch{}return i},[]);function ih(i,e,t){if(t==null&&(t=""),i!==e){let n=t,s="new";t&&(n+=".",s+=" "+t),pe(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function ix(i,e,t){if(i instanceof Uint8Array)return t?new Uint8Array(i):i;if(typeof i=="string"&&i.length%2===0&&i.match(/^0x[0-9a-f]*$/i)){const n=new Uint8Array((i.length-2)/2);let s=2;for(let r=0;r<n.length;r++)n[r]=parseInt(i.substring(s,s+2),16),s+=2;return n}V(!1,"invalid BytesLike value",e||"value",i)}function ut(i,e){return ix(i,e,!1)}function zn(i,e){return ix(i,e,!0)}function Pt(i,e){return!(typeof i!="string"||!i.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&i.length!==2+2*e||e===!0&&i.length%2!==0)}function Rf(i){return Pt(i,!0)||i instanceof Uint8Array}const sx="0123456789abcdef";function Ce(i){const e=ut(i);let t="0x";for(let n=0;n<e.length;n++){const s=e[n];t+=sx[(s&240)>>4]+sx[s&15]}return t}function Gt(i){return"0x"+i.map(e=>Ce(e).substring(2)).join("")}function ka(i){return Pt(i,!0)?(i.length-2)/2:ut(i).length}function Kt(i,e,t){const n=ut(i);return t!=null&&t>n.length&&pe(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:t}),Ce(n.slice(e??0,t??n.length))}function rx(i,e,t){const n=ut(i);pe(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),t?s.set(n,e-n.length):s.set(n,0),Ce(s)}function us(i,e){return rx(i,e,!0)}function XR(i,e){return rx(i,e,!1)}const Jo=BigInt(0),Ti=BigInt(1),Ua=9007199254740991;function YR(i,e){const t=sh(i,"value"),n=BigInt(dt(e,"width"));if(pe(t>>n===Jo,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:i}),t>>n-Ti){const s=(Ti<<n)-Ti;return-((~t&s)+Ti)}return t}function ax(i,e){let t=Ne(i,"value");const n=BigInt(dt(e,"width")),s=Ti<<n-Ti;if(t<Jo){t=-t,pe(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:i});const r=(Ti<<n)-Ti;return(~t&r)+Ti}else pe(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:i});return t}function Zo(i,e){const t=sh(i,"value"),n=BigInt(dt(e,"bits"));return t&(Ti<<n)-Ti}function Ne(i,e){switch(typeof i){case"bigint":return i;case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-Ua&&i<=Ua,"overflow",e||"value",i),BigInt(i);case"string":try{if(i==="")throw new Error("empty string");return i[0]==="-"&&i[1]!=="-"?-BigInt(i.substring(1)):BigInt(i)}catch(t){V(!1,`invalid BigNumberish string: ${t.message}`,e||"value",i)}}V(!1,"invalid BigNumberish value",e||"value",i)}function sh(i,e){const t=Ne(i,e);return pe(t>=Jo,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:i}),t}const ox="0123456789abcdef";function Ff(i){if(i instanceof Uint8Array){let e="0x0";for(const t of i)e+=ox[t>>4],e+=ox[t&15];return BigInt(e)}return Ne(i)}function dt(i,e){switch(typeof i){case"bigint":return V(i>=-Ua&&i<=Ua,"overflow",e||"value",i),Number(i);case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-Ua&&i<=Ua,"overflow",e||"value",i),i;case"string":try{if(i==="")throw new Error("empty string");return dt(BigInt(i),e)}catch(t){V(!1,`invalid numeric string: ${t.message}`,e||"value",i)}}V(!1,"invalid numeric value",e||"value",i)}function JR(i){return dt(Ff(i))}function Ks(i,e){const t=sh(i,"value");let n=t.toString(16);if(e==null)n.length%2&&(n="0"+n);else{const s=dt(e,"width");if(s===0&&t===Jo)return"0x";for(pe(s*2>=n.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:i});n.length<s*2;)n="0"+n}return"0x"+n}function rn(i,e){const t=sh(i,"value");if(t===Jo)return new Uint8Array(0);let n=t.toString(16);n.length%2&&(n="0"+n);const s=new Uint8Array(n.length/2);for(let r=0;r<s.length;r++){const a=r*2;s[r]=parseInt(n.substring(a,a+2),16)}return s}function Ri(i){let e=Ce(Rf(i)?i:rn(i)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const cx="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const lx=BigInt(58);function ZR(i){const e=ut(i);let t=Ff(e),n="";for(;t;)n=cx[Number(t%lx)]+n,t/=lx;for(let s=0;s<e.length&&!e[s];s++)n=cx[0]+n;return n}function $R(i){i=atob(i);const e=new Uint8Array(i.length);for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return ut(e)}function eF(i){const e=ut(i);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}class hx{filter;emitter;#e;constructor(e,t,n){this.#e=t,Ye(this,{emitter:e,filter:n})}async removeListener(){this.#e!=null&&await this.emitter.off(this.filter,this.#e)}}function tF(i,e,t,n,s){V(!1,`invalid codepoint at offset ${e}; ${i}`,"bytes",t)}function ux(i,e,t,n,s){if(i==="BAD_PREFIX"||i==="UNEXPECTED_CONTINUE"){let r=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)r++;return r}return i==="OVERRUN"?t.length-e-1:0}function nF(i,e,t,n,s){return i==="OVERLONG"?(V(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),n.push(s),0):(n.push(65533),ux(i,e,t))}const iF=Object.freeze({error:tF,ignore:ux,replace:nF});function sF(i,e){e==null&&(e=iF.error);const t=ut(i,"bytes"),n=[];let s=0;for(;s<t.length;){const r=t[s++];if(r>>7===0){n.push(r);continue}let a=null,o=null;if((r&224)===192)a=1,o=127;else if((r&240)===224)a=2,o=2047;else if((r&248)===240)a=3,o=65535;else{(r&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,t,n):s+=e("BAD_PREFIX",s-1,t,n);continue}if(s-1+a>=t.length){s+=e("OVERRUN",s-1,t,n);continue}let c=r&(1<<8-a-1)-1;for(let l=0;l<a;l++){let h=t[s];if((h&192)!=128){s+=e("MISSING_CONTINUE",s,t,n),c=null;break}c=c<<6|h&63,s++}if(c!==null){if(c>1114111){s+=e("OUT_OF_RANGE",s-1-a,t,n,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-a,t,n,c);continue}if(c<=o){s+=e("OVERLONG",s-1-a,t,n,c);continue}n.push(c)}}return n}function ds(i,e){V(typeof i=="string","invalid string value","str",i);let t=[];for(let n=0;n<i.length;n++){const s=i.charCodeAt(n);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){n++;const r=i.charCodeAt(n);V(n<i.length&&(r&64512)===56320,"invalid surrogate pair","str",i);const a=65536+((s&1023)<<10)+(r&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function rF(i){return i.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function rh(i,e){return rF(sF(i,e))}function dx(i){async function e(t,n){pe(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const s=t.url.split(":")[0].toLowerCase();pe(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),pe(s==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let r=null;const a=new AbortController,o=setTimeout(()=>{r=Qt("request timeout","TIMEOUT"),a.abort()},t.timeout);n&&n.addListener(()=>{r=Qt("request cancelled","CANCELLED"),a.abort()});const c=Object.assign({},i,{method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:a.signal});let l;try{l=await fetch(t.url,c)}catch(f){throw clearTimeout(o),r||f}clearTimeout(o);const h={};l.headers.forEach((f,p)=>{h[p.toLowerCase()]=f});const u=await l.arrayBuffer(),d=u==null?null:new Uint8Array(u);return{statusCode:l.status,statusMessage:l.statusText,headers:h,body:d}}return e}const aF=12,oF=250;let fx=dx();const cF=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),lF=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Nf=!1;async function px(i,e){try{const t=i.match(cF);if(!t)throw new Error("invalid data");return new js(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?$R(t[3]):uF(t[3]))}catch{return new js(599,"BAD REQUEST (invalid data: URI)",{},null,new zi(i))}}function Ax(i){async function e(t,n){try{const s=t.match(lF);if(!s)throw new Error("invalid link");return new zi(`${i}${s[2]}`)}catch{return new js(599,"BAD REQUEST (invalid IPFS URI)",{},null,new zi(t))}}return e}const ah={data:px,ipfs:Ax("https://gateway.ipfs.io/ipfs/")},gx=new WeakMap;class hF{#e;#t;constructor(e){this.#e=[],this.#t=!1,gx.set(e,()=>{if(!this.#t){this.#t=!0;for(const t of this.#e)setTimeout(()=>{t()},0);this.#e=[]}})}addListener(e){pe(!this.#t,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#e.push(e)}get cancelled(){return this.#t}checkSignal(){pe(!this.cancelled,"cancelled","CANCELLED",{})}}function oh(i){if(i==null)throw new Error("missing signal; should not happen");return i.checkSignal(),i}class zi{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;#c;#h;#u;get url(){return this.#a}set url(e){this.#a=String(e)}get body(){return this.#r==null?null:new Uint8Array(this.#r)}set body(e){if(e==null)this.#r=void 0,this.#o=void 0;else if(typeof e=="string")this.#r=ds(e),this.#o="text/plain";else if(e instanceof Uint8Array)this.#r=e,this.#o="application/octet-stream";else if(typeof e=="object")this.#r=ds(JSON.stringify(e)),this.#o="application/json";else throw new Error("invalid body")}hasBody(){return this.#r!=null}get method(){return this.#i?this.#i:this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),this.#i=String(e).toUpperCase()}get headers(){const e=Object.assign({},this.#n);return this.#f&&(e.authorization=`Basic ${eF(ds(this.#f))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&this.#o&&(e["content-type"]=this.#o),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){this.#n[String(e).toLowerCase()]=String(t)}clearHeaders(){this.#n={}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let n=0;return{next:()=>{if(n<t.length){const s=t[n++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#f||null}setCredentials(e,t){V(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#f=`${e}:${t}`}get allowGzip(){return this.#t}set allowGzip(e){this.#t=!!e}get allowInsecureAuthentication(){return!!this.#e}set allowInsecureAuthentication(e){this.#e=!!e}get timeout(){return this.#s}set timeout(e){V(e>=0,"timeout must be non-zero","timeout",e),this.#s=e}get preflightFunc(){return this.#l||null}set preflightFunc(e){this.#l=e}get processFunc(){return this.#p||null}set processFunc(e){this.#p=e}get retryFunc(){return this.#A||null}set retryFunc(e){this.#A=e}get getUrlFunc(){return this.#u||fx}set getUrlFunc(e){this.#u=e}constructor(e){this.#a=String(e),this.#e=!1,this.#t=!0,this.#n={},this.#i="",this.#s=3e5,this.#h={slotInterval:oF,maxAttempts:aF},this.#u=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#r?Ce(this.#r):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(this.#h.slotInterval=e.slotInterval),e.maxAttempts!=null&&(this.#h.maxAttempts=e.maxAttempts)}async#d(e,t,n,s,r){if(e>=this.#h.maxAttempts)return r.makeServerError("exceeded maximum retry limit");pe(mx()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),n>0&&await dF(n);let a=this.clone();const o=(a.url.split(":")[0]||"").toLowerCase();if(o in ah){const h=await ah[o](a.url,oh(s.#c));if(h instanceof js){let u=h;if(this.processFunc){oh(s.#c);try{u=await this.processFunc(a,u)}catch(d){(d.throttle==null||typeof d.stall!="number")&&u.makeServerError("error in post-processing function",d).assertOk()}}return u}a=h}this.preflightFunc&&(a=await this.preflightFunc(a));const c=await this.getUrlFunc(a,oh(s.#c));let l=new js(c.statusCode,c.statusMessage,c.headers,c.body,s);if(l.statusCode===301||l.statusCode===302){try{const h=l.headers.location||"";return a.redirect(h).#d(e+1,t,0,s,l)}catch{}return l}else if(l.statusCode===429&&(this.retryFunc==null||await this.retryFunc(a,l,e))){const h=l.headers["retry-after"];let u=this.#h.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(u=parseInt(h)),a.clone().#d(e+1,t,u,s,l)}if(this.processFunc){oh(s.#c);try{l=await this.processFunc(a,l)}catch(h){(h.throttle==null||typeof h.stall!="number")&&l.makeServerError("error in post-processing function",h).assertOk();let u=this.#h.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(u=h.stall),a.clone().#d(e+1,t,u,s,l)}}return l}send(){return pe(this.#c==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#c=new hF(this),this.#d(0,mx()+this.timeout,0,this,new js(0,"",{},null,this))}cancel(){pe(this.#c!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=gx.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();pe(this.method==="GET"&&(t!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new zi(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,s.#n=Object.assign({},this.#n),this.#r&&(s.#r=new Uint8Array(this.#r)),s.#o=this.#o,s}clone(){const e=new zi(this.url);return e.#i=this.#i,this.#r&&(e.#r=this.#r),e.#o=this.#o,e.#n=Object.assign({},this.#n),e.#f=this.#f,this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),e.#l=this.#l,e.#p=this.#p,e.#A=this.#A,e.#h=Object.assign({},this.#h),e.#u=this.#u,e}static lockConfig(){Nf=!0}static getGateway(e){return ah[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(Nf)throw new Error("gateways locked");ah[e]=t}static registerGetUrl(e){if(Nf)throw new Error("gateways locked");fx=e}static createGetUrlFunc(e){return dx(e)}static createDataGateway(){return px}static createIpfsGatewayFunc(e){return Ax(e)}}class js{#e;#t;#n;#i;#s;#a;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#i?Ce(this.#i):"null"}>`}get statusCode(){return this.#e}get statusMessage(){return this.#t}get headers(){return Object.assign({},this.#n)}get body(){return this.#i==null?null:new Uint8Array(this.#i)}get bodyText(){try{return this.#i==null?"":rh(this.#i)}catch{pe(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{pe(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let n=0;return{next:()=>{if(n<t.length){const s=t[n++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}constructor(e,t,n,s,r){this.#e=e,this.#t=t,this.#n=Object.keys(n).reduce((a,o)=>(a[o.toLowerCase()]=String(n[o]),a),{}),this.#i=s==null?null:new Uint8Array(s),this.#s=r||null,this.#a={message:""}}makeServerError(e,t){let n;e?n=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,n=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new js(599,n,this.headers,this.body,this.#s||void 0);return s.#a={message:e,error:t},s}throwThrottleError(e,t){t==null?t=-1:V(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const n=new Error(e||"throttling requests");throw Ye(n,{stall:t,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return this.#i!=null}get request(){return this.#s}ok(){return this.#a.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=this.#a;e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let s=null;try{this.#i&&(s=rh(this.#i))}catch{}pe(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:n,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function mx(){return new Date().getTime()}function uF(i){return ds(i.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function dF(i){return new Promise(e=>setTimeout(e,i))}function fF(i){let e=i.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function xx(i,e,t){let n=0;for(let s=0;s<t;s++)n=n*256+i[e+s];return n}function bx(i,e,t,n){const s=[];for(;t<e+1+n;){const r=Ex(i,t);s.push(r.result),t+=r.consumed,pe(t<=e+1+n,"child data too short","BUFFER_OVERRUN",{buffer:i,length:n,offset:e})}return{consumed:1+n,result:s}}function Ex(i,e){pe(i.length!==0,"data too short","BUFFER_OVERRUN",{buffer:i,length:0,offset:1});const t=n=>{pe(n<=i.length,"data short segment too short","BUFFER_OVERRUN",{buffer:i,length:i.length,offset:n})};if(i[e]>=248){const n=i[e]-247;t(e+1+n);const s=xx(i,e+1,n);return t(e+1+n+s),bx(i,e,e+1+n,n+s)}else if(i[e]>=192){const n=i[e]-192;return t(e+1+n),bx(i,e,e+1,n)}else if(i[e]>=184){const n=i[e]-183;t(e+1+n);const s=xx(i,e+1,n);t(e+1+n+s);const r=Ce(i.slice(e+1+n,e+1+n+s));return{consumed:1+n+s,result:r}}else if(i[e]>=128){const n=i[e]-128;t(e+1+n);const s=Ce(i.slice(e+1,e+1+n));return{consumed:1+n,result:s}}return{consumed:1,result:fF(i[e])}}function $o(i){const e=ut(i,"data"),t=Ex(e,0);return V(t.consumed===e.length,"unexpected junk after rlp payload","data",i),t.result}function yx(i){const e=[];for(;i;)e.unshift(i&255),i>>=8;return e}function _x(i){if(Array.isArray(i)){let n=[];if(i.forEach(function(r){n=n.concat(_x(r))}),n.length<=55)return n.unshift(192+n.length),n;const s=yx(n.length);return s.unshift(247+s.length),s.concat(n)}const e=Array.prototype.slice.call(ut(i,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=yx(e.length);return t.unshift(183+t.length),t.concat(e)}const wx="0123456789abcdef";function fs(i){let e="0x";for(const t of _x(i))e+=wx[t>>4],e+=wx[t&15];return e}const Vn=32,Df=new Uint8Array(Vn),pF=["then"],ch={},vx=new WeakMap;function Cr(i){return vx.get(i)}function Cx(i,e){vx.set(i,e)}function ec(i,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${i}`);throw t.error=e,t}function Lf(i,e,t){return i.indexOf(null)>=0?e.map((n,s)=>n instanceof ps?Lf(Cr(n),n,t):n):i.reduce((n,s,r)=>{let a=e.getValue(s);return s in n||(t&&a instanceof ps&&(a=Lf(Cr(a),a,t)),n[s]=a),n},{})}class ps extends Array{#e;constructor(...e){const t=e[0];let n=e[1],s=(e[2]||[]).slice(),r=!0;t!==ch&&(n=e,s=[],r=!1),super(n.length),n.forEach((c,l)=>{this[l]=c});const a=s.reduce((c,l)=>(typeof l=="string"&&c.set(l,(c.get(l)||0)+1),c),new Map);if(Cx(this,Object.freeze(n.map((c,l)=>{const h=s[l];return h!=null&&a.get(h)===1?h:null}))),this.#e=[],this.#e==null&&this.#e,!r)return;Object.freeze(this);const o=new Proxy(this,{get:(c,l,h)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){const d=dt(l,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const f=c[d];return f instanceof Error&&ec(`index ${d}`,f),f}if(pF.indexOf(l)>=0)return Reflect.get(c,l,h);const u=c[l];if(u instanceof Function)return function(...d){return u.apply(this===h?c:this,d)};if(!(l in c))return c.getValue.apply(this===h?c:this,[l])}return Reflect.get(c,l,h)}});return Cx(o,Cr(this)),o}toArray(e){const t=[];return this.forEach((n,s)=>{n instanceof Error&&ec(`index ${s}`,n),e&&n instanceof ps&&(n=n.toArray(e)),t.push(n)}),t}toObject(e){const t=Cr(this);return t.reduce((n,s,r)=>(pe(s!=null,`value at index ${r} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Lf(t,this,e)),{})}slice(e,t){e==null&&(e=0),e<0&&(e+=this.length,e<0&&(e=0)),t==null&&(t=this.length),t<0&&(t+=this.length,t<0&&(t=0)),t>this.length&&(t=this.length);const n=Cr(this),s=[],r=[];for(let a=e;a<t;a++)s.push(this[a]),r.push(n[a]);return new ps(ch,s,r)}filter(e,t){const n=Cr(this),s=[],r=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&ec(`index ${a}`,o),e.call(t,o,a,this)&&(s.push(o),r.push(n[a]))}return new ps(ch,s,r)}map(e,t){const n=[];for(let s=0;s<this.length;s++){const r=this[s];r instanceof Error&&ec(`index ${s}`,r),n.push(e.call(t,r,s,this))}return n}getValue(e){const t=Cr(this).indexOf(e);if(t===-1)return;const n=this[t];return n instanceof Error&&ec(`property ${JSON.stringify(e)}`,n.error),n}static fromItems(e,t){return new ps(ch,e,t)}}function Ix(i){let e=rn(i);return pe(e.length<=Vn,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Vn,offset:e.length}),e.length!==Vn&&(e=zn(Gt([Df.slice(e.length%Vn),e]))),e}class As{name;type;localName;dynamic;constructor(e,t,n,s){Ye(this,{name:e,type:t,localName:n,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){V(!1,e,this.localName,t)}}class Pf{#e;#t;constructor(){this.#e=[],this.#t=0}get data(){return Gt(this.#e)}get length(){return this.#t}#n(e){return this.#e.push(e),this.#t+=e.length,e.length}appendWriter(e){return this.#n(zn(e.data))}writeBytes(e){let t=zn(e);const n=t.length%Vn;return n&&(t=zn(Gt([t,Df.slice(n)]))),this.#n(t)}writeValue(e){return this.#n(Ix(e))}writeUpdatableValue(){const e=this.#e.length;return this.#e.push(Df),this.#t+=Vn,t=>{this.#e[e]=Ix(t)}}}class kf{allowLoose;#e;#t;#n;#i;#s;constructor(e,t,n){Ye(this,{allowLoose:!!t}),this.#e=zn(e),this.#n=0,this.#i=null,this.#s=n??1024,this.#t=0}get data(){return Ce(this.#e)}get dataLength(){return this.#e.length}get consumed(){return this.#t}get bytes(){return new Uint8Array(this.#e)}#a(e){if(this.#i)return this.#i.#a(e);this.#n+=e,pe(this.#s<1||this.#n<=this.#s*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:zn(this.#e),offset:this.#t,length:e,info:{bytesRead:this.#n,dataLength:this.dataLength}})}#r(e,t,n){let s=Math.ceil(t/Vn)*Vn;return this.#t+s>this.#e.length&&(this.allowLoose&&n&&this.#t+t<=this.#e.length?s=t:pe(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:zn(this.#e),length:this.#e.length,offset:this.#t+s})),this.#e.slice(this.#t,this.#t+s)}subReader(e){const t=new kf(this.#e.slice(this.#t+e),this.allowLoose,this.#s);return t.#i=this,t}readBytes(e,t){let n=this.#r(0,e,!!t);return this.#a(e),this.#t+=n.length,n.slice(0,e)}readValue(){return Ff(this.readBytes(Vn))}readIndex(){return JR(this.readBytes(Vn))}}function lh(i){if(!Number.isSafeInteger(i)||i<0)throw new Error(`Wrong positive integer: ${i}`)}function Uf(i,...e){if(!(i instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(i.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${i.length}`)}function AF(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");lh(i.outputLen),lh(i.blockLen)}function Oa(i,e=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(e&&i.finished)throw new Error("Hash#digest() has already been called")}function Sx(i,e){Uf(i);const t=e.outputLen;if(i.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const Of=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;const Mx=i=>i instanceof Uint8Array,gF=i=>new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)),Qf=i=>new DataView(i.buffer,i.byteOffset,i.byteLength),Vi=(i,e)=>i<<32-e|i>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function mF(i){if(typeof i!="string")throw new Error(`utf8ToBytes expected string, got ${typeof i}`);return new Uint8Array(new TextEncoder().encode(i))}function hh(i){if(typeof i=="string"&&(i=mF(i)),!Mx(i))throw new Error(`expected Uint8Array, got ${typeof i}`);return i}function xF(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!Mx(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}class Gf{clone(){return this._cloneInto()}}function Hf(i){const e=n=>i().update(hh(n)).digest(),t=i();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>i(),e}function bF(i=32){if(Of&&typeof Of.getRandomValues=="function")return Of.getRandomValues(new Uint8Array(i));throw new Error("crypto.getRandomValues must be defined")}class Bx extends Gf{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,AF(e);const n=hh(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,r=new Uint8Array(s);r.set(n.length>s?e.create().update(n).digest():n);for(let a=0;a<r.length;a++)r[a]^=54;this.iHash.update(r),this.oHash=e.create();for(let a=0;a<r.length;a++)r[a]^=106;this.oHash.update(r),r.fill(0)}update(e){return Oa(this),this.iHash.update(e),this}digestInto(e){Oa(this),Uf(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:s,destroyed:r,blockLen:a,outputLen:o}=this;return e=e,e.finished=s,e.destroyed=r,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Tx=(i,e,t)=>new Bx(i,e).update(t).digest();Tx.create=(i,e)=>new Bx(i,e);function EF(i,e,t,n){if(typeof i.setBigUint64=="function")return i.setBigUint64(e,t,n);const s=BigInt(32),r=BigInt(4294967295),a=Number(t>>s&r),o=Number(t&r),c=n?4:0,l=n?0:4;i.setUint32(e+c,a,n),i.setUint32(e+l,o,n)}class Rx extends Gf{constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Qf(this.buffer)}update(e){Oa(this);const{view:t,buffer:n,blockLen:s}=this;e=hh(e);const r=e.length;for(let a=0;a<r;){const o=Math.min(s-this.pos,r-a);if(o===s){const c=Qf(e);for(;s<=r-a;a+=s)this.process(c,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Oa(this),Sx(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:s,isLE:r}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(n,0),a=0);for(let u=a;u<s;u++)t[u]=0;EF(n,s-8,BigInt(this.length*8),r),this.process(n,0);const o=Qf(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)o.setUint32(4*u,h[u],r)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:s,finished:r,destroyed:a,pos:o}=this;return e.length=s,e.pos=o,e.finished=r,e.destroyed=a,s%t&&e.buffer.set(n),e}}const yF=(i,e,t)=>i&e^~i&t,_F=(i,e,t)=>i&e^i&t^e&t,wF=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Xs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ys=new Uint32Array(64);class vF extends Rx{constructor(){super(64,32,8,!1),this.A=Xs[0]|0,this.B=Xs[1]|0,this.C=Xs[2]|0,this.D=Xs[3]|0,this.E=Xs[4]|0,this.F=Xs[5]|0,this.G=Xs[6]|0,this.H=Xs[7]|0}get(){const{A:e,B:t,C:n,D:s,E:r,F:a,G:o,H:c}=this;return[e,t,n,s,r,a,o,c]}set(e,t,n,s,r,a,o,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=r|0,this.F=a|0,this.G=o|0,this.H=c|0}process(e,t){for(let u=0;u<16;u++,t+=4)Ys[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const d=Ys[u-15],f=Ys[u-2],p=Vi(d,7)^Vi(d,18)^d>>>3,m=Vi(f,17)^Vi(f,19)^f>>>10;Ys[u]=m+Ys[u-7]+p+Ys[u-16]|0}let{A:n,B:s,C:r,D:a,E:o,F:c,G:l,H:h}=this;for(let u=0;u<64;u++){const d=Vi(o,6)^Vi(o,11)^Vi(o,25),f=h+d+yF(o,c,l)+wF[u]+Ys[u]|0,m=(Vi(n,2)^Vi(n,13)^Vi(n,22))+_F(n,s,r)|0;h=l,l=c,c=o,o=a+f|0,a=r,r=s,s=n,n=f+m|0}n=n+this.A|0,s=s+this.B|0,r=r+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(n,s,r,a,o,c,l,h)}roundClean(){Ys.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Fx=Hf(()=>new vF),uh=BigInt(2**32-1),zf=BigInt(32);function Nx(i,e=!1){return e?{h:Number(i&uh),l:Number(i>>zf&uh)}:{h:Number(i>>zf&uh)|0,l:Number(i&uh)|0}}function Dx(i,e=!1){let t=new Uint32Array(i.length),n=new Uint32Array(i.length);for(let s=0;s<i.length;s++){const{h:r,l:a}=Nx(i[s],e);[t[s],n[s]]=[r,a]}return[t,n]}const CF=(i,e)=>BigInt(i>>>0)<<zf|BigInt(e>>>0),IF=(i,e,t)=>i>>>t,SF=(i,e,t)=>i<<32-t|e>>>t,MF=(i,e,t)=>i>>>t|e<<32-t,BF=(i,e,t)=>i<<32-t|e>>>t,TF=(i,e,t)=>i<<64-t|e>>>t-32,RF=(i,e,t)=>i>>>t-32|e<<64-t,FF=(i,e)=>e,NF=(i,e)=>i,Lx=(i,e,t)=>i<<t|e>>>32-t,Px=(i,e,t)=>e<<t|i>>>32-t,kx=(i,e,t)=>e<<t-32|i>>>64-t,Ux=(i,e,t)=>i<<t-32|e>>>64-t;function DF(i,e,t,n){const s=(e>>>0)+(n>>>0);return{h:i+t+(s/2**32|0)|0,l:s|0}}const lt={fromBig:Nx,split:Dx,toBig:CF,shrSH:IF,shrSL:SF,rotrSH:MF,rotrSL:BF,rotrBH:TF,rotrBL:RF,rotr32H:FF,rotr32L:NF,rotlSH:Lx,rotlSL:Px,rotlBH:kx,rotlBL:Ux,add:DF,add3L:(i,e,t)=>(i>>>0)+(e>>>0)+(t>>>0),add3H:(i,e,t,n)=>e+t+n+(i/2**32|0)|0,add4L:(i,e,t,n)=>(i>>>0)+(e>>>0)+(t>>>0)+(n>>>0),add4H:(i,e,t,n,s)=>e+t+n+s+(i/2**32|0)|0,add5H:(i,e,t,n,s,r)=>e+t+n+s+r+(i/2**32|0)|0,add5L:(i,e,t,n,s)=>(i>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0)},[LF,PF]=lt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(i=>BigInt(i))),Js=new Uint32Array(80),Zs=new Uint32Array(80);class kF extends Rx{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:s,Ch:r,Cl:a,Dh:o,Dl:c,Eh:l,El:h,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:g}=this;return[e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g]}set(e,t,n,s,r,a,o,c,l,h,u,d,f,p,m,g){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=r|0,this.Cl=a|0,this.Dh=o|0,this.Dl=c|0,this.Eh=l|0,this.El=h|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(e,t){for(let x=0;x<16;x++,t+=4)Js[x]=e.getUint32(t),Zs[x]=e.getUint32(t+=4);for(let x=16;x<80;x++){const E=Js[x-15]|0,S=Zs[x-15]|0,w=lt.rotrSH(E,S,1)^lt.rotrSH(E,S,8)^lt.shrSH(E,S,7),I=lt.rotrSL(E,S,1)^lt.rotrSL(E,S,8)^lt.shrSL(E,S,7),T=Js[x-2]|0,C=Zs[x-2]|0,v=lt.rotrSH(T,C,19)^lt.rotrBH(T,C,61)^lt.shrSH(T,C,6),F=lt.rotrSL(T,C,19)^lt.rotrBL(T,C,61)^lt.shrSL(T,C,6),K=lt.add4L(I,F,Zs[x-7],Zs[x-16]),q=lt.add4H(K,w,v,Js[x-7],Js[x-16]);Js[x]=q|0,Zs[x]=K|0}let{Ah:n,Al:s,Bh:r,Bl:a,Ch:o,Cl:c,Dh:l,Dl:h,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:g,Hh:A,Hl:_}=this;for(let x=0;x<80;x++){const E=lt.rotrSH(u,d,14)^lt.rotrSH(u,d,18)^lt.rotrBH(u,d,41),S=lt.rotrSL(u,d,14)^lt.rotrSL(u,d,18)^lt.rotrBL(u,d,41),w=u&f^~u&m,I=d&p^~d&g,T=lt.add5L(_,S,I,PF[x],Zs[x]),C=lt.add5H(T,A,E,w,LF[x],Js[x]),v=T|0,F=lt.rotrSH(n,s,28)^lt.rotrBH(n,s,34)^lt.rotrBH(n,s,39),K=lt.rotrSL(n,s,28)^lt.rotrBL(n,s,34)^lt.rotrBL(n,s,39),q=n&r^n&o^r&o,$=s&a^s&c^a&c;A=m|0,_=g|0,m=f|0,g=p|0,f=u|0,p=d|0,{h:u,l:d}=lt.add(l|0,h|0,C|0,v|0),l=o|0,h=c|0,o=r|0,c=a|0,r=n|0,a=s|0;const D=lt.add3L(v,K,$);n=lt.add3H(D,C,F,q),s=D|0}({h:n,l:s}=lt.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:r,l:a}=lt.add(this.Bh|0,this.Bl|0,r|0,a|0),{h:o,l:c}=lt.add(this.Ch|0,this.Cl|0,o|0,c|0),{h:l,l:h}=lt.add(this.Dh|0,this.Dl|0,l|0,h|0),{h:u,l:d}=lt.add(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=lt.add(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:g}=lt.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:A,l:_}=lt.add(this.Hh|0,this.Hl|0,A|0,_|0),this.set(n,s,r,a,o,c,l,h,u,d,f,p,m,g,A,_)}roundClean(){Js.fill(0),Zs.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const UF=Hf(()=>new kF);function OF(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const Ox=OF();Ox.crypto||Ox.msCrypto;function QF(i){switch(i){case"sha256":return Fx.create();case"sha512":return UF.create()}V(!1,"invalid hashing algorithm name","algorithm",i)}const[Qx,Gx,Hx]=[[],[],[]],GF=BigInt(0),tc=BigInt(1),HF=BigInt(2),zF=BigInt(7),VF=BigInt(256),WF=BigInt(113);for(let i=0,e=tc,t=1,n=0;i<24;i++){[t,n]=[n,(2*t+3*n)%5],Qx.push(2*(5*n+t)),Gx.push((i+1)*(i+2)/2%64);let s=GF;for(let r=0;r<7;r++)e=(e<<tc^(e>>zF)*WF)%VF,e&HF&&(s^=tc<<(tc<<BigInt(r))-tc);Hx.push(s)}const[qF,KF]=Dx(Hx,!0),zx=(i,e,t)=>t>32?kx(i,e,t):Lx(i,e,t),Vx=(i,e,t)=>t>32?Ux(i,e,t):Px(i,e,t);function jF(i,e=24){const t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)t[a]=i[a]^i[a+10]^i[a+20]^i[a+30]^i[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,l=t[c],h=t[c+1],u=zx(l,h,1)^t[o],d=Vx(l,h,1)^t[o+1];for(let f=0;f<50;f+=10)i[a+f]^=u,i[a+f+1]^=d}let s=i[2],r=i[3];for(let a=0;a<24;a++){const o=Gx[a],c=zx(s,r,o),l=Vx(s,r,o),h=Qx[a];s=i[h],r=i[h+1],i[h]=c,i[h+1]=l}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)t[o]=i[a+o];for(let o=0;o<10;o++)i[a+o]^=~t[(o+2)%10]&t[(o+4)%10]}i[0]^=qF[n],i[1]^=KF[n]}t.fill(0)}class Vf extends Gf{constructor(e,t,n,s=!1,r=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=s,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,lh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=gF(this.state)}keccak(){jF(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Oa(this);const{blockLen:t,state:n}=this;e=hh(e);const s=e.length;for(let r=0;r<s;){const a=Math.min(t-this.pos,s-r);for(let o=0;o<a;o++)n[this.pos++]^=e[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:s}=this;e[n]^=t,(t&128)!==0&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Oa(this,!1),Uf(e),this.finish();const t=this.state,{blockLen:n}=this;for(let s=0,r=e.length;s<r;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,r-s);e.set(t.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return lh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Sx(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:s,rounds:r,enableXOF:a}=this;return e||(e=new Vf(t,n,s,a,r)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=r,e.suffix=n,e.outputLen=s,e.enableXOF=a,e.destroyed=this.destroyed,e}}const XF=((i,e,t)=>Hf(()=>new Vf(e,i,t)))(1,136,256/8);let Wx=!1;const qx=function(i){return XF(i)};let Kx=qx;function an(i){const e=ut(i,"data");return Ce(Kx(e))}an._=qx,an.lock=function(){Wx=!0},an.register=function(i){if(Wx)throw new TypeError("keccak256 is locked");Kx=i},Object.freeze(an);const jx=function(i){return QF("sha256").update(i).digest()};let Xx=jx,Yx=!1;function Qa(i){const e=ut(i,"data");return Ce(Xx(e))}Qa._=jx,Qa.lock=function(){Yx=!0},Qa.register=function(i){if(Yx)throw new Error("sha256 is locked");Xx=i},Object.freeze(Qa),Object.freeze(Qa);BigInt(0);const YF=BigInt(1),JF=BigInt(2),dh=i=>i instanceof Uint8Array,ZF=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ga(i){if(!dh(i))throw new Error("Uint8Array expected");let e="";for(let t=0;t<i.length;t++)e+=ZF[i[t]];return e}function Wf(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return BigInt(i===""?"0":`0x${i}`)}function nc(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);const e=i.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const t=new Uint8Array(e/2);for(let n=0;n<t.length;n++){const s=n*2,r=i.slice(s,s+2),a=Number.parseInt(r,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");t[n]=a}return t}function Ir(i){return Wf(Ga(i))}function qf(i){if(!dh(i))throw new Error("Uint8Array expected");return Wf(Ga(Uint8Array.from(i).reverse()))}function Ha(i,e){return nc(i.toString(16).padStart(e*2,"0"))}function Kf(i,e){return Ha(i,e).reverse()}function Fi(i,e,t){let n;if(typeof e=="string")try{n=nc(e)}catch(r){throw new Error(`${i} must be valid hex string, got "${e}". Cause: ${r}`)}else if(dh(e))n=Uint8Array.from(e);else throw new Error(`${i} must be hex string or Uint8Array`);const s=n.length;if(typeof t=="number"&&s!==t)throw new Error(`${i} expected ${t} bytes, got ${s}`);return n}function ic(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!dh(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}const jf=i=>(JF<<BigInt(i-1))-YF,Xf=i=>new Uint8Array(i),Jx=i=>Uint8Array.from(i);function Zx(i,e,t){if(typeof i!="number"||i<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Xf(i),s=Xf(i),r=0;const a=()=>{n.fill(1),s.fill(0),r=0},o=(...u)=>t(s,n,...u),c=(u=Xf())=>{s=o(Jx([0]),u),n=o(),u.length!==0&&(s=o(Jx([1]),u),n=o())},l=()=>{if(r++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<e;){n=o();const f=n.slice();d.push(f),u+=n.length}return ic(...d)};return(u,d)=>{a(),c(u);let f;for(;!(f=d(l()));)c();return a(),f}}const $F={bigint:i=>typeof i=="bigint",function:i=>typeof i=="function",boolean:i=>typeof i=="boolean",string:i=>typeof i=="string",stringOrUint8Array:i=>typeof i=="string"||i instanceof Uint8Array,isSafeInteger:i=>Number.isSafeInteger(i),array:i=>Array.isArray(i),field:(i,e)=>e.Fp.isValid(i),hash:i=>typeof i=="function"&&Number.isSafeInteger(i.outputLen)};function sc(i,e,t={}){const n=(s,r,a)=>{const o=$F[r];if(typeof o!="function")throw new Error(`Invalid validator "${r}", expected function`);const c=i[s];if(!(a&&c===void 0)&&!o(c,i))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${r}`)};for(const[s,r]of Object.entries(e))n(s,r,!1);for(const[s,r]of Object.entries(t))n(s,r,!0);return i}const eN=Object.freeze(Object.defineProperty({__proto__:null,bitMask:jf,bytesToHex:Ga,bytesToNumberBE:Ir,bytesToNumberLE:qf,concatBytes:ic,createHmacDrbg:Zx,ensureBytes:Fi,hexToBytes:nc,hexToNumber:Wf,numberToBytesBE:Ha,numberToBytesLE:Kf,validateObject:sc},Symbol.toStringTag,{value:"Module"}));const yn=BigInt(0),en=BigInt(1),Sr=BigInt(2),tN=BigInt(3),Yf=BigInt(4),$x=BigInt(5),eb=BigInt(8);BigInt(9),BigInt(16);function Xn(i,e){const t=i%e;return t>=yn?t:e+t}function nN(i,e,t){if(t<=yn||e<yn)throw new Error("Expected power/modulo > 0");if(t===en)return yn;let n=en;for(;e>yn;)e&en&&(n=n*i%t),i=i*i%t,e>>=en;return n}function pi(i,e,t){let n=i;for(;e-- >yn;)n*=n,n%=t;return n}function Jf(i,e){if(i===yn||e<=yn)throw new Error(`invert: expected positive integers, got n=${i} mod=${e}`);let t=Xn(i,e),n=e,s=yn,r=en;for(;t!==yn;){const o=n/t,c=n%t,l=s-r*o;n=t,t=c,s=r,r=l}if(n!==en)throw new Error("invert: does not exist");return Xn(s,e)}function iN(i){const e=(i-en)/Sr;let t,n,s;for(t=i-en,n=0;t%Sr===yn;t/=Sr,n++);for(s=Sr;s<i&&nN(s,e,i)!==i-en;s++);if(n===1){const a=(i+en)/Yf;return function(c,l){const h=c.pow(l,a);if(!c.eql(c.sqr(h),l))throw new Error("Cannot find square root");return h}}const r=(t+en)/Sr;return function(o,c){if(o.pow(c,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let l=n,h=o.pow(o.mul(o.ONE,s),t),u=o.pow(c,r),d=o.pow(c,t);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let f=1;for(let m=o.sqr(d);f<l&&!o.eql(m,o.ONE);f++)m=o.sqr(m);const p=o.pow(h,en<<BigInt(l-f-1));h=o.sqr(p),u=o.mul(u,p),d=o.mul(d,h),l=f}return u}}function sN(i){if(i%Yf===tN){const e=(i+en)/Yf;return function(n,s){const r=n.pow(s,e);if(!n.eql(n.sqr(r),s))throw new Error("Cannot find square root");return r}}if(i%eb===$x){const e=(i-$x)/eb;return function(n,s){const r=n.mul(s,Sr),a=n.pow(r,e),o=n.mul(s,a),c=n.mul(n.mul(o,Sr),a),l=n.mul(o,n.sub(c,n.ONE));if(!n.eql(n.sqr(l),s))throw new Error("Cannot find square root");return l}}return iN(i)}const rN=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function aN(i){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=rN.reduce((n,s)=>(n[s]="function",n),e);return sc(i,t)}function oN(i,e,t){if(t<yn)throw new Error("Expected power > 0");if(t===yn)return i.ONE;if(t===en)return e;let n=i.ONE,s=e;for(;t>yn;)t&en&&(n=i.mul(n,s)),s=i.sqr(s),t>>=en;return n}function cN(i,e){const t=new Array(e.length),n=e.reduce((r,a,o)=>i.is0(a)?r:(t[o]=r,i.mul(r,a)),i.ONE),s=i.inv(n);return e.reduceRight((r,a,o)=>i.is0(a)?r:(t[o]=i.mul(r,t[o]),i.mul(r,a)),s),t}function tb(i,e){const t=e!==void 0?e:i.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function lN(i,e,t=!1,n={}){if(i<=yn)throw new Error(`Expected Field ORDER > 0, got ${i}`);const{nBitLength:s,nByteLength:r}=tb(i,e);if(r>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=sN(i),o=Object.freeze({ORDER:i,BITS:s,BYTES:r,MASK:jf(s),ZERO:yn,ONE:en,create:c=>Xn(c,i),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return yn<=c&&c<i},is0:c=>c===yn,isOdd:c=>(c&en)===en,neg:c=>Xn(-c,i),eql:(c,l)=>c===l,sqr:c=>Xn(c*c,i),add:(c,l)=>Xn(c+l,i),sub:(c,l)=>Xn(c-l,i),mul:(c,l)=>Xn(c*l,i),pow:(c,l)=>oN(o,c,l),div:(c,l)=>Xn(c*Jf(l,i),i),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>Jf(c,i),sqrt:n.sqrt||(c=>a(o,c)),invertBatch:c=>cN(o,c),cmov:(c,l,h)=>h?l:c,toBytes:c=>t?Kf(c,r):Ha(c,r),fromBytes:c=>{if(c.length!==r)throw new Error(`Fp.fromBytes: expected ${r}, got ${c.length}`);return t?qf(c):Ir(c)}});return Object.freeze(o)}function nb(i){if(typeof i!="bigint")throw new Error("field order must be bigint");const e=i.toString(2).length;return Math.ceil(e/8)}function ib(i){const e=nb(i);return e+Math.ceil(e/2)}function hN(i,e,t=!1){const n=i.length,s=nb(e),r=ib(e);if(n<16||n<r||n>1024)throw new Error(`expected ${r}-1024 bytes of input, got ${n}`);const a=t?Ir(i):qf(i),o=Xn(a,e-en)+en;return t?Kf(o,s):Ha(o,s)}const uN=BigInt(0),Zf=BigInt(1);function dN(i,e){const t=(s,r)=>{const a=r.negate();return s?a:r},n=s=>{const r=Math.ceil(e/s)+1,a=2**(s-1);return{windows:r,windowSize:a}};return{constTimeNegate:t,unsafeLadder(s,r){let a=i.ZERO,o=s;for(;r>uN;)r&Zf&&(a=a.add(o)),o=o.double(),r>>=Zf;return a},precomputeWindow(s,r){const{windows:a,windowSize:o}=n(r),c=[];let l=s,h=l;for(let u=0;u<a;u++){h=l,c.push(h);for(let d=1;d<o;d++)h=h.add(l),c.push(h);l=h.double()}return c},wNAF(s,r,a){const{windows:o,windowSize:c}=n(s);let l=i.ZERO,h=i.BASE;const u=BigInt(2**s-1),d=2**s,f=BigInt(s);for(let p=0;p<o;p++){const m=p*c;let g=Number(a&u);a>>=f,g>c&&(g-=d,a+=Zf);const A=m,_=m+Math.abs(g)-1,x=p%2!==0,E=g<0;g===0?h=h.add(t(x,r[A])):l=l.add(t(E,r[_]))}return{p:l,f:h}},wNAFCached(s,r,a,o){const c=s._WINDOW_SIZE||1;let l=r.get(s);return l||(l=this.precomputeWindow(s,c),c!==1&&r.set(s,o(l))),this.wNAF(c,l,a)}}}function sb(i){return aN(i.Fp),sc(i,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...tb(i.n,i.nBitLength),...i,p:i.Fp.ORDER})}function fN(i){const e=sb(i);sc(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:n,a:s}=e;if(t){if(!n.eql(s,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:pN,hexToBytes:AN}=eN,Mr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(i){const{Err:e}=Mr;if(i.length<2||i[0]!==2)throw new e("Invalid signature integer tag");const t=i[1],n=i.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:pN(n),l:i.subarray(t+2)}},toSig(i){const{Err:e}=Mr,t=typeof i=="string"?AN(i):i;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:s,l:r}=Mr._parseInt(t.subarray(2)),{d:a,l:o}=Mr._parseInt(r);if(o.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:a}},hexFromSig(i){const e=l=>Number.parseInt(l[0],16)&8?"00"+l:l,t=l=>{const h=l.toString(16);return h.length&1?`0${h}`:h},n=e(t(i.s)),s=e(t(i.r)),r=n.length/2,a=s.length/2,o=t(r),c=t(a);return`30${t(a+r+4)}02${c}${s}02${o}${n}`}},gs=BigInt(0),Ai=BigInt(1);BigInt(2);const rb=BigInt(3);BigInt(4);function gN(i){const e=fN(i),{Fp:t}=e,n=e.toBytes||((p,m,g)=>{const A=m.toAffine();return ic(Uint8Array.from([4]),t.toBytes(A.x),t.toBytes(A.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),g=t.fromBytes(m.subarray(0,t.BYTES)),A=t.fromBytes(m.subarray(t.BYTES,2*t.BYTES));return{x:g,y:A}});function r(p){const{a:m,b:g}=e,A=t.sqr(p),_=t.mul(A,p);return t.add(t.add(_,t.mul(p,m)),g)}if(!t.eql(t.sqr(e.Gy),r(e.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return typeof p=="bigint"&&gs<p&&p<e.n}function o(p){if(!a(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(p){const{allowedPrivateKeyLengths:m,nByteLength:g,wrapPrivateKey:A,n:_}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=Ga(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(g*2,"0")}let x;try{x=typeof p=="bigint"?p:Ir(Fi("private key",p,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`)}return A&&(x=Xn(x,_)),o(x),x}const l=new Map;function h(p){if(!(p instanceof u))throw new Error("ProjectivePoint expected")}class u{constructor(m,g,A){if(this.px=m,this.py=g,this.pz=A,m==null||!t.isValid(m))throw new Error("x required");if(g==null||!t.isValid(g))throw new Error("y required");if(A==null||!t.isValid(A))throw new Error("z required")}static fromAffine(m){const{x:g,y:A}=m||{};if(!m||!t.isValid(g)||!t.isValid(A))throw new Error("invalid affine point");if(m instanceof u)throw new Error("projective point not allowed");const _=x=>t.eql(x,t.ZERO);return _(g)&&_(A)?u.ZERO:new u(g,A,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const g=t.invertBatch(m.map(A=>A.pz));return m.map((A,_)=>A.toAffine(g[_])).map(u.fromAffine)}static fromHex(m){const g=u.fromAffine(s(Fi("pointHex",m)));return g.assertValidity(),g}static fromPrivateKey(m){return u.BASE.multiply(c(m))}_setWindowSize(m){this._WINDOW_SIZE=m,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:g}=this.toAffine();if(!t.isValid(m)||!t.isValid(g))throw new Error("bad point: x or y not FE");const A=t.sqr(g),_=r(m);if(!t.eql(A,_))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(t.isOdd)return!t.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){h(m);const{px:g,py:A,pz:_}=this,{px:x,py:E,pz:S}=m,w=t.eql(t.mul(g,S),t.mul(x,_)),I=t.eql(t.mul(A,S),t.mul(E,_));return w&&I}negate(){return new u(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,A=t.mul(g,rb),{px:_,py:x,pz:E}=this;let S=t.ZERO,w=t.ZERO,I=t.ZERO,T=t.mul(_,_),C=t.mul(x,x),v=t.mul(E,E),F=t.mul(_,x);return F=t.add(F,F),I=t.mul(_,E),I=t.add(I,I),S=t.mul(m,I),w=t.mul(A,v),w=t.add(S,w),S=t.sub(C,w),w=t.add(C,w),w=t.mul(S,w),S=t.mul(F,S),I=t.mul(A,I),v=t.mul(m,v),F=t.sub(T,v),F=t.mul(m,F),F=t.add(F,I),I=t.add(T,T),T=t.add(I,T),T=t.add(T,v),T=t.mul(T,F),w=t.add(w,T),v=t.mul(x,E),v=t.add(v,v),T=t.mul(v,F),S=t.sub(S,T),I=t.mul(v,C),I=t.add(I,I),I=t.add(I,I),new u(S,w,I)}add(m){h(m);const{px:g,py:A,pz:_}=this,{px:x,py:E,pz:S}=m;let w=t.ZERO,I=t.ZERO,T=t.ZERO;const C=e.a,v=t.mul(e.b,rb);let F=t.mul(g,x),K=t.mul(A,E),q=t.mul(_,S),$=t.add(g,A),D=t.add(x,E);$=t.mul($,D),D=t.add(F,K),$=t.sub($,D),D=t.add(g,_);let O=t.add(x,S);return D=t.mul(D,O),O=t.add(F,q),D=t.sub(D,O),O=t.add(A,_),w=t.add(E,S),O=t.mul(O,w),w=t.add(K,q),O=t.sub(O,w),T=t.mul(C,D),w=t.mul(v,q),T=t.add(w,T),w=t.sub(K,T),T=t.add(K,T),I=t.mul(w,T),K=t.add(F,F),K=t.add(K,F),q=t.mul(C,q),D=t.mul(v,D),K=t.add(K,q),q=t.sub(F,q),q=t.mul(C,q),D=t.add(D,q),F=t.mul(K,D),I=t.add(I,F),F=t.mul(O,D),w=t.mul($,w),w=t.sub(w,F),F=t.mul($,K),T=t.mul(O,T),T=t.add(T,F),new u(w,I,T)}subtract(m){return this.add(m.negate())}is0(){return this.equals(u.ZERO)}wNAF(m){return f.wNAFCached(this,l,m,g=>{const A=t.invertBatch(g.map(_=>_.pz));return g.map((_,x)=>_.toAffine(A[x])).map(u.fromAffine)})}multiplyUnsafe(m){const g=u.ZERO;if(m===gs)return g;if(o(m),m===Ai)return this;const{endo:A}=e;if(!A)return f.unsafeLadder(this,m);let{k1neg:_,k1:x,k2neg:E,k2:S}=A.splitScalar(m),w=g,I=g,T=this;for(;x>gs||S>gs;)x&Ai&&(w=w.add(T)),S&Ai&&(I=I.add(T)),T=T.double(),x>>=Ai,S>>=Ai;return _&&(w=w.negate()),E&&(I=I.negate()),I=new u(t.mul(I.px,A.beta),I.py,I.pz),w.add(I)}multiply(m){o(m);let g=m,A,_;const{endo:x}=e;if(x){const{k1neg:E,k1:S,k2neg:w,k2:I}=x.splitScalar(g);let{p:T,f:C}=this.wNAF(S),{p:v,f:F}=this.wNAF(I);T=f.constTimeNegate(E,T),v=f.constTimeNegate(w,v),v=new u(t.mul(v.px,x.beta),v.py,v.pz),A=T.add(v),_=C.add(F)}else{const{p:E,f:S}=this.wNAF(g);A=E,_=S}return u.normalizeZ([A,_])[0]}multiplyAndAddUnsafe(m,g,A){const _=u.BASE,x=(S,w)=>w===gs||w===Ai||!S.equals(_)?S.multiplyUnsafe(w):S.multiply(w),E=x(this,g).add(x(m,A));return E.is0()?void 0:E}toAffine(m){const{px:g,py:A,pz:_}=this,x=this.is0();m==null&&(m=x?t.ONE:t.inv(_));const E=t.mul(g,m),S=t.mul(A,m),w=t.mul(_,m);if(x)return{x:t.ZERO,y:t.ZERO};if(!t.eql(w,t.ONE))throw new Error("invZ was invalid");return{x:E,y:S}}isTorsionFree(){const{h:m,isTorsionFree:g}=e;if(m===Ai)return!0;if(g)return g(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:g}=e;return m===Ai?this:g?g(u,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),n(u,this,m)}toHex(m=!0){return Ga(this.toRawBytes(m))}}u.BASE=new u(e.Gx,e.Gy,t.ONE),u.ZERO=new u(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,f=dN(u,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:r,isWithinCurveOrder:a}}function mN(i){const e=sb(i);return sc(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function xN(i){const e=mN(i),{Fp:t,n}=e,s=t.BYTES+1,r=2*t.BYTES+1;function a(D){return gs<D&&D<t.ORDER}function o(D){return Xn(D,n)}function c(D){return Jf(D,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:h,weierstrassEquation:u,isWithinCurveOrder:d}=gN({...e,toBytes(D,O,Y){const Q=O.toAffine(),J=t.toBytes(Q.x),ee=ic;return Y?ee(Uint8Array.from([O.hasEvenY()?2:3]),J):ee(Uint8Array.from([4]),J,t.toBytes(Q.y))},fromBytes(D){const O=D.length,Y=D[0],Q=D.subarray(1);if(O===s&&(Y===2||Y===3)){const J=Ir(Q);if(!a(J))throw new Error("Point is not on curve");const ee=u(J);let ae=t.sqrt(ee);const _e=(ae&Ai)===Ai;return(Y&1)===1!==_e&&(ae=t.neg(ae)),{x:J,y:ae}}else if(O===r&&Y===4){const J=t.fromBytes(Q.subarray(0,t.BYTES)),ee=t.fromBytes(Q.subarray(t.BYTES,2*t.BYTES));return{x:J,y:ee}}else throw new Error(`Point of length ${O} was invalid. Expected ${s} compressed bytes or ${r} uncompressed bytes`)}}),f=D=>Ga(Ha(D,e.nByteLength));function p(D){const O=n>>Ai;return D>O}function m(D){return p(D)?o(-D):D}const g=(D,O,Y)=>Ir(D.slice(O,Y));class A{constructor(O,Y,Q){this.r=O,this.s=Y,this.recovery=Q,this.assertValidity()}static fromCompact(O){const Y=e.nByteLength;return O=Fi("compactSignature",O,Y*2),new A(g(O,0,Y),g(O,Y,2*Y))}static fromDER(O){const{r:Y,s:Q}=Mr.toSig(Fi("DER",O));return new A(Y,Q)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(O){return new A(this.r,this.s,O)}recoverPublicKey(O){const{r:Y,s:Q,recovery:J}=this,ee=I(Fi("msgHash",O));if(J==null||![0,1,2,3].includes(J))throw new Error("recovery id invalid");const ae=J===2||J===3?Y+e.n:Y;if(ae>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const _e=(J&1)===0?"02":"03",Me=l.fromHex(_e+f(ae)),se=c(ae),me=o(-ee*se),xe=o(Q*se),be=l.BASE.multiplyAndAddUnsafe(Me,me,xe);if(!be)throw new Error("point at infinify");return be.assertValidity(),be}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return nc(this.toDERHex())}toDERHex(){return Mr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return nc(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const _={isValidPrivateKey(D){try{return h(D),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const D=ib(e.n);return hN(e.randomBytes(D),e.n)},precompute(D=8,O=l.BASE){return O._setWindowSize(D),O.multiply(BigInt(3)),O}};function x(D,O=!0){return l.fromPrivateKey(D).toRawBytes(O)}function E(D){const O=D instanceof Uint8Array,Y=typeof D=="string",Q=(O||Y)&&D.length;return O?Q===s||Q===r:Y?Q===2*s||Q===2*r:D instanceof l}function S(D,O,Y=!0){if(E(D))throw new Error("first arg must be private key");if(!E(O))throw new Error("second arg must be public key");return l.fromHex(O).multiply(h(D)).toRawBytes(Y)}const w=e.bits2int||function(D){const O=Ir(D),Y=D.length*8-e.nBitLength;return Y>0?O>>BigInt(Y):O},I=e.bits2int_modN||function(D){return o(w(D))},T=jf(e.nBitLength);function C(D){if(typeof D!="bigint")throw new Error("bigint expected");if(!(gs<=D&&D<T))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Ha(D,e.nByteLength)}function v(D,O,Y=F){if(["recovered","canonical"].some(et=>et in Y))throw new Error("sign() legacy options not supported");const{hash:Q,randomBytes:J}=e;let{lowS:ee,prehash:ae,extraEntropy:_e}=Y;ee==null&&(ee=!0),D=Fi("msgHash",D),ae&&(D=Fi("prehashed msgHash",Q(D)));const Me=I(D),se=h(O),me=[C(se),C(Me)];if(_e!=null){const et=_e===!0?J(t.BYTES):_e;me.push(Fi("extraEntropy",et))}const xe=ic(...me),be=Me;function Ue(et){const He=w(et);if(!d(He))return;const Mt=c(He),ft=l.BASE.multiply(He).toAffine(),$e=o(ft.x);if($e===gs)return;const H=o(Mt*o(be+$e*se));if(H===gs)return;let wn=(ft.x===$e?0:2)|Number(ft.y&Ai),pt=H;return ee&&p(H)&&(pt=m(H),wn^=1),new A($e,pt,wn)}return{seed:xe,k2sig:Ue}}const F={lowS:e.lowS,prehash:!1},K={lowS:e.lowS,prehash:!1};function q(D,O,Y=F){const{seed:Q,k2sig:J}=v(D,O,Y),ee=e;return Zx(ee.hash.outputLen,ee.nByteLength,ee.hmac)(Q,J)}l.BASE._setWindowSize(8);function $(D,O,Y,Q=K){const J=D;if(O=Fi("msgHash",O),Y=Fi("publicKey",Y),"strict"in Q)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:ae}=Q;let _e,Me;try{if(typeof J=="string"||J instanceof Uint8Array)try{_e=A.fromDER(J)}catch(ft){if(!(ft instanceof Mr.Err))throw ft;_e=A.fromCompact(J)}else if(typeof J=="object"&&typeof J.r=="bigint"&&typeof J.s=="bigint"){const{r:ft,s:$e}=J;_e=new A(ft,$e)}else throw new Error("PARSE");Me=l.fromHex(Y)}catch(ft){if(ft.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&_e.hasHighS())return!1;ae&&(O=e.hash(O));const{r:se,s:me}=_e,xe=I(O),be=c(me),Ue=o(xe*be),et=o(se*be),He=l.BASE.multiplyAndAddUnsafe(Me,Ue,et)?.toAffine();return He?o(He.x)===se:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:S,sign:q,verify:$,ProjectivePoint:l,Signature:A,utils:_}}function bN(i){return{hash:i,hmac:(e,...t)=>Tx(i,e,xF(...t)),randomBytes:bF}}function EN(i,e){const t=n=>xN({...i,...bN(n)});return Object.freeze({...t(e),create:t})}const ab=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ob=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),yN=BigInt(1),$f=BigInt(2),cb=(i,e)=>(i+e/$f)/e;function _N(i){const e=ab,t=BigInt(3),n=BigInt(6),s=BigInt(11),r=BigInt(22),a=BigInt(23),o=BigInt(44),c=BigInt(88),l=i*i*i%e,h=l*l*i%e,u=pi(h,t,e)*h%e,d=pi(u,t,e)*h%e,f=pi(d,$f,e)*l%e,p=pi(f,s,e)*f%e,m=pi(p,r,e)*p%e,g=pi(m,o,e)*m%e,A=pi(g,c,e)*g%e,_=pi(A,o,e)*m%e,x=pi(_,t,e)*h%e,E=pi(x,a,e)*p%e,S=pi(E,n,e)*l%e,w=pi(S,$f,e);if(!ep.eql(ep.sqr(w),i))throw new Error("Cannot find square root");return w}const ep=lN(ab,void 0,void 0,{sqrt:_N}),$s=EN({a:BigInt(0),b:BigInt(7),Fp:ep,n:ob,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:i=>{const e=ob,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-yN*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),r=t,a=BigInt("0x100000000000000000000000000000000"),o=cb(r*i,e),c=cb(-n*i,e);let l=Xn(i-o*t-c*s,e),h=Xn(-o*n-c*r,e);const u=l>a,d=h>a;if(u&&(l=e-l),d&&(h=e-h),l>a||h>a)throw new Error("splitScalar: Endomorphism failed, k="+i);return{k1neg:u,k1:l,k2neg:d,k2:h}}}},Fx);BigInt(0),$s.ProjectivePoint;const rc="0x0000000000000000000000000000000000000000",lb="0x0000000000000000000000000000000000000000000000000000000000000000",hb=BigInt(0),ub=BigInt(1),tp=BigInt(2),db=BigInt(27),fb=BigInt(28),fh=BigInt(35),pb=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),wN=pb/tp,vN=Symbol.for("nodejs.util.inspect.custom"),Br={};function np(i){return us(rn(i),32)}class Vt{#e;#t;#n;#i;get r(){return this.#e}set r(e){V(ka(e)===32,"invalid r","value",e),this.#e=Ce(e)}get s(){return V(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){V(ka(e)===32,"invalid s","value",e),this.#t=Ce(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=wN}get v(){return this.#n}set v(e){const t=dt(e,"value");V(t===27||t===28,"invalid v","v",e),this.#n=t}get networkV(){return this.#i}get legacyChainId(){const e=this.networkV;return e==null?null:Vt.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ut(this.s);return this.yParity&&(e[0]|=128),Ce(e)}get compactSerialized(){return Gt([this.r,this.yParityAndS])}get serialized(){return Gt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,n,s){ih(e,Br,"Signature"),this.#e=t,this.#t=n,this.#n=s,this.#i=null}getCanonical(){if(this.isValid())return this;const e=pb-BigInt(this._s),t=55-this.v,n=new Vt(Br,this.r,np(e),t);return this.networkV&&(n.#i=this.networkV),n}clone(){const e=new Vt(Br,this.r,this._s,this.v);return this.networkV&&(e.#i=this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this._s,v:this.v}}[vN](){return this.toString()}toString(){return this.isValid()?`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`:`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`}static getChainId(e){const t=Ne(e,"v");return t==db||t==fb?hb:(V(t>=fh,"invalid EIP-155 v","v",e),(t-fh)/tp)}static getChainIdV(e,t){return Ne(e)*tp+BigInt(35+t-27)}static getNormalizedV(e){const t=Ne(e);return t===hb||t===db?27:t===ub||t===fb?28:(V(t>=fh,"invalid v","v",e),t&ub?27:28)}static from(e){function t(l,h){V(l,h,"signature",e)}if(e==null)return new Vt(Br,lb,lb,27);if(typeof e=="string"){const l=ut(e,"signature");if(l.length===64){const h=Ce(l.slice(0,32)),u=l.slice(32,64),d=u[0]&128?28:27;return u[0]&=127,new Vt(Br,h,Ce(u),d)}if(l.length===65){const h=Ce(l.slice(0,32)),u=Ce(l.slice(32,64)),d=Vt.getNormalizedV(l[64]);return new Vt(Br,h,u,d)}t(!1,"invalid raw signature length")}if(e instanceof Vt)return e.clone();const n=e.r;t(n!=null,"missing r");const s=np(n),r=(function(l,h){if(l!=null)return np(l);if(h!=null){t(Pt(h,32),"invalid yParityAndS");const u=ut(h);return u[0]&=127,Ce(u)}t(!1,"missing s")})(e.s,e.yParityAndS),{networkV:a,v:o}=(function(l,h,u){if(l!=null){const d=Ne(l);return{networkV:d>=fh?d:void 0,v:Vt.getNormalizedV(d)}}if(h!=null)return t(Pt(h,32),"invalid yParityAndS"),{v:ut(h)[0]&128?28:27};if(u!=null){switch(dt(u,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")})(e.v,e.yParityAndS,e.yParity),c=new Vt(Br,s,r,o);return a&&(c.#i=a),t(e.yParity==null||dt(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}}class ms{#e;constructor(e){V(ka(e)===32,"invalid private key","privateKey","[REDACTED]"),this.#e=Ce(e)}get privateKey(){return this.#e}get publicKey(){return ms.computePublicKey(this.#e)}get compressedPublicKey(){return ms.computePublicKey(this.#e,!0)}sign(e){V(ka(e)===32,"invalid digest length","digest",e);const t=$s.sign(zn(e),zn(this.#e),{lowS:!0});return Vt.from({r:Ks(t.r,32),s:Ks(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=ms.computePublicKey(e);return Ce($s.getSharedSecret(zn(this.#e),ut(t),!1))}static computePublicKey(e,t){let n=ut(e,"key");if(n.length===32){const r=$s.getPublicKey(n,!!t);return Ce(r)}if(n.length===64){const r=new Uint8Array(65);r[0]=4,r.set(n,1),n=r}const s=$s.ProjectivePoint.fromHex(n);return Ce(s.toRawBytes(t))}static recoverPublicKey(e,t){V(ka(e)===32,"invalid digest length","digest",e);const n=Vt.from(t);let s=$s.Signature.fromCompact(zn(Gt([n.r,n.s])));s=s.addRecoveryBit(n.yParity);const r=s.recoverPublicKey(zn(e));return V(r!=null,"invalid signature for digest","signature",t),"0x"+r.toHex(!1)}static addPoints(e,t,n){const s=$s.ProjectivePoint.fromHex(ms.computePublicKey(e).substring(2)),r=$s.ProjectivePoint.fromHex(ms.computePublicKey(t).substring(2));return"0x"+s.add(r).toHex(!!n)}}const CN=BigInt(0),IN=BigInt(36);function Ab(i){i=i.toLowerCase();const e=i.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const n=ut(an(t));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(n[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const ip={};for(let i=0;i<10;i++)ip[String(i)]=String(i);for(let i=0;i<26;i++)ip[String.fromCharCode(65+i)]=String(10+i);const gb=15;function SN(i){i=i.toUpperCase(),i=i.substring(4)+i.substring(0,2)+"00";let e=i.split("").map(n=>ip[n]).join("");for(;e.length>=gb;){let n=e.substring(0,gb);e=parseInt(n,10)%97+e.substring(n.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const MN=(function(){const i={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];i[t]=BigInt(e)}return i})();function BN(i){i=i.toLowerCase();let e=CN;for(let t=0;t<i.length;t++)e=e*IN+MN[i[t]];return e}function St(i){if(V(typeof i=="string","invalid address","address",i),i.match(/^(0x)?[0-9a-fA-F]{40}$/)){i.startsWith("0x")||(i="0x"+i);const e=Ab(i);return V(!i.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===i,"bad address checksum","address",i),e}if(i.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){V(i.substring(2,4)===SN(i),"bad icap checksum","address",i);let e=BN(i.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return Ab("0x"+e)}V(!1,"invalid address","address",i)}function TN(i){const e=St(i.from);let n=Ne(i.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,St(Kt(an(fs([e,n])),12))}function mb(i){return i&&typeof i.getAddress=="function"}async function sp(i,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(pe(typeof i!="string","unconfigured name","UNCONFIGURED_NAME",{value:i}),V(!1,"invalid AddressLike value; did not resolve to a value address","target",i)),St(t)}function Wn(i,e){if(typeof i=="string")return i.match(/^0x[0-9a-f]{40}$/i)?St(i):(pe(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),sp(i,e.resolveName(i)));if(mb(i))return sp(i,i.getAddress());if(i&&typeof i.then=="function")return sp(i,i);V(!1,"unsupported addressable value","target",i)}const xs={};function Be(i,e){let t=!1;return e<0&&(t=!0,e*=-1),new jt(xs,`${t?"":"u"}int${e}`,i,{signed:t,width:e})}function wt(i,e){return new jt(xs,`bytes${e||""}`,i,{size:e})}const xb=Symbol.for("_ethers_typed");class jt{type;value;#e;_typedSymbol;constructor(e,t,n,s){s==null&&(s=null),ih(xs,e,"Typed"),Ye(this,{_typedSymbol:xb,type:t,value:n}),this.#e=s,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#e}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#e===!0?-1:this.#e===!1?this.value.length:null}static from(e,t){return new jt(xs,e,t)}static uint8(e){return Be(e,8)}static uint16(e){return Be(e,16)}static uint24(e){return Be(e,24)}static uint32(e){return Be(e,32)}static uint40(e){return Be(e,40)}static uint48(e){return Be(e,48)}static uint56(e){return Be(e,56)}static uint64(e){return Be(e,64)}static uint72(e){return Be(e,72)}static uint80(e){return Be(e,80)}static uint88(e){return Be(e,88)}static uint96(e){return Be(e,96)}static uint104(e){return Be(e,104)}static uint112(e){return Be(e,112)}static uint120(e){return Be(e,120)}static uint128(e){return Be(e,128)}static uint136(e){return Be(e,136)}static uint144(e){return Be(e,144)}static uint152(e){return Be(e,152)}static uint160(e){return Be(e,160)}static uint168(e){return Be(e,168)}static uint176(e){return Be(e,176)}static uint184(e){return Be(e,184)}static uint192(e){return Be(e,192)}static uint200(e){return Be(e,200)}static uint208(e){return Be(e,208)}static uint216(e){return Be(e,216)}static uint224(e){return Be(e,224)}static uint232(e){return Be(e,232)}static uint240(e){return Be(e,240)}static uint248(e){return Be(e,248)}static uint256(e){return Be(e,256)}static uint(e){return Be(e,256)}static int8(e){return Be(e,-8)}static int16(e){return Be(e,-16)}static int24(e){return Be(e,-24)}static int32(e){return Be(e,-32)}static int40(e){return Be(e,-40)}static int48(e){return Be(e,-48)}static int56(e){return Be(e,-56)}static int64(e){return Be(e,-64)}static int72(e){return Be(e,-72)}static int80(e){return Be(e,-80)}static int88(e){return Be(e,-88)}static int96(e){return Be(e,-96)}static int104(e){return Be(e,-104)}static int112(e){return Be(e,-112)}static int120(e){return Be(e,-120)}static int128(e){return Be(e,-128)}static int136(e){return Be(e,-136)}static int144(e){return Be(e,-144)}static int152(e){return Be(e,-152)}static int160(e){return Be(e,-160)}static int168(e){return Be(e,-168)}static int176(e){return Be(e,-176)}static int184(e){return Be(e,-184)}static int192(e){return Be(e,-192)}static int200(e){return Be(e,-200)}static int208(e){return Be(e,-208)}static int216(e){return Be(e,-216)}static int224(e){return Be(e,-224)}static int232(e){return Be(e,-232)}static int240(e){return Be(e,-240)}static int248(e){return Be(e,-248)}static int256(e){return Be(e,-256)}static int(e){return Be(e,-256)}static bytes1(e){return wt(e,1)}static bytes2(e){return wt(e,2)}static bytes3(e){return wt(e,3)}static bytes4(e){return wt(e,4)}static bytes5(e){return wt(e,5)}static bytes6(e){return wt(e,6)}static bytes7(e){return wt(e,7)}static bytes8(e){return wt(e,8)}static bytes9(e){return wt(e,9)}static bytes10(e){return wt(e,10)}static bytes11(e){return wt(e,11)}static bytes12(e){return wt(e,12)}static bytes13(e){return wt(e,13)}static bytes14(e){return wt(e,14)}static bytes15(e){return wt(e,15)}static bytes16(e){return wt(e,16)}static bytes17(e){return wt(e,17)}static bytes18(e){return wt(e,18)}static bytes19(e){return wt(e,19)}static bytes20(e){return wt(e,20)}static bytes21(e){return wt(e,21)}static bytes22(e){return wt(e,22)}static bytes23(e){return wt(e,23)}static bytes24(e){return wt(e,24)}static bytes25(e){return wt(e,25)}static bytes26(e){return wt(e,26)}static bytes27(e){return wt(e,27)}static bytes28(e){return wt(e,28)}static bytes29(e){return wt(e,29)}static bytes30(e){return wt(e,30)}static bytes31(e){return wt(e,31)}static bytes32(e){return wt(e,32)}static address(e){return new jt(xs,"address",e)}static bool(e){return new jt(xs,"bool",!!e)}static bytes(e){return new jt(xs,"bytes",e)}static string(e){return new jt(xs,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new jt(xs,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===xb}static dereference(e,t){if(jt.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}}class RN extends As{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=jt.dereference(t,"string");try{n=St(n)}catch(s){return this._throwError(s.message,t)}return e.writeValue(n)}decode(e){return St(Ks(e.readValue(),20))}}class FN extends As{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}function bb(i,e,t){let n=[];if(Array.isArray(t))n=t;else if(t&&typeof t=="object"){let c={};n=e.map(l=>{const h=l.localName;return pe(h,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),pe(!c[h],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),c[h]=!0,t[h]})}else V(!1,"invalid tuple value","tuple",t);V(e.length===n.length,"types/value length mismatch","tuple",t);let s=new Pf,r=new Pf,a=[];e.forEach((c,l)=>{let h=n[l];if(c.dynamic){let u=r.length;c.encode(r,h);let d=s.writeUpdatableValue();a.push(f=>{d(f+u)})}else c.encode(s,h)}),a.forEach(c=>{c(s.length)});let o=i.appendWriter(s);return o+=i.appendWriter(r),o}function Eb(i,e){let t=[],n=[],s=i.subReader(0);return e.forEach(r=>{let a=null;if(r.dynamic){let o=i.readIndex(),c=s.subReader(o);try{a=r.decode(c)}catch(l){if(Tn(l,"BUFFER_OVERRUN"))throw l;a=l,a.baseType=r.name,a.name=r.localName,a.type=r.type}}else try{a=r.decode(i)}catch(o){if(Tn(o,"BUFFER_OVERRUN"))throw o;a=o,a.baseType=r.name,a.name=r.localName,a.type=r.type}if(a==null)throw new Error("investigate");t.push(a),n.push(r.localName||null)}),ps.fromItems(t,n)}class NN extends As{coder;length;constructor(e,t,n){const s=e.type+"["+(t>=0?t:"")+"]",r=t===-1||e.dynamic;super("array",s,n,r),Ye(this,{coder:e,length:t})}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){const n=jt.dereference(t,"array");Array.isArray(n)||this._throwError("expected array value",n);let s=this.length;s===-1&&(s=n.length,e.writeValue(n.length)),nx(n.length,s,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let a=0;a<n.length;a++)r.push(this.coder);return bb(e,r,n)}decode(e){let t=this.length;t===-1&&(t=e.readIndex(),pe(t*Vn<=e.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:e.bytes,offset:t*Vn,length:e.dataLength}));let n=[];for(let s=0;s<t;s++)n.push(new FN(this.coder));return Eb(e,n)}}class DN extends As{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const n=jt.dereference(t,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class yb extends As{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=zn(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class LN extends yb{constructor(e){super("bytes",e)}decode(e){return Ce(super.decode(e))}}class PN extends As{size;constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),Ye(this,{size:e},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,t){let n=zn(jt.dereference(t,this.type));return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return Ce(e.readBytes(this.size))}}const kN=new Uint8Array([]);class UN extends As{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(kN)}decode(e){return e.readBytes(0),null}}const ON=BigInt(0),QN=BigInt(1),GN=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class HN extends As{size;signed;constructor(e,t,n){const s=(t?"int":"uint")+e*8;super(s,s,n,!1),Ye(this,{size:e,signed:t},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(e,t){let n=Ne(jt.dereference(t,this.type)),s=Zo(GN,Vn*8);if(this.signed){let r=Zo(s,this.size*8-1);(n>r||n<-(r+QN))&&this._throwError("value out-of-bounds",t),n=ax(n,8*Vn)}else(n<ON||n>Zo(s,this.size*8))&&this._throwError("value out-of-bounds",t);return e.writeValue(n)}decode(e){let t=Zo(e.readValue(),this.size*8);return this.signed&&(t=YR(t,this.size*8)),t}}class zN extends yb{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,ds(jt.dereference(t,"string")))}decode(e){return rh(super.decode(e))}}class ph extends As{coders;constructor(e,t){let n=!1;const s=[];e.forEach(a=>{a.dynamic&&(n=!0),s.push(a.type)});const r="tuple("+s.join(",")+")";super("tuple",r,t,n),Ye(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const t=this.coders.reduce((n,s)=>{const r=s.localName;return r&&(n[r]||(n[r]=0),n[r]++),n},{});return this.coders.forEach((n,s)=>{let r=n.localName;!r||t[r]!==1||(r==="length"&&(r="_length"),e[r]==null&&(e[r]=e[s]))}),Object.freeze(e)}encode(e,t){const n=jt.dereference(t,"tuple");return bb(e,this.coders,n)}decode(e){return Eb(e,this.coders)}}function rp(i,e){return{address:St(i),storageKeys:e.map((t,n)=>(V(Pt(t,32),"invalid slot",`storageKeys[${n}]`,t),t.toLowerCase()))}}function Tr(i){if(Array.isArray(i))return i.map((t,n)=>Array.isArray(t)?(V(t.length===2,"invalid slot set",`value[${n}]`,t),rp(t[0],t[1])):(V(t!=null&&typeof t=="object","invalid address-slot set","value",i),rp(t.address,t.storageKeys)));V(i!=null&&typeof i=="object","invalid access list","value",i);const e=Object.keys(i).map(t=>{const n=i[t].reduce((s,r)=>(s[r]=!0,s),{});return rp(t,Object.keys(n).sort())});return e.sort((t,n)=>t.address.localeCompare(n.address)),e}function _b(i){return{address:St(i.address),nonce:Ne(i.nonce!=null?i.nonce:0),chainId:Ne(i.chainId!=null?i.chainId:0),signature:Vt.from(i.signature)}}function VN(i){let e;return typeof i=="string"?e=ms.computePublicKey(i,!1):e=i.publicKey,St(an("0x"+e.substring(4)).substring(26))}function WN(i,e){return VN(ms.recoverPublicKey(i,e))}const _n=BigInt(0),qN=BigInt(2),KN=BigInt(27),jN=BigInt(28),XN=BigInt(35),YN=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),JN=Symbol.for("nodejs.util.inspect.custom"),ap=4096*32,Ah=128;function ZN(i){return{blobToKzgCommitment:n=>{if("computeBlobProof"in i){if("blobToKzgCommitment"in i&&typeof i.blobToKzgCommitment=="function")return ut(i.blobToKzgCommitment(Ce(n)))}else if("blobToKzgCommitment"in i&&typeof i.blobToKzgCommitment=="function")return ut(i.blobToKzgCommitment(n));if("blobToKZGCommitment"in i&&typeof i.blobToKZGCommitment=="function")return ut(i.blobToKZGCommitment(Ce(n)));V(!1,"unsupported KZG library","kzg",i)},computeBlobKzgProof:(n,s)=>{if("computeBlobProof"in i&&typeof i.computeBlobProof=="function")return ut(i.computeBlobProof(Ce(n),Ce(s)));if("computeBlobKzgProof"in i&&typeof i.computeBlobKzgProof=="function")return i.computeBlobKzgProof(n,s);if("computeBlobKZGProof"in i&&typeof i.computeBlobKZGProof=="function")return ut(i.computeBlobKZGProof(Ce(n),Ce(s)));V(!1,"unsupported KZG library","kzg",i)}}}function wb(i,e){let t=i.toString(16);for(;t.length<2;)t="0"+t;return t+=Qa(e).substring(4),"0x"+t}function za(i){return i==="0x"?null:St(i)}function gh(i,e){try{return Tr(i)}catch(t){V(!1,t.message,e,i)}}function $N(i,e){try{if(!Array.isArray(i))throw new Error("authorizationList: invalid array");const t=[];for(let n=0;n<i.length;n++){const s=i[n];if(!Array.isArray(s))throw new Error(`authorization[${n}]: invalid array`);if(s.length!==6)throw new Error(`authorization[${n}]: wrong length`);if(!s[1])throw new Error(`authorization[${n}]: null address`);t.push({address:za(s[1]),nonce:Nt(s[2],"nonce"),chainId:Nt(s[0],"chainId"),signature:Vt.from({yParity:Rr(s[3],"yParity"),r:us(s[4],32),s:us(s[5],32)})})}return t}catch(t){V(!1,t.message,e,i)}}function Rr(i,e){return i==="0x"?0:dt(i,e)}function Nt(i,e){if(i==="0x")return _n;const t=Ne(i,e);return V(t<=YN,"value exceeds uint size",e,t),t}function xt(i,e){const t=Ne(i,"value"),n=rn(t);return V(n.length<=32,"value too large",`tx.${e}`,t),n}function mh(i){return Tr(i).map(e=>[e.address,e.storageKeys])}function eD(i){return i.map(e=>[xt(e.chainId,"chainId"),e.address,xt(e.nonce,"nonce"),xt(e.signature.yParity,"yParity"),rn(e.signature.r),rn(e.signature._s)])}function tD(i,e){V(Array.isArray(i),`invalid ${e}`,"value",i);for(let t=0;t<i.length;t++)V(Pt(i[t],32),"invalid ${ param } hash",`value[${t}]`,i[t]);return i}function nD(i){const e=$o(i);V(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",i);const t={type:0,nonce:Rr(e[0],"nonce"),gasPrice:Nt(e[1],"gasPrice"),gasLimit:Nt(e[2],"gasLimit"),to:za(e[3]),value:Nt(e[4],"value"),data:Ce(e[5]),chainId:_n};if(e.length===6)return t;const n=Nt(e[6],"v"),s=Nt(e[7],"r"),r=Nt(e[8],"s");if(s===_n&&r===_n)t.chainId=n;else{let a=(n-XN)/qN;a<_n&&(a=_n),t.chainId=a,V(a!==_n||n===KN||n===jN,"non-canonical legacy v","v",e[6]),t.signature=Vt.from({r:us(e[7],32),s:us(e[8],32),v:n})}return t}function iD(i,e){const t=[xt(i.nonce,"nonce"),xt(i.gasPrice||0,"gasPrice"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data];let n=_n;if(i.chainId!=_n)n=Ne(i.chainId,"tx.chainId"),V(!e||e.networkV==null||e.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",e);else if(i.signature){const r=i.signature.legacyChainId;r!=null&&(n=r)}if(!e)return n!==_n&&(t.push(rn(n)),t.push("0x"),t.push("0x")),fs(t);let s=BigInt(27+e.yParity);return n!==_n?s=Vt.getChainIdV(n,e.v):BigInt(e.v)!==s&&V(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(rn(s)),t.push(rn(e.r)),t.push(rn(e._s)),fs(t)}function xh(i,e){let t;try{if(t=Rr(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{V(!1,"invalid yParity","yParity",e[0])}const n=us(e[1],32),s=us(e[2],32),r=Vt.from({r:n,s,yParity:t});i.signature=r}function sD(i){const e=$o(ut(i).slice(1));V(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Ce(i));const t={type:2,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),maxPriorityFeePerGas:Nt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Nt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Nt(e[4],"gasLimit"),to:za(e[5]),value:Nt(e[6],"value"),data:Ce(e[7]),accessList:gh(e[8],"accessList")};return e.length===9||xh(t,e.slice(9)),t}function rD(i,e){const t=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),xt(i.maxFeePerGas||0,"maxFeePerGas"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data,mh(i.accessList||[])];return e&&(t.push(xt(e.yParity,"yParity")),t.push(rn(e.r)),t.push(rn(e.s))),Gt(["0x02",fs(t)])}function aD(i){const e=$o(ut(i).slice(1));V(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Ce(i));const t={type:1,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),gasPrice:Nt(e[2],"gasPrice"),gasLimit:Nt(e[3],"gasLimit"),to:za(e[4]),value:Nt(e[5],"value"),data:Ce(e[6]),accessList:gh(e[7],"accessList")};return e.length===8||xh(t,e.slice(8)),t}function oD(i,e){const t=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.gasPrice||0,"gasPrice"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data,mh(i.accessList||[])];return e&&(t.push(xt(e.yParity,"recoveryParam")),t.push(rn(e.r)),t.push(rn(e.s))),Gt(["0x01",fs(t)])}function cD(i){let e=$o(ut(i).slice(1)),t="3",n=null,s=null;if(e.length===4&&Array.isArray(e[0])){t="3 (network format)";const a=e[1],o=e[2],c=e[3];V(Array.isArray(a),"invalid network format: blobs not an array","fields[1]",a),V(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),V(Array.isArray(c),"invalid network format: proofs not an array","fields[3]",c),V(a.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),V(a.length===c.length,"invalid network format: blobs/proofs length mismatch","fields",e),s=[];for(let l=0;l<e[1].length;l++)s.push({data:a[l],commitment:o[l],proof:c[l]});e=e[0]}else if(e.length===5&&Array.isArray(e[0])){t="3 (EIP-7594 network format)",n=dt(e[1]);const a=e[2],o=e[3],c=e[4];V(n===1,`unsupported EIP-7594 network format version: ${n}`,"fields[1]",n),V(Array.isArray(a),"invalid EIP-7594 network format: blobs not an array","fields[2]",a),V(Array.isArray(o),"invalid EIP-7594 network format: commitments not an array","fields[3]",o),V(Array.isArray(c),"invalid EIP-7594 network format: proofs not an array","fields[4]",c),V(a.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),V(a.length*Ah===c.length,"invalid network format: blobs/proofs length mismatch","fields",e),s=[];for(let l=0;l<a.length;l++){const h=[];for(let u=0;u<Ah;u++)h.push(c[l*Ah+u]);s.push({data:a[l],commitment:o[l],proof:Gt(h)})}e=e[0]}V(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${t}`,"data",Ce(i));const r={type:3,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),maxPriorityFeePerGas:Nt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Nt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Nt(e[4],"gasLimit"),to:za(e[5]),value:Nt(e[6],"value"),data:Ce(e[7]),accessList:gh(e[8],"accessList"),maxFeePerBlobGas:Nt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10],blobWrapperVersion:n};s&&(r.blobs=s),V(r.to!=null,`invalid address for transaction type: ${t}`,"data",i),V(Array.isArray(r.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",i);for(let a=0;a<r.blobVersionedHashes.length;a++)V(Pt(r.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",i);return e.length===11||xh(r,e.slice(11)),r}function lD(i,e,t){const n=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),xt(i.maxFeePerGas||0,"maxFeePerGas"),xt(i.gasLimit,"gasLimit"),i.to||rc,xt(i.value,"value"),i.data,mh(i.accessList||[]),xt(i.maxFeePerBlobGas||0,"maxFeePerBlobGas"),tD(i.blobVersionedHashes||[],"blobVersionedHashes")];if(e&&(n.push(xt(e.yParity,"yParity")),n.push(rn(e.r)),n.push(rn(e.s)),t)){if(i.blobWrapperVersion!=null){const s=rn(i.blobWrapperVersion),r=[];for(const{proof:a}of t){const o=ut(a),c=o.length/Ah;for(let l=0;l<o.length;l+=c)r.push(o.subarray(l,l+c))}return Gt(["0x03",fs([n,s,t.map(a=>a.data),t.map(a=>a.commitment),r])])}return Gt(["0x03",fs([n,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])])}return Gt(["0x03",fs(n)])}function hD(i){const e=$o(ut(i).slice(1));V(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",Ce(i));const t={type:4,chainId:Nt(e[0],"chainId"),nonce:Rr(e[1],"nonce"),maxPriorityFeePerGas:Nt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Nt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Nt(e[4],"gasLimit"),to:za(e[5]),value:Nt(e[6],"value"),data:Ce(e[7]),accessList:gh(e[8],"accessList"),authorizationList:$N(e[9],"authorizationList")};return e.length===10||xh(t,e.slice(10)),t}function uD(i,e){const t=[xt(i.chainId,"chainId"),xt(i.nonce,"nonce"),xt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),xt(i.maxFeePerGas||0,"maxFeePerGas"),xt(i.gasLimit,"gasLimit"),i.to||"0x",xt(i.value,"value"),i.data,mh(i.accessList||[]),eD(i.authorizationList||[])];return e&&(t.push(xt(e.yParity,"yParity")),t.push(rn(e.r)),t.push(rn(e.s))),Gt(["0x04",fs(t)])}class Ni{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;#c;#h;#u;#d;#x;#g;get type(){return this.#e}set type(e){switch(e){case null:this.#e=null;break;case 0:case"legacy":this.#e=0;break;case 1:case"berlin":case"eip-2930":this.#e=1;break;case 2:case"london":case"eip-1559":this.#e=2;break;case 3:case"cancun":case"eip-4844":this.#e=3;break;case 4:case"pectra":case"eip-7702":this.#e=4;break;default:V(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const e=this.#t;return e==null&&this.type===3?rc:e}set to(e){this.#t=e==null?null:St(e)}get nonce(){return this.#i}set nonce(e){this.#i=dt(e,"value")}get gasLimit(){return this.#s}set gasLimit(e){this.#s=Ne(e)}get gasPrice(){const e=this.#a;return e==null&&(this.type===0||this.type===1)?_n:e}set gasPrice(e){this.#a=e==null?null:Ne(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#r;return e??(this.type===2||this.type===3?_n:null)}set maxPriorityFeePerGas(e){this.#r=e==null?null:Ne(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#o;return e??(this.type===2||this.type===3?_n:null)}set maxFeePerGas(e){this.#o=e==null?null:Ne(e,"maxFeePerGas")}get data(){return this.#n}set data(e){this.#n=Ce(e)}get value(){return this.#f}set value(e){this.#f=Ne(e,"value")}get chainId(){return this.#l}set chainId(e){this.#l=Ne(e)}get signature(){return this.#p||null}set signature(e){this.#p=e==null?null:Vt.from(e)}isValid(){const e=this.signature;if(e&&!e.isValid())return!1;const t=this.authorizationList;if(t){for(const n of t)if(!n.signature.isValid())return!1}return!0}get accessList(){const e=this.#A||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){this.#A=e==null?null:Tr(e)}get authorizationList(){const e=this.#x||null;return e==null&&this.type===4?[]:e}set authorizationList(e){this.#x=e==null?null:e.map(t=>_b(t))}get maxFeePerBlobGas(){const e=this.#c;return e==null&&this.type===3?_n:e}set maxFeePerBlobGas(e){this.#c=e==null?null:Ne(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#h;return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){V(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)V(Pt(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}this.#h=e}get blobs(){return this.#d==null?null:this.#d.map(e=>Object.assign({},e))}set blobs(e){if(e==null){this.#d=null;return}const t=[],n=[];for(let s=0;s<e.length;s++){const r=e[s];if(Rf(r)){pe(this.#u,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let a=ut(r);if(V(a.length<=ap,"blob is too large",`blobs[${s}]`,r),a.length!==ap){const l=new Uint8Array(ap);l.set(a),a=l}const o=this.#u.blobToKzgCommitment(a),c=Ce(this.#u.computeBlobKzgProof(a,o));t.push({data:Ce(a),commitment:Ce(o),proof:c}),n.push(wb(1,o))}else{const a=Ce(r.data),o=Ce(r.commitment),c=Ce(r.proof);t.push({data:a,commitment:o,proof:c}),n.push(wb(1,o))}}this.#d=t,this.#h=n}get kzg(){return this.#u}set kzg(e){e==null?this.#u=null:this.#u=ZN(e)}get blobWrapperVersion(){return this.#g}set blobWrapperVersion(e){this.#g=e}constructor(){this.#e=null,this.#t=null,this.#i=0,this.#s=_n,this.#a=null,this.#r=null,this.#o=null,this.#n="0x",this.#f=_n,this.#l=_n,this.#p=null,this.#A=null,this.#c=null,this.#h=null,this.#u=null,this.#d=null,this.#x=null,this.#g=null}get hash(){return this.signature==null?null:an(this.#m(!0,!1))}get unsignedHash(){return an(this.unsignedSerialized)}get from(){return this.signature==null?null:WN(this.unsignedHash,this.signature.getCanonical())}get fromPublicKey(){return this.signature==null?null:ms.recoverPublicKey(this.unsignedHash,this.signature.getCanonical())}isSigned(){return this.signature!=null}#m(e,t){pe(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return iD(this,n);case 1:return oD(this,n);case 2:return rD(this,n);case 3:return lD(this,n,t?this.blobs:null);case 4:return uD(this,n)}pe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#m(!0,!0)}get unsignedSerialized(){return this.#m(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,s=this.#c!=null||this.#h;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&pe(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),pe(!t||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),pe(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const r=[];return this.type!=null?r.push(this.type):this.authorizationList&&this.authorizationList.length?r.push(4):t?r.push(2):e?(r.push(1),n||r.push(0)):n?(r.push(1),r.push(2)):(s&&this.to||(r.push(0),r.push(1),r.push(2)),r.push(3)),r.sort(),r}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Ni.from(this)}toJSON(){const e=t=>t==null?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}[JN](){return this.toString()}toString(){const e=[],t=s=>{let r=this[s];typeof r=="string"&&(r=JSON.stringify(r)),e.push(`${s}: ${r}`)};this.type&&t("type"),t("to"),t("data"),t("nonce"),t("gasLimit"),t("value"),this.chainId!=null&&t("chainId"),this.signature&&(t("from"),e.push(`signature: ${this.signature.toString()}`));const n=this.authorizationList;if(n){const s=[];for(const r of n){const a=[];a.push(`address: ${JSON.stringify(r.address)}`),r.nonce!=null&&a.push(`nonce: ${r.nonce}`),r.chainId!=null&&a.push(`chainId: ${r.chainId}`),r.signature&&a.push(`signature: ${r.signature.toString()}`),s.push(`Authorization { ${a.join(", ")} }`)}e.push(`authorizations: [ ${s.join(", ")} ]`)}return`Transaction { ${e.join(", ")} }`}static from(e){if(e==null)return new Ni;if(typeof e=="string"){const n=ut(e);if(n[0]>=127)return Ni.from(nD(n));switch(n[0]){case 1:return Ni.from(aD(n));case 2:return Ni.from(sD(n));case 3:return Ni.from(cD(n));case 4:return Ni.from(hD(n))}pe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Ni;return e.type!=null&&(t.type=e.type),e.to!=null&&(t.to=e.to),e.nonce!=null&&(t.nonce=e.nonce),e.gasLimit!=null&&(t.gasLimit=e.gasLimit),e.gasPrice!=null&&(t.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(t.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(t.data=e.data),e.value!=null&&(t.value=e.value),e.chainId!=null&&(t.chainId=e.chainId),e.signature!=null&&(t.signature=Vt.from(e.signature)),e.accessList!=null&&(t.accessList=e.accessList),e.authorizationList!=null&&(t.authorizationList=e.authorizationList),e.blobVersionedHashes!=null&&(t.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(t.kzg=e.kzg),e.blobWrapperVersion!=null&&(t.blobWrapperVersion=e.blobWrapperVersion),e.blobs!=null&&(t.blobs=e.blobs),e.hash!=null&&(V(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),V(t.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(V(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),V(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}}function Fr(i){return an(ds(i))}var dD="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwAB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zMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const vb=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Cb=4;function fD(i){let e=0;function t(){return i[e++]<<8|i[e++]}let n=t(),s=1,r=[0,1];for(let S=1;S<n;S++)r.push(s+=t());let a=t(),o=e;e+=a;let c=0,l=0;function h(){return c==0&&(l=l<<8|i[e++],c=8),l>>--c&1}const u=31,d=2**u,f=d>>>1,p=f>>1,m=d-1;let g=0;for(let S=0;S<u;S++)g=g<<1|h();let A=[],_=0,x=d;for(;;){let S=Math.floor(((g-_+1)*s-1)/x),w=0,I=n;for(;I-w>1;){let v=w+I>>>1;S<r[v]?I=v:w=v}if(w==0)break;A.push(w);let T=_+Math.floor(x*r[w]/s),C=_+Math.floor(x*r[w+1]/s)-1;for(;((T^C)&f)==0;)g=g<<1&m|h(),T=T<<1&m,C=C<<1&m|1;for(;T&~C&p;)g=g&f|g<<1&m>>>1|h(),T=T<<1^f,C=(C^f)<<1|f|1;_=T,x=1+C-T}let E=n-4;return A.map(S=>{switch(S-E){case 3:return E+65792+(i[o++]<<16|i[o++]<<8|i[o++]);case 2:return E+256+(i[o++]<<8|i[o++]);case 1:return E+i[o++];default:return S-1}})}function pD(i){let e=0;return()=>i[e++]}function Ib(i){return pD(fD(AD(i)))}function AD(i){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,r)=>e[s.charCodeAt(0)]=r);let t=i.length,n=new Uint8Array(6*t>>3);for(let s=0,r=0,a=0,o=0;s<t;s++)o=o<<6|e[i.charCodeAt(s)],a+=6,a>=8&&(n[r++]=o>>(a-=8));return n}function gD(i){return i&1?~i>>1:i>>1}function mD(i,e){let t=Array(i);for(let n=0,s=0;n<i;n++)t[n]=s+=gD(e());return t}function ac(i,e=0){let t=[];for(;;){let n=i(),s=i();if(!s)break;e+=n;for(let r=0;r<s;r++)t.push(e+r);e+=s+1}return t}function Sb(i){return oc(()=>{let e=ac(i);if(e.length)return e})}function Mb(i){let e=[];for(;;){let t=i();if(t==0)break;e.push(xD(t,i))}for(;;){let t=i()-1;if(t<0)break;e.push(bD(t,i))}return e.flat()}function oc(i){let e=[];for(;;){let t=i(e.length);if(!t)break;e.push(t)}return e}function Bb(i,e,t){let n=Array(i).fill().map(()=>[]);for(let s=0;s<e;s++)mD(i,t).forEach((r,a)=>n[a].push(r));return n}function xD(i,e){let t=1+e(),n=e(),s=oc(e);return Bb(s.length,1+i,e).flatMap((a,o)=>{let[c,...l]=a;return Array(s[o]).fill().map((h,u)=>{let d=u*n;return[c+u*t,l.map(f=>f+d)]})})}function bD(i,e){let t=1+e();return Bb(t,1+i,e).map(s=>[s[0],s.slice(1)])}function ED(i){let e=[],t=ac(i);return s(n([]),[]),e;function n(r){let a=i(),o=oc(()=>{let c=ac(i).map(l=>t[l]);if(c.length)return n(c)});return{S:a,B:o,Q:r}}function s({S:r,B:a},o,c){if(!(r&4&&c===o[o.length-1])){r&2&&(c=o[o.length-1]),r&1&&e.push(o);for(let l of a)for(let h of l.Q)s(l,[...o,h],c)}}}function yD(i){return i.toString(16).toUpperCase().padStart(2,"0")}function Tb(i){return`{${yD(i)}}`}function _D(i){let e=[];for(let t=0,n=i.length;t<n;){let s=i.codePointAt(t);t+=s<65536?1:2,e.push(s)}return e}function Va(i){let t=i.length;if(t<4096)return String.fromCodePoint(...i);let n=[];for(let s=0;s<t;)n.push(String.fromCodePoint(...i.slice(s,s+=4096)));return n.join("")}function wD(i,e){let t=i.length,n=t-e.length;for(let s=0;n==0&&s<t;s++)n=i[s]-e[s];return n}var vD="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lE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OVPwpUC01nhxZuY/63E7g";const cc=44032,bh=4352,Eh=4449,yh=4519,Rb=19,Fb=21,Wa=28,_h=Fb*Wa,CD=Rb*_h,ID=cc+CD,SD=bh+Rb,MD=Eh+Fb,BD=yh+Wa;function lc(i){return i>>24&255}function Nb(i){return i&16777215}let op,Db,cp,wh;function TD(){let i=Ib(vD);op=new Map(Sb(i).flatMap((e,t)=>e.map(n=>[n,t+1<<24]))),Db=new Set(ac(i)),cp=new Map,wh=new Map;for(let[e,t]of Mb(i)){if(!Db.has(e)&&t.length==2){let[n,s]=t,r=wh.get(n);r||(r=new Map,wh.set(n,r)),r.set(s,e)}cp.set(e,t.reverse())}}function Lb(i){return i>=cc&&i<ID}function RD(i,e){if(i>=bh&&i<SD&&e>=Eh&&e<MD)return cc+(i-bh)*_h+(e-Eh)*Wa;if(Lb(i)&&e>yh&&e<BD&&(i-cc)%Wa==0)return i+(e-yh);{let t=wh.get(i);return t&&(t=t.get(e),t)?t:-1}}function Pb(i){op||TD();let e=[],t=[],n=!1;function s(r){let a=op.get(r);a&&(n=!0,r|=a),e.push(r)}for(let r of i)for(;;){if(r<128)e.push(r);else if(Lb(r)){let a=r-cc,o=a/_h|0,c=a%_h/Wa|0,l=a%Wa;s(bh+o),s(Eh+c),l>0&&s(yh+l)}else{let a=cp.get(r);a?t.push(...a):s(r)}if(!t.length)break;r=t.pop()}if(n&&e.length>1){let r=lc(e[0]);for(let a=1;a<e.length;a++){let o=lc(e[a]);if(o==0||r<=o){r=o;continue}let c=a-1;for(;;){let l=e[c+1];if(e[c+1]=e[c],e[c]=l,!c||(r=lc(e[--c]),r<=o))break}r=lc(e[a])}}return e}function FD(i){let e=[],t=[],n=-1,s=0;for(let r of i){let a=lc(r),o=Nb(r);if(n==-1)a==0?n=o:e.push(o);else if(s>0&&s>=a)a==0?(e.push(n,...t),t.length=0,n=o):t.push(o),s=a;else{let c=RD(n,o);c>=0?n=c:s==0&&a==0?(e.push(n),n=o):(t.push(o),s=a)}}return n>=0&&e.push(n,...t),e}function kb(i){return Pb(i).map(Nb)}function ND(i){return FD(Pb(i))}const Ub=45,Ob=".",Qb=65039,Gb=1,vh=i=>Array.from(i);function hc(i,e){return i.P.has(e)||i.Q.has(e)}class DD extends Array{get is_emoji(){return!0}}let lp,Hb,Nr,hp,zb,qa,up,Ka,Dr,Vb,dp;function fp(){if(lp)return;let i=Ib(dD);const e=()=>ac(i),t=()=>new Set(e()),n=(h,u)=>u.forEach(d=>h.add(d));lp=new Map(Mb(i)),Hb=t(),Nr=e(),hp=new Set(e().map(h=>Nr[h])),Nr=new Set(Nr),zb=t(),t();let s=Sb(i),r=i();const a=()=>{let h=new Set;return e().forEach(u=>n(h,s[u])),n(h,e()),h};qa=oc(h=>{let u=oc(i).map(d=>d+96);if(u.length){let d=h>=r;u[0]-=32,u=Va(u),d&&(u=`Restricted[${u}]`);let f=a(),p=a(),m=!i();return{N:u,P:f,Q:p,M:m,R:d}}}),up=t(),Ka=new Map;let o=e().concat(vh(up)).sort((h,u)=>h-u);o.forEach((h,u)=>{let d=i(),f=o[u]=d?o[u-d]:{V:[],M:new Map};f.V.push(h),up.has(h)||Ka.set(h,f)});for(let{V:h,M:u}of new Set(Ka.values())){let d=[];for(let p of h){let m=qa.filter(A=>hc(A,p)),g=d.find(({G:A})=>m.some(_=>A.has(_)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),n(g.G,m)}let f=d.flatMap(p=>vh(p.G));for(let{G:p,V:m}of d){let g=new Set(f.filter(A=>!p.has(A)));for(let A of m)u.set(A,g)}}Dr=new Set;let c=new Set;const l=h=>Dr.has(h)?c.add(h):Dr.add(h);for(let h of qa){for(let u of h.P)l(u);for(let u of h.Q)l(u)}for(let h of Dr)!Ka.has(h)&&!c.has(h)&&Ka.set(h,Gb);n(Dr,kb(Dr)),Vb=ED(i).map(h=>DD.from(h)).sort(wD),dp=new Map;for(let h of Vb){let u=[dp];for(let d of h){let f=u.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===Qb?u.push(...f):u=f}for(let d of u)d.V=h}}function pp(i){return(Wb(i)?"":`${Ap(Ch([i]))} `)+Tb(i)}function Ap(i){return`"${i}"‎`}function LD(i){if(i.length>=4&&i[2]==Ub&&i[3]==Ub)throw new Error(`invalid label extension: "${Va(i.slice(0,4))}"`)}function PD(i){for(let t=i.lastIndexOf(95);t>0;)if(i[--t]!==95)throw new Error("underscore allowed only at start")}function kD(i){let e=i[0],t=vb.get(e);if(t)throw uc(`leading ${t}`);let n=i.length,s=-1;for(let r=1;r<n;r++){e=i[r];let a=vb.get(e);if(a){if(s==r)throw uc(`${t} + ${a}`);s=r+1,t=a}}if(s==n)throw uc(`trailing ${t}`)}function Ch(i,e=1/0,t=Tb){let n=[];UD(i[0])&&n.push("◌"),i.length>e&&(e>>=1,i=[...i.slice(0,e),8230,...i.slice(-e)]);let s=0,r=i.length;for(let a=0;a<r;a++){let o=i[a];Wb(o)&&(n.push(Va(i.slice(s,a))),n.push(t(o)),s=a+1)}return n.push(Va(i.slice(s,r))),n.join("")}function UD(i){return fp(),Nr.has(i)}function Wb(i){return fp(),zb.has(i)}function OD(i){return zD(QD(i,ND,qD))}function QD(i,e,t){if(!i)return[];fp();let n=0;return i.split(Ob).map(s=>{let r=_D(s),a={input:r,offset:n};n+=r.length+1;try{let o=a.tokens=WD(r,e,t),c=o.length,l;if(!c)throw new Error("empty label");let h=a.output=o.flat();if(PD(h),!(a.emoji=c>1||o[0].is_emoji)&&h.every(d=>d<128))LD(h),l="ASCII";else{let d=o.flatMap(f=>f.is_emoji?[]:f);if(!d.length)l="Emoji";else{if(Nr.has(h[0]))throw uc("leading combining mark");for(let m=1;m<c;m++){let g=o[m];if(!g.is_emoji&&Nr.has(g[0]))throw uc(`emoji + combining mark: "${Va(o[m-1])} + ${Ch([g[0]])}"`)}kD(h);let f=vh(new Set(d)),[p]=HD(f);VD(p,d),GD(p,f),l=p.N}}a.type=l}catch(o){a.error=o}return a})}function GD(i,e){let t,n=[];for(let s of e){let r=Ka.get(s);if(r===Gb)return;if(r){let a=r.M.get(s);if(t=t?t.filter(o=>a.has(o)):vh(a),!t.length)return}else n.push(s)}if(t){for(let s of t)if(n.every(r=>hc(s,r)))throw new Error(`whole-script confusable: ${i.N}/${s.N}`)}}function HD(i){let e=qa;for(let t of i){let n=e.filter(s=>hc(s,t));if(!n.length)throw qa.some(s=>hc(s,t))?Kb(e[0],t):qb(t);if(e=n,n.length==1)break}return e}function zD(i){return i.map(({input:e,error:t,output:n})=>{if(t){let s=t.message;throw new Error(i.length==1?s:`Invalid label ${Ap(Ch(e,63))}: ${s}`)}return Va(n)}).join(Ob)}function qb(i){return new Error(`disallowed character: ${pp(i)}`)}function Kb(i,e){let t=pp(e),n=qa.find(s=>s.P.has(e));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${i.N} + ${t}`)}function uc(i){return new Error(`illegal placement: ${i}`)}function VD(i,e){for(let t of e)if(!hc(i,t))throw Kb(i,t);if(i.M){let t=kb(e);for(let n=1,s=t.length;n<s;n++)if(hp.has(t[n])){let r=n+1;for(let a;r<s&&hp.has(a=t[r]);r++)for(let o=n;o<r;o++)if(t[o]==a)throw new Error(`duplicate non-spacing marks: ${pp(a)}`);if(r-n>Cb)throw new Error(`excessive non-spacing marks: ${Ap(Ch(t.slice(n-1,r)))} (${r-n}/${Cb})`);n=r}}}function WD(i,e,t){let n=[],s=[];for(i=i.slice().reverse();i.length;){let r=KD(i);if(r)s.length&&(n.push(e(s)),s=[]),n.push(t(r));else{let a=i.pop();if(Dr.has(a))s.push(a);else{let o=lp.get(a);if(o)s.push(...o);else if(!Hb.has(a))throw qb(a)}}}return s.length&&n.push(e(s)),n}function qD(i){return i.filter(e=>e!=Qb)}function KD(i,e){let t=dp,n,s=i.length;for(;s&&(t=t.get(i[--s]),!!t);){let{V:r}=t;r&&(n=r,i.length=s)}return n}const jb=new Uint8Array(32);jb.fill(0);function Xb(i){return V(i.length!==0,"invalid ENS name; empty component","comp",i),i}function Yb(i){const e=ds(jD(i)),t=[];if(i.length===0)return t;let n=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(Xb(e.slice(n,s))),n=s+1);return V(n<e.length,"invalid ENS name; empty component","name",i),t.push(Xb(e.slice(n))),t}function jD(i){try{if(i.length===0)throw new Error("empty label");return OD(i)}catch(e){V(!1,`invalid ENS name (${e.message})`,"name",i)}}function gp(i){V(typeof i=="string","invalid ENS name; not a string","name",i),V(i.length,"invalid ENS name (empty label)","name",i);let e=jb;const t=Yb(i);for(;t.length;)e=an(Gt([e,an(t.pop())]));return Ce(e)}function XD(i,e){const t=e;return V(t<=255,"DNS encoded label cannot exceed 255","length",t),Ce(Gt(Yb(i).map(n=>{V(n.length<=t,`label ${JSON.stringify(i)} exceeds ${t} bytes`,"name",i);const s=new Uint8Array(n.length+1);return s.set(n,1),s[0]=s.length-1,s})))+"00"}const Jb=new Uint8Array(32);Jb.fill(0);const YD=BigInt(-1),Zb=BigInt(0),$b=BigInt(1),JD=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function ZD(i){const e=ut(i),t=e.length%32;return t?Gt([e,Jb.slice(t)]):Ce(e)}const $D=Ks($b,32),eL=Ks(Zb,32),eE={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},mp=["name","version","chainId","verifyingContract","salt"];function tE(i){return function(e){return V(typeof e=="string",`invalid domain value for ${JSON.stringify(i)}`,`domain.${i}`,e),e}}const tL={name:tE("name"),version:tE("version"),chainId:function(i){const e=Ne(i,"domain.chainId");return V(e>=0,"invalid chain ID","domain.chainId",i),Number.isSafeInteger(e)?Number(e):Ri(e)},verifyingContract:function(i){try{return St(i).toLowerCase()}catch{}V(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",i)},salt:function(i){const e=ut(i,"domain.salt");return V(e.length===32,'invalid domain value "salt"',"domain.salt",i),Ce(e)}};function xp(i){{const e=i.match(/^(u?)int(\d+)$/);if(e){const t=e[1]==="",n=parseInt(e[2]);V(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",i);const s=Zo(JD,t?n-1:n),r=t?(s+$b)*YD:Zb;return function(a){const o=Ne(a,"value");return V(o>=r&&o<=s,`value out-of-bounds for ${i}`,"value",o),Ks(t?ax(o,256):o,32)}}}{const e=i.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return V(t!==0&&t<=32&&e[1]===String(t),"invalid bytes width","type",i),function(n){const s=ut(n);return V(s.length===t,`invalid length for ${i}`,"value",n),ZD(n)}}}switch(i){case"address":return function(e){return us(St(e),32)};case"bool":return function(e){return e?$D:eL};case"bytes":return function(e){return an(e)};case"string":return function(e){return Fr(e)}}return null}function nE(i,e){return`${i}(${e.map(({name:t,type:n})=>n+" "+t).join(",")})`}function Ih(i){const e=i.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:i}}class ti{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#n;constructor(e){this.#t=new Map,this.#n=new Map;const t=new Map,n=new Map,s=new Map,r={};Object.keys(e).forEach(c=>{r[c]=e[c].map(({name:l,type:h})=>{let{base:u,index:d}=Ih(h);return u==="int"&&!e.int&&(u="int256"),u==="uint"&&!e.uint&&(u="uint256"),{name:l,type:u+(d||"")}}),t.set(c,new Set),n.set(c,[]),s.set(c,new Set)}),this.#e=JSON.stringify(r);for(const c in r){const l=new Set;for(const h of r[c]){V(!l.has(h.name),`duplicate variable name ${JSON.stringify(h.name)} in ${JSON.stringify(c)}`,"types",e),l.add(h.name);const u=Ih(h.type).base;V(u!==c,`circular type reference to ${JSON.stringify(u)}`,"types",e),!xp(u)&&(V(n.has(u),`unknown type ${JSON.stringify(u)}`,"types",e),n.get(u).push(c),t.get(c).add(u))}}const a=Array.from(n.keys()).filter(c=>n.get(c).length===0);V(a.length!==0,"missing primary type","types",e),V(a.length===1,`ambiguous primary types or unused types: ${a.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),Ye(this,{primaryType:a[0]});function o(c,l){V(!l.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),l.add(c);for(const h of t.get(c))if(n.has(h)){o(h,l);for(const u of l)s.get(u).add(h)}l.delete(c)}o(this.primaryType,new Set);for(const[c,l]of s){const h=Array.from(l);h.sort(),this.#t.set(c,nE(c,r[c])+h.map(u=>nE(u,r[u])).join(""))}}getEncoder(e){let t=this.#n.get(e);return t||(t=this.#i(e),this.#n.set(e,t)),t}#i(e){{const s=xp(e);if(s)return s}const t=Ih(e).array;if(t){const s=t.prefix,r=this.getEncoder(s);return a=>{V(t.count===-1||t.count===a.length,`array length mismatch; expected length ${t.count}`,"value",a);let o=a.map(r);return this.#t.has(s)&&(o=o.map(an)),an(Gt(o))}}const n=this.types[e];if(n){const s=Fr(this.#t.get(e));return r=>{const a=n.map(({name:o,type:c})=>{const l=this.getEncoder(c)(r[o]);return this.#t.has(c)?an(l):l});return a.unshift(s),Gt(a)}}V(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const t=this.#t.get(e);return V(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return an(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(xp(e))return n(e,t);const s=Ih(e).array;if(s)return V(s.count===-1||s.count===t.length,`array length mismatch; expected length ${s.count}`,"value",t),t.map(a=>this._visit(s.prefix,a,n));const r=this.types[e];if(r)return r.reduce((a,{name:o,type:c})=>(a[o]=this._visit(c,t[o],n),a),{});V(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ti(e)}static getPrimaryType(e){return ti.from(e).primaryType}static hashStruct(e,t,n){return ti.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){if(e[n]==null)continue;const s=eE[n];V(s,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:s})}return t.sort((n,s)=>mp.indexOf(n.name)-mp.indexOf(s.name)),ti.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return Gt(["0x1901",ti.hashDomain(e),ti.from(t).hash(n)])}static hash(e,t,n){return an(ti.encode(e,t,n))}static async resolveNames(e,t,n,s){e=Object.assign({},e);for(const o in e)e[o]==null&&delete e[o];const r={};e.verifyingContract&&!Pt(e.verifyingContract,20)&&(r[e.verifyingContract]="0x");const a=ti.from(t);a.visit(n,(o,c)=>(o==="address"&&!Pt(c,20)&&(r[c]="0x"),c));for(const o in r)r[o]=await s(o);return e.verifyingContract&&r[e.verifyingContract]&&(e.verifyingContract=r[e.verifyingContract]),n=a.visit(n,(o,c)=>o==="address"&&r[c]?r[c]:c),{domain:e,value:n}}static getPayload(e,t,n){ti.hashDomain(e);const s={},r=[];mp.forEach(c=>{const l=e[c];l!=null&&(s[c]=tL[c](l),r.push({name:c,type:eE[c]}))});const a=ti.from(t);t=a.types;const o=Object.assign({},t);return V(o.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),o.EIP712Domain=r,a.encode(n),{types:o,domain:s,primaryType:a.primaryType,message:a.visit(n,(c,l)=>{if(c.match(/^bytes(\d*)/))return Ce(ut(l));if(c.match(/^u?int/))return Ne(l).toString();switch(c){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return V(typeof l=="string","invalid string","value",l),l}V(!1,"unsupported type","type",c)})}}}function qn(i){const e=new Set;return i.forEach(t=>e.add(t)),Object.freeze(e)}const nL=qn("external public payable override".split(" ")),iE="constant external internal payable private public pure view override",iL=qn(iE.split(" ")),sE="constructor error event fallback function receive struct",rE=qn(sE.split(" ")),aE="calldata memory storage payable indexed",sL=qn(aE.split(" ")),rL=[sE,aE,"tuple returns",iE].join(" "),aL=qn(rL.split(" ")),oL={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},cL=new RegExp("^(\\s*)"),lL=new RegExp("^([0-9]+)"),hL=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),oE=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),cE=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class gi{#e;#t;get offset(){return this.#e}get length(){return this.#t.length-this.#e}constructor(e){this.#e=0,this.#t=e.slice()}clone(){return new gi(this.#t)}reset(){this.#e=0}#n(e=0,t=0){return new gi(this.#t.slice(e,t).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=this.#n(this.#e+1,e.match+1);return this.#e=e.match+1,t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;this.#e<e.match-1;){const n=this.peek().linkNext;t.push(this.#n(this.#e+1,n)),this.#e=n}return this.#e=e.match+1,t}peek(){if(this.#e>=this.#t.length)throw new Error("out-of-bounds");return this.#t[this.#e]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return this.#e++,e}toString(){const e=[];for(let t=this.#e;t<this.#t.length;t++){const n=this.#t[t];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}}function er(i){const e=[],t=a=>{const o=r<i.length?JSON.stringify(i[r]):"$EOI";throw new Error(`invalid token ${o} at ${r}: ${a}`)};let n=[],s=[],r=0;for(;r<i.length;){let a=i.substring(r),o=a.match(cL);o&&(r+=o[1].length,a=i.substring(r));const c={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:r,value:-1};e.push(c);let l=oL[a[0]]||"";if(l){if(c.type=l,c.text=a[0],r++,l==="OPEN_PAREN")n.push(e.length-1),s.push(e.length-1);else if(l=="CLOSE_PAREN")n.length===0&&t("no matching open bracket"),c.match=n.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if(l==="COMMA")c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(l==="OPEN_BRACKET")c.type="BRACKET";else if(l==="CLOSE_BRACKET"){let h=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const u=e.pop().text;h=u+h,e[e.length-1].value=dt(u)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=h}continue}if(o=a.match(hL),o){if(c.text=o[1],r+=c.text.length,aL.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(cE)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match(lL),o){c.text=o[1],c.type="NUMBER",r+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${r}`)}return new gi(e.map(a=>Object.freeze(a)))}function lE(i,e){let t=[];for(const n in e.keys())i.has(n)&&t.push(n);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Sh(i,e){if(e.peekKeyword(rE)){const t=e.pop().text;if(t!==i)throw new Error(`expected ${i}, got ${t}`)}return e.popType("ID")}function bs(i,e){const t=new Set;for(;;){const n=i.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(i.pop(),t.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);t.add(n)}return Object.freeze(t)}function hE(i){let e=bs(i,iL);return lE(e,qn("constant payable nonpayable".split(" "))),lE(e,qn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Es(i,e){return i.popParams().map(t=>kt.from(t,e))}function uE(i){if(i.peekType("AT")){if(i.pop(),i.peekType("NUMBER"))return Ne(i.pop().text);throw new Error("invalid gas")}return null}function Lr(i){if(i.length)throw new Error(`unexpected tokens at offset ${i.offset}: ${i.toString()}`)}const uL=new RegExp(/^(.*)\[([0-9]*)\]$/);function dE(i){const e=i.match(cE);if(V(e,"invalid type","type",i),i==="uint")return"uint256";if(i==="int")return"int256";if(e[2]){const t=parseInt(e[2]);V(t!==0&&t<=32,"invalid bytes length","type",i)}else if(e[3]){const t=parseInt(e[3]);V(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",i)}return i}const Wt={},Yn=Symbol.for("_ethers_internal"),fE="_ParamTypeInternal",pE="_ErrorInternal",AE="_EventInternal",gE="_ConstructorInternal",mE="_FallbackInternal",xE="_FunctionInternal",bE="_StructInternal";class kt{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,n,s,r,a,o,c){if(ih(e,Wt,"ParamType"),Object.defineProperty(this,Yn,{value:fE}),a&&(a=Object.freeze(a.slice())),s==="array"){if(o==null||c==null)throw new Error("")}else if(o!=null||c!=null)throw new Error("");if(s==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");Ye(this,{name:t,type:n,baseType:s,indexed:r,components:a,arrayLength:o,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const r=JSON.parse(this.arrayChildren.format("json"));return r.name=n,r.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(r)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(r=>JSON.parse(r.format(e)))),JSON.stringify(s)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(s=>n.arrayChildren.walk(s,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((s,r)=>n.components[r].walk(s,t))}return t(this.type,e)}#e(e,t,n,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,o=t.slice();o.forEach((c,l)=>{a.#e(e,c,n,h=>{o[l]=h})}),s(o);return}if(this.isTuple()){const a=this.components;let o;if(Array.isArray(t))o=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");o=a.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in t))throw new Error(`missing value for component ${c.name}`);return t[c.name]})}if(o.length!==this.components.length)throw new Error("array is wrong length");o.forEach((c,l)=>{a[l].#e(e,c,n,h=>{o[l]=h})}),s(o);return}const r=n(this.type,t);r.then?e.push((async function(){s(await r)})()):s(r)}async walkAsync(e,t){const n=[],s=[e];return this.#e(n,e,t,r=>{s[0]=r}),n.length&&await Promise.all(n),s[0]}static from(e,t){if(kt.isParamType(e))return e;if(typeof e=="string")try{return kt.from(er(e),t)}catch{V(!1,"invalid param type","obj",e)}else if(e instanceof gi){let o="",c="",l=null;bs(e,qn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",l=e.popParams().map(m=>kt.from(m)),o=`tuple(${l.map(m=>m.format()).join(",")})`):(o=dE(e.popType("TYPE")),c=o);let h=null,u=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();h=new kt(Wt,"",o,c,null,l,u,h),u=m.value,o+=m.text,c="array",l=null}let d=null;if(bs(e,sL).has("indexed")){if(!t)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new kt(Wt,p,o,c,d,l,u,h)}const n=e.name;V(!n||typeof n=="string"&&n.match(oE),"invalid name","obj.name",n);let s=e.indexed;s!=null&&(V(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let r=e.type,a=r.match(uL);if(a){const o=parseInt(a[2]||"-1"),c=kt.from({type:a[1],components:e.components});return new kt(Wt,n||"",r,"array",s,null,o,c)}if(r==="tuple"||r.startsWith("tuple(")||r.startsWith("(")){const o=e.components!=null?e.components.map(l=>kt.from(l)):null;return new kt(Wt,n||"",r,"tuple",s,o,null,null)}return r=dE(e.type),new kt(Wt,n||"",r,r,s,null,null,null)}static isParamType(e){return e&&e[Yn]===fE}}class Pr{type;inputs;constructor(e,t,n){ih(e,Wt,"Fragment"),n=Object.freeze(n.slice()),Ye(this,{type:t,inputs:n})}static from(e){if(typeof e=="string"){try{Pr.from(JSON.parse(e))}catch{}return Pr.from(er(e))}if(e instanceof gi)switch(e.peekKeyword(rE)){case"constructor":return ys.from(e);case"error":return Jn.from(e);case"event":return Wi.from(e);case"fallback":case"receive":return _s.from(e);case"function":return qi.from(e);case"struct":return kr.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return ys.from(e);case"error":return Jn.from(e);case"event":return Wi.from(e);case"fallback":case"receive":return _s.from(e);case"function":return qi.from(e);case"struct":return kr.from(e)}pe(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}V(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return ys.isFragment(e)}static isError(e){return Jn.isFragment(e)}static isEvent(e){return Wi.isFragment(e)}static isFunction(e){return qi.isFragment(e)}static isStruct(e){return kr.isFragment(e)}}class Mh extends Pr{name;constructor(e,t,n,s){super(e,t,s),V(typeof n=="string"&&n.match(oE),"invalid identifier","name",n),s=Object.freeze(s.slice()),Ye(this,{name:n})}}function dc(i,e){return"("+e.map(t=>t.format(i)).join(i==="full"?", ":",")+")"}class Jn extends Mh{constructor(e,t,n){super(e,"error",t,n),Object.defineProperty(this,Yn,{value:pE})}get selector(){return Fr(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+dc(e,this.inputs)),t.join(" ")}static from(e){if(Jn.isFragment(e))return e;if(typeof e=="string")return Jn.from(er(e));if(e instanceof gi){const t=Sh("error",e),n=Es(e);return Lr(e),new Jn(Wt,t,n)}return new Jn(Wt,e.name,e.inputs?e.inputs.map(kt.from):[])}static isFragment(e){return e&&e[Yn]===pE}}class Wi extends Mh{anonymous;constructor(e,t,n,s){super(e,"event",t,n),Object.defineProperty(this,Yn,{value:AE}),Ye(this,{anonymous:s})}get topicHash(){return Fr(this.format("sighash"))}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("event"),t.push(this.name+dc(e,this.inputs)),e!=="sighash"&&this.anonymous&&t.push("anonymous"),t.join(" ")}static getTopicHash(e,t){return t=(t||[]).map(s=>kt.from(s)),new Wi(Wt,e,t,!1).topicHash}static from(e){if(Wi.isFragment(e))return e;if(typeof e=="string")try{return Wi.from(er(e))}catch{V(!1,"invalid event fragment","obj",e)}else if(e instanceof gi){const t=Sh("event",e),n=Es(e,!0),s=!!bs(e,qn(["anonymous"])).has("anonymous");return Lr(e),new Wi(Wt,t,n,s)}return new Wi(Wt,e.name,e.inputs?e.inputs.map(t=>kt.from(t,!0)):[],!!e.anonymous)}static isFragment(e){return e&&e[Yn]===AE}}class ys extends Pr{payable;gas;constructor(e,t,n,s,r){super(e,t,n),Object.defineProperty(this,Yn,{value:gE}),Ye(this,{payable:s,gas:r})}format(e){if(pe(e!=null&&e!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),e==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[`constructor${dc(e,this.inputs)}`];return this.payable&&t.push("payable"),this.gas!=null&&t.push(`@${this.gas.toString()}`),t.join(" ")}static from(e){if(ys.isFragment(e))return e;if(typeof e=="string")try{return ys.from(er(e))}catch{V(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof gi){bs(e,qn(["constructor"]));const t=Es(e),n=!!bs(e,nL).has("payable"),s=uE(e);return Lr(e),new ys(Wt,"constructor",t,n,s)}return new ys(Wt,"constructor",e.inputs?e.inputs.map(kt.from):[],!!e.payable,e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[Yn]===gE}}class _s extends Pr{payable;constructor(e,t,n){super(e,"fallback",t),Object.defineProperty(this,Yn,{value:mE}),Ye(this,{payable:n})}format(e){const t=this.inputs.length===0?"receive":"fallback";if(e==="json"){const n=this.payable?"payable":"nonpayable";return JSON.stringify({type:t,stateMutability:n})}return`${t}()${this.payable?" payable":""}`}static from(e){if(_s.isFragment(e))return e;if(typeof e=="string")try{return _s.from(er(e))}catch{V(!1,"invalid fallback fragment","obj",e)}else if(e instanceof gi){const t=e.toString(),n=e.peekKeyword(qn(["fallback","receive"]));if(V(n,"type must be fallback or receive","obj",t),e.popKeyword(qn(["fallback","receive"]))==="receive"){const o=Es(e);return V(o.length===0,"receive cannot have arguments","obj.inputs",o),bs(e,qn(["payable"])),Lr(e),new _s(Wt,[],!0)}let r=Es(e);r.length?V(r.length===1&&r[0].type==="bytes","invalid fallback inputs","obj.inputs",r.map(o=>o.format("minimal")).join(", ")):r=[kt.from("bytes")];const a=hE(e);if(V(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),bs(e,qn(["returns"])).has("returns")){const o=Es(e);V(o.length===1&&o[0].type==="bytes","invalid fallback outputs","obj.outputs",o.map(c=>c.format("minimal")).join(", "))}return Lr(e),new _s(Wt,r,a==="payable")}if(e.type==="receive")return new _s(Wt,[],!0);if(e.type==="fallback"){const t=[kt.from("bytes")],n=e.stateMutability==="payable";return new _s(Wt,t,n)}V(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[Yn]===mE}}class qi extends Mh{constant;outputs;stateMutability;payable;gas;constructor(e,t,n,s,r,a){super(e,"function",t,s),Object.defineProperty(this,Yn,{value:xE}),r=Object.freeze(r.slice()),Ye(this,{constant:n==="view"||n==="pure",gas:a,outputs:r,payable:n==="payable",stateMutability:n})}get selector(){return Fr(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("function"),t.push(this.name+dc(e,this.inputs)),e!=="sighash"&&(this.stateMutability!=="nonpayable"&&t.push(this.stateMutability),this.outputs&&this.outputs.length&&(t.push("returns"),t.push(dc(e,this.outputs))),this.gas!=null&&t.push(`@${this.gas.toString()}`)),t.join(" ")}static getSelector(e,t){return t=(t||[]).map(s=>kt.from(s)),new qi(Wt,e,"view",t,[],null).selector}static from(e){if(qi.isFragment(e))return e;if(typeof e=="string")try{return qi.from(er(e))}catch{V(!1,"invalid function fragment","obj",e)}else if(e instanceof gi){const n=Sh("function",e),s=Es(e),r=hE(e);let a=[];bs(e,qn(["returns"])).has("returns")&&(a=Es(e));const o=uE(e);return Lr(e),new qi(Wt,n,r,s,a,o)}let t=e.stateMutability;return t==null&&(t="payable",typeof e.constant=="boolean"?(t="view",e.constant||(t="payable",typeof e.payable=="boolean"&&!e.payable&&(t="nonpayable"))):typeof e.payable=="boolean"&&!e.payable&&(t="nonpayable")),new qi(Wt,e.name,t,e.inputs?e.inputs.map(kt.from):[],e.outputs?e.outputs.map(kt.from):[],e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[Yn]===xE}}class kr extends Mh{constructor(e,t,n){super(e,"struct",t,n),Object.defineProperty(this,Yn,{value:bE})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return kr.from(er(e))}catch{V(!1,"invalid struct fragment","obj",e)}else if(e instanceof gi){const t=Sh("struct",e),n=Es(e);return Lr(e),new kr(Wt,t,n)}return new kr(Wt,e.name,e.inputs?e.inputs.map(kt.from):[])}static isFragment(e){return e&&e[Yn]===bE}}const Di=new Map;Di.set(0,"GENERIC_PANIC"),Di.set(1,"ASSERT_FALSE"),Di.set(17,"OVERFLOW"),Di.set(18,"DIVIDE_BY_ZERO"),Di.set(33,"ENUM_RANGE_ERROR"),Di.set(34,"BAD_STORAGE_DATA"),Di.set(49,"STACK_UNDERFLOW"),Di.set(50,"ARRAY_RANGE_ERROR"),Di.set(65,"OUT_OF_MEMORY"),Di.set(81,"UNINITIALIZED_FUNCTION_CALL");const dL=new RegExp(/^bytes([0-9]*)$/),fL=new RegExp(/^(u?int)([0-9]*)$/);let bp=null,EE=1024;function pL(i,e,t,n){let s="missing revert data",r=null;const a=null;let o=null;if(t){s="execution reverted";const l=ut(t);if(t=Ce(t),l.length===0)s+=" (no data present; likely require(false) occurred",r="require(false)";else if(l.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Ce(l.slice(0,4))==="0x08c379a0")try{r=n.decode(["string"],l.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[r]},s+=`: ${JSON.stringify(r)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(Ce(l.slice(0,4))==="0x4e487b71")try{const h=Number(n.decode(["uint256"],l.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[h]},r=`Panic due to ${Di.get(h)||"UNKNOWN"}(${h})`,s+=`: ${r}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?St(e.to):null,data:e.data||"0x"};return e.from&&(c.from=St(e.from)),Qt(s,"CALL_EXCEPTION",{action:i,data:t,reason:r,transaction:c,invocation:a,revert:o})}class ja{#e(e){if(e.isArray())return new NN(this.#e(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new ph(e.components.map(n=>this.#e(n)),e.name);switch(e.baseType){case"address":return new RN(e.name);case"bool":return new DN(e.name);case"string":return new zN(e.name);case"bytes":return new LN(e.name);case"":return new UN(e.name)}let t=e.type.match(fL);if(t){let n=parseInt(t[2]||"256");return V(n!==0&&n<=256&&n%8===0,"invalid "+t[1]+" bit length","param",e),new HN(n/8,t[1]==="int",e.name)}if(t=e.type.match(dL),t){let n=parseInt(t[1]);return V(n!==0&&n<=32,"invalid bytes length","param",e),new PN(n,e.name)}V(!1,"invalid type","type",e.type)}getDefaultValue(e){const t=e.map(s=>this.#e(kt.from(s)));return new ph(t,"_").defaultValue()}encode(e,t){nx(t.length,e.length,"types/values length mismatch");const n=e.map(a=>this.#e(kt.from(a))),s=new ph(n,"_"),r=new Pf;return s.encode(r,t),r.data}decode(e,t,n){const s=e.map(a=>this.#e(kt.from(a)));return new ph(s,"_").decode(new kf(t,n,EE))}static _setDefaultMaxInflation(e){V(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),EE=e}static defaultAbiCoder(){return bp==null&&(bp=new ja),bp}static getBuiltinCallException(e,t,n){return pL(e,t,n,ja.defaultAbiCoder())}}class AL{fragment;name;signature;topic;args;constructor(e,t,n){const s=e.name,r=e.format();Ye(this,{fragment:e,name:s,signature:r,topic:t,args:n})}}class gL{fragment;name;args;signature;selector;value;constructor(e,t,n,s){const r=e.name,a=e.format();Ye(this,{fragment:e,name:r,args:n,signature:a,selector:t,value:s})}}class mL{fragment;name;args;signature;selector;constructor(e,t,n){const s=e.name,r=e.format();Ye(this,{fragment:e,name:s,args:n,signature:r,selector:t})}}class yE{hash;_isIndexed;static isIndexed(e){return!!(e&&e._isIndexed)}constructor(e){Ye(this,{hash:e,_isIndexed:!0})}}const _E={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},wE={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:i=>`reverted with reason string ${JSON.stringify(i)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:i=>{let e="unknown panic code";return i>=0&&i<=255&&_E[i.toString()]&&(e=_E[i.toString()]),`reverted with panic code 0x${i.toString(16)} (${e})`}}};class Ur{fragments;deploy;fallback;receive;#e;#t;#n;#i;constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,this.#n=new Map,this.#e=new Map,this.#t=new Map;const n=[];for(const a of t)try{n.push(Pr.from(a))}catch(o){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,o.message)}Ye(this,{fragments:Object.freeze(n)});let s=null,r=!1;this.#i=this.getAbiCoder(),this.fragments.forEach((a,o)=>{let c;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ye(this,{deploy:a});return;case"fallback":a.inputs.length===0?r=!0:(V(!s||a.payable!==s.payable,"conflicting fallback fragments",`fragments[${o}]`,a),s=a,r=s.payable);return;case"function":c=this.#n;break;case"event":c=this.#t;break;case"error":c=this.#e;break;default:return}const l=a.format();c.has(l)||c.set(l,a)}),this.deploy||Ye(this,{deploy:ys.from("constructor()")}),Ye(this,{fallback:s,receive:r})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return ja.defaultAbiCoder()}#s(e,t,n){if(Pt(e)){const r=e.toLowerCase();for(const a of this.#n.values())if(r===a.selector)return a;return null}if(e.indexOf("(")===-1){const r=[];for(const[a,o]of this.#n)a.split("(")[0]===e&&r.push(o);if(t){const a=t.length>0?t[t.length-1]:null;let o=t.length,c=!0;jt.isTyped(a)&&a.type==="overrides"&&(c=!1,o--);for(let l=r.length-1;l>=0;l--){const h=r[l].inputs.length;h!==o&&(!c||h!==o-1)&&r.splice(l,1)}for(let l=r.length-1;l>=0;l--){const h=r[l].inputs;for(let u=0;u<t.length;u++)if(jt.isTyped(t[u])){if(u>=h.length){if(t[u].type==="overrides")continue;r.splice(l,1);break}if(t[u].type!==h[u].baseType){r.splice(l,1);break}}}}if(r.length===1&&t&&t.length!==r[0].inputs.length){const a=t[t.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&r.splice(0,1)}if(r.length===0)return null;if(r.length>1&&n){const a=r.map(o=>JSON.stringify(o.format())).join(", ");V(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return r[0]}const s=this.#n.get(qi.from(e).format());return s||null}getFunctionName(e){const t=this.#s(e,null,!1);return V(t,"no matching function","key",e),t.name}hasFunction(e){return!!this.#s(e,null,!1)}getFunction(e,t){return this.#s(e,t||null,!0)}forEachFunction(e){const t=Array.from(this.#n.keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(this.#n.get(s),n)}}#a(e,t,n){if(Pt(e)){const r=e.toLowerCase();for(const a of this.#t.values())if(r===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const r=[];for(const[a,o]of this.#t)a.split("(")[0]===e&&r.push(o);if(t){for(let a=r.length-1;a>=0;a--)r[a].inputs.length<t.length&&r.splice(a,1);for(let a=r.length-1;a>=0;a--){const o=r[a].inputs;for(let c=0;c<t.length;c++)if(jt.isTyped(t[c])&&t[c].type!==o[c].baseType){r.splice(a,1);break}}}if(r.length===0)return null;if(r.length>1&&n){const a=r.map(o=>JSON.stringify(o.format())).join(", ");V(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return r[0]}const s=this.#t.get(Wi.from(e).format());return s||null}getEventName(e){const t=this.#a(e,null,!1);return V(t,"no matching event","key",e),t.name}hasEvent(e){return!!this.#a(e,null,!1)}getEvent(e,t){return this.#a(e,t||null,!0)}forEachEvent(e){const t=Array.from(this.#t.keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(this.#t.get(s),n)}}getError(e,t){if(Pt(e)){const s=e.toLowerCase();if(wE[s])return Jn.from(wE[s].signature);for(const r of this.#e.values())if(s===r.selector)return r;return null}if(e.indexOf("(")===-1){const s=[];for(const[r,a]of this.#e)r.split("(")[0]===e&&s.push(a);if(s.length===0)return e==="Error"?Jn.from("error Error(string)"):e==="Panic"?Jn.from("error Panic(uint256)"):null;if(s.length>1){const r=s.map(a=>JSON.stringify(a.format())).join(", ");V(!1,`ambiguous error description (i.e. ${r})`,"name",e)}return s[0]}if(e=Jn.from(e).format(),e==="Error(string)")return Jn.from("error Error(string)");if(e==="Panic(uint256)")return Jn.from("error Panic(uint256)");const n=this.#e.get(e);return n||null}forEachError(e){const t=Array.from(this.#e.keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(this.#e.get(s),n)}}_decodeParams(e,t){return this.#i.decode(e,t)}_encodeParams(e,t){return this.#i.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);V(n,"unknown error","fragment",e),e=n}return V(Kt(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Kt(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);V(n,"unknown error","fragment",e),e=n}return Gt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);V(n,"unknown function","fragment",e),e=n}return V(Kt(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Kt(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);V(n,"unknown function","fragment",e),e=n}return Gt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){if(typeof e=="string"){const r=this.getFunction(e);V(r,"unknown function","fragment",e),e=r}let n="invalid length for result data";const s=zn(t);if(s.length%32===0)try{return this.#i.decode(e.outputs,s)}catch{n="could not decode result data"}pe(!1,n,"BAD_DATA",{value:Ce(s),info:{method:e.name,signature:e.format()}})}makeError(e,t){const n=ut(e,"data"),s=ja.getBuiltinCallException("call",t,n);if(s.message.startsWith("execution reverted (unknown custom error)")){const o=Ce(n.slice(0,4)),c=this.getError(o);if(c)try{const l=this.#i.decode(c.inputs,n.slice(4));s.revert={name:c.name,signature:c.format(),args:l},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const a=this.parseTransaction(t);return a&&(s.invocation={method:a.name,signature:a.signature,args:a.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const n=this.getFunction(e);V(n,"unknown function","fragment",e),e=n}return Ce(this.#i.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const r=this.getEvent(e);V(r,"unknown event","eventFragment",e),e=r}pe(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const n=[];e.anonymous||n.push(e.topicHash);const s=(r,a)=>r.type==="string"?Fr(a):r.type==="bytes"?an(Ce(a)):(r.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":r.type.match(/^u?int/)?a=Ks(a):r.type.match(/^bytes/)?a=XR(a,32):r.type==="address"&&this.#i.encode(["address"],[a]),us(Ce(a),32));for(t.forEach((r,a)=>{const o=e.inputs[a];if(!o.indexed){V(r==null,"cannot filter non-indexed parameters; must be null","contract."+o.name,r);return}r==null?n.push(null):o.baseType==="array"||o.baseType==="tuple"?V(!1,"filtering with tuples or arrays not supported","contract."+o.name,r):Array.isArray(r)?n.push(r.map(c=>s(o,c))):n.push(s(o,r))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,t){if(typeof e=="string"){const a=this.getEvent(e);V(a,"unknown event","eventFragment",e),e=a}const n=[],s=[],r=[];return e.anonymous||n.push(e.topicHash),V(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((a,o)=>{const c=t[o];if(a.indexed)if(a.type==="string")n.push(Fr(c));else if(a.type==="bytes")n.push(an(c));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(this.#i.encode([a.type],[c]))}else s.push(a),r.push(c)}),{data:this.#i.encode(s,r),topics:n}}decodeEventLog(e,t,n){if(typeof e=="string"){const f=this.getEvent(e);V(f,"unknown event","eventFragment",e),e=f}if(n!=null&&!e.anonymous){const f=e.topicHash;V(Pt(n[0],32)&&n[0].toLowerCase()===f,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const s=[],r=[],a=[];e.inputs.forEach((f,p)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(s.push(kt.from({type:"bytes32",name:f.name})),a.push(!0)):(s.push(f),a.push(!1)):(r.push(f),a.push(!1))});const o=n!=null?this.#i.decode(s,Gt(n)):null,c=this.#i.decode(r,t,!0),l=[],h=[];let u=0,d=0;return e.inputs.forEach((f,p)=>{let m=null;if(f.indexed)if(o==null)m=new yE(null);else if(a[p])m=new yE(o[d++]);else try{m=o[d++]}catch(g){m=g}else try{m=c[u++]}catch(g){m=g}l.push(m),h.push(f.name||null)}),ps.fromItems(l,h)}parseTransaction(e){const t=ut(e.data,"tx.data"),n=Ne(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Ce(t.slice(0,4)));if(!s)return null;const r=this.#i.decode(s.inputs,t.slice(4));return new gL(s,s.selector,r,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new AL(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=Ce(e),n=this.getError(Kt(t,0,4));if(!n)return null;const s=this.#i.decode(n.inputs,Kt(t,4));return new mL(n,n.selector,s)}static from(e){return e instanceof Ur?e:typeof e=="string"?new Ur(JSON.parse(e)):typeof e.formatJson=="function"?new Ur(e.formatJson()):typeof e.format=="function"?new Ur(e.format("json")):new Ur(e)}}const vE=BigInt(0);function Xa(i){return i??null}function tn(i){return i==null?null:i.toString()}class CE{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,t,n){Ye(this,{gasPrice:Xa(e),maxFeePerGas:Xa(t),maxPriorityFeePerGas:Xa(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:tn(e),maxFeePerGas:tn(t),maxPriorityFeePerGas:tn(n)}}}function Bh(i){const e={};i.to&&(e.to=i.to),i.from&&(e.from=i.from),i.data&&(e.data=Ce(i.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in i)||i[s]==null||(e[s]=Ne(i[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in i)||i[s]==null||(e[s]=dt(i[s],`request.${s}`));return i.accessList&&(e.accessList=Tr(i.accessList)),i.authorizationList&&(e.authorizationList=i.authorizationList.slice()),"blockTag"in i&&(e.blockTag=i.blockTag),"enableCcipRead"in i&&(e.enableCcipRead=!!i.enableCcipRead),"customData"in i&&(e.customData=i.customData),"blobVersionedHashes"in i&&i.blobVersionedHashes&&(e.blobVersionedHashes=i.blobVersionedHashes.slice()),"kzg"in i&&(e.kzg=i.kzg),"blobWrapperVersion"in i&&(e.blobWrapperVersion=i.blobWrapperVersion),"blobs"in i&&i.blobs&&(e.blobs=i.blobs.map(s=>Rf(s)?Ce(s):Object.assign({},s))),e}class xL{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#e;constructor(e,t){this.#e=e.transactions.map(n=>typeof n!="string"?new pc(n,t):n),Ye(this,{provider:t,hash:Xa(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Xa(e.prevRandao),extraData:e.extraData,baseFeePerGas:Xa(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return this.#e.map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=this.#e.slice();return e.length===0?[]:(pe(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:t,extraData:n,gasLimit:s,gasUsed:r,hash:a,miner:o,prevRandao:c,nonce:l,number:h,parentHash:u,parentBeaconBlockRoot:d,stateRoot:f,receiptsRoot:p,timestamp:m,transactions:g}=this;return{_type:"Block",baseFeePerGas:tn(e),difficulty:tn(t),extraData:n,gasLimit:tn(s),gasUsed:tn(r),blobGasUsed:tn(this.blobGasUsed),excessBlobGas:tn(this.excessBlobGas),hash:a,miner:o,prevRandao:c,nonce:l,number:h,parentHash:u,timestamp:m,parentBeaconBlockRoot:d,stateRoot:f,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>e<this.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#e.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let t;if(typeof e=="number")t=this.#e[e];else{const n=e.toLowerCase();for(const s of this.#e)if(typeof s=="string"){if(s!==n)continue;t=s;break}else{if(s.hash!==n)continue;t=s;break}}if(t==null)throw new Error("no such tx");return typeof t=="string"?await this.provider.getTransaction(t):t}getPrefetchedTransaction(e){const t=this.prefetchedTransactions;if(typeof e=="number")return t[e];e=e.toLowerCase();for(const n of t)if(n.hash===e)return n;V(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return bL(this)}}class fc{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(e,t){this.provider=t;const n=Object.freeze(e.topics.slice());Ye(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:n,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:n,data:s,index:r,removed:a,topics:o,transactionHash:c,transactionIndex:l}=this;return{_type:"log",address:e,blockHash:t,blockNumber:n,data:s,index:r,removed:a,topics:o,transactionHash:c,transactionIndex:l}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return pe(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return pe(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return pe(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return EL(this)}}class IE{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#e;constructor(e,t){this.#e=Object.freeze(e.logs.map(s=>new fc(s,t)));let n=vE;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Ye(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return this.#e}toJSON(){const{to:e,from:t,contractAddress:n,hash:s,index:r,blockHash:a,blockNumber:o,logsBloom:c,logs:l,status:h,root:u}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:o,contractAddress:n,cumulativeGasUsed:tn(this.cumulativeGasUsed),from:t,gasPrice:tn(this.gasPrice),blobGasUsed:tn(this.blobGasUsed),blobGasPrice:tn(this.blobGasPrice),gasUsed:tn(this.gasUsed),hash:s,index:r,logs:l,logsBloom:c,root:u,status:h,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return ME(this)}reorderedEvent(e){return pe(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),SE(this,e)}}class pc{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;authorizationList;#e;constructor(e,t){this.provider=t,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,this.authorizationList=e.authorizationList!=null?e.authorizationList:null,this.#e=-1}toJSON(){const{blockNumber:e,blockHash:t,index:n,hash:s,type:r,to:a,from:o,nonce:c,data:l,signature:h,accessList:u,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:u,blockNumber:e,blockHash:t,blobVersionedHashes:d,chainId:tn(this.chainId),data:l,from:o,gasLimit:tn(this.gasLimit),gasPrice:tn(this.gasPrice),hash:s,maxFeePerGas:tn(this.maxFeePerGas),maxPriorityFeePerGas:tn(this.maxPriorityFeePerGas),maxFeePerBlobGas:tn(this.maxFeePerBlobGas),nonce:c,signature:h,to:a,index:n,type:r,value:tn(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const n=await this.getTransaction();n&&(e=n.blockNumber)}if(e==null)return null;const t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:n}=await Hn({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:n-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const n=e??1,s=t??0;let r=this.#e,a=-1,o=r===-1;const c=async()=>{if(o)return null;const{blockNumber:d,nonce:f}=await Hn({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(f<this.nonce){r=d;return}if(o)return null;const p=await this.getTransaction();if(!(p&&p.blockNumber!=null))for(a===-1&&(a=r-3,a<this.#e&&(a=this.#e));a<=d;){if(o)return null;const m=await this.provider.getBlock(a,!0);if(m==null)return;for(const g of m)if(g===this.hash)return;for(let g=0;g<m.length;g++){const A=await m.getTransaction(g);if(A.from===this.from&&A.nonce===this.nonce){if(o)return null;const _=await this.provider.getTransactionReceipt(A.hash);if(_==null||d-_.blockNumber+1<n)return;let x="replaced";A.data===this.data&&A.to===this.to&&A.value===this.value?x="repriced":A.data==="0x"&&A.from===A.to&&A.value===vE&&(x="cancelled"),pe(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:x==="replaced"||x==="cancelled",reason:x,replacement:A.replaceableTransaction(r),hash:A.hash,receipt:_})}}a++}},l=d=>{if(d==null||d.status!==0)return d;pe(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},h=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(h);if(h){if(n===1||await h.confirmations()>=n)return l(h)}else if(await c(),n===0)return null;return await new Promise((d,f)=>{const p=[],m=()=>{p.forEach(A=>A())};if(p.push(()=>{o=!0}),s>0){const A=setTimeout(()=>{m(),f(Qt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(A)})}const g=async A=>{if(await A.confirmations()>=n){m();try{d(l(A))}catch(_){f(_)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),r>=0){const A=async()=>{try{await c()}catch(_){if(Tn(_,"TRANSACTION_REPLACED")){m(),f(_);return}}o||this.provider.once("block",A)};p.push(()=>{this.provider.off("block",A)}),this.provider.once("block",A)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return pe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ME(this)}reorderedEvent(e){return pe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),pe(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),SE(this,e)}replaceableTransaction(e){V(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new pc(this,this.provider);return t.#e=e,t}}function bL(i){return{orphan:"drop-block",hash:i.hash,number:i.number}}function SE(i,e){return{orphan:"reorder-transaction",tx:i,other:e}}function ME(i){return{orphan:"drop-transaction",tx:i}}function EL(i){return{orphan:"drop-log",log:{transactionHash:i.transactionHash,blockHash:i.blockHash,blockNumber:i.blockNumber,address:i.address,data:i.data,topics:Object.freeze(i.topics.slice()),index:i.index}}}class Ep extends fc{interface;fragment;args;constructor(e,t,n){super(e,e.provider);const s=t.decodeEventLog(n,e.data,e.topics);Ye(this,{args:s,fragment:n,interface:t})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class BE extends fc{error;constructor(e,t){super(e,e.provider),Ye(this,{error:t})}}class yL extends IE{#e;constructor(e,t,n){super(n,t),this.#e=e}get logs(){return super.logs.map(e=>{const t=e.topics.length?this.#e.getEvent(e.topics[0]):null;if(t)try{return new Ep(e,this.#e,t)}catch(n){return new BE(e,n)}return e})}}class yp extends pc{#e;constructor(e,t,n){super(n,t),this.#e=e}async wait(e,t){const n=await super.wait(e,t);return n==null?null:new yL(this.#e,this.provider,n)}}class TE extends hx{log;constructor(e,t,n,s){super(e,t,n),Ye(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class _L extends TE{constructor(e,t,n,s,r){super(e,t,n,new Ep(r,e.interface,s));const a=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Ye(this,{args:a,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const RE=BigInt(0);function FE(i){return i&&typeof i.call=="function"}function NE(i){return i&&typeof i.estimateGas=="function"}function Th(i){return i&&typeof i.resolveName=="function"}function DE(i){return i&&typeof i.sendTransaction=="function"}function LE(i){if(i!=null){if(Th(i))return i;if(i.provider)return i.provider}}class wL{#e;fragment;constructor(e,t,n){if(Ye(this,{fragment:t}),t.inputs.length<n.length)throw new Error("too many arguments");const s=Or(e.runner,"resolveName"),r=Th(s)?s:null;this.#e=(async function(){const a=await Promise.all(t.inputs.map((o,c)=>n[c]==null?null:o.walkAsync(n[c],(h,u)=>h==="address"?Array.isArray(u)?Promise.all(u.map(d=>Wn(d,r))):Wn(u,r):u)));return e.interface.encodeFilterTopics(t,a)})()}getTopicFilter(){return this.#e}}function Or(i,e){return i==null?null:typeof i[e]=="function"?i:i.provider&&typeof i.provider[e]=="function"?i.provider:null}function Qr(i){return i==null?null:i.provider||null}async function PE(i,e){const t=jt.dereference(i,"overrides");V(typeof t=="object","invalid overrides parameter","overrides",i);const n=Bh(t);return V(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),V(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function vL(i,e,t){const n=Or(i,"resolveName"),s=Th(n)?n:null;return await Promise.all(e.map((r,a)=>r.walkAsync(t[a],(o,c)=>(c=jt.dereference(c,o),o==="address"?Wn(c,s):c))))}function CL(i){const e=async function(a){const o=await PE(a,["data"]);o.to=await i.getAddress(),o.from&&(o.from=await Wn(o.from,LE(i.runner)));const c=i.interface,l=Ne(o.value||RE,"overrides.value")===RE,h=(o.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!h&&!l&&V(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),V(c.fallback||h,"cannot send data to receive-only contract","overrides.data",o.data);const u=c.receive||c.fallback&&c.fallback.payable;return V(u||l,"cannot send value to non-payable fallback","overrides.value",o.value),V(c.fallback||h,"cannot send data to receive-only contract","overrides.data",o.data),o},t=async function(a){const o=Or(i.runner,"call");pe(FE(o),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(a);try{return await o.call(c)}catch(l){throw Tf(l)&&l.data?i.interface.makeError(l.data,c):l}},n=async function(a){const o=i.runner;pe(DE(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),l=Qr(i.runner);return new yp(i.interface,l,c)},s=async function(a){const o=Or(i.runner,"estimateGas");return pe(NE(o),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await o.estimateGas(await e(a))},r=async a=>await n(a);return Ye(r,{_contract:i,estimateGas:s,populateTransaction:e,send:n,staticCall:t}),r}function IL(i,e){const t=function(...l){const h=i.interface.getFunction(e,l);return pe(h,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:l}}),h},n=async function(...l){const h=t(...l);let u={};if(h.inputs.length+1===l.length&&(u=await PE(l.pop()),u.from&&(u.from=await Wn(u.from,LE(i.runner)))),h.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await vL(i.runner,h.inputs,l);return Object.assign({},u,await Hn({to:i.getAddress(),data:i.interface.encodeFunctionData(h,d)}))},s=async function(...l){const h=await o(...l);return h.length===1?h[0]:h},r=async function(...l){const h=i.runner;pe(DE(h),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const u=await h.sendTransaction(await n(...l)),d=Qr(i.runner);return new yp(i.interface,d,u)},a=async function(...l){const h=Or(i.runner,"estimateGas");return pe(NE(h),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await h.estimateGas(await n(...l))},o=async function(...l){const h=Or(i.runner,"call");pe(FE(h),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const u=await n(...l);let d="0x";try{d=await h.call(u)}catch(p){throw Tf(p)&&p.data?i.interface.makeError(p.data,u):p}const f=t(...l);return i.interface.decodeFunctionResult(f,d)},c=async(...l)=>t(...l).constant?await s(...l):await r(...l);return Ye(c,{name:i.interface.getFunctionName(e),_contract:i,_key:e,getFragment:t,estimateGas:a,populateTransaction:n,send:r,staticCall:s,staticCallResult:o}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=i.interface.getFunction(e);return pe(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),l}}),c}function SL(i,e){const t=function(...s){const r=i.interface.getEvent(e,s);return pe(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),r},n=function(...s){return new wL(i,t(...s),s)};return Ye(n,{name:i.interface.getEventName(e),_contract:i,_key:e,getFragment:t}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=i.interface.getEvent(e);return pe(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),n}const Rh=Symbol.for("_ethersInternal_contract"),kE=new WeakMap;function ML(i,e){kE.set(i[Rh],e)}function ni(i){return kE.get(i[Rh])}function BL(i){return i&&typeof i=="object"&&"getTopicFilter"in i&&typeof i.getTopicFilter=="function"&&i.fragment}async function _p(i,e){let t,n=null;if(Array.isArray(e)){const r=function(a){if(Pt(a,32))return a;const o=i.interface.getEvent(a);return V(o,"unknown fragment","name",a),o.topicHash};t=e.map(a=>a==null?null:Array.isArray(a)?a.map(r):r(a))}else e==="*"?t=[null]:typeof e=="string"?Pt(e,32)?t=[e]:(n=i.interface.getEvent(e),V(n,"unknown fragment","event",e),t=[n.topicHash]):BL(e)?t=await e.getTopicFilter():"fragment"in e?(n=e.fragment,t=[n.topicHash]):V(!1,"unknown event name","event",e);t=t.map(r=>{if(r==null)return null;if(Array.isArray(r)){const a=Array.from(new Set(r.map(o=>o.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return r.toLowerCase()});const s=t.map(r=>r==null?"null":Array.isArray(r)?r.join("|"):r).join("&");return{fragment:n,tag:s,topics:t}}async function Ac(i,e){const{subs:t}=ni(i);return t.get((await _p(i,e)).tag)||null}async function UE(i,e,t){const n=Qr(i.runner);pe(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:r,topics:a}=await _p(i,t),{addr:o,subs:c}=ni(i);let l=c.get(r);if(!l){const u={address:o||i,topics:a},d=g=>{let A=s;if(A==null)try{A=i.interface.getEvent(g.topics[0])}catch{}if(A){const _=A,x=s?i.interface.decodeEventLog(s,g.data,g.topics):[];vp(i,t,x,E=>new _L(i,E,t,_,g))}else vp(i,t,[],_=>new TE(i,_,t,g))};let f=[];l={tag:r,listeners:[],start:()=>{f.length||f.push(n.on(u,d))},stop:async()=>{if(f.length==0)return;let g=f;f=[],await Promise.all(g),n.off(u,d)}},c.set(r,l)}return l}let wp=Promise.resolve();async function TL(i,e,t,n){await wp;const s=await Ac(i,e);if(!s)return!1;const r=s.listeners.length;return s.listeners=s.listeners.filter(({listener:a,once:o})=>{const c=Array.from(t);n&&c.push(n(o?null:a));try{a.call(i,...c)}catch{}return!o}),s.listeners.length===0&&(s.stop(),ni(i).subs.delete(s.tag)),r>0}async function vp(i,e,t,n){try{await wp}catch{}const s=TL(i,e,t,n);return wp=s,await s}const Fh=["then"];class gc{target;interface;runner;filters;[Rh];fallback;constructor(e,t,n,s){V(typeof e=="string"||mb(e),"invalid value for Contract target","target",e),n==null&&(n=null);const r=Ur.from(t);Ye(this,{target:e,runner:n,interface:r}),Object.defineProperty(this,Rh,{value:{}});let a,o=null,c=null;if(s){const u=Qr(n);c=new yp(this.interface,u,s)}let l=new Map;if(typeof e=="string")if(Pt(e))o=e,a=Promise.resolve(e);else{const u=Or(n,"resolveName");if(!Th(u))throw Qt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=u.resolveName(e).then(d=>{if(d==null)throw Qt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return ni(this).addr=d,d})}else a=e.getAddress().then(u=>{if(u==null)throw new Error("TODO");return ni(this).addr=u,u});ML(this,{addrPromise:a,addr:o,deployTx:c,subs:l});const h=new Proxy({},{get:(u,d,f)=>{if(typeof d=="symbol"||Fh.indexOf(d)>=0)return Reflect.get(u,d,f);try{return this.getEvent(d)}catch(p){if(!Tn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(u,d)=>Fh.indexOf(d)>=0?Reflect.has(u,d):Reflect.has(u,d)||this.interface.hasEvent(String(d))});return Ye(this,{filters:h}),Ye(this,{fallback:r.receive||r.fallback?CL(this):null}),new Proxy(this,{get:(u,d,f)=>{if(typeof d=="symbol"||d in u||Fh.indexOf(d)>=0)return Reflect.get(u,d,f);try{return u.getFunction(d)}catch(p){if(!Tn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(u,d)=>typeof d=="symbol"||d in u||Fh.indexOf(d)>=0?Reflect.has(u,d):u.interface.hasFunction(d)})}connect(e){return new gc(this.target,this.interface,e)}attach(e){return new gc(e,this.interface,this.runner)}async getAddress(){return await ni(this).addrPromise}async getDeployedCode(){const e=Qr(this.runner);pe(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=Qr(this.runner);return pe(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,r)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);n.once("block",a)}catch(o){r(o)}};a()})}deploymentTransaction(){return ni(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),IL(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),SL(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,n){t==null&&(t=0),n==null&&(n="latest");const{addr:s,addrPromise:r}=ni(this),a=s||await r,{fragment:o,topics:c}=await _p(this,e),l={address:a,topics:c,fromBlock:t,toBlock:n},h=Qr(this.runner);return pe(h,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await h.getLogs(l)).map(u=>{let d=o;if(d==null)try{d=this.interface.getEvent(u.topics[0])}catch{}if(d)try{return new Ep(u,this.interface,d)}catch(f){return new BE(u,f)}return new fc(u,h)})}async on(e,t){const n=await UE(this,"on",e);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(e,t){const n=await UE(this,"once",e);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(e,...t){return await vp(this,e,t,null)}async listenerCount(e){if(e){const s=await Ac(this,e);return s?s.listeners.length:0}const{subs:t}=ni(this);let n=0;for(const{listeners:s}of t.values())n+=s.length;return n}async listeners(e){if(e){const s=await Ac(this,e);return s?s.listeners.map(({listener:r})=>r):[]}const{subs:t}=ni(this);let n=[];for(const{listeners:s}of t.values())n=n.concat(s.map(({listener:r})=>r));return n}async off(e,t){const n=await Ac(this,e);if(!n)return this;if(t){const s=n.listeners.map(({listener:r})=>r).indexOf(t);s>=0&&n.listeners.splice(s,1)}return(t==null||n.listeners.length===0)&&(n.stop(),ni(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const t=await Ac(this,e);if(!t)return this;t.stop(),ni(this).subs.delete(t.tag)}else{const{subs:t}=ni(this);for(const{tag:n,stop:s}of t.values())s(),t.delete(n)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends gc{constructor(s,r=null){super(s,e,r)}}return t}static from(e,t,n){return n==null&&(n=null),new this(e,t,n)}}function RL(){return gc}class Gr extends RL(){}function Cp(i){return i.match(/^ipfs:\/\/ipfs\//i)?i=i.substring(12):i.match(/^ipfs:\/\//i)?i=i.substring(7):V(!1,"unsupported IPFS format","link",i),`https://gateway.ipfs.io/ipfs/${i}`}class FL{name;constructor(e){Ye(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,t){throw new Error("unsupported coin")}async decodeAddress(e,t){throw new Error("unsupported coin")}}const OE=new RegExp("^(ipfs)://(.*)$","i"),QE=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),OE,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class Ya{provider;address;name;#e;#t;constructor(e,t,n){Ye(this,{provider:e,address:t,name:n}),this.#e=null,this.#t=new Gr(t,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e)}async supportsWildcard(){return this.#e==null&&(this.#e=(async()=>{try{return await this.#t.supportsInterface("0x9061b923")}catch(e){if(Tn(e,"CALL_EXCEPTION"))return!1;throw this.#e=null,e}})()),await this.#e}async#n(e,t){t=(t||[]).slice();const n=this.#t.interface;t.unshift(gp(this.name));let s=null;await this.supportsWildcard()&&(s=n.getFunction(e),pe(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[XD(this.name,255),n.encodeFunctionData(s,t)],e="resolve(bytes,bytes)"),t.push({enableCcipRead:!0});try{const r=await this.#t[e](...t);return s?n.decodeFunctionResult(s,r)[0]:r}catch(r){if(!Tn(r,"CALL_EXCEPTION"))throw r}return null}async getAddress(e){if(e==null&&(e=60),e===60)try{const r=await this.#n("addr(bytes32)");return r==null||r===rc?null:r}catch(r){if(Tn(r,"CALL_EXCEPTION"))return null;throw r}if(e>=0&&e<2147483648){let r=e+2147483648;const a=await this.#n("addr(bytes32,uint)",[r]);if(Pt(a,20))return St(a)}let t=null;for(const r of this.provider.plugins)if(r instanceof FL&&r.supportsCoinType(e)){t=r;break}if(t==null)return null;const n=await this.#n("addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const s=await t.decodeAddress(e,n);if(s!=null)return s;pe(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const t=await this.#n("text(bytes32,string)",[e]);return t==null||t==="0x"?null:t}async getContentHash(){const e=await this.#n("contenthash(bytes32)");if(e==null||e==="0x")return null;const t=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const s=t[1]==="e3010170"?"ipfs":"ipns",r=parseInt(t[4],16);if(t[5].length===r*2)return`${s}://${ZR("0x"+t[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;pe(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const t=await this.getText("avatar");if(t==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:t});for(let n=0;n<QE.length;n++){const s=t.match(QE[n]);if(s==null)continue;const r=s[1].toLowerCase();switch(r){case"https":case"data":return e.push({type:"url",value:t}),{linkage:e,url:t};case"ipfs":{const a=Cp(t);return e.push({type:"ipfs",value:t}),e.push({type:"url",value:a}),{linkage:e,url:a}}case"erc721":case"erc1155":{const a=r==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:r,value:t});const o=await this.getAddress();if(o==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const c=(s[2]||"").split("/");if(c.length!==2)return e.push({type:`!${r}caip`,value:s[2]||""}),{url:null,linkage:e};const l=c[1],h=new Gr(c[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(r==="erc721"){const m=await h.ownerOf(l);if(o!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(r==="erc1155"){const m=await h.balanceOf(o,l);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let u=await h[a](l);if(u==null||u==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:u}),r==="erc1155"&&(u=u.replace("{id}",Ks(l,32).substring(2)),e.push({type:"metadata-url-expanded",value:u})),u.match(/^ipfs:/i)&&(u=Cp(u)),e.push({type:"metadata-url",value:u});let d={};const f=await new zi(u).send();f.assertOk();try{d=f.bodyJson}catch{try{e.push({type:"!metadata",value:f.bodyText})}catch{const A=f.body;return A&&e.push({type:"!metadata",value:Ce(A)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!d)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(d)});let p=d.image;if(typeof p!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(OE)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=Cp(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const t=await e.getNetwork(),n=t.getPlugin("org.ethers.plugins.network.Ens");return pe(n,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:t}}),n.address}static async#i(e,t){const n=await Ya.getEnsAddress(e);try{const r=await new Gr(n,["function resolver(bytes32) view returns (address)"],e).resolver(gp(t),{enableCcipRead:!0});return r===rc?null:r}catch(s){throw s}return null}static async fromName(e,t){let n=t;for(;;){if(n===""||n==="."||t!=="eth"&&n==="eth")return null;const s=await Ya.#i(e,n);if(s!=null){const r=new Ya(e,s,t);return n!==t&&!await r.supportsWildcard()?null:r}n=n.split(".").slice(1).join(".")}}}const GE=BigInt(0);function bt(i,e){return(function(t){return t==null?e:i(t)})}function mc(i,e){return(t=>{if(e&&t==null)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map(n=>i(n))})}function xc(i,e){return(t=>{const n={};for(const s in i){let r=s;if(e&&s in e&&!(r in t)){for(const a of e[s])if(a in t){r=a;break}}try{const a=i[s](t[r]);a!==void 0&&(n[s]=a)}catch(a){const o=a instanceof Error?a.message:"not-an-error";pe(!1,`invalid value for value.${s} (${o})`,"BAD_DATA",{value:t})}}return n})}function NL(i){switch(i){case!0:case"true":return!0;case!1:case"false":return!1}V(!1,`invalid boolean; ${JSON.stringify(i)}`,"value",i)}function Ja(i){return V(Pt(i,!0),"invalid data","value",i),i}function Rn(i){return V(Pt(i,32),"invalid hash","value",i),i}const DL=xc({address:St,blockHash:Rn,blockNumber:dt,data:Ja,index:dt,removed:bt(NL,!1),topics:mc(Rn),transactionHash:Rn,transactionIndex:dt},{index:["logIndex"]});function LL(i){return DL(i)}const PL=xc({hash:bt(Rn),parentHash:Rn,parentBeaconBlockRoot:bt(Rn,null),number:dt,timestamp:dt,nonce:bt(Ja),difficulty:Ne,gasLimit:Ne,gasUsed:Ne,stateRoot:bt(Rn,null),receiptsRoot:bt(Rn,null),blobGasUsed:bt(Ne,null),excessBlobGas:bt(Ne,null),miner:bt(St),prevRandao:bt(Rn,null),extraData:Ja,baseFeePerGas:bt(Ne)},{prevRandao:["mixHash"]});function kL(i){const e=PL(i);return e.transactions=i.transactions.map(t=>typeof t=="string"?t:HE(t)),e}const UL=xc({transactionIndex:dt,blockNumber:dt,transactionHash:Rn,address:St,topics:mc(Rn),data:Ja,index:dt,blockHash:Rn},{index:["logIndex"]});function OL(i){return UL(i)}const QL=xc({to:bt(St,null),from:bt(St,null),contractAddress:bt(St,null),index:dt,root:bt(Ce),gasUsed:Ne,blobGasUsed:bt(Ne,null),logsBloom:bt(Ja),blockHash:Rn,hash:Rn,logs:mc(OL),blockNumber:dt,cumulativeGasUsed:Ne,effectiveGasPrice:bt(Ne),blobGasPrice:bt(Ne,null),status:bt(dt),type:bt(dt,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function GL(i){return QL(i)}function HE(i){i.to&&Ne(i.to)===GE&&(i.to="0x0000000000000000000000000000000000000000");const e=xc({hash:Rn,index:bt(dt,void 0),type:t=>t==="0x"||t==null?0:dt(t),accessList:bt(Tr,null),blobVersionedHashes:bt(mc(Rn,!0),null),authorizationList:bt(mc(t=>{let n;if(t.signature)n=t.signature;else{let s=t.yParity;s==="0x1b"?s=0:s==="0x1c"&&(s=1),n=Object.assign({},t,{yParity:s})}return{address:St(t.address),chainId:Ne(t.chainId),nonce:Ne(t.nonce),signature:Vt.from(n)}},!1),null),blockHash:bt(Rn,null),blockNumber:bt(dt,null),transactionIndex:bt(dt,null),from:St,gasPrice:bt(Ne),maxPriorityFeePerGas:bt(Ne),maxFeePerGas:bt(Ne),maxFeePerBlobGas:bt(Ne,null),gasLimit:Ne,to:bt(St,null),value:Ne,nonce:dt,data:Ja,creates:bt(St,null),chainId:bt(Ne,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(i);if(e.to==null&&e.creates==null&&(e.creates=TN(e)),(i.type===1||i.type===2)&&i.accessList==null&&(e.accessList=[]),i.signature?e.signature=Vt.from(i.signature):e.signature=Vt.from(i),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&Ne(e.blockHash)===GE&&(e.blockHash=null),e}const HL="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class bc{name;constructor(e){Ye(this,{name:e})}clone(){return new bc(this.name)}}class Nh extends bc{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(e,t){e==null&&(e=0),super(`org.ethers.network.plugins.GasCost#${e||0}`);const n={effectiveBlock:e};function s(r,a){let o=(t||{})[r];o==null&&(o=a),V(typeof o=="number",`invalud value for ${r}`,"costs",t),n[r]=o}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),Ye(this,n)}clone(){return new Nh(this.effectiveBlock,this)}}class Dh extends bc{address;targetNetwork;constructor(e,t){super("org.ethers.plugins.network.Ens"),Ye(this,{address:e||HL,targetNetwork:t??1})}clone(){return new Dh(this.address,this.targetNetwork)}}class zL extends bc{#e;#t;get url(){return this.#e}get processFunc(){return this.#t}constructor(e,t){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#e=e,this.#t=t}clone(){return this}}const Ip=new Map;class ii{#e;#t;#n;constructor(e,t){this.#e=e,this.#t=Ne(t),this.#n=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#e}set name(e){this.#e=e}get chainId(){return this.#t}set chainId(e){this.#t=Ne(e,"chainId")}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Ne(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Ne(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Ne(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(this.#n.values())}attachPlugin(e){if(this.#n.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#n.set(e.name,e.clone()),this}getPlugin(e){return this.#n.get(e)||null}getPlugins(e){return this.plugins.filter(t=>t.name.split("#")[0]===e)}clone(){const e=new ii(this.name,this.chainId);return this.plugins.forEach(t=>{e.attachPlugin(t.clone())}),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new Nh;let n=t.txBase;if(e.to==null&&(n+=t.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?n+=t.txDataZero:n+=t.txDataNonzero;if(e.accessList){const s=Tr(e.accessList);for(const r in s)n+=t.txAccessListAddress+t.txAccessListStorageKey*s[r].storageKeys.length}return n}static from(e){if(VL(),e==null)return ii.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=Ip.get(e);if(t)return t();if(typeof e=="bigint")return new ii("unknown",e);V(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){V(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const t=new ii(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new Dh(e.ensAddress,e.ensNetwork)),t}V(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const n=Ip.get(e);n&&V(!1,`conflicting network for ${JSON.stringify(n.name)}`,"nameOrChainId",e),Ip.set(e,t)}}function zE(i,e){const t=String(i);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${i}`);const n=t.split(".");if(n.length===1&&n.push(""),n.length!==2)throw new Error(`invalid gwei value: ${i}`);for(;n[1].length<e;)n[1]+="0";if(n[1].length>9){let s=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||s++,n[1]=s.toString()}return BigInt(n[0]+n[1])}function VE(i){return new zL(i,async(e,t,n)=>{n.setHeader("User-Agent","ethers");let s;try{const[r,a]=await Promise.all([n.send(),e()]);s=r;const o=s.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:zE(o.maxFee,9),maxPriorityFeePerGas:zE(o.maxPriorityFee,9)}}catch(r){pe(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:s,error:r})}})}let WE=!1;function VL(){if(WE)return;WE=!0;function i(e,t,n){const s=function(){const r=new ii(e,t);return n.ensNetwork!=null&&r.attachPlugin(new Dh(null,n.ensNetwork)),r.attachPlugin(new Nh),(n.plugins||[]).forEach(a=>{r.attachPlugin(a)}),r};ii.register(e,s),ii.register(t,s),n.altNames&&n.altNames.forEach(r=>{ii.register(r,s)})}i("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),i("ropsten",3,{ensNetwork:3}),i("rinkeby",4,{ensNetwork:4}),i("goerli",5,{ensNetwork:5}),i("kovan",42,{ensNetwork:42}),i("sepolia",11155111,{ensNetwork:11155111}),i("holesky",17e3,{ensNetwork:17e3}),i("classic",61,{}),i("classicKotti",6,{}),i("arbitrum",42161,{ensNetwork:1}),i("arbitrum-goerli",421613,{}),i("arbitrum-sepolia",421614,{}),i("base",8453,{ensNetwork:1}),i("base-goerli",84531,{}),i("base-sepolia",84532,{}),i("bnb",56,{ensNetwork:1}),i("bnbt",97,{}),i("filecoin",314,{}),i("filecoin-calibration",314159,{}),i("linea",59144,{ensNetwork:1}),i("linea-goerli",59140,{}),i("linea-sepolia",59141,{}),i("matic",137,{ensNetwork:1,plugins:[VE("https://gasstation.polygon.technology/v2")]}),i("matic-amoy",80002,{}),i("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[VE("https://gasstation-testnet.polygon.technology/v2")]}),i("optimism",10,{ensNetwork:1,plugins:[]}),i("optimism-goerli",420,{}),i("optimism-sepolia",11155420,{}),i("xdai",100,{ensNetwork:1})}function Sp(i){return JSON.parse(JSON.stringify(i))}class WL{#e;#t;#n;#i;constructor(e){this.#e=e,this.#t=null,this.#n=4e3,this.#i=-2}get pollingInterval(){return this.#n}set pollingInterval(e){this.#n=e}async#s(){try{const e=await this.#e.getBlockNumber();if(this.#i===-2){this.#i=e;return}if(e!==this.#i){for(let t=this.#i+1;t<=e;t++){if(this.#t==null)return;await this.#e.emit("block",t)}this.#i=e}}catch{}this.#t!=null&&(this.#t=this.#e._setTimeout(this.#s.bind(this),this.#n))}start(){this.#t||(this.#t=this.#e._setTimeout(this.#s.bind(this),this.#n),this.#s())}stop(){this.#t&&(this.#e._clearTimeout(this.#t),this.#t=null)}pause(e){this.stop(),e&&(this.#i=-2)}resume(){this.start()}}class Mp{#e;#t;#n;constructor(e){this.#e=e,this.#n=!1,this.#t=t=>{this._poll(t,this.#e)}}async _poll(e,t){throw new Error("sub-classes must override this")}start(){this.#n||(this.#n=!0,this.#t(-2),this.#e.on("block",this.#t))}stop(){this.#n&&(this.#n=!1,this.#e.off("block",this.#t))}pause(e){this.stop()}resume(){this.start()}}class qL extends Mp{#e;#t;constructor(e,t){super(e),this.#e=t,this.#t=-2}pause(e){e&&(this.#t=-2),super.pause(e)}async _poll(e,t){const n=await t.getBlock(this.#e);n!=null&&(this.#t===-2?this.#t=n.number:n.number>this.#t&&(t.emit(this.#e,n.number),this.#t=n.number))}}class KL extends Mp{#e;constructor(e,t){super(e),this.#e=Sp(t)}async _poll(e,t){throw new Error("@TODO")}}class jL extends Mp{#e;constructor(e,t){super(e),this.#e=t}async _poll(e,t){const n=await t.getTransactionReceipt(this.#e);n&&t.emit(this.#e,n)}}class Bp{#e;#t;#n;#i;#s;constructor(e,t){this.#e=e,this.#t=Sp(t),this.#n=this.#a.bind(this),this.#i=!1,this.#s=-2}async#a(e){if(this.#s===-2)return;const t=Sp(this.#t);t.fromBlock=this.#s+1,t.toBlock=e;const n=await this.#e.getLogs(t);if(n.length===0){this.#s<e-60&&(this.#s=e-60);return}for(const s of n)this.#e.emit(this.#t,s),this.#s=s.blockNumber}start(){this.#i||(this.#i=!0,this.#s===-2&&this.#e.getBlockNumber().then(e=>{this.#s=e}),this.#e.on("block",this.#n))}stop(){this.#i&&(this.#i=!1,this.#e.off("block",this.#n))}pause(e){this.stop(),e&&(this.#s=-2)}resume(){this.start()}}const XL=BigInt(2),YL=10;function Lh(i){return i&&typeof i.then=="function"}function Ph(i,e){return i+":"+JSON.stringify(e,(t,n)=>{if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const s=Object.keys(n);return s.sort(),s.reduce((r,a)=>(r[a]=n[a],r),{})}return n})}class qE{name;constructor(e){Ye(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function JL(i){return JSON.parse(JSON.stringify(i))}function Tp(i){return i=Array.from(new Set(i).values()),i.sort(),i}async function Rp(i,e){if(i==null)throw new Error("invalid event");if(Array.isArray(i)&&(i={topics:i}),typeof i=="string")switch(i){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:i,tag:i}}if(Pt(i,32)){const t=i.toLowerCase();return{type:"transaction",tag:Ph("tx",{hash:t}),hash:t}}if(i.orphan){const t=i;return{type:"orphan",tag:Ph("orphan",t),filter:JL(t)}}if(i.address||i.topics){const t=i,n={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?Tp(s.map(r=>r.toLowerCase())):s.toLowerCase())};if(t.address){const s=[],r=[],a=o=>{Pt(o)?s.push(o):r.push((async()=>{s.push(await Wn(o,e))})())};Array.isArray(t.address)?t.address.forEach(a):a(t.address),r.length&&await Promise.all(r),n.address=Tp(s.map(o=>o.toLowerCase()))}return{filter:n,tag:Ph("event",n),type:"event"}}V(!1,"unknown ProviderEvent","event",i)}function Fp(){return new Date().getTime()}const ZL={cacheTimeout:250,pollingInterval:4e3};class $L{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;constructor(e,t){if(this.#A=Object.assign({},ZL,t||{}),e==="any")this.#a=!0,this.#s=null;else if(e){const n=ii.from(e);this.#a=!1,this.#s=Promise.resolve(n),setTimeout(()=>{this.emit("network",n,null)},0)}else this.#a=!1,this.#s=null;this.#o=-1,this.#r=new Map,this.#e=new Map,this.#t=new Map,this.#n=null,this.#i=!1,this.#f=1,this.#l=new Map,this.#p=!1}get pollingInterval(){return this.#A.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#t.values())}attachPlugin(e){if(this.#t.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#t.set(e.name,e.connect(this)),this}getPlugin(e){return this.#t.get(e)||null}get disableCcipRead(){return this.#p}set disableCcipRead(e){this.#p=!!e}async#c(e){const t=this.#A.cacheTimeout;if(t<0)return await this._perform(e);const n=Ph(e.method,e);let s=this.#r.get(n);return s||(s=this._perform(e),this.#r.set(n,s),setTimeout(()=>{this.#r.get(n)===s&&this.#r.delete(n)},t)),await s}async ccipReadFetch(e,t,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const s=e.to.toLowerCase(),r=t.toLowerCase(),a=[];for(let o=0;o<n.length;o++){const c=n[o],l=c.replace("{sender}",s).replace("{data}",r),h=new zi(l);c.indexOf("{data}")===-1&&(h.body={data:r,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:h,index:o,urls:n});let u="unknown error",d;try{d=await h.send()}catch(f){a.push(f.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:h,result:{error:f}});continue}try{const f=d.bodyJson;if(f.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:h,result:f}),f.data;f.message&&(u=f.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:h,result:f})}catch{}pe(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${u}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:u}}),a.push(u)}pe(!1,`error encountered during CCIP fetch: ${a.map(o=>JSON.stringify(o)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:a}})}_wrapBlock(e,t){return new xL(kL(e),this)}_wrapLog(e,t){return new fc(LL(e),this)}_wrapTransactionReceipt(e,t){return new IE(GL(e),this)}_wrapTransactionResponse(e,t){return new pc(HE(e),this)}_detectNetwork(){pe(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){pe(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=dt(await this.#c({method:"getBlockNumber"}),"%response");return this.#o>=0&&(this.#o=e),e}_getAddress(e){return Wn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Pt(e))return Pt(e,32)?e:Ri(e);if(typeof e=="bigint"&&(e=dt(e,"blockTag")),typeof e=="number")return e>=0?Ri(e):this.#o>=0?Ri(this.#o+e):this.getBlockNumber().then(t=>Ri(t+e));V(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?Tp(c.map(l=>l.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,s=(c,l,h)=>{let u;switch(c.length){case 0:break;case 1:u=c[0];break;default:c.sort(),u=c}if(n&&(l!=null||h!=null))throw new Error("invalid filter");const d={};return u&&(d.address=u),t.length&&(d.topics=t),l&&(d.fromBlock=l),h&&(d.toBlock=h),n&&(d.blockHash=n),d};let r=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)r.push(this._getAddress(c));else r.push(this._getAddress(e.address));let a;"fromBlock"in e&&(a=this._getBlockTag(e.fromBlock));let o;return"toBlock"in e&&(o=this._getBlockTag(e.toBlock)),r.filter(c=>typeof c!="string").length||a!=null&&typeof a!="string"||o!=null&&typeof o!="string"?Promise.all([Promise.all(r),a,o]).then(c=>s(c[0],c[1],c[2])):s(r,a,o)}_getTransactionRequest(e){const t=Bh(e),n=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const r=Wn(t[s],this);Lh(r)?n.push((async function(){t[s]=await r})()):t[s]=r}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);Lh(s)?n.push((async function(){t.blockTag=await s})()):t.blockTag=s}return n.length?(async function(){return await Promise.all(n),t})():t}async getNetwork(){if(this.#s==null){const s=(async()=>{try{const r=await this._detectNetwork();return this.emit("network",r,null),r}catch(r){throw this.#s===s&&(this.#s=null),r}})();return this.#s=s,(await s).clone()}const e=this.#s,[t,n]=await Promise.all([e,this._detectNetwork()]);return t.chainId!==n.chainId&&(this.#a?(this.emit("network",n,t),this.#s===e&&(this.#s=Promise.resolve(n))):pe(!1,`network changed: ${t.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const e=await this.getNetwork(),t=async()=>{const{_block:s,gasPrice:r,priorityFee:a}=await Hn({_block:this.#x("latest",!1),gasPrice:(async()=>{try{const h=await this.#c({method:"getGasPrice"});return Ne(h,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const h=await this.#c({method:"getPriorityFee"});return Ne(h,"%response")}catch{}return null})()});let o=null,c=null;const l=this._wrapBlock(s,e);return l&&l.baseFeePerGas&&(c=a??BigInt("1000000000"),o=l.baseFeePerGas*XL+c),new CE(r,o,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const s=new zi(n.url),r=await n.processFunc(t,this,s);return new CE(r.gasPrice,r.maxFeePerGas,r.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return Lh(t)&&(t=await t),Ne(await this.#c({method:"estimateGas",transaction:t}),"%response")}async#h(e,t,n){pe(n<YL,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=Bh(e);try{return Ce(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(r){if(!this.disableCcipRead&&Tf(r)&&r.data&&n>=0&&t==="latest"&&s.to!=null&&Kt(r.data,0,4)==="0x556f1830"){const a=r.data,o=await Wn(s.to,this);let c;try{c=s2(Kt(r.data,4))}catch(u){pe(!1,u.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:a}})}pe(c.sender.toLowerCase()===o.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:a,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const l=await this.ccipReadFetch(s,c.calldata,c.urls);pe(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:r.data,errorArgs:c.errorArgs}});const h={to:o,data:Gt([c.selector,i2([l,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:h});try{const u=await this.#h(h,t,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},h),result:u}),u}catch(u){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},h),error:u}),u}}throw r}}async#u(e){const{value:t}=await Hn({network:this.getNetwork(),value:e});return t}async call(e){const{tx:t,blockTag:n}=await Hn({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await this.#u(this.#h(t,n,e.enableCcipRead?0:-1))}async#d(e,t,n){let s=this._getAddress(t),r=this._getBlockTag(n);return(typeof s!="string"||typeof r!="string")&&([s,r]=await Promise.all([s,r])),await this.#u(this.#c(Object.assign(e,{address:s,blockTag:r})))}async getBalance(e,t){return Ne(await this.#d({method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return dt(await this.#d({method:"getTransactionCount"},e,t),"%response")}async getCode(e,t){return Ce(await this.#d({method:"getCode"},e,t))}async getStorage(e,t,n){const s=Ne(t,"position");return Ce(await this.#d({method:"getStorage",position:s},e,n))}async broadcastTransaction(e){const{blockNumber:t,hash:n,network:s}=await Hn({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),r=Ni.from(e);if(r.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(r,s).replaceableTransaction(t)}async#x(e,t){if(Pt(e,32))return await this.#c({method:"getBlock",blockHash:e,includeTransactions:t});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await this.#c({method:"getBlock",blockTag:n,includeTransactions:t})}async getBlock(e,t){const{network:n,params:s}=await Hn({network:this.getNetwork(),params:this.#x(e,!!t)});return s==null?null:this._wrapBlock(s,n)}async getTransaction(e){const{network:t,params:n}=await Hn({network:this.getNetwork(),params:this.#c({method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,t)}async getTransactionReceipt(e){const{network:t,params:n}=await Hn({network:this.getNetwork(),params:this.#c({method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const s=await this.#c({method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(n,t)}async getTransactionResult(e){const{result:t}=await Hn({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:e})});return t==null?null:Ce(t)}async getLogs(e){let t=this._getFilter(e);Lh(t)&&(t=await t);const{network:n,params:s}=await Hn({network:this.getNetwork(),params:this.#c({method:"getLogs",filter:t})});return s.map(r=>this._wrapLog(r,n))}_getProvider(e){pe(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Ya.fromName(this,e)}async getAvatar(e){const t=await this.getResolver(e);return t?await t.getAvatar():null}async resolveName(e){const t=await this.getResolver(e);return t?await t.getAddress():null}async lookupAddress(e){e=St(e);const t=gp(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await Ya.getEnsAddress(this),r=await new Gr(n,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(r==null||r===rc)return null;const o=await new Gr(r,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(o)!==e?null:o}catch(n){if(Tn(n,"BAD_DATA")&&n.value==="0x"||Tn(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,t,n){const s=t??1;return s===0?this.getTransactionReceipt(e):new Promise(async(r,a)=>{let o=null;const c=(async l=>{try{const h=await this.getTransactionReceipt(e);if(h!=null&&l-h.blockNumber+1>=s){r(h),o&&(clearTimeout(o),o=null);return}}catch(h){console.log("EEE",h)}this.once("block",c)});n!=null&&(o=setTimeout(()=>{o!=null&&(o=null,this.off("block",c),a(Qt("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){pe(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const t=this.#l.get(e);t&&(t.timer&&clearTimeout(t.timer),this.#l.delete(e))}_setTimeout(e,t){t==null&&(t=0);const n=this.#f++,s=()=>{this.#l.delete(n),e()};if(this.paused)this.#l.set(n,{timer:null,func:s,time:t});else{const r=setTimeout(s,t);this.#l.set(n,{timer:r,func:s,time:Fp()})}return n}_forEachSubscriber(e){for(const t of this.#e.values())e(t.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new qE(e.type);case"block":{const t=new WL(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new qL(this,e.type);case"event":return new Bp(this,e.filter);case"transaction":return new jL(this,e.hash);case"orphan":return new KL(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,t){for(const n of this.#e.values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=t,n.started&&t.start(),this.#n!=null&&t.pause(this.#n);break}}async#g(e,t){let n=await Rp(e,this);return n.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(n=await Rp({orphan:"drop-log",log:t[0]},this)),this.#e.get(n.tag)||null}async#m(e){const t=await Rp(e,this),n=t.tag;let s=this.#e.get(n);return s||(s={subscriber:this._getSubscriber(t),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#e.set(n,s)),s}async on(e,t){const n=await this.#m(e);return n.listeners.push({listener:t,once:!1}),n.started||(n.subscriber.start(),n.started=!0,this.#n!=null&&n.subscriber.pause(this.#n)),this}async once(e,t){const n=await this.#m(e);return n.listeners.push({listener:t,once:!0}),n.started||(n.subscriber.start(),n.started=!0,this.#n!=null&&n.subscriber.pause(this.#n)),this}async emit(e,...t){const n=await this.#g(e,t);if(!n||n.listeners.length===0)return!1;const s=n.listeners.length;return n.listeners=n.listeners.filter(({listener:r,once:a})=>{const o=new hx(this,a?null:r,e);try{r.call(this,...t,o)}catch{}return!a}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),this.#e.delete(n.tag)),s>0}async listenerCount(e){if(e){const n=await this.#g(e);return n?n.listeners.length:0}let t=0;for(const{listeners:n}of this.#e.values())t+=n.length;return t}async listeners(e){if(e){const n=await this.#g(e);return n?n.listeners.map(({listener:s})=>s):[]}let t=[];for(const{listeners:n}of this.#e.values())t=t.concat(n.map(({listener:s})=>s));return t}async off(e,t){const n=await this.#g(e);if(!n)return this;if(t){const s=n.listeners.map(({listener:r})=>r).indexOf(t);s>=0&&n.listeners.splice(s,1)}return(!t||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),this.#e.delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:t,started:n,subscriber:s}=await this.#m(e);n&&s.stop(),this.#e.delete(t)}else for(const[t,{started:n,subscriber:s}]of this.#e)n&&s.stop(),this.#e.delete(t);return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return this.off(e,t)}get destroyed(){return this.#i}destroy(){this.removeAllListeners();for(const e of this.#l.keys())this._clearTimeout(e);this.#i=!0}get paused(){return this.#n!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(this.#o=-1,this.#n!=null){if(this.#n==!!e)return;pe(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(e)),this.#n=!!e;for(const t of this.#l.values())t.timer&&clearTimeout(t.timer),t.time=Fp()-t.time}resume(){if(this.#n!=null){this._forEachSubscriber(e=>e.resume()),this.#n=null;for(const e of this.#l.values()){let t=e.time;t<0&&(t=0),e.time=Fp(),setTimeout(e.func,t)}}}}function e2(i,e){try{const t=Np(i,e);if(t)return rh(t)}catch{}return null}function Np(i,e){if(i==="0x")return null;try{const t=dt(Kt(i,e,e+32)),n=dt(Kt(i,t,t+32));return Kt(i,t+32,t+32+n)}catch{}return null}function KE(i){const e=rn(i);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function t2(i){if(i.length%32===0)return i;const e=new Uint8Array(Math.ceil(i.length/32)*32);return e.set(i),e}const n2=new Uint8Array([]);function i2(i){const e=[];let t=0;for(let n=0;n<i.length;n++)e.push(n2),t+=32;for(let n=0;n<i.length;n++){const s=ut(i[n]);e[n]=KE(t),e.push(KE(s.length)),e.push(t2(s)),t+=32+Math.ceil(s.length/32)*32}return Gt(e)}const jE="0x0000000000000000000000000000000000000000000000000000000000000000";function s2(i){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};pe(ka(i)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Kt(i,0,32);pe(Kt(t,0,12)===Kt(jE,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Kt(t,12);try{const n=[],s=dt(Kt(i,32,64)),r=dt(Kt(i,s,s+32)),a=Kt(i,s+32);for(let o=0;o<r;o++){const c=e2(a,o*32);if(c==null)throw new Error("abort");n.push(c)}e.urls=n}catch{pe(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const n=Np(i,64);if(n==null)throw new Error("abort");e.calldata=n}catch{pe(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}pe(Kt(i,100,128)===Kt(jE,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Kt(i,96,100);try{const n=Np(i,128);if(n==null)throw new Error("abort");e.extraData=n}catch{pe(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(n=>e[n]),e}function Hr(i,e){if(i.provider)return i.provider;pe(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function XE(i,e){let t=Bh(e);if(t.to!=null&&(t.to=Wn(t.to,i)),t.from!=null){const n=t.from;t.from=Promise.all([i.getAddress(),Wn(n,i)]).then(([s,r])=>(V(s.toLowerCase()===r.toLowerCase(),"transaction from mismatch","tx.from",r),s))}else t.from=i.getAddress();return await Hn(t)}class r2{provider;constructor(e){Ye(this,{provider:e||null})}async getNonce(e){return Hr(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await XE(this,e)}async populateTransaction(e){const t=Hr(this,"populateTransaction"),n=await XE(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const s=await this.provider.getNetwork();if(n.chainId!=null){const a=Ne(n.chainId);V(a===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=s.chainId;const r=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||r)?V(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&r&&V(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const a=await t.getFeeData();pe(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice)}else{const a=await t.getFeeData();if(n.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(n.authorizationList&&n.authorizationList.length?n.type=4:n.type=2,n.gasPrice!=null){const o=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=o,n.maxPriorityFeePerGas=o}else n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(pe(!r,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice),n.type=0):pe(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3||n.type===4)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await Hn(n)}async populateAuthorization(e){const t=Object.assign({},e);return t.chainId==null&&(t.chainId=(await Hr(this,"getNetwork").getNetwork()).chainId),t.nonce==null&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return Hr(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Hr(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Hr(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=Hr(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const s=Ni.from(n);return await t.broadcastTransaction(await this.signTransaction(s))}authorize(e){pe(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}function a2(i){return JSON.parse(JSON.stringify(i))}class YE{#e;#t;#n;#i;#s;#a;constructor(e){this.#e=e,this.#t=null,this.#n=this.#r.bind(this),this.#i=!1,this.#s=null,this.#a=!1}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}async#r(e){try{this.#t==null&&(this.#t=this._subscribe(this.#e));let t=null;try{t=await this.#t}catch(r){if(!Tn(r,"UNSUPPORTED_OPERATION")||r.operation!=="eth_newFilter")throw r}if(t==null){this.#t=null,this.#e._recoverSubscriber(this,this._recover(this.#e));return}const n=await this.#e.getNetwork();if(this.#s||(this.#s=n),this.#s.chainId!==n.chainId)throw new Error("chaid changed");if(this.#a)return;const s=await this.#e.send("eth_getFilterChanges",[t]);await this._emitResults(this.#e,s)}catch(t){console.log("@TODO",t)}this.#e.once("block",this.#n)}#o(){const e=this.#t;e&&(this.#t=null,e.then(t=>{this.#e.destroyed||this.#e.send("eth_uninstallFilter",[t])}))}start(){this.#i||(this.#i=!0,this.#r(-2))}stop(){this.#i&&(this.#i=!1,this.#a=!0,this.#o(),this.#e.off("block",this.#n))}pause(e){e&&this.#o(),this.#e.off("block",this.#n)}resume(){this.start()}}class o2 extends YE{#e;constructor(e,t){super(e),this.#e=a2(t)}_recover(e){return new Bp(e,this.#e)}async _subscribe(e){return await e.send("eth_newFilter",[this.#e])}async _emitResults(e,t){for(const n of t)e.emit(this.#e,e._wrapLog(n,e._network))}}class c2 extends YE{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const n of t)e.emit("pending",n)}}const l2="bigint,boolean,function,number,string,symbol".split(/,/g);function kh(i){if(i==null||l2.indexOf(typeof i)>=0||typeof i.getAddress=="function")return i;if(Array.isArray(i))return i.map(kh);if(typeof i=="object")return Object.keys(i).reduce((e,t)=>(e[t]=i[t],e),{});throw new Error(`should not happen: ${i} (${typeof i})`)}function h2(i){return new Promise(e=>{setTimeout(e,i)})}function Za(i){return i&&i.toLowerCase()}function JE(i){return i&&typeof i.pollingInterval=="number"}const ZE={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Dp extends r2{address;constructor(e,t){super(e),t=St(t),Ye(this,{address:t})}connect(e){pe(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(e){return await this.populateCall(e)}async sendUncheckedTransaction(e){const t=kh(e),n=[];if(t.from){const r=t.from;n.push((async()=>{const a=await Wn(r,this.provider);V(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),t.from=a})())}else t.from=this.address;if(t.gasLimit==null&&n.push((async()=>{t.gasLimit=await this.provider.estimateGas({...t,from:this.address})})()),t.to!=null){const r=t.to;n.push((async()=>{t.to=await Wn(r,this.provider)})())}n.length&&await Promise.all(n);const s=this.provider.getRpcTransaction(t);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(e){const t=await this.provider.getBlockNumber(),n=await this.sendUncheckedTransaction(e);return await new Promise((s,r)=>{const a=[1e3,100];let o=0;const c=async()=>{try{const l=await this.provider.getTransaction(n);if(l!=null){s(l.replaceableTransaction(t));return}}catch(l){if(Tn(l,"CANCELLED")||Tn(l,"BAD_DATA")||Tn(l,"NETWORK_ERROR")||Tn(l,"UNSUPPORTED_OPERATION")){l.info==null&&(l.info={}),l.info.sendTransactionHash=n,r(l);return}if(Tn(l,"INVALID_ARGUMENT")&&(o++,l.info==null&&(l.info={}),l.info.sendTransactionHash=n,o>10)){r(l);return}this.provider.emit("error",Qt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:l}))}this.provider._setTimeout(()=>{c()},a.pop()||4e3)};c()})}async signTransaction(e){const t=kh(e);if(t.from){const s=await Wn(t.from,this.provider);V(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),t.from=s}else t.from=this.address;const n=this.provider.getRpcTransaction(t);return await this.provider.send("eth_signTransaction",[n])}async signMessage(e){const t=typeof e=="string"?ds(e):e;return await this.provider.send("personal_sign",[Ce(t),this.address.toLowerCase()])}async signTypedData(e,t,n){const s=kh(n),r=await ti.resolveNames(e,t,s,async a=>{const o=await Wn(a);return V(o!=null,"TypedData does not support null address","value",a),o});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(ti.getPayload(r.domain,t,r.value))])}async unlock(e){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),e,null])}async _legacySignMessage(e){const t=typeof e=="string"?ds(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ce(t)])}}class u2 extends $L{#e;#t;#n;#i;#s;#a;#r;#o(){if(this.#i)return;const e=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#i=setTimeout(()=>{this.#i=null;const t=this.#n;for(this.#n=[];t.length;){const n=[t.shift()];for(;t.length&&n.length!==this.#e.batchMaxCount;)if(n.push(t.shift()),JSON.stringify(n.map(r=>r.payload)).length>this.#e.batchMaxSize){t.unshift(n.pop());break}(async()=>{const s=n.length===1?n[0].payload:n.map(r=>r.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const r=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:r});for(const{resolve:a,reject:o,payload:c}of n){if(this.destroyed){o(Qt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:c.method}));continue}const l=r.filter(h=>h.id===c.id)[0];if(l==null){const h=Qt("missing response for request","BAD_DATA",{value:r,info:{payload:c}});this.emit("error",h),o(h);continue}if("error"in l){o(this.getRpcError(c,l));continue}a(l.result)}}catch(r){this.emit("debug",{action:"receiveRpcError",error:r});for(const{reject:a}of n)a(r)}})()}},e)}constructor(e,t){super(e,t),this.#t=1,this.#e=Object.assign({},ZE,t||{}),this.#n=[],this.#i=null,this.#a=null,this.#r=null;{let s=null;const r=new Promise(a=>{s=a});this.#s={promise:r,resolve:s}}const n=this._getOption("staticNetwork");typeof n=="boolean"?(V(!n||e!=="any","staticNetwork cannot be used on special network 'any'","options",t),n&&e!=null&&(this.#a=ii.from(e))):n&&(V(e==null||n.matches(e),"staticNetwork MUST match network object","options",t),this.#a=n)}_getOption(e){return this.#e[e]}get _network(){return pe(this.#a,"network is not available yet","NETWORK_ERROR"),this.#a}async _perform(e){if(e.method==="call"||e.method==="estimateGas"){let n=e.transaction;if(n&&n.type!=null&&Ne(n.type)&&n.maxFeePerGas==null&&n.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(e=Object.assign({},e,{transaction:Object.assign({},n,{type:void 0})}))}}const t=this.getRpcRequest(e);return t!=null?await this.send(t.method,t.args):super._perform(e)}async _detectNetwork(){const e=this._getOption("staticNetwork");if(e)if(e===!0){if(this.#a)return this.#a}else return e;return this.#r?await this.#r:this.ready?(this.#r=(async()=>{try{const t=ii.from(Ne(await this.send("eth_chainId",[])));return this.#r=null,t}catch(t){throw this.#r=null,t}})(),await this.#r):(this.#r=(async()=>{const t={id:this.#t++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:t});let n;try{n=(await this._send(t))[0],this.#r=null}catch(s){throw this.#r=null,this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:n}),"result"in n)return ii.from(Ne(n.result));throw this.getRpcError(t,n)})(),await this.#r)}_start(){this.#s==null||this.#s.resolve==null||(this.#s.resolve(),this.#s=null,(async()=>{for(;this.#a==null&&!this.destroyed;)try{this.#a=await this._detectNetwork()}catch(e){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Qt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:e}})),await h2(1e3)}this.#o()})())}async _waitUntilReady(){if(this.#s!=null)return await this.#s.promise}_getSubscriber(e){return e.type==="pending"?new c2(this):e.type==="event"?this._getOption("polling")?new Bp(this,e.filter):new o2(this,e.filter):e.type==="orphan"&&e.filter.orphan==="drop-log"?new qE("orphan"):super._getSubscriber(e)}get ready(){return this.#s==null}getRpcTransaction(e){const t={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(n=>{if(e[n]==null)return;let s=n;n==="gasLimit"&&(s="gas"),t[s]=Ri(Ne(e[n],`tx.${n}`))}),["from","to","data"].forEach(n=>{e[n]!=null&&(t[n]=Ce(e[n]))}),e.accessList&&(t.accessList=Tr(e.accessList)),e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.map(n=>n.toLowerCase())),e.authorizationList&&(t.authorizationList=e.authorizationList.map(n=>{const s=_b(n);return{address:s.address,nonce:Ri(s.nonce),chainId:Ri(s.chainId),yParity:Ri(s.signature.yParity),r:Ri(s.signature.r),s:Ri(s.signature.s)}})),t}getRpcRequest(e){switch(e.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Za(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Za(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[Za(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Za(e.address),"0x"+e.position.toString(16),e.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[e.signedTransaction]};case"getBlock":if("blockTag"in e)return{method:"eth_getBlockByNumber",args:[e.blockTag,!!e.includeTransactions]};if("blockHash"in e)return{method:"eth_getBlockByHash",args:[e.blockHash,!!e.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[e.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[e.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(e.transaction),e.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(e.transaction)]};case"getLogs":return e.filter&&e.filter.address!=null&&(Array.isArray(e.filter.address)?e.filter.address=e.filter.address.map(Za):e.filter.address=Za(e.filter.address)),{method:"eth_getLogs",args:[e.filter]}}return null}getRpcError(e,t){const{method:n}=e,{error:s}=t;if(n==="eth_estimateGas"&&s.message){const o=s.message;if(!o.match(/revert/i)&&o.match(/insufficient funds/i))return Qt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:e.params[0],info:{payload:e,error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return Qt("nonce has already been used","NONCE_EXPIRED",{transaction:e.params[0],info:{payload:e,error:s}})}if(n==="eth_call"||n==="eth_estimateGas"){const o=Lp(s),c=ja.getBuiltinCallException(n==="eth_call"?"call":"estimateGas",e.params[0],o?o.data:null);return c.info={error:s,payload:e},c}const r=JSON.stringify(d2(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return Qt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[n]||"unknown",reason:"rejected",info:{payload:e,error:s}});if(n==="eth_sendRawTransaction"||n==="eth_sendTransaction"){const o=e.params[0];if(r.match(/insufficient funds|base fee exceeds gas limit/i))return Qt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o,info:{error:s}});if(r.match(/nonce/i)&&r.match(/too low/i))return Qt("nonce has already been used","NONCE_EXPIRED",{transaction:o,info:{error:s}});if(r.match(/replacement transaction/i)&&r.match(/underpriced/i))return Qt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o,info:{error:s}});if(r.match(/only replay-protected/i))return Qt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:n,info:{transaction:o,info:{error:s}}})}let a=!!r.match(/the method .* does not exist/i);return a||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(a=!0),a?Qt("unsupported operation","UNSUPPORTED_OPERATION",{operation:e.method,info:{error:s,payload:e}}):Qt("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:e})}send(e,t){if(this.destroyed)return Promise.reject(Qt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e}));const n=this.#t++,s=new Promise((r,a)=>{this.#n.push({resolve:r,reject:a,payload:{method:e,params:t,id:n,jsonrpc:"2.0"}})});return this.#o(),s}async getSigner(e){e==null&&(e=0);const t=this.send("eth_accounts",[]);if(typeof e=="number"){const s=await t;if(e>=s.length)throw new Error("no such account");return new Dp(this,s[e])}const{accounts:n}=await Hn({network:this.getNetwork(),accounts:t});e=St(e);for(const s of n)if(St(s)===e)return new Dp(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(t=>new Dp(this,t))}destroy(){this.#i&&(clearTimeout(this.#i),this.#i=null);for(const{payload:e,reject:t}of this.#n)t(Qt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e.method}));this.#n=[],super.destroy()}}class $E extends u2{#e;constructor(e,t){super(e,t);let n=this._getOption("pollingInterval");n==null&&(n=ZE.pollingInterval),this.#e=n}_getSubscriber(e){const t=super._getSubscriber(e);return JE(t)&&(t.pollingInterval=this.#e),t}get pollingInterval(){return this.#e}set pollingInterval(e){if(!Number.isInteger(e)||e<0)throw new Error("invalid interval");this.#e=e,this._forEachSubscriber(t=>{JE(t)&&(t.pollingInterval=this.#e)})}}class ey extends $E{#e;constructor(e,t,n){e==null&&(e="http://localhost:8545"),super(t,n),typeof e=="string"?this.#e=new zi(e):this.#e=e.clone()}_getConnection(){return this.#e.clone()}async send(e,t){return await this._start(),await super.send(e,t)}async _send(e){const t=this._getConnection();t.body=JSON.stringify(e),t.setHeader("content-type","application/json");const n=await t.send();n.assertOk();let s=n.bodyJson;return Array.isArray(s)||(s=[s]),s}}function Lp(i){if(i==null)return null;if(typeof i.message=="string"&&i.message.match(/revert/i)&&Pt(i.data))return{message:i.message,data:i.data};if(typeof i=="object"){for(const e in i){const t=Lp(i[e]);if(t)return t}return null}if(typeof i=="string")try{return Lp(JSON.parse(i))}catch{}return null}function Pp(i,e){if(i!=null){if(typeof i.message=="string"&&e.push(i.message),typeof i=="object")for(const t in i)Pp(i[t],e);if(typeof i=="string")try{return Pp(JSON.parse(i),e)}catch{}}}function d2(i){const e=[];return Pp(i,e),e}class zr extends $E{#e;#t;constructor(e,t,n){const s=Object.assign({},n??{},{batchMaxCount:1});V(e&&e.request,"invalid EIP-1193 provider","ethereum",e),super(t,s),this.#t=null,n&&n.providerInfo&&(this.#t=n.providerInfo),this.#e=async(r,a)=>{const o={method:r,params:a};this.emit("debug",{action:"sendEip1193Request",payload:o});try{const c=await e.request(o);return this.emit("debug",{action:"receiveEip1193Result",result:c}),c}catch(c){const l=new Error(c.message);throw l.code=c.code,l.data=c.data,l.payload=o,this.emit("debug",{action:"receiveEip1193Error",error:l}),l}}}get providerInfo(){return this.#t}async send(e,t){return await this._start(),await super.send(e,t)}async _send(e){V(!Array.isArray(e),"EIP-1193 does not support batch request","payload",e);try{const t=await this.#e(e.method,e.params||[]);return[{id:e.id,result:t}]}catch(t){return[{id:e.id,error:{code:t.code,data:t.data,message:t.message}}]}}getRpcError(e,t){switch(t=JSON.parse(JSON.stringify(t)),t.error.code||-1){case 4001:t.error.message=`ethers-user-denied: ${t.error.message}`;break;case 4200:t.error.message=`ethers-unsupported: ${t.error.message}`;break}return super.getRpcError(e,t)}async hasSigner(e){e==null&&(e=0);const t=await this.send("eth_accounts",[]);return typeof e=="number"?t.length>e:(e=e.toLowerCase(),t.filter(n=>n.toLowerCase()===e).length!==0)}async getSigner(e){if(e==null&&(e=0),!await this.hasSigner(e))try{await this.#e("eth_requestAccounts",[])}catch(t){const n=t.payload;throw this.getRpcError(n,{id:n.id,error:t})}return await super.getSigner(e)}static async discover(e){if(e==null&&(e={}),e.provider)return new zr(e.provider);const t=e.window?e.window:typeof window<"u"?window:null;if(t==null)return null;const n=e.anyProvider;if(n&&t.ethereum)return new zr(t.ethereum);if(!("addEventListener"in t&&"dispatchEvent"in t&&"removeEventListener"in t))return null;const s=e.timeout?e.timeout:300;return s===0?null:await new Promise((r,a)=>{let o=[];const c=u=>{o.push(u.detail),n&&l()},l=()=>{if(clearTimeout(h),o.length)if(e&&e.filter){const u=e.filter(o.map(d=>Object.assign({},d.info)));if(u==null)r(null);else if(u instanceof zr)r(u);else{let d=null;if(u.uuid&&(d=o.filter(p=>u.uuid===p.info.uuid)[0]),d){const{provider:f,info:p}=d;r(new zr(f,void 0,{providerInfo:p}))}else a(Qt("filter returned unknown info","UNSUPPORTED_OPERATION",{value:u}))}}else{const{provider:u,info:d}=o[0];r(new zr(u,void 0,{providerInfo:d}))}else r(null);t.removeEventListener("eip6963:announceProvider",c)},h=setTimeout(()=>{l()},s);t.addEventListener("eip6963:announceProvider",c),t.dispatchEvent(new Event("eip6963:requestProvider"))})}}const ty=["function register() external returns (uint256 agentId)","function register(string agentURI) external returns (uint256 agentId)","function register(string agentURI, tuple(string metadataKey, bytes metadataValue)[] metadata) external returns (uint256 agentId)","function setAgentURI(uint256 agentId, string newURI) external","function tokenURI(uint256 tokenId) external view returns (string)","function setMetadata(uint256 agentId, string metadataKey, bytes metadataValue) external","function getMetadata(uint256 agentId, string metadataKey) external view returns (bytes)","function getAgentWallet(uint256 agentId) external view returns (address)","function ownerOf(uint256 tokenId) external view returns (address)","function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function totalSupply() external view returns (uint256)","function name() external view returns (string)","function symbol() external view returns (string)","function getVersion() external pure returns (string)","function transferFrom(address from, address to, uint256 tokenId) external","function safeTransferFrom(address from, address to, uint256 tokenId) external","function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external","function approve(address to, uint256 tokenId) external","function setApprovalForAll(address operator, bool approved) external","event Registered(uint256 indexed agentId, string agentURI, address indexed owner)","event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"],Vr={identityRegistry:"0x8004A818BFB912233c491871b3d84c89A494BD9e",reputationRegistry:"0x8004B663056A597Dffe9eCcC1965A193B7388713",validationRegistry:"0x8004Cb1BF31DAf7788923b405b754f57acEB4272"},Kn={identityRegistry:"0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",reputationRegistry:"0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",validationRegistry:""},Uh={1:Kn,10:Kn,56:Kn,100:Kn,137:Kn,250:Kn,324:Kn,1284:Kn,5e3:Kn,8453:Kn,42161:Kn,42220:Kn,43114:Kn,59144:Kn,534352:Kn,97:Vr,11155111:Vr,84532:Vr,421614:Vr,11155420:Vr,80002:Vr,43113:Vr};function f2(i,e){return`eip155:${i}:${e}`}const ny={1:{name:"Ethereum",shortName:"ETH",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://ethereum-rpc.publicnode.com",explorer:"https://etherscan.io",testnet:!1},10:{name:"Optimism",shortName:"OP",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://mainnet.optimism.io",explorer:"https://optimistic.etherscan.io",testnet:!1},56:{name:"BNB Chain",shortName:"BSC",currency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrl:"https://bsc-dataseed.bnbchain.org",explorer:"https://bscscan.com",testnet:!1},100:{name:"Gnosis",shortName:"GNO",currency:{name:"xDAI",symbol:"xDAI",decimals:18},rpcUrl:"https://rpc.gnosischain.com",explorer:"https://gnosisscan.io",testnet:!1},137:{name:"Polygon",shortName:"POL",currency:{name:"POL",symbol:"POL",decimals:18},rpcUrl:"https://polygon-rpc.com",explorer:"https://polygonscan.com",testnet:!1},250:{name:"Fantom",shortName:"FTM",currency:{name:"Fantom",symbol:"FTM",decimals:18},rpcUrl:"https://rpc.ftm.tools",explorer:"https://ftmscan.com",testnet:!1},324:{name:"zkSync Era",shortName:"zkSync",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://mainnet.era.zksync.io",explorer:"https://explorer.zksync.io",testnet:!1},1284:{name:"Moonbeam",shortName:"GLMR",currency:{name:"Glimmer",symbol:"GLMR",decimals:18},rpcUrl:"https://rpc.api.moonbeam.network",explorer:"https://moonbeam.moonscan.io",testnet:!1},5e3:{name:"Mantle",shortName:"MNT",currency:{name:"Mantle",symbol:"MNT",decimals:18},rpcUrl:"https://rpc.mantle.xyz",explorer:"https://explorer.mantle.xyz",testnet:!1},8453:{name:"Base",shortName:"Base",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://mainnet.base.org",explorer:"https://basescan.org",testnet:!1},42161:{name:"Arbitrum One",shortName:"ARB",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://arb1.arbitrum.io/rpc",explorer:"https://arbiscan.io",testnet:!1},42220:{name:"Celo",shortName:"CELO",currency:{name:"Celo",symbol:"CELO",decimals:18},rpcUrl:"https://forno.celo.org",explorer:"https://celoscan.io",testnet:!1},43114:{name:"Avalanche",shortName:"AVAX",currency:{name:"Avax",symbol:"AVAX",decimals:18},rpcUrl:"https://api.avax.network/ext/bc/C/rpc",explorer:"https://snowtrace.io",testnet:!1},59144:{name:"Linea",shortName:"Linea",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://rpc.linea.build",explorer:"https://lineascan.build",testnet:!1},534352:{name:"Scroll",shortName:"Scroll",currency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrl:"https://rpc.scroll.io",explorer:"https://scrollscan.com",testnet:!1},97:{name:"BSC Testnet",shortName:"BSCt",currency:{name:"tBNB",symbol:"tBNB",decimals:18},rpcUrl:"https://bsc-testnet-rpc.publicnode.com",explorer:"https://testnet.bscscan.com",testnet:!0},11155111:{name:"Ethereum Sepolia",shortName:"Sep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://ethereum-sepolia-rpc.publicnode.com",explorer:"https://sepolia.etherscan.io",testnet:!0},84532:{name:"Base Sepolia",shortName:"BaseSep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://sepolia.base.org",explorer:"https://sepolia.basescan.org",testnet:!0},421614:{name:"Arbitrum Sepolia",shortName:"ArbSep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://sepolia-rollup.arbitrum.io/rpc",explorer:"https://sepolia.arbiscan.io",testnet:!0},11155420:{name:"Optimism Sepolia",shortName:"OpSep",currency:{name:"SepETH",symbol:"ETH",decimals:18},rpcUrl:"https://sepolia.optimism.io",explorer:"https://sepolia-optimism.etherscan.io",testnet:!0},80002:{name:"Polygon Amoy",shortName:"Amoy",currency:{name:"POL",symbol:"POL",decimals:18},rpcUrl:"https://rpc-amoy.polygon.technology",explorer:"https://amoy.polygonscan.com",testnet:!0},43113:{name:"Avalanche Fuji",shortName:"Fuji",currency:{name:"Avax",symbol:"AVAX",decimals:18},rpcUrl:"https://api.avax-test.network/ext/bc/C/rpc",explorer:"https://testnet.snowtrace.io",testnet:!0}};function p2(i,e){if(e)return new zr(e);const t=ny[i];if(!t)throw new Error(`No RPC configured for chainId ${i}`);return new ey(t.rpcUrl,i)}function A2(i,e){const t=Uh[i];if(!t||!t.identityRegistry)throw new Error(`No Identity Registry for chainId ${i}`);const n=p2(i,e);return new Gr(t.identityRegistry,ty,n)}async function g2({chainId:i,agentId:e,ethProvider:t}){const n=A2(i,t),[s,r]=await Promise.all([n.ownerOf(e).catch(()=>null),n.tokenURI(e).catch(()=>null)]);return{agentId:BigInt(e),owner:s,uri:r}}function iy(i){if(!i||typeof i!="object")return null;const e=Array.isArray(i.services)?i.services:[];for(const n of e){if(!n||typeof n!="object")continue;const s=String(n.endpoint||"").trim();if(!s)continue;const r=String(n.name||"").toLowerCase(),a=String(n.version||"").toLowerCase();if(r==="avatar"||r==="avatar-3d"||a.startsWith("gltf")||/\.(glb|gltf)(\?|#|$)/i.test(s))return s}const t=String(i.image||"").trim();return/\.(glb|gltf)(\?|#|$)/i.test(t)?t:null}async function m2(i){if(!i)return{ok:!1,error:"empty uri"};if(i.startsWith("data:"))try{const t=i.match(/^data:application\/json(?:;base64)?,(.*)$/);if(!t)return{ok:!1,error:"unsupported data URI"};const n=/;base64,/.test(i)?atob(t[1]):decodeURIComponent(t[1]);return{ok:!0,data:JSON.parse(n),resolvedUrl:i}}catch(t){return{ok:!1,error:"data URI parse failed: "+t.message}}let e=i;i.startsWith("ipfs://")?e="https://ipfs.io/ipfs/"+i.slice(7):i.startsWith("ar://")&&(e="https://arweave.net/"+i.slice(5));try{const t=await fetch(e);return t.ok?{ok:!0,data:await t.json(),resolvedUrl:e}:{ok:!1,error:`HTTP ${t.status}`,resolvedUrl:e}}catch(t){return{ok:!1,error:t.message,resolvedUrl:e}}}const x2={base:8453,"base-mainnet":8453,"base-sepolia":84532,ethereum:1,mainnet:1},b2={8453:"https://mainnet.base.org",84532:"https://sepolia.base.org",1:"https://eth.llamarpc.com"};async function Ec(i,{rpcURL:e,registry:t}={}){if(!i)throw new Error("loadManifest: source required");if(i.startsWith("agent://"))return E2(i,{rpcURL:e,registryOverride:t});if(i.startsWith("ipfs://")||i.startsWith("ar://")){const n=hs(i),s=await kp(n);return Oh(s,{baseURI:Up(n)})}if(i.startsWith("http")){const n=await kp(i);return Oh(n,{baseURI:Up(i)})}throw new Error(`Unsupported manifest source: ${i}`)}async function E2(i,{rpcURL:e,registryOverride:t}){const n=i.match(/^agent:\/\/([^/]+)\/(\d+)$/);if(!n)throw new Error(`Malformed agent URI: ${i}`);const[,s,r]=n,a=x2[s.toLowerCase()]||Number(s);if(!a)throw new Error(`Unknown chain: ${s}`);const o=Uh[a],c=t||o?.identityRegistry;if(!c)throw new Error(`No registry deployed on chain ${a}. Pass registry= override.`);const l=new ey(e||b2[a]),h=new Gr(c,ty,l),u=BigInt(r),d=await h.tokenURI(u);if(!d)throw new Error(`Agent ${r} on chain ${a} has no URI`);const f=hs(d),p=await kp(f),m=Oh(p,{baseURI:Up(f)});return m.id={...m.id,chain:s,chainId:a,registry:c,agentId:r},m}async function kp(i){let e;try{e=await fetch(i)}catch{e=await X0(i)}if(!e.ok)throw new Error(`Manifest fetch failed: ${i} (${e.status})`);return e.json()}function Oh(i,{baseURI:e=""}={}){if(i.spec&&i.spec.startsWith("agent-manifest/")){const t={...i,_baseURI:e};return t.body=t.body||{},!t.body.uri&&t.image&&(t.body.uri=t.image),t}if(i.type&&i.type.includes("eip-8004")){const t=i.registrations?.[0]||{},n=iy(i);return{spec:"agent-manifest/0.1",_baseURI:e,_source:"erc8004-registration",id:{agentId:t.agentId?.toString()},name:i.name,description:i.description,image:i.image,body:{uri:hs(n||i.image||""),format:"gltf-binary"},brain:{provider:"none"},voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:[],memory:{mode:"local"},tools:["wave","lookAt","play_clip","setExpression"],version:"0.1.0",services:Array.isArray(i.services)?i.services:[],x402Support:!!i.x402Support,embedPolicy:i.embedPolicy||null}}return{spec:"agent-manifest/0.1",_baseURI:e,name:i.name||"Unnamed agent",description:i.description||"",body:{uri:i.body?.uri||i.image||i.model||"",format:i.body?.format||"gltf-binary"},brain:i.brain||{provider:"none"},voice:i.voice||{tts:{provider:"browser"},stt:{provider:"browser"}},skills:i.skills||[],memory:i.memory||{mode:"local"},tools:i.tools||["wave","lookAt","play_clip","setExpression"],version:i.version||"0.1.0"}}function Up(i){const e=i.lastIndexOf("/");return e>=0?i.slice(0,e+1):i}async function sy(i,e){if(!i._baseURI)return null;try{const t=new URL(e,i._baseURI).href,n=await fetch(t);return n.ok?n.text():null}catch{return null}}class Dn extends Error{constructor(e,t,{status:n}={}){super(t),this.name="AgentResolveError",this.code=e,n!==void 0&&(this.status=n)}}async function ry(i,{fetchFn:e}){let t;try{t=await e(i,{credentials:"include"})}catch(n){throw new Dn("network",`network error fetching ${i}: ${n.message||n}`)}if(t.status===401||t.status===403)throw new Dn("unauthorized",`unauthorized fetching ${i} (${t.status})`,{status:t.status});if(t.status===404)throw new Dn("not_found",`resource not found: ${i}`,{status:404});if(!t.ok)throw new Dn("network",`request failed: ${i} (${t.status})`,{status:t.status});try{return await t.json()}catch(n){throw new Dn("network",`invalid JSON from ${i}: ${n.message||n}`)}}const $a=new Map,y2=100;async function _2(i,e){if(!i)throw new Dn("not-found","agentId required");if($a.has(i))return $a.get(i);const t=typeof location<"u"?location.origin:"",n=`${t}/api/agents/${encodeURIComponent(i)}`;let s;try{s=await fetch(n,{credentials:"include",signal:e})}catch(c){throw c?.name==="AbortError"?c:new Dn("network",`network error fetching ${n}: ${c.message||c}`)}if(s.status===404)throw new Dn("not-found",`agent ${i} not found`,{status:404});if(s.status===401||s.status===403)throw new Dn("unauthorized",`unauthorized (${s.status})`,{status:s.status});if(!s.ok)throw new Dn("network",`request failed (${s.status})`,{status:s.status});let r;try{r=await s.json()}catch{throw new Dn("network",`invalid JSON from ${n}`)}const a=r?.agent?.manifestUrl??null;let o=null;if(a)try{o=new URL(a,t).href}catch{o=a}return $a.size>=y2&&$a.delete($a.keys().next().value),$a.set(i,o),o}async function w2(i,{origin:e=typeof location<"u"?location.origin:"",fetchFn:t=fetch}={}){if(!i)throw new Dn("not_found","agentId required");const n=t.bind(typeof globalThis<"u"?globalThis:void 0),r=(await ry(`${e}/api/agents/${encodeURIComponent(i)}`,{fetchFn:n}))?.agent;if(!r)throw new Dn("not_found",`agent ${i} not found`);if(!r.avatar_id)throw new Dn("no_avatar",`agent ${i} has no avatar bound`);const o=(await ry(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`,{fetchFn:n}))?.avatar;if(!o||!o.url)throw new Dn("no_avatar",`avatar ${r.avatar_id} has no url`);const c=Array.isArray(r.skills)?r.skills.map(l=>typeof l=="string"?{name:l}:l).filter(Boolean):[];return{spec:"agent-manifest/0.1",name:r.name||"Agent",description:r.description||"",id:{agentId:r.id,owner:r.wallet_address,chainId:r.chain_id,walletAddress:r.wallet_address},body:{uri:o.url,format:"gltf-binary"},brain:{},voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:c,memory:{mode:"remote",namespace:r.id},tools:["wave","lookAt","play_clip","setExpression","speak","remember"],version:"0.1.0",_baseURI:`${e}/agent/${r.id}/`,_source:"agent-id"}}function ay(i){if(!i)return null;if(typeof i=="object")return i.chainId&&i.agentId!==void 0?{chainId:Number(i.chainId),agentId:String(i.agentId),registry:i.registry||void 0}:null;const e=String(i).trim();if(!e)return null;let t=e.match(/^eip155:(\d+):(0x[0-9a-fA-F]{40}):(\d+)$/);return t?{chainId:Number(t[1]),registry:t[2],agentId:t[3]}:(t=e.match(/^eip155:(\d+)\/erc721:(0x[0-9a-fA-F]{40})\/(\d+)$/),t?{chainId:Number(t[1]),registry:t[2],agentId:t[3]}:(t=e.match(/^onchain:(\d+):(\d+)$/),t?{chainId:Number(t[1]),agentId:t[2]}:(t=e.match(/^agent:\/\/(\d+)\/(\d+)$/),t?{chainId:Number(t[1]),agentId:t[2]}:(t=e.match(/^\/?a\/(\d+)\/(\d+)(?:\/(embed))?\/?$/),t?{chainId:Number(t[1]),agentId:t[2]}:(t=e.match(/^\/?a\/(\d+)\/(0x[0-9a-fA-F]{40})\/(\d+)\/?$/),t?{chainId:Number(t[1]),registry:t[2],agentId:t[3]}:null)))))}function v2(i){const e=i.registry||Uh[i.chainId]?.identityRegistry;return e?`eip155:${i.chainId}:${e}:${i.agentId}`:`onchain:${i.chainId}:${i.agentId}`}function C2(i,{embed:e=!1,origin:t}={}){return`${t||(typeof location<"u"?location.origin:"")}/a/${i.chainId}/${i.agentId}${e?"/embed":""}`}const I2=["https://ipfs.io/ipfs/","https://dweb.link/ipfs/","https://cloudflare-ipfs.com/ipfs/","https://gateway.pinata.cloud/ipfs/"],S2="https://arweave.net/";function oy(i){return i?i.startsWith("ipfs://")?I2[0]+i.slice(7):i.startsWith("ar://")?S2+i.slice(5):i:""}const yc=new Map;function M2(i){return`${i.chainId}:${i.agentId}`}async function B2(i,{ethProvider:e,fresh:t=!1}={}){const n=ay(i);if(!n)throw new Error(`Unrecognised agent reference: ${i}`);const s={chainId:n.chainId,agentId:String(n.agentId),registry:n.registry||Uh[n.chainId]?.identityRegistry||null};if(!s.registry)throw new Error(`No registry deployed on chain ${s.chainId}`);const r=M2(s);if(!t&&yc.has(r))return yc.get(r);const a=ny[s.chainId]||null,o={ref:s,caip:v2(s),publicUrl:typeof location<"u"?C2(s):`/a/${s.chainId}/${s.agentId}`,chain:a?{name:a.name,testnet:!!a.testnet,explorer:a.explorer}:null,onchain:{owner:null,uri:null},metadata:null,metadataUrl:null,image:null,glbUrl:null,name:`Agent #${s.agentId}`,description:"",services:[]};try{const{owner:c,uri:l}=await g2({chainId:s.chainId,agentId:s.agentId,ethProvider:e});if(o.onchain={owner:c,uri:l},!l)return o.error="agentURI not set",yc.set(r,o),o;const h=await m2(l);if(!h.ok)return o.error=h.error,o.metadataUrl=h.resolvedUrl||null,yc.set(r,o),o;const u=h.data;o.metadata=u,o.metadataUrl=h.resolvedUrl||null,o.name=u?.name&&String(u.name)||o.name,o.description=u?.description&&String(u.description)||"",o.image=u?.image?String(u.image):null,o.services=Array.isArray(u?.services)?u.services:[],o.glbUrl=iy(u)}catch(c){o.error=c.message||String(c)}return yc.set(r,o),o}function T2(i){const e=Array.isArray(i.services)?i.services:[],t=e.find(a=>/brain|llm|chat/i.test(a?.name||a?.type||"")),n=e.filter(a=>/skill/i.test(a?.name||a?.type||"")),s=i.glbUrl?oy(i.glbUrl):"",r=i.image?oy(i.image):"";return{spec:"agent-manifest/0.1",_baseURI:i.metadataUrl?R2(i.metadataUrl):"",_source:"erc8004-resolver",id:{agentId:i.ref.agentId,chainId:i.ref.chainId,registry:i.ref.registry,owner:i.onchain.owner||void 0,walletAddress:i.onchain.owner||void 0,caip:i.caip,agentRegistry:f2(i.ref.chainId,i.ref.registry)},name:i.name,description:i.description,image:r,body:{uri:s||r,format:"gltf-binary"},brain:t?{provider:"remote",endpoint:t.endpoint}:{provider:"none"},voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:n.map(a=>({name:a.name,uri:a.endpoint})),memory:{mode:"local",namespace:i.caip},tools:["wave","lookAt","play_clip","setExpression"],version:"0.1.0",services:e,x402Support:!!(i.metadata?.x402Support||i.metadata?.x402),embedPolicy:i.metadata?.embedPolicy||null}}function R2(i){const e=i.lastIndexOf("/");return e>=0?i.slice(0,e+1):i}const F2=["inline","floating","section","fullscreen"],cy=(()=>{try{return new URL(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:nr&&nr.tagName.toUpperCase()==="SCRIPT"&&nr.src||new URL("agent-3d.umd.cjs",document.baseURI).href).origin}catch{return""}})();function N2(i,e,t=[]){if(!i)return!1;let n;try{n=new URL(i).hostname.toLowerCase()}catch{return!1}if(t.some(o=>n===o||n.endsWith("."+o)))return!0;const s=e?.origins?.hosts??[],r=e?.origins?.mode??"allowlist",a=s.some(o=>{const c=o.toLowerCase();return c.startsWith("*.")?n.endsWith(c.slice(1))&&n!==c.slice(2):n===c});return r==="allowlist"?a:!a}const D2=`
:host {
display: block;
position: relative;
@@ -4178,7 +4178,7 @@ ${this.instructions}
padding: 8px 14px;
border-radius: 999px;
}
- .error {
+ .error, .agent-3d-error {
position: absolute;
inset: 16px;
display: grid;
@@ -4189,7 +4189,7 @@ ${this.instructions}
padding: 16px;
font: 14px var(--agent-chat-font);
}
-`;class Up extends HTMLElement{static get observedAttributes(){return["src","manifest","body","agent-id","mode","position","width","height","voice","api-key","key-proxy","responsive"]}constructor(){super(),this.attachShadow({mode:"open"}),this._viewer=null,this._scene=null,this._runtime=null,this._memory=null,this._skills=null,this._manifest=null,this._mounted=!1,this._booting=!1,this._listening=!1,this._pillActive=!1,this._mqNarrow=null,this._mqNarrowHandler=null,this._ro=null,this._outsideTapHandler=null}connectedCallback(){this._renderShell(),this._applyLayout(),this._setupResponsive(),this._observeViewport(),this.hasAttribute("eager")&&this._boot()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){this._mounted&&(["mode","position","width","height","responsive"].includes(e)&&this._applyLayout(),["src","manifest","body","agent-id"].includes(e)&&(this._teardown(),this._boot()))}_renderShell(){const e=document.createElement("style");e.textContent=R2,this.shadowRoot.appendChild(e);const t=document.createElement("div");t.className="stage",t.part="stage",this.shadowRoot.appendChild(t),this._stageEl=t;const n=document.createElement("div");n.className="poster",this.getAttribute("poster")&&(n.style.backgroundImage=`url(${this.getAttribute("poster")})`),this.shadowRoot.appendChild(n),this._posterEl=n;const s=document.createElement("div");s.className="loading",s.textContent="Loading...",s.hidden=!0,this.shadowRoot.appendChild(s),this._loadingEl=s;const r=document.createElement("button");r.className="pill-btn",r.setAttribute("aria-label","Open agent"),r.addEventListener("click",()=>this._expandPill()),r.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._expandPill())}),this.shadowRoot.appendChild(r),this._pillBtn=r;const a=document.createElement("div");if(a.className="pill-drag",this.shadowRoot.appendChild(a),this._pillDrag=a,!this.hasAttribute("kiosk")){const o=document.createElement("div");o.className="chrome",o.part="chrome";const c=document.createElement("div");c.className="chat",c.part="chat";const l=document.createElement("div");l.className="input-row";const h=document.createElement("input");h.type="text",h.placeholder="Say something...",h.addEventListener("keydown",d=>{if(d.key==="Enter"&&h.value.trim()){const f=h.value.trim();h.value="",this.say(f)}});const u=document.createElement("button");u.className="icon mic",u.title="Push to talk",u.innerHTML="🎙",u.addEventListener("click",()=>this._toggleMic()),l.appendChild(h),l.appendChild(u),o.appendChild(c),o.appendChild(l),this.shadowRoot.appendChild(o),this._chatEl=c,this._inputEl=h,this._micEl=u}}_isResponsive(){return this.getAttribute("responsive")!=="false"}_clampWidth(e){const t=_parsePx(e);if(!t)return e;const n=Math.round(Math.max(160,t*.65)),s=Math.round(t/1440*100);return`clamp(${n}px, ${s}vw, ${t}px)`}_clampHeight(e){const t=_parsePx(e);if(!t)return e;const n=Math.round(Math.max(200,t*.65)),s=Math.round(t/900*100);return`clamp(${n}px, ${s}vh, ${t}px)`}_applyLayout(){const e=this.getAttribute("mode")||"inline";if(!B2.includes(e))return;const t=this._isResponsive();if(e==="floating"){if(!this._pillActive){const r=this.getAttribute("position")||"bottom-right",a=(this.getAttribute("offset")||"24px 24px").split(/\s+/),[o,c]=[a[0],a[1]||a[0]];this.style.top=this.style.bottom=this.style.left=this.style.right="",r.includes("top")?this.style.top=o:this.style.bottom=o,r.includes("left")?this.style.left=c:r.includes("right")?this.style.right=c:r.includes("center")&&(this.style.left="50%",this.style.transform="translateX(-50%)")}const n=this.getAttribute("width")||"320px",s=this.getAttribute("height")||"420px";this.style.setProperty("--agent-width",t?this._clampWidth(n):n),this.style.setProperty("--agent-height",t?this._clampHeight(s):s)}else{this.style.top=this.style.bottom=this.style.left=this.style.right=this.style.transform="";const n=this.getAttribute("width"),s=this.getAttribute("height");e==="inline"&&(n&&(this.style.width=t?this._clampWidth(n):n),s?(this.style.height=s,this.removeAttribute("data-responsive")):t&&n&&(this.style.height="",this.setAttribute("data-responsive",""))),n&&this.style.setProperty("--agent-width",t?this._clampWidth(n):n),s&&this.style.setProperty("--agent-height",t?this._clampHeight(s):s)}}_setupResponsive(){const e=this.getAttribute("mode")||"inline";e==="inline"&&typeof ResizeObserver<"u"&&(this._ro=new ResizeObserver(()=>this._applyLayout()),this._ro.observe(this)),e==="floating"&&this._isResponsive()&&typeof window<"u"&&(this._mqNarrow=window.matchMedia("(max-width: 479px)"),this._mqNarrowHandler=n=>this._updatePillState(n.matches),this._mqNarrow.addEventListener("change",this._mqNarrowHandler),this._updatePillState(this._mqNarrow.matches));let t=0;this.shadowRoot.addEventListener("touchstart",n=>{t=n.touches[0].clientY},{passive:!0}),this.shadowRoot.addEventListener("touchend",n=>{n.changedTouches[0].clientY-t>60&&this._pillActive&&this.getAttribute("aria-expanded")==="true"&&this._collapsePill()},{passive:!0})}_updatePillState(e){e&&!this._pillActive?(this._pillActive=!0,this._collapsePill()):!e&&this._pillActive&&(this._pillActive=!1,this._restoreFromPill())}_collapsePill(){this.style.width="56px",this.style.height="56px",this.style.borderRadius="50%",this.setAttribute("aria-expanded","false"),this._pillBtn.style.display="block",this._pillDrag.style.display="none";const e=this.shadowRoot.querySelector(".chrome");e&&(e.style.display="none"),this._stageEl.style.display="none",this._outsideTapHandler&&(document.removeEventListener("pointerdown",this._outsideTapHandler),this._outsideTapHandler=null)}_expandPill(){if(!this._pillActive)return;this.style.width="100vw",this.style.height="70vh",this.style.borderRadius="16px 16px 0 0",this.style.bottom="0",this.style.top="auto",this.style.left="0",this.style.right="0",this.style.transform="none",this.setAttribute("aria-expanded","true"),this._pillBtn.style.display="none",this._pillDrag.style.display="block";const e=this.shadowRoot.querySelector(".chrome");e&&(e.style.display=""),this._stageEl.style.display="",this._outsideTapHandler=t=>{t.composedPath().includes(this)||this._collapsePill()},setTimeout(()=>document.addEventListener("pointerdown",this._outsideTapHandler),0)}_restoreFromPill(){this.removeAttribute("aria-expanded"),this._pillBtn.style.display="none",this._pillDrag.style.display="none";const e=this.shadowRoot.querySelector(".chrome");e&&(e.style.display=""),this._stageEl.style.display="",this.style.width=this.style.height=this.style.borderRadius="",this.style.bottom=this.style.top=this.style.left=this.style.right=this.style.transform="",this._applyLayout(),this._outsideTapHandler&&(document.removeEventListener("pointerdown",this._outsideTapHandler),this._outsideTapHandler=null)}_observeViewport(){if(!this.hasAttribute("eager")){if(typeof IntersectionObserver>"u"){this._boot();return}this._io=new IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&(this._io.disconnect(),this._boot())}),this._io.observe(this)}}async _boot(){if(!(this._booting||this._mounted)){this._booting=!0;try{this._loadingEl.hidden=!1,this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"manifest",pct:.1}}));const e=await this._resolveManifest();if(this._manifest=e,this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"manifest",pct:.3}})),typeof e.brain?.instructions=="string"&&e.brain.instructions.endsWith(".md")){const l=await iy(e,e.brain.instructions);l&&(e.instructions=F2(l))}else e.brain?.instructions&&(e.instructions=e.brain.instructions);const t=(()=>{const l=this.getAttribute("agent-id")||e.id?.agentId||"";return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l)?l:null})();if(t)try{const l=oy||window.location.origin,h=await fetch(`${l}/api/agents/${t}/embed-policy`,{credentials:"omit"});if(h.ok){const{policy:u}=await h.json();if(u){if(u.surfaces?.script===!1){this._fail("embed_denied_surface","This agent disallows the script-tag embed.");return}const d=["3dagent.vercel.app","localhost"],f=window.location.origin;if(!f.startsWith("http://localhost")&&!T2(f,u,d)){this._fail("embed_denied_origin",`This agent isn't permitted on ${f}.`);return}}}}catch(l){console.warn("[agent-3d] embed-policy fetch failed; continuing",l)}this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"body",pct:.45}}));const n=new If(this._stageEl,{kiosk:this.hasAttribute("kiosk")});this._viewer=n;const s=ls(e.body?.uri);s&&await n.load(s,"",new Map),this._scene=new Y0(n),this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"memory",pct:.6}}));const r=e.id?.agentId||this.getAttribute("memory-key")||e.name||"anon";this._memory=await Mi.load({mode:this.getAttribute("memory")||e.memory?.mode||"local",namespace:r,manifestURI:e._baseURI+"manifest.json",fetchFn:fetch.bind(globalThis)}),this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"skills",pct:.75}})),this._skills=new ex({trust:this.getAttribute("skill-trust")||"owned-only",ownerAddress:e.id?.owner});const a=e.skills||[];for(const l of a)try{const h=await this._skills.install(l,{bundleBase:e._baseURI});this.dispatchEvent(new CustomEvent("skill:loaded",{detail:{name:h.name,uri:h.uri}}))}catch(h){console.warn("[agent-3d] skill load failed",l,h)}this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"brain",pct:.9}}));const o={apiKey:this.getAttribute("api-key")||void 0,proxyURL:this.getAttribute("key-proxy")||void 0,agentId:t||void 0,apiOrigin:oy||window.location.origin},c=this._parseTTSAttribute();c&&(e.voice=e.voice||{},e.voice.tts={...e.voice.tts||{},...c}),this._runtime=new K0({manifest:e,viewer:this._scene,memory:this._memory,skills:this._skills,providerConfig:o});for(const l of["brain:thinking","brain:message","skill:tool-called","voice:speech-start","voice:speech-end","voice:transcript","voice:listen-start","memory:write"])this._runtime.addEventListener(l,h=>{this.dispatchEvent(new CustomEvent(l,{detail:h.detail,bubbles:!0,composed:!0})),l==="brain:message"&&this._chatEl&&this._renderMessage(h.detail)});this._mounted=!0,this._loadingEl.hidden=!0,this._pillActive||(this._posterEl.style.opacity="0"),this.dispatchEvent(new CustomEvent("agent:ready",{detail:{agent:this,manifest:e},bubbles:!0,composed:!0}))}catch(e){console.error("[agent-3d] boot failed",e),this._loadingEl.hidden=!0,this._showError(e),this.dispatchEvent(new CustomEvent("agent:error",{detail:{phase:"boot",error:e},bubbles:!0,composed:!0}))}finally{this._booting=!1}}}async _resolveManifest(){const e=this.getAttribute("src"),t=this.getAttribute("manifest"),n=this.getAttribute("body"),s=this.getAttribute("agent-id"),r=this.getAttribute("chain-id");if(e)return s&&console.warn("[agent-3d] both src and agent-id provided; using src"),Lp(e,{rpcURL:this.getAttribute("rpc-url"),registry:this.getAttribute("registry")});if(s){const a=r?{chainId:Number(r),agentId:s,registry:this.getAttribute("registry")||void 0}:s,o=ry(a);if(o){const c=await I2(o);if(c.error&&!c.glbUrl)throw new Error(`On-chain resolve failed: ${c.error}`);return S2(c)}return E2(s)}if(t)return Lp(t);if(n){const a=this.getAttribute("instructions");return{spec:"agent-manifest/0.1",_baseURI:"",name:this.getAttribute("name")||"Agent",body:{uri:n,format:"gltf-binary"},brain:{provider:this.getAttribute("brain")?"anthropic":"none",model:this.getAttribute("brain")||void 0,instructions:a||"You are an embodied 3D agent."},instructions:a||"You are an embodied 3D agent.",voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:(this.getAttribute("skills")||"").split(",").map(o=>o.trim()).filter(Boolean).map(o=>({uri:o})),memory:{mode:this.getAttribute("memory")||"local"},tools:["wave","lookAt","play_clip","setExpression","speak","remember"],version:"0.1.0"}}throw new Error("<agent-3d> requires src=, manifest=, or body= attribute")}_renderMessage({role:e,content:t}){if(!this._chatEl||!t)return;const n=document.createElement("div");n.className="msg",n.innerHTML=`<div class="role">${e}</div><div class="body"></div>`,n.querySelector(".body").textContent=t,this._chatEl.appendChild(n),this._chatEl.scrollTop=this._chatEl.scrollHeight}_showError(e){const t=document.createElement("div");t.className="error",t.textContent=`Couldn't load agent: ${e.message||e}`,this.shadowRoot.appendChild(t)}_fail(e,t){this._loadingEl.hidden=!0;const n=document.createElement("div");n.className="error",n.textContent=t,this.shadowRoot.appendChild(n),this.dispatchEvent(new CustomEvent("agent:error",{detail:{phase:"policy",error:{code:e,message:t}},bubbles:!0,composed:!0}))}async _toggleMic(){if(this._runtime){if(this._listening){this._runtime.stt?.stop(),this._listening=!1,this._micEl.dataset.listening="false";return}this._listening=!0,this._micEl.dataset.listening="true";try{const e=await this._runtime.listen();e&&await this.say(e,{voice:!0})}catch(e){console.warn("[agent-3d] listen failed",e)}finally{this._listening=!1,this._micEl.dataset.listening="false"}}}_teardown(){try{this._io?.disconnect()}catch{}try{this._ro?.disconnect()}catch{}try{this._mqNarrow&&this._mqNarrowHandler&&this._mqNarrow.removeEventListener("change",this._mqNarrowHandler)}catch{}this._outsideTapHandler&&(document.removeEventListener("pointerdown",this._outsideTapHandler),this._outsideTapHandler=null);try{this._runtime?.destroy()}catch{}try{this._viewer?.dispose?.()}catch{}this._mounted=!1,this._pillActive=!1,this._runtime=this._viewer=this._scene=this._memory=this._skills=null}async say(e,t={}){return this._runtime||await this._waitForReady(),this._runtime.send(e,{voice:t.voice??this.hasAttribute("voice")})}async ask(e,t={}){return(await this.say(e,t))?.text||""}clearConversation(){this._runtime?.clearConversation()}async wave(e){return this._scene?.playAnimationByHint("wave",e)}async lookAt(e){return this._scene?.lookAt(e)}async play(e,t){return this._scene?.playClipByName(e,t)}async installSkill(e){if(!this._skills)throw new Error("Agent not mounted");return this._skills.install({uri:e})}uninstallSkill(e){return this._skills?.uninstall(e)}get skills(){return this._skills?.all()||[]}get memory(){return this._memory}get manifest(){return this._manifest}get runtime(){return this._runtime}setMode(e){this.setAttribute("mode",e)}setPosition(e,t){this.setAttribute("position",e),t&&this.setAttribute("offset",t)}setSize(e,t){this.setAttribute("width",e),this.setAttribute("height",t)}pause(){this._runtime?.pause()}resume(){}destroy(){this._teardown()}_waitForReady(){return this._mounted?Promise.resolve():new Promise(e=>{const t=()=>{this.removeEventListener("agent:ready",t),e()};this.addEventListener("agent:ready",t),this._booting||this._boot()})}}function F2(i){const e=i.match(/^---\n[\s\S]*?\n---\n?([\s\S]*)$/);return e?e[1]:i}customElements.get("agent-3d")||customElements.define("agent-3d",Up);const N2=["row","circle","freeform"],D2=`
+`;class Op extends HTMLElement{static get observedAttributes(){return["src","manifest","body","agent-id","mode","position","width","height","voice","api-key","key-proxy","responsive"]}constructor(){super(),this.attachShadow({mode:"open"}),this._viewer=null,this._scene=null,this._runtime=null,this._memory=null,this._skills=null,this._manifest=null,this._mounted=!1,this._booting=!1,this._listening=!1,this._pillActive=!1,this._mqNarrow=null,this._mqNarrowHandler=null,this._ro=null,this._outsideTapHandler=null,this._autoResolvedManifest=!1,this._suppressAttrChange=!1}connectedCallback(){this._renderShell(),this._applyLayout(),this._setupResponsive(),this._observeViewport(),this.hasAttribute("eager")&&this._boot()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){!this._mounted||this._suppressAttrChange||(["mode","position","width","height","responsive"].includes(e)&&this._applyLayout(),["src","manifest","body","agent-id"].includes(e)&&(this._teardown(),this._boot()))}_renderShell(){const e=document.createElement("style");e.textContent=D2,this.shadowRoot.appendChild(e);const t=document.createElement("div");t.className="stage",t.part="stage",this.shadowRoot.appendChild(t),this._stageEl=t;const n=document.createElement("div");n.className="poster",this.getAttribute("poster")&&(n.style.backgroundImage=`url(${this.getAttribute("poster")})`),this.shadowRoot.appendChild(n),this._posterEl=n;const s=document.createElement("div");s.className="loading",s.textContent="Loading...",s.hidden=!0,this.shadowRoot.appendChild(s),this._loadingEl=s;const r=document.createElement("button");r.className="pill-btn",r.setAttribute("aria-label","Open agent"),r.addEventListener("click",()=>this._expandPill()),r.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._expandPill())}),this.shadowRoot.appendChild(r),this._pillBtn=r;const a=document.createElement("div");if(a.className="pill-drag",this.shadowRoot.appendChild(a),this._pillDrag=a,!this.hasAttribute("kiosk")){const o=document.createElement("div");o.className="chrome",o.part="chrome";const c=document.createElement("div");c.className="chat",c.part="chat";const l=document.createElement("div");l.className="input-row";const h=document.createElement("input");h.type="text",h.placeholder="Say something...",h.addEventListener("keydown",d=>{if(d.key==="Enter"&&h.value.trim()){const f=h.value.trim();h.value="",this.say(f)}});const u=document.createElement("button");u.className="icon mic",u.title="Push to talk",u.innerHTML="🎙",u.addEventListener("click",()=>this._toggleMic()),l.appendChild(h),l.appendChild(u),o.appendChild(c),o.appendChild(l),this.shadowRoot.appendChild(o),this._chatEl=c,this._inputEl=h,this._micEl=u}}_isResponsive(){return this.getAttribute("responsive")!=="false"}_clampWidth(e){const t=_parsePx(e);if(!t)return e;const n=Math.round(Math.max(160,t*.65)),s=Math.round(t/1440*100);return`clamp(${n}px, ${s}vw, ${t}px)`}_clampHeight(e){const t=_parsePx(e);if(!t)return e;const n=Math.round(Math.max(200,t*.65)),s=Math.round(t/900*100);return`clamp(${n}px, ${s}vh, ${t}px)`}_applyLayout(){const e=this.getAttribute("mode")||"inline";if(!F2.includes(e))return;const t=this._isResponsive();if(e==="floating"){if(!this._pillActive){const r=this.getAttribute("position")||"bottom-right",a=(this.getAttribute("offset")||"24px 24px").split(/\s+/),[o,c]=[a[0],a[1]||a[0]];this.style.top=this.style.bottom=this.style.left=this.style.right="",r.includes("top")?this.style.top=o:this.style.bottom=o,r.includes("left")?this.style.left=c:r.includes("right")?this.style.right=c:r.includes("center")&&(this.style.left="50%",this.style.transform="translateX(-50%)")}const n=this.getAttribute("width")||"320px",s=this.getAttribute("height")||"420px";this.style.setProperty("--agent-width",t?this._clampWidth(n):n),this.style.setProperty("--agent-height",t?this._clampHeight(s):s)}else{this.style.top=this.style.bottom=this.style.left=this.style.right=this.style.transform="";const n=this.getAttribute("width"),s=this.getAttribute("height");e==="inline"&&(n&&(this.style.width=t?this._clampWidth(n):n),s?(this.style.height=s,this.removeAttribute("data-responsive")):t&&n&&(this.style.height="",this.setAttribute("data-responsive",""))),n&&this.style.setProperty("--agent-width",t?this._clampWidth(n):n),s&&this.style.setProperty("--agent-height",t?this._clampHeight(s):s)}}_setupResponsive(){const e=this.getAttribute("mode")||"inline";e==="inline"&&typeof ResizeObserver<"u"&&(this._ro=new ResizeObserver(()=>this._applyLayout()),this._ro.observe(this)),e==="floating"&&this._isResponsive()&&typeof window<"u"&&(this._mqNarrow=window.matchMedia("(max-width: 479px)"),this._mqNarrowHandler=n=>this._updatePillState(n.matches),this._mqNarrow.addEventListener("change",this._mqNarrowHandler),this._updatePillState(this._mqNarrow.matches));let t=0;this.shadowRoot.addEventListener("touchstart",n=>{t=n.touches[0].clientY},{passive:!0}),this.shadowRoot.addEventListener("touchend",n=>{n.changedTouches[0].clientY-t>60&&this._pillActive&&this.getAttribute("aria-expanded")==="true"&&this._collapsePill()},{passive:!0})}_updatePillState(e){e&&!this._pillActive?(this._pillActive=!0,this._collapsePill()):!e&&this._pillActive&&(this._pillActive=!1,this._restoreFromPill())}_collapsePill(){this.style.width="56px",this.style.height="56px",this.style.borderRadius="50%",this.setAttribute("aria-expanded","false"),this._pillBtn.style.display="block",this._pillDrag.style.display="none";const e=this.shadowRoot.querySelector(".chrome");e&&(e.style.display="none"),this._stageEl.style.display="none",this._outsideTapHandler&&(document.removeEventListener("pointerdown",this._outsideTapHandler),this._outsideTapHandler=null)}_expandPill(){if(!this._pillActive)return;this.style.width="100vw",this.style.height="70vh",this.style.borderRadius="16px 16px 0 0",this.style.bottom="0",this.style.top="auto",this.style.left="0",this.style.right="0",this.style.transform="none",this.setAttribute("aria-expanded","true"),this._pillBtn.style.display="none",this._pillDrag.style.display="block";const e=this.shadowRoot.querySelector(".chrome");e&&(e.style.display=""),this._stageEl.style.display="",this._outsideTapHandler=t=>{t.composedPath().includes(this)||this._collapsePill()},setTimeout(()=>document.addEventListener("pointerdown",this._outsideTapHandler),0)}_restoreFromPill(){this.removeAttribute("aria-expanded"),this._pillBtn.style.display="none",this._pillDrag.style.display="none";const e=this.shadowRoot.querySelector(".chrome");e&&(e.style.display=""),this._stageEl.style.display="",this.style.width=this.style.height=this.style.borderRadius="",this.style.bottom=this.style.top=this.style.left=this.style.right=this.style.transform="",this._applyLayout(),this._outsideTapHandler&&(document.removeEventListener("pointerdown",this._outsideTapHandler),this._outsideTapHandler=null)}_observeViewport(){if(!this.hasAttribute("eager")){if(typeof IntersectionObserver>"u"){this._boot();return}this._io=new IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&(this._io.disconnect(),this._boot())}),this._io.observe(this)}}async _boot(){if(!(this._booting||this._mounted)){this._booting=!0;try{this._loadingEl.hidden=!1,this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"manifest",pct:.1}}));const e=await this._resolveManifest();if(this._manifest=e,this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"manifest",pct:.3}})),typeof e.brain?.instructions=="string"&&e.brain.instructions.endsWith(".md")){const l=await sy(e,e.brain.instructions);l&&(e.instructions=L2(l))}else e.brain?.instructions&&(e.instructions=e.brain.instructions);const t=(()=>{const l=this.getAttribute("agent-id")||e.id?.agentId||"";return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l)?l:null})();if(t)try{const l=cy||window.location.origin,h=await fetch(`${l}/api/agents/${t}/embed-policy`,{credentials:"omit"});if(h.ok){const{policy:u}=await h.json();if(u){if(u.surfaces?.script===!1){this._fail("embed_denied_surface","This agent disallows the script-tag embed.");return}const d=["3dagent.vercel.app","localhost"],f=window.location.origin;if(!f.startsWith("http://localhost")&&!N2(f,u,d)){this._fail("embed_denied_origin",`This agent isn't permitted on ${f}.`);return}}}}catch(l){console.warn("[agent-3d] embed-policy fetch failed; continuing",l)}this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"body",pct:.45}}));const n=new Mf(this._stageEl,{kiosk:this.hasAttribute("kiosk")});this._viewer=n;const s=hs(e.body?.uri);s&&await n.load(s,"",new Map),this._scene=new J0(n),this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"memory",pct:.6}}));const r=e.id?.agentId||this.getAttribute("memory-key")||e.name||"anon";this._memory=await Bi.load({mode:this.getAttribute("memory")||e.memory?.mode||"local",namespace:r,manifestURI:e._baseURI+"manifest.json",fetchFn:fetch.bind(globalThis)}),this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"skills",pct:.75}})),this._skills=new tx({trust:this.getAttribute("skill-trust")||"owned-only",ownerAddress:e.id?.owner});const a=e.skills||[];for(const l of a)try{const h=await this._skills.install(l,{bundleBase:e._baseURI});this.dispatchEvent(new CustomEvent("skill:loaded",{detail:{name:h.name,uri:h.uri}}))}catch(h){console.warn("[agent-3d] skill load failed",l,h)}this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"brain",pct:.9}}));const o={apiKey:this.getAttribute("api-key")||void 0,proxyURL:this.getAttribute("key-proxy")||void 0,agentId:t||void 0,apiOrigin:cy||window.location.origin},c=this._parseTTSAttribute();c&&(e.voice=e.voice||{},e.voice.tts={...e.voice.tts||{},...c}),this._runtime=new j0({manifest:e,viewer:this._scene,memory:this._memory,skills:this._skills,providerConfig:o});for(const l of["brain:thinking","brain:message","skill:tool-called","voice:speech-start","voice:speech-end","voice:transcript","voice:listen-start","memory:write"])this._runtime.addEventListener(l,h=>{this.dispatchEvent(new CustomEvent(l,{detail:h.detail,bubbles:!0,composed:!0})),l==="brain:message"&&this._chatEl&&this._renderMessage(h.detail)});this._mounted=!0,this._loadingEl.hidden=!0,this._pillActive||(this._posterEl.style.opacity="0"),this.dispatchEvent(new CustomEvent("agent:ready",{detail:{agent:this,manifest:e},bubbles:!0,composed:!0}))}catch(e){if(console.error("[agent-3d] boot failed",e),this._loadingEl.hidden=!0,e instanceof Dn&&e.code==="not-found"){const t=document.createElement("div");t.className="agent-3d-error",t.textContent="Agent not found",this.shadowRoot.appendChild(t)}else this._showError(e);this.dispatchEvent(new CustomEvent("agent:error",{detail:{phase:"boot",error:e},bubbles:!0,composed:!0}))}finally{this._booting=!1}}}async _resolveManifest(){const e=this.getAttribute("src"),t=this.getAttribute("manifest"),n=this.getAttribute("body"),s=this.getAttribute("agent-id"),r=this.getAttribute("chain-id");if(e)return s&&console.warn("[agent-3d] both src and agent-id provided; using src"),Ec(e,{rpcURL:this.getAttribute("rpc-url"),registry:this.getAttribute("registry")});if(s){const a=r?{chainId:Number(r),agentId:s,registry:this.getAttribute("registry")||void 0}:s,o=ay(a);if(o){const l=await B2(o);if(l.error&&!l.glbUrl)throw new Error(`On-chain resolve failed: ${l.error}`);return T2(l)}if(t)return Ec(t);const c=await _2(s);return c?(this._autoResolvedManifest=!0,this.setAttribute("manifest",c),Ec(c)):w2(s)}if(t)return Ec(t);if(n){const a=this.getAttribute("instructions");return{spec:"agent-manifest/0.1",_baseURI:"",name:this.getAttribute("name")||"Agent",body:{uri:n,format:"gltf-binary"},brain:{provider:this.getAttribute("brain")?"anthropic":"none",model:this.getAttribute("brain")||void 0,instructions:a||"You are an embodied 3D agent."},instructions:a||"You are an embodied 3D agent.",voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:(this.getAttribute("skills")||"").split(",").map(o=>o.trim()).filter(Boolean).map(o=>({uri:o})),memory:{mode:this.getAttribute("memory")||"local"},tools:["wave","lookAt","play_clip","setExpression","speak","remember"],version:"0.1.0"}}throw new Error("<agent-3d> requires src=, manifest=, or body= attribute")}_renderMessage({role:e,content:t}){if(!this._chatEl||!t)return;const n=document.createElement("div");n.className="msg",n.innerHTML=`<div class="role">${e}</div><div class="body"></div>`,n.querySelector(".body").textContent=t,this._chatEl.appendChild(n),this._chatEl.scrollTop=this._chatEl.scrollHeight}_showError(e){const t=document.createElement("div");t.className="error",t.textContent=`Couldn't load agent: ${e.message||e}`,this.shadowRoot.appendChild(t)}_fail(e,t){this._loadingEl.hidden=!0;const n=document.createElement("div");n.className="error",n.textContent=t,this.shadowRoot.appendChild(n),this.dispatchEvent(new CustomEvent("agent:error",{detail:{phase:"policy",error:{code:e,message:t}},bubbles:!0,composed:!0}))}async _toggleMic(){if(this._runtime){if(this._listening){this._runtime.stt?.stop(),this._listening=!1,this._micEl.dataset.listening="false";return}this._listening=!0,this._micEl.dataset.listening="true";try{const e=await this._runtime.listen();e&&await this.say(e,{voice:!0})}catch(e){console.warn("[agent-3d] listen failed",e)}finally{this._listening=!1,this._micEl.dataset.listening="false"}}}_teardown(){if(this._autoResolvedManifest){this._suppressAttrChange=!0;try{this.removeAttribute("manifest")}finally{this._suppressAttrChange=!1}this._autoResolvedManifest=!1}try{this._io?.disconnect()}catch{}try{this._ro?.disconnect()}catch{}try{this._mqNarrow&&this._mqNarrowHandler&&this._mqNarrow.removeEventListener("change",this._mqNarrowHandler)}catch{}this._outsideTapHandler&&(document.removeEventListener("pointerdown",this._outsideTapHandler),this._outsideTapHandler=null);try{this._runtime?.destroy()}catch{}try{this._viewer?.dispose?.()}catch{}this._mounted=!1,this._pillActive=!1,this._runtime=this._viewer=this._scene=this._memory=this._skills=null}async say(e,t={}){return this._runtime||await this._waitForReady(),this._runtime.send(e,{voice:t.voice??this.hasAttribute("voice")})}async ask(e,t={}){return(await this.say(e,t))?.text||""}clearConversation(){this._runtime?.clearConversation()}async wave(e){return this._scene?.playAnimationByHint("wave",e)}async lookAt(e){return this._scene?.lookAt(e)}async play(e,t){return this._scene?.playClipByName(e,t)}async installSkill(e){if(!this._skills)throw new Error("Agent not mounted");return this._skills.install({uri:e})}uninstallSkill(e){return this._skills?.uninstall(e)}get skills(){return this._skills?.all()||[]}get memory(){return this._memory}get manifest(){return this._manifest}get runtime(){return this._runtime}setMode(e){this.setAttribute("mode",e)}setPosition(e,t){this.setAttribute("position",e),t&&this.setAttribute("offset",t)}setSize(e,t){this.setAttribute("width",e),this.setAttribute("height",t)}pause(){this._runtime?.pause()}resume(){}destroy(){this._teardown()}_waitForReady(){return this._mounted?Promise.resolve():new Promise(e=>{const t=()=>{this.removeEventListener("agent:ready",t),e()};this.addEventListener("agent:ready",t),this._booting||this._boot()})}}function L2(i){const e=i.match(/^---\n[\s\S]*?\n---\n?([\s\S]*)$/);return e?e[1]:i}customElements.get("agent-3d")||customElements.define("agent-3d",Op);const P2=["row","circle","freeform"],k2=`
:host {
display: block;
position: relative;
@@ -4209,4 +4209,4 @@ ${this.instructions}
position: absolute;
pointer-events: none;
}
-`;class cy extends HTMLElement{static get observedAttributes(){return["formation"]}constructor(){super(),this.attachShadow({mode:"open"}),this._viewer=null,this._agents=[],this._initialized=!1}connectedCallback(){this._renderShell(),this._initViewer(),this._mo=new MutationObserver(()=>this._repositionAll()),this._mo.observe(this,{childList:!0})}disconnectedCallback(){try{this._mo?.disconnect()}catch{}for(const e of[...this._agents])this.unregisterAgent(e.element);try{this._viewer?.dispose?.()}catch{}this._viewer=null,this._initialized=!1}attributeChangedCallback(e){e==="formation"&&this._repositionAll()}get formation(){const e=this.getAttribute("formation")||"row";return N2.includes(e)?e:"row"}get viewer(){return this._viewer}_renderShell(){const e=document.createElement("style");e.textContent=D2,this.shadowRoot.appendChild(e);const t=document.createElement("div");t.className="stage-canvas",t.part="stage",this.shadowRoot.appendChild(t),this._canvasBox=t;const n=document.createElement("slot");this.shadowRoot.appendChild(n)}_initViewer(){if(!this._initialized){this._viewer=new If(this._canvasBox,{kiosk:!0}),this._viewer.defaultCamera.position.set(0,1.55,3.4),this._viewer.defaultCamera.lookAt(0,1.2,0),this._viewer.controls.target.set(0,1.2,0),this._viewer.controls.update();try{this._viewer.updateLights?.()}catch{}try{this._viewer.updateEnvironment?.()}catch{}this._viewer.invalidate(),this._initialized=!0}}registerAgent(e,{id:t,group:n,manifest:s}){const r=this._uniqueId(t||s?.name||"agent"),a={id:r,element:e,group:n,manifest:s};return this._agents.push(a),this._viewer?.scene.add(n),this._repositionAll(),this.dispatchEvent(new CustomEvent("stage:agent-joined",{detail:{agentId:r,element:e,manifest:s},bubbles:!0,composed:!0})),r}unregisterAgent(e){const t=this._agents.findIndex(s=>s.element===e);if(t<0)return;const[n]=this._agents.splice(t,1);try{this._viewer?.scene.remove(n.group)}catch{}L2(n.group),this._repositionAll(),this.dispatchEvent(new CustomEvent("stage:agent-left",{detail:{agentId:n.id,element:n.element},bubbles:!0,composed:!0}))}_uniqueId(e){let t=e,n=1;const s=new Set(this._agents.map(r=>r.id));for(;s.has(t);)t=`${e}-${n++}`;return t}getAgents(){return this._agents.map(({id:e,group:t,manifest:n,element:s})=>({agentId:e,name:n?.name||e,position:[+t.position.x.toFixed(3),+t.position.y.toFixed(3),+t.position.z.toFixed(3)],element:s}))}broadcast(e,t){const n={from:e,event:t};for(const s of this._agents)s.id!==e&&s.element.dispatchEvent(new CustomEvent("stage:message",{detail:n}));this.dispatchEvent(new CustomEvent("stage:message",{detail:n,bubbles:!0,composed:!0}))}async routeMessage(e,t,n){const s=this._agents.find(r=>r.id===t);if(!s)return{ok:!1,error:`No agent "${t}" on stage`};try{return{ok:!0,reply:(await s.element.say(`[from ${e}] ${n}`))?.text||""}}catch(r){return{ok:!1,error:r?.message||String(r)}}}async addAgent(e){const t=document.createElement("agent-3d");return e&&typeof e=="object"&&(t._inlineManifest=e),t.hasAttribute("eager")||t.setAttribute("eager",""),this.appendChild(t),t}removeAgent(e){const t=this._agents.find(n=>n.id===e);t&&t.element.remove()}_repositionAll(){const e=this._agents.length;if(!(!e||!this._viewer)){for(let t=0;t<e;t++){const{element:n,group:s,manifest:r}=this._agents[t],a=this._slotFor(t,e);s.position.copy(a.world),s.lookAt(0,a.world.y+1,a.world.z+5),n.style.position="absolute",n.style.left=a.dom.left,n.style.top=a.dom.top,n.style.width=a.dom.width,n.style.height=a.dom.height,n.style.pointerEvents="none"}this._viewer.invalidate()}}_slotFor(e,t){const n=this.formation,s=1/Math.max(t,1);if(n==="circle"){const o=e/t*Math.PI*2,c=Math.max(.8,.4*t);return{world:new G(Math.sin(o)*c,0,-Math.cos(o)*c+c*.5),dom:{left:`${e*s*100}%`,top:"0",width:`${s*100}%`,height:"100%"}}}if(n==="freeform")return{world:new G(0,0,0),dom:{left:"0",top:"0",width:"100%",height:"100%"}};const a=(e-(t-1)/2)*1.1;return{world:new G(a,0,0),dom:{left:`${e*s*100}%`,top:"0",width:`${s*100}%`,height:"100%"}}}}function L2(i){i.traverse(e=>{if(e.geometry)try{e.geometry.dispose()}catch{}if(e.material){const t=Array.isArray(e.material)?e.material:[e.material];for(const n of t){for(const s of Object.keys(n)){const r=n[s];if(r&&r.isTexture)try{r.dispose()}catch{}}try{n.dispose()}catch{}}}}),i.parent&&i.parent.remove(i)}customElements.get("agent-stage")||customElements.define("agent-stage",cy);const P2=(i="agent-3d")=>{customElements.get(i)||customElements.define(i,Up)};on.Agent3DElement=Up,on.AgentStageElement=cy,on.Memory=Mi,on.Runtime=K0,on.SceneController=Y0,on.Skill=$0,on.SkillRegistry=ex,on.Viewer=If,on.defineElement=P2,on.fetchRelative=iy,on.fetchWithFallback=j0,on.loadManifest=Lp,on.normalize=kh,on.resolveURI=ls,Object.defineProperty(on,Symbol.toStringTag,{value:"Module"})}));
+`;class ly extends HTMLElement{static get observedAttributes(){return["formation"]}constructor(){super(),this.attachShadow({mode:"open"}),this._viewer=null,this._agents=[],this._initialized=!1}connectedCallback(){this._renderShell(),this._initViewer(),this._mo=new MutationObserver(()=>this._repositionAll()),this._mo.observe(this,{childList:!0})}disconnectedCallback(){try{this._mo?.disconnect()}catch{}for(const e of[...this._agents])this.unregisterAgent(e.element);try{this._viewer?.dispose?.()}catch{}this._viewer=null,this._initialized=!1}attributeChangedCallback(e){e==="formation"&&this._repositionAll()}get formation(){const e=this.getAttribute("formation")||"row";return P2.includes(e)?e:"row"}get viewer(){return this._viewer}_renderShell(){const e=document.createElement("style");e.textContent=k2,this.shadowRoot.appendChild(e);const t=document.createElement("div");t.className="stage-canvas",t.part="stage",this.shadowRoot.appendChild(t),this._canvasBox=t;const n=document.createElement("slot");this.shadowRoot.appendChild(n)}_initViewer(){if(!this._initialized){this._viewer=new Mf(this._canvasBox,{kiosk:!0}),this._viewer.defaultCamera.position.set(0,1.55,3.4),this._viewer.defaultCamera.lookAt(0,1.2,0),this._viewer.controls.target.set(0,1.2,0),this._viewer.controls.update();try{this._viewer.updateLights?.()}catch{}try{this._viewer.updateEnvironment?.()}catch{}this._viewer.invalidate(),this._initialized=!0}}registerAgent(e,{id:t,group:n,manifest:s}){const r=this._uniqueId(t||s?.name||"agent"),a={id:r,element:e,group:n,manifest:s};return this._agents.push(a),this._viewer?.scene.add(n),this._repositionAll(),this.dispatchEvent(new CustomEvent("stage:agent-joined",{detail:{agentId:r,element:e,manifest:s},bubbles:!0,composed:!0})),r}unregisterAgent(e){const t=this._agents.findIndex(s=>s.element===e);if(t<0)return;const[n]=this._agents.splice(t,1);try{this._viewer?.scene.remove(n.group)}catch{}U2(n.group),this._repositionAll(),this.dispatchEvent(new CustomEvent("stage:agent-left",{detail:{agentId:n.id,element:n.element},bubbles:!0,composed:!0}))}_uniqueId(e){let t=e,n=1;const s=new Set(this._agents.map(r=>r.id));for(;s.has(t);)t=`${e}-${n++}`;return t}getAgents(){return this._agents.map(({id:e,group:t,manifest:n,element:s})=>({agentId:e,name:n?.name||e,position:[+t.position.x.toFixed(3),+t.position.y.toFixed(3),+t.position.z.toFixed(3)],element:s}))}broadcast(e,t){const n={from:e,event:t};for(const s of this._agents)s.id!==e&&s.element.dispatchEvent(new CustomEvent("stage:message",{detail:n}));this.dispatchEvent(new CustomEvent("stage:message",{detail:n,bubbles:!0,composed:!0}))}async routeMessage(e,t,n){const s=this._agents.find(r=>r.id===t);if(!s)return{ok:!1,error:`No agent "${t}" on stage`};try{return{ok:!0,reply:(await s.element.say(`[from ${e}] ${n}`))?.text||""}}catch(r){return{ok:!1,error:r?.message||String(r)}}}async addAgent(e){const t=document.createElement("agent-3d");return e&&typeof e=="object"&&(t._inlineManifest=e),t.hasAttribute("eager")||t.setAttribute("eager",""),this.appendChild(t),t}removeAgent(e){const t=this._agents.find(n=>n.id===e);t&&t.element.remove()}_repositionAll(){const e=this._agents.length;if(!(!e||!this._viewer)){for(let t=0;t<e;t++){const{element:n,group:s,manifest:r}=this._agents[t],a=this._slotFor(t,e);s.position.copy(a.world),s.lookAt(0,a.world.y+1,a.world.z+5),n.style.position="absolute",n.style.left=a.dom.left,n.style.top=a.dom.top,n.style.width=a.dom.width,n.style.height=a.dom.height,n.style.pointerEvents="none"}this._viewer.invalidate()}}_slotFor(e,t){const n=this.formation,s=1/Math.max(t,1);if(n==="circle"){const o=e/t*Math.PI*2,c=Math.max(.8,.4*t);return{world:new G(Math.sin(o)*c,0,-Math.cos(o)*c+c*.5),dom:{left:`${e*s*100}%`,top:"0",width:`${s*100}%`,height:"100%"}}}if(n==="freeform")return{world:new G(0,0,0),dom:{left:"0",top:"0",width:"100%",height:"100%"}};const a=(e-(t-1)/2)*1.1;return{world:new G(a,0,0),dom:{left:`${e*s*100}%`,top:"0",width:`${s*100}%`,height:"100%"}}}}function U2(i){i.traverse(e=>{if(e.geometry)try{e.geometry.dispose()}catch{}if(e.material){const t=Array.isArray(e.material)?e.material:[e.material];for(const n of t){for(const s of Object.keys(n)){const r=n[s];if(r&&r.isTexture)try{r.dispose()}catch{}}try{n.dispose()}catch{}}}}),i.parent&&i.parent.remove(i)}customElements.get("agent-stage")||customElements.define("agent-stage",ly);const O2=(i="agent-3d")=>{customElements.get(i)||customElements.define(i,Op)};on.Agent3DElement=Op,on.AgentStageElement=ly,on.Memory=Bi,on.Runtime=j0,on.SceneController=J0,on.Skill=ex,on.SkillRegistry=tx,on.Viewer=Mf,on.defineElement=O2,on.fetchRelative=sy,on.fetchWithFallback=X0,on.loadManifest=Ec,on.normalize=Oh,on.resolveURI=hs,Object.defineProperty(on,Symbol.toStringTag,{value:"Module"})}));
diff --git a/dist-lib/agents/README.md b/dist-lib/agents/README.md
new file mode 100644
index 000000000..0a228489d
--- /dev/null
+++ b/dist-lib/agents/README.md
@@ -0,0 +1,52 @@
+# Agents Directory
+
+Public directory of registered agents across the 3D Agent ecosystem.
+
+## Features
+
+- **Global discovery** — Browse all registered agents on-chain
+- **Chain filtering** — Filter by blockchain (Base, Base Sepolia, Optimism, Polygon)
+- **Search** — Find agents by name, ID, or description
+- **Sorting** — Sort by newest, oldest, or alphabetical order
+- **Pagination** — 30 agents per page with shareable URLs
+- **Lazy loading** — Avatar thumbnails load on-demand
+
+## Data source
+
+Agents are sourced from the **on-chain IdentityRegistry**. Each agent's metadata is resolved from the `tokenURI` stored on-chain. Avatar images are extracted from the agent manifest's `body.uri` field.
+
+## URL parameters
+
+Filters are preserved in the URL for shareability:
+
+```
+/agents/?chain=8453&sort=newest&page=2&search=Alice
+```
+
+| Parameter | Values | Default |
+| --------- | ------------------------------------------------------------------------------ | -------- |
+| `chain` | `all`, `8453` (Base), `84532` (Base Sepolia), `10` (Optimism), `137` (Polygon) | `all` |
+| `sort` | `newest`, `oldest`, `name` | `newest` |
+| `page` | `1`–N | `1` |
+| `search` | Free text | (none) |
+
+## Accessibility
+
+- Semantic HTML with `data-agent-id` attributes on cards (QA-friendly)
+- Lazy loading via `IntersectionObserver`
+- Keyboard navigation support (tabs, enter)
+- Target Lighthouse accessibility score ≥ 90
+
+## Architecture
+
+- **[index.html](./index.html)** — HTML structure + inline styles
+- **[boot.js](./boot.js)** — Event handling + URL state management
+- **[../../src/agents-directory.js](../../src/agents-directory.js)** — Controller class
+ - Fetches from on-chain registries
+ - Client-side filtering & sorting
+ - SWR-style caching (60s TTL)
+ - Lazy image loading
+
+## Rate limiting
+
+On-chain queries use public RPCs from `CHAIN_META`. No backend calls for the public list (no rate-limit concerns).
diff --git a/dist-lib/agents/boot.js b/dist-lib/agents/boot.js
new file mode 100644
index 000000000..88aad7e4b
--- /dev/null
+++ b/dist-lib/agents/boot.js
@@ -0,0 +1,153 @@
+/**
+ * Agents directory page — initialization and event handling.
+ */
+
+import { AgentsDirectory } from '../../src/agents-directory.js';
+
+const directory = new AgentsDirectory('#agents');
+
+// Decode URL params
+const urlParams = new URLSearchParams(window.location.search);
+const initialChain = urlParams.get('chain') || 'all';
+const initialSort = urlParams.get('sort') || 'newest';
+const initialPage = parseInt(urlParams.get('page') || '1', 10);
+const initialSearch = urlParams.get('search') || '';
+
+// UI elements
+const searchInput = document.getElementById('search');
+const filterChips = document.querySelectorAll('.filter-chip');
+const sortSelect = document.getElementById('sort');
+const agentsContainer = document.getElementById('agents');
+const emptyState = document.getElementById('empty-state');
+const loadingEl = document.getElementById('loading');
+const paginationEl = document.getElementById('pagination');
+const pageInfo = document.getElementById('page-info');
+const prevBtn = document.getElementById('prev-btn');
+const nextBtn = document.getElementById('next-btn');
+
+let currentChain = initialChain;
+let currentSort = initialSort;
+let currentPage = initialPage;
+let currentSearch = initialSearch;
+
+/**
+ * Update URL with current state.
+ */
+function updateUrl() {
+ const params = new URLSearchParams();
+ if (currentChain !== 'all') params.set('chain', currentChain);
+ if (currentSort !== 'newest') params.set('sort', currentSort);
+ if (currentPage !== 1) params.set('page', currentPage);
+ if (currentSearch) params.set('search', currentSearch);
+
+ const query = params.toString();
+ const path = query ? `?${query}` : '';
+ window.history.replaceState({}, '', `/agents/${path}`);
+}
+
+/**
+ * Load and render agents.
+ */
+async function render() {
+ loadingEl.style.display = 'block';
+ agentsContainer.innerHTML = '';
+ emptyState.style.display = 'none';
+ paginationEl.style.display = 'none';
+
+ try {
+ const result = await directory.load({
+ chain: currentChain,
+ search: currentSearch,
+ sort: currentSort,
+ page: currentPage,
+ });
+
+ if (result.agents.length === 0) {
+ emptyState.style.display = 'block';
+ loadingEl.style.display = 'none';
+ return;
+ }
+
+ directory.render();
+ loadingEl.style.display = 'none';
+ agentsContainer.style.display = 'grid';
+
+ // Update pagination
+ const { hasNextPage, hasPrevPage, page, totalPages } = directory.getPaginationInfo();
+ pageInfo.textContent = `Page ${page} of ${totalPages}`;
+ prevBtn.disabled = !hasPrevPage;
+ nextBtn.disabled = !hasNextPage;
+ paginationEl.style.display = 'flex';
+
+ // Scroll to top
+ window.scrollTo({ top: 0, behavior: 'smooth' });
+ } catch (err) {
+ console.error('Failed to load agents:', err);
+ loadingEl.style.display = 'none';
+ emptyState.style.display = 'block';
+ emptyState.querySelector('h2').textContent = 'Error loading agents';
+ emptyState.querySelector('p').textContent = err.message || 'Please try again later.';
+ }
+}
+
+/**
+ * Handle card clicks.
+ */
+directory.onCardClick((agent) => {
+ window.location.href = `/a/${agent.chainId}/${agent.id}`;
+});
+
+// Search input
+searchInput.value = currentSearch;
+searchInput.addEventListener('input', (e) => {
+ currentSearch = e.target.value;
+ currentPage = 1;
+ updateUrl();
+ render();
+});
+
+// Filter chips
+filterChips.forEach((chip) => {
+ const filter = chip.dataset.filter;
+ if (filter === currentChain) {
+ chip.classList.add('active');
+ }
+ chip.addEventListener('click', () => {
+ filterChips.forEach((c) => c.classList.remove('active'));
+ chip.classList.add('active');
+ currentChain = filter;
+ currentPage = 1;
+ updateUrl();
+ render();
+ });
+});
+
+// Sort select
+sortSelect.value = currentSort;
+sortSelect.addEventListener('change', (e) => {
+ currentSort = e.target.value;
+ currentPage = 1;
+ updateUrl();
+ render();
+});
+
+// Pagination
+prevBtn.addEventListener('click', () => {
+ if (currentPage > 1) {
+ currentPage--;
+ updateUrl();
+ render();
+ }
+});
+
+nextBtn.addEventListener('click', () => {
+ const info = directory.getPaginationInfo();
+ if (currentPage < info.totalPages) {
+ currentPage++;
+ updateUrl();
+ render();
+ }
+});
+
+// Initial render
+render();
diff --git a/dist-lib/agents/index.html b/dist-lib/agents/index.html
new file mode 100644
index 000000000..76aec4c95
--- /dev/null
+++ b/dist-lib/agents/index.html
@@ -0,0 +1,391 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Agents Directory — 3D Agent</title>
+ <style>
+ * {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ }
+
+ html,
+ body {
+ font-family:
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
+ background: linear-gradient(135deg, #0f0f23 0%, #1a0f3a 100%);
+ color: #e0e0e0;
+ min-height: 100vh;
+ overflow-x: hidden;
+ }
+
+ header {
+ background: rgba(15, 15, 35, 0.95);
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
+ padding: 2rem 1rem;
+ text-align: center;
+ }
+
+ header h1 {
+ font-size: 2.5rem;
+ margin-bottom: 0.5rem;
+ background: linear-gradient(135deg, #00d9ff, #7c3aed);
+ background-clip: text;
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ }
+
+ header p {
+ font-size: 1rem;
+ color: #a0a0a0;
+ }
+
+ .container {
+ max-width: 1400px;
+ margin: 2rem auto;
+ padding: 0 1rem;
+ }
+
+ .controls {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 1rem;
+ margin-bottom: 2rem;
+ align-items: center;
+ }
+
+ .search-box {
+ flex: 1;
+ min-width: 250px;
+ padding: 0.75rem 1rem;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+ color: #e0e0e0;
+ font-size: 1rem;
+ }
+
+ .search-box::placeholder {
+ color: #666;
+ }
+
+ .search-box:focus {
+ outline: none;
+ border-color: #00d9ff;
+ background: rgba(0, 217, 255, 0.05);
+ }
+
+ .filter-group {
+ display: flex;
+ gap: 0.5rem;
+ flex-wrap: wrap;
+ }
+
+ .filter-label {
+ font-size: 0.85rem;
+ font-weight: 600;
+ text-transform: uppercase;
+ color: #999;
+ align-self: center;
+ }
+
+ .filter-chip {
+ padding: 0.5rem 1rem;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 20px;
+ cursor: pointer;
+ font-size: 0.9rem;
+ color: #a0a0a0;
+ transition: all 0.2s ease;
+ }
+
+ .filter-chip:hover {
+ background: rgba(255, 255, 255, 0.1);
+ }
+
+ .filter-chip.active {
+ background: linear-gradient(135deg, #00d9ff, #7c3aed);
+ border-color: transparent;
+ color: #fff;
+ font-weight: 600;
+ }
+
+ .sort-select {
+ padding: 0.5rem 1rem;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+ color: #e0e0e0;
+ cursor: pointer;
+ font-size: 0.9rem;
+ }
+
+ .sort-select:focus {
+ outline: none;
+ border-color: #00d9ff;
+ }
+
+ .sort-select option {
+ background: #0f0f23;
+ color: #e0e0e0;
+ }
+
+ .agent-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
+ gap: 1.5rem;
+ margin-bottom: 2rem;
+ }
+
+ .agent-card {
+ background: rgba(255, 255, 255, 0.03);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 12px;
+ overflow: hidden;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ display: flex;
+ flex-direction: column;
+ }
+
+ .agent-card:hover {
+ border-color: rgba(0, 217, 255, 0.5);
+ background: rgba(0, 217, 255, 0.05);
+ transform: translateY(-4px);
+ box-shadow: 0 8px 24px rgba(0, 217, 255, 0.15);
+ }
+
+ .card-avatar {
+ width: 100%;
+ aspect-ratio: 1;
+ background: rgba(255, 255, 255, 0.02);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ overflow: hidden;
+ }
+
+ .card-avatar img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+
+ .avatar-placeholder {
+ font-size: 3rem;
+ opacity: 0.3;
+ }
+
+ .card-content {
+ padding: 1.25rem;
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ }
+
+ .card-name {
+ font-size: 1.1rem;
+ font-weight: 600;
+ margin-bottom: 0.5rem;
+ color: #fff;
+ line-height: 1.3;
+ }
+
+ .card-desc {
+ font-size: 0.85rem;
+ color: #a0a0a0;
+ margin-bottom: 1rem;
+ line-height: 1.4;
+ flex: 1;
+ }
+
+ .card-meta {
+ display: flex;
+ gap: 0.5rem;
+ flex-wrap: wrap;
+ font-size: 0.75rem;
+ }
+
+ .chain-badge {
+ background: rgba(124, 58, 237, 0.2);
+ border: 1px solid rgba(124, 58, 237, 0.5);
+ padding: 0.3rem 0.6rem;
+ border-radius: 4px;
+ color: #c4b5fd;
+ }
+
+ .agent-id {
+ background: rgba(0, 217, 255, 0.1);
+ border: 1px solid rgba(0, 217, 255, 0.3);
+ padding: 0.3rem 0.6rem;
+ border-radius: 4px;
+ color: #00d9ff;
+ font-family: 'Monaco', 'Courier New', monospace;
+ }
+
+ .empty-state {
+ text-align: center;
+ padding: 4rem 2rem;
+ }
+
+ .empty-state h2 {
+ font-size: 1.5rem;
+ margin-bottom: 1rem;
+ color: #fff;
+ }
+
+ .empty-state p {
+ font-size: 1rem;
+ color: #a0a0a0;
+ margin-bottom: 2rem;
+ }
+
+ .cta-button {
+ padding: 0.75rem 1.5rem;
+ background: linear-gradient(135deg, #00d9ff, #7c3aed);
+ border: none;
+ border-radius: 8px;
+ color: #fff;
+ font-weight: 600;
+ cursor: pointer;
+ transition: all 0.2s ease;
+ text-decoration: none;
+ display: inline-block;
+ }
+
+ .cta-button:hover {
+ transform: scale(1.05);
+ box-shadow: 0 8px 24px rgba(0, 217, 255, 0.3);
+ }
+
+ .pagination {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: 1rem;
+ margin-top: 2rem;
+ padding: 2rem;
+ flex-wrap: wrap;
+ }
+
+ .pagination-button {
+ padding: 0.5rem 1rem;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+ color: #e0e0e0;
+ cursor: pointer;
+ transition: all 0.2s ease;
+ }
+
+ .pagination-button:hover:not(:disabled) {
+ background: rgba(0, 217, 255, 0.1);
+ border-color: #00d9ff;
+ color: #00d9ff;
+ }
+
+ .pagination-button:disabled {
+ opacity: 0.3;
+ cursor: not-allowed;
+ }
+
+ .pagination-info {
+ color: #a0a0a0;
+ font-size: 0.9rem;
+ }
+
+ .loading {
+ text-align: center;
+ padding: 2rem;
+ color: #a0a0a0;
+ }
+
+ .loading::after {
+ content: '';
+ display: inline-block;
+ margin-left: 0.5rem;
+ width: 1rem;
+ height: 1rem;
+ border: 2px solid rgba(0, 217, 255, 0.3);
+ border-top-color: #00d9ff;
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
+ }
+
+ @keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
+ @media (max-width: 768px) {
+ header h1 {
+ font-size: 1.75rem;
+ }
+
+ .controls {
+ flex-direction: column;
+ }
+
+ .search-box {
+ min-width: 100%;
+ }
+
+ .agent-grid {
+ grid-template-columns: 1fr;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <h1>Agent Directory</h1>
+ <p>Discover registered agents across the ecosystem</p>
+ </header>
+
+ <div class="container">
+ <div class="controls">
+ <input
+ type="text"
+ id="search"
+ class="search-box"
+ placeholder="Search by name, ID, or description…"
+ />
+ <div class="filter-group">
+ <span class="filter-label">Chain:</span>
+ <button class="filter-chip active" data-filter="all">All</button>
+ <button class="filter-chip" data-filter="8453">Base</button>
+ <button class="filter-chip" data-filter="84532">Base Sepolia</button>
+ <button class="filter-chip" data-filter="10">Optimism</button>
+ <button class="filter-chip" data-filter="137">Polygon</button>
+ </div>
+ <select id="sort" class="sort-select">
+ <option value="newest">Newest First</option>
+ <option value="oldest">Oldest First</option>
+ <option value="name">Alphabetical</option>
+ </select>
+ </div>
+
+ <div id="loading" class="loading" style="display: none">Loading agents</div>
+ <div id="agents" class="agent-grid"></div>
+
+ <div id="empty-state" class="empty-state" style="display: none">
+ <h2>No agents found</h2>
+ <p>Be the first to register your agent on-chain.</p>
+ <a href="/create" class="cta-button">Create Agent</a>
+ </div>
+
+ <div id="pagination" class="pagination" style="display: none">
+ <button id="prev-btn" class="pagination-button">← Previous</button>
+ <span id="page-info" class="pagination-info"></span>
+ <button id="next-btn" class="pagination-button">Next →</button>
+ </div>
+ </div>
+
+ <script type="module" src="./boot.js"></script>
+ </body>
+</html>
diff --git a/dist-lib/artifact/README.md b/dist-lib/artifact/README.md
new file mode 100644
index 000000000..b72a7ee94
--- /dev/null
+++ b/dist-lib/artifact/README.md
@@ -0,0 +1,30 @@
+# Citing a 3D Agent artifact in Claude.ai
+
+`GET https://3dagent.vercel.app/api/artifact?agent=<agentId>`
+
+Paste the URL into a Claude.ai conversation. Claude recognises it as an HTML artifact and renders the interactive 3D agent inline.
+
+## Worked example
+
+```
+Here's my agent for this conversation:
+https://3dagent.vercel.app/api/artifact?agent=alice
+```
+
+Claude will embed the artifact and display the live 3D character.
+
+## Parameters
+
+| Param | Description |
+|---|---|
+| `agent` | Agent ID (required unless `model` is set) |
+| `model` | Absolute `https://` URL to a GLB from a whitelisted CDN |
+| `theme` | `dark` (default) or `light` |
+| `idle` | Animation clip name to play while idle |
+| `bg` | Background hex colour (without `#`), e.g. `bg=1a0533` |
+
+## Notes
+
+- The document returned is a single self-contained HTML page — no external requests except the UMD bundle and your agent's GLB asset.
+- `frame-ancestors *` is set in the CSP so Claude.ai's sandboxed iframe can render it.
+- Rate-limited at 600 req/min per IP (shared with widget reads).
diff --git a/dist-lib/artifact/index.html b/dist-lib/artifact/index.html
new file mode 100644
index 000000000..95a0a2d8c
--- /dev/null
+++ b/dist-lib/artifact/index.html
@@ -0,0 +1,177 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>3D Agent Artifact Demo</title>
+ <style>
+ * {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ }
+
+ body {
+ font-family: system-ui, -apple-system, sans-serif;
+ background: #0a0e27;
+ color: #fff;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ min-height: 100vh;
+ padding: 20px;
+ }
+
+ .container {
+ max-width: 800px;
+ width: 100%;
+ }
+
+ h1 {
+ text-align: center;
+ margin-bottom: 20px;
+ font-size: 28px;
+ }
+
+ .info {
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+ padding: 16px;
+ margin-bottom: 20px;
+ font-size: 14px;
+ line-height: 1.6;
+ }
+
+ .viewer-frame {
+ background: #000;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+ overflow: hidden;
+ aspect-ratio: 16 / 9;
+ margin-bottom: 20px;
+ }
+
+ #agent3d {
+ width: 100%;
+ height: 100%;
+ }
+
+ .controls {
+ display: flex;
+ gap: 10px;
+ flex-wrap: wrap;
+ justify-content: center;
+ }
+
+ button {
+ background: rgba(59, 130, 246, 0.8);
+ border: none;
+ color: #fff;
+ padding: 10px 20px;
+ border-radius: 6px;
+ cursor: pointer;
+ font-size: 14px;
+ transition: background 0.2s;
+ }
+
+ button:hover {
+ background: rgba(59, 130, 246, 1);
+ }
+
+ button:active {
+ transform: scale(0.98);
+ }
+
+ .input-group {
+ display: flex;
+ gap: 10px;
+ align-items: center;
+ margin-bottom: 10px;
+ }
+
+ input {
+ background: rgba(255, 255, 255, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ color: #fff;
+ padding: 8px 12px;
+ border-radius: 4px;
+ flex: 1;
+ }
+
+ input::placeholder {
+ color: rgba(255, 255, 255, 0.5);
+ }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <h1>3D Agent Artifact Viewer</h1>
+
+ <div class="info">
+ <p>
+ This demo shows how a 3D Agent renders inside a Claude Artifact. The bundle is
+ self-contained — no external dependencies or iframes.
+ </p>
+ </div>
+
+ <div class="input-group">
+ <input
+ type="text"
+ id="agentIdInput"
+ placeholder="Enter agent ID (e.g., from URL ?agentId=123)"
+ value=""
+ />
+ <button onclick="loadAgent()">Load</button>
+ </div>
+
+ <div class="viewer-frame">
+ <div id="agent3d" data-origin="https://3dagent.vercel.app"></div>
+ </div>
+
+ <div class="controls">
+ <button onclick="reloadAgent()">Reload</button>
+ </div>
+ </div>
+
+ <!-- The artifact bundle -->
+ <script src="artifact.js"></script>
+
+ <script>
+ function getAgentIdFromUrl() {
+ const params = new URLSearchParams(window.location.search);
+ return params.get('agentId') || localStorage.getItem('demo-agentId');
+ }
+
+ function loadAgent() {
+ const input = document.getElementById('agentIdInput');
+ const agentId = input.value.trim();
+
+ if (!agentId) {
+ alert('Please enter an agent ID');
+ return;
+ }
+
+ localStorage.setItem('demo-agentId', agentId);
+ const container = document.getElementById('agent3d');
+ container.dataset.agentId = agentId;
+
+ location.reload();
+ }
+
+ function reloadAgent() {
+ location.reload();
+ }
+
+ window.addEventListener('DOMContentLoaded', () => {
+ const agentId = getAgentIdFromUrl();
+ if (agentId) {
+ const container = document.getElementById('agent3d');
+ container.dataset.agentId = agentId;
+ document.getElementById('agentIdInput').value = agentId;
+ }
+ });
+ </script>
+ </body>
+</html>
diff --git a/dist-lib/artifact/snippet.html b/dist-lib/artifact/snippet.html
new file mode 100644
index 000000000..6a4e61bca
--- /dev/null
+++ b/dist-lib/artifact/snippet.html
@@ -0,0 +1,12 @@
+<!-- Paste this into a Claude Artifact to embed a 3D Agent -->
+<script src="https://3dagent.vercel.app/artifact.js"></script>
+
+<div id="agent3d" data-agent-id="your-agent-id-here" data-origin="https://3dagent.vercel.app"></div>
+
+<style>
+ #agent3d {
+ width: 100%;
+ height: 500px;
+ display: block;
+ }
+</style>
diff --git a/dist-lib/cz/README.md b/dist-lib/cz/README.md
new file mode 100644
index 000000000..7719d6556
--- /dev/null
+++ b/dist-lib/cz/README.md
@@ -0,0 +1,131 @@
+# CZ Demo — Landing & Claim Flow
+
+The CZ landing page is served at `/cz/` and provides:
+
+- Full-bleed dark landing page with centered 3D agent avatar
+- **Claim CZ** button — initiates wallet connection and claim flow
+- **Copy embed** button — copies `<agent-3d>` snippet to clipboard
+- Footer — displays on-chain state (chain, agentId, metadataURI)
+- Custom event analytics via `window.dispatchEvent('cz-demo-event', ...)`
+
+## Files
+
+- `index.html` — Main landing page
+- `boot.js` — Client-side initialization and claim flow UI
+- `state.json` — On-chain state stub (updated by `prompts/cz-demo/01-pre-register.js`)
+
+## State Schema
+
+`state.json` is a JSON file with this shape:
+
+```json
+{
+ "status": "pre-onchain" | "onchain",
+ "chainId": null | number,
+ "agentId": null | number,
+ "metadataURI": null | string,
+ "ownerAddress": null | "0x0..." | string,
+ "avatarUrl": "/avatars/cz.glb" | string
+}
+```
+
+**Fields:**
+
+- `status` — `"pre-onchain"` (not yet registered) or `"onchain"` (registered)
+- `chainId` — Chain ID (e.g., `8453` for Base, `84532` for Base Sepolia), or `null`
+- `agentId` — Token ID from IdentityRegistry, or `null`
+- `metadataURI` — IPFS/HTTPS URL of the full registration JSON, or `null`
+- `ownerAddress` — Current owner address, `"0x0..."` (unclaimed), or `null`
+- `avatarUrl` — GLB URL (default `/avatars/cz.glb`)
+
+The landing page footer displays the state. In `pre-onchain`, it shows "Not yet onchain".
+
+## Claim Flow
+
+The `startClaim()` function in `src/cz-flow.js` handles:
+
+1. **Pre-onchain** — Shows modal: "Claim opens when CZ is registered"
+2. **Unclaimed** (`ownerAddress === "0x0..."`): Calls `IdentityRegistry.claim(agentId)`
+3. **Demo EOA transfer**: Guides user through `transferOwner()`
+4. **Already owned**: Shows modal with current owner
+
+All steps emit progress via `onProgress({ step, status, txHash?, error? })` and fire custom events:
+
+- `landing_view` — Page loaded
+- `claim_start` — Claim button clicked
+- `claim_wallet_connected` — Wallet connected (implicit in flow)
+- `claim_tx_sent` — Transaction sent
+- `claim_complete` — Claim successful
+- `claim_error` — Error occurred
+- `embed_copied` — Embed snippet copied
+
+Listen for these on `window`:
+
+```js
+window.addEventListener('cz-demo-event', (e) => {
+ console.log(e.detail.event, e.detail.props);
+});
+```
+
+## Routing
+
+The page is served at `/cz/` by the Vite dev server and Vercel (`public/cz/` → `/cz/`).
+
+To add `/cz` (without trailing slash) or a custom route, edit:
+
+- **Local dev**: `vite.config.js` — `vercel-rewrites` plugin
+- **Production**: `vercel.json` — `rewrites` array
+
+Example for `vercel.json`:
+
+```json
+{
+ "rewrites": [
+ { "source": "/cz", "destination": "/cz/" }
+ ]
+}
+```
+
+Then run `npm run deploy` to push changes.
+
+## Integration with `prompts/cz-demo/01-pre-register.js`
+
+When the onchain pre-registration is ready, that script will:
+
+1. Deploy / verify the ERC-8004 IdentityRegistry if needed
+2. Call `register()` with the GLB and metadata
+3. Write an updated `public/cz/state.json` with real `chainId`, `agentId`, `metadataURI`, `ownerAddress`
+
+The landing page will automatically reflect this state on next load.
+
+## Accessibility
+
+- Semantic `<h1>` for the headline
+- `aria-label` on all buttons
+- Focus rings visible (2px outline with 2px offset)
+- Reduced motion support (`prefers-reduced-motion`)
+- Modal keyboard-escapable
+
+## Testing
+
+```bash
+npm run dev
+# Open http://localhost:3000/cz/
+
+# Should show:
+# - Avatar loading from /avatars/cz.glb
+# - "Claim CZ" button clickable
+# - "Copy embed" button copies snippet to clipboard
+# - Footer shows "Not yet onchain"
+```
+
+Test the claim flow:
+
+```js
+// Open browser console on /cz/
+window.addEventListener('cz-demo-event', (e) => {
+ console.log('CZ demo event:', e.detail);
+});
+
+// Click "Claim CZ" → follow wallet prompts
+```
diff --git a/dist-lib/cz/boot.js b/dist-lib/cz/boot.js
new file mode 100644
index 000000000..e9a3824c9
--- /dev/null
+++ b/dist-lib/cz/boot.js
@@ -0,0 +1,188 @@
+/**
+ * CZ landing page initialization — loads state, wires up CTAs, handles claim flow.
+ */
+
+import { startClaim, mountEmbedCopy, fireAnalytics } from '../../src/cz-flow.js';
+
+async function init() {
+ // Load state
+ let state = {
+ status: 'pre-onchain',
+ chainId: null,
+ agentId: null,
+ metadataURI: null,
+ ownerAddress: null,
+ avatarUrl: '/avatars/cz.glb',
+ };
+
+ try {
+ const res = await fetch('./state.json');
+ if (res.ok) {
+ state = await res.json();
+ }
+ } catch (err) {
+ console.warn('Failed to load state.json:', err);
+ }
+
+ // Update footer with state
+ updateFooter(state);
+
+ // Wire up claim button
+ const claimBtn = document.getElementById('cz-claim-btn');
+ if (claimBtn) {
+ claimBtn.addEventListener('click', () => handleClaimClick(state));
+ }
+
+ // Wire up embed copy
+ const embedContainer = document.getElementById('cz-embed-container');
+ if (embedContainer) {
+ mountEmbedCopy(embedContainer, { state });
+ }
+
+ // Fire landing view event
+ fireAnalytics('landing_view', { status: state.status });
+}
+
+function updateFooter(state) {
+ const footer = document.getElementById('cz-footer');
+ if (!footer) return;
+
+ if (state.status === 'pre-onchain') {
+ footer.innerHTML = `
+ <p>Not yet onchain</p>
+ `;
+ } else {
+ const chainName = getChainName(state.chainId);
+ footer.innerHTML = `
+ <p><strong>Chain:</strong> ${chainName}</p>
+ <p><strong>Agent ID:</strong> ${state.agentId}</p>
+ ${state.metadataURI ? `<p><strong>Metadata:</strong> <code>${truncate(state.metadataURI, 40)}</code></p>` : ''}
+ `;
+ }
+}
+
+function getChainName(chainId) {
+ const chains = {
+ 1: 'Ethereum',
+ 8453: 'Base',
+ 84532: 'Base Sepolia',
+ };
+ return chains[chainId] || `Chain ${chainId}`;
+}
+
+function truncate(str, len) {
+ return str.length > len ? str.slice(0, len - 3) + '…' : str;
+}
+
+async function handleClaimClick(state) {
+ const claimBtn = document.getElementById('cz-claim-btn');
+ const modal = document.getElementById('cz-claim-modal');
+
+ if (!modal) return;
+
+ fireAnalytics('claim_start', {});
+
+ // Show modal with spinner
+ modal.style.display = 'flex';
+ const content = document.getElementById('cz-modal-content');
+ const closeBtn = document.getElementById('cz-modal-close');
+
+ content.innerHTML = `
+ <div class="modal-spinner"></div>
+ <p>Initializing claim flow…</p>
+ `;
+
+ closeBtn.addEventListener('click', () => {
+ modal.style.display = 'none';
+ });
+
+ modal.addEventListener('click', (e) => {
+ if (e.target === modal) modal.style.display = 'none';
+ });
+
+ // Run claim flow
+ const result = await startClaim({
+ state,
+ onProgress: (progress) => {
+ updateModal(progress, state);
+ },
+ });
+
+ if (result.ok) {
+ if (result.message === 'pre_onchain') {
+ content.innerHTML = `
+ <h3 style="margin:0 0 1rem">Coming Soon</h3>
+ <p>CZ is not yet registered on-chain. Claiming opens once the registration is complete.</p>
+ <button class="modal-close-btn" onclick="document.getElementById('cz-claim-modal').style.display='none'">OK</button>
+ `;
+ } else if (result.message === 'already_owned') {
+ content.innerHTML = `
+ <h3 style="margin:0 0 1rem">Already Claimed</h3>
+ <p>This agent is already owned by <code>${truncate(state.ownerAddress, 20)}</code>.</p>
+ <button class="modal-close-btn" onclick="document.getElementById('cz-claim-modal').style.display='none'">OK</button>
+ `;
+ } else if (result.message === 'transfer_available') {
+ content.innerHTML = `
+ <h3 style="margin:0 0 1rem">Transfer Ownership</h3>
+ <p>This agent can be transferred to your wallet. Follow the prompts to continue.</p>
+ <button class="modal-close-btn" onclick="document.getElementById('cz-claim-modal').style.display='none'">OK</button>
+ `;
+ } else {
+ content.innerHTML = `
+ <h3 style="margin:0 0 1rem">Claim Successful</h3>
+ <p>Transaction: <code>${result.txHash}</code></p>
+ <button class="modal-close-btn" onclick="document.getElementById('cz-claim-modal').style.display='none'">OK</button>
+ `;
+ }
+ } else {
+ content.innerHTML = `
+ <h3 style="margin:0 0 1rem">Error</h3>
+ <p>${result.error}</p>
+ <button class="modal-close-btn" onclick="document.getElementById('cz-claim-modal').style.display='none'">Dismiss</button>
+ `;
+ }
+}
+
+function updateModal(progress, state) {
+ const content = document.getElementById('cz-modal-content');
+ const { step, status, error } = progress;
+
+ if (error) {
+ content.innerHTML = `
+ <h3 style="margin:0 0 1rem">Error</h3>
+ <p>${error}</p>
+ `;
+ return;
+ }
+
+ const messages = {
+ connect_wallet: {
+ connecting: 'Connecting wallet…',
+ connected: `Connected: ${progress.address?.slice(0, 10)}…`,
+ },
+ check_state: {
+ pre_onchain: 'Checking agent status…',
+ },
+ claim: {
+ submitting: 'Submitting claim…',
+ pending: 'Waiting for confirmation…',
+ confirmed: 'Claim confirmed!',
+ already_owned: 'Already owned.',
+ },
+ transfer: {
+ guide: 'Transfer available. Approve in your wallet…',
+ },
+ };
+
+ const msg = messages[step]?.[status] || `${step}: ${status}`;
+ content.innerHTML = `
+ <div class="modal-spinner"></div>
+ <p>${msg}</p>
+ `;
+}
+
+if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', init);
+} else {
+ init();
+}
diff --git a/dist-lib/cz/index.html b/dist-lib/cz/index.html
new file mode 100644
index 000000000..38d649ee6
--- /dev/null
+++ b/dist-lib/cz/index.html
@@ -0,0 +1,321 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>Claim CZ · 3D Agent</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="description" content="Meet CZ — an embodied 3D AI agent." />
+ <meta name="theme-color" content="#000000" />
+ <link rel="icon" href="/favicon.ico" />
+ <style>
+ :root {
+ color-scheme: dark;
+ --accent: #6a5cff;
+ --accent2: #ff5ca8;
+ }
+
+ * {
+ box-sizing: border-box;
+ }
+
+ body {
+ font: 15px / 1.5 -apple-system, system-ui, Segoe UI, Roboto, sans-serif;
+ background: radial-gradient(1200px 600px at 50% -100px, #1a1a2e 0, #080814 60%);
+ color: #eee;
+ margin: 0;
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 24px;
+ }
+
+ .cz-hero {
+ width: 100%;
+ max-width: 600px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 2rem;
+ }
+
+ .cz-avatar-container {
+ width: 100%;
+ max-width: 400px;
+ aspect-ratio: 1;
+ border-radius: 12px;
+ overflow: hidden;
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
+ }
+
+ agent-3d {
+ width: 100%;
+ height: 100%;
+ }
+
+ .cz-content {
+ text-align: center;
+ width: 100%;
+ }
+
+ h1 {
+ font-size: 2.5rem;
+ margin: 0 0 0.5rem;
+ letter-spacing: -0.02em;
+ font-weight: 300;
+ }
+
+ .cz-subhead {
+ font-size: 1.1rem;
+ color: rgba(255, 255, 255, 0.6);
+ margin: 0 0 2rem;
+ line-height: 1.6;
+ }
+
+ .cz-cta-group {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ width: 100%;
+ }
+
+ button {
+ padding: 14px 24px;
+ border: none;
+ border-radius: 10px;
+ font-size: 15px;
+ font-weight: 600;
+ cursor: pointer;
+ transition: all 0.2s ease;
+ }
+
+ #cz-claim-btn {
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
+ color: #fff;
+ }
+
+ #cz-claim-btn:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 8px 24px rgba(106, 92, 255, 0.3);
+ }
+
+ #cz-claim-btn:focus {
+ outline: 2px solid var(--accent);
+ outline-offset: 2px;
+ }
+
+ #cz-claim-btn:active {
+ transform: translateY(0);
+ }
+
+ #cz-embed-container {
+ display: flex;
+ }
+
+ #cz-embed-copy {
+ background: rgba(255, 255, 255, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ color: #eee;
+ width: 100%;
+ }
+
+ #cz-embed-copy:hover {
+ background: rgba(255, 255, 255, 0.15);
+ border-color: rgba(255, 255, 255, 0.3);
+ }
+
+ #cz-embed-copy:focus {
+ outline: 2px solid var(--accent);
+ outline-offset: 2px;
+ }
+
+ .cz-footer {
+ margin-top: 3rem;
+ padding-top: 2rem;
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
+ font-size: 0.875rem;
+ color: rgba(255, 255, 255, 0.5);
+ width: 100%;
+ text-align: center;
+ }
+
+ .cz-footer p {
+ margin: 0.5rem 0;
+ }
+
+ .cz-footer code {
+ background: rgba(255, 255, 255, 0.05);
+ padding: 2px 6px;
+ border-radius: 4px;
+ font-family: 'Courier New', monospace;
+ font-size: 0.8rem;
+ color: rgba(255, 255, 255, 0.7);
+ }
+
+ /* Modal */
+ #cz-claim-modal {
+ display: none;
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.7);
+ z-index: 2000;
+ align-items: center;
+ justify-content: center;
+ padding: 24px;
+ }
+
+ .cz-modal-dialog {
+ background: #14141c;
+ border: 1px solid #2a2a36;
+ border-radius: 16px;
+ padding: 32px;
+ max-width: 420px;
+ width: 100%;
+ position: relative;
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
+ }
+
+ #cz-modal-close {
+ position: absolute;
+ top: 16px;
+ right: 16px;
+ background: none;
+ border: none;
+ color: rgba(255, 255, 255, 0.5);
+ cursor: pointer;
+ padding: 8px;
+ font-size: 1.5rem;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ #cz-modal-close:hover {
+ color: rgba(255, 255, 255, 0.8);
+ }
+
+ #cz-modal-content {
+ text-align: center;
+ min-height: 100px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ }
+
+ #cz-modal-content h3 {
+ font-size: 1.2rem;
+ font-weight: 600;
+ }
+
+ #cz-modal-content p {
+ color: rgba(255, 255, 255, 0.7);
+ margin: 0.5rem 0;
+ line-height: 1.5;
+ }
+
+ #cz-modal-content code {
+ background: rgba(255, 255, 255, 0.05);
+ padding: 4px 8px;
+ border-radius: 4px;
+ font-family: 'Courier New', monospace;
+ font-size: 0.85rem;
+ color: rgba(255, 255, 255, 0.8);
+ word-break: break-all;
+ }
+
+ .modal-spinner {
+ width: 40px;
+ height: 40px;
+ border: 3px solid rgba(106, 92, 255, 0.2);
+ border-top-color: var(--accent);
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
+ margin-bottom: 1rem;
+ }
+
+ @keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
+ .modal-close-btn {
+ margin-top: 1.5rem;
+ width: 100%;
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
+ color: #fff;
+ }
+
+ .modal-close-btn:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 8px 24px rgba(106, 92, 255, 0.3);
+ }
+
+ /* Responsive */
+ @media (max-width: 640px) {
+ h1 {
+ font-size: 2rem;
+ }
+
+ .cz-hero {
+ gap: 1.5rem;
+ }
+
+ .cz-avatar-container {
+ max-width: 100%;
+ }
+ }
+
+ /* Reduced motion */
+ @media (prefers-reduced-motion: reduce) {
+ button {
+ transition: none;
+ }
+
+ .modal-spinner {
+ animation: none;
+ border-top-color: var(--accent);
+ }
+ }
+ </style>
+</head>
+<body>
+ <div class="cz-hero">
+ <div class="cz-avatar-container">
+ <agent-3d src="/avatars/cz.glb" eager></agent-3d>
+ </div>
+
+ <div class="cz-content">
+ <h1>Meet CZ</h1>
+ <p class="cz-subhead">An embodied 3D AI agent built for the Ethereum ecosystem.</p>
+
+ <div class="cz-cta-group">
+ <button id="cz-claim-btn" aria-label="Claim CZ agent ownership">Claim CZ</button>
+ <div id="cz-embed-container"></div>
+ </div>
+ </div>
+
+ <div class="cz-footer" id="cz-footer">
+ <p>Not yet onchain</p>
+ </div>
+ </div>
+
+ <!-- Claim Modal -->
+ <div id="cz-claim-modal">
+ <div class="cz-modal-dialog">
+ <button id="cz-modal-close" aria-label="Close claim dialog">×</button>
+ <div id="cz-modal-content">
+ <div class="modal-spinner"></div>
+ <p>Loading…</p>
+ </div>
+ </div>
+ </div>
+
+ <script type="module" src="./boot.js"></script>
+</body>
+</html>
diff --git a/dist-lib/cz/offline/README.md b/dist-lib/cz/offline/README.md
new file mode 100644
index 000000000..103548d5e
--- /dev/null
+++ b/dist-lib/cz/offline/README.md
@@ -0,0 +1,206 @@
+# CZ Offline Fallback Demo
+
+This directory contains the offline fallback for the CZ demo — a self-contained, zero-network-dependency copy of the demo that the operator can display if live internet fails during the event.
+
+## Overview
+
+**Purpose:** Keep the demo running when the internet dies, RPC node is down, or the staging server is unreachable.
+
+**File:** `index.html` — standalone HTML page with embedded assets.
+
+**Network:** Zero external dependencies after initial page load. Avatar and state are served from origin only.
+
+**Usage:** Open `https://3dagent.vercel.app/cz/offline/` in a browser, or `http://localhost:3000/cz/offline/` for local dev.
+
+---
+
+## How It Works
+
+### Avatar Loading
+- Tries to load `/avatars/cz.glb` from the origin (served from `public/avatars/cz.glb`)
+- If available, renders with Three.js (if loaded on the page)
+- If unavailable or WebGL fails, falls back to a canvas-drawn placeholder
+- **No external CDN calls; no IPFS gateway requests**
+
+### Claim Flow
+- User clicks "Claim Agent" button
+- Modal plays a simulated claim sequence:
+ 1. "Initializing claim flow…" (800ms)
+ 2. "Connecting wallet…" (800ms)
+ 3. "Submitting claim…" (800ms)
+ 4. "Waiting for confirmation…" (800ms)
+ 5. "Claim Successful!" + confetti (no delay)
+- **No blockchain calls; no MetaMask interaction**
+- No transaction is actually submitted; this is purely visual
+
+### State Display
+- Footer shows static values:
+ - Agent ID: `0x1234567` (placeholder)
+ - Chain: `Base Sepolia`
+ - Owner: Not displayed (since no real onchain state)
+- **All values are hardcoded; no API calls**
+
+### Cache & Service Worker
+- Page registers a service worker at `/cz/sw.js` (if available)
+- If the page is cached, it loads instantly even if origin is unreachable
+- Service worker is optional; page works without it
+
+---
+
+## Testing the Offline Fallback
+
+### Test 1: Network Throttling
+```bash
+# Open DevTools → Network tab
+# Set throttling to "Offline"
+# Reload the page
+# Avatar and claim flow should still work
+```
+
+### Test 2: Hard Offline (Kill WiFi)
+```bash
+# Open /cz/offline/ in a browser
+# Physically unplug ethernet or disable WiFi
+# Page should still display avatar and respond to clicks
+```
+
+### Test 3: Origin Unreachable
+```bash
+# Open /cz/offline/ normally
+# Block the origin in DevTools (DevTools → Network → Disable)
+# Reload page (from browser cache)
+# Fallback image and claim flow work
+```
+
+### Test 4: Timing (Dry Run)
+```bash
+# Open /cz/offline/
+# Click "Claim Agent" button
+# Observe:
+# - First modal appears at 0ms: "Initializing…"
+# - Second modal at 800ms: "Connecting…"
+# - Confetti at 3200ms
+# Total: ~4 seconds from click to success
+```
+
+---
+
+## Integration with Live Demo
+
+### When to Switch to Offline
+- Avatar fails to load for > 30 seconds
+- RPC node is down or extremely congested (claim stuck > 2 minutes)
+- Entire staging server is unreachable (502/503)
+- WiFi drops mid-demo
+
+### How to Switch
+1. **In the browser:** Open a new tab or window to `/cz/offline/`
+2. **Say to audience:** "We're in offline mode now, but the agent is fully cached and ready."
+3. **Run the demo:** Same 9-step sequence, but the claim is instant (no real tx)
+4. **Be honest:** If asked, say "This is a pre-rendered demo version—on mainnet, this would be live."
+
+### Before/After Behavior
+| Aspect | Live (`/cz`) | Offline (`/cz/offline/`) |
+|---|---|---|
+| Avatar | Loaded from `/avatars/cz.glb` (live) | Loaded from `/avatars/cz.glb` (cached) or fallback image |
+| Claim TX | Real signature + submit to RPC | Fake modal, no tx |
+| State | From `/api/cz/identity` (live API) | Hardcoded placeholder |
+| Claim Time | 30–60 seconds | ~4 seconds |
+| Network | Requires live staging + RPC | Zero external calls |
+
+---
+
+## Customization
+
+### Change Hardcoded Values
+In `index.html`, search for these and update:
+```javascript
+Agent ID: 0x1234567 // Change to real agentId
+Chain: Base Sepolia // Keep or update
+```
+
+### Change Claim Timing
+In `index.html`, `handleClaimClick()` function:
+```javascript
+setTimeout(() => { ... }, 800) // First modal at 800ms
+setTimeout(() => { ... }, 1600) // Second modal at 1600ms
+// etc.
+```
+
+### Change Colors / Styling
+In the `<style>` section:
+```css
+background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); /* bg color */
+background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* button color */
+```
+
+### Add a Real Screenshot Fallback
+If Three.js is unavailable, the fallback currently draws a placeholder on canvas. To add a real screenshot:
+1. Take a screenshot of the live demo (`/cz`) with avatar rendered
+2. Save as `fallback.png` in this directory
+3. Update `loadFallback()` in `index.html` to use the image:
+ ```javascript
+ fallback.src = '/cz/offline/fallback.png';
+ ```
+
+---
+
+## Limitations & Future Work
+
+### Current Limitations
+- Avatar rendering is a placeholder (no Three.js integration yet)
+- Claim flow is purely visual (no real blockchain state)
+- State values are hardcoded (no dynamic data from API)
+- Service worker (`/cz/sw.js`) is not yet implemented
+
+### Future Enhancements
+- [ ] Embed actual GLB file as base64 in HTML (self-contained binary)
+- [ ] Integrate Three.js for full 3D avatar rendering
+- [ ] Implement `/cz/sw.js` for offline caching
+- [ ] Parameterize agentId and chain from URL query params
+- [ ] Add pre-recorded video loop of agent interaction (if available)
+- [ ] Support keyboard controls (arrow keys for camera, Space to claim)
+
+---
+
+## Files
+
+- `index.html` — Main offline page (this is all you need)
+- `README.md` — This file
+
+---
+
+## Troubleshooting
+
+### Avatar shows as placeholder, not 3D
+- Check DevTools Console for errors
+- Verify `/avatars/cz.glb` is being loaded (Network tab)
+- Confirm Three.js is available (try `typeof THREE` in console)
+
+### Claim button doesn't respond
+- Check DevTools Console for JavaScript errors
+- Refresh the page
+- Try in incognito mode (clear cookies)
+
+### Service worker not registered
+- `/cz/sw.js` may not exist yet (that's ok; page still works)
+- Check DevTools → Application → Service Workers for status
+- This is optional for offline demo to work
+
+### Page is slow or jittery
+- Close other browser tabs (free up memory)
+- Disable browser extensions
+- Try a different browser (Chrome, Firefox, Safari, Edge)
+
+---
+
+## Contact / Issues
+
+If the offline fallback isn't working or needs updates, file an issue or reach out to the team.
+
+For live demo day:
+- **Backup operator:** Have a second laptop with offline page pre-loaded
+- **Screenshot:** Keep a static screenshot of the success state as a final fallback
+- **Notes:** Write down any issues encountered for post-mortem
+
+---
diff --git a/dist-lib/cz/offline/index.html b/dist-lib/cz/offline/index.html
new file mode 100644
index 000000000..d40525829
--- /dev/null
+++ b/dist-lib/cz/offline/index.html
@@ -0,0 +1,445 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>CZ Agent — Offline Demo</title>
+ <style>
+ * {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ }
+
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
+ color: #fff;
+ overflow: hidden;
+ height: 100vh;
+ }
+
+ .container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ height: 100vh;
+ position: relative;
+ }
+
+ .header {
+ position: absolute;
+ top: 24px;
+ left: 24px;
+ right: 24px;
+ z-index: 10;
+ }
+
+ .offline-badge {
+ display: inline-block;
+ background: rgba(255, 255, 255, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ padding: 8px 16px;
+ border-radius: 8px;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.5px;
+ text-transform: uppercase;
+ }
+
+ .badge-dot {
+ display: inline-block;
+ width: 6px;
+ height: 6px;
+ background: #fbbf24;
+ border-radius: 50%;
+ margin-right: 6px;
+ animation: pulse 2s infinite;
+ }
+
+ @keyframes pulse {
+ 0%, 100% {
+ opacity: 1;
+ }
+ 50% {
+ opacity: 0.5;
+ }
+ }
+
+ .avatar-container {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ }
+
+ #viewer {
+ width: 100%;
+ height: 100%;
+ }
+
+ .fallback-image {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: none;
+ }
+
+ .modal {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.6);
+ display: none;
+ align-items: center;
+ justify-content: center;
+ z-index: 100;
+ }
+
+ .modal.active {
+ display: flex;
+ }
+
+ .modal-content {
+ background: #16213e;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 12px;
+ padding: 40px;
+ max-width: 400px;
+ text-align: center;
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
+ }
+
+ .modal-content h2 {
+ font-size: 24px;
+ margin-bottom: 16px;
+ color: #fff;
+ }
+
+ .modal-content p {
+ font-size: 14px;
+ color: rgba(255, 255, 255, 0.7);
+ line-height: 1.6;
+ margin-bottom: 24px;
+ }
+
+ .button {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+ border: none;
+ padding: 12px 24px;
+ border-radius: 8px;
+ font-size: 14px;
+ font-weight: 600;
+ cursor: pointer;
+ transition: transform 0.2s, box-shadow 0.2s;
+ }
+
+ .button:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
+ }
+
+ .button:active {
+ transform: translateY(0);
+ }
+
+ .spinner {
+ width: 40px;
+ height: 40px;
+ border: 3px solid rgba(255, 255, 255, 0.1);
+ border-top-color: #667eea;
+ border-radius: 50%;
+ animation: spin 1s linear infinite;
+ margin: 0 auto 24px;
+ }
+
+ @keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
+ .footer {
+ position: absolute;
+ bottom: 24px;
+ left: 24px;
+ right: 24px;
+ font-size: 12px;
+ color: rgba(255, 255, 255, 0.5);
+ text-align: center;
+ }
+
+ .footer-item {
+ display: inline-block;
+ margin: 0 8px;
+ }
+
+ .code {
+ font-family: 'Monaco', 'Courier New', monospace;
+ background: rgba(255, 255, 255, 0.1);
+ padding: 2px 6px;
+ border-radius: 3px;
+ font-size: 11px;
+ }
+
+ .confetti {
+ position: fixed;
+ pointer-events: none;
+ }
+ </style>
+</head>
+<body>
+ <div class="header">
+ <div class="offline-badge">
+ <span class="badge-dot"></span>
+ Offline Demo Mode
+ </div>
+ </div>
+
+ <div class="container">
+ <div class="avatar-container">
+ <canvas id="viewer"></canvas>
+ <img id="fallback" class="fallback-image" alt="CZ Avatar" />
+ </div>
+ </div>
+
+ <div class="modal" id="modal">
+ <div class="modal-content">
+ <div id="modal-body"></div>
+ </div>
+ </div>
+
+ <div class="footer">
+ <div class="footer-item">CZ Agent</div>
+ <div class="footer-item">•</div>
+ <div class="footer-item">
+ Agent ID: <span class="code">0x1234567</span>
+ </div>
+ <div class="footer-item">•</div>
+ <div class="footer-item">
+ Chain: <span class="code">Base Sepolia</span>
+ </div>
+ </div>
+
+ <script>
+ // Offline demo mode: loads avatar GLB from origin, shows pre-rendered claim flow
+ // Falls back to static image if WebGL unavailable or network fails
+
+ const modal = document.getElementById('modal');
+ const modalBody = document.getElementById('modal-body');
+ const viewer = document.getElementById('viewer');
+ const fallback = document.getElementById('fallback');
+
+ // Initialize Three.js viewer (optional: gracefully degrade if not available)
+ // For now, we'll load the avatar and render it with a simple viewer
+ // If Three.js is not available, the fallback image will be shown
+
+ function showModal(html) {
+ modalBody.innerHTML = html;
+ modal.classList.add('active');
+ }
+
+ function hideModal() {
+ modal.classList.remove('active');
+ }
+
+ // Simulate claim flow
+ function handleClaimClick() {
+ showModal(`
+ <div class="spinner"></div>
+ <p>Initializing claim flow...</p>
+ `);
+
+ setTimeout(() => {
+ showModal(`
+ <div class="spinner"></div>
+ <p>Connecting wallet...</p>
+ `);
+ }, 800);
+
+ setTimeout(() => {
+ showModal(`
+ <div class="spinner"></div>
+ <p>Submitting claim...</p>
+ `);
+ }, 1600);
+
+ setTimeout(() => {
+ showModal(`
+ <div class="spinner"></div>
+ <p>Waiting for confirmation...</p>
+ `);
+ }, 2400);
+
+ setTimeout(() => {
+ playConfetti();
+ showModal(`
+ <h2>Claim Successful!</h2>
+ <p>Your agent is now registered on Base Sepolia.</p>
+ <p>Transaction: <span class="code">0xabc123…</span></p>
+ <button class="button" onclick="document.getElementById('modal').classList.remove('active')">Close</button>
+ `);
+ }, 3200);
+ }
+
+ // Confetti animation
+ function playConfetti() {
+ const count = 50;
+ for (let i = 0; i < count; i++) {
+ const confetti = document.createElement('div');
+ confetti.className = 'confetti';
+ confetti.style.left = Math.random() * 100 + '%';
+ confetti.style.top = '-10px';
+ confetti.style.backgroundColor = ['#667eea', '#764ba2', '#f093fb', '#4facfe'][Math.floor(Math.random() * 4)];
+ confetti.style.width = Math.random() * 10 + 5 + 'px';
+ confetti.style.height = confetti.style.width;
+ confetti.style.borderRadius = '50%';
+
+ document.body.appendChild(confetti);
+
+ const duration = Math.random() * 2 + 2; // 2-4 seconds
+ const keyframes = `
+ @keyframes fall-${i} {
+ to {
+ transform: translateY(${window.innerHeight + 20}px) rotate(720deg);
+ opacity: 0;
+ }
+ }
+ `;
+ const style = document.createElement('style');
+ style.textContent = keyframes;
+ document.head.appendChild(style);
+
+ confetti.style.animation = `fall-${i} ${duration}s ease-in forwards`;
+
+ setTimeout(() => confetti.remove(), duration * 1000);
+ }
+ }
+
+ // Try to load Three.js and render the avatar
+ async function initViewer() {
+ try {
+ // Check if Three.js is available
+ if (typeof THREE === 'undefined') {
+ console.warn('Three.js not available, using fallback image');
+ loadFallback();
+ return;
+ }
+
+ // Load GLB from origin
+ const glbUrl = '/avatars/cz.glb';
+ const response = await fetch(glbUrl);
+ if (!response.ok) {
+ console.warn(`Failed to load GLB: ${response.status}`, 'falling back to image');
+ loadFallback();
+ return;
+ }
+
+ // If we have Three.js and the GLB, render it
+ // This is a simplified viewer; full implementation would use three-std or similar
+ console.log('GLB loaded successfully, could render with Three.js');
+
+ // For now, just show a placeholder
+ viewer.style.background = 'radial-gradient(ellipse at center, #2d3d5c 0%, #1a1a2e 100%)';
+ const ctx = viewer.getContext('2d');
+ if (ctx) {
+ ctx.fillStyle = '#667eea';
+ ctx.font = '14px sans-serif';
+ ctx.textAlign = 'center';
+ ctx.fillText('CZ Avatar', viewer.width / 2, viewer.height / 2 - 10);
+ ctx.font = '12px sans-serif';
+ ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
+ ctx.fillText('(3D rendering requires Three.js)', viewer.width / 2, viewer.height / 2 + 20);
+ }
+ } catch (err) {
+ console.error('Avatar initialization error:', err);
+ loadFallback();
+ }
+ }
+
+ function loadFallback() {
+ // In production, this would be a pre-rendered screenshot of the avatar
+ // For now, just show a placeholder
+ fallback.style.display = 'block';
+ fallback.style.background = 'radial-gradient(ellipse at center, #2d3d5c 0%, #1a1a2e 100%)';
+
+ // Create a canvas fallback
+ const canvas = document.createElement('canvas');
+ canvas.width = window.innerWidth;
+ canvas.height = window.innerHeight;
+ const ctx = canvas.getContext('2d');
+ ctx.fillStyle = '#1a1a2e';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ ctx.fillStyle = '#667eea';
+ ctx.font = 'bold 48px sans-serif';
+ ctx.textAlign = 'center';
+ ctx.fillText('CZ', canvas.width / 2, canvas.height / 2);
+ ctx.font = '14px sans-serif';
+ ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
+ ctx.fillText('Offline Demo Mode', canvas.width / 2, canvas.height / 2 + 60);
+
+ fallback.src = canvas.toDataURL();
+ }
+
+ // Handle window resize
+ function handleResize() {
+ if (viewer) {
+ viewer.width = viewer.offsetWidth;
+ viewer.height = viewer.offsetHeight;
+ }
+ }
+
+ window.addEventListener('resize', handleResize);
+ handleResize();
+
+ // Create a claim button in the overlay
+ function createUI() {
+ const ui = document.createElement('div');
+ ui.style.position = 'fixed';
+ ui.style.bottom = '100px';
+ ui.style.left = '50%';
+ ui.style.transform = 'translateX(-50%)';
+ ui.style.zIndex = '50';
+ ui.innerHTML = `
+ <button class="button" style="font-size: 16px; padding: 16px 32px;" onclick="window.handleClaimClick()">
+ Claim Agent
+ </button>
+ `;
+ document.body.appendChild(ui);
+ }
+
+ // Export for global access
+ window.handleClaimClick = handleClaimClick;
+
+ // Initialize when page loads
+ document.addEventListener('DOMContentLoaded', () => {
+ createUI();
+ initViewer();
+ });
+
+ // Handle visibility change (pause/resume animations)
+ document.addEventListener('visibilitychange', () => {
+ if (document.hidden) {
+ console.log('Demo paused');
+ } else {
+ console.log('Demo resumed');
+ }
+ });
+
+ // Service worker registration (for cache awareness)
+ if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('/cz/sw.js').catch(err => {
+ console.log('Service Worker registration failed:', err);
+ });
+ }
+
+ console.log('CZ Offline Demo initialized');
+ </script>
+</body>
+</html>
diff --git a/dist-lib/cz/state.json b/dist-lib/cz/state.json
new file mode 100644
index 000000000..e31fd0a94
--- /dev/null
+++ b/dist-lib/cz/state.json
@@ -0,0 +1,8 @@
+{
+ "status": "pre-onchain",
+ "chainId": null,
+ "agentId": null,
+ "metadataURI": null,
+ "ownerAddress": null,
+ "avatarUrl": "/avatars/cz.glb"
+}
diff --git a/dist-lib/dashboard/actions.html b/dist-lib/dashboard/actions.html
new file mode 100644
index 000000000..493e61cab
--- /dev/null
+++ b/dist-lib/dashboard/actions.html
@@ -0,0 +1,602 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Action Log — 3D Agent</title>
+ <style>
+ :root {
+ color-scheme: dark;
+ --accent: #6a5cff;
+ --accent2: #ff5ca8;
+ --border: #22222e;
+ --bg: #0b0b10;
+ --panel: #14141c;
+ }
+ * {
+ box-sizing: border-box;
+ }
+ body {
+ font:
+ 15px/1.55 system-ui,
+ -apple-system,
+ Segoe UI,
+ Roboto,
+ sans-serif;
+ color: #eee;
+ margin: 0;
+ background: var(--bg);
+ min-height: 100vh;
+ }
+ a {
+ color: #9a8cff;
+ text-decoration: none;
+ }
+ .container {
+ max-width: 900px;
+ margin: 0 auto;
+ padding: 28px;
+ }
+ h1 {
+ font-size: 22px;
+ margin: 0 0 6px;
+ letter-spacing: -0.01em;
+ }
+ .header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 20px;
+ gap: 20px;
+ flex-wrap: wrap;
+ }
+ .agent-info {
+ flex: 1;
+ min-width: 300px;
+ }
+ .sub {
+ color: #888;
+ margin: 4px 0 0;
+ font-size: 14px;
+ }
+ .signer-pill {
+ display: inline-block;
+ background: rgba(106, 92, 255, 0.15);
+ border: 1px solid var(--accent);
+ border-radius: 999px;
+ padding: 4px 12px;
+ font-size: 13px;
+ margin-top: 8px;
+ color: #aaa;
+ font-family: monospace;
+ }
+ .signer-pill.verified {
+ background: rgba(34, 197, 94, 0.1);
+ border-color: #22c55e;
+ color: #86efac;
+ }
+ .actions-toolbar {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ margin-bottom: 20px;
+ flex-wrap: wrap;
+ }
+ .filter-chip {
+ padding: 6px 14px;
+ border: 1px solid var(--border);
+ background: transparent;
+ color: #aaa;
+ border-radius: 999px;
+ cursor: pointer;
+ font-size: 13px;
+ transition: all 0.2s;
+ }
+ .filter-chip:hover {
+ border-color: var(--accent);
+ color: #fff;
+ }
+ .filter-chip.active {
+ background: var(--accent);
+ border-color: var(--accent);
+ color: #fff;
+ }
+ .export-btn {
+ margin-left: auto;
+ padding: 6px 14px;
+ border: 1px solid var(--border);
+ background: transparent;
+ color: #aaa;
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 13px;
+ transition: all 0.2s;
+ }
+ .export-btn:hover {
+ border-color: var(--accent);
+ color: var(--accent);
+ }
+ .timeline {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ }
+ .action-row {
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ padding: 14px;
+ cursor: pointer;
+ transition: all 0.2s;
+ }
+ .action-row:hover {
+ border-color: var(--accent);
+ background: rgba(106, 92, 255, 0.04);
+ }
+ .action-row.expanded {
+ border-color: var(--accent);
+ }
+ .action-row-header {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ }
+ .action-icon {
+ width: 20px;
+ height: 20px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 12px;
+ border-radius: 3px;
+ flex-shrink: 0;
+ }
+ .action-icon.speak {
+ background: rgba(106, 92, 255, 0.2);
+ color: #a5b4fc;
+ }
+ .action-icon.remember {
+ background: rgba(34, 197, 94, 0.2);
+ color: #86efac;
+ }
+ .action-icon.sign {
+ background: rgba(168, 85, 247, 0.2);
+ color: #d8b4fe;
+ }
+ .action-icon.skill-done {
+ background: rgba(59, 130, 246, 0.2);
+ color: #93c5fd;
+ }
+ .action-icon.validate {
+ background: rgba(249, 115, 22, 0.2);
+ color: #fed7aa;
+ }
+ .action-icon.load-end {
+ background: rgba(236, 72, 153, 0.2);
+ color: #f472b6;
+ }
+ .action-summary {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 0;
+ }
+ .action-type {
+ font-weight: 600;
+ font-size: 14px;
+ color: #fff;
+ }
+ .action-preview {
+ color: #aaa;
+ font-size: 13px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .action-meta {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ }
+ .verify-badge {
+ width: 20px;
+ height: 20px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 12px;
+ flex-shrink: 0;
+ }
+ .verify-badge.verified {
+ color: #22c55e;
+ }
+ .verify-badge.unverified {
+ color: #888;
+ }
+ .verify-badge.unsigned {
+ color: #666;
+ }
+ .action-time {
+ color: #666;
+ font-size: 12px;
+ flex-shrink: 0;
+ }
+ .action-time:hover {
+ color: #aaa;
+ }
+ .action-detail {
+ display: none;
+ margin-top: 14px;
+ padding-top: 14px;
+ border-top: 1px solid var(--border);
+ }
+ .action-row.expanded .action-detail {
+ display: block;
+ }
+ .json-block {
+ background: rgba(0, 0, 0, 0.3);
+ border: 1px solid var(--border);
+ border-radius: 4px;
+ padding: 12px;
+ font-family: monospace;
+ font-size: 12px;
+ color: #888;
+ overflow-x: auto;
+ max-height: 300px;
+ overflow-y: auto;
+ }
+ .empty-state {
+ text-align: center;
+ color: #666;
+ padding: 40px 20px;
+ }
+ .empty-state-icon {
+ font-size: 40px;
+ margin-bottom: 12px;
+ }
+ .loading {
+ text-align: center;
+ color: #666;
+ padding: 40px 20px;
+ }
+ .error-msg {
+ background: rgba(239, 68, 68, 0.1);
+ border: 1px solid #ef4444;
+ color: #fca5a5;
+ padding: 12px 14px;
+ border-radius: 6px;
+ margin-bottom: 20px;
+ }
+ .infinite-scroll-trigger {
+ height: 1px;
+ margin-top: 20px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <div class="header">
+ <div class="agent-info">
+ <h1 id="agent-name">Action Log</h1>
+ <div class="sub" id="agent-id"></div>
+ <div class="signer-pill" id="signer-pill" style="display: none"></div>
+ </div>
+ </div>
+
+ <div id="error-msg"></div>
+
+ <div class="actions-toolbar">
+ <button class="filter-chip active" data-filter="all">All</button>
+ <button class="filter-chip" data-filter="speak">Speak</button>
+ <button class="filter-chip" data-filter="remember">Remember</button>
+ <button class="filter-chip" data-filter="sign">Sign</button>
+ <button class="filter-chip" data-filter="skill-done">Skill Done</button>
+ <button class="filter-chip" data-filter="validate">Validate</button>
+ <button class="filter-chip" data-filter="load-end">Load End</button>
+ <button class="export-btn" id="export-btn">Download JSON</button>
+ </div>
+
+ <div id="timeline" class="timeline"></div>
+ <div class="infinite-scroll-trigger" id="scroll-trigger"></div>
+ </div>
+
+ <script>
+ const pageSize = 50;
+ let currentFilter = 'all';
+ let allActions = [];
+ let nextCursor = null;
+ let isLoading = false;
+ let hasMore = true;
+
+ const params = new URLSearchParams(location.search);
+ const agentId = params.get('agent');
+ if (!agentId) {
+ showError('Missing ?agent= parameter.');
+ document.body.innerHTML = '';
+ document.body.appendChild(
+ Object.assign(document.createElement('div'), {
+ textContent: 'Missing ?agent= parameter. Expected: ?agent=<id>',
+ style: 'color:#f87171;padding:20px;',
+ }),
+ );
+ }
+
+ // Auth check
+ (async () => {
+ try {
+ const r = await fetch(`/api/agents/${agentId}/actions?limit=1`, {
+ credentials: 'include',
+ });
+ if (r.status === 401) {
+ window.location.href = `/login?next=/dashboard/actions.html?agent=${agentId}`;
+ return;
+ }
+ if (r.status === 403) {
+ showError('Not authorized to view this agent.');
+ return;
+ }
+ if (r.status === 404) {
+ showError('Agent not found.');
+ return;
+ }
+ if (!r.ok) {
+ showError(`Error ${r.status}`);
+ return;
+ }
+
+ const data = await r.json();
+ const { actions, nextCursor: nc } = data;
+
+ // Fetch agent info
+ const agentR = await fetch(`/api/agents/${agentId}`, {
+ credentials: 'include',
+ });
+ if (agentR.ok) {
+ const agentData = await agentR.json();
+ const agent = agentData.agent;
+ document.getElementById('agent-name').textContent = agent?.name || agentId;
+ document.getElementById('agent-id').textContent = `${agentId}${
+ agent?.wallet_address ? ` · ${agent.wallet_address.slice(0, 10)}…` : ''
+ }`;
+
+ if (agent?.wallet_address) {
+ const pill = document.getElementById('signer-pill');
+ pill.textContent = `Signed by ${agent.wallet_address.slice(0, 10)}…${agent.wallet_address.slice(
+ -8,
+ )}`;
+ pill.className = 'signer-pill verified';
+ pill.style.display = 'inline-block';
+ }
+ }
+
+ // Load initial page
+ nextCursor = nc;
+ await loadMore();
+ } catch (e) {
+ showError(`Fetch failed: ${e.message}`);
+ }
+ })();
+
+ // IntersectionObserver for infinite scroll
+ const observer = new IntersectionObserver(
+ (entries) => {
+ if (entries[0].isIntersecting && !isLoading && hasMore) {
+ loadMore();
+ }
+ },
+ { rootMargin: '200px' },
+ );
+
+ observer.observe(document.getElementById('scroll-trigger'));
+
+ // Load more actions
+ async function loadMore() {
+ if (isLoading || !hasMore) return;
+ isLoading = true;
+
+ try {
+ const url = new URL(`/api/agents/${agentId}/actions`, window.location.origin);
+ url.searchParams.set('limit', pageSize);
+ if (nextCursor) {
+ url.searchParams.set('cursor', nextCursor);
+ }
+
+ const r = await fetch(url, { credentials: 'include' });
+ if (!r.ok) {
+ hasMore = false;
+ return;
+ }
+
+ const data = await r.json();
+ const { actions, nextCursor: nc } = data;
+
+ allActions.push(...actions);
+ nextCursor = nc;
+ hasMore = Boolean(nc);
+
+ render();
+ } catch (e) {
+ console.error('loadMore failed:', e);
+ } finally {
+ isLoading = false;
+ }
+ }
+
+ // Filter changes
+ document.querySelectorAll('.filter-chip').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ document
+ .querySelectorAll('.filter-chip')
+ .forEach((b) => b.classList.remove('active'));
+ btn.classList.add('active');
+ currentFilter = btn.dataset.filter;
+ render();
+ });
+ });
+
+ // Export
+ document.getElementById('export-btn').addEventListener('click', () => {
+ const filtered = getFiltered();
+ const json = JSON.stringify(filtered, null, 2);
+ const blob = new Blob([json], { type: 'application/json' });
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = `actions-${agentId}-${new Date().toISOString().split('T')[0]}.json`;
+ a.click();
+ URL.revokeObjectURL(url);
+ });
+
+ function getFiltered() {
+ if (currentFilter === 'all') return allActions;
+ return allActions.filter((a) => a.type === currentFilter);
+ }
+
+ function render() {
+ const filtered = getFiltered();
+ const timeline = document.getElementById('timeline');
+
+ if (filtered.length === 0 && allActions.length === 0) {
+ timeline.innerHTML =
+ '<div class="empty-state"><div class="empty-state-icon">—</div><div>No actions yet.</div></div>';
+ return;
+ }
+
+ if (filtered.length === 0) {
+ timeline.innerHTML =
+ '<div class="empty-state"><div class="empty-state-icon">—</div><div>No actions match this filter.</div></div>';
+ return;
+ }
+
+ timeline.innerHTML = filtered.map((action) => renderRow(action)).join('');
+
+ // Add expand listeners
+ document.querySelectorAll('.action-row').forEach((row) => {
+ row.addEventListener('click', () => {
+ row.classList.toggle('expanded');
+ });
+ });
+ }
+
+ function renderRow(action) {
+ const type = action.type;
+ const preview = summarizePayload(action.payload);
+ const timestamp = new Date(action.timestamp);
+ const now = new Date();
+ const relTime = formatRelativeTime(timestamp, now);
+
+ let verifyIcon = '—';
+ let verifyClass = 'unsigned';
+ if (action.signature) {
+ if (action.verified === true) {
+ verifyIcon = '✓';
+ verifyClass = 'verified';
+ } else if (action.verified === false) {
+ verifyIcon = '✗';
+ verifyClass = 'unverified';
+ }
+ }
+
+ return `
+ <div class="action-row" data-id="${action.id}">
+ <div class="action-row-header">
+ <div class="action-icon ${type}">
+ ${getTypeIcon(type)}
+ </div>
+ <div class="action-summary">
+ <div class="action-type">${escapeHtml(type)}</div>
+ <div class="action-preview">${escapeHtml(preview)}</div>
+ </div>
+ <div class="action-meta">
+ <div class="verify-badge ${verifyClass}" title="${
+ action.verified === true
+ ? 'Verified'
+ : action.verified === false
+ ? 'Invalid signature'
+ : 'Unsigned'
+ }">${verifyIcon}</div>
+ <div class="action-time" title="${timestamp.toISOString()}">${escapeHtml(relTime)}</div>
+ </div>
+ </div>
+ <div class="action-detail">
+ <div class="json-block">${escapeHtml(JSON.stringify(action.payload, null, 2))}</div>
+ ${
+ action.signer
+ ? `<div style="margin-top:8px;color:#666;font-size:12px">Signer: <code style="color:#888">${escapeHtml(
+ action.signer,
+ )}</code></div>`
+ : ''
+ }
+ </div>
+ </div>
+ `;
+ }
+
+ function getTypeIcon(type) {
+ const icons = {
+ speak: '💬',
+ remember: '📝',
+ sign: '✍️',
+ 'skill-done': '✓',
+ validate: '✔',
+ 'load-end': '📦',
+ };
+ return icons[type] || '•';
+ }
+
+ function summarizePayload(payload) {
+ if (typeof payload !== 'object' || !payload) return '(empty)';
+ const keys = Object.keys(payload);
+ if (keys.length === 0) return '(empty)';
+
+ // For speak actions, show the text
+ if (payload.text) return payload.text.slice(0, 80);
+
+ // For remember, show content
+ if (payload.content) return payload.content.slice(0, 80);
+
+ // Generic: show key=value preview
+ const parts = keys.slice(0, 2).map((k) => {
+ const v = payload[k];
+ if (typeof v === 'string') return `${k}=${v.slice(0, 30)}`;
+ if (typeof v === 'number') return `${k}=${v}`;
+ if (typeof v === 'boolean') return `${k}=${v}`;
+ return `${k}=(object)`;
+ });
+ return parts.join(', ');
+ }
+
+ function formatRelativeTime(date, now) {
+ const seconds = Math.floor((now - date) / 1000);
+
+ if (seconds < 60) return `${seconds}s ago`;
+ if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
+ if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`;
+ if (seconds < 604800) return `${Math.floor(seconds / 86400)}d ago`;
+
+ const months = Math.floor(seconds / 2592000);
+ if (months < 12) return `${months}mo ago`;
+
+ return `${Math.floor(seconds / 31536000)}y ago`;
+ }
+
+ function showError(msg) {
+ const el = document.getElementById('error-msg');
+ el.innerHTML = `<div class="error-msg">${escapeHtml(msg)}</div>`;
+ }
+
+ function escapeHtml(text) {
+ if (!text) return '';
+ const map = {
+ '&': '&amp;',
+ '<': '&lt;',
+ '>': '&gt;',
+ '"': '&quot;',
+ "'": '&#039;',
+ };
+ return String(text).replace(/[&<>"']/g, (c) => map[c]);
+ }
+ </script>
+ </body>
+</html>
diff --git a/dist-lib/dashboard/dashboard.js b/dist-lib/dashboard/dashboard.js
index 97433b165..104f97500 100644
--- a/dist-lib/dashboard/dashboard.js
+++ b/dist-lib/dashboard/dashboard.js
@@ -1,8 +1,6 @@
// Dashboard single-file app. Uses native DOM — no framework.
// Keeps bundle small and ensures anything rendering <model-viewer> works without bundler.
-import { AvatarCreator } from '../../src/avatar-creator.js';
-
export const state = { user: null };
export const api = {
diff --git a/dist-lib/dashboard/sessions.html b/dist-lib/dashboard/sessions.html
new file mode 100644
index 000000000..ff9594a98
--- /dev/null
+++ b/dist-lib/dashboard/sessions.html
@@ -0,0 +1,442 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Sessions · 3D Agent</title>
+ <link rel="icon" href="/favicon.ico" />
+ <style>
+ :root {
+ color-scheme: dark;
+ --accent: #6a5cff;
+ --border: #22222e;
+ --bg: #0b0b10;
+ --panel: #14141c;
+ }
+ * {
+ box-sizing: border-box;
+ }
+ body {
+ font:
+ 15px/1.55 -apple-system,
+ system-ui,
+ Segoe UI,
+ Roboto,
+ sans-serif;
+ color: #eee;
+ margin: 0;
+ background: var(--bg);
+ min-height: 100vh;
+ }
+ a {
+ color: #9a8cff;
+ text-decoration: none;
+ }
+ header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 24px;
+ border-bottom: 1px solid var(--border);
+ position: sticky;
+ top: 0;
+ background: var(--bg);
+ z-index: 5;
+ }
+ .brand {
+ font-weight: 600;
+ letter-spacing: -0.01em;
+ }
+ .row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+ main {
+ padding: 28px;
+ max-width: 800px;
+ }
+ h1 {
+ font-size: 22px;
+ margin: 0 0 6px;
+ letter-spacing: -0.01em;
+ }
+ .sub {
+ color: #888;
+ margin: 0 0 22px;
+ font-size: 14px;
+ }
+ .btn {
+ padding: 9px 14px;
+ border-radius: 9px;
+ border: 0;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+ background: var(--accent);
+ color: #fff;
+ }
+ .btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ .btn.sec {
+ background: #222230;
+ color: #ddd;
+ }
+ .btn.danger {
+ background: #cc4040;
+ }
+ .btn-group {
+ display: flex;
+ gap: 8px;
+ margin-bottom: 20px;
+ }
+ table {
+ width: 100%;
+ border-collapse: collapse;
+ border: 1px solid var(--border);
+ border-radius: 10px;
+ overflow: hidden;
+ background: var(--panel);
+ }
+ thead {
+ background: #0f0f17;
+ border-bottom: 1px solid var(--border);
+ }
+ th {
+ padding: 12px 16px;
+ text-align: left;
+ font-size: 12px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ color: #888;
+ }
+ td {
+ padding: 12px 16px;
+ border-bottom: 1px solid var(--border);
+ font-size: 14px;
+ }
+ tr:last-child td {
+ border-bottom: 0;
+ }
+ .pill {
+ display: inline-block;
+ font-size: 11px;
+ padding: 3px 8px;
+ border-radius: 99px;
+ background: rgba(106, 92, 255, 0.2);
+ color: #a8a0ff;
+ white-space: nowrap;
+ }
+ .agent-cell {
+ max-width: 200px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: #bbb;
+ font-size: 13px;
+ }
+ .time-cell {
+ color: #999;
+ font-size: 13px;
+ }
+ .actions {
+ text-align: right;
+ }
+ .empty {
+ text-align: center;
+ padding: 40px 20px;
+ color: #888;
+ }
+ .toast {
+ position: fixed;
+ bottom: 24px;
+ left: 50%;
+ transform: translateX(-50%);
+ background: #1a1a24;
+ border: 1px solid var(--border);
+ padding: 10px 18px;
+ border-radius: 99px;
+ font-size: 13px;
+ color: #ddd;
+ z-index: 70;
+ box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
+ animation: toast-in 0.2s;
+ }
+ .toast.error {
+ background: rgba(204, 64, 64, 0.15);
+ border-color: rgba(204, 64, 64, 0.3);
+ color: #ffb3b3;
+ }
+ @keyframes toast-in {
+ from {
+ opacity: 0;
+ transform: translate(-50%, 8px);
+ }
+ to {
+ opacity: 1;
+ transform: translateX(-50%);
+ }
+ }
+ .btn-sec {
+ background: #222230;
+ color: #ddd;
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <div class="brand"><a href="/">3D Agent</a></div>
+ <button class="btn sec" onclick="signOut()">Sign out</button>
+ </header>
+ <main>
+ <h1>Sessions</h1>
+ <p class="sub">Manage your active login sessions across devices.</p>
+
+ <div class="btn-group">
+ <button class="btn danger" id="signOutBtn" style="display: none">
+ Sign out of all other devices
+ </button>
+ </div>
+
+ <table id="sessionsTable" style="display: none">
+ <thead>
+ <tr>
+ <th>Device / User Agent</th>
+ <th>IP Address</th>
+ <th>Created</th>
+ <th>Last Seen</th>
+ <th class="actions">Actions</th>
+ </tr>
+ </thead>
+ <tbody id="sessionsList"></tbody>
+ </table>
+
+ <div class="empty" id="loadingMessage">Loading sessions...</div>
+ </main>
+
+ <script>
+ function signOut() {
+ location.href = '/login';
+ }
+
+ function showToast(message, isError = false) {
+ const toast = document.createElement('div');
+ toast.className = 'toast' + (isError ? ' error' : '');
+ toast.textContent = message;
+ document.body.appendChild(toast);
+ setTimeout(() => {
+ toast.remove();
+ }, 3000);
+ }
+
+ function formatRelativeTime(date) {
+ const now = new Date();
+ const diff = now - new Date(date);
+ const seconds = Math.floor(diff / 1000);
+ const minutes = Math.floor(seconds / 60);
+ const hours = Math.floor(minutes / 60);
+ const days = Math.floor(hours / 24);
+
+ if (seconds < 60) return 'Just now';
+ if (minutes < 60) return `${minutes}m ago`;
+ if (hours < 24) return `${hours}h ago`;
+ if (days < 7) return `${days}d ago`;
+
+ return new Date(date).toLocaleDateString('en-US', {
+ month: 'short',
+ day: 'numeric',
+ });
+ }
+
+ function formatAbsoluteDate(date) {
+ return new Date(date).toLocaleDateString('en-US', {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit',
+ });
+ }
+
+ function truncateUA(ua) {
+ if (!ua) return 'Unknown';
+ if (ua.length > 50) return ua.substring(0, 47) + '…';
+ return ua;
+ }
+
+ async function loadSessions() {
+ try {
+ const res = await fetch('/api/auth/me', { credentials: 'include' });
+ if (res.status === 401) {
+ location.href = '/login?next=' + encodeURIComponent(location.pathname);
+ return;
+ }
+ if (!res.ok) throw new Error('Failed to verify auth');
+
+ const sessionsRes = await fetch('/api/auth/sessions', {
+ credentials: 'include',
+ });
+ if (!sessionsRes.ok) throw new Error('Failed to load sessions');
+
+ const { sessions } = await sessionsRes.json();
+
+ const tbody = document.getElementById('sessionsList');
+ tbody.innerHTML = '';
+
+ if (sessions.length === 0) {
+ document.getElementById('loadingMessage').textContent =
+ 'No active sessions';
+ return;
+ }
+
+ document.getElementById('sessionsTable').style.display = 'table';
+ document.getElementById('loadingMessage').style.display = 'none';
+
+ const hasMultiple = sessions.length > 1;
+ document.getElementById('signOutBtn').style.display = hasMultiple
+ ? 'block'
+ : 'none';
+
+ sessions.forEach((session) => {
+ const row = document.createElement('tr');
+ row.id = `session-${session.id}`;
+
+ const isCurrentSession = session.current;
+ const uaCell = document.createElement('td');
+ uaCell.className = 'agent-cell';
+ uaCell.textContent = truncateUA(session.user_agent);
+
+ const ipCell = document.createElement('td');
+ ipCell.className = 'agent-cell';
+ ipCell.textContent = session.ip || 'Unknown';
+
+ const createdCell = document.createElement('td');
+ createdCell.className = 'time-cell';
+ createdCell.textContent = formatAbsoluteDate(session.created_at);
+
+ const lastSeenCell = document.createElement('td');
+ lastSeenCell.className = 'time-cell';
+ if (isCurrentSession) {
+ lastSeenCell.innerHTML = '<span class="pill">This device</span>';
+ } else {
+ lastSeenCell.textContent = formatRelativeTime(session.last_seen_at);
+ }
+
+ const actionsCell = document.createElement('td');
+ actionsCell.className = 'actions';
+ if (!isCurrentSession) {
+ const revokeBtn = document.createElement('button');
+ revokeBtn.className = 'btn sec';
+ revokeBtn.style.padding = '6px 12px';
+ revokeBtn.style.fontSize = '12px';
+ revokeBtn.textContent = 'Revoke';
+ revokeBtn.onclick = () => revokeSession(session.id, row);
+ actionsCell.appendChild(revokeBtn);
+ } else {
+ const placeholder = document.createElement('span');
+ placeholder.style.color = '#666';
+ placeholder.style.fontSize = '12px';
+ placeholder.textContent = '—';
+ actionsCell.appendChild(placeholder);
+ }
+
+ row.appendChild(uaCell);
+ row.appendChild(ipCell);
+ row.appendChild(createdCell);
+ row.appendChild(lastSeenCell);
+ row.appendChild(actionsCell);
+ tbody.appendChild(row);
+ });
+ } catch (err) {
+ console.error(err);
+ document.getElementById('loadingMessage').textContent =
+ 'Error loading sessions';
+ }
+ }
+
+ async function revokeSession(sessionId, row) {
+ const originalRow = row.cloneNode(true);
+ row.style.opacity = '0.5';
+ row.querySelector('button').disabled = true;
+
+ try {
+ const res = await fetch(`/api/auth/sessions/${sessionId}`, {
+ method: 'DELETE',
+ credentials: 'include',
+ });
+
+ if (!res.ok) {
+ throw new Error('Failed to revoke session');
+ }
+
+ row.style.animation = 'fade-out 0.3s';
+ setTimeout(() => {
+ row.remove();
+ showToast('Session revoked');
+ const remaining = document.querySelectorAll('#sessionsList tr').length;
+ if (remaining === 1) {
+ document.getElementById('signOutBtn').style.display = 'none';
+ }
+ }, 300);
+ } catch (err) {
+ console.error(err);
+ row.replaceWith(originalRow);
+ originalRow.querySelector('button').onclick = () =>
+ revokeSession(sessionId, originalRow);
+ showToast('Failed to revoke session', true);
+ }
+ }
+
+ async function signOutEverywhere() {
+ if (
+ !confirm(
+ 'Sign out of all other devices? You will stay signed in on this device.',
+ )
+ )
+ return;
+
+ const signOutBtn = document.getElementById('signOutBtn');
+ const originalText = signOutBtn.textContent;
+ signOutBtn.disabled = true;
+ signOutBtn.textContent = 'Signing out...';
+
+ try {
+ const res = await fetch('/api/auth/sessions', {
+ method: 'DELETE',
+ credentials: 'include',
+ });
+
+ if (!res.ok) throw new Error('Failed to sign out');
+
+ const { revoked } = await res.json();
+ showToast(`Signed out of ${revoked} device${revoked === 1 ? '' : 's'}`);
+ loadSessions();
+ } catch (err) {
+ console.error(err);
+ signOutBtn.disabled = false;
+ signOutBtn.textContent = originalText;
+ showToast('Failed to sign out of other devices', true);
+ }
+ }
+
+ document.getElementById('signOutBtn').onclick = signOutEverywhere;
+
+ loadSessions();
+
+ // Add CSS animation
+ const style = document.createElement('style');
+ style.textContent = `
+ @keyframes fade-out {
+ to {
+ opacity: 0;
+ transform: translateX(-20px);
+ }
+ }
+ `;
+ document.head.appendChild(style);
+ </script>
+ </body>
+</html>
diff --git a/dist-lib/dashboard/wallets.html b/dist-lib/dashboard/wallets.html
new file mode 100644
index 000000000..98b126ec3
--- /dev/null
+++ b/dist-lib/dashboard/wallets.html
@@ -0,0 +1,418 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Linked Wallets · Dashboard · 3D Agent</title>
+ <link rel="icon" href="/favicon.ico" />
+ <style>
+ :root {
+ color-scheme: dark;
+ --accent: #6a5cff;
+ --accent2: #ff5ca8;
+ --border: #22222e;
+ --bg: #0b0b10;
+ --panel: #14141c;
+ }
+ * {
+ box-sizing: border-box;
+ }
+ body {
+ font:
+ 15px/1.55 -apple-system,
+ system-ui,
+ Segoe UI,
+ Roboto,
+ sans-serif;
+ color: #eee;
+ margin: 0;
+ background: var(--bg);
+ min-height: 100vh;
+ }
+ a {
+ color: #9a8cff;
+ text-decoration: none;
+ }
+ header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 24px;
+ border-bottom: 1px solid var(--border);
+ position: sticky;
+ top: 0;
+ background: var(--bg);
+ z-index: 5;
+ }
+ .brand {
+ font-weight: 600;
+ letter-spacing: -0.01em;
+ }
+ .row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+ main {
+ padding: 28px;
+ max-width: 800px;
+ margin: 0 auto;
+ }
+ h1 {
+ font-size: 22px;
+ margin: 0 0 6px;
+ letter-spacing: -0.01em;
+ }
+ .sub {
+ color: #888;
+ margin: 0 0 22px;
+ font-size: 14px;
+ }
+ .btn {
+ padding: 9px 14px;
+ border-radius: 9px;
+ border: 0;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+ background: var(--accent);
+ color: #fff;
+ }
+ .btn:hover {
+ filter: brightness(1.08);
+ }
+ .btn.sec {
+ background: #222230;
+ color: #ddd;
+ }
+ .btn.danger {
+ background: #cc4040;
+ }
+ .btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ .wallet-table {
+ width: 100%;
+ border-collapse: collapse;
+ margin-bottom: 24px;
+ }
+ .wallet-table th {
+ text-align: left;
+ padding: 12px;
+ border-bottom: 1px solid var(--border);
+ font-size: 12px;
+ font-weight: 600;
+ color: #aaa;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ }
+ .wallet-table td {
+ padding: 12px;
+ border-bottom: 1px solid var(--border);
+ font-size: 14px;
+ }
+ .wallet-table tr:last-child td {
+ border-bottom: none;
+ }
+ .address-cell {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ font-family:
+ ui-monospace,
+ SF Mono,
+ Menlo,
+ monospace;
+ font-size: 13px;
+ }
+ .copy-btn {
+ background: none;
+ border: none;
+ color: #666;
+ cursor: pointer;
+ padding: 2px 4px;
+ font-size: 12px;
+ }
+ .copy-btn:hover {
+ color: #aaa;
+ }
+ .pill {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 11px;
+ padding: 3px 8px;
+ border-radius: 99px;
+ background: #20202c;
+ color: #ccc;
+ white-space: nowrap;
+ }
+ .meta {
+ color: #888;
+ font-size: 13px;
+ }
+ .err {
+ padding: 12px;
+ background: rgba(255, 92, 92, 0.1);
+ border: 1px solid rgba(255, 92, 92, 0.3);
+ border-radius: 8px;
+ color: #ffb3b3;
+ margin-bottom: 14px;
+ display: none;
+ }
+ .empty {
+ text-align: center;
+ padding: 40px 20px;
+ border: 1px dashed var(--border);
+ border-radius: 14px;
+ color: #888;
+ }
+ .loading {
+ opacity: 0.6;
+ }
+ .muted {
+ color: #888;
+ font-size: 13px;
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <div class="brand"><a href="/">3D Agent</a></div>
+ <div class="row">
+ <span class="muted" id="user-email"></span>
+ <button class="btn sec" onclick="signOut()">Sign out</button>
+ </div>
+ </header>
+ <main>
+ <h1>Linked Wallets</h1>
+ <p class="sub">Manage Ethereum wallets connected to your account.</p>
+
+ <div id="error" class="err"></div>
+
+ <div id="wallets-container" class="loading">
+ <p style="color: #666">Loading wallets…</p>
+ </div>
+
+ <button id="link-btn" class="btn" style="margin-top: 20px">Link Another Wallet</button>
+ </main>
+
+ <script type="module">
+ let apiUrl = '/api';
+
+ async function signOut() {
+ await fetch(`${apiUrl}/auth/logout`, { method: 'POST', credentials: 'include' });
+ location.href = '/login';
+ }
+
+ async function fetchUser() {
+ const res = await fetch(`${apiUrl}/auth/me`, { credentials: 'include' });
+ if (!res.ok) {
+ location.href = '/login?next=' + encodeURIComponent(location.pathname);
+ return null;
+ }
+ return res.json();
+ }
+
+ async function loadWallets() {
+ try {
+ const res = await fetch(`${apiUrl}/auth/wallets`, { credentials: 'include' });
+ if (!res.ok) throw new Error('Failed to load wallets');
+ const data = await res.json();
+ renderWallets(data.wallets);
+ } catch (err) {
+ showError(err.message);
+ }
+ }
+
+ function renderWallets(wallets) {
+ const container = document.getElementById('wallets-container');
+ if (wallets.length === 0) {
+ container.innerHTML = `
+ <div class="empty">
+ <p>No wallets linked yet.</p>
+ <p class="muted">Click "Link Another Wallet" to add your first wallet.</p>
+ </div>
+ `;
+ return;
+ }
+
+ const rows = wallets
+ .map(
+ (w) => `
+ <tr>
+ <td>
+ <div class="address-cell">
+ <span>${w.address.slice(0, 6)}…${w.address.slice(-4)}</span>
+ <button
+ class="copy-btn"
+ onclick="copyToClipboard('${w.address}')"
+ title="Copy full address"
+ >
+ 📋
+ </button>
+ </div>
+ </td>
+ <td class="meta">${w.chain_id ? `Chain ${w.chain_id}` : 'Multi-chain'}</td>
+ <td class="meta">${new Date(w.created_at).toLocaleDateString()}</td>
+ <td>
+ ${w.is_primary ? '<span class="pill">Primary</span>' : ''}
+ </td>
+ <td style="text-align: right">
+ <button
+ class="btn sec btn-sm"
+ onclick="unlinkWallet('${w.address}')"
+ style="padding: 6px 10px; font-size: 12px"
+ >
+ Unlink
+ </button>
+ </td>
+ </tr>
+ `,
+ )
+ .join('');
+
+ container.innerHTML = `
+ <table class="wallet-table">
+ <thead>
+ <tr>
+ <th>Address</th>
+ <th>Chain</th>
+ <th>Linked</th>
+ <th></th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ ${rows}
+ </tbody>
+ </table>
+ `;
+ }
+
+ function copyToClipboard(text) {
+ navigator.clipboard.writeText(text).then(
+ () => {
+ // Show brief feedback
+ const btn = event.target;
+ const orig = btn.textContent;
+ btn.textContent = '✓';
+ setTimeout(() => {
+ btn.textContent = orig;
+ }, 1500);
+ },
+ () => alert('Copy failed'),
+ );
+ }
+
+ async function unlinkWallet(address) {
+ if (!confirm(`Unlink ${address.slice(0, 6)}…${address.slice(-4)}?`)) return;
+
+ try {
+ const res = await fetch(`${apiUrl}/auth/wallets/${address}`, {
+ method: 'DELETE',
+ credentials: 'include',
+ });
+ if (!res.ok) {
+ const err = await res.json();
+ throw new Error(err.error_description || 'Failed to unlink wallet');
+ }
+ loadWallets();
+ } catch (err) {
+ showError(err.message);
+ }
+ }
+
+ async function linkWallet() {
+ if (!window.ethereum) {
+ showError('MetaMask not found. Please install it to link wallets.');
+ return;
+ }
+
+ try {
+ // 1. Request accounts from MetaMask
+ const accounts = await window.ethereum.request({
+ method: 'eth_requestAccounts',
+ });
+ const address = accounts[0];
+
+ // 2. Get nonce from server
+ const nonceRes = await fetch(`${apiUrl}/auth/wallets/nonce`, {
+ method: 'POST',
+ credentials: 'include',
+ });
+ if (!nonceRes.ok) throw new Error('Failed to get nonce');
+ const { nonce, message } = await nonceRes.json();
+
+ // 3. Sign message with MetaMask
+ let signature;
+ try {
+ signature = await window.ethereum.request({
+ method: 'personal_sign',
+ params: [message, address],
+ });
+ } catch (err) {
+ if (err.code === 4001) {
+ showError('Signature cancelled by user');
+ } else {
+ showError(err.message || 'Signature failed');
+ }
+ return;
+ }
+
+ // 4. Send signature to server
+ const linkRes = await fetch(`${apiUrl}/auth/wallets`, {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ address, message, signature, nonce }),
+ });
+ if (!linkRes.ok) {
+ const err = await linkRes.json();
+ throw new Error(err.error_description || 'Failed to link wallet');
+ }
+
+ showError('', 'success');
+ loadWallets();
+ } catch (err) {
+ showError(err.message);
+ }
+ }
+
+ function showError(msg, type = 'error') {
+ const el = document.getElementById('error');
+ if (!msg) {
+ el.style.display = 'none';
+ return;
+ }
+ if (type === 'success') {
+ el.textContent = '✓ Wallet linked successfully!';
+ el.style.background = 'rgba(92, 255, 92, 0.1)';
+ el.style.borderColor = 'rgba(92, 255, 92, 0.3)';
+ el.style.color = '#b3ffb3';
+ } else {
+ el.textContent = msg;
+ el.style.background = 'rgba(255, 92, 92, 0.1)';
+ el.style.borderColor = 'rgba(255, 92, 92, 0.3)';
+ el.style.color = '#ffb3b3';
+ }
+ el.style.display = 'block';
+ }
+
+ window.copyToClipboard = copyToClipboard;
+ window.unlinkWallet = unlinkWallet;
+
+ // Initialize
+ (async () => {
+ const me = await fetchUser();
+ if (me) {
+ document.getElementById('user-email').textContent = me.user.email;
+ loadWallets();
+ }
+ })();
+
+ document.getElementById('link-btn').addEventListener('click', linkWallet);
+ </script>
+ </body>
+</html>
diff --git a/dist-lib/first-meet/first-meet.js b/dist-lib/first-meet/first-meet.js
new file mode 100644
index 000000000..084712d47
--- /dev/null
+++ b/dist-lib/first-meet/first-meet.js
@@ -0,0 +1,331 @@
+// First meet onboarding flow for newly created avatars
+
+const STEPS = ['name', 'bio', 'voice', 'greet', 'done'];
+let currentStep = 0;
+let state = {
+ avatarId: null,
+ avatar: null,
+ agent: null,
+ name: 'My Agent',
+ bio: '',
+ voice: 'en-US-female',
+ bodyType: 'neutral',
+};
+
+// ── Init ───────────────────────────────────────────────────────────────────
+
+async function boot() {
+ const avatarId = new URL(window.location).searchParams.get('avatar');
+ if (!avatarId) {
+ window.location.href = '/login';
+ return;
+ }
+
+ // Auth check
+ const authRes = await fetch('/api/auth/me', { credentials: 'include' });
+ if (!authRes.ok) {
+ window.location.href =
+ '/login?next=' + encodeURIComponent(window.location.pathname + window.location.search);
+ return;
+ }
+
+ state.avatarId = avatarId;
+
+ // Load avatar
+ try {
+ const res = await fetch(`/api/avatars/${avatarId}`, { credentials: 'include' });
+ if (!res.ok) throw new Error('Avatar not found');
+ const data = await res.json();
+ state.avatar = data.avatar;
+ renderPreview();
+ } catch (err) {
+ showPreviewError('Failed to load avatar: ' + err.message);
+ return;
+ }
+
+ // Load existing agent if any
+ try {
+ const res = await fetch('/api/agents/me', { credentials: 'include' });
+ if (res.ok) {
+ const data = await res.json();
+ if (data.agent) {
+ state.agent = data.agent;
+ if (data.agent.name) state.name = data.agent.name;
+ if (data.agent.description) state.bio = data.agent.description;
+ }
+ }
+ } catch {
+ // Ignore agent load errors, proceed
+ }
+
+ wireStepButtons();
+ updateProgress();
+ goToStep(0);
+}
+
+// ── Rendering ───────────────────────────────────────────────────────────────
+
+function renderPreview() {
+ const container = document.getElementById('preview-content');
+ if (!state.avatar || !state.avatar.model_url) {
+ container.innerHTML = '<div class="error-msg">Avatar URL not available</div>';
+ return;
+ }
+
+ const viewer = document.createElement('model-viewer');
+ viewer.src = state.avatar.model_url;
+ viewer.alt = state.avatar.name || 'Avatar';
+ viewer.setAttribute('auto-rotate', '');
+ viewer.setAttribute('camera-controls', '');
+ viewer.setAttribute('enable-shadow', '');
+
+ container.innerHTML = '';
+ container.appendChild(viewer);
+}
+
+function showPreviewError(msg) {
+ const container = document.getElementById('preview-content');
+ container.innerHTML = `<div class="error-msg">${escapeHtml(msg)}</div>`;
+}
+
+function updateProgress() {
+ const pct = ((currentStep + 1) / STEPS.length) * 100;
+ document.getElementById('progress-bar').style.width = pct + '%';
+}
+
+function goToStep(n) {
+ STEPS.forEach((s) => {
+ document.getElementById(`step-${s}`).classList.remove('active');
+ });
+ currentStep = n;
+ document.getElementById(`step-${STEPS[currentStep]}`).classList.add('active');
+ updateProgress();
+
+ if (currentStep === 0) {
+ const input = document.getElementById('name-input');
+ input.value = state.name;
+ input.focus();
+ updateCharCount('name');
+ } else if (currentStep === 1) {
+ const textarea = document.getElementById('bio-input');
+ textarea.value = state.bio;
+ textarea.focus();
+ updateCharCount('bio');
+ } else if (currentStep === 2) {
+ document.getElementById('voice-select').value = state.voice;
+ document.getElementById('body-type-select').value = state.bodyType;
+ } else if (currentStep === 3) {
+ renderGreeting();
+ }
+}
+
+function updateCharCount(field) {
+ const input = document.getElementById(`${field}-input`);
+ const count = document.getElementById(`${field}-count`);
+ count.textContent = input.value.length;
+}
+
+// ── Wire buttons ─────────────────────────────────────────────────────────────
+
+function wireStepButtons() {
+ // Step 1: Name
+ document.getElementById('name-input').addEventListener('input', (e) => {
+ state.name = e.target.value || 'My Agent';
+ updateCharCount('name');
+ });
+ document.getElementById('name-next').addEventListener('click', () => goToStep(1));
+ document.getElementById('name-skip').addEventListener('click', () => goToStep(1));
+
+ // Step 2: Bio
+ document.getElementById('bio-input').addEventListener('input', (e) => {
+ state.bio = e.target.value;
+ updateCharCount('bio');
+ });
+ document.getElementById('bio-next').addEventListener('click', () => goToStep(2));
+ document.getElementById('bio-back').addEventListener('click', () => goToStep(0));
+
+ // Step 3: Voice
+ document.getElementById('voice-select').addEventListener('change', (e) => {
+ state.voice = e.target.value;
+ });
+ document.getElementById('body-type-select').addEventListener('change', (e) => {
+ state.bodyType = e.target.value;
+ });
+ document.getElementById('voice-next').addEventListener('click', () => goToStep(3));
+ document.getElementById('voice-back').addEventListener('click', () => goToStep(1));
+
+ // Step 4: Greet
+ document.getElementById('greet-next').addEventListener('click', () => goToStep(4));
+
+ // Step 5: Done
+ document.getElementById('done-agent').addEventListener('click', async () => {
+ // Persist final state
+ try {
+ await persistState();
+ } catch (err) {
+ alert('Failed to save: ' + err.message);
+ return;
+ }
+ if (state.agent) {
+ window.location.href = `/agent/${state.agent.id}`;
+ }
+ });
+ document.getElementById('done-dashboard').addEventListener('click', () => {
+ window.location.href = '/dashboard';
+ });
+}
+
+// ── Greeting (Step 4) ───────────────────────────────────────────────────────
+
+async function renderGreeting() {
+ const container = document.getElementById('preview-content');
+ const textDiv = document.getElementById('greeting-text');
+
+ try {
+ // Try to load agent-3d element
+ if (window.customElements && customElements.get('agent-3d')) {
+ const agent3d = document.createElement('agent-3d');
+ agent3d.setAttribute('model', state.avatar.model_url);
+ agent3d.setAttribute('voice', state.voice);
+ agent3d.setAttribute('eager', '');
+
+ container.innerHTML = '';
+ container.appendChild(agent3d);
+
+ textDiv.textContent = 'Greeting…';
+
+ // Wait for element to be ready, then emit speak event
+ setTimeout(() => {
+ try {
+ const greetingText = buildGreetingText();
+ const event = new CustomEvent('speak', {
+ detail: { text: greetingText, sentiment: 0.8 },
+ });
+ agent3d.dispatchEvent(event);
+ textDiv.textContent = `"${greetingText}"`;
+ } catch (e) {
+ console.error('Greeting failed:', e);
+ textDiv.textContent = buildGreetingText();
+ }
+ }, 500);
+ } else {
+ // Fallback: model-viewer + text
+ const viewer = document.createElement('model-viewer');
+ viewer.src = state.avatar.model_url;
+ viewer.alt = state.avatar.name || 'Avatar';
+ viewer.setAttribute('auto-rotate', '');
+ viewer.setAttribute('camera-controls', '');
+ viewer.setAttribute('enable-shadow', '');
+
+ container.innerHTML = '';
+ container.appendChild(viewer);
+
+ const greetingText = buildGreetingText();
+ textDiv.textContent = `"${greetingText}"`;
+
+ // Try browser TTS
+ if (window.SpeechSynthesis || window.webkitSpeechSynthesis) {
+ const synth = window.speechSynthesis || window.webkitSpeechSynthesis;
+ const utterance = new SpeechSynthesisUtterance(greetingText);
+ utterance.voice = findVoice(state.voice);
+ utterance.rate = 0.95;
+ synth.speak(utterance);
+ }
+ }
+ } catch (err) {
+ console.error('Greeting render error:', err);
+ textDiv.textContent = buildGreetingText();
+ }
+}
+
+function buildGreetingText() {
+ const bioSuffix = state.bio ? ' ' + state.bio : '';
+ return `Hi — I'm ${state.name}.${bioSuffix}`;
+}
+
+function findVoice(voiceId) {
+ if (!(window.SpeechSynthesis || window.webkitSpeechSynthesis)) return null;
+ const synth = window.speechSynthesis || window.webkitSpeechSynthesis;
+ const voices = synth.getVoices();
+
+ const langMap = {
+ 'en-US-female': ['en-US', 'female'],
+ 'en-US-male': ['en-US', 'male'],
+ 'en-GB-female': ['en-GB', 'female'],
+ 'en-GB-male': ['en-GB', 'male'],
+ };
+
+ const [lang, gender] = langMap[voiceId] || ['en-US', 'female'];
+
+ return (
+ voices.find((v) => v.lang.startsWith(lang) && (v.name.includes(gender) || true)) ||
+ voices[0] ||
+ null
+ );
+}
+
+// ── Persistence ────────────────────────────────────────────────────────────
+
+async function persistState() {
+ // 1. PATCH avatar name + description
+ await fetch(`/api/avatars/${state.avatarId}`, {
+ method: 'PATCH',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ name: state.name,
+ description: state.bio,
+ }),
+ }).then((r) => {
+ if (!r.ok) throw new Error(`Avatar update failed: ${r.status}`);
+ return r.json();
+ });
+
+ // 2. Create or update agent
+ const agentMeta = { voice: state.voice, bodyType: state.bodyType };
+ if (!state.agent) {
+ // POST new agent
+ const res = await fetch('/api/agents', {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ name: state.name,
+ description: state.bio,
+ avatar_id: state.avatarId,
+ meta: agentMeta,
+ }),
+ });
+ if (!res.ok) throw new Error(`Agent creation failed: ${res.status}`);
+ const data = await res.json();
+ state.agent = data.agent;
+ } else {
+ // PATCH existing agent
+ const res = await fetch(`/api/agents/${state.agent.id}`, {
+ method: 'PATCH',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ name: state.name,
+ description: state.bio,
+ avatar_id: state.avatarId,
+ meta: agentMeta,
+ }),
+ });
+ if (!res.ok) throw new Error(`Agent update failed: ${res.status}`);
+ const data = await res.json();
+ state.agent = data.agent;
+ }
+}
+
+// ── Helpers ────────────────────────────────────────────────────────────────
+
+function escapeHtml(text) {
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+}
+
+// ── Bootstrap ──────────────────────────────────────────────────────────────
+
+boot();
diff --git a/dist-lib/first-meet/index.html b/dist-lib/first-meet/index.html
new file mode 100644
index 000000000..befed6937
--- /dev/null
+++ b/dist-lib/first-meet/index.html
@@ -0,0 +1,319 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Meet Your Agent · 3D Agent</title>
+ <link rel="icon" href="/favicon.ico" />
+ <style>
+ :root {
+ color-scheme: dark;
+ --accent: #6a5cff;
+ --accent2: #ff5ca8;
+ --border: #22222e;
+ --bg: #0b0b10;
+ --panel: #14141c;
+ }
+ * {
+ box-sizing: border-box;
+ }
+ body {
+ font:
+ 15px/1.55 -apple-system,
+ system-ui,
+ Segoe UI,
+ Roboto,
+ sans-serif;
+ color: #eee;
+ margin: 0;
+ background: var(--bg);
+ min-height: 100vh;
+ }
+ a {
+ color: #9a8cff;
+ text-decoration: none;
+ }
+ .container {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ min-height: 100vh;
+ gap: 0;
+ }
+ .preview-col {
+ background: var(--panel);
+ border-right: 1px solid var(--border);
+ padding: 28px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ overflow: auto;
+ }
+ .preview-col model-viewer,
+ .preview-col agent-3d {
+ width: 100%;
+ height: 100%;
+ max-height: 600px;
+ border-radius: 8px;
+ background: linear-gradient(135deg, #1a1a24 0%, #0f0f14 100%);
+ }
+ .preview-col .loading,
+ .preview-col .error-msg {
+ text-align: center;
+ color: #aaa;
+ }
+ .form-col {
+ padding: 28px;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ max-width: 600px;
+ overflow: auto;
+ }
+ .form-col h1 {
+ font-size: 24px;
+ margin: 0 0 8px;
+ letter-spacing: -0.01em;
+ }
+ .form-col .sub {
+ color: #888;
+ font-size: 14px;
+ margin: 0 0 24px;
+ }
+ .step {
+ display: none;
+ }
+ .step.active {
+ display: block;
+ }
+ .form-group {
+ margin-bottom: 20px;
+ }
+ label {
+ display: block;
+ font-size: 14px;
+ font-weight: 500;
+ margin-bottom: 8px;
+ color: #ccc;
+ }
+ input[type='text'],
+ textarea,
+ select {
+ width: 100%;
+ padding: 10px 12px;
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ background: rgba(0, 0, 0, 0.3);
+ color: #eee;
+ font-size: 14px;
+ font-family: inherit;
+ transition:
+ border-color 0.2s,
+ background-color 0.2s;
+ }
+ input[type='text']:focus,
+ textarea:focus,
+ select:focus {
+ outline: none;
+ border-color: var(--accent);
+ background: rgba(0, 0, 0, 0.5);
+ }
+ textarea {
+ resize: vertical;
+ min-height: 80px;
+ }
+ .char-count {
+ font-size: 12px;
+ color: #666;
+ margin-top: 4px;
+ }
+ .buttons {
+ display: flex;
+ gap: 12px;
+ margin-top: 24px;
+ }
+ button {
+ flex: 1;
+ padding: 10px 16px;
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ background: rgba(106, 92, 255, 0.1);
+ color: #9a8cff;
+ font-size: 14px;
+ font-weight: 500;
+ cursor: pointer;
+ transition:
+ background-color 0.2s,
+ border-color 0.2s;
+ }
+ button:hover:not(:disabled) {
+ background: rgba(106, 92, 255, 0.2);
+ border-color: var(--accent);
+ }
+ button:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ button.primary {
+ background: var(--accent);
+ color: #000;
+ border-color: var(--accent);
+ }
+ button.primary:hover:not(:disabled) {
+ background: #7b6dff;
+ }
+ .skip-btn {
+ flex: 0;
+ padding: 10px 20px;
+ background: transparent;
+ color: #666;
+ border: none;
+ }
+ .skip-btn:hover {
+ color: #aaa;
+ background: transparent;
+ }
+ .progress {
+ height: 3px;
+ background: var(--border);
+ border-radius: 2px;
+ margin-bottom: 20px;
+ overflow: hidden;
+ }
+ .progress-bar {
+ height: 100%;
+ background: var(--accent);
+ transition: width 0.3s ease;
+ }
+ .greeting-text {
+ text-align: center;
+ margin: 20px 0;
+ font-size: 16px;
+ color: #aaa;
+ font-style: italic;
+ }
+ .grid-2col {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 12px;
+ }
+ .grid-2col .form-group {
+ margin-bottom: 0;
+ }
+ @media (max-width: 900px) {
+ .container {
+ grid-template-columns: 1fr;
+ }
+ .preview-col {
+ min-height: 300px;
+ border-right: none;
+ border-bottom: 1px solid var(--border);
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <div class="preview-col">
+ <div id="preview-content">
+ <div class="loading">Loading avatar…</div>
+ </div>
+ </div>
+ <div class="form-col">
+ <div class="progress">
+ <div class="progress-bar" id="progress-bar"></div>
+ </div>
+
+ <!-- Step 1: Name -->
+ <div class="step active" id="step-name">
+ <h1>Name your agent</h1>
+ <p class="sub">Give your avatar a name. You can change it later.</p>
+ <div class="form-group">
+ <input
+ type="text"
+ id="name-input"
+ placeholder="My Agent"
+ minlength="2"
+ maxlength="40"
+ autofocus
+ />
+ <div class="char-count"><span id="name-count">0</span>/40</div>
+ </div>
+ <div class="buttons">
+ <button class="primary" id="name-next">Next</button>
+ <button class="skip-btn" id="name-skip">Skip</button>
+ </div>
+ </div>
+
+ <!-- Step 2: Bio -->
+ <div class="step" id="step-bio">
+ <h1>Tell us about your agent</h1>
+ <p class="sub">Add a short bio (optional). Max 280 characters.</p>
+ <div class="form-group">
+ <textarea
+ id="bio-input"
+ placeholder="What should people know about this agent?"
+ maxlength="280"
+ ></textarea>
+ <div class="char-count"><span id="bio-count">0</span>/280</div>
+ </div>
+ <div class="buttons">
+ <button class="primary" id="bio-next">Next</button>
+ <button id="bio-back">Back</button>
+ </div>
+ </div>
+
+ <!-- Step 3: Voice + Body Type -->
+ <div class="step" id="step-voice">
+ <h1>Voice & appearance</h1>
+ <p class="sub">Choose how your agent communicates and looks.</p>
+ <div class="form-group">
+ <label for="voice-select">Voice</label>
+ <select id="voice-select">
+ <option value="en-US-female">US Female</option>
+ <option value="en-US-male">US Male</option>
+ <option value="en-GB-female">British Female</option>
+ <option value="en-GB-male">British Male</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="body-type-select">Body type</label>
+ <select id="body-type-select">
+ <option value="neutral">Neutral</option>
+ <option value="feminine">Feminine</option>
+ <option value="masculine">Masculine</option>
+ </select>
+ </div>
+ <div class="buttons">
+ <button class="primary" id="voice-next">Next</button>
+ <button id="voice-back">Back</button>
+ </div>
+ </div>
+
+ <!-- Step 4: Greet -->
+ <div class="step" id="step-greet">
+ <h1>Meet your agent</h1>
+ <p class="sub">Your agent is ready to say hello.</p>
+ <div class="greeting-text" id="greeting-text">Listening…</div>
+ <div class="buttons">
+ <button class="primary" id="greet-next">Continue</button>
+ </div>
+ </div>
+
+ <!-- Step 5: Done -->
+ <div class="step" id="step-done">
+ <h1>All set!</h1>
+ <p class="sub">Your agent is ready to go.</p>
+ <div class="buttons">
+ <button class="primary" id="done-agent">Go to my agent</button>
+ <button id="done-dashboard">Back to dashboard</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <script src="/dist-lib/agent-3d.js" type="module"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"></script>
+ <script type="module" src="./first-meet.js"></script>
+ </body>
+</html>
diff --git a/dist-lib/hydrate/index.html b/dist-lib/hydrate/index.html
new file mode 100644
index 000000000..93e9d4ac8
--- /dev/null
+++ b/dist-lib/hydrate/index.html
@@ -0,0 +1,465 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Import My Agents</title>
+ <style>
+ :root {
+ --primary: #0066cc;
+ --primary-dark: #0052a3;
+ --gray-100: #f5f5f5;
+ --gray-200: #e0e0e0;
+ --gray-700: #333;
+ --error: #d32f2f;
+ --success: #388e3c;
+ }
+
+ * {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ }
+
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
+ background: var(--gray-100);
+ color: var(--gray-700);
+ min-height: 100vh;
+ padding: 20px;
+ }
+
+ .container {
+ max-width: 800px;
+ margin: 0 auto;
+ background: white;
+ border-radius: 8px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+ padding: 40px;
+ }
+
+ h1 {
+ margin-bottom: 10px;
+ font-size: 28px;
+ }
+
+ .subtitle {
+ color: #666;
+ margin-bottom: 30px;
+ font-size: 14px;
+ }
+
+ .alert {
+ padding: 16px;
+ border-radius: 4px;
+ margin-bottom: 24px;
+ display: none;
+ }
+
+ .alert.show {
+ display: block;
+ }
+
+ .alert.error {
+ background: #ffebee;
+ color: var(--error);
+ border-left: 4px solid var(--error);
+ }
+
+ .alert.success {
+ background: #e8f5e9;
+ color: var(--success);
+ border-left: 4px solid var(--success);
+ }
+
+ .alert.info {
+ background: #e3f2fd;
+ color: var(--primary);
+ border-left: 4px solid var(--primary);
+ }
+
+ .auth-prompt {
+ text-align: center;
+ padding: 40px 20px;
+ }
+
+ .auth-prompt p {
+ margin-bottom: 20px;
+ color: #666;
+ }
+
+ .button {
+ display: inline-block;
+ padding: 12px 24px;
+ border-radius: 4px;
+ border: none;
+ font-size: 14px;
+ font-weight: 600;
+ cursor: pointer;
+ text-decoration: none;
+ text-align: center;
+ transition: all 0.2s;
+ }
+
+ .button.primary {
+ background: var(--primary);
+ color: white;
+ }
+
+ .button.primary:hover {
+ background: var(--primary-dark);
+ }
+
+ .button.secondary {
+ background: var(--gray-200);
+ color: var(--gray-700);
+ }
+
+ .button.secondary:hover {
+ background: var(--gray-300);
+ }
+
+ .button:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ .agents-list {
+ display: none;
+ }
+
+ .agent-card {
+ border: 1px solid var(--gray-200);
+ border-radius: 6px;
+ padding: 16px;
+ margin-bottom: 16px;
+ display: flex;
+ gap: 16px;
+ align-items: flex-start;
+ }
+
+ .agent-image {
+ width: 80px;
+ height: 80px;
+ background: var(--gray-100);
+ border-radius: 4px;
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 12px;
+ color: #999;
+ overflow: hidden;
+ }
+
+ .agent-image img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+
+ .agent-info {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .agent-header {
+ display: flex;
+ align-items: baseline;
+ gap: 8px;
+ margin-bottom: 4px;
+ }
+
+ .agent-name {
+ font-size: 16px;
+ font-weight: 600;
+ color: var(--gray-700);
+ }
+
+ .chain-badge {
+ display: inline-block;
+ background: var(--gray-100);
+ color: #666;
+ padding: 2px 8px;
+ border-radius: 3px;
+ font-size: 12px;
+ font-weight: 500;
+ }
+
+ .agent-description {
+ color: #666;
+ font-size: 14px;
+ line-height: 1.4;
+ margin-bottom: 8px;
+ }
+
+ .agent-id {
+ color: #999;
+ font-size: 12px;
+ font-family: monospace;
+ }
+
+ .agent-actions {
+ display: flex;
+ gap: 8px;
+ margin-top: 12px;
+ }
+
+ .button-small {
+ padding: 6px 12px;
+ font-size: 12px;
+ }
+
+ .import-link {
+ color: var(--primary);
+ text-decoration: none;
+ font-weight: 600;
+ font-size: 12px;
+ }
+
+ .import-link:hover {
+ text-decoration: underline;
+ }
+
+ .loading {
+ text-align: center;
+ padding: 40px;
+ color: #666;
+ }
+
+ .spinner {
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ border: 2px solid var(--gray-200);
+ border-top-color: var(--primary);
+ border-radius: 50%;
+ animation: spin 0.6s linear infinite;
+ margin-right: 10px;
+ vertical-align: middle;
+ }
+
+ @keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
+ .empty-state {
+ text-align: center;
+ padding: 60px 20px;
+ }
+
+ .empty-state p {
+ color: #666;
+ margin-bottom: 20px;
+ }
+
+ .breadcrumb {
+ font-size: 12px;
+ color: #999;
+ margin-bottom: 20px;
+ }
+
+ .breadcrumb a {
+ color: var(--primary);
+ text-decoration: none;
+ }
+
+ .breadcrumb a:hover {
+ text-decoration: underline;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <div class="breadcrumb">
+ <a href="/">Home</a> / <a href="/dashboard/">Dashboard</a> / Import Agents
+ </div>
+
+ <h1>Import My Agents</h1>
+ <p class="subtitle">
+ Discover and import agents you've already registered on-chain
+ </p>
+
+ <div id="alert" class="alert"></div>
+
+ <div id="authPrompt" class="auth-prompt" style="display: none">
+ <p>
+ To import your on-chain agents, you need to
+ <strong>connect a wallet</strong> first.
+ </p>
+ <a href="/dashboard/wallets.html" class="button primary">Connect Wallet</a>
+ </div>
+
+ <div id="loadingState" class="loading" style="display: none">
+ <span class="spinner"></span> Fetching your agents…
+ </div>
+
+ <div id="agentsList" class="agents-list"></div>
+
+ <div id="emptyState" class="empty-state" style="display: none">
+ <p>No on-chain agents found for your wallets.</p>
+ <p style="font-size: 12px; color: #999">
+ Register a new agent at <a href="/deploy" style="color: var(--primary)">Deploy</a>
+ </p>
+ </div>
+ </div>
+
+ <script type="module">
+ const alertEl = document.getElementById('alert');
+ const authPrompt = document.getElementById('authPrompt');
+ const loadingState = document.getElementById('loadingState');
+ const agentsList = document.getElementById('agentsList');
+ const emptyState = document.getElementById('emptyState');
+
+ function showAlert(message, type = 'info') {
+ alertEl.textContent = message;
+ alertEl.className = `alert show ${type}`;
+ if (type === 'error') {
+ console.error('[hydrate]', message);
+ }
+ }
+
+ function hideAlert() {
+ alertEl.className = 'alert';
+ }
+
+ async function checkAuth() {
+ try {
+ const res = await fetch('/api/auth/wallets', {
+ credentials: 'include',
+ });
+
+ if (res.status === 401) {
+ // Not authenticated
+ return { authenticated: false, wallets: [] };
+ }
+
+ const data = await res.json();
+ return {
+ authenticated: true,
+ wallets: data.wallets || [],
+ };
+ } catch (err) {
+ console.error('[hydrate] auth check failed', err);
+ return { authenticated: false, wallets: [] };
+ }
+ }
+
+ async function loadAgents() {
+ const auth = await checkAuth();
+
+ if (!auth.authenticated) {
+ authPrompt.style.display = 'block';
+ return;
+ }
+
+ if (auth.wallets.length === 0) {
+ authPrompt.style.display = 'block';
+ return;
+ }
+
+ loadingState.style.display = 'block';
+
+ try {
+ const { fetchDiscoveredAgents } = await import('/src/erc8004/hydrate.js');
+ const agents = await fetchDiscoveredAgents();
+
+ loadingState.style.display = 'none';
+
+ if (agents.length === 0) {
+ emptyState.style.display = 'block';
+ return;
+ }
+
+ renderAgents(agents);
+ agentsList.style.display = 'block';
+ } catch (err) {
+ loadingState.style.display = 'none';
+ showAlert(`Failed to load agents: ${err.message}`, 'error');
+ }
+ }
+
+ function renderAgents(agents) {
+ agentsList.innerHTML = agents
+ .map(
+ (agent) => `
+ <div class="agent-card">
+ <div class="agent-image">
+ ${
+ agent.image
+ ? `<img src="${escapeHtml(agent.image)}" alt="${escapeHtml(agent.name)}" />`
+ : '📦'
+ }
+ </div>
+ <div class="agent-info">
+ <div class="agent-header">
+ <div class="agent-name">${escapeHtml(agent.name)}</div>
+ <span class="chain-badge">Chain ${agent.chainId}</span>
+ </div>
+ ${
+ agent.description
+ ? `<p class="agent-description">${escapeHtml(agent.description)}</p>`
+ : ''
+ }
+ <div class="agent-id">Agent ID: ${escapeHtml(agent.agentId)}</div>
+ </div>
+ <div class="agent-actions">
+ ${
+ agent.alreadyImported
+ ? `<a href="/dashboard/?agent=${escapeHtml(agent.id)}" class="import-link">Go to agent →</a>`
+ : `<button class="button primary button-small" data-chain="${agent.chainId}" data-id="${escapeHtml(agent.agentId)}">Import</button>`
+ }
+ </div>
+ </div>
+ `,
+ )
+ .join('');
+
+ // Attach import handlers
+ document.querySelectorAll('[data-chain]').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ importAgent(btn.dataset.chain, btn.dataset.id, btn);
+ });
+ });
+ }
+
+ async function importAgent(chainId, agentId, button) {
+ button.disabled = true;
+ const originalText = button.textContent;
+ button.innerHTML = '<span class="spinner"></span> Importing…';
+ hideAlert();
+
+ try {
+ const { importAgent: doImport } = await import('/src/erc8004/hydrate.js');
+ const agent = await doImport({
+ chainId: parseInt(chainId),
+ agentId,
+ });
+
+ showAlert(`Successfully imported ${agent.name}!`, 'success');
+
+ // Replace button with link after a brief delay
+ setTimeout(() => {
+ button.outerHTML = `<a href="/dashboard/?agent=${escapeHtml(agent.id)}" class="import-link">Go to agent →</a>`;
+ }, 1000);
+ } catch (err) {
+ showAlert(`Import failed: ${err.message}`, 'error');
+ button.disabled = false;
+ button.textContent = originalText;
+ }
+ }
+
+ function escapeHtml(text) {
+ if (!text) return '';
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+ }
+
+ // Load on page load
+ loadAgents();
+ </script>
+ </body>
+</html>
diff --git a/dist-lib/lobehub/README.md b/dist-lib/lobehub/README.md
new file mode 100644
index 000000000..96fea959e
--- /dev/null
+++ b/dist-lib/lobehub/README.md
@@ -0,0 +1,74 @@
+# 3D Agent — LobeHub Plugin
+
+Embeds a rigged 3D avatar agent into any LobeHub instance via the plugin manifest + iframe bridge.
+
+## Install into a LobeHub fork
+
+1. Open your LobeHub instance → Settings → Plugins → Custom Plugin.
+2. Enter the manifest URL: `https://3dagent.vercel.app/api/lobehub/manifest`
+3. Install. LobeHub fetches the manifest, registers the four tools (`render_agent`, `speak`, `gesture`, `emote`), and renders the iframe at `/lobehub/iframe/` inside chat messages.
+4. Optionally pre-validate an agent before rendering: `POST /api/lobehub/handshake` with `{ agentId, hostOrigin }`.
+
+## postMessage contract
+
+All messages share the envelope:
+
+```json
+{ "v": 1, "ns": "3d-agent", "type": "<string>", "id": "<optional>", "payload": {} }
+```
+
+### Host → embed (inbound)
+
+| type | payload | effect |
+| ---------------- | --------------------------------------------------- | ----------------------------- |
+| `host:hello` | `{ hostName, hostVersion, capabilities }` | Triggers `embed:hello` reply |
+| `host:ping` | `{}` | Triggers `embed:pong` reply |
+| `host:action` | `{ action: { type, payload } }` | Dispatches to avatar |
+| `host:pause` | `{}` | Pauses the viewer |
+| `host:resume` | `{}` | Resumes the viewer |
+| `host:theme` | `{ mode: 'dark'\|'light'\|'transparent', accent? }` | Sets background + accent |
+| `host:set-agent` | `{ agentId }` | Reloads iframe with new agent |
+
+Accepted action types for `host:action.action.type`: `speak`, `gesture`, `emote`.
+
+### Embed → host (outbound)
+
+| type | payload | when |
+| --------------- | --------------------------------------------------- | ----------------------------------- |
+| `embed:hello` | `{ embedVersion, agentId, capabilities }` | On load and on `host:hello` |
+| `embed:ready` | `{ agentId, name, avatarUrl }` | Avatar fully loaded |
+| `embed:blocked` | `{ reason }` | Embed-policy check failed |
+| `embed:error` | `{ code, message, phase }` | Boot or runtime error |
+| `embed:action` | `{ action: { type, payload, timestamp, agentId } }` | Mirrors every dispatched action |
+| `embed:resize` | `{ width, height, contentHeight }` | On element resize (debounced 100ms) |
+| `embed:pong` | `{}` | Reply to `host:ping` |
+
+### Origin rules
+
+- `chat.lobehub.com` and `lobechat.ai` are trusted unconditionally.
+- Pass `?host=<encoded-origin>` to narrow trust to a single parent origin.
+- `localhost` / `127.0.0.1` / `.local` are trusted in development (logged, not blocked).
+- Unknown origins are permitted but logged — public agents may embed anywhere.
+
+### Legacy compat
+
+The format `{ __agent: <id>, type: 'action', action }` from existing embedders is accepted for one version. Migrate to the v1 envelope.
+
+## Acceptance-test handshake
+
+For quick integration testing, posting `{ type: 'handshake' }` from any origin returns `{ type: 'ready', agentId }` without envelope wrapping. This is NOT the production protocol.
+
+## What this plugin does NOT yet support
+
+- **Host-auth / SIWE** — embedding a user-auth token so the iframe can call authed APIs on behalf of the LobeHub user (spec: `prompts/lobehub-embed/03-host-auth-handoff.md`).
+- **Tool-call relay** — structured LobeHub `tool_call` → action mapping; today the relay passes raw action objects (spec: `prompts/lobehub-embed/04-action-passthrough.md`).
+- **LobeHub marketplace submission** — the manifest is hosted in this repo; no registry entry exists yet (spec: `prompts/lobehub-embed/05-plugin-submission.md`).
+- **MCP tool semantics** — the `api` entries point at `/api/mcp` but the `tool` dispatch mapping from LobeHub's tool-call format to MCP JSON-RPC is not wired.
+- **Emote public API** — `host:action` with `type: emote` dispatches a `CustomEvent` on the element but `<agent-3d>` has no public `emote()` method; internal routing depends on element.js wiring.
+
+## Related specs
+
+- `prompts/lobehub-embed/01-plugin-manifest.md` — manifest design
+- `prompts/lobehub-embed/02-iframe-handshake.md` — full postMessage protocol
+- `prompts/lobehub-embed/03-host-auth-handoff.md` — auth handoff (not yet implemented)
+- `prompts/lobehub-embed/04-action-passthrough.md` — tool relay (not yet implemented)
diff --git a/dist-lib/lobehub/iframe/boot.js b/dist-lib/lobehub/iframe/boot.js
new file mode 100644
index 000000000..54e0011bf
--- /dev/null
+++ b/dist-lib/lobehub/iframe/boot.js
@@ -0,0 +1,240 @@
+// LobeHub iframe postMessage bridge for 3D Agent.
+// Envelope: { v: 1, ns: '3d-agent', type, id?, payload }
+// See public/lobehub/README.md for full contract.
+
+const NS = '3d-agent';
+const V = 1;
+const EMBED_VERSION = '0.1.0';
+
+// Origins trusted unconditionally (no ?host= needed).
+const KNOWN_ORIGINS = new Set(['https://chat.lobehub.com', 'https://lobechat.ai']);
+
+function isDev(origin) {
+ try {
+ const h = new URL(origin).hostname;
+ return h === 'localhost' || h === '127.0.0.1' || h.endsWith('.local') || h === '0.0.0.0';
+ } catch {
+ return false;
+ }
+}
+
+const params = new URL(location.href).searchParams;
+const agentId = params.get('agent') || '';
+
+// ?host=<encoded-origin> narrows the allowed parent to a single origin.
+let allowedOrigin = null;
+const hostParam = params.get('host');
+if (hostParam) {
+ try {
+ allowedOrigin = new URL(decodeURIComponent(hostParam)).origin;
+ } catch {
+ console.warn('[3d-agent:bridge] invalid ?host param');
+ }
+}
+
+function isAllowedOrigin(origin) {
+ if (!origin) return false;
+ if (allowedOrigin) return origin === allowedOrigin;
+ if (KNOWN_ORIGINS.has(origin)) return true;
+ if (isDev(origin)) return true;
+ // Permit unlisted origins but log — public agents may embed anywhere.
+ console.warn('[3d-agent:bridge] message from unlisted origin', origin);
+ return true;
+}
+
+function postToHost(type, payload, replyId) {
+ const msg = { v: V, ns: NS, type, payload: payload ?? {} };
+ if (replyId !== undefined) msg.id = replyId;
+ const target = allowedOrigin || '*';
+ try {
+ window.parent.postMessage(msg, target);
+ } catch {}
+}
+
+// ── Element wiring ────────────────────────────────────────────────────────────
+
+const el = document.getElementById('agent');
+const statusEl = document.getElementById('status');
+
+function setStatus(text) {
+ if (statusEl) statusEl.textContent = text;
+}
+
+if (agentId) {
+ el.setAttribute('agent-id', agentId);
+} else {
+ setStatus('No agent specified — add ?agent=<id> to the URL.');
+}
+
+el.addEventListener('agent:ready', (ev) => {
+ const { manifest } = ev.detail || {};
+ if (statusEl) statusEl.style.display = 'none';
+ postToHost('embed:ready', {
+ agentId,
+ name: manifest?.meta?.name || manifest?.name || '',
+ avatarUrl: manifest?.body?.url || '',
+ });
+});
+
+el.addEventListener('agent:error', (ev) => {
+ const { phase, error: err } = ev.detail || {};
+ setStatus(err?.message || 'Error loading agent');
+ postToHost('embed:error', {
+ code: err?.code || 'load_error',
+ message: err?.message || 'Agent failed to load',
+ phase: phase || 'boot',
+ });
+});
+
+// ── ResizeObserver → embed:resize (debounced 100ms) ──────────────────────────
+
+if (typeof ResizeObserver !== 'undefined') {
+ let resizeTimer;
+ const ro = new ResizeObserver(() => {
+ clearTimeout(resizeTimer);
+ resizeTimer = setTimeout(() => {
+ postToHost('embed:resize', {
+ width: el.offsetWidth,
+ height: el.offsetHeight,
+ contentHeight: el.scrollHeight,
+ });
+ }, 100);
+ });
+ ro.observe(el);
+}
+
+// ── Action dispatch ───────────────────────────────────────────────────────────
+
+async function dispatchAction(action) {
+ if (!action || !action.type) return;
+ try {
+ switch (action.type) {
+ case 'speak':
+ await el.say?.(action.payload?.text || '', {
+ sentiment: action.payload?.sentiment,
+ });
+ break;
+ case 'gesture':
+ if (action.payload?.name === 'wave') {
+ await el.wave?.();
+ } else {
+ await el.play?.(action.payload?.name, { duration: action.payload?.duration });
+ }
+ break;
+ case 'emote':
+ // TODO(lobehub-spec): <agent-3d> has no direct emote() public method.
+ // Dispatching as a CustomEvent; element.js may not consume it without
+ // a corresponding listener. Confirm with src/element.js maintainer.
+ el.dispatchEvent(new CustomEvent('agent:action', { detail: action }));
+ break;
+ default:
+ el.dispatchEvent(new CustomEvent('agent:action', { detail: action }));
+ }
+ // Mirror action up to host so it can log what the avatar did.
+ postToHost('embed:action', {
+ action: { ...action, timestamp: Date.now(), agentId },
+ });
+ } catch (err) {
+ console.warn('[3d-agent:bridge] action dispatch failed', err);
+ }
+}
+
+// ── Theme ─────────────────────────────────────────────────────────────────────
+
+function applyTheme({ mode, accent } = {}) {
+ if (mode === 'dark') document.body.style.background = '#0b0d10';
+ else if (mode === 'light') document.body.style.background = '#f5f5f5';
+ else if (mode === 'transparent') document.body.style.background = 'transparent';
+ if (accent) document.documentElement.style.setProperty('--agent-accent', accent);
+}
+
+// ── postMessage handler ───────────────────────────────────────────────────────
+
+function onMessage(ev) {
+ const { origin, data } = ev;
+ if (!data || typeof data !== 'object') return;
+
+ // Acceptance-test handshake: { type: 'handshake' } → { type: 'ready' }
+ if (data.type === 'handshake') {
+ try {
+ window.parent.postMessage({ type: 'ready', agentId }, ev.origin || '*');
+ } catch {}
+ return;
+ }
+
+ // Legacy compat: { __agent, type: 'action', action } — deprecated, one version support.
+ if (data.__agent !== undefined) {
+ if (data.__agent === agentId && data.type === 'action' && data.action) {
+ console.warn('[3d-agent:bridge] legacy message format — migrate to v1 envelope');
+ dispatchAction(data.action);
+ }
+ return;
+ }
+
+ if (!isAllowedOrigin(origin)) return;
+
+ // v1 envelope validation
+ if (data.v !== V || data.ns !== NS || !data.type) return;
+ const { type, id, payload = {} } = data;
+ console.log('[3d-agent:bridge] recv', type, payload);
+
+ switch (type) {
+ case 'host:hello':
+ postToHost(
+ 'embed:hello',
+ {
+ embedVersion: EMBED_VERSION,
+ agentId,
+ capabilities: [
+ 'speak',
+ 'gesture',
+ 'emote',
+ 'theme',
+ 'resize',
+ 'pause',
+ 'resume',
+ 'set-agent',
+ ],
+ },
+ id,
+ );
+ break;
+
+ case 'host:ping':
+ postToHost('embed:pong', {}, id);
+ break;
+
+ case 'host:action':
+ if (payload.action) dispatchAction(payload.action);
+ break;
+
+ case 'host:pause':
+ el.pause?.();
+ break;
+
+ case 'host:resume':
+ el.resume?.();
+ break;
+
+ case 'host:theme':
+ applyTheme(payload);
+ break;
+
+ case 'host:set-agent':
+ if (payload.agentId && payload.agentId !== agentId) {
+ const url = new URL(location.href);
+ url.searchParams.set('agent', payload.agentId);
+ location.replace(url.toString());
+ }
+ break;
+ }
+}
+
+window.addEventListener('message', onMessage);
+
+// Fire initial hello so host knows the iframe is alive.
+postToHost('embed:hello', {
+ embedVersion: EMBED_VERSION,
+ agentId,
+ capabilities: ['speak', 'gesture', 'emote', 'theme', 'resize', 'pause', 'resume', 'set-agent'],
+});
diff --git a/dist-lib/lobehub/iframe/index.html b/dist-lib/lobehub/iframe/index.html
new file mode 100644
index 000000000..c15054522
--- /dev/null
+++ b/dist-lib/lobehub/iframe/index.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>3D Agent — LobeHub Embed</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <meta name="robots" content="noindex" />
+ <style>
+ html,
+ body {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+ background: transparent;
+ overflow: hidden;
+ }
+ agent-3d {
+ display: block;
+ width: 100%;
+ height: 100%;
+ }
+ #status {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: rgba(255, 255, 255, 0.4);
+ font:
+ 13px system-ui,
+ sans-serif;
+ pointer-events: none;
+ }
+ </style>
+ <!--
+ TODO(lobehub-sdk): Replace with versioned CDN URL once agent-3d releases are
+ published to /agent-3d/latest/. Dev: run `npm run build:lib` then serve
+ dist-lib/ under /agent-3d/latest/.
+ TODO(lobehub-spec): Confirm LobeHub sandbox CSP allows module scripts from
+ cross-origin CDN, or switch to a bundled inline approach.
+ -->
+ <script
+ type="module"
+ src="https://3dagent.vercel.app/agent-3d/latest/agent-3d.js"
+ crossorigin
+ ></script>
+ </head>
+ <body>
+ <div id="status">Loading…</div>
+ <!-- agent-id is set dynamically by boot.js from ?agent= param -->
+ <agent-3d id="agent" kiosk eager></agent-3d>
+ <script type="module" src="./boot.js"></script>
+ </body>
+</html>
diff --git a/dist-lib/lobehub/plugin.json b/dist-lib/lobehub/plugin.json
new file mode 100644
index 000000000..315832063
--- /dev/null
+++ b/dist-lib/lobehub/plugin.json
@@ -0,0 +1,98 @@
+{
+ "$schema": "https://lobehub.com/schema/plugin-manifest/v1.json",
+ "identifier": "3d-agent",
+ "version": "0.1.0",
+ "author": "3D Agent",
+ "homepage": "https://3dagent.vercel.app",
+ "meta": {
+ "title": "3D Agent",
+ "description": "Embodied 3D avatar agent with continuous emotion blending. Renders a rigged glTF avatar inside chat, responds with gestures, speech, and on-chain ERC-8004 identity.",
+ "avatar": "https://3dagent.vercel.app/icon.svg",
+ "tags": ["3d", "avatar", "agent", "embodied", "empathy", "erc-8004"]
+ },
+ "ui": {
+ "url": "https://3dagent.vercel.app/lobehub/iframe/",
+ "height": 480
+ },
+ "api": [
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "render_agent",
+ "description": "Mount the 3D avatar for a given agent id. Call this first to bind the iframe to a specific agent before using speak/gesture/emote.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "agentId": {
+ "type": "string",
+ "description": "Agent identity id (UUID) to render."
+ }
+ },
+ "required": ["agentId"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "speak",
+ "description": "Make the avatar speak with optional emotional valence.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "text": {
+ "type": "string",
+ "description": "Text for the avatar to speak aloud."
+ },
+ "sentiment": {
+ "type": "number",
+ "description": "Emotional valence in [-1, 1]. Negative → concern, positive → celebration.",
+ "minimum": -1,
+ "maximum": 1
+ }
+ },
+ "required": ["text"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "gesture",
+ "description": "Trigger a named gesture on the avatar.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Gesture to play.",
+ "enum": ["wave", "nod", "point", "shrug"]
+ },
+ "duration": {
+ "type": "number",
+ "description": "Gesture duration in seconds (optional)."
+ }
+ },
+ "required": ["name"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "emote",
+ "description": "Inject an emotion into the avatar's continuous Empathy Layer blend.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "trigger": {
+ "type": "string",
+ "description": "Emotion to inject.",
+ "enum": ["concern", "celebration", "patience", "curiosity", "empathy"]
+ },
+ "weight": {
+ "type": "number",
+ "description": "Blend weight in [0, 1] (defaults to 1).",
+ "minimum": 0,
+ "maximum": 1
+ }
+ },
+ "required": ["trigger"]
+ }
+ }
+ ],
+ "systemRole": "You have an embodied 3D avatar agent visible in the chat. It displays emotional responses in real time using a continuous Empathy Layer blend. Use render_agent to bind it to a specific agent, speak to give it voice with emotional valence, gesture for physical expression, and emote to inject emotional state directly into its blend."
+}
diff --git a/dist-lib/login.html b/dist-lib/login.html
index 6e5c3f747..6899653f6 100644
--- a/dist-lib/login.html
+++ b/dist-lib/login.html
@@ -34,8 +34,8 @@
<p class="brand">3D Agent</p>
<h1>Welcome back</h1>
<p class="sub">Sign in to manage your avatars.</p>
- <label for="email">Email</label>
- <input id="email" type="email" autocomplete="email" required>
+ <label for="email">Email or username</label>
+ <input id="email" type="text" autocomplete="username email" required>
<label for="password">Password</label>
<input id="password" type="password" autocomplete="current-password" required minlength="10">
<button id="submit" type="submit">Sign in</button>
@@ -55,6 +55,12 @@
<script>
const params = new URLSearchParams(location.search);
const next = params.get('next') || '/dashboard/';
+
+// If already signed in, skip the login form entirely.
+fetch('/api/auth/me', { credentials: 'include' })
+ .then(r => { if (r.ok) location.replace(next); })
+ .catch(() => {});
+
const form = document.getElementById('f');
const err = document.getElementById('err');
const btn = document.getElementById('submit');
diff --git a/dist-lib/register.html b/dist-lib/register.html
new file mode 100644
index 000000000..00e445dfb
--- /dev/null
+++ b/dist-lib/register.html
@@ -0,0 +1,74 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<title>Create account · 3D Agent</title>
+<link rel="icon" href="/favicon.ico">
+<style>
+ :root { color-scheme: dark; --accent:#6a5cff; --accent2:#ff5ca8; }
+ * { box-sizing: border-box; }
+ body { font: 15px/1.5 -apple-system,system-ui,Segoe UI,Roboto,sans-serif; background:radial-gradient(1200px 600px at 50% -100px,#1a1a2e 0,#080814 60%); color:#eee; margin:0; min-height:100vh; display:grid; place-items:center; padding:24px; }
+ a { color:#9a8cff; }
+ .card { background:#14141c; border:1px solid #2a2a36; border-radius:16px; padding:32px; max-width:400px; width:100%; box-shadow:0 10px 40px rgba(0,0,0,.5); }
+ h1 { font-size:22px; margin:0 0 4px; letter-spacing:-0.01em; }
+ .sub { color:#888; margin:0 0 24px; font-size:14px; }
+ label { display:block; font-size:13px; color:#aaa; margin:14px 0 6px; }
+ input { width:100%; padding:11px 13px; background:#0f0f17; border:1px solid #2a2a36; border-radius:9px; color:#eee; font-size:15px; }
+ input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(106,92,255,.15); }
+ .hint { font-size:12px; color:#666; margin-top:4px; }
+ button { width:100%; margin-top:20px; padding:12px 16px; border:0; border-radius:10px; background:linear-gradient(135deg,var(--accent),var(--accent2)); color:#fff; font-weight:600; font-size:15px; cursor:pointer; }
+ button:disabled { opacity:.6; cursor:default; }
+ .err { margin-top:14px; padding:10px 12px; background:rgba(255,92,92,.1); border:1px solid rgba(255,92,92,.3); border-radius:8px; color:#ffb3b3; font-size:13px; display:none; }
+ .foot { margin-top:20px; text-align:center; font-size:13px; color:#888; }
+ .brand { font-size:12px; letter-spacing:.1em; text-transform:uppercase; color:var(--accent); margin:0 0 8px; }
+</style>
+</head>
+<body>
+<form class="card" id="f">
+ <p class="brand">3D Agent</p>
+ <h1>Create account</h1>
+ <p class="sub">Pick a username and password — no email needed.</p>
+ <label for="username">Username</label>
+ <input id="username" type="text" autocomplete="username" required minlength="3" maxlength="30" pattern="[a-zA-Z0-9_-]+" placeholder="e.g. cool_agent">
+ <p class="hint">3–30 characters, letters, numbers, _ or -</p>
+ <label for="password">Password</label>
+ <input id="password" type="password" autocomplete="new-password" required minlength="10" maxlength="200">
+ <p class="hint">Minimum 10 characters</p>
+ <button id="submit" type="submit">Create account</button>
+ <div class="err" id="err"></div>
+ <p class="foot">Already have an account? <a href="/login">Sign in</a></p>
+</form>
+<script>
+const params = new URLSearchParams(location.search);
+const next = params.get('next') || '/dashboard/';
+const form = document.getElementById('f');
+const err = document.getElementById('err');
+const btn = document.getElementById('submit');
+form.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ err.style.display = 'none';
+ btn.disabled = true; btn.textContent = 'Creating account…';
+ try {
+ const res = await fetch('/api/auth/register', {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ username: document.getElementById('username').value,
+ password: document.getElementById('password').value,
+ }),
+ });
+ const data = await res.json();
+ if (!res.ok) throw new Error(data.error_description || 'Registration failed');
+ try { localStorage.setItem('3dagent:auth-hint', JSON.stringify({ authed: true, ts: Date.now() })); } catch { /* ignore */ }
+ location.href = next;
+ } catch (e) {
+ err.textContent = e.message;
+ err.style.display = 'block';
+ btn.disabled = false; btn.textContent = 'Create account';
+ }
+});
+</script>
+</body>
+</html>
diff --git a/dist-lib/reputation/index.html b/dist-lib/reputation/index.html
new file mode 100644
index 000000000..86fe7af1c
--- /dev/null
+++ b/dist-lib/reputation/index.html
@@ -0,0 +1,395 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <title>Agent Reputation — 3D Agent</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
+ <meta name="description" content="View and submit reviews for on-chain agents." />
+ <meta name="theme-color" content="#0a0a0a" />
+
+ <link rel="shortcut icon" href="/favicon.ico" />
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet" />
+
+ <style>
+ * {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ }
+
+ html,
+ body {
+ background: #0a0a0a;
+ color: #e5e5e5;
+ font-family:
+ 'Inter',
+ -apple-system,
+ BlinkMacSystemFont,
+ 'Segoe UI',
+ sans-serif;
+ font-size: 16px;
+ line-height: 1.5;
+ height: 100%;
+ }
+
+ body {
+ overflow-y: auto;
+ overflow-x: hidden;
+ }
+
+ main {
+ max-width: 800px;
+ margin: 0 auto;
+ padding: 2rem 1.5rem;
+ min-height: 100vh;
+ }
+
+ h1,
+ h2,
+ h3 {
+ font-family:
+ 'Space Grotesk',
+ -apple-system,
+ BlinkMacSystemFont,
+ 'Segoe UI',
+ sans-serif;
+ font-weight: 600;
+ letter-spacing: -0.5px;
+ }
+
+ h1 {
+ font-size: 2rem;
+ }
+ h3 {
+ font-size: 1.125rem;
+ margin: 1.5rem 0 1rem;
+ }
+
+ a {
+ color: #a78bfa;
+ text-decoration: none;
+ }
+ a:hover {
+ color: #c4b5fd;
+ }
+
+ .rep-header {
+ margin-bottom: 2rem;
+ padding-bottom: 1.5rem;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
+ }
+
+ .rep-header h1 {
+ margin: 0 0 0.5rem 0;
+ }
+
+ .rep-header-meta {
+ color: rgba(229, 229, 229, 0.6);
+ font-size: 0.875rem;
+ }
+
+ .rep-stats {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
+ gap: 1rem;
+ margin-bottom: 2rem;
+ padding: 1.5rem;
+ background: rgba(139, 92, 246, 0.04);
+ border: 1px solid rgba(139, 92, 246, 0.1);
+ border-radius: 8px;
+ }
+
+ .rep-stat {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ }
+
+ .rep-stat-label {
+ font-size: 0.75rem;
+ text-transform: uppercase;
+ letter-spacing: 1px;
+ color: rgba(229, 229, 229, 0.5);
+ font-weight: 600;
+ }
+
+ .rep-stat-value {
+ font-size: 1.75rem;
+ font-weight: 700;
+ color: #e5e5e5;
+ font-family: 'Space Grotesk', monospace;
+ }
+
+ .rep-reviews {
+ margin-bottom: 2rem;
+ }
+
+ .rep-empty {
+ text-align: center;
+ color: rgba(229, 229, 229, 0.5);
+ padding: 2rem 1rem;
+ }
+
+ .rep-review-list {
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+ }
+
+ .rep-review-item {
+ padding: 1rem;
+ background: rgba(255, 255, 255, 0.02);
+ border: 1px solid rgba(255, 255, 255, 0.06);
+ border-radius: 6px;
+ transition:
+ background 0.15s,
+ border-color 0.15s;
+ }
+
+ .rep-review-item:hover {
+ background: rgba(255, 255, 255, 0.04);
+ border-color: rgba(255, 255, 255, 0.12);
+ }
+
+ .rep-review-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 0.5rem;
+ gap: 1rem;
+ }
+
+ .rep-reviewer {
+ font-weight: 500;
+ font-size: 0.875rem;
+ color: rgba(229, 229, 229, 0.7);
+ font-family: 'Courier New', monospace;
+ }
+
+ .rep-stars {
+ font-size: 0.875rem;
+ letter-spacing: 2px;
+ color: #fbbf24;
+ }
+
+ .rep-comment {
+ margin: 0.75rem 0;
+ color: rgba(229, 229, 229, 0.8);
+ font-size: 0.9375rem;
+ line-height: 1.6;
+ word-wrap: break-word;
+ white-space: pre-wrap;
+ }
+
+ .rep-review-footer {
+ display: flex;
+ gap: 0.75rem;
+ align-items: center;
+ font-size: 0.75rem;
+ }
+
+ .rep-review-footer a {
+ color: #a78bfa;
+ }
+
+ .rep-submit-form {
+ margin-top: 2.5rem;
+ padding: 1.5rem;
+ background: rgba(139, 92, 246, 0.04);
+ border: 1px solid rgba(139, 92, 246, 0.1);
+ border-radius: 8px;
+ }
+
+ .rep-form-group {
+ margin-bottom: 1.5rem;
+ }
+
+ .rep-form-group label {
+ display: block;
+ margin-bottom: 0.5rem;
+ font-weight: 500;
+ font-size: 0.875rem;
+ }
+
+ .rep-stars-input {
+ display: flex;
+ gap: 0.5rem;
+ margin-bottom: 0.5rem;
+ flex-wrap: wrap;
+ }
+
+ .rep-star-btn {
+ background: rgba(255, 255, 255, 0.08);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ color: rgba(229, 229, 229, 0.6);
+ font-size: 0.75rem;
+ padding: 0.5rem 0.75rem;
+ border-radius: 6px;
+ cursor: pointer;
+ transition: all 0.15s;
+ font-weight: 500;
+ }
+
+ .rep-star-btn:hover {
+ background: rgba(251, 191, 36, 0.1);
+ color: #fbbf24;
+ border-color: rgba(251, 191, 36, 0.3);
+ }
+
+ .rep-star-btn.selected {
+ background: rgba(251, 191, 36, 0.15);
+ color: #fbbf24;
+ border-color: rgba(251, 191, 36, 0.3);
+ }
+
+ textarea {
+ width: 100%;
+ padding: 0.75rem;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 6px;
+ color: #e5e5e5;
+ font-family: 'Inter', sans-serif;
+ font-size: 0.9375rem;
+ line-height: 1.5;
+ resize: vertical;
+ }
+
+ textarea:focus {
+ outline: none;
+ background: rgba(255, 255, 255, 0.08);
+ border-color: rgba(139, 92, 246, 0.3);
+ }
+
+ small {
+ display: block;
+ margin-top: 0.25rem;
+ color: rgba(229, 229, 229, 0.5);
+ font-size: 0.75rem;
+ }
+
+ .rep-submit-btn {
+ width: 100%;
+ padding: 0.875rem 1.5rem;
+ background: #8b5cf6;
+ border: 1px solid transparent;
+ color: #fff;
+ font-weight: 600;
+ font-size: 0.9375rem;
+ border-radius: 6px;
+ cursor: pointer;
+ transition: all 0.15s;
+ }
+
+ .rep-submit-btn:hover:not(:disabled) {
+ background: #7c3aed;
+ }
+
+ .rep-submit-btn:disabled {
+ opacity: 0.6;
+ cursor: not-allowed;
+ }
+
+ .rep-form-hint {
+ text-align: center;
+ color: rgba(229, 229, 229, 0.5);
+ }
+
+ #rep-rating {
+ display: none;
+ }
+
+ .rep-error {
+ padding: 2rem;
+ text-align: center;
+ background: rgba(255, 80, 80, 0.06);
+ border: 1px solid rgba(255, 80, 80, 0.2);
+ border-radius: 8px;
+ }
+
+ .rep-error h3 {
+ margin: 0 0 0.5rem 0;
+ color: rgba(255, 200, 200, 0.9);
+ }
+
+ .rep-error p {
+ color: rgba(255, 150, 150, 0.8);
+ margin: 0 0 1rem 0;
+ }
+
+ .rep-error button {
+ padding: 0.5rem 1.5rem;
+ background: rgba(255, 100, 100, 0.2);
+ border: 1px solid rgba(255, 100, 100, 0.3);
+ color: #ffc8c8;
+ border-radius: 4px;
+ cursor: pointer;
+ font-weight: 500;
+ }
+
+ .rep-success {
+ padding: 1rem;
+ background: rgba(100, 200, 100, 0.1);
+ border: 1px solid rgba(100, 200, 100, 0.3);
+ border-radius: 8px;
+ color: #86efac;
+ }
+
+ .rep-loading {
+ text-align: center;
+ padding: 2rem;
+ color: rgba(229, 229, 229, 0.5);
+ }
+
+ .spinner {
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ border: 2px solid rgba(139, 92, 246, 0.3);
+ border-top-color: #8b5cf6;
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
+ }
+
+ @keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
+ @media (max-width: 640px) {
+ main {
+ padding: 1rem;
+ }
+
+ .rep-stats {
+ grid-template-columns: repeat(3, 1fr);
+ gap: 0.75rem;
+ padding: 1rem;
+ }
+
+ .rep-stat-value {
+ font-size: 1.25rem;
+ }
+
+ .rep-review-header {
+ flex-direction: column;
+ align-items: flex-start;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <main id="app">
+ <div class="rep-loading">
+ <div class="spinner"></div>
+ <p>Loading reputation…</p>
+ </div>
+ </main>
+
+ <script type="module" src="./reputation.js"></script>
+ </body>
+</html>
diff --git a/dist-lib/reputation/reputation.js b/dist-lib/reputation/reputation.js
new file mode 100644
index 000000000..913d2a334
--- /dev/null
+++ b/dist-lib/reputation/reputation.js
@@ -0,0 +1,416 @@
+/**
+ * Reputation page logic — view agent scores and submit reviews.
+ * Imports from src/erc8004/reputation.js for contract interactions.
+ */
+
+import { getReputation, getRecentReviews, submitReputation } from '../../src/erc8004/reputation.js';
+import { JsonRpcProvider, BrowserProvider } from 'ethers';
+import { REGISTRY_DEPLOYMENTS } from '../../src/erc8004/abi.js';
+
+const CHAIN_NAMES = {
+ 1: 'Ethereum',
+ 10: 'Optimism',
+ 56: 'BSC',
+ 100: 'Gnosis',
+ 137: 'Polygon',
+ 250: 'Fantom',
+ 324: 'zkSync Era',
+ 1284: 'Moonbeam',
+ 5000: 'Mantle',
+ 8453: 'Base',
+ 42161: 'Arbitrum One',
+ 42220: 'Celo',
+ 43114: 'Avalanche',
+ 59144: 'Linea',
+ 534352: 'Scroll',
+ 97: 'BSC Testnet',
+ 11155111: 'Ethereum Sepolia',
+ 84532: 'Base Sepolia',
+ 421614: 'Arbitrum Sepolia',
+ 11155420: 'Optimism Sepolia',
+ 80002: 'Polygon Amoy',
+ 43113: 'Avalanche Fuji',
+};
+
+function getChainName(chainId) {
+ return CHAIN_NAMES[chainId] || `Chain ${chainId}`;
+}
+
+function getExplorerUrl(chainId, txHash) {
+ const base = {
+ 1: 'https://etherscan.io',
+ 10: 'https://optimistic.etherscan.io',
+ 56: 'https://bscscan.com',
+ 100: 'https://gnosisscan.io',
+ 137: 'https://polygonscan.com',
+ 250: 'https://ftmscan.com',
+ 324: 'https://explorer.zksync.io',
+ 1284: 'https://moonscan.io',
+ 5000: 'https://explorer.mantle.xyz',
+ 8453: 'https://basescan.org',
+ 42161: 'https://arbiscan.io',
+ 42220: 'https://explorer.celo.org',
+ 43114: 'https://snowscan.xyz',
+ 59144: 'https://lineascan.build',
+ 534352: 'https://scrollscan.com',
+ 97: 'https://testnet.bscscan.com',
+ 11155111: 'https://sepolia.etherscan.io',
+ 84532: 'https://sepolia.basescan.org',
+ 421614: 'https://sepolia.arbiscan.io',
+ 11155420: 'https://sepolia-optimism.etherscan.io',
+ 80002: 'https://amoy.polygonscan.com',
+ 43113: 'https://testnet.snowtrace.io',
+ }[chainId];
+ return base ? `${base}/tx/${txHash}` : null;
+}
+
+async function parseAgentId() {
+ const params = new URLSearchParams(window.location.search);
+ const agentParam = params.get('agent');
+
+ if (!agentParam) {
+ throw new Error('Missing ?agent=<chainId>:<agentId> parameter');
+ }
+
+ const parts = agentParam.split(':');
+ if (parts.length !== 2) {
+ throw new Error('Invalid agent format. Expected ?agent=<chainId>:<agentId>');
+ }
+
+ const chainId = Number(parts[0]);
+ const agentId = Number(parts[1]);
+
+ if (!chainId || !agentId) {
+ throw new Error('Invalid agent ID or chain ID');
+ }
+
+ return { chainId, agentId };
+}
+
+async function fetchAgentInfo(agentId) {
+ try {
+ const response = await fetch(`/api/agents/${agentId}`);
+ if (!response.ok) return null;
+ return await response.json();
+ } catch {
+ return null;
+ }
+}
+
+function truncateAddress(addr) {
+ if (!addr || addr.length < 10) return addr;
+ return `${addr.slice(0, 6)}…${addr.slice(-4)}`;
+}
+
+async function resolveENS(address, provider) {
+ try {
+ return await provider.resolveName(address);
+ } catch {
+ return null;
+ }
+}
+
+function formatScore(score) {
+ if (typeof score === 'number') {
+ return score.toFixed(1);
+ }
+ return '—';
+}
+
+function getRatingClass(score) {
+ if (score > 0) return 'rating-positive';
+ if (score < 0) return 'rating-negative';
+ return 'rating-neutral';
+}
+
+function formatDate(blockNumber) {
+ // Rough estimate: blockNumber doesn't give us date directly
+ // In production, you'd want to store the actual timestamp on-chain
+ // For now, just show "Recent"
+ return 'Recent';
+}
+
+async function main() {
+ const appEl = document.querySelector('#app');
+
+ try {
+ const { chainId, agentId } = await parseAgentId();
+
+ // Show loading state
+ appEl.innerHTML = `
+ <div class="rep-loading">
+ <div class="spinner"></div>
+ <p>Loading reputation…</p>
+ </div>
+ `;
+
+ // Check if chain is supported
+ if (!REGISTRY_DEPLOYMENTS[chainId]) {
+ throw new Error(`ReputationRegistry not deployed on ${getChainName(chainId)}`);
+ }
+
+ // Get agent info from backend if available
+ const agentInfo = await fetchAgentInfo(agentId);
+
+ // Create provider for on-chain data
+ const rpcUrl = REGISTRY_DEPLOYMENTS[chainId]?.rpcUrl || `https://rpc.${chainId}.io`;
+ const provider = new JsonRpcProvider(rpcUrl);
+
+ // Fetch reputation data
+ const [repData, reviews] = await Promise.all([
+ getReputation({ agentId, runner: provider, chainId }),
+ getRecentReviews({ agentId, runner: provider, chainId, fromBlock: 0 }),
+ ]);
+
+ // Reverse to show most recent first, limit to 20
+ const recentReviews = reviews.reverse().slice(0, 20);
+
+ // Render page
+ let html = `
+ <div class="rep-header">
+ <h1>${agentInfo?.name || `Agent #${agentId}`}</h1>
+ <div class="rep-header-meta">
+ ${getChainName(chainId)} • ID: ${agentId}
+ </div>
+ </div>
+
+ <div class="rep-stats">
+ <div class="rep-stat">
+ <div class="rep-stat-label">Average Rating</div>
+ <div class="rep-stat-value">${formatScore(repData.average)}</div>
+ </div>
+ <div class="rep-stat">
+ <div class="rep-stat-label">Reviews</div>
+ <div class="rep-stat-value">${repData.count}</div>
+ </div>
+ <div class="rep-stat">
+ <div class="rep-stat-label">Total Score</div>
+ <div class="rep-stat-value">${repData.total}</div>
+ </div>
+ </div>
+ `;
+
+ if (recentReviews.length === 0) {
+ html += `
+ <div class="rep-reviews">
+ <div class="rep-empty">No reviews yet. Be the first to review this agent!</div>
+ </div>
+ `;
+ } else {
+ html += `
+ <div class="rep-reviews">
+ <h3>Recent Reviews</h3>
+ <div class="rep-review-list">
+ `;
+
+ // Resolve ENS names in parallel
+ const ensPromises = recentReviews.map(async (rev) => {
+ const name = await resolveENS(rev.from, provider).catch(() => null);
+ return { review: rev, name };
+ });
+
+ const reviewsWithENS = await Promise.all(ensPromises);
+
+ reviewsWithENS.forEach(({ review, name }) => {
+ const displayName = name || truncateAddress(review.from);
+ const explorerUrl = getExplorerUrl(chainId, review.txHash);
+ const scoreClass = getRatingClass(review.score);
+
+ html += `
+ <div class="rep-review-item">
+ <div class="rep-review-header">
+ <span class="rep-reviewer">${displayName}</span>
+ <span class="rep-stars">${review.score > 0 ? '+' : ''}${review.score}</span>
+ </div>
+ `;
+
+ if (review.comment) {
+ html += `<div class="rep-comment">${escapeHtml(review.comment)}</div>`;
+ }
+
+ html += `
+ <div class="rep-review-footer">
+ <span>${formatDate(review.blockNumber)}</span>
+ `;
+
+ if (explorerUrl) {
+ html += `<a href="${explorerUrl}" target="_blank" rel="noopener" class="rep-tx-hash">tx</a>`;
+ }
+
+ html += `
+ </div>
+ </div>
+ `;
+ });
+
+ html += `
+ </div>
+ </div>
+ `;
+ }
+
+ // Submit form
+ html += `
+ <div class="rep-submit-form">
+ <h3>Submit a Review</h3>
+ <div id="wallet-status" class="rep-form-hint">
+ <button id="connect-wallet" class="rep-submit-btn">Connect Wallet</button>
+ </div>
+ <div id="form-container" style="display:none">
+ <div class="rep-form-group">
+ <label>Your Rating</label>
+ <div class="rep-stars-input" id="rating-input">
+ <!-- Stars filled by JS -->
+ </div>
+ <input type="hidden" id="rep-rating" value="0" />
+ </div>
+ <div class="rep-form-group">
+ <label>Comment (optional)</label>
+ <textarea id="rep-comment" placeholder="Share your feedback…" maxlength="280"></textarea>
+ <small><span id="char-count">0</span>/280 characters</small>
+ </div>
+ <button id="submit-review" class="rep-submit-btn" disabled>Submit Review</button>
+ <div id="form-message" style="display:none; margin-top:1rem"></div>
+ </div>
+ </div>
+ `;
+
+ appEl.innerHTML = html;
+
+ // Wire up wallet connection
+ const connectBtn = document.getElementById('connect-wallet');
+ const walletStatus = document.getElementById('wallet-status');
+ const formContainer = document.getElementById('form-container');
+ const submitBtn = document.getElementById('submit-review');
+ const ratingInput = document.getElementById('rating-input');
+ const commentEl = document.getElementById('rep-comment');
+ const charCount = document.getElementById('char-count');
+ const formMessage = document.getElementById('form-message');
+
+ // Create star buttons
+ for (let i = -100; i <= 100; i += 20) {
+ const btn = document.createElement('button');
+ btn.className = 'rep-star-btn';
+ btn.textContent = i >= 0 ? `+${i}` : `${i}`;
+ btn.dataset.value = i;
+ btn.addEventListener('click', () => {
+ document.querySelectorAll('#rating-input button').forEach(b => b.classList.remove('selected'));
+ btn.classList.add('selected');
+ document.getElementById('rep-rating').value = i;
+ submitBtn.disabled = false;
+ });
+ ratingInput.appendChild(btn);
+ }
+
+ commentEl.addEventListener('input', () => {
+ charCount.textContent = commentEl.value.length;
+ });
+
+ let connectedAddress = null;
+
+ connectBtn.addEventListener('click', async () => {
+ try {
+ if (typeof window.ethereum === 'undefined') {
+ throw new Error('MetaMask not found. Please install it.');
+ }
+
+ const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });
+ connectedAddress = accounts[0];
+
+ // Check if already reviewed
+ const hasReviewed = recentReviews.some(r => r.from.toLowerCase() === connectedAddress.toLowerCase());
+ if (hasReviewed) {
+ walletStatus.innerHTML = `
+ <div class="rep-error">
+ <p>You've already reviewed this agent.</p>
+ </div>
+ `;
+ formContainer.style.display = 'none';
+ return;
+ }
+
+ walletStatus.innerHTML = `
+ <p style="color:rgba(229,229,229,0.7)">
+ Connected: <code style="font-family:monospace">${truncateAddress(connectedAddress)}</code>
+ </p>
+ `;
+ formContainer.style.display = '';
+ connectBtn.style.display = 'none';
+ } catch (err) {
+ formMessage.style.display = '';
+ formMessage.className = 'rep-error';
+ formMessage.innerHTML = `<p>${err.message}</p>`;
+ }
+ });
+
+ submitBtn.addEventListener('click', async () => {
+ if (!connectedAddress) {
+ formMessage.innerHTML = '<p>Please connect your wallet first.</p>';
+ formMessage.className = 'rep-error';
+ formMessage.style.display = '';
+ return;
+ }
+
+ const rating = Number(document.getElementById('rep-rating').value);
+ const comment = commentEl.value.trim();
+
+ if (!rating && rating !== 0) {
+ formMessage.innerHTML = '<p>Please select a rating.</p>';
+ formMessage.className = 'rep-error';
+ formMessage.style.display = '';
+ return;
+ }
+
+ try {
+ submitBtn.disabled = true;
+ submitBtn.textContent = 'Submitting…';
+
+ if (typeof window.ethereum === 'undefined') {
+ throw new Error('MetaMask not found.');
+ }
+
+ const signer = new BrowserProvider(window.ethereum).getSigner();
+ const txHash = await submitReputation({
+ agentId,
+ score: Math.abs(rating),
+ comment,
+ signer: await signer,
+ chainId,
+ });
+
+ formMessage.innerHTML = `
+ <div class="rep-success">
+ <p>Review submitted! <a href="${getExplorerUrl(chainId, txHash) || '#'}" target="_blank" rel="noopener">View transaction</a></p>
+ </div>
+ `;
+ formMessage.style.display = '';
+ formContainer.style.display = 'none';
+ connectBtn.style.display = '';
+ connectBtn.textContent = 'Submit Another?';
+ } catch (err) {
+ formMessage.innerHTML = `<p>${err.message || 'Submission failed'}</p>`;
+ formMessage.className = 'rep-error';
+ formMessage.style.display = '';
+ submitBtn.disabled = false;
+ submitBtn.textContent = 'Submit Review';
+ }
+ });
+ } catch (err) {
+ console.error('Failed to load reputation:', err);
+ appEl.innerHTML = `
+ <div class="rep-error">
+ <h3>Error</h3>
+ <p>${err.message}</p>
+ <button onclick="location.reload()">Retry</button>
+ </div>
+ `;
+ }
+}
+
+function escapeHtml(text) {
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+}
+
+main();
diff --git a/dist-lib/validation/REPORT_FORMAT.md b/dist-lib/validation/REPORT_FORMAT.md
new file mode 100644
index 000000000..0b1c2ce2d
--- /dev/null
+++ b/dist-lib/validation/REPORT_FORMAT.md
@@ -0,0 +1,94 @@
+# Agent Validation Report Format
+
+## Overview
+
+An **agent validation report** is a JSON document that captures the results of testing an agent's GLB model and metadata against a suite of validation rules. Validators (auditors, testing services) generate these reports, sign them on-chain via `recordValidation()`, and end-users browse them to verify trust.
+
+## Schema
+
+```json
+{
+ "type": "agent-validation-report/0.1",
+ "agentId": 1,
+ "chainId": 84532,
+ "validator": "0x1234567890123456789012345678901234567890",
+ "ranAt": "2026-04-17T14:30:00Z",
+ "suites": [
+ {
+ "name": "glb-schema",
+ "status": "pass",
+ "details": "GLB structure valid, all required chunks present"
+ },
+ {
+ "name": "manifest-integrity",
+ "status": "pass",
+ "details": null
+ },
+ {
+ "name": "skill-handlers-load",
+ "status": "warn",
+ "details": "Skill 'sing' references missing dependency @soundfont/npm"
+ }
+ ],
+ "verdict": "pass",
+ "notes": "Agent passes baseline validation. Minor warnings on external deps."
+}
+```
+
+## Field Definitions
+
+| Field | Type | Required | Notes |
+|-------|------|----------|-------|
+| `type` | string | ✓ | Always `"agent-validation-report/0.1"`. Versioned for forward compatibility. |
+| `agentId` | number | ✓ | The agent token ID (from Identity Registry). |
+| `chainId` | number | ✓ | The blockchain chain ID (e.g., 84532 for Base Sepolia). |
+| `validator` | string | ✓ | The Ethereum address of the validator (0x-prefixed hex). |
+| `ranAt` | string (ISO 8601) | ✓ | UTC timestamp when tests ran. Format: `YYYY-MM-DDTHH:mm:ssZ`. |
+| `suites` | array | ✓ | Array of test suite results (see below). |
+| `verdict` | enum | ✓ | One of `"pass"`, `"warn"`, `"fail"`. Typically `"fail"` if any suite fails. |
+| `notes` | string | ✗ | Human-readable summary or recommendations (up to 500 chars). |
+
+## Suite Object
+
+Each suite in the `suites` array represents a category of validation tests:
+
+| Field | Type | Required | Notes |
+|-------|------|----------|-------|
+| `name` | string | ✓ | Unique identifier (e.g., `glb-schema`, `manifest-integrity`, `skill-handlers-load`). |
+| `status` | enum | ✓ | One of `"pass"`, `"warn"`, `"fail"`. |
+| `details` | string \| null | ✗ | Optional failure/warning message (up to 200 chars). Null if passing. |
+
+## Validation Rules
+
+- **GLB Schema** (`glb-schema`): Confirms the GLB file structure is valid per glTF 2.0 spec.
+ - Fails if: corrupted file, missing required chunks (glTF JSON, bin).
+ - Warns if: unsupported extensions, non-standard materials.
+
+- **Manifest Integrity** (`manifest-integrity`): Checks the agent's on-chain metadata JSON.
+ - Fails if: `agentId`, `chainId`, or registry address mismatch.
+ - Warns if: fields are missing or malformed.
+
+- **Skill Handlers Load** (`skill-handlers-load`): Verifies that all declared skills can initialize.
+ - Fails if: skill `handlers.js` has syntax errors or required imports are unavailable.
+ - Warns if: optional dependencies are missing but fallbacks exist.
+
+## Example
+
+See [`example-report.json`](./example-report.json) for a complete, valid example.
+
+## Hashing & On-Chain Storage
+
+1. **Client-side hash**: The dashboard computes `keccak256(JSON.stringify(report))` to create the proof hash.
+2. **IPFS pinning**: The full report JSON is uploaded to IPFS (via Pinata or `/api/erc8004/pin`).
+3. **On-chain record**: The contract stores `(agentId, verdict, proofHash, proofURI, kind)`, where:
+ - `proofHash` is the keccak256 hash.
+ - `proofURI` is the IPFS URI (e.g., `ipfs://QmXyz...`).
+
+Validators can verify the hash by fetching the report from IPFS and recomputing the hash locally.
+
+## Trust Model
+
+- Only Ethereum-validated wallets can submit validations.
+- The `validator` address is recorded on-chain.
+- End-users can view all validations for an agent and choose which validators to trust.
+- No endorsement or filtering by the 3D Agent team — raw records from all validators are visible.
diff --git a/dist-lib/validation/boot.js b/dist-lib/validation/boot.js
new file mode 100644
index 000000000..6af002483
--- /dev/null
+++ b/dist-lib/validation/boot.js
@@ -0,0 +1,8 @@
+/**
+ * Boot script for the validation dashboard.
+ * Exported as a module to avoid bundler requirement.
+ */
+
+import { ValidationDashboard } from '../../src/validation-ui.js';
+
+export { ValidationDashboard };
diff --git a/dist-lib/validation/example-report.json b/dist-lib/validation/example-report.json
new file mode 100644
index 000000000..ec44a49d5
--- /dev/null
+++ b/dist-lib/validation/example-report.json
@@ -0,0 +1,26 @@
+{
+ "type": "agent-validation-report/0.1",
+ "agentId": 42,
+ "chainId": 84532,
+ "validator": "0x1234567890123456789012345678901234567890",
+ "ranAt": "2026-04-17T14:30:00Z",
+ "suites": [
+ {
+ "name": "glb-schema",
+ "status": "pass",
+ "details": null
+ },
+ {
+ "name": "manifest-integrity",
+ "status": "pass",
+ "details": null
+ },
+ {
+ "name": "skill-handlers-load",
+ "status": "pass",
+ "details": null
+ }
+ ],
+ "verdict": "pass",
+ "notes": "Agent passes baseline validation. Ready for deployment."
+}
diff --git a/dist-lib/validation/index.html b/dist-lib/validation/index.html
new file mode 100644
index 000000000..c50a9b343
--- /dev/null
+++ b/dist-lib/validation/index.html
@@ -0,0 +1,485 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Validation Records · 3D Agent</title>
+ <link rel="icon" href="/favicon.ico" />
+ <style>
+ :root {
+ color-scheme: dark;
+ --accent: #6a5cff;
+ --accent2: #ff5ca8;
+ --border: #22222e;
+ --bg: #0b0b10;
+ --panel: #14141c;
+ }
+ * {
+ box-sizing: border-box;
+ }
+ body {
+ font: 15px/1.55 -apple-system, system-ui, Segoe UI, Roboto, sans-serif;
+ color: #eee;
+ margin: 0;
+ background: var(--bg);
+ min-height: 100vh;
+ }
+ a {
+ color: #9a8cff;
+ text-decoration: none;
+ }
+ header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 24px;
+ border-bottom: 1px solid var(--border);
+ position: sticky;
+ top: 0;
+ background: var(--bg);
+ z-index: 5;
+ }
+ .brand {
+ font-weight: 600;
+ letter-spacing: -0.01em;
+ }
+ nav a {
+ margin-right: 14px;
+ color: #aaa;
+ font-size: 14px;
+ }
+ nav a.active {
+ color: #fff;
+ }
+ main {
+ padding: 28px;
+ max-width: 1200px;
+ margin: 0 auto;
+ }
+ h1 {
+ font-size: 22px;
+ margin: 0 0 6px;
+ letter-spacing: -0.01em;
+ }
+ .sub {
+ color: #888;
+ margin: 0 0 22px;
+ font-size: 14px;
+ }
+ .toolbar {
+ display: flex;
+ gap: 12px;
+ margin-bottom: 24px;
+ flex-wrap: wrap;
+ align-items: center;
+ }
+ .toolbar input {
+ padding: 9px 11px;
+ background: #0f0f17;
+ border: 1px solid var(--border);
+ color: #eee;
+ border-radius: 8px;
+ font-size: 14px;
+ }
+ .toolbar input:focus {
+ outline: none;
+ border-color: var(--accent);
+ }
+ .form-group {
+ margin-bottom: 18px;
+ }
+ label {
+ display: block;
+ font-size: 13px;
+ font-weight: 500;
+ color: #bbb;
+ margin-bottom: 6px;
+ }
+ input[type='text'],
+ textarea,
+ select {
+ width: 100%;
+ background: #0f0f17;
+ border: 1px solid var(--border);
+ color: #eee;
+ padding: 9px 11px;
+ border-radius: 8px;
+ font-size: 14px;
+ font-family: inherit;
+ }
+ input[type='text']:focus,
+ textarea:focus,
+ select:focus {
+ outline: none;
+ border-color: var(--accent);
+ }
+ textarea {
+ resize: vertical;
+ font-family: ui-monospace, SF Mono, Menlo, monospace;
+ font-size: 13px;
+ }
+ .btn {
+ padding: 9px 14px;
+ border-radius: 9px;
+ border: 0;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+ background: var(--accent);
+ color: #fff;
+ }
+ .btn:hover {
+ filter: brightness(1.1);
+ }
+ .btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ filter: none;
+ }
+ .btn.sec {
+ background: #222230;
+ color: #ddd;
+ }
+ .err {
+ padding: 12px;
+ background: rgba(255, 92, 92, 0.1);
+ border: 1px solid rgba(255, 92, 92, 0.3);
+ border-radius: 8px;
+ color: #ffb3b3;
+ margin-bottom: 14px;
+ }
+ .info {
+ padding: 12px;
+ background: rgba(106, 92, 255, 0.1);
+ border: 1px solid rgba(106, 92, 255, 0.3);
+ border-radius: 8px;
+ color: #c9bfff;
+ margin-bottom: 14px;
+ font-size: 13px;
+ }
+ .records {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ }
+ .record {
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 10px;
+ padding: 16px;
+ }
+ .record-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ margin-bottom: 10px;
+ }
+ .record-title {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ }
+ .record-title h3 {
+ margin: 0;
+ font-size: 14px;
+ }
+ .badge {
+ display: inline-flex;
+ align-items: center;
+ padding: 3px 9px;
+ border-radius: 99px;
+ font-size: 11px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ }
+ .badge.pass {
+ background: rgba(76, 175, 80, 0.15);
+ color: #76d776;
+ }
+ .badge.warn {
+ background: rgba(255, 193, 7, 0.15);
+ color: #ffc107;
+ }
+ .badge.fail {
+ background: rgba(244, 67, 54, 0.15);
+ color: #ff5252;
+ }
+ .record-meta {
+ display: flex;
+ gap: 16px;
+ font-size: 12px;
+ color: #888;
+ margin: 8px 0;
+ }
+ .record-meta-item {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ }
+ .record-meta-label {
+ color: #666;
+ font-size: 11px;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ }
+ .record-meta-value {
+ color: #ccc;
+ font-family: ui-monospace, SF Mono, Menlo, monospace;
+ font-size: 13px;
+ word-break: break-all;
+ }
+ .record-actions {
+ display: flex;
+ gap: 8px;
+ margin-top: 10px;
+ }
+ .record-actions button,
+ .record-actions a {
+ padding: 6px 10px;
+ font-size: 12px;
+ border-radius: 7px;
+ border: 1px solid var(--border);
+ background: #1a1a24;
+ color: #ddd;
+ cursor: pointer;
+ text-decoration: none;
+ }
+ .record-actions button:hover,
+ .record-actions a:hover {
+ background: #22222e;
+ }
+ .empty {
+ text-align: center;
+ padding: 60px 20px;
+ border: 1px dashed var(--border);
+ border-radius: 14px;
+ color: #888;
+ }
+ .modal-overlay {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.6);
+ z-index: 60;
+ display: grid;
+ place-items: center;
+ opacity: 0;
+ pointer-events: none;
+ transition: opacity 0.15s;
+ }
+ .modal-overlay.open {
+ opacity: 1;
+ pointer-events: auto;
+ }
+ .modal {
+ background: #0e0e16;
+ border: 1px solid var(--border);
+ border-radius: 14px;
+ padding: 22px;
+ width: min(600px, calc(100vw - 32px));
+ max-height: calc(100vh - 32px);
+ overflow-y: auto;
+ }
+ .modal h2 {
+ margin: 0 0 4px;
+ font-size: 17px;
+ }
+ .modal .sub {
+ margin: 0 0 18px;
+ }
+ .modal-actions {
+ display: flex;
+ gap: 8px;
+ margin-top: 20px;
+ justify-content: flex-end;
+ }
+ .toast {
+ position: fixed;
+ bottom: 24px;
+ left: 50%;
+ transform: translateX(-50%);
+ background: #1a1a24;
+ border: 1px solid var(--border);
+ padding: 10px 18px;
+ border-radius: 99px;
+ font-size: 13px;
+ color: #ddd;
+ z-index: 70;
+ box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
+ animation: toast-in 0.2s;
+ }
+ @keyframes toast-in {
+ from {
+ opacity: 0;
+ transform: translate(-50%, 8px);
+ }
+ to {
+ opacity: 1;
+ transform: translateX(-50%);
+ }
+ }
+ .toast.err {
+ border-color: #cc4040;
+ background: #1e1010;
+ }
+ .section {
+ margin-top: 34px;
+ }
+ .section-title {
+ font-size: 15px;
+ font-weight: 600;
+ margin: 0 0 12px;
+ color: #eee;
+ }
+ .file-input-wrapper {
+ position: relative;
+ display: inline-block;
+ width: 100%;
+ }
+ .file-input-wrapper input[type='file'] {
+ position: absolute;
+ opacity: 0;
+ width: 0;
+ height: 0;
+ }
+ .file-input-label {
+ display: block;
+ padding: 18px;
+ background: #0f0f17;
+ border: 2px dashed var(--border);
+ border-radius: 8px;
+ text-align: center;
+ cursor: pointer;
+ transition: border-color 0.15s;
+ color: #888;
+ }
+ .file-input-wrapper input[type='file']:focus + .file-input-label {
+ border-color: var(--accent);
+ color: #ccc;
+ }
+ .file-input-wrapper:hover .file-input-label {
+ border-color: #444;
+ color: #aaa;
+ }
+ pre {
+ background: #0f0f17;
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ padding: 10px 12px;
+ overflow: auto;
+ font-size: 12px;
+ max-height: 200px;
+ }
+ code {
+ font-family: ui-monospace, SF Mono, Menlo, monospace;
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <div class="brand"><a href="/">3D Agent</a></div>
+ <nav>
+ <a href="/">Home</a>
+ <a href="/dashboard">Dashboard</a>
+ <a href="/explore">Explore</a>
+ </nav>
+ </header>
+
+ <main id="main">
+ <h1>Validation Records</h1>
+ <p class="sub">Browse validation reports for this agent to verify trust and integrity.</p>
+
+ <div class="toolbar">
+ <input
+ type="text"
+ id="agent-input"
+ placeholder="Agent ID (e.g., 1)"
+ style="width: 200px"
+ />
+ <input
+ type="text"
+ id="chain-input"
+ placeholder="Chain ID (e.g., 84532)"
+ style="width: 200px"
+ />
+ <button class="btn" id="load-btn">Load Records</button>
+ <button class="btn sec" id="submit-btn">Submit Validation</button>
+ </div>
+
+ <div id="error" class="err" style="display: none"></div>
+ <div id="info" class="info" style="display: none"></div>
+ <div id="records" class="records"></div>
+ <div id="empty" class="empty" style="display: none">No validation records yet.</div>
+ </main>
+
+ <!-- Submit Modal -->
+ <div class="modal-overlay" id="submit-modal">
+ <div class="modal">
+ <h2>Submit Validation Report</h2>
+ <p class="sub">Upload a JSON validation report signed by your wallet.</p>
+
+ <div class="form-group">
+ <label>Report File (JSON)</label>
+ <div class="file-input-wrapper">
+ <input type="file" id="report-file" accept=".json" />
+ <label for="report-file" class="file-input-label">
+ 📄 Click to select or drag a JSON report file
+ </label>
+ </div>
+ <div id="file-status" style="font-size: 12px; color: #888; margin-top: 8px"></div>
+ </div>
+
+ <div id="preview-section" style="display: none" class="section">
+ <div class="section-title">Preview</div>
+ <pre id="preview-json"></pre>
+ <div id="preview-error" style="color: #ffb3b3; font-size: 12px; margin-top: 8px"></div>
+ </div>
+
+ <div id="hash-section" style="display: none" class="form-group">
+ <label>Report Hash</label>
+ <input
+ type="text"
+ id="report-hash"
+ readonly
+ style="font-family: ui-monospace, SF Mono, Menlo, monospace; font-size: 12px"
+ />
+ <div style="font-size: 12px; color: #888; margin-top: 6px">
+ Computed via keccak256(JSON.stringify(report))
+ </div>
+ </div>
+
+ <div class="modal-actions">
+ <button class="btn sec" onclick="closeSubmitModal()">Cancel</button>
+ <button class="btn" id="submit-report-btn" disabled>Submit on-chain</button>
+ </div>
+ </div>
+ </div>
+
+ <script type="module">
+ import { ValidationDashboard } from '/validation/boot.js';
+
+ const dashboard = new ValidationDashboard(document.getElementById('main'), {
+ agentInput: document.getElementById('agent-input'),
+ chainInput: document.getElementById('chain-input'),
+ loadBtn: document.getElementById('load-btn'),
+ submitBtn: document.getElementById('submit-btn'),
+ recordsContainer: document.getElementById('records'),
+ emptyState: document.getElementById('empty'),
+ errorEl: document.getElementById('error'),
+ infoEl: document.getElementById('info'),
+ submitModal: document.getElementById('submit-modal'),
+ reportFile: document.getElementById('report-file'),
+ fileStatus: document.getElementById('file-status'),
+ previewSection: document.getElementById('preview-section'),
+ previewJson: document.getElementById('preview-json'),
+ previewError: document.getElementById('preview-error'),
+ hashSection: document.getElementById('hash-section'),
+ reportHash: document.getElementById('report-hash'),
+ submitReportBtn: document.getElementById('submit-report-btn'),
+ });
+
+ window.closeSubmitModal = () => dashboard.closeModal();
+ window.submitModal = () => dashboard.submitReport();
+ </script>
+ </body>
+</html>
diff --git a/dist-lib/wallet-login.js b/dist-lib/wallet-login.js
index b61828fd3..ba7fdb5cf 100644
--- a/dist-lib/wallet-login.js
+++ b/dist-lib/wallet-login.js
@@ -102,7 +102,7 @@ async function completeSignIn(provider, btn) {
if (btn) btn.textContent = 'Requesting nonce…';
const nonceRes = await fetch('/api/auth/siwe/nonce', { credentials: 'include' });
if (!nonceRes.ok) throw new Error('Failed to get nonce');
- const { nonce } = await nonceRes.json();
+ const { nonce, csrf } = await nonceRes.json();
const domain = location.host;
const uri = location.origin;
@@ -130,7 +130,7 @@ async function completeSignIn(provider, btn) {
const verifyRes = await fetch('/api/auth/siwe/verify', {
method: 'POST',
credentials: 'include',
- headers: { 'content-type': 'application/json' },
+ headers: { 'content-type': 'application/json', 'x-csrf-token': csrf },
body: JSON.stringify({ message, signature }),
});
const data = await verifyRes.json();
diff --git a/prompts/sprint-100/14-idle-animation-loop.md b/prompts/sprint-100/14-idle-animation-loop.md
new file mode 100644
index 000000000..f0e39064b
--- /dev/null
+++ b/prompts/sprint-100/14-idle-animation-loop.md
@@ -0,0 +1,59 @@
+# 14 — Idle animation loop module
+
+## Why
+
+An avatar that stands perfectly still reads as dead. Breathing + occasional head glance + micro-blink makes the agent feel alive. Currently inline hacks in multiple files; this consolidates it.
+
+## Parallel-safety
+
+Pure utility module. No wiring into existing code. Sibling prompts/code can opt in by importing.
+
+## Files you own
+
+- Create: `src/idle-animation.js`
+
+## Read first
+
+- [src/agent-avatar.js](../../src/agent-avatar.js) — the current avatar scene graph wrapper.
+- Skim for existing idle logic to avoid double-breathing.
+
+## Deliverable
+
+```js
+export class IdleAnimation {
+ constructor({ root, bones = null, intensity = 1.0 })
+ // root: THREE.Object3D (the avatar scene or armature root).
+ // bones: optional override map { spine, head, leftShoulder, rightShoulder } of THREE.Bone refs.
+ // If null, auto-detect by common names (Hips, Spine, Spine1, Spine2, Head, Neck, mixamorigSpine, etc).
+ // intensity: 0..1 multiplier on all oscillations.
+ start(clock) // clock: THREE.Clock or any getElapsedTime()-like.
+ stop()
+ update(deltaSeconds) // call from your render loop if you prefer manual ticking.
+}
+```
+
+Behavior:
+- **Breathing**: scale spine on Y by ±1% at 0.25Hz (~4s per breath).
+- **Micro-sway**: ±0.5° rotation on spine root at 0.08Hz.
+- **Head glance**: every 4–9s (random), rotate head yaw ±8° over 500ms, hold 200ms, return over 800ms.
+- **Blink**: if the avatar has a morph target named `eyesClosed` / `blink` / `Fcl_EYE_Close` (VRM), drive a 120ms blink every 3–7s.
+- All adds to existing bone transforms, never overwrites. On `stop()`, restore exact original transforms.
+
+Honor `window.matchMedia('(prefers-reduced-motion: reduce)').matches` → skip the module entirely (start() becomes a no-op).
+
+## Constraints
+
+- No new deps. Three.js already present.
+- Zero allocations inside `update()` — reuse Vector3/Quaternion temporaries.
+- Guard against missing bones — if neither auto-detect nor overrides find a spine, log once and become a no-op.
+
+## Acceptance
+
+- `node --check src/idle-animation.js` clean.
+- `npm run build` clean.
+- Scratch-mount on a Mixamo rig: breathing visible, occasional glances visible, blink if morph present.
+
+## Report
+
+- Which bone-name heuristics matched on the default avatar.
+- Benchmark: `update()` cost per frame (`console.time` over 300 frames).
diff --git a/prompts/sprint-100/15-embed-postmessage-bridge.md b/prompts/sprint-100/15-embed-postmessage-bridge.md
new file mode 100644
index 000000000..b2f347edd
--- /dev/null
+++ b/prompts/sprint-100/15-embed-postmessage-bridge.md
@@ -0,0 +1,72 @@
+# 15 — Embed postMessage bridge
+
+## Why
+
+Agent running inside a host iframe (Claude, LobeHub, random blog) needs a versioned message bus: host sends chat messages/actions, embed sends back agent events. A well-defined handshake makes the whole host-embed ecosystem stable.
+
+## Parallel-safety
+
+New standalone module. Not wired to the web component yet — sibling prompts connect it.
+
+## Files you own
+
+- Create: `src/embed-host-bridge.js`
+- Create: `specs/EMBED_HOST_PROTOCOL.md` — versioned protocol spec.
+
+## Deliverable
+
+### Protocol (v1)
+
+Messages are JSON, always shaped `{ v: 1, type: string, id?: string, payload?: object }`.
+
+**Host → embed:**
+- `host.hello` → `{ hostName, hostVersion, hostOrigin, userId?: string, userName?: string }`
+- `host.chat.message` → `{ role: 'user'|'assistant', text: string, messageId: string }`
+- `host.action` → `{ action: string, args?: object }` (e.g., `'emote.wave'`, `'speak', { text }`)
+- `host.theme` → `{ mode: 'dark'|'light' }`
+
+**Embed → host:**
+- `embed.ready` → `{ agentId, version, capabilities: string[] }`
+- `embed.event` → `{ event: string, data?: object }`
+- `embed.error` → `{ code, message }`
+- `embed.request` → `{ id, method, params? }` (host can reply with `host.response { id, result|error }`)
+
+### `src/embed-host-bridge.js`
+
+```js
+export class EmbedHostBridge extends EventTarget {
+ constructor({ allowedOrigins = '*' /* or ['https://claude.ai', ...] */ })
+ start() // adds postMessage listener, sends 'embed.ready' upward to window.parent
+ stop()
+ send(type, payload)
+ request(method, params, { timeout = 5000 } = {}) // returns Promise resolving to result
+}
+```
+
+Behavior:
+- Only messages from `window.parent` matching an allowed origin are processed.
+- `addEventListener('host.chat.message', e => ...)` etc — emit a typed CustomEvent per incoming type.
+- `request()` assigns an id, waits for matching `host.response`, rejects on timeout.
+- Sends `embed.error` on malformed messages.
+- Defensive: ignore messages missing `v: 1` or with unknown types (log once, don't crash).
+
+## Spec doc
+
+`specs/EMBED_HOST_PROTOCOL.md` — table of all message types, example payloads, versioning policy (bump `v` when breaking, deprecate gracefully for one minor).
+
+## Constraints
+
+- No new deps.
+- Module must be SSR-safe (guard `typeof window !== 'undefined'`).
+- No `eval`, no `new Function`.
+
+## Acceptance
+
+- `node --check` clean.
+- `npm run build` clean.
+- Scratch harness with two iframes (host + embed) exchanges messages correctly; unknown types are ignored.
+
+## Report
+
+- Final list of message types implemented (match the spec).
+- Origin-allowlist behavior for `'*'` vs explicit list.
diff --git a/prompts/sprint-100/16-lobehub-plugin-manifest.md b/prompts/sprint-100/16-lobehub-plugin-manifest.md
new file mode 100644
index 000000000..837474ed4
--- /dev/null
+++ b/prompts/sprint-100/16-lobehub-plugin-manifest.md
@@ -0,0 +1,84 @@
+# 16 — LobeHub plugin manifest + config endpoint
+
+## Why
+
+To be installable from LobeHub's marketplace, we need a well-known plugin manifest and a config endpoint. This doesn't yet exist in-repo.
+
+## Parallel-safety
+
+New static file + new endpoint. No edits to anything existing.
+
+## Files you own
+
+- Create: `public/.well-known/lobehub-plugin.json`
+- Create: `api/lobehub/config.js`
+- Create: `api/lobehub/manifest.js` (dynamic variant of the static file — if LobeHub allows one, prefer static; keep dynamic as a fallback)
+
+## Read first
+
+- Skim the existing well-known files under `public/.well-known/` for conventions.
+- [api/_lib/http.js](../../api/_lib/http.js) — `wrap`, `json`, `cors`.
+
+## Deliverable
+
+### `public/.well-known/lobehub-plugin.json`
+
+```json
+{
+ "$schema": "https://lobehub.com/schema/plugin.json",
+ "api": [],
+ "identifier": "3d-agent",
+ "meta": {
+ "title": "3D Agent",
+ "description": "Embed any on-chain or off-chain 3D agent as an embodied avatar inside your chat.",
+ "avatar": "https://3dagent.vercel.app/favicon.png",
+ "tags": ["3d", "avatar", "embodied-agent", "erc-8004"]
+ },
+ "ui": {
+ "mode": "iframe",
+ "url": "https://3dagent.vercel.app/agent-embed.html",
+ "height": 640,
+ "settings": {
+ "agentId": {
+ "type": "string",
+ "title": "Agent ID",
+ "description": "Paste a 3D Agent ID or ENS name"
+ }
+ }
+ },
+ "author": "3d-agent",
+ "createdAt": "2026-04-17",
+ "homepage": "https://3dagent.vercel.app",
+ "version": "1.0.0"
+}
+```
+
+Read current LobeHub plugin schema and adapt fields as needed — this is a starting point, not a finished spec.
+
+### `GET /api/lobehub/config`
+
+- Public (no auth).
+- Returns the plugin manifest dynamically so we can version-bump without redeploying the static file.
+- Same JSON shape as the static file; prefer CORS `*` so LobeHub can fetch.
+
+### `GET /api/lobehub/manifest`
+
+- Same as above but shaped as LobeHub's marketplace submission format if different.
+- If LobeHub has a single format, this endpoint may be a redirect to `/config`.
+
+## Constraints
+
+- No new deps.
+- Valid JSON (run `node -e "require('./public/.well-known/lobehub-plugin.json')"`).
+- CORS enabled.
+
+## Acceptance
+
+- `curl https://your-preview.vercel.app/.well-known/lobehub-plugin.json` returns the JSON.
+- `curl .../api/lobehub/config` returns the same shape.
+- `npm run build` clean.
+
+## Report
+
+- Link to the LobeHub plugin schema you referenced (version + date).
+- Any fields you guessed vs confirmed from their docs.
diff --git a/prompts/sprint-100/17-onchain-deploy-button.md b/prompts/sprint-100/17-onchain-deploy-button.md
new file mode 100644
index 000000000..242047d34
--- /dev/null
+++ b/prompts/sprint-100/17-onchain-deploy-button.md
@@ -0,0 +1,67 @@
+# 17 — On-chain deploy button module
+
+## Why
+
+The ERC-8004 scaffolding exists ([src/erc8004/](../../src/erc8004/)) but no user-facing "Deploy on-chain" button on the agent page. This is the band-6 unlock.
+
+## Parallel-safety
+
+New standalone module + CSS. No agent-page wiring — a later prompt or manual wiring mounts it.
+
+## Files you own
+
+- Create: `src/erc8004/deploy-button.js`
+- Create: `src/erc8004/deploy-button.css`
+
+## Read first
+
+- [src/erc8004/abi.js](../../src/erc8004/abi.js) — `REGISTRY_DEPLOYMENTS`.
+- [src/erc8004/agent-registry.js](../../src/erc8004/agent-registry.js) — existing `connectWallet`, `registerAgent`, `buildRegistrationJSON`.
+- [src/erc8004/register-ui.js](../../src/erc8004/register-ui.js) — existing UI stub; may overlap — read it FIRST and note overlap.
+
+## Deliverable
+
+```js
+export class DeployButton {
+ constructor({ agent, container, preferredChainId = 84532 /* Base Sepolia */ })
+ mount()
+ unmount()
+}
+```
+
+Behavior:
+
+1. Render a button `⬢ Deploy on-chain` inside `container`.
+2. If `agent.chainId` is already set (already deployed), replace the button with a chip `On-chain on Base Sepolia · view on explorer` linked to the appropriate explorer.
+3. On click:
+ - `connectWallet({ chainId: preferredChainId })`.
+ - Show an inline progress panel: `Estimating gas... → Sign tx → Waiting confirmation → Done`.
+ - Call `registerAgent({ signer, owner, agentURI })` with `agentURI` derived from the agent's manifest URL.
+ - On confirmation: `POST /api/agents/:id/onchain` with `{ chainId, txHash, contractAddress }` to persist. If that endpoint doesn't exist, log a warning — the on-chain state is still authoritative.
+ - Show success chip with explorer link.
+4. Errors:
+ - user rejected → reset silently.
+ - wrong network → offer "Switch to Base Sepolia" action.
+ - no contract deployed on chain → disable button with tooltip.
+ - insufficient funds → show "Fund this wallet" with faucet link.
+
+## CSS
+
+Scoped under `.deploy-button-root`. Dark-theme by default; detect via `prefers-color-scheme`.
+
+## Constraints
+
+- No new deps (ethers already present).
+- Never broadcast without user-signed tx.
+- Never mutate chain-id mappings in `abi.js`.
+
+## Acceptance
+
+- `node --check` clean.
+- `npm run build` clean.
+- Scratch-mount with a Base Sepolia testnet wallet that has funds → flows end-to-end → tx hash shown, explorer link works.
+
+## Report
+
+- Overlap analysis with [src/erc8004/register-ui.js](../../src/erc8004/register-ui.js) — keep them parallel or should one subsume the other? Just note, don't refactor in this prompt.
+- Gas-estimation output from a real Base Sepolia run.
diff --git a/prompts/sprint-100/18-ipfs-pinning.md b/prompts/sprint-100/18-ipfs-pinning.md
new file mode 100644
index 000000000..34d31d386
--- /dev/null
+++ b/prompts/sprint-100/18-ipfs-pinning.md
@@ -0,0 +1,57 @@
+# 18 — IPFS / Arweave pinning endpoint
+
+## Why
+
+Before on-chain registration, the agent manifest + GLB should be pinned to a content-addressed network so that the URI recorded on-chain is permanent. Without this, on-chain records point to R2 URLs that could rot.
+
+## Parallel-safety
+
+New endpoint, no edits elsewhere.
+
+## Files you own
+
+- Create: `api/pinning/pin.js`
+- Create: `api/pinning/status.js`
+
+## Read first
+
+- [api/avatars/presign.js](../../api/avatars/presign.js) — confirm the R2 URL shape.
+- [.env.example](../../.env.example) — check for existing pinning creds (`PINATA_JWT`, `WEB3_STORAGE_TOKEN`, `ARWEAVE_KEY`).
+- [api/_lib/http.js](../../api/_lib/http.js), [api/_lib/auth.js](../../api/_lib/auth.js).
+
+## Deliverable
+
+### `POST /api/pinning/pin`
+
+- Auth required (session or bearer).
+- Body: `{ sourceUrl: string, kind: 'manifest' | 'glb' }`.
+- Steps:
+ 1. Validate `sourceUrl` is an R2 URL we own OR a `data:` URL under 10 MB.
+ 2. HEAD the source — reject >50 MB.
+ 3. Pin via Pinata (preferred; use `PINATA_JWT` if set) or Web3.Storage (fallback). If neither env var is present, return `503 pinning-unconfigured` with a clear message.
+ 4. Return `{ ok: true, cid, gatewayUrl: 'https://ipfs.io/ipfs/' + cid, provider }`.
+ 5. Record the pin in a `pins` table: `{ user_id, source_url, cid, provider, kind, created_at }` — create the table lazily via `if not exists` on first call.
+- Rate limit: `30/hour per user`.
+
+### `GET /api/pinning/status?cid=...`
+
+- Public, rate-limited `60/min per IP`.
+- Returns `{ cid, pinned: boolean, provider, gatewayUrls: string[] }`.
+
+## Constraints
+
+- No new deps — use `fetch` against the pinning provider's HTTP API directly.
+- Never log the pinning JWT.
+- Gracefully handle missing env; never crash on import.
+
+## Acceptance
+
+- `node --check` clean on both endpoints.
+- `npm run build` clean.
+- If `PINATA_JWT` is set locally: curl with a test R2 URL → returns CID → `status?cid=...` confirms pinned.
+
+## Report
+
+- Which provider you implemented first + why.
+- Whether the `pins` table creation is idempotent.
+- Full env-var list you touched (add to [.env.example](../../.env.example) if missing — that edit is in scope).
diff --git a/prompts/sprint-100/19-address-resolver-api.md b/prompts/sprint-100/19-address-resolver-api.md
new file mode 100644
index 000000000..4fd1eb959
--- /dev/null
+++ b/prompts/sprint-100/19-address-resolver-api.md
@@ -0,0 +1,51 @@
+# 19 — Agent-by-address resolver API
+
+## Why
+
+Any host (LobeHub, Claude, our own embed) should be able to ask "what agent belongs to wallet `0xabc...`?" and get the manifest without prior indexing. This closes the on-chain → embed loop.
+
+## Parallel-safety
+
+New endpoint.
+
+## Files you own
+
+- Create: `api/agents/by-address/[addr].js`
+
+## Read first
+
+- [src/erc8004/abi.js](../../src/erc8004/abi.js) — `REGISTRY_DEPLOYMENTS`, `IdentityRegistry` ABI.
+- [api/agents/by-wallet.js](../../api/agents/by-wallet.js) — **read this first** — it may already do most of this. If it does, adapt this prompt to extend or redirect to it rather than duplicate. Note in report.
+- [api/_lib/db.js](../../api/_lib/db.js).
+
+## Deliverable
+
+### `GET /api/agents/by-address/:addr`
+
+- Public, rate-limited `120/min per IP`.
+- Query params: `?chainId=<n>` (optional, default: try all known chains).
+- Steps:
+ 1. Normalize `addr` to lowercase, validate checksum-less hex.
+ 2. DB-first: look up `agents` / `user_wallets` joined rows where the wallet owns the agent. Return if found.
+ 3. Chain fallback: for each chain in `REGISTRY_DEPLOYMENTS`, call `IdentityRegistry.agentsByOwner(addr)` via an RPC read. Use the same RPC URLs `agent-registry.js` uses.
+ 4. For each on-chain agentId, fetch `agentURI` and resolve the manifest.
+ 5. Return `{ agents: [{ id, chainId, agentURI, manifestUrl, onChain: boolean, source: 'db'|'chain' }] }`.
+- 404 with `{ agents: [] }` if none found (still 200, empty array, per REST convention — use 200).
+
+## Constraints
+
+- No new deps. Use `ethers` already in use.
+- RPC calls must have a 3s timeout each; don't block forever.
+- Cache per-address results in-memory for 60s to avoid thundering the RPC.
+
+## Acceptance
+
+- `node --check` clean.
+- `npm run build` clean.
+- curl with a known-on-chain address → returns the agent.
+- curl with a random address → `{ agents: [] }`.
+
+## Report
+
+- Overlap with `by-wallet.js` — what you inherit, what's new.
+- Per-chain RPC latency you saw.
diff --git a/prompts/sprint-100/20-ens-resolver.md b/prompts/sprint-100/20-ens-resolver.md
new file mode 100644
index 000000000..1de0c7ea9
--- /dev/null
+++ b/prompts/sprint-100/20-ens-resolver.md
@@ -0,0 +1,47 @@
+# 20 — ENS name resolver API
+
+## Why
+
+Humans paste `vitalik.eth`, not `0xd8da...`. Resolving ENS → address → agent lets embeds use readable names.
+
+## Parallel-safety
+
+New endpoint. Does not touch the by-address resolver (sibling prompt 19).
+
+## Files you own
+
+- Create: `api/agents/ens/[name].js`
+
+## Read first
+
+- [src/erc8004/agent-registry.js](../../src/erc8004/agent-registry.js) — confirm the ethers version + existing RPC setup.
+
+## Deliverable
+
+### `GET /api/agents/ens/:name`
+
+- Public, rate-limited `60/min per IP`.
+- Steps:
+ 1. Validate `name` ends with `.eth` and is a sensible ENS label (`[a-z0-9-]+` across labels).
+ 2. Use `ethers.getDefaultProvider('mainnet')` or a configured `MAINNET_RPC_URL` to call `provider.resolveName(name)` → address. If null, 404.
+ 3. Proxy/forward to `/api/agents/by-address/:addr` logic — NOT via an HTTP hop; factor the shared logic out into a small helper if convenient, OR duplicate the read-through with a TODO to dedupe later. Note the decision in the report.
+ 4. Return `{ name, address, agents: [...] }`.
+- Cache ENS → address resolution for 5 minutes in-memory.
+
+## Constraints
+
+- No new deps.
+- 3s RPC timeout; on timeout return `503 ens-timeout`.
+- Never throw on invalid names — return 400 with a clear message.
+
+## Acceptance
+
+- `node --check` clean.
+- `npm run build` clean.
+- curl `/api/agents/ens/vitalik.eth` → returns address (and `agents: []` because he's not registered with us).
+- curl `/api/agents/ens/notarealname-zzz.eth` → 404.
+
+## Report
+
+- Whether the mainnet RPC used was the public default or an env-configured one (recommend env).
+- Cache eviction behavior.
diff --git a/prompts/sprint-100/21-og-meta-polish.md b/prompts/sprint-100/21-og-meta-polish.md
new file mode 100644
index 000000000..e1ed7edde
--- /dev/null
+++ b/prompts/sprint-100/21-og-meta-polish.md
@@ -0,0 +1,65 @@
+# 21 — OG image + oEmbed polish
+
+## Why
+
+When an agent link is pasted in Twitter / Discord / Slack / Claude, the unfurl should show a rich card: avatar thumbnail, name, bio, embed-aware oEmbed entry. Today partial.
+
+## Parallel-safety
+
+Additive edits to two existing server files, plus optionally a new thumbnail renderer.
+
+## Files you own
+
+- Edit (additive): [api/a-og.js](../../api/a-og.js) — polish the response, never remove fields.
+- Edit (additive): [api/a-page.js](../../api/a-page.js) — ensure `<meta>` tags for og:image, og:video, twitter:card, oembed link.
+- Optionally create: `api/a-og-image.js` — dynamic OG image (1200×630 PNG) rendered with `@vercel/og` (ONLY if that's already a dep — check `package.json` first; if not, skip and use a static fallback).
+
+## Read first
+
+- [api/a-og.js](../../api/a-og.js) — current OG response.
+- [api/a-page.js](../../api/a-page.js) — current head tags.
+- [api/agent-oembed.js](../../api/agent-oembed.js) — confirm oEmbed endpoint exists.
+- [package.json](../../package.json) — check for `@vercel/og`.
+
+## Deliverable
+
+### `api/a-page.js` `<head>` must include:
+
+```html
+<meta property="og:type" content="profile">
+<meta property="og:title" content="${agent.name} — 3D Agent">
+<meta property="og:description" content="${agent.bio || 'An embodied 3D agent'}">
+<meta property="og:image" content="${ogImageUrl}">
+<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:image" content="${ogImageUrl}">
+<link rel="alternate" type="application/json+oembed"
+ href="${origin}/api/agent-oembed?url=${encodedCurrentUrl}&format=json">
+```
+
+### `api/a-og.js` response must include:
+- `title`, `description`, `image`, `url`, `type`, plus new fields: `agent.name`, `agent.slug`, `agent.thumbnailUrl`, `agent.chainId?`, `agent.onChain?`.
+
+### Dynamic OG image (if `@vercel/og` exists):
+- 1200×630, dark background, centered square thumbnail, agent name, small chain badge if on-chain.
+- 60s CDN cache.
+
+If `@vercel/og` is NOT a dep, just use `agent.thumbnailUrl` directly as `og:image` — same header, different source.
+
+## Constraints
+
+- No new deps unless explicitly already present.
+- Additive only — do not remove existing fields or meta tags.
+- Handle missing fields gracefully (`agent.bio` may be null).
+
+## Acceptance
+
+- `node --check` clean on edited files.
+- `npm run build` clean.
+- Paste an agent link into Twitter's card validator or `curl -A Twitterbot ...` → card renders correctly.
+
+## Report
+
+- Whether `@vercel/og` was present and which path you took.
+- The full meta block you ended up with (paste it).
diff --git a/prompts/sprint-100/22-cz-landing-page.md b/prompts/sprint-100/22-cz-landing-page.md
new file mode 100644
index 000000000..feb8a8823
--- /dev/null
+++ b/prompts/sprint-100/22-cz-landing-page.md
@@ -0,0 +1,61 @@
+# 22 — CZ claim landing page
+
+## Why
+
+The ship target: `/cz` is a bespoke landing page where CZ (or anyone with the claim link) connects their wallet and claims a pre-registered on-chain agent.
+
+## Parallel-safety
+
+Entirely new folder + routes. No edits to existing app code.
+
+## Files you own
+
+- Create: `public/cz/index.html`
+- Create: `public/cz/cz.css`
+- Create: `public/cz/cz.js`
+- Create: `api/cz/claim.js` — server-side claim handler.
+
+## Read first
+
+- [vite.config.js](../../vite.config.js) — confirm `public/cz/` will be served (it typically is by default).
+- [vercel.json](../../vercel.json) — check rewrites so `/cz` serves the index.
+
+## Deliverable
+
+### Frontend
+
+`/cz` route:
+- Full-bleed dark theme with a 3D agent embed front-and-center (uses `<agent-3d agent-id="cz-preview">` or similar hardcoded agent id).
+- Copy: `Welcome, CZ. Claim your on-chain agent.`
+- Button: `Connect wallet to claim` → uses the wallet flow from [src/wallet-auth.js](../../src/wallet-auth.js) if present, else falls back to `connectWallet()` from `erc8004/agent-registry.js`.
+- After connection, show `[ ⬢ Sign claim transaction ]`.
+- Wallet signs a claim tx that flips ownership of the pre-registered agent NFT/row to the connecting wallet.
+- Success screen: `You now own <agent-name>. Here's your embed snippet.` — shows the three snippets from the share panel.
+
+### Backend
+
+`POST /api/cz/claim`:
+- Body: `{ signerAddress, signature, nonce }` — signer proves possession of the target address.
+- Server issues a nonce via `GET /api/cz/claim?address=...` (add this branch).
+- Verify signature → record claim intent in a `cz_claims` table → respond with `{ ok: true, txPayload: { to, data, value } }` so the client can broadcast the actual on-chain transfer.
+- Rate limit: `5/hour per IP` (this is a one-shot flow).
+
+### Fallback / rehearsal
+
+- Include a `?rehearsal=1` query param that stubs the contract call with a 2-second fake success — lets us rehearse on a laptop without a live chain.
+
+## Constraints
+
+- No new deps.
+- Hardcoded agent id lives in ONE place (top of `cz.js`).
+- Service-worker for offline demo is out of scope for this prompt — note as follow-up.
+
+## Acceptance
+
+- Visit `localhost:3000/cz` → page renders, avatar visible, connect button works with MetaMask.
+- `?rehearsal=1` flows through to success without touching chain.
+
+## Report
+
+- Hardcoded agent id you used (coordinate with whoever pre-registered).
+- What `/api/cz/claim` returns in rehearsal mode vs live.
diff --git a/prompts/sprint-100/23-action-passthrough.md b/prompts/sprint-100/23-action-passthrough.md
new file mode 100644
index 000000000..0f783e100
--- /dev/null
+++ b/prompts/sprint-100/23-action-passthrough.md
@@ -0,0 +1,63 @@
+# 23 — Chat-to-agent action passthrough bridge
+
+## Why
+
+When the host sends `host.chat.message` (via the postMessage bridge), the agent should react — speak, emote, change pose. Today there's no relay between the bridge's incoming events and the agent's action protocol.
+
+## Parallel-safety
+
+Pure glue module. Imports from [src/agent-protocol.js](../../src/agent-protocol.js) and listens to (not imports) `src/embed-host-bridge.js` via the shared EventTarget API (string event names, no tight coupling).
+
+## Files you own
+
+- Create: `src/embed-action-bridge.js`
+
+## Read first
+
+- [src/agent-protocol.js](../../src/agent-protocol.js) — `ACTION_TYPES`, `protocol.emit()`, handlers.
+- [specs/EMBED_HOST_PROTOCOL.md](../../specs/EMBED_HOST_PROTOCOL.md) if sibling prompt 15 has produced it — otherwise rely on the duck-typed events `host.chat.message`, `host.action`, `host.theme`.
+
+## Deliverable
+
+```js
+export class EmbedActionBridge {
+ constructor({ bridge, protocol })
+ // bridge: an EmbedHostBridge-like EventTarget.
+ // protocol: the agent protocol singleton (src/agent-protocol.js default export).
+ start()
+ stop()
+}
+```
+
+Event map:
+
+| Host event | Translation to agent protocol |
+|---|---|
+| `host.chat.message {role:'user',text}` | `protocol.emit(ACTION_TYPES.SPEAK_TO_AGENT, { text })` |
+| `host.chat.message {role:'assistant',text}` | `protocol.emit(ACTION_TYPES.AGENT_SPEAK, { text })` + optional TTS trigger |
+| `host.action {action:'emote.wave'}` | `protocol.emit(ACTION_TYPES.PLAY_ANIMATION, { clip: 'Wave' })` |
+| `host.action {action:'emote.*'}` | generic animation trigger with the suffix |
+| `host.action {action:'speak', args:{text}}` | `protocol.emit(ACTION_TYPES.AGENT_SPEAK, { text })` |
+| `host.theme {mode}` | `document.body.dataset.theme = mode` |
+
+Reverse (agent → host):
+- When `protocol` emits `AGENT_EVENT` / `MEMORY_UPDATED` / `EMOTION_CHANGED` → `bridge.send('embed.event', { event, data })`.
+
+Unknown events logged once at debug level, not propagated.
+
+## Constraints
+
+- Don't hardcode `ACTION_TYPES` strings — import the actual constants.
+- Don't throw on malformed host events — log + ignore.
+- No new deps.
+
+## Acceptance
+
+- `node --check` clean.
+- `npm run build` clean.
+- Scratch harness with mocked bridge + protocol: messages translate in both directions.
+
+## Report
+
+- List of `ACTION_TYPES` values you mapped (and any that had no clear translation).
+- Whether TTS auto-fires on assistant messages (yes/no + rationale).
diff --git a/prompts/sprint-100/24-agent-suggest-endpoint.md b/prompts/sprint-100/24-agent-suggest-endpoint.md
new file mode 100644
index 000000000..e62156c80
--- /dev/null
+++ b/prompts/sprint-100/24-agent-suggest-endpoint.md
@@ -0,0 +1,51 @@
+# 24 — `@agent` suggest endpoint
+
+## Why
+
+Host surfaces (LobeHub chat, future web chat) need `@`-mention autocomplete: type `@cz` → see matching agents. Currently no suggest endpoint.
+
+## Parallel-safety
+
+New endpoint, no edits elsewhere.
+
+## Files you own
+
+- Create: `api/agents/suggest.js`
+
+## Read first
+
+- [api/agents/check-name.js](../../api/agents/check-name.js) — schema used.
+- [api/_lib/http.js](../../api/_lib/http.js), [api/_lib/db.js](../../api/_lib/db.js).
+
+## Deliverable
+
+### `GET /api/agents/suggest`
+
+- Query: `q` (string, 1–32 chars), `limit` (default 8, max 20).
+- Public, rate-limited `120/min per IP`.
+- Ranks:
+ 1. Exact name match (case-insensitive)
+ 2. Prefix match on name
+ 3. Prefix match on slug
+ 4. Fuzzy match (trigram if available; otherwise `ILIKE '%q%'`)
+- Returns `{ agents: [{ id, name, slug, thumbnailUrl, chainId?: number, onChain: boolean }] }`.
+- Excludes agents marked `private = true` or `hidden = true` if such columns exist.
+- 60s response cache (CDN header `cache-control: public, max-age=60`).
+
+## Constraints
+
+- SQL via tagged template — no string concat.
+- `q` sanitized (strip anything outside `[a-zA-Z0-9_-]`; then apply).
+- No new deps.
+
+## Acceptance
+
+- `node --check` clean.
+- `npm run build` clean.
+- curl `/api/agents/suggest?q=cz` returns matching agents.
+- SQL injection attempts (quotes, semicolons) return empty results, not errors.
+
+## Report
+
+- Which columns exist on the agents table for `private`/`hidden` (if any).
+- Whether pg_trgm is installed; if not, what fallback you used.
diff --git a/prompts/sprint-100/25-claim-transfer-flow.md b/prompts/sprint-100/25-claim-transfer-flow.md
new file mode 100644
index 000000000..ad8c90b12
--- /dev/null
+++ b/prompts/sprint-100/25-claim-transfer-flow.md
@@ -0,0 +1,58 @@
+# 25 — Claim / transfer flow module
+
+## Why
+
+Agents minted by ops (e.g., CZ's pre-registered agent) need a user-signed transfer to flip ownership. Also the foundation for any future "gift an agent" flow.
+
+## Parallel-safety
+
+Pure client module. No app wiring — sibling prompt 22 (CZ landing) imports it.
+
+## Files you own
+
+- Create: `src/claim-transfer.js`
+
+## Read first
+
+- [src/erc8004/abi.js](../../src/erc8004/abi.js) — look for a `transferOwnership` or equivalent function on `IdentityRegistry`.
+- [src/erc8004/agent-registry.js](../../src/erc8004/agent-registry.js) — signer/provider helpers.
+
+## Deliverable
+
+```js
+export async function claimAgent({ agentId, fromAddress, toAddress, signer, onStep })
+// Executes the on-chain ownership transfer. fromAddress is the ops/mint wallet;
+// toAddress is the claimer. Requires the target contract to support a claim
+// or transferOwnership entry point.
+//
+// onStep({ step: 'permit'|'sign'|'broadcast'|'confirm', pct, txHash? }).
+// Returns { ok: true, txHash, blockNumber }.
+
+export async function buildClaimPayload({ agentId, toAddress, chainId })
+// Pure builder — returns { to, data, value } suitable for eth_sendTransaction.
+// Used when the flow is split across a server-side payload build + client sign.
+
+export class ClaimError extends Error {} // .code: 'wrong-owner'|'already-claimed'|'user-rejected'|'network'|'unsupported-chain'
+```
+
+Behavior:
+- If the registry contract doesn't have a transfer entry point on the target chain, resolve by creating a new identity record on the claimer's wallet and marking the old one `superseded_by` — record that in `POST /api/cz/claim` (or the equivalent). If no server endpoint, throw `ClaimError('unsupported-chain')`.
+- Never skip user signing. Every state change requires signer interaction.
+
+## Constraints
+
+- No new deps.
+- Never hardcode contract addresses; read from `REGISTRY_DEPLOYMENTS`.
+- Handle `chainId` mismatch by asking wallet to switch (EIP-3326).
+
+## Acceptance
+
+- `node --check src/claim-transfer.js` clean.
+- `npm run build` clean.
+- With a Base Sepolia wallet + testnet funds: the full dry-run against a deployed IdentityRegistry succeeds.
+
+## Report
+
+- Which contract function(s) you called.
+- Gas usage and confirmation latency on Base Sepolia.
+- Whether the registry truly supports transfer on every listed chain.
diff --git a/public/.well-known/lobehub-plugin.json b/public/.well-known/lobehub-plugin.json
new file mode 100644
index 000000000..64bef564b
--- /dev/null
+++ b/public/.well-known/lobehub-plugin.json
@@ -0,0 +1,95 @@
+{
+ "$schema": "https://lobehub.com/schema/plugin-manifest/v1.json",
+ "identifier": "3d-agent",
+ "version": "1.0.0",
+ "author": "3D Agent",
+ "createdAt": "2026-04-17",
+ "homepage": "https://3dagent.vercel.app",
+ "meta": {
+ "title": "3D Agent",
+ "description": "Embed any on-chain or off-chain 3D agent as an embodied avatar inside your chat.",
+ "avatar": "https://3dagent.vercel.app/favicon.png",
+ "tags": ["3d", "avatar", "embodied-agent", "erc-8004"]
+ },
+ "ui": {
+ "url": "https://3dagent.vercel.app/lobehub/iframe/",
+ "height": 640,
+ "settings": {
+ "agentId": {
+ "type": "string",
+ "title": "Agent ID",
+ "description": "Paste a 3D Agent ID or ENS name"
+ }
+ }
+ },
+ "api": [
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "render_agent",
+ "description": "Mount the 3D avatar for a given agent id.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "agentId": {
+ "type": "string",
+ "description": "Agent identity id (UUID) to render."
+ }
+ },
+ "required": ["agentId"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "speak",
+ "description": "Make the avatar speak with optional emotional valence.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "text": {
+ "type": "string",
+ "description": "Text for the avatar to speak aloud."
+ },
+ "sentiment": {
+ "type": "number",
+ "description": "Emotional valence in [-1, 1].",
+ "minimum": -1,
+ "maximum": 1
+ }
+ },
+ "required": ["text"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "gesture",
+ "description": "Trigger a named gesture on the avatar.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "enum": ["wave", "nod", "point", "shrug"]
+ }
+ },
+ "required": ["name"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "emote",
+ "description": "Inject an emotion into the avatar's Empathy Layer blend.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "trigger": {
+ "type": "string",
+ "enum": ["concern", "celebration", "patience", "curiosity", "empathy"]
+ },
+ "weight": { "type": "number", "minimum": 0, "maximum": 1 }
+ },
+ "required": ["trigger"]
+ }
+ }
+ ],
+ "systemRole": "You have an embodied 3D avatar agent visible in the chat. Use render_agent to bind it to a specific agent, speak to give it voice with emotional valence, gesture for physical expression, and emote to inject emotional state into its blend."
+}
diff --git a/public/agents/README.md b/public/agents/README.md
index 3108aa680..0a228489d 100644
--- a/public/agents/README.md
+++ b/public/agents/README.md
@@ -23,12 +23,12 @@ Filters are preserved in the URL for shareability:
/agents/?chain=8453&sort=newest&page=2&search=Alice
```
-| Parameter | Values | Default |
-| --------- | ------ | ------- |
-| `chain` | `all`, `8453` (Base), `84532` (Base Sepolia), `10` (Optimism), `137` (Polygon) | `all` |
-| `sort` | `newest`, `oldest`, `name` | `newest` |
-| `page` | `1`–N | `1` |
-| `search` | Free text | (none) |
+| Parameter | Values | Default |
+| --------- | ------------------------------------------------------------------------------ | -------- |
+| `chain` | `all`, `8453` (Base), `84532` (Base Sepolia), `10` (Optimism), `137` (Polygon) | `all` |
+| `sort` | `newest`, `oldest`, `name` | `newest` |
+| `page` | `1`–N | `1` |
+| `search` | Free text | (none) |
## Accessibility
@@ -42,10 +42,10 @@ Filters are preserved in the URL for shareability:
- **[index.html](./index.html)** — HTML structure + inline styles
- **[boot.js](./boot.js)** — Event handling + URL state management
- **[../../src/agents-directory.js](../../src/agents-directory.js)** — Controller class
- - Fetches from on-chain registries
- - Client-side filtering & sorting
- - SWR-style caching (60s TTL)
- - Lazy image loading
+ - Fetches from on-chain registries
+ - Client-side filtering & sorting
+ - SWR-style caching (60s TTL)
+ - Lazy image loading
## Rate limiting
diff --git a/public/agents/index.html b/public/agents/index.html
index 7ffb98297..76aec4c95 100644
--- a/public/agents/index.html
+++ b/public/agents/index.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
@@ -13,7 +13,8 @@
html,
body {
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
+ font-family:
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
background: linear-gradient(135deg, #0f0f23 0%, #1a0f3a 100%);
color: #e0e0e0;
diff --git a/public/first-meet/first-meet.js b/public/first-meet/first-meet.js
index e2906ca77..084712d47 100644
--- a/public/first-meet/first-meet.js
+++ b/public/first-meet/first-meet.js
@@ -282,6 +282,7 @@ async function persistState() {
});
// 2. Create or update agent
+ const agentMeta = { voice: state.voice, bodyType: state.bodyType };
if (!state.agent) {
// POST new agent
const res = await fetch('/api/agents', {
@@ -292,6 +293,7 @@ async function persistState() {
name: state.name,
description: state.bio,
avatar_id: state.avatarId,
+ meta: agentMeta,
}),
});
if (!res.ok) throw new Error(`Agent creation failed: ${res.status}`);
@@ -307,6 +309,7 @@ async function persistState() {
name: state.name,
description: state.bio,
avatar_id: state.avatarId,
+ meta: agentMeta,
}),
});
if (!res.ok) throw new Error(`Agent update failed: ${res.status}`);
diff --git a/public/lobehub/README.md b/public/lobehub/README.md
new file mode 100644
index 000000000..96fea959e
--- /dev/null
+++ b/public/lobehub/README.md
@@ -0,0 +1,74 @@
+# 3D Agent — LobeHub Plugin
+
+Embeds a rigged 3D avatar agent into any LobeHub instance via the plugin manifest + iframe bridge.
+
+## Install into a LobeHub fork
+
+1. Open your LobeHub instance → Settings → Plugins → Custom Plugin.
+2. Enter the manifest URL: `https://3dagent.vercel.app/api/lobehub/manifest`
+3. Install. LobeHub fetches the manifest, registers the four tools (`render_agent`, `speak`, `gesture`, `emote`), and renders the iframe at `/lobehub/iframe/` inside chat messages.
+4. Optionally pre-validate an agent before rendering: `POST /api/lobehub/handshake` with `{ agentId, hostOrigin }`.
+
+## postMessage contract
+
+All messages share the envelope:
+
+```json
+{ "v": 1, "ns": "3d-agent", "type": "<string>", "id": "<optional>", "payload": {} }
+```
+
+### Host → embed (inbound)
+
+| type | payload | effect |
+| ---------------- | --------------------------------------------------- | ----------------------------- |
+| `host:hello` | `{ hostName, hostVersion, capabilities }` | Triggers `embed:hello` reply |
+| `host:ping` | `{}` | Triggers `embed:pong` reply |
+| `host:action` | `{ action: { type, payload } }` | Dispatches to avatar |
+| `host:pause` | `{}` | Pauses the viewer |
+| `host:resume` | `{}` | Resumes the viewer |
+| `host:theme` | `{ mode: 'dark'\|'light'\|'transparent', accent? }` | Sets background + accent |
+| `host:set-agent` | `{ agentId }` | Reloads iframe with new agent |
+
+Accepted action types for `host:action.action.type`: `speak`, `gesture`, `emote`.
+
+### Embed → host (outbound)
+
+| type | payload | when |
+| --------------- | --------------------------------------------------- | ----------------------------------- |
+| `embed:hello` | `{ embedVersion, agentId, capabilities }` | On load and on `host:hello` |
+| `embed:ready` | `{ agentId, name, avatarUrl }` | Avatar fully loaded |
+| `embed:blocked` | `{ reason }` | Embed-policy check failed |
+| `embed:error` | `{ code, message, phase }` | Boot or runtime error |
+| `embed:action` | `{ action: { type, payload, timestamp, agentId } }` | Mirrors every dispatched action |
+| `embed:resize` | `{ width, height, contentHeight }` | On element resize (debounced 100ms) |
+| `embed:pong` | `{}` | Reply to `host:ping` |
+
+### Origin rules
+
+- `chat.lobehub.com` and `lobechat.ai` are trusted unconditionally.
+- Pass `?host=<encoded-origin>` to narrow trust to a single parent origin.
+- `localhost` / `127.0.0.1` / `.local` are trusted in development (logged, not blocked).
+- Unknown origins are permitted but logged — public agents may embed anywhere.
+
+### Legacy compat
+
+The format `{ __agent: <id>, type: 'action', action }` from existing embedders is accepted for one version. Migrate to the v1 envelope.
+
+## Acceptance-test handshake
+
+For quick integration testing, posting `{ type: 'handshake' }` from any origin returns `{ type: 'ready', agentId }` without envelope wrapping. This is NOT the production protocol.
+
+## What this plugin does NOT yet support
+
+- **Host-auth / SIWE** — embedding a user-auth token so the iframe can call authed APIs on behalf of the LobeHub user (spec: `prompts/lobehub-embed/03-host-auth-handoff.md`).
+- **Tool-call relay** — structured LobeHub `tool_call` → action mapping; today the relay passes raw action objects (spec: `prompts/lobehub-embed/04-action-passthrough.md`).
+- **LobeHub marketplace submission** — the manifest is hosted in this repo; no registry entry exists yet (spec: `prompts/lobehub-embed/05-plugin-submission.md`).
+- **MCP tool semantics** — the `api` entries point at `/api/mcp` but the `tool` dispatch mapping from LobeHub's tool-call format to MCP JSON-RPC is not wired.
+- **Emote public API** — `host:action` with `type: emote` dispatches a `CustomEvent` on the element but `<agent-3d>` has no public `emote()` method; internal routing depends on element.js wiring.
+
+## Related specs
+
+- `prompts/lobehub-embed/01-plugin-manifest.md` — manifest design
+- `prompts/lobehub-embed/02-iframe-handshake.md` — full postMessage protocol
+- `prompts/lobehub-embed/03-host-auth-handoff.md` — auth handoff (not yet implemented)
+- `prompts/lobehub-embed/04-action-passthrough.md` — tool relay (not yet implemented)
diff --git a/public/lobehub/iframe/boot.js b/public/lobehub/iframe/boot.js
new file mode 100644
index 000000000..54e0011bf
--- /dev/null
+++ b/public/lobehub/iframe/boot.js
@@ -0,0 +1,240 @@
+// LobeHub iframe postMessage bridge for 3D Agent.
+// Envelope: { v: 1, ns: '3d-agent', type, id?, payload }
+// See public/lobehub/README.md for full contract.
+
+const NS = '3d-agent';
+const V = 1;
+const EMBED_VERSION = '0.1.0';
+
+// Origins trusted unconditionally (no ?host= needed).
+const KNOWN_ORIGINS = new Set(['https://chat.lobehub.com', 'https://lobechat.ai']);
+
+function isDev(origin) {
+ try {
+ const h = new URL(origin).hostname;
+ return h === 'localhost' || h === '127.0.0.1' || h.endsWith('.local') || h === '0.0.0.0';
+ } catch {
+ return false;
+ }
+}
+
+const params = new URL(location.href).searchParams;
+const agentId = params.get('agent') || '';
+
+// ?host=<encoded-origin> narrows the allowed parent to a single origin.
+let allowedOrigin = null;
+const hostParam = params.get('host');
+if (hostParam) {
+ try {
+ allowedOrigin = new URL(decodeURIComponent(hostParam)).origin;
+ } catch {
+ console.warn('[3d-agent:bridge] invalid ?host param');
+ }
+}
+
+function isAllowedOrigin(origin) {
+ if (!origin) return false;
+ if (allowedOrigin) return origin === allowedOrigin;
+ if (KNOWN_ORIGINS.has(origin)) return true;
+ if (isDev(origin)) return true;
+ // Permit unlisted origins but log — public agents may embed anywhere.
+ console.warn('[3d-agent:bridge] message from unlisted origin', origin);
+ return true;
+}
+
+function postToHost(type, payload, replyId) {
+ const msg = { v: V, ns: NS, type, payload: payload ?? {} };
+ if (replyId !== undefined) msg.id = replyId;
+ const target = allowedOrigin || '*';
+ try {
+ window.parent.postMessage(msg, target);
+ } catch {}
+}
+
+// ── Element wiring ────────────────────────────────────────────────────────────
+
+const el = document.getElementById('agent');
+const statusEl = document.getElementById('status');
+
+function setStatus(text) {
+ if (statusEl) statusEl.textContent = text;
+}
+
+if (agentId) {
+ el.setAttribute('agent-id', agentId);
+} else {
+ setStatus('No agent specified — add ?agent=<id> to the URL.');
+}
+
+el.addEventListener('agent:ready', (ev) => {
+ const { manifest } = ev.detail || {};
+ if (statusEl) statusEl.style.display = 'none';
+ postToHost('embed:ready', {
+ agentId,
+ name: manifest?.meta?.name || manifest?.name || '',
+ avatarUrl: manifest?.body?.url || '',
+ });
+});
+
+el.addEventListener('agent:error', (ev) => {
+ const { phase, error: err } = ev.detail || {};
+ setStatus(err?.message || 'Error loading agent');
+ postToHost('embed:error', {
+ code: err?.code || 'load_error',
+ message: err?.message || 'Agent failed to load',
+ phase: phase || 'boot',
+ });
+});
+
+// ── ResizeObserver → embed:resize (debounced 100ms) ──────────────────────────
+
+if (typeof ResizeObserver !== 'undefined') {
+ let resizeTimer;
+ const ro = new ResizeObserver(() => {
+ clearTimeout(resizeTimer);
+ resizeTimer = setTimeout(() => {
+ postToHost('embed:resize', {
+ width: el.offsetWidth,
+ height: el.offsetHeight,
+ contentHeight: el.scrollHeight,
+ });
+ }, 100);
+ });
+ ro.observe(el);
+}
+
+// ── Action dispatch ───────────────────────────────────────────────────────────
+
+async function dispatchAction(action) {
+ if (!action || !action.type) return;
+ try {
+ switch (action.type) {
+ case 'speak':
+ await el.say?.(action.payload?.text || '', {
+ sentiment: action.payload?.sentiment,
+ });
+ break;
+ case 'gesture':
+ if (action.payload?.name === 'wave') {
+ await el.wave?.();
+ } else {
+ await el.play?.(action.payload?.name, { duration: action.payload?.duration });
+ }
+ break;
+ case 'emote':
+ // TODO(lobehub-spec): <agent-3d> has no direct emote() public method.
+ // Dispatching as a CustomEvent; element.js may not consume it without
+ // a corresponding listener. Confirm with src/element.js maintainer.
+ el.dispatchEvent(new CustomEvent('agent:action', { detail: action }));
+ break;
+ default:
+ el.dispatchEvent(new CustomEvent('agent:action', { detail: action }));
+ }
+ // Mirror action up to host so it can log what the avatar did.
+ postToHost('embed:action', {
+ action: { ...action, timestamp: Date.now(), agentId },
+ });
+ } catch (err) {
+ console.warn('[3d-agent:bridge] action dispatch failed', err);
+ }
+}
+
+// ── Theme ─────────────────────────────────────────────────────────────────────
+
+function applyTheme({ mode, accent } = {}) {
+ if (mode === 'dark') document.body.style.background = '#0b0d10';
+ else if (mode === 'light') document.body.style.background = '#f5f5f5';
+ else if (mode === 'transparent') document.body.style.background = 'transparent';
+ if (accent) document.documentElement.style.setProperty('--agent-accent', accent);
+}
+
+// ── postMessage handler ───────────────────────────────────────────────────────
+
+function onMessage(ev) {
+ const { origin, data } = ev;
+ if (!data || typeof data !== 'object') return;
+
+ // Acceptance-test handshake: { type: 'handshake' } → { type: 'ready' }
+ if (data.type === 'handshake') {
+ try {
+ window.parent.postMessage({ type: 'ready', agentId }, ev.origin || '*');
+ } catch {}
+ return;
+ }
+
+ // Legacy compat: { __agent, type: 'action', action } — deprecated, one version support.
+ if (data.__agent !== undefined) {
+ if (data.__agent === agentId && data.type === 'action' && data.action) {
+ console.warn('[3d-agent:bridge] legacy message format — migrate to v1 envelope');
+ dispatchAction(data.action);
+ }
+ return;
+ }
+
+ if (!isAllowedOrigin(origin)) return;
+
+ // v1 envelope validation
+ if (data.v !== V || data.ns !== NS || !data.type) return;
+ const { type, id, payload = {} } = data;
+ console.log('[3d-agent:bridge] recv', type, payload);
+
+ switch (type) {
+ case 'host:hello':
+ postToHost(
+ 'embed:hello',
+ {
+ embedVersion: EMBED_VERSION,
+ agentId,
+ capabilities: [
+ 'speak',
+ 'gesture',
+ 'emote',
+ 'theme',
+ 'resize',
+ 'pause',
+ 'resume',
+ 'set-agent',
+ ],
+ },
+ id,
+ );
+ break;
+
+ case 'host:ping':
+ postToHost('embed:pong', {}, id);
+ break;
+
+ case 'host:action':
+ if (payload.action) dispatchAction(payload.action);
+ break;
+
+ case 'host:pause':
+ el.pause?.();
+ break;
+
+ case 'host:resume':
+ el.resume?.();
+ break;
+
+ case 'host:theme':
+ applyTheme(payload);
+ break;
+
+ case 'host:set-agent':
+ if (payload.agentId && payload.agentId !== agentId) {
+ const url = new URL(location.href);
+ url.searchParams.set('agent', payload.agentId);
+ location.replace(url.toString());
+ }
+ break;
+ }
+}
+
+window.addEventListener('message', onMessage);
+
+// Fire initial hello so host knows the iframe is alive.
+postToHost('embed:hello', {
+ embedVersion: EMBED_VERSION,
+ agentId,
+ capabilities: ['speak', 'gesture', 'emote', 'theme', 'resize', 'pause', 'resume', 'set-agent'],
+});
diff --git a/public/lobehub/iframe/index.html b/public/lobehub/iframe/index.html
new file mode 100644
index 000000000..c15054522
--- /dev/null
+++ b/public/lobehub/iframe/index.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>3D Agent — LobeHub Embed</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <meta name="robots" content="noindex" />
+ <style>
+ html,
+ body {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+ background: transparent;
+ overflow: hidden;
+ }
+ agent-3d {
+ display: block;
+ width: 100%;
+ height: 100%;
+ }
+ #status {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: rgba(255, 255, 255, 0.4);
+ font:
+ 13px system-ui,
+ sans-serif;
+ pointer-events: none;
+ }
+ </style>
+ <!--
+ TODO(lobehub-sdk): Replace with versioned CDN URL once agent-3d releases are
+ published to /agent-3d/latest/. Dev: run `npm run build:lib` then serve
+ dist-lib/ under /agent-3d/latest/.
+ TODO(lobehub-spec): Confirm LobeHub sandbox CSP allows module scripts from
+ cross-origin CDN, or switch to a bundled inline approach.
+ -->
+ <script
+ type="module"
+ src="https://3dagent.vercel.app/agent-3d/latest/agent-3d.js"
+ crossorigin
+ ></script>
+ </head>
+ <body>
+ <div id="status">Loading…</div>
+ <!-- agent-id is set dynamically by boot.js from ?agent= param -->
+ <agent-3d id="agent" kiosk eager></agent-3d>
+ <script type="module" src="./boot.js"></script>
+ </body>
+</html>
diff --git a/public/lobehub/plugin.json b/public/lobehub/plugin.json
new file mode 100644
index 000000000..315832063
--- /dev/null
+++ b/public/lobehub/plugin.json
@@ -0,0 +1,98 @@
+{
+ "$schema": "https://lobehub.com/schema/plugin-manifest/v1.json",
+ "identifier": "3d-agent",
+ "version": "0.1.0",
+ "author": "3D Agent",
+ "homepage": "https://3dagent.vercel.app",
+ "meta": {
+ "title": "3D Agent",
+ "description": "Embodied 3D avatar agent with continuous emotion blending. Renders a rigged glTF avatar inside chat, responds with gestures, speech, and on-chain ERC-8004 identity.",
+ "avatar": "https://3dagent.vercel.app/icon.svg",
+ "tags": ["3d", "avatar", "agent", "embodied", "empathy", "erc-8004"]
+ },
+ "ui": {
+ "url": "https://3dagent.vercel.app/lobehub/iframe/",
+ "height": 480
+ },
+ "api": [
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "render_agent",
+ "description": "Mount the 3D avatar for a given agent id. Call this first to bind the iframe to a specific agent before using speak/gesture/emote.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "agentId": {
+ "type": "string",
+ "description": "Agent identity id (UUID) to render."
+ }
+ },
+ "required": ["agentId"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "speak",
+ "description": "Make the avatar speak with optional emotional valence.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "text": {
+ "type": "string",
+ "description": "Text for the avatar to speak aloud."
+ },
+ "sentiment": {
+ "type": "number",
+ "description": "Emotional valence in [-1, 1]. Negative → concern, positive → celebration.",
+ "minimum": -1,
+ "maximum": 1
+ }
+ },
+ "required": ["text"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "gesture",
+ "description": "Trigger a named gesture on the avatar.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Gesture to play.",
+ "enum": ["wave", "nod", "point", "shrug"]
+ },
+ "duration": {
+ "type": "number",
+ "description": "Gesture duration in seconds (optional)."
+ }
+ },
+ "required": ["name"]
+ }
+ },
+ {
+ "url": "https://3dagent.vercel.app/api/mcp",
+ "name": "emote",
+ "description": "Inject an emotion into the avatar's continuous Empathy Layer blend.",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "trigger": {
+ "type": "string",
+ "description": "Emotion to inject.",
+ "enum": ["concern", "celebration", "patience", "curiosity", "empathy"]
+ },
+ "weight": {
+ "type": "number",
+ "description": "Blend weight in [0, 1] (defaults to 1).",
+ "minimum": 0,
+ "maximum": 1
+ }
+ },
+ "required": ["trigger"]
+ }
+ }
+ ],
+ "systemRole": "You have an embodied 3D avatar agent visible in the chat. It displays emotional responses in real time using a continuous Empathy Layer blend. Use render_agent to bind it to a specific agent, speak to give it voice with emotional valence, gesture for physical expression, and emote to inject emotional state directly into its blend."
+}
diff --git a/public/reputation/index.html b/public/reputation/index.html
index bb0368c1d..86fe7af1c 100644
--- a/public/reputation/index.html
+++ b/public/reputation/index.html
@@ -11,10 +11,7 @@
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
- <link
- href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap"
- rel="stylesheet"
- />
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet" />
<style>
* {
@@ -79,7 +76,6 @@
color: #c4b5fd;
}
- /* Header */
.rep-header {
margin-bottom: 2rem;
padding-bottom: 1.5rem;
@@ -95,7 +91,6 @@
font-size: 0.875rem;
}
- /* Stats Row */
.rep-stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
@@ -128,7 +123,6 @@
font-family: 'Space Grotesk', monospace;
}
- /* Reviews Section */
.rep-reviews {
margin-bottom: 2rem;
}
@@ -160,10 +154,6 @@
border-color: rgba(255, 255, 255, 0.12);
}
- .rep-review-item.pending {
- opacity: 0.75;
- }
-
.rep-review-header {
display: flex;
justify-content: space-between;
@@ -186,7 +176,7 @@
}
.rep-comment {
- margin: 0.75rem 0 0.75rem 0;
+ margin: 0.75rem 0;
color: rgba(229, 229, 229, 0.8);
font-size: 0.9375rem;
line-height: 1.6;
@@ -203,34 +193,8 @@
.rep-review-footer a {
color: #a78bfa;
- text-decoration: none;
}
- .rep-review-footer a:hover {
- text-decoration: underline;
- }
-
- .rep-tx-hash {
- color: rgba(229, 229, 229, 0.5);
- font-family: monospace;
- }
-
- .rep-pending-badge {
- background: rgba(251, 191, 36, 0.15);
- color: #fbbf24;
- padding: 0.25rem 0.5rem;
- border-radius: 3px;
- font-weight: 500;
- }
-
- .rep-more-reviews {
- text-align: center;
- color: rgba(229, 229, 229, 0.5);
- font-size: 0.875rem;
- margin-top: 1rem;
- }
-
- /* Submit Form */
.rep-submit-form {
margin-top: 2.5rem;
padding: 1.5rem;
@@ -254,18 +218,19 @@
display: flex;
gap: 0.5rem;
margin-bottom: 0.5rem;
+ flex-wrap: wrap;
}
.rep-star-btn {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
color: rgba(229, 229, 229, 0.6);
- font-size: 1.5rem;
- width: 3rem;
- height: 3rem;
+ font-size: 0.75rem;
+ padding: 0.5rem 0.75rem;
border-radius: 6px;
cursor: pointer;
transition: all 0.15s;
+ font-weight: 500;
}
.rep-star-btn:hover {
@@ -291,9 +256,6 @@
font-size: 0.9375rem;
line-height: 1.5;
resize: vertical;
- transition:
- background 0.15s,
- border-color 0.15s;
}
textarea:focus {
@@ -324,11 +286,6 @@
.rep-submit-btn:hover:not(:disabled) {
background: #7c3aed;
- transform: translateY(-1px);
- }
-
- .rep-submit-btn:active:not(:disabled) {
- transform: translateY(0);
}
.rep-submit-btn:disabled {
@@ -345,7 +302,6 @@
display: none;
}
- /* Error State */
.rep-error {
padding: 2rem;
text-align: center;
@@ -372,14 +328,16 @@
border-radius: 4px;
cursor: pointer;
font-weight: 500;
- transition: all 0.15s;
}
- .rep-error button:hover {
- background: rgba(255, 100, 100, 0.3);
+ .rep-success {
+ padding: 1rem;
+ background: rgba(100, 200, 100, 0.1);
+ border: 1px solid rgba(100, 200, 100, 0.3);
+ border-radius: 8px;
+ color: #86efac;
}
- /* Loading */
.rep-loading {
text-align: center;
padding: 2rem;
@@ -402,7 +360,6 @@
}
}
- /* Responsive */
@media (max-width: 640px) {
main {
padding: 1rem;
@@ -422,24 +379,6 @@
flex-direction: column;
align-items: flex-start;
}
-
- .rep-stars-input {
- gap: 0.25rem;
- }
-
- .rep-star-btn {
- width: 2.5rem;
- height: 2.5rem;
- font-size: 1.25rem;
- }
- }
-
- @media (prefers-reduced-motion: reduce) {
- * {
- animation-duration: 0.01ms !important;
- animation-iteration-count: 1 !important;
- transition-duration: 0.01ms !important;
- }
}
</style>
</head>
@@ -451,52 +390,6 @@
</div>
</main>
- <script type="module">
- import { ReputationDashboard } from '/src/reputation-ui.js';
-
- function getQueryParam(name) {
- const params = new URLSearchParams(window.location.search);
- return params.get(name);
- }
-
- async function init() {
- const agentId = getQueryParam('agent');
- const chainId = getQueryParam('chain');
-
- if (!agentId) {
- document.querySelector('#app').innerHTML = `
- <div class="rep-error">
- <h3>Missing agent ID</h3>
- <p>URL parameter required: ?agent=&lt;id&gt;&amp;chain=&lt;chainId&gt;</p>
- <p style="color: rgba(229,229,229,0.5); font-size: 0.875rem;">
- Example: ?agent=1&amp;chain=84532
- </p>
- </div>
- `;
- return;
- }
-
- const resolvedChainId = chainId ? Number(chainId) : 84532; // Default: Base Sepolia
-
- const app = document.querySelector('#app');
- const dashboard = new ReputationDashboard(app, {
- agentId: Number(agentId),
- chainId: resolvedChainId,
- });
-
- await dashboard.load();
- }
-
- init().catch((err) => {
- console.error('Init failed:', err);
- document.querySelector('#app').innerHTML = `
- <div class="rep-error">
- <h3>Failed to initialize</h3>
- <p>${err.message || String(err)}</p>
- <button onclick="location.reload()">Retry</button>
- </div>
- `;
- });
- </script>
+ <script type="module" src="./reputation.js"></script>
</body>
</html>
diff --git a/public/validation/boot.js b/public/validation/boot.js
index 4db292be6..6af002483 100644
--- a/public/validation/boot.js
+++ b/public/validation/boot.js
@@ -3,6 +3,6 @@
* Exported as a module to avoid bundler requirement.
*/
-import { ValidationDashboard } from '/src/validation-ui.js';
+import { ValidationDashboard } from '../../src/validation-ui.js';
export { ValidationDashboard };
diff --git a/scripts/migrations/add-avatar-versions.sql b/scripts/migrations/add-avatar-versions.sql
new file mode 100644
index 000000000..93a8459a4
--- /dev/null
+++ b/scripts/migrations/add-avatar-versions.sql
@@ -0,0 +1,15 @@
+-- Avatar GLB snapshot history for save-back rollback.
+-- Idempotent — safe to re-run.
+-- Run via: psql $DATABASE_URL -f scripts/migrations/add-avatar-versions.sql
+-- or: node scripts/apply-schema.mjs (picks up this file automatically if wired)
+
+create table if not exists avatar_versions (
+ id bigserial primary key,
+ avatar_id uuid not null references avatars(id) on delete cascade,
+ glb_url text not null,
+ metadata jsonb,
+ created_at timestamptz not null default now(),
+ created_by uuid references users(id)
+);
+
+create index if not exists avatar_versions_avatar_id_idx on avatar_versions(avatar_id, created_at desc);
diff --git a/specs/EMBED_HOST_PROTOCOL.md b/specs/EMBED_HOST_PROTOCOL.md
new file mode 100644
index 000000000..b80fb3835
--- /dev/null
+++ b/specs/EMBED_HOST_PROTOCOL.md
@@ -0,0 +1,307 @@
+# EMBED_HOST_PROTOCOL — v1
+
+Versioned postMessage bus between a host page (Claude.ai, LobeHub, blog) and an embedded 3D Agent iframe.
+
+---
+
+## Envelope
+
+Every message is a JSON object:
+
+```json
+{ "v": 1, "type": "<direction>.<category>", "id": "<optional>", "payload": { ... } }
+```
+
+| Field | Required | Description |
+|---|---|---|
+| `v` | yes | Protocol version integer. Current: `1`. |
+| `type` | yes | Dot-namespaced string. `host.*` or `embed.*`. |
+| `id` | request/response only | Correlation token for request–response pairs. |
+| `payload` | conditional | Type-specific data object. |
+
+Messages missing `v: 1` or `type` are malformed and MUST be ignored by the receiver (embed sends one `embed.error` diagnostic; host should log and discard).
+
+---
+
+## Host → Embed messages
+
+### `host.hello`
+
+Sent once after the iframe load event. Initiates the handshake.
+
+```json
+{
+ "v": 1,
+ "type": "host.hello",
+ "payload": {
+ "hostName": "claude.ai",
+ "hostVersion": "2024-11",
+ "hostOrigin": "https://claude.ai",
+ "userId": "u_abc123",
+ "userName": "Alice"
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `hostName` | yes | string |
+| `hostVersion` | yes | string |
+| `hostOrigin` | yes | string (origin URL) |
+| `userId` | no | string |
+| `userName` | no | string |
+
+---
+
+### `host.chat.message`
+
+Delivers a chat turn into the agent.
+
+```json
+{
+ "v": 1,
+ "type": "host.chat.message",
+ "payload": {
+ "role": "user",
+ "text": "Hello, tell me about yourself.",
+ "messageId": "msg_001"
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `role` | yes | `"user"` \| `"assistant"` |
+| `text` | yes | string |
+| `messageId` | yes | string (unique per message) |
+
+---
+
+### `host.action`
+
+Triggers a named action on the agent (emotes, speech, etc.).
+
+```json
+{
+ "v": 1,
+ "type": "host.action",
+ "payload": {
+ "action": "emote.wave",
+ "args": {}
+ }
+}
+```
+
+```json
+{
+ "v": 1,
+ "type": "host.action",
+ "payload": {
+ "action": "speak",
+ "args": { "text": "Welcome back!" }
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `action` | yes | string |
+| `args` | no | object |
+
+---
+
+### `host.theme`
+
+Updates the embed's visual theme.
+
+```json
+{
+ "v": 1,
+ "type": "host.theme",
+ "payload": {
+ "mode": "dark"
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `mode` | yes | `"dark"` \| `"light"` |
+
+---
+
+### `host.response`
+
+Reply to an `embed.request`. Identified by matching `id`.
+
+```json
+{
+ "v": 1,
+ "type": "host.response",
+ "id": "<same id as embed.request>",
+ "payload": {
+ "result": { ... }
+ }
+}
+```
+
+On error:
+
+```json
+{
+ "v": 1,
+ "type": "host.response",
+ "id": "<same id>",
+ "payload": {
+ "error": { "code": "NOT_FOUND", "message": "resource not found" }
+ }
+}
+```
+
+---
+
+## Embed → Host messages
+
+### `embed.ready`
+
+Sent by the embed after `start()` to announce the agent is live.
+
+```json
+{
+ "v": 1,
+ "type": "embed.ready",
+ "payload": {
+ "agentId": "agent_xyz",
+ "version": "1.0.0",
+ "capabilities": ["chat", "emote", "speak"]
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `agentId` | yes | string |
+| `version` | yes | semver string |
+| `capabilities` | yes | string[] |
+
+---
+
+### `embed.event`
+
+Generic agent lifecycle or interaction event stream.
+
+```json
+{
+ "v": 1,
+ "type": "embed.event",
+ "payload": {
+ "event": "agent.speaking",
+ "data": { "text": "Hello!" }
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `event` | yes | string |
+| `data` | no | object |
+
+Common event names: `agent.speaking`, `agent.idle`, `agent.emote`, `agent.error`.
+
+---
+
+### `embed.error`
+
+Reports a protocol-level error to the host (malformed message received, unsupported action, etc.).
+
+```json
+{
+ "v": 1,
+ "type": "embed.error",
+ "payload": {
+ "code": "MALFORMED_MESSAGE",
+ "message": "missing v:1 or type"
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `code` | yes | UPPER_SNAKE string |
+| `message` | yes | string |
+
+---
+
+### `embed.request`
+
+Ask the host for data or an action. Host replies with `host.response` matching `id`.
+
+```json
+{
+ "v": 1,
+ "type": "embed.request",
+ "id": "req_abc",
+ "payload": {
+ "method": "host.getUser",
+ "params": {}
+ }
+}
+```
+
+| Field | Required | Type |
+|---|---|---|
+| `id` | yes | string (unique per request) |
+| `payload.method` | yes | string |
+| `payload.params` | no | object |
+
+Default timeout: 5 000 ms. After timeout the pending request rejects with a timeout error.
+
+---
+
+## Handshake sequence
+
+```
+Host Embed
+ | |
+ | <-- iframe loads |
+ | | start() called
+ | | send('embed.ready', { ... })
+ | --> host.hello |
+ | dispatchEvent('host.hello') |
+ | |
+ | --> host.chat.message |
+ | dispatchEvent(...) |
+```
+
+The embed sends `embed.ready` immediately on `start()`. The host may send `host.hello` at any time; the embed re-emits it as a `CustomEvent` named `host.hello`.
+
+---
+
+## Origin allowlist
+
+`EmbedHostBridge` accepts an `allowedOrigins` constructor option:
+
+| Value | Behaviour |
+|---|---|
+| `'*'` (default) | Accept messages from any `window.parent` origin. |
+| `string[]` | Accept only listed origins (exact match). Example: `['https://claude.ai', 'https://lobehub.com']`. |
+
+Messages from non-parent frames are always rejected regardless of allowlist.
+
+---
+
+## Versioning policy
+
+- `v` is an integer incremented on **breaking changes** (field renames, removed types, changed semantics).
+- New optional fields and new message types are **non-breaking** — do not bump `v`.
+- Deprecated types MUST be supported for one full minor version before removal.
+- Receivers MUST silently ignore unknown types (log once; do not crash; do not send `embed.error` for unknown types from a higher version).
+
+---
+
+## Security notes
+
+- The embed MUST validate `e.source === window.parent` and origin against its allowlist before processing any message.
+- Hosts MUST validate `e.source` is the expected iframe `contentWindow`.
+- Neither side should `eval` or `new Function` message content.
+- Sensitive user data in `host.hello` (`userId`, `userName`) should not be logged to an analytics pipeline without user consent.
diff --git a/src/agent-naming.js b/src/agent-naming.js
new file mode 100644
index 000000000..e11cd1a80
--- /dev/null
+++ b/src/agent-naming.js
@@ -0,0 +1,192 @@
+const NAME_RE = /^[a-zA-Z0-9_-]{3,32}$/;
+
+const DENYLIST = new Set([
+ 'admin',
+ 'root',
+ 'system',
+ 'anthropic',
+ 'claude',
+ 'openai',
+ 'null',
+ 'undefined',
+ 'test',
+]);
+
+export class AgentNaming {
+ constructor({ container, initialName = '', onSubmit }) {
+ this._container = container;
+ this._initialName = initialName;
+ this._onSubmit = onSubmit;
+ this._debounceTimer = null;
+ this._abort = null;
+ this._checkState = 'idle'; // idle | loading | valid | invalid
+ this._lastCheckedName = null;
+ this._root = null;
+ }
+
+ mount() {
+ this._root = document.createElement('div');
+ this._root.className = 'agent-naming';
+ this._root.innerHTML = `
+<style>
+.agent-naming { display: flex; flex-direction: column; gap: 16px; max-width: 480px; font-family: inherit; }
+.an-field { display: flex; flex-direction: column; gap: 4px; }
+.an-field label { font-size: 14px; font-weight: 600; }
+.an-required { color: #e53; }
+.an-input-wrap { display: flex; align-items: center; gap: 8px; }
+.an-input-wrap input { flex: 1; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
+.an-status { font-size: 13px; min-width: 20px; white-space: nowrap; }
+.an-status[data-state="valid"] { color: #2a9d2a; }
+.an-status[data-state="invalid"] { color: #c0392b; }
+.an-status[data-state="loading"] { color: #888; }
+.an-hint { font-size: 12px; color: #888; }
+.an-field textarea { padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; resize: vertical; }
+.an-counter { font-size: 12px; color: #888; text-align: right; }
+.an-submit { padding: 10px 20px; background: #4f46e5; color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
+.an-submit:disabled { opacity: 0.45; cursor: not-allowed; }
+</style>
+<div class="an-field">
+ <label for="an-name">Name <span class="an-required">*</span></label>
+ <div class="an-input-wrap">
+ <input id="an-name" type="text" maxlength="32" autocomplete="off" spellcheck="false" placeholder="my-agent" />
+ <span class="an-status" aria-live="polite" data-state=""></span>
+ </div>
+ <div class="an-hint">3–32 chars · letters, numbers, _ and - only</div>
+</div>
+<div class="an-field">
+ <label for="an-desc">Description</label>
+ <textarea id="an-desc" maxlength="280" rows="3" placeholder="What does your agent do?"></textarea>
+ <div class="an-counter">0 / 280</div>
+</div>
+<button class="an-submit" type="button" disabled>Create agent</button>
+`;
+
+ this._nameInput = this._root.querySelector('#an-name');
+ this._descInput = this._root.querySelector('#an-desc');
+ this._statusEl = this._root.querySelector('.an-status');
+ this._submitBtn = this._root.querySelector('.an-submit');
+ this._counterEl = this._root.querySelector('.an-counter');
+
+ this._onNameInput = () => this._handleNameInput();
+ this._onDescInput = () => this._handleDescInput();
+ this._onSubmitClick = () => this._handleSubmit();
+
+ this._nameInput.addEventListener('input', this._onNameInput);
+ this._descInput.addEventListener('input', this._onDescInput);
+ this._submitBtn.addEventListener('click', this._onSubmitClick);
+
+ this._container.appendChild(this._root);
+
+ if (this._initialName) {
+ this._nameInput.value = this._initialName;
+ this._handleNameInput();
+ }
+ }
+
+ unmount() {
+ if (this._debounceTimer) clearTimeout(this._debounceTimer);
+ if (this._abort) this._abort.abort();
+ this._nameInput?.removeEventListener('input', this._onNameInput);
+ this._descInput?.removeEventListener('input', this._onDescInput);
+ this._submitBtn?.removeEventListener('click', this._onSubmitClick);
+ this._root?.remove();
+ this._root = null;
+ }
+
+ _handleNameInput() {
+ const name = this._nameInput.value;
+
+ if (this._debounceTimer) clearTimeout(this._debounceTimer);
+ if (this._abort) this._abort.abort();
+
+ const localError = this._validateLocal(name);
+ if (localError) {
+ this._setStatus('invalid', localError);
+ return;
+ }
+
+ this._setStatus('loading', '');
+ this._debounceTimer = setTimeout(() => this._runCheck(name), 400);
+ }
+
+ _handleDescInput() {
+ const len = this._descInput.value.length;
+ this._counterEl.textContent = `${len} / 280`;
+ }
+
+ _validateLocal(name) {
+ if (!name) return 'Name is required.';
+ if (name.length < 3) return 'At least 3 characters required.';
+ if (name.length > 32) return '32 characters maximum.';
+ if (!NAME_RE.test(name)) return 'Letters, numbers, _ and - only.';
+ if (DENYLIST.has(name.toLowerCase())) return 'That name is reserved.';
+ return null;
+ }
+
+ async _runCheck(name) {
+ this._abort = new AbortController();
+ try {
+ const res = await fetch(`/api/agents/check-name?name=${encodeURIComponent(name)}`, {
+ signal: this._abort.signal,
+ credentials: 'include',
+ });
+ const data = await res.json();
+ this._lastCheckedName = name;
+ if (data.available) {
+ this._setStatus('valid', '');
+ } else {
+ this._setStatus('invalid', this._reasonText(data.reason));
+ }
+ } catch (err) {
+ if (err.name === 'AbortError') return;
+ this._lastCheckedName = null;
+ this._setStatus('invalid', 'Could not check availability.');
+ }
+ }
+
+ _reasonText(reason) {
+ if (reason === 'taken') return 'Name is already taken.';
+ if (reason === 'denylisted') return 'That name is reserved.';
+ return 'Name is not available.';
+ }
+
+ _setStatus(state, message) {
+ this._checkState = state;
+ this._statusEl.dataset.state = state;
+ if (state === 'loading') {
+ this._statusEl.textContent = '…';
+ } else if (state === 'valid') {
+ this._statusEl.textContent = '✓';
+ } else if (state === 'invalid') {
+ this._statusEl.textContent = message ? `✗ ${message}` : '✗';
+ } else {
+ this._statusEl.textContent = '';
+ }
+ this._submitBtn.disabled = state !== 'valid';
+ }
+
+ async _handleSubmit() {
+ const name = this._nameInput.value;
+
+ const localError = this._validateLocal(name);
+ if (localError) {
+ this._setStatus('invalid', localError);
+ return;
+ }
+
+ // Re-run server check if input changed since last confirmed check.
+ if (this._lastCheckedName !== name) {
+ if (this._debounceTimer) clearTimeout(this._debounceTimer);
+ await this._runCheck(name);
+ if (this._checkState !== 'valid') return;
+ }
+
+ this._submitBtn.disabled = true;
+ try {
+ await this._onSubmit({ name, description: this._descInput.value.trim() });
+ } finally {
+ // Re-enable only if still mounted.
+ if (this._root) this._submitBtn.disabled = this._checkState !== 'valid';
+ }
+ }
+}
diff --git a/src/agent-resolver.js b/src/agent-resolver.js
index 2651a0b14..cd8cb8350 100644
--- a/src/agent-resolver.js
+++ b/src/agent-resolver.js
@@ -35,6 +35,64 @@ async function fetchJSON(url, { fetchFn }) {
}
}
+const _resolveCache = new Map();
+const _CACHE_MAX = 100;
+
+/**
+ * Resolve an agent ID to its manifest URL via GET /api/agents/:id.
+ * Returns null if the agent record has no manifestUrl (caller may fall back to resolveAgentById).
+ * Throws AgentResolveError('not-found') on 404.
+ *
+ * @param {string} agentId
+ * @param {AbortSignal} [signal]
+ * @returns {Promise<string|null>}
+ */
+export async function resolveByAgentId(agentId, signal) {
+ if (!agentId) throw new AgentResolveError('not-found', 'agentId required');
+
+ if (_resolveCache.has(agentId)) return _resolveCache.get(agentId);
+
+ const origin = typeof location !== 'undefined' ? location.origin : '';
+ const endpoint = `${origin}/api/agents/${encodeURIComponent(agentId)}`;
+
+ let res;
+ try {
+ res = await fetch(endpoint, { credentials: 'include', signal });
+ } catch (err) {
+ if (err?.name === 'AbortError') throw err;
+ throw new AgentResolveError('network', `network error fetching ${endpoint}: ${err.message || err}`);
+ }
+
+ if (res.status === 404)
+ throw new AgentResolveError('not-found', `agent ${agentId} not found`, { status: 404 });
+ if (res.status === 401 || res.status === 403)
+ throw new AgentResolveError('unauthorized', `unauthorized (${res.status})`, { status: res.status });
+ if (!res.ok)
+ throw new AgentResolveError('network', `request failed (${res.status})`, { status: res.status });
+
+ let data;
+ try {
+ data = await res.json();
+ } catch (err) {
+ throw new AgentResolveError('network', `invalid JSON from ${endpoint}`);
+ }
+
+ const raw = data?.agent?.manifestUrl ?? null;
+ let resolved = null;
+ if (raw) {
+ try {
+ resolved = new URL(raw, origin).href;
+ } catch {
+ resolved = raw;
+ }
+ }
+
+ if (_resolveCache.size >= _CACHE_MAX) _resolveCache.delete(_resolveCache.keys().next().value);
+ _resolveCache.set(agentId, resolved);
+
+ return resolved;
+}
+
export async function resolveAgentById(agentId, { origin = typeof location !== 'undefined' ? location.origin : '', fetchFn = fetch } = {}) {
if (!agentId) throw new AgentResolveError('not_found', 'agentId required');
diff --git a/src/agents-directory.js b/src/agents-directory.js
index a0699a6ba..d2288887c 100644
--- a/src/agents-directory.js
+++ b/src/agents-directory.js
@@ -5,7 +5,12 @@
* Uses on-chain data from IdentityRegistry with optional backend metadata.
*/
-import { listRegisteredEvents, getAgentOnchain, fetchAgentMetadata, findAvatar3D } from './erc8004/queries.js';
+import {
+ listRegisteredEvents,
+ getAgentOnchain,
+ fetchAgentMetadata,
+ findAvatar3D,
+} from './erc8004/queries.js';
import { CHAIN_META } from './erc8004/chain-meta.js';
import { REGISTRY_DEPLOYMENTS } from './erc8004/abi.js';
@@ -108,9 +113,7 @@ export class AgentsDirectory {
* Render agent cards as HTML. Call after load().
*/
render() {
- const html = this.displayedAgents
- .map((agent) => this._renderCard(agent))
- .join('');
+ const html = this.displayedAgents.map((agent) => this._renderCard(agent)).join('');
this.container.innerHTML = html;
this._attachEventListeners();
this.setupLazyLoad();
@@ -120,9 +123,7 @@ export class AgentsDirectory {
* Return pagination info for current state.
*/
getPaginationInfo() {
- const totalPages = Math.ceil(
- this._applyFilters().length / ITEMS_PER_PAGE
- );
+ const totalPages = Math.ceil(this._applyFilters().length / ITEMS_PER_PAGE);
return {
page: this.currentPage,
totalPages,
@@ -136,14 +137,13 @@ export class AgentsDirectory {
async _fetchAllAgents() {
const agents = [];
- const chains = ['all'].includes(this.filters.chain)
- ? Object.keys(CHAIN_META).map(Number)
- : [Number(this.filters.chain.split('-')[0]) || 8453]; // Default to Base if unclear
+ const chainId = this._parseChainFilter(this.filters.chain);
+ const chains = chainId === 'all' ? Object.keys(CHAIN_META).map(Number) : [chainId];
- for (const chainId of chains) {
+ for (const cid of chains) {
try {
const events = await listRegisteredEvents({
- chainId,
+ chainId: cid,
limit: 500, // Adjust as needed
});
@@ -151,23 +151,26 @@ export class AgentsDirectory {
try {
const agentId = String(ev.agentId);
const onchain = await getAgentOnchain({
- chainId,
+ chainId: cid,
agentId,
});
let metadata = {};
if (ev.agentURI) {
- metadata = await fetchAgentMetadata(ev.agentURI).catch(() => ({}));
+ const result = await fetchAgentMetadata(ev.agentURI);
+ if (result.ok && result.data) {
+ metadata = result.data;
+ }
}
- const avatar = await findAvatar3D(metadata).catch(() => null);
+ const avatar = findAvatar3D(metadata);
agents.push({
id: agentId,
- chainId,
+ chainId: cid,
name: metadata.name || `Agent #${agentId}`,
description: metadata.description || '',
- avatar: avatar?.url || null,
+ avatar,
owner: onchain.owner || ev.owner,
createdAt: ev.blockNumber
? new Date(ev.blockNumber * 12000) // Rough estimate
@@ -180,7 +183,7 @@ export class AgentsDirectory {
}
}
} catch (err) {
- console.warn(`Failed to fetch chain ${chainId}:`, err);
+ console.warn(`Failed to fetch chain ${cid}:`, err);
}
}
@@ -191,7 +194,7 @@ export class AgentsDirectory {
return this.agents.filter((agent) => {
// Chain filter
if (this.filters.chain !== 'all') {
- const targetChain = Number(this.filters.chain.split('-')[0]) || 8453;
+ const targetChain = Number(this.filters.chain);
if (agent.chainId !== targetChain) return false;
}
@@ -259,13 +262,19 @@ export class AgentsDirectory {
return String(text).replace(/[&<>"']/g, (m) => map[m]);
}
+ _parseChainFilter(filter) {
+ if (filter === 'all') return 'all';
+ const num = Number(filter);
+ return isNaN(num) ? 'all' : num;
+ }
+
_attachEventListeners() {
this.container.querySelectorAll('.agent-card').forEach((card) => {
card.addEventListener('click', () => {
const agentId = card.dataset.agentId;
const chainId = card.dataset.chainId;
const agent = this.agents.find(
- (a) => a.id === agentId && a.chainId === Number(chainId)
+ (a) => a.id === agentId && a.chainId === Number(chainId),
);
if (agent && this.cardClickHandler) {
this.cardClickHandler(agent);
diff --git a/src/avaturn-client.js b/src/avaturn-client.js
new file mode 100644
index 000000000..cbf4aa278
--- /dev/null
+++ b/src/avaturn-client.js
@@ -0,0 +1,243 @@
+/**
+ * Avaturn client bridge — session creation + GLB retrieval via hidden iframe.
+ *
+ * Typical usage:
+ *
+ * import { createAvaturnSession, awaitAvatarGLB, blobToDataUrl } from './avaturn-client.js';
+ *
+ * const frontDataUrl = await blobToDataUrl(frontBlob);
+ * const leftDataUrl = await blobToDataUrl(leftBlob);
+ * const rightDataUrl = await blobToDataUrl(rightBlob);
+ *
+ * const { sessionUrl, expiresAt } = await createAvaturnSession({
+ * front: frontDataUrl, left: leftDataUrl, right: rightDataUrl,
+ * });
+ *
+ * const { glbBytes, thumbnailUrl, metadata } = await awaitAvatarGLB({
+ * sessionUrl,
+ * onProgress: ({ step, pct }) => console.log(step, pct),
+ * signal: abortController.signal,
+ * });
+ */
+
+const SESSION_ENDPOINT = '/api/onboarding/avaturn-session';
+const OVERALL_TIMEOUT_MS = 120_000;
+// Reject immediately if session expires within this many ms.
+const EXPIRY_GRACE_MS = 10_000;
+
+// ── Error ────────────────────────────────────────────────────────────────────
+
+export class AvaturnError extends Error {
+ /**
+ * @param {string} message
+ * @param {'quota'|'auth'|'session-expired'|'network'|'timeout'} code
+ */
+ constructor(message, code) {
+ super(message);
+ this.name = 'AvaturnError';
+ this.code = code;
+ }
+}
+
+// ── Helpers ──────────────────────────────────────────────────────────────────
+
+/**
+ * Convert a Blob to a base64 data URL.
+ * @param {Blob} blob
+ * @returns {Promise<string>}
+ */
+export function blobToDataUrl(blob) {
+ return new Promise((resolve, reject) => {
+ const reader = new FileReader();
+ reader.onload = () => resolve(/** @type {string} */ (reader.result));
+ reader.onerror = () => reject(new AvaturnError('blobToDataUrl failed', 'network'));
+ reader.readAsDataURL(blob);
+ });
+}
+
+// ── Session creation ─────────────────────────────────────────────────────────
+
+/**
+ * Exchange three selfie data URLs for an Avaturn session URL.
+ *
+ * @param {{ front: string, left: string, right: string }} photos
+ * Base64 JPEG data URLs (use blobToDataUrl to convert Blobs).
+ * @returns {Promise<{ sessionUrl: string, expiresAt: string | null }>}
+ */
+export async function createAvaturnSession({ front, left, right }) {
+ let res;
+ try {
+ res = await fetch(SESSION_ENDPOINT, {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ // API schema field is 'frontal'; caller-facing param is 'front' for brevity.
+ body: JSON.stringify({ photos: { frontal: front, left, right } }),
+ });
+ } catch (err) {
+ throw new AvaturnError(`network error: ${err?.message}`, 'network');
+ }
+
+ if (!res.ok) {
+ const payload = await res.json().catch(() => ({}));
+ const code = payload?.error;
+ if (res.status === 401 || res.status === 403) throw new AvaturnError(payload?.error_description || 'unauthorized', 'auth');
+ if (res.status === 429) throw new AvaturnError(payload?.error_description || 'rate limited', 'quota');
+ throw new AvaturnError(payload?.error_description || `http ${res.status}`, code === 'not_configured' ? 'auth' : 'network');
+ }
+
+ const data = await res.json();
+ if (!data?.session_url) throw new AvaturnError('server returned no session_url', 'network');
+
+ return { sessionUrl: data.session_url, expiresAt: data.expires_at ?? null };
+}
+
+// ── GLB retrieval via hidden iframe ──────────────────────────────────────────
+
+/**
+ * Mount a hidden Avaturn iframe, wait for the avatar to be exported, fetch the GLB.
+ *
+ * @param {{
+ * sessionUrl: string,
+ * onProgress?: (evt: { step: 'iframe-load'|'avatar-gen'|'glb-fetch', pct: number }) => void,
+ * signal?: AbortSignal,
+ * }} opts
+ * @returns {Promise<{ glbBytes: ArrayBuffer, thumbnailUrl?: string, metadata?: object }>}
+ */
+export async function awaitAvatarGLB({ sessionUrl, onProgress, signal }) {
+ // Reject immediately if the session has effectively expired.
+ const expiresAt = _expiresAtFromUrl(sessionUrl);
+ if (expiresAt !== null && expiresAt - Date.now() < EXPIRY_GRACE_MS) {
+ throw new AvaturnError('session has expired', 'session-expired');
+ }
+
+ const progress = onProgress ?? (() => {});
+ let iframe = null;
+ let timeoutId = null;
+ let messageListener = null;
+
+ const cleanup = () => {
+ if (timeoutId !== null) clearTimeout(timeoutId);
+ if (messageListener) window.removeEventListener('message', messageListener);
+ if (iframe?.parentNode) iframe.parentNode.removeChild(iframe);
+ iframe = null;
+ };
+
+ return new Promise((resolve, reject) => {
+ // Abort support.
+ if (signal?.aborted) {
+ return reject(new DOMException('Aborted', 'AbortError'));
+ }
+ const onAbort = () => {
+ cleanup();
+ reject(new DOMException('Aborted', 'AbortError'));
+ };
+ signal?.addEventListener('abort', onAbort, { once: true });
+
+ // Overall timeout.
+ timeoutId = setTimeout(() => {
+ cleanup();
+ signal?.removeEventListener('abort', onAbort);
+ reject(new AvaturnError('timed out waiting for avatar export', 'timeout'));
+ }, OVERALL_TIMEOUT_MS);
+
+ // Derive allowed origin from sessionUrl so we never hardcode it.
+ let expectedOrigin;
+ try {
+ expectedOrigin = new URL(sessionUrl).origin;
+ } catch {
+ cleanup();
+ signal?.removeEventListener('abort', onAbort);
+ return reject(new AvaturnError('invalid sessionUrl', 'network'));
+ }
+
+ // Hidden iframe.
+ // Avaturn's editor needs allow-popups-to-escape-sandbox in addition to the
+ // base set because it may open OAuth flows in a new window.
+ iframe = document.createElement('iframe');
+ iframe.style.display = 'none';
+ iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox');
+ iframe.setAttribute('title', 'Avaturn avatar export');
+ iframe.setAttribute('aria-hidden', 'true');
+
+ // postMessage listener — scoped strictly to the iframe's origin.
+ messageListener = async (event) => {
+ if (event.origin !== expectedOrigin) return;
+
+ const msg = event.data;
+ if (!msg || typeof msg !== 'object') return;
+
+ // Avaturn fires postMessage events with:
+ // { source: 'avaturn', eventType: 'avatar.exported', data: { url, urlType, avatarId, thumbnailUrl, metadata } }
+ // An earlier 'avatar.ready' event signals the editor is ready.
+ // Ref: Avaturn iframe messaging protocol (see https://docs.avaturn.me — iframe events section).
+ if (msg.source !== 'avaturn') return;
+
+ const eventType = msg.eventType ?? msg.type;
+
+ if (eventType === 'avatar.ready') {
+ progress({ step: 'avatar-gen', pct: 10 });
+ return;
+ }
+
+ if (eventType === 'avatar.exported' || eventType === 'export') {
+ const glbUrl = msg.data?.url ?? msg.url;
+ if (!glbUrl) return;
+
+ progress({ step: 'glb-fetch', pct: 60 });
+
+ try {
+ let fetchRes;
+ try {
+ fetchRes = await fetch(glbUrl, { signal });
+ } catch (err) {
+ throw new AvaturnError(`GLB fetch failed: ${err?.message}`, 'network');
+ }
+ if (!fetchRes.ok) throw new AvaturnError(`GLB fetch ${fetchRes.status}`, 'network');
+
+ const glbBytes = await fetchRes.arrayBuffer();
+ progress({ step: 'glb-fetch', pct: 100 });
+
+ cleanup();
+ signal?.removeEventListener('abort', onAbort);
+ resolve({
+ glbBytes,
+ thumbnailUrl: msg.data?.thumbnailUrl ?? undefined,
+ metadata: msg.data?.metadata ?? undefined,
+ });
+ } catch (err) {
+ cleanup();
+ signal?.removeEventListener('abort', onAbort);
+ reject(err instanceof AvaturnError ? err : new AvaturnError(err?.message ?? 'unknown', 'network'));
+ }
+ }
+ };
+
+ window.addEventListener('message', messageListener);
+
+ iframe.addEventListener('load', () => {
+ progress({ step: 'iframe-load', pct: 5 });
+ }, { once: true });
+
+ document.body.appendChild(iframe);
+ progress({ step: 'iframe-load', pct: 0 });
+ iframe.src = sessionUrl;
+ });
+}
+
+/**
+ * Attempt to read an expiry timestamp encoded in the session URL's query string
+ * (e.g. ?expires_at=...). Returns epoch ms or null if not present / unparseable.
+ * @param {string} sessionUrl
+ * @returns {number|null}
+ */
+function _expiresAtFromUrl(sessionUrl) {
+ try {
+ const param = new URL(sessionUrl).searchParams.get('expires_at');
+ if (!param) return null;
+ const ms = Date.parse(param);
+ return isNaN(ms) ? null : ms;
+ } catch {
+ return null;
+ }
+}
diff --git a/src/camera-capture.css b/src/camera-capture.css
new file mode 100644
index 000000000..538b5a015
--- /dev/null
+++ b/src/camera-capture.css
@@ -0,0 +1,147 @@
+.camera-capture-root {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ background: #0a0a0a;
+ color: #fff;
+ font-family: system-ui, sans-serif;
+ overflow: hidden;
+}
+
+.camera-capture-root .cc-preview-wrap {
+ position: relative;
+ width: min(100%, 480px);
+ aspect-ratio: 1 / 1;
+ border-radius: 12px;
+ overflow: hidden;
+ background: #111;
+ box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
+}
+
+.camera-capture-root video.cc-video,
+.camera-capture-root img.cc-snapshot {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+}
+
+.camera-capture-root video.cc-video {
+ transform: scaleX(-1); /* mirror for selfie UX */
+}
+
+.camera-capture-root .cc-controls {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+ margin-top: 20px;
+ flex-wrap: wrap;
+ justify-content: center;
+}
+
+.camera-capture-root button {
+ cursor: pointer;
+ border: none;
+ font-size: 15px;
+ border-radius: 999px;
+ padding: 10px 24px;
+ font-weight: 600;
+ transition: opacity 0.15s, transform 0.1s;
+}
+
+.camera-capture-root button:active {
+ transform: scale(0.96);
+ opacity: 0.85;
+}
+
+.camera-capture-root .cc-btn-capture {
+ width: 64px;
+ height: 64px;
+ padding: 0;
+ border-radius: 50%;
+ background: #fff;
+ box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25);
+ flex-shrink: 0;
+}
+
+.camera-capture-root .cc-btn-capture::after {
+ content: '';
+ display: block;
+ width: 48px;
+ height: 48px;
+ border-radius: 50%;
+ background: #e0e0e0;
+ margin: auto;
+}
+
+.camera-capture-root .cc-btn-switch {
+ background: rgba(255, 255, 255, 0.12);
+ color: #fff;
+ font-size: 20px;
+ width: 44px;
+ height: 44px;
+ padding: 0;
+ border-radius: 50%;
+}
+
+.camera-capture-root .cc-btn-use {
+ background: #4f8ef7;
+ color: #fff;
+}
+
+.camera-capture-root .cc-btn-retake {
+ background: rgba(255, 255, 255, 0.12);
+ color: #fff;
+}
+
+.camera-capture-root .cc-link-upload {
+ margin-top: 10px;
+ font-size: 13px;
+ color: rgba(255, 255, 255, 0.45);
+ cursor: pointer;
+ text-decoration: underline;
+ background: none;
+ border: none;
+ padding: 4px 8px;
+ border-radius: 4px;
+}
+
+.camera-capture-root .cc-link-upload:hover {
+ color: rgba(255, 255, 255, 0.75);
+}
+
+.camera-capture-root .cc-fallback {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 12px;
+ padding: 32px;
+ text-align: center;
+}
+
+.camera-capture-root .cc-fallback p {
+ font-size: 14px;
+ color: rgba(255, 255, 255, 0.55);
+ margin: 0;
+ max-width: 280px;
+ line-height: 1.5;
+}
+
+.camera-capture-root .cc-btn-file-pick {
+ background: #4f8ef7;
+ color: #fff;
+}
+
+.camera-capture-root .cc-hidden-input {
+ display: none;
+}
+
+.camera-capture-root .cc-error {
+ font-size: 13px;
+ color: #ff6b6b;
+ margin-top: 8px;
+}
diff --git a/src/editor/index.js b/src/editor/index.js
index 492f9b1b4..a41365755 100644
--- a/src/editor/index.js
+++ b/src/editor/index.js
@@ -23,7 +23,9 @@ export class Editor {
this.exportFolder = null;
this._exportCtrl = null;
this._publishCtrl = null;
+ this._saveCtrl = null;
this._publishInFlight = false;
+ this._saveNeedsAuth = false;
this._attached = false;
}
@@ -74,6 +76,9 @@ export class Editor {
'explorer',
)
.name('🗂 scene panel [T]');
+ this._saveCtrl = folder
+ .add({ save: () => this._saveEdits() }, 'save')
+ .name('☁️ save edits');
folder
.add(
{
@@ -118,6 +123,43 @@ export class Editor {
}
}
+ async _saveEdits() {
+ if (this._saveNeedsAuth) {
+ window.location.href = '/login?next=' + encodeURIComponent(location.pathname + location.search + location.hash);
+ return;
+ }
+ const avatarId =
+ this.session.avatarId ?? new URLSearchParams(location.search).get('avatarId');
+ if (!avatarId) {
+ this._saveCtrl?.name('⚠ use Publish instead');
+ setTimeout(() => this._saveCtrl?.name('☁️ save edits'), 2500);
+ return;
+ }
+ const LABEL = '☁️ save edits';
+ const stepPct = { export: 0, presign: 0.25, upload: 0.4, patch: 0.9 };
+ const onStep = ({ step, pct }) => {
+ const base = stepPct[step] ?? 0;
+ const span = step === 'upload' ? 0.5 : step === 'export' ? 0.25 : step === 'presign' ? 0.15 : 0.1;
+ const overall = Math.round((base + pct * span) * 100);
+ this._saveCtrl?.name(`saving… ${overall}%`);
+ };
+ try {
+ const { saveEditedAvatar } = await import('./save-back.js');
+ await saveEditedAvatar(this.session, { avatarId, onStep });
+ this._saveCtrl?.name('saved ✓');
+ setTimeout(() => this._saveCtrl?.name(LABEL), 1500);
+ } catch (err) {
+ if (err?.code === 'auth') {
+ this._saveNeedsAuth = true;
+ this._saveCtrl?.name('⚠ sign in to save (click)');
+ } else {
+ console.error('[editor] save failed', err);
+ this._saveCtrl?.name('⚠ ' + (err?.message || 'save failed'));
+ setTimeout(() => this._saveCtrl?.name(LABEL), 3000);
+ }
+ }
+ }
+
_resetAll() {
if (!this.session.isDirty()) return;
if (!window.confirm('Discard all edits and reload the model?')) return;
@@ -184,6 +226,7 @@ export class Editor {
this.exportFolder = null;
this._exportCtrl = null;
this._publishCtrl = null;
+ this._saveCtrl = null;
this._attached = false;
}
}
diff --git a/src/editor/save-back.js b/src/editor/save-back.js
new file mode 100644
index 000000000..e789d1742
--- /dev/null
+++ b/src/editor/save-back.js
@@ -0,0 +1,101 @@
+import { exportEditedGLB } from './glb-export.js';
+
+const MAX_BYTES = 25 * 1024 * 1024;
+
+export class SaveError extends Error {
+ constructor(code, message) {
+ super(message);
+ this.name = 'SaveError';
+ this.code = code;
+ }
+}
+
+/**
+ * Export the current editor session and persist it back to the saved avatar.
+ * @param {EditorSession} session
+ * @param {{ avatarId: string, onStep?: (s: {step: string, pct: number}) => void }} opts
+ * @returns {Promise<{ok: true, avatar: object}>}
+ */
+export async function saveEditedAvatar(session, { avatarId, onStep = () => {} } = {}) {
+ // 1. Export
+ onStep({ step: 'export', pct: 0 });
+ let bytes;
+ try {
+ bytes = await exportEditedGLB(session);
+ } catch (e) {
+ throw new SaveError('server', 'GLB export failed: ' + (e?.message || e));
+ }
+ if (!bytes?.byteLength) throw new SaveError('server', 'Empty GLB buffer');
+ if (bytes.byteLength > MAX_BYTES) throw new SaveError('oversize', `GLB too large (${bytes.byteLength} bytes)`);
+ onStep({ step: 'export', pct: 1 });
+
+ // 2. Presign
+ onStep({ step: 'presign', pct: 0 });
+ let presign;
+ try {
+ const res = await fetch('/api/avatars/presign', {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ size_bytes: bytes.byteLength, content_type: 'model/gltf-binary' }),
+ });
+ if (res.status === 401) throw new SaveError('auth', 'Not signed in');
+ if (!res.ok) {
+ const b = await res.json().catch(() => ({}));
+ throw new SaveError('server', b?.error_description || `Presign failed (${res.status})`);
+ }
+ presign = await res.json();
+ } catch (e) {
+ if (e instanceof SaveError) throw e;
+ throw new SaveError('network', e?.message || 'Network error during presign');
+ }
+ onStep({ step: 'presign', pct: 1 });
+
+ // 3. Upload
+ await new Promise((resolve, reject) => {
+ onStep({ step: 'upload', pct: 0 });
+ const xhr = new XMLHttpRequest();
+ xhr.open('PUT', presign.upload_url, true);
+ for (const [k, v] of Object.entries(presign.headers || {})) xhr.setRequestHeader(k, v);
+ xhr.upload.onprogress = (e) => {
+ if (e.lengthComputable) onStep({ step: 'upload', pct: Math.max(0, Math.min(1, e.loaded / e.total)) });
+ };
+ xhr.onerror = () => reject(new SaveError('network', 'Upload network error'));
+ xhr.onabort = () => reject(new SaveError('network', 'Upload aborted'));
+ xhr.onload = () => {
+ if (xhr.status === 401) return reject(new SaveError('auth', 'Not signed in'));
+ if (xhr.status >= 200 && xhr.status < 300) {
+ onStep({ step: 'upload', pct: 1 });
+ return resolve();
+ }
+ reject(new SaveError('server', `Upload failed (${xhr.status})`));
+ };
+ xhr.send(bytes);
+ });
+
+ // 4. PATCH avatar — derive non-signed URL by stripping presign query params
+ onStep({ step: 'patch', pct: 0 });
+ const parsed = new URL(presign.upload_url);
+ const glbUrl = parsed.origin + parsed.pathname;
+ let patchRes;
+ try {
+ const res = await fetch(`/api/avatars/${avatarId}`, {
+ method: 'PATCH',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ glbUrl, storage_key: presign.storage_key }),
+ });
+ if (res.status === 401) throw new SaveError('auth', 'Not signed in');
+ if (!res.ok) {
+ const b = await res.json().catch(() => ({}));
+ throw new SaveError('server', b?.error_description || `Patch failed (${res.status})`);
+ }
+ patchRes = await res.json();
+ } catch (e) {
+ if (e instanceof SaveError) throw e;
+ throw new SaveError('network', e?.message || 'Network error during patch');
+ }
+ onStep({ step: 'patch', pct: 1 });
+
+ return { ok: true, avatar: patchRes.avatar ?? patchRes };
+}
diff --git a/src/element.js b/src/element.js
index 423e73293..d02591ab3 100644
--- a/src/element.js
+++ b/src/element.js
@@ -8,7 +8,7 @@ import { SkillRegistry } from './skills/index.js';
import { Memory } from './memory/index.js';
import { loadManifest, fetchRelative } from './manifest.js';
import { resolveURI } from './ipfs.js';
-import { resolveAgentById, AgentResolveError } from './agent-resolver.js';
+import { resolveAgentById, resolveByAgentId, AgentResolveError } from './agent-resolver.js';
import { parseAgentRef, resolveOnchainAgent, toManifest } from './erc8004/resolver.js';
const MODES = ['inline', 'floating', 'section', 'fullscreen'];
@@ -194,7 +194,7 @@ const BASE_STYLE = `
padding: 8px 14px;
border-radius: 999px;
}
- .error {
+ .error, .agent-3d-error {
position: absolute;
inset: 16px;
display: grid;
@@ -242,6 +242,8 @@ class Agent3DElement extends HTMLElement {
this._mqNarrowHandler = null;
this._ro = null;
this._outsideTapHandler = null;
+ this._autoResolvedManifest = false;
+ this._suppressAttrChange = false;
}
connectedCallback() {
@@ -258,7 +260,7 @@ class Agent3DElement extends HTMLElement {
}
attributeChangedCallback(name, oldVal, newVal) {
- if (!this._mounted) return;
+ if (!this._mounted || this._suppressAttrChange) return;
if (['mode', 'position', 'width', 'height', 'responsive'].includes(name))
this._applyLayout();
if (['src', 'manifest', 'body', 'agent-id'].includes(name)) {
@@ -736,7 +738,14 @@ class Agent3DElement extends HTMLElement {
} catch (err) {
console.error('[agent-3d] boot failed', err);
this._loadingEl.hidden = true;
- this._showError(err);
+ if (err instanceof AgentResolveError && err.code === 'not-found') {
+ const el = document.createElement('div');
+ el.className = 'agent-3d-error';
+ el.textContent = 'Agent not found';
+ this.shadowRoot.appendChild(el);
+ } else {
+ this._showError(err);
+ }
this.dispatchEvent(
new CustomEvent('agent:error', {
detail: { phase: 'boot', error: err },
@@ -782,7 +791,16 @@ class Agent3DElement extends HTMLElement {
throw new Error(`On-chain resolve failed: ${resolved.error}`);
return toManifest(resolved);
}
- // Fall back to backend agent by UUID
+ // Explicit manifest= wins over backend UUID resolution.
+ if (manifestAttr) return loadManifest(manifestAttr);
+ // Resolve agent-id → manifestUrl via backend, then load that manifest.
+ const manifestUrl = await resolveByAgentId(agentIdAttr);
+ if (manifestUrl) {
+ this._autoResolvedManifest = true;
+ this.setAttribute('manifest', manifestUrl);
+ return loadManifest(manifestUrl);
+ }
+ // No manifestUrl on agent record — build inline manifest from avatar data.
return resolveAgentById(agentIdAttr);
}
if (manifestAttr) return loadManifest(manifestAttr);
@@ -869,6 +887,17 @@ class Agent3DElement extends HTMLElement {
}
_teardown() {
+ // Clear manifest that was auto-resolved from agent-id so the next boot resolves fresh.
+ // Suppress attributeChangedCallback to avoid a reboot loop.
+ if (this._autoResolvedManifest) {
+ this._suppressAttrChange = true;
+ try {
+ this.removeAttribute('manifest');
+ } finally {
+ this._suppressAttrChange = false;
+ }
+ this._autoResolvedManifest = false;
+ }
try {
this._io?.disconnect();
} catch {}
diff --git a/src/embed-host-bridge.js b/src/embed-host-bridge.js
new file mode 100644
index 000000000..53fe09c1a
--- /dev/null
+++ b/src/embed-host-bridge.js
@@ -0,0 +1,123 @@
+const HOST_TYPES = new Set(['host.hello', 'host.chat.message', 'host.action', 'host.theme', 'host.response']);
+const EMBED_TYPES = new Set(['embed.ready', 'embed.event', 'embed.error', 'embed.request']);
+const PROTOCOL_VERSION = 1;
+
+let _warnedTypes = new Set();
+
+function makeId() {
+ return Math.random().toString(36).slice(2) + Date.now().toString(36);
+}
+
+export class EmbedHostBridge extends EventTarget {
+ constructor({ allowedOrigins = '*' } = {}) {
+ super();
+ this._allowedOrigins = allowedOrigins;
+ this._pendingRequests = new Map();
+ this._listener = null;
+ this._started = false;
+ }
+
+ start() {
+ if (this._started || typeof window === 'undefined') return;
+ this._started = true;
+ this._listener = (e) => this._onMessage(e);
+ window.addEventListener('message', this._listener);
+ // Send embed.ready to parent — payload filled by caller after construction
+ // Callers should populate capabilities via send() after wiring up the agent
+ }
+
+ stop() {
+ if (!this._started || typeof window === 'undefined') return;
+ this._started = false;
+ window.removeEventListener('message', this._listener);
+ this._listener = null;
+ for (const [, pending] of this._pendingRequests) {
+ pending.reject(new Error('bridge stopped'));
+ }
+ this._pendingRequests.clear();
+ }
+
+ send(type, payload) {
+ if (typeof window === 'undefined') return;
+ if (!EMBED_TYPES.has(type)) {
+ console.warn('[EmbedHostBridge] unknown outbound type:', type);
+ }
+ const msg = { v: PROTOCOL_VERSION, type };
+ if (payload !== undefined) msg.payload = payload;
+ window.parent.postMessage(msg, '*');
+ }
+
+ request(method, params, { timeout = 5000 } = {}) {
+ return new Promise((resolve, reject) => {
+ const id = makeId();
+ const timer = setTimeout(() => {
+ this._pendingRequests.delete(id);
+ reject(new Error(`request timeout: ${method}`));
+ }, timeout);
+
+ this._pendingRequests.set(id, {
+ resolve: (result) => {
+ clearTimeout(timer);
+ this._pendingRequests.delete(id);
+ resolve(result);
+ },
+ reject: (err) => {
+ clearTimeout(timer);
+ this._pendingRequests.delete(id);
+ reject(err);
+ },
+ });
+
+ const msg = { v: PROTOCOL_VERSION, type: 'embed.request', id, payload: { method, params } };
+ if (typeof window !== 'undefined') {
+ window.parent.postMessage(msg, '*');
+ }
+ });
+ }
+
+ _originAllowed(origin) {
+ if (this._allowedOrigins === '*') return true;
+ if (Array.isArray(this._allowedOrigins)) return this._allowedOrigins.includes(origin);
+ return false;
+ }
+
+ _onMessage(e) {
+ if (e.source !== window.parent) return;
+ if (!this._originAllowed(e.origin)) return;
+
+ const msg = e.data;
+
+ if (!msg || typeof msg !== 'object' || msg.v !== PROTOCOL_VERSION || typeof msg.type !== 'string') {
+ // malformed — send error once
+ const key = JSON.stringify(msg).slice(0, 80);
+ if (!_warnedTypes.has(key)) {
+ _warnedTypes.add(key);
+ this.send('embed.error', { code: 'MALFORMED_MESSAGE', message: 'missing v:1 or type' });
+ }
+ return;
+ }
+
+ if (!HOST_TYPES.has(msg.type)) {
+ if (!_warnedTypes.has(msg.type)) {
+ _warnedTypes.add(msg.type);
+ console.warn('[EmbedHostBridge] unknown inbound type (ignored):', msg.type);
+ }
+ return;
+ }
+
+ // Route host.response to pending requests
+ if (msg.type === 'host.response' && msg.id) {
+ const pending = this._pendingRequests.get(msg.id);
+ if (pending) {
+ if (msg.payload?.error) {
+ pending.reject(Object.assign(new Error(msg.payload.error.message || 'request failed'), msg.payload.error));
+ } else {
+ pending.resolve(msg.payload?.result);
+ }
+ }
+ return;
+ }
+
+ this.dispatchEvent(Object.assign(new CustomEvent(msg.type), { payload: msg.payload ?? null, msgId: msg.id ?? null }));
+ }
+}
diff --git a/src/erc8004/deploy-button.css b/src/erc8004/deploy-button.css
new file mode 100644
index 000000000..2940bf3c9
--- /dev/null
+++ b/src/erc8004/deploy-button.css
@@ -0,0 +1,197 @@
+/* deploy-button.css — scoped under .deploy-button-root */
+
+.deploy-button-root {
+ display: inline-flex;
+ align-items: center;
+ font-family: inherit;
+}
+
+/* ── Deploy button ───────────────────────────────────────────────────────── */
+
+.deploy-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.4em;
+ padding: 0.45em 1em;
+ border: 1.5px solid #6c63ff;
+ border-radius: 6px;
+ background: transparent;
+ color: #a89fff;
+ font-size: 0.875rem;
+ font-weight: 600;
+ cursor: pointer;
+ transition:
+ background 0.15s,
+ color 0.15s,
+ border-color 0.15s;
+ white-space: nowrap;
+}
+
+.deploy-btn:hover:not(:disabled) {
+ background: #6c63ff22;
+ border-color: #a89fff;
+ color: #fff;
+}
+
+.deploy-btn--disabled,
+.deploy-btn:disabled {
+ opacity: 0.45;
+ cursor: not-allowed;
+ border-color: #555;
+ color: #888;
+}
+
+/* ── Success chip ────────────────────────────────────────────────────────── */
+
+.deploy-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.4em;
+ padding: 0.35em 0.85em;
+ border-radius: 999px;
+ font-size: 0.8rem;
+ font-weight: 600;
+ text-decoration: none;
+ white-space: nowrap;
+ transition: opacity 0.15s;
+}
+
+.deploy-chip--success {
+ background: #0f2e1a;
+ border: 1.5px solid #2a7a4a;
+ color: #4ade80;
+}
+
+.deploy-chip--success:hover {
+ opacity: 0.82;
+}
+
+/* ── Progress bar ────────────────────────────────────────────────────────── */
+
+.deploy-progress {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.3em;
+ font-size: 0.78rem;
+ color: #aaa;
+}
+
+.progress-step {
+ padding: 0.2em 0.5em;
+ border-radius: 4px;
+ transition:
+ color 0.2s,
+ background 0.2s;
+}
+
+.progress-step--pending {
+ color: #555;
+}
+
+.progress-step--active {
+ color: #fff;
+ background: #6c63ff33;
+ border: 1px solid #6c63ff88;
+}
+
+.progress-step--done {
+ color: #4ade80;
+}
+
+.progress-sep {
+ color: #444;
+ font-size: 0.7em;
+}
+
+/* ── Error state ─────────────────────────────────────────────────────────── */
+
+.deploy-error {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.6em;
+ padding: 0.4em 0.75em;
+ border: 1.5px solid #7a2a2a;
+ border-radius: 6px;
+ background: #2e0f0f;
+ font-size: 0.8rem;
+ color: #f87171;
+ max-width: 400px;
+}
+
+.deploy-error-msg {
+ flex: 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.deploy-action-btn {
+ flex-shrink: 0;
+ padding: 0.25em 0.7em;
+ border: 1px solid #f87171;
+ border-radius: 4px;
+ background: transparent;
+ color: #f87171;
+ font-size: 0.8rem;
+ cursor: pointer;
+ transition: background 0.15s;
+}
+
+.deploy-action-btn:hover {
+ background: #f8717122;
+}
+
+/* ── Tooltip ─────────────────────────────────────────────────────────────── */
+
+.deploy-tooltip {
+ margin-left: 0.5em;
+ font-size: 0.75rem;
+ color: #888;
+ font-style: italic;
+}
+
+/* ── Light-mode overrides ────────────────────────────────────────────────── */
+
+@media (prefers-color-scheme: light) {
+ .deploy-btn {
+ border-color: #4f46e5;
+ color: #4f46e5;
+ }
+
+ .deploy-btn:hover:not(:disabled) {
+ background: #4f46e511;
+ border-color: #4f46e5;
+ color: #312e81;
+ }
+
+ .deploy-chip--success {
+ background: #ecfdf5;
+ border-color: #22c55e;
+ color: #15803d;
+ }
+
+ .deploy-progress {
+ color: #555;
+ }
+
+ .progress-step--active {
+ color: #312e81;
+ background: #eef2ff;
+ border-color: #818cf8;
+ }
+
+ .progress-step--done {
+ color: #15803d;
+ }
+
+ .deploy-error {
+ background: #fff1f2;
+ border-color: #fca5a5;
+ color: #b91c1c;
+ }
+
+ .deploy-action-btn {
+ border-color: #b91c1c;
+ color: #b91c1c;
+ }
+}
diff --git a/src/erc8004/deploy-button.js b/src/erc8004/deploy-button.js
new file mode 100644
index 000000000..1c80ce19e
--- /dev/null
+++ b/src/erc8004/deploy-button.js
@@ -0,0 +1,282 @@
+/**
+ * DeployButton — self-contained "Deploy on-chain" UI for an agent page.
+ *
+ * Distinct from register-ui.js (full multi-tab wizard). This is a minimal
+ * drop-in chip: shows deploy button if not yet on-chain, success chip if
+ * already deployed.
+ */
+
+import { connectWallet, getIdentityRegistry } from './agent-registry.js';
+import { REGISTRY_DEPLOYMENTS } from './abi.js';
+import { CHAIN_META, switchChain, txExplorerUrl } from './chain-meta.js';
+import { BrowserProvider } from 'ethers';
+
+const BASE_SEPOLIA = 84532;
+
+// Faucet links per testnet chainId
+const FAUCETS = {
+ 84532: 'https://www.coinbase.com/faucets/base-ethereum-goerli-faucet',
+ 11155111: 'https://sepoliafaucet.com/',
+ 421614: 'https://www.alchemy.com/faucets/arbitrum-sepolia',
+ 11155420: 'https://app.optimism.io/faucet',
+ 80002: 'https://faucet.polygon.technology/',
+ 43113: 'https://faucet.avax.network/',
+ 97: 'https://testnet.bnbchain.org/faucet-smart',
+};
+
+export class DeployButton {
+ /**
+ * @param {object} opts
+ * @param {object} opts.agent Agent object (must have .id and optionally .chainId, .txHash, .manifestUrl, .name)
+ * @param {HTMLElement} opts.container Where to mount
+ * @param {number} [opts.preferredChainId] Defaults to Base Sepolia (84532)
+ */
+ constructor({ agent, container, preferredChainId = BASE_SEPOLIA }) {
+ this._agent = agent;
+ this._container = container;
+ this._chainId = preferredChainId;
+ this._root = null;
+ }
+
+ mount() {
+ this._root = document.createElement('div');
+ this._root.className = 'deploy-button-root';
+ this._container.appendChild(this._root);
+ this._render();
+ }
+
+ unmount() {
+ if (this._root) {
+ this._root.remove();
+ this._root = null;
+ }
+ }
+
+ _render() {
+ if (!this._root) return;
+ const agent = this._agent;
+
+ if (agent.chainId && agent.txHash) {
+ this._renderSuccessChip(agent.chainId, agent.txHash, agent.contractAddress);
+ } else if (!REGISTRY_DEPLOYMENTS[this._chainId]) {
+ this._renderDisabled('No registry on this chain');
+ } else {
+ this._renderDeployButton();
+ }
+ }
+
+ _renderDeployButton() {
+ this._root.innerHTML = `
+ <button class="deploy-btn" title="Deploy this agent as an ERC-8004 token on-chain">
+ &#x2B22; Deploy on-chain
+ </button>
+ `;
+ this._root
+ .querySelector('.deploy-btn')
+ .addEventListener('click', () => this._startDeploy());
+ }
+
+ _renderDisabled(reason) {
+ this._root.innerHTML = `
+ <button class="deploy-btn deploy-btn--disabled" disabled title="${_esc(reason)}">
+ &#x2B22; Deploy on-chain
+ </button>
+ <span class="deploy-tooltip">${_esc(reason)}</span>
+ `;
+ }
+
+ _renderSuccessChip(chainId, txHash, contractAddress) {
+ const meta = CHAIN_META[chainId];
+ const chainName = meta ? meta.name : `Chain ${chainId}`;
+ const explorerUrl = txExplorerUrl(chainId, txHash);
+ this._root.innerHTML = `
+ <a class="deploy-chip deploy-chip--success" href="${_esc(explorerUrl)}" target="_blank" rel="noopener noreferrer">
+ &#x2B22; On-chain on ${_esc(chainName)} &middot; view on explorer
+ </a>
+ `;
+ }
+
+ _renderProgress(steps, activeIdx) {
+ const labels = steps.map((s, i) => {
+ const cls = i < activeIdx ? 'done' : i === activeIdx ? 'active' : 'pending';
+ return `<span class="progress-step progress-step--${cls}">${_esc(s)}</span>`;
+ });
+ this._root.innerHTML = `
+ <div class="deploy-progress">
+ ${labels.join('<span class="progress-sep">&#x2192;</span>')}
+ </div>
+ `;
+ }
+
+ _renderError(msg, action) {
+ const actionHtml = action
+ ? `<button class="deploy-action-btn">${_esc(action.label)}</button>`
+ : '<button class="deploy-action-btn deploy-action-btn--reset">Try again</button>';
+ this._root.innerHTML = `
+ <div class="deploy-error">
+ <span class="deploy-error-msg">${_esc(msg)}</span>
+ ${actionHtml}
+ </div>
+ `;
+ const btn = this._root.querySelector('.deploy-action-btn');
+ if (action) {
+ btn.addEventListener('click', action.handler);
+ } else {
+ btn.addEventListener('click', () => this._renderDeployButton());
+ }
+ }
+
+ async _startDeploy() {
+ const steps = ['Estimating gas', 'Sign tx', 'Waiting confirmation', 'Done'];
+ this._renderProgress(steps, 0);
+
+ let signer, chainId, provider;
+
+ // ── Connect wallet
+ try {
+ ({ signer, chainId, provider } = await connectWallet({ chainId: this._chainId }));
+ } catch (err) {
+ if (/rejected|denied/i.test(err.message)) {
+ this._renderDeployButton();
+ return;
+ }
+ this._renderError('Wallet connection failed: ' + err.message);
+ return;
+ }
+
+ // ── Check correct network
+ if (chainId !== this._chainId) {
+ this._renderError(
+ `Wrong network. Please switch to ${CHAIN_META[this._chainId]?.name ?? `chain ${this._chainId}`}.`,
+ {
+ label: `Switch to ${CHAIN_META[this._chainId]?.name ?? 'correct network'}`,
+ handler: async () => {
+ try {
+ await switchChain(this._chainId);
+ this._renderDeployButton();
+ } catch (e) {
+ this._renderError('Network switch failed: ' + e.message);
+ }
+ },
+ },
+ );
+ return;
+ }
+
+ // ── Check registry exists on chain
+ const deployment = REGISTRY_DEPLOYMENTS[chainId];
+ if (!deployment?.identityRegistry) {
+ this._renderDisabled('No ERC-8004 registry deployed on this chain');
+ return;
+ }
+
+ // ── Derive agentURI from agent manifest URL
+ const agent = this._agent;
+ const agentURI =
+ agent.manifestUrl ||
+ (agent.id ? `${location.origin}/api/agents/${agent.id}/manifest` : '');
+
+ // ── Estimate gas (step 0)
+ this._renderProgress(steps, 0);
+ const registry = getIdentityRegistry(chainId, signer);
+ let gasEstimate;
+ try {
+ gasEstimate = await registry['register(string)'].estimateGas(agentURI);
+ console.log('[deploy-button] gas estimate:', gasEstimate.toString());
+ } catch (err) {
+ // Insufficient funds surfaces here
+ if (/insufficient|fund/i.test(err.message)) {
+ const faucetUrl = FAUCETS[chainId];
+ this._renderError('Insufficient funds in this wallet.', {
+ label: 'Get testnet funds',
+ handler: () => faucetUrl && window.open(faucetUrl, '_blank'),
+ });
+ return;
+ }
+ console.warn('[deploy-button] gas estimation failed, proceeding anyway:', err.message);
+ }
+
+ // ── Sign tx (step 1)
+ this._renderProgress(steps, 1);
+ let tx;
+ try {
+ tx = await registry['register(string)'](agentURI);
+ } catch (err) {
+ if (/rejected|denied/i.test(err.message)) {
+ this._renderDeployButton();
+ return;
+ }
+ if (/insufficient|fund/i.test(err.message)) {
+ const faucetUrl = FAUCETS[chainId];
+ this._renderError('Insufficient funds in this wallet.', {
+ label: 'Get testnet funds',
+ handler: () => faucetUrl && window.open(faucetUrl, '_blank'),
+ });
+ return;
+ }
+ this._renderError('Transaction failed: ' + err.message);
+ return;
+ }
+
+ // ── Wait confirmation (step 2)
+ this._renderProgress(steps, 2);
+ let receipt;
+ try {
+ receipt = await tx.wait();
+ } catch (err) {
+ this._renderError('Transaction reverted: ' + err.message);
+ return;
+ }
+
+ // ── Extract agentId from Registered event
+ const registeredEvent = receipt.logs
+ .map((l) => {
+ try {
+ return registry.interface.parseLog(l);
+ } catch {
+ return null;
+ }
+ })
+ .find((e) => e?.name === 'Registered');
+
+ const agentId = registeredEvent ? Number(registeredEvent.args.agentId) : null;
+ const contractAddress = deployment.identityRegistry;
+
+ // ── Persist on-chain state to backend (step 3)
+ this._renderProgress(steps, 3);
+ if (agent.id) {
+ try {
+ const res = await fetch(`/api/agents/${agent.id}/onchain`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ credentials: 'include',
+ body: JSON.stringify({ chainId, txHash: tx.hash, contractAddress, agentId }),
+ });
+ if (!res.ok) {
+ console.warn(
+ `[deploy-button] POST /api/agents/${agent.id}/onchain returned ${res.status} — on-chain state is authoritative.`,
+ );
+ }
+ } catch (err) {
+ console.warn('[deploy-button] failed to persist on-chain state:', err.message);
+ }
+ } else {
+ console.warn('[deploy-button] agent.id missing — skipping backend persist.');
+ }
+
+ // ── Update local agent state + show success
+ agent.chainId = chainId;
+ agent.txHash = tx.hash;
+ agent.contractAddress = contractAddress;
+ this._renderSuccessChip(chainId, tx.hash, contractAddress);
+ }
+}
+
+/** Escape HTML attribute/text content to prevent XSS. */
+function _esc(str) {
+ return String(str ?? '')
+ .replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+}
diff --git a/src/first-meet.css b/src/first-meet.css
new file mode 100644
index 000000000..849622d70
--- /dev/null
+++ b/src/first-meet.css
@@ -0,0 +1,141 @@
+/* first-meet.css — scoped under .first-meet-root */
+
+.first-meet-root {
+ position: fixed;
+ inset: 0;
+ z-index: 9900;
+ pointer-events: none;
+ font-family: system-ui, sans-serif;
+}
+
+/* ── Fade overlay ─────────────────────────────────────────────────────────── */
+
+.fm-fade-overlay {
+ position: absolute;
+ inset: 0;
+ background: #000;
+ opacity: 1;
+ transition: opacity 0.4s ease;
+}
+
+.fm-fade-overlay.fm-faded {
+ opacity: 0;
+}
+
+/* ── Subtitle ─────────────────────────────────────────────────────────────── */
+
+.fm-subtitle {
+ position: absolute;
+ bottom: 30%;
+ left: 50%;
+ transform: translateX(-50%);
+ background: rgba(0, 0, 0, 0.55);
+ color: #fff;
+ font-size: clamp(18px, 3vw, 26px);
+ font-weight: 500;
+ letter-spacing: 0.01em;
+ padding: 10px 24px;
+ border-radius: 8px;
+ white-space: nowrap;
+ opacity: 0;
+ transition: opacity 0.5s ease;
+ backdrop-filter: blur(4px);
+}
+
+.fm-subtitle.fm-visible {
+ opacity: 1;
+}
+
+/* ── Buttons ──────────────────────────────────────────────────────────────── */
+
+.fm-actions {
+ position: absolute;
+ bottom: 18%;
+ left: 50%;
+ transform: translateX(-50%);
+ display: flex;
+ gap: 12px;
+ opacity: 0;
+ transition: opacity 0.45s ease;
+ pointer-events: none;
+}
+
+.fm-actions.fm-visible {
+ opacity: 1;
+ pointer-events: auto;
+}
+
+.fm-btn {
+ padding: 11px 28px;
+ border-radius: 8px;
+ font-size: 15px;
+ font-weight: 600;
+ cursor: pointer;
+ border: none;
+ transition:
+ background 0.15s,
+ transform 0.1s;
+}
+
+.fm-btn:active {
+ transform: scale(0.96);
+}
+
+.fm-btn-share {
+ background: #fff;
+ color: #111;
+}
+
+.fm-btn-share:hover {
+ background: #e8e8e8;
+}
+
+.fm-btn-continue {
+ background: #3d7eff;
+ color: #fff;
+}
+
+.fm-btn-continue:hover {
+ background: #2d6fee;
+}
+
+/* ── Confetti ─────────────────────────────────────────────────────────────── */
+
+.fm-confetti-piece {
+ position: absolute;
+ top: -20px;
+ border-radius: 2px;
+ pointer-events: none;
+ animation: fm-fall linear forwards;
+}
+
+@keyframes fm-fall {
+ 0% {
+ transform: translateY(0) rotate(0deg);
+ opacity: 1;
+ }
+ 70% {
+ opacity: 1;
+ }
+ 100% {
+ transform: translateY(110vh) rotate(720deg);
+ opacity: 0;
+ }
+}
+
+/* ── Reduced motion overrides ─────────────────────────────────────────────── */
+
+@media (prefers-reduced-motion: reduce) {
+ .fm-fade-overlay {
+ transition: none;
+ }
+ .fm-subtitle {
+ transition: none;
+ }
+ .fm-actions {
+ transition: none;
+ }
+ .fm-confetti-piece {
+ display: none;
+ }
+}
diff --git a/src/first-meet.js b/src/first-meet.js
new file mode 100644
index 000000000..d0e5dc8c1
--- /dev/null
+++ b/src/first-meet.js
@@ -0,0 +1,195 @@
+/**
+ * playFirstMeet — first-encounter celebration sequence for a newly generated avatar.
+ *
+ * @param {object} opts
+ * @param {object} opts.viewer — SceneController / AgentAvatar (duck-typed: .playClip(name) OR .mixer + .animations)
+ * @param {{ id: string, name: string, slug: string }} opts.agent
+ * @param {() => void} opts.onShare — called when user clicks "Share"
+ * @param {() => void} opts.onContinue — called when user clicks "Continue"
+ * @returns {Promise<void>} resolves when user clicks either button
+ */
+export async function playFirstMeet({ viewer, agent, onShare, onContinue }) {
+ const reducedMotion =
+ typeof window !== 'undefined' &&
+ window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
+
+ // Inject stylesheet once
+ if (!document.querySelector('link[data-fm-css]')) {
+ const link = document.createElement('link');
+ link.rel = 'stylesheet';
+ link.href = new URL('./first-meet.css', import.meta.url).href;
+ link.dataset.fmCss = '1';
+ document.head.appendChild(link);
+ }
+
+ // Build root overlay
+ const root = document.createElement('div');
+ root.className = 'first-meet-root';
+
+ // Fade overlay (black → transparent)
+ const overlay = document.createElement('div');
+ overlay.className = 'fm-fade-overlay';
+
+ // Subtitle
+ const subtitle = document.createElement('div');
+ subtitle.className = 'fm-subtitle';
+ subtitle.textContent = `Hello, I'm ${agent?.name ?? 'your agent'}.`;
+
+ // Action buttons
+ const actions = document.createElement('div');
+ actions.className = 'fm-actions';
+
+ const btnShare = document.createElement('button');
+ btnShare.className = 'fm-btn fm-btn-share';
+ btnShare.textContent = 'Share';
+
+ const btnContinue = document.createElement('button');
+ btnContinue.className = 'fm-btn fm-btn-continue';
+ btnContinue.textContent = 'Continue';
+
+ actions.appendChild(btnShare);
+ actions.appendChild(btnContinue);
+ root.appendChild(overlay);
+ root.appendChild(subtitle);
+ root.appendChild(actions);
+ document.body.appendChild(root);
+
+ // ── Helpers ───────────────────────────────────────────────────────────────
+
+ function delay(ms) {
+ return new Promise((res) => setTimeout(res, ms));
+ }
+
+ // Try to play a wave gesture on the viewer (duck-typed).
+ // Order probed:
+ // 1. viewer.playClip('Wave') — exact name
+ // 2. viewer.playClip('wave') — lowercase
+ // 3. viewer.playAnimationByHint?.('wave') — partial name search (SceneController)
+ // 4. Scripted bone tilt via viewer.mixer + content skeleton
+ // — bones probed: 'mixamorigRightHand', 'RightHand', 'mixamorigRightArm', 'RightArm'
+ function tryWave() {
+ if (reducedMotion) return;
+
+ // Method 1 & 2: direct clip by name
+ if (typeof viewer?.playClip === 'function') {
+ if (viewer.playClip('Wave')) return;
+ if (viewer.playClip('wave')) return;
+ }
+
+ // Method 3: SceneController hint search
+ if (typeof viewer?.playAnimationByHint === 'function') {
+ if (viewer.playAnimationByHint('wave')) return;
+ if (viewer.playAnimationByHint('Wave')) return;
+ }
+
+ // Method 4: scripted bone animation if mixer exists
+ const mixer = viewer?.mixer;
+ const root3d = viewer?.content ?? viewer?.scene;
+ if (!mixer || !root3d) return;
+
+ const BONE_NAMES = ['mixamorigRightHand', 'RightHand', 'mixamorigRightArm', 'RightArm'];
+ let targetBone = null;
+ root3d.traverse?.((obj) => {
+ if (targetBone) return;
+ if (obj.isBone && BONE_NAMES.includes(obj.name)) targetBone = obj;
+ });
+ if (!targetBone) return;
+
+ // Simple scripted tilt: raise then return over 1.2s using rAF
+ const origZ = targetBone.rotation.z;
+ const origX = targetBone.rotation.x;
+ const RAISE_Z = 1.2; // radians
+ const RAISE_X = -0.5;
+ const DURATION = 1200; // ms
+ let start = null;
+
+ function animateBone(ts) {
+ if (!start) start = ts;
+ const t = Math.min((ts - start) / DURATION, 1);
+ // Ease in-out cubic
+ const ease = t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
+ const wave = Math.sin(t * Math.PI); // arc: 0 → 1 → 0
+ targetBone.rotation.z = origZ + RAISE_Z * wave * ease;
+ targetBone.rotation.x = origX + RAISE_X * wave * ease;
+ if (t < 1) requestAnimationFrame(animateBone);
+ else {
+ targetBone.rotation.z = origZ;
+ targetBone.rotation.x = origX;
+ }
+ }
+ requestAnimationFrame(animateBone);
+ }
+
+ // Spawn CSS confetti: 40–60 spans, random hue/size/rotation/position/duration
+ function spawnConfetti() {
+ if (reducedMotion) return;
+ const count = 40 + Math.floor(Math.random() * 21);
+ const pieces = [];
+ for (let i = 0; i < count; i++) {
+ const span = document.createElement('span');
+ span.className = 'fm-confetti-piece';
+ const hue = Math.floor(Math.random() * 360);
+ const w = 6 + Math.random() * 8;
+ const h = 10 + Math.random() * 10;
+ const left = Math.random() * 100;
+ const duration = 1.4 + Math.random() * 0.8;
+ const delay_ = Math.random() * 0.4;
+ const rot = Math.floor(Math.random() * 360);
+ span.style.cssText = `
+ left: ${left}%;
+ width: ${w}px;
+ height: ${h}px;
+ background: hsl(${hue},80%,60%);
+ transform: rotate(${rot}deg);
+ animation-duration: ${duration}s;
+ animation-delay: ${delay_}s;
+ `.replace(/\s+/g, ' ');
+ root.appendChild(span);
+ pieces.push(span);
+ }
+ // Clean up after 2s
+ setTimeout(() => pieces.forEach((p) => p.remove()), 2000);
+ }
+
+ // ── Sequence ──────────────────────────────────────────────────────────────
+
+ // t=0.0 — fade overlay out (scene reveal)
+ await delay(0);
+ requestAnimationFrame(() => overlay.classList.add('fm-faded'));
+
+ // t=0.2 — wave
+ await delay(200);
+ tryWave();
+
+ // t=0.6 — subtitle fades in
+ await delay(400);
+ subtitle.classList.add('fm-visible');
+
+ // t=1.4 — confetti burst
+ await delay(800);
+ spawnConfetti();
+
+ // t=2.2 — buttons fade in
+ await delay(800);
+ actions.classList.add('fm-visible');
+
+ // ── Wait for user ─────────────────────────────────────────────────────────
+
+ await new Promise((resolve) => {
+ function cleanup() {
+ root.remove();
+ }
+
+ btnShare.addEventListener('click', () => {
+ cleanup();
+ onShare?.();
+ resolve();
+ });
+
+ btnContinue.addEventListener('click', () => {
+ cleanup();
+ onContinue?.();
+ resolve();
+ });
+ });
+}
diff --git a/src/idle-animation.js b/src/idle-animation.js
new file mode 100644
index 000000000..5849c0a5e
--- /dev/null
+++ b/src/idle-animation.js
@@ -0,0 +1,289 @@
+import { Quaternion, Vector3, MathUtils } from 'three';
+
+const DEG2RAD = Math.PI / 180;
+
+// Bone name candidates in priority order
+const SPINE_NAMES = ['Spine1', 'Spine2', 'Spine', 'mixamorigSpine1', 'mixamorigSpine', 'spine_01', 'spine_02', 'spine'];
+const HEAD_NAMES = ['Head', 'mixamorigHead', 'head'];
+const L_SHOULDER_NAMES = ['LeftShoulder', 'mixamorigLeftShoulder', 'left_shoulder', 'ShoulderL'];
+const R_SHOULDER_NAMES = ['RightShoulder', 'mixamorigRightShoulder', 'right_shoulder', 'ShoulderR'];
+
+const BLINK_MORPH_NAMES = ['eyesClosed', 'blink', 'Blink', 'Fcl_EYE_Close', 'eyeBlinkLeft', 'Eye_Blink'];
+
+function findBone(root, names) {
+ for (const name of names) {
+ let found = null;
+ root.traverse(obj => {
+ if (!found && obj.isBone && obj.name === name) found = obj;
+ });
+ if (found) return found;
+ }
+ return null;
+}
+
+function findBlinkMesh(root) {
+ let result = null;
+ root.traverse(obj => {
+ if (result) return;
+ if (!obj.morphTargetDictionary) return;
+ for (const name of BLINK_MORPH_NAMES) {
+ if (name in obj.morphTargetDictionary) {
+ result = { mesh: obj, index: obj.morphTargetDictionary[name] };
+ return;
+ }
+ }
+ });
+ return result;
+}
+
+export class IdleAnimation {
+ /**
+ * @param {{ root: import('three').Object3D, bones?: object|null, intensity?: number }} opts
+ */
+ constructor({ root, bones = null, intensity = 1.0 }) {
+ this._root = root;
+ this._intensity = Math.max(0, Math.min(1, intensity));
+ this._active = false;
+ this._noop = false;
+ this._clock = null;
+ this._elapsedPrev = 0;
+
+ // Reusable temporaries — zero alloc in update()
+ this._tmpQ = new Quaternion();
+ this._tmpV = new Vector3();
+ this._tmpQ2 = new Quaternion();
+
+ // Saved original transforms (restored on stop)
+ this._origSpineRot = new Quaternion();
+ this._origSpineScale = new Vector3();
+ this._origHeadRot = new Quaternion();
+
+ // Head glance state machine
+ this._glancePhase = 'idle'; // idle | turn | hold | return
+ this._glanceTimer = 0;
+ this._glanceDuration = 0;
+ this._glanceTargetYaw = 0; // radians
+ this._glanceCurrentYaw = 0;
+ this._glanceStartYaw = 0;
+ this._glanceNextDelay = this._randGlanceDelay();
+
+ // Blink state machine
+ this._blinkPhase = 'wait'; // wait | closing | closed | opening
+ this._blinkTimer = 0;
+ this._blinkNextDelay = this._randBlinkDelay();
+ this._blinkMorphCurrent = 0;
+
+ // Resolve bones
+ if (bones) {
+ this._spine = bones.spine || null;
+ this._head = bones.head || null;
+ this._lShoulder = bones.leftShoulder || null;
+ this._rShoulder = bones.rightShoulder || null;
+ } else {
+ this._spine = findBone(root, SPINE_NAMES);
+ this._head = findBone(root, HEAD_NAMES);
+ this._lShoulder = findBone(root, L_SHOULDER_NAMES);
+ this._rShoulder = findBone(root, R_SHOULDER_NAMES);
+ }
+
+ this._blinkTarget = findBlinkMesh(root);
+
+ if (!this._spine) {
+ console.warn('[IdleAnimation] No spine bone found — becoming a no-op.');
+ this._noop = true;
+ }
+
+ // Honor reduced-motion preference
+ if (typeof window !== 'undefined' &&
+ window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {
+ this._noop = true;
+ }
+ }
+
+ /**
+ * @param {{ getElapsedTime: () => number }} clock THREE.Clock or equivalent
+ */
+ start(clock) {
+ if (this._noop || this._active) return;
+ this._clock = clock;
+ this._elapsedPrev = clock.getElapsedTime();
+ this._active = true;
+
+ // Save originals
+ if (this._spine) {
+ this._origSpineRot.copy(this._spine.quaternion);
+ this._origSpineScale.copy(this._spine.scale);
+ }
+ if (this._head) {
+ this._origHeadRot.copy(this._head.quaternion);
+ }
+ }
+
+ stop() {
+ if (!this._active) return;
+ this._active = false;
+
+ // Restore original transforms
+ if (this._spine) {
+ this._spine.quaternion.copy(this._origSpineRot);
+ this._spine.scale.copy(this._origSpineScale);
+ }
+ if (this._head) {
+ this._head.quaternion.copy(this._origHeadRot);
+ }
+
+ // Restore blink morph
+ if (this._blinkTarget) {
+ this._blinkTarget.mesh.morphTargetInfluences[this._blinkTarget.index] = 0;
+ }
+
+ this._glancePhase = 'idle';
+ this._glanceCurrentYaw = 0;
+ this._blinkPhase = 'wait';
+ this._blinkMorphCurrent = 0;
+ }
+
+ /**
+ * Manual tick — call from your render loop.
+ * @param {number} deltaSeconds
+ */
+ update(deltaSeconds) {
+ if (!this._active || this._noop) return;
+ const dt = Math.min(deltaSeconds, 0.1); // clamp runaway dt
+ const t = this._clock.getElapsedTime();
+ const intensity = this._intensity;
+
+ // ── Breathing: spine Y-scale ±1% at 0.25 Hz ─────────────────────────
+ if (this._spine) {
+ const breathPhase = Math.sin(t * 2 * Math.PI * 0.25); // 0.25 Hz
+ const breathScale = 1.0 + breathPhase * 0.01 * intensity;
+ this._spine.scale.set(
+ this._origSpineScale.x,
+ this._origSpineScale.y * breathScale,
+ this._origSpineScale.z,
+ );
+
+ // ── Micro-sway: ±0.5° rotation on spine at 0.08 Hz ──────────────
+ const swayPhase = Math.sin(t * 2 * Math.PI * 0.08);
+ const swayRad = swayPhase * 0.5 * DEG2RAD * intensity;
+ // Apply sway as local Z-rotation delta on top of original
+ this._tmpQ.setFromAxisAngle(this._tmpV.set(0, 0, 1), swayRad);
+ this._spine.quaternion.copy(this._origSpineRot).multiply(this._tmpQ);
+ }
+
+ // ── Head glance state machine ─────────────────────────────────────────
+ if (this._head) {
+ this._glanceTimer += dt;
+
+ switch (this._glancePhase) {
+ case 'idle':
+ if (this._glanceTimer >= this._glanceNextDelay) {
+ this._glancePhase = 'turn';
+ this._glanceTimer = 0;
+ this._glanceDuration = 0.5; // 500ms turn
+ this._glanceStartYaw = this._glanceCurrentYaw;
+ // ±8° random direction
+ this._glanceTargetYaw = (Math.random() < 0.5 ? 1 : -1) *
+ (4 + Math.random() * 4) * DEG2RAD * intensity;
+ }
+ break;
+ case 'turn': {
+ const progress = Math.min(this._glanceTimer / this._glanceDuration, 1);
+ this._glanceCurrentYaw = MathUtils.lerp(
+ this._glanceStartYaw,
+ this._glanceTargetYaw,
+ _easeInOut(progress),
+ );
+ if (progress >= 1) {
+ this._glancePhase = 'hold';
+ this._glanceTimer = 0;
+ }
+ break;
+ }
+ case 'hold':
+ if (this._glanceTimer >= 0.2) { // 200ms hold
+ this._glancePhase = 'return';
+ this._glanceTimer = 0;
+ this._glanceDuration = 0.8; // 800ms return
+ this._glanceStartYaw = this._glanceCurrentYaw;
+ this._glanceTargetYaw = 0;
+ }
+ break;
+ case 'return': {
+ const progress = Math.min(this._glanceTimer / this._glanceDuration, 1);
+ this._glanceCurrentYaw = MathUtils.lerp(
+ this._glanceStartYaw,
+ 0,
+ _easeInOut(progress),
+ );
+ if (progress >= 1) {
+ this._glanceCurrentYaw = 0;
+ this._glancePhase = 'idle';
+ this._glanceTimer = 0;
+ this._glanceNextDelay = this._randGlanceDelay();
+ }
+ break;
+ }
+ }
+
+ this._tmpQ.setFromAxisAngle(this._tmpV.set(0, 1, 0), this._glanceCurrentYaw);
+ this._head.quaternion.copy(this._origHeadRot).multiply(this._tmpQ);
+ }
+
+ // ── Blink state machine ───────────────────────────────────────────────
+ if (this._blinkTarget) {
+ this._blinkTimer += dt;
+ const { mesh, index } = this._blinkTarget;
+
+ switch (this._blinkPhase) {
+ case 'wait':
+ if (this._blinkTimer >= this._blinkNextDelay) {
+ this._blinkPhase = 'closing';
+ this._blinkTimer = 0;
+ }
+ break;
+ case 'closing': {
+ const progress = Math.min(this._blinkTimer / 0.06, 1); // 60ms close
+ this._blinkMorphCurrent = progress;
+ mesh.morphTargetInfluences[index] = this._blinkMorphCurrent * intensity;
+ if (progress >= 1) {
+ this._blinkPhase = 'closed';
+ this._blinkTimer = 0;
+ }
+ break;
+ }
+ case 'closed':
+ if (this._blinkTimer >= 0.06) { // 60ms closed → total ~120ms
+ this._blinkPhase = 'opening';
+ this._blinkTimer = 0;
+ }
+ break;
+ case 'opening': {
+ const progress = Math.min(this._blinkTimer / 0.06, 1);
+ this._blinkMorphCurrent = 1 - progress;
+ mesh.morphTargetInfluences[index] = this._blinkMorphCurrent * intensity;
+ if (progress >= 1) {
+ this._blinkMorphCurrent = 0;
+ mesh.morphTargetInfluences[index] = 0;
+ this._blinkPhase = 'wait';
+ this._blinkTimer = 0;
+ this._blinkNextDelay = this._randBlinkDelay();
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ _randGlanceDelay() {
+ return 4 + Math.random() * 5; // 4–9s
+ }
+
+ _randBlinkDelay() {
+ return 3 + Math.random() * 4; // 3–7s
+ }
+}
+
+function _easeInOut(t) {
+ return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
+}
diff --git a/src/share-panel.css b/src/share-panel.css
new file mode 100644
index 000000000..897dec0ec
--- /dev/null
+++ b/src/share-panel.css
@@ -0,0 +1,143 @@
+.share-panel-backdrop {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.6);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 9000;
+ backdrop-filter: blur(2px);
+}
+
+.share-panel-modal {
+ background: #1a1a1a;
+ border: 1px solid #333;
+ border-radius: 12px;
+ width: min(540px, calc(100vw - 32px));
+ max-height: calc(100vh - 64px);
+ overflow-y: auto;
+ padding: 24px;
+ color: #e8e8e8;
+ font-family: system-ui, sans-serif;
+ font-size: 14px;
+}
+
+.share-panel-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 20px;
+}
+
+.share-panel-title {
+ font-size: 17px;
+ font-weight: 600;
+ color: #fff;
+ margin: 0;
+}
+
+.share-panel-close {
+ background: none;
+ border: none;
+ color: #888;
+ font-size: 22px;
+ line-height: 1;
+ cursor: pointer;
+ padding: 2px 6px;
+ border-radius: 4px;
+}
+
+.share-panel-close:hover {
+ color: #fff;
+ background: #2e2e2e;
+}
+
+.share-panel-row {
+ margin-bottom: 18px;
+}
+
+.share-panel-label {
+ font-size: 11px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.07em;
+ color: #888;
+ margin-bottom: 6px;
+}
+
+.share-panel-field {
+ display: flex;
+ gap: 6px;
+ align-items: flex-start;
+}
+
+.share-panel-code {
+ flex: 1;
+ background: #111;
+ border: 1px solid #2e2e2e;
+ border-radius: 6px;
+ padding: 8px 10px;
+ font-family: 'Courier New', monospace;
+ font-size: 12px;
+ color: #c8d3f5;
+ word-break: break-all;
+ white-space: pre-wrap;
+ line-height: 1.5;
+ min-height: 36px;
+}
+
+.share-panel-actions {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ flex-shrink: 0;
+}
+
+.share-panel-btn {
+ background: #2a2a2a;
+ border: 1px solid #3a3a3a;
+ border-radius: 6px;
+ color: #d0d0d0;
+ cursor: pointer;
+ font-size: 12px;
+ padding: 6px 12px;
+ white-space: nowrap;
+ transition: background 0.12s, color 0.12s;
+}
+
+.share-panel-btn:hover {
+ background: #383838;
+ color: #fff;
+}
+
+.share-panel-btn.copied {
+ color: #4caf7d;
+ border-color: #4caf7d44;
+}
+
+.share-panel-og-img {
+ display: block;
+ width: 100%;
+ height: auto;
+ border-radius: 6px;
+ border: 1px solid #2e2e2e;
+ margin-bottom: 8px;
+ background: #111;
+}
+
+.share-panel-qr {
+ display: flex;
+ justify-content: center;
+ margin-top: 4px;
+}
+
+.share-panel-qr canvas {
+ border-radius: 6px;
+ border: 4px solid #fff;
+}
+
+.share-panel-divider {
+ border: none;
+ border-top: 1px solid #2a2a2a;
+ margin: 20px 0;
+}
diff --git a/src/share-panel.js b/src/share-panel.js
new file mode 100644
index 000000000..f82bd45ad
--- /dev/null
+++ b/src/share-panel.js
@@ -0,0 +1,215 @@
+import { renderQRToCanvas } from './erc8004/qr.js';
+import './share-panel.css';
+
+/**
+ * One-click share modal for an agent: link, iframe snippet, web-component
+ * snippet, OG preview, and QR code.
+ *
+ * @example
+ * const panel = new SharePanel({ agent: { id, slug, name, thumbnailUrl }, container: document.body });
+ * panel.open();
+ */
+export class SharePanel {
+ /**
+ * @param {{ agent: { id: string, slug?: string, name?: string, thumbnailUrl?: string }, container?: HTMLElement, embedOrigin?: string }} opts
+ */
+ constructor({ agent, container = document.body, embedOrigin = location.origin }) {
+ this._agent = agent;
+ this._container = container;
+ this._origin = embedOrigin;
+ this._backdrop = null;
+ this._opener = null;
+ this._onKeyDown = this._onKeyDown.bind(this);
+ }
+
+ open() {
+ if (this._backdrop) return;
+ this._opener = document.activeElement;
+
+ const { id, slug, name } = this._agent;
+ const origin = this._origin;
+ const link = `${origin}/a/${slug || id}`;
+ const iframeSnippet =
+ `<iframe src="${origin}/agent-embed.html?id=${id}"\n` +
+ ` width="480" height="640" frameborder="0" allow="microphone; camera"></iframe>`;
+ const wcSnippet =
+ `<script type="module" src="${origin}/dist-lib/agent-3d.js"><\/script>\n` +
+ `<agent-3d agent-id="${id}"></agent-3d>`;
+ const ogUrl = `${origin}/api/a-og?id=${id}`;
+
+ const backdrop = document.createElement('div');
+ backdrop.className = 'share-panel-backdrop';
+ backdrop.setAttribute('role', 'presentation');
+
+ const modalId = `share-panel-title-${id}`;
+ const modal = document.createElement('div');
+ modal.className = 'share-panel-modal';
+ modal.setAttribute('role', 'dialog');
+ modal.setAttribute('aria-modal', 'true');
+ modal.setAttribute('aria-labelledby', modalId);
+ modal.tabIndex = -1;
+
+ modal.innerHTML = `
+ <div class="share-panel-header">
+ <h2 class="share-panel-title" id="${modalId}">Share ${name ? _esc(name) : 'Agent'}</h2>
+ <button class="share-panel-close" aria-label="Close share panel">&times;</button>
+ </div>
+
+ <div class="share-panel-row" data-section="link">
+ <div class="share-panel-label">Link</div>
+ <div class="share-panel-field">
+ <div class="share-panel-code">${_esc(link)}</div>
+ <div class="share-panel-actions">
+ <button class="share-panel-btn" data-copy="${_esc(link)}">Copy</button>
+ <a class="share-panel-btn" href="${_esc(link)}" target="_blank" rel="noopener">Open ↗</a>
+ </div>
+ </div>
+ </div>
+
+ <div class="share-panel-row" data-section="iframe">
+ <div class="share-panel-label">iframe embed</div>
+ <div class="share-panel-field">
+ <div class="share-panel-code">${_esc(iframeSnippet)}</div>
+ <div class="share-panel-actions">
+ <button class="share-panel-btn" data-copy="${_esc(iframeSnippet)}">Copy</button>
+ </div>
+ </div>
+ </div>
+
+ <div class="share-panel-row" data-section="wc">
+ <div class="share-panel-label">Web component</div>
+ <div class="share-panel-field">
+ <div class="share-panel-code">${_esc(wcSnippet)}</div>
+ <div class="share-panel-actions">
+ <button class="share-panel-btn" data-copy="${_esc(wcSnippet)}">Copy</button>
+ </div>
+ </div>
+ </div>
+
+ <hr class="share-panel-divider">
+
+ <div class="share-panel-row" data-section="og">
+ <div class="share-panel-label">OG preview</div>
+ <img class="share-panel-og-img" src="${_esc(ogUrl)}"
+ alt="OG preview for ${_esc(name || id)}"
+ style="aspect-ratio:1200/630;">
+ <div class="share-panel-field" style="margin-top:6px;">
+ <div class="share-panel-code">${_esc(ogUrl)}</div>
+ <div class="share-panel-actions">
+ <button class="share-panel-btn" data-copy="${_esc(ogUrl)}">Copy URL</button>
+ </div>
+ </div>
+ </div>
+
+ <hr class="share-panel-divider">
+
+ <div class="share-panel-row" data-section="qr">
+ <div class="share-panel-label">QR code</div>
+ <div class="share-panel-qr" id="share-panel-qr-mount"></div>
+ </div>
+ `;
+
+ // Attach close handler
+ modal.querySelector('.share-panel-close').addEventListener('click', () => this.close());
+
+ // Copy buttons
+ modal.querySelectorAll('[data-copy]').forEach((btn) => {
+ btn.addEventListener('click', () => this._copy(btn));
+ });
+
+ // Dismiss on backdrop click (outside modal)
+ backdrop.addEventListener('click', (e) => {
+ if (e.target === backdrop) this.close();
+ });
+
+ backdrop.appendChild(modal);
+ this._container.appendChild(backdrop);
+ this._backdrop = backdrop;
+
+ // Render QR
+ try {
+ const canvas = renderQRToCanvas(link, { scale: 6, margin: 2 });
+ modal.querySelector('#share-panel-qr-mount').appendChild(canvas);
+ } catch {
+ modal.querySelector('#share-panel-qr-mount').textContent = 'QR coming soon';
+ }
+
+ // Focus trap + keyboard
+ document.addEventListener('keydown', this._onKeyDown);
+ // Focus modal so Esc works immediately; focus first button for usability
+ const firstBtn = modal.querySelector('button');
+ (firstBtn || modal).focus();
+
+ _trapFocus(modal);
+ }
+
+ close() {
+ if (!this._backdrop) return;
+ document.removeEventListener('keydown', this._onKeyDown);
+ this._backdrop.remove();
+ this._backdrop = null;
+ if (this._opener && typeof this._opener.focus === 'function') {
+ this._opener.focus();
+ }
+ this._opener = null;
+ }
+
+ _onKeyDown(e) {
+ if (e.key === 'Escape') {
+ e.preventDefault();
+ this.close();
+ }
+ if (e.key === 'Tab' && this._backdrop) {
+ _handleTabTrap(e, this._backdrop.querySelector('.share-panel-modal'));
+ }
+ }
+
+ _copy(btn) {
+ const text = btn.getAttribute('data-copy');
+ navigator.clipboard.writeText(text).then(() => {
+ const orig = btn.textContent;
+ btn.textContent = 'Copied ✓';
+ btn.classList.add('copied');
+ setTimeout(() => {
+ btn.textContent = orig;
+ btn.classList.remove('copied');
+ }, 1200);
+ });
+ }
+}
+
+// ── helpers ──────────────────────────────────────────────────────────────────
+
+function _esc(str) {
+ return String(str)
+ .replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+}
+
+const FOCUSABLE = 'a[href],button:not([disabled]),input,select,textarea,[tabindex]:not([tabindex="-1"])';
+
+function _trapFocus(modal) {
+ // Initial focus on first focusable element
+ const els = modal.querySelectorAll(FOCUSABLE);
+ if (els.length) els[0].focus();
+}
+
+function _handleTabTrap(e, modal) {
+ const els = Array.from(modal.querySelectorAll(FOCUSABLE));
+ if (!els.length) return;
+ const first = els[0];
+ const last = els[els.length - 1];
+ if (e.shiftKey) {
+ if (document.activeElement === first) {
+ e.preventDefault();
+ last.focus();
+ }
+ } else {
+ if (document.activeElement === last) {
+ e.preventDefault();
+ first.focus();
+ }
+ }
+}
diff --git a/src/validation-ui.js b/src/validation-ui.js
index 7cb3728af..756693774 100644
--- a/src/validation-ui.js
+++ b/src/validation-ui.js
@@ -9,9 +9,8 @@
* - ethers for wallet connection
*/
-import { connectWallet, getSigner } from './erc8004/agent-registry.js';
+import { connectWallet } from './erc8004/agent-registry.js';
import { getLatestValidation, recordValidation, hashReport } from './erc8004/validation-recorder.js';
-import { keccak256, toUtf8Bytes } from 'ethers';
export class ValidationDashboard {
constructor(root, els) {
diff --git a/vercel.json b/vercel.json
index 7baf0f61e..726eed2c0 100644
--- a/vercel.json
+++ b/vercel.json
@@ -27,12 +27,15 @@
{ "src": "/dashboard", "dest": "/public/dashboard/index.html" },
{ "src": "/dashboard/", "dest": "/public/dashboard/index.html" },
{ "src": "/dashboard/(.*)", "dest": "/public/dashboard/$1" },
+ { "src": "/hydrate", "dest": "/public/hydrate/index.html" },
+ { "src": "/hydrate/", "dest": "/public/hydrate/index.html" },
{ "src": "/studio", "dest": "/public/studio/index.html" },
{ "src": "/studio/", "dest": "/public/studio/index.html" },
{ "src": "/studio/(.*)", "dest": "/public/studio/$1" },
{ "src": "/api/agents/me", "dest": "/api/agents" },
{ "src": "/api/agents/by-wallet", "dest": "/api/agents/by-wallet" },
+ { "src": "/api/agents/by-address/([^/]+)", "dest": "/api/agents/by-address/[addr]?addr=$1" },
{ "src": "/api/agents/([^/]+)/wallet", "dest": "/api/agents/[id]" },
{ "src": "/api/avatars/([^/]+)/storage-mode", "dest": "/api/avatars/[id]/storage-mode?id=$1" },
{ "src": "/api/avatars/([^/]+)/pin-ipfs", "dest": "/api/avatars/[id]/pin-ipfs?id=$1" },
@@ -84,9 +87,15 @@
{ "src": "/validation/", "dest": "/public/validation/index.html" },
{ "src": "/validation/(.*)", "dest": "/public/validation/$1" },
+ { "src": "/lobehub/iframe", "dest": "/public/lobehub/iframe/index.html" },
+ { "src": "/lobehub/iframe/", "dest": "/public/lobehub/iframe/index.html" },
+ { "src": "/lobehub/iframe/(.*)", "dest": "/public/lobehub/iframe/$1" },
+
{ "src": "/api/llm/anthropic", "dest": "/api/llm/anthropic.js" },
{ "src": "/api/agents/([^/]+)/usage", "dest": "/api/agents/[id]/usage?id=$1" },
{ "src": "/dashboard/usage", "dest": "/public/dashboard/usage.html" },
+ { "src": "/api/erc8004/hydrate", "dest": "/api/erc8004/hydrate.js" },
+ { "src": "/api/erc8004/import", "dest": "/api/erc8004/import.js" },
{ "src": "/api/(.*)", "dest": "/api/$1" },
diff --git a/vite.config.js b/vite.config.js
index 2c24dc8f3..e7dcbc983 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -34,6 +34,7 @@ const appConfig = {
'agent-embed': resolve(__dirname, 'agent-embed.html'),
'a-embed': resolve(__dirname, 'a-embed.html'),
reputation: resolve(__dirname, 'public/reputation/index.html'),
+ hydrate: resolve(__dirname, 'public/hydrate/index.html'),
},
},
},
@@ -62,6 +63,8 @@ const appConfig = {
'/validation/': resolve(root, 'public/validation/index.html'),
'/reputation': resolve(root, 'public/reputation/index.html'),
'/reputation/': resolve(root, 'public/reputation/index.html'),
+ '/hydrate': resolve(root, 'public/hydrate/index.html'),
+ '/hydrate/': resolve(root, 'public/hydrate/index.html'),
'/agent': resolve(root, 'agent-home.html'),
};
server.middlewares.use(async (req, res, next) => {