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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
milady
nirholas42fc7256fbc0
diff --git a/api/_lib/avatars.js b/api/_lib/avatars.jsindex b42931c44..9f4aa5568 100644--- a/api/_lib/avatars.js+++ b/api/_lib/avatars.js@@ -5,13 +5,25 @@ import { sql } from './db.js';import { publicUrl, presignGet, deleteObject } from './r2.js';import { defaultStorageMode } from './storage-mode.js';-export async function listAvatars({ userId, limit = 50, cursor, visibility, includePublic = false }) {+export async function listAvatars({+ userId,+ limit = 50,+ cursor,+ visibility,+ includePublic = false,+}) {limit = Math.min(Math.max(limit, 1), 200);const params = [userId];const conds = ['deleted_at is null'];conds.push(includePublic ? `(owner_id = $1 or visibility = 'public')` : `owner_id = $1`);- if (visibility) { params.push(visibility); conds.push(`visibility = $${params.length}`); }- if (cursor) { params.push(new Date(cursor)); conds.push(`created_at < $${params.length}`); }+ if (visibility) {+ params.push(visibility);+ conds.push(`visibility = $${params.length}`);+ }+ if (cursor) {+ params.push(new Date(cursor));+ conds.push(`created_at < $${params.length}`);+ }params.push(limit + 1);const rows = await sql(`select id, owner_id, slug, name, description, storage_key, thumbnail_key, size_bytes,@@ -104,8 +116,15 @@ export async function deleteAvatar({ id, userId }) {if (!row) return false;// Fire-and-forget object delete — DB row is source of truth.queueMicrotask(async () => {- try { await deleteObject(row.storage_key); } catch (e) { console.warn('r2 delete failed', e?.message); }- if (row.thumbnail_key) try { await deleteObject(row.thumbnail_key); } catch {}+ try {+ await deleteObject(row.storage_key);+ } catch (e) {+ console.warn('r2 delete failed', e?.message);+ }+ if (row.thumbnail_key)+ try {+ await deleteObject(row.thumbnail_key);+ } catch {}});return true;}@@ -118,8 +137,14 @@ export async function searchPublicAvatars({ q, tag, limit = 24, cursor }) {params.push('%' + q + '%');conds.push(`(name ilike $${params.length} or description ilike $${params.length})`);}- if (tag) { params.push(tag); conds.push(`$${params.length} = any(tags)`); }- if (cursor) { params.push(new Date(cursor)); conds.push(`created_at < $${params.length}`); }+ if (tag) {+ params.push(tag);+ conds.push(`$${params.length} = any(tags)`);+ }+ if (cursor) {+ params.push(new Date(cursor));+ conds.push(`created_at < $${params.length}`);+ }params.push(limit + 1);const rows = await sql(`select id, owner_id, slug, name, description, storage_key, thumbnail_key, size_bytes,@@ -140,7 +165,11 @@ export async function resolveAvatarUrl(row, { expiresIn = 600 } = {}) {if (row.visibility === 'public' || row.visibility === 'unlisted') {return { url: publicUrl(row.storage_key), cdn: true };}- return { url: await presignGet({ key: row.storage_key, expiresIn }), cdn: false, expires_in: expiresIn };+ return {+ url: await presignGet({ key: row.storage_key, expiresIn }),+ cdn: false,+ expires_in: expiresIn,+ };}// ── quotas ───────────────────────────────────────────────────────────────────@@ -156,13 +185,22 @@ async function enforceQuotas(userId, incomingBytes) {const q = rows[0];if (!q) throw Object.assign(new Error('user not found'), { status: 404 });if (incomingBytes > q.max_bytes_per_avatar) {- throw Object.assign(new Error(`file too large for plan ${q.plan}`), { status: 413, code: 'plan_limit_size' });+ throw Object.assign(new Error(`file too large for plan ${q.plan}`), {+ status: 413,+ code: 'plan_limit_size',+ });}if (q.avatar_count >= q.max_avatars) {- throw Object.assign(new Error(`avatar count limit reached on plan ${q.plan}`), { status: 402, code: 'plan_limit_count' });+ throw Object.assign(new Error(`avatar count limit reached on plan ${q.plan}`), {+ status: 402,+ code: 'plan_limit_count',+ });}if (Number(q.total_bytes) + incomingBytes > Number(q.max_total_bytes)) {- throw Object.assign(new Error(`storage limit reached on plan ${q.plan}`), { status: 402, code: 'plan_limit_storage' });+ throw Object.assign(new Error(`storage limit reached on plan ${q.plan}`), {+ status: 402,+ code: 'plan_limit_storage',+ });}}@@ -184,9 +222,10 @@ function decorate(row) {version: row.version,created_at: row.created_at,updated_at: row.updated_at,- model_url: row.visibility === 'public' || row.visibility === 'unlisted'- ? publicUrl(row.storage_key)- : null,+ model_url:+ row.visibility === 'public' || row.visibility === 'unlisted'+ ? publicUrl(row.storage_key)+ : null,parent_avatar_id: row.parent_avatar_id || null,thumbnail_url: row.thumbnail_key ? publicUrl(row.thumbnail_key) : null,};@@ -203,14 +242,16 @@ export function stripOwnerFor(avatar, requesterId) {}async function generateSlug(userId, name) {- const base = name- .toLowerCase()- .replace(/[^a-z0-9]+/g, '-')- .replace(/^-+|-+$/g, '')- .slice(0, 40) || 'avatar';+ const base =+ name+ .toLowerCase()+ .replace(/[^a-z0-9]+/g, '-')+ .replace(/^-+|-+$/g, '')+ .slice(0, 40) || 'avatar';for (let i = 0; i < 5; i++) {const candidate = i === 0 ? base : `${base}-${Math.random().toString(36).slice(2, 6)}`;- const rows = await sql`select 1 from avatars where owner_id = ${userId} and slug = ${candidate} limit 1`;+ const rows =+ await sql`select 1 from avatars where owner_id = ${userId} and slug = ${candidate} limit 1`;if (!rows[0]) return candidate;}return `${base}-${Date.now().toString(36)}`;diff --git a/api/_lib/env.js b/api/_lib/env.jsindex c23d033e1..eab406069 100644--- a/api/_lib/env.js+++ b/api/_lib/env.js@@ -17,40 +17,78 @@ function trimSlash(s) {}export const env = {- get APP_ORIGIN() { return trimSlash(opt('PUBLIC_APP_ORIGIN', 'https://3dagent.vercel.app')); },+ get APP_ORIGIN() {+ return trimSlash(opt('PUBLIC_APP_ORIGIN', 'https://3dagent.vercel.app'));+ },- get DATABASE_URL() { return req('DATABASE_URL'); },+ get DATABASE_URL() {+ return req('DATABASE_URL');+ },- get S3_ENDPOINT() { return trimSlash(req('S3_ENDPOINT')); },- get S3_ACCESS_KEY_ID() { return req('S3_ACCESS_KEY_ID'); },- get S3_SECRET_ACCESS_KEY() { return req('S3_SECRET_ACCESS_KEY'); },- get S3_BUCKET() { return req('S3_BUCKET'); },- get S3_PUBLIC_DOMAIN() { return trimSlash(req('S3_PUBLIC_DOMAIN')); },+ get S3_ENDPOINT() {+ return trimSlash(req('S3_ENDPOINT'));+ },+ get S3_ACCESS_KEY_ID() {+ return req('S3_ACCESS_KEY_ID');+ },+ get S3_SECRET_ACCESS_KEY() {+ return req('S3_SECRET_ACCESS_KEY');+ },+ get S3_BUCKET() {+ return req('S3_BUCKET');+ },+ get S3_PUBLIC_DOMAIN() {+ return trimSlash(req('S3_PUBLIC_DOMAIN'));+ },- get UPSTASH_REDIS_REST_URL() { return opt('UPSTASH_REDIS_REST_URL'); },- get UPSTASH_REDIS_REST_TOKEN(){ return opt('UPSTASH_REDIS_REST_TOKEN'); },+ get UPSTASH_REDIS_REST_URL() {+ return opt('UPSTASH_REDIS_REST_URL');+ },+ get UPSTASH_REDIS_REST_TOKEN() {+ return opt('UPSTASH_REDIS_REST_TOKEN');+ },- get JWT_SECRET() { return req('JWT_SECRET'); },- get JWT_KID() { return opt('JWT_KID', 'k1'); },+ get JWT_SECRET() {+ return req('JWT_SECRET');+ },+ get JWT_KID() {+ return opt('JWT_KID', 'k1');+ },- get PASSWORD_ROUNDS() { return parseInt(opt('PASSWORD_ROUNDS', '11'), 10); },+ get PASSWORD_ROUNDS() {+ return parseInt(opt('PASSWORD_ROUNDS', '11'), 10);+ },- get ISSUER() { return this.APP_ORIGIN; },- get MCP_RESOURCE() { return `${this.APP_ORIGIN}/api/mcp`; },+ get ISSUER() {+ return this.APP_ORIGIN;+ },+ get MCP_RESOURCE() {+ return `${this.APP_ORIGIN}/api/mcp`;+ },// Avaturn — photo-to-avatar pipeline. Only read when /api/onboarding/avaturn-session// is hit; keeping these optional so unrelated endpoints still respond when unset.- get AVATURN_API_KEY() { return opt('AVATURN_API_KEY'); },- get AVATURN_API_URL() { return trimSlash(opt('AVATURN_API_URL', 'https://api.avaturn.me')); },+ get AVATURN_API_KEY() {+ return opt('AVATURN_API_KEY');+ },+ get AVATURN_API_URL() {+ return trimSlash(opt('AVATURN_API_URL', 'https://api.avaturn.me'));+ },// Anthropic API key — used by the we-pay LLM proxy (/api/llm/anthropic).// Must be set in production; optional in local dev if the proxy is unused.- get ANTHROPIC_API_KEY() { return req('ANTHROPIC_API_KEY'); },+ get ANTHROPIC_API_KEY() {+ return req('ANTHROPIC_API_KEY');+ },// Etherscan V2 — unified multichain explorer API (one key, all chains).// Used by api/cron/erc8004-crawl.js to index ERC-8004 Registered events.- get ETHERSCAN_API_KEY() { return opt('ETHERSCAN_API_KEY'); },+ get ETHERSCAN_API_KEY() {+ return opt('ETHERSCAN_API_KEY');+ },// Secret for Vercel Cron Authorization header (crons call with `Bearer $CRON_SECRET`).- get CRON_SECRET() { return opt('CRON_SECRET'); },+ get CRON_SECRET() {+ return opt('CRON_SECRET');+ },};diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.jsindex c11764633..d6f19c309 100644--- a/api/_lib/rate-limit.js+++ b/api/_lib/rate-limit.js@@ -61,13 +61,15 @@ function parseWindowMs(w) {export const limits = {authIp: (ip) => getLimiter('auth:ip', { limit: 30, window: '10 m' }).limit(ip),registerIp: (ip) => getLimiter('register:ip', { limit: 5, window: '1 h' }).limit(ip),- oauthRegisterIp: (ip) => getLimiter('oauth:register:ip', { limit: 10, window: '1 h' }).limit(ip),+ oauthRegisterIp: (ip) =>+ getLimiter('oauth:register:ip', { limit: 10, window: '1 h' }).limit(ip),mcpUser: (userId) => getLimiter('mcp:user', { limit: 1200, window: '1 m' }).limit(userId),mcpIp: (ip) => getLimiter('mcp:ip', { limit: 600, window: '1 m' }).limit(ip),mcpValidate: (key) => getLimiter('mcp:validate', { limit: 10, window: '1 m' }).limit(key),- mcpInspect: (key) => getLimiter('mcp:inspect', { limit: 30, window: '1 m' }).limit(key),+ mcpInspect: (key) => getLimiter('mcp:inspect', { limit: 30, window: '1 m' }).limit(key),mcpOptimize: (key) => getLimiter('mcp:optimize', { limit: 10, window: '1 m' }).limit(key),- oauthToken: (clientId) => getLimiter('oauth:token', { limit: 120, window: '1 m' }).limit(clientId),+ oauthToken: (clientId) =>+ getLimiter('oauth:token', { limit: 120, window: '1 m' }).limit(clientId),upload: (userId) => getLimiter('upload', { limit: 60, 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),@@ -75,8 +77,17 @@ export const limits = {widgetRead: (ip) => getLimiter('widget:read', { limit: 600, window: '1 m' }).limit(ip),// Per-widget visitor chat. Limit is dynamic — one bucket per (widgetId, perMinute).widgetChat: ({ ip, widgetId, perMinute }) =>- getLimiter('widget:chat', { limit: Math.max(1, Math.min(60, perMinute || 8)), window: '1 m' })- .limit(`${widgetId}:${ip}`),+ getLimiter('widget:chat', {+ limit: Math.max(1, Math.min(60, perMinute || 8)),+ window: '1 m',+ }).limit(`${widgetId}:${ip}`),+ // We-pay LLM proxy: 60 req/min per IP (global floor), and per-agent dynamic bucket.+ embedLlmIp: (ip) => getLimiter('embed:llm:ip', { limit: 60, window: '1 m' }).limit(ip),+ embedLlmAgent: (agentId, perMin) =>+ getLimiter('embed:llm:agent', {+ limit: Math.max(1, Math.min(1000, perMin || 10)),+ window: '1 m',+ }).limit(agentId),};// Trust only proxy headers that Vercel itself sets and signs. Naively readingdiff --git a/api/_lib/schema.sql b/api/_lib/schema.sqlindex 7a5c5dee6..f7a75dedc 100644--- a/api/_lib/schema.sql+++ b/api/_lib/schema.sql@@ -387,3 +387,7 @@ create table if not exists erc8004_crawl_cursor (last_block bigint not null default 0,updated_at timestamptz not null default now());++-- Additive migrations for usage_events.+alter table usage_events add column if not exists agent_id uuid references agent_identities(id) on delete set null;+create index if not exists usage_events_agent_time on usage_events(agent_id, created_at desc) where agent_id is not null;diff --git a/api/_lib/usage.js b/api/_lib/usage.jsindex ee3c43ae7..69da8deb6 100644--- a/api/_lib/usage.js+++ b/api/_lib/usage.js@@ -7,12 +7,13 @@ export function recordEvent(evt) {queueMicrotask(async () => {try {await sql`- insert into usage_events (user_id, api_key_id, client_id, avatar_id, kind, tool, status, bytes, latency_ms, meta)+ insert into usage_events (user_id, api_key_id, client_id, avatar_id, agent_id, kind, tool, status, bytes, latency_ms, meta)values (${evt.userId ?? null},${evt.apiKeyId ?? null},${evt.clientId ?? null},${evt.avatarId ?? null},+ ${evt.agentId ?? null},${evt.kind},${evt.tool ?? null},${evt.status ?? 'ok'},@@ -31,6 +32,7 @@ export function logger(name) {return {info: (msg, meta = {}) => console.log(JSON.stringify({ lvl: 'info', name, msg, ...meta })),warn: (msg, meta = {}) => console.warn(JSON.stringify({ lvl: 'warn', name, msg, ...meta })),- error: (msg, meta = {}) => console.error(JSON.stringify({ lvl: 'error', name, msg, ...meta })),+ error: (msg, meta = {}) =>+ console.error(JSON.stringify({ lvl: 'error', name, msg, ...meta })),};}diff --git a/api/agents/[id]/usage.js b/api/agents/[id]/usage.jsnew file mode 100644index 000000000..edffaf224--- /dev/null+++ b/api/agents/[id]/usage.js@@ -0,0 +1,59 @@+// GET /api/agents/:id/usage — owner-only usage stats for the LLM proxy.+// Returns current-month call count, quota, and a 30-day daily breakdown.++import { sql } from '../../_lib/db.js';+import { getSessionUser } from '../../_lib/auth.js';+import { cors, json, method, wrap, error } from '../../_lib/http.js';+import { readEmbedPolicy } from '../../_lib/embed-policy.js';++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);+ if (!session) return error(res, 401, 'unauthorized', 'sign in required');++ const url = new URL(req.url, 'http://x');+ const agentId = url.searchParams.get('id');+ if (!agentId) return error(res, 400, 'validation_error', 'id query param required');++ // Verify caller owns the agent+ const [agent] = await sql`+ SELECT id FROM agent_identities+ WHERE id = ${agentId} AND user_id = ${session.id} AND deleted_at IS NULL+ `;+ if (!agent) return error(res, 404, 'not_found', 'agent not found');++ // Read embed policy for the monthly quota value+ const policy = await readEmbedPolicy(agentId);+ const monthlyQuota = policy?.brain?.monthly_quota ?? null;++ // Current-month total+ const [monthRow] = await sql`+ SELECT COUNT(*)::int AS total+ FROM usage_events+ WHERE agent_id = ${agentId}+ AND kind = 'llm'+ AND created_at >= date_trunc('month', now())+ `;++ // 30-day daily breakdown+ const dailyRows = await sql`+ SELECT+ date_trunc('day', created_at)::date AS day,+ COUNT(*)::int AS calls+ FROM usage_events+ WHERE agent_id = ${agentId}+ AND kind = 'llm'+ AND created_at >= now() - interval '30 days'+ GROUP BY 1+ ORDER BY 1+ `;++ return json(res, 200, {+ agentId,+ monthlyQuota,+ currentMonthCalls: monthRow?.total ?? 0,+ dailyBreakdown: dailyRows.map((r) => ({ day: r.day, calls: r.calls })),+ });+});diff --git a/api/avatars/index.js b/api/avatars/index.jsindex b5ecc82e0..4a8a978b1 100644--- a/api/avatars/index.js+++ b/api/avatars/index.js@@ -72,7 +72,9 @@ async function handleCreate(req, res) {);if (headChecked?.ChecksumSHA256) {// R2 returns base64; convert to lowercase hex.- body.checksum_sha256 = Buffer.from(headChecked.ChecksumSHA256, 'base64').toString('hex');+ body.checksum_sha256 = Buffer.from(headChecked.ChecksumSHA256, 'base64').toString(+ 'hex',+ );}} catch {// ChecksumMode unsupported or object has no checksum — leave null, not fatal.diff --git a/api/llm/anthropic.js b/api/llm/anthropic.jsnew file mode 100644index 000000000..272f595bd--- /dev/null+++ b/api/llm/anthropic.js@@ -0,0 +1,189 @@+// We-pay LLM proxy: forwards Anthropic messages requests on behalf of an agent+// after enforcing embed-policy (brain.mode, origins, surfaces) and quota/rate limits.++import { z } from 'zod';+import { Redis } from '@upstash/redis';+import { env } from '../_lib/env.js';+import { cors, error, method, wrap, readJson } from '../_lib/http.js';+import { parse } from '../_lib/validate.js';+import { limits, clientIp } from '../_lib/rate-limit.js';+import { recordEvent } from '../_lib/usage.js';+import { readEmbedPolicy } from '../_lib/embed-policy.js';++// ── Redis client (for monthly quota counters) ────────────────────────────────++let _redis = null;+function getRedis() {+ if (!_redis && env.UPSTASH_REDIS_REST_URL && env.UPSTASH_REDIS_REST_TOKEN) {+ _redis = new Redis({+ url: env.UPSTASH_REDIS_REST_URL,+ token: env.UPSTASH_REDIS_REST_TOKEN,+ });+ }+ return _redis;+}++// ── Helpers ───────────────────────────────────────────────────────────────────++const MODEL_ALLOWLIST = new Set([+ 'claude-opus-4-6',+ 'claude-opus-4-7',+ 'claude-sonnet-4-6',+ 'claude-haiku-4-5-20251001',+]);++// First-party hostnames always pass origin checks (same as element.js).+const FIRST_PARTY = ['3dagent.vercel.app', 'localhost'];++function originAllowed(originHeader, policy) {+ if (!originHeader) return true; // server-to-server / curl — allow+ let host;+ try {+ host = new URL(originHeader).hostname.toLowerCase();+ } catch {+ return false;+ }+ if (FIRST_PARTY.some((fp) => host === fp || host.endsWith('.' + fp))) return true;+ const hosts = policy?.origins?.hosts ?? [];+ const mode = policy?.origins?.mode ?? 'allowlist';+ const matches = hosts.some((h) => {+ const lower = h.toLowerCase();+ if (lower.startsWith('*.')) return host.endsWith(lower.slice(1)) && host !== lower.slice(2);+ return host === lower;+ });+ return mode === 'allowlist' ? matches : !matches;+}++async function incrementMonthlyQuota(agentId) {+ const r = getRedis();+ if (!r) return 0; // no Redis → quota not enforced+ const now = new Date();+ const ym = `${now.getUTCFullYear()}-${String(now.getUTCMonth() + 1).padStart(2, '0')}`;+ const key = `llm:quota:${agentId}:${ym}`;+ const count = await r.incr(key);+ if (count === 1) await r.expire(key, 40 * 24 * 3600); // expire after 40 days+ return count;+}++// ── Request schema ────────────────────────────────────────────────────────────++const messageContentSchema = z.union([+ z.string(),+ z.array(z.any()), // Anthropic content blocks; pass through+]);++const bodySchema = z.object({+ system: z.string().max(64_000).optional(),+ messages: z+ .array(+ z.object({+ role: z.enum(['user', 'assistant']),+ content: messageContentSchema,+ }),+ )+ .min(1)+ .max(200),+ tools: z.array(z.any()).max(64).optional(),+ model: z.string().max(100).optional(),+ max_tokens: z.number().int().positive().max(16_000).optional(),+ temperature: z.number().min(0).max(2).optional(),+ thinking: z.any().optional(),+});++// ── Handler ───────────────────────────────────────────────────────────────────++export default wrap(async (req, res) => {+ // Allow all HTTP origins for CORS — policy is enforced server-side below.+ if (cors(req, res, { origins: [/^https?:\/\/.+/], methods: 'POST,OPTIONS' })) return;+ if (!method(req, res, ['POST'])) return;++ const url = new URL(req.url, 'http://x');+ const agentId = url.searchParams.get('agent');+ if (!agentId) return error(res, 400, 'validation_error', 'agent query param required');++ // 1. Read embed policy+ const policy = await readEmbedPolicy(agentId);+ if (!policy) return error(res, 404, 'not_found', 'agent not found');++ if (policy.brain?.mode !== 'we-pay') {+ return error(+ res,+ 402,+ 'payment_required',+ `brain.mode is "${policy.brain?.mode ?? 'unset'}"; caller must supply its own key or proxy`,+ );+ }++ if (policy.surfaces?.script === false) {+ return error(res, 403, 'embed_denied_surface', 'script surface disabled for this agent');+ }++ // 2. Origin / Referer check+ const originHeader = req.headers.origin || req.headers.referer || '';+ if (!originAllowed(originHeader, policy)) {+ return error(+ res,+ 403,+ 'embed_denied_origin',+ "origin not permitted by this agent's embed policy",+ );+ }++ // 3. Per-IP rate limit+ const ipRl = await limits.embedLlmIp(clientIp(req));+ if (!ipRl.success) return error(res, 429, 'rate_limited', 'too many requests from this IP');++ // 4. Per-agent rate limit (dynamic, from policy)+ const perMin = policy.brain?.rate_limit_per_min;+ if (perMin && perMin > 0) {+ const agentRl = await limits.embedLlmAgent(agentId, perMin);+ if (!agentRl.success) return error(res, 429, 'rate_limited', 'agent rate limit exceeded');+ }++ // 5. Monthly quota check+ const quota = policy.brain?.monthly_quota;+ if (typeof quota === 'number' && quota !== null) {+ const used = await incrementMonthlyQuota(agentId);+ if (used > quota) {+ return error(res, 429, 'quota_exceeded', `monthly quota of ${quota} calls reached`);+ }+ }++ // 6. Validate + normalize request body+ const rawBody = await readJson(req);+ const body = parse(bodySchema, rawBody);+ const model = body.model || policy.brain?.model || 'claude-opus-4-6';+ if (!MODEL_ALLOWLIST.has(model)) {+ return error(res, 400, 'validation_error', `model "${model}" not in allowlist`);+ }++ // 7. Forward to Anthropic+ const t0 = Date.now();+ const upstream = await fetch('https://api.anthropic.com/v1/messages', {+ method: 'POST',+ headers: {+ 'content-type': 'application/json',+ 'anthropic-version': '2023-06-01',+ 'x-api-key': env.ANTHROPIC_API_KEY,+ },+ body: JSON.stringify({ ...body, model }),+ });+ const upstreamText = await upstream.text();+ const latencyMs = Date.now() - t0;++ // 8. Record usage (fire-and-forget)+ recordEvent({+ kind: 'llm',+ tool: 'anthropic.messages',+ agentId,+ bytes: upstreamText.length,+ latencyMs,+ status: upstream.ok ? 'ok' : 'error',+ meta: { model },+ });++ // 9. Proxy Anthropic's response faithfully+ res.statusCode = upstream.status;+ res.setHeader('content-type', upstream.headers.get('content-type') || 'application/json');+ return res.end(upstreamText);+});diff --git a/dist-lib/agent-3d.js b/dist-lib/agent-3d.jsindex f7752b0b7..eaa6b600e 100644--- a/dist-lib/agent-3d.js+++ b/dist-lib/agent-3d.js@@ -1,5 +1,5 @@-const _a = { ROTATE: 0, DOLLY: 1, PAN: 2 }, fa = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, HE = 0, Fp = 1, zE = 2, o0 = 1, VE = 2, $i = 3, bs = 0, Vn = 1, Ui = 2, Gs = 0, ya = 1, Dp = 2, Np = 3, Lp = 4, WE = 5, fr = 100, qE = 101, KE = 102, jE = 103, XE = 104, YE = 200, JE = 201, ZE = 202, $E = 203, ad = 204, od = 205, e_ = 206, t_ = 207, n_ = 208, i_ = 209, s_ = 210, r_ = 211, a_ = 212, o_ = 213, c_ = 214, cd = 0, ld = 1, hd = 2, Fa = 3, ud = 4, dd = 5, fd = 6, pd = 7, ch = 0, l_ = 1, h_ = 2, Hs = 0, Ad = 1, u_ = 2, d_ = 3, c0 = 4, f_ = 5, p_ = 6, A_ = 7, Pp = "attached", g_ = "detached", l0 = 300, Sr = 301, Da = 302, Fl = 303, gd = 304, lh = 306, Ws = 1e3, ti = 1001, Dl = 1002, Wn = 1003, h0 = 1004, bo = 1005, Xt = 1006, yl = 1007, hi = 1008, un = 1009, u0 = 1010, d0 = 1011, Uo = 1012, Ff = 1013, Ir = 1014, fn = 1015, Qn = 1016, Df = 1017, Nf = 1018, Oo = 1020, f0 = 35902, p0 = 1021, A0 = 1022, pn = 1023, Qo = 1026, Go = 1027, cs = 1028, Lf = 1029, xr = 1030, Pf = 1031, kf = 1033, wl = 33776, Io = 33777, vl = 33778, Mo = 33779, Nl = 35840, md = 35841, Ll = 35842, xd = 35843, Pl = 36196, kl = 37492, Ul = 37496, Ho = 37808, bd = 37809, Ed = 37810, _d = 37811, zo = 37812, yd = 37813, wd = 37814, vd = 37815, Cd = 37816, Sd = 37817, Id = 37818, Md = 37819, Bd = 37820, Td = 37821, Bo = 36492, Rd = 36494, Ol = 36495, g0 = 36283, Fd = 36284, Dd = 36285, Nd = 36286, m0 = 2200, x0 = 2201, m_ = 2202, Vo = 2300, Wo = 2301, kh = 2302, pa = 2400, Aa = 2401, Ql = 2402, Uf = 2500, x_ = 2501, b_ = 0, b0 = 1, Ld = 2, E_ = 3200, __ = 3201, hh = 0, y_ = 1, vi = "", yt = "srgb", An = "srgb-linear", Gl = "linear", Rt = "srgb", Vr = 7680, kp = 519, w_ = 512, v_ = 513, C_ = 514, E0 = 515, S_ = 516, I_ = 517, M_ = 518, B_ = 519, Pd = 35044, Up = "300 es", ls = 2e3, Hl = 2001;-class Ys {+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;+class Js {/*** Adds the given event listener to the given event type.*@@ -56,8 +56,8 @@ class Ys {}}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 Op = 1234567;-const To = Math.PI / 180, Na = 180 / Math.PI;+let Hp = 1234567;+const Fo = Math.PI / 180, La = 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 (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();@@ -65,60 +65,60 @@ function Mi() {function ot(i, e, t) {return Math.max(e, Math.min(t, i));}-function Of(i, e) {+function Hf(i, e) {return (i % e + e) % e;}-function T_(i, e, t, n, s) {+function Gy(i, e, t, n, s) {return n + (i - e) * (s - n) / (t - e);}-function R_(i, e, t) {+function Hy(i, e, t) {return i !== e ? (t - i) / (e - i) : 0;}-function Ro(i, e, t) {+function No(i, e, t) {return (1 - t) * i + t * e;}-function F_(i, e, t, n) {- return Ro(i, e, 1 - Math.exp(-t * n));+function zy(i, e, t, n) {+ return No(i, e, 1 - Math.exp(-t * n));}-function D_(i, e = 1) {- return e - Math.abs(Of(i, e * 2) - e);+function Vy(i, e = 1) {+ return e - Math.abs(Hf(i, e * 2) - e);}-function N_(i, e, t) {+function Wy(i, e, t) {return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * (3 - 2 * i));}-function L_(i, e, t) {+function qy(i, e, t) {return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * i * (i * (i * 6 - 15) + 10));}-function P_(i, e) {+function Ky(i, e) {return i + Math.floor(Math.random() * (e - i + 1));}-function k_(i, e) {+function jy(i, e) {return i + Math.random() * (e - i);}-function U_(i) {+function Xy(i) {return i * (0.5 - Math.random());}-function O_(i) {- i !== void 0 && (Op = i);- let e = Op += 1831565813;+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;}-function Q_(i) {- return i * To;+function Jy(i) {+ return i * Fo;}-function G_(i) {- return i * Na;+function Zy(i) {+ return i * La;}-function H_(i) {+function $y(i) {return (i & i - 1) === 0 && i !== 0;}-function z_(i) {+function e_(i) {return Math.pow(2, Math.ceil(Math.log(i) / Math.LN2));}-function V_(i) {+function t_(i) {return Math.pow(2, Math.floor(Math.log(i) / Math.LN2));}-function W_(i, e, t, n, s) {+function n_(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":@@ -184,8 +184,8 @@ function Bt(i, e) {}}const Cn = {- DEG2RAD: To,- RAD2DEG: Na,+ DEG2RAD: Fo,+ RAD2DEG: La,/*** Generate a [UUID]{@link https://en.wikipedia.org/wiki/Universally_unique_identifier}* (universally unique identifier).@@ -216,7 +216,7 @@ const Cn = {* @param {number} m - The second parameter.* @return {number} The Euclidean modulo.*/- euclideanModulo: Of,+ euclideanModulo: Hf,/*** 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: T_,+ mapLinear: Gy,/*** 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: R_,+ inverseLerp: Hy,/*** 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: Ro,+ lerp: No,/*** 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: F_,+ damp: zy,/*** 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: D_,+ pingpong: Vy,/*** 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: N_,+ smoothstep: Wy,/*** 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: L_,+ smootherstep: qy,/*** 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: P_,+ randInt: Ky,/*** 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: k_,+ randFloat: jy,/*** 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: U_,+ randFloatSpread: Xy,/*** 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: O_,+ seededRandom: Yy,/*** 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: Q_,+ degToRad: Jy,/*** 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: G_,+ radToDeg: Zy,/*** 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: H_,+ isPowerOfTwo: $y,/*** 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: z_,+ ceilPowerOfTwo: e_,/*** 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: V_,+ floorPowerOfTwo: t_,/*** 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: W_,+ setQuaternionFromProperEuler: n_,/*** Normalizes the given value according to the given typed array.*@@ -1100,8 +1100,8 @@ class at {* @return {Matrix3} A reference to this matrix.*/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], y = s[1], x = s[4], E = s[7], I = s[2], w = s[5], S = s[8];- return r[0] = a * m + o * y + c * I, r[3] = a * g + o * x + c * w, r[6] = a * A + o * E + c * S, r[1] = l * m + h * y + u * I, r[4] = l * g + h * x + u * w, r[7] = l * A + h * E + u * S, r[2] = d * m + f * y + p * I, r[5] = d * g + f * x + p * w, r[8] = d * A + f * E + p * S, this;+ 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;}/*** Multiplies every component of the matrix by the given scalar.@@ -1199,7 +1199,7 @@ class at {* @return {Matrix3} A reference to this matrix.*/scale(e, t) {- return this.premultiply(Uh.makeScale(e, t)), this;+ return this.premultiply(Gh.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(Uh.makeRotation(-e)), this;+ return this.premultiply(Gh.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(Uh.makeTranslation(e, t)), this;+ return this.premultiply(Gh.makeTranslation(e, t)), this;}// for 2D Transforms/**@@ -1336,24 +1336,24 @@ class at {return new this.constructor().fromArray(this.elements);}}-const Uh = /* @__PURE__ */ new at();-function _0(i) {+const Gh = /* @__PURE__ */ new at();+function I0(i) {for (let e = i.length - 1; e >= 0; --e)if (i[e] >= 65535) return !0;return !1;}-function qo(i) {+function jo(i) {return document.createElementNS("http://www.w3.org/1999/xhtml", i);}-function q_() {- const i = qo("canvas");+function i_() {+ const i = jo("canvas");return i.style.display = "block", i;}-const Qp = {};-function Cl(i) {- i in Qp || (Qp[i] = !0, console.warn(i));+const zp = {};+function Sl(i) {+ i in zp || (zp[i] = !0, console.warn(i));}-function K_(i, e, t) {+function s_(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 K_(i, e, t) {setTimeout(r, t);});}-function j_(i) {+function r_(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 X_(i) {+function a_(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 Gp = /* @__PURE__ */ new at().set(+const Vp = /* @__PURE__ */ new at().set(0.4123908,0.3575843,0.1804808,@@ -1388,7 +1388,7 @@ const Gp = /* @__PURE__ */ new at().set(0.0193308,0.1191948,0.9505322-), Hp = /* @__PURE__ */ new at().set(+), Wp = /* @__PURE__ */ new at().set(3.2409699,-1.5373832,-0.4986108,@@ -1399,7 +1399,7 @@ const Gp = /* @__PURE__ */ new at().set(-0.203977,1.0569715);-function Y_() {+function o_() {const i = {enabled: !0,workingColorSpace: An,@@ -1423,7 +1423,7 @@ function Y_() {*/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 = wa(s.r), s.g = wa(s.g), s.b = wa(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 = Ca(s.r), s.g = Ca(s.g), s.b = Ca(s.b))), s;},fromWorkingColorSpace: function(s, r) {return this.convert(s, this.workingColorSpace, r);@@ -1435,7 +1435,7 @@ function Y_() {return this.spaces[s].primaries;},getTransfer: function(s) {- return s === vi ? Gl : this.spaces[s].transfer;+ return s === vi ? zl : this.spaces[s].transfer;},getLuminanceCoefficients: function(s, r = this.workingColorSpace) {return s.fromArray(this.spaces[r].luminanceCoefficients);@@ -1458,33 +1458,33 @@ function Y_() {[An]: {primaries: e,whitePoint: n,- transfer: Gl,- toXYZ: Gp,- fromXYZ: Hp,+ transfer: zl,+ toXYZ: Vp,+ fromXYZ: Wp,luminanceCoefficients: t,- workingColorSpaceConfig: { unpackColorSpace: yt },- outputColorSpaceConfig: { drawingBufferColorSpace: yt }+ workingColorSpaceConfig: { unpackColorSpace: _t },+ outputColorSpaceConfig: { drawingBufferColorSpace: _t }},- [yt]: {+ [_t]: {primaries: e,whitePoint: n,transfer: Rt,- toXYZ: Gp,- fromXYZ: Hp,+ toXYZ: Vp,+ fromXYZ: Wp,luminanceCoefficients: t,- outputColorSpaceConfig: { drawingBufferColorSpace: yt }+ outputColorSpaceConfig: { drawingBufferColorSpace: _t }}}), i;}-const rt = /* @__PURE__ */ Y_();+const rt = /* @__PURE__ */ o_();function ps(i) {return i < 0.04045 ? i * 0.0773993808 : Math.pow(i * 0.9478672986 + 0.0521327014, 2.4);}-function wa(i) {+function Ca(i) {return i < 31308e-7 ? i * 12.92 : 1.055 * Math.pow(i, 0.41666) - 0.055;}-let Wr;-class J_ {+let Kr;+class c_ {/*** Returns a data URI containing a representation of the given image.*@@ -1499,9 +1499,9 @@ class J_ {if (e instanceof HTMLCanvasElement)n = e;else {- Wr === void 0 && (Wr = qo("canvas")), Wr.width = e.width, Wr.height = e.height;- const s = Wr.getContext("2d");- e instanceof ImageData ? s.putImageData(e, 0, 0) : s.drawImage(e, 0, 0, e.width, e.height), n = Wr;+ Kr === void 0 && (Kr = jo("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;}return n.toDataURL(t);}@@ -1513,7 +1513,7 @@ class J_ {*/static sRGBToLinear(e) {if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap) {- const t = qo("canvas");+ const t = jo("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 J_ {return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;}}-let Z_ = 0;-class Qf {+let l_ = 0;+class zf {/*** 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: Z_++ }), this.uuid = Mi(), this.data = e, this.dataReady = !0, this.version = 0;+ this.isSource = !0, Object.defineProperty(this, "id", { value: l_++ }), this.uuid = Mi(), this.data = e, this.dataReady = !0, this.version = 0;}/*** When the property is set to `true`, the engine allocates the memory@@ -1576,24 +1576,24 @@ class Qf {if (Array.isArray(s)) {r = [];for (let a = 0, o = s.length; a < o; a++)- s[a].isDataTexture ? r.push(Oh(s[a].image)) : r.push(Oh(s[a]));+ s[a].isDataTexture ? r.push(Hh(s[a].image)) : r.push(Hh(s[a]));} else- r = Oh(s);+ r = Hh(s);n.url = r;}return t || (e.images[this.uuid] = n), n;}}-function Oh(i) {- return typeof HTMLImageElement < "u" && i instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && i instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && i instanceof ImageBitmap ? J_.getDataURL(i) : i.data ? {+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 ? {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 $_ = 0;-class an extends Ys {+let h_ = 0;+class an extends Js {/*** Constructs a new texture.*@@ -1609,7 +1609,7 @@ class an extends Ys {* @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: $_++ }), this.uuid = Mi(), this.name = "", this.source = new Qf(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;+ 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;}/*** The image object holding the texture data.@@ -1703,7 +1703,7 @@ class an extends Ys {* @return {Vector2} The transformed uv vector.*/transformUv(e) {- if (this.mapping !== l0) return e;+ if (this.mapping !== p0) return e;if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)switch (this.wrapS) {case Ws:@@ -1712,7 +1712,7 @@ class an extends Ys {case ti:e.x = e.x < 0 ? 0 : 1;break;- case Dl:+ case Ll: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;}@@ -1724,7 +1724,7 @@ class an extends Ys {case ti:e.y = e.y < 0 ? 0 : 1;break;- case Dl:+ case Ll: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 Ys {}}an.DEFAULT_IMAGE = null;-an.DEFAULT_MAPPING = l0;+an.DEFAULT_MAPPING = p0;an.DEFAULT_ANISOTROPY = 1;class mt {/**@@ -2051,11 +2051,11 @@ class mt {if (Math.abs(h + d) < 0.1 && Math.abs(u + m) < 0.1 && Math.abs(p + g) < 0.1 && Math.abs(l + f + A - 3) < 0.1)return this.set(1, 0, 0, 0), this;t = Math.PI;- const x = (l + 1) / 2, E = (f + 1) / 2, I = (A + 1) / 2, w = (h + d) / 4, S = (u + m) / 4, T = (p + g) / 4;- return x > E && x > I ? x < 0.01 ? (n = 0, s = 0.707106781, r = 0.707106781) : (n = Math.sqrt(x), s = w / n, r = S / n) : E > I ? E < 0.01 ? (n = 0.707106781, s = 0, r = 0.707106781) : (s = Math.sqrt(E), n = w / s, r = T / s) : I < 0.01 ? (n = 0.707106781, s = 0.707106781, r = 0) : (r = Math.sqrt(I), n = S / r, s = T / r), this.set(n, s, r, t), this;+ 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 < 0.01 ? (n = 0, s = 0.707106781, r = 0.707106781) : (n = Math.sqrt(x), s = w / n, r = I / n) : E > S ? E < 0.01 ? (n = 0.707106781, s = 0, r = 0.707106781) : (s = Math.sqrt(E), n = w / s, r = T / s) : S < 0.01 ? (n = 0.707106781, s = 0.707106781, r = 0) : (r = Math.sqrt(S), n = I / r, s = T / r), this.set(n, s, r, t), this;}- let y = Math.sqrt((g - p) * (g - p) + (u - m) * (u - m) + (d - h) * (d - h));- return Math.abs(y) < 1e-3 && (y = 1), this.x = (g - p) / y, this.y = (u - m) / y, this.z = (d - h) / y, this.w = Math.acos((l + f + A - 1) / 2), this;+ let _ = Math.sqrt((g - p) * (g - p) + (u - m) * (u - m) + (d - h) * (d - h));+ return Math.abs(_) < 1e-3 && (_ = 1), this.x = (g - p) / _, this.y = (u - m) / _, this.z = (d - h) / _, this.w = Math.acos((l + f + A - 1) / 2), this;}/*** Sets the vector components to the position elements of the@@ -2302,7 +2302,7 @@ class mt {yield this.x, yield this.y, yield this.z, yield this.w;}}-class ey extends Ys {+class u_ extends Js {/*** Render target options.*@@ -2418,7 +2418,7 @@ class ey extends Ys {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 Qf(s);+ this.textures[t].source = new zf(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 ey extends Ys {this.dispatchEvent({ type: "dispose" });}}-class Mr extends ey {+class Rr extends u_ {/*** Constructs a new 3D render target.*@@ -2444,7 +2444,7 @@ class Mr extends ey {super(e, t, n), this.isWebGLRenderTarget = !0;}}-class y0 extends an {+class S0 extends an {/*** Constructs a new data array texture.*@@ -2475,7 +2475,7 @@ class y0 extends an {this.layerUpdates.clear();}}-class w0 extends an {+class M0 extends an {/*** Constructs a new data array texture.*@@ -2526,15 +2526,15 @@ class Jt {}if (u !== m || c !== d || l !== f || h !== p) {let g = 1 - o;- const A = c * d + l * f + h * p + u * m, y = A >= 0 ? 1 : -1, x = 1 - A * A;+ const A = c * d + l * f + h * p + u * m, _ = A >= 0 ? 1 : -1, x = 1 - A * A;if (x > Number.EPSILON) {- const I = Math.sqrt(x), w = Math.atan2(I, A * y);- g = Math.sin(g * w) / I, o = Math.sin(o * w) / I;+ 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 * y;+ 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 I = 1 / Math.sqrt(c * c + l * l + h * h + u * u);- c *= I, l *= I, h *= I, u *= I;+ 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;@@ -3155,7 +3155,7 @@ class G {* @return {Vector3} A reference to this vector.*/applyEuler(e) {- return this.applyQuaternion(zp.setFromEuler(e));+ return this.applyQuaternion(qp.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(zp.setFromAxisAngle(e, t));+ return this.applyQuaternion(qp.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 Qh.copy(this).projectOnVector(e), this.sub(Qh);+ return zh.copy(this).projectOnVector(e), this.sub(zh);}/*** 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(Qh.copy(e).multiplyScalar(2 * this.dot(e)));+ return this.sub(zh.copy(e).multiplyScalar(2 * this.dot(e)));}/*** Returns the angle between the given vector and this instance in radians.@@ -3697,7 +3697,7 @@ class G {yield this.x, yield this.y, yield this.z;}}-const Qh = /* @__PURE__ */ new G(), zp = /* @__PURE__ */ new Jt();+const zh = /* @__PURE__ */ new G(), qp = /* @__PURE__ */ new Jt();class Hi {/*** Constructs a new bounding box.@@ -3888,7 +3888,7 @@ class Hi {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);else- e.boundingBox !== void 0 ? (e.boundingBox === null && e.computeBoundingBox(), vc.copy(e.boundingBox)) : (n.boundingBox === null && n.computeBoundingBox(), vc.copy(n.boundingBox)), vc.applyMatrix4(e.matrixWorld), this.union(vc);+ 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);}const s = e.children;for (let r = 0, a = s.length; r < a; r++)@@ -3965,7 +3965,7 @@ class Hi {intersectsTriangle(e) {if (this.isEmpty())return !1;- this.getCenter(no), Cc.subVectors(this.max, no), qr.subVectors(e.a, no), Kr.subVectors(e.b, no), jr.subVectors(e.c, no), vs.subVectors(Kr, qr), Cs.subVectors(jr, Kr), tr.subVectors(qr, jr);+ 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);let t = [0,-vs.z,@@ -3974,28 +3974,28 @@ class Hi {-Cs.z,Cs.y,0,- -tr.z,- tr.y,+ -nr.z,+ nr.y,vs.z,0,-vs.x,Cs.z,0,-Cs.x,- tr.z,+ nr.z,0,- -tr.x,+ -nr.x,-vs.y,vs.x,0,-Cs.y,Cs.x,0,- -tr.y,- tr.x,+ -nr.y,+ nr.x,0];- return !Gh(t, qr, Kr, jr, Cc) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !Gh(t, qr, Kr, jr, Cc)) ? !1 : (Sc.crossVectors(vs, Cs), t = [Sc.x, Sc.y, Sc.z], Gh(t, qr, Kr, jr, Cc));+ 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));}/*** Clamps the given point within the bounds of this box.@@ -4087,17 +4087,17 @@ const Ki = [/* @__PURE__ */ new G(),/* @__PURE__ */ new G(),/* @__PURE__ */ new G()-], gi = /* @__PURE__ */ new G(), vc = /* @__PURE__ */ new Hi(), qr = /* @__PURE__ */ new G(), Kr = /* @__PURE__ */ new G(), jr = /* @__PURE__ */ new G(), vs = /* @__PURE__ */ new G(), Cs = /* @__PURE__ */ new G(), tr = /* @__PURE__ */ new G(), no = /* @__PURE__ */ new G(), Cc = /* @__PURE__ */ new G(), Sc = /* @__PURE__ */ new G(), nr = /* @__PURE__ */ new G();-function Gh(i, e, t, n, s) {+], 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) {for (let r = 0, a = i.length - 3; r <= a; r += 3) {- nr.fromArray(i, r);- const o = s.x * Math.abs(nr.x) + s.y * Math.abs(nr.y) + s.z * Math.abs(nr.z), c = e.dot(nr), l = t.dot(nr), h = n.dot(nr);+ 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);if (Math.max(-Math.max(c, l, h), Math.min(c, l, h)) > o)return !1;}return !0;}-const ty = /* @__PURE__ */ new Hi(), io = /* @__PURE__ */ new G(), Hh = /* @__PURE__ */ new G();+const d_ = /* @__PURE__ */ new Hi(), so = /* @__PURE__ */ new G(), Wh = /* @__PURE__ */ new G();class zi {/*** Constructs a new sphere.@@ -4130,7 +4130,7 @@ class zi {*/setFromPoints(e, t) {const n = this.center;- t !== void 0 ? n.copy(t) : ty.setFromPoints(e).getCenter(n);+ t !== void 0 ? n.copy(t) : d_.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;- io.subVectors(e, this.center);- const t = io.lengthSq();+ so.subVectors(e, this.center);+ const t = so.lengthSq();if (t > this.radius * this.radius) {const n = Math.sqrt(t), s = (n - this.radius) * 0.5;- this.center.addScaledVector(io, s / n), this.radius += s;+ this.center.addScaledVector(so, 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) : (Hh.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(io.copy(e.center).add(Hh)), this.expandByPoint(io.copy(e.center).sub(Hh))), 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) : (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);}/*** 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(), zh = /* @__PURE__ */ new G(), Ic = /* @__PURE__ */ new G(), Ss = /* @__PURE__ */ new G(), Vh = /* @__PURE__ */ new G(), Mc = /* @__PURE__ */ new G(), Wh = /* @__PURE__ */ new G();-class lc {+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 {/*** Constructs a new ray.*@@ -4396,8 +4396,8 @@ class lc {* @return {number} The squared distance.*/distanceSqToSegment(e, t, n, s) {- zh.copy(e).add(t).multiplyScalar(0.5), Ic.copy(t).sub(e).normalize(), Ss.copy(this.origin).sub(zh);- const r = e.distanceTo(t) * 0.5, a = -this.direction.dot(Ic), o = Ss.dot(this.direction), c = -Ss.dot(Ic), l = Ss.lengthSq(), h = Math.abs(1 - a * a);+ 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);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 lc {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);elsed = 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(zh).addScaledVector(Ic, d), f;+ return n && n.copy(this.origin).addScaledVector(this.direction, u), s && s.copy(qh).addScaledVector(Bc, d), f;}/*** Intersects this ray with the given sphere, returning the intersection@@ -4509,8 +4509,8 @@ class lc {* @return {?Vector3} The intersection point.*/intersectTriangle(e, t, n, s, r) {- Vh.subVectors(t, e), Mc.subVectors(n, e), Wh.crossVectors(Vh, Mc);- let a = this.direction.dot(Wh), o;+ Kh.subVectors(t, e), Tc.subVectors(n, e), jh.crossVectors(Kh, Tc);+ let a = this.direction.dot(jh), o;if (a > 0) {if (s) return null;o = 1;@@ -4518,14 +4518,14 @@ class lc {o = -1, a = -a;elsereturn null;- Ss.subVectors(this.origin, e);- const c = o * this.direction.dot(Mc.crossVectors(Ss, Mc));+ Is.subVectors(this.origin, e);+ const c = o * this.direction.dot(Tc.crossVectors(Is, Tc));if (c < 0)return null;- const l = o * this.direction.dot(Vh.cross(Ss));+ const l = o * this.direction.dot(Kh.cross(Is));if (l < 0 || c + l > a)return null;- const h = -o * Ss.dot(Wh);+ const h = -o * Is.dot(jh);return h < 0 ? null : this.at(h / a, r);}/**@@ -4555,7 +4555,7 @@ class lc {return new this.constructor().copy(this);}}-class De {+class Ne {/*** Constructs a new 4x4 matrix. The arguments are supposed to be* in row-major order. If no arguments are provided, the constructor@@ -4579,7 +4579,7 @@ class De {* @param {number} [n44] - 4-4 matrix element.*/constructor(e, t, n, s, r, a, o, c, l, h, u, d, f, p, m, g) {- De.prototype.isMatrix4 = !0, this.elements = [+ Ne.prototype.isMatrix4 = !0, this.elements = [1,0,0,@@ -4655,7 +4655,7 @@ class De {* @return {Matrix4} A clone of this instance.*/clone() {- return new De().fromArray(this.elements);+ return new Ne().fromArray(this.elements);}/*** Copies the values of the given matrix to this instance.@@ -4754,7 +4754,7 @@ class De {* @return {Matrix4} A reference to this matrix.*/extractRotation(e) {- const t = this.elements, n = e.elements, s = 1 / Xr.setFromMatrixColumn(e, 0).length(), r = 1 / Xr.setFromMatrixColumn(e, 1).length(), a = 1 / Xr.setFromMatrixColumn(e, 2).length();+ const t = this.elements, n = e.elements, s = 1 / Jr.setFromMatrixColumn(e, 0).length(), r = 1 / Jr.setFromMatrixColumn(e, 1).length(), a = 1 / Jr.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;}/**@@ -4799,7 +4799,7 @@ class De {* @return {Matrix4} A reference to this matrix.*/makeRotationFromQuaternion(e) {- return this.compose(ny, e, iy);+ return this.compose(f_, e, p_);}/*** Sets the rotation component of the transformation matrix, looking from `eye` towards@@ -4812,7 +4812,7 @@ class De {*/lookAt(e, t, n) {const s = this.elements;- return Jn.subVectors(e, t), Jn.lengthSq() === 0 && (Jn.z = 1), Jn.normalize(), Is.crossVectors(n, Jn), Is.lengthSq() === 0 && (Math.abs(n.z) === 1 ? Jn.x += 1e-4 : Jn.z += 1e-4, Jn.normalize(), Is.crossVectors(n, Jn)), Is.normalize(), Bc.crossVectors(Jn, Is), s[0] = Is.x, s[4] = Bc.x, s[8] = Jn.x, s[1] = Is.y, s[5] = Bc.y, s[9] = Jn.y, s[2] = Is.z, s[6] = Bc.z, s[10] = Jn.z, this;+ 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;}/*** Post-multiplies this matrix by the given 4x4 matrix.@@ -4841,8 +4841,8 @@ class De {* @return {Matrix4} A reference to this matrix.*/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], y = n[3], x = n[7], E = n[11], I = n[15], w = s[0], S = s[4], T = s[8], C = s[12], v = s[1], F = s[5], K = s[9], q = s[13], $ = s[2], N = 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 * S + o * F + c * N + 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 * S + u * F + d * N + 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 * S + m * F + g * N + A * J, r[10] = p * T + m * K + g * O + A * ee, r[14] = p * C + m * q + g * Y + A * ae, r[3] = y * w + x * v + E * $ + I * Q, r[7] = y * S + x * F + E * N + I * J, r[11] = y * T + x * K + E * O + I * ee, r[15] = y * C + x * q + E * Y + I * ae, this;+ 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;}/*** Multiplies every component of the matrix by the given scalar.@@ -4896,10 +4896,10 @@ class De {* @return {Matrix4} A reference to this matrix.*/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], y = 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, I = p * u * c - h * m * c - p * o * d + a * m * d + h * o * g - a * u * g, w = t * y + n * x + s * E + r * I;+ 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 S = 1 / w;- return e[0] = y * S, e[1] = (m * d * r - u * g * r - m * s * f + n * g * f + u * s * A - n * d * A) * S, e[2] = (o * g * r - m * c * r + m * s * l - n * g * l - o * s * A + n * c * A) * S, e[3] = (u * c * r - o * d * r - u * s * l + n * d * l + o * s * f - n * c * f) * S, e[4] = x * S, e[5] = (h * g * r - p * d * r + p * s * f - t * g * f - h * s * A + t * d * A) * S, e[6] = (p * c * r - a * g * r - p * s * l + t * g * l + a * s * A - t * c * A) * S, e[7] = (a * d * r - h * c * r + h * s * l - t * d * l - a * s * f + t * c * f) * S, e[8] = E * S, e[9] = (p * u * r - h * m * r - p * n * f + t * m * f + h * n * A - t * u * A) * S, e[10] = (a * m * r - p * o * r + p * n * l - t * m * l - a * n * A + t * o * A) * S, e[11] = (h * o * r - a * u * r - h * n * l + t * u * l + a * n * f - t * o * f) * S, e[12] = I * S, e[13] = (h * m * s - p * u * s + p * n * d - t * m * d - h * n * g + t * u * g) * S, e[14] = (p * o * s - a * m * s - p * n * c + t * m * c + a * n * g - t * o * g) * S, e[15] = (a * u * s - h * o * s + h * n * c - t * u * c - a * n * d + t * o * d) * S, this;+ 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;}/*** Multiplies the columns of this matrix by the given vector.@@ -5150,8 +5150,8 @@ class De {* @return {Matrix4} A reference to this matrix.*/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, y = c * l, x = c * h, E = c * u, I = n.x, w = n.y, S = n.z;- return s[0] = (1 - (m + A)) * I, s[1] = (f + E) * I, s[2] = (p - x) * I, s[3] = 0, s[4] = (f - E) * w, s[5] = (1 - (d + A)) * w, s[6] = (g + y) * w, s[7] = 0, s[8] = (p + x) * S, s[9] = (g - y) * S, s[10] = (1 - (d + m)) * S, s[11] = 0, s[12] = e.x, s[13] = e.y, s[14] = e.z, s[15] = 1, this;+ 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;}/*** Decomposes this matrix into its position, rotation and scale components@@ -5168,8 +5168,8 @@ class De {*/decompose(e, t, n) {const s = this.elements;- let r = Xr.set(s[0], s[1], s[2]).length();- const a = Xr.set(s[4], s[5], s[6]).length(), o = Xr.set(s[8], s[9], s[10]).length();+ 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);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;@@ -5192,7 +5192,7 @@ class De {let f, p;if (o === ls)f = -(a + r) / (a - r), p = -2 * a * r / (a - r);- else if (o === Hl)+ else if (o === Vl)f = -a / (a - r), p = -a * r / (a - r);elsethrow new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + o);@@ -5216,7 +5216,7 @@ class De {let p, m;if (o === ls)p = (a + r) * u, m = -2 * u;- else if (o === Hl)+ else if (o === Vl)p = r * u, m = -1 * u;elsethrow new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + o);@@ -5259,7 +5259,7 @@ class De {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 Xr = /* @__PURE__ */ new G(), mi = /* @__PURE__ */ new De(), ny = /* @__PURE__ */ new G(0, 0, 0), iy = /* @__PURE__ */ new G(1, 1, 1), Is = /* @__PURE__ */ new G(), Bc = /* @__PURE__ */ new G(), Jn = /* @__PURE__ */ new G(), Vp = /* @__PURE__ */ new De(), Wp = /* @__PURE__ */ new Jt();+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();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 Vp.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Vp, t, n);+ return Kp.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Kp, 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 Wp.setFromEuler(this), this.setFromQuaternion(Wp, e);+ return jp.setFromEuler(this), this.setFromQuaternion(jp, e);}/*** Returns `true` if this Euler instance is equal with the given one.@@ -5458,7 +5458,7 @@ class dn {}}dn.DEFAULT_ORDER = "XYZ";-class v0 {+class B0 {/*** Constructs a new layers instance, with membership* initially set to layer `0`.@@ -5530,14 +5530,14 @@ class v0 {return (this.mask & (1 << e | 0)) !== 0;}}-let sy = 0;-const qp = /* @__PURE__ */ new G(), Yr = /* @__PURE__ */ new Jt(), Xi = /* @__PURE__ */ new De(), Tc = /* @__PURE__ */ new G(), so = /* @__PURE__ */ new G(), ry = /* @__PURE__ */ new G(), ay = /* @__PURE__ */ new Jt(), Kp = /* @__PURE__ */ new G(1, 0, 0), jp = /* @__PURE__ */ new G(0, 1, 0), Xp = /* @__PURE__ */ new G(0, 0, 1), Yp = { type: "added" }, oy = { type: "removed" }, Jr = { type: "childadded", child: null }, qh = { type: "childremoved", child: null };-class Tt extends Ys {+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 };+class Tt extends Js {/*** Constructs a new 3D object.*/constructor() {- super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: sy++ }), 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: A_++ }), 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 Jt(), s = new G(1, 1, 1);function r() {n.setFromEuler(t, !1);@@ -5600,7 +5600,7 @@ class Tt extends Ys {* @type {Matrix4}*/modelViewMatrix: {- value: new De()+ value: new Ne()},/*** Represents the object's normal matrix.@@ -5611,7 +5611,7 @@ class Tt extends Ys {normalMatrix: {value: new at()}- }), this.matrix = new De(), this.matrixWorld = new De(), this.matrixAutoUpdate = Tt.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = Tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new v0(), 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 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 = {};}/*** A callback that is executed immediately before a 3D object is rendered to a shadow map.@@ -5723,7 +5723,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/rotateOnAxis(e, t) {- return Yr.setFromAxisAngle(e, t), this.quaternion.multiply(Yr), this;+ return Zr.setFromAxisAngle(e, t), this.quaternion.multiply(Zr), this;}/*** Rotates the 3D object along an axis in world space.@@ -5733,7 +5733,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/rotateOnWorldAxis(e, t) {- return Yr.setFromAxisAngle(e, t), this.quaternion.premultiply(Yr), this;+ return Zr.setFromAxisAngle(e, t), this.quaternion.premultiply(Zr), this;}/*** Rotates the 3D object around its X axis in local space.@@ -5742,7 +5742,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/rotateX(e) {- return this.rotateOnAxis(Kp, e);+ return this.rotateOnAxis(Yp, e);}/*** Rotates the 3D object around its Y axis in local space.@@ -5751,7 +5751,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/rotateY(e) {- return this.rotateOnAxis(jp, e);+ return this.rotateOnAxis(Jp, e);}/*** Rotates the 3D object around its Z axis in local space.@@ -5760,7 +5760,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/rotateZ(e) {- return this.rotateOnAxis(Xp, e);+ return this.rotateOnAxis(Zp, e);}/*** Translate the 3D object by a distance along the given axis in local space.@@ -5770,7 +5770,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/translateOnAxis(e, t) {- return qp.copy(e).applyQuaternion(this.quaternion), this.position.add(qp.multiplyScalar(t)), this;+ return Xp.copy(e).applyQuaternion(this.quaternion), this.position.add(Xp.multiplyScalar(t)), this;}/*** Translate the 3D object by a distance along its X-axis in local space.@@ -5779,7 +5779,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/translateX(e) {- return this.translateOnAxis(Kp, e);+ return this.translateOnAxis(Yp, e);}/*** Translate the 3D object by a distance along its Y-axis in local space.@@ -5788,7 +5788,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/translateY(e) {- return this.translateOnAxis(jp, e);+ return this.translateOnAxis(Jp, e);}/*** Translate the 3D object by a distance along its Z-axis in local space.@@ -5797,7 +5797,7 @@ class Tt extends Ys {* @return {Object3D} A reference to this instance.*/translateZ(e) {- return this.translateOnAxis(Xp, e);+ return this.translateOnAxis(Zp, e);}/*** Converts the given vector from this 3D object's local space to world space.@@ -5827,9 +5827,9 @@ class Tt extends Ys {* @param {number} [z] - The z coordinate in world space.*/lookAt(e, t, n) {- e.isVector3 ? Tc.copy(e) : Tc.set(e, t, n);+ e.isVector3 ? Fc.copy(e) : Fc.set(e, t, n);const s = this.parent;- this.updateWorldMatrix(!0, !1), so.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Xi.lookAt(so, Tc, this.up) : Xi.lookAt(Tc, so, this.up), this.quaternion.setFromRotationMatrix(Xi), s && (Xi.extractRotation(s.matrixWorld), Yr.setFromRotationMatrix(Xi), this.quaternion.premultiply(Yr.invert()));+ 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()));}/*** Adds the given 3D object as a child to this 3D object. An arbitrary number of@@ -5847,7 +5847,7 @@ class Tt extends Ys {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(Yp), Jr.child = e, this.dispatchEvent(Jr), Jr.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($p), $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 Ys {return this;}const t = this.children.indexOf(e);- return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(oy), qh.child = e, this.dispatchEvent(qh), qh.child = null), this;+ return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(x_), Xh.child = e, this.dispatchEvent(Xh), Xh.child = null), this;}/*** Removes this 3D object from its current parent.@@ -5898,7 +5898,7 @@ class Tt extends Ys {* @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(Yp), Jr.child = e, this.dispatchEvent(Jr), Jr.child = null, this;+ 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;}/*** Searches through the 3D object and its children, starting with the 3D object@@ -5968,7 +5968,7 @@ class Tt extends Ys {* @return {Quaternion} The 3D object's rotation in world space.*/getWorldQuaternion(e) {- return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(so, e, ry), e;+ return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(ro, e, g_), e;}/*** Returns a vector representing the scale of the 3D object in world space.@@ -5977,7 +5977,7 @@ class Tt extends Ys {* @return {Vector3} The 3D object's scale in world space.*/getWorldScale(e) {- return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(so, ay, e), e;+ return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(ro, m_, e), e;}/*** Returns a vector representing the ("look") direction of the 3D object in world space.@@ -6201,8 +6201,8 @@ class Tt extends Ys {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(), Kh = /* @__PURE__ */ new G(), Ji = /* @__PURE__ */ new G(), Zr = /* @__PURE__ */ new G(), $r = /* @__PURE__ */ new G(), Jp = /* @__PURE__ */ new G(), jh = /* @__PURE__ */ new G(), Xh = /* @__PURE__ */ new G(), Yh = /* @__PURE__ */ new G(), Jh = /* @__PURE__ */ new mt(), Zh = /* @__PURE__ */ new mt(), $h = /* @__PURE__ */ new mt();-class Si {+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 {/*** Constructs a new triangle.*@@ -6239,8 +6239,8 @@ class Si {* @return {?Vector3} The barycentric coordinates for the given point*/static getBarycoord(e, t, n, s, r) {- xi.subVectors(s, t), Yi.subVectors(n, t), Kh.subVectors(e, t);- const a = xi.dot(xi), o = xi.dot(Yi), c = xi.dot(Kh), l = Yi.dot(Yi), h = Yi.dot(Kh), u = a * l - o * o;+ 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;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;@@ -6289,7 +6289,7 @@ class Si {* @return {Vector3} The interpolated attribute value.*/static getInterpolatedAttribute(e, t, n, s, r, a) {- return Jh.setScalar(0), Zh.setScalar(0), $h.setScalar(0), Jh.fromBufferAttribute(e, t), Zh.fromBufferAttribute(e, n), $h.fromBufferAttribute(e, s), a.setScalar(0), a.addScaledVector(Jh, r.x), a.addScaledVector(Zh, r.y), a.addScaledVector($h, r.z), 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;}/*** Returns `true` if the triangle is oriented towards the given direction.@@ -6379,7 +6379,7 @@ class Si {* @return {Vector3} The triangle's normal.*/getNormal(e) {- return Si.getNormal(this.a, this.b, this.c, e);+ return Ii.getNormal(this.a, this.b, this.c, e);}/*** Computes a plane the triangle lies within.@@ -6399,7 +6399,7 @@ class Si {* @return {?Vector3} The barycentric coordinates for the given point*/getBarycoord(e, t) {- return Si.getBarycoord(e, this.a, this.b, this.c, t);+ return Ii.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 Si {* @return {?Vector3} The interpolated value.*/getInterpolation(e, t, n, s, r) {- return Si.getInterpolation(e, this.a, this.b, this.c, t, n, s, r);+ return Ii.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 Si {* triangle, lies within the triangle or not.*/containsPoint(e) {- return Si.containsPoint(e, this.a, this.b, this.c);+ return Ii.containsPoint(e, this.a, this.b, this.c);}/*** Returns `true` if the triangle is oriented towards the given direction.@@ -6433,7 +6433,7 @@ class Si {* @return {boolean} Whether the triangle is oriented towards the given direction or not.*/isFrontFacing(e) {- return Si.isFrontFacing(this.a, this.b, this.c, e);+ return Ii.isFrontFacing(this.a, this.b, this.c, e);}/*** Returns `true` if this triangle intersects with the given box.@@ -6454,29 +6454,29 @@ class Si {closestPointToPoint(e, t) {const n = this.a, s = this.b, r = this.c;let a, o;- Zr.subVectors(s, n), $r.subVectors(r, n), jh.subVectors(e, n);- const c = Zr.dot(jh), l = $r.dot(jh);+ ea.subVectors(s, n), ta.subVectors(r, n), Jh.subVectors(e, n);+ const c = ea.dot(Jh), l = ta.dot(Jh);if (c <= 0 && l <= 0)return t.copy(n);- Xh.subVectors(e, s);- const h = Zr.dot(Xh), u = $r.dot(Xh);+ Zh.subVectors(e, s);+ const h = ea.dot(Zh), u = ta.dot(Zh);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(Zr, a);- Yh.subVectors(e, r);- const f = Zr.dot(Yh), p = $r.dot(Yh);+ return a = c / (c - h), t.copy(n).addScaledVector(ea, a);+ $h.subVectors(e, r);+ const f = ea.dot($h), p = ta.dot($h);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($r, o);+ 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 Jp.subVectors(r, s), o = (u - h) / (u - h + (f - p)), t.copy(s).addScaledVector(Jp, o);+ return eA.subVectors(r, s), o = (u - h) / (u - h + (f - p)), t.copy(s).addScaledVector(eA, o);const A = 1 / (g + m + d);- return a = m * A, o = d * A, t.copy(n).addScaledVector(Zr, a).addScaledVector($r, o);+ return a = m * A, o = d * A, t.copy(n).addScaledVector(ea, a).addScaledVector(ta, o);}/*** Returns `true` if this triangle is equal with the given one.@@ -6488,7 +6488,7 @@ class Si {return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);}}-const C0 = {+const T0 = {aliceblue: 15792383,antiquewhite: 16444375,aqua: 65535,@@ -6637,8 +6637,8 @@ const C0 = {whitesmoke: 16119285,yellow: 16776960,yellowgreen: 10145074-}, Ms = { h: 0, s: 0, l: 0 }, Rc = { h: 0, s: 0, l: 0 };-function eu(i, e, t) {+}, Ms = { h: 0, s: 0, l: 0 }, Nc = { h: 0, s: 0, l: 0 };+function iu(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 {@@ -6689,7 +6689,7 @@ let Le = class {* @param {string} [colorSpace=SRGBColorSpace] - The color space.* @return {Color} A reference to this color.*/- setHex(e, t = yt) {+ setHex(e, t = _t) {return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, rt.toWorkingColorSpace(this, t), this;}/**@@ -6714,11 +6714,11 @@ let Le = class {* @return {Color} A reference to this color.*/setHSL(e, t, n, s = rt.workingColorSpace) {- if (e = Of(e, 1), t = ot(t, 0, 1), n = ot(n, 0, 1), t === 0)+ if (e = Hf(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 = eu(a, r, e + 1 / 3), this.g = eu(a, r, e), this.b = eu(a, r, e - 1 / 3);+ this.r = iu(a, r, e + 1 / 3), this.g = iu(a, r, e), this.b = iu(a, r, e - 1 / 3);}return rt.toWorkingColorSpace(this, s), this;}@@ -6732,7 +6732,7 @@ let Le = class {* @param {string} [colorSpace=SRGBColorSpace] - The color space.* @return {Color} A reference to this color.*/- setStyle(e, t = yt) {+ setStyle(e, t = _t) {function n(r) {r !== void 0 && parseFloat(r) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored.");}@@ -6800,8 +6800,8 @@ let Le = class {* @param {string} [colorSpace=SRGBColorSpace] - The color space.* @return {Color} A reference to this color.*/- setColorName(e, t = yt) {- const n = C0[e.toLowerCase()];+ setColorName(e, t = _t) {+ const n = T0[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 = wa(e.r), this.g = wa(e.g), this.b = wa(e.b), this;+ return this.r = Ca(e.r), this.g = Ca(e.g), this.b = Ca(e.b), this;}/*** Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`.@@ -6863,7 +6863,7 @@ let Le = class {* @param {string} [colorSpace=SRGBColorSpace] - The color space.* @return {number} The hexadecimal value.*/- getHex(e = yt) {+ getHex(e = _t) {return rt.fromWorkingColorSpace(Fn.copy(this), e), Math.round(ot(Fn.r * 255, 0, 255)) * 65536 + Math.round(ot(Fn.g * 255, 0, 255)) * 256 + Math.round(ot(Fn.b * 255, 0, 255));}/**@@ -6872,7 +6872,7 @@ let Le = class {* @param {string} [colorSpace=SRGBColorSpace] - The color space.* @return {string} The hexadecimal value as a string.*/- getHexString(e = yt) {+ getHexString(e = _t) {return ("000000" + this.getHex(e).toString(16)).slice(-6);}/**@@ -6923,10 +6923,10 @@ let Le = class {* @param {string} [colorSpace=SRGBColorSpace] - The color space.* @return {string} The CSS representation of this color.*/- getStyle(e = yt) {+ getStyle(e = _t) {rt.fromWorkingColorSpace(Fn.copy(this), e);const t = Fn.r, n = Fn.g, s = Fn.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)})`;+ return e !== _t ? `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})` : `rgb(${Math.round(t * 255)},${Math.round(n * 255)},${Math.round(s * 255)})`;}/*** Adds the given HSL values to this color's values.@@ -7033,8 +7033,8 @@ let Le = class {* @return {Color} A reference to this color.*/lerpHSL(e, t) {- this.getHSL(Ms), e.getHSL(Rc);- const n = Ro(Ms.h, Rc.h, t), s = Ro(Ms.s, Rc.s, t), r = Ro(Ms.l, Rc.l, 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);return this.setHSL(n, s, r), this;}/**@@ -7110,14 +7110,14 @@ let Le = class {}};const Fn = /* @__PURE__ */ new Le();-Le.NAMES = C0;-let cy = 0;-class ui extends Ys {+Le.NAMES = T0;+let b_ = 0;+class ui extends Js {/*** Constructs a new material.*/constructor() {- super(), this.isMaterial = !0, Object.defineProperty(this, "id", { value: cy++ }), this.uuid = Mi(), this.name = "", this.type = "Material", this.blending = ya, this.side = bs, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = ad, this.blendDst = od, this.blendEquation = fr, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new Le(0, 0, 0), this.blendAlpha = 0, this.depthFunc = Fa, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = kp, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = Vr, this.stencilZFail = Vr, this.stencilZPass = Vr, 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: 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;}/*** Sets the alpha value to be used when running an alpha test. The material@@ -7216,7 +7216,7 @@ class ui extends Ys {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 !== ya && (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 !== ad && (n.blendSrc = this.blendSrc), this.blendDst !== od && (n.blendDst = this.blendDst), this.blendEquation !== fr && (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 !== Fa && (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 !== kp && (n.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (n.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (n.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== Vr && (n.stencilFail = this.stencilFail), this.stencilZFail !== Vr && (n.stencilZFail = this.stencilZFail), this.stencilZPass !== Vr && (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 !== 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);function s(r) {const a = [];for (const o in r) {@@ -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 = ch, 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 = 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);}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__ */ ly();-function ly() {+const ss = /* @__PURE__ */ E_();+function E_() {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 ly() {offsetTable: o};}-function hy(i) {+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 uy(i) {+function __(i) {const e = i >> 10;return ss.uint32View[0] = ss.mantissaTable[ss.offsetTable[e] + (i & 1023)] + ss.exponentTable[e], ss.floatView[0];}-class Zp {+class tA {/*** Returns a half precision floating point value (FP16) from the given single* precision floating point value (FP32).@@ -7347,7 +7347,7 @@ class Zp {* @return {number} The FP16 value.*/static toHalfFloat(e) {- return hy(e);+ return y_(e);}/*** Returns a single precision floating point value (FP32) from the given half@@ -7357,11 +7357,11 @@ class Zp {* @return {number} The FP32 value.*/static fromHalfFloat(e) {- return uy(e);+ return __(e);}}-const nn = /* @__PURE__ */ new G(), Fc = /* @__PURE__ */ new Ze();-let dy = 0;+const nn = /* @__PURE__ */ new G(), Dc = /* @__PURE__ */ new Ze();+let w_ = 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: dy++ }), this.name = "", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = n, this.usage = Pd, this.updateRanges = [], this.gpuType = fn, this.version = 0;+ 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;}/*** 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++)- Fc.fromBufferAttribute(this, t), Fc.applyMatrix3(e), this.setXY(t, Fc.x, Fc.y);+ Dc.fromBufferAttribute(this, t), Dc.applyMatrix3(e), this.setXY(t, Dc.x, Dc.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);@@ -7681,10 +7681,10 @@ class Bn {array: Array.from(this.array),normalized: this.normalized};- return this.name !== "" && (e.name = this.name), this.usage !== Pd && (e.usage = this.usage), e;+ return this.name !== "" && (e.name = this.name), this.usage !== Od && (e.usage = this.usage), e;}}-class Gf extends Bn {+class Vf extends Bn {/*** Constructs a new buffer attribute.*@@ -7696,7 +7696,7 @@ class Gf extends Bn {super(new Uint16Array(e), t, n);}}-class S0 extends Bn {+class R0 extends Bn {/*** Constructs a new buffer attribute.*@@ -7720,14 +7720,14 @@ class en extends Bn {super(new Float32Array(e), t, n);}}-let fy = 0;-const ii = /* @__PURE__ */ new De(), tu = /* @__PURE__ */ new Tt(), ea = /* @__PURE__ */ new G(), Zn = /* @__PURE__ */ new Hi(), ro = /* @__PURE__ */ new Hi(), _n = /* @__PURE__ */ new G();-class Tn extends Ys {+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();+class Tn extends Js {/*** Constructs a new geometry.*/constructor() {- super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { value: fy++ }), 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: 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 = {};}/*** Returns the index of this geometry.@@ -7744,7 +7744,7 @@ class Tn extends Ys {* @return {BufferGeometry} A reference to this instance.*/setIndex(e) {- return Array.isArray(e) ? this.index = new (_0(e) ? S0 : Gf)(e, 1) : this.index = e, this;+ return Array.isArray(e) ? this.index = new (I0(e) ? R0 : Vf)(e, 1) : this.index = e, this;}/*** Sets the given indirect attribute to this geometry.@@ -7926,7 +7926,7 @@ class Tn extends Ys {* @return {BufferGeometry} A reference to this instance.*/lookAt(e) {- return tu.lookAt(e), tu.updateMatrix(), this.applyMatrix4(tu.matrix), this;+ return su.lookAt(e), su.updateMatrix(), this.applyMatrix4(su.matrix), this;}/*** Center the geometry based on its bounding box.@@ -7934,7 +7934,7 @@ class Tn extends Ys {* @return {BufferGeometry} A reference to this instance.*/center() {- return this.computeBoundingBox(), this.boundingBox.getCenter(ea).negate(), this.translate(ea.x, ea.y, ea.z), this;+ return this.computeBoundingBox(), this.boundingBox.getCenter(na).negate(), this.translate(na.x, na.y, na.z), this;}/*** Defines a geometry by creating a `position` attribute based on the given array of points. The array@@ -7985,7 +7985,7 @@ class Tn extends Ys {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 ? (_n.addVectors(this.boundingBox.min, Zn.min), this.boundingBox.expandByPoint(_n), _n.addVectors(this.boundingBox.max, Zn.max), this.boundingBox.expandByPoint(_n)) : (this.boundingBox.expandByPoint(Zn.min), this.boundingBox.expandByPoint(Zn.max));+ 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));}} elsethis.boundingBox.makeEmpty();@@ -8008,17 +8008,17 @@ class Tn extends Ys {if (Zn.setFromBufferAttribute(e), t)for (let r = 0, a = t.length; r < a; r++) {const o = t[r];- ro.setFromBufferAttribute(o), this.morphTargetsRelative ? (_n.addVectors(Zn.min, ro.min), Zn.expandByPoint(_n), _n.addVectors(Zn.max, ro.max), Zn.expandByPoint(_n)) : (Zn.expandByPoint(ro.min), Zn.expandByPoint(ro.max));+ 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));}Zn.getCenter(n);let s = 0;for (let r = 0, a = e.count; r < a; r++)- _n.fromBufferAttribute(e, r), s = Math.max(s, n.distanceToSquared(_n));+ yn.fromBufferAttribute(e, r), s = Math.max(s, n.distanceToSquared(yn));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++)- _n.fromBufferAttribute(o, l), c && (ea.fromBufferAttribute(e, l), _n.add(ea)), s = Math.max(s, n.distanceToSquared(_n));+ yn.fromBufferAttribute(o, l), c && (na.fromBufferAttribute(e, l), yn.add(na)), s = Math.max(s, n.distanceToSquared(yn));}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);}@@ -8047,13 +8047,13 @@ class Tn extends Ys {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 y = this.groups;- y.length === 0 && (y = [{+ let _ = this.groups;+ _.length === 0 && (_ = [{start: 0,count: e.count}]);- for (let T = 0, C = y.length; T < C; ++T) {- const v = y[T], F = v.start, K = v.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),@@ -8061,18 +8061,18 @@ class Tn extends Ys {e.getX(q + 2));}- const x = new G(), E = new G(), I = new G(), w = new G();- function S(T) {- I.fromBufferAttribute(s, T), w.copy(I);+ 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(I.multiplyScalar(I.dot(C))).normalize(), E.crossVectors(w, C);+ 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 = y.length; T < C; ++T) {- const v = y[T], F = v.start, K = v.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)- S(e.getX(q + 0)), S(e.getX(q + 1)), S(e.getX(q + 2));+ I(e.getX(q + 0)), I(e.getX(q + 1)), I(e.getX(q + 2));}}/**@@ -8109,7 +8109,7 @@ class Tn extends Ys {normalizeNormals() {const e = this.attributes.normal;for (let t = 0, n = e.count; t < n; t++)- _n.fromBufferAttribute(e, t), _n.normalize(), e.setXYZ(t, _n.x, _n.y, _n.z);+ yn.fromBufferAttribute(e, t), yn.normalize(), e.setXYZ(t, yn.x, yn.y, yn.z);}/*** Return a new non-index version of this indexed geometry. If the geometry@@ -8254,7 +8254,7 @@ class Tn extends Ys {this.dispatchEvent({ type: "dispose" });}}-const $p = /* @__PURE__ */ new De(), ir = /* @__PURE__ */ new lc(), Dc = /* @__PURE__ */ new zi(), eA = /* @__PURE__ */ new G(), Nc = /* @__PURE__ */ new G(), Lc = /* @__PURE__ */ new G(), Pc = /* @__PURE__ */ new G(), nu = /* @__PURE__ */ new G(), kc = /* @__PURE__ */ new G(), tA = /* @__PURE__ */ new G(), Uc = /* @__PURE__ */ new G();+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();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) {- kc.set(0, 0, 0);+ Oc.set(0, 0, 0);for (let c = 0, l = r.length; c < l; c++) {const h = o[c], u = r[c];- h !== 0 && (nu.fromBufferAttribute(u, e), a ? kc.addScaledVector(nu, h) : kc.addScaledVector(nu.sub(t), h));+ h !== 0 && (ru.fromBufferAttribute(u, e), a ? Oc.addScaledVector(ru, h) : Oc.addScaledVector(ru.sub(t), h));}- t.add(kc);+ t.add(Oc);}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(), Dc.copy(n.boundingSphere), Dc.applyMatrix4(r), ir.copy(e.ray).recast(e.near), !(Dc.containsPoint(ir.origin) === !1 && (ir.intersectSphere(Dc, eA) === null || ir.origin.distanceToSquared(eA) > (e.far - e.near) ** 2)) && ($p.copy(r).invert(), ir.copy(e.ray).applyMatrix4($p), !(n.boundingBox !== null && ir.intersectsBox(n.boundingBox) === !1) && this._computeIntersections(e, t, ir)));+ 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)));}_computeIntersections(e, t, n) {let s;@@ -8323,54 +8323,54 @@ class Zt extends Tt {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], y = Math.max(g.start, f.start), x = Math.min(o.count, Math.min(g.start + g.count, f.start + f.count));- for (let E = y, I = x; E < I; E += 3) {- const w = o.getX(E), S = o.getX(E + 1), T = o.getX(E + 2);- s = Oc(this, A, e, n, l, h, u, w, S, T), s && (s.faceIndex = Math.floor(E / 3), s.face.materialIndex = g.materialIndex, t.push(s));+ 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));}}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 y = o.getX(g), x = o.getX(g + 1), E = o.getX(g + 2);- s = Oc(this, a, e, n, l, h, u, y, x, E), s && (s.faceIndex = Math.floor(g / 3), t.push(s));+ 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));}}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], y = Math.max(g.start, f.start), x = Math.min(c.count, Math.min(g.start + g.count, f.start + f.count));- for (let E = y, I = x; E < I; E += 3) {- const w = E, S = E + 1, T = E + 2;- s = Oc(this, A, e, n, l, h, u, w, S, T), s && (s.faceIndex = Math.floor(E / 3), s.face.materialIndex = g.materialIndex, t.push(s));+ 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));}}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 y = g, x = g + 1, E = g + 2;- s = Oc(this, a, e, n, l, h, u, y, x, E), s && (s.faceIndex = Math.floor(g / 3), t.push(s));+ 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));}}}}-function py(i, e, t, n, s, r, a, o) {+function C_(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;- Uc.copy(o), Uc.applyMatrix4(i.matrixWorld);- const l = t.ray.origin.distanceTo(Uc);+ Qc.copy(o), Qc.applyMatrix4(i.matrixWorld);+ const l = t.ray.origin.distanceTo(Qc);return l < t.near || l > t.far ? null : {distance: l,- point: Uc.clone(),+ point: Qc.clone(),object: i};}-function Oc(i, e, t, n, s, r, a, o, c, l) {- i.getVertexPosition(o, Nc), i.getVertexPosition(c, Lc), i.getVertexPosition(l, Pc);- const h = py(i, e, t, n, Nc, Lc, Pc, tA);+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);if (h) {const u = new G();- Si.getBarycoord(tA, Nc, Lc, Pc, 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));+ 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));const d = {a: o,b: c,@@ -8378,11 +8378,11 @@ function Oc(i, e, t, n, s, r, a, o, c, l) {normal: new G(),materialIndex: 0};- Si.getNormal(Nc, Lc, Pc, d.normal), h.face = d, h.barycoord = u;+ Ii.getNormal(Pc, kc, Uc, d.normal), h.face = d, h.barycoord = u;}return h;}-class Va extends Tn {+class Wa extends Tn {/*** Constructs a new box geometry.*@@ -8407,21 +8407,21 @@ class Va extends Tn {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 en(l, 3)), this.setAttribute("normal", new en(h, 3)), this.setAttribute("uv", new en(u, 2));- function p(m, g, A, y, x, E, I, w, S, T, C) {- const v = E / S, F = I / T, K = E / 2, q = I / 2, $ = w / 2, N = S + 1, O = T + 1;+ 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 ye = 0; ye < N; ye++) {- const Me = ye * v - K;- J[m] = Me * y, 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(ye / S), u.push(1 - ee / T), Y += 1;+ 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 < S; ae++) {- const ye = d + ae + N * ee, Me = d + ae + N * (ee + 1), se = d + (ae + 1) + N * (ee + 1), me = d + (ae + 1) + N * ee;- c.push(ye, Me, me), c.push(Me, se, me), Q += 6;+ 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;}@@ -8437,10 +8437,10 @@ class Va extends Tn {* @return {BoxGeometry} A new instance.*/static fromJSON(e) {- return new Va(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);+ return new Wa(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);}}-function La(i) {+function Pa(i) {const e = {};for (const t in i) {e[t] = {};@@ -8454,26 +8454,26 @@ function La(i) {function Pn(i) {const e = {};for (let t = 0; t < i.length; t++) {- const n = La(i[t]);+ const n = Pa(i[t]);for (const s in n)e[s] = n[s];}return e;}-function Ay(i) {+function I_(i) {const e = [];for (let t = 0; t < i.length; t++)e.push(i[t].clone());return e;}-function I0(i) {+function F0(i) {const e = i.getRenderTarget();return e === null ? i.outputColorSpace : e.isXRRenderTarget === !0 ? e.texture.colorSpace : rt.workingColorSpace;}-const gy = { clone: La, merge: Pn };-var my = `void main() {+const S_ = { clone: Pa, merge: Pn };+var M_ = `void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );-}`, xy = `void main() {+}`, B_ = `void main() {gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );}`;class qs extends ui {@@ -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 = my, this.fragmentShader = xy, 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 = 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 = {clipCullDistance: !1,// set to use vertex shader clippingmultiDraw: !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 = La(e.uniforms), this.uniformsGroups = Ay(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 = 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;}toJSON(e) {const t = super.toJSON(e);@@ -8538,12 +8538,12 @@ class qs extends ui {return Object.keys(n).length > 0 && (t.extensions = n), t;}}-class M0 extends Tt {+class N0 extends Tt {/*** Constructs a new camera.*/constructor() {- super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new De(), this.projectionMatrix = new De(), this.projectionMatrixInverse = new De(), this.coordinateSystem = ls;+ super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new Ne(), this.projectionMatrix = new Ne(), this.projectionMatrixInverse = new Ne(), this.coordinateSystem = ls;}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;@@ -8570,8 +8570,8 @@ class M0 extends Tt {return new this.constructor().copy(this);}}-const Bs = /* @__PURE__ */ new G(), nA = /* @__PURE__ */ new Ze(), iA = /* @__PURE__ */ new Ze();-class Sn extends M0 {+const Bs = /* @__PURE__ */ new G(), rA = /* @__PURE__ */ new Ze(), aA = /* @__PURE__ */ new Ze();+class In extends N0 {/*** Constructs a new perspective camera.*@@ -8596,7 +8596,7 @@ class Sn extends M0 {*/setFocalLength(e) {const t = 0.5 * this.getFilmHeight() / e;- this.fov = Na * 2 * Math.atan(t), this.updateProjectionMatrix();+ this.fov = La * 2 * Math.atan(t), this.updateProjectionMatrix();}/*** Returns the focal length from the current {@link PerspectiveCamera#fov} and@@ -8605,7 +8605,7 @@ class Sn extends M0 {* @return {number} The computed focal length.*/getFocalLength() {- const e = Math.tan(To * 0.5 * this.fov);+ const e = Math.tan(Fo * 0.5 * this.fov);return 0.5 * this.getFilmHeight() / e;}/**@@ -8614,8 +8614,8 @@ class Sn extends M0 {* @return {number} The effective FOV.*/getEffectiveFOV() {- return Na * 2 * Math.atan(- Math.tan(To * 0.5 * this.fov) / this.zoom+ return La * 2 * Math.atan(+ Math.tan(Fo * 0.5 * this.fov) / this.zoom);}/**@@ -8655,7 +8655,7 @@ class Sn extends M0 {* @returns {Vector2} The view size.*/getViewSize(e, t) {- return this.getViewBounds(e, nA, iA), t.subVectors(iA, nA);+ return this.getViewBounds(e, rA, aA), t.subVectors(aA, rA);}/*** Sets an offset in a larger frustum. This is useful for multi-window or@@ -8723,7 +8723,7 @@ class Sn extends M0 {*/updateProjectionMatrix() {const e = this.near;- let t = e * Math.tan(To * 0.5 * this.fov) / this.zoom, n = 2 * t, s = this.aspect * n, r = -0.5 * s;+ let t = e * Math.tan(Fo * 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;@@ -8737,8 +8737,8 @@ class Sn extends M0 {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 ta = -90, na = 1;-class by extends Tt {+const ia = -90, sa = 1;+class T_ extends Tt {/*** Constructs a new cube camera.*@@ -8748,17 +8748,17 @@ class by extends Tt {*/constructor(e, t, n) {super(), this.type = "CubeCamera", this.renderTarget = n, this.coordinateSystem = null, this.activeMipmapLevel = 0;- const s = new Sn(ta, na, e, t);+ const s = new In(ia, sa, e, t);s.layers = this.layers, this.add(s);- const r = new Sn(ta, na, e, t);+ const r = new In(ia, sa, e, t);r.layers = this.layers, this.add(r);- const a = new Sn(ta, na, e, t);+ const a = new In(ia, sa, e, t);a.layers = this.layers, this.add(a);- const o = new Sn(ta, na, e, t);+ const o = new In(ia, sa, e, t);o.layers = this.layers, this.add(o);- const c = new Sn(ta, na, e, t);+ const c = new In(ia, sa, e, t);c.layers = this.layers, this.add(c);- const l = new Sn(ta, na, e, t);+ const l = new In(ia, sa, e, t);l.layers = this.layers, this.add(l);}/**@@ -8769,7 +8769,7 @@ class by 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 === Hl)+ else if (e === Vl)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);elsethrow new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: " + e);@@ -8793,7 +8793,7 @@ class by 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 B0 extends an {+class D0 extends an {/*** Constructs a new cube texture.*@@ -8808,7 +8808,7 @@ class B0 extends an {* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.* @param {string} [colorSpace=NoColorSpace] - The color space value.*/- constructor(e = [], t = Sr, n, s, r, a, o, c, l, h) {+ constructor(e = [], t = Br, 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;}/**@@ -8823,7 +8823,7 @@ class B0 extends an {this.image = e;}}-class Ey extends Mr {+class R_ extends Rr {/*** Constructs a new cube render target.*@@ -8833,7 +8833,7 @@ class Ey extends Mr {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 B0(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 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;}/*** Converts the given equirectangular texture to a cube map.@@ -8891,9 +8891,9 @@ class Ey extends Mr {}`)- }, s = new Va(5, 5, 5), r = new qs({+ }, s = new Wa(5, 5, 5), r = new qs({name: "CubemapFromEquirect",- uniforms: La(n.uniforms),+ uniforms: Pa(n.uniforms),vertexShader: n.vertexShader,fragmentShader: n.fragmentShader,side: Vn,@@ -8901,7 +8901,7 @@ class Ey extends Mr {});r.uniforms.tEquirect.value = t;const a = new Zt(s, r), o = t.minFilter;- return t.minFilter === hi && (t.minFilter = Xt), new by(1, 10, this).update(e, a), t.minFilter = o, a.geometry.dispose(), a.material.dispose(), this;+ 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;}/*** Clears this cube render target.@@ -8923,8 +8923,8 @@ class hs extends Tt {super(), this.isGroup = !0, this.type = "Group";}}-const _y = { type: "move" };-class iu {+const F_ = { type: "move" };+class au {/*** Constructs a new XR controller.*/@@ -9021,7 +9021,7 @@ class iu {}));} elsec !== 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(_y)));+ 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_)));}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 iu {return e.joints[t.jointName];}}-class kd extends Tt {+class Qd extends Tt {/*** Constructs a new scene.*/@@ -9056,7 +9056,7 @@ class kd 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 yy {+class N_ {/*** Constructs a new interleaved buffer.*@@ -9064,7 +9064,7 @@ class yy {* @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 = Pd, 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 = Od, this.updateRanges = [], this.version = 0, this.uuid = Mi();}/*** A callback function that is executed after the renderer has transferred the attribute array@@ -9179,8 +9179,8 @@ class yy {};}}-const Dn = /* @__PURE__ */ new G();-class Hf {+const Nn = /* @__PURE__ */ new G();+class Wf {/*** Constructs a new interleaved buffer attribute.*@@ -9229,7 +9229,7 @@ class Hf {*/applyMatrix4(e) {for (let t = 0, n = this.data.count; t < n; t++)- Dn.fromBufferAttribute(this, t), Dn.applyMatrix4(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);+ Nn.fromBufferAttribute(this, t), Nn.applyMatrix4(e), this.setXYZ(t, Nn.x, Nn.y, Nn.z);return this;}/**@@ -9241,7 +9241,7 @@ class Hf {*/applyNormalMatrix(e) {for (let t = 0, n = this.count; t < n; t++)- Dn.fromBufferAttribute(this, t), Dn.applyNormalMatrix(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);+ Nn.fromBufferAttribute(this, t), Nn.applyNormalMatrix(e), this.setXYZ(t, Nn.x, Nn.y, Nn.z);return this;}/**@@ -9253,7 +9253,7 @@ class Hf {*/transformDirection(e) {for (let t = 0, n = this.count; t < n; t++)- Dn.fromBufferAttribute(this, t), Dn.transformDirection(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);+ Nn.fromBufferAttribute(this, t), Nn.transformDirection(e), this.setXYZ(t, Nn.x, Nn.y, Nn.z);return this;}/**@@ -9413,7 +9413,7 @@ class Hf {}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 Hf(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 Wf(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);}/*** Serializes the buffer attribute into JSON.@@ -9448,8 +9448,8 @@ class Hf {};}}-const sA = /* @__PURE__ */ new G(), rA = /* @__PURE__ */ new mt(), aA = /* @__PURE__ */ new mt(), wy = /* @__PURE__ */ new G(), oA = /* @__PURE__ */ new De(), Qc = /* @__PURE__ */ new G(), su = /* @__PURE__ */ new zi(), cA = /* @__PURE__ */ new De(), ru = /* @__PURE__ */ new lc();-class T0 extends Zt {+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 {/*** Constructs a new skinned mesh.*@@ -9457,7 +9457,7 @@ class T0 extends Zt {* @param {Material|Array<Material>} [material] - The mesh material.*/constructor(e, t) {- super(e, t), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = Pp, this.bindMatrix = new De(), this.bindMatrixInverse = new De(), this.boundingBox = null, this.boundingSphere = null;+ 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;}/*** Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}.@@ -9470,7 +9470,7 @@ class T0 extends Zt {this.boundingBox === null && (this.boundingBox = new Hi()), this.boundingBox.makeEmpty();const t = e.getAttribute("position");for (let n = 0; n < t.count; n++)- this.getVertexPosition(n, Qc), this.boundingBox.expandByPoint(Qc);+ this.getVertexPosition(n, Hc), this.boundingBox.expandByPoint(Hc);}/*** Computes the bounding sphere of the skinned mesh, and updates {@link SkinnedMesh#boundingSphere}.@@ -9483,14 +9483,14 @@ class T0 extends Zt {this.boundingSphere === null && (this.boundingSphere = new zi()), this.boundingSphere.makeEmpty();const t = e.getAttribute("position");for (let n = 0; n < t.count; n++)- this.getVertexPosition(n, Qc), this.boundingSphere.expandByPoint(Qc);+ this.getVertexPosition(n, Hc), this.boundingSphere.expandByPoint(Hc);}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(), su.copy(this.boundingSphere), su.applyMatrix4(s), e.ray.intersectsSphere(su) !== !1 && (cA.copy(s).invert(), ru.copy(e.ray).applyMatrix4(cA), !(this.boundingBox !== null && ru.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(e, t, ru)));+ 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)));}getVertexPosition(e, t) {return super.getVertexPosition(e, t), this.applyBoneTransform(e, t), t;@@ -9524,7 +9524,7 @@ class T0 extends Zt {}}updateMatrixWorld(e) {- super.updateMatrixWorld(e), this.bindMode === Pp ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === g_ ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode);+ 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);}/*** Applies the bone transform associated with the given index to the given@@ -9537,18 +9537,18 @@ class T0 extends Zt {*/applyBoneTransform(e, t) {const n = this.skeleton, s = this.geometry;- rA.fromBufferAttribute(s.attributes.skinIndex, e), aA.fromBufferAttribute(s.attributes.skinWeight, e), sA.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);+ cA.fromBufferAttribute(s.attributes.skinIndex, e), lA.fromBufferAttribute(s.attributes.skinWeight, e), oA.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);for (let r = 0; r < 4; r++) {- const a = aA.getComponent(r);+ const a = lA.getComponent(r);if (a !== 0) {- const o = rA.getComponent(r);- oA.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(wy.copy(sA).applyMatrix4(oA), a);+ const o = cA.getComponent(r);+ hA.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(D_.copy(oA).applyMatrix4(hA), a);}}return t.applyMatrix4(this.bindMatrixInverse);}}-class zl extends Tt {+class Wl extends Tt {/*** Constructs a new bone.*/@@ -9556,7 +9556,7 @@ class zl extends Tt {super(), this.isBone = !0, this.type = "Bone";}}-class uh extends an {+class fh extends an {/*** Constructs a new data texture.*@@ -9577,8 +9577,8 @@ class uh extends an {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 lA = /* @__PURE__ */ new De(), vy = /* @__PURE__ */ new De();-class dh {+const dA = /* @__PURE__ */ new Ne(), L_ = /* @__PURE__ */ new Ne();+class ph {/*** Constructs a new skeleton.*@@ -9601,7 +9601,7 @@ class dh {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 De());+ this.boneInverses.push(new Ne());}}/**@@ -9611,7 +9611,7 @@ class dh {calculateInverses() {this.boneInverses.length = 0;for (let e = 0, t = this.bones.length; e < t; e++) {- const n = new De();+ const n = new Ne();this.bones[e] && n.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(n);}}@@ -9634,8 +9634,8 @@ class dh {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 : vy;- lA.multiplyMatrices(o, t[r]), lA.toArray(n, r * 16);+ const o = e[r] ? e[r].matrixWorld : L_;+ dA.multiplyMatrices(o, t[r]), dA.toArray(n, r * 16);}s !== null && (s.needsUpdate = !0);}@@ -9645,7 +9645,7 @@ class dh {* @return {Skeleton} A clone of this instance.*/clone() {- return new dh(this.bones, this.boneInverses);+ return new ph(this.bones, this.boneInverses);}/*** Computes a data texture for passing bone data to the vertex shader.@@ -9657,7 +9657,7 @@ class dh {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 uh(t, e, e, pn, fn);+ const n = new fh(t, e, e, pn, fn);return n.needsUpdate = !0, this.boneMatrices = t, this.boneTexture = n, this;}/**@@ -9693,7 +9693,7 @@ class dh {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 zl()), this.bones.push(a), this.boneInverses.push(new De().fromArray(e.boneInverses[n]));+ 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]));}return this.init(), this;}@@ -9724,7 +9724,7 @@ class dh {return e;}}-class Ud extends Bn {+class Gd extends Bn {/*** Constructs a new instanced buffer attribute.*@@ -9744,8 +9744,8 @@ class Ud extends Bn {return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e;}}-const ia = /* @__PURE__ */ new De(), hA = /* @__PURE__ */ new De(), Gc = [], uA = /* @__PURE__ */ new Hi(), Cy = /* @__PURE__ */ new De(), ao = /* @__PURE__ */ new Zt(), oo = /* @__PURE__ */ new zi();-class R0 extends Zt {+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 {/*** Constructs a new instanced mesh.*@@ -9754,9 +9754,9 @@ class R0 extends Zt {* @param {number} count - The number of instances.*/constructor(e, t, n) {- super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new Ud(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 Gd(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, Cy);+ this.setMatrixAt(s, P_);}/*** Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}.@@ -9767,7 +9767,7 @@ class R0 extends Zt {const e = this.geometry, t = this.count;this.boundingBox === null && (this.boundingBox = new Hi()), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty();for (let n = 0; n < t; n++)- this.getMatrixAt(n, ia), uA.copy(e.boundingBox).applyMatrix4(ia), this.boundingBox.union(uA);+ this.getMatrixAt(n, ra), pA.copy(e.boundingBox).applyMatrix4(ra), this.boundingBox.union(pA);}/*** Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere}@@ -9778,7 +9778,7 @@ class R0 extends Zt {const e = this.geometry, t = this.count;this.boundingSphere === null && (this.boundingSphere = new zi()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();for (let n = 0; n < t; n++)- this.getMatrixAt(n, ia), oo.copy(e.boundingSphere).applyMatrix4(ia), this.boundingSphere.union(oo);+ this.getMatrixAt(n, ra), co.copy(e.boundingSphere).applyMatrix4(ra), this.boundingSphere.union(co);}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 R0 extends Zt {}raycast(e, t) {const n = this.matrixWorld, s = this.count;- if (ao.geometry = this.geometry, ao.material = this.material, ao.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), oo.copy(this.boundingSphere), oo.applyMatrix4(n), e.ray.intersectsSphere(oo) !== !1))+ 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))for (let r = 0; r < s; r++) {- this.getMatrixAt(r, ia), hA.multiplyMatrices(n, ia), ao.matrixWorld = hA, ao.raycast(e, Gc);- for (let a = 0, o = Gc.length; a < o; a++) {- const c = Gc[a];+ 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];c.instanceId = r, c.object = this, t.push(c);}- Gc.length = 0;+ zc.length = 0;}}/**@@ -9832,7 +9832,7 @@ class R0 extends Zt {* @param {Color} color - The instance color.*/setColorAt(e, t) {- this.instanceColor === null && (this.instanceColor = new Ud(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3)), t.toArray(this.instanceColor.array, e * 3);+ this.instanceColor === null && (this.instanceColor = new Gd(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 R0 extends Zt {*/setMorphAt(e, t) {const n = t.morphTargetInfluences, s = n.length + 1;- this.morphTexture === null && (this.morphTexture = new uh(new Float32Array(s * this.count), s, this.count, cs, fn));+ this.morphTexture === null && (this.morphTexture = new fh(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 R0 extends Zt {this.dispatchEvent({ type: "dispose" }), this.morphTexture !== null && (this.morphTexture.dispose(), this.morphTexture = null);}}-const au = /* @__PURE__ */ new G(), Sy = /* @__PURE__ */ new G(), Iy = /* @__PURE__ */ new at();+const lu = /* @__PURE__ */ new G(), k_ = /* @__PURE__ */ new G(), U_ = /* @__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 = au.subVectors(n, t).cross(Sy.subVectors(e, t)).normalize();+ const s = lu.subVectors(n, t).cross(k_.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(au), s = this.normal.dot(n);+ const n = e.delta(lu), 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 || Iy.getNormalMatrix(e), s = this.coplanarPoint(au).applyMatrix4(e), r = this.normal.applyMatrix3(n).normalize();+ const n = t || U_.getNormalMatrix(e), s = this.coplanarPoint(lu).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 sr = /* @__PURE__ */ new zi(), Hc = /* @__PURE__ */ new G();-class zf {+const rr = /* @__PURE__ */ new zi(), Vc = /* @__PURE__ */ new G();+class qf {/*** Constructs a new frustum.*@@ -10133,10 +10133,10 @@ class zf {* @return {Frustum} A reference to this frustum.*/setFromProjectionMatrix(e, t = ls) {- 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], y = 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 + y).normalize(), n[3].setComponents(c - a, d - h, g - p, E - y).normalize(), n[4].setComponents(c - o, d - u, g - m, E - x).normalize(), t === ls)+ 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 === Hl)+ else if (t === Vl)n[5].setComponents(o, u, m, x).normalize();elsethrow new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + t);@@ -10152,12 +10152,12 @@ class zf {*/intersectsObject(e) {if (e.boundingSphere !== void 0)- e.boundingSphere === null && e.computeBoundingSphere(), sr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);+ e.boundingSphere === null && e.computeBoundingSphere(), rr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else {const t = e.geometry;- t.boundingSphere === null && t.computeBoundingSphere(), sr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);+ t.boundingSphere === null && t.computeBoundingSphere(), rr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);}- return this.intersectsSphere(sr);+ return this.intersectsSphere(rr);}/*** Returns `true` if the given sprite is intersecting this frustum.@@ -10166,7 +10166,7 @@ class zf {* @return {boolean} Whether the sprite is intersecting this frustum or not.*/intersectsSprite(e) {- return sr.center.set(0, 0, 0), sr.radius = 0.7071067811865476, sr.applyMatrix4(e.matrixWorld), this.intersectsSphere(sr);+ return rr.center.set(0, 0, 0), rr.radius = 0.7071067811865476, rr.applyMatrix4(e.matrixWorld), this.intersectsSphere(rr);}/*** Returns `true` if the given bounding sphere is intersecting this frustum.@@ -10191,7 +10191,7 @@ class zf {const t = this.planes;for (let n = 0; n < 6; n++) {const s = t[n];- if (Hc.x = s.normal.x > 0 ? e.max.x : e.min.x, Hc.y = s.normal.y > 0 ? e.max.y : e.min.y, Hc.z = s.normal.z > 0 ? e.max.z : e.min.z, s.distanceToPoint(Hc) < 0)+ 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)return !1;}return !0;@@ -10218,7 +10218,7 @@ class zf {return new this.constructor().copy(this);}}-class Wa extends ui {+class qa extends ui {/*** Constructs a new line basic material.*@@ -10235,15 +10235,15 @@ class Wa 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 Vl = /* @__PURE__ */ new G(), Wl = /* @__PURE__ */ new G(), dA = /* @__PURE__ */ new De(), co = /* @__PURE__ */ new lc(), zc = /* @__PURE__ */ new zi(), ou = /* @__PURE__ */ new G(), fA = /* @__PURE__ */ new G();-class fh extends Tt {+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 {/*** Constructs a new line.** @param {BufferGeometry} [geometry] - The line geometry.* @param {Material|Array<Material>} [material] - The line material.*/- constructor(e = new Tn(), t = new Wa()) {+ constructor(e = new Tn(), t = new qa()) {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 fh extends Tt {if (e.index === null) {const t = e.attributes.position, n = [0];for (let s = 1, r = t.count; s < r; s++)- Vl.fromBufferAttribute(t, s - 1), Wl.fromBufferAttribute(t, s), n[s] = n[s - 1], n[s] += Vl.distanceTo(Wl);+ ql.fromBufferAttribute(t, s - 1), Kl.fromBufferAttribute(t, s), n[s] = n[s - 1], n[s] += ql.distanceTo(Kl);e.setAttribute("lineDistance", new en(n, 1));} elseconsole.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");@@ -10275,27 +10275,27 @@ class fh 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(), zc.copy(n.boundingSphere), zc.applyMatrix4(s), zc.radius += r, e.ray.intersectsSphere(zc) === !1) return;- dA.copy(s).invert(), co.copy(e.ray).applyMatrix4(dA);+ 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);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), y = h.getX(m + 1), x = Vc(this, e, co, c, A, y, m);+ const A = h.getX(m), _ = h.getX(m + 1), x = qc(this, e, lo, c, A, _, m);x && t.push(x);}if (this.isLineLoop) {- const m = h.getX(p - 1), g = h.getX(f), A = Vc(this, e, co, c, m, g, p - 1);+ const m = h.getX(p - 1), g = h.getX(f), A = qc(this, e, lo, 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 = Vc(this, e, co, c, m, m + 1, m);+ const A = qc(this, e, lo, c, m, m + 1, m);A && t.push(A);}if (this.isLineLoop) {- const m = Vc(this, e, co, c, p - 1, f, p - 1);+ const m = qc(this, e, lo, c, p - 1, f, p - 1);m && t.push(m);}}@@ -10318,17 +10318,17 @@ class fh extends Tt {}}}-function Vc(i, e, t, n, s, r, a) {+function qc(i, e, t, n, s, r, a) {const o = i.geometry.attributes.position;- if (Vl.fromBufferAttribute(o, s), Wl.fromBufferAttribute(o, r), t.distanceSqToSegment(Vl, Wl, ou, fA) > n) return;- ou.applyMatrix4(i.matrixWorld);- const l = e.ray.origin.distanceTo(ou);+ 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 (!(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: fA.clone().applyMatrix4(i.matrixWorld),+ point: gA.clone().applyMatrix4(i.matrixWorld),index: a,face: null,faceIndex: null,@@ -10336,8 +10336,8 @@ function Vc(i, e, t, n, s, r, a) {object: i};}-const pA = /* @__PURE__ */ new G(), AA = /* @__PURE__ */ new G();-class ph extends fh {+const mA = /* @__PURE__ */ new G(), xA = /* @__PURE__ */ new G();+class gh extends Ah {/*** Constructs a new line segments.*@@ -10352,14 +10352,14 @@ class ph extends fh {if (e.index === null) {const t = e.attributes.position, n = [];for (let s = 0, r = t.count; s < r; s += 2)- pA.fromBufferAttribute(t, s), AA.fromBufferAttribute(t, s + 1), n[s] = s === 0 ? 0 : n[s - 1], n[s + 1] = n[s] + pA.distanceTo(AA);+ 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);e.setAttribute("lineDistance", new en(n, 1));} elseconsole.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this;}}-class My extends fh {+class O_ extends Ah {/*** Constructs a new line loop.*@@ -10370,7 +10370,7 @@ class My extends fh {super(e, t), this.isLineLoop = !0, this.type = "LineLoop";}}-class Vf extends ui {+class Kf extends ui {/*** Constructs a new points material.*@@ -10387,15 +10387,15 @@ class Vf 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 gA = /* @__PURE__ */ new De(), Od = /* @__PURE__ */ new lc(), Wc = /* @__PURE__ */ new zi(), qc = /* @__PURE__ */ new G();-class By extends Tt {+const bA = /* @__PURE__ */ new Ne(), Hd = /* @__PURE__ */ new uc(), Kc = /* @__PURE__ */ new zi(), jc = /* @__PURE__ */ new G();+class Q_ 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 Vf()) {+ constructor(e = new Tn(), t = new Kf()) {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 By 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(), Wc.copy(n.boundingSphere), Wc.applyMatrix4(s), Wc.radius += r, e.ray.intersectsSphere(Wc) === !1) return;- gA.copy(s).invert(), Od.copy(e.ray).applyMatrix4(gA);+ 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);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);- qc.fromBufferAttribute(u, g), mA(qc, g, c, s, e, t, this);+ jc.fromBufferAttribute(u, g), EA(jc, 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++)- qc.fromBufferAttribute(u, p), mA(qc, p, c, s, e, t, this);+ jc.fromBufferAttribute(u, p), EA(jc, p, c, s, e, t, this);}}/**@@ -10442,11 +10442,11 @@ class By extends Tt {}}}-function mA(i, e, t, n, s, r, a) {- const o = Od.distanceSqToPoint(i);+function EA(i, e, t, n, s, r, a) {+ const o = Hd.distanceSqToPoint(i);if (o < t) {const c = new G();- Od.closestPointToPoint(i, c), c.applyMatrix4(n);+ Hd.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 mA(i, e, t, n, s, r, a) {});}}-class Ah extends an {+class mh extends an {/*** Constructs a new compressed texture.*@@ -10483,7 +10483,7 @@ class Ah 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 Ty extends Ah {+class G_ extends mh {/*** Constructs a new compressed array texture.*@@ -10517,7 +10517,7 @@ class Ty extends Ah {this.layerUpdates.clear();}}-class Ry extends Ah {+class H_ extends mh {/*** Constructs a new compressed texture.*@@ -10526,10 +10526,10 @@ class Ry extends Ah {* @param {number} [type=UnsignedByteType] - The texture type.*/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;+ super(void 0, e[0].width, e[0].height, t, n, Br), this.isCompressedCubeTexture = !0, this.isCubeTexture = !0, this.image = e;}}-class F0 extends an {+class k0 extends an {/*** Constructs a new depth texture.*@@ -10544,20 +10544,20 @@ class F0 extends an {* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.* @param {number} [format=DepthFormat] - The texture format.*/- constructor(e, t, n = Ir, s, r, a, o = Wn, c = Wn, l, h = Qo) {- if (h !== Qo && h !== Go)+ constructor(e, t, n = Tr, s, r, a, o = Wn, c = Wn, l, h = Ho) {+ if (h !== Ho && h !== zo)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 Qf(Object.assign({}, e.image)), this.compareFunction = e.compareFunction, this;+ return super.copy(e), this.source = new zf(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 Fy {+class z_ {/*** Constructs a new curve.*/@@ -10719,7 +10719,7 @@ class Fy {* @return {{tangents: Array<Vector3>, normals: Array<Vector3>, binormals: Array<Vector3>}} The Frenet Frames.*/computeFrenetFrames(e, t = !1) {- const n = new G(), s = [], r = [], a = [], o = new G(), c = new De();+ const n = new G(), s = [], r = [], a = [], o = new G(), c = new Ne();for (let f = 0; f <= e; f++) {const p = f / e;s[f] = this.getTangentAt(p, new G());@@ -10791,13 +10791,13 @@ class Fy {return this.arcLengthDivisions = e.arcLengthDivisions, this;}}-function Dy(i, e, t = 2) {+function V_(i, e, t = 2) {const n = e && e.length, s = n ? e[0] * t : i.length;- let r = D0(i, 0, s, t, !0);+ let r = U0(i, 0, s, t, !0);const a = [];if (!r || r.next === r.prev) return a;let o, c, l;- if (n && (r = Uy(i, e, r, t)), i.length > 80 * t) {+ if (n && (r = X_(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 Dy(i, e, t = 2) {}l = Math.max(h - o, u - c), l = l !== 0 ? 32767 / l : 0;}- return Ko(r, a, t, o, c, l, 0), a;+ return Xo(r, a, t, o, c, l, 0), a;}-function D0(i, e, t, n, s) {+function U0(i, e, t, n, s) {let r;- if (s === Xy(i, e, t, n) > 0)- for (let a = e; a < t; a += n) r = xA(a / n | 0, i[a], i[a + 1], 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);else- for (let a = t - n; a >= e; a -= n) r = xA(a / n | 0, i[a], i[a + 1], r);- return r && Pa(r, r.next) && (Xo(r), r = r.next), r;+ 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;}-function Br(i, e) {+function Fr(i, e) {if (!i) return i;e || (e = i);let t = i, n;do- if (n = !1, !t.steiner && (Pa(t, t.next) || Wt(t.prev, t, t.next) === 0)) {- if (Xo(t), t = e = t.prev, t === t.next) break;+ 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;n = !0;} elset = t.next;while (n || t !== e);return e;}-function Ko(i, e, t, n, s, r, a) {+function Xo(i, e, t, n, s, r, a) {if (!i) return;- !a && r && zy(i, n, s, r);+ !a && r && ew(i, n, s, r);let o = i;for (; i.prev !== i.next; ) {const c = i.prev, l = i.next;- if (r ? Ly(i, n, s, r) : Ny(i)) {- e.push(c.i, i.i, l.i), Xo(i), i = l.next, o = l.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;continue;}if (i = l, i === o) {- a ? a === 1 ? (i = Py(Br(i), e), Ko(i, e, t, n, s, r, 2)) : a === 2 && ky(i, e, t, n, s, r) : Ko(Br(i), e, t, n, s, r, 1);+ 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);break;}}}-function Ny(i) {+function W_(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 && Eo(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 && _o(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 Ly(i, e, t, n) {+function q_(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 = Qd(f, p, e, t, n), y = Qd(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 = zd(f, p, e, t, n), _ = zd(m, g, e, t, n);let x = i.prevZ, E = i.nextZ;- for (; x && x.z >= A && E && E.z <= y; ) {- if (x.x >= f && x.x <= m && x.y >= p && x.y <= g && x !== s && x !== a && Eo(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 && Eo(o, h, c, u, l, d, E.x, E.y) && Wt(E.prev, E, E.next) >= 0)) return !1;+ 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;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 && Eo(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 && _o(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 <= y; ) {- if (E.x >= f && E.x <= m && E.y >= p && E.y <= g && E !== s && E !== a && Eo(o, h, c, u, l, d, E.x, E.y) && Wt(E.prev, E, E.next) >= 0) return !1;+ 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;E = E.nextZ;}return !0;}-function Py(i, e) {+function K_(i, e) {let t = i;do {const n = t.prev, s = t.next.next;- !Pa(n, s) && L0(n, t, t.next, s) && jo(n, s) && jo(s, n) && (e.push(n.i, t.i, s.i), Xo(t), Xo(t.next), t = i = s), t = t.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;} while (t !== i);- return Br(t);+ return Fr(t);}-function ky(i, e, t, n, s, r) {+function j_(i, e, t, n, s, r) {let a = i;do {let o = a.next.next;for (; o !== a.prev; ) {- if (a.i !== o.i && qy(a, o)) {- let c = P0(a, o);- a = Br(a, a.next), c = Br(c, c.next), Ko(a, e, t, n, s, r, 0), Ko(c, e, t, n, s, r, 0);+ 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);return;}o = o.next;@@ -10898,18 +10898,18 @@ function ky(i, e, t, n, s, r) {a = a.next;} while (a !== i);}-function Uy(i, e, t, n) {+function X_(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 = D0(i, o, c, n, !1);- l === l.next && (l.steiner = !0), s.push(Wy(l));+ 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));}- s.sort(Oy);+ s.sort(Y_);for (let r = 0; r < s.length; r++)- t = Qy(s[r], t);+ t = J_(s[r], t);return t;}-function Oy(i, e) {+function Y_(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 Oy(i, e) {}return t;}-function Qy(i, e) {- const t = Gy(i, e);+function J_(i, e) {+ const t = Z_(i, e);if (!t)return e;- const n = P0(t, i);- return Br(n, n.next), Br(t, t.next);+ const n = G0(t, i);+ return Fr(n, n.next), Fr(t, t.next);}-function Gy(i, e) {+function Z_(i, e) {let t = e;const n = i.x, s = i.y;let r = -1 / 0, a;- if (Pa(i, t)) return t;+ if (ka(i, t)) return t;do {- if (Pa(i, t.next)) return t.next;+ if (ka(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 Gy(i, e) {let h = 1 / 0;t = a;do {- if (n >= t.x && t.x >= c && n !== t.x && N0(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 && O0(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);- jo(t, i) && (u < h || u === h && (t.x > a.x || t.x === a.x && Hy(a, t))) && (a = t, h = u);+ Yo(t, i) && (u < h || u === h && (t.x > a.x || t.x === a.x && $_(a, t))) && (a = t, h = u);}t = t.next;} while (t !== o);return a;}-function Hy(i, e) {+function $_(i, e) {return Wt(i.prev, i, e.prev) < 0 && Wt(e.next, i, i.next) < 0;}-function zy(i, e, t, n) {+function ew(i, e, t, n) {let s = i;do- s.z === 0 && (s.z = Qd(s.x, s.y, e, t, n)), s.prevZ = s.prev, s.nextZ = s.next, s = s.next;+ s.z === 0 && (s.z = zd(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, Vy(s);+ s.prevZ.nextZ = null, s.prevZ = null, tw(s);}-function Vy(i) {+function tw(i) {let e, t = 1;do {let n = i, s;@@ -10981,56 +10981,56 @@ function Vy(i) {} while (e > 1);return i;}-function Qd(i, e, t, n, s) {+function zd(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 Wy(i) {+function nw(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 N0(i, e, t, n, s, r, a, o) {+function O0(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 Eo(i, e, t, n, s, r, a, o) {- return !(i === a && e === o) && N0(i, e, t, n, s, r, a, 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 qy(i, e) {- return i.next.i !== e.i && i.prev.i !== e.i && !Ky(i, e) && // dones't intersect other edges- (jo(i, e) && jo(e, i) && jy(i, e) && // locally visible+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(Wt(i.prev, i, e.prev) || Wt(i, e.prev, e)) || // does not create opposite-facing sectors- Pa(i, e) && Wt(i.prev, i, i.next) > 0 && Wt(e.prev, e, e.next) > 0);+ ka(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 Pa(i, e) {+function ka(i, e) {return i.x === e.x && i.y === e.y;}-function L0(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 && Kc(i, t, e) || r === 0 && Kc(i, n, e) || a === 0 && Kc(t, i, n) || o === 0 && Kc(t, e, n));+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 Kc(i, e, t) {+function Xc(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 jc(i) {+function Yc(i) {return i > 0 ? 1 : i < 0 ? -1 : 0;}-function Ky(i, e) {+function sw(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 && L0(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 && Q0(t, t.next, i, e)) return !0;t = t.next;} while (t !== i);return !1;}-function jo(i, e) {+function Yo(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 jy(i, e) {+function rw(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 jy(i, e) {while (t !== i);return n;}-function P0(i, e) {- const t = Gd(i.i, i.x, i.y), n = Gd(e.i, e.x, e.y), s = i.next, r = e.prev;+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;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 xA(i, e, t, n) {- const s = Gd(i, e, t);+function yA(i, e, t, n) {+ const s = Vd(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 Xo(i) {+function Jo(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 Gd(i, e, t) {+function Vd(i, e, t) {return {i,// vertex index in coordinates array@@ -11068,13 +11068,13 @@ function Gd(i, e, t) {// indicates whether this is a steiner point};}-function Xy(i, e, t, n) {+function aw(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 Yy {+class ow {/*** Triangulates the given shape definition by returning an array of triangles.*@@ -11085,10 +11085,10 @@ class Yy {* representing vertex indices.*/static triangulate(e, t, n = 2) {- return Dy(e, t, n);+ return V_(e, t, n);}}-class Wf {+class jf {/*** Calculate area of a ( 2D ) contour polygon.*@@ -11109,7 +11109,7 @@ class Wf {* @return {boolean} Whether the given contour uses a clockwise winding order or not.*/static isClockWise(e) {- return Wf.area(e) < 0;+ return jf.area(e) < 0;}/*** Triangulates the given shape definition.@@ -11120,26 +11120,26 @@ class Wf {*/static triangulateShape(e, t) {const n = [], s = [], r = [];- bA(e), EA(n, e);+ _A(e), wA(n, e);let a = e.length;- t.forEach(bA);+ t.forEach(_A);for (let c = 0; c < t.length; c++)- s.push(a), a += t[c].length, EA(n, t[c]);- const o = Yy.triangulate(n, s);+ s.push(a), a += t[c].length, wA(n, t[c]);+ const o = ow.triangulate(n, s);for (let c = 0; c < o.length; c += 3)r.push(o.slice(c, c + 3));return r;}}-function bA(i) {+function _A(i) {const e = i.length;e > 2 && i[e - 1].equals(i[0]) && i.pop();}-function EA(i, e) {+function wA(i, e) {for (let t = 0; t < e.length; t++)i.push(e[t].x), i.push(e[t].y);}-class gh extends Tn {+class xh extends Tn {/*** Constructs a new plane geometry.*@@ -11157,16 +11157,16 @@ class gh extends Tn {};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 y = A * d - a;+ const _ = A * d - a;for (let x = 0; x < l; x++) {const E = x * u - r;- p.push(E, -y, 0), m.push(0, 0, 1), g.push(x / o), g.push(1 - A / c);+ 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 y = 0; y < o; y++) {- const x = y + l * A, E = y + l * (A + 1), I = y + 1 + l * (A + 1), w = y + 1 + l * A;- f.push(x, E, w), f.push(E, I, w);+ 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 en(p, 3)), this.setAttribute("normal", new en(m, 3)), this.setAttribute("uv", new en(g, 2));}@@ -11181,10 +11181,10 @@ class gh extends Tn {* @return {PlaneGeometry} A new instance.*/static fromJSON(e) {- return new gh(e.width, e.height, e.widthSegments, e.heightSegments);+ return new xh(e.width, e.height, e.widthSegments, e.heightSegments);}}-class Yo extends ui {+class Zo extends ui {/*** Constructs a new mesh standard material.*@@ -11195,13 +11195,13 @@ class Yo 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 = hh, 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 = 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);}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 Yo {+class Vi extends Zo {/*** Constructs a new mesh physical material.*@@ -11314,7 +11314,7 @@ class Vi extends Yo {}, 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 Xc extends ui {+class Jc extends ui {/*** Constructs a new mesh phong material.*@@ -11325,13 +11325,13 @@ class Xc 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 = hh, 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 = ch, 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 = 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);}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 Jy extends ui {+class cw extends ui {/*** Constructs a new mesh lambert material.*@@ -11342,13 +11342,13 @@ class Jy 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 = hh, 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 = ch, 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 = 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);}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 Zy extends ui {+class lw extends ui {/*** Constructs a new mesh depth material.*@@ -11359,13 +11359,13 @@ class Zy extends ui {* by {@link Color#set}.*/constructor(e) {- super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = E_, 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 = 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);}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 $y extends ui {+class hw extends ui {/*** Constructs a new mesh distance material.*@@ -11382,13 +11382,13 @@ class $y 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 Yc(i, e) {+function Zc(i, e) {return !i || i.constructor === e ? i : typeof e.BYTES_PER_ELEMENT == "number" ? new e(i) : Array.prototype.slice.call(i);}-function ew(i) {+function uw(i) {return ArrayBuffer.isView(i) && !(i instanceof DataView);}-function tw(i) {+function dw(i) {function e(s, r) {return i[s] - i[r];}@@ -11396,7 +11396,7 @@ function tw(i) {for (let s = 0; s !== t; ++s) n[s] = s;return n.sort(e), n;}-function _A(i, e, t) {+function vA(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 _A(i, e, t) {}return s;}-function k0(i, e, t, n) {+function H0(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 k0(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 hc {+class dc {/*** Constructs a new interpolant.*@@ -11534,7 +11534,7 @@ class hc {intervalChanged_() {}}-class nw extends hc {+class fw extends dc {/*** Constructs a new cubic interpolant.*@@ -11545,8 +11545,8 @@ class nw extends hc {*/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: pa,- endingEnd: pa+ endingStart: ga,+ endingEnd: ga};}intervalChanged_(e, t, n) {@@ -11554,10 +11554,10 @@ class nw extends hc {let r = e - 2, a = e + 1, o = s[r], c = s[a];if (o === void 0)switch (this.getSettings_().endingStart) {- case Aa:+ case ma:r = e, o = 2 * t - n;break;- case Ql:+ case Hl:r = s.length - 2, o = t + s[r] - s[r + 1];break;default:@@ -11565,10 +11565,10 @@ class nw extends hc {}if (c === void 0)switch (this.getSettings_().endingEnd) {- case Aa:+ case ma:a = e, c = 2 * n - t;break;- case Ql:+ case Hl:a = 1, c = n + s[1] - s[0];break;default:@@ -11578,13 +11578,13 @@ class nw extends hc {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, y = (1 + d) * g + (-1.5 - 2 * d) * m + (-0.5 + d) * p + 1, x = (-1 - f) * g + (1.5 + f) * m + 0.5 * p, E = f * g - f * m;- for (let I = 0; I !== o; ++I)- r[I] = A * a[h + I] + y * a[l + I] + x * a[c + I] + E * a[u + I];+ 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 + (-0.5 + d) * p + 1, x = (-1 - f) * g + (1.5 + f) * m + 0.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 U0 extends hc {+class z0 extends dc {/*** Constructs a new linear interpolant.*@@ -11603,7 +11603,7 @@ class U0 extends hc {return r;}}-class iw extends hc {+class pw extends dc {/*** Constructs a new discrete interpolant.*@@ -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 = Yc(t, this.TimeBufferType), this.values = Yc(n, this.ValueBufferType), this.setInterpolation(s || this.DefaultInterpolation);+ this.name = e, this.times = Zc(t, this.TimeBufferType), this.values = Zc(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: Yc(e.times, Array),- values: Yc(e.values, Array)+ times: Zc(e.times, Array),+ values: Zc(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 iw(this.times, this.values, this.getValueSize(), e);+ return new pw(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 U0(this.times, this.values, this.getValueSize(), e);+ return new z0(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 nw(this.times, this.values, this.getValueSize(), e);+ return new fw(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 Vo:+ case qo:t = this.InterpolantFactoryMethodDiscrete;break;- case Wo:+ case Ko:t = this.InterpolantFactoryMethodLinear;break;- case kh:+ case Qh:t = this.InterpolantFactoryMethodSmooth;break;}@@ -11724,11 +11724,11 @@ class Bi {getInterpolation() {switch (this.createInterpolant) {case this.InterpolantFactoryMethodDiscrete:- return Vo;+ return qo;case this.InterpolantFactoryMethodLinear:- return Wo;+ return Ko;case this.InterpolantFactoryMethodSmooth:- return kh;+ return Qh;}}/**@@ -11816,7 +11816,7 @@ class Bi {}a = c;}- if (s !== void 0 && ew(s))+ if (s !== void 0 && uw(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() === kh, r = e.length - 1;+ const e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), s = this.getInterpolation() === Qh, r = e.length - 1;let a = 1;for (let o = 1; o < r; ++o) {let c = !1;@@ -11882,8 +11882,8 @@ class Bi {Bi.prototype.ValueTypeName = "";Bi.prototype.TimeBufferType = Float32Array;Bi.prototype.ValueBufferType = Float32Array;-Bi.prototype.DefaultInterpolation = Wo;-class qa extends Bi {+Bi.prototype.DefaultInterpolation = Ko;+class Ka extends Bi {/*** Constructs a new boolean keyframe track.*@@ -11898,12 +11898,12 @@ class qa extends Bi {super(e, t, n);}}-qa.prototype.ValueTypeName = "bool";-qa.prototype.ValueBufferType = Array;-qa.prototype.DefaultInterpolation = Vo;-qa.prototype.InterpolantFactoryMethodLinear = void 0;-qa.prototype.InterpolantFactoryMethodSmooth = void 0;-class O0 extends Bi {+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 {/*** Constructs a new color keyframe track.*@@ -11916,8 +11916,8 @@ class O0 extends Bi {super(e, t, n, s);}}-O0.prototype.ValueTypeName = "color";-class Tr extends Bi {+V0.prototype.ValueTypeName = "color";+class Nr extends Bi {/*** Constructs a new number keyframe track.*@@ -11930,8 +11930,8 @@ class Tr extends Bi {super(e, t, n, s);}}-Tr.prototype.ValueTypeName = "number";-class sw extends hc {+Nr.prototype.ValueTypeName = "number";+class Aw extends dc {/*** Constructs a new SLERP interpolant.*@@ -11971,12 +11971,12 @@ class Ks extends Bi {* @return {QuaternionLinearInterpolant} The new interpolant.*/InterpolantFactoryMethodLinear(e) {- return new sw(this.times, this.values, this.getValueSize(), e);+ return new Aw(this.times, this.values, this.getValueSize(), e);}}Ks.prototype.ValueTypeName = "quaternion";Ks.prototype.InterpolantFactoryMethodSmooth = void 0;-class Ka extends Bi {+class ja extends Bi {/*** Constructs a new string keyframe track.*@@ -11991,12 +11991,12 @@ class Ka extends Bi {super(e, t, n);}}-Ka.prototype.ValueTypeName = "string";-Ka.prototype.ValueBufferType = Array;-Ka.prototype.DefaultInterpolation = Vo;-Ka.prototype.InterpolantFactoryMethodLinear = void 0;-Ka.prototype.InterpolantFactoryMethodSmooth = void 0;-class Rr extends Bi {+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 {/*** Constructs a new vector keyframe track.*@@ -12009,8 +12009,8 @@ class Rr extends Bi {super(e, t, n, s);}}-Rr.prototype.ValueTypeName = "vector";-class ql {+Dr.prototype.ValueTypeName = "vector";+class jl {/*** Constructs a new animation clip.*@@ -12025,7 +12025,7 @@ class ql {* @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 = Uf) {+ 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();}/**@@ -12038,7 +12038,7 @@ class ql {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(aw(n[a]).scale(s));+ t.push(mw(n[a]).scale(s));const r = new this(e.name, e.duration, t, e.blendMode);return r.uuid = e.uuid, r;}@@ -12084,9 +12084,9 @@ class ql {o,(o + 1) % r), l.push(0, 1, 0);- const h = tw(c);- c = _A(c, 1, h), l = _A(l, 1, h), !s && c[0] === 0 && (c.push(r), l.push(l[0])), a.push(- new Tr(+ 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(+ new Nr(".morphTargetInfluences[" + t[o].name + "]",c,l@@ -12159,7 +12159,7 @@ class ql {const n = function(u, d, f, p, m) {if (f.length !== 0) {const g = [], A = [];- k0(f, g, A, p), g.length !== 0 && m.push(new u(d, g, A));+ H0(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;@@ -12176,17 +12176,17 @@ class ql {f[d[p].morphTargets[m]] = -1;for (const m in f) {const g = [], A = [];- for (let y = 0; y !== d[p].morphTargets.length; ++y) {+ 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 Tr(".morphTargetInfluence[" + m + "]", g, A));+ s.push(new Nr(".morphTargetInfluence[" + m + "]", g, A));}c = f.length * a;} else {const f = ".bones[" + t[u].name + "]";n(- Rr,+ Dr,f + ".position",d,"pos",@@ -12198,7 +12198,7 @@ class ql {"rot",s), n(- Rr,+ Dr,f + ".scale",d,"scl",@@ -12275,38 +12275,38 @@ class ql {return this.constructor.toJSON(this);}}-function rw(i) {+function gw(i) {switch (i.toLowerCase()) {case "scalar":case "double":case "float":case "number":case "integer":- return Tr;+ return Nr;case "vector":case "vector2":case "vector3":case "vector4":- return Rr;+ return Dr;case "color":- return O0;+ return V0;case "quaternion":return Ks;case "bool":case "boolean":- return qa;- case "string":return Ka;+ case "string":+ return ja;}throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + i);}-function aw(i) {+function mw(i) {if (i.type === void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");- const e = rw(i.type);+ const e = gw(i.type);if (i.times === void 0) {const t = [], n = [];- k0(i.keys, t, n, "value"), i.times = t, i.values = n;+ H0(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 Q0 {+class W0 {/*** Constructs a new loading manager.*@@ -12403,7 +12403,7 @@ class Q0 {};}}-const ow = /* @__PURE__ */ new Q0();+const xw = /* @__PURE__ */ new W0();class fi {/*** Constructs a new loader.@@ -12411,7 +12411,7 @@ class fi {* @param {LoadingManager} [manager] - The loading manager.*/constructor(e) {- this.manager = e !== void 0 ? e : ow, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};+ this.manager = e !== void 0 ? e : xw, 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@@ -12498,7 +12498,7 @@ class fi {}fi.DEFAULT_MATERIAL_NAME = "__DEFAULT";const Zi = {};-class cw extends Error {+class bw extends Error {constructor(e, t) {super(e), this.response = t;}@@ -12554,19 +12554,19 @@ class As extends fi {let m = 0;const g = new ReadableStream({start(A) {- y();- function y() {+ _();+ function _() {u.read().then(({ done: x, value: E }) => {if (x)A.close();else {m += E.byteLength;- const I = new ProgressEvent("progress", { lengthComputable: p, loaded: m, total: f });- for (let w = 0, S = h.length; w < S; w++) {+ 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(I);+ T.onProgress && T.onProgress(S);}- A.enqueue(E), y();+ A.enqueue(E), _();}}, (x) => {A.error(x);@@ -12576,7 +12576,7 @@ class As extends fi {});return new Response(g);} else- throw new cw(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l);+ throw new bw(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l);}).then((l) => {switch (c) {case "arraybuffer":@@ -12636,7 +12636,7 @@ class As extends fi {return this.mimeType = e, this;}}-class lw extends fi {+class Ew extends fi {/*** Constructs a new image loader.*@@ -12664,7 +12664,7 @@ class lw extends fi {return r.manager.itemStart(e), setTimeout(function() {t && t(a), r.manager.itemEnd(e);}, 0), a;- const o = qo("img");+ const o = jo("img");function c() {h(), us.add(e, this), t && t(this), r.manager.itemEnd(e);}@@ -12677,7 +12677,7 @@ class lw 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 hw extends fi {+class yw extends fi {/*** Constructs a new data texture loader.*@@ -12699,7 +12699,7 @@ class hw extends fi {* @return {DataTexture} The data texture.*/load(e, t, n, s) {- const r = this, a = new uh(), o = new As(this.manager);+ const r = this, a = new fh(), 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 {@@ -12716,7 +12716,7 @@ class hw extends fi {}, n, s), a;}}-class G0 extends fi {+class q0 extends fi {/*** Constructs a new texture loader.*@@ -12738,13 +12738,13 @@ class G0 extends fi {* @return {Texture} The texture.*/load(e, t, n, s) {- const r = new an(), a = new lw(this.manager);+ const r = new an(), a = new Ew(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 uc extends Tt {+class fc extends Tt {/*** Constructs a new light.*@@ -12768,7 +12768,7 @@ class uc 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 uw extends uc {+class _w extends fc {/*** Constructs a new hemisphere light.*@@ -12783,15 +12783,15 @@ class uw extends uc {return super.copy(e, t), this.groundColor.copy(e.groundColor), this;}}-const cu = /* @__PURE__ */ new De(), yA = /* @__PURE__ */ new G(), wA = /* @__PURE__ */ new G();-class qf {+const uu = /* @__PURE__ */ new Ne(), CA = /* @__PURE__ */ new G(), IA = /* @__PURE__ */ new G();+class Xf {/*** 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 De(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new zf(), 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 qf(), this._frameExtents = new Ze(1, 1), this._viewportCount = 1, this._viewports = [new mt(0, 0, 1, 1)];}@@ -12819,7 +12819,7 @@ class qf {*/updateMatrices(e) {const t = this.camera, n = this.matrix;- yA.setFromMatrixPosition(e.matrixWorld), t.position.copy(yA), wA.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(wA), t.updateMatrixWorld(), cu.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(cu), n.set(+ 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(0.5,0,0,@@ -12836,7 +12836,7 @@ class qf {0,0,1- ), n.multiply(cu);+ ), n.multiply(uu);}/*** Returns a viewport definition for the given viewport index.@@ -12890,22 +12890,22 @@ class qf {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 qf {+class ww extends Xf {/*** Constructs a new spot light shadow.*/constructor() {- super(new Sn(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1;+ super(new In(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1;}updateMatrices(e) {- const t = this.camera, n = Na * 2 * e.angle * this.focus, s = this.mapSize.width / this.mapSize.height, r = e.distance || t.far;+ const t = this.camera, n = La * 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 H0 extends uc {+class K0 extends fc {/*** Constructs a new spot light.*@@ -12917,7 +12917,7 @@ class H0 extends uc {* @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 dw();+ 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();}/*** The light's power. Power is the luminous power of the light measured in lumens (lm).@@ -12938,13 +12938,13 @@ class H0 extends uc {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 vA = /* @__PURE__ */ new De(), lo = /* @__PURE__ */ new G(), lu = /* @__PURE__ */ new G();-class fw extends qf {+const SA = /* @__PURE__ */ new Ne(), ho = /* @__PURE__ */ new G(), du = /* @__PURE__ */ new G();+class vw extends Xf {/*** Constructs a new point light shadow.*/constructor() {- super(new Sn(90, 1, 0.5, 500)), this.isPointLightShadow = !0, this._frameExtents = new Ze(4, 2), this._viewportCount = 6, this._viewports = [+ super(new In(90, 1, 0.5, 500)), this.isPointLightShadow = !0, this._frameExtents = new Ze(4, 2), this._viewportCount = 6, this._viewports = [// These viewports map a cube-map onto a 2D texture with the// following orientation://@@ -12993,10 +12993,10 @@ class fw extends qf {*/updateMatrices(e, t = 0) {const n = this.camera, s = this.matrix, r = e.distance || n.far;- r !== n.far && (n.far = r, n.updateProjectionMatrix()), lo.setFromMatrixPosition(e.matrixWorld), n.position.copy(lo), lu.copy(n.position), lu.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(lu), n.updateMatrixWorld(), s.makeTranslation(-lo.x, -lo.y, -lo.z), vA.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(vA);+ 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);}}-class Kl extends uc {+class Xl extends fc {/*** Constructs a new point light.*@@ -13006,7 +13006,7 @@ class Kl extends uc {* @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 fw();+ super(e, t), this.isPointLight = !0, this.type = "PointLight", this.distance = n, this.decay = s, this.shadow = new vw();}/*** The light's power. Power is the luminous power of the light measured in lumens (lm).@@ -13027,7 +13027,7 @@ class Kl extends uc {return super.copy(e, t), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this;}}-class Kf extends M0 {+class Yf extends N0 {/*** Constructs a new orthographic camera.*@@ -13091,15 +13091,15 @@ class Kf extends M0 {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 qf {+class Cw extends Xf {/*** Constructs a new directional light shadow.*/constructor() {- super(new Kf(-5, 5, 5, -5, 0.5, 500)), this.isDirectionalLightShadow = !0;+ super(new Yf(-5, 5, 5, -5, 0.5, 500)), this.isDirectionalLightShadow = !0;}}-class jf extends uc {+class Jf extends fc {/*** Constructs a new directional light.*@@ -13107,7 +13107,7 @@ class jf extends uc {* @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 pw();+ 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();}dispose() {this.shadow.dispose();@@ -13116,7 +13116,7 @@ class jf extends uc {return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;}}-class z0 extends uc {+class j0 extends fc {/*** Constructs a new ambient light.*@@ -13127,7 +13127,7 @@ class z0 extends uc {super(e, t), this.isAmbientLight = !0, this.type = "AmbientLight";}}-class wr {+class Cr {/*** Extracts the base URL from the given URL.*@@ -13151,7 +13151,7 @@ class wr {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 Aw extends fi {+class Iw extends fi {/*** Constructs a new image bitmap loader.*@@ -13209,7 +13209,7 @@ class Aw extends fi {us.add(e, c), r.manager.itemStart(e);}}-class gw extends Sn {+class Sw extends In {/*** Constructs a new array camera.*@@ -13219,7 +13219,7 @@ class gw extends Sn {super(), this.isArrayCamera = !0, this.isMultiViewCamera = !1, this.cameras = e;}}-class mw {+class Mw {/*** Constructs a new property mixer.*@@ -13354,12 +13354,12 @@ class mw {}}}-const Xf = "\\[\\]\\.:\\/", xw = new RegExp("[" + Xf + "]", "g"), Yf = "[^" + Xf + "]", bw = "[^" + Xf.replace("\\.", "") + "]", Ew = /* @__PURE__ */ /((?:WC+[\/:])*)/.source.replace("WC", Yf), _w = /* @__PURE__ */ /(WCOD+)?/.source.replace("WCOD", bw), yw = /* @__PURE__ */ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Yf), ww = /* @__PURE__ */ /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Yf), vw = new RegExp(- "^" + Ew + _w + yw + ww + "$"-), Cw = ["material", "materials", "bones", "map"];-class Sw {+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 {constructor(e, t, n) {- const s = n || _t.parseTrackName(t);+ const s = n || yt.parseTrackName(t);this._targetGroup = e, this._bindings = e.subscribe_(t, s);}getValue(e, t) {@@ -13383,7 +13383,7 @@ class Sw {e[t].unbind();}}-class _t {+class yt {/*** Constructs a new property binding.*@@ -13392,7 +13392,7 @@ class _t {* @param {?Object} [parsedPath] - The parsed path.*/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;+ this.path = t, this.parsedPath = n || yt.parseTrackName(t), this.node = yt.findNode(e, this.parsedPath.nodeName), this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;}/*** Factory method for creating a property binding from the given parameters.@@ -13404,7 +13404,7 @@ class _t {* @return {PropertyBinding|Composite} The created property binding or composite.*/static create(e, t, n) {- return e && e.isAnimationObjectGroup ? new _t.Composite(e, t, n) : new _t(e, t, n);+ return e && e.isAnimationObjectGroup ? new yt.Composite(e, t, n) : new yt(e, t, n);}/*** Replaces spaces with underscores and removes unsupported characters from@@ -13414,7 +13414,7 @@ class _t {* @return {string} The sanitized node name.*/static sanitizeNodeName(e) {- return e.replace(/\s/g, "_").replace(xw, "");+ return e.replace(/\s/g, "_").replace(Bw, "");}/*** Parses the given track name (an object path to an animated property) and@@ -13435,7 +13435,7 @@ class _t {* @return {Object} The parsed track name as an object.*/static parseTrackName(e) {- const t = vw.exec(e);+ const t = Lw.exec(e);if (t === null)throw new Error("PropertyBinding: Cannot parse trackName: " + e);const n = {@@ -13449,7 +13449,7 @@ class _t {}, s = n.nodeName && n.nodeName.lastIndexOf(".");if (s !== void 0 && s !== -1) {const r = n.nodeName.substring(s + 1);- Cw.indexOf(r) !== -1 && (n.nodeName = n.nodeName.substring(0, s), n.objectName = r);+ Pw.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);@@ -13569,7 +13569,7 @@ class _t {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) {+ if (e || (e = yt.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;}@@ -13661,51 +13661,51 @@ class _t {this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;}}-_t.Composite = Sw;-_t.prototype.BindingType = {+yt.Composite = kw;+yt.prototype.BindingType = {Direct: 0,EntireArray: 1,ArrayElement: 2,HasFromToArray: 3};-_t.prototype.Versioning = {+yt.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+yt.prototype.GetterByBindingType = [+ yt.prototype._getValue_direct,+ yt.prototype._getValue_array,+ yt.prototype._getValue_arrayElement,+ yt.prototype._getValue_toArray];-_t.prototype.SetterByBindingTypeAndVersioning = [+yt.prototype.SetterByBindingTypeAndVersioning = [[// Direct- _t.prototype._setValue_direct,- _t.prototype._setValue_direct_setNeedsUpdate,- _t.prototype._setValue_direct_setMatrixWorldNeedsUpdate+ yt.prototype._setValue_direct,+ yt.prototype._setValue_direct_setNeedsUpdate,+ yt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[// EntireArray- _t.prototype._setValue_array,- _t.prototype._setValue_array_setNeedsUpdate,- _t.prototype._setValue_array_setMatrixWorldNeedsUpdate+ yt.prototype._setValue_array,+ yt.prototype._setValue_array_setNeedsUpdate,+ yt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[// ArrayElement- _t.prototype._setValue_arrayElement,- _t.prototype._setValue_arrayElement_setNeedsUpdate,- _t.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate+ yt.prototype._setValue_arrayElement,+ yt.prototype._setValue_arrayElement_setNeedsUpdate,+ yt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[// HasToFromArray- _t.prototype._setValue_fromArray,- _t.prototype._setValue_fromArray_setNeedsUpdate,- _t.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate+ yt.prototype._setValue_fromArray,+ yt.prototype._setValue_fromArray_setNeedsUpdate,+ yt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];-class Iw {+class Uw {/*** Constructs a new animation action.*@@ -13717,14 +13717,14 @@ class Iw {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: pa,- endingEnd: pa+ endingStart: ga,+ endingEnd: ga};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 = x0, 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 = 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;}/*** Starts the playback of the animation.@@ -13975,11 +13975,11 @@ class Iw {if (o > 0) {const c = this._interpolants, l = this._propertyBindings;switch (this.blendMode) {- case x_:+ case By:for (let h = 0, u = c.length; h !== u; ++h)c[h].evaluate(a), l[h].accumulateAdditive(o);break;- case Uf:+ case Gf: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 Iw {_updateTime(e) {const t = this._clip.duration, n = this.loop;let s = this.time + e, r = this._loopCount;- const a = n === m_;+ const a = n === My;if (e === 0)return r === -1 ? s : a && (r & 1) === 1 ? t - s : s;- if (n === m0) {+ if (n === _0) {r === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1));e: {if (s >= t)@@ -14065,7 +14065,7 @@ class Iw {}_setEndings(e, t, n) {const s = this._interpolantSettings;- n ? (s.endingStart = Aa, s.endingEnd = Aa) : (e ? s.endingStart = this.zeroSlopeAtStart ? Aa : pa : s.endingStart = Ql, t ? s.endingEnd = this.zeroSlopeAtEnd ? Aa : pa : s.endingEnd = Ql);+ 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);}_scheduleFading(e, t, n) {const s = this._mixer, r = s.time;@@ -14075,8 +14075,8 @@ class Iw {return o[0] = r, c[0] = t, o[1] = r + e, c[1] = n, this;}}-const Mw = new Float32Array(1);-class V0 extends Ys {+const Ow = new Float32Array(1);+class X0 extends Js {/*** Constructs a new animation mixer.*@@ -14100,8 +14100,8 @@ class V0 extends Ys {continue;}const m = t && t._propertyBindings[u].binding.parsedPath;- p = new mw(- _t.create(n, f, m),+ p = new Mw(+ yt.create(n, f, m),d.ValueTypeName,d.getValueSize()), ++p.referenceCount, this._addInactiveBinding(p, c, f), a[u] = p;@@ -14231,11 +14231,11 @@ class V0 extends Ys {_lendControlInterpolant() {const e = this._controlInterpolants, t = this._nActiveControlInterpolants++;let n = e[t];- return n === void 0 && (n = new U0(+ return n === void 0 && (n = new z0(new Float32Array(2),new Float32Array(2),1,- Mw+ Ow), n.__cacheIndex = t, e[t] = n), n;}_takeBackControlInterpolant(e) {@@ -14256,17 +14256,17 @@ class V0 extends Ys {*/clipAction(e, t, n) {const s = t || this._root, r = s.uuid;- let a = typeof e == "string" ? ql.findByName(s, e) : e;+ let a = typeof e == "string" ? jl.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 = Uf), c !== void 0) {+ if (n === void 0 && (a !== null ? n = a.blendMode : n = Gf), 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 Iw(this, a, t, n);+ const h = new Uw(this, a, t, n);return this._bindAction(h, l), this._addInactiveAction(h, o, r), h;}/**@@ -14277,7 +14277,7 @@ class V0 extends Ys {* @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" ? ql.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" ? jl.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 V0 extends Ys {n !== null && (this._deactivateAction(n), this._removeInactiveAction(n));}}-class CA {+class MA {/*** Constructs a new spherical.*@@ -14456,8 +14456,8 @@ class CA {return new this.constructor().copy(this);}}-const Ts = /* @__PURE__ */ new G(), Jc = /* @__PURE__ */ new De(), hu = /* @__PURE__ */ new De();-class Bw extends ph {+const Ts = /* @__PURE__ */ new G(), $c = /* @__PURE__ */ new Ne(), fu = /* @__PURE__ */ new Ne();+class Qw extends gh {/*** Constructs a new hemisphere light helper.*@@ -14465,21 +14465,21 @@ class Bw extends ph {* can be used if it represents a hierarchy of bones (see {@link Bone}).*/constructor(e) {- const t = W0(e), n = new Tn(), s = [], r = [], a = new Le(0, 0, 1), o = new Le(0, 1, 0);+ const t = Y0(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 Wa({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 });+ const c = new qa({ 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");- hu.copy(this.root.matrixWorld).invert();+ fu.copy(this.root.matrixWorld).invert();for (let r = 0, a = 0; r < t.length; r++) {const o = t[r];- o.parent && o.parent.isBone && (Jc.multiplyMatrices(hu, o.matrixWorld), Ts.setFromMatrixPosition(Jc), s.setXYZ(a, Ts.x, Ts.y, Ts.z), Jc.multiplyMatrices(hu, o.parent.matrixWorld), Ts.setFromMatrixPosition(Jc), s.setXYZ(a + 1, Ts.x, Ts.y, Ts.z), a += 2);+ 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);}n.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e);}@@ -14491,14 +14491,14 @@ class Bw extends ph {this.geometry.dispose(), this.material.dispose();}}-function W0(i) {+function Y0(i) {const e = [];i.isBone === !0 && e.push(i);for (let t = 0; t < i.children.length; t++)- e.push(...W0(i.children[t]));+ e.push(...Y0(i.children[t]));return e;}-class Tw extends ph {+class Gw extends gh {/*** Constructs a new grid helper.*@@ -14517,7 +14517,7 @@ class Tw extends ph {}const h = new Tn();h.setAttribute("position", new en(c, 3)), h.setAttribute("color", new en(l, 3));- const u = new Wa({ vertexColors: !0, toneMapped: !1 });+ const u = new qa({ vertexColors: !0, toneMapped: !1 });super(h, u), this.type = "GridHelper";}/**@@ -14528,7 +14528,7 @@ class Tw extends ph {this.geometry.dispose(), this.material.dispose();}}-class SA extends ph {+class BA extends gh {/*** Constructs a new axes helper.*@@ -14575,7 +14575,7 @@ class SA extends ph {1], s = new Tn();s.setAttribute("position", new en(t, 3)), s.setAttribute("color", new en(n, 3));- const r = new Wa({ vertexColors: !0, toneMapped: !1 });+ const r = new qa({ vertexColors: !0, toneMapped: !1 });super(s, r), this.type = "AxesHelper";}/**@@ -14598,7 +14598,7 @@ class SA extends ph {this.geometry.dispose(), this.material.dispose();}}-class Rw extends Ys {+class Hw extends Js {/*** Constructs a new controls instance.*@@ -14641,109 +14641,109 @@ class Rw extends Ys {update() {}}-function IA(i, e, t, n) {- const s = Fw(n);+function TA(i, e, t, n) {+ const s = zw(n);switch (t) {// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml- case p0:+ case b0:return i * e;case cs:return i * e / s.components * s.byteLength;- case Lf:+ case Uf:return i * e / s.components * s.byteLength;- case xr:+ case Er:return i * e * 2 / s.components * s.byteLength;- case Pf:+ case Of:return i * e * 2 / s.components * s.byteLength;- case A0:+ case E0:return i * e * 3 / s.components * s.byteLength;case pn:return i * e * 4 / s.components * s.byteLength;- case kf:+ case Qf:return i * e * 4 / s.components * s.byteLength;// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/- case wl:- case Io:+ case Cl:+ case Bo:return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;- case vl:- case Mo:+ case Il:+ case To:return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/- case md:- case xd:+ case Ed:+ case yd:return Math.max(i, 16) * Math.max(e, 8) / 4;- case Nl:- case Ll:- return Math.max(i, 8) * Math.max(e, 8) / 2;- // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/case Pl:case kl:- 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 Ul:+ case Ol:+ return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;+ case Ql:return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/- case Ho:+ case Vo:return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;- case bd:+ case _d:return Math.floor((i + 4) / 5) * Math.floor((e + 3) / 4) * 16;- case Ed:+ case wd:return Math.floor((i + 4) / 5) * Math.floor((e + 4) / 5) * 16;- case _d:+ case vd:return Math.floor((i + 5) / 6) * Math.floor((e + 4) / 5) * 16;- case zo:+ case Wo:return Math.floor((i + 5) / 6) * Math.floor((e + 5) / 6) * 16;- case yd:+ case Cd:return Math.floor((i + 7) / 8) * Math.floor((e + 4) / 5) * 16;- case wd:+ case Id:return Math.floor((i + 7) / 8) * Math.floor((e + 5) / 6) * 16;- case vd:+ case Sd:return Math.floor((i + 7) / 8) * Math.floor((e + 7) / 8) * 16;- case Cd:+ case Md:return Math.floor((i + 9) / 10) * Math.floor((e + 4) / 5) * 16;- case Sd:+ case Bd:return Math.floor((i + 9) / 10) * Math.floor((e + 5) / 6) * 16;- case Id:+ case Td:return Math.floor((i + 9) / 10) * Math.floor((e + 7) / 8) * 16;- case Md:+ case Rd:return Math.floor((i + 9) / 10) * Math.floor((e + 9) / 10) * 16;- case Bd:+ case Fd:return Math.floor((i + 11) / 12) * Math.floor((e + 9) / 10) * 16;- case Td:+ case Nd:return Math.floor((i + 11) / 12) * Math.floor((e + 11) / 12) * 16;// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/- case Bo:- case Rd:- case Ol:+ case Ro:+ case Dd:+ case Gl:return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/- case g0:- case Fd:+ case y0:+ case Ld:return Math.ceil(i / 4) * Math.ceil(e / 4) * 8;- case Dd:- case Nd:+ case Pd:+ case kd:return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;}throw new Error(`Unable to determine texture byte length for ${t} format.`);}-function Fw(i) {+function zw(i) {switch (i) {case un:- case u0:+ case g0:return { byteLength: 1, components: 1 };- case Uo:- case d0:+ case Qo:+ case m0:case Qn:return { byteLength: 2, components: 1 };- case Df:- case Nf:+ case Pf:+ case kf:return { byteLength: 2, components: 4 };- case Ir:- case Ff:+ case Tr:+ case Lf:case fn:return { byteLength: 4, components: 1 };- case f0:+ case x0:return { byteLength: 4, components: 3 };}throw new Error(`Unknown texture type ${i}.`);@@ -14752,7 +14752,7 @@ typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvrevision: "176"} }));typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "176");-function q0() {+function J0() {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 q0() {}};}-function Dw(i) {+function Vw(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 Dw(i) {update: a};}-var Nw = `#ifdef USE_ALPHAHASH+var Ww = `#ifdef USE_ALPHAHASHif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;-#endif`, Lw = `#ifdef USE_ALPHAHASH+#endif`, qw = `#ifdef USE_ALPHAHASHconst 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 Nw = `#ifdef USE_ALPHAHASH: cases.z;return clamp( threshold , 1.0e-6, 1.0 );}-#endif`, Pw = `#ifdef USE_ALPHAMAP+#endif`, Kw = `#ifdef USE_ALPHAMAPdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;-#endif`, kw = `#ifdef USE_ALPHAMAP+#endif`, jw = `#ifdef USE_ALPHAMAPuniform sampler2D alphaMap;-#endif`, Uw = `#ifdef USE_ALPHATEST+#endif`, Xw = `#ifdef USE_ALPHATEST#ifdef ALPHA_TO_COVERAGEdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );if ( diffuseColor.a == 0.0 ) discard;#elseif ( diffuseColor.a < alphaTest ) discard;#endif-#endif`, Ow = `#ifdef USE_ALPHATEST+#endif`, Yw = `#ifdef USE_ALPHATESTuniform float alphaTest;-#endif`, Qw = `#ifdef USE_AOMAP+#endif`, Jw = `#ifdef USE_AOMAPfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;reflectedLight.indirectDiffuse *= ambientOcclusion;#if defined( USE_CLEARCOAT )@@ -14930,10 +14930,10 @@ var Nw = `#ifdef USE_ALPHAHASHfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );#endif-#endif`, Gw = `#ifdef USE_AOMAP+#endif`, Zw = `#ifdef USE_AOMAPuniform sampler2D aoMap;uniform float aoMapIntensity;-#endif`, Hw = `#ifdef USE_BATCHING+#endif`, $w = `#ifdef USE_BATCHING#if ! defined( GL_ANGLE_multi_draw )#define gl_DrawID _gl_DrawIDuniform int _gl_DrawID;@@ -14967,15 +14967,15 @@ var Nw = `#ifdef USE_ALPHAHASHint y = j / size;return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;}-#endif`, zw = `#ifdef USE_BATCHING+#endif`, ev = `#ifdef USE_BATCHINGmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );-#endif`, Vw = `vec3 transformed = vec3( position );+#endif`, tv = `vec3 transformed = vec3( position );#ifdef USE_ALPHAHASHvPosition = vec3( position );-#endif`, Ww = `vec3 objectNormal = vec3( normal );+#endif`, nv = `vec3 objectNormal = vec3( normal );#ifdef USE_TANGENTvec3 objectTangent = vec3( tangent.xyz );-#endif`, qw = `float G_BlinnPhong_Implicit( ) {+#endif`, iv = `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 vefloat G = G_BlinnPhong_Implicit( );float D = D_BlinnPhong( shininess, dotNH );return F * ( G * D );-} // validated`, Kw = `#ifdef USE_IRIDESCENCE+} // validated`, sv = `#ifdef USE_IRIDESCENCEconst 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`, jw = `#ifdef USE_BUMPMAP+#endif`, rv = `#ifdef USE_BUMPMAPuniform 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 vevec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );return normalize( abs( fDet ) * surf_norm - vGrad );}-#endif`, Xw = `#if NUM_CLIPPING_PLANES > 0+#endif`, av = `#if NUM_CLIPPING_PLANES > 0vec4 plane;#ifdef ALPHA_TO_COVERAGEfloat distanceToPlane, distanceGradient;@@ -15119,26 +15119,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in veif ( clipped ) discard;#endif#endif-#endif`, Yw = `#if NUM_CLIPPING_PLANES > 0+#endif`, ov = `#if NUM_CLIPPING_PLANES > 0varying vec3 vClipPosition;uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];-#endif`, Jw = `#if NUM_CLIPPING_PLANES > 0+#endif`, cv = `#if NUM_CLIPPING_PLANES > 0varying vec3 vClipPosition;-#endif`, Zw = `#if NUM_CLIPPING_PLANES > 0+#endif`, lv = `#if NUM_CLIPPING_PLANES > 0vClipPosition = - mvPosition.xyz;-#endif`, $w = `#if defined( USE_COLOR_ALPHA )+#endif`, hv = `#if defined( USE_COLOR_ALPHA )diffuseColor *= vColor;#elif defined( USE_COLOR )diffuseColor.rgb *= vColor;-#endif`, ev = `#if defined( USE_COLOR_ALPHA )+#endif`, uv = `#if defined( USE_COLOR_ALPHA )varying vec4 vColor;#elif defined( USE_COLOR )varying vec3 vColor;-#endif`, tv = `#if defined( USE_COLOR_ALPHA )+#endif`, dv = `#if defined( USE_COLOR_ALPHA )varying vec4 vColor;#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )varying vec3 vColor;-#endif`, nv = `#if defined( USE_COLOR_ALPHA )+#endif`, fv = `#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_COLORvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );vColor.xyz *= batchingColor.xyz;-#endif`, iv = `#define PI 3.141592653589793+#endif`, pv = `#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`, sv = `#ifdef ENVMAP_TYPE_CUBE_UV+} // validated`, Av = `#ifdef ENVMAP_TYPE_CUBE_UV#define cubeUV_minMipLevel 4.0#define cubeUV_minTileSize 16.0float 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`, rv = `vec3 transformedNormal = objectNormal;+#endif`, gv = `vec3 transformedNormal = objectNormal;#ifdef USE_TANGENTvec3 transformedTangent = objectTangent;#endif@@ -15348,21 +15348,21 @@ transformedNormal = normalMatrix * transformedNormal;#ifdef FLIP_SIDEDtransformedTangent = - transformedTangent;#endif-#endif`, av = `#ifdef USE_DISPLACEMENTMAP+#endif`, mv = `#ifdef USE_DISPLACEMENTMAPuniform sampler2D displacementMap;uniform float displacementScale;uniform float displacementBias;-#endif`, ov = `#ifdef USE_DISPLACEMENTMAP+#endif`, xv = `#ifdef USE_DISPLACEMENTMAPtransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );-#endif`, cv = `#ifdef USE_EMISSIVEMAP+#endif`, bv = `#ifdef USE_EMISSIVEMAPvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );#ifdef DECODE_VIDEO_TEXTURE_EMISSIVEemissiveColor = sRGBTransferEOTF( emissiveColor );#endiftotalEmissiveRadiance *= emissiveColor.rgb;-#endif`, lv = `#ifdef USE_EMISSIVEMAP+#endif`, Ev = `#ifdef USE_EMISSIVEMAPuniform sampler2D emissiveMap;-#endif`, hv = "gl_FragColor = linearToOutputTexel( gl_FragColor );", uv = `vec4 LinearTransferOETF( in vec4 value ) {+#endif`, yv = "gl_FragColor = linearToOutputTexel( gl_FragColor );", _v = `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 );-}`, dv = `#ifdef USE_ENVMAP+}`, wv = `#ifdef USE_ENVMAP#ifdef ENV_WORLDPOSvec3 cameraToFrag;if ( isOrthographic ) {@@ -15399,7 +15399,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {#elif defined( ENVMAP_BLENDING_ADD )outgoingLight += envColor.xyz * specularStrength * reflectivity;#endif-#endif`, fv = `#ifdef USE_ENVMAP+#endif`, vv = `#ifdef USE_ENVMAPuniform float envMapIntensity;uniform float flipEnvMap;uniform mat3 envMapRotation;@@ -15409,7 +15409,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {uniform sampler2D envMap;#endif-#endif`, pv = `#ifdef USE_ENVMAP+#endif`, Cv = `#ifdef USE_ENVMAPuniform 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 ) {#elsevarying vec3 vReflect;#endif-#endif`, Av = `#ifdef USE_ENVMAP+#endif`, Iv = `#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`, gv = `#ifdef USE_ENVMAP+#endif`, Sv = `#ifdef USE_ENVMAP#ifdef ENV_WORLDPOSvWorldPosition = worldPosition.xyz;#else@@ -15448,18 +15448,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {vReflect = refract( cameraToVertex, worldNormal, refractionRatio );#endif#endif-#endif`, mv = `#ifdef USE_FOG+#endif`, Mv = `#ifdef USE_FOGvFogDepth = - mvPosition.z;-#endif`, xv = `#ifdef USE_FOG+#endif`, Bv = `#ifdef USE_FOGvarying float vFogDepth;-#endif`, bv = `#ifdef USE_FOG+#endif`, Tv = `#ifdef USE_FOG#ifdef FOG_EXP2float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );#elsefloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );#endifgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );-#endif`, Ev = `#ifdef USE_FOG+#endif`, Rv = `#ifdef USE_FOGuniform 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`, _v = `#ifdef USE_GRADIENTMAP+#endif`, Fv = `#ifdef USE_GRADIENTMAPuniform sampler2D gradientMap;#endifvec3 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-}`, yv = `#ifdef USE_LIGHTMAP+}`, Nv = `#ifdef USE_LIGHTMAPuniform sampler2D lightMap;uniform float lightMapIntensity;-#endif`, wv = `LambertMaterial material;+#endif`, Dv = `LambertMaterial material;material.diffuseColor = diffuseColor.rgb;-material.specularStrength = specularStrength;`, vv = `varying vec3 vViewPosition;+material.specularStrength = specularStrength;`, Lv = `varying vec3 vViewPosition;struct LambertMaterial {vec3 diffuseColor;float specularStrength;@@ -15499,7 +15499,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometrreflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );}#define RE_Direct RE_Direct_Lambert-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, Cv = `uniform bool receiveShadow;+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, Pv = `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 penumbraCosivec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );return irradiance;}-#endif`, Sv = `#ifdef USE_ENVMAP+#endif`, kv = `#ifdef USE_ENVMAPvec3 getIBLIrradiance( const in vec3 normal ) {#ifdef ENVMAP_TYPE_CUBE_UVvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );@@ -15648,8 +15648,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi#endif}#endif-#endif`, Iv = `ToonMaterial material;-material.diffuseColor = diffuseColor.rgb;`, Mv = `varying vec3 vViewPosition;+#endif`, Uv = `ToonMaterial material;+material.diffuseColor = diffuseColor.rgb;`, Ov = `varying vec3 vViewPosition;struct ToonMaterial {vec3 diffuseColor;};@@ -15661,11 +15661,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPoreflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );}#define RE_Direct RE_Direct_Toon-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, Bv = `BlinnPhongMaterial material;+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, Qv = `BlinnPhongMaterial material;material.diffuseColor = diffuseColor.rgb;material.specularColor = specular;material.specularShininess = shininess;-material.specularStrength = specularStrength;`, Tv = `varying vec3 vViewPosition;+material.specularStrength = specularStrength;`, Gv = `varying vec3 vViewPosition;struct BlinnPhongMaterial {vec3 diffuseColor;vec3 specularColor;@@ -15682,7 +15682,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geomreflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );}#define RE_Direct RE_Direct_BlinnPhong-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, Rv = `PhysicalMaterial material;+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, Hv = `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`, Fv = `struct PhysicalMaterial {+#endif`, zv = `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_Physicalfloat 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 );-}`, Dv = `+}`, Vv = `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`, Nv = `#if defined( RE_IndirectDiffuse )+#endif`, Wv = `#if defined( RE_IndirectDiffuse )#ifdef USE_LIGHTMAPvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;@@ -16203,32 +16203,32 @@ IncidentLight directLight;#ifdef USE_CLEARCOATclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );#endif-#endif`, Lv = `#if defined( RE_IndirectDiffuse )+#endif`, qv = `#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`, Pv = `#if defined( USE_LOGDEPTHBUF )+#endif`, Kv = `#if defined( USE_LOGDEPTHBUF )gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;-#endif`, kv = `#if defined( USE_LOGDEPTHBUF )+#endif`, jv = `#if defined( USE_LOGDEPTHBUF )uniform float logDepthBufFC;varying float vFragDepth;varying float vIsPerspective;-#endif`, Uv = `#ifdef USE_LOGDEPTHBUF+#endif`, Xv = `#ifdef USE_LOGDEPTHBUFvarying float vFragDepth;varying float vIsPerspective;-#endif`, Ov = `#ifdef USE_LOGDEPTHBUF+#endif`, Yv = `#ifdef USE_LOGDEPTHBUFvFragDepth = 1.0 + gl_Position.w;vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );-#endif`, Qv = `#ifdef USE_MAP+#endif`, Jv = `#ifdef USE_MAPvec4 sampledDiffuseColor = texture2D( map, vMapUv );#ifdef DECODE_VIDEO_TEXTUREsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );#endifdiffuseColor *= sampledDiffuseColor;-#endif`, Gv = `#ifdef USE_MAP+#endif`, Zv = `#ifdef USE_MAPuniform sampler2D map;-#endif`, Hv = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )+#endif`, $v = `#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_ALPHAMAPdiffuseColor.a *= texture2D( alphaMap, uv ).g;-#endif`, zv = `#if defined( USE_POINTS_UV )+#endif`, eC = `#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_ALPHAMAPuniform sampler2D alphaMap;-#endif`, Vv = `float metalnessFactor = metalness;+#endif`, tC = `float metalnessFactor = metalness;#ifdef USE_METALNESSMAPvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );metalnessFactor *= texelMetalness.b;-#endif`, Wv = `#ifdef USE_METALNESSMAP+#endif`, nC = `#ifdef USE_METALNESSMAPuniform sampler2D metalnessMap;-#endif`, qv = `#ifdef USE_INSTANCING_MORPH+#endif`, iC = `#ifdef USE_INSTANCING_MORPHfloat 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`, Kv = `#if defined( USE_MORPHCOLORS )+#endif`, sC = `#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`, jv = `#ifdef USE_MORPHNORMALS+#endif`, rC = `#ifdef USE_MORPHNORMALSobjectNormal *= morphTargetBaseInfluence;for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];}-#endif`, Xv = `#ifdef USE_MORPHTARGETS+#endif`, aC = `#ifdef USE_MORPHTARGETS#ifndef USE_INSTANCING_MORPHuniform 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`, Yv = `#ifdef USE_MORPHTARGETS+#endif`, oC = `#ifdef USE_MORPHTARGETStransformed *= morphTargetBaseInfluence;for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];}-#endif`, Jv = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;+#endif`, cC = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;#ifdef FLAT_SHADEDvec3 fdx = dFdx( vViewPosition );vec3 fdy = dFdy( vViewPosition );@@ -16338,7 +16338,7 @@ IncidentLight directLight;tbn2[1] *= faceDirection;#endif#endif-vec3 nonPerturbedNormal = normal;`, Zv = `#ifdef USE_NORMALMAP_OBJECTSPACE+vec3 nonPerturbedNormal = normal;`, lC = `#ifdef USE_NORMALMAP_OBJECTSPACEnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;#ifdef FLIP_SIDEDnormal = - normal;@@ -16353,25 +16353,25 @@ vec3 nonPerturbedNormal = normal;`, Zv = `#ifdef USE_NORMALMAP_OBJECTSPACEnormal = normalize( tbn * mapN );#elif defined( USE_BUMPMAP )normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );-#endif`, $v = `#ifndef FLAT_SHADED+#endif`, hC = `#ifndef FLAT_SHADEDvarying vec3 vNormal;#ifdef USE_TANGENTvarying vec3 vTangent;varying vec3 vBitangent;#endif-#endif`, eC = `#ifndef FLAT_SHADED+#endif`, uC = `#ifndef FLAT_SHADEDvarying vec3 vNormal;#ifdef USE_TANGENTvarying vec3 vTangent;varying vec3 vBitangent;#endif-#endif`, tC = `#ifndef FLAT_SHADED+#endif`, dC = `#ifndef FLAT_SHADEDvNormal = normalize( transformedNormal );#ifdef USE_TANGENTvTangent = normalize( transformedTangent );vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );#endif-#endif`, nC = `#ifdef USE_NORMALMAP+#endif`, fC = `#ifdef USE_NORMALMAPuniform sampler2D normalMap;uniform vec2 normalScale;#endif@@ -16393,13 +16393,13 @@ vec3 nonPerturbedNormal = normal;`, Zv = `#ifdef USE_NORMALMAP_OBJECTSPACEfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );return mat3( T * scale, B * scale, N );}-#endif`, iC = `#ifdef USE_CLEARCOAT+#endif`, pC = `#ifdef USE_CLEARCOATvec3 clearcoatNormal = nonPerturbedNormal;-#endif`, sC = `#ifdef USE_CLEARCOAT_NORMALMAP+#endif`, AC = `#ifdef USE_CLEARCOAT_NORMALMAPvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;clearcoatMapN.xy *= clearcoatNormalScale;clearcoatNormal = normalize( tbn2 * clearcoatMapN );-#endif`, rC = `#ifdef USE_CLEARCOATMAP+#endif`, gC = `#ifdef USE_CLEARCOATMAPuniform sampler2D clearcoatMap;#endif#ifdef USE_CLEARCOAT_NORMALMAP@@ -16408,18 +16408,18 @@ vec3 nonPerturbedNormal = normal;`, Zv = `#ifdef USE_NORMALMAP_OBJECTSPACE#endif#ifdef USE_CLEARCOAT_ROUGHNESSMAPuniform sampler2D clearcoatRoughnessMap;-#endif`, aC = `#ifdef USE_IRIDESCENCEMAP+#endif`, mC = `#ifdef USE_IRIDESCENCEMAPuniform sampler2D iridescenceMap;#endif#ifdef USE_IRIDESCENCE_THICKNESSMAPuniform sampler2D iridescenceThicknessMap;-#endif`, oC = `#ifdef OPAQUE+#endif`, xC = `#ifdef OPAQUEdiffuseColor.a = 1.0;#endif#ifdef USE_TRANSMISSIONdiffuseColor.a *= material.transmissionAlpha;#endif-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, cC = `vec3 packNormalToRGB( const in vec3 normal ) {+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, bC = `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 );-}`, lC = `#ifdef PREMULTIPLIED_ALPHA+}`, EC = `#ifdef PREMULTIPLIED_ALPHAgl_FragColor.rgb *= gl_FragColor.a;-#endif`, hC = `vec4 mvPosition = vec4( transformed, 1.0 );+#endif`, yC = `vec4 mvPosition = vec4( transformed, 1.0 );#ifdef USE_BATCHINGmvPosition = batchingMatrix * mvPosition;#endif@@ -16498,22 +16498,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, constmvPosition = instanceMatrix * mvPosition;#endifmvPosition = modelViewMatrix * mvPosition;-gl_Position = projectionMatrix * mvPosition;`, uC = `#ifdef DITHERING+gl_Position = projectionMatrix * mvPosition;`, _C = `#ifdef DITHERINGgl_FragColor.rgb = dithering( gl_FragColor.rgb );-#endif`, dC = `#ifdef DITHERING+#endif`, wC = `#ifdef DITHERINGvec3 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`, fC = `float roughnessFactor = roughness;+#endif`, vC = `float roughnessFactor = roughness;#ifdef USE_ROUGHNESSMAPvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );roughnessFactor *= texelRoughness.g;-#endif`, pC = `#ifdef USE_ROUGHNESSMAP+#endif`, CC = `#ifdef USE_ROUGHNESSMAPuniform sampler2D roughnessMap;-#endif`, AC = `#if NUM_SPOT_LIGHT_COORDS > 0+#endif`, IC = `#if NUM_SPOT_LIGHT_COORDS > 0varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];#endif#if NUM_SPOT_LIGHT_MAPS > 0@@ -16699,7 +16699,7 @@ gl_Position = projectionMatrix * mvPosition;`, uC = `#ifdef DITHERING}return mix( 1.0, shadow, shadowIntensity );}-#endif`, gC = `#if NUM_SPOT_LIGHT_COORDS > 0+#endif`, SC = `#if NUM_SPOT_LIGHT_COORDS > 0uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];#endif@@ -16740,7 +16740,7 @@ gl_Position = projectionMatrix * mvPosition;`, uC = `#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`, MC = `#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;`, uC = `#ifdef DITHERINGvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;}#pragma unroll_loop_end-#endif`, xC = `float getShadowMask() {+#endif`, BC = `float getShadowMask() {float shadow = 1.0;#ifdef USE_SHADOWMAP#if NUM_DIR_LIGHT_SHADOWS > 0@@ -16804,12 +16804,12 @@ gl_Position = projectionMatrix * mvPosition;`, uC = `#ifdef DITHERING#endif#endifreturn shadow;-}`, bC = `#ifdef USE_SKINNING+}`, TC = `#ifdef USE_SKINNINGmat4 boneMatX = getBoneMatrix( skinIndex.x );mat4 boneMatY = getBoneMatrix( skinIndex.y );mat4 boneMatZ = getBoneMatrix( skinIndex.z );mat4 boneMatW = getBoneMatrix( skinIndex.w );-#endif`, EC = `#ifdef USE_SKINNING+#endif`, RC = `#ifdef USE_SKINNINGuniform mat4 bindMatrix;uniform mat4 bindMatrixInverse;uniform highp sampler2D boneTexture;@@ -16824,7 +16824,7 @@ gl_Position = projectionMatrix * mvPosition;`, uC = `#ifdef DITHERINGvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );return mat4( v1, v2, v3, v4 );}-#endif`, _C = `#ifdef USE_SKINNING+#endif`, FC = `#ifdef USE_SKINNINGvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );vec4 skinned = vec4( 0.0 );skinned += boneMatX * skinVertex * skinWeight.x;@@ -16832,7 +16832,7 @@ gl_Position = projectionMatrix * mvPosition;`, uC = `#ifdef DITHERINGskinned += boneMatZ * skinVertex * skinWeight.z;skinned += boneMatW * skinVertex * skinWeight.w;transformed = ( bindMatrixInverse * skinned ).xyz;-#endif`, yC = `#ifdef USE_SKINNING+#endif`, NC = `#ifdef USE_SKINNINGmat4 skinMatrix = mat4( 0.0 );skinMatrix += skinWeight.x * boneMatX;skinMatrix += skinWeight.y * boneMatY;@@ -16843,17 +16843,17 @@ gl_Position = projectionMatrix * mvPosition;`, uC = `#ifdef DITHERING#ifdef USE_TANGENTobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;#endif-#endif`, wC = `float specularStrength;+#endif`, DC = `float specularStrength;#ifdef USE_SPECULARMAPvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );specularStrength = texelSpecular.r;#elsespecularStrength = 1.0;-#endif`, vC = `#ifdef USE_SPECULARMAP+#endif`, LC = `#ifdef USE_SPECULARMAPuniform sampler2D specularMap;-#endif`, CC = `#if defined( TONE_MAPPING )+#endif`, PC = `#if defined( TONE_MAPPING )gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );-#endif`, SC = `#ifndef saturate+#endif`, kC = `#ifndef saturate#define saturate( a ) clamp( a, 0.0, 1.0 )#endifuniform 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; }`, IC = `#ifdef USE_TRANSMISSION+vec3 CustomToneMapping( vec3 color ) { return color; }`, UC = `#ifdef USE_TRANSMISSIONmaterial.transmission = transmission;material.transmissionAlpha = 1.0;material.thickness = thickness;@@ -16971,7 +16971,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, IC = `#ifdef USE_TRANSMmaterial.attenuationColor, material.attenuationDistance );material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );-#endif`, MC = `#ifdef USE_TRANSMISSION+#endif`, OC = `#ifdef USE_TRANSMISSIONuniform float transmission;uniform float thickness;uniform float attenuationDistance;@@ -17097,7 +17097,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, IC = `#ifdef USE_TRANSMfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );}-#endif`, BC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )+#endif`, QC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )varying vec2 vUv;#endif#ifdef USE_MAP@@ -17167,7 +17167,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, IC = `#ifdef USE_TRANSM#ifdef USE_THICKNESSMAPuniform mat3 thicknessMapTransform;varying vec2 vThicknessMapUv;-#endif`, TC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )+#endif`, GC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )varying vec2 vUv;#endif#ifdef USE_MAP@@ -17261,7 +17261,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, IC = `#ifdef USE_TRANSM#ifdef USE_THICKNESSMAPuniform mat3 thicknessMapTransform;varying vec2 vThicknessMapUv;-#endif`, RC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )+#endif`, HC = `#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; }`, IC = `#ifdef USE_TRANSM#endif#ifdef USE_THICKNESSMAPvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;-#endif`, FC = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0+#endif`, zC = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0vec4 worldPosition = vec4( transformed, 1.0 );#ifdef USE_BATCHINGworldPosition = batchingMatrix * worldPosition;@@ -17342,12 +17342,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, IC = `#ifdef USE_TRANSM#endifworldPosition = modelMatrix * worldPosition;#endif`;-const DC = `varying vec2 vUv;+const VC = `varying vec2 vUv;uniform mat3 uvTransform;void main() {vUv = ( uvTransform * vec3( uv, 1 ) ).xy;gl_Position = vec4( position.xy, 1.0, 1.0 );-}`, NC = `uniform sampler2D t2D;+}`, WC = `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>-}`, LC = `varying vec3 vWorldDirection;+}`, qC = `varying vec3 vWorldDirection;#include <common>void main() {vWorldDirection = transformDirection( position, modelMatrix );#include <begin_vertex>#include <project_vertex>gl_Position.z = gl_Position.w;-}`, PC = `#ifdef ENVMAP_TYPE_CUBE+}`, KC = `#ifdef ENVMAP_TYPE_CUBEuniform 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>-}`, kC = `varying vec3 vWorldDirection;+}`, jC = `varying vec3 vWorldDirection;#include <common>void main() {vWorldDirection = transformDirection( position, modelMatrix );#include <begin_vertex>#include <project_vertex>gl_Position.z = gl_Position.w;-}`, UC = `uniform samplerCube tCube;+}`, XC = `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>-}`, OC = `#include <common>+}`, YC = `#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;-}`, QC = `#if DEPTH_PACKING == 3200+}`, JC = `#if DEPTH_PACKING == 3200uniform float opacity;#endif#include <common>@@ -17467,7 +17467,7 @@ void main() {#elif DEPTH_PACKING == 3203gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );#endif-}`, GC = `#define DISTANCE+}`, ZC = `#define DISTANCEvarying vec3 vWorldPosition;#include <common>#include <batching_pars_vertex>@@ -17494,7 +17494,7 @@ void main() {#include <worldpos_vertex>#include <clipping_planes_vertex>vWorldPosition = worldPosition.xyz;-}`, HC = `#define DISTANCE+}`, $C = `#define DISTANCEuniform 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 );-}`, zC = `varying vec3 vWorldDirection;+}`, eI = `varying vec3 vWorldDirection;#include <common>void main() {vWorldDirection = transformDirection( position, modelMatrix );#include <begin_vertex>#include <project_vertex>-}`, VC = `uniform sampler2D tEquirect;+}`, tI = `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>-}`, WC = `uniform float scale;+}`, nI = `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>-}`, qC = `uniform vec3 diffuse;+}`, iI = `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>-}`, KC = `#include <common>+}`, sI = `#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>-}`, jC = `uniform vec3 diffuse;+}`, rI = `uniform vec3 diffuse;uniform float opacity;#ifndef FLAT_SHADEDvarying vec3 vNormal;@@ -17663,7 +17663,7 @@ void main() {#include <fog_fragment>#include <premultiplied_alpha_fragment>#include <dithering_fragment>-}`, XC = `#define LAMBERT+}`, aI = `#define LAMBERTvarying vec3 vViewPosition;#include <common>#include <batching_pars_vertex>@@ -17702,7 +17702,7 @@ void main() {#include <envmap_vertex>#include <shadowmap_vertex>#include <fog_vertex>-}`, YC = `#define LAMBERT+}`, oI = `#define LAMBERTuniform vec3 diffuse;uniform vec3 emissive;uniform float opacity;@@ -17759,7 +17759,7 @@ void main() {#include <fog_fragment>#include <premultiplied_alpha_fragment>#include <dithering_fragment>-}`, JC = `#define MATCAP+}`, cI = `#define MATCAPvarying vec3 vViewPosition;#include <common>#include <batching_pars_vertex>@@ -17793,7 +17793,7 @@ void main() {#include <clipping_planes_vertex>#include <fog_vertex>vViewPosition = - mvPosition.xyz;-}`, ZC = `#define MATCAP+}`, lI = `#define MATCAPuniform vec3 diffuse;uniform float opacity;uniform sampler2D matcap;@@ -17839,7 +17839,7 @@ void main() {#include <fog_fragment>#include <premultiplied_alpha_fragment>#include <dithering_fragment>-}`, $C = `#define NORMAL+}`, hI = `#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-}`, eS = `#define NORMAL+}`, uI = `#define NORMALuniform float opacity;#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )varying vec3 vViewPosition;@@ -17894,7 +17894,7 @@ void main() {#ifdef OPAQUEgl_FragColor.a = 1.0;#endif-}`, tS = `#define PHONG+}`, dI = `#define PHONGvarying vec3 vViewPosition;#include <common>#include <batching_pars_vertex>@@ -17933,7 +17933,7 @@ void main() {#include <envmap_vertex>#include <shadowmap_vertex>#include <fog_vertex>-}`, nS = `#define PHONG+}`, fI = `#define PHONGuniform vec3 diffuse;uniform vec3 emissive;uniform vec3 specular;@@ -17992,7 +17992,7 @@ void main() {#include <fog_fragment>#include <premultiplied_alpha_fragment>#include <dithering_fragment>-}`, iS = `#define STANDARD+}`, pI = `#define STANDARDvarying vec3 vViewPosition;#ifdef USE_TRANSMISSIONvarying vec3 vWorldPosition;@@ -18035,7 +18035,7 @@ void main() {#ifdef USE_TRANSMISSIONvWorldPosition = worldPosition.xyz;#endif-}`, sS = `#define STANDARD+}`, AI = `#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>-}`, rS = `#define TOON+}`, gI = `#define TOONvarying vec3 vViewPosition;#include <common>#include <batching_pars_vertex>@@ -18197,7 +18197,7 @@ void main() {#include <worldpos_vertex>#include <shadowmap_vertex>#include <fog_vertex>-}`, aS = `#define TOON+}`, mI = `#define TOONuniform vec3 diffuse;uniform vec3 emissive;uniform float opacity;@@ -18250,7 +18250,7 @@ void main() {#include <fog_fragment>#include <premultiplied_alpha_fragment>#include <dithering_fragment>-}`, oS = `uniform float size;+}`, xI = `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>-}`, cS = `uniform vec3 diffuse;+}`, bI = `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>-}`, lS = `#include <common>+}`, EI = `#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>-}`, hS = `uniform vec3 color;+}`, yI = `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>-}`, uS = `uniform float rotation;+}`, _I = `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>-}`, dS = `uniform vec3 diffuse;+}`, wI = `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: Nw,- alphahash_pars_fragment: Lw,- alphamap_fragment: Pw,- alphamap_pars_fragment: kw,- alphatest_fragment: Uw,- alphatest_pars_fragment: Ow,- aomap_fragment: Qw,- aomap_pars_fragment: Gw,- batching_pars_vertex: Hw,- batching_vertex: zw,- begin_vertex: Vw,- beginnormal_vertex: Ww,- bsdfs: qw,- iridescence_fragment: Kw,- bumpmap_pars_fragment: jw,- clipping_planes_fragment: Xw,- clipping_planes_pars_fragment: Yw,- clipping_planes_pars_vertex: Jw,- clipping_planes_vertex: Zw,- color_fragment: $w,- color_pars_fragment: ev,- color_pars_vertex: tv,- color_vertex: nv,- common: iv,- cube_uv_reflection_fragment: sv,- defaultnormal_vertex: rv,- displacementmap_pars_vertex: av,- displacementmap_vertex: ov,- emissivemap_fragment: cv,- emissivemap_pars_fragment: lv,- colorspace_fragment: hv,- colorspace_pars_fragment: uv,- envmap_fragment: dv,- envmap_common_pars_fragment: fv,- envmap_pars_fragment: pv,- envmap_pars_vertex: Av,- envmap_physical_pars_fragment: Sv,- envmap_vertex: gv,- fog_vertex: mv,- fog_pars_vertex: xv,- fog_fragment: bv,- fog_pars_fragment: Ev,- gradientmap_pars_fragment: _v,- lightmap_pars_fragment: yv,- lights_lambert_fragment: wv,- lights_lambert_pars_fragment: vv,- lights_pars_begin: Cv,- lights_toon_fragment: Iv,- lights_toon_pars_fragment: Mv,- lights_phong_fragment: Bv,- lights_phong_pars_fragment: Tv,- lights_physical_fragment: Rv,- lights_physical_pars_fragment: Fv,- lights_fragment_begin: Dv,- lights_fragment_maps: Nv,- lights_fragment_end: Lv,- logdepthbuf_fragment: Pv,- logdepthbuf_pars_fragment: kv,- logdepthbuf_pars_vertex: Uv,- logdepthbuf_vertex: Ov,- map_fragment: Qv,- map_pars_fragment: Gv,- map_particle_fragment: Hv,- map_particle_pars_fragment: zv,- metalnessmap_fragment: Vv,- metalnessmap_pars_fragment: Wv,- morphinstance_vertex: qv,- morphcolor_vertex: Kv,- morphnormal_vertex: jv,- morphtarget_pars_vertex: Xv,- morphtarget_vertex: Yv,- normal_fragment_begin: Jv,- normal_fragment_maps: Zv,- normal_pars_fragment: $v,- normal_pars_vertex: eC,- normal_vertex: tC,- normalmap_pars_fragment: nC,- clearcoat_normal_fragment_begin: iC,- clearcoat_normal_fragment_maps: sC,- clearcoat_pars_fragment: rC,- iridescence_pars_fragment: aC,- opaque_fragment: oC,- packing: cC,- premultiplied_alpha_fragment: lC,- project_vertex: hC,- dithering_fragment: uC,- dithering_pars_fragment: dC,- roughnessmap_fragment: fC,- roughnessmap_pars_fragment: pC,- shadowmap_pars_fragment: AC,- shadowmap_pars_vertex: gC,- shadowmap_vertex: mC,- shadowmask_pars_fragment: xC,- skinbase_vertex: bC,- skinning_pars_vertex: EC,- skinning_vertex: _C,- skinnormal_vertex: yC,- specularmap_fragment: wC,- specularmap_pars_fragment: vC,- tonemapping_fragment: CC,- tonemapping_pars_fragment: SC,- transmission_fragment: IC,- transmission_pars_fragment: MC,- uv_pars_fragment: BC,- uv_pars_vertex: TC,- uv_vertex: RC,- worldpos_vertex: FC,- background_vert: DC,- background_frag: NC,- backgroundCube_vert: LC,- backgroundCube_frag: PC,- cube_vert: kC,- cube_frag: UC,- depth_vert: OC,- depth_frag: QC,- distanceRGBA_vert: GC,- distanceRGBA_frag: HC,- equirect_vert: zC,- equirect_frag: VC,- linedashed_vert: WC,- linedashed_frag: qC,- meshbasic_vert: KC,- meshbasic_frag: jC,- meshlambert_vert: XC,- meshlambert_frag: YC,- meshmatcap_vert: JC,- meshmatcap_frag: ZC,- meshnormal_vert: $C,- meshnormal_frag: eS,- meshphong_vert: tS,- meshphong_frag: nS,- meshphysical_vert: iS,- meshphysical_frag: sS,- meshtoon_vert: rS,- meshtoon_frag: aS,- points_vert: oS,- points_frag: cS,- shadow_vert: lS,- shadow_frag: hS,- sprite_vert: uS,- sprite_frag: dS+ 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}, we = {common: {diffuse: { value: /* @__PURE__ */ new Le(16777215) },@@ -18974,8 +18974,8 @@ ki.physical = {vertexShader: lt.meshphysical_vert,fragmentShader: lt.meshphysical_frag};-const Zc = { r: 0, b: 0, g: 0 }, rr = /* @__PURE__ */ new dn(), fS = /* @__PURE__ */ new De();-function pS(i, e, t, n, s, r, a) {+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 o = new Le(0);let c = r === !0 ? 0 : 1, l, h, u = null, d = 0, f = null;function p(x) {@@ -18984,18 +18984,18 @@ function pS(i, e, t, n, s, r, a) {}function m(x) {let E = !1;- const I = p(x);- I === null ? A(o, c) : I && I.isColor && (A(I, 1), E = !0);+ 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 I = p(E);- I && (I.isCubeTexture || I.mapping === lh) ? (h === void 0 && (h = new Zt(- new Va(1, 1, 1),+ const S = p(E);+ S && (S.isCubeTexture || S.mapping === uh) ? (h === void 0 && (h = new Zt(+ new Wa(1, 1, 1),new qs({name: "BackgroundCubeMaterial",- uniforms: La(ki.backgroundCube.uniforms),+ uniforms: Pa(ki.backgroundCube.uniforms),vertexShader: ki.backgroundCube.vertexShader,fragmentShader: ki.backgroundCube.fragmentShader,side: Vn,@@ -19004,17 +19004,17 @@ function pS(i, e, t, n, s, r, a) {fog: !1,allowOverride: !1})- ), h.geometry.deleteAttribute("normal"), h.geometry.deleteAttribute("uv"), h.onBeforeRender = function(w, S, T) {+ ), 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)), rr.copy(E.backgroundRotation), rr.x *= -1, rr.y *= -1, rr.z *= -1, I.isCubeTexture && I.isRenderTargetTexture === !1 && (rr.y *= -1, rr.z *= -1), h.material.uniforms.envMap.value = I, h.material.uniforms.flipEnvMap.value = I.isCubeTexture && I.isRenderTargetTexture === !1 ? -1 : 1, h.material.uniforms.backgroundBlurriness.value = E.backgroundBlurriness, h.material.uniforms.backgroundIntensity.value = E.backgroundIntensity, h.material.uniforms.backgroundRotation.value.setFromMatrix4(fS.makeRotationFromEuler(rr)), h.material.toneMapped = rt.getTransfer(I.colorSpace) !== Rt, (u !== I || d !== I.version || f !== i.toneMapping) && (h.material.needsUpdate = !0, u = I, d = I.version, f = i.toneMapping), h.layers.enableAll(), x.unshift(h, h.geometry, h.material, 0, 0, null)) : I && I.isTexture && (l === void 0 && (l = new Zt(- new gh(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(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),new qs({name: "BackgroundMaterial",- uniforms: La(ki.background.uniforms),+ uniforms: Pa(ki.background.uniforms),vertexShader: ki.background.vertexShader,fragmentShader: ki.background.fragmentShader,side: bs,@@ -19027,12 +19027,12 @@ function pS(i, e, t, n, s, r, a) {get: function() {return this.uniforms.t2D.value;}- }), s.update(l)), l.material.uniforms.t2D.value = I, l.material.uniforms.backgroundIntensity.value = E.backgroundIntensity, l.material.toneMapped = rt.getTransfer(I.colorSpace) !== Rt, I.matrixAutoUpdate === !0 && I.updateMatrix(), l.material.uniforms.uvTransform.value.copy(I.matrix), (u !== I || d !== I.version || f !== i.toneMapping) && (l.material.needsUpdate = !0, u = I, d = I.version, f = i.toneMapping), l.layers.enableAll(), x.unshift(l, l.geometry, l.material, 0, 0, null));+ }), 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(Zc, I0(i)), n.buffers.color.setClear(Zc.r, Zc.g, Zc.b, E, a);+ x.getRGB(el, F0(i)), n.buffers.color.setClear(el.r, el.g, el.b, E, a);}- function y() {+ 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 {@@ -19050,16 +19050,16 @@ function pS(i, e, t, n, s, r, a) {},render: m,addToRenderList: g,- dispose: y+ dispose: _};}-function AS(i, e) {+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 N = !1;+ let D = !1;const O = u(q, K, F);- r !== O && (r = O, l(r.object)), N = f(v, q, K, $), N && p(v, q, K, $), $ !== null && e.update($, i.ELEMENT_ARRAY_BUFFER), (N || a) && (a = !1, E(v, F, K, q), $ !== null && i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, e.get($).buffer));+ 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();@@ -19074,10 +19074,10 @@ function AS(i, e) {const q = K.wireframe === !0;let $ = n[v.id];$ === void 0 && ($ = {}, n[v.id] = $);- let N = $[F.id];- N === void 0 && (N = {}, $[F.id] = N);- let O = N[q];- return O === void 0 && (O = d(c()), N[q] = O), O;+ 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 = [];@@ -19097,25 +19097,25 @@ function AS(i, e) {};}function f(v, F, K, q) {- const $ = r.attributes, N = F.attributes;+ 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 = N[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 $ = {}, N = F.attributes;+ const $ = {}, D = F.attributes;let O = 0;const Y = K.getAttributes();for (const Q in Y)if (Y[Q].location >= 0) {- let ee = N[Q];+ 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++;@@ -19134,25 +19134,25 @@ function AS(i, e) {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 y() {+ 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, $, N, O) {- O === !0 ? i.vertexAttribIPointer(v, F, K, $, N) : i.vertexAttribPointer(v, F, K, q, $, N);+ 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, N = K.getAttributes(), O = F.defaultAttributeValues;- for (const Y in N) {- const Q = N[Y];+ 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, ye = e.get(J);- if (ye === void 0) continue;- const Me = ye.buffer, se = ye.type, me = ye.bytesPerElement, xe = se === i.INT || se === i.UNSIGNED_INT || J.gpuType === Ff;+ 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;if (J.isInterleavedBufferAttribute) {const be = J.data, Ue = be.stride, et = J.offset;if (be.isInstancedInterleavedBuffer) {@@ -19212,9 +19212,9 @@ function AS(i, e) {}}}- y();+ _();}- function I() {+ function S() {T();for (const v in n) {const F = n[v];@@ -19238,7 +19238,7 @@ function AS(i, e) {}delete n[v.id];}- function S(v) {+ function I(v) {for (const F in n) {const K = n[F];if (K[v.id] === void 0) continue;@@ -19258,15 +19258,15 @@ function AS(i, e) {setup: o,reset: T,resetDefaultState: C,- dispose: I,+ dispose: S,releaseStatesOfGeometry: w,- releaseStatesOfProgram: S,+ releaseStatesOfProgram: I,initAttributes: m,enableAttribute: g,- disableUnusedAttributes: y+ disableUnusedAttributes: _};}-function gS(i, e, t) {+function SI(i, e, t) {let n;function s(l) {n = l;@@ -19301,37 +19301,37 @@ function gS(i, e, t) {}this.setMode = s, this.render = r, this.renderInstances = a, this.renderMultiDraw = o, this.renderMultiDrawInstances = c;}-function mS(i, e, t, n) {+function MI(i, e, t, n) {let s;function r() {if (s !== void 0) return s;if (e.has("EXT_texture_filter_anisotropic") === !0) {- const S = e.get("EXT_texture_filter_anisotropic");- s = i.getParameter(S.MAX_TEXTURE_MAX_ANISOTROPY_EXT);+ const I = e.get("EXT_texture_filter_anisotropic");+ s = i.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT);} elses = 0;return s;}- function a(S) {- return !(S !== pn && n.convert(S) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT));+ function a(I) {+ return !(I !== pn && n.convert(I) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT));}- function o(S) {- const T = S === Qn && (e.has("EXT_color_buffer_half_float") || e.has("EXT_color_buffer_float"));- return !(S !== un && n.convert(S) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)- S !== fn && !T);+ function o(I) {+ const T = I === Qn && (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);}- function c(S) {- if (S === "highp") {+ 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";- S = "mediump";+ I = "mediump";}- return S === "mediump" && i.getShaderPrecisionFormat(i.VERTEX_SHADER, i.MEDIUM_FLOAT).precision > 0 && i.getShaderPrecisionFormat(i.FRAGMENT_SHADER, i.MEDIUM_FLOAT).precision > 0 ? "mediump" : "lowp";+ 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), y = i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS), x = i.getParameter(i.MAX_VARYING_VECTORS), E = i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS), I = p > 0, w = i.getParameter(i.MAX_SAMPLES);+ 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,// keeping this for backwards compatibility@@ -19347,14 +19347,14 @@ function mS(i, e, t, n) {maxTextureSize: m,maxCubemapSize: g,maxAttributes: A,- maxVertexUniforms: y,+ maxVertexUniforms: _,maxVaryings: x,maxFragmentUniforms: E,- vertexTextures: I,+ vertexTextures: S,maxSamples: w};}-function xS(i) {+function BI(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 };@@ -19374,12 +19374,12 @@ function xS(i) {if (!s || p === null || p.length === 0 || r && !g)r ? h(null) : l();else {- const y = r ? 0 : n, x = y * 4;+ const _ = r ? 0 : n, x = _ * 4;let E = A.clippingState || null;c.value = E, E = h(p, d, x, f);- for (let I = 0; I !== x; ++I)- E[I] = t[I];- A.clippingState = E, this.numIntersection = m ? this.numPlanes : 0, this.numPlanes += y;+ for (let S = 0; S !== x; ++S)+ E[S] = t[S];+ A.clippingState = E, this.numIntersection = m ? this.numPlanes : 0, this.numPlanes += _;}};function l() {@@ -19390,32 +19390,32 @@ function xS(i) {let g = null;if (m !== 0) {if (g = c.value, p !== !0 || g === null) {- const A = f + m * 4, y = d.matrixWorldInverse;- o.getNormalMatrix(y), (g === null || g.length < A) && (g = new Float32Array(A));+ 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(y, o), a.normal.toArray(g, E), g[E + 3] = a.constant;+ 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 bS(i) {+function TI(i) {let e = /* @__PURE__ */ new WeakMap();function t(a, o) {- return o === Fl ? a.mapping = Sr : o === gd && (a.mapping = Da), a;+ return o === Dl ? a.mapping = Br : o === bd && (a.mapping = Da), a;}function n(a) {if (a && a.isTexture) {const o = a.mapping;- if (o === Fl || o === gd)+ if (o === Dl || o === bd)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 Ey(c.height);+ const l = new R_(c.height);return l.fromEquirectangularTexture(i, a), e.set(a, l), a.addEventListener("dispose", s), t(l.texture, a.mapping);} elsereturn null;@@ -19437,21 +19437,21 @@ function bS(i) {dispose: r};}-const ga = 4, MA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], pr = 20, uu = /* @__PURE__ */ new Kf(), BA = /* @__PURE__ */ new Le();-let du = null, fu = 0, pu = 0, Au = !1;-const ur = (1 + Math.sqrt(5)) / 2, sa = 1 / ur, TA = [- /* @__PURE__ */ new G(-ur, sa, 0),- /* @__PURE__ */ new G(ur, sa, 0),- /* @__PURE__ */ new G(-sa, 0, ur),- /* @__PURE__ */ new G(sa, 0, ur),- /* @__PURE__ */ new G(0, ur, -sa),- /* @__PURE__ */ new G(0, ur, sa),+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 = [+ /* @__PURE__ */ new G(-dr, aa, 0),+ /* @__PURE__ */ new G(dr, aa, 0),+ /* @__PURE__ */ new G(-aa, 0, dr),+ /* @__PURE__ */ new G(aa, 0, dr),+ /* @__PURE__ */ new G(0, dr, -aa),+ /* @__PURE__ */ new G(0, dr, aa),/* @__PURE__ */ new G(-1, 1, -1),/* @__PURE__ */ new G(1, 1, -1),/* @__PURE__ */ new G(-1, 1, 1),/* @__PURE__ */ new G(1, 1, 1)-], ES = /* @__PURE__ */ new G();-class Hd {+], RI = /* @__PURE__ */ new G();+class Wd {/*** Constructs a new PMREM generator.*@@ -19478,9 +19478,9 @@ class Hd {fromScene(e, t = 0, n = 0.1, s = 100, r = {}) {const {size: a = 256,- position: o = ES+ position: o = RI} = r;- du = this._renderer.getRenderTarget(), fu = this._renderer.getActiveCubeFace(), pu = this._renderer.getActiveMipmapLevel(), Au = this._renderer.xr.enabled, this._renderer.xr.enabled = !1, this._setSize(a);+ 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);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 Hd {* your texture's network fetch for increased concurrency.*/compileCubemapShader() {- this._cubemapMaterial === null && (this._cubemapMaterial = DA(), this._compileMaterial(this._cubemapMaterial));+ this._cubemapMaterial === null && (this._cubemapMaterial = PA(), 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 = FA(), this._compileMaterial(this._equirectMaterial));+ this._equirectMaterial === null && (this._equirectMaterial = LA(), this._compileMaterial(this._equirectMaterial));}/*** Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,@@ -19540,10 +19540,10 @@ class Hd {this._lodPlanes[e].dispose();}_cleanup(e) {- this._renderer.setRenderTarget(du, fu, pu), this._renderer.xr.enabled = Au, e.scissorTest = !1, $c(e, 0, 0, e.width, e.height);+ this._renderer.setRenderTarget(Au, gu, mu), this._renderer.xr.enabled = xu, e.scissorTest = !1, tl(e, 0, 0, e.width, e.height);}_fromTexture(e, t) {- e.mapping === Sr || 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), du = this._renderer.getRenderTarget(), fu = this._renderer.getActiveCubeFace(), pu = this._renderer.getActiveMipmapLevel(), Au = this._renderer.xr.enabled, this._renderer.xr.enabled = !1;+ 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;const n = t || this._allocateTargets();return this._textureToCubeUV(e, n), this._applyPMREM(n), this._cleanup(n), n;}@@ -19556,52 +19556,52 @@ class Hd {format: pn,colorSpace: An,depthBuffer: !1- }, s = RA(e, t, n);+ }, s = DA(e, t, n);if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== e || this._pingPongRenderTarget.height !== t) {- this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = RA(e, t, n);+ this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = DA(e, t, n);const { _lodMax: r } = this;- ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _S(r)), this._blurMaterial = yS(r, e, t);+ ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = FI(r)), this._blurMaterial = NI(r, e, t);}return s;}_compileMaterial(e) {const t = new Zt(this._lodPlanes[0], e);- this._renderer.compile(t, uu);+ this._renderer.compile(t, pu);}_sceneToCubeUV(e, t, n, s, r) {- const c = new Sn(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(BA), u.toneMapping = Hs, u.autoClear = !1;+ 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;const p = new Os({name: "PMREM.Background",side: Vn,depthWrite: !1,depthTest: !1- }), m = new Zt(new Va(), p);+ }), m = new Zt(new Wa(), p);let g = !1;const A = e.background;- A ? A.isColor && (p.color.copy(A), e.background = null, g = !0) : (p.color.copy(BA), g = !0);- for (let y = 0; y < 6; y++) {- const x = y % 3;- x === 0 ? (c.up.set(0, l[y], 0), c.position.set(r.x, r.y, r.z), c.lookAt(r.x + h[y], r.y, r.z)) : x === 1 ? (c.up.set(0, 0, l[y]), c.position.set(r.x, r.y, r.z), c.lookAt(r.x, r.y + h[y], r.z)) : (c.up.set(0, l[y], 0), c.position.set(r.x, r.y, r.z), c.lookAt(r.x, r.y, r.z + h[y]));+ A ? A.isColor && (p.color.copy(A), e.background = null, g = !0) : (p.color.copy(FA), 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;- $c(s, x * E, y > 2 ? E : 0, E, E), u.setRenderTarget(s), g && u.render(m, c), u.render(e, c);+ tl(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 === Da;- s ? (this._cubemapMaterial === null && (this._cubemapMaterial = DA()), this._cubemapMaterial.uniforms.flipEnvMap.value = e.isRenderTargetTexture === !1 ? -1 : 1) : this._equirectMaterial === null && (this._equirectMaterial = FA());+ 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 r = s ? this._cubemapMaterial : this._equirectMaterial, a = new Zt(this._lodPlanes[0], r), o = r.uniforms;o.envMap.value = e;const c = this._cubeSize;- $c(t, 0, 0, 3 * c, 2 * c), n.setRenderTarget(t), n.render(a, uu);+ tl(t, 0, 0, 3 * c, 2 * c), n.setRenderTarget(t), n.render(a, pu);}_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 = TA[(s - r - 1) % TA.length];+ 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];this._blur(e, r - 1, r, a, o);}t.autoClear = n;@@ -19645,76 +19645,76 @@ class Hd {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 * pr - 1), m = r / p, g = isFinite(r) ? 1 + Math.floor(h * m) : pr;- g > pr && console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${pr}`);+ 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 * Ar - 1), m = r / p, g = isFinite(r) ? 1 + Math.floor(h * m) : Ar;+ g > Ar && console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Ar}`);const A = [];- let y = 0;- for (let S = 0; S < pr; ++S) {- const T = S / m, C = Math.exp(-T * T / 2);- A.push(C), S === 0 ? y += C : S < g && (y += 2 * C);+ let _ = 0;+ for (let I = 0; I < Ar; ++I) {+ const T = I / m, C = Math.exp(-T * T / 2);+ A.push(C), I === 0 ? _ += C : I < g && (_ += 2 * C);}- for (let S = 0; S < A.length; S++)- A[S] = A[S] / y;+ 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], I = 3 * E * (s > x - ga ? s - x + ga : 0), w = 4 * (this._cubeSize - E);- $c(t, I, w, 3 * E, 2 * E), c.setRenderTarget(t), c.render(u, uu);+ 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);}}-function _S(i) {+function FI(i) {const e = [], t = [], n = [];let s = i;- const r = i - ga + 1 + MA.length;+ const r = i - xa + 1 + RA.length;for (let a = 0; a < r; a++) {const o = Math.pow(2, s);t.push(o);let c = 1 / o;- a > i - ga ? c = MA[a - i + ga - 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, y = new Float32Array(m * p * f), x = new Float32Array(g * p * f), E = new Float32Array(A * p * f);+ a > i - xa ? c = RA[a - i + xa - 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 S = w % 3 * 2 / 3 - 1, T = w > 2 ? 0 : -1, C = [- S,+ const I = w % 3 * 2 / 3 - 1, T = w > 2 ? 0 : -1, C = [+ I,T,0,- S + 2 / 3,+ I + 2 / 3,T,0,- S + 2 / 3,+ I + 2 / 3,T + 1,0,- S,+ I,T,0,- S + 2 / 3,+ I + 2 / 3,T + 1,0,- S,+ I,T + 1,0];- y.set(C, m * p * w), x.set(d, g * p * w);+ _.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 I = new Tn();- I.setAttribute("position", new Bn(y, m)), I.setAttribute("uv", new Bn(x, g)), I.setAttribute("faceIndex", new Bn(E, A)), e.push(I), s > ga && s--;+ 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--;}return { lodPlanes: e, sizeLods: t, sigmas: n };}-function RA(i, e, t) {- const n = new Mr(i, e, t);- return n.texture.mapping = lh, n.texture.name = "PMREM.cubeUv", n.scissorTest = !0, n;+function DA(i, e, t) {+ const n = new Rr(i, e, t);+ return n.texture.mapping = uh, n.texture.name = "PMREM.cubeUv", n.scissorTest = !0, n;}-function $c(i, e, t, n, s) {+function tl(i, e, t, n, s) {i.viewport.set(e, t, n, s), i.scissor.set(e, t, n, s);}-function yS(i, e, t) {- const n = new Float32Array(pr), s = new G(0, 1, 0);+function NI(i, e, t) {+ const n = new Float32Array(Ar), s = new G(0, 1, 0);return new qs({name: "SphericalGaussianBlur",defines: {- n: pr,+ n: Ar,CUBEUV_TEXEL_WIDTH: 1 / e,CUBEUV_TEXEL_HEIGHT: 1 / t,CUBEUV_MAX_MIP: `${i}.0`@@ -19728,7 +19728,7 @@ function yS(i, e, t) {mipInt: { value: 0 },poleAxis: { value: s }},- vertexShader: Jf(),+ vertexShader: ep(),fragmentShader: (/* glsl */`@@ -19798,13 +19798,13 @@ function yS(i, e, t) {depthWrite: !1});}-function FA() {+function LA() {return new qs({name: "EquirectangularToCubeUV",uniforms: {envMap: { value: null }},- vertexShader: Jf(),+ vertexShader: ep(),fragmentShader: (/* glsl */`@@ -19833,14 +19833,14 @@ function FA() {depthWrite: !1});}-function DA() {+function PA() {return new qs({name: "CubemapToCubeUV",uniforms: {envMap: { value: null },flipEnvMap: { value: -1 }},- vertexShader: Jf(),+ vertexShader: ep(),fragmentShader: (/* glsl */`@@ -19866,7 +19866,7 @@ function DA() {depthWrite: !1});}-function Jf() {+function ep() {return (/* glsl */`@@ -19927,21 +19927,21 @@ function Jf() {`);}-function wS(i) {+function DI(i) {let e = /* @__PURE__ */ new WeakMap(), t = null;function n(o) {if (o && o.isTexture) {- const c = o.mapping, l = c === Fl || c === gd, h = c === Sr || c === Da;+ const c = o.mapping, l = c === Dl || c === bd, h = c === Br || c === Da;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 Hd(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 Wd(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 Hd(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 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;}}}@@ -19968,7 +19968,7 @@ function wS(i) {dispose: a};}-function vS(i) {+function LI(i) {const e = {};function t(n) {if (e[n] !== void 0)@@ -20001,11 +20001,11 @@ function vS(i) {},get: function(n) {const s = t(n);- return s === null && Cl("THREE.WebGLRenderer: " + n + " extension not supported."), s;+ return s === null && Sl("THREE.WebGLRenderer: " + n + " extension not supported."), s;}};}-function CS(i, e, t, n) {+function PI(i, e, t, n) {const s = {}, r = /* @__PURE__ */ new WeakMap();function a(u) {const d = u.target;@@ -20028,22 +20028,22 @@ function CS(i, e, t, n) {const d = [], f = u.index, p = u.attributes.position;let m = 0;if (f !== null) {- const y = f.array;+ const _ = f.array;m = f.version;- for (let x = 0, E = y.length; x < E; x += 3) {- const I = y[x + 0], w = y[x + 1], S = y[x + 2];- d.push(I, w, w, S, S, I);+ 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 y = p.array;+ const _ = p.array;m = p.version;- for (let x = 0, E = y.length / 3 - 1; x < E; x += 3) {- const I = x + 0, w = x + 1, S = x + 2;- d.push(I, w, w, S, S, I);+ 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);}} elsereturn;- const g = new (_0(d) ? S0 : Gf)(d, 1);+ const g = new (I0(d) ? R0 : Vf)(d, 1);g.version = m;const A = r.get(u);A && e.remove(A), r.set(u, g);@@ -20063,7 +20063,7 @@ function CS(i, e, t, n) {getWireframeAttribute: h};}-function SS(i, e, t) {+function kI(i, e, t) {let n;function s(d) {n = d;@@ -20095,14 +20095,14 @@ function SS(i, e, t) {else {g.multiDrawElementsInstancedWEBGL(n, f, 0, r, d, 0, m, 0, p);let A = 0;- for (let y = 0; y < p; y++)- A += f[y] * m[y];+ 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 IS(i) {+function UI(i) {const e = {geometries: 0,textures: 0@@ -20147,35 +20147,35 @@ function IS(i) {update: n};}-function MS(i, e, t) {+function OI(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;let d = n.get(o);if (d === void 0 || d.count !== u) {let C = function() {- S.dispose(), n.delete(o), o.removeEventListener("dispose", C);+ 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 || [], y = o.morphAttributes.color || [];+ 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, I = 1;- E > e.maxTextureSize && (I = Math.ceil(E / e.maxTextureSize), E = e.maxTextureSize);- const w = new Float32Array(E * I * 4 * u), S = new y0(w, E, I, u);- S.type = fn, S.needsUpdate = !0;+ 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);+ I.type = fn, I.needsUpdate = !0;const T = x * 4;for (let v = 0; v < u; v++) {- const F = g[v], K = A[v], q = y[v], $ = E * I * 4 * v;- for (let N = 0; N < F.count; N++) {- const O = N * T;- f === !0 && (s.fromBufferAttribute(F, N), w[$ + O + 0] = s.x, w[$ + O + 1] = s.y, w[$ + O + 2] = s.z, w[$ + O + 3] = 0), p === !0 && (s.fromBufferAttribute(K, N), w[$ + O + 4] = s.x, w[$ + O + 5] = s.y, w[$ + O + 6] = s.z, w[$ + O + 7] = 0), m === !0 && (s.fromBufferAttribute(q, N), w[$ + O + 8] = s.x, w[$ + O + 9] = s.y, w[$ + O + 10] = s.z, w[$ + O + 11] = q.itemSize === 4 ? s.w : 1);+ 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: S,- size: new Ze(E, I)+ texture: I,+ size: new Ze(E, S)}, n.set(o, d), o.addEventListener("dispose", C);}if (a.isInstancedMesh === !0 && a.morphTexture !== null)@@ -20193,7 +20193,7 @@ function MS(i, e, t) {update: r};}-function BS(i, e, t, n) {+function QI(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 BS(i, e, t, n) {dispose: a};}-const K0 = /* @__PURE__ */ new an(), NA = /* @__PURE__ */ new F0(1, 1), j0 = /* @__PURE__ */ new y0(), X0 = /* @__PURE__ */ new w0(), Y0 = /* @__PURE__ */ new B0(), LA = [], PA = [], kA = new Float32Array(16), UA = new Float32Array(9), OA = new Float32Array(4);-function ja(i, e, t) {+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 n = i[0];if (n <= 0 || n > 0) return i;const s = e * t;- let r = LA[s];- if (r === void 0 && (r = new Float32Array(s), LA[s] = r), e !== 0) {+ let r = UA[s];+ if (r === void 0 && (r = new Float32Array(s), UA[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 mh(i, e) {- let t = PA[e];- t === void 0 && (t = new Int32Array(e), PA[e] = t);+function bh(i, e) {+ let t = OA[e];+ t === void 0 && (t = new Int32Array(e), OA[e] = t);for (let n = 0; n !== e; ++n)t[n] = i.allocateTextureUnit();return t;}-function TS(i, e) {+function GI(i, e) {const t = this.cache;t[0] !== e && (i.uniform1f(this.addr, e), t[0] = e);}-function RS(i, e) {+function HI(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 RS(i, e) {i.uniform2fv(this.addr, e), mn(t, e);}}-function FS(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) && (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 FS(i, e) {i.uniform3fv(this.addr, e), mn(t, e);}}-function DS(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 || 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 DS(i, e) {i.uniform4fv(this.addr, e), mn(t, e);}}-function NS(i, e) {+function WI(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;- OA.set(n), i.uniformMatrix2fv(this.addr, !1, OA), mn(t, n);+ HA.set(n), i.uniformMatrix2fv(this.addr, !1, HA), mn(t, n);}}-function LS(i, e) {+function qI(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;- UA.set(n), i.uniformMatrix3fv(this.addr, !1, UA), mn(t, n);+ GA.set(n), i.uniformMatrix3fv(this.addr, !1, GA), mn(t, n);}}-function PS(i, e) {+function KI(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;- kA.set(n), i.uniformMatrix4fv(this.addr, !1, kA), mn(t, n);+ QA.set(n), i.uniformMatrix4fv(this.addr, !1, QA), mn(t, n);}}-function kS(i, e) {+function jI(i, e) {const t = this.cache;t[0] !== e && (i.uniform1i(this.addr, e), t[0] = e);}-function US(i, e) {+function XI(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 US(i, e) {i.uniform2iv(this.addr, e), mn(t, e);}}-function OS(i, 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) && (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 OS(i, e) {i.uniform3iv(this.addr, e), mn(t, e);}}-function QS(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 || 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 QS(i, e) {i.uniform4iv(this.addr, e), mn(t, e);}}-function GS(i, e) {+function ZI(i, e) {const t = this.cache;t[0] !== e && (i.uniform1ui(this.addr, e), t[0] = e);}-function HS(i, e) {+function $I(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 HS(i, e) {i.uniform2uiv(this.addr, e), mn(t, e);}}-function zS(i, e) {+function eS(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 zS(i, e) {i.uniform3uiv(this.addr, e), mn(t, e);}}-function VS(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 || 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 VS(i, e) {i.uniform4uiv(this.addr, e), mn(t, e);}}-function WS(i, e, t) {+function nS(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 ? (NA.compareFunction = E0, r = NA) : r = K0, t.setTexture2D(e || r, s);+ this.type === i.SAMPLER_2D_SHADOW ? (kA.compareFunction = C0, r = kA) : r = Z0, t.setTexture2D(e || r, s);}-function qS(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), t.setTexture3D(e || X0, s);+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture3D(e || ex, s);}-function KS(i, e, t) {+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 || Y0, s);+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTextureCube(e || tx, s);}-function jS(i, e, t) {+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 || j0, s);+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture2DArray(e || $0, s);}-function XS(i) {+function aS(i) {switch (i) {case 5126:- return TS;+ return GI;// FLOATcase 35664:- return RS;+ return HI;// _VEC2case 35665:- return FS;+ return zI;// _VEC3case 35666:- return DS;+ return VI;// _VEC4case 35674:- return NS;+ return WI;// _MAT2case 35675:- return LS;+ return qI;// _MAT3case 35676:- return PS;+ return KI;// _MAT4case 5124:case 35670:- return kS;+ return jI;// INT, BOOLcase 35667:case 35671:- return US;+ return XI;// _VEC2case 35668:case 35672:- return OS;+ return YI;// _VEC3case 35669:case 35673:- return QS;+ return JI;// _VEC4case 5125:- return GS;+ return ZI;// UINTcase 36294:- return HS;+ return $I;// _VEC2case 36295:- return zS;+ return eS;// _VEC3case 36296:- return VS;+ return tS;// _VEC4case 35678:// SAMPLER_2D@@ -20448,13 +20448,13 @@ function XS(i) {case 36306:// UNSIGNED_INT_SAMPLER_2Dcase 35682:- return WS;+ return nS;case 35679:// SAMPLER_3Dcase 36299:// INT_SAMPLER_3Dcase 36307:- return qS;+ return iS;case 35680:// SAMPLER_CUBEcase 36300:@@ -20462,7 +20462,7 @@ function XS(i) {case 36308:// UNSIGNED_INT_SAMPLER_CUBEcase 36293:- return KS;+ return sS;case 36289:// SAMPLER_2D_ARRAYcase 36303:@@ -20470,134 +20470,134 @@ function XS(i) {case 36311:// UNSIGNED_INT_SAMPLER_2D_ARRAYcase 36292:- return jS;+ return rS;}}-function YS(i, e) {+function oS(i, e) {i.uniform1fv(this.addr, e);}-function JS(i, e) {- const t = ja(e, this.size, 2);+function cS(i, e) {+ const t = Xa(e, this.size, 2);i.uniform2fv(this.addr, t);}-function ZS(i, e) {- const t = ja(e, this.size, 3);+function lS(i, e) {+ const t = Xa(e, this.size, 3);i.uniform3fv(this.addr, t);}-function $S(i, e) {- const t = ja(e, this.size, 4);+function hS(i, e) {+ const t = Xa(e, this.size, 4);i.uniform4fv(this.addr, t);}-function eI(i, e) {- const t = ja(e, this.size, 4);+function uS(i, e) {+ const t = Xa(e, this.size, 4);i.uniformMatrix2fv(this.addr, !1, t);}-function tI(i, e) {- const t = ja(e, this.size, 9);+function dS(i, e) {+ const t = Xa(e, this.size, 9);i.uniformMatrix3fv(this.addr, !1, t);}-function nI(i, e) {- const t = ja(e, this.size, 16);+function fS(i, e) {+ const t = Xa(e, this.size, 16);i.uniformMatrix4fv(this.addr, !1, t);}-function iI(i, e) {+function pS(i, e) {i.uniform1iv(this.addr, e);}-function sI(i, e) {+function AS(i, e) {i.uniform2iv(this.addr, e);}-function rI(i, e) {+function gS(i, e) {i.uniform3iv(this.addr, e);}-function aI(i, e) {+function mS(i, e) {i.uniform4iv(this.addr, e);}-function oI(i, e) {+function xS(i, e) {i.uniform1uiv(this.addr, e);}-function cI(i, e) {+function bS(i, e) {i.uniform2uiv(this.addr, e);}-function lI(i, e) {+function ES(i, e) {i.uniform3uiv(this.addr, e);}-function hI(i, e) {+function yS(i, e) {i.uniform4uiv(this.addr, e);}-function uI(i, e, t) {- const n = this.cache, s = e.length, r = mh(t, s);+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] || K0, r[a]);+ t.setTexture2D(e[a] || Z0, r[a]);}-function dI(i, e, t) {- const n = this.cache, s = e.length, r = mh(t, s);+function wS(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.setTexture3D(e[a] || X0, r[a]);+ t.setTexture3D(e[a] || ex, r[a]);}-function fI(i, e, t) {- const n = this.cache, s = e.length, r = mh(t, s);+function vS(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.setTextureCube(e[a] || Y0, r[a]);+ t.setTextureCube(e[a] || tx, r[a]);}-function pI(i, e, t) {- const n = this.cache, s = e.length, r = mh(t, s);+function CS(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.setTexture2DArray(e[a] || j0, r[a]);+ t.setTexture2DArray(e[a] || $0, r[a]);}-function AI(i) {+function IS(i) {switch (i) {case 5126:- return YS;+ return oS;// FLOATcase 35664:- return JS;+ return cS;// _VEC2case 35665:- return ZS;+ return lS;// _VEC3case 35666:- return $S;+ return hS;// _VEC4case 35674:- return eI;+ return uS;// _MAT2case 35675:- return tI;+ return dS;// _MAT3case 35676:- return nI;+ return fS;// _MAT4case 5124:case 35670:- return iI;+ return pS;// INT, BOOLcase 35667:case 35671:- return sI;+ return AS;// _VEC2case 35668:case 35672:- return rI;+ return gS;// _VEC3case 35669:case 35673:- return aI;+ return mS;// _VEC4case 5125:- return oI;+ return xS;// UINTcase 36294:- return cI;+ return bS;// _VEC2case 36295:- return lI;+ return ES;// _VEC3case 36296:- return hI;+ return yS;// _VEC4case 35678:// SAMPLER_2D@@ -20608,13 +20608,13 @@ function AI(i) {case 36306:// UNSIGNED_INT_SAMPLER_2Dcase 35682:- return uI;+ return _S;case 35679:// SAMPLER_3Dcase 36299:// INT_SAMPLER_3Dcase 36307:- return dI;+ return wS;case 35680:// SAMPLER_CUBEcase 36300:@@ -20622,7 +20622,7 @@ function AI(i) {case 36308:// UNSIGNED_INT_SAMPLER_CUBEcase 36293:- return fI;+ return vS;case 36289:// SAMPLER_2D_ARRAYcase 36303:@@ -20630,20 +20630,20 @@ function AI(i) {case 36311:// UNSIGNED_INT_SAMPLER_2D_ARRAYcase 36292:- return pI;+ return CS;}}-class gI {+class SS {constructor(e, t, n) {- this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.setValue = XS(t.type);+ this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.setValue = aS(t.type);}}-class mI {+class MS {constructor(e, t, n) {- this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = AI(t.type);+ this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = IS(t.type);}}-class xI {+class BS {constructor(e) {this.id = e, this.seq = [], this.map = {};}@@ -20655,32 +20655,32 @@ class xI {}}}-const gu = /(\w+)(\])?(\[|\.)?/g;-function QA(i, e) {+const bu = /(\w+)(\])?(\[|\.)?/g;+function zA(i, e) {i.seq.push(e), i.map[e.id] = e;}-function bI(i, e, t) {+function TS(i, e, t) {const n = i.name, s = n.length;- for (gu.lastIndex = 0; ; ) {- const r = gu.exec(n), a = gu.lastIndex;+ for (bu.lastIndex = 0; ; ) {+ const r = bu.exec(n), a = bu.lastIndex;let o = r[1];const c = r[2] === "]", l = r[3];if (c && (o = o | 0), l === void 0 || l === "[" && a + 2 === s) {- QA(t, l === void 0 ? new gI(o, i, e) : new mI(o, i, e));+ zA(t, l === void 0 ? new SS(o, i, e) : new MS(o, i, e));break;} else {let u = t.map[o];- u === void 0 && (u = new xI(o), QA(t, u)), t = u;+ u === void 0 && (u = new BS(o), zA(t, u)), t = u;}}}-class Sl {+class Ml {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);- bI(r, a, this);+ TS(r, a, this);}}setValue(e, t, n, s) {@@ -20706,13 +20706,13 @@ class Sl {return n;}}-function GA(i, e, t) {+function VA(i, e, t) {const n = i.createShader(e);return i.shaderSource(n, t), i.compileShader(n), n;}-const EI = 37297;-let _I = 0;-function yI(i, e) {+const RS = 37297;+let FS = 0;+function NS(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 yI(i, e) {return n.join(``);}-const HA = /* @__PURE__ */ new at();-function wI(i) {- rt._getMatrix(HA, rt.workingColorSpace, i);- const e = `mat3( ${HA.elements.map((t) => t.toFixed(4))} )`;+const WA = /* @__PURE__ */ new at();+function DS(i) {+ rt._getMatrix(WA, rt.workingColorSpace, i);+ const e = `mat3( ${WA.elements.map((t) => t.toFixed(4))} )`;switch (rt.getTransfer(i)) {- case Gl:+ case zl:return [e, "LinearTransferOETF"];case Rt:return [e, "sRGBTransferOETF"];@@ -20735,7 +20735,7 @@ function wI(i) {return console.warn("THREE.WebGLProgram: Unsupported color space: ", i), [e, "LinearTransferOETF"];}}-function zA(i, e, t) {+function qA(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 zA(i, e, t) {` + s + `-` + yI(i.getShaderSource(e), a);+` + NS(i.getShaderSource(e), a);} elsereturn s;}-function vI(i, e) {- const t = wI(e);+function LS(i, e) {+ const t = DS(e);return [`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,@@ -20758,28 +20758,28 @@ function vI(i, e) {].join(``);}-function CI(i, e) {+function PS(i, e) {let t;switch (e) {- case Ad:+ case xd:t = "Linear";break;- case u_:+ case _y:t = "Reinhard";break;- case d_:+ case wy:t = "Cineon";break;- case c0:+ case f0:t = "ACESFilmic";break;- case p_:+ case Cy:t = "AgX";break;- case A_:+ case Iy:t = "Neutral";break;- case f_:+ case vy:t = "Custom";break;default:@@ -20787,10 +20787,10 @@ function CI(i, e) {}return "vec3 " + i + "( vec3 color ) { return " + t + "ToneMapping( color ); }";}-const el = /* @__PURE__ */ new G();-function SI() {- rt.getLuminanceCoefficients(el);- const i = el.x.toFixed(4), e = el.y.toFixed(4), t = el.z.toFixed(4);+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);return ["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`,@@ -20799,14 +20799,14 @@ function SI() {].join(``);}-function II(i) {+function US(i) {return [i.extensionClipCullDistance ? "#extension GL_ANGLE_clip_cull_distance : require" : "",i.extensionMultiDraw ? "#extension GL_ANGLE_multi_draw : require" : ""- ].filter(_o).join(`+ ].filter(wo).join(``);}-function MI(i) {+function OS(i) {const e = [];for (const t in i) {const n = i[t];@@ -20815,7 +20815,7 @@ function MI(i) {return e.join(``);}-function BI(i, e) {+function QS(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 BI(i, e) {}return t;}-function _o(i) {+function wo(i) {return i !== "";}-function VA(i, e) {+function KA(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 WA(i, e) {+function jA(i, e) {return i.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection);}-const TI = /^[ \t]*#include +<([\w\d./]+)>/gm;-function zd(i) {- return i.replace(TI, FI);+const GS = /^[ \t]*#include +<([\w\d./]+)>/gm;+function qd(i) {+ return i.replace(GS, zS);}-const RI = /* @__PURE__ */ new Map();-function FI(i, e) {+const HS = /* @__PURE__ */ new Map();+function zS(i, e) {let t = lt[e];if (t === void 0) {- const n = RI.get(e);+ const n = HS.get(e);if (n !== void 0)t = lt[n], console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', e, n);elsethrow new Error("Can not resolve #include <" + e + ">");}- return zd(t);+ return qd(t);}-const DI = /#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 qA(i) {- return i.replace(DI, NI);+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);}-function NI(i, e, t, n) {+function WS(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 KA(i) {+function YA(i) {let e = `precision ${i.precision} float;precision ${i.precision} int;precision ${i.precision} sampler2D;@@ -20888,70 +20888,70 @@ function KA(i) {#define MEDIUM_PRECISION` : i.precision === "lowp" && (e += `#define LOW_PRECISION`), e;}-function LI(i) {+function qS(i) {let e = "SHADOWMAP_TYPE_BASIC";- return i.shadowMapType === o0 ? e = "SHADOWMAP_TYPE_PCF" : i.shadowMapType === VE ? e = "SHADOWMAP_TYPE_PCF_SOFT" : i.shadowMapType === $i && (e = "SHADOWMAP_TYPE_VSM"), e;+ return i.shadowMapType === d0 ? e = "SHADOWMAP_TYPE_PCF" : i.shadowMapType === ty ? e = "SHADOWMAP_TYPE_PCF_SOFT" : i.shadowMapType === $i && (e = "SHADOWMAP_TYPE_VSM"), e;}-function PI(i) {+function KS(i) {let e = "ENVMAP_TYPE_CUBE";if (i.envMap)switch (i.envMapMode) {- case Sr:+ case Br:case Da:e = "ENVMAP_TYPE_CUBE";break;- case lh:+ case uh:e = "ENVMAP_TYPE_CUBE_UV";break;}return e;}-function kI(i) {+function jS(i) {let e = "ENVMAP_MODE_REFLECTION";return i.envMap && i.envMapMode === Da && (e = "ENVMAP_MODE_REFRACTION"), e;}-function UI(i) {+function XS(i) {let e = "ENVMAP_BLENDING_NONE";if (i.envMap)switch (i.combine) {- case ch:+ case hh:e = "ENVMAP_BLENDING_MULTIPLY";break;- case l_:+ case Ey:e = "ENVMAP_BLENDING_MIX";break;- case h_:+ case yy:e = "ENVMAP_BLENDING_ADD";break;}return e;}-function OI(i) {+function YS(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 QI(i, e, t, n) {+function JS(i, e, t, n) {const s = i.getContext(), r = t.defines;let a = t.vertexShader, o = t.fragmentShader;- const c = LI(t), l = PI(t), h = kI(t), u = UI(t), d = OI(t), f = II(t), p = MI(r), m = s.createProgram();- let g, A, y = t.glslVersion ? "#version " + t.glslVersion + `+ 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();+ let g, A, _ = t.glslVersion ? "#version " + t.glslVersion + `` : "";t.isRawShaderMaterial ? (g = ["#define SHADER_TYPE " + t.shaderType,"#define SHADER_NAME " + t.shaderName,p- ].filter(_o).join(`+ ].filter(wo).join(``), g.length > 0 && (g += ``), A = ["#define SHADER_TYPE " + t.shaderType,"#define SHADER_NAME " + t.shaderName,p- ].filter(_o).join(`+ ].filter(wo).join(``), A.length > 0 && (A += ``)) : (g = [- KA(t),+ YA(t),"#define SHADER_TYPE " + t.shaderType,"#define SHADER_NAME " + t.shaderName,p,@@ -21082,9 +21082,9 @@ function QI(i, e, t, n) {"#endif",``- ].filter(_o).join(`+ ].filter(wo).join(``), A = [- KA(t),+ YA(t),"#define SHADER_TYPE " + t.shaderType,"#define SHADER_NAME " + t.shaderName,p,@@ -21156,18 +21156,18 @@ function QI(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 ? CI("toneMapping", t.toneMapping) : "",+ t.toneMapping !== Hs ? PS("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- vI("linearToOutputTexel", t.outputColorSpace),- SI(),+ LS("linearToOutputTexel", t.outputColorSpace),+ kS(),t.useDepthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "",``- ].filter(_o).join(`-`)), a = zd(a), a = VA(a, t), a = WA(a, t), o = zd(o), o = VA(o, t), o = WA(o, t), a = qA(a), o = qA(o), t.isRawShaderMaterial !== !0 && (y = `#version 300 es+ ].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`, g = [f,"#define attribute in",@@ -21177,8 +21177,8 @@ function QI(i, e, t, n) {`) + `` + g, A = ["#define varying in",- t.glslVersion === Up ? "" : "layout(location = 0) out highp vec4 pc_fragColor;",- t.glslVersion === Up ? "" : "#define gl_FragColor pc_fragColor",+ t.glslVersion === Gp ? "" : "layout(location = 0) out highp vec4 pc_fragColor;",+ t.glslVersion === Gp ? "" : "#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture",@@ -21192,17 +21192,17 @@ function QI(i, e, t, n) {].join(``) + `` + A);- const x = y + g + a, E = y + A + o, I = GA(s, s.VERTEX_SHADER, x), w = GA(s, s.FRAGMENT_SHADER, E);- s.attachShader(m, I), 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 S(F) {+ const x = _ + g + a, E = _ + A + o, S = VA(s, s.VERTEX_SHADER, x), w = VA(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(I).trim(), $ = s.getShaderInfoLog(w).trim();- let N = !0, O = !0;+ 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 (N = !1, typeof i.debug.onShaderError == "function")- i.debug.onShaderError(s, m, I, w);+ if (D = !1, typeof i.debug.onShaderError == "function")+ i.debug.onShaderError(s, m, S, w);else {- const Y = zA(s, I, "vertex"), Q = zA(s, w, "fragment");+ const Y = qA(s, S, "vertex"), Q = qA(s, w, "fragment");console.error("THREE.WebGLProgram: Shader Error " + s.getError() + " - VALIDATE_STATUS " + s.getProgramParameter(m, s.VALIDATE_STATUS) + `@@ -21216,7 +21216,7 @@ Program Info Log: ` + K + `}else K !== "" ? console.warn("THREE.WebGLProgram: Program Info Log:", K) : (q === "" || $ === "") && (O = !1);O && (F.diagnostics = {- runnable: N,+ runnable: D,programLog: K,vertexShader: {log: q,@@ -21228,25 +21228,25 @@ Program Info Log: ` + K + `}});}- s.deleteShader(I), s.deleteShader(w), T = new Sl(s, m), C = BI(s, m);+ s.deleteShader(S), s.deleteShader(w), T = new Ml(s, m), C = QS(s, m);}let T;this.getUniforms = function() {- return T === void 0 && S(this), T;+ return T === void 0 && I(this), T;};let C;this.getAttributes = function() {- return C === void 0 && S(this), C;+ return C === void 0 && I(this), C;};let v = t.rendererExtensionParallelShaderCompile === !1;return this.isReady = function() {- return v === !1 && (v = s.getProgramParameter(m, EI)), v;+ return v === !1 && (v = s.getProgramParameter(m, RS)), v;}, this.destroy = function() {n.releaseStatesOfProgram(this), s.deleteProgram(m), this.program = void 0;- }, this.type = t.shaderType, this.name = t.shaderName, this.id = _I++, this.cacheKey = e, this.usedTimes = 1, this.program = m, this.vertexShader = I, this.fragmentShader = w, this;+ }, 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;}-let GI = 0;-class HI {+let ZS = 0;+class $S {constructor() {this.shaderCache = /* @__PURE__ */ new Map(), this.materialCache = /* @__PURE__ */ new Map();}@@ -21277,16 +21277,16 @@ class HI {_getShaderStage(e) {const t = this.shaderCache;let n = t.get(e);- return n === void 0 && (n = new zI(e), t.set(e, n)), n;+ return n === void 0 && (n = new e1(e), t.set(e, n)), n;}}-class zI {+class e1 {constructor(e) {- this.id = GI++, this.code = e, this.usedTimes = 0;+ this.id = ZS++, this.code = e, this.usedTimes = 0;}}-function VI(i, e, t, n, s, r, a) {- const o = new v0(), c = new HI(), l = /* @__PURE__ */ new Set(), h = [], u = s.logarithmicDepthBuffer, d = s.vertexTextures;+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;let f = s.precision;const p = {MeshDepthMaterial: "depth",@@ -21309,18 +21309,18 @@ function VI(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, N = q.geometry, O = C.isMeshStandardMaterial ? K.environment : null, Y = (C.isMeshStandardMaterial ? t : e).get(C.envMap || O), Q = Y && Y.mapping === lh ? 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 === uh ? 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 = N.morphAttributes.position || N.morphAttributes.normal || N.morphAttributes.color, ae = ee !== void 0 ? ee.length : 0;- let ye = 0;- N.morphAttributes.position !== void 0 && (ye = 1), N.morphAttributes.normal !== void 0 && (ye = 2), N.morphAttributes.color !== void 0 && (ye = 3);+ 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];Me = Ct.vertexShader, se = Ct.fragmentShader;} elseMe = 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, It = !!C.map, ht = !!C.matcap, $e = !!Y, H = !!C.aoMap, xn = !!C.lightMap, pt = !!C.bumpMap, gt = !!C.normalMap, We = !!C.displacementMap, Nt = !!C.emissiveMap, ze = !!C.metalnessMap, L = !!C.roughnessMap, M = C.anisotropy > 0, Z = C.clearcoat > 0, le = C.dispersion > 0, pe = C.iridescence > 0, oe = C.sheen > 0, Qe = C.transmission > 0, ve = M && !!C.anisotropyMap, qe = Z && !!C.clearcoatMap, Je = Z && !!C.clearcoatNormalMap, Ee = Z && !!C.clearcoatRoughnessMap, Re = pe && !!C.iridescenceMap, Oe = pe && !!C.iridescenceThicknessMap, Ge = oe && !!C.sheenColorMap, Be = oe && !!C.sheenRoughnessMap, tt = !!C.specularMap, Ke = !!C.specularColorMap, nt = !!C.specularIntensityMap, W = Qe && !!C.transmissionMap, ne = Qe && !!C.thicknessMap, re = !!C.gradientMap, de = !!C.alphaMap, Ie = C.alphaTest > 0, Ce = !!C.alphaHash, it = !!C.extensions;+ const be = i.getRenderTarget(), Ue = i.state.buffers.depth.getReversed(), et = q.isInstancedMesh === !0, He = q.isBatchedMesh === !0, St = !!C.map, ht = !!C.matcap, $e = !!Y, H = !!C.aoMap, xn = !!C.lightMap, pt = !!C.bumpMap, gt = !!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, pe = C.iridescence > 0, oe = C.sheen > 0, Qe = C.transmission > 0, ve = M && !!C.anisotropyMap, qe = Z && !!C.clearcoatMap, Je = Z && !!C.clearcoatNormalMap, Ee = Z && !!C.clearcoatRoughnessMap, Re = pe && !!C.iridescenceMap, Oe = pe && !!C.iridescenceThicknessMap, Ge = oe && !!C.sheenColorMap, Be = oe && !!C.sheenRoughnessMap, tt = !!C.specularMap, Ke = !!C.specularColorMap, nt = !!C.specularIntensityMap, W = Qe && !!C.transmissionMap, ne = Qe && !!C.thicknessMap, re = !!C.gradientMap, de = !!C.alphaMap, Se = C.alphaTest > 0, Ce = !!C.alphaHash, it = !!C.extensions;let Qt = Hs;C.toneMapped && (be === null || be.isXRRenderTarget === !0) && (Qt = i.toneMapping);const bn = {@@ -21343,7 +21343,7 @@ function VI(i, e, t, n, s, r, a) {supportsVertexTextures: d,outputColorSpace: be === null ? i.outputColorSpace : be.isXRRenderTarget === !0 ? be.texture.colorSpace : An,alphaToCoverage: !!C.alphaToCoverage,- map: It,+ map: St,matcap: ht,envMap: $e,envMapMode: $e && Y.mapping,@@ -21353,9 +21353,9 @@ function VI(i, e, t, n, s, r, a) {bumpMap: pt,normalMap: gt,displacementMap: d && We,- emissiveMap: Nt,- normalMapObjectSpace: gt && C.normalMapType === y_,- normalMapTangentSpace: gt && C.normalMapType === hh,+ emissiveMap: Dt,+ normalMapObjectSpace: gt && C.normalMapType === Ny,+ normalMapTangentSpace: gt && C.normalMapType === dh,metalnessMap: ze,roughnessMap: L,anisotropy: M,@@ -21378,19 +21378,19 @@ function VI(i, e, t, n, s, r, a) {transmissionMap: W,thicknessMap: ne,gradientMap: re,- opaque: C.transparent === !1 && C.blending === ya && C.alphaToCoverage === !1,+ opaque: C.transparent === !1 && C.blending === va && C.alphaToCoverage === !1,alphaMap: de,- alphaTest: Ie,+ alphaTest: Se,alphaHash: Ce,combine: C.combine,//- mapUv: It && m(C.map.channel),+ mapUv: St && m(C.map.channel),aoMapUv: H && m(C.aoMap.channel),lightMapUv: xn && m(C.lightMap.channel),bumpMapUv: pt && m(C.bumpMap.channel),normalMapUv: gt && m(C.normalMap.channel),displacementMapUv: We && m(C.displacementMap.channel),- emissiveMapUv: Nt && m(C.emissiveMap.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),@@ -21408,10 +21408,10 @@ function VI(i, e, t, n, s, r, a) {thicknessMapUv: ne && m(C.thicknessMap.channel),alphaMapUv: de && m(C.alphaMap.channel),//- vertexTangents: !!N.attributes.tangent && (gt || M),+ vertexTangents: !!D.attributes.tangent && (gt || M),vertexColors: C.vertexColors,- vertexAlphas: C.vertexColors === !0 && !!N.attributes.color && N.attributes.color.itemSize === 4,- pointsUvs: q.isPoints === !0 && !!N.attributes.uv && (It || de),+ vertexAlphas: C.vertexColors === !0 && !!D.attributes.color && D.attributes.color.itemSize === 4,+ pointsUvs: q.isPoints === !0 && !!D.attributes.uv && (St || de),fog: !!$,useFog: C.fog === !0,fogExp2: !!$ && $.isFogExp2,@@ -21420,11 +21420,11 @@ function VI(i, e, t, n, s, r, a) {logarithmicDepthBuffer: u,reverseDepthBuffer: Ue,skinning: q.isSkinnedMesh === !0,- morphTargets: N.morphAttributes.position !== void 0,- morphNormals: N.morphAttributes.normal !== void 0,- morphColors: N.morphAttributes.color !== void 0,+ morphTargets: D.morphAttributes.position !== void 0,+ morphNormals: D.morphAttributes.normal !== void 0,+ morphColors: D.morphAttributes.color !== void 0,morphTargetsCount: ae,- morphTextureStride: ye,+ morphTextureStride: _e,numDirLights: v.directional.length,numPointLights: v.point.length,numSpotLights: v.spot.length,@@ -21442,8 +21442,8 @@ function VI(i, e, t, n, s, r, a) {shadowMapEnabled: i.shadowMap.enabled && F.length > 0,shadowMapType: i.shadowMap.type,toneMapping: Qt,- decodeVideoTexture: It && C.map.isVideoTexture === !0 && rt.getTransfer(C.map.colorSpace) === Rt,- decodeVideoTextureEmissive: Nt && C.emissiveMap.isVideoTexture === !0 && rt.getTransfer(C.emissiveMap.colorSpace) === Rt,+ 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,@@ -21462,9 +21462,9 @@ function VI(i, e, t, n, s, r, a) {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 && (y(v, C), x(v, C), v.push(i.outputColorSpace)), v.push(C.customProgramCacheKey), v.join();+ return C.isRawShaderMaterial === !1 && (_(v, C), x(v, C), v.push(i.outputColorSpace)), v.push(C.customProgramCacheKey), v.join();}- function y(C, v) {+ 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) {@@ -21475,12 +21475,12 @@ function VI(i, e, t, n, s, r, a) {let F;if (v) {const K = ki[v];- F = gy.clone(K.uniforms);+ F = S_.clone(K.uniforms);} elseF = C.uniforms;return F;}- function I(C, v) {+ function S(C, v) {let F;for (let K = 0, q = h.length; K < q; K++) {const $ = h[K];@@ -21489,7 +21489,7 @@ function VI(i, e, t, n, s, r, a) {break;}}- return F === void 0 && (F = new QI(i, v, C, r), h.push(F)), F;+ return F === void 0 && (F = new JS(i, v, C, r), h.push(F)), F;}function w(C) {if (--C.usedTimes === 0) {@@ -21497,7 +21497,7 @@ function VI(i, e, t, n, s, r, a) {h[v] = h[h.length - 1], h.pop(), C.destroy();}}- function S(C) {+ function I(C) {c.remove(C);}function T() {@@ -21507,15 +21507,15 @@ function VI(i, e, t, n, s, r, a) {getParameters: g,getProgramCacheKey: A,getUniforms: E,- acquireProgram: I,+ acquireProgram: S,releaseProgram: w,- releaseShaderCache: S,+ releaseShaderCache: I,// Exposed for resource monitoring & error feedback via renderer.info:programs: h,dispose: T};}-function WI() {+function n1() {let i = /* @__PURE__ */ new WeakMap();function e(a) {return i.has(a);@@ -21541,13 +21541,13 @@ function WI() {dispose: r};}-function qI(i, e) {+function i1(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 JA(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 XA() {+function ZA() {const i = [];let e = 0;const t = [], n = [], s = [];@@ -21576,7 +21576,7 @@ function XA() {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 || qI), n.length > 1 && n.sort(d || jA), s.length > 1 && s.sort(d || jA);+ t.length > 1 && t.sort(u || i1), n.length > 1 && n.sort(d || JA), s.length > 1 && s.sort(d || JA);}function h() {for (let u = e, d = i.length; u < d; u++) {@@ -21596,12 +21596,12 @@ function XA() {sort: l};}-function KI() {+function s1() {let i = /* @__PURE__ */ new WeakMap();function e(n, s) {const r = i.get(n);let a;- return r === void 0 ? (a = new XA(), i.set(n, [a])) : s >= r.length ? (a = new XA(), r.push(a)) : a = r[s], 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;}function t() {i = /* @__PURE__ */ new WeakMap();@@ -21611,7 +21611,7 @@ function KI() {dispose: t};}-function jI() {+function r1() {const i = {};return {get: function(e) {@@ -21664,7 +21664,7 @@ function jI() {}};}-function XI() {+function a1() {const i = {};return {get: function(e) {@@ -21706,12 +21706,12 @@ function XI() {}};}-let YI = 0;-function JI(i, e) {+let o1 = 0;+function c1(i, e) {return (e.castShadow ? 2 : 0) - (i.castShadow ? 2 : 0) + (e.map ? 1 : 0) - (i.map ? 1 : 0);}-function ZI(i) {- const e = new jI(), t = XI(), n = {+function l1(i) {+ const e = new r1(), t = a1(), n = {version: 0,hash: {directionalLength: -1,@@ -21748,34 +21748,34 @@ function ZI(i) {numLightProbes: 0};for (let l = 0; l < 9; l++) n.probe.push(new G());- const s = new G(), r = new De(), a = new De();+ const s = new G(), r = new Ne(), a = new Ne();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, y = 0, x = 0, E = 0, I = 0, w = 0, S = 0;- l.sort(JI);+ 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);for (let C = 0, v = l.length; C < v; C++) {- const F = l[C], K = F.color, q = F.intensity, $ = F.distance, N = F.shadow && F.shadow.map ? F.shadow.map.texture : null;+ 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);- S++;+ 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] = N, n.directionalShadowMatrix[f] = F.shadow.matrix, y++;+ 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[I] = F.map, I++, Y.updateMatrices(F), F.castShadow && w++), n.spotLightMatrix[m] = Y.matrix, F.castShadow) {+ 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] = N, E++;+ 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) {@@ -21785,7 +21785,7 @@ function ZI(i) {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] = N, n.pointShadowMatrix[p] = F.shadow.matrix, x++;+ 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) {@@ -21795,12 +21795,12 @@ function ZI(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 !== y || T.numPointShadows !== x || T.numSpotShadows !== E || T.numSpotMaps !== I || T.numLightProbes !== S) && (n.directional.length = f, n.spot.length = m, n.rectArea.length = g, n.point.length = p, n.hemi.length = A, n.directionalShadow.length = y, n.directionalShadowMap.length = y, n.pointShadow.length = x, n.pointShadowMap.length = x, n.spotShadow.length = E, n.spotShadowMap.length = E, n.directionalShadowMatrix.length = y, n.pointShadowMatrix.length = x, n.spotLightMatrix.length = E + I - w, n.spotLightMap.length = I, n.numSpotLightShadowsWithMaps = w, n.numLightProbes = S, T.directionalLength = f, T.pointLength = p, T.spotLength = m, T.rectAreaLength = g, T.hemiLength = A, T.numDirectionalShadows = y, T.numPointShadows = x, T.numSpotShadows = E, T.numSpotMaps = I, T.numLightProbes = S, n.version = YI++);+ (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++);}function c(l, h) {let u = 0, d = 0, f = 0, p = 0, m = 0;const g = h.matrixWorldInverse;- for (let A = 0, y = l.length; A < y; A++) {+ for (let A = 0, _ = l.length; A < _; A++) {const x = l[A];if (x.isDirectionalLight) {const E = n.directional[u];@@ -21826,8 +21826,8 @@ function ZI(i) {state: n};}-function YA(i) {- const e = new ZI(i), t = [], n = [];+function $A(i) {+ const e = new l1(i), t = [], n = [];function s(h) {l.camera = h, t.length = 0, n.length = 0;}@@ -21859,12 +21859,12 @@ function YA(i) {pushShadow: a};}-function $I(i) {+function h1(i) {let e = /* @__PURE__ */ new WeakMap();function t(s, r = 0) {const a = e.get(s);let o;- return a === void 0 ? (o = new YA(i), e.set(s, [o])) : r >= a.length ? (o = new YA(i), a.push(o)) : o = a[r], 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;}function n() {e = /* @__PURE__ */ new WeakMap();@@ -21874,9 +21874,9 @@ function $I(i) {dispose: n};}-const e1 = `void main() {+const u1 = `void main() {gl_Position = vec4( position, 1.0 );-}`, t1 = `uniform sampler2D shadow_pass;+}`, d1 = `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 n1(i, e, t) {- let n = new zf();- const s = new Ze(), r = new Ze(), a = new mt(), o = new Zy({ depthPacking: __ }), c = new $y(), l = {}, h = t.maxTextureSize, u = { [bs]: Vn, [Vn]: bs, [Ui]: Ui }, d = new qs({+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({defines: {VSM_SAMPLES: 8},@@ -21914,8 +21914,8 @@ function n1(i, e, t) {resolution: { value: new Ze() },radius: { value: 4 }},- vertexShader: e1,- fragmentShader: t1+ vertexShader: u1,+ fragmentShader: d1}), f = d.clone();f.defines.HORIZONTAL_PASS = 1;const p = new Tn();@@ -21927,15 +21927,15 @@ function n1(i, e, t) {));const m = new Zt(p, d), g = this;- this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = o0;+ this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = d0;let A = this.type;- this.render = function(w, S, T) {+ 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;- for (let N = 0, O = w.length; N < O; N++) {- const Y = w[N], Q = Y.shadow;+ 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;@@ -21945,101 +21945,101 @@ function n1(i, e, t) {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 } : {};- Q.map !== null && Q.map.dispose(), Q.map = new Mr(s.x, s.y, ae), Q.map.texture.name = Y.name + ".shadowMap", Q.camera.updateProjectionMatrix();+ 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();const ee = Q.getViewportCount();for (let ae = 0; ae < ee; ae++) {- const ye = Q.getViewport(ae);+ const _e = Q.getViewport(ae);a.set(- r.x * ye.x,- r.y * ye.y,- r.x * ye.z,- r.y * ye.w- ), K.viewport(a), Q.updateMatrices(Y, ae), n = Q.getFrustum(), E(S, T, Q.camera, Y, this.type);+ 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 === $i && y(Q, T), Q.needsUpdate = !1;+ Q.isPointLightShadow !== !0 && this.type === $i && _(Q, T), Q.needsUpdate = !1;}A = this.type, g.needsUpdate = !1, i.setRenderTarget(C, v, F);};- function y(w, S) {+ 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 Mr(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(S, 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(S, null, T, f, m, null);+ 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 Rr(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, S, T, C) {+ 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 && S.clipShadows === !0 && Array.isArray(S.clippingPlanes) && S.clippingPlanes.length !== 0 || S.displacementMap && S.displacementScale !== 0 || S.alphaMap && S.alphaTest > 0 || S.map && S.alphaTest > 0 || S.alphaToCoverage === !0) {- const K = v.uuid, q = S.uuid;+ 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 N = $[q];- N === void 0 && (N = v.clone(), $[q] = N, S.addEventListener("dispose", I)), v = N;+ let D = $[q];+ D === void 0 && (D = v.clone(), $[q] = D, I.addEventListener("dispose", S)), v = D;}- if (v.visible = S.visible, v.wireframe = S.wireframe, C === $i ? v.side = S.shadowSide !== null ? S.shadowSide : S.side : v.side = S.shadowSide !== null ? S.shadowSide : u[S.side], v.alphaMap = S.alphaMap, v.alphaTest = S.alphaToCoverage === !0 ? 0.5 : S.alphaTest, v.map = S.map, v.clipShadows = S.clipShadows, v.clippingPlanes = S.clippingPlanes, v.clipIntersection = S.clipIntersection, v.displacementMap = S.displacementMap, v.displacementScale = S.displacementScale, v.displacementBias = S.displacementBias, v.wireframeLinewidth = S.wireframeLinewidth, v.linewidth = S.linewidth, T.isPointLight === !0 && v.isMeshDistanceMaterial === !0) {+ 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) {const K = i.properties.get(v);K.light = T;}return v;}- function E(w, S, T, C, v) {+ function E(w, I, T, C, v) {if (w.visible === !1) return;- if (w.layers.test(S.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 === $i) && (!w.frustumCulled || n.intersectsObject(w))) {w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse, w.matrixWorld);const q = e.update(w), $ = w.material;if (Array.isArray($)) {- const N = q.groups;- for (let O = 0, Y = N.length; O < Y; O++) {- const Q = N[O], J = $[Q.materialIndex];+ 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, S, T, q, ee, Q), i.renderBufferDirect(T, null, q, ee, w, Q), w.onAfterShadow(i, w, S, T, q, ee, Q);+ 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 N = x(w, $, C, v);- w.onBeforeShadow(i, w, S, T, q, N, null), i.renderBufferDirect(T, null, q, N, w, null), w.onAfterShadow(i, w, S, T, q, N, null);+ 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], S, T, C, v);+ E(K[q], I, T, C, v);}- function I(w) {- w.target.removeEventListener("dispose", I);+ 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 i1 = {- [cd]: ld,- [hd]: fd,- [ud]: pd,- [Fa]: dd,- [ld]: cd,- [fd]: hd,- [pd]: ud,- [dd]: Fa+const p1 = {+ [ud]: dd,+ [fd]: gd,+ [pd]: md,+ [Na]: Ad,+ [dd]: ud,+ [gd]: fd,+ [md]: pd,+ [Ad]: Na};-function s1(i, e) {+function A1(i, e) {function t() {let W = !1;const ne = new mt();let re = null;const de = new mt(0, 0, 0, 0);return {- setMask: function(Ie) {- re !== Ie && !W && (i.colorMask(Ie, Ie, Ie, Ie), re = Ie);+ setMask: function(Se) {+ re !== Se && !W && (i.colorMask(Se, Se, Se, Se), re = Se);},- setLocked: function(Ie) {- W = Ie;+ setLocked: function(Se) {+ W = Se;},- setClear: function(Ie, Ce, it, Qt, bn) {- bn === !0 && (Ie *= Qt, Ce *= Qt, it *= Qt), ne.set(Ie, Ce, it, Qt), de.equals(ne) === !1 && (i.clearColor(Ie, Ce, it, Qt), de.copy(ne));+ setClear: function(Se, Ce, it, Qt, bn) {+ bn === !0 && (Se *= Qt, Ce *= Qt, it *= Qt), ne.set(Se, Ce, it, Qt), de.equals(ne) === !1 && (i.clearColor(Se, Ce, it, Qt), de.copy(ne));},reset: function() {W = !1, re = null, de.set(-1, 0, 0, 0);@@ -22047,14 +22047,14 @@ function s1(i, e) {};}function n() {- let W = !1, ne = !1, re = null, de = null, Ie = null;+ let W = !1, ne = !1, re = null, de = null, Se = null;return {setReversed: function(Ce) {if (ne !== Ce) {const it = e.get("EXT_clip_control");Ce ? it.clipControlEXT(it.LOWER_LEFT_EXT, it.ZERO_TO_ONE_EXT) : it.clipControlEXT(it.LOWER_LEFT_EXT, it.NEGATIVE_ONE_TO_ONE_EXT), ne = Ce;- const Qt = Ie;- Ie = null, this.setClear(Qt);+ const Qt = Se;+ Se = null, this.setClear(Qt);}},getReversed: function() {@@ -22067,30 +22067,30 @@ function s1(i, e) {re !== Ce && !W && (i.depthMask(Ce), re = Ce);},setFunc: function(Ce) {- if (ne && (Ce = i1[Ce]), de !== Ce) {+ if (ne && (Ce = p1[Ce]), de !== Ce) {switch (Ce) {- case cd:+ case ud:i.depthFunc(i.NEVER);break;- case ld:+ case dd:i.depthFunc(i.ALWAYS);break;- case hd:+ case fd:i.depthFunc(i.LESS);break;- case Fa:+ case Na:i.depthFunc(i.LEQUAL);break;- case ud:+ case pd:i.depthFunc(i.EQUAL);break;- case dd:+ case Ad:i.depthFunc(i.GEQUAL);break;- case fd:+ case gd:i.depthFunc(i.GREATER);break;- case pd:+ case md:i.depthFunc(i.NOTEQUAL);break;default:@@ -22103,15 +22103,15 @@ function s1(i, e) {W = Ce;},setClear: function(Ce) {- Ie !== Ce && (ne && (Ce = 1 - Ce), i.clearDepth(Ce), Ie = Ce);+ Se !== Ce && (ne && (Ce = 1 - Ce), i.clearDepth(Ce), Se = Ce);},reset: function() {- W = !1, re = null, de = null, Ie = null, ne = !1;+ W = !1, re = null, de = null, Se = null, ne = !1;}};}function s() {- let W = !1, ne = null, re = null, de = null, Ie = null, Ce = null, it = null, Qt = null, bn = null;+ let W = !1, ne = null, re = null, de = null, Se = null, Ce = null, it = null, Qt = null, bn = null;return {setTest: function(Ct) {W || (Ct ? be(i.STENCIL_TEST) : Ue(i.STENCIL_TEST));@@ -22120,7 +22120,7 @@ function s1(i, e) {ne !== Ct && !W && (i.stencilMask(Ct), ne = Ct);},setFunc: function(Ct, Yn, Ai) {- (re !== Ct || de !== Yn || Ie !== Ai) && (i.stencilFunc(Ct, Yn, Ai), re = Ct, de = Yn, Ie = Ai);+ (re !== Ct || de !== Yn || Se !== Ai) && (i.stencilFunc(Ct, Yn, Ai), re = Ct, de = Yn, Se = Ai);},setOp: function(Ct, Yn, Ai) {(Ce !== Ct || it !== Yn || Qt !== Ai) && (i.stencilOp(Ct, Yn, Ai), Ce = Ct, it = Yn, Qt = Ai);@@ -22132,27 +22132,27 @@ function s1(i, e) {bn !== Ct && (i.clearStencil(Ct), bn = Ct);},reset: function() {- W = !1, ne = null, re = null, de = null, Ie = null, Ce = null, it = null, Qt = null, bn = null;+ W = !1, ne = null, re = null, de = null, Se = null, Ce = null, it = null, Qt = null, bn = null;}};}const r = new t(), a = new n(), o = new s(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();- let h = {}, u = {}, d = /* @__PURE__ */ new WeakMap(), f = [], p = null, m = !1, g = null, A = null, y = null, x = null, E = null, I = null, w = null, S = new Le(0, 0, 0), T = 0, C = !1, v = null, F = null, K = null, q = null, $ = null;- const N = i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);+ let h = {}, u = {}, d = /* @__PURE__ */ new WeakMap(), f = [], p = null, m = !1, g = null, A = null, _ = null, x = null, E = null, S = null, w = null, I = new Le(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), ye = i.getParameter(i.VIEWPORT), Me = new mt().fromArray(ae), se = new mt().fromArray(ye);+ const ae = i.getParameter(i.SCISSOR_BOX), _e = i.getParameter(i.VIEWPORT), Me = new mt().fromArray(ae), se = new mt().fromArray(_e);function me(W, ne, re, de) {- const Ie = new Uint8Array(4), Ce = i.createTexture();+ const Se = new Uint8Array(4), Ce = i.createTexture();i.bindTexture(W, Ce), i.texParameteri(W, i.TEXTURE_MIN_FILTER, i.NEAREST), i.texParameteri(W, i.TEXTURE_MAG_FILTER, i.NEAREST);for (let it = 0; it < re; it++)- W === i.TEXTURE_3D || W === i.TEXTURE_2D_ARRAY ? i.texImage3D(ne, 0, i.RGBA, 1, 1, de, 0, i.RGBA, i.UNSIGNED_BYTE, Ie) : i.texImage2D(ne + it, 0, i.RGBA, 1, 1, 0, i.RGBA, i.UNSIGNED_BYTE, Ie);+ 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 + it, 0, i.RGBA, 1, 1, 0, i.RGBA, i.UNSIGNED_BYTE, Se);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(Fa), pt(!1), gt(Fp), 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(Na), pt(!1), gt(Lp), be(i.CULL_FACE), H(Gs);function be(W) {h[W] !== !0 && (i.enable(W), h[W] = !0);}@@ -22166,61 +22166,61 @@ function s1(i, e) {let re = f, de = !1;if (W) {re = d.get(ne), re === void 0 && (re = [], d.set(ne, re));- const Ie = W.textures;- if (re.length !== Ie.length || re[0] !== i.COLOR_ATTACHMENT0) {- for (let Ce = 0, it = Ie.length; Ce < it; Ce++)+ const Se = W.textures;+ if (re.length !== Se.length || re[0] !== i.COLOR_ATTACHMENT0) {+ for (let Ce = 0, it = Se.length; Ce < it; Ce++)re[Ce] = i.COLOR_ATTACHMENT0 + Ce;- re.length = Ie.length, de = !0;+ re.length = Se.length, de = !0;}} elsere[0] !== i.BACK && (re[0] = i.BACK, de = !0);de && i.drawBuffers(re);}- function It(W) {+ function St(W) {return p !== W ? (i.useProgram(W), p = W, !0) : !1;}const ht = {- [fr]: i.FUNC_ADD,- [qE]: i.FUNC_SUBTRACT,- [KE]: i.FUNC_REVERSE_SUBTRACT+ [pr]: i.FUNC_ADD,+ [iy]: i.FUNC_SUBTRACT,+ [sy]: i.FUNC_REVERSE_SUBTRACT};- ht[jE] = i.MIN, ht[XE] = i.MAX;+ ht[ry] = i.MIN, ht[ay] = i.MAX;const $e = {- [YE]: i.ZERO,- [JE]: i.ONE,- [ZE]: i.SRC_COLOR,- [ad]: i.SRC_ALPHA,- [s_]: i.SRC_ALPHA_SATURATE,- [n_]: i.DST_COLOR,- [e_]: i.DST_ALPHA,- [$E]: i.ONE_MINUS_SRC_COLOR,- [od]: i.ONE_MINUS_SRC_ALPHA,- [i_]: i.ONE_MINUS_DST_COLOR,- [t_]: i.ONE_MINUS_DST_ALPHA,- [r_]: i.CONSTANT_COLOR,- [a_]: i.ONE_MINUS_CONSTANT_COLOR,- [o_]: i.CONSTANT_ALPHA,- [c_]: i.ONE_MINUS_CONSTANT_ALPHA+ [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};- function H(W, ne, re, de, Ie, Ce, it, Qt, bn, Ct) {+ 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 !== WE) {+ if (m === !1 && (be(i.BLEND), m = !0), W !== ny) {if (W !== g || Ct !== C) {- if ((A !== fr || E !== fr) && (i.blendEquation(i.FUNC_ADD), A = fr, E = fr), Ct)+ if ((A !== pr || E !== pr) && (i.blendEquation(i.FUNC_ADD), A = pr, E = pr), Ct)switch (W) {- case ya:+ case va:i.blendFuncSeparate(i.ONE, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);break;- case Dp:+ case Pp:i.blendFunc(i.ONE, i.ONE);break;- case Np:+ case kp:i.blendFuncSeparate(i.ZERO, i.ONE_MINUS_SRC_COLOR, i.ZERO, i.ONE);break;- case Lp:+ case Up:i.blendFuncSeparate(i.ZERO, i.SRC_COLOR, i.ZERO, i.SRC_ALPHA);break;default:@@ -22229,55 +22229,55 @@ function s1(i, e) {}elseswitch (W) {- case ya:+ case va:i.blendFuncSeparate(i.SRC_ALPHA, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);break;- case Dp:+ case Pp:i.blendFunc(i.SRC_ALPHA, i.ONE);break;- case Np:+ case kp:i.blendFuncSeparate(i.ZERO, i.ONE_MINUS_SRC_COLOR, i.ZERO, i.ONE);break;- case Lp:+ case Up:i.blendFunc(i.ZERO, i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ", W);break;}- y = null, x = null, I = null, w = null, S.set(0, 0, 0), T = 0, g = W, C = Ct;+ _ = null, x = null, S = null, w = null, I.set(0, 0, 0), T = 0, g = W, C = Ct;}return;}- Ie = Ie || ne, Ce = Ce || re, it = it || de, (ne !== A || Ie !== E) && (i.blendEquationSeparate(ht[ne], ht[Ie]), A = ne, E = Ie), (re !== y || de !== x || Ce !== I || it !== w) && (i.blendFuncSeparate($e[re], $e[de], $e[Ce], $e[it]), y = re, x = de, I = Ce, w = it), (Qt.equals(S) === !1 || bn !== T) && (i.blendColor(Qt.r, Qt.g, Qt.b, bn), S.copy(Qt), T = bn), g = W, C = !1;+ 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 === ya && 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);+ 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);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)), Nt(W.polygonOffset, W.polygonOffsetFactor, W.polygonOffsetUnits), W.alphaToCoverage === !0 ? be(i.SAMPLE_ALPHA_TO_COVERAGE) : Ue(i.SAMPLE_ALPHA_TO_COVERAGE);+ 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 gt(W) {- W !== HE ? (be(i.CULL_FACE), W !== F && (W === Fp ? i.cullFace(i.BACK) : W === zE ? i.cullFace(i.FRONT) : i.cullFace(i.FRONT_AND_BACK))) : Ue(i.CULL_FACE), F = 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;}function We(W) {W !== K && (O && i.lineWidth(W), K = W);}- function Nt(W, ne, re) {+ 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 + N - 1), J !== W && (i.activeTexture(W), J = 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 + N - 1 : re = J);+ 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);}@@ -22372,7 +22372,7 @@ function s1(i, e) {c.get(ne) !== de && (i.uniformBlockBinding(ne, de, W.__bindingPointIndex), c.set(ne, de));}function nt() {- 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 = /* @__PURE__ */ new WeakMap(), f = [], p = null, m = !1, g = null, A = null, y = null, x = null, E = null, I = null, w = null, S = new Le(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();+ 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 = /* @__PURE__ */ new WeakMap(), f = [], p = null, m = !1, g = null, A = null, _ = null, x = null, E = null, S = null, w = null, I = new Le(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: {@@ -22384,13 +22384,13 @@ function s1(i, e) {disable: Ue,bindFramebuffer: et,drawBuffers: He,- useProgram: It,+ useProgram: St,setBlending: H,setMaterial: xn,setFlipSided: pt,setCullFace: gt,setLineWidth: We,- setPolygonOffset: Nt,+ setPolygonOffset: Dt,setScissorTest: ze,activeTexture: L,bindTexture: M,@@ -22412,7 +22412,7 @@ function s1(i, e) {reset: nt};}-function r1(i, e, t, n, s, r, a) {+function g1(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 r1(i, e, t, n, s, r, a) {return f ? (// eslint-disable-next-line compat/compatnew OffscreenCanvas(L, M)- ) : qo("canvas");+ ) : jo("canvas");}function m(L, M, Z) {let le = 1;@@ -22446,7 +22446,7 @@ function r1(i, e, t, n, s, r, a) {function A(L) {i.generateMipmap(L);}- function y(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, pe = !1) {@@ -22456,25 +22456,25 @@ function r1(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 ? Gl : rt.getTransfer(le);+ const Qe = pe ? zl : 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 === Ir || M === Oo ? Z = i.DEPTH24_STENCIL8 : M === fn ? Z = i.DEPTH32F_STENCIL8 : M === Uo && (Z = i.DEPTH24_STENCIL8, console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : M === null || M === Ir || M === Oo ? Z = i.DEPTH_COMPONENT24 : M === fn ? Z = i.DEPTH_COMPONENT32F : M === Uo && (Z = i.DEPTH_COMPONENT16), 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;}- function I(L, M) {+ 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;}function w(L) {const M = L.target;M.removeEventListener("dispose", w), T(M), M.isVideoTexture && h.delete(M);}- function S(L) {+ function I(L) {const M = L.target;- M.removeEventListener("dispose", S), v(M);+ M.removeEventListener("dispose", I), v(M);}function T(L) {const M = n.get(L);@@ -22531,7 +22531,7 @@ function r1(i, e, t, n, s, r, a) {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 N(L, M) {+ 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;@@ -22573,27 +22573,27 @@ function r1(i, e, t, n, s, r, a) {const J = {[Ws]: i.REPEAT,[ti]: i.CLAMP_TO_EDGE,- [Dl]: i.MIRRORED_REPEAT+ [Ll]: i.MIRRORED_REPEAT}, ee = {[Wn]: i.NEAREST,- [h0]: i.NEAREST_MIPMAP_NEAREST,- [bo]: i.NEAREST_MIPMAP_LINEAR,+ [A0]: i.NEAREST_MIPMAP_NEAREST,+ [yo]: i.NEAREST_MIPMAP_LINEAR,[Xt]: i.LINEAR,- [yl]: i.LINEAR_MIPMAP_NEAREST,+ [vl]: i.LINEAR_MIPMAP_NEAREST,[hi]: i.LINEAR_MIPMAP_LINEAR}, ae = {- [w_]: i.NEVER,- [B_]: i.ALWAYS,- [v_]: i.LESS,- [E0]: i.LEQUAL,- [C_]: i.EQUAL,- [M_]: i.GEQUAL,- [S_]: i.GREATER,- [I_]: i.NOTEQUAL+ [Dy]: i.NEVER,+ [Qy]: i.ALWAYS,+ [Ly]: i.LESS,+ [C0]: i.LEQUAL,+ [Py]: i.EQUAL,+ [Oy]: i.GEQUAL,+ [ky]: i.GREATER,+ [Uy]: i.NOTEQUAL};- function ye(L, M) {- if (M.type === fn && e.has("OES_texture_float_linear") === !1 && (M.magFilter === Xt || M.magFilter === yl || M.magFilter === bo || M.magFilter === hi || M.minFilter === Xt || M.minFilter === yl || M.minFilter === bo || 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 !== bo && M.minFilter !== hi || M.type === fn && e.has("OES_texture_float_linear") === !1) return;+ 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.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;@@ -22628,14 +22628,14 @@ function r1(i, e, t, n, s, r, a) {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;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 = Nt(M, Ee);+ Ee = Dt(M, Ee);const Re = r.convert(M.format, M.colorSpace), Oe = r.convert(M.type);let Ge = x(M.internalFormat, Re, Oe, M.colorSpace, M.isVideoTexture);- ye(le, M);+ _e(le, M);let Be;- const tt = M.mipmaps, Ke = M.isVideoTexture !== !0, nt = Qe.__version === void 0 || pe === !0, W = oe.dataReady, ne = I(M, Ee);+ 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 === Go, 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 === 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));else if (M.isDataTexture)if (tt.length > 0) {Ke && nt && t.texStorage2D(i.TEXTURE_2D, ne, Ge, tt[0].width, tt[0].height);@@ -22653,11 +22653,11 @@ function r1(i, e, t, n, s, r, a) {if (Ke) {if (W)if (M.layerUpdates.size > 0) {- const Ie = IA(Be.width, Be.height, M.format, M.type);+ const Se = TA(Be.width, Be.height, M.format, M.type);for (const Ce of M.layerUpdates) {const it = Be.data.subarray(- Ce * Ie / Be.data.BYTES_PER_ELEMENT,- (Ce + 1) * Ie / Be.data.BYTES_PER_ELEMENT+ Ce * Se / Be.data.BYTES_PER_ELEMENT,+ (Ce + 1) * Se / Be.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY, re, 0, 0, Ce, Be.width, Be.height, 1, Re, it);}@@ -22679,13 +22679,13 @@ function r1(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 = IA(Ee.width, Ee.height, M.format, M.type);+ const re = TA(Ee.width, Ee.height, M.format, M.type);for (const de of M.layerUpdates) {- const Ie = Ee.data.subarray(+ 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, Re, Oe, Ie);+ t.texSubImage3D(i.TEXTURE_2D_ARRAY, 0, 0, 0, de, Ee.width, Ee.height, 1, Re, Oe, Se);}M.clearLayerUpdates();} else@@ -22700,8 +22700,8 @@ function r1(i, e, t, n, s, r, a) {t.texStorage2D(i.TEXTURE_2D, ne, Ge, Ee.width, Ee.height);else {let re = Ee.width, de = Ee.height;- for (let Ie = 0; Ie < ne; Ie++)- t.texImage2D(i.TEXTURE_2D, Ie, Ge, re, de, 0, Re, Oe, null), re >>= 1, de >>= 1;+ for (let Se = 0; Se < ne; Se++)+ t.texImage2D(i.TEXTURE_2D, Se, Ge, re, de, 0, Re, Oe, null), re >>= 1, de >>= 1;}} else if (tt.length > 0) {if (Ke && nt) {@@ -22734,18 +22734,18 @@ function r1(i, e, t, n, s, r, a) {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++)- !Je && !Ee ? Re[de] = m(M.image[de], !0, s.maxCubemapSize) : Re[de] = Ee ? M.image[de].image : M.image[de], Re[de] = Nt(M, Re[de]);+ !Je && !Ee ? Re[de] = m(M.image[de], !0, s.maxCubemapSize) : Re[de] = Ee ? M.image[de].image : M.image[de], Re[de] = Dt(M, Re[de]);const Oe = Re[0], Ge = r.convert(M.format, M.colorSpace), Be = r.convert(M.type), tt = x(M.internalFormat, Ge, Be, M.colorSpace), Ke = M.isVideoTexture !== !0, nt = oe.__version === void 0 || le === !0, W = pe.dataReady;- let ne = I(M, Oe);- ye(i.TEXTURE_CUBE_MAP, M);+ let ne = S(M, Oe);+ _e(i.TEXTURE_CUBE_MAP, M);let re;if (Je) {Ke && nt && t.texStorage2D(i.TEXTURE_CUBE_MAP, ne, tt, Oe.width, Oe.height);for (let de = 0; de < 6; de++) {re = Re[de].mipmaps;- for (let Ie = 0; Ie < re.length; Ie++) {- const Ce = re[Ie];- M.format !== pn ? Ge !== null ? Ke ? W && t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie, 0, 0, Ce.width, Ce.height, Ge, Ce.data) : t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie, tt, Ce.width, Ce.height, 0, Ce.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, Ie, 0, 0, Ce.width, Ce.height, Ge, Be, Ce.data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie, tt, Ce.width, Ce.height, 0, Ge, Be, Ce.data);+ for (let Se = 0; Se < re.length; Se++) {+ const Ce = re[Se];+ M.format !== pn ? Ge !== null ? Ke ? W && t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Se, 0, 0, Ce.width, Ce.height, Ge, Ce.data) : t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Se, tt, Ce.width, Ce.height, 0, Ce.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, Ce.width, Ce.height, Ge, Be, Ce.data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Se, tt, Ce.width, Ce.height, 0, Ge, Be, Ce.data);}}} else {@@ -22757,15 +22757,15 @@ function r1(i, e, t, n, s, r, a) {for (let de = 0; de < 6; de++)if (Ee) {Ke ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, 0, 0, Re[de].width, Re[de].height, Ge, Be, Re[de].data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, tt, Re[de].width, Re[de].height, 0, Ge, Be, Re[de].data);- for (let Ie = 0; Ie < re.length; Ie++) {- const it = re[Ie].image[de].image;- Ke ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, 0, 0, it.width, it.height, Ge, Be, it.data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, tt, it.width, it.height, 0, Ge, Be, it.data);+ for (let Se = 0; Se < re.length; Se++) {+ const it = re[Se].image[de].image;+ Ke ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Se + 1, 0, 0, it.width, it.height, Ge, Be, it.data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Se + 1, tt, it.width, it.height, 0, Ge, Be, it.data);}} else {Ke ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, 0, 0, Ge, Be, Re[de]) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, tt, Ge, Be, Re[de]);- for (let Ie = 0; Ie < re.length; Ie++) {- const Ce = re[Ie];- Ke ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, 0, 0, Ge, Be, Ce.image[de]) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, tt, Ge, Be, Ce.image[de]);+ for (let Se = 0; Se < re.length; Se++) {+ const Ce = re[Se];+ Ke ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Se + 1, 0, 0, Ge, Be, Ce.image[de]) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Se + 1, tt, Ge, Be, Ce.image[de]);}}}@@ -22799,11 +22799,11 @@ function r1(i, e, t, n, s, r, a) {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), N(M.depthTexture, 0);+ 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 === Qo)+ if (M.depthTexture.format === Ho)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 === Go)+ else if (M.depthTexture.format === zo)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);elsethrow new Error("Unknown depthTexture format");@@ -22848,9 +22848,9 @@ function r1(i, e, t, n, s, r, a) {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 It(L) {+ function St(L) {const M = L.texture, Z = n.get(L), le = n.get(M);- L.addEventListener("dispose", S);+ L.addEventListener("dispose", I);const pe = L.textures, oe = L.isWebGLCubeRenderTarget === !0, Qe = pe.length > 1;if (Qe || (le.__webglTexture === void 0 && (le.__webglTexture = i.createTexture()), le.__version = M.version, a.memory.textures++), oe) {Z.__webglFramebuffer = [];@@ -22885,7 +22885,7 @@ function r1(i, e, t, n, s, r, a) {}}if (oe) {- t.bindTexture(i.TEXTURE_CUBE_MAP, le.__webglTexture), ye(i.TEXTURE_CUBE_MAP, M);+ 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++)@@ -22896,12 +22896,12 @@ function r1(i, e, t, n, s, r, a) {} else if (Qe) {for (let ve = 0, qe = pe.length; ve < qe; ve++) {const Je = pe[ve], Ee = n.get(Je);- t.bindTexture(i.TEXTURE_2D, Ee.__webglTexture), ye(i.TEXTURE_2D, Je), xe(Z.__webglFramebuffer, L, Je, i.COLOR_ATTACHMENT0 + ve, i.TEXTURE_2D, 0), g(Je) && A(i.TEXTURE_2D);+ t.bindTexture(i.TEXTURE_2D, Ee.__webglTexture), _e(i.TEXTURE_2D, Je), xe(Z.__webglFramebuffer, L, Je, i.COLOR_ATTACHMENT0 + ve, i.TEXTURE_2D, 0), g(Je) && 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), ye(ve, M), M.mipmaps && M.mipmaps.length > 0)+ 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@@ -22915,7 +22915,7 @@ function r1(i, e, t, n, s, r, a) {for (let Z = 0, le = M.length; Z < le; Z++) {const pe = M[Z];if (g(pe)) {- const oe = y(L), Qe = n.get(pe).__webglTexture;+ const oe = _(L), Qe = n.get(pe).__webglTexture;t.bindTexture(oe, Qe), A(oe), t.unbindTexture();}}@@ -22965,113 +22965,113 @@ function r1(i, e, t, n, s, r, a) {const M = a.render.frame;h.get(L) !== M && (h.set(L, M), L.update());}- function Nt(L, M) {+ 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;}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 = N, this.setTexture2DArray = O, this.setTexture3D = Y, this.setTextureCube = Q, this.rebindTextures = He, this.setupRenderTarget = It, this.updateRenderTargetMipmap = ht, this.updateMultisampleRenderTarget = xn, this.setupDepthRenderbuffer = et, this.setupFrameBufferTexture = xe, this.useMultisampledRTT = gt;+ 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 a1(i, e) {+function m1(i, e) {function t(n, s = vi) {let r;const a = rt.getTransfer(s);if (n === un) return i.UNSIGNED_BYTE;- if (n === Df) return i.UNSIGNED_SHORT_4_4_4_4;- if (n === Nf) return i.UNSIGNED_SHORT_5_5_5_1;- if (n === f0) return i.UNSIGNED_INT_5_9_9_9_REV;- if (n === u0) return i.BYTE;- if (n === d0) return i.SHORT;- if (n === Uo) return i.UNSIGNED_SHORT;- if (n === Ff) return i.INT;- if (n === Ir) return i.UNSIGNED_INT;+ 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 === Tr) return i.UNSIGNED_INT;if (n === fn) return i.FLOAT;if (n === Qn) return i.HALF_FLOAT;- if (n === p0) return i.ALPHA;- if (n === A0) return i.RGB;+ if (n === b0) return i.ALPHA;+ if (n === E0) return i.RGB;if (n === pn) return i.RGBA;- if (n === Qo) return i.DEPTH_COMPONENT;- if (n === Go) return i.DEPTH_STENCIL;+ if (n === Ho) return i.DEPTH_COMPONENT;+ if (n === zo) return i.DEPTH_STENCIL;if (n === cs) return i.RED;- if (n === Lf) return i.RED_INTEGER;- if (n === xr) return i.RG;- if (n === Pf) return i.RG_INTEGER;- if (n === kf) return i.RGBA_INTEGER;- if (n === wl || n === Io || n === vl || n === Mo)+ if (n === Uf) 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 (a === Rt)if (r = e.get("WEBGL_compressed_texture_s3tc_srgb"), r !== null) {- if (n === wl) return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;- if (n === Io) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;- if (n === vl) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;- if (n === Mo) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;+ 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;} elsereturn null;else if (r = e.get("WEBGL_compressed_texture_s3tc"), r !== null) {- if (n === wl) return r.COMPRESSED_RGB_S3TC_DXT1_EXT;- if (n === Io) return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;- if (n === vl) return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;- if (n === Mo) return r.COMPRESSED_RGBA_S3TC_DXT5_EXT;+ 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;} elsereturn null;- if (n === Nl || n === md || n === Ll || n === xd)+ if (n === Pl || n === Ed || n === kl || n === yd)if (r = e.get("WEBGL_compressed_texture_pvrtc"), r !== null) {- if (n === Nl) return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;- if (n === md) return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;- if (n === Ll) return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;- if (n === xd) return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;+ 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;} elsereturn null;- if (n === Pl || n === kl || n === Ul)+ if (n === Ul || n === Ol || n === Ql)if (r = e.get("WEBGL_compressed_texture_etc"), r !== null) {- if (n === Pl || n === kl) return a === Rt ? r.COMPRESSED_SRGB8_ETC2 : r.COMPRESSED_RGB8_ETC2;- if (n === Ul) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : r.COMPRESSED_RGBA8_ETC2_EAC;+ 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;} elsereturn null;- if (n === Ho || n === bd || n === Ed || n === _d || n === zo || n === yd || n === wd || n === vd || n === Cd || n === Sd || n === Id || n === Md || n === Bd || n === Td)+ 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 (r = e.get("WEBGL_compressed_texture_astc"), r !== null) {- if (n === Ho) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : r.COMPRESSED_RGBA_ASTC_4x4_KHR;- if (n === bd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : r.COMPRESSED_RGBA_ASTC_5x4_KHR;- if (n === Ed) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : r.COMPRESSED_RGBA_ASTC_5x5_KHR;- if (n === _d) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : r.COMPRESSED_RGBA_ASTC_6x5_KHR;- if (n === zo) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : r.COMPRESSED_RGBA_ASTC_6x6_KHR;- if (n === yd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : r.COMPRESSED_RGBA_ASTC_8x5_KHR;- if (n === wd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : r.COMPRESSED_RGBA_ASTC_8x6_KHR;- if (n === vd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : r.COMPRESSED_RGBA_ASTC_8x8_KHR;- if (n === Cd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : r.COMPRESSED_RGBA_ASTC_10x5_KHR;- if (n === Sd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : r.COMPRESSED_RGBA_ASTC_10x6_KHR;- if (n === Id) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : r.COMPRESSED_RGBA_ASTC_10x8_KHR;- if (n === Md) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : r.COMPRESSED_RGBA_ASTC_10x10_KHR;- if (n === Bd) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : r.COMPRESSED_RGBA_ASTC_12x10_KHR;- if (n === Td) return a === Rt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : r.COMPRESSED_RGBA_ASTC_12x12_KHR;+ 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;} elsereturn null;- if (n === Bo || n === Rd || n === Ol)+ if (n === Ro || n === Dd || n === Gl)if (r = e.get("EXT_texture_compression_bptc"), r !== null) {- if (n === Bo) return a === Rt ? r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : r.COMPRESSED_RGBA_BPTC_UNORM_EXT;- if (n === Rd) return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;- if (n === Ol) return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;+ 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;} elsereturn null;- if (n === g0 || n === Fd || n === Dd || n === Nd)+ if (n === y0 || n === Ld || n === Pd || n === kd)if (r = e.get("EXT_texture_compression_rgtc"), r !== null) {- if (n === Bo) return r.COMPRESSED_RED_RGTC1_EXT;- if (n === Fd) return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;- if (n === Dd) return r.COMPRESSED_RED_GREEN_RGTC2_EXT;- if (n === Nd) return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;+ 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;} elsereturn null;- return n === Oo ? i.UNSIGNED_INT_24_8 : i[n] !== void 0 ? i[n] : null;+ return n === Go ? i.UNSIGNED_INT_24_8 : i[n] !== void 0 ? i[n] : null;}return { convert: t };}-const o1 = `+const x1 = `void main() {gl_Position = vec4( position, 1.0 );-}`, c1 = `+}`, b1 = `uniform sampler2DArray depthColor;uniform float depthWidth;uniform float depthHeight;@@ -23091,7 +23091,7 @@ void main() {}}`;-class l1 {+class E1 {/*** Constructs a new depth sensing module.*/@@ -23120,15 +23120,15 @@ class l1 {getMesh(e) {if (this.texture !== null && this.mesh === null) {const t = e.cameras[0].viewport, n = new qs({- vertexShader: o1,- fragmentShader: c1,+ vertexShader: x1,+ fragmentShader: b1,uniforms: {depthColor: { value: this.texture },depthWidth: { value: t.z },depthHeight: { value: t.w }}});- this.mesh = new Zt(new gh(20, 20), n);+ this.mesh = new Zt(new xh(20, 20), n);}return this.mesh;}@@ -23147,7 +23147,7 @@ class l1 {return this.texture;}}-class h1 extends Ys {+class y1 extends Js {/*** Constructs a new WebGL renderer.*@@ -23158,25 +23158,25 @@ class h1 extends Ys {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 l1(), g = t.getContextAttributes();- let A = null, y = null;- const x = [], E = [], I = new Ze();+ const m = new E1(), g = t.getContextAttributes();+ let A = null, _ = null;+ const x = [], E = [], S = new Ze();let w = null;- const S = new Sn();- S.viewport = new mt();- const T = new Sn();+ const I = new In();+ I.viewport = new mt();+ const T = new In();T.viewport = new mt();- const C = [S, T], v = new gw();+ const C = [I, T], v = new Sw();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 iu(), x[se] = me), me.getTargetRaySpace();+ return me === void 0 && (me = new au(), x[se] = me), me.getTargetRaySpace();}, this.getControllerGrip = function(se) {let me = x[se];- return me === void 0 && (me = new iu(), x[se] = me), me.getGripSpace();+ return me === void 0 && (me = new au(), x[se] = me), me.getGripSpace();}, this.getHand = function(se) {let me = x[se];- return me === void 0 && (me = new iu(), x[se] = me), me.getHandSpace();+ return me === void 0 && (me = new au(), x[se] = me), me.getHandSpace();};function q(se) {const me = E.indexOf(se.inputSource);@@ -23186,12 +23186,12 @@ class h1 extends Ys {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", N);+ 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, y = null, Me.stop(), n.isPresenting = !1, e.setPixelRatio(w), e.setSize(I.width, I.height, !1), n.dispatchEvent({ type: "sessionend" });+ 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.");@@ -23211,21 +23211,21 @@ class h1 extends Ys {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", N), g.xrCompatible !== !0 && await t.makeXRCompatible(), w = e.getPixelRatio(), e.getSize(I), typeof XRWebGLBinding < "u" && "createProjectionLayer" in XRWebGLBinding.prototype) {+ 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 ? Go : Qo, be = g.stencil ? Oo : Ir);+ g.depth && (Ue = g.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, xe = g.stencil ? zo : Ho, be = g.stencil ? Go : Tr);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), y = new Mr(+ u = new XRWebGLBinding(s, t), d = u.createProjectionLayer(et), s.updateRenderState({ layers: [d] }), e.setPixelRatio(1), e.setSize(d.textureWidth, d.textureHeight, !1), _ = new Rr(d.textureWidth,d.textureHeight,{format: pn,type: un,- depthTexture: new F0(d.textureWidth, d.textureHeight, be, void 0, void 0, void 0, void 0, void 0, void 0, xe),+ depthTexture: new k0(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,@@ -23241,7 +23241,7 @@ class h1 extends Ys {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), y = new Mr(+ f = new XRWebGLLayer(s, t, xe), s.updateRenderState({ baseLayer: f }), e.setPixelRatio(1), e.setSize(f.framebufferWidth, f.framebufferHeight, !1), _ = new Rr(f.framebufferWidth,f.framebufferHeight,{@@ -23254,7 +23254,7 @@ class h1 extends Ys {});}- y.isXRRenderTarget = !0, this.setFoveation(c), l = null, a = await s.requestReferenceSpace(o), Me.setContext(s), Me.start(), n.isPresenting = !0, n.dispatchEvent({ type: "sessionstart" });+ _.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)@@ -23262,7 +23262,7 @@ class h1 extends Ys {}, this.getDepthTexture = function() {return m.getDepthTexture();};- function N(se) {+ 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));@@ -23288,11 +23288,11 @@ class h1 extends Ys {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), It = Ue[14] / (Ue[10] + 1), ht = (Ue[9] + 1) / Ue[5], $e = (Ue[9] - 1) / Ue[5], H = (Ue[8] - 1) / Ue[0], xn = (et[8] + 1) / et[0], pt = He * H, gt = He * xn, We = be / (-H + xn), Nt = We * -H;- if (me.matrixWorld.decompose(se.position, se.quaternion, se.scale), se.translateX(Nt), se.translateZ(We), se.matrixWorld.compose(se.position, se.quaternion, se.scale), se.matrixWorldInverse.copy(se.matrixWorld).invert(), Ue[10] === -1)+ const be = O.distanceTo(Y), Ue = me.projectionMatrix.elements, et = xe.projectionMatrix.elements, He = Ue[14] / (Ue[10] - 1), St = Ue[14] / (Ue[10] + 1), ht = (Ue[9] + 1) / Ue[5], $e = (Ue[9] - 1) / Ue[5], H = (Ue[8] - 1) / Ue[0], xn = (et[8] + 1) / et[0], pt = He * H, gt = He * xn, We = be / (-H + xn), 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 = It + We, M = pt - Nt, Z = gt + (be - Nt), le = ht * It / L * ze, pe = $e * It / L * ze;+ const ze = He + We, L = St + We, M = pt - Dt, Z = gt + (be - Dt), le = ht * St / L * ze, pe = $e * St / L * ze;se.projectionMatrix.makePerspective(M, Z, le, pe, ze, L), se.projectionMatrixInverse.copy(se.projectionMatrix).invert();}}@@ -23302,18 +23302,18 @@ class h1 extends Ys {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 = S.near = me, v.far = T.far = S.far = xe, (F !== v.near || K !== v.far) && (s.updateRenderState({+ 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), S.layers.mask = se.layers.mask | 2, T.layers.mask = se.layers.mask | 4, v.layers.mask = S.layers.mask | T.layers.mask;+ }), 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, S, T) : v.projectionMatrix.copy(S.projectionMatrix), ee(se, v, 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 = Na * 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 = La * 2 * Math.atan(1 / se.projectionMatrix.elements[5]), se.zoom = 1);}this.getCamera = function() {return v;@@ -23328,27 +23328,27 @@ class h1 extends Ys {return m.getMesh(v);};let ae = null;- function ye(se, me) {+ function _e(se, me) {if (h = me.getViewerPose(l || a), p = me, h !== null) {const xe = h.views;- f !== null && (e.setRenderTargetFramebuffer(y, f.framebuffer), e.setRenderTarget(y));+ 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 It = xe[He];+ const St = xe[He];let ht = null;if (f !== null)- ht = f.getViewport(It);+ ht = f.getViewport(St);else {- const H = u.getViewSubImage(d, It);+ const H = u.getViewSubImage(d, St);ht = H.viewport, He === 0 && (e.setRenderTargetTextures(- y,+ _,H.colorTexture,H.depthStencilTexture- ), e.setRenderTarget(y));+ ), e.setRenderTarget(_));}let $e = C[He];- $e === void 0 && ($e = new Sn(), $e.layers.enable(He), $e.viewport = new mt(), C[He] = $e), $e.matrix.fromArray(It.transform.matrix), $e.matrix.decompose($e.position, $e.quaternion, $e.scale), $e.projectionMatrix.fromArray(It.projectionMatrix), $e.projectionMatrixInverse.copy($e.projectionMatrix).invert(), $e.viewport.set(ht.x, ht.y, ht.width, ht.height), He === 0 && (v.matrix.copy($e.matrix), v.matrix.decompose(v.position, v.quaternion, v.scale)), be === !0 && v.cameras.push($e);+ $e === void 0 && ($e = new In(), $e.layers.enable(He), $e.viewport = new mt(), C[He] = $e), $e.matrix.fromArray(St.transform.matrix), $e.matrix.decompose($e.position, $e.quaternion, $e.scale), $e.projectionMatrix.fromArray(St.projectionMatrix), $e.projectionMatrixInverse.copy($e.projectionMatrix).invert(), $e.viewport.set(ht.x, ht.y, ht.width, ht.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) {@@ -23362,28 +23362,28 @@ class h1 extends Ys {}ae && ae(se, me), me.detectedPlanes && n.dispatchEvent({ type: "planesdetected", data: me }), p = null;}- const Me = new q0();- Me.setAnimationLoop(ye), this.setAnimationLoop = function(se) {+ const Me = new J0();+ Me.setAnimationLoop(_e), this.setAnimationLoop = function(se) {ae = se;}, this.dispose = function() {};}}-const ar = /* @__PURE__ */ new dn(), u1 = /* @__PURE__ */ new De();-function d1(i, e) {+const or = /* @__PURE__ */ new dn(), _1 = /* @__PURE__ */ new Ne();+function w1(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, I0(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, F0(i)), A.isFog ? (g.fogNear.value = A.near, g.fogFar.value = A.far) : A.isFogExp2 && (g.fogDensity.value = A.density);}- function s(g, A, y, 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, y, 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 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);- const y = e.get(A), x = y.envMap, E = y.envMapRotation;- x && (g.envMap.value = x, ar.copy(E), ar.x *= -1, ar.y *= -1, ar.z *= -1, x.isCubeTexture && x.isRenderTargetTexture === !1 && (ar.y *= -1, ar.z *= -1), g.envMapRotation.value.setFromMatrix4(u1.makeRotationFromEuler(ar)), 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));+ 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));}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));@@ -23391,8 +23391,8 @@ function d1(i, e) {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, y, x) {- g.diffuse.value.copy(A.color), g.opacity.value = A.opacity, g.size.value = A.size * y, g.scale.value = x * 0.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 c(g, A, _, x) {+ g.diffuse.value.copy(A.color), g.opacity.value = A.opacity, g.size.value = A.size * _, g.scale.value = x * 0.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);@@ -23406,60 +23406,60 @@ function d1(i, e) {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, y) {- 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 = y.texture, g.transmissionSamplerSize.value.set(y.width, y.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 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));}function p(g, A) {A.matcap && (g.matcap.value = A.matcap);}function m(g, A) {- const y = e.get(A).light;- g.referencePosition.value.setFromMatrixPosition(y.matrixWorld), g.nearDistance.value = y.shadow.camera.near, g.farDistance.value = y.shadow.camera.far;+ 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 f1(i, e, t, n) {+function v1(i, e, t, n) {let s = {}, r = {}, a = [];const o = i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);- function c(y, x) {+ function c(_, x) {const E = x.program;- n.uniformBlockBinding(y, E);+ n.uniformBlockBinding(_, E);}- function l(y, x) {- let E = s[y.id];- E === void 0 && (p(y), E = h(y), s[y.id] = E, y.addEventListener("dispose", g));- const I = x.program;- n.updateUBOMapping(y, I);+ 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[y.id] !== w && (d(y), r[y.id] = w);+ r[_.id] !== w && (d(_), r[_.id] = w);}- function h(y) {+ function h(_) {const x = u();- y.__bindingPointIndex = x;- const E = i.createBuffer(), I = y.__size, w = y.usage;- return i.bindBuffer(i.UNIFORM_BUFFER, E), i.bufferData(i.UNIFORM_BUFFER, I, w), i.bindBuffer(i.UNIFORM_BUFFER, null), i.bindBufferBase(i.UNIFORM_BUFFER, x, E), E;+ _.__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 y = 0; y < o; y++)- if (a.indexOf(y) === -1)- return a.push(y), y;+ 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(y) {- const x = s[y.id], E = y.uniforms, I = y.__cache;+ function d(_) {+ const x = s[_.id], E = _.uniforms, S = _.__cache;i.bindBuffer(i.UNIFORM_BUFFER, x);- for (let w = 0, S = E.length; w < S; w++) {+ 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, I) === !0) {+ if (f(F, w, C, S) === !0) {const K = F.__offset, q = Array.isArray(F.value) ? F.value : [F.value];let $ = 0;- for (let N = 0; N < q.length; N++) {- const O = q[N], Y = m(O);+ 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);@@ -23468,55 +23468,55 @@ function f1(i, e, t, n) {}i.bindBuffer(i.UNIFORM_BUFFER, null);}- function f(y, x, E, I) {- const w = y.value, S = x + "_" + E;- if (I[S] === void 0)- return typeof w == "number" || typeof w == "boolean" ? I[S] = w : I[S] = w.clone(), !0;+ 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 = I[S];+ const T = S[I];if (typeof w == "number" || typeof w == "boolean") {if (T !== w)- return I[S] = w, !0;+ return S[I] = w, !0;} else if (T.equals(w) === !1)return T.copy(w), !0;}return !1;}- function p(y) {- const x = y.uniforms;+ function p(_) {+ const x = _.uniforms;let E = 0;- const I = 16;- for (let S = 0, T = x.length; S < T; S++) {- const C = Array.isArray(x[S]) ? x[S] : [x[S]];+ 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, N = q.length; $ < N; $++) {- const O = q[$], Y = m(O), Q = E % I, J = Q % Y.boundary, ee = Q + J;- E += J, ee !== 0 && I - ee < Y.storage && (E += I - ee), K.__data = new Float32Array(Y.storage / Float32Array.BYTES_PER_ELEMENT), K.__offset = E, E += Y.storage;+ 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 % I;- return w > 0 && (E += I - w), y.__size = E, y.__cache = {}, this;+ const w = E % S;+ return w > 0 && (E += S - w), _.__size = E, _.__cache = {}, this;}- function m(y) {+ function m(_) {const x = {boundary: 0,// bytesstorage: 0// bytes};- return typeof y == "number" || typeof y == "boolean" ? (x.boundary = 4, x.storage = 4) : y.isVector2 ? (x.boundary = 8, x.storage = 8) : y.isVector3 || y.isColor ? (x.boundary = 16, x.storage = 12) : y.isVector4 ? (x.boundary = 16, x.storage = 16) : y.isMatrix3 ? (x.boundary = 48, x.storage = 48) : y.isMatrix4 ? (x.boundary = 64, x.storage = 64) : y.isTexture ? console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.") : console.warn("THREE.WebGLRenderer: Unsupported uniform value type.", y), x;+ 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(y) {- const x = y.target;+ 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 y in s)- i.deleteBuffer(s[y]);+ for (const _ in s)+ i.deleteBuffer(s[_]);a = [], s = {}, r = {};}return {@@ -23525,7 +23525,7 @@ function f1(i, e, t, n) {dispose: A};}-class JA {+class eg {/*** Constructs a new WebGL renderer.*@@ -23533,7 +23533,7 @@ class JA {*/constructor(e = {}) {const {- canvas: t = q_(),+ canvas: t = i_(),context: n = null,depth: s = !0,stencil: r = !1,@@ -23555,7 +23555,7 @@ class JA {f = a;const p = new Uint32Array(4), m = new Int32Array(4);let g = null, A = null;- const y = [], x = [];+ const _ = [], x = [];this.domElement = t, this.debug = {/*** Enables error checking and reporting when shader programs are being compiled.@@ -23569,28 +23569,28 @@ class JA {onShaderError: null}, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.toneMapping = Hs, this.toneMappingExposure = 1, this.transmissionResolutionScale = 1;const E = this;- let I = !1;- this._outputColorSpace = yt;- let w = 0, S = 0, T = null, C = -1, v = null;+ let S = !1;+ this._outputColorSpace = _t;+ let w = 0, I = 0, T = null, C = -1, v = null;const F = new mt(), K = new mt();let q = null;const $ = new Le(0);- let N = 0, O = t.width, Y = t.height, Q = 1, J = null, ee = null;- const ae = new mt(0, 0, O, Y), ye = new mt(0, 0, O, Y);+ 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 zf();+ const se = new qf();let me = !1, xe = !1;- const be = new De(), Ue = new De(), et = new G(), He = new mt(), It = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 };+ 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;function $e() {return T === null ? Q : 1;}let H = n;- function xn(_, R) {- return t.getContext(_, R);+ function xn(y, R) {+ return t.getContext(y, R);}try {- const _ = {+ const y = {alpha: !0,depth: s,stencil: r,@@ -23600,87 +23600,87 @@ class JA {powerPreference: h,failIfMajorPerformanceCaveat: u};- if ("setAttribute" in t && t.setAttribute("data-engine", "three.js r176"), t.addEventListener("webglcontextlost", de, !1), t.addEventListener("webglcontextrestored", Ie, !1), t.addEventListener("webglcontextcreationerror", Ce, !1), H === null) {+ if ("setAttribute" in t && t.setAttribute("data-engine", "three.js r176"), t.addEventListener("webglcontextlost", de, !1), t.addEventListener("webglcontextrestored", Se, !1), t.addEventListener("webglcontextcreationerror", Ce, !1), H === null) {const R = "webgl2";- if (H = xn(R, _), H === null)+ if (H = xn(R, y), H === null)throw xn(R) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.");}- } catch (_) {- throw console.error("THREE.WebGLRenderer: " + _.message), _;+ } catch (y) {+ throw console.error("THREE.WebGLRenderer: " + y.message), y;}- let pt, gt, We, Nt, ze, L, M, Z, le, pe, oe, Qe, ve, qe, Je, Ee, Re, Oe, Ge, Be, tt, Ke, nt, W;+ 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 vS(H), pt.init(), Ke = new a1(H, pt), gt = new mS(H, pt, e, Ke), We = new s1(H, pt), gt.reverseDepthBuffer && d && We.buffers.depth.setReversed(!0), Nt = new IS(H), ze = new WI(), L = new r1(H, pt, We, ze, gt, Ke, Nt), M = new bS(E), Z = new wS(E), le = new Dw(H), nt = new AS(H, le), pe = new CS(H, le, Nt, nt), oe = new BS(H, pe, le, Nt), Ge = new MS(H, gt, L), Ee = new xS(ze), Qe = new VI(E, M, Z, pt, gt, nt, Ee), ve = new d1(E, ze), qe = new KI(), Je = new $I(pt), Oe = new pS(E, M, Z, We, oe, f, c), Re = new n1(E, oe, gt), W = new f1(H, Nt, gt, We), Be = new gS(H, pt, Nt), tt = new SS(H, pt, Nt), Nt.programs = Qe.programs, E.capabilities = gt, E.extensions = pt, E.properties = ze, E.renderLists = qe, E.shadowMap = Re, E.state = We, E.info = Nt;+ 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;}ne();- const re = new h1(E, H);+ const re = new y1(E, H);this.xr = re, this.getContext = function() {return H;}, this.getContextAttributes = function() {return H.getContextAttributes();}, this.forceContextLoss = function() {- const _ = pt.get("WEBGL_lose_context");- _ && _.loseContext();+ const y = pt.get("WEBGL_lose_context");+ y && y.loseContext();}, this.forceContextRestore = function() {- const _ = pt.get("WEBGL_lose_context");- _ && _.restoreContext();+ const y = pt.get("WEBGL_lose_context");+ y && y.restoreContext();}, this.getPixelRatio = function() {return Q;- }, this.setPixelRatio = function(_) {- _ !== void 0 && (Q = _, this.setSize(O, Y, !1));- }, this.getSize = function(_) {- return _.set(O, Y);- }, this.setSize = function(_, R, D = !0) {+ }, 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 = R, t.width = Math.floor(_ * Q), t.height = Math.floor(R * Q), D === !0 && (t.style.width = _ + "px", t.style.height = R + "px"), this.setViewport(0, 0, _, R);- }, this.getDrawingBufferSize = function(_) {- return _.set(O * Q, Y * Q).floor();- }, this.setDrawingBufferSize = function(_, R, D) {- O = _, Y = R, Q = D, t.width = Math.floor(_ * D), t.height = Math.floor(R * D), this.setViewport(0, 0, _, R);- }, this.getCurrentViewport = function(_) {- return _.copy(F);- }, this.getViewport = function(_) {- return _.copy(ae);- }, this.setViewport = function(_, R, D, U) {- _.isVector4 ? ae.set(_.x, _.y, _.z, _.w) : ae.set(_, R, D, U), We.viewport(F.copy(ae).multiplyScalar(Q).round());- }, this.getScissor = function(_) {- return _.copy(ye);- }, this.setScissor = function(_, R, D, U) {- _.isVector4 ? ye.set(_.x, _.y, _.z, _.w) : ye.set(_, R, D, U), We.scissor(K.copy(ye).multiplyScalar(Q).round());+ 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(_) {- We.setScissorTest(Me = _);- }, this.setOpaqueSort = function(_) {- J = _;- }, this.setTransparentSort = function(_) {- ee = _;- }, this.getClearColor = function(_) {- return _.copy(Oe.getClearColor());+ }, 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(_ = !0, R = !0, D = !0) {+ }, this.clear = function(y = !0, R = !0, N = !0) {let U = 0;- if (_) {+ if (y) {let P = !1;if (T !== null) {const z = T.texture.format;- P = z === kf || z === Pf || z === Lf;+ P = z === Qf || z === Of || z === Uf;}if (P) {- const z = T.texture.type, j = z === un || z === Ir || z === Uo || z === Oo || z === Df || z === Nf, 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 === Qo || z === Go || z === Pf || z === kf, 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));} elseU |= H.COLOR_BUFFER_BIT;}- R && (U |= H.DEPTH_BUFFER_BIT), D && (U |= H.STENCIL_BUFFER_BIT, this.state.buffers.stencil.setMask(4294967295)), H.clear(U);+ 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() {@@ -23688,47 +23688,47 @@ class JA {}, this.clearStencil = function() {this.clear(!1, !1, !0);}, this.dispose = function() {- t.removeEventListener("webglcontextlost", de, !1), t.removeEventListener("webglcontextrestored", Ie, !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", Ec), re.removeEventListener("sessionend", _c), 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", _c), re.removeEventListener("sessionend", wc), Wi.stop();};- function de(_) {- _.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), I = !0;+ function de(y) {+ y.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), S = !0;}- function Ie() {- console.log("THREE.WebGLRenderer: Context Restored."), I = !1;- const _ = Nt.autoReset, R = Re.enabled, D = Re.autoUpdate, U = Re.needsUpdate, P = Re.type;- ne(), Nt.autoReset = _, Re.enabled = R, Re.autoUpdate = D, Re.needsUpdate = U, Re.type = P;+ function Se() {+ console.log("THREE.WebGLRenderer: Context Restored."), S = !1;+ const y = Dt.autoReset, R = Re.enabled, N = Re.autoUpdate, U = Re.needsUpdate, P = Re.type;+ ne(), Dt.autoReset = y, Re.enabled = R, Re.autoUpdate = N, Re.needsUpdate = U, Re.type = P;}- function Ce(_) {- console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", _.statusMessage);+ function Ce(y) {+ console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", y.statusMessage);}- function it(_) {- const R = _.target;+ function it(y) {+ const R = y.target;R.removeEventListener("dispose", it), Qt(R);}- function Qt(_) {- bn(_), ze.remove(_);+ function Qt(y) {+ bn(y), ze.remove(y);}- function bn(_) {- const R = ze.get(_).programs;- R !== void 0 && (R.forEach(function(D) {- Qe.releaseProgram(D);- }), _.isShaderMaterial && Qe.releaseShaderCache(_));+ function bn(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(_, R, D, U, P, z) {- R === null && (R = It);- const j = P.isMesh && P.matrixWorld.determinant() < 0, X = Lh(_, R, D, U, P);+ 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);We.setMaterial(U, j);- let ie = D.index, he = 1;+ let ie = N.index, he = 1;if (U.wireframe === !0) {- if (ie = pe.getWireframeAttribute(D), ie === void 0) return;+ if (ie = pe.getWireframeAttribute(N), ie === void 0) return;he = 2;}- const ce = D.drawRange, fe = D.attributes.position;- let Ae = ce.start * he, _e = (ce.start + ce.count) * he;- z !== null && (Ae = Math.max(Ae, z.start * he), _e = Math.min(_e, (z.start + z.count) * he)), ie !== null ? (Ae = Math.max(Ae, 0), _e = Math.min(_e, ie.count)) : fe != null && (Ae = Math.max(Ae, 0), _e = Math.min(_e, fe.count));- const Pe = _e - Ae;+ const ce = N.drawRange, fe = N.attributes.position;+ let Ae = ce.start * he, ye = (ce.start + ce.count) * he;+ z !== null && (Ae = Math.max(Ae, z.start * he), ye = Math.min(ye, (z.start + z.count) * he)), ie !== null ? (Ae = Math.max(Ae, 0), ye = Math.min(ye, ie.count)) : fe != null && (Ae = Math.max(Ae, 0), ye = Math.min(ye, fe.count));+ const Pe = ye - Ae;if (Pe < 0 || Pe === 1 / 0) return;- nt.setup(P, U, X, D, ie);+ nt.setup(P, U, X, N, ie);let je, Ve = Be;if (ie !== null && (je = le.get(ie), Ve = tt, Ve.setIndex(je)), P.isMesh)U.wireframe === !0 ? (We.setLineWidth(U.wireframeLinewidth * $e()), Ve.setMode(H.LINES)) : Ve.setMode(H.TRIANGLES);@@ -23738,33 +23738,33 @@ class JA {} else P.isPoints ? Ve.setMode(H.POINTS) : P.isSprite && Ve.setMode(H.TRIANGLES);if (P.isBatchedMesh)if (P._multiDrawInstances !== null)- Cl("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);+ 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);else if (pt.get("WEBGL_multi_draw"))Ve.renderMultiDraw(P._multiDrawStarts, P._multiDrawCounts, P._multiDrawCount);else {- const Fe = P._multiDrawStarts, st = P._multiDrawCounts, ke = P._multiDrawCount, St = ie ? le.get(ie).bytesPerElement : 1, on = ze.get(U).currentProgram.getUniforms();+ const Fe = P._multiDrawStarts, st = P._multiDrawCounts, ke = P._multiDrawCount, It = ie ? le.get(ie).bytesPerElement : 1, on = ze.get(U).currentProgram.getUniforms();for (let wt = 0; wt < ke; wt++)- on.setValue(H, "_gl_DrawID", wt), Ve.render(Fe[wt] / St, st[wt]);+ on.setValue(H, "_gl_DrawID", wt), Ve.render(Fe[wt] / It, st[wt]);}else if (P.isInstancedMesh)Ve.renderInstances(Ae, Pe, P.count);- else if (D.isInstancedBufferGeometry) {- const Fe = D._maxInstanceCount !== void 0 ? D._maxInstanceCount : 1 / 0, st = Math.min(D.instanceCount, Fe);+ else if (N.isInstancedBufferGeometry) {+ const Fe = N._maxInstanceCount !== void 0 ? N._maxInstanceCount : 1 / 0, st = Math.min(N.instanceCount, Fe);Ve.renderInstances(Ae, Pe, st);} elseVe.render(Ae, Pe);};- function Ct(_, R, D) {- _.transparent === !0 && _.side === Ui && _.forceSinglePass === !1 ? (_.side = Vn, _.needsUpdate = !0, zr(_, R, D), _.side = bs, _.needsUpdate = !0, zr(_, R, D), _.side = Ui) : zr(_, R, D);+ 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);}- this.compile = function(_, R, D = null) {- D === null && (D = _), A = Je.get(D), A.init(R), x.push(A), D.traverseVisible(function(P) {+ 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) {P.isLight && P.layers.test(R.layers) && (A.pushLight(P), P.castShadow && A.pushShadow(P));- }), _ !== D && _.traverseVisible(function(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 = /* @__PURE__ */ new Set();- return _.traverse(function(P) {+ return y.traverse(function(P) {if (!(P.isMesh || P.isPoints || P.isLine || P.isSprite))return;const z = P.material;@@ -23772,19 +23772,19 @@ class JA {if (Array.isArray(z))for (let j = 0; j < z.length; j++) {const X = z[j];- Ct(X, D, P), U.add(X);+ Ct(X, N, P), U.add(X);}else- Ct(z, D, P), U.add(z);+ Ct(z, N, P), U.add(z);}), A = x.pop(), U;- }, this.compileAsync = function(_, R, D = null) {- const U = this.compile(_, R, D);+ }, 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(_);+ P(y);return;}setTimeout(z, 10);@@ -23793,86 +23793,86 @@ class JA {});};let Yn = null;- function Ai(_) {- Yn && Yn(_);+ function Ai(y) {+ Yn && Yn(y);}- function Ec() {+ function _c() {Wi.stop();}- function _c() {+ function wc() {Wi.start();}- const Wi = new q0();- Wi.setAnimationLoop(Ai), typeof self < "u" && Wi.setContext(self), this.setAnimationLoop = function(_) {- Yn = _, re.setAnimationLoop(_), _ === null ? Wi.stop() : Wi.start();- }, re.addEventListener("sessionstart", Ec), re.addEventListener("sessionend", _c), this.render = function(_, R) {+ 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) {if (R !== void 0 && R.isCamera !== !0) {console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return;}- if (I === !0) return;- if (_.matrixWorldAutoUpdate === !0 && _.updateMatrixWorld(), R.parent === null && R.matrixWorldAutoUpdate === !0 && R.updateMatrixWorld(), re.enabled === !0 && re.isPresenting === !0 && (re.cameraAutoUpdate === !0 && re.updateCamera(R), R = re.getCamera()), _.isScene === !0 && _.onBeforeRender(E, _, R, T), A = Je.get(_, 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(), y.push(g), re.enabled === !0 && re.isPresenting === !0) {+ 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 && Za(z, R, -1 / 0, E.sortObjects);+ z !== null && $a(z, R, -1 / 0, E.sortObjects);}- Za(_, 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, _), this.info.render.frame++, me === !0 && Ee.beginShadows();- const D = A.state.shadowsArray;- Re.render(D, _, R), me === !0 && Ee.endShadows(), this.info.autoReset === !0 && this.info.reset();+ $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();+ 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;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];- yc(U, P, _, ie);+ vc(U, P, y, ie);}- ht && Oe.render(_);+ ht && Oe.render(y);for (let j = 0, X = z.length; j < X; j++) {const ie = z[j];- $a(g, _, ie, ie.viewport);+ eo(g, y, ie, ie.viewport);}} else- P.length > 0 && yc(U, P, _, R), ht && Oe.render(_), $a(g, _, R);- T !== null && S === 0 && (L.updateMultisampleRenderTarget(T), L.updateRenderTargetMipmap(T)), _.isScene === !0 && _.onAfterRender(E, _, 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, y.pop(), y.length > 0 ? g = y[y.length - 1] : g = null;+ P.length > 0 && vc(U, P, y, R), ht && Oe.render(y), eo(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 Za(_, R, D, U) {- if (_.visible === !1) return;- if (_.layers.test(R.layers)) {- if (_.isGroup)- D = _.renderOrder;- else if (_.isLOD)- _.autoUpdate === !0 && _.update(R);- else if (_.isLight)- A.pushLight(_), _.castShadow && A.pushShadow(_);- else if (_.isSprite) {- if (!_.frustumCulled || se.intersectsSprite(_)) {- U && He.setFromMatrixPosition(_.matrixWorld).applyMatrix4(Ue);- const j = oe.update(_), X = _.material;- X.visible && g.push(_, j, X, D, He.z, null);+ function $a(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 ((_.isMesh || _.isLine || _.isPoints) && (!_.frustumCulled || se.intersectsObject(_))) {- const j = oe.update(_), X = _.material;- if (U && (_.boundingSphere !== void 0 ? (_.boundingSphere === null && _.computeBoundingSphere(), He.copy(_.boundingSphere.center)) : (j.boundingSphere === null && j.computeBoundingSphere(), He.copy(j.boundingSphere.center)), He.applyMatrix4(_.matrixWorld).applyMatrix4(Ue)), Array.isArray(X)) {+ } 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], Ae = X[fe.materialIndex];- Ae && Ae.visible && g.push(_, j, Ae, D, He.z, fe);+ Ae && Ae.visible && g.push(y, j, Ae, N, He.z, fe);}- } else X.visible && g.push(_, j, X, D, He.z, null);+ } else X.visible && g.push(y, j, X, N, He.z, null);}}- const z = _.children;+ const z = y.children;for (let j = 0, X = z.length; j < X; j++)- Za(z[j], R, D, U);+ $a(z[j], R, N, U);}- function $a(_, R, D, U) {- const P = _.opaque, z = _.transmissive, j = _.transparent;- A.setupLightsView(D), me === !0 && Ee.setGlobalState(E.clippingPlanes, D), U && We.viewport(F.copy(U)), P.length > 0 && Hr(P, R, D), z.length > 0 && Hr(z, R, D), j.length > 0 && Hr(j, R, D), We.buffers.depth.setTest(!0), We.buffers.depth.setMask(!0), We.buffers.color.setMask(!0), We.setPolygonOffset(!1);+ function eo(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 yc(_, R, D, U) {- if ((D.isScene === !0 ? D.overrideMaterial : null) !== null)+ function vc(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 Mr(1, 1, {+ 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,@@ -23885,83 +23885,83 @@ class JA {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($), N = E.getClearAlpha(), N < 1 && E.setClearColor(16777215, 0.5), E.clear(), ht && Oe.render(D);+ E.setRenderTarget(z), E.getClearColor($), D = E.getClearAlpha(), D < 1 && E.setClearColor(16777215, 0.5), E.clear(), ht && Oe.render(N);const ie = E.toneMapping;E.toneMapping = Hs;const he = U.viewport;- if (U.viewport !== void 0 && (U.viewport = void 0), A.setupLightsView(U), me === !0 && Ee.setGlobalState(E.clippingPlanes, U), Hr(_, D, U), L.updateMultisampleRenderTarget(z), L.updateRenderTargetMipmap(z), pt.has("WEBGL_multisampled_render_to_texture") === !1) {+ if (U.viewport !== void 0 && (U.viewport = void 0), A.setupLightsView(U), me === !0 && Ee.setGlobalState(E.clippingPlanes, U), Vr(y, N, U), L.updateMultisampleRenderTarget(z), L.updateRenderTargetMipmap(z), pt.has("WEBGL_multisampled_render_to_texture") === !1) {let ce = !1;for (let fe = 0, Ae = R.length; fe < Ae; fe++) {- const _e = R[fe], Pe = _e.object, je = _e.geometry, Ve = _e.material, Fe = _e.group;+ 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)) {const st = Ve.side;- Ve.side = Vn, Ve.needsUpdate = !0, wc(Pe, D, U, je, Ve, Fe), Ve.side = st, Ve.needsUpdate = !0, ce = !0;+ Ve.side = Vn, Ve.needsUpdate = !0, Cc(Pe, N, U, je, Ve, Fe), Ve.side = st, Ve.needsUpdate = !0, ce = !0;}}ce === !0 && (L.updateMultisampleRenderTarget(z), L.updateRenderTargetMipmap(z));}- E.setRenderTarget(X), E.setClearColor($, N), he !== void 0 && (U.viewport = he), E.toneMapping = ie;+ E.setRenderTarget(X), E.setClearColor($, D), he !== void 0 && (U.viewport = he), E.toneMapping = ie;}- function Hr(_, R, D) {+ function Vr(y, R, N) {const U = R.isScene === !0 ? R.overrideMaterial : null;- for (let P = 0, z = _.length; P < z; P++) {- const j = _[P], X = j.object, ie = j.geometry, he = j.group;+ 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(D.layers) && wc(X, R, D, ie, ce, he);+ ce.allowOverride === !0 && U !== null && (ce = U), X.layers.test(N.layers) && Cc(X, R, N, ie, ce, he);}}- function wc(_, R, D, U, P, z) {- _.onBeforeRender(E, R, D, U, P, z), _.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse, _.matrixWorld), _.normalMatrix.getNormalMatrix(_.modelViewMatrix), P.onBeforeRender(E, R, D, U, _, z), P.transparent === !0 && P.side === Ui && P.forceSinglePass === !1 ? (P.side = Vn, P.needsUpdate = !0, E.renderBufferDirect(D, R, U, P, _, z), P.side = bs, P.needsUpdate = !0, E.renderBufferDirect(D, R, U, P, _, z), P.side = Ui) : E.renderBufferDirect(D, R, U, P, _, z), _.onAfterRender(E, R, D, U, P, z);+ 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 zr(_, R, D) {- R.isScene !== !0 && (R = It);- const U = ze.get(_), P = A.state.lights, z = A.state.shadowsArray, j = P.state.version, X = Qe.getParameters(_, P.state, z, R, D), ie = Qe.getProgramCacheKey(X);+ function Wr(y, R, N) {+ R.isScene !== !0 && (R = St);+ 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 = _.isMeshStandardMaterial ? R.environment : null, U.fog = R.fog, U.envMap = (_.isMeshStandardMaterial ? Z : M).get(_.envMap || U.environment), U.envMapRotation = U.environment !== null && _.envMap === null ? R.environmentRotation : _.envMapRotation, he === void 0 && (_.addEventListener("dispose", it), he = /* @__PURE__ */ new Map(), U.programs = he);+ 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", it), he = /* @__PURE__ */ new Map(), U.programs = he);let ce = he.get(ie);if (ce !== void 0) {if (U.currentProgram === ce && U.lightsStateVersion === j)- return to(_, X), ce;+ return no(y, X), ce;} else- X.uniforms = Qe.getUniforms(_), _.onBeforeCompile(X, E), ce = Qe.acquireProgram(X, ie), he.set(ie, ce), U.uniforms = X.uniforms;+ 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 (!_.isShaderMaterial && !_.isRawShaderMaterial || _.clipping === !0) && (fe.clippingPlanes = Ee.uniform), to(_, X), U.needsLights = ws(_), 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), 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;}- function eo(_) {- if (_.uniformsList === null) {- const R = _.currentProgram.getUniforms();- _.uniformsList = Sl.seqWithValue(R.seq, _.uniforms);+ function to(y) {+ if (y.uniformsList === null) {+ const R = y.currentProgram.getUniforms();+ y.uniformsList = Ml.seqWithValue(R.seq, y.uniforms);}- return _.uniformsList;+ return y.uniformsList;}- function to(_, R) {- const D = ze.get(_);- D.outputColorSpace = R.outputColorSpace, D.batching = R.batching, D.batchingColor = R.batchingColor, D.instancing = R.instancing, D.instancingColor = R.instancingColor, D.instancingMorph = R.instancingMorph, D.skinning = R.skinning, D.morphTargets = R.morphTargets, D.morphNormals = R.morphNormals, D.morphColors = R.morphColors, D.morphTargetsCount = R.morphTargetsCount, D.numClippingPlanes = R.numClippingPlanes, D.numIntersection = R.numClipIntersection, D.vertexAlphas = R.vertexAlphas, D.vertexTangents = R.vertexTangents, D.toneMapping = R.toneMapping;+ function no(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 Lh(_, R, D, U, P) {- R.isScene !== !0 && (R = It), 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 && !!D.attributes.color && D.attributes.color.itemSize === 4, ce = !!D.attributes.tangent && (!!U.normalMap || U.anisotropy > 0), fe = !!D.morphAttributes.position, Ae = !!D.morphAttributes.normal, _e = !!D.morphAttributes.color;+ function Uh(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;U.toneMapped && (T === null || T.isXRRenderTarget === !0) && (Pe = E.toneMapping);- const je = D.morphAttributes.position || D.morphAttributes.normal || D.morphAttributes.color, Ve = je !== void 0 ? je.length : 0, Fe = ze.get(U), st = A.state.lights;- if (me === !0 && (xe === !0 || _ !== v)) {- const Lt = _ === v && U.id === C;- Ee.setState(U, _, Lt);+ const je = N.morphAttributes.position || N.morphAttributes.normal || N.morphAttributes.color, Ve = je !== void 0 ? je.length : 0, Fe = ze.get(U), st = A.state.lights;+ if (me === !0 && (xe === !0 || y !== v)) {+ const Lt = y === v && U.id === C;+ Ee.setState(U, y, Lt);}let ke = !1;- U.version === Fe.__version ? (Fe.needsLights && Fe.lightsStateVersion !== st.state.version || Fe.outputColorSpace !== X || P.isBatchedMesh && Fe.batching === !1 || !P.isBatchedMesh && Fe.batching === !0 || P.isBatchedMesh && Fe.batchingColor === !0 && P.colorTexture === null || P.isBatchedMesh && Fe.batchingColor === !1 && P.colorTexture !== null || P.isInstancedMesh && Fe.instancing === !1 || !P.isInstancedMesh && Fe.instancing === !0 || P.isSkinnedMesh && Fe.skinning === !1 || !P.isSkinnedMesh && Fe.skinning === !0 || P.isInstancedMesh && Fe.instancingColor === !0 && P.instanceColor === null || P.isInstancedMesh && Fe.instancingColor === !1 && P.instanceColor !== null || P.isInstancedMesh && Fe.instancingMorph === !0 && P.morphTexture === null || P.isInstancedMesh && Fe.instancingMorph === !1 && P.morphTexture !== null || Fe.envMap !== ie || U.fog === !0 && Fe.fog !== z || Fe.numClippingPlanes !== void 0 && (Fe.numClippingPlanes !== Ee.numPlanes || Fe.numIntersection !== Ee.numIntersection) || Fe.vertexAlphas !== he || Fe.vertexTangents !== ce || Fe.morphTargets !== fe || Fe.morphNormals !== Ae || Fe.morphColors !== _e || Fe.toneMapping !== Pe || Fe.morphTargetsCount !== Ve) && (ke = !0) : (ke = !0, Fe.__version = U.version);- let St = Fe.currentProgram;- ke === !0 && (St = zr(U, R, P));+ U.version === Fe.__version ? (Fe.needsLights && Fe.lightsStateVersion !== st.state.version || Fe.outputColorSpace !== X || P.isBatchedMesh && Fe.batching === !1 || !P.isBatchedMesh && Fe.batching === !0 || P.isBatchedMesh && Fe.batchingColor === !0 && P.colorTexture === null || P.isBatchedMesh && Fe.batchingColor === !1 && P.colorTexture !== null || P.isInstancedMesh && Fe.instancing === !1 || !P.isInstancedMesh && Fe.instancing === !0 || P.isSkinnedMesh && Fe.skinning === !1 || !P.isSkinnedMesh && Fe.skinning === !0 || P.isInstancedMesh && Fe.instancingColor === !0 && P.instanceColor === null || P.isInstancedMesh && Fe.instancingColor === !1 && P.instanceColor !== null || P.isInstancedMesh && Fe.instancingMorph === !0 && P.morphTexture === null || P.isInstancedMesh && Fe.instancingMorph === !1 && P.morphTexture !== null || Fe.envMap !== ie || U.fog === !0 && Fe.fog !== z || Fe.numClippingPlanes !== void 0 && (Fe.numClippingPlanes !== Ee.numPlanes || Fe.numIntersection !== Ee.numIntersection) || Fe.vertexAlphas !== he || Fe.vertexTangents !== ce || Fe.morphTargets !== fe || Fe.morphNormals !== Ae || Fe.morphColors !== ye || Fe.toneMapping !== Pe || Fe.morphTargetsCount !== Ve) && (ke = !0) : (ke = !0, Fe.__version = U.version);+ let It = Fe.currentProgram;+ ke === !0 && (It = Wr(U, R, P));let on = !1, wt = !1, xt = !1;- const Xe = St.getUniforms(), qt = Fe.uniforms;- if (We.useProgram(St.program) && (on = !0, wt = !0, xt = !0), U.id !== C && (C = U.id, wt = !0), on || v !== _) {- We.buffers.depth.getReversed() ? (be.copy(_.projectionMatrix), j_(be), X_(be), Xe.setValue(H, "projectionMatrix", be)) : Xe.setValue(H, "projectionMatrix", _.projectionMatrix), Xe.setValue(H, "viewMatrix", _.matrixWorldInverse);+ 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);const cn = Xe.map.cameraPosition;- cn !== void 0 && cn.setValue(H, et.setFromMatrixPosition(_.matrixWorld)), gt.logarithmicDepthBuffer && Xe.setValue(+ cn !== void 0 && cn.setValue(H, et.setFromMatrixPosition(y.matrixWorld)), gt.logarithmicDepthBuffer && Xe.setValue(H,"logDepthBufFC",- 2 / (Math.log(_.far + 1) / Math.LN2)- ), (U.isMeshPhongMaterial || U.isMeshToonMaterial || U.isMeshLambertMaterial || U.isMeshBasicMaterial || U.isMeshStandardMaterial || U.isShaderMaterial) && Xe.setValue(H, "isOrthographic", _.isOrthographicCamera === !0), v !== _ && (v = _, wt = !0, xt = !0);+ 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, wt = !0, xt = !0);}if (P.isSkinnedMesh) {Xe.setOptional(H, P, "bindMatrix"), Xe.setOptional(H, P, "bindMatrixInverse");@@ -23969,82 +23969,82 @@ class JA {Lt && (Lt.boneTexture === null && Lt.computeBoneTexture(), Xe.setValue(H, "boneTexture", Lt.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 En = D.morphAttributes;- if ((En.position !== void 0 || En.normal !== void 0 || En.color !== void 0) && Ge.update(P, D, St), (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[_.id]), Sl.upload(H, eo(Fe), qt, L)), U.isShaderMaterial && U.uniformsNeedUpdate === !0 && (Sl.upload(H, eo(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 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) {const Lt = U.uniformsGroups;- for (let cn = 0, Ph = Lt.length; cn < Ph; cn++) {- const er = Lt[cn];- W.update(er, St), W.bind(er, St);+ for (let cn = 0, Oh = Lt.length; cn < Oh; cn++) {+ const tr = Lt[cn];+ W.update(tr, It), W.bind(tr, It);}}- return St;+ return It;}- function qi(_, R) {- _.ambientLightColor.needsUpdate = R, _.lightProbe.needsUpdate = R, _.directionalLights.needsUpdate = R, _.directionalLightShadows.needsUpdate = R, _.pointLights.needsUpdate = R, _.pointLightShadows.needsUpdate = R, _.spotLights.needsUpdate = R, _.spotLightShadows.needsUpdate = R, _.rectAreaLights.needsUpdate = R, _.hemisphereLights.needsUpdate = R;+ function qi(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(_) {- return _.isMeshLambertMaterial || _.isMeshToonMaterial || _.isMeshPhongMaterial || _.isMeshStandardMaterial || _.isShadowMaterial || _.isShaderMaterial && _.lights === !0;+ function ws(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 S;+ return I;}, this.getRenderTarget = function() {return T;- }, this.setRenderTargetTextures = function(_, R, D) {- const U = ze.get(_);- U.__autoAllocateDepthBuffer = _.resolveDepthBuffer === !1, U.__autoAllocateDepthBuffer === !1 && (U.__useRenderToTexture = !1), ze.get(_.texture).__webglTexture = R, ze.get(_.depthTexture).__webglTexture = U.__autoAllocateDepthBuffer ? void 0 : D, U.__hasExternalTextures = !0;- }, this.setRenderTargetFramebuffer = function(_, R) {- const D = ze.get(_);- D.__webglFramebuffer = R, D.__useDefaultFramebuffer = R === void 0;+ }, 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(_, R = 0, D = 0) {- T = _, w = R, S = D;+ this.setRenderTarget = function(y, R = 0, N = 0) {+ T = y, w = R, I = N;let U = !0, P = null, z = !1, j = !1;- if (_) {- const ie = ze.get(_);+ 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(_);+ L.setupRenderTarget(y);else if (ie.__hasExternalTextures)- L.rebindTextures(_, ze.get(_.texture).__webglTexture, ze.get(_.depthTexture).__webglTexture);- else if (_.depthBuffer) {- const fe = _.depthTexture;+ 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) && (_.width !== fe.image.width || _.height !== fe.image.height))+ 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(_);+ L.setupDepthRenderbuffer(y);}}- const he = _.texture;+ const he = y.texture;(he.isData3DTexture || he.isDataArrayTexture || he.isCompressedArrayTexture) && (j = !0);- const ce = ze.get(_).__webglFramebuffer;- _.isWebGLCubeRenderTarget ? (Array.isArray(ce[R]) ? P = ce[R][D] : P = ce[R], z = !0) : _.samples > 0 && L.useMultisampledRTT(_) === !1 ? P = ze.get(_).__webglMultisampledFramebuffer : Array.isArray(ce) ? P = ce[D] : P = ce, F.copy(_.viewport), K.copy(_.scissor), q = _.scissorTest;+ 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(ye).multiplyScalar(Q).floor(), q = Me;- if (D !== 0 && (P = b), We.bindFramebuffer(H.FRAMEBUFFER, P) && U && We.drawBuffers(_, P), We.viewport(F), We.scissor(K), We.setScissorTest(q), z) {- const ie = ze.get(_.texture);- H.framebufferTexture2D(H.FRAMEBUFFER, H.COLOR_ATTACHMENT0, H.TEXTURE_CUBE_MAP_POSITIVE_X + R, ie.__webglTexture, D);+ 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(_.texture), he = R;- H.framebufferTextureLayer(H.FRAMEBUFFER, H.COLOR_ATTACHMENT0, ie.__webglTexture, D, he);- } else if (_ !== null && D !== 0) {- const ie = ze.get(_.texture);- H.framebufferTexture2D(H.FRAMEBUFFER, H.COLOR_ATTACHMENT0, H.TEXTURE_2D, ie.__webglTexture, D);+ 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(_, R, D, U, P, z, j) {- if (!(_ && _.isWebGLRenderTarget)) {+ }, 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(_).__webglFramebuffer;- if (_.isWebGLCubeRenderTarget && j !== void 0 && (X = X[j]), X) {+ let X = ze.get(y).__webglFramebuffer;+ if (y.isWebGLCubeRenderTarget && j !== void 0 && (X = X[j]), X) {We.bindFramebuffer(H.FRAMEBUFFER, X);try {- const ie = _.texture, he = ie.format, ce = ie.type;+ const ie = y.texture, he = ie.format, ce = ie.type;if (!gt.textureFormatReadable(he)) {console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return;@@ -24053,77 +24053,77 @@ class JA {console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return;}- R >= 0 && R <= _.width - U && D >= 0 && D <= _.height - P && H.readPixels(R, D, U, P, Ke.convert(he), Ke.convert(ce), z);+ 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(_, R, D, U, P, z, j) {- if (!(_ && _.isWebGLRenderTarget))+ }, 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(_).__webglFramebuffer;- if (_.isWebGLCubeRenderTarget && j !== void 0 && (X = X[j]), X)- if (R >= 0 && R <= _.width - U && D >= 0 && D <= _.height - P) {+ 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 = _.texture, he = ie.format, ce = ie.type;+ const ie = y.texture, he = ie.format, ce = ie.type;if (!gt.textureFormatReadable(he))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if (!gt.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, D, U, P, Ke.convert(he), Ke.convert(ce), 0);+ 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 Ae = T !== null ? ze.get(T).__webglFramebuffer : null;We.bindFramebuffer(H.FRAMEBUFFER, Ae);- const _e = H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE, 0);- return H.flush(), await K_(H, _e, 4), H.bindBuffer(H.PIXEL_PACK_BUFFER, fe), H.getBufferSubData(H.PIXEL_PACK_BUFFER, 0, z), H.deleteBuffer(fe), H.deleteSync(_e), z;+ 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;} elsethrow new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");- }, this.copyFramebufferToTexture = function(_, R = null, D = 0) {- const U = Math.pow(2, -D), P = Math.floor(_.image.width * U), z = Math.floor(_.image.height * U), j = R !== null ? R.x : 0, X = R !== null ? R.y : 0;- L.setTexture2D(_, 0), H.copyTexSubImage2D(H.TEXTURE_2D, D, 0, 0, j, X, P, z), We.unbindTexture();+ }, 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(_, R, D = null, U = null, P = 0, z = null) {- z === null && (P !== 0 ? (Cl("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, _e, Pe;- const je = _.isCompressedTexture ? _.mipmaps[z] : _.image;- if (D !== null)- j = D.max.x - D.min.x, X = D.max.y - D.min.y, ie = D.isBox3 ? D.max.z - D.min.z : 1, he = D.min.x, ce = D.min.y, fe = D.isBox3 ? D.min.z : 0;+ 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);+ let j, X, ie, he, ce, fe, Ae, 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 En = Math.pow(2, -P);- j = Math.floor(je.width * En), X = Math.floor(je.height * En), _.isDataArrayTexture ? ie = je.depth : _.isData3DTexture ? ie = Math.floor(je.depth * En) : ie = 1, he = 0, ce = 0, fe = 0;+ j = Math.floor(je.width * En), X = Math.floor(je.height * En), y.isDataArrayTexture ? ie = je.depth : y.isData3DTexture ? ie = Math.floor(je.depth * En) : ie = 1, he = 0, ce = 0, fe = 0;}- U !== null ? (Ae = U.x, _e = U.y, Pe = U.z) : (Ae = 0, _e = 0, Pe = 0);+ U !== null ? (Ae = U.x, ye = U.y, Pe = U.z) : (Ae = 0, ye = 0, Pe = 0);const Ve = Ke.convert(R.format), Fe = Ke.convert(R.type);let st;R.isData3DTexture ? (L.setTexture3D(R, 0), st = H.TEXTURE_3D) : R.isDataArrayTexture || R.isCompressedArrayTexture ? (L.setTexture2DArray(R, 0), st = H.TEXTURE_2D_ARRAY) : (L.setTexture2D(R, 0), st = 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), St = H.getParameter(H.UNPACK_IMAGE_HEIGHT), on = H.getParameter(H.UNPACK_SKIP_PIXELS), wt = H.getParameter(H.UNPACK_SKIP_ROWS), xt = H.getParameter(H.UNPACK_SKIP_IMAGES);+ const ke = H.getParameter(H.UNPACK_ROW_LENGTH), It = H.getParameter(H.UNPACK_IMAGE_HEIGHT), on = H.getParameter(H.UNPACK_SKIP_PIXELS), wt = H.getParameter(H.UNPACK_SKIP_ROWS), xt = 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 = _.isDataArrayTexture || _.isData3DTexture, qt = R.isDataArrayTexture || R.isData3DTexture;- if (_.isDepthTexture) {- const En = ze.get(_), Lt = ze.get(R), cn = ze.get(En.__renderTarget), Ph = ze.get(Lt.__renderTarget);- We.bindFramebuffer(H.READ_FRAMEBUFFER, cn.__webglFramebuffer), We.bindFramebuffer(H.DRAW_FRAMEBUFFER, Ph.__webglFramebuffer);- for (let er = 0; er < ie; er++)- Xe && (H.framebufferTextureLayer(H.READ_FRAMEBUFFER, H.COLOR_ATTACHMENT0, ze.get(_).__webglTexture, P, fe + er), H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER, H.COLOR_ATTACHMENT0, ze.get(R).__webglTexture, z, Pe + er)), H.blitFramebuffer(he, ce, j, X, Ae, _e, j, X, H.DEPTH_BUFFER_BIT, H.NEAREST);+ 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);+ 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);- } else if (P !== 0 || _.isRenderTargetTexture || ze.has(_)) {- const En = ze.get(_), Lt = ze.get(R);+ } else if (P !== 0 || y.isRenderTargetTexture || ze.has(y)) {+ const En = ze.get(y), Lt = ze.get(R);We.bindFramebuffer(H.READ_FRAMEBUFFER, B), We.bindFramebuffer(H.DRAW_FRAMEBUFFER, k);for (let cn = 0; cn < ie; cn++)- Xe ? H.framebufferTextureLayer(H.READ_FRAMEBUFFER, H.COLOR_ATTACHMENT0, En.__webglTexture, P, fe + cn) : H.framebufferTexture2D(H.READ_FRAMEBUFFER, H.COLOR_ATTACHMENT0, H.TEXTURE_2D, En.__webglTexture, P), qt ? H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER, H.COLOR_ATTACHMENT0, Lt.__webglTexture, z, Pe + cn) : H.framebufferTexture2D(H.DRAW_FRAMEBUFFER, H.COLOR_ATTACHMENT0, H.TEXTURE_2D, Lt.__webglTexture, z), P !== 0 ? H.blitFramebuffer(he, ce, j, X, Ae, _e, j, X, H.COLOR_BUFFER_BIT, H.NEAREST) : qt ? H.copyTexSubImage3D(st, z, Ae, _e, Pe + cn, he, ce, j, X) : H.copyTexSubImage2D(st, z, Ae, _e, he, ce, j, X);+ Xe ? H.framebufferTextureLayer(H.READ_FRAMEBUFFER, H.COLOR_ATTACHMENT0, En.__webglTexture, P, fe + cn) : H.framebufferTexture2D(H.READ_FRAMEBUFFER, H.COLOR_ATTACHMENT0, H.TEXTURE_2D, En.__webglTexture, P), qt ? H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER, H.COLOR_ATTACHMENT0, Lt.__webglTexture, z, Pe + cn) : H.framebufferTexture2D(H.DRAW_FRAMEBUFFER, H.COLOR_ATTACHMENT0, H.TEXTURE_2D, Lt.__webglTexture, z), P !== 0 ? H.blitFramebuffer(he, ce, j, X, Ae, ye, j, X, H.COLOR_BUFFER_BIT, H.NEAREST) : qt ? H.copyTexSubImage3D(st, z, Ae, ye, Pe + cn, he, ce, j, X) : H.copyTexSubImage2D(st, z, Ae, ye, he, ce, j, X);We.bindFramebuffer(H.READ_FRAMEBUFFER, null), We.bindFramebuffer(H.DRAW_FRAMEBUFFER, null);} else- qt ? _.isDataTexture || _.isData3DTexture ? H.texSubImage3D(st, z, Ae, _e, Pe, j, X, ie, Ve, Fe, je.data) : R.isCompressedArrayTexture ? H.compressedTexSubImage3D(st, z, Ae, _e, Pe, j, X, ie, Ve, je.data) : H.texSubImage3D(st, z, Ae, _e, Pe, j, X, ie, Ve, Fe, je) : _.isDataTexture ? H.texSubImage2D(H.TEXTURE_2D, z, Ae, _e, j, X, Ve, Fe, je.data) : _.isCompressedTexture ? H.compressedTexSubImage2D(H.TEXTURE_2D, z, Ae, _e, je.width, je.height, Ve, je.data) : H.texSubImage2D(H.TEXTURE_2D, z, Ae, _e, j, X, Ve, Fe, je);- H.pixelStorei(H.UNPACK_ROW_LENGTH, ke), H.pixelStorei(H.UNPACK_IMAGE_HEIGHT, St), 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(_, R, D = null, U = null, P = 0) {- return Cl('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'), this.copyTextureToTexture(_, R, D, U, P);- }, this.initRenderTarget = function(_) {- ze.get(_).__webglFramebuffer === void 0 && L.setupRenderTarget(_);- }, this.initTexture = function(_) {- _.isCubeTexture ? L.setTextureCube(_, 0) : _.isData3DTexture ? L.setTexture3D(_, 0) : _.isDataArrayTexture || _.isCompressedArrayTexture ? L.setTexture2DArray(_, 0) : L.setTexture2D(_, 0), We.unbindTexture();+ 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);+ }, 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, S = 0, T = null, We.reset(), nt.reset();+ w = 0, I = 0, T = null, We.reset(), nt.reset();}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));}/**@@ -24153,7 +24153,7 @@ class JA {t.drawingBufferColorSpace = rt._getDrawingBufferColorSpace(e), t.unpackColorSpace = rt._getUnpackColorSpace();}}-var Fo = function() {+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);@@ -24166,9 +24166,9 @@ var Fo = function() {e.children[u].style.display = u === h ? "block" : "none";i = h;}- var s = (performance || Date).now(), r = s, a = 0, o = t(new Fo.Panel("FPS", "#0ff", "#002")), c = t(new Fo.Panel("MS", "#0f0", "#020"));+ 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 Fo.Panel("MB", "#f08", "#201"));+ var l = t(new Do.Panel("MB", "#f08", "#201"));return n(0), {REVISION: 16,dom: e,@@ -24194,21 +24194,21 @@ var Fo = function() {setMode: n};};-Fo.Panel = function(i, e, t) {+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 = 0.9, g.fillRect(u, d, f, p), {dom: m,- update: function(A, y) {- 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 = 0.9, g.fillRect(u + f - a, d, a, r((1 - A / y) * p));+ 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 = 0.9, g.fillRect(u + f - a, d, a, r((1 - A / _) * p));}};};-function ZA(i, e) {- if (e === b_)+function tg(i, e) {+ if (e === Ty)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), i;- if (e === Ld || e === b0) {+ if (e === Ud || e === v0) {let t = i.getIndex();if (t === null) {const a = [], o = i.getAttribute("position");@@ -24220,7 +24220,7 @@ function ZA(i, e) {return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), i;}const n = t.count - 2, s = [];- if (e === Ld)+ if (e === Ud)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 ZA(i, e) {} elsereturn console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), i;}-class Zf extends fi {+class tp extends fi {/*** Constructs a new glTF loader.*@@ -24240,39 +24240,39 @@ class Zf extends fi {*/constructor(e) {super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {- return new x1(t);+ return new B1(t);}), this.register(function(t) {- return new b1(t);+ return new T1(t);}), this.register(function(t) {- return new M1(t);+ return new O1(t);}), this.register(function(t) {- return new B1(t);+ return new Q1(t);}), this.register(function(t) {- return new T1(t);+ return new G1(t);}), this.register(function(t) {- return new _1(t);+ return new F1(t);}), this.register(function(t) {- return new y1(t);+ return new N1(t);}), this.register(function(t) {- return new w1(t);+ return new D1(t);}), this.register(function(t) {- return new v1(t);+ return new L1(t);}), this.register(function(t) {- return new m1(t);+ return new M1(t);}), this.register(function(t) {- return new C1(t);+ return new P1(t);}), this.register(function(t) {- return new E1(t);+ return new R1(t);}), this.register(function(t) {- return new I1(t);+ return new U1(t);}), this.register(function(t) {- return new S1(t);+ return new k1(t);}), this.register(function(t) {- return new A1(t);+ return new I1(t);}), this.register(function(t) {- return new R1(t);+ return new H1(t);}), this.register(function(t) {- return new F1(t);+ return new z1(t);});}/**@@ -24290,10 +24290,10 @@ class Zf extends fi {if (this.resourcePath !== "")a = this.resourcePath;else if (this.path !== "") {- const l = wr.extractUrlBase(e);- a = wr.resolveURL(l, this.path);+ const l = Cr.extractUrlBase(e);+ a = Cr.resolveURL(l, this.path);} else- a = wr.extractUrlBase(e);+ a = Cr.extractUrlBase(e);this.manager.itemStart(e);const o = function(l) {s ? s(l) : console.error(l), r.manager.itemError(e), r.manager.itemEnd(e);@@ -24372,9 +24372,9 @@ class Zf extends fi {if (typeof e == "string")r = JSON.parse(e);else if (e instanceof ArrayBuffer)- if (c.decode(new Uint8Array(e, 0, 4)) === J0) {+ if (c.decode(new Uint8Array(e, 0, 4)) === nx) {try {- a[At.KHR_BINARY_GLTF] = new D1(e);+ a[At.KHR_BINARY_GLTF] = new V1(e);} catch (u) {s && s(u);return;@@ -24388,7 +24388,7 @@ class Zf extends fi {s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return;}- const l = new q1(r, {+ const l = new iM(r, {path: t || this.resourcePath || "",crossOrigin: this.crossOrigin,requestHeader: this.requestHeader,@@ -24406,16 +24406,16 @@ class Zf extends fi {const u = r.extensionsUsed[h], d = r.extensionsRequired || [];switch (u) {case At.KHR_MATERIALS_UNLIT:- a[u] = new g1();+ a[u] = new S1();break;case At.KHR_DRACO_MESH_COMPRESSION:- a[u] = new N1(r, this.dracoLoader);+ a[u] = new W1(r, this.dracoLoader);break;case At.KHR_TEXTURE_TRANSFORM:- a[u] = new L1();+ a[u] = new q1();break;case At.KHR_MESH_QUANTIZATION:- a[u] = new P1();+ a[u] = new K1();break;default:d.indexOf(u) >= 0 && o[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');@@ -24438,7 +24438,7 @@ class Zf extends fi {});}}-function p1() {+function C1() {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 A1 {+class I1 {constructor(e) {this.parser = e, this.name = At.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };}@@ -24501,13 +24501,13 @@ class A1 {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 Jf(h), l.target.position.set(0, 0, -1), l.add(l.target);break;case "point":- l = new Kl(h), l.distance = u;+ l = new Xl(h), l.distance = u;break;case "spot":- l = new H0(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 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);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);@@ -24525,7 +24525,7 @@ class A1 {});}}-class g1 {+class S1 {constructor() {this.name = At.KHR_MATERIALS_UNLIT;}@@ -24541,12 +24541,12 @@ class g1 {const a = r.baseColorFactor;e.color.setRGB(a[0], a[1], a[2], An), e.opacity = a[3];}- r.baseColorTexture !== void 0 && s.push(n.assignTexture(e, "map", r.baseColorTexture, yt));+ r.baseColorTexture !== void 0 && s.push(n.assignTexture(e, "map", r.baseColorTexture, _t));}return Promise.all(s);}}-class m1 {+class M1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_EMISSIVE_STRENGTH;}@@ -24558,7 +24558,7 @@ class m1 {return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();}}-class x1 {+class B1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_CLEARCOAT;}@@ -24578,7 +24578,7 @@ class x1 {return Promise.all(r);}}-class b1 {+class T1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_DISPERSION;}@@ -24594,7 +24594,7 @@ class b1 {return t.dispersion = r.dispersion !== void 0 ? r.dispersion : 0, Promise.resolve();}}-class E1 {+class R1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_IRIDESCENCE;}@@ -24610,7 +24610,7 @@ class E1 {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 _1 {+class F1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_SHEEN;}@@ -24629,10 +24629,10 @@ class _1 {const o = a.sheenColorFactor;t.sheenColor.setRGB(o[0], o[1], o[2], An);}- 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);+ 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 y1 {+class N1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_TRANSMISSION;}@@ -24648,7 +24648,7 @@ class y1 {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 w1 {+class D1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_VOLUME;}@@ -24666,7 +24666,7 @@ class w1 {return t.attenuationColor = new Le().setRGB(o[0], o[1], o[2], An), Promise.all(r);}}-class v1 {+class L1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_IOR;}@@ -24682,7 +24682,7 @@ class v1 {return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();}}-class C1 {+class P1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_SPECULAR;}@@ -24697,10 +24697,10 @@ class C1 {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 Le().setRGB(o[0], o[1], o[2], An), a.specularColorTexture !== void 0 && r.push(n.assignTexture(t, "specularColorMap", a.specularColorTexture, yt)), Promise.all(r);+ 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 S1 {+class k1 {constructor(e) {this.parser = e, this.name = At.EXT_MATERIALS_BUMP;}@@ -24716,7 +24716,7 @@ class S1 {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 I1 {+class U1 {constructor(e) {this.parser = e, this.name = At.KHR_MATERIALS_ANISOTROPY;}@@ -24732,7 +24732,7 @@ class I1 {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 M1 {+class O1 {constructor(e) {this.parser = e, this.name = At.KHR_TEXTURE_BASISU;}@@ -24749,7 +24749,7 @@ class M1 {return t.loadTextureImage(e, r.source, a);}}-class B1 {+class Q1 {constructor(e) {this.parser = e, this.name = At.EXT_TEXTURE_WEBP;}@@ -24766,7 +24766,7 @@ class B1 {return n.loadTextureImage(e, a.source, c);}}-class T1 {+class G1 {constructor(e) {this.parser = e, this.name = At.EXT_TEXTURE_AVIF;}@@ -24783,7 +24783,7 @@ class T1 {return n.loadTextureImage(e, a.source, c);}}-class R1 {+class H1 {constructor(e) {this.name = At.EXT_MESHOPT_COMPRESSION, this.parser = e;}@@ -24809,7 +24809,7 @@ class R1 {return null;}}-class F1 {+class z1 {constructor(e) {this.name = At.EXT_MESH_GPU_INSTANCING, this.parser = e;}@@ -24827,13 +24827,13 @@ class F1 {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 De(), g = new G(), A = new Jt(), y = new G(1, 1, 1), x = new R0(p.geometry, p.material, d);+ const m = new Ne(), g = new G(), A = new Jt(), _ = new G(1, 1, 1), x = new P0(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 && y.fromBufferAttribute(c.SCALE, E), x.setMatrixAt(E, m.compose(g, A, y));+ 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 I = c[E];- x.instanceColor = new Ud(I.array, I.itemSize, I.normalized);+ const S = c[E];+ x.instanceColor = new Gd(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 F1 {}));}}-const J0 = "glTF", ho = 12, $A = { JSON: 1313821514, BIN: 5130562 };-class D1 {+const nx = "glTF", uo = 12, ng = { JSON: 1313821514, BIN: 5130562 };+class V1 {constructor(e) {this.name = At.KHR_BINARY_GLTF, this.content = null, this.body = null;- const t = new DataView(e, 0, ho), n = new TextDecoder();+ const t = new DataView(e, 0, uo), n = new TextDecoder();if (this.header = {magic: n.decode(new Uint8Array(e.slice(0, 4))),version: t.getUint32(4, !0),length: t.getUint32(8, !0)- }, this.header.magic !== J0)+ }, this.header.magic !== nx)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 - ho, r = new DataView(e, ho);+ const s = this.header.length - uo, r = new DataView(e, uo);let a = 0;for (; a < s; ) {const o = r.getUint32(a, !0);a += 4;const c = r.getUint32(a, !0);- if (a += 4, c === $A.JSON) {- const l = new Uint8Array(e, ho + a, o);+ if (a += 4, c === ng.JSON) {+ const l = new Uint8Array(e, uo + a, o);this.content = n.decode(l);- } else if (c === $A.BIN) {- const l = ho + a;+ } else if (c === ng.BIN) {+ const l = uo + a;this.body = e.slice(l, l + o);}a += o;@@ -24873,7 +24873,7 @@ class D1 {throw new Error("THREE.GLTFLoader: JSON content not found.");}}-class N1 {+class W1 {constructor(e, t) {if (!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");@@ -24882,13 +24882,13 @@ class N1 {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 = Vd[h] || h.toLowerCase();+ const u = Kd[h] || h.toLowerCase();o[u] = a[h];}for (const h in e.attributes) {- const u = Vd[h] || h.toLowerCase();+ const u = Kd[h] || h.toLowerCase();if (a[h] !== void 0) {- const d = n.accessors[e.attributes[h]], f = va[d.componentType];+ const d = n.accessors[e.attributes[h]], f = Ia[d.componentType];l[u] = f.name, c[u] = d.normalized === !0;}}@@ -24905,7 +24905,7 @@ class N1 {});}}-class L1 {+class q1 {constructor() {this.name = At.KHR_TEXTURE_TRANSFORM;}@@ -24913,12 +24913,12 @@ class L1 {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 P1 {+class K1 {constructor() {this.name = At.KHR_MESH_QUANTIZATION;}}-class Z0 extends hc {+class ix extends dc {constructor(e, t, n, s) {super(e, t, n, s);}@@ -24929,19 +24929,19 @@ class Z0 extends hc {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, y = 1 - g, x = A - d + u;+ 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 I = a[m + E + o], w = a[m + E + c] * h, S = a[p + E + o], T = a[p + E] * h;- r[E] = y * I + x * w + g * S + A * T;+ 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 k1 = new Jt();-class U1 extends Z0 {+const j1 = new Jt();+class X1 extends ix {interpolate_(e, t, n, s) {const r = super.interpolate_(e, t, n, s);- return k1.fromArray(r).normalize().toArray(r), r;+ return j1.fromArray(r).normalize().toArray(r), r;}}const ri = {@@ -24952,25 +24952,25 @@ const ri = {TRIANGLES: 4,TRIANGLE_STRIP: 5,TRIANGLE_FAN: 6-}, va = {+}, Ia = {5120: Int8Array,5121: Uint8Array,5122: Int16Array,5123: Uint16Array,5125: Uint32Array,5126: Float32Array-}, eg = {+}, ig = {9728: Wn,9729: Xt,- 9984: h0,- 9985: yl,- 9986: bo,+ 9984: A0,+ 9985: vl,+ 9986: yo,9987: hi-}, tg = {+}, sg = {33071: ti,- 33648: Dl,+ 33648: Ll,10497: Ws-}, mu = {+}, Eu = {SCALAR: 1,VEC2: 2,VEC3: 3,@@ -24978,7 +24978,7 @@ const ri = {MAT2: 4,MAT3: 9,MAT4: 16-}, Vd = {+}, Kd = {POSITION: "position",NORMAL: "normal",TANGENT: "tangent",@@ -24994,19 +24994,19 @@ const ri = {translation: "position",rotation: "quaternion",weights: "morphTargetInfluences"-}, O1 = {+}, Y1 = {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: Wo,- STEP: Vo-}, xu = {+ LINEAR: Ko,+ STEP: qo+}, yu = {OPAQUE: "OPAQUE",MASK: "MASK",BLEND: "BLEND"};-function Q1(i) {- return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new Yo({+function J1(i) {+ return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new Zo({color: 16777215,emissive: 0,metalness: 1,@@ -25016,14 +25016,14 @@ function Q1(i) {side: bs})), i.DefaultMaterial;}-function or(i, e, t) {+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) {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 G1(i, e, t) {+function Z1(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 G1(i, e, t) {return n && (i.morphAttributes.position = h), s && (i.morphAttributes.normal = u), r && (i.morphAttributes.color = d), i.morphTargetsRelative = !0, i;});}-function H1(i, e) {+function $1(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 H1(i, e) {console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");}}-function z1(i) {+function eM(i) {let e;const t = i.extensions && i.extensions[At.KHR_DRACO_MESH_COMPRESSION];- if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + bu(t.attributes) : e = i.indices + ":" + bu(i.attributes) + ":" + i.mode, i.targets !== void 0)+ if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + _u(t.attributes) : e = i.indices + ":" + _u(i.attributes) + ":" + i.mode, i.targets !== void 0)for (let n = 0, s = i.targets.length; n < s; n++)- e += ":" + bu(i.targets[n]);+ e += ":" + _u(i.targets[n]);return e;}-function bu(i) {+function _u(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 Wd(i) {+function jd(i) {switch (i) {case Int8Array:return 1 / 127;@@ -25098,13 +25098,13 @@ function Wd(i) {throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");}}-function V1(i) {+function tM(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 W1 = new De();-class q1 {+const nM = new Ne();+class iM {constructor(e = {}, t = {}) {- this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new p1(), 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 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 = {};let n = !1, s = -1, r = !1, a = -1;if (typeof navigator < "u") {const o = navigator.userAgent;@@ -25112,7 +25112,7 @@ class q1 {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 G0(this.options.manager) : this.textureLoader = new Aw(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 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);}setExtensions(e) {this.extensions = e;@@ -25142,7 +25142,7 @@ class q1 {parser: n,userData: {}};- return or(r, o, s), ts(o, s), Promise.all(n._invokeAll(function(c) {+ return cr(r, o, s), ts(o, s), Promise.all(n._invokeAll(function(c) {return c.afterRoot && c.afterRoot(o);})).then(function() {for (const c of o.scenes)@@ -25323,7 +25323,7 @@ class q1 {return Promise.resolve(this.extensions[At.KHR_BINARY_GLTF].body);const s = this.options;return new Promise(function(r, a) {- n.load(wr.resolveURL(t.uri, s.path), r, void 0, function() {+ n.load(Cr.resolveURL(t.uri, s.path), r, void 0, function() {a(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));});});@@ -25352,25 +25352,25 @@ class q1 {loadAccessor(e) {const t = this, n = this.json, s = this.json.accessors[e];if (s.bufferView === void 0 && s.sparse === void 0) {- const a = mu[s.type], o = va[s.componentType], c = s.normalized === !0, l = new o(s.count * a);+ const a = Eu[s.type], o = Ia[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 = mu[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;+ 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;let m, g;if (f && f !== u) {- const A = Math.floor(d / f), y = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + A + ":" + s.count;- let x = t.cache.get(y);- x || (m = new l(o, A * f, s.count * f / h), x = new yy(m, f / h), t.cache.add(y, x)), g = new Hf(x, c, d % f / h, p);+ 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);} elseo === 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 = mu.SCALAR, y = va[s.sparse.indices.componentType], x = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, I = new y(a[1], x, s.sparse.count * A), w = new l(a[2], E, s.sparse.count * c);+ 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);o !== null && (g = new Bn(g.array.slice(), g.itemSize, g.normalized)), g.normalized = !1;- for (let S = 0, T = I.length; S < T; S++) {- const C = I[S];- if (g.setX(C, w[S * c]), c >= 2 && g.setY(C, w[S * c + 1]), c >= 3 && g.setZ(C, w[S * c + 2]), c >= 4 && g.setW(C, w[S * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");+ 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;}@@ -25400,7 +25400,7 @@ class q1 {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 = eg[d.magFilter] || Xt, h.minFilter = eg[d.minFilter] || hi, h.wrapS = tg[d.wrapS] || Ws, h.wrapT = tg[d.wrapT] || Ws, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== Wn && h.minFilter !== Xt, s.associations.set(h, { textures: e }), h;+ 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;}).catch(function() {return null;});@@ -25426,10 +25426,10 @@ class q1 {t.isImageBitmapLoader === !0 && (p = function(m) {const g = new an(m);g.needsUpdate = !0, d(g);- }), t.load(wr.resolveURL(u, r.path), p, void 0, f);+ }), 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 || V1(a.uri), u;+ return l === !0 && o.revokeObjectURL(c), ts(u, a), u.userData.mimeType = a.mimeType || tM(a.uri), u;}).catch(function(u) {throw console.error("THREE.GLTFLoader: Couldn't load texture", c), u;});@@ -25476,11 +25476,11 @@ class q1 {if (e.isPoints) {const o = "PointsMaterial:" + n.uuid;let c = this.cache.get(o);- c || (c = new Vf(), 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 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;} else if (e.isLine) {const o = "LineBasicMaterial:" + n.uuid;let c = this.cache.get(o);- c || (c = new Wa(), 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 qa(), ui.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 q1 {e.material = n;}getMaterialType() {- return Yo;+ return Zo;}/*** Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials@@ -25513,15 +25513,15 @@ class q1 {const d = u.baseColorFactor;o.color.setRGB(d[0], d[1], d[2], An), 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) {+ u.baseColorTexture !== void 0 && l.push(t.assignTexture(o, "map", u.baseColorTexture, _t)), 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 = Ui);- const h = r.alphaMode || xu.OPAQUE;- if (h === xu.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, h === xu.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 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)) {const u = r.normalTexture.scale;o.normalScale.set(u, u);}@@ -25529,9 +25529,9 @@ class q1 {const u = r.emissiveFactor;o.emissive = new Le().setRGB(u[0], u[1], u[2], An);}- return r.emissiveTexture !== void 0 && a !== Os && l.push(t.assignTexture(o, "emissiveMap", r.emissiveTexture, yt)), Promise.all(l).then(function() {+ 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 && or(s, u, r), u;+ return r.name && (u.name = r.name), ts(u, r), t.associations.set(u, { materials: e }), r.extensions && cr(s, u, r), u;});}/**@@ -25542,7 +25542,7 @@ class q1 {* @return {string}*/createUniqueName(e) {- const t = _t.sanitizeNodeName(e || "");+ const t = yt.sanitizeNodeName(e || "");return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);}/**@@ -25558,17 +25558,17 @@ class q1 {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 ng(c, o, t);+ return rg(c, o, t);});}const a = [];for (let o = 0, c = e.length; o < c; o++) {- const l = e[o], h = z1(l), u = s[h];+ const l = e[o], h = eM(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 = ng(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 = rg(new Tn(), l, t), s[h] = { primitive: l, promise: d }, a.push(d);}}return Promise.all(a);@@ -25583,7 +25583,7 @@ class q1 {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 ? Q1(this.cache) : this.getDependency("material", a[c].material);+ const h = a[c].material === void 0 ? J1(this.cache) : this.getDependency("material", a[c].material);o.push(h);}return o.push(t.loadGeometries(a)), Promise.all(o).then(function(c) {@@ -25591,20 +25591,20 @@ class q1 {for (let f = 0, p = h.length; f < p; f++) {const m = h[f], g = a[f];let A;- const y = l[f];+ 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 T0(m, y) : new Zt(m, y), A.isSkinnedMesh === !0 && A.normalizeSkinWeights(), g.mode === ri.TRIANGLE_STRIP ? A.geometry = ZA(A.geometry, b0) : g.mode === ri.TRIANGLE_FAN && (A.geometry = ZA(A.geometry, Ld));+ 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 ph(m, y);+ A = new gh(m, _);else if (g.mode === ri.LINE_STRIP)- A = new fh(m, y);+ A = new Ah(m, _);else if (g.mode === ri.LINE_LOOP)- A = new My(m, y);+ A = new O_(m, _);else if (g.mode === ri.POINTS)- A = new By(m, y);+ A = new Q_(m, _);elsethrow new Error("THREE.GLTFLoader: Primitive mode unsupported: " + g.mode);- Object.keys(A.geometry.morphAttributes).length > 0 && H1(A, r), A.name = t.createUniqueName(r.name || "mesh_" + e), ts(A, r), g.extensions && or(s, A, g), t.assignFinalMaterial(A), u.push(A);+ 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);}for (let f = 0, p = u.length; f < p; f++)t.associations.set(u[f], {@@ -25612,9 +25612,9 @@ class q1 {primitives: f});if (u.length === 1)- return r.extensions && or(s, u[0], r), u[0];+ return r.extensions && cr(s, u[0], r), u[0];const d = new hs();- r.extensions && or(s, d, r), t.associations.set(d, { meshes: e });+ r.extensions && cr(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;@@ -25634,7 +25634,7 @@ class q1 {console.warn("THREE.GLTFLoader: Missing camera parameters.");return;}- return n.type === "perspective" ? t = new Sn(Cn.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new Kf(-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 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);}/*** Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins@@ -25653,12 +25653,12 @@ class q1 {const u = a[l];if (u) {o.push(u);- const d = new De();+ const d = new Ne();r !== null && d.fromArray(r.array, l * 16), c.push(d);} elseconsole.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);}- return new dh(o, c);+ return new ph(o, c);});}/**@@ -25671,8 +25671,8 @@ class q1 {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, y = 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", y)), l.push(p), h.push(m));+ 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),@@ -25682,16 +25682,16 @@ class q1 {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 y = 0, x = d.length; y < x; y++) {- const E = d[y], I = f[y], w = p[y], S = m[y], T = g[y];+ 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, I, w, S, T);+ 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 ql(r, void 0, A);+ return new jl(r, void 0, A);});}createNodeMesh(e) {@@ -25724,7 +25724,7 @@ class q1 {]).then(function(l) {const h = l[0], u = l[1], d = l[2];d !== null && h.traverse(function(f) {- f.isSkinnedMesh && f.bind(d, W1);+ f.isSkinnedMesh && f.bind(d, nM);});for (let f = 0, p = u.length; f < p; f++)h.add(u[f]);@@ -25748,11 +25748,11 @@ class q1 {o.push(l);}), this.nodeCache[e] = Promise.all(o).then(function(l) {let h;- if (r.isBone === !0 ? h = new zl() : l.length > 1 ? h = new hs() : l.length === 1 ? h = l[0] : h = new Tt(), h !== l[0])+ 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])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 && or(n, h, r), r.matrix !== void 0) {- const u = new De();+ if (r.name && (h.userData.name = r.name, h.name = a), ts(h, r), r.extensions && cr(n, h, r), r.matrix !== void 0) {+ const u = new Ne();u.fromArray(r.matrix), h.applyMatrix4(u);} elser.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);@@ -25768,7 +25768,7 @@ class q1 {*/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 && or(t, r, n);+ n.name && (r.name = s.createUniqueName(n.name)), ts(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]));@@ -25795,20 +25795,20 @@ class q1 {let l;switch (Rs[r.path]) {case Rs.weights:- l = Tr;+ l = Nr;break;case Rs.rotation:l = Ks;break;case Rs.translation:case Rs.scale:- l = Rr;+ l = Dr;break;default:- n.itemSize === 1 ? l = Tr : l = Rr;+ n.itemSize === 1 ? l = Nr : l = Dr;break;}- const h = s.interpolation !== void 0 ? O1[s.interpolation] : Wo, u = this._getArrayFromAccessor(n);+ const h = s.interpolation !== void 0 ? Y1[s.interpolation] : Ko, 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 q1 {_getArrayFromAccessor(e) {let t = e.array;if (e.normalized) {- const n = Wd(t.constructor), s = new Float32Array(t.length);+ const n = jd(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,12 +25832,12 @@ class q1 {}_createCubicSplineTrackInterpolant(e) {e.createInterpolant = function(n) {- const s = this instanceof Ks ? U1 : Z0;+ const s = this instanceof Ks ? X1 : ix;return new s(this.times, this.values, this.getValueSize() / 3, n);}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;}}-function K1(i, e, t) {+function sM(i, e, t) {const n = e.attributes, s = new Hi();if (n.POSITION !== void 0) {const o = t.json.accessors[n.POSITION], c = o.min, l = o.max;@@ -25846,7 +25846,7 @@ function K1(i, e, t) {new G(c[0], c[1], c[2]),new G(l[0], l[1], l[2])), o.normalized) {- const h = Wd(va[o.componentType]);+ const h = jd(Ia[o.componentType]);s.min.multiplyScalar(h), s.max.multiplyScalar(h);}} else {@@ -25864,7 +25864,7 @@ function K1(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 = Wd(va[d.componentType]);+ const m = jd(Ia[d.componentType]);c.multiplyScalar(m);}o.max(c);@@ -25878,7 +25878,7 @@ function K1(i, e, t) {const a = new zi();s.getCenter(a.center), a.radius = s.min.distanceTo(s.max) / 2, i.boundingSphere = a;}-function ng(i, e, t) {+function rg(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 ng(i, e, t) {});}for (const a in n) {- const o = Vd[a] || a.toLowerCase();+ const o = Kd[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 ng(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), K1(i, e, t), Promise.all(s).then(function() {- return e.targets !== void 0 ? G1(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.`), ts(i, e), sM(i, e, t), Promise.all(s).then(function() {+ return e.targets !== void 0 ? Z1(i, e.targets, t) : i;});}-var j1 = (function() {+var rM = (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 {@@ -25909,19 +25909,19 @@ var j1 = (function() {r = A.instance, r.exports.__wasm_call_ctors();});function o(A) {- for (var y = new Uint8Array(A.length), x = 0; x < A.length; ++x) {+ for (var _ = new Uint8Array(A.length), x = 0; x < A.length; ++x) {var E = A.charCodeAt(x);- y[x] = E > 96 ? E - 97 : E > 64 ? E - 39 : E + 4;+ _[x] = E > 96 ? E - 97 : E > 64 ? E - 39 : E + 4;}- for (var I = 0, x = 0; x < A.length; ++x)- y[I++] = y[x] < 60 ? n[y[x]] : (y[x] - 60) * 64 + y[++x];- return y.buffer.slice(0, I);+ 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, y, x, E, I, w) {- var S = r.exports.sbrk, T = x + 3 & -4, C = S(T * E), v = S(I.length), F = new Uint8Array(r.exports.memory.buffer);- F.set(I, v);- var K = A(C, x, E, v, I.length);- if (K == 0 && w && w(C, T, E), y.set(F.subarray(C, C + x * E)), S(C - S(0)), K != 0)+ 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 = {@@ -25935,37 +25935,37 @@ var j1 = (function() {INDICES: "meshopt_decodeIndexSequence"}, u = [], d = 0;function f(A) {- var y = {+ var _ = {object: new Worker(A),pending: 0,requests: {}};- return y.object.onmessage = function(x) {+ return _.object.onmessage = function(x) {var E = x.data;- y.pending -= E.count, y.requests[E.id][E.action](E.value), delete y.requests[E.id];- }, y;+ _.pending -= E.count, _.requests[E.id][E.action](E.value), delete _.requests[E.id];+ }, _;}function p(A) {- for (var y = "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([y], { type: "text/javascript" }), E = URL.createObjectURL(x), I = 0; I < A; ++I)- u[I] = f(E);+ 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, y, x, E, I) {- for (var w = u[0], S = 1; S < u.length; ++S)- u[S].pending < w.pending && (w = u[S]);+ 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: y, source: v, mode: E, filter: I }, [v.buffer]);+ 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 y = A.data;+ var _ = A.data;try {- var x = new Uint8Array(y.count * y.size);- c(r.exports[y.mode], x, y.count, y.size, y.source, r.exports[y.filter]), self.postMessage({ id: y.id, count: y.count, action: "resolve", value: x }, [x.buffer]);+ 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: y.id, count: y.count, action: "reject", value: E });+ self.postMessage({ id: _.id, count: _.count, action: "reject", value: E });}});}@@ -25975,27 +25975,27 @@ var j1 = (function() {useWorkers: function(A) {p(A);},- decodeVertexBuffer: function(A, y, x, E, I) {- c(r.exports.meshopt_decodeVertexBuffer, A, y, x, E, r.exports[l[I]]);+ decodeVertexBuffer: function(A, _, x, E, S) {+ c(r.exports.meshopt_decodeVertexBuffer, A, _, x, E, r.exports[l[S]]);},- decodeIndexBuffer: function(A, y, x, E) {- c(r.exports.meshopt_decodeIndexBuffer, A, y, x, E);+ decodeIndexBuffer: function(A, _, x, E) {+ c(r.exports.meshopt_decodeIndexBuffer, A, _, x, E);},- decodeIndexSequence: function(A, y, x, E) {- c(r.exports.meshopt_decodeIndexSequence, A, y, x, E);+ decodeIndexSequence: function(A, _, x, E) {+ c(r.exports.meshopt_decodeIndexSequence, A, _, x, E);},- decodeGltfBuffer: function(A, y, x, E, I, w) {- c(r.exports[h[I]], A, y, x, E, r.exports[l[w]]);+ decodeGltfBuffer: function(A, _, x, E, S, w) {+ c(r.exports[h[S]], A, _, x, E, r.exports[l[w]]);},- decodeGltfBufferAsync: function(A, y, x, E, I) {- return u.length > 0 ? m(A, y, x, h[E], l[I]) : a.then(function() {- var w = new Uint8Array(A * y);- return c(r.exports[h[E]], w, A, y, x, r.exports[l[I]]), 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 ig = { type: "change" }, $f = { type: "start" }, $0 = { type: "end" }, tl = new lc(), sg = new Us(), X1 = Math.cos(70 * Cn.DEG2RAD), ln = new G(), qn = 2 * Math.PI, Ft = {+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 = {NONE: -1,ROTATE: 0,DOLLY: 1,@@ -26004,8 +26004,8 @@ const ig = { type: "change" }, $f = { type: "start" }, $0 = { type: "end" }, tlTOUCH_PAN: 4,TOUCH_DOLLY_PAN: 5,TOUCH_DOLLY_ROTATE: 6-}, Eu = 1e-6;-class Y1 extends Rw {+}, wu = 1e-6;+class oM extends Hw {/*** Constructs a new controls instance.*@@ -26013,7 +26013,7 @@ class Y1 extends Rw {* @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: _a.ROTATE, MIDDLE: _a.DOLLY, RIGHT: _a.PAN }, this.touches = { ONE: fa.ROTATE, TWO: fa.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 CA(), this._sphericalDelta = new CA(), 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 = Z1.bind(this), this._onPointerDown = J1.bind(this), this._onPointerUp = $1.bind(this), this._onContextMenu = aM.bind(this), this._onMouseWheel = nM.bind(this), this._onKeyDown = iM.bind(this), this._onTouchStart = sM.bind(this), this._onTouchMove = rM.bind(this), this._onMouseDown = eM.bind(this), this._onMouseMove = tM.bind(this), this._interceptControlDown = oM.bind(this), this._interceptControlUp = cM.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: 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();}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,7 +26074,7 @@ class Y1 extends Rw {* 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(ig), 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(ag), this.update(), this.state = Ft.NONE;}update(e = null) {const t = this.object.position;@@ -26104,12 +26104,12 @@ class Y1 extends Rw {l.unproject(this.object), this.object.position.sub(l).add(o), this.object.updateMatrixWorld(), a = ln.length();} elseconsole.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) : (tl.origin.copy(this.object.position), tl.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(tl.direction)) < X1 ? this.object.lookAt(this.target) : (sg.setFromNormalAndCoplanarPoint(this.object.up, this.target), tl.intersectPlane(sg, this.target))));+ 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))));} 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) > Eu || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Eu || this._lastTargetPosition.distanceToSquared(this.target) > Eu ? (this.dispatchEvent(ig), 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) > 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;}_getAutoRotationAngle(e) {return e !== null ? qn / 60 * this.autoRotateSpeed * e : qn / 60 / 60 * this.autoRotateSpeed;@@ -26301,16 +26301,16 @@ class Y1 extends Rw {return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;}}-function J1(i) {+function cM(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 Z1(i) {+function lM(i) {this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));}-function $1(i) {+function hM(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($0), this.state = Ft.NONE;+ this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(sx), this.state = Ft.NONE;break;case 1:const e = this._pointers[0], t = this._pointerPositions[e];@@ -26318,7 +26318,7 @@ function $1(i) {break;}}-function eM(i) {+function uM(i) {let e;switch (i.button) {case 0:@@ -26334,11 +26334,11 @@ function eM(i) {e = -1;}switch (e) {- case _a.DOLLY:+ case wa.DOLLY:if (this.enableZoom === !1) return;this._handleMouseDownDolly(i), this.state = Ft.DOLLY;break;- case _a.ROTATE:+ case wa.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 eM(i) {this._handleMouseDownRotate(i), this.state = Ft.ROTATE;}break;- case _a.PAN:+ case wa.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 eM(i) {default:this.state = Ft.NONE;}- this.state !== Ft.NONE && this.dispatchEvent($f);+ this.state !== Ft.NONE && this.dispatchEvent(np);}-function tM(i) {+function dM(i) {switch (this.state) {case Ft.ROTATE:if (this.enableRotate === !1) return;@@ -26377,21 +26377,21 @@ function tM(i) {break;}}-function nM(i) {- this.enabled === !1 || this.enableZoom === !1 || this.state !== Ft.NONE || (i.preventDefault(), this.dispatchEvent($f), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent($0));+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 iM(i) {+function pM(i) {this.enabled !== !1 && this._handleKeyDown(i);}-function sM(i) {+function AM(i) {switch (this._trackPointer(i), this._pointers.length) {case 1:switch (this.touches.ONE) {- case fa.ROTATE:+ case Aa.ROTATE:if (this.enableRotate === !1) return;this._handleTouchStartRotate(i), this.state = Ft.TOUCH_ROTATE;break;- case fa.PAN:+ case Aa.PAN:if (this.enablePan === !1) return;this._handleTouchStartPan(i), this.state = Ft.TOUCH_PAN;break;@@ -26401,11 +26401,11 @@ function sM(i) {break;case 2:switch (this.touches.TWO) {- case fa.DOLLY_PAN:+ case Aa.DOLLY_PAN:if (this.enableZoom === !1 && this.enablePan === !1) return;this._handleTouchStartDollyPan(i), this.state = Ft.TOUCH_DOLLY_PAN;break;- case fa.DOLLY_ROTATE:+ case Aa.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 sM(i) {default:this.state = Ft.NONE;}- this.state !== Ft.NONE && this.dispatchEvent($f);+ this.state !== Ft.NONE && this.dispatchEvent(np);}-function rM(i) {+function gM(i) {switch (this._trackPointer(i), this.state) {case Ft.TOUCH_ROTATE:if (this.enableRotate === !1) return;@@ -26440,37 +26440,37 @@ function rM(i) {this.state = Ft.NONE;}}-function aM(i) {+function mM(i) {this.enabled !== !1 && i.preventDefault();}-function oM(i) {+function xM(i) {i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));}-function cM(i) {+function bM(i) {i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));}-class lM extends kd {+class EM extends Qd {constructor() {super();- const e = new Va();+ const e = new Wa();e.deleteAttribute("uv");- const t = new Yo({ side: Vn }), n = new Yo(), s = new Kl(16777215, 900, 28, 2);+ const t = new Zo({ side: Vn }), n = new Zo(), s = new Xl(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 R0(e, n, 6), o = new Tt();+ const a = new P0(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, ra(50));+ 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);- const l = new Zt(e, ra(50));+ const l = new Zt(e, oa(50));l.position.set(-16.109, 18.021, -8.207), l.scale.set(0.1, 2.425, 2.751), this.add(l);- const h = new Zt(e, ra(17));+ const h = new Zt(e, oa(17));h.position.set(14.904, 12.198, -1.832), h.scale.set(0.15, 4.265, 6.331), this.add(h);- const u = new Zt(e, ra(43));+ const u = new Zt(e, oa(43));u.position.set(-0.462, 8.89, 14.52), u.scale.set(4.38, 5.441, 0.088), this.add(u);- const d = new Zt(e, ra(20));+ const d = new Zt(e, oa(20));d.position.set(3.235, 11.486, -12.541), d.scale.set(2.5, 2, 0.1), this.add(d);- const f = new Zt(e, ra(100));+ const f = new Zt(e, oa(100));f.position.set(0, 20, 0), f.scale.set(1, 0.1, 1), this.add(f);}/**@@ -26486,17 +26486,17 @@ class lM extends kd {t.dispose();}}-function ra(i) {+function oa(i) {const e = new Os();return e.color.setScalar(i), e;}-function hM(i) {+function yM(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 ma(i, e) {+function ba(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 ma(i, e) {}return "unknown format";}-var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {+var cg = Array.prototype.forEach, fo = Array.prototype.slice, ue = {BREAK: {},extend: function(e) {- return this.each(uo.call(arguments, 1), function(t) {+ return this.each(fo.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 rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {}, this), e;},defaults: function(e) {- return this.each(uo.call(arguments, 1), function(t) {+ return this.each(fo.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 rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {}, this), e;},compose: function() {- var e = uo.call(arguments);+ var e = fo.call(arguments);return function() {- for (var t = uo.call(arguments), n = e.length - 1; n >= 0; n--)+ for (var t = fo.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 (rg && e.forEach && e.forEach === rg)+ if (cg && e.forEach && e.forEach === cg)e.forEach(t, n);else if (e.length === e.length + 0) {var s = void 0, r = void 0;@@ -26580,7 +26580,7 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {};},toArray: function(e) {- return e.toArray ? e.toArray() : uo.call(e);+ return e.toArray ? e.toArray() : fo.call(e);},isUndefined: function(e) {return e === void 0;@@ -26616,7 +26616,7 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {isFunction: function(e) {return e instanceof Function;}-}, uM = [+}, _M = [{litmus: ue.isString,conversions: {@@ -26628,7 +26628,7 @@ var rg = Array.prototype.forEach, uo = 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: ma+ write: ba},SIX_CHAR_HEX: {read: function(e) {@@ -26638,7 +26638,7 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {hex: parseInt("0x" + t[1].toString(), 0)};},- write: ma+ write: ba},CSS_RGB: {read: function(e) {@@ -26650,7 +26650,7 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {b: parseFloat(t[3])};},- write: ma+ write: ba},CSS_RGBA: {read: function(e) {@@ -26663,7 +26663,7 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {a: parseFloat(t[4])};},- write: ma+ write: ba}}},@@ -26793,17 +26793,17 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {}}}-], fo = void 0, nl = void 0, qd = function() {- nl = !1;+], po = void 0, sl = void 0, Xd = function() {+ sl = !1;var e = arguments.length > 1 ? ue.toArray(arguments) : arguments[0];- return ue.each(uM, function(t) {+ return ue.each(_M, function(t) {if (t.litmus(e))return ue.each(t.conversions, function(n, s) {- if (fo = n.read(e), nl === !1 && fo !== !1)- return nl = fo, fo.conversionName = s, fo.conversion = n, ue.BREAK;+ if (po = n.read(e), sl === !1 && po !== !1)+ return sl = po, po.conversionName = s, po.conversion = n, ue.BREAK;}), ue.BREAK;- }), nl;-}, ag = void 0, jl = {+ }), sl;+}, lg = void 0, Yl = {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,9 +26836,9 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {return e >> t * 8 & 255;},hex_with_component: function(e, t, n) {- return n << (ag = t * 8) | e & ~(255 << ag);+ return n << (lg = t * 8) | e & ~(255 << lg);}-}, dM = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {+}, wM = 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;@@ -26867,7 +26867,7 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {var a = s.get;return a === void 0 ? void 0 : a.call(n);}-}, Js = function(i, e) {+}, Zs = 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, {@@ -26878,25 +26878,25 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {configurable: !0}}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(i, e) : i.__proto__ = e);-}, Zs = function(i, e) {+}, $s = 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;}, vn = (function() {function i() {- if (Ti(this, i), this.__state = qd.apply(this, arguments), this.__state === !1)+ if (Ti(this, i), this.__state = Xd.apply(this, arguments), this.__state === !1)throw new Error("Failed to interpret color arguments");this.__state.a = this.__state.a || 1;}return Ri(i, [{key: "toString",value: function() {- return ma(this);+ return ba(this);}}, {key: "toHexString",value: function() {- return ma(this, !0);+ return ba(this, !0);}}, {key: "toOriginal",@@ -26905,7 +26905,7 @@ var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {}}]), i;})();-function ep(i, e, t) {+function ip(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 ep(i, e, t) {}});}-function tp(i, e) {+function sp(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 tp(i, e) {}vn.recalculateRGB = function(i, e, t) {if (i.__state.space === "HEX")- i.__state[e] = jl.component_from_hex(i.__state.hex, t);+ i.__state[e] = Yl.component_from_hex(i.__state.hex, t);else if (i.__state.space === "HSV")- ue.extend(i.__state, jl.hsv_to_rgb(i.__state.h, i.__state.s, i.__state.v));+ ue.extend(i.__state, Yl.hsv_to_rgb(i.__state.h, i.__state.s, i.__state.v));elsethrow new Error("Corrupted color state");};vn.recalculateHSV = function(i) {- var e = jl.rgb_to_hsv(i.r, i.g, i.b);+ var e = Yl.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"];-ep(vn.prototype, "r", 2);-ep(vn.prototype, "g", 1);-ep(vn.prototype, "b", 0);-tp(vn.prototype, "h");-tp(vn.prototype, "s");-tp(vn.prototype, "v");+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");Object.defineProperty(vn.prototype, "a", {get: function() {return this.__state.a;@@ -26957,13 +26957,13 @@ Object.defineProperty(vn.prototype, "a", {});Object.defineProperty(vn.prototype, "hex", {get: function() {- return this.__state.space !== "HEX" && (this.__state.hex = jl.rgb_to_hex(this.r, this.g, this.b), this.__state.space = "HEX"), this.__state.hex;+ 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;},set: function(e) {this.__state.space = "HEX", this.__state.hex = e;}});-var Or = (function() {+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;}@@ -26998,21 +26998,21 @@ var Or = (function() {return this.initialValue !== this.getValue();}}]), i;-})(), fM = {+})(), vM = {HTMLEvents: ["change"],MouseEvents: ["click", "mousemove", "mousedown", "mouseup", "mouseover"],KeyboardEvents: ["keydown"]-}, ex = {};-ue.each(fM, function(i, e) {+}, rx = {};+ue.each(vM, function(i, e) {ue.each(i, function(t) {- ex[t] = e;+ rx[t] = e;});});-var pM = /(\d+(\.\d+)?)px/;-function Di(i) {+var CM = /(\d+(\.\d+)?)px/;+function Ni(i) {if (i === "0" || ue.isUndefined(i))return 0;- var e = i.match(pM);+ var e = i.match(CM);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 = ex[t];+ var r = n || {}, a = rx[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 Di(t["border-left-width"]) + Di(t["border-right-width"]) + Di(t["padding-left"]) + Di(t["padding-right"]) + Di(t.width);+ return Ni(t["border-left-width"]) + Ni(t["border-right-width"]) + Ni(t["padding-left"]) + Ni(t["padding-right"]) + Ni(t.width);},getHeight: function(e) {var t = getComputedStyle(e);- return Di(t["border-top-width"]) + Di(t["border-bottom-width"]) + Di(t["padding-top"]) + Di(t["padding-bottom"]) + Di(t.height);+ return Ni(t["border-top-width"]) + Ni(t["border-bottom-width"]) + Ni(t["padding-top"]) + Ni(t["padding-bottom"]) + Ni(t.height);},getOffset: function(e) {var t = e, n = { left: 0, top: 0 };@@ -27124,11 +27124,11 @@ var te = {isActive: function(e) {return e === document.activeElement && (e.type || e.href);}-}, tx = (function(i) {- Js(e, i);+}, ax = (function(i) {+ Zs(e, i);function e(t, n) {Ti(this, e);- var s = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;+ 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() {r.setValue(!r.__prev);@@ -27147,11 +27147,11 @@ 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;-})(Or), AM = (function(i) {- Js(e, i);+})(Gr), IM = (function(i) {+ Zs(e, i);function e(t, n, s) {Ti(this, e);- var r = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), a = s, o = r;+ 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 = {};ue.each(a, function(l) {@@ -27178,11 +27178,11 @@ 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;-})(Or), gM = (function(i) {- Js(e, i);+})(Gr), SM = (function(i) {+ Zs(e, i);function e(t, n) {Ti(this, e);- var s = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;+ var s = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;function a() {r.setValue(r.__input.value);}@@ -27199,17 +27199,17 @@ var te = {return te.isActive(this.__input) || (this.__input.value = this.getValue()), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);}}]), e;-})(Or);-function og(i) {+})(Gr);+function hg(i) {var e = i.toString();return e.indexOf(".") > -1 ? e.length - e.indexOf(".") - 1 : 0;}-var nx = (function(i) {- Js(e, i);+var ox = (function(i) {+ Zs(e, i);function e(t, n, s) {Ti(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 = og(r.__impliedStep), r;+ 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 Ri(e, [{key: "setValue",@@ -27230,19 +27230,19 @@ var nx = (function(i) {}, {key: "step",value: function(n) {- return this.__step = n, this.__impliedStep = n, this.__precision = og(n), this;+ return this.__step = n, this.__impliedStep = n, this.__precision = hg(n), this;}}]), e;-})(Or);-function mM(i, e) {+})(Gr);+function MM(i, e) {var t = Math.pow(10, e);return Math.round(i * t) / t;}-var Xl = (function(i) {- Js(e, i);+var Jl = (function(i) {+ Zs(e, i);function e(t, n, s) {Ti(this, e);- var r = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n, s));+ var r = $s(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n, s));r.__truncationSuspended = !1;var a = r, o = void 0;function c() {@@ -27272,18 +27272,18 @@ var Xl = (function(i) {return Ri(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() : MM(this.getValue(), this.__precision), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);}}]), e;-})(nx);-function cg(i, e, t, n, s) {+})(ox);+function ug(i, e, t, n, s) {return n + (s - n) * ((i - e) / (t - e));}-var Kd = (function(i) {- Js(e, i);+var Yd = (function(i) {+ Zs(e, i);function e(t, n, s, r, a) {Ti(this, e);- var o = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n, { min: s, max: r, step: a })), c = o;+ 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) {document.activeElement.blur(), te.bind(window, "mousemove", h), te.bind(window, "mouseup", u), h(m);@@ -27291,7 +27291,7 @@ var Kd = (function(i) {function h(m) {m.preventDefault();var g = c.__background.getBoundingClientRect();- return c.setValue(cg(m.clientX, g.left, g.right, c.__min, c.__max)), !1;+ return c.setValue(ug(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,7 +27301,7 @@ var Kd = (function(i) {}function f(m) {var g = m.touches[0].clientX, A = c.__background.getBoundingClientRect();- c.setValue(cg(g, A.left, A.right, c.__min, c.__max));+ c.setValue(ug(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());@@ -27315,11 +27315,11 @@ var Kd = (function(i) {return this.__foreground.style.width = n * 100 + "%", js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);}}]), e;-})(nx), ix = (function(i) {- Js(e, i);+})(ox), cx = (function(i) {+ Zs(e, i);function e(t, n, s) {Ti(this, e);- var r = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), a = r;+ 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;@@ -27330,11 +27330,11 @@ var Kd = (function(i) {this.__onChange && this.__onChange.call(this), this.getValue().call(this.object), this.__onFinishChange && this.__onFinishChange.call(this, this.getValue());}}]), e;-})(Or), jd = (function(i) {- Js(e, i);+})(Gr), Jd = (function(i) {+ Zs(e, i);function e(t, n) {Ti(this, e);- var s = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n));+ 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;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) {@@ -27380,7 +27380,7 @@ var Kd = (function(i) {width: "100%",height: "100%",background: "none"- }), lg(a, "top", "rgba(0,0,0,0)", "#000"), ue.extend(s.__hue_field.style, {+ }), dg(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 Kd = (function(i) {position: "absolute",top: "3px",right: "3px"- }), bM(s.__hue_field), ue.extend(s.__input.style, {+ }), TM(s.__hue_field), ue.extend(s.__input.style, {outline: "none",textAlign: "center",color: "#fff",@@ -27409,7 +27409,7 @@ var Kd = (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 = qd(this.value);+ var m = Xd(this.value);m !== !1 ? (r.__color.__state = m, r.setValue(r.__color.toOriginal())) : this.value = r.__color.toString();}function d() {@@ -27418,12 +27418,12 @@ var Kd = (function(i) {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, y = A.clientX, x = A.clientY, E = (y - g.left) / (g.right - g.left), I = 1 - (x - g.top) / (g.bottom - g.top);- return I > 1 ? I = 1 : I < 0 && (I = 0), E > 1 ? E = 1 : E < 0 && (E = 0), r.__color.v = I, r.__color.s = E, r.setValue(r.__color.toOriginal()), !1;+ 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, y = A.clientY, x = 1 - (y - g.top) / (g.bottom - g.top);+ 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;@@ -27431,7 +27431,7 @@ var Kd = (function(i) {return Ri(e, [{key: "updateDisplay",value: function() {- var n = qd(this.getValue());+ var n = Xd(this.getValue());if (n !== !1) {var s = !1;ue.each(vn.COMPONENTS, function(o) {@@ -27446,23 +27446,23 @@ var Kd = (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, lg(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, dg(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;-})(Or), xM = ["-moz-", "-o-", "-webkit-", "-ms-", ""];-function lg(i, e, t, n) {- i.style.background = "", ue.each(xM, function(s) {+})(Gr), BM = ["-moz-", "-o-", "-webkit-", "-ms-", ""];+function dg(i, e, t, n) {+ i.style.background = "", ue.each(BM, function(s) {i.style.cssText += "background: " + s + "linear-gradient(" + e + ", " + t + " 0%, " + n + " 100%); ";});}-function bM(i) {+function TM(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 EM = {+var RM = {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 EM = {} catch {}}-}, _M = `<div id="dg-save" class="dg dialogue">+}, FM = `<div id="dg-save" class="dg dialogue">Here's the new load parameter for your <code>GUI</code>'s constructor:@@ -27496,14 +27496,14 @@ var EM = {</div>-</div>`, yM = function(e, t) {+</div>`, NM = function(e, t) {var n = e[t];- return ue.isArray(arguments[2]) || ue.isObject(arguments[2]) ? new AM(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 Xl(e, t, { min: arguments[2], max: arguments[3], step: arguments[4] }) : new Xl(e, t, { min: arguments[2], max: arguments[3] }) : ue.isString(n) ? new gM(e, t) : ue.isFunction(n) ? new ix(e, t, "") : ue.isBoolean(n) ? new tx(e, t) : null;+ 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;};-function wM(i) {+function DM(i) {setTimeout(i, 1e3 / 60);}-var vM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || wM, CM = (function() {+var LM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || DM, PM = (function() {function i() {Ti(this, i), this.backgroundElement = document.createElement("div"), ue.extend(this.backgroundElement.style, {backgroundColor: "rgba(0,0,0,0.8)",@@ -27549,26 +27549,26 @@ var vM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || wthis.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;-})(), SM = hM(`.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}+})(), 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}`);-EM.inject(SM);-var hg = "dg", ug = 72, dg = 20, Jo = "Default", yo = (function() {+RM.inject(kM);+var fg = "dg", pg = 72, Ag = 20, $o = "Default", vo = (function() {try {return !!window.localStorage;} catch {return !1;}-})(), Do = void 0, fg = !0, ha = void 0, _u = !1, sx = [], kt = function i(e) {+})(), Lo = void 0, gg = !0, da = void 0, vu = !1, lx = [], 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, hg), 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, fg), 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: Jo } : n.preset && (n.load.preset = n.preset), ue.isUndefined(n.parent) && n.hideable && sx.push(this), n.resizable = ue.isUndefined(n.parent) && n.resizable, n.autoPlace && ue.isUndefined(n.scrollable) && (n.scrollable = !0);- var s = yo && localStorage.getItem(ua(this, "isLocal")) === "true", r = void 0, a = void 0;+ }), 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;if (Object.defineProperties(this,{@@ -27597,7 +27597,7 @@ var hg = "dg", ug = 72, dg = 20, Jo = "Default", yo = (function() {return t.parent ? t.getRoot().preset : n.load.preset;},set: function(d) {- t.parent ? t.getRoot().preset = d : n.load.preset = d, TM(this), t.revert();+ t.parent ? t.getRoot().preset = d : n.load.preset = d, GM(this), t.revert();}},width: {@@ -27605,7 +27605,7 @@ var hg = "dg", ug = 72, dg = 20, Jo = "Default", yo = (function() {return n.width;},set: function(d) {- n.width = d, Jd(t, d);+ n.width = d, ef(t, d);}},name: {@@ -27634,14 +27634,14 @@ var hg = "dg", ug = 72, dg = 20, Jo = "Default", yo = (function() {return s;},set: function(d) {- yo && (s = d, d ? te.bind(window, "unload", r) : te.unbind(window, "unload", r), localStorage.setItem(ua(t, "isLocal"), d));+ vo && (s = d, d ? te.bind(window, "unload", r) : te.unbind(window, "unload", r), localStorage.setItem(fa(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), yo && s) {+ if (this.closed = n.closed || !1, te.addClass(this.domElement, i.CLASS_MAIN), te.makeSelectable(this.domElement, !1), vo && s) {t.useLocalStorage = !0;- var o = localStorage.getItem(ua(this, "gui"));+ var o = localStorage.getItem(fa(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 hg = "dg", ug = 72, dg = 20, Jo = "Default", yo = (function() {} else {n.closed === void 0 && (n.closed = !0);var c = document.createTextNode(n.name);- te.addClass(c, "controller-name"), a = np(t, c);+ te.addClass(c, "controller-name"), a = rp(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) && (fg && (ha = document.createElement("div"), te.addClass(ha, hg), te.addClass(ha, i.CLASS_AUTO_PLACE_CONTAINER), document.body.appendChild(ha), fg = !1), ha.appendChild(this.domElement), te.addClass(this.domElement, i.CLASS_AUTO_PLACE)), this.parent || Jd(t, n.width)), this.__resizeHandler = function() {+ 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() {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 && BM(this), r = function() {- yo && localStorage.getItem(ua(t, "isLocal")) === "true" && localStorage.setItem(ua(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 && QM(this), r = function() {+ vo && localStorage.getItem(fa(t, "isLocal")) === "true" && localStorage.setItem(fa(t, "gui"), JSON.stringify(t.getSaveObject()));}, this.saveToLocalStorageIfPossible = r;function h() {var u = t.getRoot();@@ -27670,8 +27670,8 @@ var hg = "dg", ug = 72, dg = 20, Jo = "Default", yo = (function() {n.parent || h();};kt.toggleHide = function() {- _u = !_u, ue.each(sx, function(i) {- i.domElement.style.display = _u ? "none" : "";+ vu = !vu, ue.each(lx, function(i) {+ i.domElement.style.display = vu ? "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 === ug || i.keyCode === ug) && kt.toggleHide();+ document.activeElement.type !== "text" && (i.which === pg || i.keyCode === pg) && kt.toggleHide();};te.bind(window, "keydown", kt._keydownHandler, !1);ue.extend(kt.prototype,{add: function(e, t) {- return No(this, e, t, {+ return Po(this, e, t, {factoryArgs: Array.prototype.slice.call(arguments, 2)});},addColor: function(e, t) {- return No(this, e, t, {+ return Po(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 && ha.removeChild(this.domElement);+ this.autoPlace && da.removeChild(this.domElement);var e = this;ue.each(this.__folders, function(t) {e.removeFolder(t);- }), te.unbind(window, "keydown", kt._keydownHandler, !1), pg(this);+ }), te.unbind(window, "keydown", kt._keydownHandler, !1), mg(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 = np(this, n.domElement);+ var s = rp(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], pg(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);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 - dg < n ? (te.addClass(e.domElement, kt.CLASS_TOO_TALL), e.__ul.style.height = window.innerHeight - t - dg + "px") : (te.removeClass(e.domElement, kt.CLASS_TOO_TALL), e.__ul.style.height = "auto");+ }), 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");}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(Do) && (Do = new CM(), Do.domElement.innerHTML = _M), this.parent)+ if (ue.isUndefined(Lo) && (Lo = new PM(), Lo.domElement.innerHTML = FM), 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 && MM(e), e.__rememberedObjects.indexOf(t) === -1 && e.__rememberedObjects.push(t);- }), this.autoPlace && Jd(this, this.width);+ e.__rememberedObjects.length === 0 && OM(e), e.__rememberedObjects.indexOf(t) === -1 && e.__rememberedObjects.push(t);+ }), this.autoPlace && ef(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] = il(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] = rl(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] = il(this), Xd(this, !1), this.saveToLocalStorageIfPossible();+ this.load.remembered || (this.load.remembered = {}), this.load.remembered[this.preset] = rl(this), Zd(this, !1), this.saveToLocalStorageIfPossible();},saveAs: function(e) {- this.load.remembered || (this.load.remembered = {}, this.load.remembered[Jo] = il(this, !0)), this.load.remembered[e] = il(this), this.preset = e, Yd(this, e, !0), this.saveToLocalStorageIfPossible();+ 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();},revert: function(e) {ue.each(this.__controllers, function(t) {- this.getRoot().load.remembered ? rx(e || this.getRoot(), t) : t.setValue(t.initialValue), t.__onFinishChange && t.__onFinishChange.call(t, t.getValue());+ this.getRoot().load.remembered ? hx(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 || Xd(this.getRoot(), !1);+ }), e || Zd(this.getRoot(), !1);},listen: function(e) {var t = this.__listening.length === 0;- this.__listening.push(e), t && ax(this.__listening);+ this.__listening.push(e), t && ux(this.__listening);},updateDisplay: function() {ue.each(this.__controllers, function(e) {@@ -27811,30 +27811,30 @@ ue.extend(}});-function np(i, e, t) {+function rp(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 pg(i) {+function mg(i) {te.unbind(window, "resize", i.__resizeHandler), i.saveToLocalStorageIfPossible && te.unbind(window, "unload", i.saveToLocalStorageIfPossible);}-function Xd(i, e) {+function Zd(i, e) {var t = i.__preset_select[i.__preset_select.selectedIndex];e ? t.innerHTML = t.value + "*" : t.innerHTML = t.value;}-function IM(i, e, t) {+function UM(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(), No(i, t.object, t.property, {+ return t.remove(), Po(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(), No(i, t.object, t.property, {+ return t.remove(), Po(i, t.object, t.property, {before: c,factoryArgs: [a]});@@ -27849,8 +27849,8 @@ function IM(i, e, t) {remove: function() {return t.__gui.remove(t), t;}- }), t instanceof Kd) {- var n = new Xl(t.object, t.property, { min: t.__min, max: t.__max, step: t.__step });+ }), t instanceof Yd) {+ var n = new Jl(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 IM(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 Xl) {+ } else if (t instanceof Jl) {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 = No(i, t.object, t.property, {+ var l = Po(i, t.object, t.property, {before: t.__li.nextElementSibling,factoryArgs: [t.__min, t.__max, t.__step]});@@ -27872,24 +27872,24 @@ function IM(i, e, t) {return a;};t.min = ue.compose(s, t.min), t.max = ue.compose(s, t.max);- } else t instanceof tx ? (te.bind(e, "click", function() {+ } else t instanceof ax ? (te.bind(e, "click", function() {te.fakeEvent(t.__checkbox, "click");}), te.bind(t.__checkbox, "click", function(r) {r.stopPropagation();- })) : t instanceof ix ? (te.bind(e, "click", function() {+ })) : t instanceof cx ? (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 Jd && (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() && Xd(i.getRoot(), !0), r;+ return i.getRoot().__preset_select && t.isModified() && Zd(i.getRoot(), !0), r;}, t.setValue);}-function rx(i, e) {+function hx(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 rx(i, e) {var r = t.load.remembered, a = void 0;if (r[i.preset])a = r[i.preset];- else if (r[Jo])- a = r[Jo];+ else if (r[$o])+ a = r[$o];elsereturn;if (a[n] && a[n][e.property] !== void 0) {@@ -27908,35 +27908,35 @@ function rx(i, e) {}}}-function No(i, e, t, n) {+function Po(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 Jd(e, t);else {var r = [e, t].concat(n.factoryArgs);- s = yM.apply(i, r);+ s = NM.apply(i, r);}- n.before instanceof Or && (n.before = n.before.__li), rx(i, s), te.addClass(s.domElement, "c");+ n.before instanceof Gr && (n.before = n.before.__li), hx(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 = np(i, o, n.before);- return te.addClass(c, kt.CLASS_CONTROLLER_ROW), s instanceof jd ? te.addClass(c, "color") : te.addClass(c, dM(s.getValue())), IM(i, c, s), i.__controllers.push(s), s;+ 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;}-function ua(i, e) {+function fa(i, e) {return document.location.href + "." + e;}-function Yd(i, e, t) {+function $d(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 Ag(i, e) {+function xg(i, e) {e.style.display = i.useLocalStorage ? "block" : "none";}-function MM(i) {+function OM(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 MM(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) {- Yd(i, d, d === i.preset);- }) : Yd(i, Jo, !1), te.bind(a, "change", function() {+ $d(i, d, d === i.preset);+ }) : $d(i, $o, !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), yo) {+ }), e.appendChild(a), e.appendChild(t), e.appendChild(n), e.appendChild(s), e.appendChild(r), vo) {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(ua(i, "isLocal")) === "true" && c.setAttribute("checked", "checked"), Ag(i, o), te.bind(c, "change", function() {- i.useLocalStorage = !i.useLocalStorage, Ag(i, o);+ 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);});}var h = document.getElementById("dg-new-constructor");te.bind(h, "keydown", function(u) {- u.metaKey && (u.which === 67 || u.keyCode === 67) && Do.hide();+ u.metaKey && (u.which === 67 || u.keyCode === 67) && Lo.hide();}), te.bind(t, "click", function() {- h.innerHTML = JSON.stringify(i.getSaveObject(), void 0, 2), Do.show(), h.focus(), h.select();+ h.innerHTML = JSON.stringify(i.getSaveObject(), void 0, 2), Lo.show(), h.focus(), h.select();}), te.bind(n, "click", function() {i.save();}), te.bind(s, "click", function() {@@ -27974,7 +27974,7 @@ function MM(i) {i.revert();});}-function BM(i) {+function QM(i) {var e = void 0;i.__resize_handle = document.createElement("div"), ue.extend(i.__resize_handle.style, {width: "6px",@@ -27994,10 +27994,10 @@ function BM(i) {}te.bind(i.__resize_handle, "mousedown", s), te.bind(i.__closeButton, "mousedown", s), i.domElement.insertBefore(i.__resize_handle, i.domElement.firstElementChild);}-function Jd(i, e) {+function ef(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 il(i, e) {+function rl(i, e) {var t = {};return ue.each(i.__rememberedObjects, function(n, s) {var r = {}, a = i.__rememberedObjectIndecesToControllers[s];@@ -28006,19 +28006,19 @@ function il(i, e) {}), t[s] = r;}), t;}-function TM(i) {+function GM(i) {for (var e = 0; e < i.__preset_select.length; e++)i.__preset_select[e].value === i.preset && (i.__preset_select.selectedIndex = e);}-function ax(i) {- i.length !== 0 && vM.call(window, function() {- ax(i);+function ux(i) {+ i.length !== 0 && LM.call(window, function() {+ ux(i);}), ue.each(i, function(e) {e.updateDisplay();});}-var RM = kt;-const sl = [+var HM = kt;+const al = [{id: "",name: "None",@@ -28042,7 +28042,7 @@ const sl = [path: "https://storage.googleapis.com/donmccurdy-static/footprint_court_2k.exr",format: ".exr"}-], FM = [+], zM = ["BN","BN","BN",@@ -28299,7 +28299,7 @@ const sl = ["L","L","L"-], gg = [+], bg = [[697, 698, "ON"],[706, 719, "ON"],[722, 735, "ON"],@@ -29015,12 +29015,12 @@ const sl = [[1048574, 1048575, "BN"],[1114110, 1114111, "BN"]];-function DM(i) {+function VM(i) {if (i <= 255)- return FM[i];- let e = 0, t = gg.length - 1;+ return zM[i];+ let e = 0, t = bg.length - 1;for (; e <= t; ) {- const n = e + t >> 1, s = gg[n];+ const n = e + t >> 1, s = bg[n];if (i < s[0]) {t = n - 1;continue;@@ -29033,7 +29033,7 @@ function DM(i) {}return "L";}-function NM(i) {+function WM(i) {const e = i.length;if (e === 0)return null;@@ -29046,7 +29046,7 @@ function NM(i) {const p = i.charCodeAt(l + 1);p >= 56320 && p <= 57343 && (u = (h - 55296 << 10) + (p - 56320) + 65536, d = 2);}- const f = DM(u);+ const f = VM(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 NM(i) {}return r;}-function LM(i, e) {- const t = NM(i);+function qM(i, e) {+ const t = WM(i);if (t === null)return null;const n = new Int8Array(e.length);@@ -29129,35 +29129,35 @@ function LM(i, e) {n[s] = t[e[s]];return n;}-const PM = /[ \t\n\r\f]+/g, kM = /[\t\n\r\f]| {2,}|^ | $/;-function UM(i) {+const KM = /[ \t\n\r\f]+/g, jM = /[\t\n\r\f]| {2,}|^ | $/;+function XM(i) {const e = i ?? "normal";return e === "pre-wrap" ? { mode: e, preserveOrdinarySpaces: !0, preserveHardBreaks: !0 } : { mode: e, preserveOrdinarySpaces: !1, preserveHardBreaks: !1 };}-function OM(i) {- if (!kM.test(i))+function YM(i) {+ if (!jM.test(i))return i;- let e = i.replace(PM, " ");+ let e = i.replace(KM, " ");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 QM(i) {+function JM(i) {return /[\r\f]/.test(i) ? i.replace(/\r\n/g, ``).replace(/[\r\f]/g, ``) : i.replace(/\r\n/g, ``);}-let yu = null, GM;-function HM() {- return yu === null && (yu = new Intl.Segmenter(GM, { granularity: "word" })), yu;+let Cu = null, ZM;+function $M() {+ return Cu === null && (Cu = new Intl.Segmenter(ZM, { granularity: "word" })), Cu;}-const zM = new RegExp("\\p{Script=Arabic}", "u"), xh = new RegExp("\\p{M}", "u"), ox = new RegExp("\\p{Nd}", "u");-function mg(i) {- return zM.test(i);+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);}-function xg(i) {+function yg(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 Fr(i) {+function Lr(i) {for (let e = 0; e < i.length; e++) {const t = i.charCodeAt(e);if (!(t < 12288)) {@@ -29165,39 +29165,39 @@ function Fr(i) {const n = i.charCodeAt(e + 1);if (n >= 56320 && n <= 57343) {const s = (t - 55296 << 10) + (n - 56320) + 65536;- if (xg(s))+ if (yg(s))return !0;e++;continue;}}- if (xg(t))+ if (yg(t))return !0;}}return !1;}-function VM(i) {- const e = Eh(i);- return e !== null && (ip.has(e) || Dr.has(e));+function tB(i) {+ const e = _h(i);+ return e !== null && (ap.has(e) || Pr.has(e));}-const WM = /* @__PURE__ */ new Set([+const nB = /* @__PURE__ */ new Set([" "," ","","\uFEFF"]);-function qM(i) {- return Fr(i);+function iB(i) {+ return Lr(i);}-function KM(i) {- const e = Eh(i);- return e !== null && WM.has(e);+function sB(i) {+ const e = _h(i);+ return e !== null && nB.has(e);}-function jM(i) {- return !VM(i) && !KM(i);+function rB(i) {+ return !tB(i) && !sB(i);}-const ip = /* @__PURE__ */ new Set([+const ap = /* @__PURE__ */ new Set([",",".","!",@@ -29224,7 +29224,7 @@ const ip = /* @__PURE__ */ new Set(["ゞ","ヽ","ヾ"-]), bh = /* @__PURE__ */ new Set([+]), yh = /* @__PURE__ */ new Set(['"',"(","[",@@ -29243,10 +29243,10 @@ const ip = /* @__PURE__ */ new Set(["〖","〘","〚"-]), sp = /* @__PURE__ */ new Set([+]), op = /* @__PURE__ */ new Set(["'","’"-]), Dr = /* @__PURE__ */ new Set([+]), Pr = /* @__PURE__ */ new Set([".",",","!",@@ -29273,14 +29273,14 @@ const ip = /* @__PURE__ */ new Set(["»","›","…"-]), XM = /* @__PURE__ */ new Set([+]), aB = /* @__PURE__ */ new Set([":",".","،","؛"-]), YM = /* @__PURE__ */ new Set([+]), oB = /* @__PURE__ */ new Set(["၏"-]), JM = /* @__PURE__ */ new Set([+]), cB = /* @__PURE__ */ new Set(["”","’","»",@@ -29293,39 +29293,39 @@ const ip = /* @__PURE__ */ new Set(["〕",")"]);-function ZM(i) {- if (rp(i))+function lB(i) {+ if (cp(i))return !0;let e = !1;for (const t of i) {- if (Dr.has(t)) {+ if (Pr.has(t)) {e = !0;continue;}- if (!(e && xh.test(t)))+ if (!(e && Eh.test(t)))return !1;}return e;}-function $M(i) {+function hB(i) {for (const e of i)- if (!ip.has(e) && !Dr.has(e))+ if (!ap.has(e) && !Pr.has(e))return !1;return i.length > 0;}-function eB(i) {- if (rp(i))+function uB(i) {+ if (cp(i))return !0;for (const e of i)- if (!bh.has(e) && !sp.has(e) && !xh.test(e))+ if (!yh.has(e) && !op.has(e) && !Eh.test(e))return !1;return i.length > 0;}-function rp(i) {+function cp(i) {let e = !1;for (const t of i)- if (!(t === "\\" || xh.test(t))) {- if (bh.has(t) || Dr.has(t) || sp.has(t)) {+ if (!(t === "\\" || Eh.test(t))) {+ if (yh.has(t) || Pr.has(t) || op.has(t)) {e = !0;continue;}@@ -29333,7 +29333,7 @@ function rp(i) {}return e;}-function cx(i, e) {+function fx(i, e) {const t = e - 1;if (t <= 0)return Math.max(t, 0);@@ -29346,22 +29346,22 @@ function cx(i, e) {const r = i.charCodeAt(s);return r >= 55296 && r <= 56319 ? s : t;}-function Eh(i) {+function _h(i) {if (i.length === 0)return null;- const e = cx(i, i.length);+ const e = fx(i, i.length);return i.slice(e);}-function tB(i) {+function dB(i) {const e = Array.from(i);let t = e.length;for (; t > 0; ) {const n = e[t - 1];- if (xh.test(n)) {+ if (Eh.test(n)) {t--;continue;}- if (bh.has(n) || sp.has(n)) {+ if (yh.has(n) || op.has(n)) {t--;continue;}@@ -29372,10 +29372,10 @@ function tB(i) {tail: e.slice(t).join("")};}-function nB(i, e, t) {+function fB(i, e, t) {return t === "text" && !e && i.length === 1 && i !== "-" && i !== "—" ? i : null;}-function bg(i, e, t, n) {+function _g(i, e, t, n) {const s = e[n], r = i[n];if (s == null)return r;@@ -29385,32 +29385,32 @@ function bg(i, e, t, n) {const o = s.repeat(a);return i[n] = o, o;}-function Eg(i, e) {- return i && e !== null && XM.has(e);+function wg(i, e) {+ return i && e !== null && aB.has(e);}-function iB(i) {- const e = Eh(i);- return e !== null && YM.has(e);+function pB(i) {+ const e = _h(i);+ return e !== null && oB.has(e);}-function sB(i) {+function AB(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 Zd(i) {+function tf(i) {let e = i.length;for (; e > 0; ) {- const t = cx(i, e), n = i.slice(t, e);- if (JM.has(n))+ const t = fx(i, e), n = i.slice(t, e);+ if (cB.has(n))return !0;- if (!Dr.has(n))+ if (!Pr.has(n))return !1;e = t;}return !1;}-function rB(i, e) {+function gB(i, e) {if (e.preserveOrdinarySpaces || e.preserveHardBreaks) {if (i === " ")return "preserved-space";@@ -29422,23 +29422,23 @@ function rB(i, e) {}return i === " " ? "space" : i === " " || i === " " || i === "" || i === "\uFEFF" ? "glue" : i === "" ? "zero-width-break" : i === "" ? "soft-hyphen" : "text";}-const aB = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;+const mB = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function di(i) {return i.length === 1 ? i[0] : i.join("");}-function oB(i, e) {+function xB(i, e) {const t = [];for (let n = i.length - 1; n >= 0; n--)t.push(i[n]);return t.push(e), di(t);}-function cB(i, e, t, n) {- if (!aB.test(i))+function bB(i, e, t, n) {+ if (!mB.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 = rB(h, n), d = u === "text" && e;+ const u = gB(h, n), d = u === "text" && e;if (r !== null && u === r && d === c) {a.push(h), l += h.length;continue;@@ -29457,25 +29457,25 @@ function cB(i, e, t, n) {start: o}), s;}-function $d(i) {+function nf(i) {return i === "space" || i === "preserved-space" || i === "zero-width-break" || i === "hard-break";}-const lB = /^[A-Za-z][A-Za-z0-9+.-]*:$/;-function hB(i, e) {+const EB = /^[A-Za-z][A-Za-z0-9+.-]*:$/;+function yB(i, e) {const t = i.texts[e];- return t.startsWith("www.") ? !0 : lB.test(t) && e + 1 < i.len && i.kinds[e + 1] === "text" && i.texts[e + 1] === "//";+ return t.startsWith("www.") ? !0 : EB.test(t) && e + 1 < i.len && i.kinds[e + 1] === "text" && i.texts[e + 1] === "//";}-function uB(i) {+function _B(i) {return i.includes("?") && (i.includes("://") || i.startsWith("www."));}-function dB(i) {+function wB(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" || !hB(i, a))+ if (n[a] !== "text" || !yB(i, a))continue;const o = [e[a]];let c = a + 1;- for (; c < i.len && !$d(n[c]); ) {+ for (; c < i.len && !nf(n[c]); ) {o.push(e[c]), t[a] = !0;const l = e[c].includes("?");if (n[c] = "text", e[c] = "", c++, l)@@ -29496,18 +29496,18 @@ function dB(i) {starts: s};}-function fB(i) {+function vB(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]), !uB(a))+ if (e.push(a), t.push(i.isWordLike[r]), n.push(i.kinds[r]), s.push(i.starts[r]), !_B(a))continue;const o = r + 1;- if (o >= i.len || $d(i.kinds[o]))+ if (o >= i.len || nf(i.kinds[o]))continue;const c = [], l = i.starts[o];let h = o;- for (; h < i.len && !$d(i.kinds[h]); )+ for (; h < i.len && !nf(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);}@@ -29519,7 +29519,7 @@ function fB(i) {starts: s};}-const pB = /* @__PURE__ */ new Set([+const CB = /* @__PURE__ */ new Set([":","-","/",@@ -29529,29 +29529,29 @@ const pB = /* @__PURE__ */ new Set(["+","–","—"-]), _g = /^[A-Za-z0-9_]+[,:;]*$/, yg = /[,:;]+$/;-function lx(i) {+]), vg = /^[A-Za-z0-9_]+[,:;]*$/, Cg = /[,:;]+$/;+function px(i) {for (const e of i)- if (ox.test(e))+ if (dx.test(e))return !0;return !1;}-function Yl(i) {+function Zl(i) {if (i.length === 0)return !1;for (const e of i)- if (!(ox.test(e) || pB.has(e)))+ if (!(dx.test(e) || CB.has(e)))return !1;return !0;}-function AB(i) {+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" && Yl(a) && lx(a)) {+ if (o === "text" && Zl(a) && px(a)) {const c = [a];let l = r + 1;- for (; l < i.len && i.kinds[l] === "text" && Yl(i.texts[l]); )+ for (; l < i.len && i.kinds[l] === "text" && Zl(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;continue;@@ -29566,16 +29566,16 @@ function AB(i) {starts: s};}-function gB(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], c = i.isWordLike[r];- if (o === "text" && c && _g.test(a)) {+ if (o === "text" && c && vg.test(a)) {const l = [a];- let h = yg.test(a), u = r + 1;- for (; h && u < i.len && i.kinds[u] === "text" && i.isWordLike[u] && _g.test(i.texts[u]); ) {+ 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]); ) {const d = i.texts[u];- l.push(d), h = yg.test(d), u++;+ l.push(d), h = Cg.test(d), u++;}e.push(di(l)), t.push(!0), n.push("text"), s.push(i.starts[r]), r = u - 1;continue;@@ -29590,7 +29590,7 @@ function gB(i) {starts: s};}-function mB(i) {+function MB(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 || !lx(h) || !Yl(h)) && (c = !1);+ (h.length === 0 || !px(h) || !Zl(h)) && (c = !1);}if (c) {let l = 0;@@ -29622,7 +29622,7 @@ function mB(i) {starts: s};}-function xB(i) {+function BB(i) {const e = [], t = [], n = [], s = [];let r = 0;for (; r < i.len; ) {@@ -29663,12 +29663,12 @@ function xB(i) {starts: s};}-function bB(i) {+function TB(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" || !Fr(e[r]) || !Fr(e[r + 1]))+ if (n[r] !== "text" || n[r + 1] !== "text" || !Lr(e[r]) || !Lr(e[r + 1]))continue;- const a = tB(e[r]);+ const a = dB(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,66 +29679,66 @@ function bB(i) {starts: s};}-function wg(i, e, t) {- const n = HM();+function Ig(i, e, t) {+ const n = $M();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 S of cB(w.segment, w.isWordLike ?? !1, w.index, t)) {+ for (const I of bB(w.segment, w.isWordLike ?? !1, w.index, t)) {let O = function() {- h[N] !== null && (a[N] = [- bg(r, h, u, N)- ], h[N] = null), a[N].push(S.text), o[N] = o[N] || S.isWordLike, d[N] = d[N] || v, f[N] = f[N] || F, p[N] = q, m[N] = $, g[N] = Eg(f[N], K);+ 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);};- const T = S.kind === "text", C = nB(S.text, S.isWordLike, S.kind), v = Fr(S.text), F = mg(S.text), K = Eh(S.text), q = Zd(S.text), $ = iB(S.text), N = s - 1;- e.carryCJKAfterClosingQuote && T && s > 0 && c[N] === "text" && v && d[N] && p[N] || T && s > 0 && c[N] === "text" && $M(S.text) && d[N] || T && s > 0 && c[N] === "text" && m[N] ? O() : T && s > 0 && c[N] === "text" && S.isWordLike && F && g[N] ? (O(), o[N] = !0) : C !== null && s > 0 && c[N] === "text" && h[N] === C ? u[N] = (u[N] ?? 1) + 1 : T && !S.isWordLike && s > 0 && c[N] === "text" && (ZM(S.text) || S.text === "-" && o[N]) ? O() : (r[s] = S.text, a[s] = [S.text], o[s] = S.isWordLike, c[s] = S.kind, l[s] = S.start, h[s] = C, u[s] = C === null ? 0 : 1, d[s] = v, f[s] = F, p[s] = q, m[s] = $, g[s] = Eg(F, K), s++);+ 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++);}for (let w = 0; w < s; w++) {if (h[w] !== null) {- r[w] = bg(r, h, u, w);+ r[w] = _g(r, h, u, w);continue;}r[w] = di(a[w]);}for (let w = 1; w < s; w++)- c[w] === "text" && !o[w] && rp(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] && cp(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 y = -1;+ let _ = -1;for (let w = s - 1; w >= 0; w--) {- const S = r[w];- if (S.length !== 0) {- if (c[w] === "text" && !o[w] && eB(S) && y >= 0 && c[y] === "text") {- const T = A[y] ?? [];- T.push(S), A[y] = T, l[y] = l[w], r[w] = "";+ const I = r[w];+ if (I.length !== 0) {+ if (c[w] === "text" && !o[w] && uB(I) && _ >= 0 && c[_] === "text") {+ const T = A[_] ?? [];+ T.push(I), A[_] = T, l[_] = l[w], r[w] = "";continue;}- y = w;+ _ = w;}}for (let w = 0; w < s; w++) {- const S = A[w];- S != null && (r[w] = oB(S, r[w]));+ const I = A[w];+ I != null && (r[w] = xB(I, r[w]));}let x = 0;for (let w = 0; w < s; w++) {- const S = r[w];- S.length !== 0 && (x !== w && (r[x] = S, o[x] = o[w], c[x] = c[w], l[x] = l[w]), x++);+ 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 = xB({+ const E = BB({len: x,texts: r,isWordLike: o,kinds: c,starts: l- }), I = bB(gB(mB(AB(fB(dB(E))))));- for (let w = 0; w < I.len - 1; w++) {- const S = sB(I.texts[w]);- S !== null && (I.kinds[w] !== "space" && I.kinds[w] !== "preserved-space" || I.kinds[w + 1] !== "text" || !mg(I.texts[w + 1]) || (I.texts[w] = S.space, I.isWordLike[w] = !1, I.kinds[w] = I.kinds[w] === "preserved-space" ? "preserved-space" : "space", I.texts[w + 1] = S.marks + I.texts[w + 1], I.starts[w + 1] = I.starts[w] + S.space.length));+ }), S = TB(SB(MB(IB(vB(wB(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));}- return I;+ return S;}-function EB(i, e) {+function RB(i, e) {if (i.len === 0)return [];if (!e.preserveHardBreaks)@@ -29761,7 +29761,7 @@ function EB(i, e) {consumedEndSegmentIndex: i.len}), t;}-function _B(i) {+function FB(i) {if (i.len <= 1)return i;const e = [], t = [], n = [], s = [];@@ -29772,7 +29772,7 @@ function _B(i) {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 = qM(d), A = jM(d);+ const g = iB(d), A = rB(d);if (r !== null && c && l) {r.push(d), a = a || p, c = c || g, l = A;continue;@@ -29790,8 +29790,8 @@ function _B(i) {starts: s};}-function yB(i, e, t = "normal", n = "normal") {- const s = UM(t), r = s.mode === "pre-wrap" ? QM(i) : OM(i);+function NB(i, e, t = "normal", n = "normal") {+ const s = XM(t), r = s.mode === "pre-wrap" ? JM(i) : YM(i);if (r.length === 0)return {normalized: r,@@ -29802,75 +29802,75 @@ function yB(i, e, t = "normal", n = "normal") {kinds: [],starts: []};- const a = n === "keep-all" ? _B(wg(r, e, s)) : wg(r, e, s);+ const a = n === "keep-all" ? FB(Ig(r, e, s)) : Ig(r, e, s);return {normalized: r,- chunks: EB(a, s),+ chunks: RB(a, s),...a};}-let aa = null;-const vg = /* @__PURE__ */ new Map();-let oa = null;-const wB = 96, vB = new RegExp("\\p{Emoji_Presentation}", "u"), CB = /[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;-let wu = null;-const Cg = /* @__PURE__ */ new Map();-function ap() {- if (aa !== null)- return aa;+let ca = null;+const Sg = /* @__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() {+ if (ca !== null)+ return ca;if (typeof OffscreenCanvas < "u")- return aa = new OffscreenCanvas(1, 1).getContext("2d"), aa;+ return ca = new OffscreenCanvas(1, 1).getContext("2d"), ca;if (typeof document < "u")- return aa = document.createElement("canvas").getContext("2d"), aa;+ return ca = document.createElement("canvas").getContext("2d"), ca;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.");}-function SB(i) {- let e = vg.get(i);- return e || (e = /* @__PURE__ */ new Map(), vg.set(i, e)), e;+function kB(i) {+ let e = Sg.get(i);+ return e || (e = /* @__PURE__ */ new Map(), Sg.set(i, e)), e;}function Qs(i, e) {let t = e.get(i);return t === void 0 && (t = {- width: ap().measureText(i).width,- containsCJK: Fr(i)+ width: lp().measureText(i).width,+ containsCJK: Lr(i)}, e.set(i, t)), t;}-function Xa() {- if (oa !== null)- return oa;+function Ya() {+ if (la !== null)+ return la;if (typeof navigator > "u")- return oa = {+ return la = {lineFitEpsilon: 5e-3,carryCJKAfterClosingQuote: !1,preferPrefixWidthsForBreakableRuns: !1,preferEarlySoftHyphenBreak: !1- }, oa;+ }, la;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 oa = {+ return la = {lineFitEpsilon: t ? 1 / 64 : 5e-3,carryCJKAfterClosingQuote: n,preferPrefixWidthsForBreakableRuns: t,preferEarlySoftHyphenBreak: t- }, oa;+ }, la;}-function IB(i) {+function UB(i) {const e = i.match(/(\d+(?:\.\d+)?)\s*px/);return e ? parseFloat(e[1]) : 16;}-function hx() {- return wu === null && (wu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), wu;+function Ax() {+ return Iu === null && (Iu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Iu;}-function MB(i) {- return vB.test(i) || i.includes("️");+function OB(i) {+ return LB.test(i) || i.includes("️");}-function BB(i) {- return CB.test(i);+function QB(i) {+ return PB.test(i);}-function TB(i, e) {- let t = Cg.get(i);+function GB(i, e) {+ let t = Mg.get(i);if (t !== void 0)return t;- const n = ap();+ const n = lp();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 TB(i, e) {const a = r.getBoundingClientRect().width;document.body.removeChild(r), s - a > 0.5 && (t = s - a);}- return Cg.set(i, t), t;+ return Mg.set(i, t), t;}-function RB(i) {+function HB(i) {let e = 0;- const t = hx();+ const t = Ax();for (const n of t.segment(i))- MB(n.segment) && e++;+ OB(n.segment) && e++;return e;}-function FB(i, e) {- return e.emojiCount === void 0 && (e.emojiCount = RB(i)), e.emojiCount;+function zB(i, e) {+ return e.emojiCount === void 0 && (e.emojiCount = HB(i)), e.emojiCount;}-function br(i, e, t) {- return t === 0 ? e.width : e.width - FB(i, e) * t;+function yr(i, e, t) {+ return t === 0 ? e.width : e.width - zB(i, e) * t;}-function DB(i, e, t, n, s) {+function VB(i, e, t, n, s) {if (e.breakableFitAdvances !== void 0)return e.breakableFitAdvances;- const r = hx(), a = [];+ const r = Ax(), a = [];for (const h of r.segment(i))a.push(h.segment);if (a.length <= 1)@@ -29906,20 +29906,20 @@ function DB(i, e, t, n, s) {const h = [];for (const u of a) {const d = Qs(u, t);- h.push(br(u, d, n));+ h.push(yr(u, d, n));}return e.breakableFitAdvances = h, e.breakableFitAdvances;}- if (s === "pair-context" || a.length > wB) {+ if (s === "pair-context" || a.length > DB) {const h = [];let u = null, d = 0;for (const f of a) {- const p = Qs(f, t), m = br(f, p, n);+ const p = Qs(f, t), m = yr(f, p, n);if (u === null)h.push(m);else {const g = u + f, A = Qs(g, t);- h.push(br(g, A, n) - d);+ h.push(yr(g, A, n) - d);}u = f, d = m;}@@ -29929,18 +29929,18 @@ function DB(i, e, t, n, s) {let c = "", l = 0;for (const h of a) {c += h;- const u = Qs(c, t), d = br(c, u, n);+ const u = Qs(c, t), d = yr(c, u, n);o.push(d - l), l = d;}return e.breakableFitAdvances = o, e.breakableFitAdvances;}-function NB(i, e) {- const t = ap();+function WB(i, e) {+ const t = lp();t.font = i;- const n = SB(i), s = IB(i), r = e ? TB(i, s) : 0;+ const n = kB(i), s = UB(i), r = e ? GB(i, s) : 0;return { cache: n, fontSize: s, emojiCorrection: r };}-function LB(i, e) {+function qB(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 LB(i, e) {}return e;}-function ux(i, e) {+function gx(i, e) {if (e <= 0)return 0;const t = i % e;return Math.abs(t) <= 1e-6 ? e : e - t;}-function dx(i, e, t, n, s) {+function mx(i, e, t, n, s) {let r = 0, a = e;for (; r < i.length; ) {const o = a + i[r];@@ -29965,7 +29965,7 @@ function dx(i, e, t, n, s) {}return { fitCount: r, fittedWidth: a };}-function PB(i, e) {+function KB(i, e) {let t = 0, n = i.chunks.length;for (; t < n; ) {const s = Math.floor((t + n) / 2);@@ -29973,7 +29973,7 @@ function PB(i, e) {}return t < i.chunks.length ? t : -1;}-function fx(i, e, t) {+function xx(i, e, t) {let n = t.segmentIndex;if (t.graphemeIndex > 0)return e;@@ -29988,30 +29988,30 @@ function fx(i, e, t) {}return s.consumedEndSegmentIndex >= i.widths.length ? -1 : (t.segmentIndex = s.consumedEndSegmentIndex, t.graphemeIndex = 0, e + 1);}-function op(i, e) {+function hp(i, e) {if (e.segmentIndex >= i.widths.length)return -1;- const t = PB(i, e.segmentIndex);- return t < 0 ? -1 : fx(i, t, e);+ const t = KB(i, e.segmentIndex);+ return t < 0 ? -1 : xx(i, t, e);}-function kB(i, e, t) {+function jB(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 : fx(i, n, t);+ return n >= i.chunks.length ? -1 : xx(i, n, t);}-function UB(i, e) {- return i.simpleLineWalkFastPath ? px(i, e) : cp(i, e);+function XB(i, e) {+ return i.simpleLineWalkFastPath ? bx(i, e) : up(i, e);}-function px(i, e, t) {+function bx(i, e, t) {const { widths: n, kinds: s, breakableFitAdvances: r } = i;if (n.length === 0)return 0;- const o = Xa().lineFitEpsilon, c = e + o;+ const o = Ya().lineFitEpsilon, c = e + o;let l = 0, h = 0, u = !1, d = 0, f = 0, p = 0, m = 0, g = -1, A = 0;- function y() {+ function _() {g = -1, A = 0;}function x(C = p, v = m, F = h) {@@ -30021,12 +30021,12 @@ function px(i, e, t) {endSegmentIndex: C,endGraphemeIndex: v,width: F- }), h = 0, u = !1, y();+ }), h = 0, u = !1, _();}function E(C, v) {u = !0, d = C, f = 0, p = C + 1, m = 0, h = v;}- function I(C, v, F) {+ function S(C, v, F) {u = !0, d = C, f = v, p = C, m = v + 1, h = F;}function w(C, v) {@@ -30036,19 +30036,19 @@ function px(i, e, t) {}h += v, p = C + 1, m = 0;}- function S(C, v) {+ 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(), I(C, K, q)) : (h += q, p = C, m = K + 1) : I(C, K, q);+ 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 = LB(i, T), T >= n.length)); ) {+ for (; T < n.length && !(!u && (T = qB(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 ? S(T, 0) : E(T, C), F && (g = T + 1, A = h - C), T++;+ C > e && r[T] !== null ? I(T, 0) : E(T, C), F && (g = T + 1, A = h - C), T++;continue;}if (h + C > c) {@@ -30065,7 +30065,7 @@ function px(i, e, t) {continue;}if (C > e && r[T] !== null) {- x(), S(T, 0), T++;+ x(), I(T, 0), T++;continue;}x();@@ -30075,31 +30075,31 @@ function px(i, e, t) {}return u && x(), l;}-function cp(i, e, t) {+function up(i, e, t) {if (i.simpleLineWalkFastPath)- return px(i, e, t);+ return bx(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 = Xa(), d = u.lineFitEpsilon, f = e + d;- let p = 0, m = 0, g = !1, A = 0, y = 0, x = 0, E = 0, I = -1, w = 0, S = 0, T = null;+ const u = Ya(), 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() {- I = -1, w = 0, S = 0, T = null;+ S = -1, w = 0, I = 0, T = null;}function v(Q = x, J = E, ee = m) {p++, t?.({startSegmentIndex: A,- startGraphemeIndex: y,+ startGraphemeIndex: _,endSegmentIndex: Q,endGraphemeIndex: J,width: ee}), m = 0, g = !1, C();}function F(Q, J) {- g = !0, A = Q, y = 0, x = Q + 1, E = 0, m = J;+ g = !0, A = Q, _ = 0, x = Q + 1, E = 0, m = J;}function K(Q, J, ee) {- g = !0, A = Q, y = J, x = Q, E = J + 1, m = ee;+ g = !0, A = Q, _ = J, x = Q, E = J + 1, m = ee;}function q(Q, J) {if (!g) {@@ -30111,14 +30111,14 @@ function cp(i, e, t) {function $(Q, J, ee, ae) {if (!J)return;- const ye = Q === "tab" ? 0 : s[ee], Me = Q === "tab" ? ae : r[ee];- I = ee + 1, w = m - ae + ye, S = m - ae + Me, T = Q;+ 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 N(Q, J) {+ function D(Q, J) {const ee = o[Q];for (let ae = J; ae < ee.length; ae++) {- const ye = ee[ae];- g ? m + ye > f ? (v(), K(Q, ae, ye)) : (m += ye, x = Q, E = ae + 1) : K(Q, ae, ye);+ 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);}@@ -30128,8 +30128,8 @@ function cp(i, e, t) {const J = o[Q];if (J == null)return !1;- const { fitCount: ee, fittedWidth: ae } = dx(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), N(Q, ee), !0));+ const { fitCount: ee, fittedWidth: ae } = mx(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?.({@@ -30146,195 +30146,195 @@ function cp(i, e, t) {Y(J);continue;}- g = !1, m = 0, A = J.startSegmentIndex, y = 0, x = J.startSegmentIndex, E = 0, C();+ 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], ye = ae === "space" || ae === "preserved-space" || ae === "tab" || ae === "zero-width-break" || ae === "soft-hyphen", Me = ae === "tab" ? ux(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" ? gx(m, l) : n[ee];if (ae === "soft-hyphen") {- g && (x = ee + 1, E = 0, I = ee + 1, w = m + c, S = m + c, T = ae), ee++;+ 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 ? N(ee, 0) : F(ee, Me), $(ae, ye, ee, Me), ee++;+ 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(I, 0, S);+ v(S, 0, I);continue;}if (T === "soft-hyphen" && O(ee)) {ee++;continue;}- if (ye && me <= f) {+ if (_e && me <= f) {q(ee, Me), v(ee + 1, 0, xe), ee++;continue;}- if (I >= 0 && w <= f) {- if (x > I || x === I && E > 0) {+ if (S >= 0 && w <= f) {+ if (x > S || x === S && E > 0) {v();continue;}- const be = I;- v(be, 0, S), ee = be;+ const be = S;+ v(be, 0, I), ee = be;continue;}if (Me > e && o[ee] !== null) {- v(), N(ee, 0), ee++;+ v(), D(ee, 0), ee++;continue;}v();continue;}- q(ee, Me), $(ae, ye, ee, Me), ee++;+ q(ee, Me), $(ae, _e, ee, Me), ee++;}if (g) {- const ae = I === J.consumedEndSegmentIndex ? S : m;+ const ae = S === J.consumedEndSegmentIndex ? I : m;v(J.consumedEndSegmentIndex, 0, ae);}}return p;}-function lp(i, e, t, n) {+function dp(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 = Xa(), f = d.lineFitEpsilon, p = n + f;- let m = 0, g = !1, A = e.segmentIndex, y = e.graphemeIndex, x = -1, E = 0, I = 0, w = null;- function S() {- x = -1, E = 0, I = 0, w = null;+ const { widths: r, lineEndFitAdvances: a, lineEndPaintAdvances: o, kinds: c, breakableFitAdvances: l, discretionaryHyphenWidth: h, tabStopAdvance: u } = i, d = Ya(), 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(N = A, O = y, Y = m) {- return g ? (e.segmentIndex = N, e.graphemeIndex = O, Y) : null;+ function T(D = A, O = _, Y = m) {+ return g ? (e.segmentIndex = D, e.graphemeIndex = O, Y) : null;}- function C(N, O) {- g = !0, A = N + 1, y = 0, m = O;+ function C(D, O) {+ g = !0, A = D + 1, _ = 0, m = O;}- function v(N, O, Y) {- g = !0, A = N, y = O + 1, m = Y;+ function v(D, O, Y) {+ g = !0, A = D, _ = O + 1, m = Y;}- function F(N, O) {+ function F(D, O) {if (!g) {- C(N, O);+ C(D, O);return;}- m += O, A = N + 1, y = 0;+ m += O, A = D + 1, _ = 0;}- function K(N, O, Y, Q) {+ function K(D, O, Y, Q) {if (!O)return;- const J = N === "tab" ? 0 : a[Y], ee = N === "tab" ? Q : o[Y];- x = Y + 1, E = m - Q + J, I = m - Q + ee, w = N;+ 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(N, O) {- const Y = l[N];+ function q(D, O) {+ const Y = l[D];for (let Q = O; Q < Y.length; Q++) {const J = Y[Q];if (!g)- v(N, Q, J);+ v(D, Q, J);else {if (m + J > p)return T();- m += J, A = N, y = Q + 1;+ m += J, A = D, _ = Q + 1;}}- return g && A === N && y === Y.length && (A = N + 1, y = 0), null;+ return g && A === D && _ === Y.length && (A = D + 1, _ = 0), null;}- function $(N) {+ function $(D) {if (w !== "soft-hyphen" || x < 0)return null;- const O = l[N] ?? null;+ const O = l[D] ?? null;if (O !== null) {- const { fitCount: Y, fittedWidth: Q } = dx(O, m, n, f, h);+ const { fitCount: Y, fittedWidth: Q } = mx(O, m, n, f, h);if (Y === O.length)- return m = Q, A = N + 1, y = 0, S(), null;+ return m = Q, A = D + 1, _ = 0, I(), null;if (Y > 0)- return T(N, Y, Q + h);+ return T(D, Y, Q + h);}- return E <= p ? T(x, 0, I) : null;+ return E <= p ? T(x, 0, S) : null;}- for (let N = e.segmentIndex; N < s.endSegmentIndex; N++) {- const O = c[N], Y = O === "space" || O === "preserved-space" || O === "tab" || O === "zero-width-break" || O === "soft-hyphen", Q = N === e.segmentIndex ? e.graphemeIndex : 0, J = O === "tab" ? ux(m, u) : r[N];+ 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];if (O === "soft-hyphen" && Q === 0) {- g && (A = N + 1, y = 0, x = N + 1, E = m + h, I = m + h, w = O);+ 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(N, Q);+ const ae = q(D, Q);if (ae !== null)return ae;- } else if (J > n && l[N] !== null) {- const ae = q(N, 0);+ } else if (J > n && l[D] !== null) {+ const ae = q(D, 0);if (ae !== null)return ae;} else- C(N, J);- K(O, Y, N, J);+ C(D, J);+ K(O, Y, D, J);continue;}if (m + J > p) {- const ae = m + (O === "tab" ? 0 : a[N]), ye = m + (O === "tab" ? J : o[N]);+ 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, I);- const Me = $(N);+ return T(x, 0, S);+ const Me = $(D);if (Me !== null)return Me;if (Y && ae <= p)- return F(N, J), T(N + 1, 0, ye);+ return F(D, J), T(D + 1, 0, _e);if (x >= 0 && E <= p)- return A > x || A === x && y > 0 ? T() : T(x, 0, I);- if (J > n && l[N] !== null) {+ 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(N, 0);+ const me = q(D, 0);if (me !== null)return me;}return T();}- F(N, J), K(O, Y, N, J);+ F(D, J), K(O, Y, D, J);}- return x === s.consumedEndSegmentIndex && y === 0 ? T(s.consumedEndSegmentIndex, 0, I) : T(s.consumedEndSegmentIndex, 0, m);+ return x === s.consumedEndSegmentIndex && _ === 0 ? T(s.consumedEndSegmentIndex, 0, S) : T(s.consumedEndSegmentIndex, 0, m);}-function Ax(i, e, t) {- const { widths: n, kinds: s, breakableFitAdvances: r } = i, o = Xa().lineFitEpsilon, c = t + o;+function Ex(i, e, t) {+ const { widths: n, kinds: s, breakableFitAdvances: r } = i, o = Ya().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], y = A === "space" || A === "preserved-space" || A === "tab" || A === "zero-width-break" || A === "soft-hyphen", x = m === e.segmentIndex ? e.graphemeIndex : 0, E = r[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 I = E, w = I[x];+ const S = E, w = S[x];h = !0, l = w, u = m, d = x + 1;- for (let S = x + 1; S < I.length; S++) {- const T = I[S];+ 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 = S + 1;+ l += T, u = m, d = I + 1;}- u === m && d === I.length && (u = m + 1, d = 0);+ u === m && d === S.length && (u = m + 1, d = 0);} elseh = !0, l = g, u = m + 1, d = 0;- y && (f = m + 1, p = l - g);+ _ && (f = m + 1, p = l - g);continue;}if (l + g > c)- return y ? (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, y && (f = m + 1, p = l - g);+ 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 ef(i, e, t) {+function sf(i, e, t) {const n = {segmentIndex: e.segmentIndex,graphemeIndex: e.graphemeIndex- }, s = op(i, n);+ }, s = hp(i, n);if (s < 0)return null;- const r = n.segmentIndex, a = n.graphemeIndex, o = i.simpleLineWalkFastPath ? Ax(i, n, t) : lp(i, n, s, t);+ const r = n.segmentIndex, a = n.graphemeIndex, o = i.simpleLineWalkFastPath ? Ex(i, n, t) : dp(i, n, s, t);return o === null ? null : {startSegmentIndex: r,startGraphemeIndex: a,@@ -30343,11 +30343,11 @@ function ef(i, e, t) {width: o};}-function OB(i, e, t) {- const n = op(i, e);- return n < 0 ? null : i.simpleLineWalkFastPath ? Ax(i, e, t) : lp(i, e, n, t);+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 QB(i, e) {+function JB(i, e) {if (i.widths.length === 0)return {lineCount: 0,@@ -30359,15 +30359,15 @@ function QB(i, e) {};let n = 0, s = 0;if (!i.simpleLineWalkFastPath) {- let r = op(i, t);+ let r = hp(i, t);for (; r >= 0; ) {- const a = lp(i, t, r, e);+ const a = dp(i, t, r, e);if (a === null)return {lineCount: n,maxLineWidth: s};- n++, a > s && (s = a), r = kB(i, r, t);+ n++, a > s && (s = a), r = jB(i, r, t);}return {lineCount: n,@@ -30375,7 +30375,7 @@ function QB(i, e) {};}for (; ; ) {- const r = OB(i, t, e);+ const r = YB(i, t, e);if (r === null)return {lineCount: n,@@ -30384,11 +30384,11 @@ function QB(i, e) {n++, r > s && (s = r);}}-let vu = null, Sg = /* @__PURE__ */ new WeakMap();-function gx() {- return vu === null && (vu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), vu;+let Su = null, Bg = /* @__PURE__ */ new WeakMap();+function yx() {+ return Su === null && (Su = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Su;}-function GB(i) {+function ZB(i) {return i ? {widths: [],lineEndFitAdvances: [],@@ -30414,7 +30414,7 @@ function GB(i) {chunks: []};}-function HB(i, e) {+function $B(i, e) {const t = [];let n = [], s = 0, r = !1, a = !1, o = !1;function c() {@@ -30424,20 +30424,20 @@ function HB(i, e) {}), n = [], r = !1, a = !1, o = !1);}function l(u, d, f) {- n = [u], s = d, r = f, a = Zd(u), o = bh.has(u);+ n = [u], s = d, r = f, a = tf(u), o = yh.has(u);}function h(u, d) {n.push(u), r = r || d;- const f = Zd(u);- u.length === 1 && Dr.has(u) ? a = a || f : a = f, o = !1;+ const f = tf(u);+ u.length === 1 && Pr.has(u) ? a = a || f : a = f, o = !1;}- for (const u of gx().segment(i)) {- const d = u.segment, f = Fr(d);+ for (const u of yx().segment(i)) {+ const d = u.segment, f = Lr(d);if (n.length === 0) {l(d, u.index, f);continue;}- if (o || ip.has(d) || Dr.has(d) || e.carryCJKAfterClosingQuote && f && a) {+ if (o || ap.has(d) || Pr.has(d) || e.carryCJKAfterClosingQuote && f && a) {h(d, f);continue;}@@ -30449,30 +30449,30 @@ function HB(i, e) {}return c(), t;}-function zB(i, e, t, n) {- const s = Xa(), { cache: r, emojiCorrection: a } = NB(e, BB(i.normalized)), o = br("-", Qs("-", r), a), l = br(" ", Qs(" ", r), a) * 8;+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;if (i.len === 0)- return GB(t);+ return ZB(t);const h = [], u = [], d = [], f = [];let p = i.chunks.length <= 1;- const m = t ? [] : null, g = [], A = t ? [] : null, y = Array.from({ length: i.len });- function x(S, 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(S);+ 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(S, T, C, v, F) {- const K = Qs(S, r), q = br(S, K, a), $ = T === "space" || T === "preserved-space" || T === "zero-width-break" ? 0 : q, N = T === "space" || T === "zero-width-break" ? 0 : q;- if (F && v && S.length > 1) {+ function E(I, T, C, v, F) {+ 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";- Yl(S) ? O = "pair-context" : s.preferPrefixWidthsForBreakableRuns && (O = "segment-prefixes");- const Y = DB(S, K, r, a, O);- x(S, q, $, N, T, C, Y);+ Zl(I) ? O = "pair-context" : s.preferPrefixWidthsForBreakableRuns && (O = "segment-prefixes");+ const Y = VB(I, K, r, a, O);+ x(I, q, $, D, T, C, Y);return;}- x(S, q, $, N, T, C, null);+ x(I, q, $, D, T, C, null);}- for (let S = 0; S < i.len; S++) {- y[S] = h.length;- const T = i.texts[S], C = i.isWordLike[S], v = i.kinds[S], F = i.starts[S];+ 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;@@ -30487,16 +30487,16 @@ function zB(i, e, t, n) {}const K = Qs(T, r);if (v === "text" && K.containsCJK) {- const $ = HB(T, s);- for (let N = 0; N < $.length; N++) {- const O = $[N];- E(O.text, "text", F + O.start, C, !Fr(O.text));+ const $ = $B(T, s);+ for (let D = 0; D < $.length; D++) {+ const O = $[D];+ E(O.text, "text", F + O.start, C, !Lr(O.text));}continue;}E(T, v, F, C, !0);}- const I = VB(i.chunks, y, h.length), w = m === null ? null : LM(i.normalized, m);+ const S = tT(i.chunks, _, h.length), w = m === null ? null : qM(i.normalized, m);return A !== null ? {widths: h,lineEndFitAdvances: u,@@ -30507,7 +30507,7 @@ function zB(i, e, t, n) {breakableFitAdvances: g,discretionaryHyphenWidth: o,tabStopAdvance: l,- chunks: I,+ chunks: S,segments: A} : {widths: h,@@ -30519,10 +30519,10 @@ function zB(i, e, t, n) {breakableFitAdvances: g,discretionaryHyphenWidth: o,tabStopAdvance: l,- chunks: I+ chunks: S};}-function VB(i, e, t) {+function tT(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 VB(i, e, t) {}return n;}-function mx(i, e, t, n) {- const r = yB(i, Xa(), n?.whiteSpace, "normal");- return zB(r, e, t);+function _x(i, e, t, n) {+ const r = NB(i, Ya(), n?.whiteSpace, "normal");+ return eT(r, e, t);}-function rl(i, e, t) {- return mx(i, e, !1, t);+function ol(i, e, t) {+ return _x(i, e, !1, t);}-function Jl(i, e, t) {- return mx(i, e, !0, t);+function $l(i, e, t) {+ return _x(i, e, !0, t);}-function WB(i, e, t) {- const n = UB(i, e);+function nT(i, e, t) {+ const n = XB(i, e);return { lineCount: n, height: n * t };}-function Ig(i, e, t) {+function Tg(i, e, t) {let n = t.get(i);if (n !== void 0)return n;n = [];- const s = gx();+ const s = yx();for (const r of s.segment(e[i]))n.push(r.segment);return t.set(i, n), n;}-function xx(i) {- let e = Sg.get(i);- return e !== void 0 || (e = /* @__PURE__ */ new Map(), Sg.set(i, e)), e;+function wx(i) {+ let e = Bg.get(i);+ return e !== void 0 || (e = /* @__PURE__ */ new Map(), Bg.set(i, e)), e;}-function qB(i, e, t, n) {+function iT(i, e, t, n) {return n > 0 && i[n - 1] === "soft-hyphen" && !(e === n && t > 0);}-function KB(i, e, t, n, s, r, a) {+function sT(i, e, t, n, s, r, a) {let o = "";- const c = qB(e, n, s, r);+ const c = iT(e, n, s, r);for (let l = n; l < r; l++)- e[l] === "soft-hyphen" || e[l] === "hard-break" || (l === n && s > 0 ? o += Ig(l, i, t).slice(s).join("") : o += i[l]);- return a > 0 ? (c && (o += "-"), o += Ig(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 += 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;}-function bx(i, e, t, n, s, r, a) {+function vx(i, e, t, n, s, r, a) {return {- text: KB(i.segments, i.kinds, e, n, s, r, a),+ text: sT(i.segments, i.kinds, e, n, s, r, a),width: t,start: {segmentIndex: n,@@ -30586,10 +30586,10 @@ function bx(i, e, t, n, s, r, a) {}};}-function jB(i, e, t) {- return bx(i, e, t.width, t.startSegmentIndex, t.startGraphemeIndex, t.endSegmentIndex, t.endGraphemeIndex);+function rT(i, e, t) {+ return vx(i, e, t.width, t.startSegmentIndex, t.startGraphemeIndex, t.endSegmentIndex, t.endGraphemeIndex);}-function XB(i) {+function aT(i) {return {width: i.width,start: {@@ -30602,76 +30602,76 @@ function XB(i) {}};}-function YB(i, e) {- return bx(i, xx(i), e.width, e.start.segmentIndex, e.start.graphemeIndex, e.end.segmentIndex, e.end.graphemeIndex);+function oT(i, e) {+ return vx(i, wx(i), e.width, e.start.segmentIndex, e.start.graphemeIndex, e.end.segmentIndex, e.end.graphemeIndex);}-function JB(i, e, t) {- return i.widths.length === 0 ? 0 : cp(i, e, (n) => {- t(XB(n));+function cT(i, e, t) {+ return i.widths.length === 0 ? 0 : up(i, e, (n) => {+ t(aT(n));});}-function Cu(i, e) {- return QB(i, e);+function Mu(i, e) {+ return JB(i, e);}-function Mg(i) {+function Rg(i) {let e = 0;- return JB(i, Number.POSITIVE_INFINITY, (t) => {+ return cT(i, Number.POSITIVE_INFINITY, (t) => {t.width > e && (e = t.width);}), e;}-function ZB(i, e, t) {+function lT(i, e, t) {const n = [];if (i.widths.length === 0)return { lineCount: 0, height: 0, lines: n };- const s = xx(i), r = cp(i, e, (a) => {- n.push(jB(i, s, a));+ const s = wx(i), r = up(i, e, (a) => {+ n.push(rT(i, s, a));});return { lineCount: r, height: r * t, lines: n };}-const $B = /[ \t\n\f\r]+/, Bg = /^[ \t\n\f\r]+/, Tg = /[ \t\n\f\r]+$/, Il = { segmentIndex: 0, graphemeIndex: 0 }, Ex = {+const hT = /[ \t\n\f\r]+/, Fg = /^[ \t\n\f\r]+/, Ng = /[ \t\n\f\r]+$/, Bl = { segmentIndex: 0, graphemeIndex: 0 }, Cx = {itemIndex: 0,segmentIndex: 0,graphemeIndex: 0};-function Su(i) {+function Bu(i) {return {segmentIndex: i.segmentIndex,graphemeIndex: i.graphemeIndex};}-function Rg(i) {+function Dg(i) {return i.segmentIndex === 0 && i.graphemeIndex === 0;}-function al(i, e) {+function cl(i, e) {const t = e.get(i);if (t !== void 0)return t;- const n = Mg(Jl("A A", i)), s = Mg(Jl("AA", i)), r = Math.max(0, n - s);+ const n = Rg($l("A A", i)), s = Rg($l("AA", i)), r = Math.max(0, n - s);return e.set(i, r), r;}-function eT(i) {- const e = ef(i, Il, Number.POSITIVE_INFINITY);+function uT(i) {+ const e = sf(i, Bl, Number.POSITIVE_INFINITY);return e === null ? null : {endGraphemeIndex: e.endGraphemeIndex,endSegmentIndex: e.endSegmentIndex,width: e.width};}-function tT(i, e) {+function dT(i, e) {return i === 0 && e > 0;}-function _x(i) {+function Ix(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 = Bg.test(a.text), c = Tg.test(a.text), l = a.text.replace(Bg, "").replace(Tg, "");+ const a = i[r], o = Fg.test(a.text), c = Ng.test(a.text), l = a.text.replace(Fg, "").replace(Ng, "");if (l.length === 0) {- $B.test(a.text) && s === 0 && (s = al(a.font, n));+ hT.test(a.text) && s === 0 && (s = cl(a.font, n));continue;}- const h = s > 0 ? s : o ? al(a.font, n) : 0, u = Jl(l, a.font), d = eT(u);+ const h = s > 0 ? s : o ? cl(a.font, n) : 0, u = $l(l, a.font), d = uT(u);if (d === null) {- s = c ? al(a.font, n) : 0;+ s = c ? cl(a.font, n) : 0;continue;}const f = {@@ -30684,14 +30684,14 @@ function _x(i) {prepared: u,sourceItemIndex: r};- e.push(f), t[r] = f, s = c ? al(a.font, n) : 0;+ e.push(f), t[r] = f, s = c ? cl(a.font, n) : 0;}return {items: e,itemsBySourceItemIndex: t};}-function nT(i, e, t, n) {+function fT(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 nT(i, e, t, n) {};e: for (; o < i.items.length; ) {const l = i.items[o];- if (!Rg(c) && c.segmentIndex === l.endSegmentIndex && c.graphemeIndex === l.endGraphemeIndex) {+ if (!Dg(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 = Rg(c);+ const h = r === 0 ? 0 : l.gapBefore, u = Dg(c);if (l.break === "never") {if (!u) {o++, c.segmentIndex = 0, c.graphemeIndex = 0;@@ -30715,7 +30715,7 @@ function nT(i, e, t, n) {const m = l.naturalWidth + l.extraWidth, g = h + m;if (r > 0 && g > a)break e;- n?.(l, h, m, Su(Il), {+ n?.(l, h, m, Bu(Bl), {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 nT(i, e, t, n) {if (u) {const m = d + l.naturalWidth;if (m <= a) {- n?.(l, h, l.naturalWidth + l.extraWidth, Su(Il), {+ n?.(l, h, l.naturalWidth + l.extraWidth, Bu(Bl), {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 = ef(l.prepared, c, f);+ const f = Math.max(1, a - d), p = sf(l.prepared, c, f);if (p === null) {o++, c.segmentIndex = 0, c.graphemeIndex = 0;continue;@@ -30743,12 +30743,12 @@ function nT(i, e, t, n) {o++, c.segmentIndex = 0, c.graphemeIndex = 0;continue;}- if (r > 0 && u && h > 0 && tT(p.endSegmentIndex, p.endGraphemeIndex)) {- const m = ef(l.prepared, Il, Math.max(1, s - l.extraWidth));+ if (r > 0 && u && h > 0 && dT(p.endSegmentIndex, p.endGraphemeIndex)) {+ const m = sf(l.prepared, Bl, 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, Su(c), {+ if (n?.(l, h, p.width + l.extraWidth, Bu(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 nT(i, e, t, n) {}return r === 0 ? null : (t.itemIndex = o, t.segmentIndex = c.segmentIndex, t.graphemeIndex = c.graphemeIndex, r);}-function iT(i, e, t = Ex) {+function pT(i, e, t = Cx) {const n = i, s = {itemIndex: t.itemIndex,segmentIndex: t.segmentIndex,graphemeIndex: t.graphemeIndex- }, r = [], a = nT(n, e, s, (o, c, l, h, u) => {+ }, r = [], a = fT(n, e, s, (o, c, l, h, u) => {r.push({itemIndex: o.sourceItemIndex,gapBefore: c,@@ -30780,14 +30780,14 @@ function iT(i, e, t = Ex) {end: s};}-function sT(i, e) {- return YB(i.prepared, {+function AT(i, e) {+ return oT(i.prepared, {width: e.occupiedWidth - i.extraWidth,start: e.start,end: e.end}).text;}-function yx(i, e) {+function Sx(i, e) {const t = i;return {fragments: e.fragments.map((n) => {@@ -30796,24 +30796,24 @@ function yx(i, e) {throw new Error("Missing rich-text inline item for fragment");return {...n,- text: sT(s, n)+ text: AT(s, n)};}),width: e.width,end: e.end};}-function wx(i, e, t) {- let n = 0, s = Ex;+function Mx(i, e, t) {+ let n = 0, s = Cx;for (; ; ) {- const r = iT(i, e, s);+ const r = pT(i, e, s);if (r === null)return n;t(r), n++, s = r.end;}}-const Fg = "500 14px Inter, sans-serif", Iu = "600 10px Inter, sans-serif", Mu = "300 13px Inter, sans-serif", Dg = "600 10px Inter, sans-serif", Ng = "300 12px Inter, sans-serif", po = 18, ol = 16, hn = 16, Ni = 6, Lg = 12, cl = Math.min(window.devicePixelRatio || 1, 2), rT = "rgba(0, 0, 0, 0.75)", aT = "rgba(255, 255, 255, 0.08)", oT = "rgba(255, 255, 255, 0.9)", cT = "rgba(255, 255, 255, 0.30)", lT = "rgba(255, 255, 255, 0.85)", Pg = "rgba(255, 255, 255, 0.08)", hT = "rgba(255, 255, 255, 0.45)", uT = "rgba(255, 255, 255, 0.08)", dT = "rgba(255, 255, 255, 0.7)";-function fT(i) {+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) {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 fT(i) {hasMorphs: c};}-function Ao(i) {+function go(i) {return i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString();}-function pT(i, e) {+function CT(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 AT(i, e, t) {- const n = fT(e), s = pT(n, t), r = [- { label: "MESHES", value: Ao(n.meshes) },- { label: "VERTICES", value: Ao(n.vertices) },- { label: "TRIANGLES", value: Ao(n.triangles) },- { label: "MATERIALS", value: Ao(n.materials) },- { label: "TEXTURES", value: Ao(n.textures) }+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) }];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 = rl("Model Info", Fg), l = WB(c, o, po + 2), h = r.map((w) => {- const S = [- { text: w.label + " ", font: Iu },- { text: w.value, font: Mu }- ], T = _x(S), C = rl(w.label, Iu), v = Cu(C, o), F = rl(w.value, Mu), K = Cu(F, o);+ const o = 200, c = ol("Model Info", Lg), l = nT(c, o, Ao + 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);return {...w,labelWidth: v.maxLineWidth,@@ -30870,13 +30870,13 @@ function AT(i, e, t) {richPrepared: T};}), u = a.map((w) => {- const S = rl(w, Dg), T = Cu(S, 300);- return { text: w, width: T.maxLineWidth + Lg };+ const I = ol(w, Pg), T = Mu(I, 300);+ return { text: w, width: T.maxLineWidth + Ug };});let d = [], f = 0;if (s) {- const w = Jl(s, Ng), S = ZB(w, o - hn, po);- d = S.lines, f = S.height;+ const w = $l(s, kg), I = lT(w, o - hn, Ao);+ d = I.lines, f = I.height;}const p = Math.max(l.width + hn * 2,@@ -30884,60 +30884,60 @@ function AT(i, e, t) {), m = Math.max(p, 180);let g = 0;if (u.length > 0) {- let w = 0, S = 1;+ let w = 0, I = 1;u.forEach((T) => {- w > 0 && w + T.width > m - hn * 2 && (S++, w = 0), w += T.width + 6;- }), g = S * (ol + 6) + Ni;+ w > 0 && w + T.width > m - hn * 2 && (I++, w = 0), w += T.width + 6;+ }), g = I * (ll + 6) + Di;}- const A = hn + l.height + Ni + // title- Ni + // separator- h.length * (po + Ni) + // stat rows+ const A = hn + l.height + Di + // title+ Di + // separator+ h.length * (Ao + Di) + // stat rowsg + // chips- (f > 0 ? Ni + f : 0) + // description- hn, y = document.createElement("canvas");- y.width = m * cl, y.height = A * cl, y.style.width = m + "px", y.style.height = A + "px";- const x = y.getContext("2d");- x.scale(cl, cl), x.fillStyle = rT, Bu(x, 0, 0, m, A, 10), x.fill(), x.strokeStyle = aT, x.lineWidth = 1, Bu(x, 0.5, 0.5, m - 1, A - 1, 10), x.stroke();+ (f > 0 ? Di + f : 0) + // description+ hn, _ = document.createElement("canvas");+ _.width = m * hl, _.height = A * hl, _.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();let E = hn;- if (x.font = Fg, x.fillStyle = oT, x.textBaseline = "top", x.fillText("Model Info", hn, E), E += l.height + Ni, x.strokeStyle = Pg, x.beginPath(), x.moveTo(hn, E), x.lineTo(m - hn, E), x.stroke(), E += Ni, h.forEach((w) => {- x.font = Iu, x.fillStyle = cT, x.textAlign = "left", x.fillText(w.label, hn, E), x.font = Mu, x.fillStyle = lT, x.textAlign = "right", x.fillText(w.value, m - hn, E), x.textAlign = "left", E += po + Ni;+ 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;}), u.length > 0) {let w = hn;- u.forEach((S) => {- w > hn && w + S.width > m - hn && (w = hn, E += ol + 6), x.fillStyle = uT, Bu(x, w, E, S.width, ol, 4), x.fill(), x.font = Dg, x.fillStyle = dT, x.textBaseline = "top", x.fillText(S.text, w + Lg / 2, E + 3), w += S.width + 6;- }), E += ol + Ni + 4;+ 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;}- d.length > 0 && (x.strokeStyle = Pg, x.beginPath(), x.moveTo(hn, E), x.lineTo(m - hn, E), x.stroke(), E += Ni, x.font = Ng, x.fillStyle = hT, x.textBaseline = "top", d.forEach((w) => {- x.fillText(w.text, hn, E), E += po;+ 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;}));- const I = document.createElement("div");- return I.classList.add("model-info"), I.appendChild(y), i.appendChild(I), {- el: I,- canvas: y,+ const S = document.createElement("div");+ return S.classList.add("model-info"), S.appendChild(_), i.appendChild(S), {+ el: S,+ canvas: _,remove() {- I.remove();+ S.remove();}};}-function Bu(i, e, t, n, s, r) {+function Fu(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 gT = "500 11px Inter, sans-serif", kg = "300 10px Inter, sans-serif", tf = 10, vx = 6, Cx = 14, ll = Math.min(window.devicePixelRatio || 1, 2), mT = 8;-function xT(i) {+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 e = [];return i.traverse((t) => {- if (e.length >= mT || !t.isMesh || !t.name || t.name.startsWith("_")) return;+ if (e.length >= MT || !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: gT }+ { text: t.name, font: ST }];- r > 0 && o.push({ text: " " + ET(r) + " verts", font: kg }), a && o.push({ text: " " + a, font: kg });- const c = _x(o);+ r > 0 && o.push({ text: " " + RT(r) + " verts", font: Qg }), a && o.push({ text: " " + a, font: Qg });+ const c = Ix(o);let l = 0, h = 0;- wx(c, 300, (m) => {- const g = yx(c, m);+ Mx(c, 300, (m) => {+ const g = Sx(c, m);l = Math.max(l, g.width), h++;});- const u = l + tf * 2, d = h * Cx + vx * 2;+ const u = l + rf * 2, d = h * Tx + Bx * 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 xT(i) {});}), e;}-function bT(i) {+function TT(i) {const { labelWidth: e, labelHeight: t, items: n, prepared: s } = i, r = document.createElement("canvas");- r.width = e * ll, r.height = t * ll, r.style.width = e + "px", r.style.height = t + "px";+ r.width = e * ul, r.height = t * ul, r.style.width = e + "px", r.style.height = t + "px";const a = r.getContext("2d");- a.scale(ll, ll), a.fillStyle = "rgba(0, 0, 0, 0.8)", Ug(a, 0, 0, e, t, 6), a.fill(), a.strokeStyle = "rgba(255, 255, 255, 0.1)", a.lineWidth = 1, Ug(a, 0.5, 0.5, e - 1, t - 1, 6), a.stroke(), a.textBaseline = "top";- let o = vx;- return wx(s, e - tf * 2, (c) => {- const l = yx(s, c);- let h = tf;+ 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;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 += Cx;+ }), o += Tx;}), r;}-function ET(i) {+function RT(i) {return i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString();}-function Ug(i, e, t, n, s, r) {+function Gg(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 Tu = /* @__PURE__ */ new WeakMap();-class _T extends fi {+const Nu = /* @__PURE__ */ new WeakMap();+class FT extends fi {/*** Constructs a new Draco loader.*@@ -31046,7 +31046,7 @@ class _T extends fi {*/parse(e, t, n = () => {}) {- this.decodeDracoFile(e, t, null, null, yt, n).catch(n);+ this.decodeDracoFile(e, t, null, null, _t, n).catch(n);}//decodeDracoFile(e, t, n, s, r = An, a = () => {@@ -31061,8 +31061,8 @@ class _T extends fi {}decodeGeometry(e, t) {const n = JSON.stringify(t);- if (Tu.has(e)) {- const c = Tu.get(e);+ if (Nu.has(e)) {+ const c = Nu.get(e);if (c.key === n)return c.promise;if (e.byteLength === 0)@@ -31076,7 +31076,7 @@ class _T extends fi {}))).then((c) => this._createGeometry(c.geometry));return o.catch(() => !0).then(() => {s && r && this._releaseTask(s, r);- }), Tu.set(e, {+ }), Nu.set(e, {key: n,promise: o}), o;@@ -31091,10 +31091,10 @@ class _T extends fi {return t;}_assignVertexColorSpace(e, t) {- if (t !== yt) return;+ if (t !== _t) return;const n = new Le();for (let s = 0, r = e.count; s < r; s++)- n.fromBufferAttribute(e, s), rt.toWorkingColorSpace(n, yt), e.setXYZ(s, n.r, n.g, n.b);+ n.fromBufferAttribute(e, s), rt.toWorkingColorSpace(n, _t), e.setXYZ(s, n.r, n.g, n.b);}_loadLibrary(e, t) {const n = new As(this.manager);@@ -31111,7 +31111,7 @@ class _T 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 = yT.toString(), a = [+ const r = NT.toString(), a = ["/* draco decoder */",s,"",@@ -31159,7 +31159,7 @@ class _T extends fi {return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;}}-function yT() {+function NT() {let i, e;onmessage = function(a) {const o = a.data;@@ -31202,14 +31202,14 @@ function yT() {const m = { index: null, attributes: [] };for (const g in h) {const A = self[u[g]];- let y, x;+ let _, x;if (l.useUniqueIDs)- x = h[g], y = o.GetAttributeByUniqueId(d, x);+ x = h[g], _ = o.GetAttributeByUniqueId(d, x);else {if (x = o.GetAttributeId(d, a[h[g]]), x === -1) continue;- y = o.GetAttribute(d, x);+ _ = o.GetAttribute(d, x);}- const E = s(a, o, d, g, A, y);+ 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;@@ -31223,10 +31223,10 @@ function yT() {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 y = new h(a.HEAPF32.buffer, A, p).slice();+ const _ = new h(a.HEAPF32.buffer, A, p).slice();return a._free(A), {name: l,- array: y,+ array: _,itemSize: d};}@@ -31249,7 +31249,7 @@ function yT() {}}}-class wT {+class DT {/*** Constructs a new Worker pool.*@@ -31315,13 +31315,13 @@ class wT {this.workers.forEach((e) => e.terminate()), this.workersResolve.length = 0, this.workers.length = 0, this.queue.length = 0, this.workerStatus = 0;}}-const vT = 0, Og = 2, CT = 1, Qg = 2, ST = 0, IT = 1, MT = 10, BT = 0, Sx = 9, Ix = 15, Mx = 16, Bx = 22, Tx = 37, Rx = 43, Fx = 76, Dx = 83, Nx = 97, Lx = 100, Px = 103, kx = 109, Ux = 165, Ox = 166, hp = 1000066e3;-class TT {+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 {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 go {+class mo {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,61 +31360,61 @@ class go {return s < e && this._offset++, new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + n, s);}}-const Nn = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];-function Gg(i) {+const Dn = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];+function Vg(i) {return new TextDecoder().decode(i);}-function RT(i) {- const e = new Uint8Array(i.buffer, i.byteOffset, Nn.length);- if (e[0] !== Nn[0] || e[1] !== Nn[1] || e[2] !== Nn[2] || e[3] !== Nn[3] || e[4] !== Nn[4] || e[5] !== Nn[5] || e[6] !== Nn[6] || e[7] !== Nn[7] || e[8] !== Nn[8] || e[9] !== Nn[9] || e[10] !== Nn[10] || e[11] !== Nn[11]) throw new Error("Missing KTX 2.0 identifier.");- const t = new TT(), n = 17 * Uint32Array.BYTES_PER_ELEMENT, s = new go(i, Nn.length, n, !0);+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);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 go(i, Nn.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 mo(i, Dn.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 go(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 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;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 go(i, c, l, !0);+ const g = new mo(i, c, l, !0);for (; g._offset < l; ) {- const Y = g._nextUint32(), Q = g._scan(Y), J = Gg(Q);+ const Y = g._nextUint32(), Q = g._scan(Y), J = Vg(Q);if (t.keyValue[J] = g._nextUint8Array(Y - Q.byteLength - 1), J.match(/^ktx/i)) {- const ee = Gg(t.keyValue[J]);+ const ee = Vg(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 go(i, h, u, !0), y = A._nextUint16(), x = A._nextUint16(), E = A._nextUint32(), I = A._nextUint32(), w = A._nextUint32(), S = A._nextUint32(), 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 = [];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 + I, K = F + w, q = new Uint8Array(i.buffer, i.byteOffset + C, E), $ = new Uint8Array(i.buffer, i.byteOffset + v, I), N = new Uint8Array(i.buffer, i.byteOffset + F, w), O = new Uint8Array(i.buffer, i.byteOffset + K, S);- return t.globalData = { endpointCount: y, selectorCount: x, imageDescs: T, endpointsData: q, selectorsData: $, tablesData: N, extendedData: O }, t;+ 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 Ru, es, nf;-const Fu = { env: { emscripten_notify_memory_growth: function(i) {- nf = new Uint8Array(es.exports.memory.buffer);+let Du, es, af;+const Lu = { env: { emscripten_notify_memory_growth: function(i) {+ af = new Uint8Array(es.exports.memory.buffer);} } };-class FT {+class zT {init() {- return Ru || (Ru = typeof fetch < "u" ? fetch("data:application/wasm;base64," + Hg).then((e) => e.arrayBuffer()).then((e) => WebAssembly.instantiate(e, Fu)).then(this._init) : WebAssembly.instantiate(Buffer.from(Hg, "base64"), Fu).then(this._init), Ru);+ 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);}_init(e) {- es = e.instance, Fu.env.emscripten_notify_memory_growth(0);+ es = e.instance, Lu.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);- nf.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 = nf.slice(r, r + a);+ 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;}}-const Hg = "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/IAAgARACI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zoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAF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gCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAA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MAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAn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gRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPC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iACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQ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AAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/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", DT = "display-p3", NT = "display-p3-linear", Du = /* @__PURE__ */ new WeakMap();-let Nu = 0, Lu;+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/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8L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CACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGU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IARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAai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AXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAIN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CAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqI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AEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiO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AAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/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 {/*** Constructs a new KTX2 loader.@@ -31422,7 +31422,7 @@ class oi extends fi {* @param {LoadingManager} [manager] - The loading manager.*/constructor(e) {- super(e), this.transcoderPath = "", this.transcoderBinary = null, this.transcoderPending = null, this.workerPool = new wT(), this.workerSourceURL = "", this.workerConfig = null, typeof MSC_TRANSCODER < "u" && console.warn(+ 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('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.');}@@ -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;});- }), Nu > 0 && console.warn(+ }), ku > 0 && console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."- ), Nu++;+ ), ku++;}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 (Du.has(e))- return Du.get(e).promise.then(t).catch(n);+ if (Pu.has(e))+ return Pu.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 Ry(r, c, l);+ u = new H_(r, c, l);else {const d = r[0].mipmaps;- u = t.layerCount > 1 ? new Ty(d, a, o, t.layerCount, c, l) : new Ah(d, a, o, c, l);+ u = t.layerCount > 1 ? new G_(d, a, o, t.layerCount, c, l) : new mh(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 = Qx(t), u.premultiplyAlpha = !!(h & CT), u;+ 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;}/*** @private@@ -31574,18 +31574,18 @@ class oi extends fi {* @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}*/async _createTexture(e, t = {}) {- const n = RT(new Uint8Array(e)), s = n.vkFormat === hp && n.dataFormatDescriptor[0].colorModel === 167;- if (!(n.vkFormat === BT || s && !this.workerConfig.astcHDRSupported))- return PT(n);+ 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 a = t, o = this.init().then(() => this.workerPool.postMessage({ type: "transcode", buffer: e, taskConfig: a }, [e])).then((c) => this._createTextureFrom(c.data, n));- return Du.set(e, { promise: o }), o;+ return Pu.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), Nu--;+ this.workerPool.dispose(), this.workerSourceURL && URL.revokeObjectURL(this.workerSourceURL), ku--;}}oi.BasisFormat = {@@ -31617,16 +31617,16 @@ oi.TranscoderFormat = {};oi.EngineFormat = {RGBAFormat: pn,- RGBA_ASTC_4x4_Format: Ho,- RGB_BPTC_UNSIGNED_Format: Ol,- RGBA_BPTC_Format: Bo,- RGBA_ETC2_EAC_Format: Ul,- RGBA_PVRTC_4BPPV1_Format: Ll,- RGBA_S3TC_DXT5_Format: Mo,- RGB_ETC1_Format: Pl,- RGB_ETC2_Format: kl,- RGB_PVRTC_4BPPV1_Format: Nl,- RGBA_S3TC_DXT1_Format: Io+ 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};oi.EngineType = {UnsignedByteType: un,@@ -31645,8 +31645,8 @@ oi.BasisWorker = function() {case "transcode":e.then(() => {try {- const { faces: g, buffers: A, width: y, height: x, hasAlpha: E, format: I, type: w, dfdFlags: S } = c(m.buffer);- self.postMessage({ type: "transcode", id: m.id, data: { faces: g, width: y, height: x, hasAlpha: E, format: I, type: w, dfdFlags: S } }, A);+ 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 });}@@ -31677,20 +31677,20 @@ oi.BasisWorker = function() {A = a.UASTC_HDR;elsethrow new Error("THREE.KTX2Loader: Unknown Basis encoding");- const y = m.getWidth(), x = m.getHeight(), E = m.getLayers() || 1, I = m.getLevels(), w = m.getFaces(), S = m.getHasAlpha(), T = m.getDFDFlags(), { transcoderFormat: C, engineFormat: v, engineType: F } = u(A, y, x, S);- if (!y || !x || !I)+ 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 N = [];- for (let O = 0; O < I; O++) {+ const D = [];+ for (let O = 0; O < S; O++) {const Y = [];let Q, J;for (let ae = 0; ae < E; ae++) {- const ye = m.getImageLevelInfo(O, ae, $);- $ === 0 && O === 0 && ae === 0 && (ye.origWidth % 4 !== 0 || ye.origHeight % 4 !== 0) && console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."), I > 1 ? (Q = ye.origWidth, J = ye.origHeight) : (Q = ye.width, J = ye.height);+ 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)@@ -31698,11 +31698,11 @@ oi.BasisWorker = function() {Y.push(Me);}const ee = f(Y);- N.push({ data: ee, width: Q, height: J }), q.push(ee.buffer);+ D.push({ data: ee, width: Q, height: J }), q.push(ee.buffer);}- K.push({ mipmaps: N, width: y, height: x, format: v, type: F });+ K.push({ mipmaps: D, width: _, height: x, format: v, type: F });}- return g(), { faces: K, buffers: q, width: y, height: x, hasAlpha: S, dfdFlags: T, format: v, type: F };+ return g(), { faces: K, buffers: q, width: _, height: x, hasAlpha: I, dfdFlags: T, format: v, type: F };}const l = [{@@ -31802,12 +31802,12 @@ oi.BasisWorker = function() {[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 y = h[p];- for (let x = 0; x < y.length; x++) {- const E = y[x];+ 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 I = E.transcoderFormat[A ? 1 : 0], w = E.engineFormat[A ? 1 : 0], S = E.engineType[0];- return { transcoderFormat: I, engineFormat: w, engineType: S };+ 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.");}@@ -31817,77 +31817,77 @@ oi.BasisWorker = function() {function f(p) {if (p.length === 1) return p[0];let m = 0;- for (let y = 0; y < p.length; y++) {- const x = p[y];+ for (let _ = 0; _ < p.length; _++) {+ const x = p[_];m += x.byteLength;}const g = new Uint8Array(m);let A = 0;- for (let y = 0; y < p.length; y++) {- const x = p[y];+ for (let _ = 0; _ < p.length; _++) {+ const x = p[_];g.set(x, A), A += x.byteLength;}return g;}};-const LT = /* @__PURE__ */ new Set([pn, xr, cs]), Pu = {- [kx]: pn,- [Nx]: pn,- [Tx]: pn,- [Rx]: pn,- [Px]: xr,- [Dx]: xr,- [Mx]: xr,- [Bx]: xr,- [Lx]: cs,+const qT = /* @__PURE__ */ new Set([pn, Er, cs]), Ou = {+ [Hx]: pn,+ [Ox]: pn,+ [Lx]: pn,+ [Px]: pn,+ [Gx]: Er,+ [Ux]: Er,+ [Nx]: Er,+ [Dx]: Er,+ [Qx]: cs,+ [kx]: cs,[Fx]: cs,- [Ix]: cs,- [Sx]: cs,- [hp]: Ho,- [Ox]: zo,- [Ux]: zo-}, ku = {- [kx]: fn,- [Nx]: Qn,- [Tx]: un,+ [Rx]: cs,+ [fp]: Vo,+ [Vx]: Wo,+ [zx]: Wo+}, Qu = {+ [Hx]: fn,+ [Ox]: Qn,+ [Lx]: un,+ [Px]: un,+ [Gx]: fn,+ [Ux]: Qn,+ [Nx]: un,+ [Dx]: un,+ [Qx]: fn,+ [kx]: Qn,+ [Fx]: un,[Rx]: un,- [Px]: fn,- [Dx]: Qn,- [Mx]: un,- [Bx]: un,- [Lx]: fn,- [Fx]: Qn,- [Ix]: un,- [Sx]: un,- [hp]: Qn,- [Ox]: un,- [Ux]: un+ [fp]: Qn,+ [Vx]: un,+ [zx]: un};-async function PT(i) {+async function KT(i) {const { vkFormat: e } = i;- if (Pu[e] === void 0)+ if (Ou[e] === void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;- i.supercompressionScheme === Og && (Lu || (Lu = new Promise(async (r) => {- const a = new FT();+ i.supercompressionScheme === Hg && (Uu || (Uu = new Promise(async (r) => {+ const a = new zT();await a.init(), r(a);- })), t = await Lu);+ })), t = await Uu);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 === vT)+ if (i.supercompressionScheme === LT)h = l.levelData;- else if (i.supercompressionScheme === Og)+ else if (i.supercompressionScheme === Hg)h = t.decode(l.levelData, l.uncompressedByteLength);elsethrow new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let u;- ku[e] === fn ? u = new Float32Array(+ Qu[e] === fn ? u = new Float32Array(h.buffer,h.byteOffset,h.byteLength / Float32Array.BYTES_PER_ELEMENT- ) : ku[e] === Qn ? u = new Uint16Array(+ ) : Qu[e] === Qn ? u = new Uint16Array(h.buffer,h.byteOffset,h.byteLength / Uint16Array.BYTES_PER_ELEMENT@@ -31899,24 +31899,24 @@ async function PT(i) {});}let s;- if (LT.has(Pu[e]))- s = i.pixelDepth === 0 ? new uh(n[0].data, i.pixelWidth, i.pixelHeight) : new w0(n[0].data, i.pixelWidth, i.pixelHeight, i.pixelDepth);+ 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);else {if (i.pixelDepth > 0) throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");- s = new Ah(n, i.pixelWidth, i.pixelHeight), s.minFilter = n.length === 1 ? Xt : hi, s.magFilter = Xt;+ s = new mh(n, i.pixelWidth, i.pixelHeight), s.minFilter = n.length === 1 ? Xt : hi, s.magFilter = Xt;}- return s.mipmaps = n, s.type = ku[e], s.format = Pu[e], s.colorSpace = Qx(i), s.needsUpdate = !0, Promise.resolve(s);+ return s.mipmaps = n, s.type = Qu[e], s.format = Ou[e], s.colorSpace = Wx(i), s.needsUpdate = !0, Promise.resolve(s);}-function Qx(i) {+function Wx(i) {const e = i.dataFormatDescriptor[0];- return e.colorPrimaries === IT ? e.transferFunction === Qg ? yt : An : e.colorPrimaries === MT ? e.transferFunction === Qg ? DT : NT : (e.colorPrimaries === ST || console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`), vi);+ 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);}-const hl = "[default]", sf = { ASSET_GENERATOR: "assetgenerator" }, Zl = new Q0(), Gx = "https://unpkg.com/[email protected]", kT = new _T(Zl).setDecoderPath(- `${Gx}/examples/jsm/libs/draco/gltf/`-), UT = new oi(Zl).setTranscoderPath(- `${Gx}/examples/jsm/libs/basis/`+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/`);-function zg(i, e) {+function qg(i, e) {const t = /* @__PURE__ */ new Set();i.traverse((n) => {if (!n.geometry) return;@@ -31925,22 +31925,22 @@ function zg(i, e) {});});}-function OT(i) {+function YT(i) {const { state: e, options: t } = i;- if (t.preset === sf.ASSET_GENERATOR) {- const r = new uw();+ if (t.preset === of.ASSET_GENERATOR) {+ const r = new _w();r.name = "hemi_light", i.scene.add(r), i.lights.push(r);return;}- const n = new z0(e.ambientColor, e.ambientIntensity);+ const n = new j0(e.ambientColor, e.ambientIntensity);n.name = "ambient_light", i.defaultCamera.add(n);- const s = new jf(e.directColor, e.directIntensity);+ const s = new Jf(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 QT(i) {+function JT(i) {i.lights.forEach((e) => e.parent.remove(e)), i.lights.length = 0;}-var ci = Uint8Array, xa = Uint16Array, GT = Int32Array, Hx = new ci([+var ci = Uint8Array, Ea = Uint16Array, ZT = Int32Array, Kx = new ci([0,0,0,@@ -31975,7 +31975,7 @@ var ci = Uint8Array, xa = Uint16Array, GT = Int32Array, Hx = new ci([0,/* impossible */0-]), zx = new ci([+]), jx = new ci([0,0,0,@@ -32009,65 +32009,65 @@ var ci = Uint8Array, xa = Uint16Array, GT = Int32Array, Hx = new ci([/* unused */0,0-]), HT = new ci([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Vx = function(i, e) {- for (var t = new xa(31), n = 0; n < 31; ++n)+]), $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)t[n] = e += 1 << i[n - 1];- for (var s = new GT(t[30]), n = 1; n < 30; ++n)+ for (var s = new ZT(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 };-}, Wx = Vx(Hx, 2), qx = Wx.b, zT = Wx.r;-qx[28] = 258, zT[258] = 28;-var VT = Vx(zx, 0), WT = VT.b, rf = new xa(32768);+}, 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);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, rf[Ot] = ((Fs & 65280) >> 8 | (Fs & 255) << 8) >> 1;+ Fs = (Fs & 52428) >> 2 | (Fs & 13107) << 2, Fs = (Fs & 61680) >> 4 | (Fs & 3855) << 4, cf[Ot] = ((Fs & 65280) >> 8 | (Fs & 255) << 8) >> 1;}-var Lo = (function(i, e, t) {- for (var n = i.length, s = 0, r = new xa(e); s < n; ++s)+var ko = (function(i, e, t) {+ for (var n = i.length, s = 0, r = new Ea(e); s < n; ++s)i[s] && ++r[i[s] - 1];- var a = new xa(e);+ var a = new Ea(e);for (s = 1; s < e; ++s)a[s] = a[s - 1] + r[s - 1] << 1;var o;if (t) {- o = new xa(1 << e);+ o = new Ea(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[rf[u] >> c] = l;+ o[cf[u] >> c] = l;} else- for (o = new xa(n), s = 0; s < n; ++s)- i[s] && (o[s] = rf[a[i[s] - 1]++] >> 15 - i[s]);+ for (o = new Ea(n), s = 0; s < n; ++s)+ i[s] && (o[s] = cf[a[i[s] - 1]++] >> 15 - i[s]);return o;-}), dc = new ci(288);+}), pc = new ci(288);for (var Ot = 0; Ot < 144; ++Ot)- dc[Ot] = 8;+ pc[Ot] = 8;for (var Ot = 144; Ot < 256; ++Ot)- dc[Ot] = 9;+ pc[Ot] = 9;for (var Ot = 256; Ot < 280; ++Ot)- dc[Ot] = 7;+ pc[Ot] = 7;for (var Ot = 280; Ot < 288; ++Ot)- dc[Ot] = 8;-var Kx = new ci(32);+ pc[Ot] = 8;+var Zx = new ci(32);for (var Ot = 0; Ot < 32; ++Ot)- Kx[Ot] = 5;-var qT = /* @__PURE__ */ Lo(dc, 9, 1), KT = /* @__PURE__ */ Lo(Kx, 5, 1), Uu = function(i) {+ Zx[Ot] = 5;+var iR = /* @__PURE__ */ ko(pc, 9, 1), sR = /* @__PURE__ */ ko(Zx, 5, 1), Gu = 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) {var n = e / 8 | 0;return (i[n] | i[n + 1] << 8) >> (e & 7) & t;-}, Ou = function(i, e) {+}, Hu = function(i, e) {var t = e / 8 | 0;return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7);-}, jT = function(i) {+}, rR = function(i) {return (i + 7) / 8 | 0;-}, XT = function(i, e, t) {+}, aR = function(i, e, t) {return (t == null || t > i.length) && (t = i.length), new ci(i.subarray(e, t));-}, YT = [+}, oR = ["unexpected EOF","invalid block type","invalid length/literal",@@ -32084,40 +32084,40 @@ var qT = /* @__PURE__ */ Lo(dc, 9, 1), KT = /* @__PURE__ */ Lo(Kx, 5, 1), Uu = f"invalid zip data"// determined by unknown compression method], Ei = function(i, e, t) {- var n = new Error(e || YT[i]);+ var n = new Error(e || oR[i]);if (n.code = i, Error.captureStackTrace && Error.captureStackTrace(n, Ei), !t)throw n;return n;-}, JT = function(i, e, t, n) {+}, cR = function(i, e, t, n) {var s = i.length, r = 0;if (!s || e.f && !e.l)return t || new ci(0);var a = !t, o = a || e.i != 2, c = e.i;a && (t = new ci(s * 3));- var l = function(It) {+ var l = function(St) {var ht = t.length;- if (It > ht) {- var $e = new ci(Math.max(ht * 2, It));+ if (St > ht) {+ var $e = new ci(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 y = bi(i, u + 1, 3);- if (u += 3, y)- if (y == 1)- f = qT, p = KT, m = 9, g = 5;- else if (y == 2) {- var w = bi(i, u, 31) + 257, S = bi(i, u + 10, 15) + 4, T = w + bi(i, u + 5, 31) + 1;+ var _ = bi(i, u + 1, 3);+ if (u += 3, _)+ if (_ == 1)+ f = iR, p = sR, 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;u += 14;- for (var C = new ci(T), v = new ci(19), F = 0; F < S; ++F)- v[HT[F]] = bi(i, u + F * 3, 7);- u += S * 3;- for (var K = Uu(v), q = (1 << K) - 1, $ = Lo(v, K, 1), F = 0; F < T; ) {- var N = $[bi(i, u, q)];- u += N & 15;- var x = N >> 4;+ for (var C = new ci(T), v = new ci(19), F = 0; F < I; ++F)+ v[$T[F]] = bi(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)];+ u += D & 15;+ var x = D >> 4;if (x < 16)C[F++] = x;else {@@ -32127,16 +32127,16 @@ var qT = /* @__PURE__ */ Lo(dc, 9, 1), KT = /* @__PURE__ */ Lo(Kx, 5, 1), Uu = f}}var Q = C.subarray(0, w), J = C.subarray(w);- m = Uu(Q), g = Uu(J), f = Lo(Q, m, 1), p = Lo(J, g, 1);+ m = Gu(Q), g = Gu(J), f = ko(Q, m, 1), p = ko(J, g, 1);} elseEi(1);else {- var x = jT(u) + 4, E = i[x - 4] | i[x - 3] << 8, I = x + E;- if (I > s) {+ var x = rR(u) + 4, E = i[x - 4] | i[x - 3] << 8, S = x + E;+ if (S > s) {c && Ei(0);break;}- o && l(d + E), t.set(i.subarray(x, I), d), e.b = d += E, e.p = u = I * 8, e.f = h;+ 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) {@@ -32145,8 +32145,8 @@ var qT = /* @__PURE__ */ Lo(dc, 9, 1), KT = /* @__PURE__ */ Lo(Kx, 5, 1), Uu = f}}o && l(d + 131072);- for (var ee = (1 << m) - 1, ae = (1 << g) - 1, ye = u; ; ye = u) {- var O = f[Ou(i, u) & ee], Me = O >> 4;+ for (var ee = (1 << m) - 1, ae = (1 << g) - 1, _e = u; ; _e = u) {+ var O = f[Hu(i, u) & ee], Me = O >> 4;if (u += O & 15, u > A) {c && Ei(0);break;@@ -32154,20 +32154,20 @@ var qT = /* @__PURE__ */ Lo(dc, 9, 1), KT = /* @__PURE__ */ Lo(Kx, 5, 1), Uu = fif (O || Ei(2), Me < 256)t[d++] = Me;else if (Me == 256) {- ye = u, f = null;+ _e = u, f = null;break;} else {var se = Me - 254;if (Me > 264) {- var F = Me - 257, me = Hx[F];- se = bi(i, u, (1 << me) - 1) + qx[F], u += me;+ var F = Me - 257, me = Kx[F];+ se = bi(i, u, (1 << me) - 1) + Jx[F], u += me;}- var xe = p[Ou(i, u) & ae], be = xe >> 4;+ var xe = p[Hu(i, u) & ae], be = xe >> 4;xe || Ei(3), u += xe & 15;- var J = WT[be];+ var J = nR[be];if (be > 3) {- var me = zx[be];- J += Ou(i, u) & (1 << me) - 1, u += me;+ var me = jx[be];+ J += Hu(i, u) & (1 << me) - 1, u += me;}if (u > A) {c && Ei(0);@@ -32184,21 +32184,21 @@ var qT = /* @__PURE__ */ Lo(dc, 9, 1), KT = /* @__PURE__ */ Lo(Kx, 5, 1), Uu = ft[d] = t[d - J];}}- e.l = f, e.p = ye, e.b = d, e.f = h, f && (h = 1, e.m = m, e.d = p, e.n = g);+ 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 ? XT(t, 0, d) : t.subarray(0, d);-}, ZT = /* @__PURE__ */ new ci(0), $T = function(i, e) {+ 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;};-function wo(i, e) {- return JT(i.subarray($T(i), -4), { i: 2 }, e, e);+function Co(i, e) {+ return cR(i.subarray(hR(i), -4), { i: 2 }, e, e);}-var eR = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), tR = 0;+var uR = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), dR = 0;try {- eR.decode(ZT, { stream: !0 }), tR = 1;+ uR.decode(lR, { stream: !0 }), dR = 1;} catch {}-class nR extends hw {+class fR extends yw {/*** Constructs a new EXR loader.*@@ -32219,59 +32219,59 @@ class nR extends hw {let k = 0;for (let R = 0; R < 65536; ++R)(R == 0 || b[R >> 3] & 1 << (R & 7)) && (B[k++] = R);- const _ = k - 1;+ const y = k - 1;for (; k < 65536; ) B[k++] = 0;- return _;+ 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, _, R) {+ function q(b, B, k, y, R) {for (; k < b; )- B = B << 8 | Be(_, R), k += 8;+ B = B << 8 | Be(y, R), k += 8;k -= b, K.l = B >> k & (1 << b) - 1, K.c = B, K.lc = k;}const $ = new Array(59);- function N(b) {+ 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 _ = B + $[k] >> 1;- $[k] = B, B = _;+ const y = B + $[k] >> 1;+ $[k] = B, B = y;}for (let k = 0; k < 65537; ++k) {- const _ = b[k];- _ > 0 && (b[k] = _ | $[_]++ << 6);+ const y = b[k];+ y > 0 && (b[k] = y | $[y]++ << 6);}}- function O(b, B, k, _, R, D) {+ function O(b, B, k, y, R, N) {const U = B;let P = 0, z = 0;- for (; _ <= R; _++) {+ 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, D[_] = j, j == 63) {+ 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, _ + X > R + 1)+ if (P = K.c, z = K.lc, y + X > R + 1)throw new Error("Something wrong with hufUnpackEncTable");- for (; X--; ) D[_++] = 0;- _--;+ for (; X--; ) N[y++] = 0;+ y--;} else if (j >= 59) {let X = j - 59 + 2;- if (_ + X > R + 1)+ if (y + X > R + 1)throw new Error("Something wrong with hufUnpackEncTable");- for (; X--; ) D[_++] = 0;- _--;+ for (; X--; ) N[y++] = 0;+ y--;}}- N(D);+ D(N);}function Y(b) {return b & 63;@@ -32279,13 +32279,13 @@ class nR extends hw {function Q(b) {return b >> 6;}- function J(b, B, k, _) {+ function J(b, B, k, y) {for (; B <= k; B++) {- const R = Q(b[B]), D = Y(b[B]);- if (R >> D)+ const R = Q(b[B]), N = Y(b[B]);+ if (R >> N)throw new Error("Invalid table entry");- if (D > 14) {- const U = _[R >> D - 14];+ if (N > 14) {+ const U = y[R >> N - 14];if (U.len)throw new Error("Invalid table entry");if (U.lit++, U.p) {@@ -32296,27 +32296,27 @@ class nR extends hw {} elseU.p = new Array(1);U.p[U.lit - 1] = B;- } else if (D) {+ } else if (N) {let U = 0;- for (let P = 1 << 14 - D; P > 0; P--) {- const z = _[(R << 14 - D) + U];+ 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 = D, z.lit = B, U++;+ z.len = N, z.lit = B, U++;}}}return !0;}const ee = { c: 0, lc: 0 };- function ae(b, B, k, _) {- b = b << 8 | Be(k, _), B += 8, ee.c = b, ee.lc = B;+ function ae(b, B, k, y) {+ b = b << 8 | Be(k, y), B += 8, ee.c = b, ee.lc = B;}- const ye = { c: 0, lc: 0 };- function Me(b, B, k, _, R, D, U, P, z) {+ const _e = { c: 0, lc: 0 };+ function Me(b, B, k, y, R, N, U, P, z) {if (b == B) {- _ < 8 && (ae(k, _, R, D), k = ee.c, _ = ee.lc), _ -= 8;- let j = k >> _;+ 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];@@ -32326,7 +32326,7 @@ class nR extends hw {U[P.value++] = b;elsereturn !1;- ye.c = k, ye.lc = _;+ _e.c = k, _e.lc = y;}function se(b) {return b & 65535;@@ -32337,67 +32337,67 @@ class nR extends hw {}const xe = { a: 0, b: 0 };function be(b, B) {- const k = me(b), R = me(B), D = k + (R & 1) + (R >> 1), U = D, P = D - R;+ 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), _ = se(B), R = k - (_ >> 1) & 65535, D = _ + R - 32768 & 65535;- xe.a = D, xe.b = R;+ 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, _, R, D, U) {+ 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 + D * (R - X), ce = D * j, fe = D * X, Ae = _ * j, _e = _ * X;+ const he = ie + N * (R - X), ce = N * j, fe = N * X, Ae = y * j, ye = y * X;let Pe, je, Ve, Fe;for (; ie <= he; ie += fe) {let st = ie;- const ke = ie + _ * (k - X);- for (; st <= ke; st += _e) {- const St = st + Ae, on = st + ce, wt = on + Ae;- P ? (be(b[st + B], b[on + B]), Pe = xe.a, Ve = xe.b, be(b[St + B], b[wt + B]), je = xe.a, Fe = xe.b, be(Pe, je), b[st + B] = xe.a, b[St + B] = xe.b, be(Ve, Fe), b[on + B] = xe.a, b[wt + B] = xe.b) : (Ue(b[st + B], b[on + B]), Pe = xe.a, Ve = xe.b, Ue(b[St + B], b[wt + B]), je = xe.a, Fe = xe.b, Ue(Pe, je), b[st + B] = xe.a, b[St + B] = xe.b, Ue(Ve, Fe), b[on + B] = xe.a, b[wt + B] = xe.b);+ const ke = ie + y * (k - X);+ for (; st <= ke; st += ye) {+ const It = st + Ae, on = st + ce, wt = on + Ae;+ P ? (be(b[st + B], b[on + B]), Pe = xe.a, Ve = xe.b, be(b[It + B], b[wt + B]), je = xe.a, Fe = xe.b, be(Pe, je), b[st + B] = xe.a, b[It + B] = xe.b, be(Ve, Fe), b[on + B] = xe.a, b[wt + B] = xe.b) : (Ue(b[st + B], b[on + B]), Pe = xe.a, Ve = xe.b, Ue(b[It + B], b[wt + B]), je = xe.a, Fe = xe.b, Ue(Pe, je), b[st + B] = xe.a, b[It + B] = xe.b, Ue(Ve, Fe), b[on + B] = xe.a, b[wt + B] = xe.b);}if (k & j) {- const St = st + ce;- P ? be(b[st + B], b[St + B]) : Ue(b[st + B], b[St + B]), Pe = xe.a, b[St + B] = xe.b, b[st + B] = Pe;+ const It = st + ce;+ P ? be(b[st + B], b[It + B]) : Ue(b[st + B], b[It + B]), Pe = xe.a, b[It + B] = xe.b, b[st + B] = Pe;}}if (R & j) {let st = ie;- const ke = ie + _ * (k - X);- for (; st <= ke; st += _e) {- const St = st + Ae;- P ? be(b[st + B], b[St + B]) : Ue(b[st + B], b[St + B]), Pe = xe.a, b[St + B] = xe.b, b[st + B] = Pe;+ const ke = ie + y * (k - X);+ for (; st <= ke; st += ye) {+ const It = st + Ae;+ P ? be(b[st + B], b[It + B]) : Ue(b[st + B], b[It + B]), Pe = xe.a, b[It + B] = xe.b, b[st + B] = Pe;}}X = j, j >>= 1;}return ie;}- function He(b, B, k, _, R, D, U, P, z) {+ function He(b, B, k, y, R, N, U, P, z) {let j = 0, X = 0;- const ie = U, he = Math.trunc(_.value + (R + 7) / 8);- for (; _.value < he; )- for (ae(j, X, k, _), j = ee.c, X = ee.lc; X >= 14; ) {+ 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, Ae = B[fe];if (Ae.len)- X -= Ae.len, Me(Ae.lit, D, j, X, k, _, P, z, ie), j = ye.c, X = ye.lc;+ X -= Ae.len, Me(Ae.lit, N, j, X, k, y, P, z, ie), j = _e.c, X = _e.lc;else {if (!Ae.p)throw new Error("hufDecode issues");- let _e;- for (_e = 0; _e < Ae.lit; _e++) {- const Pe = Y(b[Ae.p[_e]]);- for (; X < Pe && _.value < he; )- ae(j, X, k, _), j = ee.c, X = ee.lc;- if (X >= Pe && Q(b[Ae.p[_e]]) == (j >> X - Pe & (1 << Pe) - 1)) {- X -= Pe, Me(Ae.p[_e], D, j, X, k, _, P, z, ie), j = ye.c, X = ye.lc;+ let ye;+ for (ye = 0; ye < Ae.lit; ye++) {+ const Pe = Y(b[Ae.p[ye]]);+ for (; X < Pe && y.value < he; )+ ae(j, X, k, y), j = ee.c, X = ee.lc;+ if (X >= Pe && Q(b[Ae.p[ye]]) == (j >> X - Pe & (1 << Pe) - 1)) {+ X -= Pe, Me(Ae.p[ye], N, j, X, k, y, P, z, ie), j = _e.c, X = _e.lc;break;}}- if (_e == Ae.lit)+ if (ye == Ae.lit)throw new Error("hufDecode issues");}}@@ -32405,13 +32405,13 @@ class nR extends hw {for (j >>= ce, X -= ce; X > 0; ) {const fe = B[j << 14 - X & 16383];if (fe.len)- X -= fe.len, Me(fe.lit, D, j, X, k, _, P, z, ie), j = ye.c, X = ye.lc;+ X -= fe.len, Me(fe.lit, N, j, X, k, y, P, z, ie), j = _e.c, X = _e.lc;elsethrow new Error("hufDecode issues");}return !0;}- function It(b, B, k, _, R, D) {+ function St(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);@@ -32419,14 +32419,14 @@ class nR extends hw {throw new Error("Something wrong with HUF_ENCSIZE");const ie = new Array(65537), he = new Array(16384);F(he);- const ce = _ - (k.value - P);- if (O(b, k, ce, z, j, ie), X > 8 * (_ - (k.value - P)))+ 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, D, R, U);+ J(ie, z, j, he), He(ie, he, b, k, X, j, N, R, U);}function ht(b, B, k) {- for (let _ = 0; _ < k; ++_)- B[_] = b[B[_]];+ for (let y = 0; y < k; ++y)+ B[y] = b[B[y]];}function $e(b) {for (let B = 1; B < b.length; B++) {@@ -32435,46 +32435,46 @@ class nR extends hw {}}function H(b, B) {- let k = 0, _ = Math.floor((b.length + 1) / 2), R = 0;- const D = b.length - 1;- for (; !(R > D || (B[R++] = b[k++], R > D)); )- B[R++] = 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 xn(b) {let B = b.byteLength;const k = new Array();- let _ = 0;+ let y = 0;const R = new DataView(b);for (; B > 0; ) {- const D = R.getInt8(_++);- if (D < 0) {- const U = -D;+ 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(_++));+ k.push(R.getUint8(y++));} else {- const U = D;+ const U = N;B -= 2;- const P = R.getUint8(_++);+ const P = R.getUint8(y++);for (let z = 0; z < U + 1; z++)k.push(P);}}return k;}- function pt(b, B, k, _, R, D) {- let U = new DataView(D.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, Ae = { value: 0 }, _e = new Array(j), Pe = new Array(j), je = new Array(j), Ve = new Array(j), Fe = new Array(j);+ 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, Ae = { value: 0 }, ye = new Array(j), Pe = new Array(j), je = new Array(j), Ve = new Array(j), Fe = new Array(j);for (let ke = 0; ke < j; ++ke)- Fe[ke] = B[b.idx[ke]], _e[ke] = ke < 1 ? 0 : _e[ke - 1] + ie * he, Pe[ke] = new Float32Array(64), je[ke] = new Uint16Array(64), Ve[ke] = new Uint16Array(ie * 64);+ Fe[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 St = 8;- ke == he - 1 && (St = fe);+ let It = 8;+ ke == he - 1 && (It = fe);let on = 8;for (let xt = 0; xt < ie; ++xt) {xt == ie - 1 && (on = ce);for (let Xe = 0; Xe < j; ++Xe)- je[Xe].fill(0), je[Xe][0] = R[_e[Xe]++], gt(Ae, _, je[Xe]), We(je[Xe], Pe[Xe]), Nt(Pe[Xe]);+ je[Xe].fill(0), je[Xe][0] = R[ye[Xe]++], gt(Ae, 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], xt * 64);@@ -32482,7 +32482,7 @@ class nR extends hw {let wt = 0;for (let xt = 0; xt < j; ++xt) {const Xe = k[b.idx[xt]].type;- for (let qt = 8 * ke; qt < 8 * ke + St; ++qt) {+ for (let qt = 8 * ke; qt < 8 * ke + It; ++qt) {wt = Fe[xt][qt];for (let En = 0; En < X; ++En) {const Lt = En * 64 + (qt & 7) * 8;@@ -32490,7 +32490,7 @@ class nR extends hw {}}if (X != ie)- for (let qt = 8 * ke; qt < 8 * ke + St; ++qt) {+ for (let qt = 8 * ke; qt < 8 * ke + It; ++qt) {const En = Fe[xt][qt] + 8 * X * 2 * Xe, Lt = X * 64 + (qt & 7) * 8;for (let cn = 0; cn < on; ++cn)U.setUint16(En + cn * 2 * Xe, Ve[xt][Lt + cn], !0);@@ -32498,46 +32498,46 @@ class nR extends hw {}}const st = new Uint16Array(P);- U = new DataView(D.buffer);+ U = new DataView(N.buffer);for (let ke = 0; ke < j; ++ke) {k[b.idx[ke]].decoded = !0;- const St = k[b.idx[ke]].type;+ const It = k[b.idx[ke]].type;if (k[ke].type == 2)for (let on = 0; on < z; ++on) {const wt = Fe[ke][on];for (let xt = 0; xt < P; ++xt)- st[xt] = U.getUint16(wt + xt * 2 * St, !0);+ st[xt] = U.getUint16(wt + xt * 2 * It, !0);for (let xt = 0; xt < P; ++xt)- U.setFloat32(wt + xt * 2 * St, ne(st[xt]), !0);+ U.setFloat32(wt + xt * 2 * It, ne(st[xt]), !0);}}}function gt(b, B, k) {- let _, R = 1;+ let y, R = 1;for (; R < 64; )- _ = B[b.value], _ == 65280 ? R = 64 : _ >> 8 == 255 ? R += _ & 255 : (k[R] = _, R++), b.value++;+ 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 Nt(b) {- const B = 0.5 * Math.cos(0.7853975), k = 0.5 * Math.cos(3.14159 / 16), _ = 0.5 * Math.cos(3.14159 / 8), R = 0.5 * Math.cos(3 * 3.14159 / 16), D = 0.5 * Math.cos(5 * 3.14159 / 16), U = 0.5 * Math.cos(3 * 3.14159 / 8), P = 0.5 * Math.cos(7 * 3.14159 / 16), z = new Array(4), j = new Array(4), X = new Array(4), ie = new Array(4);+ function Dt(b) {+ const B = 0.5 * Math.cos(0.7853975), k = 0.5 * Math.cos(3.14159 / 16), y = 0.5 * Math.cos(3.14159 / 8), R = 0.5 * Math.cos(3 * 3.14159 / 16), N = 0.5 * Math.cos(5 * 3.14159 / 16), U = 0.5 * Math.cos(3 * 3.14159 / 8), P = 0.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] = _ * b[ce + 2], z[1] = U * b[ce + 2], z[2] = _ * b[ce + 6], z[3] = U * b[ce + 6], j[0] = k * b[ce + 1] + R * b[ce + 3] + D * b[ce + 5] + P * b[ce + 7], j[1] = R * b[ce + 1] - P * b[ce + 3] - k * b[ce + 5] - D * b[ce + 7], j[2] = D * b[ce + 1] - k * b[ce + 3] + P * b[ce + 5] + R * b[ce + 7], j[3] = P * b[ce + 1] - D * 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];+ 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] = _ * b[16 + he], z[1] = U * b[16 + he], z[2] = _ * b[48 + he], z[3] = U * b[48 + he], j[0] = k * b[8 + he] + R * b[24 + he] + D * b[40 + he] + P * b[56 + he], j[1] = R * b[8 + he] - P * b[24 + he] - k * b[40 + he] - D * b[56 + he], j[2] = D * b[8 + he] - k * b[24 + he] + P * b[40 + he] + R * b[56 + he], j[3] = P * b[8 + he] - D * 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];+ 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], _ = b[1][B], R = b[2][B];- b[0][B] = k + 1.5747 * R, b[1][B] = k - 0.1873 * _ - 0.4682 * R, b[2][B] = k + 1.8556 * _;+ const k = b[0][B], y = b[1][B], R = b[2][B];+ b[0][B] = k + 1.5747 * R, b[1][B] = k - 0.1873 * y - 0.4682 * R, b[2][B] = k + 1.8556 * y;}}function L(b, B, k) {- for (let _ = 0; _ < 64; ++_)- B[k + _] = Zp.toHalfFloat(M(b[_]));+ for (let y = 0; y < 64; ++y)+ B[k + y] = tA.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);@@ -32546,19 +32546,19 @@ class nR extends hw {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(xn(B)), _ = new Uint8Array(k.length);- return $e(k), H(k, _), new DataView(_.buffer);+ const B = b.viewer.buffer.slice(b.offset.value, b.offset.value + b.size), k = new Uint8Array(xn(B)), y = new Uint8Array(k.length);+ 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 = wo(B), _ = new Uint8Array(k.length);- return $e(k), H(k, _), new DataView(_.buffer);+ const B = b.array.slice(b.offset.value, b.offset.value + b.size), k = Co(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 }, _ = new Uint16Array(b.columns * b.lines * (b.inputChannels.length * b.type)), R = new Uint8Array(8192);- let D = 0;+ 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, Ae = b.inputChannels.length; fe < Ae; fe++)- U[fe] = {}, U[fe].start = D, U[fe].end = U[fe].start, U[fe].nx = b.columns, U[fe].ny = b.lines, U[fe].size = b.type, D += U[fe].nx * U[fe].ny * U[fe].size;+ 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");@@ -32566,13 +32566,13 @@ class nR extends hw {for (let fe = 0; fe < z - P + 1; fe++)R[fe + P] = tt(B, k);const j = new Uint16Array(65536), X = v(R, j), ie = Ge(B, k);- It(b.array, B, k, ie, _, D);+ St(b.array, B, k, ie, y, N);for (let fe = 0; fe < b.inputChannels.length; ++fe) {const Ae = U[fe];- for (let _e = 0; _e < U[fe].size; ++_e)+ for (let ye = 0; ye < U[fe].size; ++ye)et(- _,- Ae.start + _e,+ y,+ Ae.start + ye,Ae.nx,Ae.size,Ae.ny,@@ -32580,18 +32580,18 @@ class nR extends hw {X);}- ht(j, _, D);+ ht(j, y, N);let he = 0;- const ce = new Uint8Array(_.buffer.byteLength);+ const ce = new Uint8Array(y.buffer.byteLength);for (let fe = 0; fe < b.lines; fe++)for (let Ae = 0; Ae < b.inputChannels.length; Ae++) {- const _e = U[Ae], Pe = _e.nx * _e.size, je = new Uint8Array(_.buffer, _e.end * 2, Pe * 2);- ce.set(je, he), he += Pe * 2, _e.end += Pe;+ const ye = U[Ae], 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 = wo(B), _ = b.inputChannels.length * b.lines * b.columns * b.totalBytes, R = new ArrayBuffer(_), D = new DataView(R);+ 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);let U = 0, P = 0;const z = new Array(4);for (let j = 0; j < b.lines; j++)@@ -32602,22 +32602,22 @@ class nR extends hw {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, D.setUint16(P, ie, !0), P += 2;+ 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, D.setUint32(P, ie, !0), P += 4;+ ie += fe, N.setUint32(P, ie, !0), P += 4;}break;}}- return D;+ return N;}function ve(b) {- const B = b.viewer, k = { value: b.offset.value }, _ = new Uint8Array(b.columns * b.lines * (b.inputChannels.length * b.type * 2)), R = {+ 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),@@ -32632,11 +32632,11 @@ class nR extends hw {};if (R.version < 2)throw new Error("EXRLoader.parse: " + qi.compression + " version " + R.version + " is unsupported");- const D = new Array();+ const N = new Array();let U = re(B, k) - 2;for (; U > 0; ) {- const Ae = qe(B.buffer, k), _e = tt(B, k), Pe = _e >> 2 & 3, je = (_e >> 4) - 1, Ve = new Int8Array([je])[0], Fe = tt(B, k);- D.push({+ const Ae = qe(B.buffer, k), ye = tt(B, k), Pe = ye >> 2 & 3, je = (ye >> 4) - 1, Ve = new Int8Array([je])[0], Fe = tt(B, k);+ N.push({name: Ae,index: Ve,type: Fe,@@ -32645,28 +32645,28 @@ class nR extends hw {}const P = qi.channels, z = new Array(b.inputChannels.length);for (let Ae = 0; Ae < b.inputChannels.length; ++Ae) {- const _e = z[Ae] = {}, Pe = P[Ae];- _e.name = Pe.name, _e.compression = 0, _e.decoded = !1, _e.type = Pe.pixelType, _e.pLinear = Pe.pLinear, _e.width = b.columns, _e.height = b.lines;+ 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;}const j = {idx: new Array(3)};for (let Ae = 0; Ae < b.inputChannels.length; ++Ae) {- const _e = z[Ae];- for (let Pe = 0; Pe < D.length; ++Pe) {- const je = D[Pe];- _e.name == je.name && (_e.compression = je.compression, je.index >= 0 && (j.idx[je.index] = Ae), _e.offset = Ae);+ const ye = z[Ae];+ 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] = Ae), ye.offset = Ae);}}let X, ie, he;if (R.acCompressedSize > 0)switch (R.acCompression) {case 0:- X = new Uint16Array(R.totalAcUncompressedCount), It(b.array, B, k, R.acCompressedSize, X, R.totalAcUncompressedCount);+ 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), _e = wo(Ae);- X = new Uint16Array(_e.buffer), k.value += R.totalAcUncompressedCount;+ const Ae = b.array.slice(k.value, k.value + R.totalAcUncompressedCount), ye = Co(Ae);+ X = new Uint16Array(ye.buffer), k.value += R.totalAcUncompressedCount;break;}if (R.dcCompressedSize > 0) {@@ -32678,28 +32678,28 @@ class nR extends hw {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), _e = wo(Ae);- he = xn(_e.buffer), k.value += R.rleCompressedSize;+ const Ae = b.array.slice(k.value, k.value + R.rleCompressedSize), ye = Co(Ae);+ he = xn(ye.buffer), k.value += R.rleCompressedSize;}let ce = 0;const fe = new Array(z.length);for (let Ae = 0; Ae < fe.length; ++Ae)fe[Ae] = new Array();for (let Ae = 0; Ae < b.lines; ++Ae)- for (let _e = 0; _e < z.length; ++_e)- fe[_e].push(ce), ce += z[_e].width * b.type * 2;- pt(j, fe, z, X, ie, _);+ 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 Ae = 0; Ae < z.length; ++Ae) {- const _e = z[Ae];- if (!_e.decoded)- switch (_e.compression) {+ const ye = z[Ae];+ if (!ye.decoded)+ switch (ye.compression) {case 2:let Pe = 0, je = 0;for (let Ve = 0; Ve < b.lines; ++Ve) {let Fe = fe[Ae][Pe];- for (let st = 0; st < _e.width; ++st) {- for (let ke = 0; ke < 2 * _e.type; ++ke)- _[Fe++] = he[je + ke * _e.width * _e.height];+ for (let st = 0; st < ye.width; ++st) {+ for (let ke = 0; ke < 2 * ye.type; ++ke)+ y[Fe++] = he[je + ke * ye.width * ye.height];je++;}Pe++;@@ -32710,31 +32710,31 @@ class nR extends hw {throw new Error("EXRLoader.parse: unsupported channel compression");}}- return new DataView(_.buffer);+ return new DataView(y.buffer);}function qe(b, B) {const k = new Uint8Array(b);- let _ = 0;- for (; k[B.value + _] != 0; )- _ += 1;+ let y = 0;+ for (; k[B.value + y] != 0; )+ y += 1;const R = new TextDecoder().decode(- k.slice(B.value, B.value + _)+ k.slice(B.value, B.value + y));- return B.value = B.value + _ + 1, R;+ return B.value = B.value + y + 1, R;}function Je(b, B, k) {- const _ = new TextDecoder().decode(+ const y = new TextDecoder().decode(new Uint8Array(b).slice(B.value, B.value + k));- return B.value = B.value + k, _;+ return B.value = B.value + k, y;}function Ee(b, B) {- const k = Oe(b, B), _ = Ge(b, B);- return [k, _];+ const k = Oe(b, B), y = Ge(b, B);+ return [k, y];}function Re(b, B) {- const k = Ge(b, B), _ = Ge(b, B);- return [k, _];+ const k = Ge(b, B), y = Ge(b, B);+ return [k, y];}function Oe(b, B) {const k = b.getInt32(B.value, !0);@@ -32761,7 +32761,7 @@ class nR extends hw {return B.value += 4, k;}function W(b, B) {- return Zp.toHalfFloat(nt(b, B));+ return tA.toHalfFloat(nt(b, B));}function ne(b) {const B = (b & 31744) >> 10, k = b & 1023;@@ -32774,13 +32774,13 @@ class nR extends hw {function de(b, B) {return ne(re(b, B));}- function Ie(b, B, k, _) {- const R = k.value, D = [];- for (; k.value < R + _ - 1; ) {+ 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 = tt(b, k);k.value += 3;const j = Oe(b, k), X = Oe(b, k);- D.push({+ N.push({name: U,pixelType: P,pLinear: z,@@ -32788,11 +32788,11 @@ class nR extends hw {ySampling: X});}- return k.value += 1, D;+ return k.value += 1, N;}function Ce(b, B) {- const k = nt(b, B), _ = nt(b, B), R = nt(b, B), D = nt(b, B), U = nt(b, B), P = nt(b, B), z = nt(b, B), j = nt(b, B);- return { redX: k, redY: _, greenX: R, greenY: D, blueX: U, blueY: P, whiteX: z, whiteY: j };+ const k = nt(b, B), y = nt(b, B), R = nt(b, B), N = nt(b, B), U = nt(b, B), P = nt(b, B), z = nt(b, B), j = nt(b, B);+ return { redX: k, redY: y, greenX: R, greenY: N, blueX: U, blueY: P, whiteX: z, whiteY: j };}function it(b, B) {const k = [@@ -32806,82 +32806,82 @@ class nR extends hw {"B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"- ], _ = tt(b, B);- return k[_];+ ], y = tt(b, B);+ return k[y];}function Qt(b, B) {- const k = Oe(b, B), _ = Oe(b, B), R = Oe(b, B), D = Oe(b, B);- return { xMin: k, yMin: _, xMax: R, yMax: D };+ 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 bn(b, B) {const k = ["INCREASING_Y","DECREASING_Y","RANDOM_Y"- ], _ = tt(b, B);- return k[_];+ ], y = tt(b, B);+ return k[y];}function Ct(b, B) {const k = ["ENVMAP_LATLONG","ENVMAP_CUBE"- ], _ = tt(b, B);- return k[_];+ ], y = tt(b, B);+ return k[y];}function Yn(b, B) {const k = ["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"- ], _ = [+ ], y = ["ROUND_DOWN","ROUND_UP"- ], R = Ge(b, B), D = Ge(b, B), U = tt(b, B);+ ], R = Ge(b, B), N = Ge(b, B), U = tt(b, B);return {xSize: R,- ySize: D,+ ySize: N,levelMode: k[U & 15],- roundingMode: _[U >> 4]+ roundingMode: y[U >> 4]};}function Ai(b, B) {- const k = nt(b, B), _ = nt(b, B);- return [k, _];+ const k = nt(b, B), y = nt(b, B);+ return [k, y];}- function Ec(b, B) {- const k = nt(b, B), _ = nt(b, B), R = nt(b, B);- return [k, _, R];+ function _c(b, B) {+ const k = nt(b, B), y = nt(b, B), R = nt(b, B);+ return [k, y, R];}- function _c(b, B, k, _, R) {- if (_ === "string" || _ === "stringvector" || _ === "iccProfile")+ function wc(b, B, k, y, R) {+ if (y === "string" || y === "stringvector" || y === "iccProfile")return Je(B, k, R);- if (_ === "chlist")- return Ie(b, B, k, R);- if (_ === "chromaticities")+ if (y === "chlist")+ return Se(b, B, k, R);+ if (y === "chromaticities")return Ce(b, k);- if (_ === "compression")+ if (y === "compression")return it(b, k);- if (_ === "box2i")+ if (y === "box2i")return Qt(b, k);- if (_ === "envmap")+ if (y === "envmap")return Ct(b, k);- if (_ === "tiledesc")+ if (y === "tiledesc")return Yn(b, k);- if (_ === "lineOrder")+ if (y === "lineOrder")return bn(b, k);- if (_ === "float")+ if (y === "float")return nt(b, k);- if (_ === "v2f")+ if (y === "v2f")return Ai(b, k);- if (_ === "v3f")- return Ec(b, k);- if (_ === "int")+ if (y === "v3f")+ return _c(b, k);+ if (y === "int")return Oe(b, k);- if (_ === "rational")+ if (y === "rational")return Ee(b, k);- if (_ === "timecode")+ if (y === "timecode")return Re(b, k);- if (_ === "preview")+ if (y === "preview")return k.value += R, "skipped";k.value += R;}@@ -32889,72 +32889,72 @@ class nR extends hw {const k = Math.log2(b);return B == "ROUND_DOWN" ? Math.floor(k) : Math.ceil(k);}- function Za(b, B, k) {- let _ = 0;+ function $a(b, B, k) {+ let y = 0;switch (b.levelMode) {case "ONE_LEVEL":- _ = 1;+ y = 1;break;case "MIPMAP_LEVELS":- _ = Wi(Math.max(B, k), b.roundingMode) + 1;+ y = Wi(Math.max(B, k), b.roundingMode) + 1;break;case "RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.");}- return _;+ return y;}- function $a(b, B, k, _) {+ function eo(b, B, k, y) {const R = new Array(b);- for (let D = 0; D < b; D++) {- const U = 1 << D;+ for (let N = 0; N < b; N++) {+ const U = 1 << N;let P = B / U | 0;- _ == "ROUND_UP" && P * U < B && (P += 1);+ y == "ROUND_UP" && P * U < B && (P += 1);const z = Math.max(P, 1);- R[D] = (z + k - 1) / k | 0;+ R[N] = (z + k - 1) / k | 0;}return R;}- function yc() {+ function vc() {const b = this, B = b.offset, k = { value: 0 };- for (let _ = 0; _ < b.tileCount; _++) {- const R = Oe(b.viewer, B), D = Oe(b.viewer, B);+ 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 = D * b.blockHeight;+ 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 = qi.channels[ce].name, Ae = b.channelByteOffsets[fe] * b.columns, _e = b.decodeChannels[fe];- if (_e === void 0) continue;+ const fe = qi.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;for (let je = 0; je < b.columns; je++) {- const Ve = Pe + (je + U) * b.outputChannels + _e;+ const Ve = Pe + (je + U) * b.outputChannels + ye;b.byteArray[Ve] = b.getter(X, k);}}}}}- function Hr() {+ function Vr() {const b = this, B = b.offset, k = { value: 0 };- for (let _ = 0; _ < b.height / b.blockHeight; _++) {+ for (let y = 0; y < b.height / b.blockHeight; y++) {const R = Oe(b.viewer, B) - qi.dataWindow.yMin;b.size = Ge(b.viewer, B), b.lines = R + b.blockHeight > b.height ? b.height - R : b.blockHeight;- const D = b.columns * b.totalBytes, P = b.size < b.lines * D ? b.uncompress(b) : Z(b);+ 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 = _ * b.blockHeight, X = z + b.scanOrder(j);+ const j = y * b.blockHeight, X = z + b.scanOrder(j);if (X >= b.height) continue;- const ie = z * D, he = (b.height - 1 - X) * b.outLineWidth;+ 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, _e = b.decodeChannels[fe];- if (_e !== void 0) {+ const fe = qi.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++) {- const je = he + Pe * b.outputChannels + _e;+ const je = he + Pe * b.outputChannels + ye;b.byteArray[je] = b.getter(P, k);}}@@ -32962,38 +32962,38 @@ class nR extends hw {}}}- function wc(b, B, k) {- const _ = {};+ function Cc(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.");- _.version = b.getUint8(4);+ y.version = b.getUint8(4);const R = b.getUint8(5);- _.spec = {+ y.spec = {singleTile: !!(R & 2),longName: !!(R & 4),deepFormat: !!(R & 8),multiPart: !!(R & 16)}, k.value = 8;- let D = !0;- for (; D; ) {+ let N = !0;+ for (; N; ) {const U = qe(B, k);if (U === "")- D = !1;+ N = !1;else {- const P = qe(B, k), z = Ge(b, k), j = _c(b, B, k, P, z);- j === void 0 ? console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`) : _[U] = j;+ const P = qe(B, k), z = Ge(b, k), j = wc(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:", _), new Error("THREE.EXRLoader: Provided file is currently unsupported.");- return _;+ throw console.error("THREE.EXRHeader:", y), new Error("THREE.EXRLoader: Provided file is currently unsupported.");+ return y;}- function zr(b, B, k, _, R) {- const D = {+ function Wr(b, B, k, y, R) {+ const N = {size: 0,viewer: B,array: k,- offset: _,+ offset: y,width: b.dataWindow.xMax - b.dataWindow.xMin + 1,height: b.dataWindow.yMax - b.dataWindow.yMin + 1,inputChannels: b.channels,@@ -33010,28 +33010,28 @@ class nR extends hw {};switch (b.compression) {case "NO_COMPRESSION":- D.blockHeight = 1, D.uncompress = Z;+ N.blockHeight = 1, N.uncompress = Z;break;case "RLE_COMPRESSION":- D.blockHeight = 1, D.uncompress = le;+ N.blockHeight = 1, N.uncompress = le;break;case "ZIPS_COMPRESSION":- D.blockHeight = 1, D.uncompress = pe;+ N.blockHeight = 1, N.uncompress = pe;break;case "ZIP_COMPRESSION":- D.blockHeight = 16, D.uncompress = pe;+ N.blockHeight = 16, N.uncompress = pe;break;case "PIZ_COMPRESSION":- D.blockHeight = 32, D.uncompress = oe;+ N.blockHeight = 32, N.uncompress = oe;break;case "PXR24_COMPRESSION":- D.blockHeight = 16, D.uncompress = Qe;+ N.blockHeight = 16, N.uncompress = Qe;break;case "DWAA_COMPRESSION":- D.blockHeight = 32, D.uncompress = ve;+ N.blockHeight = 32, N.uncompress = ve;break;case "DWAB_COMPRESSION":- D.blockHeight = 256, D.uncompress = ve;+ N.blockHeight = 256, N.uncompress = ve;break;default:throw new Error("EXRLoader.parse: " + b.compression + " is unsupported");@@ -33044,42 +33044,42 @@ class nR extends hw {case "G":case "B":case "A":- U[X.name] = !0, D.type = X.pixelType;+ U[X.name] = !0, N.type = X.pixelType;}let P = !1;if (U.R && U.G && U.B)- P = !U.A, D.outputChannels = 4, D.decodeChannels = { R: 0, G: 1, B: 2, A: 3 };+ P = !U.A, N.outputChannels = 4, N.decodeChannels = { R: 0, G: 1, B: 2, A: 3 };else if (U.Y)- D.outputChannels = 1, D.decodeChannels = { Y: 0 };+ N.outputChannels = 1, N.decodeChannels = { Y: 0 };elsethrow new Error("EXRLoader.parse: file contains unsupported data channels.");- if (D.type == 1)+ if (N.type == 1)switch (R) {case fn:- D.getter = de;+ N.getter = de;break;case Qn:- D.getter = re;+ N.getter = re;break;}- else if (D.type == 2)+ else if (N.type == 2)switch (R) {case fn:- D.getter = nt;+ N.getter = nt;break;case Qn:- D.getter = W;+ N.getter = W;}else- throw new Error("EXRLoader.parse: unsupported pixelType " + D.type + " for " + b.compression + ".");- D.columns = D.width;- const z = D.width * D.height * D.outputChannels;+ 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 fn:- D.byteArray = new Float32Array(z), P && D.byteArray.fill(1, 0, z);+ N.byteArray = new Float32Array(z), P && N.byteArray.fill(1, 0, z);break;case Qn:- D.byteArray = new Uint16Array(z), P && D.byteArray.fill(15360, 0, z);+ N.byteArray = new Uint16Array(z), P && N.byteArray.fill(15360, 0, z);break;default:console.error("THREE.EXRLoader: unsupported type: ", R);@@ -33087,26 +33087,26 @@ class nR extends hw {}let j = 0;for (const X of b.channels)- D.decodeChannels[X.name] !== void 0 && (D.channelByteOffsets[X.name] = j), j += X.pixelType * 2;- if (D.totalBytes = j, D.outLineWidth = D.width * D.outputChannels, b.lineOrder === "INCREASING_Y" ? D.scanOrder = (X) => X : D.scanOrder = (X) => D.height - 1 - X, D.outputChannels == 4 ? (D.format = pn, D.colorSpace = An) : (D.format = cs, D.colorSpace = vi), b.spec.singleTile) {- D.blockHeight = b.tiles.ySize, D.blockWidth = b.tiles.xSize;- const X = Za(b.tiles, D.width, D.height), ie = $a(X, D.width, b.tiles.xSize, b.tiles.roundingMode), he = $a(X, D.height, b.tiles.ySize, b.tiles.roundingMode);- D.tileCount = ie[0] * he[0];+ 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) {+ 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);+ 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, _);- D.decode = yc.bind(D);+ Ke(B, y);+ N.decode = vc.bind(N);} else {- D.blockWidth = D.width;- const X = Math.ceil(D.height / D.blockHeight);+ N.blockWidth = N.width;+ const X = Math.ceil(N.height / N.blockHeight);for (let ie = 0; ie < X; ie++)- Ke(B, _);- D.decode = Hr.bind(D);+ Ke(B, y);+ N.decode = Vr.bind(N);}- return D;+ return N;}- const eo = { value: 0 }, to = new DataView(e), Lh = new Uint8Array(e), qi = wc(to, e, eo), ws = zr(qi, to, Lh, eo, this.type);+ 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);return ws.decode(), {header: qi,width: ws.width,@@ -33133,10 +33133,10 @@ class nR extends hw {return super.load(e, r, n, s);}}-function iR(i, e) {+function pR(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 nR().load(+ new fR().load(n,(a) => {const o = i.pmremGenerator.fromEquirectangular(a).texture;@@ -33147,26 +33147,26 @@ function iR(i, e) {);});}-function sR(i) {+function AR(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"), rR(i);+ }, "image/png"), gR(i);}-function rR(i) {+function gR(i) {const e = document.createElement("div");e.className = "screenshot-flash", i.el.appendChild(e), e.addEventListener("animationend", () => e.remove());}-function aR(i, e) {- i.mixer && (i.mixer.stopAllAction(), i.mixer.uncacheRoot(i.mixer.getRoot()), i.mixer = null), i.clips = e, e.length && (i.mixer = new V0(i.content));+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 oR(i) {+function xR(i) {i.clips.forEach((e) => {i.mixer.clipAction(e).reset().play(), i.state.actionStates[e.name] = !0;}), i.invalidate();}-function jx(i, e, t) {+function $x(i, e, t) {const n = t.length - i - 1;if (e >= t[n])return n - 1;@@ -33177,7 +33177,7 @@ function jx(i, e, t) {e < t[a] ? r = a : s = a, a = Math.floor((s + r) / 2);return a;}-function cR(i, e, t, n) {+function bR(i, e, t, n) {const s = [], r = [], a = [];s[0] = 1;for (let o = 1; o <= t; ++o) {@@ -33191,15 +33191,15 @@ function cR(i, e, t, n) {}return s;}-function lR(i, e, t, n) {- const s = jx(i, n, e), r = cR(s, n, i, e), a = new mt(0, 0, 0, 0);+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);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 hR(i, e, t, n, s) {+function yR(i, e, t, n, s) {const r = [];for (let u = 0; u <= t; ++u)r[u] = 0;@@ -33232,14 +33232,14 @@ function hR(i, e, t, n, s) {p[0][0] = 1;for (let m = 1; m <= n; ++m) {let g = 0;- const A = u - m, y = t - m;- u >= m && (p[f][0] = p[d][0] / o[y + 1][A], g = p[f][0] * o[A][y]);- const x = A >= -1 ? 1 : -A, E = u - 1 <= y ? m - 1 : t - u;+ 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[y + 1][A + w], g += p[f][w] * o[A + w][y];- u <= y && (p[f][m] = -p[d][m - 1] / o[y + 1][u], g += p[f][m] * o[u][y]), a[m][u] = g;- const I = d;- d = f, f = I;+ 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;@@ -33250,8 +33250,8 @@ function hR(i, e, t, n, s) {}return a;}-function uR(i, e, t, n, s) {- const r = s < i ? s : i, a = [], o = jx(i, n, e), c = hR(o, n, i, r, e), l = [];+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 = [];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 uR(i, e, t, n, s) {a[h] = new mt(0, 0, 0);return a;}-function dR(i, e) {+function wR(i, e) {let t = 1;for (let s = 2; s <= i; ++s)t *= s;@@ -33277,7 +33277,7 @@ function dR(i, e) {n *= s;return t / n;}-function fR(i) {+function vR(i) {const e = i.length, t = [], n = [];for (let r = 0; r < e; ++r) {const a = i[r];@@ -33287,16 +33287,16 @@ function fR(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(dR(r, o) * n[o]));+ a.sub(s[r - o].clone().multiplyScalar(wR(r, o) * n[o]));s[r] = a.divideScalar(n[0]);}return s;}-function pR(i, e, t, n, s) {- const r = uR(i, e, t, n, s);- return fR(r);+function CR(i, e, t, n, s) {+ const r = _R(i, e, t, n, s);+ return vR(r);}-class AR extends Fy {+class IR extends z_ {/*** Constructs a new NURBS curve.*@@ -33323,7 +33323,7 @@ class AR extends Fy {* @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 = lR(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 = ER(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 AR extends Fy {* @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 = pR(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 = CR(this.degree, this.knots, this.controlPoints, s, 1);return n.copy(r[1]).normalize(), n;}toJSON() {@@ -33346,7 +33346,7 @@ class AR extends Fy {}}let ut, Yt, kn;-class gR extends fi {+class SR extends fi {/*** Constructs a new FBX loader.*@@ -33365,7 +33365,7 @@ class gR extends fi {* @param {onErrorCallback} onError - Executed when errors occur.*/load(e, t, n, s) {- const r = this, a = r.path === "" ? wr.extractUrlBase(e) : r.path, o = new As(this.manager);+ const r = this, a = r.path === "" ? Cr.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));@@ -33382,27 +33382,27 @@ class gR extends fi {* @return {Group} An object representing the parsed asset.*/parse(e, t) {- if (yR(e))- ut = new _R().parse(e);+ if (NR(e))+ ut = new FR().parse(e);else {- const s = Jx(e);- if (!wR(s))+ const s = nb(e);+ if (!DR(s))throw new Error("THREE.FBXLoader: Unknown format.");- if (Wg(s) < 7e3)- throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + Wg(s));- ut = new ER().parse(s);+ if (jg(s) < 7e3)+ throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + jg(s));+ ut = new RR().parse(s);}- const n = new G0(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);- return new mR(n, this.manager).parse(ut);+ const n = new q0(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);+ return new MR(n, this.manager).parse(ut);}}-class mR {+class MR {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 xR().parse(s);+ 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;}// Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )@@ -33548,13 +33548,13 @@ class mR {let o;switch (r.toLowerCase()) {case "phong":- o = new Xc();+ o = new Jc();break;case "lambert":- o = new Jy();+ o = new cw();break;default:- console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', r), o = new Xc();+ console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', r), o = new Jc();break;}return o.setValues(a), o.name = s, o;@@ -33563,7 +33563,7 @@ class mR {// Also parse the texture map and return any textures associated with the materialparseParameters(e, t, n) {const s = {};- e.BumpFactor && (s.bumpScale = e.BumpFactor.value), e.Diffuse ? s.color = rt.toWorkingColorSpace(new Le().fromArray(e.Diffuse.value), yt) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (s.color = rt.toWorkingColorSpace(new Le().fromArray(e.DiffuseColor.value), yt)), e.DisplacementFactor && (s.displacementScale = e.DisplacementFactor.value), e.Emissive ? s.emissive = rt.toWorkingColorSpace(new Le().fromArray(e.Emissive.value), yt) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (s.emissive = rt.toWorkingColorSpace(new Le().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 = rt.toWorkingColorSpace(new Le().fromArray(e.Specular.value), yt) : e.SpecularColor && e.SpecularColor.type === "Color" && (s.specular = rt.toWorkingColorSpace(new Le().fromArray(e.SpecularColor.value), yt));+ e.BumpFactor && (s.bumpScale = e.BumpFactor.value), e.Diffuse ? s.color = rt.toWorkingColorSpace(new Le().fromArray(e.Diffuse.value), _t) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (s.color = rt.toWorkingColorSpace(new Le().fromArray(e.DiffuseColor.value), _t)), e.DisplacementFactor && (s.displacementScale = e.DisplacementFactor.value), e.Emissive ? s.emissive = rt.toWorkingColorSpace(new Le().fromArray(e.Emissive.value), _t) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (s.emissive = rt.toWorkingColorSpace(new Le().fromArray(e.EmissiveColor.value), _t)), 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 = rt.toWorkingColorSpace(new Le().fromArray(e.Specular.value), _t) : e.SpecularColor && e.SpecularColor.type === "Color" && (s.specular = rt.toWorkingColorSpace(new Le().fromArray(e.SpecularColor.value), _t));const r = this;return Yt.get(n).children.forEach(function(a) {const o = a.relationship;@@ -33576,23 +33576,23 @@ class mR {break;case "DiffuseColor":case "Maya|TEX_color_map":- s.map = r.getTexture(t, a.ID), s.map !== void 0 && (s.map.colorSpace = yt);+ s.map = r.getTexture(t, a.ID), s.map !== void 0 && (s.map.colorSpace = _t);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);+ s.emissiveMap = r.getTexture(t, a.ID), s.emissiveMap !== void 0 && (s.emissiveMap.colorSpace = _t);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 = Fl, s.envMap.colorSpace = yt);+ s.envMap = r.getTexture(t, a.ID), s.envMap !== void 0 && (s.envMap.mapping = Dl, s.envMap.colorSpace = _t);break;case "SpecularColor":- s.specularMap = r.getTexture(t, a.ID), s.specularMap !== void 0 && (s.specularMap.colorSpace = yt);+ s.specularMap = r.getTexture(t, a.ID), s.specularMap !== void 0 && (s.specularMap.colorSpace = _t);break;case "TransparentColor":case "TransparencyFactor":@@ -33646,7 +33646,7 @@ class mR {ID: s.ID,indices: [],weights: [],- transformLink: new De().fromArray(r.TransformLink.a)+ transformLink: new Ne().fromArray(r.TransformLink.a)// transform: new Matrix4().fromArray( boneNode.Transform.a ),// linkMode: boneNode.Mode,};@@ -33686,11 +33686,11 @@ class mR {}), this.bindSkeleton(e.skeletons, t, s), this.addGlobalSceneSettings(), kn.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 = Yx(c.userData.transformData);+ const l = tb(c.userData.transformData);c.applyMatrix4(l), c.updateWorldMatrix();}});- const o = new bR().parse();+ 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;}// parse nodes in FBXTree.Objects.Model@@ -33715,13 +33715,13 @@ class mR {break;case "LimbNode":case "Root":- h = new zl();+ h = new Wl();break;default:h = new hs();break;}- h.name = c.attrName ? _t.sanitizeNodeName(c.attrName) : "", h.userData.originalName = c.attrName, h.ID = o;+ h.name = c.attrName ? yt.sanitizeNodeName(c.attrName) : "", h.userData.originalName = c.attrName, h.ID = o;}this.getTransformData(h, c), s.set(o, h);}@@ -33735,7 +33735,7 @@ class mR {c.rawBones.forEach(function(l, h) {if (l.ID === a.ID) {const u = r;- r = new zl(), 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 = 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);}});}@@ -33764,7 +33764,7 @@ class mR {const u = n.FocalLength ? n.FocalLength.value : null;switch (s) {case 0:- t = new Sn(h, l, r, a), u !== null && t.setFocalLength(u);+ t = new In(h, l, r, a), u !== null && t.setFocalLength(u);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."), t = new Tt();@@ -33788,7 +33788,7 @@ class mR {let s;n.LightType === void 0 ? s = 0 : s = n.LightType.value;let r = 16777215;- n.Color !== void 0 && (r = rt.toWorkingColorSpace(new Le().fromArray(n.Color.value), yt));+ n.Color !== void 0 && (r = rt.toWorkingColorSpace(new Le().fromArray(n.Color.value), _t));let a = n.Intensity === void 0 ? 1 : n.Intensity.value / 100;n.CastLightOnObject !== void 0 && n.CastLightOnObject.value === 0 && (a = 0);let o = 0;@@ -33796,19 +33796,19 @@ class mR {const c = 1;switch (s) {case 0:- t = new Kl(r, a, o, c);+ t = new Xl(r, a, o, c);break;case 1:- t = new jf(r, a);+ t = new Jf(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 H0(r, a, o, l, h, c);+ n.OuterAngle !== void 0 && (h = Cn.degToRad(n.OuterAngle.value), h = Math.max(h, 1)), t = new K0(r, a, o, l, h, c);break;default:- console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new Kl(r, a);+ console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new Xl(r, a);break;}n.CastShadows !== void 0 && n.CastShadows.value === 1 && (t.castShadow = !0);@@ -33820,7 +33820,7 @@ 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 Xc({+ }), o.length > 1 ? a = o : o.length > 0 ? a = o[0] : (a = new Jc({name: fi.DEFAULT_MATERIAL_NAME,color: 13421772}), o.push(a)), "color" in r.attributes && o.forEach(function(c) {@@ -33832,26 +33832,26 @@ class mR {(u.materialIndex < 0 || u.materialIndex >= o.length) && (u.materialIndex = o.length, c = !0);}if (c) {- const l = new Xc();+ const l = new Jc();o.push(l);}}- return r.FBX_Deformer ? (s = new T0(r, a), s.normalizeSkinWeights()) : s = new Zt(r, a), s;+ return r.FBX_Deformer ? (s = new L0(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 Wa({+ }, null), s = new qa({name: fi.DEFAULT_MATERIAL_NAME,color: 3342591,linewidth: 1});- return new fh(n, s);+ return new Ah(n, s);}// parse the model node for transform datagetTransformData(e, t) {const n = {};- "InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder = Zo(t.RotationOrder.value) : n.eulerOrder = Zo(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 = 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;}setLookAtProperties(e, t) {"LookAtProperty" in t && Yt.get(e.ID).children.forEach(function(s) {@@ -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 dh(a.bones), s[u.ID]);+ n.has(u.ID) && n.get(u.ID).bind(new ph(a.bones), s[u.ID]);});}});@@ -33886,8 +33886,8 @@ class mR {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 De().fromArray(r.Matrix.a);- }) : e[s.Node] = new De().fromArray(s.Matrix.a);+ e[r.Node] = new Ne().fromArray(r.Matrix.a);+ }) : e[s.Node] = new Ne().fromArray(s.Matrix.a);}}return e;@@ -33897,15 +33897,15 @@ class mR {if ("AmbientColor" in ut.GlobalSettings) {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, yt);- kn.add(new z0(r, 1));+ const r = new Le().setRGB(t, n, s, _t);+ kn.add(new j0(r, 1));}}"UnitScaleFactor" in ut.GlobalSettings && (kn.userData.unitScaleFactor = ut.GlobalSettings.UnitScaleFactor.value);}}}-class xR {+class BR {constructor() {this.negativeMaterialIndices = !1;}@@ -33943,8 +33943,8 @@ class xR {n.morphTargets[u.ID] !== void 0 && r.push(n.morphTargets[u.ID]);});const c = a[0], l = {};- "RotationOrder" in c && (l.eulerOrder = Zo(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 = Yx(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);return this.genGeometry(t, o, r, h);}// Generate a BufferGeometry from a node in FBXTree.Objects.Geometry@@ -33952,7 +33952,7 @@ class xR {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 Gf(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 Vf(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);}@@ -34003,40 +34003,40 @@ class xR {return e.vertexIndices.forEach(function(f, p) {let m, g = !1;f < 0 && (f = f ^ -1, g = !0);- let A = [], y = [];+ let A = [], _ = [];if (a.push(f * 3, f * 3 + 1, f * 3 + 2), e.color) {- const x = ul(p, n, f, e.color);+ const x = fl(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) {- y.push(x.weight), A.push(x.id);- }), y.length > 4) {+ _.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];- y.forEach(function(I, w) {- let S = I, T = A[w];+ _.forEach(function(S, w) {+ let I = S, T = A[w];E.forEach(function(C, v, F) {- if (S > C) {- F[v] = S, S = C;+ if (I > C) {+ F[v] = I, I = C;const K = x[v];x[v] = T, T = K;}});- }), A = x, y = E;+ }), A = x, _ = E;}- for (; y.length < 4; )- y.push(0), A.push(0);+ for (; _.length < 4; )+ _.push(0), A.push(0);for (let x = 0; x < 4; ++x)- h.push(y[x]), u.push(A[x]);+ h.push(_[x]), u.push(A[x]);}if (e.normal) {- const x = ul(p, n, f, e.normal);+ const x = fl(p, n, f, e.normal);o.push(x[0], x[1], x[2]);}- e.material && e.material.mappingType !== "AllSame" && (m = ul(p, n, f, e.material)[0], m < 0 && (d.negativeMaterialIndices = !0, m = 0)), e.uv && e.uv.forEach(function(x, E) {- const I = ul(p, n, f, x);- l[E] === void 0 && (l[E] = []), l[E].push(I[0]), l[E].push(I[1]);+ 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);+ 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 xR {const { tangent: p, bitangent: m } = this.getNormalTangentAndBitangent(d), g = [];for (const A of d)g.push(this.flattenVertex(A, p, m));- u = Wf.triangulateShape(g, []);+ u = jf.triangulateShape(g, []);} elseu = [[0, 1, 2]];for (const [d, f, p] of u)@@ -34145,7 +34145,7 @@ class xR {let r = [];n === "IndexToDirect" && (r = e.ColorIndex.a);for (let a = 0, o = new Le(); a < s.length; a += 4)- o.fromArray(s, a), rt.toWorkingColorSpace(o, yt), o.toArray(s, a);+ o.fromArray(s, a), rt.toWorkingColorSpace(o, _t), o.toArray(s, a);return {dataSize: 4,buffer: s,@@ -34192,11 +34192,11 @@ class xR {for (let u = 0; u < n; ++u)r.push(r[u]);}- const h = new AR(n, s, r, o, c).getPoints(r.length * 12);+ const h = new IR(n, s, r, o, c).getPoints(r.length * 12);return new Tn().setFromPoints(h);}}-class bR {+class TR {// take raw animation clips and turn them into three.js animation clipsparse() {const e = [], t = this.parseClips();@@ -34240,7 +34240,7 @@ class bR {for (const n in t) {const s = {id: t[n].id,- times: t[n].KeyTime.a.map(vR),+ times: t[n].KeyTime.a.map(LR),values: t[n].KeyValueFloat.a}, r = Yt.get(s.id);if (r !== void 0) {@@ -34271,7 +34271,7 @@ class bR {return;}const f = {- modelName: d.attrName ? _t.sanitizeNodeName(d.attrName) : "",+ modelName: d.attrName ? yt.sanitizeNodeName(d.attrName) : "",ID: d.id,initialPosition: [0, 0, 0],initialRotation: [0, 0, 0],@@ -34279,7 +34279,7 @@ class bR {};kn.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 De()), "PreRotation" in d && (f.preRotation = d.PreRotation.value), "PostRotation" in d && (f.postRotation = d.PostRotation.value), r[l] = f;+ }), 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;}}r[l] && (r[l][h.attr] = h);@@ -34288,7 +34288,7 @@ class bR {const u = Yt.get(c.ID).parents.filter(function(A) {return A.relationship !== void 0;})[0].ID, d = Yt.get(u).parents[0].ID, f = Yt.get(d).parents[0].ID, p = Yt.get(f).parents[0].ID, m = ut.Objects.Model[p], g = {- modelName: m.attrName ? _t.sanitizeNodeName(m.attrName) : "",+ modelName: m.attrName ? yt.sanitizeNodeName(m.attrName) : "",morphName: ut.Objects.Deformer[u].attrName};r[l] = g;@@ -34320,7 +34320,7 @@ class bR {const n = this;return e.layer.forEach(function(s) {t = t.concat(n.generateTracks(s));- }), new ql(e.name, -1, t);+ }), new jl(e.name, -1, t);}generateTracks(e) {const t = [];@@ -34345,7 +34345,7 @@ class bR {}generateVectorTrack(e, t, n, s) {const r = this.getTimesForAllAxes(t), a = this.getKeyframeTrackValues(r, t, n);- return new Rr(e + "." + s, r, a);+ return new Dr(e + "." + s, r, a);}generateRotationTrack(e, t, n, s, r) {let a, o;@@ -34353,7 +34353,7 @@ class bR {const d = this.interpolateRotations(t.x, t.y, t.z, r);a = d[0], o = d[1];}- const c = Zo(0);+ const c = ec(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]);@@ -34368,7 +34368,7 @@ class bR {const t = e.DeformPercent.curves.morph, n = t.values.map(function(r) {return r / 100;}), s = kn.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];- return new Tr(e.modelName + ".morphTargetInfluences[" + s + "]", t.times, n);+ return new Nr(e.modelName + ".morphTargetInfluences[" + s + "]", t.times, n);}// For all animated objects, times are defined separately for each axis// Here we'll combine the times into one sorted array without duplicates@@ -34438,18 +34438,18 @@ class bR {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), y = new Jt().setFromEuler(g), x = new Jt().setFromEuler(A);- y.dot(x) && x.set(-x.x, -x.y, -x.z, -x.w);- const E = e.times[o - 1], I = e.times[o] - E, w = new Jt(), S = new dn();+ const m = Math.max(...f) / 180, g = new dn(...l, s), A = new dn(...u, s), _ = new Jt().setFromEuler(g), x = new Jt().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 Jt(), I = new dn();for (let T = 0; T < 1; T += 1 / m)- w.copy(y.clone().slerp(x.clone(), T)), r.push(E + T * I), S.setFromQuaternion(w, s), a.push(S.x), a.push(S.y), a.push(S.z);+ 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);} elser.push(e.times[o]), a.push(Cn.degToRad(e.values[o])), a.push(Cn.degToRad(t.values[o])), a.push(Cn.degToRad(n.values[o]));}return [r, a];}}-class ER {+class RR {getPrevNode() {return this.nodeStack[this.currentIndent - 2];}@@ -34469,7 +34469,7 @@ class ER {this.currentProp = e, this.currentPropName = t;}parse(e) {- this.currentIndent = 0, this.allNodes = new Xx(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";+ this.currentIndent = 0, this.allNodes = new eb(), 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 ER {let u = r.split(",").slice(3);u = u.map(function(d) {return d.trim().replace(/^"/, "");- }), s = "connections", r = [l, h], SR(r, u), a[s] === void 0 && (a[s] = []);+ }), s = "connections", r = [l, h], kR(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 = Gu(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 = Vu(r));}parseNodePropertyContinued(e) {const t = this.getCurrentNode();- t.a += e, e.slice(-1) !== "," && (t.a = Gu(t.a));+ t.a += e, e.slice(-1) !== "," && (t.a = Vu(t.a));}// parse "Property70"parseNodeSpecialProperty(e, t, n) {@@ -34533,7 +34533,7 @@ class ER {case "Lcl_Translation":case "Lcl_Rotation":case "Lcl_Scaling":- l = Gu(l);+ l = Vu(l);break;}this.getPrevNode()[r] = {@@ -34544,14 +34544,14 @@ class ER {}, this.setCurrentProp(this.getPrevNode(), r);}}-class _R {+class FR {parse(e) {- const t = new Vg(e);+ const t = new Kg(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 Xx();+ const s = new eb();for (; !this.endOfContent(t); ) {const r = this.parseNode(t, n);r !== null && s.add(r.name, r);@@ -34648,7 +34648,7 @@ class _R {case "l":return e.getInt64Array(s);}- const o = wo(new Uint8Array(e.getArrayBuffer(a))), c = new Vg(o.buffer);+ const o = Co(new Uint8Array(e.getArrayBuffer(a))), c = new Kg(o.buffer);switch (t) {case "b":case "c":@@ -34669,7 +34669,7 @@ class _R {}}}-class Vg {+class Kg {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 Vg {return s >= 0 && (n = new Uint8Array(this.dv.buffer, t, s)), this._textDecoder.decode(n);}}-class Xx {+class eb {add(e, t) {this[e] = t;}}-function yR(i) {+function NR(i) {const e = "Kaydara FBX Binary \0";- return i.byteLength >= e.length && e === Jx(i, 0, e.length);+ return i.byteLength >= e.length && e === nb(i, 0, e.length);}-function wR(i) {+function DR(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 wR(i) {return !1;return !0;}-function Wg(i) {+function jg(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 vR(i) {+function LR(i) {return i / 46186158e3;}-const CR = [];-function ul(i, e, t, n) {+const PR = [];+function fl(i, e, t, n) {let s;switch (n.mappingType) {case "ByPolygonVertex":@@ -34819,45 +34819,45 @@ function ul(i, e, t, n) {}n.referenceType === "IndexToDirect" && (s = n.indices[s]);const r = s * n.dataSize, a = r + n.dataSize;- return IR(CR, n.buffer, r, a);+ return UR(PR, n.buffer, r, a);}-const Qu = new dn(), ca = new G();-function Yx(i) {- const e = new De(), t = new De(), n = new De(), s = new De(), r = new De(), a = new De(), o = new De(), c = new De(), l = new De(), h = new De(), u = new De(), d = new De(), f = i.inheritType ? i.inheritType : 0;- i.translation && e.setPosition(ca.fromArray(i.translation));- const p = Zo(0);+const zu = new dn(), ha = new G();+function tb(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);if (i.preRotation) {const F = i.preRotation.map(Cn.degToRad);- F.push(p), t.makeRotationFromEuler(Qu.fromArray(F));+ F.push(p), t.makeRotationFromEuler(zu.fromArray(F));}if (i.rotation) {const F = i.rotation.map(Cn.degToRad);- F.push(i.eulerOrder || p), n.makeRotationFromEuler(Qu.fromArray(F));+ F.push(i.eulerOrder || p), n.makeRotationFromEuler(zu.fromArray(F));}if (i.postRotation) {const F = i.postRotation.map(Cn.degToRad);- F.push(p), s.makeRotationFromEuler(Qu.fromArray(F)), s.invert();+ F.push(p), s.makeRotationFromEuler(zu.fromArray(F)), s.invert();}- i.scale && r.scale(ca.fromArray(i.scale)), i.scalingOffset && o.setPosition(ca.fromArray(i.scalingOffset)), i.scalingPivot && a.setPosition(ca.fromArray(i.scalingPivot)), i.rotationOffset && c.setPosition(ca.fromArray(i.rotationOffset)), i.rotationPivot && l.setPosition(ca.fromArray(i.rotationPivot)), i.parentMatrixWorld && (u.copy(i.parentMatrix), h.copy(i.parentMatrixWorld));- const m = t.clone().multiply(n).multiply(s), g = new De();+ 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();g.extractRotation(h);- const A = new De();+ const A = new Ne();A.copyPosition(h);- const y = A.clone().invert().multiply(h), x = g.clone().invert().multiply(y), E = r, I = new De();+ const _ = A.clone().invert().multiply(h), x = g.clone().invert().multiply(_), E = r, S = new Ne();if (f === 0)- I.copy(g).multiply(m).multiply(x).multiply(E);+ S.copy(g).multiply(m).multiply(x).multiply(E);else if (f === 1)- I.copy(g).multiply(x).multiply(m).multiply(E);+ S.copy(g).multiply(x).multiply(m).multiply(E);else {- const K = new De().scale(new G().setFromMatrixScale(u)).clone().invert(), q = x.clone().multiply(K);- I.copy(g).multiply(m).multiply(q).multiply(E);+ const K = new Ne().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(), S = 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(S);- const C = new De().copyPosition(T), v = h.clone().multiply(C);- return d.copyPosition(v), T = d.clone().multiply(I), T.premultiply(h.invert()), T;+ 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 Ne().copyPosition(T), v = h.clone().multiply(C);+ return d.copyPosition(v), T = d.clone().multiply(S), T.premultiply(h.invert()), T;}-function Zo(i) {+function ec(i) {i = i || 0;const e = ["ZYX",@@ -34876,27 +34876,27 @@ function Zo(i) {];return i === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), e[0]) : e[i];}-function Gu(i) {+function Vu(i) {return i.split(",").map(function(t) {return parseFloat(t);});}-function Jx(i, e, t) {+function nb(i, e, t) {return e === void 0 && (e = 0), t === void 0 && (t = i.byteLength), new TextDecoder().decode(new Uint8Array(i, e, t));}-function SR(i, e) {+function kR(i, e) {for (let t = 0, n = i.length, s = e.length; t < s; t++, n++)i[n] = e[t];}-function IR(i, e, t, n) {+function UR(i, e, t, n) {for (let s = t, r = 0; s < n; s++, r++)i[r] = e[s];return i;}-const MR = 0.35;-class BR {+const OR = 0.35;+class QR {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 Zf(), this.fbxLoader = new gR(), 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 tp(), this.fbxLoader = new SR(), 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 BR {* @param {THREE.Object3D} model*/attach(e) {- this.detach(), this.model = e, this.mixer = new V0(e), this.actions.clear(), this.currentAction = null, this.currentName = null;+ this.detach(), this.model = e, this.mixer = new X0(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 BR {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 ? m0 : x0), n.loop === !1 && (o.clampWhenFinished = !0), this.actions.set(e, o);+ o.enabled = !0, o.setLoop(n.loop === !1 ? _0 : w0), n.loop === !1 && (o.clampWhenFinished = !0), this.actions.set(e, o);}return r;}@@ -34996,7 +34996,7 @@ class BR {* @param {string} name* @param {number} [duration] - Crossfade duration in seconds*/- crossfadeTo(e, t = MR) {+ crossfadeTo(e, t = OR) {if (e === this.currentName) return;const n = this.actions.get(e);if (!n) {@@ -35094,14 +35094,14 @@ class BR {}}us.enabled = !0;-class Zx {+class ib {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 BR(), this._animPanelEl = null, this.state = {- environment: t.preset === sf.ASSET_GENERATOR ? sl.find((r) => r.id === "footprint-court").name : sl[1].name,+ 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,background: !1,playbackSpeed: 1,actionStates: {},- camera: hl,+ camera: dl,wireframe: !1,skeleton: !1,grid: !1,@@ -35109,7 +35109,7 @@ class Zx {// LightspunctualLights: !0,exposure: 0,- toneMapping: Ad,+ toneMapping: xd,ambientIntensity: 0.3,ambientColor: "#FFFFFF",directIntensity: 0.8 * Math.PI,@@ -35123,9 +35123,9 @@ class Zx {showLabels: !1,// Avatar follow modefollowMode: "mouse"- }, this.prevTime = 0, this.stats = new Fo(), 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 kd(), this.scene.background = this.backgroundColor;- const n = t.preset === sf.ASSET_GENERATOR ? 0.8 * 180 / Math.PI : 60, s = e.clientWidth / e.clientHeight;- this.defaultCamera = new Sn(n, s, 0.01, 1e3), this.activeCamera = this.defaultCamera, this.scene.add(this.defaultCamera), this.renderer = window.renderer = new JA({ 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 Hd(this.renderer), this.pmremGenerator.compileEquirectangularShader(), this.neutralEnvironment = this.pmremGenerator.fromScene(new lM()).texture, this.controls = new Y1(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 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 = () => {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,16 +35172,16 @@ class Zx {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() {- sR(this);+ AR(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 = wr.extractUrlBase(e);+ const s = Cr.extractUrlBase(e);return new Promise((r, a) => {- Zl.setURLModifier((l, h) => {+ eh.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 Zx {}return (h || "") + l;});- const o = new Zf(Zl).setCrossOrigin("anonymous").setDRACOLoader(kT).setKTX2Loader(UT.detectSupport(this.renderer)).setMeshoptDecoder(j1), c = [];+ const o = new tp(eh).setCrossOrigin("anonymous").setDRACOLoader(jT).setKTX2Loader(XT.detectSupport(this.renderer)).setMeshoptDecoder(rM), c = [];o.load(e,(l) => {@@ -35213,45 +35213,45 @@ class Zx {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(hl), 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) => {+ 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) => {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) {- aR(this, e);+ mR(this, e);}playAllClips() {- oR(this);+ xR(this);}/*** @param {string} name*/setCamera(e) {- e === hl ? (this.controls.enabled = !0, this.activeCamera = this.defaultCamera) : (this.controls.enabled = !1, this.content.traverse((t) => {+ e === dl ? (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 ? OT(this) : !e.punctualLights && t.length && QT(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 ? 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();}updateEnvironment() {- const e = sl.filter(+ const e = al.filter((t) => t.name === this.state.environment)[0];- iR(this, e).then(({ envMap: t }) => {+ pR(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)), zg(this.content, (e) => {- e.wireframe = this.state.wireframe, e instanceof Vf && (e.size = this.state.pointSize);+ 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.content.traverse((e) => {if (e.geometry && e.skeleton && this.state.skeleton) {- const t = new Bw(e.skeleton.bones[0].parent);+ const t = new Qw(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 Tw(), this.axesHelper = new SA(), 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 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();}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 Zx {* See: https://stackoverflow.com/q/16226693/1314762*/updateModelInfo(e, t) {- this.modelInfo && (this.modelInfo.remove(), this.modelInfo = null), this.state.showInfo && e && (this.modelInfo = AT(this.el, 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;- xT(this.content).forEach((t) => {- const n = bT(t), s = document.createElement("div");+ BT(this.content).forEach((t) => {+ const n = TT(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 Zx {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 kd(), this.axesCamera = new Sn(50, e / t, 0.1, 10), this.axesScene.add(this.axesCamera), this.axesRenderer = new JA({ 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 SA(5), this.axesScene.add(this.axesCorner), this.axesDiv.appendChild(this.axesRenderer.domElement);+ 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);}addGUI() {- const e = window.innerWidth <= 700, t = this.gui = new RM({+ const e = window.innerWidth <= 700, t = this.gui = new HM({autoPlace: !1,width: e ? 220 : 260,hideable: !0@@ -35307,11 +35307,11 @@ class Zx {p.add(this.state,"environment",- sl.map((w) => w.name)+ al.map((w) => w.name)).onChange(() => this.updateEnvironment()), [p.add(this.state, "toneMapping", {- Linear: Ad,- "ACES Filmic": c0+ Linear: xd,+ "ACES Filmic": f0}),p.add(this.state, "exposure", -10, 10, 0.01),p.add(this.state, "punctualLights").listen(),@@ -35323,15 +35323,15 @@ class Zx {].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 y = t.addFolder("Performance"), x = document.createElement("li");- this.stats.dom.style.position = "static", x.appendChild(this.stats.dom), x.classList.add("gui-stats"), y.__ul.appendChild(x);+ 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 I = document.createElement("button");- I.className = "gui-toggle", I.setAttribute("title", "Toggle advanced controls"), I.setAttribute("aria-label", "Toggle advanced controls"), I.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>', I.addEventListener("click", () => {+ 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");- I.classList.toggle("gui-toggle--active", !w);- }), this.el.appendChild(I), this._guiToggle = I, e ? t.close() : t.open();+ 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";@@ -35340,7 +35340,7 @@ class Zx {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 = [hl].concat(e);+ const n = [dl].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 Zx {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();- }), zg(this.content, (e) => {+ }), qg(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,9 +35471,18 @@ class Zx {}}}-class TR {- constructor({ model: e = "claude-opus-4-6", proxyURL: t, apiKey: n, temperature: s = 0.7, maxTokens: r = 4096, thinking: a = "auto" } = {}) {- this.model = e, this.proxyURL = t, this.apiKey = n, this.temperature = s, this.maxTokens = r, this.thinking = a;+class GR {+ constructor({+ model: e = "claude-opus-4-6",+ proxyURL: t,+ apiKey: n,+ agentId: s,+ apiOrigin: r,+ temperature: a = 0.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 = {@@ -35520,7 +35529,7 @@ class TR {return { role: "assistant", content: n };}}-class RR {+class HR {// Used when brain.provider === "none" — skills drive the agent.async complete() {return { text: "", toolCalls: [], stopReason: "end_turn" };@@ -35532,13 +35541,13 @@ class RR {return { role: "assistant", content: e || "" };}}-function FR(i = {}) {+function zR(i = {}) {const e = i.provider || "anthropic";- if (e === "anthropic") return new TR(i);- if (e === "none") return new RR();+ if (e === "anthropic") return new GR(i);+ if (e === "none") return new HR();throw new Error(`Unsupported provider: ${e}. Supported: anthropic, none`);}-class DR {+class VR {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;}@@ -35573,7 +35582,7 @@ class DR {return e.find((t) => t.lang?.startsWith(this.lang.slice(0, 2))) || null;}}-class NR {+class WR {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;}@@ -35613,7 +35622,7 @@ class NR {return this._listening;}}-class LR {+class qR {constructor({voiceId: e,modelId: t = "eleven_turbo_v2_5",@@ -35770,20 +35779,20 @@ class LR {this._startedFired = !1;}}-function PR(i = {}) {+function KR(i = {}) {const e = i.provider || "browser";if (e === "none") return null;- if (e === "browser") return new DR(i);- if (e === "elevenlabs") return new LR(i);+ if (e === "browser") return new VR(i);+ if (e === "elevenlabs") return new qR(i);throw new Error(`TTS provider "${e}" not implemented yet`);}-function kR(i = {}) {+function jR(i = {}) {const e = i.provider || "browser";if (e === "none") return null;- if (e === "browser") return new NR(i);+ if (e === "browser") return new WR(i);throw new Error(`STT provider "${e}" not implemented yet`);}-const qg = [+const Xg = [{name: "wave",description: "Wave at the user. Use for greetings, farewells, or acknowledgments.",@@ -35858,7 +35867,7 @@ const qg = [required: ["key", "name", "description", "type", "body"]}}-], UR = [+], XR = [{name: "observe_agents",description: "List the other agents currently sharing this stage, with their names and positions.",@@ -35876,7 +35885,7 @@ const qg = [required: ["agentId", "text"]}}-], OR = {+], YR = {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 };@@ -35910,13 +35919,13 @@ const qg = [const s = e.agentId || "anon";return e.stage.broadcast(s, { kind: "direct", to: t, text: n }), e.stage.routeMessage(s, t, n);}-}, QR = 8;-class GR extends EventTarget {+}, JR = 8;+class ZR 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 = FR({+ super(), this.manifest = e || {}, this.viewer = t, this.memory = n, this.skills = s, this.stage = o, this.agentId = c, this.provider = zR({...this.manifest.brain,...r- }), this.tts = PR({ ...this.manifest.voice?.tts, ...a.tts }), this.stt = kR({ ...this.manifest.voice?.stt, ...a.stt }), this.messages = [], this._busy = !1;+ }), this.tts = KR({ ...this.manifest.voice?.tts, ...a.tts }), this.stt = jR({ ...this.manifest.voice?.stt, ...a.stt }), this.messages = [], this._busy = !1;}get systemPrompt() {const e = [];@@ -35929,7 +35938,7 @@ class GR extends EventTarget {</memory>`), this.skills && e.push(this.skills.systemPrompt()), e.join("");}get tools() {- const e = new Set(this.manifest.tools || qg.map((r) => r.name)), t = qg.filter((r) => e.has(r.name)), n = this.skills ? this.skills.allTools() : [], s = this.stage ? UR : [];+ 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 : [];return [...t, ...s, ...n];}async send(e, { voice: t = !1 } = {}) {@@ -35948,7 +35957,7 @@ class GR extends EventTarget {}async _loop() {let e = 0, t = "";- for (; e++ < QR; ) {+ for (; e++ < JR; ) {const n = await this.provider.complete({system: this.systemPrompt,messages: this.messages,@@ -35984,7 +35993,7 @@ class GR 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 = OR[e.name];+ const s = YR[e.name];if (!s) throw new Error(`Unknown tool: ${e.name}`);return s(e.input, t);}@@ -36033,23 +36042,23 @@ class GR extends EventTarget {this.pause(), this.messages = [];}}-const af = [+const lf = ["https://dweb.link/ipfs/","https://cloudflare-ipfs.com/ipfs/","https://ipfs.io/ipfs/"-], HR = "https://arweave.net/";-function Nr(i, e = 0) {+], $R = "https://arweave.net/";+function Xs(i, e = 0) {if (!i) return i;const t = i.match(/^ipfs:\/\/(.+)$/i);if (t)- return af[e % af.length] + t[1];+ return lf[e % lf.length] + t[1];const n = i.match(/^ar:\/\/(.+)$/i);- return n ? HR + n[1] : i;+ return n ? $R + n[1] : i;}-async function zR(i) {+async function eF(i) {let e;- for (let t = 0; t < af.length; t++) {- const n = Nr(i, t);+ for (let t = 0; t < lf.length; t++) {+ const n = Xs(i, t);try {const s = await fetch(n);if (s.ok) return s;@@ -36059,7 +36068,7 @@ async function zR(i) {}throw e || new Error("All IPFS gateways failed for " + i);}-const VR = {+const tF = {idle: "idle",wave: "reaction",nod: "reaction",@@ -36071,10 +36080,10 @@ const VR = {point: "reaction",shrug: "defeated"};-function WR(i, e) {- return e && e[i] ? e[i] : VR[i] ?? i;+function nF(i, e) {+ return e && e[i] ? e[i] : tF[i] ?? i;}-const Kg = {+const Yg = {neutral: {/* reset all */},@@ -36084,9 +36093,9 @@ const Kg = {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 qR {+class iF {constructor(e) {- this.viewer = e, this._loader = new Zf(), 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 tp(), 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 needget scene() {@@ -36134,7 +36143,7 @@ class qR {* @returns {string}*/resolveAnimationSlot(e) {- return WR(e, this._animationMap);+ return nF(e, this._animationMap);}// Delegate raw load for ad-hoc casesasync load(e, t = "", n = /* @__PURE__ */ new Map()) {@@ -36183,7 +36192,7 @@ class qR {return s.reset(), s.fadeIn(t?.blend ?? 0.2), s.play(), this.viewer._animating = !0, this.viewer.invalidate(), !0;}async loadClip(e) {- const t = Nr(e);+ const t = Xs(e);return new Promise((n, s) => {this._loader.load(t,@@ -36194,7 +36203,7 @@ class qR {});}async loadGLB(e) {- const t = Nr(e);+ const t = Xs(e);return new Promise((n, s) => {this._loader.load(t, n, void 0, s);});@@ -36218,7 +36227,7 @@ class qR {}// --- Expression (morph targets) ---setExpression(e, t = 1) {- const n = Kg[e] || Kg.neutral;+ const n = Yg[e] || Yg.neutral;this.viewer.content && (this.viewer.content.traverse((s) => {if (!(!s.morphTargetDictionary || !s.morphTargetInfluences)) {for (let r = 0; r < s.morphTargetInfluences.length; r++)@@ -36258,7 +36267,7 @@ class qR {return this.clips.find((s) => s.name.toLowerCase() === n) || this.clips.find((s) => s.name.toLowerCase().includes(n));}}-const KR = `// Sandbox worker — executes skill handlers in an isolated Web Worker scope.+const sF = `// 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 */@@ -36427,40 +36436,40 @@ function _handleResponse({ requestId, result, error }) {}}`;-let li = null, Ca = null;-const Sa = /* @__PURE__ */ new Map(), $o = /* @__PURE__ */ new Map(), zs = /* @__PURE__ */ new Map(), _h = /* @__PURE__ */ new Map();-let jR = 0, XR = 0;-function jg(i) {+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) {if (i == null) return null;- const e = `@h:${++jR}`;- return _h.set(e, i), e;+ const e = `@h:${++rF}`;+ return wh.set(e, i), e;}-function YR(i) {- return typeof i == "string" && i.startsWith("@h:") ? _h.get(i) ?? i : i;+function oF(i) {+ return typeof i == "string" && i.startsWith("@h:") ? wh.get(i) ?? i : i;}-function JR(i) {- return Array.isArray(i) ? i.map(YR) : i;+function cF(i) {+ return Array.isArray(i) ? i.map(oF) : i;}-function $x() {+function sb() {if (!li) {- if (!Ca) {- const i = new Blob([KR], { type: "text/javascript" });- Ca = URL.createObjectURL(i);+ if (!Sa) {+ const i = new Blob([sF], { type: "text/javascript" });+ Sa = URL.createObjectURL(i);}- li = new Worker(Ca), li.onmessage = $R, li.onerror = ZR;+ li = new Worker(Sa), li.onmessage = hF, li.onerror = lF;}return li;}-function ZR(i) {- console.error("[sandbox] worker crashed:", i), li = null, Sa.clear(), $o.clear(), _h.clear();+function lF(i) {+ console.error("[sandbox] worker crashed:", i), li = null, Ma.clear(), tc.clear(), wh.clear();for (const [, e] of zs) e.reject(new Error("Sandbox worker crashed"));zs.clear();}-function $R({ data: i }) {+function hF({ data: i }) {switch (i.type) {case "install-ack": {- const e = $o.get(i.skillURI);- $o.delete(i.skillURI), i.ok ? e?.resolve() : (Sa.delete(i.skillURI), e?.reject(new Error(i.error || "Install failed")));+ 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")));break;}case "request": {@@ -36473,7 +36482,7 @@ function $R({ data: i }) {});return;}- eF(n, s, r.mainCtx).then(+ uF(n, s, r.mainCtx).then((a) => li?.postMessage({ type: "response", requestId: t, result: a ?? null }),(a) => li?.postMessage({type: "response",@@ -36491,8 +36500,8 @@ function $R({ data: i }) {}}}-async function eF(i, e, t) {- const n = JR(e);+async function uF(i, e, t) {+ const n = cF(e);switch (i) {// viewercase "viewer.play":@@ -36526,11 +36535,11 @@ async function eF(i, e, t) {// asset loading — results stored as handles because they're non-serializablecase "loadClip": {const s = await t.loadClip?.(n[0]);- return jg(s);+ return Jg(s);}case "loadGLB": {const s = await t.loadGLB?.(n[0]);- return jg(s);+ return Jg(s);}// speechcase "speak":@@ -36544,16 +36553,16 @@ async function eF(i, e, t) {throw new Error(`Unknown ctx method: ${i}`);}}-async function tF(i, e) {- if (Sa.has(i)) return Sa.get(i);+async function dF(i, e) {+ if (Ma.has(i)) return Ma.get(i);const t = new Promise((n, s) => {- $o.set(i, { resolve: n, reject: s });+ tc.set(i, { resolve: n, reject: s });});- return Sa.set(i, t), $x().postMessage({ type: "install", skillURI: i, handlersSrc: e }), t;+ return Ma.set(i, t), sb().postMessage({ type: "install", skillURI: i, handlersSrc: e }), t;}-async function nF(i, e, t, n, s) {- await tF(i, n);- const r = ++XR, a = $x();+async function fF(i, e, t, n, s) {+ await dF(i, n);+ const r = ++aF, a = sb();return new Promise((o, c) => {zs.set(r, { resolve: o, reject: c, mainCtx: s }), a.postMessage({type: "invoke",@@ -36565,20 +36574,20 @@ async function nF(i, e, t, n, s) {});});}-function iF() {+function pF() {if (li) {- li.terminate(), li = null, Ca && (URL.revokeObjectURL(Ca), Ca = null), Sa.clear(), $o.clear(), _h.clear();+ li.terminate(), li = null, Sa && (URL.revokeObjectURL(Sa), Sa = null), Ma.clear(), tc.clear(), wh.clear();for (const [, i] of zs) i.reject(new Error("Sandbox terminated"));zs.clear();}}-function sF() {- return { invoke: nF, terminate: iF };+function AF() {+ return { invoke: fF, terminate: pF };}-function rF(i, e) {+function gF(i, e) {return /^([a-z]+:|\/)/i.test(e) ? e : (i.endsWith("/") || (i += "/"), i + e);}-class aF {+class mF {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;}@@ -36592,7 +36601,7 @@ class aF {}if (!this.handlersSrc)throw new Error(`Skill "${this.name}" has no handler source for tool "${e}"`);- return sF().invoke(this.uri, e, t, this.handlersSrc, s);+ return AF().invoke(this.uri, e, t, this.handlersSrc, s);}systemPromptFragment() {return this.instructions ? `@@ -36602,7 +36611,7 @@ ${this.instructions}</skill>` : "";}}-class oF {+class xF {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();}@@ -36615,7 +36624,7 @@ class oF {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 aF({+ ]), l = new mF({uri: n,manifest: s,instructions: a,@@ -36656,7 +36665,7 @@ class oF {}_resolveBundleURI(e, t) {let n = e;- return !/^([a-z]+:|\/)/i.test(e) && t && (n = rF(t, e)), n.endsWith("/") || (n += "/"), (n.startsWith("ipfs://") || n.startsWith("ar://")) && (n = Nr(n)), n;+ return !/^([a-z]+:|\/)/i.test(e) && t && (n = gF(t, e)), n.endsWith("/") || (n += "/"), (n.startsWith("ipfs://") || n.startsWith("ar://")) && (n = Xs(n)), n;}async _fetchJSON(e) {const t = await this.fetchFn(e);@@ -36696,9 +36705,9 @@ class oF {}}}-const cF = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;-function dl(i) {- const e = i.match(cF);+const bF = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;+function pl(i) {+ const e = i.match(bF);if (!e) return { meta: {}, body: i };const t = {};for (const n of e[1].split(`@@ -36708,7 +36717,7 @@ function dl(i) {}return { meta: t, body: e[2] };}-function lF(i, e) {+function EF(i, e) {const t = ["---"];for (const [n, s] of Object.entries(i)) t.push(`${n}: ${s}`);return t.push("---", "", e), t.join(`@@ -36756,11 +36765,11 @@ class Pi {}read(e) {const t = e.endsWith(".md") ? e : `${e}.md`, n = this.files.get(t);- return n ? dl(n) : null;+ return n ? pl(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 && dl(l).meta.created || c, u = { name: t, description: n, type: s, created: h, updated: c };- a && (u.decay = a), this.files.set(o, lF(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 && 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();}note(e, t) {const n = { ts: (/* @__PURE__ */ new Date()).toISOString(), type: e, ...t };@@ -36769,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 } = dl(a), l = `${o.name || ""} ${o.description || ""} ${c}`.toLowerCase();+ const { meta: o, body: c } = pl(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);@@ -36777,7 +36786,7 @@ class Pi {_rebuildIndex() {const e = { user: [], feedback: [], project: [], reference: [] };for (const [s, r] of this.files) {- const { meta: a } = dl(r), o = a.type || "user";+ const { meta: a } = pl(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" };@@ -36840,8 +36849,8 @@ class Pi {this._rebuildIndex(), this._persist();}}-const hF = "6.16.0";-function uF(i, e, t) {+const yF = "6.16.0";+function _F(i, e, t) {const n = e.split("|").map((r) => r.trim());for (let r = 0; r < n.length; r++)switch (e) {@@ -36865,10 +36874,10 @@ function Ye(i, e, t) {for (let n in e) {let s = e[n];const r = t ? t[n] : null;- r && uF(s, r, n), Object.defineProperty(i, n, { enumerable: !0, value: s, writable: !1 });+ r && _F(s, r, n), Object.defineProperty(i, n, { enumerable: !0, value: s, writable: !1 });}}-function ba(i, e) {+function ya(i, e) {if (i == null)return "null";if (e == null && (e = /* @__PURE__ */ new Set()), typeof i == "object") {@@ -36877,7 +36886,7 @@ function ba(i, e) {e.add(i);}if (Array.isArray(i))- return "[ " + i.map((t) => ba(t, e)).join(", ") + " ]";+ return "[ " + i.map((t) => ya(t, e)).join(", ") + " ]";if (i instanceof Uint8Array) {const t = "0123456789abcdef";let n = "0x";@@ -36886,7 +36895,7 @@ function ba(i, e) {return n;}if (typeof i == "object" && typeof i.toJSON == "function")- return ba(i.toJSON(), e);+ return ya(i.toJSON(), e);switch (typeof i) {case "boolean":case "number":@@ -36898,7 +36907,7 @@ function ba(i, e) {return JSON.stringify(i);case "object": {const t = Object.keys(i);- return t.sort(), "{ " + t.map((n) => `${ba(n, e)}: ${ba(i[n], e)}`).join(", ") + " }";+ return t.sort(), "{ " + t.map((n) => `${ya(n, e)}: ${ya(i[n], e)}`).join(", ") + " }";}}return "[ COULD NOT SERIALIZE ]";@@ -36906,24 +36915,24 @@ function ba(i, e) {function Mn(i, e) {return i && i.code === e;}-function up(i) {+function pp(i) {return Mn(i, "CALL_EXCEPTION");}-function Ht(i, e, t) {+function Gt(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: ${ba(t)}`);+ throw new Error(`value will overwrite populated values: ${ya(t)}`);for (const a in t) {if (a === "shortMessage")continue;const o = t[a];- r.push(a + "=" + ba(o));+ r.push(a + "=" + ya(o));}}- r.push(`code=${e}`), r.push(`version=${hF}`), r.length && (i += " (" + r.join(", ") + ")");+ r.push(`code=${e}`), r.push(`version=${yF}`), r.length && (i += " (" + r.join(", ") + ")");}let s;switch (e) {@@ -36941,12 +36950,12 @@ function Ht(i, e, t) {}function ge(i, e, t, n) {if (!i)- throw Ht(e, t, n);+ throw Gt(e, t, n);}function V(i, e, t, n) {ge(i, e, "INVALID_ARGUMENT", { argument: t, value: n });}-function eb(i, e, t) {+function rb(i, e, t) {t == null && (t = ""), t && (t = ": " + t), ge(i >= e, "missing argument" + t, "MISSING_ARGUMENT", {count: i,expectedCount: e@@ -36966,7 +36975,7 @@ function eb(i, e, t) {}return i;}, []);-function yh(i, e, t) {+function vh(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", {@@ -36974,7 +36983,7 @@ function yh(i, e, t) {});}}-function tb(i, e, t) {+function ab(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)) {@@ -36987,31 +36996,31 @@ function tb(i, e, t) {V(!1, "invalid BytesLike value", e || "value", i);}function dt(i, e) {- return tb(i, e, !1);+ return ab(i, e, !1);}function On(i, e) {- return tb(i, e, !0);+ return ab(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 dp(i) {+function Ap(i) {return Ut(i, !0) || i instanceof Uint8Array;}-const Xg = "0123456789abcdef";-function Se(i) {+const Zg = "0123456789abcdef";+function Ie(i) {const e = dt(i);let t = "0x";for (let n = 0; n < e.length; n++) {const s = e[n];- t += Xg[(s & 240) >> 4] + Xg[s & 15];+ t += Zg[(s & 240) >> 4] + Zg[s & 15];}return t;}-function Gt(i) {- return "0x" + i.map((e) => Se(e).substring(2)).join("");+function Ht(i) {+ return "0x" + i.map((e) => Ie(e).substring(2)).join("");}-function Ia(i) {+function Ba(i) {return Ut(i, !0) ? (i.length - 2) / 2 : dt(i).length;}function Kt(i, e, t) {@@ -37020,9 +37029,9 @@ function Kt(i, e, t) {buffer: n,length: n.length,offset: t- }), Se(n.slice(e ?? 0, t ?? n.length));+ }), Ie(n.slice(e ?? 0, t ?? n.length));}-function nb(i, e, t) {+function ob(i, e, t) {const n = dt(i);ge(e >= n.length, "padding exceeds data length", "BUFFER_OVERRUN", {buffer: new Uint8Array(n),@@ -37030,38 +37039,38 @@ function nb(i, e, t) {offset: e + 1});const s = new Uint8Array(e);- return s.fill(0), t ? s.set(n, e - n.length) : s.set(n, 0), Se(s);+ return s.fill(0), t ? s.set(n, e - n.length) : s.set(n, 0), Ie(s);}function Es(i, e) {- return nb(i, e, !0);+ return ob(i, e, !0);}-function dF(i, e) {- return nb(i, e, !1);+function wF(i, e) {+ return ob(i, e, !1);}-const fc = BigInt(0), Ii = BigInt(1), Ea = 9007199254740991;-function fF(i, e) {- const t = wh(i, "value"), n = BigInt(ft(e, "width"));- if (ge(t >> n === fc, "overflow", "NUMERIC_FAULT", {+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", {operation: "fromTwos",fault: "overflow",value: i- }), t >> n - Ii) {- const s = (Ii << n) - Ii;- return -((~t & s) + Ii);+ }), t >> n - Si) {+ const s = (Si << n) - Si;+ return -((~t & s) + Si);}return t;}-function ib(i, e) {- let t = Ne(i, "value");- const n = BigInt(ft(e, "width")), s = Ii << n - Ii;- if (t < fc) {+function cb(i, e) {+ let t = De(i, "value");+ const n = BigInt(ft(e, "width")), s = Si << n - Si;+ if (t < Ac) {t = -t, ge(t <= s, "too low", "NUMERIC_FAULT", {operation: "toTwos",fault: "overflow",value: i});- const r = (Ii << n) - Ii;- return (~t & r) + Ii;+ const r = (Si << n) - Si;+ return (~t & r) + Si;} elsege(t < s, "too high", "NUMERIC_FAULT", {operation: "toTwos",@@ -37070,16 +37079,16 @@ function ib(i, e) {});return t;}-function vo(i, e) {- const t = wh(i, "value"), n = BigInt(ft(e, "bits"));- return t & (Ii << n) - Ii;+function Io(i, e) {+ const t = Ch(i, "value"), n = BigInt(ft(e, "bits"));+ return t & (Si << n) - Si;}-function Ne(i, e) {+function De(i, e) {switch (typeof i) {case "bigint":return i;case "number":- return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -Ea && i <= Ea, "overflow", e || "value", i), BigInt(i);+ return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -_a && i <= _a, "overflow", e || "value", i), BigInt(i);case "string":try {if (i === "")@@ -37091,30 +37100,30 @@ function Ne(i, e) {}V(!1, "invalid BigNumberish value", e || "value", i);}-function wh(i, e) {- const t = Ne(i, e);- return ge(t >= fc, "unsigned value cannot be negative", "NUMERIC_FAULT", {+function Ch(i, e) {+ const t = De(i, e);+ return ge(t >= Ac, "unsigned value cannot be negative", "NUMERIC_FAULT", {fault: "overflow",operation: "getUint",value: i}), t;}-const Yg = "0123456789abcdef";-function fp(i) {+const $g = "0123456789abcdef";+function gp(i) {if (i instanceof Uint8Array) {let e = "0x0";for (const t of i)- e += Yg[t >> 4], e += Yg[t & 15];+ e += $g[t >> 4], e += $g[t & 15];return BigInt(e);}- return Ne(i);+ return De(i);}function ft(i, e) {switch (typeof i) {case "bigint":- return V(i >= -Ea && i <= Ea, "overflow", e || "value", i), Number(i);+ return V(i >= -_a && i <= _a, "overflow", e || "value", i), Number(i);case "number":- return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -Ea && i <= Ea, "overflow", e || "value", i), i;+ return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -_a && i <= _a, "overflow", e || "value", i), i;case "string":try {if (i === "")@@ -37126,17 +37135,17 @@ function ft(i, e) {}V(!1, "invalid numeric value", e || "value", i);}-function pF(i) {- return ft(fp(i));+function CF(i) {+ return ft(gp(i));}-function Xs(i, e) {- const t = wh(i, "value");+function Ys(i, e) {+ const t = Ch(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 === fc)+ if (s === 0 && t === Ac)return "0x";for (ge(s * 2 >= n.length, `value exceeds width (${s} bytes)`, "NUMERIC_FAULT", {operation: "toBeHex",@@ -37148,8 +37157,8 @@ function Xs(i, e) {return "0x" + n;}function rn(i, e) {- const t = wh(i, "value");- if (t === fc)+ const t = Ch(i, "value");+ if (t === Ac)return new Uint8Array(0);let n = t.toString(16);n.length % 2 && (n = "0" + n);@@ -37161,38 +37170,38 @@ function rn(i, e) {return s;}function wi(i) {- let e = Se(dp(i) ? i : rn(i)).substring(2);+ let e = Ie(Ap(i) ? i : rn(i)).substring(2);for (; e.startsWith("0"); )e = e.substring(1);return e === "" && (e = "0"), "0x" + e;}-const Jg = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";+const em = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);-const Zg = BigInt(58);-function AF(i) {+const tm = BigInt(58);+function IF(i) {const e = dt(i);- let t = fp(e), n = "";+ let t = gp(e), n = "";for (; t; )- n = Jg[Number(t % Zg)] + n, t /= Zg;+ n = em[Number(t % tm)] + n, t /= tm;for (let s = 0; s < e.length && !e[s]; s++)- n = Jg[0] + n;+ n = em[0] + n;return n;}-function gF(i) {+function SF(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 MF(i) {const e = dt(i);let t = "";for (let n = 0; n < e.length; n++)t += String.fromCharCode(e[n]);return btoa(t);}-class sb {+class lb {/*** The event filter.*/@@ -37216,10 +37225,10 @@ class sb {this.#e != null && await this.emitter.off(this.filter, this.#e);}}-function xF(i, e, t, n, s) {+function BF(i, e, t, n, s) {V(!1, `invalid codepoint at offset ${e}; ${i}`, "bytes", t);}-function rb(i, e, t, n, s) {+function hb(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++)@@ -37228,16 +37237,16 @@ function rb(i, e, t, n, s) {}return i === "OVERRUN" ? t.length - e - 1 : 0;}-function bF(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), rb(i, e, t));+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));}-const EF = Object.freeze({- error: xF,- ignore: rb,- replace: bF+const RF = Object.freeze({+ error: BF,+ ignore: hb,+ replace: TF});-function _F(i, e) {- e == null && (e = EF.error);+function FF(i, e) {+ e == null && (e = RF.error);const t = dt(i, "bytes"), n = [];let s = 0;for (; s < t.length; ) {@@ -37308,13 +37317,13 @@ function gs(i, e) {}return new Uint8Array(t);}-function yF(i) {+function NF(i) {return i.map((e) => e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10 & 1023) + 55296, (e & 1023) + 56320))).join("");}-function $l(i, e) {- return yF(_F(i, e));+function th(i, e) {+ return NF(FF(i, e));}-function ab(i) {+function ub(i) {async function e(t, n) {ge(n == null || !n.cancelled, "request cancelled before sending", "CANCELLED");const s = t.url.split(":")[0].toLowerCase();@@ -37326,10 +37335,10 @@ function ab(i) {});let r = null;const a = new AbortController(), o = setTimeout(() => {- r = Ht("request timeout", "TIMEOUT"), a.abort();+ r = Gt("request timeout", "TIMEOUT"), a.abort();}, t.timeout);n && n.addListener(() => {- r = Ht("request cancelled", "CANCELLED"), a.abort();+ r = Gt("request cancelled", "CANCELLED"), a.abort();});const c = Object.assign({}, i, {method: t.method,@@ -37358,26 +37367,26 @@ function ab(i) {}return e;}-const wF = 12, vF = 250;-let $g = ab();-const CF = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"), SF = new RegExp("^ipfs://(ipfs/)?(.*)$", "i");-let Hu = !1;-async function ob(i, 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) {try {- const t = i.match(CF);+ const t = i.match(PF);if (!t)throw new Error("invalid data");return new Vs(200, "OK", {"content-type": t[1] || "text/plain"- }, t[2] ? gF(t[3]) : MF(t[3]));+ }, t[2] ? SF(t[3]) : OF(t[3]));} catch {return new Vs(599, "BAD REQUEST (invalid data: URI)", {}, null, new Gi(i));}}-function cb(i) {+function fb(i) {async function e(t, n) {try {- const s = t.match(SF);+ const s = t.match(kF);if (!s)throw new Error("invalid link");return new Gi(`${i}${s[2]}`);@@ -37387,15 +37396,15 @@ function cb(i) {}return e;}-const fl = {- data: ob,- ipfs: cb("https://gateway.ipfs.io/ipfs/")-}, lb = /* @__PURE__ */ new WeakMap();-class IF {+const Al = {+ data: db,+ ipfs: fb("https://gateway.ipfs.io/ipfs/")+}, pb = /* @__PURE__ */ new WeakMap();+class UF {#e;#t;constructor(e) {- this.#e = [], this.#t = !1, lb.set(e, () => {+ this.#e = [], this.#t = !1, pb.set(e, () => {if (!this.#t) {this.#t = !0;for (const t of this.#e)@@ -37418,7 +37427,7 @@ class IF {ge(!this.cancelled, "cancelled", "CANCELLED", {});}}-function pl(i) {+function gl(i) {if (i == null)throw new Error("missing signal; should not happen");return i.checkSignal(), i;@@ -37511,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 ${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;}/*** Get the header for %%key%%, ignoring case.@@ -37646,7 +37655,7 @@ class Gi {* configurege a proxy or other agent.*/get getUrlFunc() {- return this.#u || $g;+ return this.#u || nm;}set getUrlFunc(e) {this.#u = e;@@ -37659,12 +37668,12 @@ class Gi {*/constructor(e) {this.#a = String(e), this.#e = !1, this.#t = !0, this.#n = {}, this.#i = "", this.#s = 3e5, this.#h = {- slotInterval: vF,- maxAttempts: wF+ slotInterval: LF,+ maxAttempts: DF}, this.#u = null;}toString() {- return `<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#r ? Se(this.#r) : "null"}>`;+ return `<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#r ? Ie(this.#r) : "null"}>`;}/*** Update the throttle parameters used to determine maximum@@ -37676,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(em() <= t, "timeout", "TIMEOUT", {+ ge(im() <= t, "timeout", "TIMEOUT", {operation: "request.send",reason: "timeout",request: s- }), n > 0 && await BF(n);+ }), n > 0 && await QF(n);let a = this.clone();const o = (a.url.split(":")[0] || "").toLowerCase();- if (o in fl) {- const h = await fl[o](a.url, pl(s.#c));+ if (o in Al) {+ const h = await Al[o](a.url, gl(s.#c));if (h instanceof Vs) {let u = h;if (this.processFunc) {- pl(s.#c);+ gl(s.#c);try {u = await this.processFunc(a, u);} catch (d) {@@ -37700,7 +37709,7 @@ class Gi {a = h;}this.preflightFunc && (a = await this.preflightFunc(a));- const c = await this.getUrlFunc(a, pl(s.#c));+ const c = await this.getUrlFunc(a, gl(s.#c));let l = new Vs(c.statusCode, c.statusMessage, c.headers, c.body, s);if (l.statusCode === 301 || l.statusCode === 302) {try {@@ -37715,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) {- pl(s.#c);+ gl(s.#c);try {l = await this.processFunc(a, l);} catch (h) {@@ -37730,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 IF(this), this.#d(0, em() + 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 UF(this), this.#d(0, im() + this.timeout, 0, this, new Vs(0, "", {}, null, this));}/*** Cancels the inflight response, causing a ``CANCELLED``@@ -37738,7 +37747,7 @@ class Gi {*/cancel() {ge(this.#c != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" });- const e = lb.get(this);+ const e = pb.get(this);if (!e)throw new Error("missing signal; should not happen");e();@@ -37767,13 +37776,13 @@ class Gi {* registration.*/static lockConfig() {- Hu = !0;+ Wu = !0;}/*** Get the current Gateway function for %%scheme%%.*/static getGateway(e) {- return fl[e.toLowerCase()] || null;+ return Al[e.toLowerCase()] || null;}/*** Use the %%func%% when fetching URIs using %%scheme%%.@@ -37786,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 (Hu)+ if (Wu)throw new Error("gateways locked");- fl[e] = t;+ Al[e] = t;}/*** Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.@@ -37799,9 +37808,9 @@ class Gi {* throws.*/static registerGetUrl(e) {- if (Hu)+ if (Wu)throw new Error("gateways locked");- $g = e;+ nm = e;}/*** Creates a getUrl function that fetches content from HTTP and@@ -37815,7 +37824,7 @@ class Gi {* content.*/static createGetUrlFunc(e) {- return ab(e);+ return ub(e);}/*** Creates a function that can "fetch" data URIs.@@ -37827,7 +37836,7 @@ class Gi {* be useful in a wrapper to perfom custom data URI functionality.*/static createDataGateway() {- return ob;+ return db;}/*** Creates a function that will fetch IPFS (unvalidated) from@@ -37837,7 +37846,7 @@ class Gi {* ``"https:/\/gateway.ipfs.io/ipfs/"``.*/static createIpfsGatewayFunc(e) {- return cb(e);+ return fb(e);}}class Vs {@@ -37848,7 +37857,7 @@ class Vs {#s;#a;toString() {- return `<FetchResponse status=${this.statusCode} body=${this.#i ? Se(this.#i) : "null"}>`;+ return `<FetchResponse status=${this.statusCode} body=${this.#i ? Ie(this.#i) : "null"}>`;}/*** The response status code.@@ -37882,7 +37891,7 @@ class Vs {*/get bodyText() {try {- return this.#i == null ? "" : $l(this.#i);+ return this.#i == null ? "" : th(this.#i);} catch {ge(!1, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", {operation: "bodyText",@@ -37982,7 +37991,7 @@ class Vs {this.request && (n = this.request.url);let s = null;try {- this.#i && (s = $l(this.#i));+ this.#i && (s = th(this.#i));} catch {}ge(!1, e, "SERVER_ERROR", {@@ -37997,31 +38006,31 @@ class Vs {});}}-function em() {+function im() {return (/* @__PURE__ */ new Date()).getTime();}-function MF(i) {+function OF(i) {return gs(i.replace(/%([0-9a-f][0-9a-f])/gi, (e, t) => String.fromCharCode(parseInt(t, 16))));}-function BF(i) {+function QF(i) {return new Promise((e) => setTimeout(e, i));}-function TF(i) {+function GF(i) {let e = i.toString(16);for (; e.length < 2; )e = "0" + e;return "0x" + e;}-function tm(i, e, t) {+function sm(i, e, t) {let n = 0;for (let s = 0; s < t; s++)n = n * 256 + i[e + s];return n;}-function nm(i, e, t, n) {+function rm(i, e, t, n) {const s = [];for (; t < e + 1 + n; ) {- const r = hb(i, t);+ const r = Ab(i, t);s.push(r.result), t += r.consumed, ge(t <= e + 1 + n, "child data too short", "BUFFER_OVERRUN", {buffer: i,length: n,@@ -38030,7 +38039,7 @@ function nm(i, e, t, n) {}return { consumed: 1 + n, result: s };}-function hb(i, e) {+function Ab(i, e) {ge(i.length !== 0, "data too short", "BUFFER_OVERRUN", {buffer: i,length: 0,@@ -38046,44 +38055,44 @@ function hb(i, e) {if (i[e] >= 248) {const n = i[e] - 247;t(e + 1 + n);- const s = tm(i, e + 1, n);- return t(e + 1 + n + s), nm(i, e, e + 1 + n, n + s);+ const s = sm(i, e + 1, n);+ return t(e + 1 + n + s), rm(i, e, e + 1 + n, n + s);} else if (i[e] >= 192) {const n = i[e] - 192;- return t(e + 1 + n), nm(i, e, e + 1, n);+ return t(e + 1 + n), rm(i, e, e + 1, n);} else if (i[e] >= 184) {const n = i[e] - 183;t(e + 1 + n);- const s = tm(i, e + 1, n);+ const s = sm(i, e + 1, n);t(e + 1 + n + s);- const r = Se(i.slice(e + 1 + n, e + 1 + n + s));+ const r = Ie(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 = Se(i.slice(e + 1, e + 1 + n));+ const s = Ie(i.slice(e + 1, e + 1 + n));return { consumed: 1 + n, result: s };}- return { consumed: 1, result: TF(i[e]) };+ return { consumed: 1, result: GF(i[e]) };}-function pc(i) {- const e = dt(i, "data"), t = hb(e, 0);+function gc(i) {+ const e = dt(i, "data"), t = Ab(e, 0);return V(t.consumed === e.length, "unexpected junk after rlp payload", "data", i), t.result;}-function im(i) {+function am(i) {const e = [];for (; i; )e.unshift(i & 255), i >>= 8;return e;}-function ub(i) {+function gb(i) {if (Array.isArray(i)) {let n = [];if (i.forEach(function(r) {- n = n.concat(ub(r));+ n = n.concat(gb(r));}), n.length <= 55)return n.unshift(192 + n.length), n;- const s = im(n.length);+ const s = am(n.length);return s.unshift(247 + s.length), s.concat(n);}const e = Array.prototype.slice.call(dt(i, "object"));@@ -38091,31 +38100,31 @@ function ub(i) {return e;if (e.length <= 55)return e.unshift(128 + e.length), e;- const t = im(e.length);+ const t = am(e.length);return t.unshift(183 + t.length), t.concat(e);}-const sm = "0123456789abcdef";+const om = "0123456789abcdef";function ms(i) {let e = "0x";- for (const t of ub(i))- e += sm[t >> 4], e += sm[t & 15];+ for (const t of gb(i))+ e += om[t >> 4], e += om[t & 15];return e;}-const Gn = 32, of = new Uint8Array(Gn), RF = ["then"], Al = {}, db = /* @__PURE__ */ new WeakMap();-function Ar(i) {- return db.get(i);+const Gn = 32, hf = new Uint8Array(Gn), HF = ["then"], ml = {}, mb = /* @__PURE__ */ new WeakMap();+function gr(i) {+ return mb.get(i);}-function rm(i, e) {- db.set(i, e);+function cm(i, e) {+ mb.set(i, e);}-function mo(i, e) {+function xo(i, e) {const t = new Error(`deferred error during ABI decoding triggered accessing ${i}`);throw t.error = e, t;}-function cf(i, e, t) {- return i.indexOf(null) >= 0 ? e.map((n, s) => n instanceof ds ? cf(Ar(n), n, t) : n) : i.reduce((n, s, r) => {+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) => {let a = e.getValue(s);- return s in n || (t && a instanceof ds && (a = cf(Ar(a), a, t)), n[s] = a), n;+ return s in n || (t && a instanceof ds && (a = uf(gr(a), a, t)), n[s] = a), n;}, {});}class ds extends Array {@@ -38129,11 +38138,11 @@ class ds extends Array {constructor(...e) {const t = e[0];let n = e[1], s = (e[2] || []).slice(), r = !0;- t !== Al && (n = e, s = [], r = !1), super(n.length), n.forEach((c, l) => {+ t !== ml && (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 (rm(this, Object.freeze(n.map((c, l) => {+ if (cm(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)@@ -38147,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 && mo(`index ${d}`, f), f;+ return f instanceof Error && xo(`index ${d}`, f), f;}- if (RF.indexOf(l) >= 0)+ if (HF.indexOf(l) >= 0)return Reflect.get(c, l, h);const u = c[l];if (u instanceof Function)@@ -38162,7 +38171,7 @@ class ds extends Array {return Reflect.get(c, l, h);}});- return rm(o, Ar(this)), o;+ return cm(o, gr(this)), o;}/*** Returns the Result as a normal Array. If %%deep%%, any children@@ -38174,7 +38183,7 @@ class ds extends Array {toArray(e) {const t = [];return this.forEach((n, s) => {- n instanceof Error && mo(`index ${s}`, n), e && n instanceof ds && (n = n.toArray(e)), t.push(n);+ n instanceof Error && xo(`index ${s}`, n), e && n instanceof ds && (n = n.toArray(e)), t.push(n);}), t;}/**@@ -38186,31 +38195,31 @@ class ds extends Array {* any outstanding deferred errors.*/toObject(e) {- const t = Ar(this);+ const t = gr(this);return t.reduce((n, s, r) => (ge(s != null, `value at index ${r} unnamed`, "UNSUPPORTED_OPERATION", {operation: "toObject()"- }), cf(t, this, e)), {});+ }), uf(t, this, e)), {});}/*** @_ignore*/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 = Ar(this), s = [], r = [];+ const n = gr(this), s = [], r = [];for (let a = e; a < t; a++)s.push(this[a]), r.push(n[a]);- return new ds(Al, s, r);+ return new ds(ml, s, r);}/*** @_ignore*/filter(e, t) {- const n = Ar(this), s = [], r = [];+ const n = gr(this), s = [], r = [];for (let a = 0; a < this.length; a++) {const o = this[a];- o instanceof Error && mo(`index ${a}`, o), e.call(t, o, a, this) && (s.push(o), r.push(n[a]));+ o instanceof Error && xo(`index ${a}`, o), e.call(t, o, a, this) && (s.push(o), r.push(n[a]));}- return new ds(Al, s, r);+ return new ds(ml, s, r);}/*** @_ignore@@ -38219,7 +38228,7 @@ class ds extends Array {const n = [];for (let s = 0; s < this.length; s++) {const r = this[s];- r instanceof Error && mo(`index ${s}`, r), n.push(e.call(t, r, s, this));+ r instanceof Error && xo(`index ${s}`, r), n.push(e.call(t, r, s, this));}return n;}@@ -38232,25 +38241,25 @@ class ds extends Array {* accessible by name.*/getValue(e) {- const t = Ar(this).indexOf(e);+ const t = gr(this).indexOf(e);if (t === -1)return;const n = this[t];- return n instanceof Error && mo(`property ${JSON.stringify(e)}`, n.error), n;+ return n instanceof Error && xo(`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(Al, e, t);+ return new ds(ml, e, t);}}-function am(i) {+function lm(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(Gt([of.slice(e.length % Gn), e]))), e;+ 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;}-class ys {+class _s {// The coder name:// - address, uint256, tuple, array, etc.name;@@ -38276,7 +38285,7 @@ class ys {V(!1, e, this.localName, t);}}-class lf {+class df {// An array of WordSize lengthed objects to concatenation#e;#t;@@ -38284,7 +38293,7 @@ class lf {this.#e = [], this.#t = 0;}get data() {- return Gt(this.#e);+ return Ht(this.#e);}get length() {return this.#t;@@ -38299,22 +38308,22 @@ class lf {writeBytes(e) {let t = On(e);const n = t.length % Gn;- return n && (t = On(Gt([t, of.slice(n)]))), this.#n(t);+ return n && (t = On(Ht([t, hf.slice(n)]))), this.#n(t);}// Numeric item; pad on the left *to* WordSizewriteValue(e) {- return this.#n(am(e));+ return this.#n(lm(e));}// Inserts a numeric place-holder, returning a callback that can// be used to asjust the value laterwriteUpdatableValue() {const e = this.#e.length;- return this.#e.push(of), this.#t += Gn, (t) => {- this.#e[e] = am(t);+ return this.#e.push(hf), this.#t += Gn, (t) => {+ this.#e[e] = lm(t);};}}-class pp {+class mp {// 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@@ -38329,7 +38338,7 @@ class pp {Ye(this, { allowLoose: !!t }), this.#e = On(e), this.#n = 0, this.#i = null, this.#s = n ?? 1024, this.#t = 0;}get data() {- return Se(this.#e);+ return Ie(this.#e);}get dataLength() {return this.#e.length;@@ -38363,7 +38372,7 @@ class pp {}// Create a sub-reader with the same underlying data, but offsetsubReader(e) {- const t = new pp(this.#e.slice(this.#t + e), this.allowLoose, this.#s);+ const t = new mp(this.#e.slice(this.#t + e), this.allowLoose, this.#s);return t.#i = this, t;}// Read bytes@@ -38373,81 +38382,81 @@ class pp {}// Read a numeric valuesreadValue() {- return fp(this.readBytes(Gn));+ return gp(this.readBytes(Gn));}readIndex() {- return pF(this.readBytes(Gn));+ return CF(this.readBytes(Gn));}}-function eh(i) {+function nh(i) {if (!Number.isSafeInteger(i) || i < 0)throw new Error(`Wrong positive integer: ${i}`);}-function Ap(i, ...e) {+function xp(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 FF(i) {+function zF(i) {if (typeof i != "function" || typeof i.create != "function")throw new Error("Hash should be wrapped by utils.wrapConstructor");- eh(i.outputLen), eh(i.blockLen);+ nh(i.outputLen), nh(i.blockLen);}-function ka(i, e = !0) {+function Ua(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 fb(i, e) {- Ap(i);+function xb(i, e) {+ xp(i);const t = e.outputLen;if (i.length < t)throw new Error(`digestInto() expects output buffer of length at least ${t}`);}-const zu = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;-const pb = (i) => i instanceof Uint8Array, DF = (i) => new Uint32Array(i.buffer, i.byteOffset, Math.floor(i.byteLength / 4)), Vu = (i) => new DataView(i.buffer, i.byteOffset, i.byteLength), Li = (i, e) => i << 32 - e | i >>> e, NF = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;-if (!NF)+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)throw new Error("Non little-endian hardware is not supported");-function LF(i) {+function qF(i) {if (typeof i != "string")throw new Error(`utf8ToBytes expected string, got ${typeof i}`);return new Uint8Array(new TextEncoder().encode(i));}-function vh(i) {- if (typeof i == "string" && (i = LF(i)), !pb(i))+function Ih(i) {+ if (typeof i == "string" && (i = qF(i)), !bb(i))throw new Error(`expected Uint8Array, got ${typeof i}`);return i;}-function PF(...i) {+function KF(...i) {const e = new Uint8Array(i.reduce((n, s) => n + s.length, 0));let t = 0;return i.forEach((n) => {- if (!pb(n))+ if (!bb(n))throw new Error("Uint8Array expected");e.set(n, t), t += n.length;}), e;}-class gp {+class bp {// Safe version that clones internal stateclone() {return this._cloneInto();}}-function mp(i) {- const e = (n) => i().update(vh(n)).digest(), t = i();+function Ep(i) {+ const e = (n) => i().update(Ih(n)).digest(), t = i();return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => i(), e;}-function kF(i = 32) {- if (zu && typeof zu.getRandomValues == "function")- return zu.getRandomValues(new Uint8Array(i));+function jF(i = 32) {+ if (qu && typeof qu.getRandomValues == "function")+ return qu.getRandomValues(new Uint8Array(i));throw new Error("crypto.getRandomValues must be defined");}-class Ab extends gp {+class Eb extends bp {constructor(e, t) {- super(), this.finished = !1, this.destroyed = !1, FF(e);- const n = vh(t);+ super(), this.finished = !1, this.destroyed = !1, zF(e);+ const n = Ih(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;@@ -38461,10 +38470,10 @@ class Ab extends gp {this.oHash.update(r), r.fill(0);}update(e) {- return ka(this), this.iHash.update(e), this;+ return Ua(this), this.iHash.update(e), this;}digestInto(e) {- ka(this), Ap(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();+ Ua(this), xp(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);@@ -38479,27 +38488,27 @@ class Ab extends gp {this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();}}-const gb = (i, e, t) => new Ab(i, e).update(t).digest();-gb.create = (i, e) => new Ab(i, e);-function UF(i, e, t, n) {+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) {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 mb extends gp {+class _b extends bp {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 = Vu(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 = Ku(this.buffer);}update(e) {- ka(this);+ Ua(this);const { view: t, buffer: n, blockLen: s } = this;- e = vh(e);+ e = Ih(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 = Vu(e);+ const c = Ku(e);for (; s <= r - a; a += s)this.process(c, a);continue;@@ -38509,14 +38518,14 @@ class mb extends gp {return this.length += e.length, this.roundClean(), this;}digestInto(e) {- ka(this), fb(e, this), this.finished = !0;+ Ua(this), xb(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;- UF(n, s - 8, BigInt(this.length * 8), r), this.process(n, 0);- const o = Vu(e), c = this.outputLen;+ XF(n, s - 8, BigInt(this.length * 8), r), this.process(n, 0);+ const o = Ku(e), c = this.outputLen;if (c % 4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l = c / 4, h = this.get();@@ -38537,7 +38546,7 @@ class mb extends gp {return e.length = s, e.pos = o, e.finished = r, e.destroyed = a, s % t && e.buffer.set(n), e;}}-const OF = (i, e, t) => i & e ^ ~i & t, QF = (i, e, t) => i & e ^ i & t ^ e & t, GF = /* @__PURE__ */ new Uint32Array([+const YF = (i, e, t) => i & e ^ ~i & t, JF = (i, e, t) => i & e ^ i & t ^ e & t, ZF = /* @__PURE__ */ new Uint32Array([1116352408,1899447441,3049323471,@@ -38602,7 +38611,7 @@ const OF = (i, e, t) => i & e ^ ~i & t, QF = (i, e, t) => i & e ^ i & t ^ e & t,2756734187,3204031479,3329325298-]), Ds = /* @__PURE__ */ new Uint32Array([+]), Ns = /* @__PURE__ */ new Uint32Array([1779033703,3144134277,1013904242,@@ -38611,10 +38620,10 @@ const OF = (i, e, t) => i & e ^ ~i & t, QF = (i, e, t) => i & e ^ i & t ^ e & t,2600822924,528734635,1541459225-]), Ns = /* @__PURE__ */ new Uint32Array(64);-class HF extends mb {+]), Ds = /* @__PURE__ */ new Uint32Array(64);+class $F extends _b {constructor() {- super(64, 32, 8, !1), this.A = Ds[0] | 0, this.B = Ds[1] | 0, this.C = Ds[2] | 0, this.D = Ds[3] | 0, this.E = Ds[4] | 0, this.F = Ds[5] | 0, this.G = Ds[6] | 0, this.H = Ds[7] | 0;+ 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;}get() {const { A: e, B: t, C: n, D: s, E: r, F: a, G: o, H: c } = this;@@ -38626,66 +38635,66 @@ class HF extends mb {}process(e, t) {for (let u = 0; u < 16; u++, t += 4)- Ns[u] = e.getUint32(t, !1);+ Ds[u] = e.getUint32(t, !1);for (let u = 16; u < 64; u++) {- const d = Ns[u - 15], f = Ns[u - 2], p = Li(d, 7) ^ Li(d, 18) ^ d >>> 3, m = Li(f, 17) ^ Li(f, 19) ^ f >>> 10;- Ns[u] = m + Ns[u - 7] + p + Ns[u - 16] | 0;+ 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;+ 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 + OF(o, c, l) + GF[u] + Ns[u] | 0, m = (Li(n, 2) ^ Li(n, 13) ^ Li(n, 22)) + QF(n, s, r) | 0;+ 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;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() {- Ns.fill(0);+ Ds.fill(0);}destroy() {this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);}}-const xb = /* @__PURE__ */ mp(() => new HF()), gl = /* @__PURE__ */ BigInt(2 ** 32 - 1), hf = /* @__PURE__ */ BigInt(32);-function bb(i, e = !1) {- return e ? { h: Number(i & gl), l: Number(i >> hf & gl) } : { h: Number(i >> hf & gl) | 0, l: Number(i & gl) | 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 };}-function Eb(i, e = !1) {+function Cb(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 } = bb(i[s], e);+ const { h: r, l: a } = vb(i[s], e);[t[s], n[s]] = [r, a];}return [t, n];}-const zF = (i, e) => BigInt(i >>> 0) << hf | BigInt(e >>> 0), VF = (i, e, t) => i >>> t, WF = (i, e, t) => i << 32 - t | e >>> t, qF = (i, e, t) => i >>> t | e << 32 - t, KF = (i, e, t) => i << 32 - t | e >>> t, jF = (i, e, t) => i << 64 - t | e >>> t - 32, XF = (i, e, t) => i >>> t - 32 | e << 64 - t, YF = (i, e) => e, JF = (i, e) => i, _b = (i, e, t) => i << t | e >>> 32 - t, yb = (i, e, t) => e << t | i >>> 32 - t, wb = (i, e, t) => e << t - 32 | i >>> 64 - t, vb = (i, e, t) => i << t - 32 | e >>> 64 - t;-function ZF(i, e, 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 s = (e >>> 0) + (n >>> 0);return { h: i + t + (s / 2 ** 32 | 0) | 0, l: s | 0 };}-const $F = (i, e, t) => (i >>> 0) + (e >>> 0) + (t >>> 0), eD = (i, e, t, n) => e + t + n + (i / 2 ** 32 | 0) | 0, tD = (i, e, t, n) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0), nD = (i, e, t, n, s) => e + t + n + s + (i / 2 ** 32 | 0) | 0, iD = (i, e, t, n, s) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0) + (s >>> 0), sD = (i, e, t, n, s, r) => e + t + n + s + r + (i / 2 ** 32 | 0) | 0, ct = {- fromBig: bb,- split: Eb,- toBig: zF,- shrSH: VF,- shrSL: WF,- rotrSH: qF,- rotrSL: KF,- rotrBH: jF,- rotrBL: XF,- rotr32H: YF,- rotr32L: JF,- rotlSH: _b,- rotlSL: yb,- rotlBH: wb,- rotlBL: vb,- add: ZF,- add3L: $F,- add3H: eD,- add4L: tD,- add4H: nD,- add5H: sD,- add5L: iD-}, [rD, aD] = ct.split([+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(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f",@@ -38767,7 +38776,7 @@ const $F = (i, e, t) => (i >>> 0) + (e >>> 0) + (t >>> 0), eD = (i, e, t, n) =>"0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((i) => BigInt(i))), Ls = /* @__PURE__ */ new Uint32Array(80), Ps = /* @__PURE__ */ new Uint32Array(80);-class oD extends mb {+class xN extends _b {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;}@@ -38784,17 +38793,17 @@ class oD extends mb {for (let x = 0; x < 16; x++, t += 4)Ls[x] = e.getUint32(t), Ps[x] = e.getUint32(t += 4);for (let x = 16; x < 80; x++) {- const E = Ls[x - 15] | 0, I = Ps[x - 15] | 0, w = ct.rotrSH(E, I, 1) ^ ct.rotrSH(E, I, 8) ^ ct.shrSH(E, I, 7), S = ct.rotrSL(E, I, 1) ^ ct.rotrSL(E, I, 8) ^ ct.shrSL(E, I, 7), T = Ls[x - 2] | 0, C = Ps[x - 2] | 0, v = ct.rotrSH(T, C, 19) ^ ct.rotrBH(T, C, 61) ^ ct.shrSH(T, C, 6), F = ct.rotrSL(T, C, 19) ^ ct.rotrBL(T, C, 61) ^ ct.shrSL(T, C, 6), K = ct.add4L(S, F, Ps[x - 7], Ps[x - 16]), q = ct.add4H(K, w, v, Ls[x - 7], Ls[x - 16]);+ const E = Ls[x - 15] | 0, S = Ps[x - 15] | 0, w = ct.rotrSH(E, S, 1) ^ ct.rotrSH(E, S, 8) ^ ct.shrSH(E, S, 7), I = ct.rotrSL(E, S, 1) ^ ct.rotrSL(E, S, 8) ^ ct.shrSL(E, S, 7), T = Ls[x - 2] | 0, C = Ps[x - 2] | 0, v = ct.rotrSH(T, C, 19) ^ ct.rotrBH(T, C, 61) ^ ct.shrSH(T, C, 6), F = ct.rotrSL(T, C, 19) ^ ct.rotrBL(T, C, 61) ^ ct.shrSL(T, C, 6), K = ct.add4L(I, F, Ps[x - 7], Ps[x - 16]), q = ct.add4H(K, w, v, Ls[x - 7], Ls[x - 16]);Ls[x] = q | 0, Ps[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: y } = this;+ 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), I = ct.rotrSL(u, d, 14) ^ ct.rotrSL(u, d, 18) ^ ct.rotrBL(u, d, 41), w = u & f ^ ~u & m, S = d & p ^ ~d & g, T = ct.add5L(y, I, S, aD[x], Ps[x]), C = ct.add5H(T, A, E, w, rD[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, y = 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 N = ct.add3L(v, K, $);- n = ct.add3H(N, C, F, q), s = N | 0;+ 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;+ 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;}- ({ h: n, l: s } = ct.add(this.Ah | 0, this.Al | 0, n | 0, s | 0)), { h: r, l: a } = ct.add(this.Bh | 0, this.Bl | 0, r | 0, a | 0), { h: o, l: c } = ct.add(this.Ch | 0, this.Cl | 0, o | 0, c | 0), { h: l, l: h } = ct.add(this.Dh | 0, this.Dl | 0, l | 0, h | 0), { h: u, l: d } = ct.add(this.Eh | 0, this.El | 0, u | 0, d | 0), { h: f, l: p } = ct.add(this.Fh | 0, this.Fl | 0, f | 0, p | 0), { h: m, l: g } = ct.add(this.Gh | 0, this.Gl | 0, m | 0, g | 0), { h: A, l: y } = ct.add(this.Hh | 0, this.Hl | 0, A | 0, y | 0), this.set(n, s, r, a, o, c, l, h, u, d, f, p, m, g, A, y);+ ({ h: n, l: s } = ct.add(this.Ah | 0, this.Al | 0, n | 0, s | 0)), { h: r, l: a } = ct.add(this.Bh | 0, this.Bl | 0, r | 0, a | 0), { h: o, l: c } = ct.add(this.Ch | 0, this.Cl | 0, o | 0, c | 0), { h: l, l: h } = ct.add(this.Dh | 0, this.Dl | 0, l | 0, h | 0), { h: u, l: d } = ct.add(this.Eh | 0, this.El | 0, u | 0, d | 0), { h: f, l: p } = ct.add(this.Fh | 0, this.Fl | 0, f | 0, p | 0), { h: m, l: g } = ct.add(this.Gh | 0, this.Gl | 0, m | 0, g | 0), { h: A, l: _ } = ct.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() {Ls.fill(0), Ps.fill(0);@@ -38803,8 +38812,8 @@ class oD extends mb {this.buffer.fill(0), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);}}-const cD = /* @__PURE__ */ mp(() => new oD());-function lD() {+const bN = /* @__PURE__ */ Ep(() => new xN());+function EN() {if (typeof self < "u")return self;if (typeof window < "u")@@ -38813,39 +38822,39 @@ function lD() {return global;throw new Error("unable to locate global object");}-const om = lD();-om.crypto || om.msCrypto;-function hD(i) {+const hm = EN();+hm.crypto || hm.msCrypto;+function yN(i) {switch (i) {case "sha256":- return xb.create();+ return wb.create();case "sha512":- return cD.create();+ return bN.create();}V(!1, "invalid hashing algorithm name", "algorithm", i);}-const [Cb, Sb, Ib] = [[], [], []], uD = /* @__PURE__ */ BigInt(0), xo = /* @__PURE__ */ BigInt(1), dD = /* @__PURE__ */ BigInt(2), fD = /* @__PURE__ */ BigInt(7), pD = /* @__PURE__ */ BigInt(256), AD = /* @__PURE__ */ BigInt(113);-for (let i = 0, e = xo, t = 1, n = 0; i < 24; i++) {- [t, n] = [n, (2 * t + 3 * n) % 5], Cb.push(2 * (5 * n + t)), Sb.push((i + 1) * (i + 2) / 2 % 64);- let s = uD;+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;for (let r = 0; r < 7; r++)- e = (e << xo ^ (e >> fD) * AD) % pD, e & dD && (s ^= xo << (xo << /* @__PURE__ */ BigInt(r)) - xo);- Ib.push(s);+ e = (e << bo ^ (e >> vN) * IN) % CN, e & wN && (s ^= bo << (bo << /* @__PURE__ */ BigInt(r)) - bo);+ Fb.push(s);}-const [gD, mD] = /* @__PURE__ */ Eb(Ib, !0), cm = (i, e, t) => t > 32 ? wb(i, e, t) : _b(i, e, t), lm = (i, e, t) => t > 32 ? vb(i, e, t) : yb(i, e, t);-function xD(i, e = 24) {+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 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 = cm(l, h, 1) ^ t[o], d = lm(l, h, 1) ^ t[o + 1];+ 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];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 = Sb[a], c = cm(s, r, o), l = lm(s, r, o), h = Cb[a];+ const o = Rb[a], c = um(s, r, o), l = dm(s, r, o), h = Tb[a];s = i[h], r = i[h + 1], i[h] = c, i[h + 1] = l;}for (let a = 0; a < 50; a += 10) {@@ -38854,24 +38863,24 @@ function xD(i, e = 24) {for (let o = 0; o < 10; o++)i[a + o] ^= ~t[(o + 2) % 10] & t[(o + 4) % 10];}- i[0] ^= gD[n], i[1] ^= mD[n];+ i[0] ^= SN[n], i[1] ^= MN[n];}t.fill(0);}-class xp extends gp {+class yp extends bp {// 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, eh(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, nh(n), 0 >= this.blockLen || this.blockLen >= 200)throw new Error("Sha3 supports only keccak-f1600 function");- this.state = new Uint8Array(200), this.state32 = DF(this.state);+ this.state = new Uint8Array(200), this.state32 = VF(this.state);}keccak() {- xD(this.state32, this.rounds), this.posOut = 0, this.pos = 0;+ BN(this.state32, this.rounds), this.posOut = 0, this.pos = 0;}update(e) {- ka(this);+ Ua(this);const { blockLen: t, state: n } = this;- e = vh(e);+ e = Ih(e);const s = e.length;for (let r = 0; r < s; ) {const a = Math.min(t - this.pos, s - r);@@ -38889,7 +38898,7 @@ class xp extends gp {e[n] ^= t, (t & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();}writeInto(e) {- ka(this, !1), Ap(e), this.finish();+ Ua(this, !1), xp(e), this.finish();const t = this.state, { blockLen: n } = this;for (let s = 0, r = e.length; s < r; ) {this.posOut >= n && this.keccak();@@ -38904,10 +38913,10 @@ class xp extends gp {return this.writeInto(e);}xof(e) {- return eh(e), this.xofInto(new Uint8Array(e));+ return nh(e), this.xofInto(new Uint8Array(e));}digestInto(e) {- if (fb(e, this), this.finished)+ if (xb(e, this), this.finished)throw new Error("digest() was already called");return this.writeInto(e), this.destroy(), e;}@@ -38919,64 +38928,64 @@ class xp extends gp {}_cloneInto(e) {const { blockLen: t, suffix: n, outputLen: s, rounds: r, enableXOF: a } = this;- return e || (e = new xp(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 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;}}-const bD = (i, e, t) => mp(() => new xp(e, i, t)), ED = /* @__PURE__ */ bD(1, 136, 256 / 8);-let Mb = !1;-const Bb = function(i) {- return ED(i);+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);};-let Tb = Bb;+let Lb = Db;function sn(i) {const e = dt(i, "data");- return Se(Tb(e));+ return Ie(Lb(e));}-sn._ = Bb;+sn._ = Db;sn.lock = function() {- Mb = !0;+ Nb = !0;};sn.register = function(i) {- if (Mb)+ if (Nb)throw new TypeError("keccak256 is locked");- Tb = i;+ Lb = i;};Object.freeze(sn);-const Rb = function(i) {- return hD("sha256").update(i).digest();+const Pb = function(i) {+ return yN("sha256").update(i).digest();};-let Fb = Rb, Db = !1;-function Ya(i) {+let kb = Pb, Ub = !1;+function Ja(i) {const e = dt(i, "data");- return Se(Fb(e));+ return Ie(kb(e));}-Ya._ = Rb;-Ya.lock = function() {- Db = !0;+Ja._ = Pb;+Ja.lock = function() {+ Ub = !0;};-Ya.register = function(i) {- if (Db)+Ja.register = function(i) {+ if (Ub)throw new Error("sha256 is locked");- Fb = i;+ kb = i;};-Object.freeze(Ya);-Object.freeze(Ya);+Object.freeze(Ja);+Object.freeze(Ja);BigInt(0);-const _D = BigInt(1), yD = BigInt(2), Ch = (i) => i instanceof Uint8Array, wD = /* @__PURE__ */ Array.from({ length: 256 }, (i, e) => e.toString(16).padStart(2, "0"));-function Ua(i) {- if (!Ch(i))+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))throw new Error("Uint8Array expected");let e = "";for (let t = 0; t < i.length; t++)- e += wD[i[t]];+ e += DN[i[t]];return e;}-function bp(i) {+function _p(i) {if (typeof i != "string")throw new Error("hex string expected, got " + typeof i);return BigInt(i === "" ? "0" : `0x${i}`);}-function ec(i) {+function nc(i) {if (typeof i != "string")throw new Error("hex string expected, got " + typeof i);const e = i.length;@@ -38991,29 +39000,29 @@ function ec(i) {}return t;}-function vr(i) {- return bp(Ua(i));+function Ir(i) {+ return _p(Oa(i));}-function Ep(i) {- if (!Ch(i))+function wp(i) {+ if (!Sh(i))throw new Error("Uint8Array expected");- return bp(Ua(Uint8Array.from(i).reverse()));+ return _p(Oa(Uint8Array.from(i).reverse()));}-function Oa(i, e) {- return ec(i.toString(16).padStart(e * 2, "0"));+function Qa(i, e) {+ return nc(i.toString(16).padStart(e * 2, "0"));}-function _p(i, e) {- return Oa(i, e).reverse();+function vp(i, e) {+ return Qa(i, e).reverse();}-function _i(i, e, t) {+function yi(i, e, t) {let n;if (typeof e == "string")try {- n = ec(e);+ n = nc(e);} catch (r) {throw new Error(`${i} must be valid hex string, got "${e}". Cause: ${r}`);}- else if (Ch(e))+ else if (Sh(e))n = Uint8Array.from(e);elsethrow new Error(`${i} must be hex string or Uint8Array`);@@ -39022,28 +39031,28 @@ function _i(i, e, t) {throw new Error(`${i} expected ${t} bytes, got ${s}`);return n;}-function tc(...i) {+function ic(...i) {const e = new Uint8Array(i.reduce((n, s) => n + s.length, 0));let t = 0;return i.forEach((n) => {- if (!Ch(n))+ if (!Sh(n))throw new Error("Uint8Array expected");e.set(n, t), t += n.length;}), e;}-const yp = (i) => (yD << BigInt(i - 1)) - _D, Wu = (i) => new Uint8Array(i), hm = (i) => Uint8Array.from(i);-function Nb(i, e, t) {+const Cp = (i) => (NN << BigInt(i - 1)) - FN, ju = (i) => new Uint8Array(i), fm = (i) => Uint8Array.from(i);+function Ob(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 = Wu(i), s = Wu(i), r = 0;+ let n = ju(i), s = ju(i), r = 0;const a = () => {n.fill(1), s.fill(0), r = 0;- }, o = (...u) => t(s, n, ...u), c = (u = Wu()) => {- s = o(hm([0]), u), n = o(), u.length !== 0 && (s = o(hm([1]), u), n = o());+ }, 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());}, l = () => {if (r++ >= 1e3)throw new Error("drbg: tried 1000 values");@@ -39054,7 +39063,7 @@ function Nb(i, e, t) {const f = n.slice();d.push(f), u += n.length;}- return tc(...d);+ return ic(...d);};return (u, d) => {a(), c(u);@@ -39064,7 +39073,7 @@ function Nb(i, e, t) {return a(), f;};}-const vD = {+const LN = {bigint: (i) => typeof i == "bigint",function: (i) => typeof i == "function",boolean: (i) => typeof i == "boolean",@@ -39075,9 +39084,9 @@ const vD = {field: (i, e) => e.Fp.isValid(i),hash: (i) => typeof i == "function" && Number.isSafeInteger(i.outputLen)};-function Ac(i, e, t = {}) {+function mc(i, e, t = {}) {const n = (s, r, a) => {- const o = vD[r];+ const o = LN[r];if (typeof o != "function")throw new Error(`Invalid validator "${r}", expected function`);const c = i[s];@@ -39090,29 +39099,29 @@ function Ac(i, e, t = {}) {n(s, r, !0);return i;}-const CD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({+const PN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({__proto__: null,- bitMask: yp,- bytesToHex: Ua,- bytesToNumberBE: vr,- bytesToNumberLE: Ep,- concatBytes: tc,- createHmacDrbg: Nb,- ensureBytes: _i,- hexToBytes: ec,- hexToNumber: bp,- numberToBytesBE: Oa,- numberToBytesLE: _p,- validateObject: Ac+ bitMask: Cp,+ bytesToHex: Oa,+ bytesToNumberBE: Ir,+ bytesToNumberLE: wp,+ concatBytes: ic,+ createHmacDrbg: Ob,+ ensureBytes: yi,+ hexToBytes: nc,+ hexToNumber: _p,+ numberToBytesBE: Qa,+ numberToBytesLE: vp,+ validateObject: mc}, Symbol.toStringTag, { value: "Module" }));-const wn = BigInt(0), tn = BigInt(1), gr = BigInt(2), SD = BigInt(3), uf = BigInt(4), um = BigInt(5), dm = BigInt(8);+const wn = BigInt(0), tn = BigInt(1), mr = BigInt(2), kN = BigInt(3), pf = BigInt(4), pm = BigInt(5), Am = BigInt(8);BigInt(9);BigInt(16);function Kn(i, e) {const t = i % e;return t >= wn ? t : e + t;}-function ID(i, e, t) {+function UN(i, e, t) {if (t <= wn || e < wn)throw new Error("Expected power/modulo > 0");if (t === tn)@@ -39128,7 +39137,7 @@ function si(i, e, t) {n *= n, n %= t;return n;}-function df(i, e) {+function Af(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;@@ -39140,15 +39149,15 @@ function df(i, e) {throw new Error("invert: does not exist");return Kn(s, e);}-function MD(i) {- const e = (i - tn) / gr;+function ON(i) {+ const e = (i - tn) / mr;let t, n, s;- for (t = i - tn, n = 0; t % gr === wn; t /= gr, n++)+ for (t = i - tn, n = 0; t % mr === wn; t /= mr, n++);- for (s = gr; s < i && ID(s, e, i) !== i - tn; s++)+ for (s = mr; s < i && UN(s, e, i) !== i - tn; s++);if (n === 1) {- const a = (i + tn) / uf;+ const a = (i + tn) / pf;return function(c, l) {const h = c.pow(l, a);if (!c.eql(c.sqr(h), l))@@ -39156,7 +39165,7 @@ function MD(i) {return h;};}- const r = (t + tn) / gr;+ const r = (t + tn) / mr;return function(o, c) {if (o.pow(c, e) === o.neg(o.ONE))throw new Error("Cannot find square root");@@ -39173,9 +39182,9 @@ function MD(i) {return u;};}-function BD(i) {- if (i % uf === SD) {- const e = (i + tn) / uf;+function QN(i) {+ if (i % pf === kN) {+ const e = (i + tn) / pf;return function(n, s) {const r = n.pow(s, e);if (!n.eql(n.sqr(r), s))@@ -39183,18 +39192,18 @@ function BD(i) {return r;};}- if (i % dm === um) {- const e = (i - um) / dm;+ if (i % Am === pm) {+ const e = (i - pm) / Am;return function(n, s) {- const r = n.mul(s, gr), a = n.pow(r, e), o = n.mul(s, a), c = n.mul(n.mul(o, gr), a), l = n.mul(o, n.sub(c, n.ONE));+ 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))throw new Error("Cannot find square root");return l;};}- return MD(i);+ return ON(i);}-const TD = [+const GN = ["create","isValid","is0",@@ -39213,16 +39222,16 @@ const TD = ["mulN","sqrN"];-function RD(i) {+function HN(i) {const e = {ORDER: "bigint",MASK: "bigint",BYTES: "isSafeInteger",BITS: "isSafeInteger"- }, t = TD.reduce((n, s) => (n[s] = "function", n), e);- return Ac(i, t);+ }, t = GN.reduce((n, s) => (n[s] = "function", n), e);+ return mc(i, t);}-function FD(i, e, t) {+function zN(i, e, t) {if (t < wn)throw new Error("Expected power > 0");if (t === wn)@@ -39234,25 +39243,25 @@ function FD(i, e, t) {t & tn && (n = i.mul(n, s)), s = i.sqr(s), t >>= tn;return n;}-function DD(i, e) {+function VN(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 Lb(i, e) {+function Qb(i, e) {const t = e !== void 0 ? e : i.toString(2).length, n = Math.ceil(t / 8);return { nBitLength: t, nByteLength: n };}-function ND(i, e, t = !1, n = {}) {+function WN(i, e, t = !1, n = {}) {if (i <= wn)throw new Error(`Expected Field ORDER > 0, got ${i}`);- const { nBitLength: s, nByteLength: r } = Lb(i, e);+ const { nBitLength: s, nByteLength: r } = Qb(i, e);if (r > 2048)throw new Error("Field lengths over 2048 bytes are not supported");- const a = BD(i), o = Object.freeze({+ const a = QN(i), o = Object.freeze({ORDER: i,BITS: s,BYTES: r,- MASK: yp(s),+ MASK: Cp(s),ZERO: wn,ONE: tn,create: (c) => Kn(c, i),@@ -39269,47 +39278,47 @@ function ND(i, e, t = !1, n = {}) {add: (c, l) => Kn(c + l, i),sub: (c, l) => Kn(c - l, i),mul: (c, l) => Kn(c * l, i),- pow: (c, l) => FD(o, c, l),- div: (c, l) => Kn(c * df(l, i), i),+ pow: (c, l) => zN(o, c, l),+ div: (c, l) => Kn(c * Af(l, i), i),// Same as above, but doesn't normalizesqrN: (c) => c * c,addN: (c, l) => c + l,subN: (c, l) => c - l,mulN: (c, l) => c * l,- inv: (c) => df(c, i),+ inv: (c) => Af(c, i),sqrt: n.sqrt || ((c) => a(o, c)),- invertBatch: (c) => DD(o, c),+ invertBatch: (c) => VN(o, c),// TODO: do we really need constant cmov?// We don't have const-time bigints anyway, so probably will be not very usefulcmov: (c, l, h) => h ? l : c,- toBytes: (c) => t ? _p(c, r) : Oa(c, r),+ toBytes: (c) => t ? vp(c, r) : Qa(c, r),fromBytes: (c) => {if (c.length !== r)throw new Error(`Fp.fromBytes: expected ${r}, got ${c.length}`);- return t ? Ep(c) : vr(c);+ return t ? wp(c) : Ir(c);}});return Object.freeze(o);}-function Pb(i) {+function Gb(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 kb(i) {- const e = Pb(i);+function Hb(i) {+ const e = Gb(i);return e + Math.ceil(e / 2);}-function LD(i, e, t = !1) {- const n = i.length, s = Pb(e), r = kb(e);+function qN(i, e, t = !1) {+ const n = i.length, s = Gb(e), r = Hb(e);if (n < 16 || n < r || n > 1024)throw new Error(`expected ${r}-1024 bytes of input, got ${n}`);- const a = t ? vr(i) : Ep(i), o = Kn(a, e - tn) + tn;- return t ? _p(o, s) : Oa(o, s);+ const a = t ? Ir(i) : wp(i), o = Kn(a, e - tn) + tn;+ return t ? vp(o, s) : Qa(o, s);}-const PD = BigInt(0), qu = BigInt(1);-function kD(i, e) {+const KN = BigInt(0), Xu = BigInt(1);+function jN(i, e) {const t = (s, r) => {const a = r.negate();return s ? a : r;@@ -39322,8 +39331,8 @@ function kD(i, e) {// non-const time multiplication ladderunsafeLadder(s, r) {let a = i.ZERO, o = s;- for (; r > PD; )- r & qu && (a = a.add(o)), o = o.double(), r >>= qu;+ for (; r > KN; )+ r & Xu && (a = a.add(o)), o = o.double(), r >>= Xu;return a;},/**@@ -39361,9 +39370,9 @@ function kD(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 += qu);- const A = m, y = 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[y]));+ a >>= f, g > c && (g -= d, a += Xu);+ 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 };},@@ -39374,8 +39383,8 @@ function kD(i, e) {}};}-function Ub(i) {- return RD(i.Fp), Ac(i, {+function zb(i) {+ return HN(i.Fp), mc(i, {n: "bigint",h: "bigint",Gx: "field",@@ -39384,14 +39393,14 @@ function Ub(i) {nBitLength: "isSafeInteger",nByteLength: "isSafeInteger"}), Object.freeze({- ...Lb(i.n, i.nBitLength),+ ...Qb(i.n, i.nBitLength),...i,p: i.Fp.ORDER});}-function UD(i) {- const e = Ub(i);- Ac(e, {+function XN(i) {+ const e = zb(i);+ mc(e, {a: "field",b: "field"}, {@@ -39412,7 +39421,7 @@ function UD(i) {}return Object.freeze({ ...e });}-const { bytesToNumberBE: OD, hexToBytes: QD } = CD, Er = {+const { bytesToNumberBE: YN, hexToBytes: JN } = PN, _r = {// asn.1 DER encoding utilsErr: class extends Error {constructor(e = "") {@@ -39420,7 +39429,7 @@ const { bytesToNumberBE: OD, hexToBytes: QD } = CD, Er = {}},_parseInt(i) {- const { Err: e } = Er;+ const { Err: e } = _r;if (i.length < 2 || i[0] !== 2)throw new e("Invalid signature integer tag");const t = i[1], n = i.subarray(2, t + 2);@@ -39430,10 +39439,10 @@ const { bytesToNumberBE: OD, hexToBytes: QD } = CD, Er = {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: OD(n), l: i.subarray(t + 2) };+ return { d: YN(n), l: i.subarray(t + 2) };},toSig(i) {- const { Err: e } = Er, t = typeof i == "string" ? QD(i) : i;+ const { Err: e } = _r, t = typeof i == "string" ? JN(i) : i;if (!(t instanceof Uint8Array))throw new Error("ui8a expected");let n = t.length;@@ -39441,7 +39450,7 @@ const { bytesToNumberBE: OD, hexToBytes: QD } = CD, Er = {throw new e("Invalid signature tag");if (t[1] !== n - 2)throw new e("Invalid signature: incorrect length");- const { d: s, l: r } = Er._parseInt(t.subarray(2)), { d: a, l: o } = Er._parseInt(r);+ const { d: s, l: r } = _r._parseInt(t.subarray(2)), { d: a, l: o } = _r._parseInt(r);if (o.length)throw new e("Invalid signature: left bytes after parsing");return { r: s, s: a };@@ -39455,19 +39464,19 @@ const { bytesToNumberBE: OD, hexToBytes: QD } = CD, Er = {}}, rs = BigInt(0), ai = BigInt(1);BigInt(2);-const fm = BigInt(3);+const gm = BigInt(3);BigInt(4);-function GD(i) {- const e = UD(i), { Fp: t } = e, n = e.toBytes || ((p, m, g) => {+function ZN(i) {+ const e = XN(i), { Fp: t } = e, n = e.toBytes || ((p, m, g) => {const A = m.toAffine();- return tc(Uint8Array.from([4]), t.toBytes(A.x), t.toBytes(A.y));+ 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), y = t.mul(A, p);- return t.add(t.add(y, t.mul(p, m)), g);+ 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");@@ -39479,19 +39488,19 @@ function GD(i) {throw new Error("Expected valid bigint: 0 < bigint < curve.n");}function c(p) {- const { allowedPrivateKeyLengths: m, nByteLength: g, wrapPrivateKey: A, n: y } = e;+ const { allowedPrivateKeyLengths: m, nByteLength: g, wrapPrivateKey: A, n: _ } = e;if (m && typeof p != "bigint") {- if (p instanceof Uint8Array && (p = Ua(p)), typeof p != "string" || !m.includes(p.length))+ if (p instanceof Uint8Array && (p = Oa(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 : vr(_i("private key", p, g));+ x = typeof p == "bigint" ? p : Ir(yi("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, y)), o(x), x;+ return A && (x = Kn(x, _)), o(x), x;}const l = /* @__PURE__ */ new Map();function h(p) {@@ -39515,8 +39524,8 @@ function GD(i) {throw new Error("invalid affine point");if (m instanceof u)throw new Error("projective point not allowed");- const y = (x) => t.eql(x, t.ZERO);- return y(g) && y(A) ? u.ZERO : new u(g, A, t.ONE);+ const _ = (x) => t.eql(x, t.ZERO);+ return _(g) && _(A) ? u.ZERO : new u(g, A, t.ONE);}get x() {return this.toAffine().x;@@ -39532,14 +39541,14 @@ function GD(i) {*/static normalizeZ(m) {const g = t.invertBatch(m.map((A) => A.pz));- return m.map((A, y) => A.toAffine(g[y])).map(u.fromAffine);+ return m.map((A, _) => A.toAffine(g[_])).map(u.fromAffine);}/*** Converts hash string or Uint8Array to Point.* @param hex short/long ECDSA hex*/static fromHex(m) {- const g = u.fromAffine(s(_i("pointHex", m)));+ const g = u.fromAffine(s(yi("pointHex", m)));return g.assertValidity(), g;}// Multiplies generator point by privateKey.@@ -39560,8 +39569,8 @@ function GD(i) {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), y = r(m);- if (!t.eql(A, y))+ 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");@@ -39577,8 +39586,8 @@ function GD(i) {*/equals(m) {h(m);- const { px: g, py: A, pz: y } = this, { px: x, py: E, pz: I } = m, w = t.eql(t.mul(g, I), t.mul(x, y)), S = t.eql(t.mul(A, I), t.mul(E, y));- return w && S;+ 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;}/*** Flips point to one corresponding to (x, -y) in Affine coordinates.@@ -39591,9 +39600,9 @@ function GD(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, fm), { px: y, py: x, pz: E } = this;- let I = t.ZERO, w = t.ZERO, S = t.ZERO, T = t.mul(y, y), C = t.mul(x, x), v = t.mul(E, E), F = t.mul(y, x);- return F = t.add(F, F), S = t.mul(y, E), S = t.add(S, S), I = t.mul(m, S), w = t.mul(A, v), w = t.add(I, w), I = t.sub(C, w), w = t.add(C, w), w = t.mul(I, w), I = t.mul(F, I), S = t.mul(A, S), v = t.mul(m, v), F = t.sub(T, v), F = t.mul(m, F), F = t.add(F, S), S = t.add(T, T), T = t.add(S, 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), I = t.sub(I, T), S = t.mul(v, C), S = t.add(S, S), S = t.add(S, S), new u(I, w, S);+ const { a: m, b: g } = e, A = t.mul(g, gm), { 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);}// Renes-Costello-Batina exception-free addition formula.// There is 30% faster Jacobian formula, but it is not complete.@@ -39601,13 +39610,13 @@ function GD(i) {// Cost: 12M + 0S + 3*a + 3*b3 + 23add.add(m) {h(m);- const { px: g, py: A, pz: y } = this, { px: x, py: E, pz: I } = m;- let w = t.ZERO, S = t.ZERO, T = t.ZERO;- const C = e.a, v = t.mul(e.b, fm);- let F = t.mul(g, x), K = t.mul(A, E), q = t.mul(y, I), $ = t.add(g, A), N = t.add(x, E);- $ = t.mul($, N), N = t.add(F, K), $ = t.sub($, N), N = t.add(g, y);- let O = t.add(x, I);- return N = t.mul(N, O), O = t.add(F, q), N = t.sub(N, O), O = t.add(A, y), w = t.add(E, I), O = t.mul(O, w), w = t.add(K, q), O = t.sub(O, w), T = t.mul(C, N), w = t.mul(v, q), T = t.add(w, T), w = t.sub(K, T), T = t.add(K, T), S = t.mul(w, T), K = t.add(F, F), K = t.add(K, F), q = t.mul(C, q), N = t.mul(v, N), K = t.add(K, q), q = t.sub(F, q), q = t.mul(C, q), N = t.add(N, q), F = t.mul(K, N), S = t.add(S, F), F = t.mul(O, N), 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, S, T);+ 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);+ 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());@@ -39617,8 +39626,8 @@ function GD(i) {}wNAF(m) {return f.wNAFCached(this, l, m, (g) => {- const A = t.invertBatch(g.map((y) => y.pz));- return g.map((y, x) => y.toAffine(A[x])).map(u.fromAffine);+ const A = t.invertBatch(g.map((_) => _.pz));+ return g.map((_, x) => _.toAffine(A[x])).map(u.fromAffine);});}/**@@ -39635,10 +39644,10 @@ function GD(i) {const { endo: A } = e;if (!A)return f.unsafeLadder(this, m);- let { k1neg: y, k1: x, k2neg: E, k2: I } = A.splitScalar(m), w = g, S = g, T = this;- for (; x > rs || I > rs; )- x & ai && (w = w.add(T)), I & ai && (S = S.add(T)), T = T.double(), x >>= ai, I >>= ai;- return y && (w = w.negate()), E && (S = S.negate()), S = new u(t.mul(S.px, A.beta), S.py, S.pz), w.add(S);+ 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;+ return _ && (w = w.negate()), E && (I = I.negate()), I = new u(t.mul(I.px, A.beta), I.py, I.pz), w.add(I);}/*** Constant time multiplication.@@ -39651,17 +39660,17 @@ function GD(i) {*/multiply(m) {o(m);- let g = m, A, y;+ let g = m, A, _;const { endo: x } = e;if (x) {- const { k1neg: E, k1: I, k2neg: w, k2: S } = x.splitScalar(g);- let { p: T, f: C } = this.wNAF(I), { p: v, f: F } = this.wNAF(S);- 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), y = C.add(F);+ 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: I } = this.wNAF(g);- A = E, y = I;+ const { p: E, f: S } = this.wNAF(g);+ A = E, _ = S;}- return u.normalizeZ([A, y])[0];+ return u.normalizeZ([A, _])[0];}/*** Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.@@ -39670,21 +39679,21 @@ function GD(i) {* @returns non-zero affine point*/multiplyAndAddUnsafe(m, g, A) {- const y = u.BASE, x = (I, w) => w === rs || w === ai || !I.equals(y) ? I.multiplyUnsafe(w) : I.multiply(w), E = x(this, g).add(x(m, 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));return E.is0() ? void 0 : E;}// Converts Projective point to affine (x, y) coordinates.// Can accept precomputed Z^-1 - for example, from invertBatch.// (x, y, z) ∋ (x=x/z, y=y/z)toAffine(m) {- const { px: g, py: A, pz: y } = this, x = this.is0();- m == null && (m = x ? t.ONE : t.inv(y));- const E = t.mul(g, m), I = t.mul(A, m), w = t.mul(y, 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: I };+ return { x: E, y: S };}isTorsionFree() {const { h: m, isTorsionFree: g } = e;@@ -39702,11 +39711,11 @@ function GD(i) {return this.assertValidity(), n(u, this, m);}toHex(m = !0) {- return Ua(this.toRawBytes(m));+ return Oa(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 = kD(u, e.endo ? Math.ceil(d / 2) : d);+ const d = e.nBitLength, f = jN(u, e.endo ? Math.ceil(d / 2) : d);return {CURVE: e,ProjectivePoint: u,@@ -39715,9 +39724,9 @@ function GD(i) {isWithinCurveOrder: a};}-function HD(i) {- const e = Ub(i);- return Ac(e, {+function $N(i) {+ const e = zb(i);+ return mc(e, {hash: "hash",hmac: "function",randomBytes: "function"@@ -39727,48 +39736,48 @@ function HD(i) {lowS: "boolean"}), Object.freeze({ lowS: !0, ...e });}-function zD(i) {- const e = HD(i), { Fp: t, n } = e, s = t.BYTES + 1, r = 2 * t.BYTES + 1;- function a(N) {- return rs < N && N < t.ORDER;+function eD(i) {+ const e = $N(i), { Fp: t, n } = e, s = t.BYTES + 1, r = 2 * t.BYTES + 1;+ function a(D) {+ return rs < D && D < t.ORDER;}- function o(N) {- return Kn(N, n);+ function o(D) {+ return Kn(D, n);}- function c(N) {- return df(N, n);+ function c(D) {+ return Af(D, n);}- const { ProjectivePoint: l, normPrivateKeyToScalar: h, weierstrassEquation: u, isWithinCurveOrder: d } = GD({+ const { ProjectivePoint: l, normPrivateKeyToScalar: h, weierstrassEquation: u, isWithinCurveOrder: d } = ZN({...e,- toBytes(N, O, Y) {- const Q = O.toAffine(), J = t.toBytes(Q.x), ee = tc;+ 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(N) {- const O = N.length, Y = N[0], Q = N.subarray(1);+ fromBytes(D) {+ const O = D.length, Y = D[0], Q = D.subarray(1);if (O === s && (Y === 2 || Y === 3)) {- const J = vr(Q);+ 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 ye = (ae & ai) === ai;- return (Y & 1) === 1 !== ye && (ae = t.neg(ae)), { x: J, y: ae };+ 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 };} elsethrow new Error(`Point of length ${O} was invalid. Expected ${s} compressed bytes or ${r} uncompressed bytes`);}- }), f = (N) => Ua(Oa(N, e.nByteLength));- function p(N) {+ }), f = (D) => Oa(Qa(D, e.nByteLength));+ function p(D) {const O = n >> ai;- return N > O;+ return D > O;}- function m(N) {- return p(N) ? o(-N) : N;+ function m(D) {+ return p(D) ? o(-D) : D;}- const g = (N, O, Y) => vr(N.slice(O, Y));+ 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();@@ -39776,12 +39785,12 @@ function zD(i) {// pair (bytes of r, bytes of s)static fromCompact(O) {const Y = e.nByteLength;- return O = _i("compactSignature", O, Y * 2), new A(g(O, 0, Y), g(O, Y, 2 * Y));+ return O = yi("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-scriptstatic fromDER(O) {- const { r: Y, s: Q } = Er.toSig(_i("DER", O));+ const { r: Y, s: Q } = _r.toSig(yi("DER", O));return new A(Y, Q);}assertValidity() {@@ -39794,13 +39803,13 @@ function zD(i) {return new A(this.r, this.s, O);}recoverPublicKey(O) {- const { r: Y, s: Q, recovery: J } = this, ee = S(_i("msgHash", O));+ const { r: Y, s: Q, recovery: J } = this, ee = I(yi("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 ye = (J & 1) === 0 ? "02" : "03", Me = l.fromHex(ye + f(ae)), se = c(ae), me = o(-ee * se), xe = o(Q * se), be = l.BASE.multiplyAndAddUnsafe(Me, me, xe);+ 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;@@ -39814,23 +39823,23 @@ function zD(i) {}// DER-encodedtoDERRawBytes() {- return ec(this.toDERHex());+ return nc(this.toDERHex());}toDERHex() {- return Er.hexFromSig({ r: this.r, s: this.s });+ return _r.hexFromSig({ r: this.r, s: this.s });}// padded bytes of r, then padded bytes of stoCompactRawBytes() {- return ec(this.toCompactHex());+ return nc(this.toCompactHex());}toCompactHex() {return f(this.r) + f(this.s);}}- const y = {- isValidPrivateKey(N) {+ const _ = {+ isValidPrivateKey(D) {try {- return h(N), !0;+ return h(D), !0;} catch {return !1;}@@ -39841,8 +39850,8 @@ function zD(i) {* (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.*/randomPrivateKey: () => {- const N = kb(e.n);- return LD(e.randomBytes(N), e.n);+ const D = Hb(e.n);+ return qN(e.randomBytes(D), e.n);},/*** Creates precompute table for an arbitrary EC point. Makes point "cached".@@ -39852,57 +39861,57 @@ function zD(i) {* const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));* fast.multiply(privKey); // much faster ECDH now*/- precompute(N = 8, O = l.BASE) {- return O._setWindowSize(N), O.multiply(BigInt(3)), O;+ precompute(D = 8, O = l.BASE) {+ return O._setWindowSize(D), O.multiply(BigInt(3)), O;}};- function x(N, O = !0) {- return l.fromPrivateKey(N).toRawBytes(O);+ function x(D, O = !0) {+ return l.fromPrivateKey(D).toRawBytes(O);}- function E(N) {- const O = N instanceof Uint8Array, Y = typeof N == "string", Q = (O || Y) && N.length;- return O ? Q === s || Q === r : Y ? Q === 2 * s || Q === 2 * r : N instanceof l;+ 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 I(N, O, Y = !0) {- if (E(N))+ 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(N)).toRawBytes(Y);+ return l.fromHex(O).multiply(h(D)).toRawBytes(Y);}- const w = e.bits2int || function(N) {- const O = vr(N), Y = N.length * 8 - e.nBitLength;+ const w = e.bits2int || function(D) {+ const O = Ir(D), Y = D.length * 8 - e.nBitLength;return Y > 0 ? O >> BigInt(Y) : O;- }, S = e.bits2int_modN || function(N) {- return o(w(N));- }, T = yp(e.nBitLength);- function C(N) {- if (typeof N != "bigint")+ }, I = e.bits2int_modN || function(D) {+ return o(w(D));+ }, T = Cp(e.nBitLength);+ function C(D) {+ if (typeof D != "bigint")throw new Error("bigint expected");- if (!(rs <= N && N < T))+ if (!(rs <= D && D < T))throw new Error(`bigint expected < 2^${e.nBitLength}`);- return Oa(N, e.nByteLength);+ return Qa(D, e.nByteLength);}- function v(N, O, Y = F) {+ 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: ye } = Y;- ee == null && (ee = !0), N = _i("msgHash", N), ae && (N = _i("prehashed msgHash", Q(N)));- const Me = S(N), se = h(O), me = [C(se), C(Me)];- if (ye != null) {- const et = ye === !0 ? J(t.BYTES) : ye;- me.push(_i("extraEntropy", et));- }- const xe = tc(...me), be = Me;+ let { lowS: ee, prehash: ae, extraEntropy: _e } = Y;+ ee == null && (ee = !0), D = yi("msgHash", D), ae && (D = yi("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));+ }+ const xe = ic(...me), be = Me;function Ue(et) {const He = w(et);if (!d(He))return;- const It = c(He), ht = l.BASE.multiply(He).toAffine(), $e = o(ht.x);+ const St = c(He), ht = l.BASE.multiply(He).toAffine(), $e = o(ht.x);if ($e === rs)return;- const H = o(It * o(be + $e * se));+ const H = o(St * o(be + $e * se));if (H === rs)return;let xn = (ht.x === $e ? 0 : 2) | Number(ht.y & ai), pt = H;@@ -39911,29 +39920,29 @@ function zD(i) {return { seed: xe, k2sig: Ue };}const F = { lowS: e.lowS, prehash: !1 }, K = { lowS: e.lowS, prehash: !1 };- function q(N, O, Y = F) {- const { seed: Q, k2sig: J } = v(N, O, Y), ee = e;- return Nb(ee.hash.outputLen, ee.nByteLength, ee.hmac)(Q, J);+ 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);}l.BASE._setWindowSize(8);- function $(N, O, Y, Q = K) {- const J = N;- if (O = _i("msgHash", O), Y = _i("publicKey", Y), "strict" in Q)+ function $(D, O, Y, Q = K) {+ const J = D;+ if (O = yi("msgHash", O), Y = yi("publicKey", Y), "strict" in Q)throw new Error("options.strict was renamed to lowS");const { lowS: ee, prehash: ae } = Q;- let ye, Me;+ let _e, Me;try {if (typeof J == "string" || J instanceof Uint8Array)try {- ye = A.fromDER(J);+ _e = A.fromDER(J);} catch (ht) {- if (!(ht instanceof Er.Err))+ if (!(ht instanceof _r.Err))throw ht;- ye = A.fromCompact(J);+ _e = A.fromCompact(J);}else if (typeof J == "object" && typeof J.r == "bigint" && typeof J.s == "bigint") {const { r: ht, s: $e } = J;- ye = new A(ht, $e);+ _e = new A(ht, $e);} elsethrow new Error("PARSE");Me = l.fromHex(Y);@@ -39942,46 +39951,46 @@ function zD(i) {throw new Error("signature must be Signature instance, Uint8Array or hex string");return !1;}- if (ee && ye.hasHighS())+ if (ee && _e.hasHighS())return !1;ae && (O = e.hash(O));- const { r: se, s: me } = ye, xe = S(O), be = c(me), Ue = o(xe * be), et = o(se * be), He = l.BASE.multiplyAndAddUnsafe(Me, Ue, et)?.toAffine();+ 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: I,+ getSharedSecret: S,sign: q,verify: $,ProjectivePoint: l,Signature: A,- utils: y+ utils: _};}-function VD(i) {+function tD(i) {return {hash: i,- hmac: (e, ...t) => gb(i, e, PF(...t)),- randomBytes: kF+ hmac: (e, ...t) => yb(i, e, KF(...t)),+ randomBytes: jF};}-function WD(i, e) {- const t = (n) => zD({ ...i, ...VD(n) });+function nD(i, e) {+ const t = (n) => eD({ ...i, ...tD(n) });return Object.freeze({ ...t(e), create: t });}-const Ob = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), pm = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), qD = BigInt(1), ff = BigInt(2), Am = (i, e) => (i + e / ff) / e;-function KD(i) {- const e = Ob, 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, ff, 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, y = si(A, o, e) * m % e, x = si(y, t, e) * h % e, E = si(x, a, e) * p % e, I = si(E, n, e) * l % e, w = si(I, ff, e);- if (!pf.eql(pf.sqr(w), i))+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))throw new Error("Cannot find square root");return w;}-const pf = ND(Ob, void 0, void 0, { sqrt: KD }), ks = WD({+const mf = WN(Vb, void 0, void 0, { sqrt: sD }), ks = nD({a: BigInt(0),b: BigInt(7),- Fp: pf,- n: pm,+ Fp: mf,+ n: mm,// Base point (x, y) aka generator pointGx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),@@ -39996,7 +40005,7 @@ const pf = ND(Ob, void 0, void 0, { sqrt: KD }), ks = WD({endo: {beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar: (i) => {- const e = pm, t = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), n = -qD * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), s = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), r = t, a = BigInt("0x100000000000000000000000000000000"), o = Am(r * i, e), c = Am(-n * i, e);+ 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 u = l > a, d = h > a;if (u && (l = e - l), d && (h = e - h), l > a || h > a)@@ -40004,11 +40013,11 @@ const pf = ND(Ob, void 0, void 0, { sqrt: KD }), ks = WD({return { k1neg: u, k1: l, k2neg: d, k2: h };}}-}, xb);+}, wb);BigInt(0);ks.ProjectivePoint;-const nc = "0x0000000000000000000000000000000000000000", gm = "0x0000000000000000000000000000000000000000000000000000000000000000", mm = BigInt(0), xm = BigInt(1), Af = BigInt(2), bm = BigInt(27), Em = BigInt(28), ml = BigInt(35), Qb = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), jD = Qb / Af, XD = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), cr = {};-function Ku(i) {+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) {return Es(rn(i), 32);}class zt {@@ -40026,7 +40035,7 @@ class zt {return this.#e;}set r(e) {- V(Ia(e) === 32, "invalid r", "value", e), this.#e = Se(e);+ V(Ba(e) === 32, "invalid r", "value", e), this.#e = Ie(e);}/*** The ``s`` value for a signature.@@ -40035,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(Ia(e) === 32, "invalid s", "value", e), this.#t = Se(e);+ V(Ba(e) === 32, "invalid s", "value", e), this.#t = Ie(e);}/*** Return the s value, unchecked for EIP-2 compliance.@@ -40052,7 +40061,7 @@ class zt {* Returns true if the Signature is valid for [[link-eip-2]] signatures.*/isValid() {- return BigInt(this.#t) <= jD;+ return BigInt(this.#t) <= rD;}/*** The ``v`` value for a signature.@@ -40100,25 +40109,25 @@ class zt {*/get yParityAndS() {const e = dt(this.s);- return this.yParity && (e[0] |= 128), Se(e);+ return this.yParity && (e[0] |= 128), Ie(e);}/*** The [[link-eip-2098]] compact representation.*/get compactSerialized() {- return Gt([this.r, this.yParityAndS]);+ return Ht([this.r, this.yParityAndS]);}/*** The serialized representation.*/get serialized() {- return Gt([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]);+ return Ht([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]);}/*** @private*/constructor(e, t, n, s) {- yh(e, cr, "Signature"), this.#e = t, this.#t = n, this.#n = s, this.#i = null;+ vh(e, lr, "Signature"), this.#e = t, this.#t = n, this.#n = s, this.#i = null;}/*** Returns the canonical signature.@@ -40130,14 +40139,14 @@ class zt {getCanonical() {if (this.isValid())return this;- const e = Qb - BigInt(this._s), t = 55 - this.v, n = new zt(cr, this.r, Ku(e), t);+ const e = Wb - BigInt(this._s), t = 55 - this.v, n = new zt(lr, this.r, Yu(e), t);return this.networkV && (n.#i = this.networkV), n;}/*** Returns a new identical [[Signature]].*/clone() {- const e = new zt(cr, this.r, this._s, this.v);+ const e = new zt(lr, this.r, this._s, this.v);return this.networkV && (e.#i = this.networkV), e;}/**@@ -40153,7 +40162,7 @@ class zt {v: this.v};}- [XD]() {+ [aD]() {return this.toString();}toString() {@@ -40170,8 +40179,8 @@ class zt {* //_result:*/static getChainId(e) {- const t = Ne(e, "v");- return t == bm || t == Em ? mm : (V(t >= ml, "invalid EIP-155 v", "v", e), (t - ml) / Af);+ const t = De(e, "v");+ return t == _m || t == wm ? Em : (V(t >= bl, "invalid EIP-155 v", "v", e), (t - bl) / xf);}/*** Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.@@ -40188,7 +40197,7 @@ class zt {**/static getChainIdV(e, t) {- return Ne(e) * Af + BigInt(35 + t - 27);+ return De(e) * xf + BigInt(35 + t - 27);}/*** Compute the normalized legacy transaction ``v`` from a ``yParirty``,@@ -40212,8 +40221,8 @@ class zt {* //_error:*/static getNormalizedV(e) {- const t = Ne(e);- return t === mm || t === bm ? 27 : t === xm || t === Em ? 28 : (V(t >= ml, "invalid v", "v", e), t & xm ? 27 : 28);+ 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);}/*** Creates a new [[Signature]].@@ -40228,16 +40237,16 @@ class zt {V(l, h, "signature", e);}if (e == null)- return new zt(cr, gm, gm, 27);+ return new zt(lr, bm, bm, 27);if (typeof e == "string") {const l = dt(e, "signature");if (l.length === 64) {- const h = Se(l.slice(0, 32)), u = l.slice(32, 64), d = u[0] & 128 ? 28 : 27;- return u[0] &= 127, new zt(cr, h, Se(u), d);+ const h = Ie(l.slice(0, 32)), u = l.slice(32, 64), d = u[0] & 128 ? 28 : 27;+ return u[0] &= 127, new zt(lr, h, Ie(u), d);}if (l.length === 65) {- const h = Se(l.slice(0, 32)), u = Se(l.slice(32, 64)), d = zt.getNormalizedV(l[64]);- return new zt(cr, h, u, d);+ const h = Ie(l.slice(0, 32)), u = Ie(l.slice(32, 64)), d = zt.getNormalizedV(l[64]);+ return new zt(lr, h, u, d);}t(!1, "invalid raw signature length");}@@ -40245,20 +40254,20 @@ class zt {return e.clone();const n = e.r;t(n != null, "missing r");- const s = Ku(n), r = (function(l, h) {+ const s = Yu(n), r = (function(l, h) {if (l != null)- return Ku(l);+ return Yu(l);if (h != null) {t(Ut(h, 32), "invalid yParityAndS");const u = dt(h);- return u[0] &= 127, Se(u);+ return u[0] &= 127, Ie(u);}t(!1, "missing s");})(e.s, e.yParityAndS), { networkV: a, v: o } = (function(l, h, u) {if (l != null) {- const d = Ne(l);+ const d = De(l);return {- networkV: d >= ml ? d : void 0,+ networkV: d >= bl ? d : void 0,v: zt.getNormalizedV(d)};}@@ -40274,7 +40283,7 @@ class zt {t(!1, "invalid yParity");}t(!1, "missing v");- })(e.v, e.yParityAndS, e.yParity), c = new zt(cr, s, r, o);+ })(e.v, e.yParityAndS, e.yParity), c = new zt(lr, s, r, o);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;}}@@ -40284,7 +40293,7 @@ class as {* Creates a new **SigningKey** for %%privateKey%%.*/constructor(e) {- V(Ia(e) === 32, "invalid private key", "privateKey", "[REDACTED]"), this.#e = Se(e);+ V(Ba(e) === 32, "invalid private key", "privateKey", "[REDACTED]"), this.#e = Ie(e);}/*** The private key.@@ -40315,13 +40324,13 @@ class as {* Return the signature of the signed %%digest%%.*/sign(e) {- V(Ia(e) === 32, "invalid digest length", "digest", e);+ V(Ba(e) === 32, "invalid digest length", "digest", e);const t = ks.sign(On(e), On(this.#e), {lowS: !0});return zt.from({- r: Xs(t.r, 32),- s: Xs(t.s, 32),+ r: Ys(t.r, 32),+ s: Ys(t.s, 32),v: t.recovery ? 28 : 27});}@@ -40349,7 +40358,7 @@ class as {*/computeSharedSecret(e) {const t = as.computePublicKey(e);- return Se(ks.getSharedSecret(On(this.#e), dt(t), !1));+ return Ie(ks.getSharedSecret(On(this.#e), dt(t), !1));}/*** Compute the public key for %%key%%, optionally %%compressed%%.@@ -40380,14 +40389,14 @@ class as {let n = dt(e, "key");if (n.length === 32) {const r = ks.getPublicKey(n, !!t);- return Se(r);+ return Ie(r);}if (n.length === 64) {const r = new Uint8Array(65);r[0] = 4, r.set(n, 1), n = r;}const s = ks.ProjectivePoint.fromHex(n);- return Se(s.toRawBytes(t));+ return Ie(s.toRawBytes(t));}/*** Returns the public key for the private key which produced the@@ -40408,9 +40417,9 @@ class as {**/static recoverPublicKey(e, t) {- V(Ia(e) === 32, "invalid digest length", "digest", e);+ V(Ba(e) === 32, "invalid digest length", "digest", e);const n = zt.from(t);- let s = ks.Signature.fromCompact(On(Gt([n.r, n.s])));+ let s = ks.Signature.fromCompact(On(Ht([n.r, n.s])));s = s.addRecoveryBit(n.yParity);const r = s.recoverPublicKey(On(e));return V(r != null, "invalid signature for digest", "signature", t), "0x" + r.toHex(!1);@@ -40430,8 +40439,8 @@ class as {return "0x" + s.add(r).toHex(!!n);}}-const YD = BigInt(0), JD = BigInt(36);-function _m(i) {+const oD = BigInt(0), cD = BigInt(36);+function vm(i) {i = i.toLowerCase();const e = i.substring(2).split(""), t = new Uint8Array(40);for (let s = 0; s < 40; s++)@@ -40441,17 +40450,17 @@ function _m(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 wp = {};+const Ip = {};for (let i = 0; i < 10; i++)- wp[String(i)] = String(i);+ Ip[String(i)] = String(i);for (let i = 0; i < 26; i++)- wp[String.fromCharCode(65 + i)] = String(10 + i);-const ym = 15;-function ZD(i) {+ Ip[String.fromCharCode(65 + i)] = String(10 + i);+const Cm = 15;+function lD(i) {i = i.toUpperCase(), i = i.substring(4) + i.substring(0, 2) + "00";- let e = i.split("").map((n) => wp[n]).join("");- for (; e.length >= ym; ) {- let n = e.substring(0, ym);+ let e = i.split("").map((n) => Ip[n]).join("");+ for (; e.length >= Cm; ) {+ let n = e.substring(0, Cm);e = parseInt(n, 10) % 97 + e.substring(n.length);}let t = String(98 - parseInt(e, 10) % 97);@@ -40459,7 +40468,7 @@ function ZD(i) {t = "0" + t;return t;}-const $D = (function() {+const hD = (function() {const i = {};for (let e = 0; e < 36; e++) {const t = "0123456789abcdefghijklmnopqrstuvwxyz"[e];@@ -40467,47 +40476,47 @@ const $D = (function() {}return i;})();-function eN(i) {+function uD(i) {i = i.toLowerCase();- let e = YD;+ let e = oD;for (let t = 0; t < i.length; t++)- e = e * JD + $D[i[t]];+ e = e * cD + hD[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 = _m(i);+ const e = vm(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) === ZD(i), "bad icap checksum", "address", i);- let e = eN(i.substring(4)).toString(16);+ V(i.substring(2, 4) === lD(i), "bad icap checksum", "address", i);+ let e = uD(i.substring(4)).toString(16);for (; e.length < 40; )e = "0" + e;- return _m("0x" + e);+ return vm("0x" + e);}V(!1, "invalid address", "address", i);}-function tN(i) {+function dD(i) {const e = Mt(i.from);- let n = Ne(i.nonce, "tx.nonce").toString(16);+ 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 Gb(i) {+function qb(i) {return i && typeof i.getAddress == "function";}-async function ju(i, e) {+async function Ju(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) {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 (Gb(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" }), Ju(i, e.resolveName(i)));+ if (qb(i))+ return Ju(i, i.getAddress());if (i && typeof i.then == "function")- return ju(i, i);+ return Ju(i, i);V(!1, "unsupported addressable value", "target", i);}const ns = {};@@ -40518,7 +40527,7 @@ function Te(i, e) {function vt(i, e) {return new jt(ns, `bytes${e || ""}`, i, { size: e });}-const wm = /* @__PURE__ */ Symbol.for("_ethers_typed");+const Im = /* @__PURE__ */ Symbol.for("_ethers_typed");class jt {/*** The type, as a Solidity-compatible type.@@ -40537,7 +40546,7 @@ class jt {* @_ignore:*/constructor(e, t, n, s) {- s == null && (s = null), yh(ns, e, "Typed"), Ye(this, { _typedSymbol: wm, type: t, value: n }), this.#e = s, this.format();+ s == null && (s = null), vh(ns, e, "Typed"), Ye(this, { _typedSymbol: Im, type: t, value: n }), this.#e = s, this.format();}/*** Format the type as a Human-Readable type.@@ -41247,7 +41256,7 @@ class jt {* Returns true only if %%value%% is a [[Typed]] instance.*/static isTyped(e) {- return e && typeof e == "object" && "_typedSymbol" in e && e._typedSymbol === wm;+ return e && typeof e == "object" && "_typedSymbol" in e && e._typedSymbol === Im;}/*** If the value is a [[Typed]] instance, validates the underlying value@@ -41265,7 +41274,7 @@ class jt {return e;}}-class nN extends ys {+class fD extends _s {constructor(e) {super("address", "address", e, !1);}@@ -41282,10 +41291,10 @@ class nN extends ys {return e.writeValue(n);}decode(e) {- return Mt(Xs(e.readValue(), 20));+ return Mt(Ys(e.readValue(), 20));}}-class iN extends ys {+class pD extends _s {coder;constructor(e) {super(e.name, e.type, "_", e.dynamic), this.coder = e;@@ -41300,7 +41309,7 @@ class iN extends ys {return this.coder.decode(e);}}-function Hb(i, e, t) {+function Kb(i, e, t) {let n = [];if (Array.isArray(t))n = t;@@ -41313,7 +41322,7 @@ function Hb(i, e, t) {} elseV(!1, "invalid tuple value", "tuple", t);V(e.length === n.length, "types/value length mismatch", "tuple", t);- let s = new lf(), r = new lf(), a = [];+ let s = new df(), r = new df(), a = [];e.forEach((c, l) => {let h = n[l];if (c.dynamic) {@@ -41331,7 +41340,7 @@ function Hb(i, e, t) {let o = i.appendWriter(s);return o += i.appendWriter(r), o;}-function zb(i, e) {+function jb(i, e) {let t = [], n = [], s = i.subReader(0);return e.forEach((r) => {let a = null;@@ -41357,7 +41366,7 @@ function zb(i, e) {t.push(a), n.push(r.localName || null);}), ds.fromItems(t, n);}-class sN extends ys {+class AD extends _s {coder;length;constructor(e, t, n) {@@ -41374,22 +41383,22 @@ class sN extends ys {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)), eb(n.length, s, "coder array" + (this.localName ? " " + this.localName : ""));+ s === -1 && (s = n.length, e.writeValue(n.length)), rb(n.length, s, "coder array" + (this.localName ? " " + this.localName : ""));let r = [];for (let a = 0; a < n.length; a++)r.push(this.coder);- return Hb(e, r, n);+ return Kb(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 }));let n = [];for (let s = 0; s < t; s++)- n.push(new iN(this.coder));- return zb(e, n);+ n.push(new pD(this.coder));+ return jb(e, n);}}-class rN extends ys {+class gD extends _s {constructor(e) {super("bool", "bool", e, !1);}@@ -41404,7 +41413,7 @@ class rN extends ys {return !!e.readValue();}}-class Vb extends ys {+class Xb extends _s {constructor(e, t) {super(e, e, t, !0);}@@ -41420,15 +41429,15 @@ class Vb extends ys {return e.readBytes(e.readIndex(), !0);}}-class aN extends Vb {+class mD extends Xb {constructor(e) {super("bytes", e);}decode(e) {- return Se(super.decode(e));+ return Ie(super.decode(e));}}-class oN extends ys {+class xD extends _s {size;constructor(e, t) {let n = "bytes" + String(e);@@ -41442,11 +41451,11 @@ class oN extends ys {return n.length !== this.size && this._throwError("incorrect data length", t), e.writeBytes(n);}decode(e) {- return Se(e.readBytes(this.size));+ return Ie(e.readBytes(this.size));}}-const cN = new Uint8Array([]);-class lN extends ys {+const bD = new Uint8Array([]);+class ED extends _s {constructor(e) {super("null", "", e, !1);}@@ -41454,14 +41463,14 @@ class lN extends ys {return null;}encode(e, t) {- return t != null && this._throwError("not null", t), e.writeBytes(cN);+ return t != null && this._throwError("not null", t), e.writeBytes(bD);}decode(e) {return e.readBytes(0), null;}}-const hN = BigInt(0), uN = BigInt(1), dN = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");-class fN extends ys {+const yD = BigInt(0), _D = BigInt(1), wD = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");+class vD extends _s {size;signed;constructor(e, t, n) {@@ -41472,19 +41481,19 @@ class fN extends ys {return 0;}encode(e, t) {- let n = Ne(jt.dereference(t, this.type)), s = vo(dN, Gn * 8);+ let n = De(jt.dereference(t, this.type)), s = Io(wD, Gn * 8);if (this.signed) {- let r = vo(s, this.size * 8 - 1);- (n > r || n < -(r + uN)) && this._throwError("value out-of-bounds", t), n = ib(n, 8 * Gn);- } else (n < hN || n > vo(s, this.size * 8)) && this._throwError("value out-of-bounds", t);+ 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);return e.writeValue(n);}decode(e) {- let t = vo(e.readValue(), this.size * 8);- return this.signed && (t = fF(t, this.size * 8)), t;+ let t = Io(e.readValue(), this.size * 8);+ return this.signed && (t = vF(t, this.size * 8)), t;}}-class pN extends Vb {+class CD extends Xb {constructor(e) {super("string", e);}@@ -41495,10 +41504,10 @@ class pN extends Vb {return super.encode(e, gs(jt.dereference(t, "string")));}decode(e) {- return $l(super.decode(e));+ return th(super.decode(e));}}-class xl extends ys {+class El extends _s {coders;constructor(e, t) {let n = !1;@@ -41525,81 +41534,81 @@ class xl extends ys {}encode(e, t) {const n = jt.dereference(t, "tuple");- return Hb(e, this.coders, n);+ return Kb(e, this.coders, n);}decode(e) {- return zb(e, this.coders);+ return jb(e, this.coders);}}-function Xu(i, e) {+function Zu(i, e) {return {address: Mt(i),storageKeys: e.map((t, n) => (V(Ut(t, 32), "invalid slot", `storageKeys[${n}]`, t), t.toLowerCase()))};}-function Qr(i) {+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), Xu(t[0], t[1])) : (V(t != null && typeof t == "object", "invalid address-slot set", "value", i), Xu(t.address, t.storageKeys)));+ 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)));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 Xu(t, Object.keys(n).sort());+ return Zu(t, Object.keys(n).sort());});return e.sort((t, n) => t.address.localeCompare(n.address)), e;}-function Wb(i) {+function Yb(i) {return {address: Mt(i.address),- nonce: Ne(i.nonce != null ? i.nonce : 0),- chainId: Ne(i.chainId != null ? i.chainId : 0),+ nonce: De(i.nonce != null ? i.nonce : 0),+ chainId: De(i.chainId != null ? i.chainId : 0),signature: zt.from(i.signature)};}-function AN(i) {+function ID(i) {let e;return typeof i == "string" ? e = as.computePublicKey(i, !1) : e = i.publicKey, Mt(sn("0x" + e.substring(4)).substring(26));}-function gN(i, e) {- return AN(as.recoverPublicKey(i, e));+function SD(i, e) {+ return ID(as.recoverPublicKey(i, e));}-const yn = BigInt(0), mN = BigInt(2), xN = BigInt(27), bN = BigInt(28), EN = BigInt(35), _N = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), yN = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), Yu = 4096 * 32, Ml = 128;-function wN(i) {+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) {return { blobToKzgCommitment: (n) => {if ("computeBlobProof" in i) {if ("blobToKzgCommitment" in i && typeof i.blobToKzgCommitment == "function")- return dt(i.blobToKzgCommitment(Se(n)));+ return dt(i.blobToKzgCommitment(Ie(n)));} else if ("blobToKzgCommitment" in i && typeof i.blobToKzgCommitment == "function")return dt(i.blobToKzgCommitment(n));if ("blobToKZGCommitment" in i && typeof i.blobToKZGCommitment == "function")- return dt(i.blobToKZGCommitment(Se(n)));+ return dt(i.blobToKZGCommitment(Ie(n)));V(!1, "unsupported KZG library", "kzg", i);}, computeBlobKzgProof: (n, s) => {if ("computeBlobProof" in i && typeof i.computeBlobProof == "function")- return dt(i.computeBlobProof(Se(n), Se(s)));+ return dt(i.computeBlobProof(Ie(n), Ie(s)));if ("computeBlobKzgProof" in i && typeof i.computeBlobKzgProof == "function")return i.computeBlobKzgProof(n, s);if ("computeBlobKZGProof" in i && typeof i.computeBlobKZGProof == "function")- return dt(i.computeBlobKZGProof(Se(n), Se(s)));+ return dt(i.computeBlobKZGProof(Ie(n), Ie(s)));V(!1, "unsupported KZG library", "kzg", i);} };}-function vm(i, e) {+function Sm(i, e) {let t = i.toString(16);for (; t.length < 2; )t = "0" + t;- return t += Ya(e).substring(4), "0x" + t;+ return t += Ja(e).substring(4), "0x" + t;}-function Ja(i) {+function Za(i) {return i === "0x" ? null : Mt(i);}-function Sh(i, e) {+function Mh(i, e) {try {- return Qr(i);+ return Hr(i);} catch (t) {V(!1, t.message, e, i);}}-function vN(i, e) {+function LD(i, e) {try {if (!Array.isArray(i))throw new Error("authorizationList: invalid array");@@ -41613,11 +41622,11 @@ function vN(i, e) {if (!s[1])throw new Error(`authorization[${n}]: null address`);t.push({- address: Ja(s[1]),- nonce: Dt(s[2], "nonce"),- chainId: Dt(s[0], "chainId"),+ address: Za(s[1]),+ nonce: Nt(s[2], "nonce"),+ chainId: Nt(s[0], "chainId"),signature: zt.from({- yParity: Gr(s[3], "yParity"),+ yParity: zr(s[3], "yParity"),r: Es(s[4], 32),s: Es(s[5], 32)})@@ -41628,23 +41637,23 @@ function vN(i, e) {V(!1, t.message, e, i);}}-function Gr(i, e) {+function zr(i, e) {return i === "0x" ? 0 : ft(i, e);}-function Dt(i, e) {+function Nt(i, e) {if (i === "0x")- return yn;- const t = Ne(i, e);- return V(t <= _N, "value exceeds uint size", e, t), t;+ return _n;+ const t = De(i, e);+ return V(t <= FD, "value exceeds uint size", e, t), t;}function Et(i, e) {- const t = Ne(i, "value"), n = rn(t);+ const t = De(i, "value"), n = rn(t);return V(n.length <= 32, "value too large", `tx.${e}`, t), n;}-function Ih(i) {- return Qr(i).map((e) => [e.address, e.storageKeys]);+function Bh(i) {+ return Hr(i).map((e) => [e.address, e.storageKeys]);}-function CN(i) {+function PD(i) {return i.map((e) => [Et(e.chainId, "chainId"),e.address,@@ -41654,33 +41663,33 @@ function CN(i) {rn(e.signature._s)]);}-function SN(i, e) {+function kD(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 IN(i) {- const e = pc(i);+function UD(i) {+ const e = gc(i);V(Array.isArray(e) && (e.length === 9 || e.length === 6), "invalid field count for legacy transaction", "data", i);const t = {type: 0,- nonce: Gr(e[0], "nonce"),- gasPrice: Dt(e[1], "gasPrice"),- gasLimit: Dt(e[2], "gasLimit"),- to: Ja(e[3]),- value: Dt(e[4], "value"),- data: Se(e[5]),- chainId: yn+ nonce: zr(e[0], "nonce"),+ gasPrice: Nt(e[1], "gasPrice"),+ gasLimit: Nt(e[2], "gasLimit"),+ to: Za(e[3]),+ value: Nt(e[4], "value"),+ data: Ie(e[5]),+ chainId: _n};if (e.length === 6)return t;- const n = Dt(e[6], "v"), s = Dt(e[7], "r"), r = Dt(e[8], "s");- if (s === yn && r === yn)+ 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 - EN) / mN;- a < yn && (a = yn), t.chainId = a, V(a !== yn || n === xN || n === bN, "non-canonical legacy v", "v", e[6]), t.signature = zt.from({+ 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({r: Es(e[7], 32),s: Es(e[8], 32),v: n@@ -41688,7 +41697,7 @@ function IN(i) {}return t;}-function MN(i, e) {+function OD(i, e) {const t = [Et(i.nonce, "nonce"),Et(i.gasPrice || 0, "gasPrice"),@@ -41697,22 +41706,22 @@ function MN(i, e) {Et(i.value, "value"),i.data];- let n = yn;- if (i.chainId != yn)- n = Ne(i.chainId, "tx.chainId"), V(!e || e.networkV == null || e.legacyChainId === n, "tx.chainId/sig.v mismatch", "sig", e);+ let n = _n;+ if (i.chainId != _n)+ n = De(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 !== yn && (t.push(rn(n)), t.push("0x"), t.push("0x")), ms(t);+ return n !== _n && (t.push(rn(n)), t.push("0x"), t.push("0x")), ms(t);let s = BigInt(27 + e.yParity);- return n !== yn ? 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);+ 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 Mh(i, e) {+function Th(i, e) {let t;try {- if (t = Gr(e[0], "yParity"), t !== 0 && t !== 1)+ if (t = zr(e[0], "yParity"), t !== 0 && t !== 1)throw new Error("bad yParity");} catch {V(!1, "invalid yParity", "yParity", e[0]);@@ -41720,25 +41729,25 @@ function Mh(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 BN(i) {- const e = pc(dt(i).slice(1));- V(Array.isArray(e) && (e.length === 9 || e.length === 12), "invalid field count for transaction type: 2", "data", Se(i));+function QD(i) {+ const e = gc(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,- chainId: Dt(e[0], "chainId"),- nonce: Gr(e[1], "nonce"),- maxPriorityFeePerGas: Dt(e[2], "maxPriorityFeePerGas"),- maxFeePerGas: Dt(e[3], "maxFeePerGas"),+ chainId: Nt(e[0], "chainId"),+ nonce: zr(e[1], "nonce"),+ maxPriorityFeePerGas: Nt(e[2], "maxPriorityFeePerGas"),+ maxFeePerGas: Nt(e[3], "maxFeePerGas"),gasPrice: null,- gasLimit: Dt(e[4], "gasLimit"),- to: Ja(e[5]),- value: Dt(e[6], "value"),- data: Se(e[7]),- accessList: Sh(e[8], "accessList")+ gasLimit: Nt(e[4], "gasLimit"),+ to: Za(e[5]),+ value: Nt(e[6], "value"),+ data: Ie(e[7]),+ accessList: Mh(e[8], "accessList")};- return e.length === 9 || Mh(t, e.slice(9)), t;+ return e.length === 9 || Th(t, e.slice(9)), t;}-function TN(i, e) {+function GD(i, e) {const t = [Et(i.chainId, "chainId"),Et(i.nonce, "nonce"),@@ -41748,27 +41757,27 @@ function TN(i, e) {i.to || "0x",Et(i.value, "value"),i.data,- Ih(i.accessList || [])+ Bh(i.accessList || [])];- return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Gt(["0x02", ms(t)]);+ return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Ht(["0x02", ms(t)]);}-function RN(i) {- const e = pc(dt(i).slice(1));- V(Array.isArray(e) && (e.length === 8 || e.length === 11), "invalid field count for transaction type: 1", "data", Se(i));+function HD(i) {+ const e = gc(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,- chainId: Dt(e[0], "chainId"),- nonce: Gr(e[1], "nonce"),- gasPrice: Dt(e[2], "gasPrice"),- gasLimit: Dt(e[3], "gasLimit"),- to: Ja(e[4]),- value: Dt(e[5], "value"),- data: Se(e[6]),- accessList: Sh(e[7], "accessList")+ chainId: Nt(e[0], "chainId"),+ nonce: zr(e[1], "nonce"),+ gasPrice: Nt(e[2], "gasPrice"),+ gasLimit: Nt(e[3], "gasLimit"),+ to: Za(e[4]),+ value: Nt(e[5], "value"),+ data: Ie(e[6]),+ accessList: Mh(e[7], "accessList")};- return e.length === 8 || Mh(t, e.slice(8)), t;+ return e.length === 8 || Th(t, e.slice(8)), t;}-function FN(i, e) {+function zD(i, e) {const t = [Et(i.chainId, "chainId"),Et(i.nonce, "nonce"),@@ -41777,12 +41786,12 @@ function FN(i, e) {i.to || "0x",Et(i.value, "value"),i.data,- Ih(i.accessList || [])+ Bh(i.accessList || [])];- return e && (t.push(Et(e.yParity, "recoveryParam")), t.push(rn(e.r)), t.push(rn(e.s))), Gt(["0x01", ms(t)]);+ return e && (t.push(Et(e.yParity, "recoveryParam")), t.push(rn(e.r)), t.push(rn(e.s))), Ht(["0x01", ms(t)]);}-function DN(i) {- let e = pc(dt(i).slice(1)), t = "3", n = null, s = null;+function VD(i) {+ let e = gc(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];@@ -41797,64 +41806,64 @@ function DN(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 * Ml === 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 * Tl === 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 < Ml; u++)- h.push(c[l * Ml + u]);+ for (let u = 0; u < Tl; u++)+ h.push(c[l * Tl + u]);s.push({data: a[l],commitment: o[l],- proof: Gt(h)+ proof: Ht(h)});}e = e[0];}- V(Array.isArray(e) && (e.length === 11 || e.length === 14), `invalid field count for transaction type: ${t}`, "data", Se(i));+ V(Array.isArray(e) && (e.length === 11 || e.length === 14), `invalid field count for transaction type: ${t}`, "data", Ie(i));const r = {type: 3,- chainId: Dt(e[0], "chainId"),- nonce: Gr(e[1], "nonce"),- maxPriorityFeePerGas: Dt(e[2], "maxPriorityFeePerGas"),- maxFeePerGas: Dt(e[3], "maxFeePerGas"),+ chainId: Nt(e[0], "chainId"),+ nonce: zr(e[1], "nonce"),+ maxPriorityFeePerGas: Nt(e[2], "maxPriorityFeePerGas"),+ maxFeePerGas: Nt(e[3], "maxFeePerGas"),gasPrice: null,- gasLimit: Dt(e[4], "gasLimit"),- to: Ja(e[5]),- value: Dt(e[6], "value"),- data: Se(e[7]),- accessList: Sh(e[8], "accessList"),- maxFeePerBlobGas: Dt(e[9], "maxFeePerBlobGas"),+ gasLimit: Nt(e[4], "gasLimit"),+ to: Za(e[5]),+ value: Nt(e[6], "value"),+ data: Ie(e[7]),+ accessList: Mh(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(Ut(r.blobVersionedHashes[a], 32), `invalid blobVersionedHash at index ${a}: must be length 32`, "data", i);- return e.length === 11 || Mh(r, e.slice(11)), r;+ return e.length === 11 || Th(r, e.slice(11)), r;}-function NN(i, e, t) {+function WD(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 || nc,+ i.to || sc,Et(i.value, "value"),i.data,- Ih(i.accessList || []),+ Bh(i.accessList || []),Et(i.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),- SN(i.blobVersionedHashes || [], "blobVersionedHashes")+ kD(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 / Ml;+ const o = dt(a), c = o.length / Tl;for (let l = 0; l < o.length; l += c)r.push(o.subarray(l, l + c));}- return Gt([+ return Ht(["0x03",ms([n,@@ -41865,7 +41874,7 @@ function NN(i, e, t) {])]);}- return Gt([+ return Ht(["0x03",ms([n,@@ -41875,28 +41884,28 @@ function NN(i, e, t) {])]);}- return Gt(["0x03", ms(n)]);+ return Ht(["0x03", ms(n)]);}-function LN(i) {- const e = pc(dt(i).slice(1));- V(Array.isArray(e) && (e.length === 10 || e.length === 13), "invalid field count for transaction type: 4", "data", Se(i));+function qD(i) {+ const e = gc(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,- chainId: Dt(e[0], "chainId"),- nonce: Gr(e[1], "nonce"),- maxPriorityFeePerGas: Dt(e[2], "maxPriorityFeePerGas"),- maxFeePerGas: Dt(e[3], "maxFeePerGas"),+ chainId: Nt(e[0], "chainId"),+ nonce: zr(e[1], "nonce"),+ maxPriorityFeePerGas: Nt(e[2], "maxPriorityFeePerGas"),+ maxFeePerGas: Nt(e[3], "maxFeePerGas"),gasPrice: null,- gasLimit: Dt(e[4], "gasLimit"),- to: Ja(e[5]),- value: Dt(e[6], "value"),- data: Se(e[7]),- accessList: Sh(e[8], "accessList"),- authorizationList: vN(e[9], "authorizationList")+ gasLimit: Nt(e[4], "gasLimit"),+ to: Za(e[5]),+ value: Nt(e[6], "value"),+ data: Ie(e[7]),+ accessList: Mh(e[8], "accessList"),+ authorizationList: LD(e[9], "authorizationList")};- return e.length === 10 || Mh(t, e.slice(10)), t;+ return e.length === 10 || Th(t, e.slice(10)), t;}-function PN(i, e) {+function KD(i, e) {const t = [Et(i.chainId, "chainId"),Et(i.nonce, "nonce"),@@ -41906,12 +41915,12 @@ function PN(i, e) {i.to || "0x",Et(i.value, "value"),i.data,- Ih(i.accessList || []),- CN(i.authorizationList || [])+ Bh(i.accessList || []),+ PD(i.authorizationList || [])];- return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Gt(["0x04", ms(t)]);+ return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Ht(["0x04", ms(t)]);}-class yi {+class _i {#e;#t;#n;@@ -41996,7 +42005,7 @@ class yi {*/get to() {const e = this.#t;- return e == null && this.type === 3 ? nc : e;+ return e == null && this.type === 3 ? sc : e;}set to(e) {this.#t = e == null ? null : Mt(e);@@ -42017,7 +42026,7 @@ class yi {return this.#s;}set gasLimit(e) {- this.#s = Ne(e);+ this.#s = De(e);}/*** The gas price.@@ -42027,10 +42036,10 @@ class yi {*/get gasPrice() {const e = this.#a;- return e == null && (this.type === 0 || this.type === 1) ? yn : e;+ return e == null && (this.type === 0 || this.type === 1) ? _n : e;}set gasPrice(e) {- this.#a = e == null ? null : Ne(e, "gasPrice");+ this.#a = e == null ? null : De(e, "gasPrice");}/*** The maximum priority fee per unit of gas to pay. On legacy@@ -42038,10 +42047,10 @@ class yi {*/get maxPriorityFeePerGas() {const e = this.#r;- return e ?? (this.type === 2 || this.type === 3 ? yn : null);+ return e ?? (this.type === 2 || this.type === 3 ? _n : null);}set maxPriorityFeePerGas(e) {- this.#r = e == null ? null : Ne(e, "maxPriorityFeePerGas");+ this.#r = e == null ? null : De(e, "maxPriorityFeePerGas");}/*** The maximum total fee per unit of gas to pay. On legacy@@ -42049,10 +42058,10 @@ class yi {*/get maxFeePerGas() {const e = this.#o;- return e ?? (this.type === 2 || this.type === 3 ? yn : null);+ return e ?? (this.type === 2 || this.type === 3 ? _n : null);}set maxFeePerGas(e) {- this.#o = e == null ? null : Ne(e, "maxFeePerGas");+ this.#o = e == null ? null : De(e, "maxFeePerGas");}/*** The transaction data. For ``init`` transactions this is the@@ -42062,7 +42071,7 @@ class yi {return this.#n;}set data(e) {- this.#n = Se(e);+ this.#n = Ie(e);}/*** The amount of ether (in wei) to send in this transactions.@@ -42071,7 +42080,7 @@ class yi {return this.#f;}set value(e) {- this.#f = Ne(e, "value");+ this.#f = De(e, "value");}/*** The chain ID this transaction is valid on.@@ -42080,7 +42089,7 @@ class yi {return this.#l;}set chainId(e) {- this.#l = Ne(e);+ this.#l = De(e);}/*** If signed, the signature for this transaction.@@ -42114,24 +42123,24 @@ class yi {return e ?? (this.type === 1 || this.type === 2 || this.type === 3 ? [] : null);}set accessList(e) {- this.#A = e == null ? null : Qr(e);+ this.#A = e == null ? null : Hr(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) => Wb(t));+ this.#x = e == null ? null : e.map((t) => Yb(t));}/*** The max fee per blob gas for Cancun transactions.*/get maxFeePerBlobGas() {const e = this.#c;- return e == null && this.type === 3 ? yn : e;+ return e == null && this.type === 3 ? _n : e;}set maxFeePerBlobGas(e) {- this.#c = e == null ? null : Ne(e, "maxFeePerBlobGas");+ this.#c = e == null ? null : De(e, "maxFeePerBlobGas");}/*** The BLOb versioned hashes for Cancun transactions.@@ -42187,24 +42196,24 @@ class yi {const t = [], n = [];for (let s = 0; s < e.length; s++) {const r = e[s];- if (dp(r)) {+ if (Ap(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 <= Yu, "blob is too large", `blobs[${s}]`, r), a.length !== Yu) {- const l = new Uint8Array(Yu);+ if (V(a.length <= $u, "blob is too large", `blobs[${s}]`, r), a.length !== $u) {+ const l = new Uint8Array($u);l.set(a), a = l;}- const o = this.#u.blobToKzgCommitment(a), c = Se(this.#u.computeBlobKzgProof(a, o));+ const o = this.#u.blobToKzgCommitment(a), c = Ie(this.#u.computeBlobKzgProof(a, o));t.push({- data: Se(a),- commitment: Se(o),+ data: Ie(a),+ commitment: Ie(o),proof: c- }), n.push(vm(1, o));+ }), n.push(Sm(1, o));} else {- const a = Se(r.data), o = Se(r.commitment), c = Se(r.proof);- t.push({ data: a, commitment: o, proof: c }), n.push(vm(1, o));+ 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));}}this.#d = t, this.#h = n;@@ -42213,7 +42222,7 @@ class yi {return this.#u;}set kzg(e) {- e == null ? this.#u = null : this.#u = wN(e);+ e == null ? this.#u = null : this.#u = DD(e);}get blobWrapperVersion() {return this.#g;@@ -42225,7 +42234,7 @@ class yi {* Creates a new Transaction with default values.*/constructor() {- this.#e = null, this.#t = null, this.#i = 0, this.#s = yn, this.#a = null, this.#r = null, this.#o = null, this.#n = "0x", this.#f = yn, this.#l = yn, this.#p = null, this.#A = null, this.#c = null, this.#h = null, this.#u = null, this.#d = null, this.#x = null, this.#g = null;+ 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;}/*** The transaction hash, if signed. Otherwise, ``null``.@@ -42246,7 +42255,7 @@ class yi {* The sending address, if signed. Otherwise, ``null``.*/get from() {- return this.signature == null ? null : gN(this.unsignedHash, this.signature.getCanonical());+ return this.signature == null ? null : SD(this.unsignedHash, this.signature.getCanonical());}/*** The public key of the sender, if signed. Otherwise, ``null``.@@ -42268,15 +42277,15 @@ class yi {const n = e ? this.signature : null;switch (this.inferType()) {case 0:- return MN(this, n);+ return OD(this, n);case 1:- return FN(this, n);+ return zD(this, n);case 2:- return TN(this, n);+ return GD(this, n);case 3:- return NN(this, n, t ? this.blobs : null);+ return WD(this, n, t ? this.blobs : null);case 4:- return PN(this, n);+ return KD(this, n);}ge(!1, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" });}@@ -42360,7 +42369,7 @@ class yi {* Create a copy of this transaciton.*/clone() {- return yi.from(this);+ return _i.from(this);}/*** Return a JSON-friendly object.@@ -42383,7 +42392,7 @@ class yi {accessList: this.accessList};}- [yN]() {+ [ND]() {return this.toString();}toString() {@@ -42409,39 +42418,39 @@ class yi {*/static from(e) {if (e == null)- return new yi();+ return new _i();if (typeof e == "string") {const n = dt(e);if (n[0] >= 127)- return yi.from(IN(n));+ return _i.from(UD(n));switch (n[0]) {case 1:- return yi.from(RN(n));+ return _i.from(HD(n));case 2:- return yi.from(BN(n));+ return _i.from(QD(n));case 3:- return yi.from(DN(n));+ return _i.from(VD(n));case 4:- return yi.from(LN(n));+ return _i.from(qD(n));}ge(!1, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" });}- const t = new yi();+ const t = new _i();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 Lr(i) {+function kr(i) {return sn(gs(i));}-var kN = "AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFM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NEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";-const Cm = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]), Sm = 4;-function UN(i) {+var jD = "AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQ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GSkr/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) {let e = 0;function t() {return i[e++] << 8 | i[e++];}let n = t(), s = 1, r = [0, 1];- for (let I = 1; I < n; I++)+ for (let S = 1; S < n; S++)r.push(s += t());let a = t(), o = e;e += a;@@ -42451,26 +42460,26 @@ function UN(i) {}const u = 31, d = 2 ** u, f = d >>> 1, p = f >> 1, m = d - 1;let g = 0;- for (let I = 0; I < u; I++) g = g << 1 | h();- let A = [], y = 0, x = d;+ for (let S = 0; S < u; S++) g = g << 1 | h();+ let A = [], _ = 0, x = d;for (; ; ) {- let I = Math.floor(((g - y + 1) * s - 1) / x), w = 0, S = n;- for (; S - w > 1; ) {- let v = w + S >>> 1;- I < r[v] ? S = v : w = v;+ 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 = y + Math.floor(x * r[w] / s), C = y + Math.floor(x * r[w + 1] / s) - 1;+ 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;- y = T, x = 1 + C - T;+ _ = T, x = 1 + C - T;}let E = n - 4;- return A.map((I) => {- switch (I - E) {+ return A.map((S) => {+ switch (S - E) {case 3:return E + 65792 + (i[o++] << 16 | i[o++] << 8 | i[o++]);case 2:@@ -42478,18 +42487,18 @@ function UN(i) {case 1:return E + i[o++];default:- return I - 1;+ return S - 1;}});}-function ON(i) {+function YD(i) {let e = 0;return () => i[e++];}-function qb(i) {- return ON(UN(QN(i)));+function Jb(i) {+ return YD(XD(JD(i)));}-function QN(i) {+function JD(i) {let e = [];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s, r) => e[s.charCodeAt(0)] = r);let t = i.length, n = new Uint8Array(6 * t >> 3);@@ -42497,15 +42506,15 @@ function QN(i) {o = o << 6 | e[i.charCodeAt(s)], a += 6, a >= 8 && (n[r++] = o >> (a -= 8));return n;}-function GN(i) {+function ZD(i) {return i & 1 ? ~i >> 1 : i >> 1;}-function HN(i, e) {+function $D(i, e) {let t = Array(i);- for (let n = 0, s = 0; n < i; n++) t[n] = s += GN(e());+ for (let n = 0, s = 0; n < i; n++) t[n] = s += ZD(e());return t;}-function ic(i, e = 0) {+function rc(i, e = 0) {let t = [];for (; ; ) {let n = i(), s = i();@@ -42517,27 +42526,27 @@ function ic(i, e = 0) {}return t;}-function Kb(i) {- return sc(() => {- let e = ic(i);+function Zb(i) {+ return ac(() => {+ let e = rc(i);if (e.length) return e;});}-function jb(i) {+function $b(i) {let e = [];for (; ; ) {let t = i();if (t == 0) break;- e.push(zN(t, i));+ e.push(eL(t, i));}for (; ; ) {let t = i() - 1;if (t < 0) break;- e.push(VN(t, i));+ e.push(tL(t, i));}return e.flat();}-function sc(i) {+function ac(i) {let e = [];for (; ; ) {let t = i(e.length);@@ -42546,15 +42555,15 @@ function sc(i) {}return e;}-function Xb(i, e, t) {+function eE(i, e, t) {let n = Array(i).fill().map(() => []);for (let s = 0; s < e; s++)- HN(i, t).forEach((r, a) => n[a].push(r));+ $D(i, t).forEach((r, a) => n[a].push(r));return n;}-function zN(i, e) {- let t = 1 + e(), n = e(), s = sc(e);- return Xb(s.length, 1 + i, e).flatMap((a, o) => {+function eL(i, e) {+ let t = 1 + e(), n = e(), s = ac(e);+ return eE(s.length, 1 + i, e).flatMap((a, o) => {let [c, ...l] = a;return Array(s[o]).fill().map((h, u) => {let d = u * n;@@ -42562,16 +42571,16 @@ function zN(i, e) {});});}-function VN(i, e) {+function tL(i, e) {let t = 1 + e();- return Xb(t, 1 + i, e).map((s) => [s[0], s.slice(1)]);+ return eE(t, 1 + i, e).map((s) => [s[0], s.slice(1)]);}-function WN(i) {- let e = [], t = ic(i);+function nL(i) {+ let e = [], t = rc(i);return s(n([]), []), e;function n(r) {- let a = i(), o = sc(() => {- let c = ic(i).map((l) => t[l]);+ 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 };@@ -42585,13 +42594,13 @@ function WN(i) {}}}-function qN(i) {+function iL(i) {return i.toString(16).toUpperCase().padStart(2, "0");}-function Yb(i) {- return `{${qN(i)}}`;+function tE(i) {+ return `{${iL(i)}}`;}-function KN(i) {+function sL(i) {let e = [];for (let t = 0, n = i.length; t < n; ) {let s = i.codePointAt(t);@@ -42599,7 +42608,7 @@ function KN(i) {}return e;}-function Qa(i) {+function Ga(i) {let t = i.length;if (t < 4096) return String.fromCodePoint(...i);let n = [];@@ -42607,69 +42616,69 @@ function Qa(i) {n.push(String.fromCodePoint(...i.slice(s, s += 4096)));return n.join("");}-function jN(i, e) {+function rL(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 XN = "AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ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0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";-const rc = 44032, th = 4352, nh = 4449, ih = 4519, Jb = 19, Zb = 21, Ga = 28, sh = Zb * Ga, YN = Jb * sh, JN = rc + YN, ZN = th + Jb, $N = nh + Zb, eL = ih + Ga;-function Co(i) {+var aL = "AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcM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jcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";+const oc = 44032, ih = 4352, sh = 4449, rh = 4519, nE = 19, iE = 21, Ha = 28, ah = iE * Ha, oL = nE * ah, cL = oc + oL, lL = ih + nE, hL = sh + iE, uL = rh + Ha;+function So(i) {return i >> 24 & 255;}-function $b(i) {+function sE(i) {return i & 16777215;}-let gf, Im, mf, Bl;-function tL() {- let i = qb(XN);- gf = new Map(Kb(i).flatMap((e, t) => e.map((n) => [n, t + 1 << 24]))), Im = new Set(ic(i)), mf = /* @__PURE__ */ new Map(), Bl = /* @__PURE__ */ new Map();- for (let [e, t] of jb(i)) {- if (!Im.has(e) && t.length == 2) {- let [n, s] = t, r = Bl.get(n);- r || (r = /* @__PURE__ */ new Map(), Bl.set(n, r)), r.set(s, e);+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);}- mf.set(e, t.reverse());+ Ef.set(e, t.reverse());}}-function eE(i) {- return i >= rc && i < JN;+function rE(i) {+ return i >= oc && i < cL;}-function nL(i, e) {- if (i >= th && i < ZN && e >= nh && e < $N)- return rc + (i - th) * sh + (e - nh) * Ga;- if (eE(i) && e > ih && e < eL && (i - rc) % Ga == 0)- return i + (e - ih);+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);{- let t = Bl.get(i);+ let t = Rl.get(i);return t && (t = t.get(e), t) ? t : -1;}}-function tE(i) {- gf || tL();+function aE(i) {+ bf || dL();let e = [], t = [], n = !1;function s(r) {- let a = gf.get(r);+ let a = bf.get(r);a && (n = !0, r |= a), e.push(r);}for (let r of i)for (; ; ) {if (r < 128)e.push(r);- else if (eE(r)) {- let a = r - rc, o = a / sh | 0, c = a % sh / Ga | 0, l = a % Ga;- s(th + o), s(nh + c), l > 0 && s(ih + l);+ 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 {- let a = mf.get(r);+ let a = Ef.get(r);a ? t.push(...a) : s(r);}if (!t.length) break;r = t.pop();}if (n && e.length > 1) {- let r = Co(e[0]);+ let r = So(e[0]);for (let a = 1; a < e.length; a++) {- let o = Co(e[a]);+ let o = So(e[a]);if (o == 0 || r <= o) {r = o;continue;@@ -42677,185 +42686,185 @@ function tE(i) {let c = a - 1;for (; ; ) {let l = e[c + 1];- if (e[c + 1] = e[c], e[c] = l, !c || (r = Co(e[--c]), r <= o)) break;+ if (e[c + 1] = e[c], e[c] = l, !c || (r = So(e[--c]), r <= o)) break;}- r = Co(e[a]);+ r = So(e[a]);}}return e;}-function iL(i) {+function pL(i) {let e = [], t = [], n = -1, s = 0;for (let r of i) {- let a = Co(r), o = $b(r);+ let a = So(r), o = sE(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 = nL(n, o);+ let c = fL(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 nE(i) {- return tE(i).map($b);+function oE(i) {+ return aE(i).map(sE);}-function sL(i) {- return iL(tE(i));+function AL(i) {+ return pL(aE(i));}-const Mm = 45, iE = ".", sE = 65039, rE = 1, rh = (i) => Array.from(i);-function ac(i, e) {+const Rm = 45, cE = ".", lE = 65039, hE = 1, oh = (i) => Array.from(i);+function cc(i, e) {return i.P.has(e) || i.Q.has(e);}-class rL extends Array {+class gL extends Array {get is_emoji() {return !0;}// free tagging system}-let xf, aE, _r, bf, oE, Ma, Ju, da, dr, Bm, Ef;-function vp() {- if (xf) return;- let i = qb(kN);- const e = () => ic(i), t = () => new Set(e()), n = (h, u) => u.forEach((d) => h.add(d));- xf = new Map(jb(i)), aE = t(), _r = e(), bf = new Set(e().map((h) => _r[h])), _r = new Set(_r), oE = t(), t();- let s = Kb(i), r = i();+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();const a = () => {let h = /* @__PURE__ */ new Set();return e().forEach((u) => n(h, s[u])), n(h, e()), h;};- Ma = sc((h) => {- let u = sc(i).map((d) => d + 96);+ Ta = ac((h) => {+ let u = ac(i).map((d) => d + 96);if (u.length) {let d = h >= r;- u[0] -= 32, u = Qa(u), d && (u = `Restricted[${u}]`);+ u[0] -= 32, u = Ga(u), d && (u = `Restricted[${u}]`);let f = a(), p = a(), m = !i();return { N: u, P: f, Q: p, M: m, R: d };}- }), Ju = t(), da = /* @__PURE__ */ new Map();- let o = e().concat(rh(Ju)).sort((h, u) => h - u);+ }), ed = t(), pa = /* @__PURE__ */ new Map();+ let o = e().concat(oh(ed)).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), Ju.has(h) || da.set(h, f);+ f.V.push(h), ed.has(h) || pa.set(h, f);});- for (let { V: h, M: u } of new Set(da.values())) {+ for (let { V: h, M: u } of new Set(pa.values())) {let d = [];for (let p of h) {- let m = Ma.filter((A) => ac(A, p)), g = d.find(({ G: A }) => m.some((y) => A.has(y)));+ let m = Ta.filter((A) => cc(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) => rh(p.G));+ let f = d.flatMap((p) => oh(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 = /* @__PURE__ */ new Set();+ fr = /* @__PURE__ */ new Set();let c = /* @__PURE__ */ new Set();- const l = (h) => dr.has(h) ? c.add(h) : dr.add(h);- for (let h of Ma) {+ const l = (h) => fr.has(h) ? c.add(h) : fr.add(h);+ for (let h of Ta) {for (let u of h.P) l(u);for (let u of h.Q) l(u);}- for (let h of dr)- !da.has(h) && !c.has(h) && da.set(h, rE);- n(dr, nE(dr)), Bm = WN(i).map((h) => rL.from(h)).sort(jN), Ef = /* @__PURE__ */ new Map();- for (let h of Bm) {- let u = [Ef];+ 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];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 === sE ? u.push(...f) : u = f;+ d === lE ? u.push(...f) : u = f;}for (let d of u)d.V = h;}}-function Cp(i) {- return (cE(i) ? "" : `${Sp(Bh([i]))} `) + Yb(i);+function Mp(i) {+ return (fE(i) ? "" : `${Bp(Rh([i]))} `) + tE(i);}-function Sp(i) {+function Bp(i) {return `"${i}"`;}-function aL(i) {- if (i.length >= 4 && i[2] == Mm && i[3] == Mm)- throw new Error(`invalid label extension: "${Qa(i.slice(0, 4))}"`);+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 oL(i) {+function xL(i) {for (let t = i.lastIndexOf(95); t > 0; )if (i[--t] !== 95)throw new Error("underscore allowed only at start");}-function cL(i) {- let e = i[0], t = Cm.get(e);- if (t) throw Po(`leading ${t}`);+function bL(i) {+ let e = i[0], t = Mm.get(e);+ if (t) throw Uo(`leading ${t}`);let n = i.length, s = -1;for (let r = 1; r < n; r++) {e = i[r];- let a = Cm.get(e);+ let a = Mm.get(e);if (a) {- if (s == r) throw Po(`${t} + ${a}`);+ if (s == r) throw Uo(`${t} + ${a}`);s = r + 1, t = a;}}- if (s == n) throw Po(`trailing ${t}`);+ if (s == n) throw Uo(`trailing ${t}`);}-function Bh(i, e = 1 / 0, t = Yb) {+function Rh(i, e = 1 / 0, t = tE) {let n = [];- lL(i[0]) && n.push("◌"), i.length > e && (e >>= 1, i = [...i.slice(0, e), 8230, ...i.slice(-e)]);+ EL(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];- cE(o) && (n.push(Qa(i.slice(s, a))), n.push(t(o)), s = a + 1);+ fE(o) && (n.push(Ga(i.slice(s, a))), n.push(t(o)), s = a + 1);}- return n.push(Qa(i.slice(s, r))), n.join("");+ return n.push(Ga(i.slice(s, r))), n.join("");}-function lL(i) {- return vp(), _r.has(i);+function EL(i) {+ return Sp(), wr.has(i);}-function cE(i) {- return vp(), oE.has(i);+function fE(i) {+ return Sp(), dE.has(i);}-function hL(i) {- return pL(uL(i, sL, mL));+function yL(i) {+ return CL(_L(i, AL, ML));}-function uL(i, e, t) {+function _L(i, e, t) {if (!i) return [];- vp();+ Sp();let n = 0;- return i.split(iE).map((s) => {- let r = KN(s), a = {+ return i.split(cE).map((s) => {+ let r = sL(s), a = {input: r,offset: n// codepoint, not substring!};n += r.length + 1;try {- let o = a.tokens = gL(r, e, t), c = o.length, l;+ let o = a.tokens = SL(r, e, t), c = o.length, l;if (!c)throw new Error("empty label");let h = a.output = o.flat();- if (oL(h), !(a.emoji = c > 1 || o[0].is_emoji) && h.every((d) => d < 128))- aL(h), l = "ASCII";+ if (xL(h), !(a.emoji = c > 1 || o[0].is_emoji) && h.every((d) => d < 128))+ mL(h), l = "ASCII";else {let d = o.flatMap((f) => f.is_emoji ? [] : f);if (!d.length)l = "Emoji";else {- if (_r.has(h[0])) throw Po("leading combining mark");+ if (wr.has(h[0])) throw Uo("leading combining mark");for (let m = 1; m < c; m++) {let g = o[m];- if (!g.is_emoji && _r.has(g[0]))- throw Po(`emoji + combining mark: "${Qa(o[m - 1])} + ${Bh([g[0]])}"`);+ if (!g.is_emoji && wr.has(g[0]))+ throw Uo(`emoji + combining mark: "${Ga(o[m - 1])} + ${Rh([g[0]])}"`);}- cL(h);- let f = rh(new Set(d)), [p] = fL(f);- AL(p, d), dL(p, f), l = p.N;+ bL(h);+ let f = oh(new Set(d)), [p] = vL(f);+ IL(p, d), wL(p, f), l = p.N;}}a.type = l;@@ -42865,172 +42874,172 @@ function uL(i, e, t) {return a;});}-function dL(i, e) {+function wL(i, e) {let t, n = [];for (let s of e) {- let r = da.get(s);- if (r === rE) return;+ let r = pa.get(s);+ if (r === hE) return;if (r) {let a = r.M.get(s);- if (t = t ? t.filter((o) => a.has(o)) : rh(a), !t.length) return;+ if (t = t ? t.filter((o) => a.has(o)) : oh(a), !t.length) return;} elsen.push(s);}if (t) {for (let s of t)- if (n.every((r) => ac(s, r)))+ if (n.every((r) => cc(s, r)))throw new Error(`whole-script confusable: ${i.N}/${s.N}`);}}-function fL(i) {- let e = Ma;+function vL(i) {+ let e = Ta;for (let t of i) {- let n = e.filter((s) => ac(s, t));+ let n = e.filter((s) => cc(s, t));if (!n.length)- throw Ma.some((s) => ac(s, t)) ? hE(e[0], t) : lE(t);+ throw Ta.some((s) => cc(s, t)) ? AE(e[0], t) : pE(t);if (e = n, n.length == 1) break;}return e;}-function pL(i) {+function CL(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 ${Sp(Bh(e, 63))}: ${s}`);+ throw new Error(i.length == 1 ? s : `Invalid label ${Bp(Rh(e, 63))}: ${s}`);}- return Qa(n);- }).join(iE);+ return Ga(n);+ }).join(cE);}-function lE(i) {- return new Error(`disallowed character: ${Cp(i)}`);+function pE(i) {+ return new Error(`disallowed character: ${Mp(i)}`);}-function hE(i, e) {- let t = Cp(e), n = Ma.find((s) => s.P.has(e));+function AE(i, e) {+ let t = Mp(e), n = Ta.find((s) => s.P.has(e));return n && (t = `${n.N} ${t}`), new Error(`illegal mixture: ${i.N} + ${t}`);}-function Po(i) {+function Uo(i) {return new Error(`illegal placement: ${i}`);}-function AL(i, e) {+function IL(i, e) {for (let t of e)- if (!ac(i, t))- throw hE(i, t);+ if (!cc(i, t))+ throw AE(i, t);if (i.M) {- let t = nE(e);+ let t = oE(e);for (let n = 1, s = t.length; n < s; n++)- if (bf.has(t[n])) {+ if (_f.has(t[n])) {let r = n + 1;- for (let a; r < s && bf.has(a = t[r]); r++)+ for (let a; r < s && _f.has(a = t[r]); r++)for (let o = n; o < r; o++)if (t[o] == a)- throw new Error(`duplicate non-spacing marks: ${Cp(a)}`);- if (r - n > Sm)- throw new Error(`excessive non-spacing marks: ${Sp(Bh(t.slice(n - 1, r)))} (${r - n}/${Sm})`);+ 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})`);n = r;}}}-function gL(i, e, t) {+function SL(i, e, t) {let n = [], s = [];for (i = i.slice().reverse(); i.length; ) {- let r = xL(i);+ let r = BL(i);if (r)s.length && (n.push(e(s)), s = []), n.push(t(r));else {let a = i.pop();- if (dr.has(a))+ if (fr.has(a))s.push(a);else {- let o = xf.get(a);+ let o = yf.get(a);if (o)s.push(...o);- else if (!aE.has(a))- throw lE(a);+ else if (!uE.has(a))+ throw pE(a);}}}return s.length && n.push(e(s)), n;}-function mL(i) {- return i.filter((e) => e != sE);+function ML(i) {+ return i.filter((e) => e != lE);}-function xL(i, e) {- let t = Ef, n, s = i.length;+function BL(i, e) {+ let t = wf, 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 uE = new Uint8Array(32);-uE.fill(0);-function Tm(i) {+const gE = new Uint8Array(32);+gE.fill(0);+function Nm(i) {return V(i.length !== 0, "invalid ENS name; empty component", "comp", i), i;}-function dE(i) {- const e = gs(bL(i)), t = [];+function mE(i) {+ const e = gs(TL(i)), t = [];if (i.length === 0)return t;let n = 0;for (let s = 0; s < e.length; s++)- e[s] === 46 && (t.push(Tm(e.slice(n, s))), n = s + 1);- return V(n < e.length, "invalid ENS name; empty component", "name", i), t.push(Tm(e.slice(n))), t;+ 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;}-function bL(i) {+function TL(i) {try {if (i.length === 0)throw new Error("empty label");- return hL(i);+ return yL(i);} catch (e) {V(!1, `invalid ENS name (${e.message})`, "name", i);}}-function _f(i) {+function vf(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 = uE;- const t = dE(i);+ let e = gE;+ const t = mE(i);for (; t.length; )- e = sn(Gt([e, sn(t.pop())]));- return Se(e);+ e = sn(Ht([e, sn(t.pop())]));+ return Ie(e);}-function EL(i, e) {+function RL(i, e) {const t = e;- return V(t <= 255, "DNS encoded label cannot exceed 255", "length", t), Se(Gt(dE(i).map((n) => {+ return V(t <= 255, "DNS encoded label cannot exceed 255", "length", t), Ie(Ht(mE(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 fE = new Uint8Array(32);-fE.fill(0);-const _L = BigInt(-1), pE = BigInt(0), AE = BigInt(1), yL = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");-function wL(i) {+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 e = dt(i), t = e.length % 32;- return t ? Gt([e, fE.slice(t)]) : Se(e);+ return t ? Ht([e, xE.slice(t)]) : Ie(e);}-const vL = Xs(AE, 32), CL = Xs(pE, 32), Rm = {+const LL = Ys(EE, 32), PL = Ys(bE, 32), Dm = {name: "string",version: "string",chainId: "uint256",verifyingContract: "address",salt: "bytes32"-}, Zu = [+}, td = ["name","version","chainId","verifyingContract","salt"];-function Fm(i) {+function Lm(i) {return function(e) {return V(typeof e == "string", `invalid domain value for ${JSON.stringify(i)}`, `domain.${i}`, e), e;};}-const SL = {- name: Fm("name"),- version: Fm("version"),+const kL = {+ name: Lm("name"),+ version: Lm("version"),chainId: function(i) {- const e = Ne(i, "domain.chainId");+ const e = De(i, "domain.chainId");return V(e >= 0, "invalid chain ID", "domain.chainId", i), Number.isSafeInteger(e) ? Number(e) : wi(e);},verifyingContract: function(i) {@@ -43042,19 +43051,19 @@ const SL = {},salt: function(i) {const e = dt(i, "domain.salt");- return V(e.length === 32, 'invalid domain value "salt"', "domain.salt", i), Se(e);+ return V(e.length === 32, 'invalid domain value "salt"', "domain.salt", i), Ie(e);}};-function $u(i) {+function nd(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 = vo(yL, t ? n - 1 : n), r = t ? (s + AE) * _L : pE;+ const s = Io(NL, t ? n - 1 : n), r = t ? (s + EE) * FL : bE;return function(a) {- const o = Ne(a, "value");- return V(o >= r && o <= s, `value out-of-bounds for ${i}`, "value", o), Xs(t ? ib(o, 256) : o, 32);+ 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);};}}@@ -43064,7 +43073,7 @@ function $u(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), wL(n);+ return V(s.length === t, `invalid length for ${i}`, "value", n), DL(n);};}}@@ -43075,7 +43084,7 @@ function $u(i) {};case "bool":return function(e) {- return e ? vL : CL;+ return e ? LL : PL;};case "bytes":return function(e) {@@ -43083,15 +43092,15 @@ function $u(i) {};case "string":return function(e) {- return Lr(e);+ return kr(e);};}return null;}-function Dm(i, e) {+function Pm(i, e) {return `${i}(${e.map(({ name: t, type: n }) => n + " " + t).join(",")})`;}-function bl(i) {+function yl(i) {const e = i.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e ? {base: e[1],@@ -43134,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 } = bl(h);+ let { base: u, index: d } = yl(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);@@ -43142,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 = bl(h.type).base;- V(u !== c, `circular type reference to ${JSON.stringify(u)}`, "types", e), !$u(u) && (V(n.has(u), `unknown type ${JSON.stringify(u)}`, "types", e), n.get(u).push(c), t.get(c).add(u));+ 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 a = Array.from(n.keys()).filter((c) => n.get(c).length === 0);@@ -43161,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, Dm(c, r[c]) + h.map((u) => Dm(u, r[u])).join(""));+ h.sort(), this.#t.set(c, Pm(c, r[c]) + h.map((u) => Pm(u, r[u])).join(""));}}/**@@ -43173,28 +43182,28 @@ class $n {}#i(e) {{- const s = $u(e);+ const s = nd(e);if (s)return s;}- const t = bl(e).array;+ const t = yl(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(sn)), sn(Gt(o));+ return this.#t.has(s) && (o = o.map(sn)), sn(Ht(o));};}const n = this.types[e];if (n) {- const s = Lr(this.#t.get(e));+ const s = kr(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) ? sn(l) : l;});- return a.unshift(s), Gt(a);+ return a.unshift(s), Ht(a);};}V(!1, `unknown type: ${e}`, "type", e);@@ -43234,9 +43243,9 @@ class $n {* @_ignore:*/_visit(e, t, n) {- if ($u(e))+ if (nd(e))return n(e, t);- const s = bl(e).array;+ const s = yl(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];@@ -43280,16 +43289,16 @@ class $n {for (const n in e) {if (e[n] == null)continue;- const s = Rm[n];+ const s = Dm[n];V(s, `invalid typed-data domain key: ${JSON.stringify(n)}`, "domain", e), t.push({ name: n, type: s });}- return t.sort((n, s) => Zu.indexOf(n.name) - Zu.indexOf(s.name)), $n.hashStruct("EIP712Domain", { EIP712Domain: t }, e);+ return t.sort((n, s) => td.indexOf(n.name) - td.indexOf(s.name)), $n.hashStruct("EIP712Domain", { EIP712Domain: t }, e);}/*** Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.*/static encode(e, t, n) {- return Gt([+ return Ht(["0x1901",$n.hashDomain(e),$n.from(t).hash(n)@@ -43325,9 +43334,9 @@ class $n {static getPayload(e, t, n) {$n.hashDomain(e);const s = {}, r = [];- Zu.forEach((c) => {+ td.forEach((c) => {const l = e[c];- l != null && (s[c] = SL[c](l), r.push({ name: c, type: Rm[c] }));+ l != null && (s[c] = kL[c](l), r.push({ name: c, type: Dm[c] }));});const a = $n.from(t);t = a.types;@@ -43338,9 +43347,9 @@ class $n {primaryType: a.primaryType,message: a.visit(n, (c, l) => {if (c.match(/^bytes(\d*)/))- return Se(dt(l));+ return Ie(dt(l));if (c.match(/^u?int/))- return Ne(l).toString();+ return De(l).toString();switch (c) {case "address":return l.toLowerCase();@@ -43358,14 +43367,14 @@ function zn(i) {const e = /* @__PURE__ */ new Set();return i.forEach((t) => e.add(t)), Object.freeze(e);}-const IL = "external public payable override", ML = zn(IL.split(" ")), gE = "constant external internal payable private public pure view override", BL = zn(gE.split(" ")), mE = "constructor error event fallback function receive struct", xE = zn(mE.split(" ")), bE = "calldata memory storage payable indexed", TL = zn(bE.split(" ")), RL = "tuple returns", FL = [mE, bE, RL, gE].join(" "), DL = zn(FL.split(" ")), NL = {+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 = {"(": "OPEN_PAREN",")": "CLOSE_PAREN","[": "OPEN_BRACKET","]": "CLOSE_BRACKET",",": "COMMA","@": "AT"-}, LL = new RegExp("^(\\s*)"), PL = new RegExp("^([0-9]+)"), kL = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), EE = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), _E = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");+}, 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 {#e;#t;@@ -43458,18 +43467,18 @@ class pi {return `<TokenString ${e.join(" ")}>`;}}-function $s(i) {+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(LL);+ let a = i.substring(r), o = a.match(qL);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 = NL[a[0]] || "";+ let l = WL[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);@@ -43491,19 +43500,19 @@ function $s(i) {}continue;}- if (o = a.match(kL), o) {- if (c.text = o[1], r += c.text.length, DL.has(c.text)) {+ if (o = a.match(jL), o) {+ if (c.text = o[1], r += c.text.length, VL.has(c.text)) {c.type = "KEYWORD";continue;}- if (c.text.match(_E)) {+ if (c.text.match(IE)) {c.type = "TYPE";continue;}c.type = "ID";continue;}- if (o = a.match(PL), o) {+ if (o = a.match(KL), o) {c.text = o[1], c.type = "NUMBER", r += c.text.length;continue;}@@ -43511,22 +43520,22 @@ function $s(i) {}return new pi(e.map((a) => Object.freeze(a)));}-function Nm(i, e) {+function km(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 Th(i, e) {- if (e.peekKeyword(xE)) {+function Fh(i, e) {+ if (e.peekKeyword(wE)) {const t = e.pop().text;if (t !== i)throw new Error(`expected ${i}, got ${t}`);}return e.popType("ID");}-function _s(i, e) {+function ys(i, e) {const t = /* @__PURE__ */ new Set();for (; ; ) {const n = i.peekType("KEYWORD");@@ -43538,28 +43547,28 @@ function _s(i, e) {}return Object.freeze(t);}-function yE(i) {- let e = _s(i, BL);- return Nm(e, zn("constant payable nonpayable".split(" "))), Nm(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 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 xs(i, e) {return i.popParams().map((t) => Pt.from(t, e));}-function wE(i) {+function ME(i) {if (i.peekType("AT")) {if (i.pop(), i.peekType("NUMBER"))- return Ne(i.pop().text);+ return De(i.pop().text);throw new Error("invalid gas");}return null;}-function Pr(i) {+function Ur(i) {if (i.length)throw new Error(`unexpected tokens at offset ${i.offset}: ${i.toString()}`);}-const UL = new RegExp(/^(.*)\[([0-9]*)\]$/);-function Lm(i) {- const e = i.match(_E);+const XL = new RegExp(/^(.*)\[([0-9]*)\]$/);+function Um(i) {+ const e = i.match(IE);if (V(e, "invalid type", "type", i), i === "uint")return "uint256";if (i === "int")@@ -43573,7 +43582,7 @@ function Lm(i) {}return i;}-const Vt = {}, Xn = /* @__PURE__ */ Symbol.for("_ethers_internal"), Pm = "_ParamTypeInternal", km = "_ErrorInternal", Um = "_EventInternal", Om = "_ConstructorInternal", Qm = "_FallbackInternal", Gm = "_FunctionInternal", Hm = "_StructInternal";+const Vt = {}, Xn = /* @__PURE__ */ Symbol.for("_ethers_internal"), Om = "_ParamTypeInternal", Qm = "_ErrorInternal", Gm = "_EventInternal", Hm = "_ConstructorInternal", zm = "_FallbackInternal", Vm = "_FunctionInternal", Wm = "_StructInternal";class Pt {/*** The local name of the parameter (or ``""`` if unbound)@@ -43616,7 +43625,7 @@ class Pt {* @private*/constructor(e, t, n, s, r, a, o, c) {- if (yh(e, Vt, "ParamType"), Object.defineProperty(this, Xn, { value: Pm }), a && (a = Object.freeze(a.slice())), s === "array") {+ if (vh(e, Vt, "ParamType"), Object.defineProperty(this, Xn, { value: Om }), a && (a = Object.freeze(a.slice())), s === "array") {if (o == null || c == null)throw new Error("");} else if (o != null || c != null)@@ -43781,20 +43790,20 @@ class Pt {return e;if (typeof e == "string")try {- return Pt.from($s(e), t);+ return Pt.from(er(e), t);} catch {V(!1, "invalid param type", "obj", e);}else if (e instanceof pi) {let o = "", c = "", l = null;- _s(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 = Lm(e.popType("TYPE")), c = o);+ 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);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 (_s(e, TL).has("indexed")) {+ if (ys(e, GL).has("indexed")) {if (!t)throw new Error("");d = !0;@@ -43805,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(EE), "invalid name", "obj.name", n);+ V(!n || typeof n == "string" && n.match(CE), "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);+ let r = e.type, a = r.match(XL);if (a) {const o = parseInt(a[2] || "-1"), c = Pt.from({type: a[1],@@ -43826,16 +43835,16 @@ 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 = Lm(e.type), new Pt(Vt, n || "", r, r, s, null, null, null);+ return r = Um(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] === Pm;+ return e && e[Xn] === Om;}}-class kr {+class Or {/*** The type of the fragment.*/@@ -43848,7 +43857,7 @@ class kr {* @private*/constructor(e, t, n) {- yh(e, Vt, "Fragment"), n = Object.freeze(n.slice()), Ye(this, { type: t, inputs: n });+ vh(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@@ -43857,13 +43866,13 @@ class kr {static from(e) {if (typeof e == "string") {try {- kr.from(JSON.parse(e));+ Or.from(JSON.parse(e));} catch {}- return kr.from($s(e));+ return Or.from(er(e));}if (e instanceof pi)- switch (e.peekKeyword(xE)) {+ switch (e.peekKeyword(wE)) {case "constructor":return fs.from(e);case "error":@@ -43876,7 +43885,7 @@ class kr {case "function":return Qi.from(e);case "struct":- return Cr.from(e);+ return Sr.from(e);}else if (typeof e == "object") {switch (e.type) {@@ -43892,7 +43901,7 @@ class kr {case "function":return Qi.from(e);case "struct":- return Cr.from(e);+ return Sr.from(e);}ge(!1, `unsupported type: ${e.type}`, "UNSUPPORTED_OPERATION", {operation: "Fragment.from"@@ -43928,10 +43937,10 @@ class kr {* Returns true if %%value%% is a [[StructFragment]].*/static isStruct(e) {- return Cr.isFragment(e);+ return Sr.isFragment(e);}}-class Rh extends kr {+class Nh extends Or {/*** The name of the fragment.*/@@ -43940,24 +43949,24 @@ class Rh extends kr {* @private*/constructor(e, t, n, s) {- super(e, t, s), V(typeof n == "string" && n.match(EE), "invalid identifier", "name", n), s = Object.freeze(s.slice()), Ye(this, { name: n });+ super(e, t, s), V(typeof n == "string" && n.match(CE), "invalid identifier", "name", n), s = Object.freeze(s.slice()), Ye(this, { name: n });}}-function oc(i, e) {+function lc(i, e) {return "(" + e.map((t) => t.format(i)).join(i === "full" ? ", " : ",") + ")";}-class jn extends Rh {+class jn extends Nh {/*** @private*/constructor(e, t, n) {- super(e, "error", t, n), Object.defineProperty(this, Xn, { value: km });+ super(e, "error", t, n), Object.defineProperty(this, Xn, { value: Qm });}/*** The Custom Error selector.*/get selector() {- return Lr(this.format("sighash")).substring(0, 10);+ return kr(this.format("sighash")).substring(0, 10);}/*** Returns a string representation of this fragment as %%format%%.@@ -43970,7 +43979,7 @@ class jn extends Rh {inputs: this.inputs.map((n) => JSON.parse(n.format(e)))});const t = [];- return e !== "sighash" && t.push("error"), t.push(this.name + oc(e, this.inputs)), t.join(" ");+ return e !== "sighash" && t.push("error"), t.push(this.name + lc(e, this.inputs)), t.join(" ");}/*** Returns a new **ErrorFragment** for %%obj%%.@@ -43979,10 +43988,10 @@ class jn extends Rh {if (jn.isFragment(e))return e;if (typeof e == "string")- return jn.from($s(e));+ return jn.from(er(e));if (e instanceof pi) {- const t = Th("error", e), n = xs(e);- return Pr(e), new jn(Vt, t, n);+ const t = Fh("error", e), n = xs(e);+ return Ur(e), new jn(Vt, t, n);}return new jn(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);}@@ -43991,10 +44000,10 @@ class jn extends Rh {* **ErrorFragment**.*/static isFragment(e) {- return e && e[Xn] === km;+ return e && e[Xn] === Qm;}}-class Oi extends Rh {+class Oi extends Nh {/*** Whether this event is anonymous.*/@@ -44003,13 +44012,13 @@ class Oi extends Rh {* @private*/constructor(e, t, n, s) {- super(e, "event", t, n), Object.defineProperty(this, Xn, { value: Um }), Ye(this, { anonymous: s });+ super(e, "event", t, n), Object.defineProperty(this, Xn, { value: Gm }), Ye(this, { anonymous: s });}/*** The Event topic hash.*/get topicHash() {- return Lr(this.format("sighash"));+ return kr(this.format("sighash"));}/*** Returns a string representation of this event as %%format%%.@@ -44023,7 +44032,7 @@ class Oi extends Rh {inputs: this.inputs.map((n) => JSON.parse(n.format(e)))});const t = [];- return e !== "sighash" && t.push("event"), t.push(this.name + oc(e, this.inputs)), e !== "sighash" && this.anonymous && t.push("anonymous"), t.join(" ");+ return e !== "sighash" && t.push("event"), t.push(this.name + lc(e, this.inputs)), e !== "sighash" && this.anonymous && t.push("anonymous"), t.join(" ");}/*** Return the topic hash for an event with %%name%% and %%params%%.@@ -44039,13 +44048,13 @@ class Oi extends Rh {return e;if (typeof e == "string")try {- return Oi.from($s(e));+ return Oi.from(er(e));} catch {V(!1, "invalid event fragment", "obj", e);}else if (e instanceof pi) {- const t = Th("event", e), n = xs(e, !0), s = !!_s(e, zn(["anonymous"])).has("anonymous");- return Pr(e), new Oi(Vt, t, n, s);+ 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);}return new Oi(Vt, e.name, e.inputs ? e.inputs.map((t) => Pt.from(t, !0)) : [], !!e.anonymous);}@@ -44054,10 +44063,10 @@ class Oi extends Rh {* **EventFragment**.*/static isFragment(e) {- return e && e[Xn] === Um;+ return e && e[Xn] === Gm;}}-class fs extends kr {+class fs extends Or {/*** Whether the constructor can receive an endowment.*/@@ -44070,7 +44079,7 @@ class fs extends kr {* @private*/constructor(e, t, n, s, r) {- super(e, t, n), Object.defineProperty(this, Xn, { value: Om }), Ye(this, { payable: s, gas: r });+ super(e, t, n), Object.defineProperty(this, Xn, { value: Hm }), Ye(this, { payable: s, gas: r });}/*** Returns a string representation of this constructor as %%format%%.@@ -44084,7 +44093,7 @@ class fs extends kr {gas: this.gas != null ? this.gas : void 0,inputs: this.inputs.map((n) => JSON.parse(n.format(e)))});- const t = [`constructor${oc(e, this.inputs)}`];+ const t = [`constructor${lc(e, this.inputs)}`];return this.payable && t.push("payable"), this.gas != null && t.push(`@${this.gas.toString()}`), t.join(" ");}/**@@ -44095,14 +44104,14 @@ class fs extends kr {return e;if (typeof e == "string")try {- return fs.from($s(e));+ return fs.from(er(e));} catch {V(!1, "invalid constuctor fragment", "obj", e);}else if (e instanceof pi) {- _s(e, zn(["constructor"]));- const t = xs(e), n = !!_s(e, ML).has("payable"), s = wE(e);- return Pr(e), new fs(Vt, "constructor", t, n, s);+ ys(e, zn(["constructor"]));+ const t = xs(e), n = !!ys(e, OL).has("payable"), s = ME(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);}@@ -44111,16 +44120,16 @@ class fs extends kr {* **ConstructorFragment**.*/static isFragment(e) {- return e && e[Xn] === Om;+ return e && e[Xn] === Hm;}}-class is extends kr {+class is 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: Qm }), Ye(this, { payable: n });+ super(e, "fallback", t), Object.defineProperty(this, Xn, { value: zm }), Ye(this, { payable: n });}/*** Returns a string representation of this fallback as %%format%%.@@ -44141,7 +44150,7 @@ class is extends kr {return e;if (typeof e == "string")try {- return is.from($s(e));+ return is.from(er(e));} catch {V(!1, "invalid fallback fragment", "obj", e);}@@ -44149,16 +44158,16 @@ class is extends kr {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") {const o = xs(e);- return V(o.length === 0, "receive cannot have arguments", "obj.inputs", o), _s(e, zn(["payable"])), Pr(e), new is(Vt, [], !0);+ return V(o.length === 0, "receive cannot have arguments", "obj.inputs", o), ys(e, zn(["payable"])), Ur(e), new is(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 = yE(e);- if (V(a === "nonpayable" || a === "payable", "fallback cannot be constants", "obj.stateMutability", a), _s(e, zn(["returns"])).has("returns")) {+ const a = SE(e);+ if (V(a === "nonpayable" || a === "payable", "fallback cannot be constants", "obj.stateMutability", a), ys(e, zn(["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 Pr(e), new is(Vt, r, a === "payable");+ return Ur(e), new is(Vt, r, a === "payable");}if (e.type === "receive")return new is(Vt, [], !0);@@ -44173,10 +44182,10 @@ class is extends kr {* **FallbackFragment**.*/static isFragment(e) {- return e && e[Xn] === Qm;+ return e && e[Xn] === zm;}}-class Qi extends Rh {+class Qi extends Nh {/*** If the function is constant (e.g. ``pure`` or ``view`` functions).*/@@ -44202,13 +44211,13 @@ class Qi extends Rh {* @private*/constructor(e, t, n, s, r, a) {- super(e, "function", t, s), Object.defineProperty(this, Xn, { value: Gm }), 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, Xn, { value: Vm }), r = Object.freeze(r.slice()), Ye(this, { constant: n === "view" || n === "pure", gas: a, outputs: r, payable: n === "payable", stateMutability: n });}/*** The Function selector.*/get selector() {- return Lr(this.format("sighash")).substring(0, 10);+ return kr(this.format("sighash")).substring(0, 10);}/*** Returns a string representation of this function as %%format%%.@@ -44226,7 +44235,7 @@ class Qi extends Rh {outputs: this.outputs.map((n) => JSON.parse(n.format(e)))});const t = [];- return e !== "sighash" && t.push("function"), t.push(this.name + oc(e, this.inputs)), e !== "sighash" && (this.stateMutability !== "nonpayable" && t.push(this.stateMutability), this.outputs && this.outputs.length && (t.push("returns"), t.push(oc(e, this.outputs))), this.gas != null && t.push(`@${this.gas.toString()}`)), t.join(" ");+ 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 the selector for a function with %%name%% and %%params%%.@@ -44242,16 +44251,16 @@ class Qi extends Rh {return e;if (typeof e == "string")try {- return Qi.from($s(e));+ return Qi.from(er(e));} catch {V(!1, "invalid function fragment", "obj", e);}else if (e instanceof pi) {- const n = Th("function", e), s = xs(e), r = yE(e);+ const n = Fh("function", e), s = xs(e), r = SE(e);let a = [];- _s(e, zn(["returns"])).has("returns") && (a = xs(e));- const o = wE(e);- return Pr(e), new Qi(Vt, n, r, s, a, o);+ ys(e, zn(["returns"])).has("returns") && (a = xs(e));+ const o = ME(e);+ return Ur(e), new Qi(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);@@ -44261,15 +44270,15 @@ class Qi extends Rh {* **FunctionFragment**.*/static isFragment(e) {- return e && e[Xn] === Gm;+ return e && e[Xn] === Vm;}}-class Cr extends Rh {+class Sr extends Nh {/*** @private*/constructor(e, t, n) {- super(e, "struct", t, n), Object.defineProperty(this, Xn, { value: Hm });+ super(e, "struct", t, n), Object.defineProperty(this, Xn, { value: Wm });}/*** Returns a string representation of this struct as %%format%%.@@ -44283,15 +44292,15 @@ class Cr extends Rh {static from(e) {if (typeof e == "string")try {- return Cr.from($s(e));+ return Sr.from(er(e));} catch {V(!1, "invalid struct fragment", "obj", e);}else if (e instanceof pi) {- const t = Th("struct", e), n = xs(e);- return Pr(e), new Cr(Vt, t, n);+ const t = Fh("struct", e), n = xs(e);+ return Ur(e), new Sr(Vt, t, n);}- return new Cr(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);+ return new Sr(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);}// @TODO: fix this return type/**@@ -44299,7 +44308,7 @@ class Cr extends Rh {* **StructFragment**.*/static isFragment(e) {- return e && e[Xn] === Hm;+ return e && e[Xn] === Wm;}}const Fi = /* @__PURE__ */ new Map();@@ -44313,20 +44322,20 @@ Fi.set(49, "STACK_UNDERFLOW");Fi.set(50, "ARRAY_RANGE_ERROR");Fi.set(65, "OUT_OF_MEMORY");Fi.set(81, "UNINITIALIZED_FUNCTION_CALL");-const OL = new RegExp(/^bytes([0-9]*)$/), QL = new RegExp(/^(u?int)([0-9]*)$/);-let ed = null, zm = 1024;-function GL(i, e, t, n) {+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) {let s = "missing revert data", r = null;const a = null;let o = null;if (t) {s = "execution reverted";const l = dt(t);- if (t = Se(t), l.length === 0)+ if (t = Ie(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 (Se(l.slice(0, 4)) === "0x08c379a0")+ else if (Ie(l.slice(0, 4)) === "0x08c379a0")try {r = n.decode(["string"], l.slice(4))[0], o = {signature: "Error(string)",@@ -44336,7 +44345,7 @@ function GL(i, e, t, n) {} catch {s += " (could not decode reason; invalid string data)";}- else if (Se(l.slice(0, 4)) === "0x4e487b71")+ else if (Ie(l.slice(0, 4)) === "0x4e487b71")try {const h = Number(n.decode(["uint256"], l.slice(4))[0]);o = {@@ -44354,7 +44363,7 @@ function GL(i, e, t, n) {to: e.to ? Mt(e.to) : null,data: e.data || "0x"};- return e.from && (c.from = Mt(e.from)), Ht(s, "CALL_EXCEPTION", {+ return e.from && (c.from = Mt(e.from)), Gt(s, "CALL_EXCEPTION", {action: i,data: t,reason: r,@@ -44363,32 +44372,32 @@ function GL(i, e, t, n) {revert: o});}-class Ha {+class za {#e(e) {if (e.isArray())- return new sN(this.#e(e.arrayChildren), e.arrayLength, e.name);+ return new AD(this.#e(e.arrayChildren), e.arrayLength, e.name);if (e.isTuple())- return new xl(e.components.map((n) => this.#e(n)), e.name);+ return new El(e.components.map((n) => this.#e(n)), e.name);switch (e.baseType) {case "address":- return new nN(e.name);+ return new fD(e.name);case "bool":- return new rN(e.name);+ return new gD(e.name);case "string":- return new pN(e.name);+ return new CD(e.name);case "bytes":- return new aN(e.name);+ return new mD(e.name);case "":- return new lN(e.name);+ return new ED(e.name);}- let t = e.type.match(QL);+ let t = e.type.match(JL);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 fN(n / 8, t[1] === "int", e.name);+ 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);}- if (t = e.type.match(OL), t) {+ if (t = e.type.match(YL), t) {let n = parseInt(t[1]);- return V(n !== 0 && n <= 32, "invalid bytes length", "param", e), new oN(n, e.name);+ return V(n !== 0 && n <= 32, "invalid bytes length", "param", e), new xD(n, e.name);}V(!1, "invalid type", "type", e.type);}@@ -44400,7 +44409,7 @@ class Ha {*/getDefaultValue(e) {const t = e.map((s) => this.#e(Pt.from(s)));- return new xl(t, "_").defaultValue();+ return new El(t, "_").defaultValue();}/*** Encode the %%values%% as the %%types%% into ABI data.@@ -44408,8 +44417,8 @@ class Ha {* @returns DataHexstring*/encode(e, t) {- eb(t.length, e.length, "types/values length mismatch");- const n = e.map((a) => this.#e(Pt.from(a))), s = new xl(n, "_"), r = new lf();+ 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();return s.encode(r, t), r.data;}/**@@ -44421,10 +44430,10 @@ class Ha {*/decode(e, t, n) {const s = e.map((a) => this.#e(Pt.from(a)));- return new xl(s, "_").decode(new pp(t, n, zm));+ return new El(s, "_").decode(new mp(t, n, qm));}static _setDefaultMaxInflation(e) {- V(typeof e == "number" && Number.isInteger(e), "invalid defaultMaxInflation factor", "value", e), zm = e;+ V(typeof e == "number" && Number.isInteger(e), "invalid defaultMaxInflation factor", "value", e), qm = e;}/*** Returns the shared singleton instance of a default [[AbiCoder]].@@ -44432,7 +44441,7 @@ class Ha {* On the first call, the instance is created internally.*/static defaultAbiCoder() {- return ed == null && (ed = new Ha()), ed;+ return id == null && (id = new za()), id;}/*** Returns an ethers-compatible [[CallExceptionError]] Error for the given@@ -44440,10 +44449,10 @@ class Ha {* the Transaction %%tx%%.*/static getBuiltinCallException(e, t, n) {- return GL(e, t, n, Ha.defaultAbiCoder());+ return ZL(e, t, n, za.defaultAbiCoder());}}-class HL {+class $L {/*** The matching fragment for the ``topic0``.*/@@ -44478,7 +44487,7 @@ class HL {});}}-class zL {+class e2 {/*** The matching fragment from the transaction ``data``.*/@@ -44518,7 +44527,7 @@ class zL {});}}-class VL {+class t2 {/*** The matching fragment.*/@@ -44553,7 +44562,7 @@ class VL {});}}-class Vm {+class Km {/*** The ``keccak256`` of the value logged.*/@@ -44577,7 +44586,7 @@ class Vm {Ye(this, { hash: e, _isIndexed: !0 });}}-const Wm = {+const jm = {0: "generic panic",1: "assert(false)",17: "arithmetic overflow",@@ -44588,7 +44597,7 @@ const Wm = {50: "out-of-bounds access of an array or bytesN",65: "out of memory",81: "uninitialized function"-}, qm = {+}, Xm = {"0x08c379a0": {signature: "Error(string)",name: "Error",@@ -44601,11 +44610,11 @@ const Wm = {inputs: ["uint256"],reason: (i) => {let e = "unknown panic code";- return i >= 0 && i <= 255 && Wm[i.toString()] && (e = Wm[i.toString()]), `reverted with panic code 0x${i.toString(16)} (${e})`;+ return i >= 0 && i <= 255 && jm[i.toString()] && (e = jm[i.toString()]), `reverted with panic code 0x${i.toString(16)} (${e})`;}}};-class mr {+class xr {/*** All the Contract ABI members (i.e. methods, events, errors, etc).*/@@ -44636,7 +44645,7 @@ class mr {const n = [];for (const a of t)try {- n.push(kr.from(a));+ n.push(Or.from(a));} catch (o) {console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, o.message);}@@ -44697,7 +44706,7 @@ class mr {* data.*/getAbiCoder() {- return Ha.defaultAbiCoder();+ return za.defaultAbiCoder();}// Find a function definition by any means necessary (unless it is ambiguous)#s(e, t, n) {@@ -44891,8 +44900,8 @@ class mr {getError(e, t) {if (Ut(e)) {const s = e.toLowerCase();- if (qm[s])- return jn.from(qm[s].signature);+ if (Xm[s])+ return jn.from(Xm[s].signature);for (const r of this.#e.values())if (s === r.selector)return r;@@ -45001,7 +45010,7 @@ class mr {const n = this.getError(e);V(n, "unknown error", "fragment", e), e = n;}- return Gt([+ return Ht([e.selector,this._encodeParams(e.inputs, t || [])]);@@ -45031,7 +45040,7 @@ class mr {const n = this.getFunction(e);V(n, "unknown function", "fragment", e), e = n;}- return Gt([+ return Ht([e.selector,this._encodeParams(e.inputs, t || [])]);@@ -45059,14 +45068,14 @@ class mr {n = "could not decode result data";}ge(!1, n, "BAD_DATA", {- value: Se(s),+ value: Ie(s),info: { method: e.name, signature: e.format() }});}makeError(e, t) {- const n = dt(e, "data"), s = Ha.getBuiltinCallException("call", t, n);+ const n = dt(e, "data"), s = za.getBuiltinCallException("call", t, n);if (s.message.startsWith("execution reverted (unknown custom error)")) {- const o = Se(n.slice(0, 4)), c = this.getError(o);+ const o = Ie(n.slice(0, 4)), c = this.getError(o);if (c)try {const l = this.#i.decode(c.inputs, n.slice(4));@@ -45099,7 +45108,7 @@ class mr {const n = this.getFunction(e);V(n, "unknown function", "fragment", e), e = n;}- return Se(this.#i.encode(e.outputs, t || []));+ return Ie(this.#i.encode(e.outputs, t || []));}/*spelunk(inputs: Array<ParamType>, values: ReadonlyArray<any>, processfunc: (type: string, value: any) => Promise<any>): Promise<Array<any>> {@@ -45140,7 +45149,7 @@ class mr {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" ? Lr(a) : r.type === "bytes" ? sn(Se(a)) : (r.type === "bool" && typeof a == "boolean" ? a = a ? "0x01" : "0x00" : r.type.match(/^u?int/) ? a = Xs(a) : r.type.match(/^bytes/) ? a = dF(a, 32) : r.type === "address" && this.#i.encode(["address"], [a]), Es(Se(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 = wF(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) {@@ -45162,7 +45171,7 @@ class mr {const c = t[o];if (a.indexed)if (a.type === "string")- n.push(Lr(c));+ n.push(kr(c));else if (a.type === "bytes")n.push(sn(c));else {@@ -45191,15 +45200,15 @@ class mr {e.inputs.forEach((f, p) => {f.indexed ? f.type === "string" || f.type === "bytes" || f.baseType === "tuple" || f.baseType === "array" ? (s.push(Pt.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 = [];+ const o = n != null ? this.#i.decode(s, Ht(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 Vm(null);+ m = new Km(null);else if (a[p])- m = new Vm(o[d++]);+ m = new Km(o[d++]);elsetry {m = o[d++];@@ -45222,11 +45231,11 @@ class mr {* If the matching function cannot be found, return null.*/parseTransaction(e) {- const t = dt(e.data, "tx.data"), n = Ne(e.value != null ? e.value : 0, "tx.value"), s = this.getFunction(Se(t.slice(0, 4)));+ const t = dt(e.data, "tx.data"), n = De(e.value != null ? e.value : 0, "tx.value"), s = this.getFunction(Ie(t.slice(0, 4)));if (!s)return null;const r = this.#i.decode(s.inputs, t.slice(4));- return new zL(s, s.selector, r, n);+ return new e2(s, s.selector, r, n);}parseCallResult(e) {throw new Error("@TODO");@@ -45239,7 +45248,7 @@ class mr {*/parseLog(e) {const t = this.getEvent(e.topics[0]);- return !t || t.anonymous ? null : new HL(t, t.topicHash, this.decodeEventLog(t, e.data, e.topics));+ return !t || t.anonymous ? null : new $L(t, t.topicHash, this.decodeEventLog(t, e.data, e.topics));}/*** Parses a revert data, finding the matching error and extracts@@ -45248,11 +45257,11 @@ class mr {* If the matching error cannot be found, returns null.*/parseError(e) {- const t = Se(e), n = this.getError(Kt(t, 0, 4));+ const t = Ie(e), n = this.getError(Kt(t, 0, 4));if (!n)return null;const s = this.#i.decode(n.inputs, Kt(t, 4));- return new VL(n, n.selector, s);+ return new t2(n, n.selector, s);}/*** Creates a new [[Interface]] from the ABI %%value%%.@@ -45261,17 +45270,17 @@ class mr {* a JSON-encoded ABI or any Human-Readable ABI format.*/static from(e) {- return e instanceof mr ? e : typeof e == "string" ? new mr(JSON.parse(e)) : typeof e.formatJson == "function" ? new mr(e.formatJson()) : typeof e.format == "function" ? new mr(e.format("json")) : new mr(e);+ 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 vE = BigInt(0);-function Ba(i) {+const BE = BigInt(0);+function Ra(i) {return i ?? null;}function $t(i) {return i == null ? null : i.toString();}-class Km {+class Ym {/*** The gas price for legacy networks.*/@@ -45305,9 +45314,9 @@ class Km {*/constructor(e, t, n) {Ye(this, {- gasPrice: Ba(e),- maxFeePerGas: Ba(t),- maxPriorityFeePerGas: Ba(n)+ gasPrice: Ra(e),+ maxFeePerGas: Ra(t),+ maxPriorityFeePerGas: Ra(n)});}/**@@ -45323,18 +45332,18 @@ class Km {};}}-function ah(i) {+function ch(i) {const e = {};- i.to && (e.to = i.to), i.from && (e.from = i.from), i.data && (e.data = Se(i.data));+ 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(/,/);for (const s of t)- !(s in i) || i[s] == null || (e[s] = Ne(i[s], `request.${s}`));+ !(s in i) || i[s] == null || (e[s] = De(i[s], `request.${s}`));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 = Qr(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) => dp(s) ? Se(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) => Ap(s) ? Ie(s) : Object.assign({}, s))), e;}-class WL {+class n2 {/*** The provider connected to the block used to fetch additional details* if necessary.@@ -45440,9 +45449,9 @@ class WL {* low-level library.*/constructor(e, t) {- this.#e = e.transactions.map((n) => typeof n != "string" ? new mc(n, t) : n), Ye(this, {+ this.#e = e.transactions.map((n) => typeof n != "string" ? new bc(n, t) : n), Ye(this, {provider: t,- hash: Ba(e.hash),+ hash: Ra(e.hash),number: e.number,timestamp: e.timestamp,parentHash: e.parentHash,@@ -45454,9 +45463,9 @@ class WL {blobGasUsed: e.blobGasUsed,excessBlobGas: e.excessBlobGas,miner: e.miner,- prevRandao: Ba(e.prevRandao),+ prevRandao: Ra(e.prevRandao),extraData: e.extraData,- baseFeePerGas: Ba(e.baseFeePerGas),+ baseFeePerGas: Ra(e.baseFeePerGas),stateRoot: e.stateRoot,receiptsRoot: e.receiptsRoot});@@ -45592,10 +45601,10 @@ class WL {orphanedEvent() {if (!this.isMined())throw new Error("");- return qL(this);+ return i2(this);}}-class gc {+class xc {/*** The provider connected to the log used to fetch additional details* if necessary.@@ -45712,10 +45721,10 @@ class gc {* @_ignore:*/removedEvent() {- return KL(this);+ return s2(this);}}-class CE {+class TE {/*** The provider connected to the log used to fetch additional details* if necessary.@@ -45816,8 +45825,8 @@ class CE {* @_ignore:*/constructor(e, t) {- this.#e = Object.freeze(e.logs.map((s) => new gc(s, t)));- let n = vE;+ this.#e = Object.freeze(e.logs.map((s) => new xc(s, t)));+ let n = BE;e.effectiveGasPrice != null ? n = e.effectiveGasPrice : e.gasPrice != null && (n = e.gasPrice), Ye(this, {provider: t,to: e.to,@@ -45939,16 +45948,16 @@ class CE {* @_ignore:*/removedEvent() {- return IE(this);+ return FE(this);}/*** @_ignore:*/reorderedEvent(e) {- return ge(!e || e.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }), SE(this, e);+ return ge(!e || e.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }), RE(this, e);}}-class mc {+class bc {/*** The provider this is connected to, which will influence how its* methods will resolve its async inspection methods.@@ -46182,16 +46191,16 @@ class mc {if (A.from === this.from && A.nonce === this.nonce) {if (o)return null;- const y = await this.provider.getTransactionReceipt(A.hash);- if (y == null || d - y.blockNumber + 1 < n)+ 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"), 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 === BE && (x = "cancelled"), ge(!1, "transaction was replaced", "TRANSACTION_REPLACED", {cancelled: x === "replaced" || x === "cancelled",reason: x,replacement: A.replaceableTransaction(r),hash: A.hash,- receipt: y+ receipt: _});}}@@ -46230,7 +46239,7 @@ class mc {o = !0;}), s > 0) {const A = setTimeout(() => {- m(), f(Ht("wait for transaction timeout", "TIMEOUT"));+ m(), f(Gt("wait for transaction timeout", "TIMEOUT"));}, s);p.push(() => {clearTimeout(A);@@ -46241,8 +46250,8 @@ class mc {m();try {d(l(A));- } catch (y) {- f(y);+ } catch (_) {+ f(_);}}};@@ -46252,9 +46261,9 @@ class mc {const A = async () => {try {await c();- } catch (y) {- if (Mn(y, "TRANSACTION_REPLACED")) {- m(), f(y);+ } catch (_) {+ if (Mn(_, "TRANSACTION_REPLACED")) {+ m(), f(_);return;}}@@ -46322,14 +46331,14 @@ class mc {* that evict this transaction.*/removedEvent() {- return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), IE(this);+ return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), FE(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()" }), SE(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()" }), RE(this, e);}/*** Returns a new TransactionResponse instance which has the ability to@@ -46342,20 +46351,20 @@ class mc {*/replaceableTransaction(e) {V(Number.isInteger(e) && e >= 0, "invalid startBlock", "startBlock", e);- const t = new mc(this, this.provider);+ const t = new bc(this, this.provider);return t.#e = e, t;}}-function qL(i) {+function i2(i) {return { orphan: "drop-block", hash: i.hash, number: i.number };}-function SE(i, e) {+function RE(i, e) {return { orphan: "reorder-transaction", tx: i, other: e };}-function IE(i) {+function FE(i) {return { orphan: "drop-transaction", tx: i };}-function KL(i) {+function s2(i) {return { orphan: "drop-log", log: {transactionHash: i.transactionHash,blockHash: i.blockHash,@@ -46366,7 +46375,7 @@ function KL(i) {index: i.index} };}-class Ip extends gc {+class Tp extends xc {/*** The Contract Interface.*/@@ -46400,7 +46409,7 @@ class Ip extends gc {return this.fragment.format();}}-class ME extends gc {+class NE extends xc {/*** The error encounted when trying to decode the log.*/@@ -46412,7 +46421,7 @@ class ME extends gc {super(e, e.provider), Ye(this, { error: t });}}-class jL extends CE {+class r2 extends TE {#e;/*** @_ignore:@@ -46429,15 +46438,15 @@ class jL extends CE {const t = e.topics.length ? this.#e.getEvent(e.topics[0]) : null;if (t)try {- return new Ip(e, this.#e, t);+ return new Tp(e, this.#e, t);} catch (n) {- return new ME(e, n);+ return new NE(e, n);}return e;});}}-class Mp extends mc {+class Rp extends bc {#e;/*** @_ignore:@@ -46456,10 +46465,10 @@ class Mp extends mc {*/async wait(e, t) {const n = await super.wait(e, t);- return n == null ? null : new jL(this.#e, this.provider, n);+ return n == null ? null : new r2(this.#e, this.provider, n);}}-class BE extends sb {+class DE extends lb {/*** The log with no matching events.*/@@ -46489,12 +46498,12 @@ class BE extends sb {return await this.log.getTransactionReceipt();}}-class XL extends BE {+class a2 extends DE {/*** @_ignore:*/constructor(e, t, n, s, r) {- super(e, t, n, new Ip(r, e.interface, s));+ super(e, t, n, new Tp(r, e.interface, s));const a = e.interface.decodeEventLog(s, this.log.data, this.log.topics);Ye(this, { args: a, fragment: s });}@@ -46511,34 +46520,34 @@ class XL extends BE {return this.fragment.format();}}-const jm = BigInt(0);-function TE(i) {+const Jm = BigInt(0);+function LE(i) {return i && typeof i.call == "function";}-function RE(i) {+function PE(i) {return i && typeof i.estimateGas == "function";}-function Fh(i) {+function Dh(i) {return i && typeof i.resolveName == "function";}-function FE(i) {+function kE(i) {return i && typeof i.sendTransaction == "function";}-function DE(i) {+function UE(i) {if (i != null) {- if (Fh(i))+ if (Dh(i))return i;if (i.provider)return i.provider;}}-class YL {+class o2 {#e;fragment;constructor(e, t, n) {if (Ye(this, { fragment: t }), t.inputs.length < n.length)throw new Error("too many arguments");- const s = Ur(e.runner, "resolveName"), r = Fh(s) ? s : null;+ const s = Qr(e.runner, "resolveName"), r = Dh(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)));return e.interface.encodeFilterTopics(t, a);@@ -46548,47 +46557,47 @@ class YL {return this.#e;}}-function Ur(i, e) {+function Qr(i, e) {return i == null ? null : typeof i[e] == "function" ? i : i.provider && typeof i.provider[e] == "function" ? i.provider : null;}-function yr(i) {+function vr(i) {return i == null ? null : i.provider || null;}-async function NE(i, e) {+async function OE(i, e) {const t = jt.dereference(i, "overrides");V(typeof t == "object", "invalid overrides parameter", "overrides", i);- const n = ah(t);+ const n = ch(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 JL(i, e, t) {- const n = Ur(i, "resolveName"), s = Fh(n) ? n : null;+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))));}-function ZL(i) {+function l2(i) {const e = async function(a) {- const o = await NE(a, ["data"]);- o.to = await i.getAddress(), o.from && (o.from = await Hn(o.from, DE(i.runner)));- const c = i.interface, l = Ne(o.value || jm, "overrides.value") === jm, h = (o.data || "0x") === "0x";+ 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";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 = Ur(i.runner, "call");- ge(TE(o), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });+ const o = Qr(i.runner, "call");+ ge(LE(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 up(l) && l.data ? i.interface.makeError(l.data, c) : l;+ throw pp(l) && l.data ? i.interface.makeError(l.data, c) : l;}}, n = async function(a) {const o = i.runner;- ge(FE(o), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });- const c = await o.sendTransaction(await e(a)), l = yr(i.runner);- return new Mp(i.interface, l, c);+ ge(kE(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);}, s = async function(a) {- const o = Ur(i.runner, "estimateGas");- return ge(RE(o), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await o.estimateGas(await e(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));}, r = async (a) => await n(a);return Ye(r, {_contract: i,@@ -46598,7 +46607,7 @@ function ZL(i) {staticCall: t}), r;}-function $L(i, e) {+function h2(i, e) {const t = function(...l) {const h = i.interface.getFunction(e, l);return ge(h, "no matching fragment", "UNSUPPORTED_OPERATION", {@@ -46608,9 +46617,9 @@ function $L(i, e) {}, n = async function(...l) {const h = t(...l);let u = {};- if (h.inputs.length + 1 === l.length && (u = await NE(l.pop()), u.from && (u.from = await Hn(u.from, DE(i.runner)))), h.inputs.length !== l.length)+ 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)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");- const d = await JL(i.runner, h.inputs, l);+ const d = await c2(i.runner, h.inputs, l);return Object.assign({}, u, await Un({to: i.getAddress(),data: i.interface.encodeFunctionData(h, d)@@ -46620,21 +46629,21 @@ function $L(i, e) {return h.length === 1 ? h[0] : h;}, r = async function(...l) {const h = i.runner;- ge(FE(h), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });- const u = await h.sendTransaction(await n(...l)), d = yr(i.runner);- return new Mp(i.interface, d, u);+ ge(kE(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);}, a = async function(...l) {- const h = Ur(i.runner, "estimateGas");- return ge(RE(h), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await h.estimateGas(await n(...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));}, o = async function(...l) {- const h = Ur(i.runner, "call");- ge(TE(h), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });+ const h = Qr(i.runner, "call");+ ge(LE(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 up(p) && p.data ? i.interface.makeError(p.data, u) : p;+ throw pp(p) && p.data ? i.interface.makeError(p.data, u) : p;}const f = t(...l);return i.interface.decodeFunctionResult(f, d);@@ -46661,7 +46670,7 @@ function $L(i, e) {}}), c;}-function e2(i, e) {+function u2(i, e) {const t = function(...s) {const r = i.interface.getEvent(e, s);return ge(r, "no matching fragment", "UNSUPPORTED_OPERATION", {@@ -46669,7 +46678,7 @@ function e2(i, e) {info: { key: e, args: s }}), r;}, n = function(...s) {- return new YL(i, t(...s), s);+ return new o2(i, t(...s), s);};return Ye(n, {name: i.interface.getEventName(e),@@ -46688,17 +46697,17 @@ function e2(i, e) {}}), n;}-const oh = /* @__PURE__ */ Symbol.for("_ethersInternal_contract"), LE = /* @__PURE__ */ new WeakMap();-function t2(i, e) {- LE.set(i[oh], e);+const lh = /* @__PURE__ */ Symbol.for("_ethersInternal_contract"), QE = /* @__PURE__ */ new WeakMap();+function d2(i, e) {+ QE.set(i[lh], e);}function ei(i) {- return LE.get(i[oh]);+ return QE.get(i[lh]);}-function n2(i) {+function f2(i) {return i && typeof i == "object" && "getTopicFilter" in i && typeof i.getTopicFilter == "function" && i.fragment;}-async function Bp(i, e) {+async function Fp(i, e) {let t, n = null;if (Array.isArray(e)) {const r = function(a) {@@ -46708,7 +46717,7 @@ async function Bp(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]) : n2(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]) : f2(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;@@ -46721,14 +46730,14 @@ async function Bp(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 So(i, e) {+async function Mo(i, e) {const { subs: t } = ei(i);- return t.get((await Bp(i, e)).tag) || null;+ return t.get((await Fp(i, e)).tag) || null;}-async function Xm(i, e, t) {- const n = yr(i.runner);+async function Zm(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 Bp(i, t), { addr: o, subs: c } = ei(i);+ const { fragment: s, tag: r, topics: a } = await Fp(i, t), { addr: o, subs: c } = ei(i);let l = c.get(r);if (!l) {const u = { address: o || i, topics: a }, d = (g) => {@@ -46739,10 +46748,10 @@ async function Xm(i, e, t) {} catch {}if (A) {- const y = A, x = s ? i.interface.decodeEventLog(s, g.data, g.topics) : [];- wf(i, t, x, (E) => new XL(i, E, t, y, g));+ const _ = A, x = s ? i.interface.decodeEventLog(s, g.data, g.topics) : [];+ If(i, t, x, (E) => new a2(i, E, t, _, g));} else- wf(i, t, [], (y) => new BE(i, y, t, g));+ If(i, t, [], (_) => new DE(i, _, t, g));};let f = [];l = { tag: r, listeners: [], start: () => {@@ -46756,10 +46765,10 @@ async function Xm(i, e, t) {}return l;}-let yf = Promise.resolve();-async function i2(i, e, t, n) {- await yf;- const s = await So(i, e);+let Cf = Promise.resolve();+async function p2(i, e, t, n) {+ await Cf;+ const s = await Mo(i, e);if (!s)return !1;const r = s.listeners.length;@@ -46773,16 +46782,16 @@ async function i2(i, e, t, n) {return !o;}), s.listeners.length === 0 && (s.stop(), ei(i).subs.delete(s.tag)), r > 0;}-async function wf(i, e, t, n) {+async function If(i, e, t, n) {try {- await yf;+ await Cf;} catch {}- const s = i2(i, e, t, n);- return yf = s, await s;+ const s = p2(i, e, t, n);+ return Cf = s, await s;}-const El = ["then"];-class ko {+const _l = ["then"];+class Oo {/*** The target to connect to.*@@ -46810,7 +46819,7 @@ class ko {/*** @_ignore:*/- [oh];+ [lh];/*** The fallback or receive function if any.*/@@ -46821,27 +46830,27 @@ class ko {* of.*/constructor(e, t, n, s) {- V(typeof e == "string" || Gb(e), "invalid value for Contract target", "target", e), n == null && (n = null);- const r = mr.from(t);- Ye(this, { target: e, runner: n, interface: r }), Object.defineProperty(this, oh, { value: {} });+ V(typeof e == "string" || qb(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: {} });let a, o = null, c = null;if (s) {- const u = yr(n);- c = new Mp(this.interface, u, s);+ const u = vr(n);+ c = new Rp(this.interface, u, s);}let l = /* @__PURE__ */ new Map();if (typeof e == "string")if (Ut(e))o = e, a = Promise.resolve(e);else {- const u = Ur(n, "resolveName");- if (!Fh(u))- throw Ht("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", {+ const u = Qr(n, "resolveName");+ if (!Dh(u))+ throw Gt("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", {operation: "resolveName"});a = u.resolveName(e).then((d) => {if (d == null)- throw Ht("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", {+ throw Gt("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", {value: e});return ei(this).addr = d, d;@@ -46853,10 +46862,10 @@ class ko {throw new Error("TODO");return ei(this).addr = u, u;});- t2(this, { addrPromise: a, addr: o, deployTx: c, subs: l });+ d2(this, { addrPromise: a, addr: o, deployTx: c, subs: l });const h = new Proxy({}, {get: (u, d, f) => {- if (typeof d == "symbol" || El.indexOf(d) >= 0)+ if (typeof d == "symbol" || _l.indexOf(d) >= 0)return Reflect.get(u, d, f);try {return this.getEvent(d);@@ -46865,13 +46874,13 @@ class ko {throw p;}},- has: (u, d) => El.indexOf(d) >= 0 ? Reflect.has(u, d) : Reflect.has(u, d) || this.interface.hasEvent(String(d))+ has: (u, d) => _l.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 ? ZL(this) : null+ fallback: r.receive || r.fallback ? l2(this) : null}), new Proxy(this, {get: (u, d, f) => {- if (typeof d == "symbol" || d in u || El.indexOf(d) >= 0)+ if (typeof d == "symbol" || d in u || _l.indexOf(d) >= 0)return Reflect.get(u, d, f);try {return u.getFunction(d);@@ -46880,7 +46889,7 @@ class ko {throw p;}},- has: (u, d) => typeof d == "symbol" || d in u || El.indexOf(d) >= 0 ? Reflect.has(u, d) : u.interface.hasFunction(d)+ has: (u, d) => typeof d == "symbol" || d in u || _l.indexOf(d) >= 0 ? Reflect.has(u, d) : u.interface.hasFunction(d)});}/**@@ -46888,14 +46897,14 @@ class ko {* a different %%runner%%.*/connect(e) {- return new ko(this.target, this.interface, e);+ return new Oo(this.target, this.interface, e);}/*** Return a new Contract instance with the same ABI and runner, but* a different %%target%%.*/attach(e) {- return new ko(e, this.interface, this.runner);+ return new Oo(e, this.interface, this.runner);}/*** Return the resolved address of this Contract.@@ -46907,7 +46916,7 @@ class ko {* Return the deployed bytecode or null if no bytecode is found.*/async getDeployedCode() {- const e = yr(this.runner);+ const e = vr(this.runner);ge(e, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" });const t = await e.getCode(await this.getAddress());return t === "0x" ? null : t;@@ -46922,7 +46931,7 @@ class ko {return await e.wait(), this;if (await this.getDeployedCode() != null)return this;- const n = yr(this.runner);+ const n = vr(this.runner);return ge(n != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }), new Promise((s, r) => {const a = async () => {try {@@ -46951,7 +46960,7 @@ class ko {* when using a Contract programmatically.*/getFunction(e) {- return typeof e != "string" && (e = e.format()), $L(this, e);+ return typeof e != "string" && (e = e.format()), h2(this, e);}/*** Return the event for a given name. This is useful when a contract@@ -46959,7 +46968,7 @@ class ko {* when using a Contract programmatically.*/getEvent(e) {- return typeof e != "string" && (e = e.format()), e2(this, e);+ return typeof e != "string" && (e = e.format()), u2(this, e);}/*** @_ignore:@@ -46989,7 +46998,7 @@ class ko {*/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 Bp(this, e), l = { address: a, topics: c, fromBlock: t, toBlock: n }, h = yr(this.runner);+ 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);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)@@ -46999,18 +47008,18 @@ class ko {}if (d)try {- return new Ip(u, this.interface, d);+ return new Tp(u, this.interface, d);} catch (f) {- return new ME(u, f);+ return new NE(u, f);}- return new gc(u, h);+ return new xc(u, h);});}/*** Add an event %%listener%% for the %%event%%.*/async on(e, t) {- const n = await Xm(this, "on", e);+ const n = await Zm(this, "on", e);return n.listeners.push({ listener: t, once: !1 }), n.start(), this;}/**@@ -47018,7 +47027,7 @@ class ko {* after it is fired once.*/async once(e, t) {- const n = await Xm(this, "once", e);+ const n = await Zm(this, "once", e);return n.listeners.push({ listener: t, once: !0 }), n.start(), this;}/**@@ -47027,7 +47036,7 @@ class ko {* Resolves to ``true`` if any listeners were called.*/async emit(e, ...t) {- return await wf(this, e, t, null);+ return await If(this, e, t, null);}/*** Resolves to the number of listeners of %%event%% or the total number@@ -47035,7 +47044,7 @@ class ko {*/async listenerCount(e) {if (e) {- const s = await So(this, e);+ const s = await Mo(this, e);return s ? s.listeners.length : 0;}const { subs: t } = ei(this);@@ -47050,7 +47059,7 @@ class ko {*/async listeners(e) {if (e) {- const s = await So(this, e);+ const s = await Mo(this, e);return s ? s.listeners.map(({ listener: r }) => r) : [];}const { subs: t } = ei(this);@@ -47064,7 +47073,7 @@ class ko {* all listeners if unspecified.*/async off(e, t) {- const n = await So(this, e);+ const n = await Mo(this, e);if (!n)return this;if (t) {@@ -47079,7 +47088,7 @@ class ko {*/async removeAllListeners(e) {if (e) {- const t = await So(this, e);+ const t = await Mo(this, e);if (!t)return this;t.stop(), ei(this).subs.delete(t.tag);@@ -47106,7 +47115,7 @@ class ko {* Create a new Class for the %%abi%%.*/static buildClass(e) {- class t extends ko {+ class t extends Oo {constructor(s, r = null) {super(s, e, r);}@@ -47120,15 +47129,15 @@ class ko {return n == null && (n = null), new this(e, t, n);}}-function s2() {- return ko;+function A2() {+ return Oo;}-class Ta extends s2() {+class Mr extends A2() {}-function td(i) {+function sd(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 r2 {+class g2 {/*** The name.*/@@ -47161,13 +47170,13 @@ class r2 {throw new Error("unsupported coin");}}-const PE = new RegExp("^(ipfs)://(.*)$", "i"), Ym = [+const GE = new RegExp("^(ipfs)://(.*)$", "i"), $m = [new RegExp("^(https)://(.*)$", "i"),new RegExp("^(data):(.*)$", "i"),- PE,+ GE,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i")];-class Ra {+class Fa {/*** The connected provider.*/@@ -47184,7 +47193,7 @@ class Ra {#e;#t;constructor(e, t, n) {- Ye(this, { provider: e, address: t, name: n }), this.#e = null, this.#t = new Ta(t, [+ Ye(this, { provider: e, address: t, name: n }), this.#e = null, this.#t = new Mr(t, ["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)",@@ -47210,12 +47219,12 @@ class Ra {async #n(e, t) {t = (t || []).slice();const n = this.#t.interface;- t.unshift(_f(this.name));+ t.unshift(vf(this.name));let s = null;await this.supportsWildcard() && (s = n.getFunction(e), ge(s, "missing fragment", "UNKNOWN_ERROR", {info: { funcName: e }}), t = [- EL(this.name, 255),+ RL(this.name, 255),n.encodeFunctionData(s, t)], e = "resolve(bytes,bytes)"), t.push({enableCcipRead: !0@@ -47237,7 +47246,7 @@ class Ra {if (e == null && (e = 60), e === 60)try {const r = await this.#n("addr(bytes32)");- return r == null || r === nc ? null : r;+ return r == null || r === sc ? null : r;} catch (r) {if (Mn(r, "CALL_EXCEPTION"))return null;@@ -47251,7 +47260,7 @@ class Ra {}let t = null;for (const r of this.provider.plugins)- if (r instanceof r2 && r.supportsCoinType(e)) {+ if (r instanceof g2 && r.supportsCoinType(e)) {t = r;break;}@@ -47287,7 +47296,7 @@ class Ra {if (t) {const s = t[1] === "e3010170" ? "ipfs" : "ipns", r = parseInt(t[4], 16);if (t[5].length === r * 2)- return `${s}://${AF("0x" + t[2])}`;+ return `${s}://${IF("0x" + t[2])}`;}const n = e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if (n && n[1].length === 64)@@ -47323,8 +47332,8 @@ class Ra {if (t == null)return e.push({ type: "!avatar", value: "" }), { url: null, linkage: e };e.push({ type: "avatar", value: t });- for (let n = 0; n < Ym.length; n++) {- const s = t.match(Ym[n]);+ for (let n = 0; n < $m.length; n++) {+ const s = t.match($m[n]);if (s == null)continue;const r = s[1].toLowerCase();@@ -47333,7 +47342,7 @@ class Ra {case "data":return e.push({ type: "url", value: t }), { linkage: e, url: t };case "ipfs": {- const a = td(t);+ const a = sd(t);return e.push({ type: "ipfs", value: t }), e.push({ type: "url", value: a }), { linkage: e, url: a };}case "erc721":@@ -47346,7 +47355,7 @@ class Ra {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 Ta(c[0], [+ const l = c[1], h = new Mr(c[0], [// ERC-721"function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)",@@ -47368,7 +47377,7 @@ class Ra {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}", Xs(l, 32).substring(2)), e.push({ type: "metadata-url-expanded", value: u })), u.match(/^ipfs:/i) && (u = td(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 = sd(u)), e.push({ type: "metadata-url", value: u });let d = {};const f = await new Gi(u).send();f.assertOk();@@ -47379,7 +47388,7 @@ class Ra {e.push({ type: "!metadata", value: f.bodyText });} catch {const A = f.body;- return A && e.push({ type: "!metadata", value: Se(A) }), { url: null, linkage: e };+ return A && e.push({ type: "!metadata", value: Ie(A) }), { url: null, linkage: e };}return { url: null, linkage: e };}@@ -47390,9 +47399,9 @@ class Ra {if (typeof p != "string")return e.push({ type: "!imageUrl", value: "" }), { url: null, linkage: e };if (!p.match(/^(https:\/\/|data:)/i)) {- if (p.match(PE) == null)+ if (p.match(GE) == null)return e.push({ type: "!imageUrl-ipfs", value: p }), { url: null, linkage: e };- e.push({ type: "imageUrl-ipfs", value: p }), p = td(p);+ e.push({ type: "imageUrl-ipfs", value: p }), p = sd(p);}return e.push({ type: "url", value: p }), { linkage: e, url: p };}@@ -47410,14 +47419,14 @@ class Ra {}), n.address;}static async #i(e, t) {- const n = await Ra.getEnsAddress(e);+ const n = await Fa.getEnsAddress(e);try {- const r = await new Ta(n, [+ const r = await new Mr(n, ["function resolver(bytes32) view returns (address)"- ], e).resolver(_f(t), {+ ], e).resolver(vf(t), {enableCcipRead: !0});- return r === nc ? null : r;+ return r === sc ? null : r;} catch (s) {throw s;}@@ -47432,22 +47441,22 @@ class Ra {for (; ; ) {if (n === "" || n === "." || t !== "eth" && n === "eth")return null;- const s = await Ra.#i(e, n);+ const s = await Fa.#i(e, n);if (s != null) {- const r = new Ra(e, s, t);+ const r = new Fa(e, s, t);return n !== t && !await r.supportsWildcard() ? null : r;}n = n.split(".").slice(1).join(".");}}}-const Jm = BigInt(0);+const e0 = BigInt(0);function bt(i, e) {return (function(t) {return t == null ? e : i(t);});}-function cc(i, e) {+function hc(i, e) {return ((t) => {if (e && t == null)return null;@@ -47456,7 +47465,7 @@ function cc(i, e) {return t.map((n) => i(n));});}-function xc(i, e) {+function Ec(i, e) {return ((t) => {const n = {};for (const s in i) {@@ -47479,7 +47488,7 @@ function xc(i, e) {return n;});}-function a2(i) {+function m2(i) {switch (i) {case !0:case "true":@@ -47490,86 +47499,86 @@ function a2(i) {}V(!1, `invalid boolean; ${JSON.stringify(i)}`, "value", i);}-function za(i) {+function Va(i) {return V(Ut(i, !0), "invalid data", "value", i), i;}-function In(i) {+function Sn(i) {return V(Ut(i, 32), "invalid hash", "value", i), i;}-const o2 = xc({+const x2 = Ec({address: Mt,- blockHash: In,+ blockHash: Sn,blockNumber: ft,- data: za,+ data: Va,index: ft,- removed: bt(a2, !1),- topics: cc(In),- transactionHash: In,+ removed: bt(m2, !1),+ topics: hc(Sn),+ transactionHash: Sn,transactionIndex: ft}, {index: ["logIndex"]});-function c2(i) {- return o2(i);+function b2(i) {+ return x2(i);}-const l2 = xc({- hash: bt(In),- parentHash: In,- parentBeaconBlockRoot: bt(In, null),+const E2 = Ec({+ hash: bt(Sn),+ parentHash: Sn,+ parentBeaconBlockRoot: bt(Sn, null),number: ft,timestamp: ft,- nonce: bt(za),- difficulty: Ne,- gasLimit: Ne,- gasUsed: Ne,- stateRoot: bt(In, null),- receiptsRoot: bt(In, null),- blobGasUsed: bt(Ne, null),- excessBlobGas: bt(Ne, null),+ nonce: bt(Va),+ difficulty: De,+ gasLimit: De,+ gasUsed: De,+ stateRoot: bt(Sn, null),+ receiptsRoot: bt(Sn, null),+ blobGasUsed: bt(De, null),+ excessBlobGas: bt(De, null),miner: bt(Mt),- prevRandao: bt(In, null),- extraData: za,- baseFeePerGas: bt(Ne)+ prevRandao: bt(Sn, null),+ extraData: Va,+ baseFeePerGas: bt(De)}, {prevRandao: ["mixHash"]});-function h2(i) {- const e = l2(i);- return e.transactions = i.transactions.map((t) => typeof t == "string" ? t : kE(t)), e;+function y2(i) {+ const e = E2(i);+ return e.transactions = i.transactions.map((t) => typeof t == "string" ? t : HE(t)), e;}-const u2 = xc({+const _2 = Ec({transactionIndex: ft,blockNumber: ft,- transactionHash: In,+ transactionHash: Sn,address: Mt,- topics: cc(In),- data: za,+ topics: hc(Sn),+ data: Va,index: ft,- blockHash: In+ blockHash: Sn}, {index: ["logIndex"]});-function d2(i) {- return u2(i);+function w2(i) {+ return _2(i);}-const f2 = xc({+const v2 = Ec({to: bt(Mt, null),from: bt(Mt, null),contractAddress: bt(Mt, null),// should be allowNull(hash), but broken-EIP-658 support is handled in receiptindex: ft,- root: bt(Se),- gasUsed: Ne,- blobGasUsed: bt(Ne, null),- logsBloom: bt(za),- blockHash: In,- hash: In,- logs: cc(d2),+ root: bt(Ie),+ gasUsed: De,+ blobGasUsed: bt(De, null),+ logsBloom: bt(Va),+ blockHash: Sn,+ hash: Sn,+ logs: hc(w2),blockNumber: ft,//confirmations: allowNull(getNumber, null),- cumulativeGasUsed: Ne,- effectiveGasPrice: bt(Ne),- blobGasPrice: bt(Ne, null),+ cumulativeGasUsed: De,+ effectiveGasPrice: bt(De),+ blobGasPrice: bt(De, null),status: bt(ft),type: bt(ft, 0)}, {@@ -47577,19 +47586,19 @@ const f2 = xc({hash: ["transactionHash"],index: ["transactionIndex"]});-function p2(i) {- return f2(i);+function C2(i) {+ return v2(i);}-function kE(i) {- i.to && Ne(i.to) === Jm && (i.to = "0x0000000000000000000000000000000000000000");- const e = xc({- hash: In,+function HE(i) {+ i.to && De(i.to) === e0 && (i.to = "0x0000000000000000000000000000000000000000");+ const e = Ec({+ 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(Qr, null),- blobVersionedHashes: bt(cc(In, !0), null),- authorizationList: bt(cc((t) => {+ accessList: bt(Hr, null),+ blobVersionedHashes: bt(hc(Sn, !0), null),+ authorizationList: bt(hc((t) => {let n;if (t.signature)n = t.signature;@@ -47599,40 +47608,40 @@ function kE(i) {}return {address: Mt(t.address),- chainId: Ne(t.chainId),- nonce: Ne(t.nonce),+ chainId: De(t.chainId),+ nonce: De(t.nonce),signature: zt.from(n)};}, !1), null),- blockHash: bt(In, null),+ blockHash: bt(Sn, null),blockNumber: bt(ft, null),transactionIndex: bt(ft, null),from: Mt,// either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set- gasPrice: bt(Ne),- maxPriorityFeePerGas: bt(Ne),- maxFeePerGas: bt(Ne),- maxFeePerBlobGas: bt(Ne, null),- gasLimit: Ne,+ gasPrice: bt(De),+ maxPriorityFeePerGas: bt(De),+ maxFeePerGas: bt(De),+ maxFeePerBlobGas: bt(De, null),+ gasLimit: De,to: bt(Mt, null),- value: Ne,+ value: De,nonce: ft,- data: za,+ data: Va,creates: bt(Mt, null),- chainId: bt(Ne, null)+ chainId: bt(De, 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 = zt.from(i.signature) : e.signature = zt.from(i), e.chainId == null) {+ 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) {const t = e.signature.legacyChainId;t != null && (e.chainId = t);}- return e.blockHash && Ne(e.blockHash) === Jm && (e.blockHash = null), e;+ return e.blockHash && De(e.blockHash) === e0 && (e.blockHash = null), e;}-const A2 = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";-class bc {+const I2 = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";+class yc {/*** The name of the plugin.*@@ -47650,10 +47659,10 @@ class bc {* Creates a copy of this plugin.*/clone() {- return new bc(this.name);+ return new yc(this.name);}}-class Dh extends bc {+class Lh extends yc {/*** The block number to treat these values as valid from.*@@ -47700,10 +47709,10 @@ class Dh extends bc {s("txBase", 21e3), s("txCreate", 32e3), s("txDataZero", 4), s("txDataNonzero", 16), s("txAccessListStorageKey", 1900), s("txAccessListAddress", 2400), Ye(this, n);}clone() {- return new Dh(this.effectiveBlock, this);+ return new Lh(this.effectiveBlock, this);}}-class Nh extends bc {+class Ph extends yc {/*** The ENS Registrty Contract address.*/@@ -47719,15 +47728,15 @@ class Nh extends bc {*/constructor(e, t) {super("org.ethers.plugins.network.Ens"), Ye(this, {- address: e || A2,+ address: e || I2,targetNetwork: t ?? 1});}clone() {- return new Nh(this.address, this.targetNetwork);+ return new Ph(this.address, this.targetNetwork);}}-class g2 extends bc {+class S2 extends yc {#e;#t;/**@@ -47754,7 +47763,7 @@ class g2 extends bc {return this;}}-const nd = /* @__PURE__ */ new Map();+const rd = /* @__PURE__ */ new Map();class ni {#e;#t;@@ -47763,7 +47772,7 @@ class ni {* Creates a new **Network** for %%name%% and %%chainId%%.*/constructor(e, t) {- this.#e = e, this.#t = Ne(t), this.#n = /* @__PURE__ */ new Map();+ this.#e = e, this.#t = De(t), this.#n = /* @__PURE__ */ new Map();}/*** Returns a JSON-compatible representation of a Network.@@ -47790,7 +47799,7 @@ class ni {return this.#t;}set chainId(e) {- this.#t = Ne(e, "chainId");+ this.#t = De(e, "chainId");}/*** Returns true if %%other%% matches this network. Any chain ID@@ -47804,14 +47813,14 @@ class ni {return !1;if (typeof e == "string") {try {- return this.chainId === Ne(e);+ return this.chainId === De(e);} catch {}return this.name === e;}if (typeof e == "number" || typeof e == "bigint") {try {- return this.chainId === Ne(e);+ return this.chainId === De(e);} catch {}return !1;@@ -47819,7 +47828,7 @@ class ni {if (typeof e == "object") {if (e.chainId != null) {try {- return this.chainId === Ne(e.chainId);+ return this.chainId === De(e.chainId);} catch {}return !1;@@ -47874,13 +47883,13 @@ class ni {* values.*/computeIntrinsicGas(e) {- const t = this.getPlugin("org.ethers.plugins.network.GasCost") || new Dh();+ const t = this.getPlugin("org.ethers.plugins.network.GasCost") || new Lh();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 = Qr(e.accessList);+ const s = Hr(e.accessList);for (const r in s)n += t.txAccessListAddress + t.txAccessListStorageKey * s[r].storageKeys.length;}@@ -47890,10 +47899,10 @@ class ni {* Returns a new Network for the %%network%% name or chainId.*/static from(e) {- if (m2(), e == null)+ if (M2(), e == null)return ni.from("mainnet");if (typeof e == "number" && (e = BigInt(e)), typeof e == "string" || typeof e == "bigint") {- const t = nd.get(e);+ const t = rd.get(e);if (t)return t();if (typeof e == "bigint")@@ -47905,7 +47914,7 @@ class ni {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 Nh(e.ensAddress, e.ensNetwork)), t;+ return (e.ensAddress || e.ensNetwork != null) && t.attachPlugin(new Ph(e.ensAddress, e.ensNetwork)), t;}V(!1, "invalid network", "network", e);}@@ -47915,11 +47924,11 @@ class ni {*/static register(e, t) {typeof e == "number" && (e = BigInt(e));- const n = nd.get(e);- n && V(!1, `conflicting network for ${JSON.stringify(n.name)}`, "nameOrChainId", e), nd.set(e, t);+ const n = rd.get(e);+ n && V(!1, `conflicting network for ${JSON.stringify(n.name)}`, "nameOrChainId", e), rd.set(e, t);}}-function Zm(i, e) {+function t0(i, e) {const t = String(i);if (!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${i}`);@@ -47934,8 +47943,8 @@ function Zm(i, e) {}return BigInt(n[0] + n[1]);}-function $m(i) {- return new g2(i, async (e, t, n) => {+function n0(i) {+ return new S2(i, async (e, t, n) => {n.setHeader("User-Agent", "ethers");let s;try {@@ -47947,23 +47956,23 @@ function $m(i) {const o = s.bodyJson.standard;return {gasPrice: a.gasPrice,- maxFeePerGas: Zm(o.maxFee, 9),- maxPriorityFeePerGas: Zm(o.maxPriorityFee, 9)+ maxFeePerGas: t0(o.maxFee, 9),+ maxPriorityFeePerGas: t0(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 e0 = !1;-function m2() {- if (e0)+let i0 = !1;+function M2() {+ if (i0)return;- e0 = !0;+ i0 = !0;function i(e, t, n) {const s = function() {const r = new ni(e, t);- return n.ensNetwork != null && r.attachPlugin(new Nh(null, n.ensNetwork)), r.attachPlugin(new Dh()), (n.plugins || []).forEach((a) => {+ return n.ensNetwork != null && r.attachPlugin(new Ph(null, n.ensNetwork)), r.attachPlugin(new Lh()), (n.plugins || []).forEach((a) => {r.attachPlugin(a);}), r;};@@ -47976,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: [- $m("https://gasstation.polygon.technology/v2")+ n0("https://gasstation.polygon.technology/v2")]}), i("matic-amoy", 80002, {}), i("matic-mumbai", 80001, {altNames: ["maticMumbai", "maticmum"],plugins: [- $m("https://gasstation-testnet.polygon.technology/v2")+ n0("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 vf(i) {+function Sf(i) {return JSON.parse(JSON.stringify(i));}-class x2 {+class B2 {#e;#t;#n;@@ -48045,7 +48054,7 @@ class x2 {this.start();}}-class Tp {+class Np {#e;#t;#n;@@ -48076,7 +48085,7 @@ class Tp {this.start();}}-class b2 extends Tp {+class T2 extends Np {#e;#t;constructor(e, t) {@@ -48090,16 +48099,16 @@ class b2 extends Tp {n != null && (this.#t === -2 ? this.#t = n.number : n.number > this.#t && (t.emit(this.#e, n.number), this.#t = n.number));}}-class E2 extends Tp {+class R2 extends Np {#e;constructor(e, t) {- super(e), this.#e = vf(t);+ super(e), this.#e = Sf(t);}async _poll(e, t) {throw new Error("@TODO");}}-class _2 extends Tp {+class F2 extends Np {#e;/*** Create a new **PollingTransactionSubscriber** attached to@@ -48113,7 +48122,7 @@ class _2 extends Tp {n && t.emit(this.#e, n);}}-class Rp {+class Dp {#e;#t;#n;@@ -48126,12 +48135,12 @@ class Rp {* %%provider%%, listening for %%filter%%.*/constructor(e, t) {- this.#e = e, this.#t = vf(t), this.#n = this.#a.bind(this), this.#i = !1, this.#s = -2;+ this.#e = e, this.#t = Sf(t), this.#n = this.#a.bind(this), this.#i = !1, this.#s = -2;}async #a(e) {if (this.#s === -2)return;- const t = vf(this.#t);+ const t = Sf(this.#t);t.fromBlock = this.#s + 1, t.toBlock = e;const n = await this.#e.getLogs(t);if (n.length === 0) {@@ -48156,11 +48165,11 @@ class Rp {this.start();}}-const y2 = BigInt(2), w2 = 10;-function _l(i) {+const N2 = BigInt(2), D2 = 10;+function wl(i) {return i && typeof i.then == "function";}-function Tl(i, e) {+function Fl(i, e) {return i + ":" + JSON.stringify(e, (t, n) => {if (n == null)return "null";@@ -48175,7 +48184,7 @@ function Tl(i, e) {return n;});}-class UE {+class zE {/*** The name fof the event.*/@@ -48195,13 +48204,13 @@ class UE {resume() {}}-function v2(i) {+function L2(i) {return JSON.parse(JSON.stringify(i));}-function Cf(i) {+function Mf(i) {return i = Array.from(new Set(i).values()), i.sort(), i;}-async function id(i, e) {+async function ad(i, e) {if (i == null)throw new Error("invalid event");if (Array.isArray(i) && (i = { topics: i }), typeof i == "string")@@ -48217,15 +48226,15 @@ async function id(i, e) {}if (Ut(i, 32)) {const t = i.toLowerCase();- return { type: "transaction", tag: Tl("tx", { hash: t }), hash: t };+ return { type: "transaction", tag: Fl("tx", { hash: t }), hash: t };}if (i.orphan) {const t = i;- return { type: "orphan", tag: Tl("orphan", t), filter: v2(t) };+ return { type: "orphan", tag: Fl("orphan", t), filter: L2(t) };}if (i.address || i.topics) {const t = i, n = {- topics: (t.topics || []).map((s) => s == null ? null : Array.isArray(s) ? Cf(s.map((r) => r.toLowerCase())) : s.toLowerCase())+ topics: (t.topics || []).map((s) => s == null ? null : Array.isArray(s) ? Mf(s.map((r) => r.toLowerCase())) : s.toLowerCase())};if (t.address) {const s = [], r = [], a = (o) => {@@ -48233,20 +48242,20 @@ async function id(i, e) {s.push(await Hn(o, e));})());};- Array.isArray(t.address) ? t.address.forEach(a) : a(t.address), r.length && await Promise.all(r), n.address = Cf(s.map((o) => o.toLowerCase()));+ 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()));}- return { filter: n, tag: Tl("event", n), type: "event" };+ return { filter: n, tag: Fl("event", n), type: "event" };}V(!1, "unknown ProviderEvent", "event", i);}-function sd() {+function od() {return (/* @__PURE__ */ new Date()).getTime();}-const C2 = {+const P2 = {cacheTimeout: 250,pollingInterval: 4e3};-class S2 {+class k2 {#e;#t;// null=unpaused, true=paused+dropWhilePaused, false=paused@@ -48267,7 +48276,7 @@ class S2 {* [[Network]] if necessary.*/constructor(e, t) {- if (this.#A = Object.assign({}, C2, t || {}), e === "any")+ if (this.#A = Object.assign({}, P2, t || {}), e === "any")this.#a = !0, this.#s = null;else if (e) {const n = ni.from(e);@@ -48323,7 +48332,7 @@ class S2 {const t = this.#A.cacheTimeout;if (t < 0)return await this._perform(e);- const n = Tl(e.method, e);+ const n = Fl(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);@@ -48367,7 +48376,7 @@ class S2 {* sub-class of [[Block]].*/_wrapBlock(e, t) {- return new WL(h2(e), this);+ return new n2(y2(e), this);}/*** Provides the opportunity for a sub-class to wrap a log before@@ -48375,7 +48384,7 @@ class S2 {* sub-class of [[Log]].*/_wrapLog(e, t) {- return new gc(c2(e), this);+ return new xc(b2(e), this);}/*** Provides the opportunity for a sub-class to wrap a transaction@@ -48383,7 +48392,7 @@ class S2 {* alternate sub-class of [[TransactionReceipt]].*/_wrapTransactionReceipt(e, t) {- return new CE(p2(e), this);+ return new TE(C2(e), this);}/*** Provides the opportunity for a sub-class to wrap a transaction@@ -48391,7 +48400,7 @@ class S2 {* alternate sub-class of [[TransactionResponse]].*/_wrapTransactionResponse(e, t) {- return new mc(kE(e), this);+ return new bc(HE(e), this);}/*** Resolves to the Network, forcing a network detection using whatever@@ -48457,7 +48466,7 @@ class S2 {* filter.*/_getFilter(e) {- const t = (e.topics || []).map((c) => c == null ? null : Array.isArray(c) ? Cf(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) ? Mf(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:@@ -48491,17 +48500,17 @@ class S2 {* transaction.*/_getTransactionRequest(e) {- const t = ah(e), n = [];+ const t = ch(e), n = [];if (["to", "from"].forEach((s) => {if (t[s] == null)return;const r = Hn(t[s], this);- _l(r) ? n.push((async function() {+ wl(r) ? n.push((async function() {t[s] = await r;})()) : t[s] = r;}), t.blockTag != null) {const s = this._getBlockTag(t.blockTag);- _l(s) ? n.push((async function() {+ wl(s) ? n.push((async function() {t.blockTag = await s;})()) : t.blockTag = s;}@@ -48537,7 +48546,7 @@ class S2 {gasPrice: (async () => {try {const h = await this.#c({ method: "getGasPrice" });- return Ne(h, "%response");+ return De(h, "%response");} catch {}return null;@@ -48545,7 +48554,7 @@ class S2 {priorityFee: (async () => {try {const h = await this.#c({ method: "getPriorityFee" });- return Ne(h, "%response");+ return De(h, "%response");} catch {}return null;@@ -48553,35 +48562,35 @@ class S2 {});let o = null, c = null;const l = this._wrapBlock(s, e);- return l && l.baseFeePerGas && (c = a ?? BigInt("1000000000"), o = l.baseFeePerGas * y2 + c), new Km(r, o, c);+ return l && l.baseFeePerGas && (c = a ?? BigInt("1000000000"), o = l.baseFeePerGas * N2 + c), new Ym(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 Km(r.gasPrice, r.maxFeePerGas, r.maxPriorityFeePerGas);+ return new Ym(r.gasPrice, r.maxFeePerGas, r.maxPriorityFeePerGas);}return await t();}async estimateGas(e) {let t = this._getTransactionRequest(e);- return _l(t) && (t = await t), Ne(await this.#c({+ return wl(t) && (t = await t), De(await this.#c({method: "estimateGas",transaction: t}), "%response");}async #h(e, t, n) {- ge(n < w2, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {+ ge(n < D2, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {reason: "TOO_MANY_REDIRECTS",transaction: Object.assign({}, e, { blockTag: t, enableCcipRead: !0 })});- const s = ah(e);+ const s = ch(e);try {- return Se(await this._perform({ method: "call", transaction: s, blockTag: t }));+ return Ie(await this._perform({ method: "call", transaction: s, blockTag: t }));} catch (r) {- if (!this.disableCcipRead && up(r) && r.data && n >= 0 && t === "latest" && s.to != null && Kt(r.data, 0, 4) === "0x556f1830") {+ 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);let c;try {- c = R2(Kt(r.data, 4));+ c = H2(Kt(r.data, 4));} catch (u) {ge(!1, u.message, "OFFCHAIN_FAULT", {reason: "BAD_DATA",@@ -48609,7 +48618,7 @@ class S2 {});const h = {to: o,- data: Gt([c.selector, T2([l, c.extraData])])+ data: Ht([c.selector, G2([l, c.extraData])])};this.emit("debug", { action: "sendCcipReadCall", transaction: h });try {@@ -48642,17 +48651,17 @@ class S2 {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");+ return De(await this.#d({ method: "getBalance" }, e, t), "%response");}async getTransactionCount(e, t) {return ft(await this.#d({ method: "getTransactionCount" }, e, t), "%response");}async getCode(e, t) {- return Se(await this.#d({ method: "getCode" }, e, t));+ return Ie(await this.#d({ method: "getCode" }, e, t));}async getStorage(e, t, n) {- const s = Ne(t, "position");- return Se(await this.#d({ method: "getStorage", position: s }, e, n));+ const s = De(t, "position");+ return Ie(await this.#d({ method: "getStorage", position: s }, e, n));}// Writeasync broadcastTransaction(e) {@@ -48663,7 +48672,7 @@ class S2 {signedTransaction: e}),network: this.getNetwork()- }), r = yi.from(e);+ }), r = _i.from(e);if (r.hash !== n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(r, s).replaceableTransaction(t);@@ -48717,12 +48726,12 @@ class S2 {network: this.getNetwork(),result: this.#c({ method: "getTransactionResult", hash: e })});- return t == null ? null : Se(t);+ return t == null ? null : Ie(t);}// Bloom-filter Queriesasync getLogs(e) {let t = this._getFilter(e);- _l(t) && (t = await t);+ wl(t) && (t = await t);const { network: n, params: s } = await Un({network: this.getNetwork(),params: this.#c({ method: "getLogs", filter: t })@@ -48736,7 +48745,7 @@ class S2 {});}async getResolver(e) {- return await Ra.fromName(this, e);+ return await Fa.fromName(this, e);}async getAvatar(e) {const t = await this.getResolver(e);@@ -48748,14 +48757,14 @@ class S2 {}async lookupAddress(e) {e = Mt(e);- const t = _f(e.substring(2).toLowerCase() + ".addr.reverse");+ const t = vf(e.substring(2).toLowerCase() + ".addr.reverse");try {- const n = await Ra.getEnsAddress(this), r = await new Ta(n, [+ const n = await Fa.getEnsAddress(this), r = await new Mr(n, ["function resolver(bytes32) view returns (address)"], this).resolver(t);- if (r == null || r === nc)+ if (r == null || r === sc)return null;- const o = await new Ta(r, [+ const o = await new Mr(r, ["function name(bytes32) view returns (string)"], this).name(t);return await this.resolveName(o) !== e ? null : o;@@ -48783,7 +48792,7 @@ class S2 {this.once("block", c);});n != null && (o = setTimeout(() => {- o != null && (o = null, this.off("block", c), a(Ht("timeout", "TIMEOUT", { reason: "timeout" })));+ o != null && (o = null, this.off("block", c), a(Gt("timeout", "TIMEOUT", { reason: "timeout" })));}, n)), c(await this.getBlockNumber());});}@@ -48816,7 +48825,7 @@ class S2 {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: sd() });+ this.#l.set(n, { timer: r, func: s, time: od() });}return n;}@@ -48836,20 +48845,20 @@ class S2 {case "debug":case "error":case "network":- return new UE(e.type);+ return new zE(e.type);case "block": {- const t = new x2(this);+ const t = new B2(this);return t.pollingInterval = this.pollingInterval, t;}case "safe":case "finalized":- return new b2(this, e.type);+ return new T2(this, e.type);case "event":- return new Rp(this, e.filter);+ return new Dp(this, e.filter);case "transaction":- return new _2(this, e.hash);+ return new F2(this, e.hash);case "orphan":- return new E2(this, e.filter);+ return new R2(this, e.filter);}throw new Error(`unsupported event: ${e.type}`);}@@ -48870,11 +48879,11 @@ class S2 {}}async #g(e, t) {- let n = await id(e, this);- return n.type === "event" && t && t.length > 0 && t[0].removed === !0 && (n = await id({ orphan: "drop-log", log: t[0] }, this)), this.#e.get(n.tag) || null;+ 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;}async #m(e) {- const t = await id(e, this), n = t.tag;+ const t = await ad(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;}@@ -48892,7 +48901,7 @@ class S2 {return !1;const s = n.listeners.length;return n.listeners = n.listeners.filter(({ listener: r, once: a }) => {- const o = new sb(this, a ? null : r, e);+ const o = new lb(this, a ? null : r, e);try {r.call(this, ...t, o);} catch {@@ -49001,7 +49010,7 @@ class S2 {}this._forEachSubscriber((t) => t.pause(e)), this.#n = !!e;for (const t of this.#l.values())- t.timer && clearTimeout(t.timer), t.time = sd() - t.time;+ t.timer && clearTimeout(t.timer), t.time = od() - t.time;}/*** Resume the provider.@@ -49011,21 +49020,21 @@ class S2 {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 = sd(), setTimeout(e.func, t);+ t < 0 && (t = 0), e.time = od(), setTimeout(e.func, t);}}}}-function I2(i, e) {+function U2(i, e) {try {- const t = Sf(i, e);+ const t = Bf(i, e);if (t)- return $l(t);+ return th(t);} catch {}return null;}-function Sf(i, e) {+function Bf(i, e) {if (i === "0x")return null;try {@@ -49035,33 +49044,33 @@ function Sf(i, e) {}return null;}-function t0(i) {+function s0(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 M2(i) {+function O2(i) {if (i.length % 32 === 0)return i;const e = new Uint8Array(Math.ceil(i.length / 32) * 32);return e.set(i), e;}-const B2 = new Uint8Array([]);-function T2(i) {+const Q2 = new Uint8Array([]);+function G2(i) {const e = [];let t = 0;for (let n = 0; n < i.length; n++)- e.push(B2), t += 32;+ e.push(Q2), t += 32;for (let n = 0; n < i.length; n++) {const s = dt(i[n]);- e[n] = t0(t), e.push(t0(s.length)), e.push(M2(s)), t += 32 + Math.ceil(s.length / 32) * 32;+ e[n] = s0(t), e.push(s0(s.length)), e.push(O2(s)), t += 32 + Math.ceil(s.length / 32) * 32;}- return Gt(e);+ return Ht(e);}-const n0 = "0x0000000000000000000000000000000000000000000000000000000000000000";-function R2(i) {+const r0 = "0x0000000000000000000000000000000000000000000000000000000000000000";+function H2(i) {const e = {sender: "",urls: [],@@ -49070,17 +49079,17 @@ function R2(i) {extraData: "",errorArgs: []};- ge(Ia(i) >= 160, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {+ ge(Ba(i) >= 160, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {reason: "insufficient OffchainLookup data"});const t = Kt(i, 0, 32);- ge(Kt(t, 0, 12) === Kt(n0, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {+ ge(Kt(t, 0, 12) === Kt(r0, 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 = I2(a, o * 32);+ const c = U2(a, o * 32);if (c == null)throw new Error("abort");n.push(c);@@ -49092,7 +49101,7 @@ function R2(i) {});}try {- const n = Sf(i, 64);+ const n = Bf(i, 64);if (n == null)throw new Error("abort");e.calldata = n;@@ -49101,11 +49110,11 @@ function R2(i) {reason: "corrupt OffchainLookup calldata"});}- ge(Kt(i, 100, 128) === Kt(n0, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {+ ge(Kt(i, 100, 128) === Kt(r0, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {reason: "corrupt OffchainLookup callbaackSelector"}), e.selector = Kt(i, 96, 100);try {- const n = Sf(i, 128);+ const n = Bf(i, 128);if (n == null)throw new Error("abort");e.extraData = n;@@ -49116,13 +49125,13 @@ function R2(i) {}return e.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((n) => e[n]), e;}-function lr(i, e) {+function hr(i, e) {if (i.provider)return i.provider;ge(!1, "missing provider", "UNSUPPORTED_OPERATION", { operation: e });}-async function i0(i, e) {- let t = ah(e);+async function a0(i, e) {+ let t = ch(e);if (t.to != null && (t.to = Hn(t.to, i)), t.from != null) {const n = t.from;t.from = Promise.all([@@ -49133,7 +49142,7 @@ async function i0(i, e) {t.from = i.getAddress();return await Un(t);}-class F2 {+class z2 {/*** The provider this signer is connected to.*/@@ -49145,17 +49154,17 @@ class F2 {Ye(this, { provider: e || null });}async getNonce(e) {- return lr(this, "getTransactionCount").getTransactionCount(await this.getAddress(), e);+ return hr(this, "getTransactionCount").getTransactionCount(await this.getAddress(), e);}async populateCall(e) {- return await i0(this, e);+ return await a0(this, e);}async populateTransaction(e) {- const t = lr(this, "populateTransaction"), n = await i0(this, e);+ const t = hr(this, "populateTransaction"), n = await a0(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);+ const a = De(n.chainId);V(a === s.chainId, "transaction chainId mismatch", "tx.chainId", e.chainId);} elsen.chainId = s.chainId;@@ -49187,21 +49196,21 @@ class F2 {}async populateAuthorization(e) {const t = Object.assign({}, e);- return t.chainId == null && (t.chainId = (await lr(this, "getNetwork").getNetwork()).chainId), t.nonce == null && (t.nonce = await this.getNonce()), t;+ 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 lr(this, "estimateGas").estimateGas(await this.populateCall(e));+ return hr(this, "estimateGas").estimateGas(await this.populateCall(e));}async call(e) {- return lr(this, "call").call(await this.populateCall(e));+ return hr(this, "call").call(await this.populateCall(e));}async resolveName(e) {- return await lr(this, "resolveName").resolveName(e);+ return await hr(this, "resolveName").resolveName(e);}async sendTransaction(e) {- const t = lr(this, "sendTransaction"), n = await this.populateTransaction(e);+ const t = hr(this, "sendTransaction"), n = await this.populateTransaction(e);delete n.from;- const s = yi.from(n);+ const s = _i.from(n);return await t.broadcastTransaction(await this.signTransaction(s));}// @TODO: in v7 move this to be abstract@@ -49209,10 +49218,10 @@ class F2 {ge(!1, "authorization not implemented for this signer", "UNSUPPORTED_OPERATION", { operation: "authorize" });}}-function D2(i) {+function V2(i) {return JSON.parse(JSON.stringify(i));}-class OE {+class VE {#e;#t;#n;@@ -49290,17 +49299,17 @@ class OE {this.start();}}-class N2 extends OE {+class W2 extends VE {#e;/*** Creates a new **FilterIdEventSubscriber** attached to %%provider%%* listening for %%filter%%.*/constructor(e, t) {- super(e), this.#e = D2(t);+ super(e), this.#e = V2(t);}_recover(e) {- return new Rp(e, this.#e);+ return new Dp(e, this.#e);}async _subscribe(e) {return await e.send("eth_newFilter", [this.#e]);@@ -49310,7 +49319,7 @@ class N2 extends OE {e.emit(this.#e, e._wrapLog(n, e._network));}}-class L2 extends OE {+class q2 extends VE {async _subscribe(e) {return await e.send("eth_newPendingTransactionFilter", []);}@@ -49319,28 +49328,28 @@ class L2 extends OE {e.emit("pending", n);}}-const P2 = "bigint,boolean,function,number,string,symbol".split(/,/g);-function Rl(i) {- if (i == null || P2.indexOf(typeof i) >= 0 || typeof i.getAddress == "function")+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")return i;if (Array.isArray(i))- return i.map(Rl);+ return i.map(Nl);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 k2(i) {+function j2(i) {return new Promise((e) => {setTimeout(e, i);});}-function la(i) {+function ua(i) {return i && i.toLowerCase();}-function s0(i) {+function o0(i) {return i && typeof i.pollingInterval == "number";}-const QE = {+const WE = {polling: !1,staticNetwork: null,batchStallTime: 10,@@ -49349,7 +49358,7 @@ const QE = {cacheTimeout: 250,pollingInterval: 4e3};-class rd extends F2 {+class cd extends z2 {address;constructor(e, t) {super(e), t = Mt(t), Ye(this, { address: t });@@ -49369,7 +49378,7 @@ class rd extends F2 {// Returns just the hash of the transaction after sent, which is what// the bare JSON-RPC API does;async sendUncheckedTransaction(e) {- const t = Rl(e), n = [];+ const t = Nl(e), n = [];if (t.from) {const r = t.from;n.push((async () => {@@ -49411,7 +49420,7 @@ class rd extends F2 {r(l);return;}- this.provider.emit("error", Ht("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error: l }));+ this.provider.emit("error", Gt("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error: l }));}this.provider._setTimeout(() => {c();@@ -49421,7 +49430,7 @@ class rd extends F2 {});}async signTransaction(e) {- const t = Rl(e);+ const t = Nl(e);if (t.from) {const s = await Hn(t.from, this.provider);V(s != null && s.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", e), t.from = s;@@ -49433,12 +49442,12 @@ class rd extends F2 {async signMessage(e) {const t = typeof e == "string" ? gs(e) : e;return await this.provider.send("personal_sign", [- Se(t),+ Ie(t),this.address.toLowerCase()]);}async signTypedData(e, t, n) {- const s = Rl(n), r = await $n.resolveNames(e, t, s, async (a) => {+ const s = Nl(n), r = await $n.resolveNames(e, t, s, async (a) => {const o = await Hn(a);return V(o != null, "TypedData does not support null address", "value", a), o;});@@ -49459,11 +49468,11 @@ class rd extends F2 {const t = typeof e == "string" ? gs(e) : e;return await this.provider.send("eth_sign", [this.address.toLowerCase(),- Se(t)+ Ie(t)]);}}-class U2 extends S2 {+class X2 extends k2 {#e;// The next ID to use for the JSON-RPC ID field#t;@@ -49495,12 +49504,12 @@ class U2 extends S2 {this.emit("debug", { action: "receiveRpcResult", result: r });for (const { resolve: a, reject: o, payload: c } of n) {if (this.destroyed) {- o(Ht("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: c.method }));+ o(Gt("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 = Ht("missing response for request", "BAD_DATA", {+ const h = Gt("missing response for request", "BAD_DATA", {value: r,info: { payload: c }});@@ -49523,7 +49532,7 @@ class U2 extends S2 {}, e);}constructor(e, t) {- super(e, t), this.#t = 1, this.#e = Object.assign({}, QE, t || {}), this.#n = [], this.#i = null, this.#a = null, this.#r = null;+ super(e, t), this.#t = 1, this.#e = Object.assign({}, WE, t || {}), this.#n = [], this.#i = null, this.#a = null, this.#r = null;{let s = null;const r = new Promise((a) => {@@ -49558,7 +49567,7 @@ class U2 extends S2 {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) {+ if (n && n.type != null && De(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 })@@ -49585,7 +49594,7 @@ class U2 extends S2 {return e;return this.#r ? await this.#r : this.ready ? (this.#r = (async () => {try {- const t = ni.from(Ne(await this.send("eth_chainId", [])));+ const t = ni.from(De(await this.send("eth_chainId", [])));return this.#r = null, t;} catch (t) {throw this.#r = null, t;@@ -49605,7 +49614,7 @@ class U2 extends S2 {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));+ return ni.from(De(n.result));throw this.getRpcError(t, n);})(), await this.#r);}@@ -49624,7 +49633,7 @@ class U2 extends S2 {} 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", Ht("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error: e } })), await k2(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 j2(1e3);}this.#o();})());@@ -49645,7 +49654,7 @@ class U2 extends S2 {* subscription management.*/_getSubscriber(e) {- return e.type === "pending" ? new L2(this) : e.type === "event" ? this._getOption("polling") ? new Rp(this, e.filter) : new N2(this, e.filter) : e.type === "orphan" && e.filter.orphan === "drop-log" ? new UE("orphan") : super._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);}/*** Returns true only if the [[_start]] has been called.@@ -49664,11 +49673,11 @@ class U2 extends S2 {if (e[n] == null)return;let s = n;- n === "gasLimit" && (s = "gas"), t[s] = wi(Ne(e[n], `tx.${n}`));+ n === "gasLimit" && (s = "gas"), t[s] = wi(De(e[n], `tx.${n}`));}), ["from", "to", "data"].forEach((n) => {- e[n] != null && (t[n] = Se(e[n]));- }), e.accessList && (t.accessList = Qr(e.accessList)), e.blobVersionedHashes && (t.blobVersionedHashes = e.blobVersionedHashes.map((n) => n.toLowerCase())), e.authorizationList && (t.authorizationList = e.authorizationList.map((n) => {- const s = Wb(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);return {address: s.address,nonce: wi(s.nonce),@@ -49696,23 +49705,23 @@ class U2 extends S2 {case "getBalance":return {method: "eth_getBalance",- args: [la(e.address), e.blockTag]+ args: [ua(e.address), e.blockTag]};case "getTransactionCount":return {method: "eth_getTransactionCount",- args: [la(e.address), e.blockTag]+ args: [ua(e.address), e.blockTag]};case "getCode":return {method: "eth_getCode",- args: [la(e.address), e.blockTag]+ args: [ua(e.address), e.blockTag]};case "getStorage":return {method: "eth_getStorageAt",args: [- la(e.address),+ ua(e.address),"0x" + e.position.toString(16),e.blockTag]@@ -49755,7 +49764,7 @@ class U2 extends S2 {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(la) : e.filter.address = la(e.filter.address)), { method: "eth_getLogs", args: [e.filter] };+ return e.filter && e.filter.address != null && (Array.isArray(e.filter.address) ? e.filter.address = e.filter.address.map(ua) : e.filter.address = ua(e.filter.address)), { method: "eth_getLogs", args: [e.filter] };}return null;}@@ -49770,23 +49779,23 @@ class U2 extends S2 {if (n === "eth_estimateGas" && s.message) {const o = s.message;if (!o.match(/revert/i) && o.match(/insufficient funds/i))- return Ht("insufficient funds", "INSUFFICIENT_FUNDS", {+ return Gt("insufficient funds", "INSUFFICIENT_FUNDS", {transaction: e.params[0],info: { payload: e, error: s }});if (o.match(/nonce/i) && o.match(/too low/i))- return Ht("nonce has already been used", "NONCE_EXPIRED", {+ return Gt("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 = If(s), c = Ha.getBuiltinCallException(n === "eth_call" ? "call" : "estimateGas", e.params[0], o ? o.data : null);+ const o = Tf(s), c = za.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(G2(s));+ const r = JSON.stringify(Y2(s));if (typeof s.message == "string" && s.message.match(/user denied|ethers-user-denied/i))- return Ht("user rejected action", "ACTION_REJECTED", {+ return Gt("user rejected action", "ACTION_REJECTED", {action: {eth_sign: "signMessage",personal_sign: "signMessage",@@ -49802,25 +49811,25 @@ class U2 extends S2 {if (n === "eth_sendRawTransaction" || n === "eth_sendTransaction") {const o = e.params[0];if (r.match(/insufficient funds|base fee exceeds gas limit/i))- return Ht("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", {+ return Gt("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", {transaction: o,info: { error: s }});if (r.match(/nonce/i) && r.match(/too low/i))- return Ht("nonce has already been used", "NONCE_EXPIRED", { transaction: o, info: { error: s } });+ return Gt("nonce has already been used", "NONCE_EXPIRED", { transaction: o, info: { error: s } });if (r.match(/replacement transaction/i) && r.match(/underpriced/i))- return Ht("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction: o, info: { error: s } });+ return Gt("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction: o, info: { error: s } });if (r.match(/only replay-protected/i))- return Ht("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", {+ return Gt("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 ? Ht("unsupported operation", "UNSUPPORTED_OPERATION", {+ return a || s && s.details && s.details.startsWith("Unauthorized method:") && (a = !0), a ? Gt("unsupported operation", "UNSUPPORTED_OPERATION", {operation: e.method,info: { error: s, payload: e }- }) : Ht("could not coalesce error", "UNKNOWN_ERROR", { error: s, payload: e });+ }) : Gt("could not coalesce error", "UNKNOWN_ERROR", { error: s, payload: e });}/*** Requests the %%method%% with %%params%% via the JSON-RPC protocol@@ -49837,7 +49846,7 @@ class U2 extends S2 {*/send(e, t) {if (this.destroyed)- return Promise.reject(Ht("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: e }));+ return Promise.reject(Gt("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: e }));const n = this.#t++, s = new Promise((r, a) => {this.#n.push({resolve: r,@@ -49866,7 +49875,7 @@ class U2 extends S2 {const s = await t;if (e >= s.length)throw new Error("no such account");- return new rd(this, s[e]);+ return new cd(this, s[e]);}const { accounts: n } = await Un({network: this.getNetwork(),@@ -49875,29 +49884,29 @@ class U2 extends S2 {e = Mt(e);for (const s of n)if (Mt(s) === e)- return new rd(this, e);+ return new cd(this, e);throw new Error("invalid account");}async listAccounts() {- return (await this.send("eth_accounts", [])).map((t) => new rd(this, t));+ return (await this.send("eth_accounts", [])).map((t) => new cd(this, t));}destroy() {this.#i && (clearTimeout(this.#i), this.#i = null);for (const { payload: e, reject: t } of this.#n)- t(Ht("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: e.method }));+ t(Gt("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: e.method }));this.#n = [], super.destroy();}}-class O2 extends U2 {+class qE extends X2 {#e;constructor(e, t) {super(e, t);let n = this._getOption("pollingInterval");- n == null && (n = QE.pollingInterval), this.#e = n;+ n == null && (n = WE.pollingInterval), this.#e = n;}_getSubscriber(e) {const t = super._getSubscriber(e);- return s0(t) && (t.pollingInterval = this.#e), t;+ return o0(t) && (t.pollingInterval = this.#e), t;}/*** The polling interval (default: 4000 ms)@@ -49909,11 +49918,11 @@ class O2 extends U2 {if (!Number.isInteger(e) || e < 0)throw new Error("invalid interval");this.#e = e, this._forEachSubscriber((t) => {- s0(t) && (t.pollingInterval = this.#e);+ o0(t) && (t.pollingInterval = this.#e);});}}-class Q2 extends O2 {+class KE extends qE {#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();@@ -49933,14 +49942,14 @@ class Q2 extends O2 {return Array.isArray(s) || (s = [s]), s;}}-function If(i) {+function Tf(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 = If(i[e]);+ const t = Tf(i[e]);if (t)return t;}@@ -49948,28 +49957,153 @@ function If(i) {}if (typeof i == "string")try {- return If(JSON.parse(i));+ return Tf(JSON.parse(i));} catch {}return null;}-function Mf(i, e) {+function Rf(i, e) {if (i != null) {if (typeof i.message == "string" && e.push(i.message), typeof i == "object")for (const t in i)- Mf(i[t], e);+ Rf(i[t], e);if (typeof i == "string")try {- return Mf(JSON.parse(i), e);+ return Rf(JSON.parse(i), e);} catch {}}}-function G2(i) {+function Y2(i) {const e = [];- return Mf(i, e), e;+ return Rf(i, e), e;}-const H2 = [+class br extends qE {+ #e;+ #t;+ /**+ * Connect to the %%ethereum%% provider, optionally forcing the+ * %%network%%.+ */+ 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);+ }+ /**+ * Resolves to ``true`` if the provider manages the %%address%%.+ */+ 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);+ }+ /**+ * Discover and connect to a Provider in the Browser using the+ * [[link-eip-6963]] discovery mechanism. If no providers are+ * present, ``null`` is resolved.+ */+ static async discover(e) {+ if (e == null && (e = {}), e.provider)+ return new br(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 br(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 br)+ 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 br(f, void 0, {+ providerInfo: p+ }));+ } else+ a(Gt("filter returned unknown info", "UNSUPPORTED_OPERATION", {+ value: u+ }));+ }+ } else {+ const { provider: u, info: d } = o[0];+ r(new br(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 jE = [// --- Registration ---"function register() external returns (uint256 agentId)","function register(string agentURI) external returns (uint256 agentId)",@@ -49999,7 +50133,7 @@ const H2 = [// --- Events ---"event Registered(uint256 indexed agentId, string agentURI, address indexed owner)","event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"-], hr = {+], ur = {identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e",reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713",validationRegistry: "0x8004Cb1BF31DAf7788923b405b754f57acEB4272"@@ -50008,7 +50142,7 @@ const H2 = [reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",validationRegistry: ""// not yet deployed on mainnet-}, z2 = {+}, kh = {// Mainnets1: Ln,// Ethereum@@ -50041,56 +50175,139 @@ const H2 = [534352: Ln,// Scroll// Testnets- 97: hr,+ 97: ur,// BSC Testnet- 11155111: hr,+ 11155111: ur,// Ethereum Sepolia- 84532: hr,+ 84532: ur,// Base Sepolia- 421614: hr,+ 421614: ur,// Arbitrum Sepolia- 11155420: hr,+ 11155420: ur,// Optimism Sepolia- 80002: hr,+ 80002: ur,// Polygon Amoy- 43113: hr+ 43113: ur// Avalanche Fuji-}, V2 = {+};+function J2(i, e) {+ return `eip155:${i}:${e}`;+}+const XE = {+ // ── 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 },+ 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 },+ // ── Testnets ──────────────────────────────────────────────────────────+ 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 Z2(i, e) {+ if (e) return new br(e);+ const t = XE[i];+ if (!t) throw new Error(`No RPC configured for chainId ${i}`);+ return new KE(t.rpcUrl, i);+}+function $2(i, e) {+ const t = kh[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);+}+async function eP({ chainId: i, agentId: e, ethProvider: t }) {+ const n = $2(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) {+ 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 tP(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 nP = {base: 8453,"base-mainnet": 8453,"base-sepolia": 84532,ethereum: 1,mainnet: 1-}, W2 = {+}, iP = {8453: "https://mainnet.base.org",84532: "https://sepolia.base.org",1: "https://eth.llamarpc.com"};-async function r0(i, { rpcURL: e, registry: t } = {}) {+async function c0(i, { rpcURL: e, registry: t } = {}) {if (!i) throw new Error("loadManifest: source required");if (i.startsWith("agent://"))- return q2(i, { rpcURL: e, registryOverride: t });+ return sP(i, { rpcURL: e, registryOverride: t });if (i.startsWith("ipfs://") || i.startsWith("ar://")) {- const n = Nr(i), s = await Bf(n);- return Tf(s, { baseURI: Rf(n) });+ const n = Xs(i), s = await Ff(n);+ return Nf(s, { baseURI: Df(n) });}if (i.startsWith("http")) {- const n = await Bf(i);- return Tf(n, { baseURI: Rf(i) });+ const n = await Ff(i);+ return Nf(n, { baseURI: Df(i) });}throw new Error(`Unsupported manifest source: ${i}`);}-async function q2(i, { rpcURL: e, registryOverride: t }) {+async function sP(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 = V2[s.toLowerCase()] || Number(s);+ const [, s, r] = n, a = nP[s.toLowerCase()] || Number(s);if (!a) throw new Error(`Unknown chain: ${s}`);- const o = z2[a], c = t || o?.identityRegistry;+ const o = kh[a], c = t || o?.identityRegistry;if (!c)throw new Error(`No registry deployed on chain ${a}. Pass registry= override.`);- const l = new Q2(e || W2[a]), h = new Ta(c, H2, l), u = BigInt(r), d = await h.tokenURI(u);+ const l = new KE(e || iP[a]), h = new Mr(c, jE, l), u = BigInt(r), d = await h.tokenURI(u);if (!d) throw new Error(`Agent ${r} on chain ${a} has no URI`);- const f = Nr(d), p = await Bf(f), m = Tf(p, { baseURI: Rf(f) });+ const f = Xs(d), p = await Ff(f), m = Nf(p, { baseURI: Df(f) });return m.id = {...m.id,chain: s,@@ -50099,23 +50316,23 @@ async function q2(i, { rpcURL: e, registryOverride: t }) {agentId: r}, m;}-async function Bf(i) {+async function Ff(i) {let e;try {e = await fetch(i);} catch {- e = await zR(i);+ e = await eF(i);}if (!e.ok) throw new Error(`Manifest fetch failed: ${i} (${e.status})`);return e.json();}-function Tf(i, { baseURI: e = "" } = {}) {+function Nf(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] || {};+ const t = i.registrations?.[0] || {}, n = YE(i);return {spec: "agent-manifest/0.1",_baseURI: e,@@ -50124,13 +50341,16 @@ function Tf(i, { baseURI: e = "" } = {}) {name: i.name,description: i.description,image: i.image,- body: { uri: i.image, format: "gltf-binary" },+ body: { uri: Xs(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"+ version: "0.1.0",+ services: Array.isArray(i.services) ? i.services : [],+ x402Support: !!i.x402Support,+ embedPolicy: i.embedPolicy || null};}return {@@ -50150,11 +50370,11 @@ function Tf(i, { baseURI: e = "" } = {}) {version: i.version || "0.1.0"};}-function Rf(i) {+function Df(i) {const e = i.lastIndexOf("/");return e >= 0 ? i.slice(0, e + 1) : i;}-async function K2(i, e) {+async function rP(i, e) {if (!i._baseURI) return null;try {const t = new URL(e, i._baseURI).href, n = await fetch(t);@@ -50168,7 +50388,7 @@ class os extends Error {super(t), this.name = "AgentResolveError", this.code = e, n !== void 0 && (this.status = n);}}-async function a0(i, { fetchFn: e }) {+async function l0(i, { fetchFn: e }) {let t;try {t = await e(i, { credentials: "include" });@@ -50187,13 +50407,13 @@ async function a0(i, { fetchFn: e }) {throw new os("network", `invalid JSON from ${i}: ${n.message || n}`);}}-async function j2(i, { origin: e = typeof location < "u" ? location.origin : "", fetchFn: t = fetch } = {}) {+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 a0(`${e}/api/agents/${encodeURIComponent(i)}`, { fetchFn: n }))?.agent;+ 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`);if (!r.avatar_id)throw new os("no_avatar", `agent ${i} has no avatar bound`);- const o = (await a0(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`, { fetchFn: n }))?.avatar;+ const o = (await l0(`${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`);const c = Array.isArray(r.skills) ? r.skills.map((l) => typeof l == "string" ? { name: l } : l).filter(Boolean) : [];@@ -50218,7 +50438,139 @@ async function j2(i, { origin: e = typeof location < "u" ? location.origin : "",_source: "agent-id"};}-const X2 = ["inline", "floating", "section", "fullscreen"], Y2 = `+function JE(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 oP(i) {+ const e = i.registry || kh[i.chainId]?.identityRegistry;+ return e ? `eip155:${i.chainId}:${e}:${i.agentId}` : `onchain:${i.chainId}:${i.agentId}`;+}+function cP(i, { embed: e = !1, origin: t } = {}) {+ return `${t || (typeof location < "u" ? location.origin : "")}/a/${i.chainId}/${i.agentId}${e ? "/embed" : ""}`;+}+const lP = [+ "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 : "";+}+const Eo = /* @__PURE__ */ new Map();+function uP(i) {+ return `${i.chainId}:${i.agentId}`;+}+async function dP(i, { ethProvider: e, fresh: t = !1 } = {}) {+ const n = JE(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+ };+ 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 = {+ ref: s,+ caip: oP(s),+ publicUrl: typeof location < "u" ? cP(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 eP({+ 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);+ if (!h.ok)+ return o.error = h.error, o.metadataUrl = h.resolvedUrl || null, Eo.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);+ } catch (c) {+ o.error = c.message || String(c);+ }+ return Eo.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) : "";+ return {+ spec: "agent-manifest/0.1",+ _baseURI: i.metadataUrl ? pP(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: J2(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 pP(i) {+ const e = i.lastIndexOf("/");+ return e >= 0 ? i.slice(0, e + 1) : i;+}+const AP = ["inline", "floating", "section", "fullscreen"], u0 = (() => {+ try {+ return new URL(import.meta.url).origin;+ } catch {+ return "";+ }+})();+function gP(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 mP = `:host {display: block;position: relative;@@ -50383,9 +50735,22 @@ const X2 = ["inline", "floating", "section", "fullscreen"], Y2 = `font: 14px var(--agent-chat-font);}`;-class GE extends HTMLElement {+class ZE extends HTMLElement {static get observedAttributes() {- return ["src", "manifest", "body", "agent-id", "mode", "position", "width", "height", "voice", "api-key", "key-proxy", "responsive"];+ 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;@@ -50401,7 +50766,7 @@ class GE extends HTMLElement {}_renderShell() {const e = document.createElement("style");- e.textContent = Y2, this.shadowRoot.appendChild(e);+ e.textContent = mP, 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");@@ -50448,7 +50813,7 @@ class GE extends HTMLElement {}_applyLayout() {const e = this.getAttribute("mode") || "inline";- if (!X2.includes(e)) return;+ if (!AP.includes(e)) return;const t = this._isResponsive();if (e === "floating") {if (!this._pillActive) {@@ -50456,22 +50821,39 @@ class GE extends HTMLElement {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);+ 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);+ 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 });+ 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());@@ -50509,75 +50891,159 @@ class GE extends HTMLElement {if (!(this._booting || this._mounted)) {this._booting = !0;try {- this._loadingEl.hidden = !1, this.dispatchEvent(new CustomEvent("agent:load-progress", { detail: { phase: "manifest", pct: 0.1 } }));+ this._loadingEl.hidden = !1, this.dispatchEvent(+ new CustomEvent("agent:load-progress", { detail: { phase: "manifest", pct: 0.1 } })+ );const e = await this._resolveManifest();- 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 c = await K2(e, e.brain.instructions);- c && (e.instructions = J2(c));+ 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));} else e.brain?.instructions && (e.instructions = e.brain.instructions);- this.dispatchEvent(new CustomEvent("agent:load-progress", { detail: { phase: "body", pct: 0.45 } }));- const t = new Zx(this._stageEl, { kiosk: this.hasAttribute("kiosk") });- this._viewer = t;- const n = Nr(e.body?.uri);- n && await t.load(n, "", /* @__PURE__ */ new Map()), this._scene = new qR(t), this.dispatchEvent(new CustomEvent("agent:load-progress", { detail: { phase: "memory", pct: 0.6 } }));- const s = e.id?.agentId || this.getAttribute("memory-key") || e.name || "anon";+ 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 = u0 || 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") && !gP(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: 0.45 } })+ );+ const n = new ib(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(+ 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({mode: this.getAttribute("memory") || e.memory?.mode || "local",- namespace: s,+ 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 oF({+ }), this.dispatchEvent(+ new CustomEvent("agent:load-progress", { detail: { phase: "skills", pct: 0.75 } })+ ), this._skills = new xF({trust: this.getAttribute("skill-trust") || "owned-only",ownerAddress: e.id?.owner});- const r = e.skills || [];- for (const c of r)+ const a = e.skills || [];+ for (const l of a)try {- const l = await this._skills.install(c, { bundleBase: e._baseURI });- this.dispatchEvent(new CustomEvent("skill:loaded", { detail: { name: l.name, uri: l.uri } }));- } catch (l) {- console.warn("[agent-3d] skill load failed", c, l);+ 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: 0.9 } }));- const a = {+ this.dispatchEvent(+ new CustomEvent("agent:load-progress", { detail: { phase: "brain", pct: 0.9 } })+ );+ const o = {apiKey: this.getAttribute("api-key") || void 0,- proxyURL: this.getAttribute("key-proxy") || void 0- }, o = this._parseTTSAttribute();- o && (e.voice = e.voice || {}, e.voice.tts = { ...e.voice.tts || {}, ...o }), this._runtime = new GR({+ proxyURL: this.getAttribute("key-proxy") || void 0,+ agentId: t || void 0,+ apiOrigin: u0 || window.location.origin+ }, c = this._parseTTSAttribute();+ c && (e.voice = e.voice || {}, e.voice.tts = { ...e.voice.tts || {}, ...c }), this._runtime = new ZR({manifest: e,viewer: this._scene,memory: this._memory,skills: this._skills,- providerConfig: a+ providerConfig: o});- for (const c of ["brain:thinking", "brain:message", "skill:tool-called", "voice:speech-start", "voice:speech-end", "voice:transcript", "voice:listen-start", "memory:write"])- this._runtime.addEventListener(c, (l) => {- this.dispatchEvent(new CustomEvent(c, { detail: l.detail, bubbles: !0, composed: !0 })), c === "brain:message" && this._chatEl && this._renderMessage(l.detail);+ 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- }));+ 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- }));+ 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");+ 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"), r0(e, { rpcURL: this.getAttribute("rpc-url"), registry: this.getAttribute("registry") });- if (s) return j2(s);- if (t) return r0(t);+ return s && console.warn("[agent-3d] both src and agent-id provided; using src"), c0(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 = JE(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);+ }+ return aP(s);+ }+ if (t) return c0(t);if (n) {- const r = this.getAttribute("instructions");+ const a = this.getAttribute("instructions");return {spec: "agent-manifest/0.1",_baseURI: "",@@ -50586,11 +51052,11 @@ class GE extends HTMLElement {brain: {provider: this.getAttribute("brain") ? "anthropic" : "none",model: this.getAttribute("brain") || void 0,- instructions: r || "You are an embodied 3D agent."+ instructions: a || "You are an embodied 3D agent."},- instructions: r || "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((a) => a.trim()).filter(Boolean).map((a) => ({ uri: a })),+ 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"@@ -50607,6 +51073,17 @@ class GE extends HTMLElement {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) {@@ -50712,12 +51189,12 @@ class GE extends HTMLElement {});}}-function J2(i) {+function xP(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", GE);-const Z2 = ["row", "circle", "freeform"], $2 = `+customElements.get("agent-3d") || customElements.define("agent-3d", ZE);+const bP = ["row", "circle", "freeform"], EP = `:host {display: block;position: relative;@@ -50738,7 +51215,7 @@ const Z2 = ["row", "circle", "freeform"], $2 = `pointer-events: none;}`;-class eP extends HTMLElement {+class yP extends HTMLElement {static get observedAttributes() {return ["formation"];}@@ -50765,14 +51242,14 @@ class eP extends HTMLElement {}get formation() {const e = this.getAttribute("formation") || "row";- return Z2.includes(e) ? e : "row";+ return bP.includes(e) ? e : "row";}get viewer() {return this._viewer;}_renderShell() {const e = document.createElement("style");- e.textContent = $2, this.shadowRoot.appendChild(e);+ e.textContent = EP, 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");@@ -50780,7 +51257,7 @@ class eP extends HTMLElement {}_initViewer() {if (!this._initialized) {- this._viewer = new Zx(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 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();try {this._viewer.updateLights?.();} catch {@@ -50809,7 +51286,7 @@ class eP extends HTMLElement {this._viewer?.scene.remove(n.group);} catch {}- tP(n.group), this._repositionAll(), this.dispatchEvent(new CustomEvent("stage:agent-left", {+ _P(n.group), this._repositionAll(), this.dispatchEvent(new CustomEvent("stage:agent-left", {detail: { agentId: n.id, element: n.element },bubbles: !0,composed: !0@@ -50903,7 +51380,7 @@ class eP extends HTMLElement {};}}-function tP(i) {+function _P(i) {i.traverse((e) => {if (e.geometry)try {@@ -50929,23 +51406,23 @@ function tP(i) {}}), i.parent && i.parent.remove(i);}-customElements.get("agent-stage") || customElements.define("agent-stage", eP);-const sP = (i = "agent-3d") => {- customElements.get(i) || customElements.define(i, GE);+customElements.get("agent-stage") || customElements.define("agent-stage", yP);+const CP = (i = "agent-3d") => {+ customElements.get(i) || customElements.define(i, ZE);};export {- GE as Agent3DElement,- eP as AgentStageElement,+ ZE as Agent3DElement,+ yP as AgentStageElement,Pi as Memory,- GR as Runtime,- qR as SceneController,- aF as Skill,- oF as SkillRegistry,- Zx as Viewer,- sP as defineElement,- K2 as fetchRelative,- zR as fetchWithFallback,- r0 as loadManifest,- Tf as normalize,- Nr as resolveURI+ 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,+ Xs as resolveURI};diff --git a/dist-lib/agent-3d.umd.cjs b/dist-lib/agent-3d.umd.cjsindex d09d47e5b..232cdd613 100644--- a/dist-lib/agent-3d.umd.cjs+++ b/dist-lib/agent-3d.umd.cjs@@ -1,8 +1,8 @@-(function(on,yc){typeof exports=="object"&&typeof module<"u"?yc(exports):typeof define=="function"&&define.amd?define(["exports"],yc):(on=typeof globalThis<"u"?globalThis:on||self,yc(on.Agent3D={}))})(this,(function(on){"use strict";const zr={ROTATE:0,DOLLY:1,PAN:2},Vr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},JE=0,kp=1,ZE=2,Up=1,$E=2,qi=3,Ki=0,Nn=1,Li=2,vs=0,Wr=1,Op=2,Qp=3,Gp=4,ey=5,nr=100,ty=101,ny=102,iy=103,sy=104,ry=200,ay=201,oy=202,cy=203,Uh=204,Oh=205,ly=206,hy=207,uy=208,dy=209,fy=210,py=211,Ay=212,gy=213,my=214,Qh=0,Gh=1,Hh=2,qr=3,zh=4,Vh=5,Wh=6,qh=7,_c=0,xy=1,by=2,Cs=0,Kh=1,Ey=2,yy=3,Hp=4,_y=5,wy=6,vy=7,zp="attached",Cy="detached",Vp=300,ir=301,Kr=302,wc=303,jh=304,vc=306,Ss=1e3,Jn=1001,Cc=1002,Ln=1003,Wp=1004,$a=1005,qt=1006,Sc=1007,si=1008,cn=1009,qp=1010,Kp=1011,eo=1012,Xh=1013,sr=1014,ln=1015,Pn=1016,Yh=1017,Jh=1018,to=1020,jp=35902,Xp=1021,Yp=1022,hn=1023,no=1026,io=1027,ji=1028,Zh=1029,rr=1030,$h=1031,eu=1033,Ic=33776,so=33777,Mc=33778,ro=33779,Bc=35840,tu=35841,Tc=35842,nu=35843,Rc=36196,Fc=37492,Dc=37496,ao=37808,iu=37809,su=37810,ru=37811,oo=37812,au=37813,ou=37814,cu=37815,lu=37816,hu=37817,uu=37818,du=37819,fu=37820,pu=37821,co=36492,Au=36494,Nc=36495,Jp=36283,gu=36284,mu=36285,xu=36286,Zp=2200,$p=2201,Sy=2202,lo=2300,ho=2301,bu=2302,jr=2400,Xr=2401,Lc=2402,Eu=2500,Iy=2501,My=0,eA=1,yu=2,By=3200,Ty=3201,Pc=0,Ry=1,gi="",yt="srgb",un="srgb-linear",kc="linear",Rt="srgb",Yr=7680,tA=519,Fy=512,Dy=513,Ny=514,nA=515,Ly=516,Py=517,ky=518,Uy=519,_u=35044,iA="300 es",Xi=2e3,Uc=2001;class Is{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 sA=1234567;const uo=Math.PI/180,Jr=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 wu(i,e){return(i%e+e)%e}function Oy(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function Qy(i,e,t){return i!==e?(t-i)/(e-i):0}function fo(i,e,t){return(1-t)*i+t*e}function Gy(i,e,t,n){return fo(i,e,1-Math.exp(-t*n))}function Hy(i,e=1){return e-Math.abs(wu(i,e*2)-e)}function zy(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Vy(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Wy(i,e){return i+Math.floor(Math.random()*(e-i+1))}function qy(i,e){return i+Math.random()*(e-i)}function Ky(i){return i*(.5-Math.random())}function jy(i){i!==void 0&&(sA=i);let e=sA+=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 Xy(i){return i*uo}function Yy(i){return i*Jr}function Jy(i){return(i&i-1)===0&&i!==0}function Zy(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function $y(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function e_(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 Sn={DEG2RAD:uo,RAD2DEG:Jr,generateUUID:mi,clamp:at,euclideanModulo:wu,mapLinear:Oy,inverseLerp:Qy,lerp:fo,damp:Gy,pingpong:Hy,smoothstep:zy,smootherstep:Vy,randInt:Wy,randFloat:qy,randFloatSpread:Ky,seededRandom:jy,degToRad:Xy,radToDeg:Yy,isPowerOfTwo:Jy,ceilPowerOfTwo:Zy,floorPowerOfTwo:$y,setQuaternionFromProperEuler:e_,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],I=s[2],w=s[5],S=s[8];return r[0]=a*m+o*_+c*I,r[3]=a*g+o*x+c*w,r[6]=a*A+o*E+c*S,r[1]=l*m+h*_+u*I,r[4]=l*g+h*x+u*w,r[7]=l*A+h*E+u*S,r[2]=d*m+f*_+p*I,r[5]=d*g+f*x+p*w,r[8]=d*A+f*E+p*S,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(vu.makeScale(e,t)),this}rotate(e){return this.premultiply(vu.makeRotation(-e)),this}translate(e,t){return this.premultiply(vu.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 vu=new ot;function rA(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function po(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function t_(){const i=po("canvas");return i.style.display="block",i}const aA={};function Oc(i){i in aA||(aA[i]=!0,console.warn(i))}function n_(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 i_(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 s_(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 oA=new ot().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),cA=new ot().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function r_(){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=Zr(s.r),s.g=Zr(s.g),s.b=Zr(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?kc: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:kc,toXYZ:oA,fromXYZ:cA,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:yt},outputColorSpaceConfig:{drawingBufferColorSpace:yt}},[yt]:{primaries:e,whitePoint:n,transfer:Rt,toXYZ:oA,fromXYZ:cA,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:yt}}}),i}const tt=r_();function Yi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Zr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let $r;class a_{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{$r===void 0&&($r=po("canvas")),$r.width=e.width,$r.height=e.height;const s=$r.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=$r}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=po("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 o_=0;class Cu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:o_++}),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(Su(s[a].image)):r.push(Su(s[a]))}else r=Su(s);n.url=r}return t||(e.images[this.uuid]=n),n}}function Su(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?a_.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 c_=0;class nn extends Is{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:c_++}),this.uuid=mi(),this.name="",this.source=new Cu(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!==Vp)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 Cc: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 Cc: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=Vp,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,I=(A+1)/2,w=(h+d)/4,S=(u+m)/4,T=(p+g)/4;return x>E&&x>I?x<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(x),s=w/n,r=S/n):E>I?E<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(E),n=w/s,r=T/s):I<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(I),n=S/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 l_ extends Is{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 Cu(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 ar extends l_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class lA 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 hA 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 I=Math.sqrt(x),w=Math.atan2(I,A*_);g=Math.sin(g*w)/I,o=Math.sin(o*w)/I}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 I=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=I,l*=I,h*=I,u*=I}}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(uA.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(uA.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 Iu.copy(this).projectOnVector(e),this.sub(Iu)}reflect(e){return this.sub(Iu.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 Iu=new G,uA=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(),Qc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Qc.copy(n.boundingBox)),Qc.applyMatrix4(e.matrixWorld),this.union(Qc)}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(Ao),Gc.subVectors(this.max,Ao),ea.subVectors(e.a,Ao),ta.subVectors(e.b,Ao),na.subVectors(e.c,Ao),Ms.subVectors(ta,ea),Bs.subVectors(na,ta),or.subVectors(ea,na);let t=[0,-Ms.z,Ms.y,0,-Bs.z,Bs.y,0,-or.z,or.y,Ms.z,0,-Ms.x,Bs.z,0,-Bs.x,or.z,0,-or.x,-Ms.y,Ms.x,0,-Bs.y,Bs.x,0,-or.y,or.x,0];return!Mu(t,ea,ta,na,Gc)||(t=[1,0,0,0,1,0,0,0,1],!Mu(t,ea,ta,na,Gc))?!1:(Hc.crossVectors(Ms,Bs),t=[Hc.x,Hc.y,Hc.z],Mu(t,ea,ta,na,Gc))}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,Qc=new Pi,ea=new G,ta=new G,na=new G,Ms=new G,Bs=new G,or=new G,Ao=new G,Gc=new G,Hc=new G,cr=new G;function Mu(i,e,t,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){cr.fromArray(i,r);const o=s.x*Math.abs(cr.x)+s.y*Math.abs(cr.y)+s.z*Math.abs(cr.z),c=e.dot(cr),l=t.dot(cr),h=n.dot(cr);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const h_=new Pi,go=new G,Bu=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):h_.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;go.subVectors(e,this.center);const t=go.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(go,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):(Bu.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(go.copy(e.center).add(Bu)),this.expandByPoint(go.copy(e.center).sub(Bu))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Zi=new G,Tu=new G,zc=new G,Ts=new G,Ru=new G,Vc=new G,Fu=new G;class mo{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){Tu.copy(e).add(t).multiplyScalar(.5),zc.copy(t).sub(e).normalize(),Ts.copy(this.origin).sub(Tu);const r=e.distanceTo(t)*.5,a=-this.direction.dot(zc),o=Ts.dot(this.direction),c=-Ts.dot(zc),l=Ts.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(Tu).addScaledVector(zc,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){Ru.subVectors(t,e),Vc.subVectors(n,e),Fu.crossVectors(Ru,Vc);let a=this.direction.dot(Fu),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Ts.subVectors(this.origin,e);const c=o*this.direction.dot(Vc.crossVectors(Ts,Vc));if(c<0)return null;const l=o*this.direction.dot(Ru.cross(Ts));if(l<0||c+l>a)return null;const h=-o*Ts.dot(Fu);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/ia.setFromMatrixColumn(e,0).length(),r=1/ia.setFromMatrixColumn(e,1).length(),a=1/ia.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(u_,e,d_)}lookAt(e,t,n){const s=this.elements;return Zn.subVectors(e,t),Zn.lengthSq()===0&&(Zn.z=1),Zn.normalize(),Rs.crossVectors(n,Zn),Rs.lengthSq()===0&&(Math.abs(n.z)===1?Zn.x+=1e-4:Zn.z+=1e-4,Zn.normalize(),Rs.crossVectors(n,Zn)),Rs.normalize(),Wc.crossVectors(Zn,Rs),s[0]=Rs.x,s[4]=Wc.x,s[8]=Zn.x,s[1]=Rs.y,s[5]=Wc.y,s[9]=Zn.y,s[2]=Rs.z,s[6]=Wc.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],I=n[15],w=s[0],S=s[4],T=s[8],C=s[12],v=s[1],F=s[5],K=s[9],q=s[13],$=s[2],N=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*S+o*F+c*N+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*S+u*F+d*N+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*S+m*F+g*N+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*$+I*Q,r[7]=_*S+x*F+E*N+I*J,r[11]=_*T+x*K+E*O+I*ee,r[15]=_*C+x*q+E*Y+I*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[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]+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,I=n.x,w=n.y,S=n.z;return s[0]=(1-(m+A))*I,s[1]=(f+E)*I,s[2]=(p-x)*I,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)*S,s[9]=(g-_)*S,s[10]=(1-(d+m))*S,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=ia.set(s[0],s[1],s[2]).length();const a=ia.set(s[4],s[5],s[6]).length(),o=ia.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===Uc)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===Uc)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 ia=new G,Ei=new Re,u_=new G(0,0,0),d_=new G(1,1,1),Rs=new G,Wc=new G,Zn=new G,dA=new Re,fA=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 dA.makeRotationFromQuaternion(e),this.setFromRotationMatrix(dA,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fA.setFromEuler(this),this.setFromQuaternion(fA,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 pA{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 f_=0;const AA=new G,sa=new Yt,$i=new Re,qc=new G,xo=new G,p_=new G,A_=new Yt,gA=new G(1,0,0),mA=new G(0,1,0),xA=new G(0,0,1),bA={type:"added"},g_={type:"removed"},ra={type:"childadded",child:null},Du={type:"childremoved",child:null};class Tt extends Is{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:f_++}),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 pA,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 sa.setFromAxisAngle(e,t),this.quaternion.multiply(sa),this}rotateOnWorldAxis(e,t){return sa.setFromAxisAngle(e,t),this.quaternion.premultiply(sa),this}rotateX(e){return this.rotateOnAxis(gA,e)}rotateY(e){return this.rotateOnAxis(mA,e)}rotateZ(e){return this.rotateOnAxis(xA,e)}translateOnAxis(e,t){return AA.copy(e).applyQuaternion(this.quaternion),this.position.add(AA.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(gA,e)}translateY(e){return this.translateOnAxis(mA,e)}translateZ(e){return this.translateOnAxis(xA,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?qc.copy(e):qc.set(e,t,n);const s=this.parent;this.updateWorldMatrix(!0,!1),xo.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$i.lookAt(xo,qc,this.up):$i.lookAt(qc,xo,this.up),this.quaternion.setFromRotationMatrix($i),s&&($i.extractRotation(s.matrixWorld),sa.setFromRotationMatrix($i),this.quaternion.premultiply(sa.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(bA),ra.child=e,this.dispatchEvent(ra),ra.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(g_),Du.child=e,this.dispatchEvent(Du),Du.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(bA),ra.child=e,this.dispatchEvent(ra),ra.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(xo,e,p_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xo,A_,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,Nu=new G,ts=new G,aa=new G,oa=new G,EA=new G,Lu=new G,Pu=new G,ku=new G,Uu=new gt,Ou=new gt,Qu=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),Nu.subVectors(e,t);const a=yi.dot(yi),o=yi.dot(es),c=yi.dot(Nu),l=es.dot(es),h=es.dot(Nu),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 Uu.setScalar(0),Ou.setScalar(0),Qu.setScalar(0),Uu.fromBufferAttribute(e,t),Ou.fromBufferAttribute(e,n),Qu.fromBufferAttribute(e,s),a.setScalar(0),a.addScaledVector(Uu,r.x),a.addScaledVector(Ou,r.y),a.addScaledVector(Qu,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;aa.subVectors(s,n),oa.subVectors(r,n),Lu.subVectors(e,n);const c=aa.dot(Lu),l=oa.dot(Lu);if(c<=0&&l<=0)return t.copy(n);Pu.subVectors(e,s);const h=aa.dot(Pu),u=oa.dot(Pu);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(aa,a);ku.subVectors(e,r);const f=aa.dot(ku),p=oa.dot(ku);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(oa,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);const A=1/(g+m+d);return a=m*A,o=d*A,t.copy(n).addScaledVector(aa,a).addScaledVector(oa,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const yA={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},Fs={h:0,s:0,l:0},Kc={h:0,s:0,l:0};function Gu(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=wu(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=Gu(a,r,e+1/3),this.g=Gu(a,r,e),this.b=Gu(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=yA[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=Zr(e.r),this.g=Zr(e.g),this.b=Zr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yt){return tt.fromWorkingColorSpace(Dn.copy(this),e),Math.round(at(Dn.r*255,0,255))*65536+Math.round(at(Dn.g*255,0,255))*256+Math.round(at(Dn.b*255,0,255))}getHexString(e=yt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tt.workingColorSpace){tt.fromWorkingColorSpace(Dn.copy(this),t);const n=Dn.r,s=Dn.g,r=Dn.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(Dn.copy(this),t),e.r=Dn.r,e.g=Dn.g,e.b=Dn.b,e}getStyle(e=yt){tt.fromWorkingColorSpace(Dn.copy(this),e);const t=Dn.r,n=Dn.g,s=Dn.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(Fs),this.setHSL(Fs.h+e,Fs.s+t,Fs.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(Fs),e.getHSL(Kc);const n=fo(Fs.h,Kc.h,t),s=fo(Fs.s,Kc.s,t),r=fo(Fs.l,Kc.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 Dn=new Fe;Fe.NAMES=yA;let m_=0;class ri extends Is{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:m_++}),this.uuid=mi(),this.name="",this.type="Material",this.blending=Wr,this.side=Ki,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Uh,this.blendDst=Oh,this.blendEquation=nr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Fe(0,0,0),this.blendAlpha=0,this.depthFunc=qr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=tA,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Yr,this.stencilZFail=Yr,this.stencilZPass=Yr,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!==Wr&&(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!==Uh&&(n.blendSrc=this.blendSrc),this.blendDst!==Oh&&(n.blendDst=this.blendDst),this.blendEquation!==nr&&(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!==qr&&(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!==tA&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yr&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Yr&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Yr&&(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=_c,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=x_();function x_(){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 b_(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 E_(i){const e=i>>10;return ns.uint32View[0]=ns.mantissaTable[ns.offsetTable[e]+(i&1023)]+ns.exponentTable[e],ns.floatView[0]}class _A{static toHalfFloat(e){return b_(e)}static fromHalfFloat(e){return E_(e)}}const sn=new G,jc=new Je;let y_=0;class In{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:y_++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=_u,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!==_u&&(e.usage=this.usage),e}}class Hu extends In{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class wA extends In{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Jt extends In{constructor(e,t,n){super(new Float32Array(e),t,n)}}let __=0;const ai=new Re,zu=new Tt,ca=new G,$n=new Pi,bo=new Pi,bn=new G;class Mn extends Is{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:__++}),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(rA(e)?wA:Hu)(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 zu.lookAt(e),zu.updateMatrix(),this.applyMatrix4(zu.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ca).negate(),this.translate(ca.x,ca.y,ca.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];bo.setFromBufferAttribute(o),this.morphTargetsRelative?(bn.addVectors($n.min,bo.min),$n.expandByPoint(bn),bn.addVectors($n.max,bo.max),$n.expandByPoint(bn)):($n.expandByPoint(bo.min),$n.expandByPoint(bo.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&&(ca.fromBufferAttribute(e,l),bn.add(ca)),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 In(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,I=new G,w=new G;function S(T){I.fromBufferAttribute(s,T),w.copy(I);const C=o[T];x.copy(C),x.sub(I.multiplyScalar(I.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)S(e.getX(q+0)),S(e.getX(q+1)),S(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 In(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 In(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 vA=new Re,lr=new mo,Xc=new ki,CA=new G,Yc=new G,Jc=new G,Zc=new G,Vu=new G,$c=new G,SA=new G,el=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){$c.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const h=o[c],u=r[c];h!==0&&(Vu.fromBufferAttribute(u,e),a?$c.addScaledVector(Vu,h):$c.addScaledVector(Vu.sub(t),h))}t.add($c)}return t}raycast(e,t){const n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Xc.copy(n.boundingSphere),Xc.applyMatrix4(r),lr.copy(e.ray).recast(e.near),!(Xc.containsPoint(lr.origin)===!1&&(lr.intersectSphere(Xc,CA)===null||lr.origin.distanceToSquared(CA)>(e.far-e.near)**2))&&(vA.copy(r).invert(),lr.copy(e.ray).applyMatrix4(vA),!(n.boundingBox!==null&&lr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,lr)))}_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=_,I=x;E<I;E+=3){const w=o.getX(E),S=o.getX(E+1),T=o.getX(E+2);s=tl(this,A,e,n,l,h,u,w,S,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=tl(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=_,I=x;E<I;E+=3){const w=E,S=E+1,T=E+2;s=tl(this,A,e,n,l,h,u,w,S,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=tl(this,a,e,n,l,h,u,_,x,E),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}}}function w_(i,e,t,n,s,r,a,o){let c;if(e.side===Nn?c=n.intersectTriangle(a,r,s,!0,o):c=n.intersectTriangle(s,r,a,e.side===Ki,o),c===null)return null;el.copy(o),el.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(el);return l<t.near||l>t.far?null:{distance:l,point:el.clone(),object:i}}function tl(i,e,t,n,s,r,a,o,c,l){i.getVertexPosition(o,Yc),i.getVertexPosition(c,Jc),i.getVertexPosition(l,Zc);const h=w_(i,e,t,n,Yc,Jc,Zc,SA);if(h){const u=new G;_i.getBarycoord(SA,Yc,Jc,Zc,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(Yc,Jc,Zc,d.normal),h.face=d,h.barycoord=u}return h}class la 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,I,w,S,T,C){const v=E/S,F=I/T,K=E/2,q=I/2,$=w/2,N=S+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<N;_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/S),u.push(1-ee/T),Y+=1}}for(let ee=0;ee<T;ee++)for(let ae=0;ae<S;ae++){const _e=d+ae+N*ee,Me=d+ae+N*(ee+1),se=d+(ae+1)+N*(ee+1),me=d+(ae+1)+N*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 la(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ha(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=ha(i[t]);for(const s in n)e[s]=n[s]}return e}function v_(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function IA(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:tt.workingColorSpace}const C_={clone:ha,merge:kn};var S_=`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 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() {gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );-}`,I_=`void main() {+}`,O_=`void main() {gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );-}`;class Ns extends ri{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=S_,this.fragmentShader=I_,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=ha(e.uniforms),this.uniformsGroups=v_(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 MA 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 Ls=new G,BA=new Je,TA=new Je;class Bn extends MA{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=Jr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(uo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Jr*2*Math.atan(Math.tan(uo*.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){Ls.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ls.x,Ls.y).multiplyScalar(-e/Ls.z),Ls.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ls.x,Ls.y).multiplyScalar(-e/Ls.z)}getViewSize(e,t){return this.getViewBounds(e,BA,TA),t.subVectors(TA,BA)}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(uo*.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 ua=-90,da=1;class M_ extends Tt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Bn(ua,da,e,t);s.layers=this.layers,this.add(s);const r=new Bn(ua,da,e,t);r.layers=this.layers,this.add(r);const a=new Bn(ua,da,e,t);a.layers=this.layers,this.add(a);const o=new Bn(ua,da,e,t);o.layers=this.layers,this.add(o);const c=new Bn(ua,da,e,t);c.layers=this.layers,this.add(c);const l=new Bn(ua,da,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===Uc)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 RA extends nn{constructor(e=[],t=ir,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 B_ extends ar{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 RA(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 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:`varying vec3 vWorldDirection;@@ -37,9 +37,9 @@gl_FragColor = texture2D( tEquirect, sampleUV );}- `},s=new la(5,5,5),r=new Ns({name:"CubemapFromEquirect",uniforms:ha(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Nn,blending:vs});r.uniforms.tEquirect.value=t;const a=new Zt(s,r),o=t.minFilter;return t.minFilter===si&&(t.minFilter=qt),new M_(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 T_={type:"move"};class Wu{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(T_)))}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 qu 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 R_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=_u,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 Ku{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 In(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 Ku(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 FA=new G,DA=new gt,NA=new gt,F_=new G,LA=new Re,nl=new G,ju=new ki,PA=new Re,Xu=new mo;class kA extends Zt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=zp,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,nl),this.boundingBox.expandByPoint(nl)}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,nl),this.boundingSphere.expandByPoint(nl)}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(),ju.copy(this.boundingSphere),ju.applyMatrix4(s),e.ray.intersectsSphere(ju)!==!1&&(PA.copy(s).invert(),Xu.copy(e.ray).applyMatrix4(PA),!(this.boundingBox!==null&&Xu.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Xu)))}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===zp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Cy?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,s=this.geometry;DA.fromBufferAttribute(s.attributes.skinIndex,e),NA.fromBufferAttribute(s.attributes.skinWeight,e),FA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=NA.getComponent(r);if(a!==0){const o=DA.getComponent(r);LA.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(F_.copy(FA).applyMatrix4(LA),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class il extends Tt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class sl 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 UA=new Re,D_=new Re;class rl{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:D_;UA.multiplyMatrices(o,t[r]),UA.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new rl(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 sl(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 il),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 Yu extends In{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 fa=new Re,OA=new Re,al=[],QA=new Pi,N_=new Re,Eo=new Zt,yo=new ki;class GA extends Zt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Yu(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,N_)}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,fa),QA.copy(e.boundingBox).applyMatrix4(fa),this.boundingBox.union(QA)}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,fa),yo.copy(e.boundingSphere).applyMatrix4(fa),this.boundingSphere.union(yo)}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(Eo.geometry=this.geometry,Eo.material=this.material,Eo.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),yo.copy(this.boundingSphere),yo.applyMatrix4(n),e.ray.intersectsSphere(yo)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,fa),OA.multiplyMatrices(n,fa),Eo.matrixWorld=OA,Eo.raycast(e,al);for(let a=0,o=al.length;a<o;a++){const c=al[a];c.instanceId=r,c.object=this,t.push(c)}al.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Yu(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 sl(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 Ju=new G,L_=new G,P_=new ot;class Ps{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=Ju.subVectors(n,t).cross(L_.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(Ju),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||P_.getNormalMatrix(e),s=this.coplanarPoint(Ju).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 hr=new ki,ol=new G;class Zu{constructor(e=new Ps,t=new Ps,n=new Ps,s=new Ps,r=new Ps,a=new Ps){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===Uc)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(),hr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),hr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(hr)}intersectsSprite(e){return hr.center.set(0,0,0),hr.radius=.7071067811865476,hr.applyMatrix4(e.matrixWorld),this.intersectsSphere(hr)}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(ol.x=s.normal.x>0?e.max.x:e.min.x,ol.y=s.normal.y>0?e.max.y:e.min.y,ol.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(ol)<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 pa 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 cl=new G,ll=new G,HA=new Re,_o=new mo,hl=new ki,$u=new G,zA=new G;class ul extends Tt{constructor(e=new Mn,t=new pa){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++)cl.fromBufferAttribute(t,s-1),ll.fromBufferAttribute(t,s),n[s]=n[s-1],n[s]+=cl.distanceTo(ll);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(),hl.copy(n.boundingSphere),hl.applyMatrix4(s),hl.radius+=r,e.ray.intersectsSphere(hl)===!1)return;HA.copy(s).invert(),_o.copy(e.ray).applyMatrix4(HA);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=dl(this,e,_o,c,A,_,m);x&&t.push(x)}if(this.isLineLoop){const m=h.getX(p-1),g=h.getX(f),A=dl(this,e,_o,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=dl(this,e,_o,c,m,m+1,m);A&&t.push(A)}if(this.isLineLoop){const m=dl(this,e,_o,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 dl(i,e,t,n,s,r,a){const o=i.geometry.attributes.position;if(cl.fromBufferAttribute(o,s),ll.fromBufferAttribute(o,r),t.distanceSqToSegment(cl,ll,$u,zA)>n)return;$u.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo($u);if(!(l<e.near||l>e.far))return{distance:l,point:zA.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const VA=new G,WA=new G;class fl extends ul{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)VA.fromBufferAttribute(t,s),WA.fromBufferAttribute(t,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+VA.distanceTo(WA);e.setAttribute("lineDistance",new Jt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class k_ extends ul{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class ed 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 qA=new Re,td=new mo,pl=new ki,Al=new G;class U_ extends Tt{constructor(e=new Mn,t=new ed){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(),pl.copy(n.boundingSphere),pl.applyMatrix4(s),pl.radius+=r,e.ray.intersectsSphere(pl)===!1)return;qA.copy(s).invert(),td.copy(e.ray).applyMatrix4(qA);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);Al.fromBufferAttribute(u,g),KA(Al,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++)Al.fromBufferAttribute(u,p),KA(Al,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 KA(i,e,t,n,s,r,a){const o=td.distanceSqToPoint(i);if(o<t){const c=new G;td.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 gl 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 O_ extends gl{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 Q_ extends gl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,ir),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class jA extends nn{constructor(e,t,n=sr,s,r,a,o=Ln,c=Ln,l,h=no){if(h!==no&&h!==io)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 Cu(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 G_{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 H_(i,e,t=2){const n=e&&e.length,s=n?e[0]*t:i.length;let r=XA(i,0,s,t,!0);const a=[];if(!r||r.next===r.prev)return a;let o,c,l;if(n&&(r=K_(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 wo(r,a,t,o,c,l,0),a}function XA(i,e,t,n,s){let r;if(s===sw(i,e,t,n)>0)for(let a=e;a<t;a+=n)r=$A(a/n|0,i[a],i[a+1],r);else for(let a=t-n;a>=e;a-=n)r=$A(a/n|0,i[a],i[a+1],r);return r&&Aa(r,r.next)&&(So(r),r=r.next),r}function ur(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Aa(t,t.next)||Ht(t.prev,t,t.next)===0)){if(So(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function wo(i,e,t,n,s,r,a){if(!i)return;!a&&r&&Z_(i,n,s,r);let o=i;for(;i.prev!==i.next;){const c=i.prev,l=i.next;if(r?V_(i,n,s,r):z_(i)){e.push(c.i,i.i,l.i),So(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=W_(ur(i),e),wo(i,e,t,n,s,r,2)):a===2&&q_(i,e,t,n,s,r):wo(ur(i),e,t,n,s,r,1);break}}}function z_(i){const e=i.prev,t=i,n=i.next;if(Ht(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&&vo(s,o,r,c,a,l,p.x,p.y)&&Ht(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function V_(i,e,t,n){const s=i.prev,r=i,a=i.next;if(Ht(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=nd(f,p,e,t,n),_=nd(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&&vo(o,h,c,u,l,d,x.x,x.y)&&Ht(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&&vo(o,h,c,u,l,d,E.x,E.y)&&Ht(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&&vo(o,h,c,u,l,d,x.x,x.y)&&Ht(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&&vo(o,h,c,u,l,d,E.x,E.y)&&Ht(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function W_(i,e){let t=i;do{const n=t.prev,s=t.next.next;!Aa(n,s)&&JA(n,t,t.next,s)&&Co(n,s)&&Co(s,n)&&(e.push(n.i,t.i,s.i),So(t),So(t.next),t=i=s),t=t.next}while(t!==i);return ur(t)}function q_(i,e,t,n,s,r){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&tw(a,o)){let c=ZA(a,o);a=ur(a,a.next),c=ur(c,c.next),wo(a,e,t,n,s,r,0),wo(c,e,t,n,s,r,0);return}o=o.next}a=a.next}while(a!==i)}function K_(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=XA(i,o,c,n,!1);l===l.next&&(l.steiner=!0),s.push(ew(l))}s.sort(j_);for(let r=0;r<s.length;r++)t=X_(s[r],t);return t}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);t=n-s}return t}function X_(i,e){const t=Y_(i,e);if(!t)return e;const n=ZA(t,i);return ur(n,n.next),ur(t,t.next)}function Y_(i,e){let t=e;const n=i.x,s=i.y;let r=-1/0,a;if(Aa(i,t))return t;do{if(Aa(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&&YA(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);Co(t,i)&&(u<h||u===h&&(t.x>a.x||t.x===a.x&&J_(a,t)))&&(a=t,h=u)}t=t.next}while(t!==o);return a}function J_(i,e){return Ht(i.prev,i,e.prev)<0&&Ht(e.next,i,i.next)<0}function Z_(i,e,t,n){let s=i;do s.z===0&&(s.z=nd(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,$_(s)}function $_(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 nd(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 ew(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 YA(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 vo(i,e,t,n,s,r,a,o){return!(i===a&&e===o)&&YA(i,e,t,n,s,r,a,o)}function tw(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!nw(i,e)&&(Co(i,e)&&Co(e,i)&&iw(i,e)&&(Ht(i.prev,i,e.prev)||Ht(i,e.prev,e))||Aa(i,e)&&Ht(i.prev,i,i.next)>0&&Ht(e.prev,e,e.next)>0)}function Ht(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Aa(i,e){return i.x===e.x&&i.y===e.y}function JA(i,e,t,n){const s=xl(Ht(i,e,t)),r=xl(Ht(i,e,n)),a=xl(Ht(t,n,i)),o=xl(Ht(t,n,e));return!!(s!==r&&a!==o||s===0&&ml(i,t,e)||r===0&&ml(i,n,e)||a===0&&ml(t,i,n)||o===0&&ml(t,e,n))}function ml(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 xl(i){return i>0?1:i<0?-1:0}function nw(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&&JA(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Co(i,e){return Ht(i.prev,i,i.next)<0?Ht(i,e,i.next)>=0&&Ht(i,i.prev,e)>=0:Ht(i,e,i.prev)<0||Ht(i,i.next,e)<0}function iw(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 ZA(i,e){const t=id(i.i,i.x,i.y),n=id(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 $A(i,e,t,n){const s=id(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 So(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 id(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function sw(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 rw{static triangulate(e,t,n=2){return H_(e,t,n)}}class sd{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 sd.area(e)<0}static triangulateShape(e,t){const n=[],s=[],r=[];eg(e),tg(n,e);let a=e.length;t.forEach(eg);for(let c=0;c<t.length;c++)s.push(a),a+=t[c].length,tg(n,t[c]);const o=rw.triangulate(n,s);for(let c=0;c<o.length;c+=3)r.push(o.slice(c,c+3));return r}}function eg(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function tg(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class bl 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),I=_+1+l*(A+1),w=_+1+l*A;f.push(x,E,w),f.push(E,I,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 bl(e.width,e.height,e.widthSegments,e.heightSegments)}}class Io 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=Pc,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 Io{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 El 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=Pc,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=_c,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 aw 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=Pc,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=_c,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 ow extends ri{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=By,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 cw 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 yl(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function lw(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function hw(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 ng(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 ig(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 Mo{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 uw extends Mo{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 Xr:r=e,o=2*t-n;break;case Lc: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 Xr:a=e,c=2*n-t;break;case Lc: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 I=0;I!==o;++I)r[I]=A*a[h+I]+_*a[l+I]+x*a[c+I]+E*a[u+I];return r}}class sg extends Mo{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 dw extends Mo{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=yl(t,this.TimeBufferType),this.values=yl(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:yl(e.times,Array),values:yl(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(n.interpolation=s)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new dw(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new sg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new uw(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case lo:t=this.InterpolantFactoryMethodDiscrete;break;case ho:t=this.InterpolantFactoryMethodLinear;break;case bu: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 lo;case this.InterpolantFactoryMethodLinear:return ho;case this.InterpolantFactoryMethodSmooth:return bu}}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&&lw(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()===bu,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=ho;class ga extends wi{constructor(e,t,n){super(e,t,n)}}ga.prototype.ValueTypeName="bool",ga.prototype.ValueBufferType=Array,ga.prototype.DefaultInterpolation=lo,ga.prototype.InterpolantFactoryMethodLinear=void 0,ga.prototype.InterpolantFactoryMethodSmooth=void 0;class rg extends wi{constructor(e,t,n,s){super(e,t,n,s)}}rg.prototype.ValueTypeName="color";class dr extends wi{constructor(e,t,n,s){super(e,t,n,s)}}dr.prototype.ValueTypeName="number";class fw extends Mo{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 ks extends wi{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new fw(this.times,this.values,this.getValueSize(),e)}}ks.prototype.ValueTypeName="quaternion",ks.prototype.InterpolantFactoryMethodSmooth=void 0;class ma extends wi{constructor(e,t,n){super(e,t,n)}}ma.prototype.ValueTypeName="string",ma.prototype.ValueBufferType=Array,ma.prototype.DefaultInterpolation=lo,ma.prototype.InterpolantFactoryMethodLinear=void 0,ma.prototype.InterpolantFactoryMethodSmooth=void 0;class fr extends wi{constructor(e,t,n,s){super(e,t,n,s)}}fr.prototype.ValueTypeName="vector";class _l{constructor(e="",t=-1,n=[],s=Eu){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(Aw(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=hw(c);c=ng(c,1,h),l=ng(l,1,h),!s&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new dr(".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=[];ig(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 dr(".morphTargetInfluence["+m+"]",g,A))}c=f.length*a}else{const f=".bones["+t[u].name+"]";n(fr,f+".position",d,"pos",s),n(ks,f+".quaternion",d,"rot",s),n(fr,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 pw(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return dr;case"vector":case"vector2":case"vector3":case"vector4":return fr;case"color":return rg;case"quaternion":return ks;case"bool":case"boolean":return ga;case"string":return ma}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function Aw(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=pw(i.type);if(i.times===void 0){const t=[],n=[];ig(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 ag{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 gw=new ag;class oi{constructor(e){this.manager=e!==void 0?e:gw,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 mw 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 I=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:f});for(let w=0,S=h.length;w<S;w++){const T=h[w];T.onProgress&&T.onProgress(I)}A.enqueue(E),_()}},x=>{A.error(x)})}}});return new Response(g)}else throw new mw(`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 xw 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=po("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 bw extends oi{constructor(e){super(e)}load(e,t,n,s){const r=this,a=new sl,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 og extends oi{constructor(e){super(e)}load(e,t,n,s){const r=new nn,a=new xw(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 Bo 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 Ew extends Bo{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 rd=new Re,cg=new G,lg=new G;class ad{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 Zu,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;cg.setFromMatrixPosition(e.matrixWorld),t.position.copy(cg),lg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(lg),t.updateMatrixWorld(),rd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rd),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(rd)}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 yw extends ad{constructor(){super(new Bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=Jr*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 hg extends Bo{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 yw}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 ug=new Re,To=new G,od=new G;class _w extends ad{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()),To.setFromMatrixPosition(e.matrixWorld),n.position.copy(To),od.copy(n.position),od.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(od),n.updateMatrixWorld(),s.makeTranslation(-To.x,-To.y,-To.z),ug.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ug)}}class wl extends Bo{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 _w}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 cd extends MA{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 ww extends ad{constructor(){super(new cd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ld extends Bo{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 ww}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class dg extends Bo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class pr{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 vw 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 Cw extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Sw{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 hd="\\[\\]\\.:\\/",Iw=new RegExp("["+hd+"]","g"),ud="[^"+hd+"]",Mw="[^"+hd.replace("\\.","")+"]",Bw=/((?:WC+[\/:])*)/.source.replace("WC",ud),Tw=/(WCOD+)?/.source.replace("WCOD",Mw),Rw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ud),Fw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ud),Dw=new RegExp("^"+Bw+Tw+Rw+Fw+"$"),Nw=["material","materials","bones","map"];class Lw{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(Iw,"")}static parseTrackName(e){const t=Dw.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);Nw.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=Lw,_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 Pw{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=$p,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 Iy:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Eu: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===Sy;if(e===0)return r===-1?s:a&&(r&1)===1?t-s:s;if(n===Zp){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=Xr,s.endingEnd=Xr):(e?s.endingStart=this.zeroSlopeAtStart?Xr:jr:s.endingStart=Lc,t?s.endingEnd=this.zeroSlopeAtEnd?Xr:jr:s.endingEnd=Lc)}_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 kw=new Float32Array(1);class fg extends Is{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 Sw(_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 sg(new Float32Array(2),new Float32Array(2),1,kw),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"?_l.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=Eu),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 Pw(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"?_l.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 pg{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 Us=new G,vl=new Re,dd=new Re;class Uw extends fl{constructor(e){const t=Ag(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 pa({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");dd.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<t.length;r++){const o=t[r];o.parent&&o.parent.isBone&&(vl.multiplyMatrices(dd,o.matrixWorld),Us.setFromMatrixPosition(vl),s.setXYZ(a,Us.x,Us.y,Us.z),vl.multiplyMatrices(dd,o.parent.matrixWorld),Us.setFromMatrixPosition(vl),s.setXYZ(a+1,Us.x,Us.y,Us.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ag(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push(...Ag(i.children[t]));return e}class Ow extends fl{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 pa({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class gg extends fl{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 pa({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 Qw extends Is{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 mg(i,e,t,n){const s=Gw(n);switch(t){case Xp:return i*e;case ji:return i*e/s.components*s.byteLength;case Zh:return i*e/s.components*s.byteLength;case rr:return i*e*2/s.components*s.byteLength;case $h:return i*e*2/s.components*s.byteLength;case Yp:return i*e*3/s.components*s.byteLength;case hn:return i*e*4/s.components*s.byteLength;case eu:return i*e*4/s.components*s.byteLength;case Ic:case so:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Mc:case ro:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case tu:case nu:return Math.max(i,16)*Math.max(e,8)/4;case Bc:case Tc:return Math.max(i,8)*Math.max(e,8)/2;case Rc:case Fc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Dc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ao:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case iu:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case su:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case ru:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case oo:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case au:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case ou:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case cu:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case lu:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case hu:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case uu:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case du:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case fu:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case pu:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case co:case Au:case Nc:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Jp:case gu:return Math.ceil(i/4)*Math.ceil(e/4)*8;case mu:case xu:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Gw(i){switch(i){case cn:case qp:return{byteLength:1,components:1};case eo:case Kp:case Pn:return{byteLength:2,components:1};case Yh:case Jh:return{byteLength:2,components:4};case sr:case Xh:case ln:return{byteLength:4,components:1};case jp:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"176"}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="176");function xg(){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 Hw(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 zw=`#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: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_ALPHAHASHif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;-#endif`,Vw=`#ifdef USE_ALPHAHASH+#endif`,nv=`#ifdef USE_ALPHAHASHconst 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`,Ww=`#ifdef USE_ALPHAMAP+#endif`,iv=`#ifdef USE_ALPHAMAPdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;-#endif`,qw=`#ifdef USE_ALPHAMAP+#endif`,sv=`#ifdef USE_ALPHAMAPuniform sampler2D alphaMap;-#endif`,Kw=`#ifdef USE_ALPHATEST+#endif`,rv=`#ifdef USE_ALPHATEST#ifdef ALPHA_TO_COVERAGEdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );if ( diffuseColor.a == 0.0 ) discard;#elseif ( diffuseColor.a < alphaTest ) discard;#endif-#endif`,jw=`#ifdef USE_ALPHATEST+#endif`,av=`#ifdef USE_ALPHATESTuniform float alphaTest;-#endif`,Xw=`#ifdef USE_AOMAP+#endif`,ov=`#ifdef USE_AOMAPfloat 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`,Yw=`#ifdef USE_AOMAP+#endif`,cv=`#ifdef USE_AOMAPuniform sampler2D aoMap;uniform float aoMapIntensity;-#endif`,Jw=`#ifdef USE_BATCHING+#endif`,lv=`#ifdef USE_BATCHING#if ! defined( GL_ANGLE_multi_draw )#define gl_DrawID _gl_DrawIDuniform int _gl_DrawID;@@ -137,15 +137,15 @@int y = j / size;return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;}-#endif`,Zw=`#ifdef USE_BATCHING+#endif`,hv=`#ifdef USE_BATCHINGmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );-#endif`,$w=`vec3 transformed = vec3( position );+#endif`,uv=`vec3 transformed = vec3( position );#ifdef USE_ALPHAHASHvPosition = vec3( position );-#endif`,ev=`vec3 objectNormal = vec3( normal );+#endif`,dv=`vec3 objectNormal = vec3( normal );#ifdef USE_TANGENTvec3 objectTangent = vec3( tangent.xyz );-#endif`,tv=`float G_BlinnPhong_Implicit( ) {+#endif`,fv=`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 vefloat G = G_BlinnPhong_Implicit( );float D = D_BlinnPhong( shininess, dotNH );return F * ( G * D );-} // validated`,nv=`#ifdef USE_IRIDESCENCE+} // validated`,pv=`#ifdef USE_IRIDESCENCEconst 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`,iv=`#ifdef USE_BUMPMAP+#endif`,Av=`#ifdef USE_BUMPMAPuniform 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 vevec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );return normalize( abs( fDet ) * surf_norm - vGrad );}-#endif`,sv=`#if NUM_CLIPPING_PLANES > 0+#endif`,gv=`#if NUM_CLIPPING_PLANES > 0vec4 plane;#ifdef ALPHA_TO_COVERAGEfloat distanceToPlane, distanceGradient;@@ -289,26 +289,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in veif ( clipped ) discard;#endif#endif-#endif`,rv=`#if NUM_CLIPPING_PLANES > 0+#endif`,mv=`#if NUM_CLIPPING_PLANES > 0varying vec3 vClipPosition;uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];-#endif`,av=`#if NUM_CLIPPING_PLANES > 0+#endif`,xv=`#if NUM_CLIPPING_PLANES > 0varying vec3 vClipPosition;-#endif`,ov=`#if NUM_CLIPPING_PLANES > 0+#endif`,bv=`#if NUM_CLIPPING_PLANES > 0vClipPosition = - mvPosition.xyz;-#endif`,cv=`#if defined( USE_COLOR_ALPHA )+#endif`,Ev=`#if defined( USE_COLOR_ALPHA )diffuseColor *= vColor;#elif defined( USE_COLOR )diffuseColor.rgb *= vColor;-#endif`,lv=`#if defined( USE_COLOR_ALPHA )+#endif`,yv=`#if defined( USE_COLOR_ALPHA )varying vec4 vColor;#elif defined( USE_COLOR )varying vec3 vColor;-#endif`,hv=`#if defined( USE_COLOR_ALPHA )+#endif`,_v=`#if defined( USE_COLOR_ALPHA )varying vec4 vColor;#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )varying vec3 vColor;-#endif`,uv=`#if defined( USE_COLOR_ALPHA )+#endif`,wv=`#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_COLORvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );vColor.xyz *= batchingColor.xyz;-#endif`,dv=`#define PI 3.141592653589793+#endif`,vv=`#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`,fv=`#ifdef ENVMAP_TYPE_CUBE_UV+} // validated`,Cv=`#ifdef ENVMAP_TYPE_CUBE_UV#define cubeUV_minMipLevel 4.0#define cubeUV_minTileSize 16.0float 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`,pv=`vec3 transformedNormal = objectNormal;+#endif`,Iv=`vec3 transformedNormal = objectNormal;#ifdef USE_TANGENTvec3 transformedTangent = objectTangent;#endif@@ -518,21 +518,21 @@ transformedNormal = normalMatrix * transformedNormal;#ifdef FLIP_SIDEDtransformedTangent = - transformedTangent;#endif-#endif`,Av=`#ifdef USE_DISPLACEMENTMAP+#endif`,Sv=`#ifdef USE_DISPLACEMENTMAPuniform sampler2D displacementMap;uniform float displacementScale;uniform float displacementBias;-#endif`,gv=`#ifdef USE_DISPLACEMENTMAP+#endif`,Mv=`#ifdef USE_DISPLACEMENTMAPtransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );-#endif`,mv=`#ifdef USE_EMISSIVEMAP+#endif`,Bv=`#ifdef USE_EMISSIVEMAPvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );#ifdef DECODE_VIDEO_TEXTURE_EMISSIVEemissiveColor = sRGBTransferEOTF( emissiveColor );#endiftotalEmissiveRadiance *= emissiveColor.rgb;-#endif`,xv=`#ifdef USE_EMISSIVEMAP+#endif`,Tv=`#ifdef USE_EMISSIVEMAPuniform sampler2D emissiveMap;-#endif`,bv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ev=`vec4 LinearTransferOETF( in vec4 value ) {+#endif`,Rv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Fv=`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 );-}`,yv=`#ifdef USE_ENVMAP+}`,Nv=`#ifdef USE_ENVMAP#ifdef ENV_WORLDPOSvec3 cameraToFrag;if ( isOrthographic ) {@@ -569,7 +569,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {#elif defined( ENVMAP_BLENDING_ADD )outgoingLight += envColor.xyz * specularStrength * reflectivity;#endif-#endif`,_v=`#ifdef USE_ENVMAP+#endif`,Dv=`#ifdef USE_ENVMAPuniform float envMapIntensity;uniform float flipEnvMap;uniform mat3 envMapRotation;@@ -579,7 +579,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {uniform sampler2D envMap;#endif-#endif`,wv=`#ifdef USE_ENVMAP+#endif`,Lv=`#ifdef USE_ENVMAPuniform 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 ) {#elsevarying vec3 vReflect;#endif-#endif`,vv=`#ifdef USE_ENVMAP+#endif`,Pv=`#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`,Cv=`#ifdef USE_ENVMAP+#endif`,kv=`#ifdef USE_ENVMAP#ifdef ENV_WORLDPOSvWorldPosition = worldPosition.xyz;#else@@ -618,18 +618,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {vReflect = refract( cameraToVertex, worldNormal, refractionRatio );#endif#endif-#endif`,Sv=`#ifdef USE_FOG+#endif`,Uv=`#ifdef USE_FOGvFogDepth = - mvPosition.z;-#endif`,Iv=`#ifdef USE_FOG+#endif`,Ov=`#ifdef USE_FOGvarying float vFogDepth;-#endif`,Mv=`#ifdef USE_FOG+#endif`,Qv=`#ifdef USE_FOG#ifdef FOG_EXP2float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );#elsefloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );#endifgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );-#endif`,Bv=`#ifdef USE_FOG+#endif`,Gv=`#ifdef USE_FOGuniform 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`,Tv=`#ifdef USE_GRADIENTMAP+#endif`,Hv=`#ifdef USE_GRADIENTMAPuniform sampler2D gradientMap;#endifvec3 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-}`,Rv=`#ifdef USE_LIGHTMAP+}`,zv=`#ifdef USE_LIGHTMAPuniform sampler2D lightMap;uniform float lightMapIntensity;-#endif`,Fv=`LambertMaterial material;+#endif`,Vv=`LambertMaterial material;material.diffuseColor = diffuseColor.rgb;-material.specularStrength = specularStrength;`,Dv=`varying vec3 vViewPosition;+material.specularStrength = specularStrength;`,Wv=`varying vec3 vViewPosition;struct LambertMaterial {vec3 diffuseColor;float specularStrength;@@ -669,7 +669,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometrreflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );}#define RE_Direct RE_Direct_Lambert-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Nv=`uniform bool receiveShadow;+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,qv=`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 penumbraCosivec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );return irradiance;}-#endif`,Lv=`#ifdef USE_ENVMAP+#endif`,Kv=`#ifdef USE_ENVMAPvec3 getIBLIrradiance( const in vec3 normal ) {#ifdef ENVMAP_TYPE_CUBE_UVvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );@@ -818,8 +818,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi#endif}#endif-#endif`,Pv=`ToonMaterial material;-material.diffuseColor = diffuseColor.rgb;`,kv=`varying vec3 vViewPosition;+#endif`,jv=`ToonMaterial material;+material.diffuseColor = diffuseColor.rgb;`,Xv=`varying vec3 vViewPosition;struct ToonMaterial {vec3 diffuseColor;};@@ -831,11 +831,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPoreflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );}#define RE_Direct RE_Direct_Toon-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Uv=`BlinnPhongMaterial material;+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Yv=`BlinnPhongMaterial material;material.diffuseColor = diffuseColor.rgb;material.specularColor = specular;material.specularShininess = shininess;-material.specularStrength = specularStrength;`,Ov=`varying vec3 vViewPosition;+material.specularStrength = specularStrength;`,Jv=`varying vec3 vViewPosition;struct BlinnPhongMaterial {vec3 diffuseColor;vec3 specularColor;@@ -852,7 +852,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geomreflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );}#define RE_Direct RE_Direct_BlinnPhong-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Qv=`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 );@@ -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`,Gv=`struct PhysicalMaterial {+#endif`,$v=`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_Physicalfloat 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 );-}`,Hv=`+}`,eC=`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`,zv=`#if defined( RE_IndirectDiffuse )+#endif`,tC=`#if defined( RE_IndirectDiffuse )#ifdef USE_LIGHTMAPvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;@@ -1373,32 +1373,32 @@ IncidentLight directLight;#ifdef USE_CLEARCOATclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );#endif-#endif`,Vv=`#if defined( RE_IndirectDiffuse )+#endif`,nC=`#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`,Wv=`#if defined( USE_LOGDEPTHBUF )+#endif`,iC=`#if defined( USE_LOGDEPTHBUF )gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;-#endif`,qv=`#if defined( USE_LOGDEPTHBUF )+#endif`,sC=`#if defined( USE_LOGDEPTHBUF )uniform float logDepthBufFC;varying float vFragDepth;varying float vIsPerspective;-#endif`,Kv=`#ifdef USE_LOGDEPTHBUF+#endif`,rC=`#ifdef USE_LOGDEPTHBUFvarying float vFragDepth;varying float vIsPerspective;-#endif`,jv=`#ifdef USE_LOGDEPTHBUF+#endif`,aC=`#ifdef USE_LOGDEPTHBUFvFragDepth = 1.0 + gl_Position.w;vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );-#endif`,Xv=`#ifdef USE_MAP+#endif`,oC=`#ifdef USE_MAPvec4 sampledDiffuseColor = texture2D( map, vMapUv );#ifdef DECODE_VIDEO_TEXTUREsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );#endifdiffuseColor *= sampledDiffuseColor;-#endif`,Yv=`#ifdef USE_MAP+#endif`,cC=`#ifdef USE_MAPuniform sampler2D map;-#endif`,Jv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )+#endif`,lC=`#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_ALPHAMAPdiffuseColor.a *= texture2D( alphaMap, uv ).g;-#endif`,Zv=`#if defined( USE_POINTS_UV )+#endif`,hC=`#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_ALPHAMAPuniform sampler2D alphaMap;-#endif`,$v=`float metalnessFactor = metalness;+#endif`,uC=`float metalnessFactor = metalness;#ifdef USE_METALNESSMAPvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );metalnessFactor *= texelMetalness.b;-#endif`,eC=`#ifdef USE_METALNESSMAP+#endif`,dC=`#ifdef USE_METALNESSMAPuniform sampler2D metalnessMap;-#endif`,tC=`#ifdef USE_INSTANCING_MORPH+#endif`,fC=`#ifdef USE_INSTANCING_MORPHfloat 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`,nC=`#if defined( USE_MORPHCOLORS )+#endif`,pC=`#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`,iC=`#ifdef USE_MORPHNORMALS+#endif`,AC=`#ifdef USE_MORPHNORMALSobjectNormal *= morphTargetBaseInfluence;for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];}-#endif`,sC=`#ifdef USE_MORPHTARGETS+#endif`,gC=`#ifdef USE_MORPHTARGETS#ifndef USE_INSTANCING_MORPHuniform 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`,rC=`#ifdef USE_MORPHTARGETS+#endif`,mC=`#ifdef USE_MORPHTARGETStransformed *= morphTargetBaseInfluence;for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];}-#endif`,aC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;+#endif`,xC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;#ifdef FLAT_SHADEDvec3 fdx = dFdx( vViewPosition );vec3 fdy = dFdy( vViewPosition );@@ -1508,7 +1508,7 @@ IncidentLight directLight;tbn2[1] *= faceDirection;#endif#endif-vec3 nonPerturbedNormal = normal;`,oC=`#ifdef USE_NORMALMAP_OBJECTSPACE+vec3 nonPerturbedNormal = normal;`,bC=`#ifdef USE_NORMALMAP_OBJECTSPACEnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;#ifdef FLIP_SIDEDnormal = - normal;@@ -1523,25 +1523,25 @@ vec3 nonPerturbedNormal = normal;`,oC=`#ifdef USE_NORMALMAP_OBJECTSPACEnormal = normalize( tbn * mapN );#elif defined( USE_BUMPMAP )normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );-#endif`,cC=`#ifndef FLAT_SHADED+#endif`,EC=`#ifndef FLAT_SHADEDvarying vec3 vNormal;#ifdef USE_TANGENTvarying vec3 vTangent;varying vec3 vBitangent;#endif-#endif`,lC=`#ifndef FLAT_SHADED+#endif`,yC=`#ifndef FLAT_SHADEDvarying vec3 vNormal;#ifdef USE_TANGENTvarying vec3 vTangent;varying vec3 vBitangent;#endif-#endif`,hC=`#ifndef FLAT_SHADED+#endif`,_C=`#ifndef FLAT_SHADEDvNormal = normalize( transformedNormal );#ifdef USE_TANGENTvTangent = normalize( transformedTangent );vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );#endif-#endif`,uC=`#ifdef USE_NORMALMAP+#endif`,wC=`#ifdef USE_NORMALMAPuniform sampler2D normalMap;uniform vec2 normalScale;#endif@@ -1563,13 +1563,13 @@ vec3 nonPerturbedNormal = normal;`,oC=`#ifdef USE_NORMALMAP_OBJECTSPACEfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );return mat3( T * scale, B * scale, N );}-#endif`,dC=`#ifdef USE_CLEARCOAT+#endif`,vC=`#ifdef USE_CLEARCOATvec3 clearcoatNormal = nonPerturbedNormal;-#endif`,fC=`#ifdef USE_CLEARCOAT_NORMALMAP+#endif`,CC=`#ifdef USE_CLEARCOAT_NORMALMAPvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;clearcoatMapN.xy *= clearcoatNormalScale;clearcoatNormal = normalize( tbn2 * clearcoatMapN );-#endif`,pC=`#ifdef USE_CLEARCOATMAP+#endif`,IC=`#ifdef USE_CLEARCOATMAPuniform sampler2D clearcoatMap;#endif#ifdef USE_CLEARCOAT_NORMALMAP@@ -1578,18 +1578,18 @@ vec3 nonPerturbedNormal = normal;`,oC=`#ifdef USE_NORMALMAP_OBJECTSPACE#endif#ifdef USE_CLEARCOAT_ROUGHNESSMAPuniform sampler2D clearcoatRoughnessMap;-#endif`,AC=`#ifdef USE_IRIDESCENCEMAP+#endif`,SC=`#ifdef USE_IRIDESCENCEMAPuniform sampler2D iridescenceMap;#endif#ifdef USE_IRIDESCENCE_THICKNESSMAPuniform sampler2D iridescenceThicknessMap;-#endif`,gC=`#ifdef OPAQUE+#endif`,MC=`#ifdef OPAQUEdiffuseColor.a = 1.0;#endif#ifdef USE_TRANSMISSIONdiffuseColor.a *= material.transmissionAlpha;#endif-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,mC=`vec3 packNormalToRGB( const in vec3 normal ) {+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,BC=`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 );-}`,xC=`#ifdef PREMULTIPLIED_ALPHA+}`,TC=`#ifdef PREMULTIPLIED_ALPHAgl_FragColor.rgb *= gl_FragColor.a;-#endif`,bC=`vec4 mvPosition = vec4( transformed, 1.0 );+#endif`,RC=`vec4 mvPosition = vec4( transformed, 1.0 );#ifdef USE_BATCHINGmvPosition = batchingMatrix * mvPosition;#endif@@ -1668,22 +1668,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, constmvPosition = instanceMatrix * mvPosition;#endifmvPosition = modelViewMatrix * mvPosition;-gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERING+gl_Position = projectionMatrix * mvPosition;`,FC=`#ifdef DITHERINGgl_FragColor.rgb = dithering( gl_FragColor.rgb );-#endif`,yC=`#ifdef DITHERING+#endif`,NC=`#ifdef DITHERINGvec3 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`,_C=`float roughnessFactor = roughness;+#endif`,DC=`float roughnessFactor = roughness;#ifdef USE_ROUGHNESSMAPvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );roughnessFactor *= texelRoughness.g;-#endif`,wC=`#ifdef USE_ROUGHNESSMAP+#endif`,LC=`#ifdef USE_ROUGHNESSMAPuniform sampler2D roughnessMap;-#endif`,vC=`#if NUM_SPOT_LIGHT_COORDS > 0+#endif`,PC=`#if NUM_SPOT_LIGHT_COORDS > 0varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];#endif#if NUM_SPOT_LIGHT_MAPS > 0@@ -1869,7 +1869,7 @@ gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERING}return mix( 1.0, shadow, shadowIntensity );}-#endif`,CC=`#if NUM_SPOT_LIGHT_COORDS > 0+#endif`,kC=`#if NUM_SPOT_LIGHT_COORDS > 0uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];#endif@@ -1910,7 +1910,7 @@ gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERING};uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];#endif-#endif`,SC=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )+#endif`,UC=`#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;`,EC=`#ifdef DITHERINGvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;}#pragma unroll_loop_end-#endif`,IC=`float getShadowMask() {+#endif`,OC=`float getShadowMask() {float shadow = 1.0;#ifdef USE_SHADOWMAP#if NUM_DIR_LIGHT_SHADOWS > 0@@ -1974,12 +1974,12 @@ gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERING#endif#endifreturn shadow;-}`,MC=`#ifdef USE_SKINNING+}`,QC=`#ifdef USE_SKINNINGmat4 boneMatX = getBoneMatrix( skinIndex.x );mat4 boneMatY = getBoneMatrix( skinIndex.y );mat4 boneMatZ = getBoneMatrix( skinIndex.z );mat4 boneMatW = getBoneMatrix( skinIndex.w );-#endif`,BC=`#ifdef USE_SKINNING+#endif`,GC=`#ifdef USE_SKINNINGuniform mat4 bindMatrix;uniform mat4 bindMatrixInverse;uniform highp sampler2D boneTexture;@@ -1994,7 +1994,7 @@ gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERINGvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );return mat4( v1, v2, v3, v4 );}-#endif`,TC=`#ifdef USE_SKINNING+#endif`,HC=`#ifdef USE_SKINNINGvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );vec4 skinned = vec4( 0.0 );skinned += boneMatX * skinVertex * skinWeight.x;@@ -2002,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERINGskinned += boneMatZ * skinVertex * skinWeight.z;skinned += boneMatW * skinVertex * skinWeight.w;transformed = ( bindMatrixInverse * skinned ).xyz;-#endif`,RC=`#ifdef USE_SKINNING+#endif`,zC=`#ifdef USE_SKINNINGmat4 skinMatrix = mat4( 0.0 );skinMatrix += skinWeight.x * boneMatX;skinMatrix += skinWeight.y * boneMatY;@@ -2013,17 +2013,17 @@ gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERING#ifdef USE_TANGENTobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;#endif-#endif`,FC=`float specularStrength;+#endif`,VC=`float specularStrength;#ifdef USE_SPECULARMAPvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );specularStrength = texelSpecular.r;#elsespecularStrength = 1.0;-#endif`,DC=`#ifdef USE_SPECULARMAP+#endif`,WC=`#ifdef USE_SPECULARMAPuniform sampler2D specularMap;-#endif`,NC=`#if defined( TONE_MAPPING )+#endif`,qC=`#if defined( TONE_MAPPING )gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );-#endif`,LC=`#ifndef saturate+#endif`,KC=`#ifndef saturate#define saturate( a ) clamp( a, 0.0, 1.0 )#endifuniform 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; }`,PC=`#ifdef USE_TRANSMISSION+vec3 CustomToneMapping( vec3 color ) { return color; }`,jC=`#ifdef USE_TRANSMISSIONmaterial.transmission = transmission;material.transmissionAlpha = 1.0;material.thickness = thickness;@@ -2141,7 +2141,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,PC=`#ifdef USE_TRANSMISSmaterial.attenuationColor, material.attenuationDistance );material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );-#endif`,kC=`#ifdef USE_TRANSMISSION+#endif`,XC=`#ifdef USE_TRANSMISSIONuniform float transmission;uniform float thickness;uniform float attenuationDistance;@@ -2267,7 +2267,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,PC=`#ifdef USE_TRANSMISSfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );}-#endif`,UC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )+#endif`,YC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )varying vec2 vUv;#endif#ifdef USE_MAP@@ -2337,7 +2337,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,PC=`#ifdef USE_TRANSMISS#ifdef USE_THICKNESSMAPuniform mat3 thicknessMapTransform;varying vec2 vThicknessMapUv;-#endif`,OC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )+#endif`,JC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )varying vec2 vUv;#endif#ifdef USE_MAP@@ -2431,7 +2431,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,PC=`#ifdef USE_TRANSMISS#ifdef USE_THICKNESSMAPuniform mat3 thicknessMapTransform;varying vec2 vThicknessMapUv;-#endif`,QC=`#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@@ -2502,7 +2502,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,PC=`#ifdef USE_TRANSMISS#endif#ifdef USE_THICKNESSMAPvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;-#endif`,GC=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0+#endif`,$C=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0vec4 worldPosition = vec4( transformed, 1.0 );#ifdef USE_BATCHINGworldPosition = batchingMatrix * worldPosition;@@ -2511,7 +2511,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,PC=`#ifdef USE_TRANSMISSworldPosition = instanceMatrix * worldPosition;#endifworldPosition = modelMatrix * worldPosition;-#endif`;const ct={alphahash_fragment:zw,alphahash_pars_fragment:Vw,alphamap_fragment:Ww,alphamap_pars_fragment:qw,alphatest_fragment:Kw,alphatest_pars_fragment:jw,aomap_fragment:Xw,aomap_pars_fragment:Yw,batching_pars_vertex:Jw,batching_vertex:Zw,begin_vertex:$w,beginnormal_vertex:ev,bsdfs:tv,iridescence_fragment:nv,bumpmap_pars_fragment:iv,clipping_planes_fragment:sv,clipping_planes_pars_fragment:rv,clipping_planes_pars_vertex:av,clipping_planes_vertex:ov,color_fragment:cv,color_pars_fragment:lv,color_pars_vertex:hv,color_vertex:uv,common:dv,cube_uv_reflection_fragment:fv,defaultnormal_vertex:pv,displacementmap_pars_vertex:Av,displacementmap_vertex:gv,emissivemap_fragment:mv,emissivemap_pars_fragment:xv,colorspace_fragment:bv,colorspace_pars_fragment:Ev,envmap_fragment:yv,envmap_common_pars_fragment:_v,envmap_pars_fragment:wv,envmap_pars_vertex:vv,envmap_physical_pars_fragment:Lv,envmap_vertex:Cv,fog_vertex:Sv,fog_pars_vertex:Iv,fog_fragment:Mv,fog_pars_fragment:Bv,gradientmap_pars_fragment:Tv,lightmap_pars_fragment:Rv,lights_lambert_fragment:Fv,lights_lambert_pars_fragment:Dv,lights_pars_begin:Nv,lights_toon_fragment:Pv,lights_toon_pars_fragment:kv,lights_phong_fragment:Uv,lights_phong_pars_fragment:Ov,lights_physical_fragment:Qv,lights_physical_pars_fragment:Gv,lights_fragment_begin:Hv,lights_fragment_maps:zv,lights_fragment_end:Vv,logdepthbuf_fragment:Wv,logdepthbuf_pars_fragment:qv,logdepthbuf_pars_vertex:Kv,logdepthbuf_vertex:jv,map_fragment:Xv,map_pars_fragment:Yv,map_particle_fragment:Jv,map_particle_pars_fragment:Zv,metalnessmap_fragment:$v,metalnessmap_pars_fragment:eC,morphinstance_vertex:tC,morphcolor_vertex:nC,morphnormal_vertex:iC,morphtarget_pars_vertex:sC,morphtarget_vertex:rC,normal_fragment_begin:aC,normal_fragment_maps:oC,normal_pars_fragment:cC,normal_pars_vertex:lC,normal_vertex:hC,normalmap_pars_fragment:uC,clearcoat_normal_fragment_begin:dC,clearcoat_normal_fragment_maps:fC,clearcoat_pars_fragment:pC,iridescence_pars_fragment:AC,opaque_fragment:gC,packing:mC,premultiplied_alpha_fragment:xC,project_vertex:bC,dithering_fragment:EC,dithering_pars_fragment:yC,roughnessmap_fragment:_C,roughnessmap_pars_fragment:wC,shadowmap_pars_fragment:vC,shadowmap_pars_vertex:CC,shadowmap_vertex:SC,shadowmask_pars_fragment:IC,skinbase_vertex:MC,skinning_pars_vertex:BC,skinning_vertex:TC,skinnormal_vertex:RC,specularmap_fragment:FC,specularmap_pars_fragment:DC,tonemapping_fragment:NC,tonemapping_pars_fragment:LC,transmission_fragment:PC,transmission_pars_fragment:kC,uv_pars_fragment:UC,uv_pars_vertex:OC,uv_vertex:QC,worldpos_vertex:GC,background_vert:`varying vec2 vUv;+#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;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 Cl={r:0,b:0,g:0},Ar=new dn,HC=new Re;function zC(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 I=p(x);I===null?A(o,c):I&&I.isColor&&(A(I,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 I=p(E);I&&(I.isCubeTexture||I.mapping===vc)?(h===void 0&&(h=new Zt(new la(1,1,1),new Ns({name:"BackgroundCubeMaterial",uniforms:ha(Oi.backgroundCube.uniforms),vertexShader:Oi.backgroundCube.vertexShader,fragmentShader:Oi.backgroundCube.fragmentShader,side:Nn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(w,S,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),Ar.copy(E.backgroundRotation),Ar.x*=-1,Ar.y*=-1,Ar.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(Ar.y*=-1,Ar.z*=-1),h.material.uniforms.envMap.value=I,h.material.uniforms.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(HC.makeRotationFromEuler(Ar)),h.material.toneMapped=tt.getTransfer(I.colorSpace)!==Rt,(u!==I||d!==I.version||f!==i.toneMapping)&&(h.material.needsUpdate=!0,u=I,d=I.version,f=i.toneMapping),h.layers.enableAll(),x.unshift(h,h.geometry,h.material,0,0,null)):I&&I.isTexture&&(l===void 0&&(l=new Zt(new bl(2,2),new Ns({name:"BackgroundMaterial",uniforms:ha(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=I,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.toneMapped=tt.getTransfer(I.colorSpace)!==Rt,I.matrixAutoUpdate===!0&&I.updateMatrix(),l.material.uniforms.uvTransform.value.copy(I.matrix),(u!==I||d!==I.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=I,d=I.version,f=i.toneMapping),l.layers.enableAll(),x.unshift(l,l.geometry,l.material,0,0,null))}function A(x,E){x.getRGB(Cl,IA(i)),n.buffers.color.setClear(Cl.r,Cl.g,Cl.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 VC(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 N=!1;const O=u(q,K,F);r!==O&&(r=O,l(r.object)),N=f(v,q,K,$),N&&p(v,q,K,$),$!==null&&e.update($,i.ELEMENT_ARRAY_BUFFER),(N||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 N=$[F.id];N===void 0&&(N={},$[F.id]=N);let O=N[q];return O===void 0&&(O=d(c()),N[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,N=F.attributes;let O=0;const Y=K.getAttributes();for(const Q in Y)if(Y[Q].location>=0){const ee=$[Q];let ae=N[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 $={},N=F.attributes;let O=0;const Y=K.getAttributes();for(const Q in Y)if(Y[Q].location>=0){let ee=N[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,$,N,O){O===!0?i.vertexAttribIPointer(v,F,K,$,N):i.vertexAttribPointer(v,F,K,q,$,N)}function E(v,F,K,q){m();const $=q.attributes,N=K.getAttributes(),O=F.defaultAttributeValues;for(const Y in N){const Q=N[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===Xh;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 I(){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 S(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:I,releaseStatesOfGeometry:w,releaseStatesOfProgram:S,initAttributes:m,enableAttribute:g,disableUnusedAttributes:_}}function WC(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 qC(i,e,t,n){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const S=e.get("EXT_texture_filter_anisotropic");s=i.getParameter(S.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(S){return!(S!==hn&&n.convert(S)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(S){const T=S===Pn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(S!==cn&&n.convert(S)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&S!==ln&&!T)}function c(S){if(S==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="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),I=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:I,maxSamples:w}}function KC(i){const e=this;let t=null,n=0,s=!1,r=!1;const a=new Ps,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 I=0;I!==x;++I)E[I]=t[I];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 jC(i){let e=new WeakMap;function t(a,o){return o===wc?a.mapping=ir:o===jh&&(a.mapping=Kr),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===wc||o===jh)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 B_(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 xa=4,bg=[.125,.215,.35,.446,.526,.582],gr=20,fd=new cd,Eg=new Fe;let pd=null,Ad=0,gd=0,md=!1;const mr=(1+Math.sqrt(5))/2,ba=1/mr,yg=[new G(-mr,ba,0),new G(mr,ba,0),new G(-ba,0,mr),new G(ba,0,mr),new G(0,mr,-ba),new G(0,mr,ba),new G(-1,1,-1),new G(1,1,-1),new G(-1,1,1),new G(1,1,1)],XC=new G;class xd{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=XC}=r;pd=this._renderer.getRenderTarget(),Ad=this._renderer.getActiveCubeFace(),gd=this._renderer.getActiveMipmapLevel(),md=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=vg(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=wg(),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(pd,Ad,gd),this._renderer.xr.enabled=md,e.scissorTest=!1,Sl(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ir||e.mapping===Kr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),pd=this._renderer.getRenderTarget(),Ad=this._renderer.getActiveCubeFace(),gd=this._renderer.getActiveMipmapLevel(),md=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=_g(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=_g(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=YC(r)),this._blurMaterial=JC(r,e,t)}return s}_compileMaterial(e){const t=new Zt(this._lodPlanes[0],e);this._renderer.compile(t,fd)}_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(Eg),u.toneMapping=Cs,u.autoClear=!1;const p=new Ds({name:"PMREM.Background",side:Nn,depthWrite:!1,depthTest:!1}),m=new Zt(new la,p);let g=!1;const A=e.background;A?A.isColor&&(p.color.copy(A),e.background=null,g=!0):(p.color.copy(Eg),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;Sl(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===ir||e.mapping===Kr;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=vg()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=wg());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;Sl(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,fd)}_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=yg[(s-r-1)%yg.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*gr-1),m=r/p,g=isFinite(r)?1+Math.floor(h*m):gr;g>gr&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${gr}`);const A=[];let _=0;for(let S=0;S<gr;++S){const T=S/m,C=Math.exp(-T*T/2);A.push(C),S===0?_+=C:S<g&&(_+=2*C)}for(let S=0;S<A.length;S++)A[S]=A[S]/_;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],I=3*E*(s>x-xa?s-x+xa:0),w=4*(this._cubeSize-E);Sl(t,I,w,3*E,2*E),c.setRenderTarget(t),c.render(u,fd)}}function YC(i){const e=[],t=[],n=[];let s=i;const r=i-xa+1+bg.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=bg[a-i+xa-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 S=w%3*2/3-1,T=w>2?0:-1,C=[S,T,0,S+2/3,T,0,S+2/3,T+1,0,S,T,0,S+2/3,T+1,0,S,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 I=new Mn;I.setAttribute("position",new In(_,m)),I.setAttribute("uv",new In(x,g)),I.setAttribute("faceIndex",new In(E,A)),e.push(I),s>xa&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function _g(i,e,t){const n=new ar(i,e,t);return n.texture.mapping=vc,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Sl(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function JC(i,e,t){const n=new Float32Array(gr),s=new G(0,1,0);return new Ns({name:"SphericalGaussianBlur",defines:{n:gr,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:bd(),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}}},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:`precision mediump float;precision mediump int;@@ -3623,7 +3623,7 @@ void main() {}}- `,blending:vs,depthTest:!1,depthWrite:!1})}function wg(){return new Ns({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:bd(),fragmentShader:`+ `,blending:Cs,depthTest:!1,depthWrite:!1})}function Sg(){return new Ls({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:wd(),fragmentShader:`precision mediump float;precision mediump int;@@ -3642,7 +3642,7 @@ void main() {gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );}- `,blending:vs,depthTest:!1,depthWrite:!1})}function vg(){return new Ns({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:bd(),fragmentShader:`+ `,blending:Cs,depthTest:!1,depthWrite:!1})}function Mg(){return new Ls({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:wd(),fragmentShader:`precision mediump float;precision mediump int;@@ -3658,7 +3658,7 @@ void main() {gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );}- `,blending:vs,depthTest:!1,depthWrite:!1})}function bd(){return`+ `,blending:Cs,depthTest:!1,depthWrite:!1})}function wd(){return`precision mediump float;precision mediump int;@@ -3713,17 +3713,17 @@ void main() {gl_Position = vec4( position, 1.0 );}- `}function ZC(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===wc||c===jh,h=c===ir||c===Kr;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 xd(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 xd(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 $C(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&&Oc("THREE.WebGLRenderer: "+n+" extension not supported."),s}}}function eS(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 I=_[x+0],w=_[x+1],S=_[x+2];d.push(I,w,w,S,S,I)}}else if(p!==void 0){const _=p.array;m=p.version;for(let x=0,E=_.length/3-1;x<E;x+=3){const I=x+0,w=x+1,S=x+2;d.push(I,w,w,S,S,I)}}else return;const g=new(rA(d)?wA:Hu)(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 tS(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 nS(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 iS(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(){S.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,I=1;E>e.maxTextureSize&&(I=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const w=new Float32Array(E*I*4*u),S=new lA(w,E,I,u);S.type=ln,S.needsUpdate=!0;const T=x*4;for(let v=0;v<u;v++){const F=g[v],K=A[v],q=_[v],$=E*I*4*v;for(let N=0;N<F.count;N++){const O=N*T;f===!0&&(s.fromBufferAttribute(F,N),w[$+O+0]=s.x,w[$+O+1]=s.y,w[$+O+2]=s.z,w[$+O+3]=0),p===!0&&(s.fromBufferAttribute(K,N),w[$+O+4]=s.x,w[$+O+5]=s.y,w[$+O+6]=s.z,w[$+O+7]=0),m===!0&&(s.fromBufferAttribute(q,N),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:S,size:new Je(E,I)},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 sS(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 Cg=new nn,Sg=new jA(1,1),Ig=new lA,Mg=new hA,Bg=new RA,Tg=[],Rg=[],Fg=new Float32Array(16),Dg=new Float32Array(9),Ng=new Float32Array(4);function Ea(i,e,t){const n=i[0];if(n<=0||n>0)return i;const s=e*t;let r=Tg[s];if(r===void 0&&(r=new Float32Array(s),Tg[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 Il(i,e){let t=Rg[e];t===void 0&&(t=new Int32Array(e),Rg[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function rS(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function aS(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 oS(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 cS(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 lS(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;Ng.set(n),i.uniformMatrix2fv(this.addr,!1,Ng),pn(t,n)}}function hS(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;Dg.set(n),i.uniformMatrix3fv(this.addr,!1,Dg),pn(t,n)}}function uS(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;Fg.set(n),i.uniformMatrix4fv(this.addr,!1,Fg),pn(t,n)}}function dS(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function fS(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 pS(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 AS(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 gS(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function mS(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 xS(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 bS(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 ES(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?(Sg.compareFunction=nA,r=Sg):r=Cg,t.setTexture2D(e||r,s)}function yS(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture3D(e||Mg,s)}function _S(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTextureCube(e||Bg,s)}function wS(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture2DArray(e||Ig,s)}function vS(i){switch(i){case 5126:return rS;case 35664:return aS;case 35665:return oS;case 35666:return cS;case 35674:return lS;case 35675:return hS;case 35676:return uS;case 5124:case 35670:return dS;case 35667:case 35671:return fS;case 35668:case 35672:return pS;case 35669:case 35673:return AS;case 5125:return gS;case 36294:return mS;case 36295:return xS;case 36296:return bS;case 35678:case 36198:case 36298:case 36306:case 35682:return ES;case 35679:case 36299:case 36307:return yS;case 35680:case 36300:case 36308:case 36293:return _S;case 36289:case 36303:case 36311:case 36292:return wS}}function CS(i,e){i.uniform1fv(this.addr,e)}function SS(i,e){const t=Ea(e,this.size,2);i.uniform2fv(this.addr,t)}function IS(i,e){const t=Ea(e,this.size,3);i.uniform3fv(this.addr,t)}function MS(i,e){const t=Ea(e,this.size,4);i.uniform4fv(this.addr,t)}function BS(i,e){const t=Ea(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function TS(i,e){const t=Ea(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function RS(i,e){const t=Ea(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function FS(i,e){i.uniform1iv(this.addr,e)}function DS(i,e){i.uniform2iv(this.addr,e)}function NS(i,e){i.uniform3iv(this.addr,e)}function LS(i,e){i.uniform4iv(this.addr,e)}function PS(i,e){i.uniform1uiv(this.addr,e)}function kS(i,e){i.uniform2uiv(this.addr,e)}function US(i,e){i.uniform3uiv(this.addr,e)}function OS(i,e){i.uniform4uiv(this.addr,e)}function QS(i,e,t){const n=this.cache,s=e.length,r=Il(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture2D(e[a]||Cg,r[a])}function GS(i,e,t){const n=this.cache,s=e.length,r=Il(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture3D(e[a]||Mg,r[a])}function HS(i,e,t){const n=this.cache,s=e.length,r=Il(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTextureCube(e[a]||Bg,r[a])}function zS(i,e,t){const n=this.cache,s=e.length,r=Il(t,s);fn(n,r)||(i.uniform1iv(this.addr,r),pn(n,r));for(let a=0;a!==s;++a)t.setTexture2DArray(e[a]||Ig,r[a])}function VS(i){switch(i){case 5126:return CS;case 35664:return SS;case 35665:return IS;case 35666:return MS;case 35674:return BS;case 35675:return TS;case 35676:return RS;case 5124:case 35670:return FS;case 35667:case 35671:return DS;case 35668:case 35672:return NS;case 35669:case 35673:return LS;case 5125:return PS;case 36294:return kS;case 36295:return US;case 36296:return OS;case 35678:case 36198:case 36298:case 36306:case 35682:return QS;case 35679:case 36299:case 36307:return GS;case 35680:case 36300:case 36308:case 36293:return HS;case 36289:case 36303:case 36311:case 36292:return zS}}class WS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=vS(t.type)}}class qS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=VS(t.type)}}class KS{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 Ed=/(\w+)(\])?(\[|\.)?/g;function Lg(i,e){i.seq.push(e),i.map[e.id]=e}function jS(i,e,t){const n=i.name,s=n.length;for(Ed.lastIndex=0;;){const r=Ed.exec(n),a=Ed.lastIndex;let o=r[1];const c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===s){Lg(t,l===void 0?new WS(o,i,e):new qS(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new KS(o),Lg(t,u)),t=u}}}class Ml{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);jS(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 Pg(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const XS=37297;let YS=0;function JS(i,e){const t=i.split(`+ `}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(``),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 kg=new ot;function ZS(i){tt._getMatrix(kg,tt.workingColorSpace,i);const e=`mat3( ${kg.elements.map(t=>t.toFixed(4))} )`;switch(tt.getTransfer(i)){case kc:return[e,"LinearTransferOETF"];case Rt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Ug(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 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()+``+s+`-`+JS(i.getShaderSource(e),a)}else return s}function $S(i,e){const t=ZS(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`-`)}function eI(i,e){let t;switch(e){case Kh:t="Linear";break;case Ey:t="Reinhard";break;case yy:t="Cineon";break;case Hp:t="ACESFilmic";break;case wy:t="AgX";break;case vy:t="Neutral";break;case _y:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Bl=new G;function tI(){tt.getLuminanceCoefficients(Bl);const i=Bl.x.toFixed(4),e=Bl.y.toFixed(4),t=Bl.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`-`)}function nI(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ro).join(`-`)}function iI(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`-`)}function sI(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 Ro(i){return i!==""}function Og(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 Qg(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const rI=/^[ \t]*#include +<([\w\d./]+)>/gm;function yd(i){return i.replace(rI,oI)}const aI=new Map;function oI(i,e){let t=ct[e];if(t===void 0){const n=aI.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 yd(t)}const cI=/#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 Gg(i){return i.replace(cI,lI)}function lI(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 Hg(i){let e=`precision ${i.precision} float;+`+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;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 hI(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Up?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===$E?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===qi&&(e="SHADOWMAP_TYPE_VSM"),e}function uI(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case ir:case Kr:e="ENVMAP_TYPE_CUBE";break;case vc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function dI(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===Kr&&(e="ENVMAP_MODE_REFRACTION"),e}function fI(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case _c:e="ENVMAP_BLENDING_MULTIPLY";break;case xy:e="ENVMAP_BLENDING_MIX";break;case by:e="ENVMAP_BLENDING_ADD";break}return e}function pI(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 AI(i,e,t,n){const s=i.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=hI(t),l=uI(t),h=dI(t),u=fI(t),d=pI(t),f=nI(t),p=iI(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(Ro).join(`+#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(``),g.length>0&&(g+=`-`),A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Ro).join(`+`),A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(No).join(``),A.length>0&&(A+=`-`)):(g=[Hg(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(Ro).join(`-`),A=[Hg(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!==Cs?"#define TONE_MAPPING":"",t.toneMapping!==Cs?ct.tonemapping_pars_fragment:"",t.toneMapping!==Cs?eI("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ct.colorspace_pars_fragment,$S("linearToOutputTexel",t.outputColorSpace),tI(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`-`].filter(Ro).join(`-`)),a=yd(a),a=Og(a,t),a=Qg(a,t),o=yd(o),o=Og(o,t),o=Qg(o,t),a=Gg(a),o=Gg(o),t.isRawShaderMaterial!==!0&&(_=`#version 300 es+`)):(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=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(``)+`-`+g,A=["#define varying in",t.glslVersion===iA?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===iA?"":"#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===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(``)+`-`+A);const x=_+g+a,E=_+A+o,I=Pg(s,s.VERTEX_SHADER,x),w=Pg(s,s.FRAGMENT_SHADER,E);s.attachShader(m,I),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 S(F){if(i.debug.checkShaderErrors){const K=s.getProgramInfoLog(m).trim(),q=s.getShaderInfoLog(I).trim(),$=s.getShaderInfoLog(w).trim();let N=!0,O=!0;if(s.getProgramParameter(m,s.LINK_STATUS)===!1)if(N=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,m,I,w);else{const Y=Ug(s,I,"vertex"),Q=Ug(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=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)+`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:N,programLog:K,vertexShader:{log:q,prefix:g},fragmentShader:{log:$,prefix:A}})}s.deleteShader(I),s.deleteShader(w),T=new Ml(s,m),C=sI(s,m)}let T;this.getUniforms=function(){return T===void 0&&S(this),T};let C;this.getAttributes=function(){return C===void 0&&S(this),C};let v=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return v===!1&&(v=s.getProgramParameter(m,XS)),v},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=YS++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=I,this.fragmentShader=w,this}let gI=0;class mI{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 xI(e),t.set(e,n)),n}}class xI{constructor(e){this.id=gI++,this.code=e,this.usedTimes=0}}function bI(i,e,t,n,s,r,a){const o=new pA,c=new mI,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,N=q.geometry,O=C.isMeshStandardMaterial?K.environment:null,Y=(C.isMeshStandardMaterial?t:e).get(C.envMap||O),Q=Y&&Y.mapping===vc?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=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,ae=ee!==void 0?ee.length:0;let _e=0;N.morphAttributes.position!==void 0&&(_e=1),N.morphAttributes.normal!==void 0&&(_e=2),N.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,Nt=!!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,Ne=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,Ie=C.alphaTest>0,Se=!!C.alphaHash,st=!!C.extensions;let Gt=Cs;C.toneMapped&&(be===null||be.isXRRenderTarget===!0)&&(Gt=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:Nt,normalMapObjectSpace:mt&&C.normalMapType===Ry,normalMapTangentSpace:mt&&C.normalMapType===Pc,metalnessMap:ze,roughnessMap:L,anisotropy:M,anisotropyMap:ve,clearcoat:Z,clearcoatMap:qe,clearcoatNormalMap:Ze,clearcoatRoughnessMap:Ee,dispersion:le,iridescence:Ae,iridescenceMap:Ne,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===Wr&&C.alphaToCoverage===!1,alphaMap:de,alphaTest:Ie,alphaHash:Se,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:Nt&&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:Ne&&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:!!N.attributes.tangent&&(mt||M),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:q.isPoints===!0&&!!N.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:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.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:Gt,decodeVideoTexture:Mt&&C.map.isVideoTexture===!0&&tt.getTransfer(C.map.colorSpace)===Rt,decodeVideoTextureEmissive:Nt&&C.emissiveMap.isVideoTexture===!0&&tt.getTransfer(C.emissiveMap.colorSpace)===Rt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Li,flipSided:C.side===Nn,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=C_.clone(K.uniforms)}else F=C.uniforms;return F}function I(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 AI(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 S(C){c.remove(C)}function T(){c.dispose()}return{getParameters:g,getProgramCacheKey:A,getUniforms:E,acquireProgram:I,releaseProgram:w,releaseShaderCache:S,programs:h,dispose:T}}function EI(){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 yI(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 zg(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 Vg(){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||yI),n.length>1&&n.sort(d||zg),s.length>1&&s.sort(d||zg)}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 _I(){let i=new WeakMap;function e(n,s){const r=i.get(n);let a;return r===void 0?(a=new Vg,i.set(n,[a])):s>=r.length?(a=new Vg,r.push(a)):a=r[s],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function wI(){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 vI(){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 CI=0;function SI(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function II(i){const e=new wI,t=vI(),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,I=0,w=0,S=0;l.sort(SI);for(let C=0,v=l.length;C<v;C++){const F=l[C],K=F.color,q=F.intensity,$=F.distance,N=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);S++}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]=N,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[I]=F.map,I++,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]=N,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]=N,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!==I||T.numLightProbes!==S)&&(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+I-w,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=S,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=I,T.numLightProbes=S,n.version=CI++)}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 Wg(i){const e=new II(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 MI(i){let e=new WeakMap;function t(s,r=0){const a=e.get(s);let o;return a===void 0?(o=new Wg(i),e.set(s,[o])):r>=a.length?(o=new Wg(i),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const BI=`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 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() {gl_Position = vec4( position, 1.0 );-}`,TI=`uniform sampler2D shadow_pass;+}`,HS=`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 RI(i,e,t){let n=new Zu;const s=new Je,r=new Je,a=new gt,o=new ow({depthPacking:Ty}),c=new cw,l={},h=t.maxTextureSize,u={[Ki]:Nn,[Nn]:Ki,[Li]:Li},d=new Ns({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Je},radius:{value:4}},vertexShader:BI,fragmentShader:TI}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new Mn;p.setAttribute("position",new In(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=Up;let A=this.type;this.render=function(w,S,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(vs),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 N=0,O=w.length;N<O;N++){const Y=w[N],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 ar(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(S,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,S){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 ar(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(S,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(S,null,T,f,m,null)}function x(w,S,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&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0||S.alphaToCoverage===!0){const K=v.uuid,q=S.uuid;let $=l[K];$===void 0&&($={},l[K]=$);let N=$[q];N===void 0&&(N=v.clone(),$[q]=N,S.addEventListener("dispose",I)),v=N}if(v.visible=S.visible,v.wireframe=S.wireframe,C===qi?v.side=S.shadowSide!==null?S.shadowSide:S.side:v.side=S.shadowSide!==null?S.shadowSide:u[S.side],v.alphaMap=S.alphaMap,v.alphaTest=S.alphaToCoverage===!0?.5:S.alphaTest,v.map=S.map,v.clipShadows=S.clipShadows,v.clippingPlanes=S.clippingPlanes,v.clipIntersection=S.clipIntersection,v.displacementMap=S.displacementMap,v.displacementScale=S.displacementScale,v.displacementBias=S.displacementBias,v.wireframeLinewidth=S.wireframeLinewidth,v.linewidth=S.linewidth,T.isPointLight===!0&&v.isMeshDistanceMaterial===!0){const K=i.properties.get(v);K.light=T}return v}function E(w,S,T,C,v){if(w.visible===!1)return;if(w.layers.test(S.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 N=q.groups;for(let O=0,Y=N.length;O<Y;O++){const Q=N[O],J=$[Q.materialIndex];if(J&&J.visible){const ee=x(w,J,C,v);w.onBeforeShadow(i,w,S,T,q,ee,Q),i.renderBufferDirect(T,null,q,ee,w,Q),w.onAfterShadow(i,w,S,T,q,ee,Q)}}}else if($.visible){const N=x(w,$,C,v);w.onBeforeShadow(i,w,S,T,q,N,null),i.renderBufferDirect(T,null,q,N,w,null),w.onAfterShadow(i,w,S,T,q,N,null)}}const K=w.children;for(let q=0,$=K.length;q<$;q++)E(K[q],S,T,C,v)}function I(w){w.target.removeEventListener("dispose",I);for(const T in l){const C=l[T],v=w.target.uuid;v in C&&(C[v].dispose(),delete C[v])}}}const FI={[Qh]:Gh,[Hh]:Wh,[zh]:qh,[qr]:Vh,[Gh]:Qh,[Wh]:Hh,[qh]:zh,[Vh]:qr};function DI(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(Ie){re!==Ie&&!W&&(i.colorMask(Ie,Ie,Ie,Ie),re=Ie)},setLocked:function(Ie){W=Ie},setClear:function(Ie,Se,st,Gt,vn){vn===!0&&(Ie*=Gt,Se*=Gt,st*=Gt),ne.set(Ie,Se,st,Gt),de.equals(ne)===!1&&(i.clearColor(Ie,Se,st,Gt),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,Ie=null;return{setReversed:function(Se){if(ne!==Se){const st=e.get("EXT_clip_control");Se?st.clipControlEXT(st.LOWER_LEFT_EXT,st.ZERO_TO_ONE_EXT):st.clipControlEXT(st.LOWER_LEFT_EXT,st.NEGATIVE_ONE_TO_ONE_EXT),ne=Se;const Gt=Ie;Ie=null,this.setClear(Gt)}},getReversed:function(){return ne},setTest:function(Se){Se?be(i.DEPTH_TEST):Ue(i.DEPTH_TEST)},setMask:function(Se){re!==Se&&!W&&(i.depthMask(Se),re=Se)},setFunc:function(Se){if(ne&&(Se=FI[Se]),de!==Se){switch(Se){case Qh:i.depthFunc(i.NEVER);break;case Gh:i.depthFunc(i.ALWAYS);break;case Hh:i.depthFunc(i.LESS);break;case qr:i.depthFunc(i.LEQUAL);break;case zh:i.depthFunc(i.EQUAL);break;case Vh:i.depthFunc(i.GEQUAL);break;case Wh:i.depthFunc(i.GREATER);break;case qh:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}de=Se}},setLocked:function(Se){W=Se},setClear:function(Se){Ie!==Se&&(ne&&(Se=1-Se),i.clearDepth(Se),Ie=Se)},reset:function(){W=!1,re=null,de=null,Ie=null,ne=!1}}}function s(){let W=!1,ne=null,re=null,de=null,Ie=null,Se=null,st=null,Gt=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,Ni){(re!==Ct||de!==ii||Ie!==Ni)&&(i.stencilFunc(Ct,ii,Ni),re=Ct,de=ii,Ie=Ni)},setOp:function(Ct,ii,Ni){(Se!==Ct||st!==ii||Gt!==Ni)&&(i.stencilOp(Ct,ii,Ni),Se=Ct,st=ii,Gt=Ni)},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,Ie=null,Se=null,st=null,Gt=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,I=null,w=null,S=new Fe(0,0,0),T=0,C=!1,v=null,F=null,K=null,q=null,$=null;const N=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 Ie=new Uint8Array(4),Se=i.createTexture();i.bindTexture(W,Se),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,Ie):i.texImage2D(ne+st,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Ie);return Se}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(qr),pt(!1),mt(kp),be(i.CULL_FACE),H(vs);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 Ie=W.textures;if(re.length!==Ie.length||re[0]!==i.COLOR_ATTACHMENT0){for(let Se=0,st=Ie.length;Se<st;Se++)re[Se]=i.COLOR_ATTACHMENT0+Se;re.length=Ie.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={[nr]:i.FUNC_ADD,[ty]:i.FUNC_SUBTRACT,[ny]:i.FUNC_REVERSE_SUBTRACT};ft[iy]=i.MIN,ft[sy]=i.MAX;const $e={[ry]:i.ZERO,[ay]:i.ONE,[oy]:i.SRC_COLOR,[Uh]:i.SRC_ALPHA,[fy]:i.SRC_ALPHA_SATURATE,[uy]:i.DST_COLOR,[ly]:i.DST_ALPHA,[cy]:i.ONE_MINUS_SRC_COLOR,[Oh]:i.ONE_MINUS_SRC_ALPHA,[dy]:i.ONE_MINUS_DST_COLOR,[hy]:i.ONE_MINUS_DST_ALPHA,[py]:i.CONSTANT_COLOR,[Ay]:i.ONE_MINUS_CONSTANT_COLOR,[gy]:i.CONSTANT_ALPHA,[my]:i.ONE_MINUS_CONSTANT_ALPHA};function H(W,ne,re,de,Ie,Se,st,Gt,vn,Ct){if(W===vs){m===!0&&(Ue(i.BLEND),m=!1);return}if(m===!1&&(be(i.BLEND),m=!0),W!==ey){if(W!==g||Ct!==C){if((A!==nr||E!==nr)&&(i.blendEquation(i.FUNC_ADD),A=nr,E=nr),Ct)switch(W){case Wr:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Op:i.blendFunc(i.ONE,i.ONE);break;case Qp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Gp: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 Wr:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Op:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Qp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Gp:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}_=null,x=null,I=null,w=null,S.set(0,0,0),T=0,g=W,C=Ct}return}Ie=Ie||ne,Se=Se||re,st=st||de,(ne!==A||Ie!==E)&&(i.blendEquationSeparate(ft[ne],ft[Ie]),A=ne,E=Ie),(re!==_||de!==x||Se!==I||st!==w)&&(i.blendFuncSeparate($e[re],$e[de],$e[Se],$e[st]),_=re,x=de,I=Se,w=st),(Gt.equals(S)===!1||vn!==T)&&(i.blendColor(Gt.r,Gt.g,Gt.b,vn),S.copy(Gt),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===Nn;ne&&(re=!re),pt(re),W.blending===Wr&&W.transparent===!1?H(vs):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)),Nt(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!==JE?(be(i.CULL_FACE),W!==F&&(W===kp?i.cullFace(i.BACK):W===ZE?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 Nt(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+N-1),J!==W&&(i.activeTexture(W),J=W)}function M(W,ne,re){re===void 0&&(J===null?re=i.TEXTURE0+N-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 Ne(){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,I=null,w=null,S=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:Nt,setScissorTest:ze,activeTexture:L,bindTexture:M,unbindTexture:Z,compressedTexImage2D:le,compressedTexImage3D:Ae,texImage2D:Ne,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 NI(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):po("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?kc: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===sr||M===to?Z=i.DEPTH24_STENCIL8:M===ln?Z=i.DEPTH32F_STENCIL8:M===eo&&(Z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===sr||M===to?Z=i.DEPTH_COMPONENT24:M===ln?Z=i.DEPTH_COMPONENT32F:M===eo&&(Z=i.DEPTH_COMPONENT16),Z}function I(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 S(L){const M=L.target;M.removeEventListener("dispose",S),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 N(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,[Cc]:i.MIRRORED_REPEAT},ee={[Ln]:i.NEAREST,[Wp]:i.NEAREST_MIPMAP_NEAREST,[$a]:i.NEAREST_MIPMAP_LINEAR,[qt]:i.LINEAR,[Sc]:i.LINEAR_MIPMAP_NEAREST,[si]:i.LINEAR_MIPMAP_LINEAR},ae={[Fy]:i.NEVER,[Uy]:i.ALWAYS,[Dy]:i.LESS,[nA]:i.LEQUAL,[Ny]:i.EQUAL,[ky]:i.GEQUAL,[Ly]:i.GREATER,[Py]:i.NOTEQUAL};function _e(L,M){if(M.type===ln&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===qt||M.magFilter===Sc||M.magFilter===$a||M.magFilter===si||M.minFilter===qt||M.minFilter===Sc||M.minFilter===$a||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!==$a&&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=Nt(M,Ee);const Ne=r.convert(M.format,M.colorSpace),Oe=r.convert(M.type);let Ge=x(M.internalFormat,Ne,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=I(M,Ee);if(M.isDepthTexture)Ge=E(M.format===io,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,Ne,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,Ne,Oe,Te.data):t.texImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,Ne,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,Ne,Oe,Ee.data)):t.texImage2D(i.TEXTURE_2D,0,Ge,Ee.width,Ee.height,0,Ne,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(Ne!==null)if(Ke){if(W)if(M.layerUpdates.size>0){const Ie=mg(Te.width,Te.height,M.format,M.type);for(const Se of M.layerUpdates){const st=Te.data.subarray(Se*Ie/Te.data.BYTES_PER_ELEMENT,(Se+1)*Ie/Te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,Se,Te.width,Te.height,1,Ne,st)}M.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,Te.width,Te.height,Ee.depth,Ne,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,Ne,Oe,Te.data):t.texImage3D(i.TEXTURE_2D_ARRAY,re,Ge,Te.width,Te.height,Ee.depth,0,Ne,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?Ne!==null?Ke?W&&t.compressedTexSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,Ne,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,Ne,Oe,Te.data):t.texImage2D(i.TEXTURE_2D,re,Ge,Te.width,Te.height,0,Ne,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=mg(Ee.width,Ee.height,M.format,M.type);for(const de of M.layerUpdates){const Ie=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,Ne,Oe,Ie)}M.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ee.width,Ee.height,Ee.depth,Ne,Oe,Ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ge,Ee.width,Ee.height,Ee.depth,0,Ne,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,Ne,Oe,Ee.data)):t.texImage3D(i.TEXTURE_3D,0,Ge,Ee.width,Ee.height,Ee.depth,0,Ne,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 Ie=0;Ie<ne;Ie++)t.texImage2D(i.TEXTURE_2D,Ie,Ge,re,de,0,Ne,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,Ne,Oe,Te):t.texImage2D(i.TEXTURE_2D,re,Ge,Ne,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,Ne,Oe,Ee)}else t.texImage2D(i.TEXTURE_2D,0,Ge,Ne,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,Ne=[];for(let de=0;de<6;de++)!Ze&&!Ee?Ne[de]=m(M.image[de],!0,s.maxCubemapSize):Ne[de]=Ee?M.image[de].image:M.image[de],Ne[de]=Nt(M,Ne[de]);const Oe=Ne[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=I(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=Ne[de].mipmaps;for(let Ie=0;Ie<re.length;Ie++){const Se=re[Ie];M.format!==hn?Ge!==null?Ke?W&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie,0,0,Se.width,Se.height,Ge,Se.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie,nt,Se.width,Se.height,0,Se.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,Ie,0,0,Se.width,Se.height,Ge,Te,Se.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie,nt,Se.width,Se.height,0,Ge,Te,Se.data)}}}else{if(re=M.mipmaps,Ke&&it){re.length>0&&ne++;const de=ze(Ne[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,Ne[de].width,Ne[de].height,Ge,Te,Ne[de].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,nt,Ne[de].width,Ne[de].height,0,Ge,Te,Ne[de].data);for(let Ie=0;Ie<re.length;Ie++){const st=re[Ie].image[de].image;Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+1,0,0,st.width,st.height,Ge,Te,st.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+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,Ne[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,nt,Ge,Te,Ne[de]);for(let Ie=0;Ie<re.length;Ie++){const Se=re[Ie];Ke?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+1,0,0,Ge,Te,Se.image[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+1,nt,Ge,Te,Se.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 Ne=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,Ne,Oe,M.depth,0,Qe,ve,null):t.texImage2D(Ae,oe,qe,Ne,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),N(M.depthTexture,0);const Ae=le.__webglTexture,oe=pt(M);if(M.depthTexture.format===no)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===io)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",S);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),Ne=x(qe.internalFormat,Ze,Ee,qe.colorSpace,L.isXRRenderTarget===!0),Oe=pt(L);i.renderbufferStorageMultisample(i.RENDERBUFFER,Oe,Ne,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 Nt(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=N,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 LI(i,e){function t(n,s=gi){let r;const a=tt.getTransfer(s);if(n===cn)return i.UNSIGNED_BYTE;if(n===Yh)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Jh)return i.UNSIGNED_SHORT_5_5_5_1;if(n===jp)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===qp)return i.BYTE;if(n===Kp)return i.SHORT;if(n===eo)return i.UNSIGNED_SHORT;if(n===Xh)return i.INT;if(n===sr)return i.UNSIGNED_INT;if(n===ln)return i.FLOAT;if(n===Pn)return i.HALF_FLOAT;if(n===Xp)return i.ALPHA;if(n===Yp)return i.RGB;if(n===hn)return i.RGBA;if(n===no)return i.DEPTH_COMPONENT;if(n===io)return i.DEPTH_STENCIL;if(n===ji)return i.RED;if(n===Zh)return i.RED_INTEGER;if(n===rr)return i.RG;if(n===$h)return i.RG_INTEGER;if(n===eu)return i.RGBA_INTEGER;if(n===Ic||n===so||n===Mc||n===ro)if(a===Rt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Ic)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===so)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Mc)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===Ic)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===so)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Mc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ro)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Bc||n===tu||n===Tc||n===nu)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Bc)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===tu)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Tc)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===nu)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Rc||n===Fc||n===Dc)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Rc||n===Fc)return a===Rt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Dc)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ao||n===iu||n===su||n===ru||n===oo||n===au||n===ou||n===cu||n===lu||n===hu||n===uu||n===du||n===fu||n===pu)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ao)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===iu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===su)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ru)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===oo)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===au)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ou)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===cu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===lu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===hu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===uu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===du)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===fu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===pu)return a===Rt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===co||n===Au||n===Nc)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===co)return a===Rt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Au)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Nc)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Jp||n===gu||n===mu||n===xu)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===co)return r.COMPRESSED_RED_RGTC1_EXT;if(n===gu)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===mu)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===xu)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===to?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const PI=`+}`;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=`void main() {gl_Position = vec4( position, 1.0 );-}`,kI=`+}`,XS=`uniform sampler2DArray depthColor;uniform float depthWidth;uniform float depthHeight;@@ -3816,7 +3816,7 @@ void main() {}-}`;class UI{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 Ns({vertexShader:PI,fragmentShader:kI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Zt(new bl(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class OI extends Is{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 UI,g=t.getContextAttributes();let A=null,_=null;const x=[],E=[],I=new Je;let w=null;const S=new Bn;S.viewport=new gt;const T=new Bn;T.viewport=new gt;const C=[S,T],v=new Cw;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 Wu,x[se]=me),me.getTargetRaySpace()},this.getControllerGrip=function(se){let me=x[se];return me===void 0&&(me=new Wu,x[se]=me),me.getGripSpace()},this.getHand=function(se){let me=x[se];return me===void 0&&(me=new Wu,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",N);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(I.width,I.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",N),g.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(I),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?io:no,be=g.stencil?to:sr);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 ar(d.textureWidth,d.textureHeight,{format:hn,type:cn,depthTexture:new jA(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 ar(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 N(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),Nt=We*-H;if(me.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Nt),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-Nt,Z=mt+(be-Nt),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=S.near=me,v.far=T.far=S.far=xe,(F!==v.near||K!==v.far)&&(s.updateRenderState({depthNear:v.near,depthFar:v.far}),F=v.near,K=v.far),S.layers.mask=se.layers.mask|2,T.layers.mask=se.layers.mask|4,v.layers.mask=S.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,S,T):v.projectionMatrix.copy(S.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=Jr*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 xg;Me.setAnimationLoop(_e),this.setAnimationLoop=function(se){ae=se},this.dispose=function(){}}}const xr=new dn,QI=new Re;function GI(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,IA(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===Nn&&(g.bumpScale.value*=-1)),A.normalMap&&(g.normalMap.value=A.normalMap,t(A.normalMap,g.normalMapTransform),g.normalScale.value.copy(A.normalScale),A.side===Nn&&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,xr.copy(E),xr.x*=-1,xr.y*=-1,xr.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(xr.y*=-1,xr.z*=-1),g.envMapRotation.value.setFromMatrix4(QI.makeRotationFromEuler(xr)),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===Nn&&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 HI(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 I=x.program;n.updateUBOMapping(_,I);const w=e.render.frame;r[_.id]!==w&&(d(_),r[_.id]=w)}function h(_){const x=u();_.__bindingPointIndex=x;const E=i.createBuffer(),I=_.__size,w=_.usage;return i.bindBuffer(i.UNIFORM_BUFFER,E),i.bufferData(i.UNIFORM_BUFFER,I,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,I=_.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let w=0,S=E.length;w<S;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,I)===!0){const K=F.__offset,q=Array.isArray(F.value)?F.value:[F.value];let $=0;for(let N=0;N<q.length;N++){const O=q[N],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,I){const w=_.value,S=x+"_"+E;if(I[S]===void 0)return typeof w=="number"||typeof w=="boolean"?I[S]=w:I[S]=w.clone(),!0;{const T=I[S];if(typeof w=="number"||typeof w=="boolean"){if(T!==w)return I[S]=w,!0}else if(T.equals(w)===!1)return T.copy(w),!0}return!1}function p(_){const x=_.uniforms;let E=0;const I=16;for(let S=0,T=x.length;S<T;S++){const C=Array.isArray(x[S])?x[S]:[x[S]];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,N=q.length;$<N;$++){const O=q[$],Y=m(O),Q=E%I,J=Q%Y.boundary,ee=Q+J;E+=J,ee!==0&&I-ee<Y.storage&&(E+=I-ee),K.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=E,E+=Y.storage}}}const w=E%I;return w>0&&(E+=I-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 qg{constructor(e={}){const{canvas:t=t_(),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=Cs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let I=!1;this._outputColorSpace=yt;let w=0,S=0,T=null,C=-1,v=null;const F=new gt,K=new gt;let q=null;const $=new Fe(0);let N=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 Zu;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 r176"),t.addEventListener("webglcontextlost",de,!1),t.addEventListener("webglcontextrestored",Ie,!1),t.addEventListener("webglcontextcreationerror",Se,!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,Nt,ze,L,M,Z,le,Ae,oe,Qe,ve,qe,Ze,Ee,Ne,Oe,Ge,Te,nt,Ke,it,W;function ne(){pt=new $C(H),pt.init(),Ke=new LI(H,pt),mt=new qC(H,pt,e,Ke),We=new DI(H,pt),mt.reverseDepthBuffer&&d&&We.buffers.depth.setReversed(!0),Nt=new nS(H),ze=new EI,L=new NI(H,pt,We,ze,mt,Ke,Nt),M=new jC(E),Z=new ZC(E),le=new Hw(H),it=new VC(H,le),Ae=new eS(H,le,Nt,it),oe=new sS(H,Ae,le,Nt),Ge=new iS(H,mt,L),Ee=new KC(ze),Qe=new bI(E,M,Z,pt,mt,it,Ee),ve=new GI(E,ze),qe=new _I,Ze=new MI(pt),Oe=new zC(E,M,Z,We,oe,f,c),Ne=new RI(E,oe,mt),W=new HI(H,Nt,mt,We),Te=new WC(H,pt,Nt),nt=new tS(H,pt,Nt),Nt.programs=Qe.programs,E.capabilities=mt,E.extensions=pt,E.properties=ze,E.renderLists=qe,E.shadowMap=Ne,E.state=We,E.info=Nt}ne();const re=new OI(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,D=!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),D===!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,D){O=y,Y=R,Q=D,t.width=Math.floor(y*D),t.height=Math.floor(R*D),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,D,U){y.isVector4?ae.set(y.x,y.y,y.z,y.w):ae.set(y,R,D,U),We.viewport(F.copy(ae).multiplyScalar(Q).round())},this.getScissor=function(y){return y.copy(_e)},this.setScissor=function(y,R,D,U){y.isVector4?_e.set(y.x,y.y,y.z,y.w):_e.set(y,R,D,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,D=!0){let U=0;if(y){let P=!1;if(T!==null){const z=T.texture.format;P=z===eu||z===$h||z===Zh}if(P){const z=T.texture.type,j=z===cn||z===sr||z===eo||z===to||z===Yh||z===Jh,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),D&&(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",Ie,!1),t.removeEventListener("webglcontextcreationerror",Se,!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",Nh),re.removeEventListener("sessionend",Lh),_s.stop()};function de(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function Ie(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const y=Nt.autoReset,R=Ne.enabled,D=Ne.autoUpdate,U=Ne.needsUpdate,P=Ne.type;ne(),Nt.autoReset=y,Ne.enabled=R,Ne.autoUpdate=D,Ne.needsUpdate=U,Ne.type=P}function Se(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),Gt(R)}function Gt(y){vn(y),ze.remove(y)}function vn(y){const R=ze.get(y).programs;R!==void 0&&(R.forEach(function(D){Qe.releaseProgram(D)}),y.isShaderMaterial&&Qe.releaseShaderCache(y))}this.renderBufferDirect=function(y,R,D,U,P,z){R===null&&(R=Mt);const j=P.isMesh&&P.matrixWorld.determinant()<0,X=Lp(y,R,D,U,P);We.setMaterial(U,j);let ie=D.index,he=1;if(U.wireframe===!0){if(ie=Ae.getWireframeAttribute(D),ie===void 0)return;he=2}const ce=D.drawRange,fe=D.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,D,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)Oc("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,St=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]/St,rt[vt])}else if(P.isInstancedMesh)Ve.renderInstances(ge,Pe,P.count);else if(D.isInstancedBufferGeometry){const Le=D._maxInstanceCount!==void 0?D._maxInstanceCount:1/0,rt=Math.min(D.instanceCount,Le);Ve.renderInstances(ge,Pe,rt)}else Ve.render(ge,Pe)};function Ct(y,R,D){y.transparent===!0&&y.side===Li&&y.forceSinglePass===!1?(y.side=Nn,y.needsUpdate=!0,Za(y,R,D),y.side=Ki,y.needsUpdate=!0,Za(y,R,D),y.side=Li):Za(y,R,D)}this.compile=function(y,R,D=null){D===null&&(D=y),A=Ze.get(D),A.init(R),x.push(A),D.traverseVisible(function(P){P.isLight&&P.layers.test(R.layers)&&(A.pushLight(P),P.castShadow&&A.pushShadow(P))}),y!==D&&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,D,P),U.add(X)}else Ct(z,D,P),U.add(z)}),A=x.pop(),U},this.compileAsync=function(y,R,D=null){const U=this.compile(y,R,D);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 Ni(y){ii&&ii(y)}function Nh(){_s.stop()}function Lh(){_s.start()}const _s=new xg;_s.setAnimationLoop(Ni),typeof self<"u"&&_s.setContext(self),this.setAnimationLoop=function(y){ii=y,re.setAnimationLoop(y),y===null?_s.stop():_s.start()},re.addEventListener("sessionstart",Nh),re.addEventListener("sessionend",Lh),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(I===!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&&mc(z,R,-1/0,E.sortObjects)}mc(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 D=A.state.shadowsArray;Ne.render(D,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];Ph(U,P,y,ie)}ft&&Oe.render(y);for(let j=0,X=z.length;j<X;j++){const ie=z[j];xc(g,y,ie,ie.viewport)}}else P.length>0&&Ph(U,P,y,R),ft&&Oe.render(y),xc(g,y,R);T!==null&&S===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 mc(y,R,D,U){if(y.visible===!1)return;if(y.layers.test(R.layers)){if(y.isGroup)D=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,D,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,D,He.z,fe)}}else X.visible&&g.push(y,j,X,D,He.z,null)}}const z=y.children;for(let j=0,X=z.length;j<X;j++)mc(z[j],R,D,U)}function xc(y,R,D,U){const P=y.opaque,z=y.transmissive,j=y.transparent;A.setupLightsView(D),me===!0&&Ee.setGlobalState(E.clippingPlanes,D),U&&We.viewport(F.copy(U)),P.length>0&&Ja(P,R,D),z.length>0&&Ja(z,R,D),j.length>0&&Ja(j,R,D),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1)}function Ph(y,R,D,U){if((D.isScene===!0?D.overrideMaterial:null)!==null)return;A.state.transmissionRenderTarget[U.id]===void 0&&(A.state.transmissionRenderTarget[U.id]=new ar(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($),N=E.getClearAlpha(),N<1&&E.setClearColor(16777215,.5),E.clear(),ft&&Oe.render(D);const ie=E.toneMapping;E.toneMapping=Cs;const he=U.viewport;if(U.viewport!==void 0&&(U.viewport=void 0),A.setupLightsView(U),me===!0&&Ee.setGlobalState(E.clippingPlanes,U),Ja(y,D,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=Nn,Ve.needsUpdate=!0,kh(Pe,D,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($,N),he!==void 0&&(U.viewport=he),E.toneMapping=ie}function Ja(y,R,D){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(D.layers)&&kh(X,R,D,ie,ce,he)}}function kh(y,R,D,U,P,z){y.onBeforeRender(E,R,D,U,P,z),y.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),P.onBeforeRender(E,R,D,U,y,z),P.transparent===!0&&P.side===Li&&P.forceSinglePass===!1?(P.side=Nn,P.needsUpdate=!0,E.renderBufferDirect(D,R,U,P,y,z),P.side=Ki,P.needsUpdate=!0,E.renderBufferDirect(D,R,U,P,y,z),P.side=Li):E.renderBufferDirect(D,R,U,P,y,z),y.onAfterRender(E,R,D,U,P,z)}function Za(y,R,D){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,D),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 Ec(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),Ec(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 bc(y){if(y.uniformsList===null){const R=y.currentProgram.getUniforms();y.uniformsList=Ml.seqWithValue(R.seq,y.uniforms)}return y.uniformsList}function Ec(y,R){const D=ze.get(y);D.outputColorSpace=R.outputColorSpace,D.batching=R.batching,D.batchingColor=R.batchingColor,D.instancing=R.instancing,D.instancingColor=R.instancingColor,D.instancingMorph=R.instancingMorph,D.skinning=R.skinning,D.morphTargets=R.morphTargets,D.morphNormals=R.morphNormals,D.morphColors=R.morphColors,D.morphTargetsCount=R.morphTargetsCount,D.numClippingPlanes=R.numClippingPlanes,D.numIntersection=R.numClipIntersection,D.vertexAlphas=R.vertexAlphas,D.vertexTangents=R.vertexTangents,D.toneMapping=R.toneMapping}function Lp(y,R,D,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&&!!D.attributes.color&&D.attributes.color.itemSize===4,ce=!!D.attributes.tangent&&(!!U.normalMap||U.anisotropy>0),fe=!!D.morphAttributes.position,ge=!!D.morphAttributes.normal,ye=!!D.morphAttributes.color;let Pe=Cs;U.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(Pe=E.toneMapping);const je=D.morphAttributes.position||D.morphAttributes.normal||D.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 St=Le.currentProgram;ke===!0&&(St=Za(U,R,P));let mn=!1,vt=!1,Et=!1;const Xe=St.getUniforms(),Xt=Le.uniforms;if(We.useProgram(St.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),i_(be),s_(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=D.morphAttributes;if((Cn.position!==void 0||Cn.normal!==void 0||Cn.color!==void 0)&&Ge.update(P,D,St),(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&&ws(Xt,Et),z&&U.fog===!0&&ve.refreshFogUniforms(Xt,z),ve.refreshMaterialUniforms(Xt,U,Q,Y,A.state.transmissionRenderTarget[y.id]),Ml.upload(H,bc(Le),Xt,L)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(Ml.upload(H,bc(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,Pp=Ut.length;xn<Pp;xn++){const Hr=Ut[xn];W.update(Hr,St),W.bind(Hr,St)}}return St}function ws(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 S},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(y,R,D){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:D,U.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(y,R){const D=ze.get(y);D.__webglFramebuffer=R,D.__useDefaultFramebuffer=R===void 0};const b=H.createFramebuffer();this.setRenderTarget=function(y,R=0,D=0){T=y,w=R,S=D;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][D]:P=ce[R],z=!0):y.samples>0&&L.useMultisampledRTT(y)===!1?P=ze.get(y).__webglMultisampledFramebuffer:Array.isArray(ce)?P=ce[D]: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(D!==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,D)}else if(j){const ie=ze.get(y.texture),he=R;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,ie.__webglTexture,D,he)}else if(y!==null&&D!==0){const ie=ze.get(y.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,ie.__webglTexture,D)}C=-1},this.readRenderTargetPixels=function(y,R,D,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&&D>=0&&D<=y.height-P&&H.readPixels(R,D,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,D,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&&D>=0&&D<=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,D,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 n_(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,D=0){const U=Math.pow(2,-D),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,D,0,0,j,X,P,z),We.unbindTexture()};const B=H.createFramebuffer(),k=H.createFramebuffer();this.copyTextureToTexture=function(y,R,D=null,U=null,P=0,z=null){z===null&&(P!==0?(Oc("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(D!==null)j=D.max.x-D.min.x,X=D.max.y-D.min.y,ie=D.isBox3?D.max.z-D.min.z:1,he=D.min.x,ce=D.min.y,fe=D.isBox3?D.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),St=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),Pp=ze.get(Ut.__renderTarget);We.bindFramebuffer(H.READ_FRAMEBUFFER,xn.__webglFramebuffer),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,Pp.__webglFramebuffer);for(let Hr=0;Hr<ie;Hr++)Xe&&(H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,ze.get(y).__webglTexture,P,fe+Hr),H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,ze.get(R).__webglTexture,z,Pe+Hr)),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,St),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,D=null,U=null,P=0){return Oc('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(y,R,D,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,S=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 Fo=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 Fo.Panel("FPS","#0ff","#002")),c=t(new Fo.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new Fo.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}};Fo.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 Kg(i,e){if(e===My)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===yu||e===eA){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===yu)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 _d extends oi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new KI(t)}),this.register(function(t){return new jI(t)}),this.register(function(t){return new i1(t)}),this.register(function(t){return new s1(t)}),this.register(function(t){return new r1(t)}),this.register(function(t){return new YI(t)}),this.register(function(t){return new JI(t)}),this.register(function(t){return new ZI(t)}),this.register(function(t){return new $I(t)}),this.register(function(t){return new qI(t)}),this.register(function(t){return new e1(t)}),this.register(function(t){return new XI(t)}),this.register(function(t){return new n1(t)}),this.register(function(t){return new t1(t)}),this.register(function(t){return new VI(t)}),this.register(function(t){return new a1(t)}),this.register(function(t){return new o1(t)})}load(e,t,n,s){const r=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=pr.extractUrlBase(e);a=pr.resolveURL(l,this.path)}else a=pr.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))===jg){try{a[At.KHR_BINARY_GLTF]=new c1(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 y1(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 WI;break;case At.KHR_DRACO_MESH_COMPRESSION:a[u]=new l1(r,this.dracoLoader);break;case At.KHR_TEXTURE_TRANSFORM:a[u]=new h1;break;case At.KHR_MESH_QUANTIZATION:a[u]=new u1;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 zI(){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 VI{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 ld(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new wl(h),l.distance=u;break;case"spot":l=new hg(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 WI{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 qI{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 KI{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 jI{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 XI{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 YI{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 JI{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 ZI{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 $I{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 e1{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 t1{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 n1{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 i1{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 s1{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 r1{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 a1{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 o1{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 GA(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 I=c[E];x.instanceColor=new Yu(I.array,I.itemSize,I.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 jg="glTF",Do=12,Xg={JSON:1313821514,BIN:5130562};class c1{constructor(e){this.name=At.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Do),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!==jg)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-Do,r=new DataView(e,Do);let a=0;for(;a<s;){const o=r.getUint32(a,!0);a+=4;const c=r.getUint32(a,!0);if(a+=4,c===Xg.JSON){const l=new Uint8Array(e,Do+a,o);this.content=n.decode(l)}else if(c===Xg.BIN){const l=Do+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class l1{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=vd[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=vd[h]||h.toLowerCase();if(a[h]!==void 0){const d=n.accessors[e.attributes[h]],f=ya[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 h1{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 u1{constructor(){this.name=At.KHR_MESH_QUANTIZATION}}class Yg extends Mo{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 I=a[m+E+o],w=a[m+E+c]*h,S=a[p+E+o],T=a[p+E]*h;r[E]=_*I+x*w+g*S+A*T}return r}}const d1=new Yt;class f1 extends Yg{interpolate_(e,t,n,s){const r=super.interpolate_(e,t,n,s);return d1.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},ya={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Jg={9728:Ln,9729:qt,9984:Wp,9985:Sc,9986:$a,9987:si},Zg={33071:Jn,33648:Cc,10497:Ss},wd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},vd={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"},Os={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},p1={CUBICSPLINE:void 0,LINEAR:ho,STEP:lo},Cd={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function A1(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new Io({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ki})),i.DefaultMaterial}function br(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 g1(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 m1(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 x1(i){let e;const t=i.extensions&&i.extensions[At.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Sd(t.attributes):e=i.indices+":"+Sd(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,s=i.targets.length;n<s;n++)e+=":"+Sd(i.targets[n]);return e}function Sd(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 Id(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 b1(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 E1=new Re;class y1{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new zI,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 og(this.options.manager):this.textureLoader=new vw(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 br(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(pr.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=wd[s.type],o=ya[s.componentType],c=s.normalized===!0,l=new o(s.count*a);return Promise.resolve(new In(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=wd[s.type],l=ya[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 R_(m,f/h),t.cache.add(_,x)),g=new Ku(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 In(m,c,p);if(s.sparse!==void 0){const A=wd.SCALAR,_=ya[s.sparse.indices.componentType],x=s.sparse.indices.byteOffset||0,E=s.sparse.values.byteOffset||0,I=new _(a[1],x,s.sparse.count*A),w=new l(a[2],E,s.sparse.count*c);o!==null&&(g=new In(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let S=0,T=I.length;S<T;S++){const C=I[S];if(g.setX(C,w[S*c]),c>=2&&g.setY(C,w[S*c+1]),c>=3&&g.setZ(C,w[S*c+2]),c>=4&&g.setW(C,w[S*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=Jg[d.magFilter]||qt,h.minFilter=Jg[d.minFilter]||si,h.wrapS=Zg[d.wrapS]||Ss,h.wrapT=Zg[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(pr.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||b1(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 ed,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 pa,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 Io}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||Cd.OPAQUE;if(h===Cd.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Cd.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&&br(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 $g(c,o,t)})}const a=[];for(let o=0,c=e.length;o<c;o++){const l=e[o],h=x1(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=$g(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?A1(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 kA(m,_):new Zt(m,_),A.isSkinnedMesh===!0&&A.normalizeSkinWeights(),g.mode===ci.TRIANGLE_STRIP?A.geometry=Kg(A.geometry,eA):g.mode===ci.TRIANGLE_FAN&&(A.geometry=Kg(A.geometry,yu));else if(g.mode===ci.LINES)A=new fl(m,_);else if(g.mode===ci.LINE_STRIP)A=new ul(m,_);else if(g.mode===ci.LINE_LOOP)A=new k_(m,_);else if(g.mode===ci.POINTS)A=new U_(m,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(A.geometry.morphAttributes).length>0&&m1(A,r),A.name=t.createUniqueName(r.name||"mesh_"+e),os(A,r),g.extensions&&br(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&&br(s,u[0],r),u[0];const d=new is;r.extensions&&br(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(Sn.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new cd(-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 rl(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[_],I=f[_],w=p[_],S=m[_],T=g[_];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();const C=n._createAnimationTracks(E,I,w,S,T);if(C)for(let v=0;v<C.length;v++)A.push(C[v])}return new _l(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,E1)});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 il: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&&br(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&&br(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=[];Os[r.path]===Os.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(Os[r.path]){case Os.weights:l=dr;break;case Os.rotation:l=ks;break;case Os.translation:case Os.scale:l=fr;break;default:n.itemSize===1?l=dr:l=fr;break}const h=s.interpolation!==void 0?p1[s.interpolation]:ho,u=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d<f;d++){const p=new l(c[d]+"."+Os[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=Id(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 ks?f1:Yg;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function _1(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=Id(ya[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=Id(ya[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 $g(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=vd[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),_1(i,e,t),Promise.all(s).then(function(){return e.targets!==void 0?g1(i,e.targets,t):i})}var w1=(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;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoax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cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9: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 I=0,x=0;x<A.length;++x)_[I++]=_[x]<60?n[_[x]]:(_[x]-60)*64+_[++x];return _.buffer.slice(0,I)}function c(A,_,x,E,I,w){var S=r.exports.sbrk,T=x+3&-4,C=S(T*E),v=S(I.length),F=new Uint8Array(r.exports.memory.buffer);F.set(I,v);var K=A(C,x,E,v,I.length);if(K==0&&w&&w(C,T,E),_.set(F.subarray(C,C+x*E)),S(C-S(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),I=0;I<A;++I)u[I]=f(E);URL.revokeObjectURL(E)}function m(A,_,x,E,I){for(var w=u[0],S=1;S<u.length;++S)u[S].pending<w.pending&&(w=u[S]);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:I},[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,I){c(r.exports.meshopt_decodeVertexBuffer,A,_,x,E,r.exports[l[I]])},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,I,w){c(r.exports[h[I]],A,_,x,E,r.exports[l[w]])},decodeGltfBufferAsync:function(A,_,x,E,I){return u.length>0?m(A,_,x,h[E],l[I]):a.then(function(){var w=new Uint8Array(A*_);return c(r.exports[h[E]],w,A,_,x,r.exports[l[I]]),w})}}})();const em={type:"change"},Md={type:"start"},tm={type:"end"},Tl=new mo,nm=new Ps,v1=Math.cos(70*Sn.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},Bd=1e-6;class C1 extends Qw{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:zr.ROTATE,MIDDLE:zr.DOLLY,RIGHT:zr.PAN},this.touches={ONE:Vr.ROTATE,TWO:Vr.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 pg,this._sphericalDelta=new pg,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=I1.bind(this),this._onPointerDown=S1.bind(this),this._onPointerUp=M1.bind(this),this._onContextMenu=L1.bind(this),this._onMouseWheel=R1.bind(this),this._onKeyDown=F1.bind(this),this._onTouchStart=D1.bind(this),this._onTouchMove=N1.bind(this),this._onMouseDown=B1.bind(this),this._onMouseMove=T1.bind(this),this._interceptControlDown=P1.bind(this),this._interceptControlUp=k1.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(em),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):(Tl.origin.copy(this.object.position),Tl.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Tl.direction))<v1?this.object.lookAt(this.target):(nm.setFromNormalAndCoplanarPoint(this.object.up,this.target),Tl.intersectPlane(nm,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)>Bd||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Bd||this._lastTargetPosition.distanceToSquared(this.target)>Bd?(this.dispatchEvent(em),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 S1(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 I1(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function M1(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(tm),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 B1(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 zr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Ft.DOLLY;break;case zr.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 zr.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(Md)}function T1(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 R1(i){this.enabled===!1||this.enableZoom===!1||this.state!==Ft.NONE||(i.preventDefault(),this.dispatchEvent(Md),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(tm))}function F1(i){this.enabled!==!1&&this._handleKeyDown(i)}function D1(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Vr.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Ft.TOUCH_ROTATE;break;case Vr.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 Vr.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Ft.TOUCH_DOLLY_PAN;break;case Vr.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(Md)}function N1(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 L1(i){this.enabled!==!1&&i.preventDefault()}function P1(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function k1(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class U1 extends qu{constructor(){super();const e=new la;e.deleteAttribute("uv");const t=new Io({side:Nn}),n=new Io,s=new wl(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 GA(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,_a(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,_a(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,_a(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,_a(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,_a(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,_a(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 _a(i){const e=new Ds;return e.color.setScalar(i),e}function O1(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 wa(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 im=Array.prototype.forEach,No=Array.prototype.slice,ue={BREAK:{},extend:function(e){return this.each(No.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(No.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=No.call(arguments);return function(){for(var t=No.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(im&&e.forEach&&e.forEach===im)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():No.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}},Q1=[{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:wa},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:wa},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:wa},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:wa}}},{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}}}}}],Lo=void 0,Rl=void 0,Td=function(){Rl=!1;var e=arguments.length>1?ue.toArray(arguments):arguments[0];return ue.each(Q1,function(t){if(t.litmus(e))return ue.each(t.conversions,function(n,s){if(Lo=n.read(e),Rl===!1&&Lo!==!1)return Rl=Lo,Lo.conversionName=s,Lo.conversion=n,ue.BREAK}),ue.BREAK}),Rl},sm=void 0,Fl={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<<(sm=t*8)|e&~(255<<sm)}},G1=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}})(),Qs=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)}},Gs=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)},Hs=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=Td.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 wa(this)}},{key:"toHexString",value:function(){return wa(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),i})();function Rd(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 Fd(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]=Fl.component_from_hex(i.__state.hex,t);else if(i.__state.space==="HSV")ue.extend(i.__state,Fl.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=Fl.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"],Rd(En.prototype,"r",2),Rd(En.prototype,"g",1),Rd(En.prototype,"b",0),Fd(En.prototype,"h"),Fd(En.prototype,"s"),Fd(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=Fl.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 Er=(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})(),H1={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},rm={};ue.each(H1,function(i,e){ue.each(i,function(t){rm[t]=e})});var z1=/(\d+(\.\d+)?)px/;function Qi(i){if(i==="0"||ue.isUndefined(i))return 0;var e=i.match(z1);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=rm[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)}},am=(function(i){Gs(e,i);function e(t,n){vi(this,e);var s=Hs(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=Qs(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),Qs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(Er),V1=(function(i){Gs(e,i);function e(t,n,s){vi(this,e);var r=Hs(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=Qs(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(),Qs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e})(Er),W1=(function(i){Gs(e,i);function e(t,n){vi(this,e);var s=Hs(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()),Qs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(Er);function om(i){var e=i.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var cm=(function(i){Gs(e,i);function e(t,n,s){vi(this,e);var r=Hs(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=om(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),Qs(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=om(n),this}}]),e})(Er);function q1(i,e){var t=Math.pow(10,e);return Math.round(i*t)/t}var Dl=(function(i){Gs(e,i);function e(t,n,s){vi(this,e);var r=Hs(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():q1(this.getValue(),this.__precision),Qs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(cm);function lm(i,e,t,n,s){return n+(s-n)*((i-e)/(t-e))}var Dd=(function(i){Gs(e,i);function e(t,n,s,r,a){vi(this,e);var o=Hs(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(lm(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(lm(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+"%",Qs(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(cm),hm=(function(i){Gs(e,i);function e(t,n,s){vi(this,e);var r=Hs(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})(Er),Nd=(function(i){Gs(e,i);function e(t,n){vi(this,e);var s=Hs(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"}),um(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"}),j1(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=Td(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),I=1-(x-g.top)/(g.bottom-g.top);return I>1?I=1:I<0&&(I=0),E>1?E=1:E<0&&(E=0),r.__color.v=I,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=Td(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,um(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})(Er),K1=["-moz-","-o-","-webkit-","-ms-",""];function um(i,e,t,n){i.style.background="",ue.each(K1,function(s){i.style.cssText+="background: "+s+"linear-gradient("+e+", "+t+" 0%, "+n+" 100%); "})}function j1(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 X1={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{}}},Y1=`<div id="dg-save" class="dg dialogue">+}`;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">Here's the new load parameter for your <code>GUI</code>'s constructor:@@ -3836,18 +3836,18 @@ void main() {</div>-</div>`,J1=function(e,t){var n=e[t];return ue.isArray(arguments[2])||ue.isObject(arguments[2])?new V1(e,t,arguments[2]):ue.isNumber(n)?ue.isNumber(arguments[2])&&ue.isNumber(arguments[3])?ue.isNumber(arguments[4])?new Dd(e,t,arguments[2],arguments[3],arguments[4]):new Dd(e,t,arguments[2],arguments[3]):ue.isNumber(arguments[4])?new Dl(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Dl(e,t,{min:arguments[2],max:arguments[3]}):ue.isString(n)?new W1(e,t):ue.isFunction(n)?new hm(e,t,""):ue.isBoolean(n)?new am(e,t):null};function Z1(i){setTimeout(i,1e3/60)}var $1=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||Z1,eM=(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})(),tM=O1(`.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}-`);X1.inject(tM);var dm="dg",fm=72,pm=20,Po="Default",ko=(function(){try{return!!window.localStorage}catch{return!1}})(),Uo=void 0,Am=!0,va=void 0,Ld=!1,gm=[],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,dm),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:Po}:n.preset&&(n.load.preset=n.preset),ue.isUndefined(n.parent)&&n.hideable&&gm.push(this),n.resizable=ue.isUndefined(n.parent)&&n.resizable,n.autoPlace&&ue.isUndefined(n.scrollable)&&(n.scrollable=!0);var s=ko&&localStorage.getItem(Ca(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,rM(this),t.revert()}},width:{get:function(){return n.width},set:function(d){n.width=d,Od(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){ko&&(s=d,d?te.bind(window,"unload",r):te.unbind(window,"unload",r),localStorage.setItem(Ca(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),ko&&s){t.useLocalStorage=!0;var o=localStorage.getItem(Ca(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=Pd(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)&&(Am&&(va=document.createElement("div"),te.addClass(va,dm),te.addClass(va,i.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(va),Am=!1),va.appendChild(this.domElement),te.addClass(this.domElement,i.CLASS_AUTO_PLACE)),this.parent||Od(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&&sM(this),r=function(){ko&&localStorage.getItem(Ca(t,"isLocal"))==="true"&&localStorage.setItem(Ca(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(){Ld=!Ld,ue.each(gm,function(i){i.domElement.style.display=Ld?"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===fm||i.keyCode===fm)&&Lt.toggleHide()},te.bind(window,"keydown",Lt._keydownHandler,!1),ue.extend(Lt.prototype,{add:function(e,t){return Oo(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return Oo(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&&va.removeChild(this.domElement);var e=this;ue.each(this.__folders,function(t){e.removeFolder(t)}),te.unbind(window,"keydown",Lt._keydownHandler,!1),mm(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=Pd(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],mm(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-pm<n?(te.addClass(e.domElement,Lt.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-pm+"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(Uo)&&(Uo=new eM,Uo.domElement.innerHTML=Y1),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&&iM(e),e.__rememberedObjects.indexOf(t)===-1&&e.__rememberedObjects.push(t)}),this.autoPlace&&Od(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]=Nl(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]=Nl(this),kd(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Po]=Nl(this,!0)),this.load.remembered[e]=Nl(this),this.preset=e,Ud(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){ue.each(this.__controllers,function(t){this.getRoot().load.remembered?xm(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||kd(this.getRoot(),!1)},listen:function(e){var t=this.__listening.length===0;this.__listening.push(e),t&&Em(this.__listening)},updateDisplay:function(){ue.each(this.__controllers,function(e){e.updateDisplay()}),ue.each(this.__folders,function(e){e.updateDisplay()})}});function Pd(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 mm(i){te.unbind(window,"resize",i.__resizeHandler),i.saveToLocalStorageIfPossible&&te.unbind(window,"unload",i.saveToLocalStorageIfPossible)}function kd(i,e){var t=i.__preset_select[i.__preset_select.selectedIndex];e?t.innerHTML=t.value+"*":t.innerHTML=t.value}function nM(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(),Oo(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(),Oo(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 Dd){var n=new Dl(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 Dl){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=Oo(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 am?(te.bind(e,"click",function(){te.fakeEvent(t.__checkbox,"click")}),te.bind(t.__checkbox,"click",function(r){r.stopPropagation()})):t instanceof hm?(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 Nd&&(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()&&kd(i.getRoot(),!0),r},t.setValue)}function xm(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[Po])a=r[Po];else return;if(a[n]&&a[n][e.property]!==void 0){var o=a[n][e.property];e.initialValue=o,e.setValue(o)}}}}function Oo(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 Nd(e,t);else{var r=[e,t].concat(n.factoryArgs);s=J1.apply(i,r)}n.before instanceof Er&&(n.before=n.before.__li),xm(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=Pd(i,o,n.before);return te.addClass(c,Lt.CLASS_CONTROLLER_ROW),s instanceof Nd?te.addClass(c,"color"):te.addClass(c,G1(s.getValue())),nM(i,c,s),i.__controllers.push(s),s}function Ca(i,e){return document.location.href+"."+e}function Ud(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 bm(i,e){e.style.display=i.useLocalStorage?"block":"none"}function iM(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=" ",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){Ud(i,d,d===i.preset)}):Ud(i,Po,!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),ko){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(Ca(i,"isLocal"))==="true"&&c.setAttribute("checked","checked"),bm(i,o),te.bind(c,"change",function(){i.useLocalStorage=!i.useLocalStorage,bm(i,o)})}var h=document.getElementById("dg-new-constructor");te.bind(h,"keydown",function(u){u.metaKey&&(u.which===67||u.keyCode===67)&&Uo.hide()}),te.bind(t,"click",function(){h.innerHTML=JSON.stringify(i.getSaveObject(),void 0,2),Uo.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 sM(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 Od(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 Nl(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 rM(i){for(var e=0;e<i.__preset_select.length;e++)i.__preset_select[e].value===i.preset&&(i.__preset_select.selectedIndex=e)}function Em(i){i.length!==0&&$1.call(window,function(){Em(i)}),ue.each(i,function(e){e.updateDisplay()})}var aM=Lt;const Ll=[{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"}],oM=["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"],ym=[[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 cM(i){if(i<=255)return oM[i];let e=0,t=ym.length-1;for(;e<=t;){const n=e+t>>1,s=ym[n];if(i<s[0]){t=n-1;continue}if(i>s[1]){e=n+1;continue}return s[2]}return"L"}function lM(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=cM(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 hM(i,e){const t=lM(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 uM=/[ \t\n\r\f]+/g,dM=/[\t\n\r\f]| {2,}|^ | $/;function fM(i){const e=i??"normal";return e==="pre-wrap"?{mode:e,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:e,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function pM(i){if(!dM.test(i))return i;let e=i.replace(uM," ");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 AM(i){return/[\r\f]/.test(i)?i.replace(/\r\n/g,`+</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=" ",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,``).replace(/[\r\f]/g,``):i.replace(/\r\n/g,`-`)}let Qd=null,gM;function mM(){return Qd===null&&(Qd=new Intl.Segmenter(gM,{granularity:"word"})),Qd}const xM=new RegExp("\\p{Script=Arabic}","u"),Pl=new RegExp("\\p{M}","u"),_m=new RegExp("\\p{Nd}","u");function wm(i){return xM.test(i)}function vm(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 yr(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(vm(s))return!0;e++;continue}}if(vm(t))return!0}}return!1}function bM(i){const e=Ul(i);return e!==null&&(Gd.has(e)||_r.has(e))}const EM=new Set([" "," ","","\uFEFF"]);function yM(i){return yr(i)}function _M(i){const e=Ul(i);return e!==null&&EM.has(e)}function wM(i){return!bM(i)&&!_M(i)}const Gd=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),kl=new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),Hd=new Set(["'","’"]),_r=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),vM=new Set([":",".","،","؛"]),CM=new Set(["၏"]),SM=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function IM(i){if(zd(i))return!0;let e=!1;for(const t of i){if(_r.has(t)){e=!0;continue}if(!(e&&Pl.test(t)))return!1}return e}function MM(i){for(const e of i)if(!Gd.has(e)&&!_r.has(e))return!1;return i.length>0}function BM(i){if(zd(i))return!0;for(const e of i)if(!kl.has(e)&&!Hd.has(e)&&!Pl.test(e))return!1;return i.length>0}function zd(i){let e=!1;for(const t of i)if(!(t==="\\"||Pl.test(t))){if(kl.has(t)||_r.has(t)||Hd.has(t)){e=!0;continue}return!1}return e}function Cm(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 Ul(i){if(i.length===0)return null;const e=Cm(i,i.length);return i.slice(e)}function TM(i){const e=Array.from(i);let t=e.length;for(;t>0;){const n=e[t-1];if(Pl.test(n)){t--;continue}if(kl.has(n)||Hd.has(n)){t--;continue}break}return t<=0||t===e.length?null:{head:e.slice(0,t).join(""),tail:e.slice(t).join("")}}function RM(i,e,t){return t==="text"&&!e&&i.length===1&&i!=="-"&&i!=="—"?i:null}function Sm(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 Im(i,e){return i&&e!==null&&vM.has(e)}function FM(i){const e=Ul(i);return e!==null&&CM.has(e)}function DM(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 Vd(i){let e=i.length;for(;e>0;){const t=Cm(i,e),n=i.slice(t,e);if(SM.has(n))return!0;if(!_r.has(n))return!1;e=t}return!1}function NM(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 LM=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function li(i){return i.length===1?i[0]:i.join("")}function PM(i,e){const t=[];for(let n=i.length-1;n>=0;n--)t.push(i[n]);return t.push(e),li(t)}function kM(i,e,t,n){if(!LM.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=NM(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 Wd(i){return i==="space"||i==="preserved-space"||i==="zero-width-break"||i==="hard-break"}const UM=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function OM(i,e){const t=i.texts[e];return t.startsWith("www.")?!0:UM.test(t)&&e+1<i.len&&i.kinds[e+1]==="text"&&i.texts[e+1]==="//"}function QM(i){return i.includes("?")&&(i.includes("://")||i.startsWith("www."))}function GM(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"||!OM(i,a))continue;const o=[e[a]];let c=a+1;for(;c<i.len&&!Wd(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 HM(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]),!QM(a))continue;const o=r+1;if(o>=i.len||Wd(i.kinds[o]))continue;const c=[],l=i.starts[o];let h=o;for(;h<i.len&&!Wd(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 zM=new Set([":","-","/","×",",",".","+","–","—"]),Mm=/^[A-Za-z0-9_]+[,:;]*$/,Bm=/[,:;]+$/;function Tm(i){for(const e of i)if(_m.test(e))return!0;return!1}function Ol(i){if(i.length===0)return!1;for(const e of i)if(!(_m.test(e)||zM.has(e)))return!1;return!0}function VM(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"&&Ol(a)&&Tm(a)){const c=[a];let l=r+1;for(;l<i.len&&i.kinds[l]==="text"&&Ol(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 WM(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&&Mm.test(a)){const l=[a];let h=Bm.test(a),u=r+1;for(;h&&u<i.len&&i.kinds[u]==="text"&&i.isWordLike[u]&&Mm.test(i.texts[u]);){const d=i.texts[u];l.push(d),h=Bm.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 qM(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||!Tm(h)||!Ol(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 KM(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 jM(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"||!yr(e[r])||!yr(e[r+1]))continue;const a=TM(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 Rm(i,e,t){const n=mM();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 S of kM(w.segment,w.isWordLike??!1,w.index,t)){let O=function(){h[N]!==null&&(a[N]=[Sm(r,h,u,N)],h[N]=null),a[N].push(S.text),o[N]=o[N]||S.isWordLike,d[N]=d[N]||v,f[N]=f[N]||F,p[N]=q,m[N]=$,g[N]=Im(f[N],K)};const T=S.kind==="text",C=RM(S.text,S.isWordLike,S.kind),v=yr(S.text),F=wm(S.text),K=Ul(S.text),q=Vd(S.text),$=FM(S.text),N=s-1;e.carryCJKAfterClosingQuote&&T&&s>0&&c[N]==="text"&&v&&d[N]&&p[N]||T&&s>0&&c[N]==="text"&&MM(S.text)&&d[N]||T&&s>0&&c[N]==="text"&&m[N]?O():T&&s>0&&c[N]==="text"&&S.isWordLike&&F&&g[N]?(O(),o[N]=!0):C!==null&&s>0&&c[N]==="text"&&h[N]===C?u[N]=(u[N]??1)+1:T&&!S.isWordLike&&s>0&&c[N]==="text"&&(IM(S.text)||S.text==="-"&&o[N])?O():(r[s]=S.text,a[s]=[S.text],o[s]=S.isWordLike,c[s]=S.kind,l[s]=S.start,h[s]=C,u[s]=C===null?0:1,d[s]=v,f[s]=F,p[s]=q,m[s]=$,g[s]=Im(F,K),s++)}for(let w=0;w<s;w++){if(h[w]!==null){r[w]=Sm(r,h,u,w);continue}r[w]=li(a[w])}for(let w=1;w<s;w++)c[w]==="text"&&!o[w]&&zd(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 S=r[w];if(S.length!==0){if(c[w]==="text"&&!o[w]&&BM(S)&&_>=0&&c[_]==="text"){const T=A[_]??[];T.push(S),A[_]=T,l[_]=l[w],r[w]="";continue}_=w}}for(let w=0;w<s;w++){const S=A[w];S!=null&&(r[w]=PM(S,r[w]))}let x=0;for(let w=0;w<s;w++){const S=r[w];S.length!==0&&(x!==w&&(r[x]=S,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=KM({len:x,texts:r,isWordLike:o,kinds:c,starts:l}),I=jM(WM(qM(VM(HM(GM(E))))));for(let w=0;w<I.len-1;w++){const S=DM(I.texts[w]);S!==null&&(I.kinds[w]!=="space"&&I.kinds[w]!=="preserved-space"||I.kinds[w+1]!=="text"||!wm(I.texts[w+1])||(I.texts[w]=S.space,I.isWordLike[w]=!1,I.kinds[w]=I.kinds[w]==="preserved-space"?"preserved-space":"space",I.texts[w+1]=S.marks+I.texts[w+1],I.starts[w+1]=I.starts[w]+S.space.length))}return I}function XM(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 YM(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=yM(d),A=wM(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 JM(i,e,t="normal",n="normal"){const s=fM(t),r=s.mode==="pre-wrap"?AM(i):pM(i);if(r.length===0)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const a=n==="keep-all"?YM(Rm(r,e,s)):Rm(r,e,s);return{normalized:r,chunks:XM(a,s),...a}}let Sa=null;const Fm=new Map;let Ia=null;const ZM=96,$M=new RegExp("\\p{Emoji_Presentation}","u"),eB=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let qd=null;const Dm=new Map;function Kd(){if(Sa!==null)return Sa;if(typeof OffscreenCanvas<"u")return Sa=new OffscreenCanvas(1,1).getContext("2d"),Sa;if(typeof document<"u")return Sa=document.createElement("canvas").getContext("2d"),Sa;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function tB(i){let e=Fm.get(i);return e||(e=new Map,Fm.set(i,e)),e}function zs(i,e){let t=e.get(i);return t===void 0&&(t={width:Kd().measureText(i).width,containsCJK:yr(i)},e.set(i,t)),t}function Ma(){if(Ia!==null)return Ia;if(typeof navigator>"u")return Ia={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ia;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 Ia={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},Ia}function nB(i){const e=i.match(/(\d+(?:\.\d+)?)\s*px/);return e?parseFloat(e[1]):16}function Nm(){return qd===null&&(qd=new Intl.Segmenter(void 0,{granularity:"grapheme"})),qd}function iB(i){return $M.test(i)||i.includes("️")}function sB(i){return eB.test(i)}function rB(i,e){let t=Dm.get(i);if(t!==void 0)return t;const n=Kd();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 Dm.set(i,t),t}function aB(i){let e=0;const t=Nm();for(const n of t.segment(i))iB(n.segment)&&e++;return e}function oB(i,e){return e.emojiCount===void 0&&(e.emojiCount=aB(i)),e.emojiCount}function wr(i,e,t){return t===0?e.width:e.width-oB(i,e)*t}function cB(i,e,t,n,s){if(e.breakableFitAdvances!==void 0)return e.breakableFitAdvances;const r=Nm(),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=zs(u,t);h.push(wr(u,d,n))}return e.breakableFitAdvances=h,e.breakableFitAdvances}if(s==="pair-context"||a.length>ZM){const h=[];let u=null,d=0;for(const f of a){const p=zs(f,t),m=wr(f,p,n);if(u===null)h.push(m);else{const g=u+f,A=zs(g,t);h.push(wr(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=zs(c,t),d=wr(c,u,n);o.push(d-l),l=d}return e.breakableFitAdvances=o,e.breakableFitAdvances}function lB(i,e){const t=Kd();t.font=i;const n=tB(i),s=nB(i),r=e?rB(i,s):0;return{cache:n,fontSize:s,emojiCorrection:r}}function hB(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 Lm(i,e){if(e<=0)return 0;const t=i%e;return Math.abs(t)<=1e-6?e:e-t}function Pm(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 uB(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 km(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 jd(i,e){if(e.segmentIndex>=i.widths.length)return-1;const t=uB(i,e.segmentIndex);return t<0?-1:km(i,t,e)}function dB(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:km(i,n,t)}function fB(i,e){return i.simpleLineWalkFastPath?Um(i,e):Xd(i,e)}function Um(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i;if(n.length===0)return 0;const o=Ma().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 I(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 S(C,v){const F=r[C];for(let K=v;K<F.length;K++){const q=F[K];u?h+q>c?(x(),I(C,K,q)):(h+=q,p=C,m=K+1):I(C,K,q)}u&&p===C&&m===F.length&&(p=C+1,m=0)}let T=0;for(;T<n.length&&!(!u&&(T=hB(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?S(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(),S(T,0),T++;continue}x();continue}w(T,C),F&&(g=T+1,A=h-C),T++}return u&&x(),l}function Xd(i,e,t){if(i.simpleLineWalkFastPath)return Um(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=Ma(),d=u.lineFitEpsilon,f=e+d;let p=0,m=0,g=!1,A=0,_=0,x=0,E=0,I=-1,w=0,S=0,T=null;function C(){I=-1,w=0,S=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];I=ee+1,w=m-ae+_e,S=m-ae+Me,T=Q}function N(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}=Pm(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),N(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"?Lm(m,l):n[ee];if(ae==="soft-hyphen"){g&&(x=ee+1,E=0,I=ee+1,w=m+c,S=m+c,T=ae),ee++;continue}if(!g){Me>e&&o[ee]!==null?N(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(I,0,S);continue}if(T==="soft-hyphen"&&O(ee)){ee++;continue}if(_e&&me<=f){q(ee,Me),v(ee+1,0,xe),ee++;continue}if(I>=0&&w<=f){if(x>I||x===I&&E>0){v();continue}const be=I;v(be,0,S),ee=be;continue}if(Me>e&&o[ee]!==null){v(),N(ee,0),ee++;continue}v();continue}q(ee,Me),$(ae,_e,ee,Me),ee++}if(g){const ae=I===J.consumedEndSegmentIndex?S:m;v(J.consumedEndSegmentIndex,0,ae)}}return p}function Yd(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=Ma(),f=d.lineFitEpsilon,p=n+f;let m=0,g=!1,A=e.segmentIndex,_=e.graphemeIndex,x=-1,E=0,I=0,w=null;function S(){x=-1,E=0,I=0,w=null}function T(N=A,O=_,Y=m){return g?(e.segmentIndex=N,e.graphemeIndex=O,Y):null}function C(N,O){g=!0,A=N+1,_=0,m=O}function v(N,O,Y){g=!0,A=N,_=O+1,m=Y}function F(N,O){if(!g){C(N,O);return}m+=O,A=N+1,_=0}function K(N,O,Y,Q){if(!O)return;const J=N==="tab"?0:a[Y],ee=N==="tab"?Q:o[Y];x=Y+1,E=m-Q+J,I=m-Q+ee,w=N}function q(N,O){const Y=l[N];for(let Q=O;Q<Y.length;Q++){const J=Y[Q];if(!g)v(N,Q,J);else{if(m+J>p)return T();m+=J,A=N,_=Q+1}}return g&&A===N&&_===Y.length&&(A=N+1,_=0),null}function $(N){if(w!=="soft-hyphen"||x<0)return null;const O=l[N]??null;if(O!==null){const{fitCount:Y,fittedWidth:Q}=Pm(O,m,n,f,h);if(Y===O.length)return m=Q,A=N+1,_=0,S(),null;if(Y>0)return T(N,Y,Q+h)}return E<=p?T(x,0,I):null}for(let N=e.segmentIndex;N<s.endSegmentIndex;N++){const O=c[N],Y=O==="space"||O==="preserved-space"||O==="tab"||O==="zero-width-break"||O==="soft-hyphen",Q=N===e.segmentIndex?e.graphemeIndex:0,J=O==="tab"?Lm(m,u):r[N];if(O==="soft-hyphen"&&Q===0){g&&(A=N+1,_=0,x=N+1,E=m+h,I=m+h,w=O);continue}if(!g){if(Q>0){const ae=q(N,Q);if(ae!==null)return ae}else if(J>n&&l[N]!==null){const ae=q(N,0);if(ae!==null)return ae}else C(N,J);K(O,Y,N,J);continue}if(m+J>p){const ae=m+(O==="tab"?0:a[N]),_e=m+(O==="tab"?J:o[N]);if(w==="soft-hyphen"&&d.preferEarlySoftHyphenBreak&&E<=p)return T(x,0,I);const Me=$(N);if(Me!==null)return Me;if(Y&&ae<=p)return F(N,J),T(N+1,0,_e);if(x>=0&&E<=p)return A>x||A===x&&_>0?T():T(x,0,I);if(J>n&&l[N]!==null){const se=T();if(se!==null)return se;const me=q(N,0);if(me!==null)return me}return T()}F(N,J),K(O,Y,N,J)}return x===s.consumedEndSegmentIndex&&_===0?T(s.consumedEndSegmentIndex,0,I):T(s.consumedEndSegmentIndex,0,m)}function Om(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i,o=Ma().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 I=E,w=I[x];h=!0,l=w,u=m,d=x+1;for(let S=x+1;S<I.length;S++){const T=I[S];if(l+T>c)return e.segmentIndex=u,e.graphemeIndex=d,l;l+=T,u=m,d=S+1}u===m&&d===I.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 Jd(i,e,t){const n={segmentIndex:e.segmentIndex,graphemeIndex:e.graphemeIndex},s=jd(i,n);if(s<0)return null;const r=n.segmentIndex,a=n.graphemeIndex,o=i.simpleLineWalkFastPath?Om(i,n,t):Yd(i,n,s,t);return o===null?null:{startSegmentIndex:r,startGraphemeIndex:a,endSegmentIndex:n.segmentIndex,endGraphemeIndex:n.graphemeIndex,width:o}}function pB(i,e,t){const n=jd(i,e);return n<0?null:i.simpleLineWalkFastPath?Om(i,e,t):Yd(i,e,n,t)}function AB(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=jd(i,t);for(;r>=0;){const a=Yd(i,t,r,e);if(a===null)return{lineCount:n,maxLineWidth:s};n++,a>s&&(s=a),r=dB(i,r,t)}return{lineCount:n,maxLineWidth:s}}for(;;){const r=pB(i,t,e);if(r===null)return{lineCount:n,maxLineWidth:s};n++,r>s&&(s=r)}}let Zd=null,Qm=new WeakMap;function Gm(){return Zd===null&&(Zd=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Zd}function gB(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 mB(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=Vd(u),o=kl.has(u)}function h(u,d){n.push(u),r=r||d;const f=Vd(u);u.length===1&&_r.has(u)?a=a||f:a=f,o=!1}for(const u of Gm().segment(i)){const d=u.segment,f=yr(d);if(n.length===0){l(d,u.index,f);continue}if(o||Gd.has(d)||_r.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 xB(i,e,t,n){const s=Ma(),{cache:r,emojiCorrection:a}=lB(e,sB(i.normalized)),o=wr("-",zs("-",r),a),l=wr(" ",zs(" ",r),a)*8;if(i.len===0)return gB(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(S,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(S)}function E(S,T,C,v,F){const K=zs(S,r),q=wr(S,K,a),$=T==="space"||T==="preserved-space"||T==="zero-width-break"?0:q,N=T==="space"||T==="zero-width-break"?0:q;if(F&&v&&S.length>1){let O="sum-graphemes";Ol(S)?O="pair-context":s.preferPrefixWidthsForBreakableRuns&&(O="segment-prefixes");const Y=cB(S,K,r,a,O);x(S,q,$,N,T,C,Y);return}x(S,q,$,N,T,C,null)}for(let S=0;S<i.len;S++){_[S]=h.length;const T=i.texts[S],C=i.isWordLike[S],v=i.kinds[S],F=i.starts[S];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=zs(T,r);if(v==="text"&&K.containsCJK){const $=mB(T,s);for(let N=0;N<$.length;N++){const O=$[N];E(O.text,"text",F+O.start,C,!yr(O.text))}continue}E(T,v,F,C,!0)}const I=bB(i.chunks,_,h.length),w=m===null?null:hM(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:I,segments:A}:{widths:h,lineEndFitAdvances:u,lineEndPaintAdvances:d,kinds:f,simpleLineWalkFastPath:p,segLevels:w,breakableFitAdvances:g,discretionaryHyphenWidth:o,tabStopAdvance:l,chunks:I}}function bB(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 Hm(i,e,t,n){const r=JM(i,Ma(),n?.whiteSpace,"normal");return xB(r,e,t)}function Ql(i,e,t){return Hm(i,e,!1,t)}function Gl(i,e,t){return Hm(i,e,!0,t)}function X2(i){return i}function EB(i,e,t){const n=fB(i,e);return{lineCount:n,height:n*t}}function zm(i,e,t){let n=t.get(i);if(n!==void 0)return n;n=[];const s=Gm();for(const r of s.segment(e[i]))n.push(r.segment);return t.set(i,n),n}function Vm(i){let e=Qm.get(i);return e!==void 0||(e=new Map,Qm.set(i,e)),e}function yB(i,e,t,n){return n>0&&i[n-1]==="soft-hyphen"&&!(e===n&&t>0)}function _B(i,e,t,n,s,r,a){let o="";const c=yB(e,n,s,r);for(let l=n;l<r;l++)e[l]==="soft-hyphen"||e[l]==="hard-break"||(l===n&&s>0?o+=zm(l,i,t).slice(s).join(""):o+=i[l]);return a>0?(c&&(o+="-"),o+=zm(r,i,t).slice(n===r?s:0,a).join("")):c&&(o+="-"),o}function Wm(i,e,t,n,s,r,a){return{text:_B(i.segments,i.kinds,e,n,s,r,a),width:t,start:{segmentIndex:n,graphemeIndex:s},end:{segmentIndex:r,graphemeIndex:a}}}function wB(i,e,t){return Wm(i,e,t.width,t.startSegmentIndex,t.startGraphemeIndex,t.endSegmentIndex,t.endGraphemeIndex)}function vB(i){return{width:i.width,start:{segmentIndex:i.startSegmentIndex,graphemeIndex:i.startGraphemeIndex},end:{segmentIndex:i.endSegmentIndex,graphemeIndex:i.endGraphemeIndex}}}function CB(i,e){return Wm(i,Vm(i),e.width,e.start.segmentIndex,e.start.graphemeIndex,e.end.segmentIndex,e.end.graphemeIndex)}function SB(i,e,t){return i.widths.length===0?0:Xd(i,e,n=>{t(vB(n))})}function $d(i,e){return AB(i,e)}function qm(i){let e=0;return SB(i,Number.POSITIVE_INFINITY,t=>{t.width>e&&(e=t.width)}),e}function IB(i,e,t){const n=[];if(i.widths.length===0)return{lineCount:0,height:0,lines:n};const s=Vm(i),r=Xd(i,e,a=>{n.push(wB(i,s,a))});return{lineCount:r,height:r*t,lines:n}}const MB=/[ \t\n\f\r]+/,Km=/^[ \t\n\f\r]+/,jm=/[ \t\n\f\r]+$/,Hl={segmentIndex:0,graphemeIndex:0},Xm={itemIndex:0,segmentIndex:0,graphemeIndex:0};function Y2(i){return i}function ef(i){return{segmentIndex:i.segmentIndex,graphemeIndex:i.graphemeIndex}}function Ym(i){return i.segmentIndex===0&&i.graphemeIndex===0}function zl(i,e){const t=e.get(i);if(t!==void 0)return t;const n=qm(Gl("A A",i)),s=qm(Gl("AA",i)),r=Math.max(0,n-s);return e.set(i,r),r}function BB(i){const e=Jd(i,Hl,Number.POSITIVE_INFINITY);return e===null?null:{endGraphemeIndex:e.endGraphemeIndex,endSegmentIndex:e.endSegmentIndex,width:e.width}}function TB(i,e){return i===0&&e>0}function Jm(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=Km.test(a.text),c=jm.test(a.text),l=a.text.replace(Km,"").replace(jm,"");if(l.length===0){MB.test(a.text)&&s===0&&(s=zl(a.font,n));continue}const h=s>0?s:o?zl(a.font,n):0,u=Gl(l,a.font),d=BB(u);if(d===null){s=c?zl(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?zl(a.font,n):0}return{items:e,itemsBySourceItemIndex:t}}function RB(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(!Ym(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=Ym(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,ef(Hl),{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,ef(Hl),{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=Jd(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&&TB(p.endSegmentIndex,p.endGraphemeIndex)){const m=Jd(l.prepared,Hl,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,ef(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 FB(i,e,t=Xm){const n=i,s={itemIndex:t.itemIndex,segmentIndex:t.segmentIndex,graphemeIndex:t.graphemeIndex},r=[],a=RB(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 DB(i,e){return CB(i.prepared,{width:e.occupiedWidth-i.extraWidth,start:e.start,end:e.end}).text}function Zm(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:DB(s,n)}}),width:e.width,end:e.end}}function $m(i,e,t){let n=0,s=Xm;for(;;){const r=FB(i,e,s);if(r===null)return n;t(r),n++,s=r.end}}const e0="500 14px Inter, sans-serif",tf="600 10px Inter, sans-serif",nf="300 13px Inter, sans-serif",t0="600 10px Inter, sans-serif",n0="300 12px Inter, sans-serif",Qo=18,Vl=16,gn=16,Gi=6,i0=12,Wl=Math.min(window.devicePixelRatio||1,2),NB="rgba(0, 0, 0, 0.75)",LB="rgba(255, 255, 255, 0.08)",PB="rgba(255, 255, 255, 0.9)",kB="rgba(255, 255, 255, 0.30)",UB="rgba(255, 255, 255, 0.85)",s0="rgba(255, 255, 255, 0.08)",OB="rgba(255, 255, 255, 0.45)",QB="rgba(255, 255, 255, 0.08)",GB="rgba(255, 255, 255, 0.7)";function HB(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 Go(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function zB(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 VB(i,e,t){const n=HB(e),s=zB(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)}];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=Ql("Model Info",e0),l=EB(c,o,Qo+2),h=r.map(w=>{const S=[{text:w.label+" ",font:tf},{text:w.value,font:nf}],T=Jm(S),C=Ql(w.label,tf),v=$d(C,o),F=Ql(w.value,nf),K=$d(F,o);return{...w,labelWidth:v.maxLineWidth,valueWidth:K.maxLineWidth,richPrepared:T}}),u=a.map(w=>{const S=Ql(w,t0),T=$d(S,300);return{text:w,width:T.maxLineWidth+i0}});let d=[],f=0;if(s){const w=Gl(s,n0),S=IB(w,o-gn,Qo);d=S.lines,f=S.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,S=1;u.forEach(T=>{w>0&&w+T.width>m-gn*2&&(S++,w=0),w+=T.width+6}),g=S*(Vl+6)+Gi}const A=gn+l.height+Gi+Gi+h.length*(Qo+Gi)+g+(f>0?Gi+f:0)+gn,_=document.createElement("canvas");_.width=m*Wl,_.height=A*Wl,_.style.width=m+"px",_.style.height=A+"px";const x=_.getContext("2d");x.scale(Wl,Wl),x.fillStyle=NB,sf(x,0,0,m,A,10),x.fill(),x.strokeStyle=LB,x.lineWidth=1,sf(x,.5,.5,m-1,A-1,10),x.stroke();let E=gn;if(x.font=e0,x.fillStyle=PB,x.textBaseline="top",x.fillText("Model Info",gn,E),E+=l.height+Gi,x.strokeStyle=s0,x.beginPath(),x.moveTo(gn,E),x.lineTo(m-gn,E),x.stroke(),E+=Gi,h.forEach(w=>{x.font=tf,x.fillStyle=kB,x.textAlign="left",x.fillText(w.label,gn,E),x.font=nf,x.fillStyle=UB,x.textAlign="right",x.fillText(w.value,m-gn,E),x.textAlign="left",E+=Qo+Gi}),u.length>0){let w=gn;u.forEach(S=>{w>gn&&w+S.width>m-gn&&(w=gn,E+=Vl+6),x.fillStyle=QB,sf(x,w,E,S.width,Vl,4),x.fill(),x.font=t0,x.fillStyle=GB,x.textBaseline="top",x.fillText(S.text,w+i0/2,E+3),w+=S.width+6}),E+=Vl+Gi+4}d.length>0&&(x.strokeStyle=s0,x.beginPath(),x.moveTo(gn,E),x.lineTo(m-gn,E),x.stroke(),E+=Gi,x.font=n0,x.fillStyle=OB,x.textBaseline="top",d.forEach(w=>{x.fillText(w.text,gn,E),E+=Qo}));const I=document.createElement("div");return I.classList.add("model-info"),I.appendChild(_),i.appendChild(I),{el:I,canvas:_,remove(){I.remove()}}}function sf(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 WB="500 11px Inter, sans-serif",r0="300 10px Inter, sans-serif",rf=10,a0=6,o0=14,ql=Math.min(window.devicePixelRatio||1,2),qB=8;function KB(i){const e=[];return i.traverse(t=>{if(e.length>=qB||!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:WB}];r>0&&o.push({text:" "+XB(r)+" verts",font:r0}),a&&o.push({text:" "+a,font:r0});const c=Jm(o);let l=0,h=0;$m(c,300,m=>{const g=Zm(c,m);l=Math.max(l,g.width),h++});const u=l+rf*2,d=h*o0+a0*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 jB(i){const{labelWidth:e,labelHeight:t,items:n,prepared:s}=i,r=document.createElement("canvas");r.width=e*ql,r.height=t*ql,r.style.width=e+"px",r.style.height=t+"px";const a=r.getContext("2d");a.scale(ql,ql),a.fillStyle="rgba(0, 0, 0, 0.8)",c0(a,0,0,e,t,6),a.fill(),a.strokeStyle="rgba(255, 255, 255, 0.1)",a.lineWidth=1,c0(a,.5,.5,e-1,t-1,6),a.stroke(),a.textBaseline="top";let o=a0;return $m(s,e-rf*2,c=>{const l=Zm(s,c);let h=rf;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+=o0}),r}function XB(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function c0(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 af=new WeakMap;class YB 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(af.has(e)){const c=af.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)}),af.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new Mn;e.index&&t.setIndex(new In(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 In(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=JB.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 JB(){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 ZB{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 $B=0,l0=2,eT=1,h0=2,tT=0,nT=1,iT=10,sT=0,u0=9,d0=15,f0=16,p0=22,A0=37,g0=43,m0=76,x0=83,b0=97,E0=100,y0=103,_0=109,w0=165,v0=166,of=1000066e3;class rT{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 Ho{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 C0(i){return new TextDecoder().decode(i)}function aT(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 rT,n=17*Uint32Array.BYTES_PER_ELEMENT,s=new Ho(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 Ho(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 Ho(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 Ho(i,c,l,!0);for(;g._offset<l;){const Y=g._nextUint32(),Q=g._scan(Y),J=C0(Q);if(t.keyValue[J]=g._nextUint8Array(Y-Q.byteLength-1),J.match(/^ktx/i)){const ee=C0(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 Ho(i,h,u,!0),_=A._nextUint16(),x=A._nextUint16(),E=A._nextUint32(),I=A._nextUint32(),w=A._nextUint32(),S=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+I,K=F+w,q=new Uint8Array(i.buffer,i.byteOffset+C,E),$=new Uint8Array(i.buffer,i.byteOffset+v,I),N=new Uint8Array(i.buffer,i.byteOffset+F,w),O=new Uint8Array(i.buffer,i.byteOffset+K,S);return t.globalData={endpointCount:_,selectorCount:x,imageDescs:T,endpointsData:q,selectorsData:$,tablesData:N,extendedData:O},t}let cf,cs,lf;const hf={env:{emscripten_notify_memory_growth:function(i){lf=new Uint8Array(cs.exports.memory.buffer)}}};class oT{init(){return cf||(cf=typeof fetch<"u"?fetch("data:application/wasm;base64,"+S0).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,hf)).then(this._init):WebAssembly.instantiate(Buffer.from(S0,"base64"),hf).then(this._init),cf)}_init(e){cs=e.instance,hf.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);lf.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=lf.slice(r,r+a);return cs.exports.free(s),cs.exports.free(r),o}}const S0="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/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34B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8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQ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ACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKAL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CACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAF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OgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEI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08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAA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AAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/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",cT="display-p3",lT="display-p3-linear",uf=new WeakMap;let df=0,ff;class hi extends oi{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new ZB,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})}),df>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),df++}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(uf.has(e))return uf.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 Q_(r,c,l);else{const d=r[0].mipmaps;u=t.layerCount>1?new O_(d,a,o,t.layerCount,c,l):new gl(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=I0(t),u.premultiplyAlpha=!!(h&eT),u}async _createTexture(e,t={}){const n=aT(new Uint8Array(e)),s=n.vkFormat===of&&n.dataFormatDescriptor[0].colorModel===167;if(!(n.vkFormat===sT||s&&!this.workerConfig.astcHDRSupported))return uT(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 uf.set(e,{promise:o}),o}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),df--}}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:ao,RGB_BPTC_UNSIGNED_Format:Nc,RGBA_BPTC_Format:co,RGBA_ETC2_EAC_Format:Dc,RGBA_PVRTC_4BPPV1_Format:Tc,RGBA_S3TC_DXT5_Format:ro,RGB_ETC1_Format:Rc,RGB_ETC2_Format:Fc,RGB_PVRTC_4BPPV1_Format:Bc,RGBA_S3TC_DXT1_Format:so},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:I,type:w,dfdFlags:S}=c(m.buffer);self.postMessage({type:"transcode",id:m.id,data:{faces:g,width:_,height:x,hasAlpha:E,format:I,type:w,dfdFlags:S}},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,I=m.getLevels(),w=m.getFaces(),S=m.getHasAlpha(),T=m.getDFDFlags(),{transcoderFormat:C,engineFormat:v,engineType:F}=u(A,_,x,S);if(!_||!x||!I)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 N=[];for(let O=0;O<I;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."),I>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);N.push({data:ee,width:Q,height:J}),q.push(ee.buffer)}K.push({mipmaps:N,width:_,height:x,format:v,type:F})}return g(),{faces:K,buffers:q,width:_,height:x,hasAlpha:S,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 I=E.transcoderFormat[A?1:0],w=E.engineFormat[A?1:0],S=E.engineType[0];return{transcoderFormat:I,engineFormat:w,engineType:S}}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 hT=new Set([hn,rr,ji]),pf={[_0]:hn,[b0]:hn,[A0]:hn,[g0]:hn,[y0]:rr,[x0]:rr,[f0]:rr,[p0]:rr,[E0]:ji,[m0]:ji,[d0]:ji,[u0]:ji,[of]:ao,[v0]:oo,[w0]:oo},Af={[_0]:ln,[b0]:Pn,[A0]:cn,[g0]:cn,[y0]:ln,[x0]:Pn,[f0]:cn,[p0]:cn,[E0]:ln,[m0]:Pn,[d0]:cn,[u0]:cn,[of]:Pn,[v0]:cn,[w0]:cn};async function uT(i){const{vkFormat:e}=i;if(pf[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;i.supercompressionScheme===l0&&(ff||(ff=new Promise(async r=>{const a=new oT;await a.init(),r(a)})),t=await ff);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===$B)h=l.levelData;else if(i.supercompressionScheme===l0)h=t.decode(l.levelData,l.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let u;Af[e]===ln?u=new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):Af[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(hT.has(pf[e]))s=i.pixelDepth===0?new sl(n[0].data,i.pixelWidth,i.pixelHeight):new hA(n[0].data,i.pixelWidth,i.pixelHeight,i.pixelDepth);else{if(i.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new gl(n,i.pixelWidth,i.pixelHeight),s.minFilter=n.length===1?qt:si,s.magFilter=qt}return s.mipmaps=n,s.type=Af[e],s.format=pf[e],s.colorSpace=I0(i),s.needsUpdate=!0,Promise.resolve(s)}function I0(i){const e=i.dataFormatDescriptor[0];return e.colorPrimaries===nT?e.transferFunction===h0?yt:un:e.colorPrimaries===iT?e.transferFunction===h0?cT:lT:(e.colorPrimaries===tT||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),gi)}const Kl="[default]",gf={ASSET_GENERATOR:"assetgenerator"},jl=new ag,M0="https://unpkg.com/[email protected]",dT=new YB(jl).setDecoderPath(`${M0}/examples/jsm/libs/draco/gltf/`),fT=new hi(jl).setTranscoderPath(`${M0}/examples/jsm/libs/basis/`);function B0(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 pT(i){const{state:e,options:t}=i;if(t.preset===gf.ASSET_GENERATOR){const r=new Ew;r.name="hemi_light",i.scene.add(r),i.lights.push(r);return}const n=new dg(e.ambientColor,e.ambientIntensity);n.name="ambient_light",i.defaultCamera.add(n);const s=new ld(e.directColor,e.directIntensity);s.position.set(.5,0,.866),s.name="main_light",i.defaultCamera.add(s),i.lights.push(n,s)}function AT(i){i.lights.forEach(e=>e.parent.remove(e)),i.lights.length=0}var ui=Uint8Array,Ba=Uint16Array,gT=Int32Array,T0=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]),R0=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]),mT=new ui([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),F0=function(i,e){for(var t=new Ba(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var s=new gT(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}},D0=F0(T0,2),N0=D0.b,xT=D0.r;N0[28]=258,xT[258]=28;for(var bT=F0(R0,0),ET=bT.b,mf=new Ba(32768),Ot=0;Ot<32768;++Ot){var Vs=(Ot&43690)>>1|(Ot&21845)<<1;Vs=(Vs&52428)>>2|(Vs&13107)<<2,Vs=(Vs&61680)>>4|(Vs&3855)<<4,mf[Ot]=((Vs&65280)>>8|(Vs&255)<<8)>>1}for(var zo=(function(i,e,t){for(var n=i.length,s=0,r=new Ba(e);s<n;++s)i[s]&&++r[i[s]-1];var a=new Ba(e);for(s=1;s<e;++s)a[s]=a[s-1]+r[s-1]<<1;var o;if(t){o=new Ba(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[mf[u]>>c]=l}else for(o=new Ba(n),s=0;s<n;++s)i[s]&&(o[s]=mf[a[i[s]-1]++]>>15-i[s]);return o}),Vo=new ui(288),Ot=0;Ot<144;++Ot)Vo[Ot]=8;for(var Ot=144;Ot<256;++Ot)Vo[Ot]=9;for(var Ot=256;Ot<280;++Ot)Vo[Ot]=7;for(var Ot=280;Ot<288;++Ot)Vo[Ot]=8;for(var L0=new ui(32),Ot=0;Ot<32;++Ot)L0[Ot]=5;var yT=zo(Vo,9,1),_T=zo(L0,5,1),xf=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},bf=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},wT=function(i){return(i+7)/8|0},vT=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new ui(i.subarray(e,t))},CT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ii=function(i,e,t){var n=new Error(e||CT[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Ii),!t)throw n;return n},ST=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=Si(i,u,1);var _=Si(i,u+1,3);if(u+=3,_)if(_==1)f=yT,p=_T,m=9,g=5;else if(_==2){var w=Si(i,u,31)+257,S=Si(i,u+10,15)+4,T=w+Si(i,u+5,31)+1;u+=14;for(var C=new ui(T),v=new ui(19),F=0;F<S;++F)v[mT[F]]=Si(i,u+F*3,7);u+=S*3;for(var K=xf(v),q=(1<<K)-1,$=zo(v,K,1),F=0;F<T;){var N=$[Si(i,u,q)];u+=N&15;var x=N>>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=xf(Q),g=xf(J),f=zo(Q,m,1),p=zo(J,g,1)}else Ii(1);else{var x=wT(u)+4,E=i[x-4]|i[x-3]<<8,I=x+E;if(I>s){c&&Ii(0);break}o&&l(d+E),t.set(i.subarray(x,I),d),e.b=d+=E,e.p=u=I*8,e.f=h;continue}if(u>A){c&&Ii(0);break}}o&&l(d+131072);for(var ee=(1<<m)-1,ae=(1<<g)-1,_e=u;;_e=u){var O=f[bf(i,u)&ee],Me=O>>4;if(u+=O&15,u>A){c&&Ii(0);break}if(O||Ii(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=T0[F];se=Si(i,u,(1<<me)-1)+N0[F],u+=me}var xe=p[bf(i,u)&ae],be=xe>>4;xe||Ii(3),u+=xe&15;var J=ET[be];if(be>3){var me=R0[be];J+=bf(i,u)&(1<<me)-1,u+=me}if(u>A){c&&Ii(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&&Ii(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?vT(t,0,d):t.subarray(0,d)},IT=new ui(0),MT=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Ii(6,"invalid zlib data"),(i[1]>>5&1)==1&&Ii(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Wo(i,e){return ST(i.subarray(MT(i),-4),{i:2},e,e)}var BT=typeof TextDecoder<"u"&&new TextDecoder,TT=0;try{BT.decode(IT,{stream:!0}),TT=1}catch{}class RT extends bw{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 N(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,D){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,D[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--;)D[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--;)D[y++]=0;y--}}N(D)}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]),D=Y(b[B]);if(R>>D)throw new Error("Invalid table entry");if(D>14){const U=y[R>>D-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(D){let U=0;for(let P=1<<14-D;P>0;P--){const z=y[(R<<14-D)+U];if(z.len||z.p)throw new Error("Invalid table entry");z.len=D,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,D,U,P,z){if(b==B){y<8&&(ae(k,y,R,D),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),D=k+(R&1)+(R>>1),U=D,P=D-R;xe.a=U,xe.b=P}function Ue(b,B){const k=se(b),y=se(B),R=k-(y>>1)&65535,D=y+R-32768&65535;xe.a=D,xe.b=R}function et(b,B,k,y,R,D,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+D*(R-X),ce=D*j,fe=D*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 St=rt+ge,mn=rt+ce,vt=mn+ge;P?(be(b[rt+B],b[mn+B]),Pe=xe.a,Ve=xe.b,be(b[St+B],b[vt+B]),je=xe.a,Le=xe.b,be(Pe,je),b[rt+B]=xe.a,b[St+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[St+B],b[vt+B]),je=xe.a,Le=xe.b,Ue(Pe,je),b[rt+B]=xe.a,b[St+B]=xe.b,Ue(Ve,Le),b[mn+B]=xe.a,b[vt+B]=xe.b)}if(k&j){const St=rt+ce;P?be(b[rt+B],b[St+B]):Ue(b[rt+B],b[St+B]),Pe=xe.a,b[St+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 St=rt+ge;P?be(b[rt+B],b[St+B]):Ue(b[rt+B],b[St+B]),Pe=xe.a,b[St+B]=xe.b,b[rt+B]=Pe}}X=j,j>>=1}return ie}function He(b,B,k,y,R,D,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,D,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],D,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,D,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,D){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,D,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 D=b.length-1;for(;!(R>D||(B[R++]=b[k++],R>D));)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 D=R.getInt8(y++);if(D<0){const U=-D;B-=U+1;for(let P=0;P<U;P++)k.push(R.getUint8(y++))}else{const U=D;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,D){let U=new DataView(D.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 St=8;ke==he-1&&(St=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]),Nt(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+St;++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+St;++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(D.buffer);for(let ke=0;ke<j;++ke){k[b.idx[ke]].decoded=!0;const St=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*St,!0);for(let Et=0;Et<P;++Et)U.setFloat32(vt+Et*2*St,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 Nt(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),D=.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]+D*b[ce+5]+P*b[ce+7],j[1]=R*b[ce+1]-P*b[ce+3]-k*b[ce+5]-D*b[ce+7],j[2]=D*b[ce+1]-k*b[ce+3]+P*b[ce+5]+R*b[ce+7],j[3]=P*b[ce+1]-D*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]+D*b[40+he]+P*b[56+he],j[1]=R*b[8+he]-P*b[24+he]-k*b[40+he]-D*b[56+he],j[2]=D*b[8+he]-k*b[24+he]+P*b[40+he]+R*b[56+he],j[3]=P*b[8+he]-D*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]=_A.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=Wo(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 D=0;const U=new Array(b.inputChannels.length);for(let fe=0,ge=b.inputChannels.length;fe<ge;fe++)U[fe]={},U[fe].start=D,U[fe].end=U[fe].start,U[fe].nx=b.columns,U[fe].ny=b.lines,U[fe].size=b.type,D+=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,D);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,D);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=Wo(B),y=b.inputChannels.length*b.lines*b.columns*b.totalBytes,R=new ArrayBuffer(y),D=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,D.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,D.setUint32(P,ie,!0),P+=4}break}}return D}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: "+ws.compression+" version "+R.version+" is unsupported");const D=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);D.push({name:ge,index:Ve,type:Le,compression:Pe}),U-=ge.length+3}const P=ws.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<D.length;++Pe){const je=D[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=Wo(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=Wo(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 Ne(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 _A.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 Ie(b,B,k,y){const R=k.value,D=[];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);D.push({name:U,pixelType:P,pLinear:z,xSampling:j,ySampling:X})}return k.value+=1,D}function Se(b,B){const k=it(b,B),y=it(b,B),R=it(b,B),D=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:D,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 Gt(b,B){const k=Oe(b,B),y=Oe(b,B),R=Oe(b,B),D=Oe(b,B);return{xMin:k,yMin:y,xMax:R,yMax:D}}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),D=Ge(b,B),U=nt(b,B);return{xSize:R,ySize:D,levelMode:k[U&15],roundingMode:y[U>>4]}}function Ni(b,B){const k=it(b,B),y=it(b,B);return[k,y]}function Nh(b,B){const k=it(b,B),y=it(b,B),R=it(b,B);return[k,y,R]}function Lh(b,B,k,y,R){if(y==="string"||y==="stringvector"||y==="iccProfile")return Ze(B,k,R);if(y==="chlist")return Ie(b,B,k,R);if(y==="chromaticities")return Se(b,k);if(y==="compression")return st(b,k);if(y==="box2i")return Gt(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 Ni(b,k);if(y==="v3f")return Nh(b,k);if(y==="int")return Oe(b,k);if(y==="rational")return Ee(b,k);if(y==="timecode")return Ne(b,k);if(y==="preview")return k.value+=R,"skipped";k.value+=R}function _s(b,B){const k=Math.log2(b);return B=="ROUND_DOWN"?Math.floor(k):Math.ceil(k)}function mc(b,B,k){let y=0;switch(b.levelMode){case"ONE_LEVEL":y=1;break;case"MIPMAP_LEVELS":y=_s(Math.max(B,k),b.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return y}function xc(b,B,k,y){const R=new Array(b);for(let D=0;D<b;D++){const U=1<<D;let P=B/U|0;y=="ROUND_UP"&&P*U<B&&(P+=1);const z=Math.max(P,1);R[D]=(z+k-1)/k|0}return R}function Ph(){const b=this,B=b.offset,k={value:0};for(let y=0;y<b.tileCount;y++){const R=Oe(b.viewer,B),D=Oe(b.viewer,B);B.value+=8,b.size=Ge(b.viewer,B);const U=R*b.blockWidth,P=D*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=ws.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 Ja(){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)-ws.dataWindow.yMin;b.size=Ge(b.viewer,B),b.lines=R+b.blockHeight>b.height?b.height-R:b.blockHeight;const D=b.columns*b.totalBytes,P=b.size<b.lines*D?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*D,he=(b.height-1-X)*b.outLineWidth;for(let ce=0;ce<b.inputChannels.length;ce++){const fe=ws.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 kh(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 D=!0;for(;D;){const U=qe(B,k);if(U==="")D=!1;else{const P=qe(B,k),z=Ge(b,k),j=Lh(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 Za(b,B,k,y,R){const D={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":D.blockHeight=1,D.uncompress=Z;break;case"RLE_COMPRESSION":D.blockHeight=1,D.uncompress=le;break;case"ZIPS_COMPRESSION":D.blockHeight=1,D.uncompress=Ae;break;case"ZIP_COMPRESSION":D.blockHeight=16,D.uncompress=Ae;break;case"PIZ_COMPRESSION":D.blockHeight=32,D.uncompress=oe;break;case"PXR24_COMPRESSION":D.blockHeight=16,D.uncompress=Qe;break;case"DWAA_COMPRESSION":D.blockHeight=32,D.uncompress=ve;break;case"DWAB_COMPRESSION":D.blockHeight=256,D.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,D.type=X.pixelType}let P=!1;if(U.R&&U.G&&U.B)P=!U.A,D.outputChannels=4,D.decodeChannels={R:0,G:1,B:2,A:3};else if(U.Y)D.outputChannels=1,D.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(D.type==1)switch(R){case ln:D.getter=de;break;case Pn:D.getter=re;break}else if(D.type==2)switch(R){case ln:D.getter=it;break;case Pn:D.getter=W}else throw new Error("EXRLoader.parse: unsupported pixelType "+D.type+" for "+b.compression+".");D.columns=D.width;const z=D.width*D.height*D.outputChannels;switch(R){case ln:D.byteArray=new Float32Array(z),P&&D.byteArray.fill(1,0,z);break;case Pn:D.byteArray=new Uint16Array(z),P&&D.byteArray.fill(15360,0,z);break;default:console.error("THREE.EXRLoader: unsupported type: ",R);break}let j=0;for(const X of b.channels)D.decodeChannels[X.name]!==void 0&&(D.channelByteOffsets[X.name]=j),j+=X.pixelType*2;if(D.totalBytes=j,D.outLineWidth=D.width*D.outputChannels,b.lineOrder==="INCREASING_Y"?D.scanOrder=X=>X:D.scanOrder=X=>D.height-1-X,D.outputChannels==4?(D.format=hn,D.colorSpace=un):(D.format=ji,D.colorSpace=gi),b.spec.singleTile){D.blockHeight=b.tiles.ySize,D.blockWidth=b.tiles.xSize;const X=mc(b.tiles,D.width,D.height),ie=xc(X,D.width,b.tiles.xSize,b.tiles.roundingMode),he=xc(X,D.height,b.tiles.ySize,b.tiles.roundingMode);D.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);D.decode=Ph.bind(D)}else{D.blockWidth=D.width;const X=Math.ceil(D.height/D.blockHeight);for(let ie=0;ie<X;ie++)Ke(B,y);D.decode=Ja.bind(D)}return D}const bc={value:0},Ec=new DataView(e),Lp=new Uint8Array(e),ws=kh(Ec,e,bc),tr=Za(ws,Ec,Lp,bc,this.type);return tr.decode(),{header:ws,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 FT(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 RT().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 DT(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"),NT(i)}function NT(i){const e=document.createElement("div");e.className="screenshot-flash",i.el.appendChild(e),e.addEventListener("animationend",()=>e.remove())}function LT(i,e){i.mixer&&(i.mixer.stopAllAction(),i.mixer.uncacheRoot(i.mixer.getRoot()),i.mixer=null),i.clips=e,e.length&&(i.mixer=new fg(i.content))}function PT(i){i.clips.forEach(e=>{i.mixer.clipAction(e).reset().play(),i.state.actionStates[e.name]=!0}),i.invalidate()}function P0(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 kT(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 UT(i,e,t,n){const s=P0(i,n,e),r=kT(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 OT(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 I=d;d=f,f=I}}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 QT(i,e,t,n,s){const r=s<i?s:i,a=[],o=P0(i,n,e),c=OT(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 GT(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 HT(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(GT(r,o)*n[o]));s[r]=a.divideScalar(n[0])}return s}function zT(i,e,t,n,s){const r=QT(i,e,t,n,s);return HT(r)}class VT extends G_{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=UT(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=zT(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 WT extends oi{constructor(e){super(e)}load(e,t,n,s){const r=this,a=r.path===""?pr.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(JT(e))ht=new YT().parse(e);else{const s=G0(e);if(!ZT(s))throw new Error("THREE.FBXLoader: Unknown format.");if(O0(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+O0(s));ht=new XT().parse(s)}const n=new og(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new qT(n,this.manager).parse(ht)}}class qT{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 KT().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 El;break;case"lambert":o=new aw;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),o=new El;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=wc,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=Q0(c.userData.transformData);c.applyMatrix4(l),c.updateWorldMatrix()}});const o=new jT().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 il;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 il,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 wl(r,a,o,c);break;case 1:t=new ld(r,a);break;case 2:let l=Math.PI/3;n.InnerAngle!==void 0&&(l=Sn.degToRad(n.InnerAngle.value));let h=0;n.OuterAngle!==void 0&&(h=Sn.degToRad(n.OuterAngle.value),h=Math.max(h,1)),t=new hg(r,a,o,l,h,c);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new wl(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 El({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 El;o.push(l)}}return r.FBX_Deformer?(s=new kA(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 pa({name:oi.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new ul(n,s)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=qo(t.RotationOrder.value):n.eulerOrder=qo(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 rl(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 dg(r,1))}}"UnitScaleFactor"in ht.GlobalSettings&&(Qn.userData.unitScaleFactor=ht.GlobalSettings.UnitScaleFactor.value)}}}class KT{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=qo(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=Q0(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 Hu(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=Xl(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(I,w){let S=I,T=A[w];E.forEach(function(C,v,F){if(S>C){F[v]=S,S=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=Xl(p,n,f,e.normal);o.push(x[0],x[1],x[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=Xl(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(x,E){const I=Xl(p,n,f,x);l[E]===void 0&&(l[E]=[]),l[E].push(I[0]),l[E].push(I[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=sd.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 VT(n,s,r,o,c).getPoints(r.length*12);return new Mn().setFromPoints(h)}}class jT{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($T),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 _l(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 fr(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=qo(0);n!==void 0&&(n=n.map(Sn.degToRad),n.push(c),n=new dn().fromArray(n),n=new Yt().setFromEuler(n)),s!==void 0&&(s=s.map(Sn.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 ks(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 ks(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 dr(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(Sn.degToRad(e.values[0])),a.push(Sn.degToRad(t.values[0])),a.push(Sn.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(Sn.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(Sn.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],I=e.times[o]-E,w=new Yt,S=new dn;for(let T=0;T<1;T+=1/m)w.copy(_.clone().slerp(x.clone(),T)),r.push(E+T*I),S.setFromQuaternion(w,s),a.push(S.x),a.push(S.y),a.push(S.z)}else r.push(e.times[o]),a.push(Sn.degToRad(e.values[o])),a.push(Sn.degToRad(t.values[o])),a.push(Sn.degToRad(n.values[o]))}return[r,a]}}class XT{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 U0,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],tR(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=yf(r))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=yf(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=yf(l);break}this.getPrevNode()[r]={type:a,type2:o,flag:c,value:l},this.setCurrentProp(this.getPrevNode(),r)}}class YT{parse(e){const t=new k0(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 U0;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=Wo(new Uint8Array(e.getArrayBuffer(a))),c=new k0(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 k0{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 U0{add(e,t){this[e]=t}}function JT(i){const e="Kaydara FBX Binary \0";return i.byteLength>=e.length&&e===G0(i,0,e.length)}function ZT(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 O0(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 $T(i){return i/46186158e3}const eR=[];function Xl(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 nR(eR,n.buffer,r,a)}const Ef=new dn,Ta=new G;function Q0(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(Ta.fromArray(i.translation));const p=qo(0);if(i.preRotation){const F=i.preRotation.map(Sn.degToRad);F.push(p),t.makeRotationFromEuler(Ef.fromArray(F))}if(i.rotation){const F=i.rotation.map(Sn.degToRad);F.push(i.eulerOrder||p),n.makeRotationFromEuler(Ef.fromArray(F))}if(i.postRotation){const F=i.postRotation.map(Sn.degToRad);F.push(p),s.makeRotationFromEuler(Ef.fromArray(F)),s.invert()}i.scale&&r.scale(Ta.fromArray(i.scale)),i.scalingOffset&&o.setPosition(Ta.fromArray(i.scalingOffset)),i.scalingPivot&&a.setPosition(Ta.fromArray(i.scalingPivot)),i.rotationOffset&&c.setPosition(Ta.fromArray(i.rotationOffset)),i.rotationPivot&&l.setPosition(Ta.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,I=new Re;if(f===0)I.copy(g).multiply(m).multiply(x).multiply(E);else if(f===1)I.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);I.copy(g).multiply(m).multiply(q).multiply(E)}const w=l.clone().invert(),S=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(S);const C=new Re().copyPosition(T),v=h.clone().multiply(C);return d.copyPosition(v),T=d.clone().multiply(I),T.premultiply(h.invert()),T}function qo(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 yf(i){return i.split(",").map(function(t){return parseFloat(t)})}function G0(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=i.byteLength),new TextDecoder().decode(new Uint8Array(i,e,t))}function tR(i,e){for(let t=0,n=i.length,s=e.length;t<s;t++,n++)i[n]=e[t]}function nR(i,e,t,n){for(let s=t,r=0;s<n;s++,r++)i[r]=e[s];return i}const iR=.35;class sR{constructor(){this.model=null,this.mixer=null,this.clips=new Map,this.actions=new Map,this.currentName=null,this.currentAction=null,this.loader=new _d,this.fbxLoader=new WT,this.onChange=null,this._gltfCache=new Map,this._animationDefs=[]}attach(e){this.detach(),this.model=e,this.mixer=new fg(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?Zp:$p),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=iR){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 _f{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 sR,this._animPanelEl=null,this.state={environment:t.preset===gf.ASSET_GENERATOR?Ll.find(r=>r.id==="footprint-court").name:Ll[1].name,background:!1,playbackSpeed:1,actionStates:{},camera:Kl,wireframe:!1,skeleton:!1,grid:!1,autoRotate:!1,punctualLights:!0,exposure:0,toneMapping:Kh,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 Fo,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 qu,this.scene.background=this.backgroundColor;const n=t.preset===gf.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 qg({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 xd(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.neutralEnvironment=this.pmremGenerator.fromScene(new U1).texture,this.controls=new C1(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(){DT(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=pr.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 _d(jl).setCrossOrigin("anonymous").setDRACOLoader(dT).setKTX2Loader(fT.detectSupport(this.renderer)).setMeshoptDecoder(w1),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(Kl),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){LT(this,e)}playAllClips(){PT(this)}setCamera(e){e===Kl?(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?pT(this):!e.punctualLights&&t.length&&AT(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=Ll.filter(t=>t.name===this.state.environment)[0];FT(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)),B0(this.content,e=>{e.wireframe=this.state.wireframe,e instanceof ed&&(e.size=this.state.pointSize)}),this.content.traverse(e=>{if(e.geometry&&e.skeleton&&this.state.skeleton){const t=new Uw(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 Ow,this.axesHelper=new gg,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=VB(this.el,e,t))}updateAnnotations(){if(this.annotationEls.forEach(t=>t.el.remove()),this.annotationEls=[],!this.state.showLabels||!this.content)return;KB(this.content).forEach(t=>{const n=jB(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 qu,this.axesCamera=new Bn(50,e/t,.1,10),this.axesScene.add(this.axesCamera),this.axesRenderer=new qg({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 gg(5),this.axesScene.add(this.axesCorner),this.axesDiv.appendChild(this.axesRenderer.domElement)}addGUI(){const e=window.innerWidth<=700,t=this.gui=new aM({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",Ll.map(w=>w.name)).onChange(()=>this.updateEnvironment()),[p.add(this.state,"toneMapping",{Linear:Kh,"ACES Filmic":Hp}),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 I=document.createElement("button");I.className="gui-toggle",I.setAttribute("title","Toggle advanced controls"),I.setAttribute("aria-label","Toggle advanced controls"),I.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>',I.addEventListener("click",()=>{const w=E.classList.toggle("gui-wrap--hidden");I.classList.toggle("gui-toggle--active",!w)}),this.el.appendChild(I),this._guiToggle=I,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=[Kl].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()}),B0(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 rR{constructor({model:e="claude-opus-4-6",proxyURL:t,apiKey:n,temperature:s=.7,maxTokens:r=4096,thinking:a="auto"}={}){this.model=e,this.proxyURL=t,this.apiKey=n,this.temperature=s,this.maxTokens=r,this.thinking=a}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 aR{async complete(){return{text:"",toolCalls:[],stopReason:"end_turn"}}formatToolResults(){return{role:"user",content:[]}}formatAssistantWithToolCalls(e){return{role:"assistant",content:e||""}}}function oR(i={}){const e=i.provider||"anthropic";if(e==="anthropic")return new rR(i);if(e==="none")return new aR;throw new Error(`Unsupported provider: ${e}. Supported: anthropic, none`)}class cR{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 lR{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 hR{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 uR(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new cR(i);if(e==="elevenlabs")return new hR(i);throw new Error(`TTS provider "${e}" not implemented yet`)}function dR(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new lR(i);throw new Error(`STT provider "${e}" not implemented yet`)}const H0=[{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"]}}],fR=[{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"]}}],pR={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)}},AR=8;class z0 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=oR({...this.manifest.brain,...r}),this.tts=uR({...this.manifest.voice?.tts,...a.tts}),this.stt=dR({...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 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/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2l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OgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQA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IgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqK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0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABK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E2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0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AAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/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",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(`<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||H0.map(r=>r.name)),t=H0.filter(r=>e.has(r.name)),n=this.skills?this.skills.allTools():[],s=this.stage?fR:[];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++<AR;){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=pR[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 wf=["https://dweb.link/ipfs/","https://cloudflare-ipfs.com/ipfs/","https://ipfs.io/ipfs/"],gR="https://arweave.net/";function Ws(i,e=0){if(!i)return i;const t=i.match(/^ipfs:\/\/(.+)$/i);if(t)return wf[e%wf.length]+t[1];const n=i.match(/^ar:\/\/(.+)$/i);return n?gR+n[1]:i}async function V0(i){let e;for(let t=0;t<wf.length;t++){const n=Ws(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 mR={idle:"idle",wave:"reaction",nod:"reaction",shake:"angry",think:"pray",celebrate:"celebrate",concern:"defeated",bow:"sitclap",point:"reaction",shrug:"defeated"};function xR(i,e){return e&&e[i]?e[i]:mR[i]??i}const W0={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 q0{constructor(e){this.viewer=e,this._loader=new _d,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 xR(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=Ws(e);return new Promise((n,s)=>{this._loader.load(t,r=>n(r.animations?.[0]||null),void 0,s)})}async loadGLB(e){const t=Ws(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=W0[e]||W0.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 bR=`// 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||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.// 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,Ra=null;const Fa=new Map,Ko=new Map,qs=new Map,Yl=new Map;let ER=0,yR=0;function K0(i){if(i==null)return null;const e=`@h:${++ER}`;return Yl.set(e,i),e}function _R(i){return typeof i=="string"&&i.startsWith("@h:")?Yl.get(i)??i:i}function wR(i){return Array.isArray(i)?i.map(_R):i}function j0(){if(!di){if(!Ra){const i=new Blob([bR],{type:"text/javascript"});Ra=URL.createObjectURL(i)}di=new Worker(Ra),di.onmessage=CR,di.onerror=vR}return di}function vR(i){console.error("[sandbox] worker crashed:",i),di=null,Fa.clear(),Ko.clear(),Yl.clear();for(const[,e]of qs)e.reject(new Error("Sandbox worker crashed"));qs.clear()}function CR({data:i}){switch(i.type){case"install-ack":{const e=Ko.get(i.skillURI);Ko.delete(i.skillURI),i.ok?e?.resolve():(Fa.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}SR(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 SR(i,e,t){const n=wR(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 K0(s)}case"loadGLB":{const s=await t.loadGLB?.(n[0]);return K0(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 IR(i,e){if(Fa.has(i))return Fa.get(i);const t=new Promise((n,s)=>{Ko.set(i,{resolve:n,reject:s})});return Fa.set(i,t),j0().postMessage({type:"install",skillURI:i,handlersSrc:e}),t}async function MR(i,e,t,n,s){await IR(i,n);const r=++yR,a=j0();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 BR(){if(di){di.terminate(),di=null,Ra&&(URL.revokeObjectURL(Ra),Ra=null),Fa.clear(),Ko.clear(),Yl.clear();for(const[,i]of qs)i.reject(new Error("Sandbox terminated"));qs.clear()}}function TR(){return{invoke:MR,terminate:BR}}function RR(i,e){return/^([a-z]+:|\/)/i.test(e)?e:(i.endsWith("/")||(i+="/"),i+e)}class X0{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 TR().invoke(this.uri,e,t,this.handlersSrc,s)}systemPromptFragment(){return this.instructions?`+`;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?`<skill name="${this.name}" version="${this.version}">${this.instructions}-</skill>`:""}}class Y0{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 X0({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=RR(t,e)),n.endsWith("/")||(n+="/"),(n.startsWith("ipfs://")||n.startsWith("ar://"))&&(n=Ws(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 FR=/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;function Jl(i){const e=i.match(FR);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 DR(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?Jl(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&&Jl(l).meta.created||c,u={name:t,description:n,type:s,created:h,updated:c};a&&(u.decay=a),this.files.set(o,DR(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}=Jl(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}=Jl(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 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(``)}_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 NR="6.16.0";function LR(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&&LR(s,r,n),Object.defineProperty(i,n,{enumerable:!0,value:s,writable:!1})}}function Da(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=>Da(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 Da(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=>`${Da(n,e)}: ${Da(i[n],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Tn(i,e){return i&&i.code===e}function vf(i){return Tn(i,"CALL_EXCEPTION")}function zt(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: ${Da(t)}`);for(const a in t){if(a==="shortMessage")continue;const o=t[a];r.push(a+"="+Da(o))}}r.push(`code=${e}`),r.push(`version=${NR}`),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 zt(e,t,n)}function V(i,e,t,n){pe(i,e,"INVALID_ARGUMENT",{argument:t,value:n})}function J0(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 Zl(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 Z0(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 Z0(i,e,!1)}function Hn(i,e){return Z0(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 Cf(i){return Pt(i,!0)||i instanceof Uint8Array}const $0="0123456789abcdef";function Ce(i){const e=ut(i);let t="0x";for(let n=0;n<e.length;n++){const s=e[n];t+=$0[(s&240)>>4]+$0[s&15]}return t}function Qt(i){return"0x"+i.map(e=>Ce(e).substring(2)).join("")}function Na(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 ex(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 ls(i,e){return ex(i,e,!0)}function PR(i,e){return ex(i,e,!1)}const jo=BigInt(0),Bi=BigInt(1),La=9007199254740991;function kR(i,e){const t=$l(i,"value"),n=BigInt(dt(e,"width"));if(pe(t>>n===jo,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:i}),t>>n-Bi){const s=(Bi<<n)-Bi;return-((~t&s)+Bi)}return t}function tx(i,e){let t=De(i,"value");const n=BigInt(dt(e,"width")),s=Bi<<n-Bi;if(t<jo){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 Xo(i,e){const t=$l(i,"value"),n=BigInt(dt(e,"bits"));return t&(Bi<<n)-Bi}function De(i,e){switch(typeof i){case"bigint":return i;case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-La&&i<=La,"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 $l(i,e){const t=De(i,e);return pe(t>=jo,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:i}),t}const nx="0123456789abcdef";function Sf(i){if(i instanceof Uint8Array){let e="0x0";for(const t of i)e+=nx[t>>4],e+=nx[t&15];return BigInt(e)}return De(i)}function dt(i,e){switch(typeof i){case"bigint":return V(i>=-La&&i<=La,"overflow",e||"value",i),Number(i);case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-La&&i<=La,"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 UR(i){return dt(Sf(i))}function Ks(i,e){const t=$l(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=$l(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 Ti(i){let e=Ce(Cf(i)?i:rn(i)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const ix="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const sx=BigInt(58);function OR(i){const e=ut(i);let t=Sf(e),n="";for(;t;)n=ix[Number(t%sx)]+n,t/=sx;for(let s=0;s<e.length&&!e[s];s++)n=ix[0]+n;return n}function QR(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 GR(i){const e=ut(i);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}class rx{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 HR(i,e,t,n,s){V(!1,`invalid codepoint at offset ${e}; ${i}`,"bytes",t)}function ax(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 zR(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),ax(i,e,t))}const VR=Object.freeze({error:HR,ignore:ax,replace:zR});function WR(i,e){e==null&&(e=VR.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 hs(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 qR(i){return i.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function eh(i,e){return qR(WR(i,e))}function ox(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=zt("request timeout","TIMEOUT"),a.abort()},t.timeout);n&&n.addListener(()=>{r=zt("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 KR=12,jR=250;let cx=ox();const XR=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),YR=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let If=!1;async function lx(i,e){try{const t=i.match(XR);if(!t)throw new Error("invalid data");return new js(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?QR(t[3]):ZR(t[3]))}catch{return new js(599,"BAD REQUEST (invalid data: URI)",{},null,new Hi(i))}}function hx(i){async function e(t,n){try{const s=t.match(YR);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 th={data:lx,ipfs:hx("https://gateway.ipfs.io/ipfs/")},ux=new WeakMap;class JR{#e;#t;constructor(e){this.#e=[],this.#t=!1,ux.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 nh(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=hs(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=hs(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 ${GR(hs(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||cx}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:jR,maxAttempts:KR},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(dx()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),n>0&&await $R(n);let a=this.clone();const o=(a.url.split(":")[0]||"").toLowerCase();if(o in th){const h=await th[o](a.url,nh(s.#c));if(h instanceof js){let u=h;if(this.processFunc){nh(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,nh(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){nh(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 JR(this),this.#d(0,dx()+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=ux.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(){If=!0}static getGateway(e){return th[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(If)throw new Error("gateways locked");th[e]=t}static registerGetUrl(e){if(If)throw new Error("gateways locked");cx=e}static createGetUrlFunc(e){return ox(e)}static createDataGateway(){return lx}static createIpfsGatewayFunc(e){return hx(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?"":eh(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=eh(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 dx(){return new Date().getTime()}function ZR(i){return hs(i.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function $R(i){return new Promise(e=>setTimeout(e,i))}function eF(i){let e=i.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function fx(i,e,t){let n=0;for(let s=0;s<t;s++)n=n*256+i[e+s];return n}function px(i,e,t,n){const s=[];for(;t<e+1+n;){const r=Ax(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 Ax(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=fx(i,e+1,n);return t(e+1+n+s),px(i,e,e+1+n,n+s)}else if(i[e]>=192){const n=i[e]-192;return t(e+1+n),px(i,e,e+1,n)}else if(i[e]>=184){const n=i[e]-183;t(e+1+n);const s=fx(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:eF(i[e])}}function Yo(i){const e=ut(i,"data"),t=Ax(e,0);return V(t.consumed===e.length,"unexpected junk after rlp payload","data",i),t.result}function gx(i){const e=[];for(;i;)e.unshift(i&255),i>>=8;return e}function mx(i){if(Array.isArray(i)){let n=[];if(i.forEach(function(r){n=n.concat(mx(r))}),n.length<=55)return n.unshift(192+n.length),n;const s=gx(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=gx(e.length);return t.unshift(183+t.length),t.concat(e)}const xx="0123456789abcdef";function us(i){let e="0x";for(const t of mx(i))e+=xx[t>>4],e+=xx[t&15];return e}const zn=32,Mf=new Uint8Array(zn),tF=["then"],ih={},bx=new WeakMap;function vr(i){return bx.get(i)}function Ex(i,e){bx.set(i,e)}function Jo(i,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${i}`);throw t.error=e,t}function Bf(i,e,t){return i.indexOf(null)>=0?e.map((n,s)=>n instanceof ds?Bf(vr(n),n,t):n):i.reduce((n,s,r)=>{let a=e.getValue(s);return s in n||(t&&a instanceof ds&&(a=Bf(vr(a),a,t)),n[s]=a),n},{})}class ds extends Array{#e;constructor(...e){const t=e[0];let n=e[1],s=(e[2]||[]).slice(),r=!0;t!==ih&&(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(Ex(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&&Jo(`index ${d}`,f),f}if(tF.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 Ex(o,vr(this)),o}toArray(e){const t=[];return this.forEach((n,s)=>{n instanceof Error&&Jo(`index ${s}`,n),e&&n instanceof ds&&(n=n.toArray(e)),t.push(n)}),t}toObject(e){const t=vr(this);return t.reduce((n,s,r)=>(pe(s!=null,`value at index ${r} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Bf(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=vr(this),s=[],r=[];for(let a=e;a<t;a++)s.push(this[a]),r.push(n[a]);return new ds(ih,s,r)}filter(e,t){const n=vr(this),s=[],r=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&Jo(`index ${a}`,o),e.call(t,o,a,this)&&(s.push(o),r.push(n[a]))}return new ds(ih,s,r)}map(e,t){const n=[];for(let s=0;s<this.length;s++){const r=this[s];r instanceof Error&&Jo(`index ${s}`,r),n.push(e.call(t,r,s,this))}return n}getValue(e){const t=vr(this).indexOf(e);if(t===-1)return;const n=this[t];return n instanceof Error&&Jo(`property ${JSON.stringify(e)}`,n.error),n}static fromItems(e,t){return new ds(ih,e,t)}}function yx(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(Qt([Mf.slice(e.length%zn),e]))),e}class fs{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 Tf{#e;#t;constructor(){this.#e=[],this.#t=0}get data(){return Qt(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(Qt([t,Mf.slice(n)]))),this.#n(t)}writeValue(e){return this.#n(yx(e))}writeUpdatableValue(){const e=this.#e.length;return this.#e.push(Mf),this.#t+=zn,t=>{this.#e[e]=yx(t)}}}class Rf{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 Rf(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 Sf(this.readBytes(zn))}readIndex(){return UR(this.readBytes(zn))}}function sh(i){if(!Number.isSafeInteger(i)||i<0)throw new Error(`Wrong positive integer: ${i}`)}function Ff(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 nF(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");sh(i.outputLen),sh(i.blockLen)}function Pa(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 _x(i,e){Ff(i);const t=e.outputLen;if(i.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const Df=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;const wx=i=>i instanceof Uint8Array,iF=i=>new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)),Nf=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 sF(i){if(typeof i!="string")throw new Error(`utf8ToBytes expected string, got ${typeof i}`);return new Uint8Array(new TextEncoder().encode(i))}function rh(i){if(typeof i=="string"&&(i=sF(i)),!wx(i))throw new Error(`expected Uint8Array, got ${typeof i}`);return i}function rF(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!wx(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}class Lf{clone(){return this._cloneInto()}}function Pf(i){const e=n=>i().update(rh(n)).digest(),t=i();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>i(),e}function aF(i=32){if(Df&&typeof Df.getRandomValues=="function")return Df.getRandomValues(new Uint8Array(i));throw new Error("crypto.getRandomValues must be defined")}class vx extends Lf{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,nF(e);const n=rh(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 Pa(this),this.iHash.update(e),this}digestInto(e){Pa(this),Ff(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 Cx=(i,e,t)=>new vx(i,e).update(t).digest();Cx.create=(i,e)=>new vx(i,e);function oF(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 Sx extends Lf{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=Nf(this.buffer)}update(e){Pa(this);const{view:t,buffer:n,blockLen:s}=this;e=rh(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=Nf(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){Pa(this),_x(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;oF(n,s-8,BigInt(this.length*8),r),this.process(n,0);const o=Nf(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 cF=(i,e,t)=>i&e^~i&t,lF=(i,e,t)=>i&e^i&t^e&t,hF=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 uF extends Sx{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+cF(o,c,l)+hF[u]+Ys[u]|0,m=(zi(n,2)^zi(n,13)^zi(n,22))+lF(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 Ix=Pf(()=>new uF),ah=BigInt(2**32-1),kf=BigInt(32);function Mx(i,e=!1){return e?{h:Number(i&ah),l:Number(i>>kf&ah)}:{h:Number(i>>kf&ah)|0,l:Number(i&ah)|0}}function Bx(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}=Mx(i[s],e);[t[s],n[s]]=[r,a]}return[t,n]}const dF=(i,e)=>BigInt(i>>>0)<<kf|BigInt(e>>>0),fF=(i,e,t)=>i>>>t,pF=(i,e,t)=>i<<32-t|e>>>t,AF=(i,e,t)=>i>>>t|e<<32-t,gF=(i,e,t)=>i<<32-t|e>>>t,mF=(i,e,t)=>i<<64-t|e>>>t-32,xF=(i,e,t)=>i>>>t-32|e<<64-t,bF=(i,e)=>e,EF=(i,e)=>i,Tx=(i,e,t)=>i<<t|e>>>32-t,Rx=(i,e,t)=>e<<t|i>>>32-t,Fx=(i,e,t)=>e<<t-32|i>>>64-t,Dx=(i,e,t)=>i<<t-32|e>>>64-t;function yF(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:Mx,split:Bx,toBig:dF,shrSH:fF,shrSL:pF,rotrSH:AF,rotrSL:gF,rotrBH:mF,rotrBL:xF,rotr32H:bF,rotr32L:EF,rotlSH:Tx,rotlSL:Rx,rotlBH:Fx,rotlBL:Dx,add:yF,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)},[_F,wF]=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 vF extends Sx{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,I=Zs[x-15]|0,w=lt.rotrSH(E,I,1)^lt.rotrSH(E,I,8)^lt.shrSH(E,I,7),S=lt.rotrSL(E,I,1)^lt.rotrSL(E,I,8)^lt.shrSL(E,I,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(S,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),I=lt.rotrSL(u,d,14)^lt.rotrSL(u,d,18)^lt.rotrBL(u,d,41),w=u&f^~u&m,S=d&p^~d&g,T=lt.add5L(_,I,S,wF[x],Zs[x]),C=lt.add5H(T,A,E,w,_F[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 N=lt.add3L(v,K,$);n=lt.add3H(N,C,F,q),s=N|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 CF=Pf(()=>new vF);function SF(){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 Nx=SF();Nx.crypto||Nx.msCrypto;function IF(i){switch(i){case"sha256":return Ix.create();case"sha512":return CF.create()}V(!1,"invalid hashing algorithm name","algorithm",i)}const[Lx,Px,kx]=[[],[],[]],MF=BigInt(0),Zo=BigInt(1),BF=BigInt(2),TF=BigInt(7),RF=BigInt(256),FF=BigInt(113);for(let i=0,e=Zo,t=1,n=0;i<24;i++){[t,n]=[n,(2*t+3*n)%5],Lx.push(2*(5*n+t)),Px.push((i+1)*(i+2)/2%64);let s=MF;for(let r=0;r<7;r++)e=(e<<Zo^(e>>TF)*FF)%RF,e&BF&&(s^=Zo<<(Zo<<BigInt(r))-Zo);kx.push(s)}const[DF,NF]=Bx(kx,!0),Ux=(i,e,t)=>t>32?Fx(i,e,t):Tx(i,e,t),Ox=(i,e,t)=>t>32?Dx(i,e,t):Rx(i,e,t);function LF(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=Ux(l,h,1)^t[o],d=Ox(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=Px[a],c=Ux(s,r,o),l=Ox(s,r,o),h=Lx[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]^=DF[n],i[1]^=NF[n]}t.fill(0)}class Uf extends Lf{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,sh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=iF(this.state)}keccak(){LF(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Pa(this);const{blockLen:t,state:n}=this;e=rh(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){Pa(this,!1),Ff(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 sh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(_x(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 Uf(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 PF=((i,e,t)=>Pf(()=>new Uf(e,i,t)))(1,136,256/8);let Qx=!1;const Gx=function(i){return PF(i)};let Hx=Gx;function an(i){const e=ut(i,"data");return Ce(Hx(e))}an._=Gx,an.lock=function(){Qx=!0},an.register=function(i){if(Qx)throw new TypeError("keccak256 is locked");Hx=i},Object.freeze(an);const zx=function(i){return IF("sha256").update(i).digest()};let Vx=zx,Wx=!1;function ka(i){const e=ut(i,"data");return Ce(Vx(e))}ka._=zx,ka.lock=function(){Wx=!0},ka.register=function(i){if(Wx)throw new Error("sha256 is locked");Vx=i},Object.freeze(ka),Object.freeze(ka);BigInt(0);const kF=BigInt(1),UF=BigInt(2),oh=i=>i instanceof Uint8Array,OF=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ua(i){if(!oh(i))throw new Error("Uint8Array expected");let e="";for(let t=0;t<i.length;t++)e+=OF[i[t]];return e}function Of(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return BigInt(i===""?"0":`0x${i}`)}function $o(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 Cr(i){return Of(Ua(i))}function Qf(i){if(!oh(i))throw new Error("Uint8Array expected");return Of(Ua(Uint8Array.from(i).reverse()))}function Oa(i,e){return $o(i.toString(16).padStart(e*2,"0"))}function Gf(i,e){return Oa(i,e).reverse()}function Ri(i,e,t){let n;if(typeof e=="string")try{n=$o(e)}catch(r){throw new Error(`${i} must be valid hex string, got "${e}". Cause: ${r}`)}else if(oh(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 ec(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!oh(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}const Hf=i=>(UF<<BigInt(i-1))-kF,zf=i=>new Uint8Array(i),qx=i=>Uint8Array.from(i);function Kx(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=zf(i),s=zf(i),r=0;const a=()=>{n.fill(1),s.fill(0),r=0},o=(...u)=>t(s,n,...u),c=(u=zf())=>{s=o(qx([0]),u),n=o(),u.length!==0&&(s=o(qx([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 ec(...d)};return(u,d)=>{a(),c(u);let f;for(;!(f=d(l()));)c();return a(),f}}const QF={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 tc(i,e,t={}){const n=(s,r,a)=>{const o=QF[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 GF=Object.freeze(Object.defineProperty({__proto__:null,bitMask:Hf,bytesToHex:Ua,bytesToNumberBE:Cr,bytesToNumberLE:Qf,concatBytes:ec,createHmacDrbg:Kx,ensureBytes:Ri,hexToBytes:$o,hexToNumber:Of,numberToBytesBE:Oa,numberToBytesLE:Gf,validateObject:tc},Symbol.toStringTag,{value:"Module"}));const yn=BigInt(0),en=BigInt(1),Sr=BigInt(2),HF=BigInt(3),Vf=BigInt(4),jx=BigInt(5),Xx=BigInt(8);BigInt(9),BigInt(16);function jn(i,e){const t=i%e;return t>=yn?t:e+t}function zF(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 Wf(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 VF(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&&zF(s,e,i)!==i-en;s++);if(n===1){const a=(i+en)/Vf;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 WF(i){if(i%Vf===HF){const e=(i+en)/Vf;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%Xx===jx){const e=(i-jx)/Xx;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 VF(i)}const qF=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function KF(i){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=qF.reduce((n,s)=>(n[s]="function",n),e);return tc(i,t)}function jF(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 XF(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 Yx(i,e){const t=e!==void 0?e:i.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function YF(i,e,t=!1,n={}){if(i<=yn)throw new Error(`Expected Field ORDER > 0, got ${i}`);const{nBitLength:s,nByteLength:r}=Yx(i,e);if(r>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=WF(i),o=Object.freeze({ORDER:i,BITS:s,BYTES:r,MASK:Hf(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)=>jF(o,c,l),div:(c,l)=>jn(c*Wf(l,i),i),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>Wf(c,i),sqrt:n.sqrt||(c=>a(o,c)),invertBatch:c=>XF(o,c),cmov:(c,l,h)=>h?l:c,toBytes:c=>t?Gf(c,r):Oa(c,r),fromBytes:c=>{if(c.length!==r)throw new Error(`Fp.fromBytes: expected ${r}, got ${c.length}`);return t?Qf(c):Cr(c)}});return Object.freeze(o)}function Jx(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 Zx(i){const e=Jx(i);return e+Math.ceil(e/2)}function JF(i,e,t=!1){const n=i.length,s=Jx(e),r=Zx(e);if(n<16||n<r||n>1024)throw new Error(`expected ${r}-1024 bytes of input, got ${n}`);const a=t?Cr(i):Qf(i),o=jn(a,e-en)+en;return t?Gf(o,s):Oa(o,s)}const ZF=BigInt(0),qf=BigInt(1);function $F(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>ZF;)r&qf&&(a=a.add(o)),o=o.double(),r>>=qf;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+=qf);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 $x(i){return KF(i.Fp),tc(i,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Yx(i.n,i.nBitLength),...i,p:i.Fp.ORDER})}function eD(i){const e=$x(i);tc(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:tD,hexToBytes:nD}=GF,Ir={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(i){const{Err:e}=Ir;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:tD(n),l:i.subarray(t+2)}},toSig(i){const{Err:e}=Ir,t=typeof i=="string"?nD(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}=Ir._parseInt(t.subarray(2)),{d:a,l:o}=Ir._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}`}},ps=BigInt(0),pi=BigInt(1);BigInt(2);const eb=BigInt(3);BigInt(4);function iD(i){const e=eD(i),{Fp:t}=e,n=e.toBytes||((p,m,g)=>{const A=m.toAffine();return ec(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"&&ps<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=Ua(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:Cr(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:I}=m,w=t.eql(t.mul(g,I),t.mul(x,_)),S=t.eql(t.mul(A,I),t.mul(E,_));return w&&S}negate(){return new u(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,A=t.mul(g,eb),{px:_,py:x,pz:E}=this;let I=t.ZERO,w=t.ZERO,S=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),S=t.mul(_,E),S=t.add(S,S),I=t.mul(m,S),w=t.mul(A,v),w=t.add(I,w),I=t.sub(C,w),w=t.add(C,w),w=t.mul(I,w),I=t.mul(F,I),S=t.mul(A,S),v=t.mul(m,v),F=t.sub(T,v),F=t.mul(m,F),F=t.add(F,S),S=t.add(T,T),T=t.add(S,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),I=t.sub(I,T),S=t.mul(v,C),S=t.add(S,S),S=t.add(S,S),new u(I,w,S)}add(m){h(m);const{px:g,py:A,pz:_}=this,{px:x,py:E,pz:I}=m;let w=t.ZERO,S=t.ZERO,T=t.ZERO;const C=e.a,v=t.mul(e.b,eb);let F=t.mul(g,x),K=t.mul(A,E),q=t.mul(_,I),$=t.add(g,A),N=t.add(x,E);$=t.mul($,N),N=t.add(F,K),$=t.sub($,N),N=t.add(g,_);let O=t.add(x,I);return N=t.mul(N,O),O=t.add(F,q),N=t.sub(N,O),O=t.add(A,_),w=t.add(E,I),O=t.mul(O,w),w=t.add(K,q),O=t.sub(O,w),T=t.mul(C,N),w=t.mul(v,q),T=t.add(w,T),w=t.sub(K,T),T=t.add(K,T),S=t.mul(w,T),K=t.add(F,F),K=t.add(K,F),q=t.mul(C,q),N=t.mul(v,N),K=t.add(K,q),q=t.sub(F,q),q=t.mul(C,q),N=t.add(N,q),F=t.mul(K,N),S=t.add(S,F),F=t.mul(O,N),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,S,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===ps)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:I}=A.splitScalar(m),w=g,S=g,T=this;for(;x>ps||I>ps;)x&pi&&(w=w.add(T)),I&pi&&(S=S.add(T)),T=T.double(),x>>=pi,I>>=pi;return _&&(w=w.negate()),E&&(S=S.negate()),S=new u(t.mul(S.px,A.beta),S.py,S.pz),w.add(S)}multiply(m){o(m);let g=m,A,_;const{endo:x}=e;if(x){const{k1neg:E,k1:I,k2neg:w,k2:S}=x.splitScalar(g);let{p:T,f:C}=this.wNAF(I),{p:v,f:F}=this.wNAF(S);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:I}=this.wNAF(g);A=E,_=I}return u.normalizeZ([A,_])[0]}multiplyAndAddUnsafe(m,g,A){const _=u.BASE,x=(I,w)=>w===ps||w===pi||!I.equals(_)?I.multiplyUnsafe(w):I.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),I=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:I}}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 Ua(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=$F(u,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:r,isWithinCurveOrder:a}}function sD(i){const e=$x(i);return tc(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function rD(i){const e=sD(i),{Fp:t,n}=e,s=t.BYTES+1,r=2*t.BYTES+1;function a(N){return ps<N&&N<t.ORDER}function o(N){return jn(N,n)}function c(N){return Wf(N,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:h,weierstrassEquation:u,isWithinCurveOrder:d}=iD({...e,toBytes(N,O,Y){const Q=O.toAffine(),J=t.toBytes(Q.x),ee=ec;return Y?ee(Uint8Array.from([O.hasEvenY()?2:3]),J):ee(Uint8Array.from([4]),J,t.toBytes(Q.y))},fromBytes(N){const O=N.length,Y=N[0],Q=N.subarray(1);if(O===s&&(Y===2||Y===3)){const J=Cr(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=N=>Ua(Oa(N,e.nByteLength));function p(N){const O=n>>pi;return N>O}function m(N){return p(N)?o(-N):N}const g=(N,O,Y)=>Cr(N.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}=Ir.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=S(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 $o(this.toDERHex())}toDERHex(){return Ir.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return $o(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const _={isValidPrivateKey(N){try{return h(N),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const N=Zx(e.n);return JF(e.randomBytes(N),e.n)},precompute(N=8,O=l.BASE){return O._setWindowSize(N),O.multiply(BigInt(3)),O}};function x(N,O=!0){return l.fromPrivateKey(N).toRawBytes(O)}function E(N){const O=N instanceof Uint8Array,Y=typeof N=="string",Q=(O||Y)&&N.length;return O?Q===s||Q===r:Y?Q===2*s||Q===2*r:N instanceof l}function I(N,O,Y=!0){if(E(N))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(N)).toRawBytes(Y)}const w=e.bits2int||function(N){const O=Cr(N),Y=N.length*8-e.nBitLength;return Y>0?O>>BigInt(Y):O},S=e.bits2int_modN||function(N){return o(w(N))},T=Hf(e.nBitLength);function C(N){if(typeof N!="bigint")throw new Error("bigint expected");if(!(ps<=N&&N<T))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Oa(N,e.nByteLength)}function v(N,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),N=Ri("msgHash",N),ae&&(N=Ri("prehashed msgHash",Q(N)));const Me=S(N),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=ec(...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===ps)return;const H=o(Mt*o(be+$e*se));if(H===ps)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(N,O,Y=F){const{seed:Q,k2sig:J}=v(N,O,Y),ee=e;return Kx(ee.hash.outputLen,ee.nByteLength,ee.hmac)(Q,J)}l.BASE._setWindowSize(8);function $(N,O,Y,Q=K){const J=N;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 Ir.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=S(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:I,sign:q,verify:$,ProjectivePoint:l,Signature:A,utils:_}}function aD(i){return{hash:i,hmac:(e,...t)=>Cx(i,e,rF(...t)),randomBytes:aF}}function oD(i,e){const t=n=>rD({...i,...aD(n)});return Object.freeze({...t(e),create:t})}const tb=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),nb=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),cD=BigInt(1),Kf=BigInt(2),ib=(i,e)=>(i+e/Kf)/e;function lD(i){const e=tb,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,Kf,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,I=fi(E,n,e)*l%e,w=fi(I,Kf,e);if(!jf.eql(jf.sqr(w),i))throw new Error("Cannot find square root");return w}const jf=YF(tb,void 0,void 0,{sqrt:lD}),$s=oD({a:BigInt(0),b:BigInt(7),Fp:jf,n:nb,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:i=>{const e=nb,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-cD*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),r=t,a=BigInt("0x100000000000000000000000000000000"),o=ib(r*i,e),c=ib(-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}}}},Ix);BigInt(0),$s.ProjectivePoint;const nc="0x0000000000000000000000000000000000000000",sb="0x0000000000000000000000000000000000000000000000000000000000000000",rb=BigInt(0),ab=BigInt(1),Xf=BigInt(2),ob=BigInt(27),cb=BigInt(28),ch=BigInt(35),lb=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),hD=lb/Xf,uD=Symbol.for("nodejs.util.inspect.custom"),Mr={};function Yf(i){return ls(rn(i),32)}class Vt{#e;#t;#n;#i;get r(){return this.#e}set r(e){V(Na(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(Na(e)===32,"invalid s","value",e),this.#t=Ce(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=hD}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 Qt([this.r,this.yParityAndS])}get serialized(){return Qt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,n,s){Zl(e,Mr,"Signature"),this.#e=t,this.#t=n,this.#n=s,this.#i=null}getCanonical(){if(this.isValid())return this;const e=lb-BigInt(this._s),t=55-this.v,n=new Vt(Mr,this.r,Yf(e),t);return this.networkV&&(n.#i=this.networkV),n}clone(){const e=new Vt(Mr,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}}[uD](){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=De(e,"v");return t==ob||t==cb?rb:(V(t>=ch,"invalid EIP-155 v","v",e),(t-ch)/Xf)}static getChainIdV(e,t){return De(e)*Xf+BigInt(35+t-27)}static getNormalizedV(e){const t=De(e);return t===rb||t===ob?27:t===ab||t===cb?28:(V(t>=ch,"invalid v","v",e),t&ab?27:28)}static from(e){function t(l,h){V(l,h,"signature",e)}if(e==null)return new Vt(Mr,sb,sb,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(Mr,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(Mr,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=Yf(n),r=(function(l,h){if(l!=null)return Yf(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=De(l);return{networkV:d>=ch?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(Mr,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 As{#e;constructor(e){V(Na(e)===32,"invalid private key","privateKey","[REDACTED]"),this.#e=Ce(e)}get privateKey(){return this.#e}get publicKey(){return As.computePublicKey(this.#e)}get compressedPublicKey(){return As.computePublicKey(this.#e,!0)}sign(e){V(Na(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=As.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(Na(e)===32,"invalid digest length","digest",e);const n=Vt.from(t);let s=$s.Signature.fromCompact(Hn(Qt([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(As.computePublicKey(e).substring(2)),r=$s.ProjectivePoint.fromHex(As.computePublicKey(t).substring(2));return"0x"+s.add(r).toHex(!!n)}}const dD=BigInt(0),fD=BigInt(36);function hb(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 Jf={};for(let i=0;i<10;i++)Jf[String(i)]=String(i);for(let i=0;i<26;i++)Jf[String.fromCharCode(65+i)]=String(10+i);const ub=15;function pD(i){i=i.toUpperCase(),i=i.substring(4)+i.substring(0,2)+"00";let e=i.split("").map(n=>Jf[n]).join("");for(;e.length>=ub;){let n=e.substring(0,ub);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 AD=(function(){const i={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];i[t]=BigInt(e)}return i})();function gD(i){i=i.toLowerCase();let e=dD;for(let t=0;t<i.length;t++)e=e*fD+AD[i[t]];return e}function It(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=hb(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)===pD(i),"bad icap checksum","address",i);let e=gD(i.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return hb("0x"+e)}V(!1,"invalid address","address",i)}function mD(i){const e=It(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,It(Kt(an(us([e,n])),12))}function db(i){return i&&typeof i.getAddress=="function"}async function Zf(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)),It(t)}function Vn(i,e){if(typeof i=="string")return i.match(/^0x[0-9a-f]{40}$/i)?It(i):(pe(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Zf(i,e.resolveName(i)));if(db(i))return Zf(i,i.getAddress());if(i&&typeof i.then=="function")return Zf(i,i);V(!1,"unsupported addressable value","target",i)}const gs={};function Be(i,e){let t=!1;return e<0&&(t=!0,e*=-1),new jt(gs,`${t?"":"u"}int${e}`,i,{signed:t,width:e})}function wt(i,e){return new jt(gs,`bytes${e||""}`,i,{size:e})}const fb=Symbol.for("_ethers_typed");class jt{type;value;#e;_typedSymbol;constructor(e,t,n,s){s==null&&(s=null),Zl(gs,e,"Typed"),Ye(this,{_typedSymbol:fb,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(gs,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(gs,"address",e)}static bool(e){return new jt(gs,"bool",!!e)}static bytes(e){return new jt(gs,"bytes",e)}static string(e){return new jt(gs,"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(gs,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===fb}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 xD extends fs{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=jt.dereference(t,"string");try{n=It(n)}catch(s){return this._throwError(s.message,t)}return e.writeValue(n)}decode(e){return It(Ks(e.readValue(),20))}}class bD extends fs{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 pb(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 Tf,r=new Tf,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 Ab(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)}),ds.fromItems(t,n)}class ED extends fs{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)),J0(n.length,s,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let a=0;a<n.length;a++)r.push(this.coder);return pb(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 bD(this.coder));return Ab(e,n)}}class yD extends fs{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 gb extends fs{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 _D extends gb{constructor(e){super("bytes",e)}decode(e){return Ce(super.decode(e))}}class wD extends fs{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 vD=new Uint8Array([]);class CD extends fs{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(vD)}decode(e){return e.readBytes(0),null}}const SD=BigInt(0),ID=BigInt(1),MD=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class BD extends fs{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=De(jt.dereference(t,this.type)),s=Xo(MD,zn*8);if(this.signed){let r=Xo(s,this.size*8-1);(n>r||n<-(r+ID))&&this._throwError("value out-of-bounds",t),n=tx(n,8*zn)}else(n<SD||n>Xo(s,this.size*8))&&this._throwError("value out-of-bounds",t);return e.writeValue(n)}decode(e){let t=Xo(e.readValue(),this.size*8);return this.signed&&(t=kR(t,this.size*8)),t}}class TD extends gb{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,hs(jt.dereference(t,"string")))}decode(e){return eh(super.decode(e))}}class lh extends fs{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 pb(e,this.coders,n)}decode(e){return Ab(e,this.coders)}}function $f(i,e){return{address:It(i),storageKeys:e.map((t,n)=>(V(Pt(t,32),"invalid slot",`storageKeys[${n}]`,t),t.toLowerCase()))}}function Br(i){if(Array.isArray(i))return i.map((t,n)=>Array.isArray(t)?(V(t.length===2,"invalid slot set",`value[${n}]`,t),$f(t[0],t[1])):(V(t!=null&&typeof t=="object","invalid address-slot set","value",i),$f(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 $f(t,Object.keys(n).sort())});return e.sort((t,n)=>t.address.localeCompare(n.address)),e}function mb(i){return{address:It(i.address),nonce:De(i.nonce!=null?i.nonce:0),chainId:De(i.chainId!=null?i.chainId:0),signature:Vt.from(i.signature)}}function RD(i){let e;return typeof i=="string"?e=As.computePublicKey(i,!1):e=i.publicKey,It(an("0x"+e.substring(4)).substring(26))}function FD(i,e){return RD(As.recoverPublicKey(i,e))}const _n=BigInt(0),DD=BigInt(2),ND=BigInt(27),LD=BigInt(28),PD=BigInt(35),kD=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),UD=Symbol.for("nodejs.util.inspect.custom"),ep=4096*32,hh=128;function OD(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 xb(i,e){let t=i.toString(16);for(;t.length<2;)t="0"+t;return t+=ka(e).substring(4),"0x"+t}function Qa(i){return i==="0x"?null:It(i)}function uh(i,e){try{return Br(i)}catch(t){V(!1,t.message,e,i)}}function QD(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:Qa(s[1]),nonce:Dt(s[2],"nonce"),chainId:Dt(s[0],"chainId"),signature:Vt.from({yParity:Tr(s[3],"yParity"),r:ls(s[4],32),s:ls(s[5],32)})})}return t}catch(t){V(!1,t.message,e,i)}}function Tr(i,e){return i==="0x"?0:dt(i,e)}function Dt(i,e){if(i==="0x")return _n;const t=De(i,e);return V(t<=kD,"value exceeds uint size",e,t),t}function xt(i,e){const t=De(i,"value"),n=rn(t);return V(n.length<=32,"value too large",`tx.${e}`,t),n}function dh(i){return Br(i).map(e=>[e.address,e.storageKeys])}function GD(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 HD(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 zD(i){const e=Yo(i);V(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",i);const t={type:0,nonce:Tr(e[0],"nonce"),gasPrice:Dt(e[1],"gasPrice"),gasLimit:Dt(e[2],"gasLimit"),to:Qa(e[3]),value:Dt(e[4],"value"),data:Ce(e[5]),chainId:_n};if(e.length===6)return t;const n=Dt(e[6],"v"),s=Dt(e[7],"r"),r=Dt(e[8],"s");if(s===_n&&r===_n)t.chainId=n;else{let a=(n-PD)/DD;a<_n&&(a=_n),t.chainId=a,V(a!==_n||n===ND||n===LD,"non-canonical legacy v","v",e[6]),t.signature=Vt.from({r:ls(e[7],32),s:ls(e[8],32),v:n})}return t}function VD(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=De(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")),us(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)),us(t)}function fh(i,e){let t;try{if(t=Tr(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{V(!1,"invalid yParity","yParity",e[0])}const n=ls(e[1],32),s=ls(e[2],32),r=Vt.from({r:n,s,yParity:t});i.signature=r}function WD(i){const e=Yo(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:Dt(e[0],"chainId"),nonce:Tr(e[1],"nonce"),maxPriorityFeePerGas:Dt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Dt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Dt(e[4],"gasLimit"),to:Qa(e[5]),value:Dt(e[6],"value"),data:Ce(e[7]),accessList:uh(e[8],"accessList")};return e.length===9||fh(t,e.slice(9)),t}function qD(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,dh(i.accessList||[])];return e&&(t.push(xt(e.yParity,"yParity")),t.push(rn(e.r)),t.push(rn(e.s))),Qt(["0x02",us(t)])}function KD(i){const e=Yo(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:Dt(e[0],"chainId"),nonce:Tr(e[1],"nonce"),gasPrice:Dt(e[2],"gasPrice"),gasLimit:Dt(e[3],"gasLimit"),to:Qa(e[4]),value:Dt(e[5],"value"),data:Ce(e[6]),accessList:uh(e[7],"accessList")};return e.length===8||fh(t,e.slice(8)),t}function jD(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,dh(i.accessList||[])];return e&&(t.push(xt(e.yParity,"recoveryParam")),t.push(rn(e.r)),t.push(rn(e.s))),Qt(["0x01",us(t)])}function XD(i){let e=Yo(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*hh===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<hh;u++)h.push(c[l*hh+u]);s.push({data:a[l],commitment:o[l],proof:Qt(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:Dt(e[0],"chainId"),nonce:Tr(e[1],"nonce"),maxPriorityFeePerGas:Dt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Dt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Dt(e[4],"gasLimit"),to:Qa(e[5]),value:Dt(e[6],"value"),data:Ce(e[7]),accessList:uh(e[8],"accessList"),maxFeePerBlobGas:Dt(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||fh(r,e.slice(11)),r}function YD(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||nc,xt(i.value,"value"),i.data,dh(i.accessList||[]),xt(i.maxFeePerBlobGas||0,"maxFeePerBlobGas"),HD(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/hh;for(let l=0;l<o.length;l+=c)r.push(o.subarray(l,l+c))}return Qt(["0x03",us([n,s,t.map(a=>a.data),t.map(a=>a.commitment),r])])}return Qt(["0x03",us([n,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])])}return Qt(["0x03",us(n)])}function JD(i){const e=Yo(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:Dt(e[0],"chainId"),nonce:Tr(e[1],"nonce"),maxPriorityFeePerGas:Dt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Dt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Dt(e[4],"gasLimit"),to:Qa(e[5]),value:Dt(e[6],"value"),data:Ce(e[7]),accessList:uh(e[8],"accessList"),authorizationList:QD(e[9],"authorizationList")};return e.length===10||fh(t,e.slice(10)),t}function ZD(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,dh(i.accessList||[]),GD(i.authorizationList||[])];return e&&(t.push(xt(e.yParity,"yParity")),t.push(rn(e.r)),t.push(rn(e.s))),Qt(["0x04",us(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?nc:e}set to(e){this.#t=e==null?null:It(e)}get nonce(){return this.#i}set nonce(e){this.#i=dt(e,"value")}get gasLimit(){return this.#s}set gasLimit(e){this.#s=De(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:De(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:De(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:De(e,"maxFeePerGas")}get data(){return this.#n}set data(e){this.#n=Ce(e)}get value(){return this.#f}set value(e){this.#f=De(e,"value")}get chainId(){return this.#l}set chainId(e){this.#l=De(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:Br(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=>mb(t))}get maxFeePerBlobGas(){const e=this.#c;return e==null&&this.type===3?_n:e}set maxFeePerBlobGas(e){this.#c=e==null?null:De(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(Cf(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<=ep,"blob is too large",`blobs[${s}]`,r),a.length!==ep){const l=new Uint8Array(ep);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(xb(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(xb(1,o))}}this.#d=t,this.#h=n}get kzg(){return this.#u}set kzg(e){e==null?this.#u=null:this.#u=OD(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:FD(this.unsignedHash,this.signature.getCanonical())}get fromPublicKey(){return this.signature==null?null:As.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 VD(this,n);case 1:return jD(this,n);case 2:return qD(this,n);case 3:return YD(this,n,t?this.blobs:null);case 4:return ZD(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}}[UD](){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(zD(n));switch(n[0]){case 1:return Fi.from(KD(n));case 2:return Fi.from(WD(n));case 3:return Fi.from(XD(n));case 4:return Fi.from(JD(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 Rr(i){return an(hs(i))}var $D="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnI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pVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/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 bb=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Eb=4;function eN(i){let e=0;function t(){return i[e++]<<8|i[e++]}let n=t(),s=1,r=[0,1];for(let I=1;I<n;I++)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 I=0;I<u;I++)g=g<<1|h();let A=[],_=0,x=d;for(;;){let I=Math.floor(((g-_+1)*s-1)/x),w=0,S=n;for(;S-w>1;){let v=w+S>>>1;I<r[v]?S=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(I=>{switch(I-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 I-1}})}function tN(i){let e=0;return()=>i[e++]}function yb(i){return tN(eN(nN(i)))}function nN(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 iN(i){return i&1?~i>>1:i>>1}function sN(i,e){let t=Array(i);for(let n=0,s=0;n<i;n++)t[n]=s+=iN(e());return t}function ic(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 _b(i){return sc(()=>{let e=ic(i);if(e.length)return e})}function wb(i){let e=[];for(;;){let t=i();if(t==0)break;e.push(rN(t,i))}for(;;){let t=i()-1;if(t<0)break;e.push(aN(t,i))}return e.flat()}function sc(i){let e=[];for(;;){let t=i(e.length);if(!t)break;e.push(t)}return e}function vb(i,e,t){let n=Array(i).fill().map(()=>[]);for(let s=0;s<e;s++)sN(i,t).forEach((r,a)=>n[a].push(r));return n}function rN(i,e){let t=1+e(),n=e(),s=sc(e);return vb(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 aN(i,e){let t=1+e();return vb(t,1+i,e).map(s=>[s[0],s.slice(1)])}function oN(i){let e=[],t=ic(i);return s(n([]),[]),e;function n(r){let a=i(),o=sc(()=>{let c=ic(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 cN(i){return i.toString(16).toUpperCase().padStart(2,"0")}function Cb(i){return`{${cN(i)}}`}function lN(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 Ga(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 hN(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 uN="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBH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y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";const rc=44032,ph=4352,Ah=4449,gh=4519,Sb=19,Ib=21,Ha=28,mh=Ib*Ha,dN=Sb*mh,fN=rc+dN,pN=ph+Sb,AN=Ah+Ib,gN=gh+Ha;function ac(i){return i>>24&255}function Mb(i){return i&16777215}let tp,Bb,np,xh;function mN(){let i=yb(uN);tp=new Map(_b(i).flatMap((e,t)=>e.map(n=>[n,t+1<<24]))),Bb=new Set(ic(i)),np=new Map,xh=new Map;for(let[e,t]of wb(i)){if(!Bb.has(e)&&t.length==2){let[n,s]=t,r=xh.get(n);r||(r=new Map,xh.set(n,r)),r.set(s,e)}np.set(e,t.reverse())}}function Tb(i){return i>=rc&&i<fN}function xN(i,e){if(i>=ph&&i<pN&&e>=Ah&&e<AN)return rc+(i-ph)*mh+(e-Ah)*Ha;if(Tb(i)&&e>gh&&e<gN&&(i-rc)%Ha==0)return i+(e-gh);{let t=xh.get(i);return t&&(t=t.get(e),t)?t:-1}}function Rb(i){tp||mN();let e=[],t=[],n=!1;function s(r){let a=tp.get(r);a&&(n=!0,r|=a),e.push(r)}for(let r of i)for(;;){if(r<128)e.push(r);else if(Tb(r)){let a=r-rc,o=a/mh|0,c=a%mh/Ha|0,l=a%Ha;s(ph+o),s(Ah+c),l>0&&s(gh+l)}else{let a=np.get(r);a?t.push(...a):s(r)}if(!t.length)break;r=t.pop()}if(n&&e.length>1){let r=ac(e[0]);for(let a=1;a<e.length;a++){let o=ac(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=ac(e[--c]),r<=o))break}r=ac(e[a])}}return e}function bN(i){let e=[],t=[],n=-1,s=0;for(let r of i){let a=ac(r),o=Mb(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=xN(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 Fb(i){return Rb(i).map(Mb)}function EN(i){return bN(Rb(i))}const Db=45,Nb=".",Lb=65039,Pb=1,bh=i=>Array.from(i);function oc(i,e){return i.P.has(e)||i.Q.has(e)}class yN extends Array{get is_emoji(){return!0}}let ip,kb,Fr,sp,Ub,za,rp,Va,Dr,Ob,ap;function op(){if(ip)return;let i=yb($D);const e=()=>ic(i),t=()=>new Set(e()),n=(h,u)=>u.forEach(d=>h.add(d));ip=new Map(wb(i)),kb=t(),Fr=e(),sp=new Set(e().map(h=>Fr[h])),Fr=new Set(Fr),Ub=t(),t();let s=_b(i),r=i();const a=()=>{let h=new Set;return e().forEach(u=>n(h,s[u])),n(h,e()),h};za=sc(h=>{let u=sc(i).map(d=>d+96);if(u.length){let d=h>=r;u[0]-=32,u=Ga(u),d&&(u=`Restricted[${u}]`);let f=a(),p=a(),m=!i();return{N:u,P:f,Q:p,M:m,R:d}}}),rp=t(),Va=new Map;let o=e().concat(bh(rp)).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),rp.has(h)||Va.set(h,f)});for(let{V:h,M:u}of new Set(Va.values())){let d=[];for(let p of h){let m=za.filter(A=>oc(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=>bh(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 za){for(let u of h.P)l(u);for(let u of h.Q)l(u)}for(let h of Dr)!Va.has(h)&&!c.has(h)&&Va.set(h,Pb);n(Dr,Fb(Dr)),Ob=oN(i).map(h=>yN.from(h)).sort(hN),ap=new Map;for(let h of Ob){let u=[ap];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===Lb?u.push(...f):u=f}for(let d of u)d.V=h}}function cp(i){return(Qb(i)?"":`${lp(Eh([i]))} `)+Cb(i)}function lp(i){return`"${i}"`}function _N(i){if(i.length>=4&&i[2]==Db&&i[3]==Db)throw new Error(`invalid label extension: "${Ga(i.slice(0,4))}"`)}function wN(i){for(let t=i.lastIndexOf(95);t>0;)if(i[--t]!==95)throw new Error("underscore allowed only at start")}function vN(i){let e=i[0],t=bb.get(e);if(t)throw cc(`leading ${t}`);let n=i.length,s=-1;for(let r=1;r<n;r++){e=i[r];let a=bb.get(e);if(a){if(s==r)throw cc(`${t} + ${a}`);s=r+1,t=a}}if(s==n)throw cc(`trailing ${t}`)}function Eh(i,e=1/0,t=Cb){let n=[];CN(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];Qb(o)&&(n.push(Ga(i.slice(s,a))),n.push(t(o)),s=a+1)}return n.push(Ga(i.slice(s,r))),n.join("")}function CN(i){return op(),Fr.has(i)}function Qb(i){return op(),Ub.has(i)}function SN(i){return TN(IN(i,EN,DN))}function IN(i,e,t){if(!i)return[];op();let n=0;return i.split(Nb).map(s=>{let r=lN(s),a={input:r,offset:n};n+=r.length+1;try{let o=a.tokens=FN(r,e,t),c=o.length,l;if(!c)throw new Error("empty label");let h=a.output=o.flat();if(wN(h),!(a.emoji=c>1||o[0].is_emoji)&&h.every(d=>d<128))_N(h),l="ASCII";else{let d=o.flatMap(f=>f.is_emoji?[]:f);if(!d.length)l="Emoji";else{if(Fr.has(h[0]))throw cc("leading combining mark");for(let m=1;m<c;m++){let g=o[m];if(!g.is_emoji&&Fr.has(g[0]))throw cc(`emoji + combining mark: "${Ga(o[m-1])} + ${Eh([g[0]])}"`)}vN(h);let f=bh(new Set(d)),[p]=BN(f);RN(p,d),MN(p,f),l=p.N}}a.type=l}catch(o){a.error=o}return a})}function MN(i,e){let t,n=[];for(let s of e){let r=Va.get(s);if(r===Pb)return;if(r){let a=r.M.get(s);if(t=t?t.filter(o=>a.has(o)):bh(a),!t.length)return}else n.push(s)}if(t){for(let s of t)if(n.every(r=>oc(s,r)))throw new Error(`whole-script confusable: ${i.N}/${s.N}`)}}function BN(i){let e=za;for(let t of i){let n=e.filter(s=>oc(s,t));if(!n.length)throw za.some(s=>oc(s,t))?Hb(e[0],t):Gb(t);if(e=n,n.length==1)break}return e}function TN(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 ${lp(Eh(e,63))}: ${s}`)}return Ga(n)}).join(Nb)}function Gb(i){return new Error(`disallowed character: ${cp(i)}`)}function Hb(i,e){let t=cp(e),n=za.find(s=>s.P.has(e));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${i.N} + ${t}`)}function cc(i){return new Error(`illegal placement: ${i}`)}function RN(i,e){for(let t of e)if(!oc(i,t))throw Hb(i,t);if(i.M){let t=Fb(e);for(let n=1,s=t.length;n<s;n++)if(sp.has(t[n])){let r=n+1;for(let a;r<s&&sp.has(a=t[r]);r++)for(let o=n;o<r;o++)if(t[o]==a)throw new Error(`duplicate non-spacing marks: ${cp(a)}`);if(r-n>Eb)throw new Error(`excessive non-spacing marks: ${lp(Eh(t.slice(n-1,r)))} (${r-n}/${Eb})`);n=r}}}function FN(i,e,t){let n=[],s=[];for(i=i.slice().reverse();i.length;){let r=NN(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=ip.get(a);if(o)s.push(...o);else if(!kb.has(a))throw Gb(a)}}}return s.length&&n.push(e(s)),n}function DN(i){return i.filter(e=>e!=Lb)}function NN(i,e){let t=ap,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 zb=new Uint8Array(32);zb.fill(0);function Vb(i){return V(i.length!==0,"invalid ENS name; empty component","comp",i),i}function Wb(i){const e=hs(LN(i)),t=[];if(i.length===0)return t;let n=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(Vb(e.slice(n,s))),n=s+1);return V(n<e.length,"invalid ENS name; empty component","name",i),t.push(Vb(e.slice(n))),t}function LN(i){try{if(i.length===0)throw new Error("empty label");return SN(i)}catch(e){V(!1,`invalid ENS name (${e.message})`,"name",i)}}function hp(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=zb;const t=Wb(i);for(;t.length;)e=an(Qt([e,an(t.pop())]));return Ce(e)}function PN(i,e){const t=e;return V(t<=255,"DNS encoded label cannot exceed 255","length",t),Ce(Qt(Wb(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 qb=new Uint8Array(32);qb.fill(0);const kN=BigInt(-1),Kb=BigInt(0),jb=BigInt(1),UN=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function ON(i){const e=ut(i),t=e.length%32;return t?Qt([e,qb.slice(t)]):Ce(e)}const QN=Ks(jb,32),GN=Ks(Kb,32),Xb={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},up=["name","version","chainId","verifyingContract","salt"];function Yb(i){return function(e){return V(typeof e=="string",`invalid domain value for ${JSON.stringify(i)}`,`domain.${i}`,e),e}}const HN={name:Yb("name"),version:Yb("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):Ti(e)},verifyingContract:function(i){try{return It(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 dp(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=Xo(UN,t?n-1:n),r=t?(s+jb)*kN:Kb;return function(a){const o=De(a,"value");return V(o>=r&&o<=s,`value out-of-bounds for ${i}`,"value",o),Ks(t?tx(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),ON(n)}}}switch(i){case"address":return function(e){return ls(It(e),32)};case"bool":return function(e){return e?QN:GN};case"bytes":return function(e){return an(e)};case"string":return function(e){return Rr(e)}}return null}function Jb(i,e){return`${i}(${e.map(({name:t,type:n})=>n+" "+t).join(",")})`}function yh(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}=yh(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=yh(h.type).base;V(u!==c,`circular type reference to ${JSON.stringify(u)}`,"types",e),!dp(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,Jb(c,r[c])+h.map(u=>Jb(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=dp(e);if(s)return s}const t=yh(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(Qt(o))}}const n=this.types[e];if(n){const s=Rr(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),Qt(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(dp(e))return n(e,t);const s=yh(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=Xb[n];V(s,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:s})}return t.sort((n,s)=>up.indexOf(n.name)-up.indexOf(s.name)),ei.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return Qt(["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=[];up.forEach(c=>{const l=e[c];l!=null&&(s[c]=HN[c](l),r.push({name:c,type:Xb[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 De(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 zN=Wn("external public payable override".split(" ")),Zb="constant external internal payable private public pure view override",VN=Wn(Zb.split(" ")),$b="constructor error event fallback function receive struct",eE=Wn($b.split(" ")),tE="calldata memory storage payable indexed",WN=Wn(tE.split(" ")),qN=[$b,tE,"tuple returns",Zb].join(" "),KN=Wn(qN.split(" ")),jN={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},XN=new RegExp("^(\\s*)"),YN=new RegExp("^([0-9]+)"),JN=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),nE=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),iE=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(XN);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=jN[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(JN),o){if(c.text=o[1],r+=c.text.length,KN.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(iE)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match(YN),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 sE(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 _h(i,e){if(e.peekKeyword(eE)){const t=e.pop().text;if(t!==i)throw new Error(`expected ${i}, got ${t}`)}return e.popType("ID")}function ms(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 rE(i){let e=ms(i,VN);return sE(e,Wn("constant payable nonpayable".split(" "))),sE(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 xs(i,e){return i.popParams().map(t=>kt.from(t,e))}function aE(i){if(i.peekType("AT")){if(i.pop(),i.peekType("NUMBER"))return De(i.pop().text);throw new Error("invalid gas")}return null}function Nr(i){if(i.length)throw new Error(`unexpected tokens at offset ${i.offset}: ${i.toString()}`)}const ZN=new RegExp(/^(.*)\[([0-9]*)\]$/);function oE(i){const e=i.match(iE);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"),cE="_ParamTypeInternal",lE="_ErrorInternal",hE="_EventInternal",uE="_ConstructorInternal",dE="_FallbackInternal",fE="_FunctionInternal",pE="_StructInternal";class kt{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,n,s,r,a,o,c){if(Zl(e,Wt,"ParamType"),Object.defineProperty(this,Xn,{value:cE}),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;ms(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=oE(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(ms(e,WN).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(nE),"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(ZN);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=oE(e.type),new kt(Wt,n||"",r,r,s,null,null,null)}static isParamType(e){return e&&e[Xn]===cE}}class Lr{type;inputs;constructor(e,t,n){Zl(e,Wt,"Fragment"),n=Object.freeze(n.slice()),Ye(this,{type:t,inputs:n})}static from(e){if(typeof e=="string"){try{Lr.from(JSON.parse(e))}catch{}return Lr.from(er(e))}if(e instanceof Ai)switch(e.peekKeyword(eE)){case"constructor":return bs.from(e);case"error":return Yn.from(e);case"event":return Vi.from(e);case"fallback":case"receive":return Es.from(e);case"function":return Wi.from(e);case"struct":return Pr.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return bs.from(e);case"error":return Yn.from(e);case"event":return Vi.from(e);case"fallback":case"receive":return Es.from(e);case"function":return Wi.from(e);case"struct":return Pr.from(e)}pe(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}V(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return bs.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 Pr.isFragment(e)}}class wh extends Lr{name;constructor(e,t,n,s){super(e,t,s),V(typeof n=="string"&&n.match(nE),"invalid identifier","name",n),s=Object.freeze(s.slice()),Ye(this,{name:n})}}function lc(i,e){return"("+e.map(t=>t.format(i)).join(i==="full"?", ":",")+")"}class Yn extends wh{constructor(e,t,n){super(e,"error",t,n),Object.defineProperty(this,Xn,{value:lE})}get selector(){return Rr(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+lc(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=_h("error",e),n=xs(e);return Nr(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]===lE}}class Vi extends wh{anonymous;constructor(e,t,n,s){super(e,"event",t,n),Object.defineProperty(this,Xn,{value:hE}),Ye(this,{anonymous:s})}get topicHash(){return Rr(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+lc(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=_h("event",e),n=xs(e,!0),s=!!ms(e,Wn(["anonymous"])).has("anonymous");return Nr(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]===hE}}class bs extends Lr{payable;gas;constructor(e,t,n,s,r){super(e,t,n),Object.defineProperty(this,Xn,{value:uE}),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${lc(e,this.inputs)}`];return this.payable&&t.push("payable"),this.gas!=null&&t.push(`@${this.gas.toString()}`),t.join(" ")}static from(e){if(bs.isFragment(e))return e;if(typeof e=="string")try{return bs.from(er(e))}catch{V(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof Ai){ms(e,Wn(["constructor"]));const t=xs(e),n=!!ms(e,zN).has("payable"),s=aE(e);return Nr(e),new bs(Wt,"constructor",t,n,s)}return new bs(Wt,"constructor",e.inputs?e.inputs.map(kt.from):[],!!e.payable,e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[Xn]===uE}}class Es extends Lr{payable;constructor(e,t,n){super(e,"fallback",t),Object.defineProperty(this,Xn,{value:dE}),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(Es.isFragment(e))return e;if(typeof e=="string")try{return Es.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=xs(e);return V(o.length===0,"receive cannot have arguments","obj.inputs",o),ms(e,Wn(["payable"])),Nr(e),new Es(Wt,[],!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=[kt.from("bytes")];const a=rE(e);if(V(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),ms(e,Wn(["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 Nr(e),new Es(Wt,r,a==="payable")}if(e.type==="receive")return new Es(Wt,[],!0);if(e.type==="fallback"){const t=[kt.from("bytes")],n=e.stateMutability==="payable";return new Es(Wt,t,n)}V(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[Xn]===dE}}class Wi extends wh{constant;outputs;stateMutability;payable;gas;constructor(e,t,n,s,r,a){super(e,"function",t,s),Object.defineProperty(this,Xn,{value:fE}),r=Object.freeze(r.slice()),Ye(this,{constant:n==="view"||n==="pure",gas:a,outputs:r,payable:n==="payable",stateMutability:n})}get selector(){return Rr(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+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(" ")}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=_h("function",e),s=xs(e),r=rE(e);let a=[];ms(e,Wn(["returns"])).has("returns")&&(a=xs(e));const o=aE(e);return Nr(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]===fE}}class Pr extends wh{constructor(e,t,n){super(e,"struct",t,n),Object.defineProperty(this,Xn,{value:pE})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Pr.from(er(e))}catch{V(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ai){const t=_h("struct",e),n=xs(e);return Nr(e),new Pr(Wt,t,n)}return new Pr(Wt,e.name,e.inputs?e.inputs.map(kt.from):[])}static isFragment(e){return e&&e[Xn]===pE}}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 $N=new RegExp(/^bytes([0-9]*)$/),eL=new RegExp(/^(u?int)([0-9]*)$/);let fp=null,AE=1024;function tL(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?It(e.to):null,data:e.data||"0x"};return e.from&&(c.from=It(e.from)),zt(s,"CALL_EXCEPTION",{action:i,data:t,reason:r,transaction:c,invocation:a,revert:o})}class Wa{#e(e){if(e.isArray())return new ED(this.#e(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new lh(e.components.map(n=>this.#e(n)),e.name);switch(e.baseType){case"address":return new xD(e.name);case"bool":return new yD(e.name);case"string":return new TD(e.name);case"bytes":return new _D(e.name);case"":return new CD(e.name)}let t=e.type.match(eL);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 BD(n/8,t[1]==="int",e.name)}if(t=e.type.match($N),t){let n=parseInt(t[1]);return V(n!==0&&n<=32,"invalid bytes length","param",e),new wD(n,e.name)}V(!1,"invalid type","type",e.type)}getDefaultValue(e){const t=e.map(s=>this.#e(kt.from(s)));return new lh(t,"_").defaultValue()}encode(e,t){J0(t.length,e.length,"types/values length mismatch");const n=e.map(a=>this.#e(kt.from(a))),s=new lh(n,"_"),r=new Tf;return s.encode(r,t),r.data}decode(e,t,n){const s=e.map(a=>this.#e(kt.from(a)));return new lh(s,"_").decode(new Rf(t,n,AE))}static _setDefaultMaxInflation(e){V(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),AE=e}static defaultAbiCoder(){return fp==null&&(fp=new Wa),fp}static getBuiltinCallException(e,t,n){return tL(e,t,n,Wa.defaultAbiCoder())}}class nL{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 iL{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 sL{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 gE{hash;_isIndexed;static isIndexed(e){return!!(e&&e._isIndexed)}constructor(e){Ye(this,{hash:e,_isIndexed:!0})}}const mE={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"},xE={"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&&mE[i.toString()]&&(e=mE[i.toString()]),`reverted with panic code 0x${i.toString(16)} (${e})`}}};class kr{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(Lr.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:bs.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 Wa.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(xE[s])return Yn.from(xE[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 Qt([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 Qt([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=Wa.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"?Rr(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=PR(a,32):r.type==="address"&&this.#i.encode(["address"],[a]),ls(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(Rr(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,Qt(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 gE(null);else if(a[p])m=new gE(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)}),ds.fromItems(l,h)}parseTransaction(e){const t=ut(e.data,"tx.data"),n=De(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 iL(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 nL(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 sL(n,n.selector,s)}static from(e){return e instanceof kr?e:typeof e=="string"?new kr(JSON.parse(e)):typeof e.formatJson=="function"?new kr(e.formatJson()):typeof e.format=="function"?new kr(e.format("json")):new kr(e)}}const bE=BigInt(0);function qa(i){return i??null}function tn(i){return i==null?null:i.toString()}class EE{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,t,n){Ye(this,{gasPrice:qa(e),maxFeePerGas:qa(t),maxPriorityFeePerGas:qa(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:tn(e),maxFeePerGas:tn(t),maxPriorityFeePerGas:tn(n)}}}function vh(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]=De(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=Br(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=>Cf(s)?Ce(s):Object.assign({},s))),e}class rL{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 uc(n,t):n),Ye(this,{provider:t,hash:qa(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:qa(e.prevRandao),extraData:e.extraData,baseFeePerGas:qa(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 aL(this)}}class hc{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 oL(this)}}class yE{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 hc(s,t)));let n=bE;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 wE(this)}reorderedEvent(e){return pe(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),_E(this,e)}}class uc{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===bE&&(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(zt("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()"}),wE(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()"}),_E(this,e)}replaceableTransaction(e){V(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new uc(this,this.provider);return t.#e=e,t}}function aL(i){return{orphan:"drop-block",hash:i.hash,number:i.number}}function _E(i,e){return{orphan:"reorder-transaction",tx:i,other:e}}function wE(i){return{orphan:"drop-transaction",tx:i}}function oL(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 pp extends hc{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 vE extends hc{error;constructor(e,t){super(e,e.provider),Ye(this,{error:t})}}class cL extends yE{#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 pp(e,this.#e,t)}catch(n){return new vE(e,n)}return e})}}class Ap extends uc{#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 cL(this.#e,this.provider,n)}}class CE extends rx{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 lL extends CE{constructor(e,t,n,s,r){super(e,t,n,new pp(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 SE=BigInt(0);function IE(i){return i&&typeof i.call=="function"}function ME(i){return i&&typeof i.estimateGas=="function"}function Ch(i){return i&&typeof i.resolveName=="function"}function BE(i){return i&&typeof i.sendTransaction=="function"}function TE(i){if(i!=null){if(Ch(i))return i;if(i.provider)return i.provider}}class hL{#e;fragment;constructor(e,t,n){if(Ye(this,{fragment:t}),t.inputs.length<n.length)throw new Error("too many arguments");const s=Ur(e.runner,"resolveName"),r=Ch(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 Ur(i,e){return i==null?null:typeof i[e]=="function"?i:i.provider&&typeof i.provider[e]=="function"?i.provider:null}function Or(i){return i==null?null:i.provider||null}async function RE(i,e){const t=jt.dereference(i,"overrides");V(typeof t=="object","invalid overrides parameter","overrides",i);const n=vh(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 uL(i,e,t){const n=Ur(i,"resolveName"),s=Ch(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 dL(i){const e=async function(a){const o=await RE(a,["data"]);o.to=await i.getAddress(),o.from&&(o.from=await Vn(o.from,TE(i.runner)));const c=i.interface,l=De(o.value||SE,"overrides.value")===SE,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=Ur(i.runner,"call");pe(IE(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 vf(l)&&l.data?i.interface.makeError(l.data,c):l}},n=async function(a){const o=i.runner;pe(BE(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),l=Or(i.runner);return new Ap(i.interface,l,c)},s=async function(a){const o=Ur(i.runner,"estimateGas");return pe(ME(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 fL(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 RE(l.pop()),u.from&&(u.from=await Vn(u.from,TE(i.runner)))),h.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await uL(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(BE(h),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const u=await h.sendTransaction(await n(...l)),d=Or(i.runner);return new Ap(i.interface,d,u)},a=async function(...l){const h=Ur(i.runner,"estimateGas");return pe(ME(h),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await h.estimateGas(await n(...l))},o=async function(...l){const h=Ur(i.runner,"call");pe(IE(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 vf(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 pL(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 hL(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 Sh=Symbol.for("_ethersInternal_contract"),FE=new WeakMap;function AL(i,e){FE.set(i[Sh],e)}function ti(i){return FE.get(i[Sh])}function gL(i){return i&&typeof i=="object"&&"getTopicFilter"in i&&typeof i.getTopicFilter=="function"&&i.fragment}async function gp(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]):gL(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 dc(i,e){const{subs:t}=ti(i);return t.get((await gp(i,e)).tag)||null}async function DE(i,e,t){const n=Or(i.runner);pe(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:r,topics:a}=await gp(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):[];xp(i,t,x,E=>new lL(i,E,t,_,g))}else xp(i,t,[],_=>new CE(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 mp=Promise.resolve();async function mL(i,e,t,n){await mp;const s=await dc(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 xp(i,e,t,n){try{await mp}catch{}const s=mL(i,e,t,n);return mp=s,await s}const Ih=["then"];class fc{target;interface;runner;filters;[Sh];fallback;constructor(e,t,n,s){V(typeof e=="string"||db(e),"invalid value for Contract target","target",e),n==null&&(n=null);const r=kr.from(t);Ye(this,{target:e,runner:n,interface:r}),Object.defineProperty(this,Sh,{value:{}});let a,o=null,c=null;if(s){const u=Or(n);c=new Ap(this.interface,u,s)}let l=new Map;if(typeof e=="string")if(Pt(e))o=e,a=Promise.resolve(e);else{const u=Ur(n,"resolveName");if(!Ch(u))throw zt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=u.resolveName(e).then(d=>{if(d==null)throw zt("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});AL(this,{addrPromise:a,addr:o,deployTx:c,subs:l});const h=new Proxy({},{get:(u,d,f)=>{if(typeof d=="symbol"||Ih.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)=>Ih.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?dL(this):null}),new Proxy(this,{get:(u,d,f)=>{if(typeof d=="symbol"||d in u||Ih.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||Ih.indexOf(d)>=0?Reflect.has(u,d):u.interface.hasFunction(d)})}connect(e){return new fc(this.target,this.interface,e)}attach(e){return new fc(e,this.interface,this.runner)}async getAddress(){return await ti(this).addrPromise}async getDeployedCode(){const e=Or(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=Or(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()),fL(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),pL(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 gp(this,e),l={address:a,topics:c,fromBlock:t,toBlock:n},h=Or(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 pp(u,this.interface,d)}catch(f){return new vE(u,f)}return new hc(u,h)})}async on(e,t){const n=await DE(this,"on",e);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(e,t){const n=await DE(this,"once",e);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(e,...t){return await xp(this,e,t,null)}async listenerCount(e){if(e){const s=await dc(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 dc(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 dc(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 dc(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 fc{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 xL(){return fc}class Ka extends xL(){}function bp(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 bL{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 NE=new RegExp("^(ipfs)://(.*)$","i"),LE=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),NE,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class ja{provider;address;name;#e;#t;constructor(e,t,n){Ye(this,{provider:e,address:t,name:n}),this.#e=null,this.#t=new Ka(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(hp(this.name));let s=null;await this.supportsWildcard()&&(s=n.getFunction(e),pe(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[PN(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===nc?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 It(a)}let t=null;for(const r of this.provider.plugins)if(r instanceof bL&&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}://${OR("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<LE.length;n++){const s=t.match(LE[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=bp(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 Ka(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=bp(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(NE)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=bp(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 ja.getEnsAddress(e);try{const r=await new Ka(n,["function resolver(bytes32) view returns (address)"],e).resolver(hp(t),{enableCcipRead:!0});return r===nc?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 ja.#i(e,n);if(s!=null){const r=new ja(e,s,t);return n!==t&&!await r.supportsWildcard()?null:r}n=n.split(".").slice(1).join(".")}}}const PE=BigInt(0);function bt(i,e){return(function(t){return t==null?e:i(t)})}function pc(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 Ac(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 EL(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 Xa(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 yL=Ac({address:It,blockHash:Rn,blockNumber:dt,data:Xa,index:dt,removed:bt(EL,!1),topics:pc(Rn),transactionHash:Rn,transactionIndex:dt},{index:["logIndex"]});function _L(i){return yL(i)}const wL=Ac({hash:bt(Rn),parentHash:Rn,parentBeaconBlockRoot:bt(Rn,null),number:dt,timestamp:dt,nonce:bt(Xa),difficulty:De,gasLimit:De,gasUsed:De,stateRoot:bt(Rn,null),receiptsRoot:bt(Rn,null),blobGasUsed:bt(De,null),excessBlobGas:bt(De,null),miner:bt(It),prevRandao:bt(Rn,null),extraData:Xa,baseFeePerGas:bt(De)},{prevRandao:["mixHash"]});function vL(i){const e=wL(i);return e.transactions=i.transactions.map(t=>typeof t=="string"?t:kE(t)),e}const CL=Ac({transactionIndex:dt,blockNumber:dt,transactionHash:Rn,address:It,topics:pc(Rn),data:Xa,index:dt,blockHash:Rn},{index:["logIndex"]});function SL(i){return CL(i)}const IL=Ac({to:bt(It,null),from:bt(It,null),contractAddress:bt(It,null),index:dt,root:bt(Ce),gasUsed:De,blobGasUsed:bt(De,null),logsBloom:bt(Xa),blockHash:Rn,hash:Rn,logs:pc(SL),blockNumber:dt,cumulativeGasUsed:De,effectiveGasPrice:bt(De),blobGasPrice:bt(De,null),status:bt(dt),type:bt(dt,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function ML(i){return IL(i)}function kE(i){i.to&&De(i.to)===PE&&(i.to="0x0000000000000000000000000000000000000000");const e=Ac({hash:Rn,index:bt(dt,void 0),type:t=>t==="0x"||t==null?0:dt(t),accessList:bt(Br,null),blobVersionedHashes:bt(pc(Rn,!0),null),authorizationList:bt(pc(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:It(t.address),chainId:De(t.chainId),nonce:De(t.nonce),signature:Vt.from(n)}},!1),null),blockHash:bt(Rn,null),blockNumber:bt(dt,null),transactionIndex:bt(dt,null),from:It,gasPrice:bt(De),maxPriorityFeePerGas:bt(De),maxFeePerGas:bt(De),maxFeePerBlobGas:bt(De,null),gasLimit:De,to:bt(It,null),value:De,nonce:dt,data:Xa,creates:bt(It,null),chainId:bt(De,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(i);if(e.to==null&&e.creates==null&&(e.creates=mD(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&&De(e.blockHash)===PE&&(e.blockHash=null),e}const BL="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class gc{name;constructor(e){Ye(this,{name:e})}clone(){return new gc(this.name)}}class Mh extends gc{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 Mh(this.effectiveBlock,this)}}class Bh extends gc{address;targetNetwork;constructor(e,t){super("org.ethers.plugins.network.Ens"),Ye(this,{address:e||BL,targetNetwork:t??1})}clone(){return new Bh(this.address,this.targetNetwork)}}class TL extends gc{#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 Ep=new Map;class ni{#e;#t;#n;constructor(e,t){this.#e=e,this.#t=De(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=De(e,"chainId")}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===De(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===De(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===De(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 Mh;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=Br(e.accessList);for(const r in s)n+=t.txAccessListAddress+t.txAccessListStorageKey*s[r].storageKeys.length}return n}static from(e){if(RL(),e==null)return ni.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=Ep.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 Bh(e.ensAddress,e.ensNetwork)),t}V(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const n=Ep.get(e);n&&V(!1,`conflicting network for ${JSON.stringify(n.name)}`,"nameOrChainId",e),Ep.set(e,t)}}function UE(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 OE(i){return new TL(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:UE(o.maxFee,9),maxPriorityFeePerGas:UE(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 QE=!1;function RL(){if(QE)return;QE=!0;function i(e,t,n){const s=function(){const r=new ni(e,t);return n.ensNetwork!=null&&r.attachPlugin(new Bh(null,n.ensNetwork)),r.attachPlugin(new Mh),(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:[OE("https://gasstation.polygon.technology/v2")]}),i("matic-amoy",80002,{}),i("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[OE("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 yp(i){return JSON.parse(JSON.stringify(i))}class FL{#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 _p{#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 DL extends _p{#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 NL extends _p{#e;constructor(e,t){super(e),this.#e=yp(t)}async _poll(e,t){throw new Error("@TODO")}}class LL extends _p{#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 wp{#e;#t;#n;#i;#s;constructor(e,t){this.#e=e,this.#t=yp(t),this.#n=this.#a.bind(this),this.#i=!1,this.#s=-2}async#a(e){if(this.#s===-2)return;const t=yp(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 PL=BigInt(2),kL=10;function Th(i){return i&&typeof i.then=="function"}function Rh(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 GE{name;constructor(e){Ye(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function UL(i){return JSON.parse(JSON.stringify(i))}function vp(i){return i=Array.from(new Set(i).values()),i.sort(),i}async function Cp(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:Rh("tx",{hash:t}),hash:t}}if(i.orphan){const t=i;return{type:"orphan",tag:Rh("orphan",t),filter:UL(t)}}if(i.address||i.topics){const t=i,n={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?vp(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=vp(s.map(o=>o.toLowerCase()))}return{filter:n,tag:Rh("event",n),type:"event"}}V(!1,"unknown ProviderEvent","event",i)}function Sp(){return new Date().getTime()}const OL={cacheTimeout:250,pollingInterval:4e3};class QL{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;constructor(e,t){if(this.#A=Object.assign({},OL,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=Rh(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 rL(vL(e),this)}_wrapLog(e,t){return new hc(_L(e),this)}_wrapTransactionReceipt(e,t){return new yE(ML(e),this)}_wrapTransactionResponse(e,t){return new uc(kE(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)?vp(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=vh(e),n=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const r=Vn(t[s],this);Th(r)?n.push((async function(){t[s]=await r})()):t[s]=r}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);Th(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 De(h,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const h=await this.#c({method:"getPriorityFee"});return De(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*PL+c),new EE(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 EE(r.gasPrice,r.maxFeePerGas,r.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return Th(t)&&(t=await t),De(await this.#c({method:"estimateGas",transaction:t}),"%response")}async#h(e,t,n){pe(n<kL,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=vh(e);try{return Ce(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(r){if(!this.disableCcipRead&&vf(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=WL(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:Qt([c.selector,VL([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 De(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=De(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);Th(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 ja.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=It(e);const t=hp(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await ja.getEnsAddress(this),r=await new Ka(n,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(r==null||r===nc)return null;const o=await new Ka(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(zt("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:Sp()})}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 GE(e.type);case"block":{const t=new FL(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new DL(this,e.type);case"event":return new wp(this,e.filter);case"transaction":return new LL(this,e.hash);case"orphan":return new NL(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 Cp(e,this);return n.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(n=await Cp({orphan:"drop-log",log:t[0]},this)),this.#e.get(n.tag)||null}async#m(e){const t=await Cp(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 rx(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=Sp()-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=Sp(),setTimeout(e.func,t)}}}}function GL(i,e){try{const t=Ip(i,e);if(t)return eh(t)}catch{}return null}function Ip(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 HE(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 HL(i){if(i.length%32===0)return i;const e=new Uint8Array(Math.ceil(i.length/32)*32);return e.set(i),e}const zL=new Uint8Array([]);function VL(i){const e=[];let t=0;for(let n=0;n<i.length;n++)e.push(zL),t+=32;for(let n=0;n<i.length;n++){const s=ut(i[n]);e[n]=HE(t),e.push(HE(s.length)),e.push(HL(s)),t+=32+Math.ceil(s.length/32)*32}return Qt(e)}const zE="0x0000000000000000000000000000000000000000000000000000000000000000";function WL(i){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};pe(Na(i)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Kt(i,0,32);pe(Kt(t,0,12)===Kt(zE,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=GL(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=Ip(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(zE,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Kt(i,96,100);try{const n=Ip(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 Qr(i,e){if(i.provider)return i.provider;pe(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function VE(i,e){let t=vh(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 qL{provider;constructor(e){Ye(this,{provider:e||null})}async getNonce(e){return Qr(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await VE(this,e)}async populateTransaction(e){const t=Qr(this,"populateTransaction"),n=await VE(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=De(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 Qr(this,"getNetwork").getNetwork()).chainId),t.nonce==null&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return Qr(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Qr(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Qr(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=Qr(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 KL(i){return JSON.parse(JSON.stringify(i))}class WE{#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 jL extends WE{#e;constructor(e,t){super(e),this.#e=KL(t)}_recover(e){return new wp(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 XL extends WE{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const n of t)e.emit("pending",n)}}const YL="bigint,boolean,function,number,string,symbol".split(/,/g);function Fh(i){if(i==null||YL.indexOf(typeof i)>=0||typeof i.getAddress=="function")return i;if(Array.isArray(i))return i.map(Fh);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 JL(i){return new Promise(e=>{setTimeout(e,i)})}function Ya(i){return i&&i.toLowerCase()}function qE(i){return i&&typeof i.pollingInterval=="number"}const KE={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Mp extends qL{address;constructor(e,t){super(e),t=It(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=Fh(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",zt("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=Fh(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"?hs(e):e;return await this.provider.send("personal_sign",[Ce(t),this.address.toLowerCase()])}async signTypedData(e,t,n){const s=Fh(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"?hs(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ce(t)])}}class ZL extends QL{#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(zt("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=zt("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({},KE,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&&De(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(De(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(De(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",zt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:e}})),await JL(1e3)}this.#o()})())}async _waitUntilReady(){if(this.#s!=null)return await this.#s.promise}_getSubscriber(e){return e.type==="pending"?new XL(this):e.type==="event"?this._getOption("polling")?new wp(this,e.filter):new jL(this,e.filter):e.type==="orphan"&&e.filter.orphan==="drop-log"?new GE("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(De(e[n],`tx.${n}`))}),["from","to","data"].forEach(n=>{e[n]!=null&&(t[n]=Ce(e[n]))}),e.accessList&&(t.accessList=Br(e.accessList)),e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.map(n=>n.toLowerCase())),e.authorizationList&&(t.authorizationList=e.authorizationList.map(n=>{const s=mb(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:[Ya(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Ya(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[Ya(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Ya(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(Ya):e.filter.address=Ya(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 zt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:e.params[0],info:{payload:e,error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return zt("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=Bp(s),c=Wa.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(t2(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return zt("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 zt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o,info:{error:s}});if(r.match(/nonce/i)&&r.match(/too low/i))return zt("nonce has already been used","NONCE_EXPIRED",{transaction:o,info:{error:s}});if(r.match(/replacement transaction/i)&&r.match(/underpriced/i))return zt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o,info:{error:s}});if(r.match(/only replay-protected/i))return zt("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?zt("unsupported operation","UNSUPPORTED_OPERATION",{operation:e.method,info:{error:s,payload:e}}):zt("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:e})}send(e,t){if(this.destroyed)return Promise.reject(zt("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 Mp(this,s[e])}const{accounts:n}=await Gn({network:this.getNetwork(),accounts:t});e=It(e);for(const s of n)if(It(s)===e)return new Mp(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(t=>new Mp(this,t))}destroy(){this.#i&&(clearTimeout(this.#i),this.#i=null);for(const{payload:e,reject:t}of this.#n)t(zt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e.method}));this.#n=[],super.destroy()}}class $L extends ZL{#e;constructor(e,t){super(e,t);let n=this._getOption("pollingInterval");n==null&&(n=KE.pollingInterval),this.#e=n}_getSubscriber(e){const t=super._getSubscriber(e);return qE(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=>{qE(t)&&(t.pollingInterval=this.#e)})}}class e2 extends $L{#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 Bp(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=Bp(i[e]);if(t)return t}return null}if(typeof i=="string")try{return Bp(JSON.parse(i))}catch{}return null}function Tp(i,e){if(i!=null){if(typeof i.message=="string"&&e.push(i.message),typeof i=="object")for(const t in i)Tp(i[t],e);if(typeof i=="string")try{return Tp(JSON.parse(i),e)}catch{}}}function t2(i){const e=[];return Tp(i,e),e}const n2=["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)"],Gr={identityRegistry:"0x8004A818BFB912233c491871b3d84c89A494BD9e",reputationRegistry:"0x8004B663056A597Dffe9eCcC1965A193B7388713",validationRegistry:"0x8004Cb1BF31DAf7788923b405b754f57acEB4272"},qn={identityRegistry:"0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",reputationRegistry:"0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",validationRegistry:""},i2={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:Gr,11155111:Gr,84532:Gr,421614:Gr,11155420:Gr,80002:Gr,43113:Gr},s2={base:8453,"base-mainnet":8453,"base-sepolia":84532,ethereum:1,mainnet:1},r2={8453:"https://mainnet.base.org",84532:"https://sepolia.base.org",1:"https://eth.llamarpc.com"};async function Rp(i,{rpcURL:e,registry:t}={}){if(!i)throw new Error("loadManifest: source required");if(i.startsWith("agent://"))return a2(i,{rpcURL:e,registryOverride:t});if(i.startsWith("ipfs://")||i.startsWith("ar://")){const n=Ws(i),s=await Fp(n);return Dh(s,{baseURI:Dp(n)})}if(i.startsWith("http")){const n=await Fp(i);return Dh(n,{baseURI:Dp(i)})}throw new Error(`Unsupported manifest source: ${i}`)}async function a2(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=s2[s.toLowerCase()]||Number(s);if(!a)throw new Error(`Unknown chain: ${s}`);const o=i2[a],c=t||o?.identityRegistry;if(!c)throw new Error(`No registry deployed on chain ${a}. Pass registry= override.`);const l=new e2(e||r2[a]),h=new Ka(c,n2,l),u=BigInt(r),d=await h.tokenURI(u);if(!d)throw new Error(`Agent ${r} on chain ${a} has no URI`);const f=Ws(d),p=await Fp(f),m=Dh(p,{baseURI:Dp(f)});return m.id={...m.id,chain:s,chainId:a,registry:c,agentId:r},m}async function Fp(i){let e;try{e=await fetch(i)}catch{e=await V0(i)}if(!e.ok)throw new Error(`Manifest fetch failed: ${i} (${e.status})`);return e.json()}function Dh(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]||{};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: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"}}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 Dp(i){const e=i.lastIndexOf("/");return e>=0?i.slice(0,e+1):i}async function jE(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 ys extends Error{constructor(e,t,{status:n}={}){super(t),this.name="AgentResolveError",this.code=e,n!==void 0&&(this.status=n)}}async function XE(i,{fetchFn:e}){let t;try{t=await e(i,{credentials:"include"})}catch(n){throw new ys("network",`network error fetching ${i}: ${n.message||n}`)}if(t.status===401||t.status===403)throw new ys("unauthorized",`unauthorized fetching ${i} (${t.status})`,{status:t.status});if(t.status===404)throw new ys("not_found",`resource not found: ${i}`,{status:404});if(!t.ok)throw new ys("network",`request failed: ${i} (${t.status})`,{status:t.status});try{return await t.json()}catch(n){throw new ys("network",`invalid JSON from ${i}: ${n.message||n}`)}}async function o2(i,{origin:e=typeof location<"u"?location.origin:"",fetchFn:t=fetch}={}){if(!i)throw new ys("not_found","agentId required");const n=t.bind(typeof globalThis<"u"?globalThis:void 0),r=(await XE(`${e}/api/agents/${encodeURIComponent(i)}`,{fetchFn:n}))?.agent;if(!r)throw new ys("not_found",`agent ${i} not found`);if(!r.avatar_id)throw new ys("no_avatar",`agent ${i} has no avatar bound`);const o=(await XE(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`,{fetchFn:n}))?.avatar;if(!o||!o.url)throw new ys("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"}}const c2=["inline","floating","section","fullscreen"],l2=`+`)}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+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt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hz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/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+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84Ud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UKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+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=`:host {display: block;position: relative;@@ -4189,7 +4189,7 @@ ${this.instructions}padding: 16px;font: 14px var(--agent-chat-font);}-`;class Np 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=l2,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(!c2.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 c=await jE(e,e.brain.instructions);c&&(e.instructions=h2(c))}else e.brain?.instructions&&(e.instructions=e.brain.instructions);this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"body",pct:.45}}));const t=new _f(this._stageEl,{kiosk:this.hasAttribute("kiosk")});this._viewer=t;const n=Ws(e.body?.uri);n&&await t.load(n,"",new Map),this._scene=new q0(t),this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"memory",pct:.6}}));const s=e.id?.agentId||this.getAttribute("memory-key")||e.name||"anon";this._memory=await Mi.load({mode:this.getAttribute("memory")||e.memory?.mode||"local",namespace:s,manifestURI:e._baseURI+"manifest.json",fetchFn:fetch.bind(globalThis)}),this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"skills",pct:.75}})),this._skills=new Y0({trust:this.getAttribute("skill-trust")||"owned-only",ownerAddress:e.id?.owner});const r=e.skills||[];for(const c of r)try{const l=await this._skills.install(c,{bundleBase:e._baseURI});this.dispatchEvent(new CustomEvent("skill:loaded",{detail:{name:l.name,uri:l.uri}}))}catch(l){console.warn("[agent-3d] skill load failed",c,l)}this.dispatchEvent(new CustomEvent("agent:load-progress",{detail:{phase:"brain",pct:.9}}));const a={apiKey:this.getAttribute("api-key")||void 0,proxyURL:this.getAttribute("key-proxy")||void 0},o=this._parseTTSAttribute();o&&(e.voice=e.voice||{},e.voice.tts={...e.voice.tts||{},...o}),this._runtime=new z0({manifest:e,viewer:this._scene,memory:this._memory,skills:this._skills,providerConfig:a});for(const c of["brain:thinking","brain:message","skill:tool-called","voice:speech-start","voice:speech-end","voice:transcript","voice:listen-start","memory:write"])this._runtime.addEventListener(c,l=>{this.dispatchEvent(new CustomEvent(c,{detail:l.detail,bubbles:!0,composed:!0})),c==="brain:message"&&this._chatEl&&this._renderMessage(l.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");if(e)return s&&console.warn("[agent-3d] both src and agent-id provided; using src"),Rp(e,{rpcURL:this.getAttribute("rpc-url"),registry:this.getAttribute("registry")});if(s)return o2(s);if(t)return Rp(t);if(n){const r=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:r||"You are an embodied 3D agent."},instructions:r||"You are an embodied 3D agent.",voice:{tts:{provider:"browser"},stt:{provider:"browser"}},skills:(this.getAttribute("skills")||"").split(",").map(a=>a.trim()).filter(Boolean).map(a=>({uri:a})),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)}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 h2(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",Np);const u2=["row","circle","freeform"],d2=`+`;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=`:host {display: block;position: relative;@@ -4209,4 +4209,4 @@ ${this.instructions}position: absolute;pointer-events: none;}-`;class YE 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 u2.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 _f(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{}f2(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 f2(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",YE);const p2=(i="agent-3d")=>{customElements.get(i)||customElements.define(i,Np)};on.Agent3DElement=Np,on.AgentStageElement=YE,on.Memory=Mi,on.Runtime=z0,on.SceneController=q0,on.Skill=X0,on.SkillRegistry=Y0,on.Viewer=_f,on.defineElement=p2,on.fetchRelative=jE,on.fetchWithFallback=V0,on.loadManifest=Rp,on.normalize=Dh,on.resolveURI=Ws,Object.defineProperty(on,Symbol.toStringTag,{value:"Module"})}));+`;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"})}));diff --git a/dist-lib/dashboard/dashboard.js b/dist-lib/dashboard/dashboard.jsindex 6e3c3ebaa..97433b165 100644--- a/dist-lib/dashboard/dashboard.js+++ b/dist-lib/dashboard/dashboard.js@@ -87,7 +87,7 @@ async function renderAvatars(root) {try {const { avatars } = await api.listAvatars();if (!avatars.length) {- list.innerHTML = `<div class="empty">No avatars yet. <a href="#create">Take a selfie</a> or <a href="#upload">upload a .glb</a>.</div>`;+ list.innerHTML = `<div class="empty">No avatars yet. <a href="#create">Take a selfie</a>, <a href="#upload">upload a .glb</a>, or <a href="/deploy">deploy a metadata-only agent on-chain</a>.</div>`;return;}list.innerHTML = '';diff --git a/dist-lib/dashboard/embed-policy.html b/dist-lib/dashboard/embed-policy.htmlindex 7667d2e3b..e9985f065 100644--- a/dist-lib/dashboard/embed-policy.html+++ b/dist-lib/dashboard/embed-policy.html@@ -1,182 +1,612 @@<!doctype html><html lang="en">-<head>-<meta charset="utf-8">-<meta name="viewport" content="width=device-width,initial-scale=1">-<title>Embed policy · 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:-.01em; }- main { padding:28px; max-width:720px; margin:0 auto; }- h1 { font-size:22px; margin:0 0 6px; letter-spacing:-.01em; }- .sub { color:#888; margin:0 0 22px; font-size:14px; }- .card { background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:20px; }- label { display:block; margin:14px 0 6px; font-size:13px; color:#bbb; }- input, select, textarea { background:#0f0f17; border:1px solid var(--border); color:#eee; padding:9px 11px; border-radius:8px; font-size:14px; font-family:inherit; width:100%; }- textarea { min-height:120px; font-family: ui-monospace, SF Mono, Menlo, monospace; font-size:13px; }- input:focus, textarea:focus, select:focus { outline:none; border-color:var(--accent); }- .row { display:flex; gap:10px; align-items:center; }- .btn { padding:9px 14px; border-radius:9px; border:0; font-size:13px; font-weight:600; cursor:pointer; background:var(--accent); color:#fff; }- .btn.sec { background:#222230; color:#ddd; }- .btn.danger { background:#3a1f24; color:#ff9c9c; }- .muted { color:#888; font-size:13px; }- .err { padding:12px; background:rgba(255,92,92,.1); border:1px solid rgba(255,92,92,.3); border-radius:8px; color:#ffb3b3; margin-bottom:14px; }- .ok { padding:12px; background:rgba(92,255,140,.07); border:1px solid rgba(92,255,140,.2); border-radius:8px; color:#b6f2c6; margin-bottom:14px; }- code { font-family: ui-monospace, SF Mono, Menlo, monospace; background:#0f0f17; border:1px solid var(--border); border-radius:4px; padding:1px 6px; font-size:12px; }- .actions { display:flex; gap:10px; margin-top:22px; }- hr { border:0; border-top:1px solid var(--border); margin:22px 0; }-</style>-</head>-<body>-<header>- <div class="brand"><a href="/dashboard">← Dashboard</a></div>- <div class="muted"><span id="agent-name">Agent</span></div>-</header>-<main>- <h1>Embed policy</h1>- <p class="sub">Control which sites can iframe <code id="embed-url"></code>. An unset policy allows embedding everywhere (today's default).</p>-- <div id="status"></div>-- <div class="card">- <label for="mode">Policy mode</label>- <select id="mode">- <option value="off">Off — allow all embeds</option>- <option value="allowlist">Allowlist — only these hosts</option>- <option value="denylist">Denylist — everywhere except these hosts</option>- </select>-- <div id="hosts-wrap">- <label for="hosts">Hosts (one per line)</label>- <textarea id="hosts" placeholder="example.com *.substack.com"></textarea>- <div class="muted" style="margin-top:6px">One host per line. Use <code>*.example.com</code> to match all subdomains.</div>- </div>-- <div class="actions">- <button class="btn" id="save">Save</button>- <button class="btn sec" id="reload">Reload</button>- <button class="btn danger" id="clear" style="margin-left:auto">Clear policy</button>- </div>- </div>-- <hr>-- <div class="muted">- Signed-in owners can preview the embed bypassing this policy by appending <code>?preview=1</code> to the embed URL.- </div>-</main>-<script type="module">-const params = new URL(location.href).searchParams;-const agentId = params.get('agent');-const statusEl = document.getElementById('status');-const modeSel = document.getElementById('mode');-const hostsEl = document.getElementById('hosts');-const wrap = document.getElementById('hosts-wrap');-const nameEl = document.getElementById('agent-name');-const urlEl = document.getElementById('embed-url');--if (!agentId) {- statusEl.innerHTML = '<div class="err">Missing <code>?agent=ID</code> in URL.</div>';- throw new Error('no agent id');-}-urlEl.textContent = `/agent/${agentId}/embed`;--async function api(method, path, body) {- const res = await fetch(path, {- method,- credentials: 'include',- headers: body ? { 'content-type': 'application/json' } : {},- body: body ? JSON.stringify(body) : undefined,- });- const ct = res.headers.get('content-type') || '';- const data = ct.includes('application/json') ? await res.json() : null;- if (!res.ok) throw Object.assign(new Error((data && data.error_description) || res.statusText), { status: res.status });- return data;-}--function setStatus(html) { statusEl.innerHTML = html; }-function updateVisibility() { wrap.style.display = modeSel.value === 'off' ? 'none' : ''; }--async function loadMe() {- try {- await api('GET', '/api/auth/me');- } catch {- location.href = '/login?next=' + encodeURIComponent(location.pathname + location.search);- throw new Error('redirecting');- }-}--async function loadAgent() {- try {- const { agent } = await api('GET', `/api/agents/${agentId}`);- nameEl.textContent = agent.name || 'Agent';- } catch (e) {- setStatus(`<div class="err">Could not load agent: ${escapeHtml(e.message)}</div>`);- }-}--async function loadPolicy() {- try {- const { policy } = await api('GET', `/api/agents/${agentId}/embed-policy`);- if (!policy) {- modeSel.value = 'off';- hostsEl.value = '';- } else {- modeSel.value = policy.mode === 'denylist' ? 'denylist' : 'allowlist';- hostsEl.value = (policy.hosts || []).join('\n');- }- updateVisibility();- } catch (e) {- setStatus(`<div class="err">Could not load policy: ${escapeHtml(e.message)}</div>`);- }-}--async function save() {- setStatus('');- if (modeSel.value === 'off') {- try {- await api('DELETE', `/api/agents/${agentId}/embed-policy`);- setStatus('<div class="ok">Policy cleared. All hosts can embed this agent.</div>');- } catch (e) { setStatus(`<div class="err">${escapeHtml(e.message)}</div>`); }- return;- }- const hosts = hostsEl.value.split(/\r?\n/).map(s => s.trim()).filter(Boolean);- try {- await api('PUT', `/api/agents/${agentId}/embed-policy`, { mode: modeSel.value, hosts });- setStatus('<div class="ok">Policy saved.</div>');- } catch (e) {- setStatus(`<div class="err">${escapeHtml(e.message)}</div>`);- }-}--async function clearPolicy() {- if (!confirm('Clear the embed policy? Any site will be able to embed this agent.')) return;- try {- await api('DELETE', `/api/agents/${agentId}/embed-policy`);- modeSel.value = 'off';- hostsEl.value = '';- updateVisibility();- setStatus('<div class="ok">Policy cleared.</div>');- } catch (e) { setStatus(`<div class="err">${escapeHtml(e.message)}</div>`); }-}--function escapeHtml(s) { return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&':'&','<':'<','>':'>','"':'"',"'":''' }[c])); }--modeSel.addEventListener('change', updateVisibility);-document.getElementById('save').addEventListener('click', save);-document.getElementById('reload').addEventListener('click', loadPolicy);-document.getElementById('clear').addEventListener('click', clearPolicy);--(async () => {- await loadMe();- await loadAgent();- await loadPolicy();-})();-</script>-</body>+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width,initial-scale=1" />+ <title>Embed policy · 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;+ }+ main {+ padding: 28px;+ max-width: 720px;+ 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;+ }+ .card {+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 14px;+ padding: 20px;+ margin-bottom: 20px;+ }+ fieldset {+ border: 0;+ padding: 0;+ margin: 0;+ }+ legend {+ font-size: 13px;+ font-weight: 600;+ color: #ccc;+ margin-bottom: 12px;+ letter-spacing: 0.02em;+ text-transform: uppercase;+ }+ label {+ display: block;+ margin: 14px 0 6px;+ font-size: 13px;+ color: #bbb;+ }+ label.check {+ display: flex;+ align-items: center;+ gap: 8px;+ margin: 8px 0;+ cursor: pointer;+ color: #ccc;+ }+ label.check input {+ width: auto;+ margin: 0;+ }+ input,+ select,+ textarea {+ background: #0f0f17;+ border: 1px solid var(--border);+ color: #eee;+ padding: 9px 11px;+ border-radius: 8px;+ font-size: 14px;+ font-family: inherit;+ width: 100%;+ }+ textarea {+ min-height: 120px;+ font-family:+ ui-monospace,+ SF Mono,+ Menlo,+ monospace;+ font-size: 13px;+ }+ input:focus,+ textarea:focus,+ select:focus {+ outline: none;+ border-color: var(--accent);+ }+ input[type='checkbox'] {+ width: 16px;+ height: 16px;+ accent-color: var(--accent);+ }+ input[type='number'] {+ -moz-appearance: textfield;+ }+ .row {+ display: flex;+ gap: 10px;+ align-items: center;+ }+ .col2 {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 12px;+ }+ .btn {+ padding: 9px 14px;+ border-radius: 9px;+ border: 0;+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ background: var(--accent);+ color: #fff;+ }+ .btn.sec {+ background: #222230;+ color: #ddd;+ }+ .btn.danger {+ background: #3a1f24;+ color: #ff9c9c;+ }+ .muted {+ 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;+ }+ .ok {+ padding: 12px;+ background: rgba(92, 255, 140, 0.07);+ border: 1px solid rgba(92, 255, 140, 0.2);+ border-radius: 8px;+ color: #b6f2c6;+ margin-bottom: 14px;+ }+ code {+ font-family:+ ui-monospace,+ SF Mono,+ Menlo,+ monospace;+ background: #0f0f17;+ border: 1px solid var(--border);+ border-radius: 4px;+ padding: 1px 6px;+ font-size: 12px;+ }+ .actions {+ display: flex;+ gap: 10px;+ margin-top: 22px;+ }+ hr {+ border: 0;+ border-top: 1px solid var(--border);+ margin: 22px 0;+ }+ .hidden {+ display: none !important;+ }+ </style>+ </head>+ <body>+ <header>+ <div class="brand"><a href="/dashboard">← Dashboard</a></div>+ <div class="muted"><span id="agent-name">Agent</span></div>+ </header>+ <main>+ <h1>Embed policy</h1>+ <p class="sub">+ Control how <code id="embed-url"></code> can be embedded across the web.+ </p>++ <div id="status"></div>++ <!-- Origins -->+ <div class="card">+ <fieldset>+ <legend>Origins</legend>+ <label for="mode">Policy mode</label>+ <select id="mode">+ <option value="off">Off — allow all embeds</option>+ <option value="allowlist">Allowlist — only these hosts</option>+ <option value="denylist">Denylist — everywhere except these hosts</option>+ </select>++ <div id="hosts-wrap">+ <label for="hosts">Hosts (one per line)</label>+ <textarea+ id="hosts"+ placeholder="example.com *.substack.com"+ ></textarea>+ <div class="muted" style="margin-top: 6px">+ One host per line. Use <code>*.example.com</code> to match all+ subdomains.+ </div>+ </div>+ </fieldset>+ </div>++ <!-- Surfaces -->+ <div class="card">+ <fieldset>+ <legend>Surfaces</legend>+ <div class="muted" style="margin-bottom: 12px">+ Choose which embed surfaces are enabled for this agent.+ </div>+ <label class="check"+ ><input type="checkbox" id="surf-script" />+ <span+ ><strong>Script tag</strong> — <code><agent-3d></code> on+ third-party pages</span+ ></label+ >+ <label class="check"+ ><input type="checkbox" id="surf-iframe" />+ <span+ ><strong>iframe</strong> —+ <code><iframe src="/agent/:id/embed"></code></span+ ></label+ >+ <label class="check"+ ><input type="checkbox" id="surf-widget" />+ <span+ ><strong>Widget</strong> — <code>/w/:id</code> widget pages</span+ ></label+ >+ <label class="check"+ ><input type="checkbox" id="surf-mcp" />+ <span+ ><strong>MCP</strong> — exposed as an MCP tool over+ <code>/api/mcp</code></span+ ></label+ >+ </fieldset>+ </div>++ <!-- Brain -->+ <div class="card">+ <fieldset>+ <legend>Brain / LLM</legend>+ <label for="brain-mode">Payment mode</label>+ <select id="brain-mode">+ <option value="we-pay">+ We-pay — 3D Agent covers API costs (quota-limited)+ </option>+ <option value="key-proxy">+ Key-proxy — calls routed through your proxy URL+ </option>+ <option value="wallet-gated">+ Wallet-gated — user pays via connected wallet+ </option>+ <option value="none">None — LLM disabled for this agent</option>+ </select>++ <div id="proxy-url-wrap">+ <label for="brain-proxy-url">Proxy URL</label>+ <input+ type="url"+ id="brain-proxy-url"+ placeholder="https://owner.example/llm"+ />+ </div>++ <div class="col2" style="margin-top: 14px">+ <div>+ <label for="brain-quota">Monthly quota (completions)</label>+ <input+ type="number"+ id="brain-quota"+ min="0"+ placeholder="1000 (blank = unlimited)"+ />+ </div>+ <div>+ <label for="brain-rate">Rate limit (req / min)</label>+ <input+ type="number"+ id="brain-rate"+ min="0"+ placeholder="10 (blank = unlimited)"+ />+ </div>+ </div>++ <label for="brain-model">Model</label>+ <input type="text" id="brain-model" placeholder="claude-opus-4-6" />+ </fieldset>+ </div>++ <!-- Storage -->+ <div class="card">+ <fieldset>+ <legend>Storage</legend>+ <label for="storage-primary">Primary storage</label>+ <select id="storage-primary">+ <option value="r2">R2 (Cloudflare) — default</option>+ <option value="ipfs">IPFS — decentralised</option>+ </select>++ <label class="check" style="margin-top: 14px">+ <input type="checkbox" id="storage-ipfs" disabled />+ <span+ ><strong>IPFS pin</strong> — avatar pinned to IPFS+ <em class="muted">(pin flow coming soon)</em></span+ >+ </label>+ <label class="check">+ <input type="checkbox" id="storage-attested" disabled />+ <span+ ><strong>On-chain attestation</strong> — content hash recorded on-chain+ <em class="muted">(coming soon)</em></span+ >+ </label>+ </fieldset>+ </div>++ <div class="actions">+ <button class="btn" id="save">Save</button>+ <button class="btn sec" id="reload">Reload</button>+ <button class="btn danger" id="clear" style="margin-left: auto">+ Clear policy+ </button>+ </div>++ <hr />++ <div class="muted">+ Signed-in owners can preview the embed bypassing this policy by appending+ <code>?preview=1</code> to the embed URL.+ </div>+ </main>+ <script type="module">+ const params = new URL(location.href).searchParams;+ const agentId = params.get('agent');+ const statusEl = document.getElementById('status');+ const modeSel = document.getElementById('mode');+ const hostsEl = document.getElementById('hosts');+ const hostsWrap = document.getElementById('hosts-wrap');+ const nameEl = document.getElementById('agent-name');+ const urlEl = document.getElementById('embed-url');+ const brainModeSel = document.getElementById('brain-mode');+ const proxyWrap = document.getElementById('proxy-url-wrap');++ if (!agentId) {+ statusEl.innerHTML =+ '<div class="err">Missing <code>?agent=ID</code> in URL.</div>';+ throw new Error('no agent id');+ }+ urlEl.textContent = `/agent/${agentId}/embed`;++ async function api(method, path, body) {+ const res = await fetch(path, {+ method,+ credentials: 'include',+ headers: body ? { 'content-type': 'application/json' } : {},+ body: body ? JSON.stringify(body) : undefined,+ });+ const ct = res.headers.get('content-type') || '';+ const data = ct.includes('application/json') ? await res.json() : null;+ if (!res.ok)+ throw Object.assign(+ new Error((data && data.error_description) || res.statusText),+ { status: res.status, fields: data?.fields },+ );+ return data;+ }++ function setStatus(html) {+ statusEl.innerHTML = html;+ }++ function updateOriginVisibility() {+ hostsWrap.style.display = modeSel.value === 'off' ? 'none' : '';+ }++ function updateBrainVisibility() {+ proxyWrap.classList.toggle('hidden', brainModeSel.value !== 'key-proxy');+ }++ async function loadMe() {+ try {+ await api('GET', '/api/auth/me');+ } catch {+ location.href =+ '/login?next=' + encodeURIComponent(location.pathname + location.search);+ throw new Error('redirecting');+ }+ }++ async function loadAgent() {+ try {+ const { agent } = await api('GET', `/api/agents/${agentId}`);+ nameEl.textContent = agent.name || 'Agent';+ } catch (e) {+ setStatus(+ `<div class="err">Could not load agent: ${escapeHtml(e.message)}</div>`,+ );+ }+ }++ function populateForm(policy) {+ if (!policy) {+ modeSel.value = 'off';+ hostsEl.value = '';+ document.getElementById('surf-script').checked = true;+ document.getElementById('surf-iframe').checked = true;+ document.getElementById('surf-widget').checked = true;+ document.getElementById('surf-mcp').checked = false;+ brainModeSel.value = 'we-pay';+ document.getElementById('brain-proxy-url').value = '';+ document.getElementById('brain-quota').value = '1000';+ document.getElementById('brain-rate').value = '10';+ document.getElementById('brain-model').value = 'claude-opus-4-6';+ document.getElementById('storage-primary').value = 'r2';+ document.getElementById('storage-ipfs').checked = false;+ document.getElementById('storage-attested').checked = false;+ updateOriginVisibility();+ updateBrainVisibility();+ return;+ }++ const orig = policy.origins || {};+ modeSel.value = orig.mode === 'denylist' ? 'denylist' : 'allowlist';+ hostsEl.value = (orig.hosts || []).join('\n');++ const surf = policy.surfaces || {};+ document.getElementById('surf-script').checked = surf.script !== false;+ document.getElementById('surf-iframe').checked = surf.iframe !== false;+ document.getElementById('surf-widget').checked = surf.widget !== false;+ document.getElementById('surf-mcp').checked = !!surf.mcp;++ const brain = policy.brain || {};+ brainModeSel.value = brain.mode || 'we-pay';+ document.getElementById('brain-proxy-url').value = brain.proxy_url || '';+ document.getElementById('brain-quota').value =+ brain.monthly_quota != null ? String(brain.monthly_quota) : '';+ document.getElementById('brain-rate').value =+ brain.rate_limit_per_min != null ? String(brain.rate_limit_per_min) : '';+ document.getElementById('brain-model').value = brain.model || 'claude-opus-4-6';++ const storage = policy.storage || {};+ document.getElementById('storage-primary').value = storage.primary || 'r2';+ document.getElementById('storage-ipfs').checked = !!storage.pinned_ipfs;+ document.getElementById('storage-attested').checked = !!storage.onchain_attested;++ updateOriginVisibility();+ updateBrainVisibility();+ }++ async function loadPolicy() {+ try {+ const { policy } = await api('GET', `/api/agents/${agentId}/embed-policy`);+ populateForm(policy);+ } catch (e) {+ setStatus(+ `<div class="err">Could not load policy: ${escapeHtml(e.message)}</div>`,+ );+ }+ }++ function buildPolicy() {+ const numOrNull = (id) => {+ const v = document.getElementById(id).value.trim();+ return v === '' ? null : parseInt(v, 10);+ };++ return {+ version: 1,+ origins: {+ mode: modeSel.value === 'off' ? 'allowlist' : modeSel.value,+ hosts:+ modeSel.value === 'off'+ ? []+ : hostsEl.value+ .split(/\r?\n/)+ .map((s) => s.trim())+ .filter(Boolean),+ },+ surfaces: {+ script: document.getElementById('surf-script').checked,+ iframe: document.getElementById('surf-iframe').checked,+ widget: document.getElementById('surf-widget').checked,+ mcp: document.getElementById('surf-mcp').checked,+ },+ brain: {+ mode: brainModeSel.value,+ proxy_url: document.getElementById('brain-proxy-url').value.trim() || null,+ monthly_quota: numOrNull('brain-quota'),+ rate_limit_per_min: numOrNull('brain-rate'),+ model:+ document.getElementById('brain-model').value.trim() ||+ 'claude-opus-4-6',+ },+ storage: {+ primary: document.getElementById('storage-primary').value,+ pinned_ipfs: document.getElementById('storage-ipfs').checked,+ onchain_attested: document.getElementById('storage-attested').checked,+ },+ };+ }++ async function save() {+ setStatus('');+ try {+ const { policy } = await api(+ 'PUT',+ `/api/agents/${agentId}/embed-policy`,+ buildPolicy(),+ );+ populateForm(policy);+ setStatus('<div class="ok">Policy saved.</div>');+ } catch (e) {+ let msg = escapeHtml(e.message);+ if (e.fields && e.fields.length) {+ msg +=+ '<br><small>' ++ e.fields+ .map((f) => escapeHtml(f.path?.join('.') + ': ' + f.message))+ .join('<br>') ++ '</small>';+ }+ setStatus(`<div class="err">${msg}</div>`);+ }+ }++ async function clearPolicy() {+ if (!confirm('Clear the embed policy? Defaults will apply.')) return;+ try {+ await api('DELETE', `/api/agents/${agentId}/embed-policy`);+ populateForm(null);+ setStatus('<div class="ok">Policy cleared.</div>');+ } catch (e) {+ setStatus(`<div class="err">${escapeHtml(e.message)}</div>`);+ }+ }++ function escapeHtml(s) {+ return String(s ?? '').replace(+ /[&<>"']/g,+ (c) =>+ ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[+ c+ ],+ );+ }++ modeSel.addEventListener('change', updateOriginVisibility);+ brainModeSel.addEventListener('change', updateBrainVisibility);+ document.getElementById('save').addEventListener('click', save);+ document.getElementById('reload').addEventListener('click', loadPolicy);+ document.getElementById('clear').addEventListener('click', clearPolicy);++ (async () => {+ await loadMe();+ await loadAgent();+ await loadPolicy();+ })();+ </script>+ </body></html>diff --git a/dist-lib/dashboard/index.html b/dist-lib/dashboard/index.htmlindex 82b3b3f93..3299709d8 100644--- a/dist-lib/dashboard/index.html+++ b/dist-lib/dashboard/index.html@@ -1,161 +1,695 @@<!doctype html><html lang="en">-<head>-<meta charset="utf-8">-<meta name="viewport" content="width=device-width,initial-scale=1">-<title>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:-.01em; }- nav a { margin-right:14px; color:#aaa; font-size:14px; }- nav a.active { color:#fff; }- .layout { display:grid; grid-template-columns:220px 1fr; min-height:calc(100vh - 57px); }- aside { border-right:1px solid var(--border); padding:20px 0; }- aside a { display:block; padding:9px 20px; color:#aaa; font-size:14px; border-left:2px solid transparent; }- aside a.active { color:#fff; background:rgba(106,92,255,.08); border-left-color:var(--accent); }- main { padding:28px; max-width:1100px; }- h1 { font-size:22px; margin:0 0 6px; letter-spacing:-.01em; }- .sub { color:#888; margin:0 0 22px; font-size:14px; }- .cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; }- .card { background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:16px; }- .card h3 { margin:0 0 4px; font-size:15px; }- .card .meta { font-size:12px; color:#888; margin:0 0 10px; }- .preview { aspect-ratio:1/1; background:#0f0f17; border-radius:10px; margin-bottom:10px; overflow:hidden; display:grid; place-items:center; color:#555; font-size:12px; }- .preview model-viewer { width:100%; height:100%; }- .row { display:flex; align-items:center; gap:8px; }- .tag { font-size:11px; padding:2px 7px; border-radius:99px; background:#20202c; color:#ccc; }- .btn { padding:9px 14px; border-radius:9px; border:0; font-size:13px; font-weight:600; cursor:pointer; background:var(--accent); color:#fff; }- .btn.sec { background:#222230; color:#ddd; }- .empty { text-align:center; padding:60px 20px; border:1px dashed var(--border); border-radius:14px; color:#888; }- .toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }- .err { padding:12px; background:rgba(255,92,92,.1); border:1px solid rgba(255,92,92,.3); border-radius:8px; color:#ffb3b3; margin-bottom:14px; }- pre { background:#0f0f17; border:1px solid var(--border); border-radius:8px; padding:10px 12px; overflow:auto; font-size:12px; }- code { font-family: ui-monospace, SF Mono, Menlo, monospace; }- .key-row { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--border); }- .key-row:last-child { border:0; }- .muted { color:#888; font-size:13px; }- .section { margin-top:34px; }- input, textarea, select { background:#0f0f17; border:1px solid var(--border); color:#eee; padding:9px 11px; border-radius:8px; font-size:14px; font-family:inherit; }- input:focus, textarea:focus, select:focus { outline:none; border-color:var(--accent); }+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width,initial-scale=1" />+ <title>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;+ }+ nav a {+ margin-right: 14px;+ color: #aaa;+ font-size: 14px;+ }+ nav a.active {+ color: #fff;+ }+ .layout {+ display: grid;+ grid-template-columns: 220px 1fr;+ min-height: calc(100vh - 57px);+ }+ aside {+ border-right: 1px solid var(--border);+ padding: 20px 0;+ }+ aside a {+ display: block;+ padding: 9px 20px;+ color: #aaa;+ font-size: 14px;+ border-left: 2px solid transparent;+ }+ aside a.active {+ color: #fff;+ background: rgba(106, 92, 255, 0.08);+ border-left-color: var(--accent);+ }+ main {+ padding: 28px;+ max-width: 1100px;+ }+ h1 {+ font-size: 22px;+ margin: 0 0 6px;+ letter-spacing: -0.01em;+ }+ .sub {+ color: #888;+ margin: 0 0 22px;+ font-size: 14px;+ }+ .cards {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));+ gap: 14px;+ }+ .card {+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 14px;+ padding: 16px;+ }+ .card h3 {+ margin: 0 0 4px;+ font-size: 15px;+ }+ .card .meta {+ font-size: 12px;+ color: #888;+ margin: 0 0 10px;+ }+ .preview {+ aspect-ratio: 1/1;+ background: #0f0f17;+ border-radius: 10px;+ margin-bottom: 10px;+ overflow: hidden;+ display: grid;+ place-items: center;+ color: #555;+ font-size: 12px;+ }+ .preview model-viewer {+ width: 100%;+ height: 100%;+ }+ .row {+ display: flex;+ align-items: center;+ gap: 8px;+ }+ .tag {+ font-size: 11px;+ padding: 2px 7px;+ border-radius: 99px;+ background: #20202c;+ color: #ccc;+ }+ .btn {+ padding: 9px 14px;+ border-radius: 9px;+ border: 0;+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ background: var(--accent);+ color: #fff;+ }+ .btn.sec {+ background: #222230;+ color: #ddd;+ }+ .empty {+ text-align: center;+ padding: 60px 20px;+ border: 1px dashed var(--border);+ border-radius: 14px;+ color: #888;+ }+ .toolbar {+ display: flex;+ justify-content: space-between;+ align-items: center;+ margin-bottom: 18px;+ }+ .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;+ }+ pre {+ background: #0f0f17;+ border: 1px solid var(--border);+ border-radius: 8px;+ padding: 10px 12px;+ overflow: auto;+ font-size: 12px;+ }+ code {+ font-family:+ ui-monospace,+ SF Mono,+ Menlo,+ monospace;+ }+ .key-row {+ display: flex;+ justify-content: space-between;+ align-items: center;+ padding: 10px 0;+ border-bottom: 1px solid var(--border);+ }+ .key-row:last-child {+ border: 0;+ }+ .muted {+ color: #888;+ font-size: 13px;+ }+ .section {+ margin-top: 34px;+ }+ input,+ textarea,+ select {+ background: #0f0f17;+ border: 1px solid var(--border);+ color: #eee;+ padding: 9px 11px;+ border-radius: 8px;+ font-size: 14px;+ font-family: inherit;+ }+ input:focus,+ textarea:focus,+ select:focus {+ outline: none;+ border-color: var(--accent);+ }- /* ── Widgets tab ─────────────────────────────────────────────────────── */- .btn-primary { display:inline-block; padding:9px 14px; border-radius:9px; border:0; font-size:13px; font-weight:600; cursor:pointer; background:var(--accent); color:#fff; text-decoration:none; }- .btn-primary:hover { filter:brightness(1.08); }- .btn-danger { background:#cc4040; }- .widgets-header { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; margin-bottom:18px; flex-wrap:wrap; }- .widgets-header h1 { margin-bottom:6px; }- .widget-toolbar { display:flex; gap:10px; align-items:center; margin-bottom:18px; flex-wrap:wrap; }- .widget-toolbar input, .widget-toolbar select { padding:7px 10px; font-size:13px; }- .widget-toolbar input[type="search"] { min-width:200px; }- .widget-card { background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:14px; display:flex; flex-direction:column; gap:10px; position:relative; transition:border-color .15s; }- .widget-card:hover { border-color:#2c2c40; }- .widget-card .frame { aspect-ratio:1/1; background:#0f0f17; border-radius:10px; overflow:hidden; position:relative; }- .widget-card .frame iframe { width:100%; height:100%; border:0; display:block; }- .widget-card .frame .placeholder { display:grid; place-items:center; height:100%; color:#555; font-size:12px; padding:10px; text-align:center; }- .widget-card .title { display:flex; align-items:baseline; gap:8px; min-height:22px; }- .widget-card .title h3 { margin:0; font-size:14px; cursor:text; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }- .widget-card .title input { flex:1; padding:3px 6px; font-size:14px; font-weight:600; }- .widget-card .pill { display:inline-flex; align-items:center; gap:6px; font-size:11px; padding:2px 8px; border-radius:99px; background:#20202c; color:#ccc; white-space:nowrap; }- .widget-card .pill .dot { width:7px; height:7px; border-radius:50%; }- .widget-card .meta { font-size:12px; color:#888; }- .widget-card .actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:auto; }- .widget-card .actions button, .widget-card .actions a { padding:6px 10px; border-radius:7px; border:1px solid var(--border); background:#1a1a24; color:#ddd; font-size:12px; cursor:pointer; text-decoration:none; }- .widget-card .actions button:hover, .widget-card .actions a:hover { background:#22222e; }- .widget-card .actions .danger:hover { background:rgba(204,64,64,.18); border-color:rgba(204,64,64,.5); color:#ffb3b3; }- .toggle { position:relative; display:inline-flex; align-items:center; gap:6px; cursor:pointer; user-select:none; }- .toggle input { position:absolute; opacity:0; width:0; height:0; }- .toggle .track { width:30px; height:17px; background:#2a2a36; border-radius:99px; position:relative; transition:background .15s; }- .toggle .track::after { content:''; position:absolute; top:2px; left:2px; width:13px; height:13px; background:#aaa; border-radius:50%; transition:transform .15s, background .15s; }- .toggle input:checked + .track { background:rgba(106,92,255,.55); }- .toggle input:checked + .track::after { transform:translateX(13px); background:#fff; }- .toggle input:focus-visible + .track { outline:2px solid var(--accent); outline-offset:2px; }- .toggle .label { font-size:11px; color:#888; }+ /* ── Widgets tab ─────────────────────────────────────────────────────── */+ .btn-primary {+ display: inline-block;+ padding: 9px 14px;+ border-radius: 9px;+ border: 0;+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ background: var(--accent);+ color: #fff;+ text-decoration: none;+ }+ .btn-primary:hover {+ filter: brightness(1.08);+ }+ .btn-danger {+ background: #cc4040;+ }+ .widgets-header {+ display: flex;+ justify-content: space-between;+ align-items: flex-start;+ gap: 14px;+ margin-bottom: 18px;+ flex-wrap: wrap;+ }+ .widgets-header h1 {+ margin-bottom: 6px;+ }+ .widget-toolbar {+ display: flex;+ gap: 10px;+ align-items: center;+ margin-bottom: 18px;+ flex-wrap: wrap;+ }+ .widget-toolbar input,+ .widget-toolbar select {+ padding: 7px 10px;+ font-size: 13px;+ }+ .widget-toolbar input[type='search'] {+ min-width: 200px;+ }+ .widget-card {+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 14px;+ padding: 14px;+ display: flex;+ flex-direction: column;+ gap: 10px;+ position: relative;+ transition: border-color 0.15s;+ }+ .widget-card:hover {+ border-color: #2c2c40;+ }+ .widget-card .frame {+ aspect-ratio: 1/1;+ background: #0f0f17;+ border-radius: 10px;+ overflow: hidden;+ position: relative;+ }+ .widget-card .frame iframe {+ width: 100%;+ height: 100%;+ border: 0;+ display: block;+ }+ .widget-card .frame .placeholder {+ display: grid;+ place-items: center;+ height: 100%;+ color: #555;+ font-size: 12px;+ padding: 10px;+ text-align: center;+ }+ .widget-card .title {+ display: flex;+ align-items: baseline;+ gap: 8px;+ min-height: 22px;+ }+ .widget-card .title h3 {+ margin: 0;+ font-size: 14px;+ cursor: text;+ flex: 1;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .widget-card .title input {+ flex: 1;+ padding: 3px 6px;+ font-size: 14px;+ font-weight: 600;+ }+ .widget-card .pill {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ font-size: 11px;+ padding: 2px 8px;+ border-radius: 99px;+ background: #20202c;+ color: #ccc;+ white-space: nowrap;+ }+ .widget-card .pill .dot {+ width: 7px;+ height: 7px;+ border-radius: 50%;+ }+ .widget-card .meta {+ font-size: 12px;+ color: #888;+ }+ .widget-card .actions {+ display: flex;+ gap: 6px;+ flex-wrap: wrap;+ margin-top: auto;+ }+ .widget-card .actions button,+ .widget-card .actions a {+ padding: 6px 10px;+ border-radius: 7px;+ border: 1px solid var(--border);+ background: #1a1a24;+ color: #ddd;+ font-size: 12px;+ cursor: pointer;+ text-decoration: none;+ }+ .widget-card .actions button:hover,+ .widget-card .actions a:hover {+ background: #22222e;+ }+ .widget-card .actions .danger:hover {+ background: rgba(204, 64, 64, 0.18);+ border-color: rgba(204, 64, 64, 0.5);+ color: #ffb3b3;+ }+ .toggle {+ position: relative;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ cursor: pointer;+ user-select: none;+ }+ .toggle input {+ position: absolute;+ opacity: 0;+ width: 0;+ height: 0;+ }+ .toggle .track {+ width: 30px;+ height: 17px;+ background: #2a2a36;+ border-radius: 99px;+ position: relative;+ transition: background 0.15s;+ }+ .toggle .track::after {+ content: '';+ position: absolute;+ top: 2px;+ left: 2px;+ width: 13px;+ height: 13px;+ background: #aaa;+ border-radius: 50%;+ transition:+ transform 0.15s,+ background 0.15s;+ }+ .toggle input:checked + .track {+ background: rgba(106, 92, 255, 0.55);+ }+ .toggle input:checked + .track::after {+ transform: translateX(13px);+ background: #fff;+ }+ .toggle input:focus-visible + .track {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ .toggle .label {+ font-size: 11px;+ color: #888;+ }- /* Drawer */- .drawer-overlay { position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:50; opacity:0; pointer-events:none; transition:opacity .18s; }- .drawer-overlay.open { opacity:1; pointer-events:auto; }- .drawer { position:fixed; right:0; top:0; bottom:0; width:min(560px, 100vw); background:#0e0e16; border-left:1px solid var(--border); transform:translateX(100%); transition:transform .22s cubic-bezier(.2,.8,.2,1); z-index:51; overflow-y:auto; }- .drawer.open { transform:none; }- .drawer header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); position:sticky; top:0; background:#0e0e16; z-index:1; }- .drawer header h2 { margin:0; font-size:16px; }- .drawer .body { padding:20px; display:flex; flex-direction:column; gap:18px; }- .drawer .frame-lg { aspect-ratio:1/1; background:#0f0f17; border-radius:10px; overflow:hidden; }- .drawer .frame-lg iframe { width:100%; height:100%; border:0; }- .drawer .stat-grid { display:grid; grid-template-columns:repeat(2, 1fr); gap:10px; }- .drawer .stat { background:#13131c; border:1px solid var(--border); border-radius:10px; padding:12px 14px; }- .drawer .stat .n { font-size:22px; font-weight:600; }- .drawer .stat .l { font-size:11px; color:#888; text-transform:uppercase; letter-spacing:.5px; }- .spark { width:100%; height:60px; }- .spark path.area { fill:rgba(106,92,255,.18); }- .spark path.line { fill:none; stroke:var(--accent); stroke-width:2; }- .spark .axis { stroke:#22222e; stroke-width:1; }- details summary { cursor:pointer; padding:6px 0; color:#aaa; font-size:13px; }- details[open] summary { color:#eee; }- .danger-zone { border:1px solid rgba(204,64,64,.4); border-radius:10px; padding:14px; background:rgba(204,64,64,.05); }- .danger-zone h3 { margin:0 0 6px; color:#ffb3b3; font-size:13px; }+ /* Drawer */+ .drawer-overlay {+ position: fixed;+ inset: 0;+ background: rgba(0, 0, 0, 0.55);+ z-index: 50;+ opacity: 0;+ pointer-events: none;+ transition: opacity 0.18s;+ }+ .drawer-overlay.open {+ opacity: 1;+ pointer-events: auto;+ }+ .drawer {+ position: fixed;+ right: 0;+ top: 0;+ bottom: 0;+ width: min(560px, 100vw);+ background: #0e0e16;+ border-left: 1px solid var(--border);+ transform: translateX(100%);+ transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);+ z-index: 51;+ overflow-y: auto;+ }+ .drawer.open {+ transform: none;+ }+ .drawer header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 16px 20px;+ border-bottom: 1px solid var(--border);+ position: sticky;+ top: 0;+ background: #0e0e16;+ z-index: 1;+ }+ .drawer header h2 {+ margin: 0;+ font-size: 16px;+ }+ .drawer .body {+ padding: 20px;+ display: flex;+ flex-direction: column;+ gap: 18px;+ }+ .drawer .frame-lg {+ aspect-ratio: 1/1;+ background: #0f0f17;+ border-radius: 10px;+ overflow: hidden;+ }+ .drawer .frame-lg iframe {+ width: 100%;+ height: 100%;+ border: 0;+ }+ .drawer .stat-grid {+ display: grid;+ grid-template-columns: repeat(2, 1fr);+ gap: 10px;+ }+ .drawer .stat {+ background: #13131c;+ border: 1px solid var(--border);+ border-radius: 10px;+ padding: 12px 14px;+ }+ .drawer .stat .n {+ font-size: 22px;+ font-weight: 600;+ }+ .drawer .stat .l {+ font-size: 11px;+ color: #888;+ text-transform: uppercase;+ letter-spacing: 0.5px;+ }+ .spark {+ width: 100%;+ height: 60px;+ }+ .spark path.area {+ fill: rgba(106, 92, 255, 0.18);+ }+ .spark path.line {+ fill: none;+ stroke: var(--accent);+ stroke-width: 2;+ }+ .spark .axis {+ stroke: #22222e;+ stroke-width: 1;+ }+ details summary {+ cursor: pointer;+ padding: 6px 0;+ color: #aaa;+ font-size: 13px;+ }+ details[open] summary {+ color: #eee;+ }+ .danger-zone {+ border: 1px solid rgba(204, 64, 64, 0.4);+ border-radius: 10px;+ padding: 14px;+ background: rgba(204, 64, 64, 0.05);+ }+ .danger-zone h3 {+ margin: 0 0 6px;+ color: #ffb3b3;+ font-size: 13px;+ }- /* Modal */- .modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:60; display:grid; place-items:center; opacity:0; pointer-events:none; transition:opacity .15s; }- .modal-overlay.open { opacity:1; pointer-events:auto; }- .modal { background:#0e0e16; border:1px solid var(--border); border-radius:14px; padding:22px; width:min(560px, 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; }- .size-presets { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }- .size-presets button { padding:6px 12px; border-radius:99px; border:1px solid var(--border); background:#13131c; color:#ccc; font-size:12px; cursor:pointer; }- .size-presets button.active { border-color:var(--accent); color:#fff; background:rgba(106,92,255,.15); }- .size-inputs { display:flex; gap:8px; align-items:center; margin-bottom:14px; }- .size-inputs input { width:90px; }+ /* Modal */+ .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(560px, 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;+ }+ .size-presets {+ display: flex;+ gap: 6px;+ flex-wrap: wrap;+ margin-bottom: 14px;+ }+ .size-presets button {+ padding: 6px 12px;+ border-radius: 99px;+ border: 1px solid var(--border);+ background: #13131c;+ color: #ccc;+ font-size: 12px;+ cursor: pointer;+ }+ .size-presets button.active {+ border-color: var(--accent);+ color: #fff;+ background: rgba(106, 92, 255, 0.15);+ }+ .size-inputs {+ display: flex;+ gap: 8px;+ align-items: center;+ margin-bottom: 14px;+ }+ .size-inputs input {+ width: 90px;+ }- .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,.4); animation:toast-in .2s; }- @keyframes toast-in { from { opacity:0; transform:translate(-50%, 8px); } to { opacity:1; transform:translateX(-50%); } }+ .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%);+ }+ }- /* visually-hidden utility for screen-reader-only labels */- .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }-</style>-<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"></script>-</head>-<body>-<header>- <div class="brand"><a href="/">3D Agent</a></div>- <div class="row">- <span id="user-email" class="muted"></span>- <button class="btn sec" onclick="signOut()">Sign out</button>- </div>-</header>-<div class="layout">- <aside>- <a href="#avatars" class="active" data-tab="avatars">Avatars</a>- <a href="#create" data-tab="create">Create from selfie</a>- <a href="#upload" data-tab="upload">Upload</a>- <a href="#widgets" data-tab="widgets">Widgets</a>- <a href="#embed" data-tab="embed">Embed</a>- <a href="#keys" data-tab="keys">API keys</a>- <a href="#mcp" data-tab="mcp">MCP</a>- <a href="#billing" data-tab="billing">Plan & usage</a>- </aside>- <main id="main"></main>-</div>-<script type="module">-import { state, api, navigate, signOut } from '/dashboard/dashboard.js';-window.signOut = signOut;+ /* visually-hidden utility for screen-reader-only labels */+ .sr-only {+ position: absolute;+ width: 1px;+ height: 1px;+ padding: 0;+ margin: -1px;+ overflow: hidden;+ clip: rect(0, 0, 0, 0);+ border: 0;+ }+ </style>+ <script+ type="module"+ src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"+ ></script>+ </head>+ <body>+ <header>+ <div class="brand"><a href="/">3D Agent</a></div>+ <div class="row">+ <span id="user-email" class="muted"></span>+ <button class="btn sec" onclick="signOut()">Sign out</button>+ </div>+ </header>+ <div class="layout">+ <aside>+ <a href="#avatars" class="active" data-tab="avatars">Avatars</a>+ <a href="#create" data-tab="create">Create from selfie</a>+ <a href="#upload" data-tab="upload">Upload</a>+ <a href="#widgets" data-tab="widgets">Widgets</a>+ <a href="#embed" data-tab="embed">Embed</a>+ <a href="#keys" data-tab="keys">API keys</a>+ <a href="#mcp" data-tab="mcp">MCP</a>+ <a href="#billing" data-tab="billing">Plan & usage</a>+ <a href="/explore" title="Browse on-chain agents across every supported chain"+ >Explore on-chain ↗</a+ >+ </aside>+ <main id="main"></main>+ </div>+ <script type="module">+ import { state, api, navigate, signOut } from '/dashboard/dashboard.js';+ window.signOut = signOut;-(async () => {- try {- const me = await api.me();- state.user = me.user;- document.getElementById('user-email').textContent = me.user.email;- } catch {- location.href = '/login?next=' + encodeURIComponent(location.pathname + location.hash);- return;- }- navigate(location.hash.slice(1) || 'avatars');- window.addEventListener('hashchange', () => navigate(location.hash.slice(1) || 'avatars'));-})();-</script>-</body>+ (async () => {+ try {+ const me = await api.me();+ state.user = me.user;+ document.getElementById('user-email').textContent = me.user.email;+ } catch {+ location.href =+ '/login?next=' + encodeURIComponent(location.pathname + location.hash);+ return;+ }+ navigate(location.hash.slice(1) || 'avatars');+ window.addEventListener('hashchange', () =>+ navigate(location.hash.slice(1) || 'avatars'),+ );+ })();+ </script>+ </body></html>diff --git a/dist-lib/dashboard/storage.html b/dist-lib/dashboard/storage.htmlnew file mode 100644index 000000000..bc9170d24--- /dev/null+++ b/dist-lib/dashboard/storage.html@@ -0,0 +1,447 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width,initial-scale=1" />+ <title>Storage · 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;+ }+ main {+ padding: 28px;+ max-width: 720px;+ 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;+ }+ .card {+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 14px;+ padding: 20px;+ margin-bottom: 20px;+ }+ fieldset {+ border: 0;+ padding: 0;+ margin: 0;+ }+ legend {+ font-size: 13px;+ font-weight: 600;+ color: #ccc;+ margin-bottom: 12px;+ letter-spacing: 0.02em;+ text-transform: uppercase;+ }+ label {+ display: block;+ margin: 14px 0 6px;+ font-size: 13px;+ color: #bbb;+ }+ input,+ select {+ background: #0f0f17;+ border: 1px solid var(--border);+ color: #eee;+ padding: 9px 11px;+ border-radius: 8px;+ font-size: 14px;+ font-family: inherit;+ width: 100%;+ }+ input:focus,+ select:focus {+ outline: none;+ border-color: var(--accent);+ }+ .kv {+ display: flex;+ align-items: center;+ gap: 10px;+ margin: 10px 0;+ }+ .kv-label {+ font-size: 13px;+ color: #888;+ min-width: 120px;+ }+ .kv-value {+ font-size: 13px;+ color: #ddd;+ word-break: break-all;+ }+ .badge {+ display: inline-block;+ font-size: 11px;+ font-weight: 700;+ padding: 2px 8px;+ border-radius: 99px;+ letter-spacing: 0.04em;+ }+ .badge.green {+ background: rgba(92, 255, 140, 0.1);+ color: #7ef0a3;+ border: 1px solid rgba(92, 255, 140, 0.25);+ }+ .badge.grey {+ background: rgba(180, 180, 200, 0.08);+ color: #aaa;+ border: 1px solid rgba(180, 180, 200, 0.15);+ }+ .badge.yellow {+ background: rgba(255, 220, 92, 0.1);+ color: #f0dc7e;+ border: 1px solid rgba(255, 220, 92, 0.25);+ }+ .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;+ }+ .muted {+ 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;+ }+ .ok {+ padding: 12px;+ background: rgba(92, 255, 140, 0.07);+ border: 1px solid rgba(92, 255, 140, 0.2);+ border-radius: 8px;+ color: #b6f2c6;+ margin-bottom: 14px;+ }+ code {+ font-family:+ ui-monospace,+ SF Mono,+ Menlo,+ monospace;+ background: #0f0f17;+ border: 1px solid var(--border);+ border-radius: 4px;+ padding: 1px 6px;+ font-size: 12px;+ }+ .actions {+ display: flex;+ gap: 10px;+ margin-top: 16px;+ }+ hr {+ border: 0;+ border-top: 1px solid var(--border);+ margin: 22px 0;+ }+ .hidden {+ display: none !important;+ }+ </style>+ </head>+ <body>+ <header>+ <div class="brand"><a href="/dashboard">← Dashboard</a></div>+ <div class="muted"><span id="avatar-name">Avatar</span></div>+ </header>+ <main>+ <h1>Storage</h1>+ <p class="sub">+ Manage where <code id="avatar-id-label"></code>'s bytes live and track content+ attestation.+ </p>++ <div id="status"></div>++ <!-- R2 -->+ <div class="card">+ <fieldset>+ <legend>R2 (primary storage)</legend>+ <div class="kv">+ <span class="kv-label">Status</span>+ <span class="badge green" id="r2-present-badge">Present</span>+ </div>+ <div class="kv">+ <span class="kv-label">Storage key</span>+ <code id="r2-key" class="kv-value">—</code>+ </div>+ </fieldset>+ </div>++ <!-- IPFS -->+ <div class="card">+ <fieldset>+ <legend>IPFS</legend>+ <div class="kv">+ <span class="kv-label">Pinned</span>+ <span class="badge grey" id="ipfs-pinned-badge">Not pinned</span>+ </div>+ <div class="kv" id="ipfs-cid-row">+ <span class="kv-label">CID</span>+ <code id="ipfs-cid" class="kv-value">—</code>+ </div>+ <div class="kv" id="ipfs-pinned-at-row">+ <span class="kv-label">Pinned at</span>+ <span id="ipfs-pinned-at" class="kv-value muted">—</span>+ </div>+ <div class="actions">+ <button class="btn" id="pin-btn">Pin to IPFS (stub)</button>+ </div>+ <p class="muted" style="margin-top: 10px">+ Real Pinata / Web3.Storage integration is a follow-up. This stub records a+ placeholder CID derived from the content hash.+ </p>+ </fieldset>+ </div>++ <!-- Attestation -->+ <div class="card">+ <fieldset>+ <legend>On-chain attestation</legend>+ <div class="kv">+ <span class="kv-label">Content hash</span>+ <code id="attest-hash" class="kv-value">—</code>+ </div>+ <div class="kv">+ <span class="kv-label">Chain</span>+ <span id="attest-chain" class="kv-value muted">—</span>+ </div>+ <div class="kv">+ <span class="kv-label">Tx hash</span>+ <code id="attest-tx" class="kv-value">—</code>+ </div>+ <div class="kv">+ <span class="kv-label">Attested at</span>+ <span id="attest-at" class="kv-value muted">—</span>+ </div>+ <p class="muted" style="margin-top: 10px">+ On-chain attestation is read-only. Content hashing runs server-side+ post-upload. Transaction broadcasting is a future feature.+ </p>+ </fieldset>+ </div>++ <div class="actions">+ <button class="btn sec" id="reload">Reload</button>+ </div>+ </main>+ <script type="module">+ const params = new URL(location.href).searchParams;+ const avatarId = params.get('id');+ const statusEl = document.getElementById('status');+ const nameEl = document.getElementById('avatar-name');+ const labelEl = document.getElementById('avatar-id-label');++ if (!avatarId) {+ statusEl.innerHTML =+ '<div class="err">Missing <code>?id=AVATAR_ID</code> in URL.</div>';+ throw new Error('no avatar id');+ }+ labelEl.textContent = avatarId;++ async function api(method, path, body) {+ const res = await fetch(path, {+ method,+ credentials: 'include',+ headers: body ? { 'content-type': 'application/json' } : {},+ body: body ? JSON.stringify(body) : undefined,+ });+ const ct = res.headers.get('content-type') || '';+ const data = ct.includes('application/json') ? await res.json() : null;+ if (!res.ok)+ throw Object.assign(+ new Error((data && data.error_description) || res.statusText),+ { status: res.status },+ );+ return data;+ }++ function setStatus(html) {+ statusEl.innerHTML = html;+ }++ function escapeHtml(s) {+ return String(s ?? '').replace(+ /[&<>"']/g,+ (c) =>+ ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[+ c+ ],+ );+ }++ function populateMode(mode) {+ if (!mode) return;++ // R2+ document.getElementById('r2-key').textContent = mode.r2?.key || '—';+ const r2Badge = document.getElementById('r2-present-badge');+ if (mode.r2?.present) {+ r2Badge.textContent = 'Present';+ r2Badge.className = 'badge green';+ } else {+ r2Badge.textContent = 'Missing';+ r2Badge.className = 'badge grey';+ }++ // IPFS+ const ipfsBadge = document.getElementById('ipfs-pinned-badge');+ if (mode.ipfs?.pinned) {+ ipfsBadge.textContent = 'Pinned';+ ipfsBadge.className = 'badge green';+ document.getElementById('pin-btn').disabled = true;+ document.getElementById('pin-btn').textContent = 'Already pinned';+ } else {+ ipfsBadge.textContent = 'Not pinned';+ ipfsBadge.className = 'badge grey';+ document.getElementById('pin-btn').disabled = false;+ document.getElementById('pin-btn').textContent = 'Pin to IPFS (stub)';+ }+ document.getElementById('ipfs-cid').textContent = mode.ipfs?.cid || '—';+ document.getElementById('ipfs-pinned-at').textContent = mode.ipfs?.pinned_at+ ? new Date(mode.ipfs.pinned_at).toLocaleString()+ : '—';++ // Attestation+ const hash = mode.attestation?.hash;+ document.getElementById('attest-hash').textContent = hash || 'Not yet computed';+ document.getElementById('attest-chain').textContent =+ mode.attestation?.chain_id != null ? String(mode.attestation.chain_id) : '—';+ document.getElementById('attest-tx').textContent = mode.attestation?.tx_hash || '—';+ document.getElementById('attest-at').textContent = mode.attestation?.attested_at+ ? new Date(mode.attestation.attested_at).toLocaleString()+ : '—';+ }++ async function loadMe() {+ try {+ await api('GET', '/api/auth/me');+ } catch {+ location.href =+ '/login?next=' + encodeURIComponent(location.pathname + location.search);+ throw new Error('redirecting');+ }+ }++ async function loadAvatar() {+ try {+ const data = await api('GET', `/api/avatars/${avatarId}`);+ const av = data.avatar || data;+ nameEl.textContent = av.name || avatarId;+ } catch (e) {+ setStatus(+ `<div class="err">Could not load avatar: ${escapeHtml(e.message)}</div>`,+ );+ }+ }++ async function loadMode() {+ try {+ const { storage_mode } = await api(+ 'GET',+ `/api/avatars/${avatarId}/storage-mode`,+ );+ populateMode(storage_mode);+ } catch (e) {+ setStatus(+ `<div class="err">Could not load storage mode: ${escapeHtml(e.message)}</div>`,+ );+ }+ }++ async function pinIpfs() {+ setStatus('');+ document.getElementById('pin-btn').disabled = true;+ try {+ const { storage_mode } = await api('POST', `/api/avatars/${avatarId}/pin-ipfs`);+ populateMode(storage_mode);+ setStatus(+ '<div class="ok">Pinned (stub). Real IPFS pinning is a follow-up.</div>',+ );+ } catch (e) {+ document.getElementById('pin-btn').disabled = false;+ setStatus(`<div class="err">${escapeHtml(e.message)}</div>`);+ }+ }++ document.getElementById('pin-btn').addEventListener('click', pinIpfs);+ document.getElementById('reload').addEventListener('click', loadMode);++ (async () => {+ await loadMe();+ await loadAvatar();+ await loadMode();+ })();+ </script>+ </body>+</html>diff --git a/dist-lib/dashboard/usage.html b/dist-lib/dashboard/usage.htmlnew file mode 100644index 000000000..3d46aae13--- /dev/null+++ b/dist-lib/dashboard/usage.html@@ -0,0 +1,212 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width,initial-scale=1" />+ <title>LLM Usage — 3D Agent</title>+ <link rel="stylesheet" href="/assets/dashboard.css" />+ <style>+ body {+ font-family:+ system-ui,+ -apple-system,+ sans-serif;+ max-width: 640px;+ margin: 2rem auto;+ padding: 0 1rem;+ color: #111;+ }+ h1 {+ font-size: 1.25rem;+ margin-bottom: 0.25rem;+ }+ .sub {+ color: #555;+ font-size: 0.875rem;+ margin-bottom: 1.5rem;+ }+ .quota-bar {+ background: #e5e7eb;+ border-radius: 999px;+ height: 12px;+ overflow: hidden;+ margin: 0.5rem 0 0.25rem;+ }+ .quota-fill {+ background: #3b82f6;+ height: 100%;+ border-radius: 999px;+ transition: width 0.4s;+ }+ .quota-fill.warn {+ background: #f59e0b;+ }+ .quota-fill.danger {+ background: #ef4444;+ }+ .quota-label {+ font-size: 0.8rem;+ color: #555;+ }+ table {+ width: 100%;+ border-collapse: collapse;+ margin-top: 1.5rem;+ font-size: 0.875rem;+ }+ th {+ text-align: left;+ padding: 6px 8px;+ border-bottom: 2px solid #e5e7eb;+ color: #555;+ font-weight: 600;+ }+ td {+ padding: 5px 8px;+ border-bottom: 1px solid #f3f4f6;+ }+ .sparkline {+ display: flex;+ align-items: flex-end;+ gap: 2px;+ height: 40px;+ margin-top: 1.5rem;+ }+ .sparkline-bar {+ flex: 1;+ background: #3b82f6;+ border-radius: 2px 2px 0 0;+ min-height: 2px;+ }+ .sparkline-bar:hover {+ background: #2563eb;+ }+ .error {+ color: #dc2626;+ padding: 1rem 0;+ }+ .section {+ margin-top: 2rem;+ }+ h2 {+ font-size: 1rem;+ margin-bottom: 0.5rem;+ color: #374151;+ }+ </style>+ </head>+ <body>+ <h1>LLM Usage</h1>+ <div class="sub" id="agent-label">Loading…</div>++ <div class="section" id="quota-section" style="display: none">+ <h2>Current month</h2>+ <div class="quota-bar">+ <div class="quota-fill" id="quota-fill" style="width: 0%"></div>+ </div>+ <div class="quota-label" id="quota-label"></div>+ </div>++ <div class="section" id="spark-section" style="display: none">+ <h2>Last 30 days</h2>+ <div class="sparkline" id="sparkline"></div>+ </div>++ <div class="section" id="table-section" style="display: none">+ <table>+ <thead>+ <tr>+ <th>Day</th>+ <th>Calls</th>+ </tr>+ </thead>+ <tbody id="daily-tbody"></tbody>+ </table>+ </div>++ <div class="error" id="error-msg" style="display: none"></div>++ <script>+ (async () => {+ const params = new URLSearchParams(location.search);+ const id = params.get('id');+ if (!id) {+ show('error-msg', 'Missing ?id= parameter.');+ return;+ }++ document.getElementById('agent-label').textContent = `Agent ${id}`;++ let data;+ try {+ const r = await fetch(`/api/agents/${id}/usage`, { credentials: 'include' });+ if (r.status === 401) {+ show('error-msg', 'Not signed in. Visit /login first.');+ return;+ }+ if (r.status === 404) {+ show('error-msg', 'Agent not found or not yours.');+ return;+ }+ if (!r.ok) {+ show('error-msg', `Error ${r.status}`);+ return;+ }+ data = await r.json();+ } catch (e) {+ show('error-msg', `Fetch failed: ${e.message}`);+ return;+ }++ const { currentMonthCalls, monthlyQuota, dailyBreakdown, agentId } = data;+ document.getElementById('agent-label').textContent = `Agent ${agentId}`;++ // Quota bar+ if (typeof monthlyQuota === 'number') {+ const pct = Math.min(100, (currentMonthCalls / monthlyQuota) * 100);+ const fill = document.getElementById('quota-fill');+ fill.style.width = pct + '%';+ fill.className =+ 'quota-fill' + (pct >= 90 ? ' danger' : pct >= 70 ? ' warn' : '');+ document.getElementById('quota-label').textContent =+ `${currentMonthCalls.toLocaleString()} / ${monthlyQuota.toLocaleString()} calls this month (${Math.round(pct)}%)`;+ document.getElementById('quota-section').style.display = '';+ } else {+ document.getElementById('quota-section').style.display = '';+ document.getElementById('quota-label').textContent =+ `${currentMonthCalls.toLocaleString()} calls this month (no quota set)`;+ }++ // Sparkline + table+ if (dailyBreakdown && dailyBreakdown.length) {+ const max = Math.max(1, ...dailyBreakdown.map((r) => r.calls));+ const spark = document.getElementById('sparkline');+ const tbody = document.getElementById('daily-tbody');+ for (const row of dailyBreakdown) {+ const bar = document.createElement('div');+ bar.className = 'sparkline-bar';+ bar.style.height = Math.max(2, Math.round((row.calls / max) * 40)) + 'px';+ bar.title = `${row.day}: ${row.calls}`;+ spark.appendChild(bar);++ const tr = document.createElement('tr');+ tr.innerHTML = `<td>${row.day}</td><td>${row.calls.toLocaleString()}</td>`;+ tbody.appendChild(tr);+ }+ document.getElementById('spark-section').style.display = '';+ document.getElementById('table-section').style.display = '';+ } else {+ document.getElementById('spark-section').style.display = '';+ document.getElementById('spark-section').innerHTML +=+ '<p style="color:#555;font-size:0.875rem">No calls in the last 30 days.</p>';+ }+ })();++ function show(id, msg) {+ const el = document.getElementById(id);+ el.textContent = msg;+ el.style.display = '';+ }+ </script>+ </body>+</html>diff --git a/dist-lib/explore/explore.js b/dist-lib/explore/explore.jsnew file mode 100644index 000000000..0b8556578--- /dev/null+++ b/dist-lib/explore/explore.js@@ -0,0 +1,348 @@+/**+ * /explore — ERC-8004 agent marketplace grid.+ *+ * Pulls from GET /api/explore. Filters + infinite pagination via cursor.+ * Clicking a card opens the on-chain token page on the source chain's+ * explorer; clicking the 3D preview (when present) loads the GLB in the+ * main viewer via /#model=<url>.+ */++const CHAINS = [+ { id: 8453, name: 'Base' },+ { id: 42161, name: 'Arbitrum One' },+ { id: 56, name: 'BNB Chain' },+ { id: 1, name: 'Ethereum' },+ { id: 10, name: 'Optimism' },+ { id: 137, name: 'Polygon' },+ { id: 43114, name: 'Avalanche' },+ { id: 100, name: 'Gnosis' },+ { id: 250, name: 'Fantom' },+ { id: 42220, name: 'Celo' },+ { id: 59144, name: 'Linea' },+ { id: 534352, name: 'Scroll' },+ { id: 5000, name: 'Mantle' },+ { id: 324, name: 'zkSync Era' },+ { id: 1284, name: 'Moonbeam' },+ { id: 97, name: 'BSC Testnet' },+ { id: 84532, name: 'Base Sepolia' },+ { id: 421614, name: 'Arbitrum Sepolia' },+ { id: 11155111, name: 'Ethereum Sepolia' },+ { id: 11155420, name: 'Optimism Sepolia' },+ { id: 80002, name: 'Polygon Amoy' },+ { id: 43113, name: 'Avalanche Fuji' },+];++const els = {+ search: document.querySelector('[data-role="search"]'),+ filters: document.querySelector('[data-role="filters"]'),+ chain: document.querySelector('[data-role="chain"]'),+ grid: document.querySelector('[data-role="grid"]'),+ status: document.querySelector('[data-role="status"]'),+ loadMore: document.querySelector('[data-role="load-more"]'),+ statAll: document.querySelector('[data-role="stat-all"]'),+ stat3d: document.querySelector('[data-role="stat-3d"]'),+};++// Populate chain dropdown.+for (const c of CHAINS) {+ const opt = document.createElement('option');+ opt.value = String(c.id);+ opt.textContent = c.name;+ els.chain.appendChild(opt);+}++const state = {+ filter: 'all', // 'all' | '3d'+ chainId: '',+ query: '',+ cursor: null,+ loading: false,+};++let searchDebounce;++els.filters.addEventListener('click', (e) => {+ const btn = e.target.closest('[data-filter]');+ if (!btn) return;+ state.filter = btn.dataset.filter;+ for (const b of els.filters.querySelectorAll('[data-filter]')) {+ b.classList.toggle('active', b.dataset.filter === state.filter);+ }+ resetAndLoad();+});++els.chain.addEventListener('change', () => {+ state.chainId = els.chain.value;+ resetAndLoad();+});++els.search.addEventListener('input', () => {+ clearTimeout(searchDebounce);+ searchDebounce = setTimeout(() => {+ state.query = els.search.value.trim();+ resetAndLoad();+ }, 250);+});++els.loadMore.addEventListener('click', () => loadPage());++// Delegated embed-button click — cards can be re-rendered freely+els.grid.addEventListener('click', (e) => {+ const btn = e.target.closest('[data-role="card-embed"]');+ if (!btn) return;+ e.preventDefault();+ e.stopPropagation();+ openEmbedModal({+ chainId: Number(btn.dataset.chainId),+ agentId: btn.dataset.agentId,+ name: btn.dataset.name,+ });+});++function resetAndLoad() {+ state.cursor = null;+ els.grid.innerHTML = '';+ loadPage();+}++async function loadPage() {+ if (state.loading) return;+ state.loading = true;+ els.loadMore.hidden = true;+ els.status.textContent = state.cursor ? 'Loading more…' : 'Loading agents…';++ const params = new URLSearchParams();+ if (state.filter === '3d') params.set('only3d', '1');+ if (state.chainId) params.set('chain', state.chainId);+ if (state.query) params.set('q', state.query);+ if (state.cursor) params.set('cursor', state.cursor);+ params.set('limit', '24');++ try {+ const res = await fetch(`/api/explore?${params.toString()}`);+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ const data = await res.json();++ if (data.totals) {+ els.statAll.textContent = data.totals.all.toLocaleString();+ els.stat3d.textContent = data.totals.threeD.toLocaleString();+ }++ for (const item of data.items) {+ els.grid.appendChild(renderCard(item));+ }+ state.cursor = data.nextCursor;+ els.loadMore.hidden = !state.cursor;++ if (els.grid.children.length === 0) {+ els.status.innerHTML =+ '<div class="explore-empty">No agents match these filters yet.</div>';+ } else {+ els.status.textContent = '';+ }+ } catch (err) {+ els.status.innerHTML = `<div class="explore-error">Failed to load: ${escapeHtml(err.message)}</div>`;+ } finally {+ state.loading = false;+ }+}++function renderCard(item) {+ const card = document.createElement('article');+ card.className = 'explore-card' + (item.has3d ? ' explore-card--3d' : '');++ const thumb = item.image+ ? `<img src="${escapeAttr(item.image)}" alt="" loading="lazy" />`+ : `<div class="explore-card-ph">${item.has3d ? '🎭' : '🤖'}</div>`;++ const badges = [];+ badges.push(+ `<span class="explore-badge explore-badge--chain">${escapeHtml(item.chainName)}</span>`,+ );+ if (item.has3d)+ badges.push(`<span class="explore-badge explore-badge--3d">3D</span>`);+ if (item.x402Support)+ badges.push(`<span class="explore-badge explore-badge--x402">x402</span>`);++ const serviceChips = (item.services || [])+ .filter((s) => s.name && !['avatar', '3d'].includes(String(s.name).toLowerCase()))+ .slice(0, 3)+ .map((s) => `<span class="explore-svc">${escapeHtml(s.name)}</span>`)+ .join('');++ const primaryHref = item.viewerUrl || item.tokenExplorerUrl || '#';+ const primaryLabel = item.viewerUrl ? 'Load in viewer' : 'View on explorer';+ const primaryTarget = item.viewerUrl ? '_self' : '_blank';++ card.innerHTML = `+ <a class="explore-card-thumb" href="${escapeAttr(primaryHref)}" target="${primaryTarget}" rel="noopener">+ ${thumb}+ ${item.has3d ? '<span class="explore-card-play">▶</span>' : ''}+ </a>+ <div class="explore-card-body">+ <div class="explore-card-head">+ <h3 class="explore-card-name">${escapeHtml(item.name)}</h3>+ <span class="explore-card-id">#${escapeHtml(item.agentId)}</span>+ </div>+ <div class="explore-card-badges">${badges.join('')}</div>+ ${item.description ? `<p class="explore-card-desc">${escapeHtml(item.description)}</p>` : ''}+ ${serviceChips ? `<div class="explore-card-svcs">${serviceChips}</div>` : ''}+ <div class="explore-card-foot">+ <a class="explore-card-owner" href="${escapeAttr(item.ownerExplorerUrl || '#')}" target="_blank" rel="noopener" title="${escapeAttr(item.owner)}">+ ${escapeHtml(item.ownerShort)}+ </a>+ <div class="explore-card-actions">+ ${item.viewerUrl ? `<a class="explore-card-link" href="${escapeAttr(item.viewerUrl)}">View 3D</a>` : ''}+ <a class="explore-card-link" href="${escapeAttr(item.tokenExplorerUrl || '#')}" target="_blank" rel="noopener">On-chain ↗</a>+ <button type="button" class="explore-card-link explore-card-link--ghost" data-role="card-embed"+ data-chain-id="${escapeAttr(String(item.chainId))}"+ data-agent-id="${escapeAttr(String(item.agentId))}"+ data-name="${escapeAttr(item.name || `Agent #${item.agentId}`)}">Embed</button>+ </div>+ </div>+ </div>+ `;+ return card;+}++function escapeHtml(s) {+ return String(s ?? '')+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/"/g, '"');+}+function escapeAttr(s) {+ return escapeHtml(s).replace(/'/g, ''');+}++// ─── Embed modal ──────────────────────────────────────────────────────────+const LIB_CDN_URL = 'https://3dagent.vercel.app/agent-3d/latest/agent-3d.js';++function openEmbedModal({ chainId, agentId, name }) {+ document.querySelector('.embed-modal')?.remove();++ const origin = location.origin;+ const pageUrl = `${origin}/a/${chainId}/${agentId}`;+ const embedUrl = `${origin}/a/${chainId}/${agentId}/embed`;+ const agentUri = `agent://${chainId}/${agentId}`;+ const displayName = name || `Agent #${agentId}`;++ const snippets = {+ webComponent: `<script type="module" src="${LIB_CDN_URL}"></script>\n<agent-3d src="${agentUri}" mode="inline" width="480px" responsive></agent-3d>`,+ iframe: `<iframe src="${embedUrl}" width="480" height="600" style="border:0;border-radius:12px" allow="autoplay; xr-spatial-tracking" sandbox="allow-scripts allow-same-origin allow-popups" title="${displayName}"></iframe>`,+ link: pageUrl,+ markdown: `[](${pageUrl})`,+ farcaster: pageUrl,+ };++ const modal = document.createElement('div');+ modal.className = 'embed-modal';+ modal.setAttribute('role', 'dialog');+ modal.setAttribute('aria-modal', 'true');+ modal.innerHTML = `+ <div class="embed-modal__backdrop" data-role="close"></div>+ <div class="embed-modal__panel" role="document">+ <header class="embed-modal__head">+ <div>+ <h2 class="embed-modal__title">Embed ${escapeHtml(displayName)}</h2>+ <p class="embed-modal__sub">Drop this anywhere — any site, any doc, any chat.</p>+ </div>+ <button type="button" class="embed-modal__close" data-role="close" aria-label="Close">×</button>+ </header>+ <div class="embed-modal__tabs" role="tablist">+ <button type="button" class="embed-tab is-active" data-tab="webComponent" role="tab" aria-selected="true">Web component</button>+ <button type="button" class="embed-tab" data-tab="iframe" role="tab" aria-selected="false">iframe</button>+ <button type="button" class="embed-tab" data-tab="link" role="tab" aria-selected="false">Link</button>+ <button type="button" class="embed-tab" data-tab="markdown" role="tab" aria-selected="false">Markdown</button>+ <button type="button" class="embed-tab" data-tab="farcaster" role="tab" aria-selected="false">Farcaster</button>+ </div>+ <div class="embed-modal__body">+ <div class="embed-pane is-active" data-pane="webComponent">+ <p class="embed-pane__hint">Full fidelity — avatar, animations, voice, memory. Requires script module.</p>+ <textarea class="embed-snippet" readonly rows="3">${escapeHtml(snippets.webComponent)}</textarea>+ <button type="button" class="embed-copy-btn" data-role="copy" data-key="webComponent">Copy</button>+ </div>+ <div class="embed-pane" data-pane="iframe">+ <p class="embed-pane__hint">Works anywhere that allows iframes: Notion, Substack, Ghost, blogs.</p>+ <textarea class="embed-snippet" readonly rows="3">${escapeHtml(snippets.iframe)}</textarea>+ <button type="button" class="embed-copy-btn" data-role="copy" data-key="iframe">Copy</button>+ </div>+ <div class="embed-pane" data-pane="link">+ <p class="embed-pane__hint">Unfurls in Slack, X, Discord, iMessage with a rich preview card.</p>+ <input class="embed-snippet embed-snippet--input" readonly value="${escapeAttr(snippets.link)}" />+ <button type="button" class="embed-copy-btn" data-role="copy" data-key="link">Copy</button>+ </div>+ <div class="embed-pane" data-pane="markdown">+ <p class="embed-pane__hint">GitHub README, Markdown blog — renders a preview card that links to the viewer.</p>+ <textarea class="embed-snippet" readonly rows="2">${escapeHtml(snippets.markdown)}</textarea>+ <button type="button" class="embed-copy-btn" data-role="copy" data-key="markdown">Copy</button>+ </div>+ <div class="embed-pane" data-pane="farcaster">+ <p class="embed-pane__hint">Cast this link — Warpcast and compatible clients render an interactive Frame with View 3D + Explore buttons.</p>+ <input class="embed-snippet embed-snippet--input" readonly value="${escapeAttr(snippets.farcaster)}" />+ <button type="button" class="embed-copy-btn" data-role="copy" data-key="farcaster">Copy</button>+ </div>+ </div>+ <footer class="embed-modal__foot">+ <a href="${escapeAttr(pageUrl)}" target="_blank" rel="noopener" class="embed-foot-link">Open standalone page ↗</a>+ <a href="${escapeAttr(embedUrl)}" target="_blank" rel="noopener" class="embed-foot-link">Preview iframe ↗</a>+ </footer>+ </div>+ `;+ document.body.appendChild(modal);++ const close = () => {+ modal.remove();+ document.removeEventListener('keydown', onEsc);+ };+ const onEsc = (e) => {+ if (e.key === 'Escape') close();+ };+ document.addEventListener('keydown', onEsc);+ modal.querySelectorAll('[data-role="close"]').forEach((el) => el.addEventListener('click', close));++ modal.querySelectorAll('.embed-tab').forEach((tab) => {+ tab.addEventListener('click', () => {+ modal.querySelectorAll('.embed-tab').forEach((t) => {+ t.classList.toggle('is-active', t === tab);+ t.setAttribute('aria-selected', t === tab ? 'true' : 'false');+ });+ modal.querySelectorAll('.embed-pane').forEach((p) => {+ p.classList.toggle('is-active', p.dataset.pane === tab.dataset.tab);+ });+ });+ });++ modal.querySelectorAll('[data-role="copy"]').forEach((btn) => {+ btn.addEventListener('click', () => {+ const key = btn.dataset.key;+ const text = snippets[key];+ if (!text) return;+ const done = (ok) => {+ btn.textContent = ok ? 'Copied ✓' : 'Copy failed';+ setTimeout(() => (btn.textContent = 'Copy'), 1400);+ };+ if (navigator.clipboard?.writeText) {+ navigator.clipboard.writeText(text).then(() => done(true), () => done(false));+ } else {+ const ta = modal.querySelector(`[data-pane="${key}"] .embed-snippet`);+ ta?.select();+ try {+ document.execCommand('copy');+ done(true);+ } catch {+ done(false);+ }+ }+ });+ });++ setTimeout(() => {+ const first = modal.querySelector('.embed-pane.is-active .embed-snippet');+ first?.focus();+ first?.select?.();+ }, 50);+}++loadPage();diff --git a/dist-lib/explore/index.html b/dist-lib/explore/index.htmlnew file mode 100644index 000000000..5d38da558--- /dev/null+++ b/dist-lib/explore/index.html@@ -0,0 +1,103 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />+ <title>Explore · 3D Agent</title>+ <meta+ name="viewport"+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"+ />+ <meta+ name="description"+ content="Browse every ERC-8004 agent registered on-chain across 20+ EVM networks. Filter by 3D avatar, chain, and keywords."+ />+ <meta name="theme-color" content="#000000" />+ <link rel="canonical" href="https://3dagent.vercel.app/explore" />+ <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 rel="stylesheet" href="/style.css" />+ <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"+ />+ </head>+ <body class="features-page explore-page">+ <header>+ <h1>+ <a href="/"><span class="wordmark-dot" aria-hidden="true"></span>3D Agent</a>+ </h1>+ <nav class="features-nav">+ <a href="/app">Viewer</a>+ <a href="/explore" class="active">Explore</a>+ <a href="/features">Features</a>+ <a href="/widgets">Widgets</a>+ <a href="/dashboard" class="nav-dashboard">Dashboard</a>+ <a href="/login" class="nav-sign-in" id="nav-sign-in">Sign in</a>+ </nav>+ </header>++ <main class="features-main explore-main">+ <section class="explore-hero">+ <div class="explore-hero-chip">+ <span class="explore-hero-dot"></span>+ <span>ERC-8004 Agent Directory</span>+ </div>+ <h2>Every agent, every chain.</h2>+ <p class="explore-sub">+ The complete on-chain index of ERC-8004 agents. Click a 3D avatar to load+ it in the viewer. Click any card for its on-chain passport.+ </p>++ <div class="explore-stats" data-role="stats">+ <div class="explore-stat">+ <div class="explore-stat-value" data-role="stat-all">—</div>+ <div class="explore-stat-label">Agents indexed</div>+ </div>+ <div class="explore-stat">+ <div class="explore-stat-value" data-role="stat-3d">—</div>+ <div class="explore-stat-label">With 3D avatars</div>+ </div>+ <div class="explore-stat">+ <div class="explore-stat-value" data-role="stat-chains">22</div>+ <div class="explore-stat-label">Chains crawled</div>+ </div>+ </div>+ </section>++ <section class="explore-controls">+ <div class="explore-search">+ <input+ type="search"+ placeholder="Search by name or description…"+ data-role="search"+ aria-label="Search agents"+ />+ </div>+ <div class="explore-chips" data-role="filters">+ <button class="explore-chip active" data-filter="all">All agents</button>+ <button class="explore-chip" data-filter="3d">3D only</button>+ </div>+ <div class="explore-chain-select">+ <label for="explore-chain">Chain:</label>+ <select id="explore-chain" data-role="chain">+ <option value="">All chains</option>+ </select>+ </div>+ </section>++ <section class="explore-grid-wrap">+ <div class="explore-grid" data-role="grid"></div>+ <div class="explore-status" data-role="status"></div>+ <div class="explore-load-more-wrap">+ <button class="explore-load-more" data-role="load-more" hidden>+ Load more+ </button>+ </div>+ </section>+ </main>++ <script type="module" src="./explore.js"></script>+ </body>+</html>diff --git a/public/dashboard/storage.html b/public/dashboard/storage.htmlnew file mode 100644index 000000000..bc9170d24--- /dev/null+++ b/public/dashboard/storage.html@@ -0,0 +1,447 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width,initial-scale=1" />+ <title>Storage · 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;+ }+ main {+ padding: 28px;+ max-width: 720px;+ 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;+ }+ .card {+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 14px;+ padding: 20px;+ margin-bottom: 20px;+ }+ fieldset {+ border: 0;+ padding: 0;+ margin: 0;+ }+ legend {+ font-size: 13px;+ font-weight: 600;+ color: #ccc;+ margin-bottom: 12px;+ letter-spacing: 0.02em;+ text-transform: uppercase;+ }+ label {+ display: block;+ margin: 14px 0 6px;+ font-size: 13px;+ color: #bbb;+ }+ input,+ select {+ background: #0f0f17;+ border: 1px solid var(--border);+ color: #eee;+ padding: 9px 11px;+ border-radius: 8px;+ font-size: 14px;+ font-family: inherit;+ width: 100%;+ }+ input:focus,+ select:focus {+ outline: none;+ border-color: var(--accent);+ }+ .kv {+ display: flex;+ align-items: center;+ gap: 10px;+ margin: 10px 0;+ }+ .kv-label {+ font-size: 13px;+ color: #888;+ min-width: 120px;+ }+ .kv-value {+ font-size: 13px;+ color: #ddd;+ word-break: break-all;+ }+ .badge {+ display: inline-block;+ font-size: 11px;+ font-weight: 700;+ padding: 2px 8px;+ border-radius: 99px;+ letter-spacing: 0.04em;+ }+ .badge.green {+ background: rgba(92, 255, 140, 0.1);+ color: #7ef0a3;+ border: 1px solid rgba(92, 255, 140, 0.25);+ }+ .badge.grey {+ background: rgba(180, 180, 200, 0.08);+ color: #aaa;+ border: 1px solid rgba(180, 180, 200, 0.15);+ }+ .badge.yellow {+ background: rgba(255, 220, 92, 0.1);+ color: #f0dc7e;+ border: 1px solid rgba(255, 220, 92, 0.25);+ }+ .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;+ }+ .muted {+ 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;+ }+ .ok {+ padding: 12px;+ background: rgba(92, 255, 140, 0.07);+ border: 1px solid rgba(92, 255, 140, 0.2);+ border-radius: 8px;+ color: #b6f2c6;+ margin-bottom: 14px;+ }+ code {+ font-family:+ ui-monospace,+ SF Mono,+ Menlo,+ monospace;+ background: #0f0f17;+ border: 1px solid var(--border);+ border-radius: 4px;+ padding: 1px 6px;+ font-size: 12px;+ }+ .actions {+ display: flex;+ gap: 10px;+ margin-top: 16px;+ }+ hr {+ border: 0;+ border-top: 1px solid var(--border);+ margin: 22px 0;+ }+ .hidden {+ display: none !important;+ }+ </style>+ </head>+ <body>+ <header>+ <div class="brand"><a href="/dashboard">← Dashboard</a></div>+ <div class="muted"><span id="avatar-name">Avatar</span></div>+ </header>+ <main>+ <h1>Storage</h1>+ <p class="sub">+ Manage where <code id="avatar-id-label"></code>'s bytes live and track content+ attestation.+ </p>++ <div id="status"></div>++ <!-- R2 -->+ <div class="card">+ <fieldset>+ <legend>R2 (primary storage)</legend>+ <div class="kv">+ <span class="kv-label">Status</span>+ <span class="badge green" id="r2-present-badge">Present</span>+ </div>+ <div class="kv">+ <span class="kv-label">Storage key</span>+ <code id="r2-key" class="kv-value">—</code>+ </div>+ </fieldset>+ </div>++ <!-- IPFS -->+ <div class="card">+ <fieldset>+ <legend>IPFS</legend>+ <div class="kv">+ <span class="kv-label">Pinned</span>+ <span class="badge grey" id="ipfs-pinned-badge">Not pinned</span>+ </div>+ <div class="kv" id="ipfs-cid-row">+ <span class="kv-label">CID</span>+ <code id="ipfs-cid" class="kv-value">—</code>+ </div>+ <div class="kv" id="ipfs-pinned-at-row">+ <span class="kv-label">Pinned at</span>+ <span id="ipfs-pinned-at" class="kv-value muted">—</span>+ </div>+ <div class="actions">+ <button class="btn" id="pin-btn">Pin to IPFS (stub)</button>+ </div>+ <p class="muted" style="margin-top: 10px">+ Real Pinata / Web3.Storage integration is a follow-up. This stub records a+ placeholder CID derived from the content hash.+ </p>+ </fieldset>+ </div>++ <!-- Attestation -->+ <div class="card">+ <fieldset>+ <legend>On-chain attestation</legend>+ <div class="kv">+ <span class="kv-label">Content hash</span>+ <code id="attest-hash" class="kv-value">—</code>+ </div>+ <div class="kv">+ <span class="kv-label">Chain</span>+ <span id="attest-chain" class="kv-value muted">—</span>+ </div>+ <div class="kv">+ <span class="kv-label">Tx hash</span>+ <code id="attest-tx" class="kv-value">—</code>+ </div>+ <div class="kv">+ <span class="kv-label">Attested at</span>+ <span id="attest-at" class="kv-value muted">—</span>+ </div>+ <p class="muted" style="margin-top: 10px">+ On-chain attestation is read-only. Content hashing runs server-side+ post-upload. Transaction broadcasting is a future feature.+ </p>+ </fieldset>+ </div>++ <div class="actions">+ <button class="btn sec" id="reload">Reload</button>+ </div>+ </main>+ <script type="module">+ const params = new URL(location.href).searchParams;+ const avatarId = params.get('id');+ const statusEl = document.getElementById('status');+ const nameEl = document.getElementById('avatar-name');+ const labelEl = document.getElementById('avatar-id-label');++ if (!avatarId) {+ statusEl.innerHTML =+ '<div class="err">Missing <code>?id=AVATAR_ID</code> in URL.</div>';+ throw new Error('no avatar id');+ }+ labelEl.textContent = avatarId;++ async function api(method, path, body) {+ const res = await fetch(path, {+ method,+ credentials: 'include',+ headers: body ? { 'content-type': 'application/json' } : {},+ body: body ? JSON.stringify(body) : undefined,+ });+ const ct = res.headers.get('content-type') || '';+ const data = ct.includes('application/json') ? await res.json() : null;+ if (!res.ok)+ throw Object.assign(+ new Error((data && data.error_description) || res.statusText),+ { status: res.status },+ );+ return data;+ }++ function setStatus(html) {+ statusEl.innerHTML = html;+ }++ function escapeHtml(s) {+ return String(s ?? '').replace(+ /[&<>"']/g,+ (c) =>+ ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[+ c+ ],+ );+ }++ function populateMode(mode) {+ if (!mode) return;++ // R2+ document.getElementById('r2-key').textContent = mode.r2?.key || '—';+ const r2Badge = document.getElementById('r2-present-badge');+ if (mode.r2?.present) {+ r2Badge.textContent = 'Present';+ r2Badge.className = 'badge green';+ } else {+ r2Badge.textContent = 'Missing';+ r2Badge.className = 'badge grey';+ }++ // IPFS+ const ipfsBadge = document.getElementById('ipfs-pinned-badge');+ if (mode.ipfs?.pinned) {+ ipfsBadge.textContent = 'Pinned';+ ipfsBadge.className = 'badge green';+ document.getElementById('pin-btn').disabled = true;+ document.getElementById('pin-btn').textContent = 'Already pinned';+ } else {+ ipfsBadge.textContent = 'Not pinned';+ ipfsBadge.className = 'badge grey';+ document.getElementById('pin-btn').disabled = false;+ document.getElementById('pin-btn').textContent = 'Pin to IPFS (stub)';+ }+ document.getElementById('ipfs-cid').textContent = mode.ipfs?.cid || '—';+ document.getElementById('ipfs-pinned-at').textContent = mode.ipfs?.pinned_at+ ? new Date(mode.ipfs.pinned_at).toLocaleString()+ : '—';++ // Attestation+ const hash = mode.attestation?.hash;+ document.getElementById('attest-hash').textContent = hash || 'Not yet computed';+ document.getElementById('attest-chain').textContent =+ mode.attestation?.chain_id != null ? String(mode.attestation.chain_id) : '—';+ document.getElementById('attest-tx').textContent = mode.attestation?.tx_hash || '—';+ document.getElementById('attest-at').textContent = mode.attestation?.attested_at+ ? new Date(mode.attestation.attested_at).toLocaleString()+ : '—';+ }++ async function loadMe() {+ try {+ await api('GET', '/api/auth/me');+ } catch {+ location.href =+ '/login?next=' + encodeURIComponent(location.pathname + location.search);+ throw new Error('redirecting');+ }+ }++ async function loadAvatar() {+ try {+ const data = await api('GET', `/api/avatars/${avatarId}`);+ const av = data.avatar || data;+ nameEl.textContent = av.name || avatarId;+ } catch (e) {+ setStatus(+ `<div class="err">Could not load avatar: ${escapeHtml(e.message)}</div>`,+ );+ }+ }++ async function loadMode() {+ try {+ const { storage_mode } = await api(+ 'GET',+ `/api/avatars/${avatarId}/storage-mode`,+ );+ populateMode(storage_mode);+ } catch (e) {+ setStatus(+ `<div class="err">Could not load storage mode: ${escapeHtml(e.message)}</div>`,+ );+ }+ }++ async function pinIpfs() {+ setStatus('');+ document.getElementById('pin-btn').disabled = true;+ try {+ const { storage_mode } = await api('POST', `/api/avatars/${avatarId}/pin-ipfs`);+ populateMode(storage_mode);+ setStatus(+ '<div class="ok">Pinned (stub). Real IPFS pinning is a follow-up.</div>',+ );+ } catch (e) {+ document.getElementById('pin-btn').disabled = false;+ setStatus(`<div class="err">${escapeHtml(e.message)}</div>`);+ }+ }++ document.getElementById('pin-btn').addEventListener('click', pinIpfs);+ document.getElementById('reload').addEventListener('click', loadMode);++ (async () => {+ await loadMe();+ await loadAvatar();+ await loadMode();+ })();+ </script>+ </body>+</html>diff --git a/public/dashboard/usage.html b/public/dashboard/usage.htmlnew file mode 100644index 000000000..3d46aae13--- /dev/null+++ b/public/dashboard/usage.html@@ -0,0 +1,212 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width,initial-scale=1" />+ <title>LLM Usage — 3D Agent</title>+ <link rel="stylesheet" href="/assets/dashboard.css" />+ <style>+ body {+ font-family:+ system-ui,+ -apple-system,+ sans-serif;+ max-width: 640px;+ margin: 2rem auto;+ padding: 0 1rem;+ color: #111;+ }+ h1 {+ font-size: 1.25rem;+ margin-bottom: 0.25rem;+ }+ .sub {+ color: #555;+ font-size: 0.875rem;+ margin-bottom: 1.5rem;+ }+ .quota-bar {+ background: #e5e7eb;+ border-radius: 999px;+ height: 12px;+ overflow: hidden;+ margin: 0.5rem 0 0.25rem;+ }+ .quota-fill {+ background: #3b82f6;+ height: 100%;+ border-radius: 999px;+ transition: width 0.4s;+ }+ .quota-fill.warn {+ background: #f59e0b;+ }+ .quota-fill.danger {+ background: #ef4444;+ }+ .quota-label {+ font-size: 0.8rem;+ color: #555;+ }+ table {+ width: 100%;+ border-collapse: collapse;+ margin-top: 1.5rem;+ font-size: 0.875rem;+ }+ th {+ text-align: left;+ padding: 6px 8px;+ border-bottom: 2px solid #e5e7eb;+ color: #555;+ font-weight: 600;+ }+ td {+ padding: 5px 8px;+ border-bottom: 1px solid #f3f4f6;+ }+ .sparkline {+ display: flex;+ align-items: flex-end;+ gap: 2px;+ height: 40px;+ margin-top: 1.5rem;+ }+ .sparkline-bar {+ flex: 1;+ background: #3b82f6;+ border-radius: 2px 2px 0 0;+ min-height: 2px;+ }+ .sparkline-bar:hover {+ background: #2563eb;+ }+ .error {+ color: #dc2626;+ padding: 1rem 0;+ }+ .section {+ margin-top: 2rem;+ }+ h2 {+ font-size: 1rem;+ margin-bottom: 0.5rem;+ color: #374151;+ }+ </style>+ </head>+ <body>+ <h1>LLM Usage</h1>+ <div class="sub" id="agent-label">Loading…</div>++ <div class="section" id="quota-section" style="display: none">+ <h2>Current month</h2>+ <div class="quota-bar">+ <div class="quota-fill" id="quota-fill" style="width: 0%"></div>+ </div>+ <div class="quota-label" id="quota-label"></div>+ </div>++ <div class="section" id="spark-section" style="display: none">+ <h2>Last 30 days</h2>+ <div class="sparkline" id="sparkline"></div>+ </div>++ <div class="section" id="table-section" style="display: none">+ <table>+ <thead>+ <tr>+ <th>Day</th>+ <th>Calls</th>+ </tr>+ </thead>+ <tbody id="daily-tbody"></tbody>+ </table>+ </div>++ <div class="error" id="error-msg" style="display: none"></div>++ <script>+ (async () => {+ const params = new URLSearchParams(location.search);+ const id = params.get('id');+ if (!id) {+ show('error-msg', 'Missing ?id= parameter.');+ return;+ }++ document.getElementById('agent-label').textContent = `Agent ${id}`;++ let data;+ try {+ const r = await fetch(`/api/agents/${id}/usage`, { credentials: 'include' });+ if (r.status === 401) {+ show('error-msg', 'Not signed in. Visit /login first.');+ return;+ }+ if (r.status === 404) {+ show('error-msg', 'Agent not found or not yours.');+ return;+ }+ if (!r.ok) {+ show('error-msg', `Error ${r.status}`);+ return;+ }+ data = await r.json();+ } catch (e) {+ show('error-msg', `Fetch failed: ${e.message}`);+ return;+ }++ const { currentMonthCalls, monthlyQuota, dailyBreakdown, agentId } = data;+ document.getElementById('agent-label').textContent = `Agent ${agentId}`;++ // Quota bar+ if (typeof monthlyQuota === 'number') {+ const pct = Math.min(100, (currentMonthCalls / monthlyQuota) * 100);+ const fill = document.getElementById('quota-fill');+ fill.style.width = pct + '%';+ fill.className =+ 'quota-fill' + (pct >= 90 ? ' danger' : pct >= 70 ? ' warn' : '');+ document.getElementById('quota-label').textContent =+ `${currentMonthCalls.toLocaleString()} / ${monthlyQuota.toLocaleString()} calls this month (${Math.round(pct)}%)`;+ document.getElementById('quota-section').style.display = '';+ } else {+ document.getElementById('quota-section').style.display = '';+ document.getElementById('quota-label').textContent =+ `${currentMonthCalls.toLocaleString()} calls this month (no quota set)`;+ }++ // Sparkline + table+ if (dailyBreakdown && dailyBreakdown.length) {+ const max = Math.max(1, ...dailyBreakdown.map((r) => r.calls));+ const spark = document.getElementById('sparkline');+ const tbody = document.getElementById('daily-tbody');+ for (const row of dailyBreakdown) {+ const bar = document.createElement('div');+ bar.className = 'sparkline-bar';+ bar.style.height = Math.max(2, Math.round((row.calls / max) * 40)) + 'px';+ bar.title = `${row.day}: ${row.calls}`;+ spark.appendChild(bar);++ const tr = document.createElement('tr');+ tr.innerHTML = `<td>${row.day}</td><td>${row.calls.toLocaleString()}</td>`;+ tbody.appendChild(tr);+ }+ document.getElementById('spark-section').style.display = '';+ document.getElementById('table-section').style.display = '';+ } else {+ document.getElementById('spark-section').style.display = '';+ document.getElementById('spark-section').innerHTML +=+ '<p style="color:#555;font-size:0.875rem">No calls in the last 30 days.</p>';+ }+ })();++ function show(id, msg) {+ const el = document.getElementById(id);+ el.textContent = msg;+ el.style.display = '';+ }+ </script>+ </body>+</html>diff --git a/src/element.js b/src/element.jsindex ea2a8cf41..423e73293 100644--- a/src/element.js+++ b/src/element.js@@ -688,6 +688,8 @@ class Agent3DElement extends HTMLElement {const providerConfig = {apiKey: this.getAttribute('api-key') || undefined,proxyURL: this.getAttribute('key-proxy') || undefined,+ agentId: _backendId || undefined,+ apiOrigin: _scriptOrigin || window.location.origin,};// Apply tts="..." attribute shorthand on top of the manifest's voice config.const ttsOverride = this._parseTTSAttribute();diff --git a/src/runtime/providers.js b/src/runtime/providers.jsindex c3e64e209..7f74f3717 100644--- a/src/runtime/providers.js+++ b/src/runtime/providers.js@@ -2,13 +2,30 @@// never ship API keys in the browser.export class AnthropicProvider {- constructor({ model = 'claude-opus-4-6', proxyURL, apiKey, temperature = 0.7, maxTokens = 4096, thinking = 'auto' } = {}) {+ constructor({+ model = 'claude-opus-4-6',+ proxyURL,+ apiKey,+ agentId,+ apiOrigin,+ temperature = 0.7,+ maxTokens = 4096,+ thinking = 'auto',+ } = {}) {this.model = model;- this.proxyURL = proxyURL;this.apiKey = apiKey;this.temperature = temperature;this.maxTokens = maxTokens;this.thinking = thinking;++ // Priority: explicit proxyURL > direct key > we-pay fallback+ if (proxyURL) {+ this.proxyURL = proxyURL;+ } else if (!apiKey && agentId && apiOrigin) {+ this.proxyURL = `${apiOrigin}/api/llm/anthropic?agent=${encodeURIComponent(agentId)}`;+ } else {+ this.proxyURL = null;+ }}async complete({ system, messages, tools }) {@@ -83,8 +100,12 @@ export class NullProvider {async complete() {return { text: '', toolCalls: [], stopReason: 'end_turn' };}- formatToolResults() { return { role: 'user', content: [] }; }- formatAssistantWithToolCalls(text) { return { role: 'assistant', content: text || '' }; }+ formatToolResults() {+ return { role: 'user', content: [] };+ }+ formatAssistantWithToolCalls(text) {+ return { role: 'assistant', content: text || '' };+ }}export function createProvider(config = {}) {diff --git a/vercel.json b/vercel.jsonindex 67060603b..340dd7173 100644--- a/vercel.json+++ b/vercel.json@@ -33,6 +33,9 @@{ "src": "/api/agents/me", "dest": "/api/agents" },{ "src": "/api/agents/by-wallet", "dest": "/api/agents/by-wallet" },{ "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" },+ { "src": "/dashboard/storage", "dest": "/public/dashboard/storage.html" },{"src": "/api/agents/([^/]+)/embed-policy","dest": "/api/agents/[id]/embed-policy?id=$1"@@ -68,6 +71,10 @@{ "src": "/widgets/(.*)", "dest": "/public/widgets-gallery/$1" },{ "src": "/docs/widgets", "dest": "/public/docs-widgets.html" },+ { "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/(.*)", "dest": "/api/$1" },{