Skip to content

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

erc8004

nirholas9eecb0493f68
diff --git a/app.html b/app.html
index 46474f450..07057c9b6 100644
--- a/app.html
+++ b/app.html
@@ -58,6 +58,7 @@
<nav class="features-nav">
<a href="/app" class="active">Viewer</a>
<a href="/features">Features</a>
+ <a href="/explore">Explore</a>
<a href="/widgets">Widgets</a>
<a
class="save-to-account-btn"
diff --git a/dist-lib/agent-3d.js b/dist-lib/agent-3d.js
index dcbf1c6a4..f7752b0b7 100644
--- a/dist-lib/agent-3d.js
+++ b/dist-lib/agent-3d.js
@@ -1,5 +1,5 @@
-const la = { ROTATE: 0, DOLLY: 1, PAN: 2 }, ta = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, sE = 0, sp = 1, rE = 2, Mm = 1, aE = 2, Ki = 3, us = 0, Ln = 1, Ti = 2, Ds = 0, ha = 1, rp = 2, ap = 3, op = 4, oE = 5, rr = 100, cE = 101, lE = 102, hE = 103, uE = 104, dE = 200, fE = 201, pE = 202, AE = 203, Fu = 204, Du = 205, gE = 206, mE = 207, bE = 208, xE = 209, EE = 210, _E = 211, yE = 212, wE = 213, vE = 214, Lu = 0, Pu = 1, ku = 2, _a = 3, Uu = 4, Ou = 5, Qu = 6, Gu = 7, Bm = 0, CE = 1, SE = 2, Ls = 0, Hu = 1, IE = 2, ME = 3, Tm = 4, BE = 5, TE = 6, RE = 7, cp = "attached", NE = "detached", Rm = 300, br = 301, ya = 302, zu = 303, Vu = 304, Gl = 306, wa = 1e3, xi = 1001, Al = 1002, Pn = 1003, Nm = 1004, lo = 1005, qt = 1006, rl = 1007, ii = 1008, rn = 1009, Fm = 1010, Dm = 1011, Io = 1012, rf = 1013, xr = 1014, an = 1015, Rn = 1016, af = 1017, of = 1018, Mo = 1020, Lm = 35902, Pm = 1021, km = 1022, on = 1023, Bo = 1026, To = 1027, ns = 1028, cf = 1029, hr = 1030, lf = 1031, hf = 1033, al = 33776, go = 33777, ol = 33778, mo = 33779, gl = 35840, Wu = 35841, ml = 35842, qu = 35843, bl = 36196, xl = 37492, El = 37496, Ro = 37808, Ku = 37809, ju = 37810, Xu = 37811, No = 37812, Yu = 37813, Ju = 37814, Zu = 37815, $u = 37816, ed = 37817, td = 37818, nd = 37819, id = 37820, sd = 37821, bo = 36492, rd = 36494, _l = 36495, Um = 36283, ad = 36284, od = 36285, cd = 36286, Om = 2200, Qm = 2201, FE = 2202, Fo = 2300, Do = 2301, dh = 2302, na = 2400, ia = 2401, yl = 2402, uf = 2500, DE = 2501, LE = 0, Gm = 1, ld = 2, PE = 3200, kE = 3201, Hm = 0, UE = 1, Ai = "", Kt = "srgb", ln = "srgb-linear", wl = "linear", Mt = "srgb", Fr = 7680, lp = 519, OE = 512, QE = 513, GE = 514, zm = 515, HE = 516, zE = 517, VE = 518, WE = 519, hd = 35044, hp = "300 es", is = 2e3, vl = 2001;
-class Hs {
+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 {
/**
* Adds the given event listener to the given event type.
*
@@ -55,71 +55,71 @@ class Hs {
}
}
}
-const yn = ["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 up = 1234567;
-const xo = Math.PI / 180, va = 180 / Math.PI;
-function Ei() {
+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;
+function Mi() {
const i = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0;
- return (yn[i & 255] + yn[i >> 8 & 255] + yn[i >> 16 & 255] + yn[i >> 24 & 255] + "-" + yn[e & 255] + yn[e >> 8 & 255] + "-" + yn[e >> 16 & 15 | 64] + yn[e >> 24 & 255] + "-" + yn[t & 63 | 128] + yn[t >> 8 & 255] + "-" + yn[t >> 16 & 255] + yn[t >> 24 & 255] + yn[n & 255] + yn[n >> 8 & 255] + yn[n >> 16 & 255] + yn[n >> 24 & 255]).toLowerCase();
+ return (Rn[i & 255] + Rn[i >> 8 & 255] + Rn[i >> 16 & 255] + Rn[i >> 24 & 255] + "-" + Rn[e & 255] + Rn[e >> 8 & 255] + "-" + Rn[e >> 16 & 15 | 64] + Rn[e >> 24 & 255] + "-" + Rn[t & 63 | 128] + Rn[t >> 8 & 255] + "-" + Rn[t >> 16 & 255] + Rn[t >> 24 & 255] + Rn[n & 255] + Rn[n >> 8 & 255] + Rn[n >> 16 & 255] + Rn[n >> 24 & 255]).toLowerCase();
}
-function ct(i, e, t) {
+function ot(i, e, t) {
return Math.max(e, Math.min(t, i));
}
-function df(i, e) {
+function Of(i, e) {
return (i % e + e) % e;
}
-function qE(i, e, t, n, s) {
+function T_(i, e, t, n, s) {
return n + (i - e) * (s - n) / (t - e);
}
-function KE(i, e, t) {
+function R_(i, e, t) {
return i !== e ? (t - i) / (e - i) : 0;
}
-function Eo(i, e, t) {
+function Ro(i, e, t) {
return (1 - t) * i + t * e;
}
-function jE(i, e, t, n) {
- return Eo(i, e, 1 - Math.exp(-t * n));
+function F_(i, e, t, n) {
+ return Ro(i, e, 1 - Math.exp(-t * n));
}
-function XE(i, e = 1) {
- return e - Math.abs(df(i, e * 2) - e);
+function D_(i, e = 1) {
+ return e - Math.abs(Of(i, e * 2) - e);
}
-function YE(i, e, t) {
+function N_(i, e, t) {
return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * (3 - 2 * i));
}
-function JE(i, e, t) {
+function L_(i, e, t) {
return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * i * (i * (i * 6 - 15) + 10));
}
-function ZE(i, e) {
+function P_(i, e) {
return i + Math.floor(Math.random() * (e - i + 1));
}
-function $E(i, e) {
+function k_(i, e) {
return i + Math.random() * (e - i);
}
-function e_(i) {
+function U_(i) {
return i * (0.5 - Math.random());
}
-function t_(i) {
- i !== void 0 && (up = i);
- let e = up += 1831565813;
+function O_(i) {
+ i !== void 0 && (Op = i);
+ let e = Op += 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 n_(i) {
- return i * xo;
+function Q_(i) {
+ return i * To;
}
-function i_(i) {
- return i * va;
+function G_(i) {
+ return i * Na;
}
-function s_(i) {
+function H_(i) {
return (i & i - 1) === 0 && i !== 0;
}
-function r_(i) {
+function z_(i) {
return Math.pow(2, Math.ceil(Math.log(i) / Math.LN2));
}
-function a_(i) {
+function V_(i) {
return Math.pow(2, Math.floor(Math.log(i) / Math.LN2));
}
-function o_(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), m = a((n - e) / 2);
+function W_(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);
@@ -131,19 +131,19 @@ function o_(i, e, t, n, s) {
i.set(c * u, c * d, o * h, o * l);
break;
case "XZX":
- i.set(o * h, c * m, c * f, o * l);
+ i.set(o * h, c * p, c * f, o * l);
break;
case "YXY":
- i.set(c * f, o * h, c * m, o * l);
+ i.set(c * f, o * h, c * p, o * l);
break;
case "ZYZ":
- i.set(c * m, c * f, o * h, o * l);
+ i.set(c * p, c * f, o * h, o * l);
break;
default:
console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + s);
}
}
-function gi(i, e) {
+function Ci(i, e) {
switch (e.constructor) {
case Float32Array:
return i;
@@ -163,7 +163,7 @@ function gi(i, e) {
throw new Error("Invalid component type.");
}
}
-function It(i, e) {
+function Bt(i, e) {
switch (e.constructor) {
case Float32Array:
return i;
@@ -183,9 +183,9 @@ function It(i, e) {
throw new Error("Invalid component type.");
}
}
-const Vm = {
- DEG2RAD: xo,
- RAD2DEG: va,
+const Cn = {
+ DEG2RAD: To,
+ RAD2DEG: Na,
/**
* Generate a [UUID]{@link https://en.wikipedia.org/wiki/Universally_unique_identifier}
* (universally unique identifier).
@@ -194,7 +194,7 @@ const Vm = {
* @method
* @return {string} The UUID.
*/
- generateUUID: Ei,
+ generateUUID: Mi,
/**
* Clamps the given value between min and max.
*
@@ -205,7 +205,7 @@ const Vm = {
* @param {number} max - The max value.
* @return {number} The clamped value.
*/
- clamp: ct,
+ clamp: ot,
/**
* Computes the Euclidean modulo of the given parameters that
* is `( ( n % m ) + m ) % m`.
@@ -216,7 +216,7 @@ const Vm = {
* @param {number} m - The second parameter.
* @return {number} The Euclidean modulo.
*/
- euclideanModulo: df,
+ euclideanModulo: Of,
/**
* Performs a linear mapping from range `<a1, a2>` to range `<b1, b2>`
* for the given value.
@@ -230,7 +230,7 @@ const Vm = {
* @param {number} b2 - Maximum value for range B.
* @return {number} The mapped value.
*/
- mapLinear: qE,
+ mapLinear: T_,
/**
* Returns the percentage in the closed interval `[0, 1]` of the given value
* between the start and end point.
@@ -242,7 +242,7 @@ const Vm = {
* @param {number} value - A value between start and end.
* @return {number} The interpolation factor.
*/
- inverseLerp: KE,
+ inverseLerp: R_,
/**
* 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 Vm = {
* @param {number} t - The interpolation factor in the closed interval `[0, 1]`.
* @return {number} The interpolated value.
*/
- lerp: Eo,
+ lerp: Ro,
/**
* 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 Vm = {
* @param {number} dt - Delta time in seconds.
* @return {number} The interpolated value.
*/
- damp: jE,
+ damp: F_,
/**
* Returns a value that alternates between `0` and the given `length` parameter.
*
@@ -279,7 +279,7 @@ const Vm = {
* @param {number} [length=1] - The positive value the function will pingpong to.
* @return {number} The alternated value.
*/
- pingpong: XE,
+ pingpong: D_,
/**
* 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 Vm = {
* @param {number} max - The max value. Any x value above max will be `1`.
* @return {number} The alternated value.
*/
- smoothstep: YE,
+ smoothstep: N_,
/**
* 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 Vm = {
* @param {number} max - The max value. Any x value above max will be `1`.
* @return {number} The alternated value.
*/
- smootherstep: JE,
+ smootherstep: L_,
/**
* Returns a random integer from `<low, high>` interval.
*
@@ -316,7 +316,7 @@ const Vm = {
* @param {number} high - The upper value boundary
* @return {number} A random integer.
*/
- randInt: ZE,
+ randInt: P_,
/**
* Returns a random float from `<low, high>` interval.
*
@@ -326,7 +326,7 @@ const Vm = {
* @param {number} high - The upper value boundary
* @return {number} A random float.
*/
- randFloat: $E,
+ randFloat: k_,
/**
* Returns a random integer from `<-range/2, range/2>` interval.
*
@@ -335,7 +335,7 @@ const Vm = {
* @param {number} range - Defines the value range.
* @return {number} A random float.
*/
- randFloatSpread: e_,
+ randFloatSpread: U_,
/**
* Returns a deterministic pseudo-random float in the interval `[0, 1]`.
*
@@ -344,7 +344,7 @@ const Vm = {
* @param {number} [s] - The integer seed.
* @return {number} A random float.
*/
- seededRandom: t_,
+ seededRandom: O_,
/**
* Converts degrees to radians.
*
@@ -353,7 +353,7 @@ const Vm = {
* @param {number} degrees - A value in degrees.
* @return {number} The converted value in radians.
*/
- degToRad: n_,
+ degToRad: Q_,
/**
* Converts radians to degrees.
*
@@ -362,7 +362,7 @@ const Vm = {
* @param {number} radians - A value in radians.
* @return {number} The converted value in degrees.
*/
- radToDeg: i_,
+ radToDeg: G_,
/**
* Returns `true` if the given number is a power of two.
*
@@ -371,7 +371,7 @@ const Vm = {
* @param {number} value - The value to check.
* @return {boolean} Whether the given number is a power of two or not.
*/
- isPowerOfTwo: s_,
+ isPowerOfTwo: H_,
/**
* Returns the smallest power of two that is greater than or equal to the given number.
*
@@ -380,7 +380,7 @@ const Vm = {
* @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: r_,
+ ceilPowerOfTwo: z_,
/**
* Returns the largest power of two that is less than or equal to the given number.
*
@@ -389,7 +389,7 @@ const Vm = {
* @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: a_,
+ floorPowerOfTwo: V_,
/**
* 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 Vm = {
* @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: o_,
+ setQuaternionFromProperEuler: W_,
/**
* Normalizes the given value according to the given typed array.
*
@@ -415,7 +415,7 @@ const Vm = {
* @param {TypedArray} array - The typed array that defines the data type of the value.
* @return {number} The normalize value.
*/
- normalize: It,
+ normalize: Bt,
/**
* Denormalizes the given value according to the given typed array.
*
@@ -425,7 +425,7 @@ const Vm = {
* @param {TypedArray} array - The typed array that defines the data type of the value.
* @return {number} The denormalize (float) value in the range `[0,1]`.
*/
- denormalize: gi
+ denormalize: Ci
};
class Ze {
/**
@@ -693,7 +693,7 @@ class Ze {
* @return {Vector2} A reference to this vector.
*/
clamp(e, t) {
- return this.x = ct(this.x, e.x, t.x), this.y = ct(this.y, e.y, t.y), this;
+ return this.x = ot(this.x, e.x, t.x), this.y = ot(this.y, e.y, t.y), this;
}
/**
* If this vector's x or y values are greater than the max value, they are
@@ -706,7 +706,7 @@ class Ze {
* @return {Vector2} A reference to this vector.
*/
clampScalar(e, t) {
- return this.x = ct(this.x, e, t), this.y = ct(this.y, e, t), this;
+ return this.x = ot(this.x, e, t), this.y = ot(this.y, e, t), this;
}
/**
* If this vector's length is greater than the max value, it is replaced by
@@ -720,7 +720,7 @@ class Ze {
*/
clampLength(e, t) {
const n = this.length();
- return this.divideScalar(n || 1).multiplyScalar(ct(n, e, t));
+ return this.divideScalar(n || 1).multiplyScalar(ot(n, e, t));
}
/**
* The components of this vector are rounded down to the nearest integer value.
@@ -834,7 +834,7 @@ class Ze {
const t = Math.sqrt(this.lengthSq() * e.lengthSq());
if (t === 0) return Math.PI / 2;
const n = this.dot(e) / t;
- return Math.acos(ct(n, -1, 1));
+ return Math.acos(ot(n, -1, 1));
}
/**
* Computes the distance from the given vector to this instance.
@@ -966,7 +966,7 @@ class Ze {
yield this.x, yield this.y;
}
}
-class rt {
+class at {
/**
* Constructs a new 3x3 matrix. The arguments are supposed to be
* in row-major order. If no arguments are provided, the constructor
@@ -983,7 +983,7 @@ class rt {
* @param {number} [n33] - 3-3 matrix element.
*/
constructor(e, t, n, s, r, a, o, c, l) {
- rt.prototype.isMatrix3 = !0, this.elements = [
+ at.prototype.isMatrix3 = !0, this.elements = [
1,
0,
0,
@@ -1100,8 +1100,8 @@ class rt {
* @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], m = n[8], g = s[0], A = s[3], p = s[6], y = s[1], b = s[4], _ = s[7], M = s[2], w = s[5], S = s[8];
- return r[0] = a * g + o * y + c * M, r[3] = a * A + o * b + c * w, r[6] = a * p + o * _ + c * S, r[1] = l * g + h * y + u * M, r[4] = l * A + h * b + u * w, r[7] = l * p + h * _ + u * S, r[2] = d * g + f * y + m * M, r[5] = d * A + f * b + m * w, r[8] = d * p + f * _ + m * 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], 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;
}
/**
* Multiplies every component of the matrix by the given scalar.
@@ -1130,10 +1130,10 @@ class rt {
* @return {Matrix3} 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 = h * a - o * l, d = o * c - h * r, f = l * r - a * c, m = t * u + n * d + s * f;
- if (m === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
- const g = 1 / m;
- return e[0] = u * g, e[1] = (s * l - h * n) * g, e[2] = (o * n - s * a) * g, e[3] = d * g, e[4] = (h * t - s * c) * g, e[5] = (s * r - o * t) * g, e[6] = f * g, e[7] = (n * c - l * t) * g, e[8] = (a * t - n * r) * g, this;
+ 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;
}
/**
* Transposes this matrix in place.
@@ -1199,7 +1199,7 @@ class rt {
* @return {Matrix3} A reference to this matrix.
*/
scale(e, t) {
- return this.premultiply(fh.makeScale(e, t)), this;
+ return this.premultiply(Uh.makeScale(e, t)), this;
}
/**
* Rotates this matrix by the given angle.
@@ -1208,7 +1208,7 @@ class rt {
* @return {Matrix3} A reference to this matrix.
*/
rotate(e) {
- return this.premultiply(fh.makeRotation(-e)), this;
+ return this.premultiply(Uh.makeRotation(-e)), this;
}
/**
* Translates this matrix by the given scalar values.
@@ -1218,7 +1218,7 @@ class rt {
* @return {Matrix3} A reference to this matrix.
*/
translate(e, t) {
- return this.premultiply(fh.makeTranslation(e, t)), this;
+ return this.premultiply(Uh.makeTranslation(e, t)), this;
}
// for 2D Transforms
/**
@@ -1336,24 +1336,24 @@ class rt {
return new this.constructor().fromArray(this.elements);
}
}
-const fh = /* @__PURE__ */ new rt();
-function Wm(i) {
+const Uh = /* @__PURE__ */ new at();
+function _0(i) {
for (let e = i.length - 1; e >= 0; --e)
if (i[e] >= 65535) return !0;
return !1;
}
-function Lo(i) {
+function qo(i) {
return document.createElementNS("http://www.w3.org/1999/xhtml", i);
}
-function c_() {
- const i = Lo("canvas");
+function q_() {
+ const i = qo("canvas");
return i.style.display = "block", i;
}
-const dp = {};
-function cl(i) {
- i in dp || (dp[i] = !0, console.warn(i));
+const Qp = {};
+function Cl(i) {
+ i in Qp || (Qp[i] = !0, console.warn(i));
}
-function l_(i, e, t) {
+function K_(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 l_(i, e, t) {
setTimeout(r, t);
});
}
-function h_(i) {
+function j_(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 u_(i) {
+function X_(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 fp = /* @__PURE__ */ new rt().set(
+const Gp = /* @__PURE__ */ new at().set(
0.4123908,
0.3575843,
0.1804808,
@@ -1388,7 +1388,7 @@ const fp = /* @__PURE__ */ new rt().set(
0.0193308,
0.1191948,
0.9505322
-), pp = /* @__PURE__ */ new rt().set(
+), Hp = /* @__PURE__ */ new at().set(
3.2409699,
-1.5373832,
-0.4986108,
@@ -1399,10 +1399,10 @@ const fp = /* @__PURE__ */ new rt().set(
-0.203977,
1.0569715
);
-function d_() {
+function Y_() {
const i = {
enabled: !0,
- workingColorSpace: ln,
+ workingColorSpace: An,
/**
* Implementations of supported color spaces.
*
@@ -1423,7 +1423,7 @@ function d_() {
*/
spaces: {},
convert: function(s, r, a) {
- return this.enabled === !1 || r === a || !r || !a || (this.spaces[r].transfer === Mt && (s.r = os(s.r), s.g = os(s.g), s.b = os(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 === Mt && (s.r = ua(s.r), s.g = ua(s.g), s.b = ua(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 = wa(s.r), s.g = wa(s.g), s.b = wa(s.b))), s;
},
fromWorkingColorSpace: function(s, r) {
return this.convert(s, this.workingColorSpace, r);
@@ -1435,7 +1435,7 @@ function d_() {
return this.spaces[s].primaries;
},
getTransfer: function(s) {
- return s === Ai ? wl : this.spaces[s].transfer;
+ return s === vi ? Gl : this.spaces[s].transfer;
},
getLuminanceCoefficients: function(s, r = this.workingColorSpace) {
return s.fromArray(this.spaces[r].luminanceCoefficients);
@@ -1455,36 +1455,36 @@ function d_() {
}
}, e = [0.64, 0.33, 0.3, 0.6, 0.15, 0.06], t = [0.2126, 0.7152, 0.0722], n = [0.3127, 0.329];
return i.define({
- [ln]: {
+ [An]: {
primaries: e,
whitePoint: n,
- transfer: wl,
- toXYZ: fp,
- fromXYZ: pp,
+ transfer: Gl,
+ toXYZ: Gp,
+ fromXYZ: Hp,
luminanceCoefficients: t,
- workingColorSpaceConfig: { unpackColorSpace: Kt },
- outputColorSpaceConfig: { drawingBufferColorSpace: Kt }
+ workingColorSpaceConfig: { unpackColorSpace: yt },
+ outputColorSpaceConfig: { drawingBufferColorSpace: yt }
},
- [Kt]: {
+ [yt]: {
primaries: e,
whitePoint: n,
- transfer: Mt,
- toXYZ: fp,
- fromXYZ: pp,
+ transfer: Rt,
+ toXYZ: Gp,
+ fromXYZ: Hp,
luminanceCoefficients: t,
- outputColorSpaceConfig: { drawingBufferColorSpace: Kt }
+ outputColorSpaceConfig: { drawingBufferColorSpace: yt }
}
}), i;
}
-const mt = /* @__PURE__ */ d_();
-function os(i) {
+const rt = /* @__PURE__ */ Y_();
+function ps(i) {
return i < 0.04045 ? i * 0.0773993808 : Math.pow(i * 0.9478672986 + 0.0521327014, 2.4);
}
-function ua(i) {
+function wa(i) {
return i < 31308e-7 ? i * 12.92 : 1.055 * Math.pow(i, 0.41666) - 0.055;
}
-let Dr;
-class f_ {
+let Wr;
+class J_ {
/**
* Returns a data URI containing a representation of the given image.
*
@@ -1499,9 +1499,9 @@ class f_ {
if (e instanceof HTMLCanvasElement)
n = e;
else {
- Dr === void 0 && (Dr = Lo("canvas")), Dr.width = e.width, Dr.height = e.height;
- const s = Dr.getContext("2d");
- e instanceof ImageData ? s.putImageData(e, 0, 0) : s.drawImage(e, 0, 0, e.width, e.height), n = Dr;
+ 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;
}
return n.toDataURL(t);
}
@@ -1513,18 +1513,18 @@ class f_ {
*/
static sRGBToLinear(e) {
if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap) {
- const t = Lo("canvas");
+ const t = qo("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] = os(r[a] / 255) * 255;
+ r[a] = ps(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(os(t[n] / 255) * 255) : t[n] = os(t[n]);
+ t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[n] = Math.floor(ps(t[n] / 255) * 255) : t[n] = ps(t[n]);
return {
data: t,
width: e.width,
@@ -1534,15 +1534,15 @@ class f_ {
return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
}
}
-let p_ = 0;
-class ff {
+let Z_ = 0;
+class Qf {
/**
* 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: p_++ }), this.uuid = Ei(), this.data = e, this.dataReady = !0, this.version = 0;
+ this.isSource = !0, Object.defineProperty(this, "id", { value: Z_++ }), 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 ff {
if (Array.isArray(s)) {
r = [];
for (let a = 0, o = s.length; a < o; a++)
- s[a].isDataTexture ? r.push(ph(s[a].image)) : r.push(ph(s[a]));
+ s[a].isDataTexture ? r.push(Oh(s[a].image)) : r.push(Oh(s[a]));
} else
- r = ph(s);
+ r = Oh(s);
n.url = r;
}
return t || (e.images[this.uuid] = n), n;
}
}
-function ph(i) {
- return typeof HTMLImageElement < "u" && i instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && i instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && i instanceof ImageBitmap ? f_.getDataURL(i) : i.data ? {
+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 ? {
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 A_ = 0;
-class cn extends Hs {
+let $_ = 0;
+class an extends Ys {
/**
* Constructs a new texture.
*
@@ -1608,8 +1608,8 @@ class cn extends Hs {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space.
*/
- constructor(e = cn.DEFAULT_IMAGE, t = cn.DEFAULT_MAPPING, n = xi, s = xi, r = qt, a = ii, o = on, c = rn, l = cn.DEFAULT_ANISOTROPY, h = Ai) {
- super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: A_++ }), this.uuid = Ei(), this.name = "", this.source = new ff(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 rt(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = h, this.userData = {}, this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isTextureArray = !1, this.pmremVersion = 0;
+ constructor(e = an.DEFAULT_IMAGE, t = an.DEFAULT_MAPPING, n = 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;
}
/**
* The image object holding the texture data.
@@ -1703,28 +1703,28 @@ class cn extends Hs {
* @return {Vector2} The transformed uv vector.
*/
transformUv(e) {
- if (this.mapping !== Rm) return e;
+ if (this.mapping !== l0) return e;
if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)
switch (this.wrapS) {
- case wa:
+ case Ws:
e.x = e.x - Math.floor(e.x);
break;
- case xi:
+ case ti:
e.x = e.x < 0 ? 0 : 1;
break;
- case Al:
+ case Dl:
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 wa:
+ case Ws:
e.y = e.y - Math.floor(e.y);
break;
- case xi:
+ case ti:
e.y = e.y < 0 ? 0 : 1;
break;
- case Al:
+ case Dl:
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;
}
@@ -1754,10 +1754,10 @@ class cn extends Hs {
e === !0 && this.pmremVersion++;
}
}
-cn.DEFAULT_IMAGE = null;
-cn.DEFAULT_MAPPING = Rm;
-cn.DEFAULT_ANISOTROPY = 1;
-class wt {
+an.DEFAULT_IMAGE = null;
+an.DEFAULT_MAPPING = l0;
+an.DEFAULT_ANISOTROPY = 1;
+class mt {
/**
* Constructs a new 4D vector.
*
@@ -1767,7 +1767,7 @@ class wt {
* @param {number} [w=1] - The w value of this vector.
*/
constructor(e = 0, t = 0, n = 0, s = 1) {
- wt.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = n, this.w = s;
+ mt.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = n, this.w = s;
}
/**
* Alias for {@link Vector4#z}.
@@ -2046,16 +2046,16 @@ class wt {
*/
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], m = c[9], g = c[2], A = c[6], p = c[10];
- if (Math.abs(h - d) < 0.01 && Math.abs(u - g) < 0.01 && Math.abs(m - A) < 0.01) {
- if (Math.abs(h + d) < 0.1 && Math.abs(u + g) < 0.1 && Math.abs(m + A) < 0.1 && Math.abs(l + f + p - 3) < 0.1)
+ 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) < 0.01 && Math.abs(u - m) < 0.01 && Math.abs(p - g) < 0.01) {
+ 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 b = (l + 1) / 2, _ = (f + 1) / 2, M = (p + 1) / 2, w = (h + d) / 4, S = (u + g) / 4, T = (m + A) / 4;
- return b > _ && b > M ? b < 0.01 ? (n = 0, s = 0.707106781, r = 0.707106781) : (n = Math.sqrt(b), s = w / n, r = S / n) : _ > M ? _ < 0.01 ? (n = 0.707106781, s = 0, r = 0.707106781) : (s = Math.sqrt(_), n = w / s, r = T / s) : M < 0.01 ? (n = 0.707106781, s = 0.707106781, r = 0) : (r = Math.sqrt(M), n = S / r, s = T / r), this.set(n, s, r, t), this;
+ 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;
}
- let y = Math.sqrt((A - m) * (A - m) + (u - g) * (u - g) + (d - h) * (d - h));
- return Math.abs(y) < 1e-3 && (y = 1), this.x = (A - m) / y, this.y = (u - g) / y, this.z = (d - h) / y, this.w = Math.acos((l + f + p - 1) / 2), 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;
}
/**
* Sets the vector components to the position elements of the
@@ -2099,7 +2099,7 @@ class wt {
* @return {Vector4} A reference to this vector.
*/
clamp(e, t) {
- return this.x = ct(this.x, e.x, t.x), this.y = ct(this.y, e.y, t.y), this.z = ct(this.z, e.z, t.z), this.w = ct(this.w, e.w, t.w), this;
+ return this.x = ot(this.x, e.x, t.x), this.y = ot(this.y, e.y, t.y), this.z = ot(this.z, e.z, t.z), this.w = ot(this.w, e.w, t.w), this;
}
/**
* If this vector's x, y, z or w values are greater than the max value, they are
@@ -2112,7 +2112,7 @@ class wt {
* @return {Vector4} A reference to this vector.
*/
clampScalar(e, t) {
- return this.x = ct(this.x, e, t), this.y = ct(this.y, e, t), this.z = ct(this.z, e, t), this.w = ct(this.w, e, t), this;
+ return this.x = ot(this.x, e, t), this.y = ot(this.y, e, t), this.z = ot(this.z, e, t), this.w = ot(this.w, e, t), this;
}
/**
* If this vector's length is greater than the max value, it is replaced by
@@ -2126,7 +2126,7 @@ class wt {
*/
clampLength(e, t) {
const n = this.length();
- return this.divideScalar(n || 1).multiplyScalar(ct(n, e, t));
+ return this.divideScalar(n || 1).multiplyScalar(ot(n, e, t));
}
/**
* The components of this vector are rounded down to the nearest integer value.
@@ -2302,7 +2302,7 @@ class wt {
yield this.x, yield this.y, yield this.z, yield this.w;
}
}
-class g_ extends Hs {
+class ey extends Ys {
/**
* Render target options.
*
@@ -2334,12 +2334,12 @@ class g_ extends Hs {
* @param {RenderTarget~Options} [options] - The configuration object.
*/
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 wt(0, 0, e, t), this.scissorTest = !1, this.viewport = new wt(0, 0, e, t);
+ super(), this.isRenderTarget = !0, this.width = e, this.height = t, this.depth = n.depth ? n.depth : 1, this.scissor = new mt(0, 0, e, t), this.scissorTest = !1, this.viewport = new mt(0, 0, e, t);
const s = { width: e, height: t, depth: this.depth };
n = Object.assign({
generateMipmaps: !1,
internalFormat: null,
- minFilter: qt,
+ minFilter: Xt,
depthBuffer: !0,
stencilBuffer: !1,
resolveDepthBuffer: !0,
@@ -2349,7 +2349,7 @@ class g_ extends Hs {
count: 1,
multiview: !1
}, n);
- const r = new cn(s, n.mapping, n.wrapS, n.wrapT, n.magFilter, n.minFilter, n.format, n.type, n.anisotropy, n.colorSpace);
+ const r = new an(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++)
@@ -2418,7 +2418,7 @@ class g_ extends Hs {
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 ff(s);
+ this.textures[t].source = new Qf(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 g_ extends Hs {
this.dispatchEvent({ type: "dispose" });
}
}
-class Er extends g_ {
+class Mr extends ey {
/**
* Constructs a new 3D render target.
*
@@ -2444,7 +2444,7 @@ class Er extends g_ {
super(e, t, n), this.isWebGLRenderTarget = !0;
}
}
-class qm extends cn {
+class y0 extends an {
/**
* Constructs a new data array texture.
*
@@ -2454,7 +2454,7 @@ class qm extends cn {
* @param {number} [depth=1] - The depth of the texture.
*/
constructor(e = null, t = 1, n = 1, s = 1) {
- super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Pn, this.minFilter = Pn, this.wrapR = xi, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();
+ super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Wn, this.minFilter = Wn, this.wrapR = ti, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();
}
/**
* Describes that a specific layer of the texture needs to be updated.
@@ -2475,7 +2475,7 @@ class qm extends cn {
this.layerUpdates.clear();
}
}
-class Km extends cn {
+class w0 extends an {
/**
* Constructs a new data array texture.
*
@@ -2485,10 +2485,10 @@ class Km extends cn {
* @param {number} [depth=1] - The depth of the texture.
*/
constructor(e = null, t = 1, n = 1, s = 1) {
- super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Pn, this.minFilter = Pn, this.wrapR = xi, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
+ super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Wn, this.minFilter = Wn, this.wrapR = ti, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}
-class Xn {
+class Jt {
/**
* Constructs a new quaternion.
*
@@ -2515,26 +2515,26 @@ class Xn {
*/
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], m = r[a + 2], g = r[a + 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] = m, e[t + 3] = g;
+ e[t + 0] = d, e[t + 1] = f, e[t + 2] = p, e[t + 3] = m;
return;
}
- if (u !== g || c !== d || l !== f || h !== m) {
- let A = 1 - o;
- const p = c * d + l * f + h * m + u * g, y = p >= 0 ? 1 : -1, b = 1 - p * p;
- if (b > Number.EPSILON) {
- const M = Math.sqrt(b), w = Math.atan2(M, p * y);
- A = Math.sin(A * w) / M, o = Math.sin(o * w) / M;
+ 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;
+ 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 _ = o * y;
- if (c = c * A + d * _, l = l * A + f * _, h = h * A + m * _, u = u * A + g * _, A === 1 - o) {
- const M = 1 / Math.sqrt(c * c + l * l + h * h + u * u);
- c *= M, l *= M, h *= M, u *= M;
+ const E = o * y;
+ 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;
@@ -2553,8 +2553,8 @@ class Xn {
* @see {@link Quaternion#multiplyQuaternions}.
*/
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], m = r[a + 3];
- return e[t] = o * m + h * u + c * f - l * d, e[t + 1] = c * m + h * d + l * u - o * f, e[t + 2] = l * m + h * f + o * d - c * u, e[t + 3] = h * m - o * u - c * d - l * f, e;
+ 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;
}
/**
* The x value of this quaternion.
@@ -2642,25 +2642,25 @@ class Xn {
* @return {Quaternion} A reference to this quaternion.
*/
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), m = c(r / 2);
+ 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 * m, this._y = l * f * u - d * h * m, this._z = l * h * m + d * f * u, this._w = l * h * u - d * f * m;
+ 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 * m, this._y = l * f * u - d * h * m, this._z = l * h * m - d * f * u, this._w = l * h * u + d * f * m;
+ 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 * m, this._y = l * f * u + d * h * m, this._z = l * h * m + d * f * u, this._w = l * h * u - d * f * m;
+ 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 * m, this._y = l * f * u + d * h * m, this._z = l * h * m - d * f * u, this._w = l * h * u + d * f * m;
+ 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 * m, this._y = l * f * u + d * h * m, this._z = l * h * m - d * f * u, this._w = l * h * u - d * f * m;
+ 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 * m, this._y = l * f * u - d * h * m, this._z = l * h * m + d * f * u, this._w = l * h * u + d * f * m;
+ 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);
@@ -2720,7 +2720,7 @@ class Xn {
* @return {number} The angle in radians.
*/
angleTo(e) {
- return 2 * Math.acos(Math.abs(ct(this.dot(e), -1, 1)));
+ return 2 * Math.acos(Math.abs(ot(this.dot(e), -1, 1)));
}
/**
* Rotates this quaternion by a given angular step to the given quaternion.
@@ -2938,7 +2938,7 @@ class Xn {
yield this._x, yield this._y, yield this._z, yield this._w;
}
}
-class H {
+class G {
/**
* Constructs a new 3D vector.
*
@@ -2947,7 +2947,7 @@ class H {
* @param {number} [z=0] - The z value of this vector.
*/
constructor(e = 0, t = 0, n = 0) {
- H.prototype.isVector3 = !0, this.x = e, this.y = t, this.z = n;
+ G.prototype.isVector3 = !0, this.x = e, this.y = t, this.z = n;
}
/**
* Sets the vector components.
@@ -3155,7 +3155,7 @@ class H {
* @return {Vector3} A reference to this vector.
*/
applyEuler(e) {
- return this.applyQuaternion(Ap.setFromEuler(e));
+ return this.applyQuaternion(zp.setFromEuler(e));
}
/**
* Applies a rotation specified by an axis and an angle to this vector.
@@ -3165,7 +3165,7 @@ class H {
* @return {Vector3} A reference to this vector.
*/
applyAxisAngle(e, t) {
- return this.applyQuaternion(Ap.setFromAxisAngle(e, t));
+ return this.applyQuaternion(zp.setFromAxisAngle(e, t));
}
/**
* Multiplies this vector with the given 3x3 matrix.
@@ -3288,7 +3288,7 @@ class H {
* @return {Vector3} A reference to this vector.
*/
clamp(e, t) {
- return this.x = ct(this.x, e.x, t.x), this.y = ct(this.y, e.y, t.y), this.z = ct(this.z, e.z, t.z), this;
+ return this.x = ot(this.x, e.x, t.x), this.y = ot(this.y, e.y, t.y), this.z = ot(this.z, e.z, t.z), this;
}
/**
* If this vector's x, y or z values are greater than the max value, they are
@@ -3301,7 +3301,7 @@ class H {
* @return {Vector3} A reference to this vector.
*/
clampScalar(e, t) {
- return this.x = ct(this.x, e, t), this.y = ct(this.y, e, t), this.z = ct(this.z, e, t), this;
+ return this.x = ot(this.x, e, t), this.y = ot(this.y, e, t), this.z = ot(this.z, e, t), this;
}
/**
* If this vector's length is greater than the max value, it is replaced by
@@ -3315,7 +3315,7 @@ class H {
*/
clampLength(e, t) {
const n = this.length();
- return this.divideScalar(n || 1).multiplyScalar(ct(n, e, t));
+ return this.divideScalar(n || 1).multiplyScalar(ot(n, e, t));
}
/**
* The components of this vector are rounded down to the nearest integer value.
@@ -3479,7 +3479,7 @@ class H {
* @return {Vector3} A reference to this vector.
*/
projectOnPlane(e) {
- return Ah.copy(this).projectOnVector(e), this.sub(Ah);
+ return Qh.copy(this).projectOnVector(e), this.sub(Qh);
}
/**
* Reflects this vector off a plane orthogonal to the given normal vector.
@@ -3488,7 +3488,7 @@ class H {
* @return {Vector3} A reference to this vector.
*/
reflect(e) {
- return this.sub(Ah.copy(e).multiplyScalar(2 * this.dot(e)));
+ return this.sub(Qh.copy(e).multiplyScalar(2 * this.dot(e)));
}
/**
* Returns the angle between the given vector and this instance in radians.
@@ -3500,7 +3500,7 @@ class H {
const t = Math.sqrt(this.lengthSq() * e.lengthSq());
if (t === 0) return Math.PI / 2;
const n = this.dot(e) / t;
- return Math.acos(ct(n, -1, 1));
+ return Math.acos(ot(n, -1, 1));
}
/**
* Computes the distance from the given vector to this instance.
@@ -3697,15 +3697,15 @@ class H {
yield this.x, yield this.y, yield this.z;
}
}
-const Ah = /* @__PURE__ */ new H(), Ap = /* @__PURE__ */ new Xn();
-class Pi {
+const Qh = /* @__PURE__ */ new G(), zp = /* @__PURE__ */ new Jt();
+class Hi {
/**
* Constructs a new bounding box.
*
* @param {Vector3} [min=(Infinity,Infinity,Infinity)] - A vector representing the lower boundary of the box.
* @param {Vector3} [max=(-Infinity,-Infinity,-Infinity)] - A vector representing the upper boundary of the box.
*/
- constructor(e = new H(1 / 0, 1 / 0, 1 / 0), t = new H(-1 / 0, -1 / 0, -1 / 0)) {
+ 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;
}
/**
@@ -3729,7 +3729,7 @@ class Pi {
setFromArray(e) {
this.makeEmpty();
for (let t = 0, n = e.length; t < n; t += 3)
- this.expandByPoint(oi.fromArray(e, t));
+ this.expandByPoint(gi.fromArray(e, t));
return this;
}
/**
@@ -3742,7 +3742,7 @@ class Pi {
setFromBufferAttribute(e) {
this.makeEmpty();
for (let t = 0, n = e.count; t < n; t++)
- this.expandByPoint(oi.fromBufferAttribute(e, t));
+ this.expandByPoint(gi.fromBufferAttribute(e, t));
return this;
}
/**
@@ -3767,7 +3767,7 @@ class Pi {
* @return {Box3} A reference to this bounding box.
*/
setFromCenterAndSize(e, t) {
- const n = oi.copy(t).multiplyScalar(0.5);
+ const n = gi.copy(t).multiplyScalar(0.5);
return this.min.copy(e).sub(n), this.max.copy(e).add(n), this;
}
/**
@@ -3886,9 +3886,9 @@ class Pi {
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, oi) : oi.fromBufferAttribute(r, a), oi.applyMatrix4(e.matrixWorld), this.expandByPoint(oi);
+ 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(), hc.copy(e.boundingBox)) : (n.boundingBox === null && n.computeBoundingBox(), hc.copy(n.boundingBox)), hc.applyMatrix4(e.matrixWorld), this.union(hc);
+ 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);
}
const s = e.children;
for (let r = 0, a = s.length; r < a; r++)
@@ -3944,7 +3944,7 @@ class Pi {
* @return {boolean} Whether the given bounding sphere intersects with this bounding box.
*/
intersectsSphere(e) {
- return this.clampPoint(e.center, oi), oi.distanceToSquared(e.center) <= e.radius * e.radius;
+ return this.clampPoint(e.center, gi), gi.distanceToSquared(e.center) <= e.radius * e.radius;
}
/**
* Returns `true` if the given plane intersects with this bounding box.
@@ -3965,37 +3965,37 @@ class Pi {
intersectsTriangle(e) {
if (this.isEmpty())
return !1;
- this.getCenter(Ka), uc.subVectors(this.max, Ka), Lr.subVectors(e.a, Ka), Pr.subVectors(e.b, Ka), kr.subVectors(e.c, Ka), ms.subVectors(Pr, Lr), bs.subVectors(kr, Pr), Ks.subVectors(Lr, kr);
+ 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);
let t = [
0,
- -ms.z,
- ms.y,
+ -vs.z,
+ vs.y,
0,
- -bs.z,
- bs.y,
+ -Cs.z,
+ Cs.y,
0,
- -Ks.z,
- Ks.y,
- ms.z,
+ -tr.z,
+ tr.y,
+ vs.z,
0,
- -ms.x,
- bs.z,
+ -vs.x,
+ Cs.z,
0,
- -bs.x,
- Ks.z,
+ -Cs.x,
+ tr.z,
0,
- -Ks.x,
- -ms.y,
- ms.x,
+ -tr.x,
+ -vs.y,
+ vs.x,
0,
- -bs.y,
- bs.x,
+ -Cs.y,
+ Cs.x,
0,
- -Ks.y,
- Ks.x,
+ -tr.y,
+ tr.x,
0
];
- return !gh(t, Lr, Pr, kr, uc) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !gh(t, Lr, Pr, kr, uc)) ? !1 : (dc.crossVectors(ms, bs), t = [dc.x, dc.y, dc.z], gh(t, Lr, Pr, kr, uc));
+ 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));
}
/**
* Clamps the given point within the bounds of this box.
@@ -4015,7 +4015,7 @@ class Pi {
* @return {number} The euclidean distance.
*/
distanceToPoint(e) {
- return this.clampPoint(e, oi).distanceTo(e);
+ return this.clampPoint(e, gi).distanceTo(e);
}
/**
* Returns a bounding sphere that encloses this bounding box.
@@ -4024,7 +4024,7 @@ class Pi {
* @return {Sphere} The bounding sphere that encloses this bounding box.
*/
getBoundingSphere(e) {
- return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = this.getSize(oi).length() * 0.5), e;
+ return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = this.getSize(gi).length() * 0.5), e;
}
/**
* Computes the intersection of this bounding box and the given one, setting the upper
@@ -4056,7 +4056,7 @@ class Pi {
* @return {Box3} A reference to this bounding box.
*/
applyMatrix4(e) {
- return this.isEmpty() ? this : (Gi[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Gi[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Gi[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Gi[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Gi[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Gi[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Gi[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Gi[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Gi), this);
+ return this.isEmpty() ? this : (Ki[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Ki[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Ki[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Ki[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Ki[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Ki[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Ki[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Ki[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Ki), this);
}
/**
* Adds the given offset to both the upper and lower bounds of this bounding box,
@@ -4078,34 +4078,34 @@ class Pi {
return e.min.equals(this.min) && e.max.equals(this.max);
}
}
-const Gi = [
- /* @__PURE__ */ new H(),
- /* @__PURE__ */ new H(),
- /* @__PURE__ */ new H(),
- /* @__PURE__ */ new H(),
- /* @__PURE__ */ new H(),
- /* @__PURE__ */ new H(),
- /* @__PURE__ */ new H(),
- /* @__PURE__ */ new H()
-], oi = /* @__PURE__ */ new H(), hc = /* @__PURE__ */ new Pi(), Lr = /* @__PURE__ */ new H(), Pr = /* @__PURE__ */ new H(), kr = /* @__PURE__ */ new H(), ms = /* @__PURE__ */ new H(), bs = /* @__PURE__ */ new H(), Ks = /* @__PURE__ */ new H(), Ka = /* @__PURE__ */ new H(), uc = /* @__PURE__ */ new H(), dc = /* @__PURE__ */ new H(), js = /* @__PURE__ */ new H();
-function gh(i, e, t, n, s) {
+const Ki = [
+ /* @__PURE__ */ new G(),
+ /* @__PURE__ */ new G(),
+ /* @__PURE__ */ new G(),
+ /* @__PURE__ */ new G(),
+ /* @__PURE__ */ new G(),
+ /* @__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) {
for (let r = 0, a = i.length - 3; r <= a; r += 3) {
- js.fromArray(i, r);
- const o = s.x * Math.abs(js.x) + s.y * Math.abs(js.y) + s.z * Math.abs(js.z), c = e.dot(js), l = t.dot(js), h = n.dot(js);
+ 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);
if (Math.max(-Math.max(c, l, h), Math.min(c, l, h)) > o)
return !1;
}
return !0;
}
-const m_ = /* @__PURE__ */ new Pi(), ja = /* @__PURE__ */ new H(), mh = /* @__PURE__ */ new H();
-class ki {
+const ty = /* @__PURE__ */ new Hi(), io = /* @__PURE__ */ new G(), Hh = /* @__PURE__ */ new G();
+class zi {
/**
* Constructs a new sphere.
*
* @param {Vector3} [center=(0,0,0)] - The center of the sphere
* @param {number} [radius=-1] - The radius of the sphere.
*/
- constructor(e = new H(), t = -1) {
+ constructor(e = new G(), t = -1) {
this.isSphere = !0, this.center = e, this.radius = t;
}
/**
@@ -4130,7 +4130,7 @@ class ki {
*/
setFromPoints(e, t) {
const n = this.center;
- t !== void 0 ? n.copy(t) : m_.setFromPoints(e).getCenter(n);
+ t !== void 0 ? n.copy(t) : ty.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 ki {
expandByPoint(e) {
if (this.isEmpty())
return this.center.copy(e), this.radius = 0, this;
- ja.subVectors(e, this.center);
- const t = ja.lengthSq();
+ io.subVectors(e, this.center);
+ const t = io.lengthSq();
if (t > this.radius * this.radius) {
const n = Math.sqrt(t), s = (n - this.radius) * 0.5;
- this.center.addScaledVector(ja, s / n), this.radius += s;
+ this.center.addScaledVector(io, s / n), this.radius += s;
}
return this;
}
@@ -4277,7 +4277,7 @@ class ki {
* @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) : (mh.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(ja.copy(e.center).add(mh)), this.expandByPoint(ja.copy(e.center).sub(mh))), 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) : (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);
}
/**
* Returns `true` if this sphere is equal with the given one.
@@ -4297,15 +4297,15 @@ class ki {
return new this.constructor().copy(this);
}
}
-const Hi = /* @__PURE__ */ new H(), bh = /* @__PURE__ */ new H(), fc = /* @__PURE__ */ new H(), xs = /* @__PURE__ */ new H(), xh = /* @__PURE__ */ new H(), pc = /* @__PURE__ */ new H(), Eh = /* @__PURE__ */ new H();
-class jo {
+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 {
/**
* Constructs a new ray.
*
* @param {Vector3} [origin=(0,0,0)] - The origin of the ray.
* @param {Vector3} [direction=(0,0,-1)] - The (normalized) direction of the ray.
*/
- constructor(e = new H(), t = new H(0, 0, -1)) {
+ constructor(e = new G(), t = new G(0, 0, -1)) {
this.origin = e, this.direction = t;
}
/**
@@ -4353,7 +4353,7 @@ class jo {
* @return {Ray} A reference to this ray.
*/
recast(e) {
- return this.origin.copy(this.at(e, Hi)), this;
+ return this.origin.copy(this.at(e, ji)), this;
}
/**
* Returns the point along this ray that is closest to the given point.
@@ -4383,8 +4383,8 @@ class jo {
* @return {number} The squared distance.
*/
distanceSqToPoint(e) {
- const t = Hi.subVectors(e, this.origin).dot(this.direction);
- return t < 0 ? this.origin.distanceToSquared(e) : (Hi.copy(this.origin).addScaledVector(this.direction, t), Hi.distanceToSquared(e));
+ const t = ji.subVectors(e, this.origin).dot(this.direction);
+ return t < 0 ? this.origin.distanceToSquared(e) : (ji.copy(this.origin).addScaledVector(this.direction, t), ji.distanceToSquared(e));
}
/**
* Returns the squared distance between this ray and the given line segment.
@@ -4396,24 +4396,24 @@ class jo {
* @return {number} The squared distance.
*/
distanceSqToSegment(e, t, n, s) {
- bh.copy(e).add(t).multiplyScalar(0.5), fc.copy(t).sub(e).normalize(), xs.copy(this.origin).sub(bh);
- const r = e.distanceTo(t) * 0.5, a = -this.direction.dot(fc), o = xs.dot(this.direction), c = -xs.dot(fc), l = xs.lengthSq(), h = Math.abs(1 - a * a);
- let u, d, f, m;
+ 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);
+ let u, d, f, p;
if (h > 0)
- if (u = a * c - o, d = a * o - c, m = r * h, u >= 0)
- if (d >= -m)
- if (d <= m) {
- const g = 1 / h;
- u *= g, d *= g, f = u * (u + a * d + 2 * o) + d * (a * u + d + 2 * c) + l;
+ 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 <= -m ? (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 <= m ? (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);
+ 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(bh).addScaledVector(fc, d), f;
+ return n && n.copy(this.origin).addScaledVector(this.direction, u), s && s.copy(zh).addScaledVector(Ic, d), f;
}
/**
* Intersects this ray with the given sphere, returning the intersection
@@ -4424,8 +4424,8 @@ class jo {
* @return {?Vector3} The intersection point.
*/
intersectSphere(e, t) {
- Hi.subVectors(e.center, this.origin);
- const n = Hi.dot(this.direction), s = Hi.dot(Hi) - n * n, r = e.radius * e.radius;
+ ji.subVectors(e.center, this.origin);
+ const n = ji.dot(this.direction), s = ji.dot(ji) - n * n, r = e.radius * e.radius;
if (s > r) return null;
const a = Math.sqrt(r - s), o = n - a, c = n + a;
return c < 0 ? null : o < 0 ? this.at(c, t) : this.at(o, t);
@@ -4495,7 +4495,7 @@ class jo {
* @return {boolean} Whether this ray intersects with the given box or not.
*/
intersectsBox(e) {
- return this.intersectBox(e, Hi) !== null;
+ return this.intersectBox(e, ji) !== null;
}
/**
* Intersects this ray with the given triangle, returning the intersection
@@ -4509,8 +4509,8 @@ class jo {
* @return {?Vector3} The intersection point.
*/
intersectTriangle(e, t, n, s, r) {
- xh.subVectors(t, e), pc.subVectors(n, e), Eh.crossVectors(xh, pc);
- let a = this.direction.dot(Eh), o;
+ Vh.subVectors(t, e), Mc.subVectors(n, e), Wh.crossVectors(Vh, Mc);
+ let a = this.direction.dot(Wh), o;
if (a > 0) {
if (s) return null;
o = 1;
@@ -4518,14 +4518,14 @@ class jo {
o = -1, a = -a;
else
return null;
- xs.subVectors(this.origin, e);
- const c = o * this.direction.dot(pc.crossVectors(xs, pc));
+ Ss.subVectors(this.origin, e);
+ const c = o * this.direction.dot(Mc.crossVectors(Ss, Mc));
if (c < 0)
return null;
- const l = o * this.direction.dot(xh.cross(xs));
+ const l = o * this.direction.dot(Vh.cross(Ss));
if (l < 0 || c + l > a)
return null;
- const h = -o * xs.dot(Eh);
+ const h = -o * Ss.dot(Wh);
return h < 0 ? null : this.at(h / a, r);
}
/**
@@ -4555,7 +4555,7 @@ class jo {
return new this.constructor().copy(this);
}
}
-class st {
+class De {
/**
* Constructs a new 4x4 matrix. The arguments are supposed to be
* in row-major order. If no arguments are provided, the constructor
@@ -4578,8 +4578,8 @@ class st {
* @param {number} [n43] - 4-3 matrix element.
* @param {number} [n44] - 4-4 matrix element.
*/
- constructor(e, t, n, s, r, a, o, c, l, h, u, d, f, m, g, A) {
- st.prototype.isMatrix4 = !0, this.elements = [
+ constructor(e, t, n, s, r, a, o, c, l, h, u, d, f, p, m, g) {
+ De.prototype.isMatrix4 = !0, this.elements = [
1,
0,
0,
@@ -4596,7 +4596,7 @@ class st {
0,
0,
1
- ], e !== void 0 && this.set(e, t, n, s, r, a, o, c, l, h, u, d, f, m, g, A);
+ ], e !== void 0 && this.set(e, t, n, s, r, a, o, c, l, h, u, d, f, p, m, g);
}
/**
* Sets the elements of the matrix.The arguments are supposed to be
@@ -4620,9 +4620,9 @@ class st {
* @param {number} [n44] - 4-4 matrix element.
* @return {Matrix4} A reference to this matrix.
*/
- set(e, t, n, s, r, a, o, c, l, h, u, d, f, m, g, A) {
- const p = this.elements;
- return p[0] = e, p[4] = t, p[8] = n, p[12] = s, p[1] = r, p[5] = a, p[9] = o, p[13] = c, p[2] = l, p[6] = h, p[10] = u, p[14] = d, p[3] = f, p[7] = m, p[11] = g, p[15] = A, this;
+ 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;
}
/**
* Sets this matrix to the 4x4 identity matrix.
@@ -4655,7 +4655,7 @@ class st {
* @return {Matrix4} A clone of this instance.
*/
clone() {
- return new st().fromArray(this.elements);
+ return new De().fromArray(this.elements);
}
/**
* Copies the values of the given matrix to this instance.
@@ -4754,7 +4754,7 @@ class st {
* @return {Matrix4} A reference to this matrix.
*/
extractRotation(e) {
- const t = this.elements, n = e.elements, s = 1 / Ur.setFromMatrixColumn(e, 0).length(), r = 1 / Ur.setFromMatrixColumn(e, 1).length(), a = 1 / Ur.setFromMatrixColumn(e, 2).length();
+ 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();
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;
}
/**
@@ -4770,23 +4770,23 @@ class st {
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, m = o * h, g = o * u;
- t[0] = c * h, t[4] = -c * u, t[8] = l, t[1] = f + m * l, t[5] = d - g * l, t[9] = -o * c, t[2] = g - d * l, t[6] = m + f * l, t[10] = a * c;
+ 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, m = l * h, g = l * u;
- t[0] = d + g * o, t[4] = m * o - f, t[8] = a * l, t[1] = a * u, t[5] = a * h, t[9] = -o, t[2] = f * o - m, t[6] = g + d * o, t[10] = a * c;
+ 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, m = l * h, g = l * u;
- t[0] = d - g * o, t[4] = -a * u, t[8] = m + f * o, t[1] = f + m * o, t[5] = a * h, t[9] = g - d * o, t[2] = -a * l, t[6] = o, t[10] = a * c;
+ 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, m = o * h, g = o * u;
- t[0] = c * h, t[4] = m * l - f, t[8] = d * l + g, t[1] = c * u, t[5] = g * l + d, t[9] = f * l - m, t[2] = -l, t[6] = o * c, t[10] = a * c;
+ 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, m = o * c, g = o * l;
- t[0] = c * h, t[4] = g - d * u, t[8] = m * u + f, t[1] = u, t[5] = a * h, t[9] = -o * h, t[2] = -l * h, t[6] = f * u + m, t[10] = d - g * u;
+ 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, m = o * c, g = o * l;
- t[0] = c * h, t[4] = -u, t[8] = l * h, t[1] = d * u + g, t[5] = a * h, t[9] = f * u - m, t[2] = m * u - f, t[6] = o * h, t[10] = g * u + d;
+ 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;
}
@@ -4799,7 +4799,7 @@ class st {
* @return {Matrix4} A reference to this matrix.
*/
makeRotationFromQuaternion(e) {
- return this.compose(b_, e, x_);
+ return this.compose(ny, e, iy);
}
/**
* Sets the rotation component of the transformation matrix, looking from `eye` towards
@@ -4812,7 +4812,7 @@ class st {
*/
lookAt(e, t, n) {
const s = this.elements;
- return Vn.subVectors(e, t), Vn.lengthSq() === 0 && (Vn.z = 1), Vn.normalize(), Es.crossVectors(n, Vn), Es.lengthSq() === 0 && (Math.abs(n.z) === 1 ? Vn.x += 1e-4 : Vn.z += 1e-4, Vn.normalize(), Es.crossVectors(n, Vn)), Es.normalize(), Ac.crossVectors(Vn, Es), s[0] = Es.x, s[4] = Ac.x, s[8] = Vn.x, s[1] = Es.y, s[5] = Ac.y, s[9] = Vn.y, s[2] = Es.z, s[6] = Ac.z, s[10] = Vn.z, this;
+ 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;
}
/**
* Post-multiplies this matrix by the given 4x4 matrix.
@@ -4841,8 +4841,8 @@ class st {
* @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], m = n[2], g = n[6], A = n[10], p = n[14], y = n[3], b = n[7], _ = n[11], M = 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], 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 * S + 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 * S + 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] = m * w + g * v + A * $ + p * Q, r[6] = m * S + g * F + A * D + p * J, r[10] = m * T + g * K + A * O + p * ee, r[14] = m * C + g * q + A * Y + p * ae, r[3] = y * w + b * v + _ * $ + M * Q, r[7] = y * S + b * F + _ * D + M * J, r[11] = y * T + b * K + _ * O + M * ee, r[15] = y * C + b * q + _ * Y + M * 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], 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;
}
/**
* Multiplies every component of the matrix by the given scalar.
@@ -4862,8 +4862,8 @@ class st {
* @return {number} The determinant.
*/
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], m = e[3], g = e[7], A = e[11], p = e[15];
- return m * (+r * c * u - s * l * u - r * o * d + n * l * d + s * o * f - n * c * f) + g * (+t * c * f - t * l * d + r * a * d - s * a * f + s * l * h - r * c * h) + A * (+t * l * u - t * o * f - r * a * u + n * a * f + r * o * h - n * l * h) + p * (-s * o * h - t * c * u + t * o * d + s * a * u - n * a * d + n * c * h);
+ 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);
}
/**
* Transposes this matrix in place.
@@ -4896,10 +4896,10 @@ class st {
* @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], m = e[12], g = e[13], A = e[14], p = e[15], y = u * A * l - g * d * l + g * c * f - o * A * f - u * c * p + o * d * p, b = m * d * l - h * A * l - m * c * f + a * A * f + h * c * p - a * d * p, _ = h * g * l - m * u * l + m * o * f - a * g * f - h * o * p + a * u * p, M = m * u * c - h * g * c - m * o * d + a * g * d + h * o * A - a * u * A, w = t * y + n * b + s * _ + r * M;
+ 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;
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] = (g * d * r - u * A * r - g * s * f + n * A * f + u * s * p - n * d * p) * S, e[2] = (o * A * r - g * c * r + g * s * l - n * A * l - o * s * p + n * c * p) * S, e[3] = (u * c * r - o * d * r - u * s * l + n * d * l + o * s * f - n * c * f) * S, e[4] = b * S, e[5] = (h * A * r - m * d * r + m * s * f - t * A * f - h * s * p + t * d * p) * S, e[6] = (m * c * r - a * A * r - m * s * l + t * A * l + a * s * p - t * c * p) * S, e[7] = (a * d * r - h * c * r + h * s * l - t * d * l - a * s * f + t * c * f) * S, e[8] = _ * S, e[9] = (m * u * r - h * g * r - m * n * f + t * g * f + h * n * p - t * u * p) * S, e[10] = (a * g * r - m * o * r + m * n * l - t * g * l - a * n * p + t * o * p) * S, e[11] = (h * o * r - a * u * r - h * n * l + t * u * l + a * n * f - t * o * f) * S, e[12] = M * S, e[13] = (h * g * s - m * u * s + m * n * d - t * g * d - h * n * A + t * u * A) * S, e[14] = (m * o * s - a * g * s - m * n * c + t * g * c + a * n * A - t * o * A) * S, e[15] = (a * u * s - h * o * s + h * n * c - t * u * c - a * n * d + t * o * d) * S, this;
+ 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;
}
/**
* Multiplies the columns of this matrix by the given vector.
@@ -5150,8 +5150,8 @@ class st {
* @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, m = r * u, g = a * h, A = a * u, p = o * u, y = c * l, b = c * h, _ = c * u, M = n.x, w = n.y, S = n.z;
- return s[0] = (1 - (g + p)) * M, s[1] = (f + _) * M, s[2] = (m - b) * M, s[3] = 0, s[4] = (f - _) * w, s[5] = (1 - (d + p)) * w, s[6] = (A + y) * w, s[7] = 0, s[8] = (m + b) * S, s[9] = (A - y) * S, s[10] = (1 - (d + g)) * 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, 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;
}
/**
* Decomposes this matrix into its position, rotation and scale components
@@ -5168,11 +5168,11 @@ class st {
*/
decompose(e, t, n) {
const s = this.elements;
- let r = Ur.set(s[0], s[1], s[2]).length();
- const a = Ur.set(s[4], s[5], s[6]).length(), o = Ur.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], ci.copy(this);
+ 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();
+ 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 ci.elements[0] *= l, ci.elements[1] *= l, ci.elements[2] *= l, ci.elements[4] *= h, ci.elements[5] *= h, ci.elements[6] *= h, ci.elements[8] *= u, ci.elements[9] *= u, ci.elements[10] *= u, t.setFromRotationMatrix(ci), n.x = r, n.y = a, n.z = o, this;
+ 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;
}
/**
* Creates a perspective projection matrix. This is used internally by
@@ -5187,16 +5187,16 @@ class st {
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
* @return {Matrix4} A reference to this matrix.
*/
- makePerspective(e, t, n, s, r, a, o = is) {
+ makePerspective(e, t, n, s, r, a, o = ls) {
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, m;
- if (o === is)
- f = -(a + r) / (a - r), m = -2 * a * r / (a - r);
- else if (o === vl)
- f = -a / (a - r), m = -a * r / (a - r);
+ let f, p;
+ if (o === ls)
+ f = -(a + r) / (a - r), p = -2 * a * r / (a - r);
+ else if (o === Hl)
+ 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] = m, c[3] = 0, c[7] = 0, c[11] = -1, c[15] = 0, this;
+ 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;
}
/**
* Creates a orthographic projection matrix. This is used internally by
@@ -5211,16 +5211,16 @@ class st {
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
* @return {Matrix4} A reference to this matrix.
*/
- makeOrthographic(e, t, n, s, r, a, o = is) {
+ makeOrthographic(e, t, n, s, r, a, o = ls) {
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 m, g;
- if (o === is)
- m = (a + r) * u, g = -2 * u;
- else if (o === vl)
- m = r * u, g = -1 * u;
+ let p, m;
+ if (o === ls)
+ p = (a + r) * u, m = -2 * u;
+ else if (o === Hl)
+ 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] = g, c[14] = -m, c[3] = 0, c[7] = 0, c[11] = 0, c[15] = 1, this;
+ 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;
}
/**
* Returns `true` if this matrix is equal with the given one.
@@ -5259,8 +5259,8 @@ class st {
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 Ur = /* @__PURE__ */ new H(), ci = /* @__PURE__ */ new st(), b_ = /* @__PURE__ */ new H(0, 0, 0), x_ = /* @__PURE__ */ new H(1, 1, 1), Es = /* @__PURE__ */ new H(), Ac = /* @__PURE__ */ new H(), Vn = /* @__PURE__ */ new H(), gp = /* @__PURE__ */ new st(), mp = /* @__PURE__ */ new Xn();
-class Di {
+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();
+class dn {
/**
* Constructs a new euler instance.
*
@@ -5269,7 +5269,7 @@ class Di {
* @param {number} [z=0] - The angle of the z axis in radians.
* @param {string} [order=Euler.DEFAULT_ORDER] - A string representing the order that the rotations are applied.
*/
- constructor(e = 0, t = 0, n = 0, s = Di.DEFAULT_ORDER) {
+ 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;
}
/**
@@ -5361,22 +5361,22 @@ class Di {
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(ct(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-h, f), this._z = Math.atan2(-a, r)) : (this._x = Math.atan2(d, l), this._z = 0);
+ this._y = Math.asin(ot(o, -1, 1)), Math.abs(o) < 0.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(-ct(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._y = Math.atan2(o, f), this._z = Math.atan2(c, l)) : (this._y = Math.atan2(-u, r), this._z = 0);
+ this._x = Math.asin(-ot(h, -1, 1)), Math.abs(h) < 0.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(ct(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(-u, f), this._z = Math.atan2(-a, l)) : (this._y = 0, this._z = Math.atan2(c, r));
+ this._x = Math.asin(ot(d, -1, 1)), Math.abs(d) < 0.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(-ct(u, -1, 1)), Math.abs(u) < 0.9999999 ? (this._x = Math.atan2(d, f), this._z = Math.atan2(c, r)) : (this._x = 0, this._z = Math.atan2(-a, l));
+ this._y = Math.asin(-ot(u, -1, 1)), Math.abs(u) < 0.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(ct(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._x = Math.atan2(-h, l), this._y = Math.atan2(-u, r)) : (this._x = 0, this._y = Math.atan2(o, f));
+ this._z = Math.asin(ot(c, -1, 1)), Math.abs(c) < 0.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(-ct(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(d, l), this._y = Math.atan2(o, r)) : (this._x = Math.atan2(-h, f), this._y = 0);
+ this._z = Math.asin(-ot(a, -1, 1)), Math.abs(a) < 0.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);
@@ -5392,7 +5392,7 @@ class Di {
* @return {Euler} A reference to this Euler instance.
*/
setFromQuaternion(e, t, n) {
- return gp.makeRotationFromQuaternion(e), this.setFromRotationMatrix(gp, t, n);
+ return Vp.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Vp, t, n);
}
/**
* Sets the angles of this Euler instance from the given vector.
@@ -5415,7 +5415,7 @@ class Di {
* @return {Euler} A reference to this Euler instance.
*/
reorder(e) {
- return mp.setFromEuler(this), this.setFromQuaternion(mp, e);
+ return Wp.setFromEuler(this), this.setFromQuaternion(Wp, e);
}
/**
* Returns `true` if this Euler instance is equal with the given one.
@@ -5457,8 +5457,8 @@ class Di {
yield this._x, yield this._y, yield this._z, yield this._order;
}
}
-Di.DEFAULT_ORDER = "XYZ";
-class jm {
+dn.DEFAULT_ORDER = "XYZ";
+class v0 {
/**
* Constructs a new layers instance, with membership
* initially set to layer `0`.
@@ -5530,15 +5530,15 @@ class jm {
return (this.mask & (1 << e | 0)) !== 0;
}
}
-let E_ = 0;
-const bp = /* @__PURE__ */ new H(), Or = /* @__PURE__ */ new Xn(), zi = /* @__PURE__ */ new st(), gc = /* @__PURE__ */ new H(), Xa = /* @__PURE__ */ new H(), __ = /* @__PURE__ */ new H(), y_ = /* @__PURE__ */ new Xn(), xp = /* @__PURE__ */ new H(1, 0, 0), Ep = /* @__PURE__ */ new H(0, 1, 0), _p = /* @__PURE__ */ new H(0, 0, 1), yp = { type: "added" }, w_ = { type: "removed" }, Qr = { type: "childadded", child: null }, _h = { type: "childremoved", child: null };
-class kt extends Hs {
+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 {
/**
* Constructs a new 3D object.
*/
constructor() {
- super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: E_++ }), this.uuid = Ei(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = kt.DEFAULT_UP.clone();
- const e = new H(), t = new Di(), n = new Xn(), s = new H(1, 1, 1);
+ 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();
+ 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 kt extends Hs {
* @type {Matrix4}
*/
modelViewMatrix: {
- value: new st()
+ value: new De()
},
/**
* Represents the object's normal matrix.
@@ -5609,9 +5609,9 @@ class kt extends Hs {
* @type {Matrix3}
*/
normalMatrix: {
- value: new rt()
+ value: new at()
}
- }), this.matrix = new st(), this.matrixWorld = new st(), this.matrixAutoUpdate = kt.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new jm(), 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 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 = {};
}
/**
* A callback that is executed immediately before a 3D object is rendered to a shadow map.
@@ -5723,7 +5723,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
rotateOnAxis(e, t) {
- return Or.setFromAxisAngle(e, t), this.quaternion.multiply(Or), this;
+ return Yr.setFromAxisAngle(e, t), this.quaternion.multiply(Yr), this;
}
/**
* Rotates the 3D object along an axis in world space.
@@ -5733,7 +5733,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
rotateOnWorldAxis(e, t) {
- return Or.setFromAxisAngle(e, t), this.quaternion.premultiply(Or), this;
+ return Yr.setFromAxisAngle(e, t), this.quaternion.premultiply(Yr), this;
}
/**
* Rotates the 3D object around its X axis in local space.
@@ -5742,7 +5742,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
rotateX(e) {
- return this.rotateOnAxis(xp, e);
+ return this.rotateOnAxis(Kp, e);
}
/**
* Rotates the 3D object around its Y axis in local space.
@@ -5751,7 +5751,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
rotateY(e) {
- return this.rotateOnAxis(Ep, e);
+ return this.rotateOnAxis(jp, e);
}
/**
* Rotates the 3D object around its Z axis in local space.
@@ -5760,7 +5760,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
rotateZ(e) {
- return this.rotateOnAxis(_p, e);
+ return this.rotateOnAxis(Xp, e);
}
/**
* Translate the 3D object by a distance along the given axis in local space.
@@ -5770,7 +5770,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
translateOnAxis(e, t) {
- return bp.copy(e).applyQuaternion(this.quaternion), this.position.add(bp.multiplyScalar(t)), this;
+ return qp.copy(e).applyQuaternion(this.quaternion), this.position.add(qp.multiplyScalar(t)), this;
}
/**
* Translate the 3D object by a distance along its X-axis in local space.
@@ -5779,7 +5779,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
translateX(e) {
- return this.translateOnAxis(xp, e);
+ return this.translateOnAxis(Kp, e);
}
/**
* Translate the 3D object by a distance along its Y-axis in local space.
@@ -5788,7 +5788,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
translateY(e) {
- return this.translateOnAxis(Ep, 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 kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
translateZ(e) {
- return this.translateOnAxis(_p, e);
+ return this.translateOnAxis(Xp, e);
}
/**
* Converts the given vector from this 3D object's local space to world space.
@@ -5815,7 +5815,7 @@ class kt extends Hs {
* @return {Vector3} The converted vector.
*/
worldToLocal(e) {
- return this.updateWorldMatrix(!0, !1), e.applyMatrix4(zi.copy(this.matrixWorld).invert());
+ return this.updateWorldMatrix(!0, !1), e.applyMatrix4(Xi.copy(this.matrixWorld).invert());
}
/**
* Rotates the object to face a point in world space.
@@ -5827,9 +5827,9 @@ class kt extends Hs {
* @param {number} [z] - The z coordinate in world space.
*/
lookAt(e, t, n) {
- e.isVector3 ? gc.copy(e) : gc.set(e, t, n);
+ e.isVector3 ? Tc.copy(e) : Tc.set(e, t, n);
const s = this.parent;
- this.updateWorldMatrix(!0, !1), Xa.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? zi.lookAt(Xa, gc, this.up) : zi.lookAt(gc, Xa, this.up), this.quaternion.setFromRotationMatrix(zi), s && (zi.extractRotation(s.matrixWorld), Or.setFromRotationMatrix(zi), this.quaternion.premultiply(Or.invert()));
+ 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()));
}
/**
* Adds the given 3D object as a child to this 3D object. An arbitrary number of
@@ -5847,7 +5847,7 @@ class kt extends Hs {
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), Qr.child = e, this.dispatchEvent(Qr), Qr.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(Yp), Jr.child = e, this.dispatchEvent(Jr), Jr.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 kt extends Hs {
return this;
}
const t = this.children.indexOf(e);
- return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(w_), _h.child = e, this.dispatchEvent(_h), _h.child = null), this;
+ return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(oy), qh.child = e, this.dispatchEvent(qh), qh.child = null), this;
}
/**
* Removes this 3D object from its current parent.
@@ -5898,7 +5898,7 @@ class kt extends Hs {
* @return {Object3D} A reference to this instance.
*/
attach(e) {
- return this.updateWorldMatrix(!0, !1), zi.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), zi.multiply(e.parent.matrixWorld)), e.applyMatrix4(zi), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(yp), Qr.child = e, this.dispatchEvent(Qr), Qr.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(Yp), Jr.child = e, this.dispatchEvent(Jr), Jr.child = null, this;
}
/**
* Searches through the 3D object and its children, starting with the 3D object
@@ -5968,7 +5968,7 @@ class kt extends Hs {
* @return {Quaternion} The 3D object's rotation in world space.
*/
getWorldQuaternion(e) {
- return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Xa, e, __), e;
+ return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(so, e, ry), e;
}
/**
* Returns a vector representing the scale of the 3D object in world space.
@@ -5977,7 +5977,7 @@ class kt extends Hs {
* @return {Vector3} The 3D object's scale in world space.
*/
getWorldScale(e) {
- return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Xa, y_, e), e;
+ return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(so, ay, e), e;
}
/**
* Returns a vector representing the ("look") direction of the 3D object in world space.
@@ -6160,8 +6160,8 @@ class kt extends Hs {
}
}
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), m = 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), m.length > 0 && (n.nodes = m);
+ 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) {
@@ -6198,11 +6198,11 @@ class kt extends Hs {
return this;
}
}
-kt.DEFAULT_UP = /* @__PURE__ */ new H(0, 1, 0);
-kt.DEFAULT_MATRIX_AUTO_UPDATE = !0;
-kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
-const li = /* @__PURE__ */ new H(), Vi = /* @__PURE__ */ new H(), yh = /* @__PURE__ */ new H(), Wi = /* @__PURE__ */ new H(), Gr = /* @__PURE__ */ new H(), Hr = /* @__PURE__ */ new H(), wp = /* @__PURE__ */ new H(), wh = /* @__PURE__ */ new H(), vh = /* @__PURE__ */ new H(), Ch = /* @__PURE__ */ new H(), Sh = /* @__PURE__ */ new wt(), Ih = /* @__PURE__ */ new wt(), Mh = /* @__PURE__ */ new wt();
-class mi {
+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 {
/**
* Constructs a new triangle.
*
@@ -6210,7 +6210,7 @@ class mi {
* @param {Vector3} [b=(0,0,0)] - The second corner of the triangle.
* @param {Vector3} [c=(0,0,0)] - The third corner of the triangle.
*/
- constructor(e = new H(), t = new H(), n = new H()) {
+ constructor(e = new G(), t = new G(), n = new G()) {
this.a = e, this.b = t, this.c = n;
}
/**
@@ -6223,7 +6223,7 @@ class mi {
* @return {Vector3} The triangle's normal.
*/
static getNormal(e, t, n, s) {
- s.subVectors(n, t), li.subVectors(e, t), s.cross(li);
+ s.subVectors(n, t), xi.subVectors(e, t), s.cross(xi);
const r = s.lengthSq();
return r > 0 ? s.multiplyScalar(1 / Math.sqrt(r)) : s.set(0, 0, 0);
}
@@ -6239,12 +6239,12 @@ class mi {
* @return {?Vector3} The barycentric coordinates for the given point
*/
static getBarycoord(e, t, n, s, r) {
- li.subVectors(s, t), Vi.subVectors(n, t), yh.subVectors(e, t);
- const a = li.dot(li), o = li.dot(Vi), c = li.dot(yh), l = Vi.dot(Vi), h = Vi.dot(yh), u = a * l - o * o;
+ 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;
if (u === 0)
return r.set(0, 0, 0), null;
- const d = 1 / u, f = (l * c - o * h) * d, m = (a * h - o * c) * d;
- return r.set(1 - f - m, m, f);
+ const d = 1 / u, f = (l * c - o * h) * d, p = (a * h - o * c) * d;
+ return r.set(1 - f - p, p, f);
}
/**
* Returns `true` if the given point, when projected onto the plane of the
@@ -6258,7 +6258,7 @@ class mi {
* triangle, lies within the triangle or not.
*/
static containsPoint(e, t, n, s) {
- return this.getBarycoord(e, t, n, s, Wi) === null ? !1 : Wi.x >= 0 && Wi.y >= 0 && Wi.x + Wi.y <= 1;
+ return this.getBarycoord(e, t, n, s, Ji) === null ? !1 : Ji.x >= 0 && Ji.y >= 0 && Ji.x + Ji.y <= 1;
}
/**
* Computes the value barycentrically interpolated for the given point on the
@@ -6275,7 +6275,7 @@ class mi {
* @return {?Vector3} The interpolated value.
*/
static getInterpolation(e, t, n, s, r, a, o, c) {
- return this.getBarycoord(e, t, n, s, Wi) === 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, Wi.x), c.addScaledVector(a, Wi.y), c.addScaledVector(o, Wi.z), c);
+ return this.getBarycoord(e, t, n, s, Ji) === null ? (c.x = 0, c.y = 0, "z" in c && (c.z = 0), "w" in c && (c.w = 0), null) : (c.setScalar(0), c.addScaledVector(r, Ji.x), c.addScaledVector(a, Ji.y), c.addScaledVector(o, Ji.z), c);
}
/**
* Computes the value barycentrically interpolated for the given attribute and indices.
@@ -6289,7 +6289,7 @@ class mi {
* @return {Vector3} The interpolated attribute value.
*/
static getInterpolatedAttribute(e, t, n, s, r, a) {
- return Sh.setScalar(0), Ih.setScalar(0), Mh.setScalar(0), Sh.fromBufferAttribute(e, t), Ih.fromBufferAttribute(e, n), Mh.fromBufferAttribute(e, s), a.setScalar(0), a.addScaledVector(Sh, r.x), a.addScaledVector(Ih, r.y), a.addScaledVector(Mh, r.z), 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;
}
/**
* Returns `true` if the triangle is oriented towards the given direction.
@@ -6301,7 +6301,7 @@ class mi {
* @return {boolean} Whether the triangle is oriented towards the given direction or not.
*/
static isFrontFacing(e, t, n, s) {
- return li.subVectors(n, t), Vi.subVectors(e, t), li.cross(Vi).dot(s) < 0;
+ return xi.subVectors(n, t), Yi.subVectors(e, t), xi.cross(Yi).dot(s) < 0;
}
/**
* Sets the triangle's vertices by copying the given values.
@@ -6361,7 +6361,7 @@ class mi {
* @return {number} The triangle's area.
*/
getArea() {
- return li.subVectors(this.c, this.b), Vi.subVectors(this.a, this.b), li.cross(Vi).length() * 0.5;
+ return xi.subVectors(this.c, this.b), Yi.subVectors(this.a, this.b), xi.cross(Yi).length() * 0.5;
}
/**
* Computes the midpoint of the triangle.
@@ -6379,7 +6379,7 @@ class mi {
* @return {Vector3} The triangle's normal.
*/
getNormal(e) {
- return mi.getNormal(this.a, this.b, this.c, e);
+ return Si.getNormal(this.a, this.b, this.c, e);
}
/**
* Computes a plane the triangle lies within.
@@ -6399,7 +6399,7 @@ class mi {
* @return {?Vector3} The barycentric coordinates for the given point
*/
getBarycoord(e, t) {
- return mi.getBarycoord(e, this.a, this.b, this.c, t);
+ return Si.getBarycoord(e, this.a, this.b, this.c, t);
}
/**
* Computes the value barycentrically interpolated for the given point on the
@@ -6413,7 +6413,7 @@ class mi {
* @return {?Vector3} The interpolated value.
*/
getInterpolation(e, t, n, s, r) {
- return mi.getInterpolation(e, this.a, this.b, this.c, t, n, s, r);
+ return Si.getInterpolation(e, this.a, this.b, this.c, t, n, s, r);
}
/**
* Returns `true` if the given point, when projected onto the plane of the
@@ -6424,7 +6424,7 @@ class mi {
* triangle, lies within the triangle or not.
*/
containsPoint(e) {
- return mi.containsPoint(e, this.a, this.b, this.c);
+ return Si.containsPoint(e, this.a, this.b, this.c);
}
/**
* Returns `true` if the triangle is oriented towards the given direction.
@@ -6433,7 +6433,7 @@ class mi {
* @return {boolean} Whether the triangle is oriented towards the given direction or not.
*/
isFrontFacing(e) {
- return mi.isFrontFacing(this.a, this.b, this.c, e);
+ return Si.isFrontFacing(this.a, this.b, this.c, e);
}
/**
* Returns `true` if this triangle intersects with the given box.
@@ -6454,29 +6454,29 @@ class mi {
closestPointToPoint(e, t) {
const n = this.a, s = this.b, r = this.c;
let a, o;
- Gr.subVectors(s, n), Hr.subVectors(r, n), wh.subVectors(e, n);
- const c = Gr.dot(wh), l = Hr.dot(wh);
+ Zr.subVectors(s, n), $r.subVectors(r, n), jh.subVectors(e, n);
+ const c = Zr.dot(jh), l = $r.dot(jh);
if (c <= 0 && l <= 0)
return t.copy(n);
- vh.subVectors(e, s);
- const h = Gr.dot(vh), u = Hr.dot(vh);
+ Xh.subVectors(e, s);
+ const h = Zr.dot(Xh), u = $r.dot(Xh);
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(Gr, a);
- Ch.subVectors(e, r);
- const f = Gr.dot(Ch), m = Hr.dot(Ch);
- if (m >= 0 && f <= m)
+ return a = c / (c - h), t.copy(n).addScaledVector(Zr, a);
+ Yh.subVectors(e, r);
+ const f = Zr.dot(Yh), p = $r.dot(Yh);
+ if (p >= 0 && f <= p)
return t.copy(r);
- const g = f * l - c * m;
- if (g <= 0 && l >= 0 && m <= 0)
- return o = l / (l - m), t.copy(n).addScaledVector(Hr, o);
- const A = h * m - f * u;
- if (A <= 0 && u - h >= 0 && f - m >= 0)
- return wp.subVectors(r, s), o = (u - h) / (u - h + (f - m)), t.copy(s).addScaledVector(wp, o);
- const p = 1 / (A + g + d);
- return a = g * p, o = d * p, t.copy(n).addScaledVector(Gr, a).addScaledVector(Hr, o);
+ const m = f * l - c * p;
+ if (m <= 0 && l >= 0 && p <= 0)
+ return o = l / (l - p), t.copy(n).addScaledVector($r, 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);
+ const A = 1 / (g + m + d);
+ return a = m * A, o = d * A, t.copy(n).addScaledVector(Zr, a).addScaledVector($r, o);
}
/**
* Returns `true` if this triangle is equal with the given one.
@@ -6488,7 +6488,7 @@ class mi {
return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);
}
}
-const Xm = {
+const C0 = {
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
@@ -6637,11 +6637,11 @@ const Xm = {
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
-}, _s = { h: 0, s: 0, l: 0 }, mc = { h: 0, s: 0, l: 0 };
-function Bh(i, e, t) {
+}, Ms = { h: 0, s: 0, l: 0 }, Rc = { h: 0, s: 0, l: 0 };
+function eu(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 je = class {
+let Le = class {
/**
* Constructs a new color.
*
@@ -6689,8 +6689,8 @@ let je = class {
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
* @return {Color} A reference to this color.
*/
- setHex(e, t = Kt) {
- return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, mt.toWorkingColorSpace(this, t), 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, rt.toWorkingColorSpace(this, t), this;
}
/**
* Sets this color from RGB values.
@@ -6701,8 +6701,8 @@ let je = class {
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
* @return {Color} A reference to this color.
*/
- setRGB(e, t, n, s = mt.workingColorSpace) {
- return this.r = e, this.g = t, this.b = n, mt.toWorkingColorSpace(this, s), this;
+ setRGB(e, t, n, s = rt.workingColorSpace) {
+ return this.r = e, this.g = t, this.b = n, rt.toWorkingColorSpace(this, s), this;
}
/**
* Sets this color from RGB values.
@@ -6713,14 +6713,14 @@ let je = class {
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
* @return {Color} A reference to this color.
*/
- setHSL(e, t, n, s = mt.workingColorSpace) {
- if (e = df(e, 1), t = ct(t, 0, 1), n = ct(n, 0, 1), t === 0)
+ setHSL(e, t, n, s = rt.workingColorSpace) {
+ if (e = Of(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 = Bh(a, r, e + 1 / 3), this.g = Bh(a, r, e), this.b = Bh(a, r, e - 1 / 3);
+ this.r = eu(a, r, e + 1 / 3), this.g = eu(a, r, e), this.b = eu(a, r, e - 1 / 3);
}
- return mt.toWorkingColorSpace(this, s), this;
+ return rt.toWorkingColorSpace(this, s), this;
}
/**
* Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`,
@@ -6732,7 +6732,7 @@ let je = class {
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
* @return {Color} A reference to this color.
*/
- setStyle(e, t = Kt) {
+ setStyle(e, t = yt) {
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 je = class {
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
* @return {Color} A reference to this color.
*/
- setColorName(e, t = Kt) {
- const n = Xm[e.toLowerCase()];
+ setColorName(e, t = yt) {
+ const n = C0[e.toLowerCase()];
return n !== void 0 ? this.setHex(n, t) : console.warn("THREE.Color: Unknown color " + e), this;
}
/**
@@ -6829,7 +6829,7 @@ let je = class {
* @return {Color} A reference to this color.
*/
copySRGBToLinear(e) {
- return this.r = os(e.r), this.g = os(e.g), this.b = os(e.b), this;
+ return this.r = ps(e.r), this.g = ps(e.g), this.b = ps(e.b), this;
}
/**
* Copies the given color into this color, and then converts this color from
@@ -6839,7 +6839,7 @@ let je = class {
* @return {Color} A reference to this color.
*/
copyLinearToSRGB(e) {
- return this.r = ua(e.r), this.g = ua(e.g), this.b = ua(e.b), this;
+ return this.r = wa(e.r), this.g = wa(e.g), this.b = wa(e.b), this;
}
/**
* Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`.
@@ -6863,8 +6863,8 @@ let je = class {
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
* @return {number} The hexadecimal value.
*/
- getHex(e = Kt) {
- return mt.fromWorkingColorSpace(wn.copy(this), e), Math.round(ct(wn.r * 255, 0, 255)) * 65536 + Math.round(ct(wn.g * 255, 0, 255)) * 256 + Math.round(ct(wn.b * 255, 0, 255));
+ getHex(e = yt) {
+ 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));
}
/**
* Returns the hexadecimal value of this color as a string (for example, 'FFFFFF').
@@ -6872,7 +6872,7 @@ let je = class {
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
* @return {string} The hexadecimal value as a string.
*/
- getHexString(e = Kt) {
+ getHexString(e = yt) {
return ("000000" + this.getHex(e).toString(16)).slice(-6);
}
/**
@@ -6883,9 +6883,9 @@ let je = class {
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
* @return {{h:number,s:number,l:number}} The HSL representation of this color.
*/
- getHSL(e, t = mt.workingColorSpace) {
- mt.fromWorkingColorSpace(wn.copy(this), t);
- const n = wn.r, s = wn.g, r = wn.b, a = Math.max(n, s, r), o = Math.min(n, s, r);
+ getHSL(e, t = rt.workingColorSpace) {
+ rt.fromWorkingColorSpace(Fn.copy(this), t);
+ const n = Fn.r, s = Fn.g, r = Fn.b, a = Math.max(n, s, r), o = Math.min(n, s, r);
let c, l;
const h = (o + a) / 2;
if (o === a)
@@ -6914,8 +6914,8 @@ let je = class {
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
* @return {Color} The RGB representation of this color.
*/
- getRGB(e, t = mt.workingColorSpace) {
- return mt.fromWorkingColorSpace(wn.copy(this), t), e.r = wn.r, e.g = wn.g, e.b = wn.b, e;
+ getRGB(e, t = rt.workingColorSpace) {
+ return rt.fromWorkingColorSpace(Fn.copy(this), t), e.r = Fn.r, e.g = Fn.g, e.b = Fn.b, e;
}
/**
* Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`.
@@ -6923,10 +6923,10 @@ let je = class {
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
* @return {string} The CSS representation of this color.
*/
- getStyle(e = Kt) {
- mt.fromWorkingColorSpace(wn.copy(this), e);
- const t = wn.r, n = wn.g, s = wn.b;
- return e !== Kt ? `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})` : `rgb(${Math.round(t * 255)},${Math.round(n * 255)},${Math.round(s * 255)})`;
+ getStyle(e = yt) {
+ 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)})`;
}
/**
* Adds the given HSL values to this color's values.
@@ -6939,7 +6939,7 @@ let je = class {
* @return {Color} A reference to this color.
*/
offsetHSL(e, t, n) {
- return this.getHSL(_s), this.setHSL(_s.h + e, _s.s + t, _s.l + n);
+ return this.getHSL(Ms), this.setHSL(Ms.h + e, Ms.s + t, Ms.l + n);
}
/**
* Adds the RGB values of the given color to the RGB values of this color.
@@ -7033,8 +7033,8 @@ let je = class {
* @return {Color} A reference to this color.
*/
lerpHSL(e, t) {
- this.getHSL(_s), e.getHSL(mc);
- const n = Eo(_s.h, mc.h, t), s = Eo(_s.s, mc.s, t), r = Eo(_s.l, mc.l, 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);
return this.setHSL(n, s, r), this;
}
/**
@@ -7109,15 +7109,15 @@ let je = class {
yield this.r, yield this.g, yield this.b;
}
};
-const wn = /* @__PURE__ */ new je();
-je.NAMES = Xm;
-let v_ = 0;
-class Fi extends Hs {
+const Fn = /* @__PURE__ */ new Le();
+Le.NAMES = C0;
+let cy = 0;
+class ui extends Ys {
/**
* Constructs a new material.
*/
constructor() {
- super(), this.isMaterial = !0, Object.defineProperty(this, "id", { value: v_++ }), this.uuid = Ei(), this.name = "", this.type = "Material", this.blending = ha, this.side = us, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = Fu, this.blendDst = Du, this.blendEquation = rr, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new je(0, 0, 0), this.blendAlpha = 0, this.depthFunc = _a, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = lp, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = Fr, this.stencilZFail = Fr, this.stencilZPass = Fr, 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: 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;
}
/**
* Sets the alpha value to be used when running an alpha test. The material
@@ -7216,7 +7216,7 @@ class Fi extends Hs {
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 !== ha && (n.blending = this.blending), this.side !== us && (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 !== Fu && (n.blendSrc = this.blendSrc), this.blendDst !== Du && (n.blendDst = this.blendDst), this.blendEquation !== rr && (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 !== _a && (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 !== lp && (n.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (n.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (n.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== Fr && (n.stencilFail = this.stencilFail), this.stencilZFail !== Fr && (n.stencilZFail = this.stencilZFail), this.stencilZPass !== Fr && (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 !== 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);
function s(r) {
const a = [];
for (const o in r) {
@@ -7278,7 +7278,7 @@ class Fi extends Hs {
e === !0 && this.version++;
}
}
-class Ns extends Fi {
+class Os extends ui {
/**
* Constructs a new mesh basic material.
*
@@ -7289,14 +7289,14 @@ class Ns extends Fi {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshBasicMaterial = !0, this.type = "MeshBasicMaterial", this.color = new je(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 Di(), this.combine = Bm, 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 = 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);
}
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 Zi = /* @__PURE__ */ C_();
-function C_() {
+const ss = /* @__PURE__ */ ly();
+function ly() {
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 C_() {
offsetTable: o
};
}
-function S_(i) {
- Math.abs(i) > 65504 && console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."), i = ct(i, -65504, 65504), Zi.floatView[0] = i;
- const e = Zi.uint32View[0], t = e >> 23 & 511;
- return Zi.baseTable[t] + ((e & 8388607) >> Zi.shiftTable[t]);
+function hy(i) {
+ Math.abs(i) > 65504 && console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."), i = ot(i, -65504, 65504), ss.floatView[0] = i;
+ const e = ss.uint32View[0], t = e >> 23 & 511;
+ return ss.baseTable[t] + ((e & 8388607) >> ss.shiftTable[t]);
}
-function I_(i) {
+function uy(i) {
const e = i >> 10;
- return Zi.uint32View[0] = Zi.mantissaTable[Zi.offsetTable[e] + (i & 1023)] + Zi.exponentTable[e], Zi.floatView[0];
+ return ss.uint32View[0] = ss.mantissaTable[ss.offsetTable[e] + (i & 1023)] + ss.exponentTable[e], ss.floatView[0];
}
-class vp {
+class Zp {
/**
* Returns a half precision floating point value (FP16) from the given single
* precision floating point value (FP32).
@@ -7347,7 +7347,7 @@ class vp {
* @return {number} The FP16 value.
*/
static toHalfFloat(e) {
- return S_(e);
+ return hy(e);
}
/**
* Returns a single precision floating point value (FP32) from the given half
@@ -7357,12 +7357,12 @@ class vp {
* @return {number} The FP32 value.
*/
static fromHalfFloat(e) {
- return I_(e);
+ return uy(e);
}
}
-const Yt = /* @__PURE__ */ new H(), bc = /* @__PURE__ */ new Ze();
-let M_ = 0;
-class _n {
+const nn = /* @__PURE__ */ new G(), Fc = /* @__PURE__ */ new Ze();
+let dy = 0;
+class Bn {
/**
* Constructs a new buffer attribute.
*
@@ -7373,7 +7373,7 @@ class _n {
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: M_++ }), this.name = "", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = n, this.usage = hd, this.updateRanges = [], this.gpuType = an, this.version = 0;
+ 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;
}
/**
* A callback function that is executed after the renderer has transferred the attribute
@@ -7460,10 +7460,10 @@ class _n {
applyMatrix3(e) {
if (this.itemSize === 2)
for (let t = 0, n = this.count; t < n; t++)
- bc.fromBufferAttribute(this, t), bc.applyMatrix3(e), this.setXY(t, bc.x, bc.y);
+ Fc.fromBufferAttribute(this, t), Fc.applyMatrix3(e), this.setXY(t, Fc.x, Fc.y);
else if (this.itemSize === 3)
for (let t = 0, n = this.count; t < n; t++)
- Yt.fromBufferAttribute(this, t), Yt.applyMatrix3(e), this.setXYZ(t, Yt.x, Yt.y, Yt.z);
+ nn.fromBufferAttribute(this, t), nn.applyMatrix3(e), this.setXYZ(t, nn.x, nn.y, nn.z);
return this;
}
/**
@@ -7475,7 +7475,7 @@ class _n {
*/
applyMatrix4(e) {
for (let t = 0, n = this.count; t < n; t++)
- Yt.fromBufferAttribute(this, t), Yt.applyMatrix4(e), this.setXYZ(t, Yt.x, Yt.y, Yt.z);
+ nn.fromBufferAttribute(this, t), nn.applyMatrix4(e), this.setXYZ(t, nn.x, nn.y, nn.z);
return this;
}
/**
@@ -7487,7 +7487,7 @@ class _n {
*/
applyNormalMatrix(e) {
for (let t = 0, n = this.count; t < n; t++)
- Yt.fromBufferAttribute(this, t), Yt.applyNormalMatrix(e), this.setXYZ(t, Yt.x, Yt.y, Yt.z);
+ nn.fromBufferAttribute(this, t), nn.applyNormalMatrix(e), this.setXYZ(t, nn.x, nn.y, nn.z);
return this;
}
/**
@@ -7499,7 +7499,7 @@ class _n {
*/
transformDirection(e) {
for (let t = 0, n = this.count; t < n; t++)
- Yt.fromBufferAttribute(this, t), Yt.transformDirection(e), this.setXYZ(t, Yt.x, Yt.y, Yt.z);
+ nn.fromBufferAttribute(this, t), nn.transformDirection(e), this.setXYZ(t, nn.x, nn.y, nn.z);
return this;
}
/**
@@ -7521,7 +7521,7 @@ class _n {
*/
getComponent(e, t) {
let n = this.array[e * this.itemSize + t];
- return this.normalized && (n = gi(n, this.array)), n;
+ return this.normalized && (n = Ci(n, this.array)), n;
}
/**
* Sets the given value to the given component of the vector at the given index.
@@ -7532,7 +7532,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setComponent(e, t, n) {
- return this.normalized && (n = It(n, this.array)), this.array[e * this.itemSize + t] = n, this;
+ return this.normalized && (n = Bt(n, this.array)), this.array[e * this.itemSize + t] = n, this;
}
/**
* Returns the x component of the vector at the given index.
@@ -7542,7 +7542,7 @@ class _n {
*/
getX(e) {
let t = this.array[e * this.itemSize];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Sets the x component of the vector at the given index.
@@ -7552,7 +7552,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setX(e, t) {
- return this.normalized && (t = It(t, this.array)), this.array[e * this.itemSize] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.array[e * this.itemSize] = t, this;
}
/**
* Returns the y component of the vector at the given index.
@@ -7562,7 +7562,7 @@ class _n {
*/
getY(e) {
let t = this.array[e * this.itemSize + 1];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Sets the y component of the vector at the given index.
@@ -7572,7 +7572,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setY(e, t) {
- return this.normalized && (t = It(t, this.array)), this.array[e * this.itemSize + 1] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.array[e * this.itemSize + 1] = t, this;
}
/**
* Returns the z component of the vector at the given index.
@@ -7582,7 +7582,7 @@ class _n {
*/
getZ(e) {
let t = this.array[e * this.itemSize + 2];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Sets the z component of the vector at the given index.
@@ -7592,7 +7592,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setZ(e, t) {
- return this.normalized && (t = It(t, this.array)), this.array[e * this.itemSize + 2] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.array[e * this.itemSize + 2] = t, this;
}
/**
* Returns the w component of the vector at the given index.
@@ -7602,7 +7602,7 @@ class _n {
*/
getW(e) {
let t = this.array[e * this.itemSize + 3];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Sets the w component of the vector at the given index.
@@ -7612,7 +7612,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setW(e, t) {
- return this.normalized && (t = It(t, this.array)), this.array[e * this.itemSize + 3] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.array[e * this.itemSize + 3] = t, this;
}
/**
* Sets the x and y component of the vector at the given index.
@@ -7623,7 +7623,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setXY(e, t, n) {
- return e *= this.itemSize, this.normalized && (t = It(t, this.array), n = It(n, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this;
+ 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;
}
/**
* Sets the x, y and z component of the vector at the given index.
@@ -7635,7 +7635,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setXYZ(e, t, n, s) {
- return e *= this.itemSize, this.normalized && (t = It(t, this.array), n = It(n, this.array), s = It(s, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = s, this;
+ 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;
}
/**
* Sets the x, y, z and w component of the vector at the given index.
@@ -7648,7 +7648,7 @@ class _n {
* @return {BufferAttribute} A reference to this instance.
*/
setXYZW(e, t, n, s, r) {
- return e *= this.itemSize, this.normalized && (t = It(t, this.array), n = It(n, this.array), s = It(s, this.array), r = It(r, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = s, this.array[e + 3] = r, this;
+ 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;
}
/**
* Sets the given callback function that is executed after the Renderer has transferred
@@ -7681,10 +7681,10 @@ class _n {
array: Array.from(this.array),
normalized: this.normalized
};
- return this.name !== "" && (e.name = this.name), this.usage !== hd && (e.usage = this.usage), e;
+ return this.name !== "" && (e.name = this.name), this.usage !== Pd && (e.usage = this.usage), e;
}
}
-class Ym extends _n {
+class Gf extends Bn {
/**
* Constructs a new buffer attribute.
*
@@ -7696,7 +7696,7 @@ class Ym extends _n {
super(new Uint16Array(e), t, n);
}
}
-class Jm extends _n {
+class S0 extends Bn {
/**
* Constructs a new buffer attribute.
*
@@ -7708,7 +7708,7 @@ class Jm extends _n {
super(new Uint32Array(e), t, n);
}
}
-class kn extends _n {
+class en extends Bn {
/**
* Constructs a new buffer attribute.
*
@@ -7720,14 +7720,14 @@ class kn extends _n {
super(new Float32Array(e), t, n);
}
}
-let B_ = 0;
-const Yn = /* @__PURE__ */ new st(), Th = /* @__PURE__ */ new kt(), zr = /* @__PURE__ */ new H(), Wn = /* @__PURE__ */ new Pi(), Ya = /* @__PURE__ */ new Pi(), An = /* @__PURE__ */ new H();
-class Hn extends Hs {
+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 {
/**
* Constructs a new geometry.
*/
constructor() {
- super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { value: B_++ }), this.uuid = Ei(), 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: 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 = {};
}
/**
* Returns the index of this geometry.
@@ -7744,7 +7744,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
setIndex(e) {
- return Array.isArray(e) ? this.index = new (Wm(e) ? Jm : Ym)(e, 1) : this.index = e, this;
+ return Array.isArray(e) ? this.index = new (_0(e) ? S0 : Gf)(e, 1) : this.index = e, this;
}
/**
* Sets the given indirect attribute to this geometry.
@@ -7843,7 +7843,7 @@ class Hn extends Hs {
t !== void 0 && (t.applyMatrix4(e), t.needsUpdate = !0);
const n = this.attributes.normal;
if (n !== void 0) {
- const r = new rt().getNormalMatrix(e);
+ const r = new at().getNormalMatrix(e);
n.applyNormalMatrix(r), n.needsUpdate = !0;
}
const s = this.attributes.tangent;
@@ -7856,7 +7856,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
applyQuaternion(e) {
- return Yn.makeRotationFromQuaternion(e), this.applyMatrix4(Yn), this;
+ return ii.makeRotationFromQuaternion(e), this.applyMatrix4(ii), this;
}
/**
* Rotates the geometry about the X axis. This is typically done as a one time
@@ -7867,7 +7867,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
rotateX(e) {
- return Yn.makeRotationX(e), this.applyMatrix4(Yn), this;
+ return ii.makeRotationX(e), this.applyMatrix4(ii), this;
}
/**
* Rotates the geometry about the Y axis. This is typically done as a one time
@@ -7878,7 +7878,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
rotateY(e) {
- return Yn.makeRotationY(e), this.applyMatrix4(Yn), this;
+ return ii.makeRotationY(e), this.applyMatrix4(ii), this;
}
/**
* Rotates the geometry about the Z axis. This is typically done as a one time
@@ -7889,7 +7889,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
rotateZ(e) {
- return Yn.makeRotationZ(e), this.applyMatrix4(Yn), this;
+ return ii.makeRotationZ(e), this.applyMatrix4(ii), this;
}
/**
* Translates the geometry. This is typically done as a one time
@@ -7902,7 +7902,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
translate(e, t, n) {
- return Yn.makeTranslation(e, t, n), this.applyMatrix4(Yn), this;
+ return ii.makeTranslation(e, t, n), this.applyMatrix4(ii), this;
}
/**
* Scales the geometry. This is typically done as a one time
@@ -7915,7 +7915,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
scale(e, t, n) {
- return Yn.makeScale(e, t, n), this.applyMatrix4(Yn), this;
+ return ii.makeScale(e, t, n), this.applyMatrix4(ii), this;
}
/**
* Rotates the geometry to face a point in 3D space. This is typically done as a one time
@@ -7926,7 +7926,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
lookAt(e) {
- return Th.lookAt(e), Th.updateMatrix(), this.applyMatrix4(Th.matrix), this;
+ return tu.lookAt(e), tu.updateMatrix(), this.applyMatrix4(tu.matrix), this;
}
/**
* Center the geometry based on its bounding box.
@@ -7934,7 +7934,7 @@ class Hn extends Hs {
* @return {BufferGeometry} A reference to this instance.
*/
center() {
- return this.computeBoundingBox(), this.boundingBox.getCenter(zr).negate(), this.translate(zr.x, zr.y, zr.z), this;
+ return this.computeBoundingBox(), this.boundingBox.getCenter(ea).negate(), this.translate(ea.x, ea.y, ea.z), this;
}
/**
* Defines a geometry by creating a `position` attribute based on the given array of points. The array
@@ -7955,7 +7955,7 @@ class Hn extends Hs {
const a = e[s];
n.push(a.x, a.y, a.z || 0);
}
- this.setAttribute("position", new kn(n, 3));
+ this.setAttribute("position", new en(n, 3));
} else {
const n = Math.min(e.length, t.count);
for (let s = 0; s < n; s++) {
@@ -7972,12 +7972,12 @@ class Hn extends Hs {
* You may need to recompute the bounding box if the geometry vertices are modified.
*/
computeBoundingBox() {
- this.boundingBox === null && (this.boundingBox = new Pi());
+ this.boundingBox === null && (this.boundingBox = new Hi());
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 H(-1 / 0, -1 / 0, -1 / 0),
- new H(1 / 0, 1 / 0, 1 / 0)
+ new G(-1 / 0, -1 / 0, -1 / 0),
+ new G(1 / 0, 1 / 0, 1 / 0)
);
return;
}
@@ -7985,7 +7985,7 @@ class Hn extends Hs {
if (this.boundingBox.setFromBufferAttribute(e), t)
for (let n = 0, s = t.length; n < s; n++) {
const r = t[n];
- Wn.setFromBufferAttribute(r), this.morphTargetsRelative ? (An.addVectors(this.boundingBox.min, Wn.min), this.boundingBox.expandByPoint(An), An.addVectors(this.boundingBox.max, Wn.max), this.boundingBox.expandByPoint(An)) : (this.boundingBox.expandByPoint(Wn.min), this.boundingBox.expandByPoint(Wn.max));
+ 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));
}
} else
this.boundingBox.makeEmpty();
@@ -7997,28 +7997,28 @@ class Hn extends Hs {
* You may need to recompute the bounding sphere if the geometry vertices are modified.
*/
computeBoundingSphere() {
- this.boundingSphere === null && (this.boundingSphere = new ki());
+ this.boundingSphere === null && (this.boundingSphere = new zi());
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 H(), 1 / 0);
+ 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 (Wn.setFromBufferAttribute(e), t)
+ if (Zn.setFromBufferAttribute(e), t)
for (let r = 0, a = t.length; r < a; r++) {
const o = t[r];
- Ya.setFromBufferAttribute(o), this.morphTargetsRelative ? (An.addVectors(Wn.min, Ya.min), Wn.expandByPoint(An), An.addVectors(Wn.max, Ya.max), Wn.expandByPoint(An)) : (Wn.expandByPoint(Ya.min), Wn.expandByPoint(Ya.max));
+ 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));
}
- Wn.getCenter(n);
+ Zn.getCenter(n);
let s = 0;
for (let r = 0, a = e.count; r < a; r++)
- An.fromBufferAttribute(e, r), s = Math.max(s, n.distanceToSquared(An));
+ _n.fromBufferAttribute(e, r), s = Math.max(s, n.distanceToSquared(_n));
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++)
- An.fromBufferAttribute(o, l), c && (zr.fromBufferAttribute(e, l), An.add(zr)), s = Math.max(s, n.distanceToSquared(An));
+ _n.fromBufferAttribute(o, l), c && (ea.fromBufferAttribute(e, l), _n.add(ea)), s = Math.max(s, n.distanceToSquared(_n));
}
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);
}
@@ -8037,15 +8037,15 @@ class Hn extends Hs {
return;
}
const n = t.position, s = t.normal, r = t.uv;
- this.hasAttribute("tangent") === !1 && this.setAttribute("tangent", new _n(new Float32Array(4 * n.count), 4));
+ this.hasAttribute("tangent") === !1 && this.setAttribute("tangent", new Bn(new Float32Array(4 * n.count), 4));
const a = this.getAttribute("tangent"), o = [], c = [];
for (let T = 0; T < n.count; T++)
- o[T] = new H(), c[T] = new H();
- const l = new H(), h = new H(), u = new H(), d = new Ze(), f = new Ze(), m = new Ze(), g = new H(), A = new H();
- function p(T, C, v) {
- l.fromBufferAttribute(n, T), h.fromBufferAttribute(n, C), u.fromBufferAttribute(n, v), d.fromBufferAttribute(r, T), f.fromBufferAttribute(r, C), m.fromBufferAttribute(r, v), h.sub(l), u.sub(l), f.sub(d), m.sub(d);
- const F = 1 / (f.x * m.y - m.x * f.y);
- isFinite(F) && (g.copy(h).multiplyScalar(m.y).addScaledVector(u, -f.y).multiplyScalar(F), A.copy(u).multiplyScalar(f.x).addScaledVector(h, -m.x).multiplyScalar(F), o[T].add(g), o[C].add(g), o[v].add(g), c[T].add(A), c[C].add(A), c[v].add(A));
+ o[T] = new G(), c[T] = new G();
+ const l = new G(), h = new G(), u = new G(), d = new Ze(), f = new Ze(), p = new Ze(), 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 y = this.groups;
y.length === 0 && (y = [{
@@ -8055,19 +8055,19 @@ class Hn extends Hs {
for (let T = 0, C = y.length; T < C; ++T) {
const v = y[T], F = v.start, K = v.count;
for (let q = F, $ = F + K; q < $; q += 3)
- p(
+ A(
e.getX(q + 0),
e.getX(q + 1),
e.getX(q + 2)
);
}
- const b = new H(), _ = new H(), M = new H(), w = new H();
+ const x = new G(), E = new G(), I = new G(), w = new G();
function S(T) {
- M.fromBufferAttribute(s, T), w.copy(M);
+ I.fromBufferAttribute(s, T), w.copy(I);
const C = o[T];
- b.copy(C), b.sub(M.multiplyScalar(M.dot(C))).normalize(), _.crossVectors(w, C);
- const F = _.dot(c[T]) < 0 ? -1 : 1;
- a.setXYZW(T, b.x, b.y, b.z, F);
+ 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 = y.length; T < C; ++T) {
const v = y[T], F = v.start, K = v.count;
@@ -8086,15 +8086,15 @@ class Hn extends Hs {
if (t !== void 0) {
let n = this.getAttribute("normal");
if (n === void 0)
- n = new _n(new Float32Array(t.count * 3), 3), this.setAttribute("normal", n);
+ n = new Bn(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 H(), r = new H(), a = new H(), o = new H(), c = new H(), l = new H(), h = new H(), u = new H();
+ 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 m = e.getX(d + 0), g = e.getX(d + 1), A = e.getX(d + 2);
- s.fromBufferAttribute(t, m), r.fromBufferAttribute(t, g), a.fromBufferAttribute(t, A), h.subVectors(a, r), u.subVectors(s, r), h.cross(u), o.fromBufferAttribute(n, m), c.fromBufferAttribute(n, g), l.fromBufferAttribute(n, A), o.add(h), c.add(h), l.add(h), n.setXYZ(m, o.x, o.y, o.z), n.setXYZ(g, c.x, c.y, c.z), n.setXYZ(A, l.x, l.y, l.z);
+ 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)
@@ -8109,7 +8109,7 @@ class Hn extends Hs {
normalizeNormals() {
const e = this.attributes.normal;
for (let t = 0, n = e.count; t < n; t++)
- An.fromBufferAttribute(e, t), An.normalize(), e.setXYZ(t, An.x, An.y, An.z);
+ _n.fromBufferAttribute(e, t), _n.normalize(), e.setXYZ(t, _n.x, _n.y, _n.z);
}
/**
* Return a new non-index version of this indexed geometry. If the geometry
@@ -8120,17 +8120,17 @@ class Hn extends Hs {
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, m = 0;
- for (let g = 0, A = c.length; g < A; g++) {
- o.isInterleavedBufferAttribute ? f = c[g] * o.data.stride + o.offset : f = c[g] * h;
- for (let p = 0; p < h; p++)
- d[m++] = l[f++];
+ 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 _n(d, h, u);
+ return new Bn(d, h, u);
}
if (this.index === null)
return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this;
- const t = new Hn(), n = this.index.array, s = this.attributes;
+ const t = new Tn(), n = this.index.array, s = this.attributes;
for (const o in s) {
const c = s[o], l = e(c, n);
t.setAttribute(o, l);
@@ -8254,15 +8254,15 @@ class Hn extends Hs {
this.dispatchEvent({ type: "dispose" });
}
}
-const Cp = /* @__PURE__ */ new st(), Xs = /* @__PURE__ */ new jo(), xc = /* @__PURE__ */ new ki(), Sp = /* @__PURE__ */ new H(), Ec = /* @__PURE__ */ new H(), _c = /* @__PURE__ */ new H(), yc = /* @__PURE__ */ new H(), Rh = /* @__PURE__ */ new H(), wc = /* @__PURE__ */ new H(), Ip = /* @__PURE__ */ new H(), vc = /* @__PURE__ */ new H();
-class Jt extends kt {
+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();
+class Zt extends Tt {
/**
* Constructs a new mesh.
*
* @param {BufferGeometry} [geometry] - The mesh geometry.
* @param {Material|Array<Material>} [material] - The mesh material.
*/
- constructor(e = new Hn(), t = new Ns()) {
+ constructor(e = new Tn(), t = new Os()) {
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) {
@@ -8298,12 +8298,12 @@ class Jt extends kt {
t.fromBufferAttribute(s, e);
const o = this.morphTargetInfluences;
if (r && o) {
- wc.set(0, 0, 0);
+ kc.set(0, 0, 0);
for (let c = 0, l = r.length; c < l; c++) {
const h = o[c], u = r[c];
- h !== 0 && (Rh.fromBufferAttribute(u, e), a ? wc.addScaledVector(Rh, h) : wc.addScaledVector(Rh.sub(t), h));
+ h !== 0 && (nu.fromBufferAttribute(u, e), a ? kc.addScaledVector(nu, h) : kc.addScaledVector(nu.sub(t), h));
}
- t.add(wc);
+ t.add(kc);
}
return t;
}
@@ -8315,74 +8315,74 @@ class Jt extends kt {
*/
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), Xs.copy(e.ray).recast(e.near), !(xc.containsPoint(Xs.origin) === !1 && (Xs.intersectSphere(xc, Sp) === null || Xs.origin.distanceToSquared(Sp) > (e.far - e.near) ** 2)) && (Cp.copy(r).invert(), Xs.copy(e.ray).applyMatrix4(Cp), !(n.boundingBox !== null && Xs.intersectsBox(n.boundingBox) === !1) && this._computeIntersections(e, t, Xs)));
+ 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)));
}
_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 m = 0, g = d.length; m < g; m++) {
- const A = d[m], p = a[A.materialIndex], y = Math.max(A.start, f.start), b = Math.min(o.count, Math.min(A.start + A.count, f.start + f.count));
- for (let _ = y, M = b; _ < M; _ += 3) {
- const w = o.getX(_), S = o.getX(_ + 1), T = o.getX(_ + 2);
- s = Cc(this, p, e, n, l, h, u, w, S, T), s && (s.faceIndex = Math.floor(_ / 3), s.face.materialIndex = A.materialIndex, t.push(s));
+ 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));
}
}
else {
- const m = Math.max(0, f.start), g = Math.min(o.count, f.start + f.count);
- for (let A = m, p = g; A < p; A += 3) {
- const y = o.getX(A), b = o.getX(A + 1), _ = o.getX(A + 2);
- s = Cc(this, a, e, n, l, h, u, y, b, _), s && (s.faceIndex = Math.floor(A / 3), t.push(s));
+ 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));
}
}
else if (c !== void 0)
if (Array.isArray(a))
- for (let m = 0, g = d.length; m < g; m++) {
- const A = d[m], p = a[A.materialIndex], y = Math.max(A.start, f.start), b = Math.min(c.count, Math.min(A.start + A.count, f.start + f.count));
- for (let _ = y, M = b; _ < M; _ += 3) {
- const w = _, S = _ + 1, T = _ + 2;
- s = Cc(this, p, e, n, l, h, u, w, S, T), s && (s.faceIndex = Math.floor(_ / 3), s.face.materialIndex = A.materialIndex, t.push(s));
+ 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));
}
}
else {
- const m = Math.max(0, f.start), g = Math.min(c.count, f.start + f.count);
- for (let A = m, p = g; A < p; A += 3) {
- const y = A, b = A + 1, _ = A + 2;
- s = Cc(this, a, e, n, l, h, u, y, b, _), s && (s.faceIndex = Math.floor(A / 3), t.push(s));
+ 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));
}
}
}
}
-function T_(i, e, t, n, s, r, a, o) {
+function py(i, e, t, n, s, r, a, o) {
let c;
- if (e.side === Ln ? c = n.intersectTriangle(a, r, s, !0, o) : c = n.intersectTriangle(s, r, a, e.side === us, o), c === null) return null;
- vc.copy(o), vc.applyMatrix4(i.matrixWorld);
- const l = t.ray.origin.distanceTo(vc);
+ 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);
return l < t.near || l > t.far ? null : {
distance: l,
- point: vc.clone(),
+ point: Uc.clone(),
object: i
};
}
-function Cc(i, e, t, n, s, r, a, o, c, l) {
- i.getVertexPosition(o, Ec), i.getVertexPosition(c, _c), i.getVertexPosition(l, yc);
- const h = T_(i, e, t, n, Ec, _c, yc, Ip);
+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);
if (h) {
- const u = new H();
- mi.getBarycoord(Ip, Ec, _c, yc, u), s && (h.uv = mi.getInterpolatedAttribute(s, o, c, l, u, new Ze())), r && (h.uv1 = mi.getInterpolatedAttribute(r, o, c, l, u, new Ze())), a && (h.normal = mi.getInterpolatedAttribute(a, o, c, l, u, new H()), h.normal.dot(n.direction) > 0 && h.normal.multiplyScalar(-1));
+ 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));
const d = {
a: o,
b: c,
c: l,
- normal: new H(),
+ normal: new G(),
materialIndex: 0
};
- mi.getNormal(Ec, _c, yc, d.normal), h.face = d, h.barycoord = u;
+ Si.getNormal(Nc, Lc, Pc, d.normal), h.face = d, h.barycoord = u;
}
return h;
}
-class Pa extends Hn {
+class Va extends Tn {
/**
* Constructs a new box geometry.
*
@@ -8406,21 +8406,21 @@ class Pa extends Hn {
s = Math.floor(s), r = Math.floor(r), a = Math.floor(a);
const c = [], l = [], h = [], u = [];
let d = 0, f = 0;
- m("z", "y", "x", -1, -1, n, t, e, a, r, 0), m("z", "y", "x", 1, -1, n, t, -e, a, r, 1), m("x", "z", "y", 1, 1, e, n, t, s, a, 2), m("x", "z", "y", 1, -1, e, n, -t, s, a, 3), m("x", "y", "z", 1, -1, e, t, n, s, r, 4), m("x", "y", "z", -1, -1, e, t, -n, s, r, 5), this.setIndex(c), this.setAttribute("position", new kn(l, 3)), this.setAttribute("normal", new kn(h, 3)), this.setAttribute("uv", new kn(u, 2));
- function m(g, A, p, y, b, _, M, w, S, T, C) {
- const v = _ / S, F = M / T, K = _ / 2, q = M / 2, $ = w / 2, D = S + 1, O = T + 1;
+ 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;
let Y = 0, Q = 0;
- const J = new H();
+ const J = new G();
for (let ee = 0; ee < O; ee++) {
const ae = ee * F - q;
- for (let ye = 0; ye < D; ye++) {
+ for (let ye = 0; ye < N; ye++) {
const Me = ye * v - K;
- J[g] = Me * y, J[A] = ae * b, J[p] = $, l.push(J.x, J.y, J.z), J[g] = 0, J[A] = 0, J[p] = w > 0 ? 1 : -1, h.push(J.x, J.y, J.z), u.push(ye / S), u.push(1 - ee / T), Y += 1;
+ 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 ee = 0; ee < T; ee++)
for (let ae = 0; ae < S; ae++) {
- const ye = d + ae + D * ee, Me = d + ae + D * (ee + 1), se = d + (ae + 1) + D * (ee + 1), me = d + (ae + 1) + D * ee;
+ 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;
}
o.addGroup(f, Q, C), f += Q, d += Y;
@@ -8437,10 +8437,10 @@ class Pa extends Hn {
* @return {BoxGeometry} A new instance.
*/
static fromJSON(e) {
- return new Pa(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);
+ return new Va(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);
}
}
-function Ca(i) {
+function La(i) {
const e = {};
for (const t in i) {
e[t] = {};
@@ -8451,32 +8451,32 @@ function Ca(i) {
}
return e;
}
-function Mn(i) {
+function Pn(i) {
const e = {};
for (let t = 0; t < i.length; t++) {
- const n = Ca(i[t]);
+ const n = La(i[t]);
for (const s in n)
e[s] = n[s];
}
return e;
}
-function R_(i) {
+function Ay(i) {
const e = [];
for (let t = 0; t < i.length; t++)
e.push(i[t].clone());
return e;
}
-function Zm(i) {
+function I0(i) {
const e = i.getRenderTarget();
- return e === null ? i.outputColorSpace : e.isXRRenderTarget === !0 ? e.texture.colorSpace : mt.workingColorSpace;
+ return e === null ? i.outputColorSpace : e.isXRRenderTarget === !0 ? e.texture.colorSpace : rt.workingColorSpace;
}
-const N_ = { clone: Ca, merge: Mn };
-var F_ = `void main() {
+const gy = { clone: La, merge: Pn };
+var my = `void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-}`, D_ = `void main() {
+}`, xy = `void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;
-class Os extends Fi {
+class qs extends ui {
/**
* Constructs a new shader material.
*
@@ -8487,7 +8487,7 @@ class Os extends Fi {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isShaderMaterial = !0, this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = F_, this.fragmentShader = D_, 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 = 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 = {
clipCullDistance: !1,
// set to use vertex shader clipping
multiDraw: !1
@@ -8499,7 +8499,7 @@ class Os extends Fi {
}, 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 = Ca(e.uniforms), this.uniformsGroups = R_(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 = 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;
}
toJSON(e) {
const t = super.toJSON(e);
@@ -8538,12 +8538,12 @@ class Os extends Fi {
return Object.keys(n).length > 0 && (t.extensions = n), t;
}
}
-class $m extends kt {
+class M0 extends Tt {
/**
* Constructs a new camera.
*/
constructor() {
- super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new st(), this.projectionMatrix = new st(), this.projectionMatrixInverse = new st(), this.coordinateSystem = is;
+ super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new De(), this.projectionMatrix = new De(), this.projectionMatrixInverse = new De(), 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 $m extends kt {
return new this.constructor().copy(this);
}
}
-const ys = /* @__PURE__ */ new H(), Mp = /* @__PURE__ */ new Ze(), Bp = /* @__PURE__ */ new Ze();
-class vn extends $m {
+const Bs = /* @__PURE__ */ new G(), nA = /* @__PURE__ */ new Ze(), iA = /* @__PURE__ */ new Ze();
+class Sn extends M0 {
/**
* Constructs a new perspective camera.
*
@@ -8596,7 +8596,7 @@ class vn extends $m {
*/
setFocalLength(e) {
const t = 0.5 * this.getFilmHeight() / e;
- this.fov = va * 2 * Math.atan(t), this.updateProjectionMatrix();
+ this.fov = Na * 2 * Math.atan(t), this.updateProjectionMatrix();
}
/**
* Returns the focal length from the current {@link PerspectiveCamera#fov} and
@@ -8605,7 +8605,7 @@ class vn extends $m {
* @return {number} The computed focal length.
*/
getFocalLength() {
- const e = Math.tan(xo * 0.5 * this.fov);
+ const e = Math.tan(To * 0.5 * this.fov);
return 0.5 * this.getFilmHeight() / e;
}
/**
@@ -8614,8 +8614,8 @@ class vn extends $m {
* @return {number} The effective FOV.
*/
getEffectiveFOV() {
- return va * 2 * Math.atan(
- Math.tan(xo * 0.5 * this.fov) / this.zoom
+ return Na * 2 * Math.atan(
+ Math.tan(To * 0.5 * this.fov) / this.zoom
);
}
/**
@@ -8645,7 +8645,7 @@ class vn extends $m {
* @param {Vector2} maxTarget - The upper-right corner of the view rectangle is written into this vector.
*/
getViewBounds(e, t, n) {
- ys.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse), t.set(ys.x, ys.y).multiplyScalar(-e / ys.z), ys.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse), n.set(ys.x, ys.y).multiplyScalar(-e / ys.z);
+ Bs.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse), t.set(Bs.x, Bs.y).multiplyScalar(-e / Bs.z), Bs.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse), n.set(Bs.x, Bs.y).multiplyScalar(-e / Bs.z);
}
/**
* Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
@@ -8655,7 +8655,7 @@ class vn extends $m {
* @returns {Vector2} The view size.
*/
getViewSize(e, t) {
- return this.getViewBounds(e, Mp, Bp), t.subVectors(Bp, Mp);
+ return this.getViewBounds(e, nA, iA), t.subVectors(iA, nA);
}
/**
* Sets an offset in a larger frustum. This is useful for multi-window or
@@ -8723,7 +8723,7 @@ class vn extends $m {
*/
updateProjectionMatrix() {
const e = this.near;
- let t = e * Math.tan(xo * 0.5 * this.fov) / this.zoom, n = 2 * t, s = this.aspect * n, r = -0.5 * s;
+ let t = e * Math.tan(To * 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 vn extends $m {
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 Vr = -90, Wr = 1;
-class L_ extends kt {
+const ta = -90, na = 1;
+class by extends Tt {
/**
* Constructs a new cube camera.
*
@@ -8748,17 +8748,17 @@ class L_ extends kt {
*/
constructor(e, t, n) {
super(), this.type = "CubeCamera", this.renderTarget = n, this.coordinateSystem = null, this.activeMipmapLevel = 0;
- const s = new vn(Vr, Wr, e, t);
+ const s = new Sn(ta, na, e, t);
s.layers = this.layers, this.add(s);
- const r = new vn(Vr, Wr, e, t);
+ const r = new Sn(ta, na, e, t);
r.layers = this.layers, this.add(r);
- const a = new vn(Vr, Wr, e, t);
+ const a = new Sn(ta, na, e, t);
a.layers = this.layers, this.add(a);
- const o = new vn(Vr, Wr, e, t);
+ const o = new Sn(ta, na, e, t);
o.layers = this.layers, this.add(o);
- const c = new vn(Vr, Wr, e, t);
+ const c = new Sn(ta, na, e, t);
c.layers = this.layers, this.add(c);
- const l = new vn(Vr, Wr, e, t);
+ const l = new Sn(ta, na, e, t);
l.layers = this.layers, this.add(l);
}
/**
@@ -8767,9 +8767,9 @@ class L_ extends kt {
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 === is)
+ if (e === ls)
n.up.set(0, 1, 0), n.lookAt(1, 0, 0), s.up.set(0, 1, 0), s.lookAt(-1, 0, 0), r.up.set(0, 0, -1), r.lookAt(0, 1, 0), a.up.set(0, 0, 1), a.lookAt(0, -1, 0), o.up.set(0, 1, 0), o.lookAt(0, 0, 1), c.up.set(0, 1, 0), c.lookAt(0, 0, -1);
- else if (e === vl)
+ else if (e === Hl)
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);
@@ -8787,13 +8787,13 @@ class L_ extends kt {
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(), m = e.xr.enabled;
+ 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 g = 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 = g, e.setRenderTarget(n, 5, s), e.render(t, h), e.setRenderTarget(u, d, f), e.xr.enabled = m, n.texture.needsPMREMUpdate = !0;
+ 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 e0 extends cn {
+class B0 extends an {
/**
* Constructs a new cube texture.
*
@@ -8808,7 +8808,7 @@ class e0 extends cn {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space value.
*/
- constructor(e = [], t = br, n, s, r, a, o, c, l, h) {
+ 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;
}
/**
@@ -8823,7 +8823,7 @@ class e0 extends cn {
this.image = e;
}
}
-class P_ extends Er {
+class Ey extends Mr {
/**
* Constructs a new cube render target.
*
@@ -8833,7 +8833,7 @@ class P_ extends Er {
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 e0(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;
+ 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;
}
/**
* Converts the given equirectangular texture to a cube map.
@@ -8891,17 +8891,17 @@ class P_ extends Er {
}
`
)
- }, s = new Pa(5, 5, 5), r = new Os({
+ }, s = new Va(5, 5, 5), r = new qs({
name: "CubemapFromEquirect",
- uniforms: Ca(n.uniforms),
+ uniforms: La(n.uniforms),
vertexShader: n.vertexShader,
fragmentShader: n.fragmentShader,
- side: Ln,
- blending: Ds
+ side: Vn,
+ blending: Gs
});
r.uniforms.tEquirect.value = t;
- const a = new Jt(s, r), o = t.minFilter;
- return t.minFilter === ii && (t.minFilter = qt), new L_(1, 10, this).update(e, a), t.minFilter = o, a.geometry.dispose(), a.material.dispose(), this;
+ 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;
}
/**
* Clears this cube render target.
@@ -8918,13 +8918,13 @@ class P_ extends Er {
e.setRenderTarget(r);
}
}
-class ur extends kt {
+class hs extends Tt {
constructor() {
super(), this.isGroup = !0, this.type = "Group";
}
}
-const k_ = { type: "move" };
-class Nh {
+const _y = { type: "move" };
+class iu {
/**
* Constructs a new XR controller.
*/
@@ -8937,7 +8937,7 @@ class Nh {
* @return {Group} A group representing the hand space of the XR controller.
*/
getHandSpace() {
- return this._hand === null && (this._hand = new ur(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand;
+ return this._hand === null && (this._hand = new hs(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand;
}
/**
* Returns a group representing the target ray space of the XR controller.
@@ -8945,7 +8945,7 @@ class Nh {
* @return {Group} A group representing the target ray space of the XR controller.
*/
getTargetRaySpace() {
- return this._targetRay === null && (this._targetRay = new ur(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new H(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new H()), this._targetRay;
+ return this._targetRay === null && (this._targetRay = new hs(), 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;
}
/**
* Returns a group representing the grip space of the XR controller.
@@ -8953,7 +8953,7 @@ class Nh {
* @return {Group} A group representing the grip space of the XR controller.
*/
getGripSpace() {
- return this._grip === null && (this._grip = new ur(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new H(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new H()), this._grip;
+ return this._grip === null && (this._grip = new hs(), 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;
}
/**
* Dispatches the given event to the groups representing
@@ -9005,23 +9005,23 @@ class Nh {
if (e && t.session.visibilityState !== "visible-blurred") {
if (l && e.hand) {
a = !0;
- for (const g of e.hand.values()) {
- const A = t.getJointPose(g, n), p = this._getHandJoint(l, g);
- A !== null && (p.matrix.fromArray(A.transform.matrix), p.matrix.decompose(p.position, p.rotation, p.scale), p.matrixWorldNeedsUpdate = !0, p.jointRadius = A.radius), p.visible = A !== null;
+ 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 = 0.02, m = 5e-3;
- l.inputState.pinching && d > f + m ? (l.inputState.pinching = !1, this.dispatchEvent({
+ const h = l.joints["index-finger-tip"], u = l.joints["thumb-tip"], d = h.position.distanceTo(u.position), f = 0.02, p = 5e-3;
+ l.inputState.pinching && d > f + p ? (l.inputState.pinching = !1, this.dispatchEvent({
type: "pinchend",
handedness: e.handedness,
target: this
- })) : !l.inputState.pinching && d <= f - m && (l.inputState.pinching = !0, this.dispatchEvent({
+ })) : !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(k_)));
+ 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)));
}
return o !== null && (o.visible = s !== null), c !== null && (c.visible = r !== null), l !== null && (l.visible = a !== null), this;
}
@@ -9035,18 +9035,18 @@ class Nh {
*/
_getHandJoint(e, t) {
if (e.joints[t.jointName] === void 0) {
- const n = new ur();
+ const n = new hs();
n.matrixAutoUpdate = !1, n.visible = !1, e.joints[t.jointName] = n, e.add(n);
}
return e.joints[t.jointName];
}
}
-class ud extends kt {
+class kd extends Tt {
/**
* Constructs a new scene.
*/
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 Di(), this.environmentIntensity = 1, this.environmentRotation = new Di(), this.overrideMaterial = null, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
+ 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;
@@ -9056,7 +9056,7 @@ class ud extends kt {
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 U_ {
+class yy {
/**
* Constructs a new interleaved buffer.
*
@@ -9064,7 +9064,7 @@ class U_ {
* @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 = hd, this.updateRanges = [], this.version = 0, this.uuid = Ei();
+ 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();
}
/**
* A callback function that is executed after the renderer has transferred the attribute array
@@ -9149,7 +9149,7 @@ class U_ {
* @return {InterleavedBuffer} A clone of this instance.
*/
clone(e) {
- e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Ei()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);
+ e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = 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;
}
@@ -9171,7 +9171,7 @@ class U_ {
* @return {Object} A JSON object representing the serialized interleaved buffer.
*/
toJSON(e) {
- return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Ei()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer))), {
+ return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = 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,
@@ -9179,8 +9179,8 @@ class U_ {
};
}
}
-const Cn = /* @__PURE__ */ new H();
-class pf {
+const Dn = /* @__PURE__ */ new G();
+class Hf {
/**
* Constructs a new interleaved buffer attribute.
*
@@ -9229,7 +9229,7 @@ class pf {
*/
applyMatrix4(e) {
for (let t = 0, n = this.data.count; t < n; t++)
- Cn.fromBufferAttribute(this, t), Cn.applyMatrix4(e), this.setXYZ(t, Cn.x, Cn.y, Cn.z);
+ Dn.fromBufferAttribute(this, t), Dn.applyMatrix4(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);
return this;
}
/**
@@ -9241,7 +9241,7 @@ class pf {
*/
applyNormalMatrix(e) {
for (let t = 0, n = this.count; t < n; t++)
- Cn.fromBufferAttribute(this, t), Cn.applyNormalMatrix(e), this.setXYZ(t, Cn.x, Cn.y, Cn.z);
+ Dn.fromBufferAttribute(this, t), Dn.applyNormalMatrix(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);
return this;
}
/**
@@ -9253,7 +9253,7 @@ class pf {
*/
transformDirection(e) {
for (let t = 0, n = this.count; t < n; t++)
- Cn.fromBufferAttribute(this, t), Cn.transformDirection(e), this.setXYZ(t, Cn.x, Cn.y, Cn.z);
+ Dn.fromBufferAttribute(this, t), Dn.transformDirection(e), this.setXYZ(t, Dn.x, Dn.y, Dn.z);
return this;
}
/**
@@ -9265,7 +9265,7 @@ class pf {
*/
getComponent(e, t) {
let n = this.array[e * this.data.stride + this.offset + t];
- return this.normalized && (n = gi(n, this.array)), n;
+ return this.normalized && (n = Ci(n, this.array)), n;
}
/**
* Sets the given value to the given component of the vector at the given index.
@@ -9276,7 +9276,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setComponent(e, t, n) {
- return this.normalized && (n = It(n, this.array)), this.data.array[e * this.data.stride + this.offset + t] = n, this;
+ return this.normalized && (n = Bt(n, this.array)), this.data.array[e * this.data.stride + this.offset + t] = n, this;
}
/**
* Sets the x component of the vector at the given index.
@@ -9286,7 +9286,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setX(e, t) {
- return this.normalized && (t = It(t, this.array)), this.data.array[e * this.data.stride + this.offset] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.data.array[e * this.data.stride + this.offset] = t, this;
}
/**
* Sets the y component of the vector at the given index.
@@ -9296,7 +9296,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setY(e, t) {
- return this.normalized && (t = It(t, this.array)), this.data.array[e * this.data.stride + this.offset + 1] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 1] = t, this;
}
/**
* Sets the z component of the vector at the given index.
@@ -9306,7 +9306,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setZ(e, t) {
- return this.normalized && (t = It(t, this.array)), this.data.array[e * this.data.stride + this.offset + 2] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 2] = t, this;
}
/**
* Sets the w component of the vector at the given index.
@@ -9316,7 +9316,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setW(e, t) {
- return this.normalized && (t = It(t, this.array)), this.data.array[e * this.data.stride + this.offset + 3] = t, this;
+ return this.normalized && (t = Bt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 3] = t, this;
}
/**
* Returns the x component of the vector at the given index.
@@ -9326,7 +9326,7 @@ class pf {
*/
getX(e) {
let t = this.data.array[e * this.data.stride + this.offset];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Returns the y component of the vector at the given index.
@@ -9336,7 +9336,7 @@ class pf {
*/
getY(e) {
let t = this.data.array[e * this.data.stride + this.offset + 1];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Returns the z component of the vector at the given index.
@@ -9346,7 +9346,7 @@ class pf {
*/
getZ(e) {
let t = this.data.array[e * this.data.stride + this.offset + 2];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Returns the w component of the vector at the given index.
@@ -9356,7 +9356,7 @@ class pf {
*/
getW(e) {
let t = this.data.array[e * this.data.stride + this.offset + 3];
- return this.normalized && (t = gi(t, this.array)), t;
+ return this.normalized && (t = Ci(t, this.array)), t;
}
/**
* Sets the x and y component of the vector at the given index.
@@ -9367,7 +9367,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setXY(e, t, n) {
- return e = e * this.data.stride + this.offset, this.normalized && (t = It(t, this.array), n = It(n, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this;
+ 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;
}
/**
* Sets the x, y and z component of the vector at the given index.
@@ -9379,7 +9379,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setXYZ(e, t, n, s) {
- return e = e * this.data.stride + this.offset, this.normalized && (t = It(t, this.array), n = It(n, this.array), s = It(s, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = s, this;
+ 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;
}
/**
* Sets the x, y, z and w component of the vector at the given index.
@@ -9392,7 +9392,7 @@ class pf {
* @return {InterleavedBufferAttribute} A reference to this instance.
*/
setXYZW(e, t, n, s, r) {
- return e = e * this.data.stride + this.offset, this.normalized && (t = It(t, this.array), n = It(n, this.array), s = It(s, this.array), r = It(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;
+ 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;
}
/**
* Returns a new buffer attribute with copied values from this instance.
@@ -9411,9 +9411,9 @@ class pf {
for (let r = 0; r < this.itemSize; r++)
t.push(this.data.array[s + r]);
}
- return new _n(new this.array.constructor(t), this.itemSize, this.normalized);
+ 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 pf(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 Hf(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
}
/**
* Serializes the buffer attribute into JSON.
@@ -9448,8 +9448,8 @@ class pf {
};
}
}
-const Tp = /* @__PURE__ */ new H(), Rp = /* @__PURE__ */ new wt(), Np = /* @__PURE__ */ new wt(), O_ = /* @__PURE__ */ new H(), Fp = /* @__PURE__ */ new st(), Sc = /* @__PURE__ */ new H(), Fh = /* @__PURE__ */ new ki(), Dp = /* @__PURE__ */ new st(), Dh = /* @__PURE__ */ new jo();
-class Q_ extends Jt {
+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 {
/**
* Constructs a new skinned mesh.
*
@@ -9457,7 +9457,7 @@ class Q_ extends Jt {
* @param {Material|Array<Material>} [material] - The mesh material.
*/
constructor(e, t) {
- super(e, t), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = cp, this.bindMatrix = new st(), this.bindMatrixInverse = new st(), this.boundingBox = null, this.boundingSphere = null;
+ 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;
}
/**
* Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}.
@@ -9467,10 +9467,10 @@ class Q_ extends Jt {
*/
computeBoundingBox() {
const e = this.geometry;
- this.boundingBox === null && (this.boundingBox = new Pi()), this.boundingBox.makeEmpty();
+ 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, Sc), this.boundingBox.expandByPoint(Sc);
+ this.getVertexPosition(n, Qc), this.boundingBox.expandByPoint(Qc);
}
/**
* Computes the bounding sphere of the skinned mesh, and updates {@link SkinnedMesh#boundingSphere}.
@@ -9480,17 +9480,17 @@ class Q_ extends Jt {
*/
computeBoundingSphere() {
const e = this.geometry;
- this.boundingSphere === null && (this.boundingSphere = new ki()), this.boundingSphere.makeEmpty();
+ 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, Sc), this.boundingSphere.expandByPoint(Sc);
+ this.getVertexPosition(n, Qc), this.boundingSphere.expandByPoint(Qc);
}
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(), Fh.copy(this.boundingSphere), Fh.applyMatrix4(s), e.ray.intersectsSphere(Fh) !== !1 && (Dp.copy(s).invert(), Dh.copy(e.ray).applyMatrix4(Dp), !(this.boundingBox !== null && Dh.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(e, t, Dh)));
+ 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)));
}
getVertexPosition(e, t) {
return super.getVertexPosition(e, t), this.applyBoneTransform(e, t), t;
@@ -9516,7 +9516,7 @@ class Q_ extends Jt {
* in the skinned mesh's geometry.
*/
normalizeSkinWeights() {
- const e = new wt(), t = this.geometry.attributes.skinWeight;
+ const e = new mt(), t = this.geometry.attributes.skinWeight;
for (let n = 0, s = t.count; n < s; n++) {
e.fromBufferAttribute(t, n);
const r = 1 / e.manhattanLength();
@@ -9524,7 +9524,7 @@ class Q_ extends Jt {
}
}
updateMatrixWorld(e) {
- super.updateMatrixWorld(e), this.bindMode === cp ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === NE ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode);
+ 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);
}
/**
* Applies the bone transform associated with the given index to the given
@@ -9537,18 +9537,18 @@ class Q_ extends Jt {
*/
applyBoneTransform(e, t) {
const n = this.skeleton, s = this.geometry;
- Rp.fromBufferAttribute(s.attributes.skinIndex, e), Np.fromBufferAttribute(s.attributes.skinWeight, e), Tp.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);
+ rA.fromBufferAttribute(s.attributes.skinIndex, e), aA.fromBufferAttribute(s.attributes.skinWeight, e), sA.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);
for (let r = 0; r < 4; r++) {
- const a = Np.getComponent(r);
+ const a = aA.getComponent(r);
if (a !== 0) {
- const o = Rp.getComponent(r);
- Fp.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(O_.copy(Tp).applyMatrix4(Fp), a);
+ const o = rA.getComponent(r);
+ oA.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(wy.copy(sA).applyMatrix4(oA), a);
}
}
return t.applyMatrix4(this.bindMatrixInverse);
}
}
-class t0 extends kt {
+class zl extends Tt {
/**
* Constructs a new bone.
*/
@@ -9556,7 +9556,7 @@ class t0 extends kt {
super(), this.isBone = !0, this.type = "Bone";
}
}
-class Hl extends cn {
+class uh extends an {
/**
* Constructs a new data texture.
*
@@ -9573,12 +9573,12 @@ class Hl extends cn {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space.
*/
- constructor(e = null, t = 1, n = 1, s, r, a, o, c, l = Pn, h = Pn, u, d) {
+ constructor(e = null, t = 1, n = 1, s, r, a, o, c, l = Wn, h = Wn, 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 Lp = /* @__PURE__ */ new st(), G_ = /* @__PURE__ */ new st();
-class Af {
+const lA = /* @__PURE__ */ new De(), vy = /* @__PURE__ */ new De();
+class dh {
/**
* Constructs a new skeleton.
*
@@ -9587,7 +9587,7 @@ class Af {
* If not provided, these matrices will be computed automatically via {@link Skeleton#calculateInverses}.
*/
constructor(e = [], t = []) {
- this.uuid = Ei(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.init();
+ this.uuid = Mi(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.init();
}
/**
* Initializes the skeleton. This method gets automatically called by the constructor
@@ -9601,7 +9601,7 @@ class Af {
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 st());
+ this.boneInverses.push(new De());
}
}
/**
@@ -9611,7 +9611,7 @@ class Af {
calculateInverses() {
this.boneInverses.length = 0;
for (let e = 0, t = this.bones.length; e < t; e++) {
- const n = new st();
+ const n = new De();
this.bones[e] && n.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(n);
}
}
@@ -9634,8 +9634,8 @@ class Af {
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 : G_;
- Lp.multiplyMatrices(o, t[r]), Lp.toArray(n, r * 16);
+ const o = e[r] ? e[r].matrixWorld : vy;
+ lA.multiplyMatrices(o, t[r]), lA.toArray(n, r * 16);
}
s !== null && (s.needsUpdate = !0);
}
@@ -9645,7 +9645,7 @@ class Af {
* @return {Skeleton} A clone of this instance.
*/
clone() {
- return new Af(this.bones, this.boneInverses);
+ return new dh(this.bones, this.boneInverses);
}
/**
* Computes a data texture for passing bone data to the vertex shader.
@@ -9657,7 +9657,7 @@ class Af {
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 Hl(t, e, e, on, an);
+ const n = new uh(t, e, e, pn, fn);
return n.needsUpdate = !0, this.boneMatrices = t, this.boneTexture = n, this;
}
/**
@@ -9693,7 +9693,7 @@ class Af {
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 t0()), this.bones.push(a), this.boneInverses.push(new st().fromArray(e.boneInverses[n]));
+ 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]));
}
return this.init(), this;
}
@@ -9724,7 +9724,7 @@ class Af {
return e;
}
}
-class dd extends _n {
+class Ud extends Bn {
/**
* Constructs a new instanced buffer attribute.
*
@@ -9744,8 +9744,8 @@ class dd extends _n {
return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e;
}
}
-const qr = /* @__PURE__ */ new st(), Pp = /* @__PURE__ */ new st(), Ic = [], kp = /* @__PURE__ */ new Pi(), H_ = /* @__PURE__ */ new st(), Ja = /* @__PURE__ */ new Jt(), Za = /* @__PURE__ */ new ki();
-class n0 extends Jt {
+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 {
/**
* Constructs a new instanced mesh.
*
@@ -9754,9 +9754,9 @@ class n0 extends Jt {
* @param {number} count - The number of instances.
*/
constructor(e, t, n) {
- super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new dd(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 Ud(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, H_);
+ this.setMatrixAt(s, Cy);
}
/**
* Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}.
@@ -9765,9 +9765,9 @@ class n0 extends Jt {
*/
computeBoundingBox() {
const e = this.geometry, t = this.count;
- this.boundingBox === null && (this.boundingBox = new Pi()), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty();
+ 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, qr), kp.copy(e.boundingBox).applyMatrix4(qr), this.boundingBox.union(kp);
+ this.getMatrixAt(n, ia), uA.copy(e.boundingBox).applyMatrix4(ia), this.boundingBox.union(uA);
}
/**
* Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere}
@@ -9776,9 +9776,9 @@ class n0 extends Jt {
*/
computeBoundingSphere() {
const e = this.geometry, t = this.count;
- this.boundingSphere === null && (this.boundingSphere = new ki()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();
+ 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, qr), Za.copy(e.boundingSphere).applyMatrix4(qr), this.boundingSphere.union(Za);
+ this.getMatrixAt(n, ia), oo.copy(e.boundingSphere).applyMatrix4(ia), this.boundingSphere.union(oo);
}
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 n0 extends Jt {
}
raycast(e, t) {
const n = this.matrixWorld, s = this.count;
- if (Ja.geometry = this.geometry, Ja.material = this.material, Ja.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), Za.copy(this.boundingSphere), Za.applyMatrix4(n), e.ray.intersectsSphere(Za) !== !1))
+ 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))
for (let r = 0; r < s; r++) {
- this.getMatrixAt(r, qr), Pp.multiplyMatrices(n, qr), Ja.matrixWorld = Pp, Ja.raycast(e, Ic);
- for (let a = 0, o = Ic.length; a < o; a++) {
- const c = Ic[a];
+ 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];
c.instanceId = r, c.object = this, t.push(c);
}
- Ic.length = 0;
+ Gc.length = 0;
}
}
/**
@@ -9832,7 +9832,7 @@ class n0 extends Jt {
* @param {Color} color - The instance color.
*/
setColorAt(e, t) {
- this.instanceColor === null && (this.instanceColor = new dd(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3)), t.toArray(this.instanceColor.array, e * 3);
+ this.instanceColor === null && (this.instanceColor = new Ud(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 n0 extends Jt {
*/
setMorphAt(e, t) {
const n = t.morphTargetInfluences, s = n.length + 1;
- this.morphTexture === null && (this.morphTexture = new Hl(new Float32Array(s * this.count), s, this.count, ns, an));
+ this.morphTexture === null && (this.morphTexture = new uh(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,15 +9872,15 @@ class n0 extends Jt {
this.dispatchEvent({ type: "dispose" }), this.morphTexture !== null && (this.morphTexture.dispose(), this.morphTexture = null);
}
}
-const Lh = /* @__PURE__ */ new H(), z_ = /* @__PURE__ */ new H(), V_ = /* @__PURE__ */ new rt();
-class Rs {
+const au = /* @__PURE__ */ new G(), Sy = /* @__PURE__ */ new G(), Iy = /* @__PURE__ */ new at();
+class Us {
/**
* Constructs a new plane.
*
* @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.
* @param {number} [constant=0] - The signed distance from the origin to the plane.
*/
- constructor(e = new H(1, 0, 0), t = 0) {
+ constructor(e = new G(1, 0, 0), t = 0) {
this.isPlane = !0, this.normal = e, this.constant = t;
}
/**
@@ -9928,7 +9928,7 @@ class Rs {
* @return {Plane} A reference to this plane.
*/
setFromCoplanarPoints(e, t, n) {
- const s = Lh.subVectors(n, t).cross(z_.subVectors(e, t)).normalize();
+ const s = au.subVectors(n, t).cross(Sy.subVectors(e, t)).normalize();
return this.setFromNormalAndCoplanarPoint(s, e), this;
}
/**
@@ -9995,7 +9995,7 @@ class Rs {
* @return {?Vector3} The intersection point.
*/
intersectLine(e, t) {
- const n = e.delta(Lh), s = this.normal.dot(n);
+ const n = e.delta(au), 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 Rs {
* @return {Plane} A reference to this plane.
*/
applyMatrix4(e, t) {
- const n = t || V_.getNormalMatrix(e), s = this.coplanarPoint(Lh).applyMatrix4(e), r = this.normal.applyMatrix3(n).normalize();
+ const n = t || Iy.getNormalMatrix(e), s = this.coplanarPoint(au).applyMatrix4(e), r = this.normal.applyMatrix3(n).normalize();
return this.constant = -s.dot(r), this;
}
/**
@@ -10083,8 +10083,8 @@ class Rs {
return new this.constructor().copy(this);
}
}
-const Ys = /* @__PURE__ */ new ki(), Mc = /* @__PURE__ */ new H();
-class gf {
+const sr = /* @__PURE__ */ new zi(), Hc = /* @__PURE__ */ new G();
+class zf {
/**
* Constructs a new frustum.
*
@@ -10095,7 +10095,7 @@ class gf {
* @param {Plane} [p4] - The fifth plane that encloses the frustum.
* @param {Plane} [p5] - The sixth plane that encloses the frustum.
*/
- constructor(e = new Rs(), t = new Rs(), n = new Rs(), s = new Rs(), r = new Rs(), a = new Rs()) {
+ constructor(e = new Us(), t = new Us(), n = new Us(), s = new Us(), r = new Us(), a = new Us()) {
this.planes = [e, t, n, s, r, a];
}
/**
@@ -10132,12 +10132,12 @@ class gf {
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} coordinateSystem - The coordinate system.
* @return {Frustum} A reference to this frustum.
*/
- setFromProjectionMatrix(e, t = is) {
- 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], m = s[9], g = s[10], A = s[11], p = s[12], y = s[13], b = s[14], _ = s[15];
- if (n[0].setComponents(c - r, d - l, A - f, _ - p).normalize(), n[1].setComponents(c + r, d + l, A + f, _ + p).normalize(), n[2].setComponents(c + a, d + h, A + m, _ + y).normalize(), n[3].setComponents(c - a, d - h, A - m, _ - y).normalize(), n[4].setComponents(c - o, d - u, A - g, _ - b).normalize(), t === is)
- n[5].setComponents(c + o, d + u, A + g, _ + b).normalize();
- else if (t === vl)
- n[5].setComponents(o, u, g, b).normalize();
+ 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)
+ n[5].setComponents(c + o, d + u, g + m, E + x).normalize();
+ else if (t === Hl)
+ n[5].setComponents(o, u, m, x).normalize();
else
throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + t);
return this;
@@ -10152,12 +10152,12 @@ class gf {
*/
intersectsObject(e) {
if (e.boundingSphere !== void 0)
- e.boundingSphere === null && e.computeBoundingSphere(), Ys.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);
+ e.boundingSphere === null && e.computeBoundingSphere(), sr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);
else {
const t = e.geometry;
- t.boundingSphere === null && t.computeBoundingSphere(), Ys.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);
+ t.boundingSphere === null && t.computeBoundingSphere(), sr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);
}
- return this.intersectsSphere(Ys);
+ return this.intersectsSphere(sr);
}
/**
* Returns `true` if the given sprite is intersecting this frustum.
@@ -10166,7 +10166,7 @@ class gf {
* @return {boolean} Whether the sprite is intersecting this frustum or not.
*/
intersectsSprite(e) {
- return Ys.center.set(0, 0, 0), Ys.radius = 0.7071067811865476, Ys.applyMatrix4(e.matrixWorld), this.intersectsSphere(Ys);
+ return sr.center.set(0, 0, 0), sr.radius = 0.7071067811865476, sr.applyMatrix4(e.matrixWorld), this.intersectsSphere(sr);
}
/**
* Returns `true` if the given bounding sphere is intersecting this frustum.
@@ -10191,7 +10191,7 @@ class gf {
const t = this.planes;
for (let n = 0; n < 6; n++) {
const s = t[n];
- if (Mc.x = s.normal.x > 0 ? e.max.x : e.min.x, Mc.y = s.normal.y > 0 ? e.max.y : e.min.y, Mc.z = s.normal.z > 0 ? e.max.z : e.min.z, s.distanceToPoint(Mc) < 0)
+ 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)
return !1;
}
return !0;
@@ -10218,7 +10218,7 @@ class gf {
return new this.constructor().copy(this);
}
}
-class Xo extends Fi {
+class Wa extends ui {
/**
* Constructs a new line basic material.
*
@@ -10229,21 +10229,21 @@ class Xo extends Fi {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isLineBasicMaterial = !0, this.type = "LineBasicMaterial", this.color = new je(16777215), this.map = null, this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.fog = !0, this.setValues(e);
+ super(), this.isLineBasicMaterial = !0, this.type = "LineBasicMaterial", this.color = new Le(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 = /* @__PURE__ */ new H(), Sl = /* @__PURE__ */ new H(), Up = /* @__PURE__ */ new st(), $a = /* @__PURE__ */ new jo(), Bc = /* @__PURE__ */ new ki(), Ph = /* @__PURE__ */ new H(), Op = /* @__PURE__ */ new H();
-class mf extends kt {
+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 {
/**
* Constructs a new line.
*
* @param {BufferGeometry} [geometry] - The line geometry.
* @param {Material|Array<Material>} [material] - The line material.
*/
- constructor(e = new Hn(), t = new Xo()) {
+ constructor(e = new Tn(), t = new Wa()) {
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,8 +10261,8 @@ class mf extends kt {
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), Sl.fromBufferAttribute(t, s), n[s] = n[s - 1], n[s] += Cl.distanceTo(Sl);
- e.setAttribute("lineDistance", new kn(n, 1));
+ Vl.fromBufferAttribute(t, s - 1), Wl.fromBufferAttribute(t, s), n[s] = n[s - 1], n[s] += Vl.distanceTo(Wl);
+ e.setAttribute("lineDistance", new en(n, 1));
} else
console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
return this;
@@ -10275,28 +10275,28 @@ class mf extends kt {
*/
raycast(e, t) {
const n = this.geometry, s = this.matrixWorld, r = e.params.Line.threshold, a = n.drawRange;
- if (n.boundingSphere === null && n.computeBoundingSphere(), Bc.copy(n.boundingSphere), Bc.applyMatrix4(s), Bc.radius += r, e.ray.intersectsSphere(Bc) === !1) return;
- Up.copy(s).invert(), $a.copy(e.ray).applyMatrix4(Up);
+ 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);
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), m = Math.min(h.count, a.start + a.count);
- for (let g = f, A = m - 1; g < A; g += l) {
- const p = h.getX(g), y = h.getX(g + 1), b = Tc(this, e, $a, c, p, y, g);
- b && t.push(b);
+ 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);
+ x && t.push(x);
}
if (this.isLineLoop) {
- const g = h.getX(m - 1), A = h.getX(f), p = Tc(this, e, $a, c, g, A, m - 1);
- p && t.push(p);
+ const m = h.getX(p - 1), g = h.getX(f), A = Vc(this, e, co, c, m, g, p - 1);
+ A && t.push(A);
}
} else {
- const f = Math.max(0, a.start), m = Math.min(d.count, a.start + a.count);
- for (let g = f, A = m - 1; g < A; g += l) {
- const p = Tc(this, e, $a, c, g, g + 1, g);
- p && t.push(p);
+ 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);
+ A && t.push(A);
}
if (this.isLineLoop) {
- const g = Tc(this, e, $a, c, m - 1, f, m - 1);
- g && t.push(g);
+ const m = Vc(this, e, co, c, p - 1, f, p - 1);
+ m && t.push(m);
}
}
}
@@ -10318,17 +10318,17 @@ class mf extends kt {
}
}
}
-function Tc(i, e, t, n, s, r, a) {
+function Vc(i, e, t, n, s, r, a) {
const o = i.geometry.attributes.position;
- if (Cl.fromBufferAttribute(o, s), Sl.fromBufferAttribute(o, r), t.distanceSqToSegment(Cl, Sl, Ph, Op) > n) return;
- Ph.applyMatrix4(i.matrixWorld);
- const l = e.ray.origin.distanceTo(Ph);
+ 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 (!(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: Op.clone().applyMatrix4(i.matrixWorld),
+ point: fA.clone().applyMatrix4(i.matrixWorld),
index: a,
face: null,
faceIndex: null,
@@ -10336,8 +10336,8 @@ function Tc(i, e, t, n, s, r, a) {
object: i
};
}
-const Qp = /* @__PURE__ */ new H(), Gp = /* @__PURE__ */ new H();
-class zl extends mf {
+const pA = /* @__PURE__ */ new G(), AA = /* @__PURE__ */ new G();
+class ph extends fh {
/**
* Constructs a new line segments.
*
@@ -10352,14 +10352,14 @@ class zl extends mf {
if (e.index === null) {
const t = e.attributes.position, n = [];
for (let s = 0, r = t.count; s < r; s += 2)
- Qp.fromBufferAttribute(t, s), Gp.fromBufferAttribute(t, s + 1), n[s] = s === 0 ? 0 : n[s - 1], n[s + 1] = n[s] + Qp.distanceTo(Gp);
- e.setAttribute("lineDistance", new kn(n, 1));
+ 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);
+ e.setAttribute("lineDistance", new en(n, 1));
} else
console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
return this;
}
}
-class W_ extends mf {
+class My extends fh {
/**
* Constructs a new line loop.
*
@@ -10370,7 +10370,7 @@ class W_ extends mf {
super(e, t), this.isLineLoop = !0, this.type = "LineLoop";
}
}
-class bf extends Fi {
+class Vf extends ui {
/**
* Constructs a new points material.
*
@@ -10381,21 +10381,21 @@ class bf extends Fi {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isPointsMaterial = !0, this.type = "PointsMaterial", this.color = new je(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.fog = !0, this.setValues(e);
+ super(), this.isPointsMaterial = !0, this.type = "PointsMaterial", this.color = new Le(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 Hp = /* @__PURE__ */ new st(), fd = /* @__PURE__ */ new jo(), Rc = /* @__PURE__ */ new ki(), Nc = /* @__PURE__ */ new H();
-class q_ extends kt {
+const gA = /* @__PURE__ */ new De(), Od = /* @__PURE__ */ new lc(), Wc = /* @__PURE__ */ new zi(), qc = /* @__PURE__ */ new G();
+class By extends Tt {
/**
* Constructs a new point cloud.
*
* @param {BufferGeometry} [geometry] - The points geometry.
* @param {Material|Array<Material>} [material] - The points material.
*/
- constructor(e = new Hn(), t = new bf()) {
+ constructor(e = new Tn(), t = new Vf()) {
super(), this.isPoints = !0, this.type = "Points", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets();
}
copy(e, t) {
@@ -10409,19 +10409,19 @@ class q_ extends kt {
*/
raycast(e, t) {
const n = this.geometry, s = this.matrixWorld, r = e.params.Points.threshold, a = n.drawRange;
- if (n.boundingSphere === null && n.computeBoundingSphere(), Rc.copy(n.boundingSphere), Rc.applyMatrix4(s), Rc.radius += r, e.ray.intersectsSphere(Rc) === !1) return;
- Hp.copy(s).invert(), fd.copy(e.ray).applyMatrix4(Hp);
+ 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);
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 m = d, g = f; m < g; m++) {
- const A = l.getX(m);
- Nc.fromBufferAttribute(u, A), zp(Nc, A, c, s, e, t, this);
+ 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);
}
} else {
const d = Math.max(0, a.start), f = Math.min(u.count, a.start + a.count);
- for (let m = d, g = f; m < g; m++)
- Nc.fromBufferAttribute(u, m), zp(Nc, m, c, s, e, t, this);
+ for (let p = d, m = f; p < m; p++)
+ qc.fromBufferAttribute(u, p), mA(qc, p, c, s, e, t, this);
}
}
/**
@@ -10442,11 +10442,11 @@ class q_ extends kt {
}
}
}
-function zp(i, e, t, n, s, r, a) {
- const o = fd.distanceSqToPoint(i);
+function mA(i, e, t, n, s, r, a) {
+ const o = Od.distanceSqToPoint(i);
if (o < t) {
- const c = new H();
- fd.closestPointToPoint(i, c), c.applyMatrix4(n);
+ const c = new G();
+ Od.closestPointToPoint(i, c), c.applyMatrix4(n);
const l = s.ray.origin.distanceTo(c);
if (l < s.near || l > s.far) return;
r.push({
@@ -10461,7 +10461,7 @@ function zp(i, e, t, n, s, r, a) {
});
}
}
-class Vl extends cn {
+class Ah extends an {
/**
* Constructs a new compressed texture.
*
@@ -10483,7 +10483,7 @@ class Vl extends cn {
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 K_ extends Vl {
+class Ty extends Ah {
/**
* Constructs a new compressed array texture.
*
@@ -10496,7 +10496,7 @@ class K_ extends Vl {
* @param {number} [type=UnsignedByteType] - The min filter value.
*/
constructor(e, t, n, s, r, a) {
- super(e, t, n, r, a), this.isCompressedArrayTexture = !0, this.image.depth = s, this.wrapR = xi, this.layerUpdates = /* @__PURE__ */ new Set();
+ super(e, t, n, r, a), this.isCompressedArrayTexture = !0, this.image.depth = s, this.wrapR = ti, this.layerUpdates = /* @__PURE__ */ new Set();
}
/**
* Describes that a specific layer of the texture needs to be updated.
@@ -10517,7 +10517,7 @@ class K_ extends Vl {
this.layerUpdates.clear();
}
}
-class j_ extends Vl {
+class Ry extends Ah {
/**
* Constructs a new compressed texture.
*
@@ -10526,10 +10526,10 @@ class j_ extends Vl {
* @param {number} [type=UnsignedByteType] - The texture type.
*/
constructor(e, t, n) {
- super(void 0, e[0].width, e[0].height, t, n, br), this.isCompressedCubeTexture = !0, this.isCubeTexture = !0, this.image = e;
+ super(void 0, e[0].width, e[0].height, t, n, Sr), this.isCompressedCubeTexture = !0, this.isCubeTexture = !0, this.image = e;
}
}
-class i0 extends cn {
+class F0 extends an {
/**
* Constructs a new depth texture.
*
@@ -10544,20 +10544,602 @@ class i0 extends cn {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {number} [format=DepthFormat] - The texture format.
*/
- constructor(e, t, n = xr, s, r, a, o = Pn, c = Pn, l, h = Bo) {
- if (h !== Bo && h !== To)
+ constructor(e, t, n = Ir, s, r, a, o = Wn, c = Wn, l, h = Qo) {
+ if (h !== Qo && h !== Go)
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 ff(Object.assign({}, e.image)), this.compareFunction = e.compareFunction, this;
+ return super.copy(e), this.source = new Qf(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 Wl extends Hn {
+class Fy {
+ /**
+ * Constructs a new curve.
+ */
+ constructor() {
+ this.type = "Curve", this.arcLengthDivisions = 200, this.needsUpdate = !1, this.cacheArcLengths = null;
+ }
+ /**
+ * This method returns a vector in 2D or 3D space (depending on the curve definition)
+ * for the given interpolation factor.
+ *
+ * @abstract
+ * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
+ * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
+ */
+ getPoint() {
+ console.warn("THREE.Curve: .getPoint() not implemented.");
+ }
+ /**
+ * This method returns a vector in 2D or 3D space (depending on the curve definition)
+ * for the given interpolation factor. Unlike {@link Curve#getPoint}, this method honors the length
+ * of the curve which equidistant samples.
+ *
+ * @param {number} u - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
+ * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
+ */
+ getPointAt(e, t) {
+ const n = this.getUtoTmapping(e);
+ return this.getPoint(n, t);
+ }
+ /**
+ * This method samples the curve via {@link Curve#getPoint} and returns an array of points representing
+ * the curve shape.
+ *
+ * @param {number} [divisions=5] - The number of divisions.
+ * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`.
+ */
+ getPoints(e = 5) {
+ const t = [];
+ for (let n = 0; n <= e; n++)
+ t.push(this.getPoint(n / e));
+ return t;
+ }
+ // Get sequence of points using getPointAt( u )
+ /**
+ * This method samples the curve via {@link Curve#getPointAt} and returns an array of points representing
+ * the curve shape. Unlike {@link Curve#getPoints}, this method returns equi-spaced points across the entire
+ * curve.
+ *
+ * @param {number} [divisions=5] - The number of divisions.
+ * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`.
+ */
+ getSpacedPoints(e = 5) {
+ const t = [];
+ for (let n = 0; n <= e; n++)
+ t.push(this.getPointAt(n / e));
+ return t;
+ }
+ /**
+ * Returns the total arc length of the curve.
+ *
+ * @return {number} The length of the curve.
+ */
+ getLength() {
+ const e = this.getLengths();
+ return e[e.length - 1];
+ }
+ /**
+ * Returns an array of cumulative segment lengths of the curve.
+ *
+ * @param {number} [divisions=this.arcLengthDivisions] - The number of divisions.
+ * @return {Array<number>} An array holding the cumulative segment lengths.
+ */
+ 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;
+ }
+ /**
+ * Update the cumulative segment distance cache. The method must be called
+ * every time curve parameters are changed. If an updated curve is part of a
+ * composed curve like {@link CurvePath}, this method must be called on the
+ * composed curve, too.
+ */
+ updateArcLengths() {
+ this.needsUpdate = !0, this.getLengths();
+ }
+ /**
+ * Given an interpolation factor in the range `[0,1]`, this method returns an updated
+ * interpolation factor in the same range that can be ued to sample equidistant points
+ * from a curve.
+ *
+ * @param {number} u - The interpolation factor.
+ * @param {?number} distance - An optional distance on the curve.
+ * @return {number} The updated interpolation factor.
+ */
+ 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);
+ }
+ /**
+ * Returns a unit vector tangent for the given interpolation factor.
+ * If the derived curve does not implement its tangent derivation,
+ * two points a small delta apart will be used to find its gradient
+ * which seems to give a reasonable approximation.
+ *
+ * @param {number} t - The interpolation factor.
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
+ * @return {(Vector2|Vector3)} The tangent vector.
+ */
+ 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 Ze() : new G());
+ return c.copy(o).sub(a).normalize(), c;
+ }
+ /**
+ * Same as {@link Curve#getTangent} but with equidistant samples.
+ *
+ * @param {number} u - The interpolation factor.
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
+ * @return {(Vector2|Vector3)} The tangent vector.
+ * @see {@link Curve#getPointAt}
+ */
+ getTangentAt(e, t) {
+ const n = this.getUtoTmapping(e);
+ return this.getTangent(n, t);
+ }
+ /**
+ * Generates the Frenet Frames. Requires a curve definition in 3D space. Used
+ * in geometries like {@link TubeGeometry} or {@link ExtrudeGeometry}.
+ *
+ * @param {number} segments - The number of segments.
+ * @param {boolean} [closed=false] - Whether the curve is closed or not.
+ * @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();
+ 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(ot(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(ot(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
+ };
+ }
+ /**
+ * Returns a new curve with copied values from this instance.
+ *
+ * @return {Curve} A clone of this instance.
+ */
+ clone() {
+ return new this.constructor().copy(this);
+ }
+ /**
+ * Copies the values of the given curve to this instance.
+ *
+ * @param {Curve} source - The curve to copy.
+ * @return {Curve} A reference to this curve.
+ */
+ copy(e) {
+ return this.arcLengthDivisions = e.arcLengthDivisions, this;
+ }
+ /**
+ * Serializes the curve into JSON.
+ *
+ * @return {Object} A JSON object representing the serialized curve.
+ * @see {@link ObjectLoader#parse}
+ */
+ toJSON() {
+ const e = {
+ metadata: {
+ version: 4.6,
+ type: "Curve",
+ generator: "Curve.toJSON"
+ }
+ };
+ return e.arcLengthDivisions = this.arcLengthDivisions, e.type = this.type, e;
+ }
+ /**
+ * Deserializes the curve from the given JSON.
+ *
+ * @param {Object} json - The JSON holding the serialized curve.
+ * @return {Curve} A reference to this curve.
+ */
+ fromJSON(e) {
+ return this.arcLengthDivisions = e.arcLengthDivisions, this;
+ }
+}
+function Dy(i, e, t = 2) {
+ const n = e && e.length, s = n ? e[0] * t : i.length;
+ let r = D0(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) {
+ 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 Ko(r, a, t, o, c, l, 0), a;
+}
+function D0(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);
+ 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;
+}
+function Br(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;
+ n = !0;
+ } else
+ t = t.next;
+ while (n || t !== e);
+ return e;
+}
+function Ko(i, e, t, n, s, r, a) {
+ if (!i) return;
+ !a && r && zy(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;
+ 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);
+ break;
+ }
+ }
+}
+function Ny(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;
+ p = p.next;
+ }
+ return !0;
+}
+function Ly(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);
+ 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;
+ 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;
+ 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;
+ E = E.nextZ;
+ }
+ return !0;
+}
+function Py(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;
+ } while (t !== i);
+ return Br(t);
+}
+function ky(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);
+ return;
+ }
+ o = o.next;
+ }
+ a = a.next;
+ } while (a !== i);
+}
+function Uy(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));
+ }
+ s.sort(Oy);
+ for (let r = 0; r < s.length; r++)
+ t = Qy(s[r], t);
+ return t;
+}
+function Oy(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 Qy(i, e) {
+ const t = Gy(i, e);
+ if (!t)
+ return e;
+ const n = P0(t, i);
+ return Br(n, n.next), Br(t, t.next);
+}
+function Gy(i, e) {
+ let t = e;
+ const n = i.x, s = i.y;
+ let r = -1 / 0, a;
+ if (Pa(i, t)) return t;
+ do {
+ if (Pa(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 && N0(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);
+ }
+ t = t.next;
+ } while (t !== o);
+ return a;
+}
+function Hy(i, e) {
+ return Wt(i.prev, i, e.prev) < 0 && Wt(e.next, i, i.next) < 0;
+}
+function zy(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;
+ while (s !== i);
+ s.prevZ.nextZ = null, s.prevZ = null, Vy(s);
+}
+function Vy(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 Qd(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) {
+ 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) {
+ 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 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
+ (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);
+}
+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) {
+ 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 Kc(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) {
+ return i > 0 ? 1 : i < 0 ? -1 : 0;
+}
+function Ky(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;
+ t = t.next;
+ } while (t !== i);
+ return !1;
+}
+function jo(i, e) {
+ return Wt(i.prev, i, i.next) < 0 ? Wt(i, e, i.next) >= 0 && Wt(i, i.prev, e) >= 0 : Wt(i, e, i.prev) < 0 || Wt(i, i.next, e) < 0;
+}
+function jy(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 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;
+ 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);
+ 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) {
+ 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) {
+ return {
+ i,
+ // vertex index in coordinates array
+ x: e,
+ y: t,
+ // vertex coordinates
+ prev: null,
+ // previous and next vertex nodes in a polygon ring
+ next: null,
+ z: 0,
+ // z-order curve value
+ prevZ: null,
+ // previous and next nodes in z-order
+ nextZ: null,
+ steiner: !1
+ // indicates whether this is a steiner point
+ };
+}
+function Xy(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 {
+ /**
+ * Triangulates the given shape definition by returning an array of triangles.
+ *
+ * @param {Array<number>} data - An array with 2D points.
+ * @param {Array<number>} holeIndices - An array with indices defining holes.
+ * @param {number} [dim=2] - The number of coordinates per vertex in the input array.
+ * @return {Array<number>} An array representing the triangulated faces. Each face is defined by three consecutive numbers
+ * representing vertex indices.
+ */
+ static triangulate(e, t, n = 2) {
+ return Dy(e, t, n);
+ }
+}
+class Wf {
+ /**
+ * Calculate area of a ( 2D ) contour polygon.
+ *
+ * @param {Array<Vector2>} contour - An array of 2D points.
+ * @return {number} The area.
+ */
+ 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 * 0.5;
+ }
+ /**
+ * Returns `true` if the given contour uses a clockwise winding order.
+ *
+ * @param {Array<Vector2>} pts - An array of 2D points defining a polygon.
+ * @return {boolean} Whether the given contour uses a clockwise winding order or not.
+ */
+ static isClockWise(e) {
+ return Wf.area(e) < 0;
+ }
+ /**
+ * Triangulates the given shape definition.
+ *
+ * @param {Array<Vector2>} contour - An array of 2D points defining the contour.
+ * @param {Array<Array<Vector2>>} holes - An array that holds arrays of 2D points defining the holes.
+ * @return {Array<Array<number>>} An array that holds for each face definition an array with three indices.
+ */
+ static triangulateShape(e, t) {
+ const n = [], s = [], r = [];
+ bA(e), EA(n, e);
+ let a = e.length;
+ t.forEach(bA);
+ 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);
+ for (let c = 0; c < o.length; c += 3)
+ r.push(o.slice(c, c + 3));
+ return r;
+ }
+}
+function bA(i) {
+ const e = i.length;
+ e > 2 && i[e - 1].equals(i[0]) && i.pop();
+}
+function EA(i, e) {
+ for (let t = 0; t < e.length; t++)
+ i.push(e[t].x), i.push(e[t].y);
+}
+class gh extends Tn {
/**
* Constructs a new plane geometry.
*
@@ -10573,20 +11155,20 @@ class Wl extends Hn {
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 = [], m = [], g = [], A = [];
- for (let p = 0; p < h; p++) {
- const y = p * d - a;
- for (let b = 0; b < l; b++) {
- const _ = b * u - r;
- m.push(_, -y, 0), g.push(0, 0, 1), A.push(b / o), A.push(1 - p / c);
+ 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;
+ 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);
}
}
- for (let p = 0; p < c; p++)
+ for (let A = 0; A < c; A++)
for (let y = 0; y < o; y++) {
- const b = y + l * p, _ = y + l * (p + 1), M = y + 1 + l * (p + 1), w = y + 1 + l * p;
- f.push(b, _, w), f.push(_, M, w);
+ 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);
}
- this.setIndex(f), this.setAttribute("position", new kn(m, 3)), this.setAttribute("normal", new kn(g, 3)), this.setAttribute("uv", new kn(A, 2));
+ this.setIndex(f), this.setAttribute("position", new en(p, 3)), this.setAttribute("normal", new en(m, 3)), this.setAttribute("uv", new en(g, 2));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
@@ -10599,10 +11181,10 @@ class Wl extends Hn {
* @return {PlaneGeometry} A new instance.
*/
static fromJSON(e) {
- return new Wl(e.width, e.height, e.widthSegments, e.heightSegments);
+ return new gh(e.width, e.height, e.widthSegments, e.heightSegments);
}
}
-class Po extends Fi {
+class Yo extends ui {
/**
* Constructs a new mesh standard material.
*
@@ -10613,13 +11195,13 @@ class Po extends Fi {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshStandardMaterial = !0, this.type = "MeshStandardMaterial", this.defines = { STANDARD: "" }, this.color = new je(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 je(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Hm, 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 Di(), 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 = 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);
}
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 Po {
+class Vi extends Yo {
/**
* Constructs a new mesh physical material.
*
@@ -10635,12 +11217,12 @@ class Ui extends Po {
PHYSICAL: ""
}, this.type = "MeshPhysicalMaterial", this.anisotropyRotation = 0, this.anisotropyMap = null, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new Ze(1, 1), this.clearcoatNormalMap = null, this.ior = 1.5, Object.defineProperty(this, "reflectivity", {
get: function() {
- return ct(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);
+ return ot(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);
},
set: function(t) {
this.ior = (1 + 0.4 * t) / (1 - 0.4 * t);
}
- }), this.iridescenceMap = null, this.iridescenceIOR = 1.3, this.iridescenceThicknessRange = [100, 400], this.iridescenceThicknessMap = null, this.sheenColor = new je(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 je(1, 1, 1), this.specularIntensity = 1, this.specularIntensityMap = null, this.specularColor = new je(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);
+ }), this.iridescenceMap = null, this.iridescenceIOR = 1.3, this.iridescenceThicknessRange = [100, 400], this.iridescenceThicknessMap = null, this.sheenColor = new Le(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 Le(1, 1, 1), this.specularIntensity = 1, this.specularIntensityMap = null, this.specularColor = new Le(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);
}
/**
* The anisotropy strength.
@@ -10732,7 +11314,41 @@ class Ui extends Po {
}, 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 X_ extends Fi {
+class Xc extends ui {
+ /**
+ * Constructs a new mesh phong material.
+ *
+ * @param {Object} [parameters] - An object with one or more properties
+ * defining the material's appearance. Any property of the material
+ * (including any property from inherited materials) can be passed
+ * in here. Color values can be passed any type of value accepted
+ * 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);
+ }
+ 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 {
+ /**
+ * Constructs a new mesh lambert material.
+ *
+ * @param {Object} [parameters] - An object with one or more properties
+ * defining the material's appearance. Any property of the material
+ * (including any property from inherited materials) can be passed
+ * in here. Color values can be passed any type of value accepted
+ * 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);
+ }
+ 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 {
/**
* Constructs a new mesh depth material.
*
@@ -10743,13 +11359,13 @@ class X_ extends Fi {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = PE, 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 = 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);
}
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 Fi {
+class $y extends ui {
/**
* Constructs a new mesh distance material.
*
@@ -10766,13 +11382,13 @@ class Y_ extends Fi {
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 Fc(i, e) {
+function Yc(i, e) {
return !i || i.constructor === e ? i : typeof e.BYTES_PER_ELEMENT == "number" ? new e(i) : Array.prototype.slice.call(i);
}
-function J_(i) {
+function ew(i) {
return ArrayBuffer.isView(i) && !(i instanceof DataView);
}
-function Z_(i) {
+function tw(i) {
function e(s, r) {
return i[s] - i[r];
}
@@ -10780,7 +11396,7 @@ function Z_(i) {
for (let s = 0; s !== t; ++s) n[s] = s;
return n.sort(e), n;
}
-function Vp(i, e, t) {
+function _A(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;
@@ -10789,7 +11405,7 @@ function Vp(i, e, t) {
}
return s;
}
-function s0(i, e, t, n) {
+function k0(i, e, t, n) {
let s = 1, r = i[0];
for (; r !== void 0 && r[n] === void 0; )
r = i[s++];
@@ -10809,7 +11425,7 @@ function s0(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 Yo {
+class hc {
/**
* Constructs a new interpolant.
*
@@ -10918,7 +11534,7 @@ class Yo {
intervalChanged_() {
}
}
-class $_ extends Yo {
+class nw extends hc {
/**
* Constructs a new cubic interpolant.
*
@@ -10929,8 +11545,8 @@ class $_ extends Yo {
*/
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: na,
- endingEnd: na
+ endingStart: pa,
+ endingEnd: pa
};
}
intervalChanged_(e, t, n) {
@@ -10938,10 +11554,10 @@ class $_ extends Yo {
let r = e - 2, a = e + 1, o = s[r], c = s[a];
if (o === void 0)
switch (this.getSettings_().endingStart) {
- case ia:
+ case Aa:
r = e, o = 2 * t - n;
break;
- case yl:
+ case Ql:
r = s.length - 2, o = t + s[r] - s[r + 1];
break;
default:
@@ -10949,10 +11565,10 @@ class $_ extends Yo {
}
if (c === void 0)
switch (this.getSettings_().endingEnd) {
- case ia:
+ case Aa:
a = e, c = 2 * n - t;
break;
- case yl:
+ case Ql:
a = 1, c = n + s[1] - s[0];
break;
default:
@@ -10962,13 +11578,13 @@ class $_ extends Yo {
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, m = (n - t) / (s - t), g = m * m, A = g * m, p = -d * A + 2 * d * g - d * m, y = (1 + d) * A + (-1.5 - 2 * d) * g + (-0.5 + d) * m + 1, b = (-1 - f) * A + (1.5 + f) * g + 0.5 * m, _ = f * A - f * g;
- for (let M = 0; M !== o; ++M)
- r[M] = p * a[h + M] + y * a[l + M] + b * a[c + M] + _ * a[u + M];
+ 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];
return r;
}
}
-class r0 extends Yo {
+class U0 extends hc {
/**
* Constructs a new linear interpolant.
*
@@ -10987,7 +11603,7 @@ class r0 extends Yo {
return r;
}
}
-class ey extends Yo {
+class iw extends hc {
/**
* Constructs a new discrete interpolant.
*
@@ -11003,7 +11619,7 @@ class ey extends Yo {
return this.copySampleValue_(e - 1);
}
}
-class _i {
+class Bi {
/**
* Constructs a new keyframe track.
*
@@ -11015,7 +11631,7 @@ class _i {
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 = Fc(t, this.TimeBufferType), this.values = Fc(n, this.ValueBufferType), this.setInterpolation(s || this.DefaultInterpolation);
+ this.name = e, this.times = Yc(t, this.TimeBufferType), this.values = Yc(n, this.ValueBufferType), this.setInterpolation(s || this.DefaultInterpolation);
}
/**
* Converts the keyframe track to JSON.
@@ -11032,8 +11648,8 @@ class _i {
else {
n = {
name: e.name,
- times: Fc(e.times, Array),
- values: Fc(e.values, Array)
+ times: Yc(e.times, Array),
+ values: Yc(e.values, Array)
};
const s = e.getInterpolation();
s !== e.DefaultInterpolation && (n.interpolation = s);
@@ -11048,7 +11664,7 @@ class _i {
* @return {DiscreteInterpolant} The new interpolant.
*/
InterpolantFactoryMethodDiscrete(e) {
- return new ey(this.times, this.values, this.getValueSize(), e);
+ return new iw(this.times, this.values, this.getValueSize(), e);
}
/**
* Factory method for creating a new linear interpolant.
@@ -11058,7 +11674,7 @@ class _i {
* @return {LinearInterpolant} The new interpolant.
*/
InterpolantFactoryMethodLinear(e) {
- return new r0(this.times, this.values, this.getValueSize(), e);
+ return new U0(this.times, this.values, this.getValueSize(), e);
}
/**
* Factory method for creating a new smooth interpolant.
@@ -11068,7 +11684,7 @@ class _i {
* @return {CubicInterpolant} The new interpolant.
*/
InterpolantFactoryMethodSmooth(e) {
- return new $_(this.times, this.values, this.getValueSize(), e);
+ return new nw(this.times, this.values, this.getValueSize(), e);
}
/**
* Defines the interpolation factor method for this keyframe track.
@@ -11079,13 +11695,13 @@ class _i {
setInterpolation(e) {
let t;
switch (e) {
- case Fo:
+ case Vo:
t = this.InterpolantFactoryMethodDiscrete;
break;
- case Do:
+ case Wo:
t = this.InterpolantFactoryMethodLinear;
break;
- case dh:
+ case kh:
t = this.InterpolantFactoryMethodSmooth;
break;
}
@@ -11108,11 +11724,11 @@ class _i {
getInterpolation() {
switch (this.createInterpolant) {
case this.InterpolantFactoryMethodDiscrete:
- return Fo;
+ return Vo;
case this.InterpolantFactoryMethodLinear:
- return Do;
+ return Wo;
case this.InterpolantFactoryMethodSmooth:
- return dh;
+ return kh;
}
}
/**
@@ -11200,7 +11816,7 @@ class _i {
}
a = c;
}
- if (s !== void 0 && J_(s))
+ if (s !== void 0 && ew(s))
for (let o = 0, c = s.length; o !== c; ++o) {
const l = s[o];
if (isNaN(l)) {
@@ -11217,7 +11833,7 @@ class _i {
* @return {AnimationClip} A reference to this animation clip.
*/
optimize() {
- const e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), s = this.getInterpolation() === dh, r = e.length - 1;
+ const e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), s = this.getInterpolation() === kh, r = e.length - 1;
let a = 1;
for (let o = 1; o < r; ++o) {
let c = !1;
@@ -11227,9 +11843,9 @@ class _i {
c = !0;
else {
const u = o * n, d = u - n, f = u + n;
- for (let m = 0; m !== n; ++m) {
- const g = t[u + m];
- if (g !== t[d + m] || g !== t[f + m]) {
+ for (let p = 0; p !== n; ++p) {
+ const m = t[u + p];
+ if (m !== t[d + p] || m !== t[f + p]) {
c = !0;
break;
}
@@ -11263,11 +11879,11 @@ class _i {
return s.createInterpolant = this.createInterpolant, s;
}
}
-_i.prototype.ValueTypeName = "";
-_i.prototype.TimeBufferType = Float32Array;
-_i.prototype.ValueBufferType = Float32Array;
-_i.prototype.DefaultInterpolation = Do;
-class ka extends _i {
+Bi.prototype.ValueTypeName = "";
+Bi.prototype.TimeBufferType = Float32Array;
+Bi.prototype.ValueBufferType = Float32Array;
+Bi.prototype.DefaultInterpolation = Wo;
+class qa extends Bi {
/**
* Constructs a new boolean keyframe track.
*
@@ -11282,12 +11898,12 @@ class ka extends _i {
super(e, t, n);
}
}
-ka.prototype.ValueTypeName = "bool";
-ka.prototype.ValueBufferType = Array;
-ka.prototype.DefaultInterpolation = Fo;
-ka.prototype.InterpolantFactoryMethodLinear = void 0;
-ka.prototype.InterpolantFactoryMethodSmooth = void 0;
-class a0 extends _i {
+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 {
/**
* Constructs a new color keyframe track.
*
@@ -11300,8 +11916,8 @@ class a0 extends _i {
super(e, t, n, s);
}
}
-a0.prototype.ValueTypeName = "color";
-class Sa extends _i {
+O0.prototype.ValueTypeName = "color";
+class Tr extends Bi {
/**
* Constructs a new number keyframe track.
*
@@ -11314,8 +11930,8 @@ class Sa extends _i {
super(e, t, n, s);
}
}
-Sa.prototype.ValueTypeName = "number";
-class ty extends Yo {
+Tr.prototype.ValueTypeName = "number";
+class sw extends hc {
/**
* Constructs a new SLERP interpolant.
*
@@ -11331,11 +11947,11 @@ class ty extends Yo {
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)
- Xn.slerpFlat(r, 0, a, l - o, a, l, c);
+ Jt.slerpFlat(r, 0, a, l - o, a, l, c);
return r;
}
}
-class Ia extends _i {
+class Ks extends Bi {
/**
* Constructs a new Quaternion keyframe track.
*
@@ -11355,12 +11971,12 @@ class Ia extends _i {
* @return {QuaternionLinearInterpolant} The new interpolant.
*/
InterpolantFactoryMethodLinear(e) {
- return new ty(this.times, this.values, this.getValueSize(), e);
+ return new sw(this.times, this.values, this.getValueSize(), e);
}
}
-Ia.prototype.ValueTypeName = "quaternion";
-Ia.prototype.InterpolantFactoryMethodSmooth = void 0;
-class Ua extends _i {
+Ks.prototype.ValueTypeName = "quaternion";
+Ks.prototype.InterpolantFactoryMethodSmooth = void 0;
+class Ka extends Bi {
/**
* Constructs a new string keyframe track.
*
@@ -11375,12 +11991,12 @@ class Ua extends _i {
super(e, t, n);
}
}
-Ua.prototype.ValueTypeName = "string";
-Ua.prototype.ValueBufferType = Array;
-Ua.prototype.DefaultInterpolation = Fo;
-Ua.prototype.InterpolantFactoryMethodLinear = void 0;
-Ua.prototype.InterpolantFactoryMethodSmooth = void 0;
-class Ma extends _i {
+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 {
/**
* Constructs a new vector keyframe track.
*
@@ -11393,8 +12009,8 @@ class Ma extends _i {
super(e, t, n, s);
}
}
-Ma.prototype.ValueTypeName = "vector";
-class pd {
+Rr.prototype.ValueTypeName = "vector";
+class ql {
/**
* Constructs a new animation clip.
*
@@ -11409,8 +12025,8 @@ class pd {
* @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) {
- this.name = e, this.tracks = n, this.duration = t, this.blendMode = s, this.uuid = Ei(), this.duration < 0 && this.resetDuration();
+ constructor(e = "", t = -1, n = [], s = Uf) {
+ this.name = e, this.tracks = n, this.duration = t, this.blendMode = s, this.uuid = Mi(), this.duration < 0 && this.resetDuration();
}
/**
* Factory method for creating an animation clip from the given JSON.
@@ -11422,7 +12038,7 @@ class pd {
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(iy(n[a]).scale(s));
+ t.push(aw(n[a]).scale(s));
const r = new this(e.name, e.duration, t, e.blendMode);
return r.uuid = e.uuid, r;
}
@@ -11442,7 +12058,7 @@ class pd {
blendMode: e.blendMode
};
for (let r = 0, a = n.length; r !== a; ++r)
- t.push(_i.toJSON(n[r]));
+ t.push(Bi.toJSON(n[r]));
return s;
}
/**
@@ -11468,9 +12084,9 @@ class pd {
o,
(o + 1) % r
), l.push(0, 1, 0);
- const h = Z_(c);
- c = Vp(c, 1, h), l = Vp(l, 1, h), !s && c[0] === 0 && (c.push(r), l.push(l[0])), a.push(
- new Sa(
+ 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(
".morphTargetInfluences[" + t[o].name + "]",
c,
l
@@ -11540,10 +12156,10 @@ class pd {
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, m, g) {
+ const n = function(u, d, f, p, m) {
if (f.length !== 0) {
- const A = [], p = [];
- s0(f, A, p, m), A.length !== 0 && g.push(new u(d, A, p));
+ const g = [], A = [];
+ k0(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;
@@ -11553,36 +12169,36 @@ class pd {
if (!(!d || d.length === 0))
if (d[0].morphTargets) {
const f = {};
- let m;
- for (m = 0; m < d.length; m++)
- if (d[m].morphTargets)
- for (let g = 0; g < d[m].morphTargets.length; g++)
- f[d[m].morphTargets[g]] = -1;
- for (const g in f) {
- const A = [], p = [];
- for (let y = 0; y !== d[m].morphTargets.length; ++y) {
- const b = d[m];
- A.push(b.time), p.push(b.morphTarget === g ? 1 : 0);
+ 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 y = 0; y !== d[p].morphTargets.length; ++y) {
+ const x = d[p];
+ g.push(x.time), A.push(x.morphTarget === m ? 1 : 0);
}
- s.push(new Sa(".morphTargetInfluence[" + g + "]", A, p));
+ s.push(new Tr(".morphTargetInfluence[" + m + "]", g, A));
}
c = f.length * a;
} else {
const f = ".bones[" + t[u].name + "]";
n(
- Ma,
+ Rr,
f + ".position",
d,
"pos",
s
), n(
- Ia,
+ Ks,
f + ".quaternion",
d,
"rot",
s
), n(
- Ma,
+ Rr,
f + ".scale",
d,
"scl",
@@ -11659,42 +12275,42 @@ class pd {
return this.constructor.toJSON(this);
}
}
-function ny(i) {
+function rw(i) {
switch (i.toLowerCase()) {
case "scalar":
case "double":
case "float":
case "number":
case "integer":
- return Sa;
+ return Tr;
case "vector":
case "vector2":
case "vector3":
case "vector4":
- return Ma;
+ return Rr;
case "color":
- return a0;
+ return O0;
case "quaternion":
- return Ia;
+ return Ks;
case "bool":
case "boolean":
- return ka;
+ return qa;
case "string":
- return Ua;
+ return Ka;
}
throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + i);
}
-function iy(i) {
+function aw(i) {
if (i.type === void 0)
throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");
- const e = ny(i.type);
+ const e = rw(i.type);
if (i.times === void 0) {
const t = [], n = [];
- s0(i.keys, t, n, "value"), i.times = t, i.values = n;
+ k0(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 = {
+const us = {
/**
* Whether caching is enabled or not.
*
@@ -11750,7 +12366,7 @@ const ss = {
this.files = {};
}
};
-class o0 {
+class Q0 {
/**
* Constructs a new loading manager.
*
@@ -11779,23 +12395,23 @@ class o0 {
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], m = l[u + 1];
+ const f = l[u], p = l[u + 1];
if (f.global && (f.lastIndex = 0), f.test(h))
- return m;
+ return p;
}
return null;
};
}
}
-const sy = /* @__PURE__ */ new o0();
-class ps {
+const ow = /* @__PURE__ */ new Q0();
+class fi {
/**
* Constructs a new loader.
*
* @param {LoadingManager} [manager] - The loading manager.
*/
constructor(e) {
- this.manager = e !== void 0 ? e : sy, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
+ this.manager = e !== void 0 ? e : ow, 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
@@ -11880,14 +12496,14 @@ class ps {
return this.requestHeader = e, this;
}
}
-ps.DEFAULT_MATERIAL_NAME = "__DEFAULT";
-const qi = {};
-class ry extends Error {
+fi.DEFAULT_MATERIAL_NAME = "__DEFAULT";
+const Zi = {};
+class cw extends Error {
constructor(e, t) {
super(e), this.response = t;
}
}
-class Ps extends ps {
+class As extends fi {
/**
* Constructs a new file loader.
*
@@ -11907,20 +12523,20 @@ class Ps extends ps {
*/
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);
+ const r = us.get(e);
if (r !== void 0)
return this.manager.itemStart(e), setTimeout(() => {
t && t(r), this.manager.itemEnd(e);
}, 0), r;
- if (qi[e] !== void 0) {
- qi[e].push({
+ if (Zi[e] !== void 0) {
+ Zi[e].push({
onLoad: t,
onProgress: n,
onError: s
});
return;
}
- qi[e] = [], qi[e].push({
+ Zi[e] = [], Zi[e].push({
onLoad: t,
onProgress: n,
onError: s
@@ -11934,33 +12550,33 @@ class Ps extends ps {
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 = qi[e], u = l.body.getReader(), d = l.headers.get("X-File-Size") || l.headers.get("Content-Length"), f = d ? parseInt(d) : 0, m = f !== 0;
- let g = 0;
- const A = new ReadableStream({
- start(p) {
+ const h = Zi[e], u = l.body.getReader(), d = l.headers.get("X-File-Size") || l.headers.get("Content-Length"), f = d ? parseInt(d) : 0, p = f !== 0;
+ let m = 0;
+ const g = new ReadableStream({
+ start(A) {
y();
function y() {
- u.read().then(({ done: b, value: _ }) => {
- if (b)
- p.close();
+ u.read().then(({ done: x, value: E }) => {
+ if (x)
+ A.close();
else {
- g += _.byteLength;
- const M = new ProgressEvent("progress", { lengthComputable: m, loaded: g, total: f });
+ 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(M);
+ T.onProgress && T.onProgress(I);
}
- p.enqueue(_), y();
+ A.enqueue(E), y();
}
- }, (b) => {
- p.error(b);
+ }, (x) => {
+ A.error(x);
});
}
}
});
- return new Response(A);
+ return new Response(g);
} else
- throw new ry(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l);
+ throw new cw(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l);
}).then((l) => {
switch (c) {
case "arraybuffer":
@@ -11976,22 +12592,22 @@ class Ps extends ps {
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((m) => f.decode(m));
+ return l.arrayBuffer().then((p) => f.decode(p));
}
}
}).then((l) => {
- ss.add(e, l);
- const h = qi[e];
- delete qi[e];
+ us.add(e, l);
+ const h = Zi[e];
+ delete Zi[e];
for (let u = 0, d = h.length; u < d; u++) {
const f = h[u];
f.onLoad && f.onLoad(l);
}
}).catch((l) => {
- const h = qi[e];
+ const h = Zi[e];
if (h === void 0)
throw this.manager.itemError(e), l;
- delete qi[e];
+ delete Zi[e];
for (let u = 0, d = h.length; u < d; u++) {
const f = h[u];
f.onError && f.onError(l);
@@ -12020,7 +12636,7 @@ class Ps extends ps {
return this.mimeType = e, this;
}
}
-class ay extends ps {
+class lw extends fi {
/**
* Constructs a new image loader.
*
@@ -12043,14 +12659,14 @@ class ay extends ps {
*/
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);
+ const r = this, a = us.get(e);
if (a !== void 0)
return r.manager.itemStart(e), setTimeout(function() {
t && t(a), r.manager.itemEnd(e);
}, 0), a;
- const o = Lo("img");
+ const o = qo("img");
function c() {
- h(), ss.add(e, this), t && t(this), r.manager.itemEnd(e);
+ h(), us.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);
@@ -12061,7 +12677,7 @@ class ay extends ps {
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 oy extends ps {
+class hw extends fi {
/**
* Constructs a new data texture loader.
*
@@ -12083,7 +12699,7 @@ class oy extends ps {
* @return {DataTexture} The data texture.
*/
load(e, t, n, s) {
- const r = this, a = new Hl(), o = new Ps(this.manager);
+ const r = this, a = new uh(), 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 {
@@ -12096,11 +12712,11 @@ class oy extends ps {
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 : xi, a.wrapT = l.wrapT !== void 0 ? l.wrapT : xi, 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 = ii), l.mipmapCount === 1 && (a.minFilter = qt), l.generateMipmaps !== void 0 && (a.generateMipmaps = l.generateMipmaps), a.needsUpdate = !0, t && t(a, l);
+ l.image !== void 0 ? a.image = l.image : l.data !== void 0 && (a.image.width = l.width, a.image.height = l.height, a.image.data = l.data), a.wrapS = l.wrapS !== void 0 ? l.wrapS : ti, a.wrapT = l.wrapT !== void 0 ? l.wrapT : ti, a.magFilter = l.magFilter !== void 0 ? l.magFilter : Xt, a.minFilter = l.minFilter !== void 0 ? l.minFilter : Xt, a.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.colorSpace !== void 0 && (a.colorSpace = l.colorSpace), l.flipY !== void 0 && (a.flipY = l.flipY), l.format !== void 0 && (a.format = l.format), l.type !== void 0 && (a.type = l.type), l.mipmaps !== void 0 && (a.mipmaps = l.mipmaps, a.minFilter = hi), l.mipmapCount === 1 && (a.minFilter = Xt), l.generateMipmaps !== void 0 && (a.generateMipmaps = l.generateMipmaps), a.needsUpdate = !0, t && t(a, l);
}, n, s), a;
}
}
-class cy extends ps {
+class G0 extends fi {
/**
* Constructs a new texture loader.
*
@@ -12122,13 +12738,13 @@ class cy extends ps {
* @return {Texture} The texture.
*/
load(e, t, n, s) {
- const r = new cn(), a = new ay(this.manager);
+ const r = new an(), a = new lw(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 Jo extends kt {
+class uc extends Tt {
/**
* Constructs a new light.
*
@@ -12136,7 +12752,7 @@ class Jo extends kt {
* @param {number} [intensity=1] - The light's strength/intensity.
*/
constructor(e, t = 1) {
- super(), this.isLight = !0, this.type = "Light", this.color = new je(e), this.intensity = t;
+ super(), this.isLight = !0, this.type = "Light", this.color = new Le(e), this.intensity = t;
}
/**
* Frees the GPU-related resources allocated by this instance. Call this
@@ -12152,7 +12768,7 @@ class Jo extends kt {
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 ly extends Jo {
+class uw extends uc {
/**
* Constructs a new hemisphere light.
*
@@ -12161,22 +12777,22 @@ class ly extends Jo {
* @param {number} [intensity=1] - The light's strength/intensity.
*/
constructor(e, t, n) {
- super(e, n), this.isHemisphereLight = !0, this.type = "HemisphereLight", this.position.copy(kt.DEFAULT_UP), this.updateMatrix(), this.groundColor = new je(t);
+ super(e, n), this.isHemisphereLight = !0, this.type = "HemisphereLight", this.position.copy(Tt.DEFAULT_UP), this.updateMatrix(), this.groundColor = new Le(t);
}
copy(e, t) {
return super.copy(e, t), this.groundColor.copy(e.groundColor), this;
}
}
-const kh = /* @__PURE__ */ new st(), Wp = /* @__PURE__ */ new H(), qp = /* @__PURE__ */ new H();
-class xf {
+const cu = /* @__PURE__ */ new De(), yA = /* @__PURE__ */ new G(), wA = /* @__PURE__ */ new G();
+class qf {
/**
* 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 = rn, this.map = null, this.mapPass = null, this.matrix = new st(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new gf(), this._frameExtents = new Ze(1, 1), this._viewportCount = 1, this._viewports = [
- new wt(0, 0, 1, 1)
+ 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 = [
+ new mt(0, 0, 1, 1)
];
}
/**
@@ -12203,7 +12819,7 @@ class xf {
*/
updateMatrices(e) {
const t = this.camera, n = this.matrix;
- Wp.setFromMatrixPosition(e.matrixWorld), t.position.copy(Wp), qp.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(qp), t.updateMatrixWorld(), kh.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(kh), n.set(
+ 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(
0.5,
0,
0,
@@ -12220,7 +12836,7 @@ class xf {
0,
0,
1
- ), n.multiply(kh);
+ ), n.multiply(cu);
}
/**
* Returns a viewport definition for the given viewport index.
@@ -12274,22 +12890,22 @@ class xf {
return this.intensity !== 1 && (e.intensity = this.intensity), this.bias !== 0 && (e.bias = this.bias), this.normalBias !== 0 && (e.normalBias = this.normalBias), this.radius !== 1 && (e.radius = this.radius), (this.mapSize.x !== 512 || this.mapSize.y !== 512) && (e.mapSize = this.mapSize.toArray()), e.camera = this.camera.toJSON(!1).object, delete e.camera.matrix, e;
}
}
-class hy extends xf {
+class dw extends qf {
/**
* Constructs a new spot light shadow.
*/
constructor() {
- super(new vn(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1;
+ super(new Sn(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1;
}
updateMatrices(e) {
- const t = this.camera, n = va * 2 * e.angle * this.focus, s = this.mapSize.width / this.mapSize.height, r = e.distance || t.far;
+ const t = this.camera, n = Na * 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 uy extends Jo {
+class H0 extends uc {
/**
* Constructs a new spot light.
*
@@ -12301,7 +12917,7 @@ class uy extends Jo {
* @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(kt.DEFAULT_UP), this.updateMatrix(), this.target = new kt(), this.distance = n, this.angle = s, this.penumbra = r, this.decay = a, this.map = null, this.shadow = new hy();
+ 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();
}
/**
* The light's power. Power is the luminous power of the light measured in lumens (lm).
@@ -12322,13 +12938,13 @@ class uy extends Jo {
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 Kp = /* @__PURE__ */ new st(), eo = /* @__PURE__ */ new H(), Uh = /* @__PURE__ */ new H();
-class dy extends xf {
+const vA = /* @__PURE__ */ new De(), lo = /* @__PURE__ */ new G(), lu = /* @__PURE__ */ new G();
+class fw extends qf {
/**
* Constructs a new point light shadow.
*/
constructor() {
- super(new vn(90, 1, 0.5, 500)), this.isPointLightShadow = !0, this._frameExtents = new Ze(4, 2), this._viewportCount = 6, this._viewports = [
+ super(new Sn(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:
//
@@ -12342,31 +12958,31 @@ class dy extends xf {
// Z - Positive z direction
// z - Negative z direction
// positive X
- new wt(2, 1, 1, 1),
+ new mt(2, 1, 1, 1),
// negative X
- new wt(0, 1, 1, 1),
+ new mt(0, 1, 1, 1),
// positive Z
- new wt(3, 1, 1, 1),
+ new mt(3, 1, 1, 1),
// negative Z
- new wt(1, 1, 1, 1),
+ new mt(1, 1, 1, 1),
// positive Y
- new wt(3, 0, 1, 1),
+ new mt(3, 0, 1, 1),
// negative Y
- new wt(1, 0, 1, 1)
+ new mt(1, 0, 1, 1)
], this._cubeDirections = [
- new H(1, 0, 0),
- new H(-1, 0, 0),
- new H(0, 0, 1),
- new H(0, 0, -1),
- new H(0, 1, 0),
- new H(0, -1, 0)
+ 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 H(0, 1, 0),
- new H(0, 1, 0),
- new H(0, 1, 0),
- new H(0, 1, 0),
- new H(0, 0, 1),
- new H(0, 0, -1)
+ 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)
];
}
/**
@@ -12377,10 +12993,10 @@ class dy extends xf {
*/
updateMatrices(e, t = 0) {
const n = this.camera, s = this.matrix, r = e.distance || n.far;
- r !== n.far && (n.far = r, n.updateProjectionMatrix()), eo.setFromMatrixPosition(e.matrixWorld), n.position.copy(eo), Uh.copy(n.position), Uh.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(Uh), n.updateMatrixWorld(), s.makeTranslation(-eo.x, -eo.y, -eo.z), Kp.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(Kp);
+ 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);
}
}
-class c0 extends Jo {
+class Kl extends uc {
/**
* Constructs a new point light.
*
@@ -12390,7 +13006,7 @@ class c0 extends Jo {
* @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 dy();
+ super(e, t), this.isPointLight = !0, this.type = "PointLight", this.distance = n, this.decay = s, this.shadow = new fw();
}
/**
* The light's power. Power is the luminous power of the light measured in lumens (lm).
@@ -12411,7 +13027,7 @@ class c0 extends Jo {
return super.copy(e, t), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this;
}
}
-class Ef extends $m {
+class Kf extends M0 {
/**
* Constructs a new orthographic camera.
*
@@ -12475,15 +13091,15 @@ class Ef extends $m {
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 fy extends xf {
+class pw extends qf {
/**
* Constructs a new directional light shadow.
*/
constructor() {
- super(new Ef(-5, 5, 5, -5, 0.5, 500)), this.isDirectionalLightShadow = !0;
+ super(new Kf(-5, 5, 5, -5, 0.5, 500)), this.isDirectionalLightShadow = !0;
}
}
-class l0 extends Jo {
+class jf extends uc {
/**
* Constructs a new directional light.
*
@@ -12491,7 +13107,7 @@ class l0 extends Jo {
* @param {number} [intensity=1] - The light's strength/intensity.
*/
constructor(e, t) {
- super(e, t), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(kt.DEFAULT_UP), this.updateMatrix(), this.target = new kt(), this.shadow = new fy();
+ super(e, t), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(Tt.DEFAULT_UP), this.updateMatrix(), this.target = new Tt(), this.shadow = new pw();
}
dispose() {
this.shadow.dispose();
@@ -12500,7 +13116,7 @@ class l0 extends Jo {
return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;
}
}
-class py extends Jo {
+class z0 extends uc {
/**
* Constructs a new ambient light.
*
@@ -12511,7 +13127,7 @@ class py extends Jo {
super(e, t), this.isAmbientLight = !0, this.type = "AmbientLight";
}
}
-class da {
+class wr {
/**
* Extracts the base URL from the given URL.
*
@@ -12535,7 +13151,7 @@ class da {
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 Ay extends ps {
+class Aw extends fi {
/**
* Constructs a new image bitmap loader.
*
@@ -12565,7 +13181,7 @@ class Ay extends ps {
*/
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);
+ const r = this, a = us.get(e);
if (a !== void 0) {
if (r.manager.itemStart(e), a.then) {
a.then((l) => {
@@ -12586,14 +13202,14 @@ class Ay extends ps {
}).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;
+ return us.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);
+ s && s(l), us.remove(e), r.manager.itemError(e), r.manager.itemEnd(e);
});
- ss.add(e, c), r.manager.itemStart(e);
+ us.add(e, c), r.manager.itemStart(e);
}
}
-class gy extends vn {
+class gw extends Sn {
/**
* Constructs a new array camera.
*
@@ -12603,7 +13219,7 @@ class gy extends vn {
super(), this.isArrayCamera = !0, this.isMultiViewCamera = !1, this.cameras = e;
}
}
-class my {
+class mw {
/**
* Constructs a new property mixer.
*
@@ -12718,11 +13334,11 @@ class my {
e[t + a] = e[n + a];
}
_slerp(e, t, n, s) {
- Xn.slerpFlat(e, t, e, t, e, n, s);
+ Jt.slerpFlat(e, t, e, t, e, n, s);
}
_slerpAdditive(e, t, n, s, r) {
const a = this._workIndex * r;
- Xn.multiplyQuaternionsFlat(e, a, e, t, e, n), Xn.slerpFlat(e, t, e, t, e, a, s);
+ Jt.multiplyQuaternionsFlat(e, a, e, t, e, n), Jt.slerpFlat(e, t, e, t, e, a, s);
}
_lerp(e, t, n, s, r) {
const a = 1 - s;
@@ -12738,12 +13354,12 @@ class my {
}
}
}
-const _f = "\\[\\]\\.:\\/", by = new RegExp("[" + _f + "]", "g"), yf = "[^" + _f + "]", xy = "[^" + _f.replace("\\.", "") + "]", Ey = /* @__PURE__ */ /((?:WC+[\/:])*)/.source.replace("WC", yf), _y = /* @__PURE__ */ /(WCOD+)?/.source.replace("WCOD", xy), yy = /* @__PURE__ */ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", yf), wy = /* @__PURE__ */ /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", yf), vy = new RegExp(
- "^" + Ey + _y + yy + wy + "$"
-), Cy = ["material", "materials", "bones", "map"];
-class Sy {
+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 {
constructor(e, t, n) {
- const s = n || Ct.parseTrackName(t);
+ const s = n || _t.parseTrackName(t);
this._targetGroup = e, this._bindings = e.subscribe_(t, s);
}
getValue(e, t) {
@@ -12767,7 +13383,7 @@ class Sy {
e[t].unbind();
}
}
-class Ct {
+class _t {
/**
* Constructs a new property binding.
*
@@ -12776,7 +13392,7 @@ class Ct {
* @param {?Object} [parsedPath] - The parsed path.
*/
constructor(e, t, n) {
- this.path = t, this.parsedPath = n || Ct.parseTrackName(t), this.node = Ct.findNode(e, this.parsedPath.nodeName), this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
+ 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;
}
/**
* Factory method for creating a property binding from the given parameters.
@@ -12788,7 +13404,7 @@ class Ct {
* @return {PropertyBinding|Composite} The created property binding or composite.
*/
static create(e, t, n) {
- return e && e.isAnimationObjectGroup ? new Ct.Composite(e, t, n) : new Ct(e, t, n);
+ return e && e.isAnimationObjectGroup ? new _t.Composite(e, t, n) : new _t(e, t, n);
}
/**
* Replaces spaces with underscores and removes unsupported characters from
@@ -12798,7 +13414,7 @@ class Ct {
* @return {string} The sanitized node name.
*/
static sanitizeNodeName(e) {
- return e.replace(/\s/g, "_").replace(by, "");
+ return e.replace(/\s/g, "_").replace(xw, "");
}
/**
* Parses the given track name (an object path to an animated property) and
@@ -12819,7 +13435,7 @@ class Ct {
* @return {Object} The parsed track name as an object.
*/
static parseTrackName(e) {
- const t = vy.exec(e);
+ const t = vw.exec(e);
if (t === null)
throw new Error("PropertyBinding: Cannot parse trackName: " + e);
const n = {
@@ -12833,7 +13449,7 @@ class Ct {
}, s = n.nodeName && n.nodeName.lastIndexOf(".");
if (s !== void 0 && s !== -1) {
const r = n.nodeName.substring(s + 1);
- Cy.indexOf(r) !== -1 && (n.nodeName = n.nodeName.substring(0, s), n.objectName = r);
+ Cw.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);
@@ -12953,7 +13569,7 @@ class Ct {
let e = this.node;
const t = this.parsedPath, n = t.objectName, s = t.propertyName;
let r = t.propertyIndex;
- if (e || (e = Ct.findNode(this.rootNode, t.nodeName), this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) {
+ 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;
}
@@ -13045,51 +13661,51 @@ class Ct {
this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
}
}
-Ct.Composite = Sy;
-Ct.prototype.BindingType = {
+_t.Composite = Sw;
+_t.prototype.BindingType = {
Direct: 0,
EntireArray: 1,
ArrayElement: 2,
HasFromToArray: 3
};
-Ct.prototype.Versioning = {
+_t.prototype.Versioning = {
None: 0,
NeedsUpdate: 1,
MatrixWorldNeedsUpdate: 2
};
-Ct.prototype.GetterByBindingType = [
- Ct.prototype._getValue_direct,
- Ct.prototype._getValue_array,
- Ct.prototype._getValue_arrayElement,
- Ct.prototype._getValue_toArray
+_t.prototype.GetterByBindingType = [
+ _t.prototype._getValue_direct,
+ _t.prototype._getValue_array,
+ _t.prototype._getValue_arrayElement,
+ _t.prototype._getValue_toArray
];
-Ct.prototype.SetterByBindingTypeAndVersioning = [
+_t.prototype.SetterByBindingTypeAndVersioning = [
[
// Direct
- Ct.prototype._setValue_direct,
- Ct.prototype._setValue_direct_setNeedsUpdate,
- Ct.prototype._setValue_direct_setMatrixWorldNeedsUpdate
+ _t.prototype._setValue_direct,
+ _t.prototype._setValue_direct_setNeedsUpdate,
+ _t.prototype._setValue_direct_setMatrixWorldNeedsUpdate
],
[
// EntireArray
- Ct.prototype._setValue_array,
- Ct.prototype._setValue_array_setNeedsUpdate,
- Ct.prototype._setValue_array_setMatrixWorldNeedsUpdate
+ _t.prototype._setValue_array,
+ _t.prototype._setValue_array_setNeedsUpdate,
+ _t.prototype._setValue_array_setMatrixWorldNeedsUpdate
],
[
// ArrayElement
- Ct.prototype._setValue_arrayElement,
- Ct.prototype._setValue_arrayElement_setNeedsUpdate,
- Ct.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate
+ _t.prototype._setValue_arrayElement,
+ _t.prototype._setValue_arrayElement_setNeedsUpdate,
+ _t.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate
],
[
// HasToFromArray
- Ct.prototype._setValue_fromArray,
- Ct.prototype._setValue_fromArray_setNeedsUpdate,
- Ct.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate
+ _t.prototype._setValue_fromArray,
+ _t.prototype._setValue_fromArray_setNeedsUpdate,
+ _t.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate
]
];
-class Iy {
+class Iw {
/**
* Constructs a new animation action.
*
@@ -13101,14 +13717,14 @@ class Iy {
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: na,
- endingEnd: na
+ endingStart: pa,
+ endingEnd: pa
};
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 = Qm, 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 = 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;
}
/**
* Starts the playback of the animation.
@@ -13359,11 +13975,11 @@ class Iy {
if (o > 0) {
const c = this._interpolants, l = this._propertyBindings;
switch (this.blendMode) {
- case DE:
+ case x_:
for (let h = 0, u = c.length; h !== u; ++h)
c[h].evaluate(a), l[h].accumulateAdditive(o);
break;
- case uf:
+ case Uf:
default:
for (let h = 0, u = c.length; h !== u; ++h)
c[h].evaluate(a), l[h].accumulate(s, o);
@@ -13397,10 +14013,10 @@ class Iy {
_updateTime(e) {
const t = this._clip.duration, n = this.loop;
let s = this.time + e, r = this._loopCount;
- const a = n === FE;
+ const a = n === m_;
if (e === 0)
return r === -1 ? s : a && (r & 1) === 1 ? t - s : s;
- if (n === Om) {
+ if (n === m0) {
r === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1));
e: {
if (s >= t)
@@ -13449,7 +14065,7 @@ class Iy {
}
_setEndings(e, t, n) {
const s = this._interpolantSettings;
- n ? (s.endingStart = ia, s.endingEnd = ia) : (e ? s.endingStart = this.zeroSlopeAtStart ? ia : na : s.endingStart = yl, t ? s.endingEnd = this.zeroSlopeAtEnd ? ia : na : s.endingEnd = yl);
+ 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);
}
_scheduleFading(e, t, n) {
const s = this._mixer, r = s.time;
@@ -13459,8 +14075,8 @@ class Iy {
return o[0] = r, c[0] = t, o[1] = r + e, c[1] = n, this;
}
}
-const My = new Float32Array(1);
-class h0 extends Hs {
+const Mw = new Float32Array(1);
+class V0 extends Ys {
/**
* Constructs a new animation mixer.
*
@@ -13475,22 +14091,22 @@ class h0 extends Hs {
h === void 0 && (h = {}, l[c] = h);
for (let u = 0; u !== r; ++u) {
const d = s[u], f = d.name;
- let m = h[f];
- if (m !== void 0)
- ++m.referenceCount, a[u] = m;
+ let p = h[f];
+ if (p !== void 0)
+ ++p.referenceCount, a[u] = p;
else {
- if (m = a[u], m !== void 0) {
- m._cacheIndex === null && (++m.referenceCount, this._addInactiveBinding(m, c, f));
+ if (p = a[u], p !== void 0) {
+ p._cacheIndex === null && (++p.referenceCount, this._addInactiveBinding(p, c, f));
continue;
}
- const g = t && t._propertyBindings[u].binding.parsedPath;
- m = new my(
- Ct.create(n, f, g),
+ const m = t && t._propertyBindings[u].binding.parsedPath;
+ p = new mw(
+ _t.create(n, f, m),
d.ValueTypeName,
d.getValueSize()
- ), ++m.referenceCount, this._addInactiveBinding(m, c, f), a[u] = m;
+ ), ++p.referenceCount, this._addInactiveBinding(p, c, f), a[u] = p;
}
- o[u].resultBuffer = m.buffer;
+ o[u].resultBuffer = p.buffer;
}
}
_activateAction(e) {
@@ -13615,11 +14231,11 @@ class h0 extends Hs {
_lendControlInterpolant() {
const e = this._controlInterpolants, t = this._nActiveControlInterpolants++;
let n = e[t];
- return n === void 0 && (n = new r0(
+ return n === void 0 && (n = new U0(
new Float32Array(2),
new Float32Array(2),
1,
- My
+ Mw
), n.__cacheIndex = t, e[t] = n), n;
}
_takeBackControlInterpolant(e) {
@@ -13640,17 +14256,17 @@ class h0 extends Hs {
*/
clipAction(e, t, n) {
const s = t || this._root, r = s.uuid;
- let a = typeof e == "string" ? pd.findByName(s, e) : e;
+ let a = typeof e == "string" ? ql.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 = Uf), 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 Iy(this, a, t, n);
+ const h = new Iw(this, a, t, n);
return this._bindAction(h, l), this._addInactiveAction(h, o, r), h;
}
/**
@@ -13661,7 +14277,7 @@ class h0 extends Hs {
* @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" ? pd.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" ? ql.findByName(n, e) : e, a = r ? r.uuid : e, o = this._actionsByClip[a];
return o !== void 0 && o.actionByRoot[s] || null;
}
/**
@@ -13770,7 +14386,7 @@ class h0 extends Hs {
n !== null && (this._deactivateAction(n), this._removeInactiveAction(n));
}
}
-class jp {
+class CA {
/**
* Constructs a new spherical.
*
@@ -13808,7 +14424,7 @@ class jp {
* @return {Spherical} A reference to this spherical.
*/
makeSafe() {
- return this.phi = ct(this.phi, 1e-6, Math.PI - 1e-6), this;
+ return this.phi = ot(this.phi, 1e-6, Math.PI - 1e-6), this;
}
/**
* Sets the spherical components from the given vector which is assumed to hold
@@ -13829,7 +14445,7 @@ class jp {
* @return {Spherical} A reference to this spherical.
*/
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(ct(t / this.radius, -1, 1))), this;
+ 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(ot(t / this.radius, -1, 1))), this;
}
/**
* Returns a new spherical with copied values from this instance.
@@ -13840,8 +14456,8 @@ class jp {
return new this.constructor().copy(this);
}
}
-const ws = /* @__PURE__ */ new H(), Dc = /* @__PURE__ */ new st(), Oh = /* @__PURE__ */ new st();
-class By extends zl {
+const Ts = /* @__PURE__ */ new G(), Jc = /* @__PURE__ */ new De(), hu = /* @__PURE__ */ new De();
+class Bw extends ph {
/**
* Constructs a new hemisphere light helper.
*
@@ -13849,21 +14465,21 @@ class By extends zl {
* can be used if it represents a hierarchy of bones (see {@link Bone}).
*/
constructor(e) {
- const t = u0(e), n = new Hn(), s = [], r = [], a = new je(0, 0, 1), o = new je(0, 1, 0);
+ const t = W0(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 kn(s, 3)), n.setAttribute("color", new kn(r, 3));
- const c = new Xo({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 });
+ 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 });
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");
- Oh.copy(this.root.matrixWorld).invert();
+ hu.copy(this.root.matrixWorld).invert();
for (let r = 0, a = 0; r < t.length; r++) {
const o = t[r];
- o.parent && o.parent.isBone && (Dc.multiplyMatrices(Oh, o.matrixWorld), ws.setFromMatrixPosition(Dc), s.setXYZ(a, ws.x, ws.y, ws.z), Dc.multiplyMatrices(Oh, o.parent.matrixWorld), ws.setFromMatrixPosition(Dc), s.setXYZ(a + 1, ws.x, ws.y, ws.z), a += 2);
+ 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);
}
n.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e);
}
@@ -13875,14 +14491,14 @@ class By extends zl {
this.geometry.dispose(), this.material.dispose();
}
}
-function u0(i) {
+function W0(i) {
const e = [];
i.isBone === !0 && e.push(i);
for (let t = 0; t < i.children.length; t++)
- e.push(...u0(i.children[t]));
+ e.push(...W0(i.children[t]));
return e;
}
-class Ty extends zl {
+class Tw extends ph {
/**
* Constructs a new grid helper.
*
@@ -13892,16 +14508,16 @@ class Ty extends zl {
* @param {number|Color|string} [color2=0x888888] - The color of the lines of the grid.
*/
constructor(e = 10, t = 10, n = 4473924, s = 8947848) {
- n = new je(n), s = new je(s);
+ n = new Le(n), s = new Le(s);
const r = t / 2, a = e / t, o = e / 2, c = [], l = [];
- for (let d = 0, f = 0, m = -o; d <= t; d++, m += a) {
- c.push(-o, 0, m, o, 0, m), c.push(m, 0, -o, m, 0, o);
- const g = d === r ? n : s;
- g.toArray(l, f), f += 3, g.toArray(l, f), f += 3, g.toArray(l, f), f += 3, g.toArray(l, f), f += 3;
- }
- const h = new Hn();
- h.setAttribute("position", new kn(c, 3)), h.setAttribute("color", new kn(l, 3));
- const u = new Xo({ vertexColors: !0, toneMapped: !1 });
+ 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 Tn();
+ h.setAttribute("position", new en(c, 3)), h.setAttribute("color", new en(l, 3));
+ const u = new Wa({ vertexColors: !0, toneMapped: !1 });
super(h, u), this.type = "GridHelper";
}
/**
@@ -13912,7 +14528,7 @@ class Ty extends zl {
this.geometry.dispose(), this.material.dispose();
}
}
-class Xp extends zl {
+class SA extends ph {
/**
* Constructs a new axes helper.
*
@@ -13957,9 +14573,9 @@ class Xp extends zl {
0,
0.6,
1
- ], s = new Hn();
- s.setAttribute("position", new kn(t, 3)), s.setAttribute("color", new kn(n, 3));
- const r = new Xo({ vertexColors: !0, toneMapped: !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 });
super(s, r), this.type = "AxesHelper";
}
/**
@@ -13971,7 +14587,7 @@ class Xp extends zl {
* @return {AxesHelper} A reference to this axes helper.
*/
setColors(e, t, n) {
- const s = new je(), r = this.geometry.attributes.color.array;
+ const s = new Le(), 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;
}
/**
@@ -13982,7 +14598,7 @@ class Xp extends zl {
this.geometry.dispose(), this.material.dispose();
}
}
-class Ry extends Hs {
+class Rw extends Ys {
/**
* Constructs a new controls instance.
*
@@ -14025,109 +14641,109 @@ class Ry extends Hs {
update() {
}
}
-function Yp(i, e, t, n) {
- const s = Ny(n);
+function IA(i, e, t, n) {
+ const s = Fw(n);
switch (t) {
// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
- case Pm:
+ case p0:
return i * e;
- case ns:
+ case cs:
return i * e / s.components * s.byteLength;
- case cf:
+ case Lf:
return i * e / s.components * s.byteLength;
- case hr:
+ case xr:
return i * e * 2 / s.components * s.byteLength;
- case lf:
+ case Pf:
return i * e * 2 / s.components * s.byteLength;
- case km:
+ case A0:
return i * e * 3 / s.components * s.byteLength;
- case on:
+ case pn:
return i * e * 4 / s.components * s.byteLength;
- case hf:
+ case kf:
return i * e * 4 / s.components * s.byteLength;
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/
- case al:
- case go:
+ case wl:
+ case Io:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;
- case ol:
- case mo:
+ case vl:
+ case Mo:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/
- case Wu:
- case qu:
+ case md:
+ case xd:
return Math.max(i, 16) * Math.max(e, 8) / 4;
- case gl:
- case ml:
+ 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 bl:
- case xl:
+ case Pl:
+ case kl:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;
- case El:
+ case Ul:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
- case Ro:
+ case Ho:
return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;
- case Ku:
+ case bd:
return Math.floor((i + 4) / 5) * Math.floor((e + 3) / 4) * 16;
- case ju:
+ case Ed:
return Math.floor((i + 4) / 5) * Math.floor((e + 4) / 5) * 16;
- case Xu:
+ case _d:
return Math.floor((i + 5) / 6) * Math.floor((e + 4) / 5) * 16;
- case No:
+ case zo:
return Math.floor((i + 5) / 6) * Math.floor((e + 5) / 6) * 16;
- case Yu:
+ case yd:
return Math.floor((i + 7) / 8) * Math.floor((e + 4) / 5) * 16;
- case Ju:
+ case wd:
return Math.floor((i + 7) / 8) * Math.floor((e + 5) / 6) * 16;
- case Zu:
+ case vd:
return Math.floor((i + 7) / 8) * Math.floor((e + 7) / 8) * 16;
- case $u:
+ case Cd:
return Math.floor((i + 9) / 10) * Math.floor((e + 4) / 5) * 16;
- case ed:
+ case Sd:
return Math.floor((i + 9) / 10) * Math.floor((e + 5) / 6) * 16;
- case td:
+ case Id:
return Math.floor((i + 9) / 10) * Math.floor((e + 7) / 8) * 16;
- case nd:
+ case Md:
return Math.floor((i + 9) / 10) * Math.floor((e + 9) / 10) * 16;
- case id:
+ case Bd:
return Math.floor((i + 11) / 12) * Math.floor((e + 9) / 10) * 16;
- case sd:
+ case Td:
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 _l:
+ case Bo:
+ case Rd:
+ case Ol:
return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/
- case Um:
- case ad:
+ case g0:
+ case Fd:
return Math.ceil(i / 4) * Math.ceil(e / 4) * 8;
- case od:
- case cd:
+ case Dd:
+ case Nd:
return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;
}
throw new Error(
`Unable to determine texture byte length for ${t} format.`
);
}
-function Ny(i) {
+function Fw(i) {
switch (i) {
- case rn:
- case Fm:
+ case un:
+ case u0:
return { byteLength: 1, components: 1 };
- case Io:
- case Dm:
- case Rn:
+ case Uo:
+ case d0:
+ case Qn:
return { byteLength: 2, components: 1 };
- case af:
- case of:
+ case Df:
+ case Nf:
return { byteLength: 2, components: 4 };
- case xr:
- case rf:
- case an:
+ case Ir:
+ case Ff:
+ case fn:
return { byteLength: 4, components: 1 };
- case Lm:
+ case f0:
return { byteLength: 4, components: 3 };
}
throw new Error(`Unknown texture type ${i}.`);
@@ -14136,7 +14752,7 @@ typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEv
revision: "176"
} }));
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "176");
-function d0() {
+function q0() {
let i = null, e = !1, t = null, n = null;
function s(r, a) {
t(r, a), n = i.requestAnimationFrame(s);
@@ -14156,7 +14772,7 @@ function d0() {
}
};
}
-function Fy(i) {
+function Dw(i) {
const e = /* @__PURE__ */ new WeakMap();
function t(o, c) {
const l = o.array, h = o.usage, u = l.byteLength, d = i.createBuffer();
@@ -14193,24 +14809,24 @@ function Fy(i) {
if (i.bindBuffer(l, o), u.length === 0)
i.bufferSubData(l, 0, h);
else {
- u.sort((f, m) => f.start - m.start);
+ u.sort((f, p) => f.start - p.start);
let d = 0;
for (let f = 1; f < u.length; f++) {
- const m = u[d], g = u[f];
- g.start <= m.start + m.count + 1 ? m.count = Math.max(
- m.count,
- g.start + g.count - m.start
- ) : (++d, u[d] = g);
+ 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, m = u.length; f < m; f++) {
- const g = u[f];
+ for (let f = 0, p = u.length; f < p; f++) {
+ const m = u[f];
i.bufferSubData(
l,
- g.start * h.BYTES_PER_ELEMENT,
+ m.start * h.BYTES_PER_ELEMENT,
h,
- g.start,
- g.count
+ m.start,
+ m.count
);
}
c.clearUpdateRanges();
@@ -14251,9 +14867,9 @@ function Fy(i) {
update: a
};
}
-var Dy = `#ifdef USE_ALPHAHASH
+var Nw = `#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
-#endif`, Ly = `#ifdef USE_ALPHAHASH
+#endif`, Lw = `#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -14288,20 +14904,20 @@ var Dy = `#ifdef USE_ALPHAHASH
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
-#endif`, Py = `#ifdef USE_ALPHAMAP
+#endif`, Pw = `#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
-#endif`, ky = `#ifdef USE_ALPHAMAP
+#endif`, kw = `#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`, Uy = `#ifdef USE_ALPHATEST
+#endif`, Uw = `#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
-#endif`, Oy = `#ifdef USE_ALPHATEST
+#endif`, Ow = `#ifdef USE_ALPHATEST
uniform float alphaTest;
-#endif`, Qy = `#ifdef USE_AOMAP
+#endif`, Qw = `#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
@@ -14314,10 +14930,10 @@ var Dy = `#ifdef USE_ALPHAHASH
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
-#endif`, Gy = `#ifdef USE_AOMAP
+#endif`, Gw = `#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
-#endif`, Hy = `#ifdef USE_BATCHING
+#endif`, Hw = `#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
@@ -14351,15 +14967,15 @@ var Dy = `#ifdef USE_ALPHAHASH
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
-#endif`, zy = `#ifdef USE_BATCHING
+#endif`, zw = `#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
-#endif`, Vy = `vec3 transformed = vec3( position );
+#endif`, Vw = `vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
-#endif`, Wy = `vec3 objectNormal = vec3( normal );
+#endif`, Ww = `vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
-#endif`, qy = `float G_BlinnPhong_Implicit( ) {
+#endif`, qw = `float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -14373,7 +14989,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
-} // validated`, Ky = `#ifdef USE_IRIDESCENCE
+} // validated`, Kw = `#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
@@ -14436,7 +15052,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
}
return max( I, vec3( 0.0 ) );
}
-#endif`, jy = `#ifdef USE_BUMPMAP
+#endif`, jw = `#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
@@ -14457,7 +15073,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
-#endif`, Xy = `#if NUM_CLIPPING_PLANES > 0
+#endif`, Xw = `#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
@@ -14503,26 +15119,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
if ( clipped ) discard;
#endif
#endif
-#endif`, Yy = `#if NUM_CLIPPING_PLANES > 0
+#endif`, Yw = `#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
-#endif`, Jy = `#if NUM_CLIPPING_PLANES > 0
+#endif`, Jw = `#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
-#endif`, Zy = `#if NUM_CLIPPING_PLANES > 0
+#endif`, Zw = `#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
-#endif`, $y = `#if defined( USE_COLOR_ALPHA )
+#endif`, $w = `#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
-#endif`, ew = `#if defined( USE_COLOR_ALPHA )
+#endif`, ev = `#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
-#endif`, tw = `#if defined( USE_COLOR_ALPHA )
+#endif`, tv = `#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
-#endif`, nw = `#if defined( USE_COLOR_ALPHA )
+#endif`, nv = `#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 );
@@ -14536,7 +15152,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
-#endif`, iw = `#define PI 3.141592653589793
+#endif`, iv = `#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
@@ -14610,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`, sw = `#ifdef ENVMAP_TYPE_CUBE_UV
+} // validated`, sv = `#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
@@ -14703,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`, rw = `vec3 transformedNormal = objectNormal;
+#endif`, rv = `vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
@@ -14732,21 +15348,21 @@ transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
-#endif`, aw = `#ifdef USE_DISPLACEMENTMAP
+#endif`, av = `#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
-#endif`, ow = `#ifdef USE_DISPLACEMENTMAP
+#endif`, ov = `#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
-#endif`, cw = `#ifdef USE_EMISSIVEMAP
+#endif`, cv = `#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
-#endif`, lw = `#ifdef USE_EMISSIVEMAP
+#endif`, lv = `#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
-#endif`, hw = "gl_FragColor = linearToOutputTexel( gl_FragColor );", uw = `vec4 LinearTransferOETF( in vec4 value ) {
+#endif`, hv = "gl_FragColor = linearToOutputTexel( gl_FragColor );", uv = `vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -14754,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 );
-}`, dw = `#ifdef USE_ENVMAP
+}`, dv = `#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
@@ -14783,7 +15399,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
-#endif`, fw = `#ifdef USE_ENVMAP
+#endif`, fv = `#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
@@ -14793,7 +15409,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform sampler2D envMap;
#endif
-#endif`, pw = `#ifdef USE_ENVMAP
+#endif`, pv = `#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
@@ -14804,7 +15420,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
varying vec3 vReflect;
#endif
-#endif`, Aw = `#ifdef USE_ENVMAP
+#endif`, Av = `#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
@@ -14815,7 +15431,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
varying vec3 vReflect;
uniform float refractionRatio;
#endif
-#endif`, gw = `#ifdef USE_ENVMAP
+#endif`, gv = `#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
@@ -14832,18 +15448,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
-#endif`, mw = `#ifdef USE_FOG
+#endif`, mv = `#ifdef USE_FOG
vFogDepth = - mvPosition.z;
-#endif`, bw = `#ifdef USE_FOG
+#endif`, xv = `#ifdef USE_FOG
varying float vFogDepth;
-#endif`, xw = `#ifdef USE_FOG
+#endif`, bv = `#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
-#endif`, Ew = `#ifdef USE_FOG
+#endif`, Ev = `#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
@@ -14852,7 +15468,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform float fogNear;
uniform float fogFar;
#endif
-#endif`, _w = `#ifdef USE_GRADIENTMAP
+#endif`, _v = `#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -14864,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
-}`, yw = `#ifdef USE_LIGHTMAP
+}`, yv = `#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
-#endif`, ww = `LambertMaterial material;
+#endif`, wv = `LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
-material.specularStrength = specularStrength;`, vw = `varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`, vv = `varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
@@ -14883,7 +15499,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, Cw = `uniform bool receiveShadow;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, Cv = `uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
@@ -14999,7 +15615,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
-#endif`, Sw = `#ifdef USE_ENVMAP
+#endif`, Sv = `#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -15032,8 +15648,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
#endif
}
#endif
-#endif`, Iw = `ToonMaterial material;
-material.diffuseColor = diffuseColor.rgb;`, Mw = `varying vec3 vViewPosition;
+#endif`, Iv = `ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`, Mv = `varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
@@ -15045,11 +15661,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, Bw = `BlinnPhongMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, Bv = `BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
-material.specularStrength = specularStrength;`, Tw = `varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`, Tv = `varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
@@ -15066,7 +15682,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, Rw = `PhysicalMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, Rv = `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 );
@@ -15152,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`, Nw = `struct PhysicalMaterial {
+#endif`, Fv = `struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
@@ -15453,7 +16069,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
-}`, Fw = `
+}`, Dv = `
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -15568,7 +16184,7 @@ IncidentLight directLight;
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
-#endif`, Dw = `#if defined( RE_IndirectDiffuse )
+#endif`, Nv = `#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -15587,32 +16203,32 @@ IncidentLight directLight;
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
-#endif`, Lw = `#if defined( RE_IndirectDiffuse )
+#endif`, Lv = `#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`, Pw = `#if defined( USE_LOGDEPTHBUF )
+#endif`, Pv = `#if defined( USE_LOGDEPTHBUF )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
-#endif`, kw = `#if defined( USE_LOGDEPTHBUF )
+#endif`, kv = `#if defined( USE_LOGDEPTHBUF )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`, Uw = `#ifdef USE_LOGDEPTHBUF
+#endif`, Uv = `#ifdef USE_LOGDEPTHBUF
varying float vFragDepth;
varying float vIsPerspective;
-#endif`, Ow = `#ifdef USE_LOGDEPTHBUF
+#endif`, Ov = `#ifdef USE_LOGDEPTHBUF
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
-#endif`, Qw = `#ifdef USE_MAP
+#endif`, Qv = `#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
-#endif`, Gw = `#ifdef USE_MAP
+#endif`, Gv = `#ifdef USE_MAP
uniform sampler2D map;
-#endif`, Hw = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+#endif`, Hv = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
@@ -15624,7 +16240,7 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
-#endif`, zw = `#if defined( USE_POINTS_UV )
+#endif`, zv = `#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -15636,19 +16252,19 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`, Vw = `float metalnessFactor = metalness;
+#endif`, Vv = `float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
-#endif`, Ww = `#ifdef USE_METALNESSMAP
+#endif`, Wv = `#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
-#endif`, qw = `#ifdef USE_INSTANCING_MORPH
+#endif`, qv = `#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
-#endif`, Kw = `#if defined( USE_MORPHCOLORS )
+#endif`, Kv = `#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
@@ -15657,12 +16273,12 @@ IncidentLight directLight;
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
-#endif`, jw = `#ifdef USE_MORPHNORMALS
+#endif`, jv = `#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
-#endif`, Xw = `#ifdef USE_MORPHTARGETS
+#endif`, Xv = `#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -15676,12 +16292,12 @@ IncidentLight directLight;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
-#endif`, Yw = `#ifdef USE_MORPHTARGETS
+#endif`, Yv = `#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
-#endif`, Jw = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#endif`, Jv = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
@@ -15722,7 +16338,7 @@ IncidentLight directLight;
tbn2[1] *= faceDirection;
#endif
#endif
-vec3 nonPerturbedNormal = normal;`, Zw = `#ifdef USE_NORMALMAP_OBJECTSPACE
+vec3 nonPerturbedNormal = normal;`, Zv = `#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
@@ -15737,25 +16353,25 @@ vec3 nonPerturbedNormal = normal;`, Zw = `#ifdef USE_NORMALMAP_OBJECTSPACE
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
-#endif`, $w = `#ifndef FLAT_SHADED
+#endif`, $v = `#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`, ev = `#ifndef FLAT_SHADED
+#endif`, eC = `#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`, tv = `#ifndef FLAT_SHADED
+#endif`, tC = `#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
-#endif`, nv = `#ifdef USE_NORMALMAP
+#endif`, nC = `#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
@@ -15777,13 +16393,13 @@ vec3 nonPerturbedNormal = normal;`, Zw = `#ifdef USE_NORMALMAP_OBJECTSPACE
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
-#endif`, iv = `#ifdef USE_CLEARCOAT
+#endif`, iC = `#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
-#endif`, sv = `#ifdef USE_CLEARCOAT_NORMALMAP
+#endif`, sC = `#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
-#endif`, rv = `#ifdef USE_CLEARCOATMAP
+#endif`, rC = `#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
@@ -15792,18 +16408,18 @@ vec3 nonPerturbedNormal = normal;`, Zw = `#ifdef USE_NORMALMAP_OBJECTSPACE
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
-#endif`, av = `#ifdef USE_IRIDESCENCEMAP
+#endif`, aC = `#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
-#endif`, ov = `#ifdef OPAQUE
+#endif`, oC = `#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, cv = `vec3 packNormalToRGB( const in vec3 normal ) {
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, cC = `vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -15872,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 );
-}`, lv = `#ifdef PREMULTIPLIED_ALPHA
+}`, lC = `#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
-#endif`, hv = `vec4 mvPosition = vec4( transformed, 1.0 );
+#endif`, hC = `vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
@@ -15882,22 +16498,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
-gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
+gl_Position = projectionMatrix * mvPosition;`, uC = `#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
-#endif`, dv = `#ifdef DITHERING
+#endif`, dC = `#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
-#endif`, fv = `float roughnessFactor = roughness;
+#endif`, fC = `float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
-#endif`, pv = `#ifdef USE_ROUGHNESSMAP
+#endif`, pC = `#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
-#endif`, Av = `#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`, AC = `#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
@@ -16083,7 +16699,7 @@ gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
}
return mix( 1.0, shadow, shadowIntensity );
}
-#endif`, gv = `#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`, gC = `#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
@@ -16124,7 +16740,7 @@ gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
-#endif`, mv = `#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
@@ -16156,7 +16772,7 @@ gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
-#endif`, bv = `float getShadowMask() {
+#endif`, xC = `float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
@@ -16188,12 +16804,12 @@ gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
#endif
#endif
return shadow;
-}`, xv = `#ifdef USE_SKINNING
+}`, bC = `#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
-#endif`, Ev = `#ifdef USE_SKINNING
+#endif`, EC = `#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
@@ -16208,7 +16824,7 @@ gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
-#endif`, _v = `#ifdef USE_SKINNING
+#endif`, _C = `#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
@@ -16216,7 +16832,7 @@ gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
-#endif`, yv = `#ifdef USE_SKINNING
+#endif`, yC = `#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
@@ -16227,17 +16843,17 @@ gl_Position = projectionMatrix * mvPosition;`, uv = `#ifdef DITHERING
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
-#endif`, wv = `float specularStrength;
+#endif`, wC = `float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
-#endif`, vv = `#ifdef USE_SPECULARMAP
+#endif`, vC = `#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
-#endif`, Cv = `#if defined( TONE_MAPPING )
+#endif`, CC = `#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
-#endif`, Sv = `#ifndef saturate
+#endif`, SC = `#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
@@ -16334,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; }`, Iv = `#ifdef USE_TRANSMISSION
+vec3 CustomToneMapping( vec3 color ) { return color; }`, IC = `#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
@@ -16355,7 +16971,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, Iv = `#ifdef USE_TRANSM
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
-#endif`, Mv = `#ifdef USE_TRANSMISSION
+#endif`, MC = `#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
@@ -16481,7 +17097,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, Iv = `#ifdef USE_TRANSM
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
-#endif`, Bv = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`, BC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -16551,7 +17167,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, Iv = `#ifdef USE_TRANSM
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`, Tv = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`, TC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -16645,7 +17261,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, Iv = `#ifdef USE_TRANSM
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`, Rv = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`, RC = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
@@ -16716,7 +17332,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, Iv = `#ifdef USE_TRANSM
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
-#endif`, Nv = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+#endif`, FC = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
@@ -16726,12 +17342,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`, Iv = `#ifdef USE_TRANSM
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;
-const Fv = `varying vec2 vUv;
+const DC = `varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
-}`, Dv = `uniform sampler2D t2D;
+}`, NC = `uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
@@ -16743,14 +17359,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, Lv = `varying vec3 vWorldDirection;
+}`, LC = `varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`, Pv = `#ifdef ENVMAP_TYPE_CUBE
+}`, PC = `#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
@@ -16773,14 +17389,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, kv = `varying vec3 vWorldDirection;
+}`, kC = `varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`, Uv = `uniform samplerCube tCube;
+}`, UC = `uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
@@ -16790,7 +17406,7 @@ void main() {
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, Ov = `#include <common>
+}`, OC = `#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
@@ -16817,7 +17433,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
-}`, Qv = `#if DEPTH_PACKING == 3200
+}`, QC = `#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
@@ -16851,7 +17467,7 @@ void main() {
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
-}`, Gv = `#define DISTANCE
+}`, GC = `#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
@@ -16878,7 +17494,7 @@ void main() {
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
-}`, Hv = `#define DISTANCE
+}`, HC = `#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
@@ -16902,13 +17518,13 @@ void main () {
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
-}`, zv = `varying vec3 vWorldDirection;
+}`, zC = `varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
-}`, Vv = `uniform sampler2D tEquirect;
+}`, VC = `uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
@@ -16917,7 +17533,7 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`, Wv = `uniform float scale;
+}`, WC = `uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
@@ -16939,7 +17555,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`, qv = `uniform vec3 diffuse;
+}`, qC = `uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
@@ -16967,7 +17583,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`, Kv = `#include <common>
+}`, KC = `#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
@@ -16999,7 +17615,7 @@ void main() {
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
-}`, jv = `uniform vec3 diffuse;
+}`, jC = `uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
@@ -17047,7 +17663,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, Xv = `#define LAMBERT
+}`, XC = `#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17086,7 +17702,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, Yv = `#define LAMBERT
+}`, YC = `#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -17143,7 +17759,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, Jv = `#define MATCAP
+}`, JC = `#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17177,7 +17793,7 @@ void main() {
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
-}`, Zv = `#define MATCAP
+}`, ZC = `#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
@@ -17223,7 +17839,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, $v = `#define NORMAL
+}`, $C = `#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
@@ -17256,7 +17872,7 @@ void main() {
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
-}`, eC = `#define NORMAL
+}`, eS = `#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
@@ -17278,7 +17894,7 @@ void main() {
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
-}`, tC = `#define PHONG
+}`, tS = `#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17317,7 +17933,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, nC = `#define PHONG
+}`, nS = `#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
@@ -17376,7 +17992,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, iC = `#define STANDARD
+}`, iS = `#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
@@ -17419,7 +18035,7 @@ void main() {
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
-}`, sC = `#define STANDARD
+}`, sS = `#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
@@ -17544,7 +18160,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, rC = `#define TOON
+}`, rS = `#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -17581,7 +18197,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, aC = `#define TOON
+}`, aS = `#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -17634,7 +18250,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`, oC = `uniform float size;
+}`, oS = `uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
@@ -17665,7 +18281,7 @@ void main() {
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
-}`, cC = `uniform vec3 diffuse;
+}`, cS = `uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
@@ -17690,7 +18306,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`, lC = `#include <common>
+}`, lS = `#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
@@ -17713,7 +18329,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`, hC = `uniform vec3 color;
+}`, hS = `uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
@@ -17729,7 +18345,7 @@ void main() {
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
-}`, uC = `uniform float rotation;
+}`, uS = `uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
@@ -17753,7 +18369,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`, dC = `uniform vec3 diffuse;
+}`, dS = `uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
@@ -17778,165 +18394,165 @@ void main() {
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
-}`, ot = {
- alphahash_fragment: Dy,
- alphahash_pars_fragment: Ly,
- alphamap_fragment: Py,
- alphamap_pars_fragment: ky,
- alphatest_fragment: Uy,
- alphatest_pars_fragment: Oy,
- aomap_fragment: Qy,
- aomap_pars_fragment: Gy,
- batching_pars_vertex: Hy,
- batching_vertex: zy,
- begin_vertex: Vy,
- beginnormal_vertex: Wy,
- bsdfs: qy,
- iridescence_fragment: Ky,
- bumpmap_pars_fragment: jy,
- clipping_planes_fragment: Xy,
- clipping_planes_pars_fragment: Yy,
- clipping_planes_pars_vertex: Jy,
- clipping_planes_vertex: Zy,
- color_fragment: $y,
- color_pars_fragment: ew,
- color_pars_vertex: tw,
- color_vertex: nw,
- common: iw,
- cube_uv_reflection_fragment: sw,
- defaultnormal_vertex: rw,
- displacementmap_pars_vertex: aw,
- displacementmap_vertex: ow,
- emissivemap_fragment: cw,
- emissivemap_pars_fragment: lw,
- colorspace_fragment: hw,
- colorspace_pars_fragment: uw,
- envmap_fragment: dw,
- envmap_common_pars_fragment: fw,
- envmap_pars_fragment: pw,
- envmap_pars_vertex: Aw,
- envmap_physical_pars_fragment: Sw,
- envmap_vertex: gw,
- fog_vertex: mw,
- fog_pars_vertex: bw,
- fog_fragment: xw,
- fog_pars_fragment: Ew,
- gradientmap_pars_fragment: _w,
- lightmap_pars_fragment: yw,
- lights_lambert_fragment: ww,
- lights_lambert_pars_fragment: vw,
- lights_pars_begin: Cw,
- lights_toon_fragment: Iw,
- lights_toon_pars_fragment: Mw,
- lights_phong_fragment: Bw,
- lights_phong_pars_fragment: Tw,
- lights_physical_fragment: Rw,
- lights_physical_pars_fragment: Nw,
- lights_fragment_begin: Fw,
- lights_fragment_maps: Dw,
- lights_fragment_end: Lw,
- logdepthbuf_fragment: Pw,
- logdepthbuf_pars_fragment: kw,
- logdepthbuf_pars_vertex: Uw,
- logdepthbuf_vertex: Ow,
- map_fragment: Qw,
- map_pars_fragment: Gw,
- map_particle_fragment: Hw,
- map_particle_pars_fragment: zw,
- metalnessmap_fragment: Vw,
- metalnessmap_pars_fragment: Ww,
- morphinstance_vertex: qw,
- morphcolor_vertex: Kw,
- morphnormal_vertex: jw,
- morphtarget_pars_vertex: Xw,
- morphtarget_vertex: Yw,
- normal_fragment_begin: Jw,
- normal_fragment_maps: Zw,
- normal_pars_fragment: $w,
- normal_pars_vertex: ev,
- normal_vertex: tv,
- normalmap_pars_fragment: nv,
- clearcoat_normal_fragment_begin: iv,
- clearcoat_normal_fragment_maps: sv,
- clearcoat_pars_fragment: rv,
- iridescence_pars_fragment: av,
- opaque_fragment: ov,
- packing: cv,
- premultiplied_alpha_fragment: lv,
- project_vertex: hv,
- dithering_fragment: uv,
- dithering_pars_fragment: dv,
- roughnessmap_fragment: fv,
- roughnessmap_pars_fragment: pv,
- shadowmap_pars_fragment: Av,
- shadowmap_pars_vertex: gv,
- shadowmap_vertex: mv,
- shadowmask_pars_fragment: bv,
- skinbase_vertex: xv,
- skinning_pars_vertex: Ev,
- skinning_vertex: _v,
- skinnormal_vertex: yv,
- specularmap_fragment: wv,
- specularmap_pars_fragment: vv,
- tonemapping_fragment: Cv,
- tonemapping_pars_fragment: Sv,
- transmission_fragment: Iv,
- transmission_pars_fragment: Mv,
- uv_pars_fragment: Bv,
- uv_pars_vertex: Tv,
- uv_vertex: Rv,
- worldpos_vertex: Nv,
- background_vert: Fv,
- background_frag: Dv,
- backgroundCube_vert: Lv,
- backgroundCube_frag: Pv,
- cube_vert: kv,
- cube_frag: Uv,
- depth_vert: Ov,
- depth_frag: Qv,
- distanceRGBA_vert: Gv,
- distanceRGBA_frag: Hv,
- equirect_vert: zv,
- equirect_frag: Vv,
- linedashed_vert: Wv,
- linedashed_frag: qv,
- meshbasic_vert: Kv,
- meshbasic_frag: jv,
- meshlambert_vert: Xv,
- meshlambert_frag: Yv,
- meshmatcap_vert: Jv,
- meshmatcap_frag: Zv,
- meshnormal_vert: $v,
- meshnormal_frag: eC,
- meshphong_vert: tC,
- meshphong_frag: nC,
- meshphysical_vert: iC,
- meshphysical_frag: sC,
- meshtoon_vert: rC,
- meshtoon_frag: aC,
- points_vert: oC,
- points_frag: cC,
- shadow_vert: lC,
- shadow_frag: hC,
- sprite_vert: uC,
- sprite_frag: dC
+}`, 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
}, we = {
common: {
- diffuse: { value: /* @__PURE__ */ new je(16777215) },
+ diffuse: { value: /* @__PURE__ */ new Le(16777215) },
opacity: { value: 1 },
map: { value: null },
- mapTransform: { value: /* @__PURE__ */ new rt() },
+ mapTransform: { value: /* @__PURE__ */ new at() },
alphaMap: { value: null },
- alphaMapTransform: { value: /* @__PURE__ */ new rt() },
+ alphaMapTransform: { value: /* @__PURE__ */ new at() },
alphaTest: { value: 0 }
},
specularmap: {
specularMap: { value: null },
- specularMapTransform: { value: /* @__PURE__ */ new rt() }
+ specularMapTransform: { value: /* @__PURE__ */ new at() }
},
envmap: {
envMap: { value: null },
- envMapRotation: { value: /* @__PURE__ */ new rt() },
+ envMapRotation: { value: /* @__PURE__ */ new at() },
flipEnvMap: { value: -1 },
reflectivity: { value: 1 },
// basic, lambert, phong
@@ -17948,40 +18564,40 @@ void main() {
aomap: {
aoMap: { value: null },
aoMapIntensity: { value: 1 },
- aoMapTransform: { value: /* @__PURE__ */ new rt() }
+ aoMapTransform: { value: /* @__PURE__ */ new at() }
},
lightmap: {
lightMap: { value: null },
lightMapIntensity: { value: 1 },
- lightMapTransform: { value: /* @__PURE__ */ new rt() }
+ lightMapTransform: { value: /* @__PURE__ */ new at() }
},
bumpmap: {
bumpMap: { value: null },
- bumpMapTransform: { value: /* @__PURE__ */ new rt() },
+ bumpMapTransform: { value: /* @__PURE__ */ new at() },
bumpScale: { value: 1 }
},
normalmap: {
normalMap: { value: null },
- normalMapTransform: { value: /* @__PURE__ */ new rt() },
+ normalMapTransform: { value: /* @__PURE__ */ new at() },
normalScale: { value: /* @__PURE__ */ new Ze(1, 1) }
},
displacementmap: {
displacementMap: { value: null },
- displacementMapTransform: { value: /* @__PURE__ */ new rt() },
+ displacementMapTransform: { value: /* @__PURE__ */ new at() },
displacementScale: { value: 1 },
displacementBias: { value: 0 }
},
emissivemap: {
emissiveMap: { value: null },
- emissiveMapTransform: { value: /* @__PURE__ */ new rt() }
+ emissiveMapTransform: { value: /* @__PURE__ */ new at() }
},
metalnessmap: {
metalnessMap: { value: null },
- metalnessMapTransform: { value: /* @__PURE__ */ new rt() }
+ metalnessMapTransform: { value: /* @__PURE__ */ new at() }
},
roughnessmap: {
roughnessMap: { value: null },
- roughnessMapTransform: { value: /* @__PURE__ */ new rt() }
+ roughnessMapTransform: { value: /* @__PURE__ */ new at() }
},
gradientmap: {
gradientMap: { value: null }
@@ -17990,7 +18606,7 @@ void main() {
fogDensity: { value: 25e-5 },
fogNear: { value: 1 },
fogFar: { value: 2e3 },
- fogColor: { value: /* @__PURE__ */ new je(16777215) }
+ fogColor: { value: /* @__PURE__ */ new Le(16777215) }
},
lights: {
ambientLightColor: { value: [] },
@@ -18060,30 +18676,30 @@ void main() {
ltc_2: { value: null }
},
points: {
- diffuse: { value: /* @__PURE__ */ new je(16777215) },
+ diffuse: { value: /* @__PURE__ */ new Le(16777215) },
opacity: { value: 1 },
size: { value: 1 },
scale: { value: 1 },
map: { value: null },
alphaMap: { value: null },
- alphaMapTransform: { value: /* @__PURE__ */ new rt() },
+ alphaMapTransform: { value: /* @__PURE__ */ new at() },
alphaTest: { value: 0 },
- uvTransform: { value: /* @__PURE__ */ new rt() }
+ uvTransform: { value: /* @__PURE__ */ new at() }
},
sprite: {
- diffuse: { value: /* @__PURE__ */ new je(16777215) },
+ diffuse: { value: /* @__PURE__ */ new Le(16777215) },
opacity: { value: 1 },
center: { value: /* @__PURE__ */ new Ze(0.5, 0.5) },
rotation: { value: 0 },
map: { value: null },
- mapTransform: { value: /* @__PURE__ */ new rt() },
+ mapTransform: { value: /* @__PURE__ */ new at() },
alphaMap: { value: null },
- alphaMapTransform: { value: /* @__PURE__ */ new rt() },
+ alphaMapTransform: { value: /* @__PURE__ */ new at() },
alphaTest: { value: 0 }
}
-}, Bi = {
+}, ki = {
basic: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.specularmap,
we.envmap,
@@ -18091,11 +18707,11 @@ void main() {
we.lightmap,
we.fog
]),
- vertexShader: ot.meshbasic_vert,
- fragmentShader: ot.meshbasic_frag
+ vertexShader: lt.meshbasic_vert,
+ fragmentShader: lt.meshbasic_frag
},
lambert: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.specularmap,
we.envmap,
@@ -18108,14 +18724,14 @@ void main() {
we.fog,
we.lights,
{
- emissive: { value: /* @__PURE__ */ new je(0) }
+ emissive: { value: /* @__PURE__ */ new Le(0) }
}
]),
- vertexShader: ot.meshlambert_vert,
- fragmentShader: ot.meshlambert_frag
+ vertexShader: lt.meshlambert_vert,
+ fragmentShader: lt.meshlambert_frag
},
phong: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.specularmap,
we.envmap,
@@ -18128,16 +18744,16 @@ void main() {
we.fog,
we.lights,
{
- emissive: { value: /* @__PURE__ */ new je(0) },
- specular: { value: /* @__PURE__ */ new je(1118481) },
+ emissive: { value: /* @__PURE__ */ new Le(0) },
+ specular: { value: /* @__PURE__ */ new Le(1118481) },
shininess: { value: 30 }
}
]),
- vertexShader: ot.meshphong_vert,
- fragmentShader: ot.meshphong_frag
+ vertexShader: lt.meshphong_vert,
+ fragmentShader: lt.meshphong_frag
},
standard: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.envmap,
we.aomap,
@@ -18151,17 +18767,17 @@ void main() {
we.fog,
we.lights,
{
- emissive: { value: /* @__PURE__ */ new je(0) },
+ emissive: { value: /* @__PURE__ */ new Le(0) },
roughness: { value: 1 },
metalness: { value: 0 },
envMapIntensity: { value: 1 }
}
]),
- vertexShader: ot.meshphysical_vert,
- fragmentShader: ot.meshphysical_frag
+ vertexShader: lt.meshphysical_vert,
+ fragmentShader: lt.meshphysical_frag
},
toon: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.aomap,
we.lightmap,
@@ -18173,14 +18789,14 @@ void main() {
we.fog,
we.lights,
{
- emissive: { value: /* @__PURE__ */ new je(0) }
+ emissive: { value: /* @__PURE__ */ new Le(0) }
}
]),
- vertexShader: ot.meshtoon_vert,
- fragmentShader: ot.meshtoon_frag
+ vertexShader: lt.meshtoon_vert,
+ fragmentShader: lt.meshtoon_frag
},
matcap: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.bumpmap,
we.normalmap,
@@ -18190,19 +18806,19 @@ void main() {
matcap: { value: null }
}
]),
- vertexShader: ot.meshmatcap_vert,
- fragmentShader: ot.meshmatcap_frag
+ vertexShader: lt.meshmatcap_vert,
+ fragmentShader: lt.meshmatcap_frag
},
points: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.points,
we.fog
]),
- vertexShader: ot.points_vert,
- fragmentShader: ot.points_frag
+ vertexShader: lt.points_vert,
+ fragmentShader: lt.points_frag
},
dashed: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.fog,
{
@@ -18211,19 +18827,19 @@ void main() {
totalSize: { value: 2 }
}
]),
- vertexShader: ot.linedashed_vert,
- fragmentShader: ot.linedashed_frag
+ vertexShader: lt.linedashed_vert,
+ fragmentShader: lt.linedashed_frag
},
depth: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.displacementmap
]),
- vertexShader: ot.depth_vert,
- fragmentShader: ot.depth_frag
+ vertexShader: lt.depth_vert,
+ fragmentShader: lt.depth_frag
},
normal: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.bumpmap,
we.normalmap,
@@ -18232,25 +18848,25 @@ void main() {
opacity: { value: 1 }
}
]),
- vertexShader: ot.meshnormal_vert,
- fragmentShader: ot.meshnormal_frag
+ vertexShader: lt.meshnormal_vert,
+ fragmentShader: lt.meshnormal_frag
},
sprite: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.sprite,
we.fog
]),
- vertexShader: ot.sprite_vert,
- fragmentShader: ot.sprite_frag
+ vertexShader: lt.sprite_vert,
+ fragmentShader: lt.sprite_frag
},
background: {
uniforms: {
- uvTransform: { value: /* @__PURE__ */ new rt() },
+ uvTransform: { value: /* @__PURE__ */ new at() },
t2D: { value: null },
backgroundIntensity: { value: 1 }
},
- vertexShader: ot.background_vert,
- fragmentShader: ot.background_frag
+ vertexShader: lt.background_vert,
+ fragmentShader: lt.background_frag
},
backgroundCube: {
uniforms: {
@@ -18258,10 +18874,10 @@ void main() {
flipEnvMap: { value: -1 },
backgroundBlurriness: { value: 0 },
backgroundIntensity: { value: 1 },
- backgroundRotation: { value: /* @__PURE__ */ new rt() }
+ backgroundRotation: { value: /* @__PURE__ */ new at() }
},
- vertexShader: ot.backgroundCube_vert,
- fragmentShader: ot.backgroundCube_frag
+ vertexShader: lt.backgroundCube_vert,
+ fragmentShader: lt.backgroundCube_frag
},
cube: {
uniforms: {
@@ -18269,120 +18885,120 @@ void main() {
tFlip: { value: -1 },
opacity: { value: 1 }
},
- vertexShader: ot.cube_vert,
- fragmentShader: ot.cube_frag
+ vertexShader: lt.cube_vert,
+ fragmentShader: lt.cube_frag
},
equirect: {
uniforms: {
tEquirect: { value: null }
},
- vertexShader: ot.equirect_vert,
- fragmentShader: ot.equirect_frag
+ vertexShader: lt.equirect_vert,
+ fragmentShader: lt.equirect_frag
},
distanceRGBA: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.common,
we.displacementmap,
{
- referencePosition: { value: /* @__PURE__ */ new H() },
+ referencePosition: { value: /* @__PURE__ */ new G() },
nearDistance: { value: 1 },
farDistance: { value: 1e3 }
}
]),
- vertexShader: ot.distanceRGBA_vert,
- fragmentShader: ot.distanceRGBA_frag
+ vertexShader: lt.distanceRGBA_vert,
+ fragmentShader: lt.distanceRGBA_frag
},
shadow: {
- uniforms: /* @__PURE__ */ Mn([
+ uniforms: /* @__PURE__ */ Pn([
we.lights,
we.fog,
{
- color: { value: /* @__PURE__ */ new je(0) },
+ color: { value: /* @__PURE__ */ new Le(0) },
opacity: { value: 1 }
}
]),
- vertexShader: ot.shadow_vert,
- fragmentShader: ot.shadow_frag
+ vertexShader: lt.shadow_vert,
+ fragmentShader: lt.shadow_frag
}
};
-Bi.physical = {
- uniforms: /* @__PURE__ */ Mn([
- Bi.standard.uniforms,
+ki.physical = {
+ uniforms: /* @__PURE__ */ Pn([
+ ki.standard.uniforms,
{
clearcoat: { value: 0 },
clearcoatMap: { value: null },
- clearcoatMapTransform: { value: /* @__PURE__ */ new rt() },
+ clearcoatMapTransform: { value: /* @__PURE__ */ new at() },
clearcoatNormalMap: { value: null },
- clearcoatNormalMapTransform: { value: /* @__PURE__ */ new rt() },
+ clearcoatNormalMapTransform: { value: /* @__PURE__ */ new at() },
clearcoatNormalScale: { value: /* @__PURE__ */ new Ze(1, 1) },
clearcoatRoughness: { value: 0 },
clearcoatRoughnessMap: { value: null },
- clearcoatRoughnessMapTransform: { value: /* @__PURE__ */ new rt() },
+ clearcoatRoughnessMapTransform: { value: /* @__PURE__ */ new at() },
dispersion: { value: 0 },
iridescence: { value: 0 },
iridescenceMap: { value: null },
- iridescenceMapTransform: { value: /* @__PURE__ */ new rt() },
+ iridescenceMapTransform: { value: /* @__PURE__ */ new at() },
iridescenceIOR: { value: 1.3 },
iridescenceThicknessMinimum: { value: 100 },
iridescenceThicknessMaximum: { value: 400 },
iridescenceThicknessMap: { value: null },
- iridescenceThicknessMapTransform: { value: /* @__PURE__ */ new rt() },
+ iridescenceThicknessMapTransform: { value: /* @__PURE__ */ new at() },
sheen: { value: 0 },
- sheenColor: { value: /* @__PURE__ */ new je(0) },
+ sheenColor: { value: /* @__PURE__ */ new Le(0) },
sheenColorMap: { value: null },
- sheenColorMapTransform: { value: /* @__PURE__ */ new rt() },
+ sheenColorMapTransform: { value: /* @__PURE__ */ new at() },
sheenRoughness: { value: 1 },
sheenRoughnessMap: { value: null },
- sheenRoughnessMapTransform: { value: /* @__PURE__ */ new rt() },
+ sheenRoughnessMapTransform: { value: /* @__PURE__ */ new at() },
transmission: { value: 0 },
transmissionMap: { value: null },
- transmissionMapTransform: { value: /* @__PURE__ */ new rt() },
+ transmissionMapTransform: { value: /* @__PURE__ */ new at() },
transmissionSamplerSize: { value: /* @__PURE__ */ new Ze() },
transmissionSamplerMap: { value: null },
thickness: { value: 0 },
thicknessMap: { value: null },
- thicknessMapTransform: { value: /* @__PURE__ */ new rt() },
+ thicknessMapTransform: { value: /* @__PURE__ */ new at() },
attenuationDistance: { value: 0 },
- attenuationColor: { value: /* @__PURE__ */ new je(0) },
- specularColor: { value: /* @__PURE__ */ new je(1, 1, 1) },
+ attenuationColor: { value: /* @__PURE__ */ new Le(0) },
+ specularColor: { value: /* @__PURE__ */ new Le(1, 1, 1) },
specularColorMap: { value: null },
- specularColorMapTransform: { value: /* @__PURE__ */ new rt() },
+ specularColorMapTransform: { value: /* @__PURE__ */ new at() },
specularIntensity: { value: 1 },
specularIntensityMap: { value: null },
- specularIntensityMapTransform: { value: /* @__PURE__ */ new rt() },
+ specularIntensityMapTransform: { value: /* @__PURE__ */ new at() },
anisotropyVector: { value: /* @__PURE__ */ new Ze() },
anisotropyMap: { value: null },
- anisotropyMapTransform: { value: /* @__PURE__ */ new rt() }
+ anisotropyMapTransform: { value: /* @__PURE__ */ new at() }
}
]),
- vertexShader: ot.meshphysical_vert,
- fragmentShader: ot.meshphysical_frag
+ vertexShader: lt.meshphysical_vert,
+ fragmentShader: lt.meshphysical_frag
};
-const Lc = { r: 0, b: 0, g: 0 }, Js = /* @__PURE__ */ new Di(), fC = /* @__PURE__ */ new st();
-function pC(i, e, t, n, s, r, a) {
- const o = new je(0);
+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 o = new Le(0);
let c = r === !0 ? 0 : 1, l, h, u = null, d = 0, f = null;
- function m(b) {
- let _ = b.isScene === !0 ? b.background : null;
- return _ && _.isTexture && (_ = (b.backgroundBlurriness > 0 ? t : e).get(_)), _;
- }
- function g(b) {
- let _ = !1;
- const M = m(b);
- M === null ? p(o, c) : M && M.isColor && (p(M, 1), _ = !0);
+ 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 || _) && (n.buffers.depth.setTest(!0), n.buffers.depth.setMask(!0), n.buffers.color.setMask(!0), i.clear(i.autoClearColor, i.autoClearDepth, i.autoClearStencil));
+ 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 A(b, _) {
- const M = m(_);
- M && (M.isCubeTexture || M.mapping === Gl) ? (h === void 0 && (h = new Jt(
- new Pa(1, 1, 1),
- new Os({
+ 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),
+ new qs({
name: "BackgroundCubeMaterial",
- uniforms: Ca(Bi.backgroundCube.uniforms),
- vertexShader: Bi.backgroundCube.vertexShader,
- fragmentShader: Bi.backgroundCube.fragmentShader,
- side: Ln,
+ uniforms: La(ki.backgroundCube.uniforms),
+ vertexShader: ki.backgroundCube.vertexShader,
+ fragmentShader: ki.backgroundCube.fragmentShader,
+ side: Vn,
depthTest: !1,
depthWrite: !1,
fog: !1,
@@ -18394,14 +19010,14 @@ function pC(i, e, t, n, s, r, a) {
get: function() {
return this.uniforms.envMap.value;
}
- }), s.update(h)), Js.copy(_.backgroundRotation), Js.x *= -1, Js.y *= -1, Js.z *= -1, M.isCubeTexture && M.isRenderTargetTexture === !1 && (Js.y *= -1, Js.z *= -1), h.material.uniforms.envMap.value = M, h.material.uniforms.flipEnvMap.value = M.isCubeTexture && M.isRenderTargetTexture === !1 ? -1 : 1, h.material.uniforms.backgroundBlurriness.value = _.backgroundBlurriness, h.material.uniforms.backgroundIntensity.value = _.backgroundIntensity, h.material.uniforms.backgroundRotation.value.setFromMatrix4(fC.makeRotationFromEuler(Js)), h.material.toneMapped = mt.getTransfer(M.colorSpace) !== Mt, (u !== M || d !== M.version || f !== i.toneMapping) && (h.material.needsUpdate = !0, u = M, d = M.version, f = i.toneMapping), h.layers.enableAll(), b.unshift(h, h.geometry, h.material, 0, 0, null)) : M && M.isTexture && (l === void 0 && (l = new Jt(
- new Wl(2, 2),
- new Os({
+ }), 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),
+ new qs({
name: "BackgroundMaterial",
- uniforms: Ca(Bi.background.uniforms),
- vertexShader: Bi.background.vertexShader,
- fragmentShader: Bi.background.fragmentShader,
- side: us,
+ uniforms: La(ki.background.uniforms),
+ vertexShader: ki.background.vertexShader,
+ fragmentShader: ki.background.fragmentShader,
+ side: bs,
depthTest: !1,
depthWrite: !1,
fog: !1,
@@ -18411,10 +19027,10 @@ function pC(i, e, t, n, s, r, a) {
get: function() {
return this.uniforms.t2D.value;
}
- }), s.update(l)), l.material.uniforms.t2D.value = M, l.material.uniforms.backgroundIntensity.value = _.backgroundIntensity, l.material.toneMapped = mt.getTransfer(M.colorSpace) !== Mt, M.matrixAutoUpdate === !0 && M.updateMatrix(), l.material.uniforms.uvTransform.value.copy(M.matrix), (u !== M || d !== M.version || f !== i.toneMapping) && (l.material.needsUpdate = !0, u = M, d = M.version, f = i.toneMapping), l.layers.enableAll(), b.unshift(l, l.geometry, l.material, 0, 0, null));
+ }), 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));
}
- function p(b, _) {
- b.getRGB(Lc, Zm(i)), n.buffers.color.setClear(Lc.r, Lc.g, Lc.b, _, a);
+ function A(x, E) {
+ x.getRGB(Zc, I0(i)), n.buffers.color.setClear(Zc.r, Zc.g, Zc.b, E, a);
}
function y() {
h !== void 0 && (h.geometry.dispose(), h.material.dispose(), h = void 0), l !== void 0 && (l.geometry.dispose(), l.material.dispose(), l = void 0);
@@ -18423,27 +19039,27 @@ function pC(i, e, t, n, s, r, a) {
getClearColor: function() {
return o;
},
- setClearColor: function(b, _ = 1) {
- o.set(b), c = _, p(o, c);
+ setClearColor: function(x, E = 1) {
+ o.set(x), c = E, A(o, c);
},
getClearAlpha: function() {
return c;
},
- setClearAlpha: function(b) {
- c = b, p(o, c);
+ setClearAlpha: function(x) {
+ c = x, A(o, c);
},
- render: g,
- addToRenderList: A,
+ render: m,
+ addToRenderList: g,
dispose: y
};
}
-function AC(i, e) {
+function AS(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;
+ let N = !1;
const O = u(q, K, F);
- r !== O && (r = O, l(r.object)), D = f(v, q, K, $), D && m(v, q, K, $), $ !== null && e.update($, i.ELEMENT_ARRAY_BUFFER), (D || a) && (a = !1, _(v, F, K, q), $ !== null && i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, e.get($).buffer));
+ 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();
@@ -18458,10 +19074,10 @@ function AC(i, e) {
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;
+ 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 = [];
@@ -18481,40 +19097,40 @@ function AC(i, e) {
};
}
function f(v, F, K, q) {
- const $ = r.attributes, D = F.attributes;
+ 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 = D[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 m(v, F, K, q) {
- const $ = {}, D = F.attributes;
+ 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 = D[Q];
+ 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 g() {
+ function m() {
const v = r.newAttributes;
for (let F = 0, K = v.length; F < K; F++)
v[F] = 0;
}
- function A(v) {
- p(v, 0);
+ function g(v) {
+ A(v, 0);
}
- function p(v, F) {
+ 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);
}
@@ -18523,58 +19139,58 @@ function AC(i, e) {
for (let K = 0, q = F.length; K < q; K++)
F[K] !== v[K] && (i.disableVertexAttribArray(K), F[K] = 0);
}
- function b(v, F, K, q, $, D, O) {
- O === !0 ? i.vertexAttribIPointer(v, F, K, $, D) : i.vertexAttribPointer(v, F, K, q, $, D);
+ function x(v, F, K, q, $, N, O) {
+ O === !0 ? i.vertexAttribIPointer(v, F, K, $, N) : i.vertexAttribPointer(v, F, K, q, $, N);
}
- function _(v, F, K, q) {
- g();
- const $ = q.attributes, D = K.getAttributes(), O = F.defaultAttributeValues;
- for (const Y in D) {
- const Q = D[Y];
+ 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, ye = e.get(J);
if (ye === void 0) continue;
- const Me = ye.buffer, se = ye.type, me = ye.bytesPerElement, be = se === i.INT || se === i.UNSIGNED_INT || J.gpuType === rf;
+ const Me = ye.buffer, se = ye.type, me = ye.bytesPerElement, xe = se === i.INT || se === i.UNSIGNED_INT || J.gpuType === Ff;
if (J.isInterleavedBufferAttribute) {
- const xe = J.data, Pe = xe.stride, $e = J.offset;
- if (xe.isInstancedInterleavedBuffer) {
- for (let Qe = 0; Qe < Q.locationSize; Qe++)
- p(Q.location + Qe, xe.meshPerAttribute);
- v.isInstancedMesh !== !0 && q._maxInstanceCount === void 0 && (q._maxInstanceCount = xe.meshPerAttribute * xe.count);
+ 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 Qe = 0; Qe < Q.locationSize; Qe++)
- A(Q.location + Qe);
+ for (let He = 0; He < Q.locationSize; He++)
+ g(Q.location + He);
i.bindBuffer(i.ARRAY_BUFFER, Me);
- for (let Qe = 0; Qe < Q.locationSize; Qe++)
- b(
- Q.location + Qe,
+ for (let He = 0; He < Q.locationSize; He++)
+ x(
+ Q.location + He,
ae / Q.locationSize,
se,
ee,
- Pe * me,
- ($e + ae / Q.locationSize * Qe) * me,
- be
+ Ue * me,
+ (et + ae / Q.locationSize * He) * me,
+ xe
);
} else {
if (J.isInstancedBufferAttribute) {
- for (let xe = 0; xe < Q.locationSize; xe++)
- p(Q.location + xe, J.meshPerAttribute);
+ 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 xe = 0; xe < Q.locationSize; xe++)
- A(Q.location + xe);
+ for (let be = 0; be < Q.locationSize; be++)
+ g(Q.location + be);
i.bindBuffer(i.ARRAY_BUFFER, Me);
- for (let xe = 0; xe < Q.locationSize; xe++)
- b(
- Q.location + xe,
+ for (let be = 0; be < Q.locationSize; be++)
+ x(
+ Q.location + be,
ae / Q.locationSize,
se,
ee,
ae * me,
- ae / Q.locationSize * xe * me,
- be
+ ae / Q.locationSize * be * me,
+ xe
);
}
} else if (O !== void 0) {
@@ -18598,7 +19214,7 @@ function AC(i, e) {
}
y();
}
- function M() {
+ function I() {
T();
for (const v in n) {
const F = n[v];
@@ -18642,15 +19258,15 @@ function AC(i, e) {
setup: o,
reset: T,
resetDefaultState: C,
- dispose: M,
+ dispose: I,
releaseStatesOfGeometry: w,
releaseStatesOfProgram: S,
- initAttributes: g,
- enableAttribute: A,
+ initAttributes: m,
+ enableAttribute: g,
disableUnusedAttributes: y
};
}
-function gC(i, e, t) {
+function gS(i, e, t) {
let n;
function s(l) {
n = l;
@@ -18665,27 +19281,27 @@ function gC(i, e, t) {
if (u === 0) return;
e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n, l, 0, h, 0, u);
let f = 0;
- for (let m = 0; m < u; m++)
- f += h[m];
+ 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 m = 0; m < l.length; m++)
- a(l[m], h[m], d[m]);
+ 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 m = 0;
- for (let g = 0; g < u; g++)
- m += h[g] * d[g];
- t.update(m, n, 1);
+ 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 mC(i, e, t, n) {
+function mS(i, e, t, n) {
let s;
function r() {
if (s !== void 0) return s;
@@ -18697,12 +19313,12 @@ function mC(i, e, t, n) {
return s;
}
function a(S) {
- return !(S !== on && n.convert(S) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT));
+ return !(S !== pn && n.convert(S) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT));
}
function o(S) {
- const T = S === Rn && (e.has("EXT_color_buffer_half_float") || e.has("EXT_color_buffer_float"));
- return !(S !== rn && n.convert(S) !== i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)
- S !== an && !T);
+ 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 c(S) {
if (S === "highp") {
@@ -18715,7 +19331,7 @@ function mC(i, e, t, n) {
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), m = i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS), g = i.getParameter(i.MAX_TEXTURE_SIZE), A = i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE), p = i.getParameter(i.MAX_VERTEX_ATTRIBS), y = i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS), b = i.getParameter(i.MAX_VARYING_VECTORS), _ = i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS), M = m > 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), 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);
return {
isWebGL2: !0,
// keeping this for backwards compatibility
@@ -18727,21 +19343,21 @@ function mC(i, e, t, n) {
logarithmicDepthBuffer: u,
reverseDepthBuffer: d,
maxTextures: f,
- maxVertexTextures: m,
- maxTextureSize: g,
- maxCubemapSize: A,
- maxAttributes: p,
+ maxVertexTextures: p,
+ maxTextureSize: m,
+ maxCubemapSize: g,
+ maxAttributes: A,
maxVertexUniforms: y,
- maxVaryings: b,
- maxFragmentUniforms: _,
- vertexTextures: M,
+ maxVaryings: x,
+ maxFragmentUniforms: E,
+ vertexTextures: I,
maxSamples: w
};
}
-function bC(i) {
+function xS(i) {
const e = this;
let t = null, n = 0, s = !1, r = !1;
- const a = new Rs(), o = new rt(), c = { value: null, needsUpdate: !1 };
+ const a = new Us(), o = new at(), 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 || // enable state of previous frame - the clipping code has to
// run another frame in order to reset the state:
@@ -18754,52 +19370,52 @@ function bC(i) {
}, this.setGlobalState = function(u, d) {
t = h(u, d, 0);
}, this.setState = function(u, d, f) {
- const m = u.clippingPlanes, g = u.clipIntersection, A = u.clipShadows, p = i.get(u);
- if (!s || m === null || m.length === 0 || r && !A)
+ 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 y = r ? 0 : n, b = y * 4;
- let _ = p.clippingState || null;
- c.value = _, _ = h(m, d, b, f);
- for (let M = 0; M !== b; ++M)
- _[M] = t[M];
- p.clippingState = _, this.numIntersection = g ? this.numPlanes : 0, this.numPlanes += y;
+ const y = r ? 0 : n, x = y * 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;
}
};
function l() {
c.value !== t && (c.value = t, c.needsUpdate = n > 0), e.numPlanes = n, e.numIntersection = 0;
}
- function h(u, d, f, m) {
- const g = u !== null ? u.length : 0;
- let A = null;
- if (g !== 0) {
- if (A = c.value, m !== !0 || A === null) {
- const p = f + g * 4, y = d.matrixWorldInverse;
- o.getNormalMatrix(y), (A === null || A.length < p) && (A = new Float32Array(p));
- for (let b = 0, _ = f; b !== g; ++b, _ += 4)
- a.copy(u[b]).applyMatrix4(y, o), a.normal.toArray(A, _), A[_ + 3] = a.constant;
+ 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, y = d.matrixWorldInverse;
+ o.getNormalMatrix(y), (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;
}
- c.value = A, c.needsUpdate = !0;
+ c.value = g, c.needsUpdate = !0;
}
- return e.numPlanes = g, e.numIntersection = 0, A;
+ return e.numPlanes = m, e.numIntersection = 0, g;
}
}
-function xC(i) {
+function bS(i) {
let e = /* @__PURE__ */ new WeakMap();
function t(a, o) {
- return o === zu ? a.mapping = br : o === Vu && (a.mapping = ya), a;
+ return o === Fl ? a.mapping = Sr : o === gd && (a.mapping = Da), a;
}
function n(a) {
if (a && a.isTexture) {
const o = a.mapping;
- if (o === zu || o === Vu)
+ if (o === Fl || o === gd)
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 P_(c.height);
+ const l = new Ey(c.height);
return l.fromEquirectangularTexture(i, a), e.set(a, l), a.addEventListener("dispose", s), t(l.texture, a.mapping);
} else
return null;
@@ -18821,21 +19437,21 @@ function xC(i) {
dispose: r
};
}
-const sa = 4, Jp = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], ar = 20, Qh = /* @__PURE__ */ new Ef(), Zp = /* @__PURE__ */ new je();
-let Gh = null, Hh = 0, zh = 0, Vh = !1;
-const ir = (1 + Math.sqrt(5)) / 2, Kr = 1 / ir, $p = [
- /* @__PURE__ */ new H(-ir, Kr, 0),
- /* @__PURE__ */ new H(ir, Kr, 0),
- /* @__PURE__ */ new H(-Kr, 0, ir),
- /* @__PURE__ */ new H(Kr, 0, ir),
- /* @__PURE__ */ new H(0, ir, -Kr),
- /* @__PURE__ */ new H(0, ir, Kr),
- /* @__PURE__ */ new H(-1, 1, -1),
- /* @__PURE__ */ new H(1, 1, -1),
- /* @__PURE__ */ new H(-1, 1, 1),
- /* @__PURE__ */ new H(1, 1, 1)
-], EC = /* @__PURE__ */ new H();
-class Ad {
+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),
+ /* @__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 {
/**
* Constructs a new PMREM generator.
*
@@ -18862,9 +19478,9 @@ class Ad {
fromScene(e, t = 0, n = 0.1, s = 100, r = {}) {
const {
size: a = 256,
- position: o = EC
+ position: o = ES
} = r;
- Gh = this._renderer.getRenderTarget(), Hh = this._renderer.getActiveCubeFace(), zh = this._renderer.getActiveMipmapLevel(), Vh = this._renderer.xr.enabled, this._renderer.xr.enabled = !1, this._setSize(a);
+ 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);
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;
}
@@ -18897,14 +19513,14 @@ class Ad {
* your texture's network fetch for increased concurrency.
*/
compileCubemapShader() {
- this._cubemapMaterial === null && (this._cubemapMaterial = nA(), this._compileMaterial(this._cubemapMaterial));
+ this._cubemapMaterial === null && (this._cubemapMaterial = DA(), 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 = tA(), this._compileMaterial(this._equirectMaterial));
+ this._equirectMaterial === null && (this._equirectMaterial = FA(), this._compileMaterial(this._equirectMaterial));
}
/**
* Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,
@@ -18924,68 +19540,68 @@ class Ad {
this._lodPlanes[e].dispose();
}
_cleanup(e) {
- this._renderer.setRenderTarget(Gh, Hh, zh), this._renderer.xr.enabled = Vh, e.scissorTest = !1, Pc(e, 0, 0, e.width, e.height);
+ this._renderer.setRenderTarget(du, fu, pu), this._renderer.xr.enabled = Au, e.scissorTest = !1, $c(e, 0, 0, e.width, e.height);
}
_fromTexture(e, t) {
- e.mapping === br || e.mapping === ya ? this._setSize(e.image.length === 0 ? 16 : e.image[0].width || e.image[0].image.width) : this._setSize(e.image.width / 4), Gh = this._renderer.getRenderTarget(), Hh = this._renderer.getActiveCubeFace(), zh = this._renderer.getActiveMipmapLevel(), Vh = this._renderer.xr.enabled, this._renderer.xr.enabled = !1;
+ 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;
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,
+ magFilter: Xt,
+ minFilter: Xt,
generateMipmaps: !1,
- type: Rn,
- format: on,
- colorSpace: ln,
+ type: Qn,
+ format: pn,
+ colorSpace: An,
depthBuffer: !1
- }, s = eA(e, t, n);
+ }, s = RA(e, t, n);
if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== e || this._pingPongRenderTarget.height !== t) {
- this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = eA(e, t, n);
+ this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = RA(e, t, n);
const { _lodMax: r } = this;
- ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _C(r)), this._blurMaterial = yC(r, e, t);
+ ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _S(r)), this._blurMaterial = yS(r, e, t);
}
return s;
}
_compileMaterial(e) {
- const t = new Jt(this._lodPlanes[0], e);
- this._renderer.compile(t, Qh);
+ const t = new Zt(this._lodPlanes[0], e);
+ this._renderer.compile(t, uu);
}
_sceneToCubeUV(e, t, n, s, r) {
- const c = new vn(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(Zp), u.toneMapping = Ls, u.autoClear = !1;
- const m = new Ns({
+ 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 p = new Os({
name: "PMREM.Background",
- side: Ln,
+ side: Vn,
depthWrite: !1,
depthTest: !1
- }), g = new Jt(new Pa(), m);
- let A = !1;
- const p = e.background;
- p ? p.isColor && (m.color.copy(p), e.background = null, A = !0) : (m.color.copy(Zp), A = !0);
+ }), m = new Zt(new Va(), 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 b = y % 3;
- b === 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)) : b === 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]));
- const _ = this._cubeSize;
- Pc(s, b * _, y > 2 ? _ : 0, _, _), u.setRenderTarget(s), A && u.render(g, c), u.render(e, c);
+ 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]));
+ 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);
}
- g.geometry.dispose(), g.material.dispose(), u.toneMapping = f, u.autoClear = d, e.background = p;
+ m.geometry.dispose(), m.material.dispose(), u.toneMapping = f, u.autoClear = d, e.background = A;
}
_textureToCubeUV(e, t) {
- const n = this._renderer, s = e.mapping === br || e.mapping === ya;
- s ? (this._cubemapMaterial === null && (this._cubemapMaterial = nA()), this._cubemapMaterial.uniforms.flipEnvMap.value = e.isRenderTargetTexture === !1 ? -1 : 1) : this._equirectMaterial === null && (this._equirectMaterial = tA());
- const r = s ? this._cubemapMaterial : this._equirectMaterial, a = new Jt(this._lodPlanes[0], r), o = r.uniforms;
+ 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 r = s ? this._cubemapMaterial : this._equirectMaterial, a = new Zt(this._lodPlanes[0], r), o = r.uniforms;
o.envMap.value = e;
const c = this._cubeSize;
- Pc(t, 0, 0, 3 * c, 2 * c), n.setRenderTarget(t), n.render(a, Qh);
+ $c(t, 0, 0, 3 * c, 2 * c), n.setRenderTarget(t), n.render(a, uu);
}
_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 = $p[(s - r - 1) % $p.length];
+ 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];
this._blur(e, r - 1, r, a, o);
}
t.autoClear = n;
@@ -19029,33 +19645,33 @@ class Ad {
a !== "latitudinal" && a !== "longitudinal" && console.error(
"blur direction must be either latitudinal or longitudinal!"
);
- const h = 3, u = new Jt(this._lodPlanes[s], l), d = l.uniforms, f = this._sizeLods[n] - 1, m = isFinite(r) ? Math.PI / (2 * f) : 2 * Math.PI / (2 * ar - 1), g = r / m, A = isFinite(r) ? 1 + Math.floor(h * g) : ar;
- A > ar && console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to ${ar}`);
- const p = [];
+ 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 A = [];
let y = 0;
- for (let S = 0; S < ar; ++S) {
- const T = S / g, C = Math.exp(-T * T / 2);
- p.push(C), S === 0 ? y += C : S < A && (y += 2 * C);
+ 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);
}
- for (let S = 0; S < p.length; S++)
- p[S] = p[S] / y;
- d.envMap.value = e.texture, d.samples.value = A, d.weights.value = p, d.latitudinal.value = a === "latitudinal", o && (d.poleAxis.value = o);
- const { _lodMax: b } = this;
- d.dTheta.value = m, d.mipInt.value = b - n;
- const _ = this._sizeLods[s], M = 3 * _ * (s > b - sa ? s - b + sa : 0), w = 4 * (this._cubeSize - _);
- Pc(t, M, w, 3 * _, 2 * _), c.setRenderTarget(t), c.render(u, Qh);
+ for (let S = 0; S < A.length; S++)
+ A[S] = A[S] / y;
+ 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);
}
}
-function _C(i) {
+function _S(i) {
const e = [], t = [], n = [];
let s = i;
- const r = i - sa + 1 + Jp.length;
+ const r = i - ga + 1 + MA.length;
for (let a = 0; a < r; a++) {
const o = Math.pow(2, s);
t.push(o);
let c = 1 / o;
- a > i - sa ? c = Jp[a - i + sa - 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, m = 6, g = 3, A = 2, p = 1, y = new Float32Array(g * m * f), b = new Float32Array(A * m * f), _ = new Float32Array(p * m * f);
+ 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);
for (let w = 0; w < f; w++) {
const S = w % 3 * 2 / 3 - 1, T = w > 2 ? 0 : -1, C = [
S,
@@ -19077,28 +19693,28 @@ function _C(i) {
T + 1,
0
];
- y.set(C, g * m * w), b.set(d, A * m * w);
+ y.set(C, m * p * w), x.set(d, g * p * w);
const v = [w, w, w, w, w, w];
- _.set(v, p * m * w);
+ E.set(v, A * p * w);
}
- const M = new Hn();
- M.setAttribute("position", new _n(y, g)), M.setAttribute("uv", new _n(b, A)), M.setAttribute("faceIndex", new _n(_, p)), e.push(M), s > sa && s--;
+ 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--;
}
return { lodPlanes: e, sizeLods: t, sigmas: n };
}
-function eA(i, e, t) {
- const n = new Er(i, e, t);
- return n.texture.mapping = Gl, n.texture.name = "PMREM.cubeUv", n.scissorTest = !0, 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 Pc(i, e, t, n, s) {
+function $c(i, e, t, n, s) {
i.viewport.set(e, t, n, s), i.scissor.set(e, t, n, s);
}
-function yC(i, e, t) {
- const n = new Float32Array(ar), s = new H(0, 1, 0);
- return new Os({
+function yS(i, e, t) {
+ const n = new Float32Array(pr), s = new G(0, 1, 0);
+ return new qs({
name: "SphericalGaussianBlur",
defines: {
- n: ar,
+ n: pr,
CUBEUV_TEXEL_WIDTH: 1 / e,
CUBEUV_TEXEL_HEIGHT: 1 / t,
CUBEUV_MAX_MIP: `${i}.0`
@@ -19112,7 +19728,7 @@ function yC(i, e, t) {
mipInt: { value: 0 },
poleAxis: { value: s }
},
- vertexShader: wf(),
+ vertexShader: Jf(),
fragmentShader: (
/* glsl */
`
@@ -19177,18 +19793,18 @@ function yC(i, e, t) {
}
`
),
- blending: Ds,
+ blending: Gs,
depthTest: !1,
depthWrite: !1
});
}
-function tA() {
- return new Os({
+function FA() {
+ return new qs({
name: "EquirectangularToCubeUV",
uniforms: {
envMap: { value: null }
},
- vertexShader: wf(),
+ vertexShader: Jf(),
fragmentShader: (
/* glsl */
`
@@ -19212,19 +19828,19 @@ function tA() {
}
`
),
- blending: Ds,
+ blending: Gs,
depthTest: !1,
depthWrite: !1
});
}
-function nA() {
- return new Os({
+function DA() {
+ return new qs({
name: "CubemapToCubeUV",
uniforms: {
envMap: { value: null },
flipEnvMap: { value: -1 }
},
- vertexShader: wf(),
+ vertexShader: Jf(),
fragmentShader: (
/* glsl */
`
@@ -19245,12 +19861,12 @@ function nA() {
}
`
),
- blending: Ds,
+ blending: Gs,
depthTest: !1,
depthWrite: !1
});
}
-function wf() {
+function Jf() {
return (
/* glsl */
`
@@ -19311,21 +19927,21 @@ function wf() {
`
);
}
-function wC(i) {
+function wS(i) {
let e = /* @__PURE__ */ new WeakMap(), t = null;
function n(o) {
if (o && o.isTexture) {
- const c = o.mapping, l = c === zu || c === Vu, h = c === br || c === ya;
+ const c = o.mapping, l = c === Fl || c === gd, h = c === Sr || 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 Ad(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 Hd(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 Ad(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 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;
}
}
}
@@ -19352,7 +19968,7 @@ function wC(i) {
dispose: a
};
}
-function vC(i) {
+function vS(i) {
const e = {};
function t(n) {
if (e[n] !== void 0)
@@ -19385,17 +20001,17 @@ function vC(i) {
},
get: function(n) {
const s = t(n);
- return s === null && cl("THREE.WebGLRenderer: " + n + " extension not supported."), s;
+ return s === null && Cl("THREE.WebGLRenderer: " + n + " extension not supported."), s;
}
};
}
-function CC(i, e, t, n) {
+function CS(i, e, t, n) {
const s = {}, r = /* @__PURE__ */ new WeakMap();
function a(u) {
const d = u.target;
d.index !== null && e.remove(d.index);
- for (const m in d.attributes)
- e.remove(d.attributes[m]);
+ 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--;
@@ -19409,28 +20025,28 @@ function CC(i, e, t, n) {
e.update(d[f], i.ARRAY_BUFFER);
}
function l(u) {
- const d = [], f = u.index, m = u.attributes.position;
- let g = 0;
+ const d = [], f = u.index, p = u.attributes.position;
+ let m = 0;
if (f !== null) {
const y = f.array;
- g = f.version;
- for (let b = 0, _ = y.length; b < _; b += 3) {
- const M = y[b + 0], w = y[b + 1], S = y[b + 2];
- d.push(M, w, w, S, S, M);
- }
- } else if (m !== void 0) {
- const y = m.array;
- g = m.version;
- for (let b = 0, _ = y.length / 3 - 1; b < _; b += 3) {
- const M = b + 0, w = b + 1, S = b + 2;
- d.push(M, w, w, S, S, M);
+ 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);
+ }
+ } else if (p !== void 0) {
+ const y = 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);
}
} else
return;
- const A = new (Wm(d) ? Jm : Ym)(d, 1);
- A.version = g;
- const p = r.get(u);
- p && e.remove(p), r.set(u, A);
+ const g = new (_0(d) ? S0 : Gf)(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);
@@ -19447,7 +20063,7 @@ function CC(i, e, t, n) {
getWireframeAttribute: h
};
}
-function SC(i, e, t) {
+function SS(i, e, t) {
let n;
function s(d) {
n = d;
@@ -19459,34 +20075,34 @@ function SC(i, e, t) {
function c(d, f) {
i.drawElements(n, f, r, d * a), t.update(f, n, 1);
}
- function l(d, f, m) {
- m !== 0 && (i.drawElementsInstanced(n, f, r, d * a, m), t.update(f, n, m));
+ function l(d, f, p) {
+ p !== 0 && (i.drawElementsInstanced(n, f, r, d * a, p), t.update(f, n, p));
}
- function h(d, f, m) {
- if (m === 0) return;
- e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n, f, 0, r, d, 0, m);
- let A = 0;
- for (let p = 0; p < m; p++)
- A += f[p];
- t.update(A, n, 1);
- }
- function u(d, f, m, g) {
- if (m === 0) return;
- const A = e.get("WEBGL_multi_draw");
- if (A === null)
- for (let p = 0; p < d.length; p++)
- l(d[p] / a, f[p], g[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 {
- A.multiDrawElementsInstancedWEBGL(n, f, 0, r, d, 0, g, 0, m);
- let p = 0;
- for (let y = 0; y < m; y++)
- p += f[y] * g[y];
- t.update(p, n, 1);
+ 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];
+ t.update(A, n, 1);
}
}
this.setMode = s, this.setIndex = o, this.render = c, this.renderInstances = l, this.renderMultiDraw = h, this.renderMultiDrawInstances = u;
}
-function IC(i) {
+function IS(i) {
const e = {
geometries: 0,
textures: 0
@@ -19531,8 +20147,8 @@ function IC(i) {
update: n
};
}
-function MC(i, e, t) {
- const n = /* @__PURE__ */ new WeakMap(), s = new wt();
+function MS(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);
@@ -19541,35 +20157,35 @@ function MC(i, e, t) {
S.dispose(), n.delete(o), o.removeEventListener("dispose", C);
};
d !== void 0 && d.texture.dispose();
- const f = o.morphAttributes.position !== void 0, m = o.morphAttributes.normal !== void 0, g = o.morphAttributes.color !== void 0, A = o.morphAttributes.position || [], p = o.morphAttributes.normal || [], y = o.morphAttributes.color || [];
- let b = 0;
- f === !0 && (b = 1), m === !0 && (b = 2), g === !0 && (b = 3);
- let _ = o.attributes.position.count * b, M = 1;
- _ > e.maxTextureSize && (M = Math.ceil(_ / e.maxTextureSize), _ = e.maxTextureSize);
- const w = new Float32Array(_ * M * 4 * u), S = new qm(w, _, M, u);
- S.type = an, S.needsUpdate = !0;
- const T = b * 4;
+ 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 || [];
+ 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;
+ const T = x * 4;
for (let v = 0; v < u; v++) {
- const F = A[v], K = p[v], q = y[v], $ = _ * M * 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), m === !0 && (s.fromBufferAttribute(K, D), w[$ + O + 4] = s.x, w[$ + O + 5] = s.y, w[$ + O + 6] = s.z, w[$ + O + 7] = 0), g === !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);
+ 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);
}
}
d = {
count: u,
texture: S,
- size: new Ze(_, M)
+ size: new Ze(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 g = 0; g < l.length; g++)
- f += l[g];
- const m = o.morphTargetsRelative ? 1 : 1 - f;
- c.getUniforms().setValue(i, "morphTargetBaseInfluence", m), c.getUniforms().setValue(i, "morphTargetInfluences", l);
+ 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);
}
@@ -19577,7 +20193,7 @@ function MC(i, e, t) {
update: r
};
}
-function BC(i, e, t, n) {
+function BS(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);
@@ -19599,229 +20215,229 @@ function BC(i, e, t, n) {
dispose: a
};
}
-const f0 = /* @__PURE__ */ new cn(), iA = /* @__PURE__ */ new i0(1, 1), p0 = /* @__PURE__ */ new qm(), A0 = /* @__PURE__ */ new Km(), g0 = /* @__PURE__ */ new e0(), sA = [], rA = [], aA = new Float32Array(16), oA = new Float32Array(9), cA = new Float32Array(4);
-function Oa(i, e, t) {
+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 n = i[0];
if (n <= 0 || n > 0) return i;
const s = e * t;
- let r = sA[s];
- if (r === void 0 && (r = new Float32Array(s), sA[s] = r), e !== 0) {
+ let r = LA[s];
+ if (r === void 0 && (r = new Float32Array(s), LA[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 hn(i, e) {
+function gn(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 un(i, e) {
+function mn(i, e) {
for (let t = 0, n = e.length; t < n; t++)
i[t] = e[t];
}
-function ql(i, e) {
- let t = rA[e];
- t === void 0 && (t = new Int32Array(e), rA[e] = t);
+function mh(i, e) {
+ let t = PA[e];
+ t === void 0 && (t = new Int32Array(e), PA[e] = t);
for (let n = 0; n !== e; ++n)
t[n] = i.allocateTextureUnit();
return t;
}
-function TC(i, e) {
+function TS(i, e) {
const t = this.cache;
t[0] !== e && (i.uniform1f(this.addr, e), t[0] = e);
}
-function RC(i, e) {
+function RS(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 (hn(t, e)) return;
- i.uniform2fv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform2fv(this.addr, e), mn(t, e);
}
}
-function NC(i, e) {
+function FS(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 (hn(t, e)) return;
- i.uniform3fv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform3fv(this.addr, e), mn(t, e);
}
}
-function FC(i, e) {
+function DS(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 (hn(t, e)) return;
- i.uniform4fv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform4fv(this.addr, e), mn(t, e);
}
}
-function DC(i, e) {
+function NS(i, e) {
const t = this.cache, n = e.elements;
if (n === void 0) {
- if (hn(t, e)) return;
- i.uniformMatrix2fv(this.addr, !1, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniformMatrix2fv(this.addr, !1, e), mn(t, e);
} else {
- if (hn(t, n)) return;
- cA.set(n), i.uniformMatrix2fv(this.addr, !1, cA), un(t, n);
+ if (gn(t, n)) return;
+ OA.set(n), i.uniformMatrix2fv(this.addr, !1, OA), mn(t, n);
}
}
-function LC(i, e) {
+function LS(i, e) {
const t = this.cache, n = e.elements;
if (n === void 0) {
- if (hn(t, e)) return;
- i.uniformMatrix3fv(this.addr, !1, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniformMatrix3fv(this.addr, !1, e), mn(t, e);
} else {
- if (hn(t, n)) return;
- oA.set(n), i.uniformMatrix3fv(this.addr, !1, oA), un(t, n);
+ if (gn(t, n)) return;
+ UA.set(n), i.uniformMatrix3fv(this.addr, !1, UA), mn(t, n);
}
}
-function PC(i, e) {
+function PS(i, e) {
const t = this.cache, n = e.elements;
if (n === void 0) {
- if (hn(t, e)) return;
- i.uniformMatrix4fv(this.addr, !1, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniformMatrix4fv(this.addr, !1, e), mn(t, e);
} else {
- if (hn(t, n)) return;
- aA.set(n), i.uniformMatrix4fv(this.addr, !1, aA), un(t, n);
+ if (gn(t, n)) return;
+ kA.set(n), i.uniformMatrix4fv(this.addr, !1, kA), mn(t, n);
}
}
-function kC(i, e) {
+function kS(i, e) {
const t = this.cache;
t[0] !== e && (i.uniform1i(this.addr, e), t[0] = e);
}
-function UC(i, e) {
+function US(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 (hn(t, e)) return;
- i.uniform2iv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform2iv(this.addr, e), mn(t, e);
}
}
-function OC(i, 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.uniform3i(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z);
else {
- if (hn(t, e)) return;
- i.uniform3iv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform3iv(this.addr, e), mn(t, e);
}
}
-function QC(i, e) {
+function QS(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 (hn(t, e)) return;
- i.uniform4iv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform4iv(this.addr, e), mn(t, e);
}
}
-function GC(i, e) {
+function GS(i, e) {
const t = this.cache;
t[0] !== e && (i.uniform1ui(this.addr, e), t[0] = e);
}
-function HC(i, e) {
+function HS(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 (hn(t, e)) return;
- i.uniform2uiv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform2uiv(this.addr, e), mn(t, e);
}
}
-function zC(i, e) {
+function zS(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 (hn(t, e)) return;
- i.uniform3uiv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform3uiv(this.addr, e), mn(t, e);
}
}
-function VC(i, e) {
+function VS(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 (hn(t, e)) return;
- i.uniform4uiv(this.addr, e), un(t, e);
+ if (gn(t, e)) return;
+ i.uniform4uiv(this.addr, e), mn(t, e);
}
}
-function WC(i, e, t) {
+function WS(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 ? (iA.compareFunction = zm, r = iA) : r = f0, t.setTexture2D(e || r, s);
+ this.type === i.SAMPLER_2D_SHADOW ? (NA.compareFunction = E0, r = NA) : r = K0, t.setTexture2D(e || r, s);
}
-function qC(i, e, t) {
+function qS(i, e, t) {
const n = this.cache, s = t.allocateTextureUnit();
- n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture3D(e || A0, s);
+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture3D(e || X0, s);
}
-function KC(i, e, t) {
+function KS(i, e, t) {
const n = this.cache, s = t.allocateTextureUnit();
- n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTextureCube(e || g0, s);
+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTextureCube(e || Y0, s);
}
-function jC(i, e, t) {
+function jS(i, e, t) {
const n = this.cache, s = t.allocateTextureUnit();
- n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture2DArray(e || p0, s);
+ n[0] !== s && (i.uniform1i(this.addr, s), n[0] = s), t.setTexture2DArray(e || j0, s);
}
-function XC(i) {
+function XS(i) {
switch (i) {
case 5126:
- return TC;
+ return TS;
// FLOAT
case 35664:
- return RC;
+ return RS;
// _VEC2
case 35665:
- return NC;
+ return FS;
// _VEC3
case 35666:
- return FC;
+ return DS;
// _VEC4
case 35674:
- return DC;
+ return NS;
// _MAT2
case 35675:
- return LC;
+ return LS;
// _MAT3
case 35676:
- return PC;
+ return PS;
// _MAT4
case 5124:
case 35670:
- return kC;
+ return kS;
// INT, BOOL
case 35667:
case 35671:
- return UC;
+ return US;
// _VEC2
case 35668:
case 35672:
- return OC;
+ return OS;
// _VEC3
case 35669:
case 35673:
- return QC;
+ return QS;
// _VEC4
case 5125:
- return GC;
+ return GS;
// UINT
case 36294:
- return HC;
+ return HS;
// _VEC2
case 36295:
- return zC;
+ return zS;
// _VEC3
case 36296:
- return VC;
+ return VS;
// _VEC4
case 35678:
// SAMPLER_2D
@@ -19832,13 +20448,13 @@ function XC(i) {
case 36306:
// UNSIGNED_INT_SAMPLER_2D
case 35682:
- return WC;
+ return WS;
case 35679:
// SAMPLER_3D
case 36299:
// INT_SAMPLER_3D
case 36307:
- return qC;
+ return qS;
case 35680:
// SAMPLER_CUBE
case 36300:
@@ -19846,7 +20462,7 @@ function XC(i) {
case 36308:
// UNSIGNED_INT_SAMPLER_CUBE
case 36293:
- return KC;
+ return KS;
case 36289:
// SAMPLER_2D_ARRAY
case 36303:
@@ -19854,134 +20470,134 @@ function XC(i) {
case 36311:
// UNSIGNED_INT_SAMPLER_2D_ARRAY
case 36292:
- return jC;
+ return jS;
}
}
-function YC(i, e) {
+function YS(i, e) {
i.uniform1fv(this.addr, e);
}
-function JC(i, e) {
- const t = Oa(e, this.size, 2);
+function JS(i, e) {
+ const t = ja(e, this.size, 2);
i.uniform2fv(this.addr, t);
}
-function ZC(i, e) {
- const t = Oa(e, this.size, 3);
+function ZS(i, e) {
+ const t = ja(e, this.size, 3);
i.uniform3fv(this.addr, t);
}
-function $C(i, e) {
- const t = Oa(e, this.size, 4);
+function $S(i, e) {
+ const t = ja(e, this.size, 4);
i.uniform4fv(this.addr, t);
}
-function eS(i, e) {
- const t = Oa(e, this.size, 4);
+function eI(i, e) {
+ const t = ja(e, this.size, 4);
i.uniformMatrix2fv(this.addr, !1, t);
}
-function tS(i, e) {
- const t = Oa(e, this.size, 9);
+function tI(i, e) {
+ const t = ja(e, this.size, 9);
i.uniformMatrix3fv(this.addr, !1, t);
}
-function nS(i, e) {
- const t = Oa(e, this.size, 16);
+function nI(i, e) {
+ const t = ja(e, this.size, 16);
i.uniformMatrix4fv(this.addr, !1, t);
}
-function iS(i, e) {
+function iI(i, e) {
i.uniform1iv(this.addr, e);
}
-function sS(i, e) {
+function sI(i, e) {
i.uniform2iv(this.addr, e);
}
-function rS(i, e) {
+function rI(i, e) {
i.uniform3iv(this.addr, e);
}
-function aS(i, e) {
+function aI(i, e) {
i.uniform4iv(this.addr, e);
}
-function oS(i, e) {
+function oI(i, e) {
i.uniform1uiv(this.addr, e);
}
-function cS(i, e) {
+function cI(i, e) {
i.uniform2uiv(this.addr, e);
}
-function lS(i, e) {
+function lI(i, e) {
i.uniform3uiv(this.addr, e);
}
-function hS(i, e) {
+function hI(i, e) {
i.uniform4uiv(this.addr, e);
}
-function uS(i, e, t) {
- const n = this.cache, s = e.length, r = ql(t, s);
- hn(n, r) || (i.uniform1iv(this.addr, r), un(n, r));
+function uI(i, e, t) {
+ const n = this.cache, s = e.length, r = mh(t, s);
+ gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
for (let a = 0; a !== s; ++a)
- t.setTexture2D(e[a] || f0, r[a]);
+ t.setTexture2D(e[a] || K0, r[a]);
}
-function dS(i, e, t) {
- const n = this.cache, s = e.length, r = ql(t, s);
- hn(n, r) || (i.uniform1iv(this.addr, r), un(n, r));
+function dI(i, e, t) {
+ const n = this.cache, s = e.length, r = mh(t, s);
+ gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
for (let a = 0; a !== s; ++a)
- t.setTexture3D(e[a] || A0, r[a]);
+ t.setTexture3D(e[a] || X0, r[a]);
}
-function fS(i, e, t) {
- const n = this.cache, s = e.length, r = ql(t, s);
- hn(n, r) || (i.uniform1iv(this.addr, r), un(n, r));
+function fI(i, e, t) {
+ const n = this.cache, s = e.length, r = mh(t, s);
+ gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
for (let a = 0; a !== s; ++a)
- t.setTextureCube(e[a] || g0, r[a]);
+ t.setTextureCube(e[a] || Y0, r[a]);
}
-function pS(i, e, t) {
- const n = this.cache, s = e.length, r = ql(t, s);
- hn(n, r) || (i.uniform1iv(this.addr, r), un(n, r));
+function pI(i, e, t) {
+ const n = this.cache, s = e.length, r = mh(t, s);
+ gn(n, r) || (i.uniform1iv(this.addr, r), mn(n, r));
for (let a = 0; a !== s; ++a)
- t.setTexture2DArray(e[a] || p0, r[a]);
+ t.setTexture2DArray(e[a] || j0, r[a]);
}
-function AS(i) {
+function AI(i) {
switch (i) {
case 5126:
- return YC;
+ return YS;
// FLOAT
case 35664:
- return JC;
+ return JS;
// _VEC2
case 35665:
- return ZC;
+ return ZS;
// _VEC3
case 35666:
- return $C;
+ return $S;
// _VEC4
case 35674:
- return eS;
+ return eI;
// _MAT2
case 35675:
- return tS;
+ return tI;
// _MAT3
case 35676:
- return nS;
+ return nI;
// _MAT4
case 5124:
case 35670:
- return iS;
+ return iI;
// INT, BOOL
case 35667:
case 35671:
- return sS;
+ return sI;
// _VEC2
case 35668:
case 35672:
- return rS;
+ return rI;
// _VEC3
case 35669:
case 35673:
- return aS;
+ return aI;
// _VEC4
case 5125:
- return oS;
+ return oI;
// UINT
case 36294:
- return cS;
+ return cI;
// _VEC2
case 36295:
- return lS;
+ return lI;
// _VEC3
case 36296:
- return hS;
+ return hI;
// _VEC4
case 35678:
// SAMPLER_2D
@@ -19992,13 +20608,13 @@ function AS(i) {
case 36306:
// UNSIGNED_INT_SAMPLER_2D
case 35682:
- return uS;
+ return uI;
case 35679:
// SAMPLER_3D
case 36299:
// INT_SAMPLER_3D
case 36307:
- return dS;
+ return dI;
case 35680:
// SAMPLER_CUBE
case 36300:
@@ -20006,7 +20622,7 @@ function AS(i) {
case 36308:
// UNSIGNED_INT_SAMPLER_CUBE
case 36293:
- return fS;
+ return fI;
case 36289:
// SAMPLER_2D_ARRAY
case 36303:
@@ -20014,20 +20630,20 @@ function AS(i) {
case 36311:
// UNSIGNED_INT_SAMPLER_2D_ARRAY
case 36292:
- return pS;
+ return pI;
}
}
-class gS {
+class gI {
constructor(e, t, n) {
- this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.setValue = XC(t.type);
+ this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.setValue = XS(t.type);
}
}
-class mS {
+class mI {
constructor(e, t, n) {
- this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = AS(t.type);
+ this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = AI(t.type);
}
}
-class bS {
+class xI {
constructor(e) {
this.id = e, this.seq = [], this.map = {};
}
@@ -20039,32 +20655,32 @@ class bS {
}
}
}
-const Wh = /(\w+)(\])?(\[|\.)?/g;
-function lA(i, e) {
+const gu = /(\w+)(\])?(\[|\.)?/g;
+function QA(i, e) {
i.seq.push(e), i.map[e.id] = e;
}
-function xS(i, e, t) {
+function bI(i, e, t) {
const n = i.name, s = n.length;
- for (Wh.lastIndex = 0; ; ) {
- const r = Wh.exec(n), a = Wh.lastIndex;
+ for (gu.lastIndex = 0; ; ) {
+ const r = gu.exec(n), a = gu.lastIndex;
let o = r[1];
const c = r[2] === "]", l = r[3];
if (c && (o = o | 0), l === void 0 || l === "[" && a + 2 === s) {
- lA(t, l === void 0 ? new gS(o, i, e) : new mS(o, i, e));
+ QA(t, l === void 0 ? new gI(o, i, e) : new mI(o, i, e));
break;
} else {
let u = t.map[o];
- u === void 0 && (u = new bS(o), lA(t, u)), t = u;
+ u === void 0 && (u = new xI(o), QA(t, u)), t = u;
}
}
}
-class ll {
+class Sl {
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);
- xS(r, a, this);
+ bI(r, a, this);
}
}
setValue(e, t, n, s) {
@@ -20090,13 +20706,13 @@ class ll {
return n;
}
}
-function hA(i, e, t) {
+function GA(i, e, t) {
const n = i.createShader(e);
return i.shaderSource(n, t), i.compileShader(n), n;
}
-const ES = 37297;
-let _S = 0;
-function yS(i, e) {
+const EI = 37297;
+let _I = 0;
+function yI(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++) {
@@ -20106,20 +20722,20 @@ function yS(i, e) {
return n.join(`
`);
}
-const uA = /* @__PURE__ */ new rt();
-function wS(i) {
- mt._getMatrix(uA, mt.workingColorSpace, i);
- const e = `mat3( ${uA.elements.map((t) => t.toFixed(4))} )`;
- switch (mt.getTransfer(i)) {
- case wl:
+const HA = /* @__PURE__ */ new at();
+function wI(i) {
+ rt._getMatrix(HA, rt.workingColorSpace, i);
+ const e = `mat3( ${HA.elements.map((t) => t.toFixed(4))} )`;
+ switch (rt.getTransfer(i)) {
+ case Gl:
return [e, "LinearTransferOETF"];
- case Mt:
+ case Rt:
return [e, "sRGBTransferOETF"];
default:
return console.warn("THREE.WebGLProgram: Unsupported color space: ", i), [e, "LinearTransferOETF"];
}
}
-function dA(i, e, t) {
+function zA(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);
@@ -20129,12 +20745,12 @@ function dA(i, e, t) {
` + s + `
-` + yS(i.getShaderSource(e), a);
+` + yI(i.getShaderSource(e), a);
} else
return s;
}
-function vS(i, e) {
- const t = wS(e);
+function vI(i, e) {
+ const t = wI(e);
return [
`vec4 ${i}( vec4 value ) {`,
` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,
@@ -20142,28 +20758,28 @@ function vS(i, e) {
].join(`
`);
}
-function CS(i, e) {
+function CI(i, e) {
let t;
switch (e) {
- case Hu:
+ case Ad:
t = "Linear";
break;
- case IE:
+ case u_:
t = "Reinhard";
break;
- case ME:
+ case d_:
t = "Cineon";
break;
- case Tm:
+ case c0:
t = "ACESFilmic";
break;
- case TE:
+ case p_:
t = "AgX";
break;
- case RE:
+ case A_:
t = "Neutral";
break;
- case BE:
+ case f_:
t = "Custom";
break;
default:
@@ -20171,10 +20787,10 @@ function CS(i, e) {
}
return "vec3 " + i + "( vec3 color ) { return " + t + "ToneMapping( color ); }";
}
-const kc = /* @__PURE__ */ new H();
-function SS() {
- mt.getLuminanceCoefficients(kc);
- const i = kc.x.toFixed(4), e = kc.y.toFixed(4), t = kc.z.toFixed(4);
+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);
return [
"float luminance( const in vec3 rgb ) {",
` const vec3 weights = vec3( ${i}, ${e}, ${t} );`,
@@ -20183,14 +20799,14 @@ function SS() {
].join(`
`);
}
-function IS(i) {
+function II(i) {
return [
i.extensionClipCullDistance ? "#extension GL_ANGLE_clip_cull_distance : require" : "",
i.extensionMultiDraw ? "#extension GL_ANGLE_multi_draw : require" : ""
- ].filter(ho).join(`
+ ].filter(_o).join(`
`);
}
-function MS(i) {
+function MI(i) {
const e = [];
for (const t in i) {
const n = i[t];
@@ -20199,7 +20815,7 @@ function MS(i) {
return e.join(`
`);
}
-function BS(i, e) {
+function BI(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;
@@ -20212,43 +20828,43 @@ function BS(i, e) {
}
return t;
}
-function ho(i) {
+function _o(i) {
return i !== "";
}
-function fA(i, e) {
+function VA(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 pA(i, e) {
+function WA(i, e) {
return i.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection);
}
-const TS = /^[ \t]*#include +<([\w\d./]+)>/gm;
-function gd(i) {
- return i.replace(TS, NS);
+const TI = /^[ \t]*#include +<([\w\d./]+)>/gm;
+function zd(i) {
+ return i.replace(TI, FI);
}
-const RS = /* @__PURE__ */ new Map();
-function NS(i, e) {
- let t = ot[e];
+const RI = /* @__PURE__ */ new Map();
+function FI(i, e) {
+ let t = lt[e];
if (t === void 0) {
- const n = RS.get(e);
+ const n = RI.get(e);
if (n !== void 0)
- t = ot[n], console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', e, n);
+ t = lt[n], console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', e, n);
else
throw new Error("Can not resolve #include <" + e + ">");
}
- return gd(t);
+ return zd(t);
}
-const FS = /#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 AA(i) {
- return i.replace(FS, DS);
+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);
}
-function DS(i, e, t, n) {
+function NI(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 gA(i) {
+function KA(i) {
let e = `precision ${i.precision} float;
precision ${i.precision} int;
precision ${i.precision} sampler2D;
@@ -20272,73 +20888,73 @@ function gA(i) {
#define MEDIUM_PRECISION` : i.precision === "lowp" && (e += `
#define LOW_PRECISION`), e;
}
-function LS(i) {
+function LI(i) {
let e = "SHADOWMAP_TYPE_BASIC";
- return i.shadowMapType === Mm ? e = "SHADOWMAP_TYPE_PCF" : i.shadowMapType === aE ? e = "SHADOWMAP_TYPE_PCF_SOFT" : i.shadowMapType === Ki && (e = "SHADOWMAP_TYPE_VSM"), e;
+ return i.shadowMapType === o0 ? e = "SHADOWMAP_TYPE_PCF" : i.shadowMapType === VE ? e = "SHADOWMAP_TYPE_PCF_SOFT" : i.shadowMapType === $i && (e = "SHADOWMAP_TYPE_VSM"), e;
}
-function PS(i) {
+function PI(i) {
let e = "ENVMAP_TYPE_CUBE";
if (i.envMap)
switch (i.envMapMode) {
- case br:
- case ya:
+ case Sr:
+ case Da:
e = "ENVMAP_TYPE_CUBE";
break;
- case Gl:
+ case lh:
e = "ENVMAP_TYPE_CUBE_UV";
break;
}
return e;
}
-function kS(i) {
+function kI(i) {
let e = "ENVMAP_MODE_REFLECTION";
- return i.envMap && i.envMapMode === ya && (e = "ENVMAP_MODE_REFRACTION"), e;
+ return i.envMap && i.envMapMode === Da && (e = "ENVMAP_MODE_REFRACTION"), e;
}
-function US(i) {
+function UI(i) {
let e = "ENVMAP_BLENDING_NONE";
if (i.envMap)
switch (i.combine) {
- case Bm:
+ case ch:
e = "ENVMAP_BLENDING_MULTIPLY";
break;
- case CE:
+ case l_:
e = "ENVMAP_BLENDING_MIX";
break;
- case SE:
+ case h_:
e = "ENVMAP_BLENDING_ADD";
break;
}
return e;
}
-function OS(i) {
+function OI(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 QS(i, e, t, n) {
+function QI(i, e, t, n) {
const s = i.getContext(), r = t.defines;
let a = t.vertexShader, o = t.fragmentShader;
- const c = LS(t), l = PS(t), h = kS(t), u = US(t), d = OS(t), f = IS(t), m = MS(r), g = s.createProgram();
- let A, p, y = t.glslVersion ? "#version " + t.glslVersion + `
+ 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 + `
` : "";
- t.isRawShaderMaterial ? (A = [
+ t.isRawShaderMaterial ? (g = [
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
- m
- ].filter(ho).join(`
-`), A.length > 0 && (A += `
-`), p = [
+ p
+ ].filter(_o).join(`
+`), g.length > 0 && (g += `
+`), A = [
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
- m
- ].filter(ho).join(`
-`), p.length > 0 && (p += `
-`)) : (A = [
- gA(t),
+ p
+ ].filter(_o).join(`
+`), A.length > 0 && (A += `
+`)) : (g = [
+ KA(t),
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
- m,
+ p,
t.extensionClipCullDistance ? "#define USE_CLIP_DISTANCE" : "",
t.batching ? "#define USE_BATCHING" : "",
t.batchingColor ? "#define USE_BATCHING_COLOR" : "",
@@ -20466,12 +21082,12 @@ function QS(i, e, t, n) {
"#endif",
`
`
- ].filter(ho).join(`
-`), p = [
- gA(t),
+ ].filter(_o).join(`
+`), A = [
+ KA(t),
"#define SHADER_TYPE " + t.shaderType,
"#define SHADER_NAME " + t.shaderName,
- m,
+ p,
t.useFog && t.fog ? "#define USE_FOG" : "",
t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "",
t.alphaToCoverage ? "#define ALPHA_TO_COVERAGE" : "",
@@ -20537,32 +21153,32 @@ function QS(i, e, t, n) {
"uniform mat4 viewMatrix;",
"uniform vec3 cameraPosition;",
"uniform bool isOrthographic;",
- t.toneMapping !== Ls ? "#define TONE_MAPPING" : "",
- t.toneMapping !== Ls ? ot.tonemapping_pars_fragment : "",
+ 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 !== Ls ? CS("toneMapping", t.toneMapping) : "",
+ t.toneMapping !== Hs ? CI("toneMapping", t.toneMapping) : "",
t.dithering ? "#define DITHERING" : "",
t.opaque ? "#define OPAQUE" : "",
- ot.colorspace_pars_fragment,
+ lt.colorspace_pars_fragment,
// this code is required here because it is used by the various encoding/decoding function defined below
- vS("linearToOutputTexel", t.outputColorSpace),
- SS(),
+ vI("linearToOutputTexel", t.outputColorSpace),
+ SI(),
t.useDepthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "",
`
`
- ].filter(ho).join(`
-`)), a = gd(a), a = fA(a, t), a = pA(a, t), o = gd(o), o = fA(o, t), o = pA(o, t), a = AA(a), o = AA(o), t.isRawShaderMaterial !== !0 && (y = `#version 300 es
-`, A = [
+ ].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
+`, g = [
f,
"#define attribute in",
"#define varying out",
"#define texture2D texture"
].join(`
`) + `
-` + A, p = [
+` + g, A = [
"#define varying in",
- t.glslVersion === hp ? "" : "layout(location = 0) out highp vec4 pc_fragColor;",
- t.glslVersion === hp ? "" : "#define gl_FragColor pc_fragColor",
+ t.glslVersion === Up ? "" : "layout(location = 0) out highp vec4 pc_fragColor;",
+ t.glslVersion === Up ? "" : "#define gl_FragColor pc_fragColor",
"#define gl_FragDepthEXT gl_FragDepth",
"#define texture2D texture",
"#define textureCube texture",
@@ -20575,20 +21191,20 @@ function QS(i, e, t, n) {
"#define textureCubeGradEXT textureGrad"
].join(`
`) + `
-` + p);
- const b = y + A + a, _ = y + p + o, M = hA(s, s.VERTEX_SHADER, b), w = hA(s, s.FRAGMENT_SHADER, _);
- s.attachShader(g, M), s.attachShader(g, w), t.index0AttributeName !== void 0 ? s.bindAttribLocation(g, 0, t.index0AttributeName) : t.morphTargets === !0 && s.bindAttribLocation(g, 0, "position"), s.linkProgram(g);
+` + 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) {
if (i.debug.checkShaderErrors) {
- const K = s.getProgramInfoLog(g).trim(), q = s.getShaderInfoLog(M).trim(), $ = s.getShaderInfoLog(w).trim();
- let D = !0, O = !0;
- if (s.getProgramParameter(g, s.LINK_STATUS) === !1)
- if (D = !1, typeof i.debug.onShaderError == "function")
- i.debug.onShaderError(s, g, M, w);
+ 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 = dA(s, M, "vertex"), Q = dA(s, w, "fragment");
+ const Y = zA(s, I, "vertex"), Q = zA(s, w, "fragment");
console.error(
- "THREE.WebGLProgram: Shader Error " + s.getError() + " - VALIDATE_STATUS " + s.getProgramParameter(g, s.VALIDATE_STATUS) + `
+ "THREE.WebGLProgram: Shader Error " + s.getError() + " - VALIDATE_STATUS " + s.getProgramParameter(m, s.VALIDATE_STATUS) + `
Material Name: ` + F.name + `
Material Type: ` + F.type + `
@@ -20600,19 +21216,19 @@ Program Info Log: ` + K + `
}
else K !== "" ? console.warn("THREE.WebGLProgram: Program Info Log:", K) : (q === "" || $ === "") && (O = !1);
O && (F.diagnostics = {
- runnable: D,
+ runnable: N,
programLog: K,
vertexShader: {
log: q,
- prefix: A
+ prefix: g
},
fragmentShader: {
log: $,
- prefix: p
+ prefix: A
}
});
}
- s.deleteShader(M), s.deleteShader(w), T = new ll(s, g), C = BS(s, g);
+ s.deleteShader(I), s.deleteShader(w), T = new Sl(s, m), C = BI(s, m);
}
let T;
this.getUniforms = function() {
@@ -20624,13 +21240,13 @@ Program Info Log: ` + K + `
};
let v = t.rendererExtensionParallelShaderCompile === !1;
return this.isReady = function() {
- return v === !1 && (v = s.getProgramParameter(g, ES)), v;
+ return v === !1 && (v = s.getProgramParameter(m, EI)), v;
}, this.destroy = function() {
- n.releaseStatesOfProgram(this), s.deleteProgram(g), this.program = void 0;
- }, this.type = t.shaderType, this.name = t.shaderName, this.id = _S++, this.cacheKey = e, this.usedTimes = 1, this.program = g, this.vertexShader = M, this.fragmentShader = w, this;
+ 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;
}
-let GS = 0;
-class HS {
+let GI = 0;
+class HI {
constructor() {
this.shaderCache = /* @__PURE__ */ new Map(), this.materialCache = /* @__PURE__ */ new Map();
}
@@ -20661,18 +21277,18 @@ class HS {
_getShaderStage(e) {
const t = this.shaderCache;
let n = t.get(e);
- return n === void 0 && (n = new zS(e), t.set(e, n)), n;
+ return n === void 0 && (n = new zI(e), t.set(e, n)), n;
}
}
-class zS {
+class zI {
constructor(e) {
- this.id = GS++, this.code = e, this.usedTimes = 0;
+ this.id = GI++, this.code = e, this.usedTimes = 0;
}
}
-function VS(i, e, t, n, s, r, a) {
- const o = new jm(), c = new HS(), l = /* @__PURE__ */ new Set(), h = [], u = s.logarithmicDepthBuffer, d = s.vertexTextures;
+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;
let f = s.precision;
- const m = {
+ const p = {
MeshDepthMaterial: "depth",
MeshDistanceMaterial: "distanceRGBA",
MeshNormalMaterial: "normal",
@@ -20689,25 +21305,25 @@ function VS(i, e, t, n, s, r, a) {
ShadowMaterial: "shadow",
SpriteMaterial: "sprite"
};
- function g(C) {
+ function m(C) {
return l.add(C), C === 0 ? "uv" : `uv${C}`;
}
- function A(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 === Gl ? Y.image.height : null, J = m[C.type];
+ 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];
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;
+ const ee = N.morphAttributes.position || N.morphAttributes.normal || N.morphAttributes.color, ae = ee !== void 0 ? ee.length : 0;
let ye = 0;
- D.morphAttributes.position !== void 0 && (ye = 1), D.morphAttributes.normal !== void 0 && (ye = 2), D.morphAttributes.color !== void 0 && (ye = 3);
- let Me, se, me, be;
+ N.morphAttributes.position !== void 0 && (ye = 1), N.morphAttributes.normal !== void 0 && (ye = 2), N.morphAttributes.color !== void 0 && (ye = 3);
+ let Me, se, me, xe;
if (J) {
- const _t = Bi[J];
- Me = _t.vertexShader, se = _t.fragmentShader;
+ const Ct = ki[J];
+ Me = Ct.vertexShader, se = Ct.fragmentShader;
} else
- Me = C.vertexShader, se = C.fragmentShader, c.update(C), me = c.getVertexShaderID(C), be = c.getFragmentShaderID(C);
- const xe = i.getRenderTarget(), Pe = i.state.buffers.depth.getReversed(), $e = q.isInstancedMesh === !0, Qe = q.isBatchedMesh === !0, vt = !!C.map, lt = !!C.matcap, Je = !!Y, G = !!C.aoMap, dn = !!C.lightMap, dt = !!C.bumpMap, pt = !!C.normalMap, ze = !!C.displacementMap, Rt = !!C.emissiveMap, Ge = !!C.metalnessMap, L = !!C.roughnessMap, I = C.anisotropy > 0, Z = C.clearcoat > 0, le = C.dispersion > 0, pe = C.iridescence > 0, oe = C.sheen > 0, Ue = C.transmission > 0, ve = I && !!C.anisotropyMap, Ve = Z && !!C.clearcoatMap, Ye = Z && !!C.clearcoatNormalMap, Ee = Z && !!C.clearcoatRoughnessMap, Re = pe && !!C.iridescenceMap, ke = pe && !!C.iridescenceThicknessMap, Oe = oe && !!C.sheenColorMap, Be = oe && !!C.sheenRoughnessMap, et = !!C.specularMap, We = !!C.specularColorMap, tt = !!C.specularIntensityMap, W = Ue && !!C.transmissionMap, ne = Ue && !!C.thicknessMap, re = !!C.gradientMap, de = !!C.alphaMap, Ie = C.alphaTest > 0, Ce = !!C.alphaHash, nt = !!C.extensions;
- let Ut = Ls;
- C.toneMapped && (xe === null || xe.isXRRenderTarget === !0) && (Ut = i.toneMapping);
- const fn = {
+ 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, 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;
+ let Qt = Hs;
+ C.toneMapped && (be === null || be.isXRRenderTarget === !0) && (Qt = i.toneMapping);
+ const bn = {
shaderID: J,
shaderType: C.type,
shaderName: C.name,
@@ -20715,98 +21331,98 @@ function VS(i, e, t, n, s, r, a) {
fragmentShader: se,
defines: C.defines,
customVertexShaderID: me,
- customFragmentShaderID: be,
+ customFragmentShaderID: xe,
isRawShaderMaterial: C.isRawShaderMaterial === !0,
glslVersion: C.glslVersion,
precision: f,
- batching: Qe,
- batchingColor: Qe && q._colorsTexture !== null,
- instancing: $e,
- instancingColor: $e && q.instanceColor !== null,
- instancingMorph: $e && q.morphTexture !== null,
+ batching: He,
+ batchingColor: He && q._colorsTexture !== null,
+ instancing: et,
+ instancingColor: et && q.instanceColor !== null,
+ instancingMorph: et && q.morphTexture !== null,
supportsVertexTextures: d,
- outputColorSpace: xe === null ? i.outputColorSpace : xe.isXRRenderTarget === !0 ? xe.texture.colorSpace : ln,
+ outputColorSpace: be === null ? i.outputColorSpace : be.isXRRenderTarget === !0 ? be.texture.colorSpace : An,
alphaToCoverage: !!C.alphaToCoverage,
- map: vt,
- matcap: lt,
- envMap: Je,
- envMapMode: Je && Y.mapping,
+ map: It,
+ matcap: ht,
+ envMap: $e,
+ envMapMode: $e && Y.mapping,
envMapCubeUVHeight: Q,
- aoMap: G,
- lightMap: dn,
- bumpMap: dt,
- normalMap: pt,
- displacementMap: d && ze,
- emissiveMap: Rt,
- normalMapObjectSpace: pt && C.normalMapType === UE,
- normalMapTangentSpace: pt && C.normalMapType === Hm,
- metalnessMap: Ge,
+ aoMap: H,
+ lightMap: xn,
+ bumpMap: pt,
+ normalMap: gt,
+ displacementMap: d && We,
+ emissiveMap: Nt,
+ normalMapObjectSpace: gt && C.normalMapType === y_,
+ normalMapTangentSpace: gt && C.normalMapType === hh,
+ metalnessMap: ze,
roughnessMap: L,
- anisotropy: I,
+ anisotropy: M,
anisotropyMap: ve,
clearcoat: Z,
- clearcoatMap: Ve,
- clearcoatNormalMap: Ye,
+ clearcoatMap: qe,
+ clearcoatNormalMap: Je,
clearcoatRoughnessMap: Ee,
dispersion: le,
iridescence: pe,
iridescenceMap: Re,
- iridescenceThicknessMap: ke,
+ iridescenceThicknessMap: Oe,
sheen: oe,
- sheenColorMap: Oe,
+ sheenColorMap: Ge,
sheenRoughnessMap: Be,
- specularMap: et,
- specularColorMap: We,
- specularIntensityMap: tt,
- transmission: Ue,
+ specularMap: tt,
+ specularColorMap: Ke,
+ specularIntensityMap: nt,
+ transmission: Qe,
transmissionMap: W,
thicknessMap: ne,
gradientMap: re,
- opaque: C.transparent === !1 && C.blending === ha && C.alphaToCoverage === !1,
+ opaque: C.transparent === !1 && C.blending === ya && C.alphaToCoverage === !1,
alphaMap: de,
alphaTest: Ie,
alphaHash: Ce,
combine: C.combine,
//
- mapUv: vt && g(C.map.channel),
- aoMapUv: G && g(C.aoMap.channel),
- lightMapUv: dn && g(C.lightMap.channel),
- bumpMapUv: dt && g(C.bumpMap.channel),
- normalMapUv: pt && g(C.normalMap.channel),
- displacementMapUv: ze && g(C.displacementMap.channel),
- emissiveMapUv: Rt && g(C.emissiveMap.channel),
- metalnessMapUv: Ge && g(C.metalnessMap.channel),
- roughnessMapUv: L && g(C.roughnessMap.channel),
- anisotropyMapUv: ve && g(C.anisotropyMap.channel),
- clearcoatMapUv: Ve && g(C.clearcoatMap.channel),
- clearcoatNormalMapUv: Ye && g(C.clearcoatNormalMap.channel),
- clearcoatRoughnessMapUv: Ee && g(C.clearcoatRoughnessMap.channel),
- iridescenceMapUv: Re && g(C.iridescenceMap.channel),
- iridescenceThicknessMapUv: ke && g(C.iridescenceThicknessMap.channel),
- sheenColorMapUv: Oe && g(C.sheenColorMap.channel),
- sheenRoughnessMapUv: Be && g(C.sheenRoughnessMap.channel),
- specularMapUv: et && g(C.specularMap.channel),
- specularColorMapUv: We && g(C.specularColorMap.channel),
- specularIntensityMapUv: tt && g(C.specularIntensityMap.channel),
- transmissionMapUv: W && g(C.transmissionMap.channel),
- thicknessMapUv: ne && g(C.thicknessMap.channel),
- alphaMapUv: de && g(C.alphaMap.channel),
+ mapUv: It && 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),
+ 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: Je && m(C.clearcoatNormalMap.channel),
+ clearcoatRoughnessMapUv: Ee && m(C.clearcoatRoughnessMap.channel),
+ iridescenceMapUv: Re && m(C.iridescenceMap.channel),
+ iridescenceThicknessMapUv: Oe && m(C.iridescenceThicknessMap.channel),
+ sheenColorMapUv: Ge && m(C.sheenColorMap.channel),
+ sheenRoughnessMapUv: Be && m(C.sheenRoughnessMap.channel),
+ specularMapUv: tt && m(C.specularMap.channel),
+ specularColorMapUv: Ke && m(C.specularColorMap.channel),
+ specularIntensityMapUv: nt && 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 && (pt || I),
+ vertexTangents: !!N.attributes.tangent && (gt || M),
vertexColors: C.vertexColors,
- vertexAlphas: C.vertexColors === !0 && !!D.attributes.color && D.attributes.color.itemSize === 4,
- pointsUvs: q.isPoints === !0 && !!D.attributes.uv && (vt || de),
+ vertexAlphas: C.vertexColors === !0 && !!N.attributes.color && N.attributes.color.itemSize === 4,
+ pointsUvs: q.isPoints === !0 && !!N.attributes.uv && (It || de),
fog: !!$,
useFog: C.fog === !0,
fogExp2: !!$ && $.isFogExp2,
flatShading: C.flatShading === !0,
sizeAttenuation: C.sizeAttenuation === !0,
logarithmicDepthBuffer: u,
- reverseDepthBuffer: Pe,
+ reverseDepthBuffer: Ue,
skinning: q.isSkinnedMesh === !0,
- morphTargets: D.morphAttributes.position !== void 0,
- morphNormals: D.morphAttributes.normal !== void 0,
- morphColors: D.morphAttributes.color !== void 0,
+ morphTargets: N.morphAttributes.position !== void 0,
+ morphNormals: N.morphAttributes.normal !== void 0,
+ morphColors: N.morphAttributes.color !== void 0,
morphTargetsCount: ae,
morphTextureStride: ye,
numDirLights: v.directional.length,
@@ -20825,46 +21441,46 @@ function VS(i, e, t, n, s, r, a) {
dithering: C.dithering,
shadowMapEnabled: i.shadowMap.enabled && F.length > 0,
shadowMapType: i.shadowMap.type,
- toneMapping: Ut,
- decodeVideoTexture: vt && C.map.isVideoTexture === !0 && mt.getTransfer(C.map.colorSpace) === Mt,
- decodeVideoTextureEmissive: Rt && C.emissiveMap.isVideoTexture === !0 && mt.getTransfer(C.emissiveMap.colorSpace) === Mt,
+ 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,
premultipliedAlpha: C.premultipliedAlpha,
- doubleSided: C.side === Ti,
- flipSided: C.side === Ln,
+ doubleSided: C.side === Ui,
+ flipSided: C.side === Vn,
useDepthPacking: C.depthPacking >= 0,
depthPacking: C.depthPacking || 0,
index0AttributeName: C.index0AttributeName,
- extensionClipCullDistance: nt && C.extensions.clipCullDistance === !0 && n.has("WEBGL_clip_cull_distance"),
- extensionMultiDraw: (nt && C.extensions.multiDraw === !0 || Qe) && n.has("WEBGL_multi_draw"),
+ extensionClipCullDistance: it && C.extensions.clipCullDistance === !0 && n.has("WEBGL_clip_cull_distance"),
+ extensionMultiDraw: (it && C.extensions.multiDraw === !0 || He) && n.has("WEBGL_multi_draw"),
rendererExtensionParallelShaderCompile: n.has("KHR_parallel_shader_compile"),
customProgramCacheKey: C.customProgramCacheKey()
};
- return fn.vertexUv1s = l.has(1), fn.vertexUv2s = l.has(2), fn.vertexUv3s = l.has(3), l.clear(), fn;
+ return bn.vertexUv1s = l.has(1), bn.vertexUv2s = l.has(2), bn.vertexUv3s = l.has(3), l.clear(), bn;
}
- function p(C) {
+ 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 && (y(v, C), b(v, C), v.push(i.outputColorSpace)), v.push(C.customProgramCacheKey), v.join();
+ return C.isRawShaderMaterial === !1 && (y(v, C), x(v, C), v.push(i.outputColorSpace)), v.push(C.customProgramCacheKey), v.join();
}
function y(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 b(C, v) {
+ 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 _(C) {
- const v = m[C.type];
+ function E(C) {
+ const v = p[C.type];
let F;
if (v) {
- const K = Bi[v];
- F = N_.clone(K.uniforms);
+ const K = ki[v];
+ F = gy.clone(K.uniforms);
} else
F = C.uniforms;
return F;
}
- function M(C, v) {
+ function I(C, v) {
let F;
for (let K = 0, q = h.length; K < q; K++) {
const $ = h[K];
@@ -20873,7 +21489,7 @@ function VS(i, e, t, n, s, r, a) {
break;
}
}
- return F === void 0 && (F = new QS(i, v, C, r), h.push(F)), F;
+ return F === void 0 && (F = new QI(i, v, C, r), h.push(F)), F;
}
function w(C) {
if (--C.usedTimes === 0) {
@@ -20888,10 +21504,10 @@ function VS(i, e, t, n, s, r, a) {
c.dispose();
}
return {
- getParameters: A,
- getProgramCacheKey: p,
- getUniforms: _,
- acquireProgram: M,
+ getParameters: g,
+ getProgramCacheKey: A,
+ getUniforms: E,
+ acquireProgram: I,
releaseProgram: w,
releaseShaderCache: S,
// Exposed for resource monitoring & error feedback via renderer.info:
@@ -20899,7 +21515,7 @@ function VS(i, e, t, n, s, r, a) {
dispose: T
};
}
-function WS() {
+function WI() {
let i = /* @__PURE__ */ new WeakMap();
function e(a) {
return i.has(a);
@@ -20925,42 +21541,42 @@ function WS() {
dispose: r
};
}
-function qS(i, e) {
+function qI(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 mA(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 bA() {
+function XA() {
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, m, g, A) {
- let p = i[e];
- return p === void 0 ? (p = {
+ 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: m,
+ groupOrder: p,
renderOrder: u.renderOrder,
- z: g,
- group: A
- }, i[e] = p) : (p.id = u.id, p.object = u, p.geometry = d, p.material = f, p.groupOrder = m, p.renderOrder = u.renderOrder, p.z = g, p.group = A), e++, p;
+ 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, m, g, A) {
- const p = a(u, d, f, m, g, A);
- f.transmission > 0 ? n.push(p) : f.transparent === !0 ? s.push(p) : t.push(p);
+ 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, m, g, A) {
- const p = a(u, d, f, m, g, A);
- f.transmission > 0 ? n.unshift(p) : f.transparent === !0 ? s.unshift(p) : t.unshift(p);
+ 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 || qS), n.length > 1 && n.sort(d || mA), s.length > 1 && s.sort(d || mA);
+ t.length > 1 && t.sort(u || qI), 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++) {
@@ -20980,12 +21596,12 @@ function bA() {
sort: l
};
}
-function KS() {
+function KI() {
let i = /* @__PURE__ */ new WeakMap();
function e(n, s) {
const r = i.get(n);
let a;
- return r === void 0 ? (a = new bA(), i.set(n, [a])) : s >= r.length ? (a = new bA(), r.push(a)) : a = r[s], 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;
}
function t() {
i = /* @__PURE__ */ new WeakMap();
@@ -20995,7 +21611,7 @@ function KS() {
dispose: t
};
}
-function jS() {
+function jI() {
const i = {};
return {
get: function(e) {
@@ -21005,15 +21621,15 @@ function jS() {
switch (e.type) {
case "DirectionalLight":
t = {
- direction: new H(),
- color: new je()
+ direction: new G(),
+ color: new Le()
};
break;
case "SpotLight":
t = {
- position: new H(),
- direction: new H(),
- color: new je(),
+ position: new G(),
+ direction: new G(),
+ color: new Le(),
distance: 0,
coneCos: 0,
penumbraCos: 0,
@@ -21022,25 +21638,25 @@ function jS() {
break;
case "PointLight":
t = {
- position: new H(),
- color: new je(),
+ position: new G(),
+ color: new Le(),
distance: 0,
decay: 0
};
break;
case "HemisphereLight":
t = {
- direction: new H(),
- skyColor: new je(),
- groundColor: new je()
+ direction: new G(),
+ skyColor: new Le(),
+ groundColor: new Le()
};
break;
case "RectAreaLight":
t = {
- color: new je(),
- position: new H(),
- halfWidth: new H(),
- halfHeight: new H()
+ color: new Le(),
+ position: new G(),
+ halfWidth: new G(),
+ halfHeight: new G()
};
break;
}
@@ -21048,7 +21664,7 @@ function jS() {
}
};
}
-function XS() {
+function XI() {
const i = {};
return {
get: function(e) {
@@ -21090,12 +21706,12 @@ function XS() {
}
};
}
-let YS = 0;
-function JS(i, e) {
+let YI = 0;
+function JI(i, e) {
return (e.castShadow ? 2 : 0) - (i.castShadow ? 2 : 0) + (e.map ? 1 : 0) - (i.map ? 1 : 0);
}
-function ZS(i) {
- const e = new jS(), t = XS(), n = {
+function ZI(i) {
+ const e = new jI(), t = XI(), n = {
version: 0,
hash: {
directionalLength: -1,
@@ -21131,15 +21747,15 @@ function ZS(i) {
numSpotLightShadowsWithMaps: 0,
numLightProbes: 0
};
- for (let l = 0; l < 9; l++) n.probe.push(new H());
- const s = new H(), r = new st(), a = new st();
+ for (let l = 0; l < 9; l++) n.probe.push(new G());
+ const s = new G(), r = new De(), a = new De();
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, m = 0, g = 0, A = 0, p = 0, y = 0, b = 0, _ = 0, M = 0, w = 0, S = 0;
- l.sort(JS);
+ 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);
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;
+ 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) {
@@ -21150,57 +21766,57 @@ function ZS(i) {
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, 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] = N, n.directionalShadowMatrix[f] = F.shadow.matrix, y++;
}
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[g] = O;
+ 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[M] = F.map, M++, Y.updateMatrices(F), F.castShadow && w++), n.spotLightMatrix[g] = Y.matrix, F.castShadow) {
+ 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[g] = Q, n.spotShadowMap[g] = D, _++;
+ 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++;
}
- g++;
+ m++;
} else if (F.isRectAreaLight) {
const O = e.get(F);
- O.color.copy(K).multiplyScalar(q), O.halfWidth.set(F.width * 0.5, 0, 0), O.halfHeight.set(0, F.height * 0.5, 0), n.rectArea[A] = O, A++;
+ O.color.copy(K).multiplyScalar(q), O.halfWidth.set(F.width * 0.5, 0, 0), O.halfHeight.set(0, F.height * 0.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[m] = Q, n.pointShadowMap[m] = D, n.pointShadowMatrix[m] = F.shadow.matrix, b++;
+ 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[m] = O, m++;
+ 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[p] = O, p++;
+ O.skyColor.copy(F.color).multiplyScalar(q), O.groundColor.copy(F.groundColor).multiplyScalar(q), n.hemi[A] = O, A++;
}
}
- A > 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;
+ 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 !== m || T.spotLength !== g || T.rectAreaLength !== A || T.hemiLength !== p || T.numDirectionalShadows !== y || T.numPointShadows !== b || T.numSpotShadows !== _ || T.numSpotMaps !== M || T.numLightProbes !== S) && (n.directional.length = f, n.spot.length = g, n.rectArea.length = A, n.point.length = m, n.hemi.length = p, n.directionalShadow.length = y, n.directionalShadowMap.length = y, n.pointShadow.length = b, n.pointShadowMap.length = b, n.spotShadow.length = _, n.spotShadowMap.length = _, n.directionalShadowMatrix.length = y, n.pointShadowMatrix.length = b, n.spotLightMatrix.length = _ + M - w, n.spotLightMap.length = M, n.numSpotLightShadowsWithMaps = w, n.numLightProbes = S, T.directionalLength = f, T.pointLength = m, T.spotLength = g, T.rectAreaLength = A, T.hemiLength = p, T.numDirectionalShadows = y, T.numPointShadows = b, T.numSpotShadows = _, T.numSpotMaps = M, T.numLightProbes = S, n.version = YS++);
+ (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++);
}
function c(l, h) {
- let u = 0, d = 0, f = 0, m = 0, g = 0;
- const A = h.matrixWorldInverse;
- for (let p = 0, y = l.length; p < y; p++) {
- const b = l[p];
- if (b.isDirectionalLight) {
- const _ = n.directional[u];
- _.direction.setFromMatrixPosition(b.matrixWorld), s.setFromMatrixPosition(b.target.matrixWorld), _.direction.sub(s), _.direction.transformDirection(A), u++;
- } else if (b.isSpotLight) {
- const _ = n.spot[f];
- _.position.setFromMatrixPosition(b.matrixWorld), _.position.applyMatrix4(A), _.direction.setFromMatrixPosition(b.matrixWorld), s.setFromMatrixPosition(b.target.matrixWorld), _.direction.sub(s), _.direction.transformDirection(A), f++;
- } else if (b.isRectAreaLight) {
- const _ = n.rectArea[m];
- _.position.setFromMatrixPosition(b.matrixWorld), _.position.applyMatrix4(A), a.identity(), r.copy(b.matrixWorld), r.premultiply(A), a.extractRotation(r), _.halfWidth.set(b.width * 0.5, 0, 0), _.halfHeight.set(0, b.height * 0.5, 0), _.halfWidth.applyMatrix4(a), _.halfHeight.applyMatrix4(a), m++;
- } else if (b.isPointLight) {
- const _ = n.point[d];
- _.position.setFromMatrixPosition(b.matrixWorld), _.position.applyMatrix4(A), d++;
- } else if (b.isHemisphereLight) {
- const _ = n.hemi[g];
- _.direction.setFromMatrixPosition(b.matrixWorld), _.direction.transformDirection(A), g++;
+ 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++) {
+ 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 * 0.5, 0, 0), E.halfHeight.set(0, x.height * 0.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++;
}
}
}
@@ -21210,8 +21826,8 @@ function ZS(i) {
state: n
};
}
-function xA(i) {
- const e = new ZS(i), t = [], n = [];
+function YA(i) {
+ const e = new ZI(i), t = [], n = [];
function s(h) {
l.camera = h, t.length = 0, n.length = 0;
}
@@ -21243,12 +21859,12 @@ function xA(i) {
pushShadow: a
};
}
-function $S(i) {
+function $I(i) {
let e = /* @__PURE__ */ new WeakMap();
function t(s, r = 0) {
const a = e.get(s);
let o;
- return a === void 0 ? (o = new xA(i), e.set(s, [o])) : r >= a.length ? (o = new xA(i), a.push(o)) : o = a[r], 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;
}
function n() {
e = /* @__PURE__ */ new WeakMap();
@@ -21258,9 +21874,9 @@ function $S(i) {
dispose: n
};
}
-const eI = `void main() {
+const e1 = `void main() {
gl_Position = vec4( position, 1.0 );
-}`, tI = `uniform sampler2D shadow_pass;
+}`, t1 = `uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
@@ -21287,9 +21903,9 @@ void main() {
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;
-function nI(i, e, t) {
- let n = new gf();
- const s = new Ze(), r = new Ze(), a = new wt(), o = new X_({ depthPacking: kE }), c = new Y_(), l = {}, h = t.maxTextureSize, u = { [us]: Ln, [Ln]: us, [Ti]: Ti }, d = new Os({
+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({
defines: {
VSM_SAMPLES: 8
},
@@ -21298,28 +21914,28 @@ function nI(i, e, t) {
resolution: { value: new Ze() },
radius: { value: 4 }
},
- vertexShader: eI,
- fragmentShader: tI
+ vertexShader: e1,
+ fragmentShader: t1
}), f = d.clone();
f.defines.HORIZONTAL_PASS = 1;
- const m = new Hn();
- m.setAttribute(
+ const p = new Tn();
+ p.setAttribute(
"position",
- new _n(
+ new Bn(
new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]),
3
)
);
- const g = new Jt(m, d), A = this;
- this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = Mm;
- let p = this.type;
+ const m = new Zt(p, d), g = this;
+ this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = o0;
+ let A = this.type;
this.render = function(w, S, T) {
- if (A.enabled === !1 || A.autoUpdate === !1 && A.needsUpdate === !1 || w.length === 0) return;
+ 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(Ds), K.buffers.color.setClear(1, 1, 1, 1), K.buffers.depth.setTest(!0), K.setScissorTest(!1);
- const q = p !== Ki && this.type === Ki, $ = p === Ki && this.type !== Ki;
- for (let D = 0, O = w.length; D < O; D++) {
- const Y = w[D], Q = Y.shadow;
+ 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;
if (Q === void 0) {
console.warn("THREE.WebGLShadowMap:", Y, "has no shadow.");
continue;
@@ -21328,8 +21944,8 @@ function nI(i, e, t) {
s.copy(Q.mapSize);
const J = Q.getFrameExtents();
if (s.multiply(J), r.copy(Q.mapSize), (s.x > h || s.y > h) && (s.x > h && (r.x = Math.floor(h / J.x), s.x = r.x * J.x, Q.mapSize.x = r.x), s.y > h && (r.y = Math.floor(h / J.y), s.y = r.y * J.y, Q.mapSize.y = r.y)), Q.map === null || q === !0 || $ === !0) {
- const ae = this.type !== Ki ? { minFilter: Pn, magFilter: Pn } : {};
- Q.map !== null && Q.map.dispose(), Q.map = new Er(s.x, s.y, ae), Q.map.texture.name = Y.name + ".shadowMap", Q.camera.updateProjectionMatrix();
+ 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();
}
i.setRenderTarget(Q.map), i.clear();
const ee = Q.getViewportCount();
@@ -21340,17 +21956,17 @@ function nI(i, e, t) {
r.y * ye.y,
r.x * ye.z,
r.y * ye.w
- ), K.viewport(a), Q.updateMatrices(Y, ae), n = Q.getFrustum(), _(S, T, Q.camera, Y, this.type);
+ ), K.viewport(a), Q.updateMatrices(Y, ae), n = Q.getFrustum(), E(S, T, Q.camera, Y, this.type);
}
- Q.isPointLightShadow !== !0 && this.type === Ki && y(Q, T), Q.needsUpdate = !1;
+ Q.isPointLightShadow !== !0 && this.type === $i && y(Q, T), Q.needsUpdate = !1;
}
- p = this.type, A.needsUpdate = !1, i.setRenderTarget(C, v, F);
+ A = this.type, g.needsUpdate = !1, i.setRenderTarget(C, v, F);
};
function y(w, S) {
- const T = e.update(g);
- 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 Er(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, g, 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, g, null);
+ 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);
}
- function b(w, S, T, C) {
+ function x(w, S, T, C) {
let v = null;
const F = T.isPointLight === !0 ? w.customDistanceMaterial : w.customDepthMaterial;
if (F !== void 0)
@@ -21359,62 +21975,62 @@ function nI(i, e, t) {
const K = v.uuid, q = S.uuid;
let $ = l[K];
$ === void 0 && ($ = {}, l[K] = $);
- let D = $[q];
- D === void 0 && (D = v.clone(), $[q] = D, S.addEventListener("dispose", M)), v = D;
+ 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 === Ki ? 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 = 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) {
const K = i.properties.get(v);
K.light = T;
}
return v;
}
- function _(w, S, T, C, 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 === Ki) && (!w.frustumCulled || n.intersectsObject(w))) {
+ if (w.layers.test(S.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 D = q.groups;
- for (let O = 0, Y = D.length; O < Y; O++) {
- const Q = D[O], J = $[Q.materialIndex];
+ 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 = b(w, J, C, v);
+ 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 D = b(w, $, C, v);
- w.onBeforeShadow(i, w, S, T, q, D, null), i.renderBufferDirect(T, null, q, D, w, null), w.onAfterShadow(i, w, S, T, q, D, null);
+ 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++)
- _(K[q], S, T, C, v);
+ E(K[q], S, T, C, v);
}
- function M(w) {
- w.target.removeEventListener("dispose", M);
+ 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 iI = {
- [Lu]: Pu,
- [ku]: Qu,
- [Uu]: Gu,
- [_a]: Ou,
- [Pu]: Lu,
- [Qu]: ku,
- [Gu]: Uu,
- [Ou]: _a
+const i1 = {
+ [cd]: ld,
+ [hd]: fd,
+ [ud]: pd,
+ [Fa]: dd,
+ [ld]: cd,
+ [fd]: hd,
+ [pd]: ud,
+ [dd]: Fa
};
-function sI(i, e) {
+function s1(i, e) {
function t() {
let W = !1;
- const ne = new wt();
+ const ne = new mt();
let re = null;
- const de = new wt(0, 0, 0, 0);
+ const de = new mt(0, 0, 0, 0);
return {
setMask: function(Ie) {
re !== Ie && !W && (i.colorMask(Ie, Ie, Ie, Ie), re = Ie);
@@ -21422,8 +22038,8 @@ function sI(i, e) {
setLocked: function(Ie) {
W = Ie;
},
- setClear: function(Ie, Ce, nt, Ut, fn) {
- fn === !0 && (Ie *= Ut, Ce *= Ut, nt *= Ut), ne.set(Ie, Ce, nt, Ut), de.equals(ne) === !1 && (i.clearColor(Ie, Ce, nt, Ut), de.copy(ne));
+ 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));
},
reset: function() {
W = !1, re = null, de.set(-1, 0, 0, 0);
@@ -21435,46 +22051,46 @@ function sI(i, e) {
return {
setReversed: function(Ce) {
if (ne !== Ce) {
- const nt = e.get("EXT_clip_control");
- Ce ? nt.clipControlEXT(nt.LOWER_LEFT_EXT, nt.ZERO_TO_ONE_EXT) : nt.clipControlEXT(nt.LOWER_LEFT_EXT, nt.NEGATIVE_ONE_TO_ONE_EXT), ne = Ce;
- const Ut = Ie;
- Ie = null, this.setClear(Ut);
+ 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);
}
},
getReversed: function() {
return ne;
},
setTest: function(Ce) {
- Ce ? xe(i.DEPTH_TEST) : Pe(i.DEPTH_TEST);
+ Ce ? be(i.DEPTH_TEST) : Ue(i.DEPTH_TEST);
},
setMask: function(Ce) {
re !== Ce && !W && (i.depthMask(Ce), re = Ce);
},
setFunc: function(Ce) {
- if (ne && (Ce = iI[Ce]), de !== Ce) {
+ if (ne && (Ce = i1[Ce]), de !== Ce) {
switch (Ce) {
- case Lu:
+ case cd:
i.depthFunc(i.NEVER);
break;
- case Pu:
+ case ld:
i.depthFunc(i.ALWAYS);
break;
- case ku:
+ case hd:
i.depthFunc(i.LESS);
break;
- case _a:
+ case Fa:
i.depthFunc(i.LEQUAL);
break;
- case Uu:
+ case ud:
i.depthFunc(i.EQUAL);
break;
- case Ou:
+ case dd:
i.depthFunc(i.GEQUAL);
break;
- case Qu:
+ case fd:
i.depthFunc(i.GREATER);
break;
- case Gu:
+ case pd:
i.depthFunc(i.NOTEQUAL);
break;
default:
@@ -21495,64 +22111,64 @@ function sI(i, e) {
};
}
function s() {
- let W = !1, ne = null, re = null, de = null, Ie = null, Ce = null, nt = null, Ut = null, fn = null;
+ let W = !1, ne = null, re = null, de = null, Ie = null, Ce = null, it = null, Qt = null, bn = null;
return {
- setTest: function(_t) {
- W || (_t ? xe(i.STENCIL_TEST) : Pe(i.STENCIL_TEST));
+ setTest: function(Ct) {
+ W || (Ct ? be(i.STENCIL_TEST) : Ue(i.STENCIL_TEST));
},
- setMask: function(_t) {
- ne !== _t && !W && (i.stencilMask(_t), ne = _t);
+ setMask: function(Ct) {
+ ne !== Ct && !W && (i.stencilMask(Ct), ne = Ct);
},
- setFunc: function(_t, zn, ai) {
- (re !== _t || de !== zn || Ie !== ai) && (i.stencilFunc(_t, zn, ai), re = _t, de = zn, Ie = ai);
+ setFunc: function(Ct, Yn, Ai) {
+ (re !== Ct || de !== Yn || Ie !== Ai) && (i.stencilFunc(Ct, Yn, Ai), re = Ct, de = Yn, Ie = Ai);
},
- setOp: function(_t, zn, ai) {
- (Ce !== _t || nt !== zn || Ut !== ai) && (i.stencilOp(_t, zn, ai), Ce = _t, nt = zn, Ut = ai);
+ setOp: function(Ct, Yn, Ai) {
+ (Ce !== Ct || it !== Yn || Qt !== Ai) && (i.stencilOp(Ct, Yn, Ai), Ce = Ct, it = Yn, Qt = Ai);
},
- setLocked: function(_t) {
- W = _t;
+ setLocked: function(Ct) {
+ W = Ct;
},
- setClear: function(_t) {
- fn !== _t && (i.clearStencil(_t), fn = _t);
+ setClear: function(Ct) {
+ bn !== Ct && (i.clearStencil(Ct), bn = Ct);
},
reset: function() {
- W = !1, ne = null, re = null, de = null, Ie = null, Ce = null, nt = null, Ut = null, fn = null;
+ W = !1, ne = null, re = null, de = null, Ie = 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 = [], m = null, g = !1, A = null, p = null, y = null, b = null, _ = null, M = null, w = null, S = new je(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 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 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 wt().fromArray(ae), se = new wt().fromArray(ye);
+ const ae = i.getParameter(i.SCISSOR_BOX), ye = i.getParameter(i.VIEWPORT), Me = new mt().fromArray(ae), se = new mt().fromArray(ye);
function me(W, ne, re, de) {
const Ie = 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 nt = 0; nt < re; nt++)
- 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 + nt, 0, i.RGBA, 1, 1, 0, i.RGBA, i.UNSIGNED_BYTE, Ie);
+ 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);
return Ce;
}
- const be = {};
- be[i.TEXTURE_2D] = me(i.TEXTURE_2D, i.TEXTURE_2D, 1), be[i.TEXTURE_CUBE_MAP] = me(i.TEXTURE_CUBE_MAP, i.TEXTURE_CUBE_MAP_POSITIVE_X, 6), be[i.TEXTURE_2D_ARRAY] = me(i.TEXTURE_2D_ARRAY, i.TEXTURE_2D_ARRAY, 1, 1), be[i.TEXTURE_3D] = me(i.TEXTURE_3D, i.TEXTURE_3D, 1, 1), r.setClear(0, 0, 0, 1), a.setClear(1), o.setClear(0), xe(i.DEPTH_TEST), a.setFunc(_a), dt(!1), pt(sp), xe(i.CULL_FACE), G(Ds);
- function xe(W) {
+ 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);
+ function be(W) {
h[W] !== !0 && (i.enable(W), h[W] = !0);
}
- function Pe(W) {
+ function Ue(W) {
h[W] !== !1 && (i.disable(W), h[W] = !1);
}
- function $e(W, ne) {
+ 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 Qe(W, ne) {
+ 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 Ce = 0, nt = Ie.length; Ce < nt; Ce++)
+ for (let Ce = 0, it = Ie.length; Ce < it; Ce++)
re[Ce] = i.COLOR_ATTACHMENT0 + Ce;
re.length = Ie.length, de = !0;
}
@@ -21560,51 +22176,51 @@ function sI(i, e) {
re[0] !== i.BACK && (re[0] = i.BACK, de = !0);
de && i.drawBuffers(re);
}
- function vt(W) {
- return m !== W ? (i.useProgram(W), m = W, !0) : !1;
+ function It(W) {
+ return p !== W ? (i.useProgram(W), p = W, !0) : !1;
}
- const lt = {
- [rr]: i.FUNC_ADD,
- [cE]: i.FUNC_SUBTRACT,
- [lE]: i.FUNC_REVERSE_SUBTRACT
+ const ht = {
+ [fr]: i.FUNC_ADD,
+ [qE]: i.FUNC_SUBTRACT,
+ [KE]: i.FUNC_REVERSE_SUBTRACT
};
- lt[hE] = i.MIN, lt[uE] = i.MAX;
- const Je = {
- [dE]: i.ZERO,
- [fE]: i.ONE,
- [pE]: i.SRC_COLOR,
- [Fu]: i.SRC_ALPHA,
- [EE]: i.SRC_ALPHA_SATURATE,
- [bE]: i.DST_COLOR,
- [gE]: i.DST_ALPHA,
- [AE]: i.ONE_MINUS_SRC_COLOR,
- [Du]: i.ONE_MINUS_SRC_ALPHA,
- [xE]: i.ONE_MINUS_DST_COLOR,
- [mE]: i.ONE_MINUS_DST_ALPHA,
- [_E]: i.CONSTANT_COLOR,
- [yE]: i.ONE_MINUS_CONSTANT_COLOR,
- [wE]: i.CONSTANT_ALPHA,
- [vE]: i.ONE_MINUS_CONSTANT_ALPHA
+ ht[jE] = i.MIN, ht[XE] = 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
};
- function G(W, ne, re, de, Ie, Ce, nt, Ut, fn, _t) {
- if (W === Ds) {
- g === !0 && (Pe(i.BLEND), g = !1);
+ function H(W, ne, re, de, Ie, Ce, it, Qt, bn, Ct) {
+ if (W === Gs) {
+ m === !0 && (Ue(i.BLEND), m = !1);
return;
}
- if (g === !1 && (xe(i.BLEND), g = !0), W !== oE) {
- if (W !== A || _t !== C) {
- if ((p !== rr || _ !== rr) && (i.blendEquation(i.FUNC_ADD), p = rr, _ = rr), _t)
+ if (m === !1 && (be(i.BLEND), m = !0), W !== WE) {
+ if (W !== g || Ct !== C) {
+ if ((A !== fr || E !== fr) && (i.blendEquation(i.FUNC_ADD), A = fr, E = fr), Ct)
switch (W) {
- case ha:
+ case ya:
i.blendFuncSeparate(i.ONE, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);
break;
- case rp:
+ case Dp:
i.blendFunc(i.ONE, i.ONE);
break;
- case ap:
+ case Np:
i.blendFuncSeparate(i.ZERO, i.ONE_MINUS_SRC_COLOR, i.ZERO, i.ONE);
break;
- case op:
+ case Lp:
i.blendFuncSeparate(i.ZERO, i.SRC_COLOR, i.ZERO, i.SRC_ALPHA);
break;
default:
@@ -21613,57 +22229,57 @@ function sI(i, e) {
}
else
switch (W) {
- case ha:
+ case ya:
i.blendFuncSeparate(i.SRC_ALPHA, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);
break;
- case rp:
+ case Dp:
i.blendFunc(i.SRC_ALPHA, i.ONE);
break;
- case ap:
+ case Np:
i.blendFuncSeparate(i.ZERO, i.ONE_MINUS_SRC_COLOR, i.ZERO, i.ONE);
break;
- case op:
+ case Lp:
i.blendFunc(i.ZERO, i.SRC_COLOR);
break;
default:
console.error("THREE.WebGLState: Invalid blending: ", W);
break;
}
- y = null, b = null, M = null, w = null, S.set(0, 0, 0), T = 0, A = W, C = _t;
+ y = null, x = null, I = null, w = null, S.set(0, 0, 0), T = 0, g = W, C = Ct;
}
return;
}
- Ie = Ie || ne, Ce = Ce || re, nt = nt || de, (ne !== p || Ie !== _) && (i.blendEquationSeparate(lt[ne], lt[Ie]), p = ne, _ = Ie), (re !== y || de !== b || Ce !== M || nt !== w) && (i.blendFuncSeparate(Je[re], Je[de], Je[Ce], Je[nt]), y = re, b = de, M = Ce, w = nt), (Ut.equals(S) === !1 || fn !== T) && (i.blendColor(Ut.r, Ut.g, Ut.b, fn), S.copy(Ut), T = fn), A = W, C = !1;
+ 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;
}
- function dn(W, ne) {
- W.side === Ti ? Pe(i.CULL_FACE) : xe(i.CULL_FACE);
- let re = W.side === Ln;
- ne && (re = !re), dt(re), W.blending === ha && W.transparent === !1 ? G(Ds) : G(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);
+ 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);
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)), Rt(W.polygonOffset, W.polygonOffsetFactor, W.polygonOffsetUnits), W.alphaToCoverage === !0 ? xe(i.SAMPLE_ALPHA_TO_COVERAGE) : Pe(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)), Nt(W.polygonOffset, W.polygonOffsetFactor, W.polygonOffsetUnits), W.alphaToCoverage === !0 ? be(i.SAMPLE_ALPHA_TO_COVERAGE) : Ue(i.SAMPLE_ALPHA_TO_COVERAGE);
}
- function dt(W) {
+ function pt(W) {
v !== W && (W ? i.frontFace(i.CW) : i.frontFace(i.CCW), v = W);
}
- function pt(W) {
- W !== sE ? (xe(i.CULL_FACE), W !== F && (W === sp ? i.cullFace(i.BACK) : W === rE ? i.cullFace(i.FRONT) : i.cullFace(i.FRONT_AND_BACK))) : Pe(i.CULL_FACE), F = 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;
}
- function ze(W) {
+ function We(W) {
W !== K && (O && i.lineWidth(W), K = W);
}
- function Rt(W, ne, re) {
- W ? (xe(i.POLYGON_OFFSET_FILL), (q !== ne || $ !== re) && (i.polygonOffset(ne, re), q = ne, $ = re)) : Pe(i.POLYGON_OFFSET_FILL);
+ 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 Ge(W) {
- W ? xe(i.SCISSOR_TEST) : Pe(i.SCISSOR_TEST);
+ 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);
+ W === void 0 && (W = i.TEXTURE0 + N - 1), J !== W && (i.activeTexture(W), J = W);
}
- function I(W, ne, re) {
- re === void 0 && (J === null ? re = i.TEXTURE0 + D - 1 : re = J);
+ 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 || be[W]), de.type = W, de.texture = ne);
+ 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];
@@ -21690,7 +22306,7 @@ function sI(i, e) {
console.error("THREE.WebGLState:", W);
}
}
- function Ue() {
+ function Qe() {
try {
i.texSubImage3D(...arguments);
} catch (W) {
@@ -21704,14 +22320,14 @@ function sI(i, e) {
console.error("THREE.WebGLState:", W);
}
}
- function Ve() {
+ function qe() {
try {
i.compressedTexSubImage3D(...arguments);
} catch (W) {
console.error("THREE.WebGLState:", W);
}
}
- function Ye() {
+ function Je() {
try {
i.texStorage2D(...arguments);
} catch (W) {
@@ -21732,31 +22348,31 @@ function sI(i, e) {
console.error("THREE.WebGLState:", W);
}
}
- function ke() {
+ function Oe() {
try {
i.texImage3D(...arguments);
} catch (W) {
console.error("THREE.WebGLState:", W);
}
}
- function Oe(W) {
+ function Ge(W) {
Me.equals(W) === !1 && (i.scissor(W.x, W.y, W.z, W.w), Me.copy(W));
}
function Be(W) {
se.equals(W) === !1 && (i.viewport(W.x, W.y, W.z, W.w), se.copy(W));
}
- function et(W, ne) {
+ function tt(W, ne) {
let re = l.get(ne);
re === void 0 && (re = /* @__PURE__ */ 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 We(W, ne) {
+ 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 tt() {
- 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 = [], m = null, g = !1, A = null, p = null, y = null, b = null, _ = null, M = null, w = null, S = new je(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();
+ 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();
}
return {
buffers: {
@@ -21764,39 +22380,39 @@ function sI(i, e) {
depth: a,
stencil: o
},
- enable: xe,
- disable: Pe,
- bindFramebuffer: $e,
- drawBuffers: Qe,
- useProgram: vt,
- setBlending: G,
- setMaterial: dn,
- setFlipSided: dt,
- setCullFace: pt,
- setLineWidth: ze,
- setPolygonOffset: Rt,
- setScissorTest: Ge,
+ enable: be,
+ disable: Ue,
+ bindFramebuffer: et,
+ drawBuffers: He,
+ useProgram: It,
+ setBlending: H,
+ setMaterial: xn,
+ setFlipSided: pt,
+ setCullFace: gt,
+ setLineWidth: We,
+ setPolygonOffset: Nt,
+ setScissorTest: ze,
activeTexture: L,
- bindTexture: I,
+ bindTexture: M,
unbindTexture: Z,
compressedTexImage2D: le,
compressedTexImage3D: pe,
texImage2D: Re,
- texImage3D: ke,
- updateUBOMapping: et,
- uniformBlockBinding: We,
- texStorage2D: Ye,
+ texImage3D: Oe,
+ updateUBOMapping: tt,
+ uniformBlockBinding: Ke,
+ texStorage2D: Je,
texStorage3D: Ee,
texSubImage2D: oe,
- texSubImage3D: Ue,
+ texSubImage3D: Qe,
compressedTexSubImage2D: ve,
- compressedTexSubImage3D: Ve,
- scissor: Oe,
+ compressedTexSubImage3D: qe,
+ scissor: Ge,
viewport: Be,
- reset: tt
+ reset: nt
};
}
-function rI(i, e, t, n, s, r, a) {
+function r1(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();
@@ -21805,96 +22421,96 @@ function rI(i, e, t, n, s, r, a) {
f = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null;
} catch {
}
- function m(L, I) {
+ function p(L, M) {
return f ? (
// eslint-disable-next-line compat/compat
- new OffscreenCanvas(L, I)
- ) : Lo("canvas");
+ new OffscreenCanvas(L, M)
+ ) : qo("canvas");
}
- function g(L, I, Z) {
+ function m(L, M, Z) {
let le = 1;
- const pe = Ge(L);
+ const pe = ze(L);
if ((pe.width > Z || pe.height > Z) && (le = Z / Math.max(pe.width, pe.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 * pe.width), Ue = Math.floor(le * pe.height);
- u === void 0 && (u = m(oe, Ue));
- const ve = I ? m(oe, Ue) : u;
- return ve.width = oe, ve.height = Ue, ve.getContext("2d").drawImage(L, 0, 0, oe, Ue), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + pe.width + "x" + pe.height + ") to (" + oe + "x" + Ue + ")."), ve;
+ const oe = Math.floor(le * pe.width), Qe = Math.floor(le * pe.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 (" + pe.width + "x" + pe.height + ") to (" + oe + "x" + Qe + ")."), ve;
} else
return "data" in L && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + pe.width + "x" + pe.height + ")."), L;
return L;
}
- function A(L) {
+ function g(L) {
return L.generateMipmaps;
}
- function p(L) {
+ function A(L) {
i.generateMipmap(L);
}
function y(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 b(L, I, Z, le, pe = !1) {
+ function x(L, M, Z, le, pe = !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 = I;
- if (I === i.RED && (Z === i.FLOAT && (oe = i.R32F), Z === i.HALF_FLOAT && (oe = i.R16F), Z === i.UNSIGNED_BYTE && (oe = i.R8)), I === 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)), I === i.RG && (Z === i.FLOAT && (oe = i.RG32F), Z === i.HALF_FLOAT && (oe = i.RG16F), Z === i.UNSIGNED_BYTE && (oe = i.RG8)), I === 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)), I === 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)), I === 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)), I === i.RGB && Z === i.UNSIGNED_INT_5_9_9_9_REV && (oe = i.RGB9_E5), I === i.RGBA) {
- const Ue = pe ? wl : mt.getTransfer(le);
- Z === i.FLOAT && (oe = i.RGBA32F), Z === i.HALF_FLOAT && (oe = i.RGBA16F), Z === i.UNSIGNED_BYTE && (oe = Ue === Mt ? 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);
+ 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);
+ 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 _(L, I) {
+ function E(L, M) {
let Z;
- return L ? I === null || I === xr || I === Mo ? Z = i.DEPTH24_STENCIL8 : I === an ? Z = i.DEPTH32F_STENCIL8 : I === Io && (Z = i.DEPTH24_STENCIL8, console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : I === null || I === xr || I === Mo ? Z = i.DEPTH_COMPONENT24 : I === an ? Z = i.DEPTH_COMPONENT32F : I === Io && (Z = i.DEPTH_COMPONENT16), 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;
}
- function M(L, I) {
- return A(L) === !0 || L.isFramebufferTexture && L.minFilter !== Pn && L.minFilter !== qt ? Math.log2(Math.max(I.width, I.height)) + 1 : L.mipmaps !== void 0 && L.mipmaps.length > 0 ? L.mipmaps.length : L.isCompressedTexture && Array.isArray(L.image) ? I.mipmaps.length : 1;
+ function I(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 I = L.target;
- I.removeEventListener("dispose", w), T(I), I.isVideoTexture && h.delete(I);
+ const M = L.target;
+ M.removeEventListener("dispose", w), T(M), M.isVideoTexture && h.delete(M);
}
function S(L) {
- const I = L.target;
- I.removeEventListener("dispose", S), v(I);
+ const M = L.target;
+ M.removeEventListener("dispose", S), v(M);
}
function T(L) {
- const I = n.get(L);
- if (I.__webglInit === void 0) return;
+ const M = n.get(L);
+ if (M.__webglInit === void 0) return;
const Z = L.source, le = d.get(Z);
if (le) {
- const pe = le[I.__cacheKey];
+ const pe = le[M.__cacheKey];
pe.usedTimes--, pe.usedTimes === 0 && C(L), Object.keys(le).length === 0 && d.delete(Z);
}
n.remove(L);
}
function C(L) {
- const I = n.get(L);
- i.deleteTexture(I.__webglTexture);
+ const M = n.get(L);
+ i.deleteTexture(M.__webglTexture);
const Z = L.source, le = d.get(Z);
- delete le[I.__cacheKey], a.memory.textures--;
+ delete le[M.__cacheKey], a.memory.textures--;
}
function v(L) {
- const I = n.get(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(I.__webglFramebuffer[le]))
- for (let pe = 0; pe < I.__webglFramebuffer[le].length; pe++) i.deleteFramebuffer(I.__webglFramebuffer[le][pe]);
+ if (Array.isArray(M.__webglFramebuffer[le]))
+ for (let pe = 0; pe < M.__webglFramebuffer[le].length; pe++) i.deleteFramebuffer(M.__webglFramebuffer[le][pe]);
else
- i.deleteFramebuffer(I.__webglFramebuffer[le]);
- I.__webglDepthbuffer && i.deleteRenderbuffer(I.__webglDepthbuffer[le]);
+ i.deleteFramebuffer(M.__webglFramebuffer[le]);
+ M.__webglDepthbuffer && i.deleteRenderbuffer(M.__webglDepthbuffer[le]);
}
else {
- if (Array.isArray(I.__webglFramebuffer))
- for (let le = 0; le < I.__webglFramebuffer.length; le++) i.deleteFramebuffer(I.__webglFramebuffer[le]);
+ if (Array.isArray(M.__webglFramebuffer))
+ for (let le = 0; le < M.__webglFramebuffer.length; le++) i.deleteFramebuffer(M.__webglFramebuffer[le]);
else
- i.deleteFramebuffer(I.__webglFramebuffer);
- if (I.__webglDepthbuffer && i.deleteRenderbuffer(I.__webglDepthbuffer), I.__webglMultisampledFramebuffer && i.deleteFramebuffer(I.__webglMultisampledFramebuffer), I.__webglColorRenderbuffer)
- for (let le = 0; le < I.__webglColorRenderbuffer.length; le++)
- I.__webglColorRenderbuffer[le] && i.deleteRenderbuffer(I.__webglColorRenderbuffer[le]);
- I.__webglDepthRenderbuffer && i.deleteRenderbuffer(I.__webglDepthRenderbuffer);
+ 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, pe = Z.length; le < pe; le++) {
@@ -21912,550 +22528,550 @@ function rI(i, e, t, n, s, r, a) {
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 I = [];
- return I.push(L.wrapS), I.push(L.wrapT), I.push(L.wrapR || 0), I.push(L.magFilter), I.push(L.minFilter), I.push(L.anisotropy), I.push(L.internalFormat), I.push(L.format), I.push(L.type), I.push(L.generateMipmaps), I.push(L.premultiplyAlpha), I.push(L.flipY), I.push(L.unpackAlignment), I.push(L.colorSpace), I.join();
+ 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, I) {
+ function N(L, M) {
const Z = n.get(L);
- if (L.isVideoTexture && ze(L), L.isRenderTargetTexture === !1 && L.version > 0 && Z.__version !== L.version) {
+ 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, I);
+ se(Z, L, M);
return;
}
}
- t.bindTexture(i.TEXTURE_2D, Z.__webglTexture, i.TEXTURE0 + I);
+ t.bindTexture(i.TEXTURE_2D, Z.__webglTexture, i.TEXTURE0 + M);
}
- function O(L, I) {
+ function O(L, M) {
const Z = n.get(L);
if (L.version > 0 && Z.__version !== L.version) {
- se(Z, L, I);
+ se(Z, L, M);
return;
}
- t.bindTexture(i.TEXTURE_2D_ARRAY, Z.__webglTexture, i.TEXTURE0 + I);
+ t.bindTexture(i.TEXTURE_2D_ARRAY, Z.__webglTexture, i.TEXTURE0 + M);
}
- function Y(L, I) {
+ function Y(L, M) {
const Z = n.get(L);
if (L.version > 0 && Z.__version !== L.version) {
- se(Z, L, I);
+ se(Z, L, M);
return;
}
- t.bindTexture(i.TEXTURE_3D, Z.__webglTexture, i.TEXTURE0 + I);
+ t.bindTexture(i.TEXTURE_3D, Z.__webglTexture, i.TEXTURE0 + M);
}
- function Q(L, I) {
+ function Q(L, M) {
const Z = n.get(L);
if (L.version > 0 && Z.__version !== L.version) {
- me(Z, L, I);
+ me(Z, L, M);
return;
}
- t.bindTexture(i.TEXTURE_CUBE_MAP, Z.__webglTexture, i.TEXTURE0 + I);
+ t.bindTexture(i.TEXTURE_CUBE_MAP, Z.__webglTexture, i.TEXTURE0 + M);
}
const J = {
- [wa]: i.REPEAT,
- [xi]: i.CLAMP_TO_EDGE,
- [Al]: i.MIRRORED_REPEAT
+ [Ws]: i.REPEAT,
+ [ti]: i.CLAMP_TO_EDGE,
+ [Dl]: i.MIRRORED_REPEAT
}, ee = {
- [Pn]: i.NEAREST,
- [Nm]: i.NEAREST_MIPMAP_NEAREST,
- [lo]: i.NEAREST_MIPMAP_LINEAR,
- [qt]: i.LINEAR,
- [rl]: i.LINEAR_MIPMAP_NEAREST,
- [ii]: i.LINEAR_MIPMAP_LINEAR
+ [Wn]: i.NEAREST,
+ [h0]: i.NEAREST_MIPMAP_NEAREST,
+ [bo]: i.NEAREST_MIPMAP_LINEAR,
+ [Xt]: i.LINEAR,
+ [yl]: i.LINEAR_MIPMAP_NEAREST,
+ [hi]: i.LINEAR_MIPMAP_LINEAR
}, ae = {
- [OE]: i.NEVER,
- [WE]: i.ALWAYS,
- [QE]: i.LESS,
- [zm]: i.LEQUAL,
- [GE]: i.EQUAL,
- [VE]: i.GEQUAL,
- [HE]: i.GREATER,
- [zE]: i.NOTEQUAL
+ [w_]: i.NEVER,
+ [B_]: i.ALWAYS,
+ [v_]: i.LESS,
+ [E0]: i.LEQUAL,
+ [C_]: i.EQUAL,
+ [M_]: i.GEQUAL,
+ [S_]: i.GREATER,
+ [I_]: i.NOTEQUAL
};
- function ye(L, I) {
- if (I.type === an && e.has("OES_texture_float_linear") === !1 && (I.magFilter === qt || I.magFilter === rl || I.magFilter === lo || I.magFilter === ii || I.minFilter === qt || I.minFilter === rl || I.minFilter === lo || I.minFilter === ii) && 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[I.wrapS]), i.texParameteri(L, i.TEXTURE_WRAP_T, J[I.wrapT]), (L === i.TEXTURE_3D || L === i.TEXTURE_2D_ARRAY) && i.texParameteri(L, i.TEXTURE_WRAP_R, J[I.wrapR]), i.texParameteri(L, i.TEXTURE_MAG_FILTER, ee[I.magFilter]), i.texParameteri(L, i.TEXTURE_MIN_FILTER, ee[I.minFilter]), I.compareFunction && (i.texParameteri(L, i.TEXTURE_COMPARE_MODE, i.COMPARE_REF_TO_TEXTURE), i.texParameteri(L, i.TEXTURE_COMPARE_FUNC, ae[I.compareFunction])), e.has("EXT_texture_filter_anisotropic") === !0) {
- if (I.magFilter === Pn || I.minFilter !== lo && I.minFilter !== ii || I.type === an && e.has("OES_texture_float_linear") === !1) return;
- if (I.anisotropy > 1 || n.get(I).__currentAnisotropy) {
+ 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;
+ 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(I.anisotropy, s.getMaxAnisotropy())), n.get(I).__currentAnisotropy = I.anisotropy;
+ i.texParameterf(L, Z.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(M.anisotropy, s.getMaxAnisotropy())), n.get(M).__currentAnisotropy = M.anisotropy;
}
}
}
- function Me(L, I) {
+ function Me(L, M) {
let Z = !1;
- L.__webglInit === void 0 && (L.__webglInit = !0, I.addEventListener("dispose", w));
- const le = I.source;
+ L.__webglInit === void 0 && (L.__webglInit = !0, M.addEventListener("dispose", w));
+ const le = M.source;
let pe = d.get(le);
pe === void 0 && (pe = {}, d.set(le, pe));
- const oe = $(I);
+ const oe = $(M);
if (oe !== L.__cacheKey) {
pe[oe] === void 0 && (pe[oe] = {
texture: i.createTexture(),
usedTimes: 0
}, a.memory.textures++, Z = !0), pe[oe].usedTimes++;
- const Ue = pe[L.__cacheKey];
- Ue !== void 0 && (pe[L.__cacheKey].usedTimes--, Ue.usedTimes === 0 && C(I)), L.__cacheKey = oe, L.__webglTexture = pe[oe].texture;
+ const Qe = pe[L.__cacheKey];
+ Qe !== void 0 && (pe[L.__cacheKey].usedTimes--, Qe.usedTimes === 0 && C(M)), L.__cacheKey = oe, L.__webglTexture = pe[oe].texture;
}
return Z;
}
- function se(L, I, Z) {
+ function se(L, M, Z) {
let le = i.TEXTURE_2D;
- (I.isDataArrayTexture || I.isCompressedArrayTexture) && (le = i.TEXTURE_2D_ARRAY), I.isData3DTexture && (le = i.TEXTURE_3D);
- const pe = Me(L, I), oe = I.source;
+ (M.isDataArrayTexture || M.isCompressedArrayTexture) && (le = i.TEXTURE_2D_ARRAY), M.isData3DTexture && (le = i.TEXTURE_3D);
+ const pe = Me(L, M), oe = M.source;
t.bindTexture(le, L.__webglTexture, i.TEXTURE0 + Z);
- const Ue = n.get(oe);
- if (oe.version !== Ue.__version || pe === !0) {
+ const Qe = n.get(oe);
+ if (oe.version !== Qe.__version || pe === !0) {
t.activeTexture(i.TEXTURE0 + Z);
- const ve = mt.getPrimaries(mt.workingColorSpace), Ve = I.colorSpace === Ai ? null : mt.getPrimaries(I.colorSpace), Ye = I.colorSpace === Ai || ve === Ve ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
- i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, I.flipY), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, I.premultiplyAlpha), i.pixelStorei(i.UNPACK_ALIGNMENT, I.unpackAlignment), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, Ye);
- let Ee = g(I.image, !1, s.maxTextureSize);
- Ee = Rt(I, Ee);
- const Re = r.convert(I.format, I.colorSpace), ke = r.convert(I.type);
- let Oe = b(I.internalFormat, Re, ke, I.colorSpace, I.isVideoTexture);
- ye(le, I);
+ 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);
+ 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);
let Be;
- const et = I.mipmaps, We = I.isVideoTexture !== !0, tt = Ue.__version === void 0 || pe === !0, W = oe.dataReady, ne = M(I, Ee);
- if (I.isDepthTexture)
- Oe = _(I.format === To, I.type), tt && (We ? t.texStorage2D(i.TEXTURE_2D, 1, Oe, Ee.width, Ee.height) : t.texImage2D(i.TEXTURE_2D, 0, Oe, Ee.width, Ee.height, 0, Re, ke, null));
- else if (I.isDataTexture)
- if (et.length > 0) {
- We && tt && t.texStorage2D(i.TEXTURE_2D, ne, Oe, et[0].width, et[0].height);
- for (let re = 0, de = et.length; re < de; re++)
- Be = et[re], We ? W && t.texSubImage2D(i.TEXTURE_2D, re, 0, 0, Be.width, Be.height, Re, ke, Be.data) : t.texImage2D(i.TEXTURE_2D, re, Oe, Be.width, Be.height, 0, Re, ke, Be.data);
- I.generateMipmaps = !1;
+ const tt = M.mipmaps, Ke = M.isVideoTexture !== !0, nt = Qe.__version === void 0 || pe === !0, W = oe.dataReady, ne = I(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));
+ else if (M.isDataTexture)
+ if (tt.length > 0) {
+ Ke && nt && t.texStorage2D(i.TEXTURE_2D, ne, Ge, tt[0].width, tt[0].height);
+ for (let re = 0, de = tt.length; re < de; re++)
+ Be = tt[re], Ke ? W && t.texSubImage2D(i.TEXTURE_2D, re, 0, 0, Be.width, Be.height, Re, Oe, Be.data) : t.texImage2D(i.TEXTURE_2D, re, Ge, Be.width, Be.height, 0, Re, Oe, Be.data);
+ M.generateMipmaps = !1;
} else
- We ? (tt && t.texStorage2D(i.TEXTURE_2D, ne, Oe, Ee.width, Ee.height), W && t.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, Ee.width, Ee.height, Re, ke, Ee.data)) : t.texImage2D(i.TEXTURE_2D, 0, Oe, Ee.width, Ee.height, 0, Re, ke, Ee.data);
- else if (I.isCompressedTexture)
- if (I.isCompressedArrayTexture) {
- We && tt && t.texStorage3D(i.TEXTURE_2D_ARRAY, ne, Oe, et[0].width, et[0].height, Ee.depth);
- for (let re = 0, de = et.length; re < de; re++)
- if (Be = et[re], I.format !== on)
+ Ke ? (nt && t.texStorage2D(i.TEXTURE_2D, ne, Ge, Ee.width, Ee.height), W && t.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, Ee.width, Ee.height, Re, Oe, Ee.data)) : t.texImage2D(i.TEXTURE_2D, 0, Ge, Ee.width, Ee.height, 0, Re, Oe, Ee.data);
+ else if (M.isCompressedTexture)
+ if (M.isCompressedArrayTexture) {
+ Ke && nt && t.texStorage3D(i.TEXTURE_2D_ARRAY, ne, Ge, tt[0].width, tt[0].height, Ee.depth);
+ for (let re = 0, de = tt.length; re < de; re++)
+ if (Be = tt[re], M.format !== pn)
if (Re !== null)
- if (We) {
+ if (Ke) {
if (W)
- if (I.layerUpdates.size > 0) {
- const Ie = Yp(Be.width, Be.height, I.format, I.type);
- for (const Ce of I.layerUpdates) {
- const nt = Be.data.subarray(
+ if (M.layerUpdates.size > 0) {
+ const Ie = IA(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
);
- t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY, re, 0, 0, Ce, Be.width, Be.height, 1, Re, nt);
+ t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY, re, 0, 0, Ce, Be.width, Be.height, 1, Re, it);
}
- I.clearLayerUpdates();
+ M.clearLayerUpdates();
} else
t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY, re, 0, 0, 0, Be.width, Be.height, Ee.depth, Re, Be.data);
} else
- t.compressedTexImage3D(i.TEXTURE_2D_ARRAY, re, Oe, Be.width, Be.height, Ee.depth, 0, Be.data, 0, 0);
+ t.compressedTexImage3D(i.TEXTURE_2D_ARRAY, re, Ge, Be.width, Be.height, Ee.depth, 0, Be.data, 0, 0);
else
console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");
else
- We ? W && t.texSubImage3D(i.TEXTURE_2D_ARRAY, re, 0, 0, 0, Be.width, Be.height, Ee.depth, Re, ke, Be.data) : t.texImage3D(i.TEXTURE_2D_ARRAY, re, Oe, Be.width, Be.height, Ee.depth, 0, Re, ke, Be.data);
+ Ke ? W && t.texSubImage3D(i.TEXTURE_2D_ARRAY, re, 0, 0, 0, Be.width, Be.height, Ee.depth, Re, Oe, Be.data) : t.texImage3D(i.TEXTURE_2D_ARRAY, re, Ge, Be.width, Be.height, Ee.depth, 0, Re, Oe, Be.data);
} else {
- We && tt && t.texStorage2D(i.TEXTURE_2D, ne, Oe, et[0].width, et[0].height);
- for (let re = 0, de = et.length; re < de; re++)
- Be = et[re], I.format !== on ? Re !== null ? We ? W && t.compressedTexSubImage2D(i.TEXTURE_2D, re, 0, 0, Be.width, Be.height, Re, Be.data) : t.compressedTexImage2D(i.TEXTURE_2D, re, Oe, Be.width, Be.height, 0, Be.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : We ? W && t.texSubImage2D(i.TEXTURE_2D, re, 0, 0, Be.width, Be.height, Re, ke, Be.data) : t.texImage2D(i.TEXTURE_2D, re, Oe, Be.width, Be.height, 0, Re, ke, Be.data);
+ Ke && nt && t.texStorage2D(i.TEXTURE_2D, ne, Ge, tt[0].width, tt[0].height);
+ for (let re = 0, de = tt.length; re < de; re++)
+ Be = tt[re], M.format !== pn ? Re !== null ? Ke ? W && t.compressedTexSubImage2D(i.TEXTURE_2D, re, 0, 0, Be.width, Be.height, Re, Be.data) : t.compressedTexImage2D(i.TEXTURE_2D, re, Ge, Be.width, Be.height, 0, Be.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : Ke ? W && t.texSubImage2D(i.TEXTURE_2D, re, 0, 0, Be.width, Be.height, Re, Oe, Be.data) : t.texImage2D(i.TEXTURE_2D, re, Ge, Be.width, Be.height, 0, Re, Oe, Be.data);
}
- else if (I.isDataArrayTexture)
- if (We) {
- if (tt && t.texStorage3D(i.TEXTURE_2D_ARRAY, ne, Oe, Ee.width, Ee.height, Ee.depth), W)
- if (I.layerUpdates.size > 0) {
- const re = Yp(Ee.width, Ee.height, I.format, I.type);
- for (const de of I.layerUpdates) {
+ else if (M.isDataArrayTexture)
+ 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);
+ 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, Re, ke, Ie);
+ t.texSubImage3D(i.TEXTURE_2D_ARRAY, 0, 0, 0, de, Ee.width, Ee.height, 1, Re, Oe, Ie);
}
- I.clearLayerUpdates();
+ M.clearLayerUpdates();
} else
- t.texSubImage3D(i.TEXTURE_2D_ARRAY, 0, 0, 0, 0, Ee.width, Ee.height, Ee.depth, Re, ke, Ee.data);
+ t.texSubImage3D(i.TEXTURE_2D_ARRAY, 0, 0, 0, 0, Ee.width, Ee.height, Ee.depth, Re, Oe, Ee.data);
} else
- t.texImage3D(i.TEXTURE_2D_ARRAY, 0, Oe, Ee.width, Ee.height, Ee.depth, 0, Re, ke, Ee.data);
- else if (I.isData3DTexture)
- We ? (tt && t.texStorage3D(i.TEXTURE_3D, ne, Oe, Ee.width, Ee.height, Ee.depth), W && t.texSubImage3D(i.TEXTURE_3D, 0, 0, 0, 0, Ee.width, Ee.height, Ee.depth, Re, ke, Ee.data)) : t.texImage3D(i.TEXTURE_3D, 0, Oe, Ee.width, Ee.height, Ee.depth, 0, Re, ke, Ee.data);
- else if (I.isFramebufferTexture) {
- if (tt)
- if (We)
- t.texStorage2D(i.TEXTURE_2D, ne, Oe, Ee.width, Ee.height);
+ t.texImage3D(i.TEXTURE_2D_ARRAY, 0, Ge, Ee.width, Ee.height, Ee.depth, 0, Re, Oe, Ee.data);
+ else if (M.isData3DTexture)
+ Ke ? (nt && 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, Re, Oe, Ee.data)) : t.texImage3D(i.TEXTURE_3D, 0, Ge, Ee.width, Ee.height, Ee.depth, 0, Re, Oe, Ee.data);
+ else if (M.isFramebufferTexture) {
+ if (nt)
+ 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, Oe, re, de, 0, Re, ke, null), re >>= 1, de >>= 1;
+ t.texImage2D(i.TEXTURE_2D, Ie, Ge, re, de, 0, Re, Oe, null), re >>= 1, de >>= 1;
}
- } else if (et.length > 0) {
- if (We && tt) {
- const re = Ge(et[0]);
- t.texStorage2D(i.TEXTURE_2D, ne, Oe, re.width, re.height);
+ } else if (tt.length > 0) {
+ if (Ke && nt) {
+ const re = ze(tt[0]);
+ t.texStorage2D(i.TEXTURE_2D, ne, Ge, re.width, re.height);
}
- for (let re = 0, de = et.length; re < de; re++)
- Be = et[re], We ? W && t.texSubImage2D(i.TEXTURE_2D, re, 0, 0, Re, ke, Be) : t.texImage2D(i.TEXTURE_2D, re, Oe, Re, ke, Be);
- I.generateMipmaps = !1;
- } else if (We) {
- if (tt) {
- const re = Ge(Ee);
- t.texStorage2D(i.TEXTURE_2D, ne, Oe, re.width, re.height);
+ for (let re = 0, de = tt.length; re < de; re++)
+ Be = tt[re], Ke ? W && t.texSubImage2D(i.TEXTURE_2D, re, 0, 0, Re, Oe, Be) : t.texImage2D(i.TEXTURE_2D, re, Ge, Re, Oe, Be);
+ M.generateMipmaps = !1;
+ } else if (Ke) {
+ if (nt) {
+ const re = ze(Ee);
+ t.texStorage2D(i.TEXTURE_2D, ne, Ge, re.width, re.height);
}
- W && t.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, Re, ke, Ee);
+ W && t.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, Re, Oe, Ee);
} else
- t.texImage2D(i.TEXTURE_2D, 0, Oe, Re, ke, Ee);
- A(I) && p(le), Ue.__version = oe.version, I.onUpdate && I.onUpdate(I);
+ t.texImage2D(i.TEXTURE_2D, 0, Ge, Re, Oe, Ee);
+ g(M) && A(le), Qe.__version = oe.version, M.onUpdate && M.onUpdate(M);
}
- L.__version = I.version;
+ L.__version = M.version;
}
- function me(L, I, Z) {
- if (I.image.length !== 6) return;
- const le = Me(L, I), pe = I.source;
+ function me(L, M, Z) {
+ if (M.image.length !== 6) return;
+ const le = Me(L, M), pe = M.source;
t.bindTexture(i.TEXTURE_CUBE_MAP, L.__webglTexture, i.TEXTURE0 + Z);
const oe = n.get(pe);
if (pe.version !== oe.__version || le === !0) {
t.activeTexture(i.TEXTURE0 + Z);
- const Ue = mt.getPrimaries(mt.workingColorSpace), ve = I.colorSpace === Ai ? null : mt.getPrimaries(I.colorSpace), Ve = I.colorSpace === Ai || Ue === ve ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
- i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, I.flipY), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, I.premultiplyAlpha), i.pixelStorei(i.UNPACK_ALIGNMENT, I.unpackAlignment), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, Ve);
- const Ye = I.isCompressedTexture || I.image[0].isCompressedTexture, Ee = I.image[0] && I.image[0].isDataTexture, Re = [];
+ const Qe = rt.getPrimaries(rt.workingColorSpace), ve = M.colorSpace === vi ? null : rt.getPrimaries(M.colorSpace), qe = M.colorSpace === vi || Qe === ve ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
+ 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++)
- !Ye && !Ee ? Re[de] = g(I.image[de], !0, s.maxCubemapSize) : Re[de] = Ee ? I.image[de].image : I.image[de], Re[de] = Rt(I, Re[de]);
- const ke = Re[0], Oe = r.convert(I.format, I.colorSpace), Be = r.convert(I.type), et = b(I.internalFormat, Oe, Be, I.colorSpace), We = I.isVideoTexture !== !0, tt = oe.__version === void 0 || le === !0, W = pe.dataReady;
- let ne = M(I, ke);
- ye(i.TEXTURE_CUBE_MAP, I);
+ !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]);
+ 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 re;
- if (Ye) {
- We && tt && t.texStorage2D(i.TEXTURE_CUBE_MAP, ne, et, ke.width, ke.height);
+ 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];
- I.format !== on ? Oe !== null ? We ? W && t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie, 0, 0, Ce.width, Ce.height, Oe, Ce.data) : t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie, et, Ce.width, Ce.height, 0, Ce.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : We ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie, 0, 0, Ce.width, Ce.height, Oe, Be, Ce.data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie, et, Ce.width, Ce.height, 0, Oe, Be, Ce.data);
+ 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);
}
}
} else {
- if (re = I.mipmaps, We && tt) {
+ if (re = M.mipmaps, Ke && nt) {
re.length > 0 && ne++;
- const de = Ge(Re[0]);
- t.texStorage2D(i.TEXTURE_CUBE_MAP, ne, et, de.width, de.height);
+ const de = ze(Re[0]);
+ t.texStorage2D(i.TEXTURE_CUBE_MAP, ne, tt, de.width, de.height);
}
for (let de = 0; de < 6; de++)
if (Ee) {
- We ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, 0, 0, Re[de].width, Re[de].height, Oe, Be, Re[de].data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, et, Re[de].width, Re[de].height, 0, Oe, Be, Re[de].data);
+ 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 nt = re[Ie].image[de].image;
- We ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, 0, 0, nt.width, nt.height, Oe, Be, nt.data) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, et, nt.width, nt.height, 0, Oe, Be, nt.data);
+ 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);
}
} else {
- We ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, 0, 0, Oe, Be, Re[de]) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, 0, et, Oe, Be, Re[de]);
+ 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];
- We ? W && t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, 0, 0, Oe, Be, Ce.image[de]) : t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + de, Ie + 1, et, Oe, Be, Ce.image[de]);
+ 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]);
}
}
}
- A(I) && p(i.TEXTURE_CUBE_MAP), oe.__version = pe.version, I.onUpdate && I.onUpdate(I);
+ g(M) && A(i.TEXTURE_CUBE_MAP), oe.__version = pe.version, M.onUpdate && M.onUpdate(M);
}
- L.__version = I.version;
+ L.__version = M.version;
}
- function be(L, I, Z, le, pe, oe) {
- const Ue = r.convert(Z.format, Z.colorSpace), ve = r.convert(Z.type), Ve = b(Z.internalFormat, Ue, ve, Z.colorSpace), Ye = n.get(I), Ee = n.get(Z);
- if (Ee.__renderTarget = I, !Ye.__hasExternalTextures) {
- const Re = Math.max(1, I.width >> oe), ke = Math.max(1, I.height >> oe);
- pe === i.TEXTURE_3D || pe === i.TEXTURE_2D_ARRAY ? t.texImage3D(pe, oe, Ve, Re, ke, I.depth, 0, Ue, ve, null) : t.texImage2D(pe, oe, Ve, Re, ke, 0, Ue, ve, null);
+ function xe(L, M, Z, le, pe, oe) {
+ const Qe = r.convert(Z.format, Z.colorSpace), ve = r.convert(Z.type), qe = x(Z.internalFormat, Qe, ve, Z.colorSpace), Je = n.get(M), Ee = n.get(Z);
+ if (Ee.__renderTarget = M, !Je.__hasExternalTextures) {
+ const Re = Math.max(1, M.width >> oe), Oe = Math.max(1, M.height >> oe);
+ pe === i.TEXTURE_3D || pe === i.TEXTURE_2D_ARRAY ? t.texImage3D(pe, oe, qe, Re, Oe, M.depth, 0, Qe, ve, null) : t.texImage2D(pe, oe, qe, Re, Oe, 0, Qe, ve, null);
}
- t.bindFramebuffer(i.FRAMEBUFFER, L), pt(I) ? o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER, le, pe, Ee.__webglTexture, 0, dt(I)) : (pe === i.TEXTURE_2D || pe >= i.TEXTURE_CUBE_MAP_POSITIVE_X && pe <= i.TEXTURE_CUBE_MAP_NEGATIVE_Z) && i.framebufferTexture2D(i.FRAMEBUFFER, le, pe, Ee.__webglTexture, oe), t.bindFramebuffer(i.FRAMEBUFFER, null);
+ t.bindFramebuffer(i.FRAMEBUFFER, L), gt(M) ? o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER, le, pe, Ee.__webglTexture, 0, pt(M)) : (pe === i.TEXTURE_2D || pe >= i.TEXTURE_CUBE_MAP_POSITIVE_X && pe <= i.TEXTURE_CUBE_MAP_NEGATIVE_Z) && i.framebufferTexture2D(i.FRAMEBUFFER, le, pe, Ee.__webglTexture, oe), t.bindFramebuffer(i.FRAMEBUFFER, null);
}
- function xe(L, I, Z) {
- if (i.bindRenderbuffer(i.RENDERBUFFER, L), I.depthBuffer) {
- const le = I.depthTexture, pe = le && le.isDepthTexture ? le.type : null, oe = _(I.stencilBuffer, pe), Ue = I.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, ve = dt(I);
- pt(I) ? o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER, ve, oe, I.width, I.height) : Z ? i.renderbufferStorageMultisample(i.RENDERBUFFER, ve, oe, I.width, I.height) : i.renderbufferStorage(i.RENDERBUFFER, oe, I.width, I.height), i.framebufferRenderbuffer(i.FRAMEBUFFER, Ue, i.RENDERBUFFER, L);
+ function be(L, M, Z) {
+ if (i.bindRenderbuffer(i.RENDERBUFFER, L), M.depthBuffer) {
+ const le = M.depthTexture, pe = le && le.isDepthTexture ? le.type : null, oe = E(M.stencilBuffer, pe), Qe = M.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, ve = pt(M);
+ gt(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 = I.textures;
+ const le = M.textures;
for (let pe = 0; pe < le.length; pe++) {
- const oe = le[pe], Ue = r.convert(oe.format, oe.colorSpace), ve = r.convert(oe.type), Ve = b(oe.internalFormat, Ue, ve, oe.colorSpace), Ye = dt(I);
- Z && pt(I) === !1 ? i.renderbufferStorageMultisample(i.RENDERBUFFER, Ye, Ve, I.width, I.height) : pt(I) ? o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER, Ye, Ve, I.width, I.height) : i.renderbufferStorage(i.RENDERBUFFER, Ve, I.width, I.height);
+ const oe = le[pe], Qe = r.convert(oe.format, oe.colorSpace), ve = r.convert(oe.type), qe = x(oe.internalFormat, Qe, ve, oe.colorSpace), Je = pt(M);
+ Z && gt(M) === !1 ? i.renderbufferStorageMultisample(i.RENDERBUFFER, Je, qe, M.width, M.height) : gt(M) ? o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER, Je, qe, M.width, M.height) : i.renderbufferStorage(i.RENDERBUFFER, qe, M.width, M.height);
}
}
i.bindRenderbuffer(i.RENDERBUFFER, null);
}
- function Pe(L, I) {
- if (I && I.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported");
- if (t.bindFramebuffer(i.FRAMEBUFFER, L), !(I.depthTexture && I.depthTexture.isDepthTexture))
+ 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(I.depthTexture);
- le.__renderTarget = I, (!le.__webglTexture || I.depthTexture.image.width !== I.width || I.depthTexture.image.height !== I.height) && (I.depthTexture.image.width = I.width, I.depthTexture.image.height = I.height, I.depthTexture.needsUpdate = !0), D(I.depthTexture, 0);
- const pe = le.__webglTexture, oe = dt(I);
- if (I.depthTexture.format === Bo)
- pt(I) ? 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 (I.depthTexture.format === To)
- pt(I) ? 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);
+ 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 pe = le.__webglTexture, oe = pt(M);
+ if (M.depthTexture.format === Qo)
+ 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)
+ gt(M) ? o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER, i.DEPTH_STENCIL_ATTACHMENT, i.TEXTURE_2D, pe, 0, oe) : i.framebufferTexture2D(i.FRAMEBUFFER, i.DEPTH_STENCIL_ATTACHMENT, i.TEXTURE_2D, pe, 0);
else
throw new Error("Unknown depthTexture format");
}
- function $e(L) {
- const I = n.get(L), Z = L.isWebGLCubeRenderTarget === !0;
- if (I.__boundDepthTexture !== L.depthTexture) {
+ function et(L) {
+ const M = n.get(L), Z = L.isWebGLCubeRenderTarget === !0;
+ if (M.__boundDepthTexture !== L.depthTexture) {
const le = L.depthTexture;
- if (I.__depthDisposeCallback && I.__depthDisposeCallback(), le) {
+ if (M.__depthDisposeCallback && M.__depthDisposeCallback(), le) {
const pe = () => {
- delete I.__boundDepthTexture, delete I.__depthDisposeCallback, le.removeEventListener("dispose", pe);
+ delete M.__boundDepthTexture, delete M.__depthDisposeCallback, le.removeEventListener("dispose", pe);
};
- le.addEventListener("dispose", pe), I.__depthDisposeCallback = pe;
+ le.addEventListener("dispose", pe), M.__depthDisposeCallback = pe;
}
- I.__boundDepthTexture = le;
+ M.__boundDepthTexture = le;
}
- if (L.depthTexture && !I.__autoAllocateDepthBuffer) {
+ 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 ? Pe(I.__webglFramebuffer[0], L) : Pe(I.__webglFramebuffer, L);
+ le && le.length > 0 ? Ue(M.__webglFramebuffer[0], L) : Ue(M.__webglFramebuffer, L);
} else if (Z) {
- I.__webglDepthbuffer = [];
+ M.__webglDepthbuffer = [];
for (let le = 0; le < 6; le++)
- if (t.bindFramebuffer(i.FRAMEBUFFER, I.__webglFramebuffer[le]), I.__webglDepthbuffer[le] === void 0)
- I.__webglDepthbuffer[le] = i.createRenderbuffer(), xe(I.__webglDepthbuffer[le], L, !1);
+ 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 pe = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, oe = I.__webglDepthbuffer[le];
+ const pe = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, oe = M.__webglDepthbuffer[le];
i.bindRenderbuffer(i.RENDERBUFFER, oe), i.framebufferRenderbuffer(i.FRAMEBUFFER, pe, i.RENDERBUFFER, oe);
}
} else {
const le = L.texture.mipmaps;
- if (le && le.length > 0 ? t.bindFramebuffer(i.FRAMEBUFFER, I.__webglFramebuffer[0]) : t.bindFramebuffer(i.FRAMEBUFFER, I.__webglFramebuffer), I.__webglDepthbuffer === void 0)
- I.__webglDepthbuffer = i.createRenderbuffer(), xe(I.__webglDepthbuffer, L, !1);
+ 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 pe = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, oe = I.__webglDepthbuffer;
+ const pe = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, oe = M.__webglDepthbuffer;
i.bindRenderbuffer(i.RENDERBUFFER, oe), i.framebufferRenderbuffer(i.FRAMEBUFFER, pe, i.RENDERBUFFER, oe);
}
}
t.bindFramebuffer(i.FRAMEBUFFER, null);
}
- function Qe(L, I, Z) {
+ function He(L, M, Z) {
const le = n.get(L);
- I !== void 0 && be(le.__webglFramebuffer, L, L.texture, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, 0), Z !== void 0 && $e(L);
+ M !== void 0 && xe(le.__webglFramebuffer, L, L.texture, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, 0), Z !== void 0 && et(L);
}
- function vt(L) {
- const I = L.texture, Z = n.get(L), le = n.get(I);
+ function It(L) {
+ const M = L.texture, Z = n.get(L), le = n.get(M);
L.addEventListener("dispose", S);
- const pe = L.textures, oe = L.isWebGLCubeRenderTarget === !0, Ue = pe.length > 1;
- if (Ue || (le.__webglTexture === void 0 && (le.__webglTexture = i.createTexture()), le.__version = I.version, a.memory.textures++), oe) {
+ 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 = [];
for (let ve = 0; ve < 6; ve++)
- if (I.mipmaps && I.mipmaps.length > 0) {
+ if (M.mipmaps && M.mipmaps.length > 0) {
Z.__webglFramebuffer[ve] = [];
- for (let Ve = 0; Ve < I.mipmaps.length; Ve++)
- Z.__webglFramebuffer[ve][Ve] = i.createFramebuffer();
+ for (let qe = 0; qe < M.mipmaps.length; qe++)
+ Z.__webglFramebuffer[ve][qe] = i.createFramebuffer();
} else
Z.__webglFramebuffer[ve] = i.createFramebuffer();
} else {
- if (I.mipmaps && I.mipmaps.length > 0) {
+ if (M.mipmaps && M.mipmaps.length > 0) {
Z.__webglFramebuffer = [];
- for (let ve = 0; ve < I.mipmaps.length; ve++)
+ for (let ve = 0; ve < M.mipmaps.length; ve++)
Z.__webglFramebuffer[ve] = i.createFramebuffer();
} else
Z.__webglFramebuffer = i.createFramebuffer();
- if (Ue)
- for (let ve = 0, Ve = pe.length; ve < Ve; ve++) {
- const Ye = n.get(pe[ve]);
- Ye.__webglTexture === void 0 && (Ye.__webglTexture = i.createTexture(), a.memory.textures++);
+ if (Qe)
+ for (let ve = 0, qe = pe.length; ve < qe; ve++) {
+ const Je = n.get(pe[ve]);
+ Je.__webglTexture === void 0 && (Je.__webglTexture = i.createTexture(), a.memory.textures++);
}
- if (L.samples > 0 && pt(L) === !1) {
+ if (L.samples > 0 && gt(L) === !1) {
Z.__webglMultisampledFramebuffer = i.createFramebuffer(), Z.__webglColorRenderbuffer = [], t.bindFramebuffer(i.FRAMEBUFFER, Z.__webglMultisampledFramebuffer);
for (let ve = 0; ve < pe.length; ve++) {
- const Ve = pe[ve];
+ const qe = pe[ve];
Z.__webglColorRenderbuffer[ve] = i.createRenderbuffer(), i.bindRenderbuffer(i.RENDERBUFFER, Z.__webglColorRenderbuffer[ve]);
- const Ye = r.convert(Ve.format, Ve.colorSpace), Ee = r.convert(Ve.type), Re = b(Ve.internalFormat, Ye, Ee, Ve.colorSpace, L.isXRRenderTarget === !0), ke = dt(L);
- i.renderbufferStorageMultisample(i.RENDERBUFFER, ke, Re, L.width, L.height), i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + ve, i.RENDERBUFFER, Z.__webglColorRenderbuffer[ve]);
+ const Je = r.convert(qe.format, qe.colorSpace), Ee = r.convert(qe.type), Re = x(qe.internalFormat, Je, Ee, qe.colorSpace, L.isXRRenderTarget === !0), Oe = pt(L);
+ i.renderbufferStorageMultisample(i.RENDERBUFFER, Oe, Re, 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(), xe(Z.__webglDepthRenderbuffer, L, !0)), t.bindFramebuffer(i.FRAMEBUFFER, null);
+ 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), ye(i.TEXTURE_CUBE_MAP, I);
+ t.bindTexture(i.TEXTURE_CUBE_MAP, le.__webglTexture), ye(i.TEXTURE_CUBE_MAP, M);
for (let ve = 0; ve < 6; ve++)
- if (I.mipmaps && I.mipmaps.length > 0)
- for (let Ve = 0; Ve < I.mipmaps.length; Ve++)
- be(Z.__webglFramebuffer[ve][Ve], L, I, i.COLOR_ATTACHMENT0, i.TEXTURE_CUBE_MAP_POSITIVE_X + ve, 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
- be(Z.__webglFramebuffer[ve], L, I, i.COLOR_ATTACHMENT0, i.TEXTURE_CUBE_MAP_POSITIVE_X + ve, 0);
- A(I) && p(i.TEXTURE_CUBE_MAP), t.unbindTexture();
- } else if (Ue) {
- for (let ve = 0, Ve = pe.length; ve < Ve; ve++) {
- const Ye = pe[ve], Ee = n.get(Ye);
- t.bindTexture(i.TEXTURE_2D, Ee.__webglTexture), ye(i.TEXTURE_2D, Ye), be(Z.__webglFramebuffer, L, Ye, i.COLOR_ATTACHMENT0 + ve, i.TEXTURE_2D, 0), A(Ye) && p(i.TEXTURE_2D);
+ 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 = 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.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, I), I.mipmaps && I.mipmaps.length > 0)
- for (let Ve = 0; Ve < I.mipmaps.length; Ve++)
- be(Z.__webglFramebuffer[Ve], L, I, i.COLOR_ATTACHMENT0, ve, Ve);
+ 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)
+ for (let qe = 0; qe < M.mipmaps.length; qe++)
+ xe(Z.__webglFramebuffer[qe], L, M, i.COLOR_ATTACHMENT0, ve, qe);
else
- be(Z.__webglFramebuffer, L, I, i.COLOR_ATTACHMENT0, ve, 0);
- A(I) && p(ve), t.unbindTexture();
+ xe(Z.__webglFramebuffer, L, M, i.COLOR_ATTACHMENT0, ve, 0);
+ g(M) && A(ve), t.unbindTexture();
}
- L.depthBuffer && $e(L);
+ L.depthBuffer && et(L);
}
- function lt(L) {
- const I = L.textures;
- for (let Z = 0, le = I.length; Z < le; Z++) {
- const pe = I[Z];
- if (A(pe)) {
- const oe = y(L), Ue = n.get(pe).__webglTexture;
- t.bindTexture(oe, Ue), p(oe), t.unbindTexture();
+ function ht(L) {
+ const M = L.textures;
+ 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;
+ t.bindTexture(oe, Qe), A(oe), t.unbindTexture();
}
}
}
- const Je = [], G = [];
- function dn(L) {
+ const $e = [], H = [];
+ function xn(L) {
if (L.samples > 0) {
- if (pt(L) === !1) {
- const I = L.textures, Z = L.width, le = L.height;
+ if (gt(L) === !1) {
+ const M = L.textures, Z = L.width, le = L.height;
let pe = i.COLOR_BUFFER_BIT;
- const oe = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, Ue = n.get(L), ve = I.length > 1;
+ const oe = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT, Qe = n.get(L), ve = M.length > 1;
if (ve)
- for (let Ye = 0; Ye < I.length; Ye++)
- t.bindFramebuffer(i.FRAMEBUFFER, Ue.__webglMultisampledFramebuffer), i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Ye, i.RENDERBUFFER, null), t.bindFramebuffer(i.FRAMEBUFFER, Ue.__webglFramebuffer), i.framebufferTexture2D(i.DRAW_FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Ye, i.TEXTURE_2D, null, 0);
- t.bindFramebuffer(i.READ_FRAMEBUFFER, Ue.__webglMultisampledFramebuffer);
- const Ve = L.texture.mipmaps;
- Ve && Ve.length > 0 ? t.bindFramebuffer(i.DRAW_FRAMEBUFFER, Ue.__webglFramebuffer[0]) : t.bindFramebuffer(i.DRAW_FRAMEBUFFER, Ue.__webglFramebuffer);
- for (let Ye = 0; Ye < I.length; Ye++) {
+ for (let Je = 0; Je < M.length; Je++)
+ t.bindFramebuffer(i.FRAMEBUFFER, Qe.__webglMultisampledFramebuffer), i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Je, i.RENDERBUFFER, null), t.bindFramebuffer(i.FRAMEBUFFER, Qe.__webglFramebuffer), i.framebufferTexture2D(i.DRAW_FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Je, 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 Je = 0; Je < M.length; Je++) {
if (L.resolveDepthBuffer && (L.depthBuffer && (pe |= i.DEPTH_BUFFER_BIT), L.stencilBuffer && L.resolveStencilBuffer && (pe |= i.STENCIL_BUFFER_BIT)), ve) {
- i.framebufferRenderbuffer(i.READ_FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.RENDERBUFFER, Ue.__webglColorRenderbuffer[Ye]);
- const Ee = n.get(I[Ye]).__webglTexture;
+ i.framebufferRenderbuffer(i.READ_FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.RENDERBUFFER, Qe.__webglColorRenderbuffer[Je]);
+ const Ee = n.get(M[Je]).__webglTexture;
i.framebufferTexture2D(i.DRAW_FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, Ee, 0);
}
- i.blitFramebuffer(0, 0, Z, le, 0, 0, Z, le, pe, i.NEAREST), c === !0 && (Je.length = 0, G.length = 0, Je.push(i.COLOR_ATTACHMENT0 + Ye), L.depthBuffer && L.resolveDepthBuffer === !1 && (Je.push(oe), G.push(oe), i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER, G)), i.invalidateFramebuffer(i.READ_FRAMEBUFFER, Je));
+ i.blitFramebuffer(0, 0, Z, le, 0, 0, Z, le, pe, i.NEAREST), c === !0 && ($e.length = 0, H.length = 0, $e.push(i.COLOR_ATTACHMENT0 + Je), 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 Ye = 0; Ye < I.length; Ye++) {
- t.bindFramebuffer(i.FRAMEBUFFER, Ue.__webglMultisampledFramebuffer), i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Ye, i.RENDERBUFFER, Ue.__webglColorRenderbuffer[Ye]);
- const Ee = n.get(I[Ye]).__webglTexture;
- t.bindFramebuffer(i.FRAMEBUFFER, Ue.__webglFramebuffer), i.framebufferTexture2D(i.DRAW_FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Ye, i.TEXTURE_2D, Ee, 0);
+ for (let Je = 0; Je < M.length; Je++) {
+ t.bindFramebuffer(i.FRAMEBUFFER, Qe.__webglMultisampledFramebuffer), i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Je, i.RENDERBUFFER, Qe.__webglColorRenderbuffer[Je]);
+ const Ee = n.get(M[Je]).__webglTexture;
+ t.bindFramebuffer(i.FRAMEBUFFER, Qe.__webglFramebuffer), i.framebufferTexture2D(i.DRAW_FRAMEBUFFER, i.COLOR_ATTACHMENT0 + Je, i.TEXTURE_2D, Ee, 0);
}
- t.bindFramebuffer(i.DRAW_FRAMEBUFFER, Ue.__webglMultisampledFramebuffer);
+ t.bindFramebuffer(i.DRAW_FRAMEBUFFER, Qe.__webglMultisampledFramebuffer);
} else if (L.depthBuffer && L.resolveDepthBuffer === !1 && c) {
- const I = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT;
- i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER, [I]);
+ const M = L.stencilBuffer ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT;
+ i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER, [M]);
}
}
}
- function dt(L) {
+ function pt(L) {
return Math.min(s.maxSamples, L.samples);
}
- function pt(L) {
- const I = n.get(L);
- return L.samples > 0 && e.has("WEBGL_multisampled_render_to_texture") === !0 && I.__useRenderToTexture !== !1;
+ function gt(L) {
+ const M = n.get(L);
+ return L.samples > 0 && e.has("WEBGL_multisampled_render_to_texture") === !0 && M.__useRenderToTexture !== !1;
}
- function ze(L) {
- const I = a.render.frame;
- h.get(L) !== I && (h.set(L, I), L.update());
+ function We(L) {
+ const M = a.render.frame;
+ h.get(L) !== M && (h.set(L, M), L.update());
}
- function Rt(L, I) {
+ function Nt(L, M) {
const Z = L.colorSpace, le = L.format, pe = L.type;
- return L.isCompressedTexture === !0 || L.isVideoTexture === !0 || Z !== ln && Z !== Ai && (mt.getTransfer(Z) === Mt ? (le !== on || pe !== rn) && console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : console.error("THREE.WebGLTextures: Unsupported texture color space:", Z)), I;
+ 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 Ge(L) {
+ 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 = Qe, this.setupRenderTarget = vt, this.updateRenderTargetMipmap = lt, this.updateMultisampleRenderTarget = dn, this.setupDepthRenderbuffer = $e, this.setupFrameBufferTexture = be, this.useMultisampledRTT = pt;
+ 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;
}
-function aI(i, e) {
- function t(n, s = Ai) {
+function a1(i, e) {
+ function t(n, s = vi) {
let r;
- const a = mt.getTransfer(s);
- if (n === rn) return i.UNSIGNED_BYTE;
- if (n === af) return i.UNSIGNED_SHORT_4_4_4_4;
- if (n === of) return i.UNSIGNED_SHORT_5_5_5_1;
- if (n === Lm) return i.UNSIGNED_INT_5_9_9_9_REV;
- if (n === Fm) return i.BYTE;
- if (n === Dm) return i.SHORT;
- if (n === Io) return i.UNSIGNED_SHORT;
- if (n === rf) return i.INT;
- if (n === xr) return i.UNSIGNED_INT;
- if (n === an) return i.FLOAT;
- if (n === Rn) return i.HALF_FLOAT;
- if (n === Pm) return i.ALPHA;
- if (n === km) return i.RGB;
- if (n === on) return i.RGBA;
- if (n === Bo) return i.DEPTH_COMPONENT;
- if (n === To) return i.DEPTH_STENCIL;
- if (n === ns) return i.RED;
- if (n === cf) return i.RED_INTEGER;
- if (n === hr) return i.RG;
- if (n === lf) return i.RG_INTEGER;
- if (n === hf) return i.RGBA_INTEGER;
- if (n === al || n === go || n === ol || n === mo)
- if (a === Mt)
+ 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 === 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 === pn) return i.RGBA;
+ if (n === Qo) return i.DEPTH_COMPONENT;
+ if (n === Go) 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 (a === Rt)
if (r = e.get("WEBGL_compressed_texture_s3tc_srgb"), r !== null) {
- if (n === al) return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;
- if (n === go) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
- if (n === ol) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
- if (n === mo) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
+ 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;
} else
return null;
else if (r = e.get("WEBGL_compressed_texture_s3tc"), r !== null) {
- if (n === al) return r.COMPRESSED_RGB_S3TC_DXT1_EXT;
- if (n === go) return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;
- if (n === ol) return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;
- if (n === mo) return r.COMPRESSED_RGBA_S3TC_DXT5_EXT;
+ 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;
} else
return null;
- if (n === gl || n === Wu || n === ml || n === qu)
+ if (n === Nl || n === md || n === Ll || n === xd)
if (r = e.get("WEBGL_compressed_texture_pvrtc"), r !== null) {
- if (n === gl) return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
- if (n === Wu) return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
- if (n === ml) return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
- if (n === qu) return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
+ 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;
} else
return null;
- if (n === bl || n === xl || n === El)
+ if (n === Pl || n === kl || n === Ul)
if (r = e.get("WEBGL_compressed_texture_etc"), r !== null) {
- if (n === bl || n === xl) return a === Mt ? r.COMPRESSED_SRGB8_ETC2 : r.COMPRESSED_RGB8_ETC2;
- if (n === El) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : r.COMPRESSED_RGBA8_ETC2_EAC;
+ 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;
} else
return null;
- if (n === Ro || n === Ku || n === ju || n === Xu || n === No || n === Yu || n === Ju || n === Zu || n === $u || n === ed || n === td || n === nd || n === id || n === sd)
+ 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 (r = e.get("WEBGL_compressed_texture_astc"), r !== null) {
- if (n === Ro) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : r.COMPRESSED_RGBA_ASTC_4x4_KHR;
- if (n === Ku) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : r.COMPRESSED_RGBA_ASTC_5x4_KHR;
- if (n === ju) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : r.COMPRESSED_RGBA_ASTC_5x5_KHR;
- if (n === Xu) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : r.COMPRESSED_RGBA_ASTC_6x5_KHR;
- if (n === No) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : r.COMPRESSED_RGBA_ASTC_6x6_KHR;
- if (n === Yu) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : r.COMPRESSED_RGBA_ASTC_8x5_KHR;
- if (n === Ju) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : r.COMPRESSED_RGBA_ASTC_8x6_KHR;
- if (n === Zu) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : r.COMPRESSED_RGBA_ASTC_8x8_KHR;
- if (n === $u) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : r.COMPRESSED_RGBA_ASTC_10x5_KHR;
- if (n === ed) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : r.COMPRESSED_RGBA_ASTC_10x6_KHR;
- if (n === td) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : r.COMPRESSED_RGBA_ASTC_10x8_KHR;
- if (n === nd) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : r.COMPRESSED_RGBA_ASTC_10x10_KHR;
- if (n === id) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : r.COMPRESSED_RGBA_ASTC_12x10_KHR;
- if (n === sd) return a === Mt ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : r.COMPRESSED_RGBA_ASTC_12x12_KHR;
+ 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;
} else
return null;
- if (n === bo || n === rd || n === _l)
+ if (n === Bo || n === Rd || n === Ol)
if (r = e.get("EXT_texture_compression_bptc"), r !== null) {
- if (n === bo) return a === Mt ? 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 === _l) return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
+ 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;
} else
return null;
- if (n === Um || n === ad || n === od || n === cd)
+ if (n === g0 || n === Fd || n === Dd || n === Nd)
if (r = e.get("EXT_texture_compression_rgtc"), r !== null) {
- if (n === bo) return r.COMPRESSED_RED_RGTC1_EXT;
- if (n === ad) return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;
- if (n === od) return r.COMPRESSED_RED_GREEN_RGTC2_EXT;
- if (n === cd) return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
+ 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;
} else
return null;
- return n === Mo ? i.UNSIGNED_INT_24_8 : i[n] !== void 0 ? i[n] : null;
+ return n === Oo ? i.UNSIGNED_INT_24_8 : i[n] !== void 0 ? i[n] : null;
}
return { convert: t };
}
-const oI = `
+const o1 = `
void main() {
gl_Position = vec4( position, 1.0 );
-}`, cI = `
+}`, c1 = `
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
@@ -22475,7 +23091,7 @@ void main() {
}
}`;
-class lI {
+class l1 {
/**
* Constructs a new depth sensing module.
*/
@@ -22491,7 +23107,7 @@ class lI {
*/
init(e, t, n) {
if (this.texture === null) {
- const s = new cn(), r = e.properties.get(s);
+ const s = new an(), 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;
}
}
@@ -22503,16 +23119,16 @@ class lI {
*/
getMesh(e) {
if (this.texture !== null && this.mesh === null) {
- const t = e.cameras[0].viewport, n = new Os({
- vertexShader: oI,
- fragmentShader: cI,
+ const t = e.cameras[0].viewport, n = new qs({
+ vertexShader: o1,
+ fragmentShader: c1,
uniforms: {
depthColor: { value: this.texture },
depthWidth: { value: t.z },
depthHeight: { value: t.w }
}
});
- this.mesh = new Jt(new Wl(20, 20), n);
+ this.mesh = new Zt(new gh(20, 20), n);
}
return this.mesh;
}
@@ -22531,7 +23147,7 @@ class lI {
return this.texture;
}
}
-class hI extends Hs {
+class h1 extends Ys {
/**
* Constructs a new WebGL renderer.
*
@@ -22541,41 +23157,41 @@ class hI extends Hs {
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, m = null;
- const g = new lI(), A = t.getContextAttributes();
- let p = null, y = null;
- const b = [], _ = [], M = new Ze();
+ 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();
let w = null;
- const S = new vn();
- S.viewport = new wt();
- const T = new vn();
- T.viewport = new wt();
- const C = [S, T], v = new gy();
+ const S = new Sn();
+ S.viewport = new mt();
+ const T = new Sn();
+ T.viewport = new mt();
+ const C = [S, T], v = new gw();
let F = null, K = null;
this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(se) {
- let me = b[se];
- return me === void 0 && (me = new Nh(), b[se] = me), me.getTargetRaySpace();
+ let me = x[se];
+ return me === void 0 && (me = new iu(), x[se] = me), me.getTargetRaySpace();
}, this.getControllerGrip = function(se) {
- let me = b[se];
- return me === void 0 && (me = new Nh(), b[se] = me), me.getGripSpace();
+ let me = x[se];
+ return me === void 0 && (me = new iu(), x[se] = me), me.getGripSpace();
}, this.getHand = function(se) {
- let me = b[se];
- return me === void 0 && (me = new Nh(), b[se] = me), me.getHandSpace();
+ let me = x[se];
+ return me === void 0 && (me = new iu(), x[se] = me), me.getHandSpace();
};
function q(se) {
- const me = _.indexOf(se.inputSource);
+ const me = E.indexOf(se.inputSource);
if (me === -1)
return;
- const be = b[me];
- be !== void 0 && (be.update(se.inputSource, se.frame, l || a), be.dispatchEvent({ type: se.type, data: se.inputSource }));
+ 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 < b.length; se++) {
- const me = _[se];
- me !== null && (_[se] = null, b[se].disconnect(me));
+ 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, g.reset(), e.setRenderTarget(p), f = null, d = null, u = null, s = null, y = null, Me.stop(), n.isPresenting = !1, e.setPixelRatio(w), e.setSize(M.width, M.height, !1), n.dispatchEvent({ type: "sessionend" });
+ 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" });
}
this.setFramebufferScaleFactor = function(se) {
r = se, n.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.");
@@ -22590,49 +23206,49 @@ class hI extends Hs {
}, this.getBinding = function() {
return u;
}, this.getFrame = function() {
- return m;
+ return p;
}, this.getSession = function() {
return s;
}, this.setSession = async function(se) {
if (s = se, s !== null) {
- if (p = 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), A.xrCompatible !== !0 && await t.makeXRCompatible(), w = e.getPixelRatio(), e.getSize(M), typeof XRWebGLBinding < "u" && "createProjectionLayer" in XRWebGLBinding.prototype) {
- let be = null, xe = null, Pe = null;
- A.depth && (Pe = A.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, be = A.stencil ? To : Bo, xe = A.stencil ? Mo : xr);
- const $e = {
+ 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 ? Go : Qo, be = g.stencil ? Oo : Ir);
+ const et = {
colorFormat: t.RGBA8,
- depthFormat: Pe,
+ depthFormat: Ue,
scaleFactor: r
};
- u = new XRWebGLBinding(s, t), d = u.createProjectionLayer($e), s.updateRenderState({ layers: [d] }), e.setPixelRatio(1), e.setSize(d.textureWidth, d.textureHeight, !1), y = new Er(
+ 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(
d.textureWidth,
d.textureHeight,
{
- format: on,
- type: rn,
- depthTexture: new i0(d.textureWidth, d.textureHeight, xe, void 0, void 0, void 0, void 0, void 0, void 0, be),
- stencilBuffer: A.stencil,
+ 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),
+ stencilBuffer: g.stencil,
colorSpace: e.outputColorSpace,
- samples: A.antialias ? 4 : 0,
+ samples: g.antialias ? 4 : 0,
resolveDepthBuffer: d.ignoreDepthValues === !1,
resolveStencilBuffer: d.ignoreDepthValues === !1
}
);
} else {
- const be = {
- antialias: A.antialias,
+ const xe = {
+ antialias: g.antialias,
alpha: !0,
- depth: A.depth,
- stencil: A.stencil,
+ depth: g.depth,
+ stencil: g.stencil,
framebufferScaleFactor: r
};
- f = new XRWebGLLayer(s, t, be), s.updateRenderState({ baseLayer: f }), e.setPixelRatio(1), e.setSize(f.framebufferWidth, f.framebufferHeight, !1), y = new Er(
+ f = new XRWebGLLayer(s, t, xe), s.updateRenderState({ baseLayer: f }), e.setPixelRatio(1), e.setSize(f.framebufferWidth, f.framebufferHeight, !1), y = new Mr(
f.framebufferWidth,
f.framebufferHeight,
{
- format: on,
- type: rn,
+ format: pn,
+ type: un,
colorSpace: e.outputColorSpace,
- stencilBuffer: A.stencil,
+ stencilBuffer: g.stencil,
resolveDepthBuffer: f.ignoreDepthValues === !1,
resolveStencilBuffer: f.ignoreDepthValues === !1
}
@@ -22644,40 +23260,40 @@ class hI extends Hs {
if (s !== null)
return s.environmentBlendMode;
}, this.getDepthTexture = function() {
- return g.getDepthTexture();
+ return m.getDepthTexture();
};
- function D(se) {
+ function N(se) {
for (let me = 0; me < se.removed.length; me++) {
- const be = se.removed[me], xe = _.indexOf(be);
- xe >= 0 && (_[xe] = null, b[xe].disconnect(be));
+ 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 be = se.added[me];
- let xe = _.indexOf(be);
- if (xe === -1) {
- for (let $e = 0; $e < b.length; $e++)
- if ($e >= _.length) {
- _.push(be), xe = $e;
+ 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] === null) {
- _[$e] = be, xe = $e;
+ } else if (E[et] === null) {
+ E[et] = xe, be = et;
break;
}
- if (xe === -1) break;
+ if (be === -1) break;
}
- const Pe = b[xe];
- Pe && Pe.connect(be);
+ const Ue = x[be];
+ Ue && Ue.connect(xe);
}
}
- const O = new H(), Y = new H();
- function Q(se, me, be) {
- O.setFromMatrixPosition(me.matrixWorld), Y.setFromMatrixPosition(be.matrixWorld);
- const xe = O.distanceTo(Y), Pe = me.projectionMatrix.elements, $e = be.projectionMatrix.elements, Qe = Pe[14] / (Pe[10] - 1), vt = Pe[14] / (Pe[10] + 1), lt = (Pe[9] + 1) / Pe[5], Je = (Pe[9] - 1) / Pe[5], G = (Pe[8] - 1) / Pe[0], dn = ($e[8] + 1) / $e[0], dt = Qe * G, pt = Qe * dn, ze = xe / (-G + dn), Rt = ze * -G;
- if (me.matrixWorld.decompose(se.position, se.quaternion, se.scale), se.translateX(Rt), se.translateZ(ze), se.matrixWorld.compose(se.position, se.quaternion, se.scale), se.matrixWorldInverse.copy(se.matrixWorld).invert(), Pe[10] === -1)
+ 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)
se.projectionMatrix.copy(me.projectionMatrix), se.projectionMatrixInverse.copy(me.projectionMatrixInverse);
else {
- const Ge = Qe + ze, L = vt + ze, I = dt - Rt, Z = pt + (xe - Rt), le = lt * vt / L * Ge, pe = Je * vt / L * Ge;
- se.projectionMatrix.makePerspective(I, Z, le, pe, Ge, L), se.projectionMatrixInverse.copy(se.projectionMatrix).invert();
+ const ze = He + We, L = It + We, M = pt - Nt, Z = gt + (be - Nt), le = ht * It / L * ze, pe = $e * It / L * ze;
+ se.projectionMatrix.makePerspective(M, Z, le, pe, ze, L), se.projectionMatrixInverse.copy(se.projectionMatrix).invert();
}
}
function J(se, me) {
@@ -22685,19 +23301,19 @@ class hI extends Hs {
}
this.updateCamera = function(se) {
if (s === null) return;
- let me = se.near, be = se.far;
- g.texture !== null && (g.depthNear > 0 && (me = g.depthNear), g.depthFar > 0 && (be = g.depthFar)), v.near = T.near = S.near = me, v.far = T.far = S.far = be, (F !== v.near || K !== v.far) && (s.updateRenderState({
+ 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 xe = se.parent, Pe = v.cameras;
- J(v, xe);
- for (let $e = 0; $e < Pe.length; $e++)
- J(Pe[$e], xe);
- Pe.length === 2 ? Q(v, S, T) : v.projectionMatrix.copy(S.projectionMatrix), ee(se, v, xe);
+ 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, be) {
- be === null ? se.matrix.copy(me.matrixWorld) : (se.matrix.copy(be.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 = va * 2 * Math.atan(1 / se.projectionMatrix.elements[5]), se.zoom = 1);
+ 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);
}
this.getCamera = function() {
return v;
@@ -22707,124 +23323,124 @@ class hI extends Hs {
}, this.setFoveation = function(se) {
c = se, d !== null && (d.fixedFoveation = se), f !== null && f.fixedFoveation !== void 0 && (f.fixedFoveation = se);
}, this.hasDepthSensing = function() {
- return g.texture !== null;
+ return m.texture !== null;
}, this.getDepthSensingMesh = function() {
- return g.getMesh(v);
+ return m.getMesh(v);
};
let ae = null;
function ye(se, me) {
- if (h = me.getViewerPose(l || a), m = me, h !== null) {
- const be = h.views;
+ if (h = me.getViewerPose(l || a), p = me, h !== null) {
+ const xe = h.views;
f !== null && (e.setRenderTargetFramebuffer(y, f.framebuffer), e.setRenderTarget(y));
- let xe = !1;
- be.length !== v.cameras.length && (v.cameras.length = 0, xe = !0);
- for (let Qe = 0; Qe < be.length; Qe++) {
- const vt = be[Qe];
- let lt = null;
+ 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];
+ let ht = null;
if (f !== null)
- lt = f.getViewport(vt);
+ ht = f.getViewport(It);
else {
- const G = u.getViewSubImage(d, vt);
- lt = G.viewport, Qe === 0 && (e.setRenderTargetTextures(
+ const H = u.getViewSubImage(d, It);
+ ht = H.viewport, He === 0 && (e.setRenderTargetTextures(
y,
- G.colorTexture,
- G.depthStencilTexture
+ H.colorTexture,
+ H.depthStencilTexture
), e.setRenderTarget(y));
}
- let Je = C[Qe];
- Je === void 0 && (Je = new vn(), Je.layers.enable(Qe), Je.viewport = new wt(), C[Qe] = Je), Je.matrix.fromArray(vt.transform.matrix), Je.matrix.decompose(Je.position, Je.quaternion, Je.scale), Je.projectionMatrix.fromArray(vt.projectionMatrix), Je.projectionMatrixInverse.copy(Je.projectionMatrix).invert(), Je.viewport.set(lt.x, lt.y, lt.width, lt.height), Qe === 0 && (v.matrix.copy(Je.matrix), v.matrix.decompose(v.position, v.quaternion, v.scale)), xe === !0 && v.cameras.push(Je);
+ 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);
}
- const Pe = s.enabledFeatures;
- if (Pe && Pe.includes("depth-sensing") && s.depthUsage == "gpu-optimized" && u) {
- const Qe = u.getDepthInformation(be[0]);
- Qe && Qe.isValid && Qe.texture && g.init(e, Qe, s.renderState);
+ 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 be = 0; be < b.length; be++) {
- const xe = _[be], Pe = b[be];
- xe !== null && Pe !== void 0 && Pe.update(xe, me, l || a);
+ 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 }), m = null;
+ ae && ae(se, me), me.detectedPlanes && n.dispatchEvent({ type: "planesdetected", data: me }), p = null;
}
- const Me = new d0();
+ const Me = new q0();
Me.setAnimationLoop(ye), this.setAnimationLoop = function(se) {
ae = se;
}, this.dispose = function() {
};
}
}
-const Zs = /* @__PURE__ */ new Di(), uI = /* @__PURE__ */ new st();
-function dI(i, e) {
- function t(A, p) {
- A.matrixAutoUpdate === !0 && A.updateMatrix(), p.value.copy(A.matrix);
+const ar = /* @__PURE__ */ new dn(), u1 = /* @__PURE__ */ new De();
+function d1(i, e) {
+ function t(g, A) {
+ g.matrixAutoUpdate === !0 && g.updateMatrix(), A.value.copy(g.matrix);
}
- function n(A, p) {
- p.color.getRGB(A.fogColor.value, Zm(i)), p.isFog ? (A.fogNear.value = p.near, A.fogFar.value = p.far) : p.isFogExp2 && (A.fogDensity.value = p.density);
+ 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);
}
- function s(A, p, y, b, _) {
- p.isMeshBasicMaterial || p.isMeshLambertMaterial ? r(A, p) : p.isMeshToonMaterial ? (r(A, p), u(A, p)) : p.isMeshPhongMaterial ? (r(A, p), h(A, p)) : p.isMeshStandardMaterial ? (r(A, p), d(A, p), p.isMeshPhysicalMaterial && f(A, p, _)) : p.isMeshMatcapMaterial ? (r(A, p), m(A, p)) : p.isMeshDepthMaterial ? r(A, p) : p.isMeshDistanceMaterial ? (r(A, p), g(A, p)) : p.isMeshNormalMaterial ? r(A, p) : p.isLineBasicMaterial ? (a(A, p), p.isLineDashedMaterial && o(A, p)) : p.isPointsMaterial ? c(A, p, y, b) : p.isSpriteMaterial ? l(A, p) : p.isShadowMaterial ? (A.color.value.copy(p.color), A.opacity.value = p.opacity) : p.isShaderMaterial && (p.uniformsNeedUpdate = !1);
+ 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 r(A, p) {
- A.opacity.value = p.opacity, p.color && A.diffuse.value.copy(p.color), p.emissive && A.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity), p.map && (A.map.value = p.map, t(p.map, A.mapTransform)), p.alphaMap && (A.alphaMap.value = p.alphaMap, t(p.alphaMap, A.alphaMapTransform)), p.bumpMap && (A.bumpMap.value = p.bumpMap, t(p.bumpMap, A.bumpMapTransform), A.bumpScale.value = p.bumpScale, p.side === Ln && (A.bumpScale.value *= -1)), p.normalMap && (A.normalMap.value = p.normalMap, t(p.normalMap, A.normalMapTransform), A.normalScale.value.copy(p.normalScale), p.side === Ln && A.normalScale.value.negate()), p.displacementMap && (A.displacementMap.value = p.displacementMap, t(p.displacementMap, A.displacementMapTransform), A.displacementScale.value = p.displacementScale, A.displacementBias.value = p.displacementBias), p.emissiveMap && (A.emissiveMap.value = p.emissiveMap, t(p.emissiveMap, A.emissiveMapTransform)), p.specularMap && (A.specularMap.value = p.specularMap, t(p.specularMap, A.specularMapTransform)), p.alphaTest > 0 && (A.alphaTest.value = p.alphaTest);
- const y = e.get(p), b = y.envMap, _ = y.envMapRotation;
- b && (A.envMap.value = b, Zs.copy(_), Zs.x *= -1, Zs.y *= -1, Zs.z *= -1, b.isCubeTexture && b.isRenderTargetTexture === !1 && (Zs.y *= -1, Zs.z *= -1), A.envMapRotation.value.setFromMatrix4(uI.makeRotationFromEuler(Zs)), A.flipEnvMap.value = b.isCubeTexture && b.isRenderTargetTexture === !1 ? -1 : 1, A.reflectivity.value = p.reflectivity, A.ior.value = p.ior, A.refractionRatio.value = p.refractionRatio), p.lightMap && (A.lightMap.value = p.lightMap, A.lightMapIntensity.value = p.lightMapIntensity, t(p.lightMap, A.lightMapTransform)), p.aoMap && (A.aoMap.value = p.aoMap, A.aoMapIntensity.value = p.aoMapIntensity, t(p.aoMap, A.aoMapTransform));
+ 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));
}
- function a(A, p) {
- A.diffuse.value.copy(p.color), A.opacity.value = p.opacity, p.map && (A.map.value = p.map, t(p.map, A.mapTransform));
+ 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(A, p) {
- A.dashSize.value = p.dashSize, A.totalSize.value = p.dashSize + p.gapSize, A.scale.value = p.scale;
+ function o(g, A) {
+ g.dashSize.value = A.dashSize, g.totalSize.value = A.dashSize + A.gapSize, g.scale.value = A.scale;
}
- function c(A, p, y, b) {
- A.diffuse.value.copy(p.color), A.opacity.value = p.opacity, A.size.value = p.size * y, A.scale.value = b * 0.5, p.map && (A.map.value = p.map, t(p.map, A.uvTransform)), p.alphaMap && (A.alphaMap.value = p.alphaMap, t(p.alphaMap, A.alphaMapTransform)), p.alphaTest > 0 && (A.alphaTest.value = p.alphaTest);
+ 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 l(A, p) {
- A.diffuse.value.copy(p.color), A.opacity.value = p.opacity, A.rotation.value = p.rotation, p.map && (A.map.value = p.map, t(p.map, A.mapTransform)), p.alphaMap && (A.alphaMap.value = p.alphaMap, t(p.alphaMap, A.alphaMapTransform)), p.alphaTest > 0 && (A.alphaTest.value = p.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(A, p) {
- A.specular.value.copy(p.specular), A.shininess.value = Math.max(p.shininess, 1e-4);
+ function h(g, A) {
+ g.specular.value.copy(A.specular), g.shininess.value = Math.max(A.shininess, 1e-4);
}
- function u(A, p) {
- p.gradientMap && (A.gradientMap.value = p.gradientMap);
+ function u(g, A) {
+ A.gradientMap && (g.gradientMap.value = A.gradientMap);
}
- function d(A, p) {
- A.metalness.value = p.metalness, p.metalnessMap && (A.metalnessMap.value = p.metalnessMap, t(p.metalnessMap, A.metalnessMapTransform)), A.roughness.value = p.roughness, p.roughnessMap && (A.roughnessMap.value = p.roughnessMap, t(p.roughnessMap, A.roughnessMapTransform)), p.envMap && (A.envMapIntensity.value = p.envMapIntensity);
+ 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(A, p, y) {
- A.ior.value = p.ior, p.sheen > 0 && (A.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen), A.sheenRoughness.value = p.sheenRoughness, p.sheenColorMap && (A.sheenColorMap.value = p.sheenColorMap, t(p.sheenColorMap, A.sheenColorMapTransform)), p.sheenRoughnessMap && (A.sheenRoughnessMap.value = p.sheenRoughnessMap, t(p.sheenRoughnessMap, A.sheenRoughnessMapTransform))), p.clearcoat > 0 && (A.clearcoat.value = p.clearcoat, A.clearcoatRoughness.value = p.clearcoatRoughness, p.clearcoatMap && (A.clearcoatMap.value = p.clearcoatMap, t(p.clearcoatMap, A.clearcoatMapTransform)), p.clearcoatRoughnessMap && (A.clearcoatRoughnessMap.value = p.clearcoatRoughnessMap, t(p.clearcoatRoughnessMap, A.clearcoatRoughnessMapTransform)), p.clearcoatNormalMap && (A.clearcoatNormalMap.value = p.clearcoatNormalMap, t(p.clearcoatNormalMap, A.clearcoatNormalMapTransform), A.clearcoatNormalScale.value.copy(p.clearcoatNormalScale), p.side === Ln && A.clearcoatNormalScale.value.negate())), p.dispersion > 0 && (A.dispersion.value = p.dispersion), p.iridescence > 0 && (A.iridescence.value = p.iridescence, A.iridescenceIOR.value = p.iridescenceIOR, A.iridescenceThicknessMinimum.value = p.iridescenceThicknessRange[0], A.iridescenceThicknessMaximum.value = p.iridescenceThicknessRange[1], p.iridescenceMap && (A.iridescenceMap.value = p.iridescenceMap, t(p.iridescenceMap, A.iridescenceMapTransform)), p.iridescenceThicknessMap && (A.iridescenceThicknessMap.value = p.iridescenceThicknessMap, t(p.iridescenceThicknessMap, A.iridescenceThicknessMapTransform))), p.transmission > 0 && (A.transmission.value = p.transmission, A.transmissionSamplerMap.value = y.texture, A.transmissionSamplerSize.value.set(y.width, y.height), p.transmissionMap && (A.transmissionMap.value = p.transmissionMap, t(p.transmissionMap, A.transmissionMapTransform)), A.thickness.value = p.thickness, p.thicknessMap && (A.thicknessMap.value = p.thicknessMap, t(p.thicknessMap, A.thicknessMapTransform)), A.attenuationDistance.value = p.attenuationDistance, A.attenuationColor.value.copy(p.attenuationColor)), p.anisotropy > 0 && (A.anisotropyVector.value.set(p.anisotropy * Math.cos(p.anisotropyRotation), p.anisotropy * Math.sin(p.anisotropyRotation)), p.anisotropyMap && (A.anisotropyMap.value = p.anisotropyMap, t(p.anisotropyMap, A.anisotropyMapTransform))), A.specularIntensity.value = p.specularIntensity, A.specularColor.value.copy(p.specularColor), p.specularColorMap && (A.specularColorMap.value = p.specularColorMap, t(p.specularColorMap, A.specularColorMapTransform)), p.specularIntensityMap && (A.specularIntensityMap.value = p.specularIntensityMap, t(p.specularIntensityMap, A.specularIntensityMapTransform));
+ 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 m(A, p) {
- p.matcap && (A.matcap.value = p.matcap);
+ function p(g, A) {
+ A.matcap && (g.matcap.value = A.matcap);
}
- function g(A, p) {
- const y = e.get(p).light;
- A.referencePosition.value.setFromMatrixPosition(y.matrixWorld), A.nearDistance.value = y.shadow.camera.near, A.farDistance.value = y.shadow.camera.far;
+ 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;
}
return {
refreshFogUniforms: n,
refreshMaterialUniforms: s
};
}
-function fI(i, e, t, n) {
+function f1(i, e, t, n) {
let s = {}, r = {}, a = [];
const o = i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);
- function c(y, b) {
- const _ = b.program;
- n.uniformBlockBinding(y, _);
- }
- function l(y, b) {
- let _ = s[y.id];
- _ === void 0 && (m(y), _ = h(y), s[y.id] = _, y.addEventListener("dispose", A));
- const M = b.program;
- n.updateUBOMapping(y, M);
+ function c(y, x) {
+ const E = x.program;
+ n.uniformBlockBinding(y, 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);
const w = e.render.frame;
r[y.id] !== w && (d(y), r[y.id] = w);
}
function h(y) {
- const b = u();
- y.__bindingPointIndex = b;
- const _ = i.createBuffer(), M = y.__size, w = y.usage;
- return i.bindBuffer(i.UNIFORM_BUFFER, _), i.bufferData(i.UNIFORM_BUFFER, M, w), i.bindBuffer(i.UNIFORM_BUFFER, null), i.bindBufferBase(i.UNIFORM_BUFFER, b, _), _;
+ 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;
}
function u() {
for (let y = 0; y < o; y++)
@@ -22833,17 +23449,17 @@ function fI(i, e, t, n) {
return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."), 0;
}
function d(y) {
- const b = s[y.id], _ = y.uniforms, M = y.__cache;
- i.bindBuffer(i.UNIFORM_BUFFER, b);
- for (let w = 0, S = _.length; w < S; w++) {
- const T = Array.isArray(_[w]) ? _[w] : [_[w]];
+ const x = s[y.id], E = y.uniforms, I = y.__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, M) === !0) {
+ if (f(F, w, C, I) === !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 = g(O);
+ 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);
@@ -22852,53 +23468,53 @@ function fI(i, e, t, n) {
}
i.bindBuffer(i.UNIFORM_BUFFER, null);
}
- function f(y, b, _, M) {
- const w = y.value, S = b + "_" + _;
- if (M[S] === void 0)
- return typeof w == "number" || typeof w == "boolean" ? M[S] = w : M[S] = w.clone(), !0;
+ 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;
{
- const T = M[S];
+ const T = I[S];
if (typeof w == "number" || typeof w == "boolean") {
if (T !== w)
- return M[S] = w, !0;
+ return I[S] = w, !0;
} else if (T.equals(w) === !1)
return T.copy(w), !0;
}
return !1;
}
- function m(y) {
- const b = y.uniforms;
- let _ = 0;
- const M = 16;
- for (let S = 0, T = b.length; S < T; S++) {
- const C = Array.isArray(b[S]) ? b[S] : [b[S]];
+ function p(y) {
+ const x = y.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, D = q.length; $ < D; $++) {
- const O = q[$], Y = g(O), Q = _ % M, J = Q % Y.boundary, ee = Q + J;
- _ += J, ee !== 0 && M - ee < Y.storage && (_ += M - ee), K.__data = new Float32Array(Y.storage / Float32Array.BYTES_PER_ELEMENT), K.__offset = _, _ += Y.storage;
+ 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 = _ % M;
- return w > 0 && (_ += M - w), y.__size = _, y.__cache = {}, this;
+ const w = E % I;
+ return w > 0 && (E += I - w), y.__size = E, y.__cache = {}, this;
}
- function g(y) {
- const b = {
+ function m(y) {
+ const x = {
boundary: 0,
// bytes
storage: 0
// bytes
};
- return typeof y == "number" || typeof y == "boolean" ? (b.boundary = 4, b.storage = 4) : y.isVector2 ? (b.boundary = 8, b.storage = 8) : y.isVector3 || y.isColor ? (b.boundary = 16, b.storage = 12) : y.isVector4 ? (b.boundary = 16, b.storage = 16) : y.isMatrix3 ? (b.boundary = 48, b.storage = 48) : y.isMatrix4 ? (b.boundary = 64, b.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), b;
+ 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;
}
- function A(y) {
- const b = y.target;
- b.removeEventListener("dispose", A);
- const _ = a.indexOf(b.__bindingPointIndex);
- a.splice(_, 1), i.deleteBuffer(s[b.id]), delete s[b.id], delete r[b.id];
+ function g(y) {
+ const x = y.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 p() {
+ function A() {
for (const y in s)
i.deleteBuffer(s[y]);
a = [], s = {}, r = {};
@@ -22906,10 +23522,10 @@ function fI(i, e, t, n) {
return {
bind: c,
update: l,
- dispose: p
+ dispose: A
};
}
-class EA {
+class JA {
/**
* Constructs a new WebGL renderer.
*
@@ -22917,7 +23533,7 @@ class EA {
*/
constructor(e = {}) {
const {
- canvas: t = c_(),
+ canvas: t = q_(),
context: n = null,
depth: s = !0,
stencil: r = !1,
@@ -22937,9 +23553,9 @@ class EA {
f = n.getContextAttributes().alpha;
} else
f = a;
- const m = new Uint32Array(4), g = new Int32Array(4);
- let A = null, p = null;
- const y = [], b = [];
+ const p = new Uint32Array(4), m = new Int32Array(4);
+ let g = null, A = null;
+ const y = [], x = [];
this.domElement = t, this.debug = {
/**
* Enables error checking and reporting when shader programs are being compiled.
@@ -22951,30 +23567,30 @@ class EA {
* @type {?Function}
*/
onShaderError: null
- }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.toneMapping = Ls, this.toneMappingExposure = 1, this.transmissionResolutionScale = 1;
- const _ = this;
- let M = !1;
- this._outputColorSpace = Kt;
+ }, 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;
- const F = new wt(), K = new wt();
+ const F = new mt(), K = new mt();
let q = null;
- const $ = new je(0);
- let D = 0, O = t.width, Y = t.height, Q = 1, J = null, ee = null;
- const ae = new wt(0, 0, O, Y), ye = new wt(0, 0, O, Y);
+ 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 Me = !1;
- const se = new gf();
- let me = !1, be = !1;
- const xe = new st(), Pe = new st(), $e = new H(), Qe = new wt(), vt = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 };
- let lt = !1;
- function Je() {
+ const se = new zf();
+ 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 };
+ let ht = !1;
+ function $e() {
return T === null ? Q : 1;
}
- let G = n;
- function dn(E, R) {
- return t.getContext(E, R);
+ let H = n;
+ function xn(_, R) {
+ return t.getContext(_, R);
}
try {
- const E = {
+ const _ = {
alpha: !0,
depth: s,
stencil: r,
@@ -22984,87 +23600,87 @@ class EA {
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), G === null) {
+ 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) {
const R = "webgl2";
- if (G = dn(R, E), G === null)
- throw dn(R) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.");
+ if (H = xn(R, _), H === null)
+ throw xn(R) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.");
}
- } catch (E) {
- throw console.error("THREE.WebGLRenderer: " + E.message), E;
+ } catch (_) {
+ throw console.error("THREE.WebGLRenderer: " + _.message), _;
}
- let dt, pt, ze, Rt, Ge, L, I, Z, le, pe, oe, Ue, ve, Ve, Ye, Ee, Re, ke, Oe, Be, et, We, tt, W;
+ 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;
function ne() {
- dt = new vC(G), dt.init(), We = new aI(G, dt), pt = new mC(G, dt, e, We), ze = new sI(G, dt), pt.reverseDepthBuffer && d && ze.buffers.depth.setReversed(!0), Rt = new IC(G), Ge = new WS(), L = new rI(G, dt, ze, Ge, pt, We, Rt), I = new xC(_), Z = new wC(_), le = new Fy(G), tt = new AC(G, le), pe = new CC(G, le, Rt, tt), oe = new BC(G, pe, le, Rt), Oe = new MC(G, pt, L), Ee = new bC(Ge), Ue = new VS(_, I, Z, dt, pt, tt, Ee), ve = new dI(_, Ge), Ve = new KS(), Ye = new $S(dt), ke = new pC(_, I, Z, ze, oe, f, c), Re = new nI(_, oe, pt), W = new fI(G, Rt, pt, ze), Be = new gC(G, dt, Rt), et = new SC(G, dt, Rt), Rt.programs = Ue.programs, _.capabilities = pt, _.extensions = dt, _.properties = Ge, _.renderLists = Ve, _.shadowMap = Re, _.state = ze, _.info = Rt;
+ 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;
}
ne();
- const re = new hI(_, G);
+ const re = new h1(E, H);
this.xr = re, this.getContext = function() {
- return G;
+ return H;
}, this.getContextAttributes = function() {
- return G.getContextAttributes();
+ return H.getContextAttributes();
}, this.forceContextLoss = function() {
- const E = dt.get("WEBGL_lose_context");
- E && E.loseContext();
+ const _ = pt.get("WEBGL_lose_context");
+ _ && _.loseContext();
}, this.forceContextRestore = function() {
- const E = dt.get("WEBGL_lose_context");
- E && E.restoreContext();
+ const _ = pt.get("WEBGL_lose_context");
+ _ && _.restoreContext();
}, this.getPixelRatio = function() {
return Q;
- }, this.setPixelRatio = function(E) {
- E !== void 0 && (Q = E, this.setSize(O, Y, !1));
- }, this.getSize = function(E) {
- return E.set(O, Y);
- }, this.setSize = function(E, R, N = !0) {
+ }, this.setPixelRatio = function(_) {
+ _ !== void 0 && (Q = _, this.setSize(O, Y, !1));
+ }, this.getSize = function(_) {
+ return _.set(O, Y);
+ }, this.setSize = function(_, R, D = !0) {
if (re.isPresenting) {
console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");
return;
}
- O = E, Y = R, t.width = Math.floor(E * Q), t.height = Math.floor(R * Q), N === !0 && (t.style.width = E + "px", t.style.height = R + "px"), this.setViewport(0, 0, E, R);
- }, this.getDrawingBufferSize = function(E) {
- return E.set(O * Q, Y * Q).floor();
- }, this.setDrawingBufferSize = function(E, R, N) {
- O = E, Y = R, Q = N, t.width = Math.floor(E * N), t.height = Math.floor(R * N), this.setViewport(0, 0, E, R);
- }, this.getCurrentViewport = function(E) {
- return E.copy(F);
- }, this.getViewport = function(E) {
- return E.copy(ae);
- }, this.setViewport = function(E, R, N, U) {
- E.isVector4 ? ae.set(E.x, E.y, E.z, E.w) : ae.set(E, R, N, U), ze.viewport(F.copy(ae).multiplyScalar(Q).round());
- }, this.getScissor = function(E) {
- return E.copy(ye);
- }, this.setScissor = function(E, R, N, U) {
- E.isVector4 ? ye.set(E.x, E.y, E.z, E.w) : ye.set(E, R, N, U), ze.scissor(K.copy(ye).multiplyScalar(Q).round());
+ 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());
}, this.getScissorTest = function() {
return Me;
- }, this.setScissorTest = function(E) {
- ze.setScissorTest(Me = E);
- }, this.setOpaqueSort = function(E) {
- J = E;
- }, this.setTransparentSort = function(E) {
- ee = E;
- }, this.getClearColor = function(E) {
- return E.copy(ke.getClearColor());
+ }, this.setScissorTest = function(_) {
+ We.setScissorTest(Me = _);
+ }, this.setOpaqueSort = function(_) {
+ J = _;
+ }, this.setTransparentSort = function(_) {
+ ee = _;
+ }, this.getClearColor = function(_) {
+ return _.copy(Oe.getClearColor());
}, this.setClearColor = function() {
- ke.setClearColor(...arguments);
+ Oe.setClearColor(...arguments);
}, this.getClearAlpha = function() {
- return ke.getClearAlpha();
+ return Oe.getClearAlpha();
}, this.setClearAlpha = function() {
- ke.setClearAlpha(...arguments);
- }, this.clear = function(E = !0, R = !0, N = !0) {
+ Oe.setClearAlpha(...arguments);
+ }, this.clear = function(_ = !0, R = !0, D = !0) {
let U = 0;
- if (E) {
+ if (_) {
let P = !1;
if (T !== null) {
const z = T.texture.format;
- P = z === hf || z === lf || z === cf;
+ P = z === kf || z === Pf || z === Lf;
}
if (P) {
- const z = T.texture.type, j = z === rn || z === xr || z === Io || z === Mo || z === af || z === of, X = ke.getClearColor(), ie = ke.getClearAlpha(), he = X.r, ce = X.g, fe = X.b;
- j ? (m[0] = he, m[1] = ce, m[2] = fe, m[3] = ie, G.clearBufferuiv(G.COLOR, 0, m)) : (g[0] = he, g[1] = ce, g[2] = fe, g[3] = ie, G.clearBufferiv(G.COLOR, 0, g));
+ 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;
+ 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 |= G.COLOR_BUFFER_BIT;
+ U |= H.COLOR_BUFFER_BIT;
}
- R && (U |= G.DEPTH_BUFFER_BIT), N && (U |= G.STENCIL_BUFFER_BIT, this.state.buffers.stencil.setMask(4294967295)), G.clear(U);
+ 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() {
@@ -23072,83 +23688,83 @@ class EA {
}, 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), ke.dispose(), Ve.dispose(), Ye.dispose(), Ge.dispose(), I.dispose(), Z.dispose(), oe.dispose(), tt.dispose(), W.dispose(), Ue.dispose(), re.dispose(), re.removeEventListener("sessionstart", ac), re.removeEventListener("sessionend", oc), Oi.stop();
+ 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();
};
- function de(E) {
- E.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), M = !0;
+ function de(_) {
+ _.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), I = !0;
}
function Ie() {
- console.log("THREE.WebGLRenderer: Context Restored."), M = !1;
- const E = Rt.autoReset, R = Re.enabled, N = Re.autoUpdate, U = Re.needsUpdate, P = Re.type;
- ne(), Rt.autoReset = E, Re.enabled = R, Re.autoUpdate = N, Re.needsUpdate = U, Re.type = P;
- }
- function Ce(E) {
- console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", E.statusMessage);
- }
- function nt(E) {
- const R = E.target;
- R.removeEventListener("dispose", nt), Ut(R);
- }
- function Ut(E) {
- fn(E), Ge.remove(E);
- }
- function fn(E) {
- const R = Ge.get(E).programs;
- R !== void 0 && (R.forEach(function(N) {
- Ue.releaseProgram(N);
- }), E.isShaderMaterial && Ue.releaseShaderCache(E));
- }
- this.renderBufferDirect = function(E, R, N, U, P, z) {
- R === null && (R = vt);
- const j = P.isMesh && P.matrixWorld.determinant() < 0, X = hh(E, R, N, U, P);
- ze.setMaterial(U, j);
- let ie = N.index, he = 1;
+ 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 Ce(_) {
+ console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", _.statusMessage);
+ }
+ function it(_) {
+ const R = _.target;
+ R.removeEventListener("dispose", it), Qt(R);
+ }
+ function Qt(_) {
+ bn(_), ze.remove(_);
+ }
+ function bn(_) {
+ const R = ze.get(_).programs;
+ R !== void 0 && (R.forEach(function(D) {
+ Qe.releaseProgram(D);
+ }), _.isShaderMaterial && Qe.releaseShaderCache(_));
+ }
+ 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);
+ We.setMaterial(U, j);
+ let ie = D.index, he = 1;
if (U.wireframe === !0) {
- if (ie = pe.getWireframeAttribute(N), ie === void 0) return;
+ if (ie = pe.getWireframeAttribute(D), ie === void 0) return;
he = 2;
}
- const ce = N.drawRange, fe = N.attributes.position;
+ 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 De = _e - Ae;
- if (De < 0 || De === 1 / 0) return;
- tt.setup(P, U, X, N, ie);
- let qe, He = Be;
- if (ie !== null && (qe = le.get(ie), He = et, He.setIndex(qe)), P.isMesh)
- U.wireframe === !0 ? (ze.setLineWidth(U.wireframeLinewidth * Je()), He.setMode(G.LINES)) : He.setMode(G.TRIANGLES);
+ const Pe = _e - Ae;
+ if (Pe < 0 || Pe === 1 / 0) return;
+ nt.setup(P, U, X, D, 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);
else if (P.isLine) {
- let Ne = U.linewidth;
- Ne === void 0 && (Ne = 1), ze.setLineWidth(Ne * Je()), P.isLineSegments ? He.setMode(G.LINES) : P.isLineLoop ? He.setMode(G.LINE_LOOP) : He.setMode(G.LINE_STRIP);
- } else P.isPoints ? He.setMode(G.POINTS) : P.isSprite && He.setMode(G.TRIANGLES);
+ let Fe = U.linewidth;
+ Fe === void 0 && (Fe = 1), We.setLineWidth(Fe * $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)
- cl("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."), He.renderMultiDrawInstances(P._multiDrawStarts, P._multiDrawCounts, P._multiDrawCount, P._multiDrawInstances);
- else if (dt.get("WEBGL_multi_draw"))
- He.renderMultiDraw(P._multiDrawStarts, P._multiDrawCounts, P._multiDrawCount);
+ 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);
+ else if (pt.get("WEBGL_multi_draw"))
+ Ve.renderMultiDraw(P._multiDrawStarts, P._multiDrawCounts, P._multiDrawCount);
else {
- const Ne = P._multiDrawStarts, it = P._multiDrawCounts, Le = P._multiDrawCount, yt = ie ? le.get(ie).bytesPerElement : 1, en = Ge.get(U).currentProgram.getUniforms();
- for (let xt = 0; xt < Le; xt++)
- en.setValue(G, "_gl_DrawID", xt), He.render(Ne[xt] / yt, it[xt]);
+ const Fe = P._multiDrawStarts, st = P._multiDrawCounts, ke = P._multiDrawCount, St = 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]);
}
else if (P.isInstancedMesh)
- He.renderInstances(Ae, De, P.count);
- else if (N.isInstancedBufferGeometry) {
- const Ne = N._maxInstanceCount !== void 0 ? N._maxInstanceCount : 1 / 0, it = Math.min(N.instanceCount, Ne);
- He.renderInstances(Ae, De, it);
+ 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);
+ Ve.renderInstances(Ae, Pe, st);
} else
- He.render(Ae, De);
+ Ve.render(Ae, Pe);
};
- function _t(E, R, N) {
- E.transparent === !0 && E.side === Ti && E.forceSinglePass === !1 ? (E.side = Ln, E.needsUpdate = !0, Nr(E, R, N), E.side = us, E.needsUpdate = !0, Nr(E, R, N), E.side = Ti) : Nr(E, R, N);
- }
- this.compile = function(E, R, N = null) {
- N === null && (N = E), p = Ye.get(N), p.init(R), b.push(p), N.traverseVisible(function(P) {
- P.isLight && P.layers.test(R.layers) && (p.pushLight(P), P.castShadow && p.pushShadow(P));
- }), E !== N && E.traverseVisible(function(P) {
- P.isLight && P.layers.test(R.layers) && (p.pushLight(P), P.castShadow && p.pushShadow(P));
- }), p.setupLights();
+ 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);
+ }
+ this.compile = function(_, R, D = null) {
+ D === null && (D = _), A = Je.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));
+ }), _ !== D && _.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 E.traverse(function(P) {
+ return _.traverse(function(P) {
if (!(P.isMesh || P.isPoints || P.isLine || P.isSprite))
return;
const z = P.material;
@@ -23156,218 +23772,218 @@ class EA {
if (Array.isArray(z))
for (let j = 0; j < z.length; j++) {
const X = z[j];
- _t(X, N, P), U.add(X);
+ Ct(X, D, P), U.add(X);
}
else
- _t(z, N, P), U.add(z);
- }), p = b.pop(), U;
- }, this.compileAsync = function(E, R, N = null) {
- const U = this.compile(E, R, N);
+ Ct(z, D, P), U.add(z);
+ }), A = x.pop(), U;
+ }, this.compileAsync = function(_, R, D = null) {
+ const U = this.compile(_, R, D);
return new Promise((P) => {
function z() {
if (U.forEach(function(j) {
- Ge.get(j).currentProgram.isReady() && U.delete(j);
+ ze.get(j).currentProgram.isReady() && U.delete(j);
}), U.size === 0) {
- P(E);
+ P(_);
return;
}
setTimeout(z, 10);
}
- dt.get("KHR_parallel_shader_compile") !== null ? z() : setTimeout(z, 10);
+ pt.get("KHR_parallel_shader_compile") !== null ? z() : setTimeout(z, 10);
});
};
- let zn = null;
- function ai(E) {
- zn && zn(E);
+ let Yn = null;
+ function Ai(_) {
+ Yn && Yn(_);
}
- function ac() {
- Oi.stop();
+ function Ec() {
+ Wi.stop();
}
- function oc() {
- Oi.start();
+ function _c() {
+ Wi.start();
}
- const Oi = new d0();
- Oi.setAnimationLoop(ai), typeof self < "u" && Oi.setContext(self), this.setAnimationLoop = function(E) {
- zn = E, re.setAnimationLoop(E), E === null ? Oi.stop() : Oi.start();
- }, re.addEventListener("sessionstart", ac), re.addEventListener("sessionend", oc), this.render = function(E, R) {
+ 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) {
if (R !== void 0 && R.isCamera !== !0) {
console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
return;
}
- if (M === !0) return;
- if (E.matrixWorldAutoUpdate === !0 && E.updateMatrixWorld(), R.parent === null && R.matrixWorldAutoUpdate === !0 && R.updateMatrixWorld(), re.enabled === !0 && re.isPresenting === !0 && (re.cameraAutoUpdate === !0 && re.updateCamera(R), R = re.getCamera()), E.isScene === !0 && E.onBeforeRender(_, E, R, T), p = Ye.get(E, b.length), p.init(R), b.push(p), Pe.multiplyMatrices(R.projectionMatrix, R.matrixWorldInverse), se.setFromProjectionMatrix(Pe), be = this.localClippingEnabled, me = Ee.init(this.clippingPlanes, be), A = Ve.get(E, y.length), A.init(), y.push(A), re.enabled === !0 && re.isPresenting === !0) {
- const z = _.xr.getDepthSensingMesh();
- z !== null && za(z, R, -1 / 0, _.sortObjects);
+ 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) {
+ const z = E.xr.getDepthSensingMesh();
+ z !== null && Za(z, R, -1 / 0, E.sortObjects);
}
- za(E, R, 0, _.sortObjects), A.finish(), _.sortObjects === !0 && A.sort(J, ee), lt = re.enabled === !1 || re.isPresenting === !1 || re.hasDepthSensing() === !1, lt && ke.addToRenderList(A, E), this.info.render.frame++, me === !0 && Ee.beginShadows();
- const N = p.state.shadowsArray;
- Re.render(N, E, R), me === !0 && Ee.endShadows(), this.info.autoReset === !0 && this.info.reset();
- const U = A.opaque, P = A.transmissive;
- if (p.setupLights(), R.isArrayCamera) {
+ 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();
+ 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];
- cc(U, P, E, ie);
+ yc(U, P, _, ie);
}
- lt && ke.render(E);
+ ht && Oe.render(_);
for (let j = 0, X = z.length; j < X; j++) {
const ie = z[j];
- Va(A, E, ie, ie.viewport);
+ $a(g, _, ie, ie.viewport);
}
} else
- P.length > 0 && cc(U, P, E, R), lt && ke.render(E), Va(A, E, R);
- T !== null && S === 0 && (L.updateMultisampleRenderTarget(T), L.updateRenderTargetMipmap(T)), E.isScene === !0 && E.onAfterRender(_, E, R), tt.resetDefaultState(), C = -1, v = null, b.pop(), b.length > 0 ? (p = b[b.length - 1], me === !0 && Ee.setGlobalState(_.clippingPlanes, p.state.camera)) : p = null, y.pop(), y.length > 0 ? A = y[y.length - 1] : A = null;
+ 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;
};
- function za(E, R, N, U) {
- if (E.visible === !1) return;
- if (E.layers.test(R.layers)) {
- if (E.isGroup)
- N = E.renderOrder;
- else if (E.isLOD)
- E.autoUpdate === !0 && E.update(R);
- else if (E.isLight)
- p.pushLight(E), E.castShadow && p.pushShadow(E);
- else if (E.isSprite) {
- if (!E.frustumCulled || se.intersectsSprite(E)) {
- U && Qe.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Pe);
- const j = oe.update(E), X = E.material;
- X.visible && A.push(E, j, X, N, Qe.z, 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);
}
- } else if ((E.isMesh || E.isLine || E.isPoints) && (!E.frustumCulled || se.intersectsObject(E))) {
- const j = oe.update(E), X = E.material;
- if (U && (E.boundingSphere !== void 0 ? (E.boundingSphere === null && E.computeBoundingSphere(), Qe.copy(E.boundingSphere.center)) : (j.boundingSphere === null && j.computeBoundingSphere(), Qe.copy(j.boundingSphere.center)), Qe.applyMatrix4(E.matrixWorld).applyMatrix4(Pe)), Array.isArray(X)) {
+ } 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)) {
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 && A.push(E, j, Ae, N, Qe.z, fe);
+ Ae && Ae.visible && g.push(_, j, Ae, D, He.z, fe);
}
- } else X.visible && A.push(E, j, X, N, Qe.z, null);
+ } else X.visible && g.push(_, j, X, D, He.z, null);
}
}
- const z = E.children;
+ const z = _.children;
for (let j = 0, X = z.length; j < X; j++)
- za(z[j], R, N, U);
+ Za(z[j], R, D, U);
}
- function Va(E, R, N, U) {
- const P = E.opaque, z = E.transmissive, j = E.transparent;
- p.setupLightsView(N), me === !0 && Ee.setGlobalState(_.clippingPlanes, N), U && ze.viewport(F.copy(U)), P.length > 0 && Rr(P, R, N), z.length > 0 && Rr(z, R, N), j.length > 0 && Rr(j, R, N), ze.buffers.depth.setTest(!0), ze.buffers.depth.setMask(!0), ze.buffers.color.setMask(!0), ze.setPolygonOffset(!1);
+ 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 cc(E, R, N, U) {
- if ((N.isScene === !0 ? N.overrideMaterial : null) !== null)
+ function yc(_, R, D, U) {
+ if ((D.isScene === !0 ? D.overrideMaterial : null) !== null)
return;
- p.state.transmissionRenderTarget[U.id] === void 0 && (p.state.transmissionRenderTarget[U.id] = new Er(1, 1, {
+ A.state.transmissionRenderTarget[U.id] === void 0 && (A.state.transmissionRenderTarget[U.id] = new Mr(1, 1, {
generateMipmaps: !0,
- type: dt.has("EXT_color_buffer_half_float") || dt.has("EXT_color_buffer_float") ? Rn : rn,
- minFilter: ii,
+ type: pt.has("EXT_color_buffer_half_float") || pt.has("EXT_color_buffer_float") ? Qn : un,
+ minFilter: hi,
samples: 4,
stencilBuffer: r,
resolveDepthBuffer: !1,
resolveStencilBuffer: !1,
- colorSpace: mt.workingColorSpace
+ colorSpace: rt.workingColorSpace
}));
- const z = p.state.transmissionRenderTarget[U.id], j = U.viewport || F;
- z.setSize(j.z * _.transmissionResolutionScale, j.w * _.transmissionResolutionScale);
- const X = _.getRenderTarget();
- _.setRenderTarget(z), _.getClearColor($), D = _.getClearAlpha(), D < 1 && _.setClearColor(16777215, 0.5), _.clear(), lt && ke.render(N);
- const ie = _.toneMapping;
- _.toneMapping = Ls;
+ 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);
+ const ie = E.toneMapping;
+ E.toneMapping = Hs;
const he = U.viewport;
- if (U.viewport !== void 0 && (U.viewport = void 0), p.setupLightsView(U), me === !0 && Ee.setGlobalState(_.clippingPlanes, U), Rr(E, N, U), L.updateMultisampleRenderTarget(z), L.updateRenderTargetMipmap(z), dt.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), Hr(_, D, 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], De = _e.object, qe = _e.geometry, He = _e.material, Ne = _e.group;
- if (He.side === Ti && De.layers.test(U.layers)) {
- const it = He.side;
- He.side = Ln, He.needsUpdate = !0, lc(De, N, U, qe, He, Ne), He.side = it, He.needsUpdate = !0, ce = !0;
+ const _e = R[fe], Pe = _e.object, je = _e.geometry, Ve = _e.material, Fe = _e.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;
}
}
ce === !0 && (L.updateMultisampleRenderTarget(z), L.updateRenderTargetMipmap(z));
}
- _.setRenderTarget(X), _.setClearColor($, D), he !== void 0 && (U.viewport = he), _.toneMapping = ie;
+ E.setRenderTarget(X), E.setClearColor($, N), he !== void 0 && (U.viewport = he), E.toneMapping = ie;
}
- function Rr(E, R, N) {
+ function Hr(_, R, D) {
const U = R.isScene === !0 ? R.overrideMaterial : null;
- for (let P = 0, z = E.length; P < z; P++) {
- const j = E[P], X = j.object, ie = j.geometry, he = j.group;
+ for (let P = 0, z = _.length; P < z; P++) {
+ const j = _[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) && lc(X, R, N, ie, ce, he);
+ ce.allowOverride === !0 && U !== null && (ce = U), X.layers.test(D.layers) && wc(X, R, D, ie, ce, he);
}
}
- function lc(E, R, N, U, P, z) {
- E.onBeforeRender(_, R, N, U, P, z), E.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse, E.matrixWorld), E.normalMatrix.getNormalMatrix(E.modelViewMatrix), P.onBeforeRender(_, R, N, U, E, z), P.transparent === !0 && P.side === Ti && P.forceSinglePass === !1 ? (P.side = Ln, P.needsUpdate = !0, _.renderBufferDirect(N, R, U, P, E, z), P.side = us, P.needsUpdate = !0, _.renderBufferDirect(N, R, U, P, E, z), P.side = Ti) : _.renderBufferDirect(N, R, U, P, E, z), E.onAfterRender(_, R, N, U, P, z);
+ 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 Nr(E, R, N) {
- R.isScene !== !0 && (R = vt);
- const U = Ge.get(E), P = p.state.lights, z = p.state.shadowsArray, j = P.state.version, X = Ue.getParameters(E, P.state, z, R, N), ie = Ue.getProgramCacheKey(X);
+ 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);
let he = U.programs;
- U.environment = E.isMeshStandardMaterial ? R.environment : null, U.fog = R.fog, U.envMap = (E.isMeshStandardMaterial ? Z : I).get(E.envMap || U.environment), U.envMapRotation = U.environment !== null && E.envMap === null ? R.environmentRotation : E.envMapRotation, he === void 0 && (E.addEventListener("dispose", nt), he = /* @__PURE__ */ new Map(), U.programs = he);
+ 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);
let ce = he.get(ie);
if (ce !== void 0) {
if (U.currentProgram === ce && U.lightsStateVersion === j)
- return qa(E, X), ce;
+ return to(_, X), ce;
} else
- X.uniforms = Ue.getUniforms(E), E.onBeforeCompile(X, _), ce = Ue.acquireProgram(X, ie), he.set(ie, ce), U.uniforms = X.uniforms;
+ X.uniforms = Qe.getUniforms(_), _.onBeforeCompile(X, E), ce = Qe.acquireProgram(X, ie), he.set(ie, ce), U.uniforms = X.uniforms;
const fe = U.uniforms;
- return (!E.isShaderMaterial && !E.isRawShaderMaterial || E.clipping === !0) && (fe.clippingPlanes = Ee.uniform), qa(E, X), U.needsLights = gs(E), 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 Wa(E) {
- if (E.uniformsList === null) {
- const R = E.currentProgram.getUniforms();
- E.uniformsList = ll.seqWithValue(R.seq, E.uniforms);
- }
- return E.uniformsList;
- }
- function qa(E, R) {
- const N = Ge.get(E);
- 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 hh(E, R, N, U, P) {
- R.isScene !== !0 && (R = vt), L.resetTextureUnits();
- const z = R.fog, j = U.isMeshStandardMaterial ? R.environment : null, X = T === null ? _.outputColorSpace : T.isXRRenderTarget === !0 ? T.texture.colorSpace : ln, ie = (U.isMeshStandardMaterial ? Z : I).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, _e = !!N.morphAttributes.color;
- let De = Ls;
- U.toneMapped && (T === null || T.isXRRenderTarget === !0) && (De = _.toneMapping);
- const qe = N.morphAttributes.position || N.morphAttributes.normal || N.morphAttributes.color, He = qe !== void 0 ? qe.length : 0, Ne = Ge.get(U), it = p.state.lights;
- if (me === !0 && (be === !0 || E !== v)) {
- const Nt = E === v && U.id === C;
- Ee.setState(U, E, Nt);
- }
- let Le = !1;
- U.version === Ne.__version ? (Ne.needsLights && Ne.lightsStateVersion !== it.state.version || Ne.outputColorSpace !== X || P.isBatchedMesh && Ne.batching === !1 || !P.isBatchedMesh && Ne.batching === !0 || P.isBatchedMesh && Ne.batchingColor === !0 && P.colorTexture === null || P.isBatchedMesh && Ne.batchingColor === !1 && P.colorTexture !== null || P.isInstancedMesh && Ne.instancing === !1 || !P.isInstancedMesh && Ne.instancing === !0 || P.isSkinnedMesh && Ne.skinning === !1 || !P.isSkinnedMesh && Ne.skinning === !0 || P.isInstancedMesh && Ne.instancingColor === !0 && P.instanceColor === null || P.isInstancedMesh && Ne.instancingColor === !1 && P.instanceColor !== null || P.isInstancedMesh && Ne.instancingMorph === !0 && P.morphTexture === null || P.isInstancedMesh && Ne.instancingMorph === !1 && P.morphTexture !== null || Ne.envMap !== ie || U.fog === !0 && Ne.fog !== z || Ne.numClippingPlanes !== void 0 && (Ne.numClippingPlanes !== Ee.numPlanes || Ne.numIntersection !== Ee.numIntersection) || Ne.vertexAlphas !== he || Ne.vertexTangents !== ce || Ne.morphTargets !== fe || Ne.morphNormals !== Ae || Ne.morphColors !== _e || Ne.toneMapping !== De || Ne.morphTargetsCount !== He) && (Le = !0) : (Le = !0, Ne.__version = U.version);
- let yt = Ne.currentProgram;
- Le === !0 && (yt = Nr(U, R, P));
- let en = !1, xt = !1, At = !1;
- const Ke = yt.getUniforms(), zt = Ne.uniforms;
- if (ze.useProgram(yt.program) && (en = !0, xt = !0, At = !0), U.id !== C && (C = U.id, xt = !0), en || v !== E) {
- ze.buffers.depth.getReversed() ? (xe.copy(E.projectionMatrix), h_(xe), u_(xe), Ke.setValue(G, "projectionMatrix", xe)) : Ke.setValue(G, "projectionMatrix", E.projectionMatrix), Ke.setValue(G, "viewMatrix", E.matrixWorldInverse);
- const tn = Ke.map.cameraPosition;
- tn !== void 0 && tn.setValue(G, $e.setFromMatrixPosition(E.matrixWorld)), pt.logarithmicDepthBuffer && Ke.setValue(
- G,
+ 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;
+ }
+ function eo(_) {
+ if (_.uniformsList === null) {
+ const R = _.currentProgram.getUniforms();
+ _.uniformsList = Sl.seqWithValue(R.seq, _.uniforms);
+ }
+ return _.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 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;
+ 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);
+ }
+ 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));
+ 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 cn = Xe.map.cameraPosition;
+ cn !== void 0 && cn.setValue(H, et.setFromMatrixPosition(_.matrixWorld)), gt.logarithmicDepthBuffer && Xe.setValue(
+ H,
"logDepthBufFC",
- 2 / (Math.log(E.far + 1) / Math.LN2)
- ), (U.isMeshPhongMaterial || U.isMeshToonMaterial || U.isMeshLambertMaterial || U.isMeshBasicMaterial || U.isMeshStandardMaterial || U.isShaderMaterial) && Ke.setValue(G, "isOrthographic", E.isOrthographicCamera === !0), v !== E && (v = E, xt = !0, At = !0);
+ 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);
}
if (P.isSkinnedMesh) {
- Ke.setOptional(G, P, "bindMatrix"), Ke.setOptional(G, P, "bindMatrixInverse");
- const Nt = P.skeleton;
- Nt && (Nt.boneTexture === null && Nt.computeBoneTexture(), Ke.setValue(G, "boneTexture", Nt.boneTexture, L));
- }
- P.isBatchedMesh && (Ke.setOptional(G, P, "batchingTexture"), Ke.setValue(G, "batchingTexture", P._matricesTexture, L), Ke.setOptional(G, P, "batchingIdTexture"), Ke.setValue(G, "batchingIdTexture", P._indirectTexture, L), Ke.setOptional(G, P, "batchingColorTexture"), P._colorsTexture !== null && Ke.setValue(G, "batchingColorTexture", P._colorsTexture, L));
- const pn = N.morphAttributes;
- if ((pn.position !== void 0 || pn.normal !== void 0 || pn.color !== void 0) && Oe.update(P, N, yt), (xt || Ne.receiveShadow !== P.receiveShadow) && (Ne.receiveShadow = P.receiveShadow, Ke.setValue(G, "receiveShadow", P.receiveShadow)), U.isMeshGouraudMaterial && U.envMap !== null && (zt.envMap.value = ie, zt.flipEnvMap.value = ie.isCubeTexture && ie.isRenderTargetTexture === !1 ? -1 : 1), U.isMeshStandardMaterial && U.envMap === null && R.environment !== null && (zt.envMapIntensity.value = R.environmentIntensity), xt && (Ke.setValue(G, "toneMappingExposure", _.toneMappingExposure), Ne.needsLights && Qi(zt, At), z && U.fog === !0 && ve.refreshFogUniforms(zt, z), ve.refreshMaterialUniforms(zt, U, Q, Y, p.state.transmissionRenderTarget[E.id]), ll.upload(G, Wa(Ne), zt, L)), U.isShaderMaterial && U.uniformsNeedUpdate === !0 && (ll.upload(G, Wa(Ne), zt, L), U.uniformsNeedUpdate = !1), U.isSpriteMaterial && Ke.setValue(G, "center", P.center), Ke.setValue(G, "modelViewMatrix", P.modelViewMatrix), Ke.setValue(G, "normalMatrix", P.normalMatrix), Ke.setValue(G, "modelMatrix", P.matrixWorld), U.isShaderMaterial || U.isRawShaderMaterial) {
- const Nt = U.uniformsGroups;
- for (let tn = 0, uh = Nt.length; tn < uh; tn++) {
- const qs = Nt[tn];
- W.update(qs, yt), W.bind(qs, yt);
+ Xe.setOptional(H, P, "bindMatrix"), Xe.setOptional(H, P, "bindMatrixInverse");
+ const Lt = P.skeleton;
+ 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 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);
}
}
- return yt;
+ return St;
}
- function Qi(E, R) {
- E.ambientLightColor.needsUpdate = R, E.lightProbe.needsUpdate = R, E.directionalLights.needsUpdate = R, E.directionalLightShadows.needsUpdate = R, E.pointLights.needsUpdate = R, E.pointLightShadows.needsUpdate = R, E.spotLights.needsUpdate = R, E.spotLightShadows.needsUpdate = R, E.rectAreaLights.needsUpdate = R, E.hemisphereLights.needsUpdate = R;
+ 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 gs(E) {
- return E.isMeshLambertMaterial || E.isMeshToonMaterial || E.isMeshPhongMaterial || E.isMeshStandardMaterial || E.isShadowMaterial || E.isShaderMaterial && E.lights === !0;
+ function ws(_) {
+ return _.isMeshLambertMaterial || _.isMeshToonMaterial || _.isMeshPhongMaterial || _.isMeshStandardMaterial || _.isShadowMaterial || _.isShaderMaterial && _.lights === !0;
}
this.getActiveCubeFace = function() {
return w;
@@ -23375,139 +23991,139 @@ class EA {
return S;
}, this.getRenderTarget = function() {
return T;
- }, this.setRenderTargetTextures = function(E, R, N) {
- const U = Ge.get(E);
- U.__autoAllocateDepthBuffer = E.resolveDepthBuffer === !1, U.__autoAllocateDepthBuffer === !1 && (U.__useRenderToTexture = !1), Ge.get(E.texture).__webglTexture = R, Ge.get(E.depthTexture).__webglTexture = U.__autoAllocateDepthBuffer ? void 0 : N, U.__hasExternalTextures = !0;
- }, this.setRenderTargetFramebuffer = function(E, R) {
- const N = Ge.get(E);
- N.__webglFramebuffer = R, N.__useDefaultFramebuffer = R === void 0;
+ }, 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;
};
- const x = G.createFramebuffer();
- this.setRenderTarget = function(E, R = 0, N = 0) {
- T = E, w = R, S = N;
+ const b = H.createFramebuffer();
+ this.setRenderTarget = function(_, R = 0, D = 0) {
+ T = _, w = R, S = D;
let U = !0, P = null, z = !1, j = !1;
- if (E) {
- const ie = Ge.get(E);
+ if (_) {
+ const ie = ze.get(_);
if (ie.__useDefaultFramebuffer !== void 0)
- ze.bindFramebuffer(G.FRAMEBUFFER, null), U = !1;
+ We.bindFramebuffer(H.FRAMEBUFFER, null), U = !1;
else if (ie.__webglFramebuffer === void 0)
- L.setupRenderTarget(E);
+ L.setupRenderTarget(_);
else if (ie.__hasExternalTextures)
- L.rebindTextures(E, Ge.get(E.texture).__webglTexture, Ge.get(E.depthTexture).__webglTexture);
- else if (E.depthBuffer) {
- const fe = E.depthTexture;
+ L.rebindTextures(_, ze.get(_.texture).__webglTexture, ze.get(_.depthTexture).__webglTexture);
+ else if (_.depthBuffer) {
+ const fe = _.depthTexture;
if (ie.__boundDepthTexture !== fe) {
- if (fe !== null && Ge.has(fe) && (E.width !== fe.image.width || E.height !== fe.image.height))
+ if (fe !== null && ze.has(fe) && (_.width !== fe.image.width || _.height !== fe.image.height))
throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");
- L.setupDepthRenderbuffer(E);
+ L.setupDepthRenderbuffer(_);
}
}
- const he = E.texture;
+ const he = _.texture;
(he.isData3DTexture || he.isDataArrayTexture || he.isCompressedArrayTexture) && (j = !0);
- const ce = Ge.get(E).__webglFramebuffer;
- E.isWebGLCubeRenderTarget ? (Array.isArray(ce[R]) ? P = ce[R][N] : P = ce[R], z = !0) : E.samples > 0 && L.useMultisampledRTT(E) === !1 ? P = Ge.get(E).__webglMultisampledFramebuffer : Array.isArray(ce) ? P = ce[N] : P = ce, F.copy(E.viewport), K.copy(E.scissor), q = E.scissorTest;
+ 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;
} else
F.copy(ae).multiplyScalar(Q).floor(), K.copy(ye).multiplyScalar(Q).floor(), q = Me;
- if (N !== 0 && (P = x), ze.bindFramebuffer(G.FRAMEBUFFER, P) && U && ze.drawBuffers(E, P), ze.viewport(F), ze.scissor(K), ze.setScissorTest(q), z) {
- const ie = Ge.get(E.texture);
- G.framebufferTexture2D(G.FRAMEBUFFER, G.COLOR_ATTACHMENT0, G.TEXTURE_CUBE_MAP_POSITIVE_X + R, ie.__webglTexture, N);
+ 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);
} else if (j) {
- const ie = Ge.get(E.texture), he = R;
- G.framebufferTextureLayer(G.FRAMEBUFFER, G.COLOR_ATTACHMENT0, ie.__webglTexture, N, he);
- } else if (E !== null && N !== 0) {
- const ie = Ge.get(E.texture);
- G.framebufferTexture2D(G.FRAMEBUFFER, G.COLOR_ATTACHMENT0, G.TEXTURE_2D, ie.__webglTexture, N);
+ 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);
}
C = -1;
- }, this.readRenderTargetPixels = function(E, R, N, U, P, z, j) {
- if (!(E && E.isWebGLRenderTarget)) {
+ }, this.readRenderTargetPixels = function(_, R, D, U, P, z, j) {
+ if (!(_ && _.isWebGLRenderTarget)) {
console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
return;
}
- let X = Ge.get(E).__webglFramebuffer;
- if (E.isWebGLCubeRenderTarget && j !== void 0 && (X = X[j]), X) {
- ze.bindFramebuffer(G.FRAMEBUFFER, X);
+ let X = ze.get(_).__webglFramebuffer;
+ if (_.isWebGLCubeRenderTarget && j !== void 0 && (X = X[j]), X) {
+ We.bindFramebuffer(H.FRAMEBUFFER, X);
try {
- const ie = E.texture, he = ie.format, ce = ie.type;
- if (!pt.textureFormatReadable(he)) {
+ const ie = _.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;
}
- if (!pt.textureTypeReadable(ce)) {
+ if (!gt.textureTypeReadable(ce)) {
console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");
return;
}
- R >= 0 && R <= E.width - U && N >= 0 && N <= E.height - P && G.readPixels(R, N, U, P, We.convert(he), We.convert(ce), z);
+ R >= 0 && R <= _.width - U && D >= 0 && D <= _.height - P && H.readPixels(R, D, U, P, Ke.convert(he), Ke.convert(ce), z);
} finally {
- const ie = T !== null ? Ge.get(T).__webglFramebuffer : null;
- ze.bindFramebuffer(G.FRAMEBUFFER, ie);
+ const ie = T !== null ? ze.get(T).__webglFramebuffer : null;
+ We.bindFramebuffer(H.FRAMEBUFFER, ie);
}
}
- }, this.readRenderTargetPixelsAsync = async function(E, R, N, U, P, z, j) {
- if (!(E && E.isWebGLRenderTarget))
+ }, this.readRenderTargetPixelsAsync = async function(_, R, D, U, P, z, j) {
+ if (!(_ && _.isWebGLRenderTarget))
throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
- let X = Ge.get(E).__webglFramebuffer;
- if (E.isWebGLCubeRenderTarget && j !== void 0 && (X = X[j]), X)
- if (R >= 0 && R <= E.width - U && N >= 0 && N <= E.height - P) {
- ze.bindFramebuffer(G.FRAMEBUFFER, X);
- const ie = E.texture, he = ie.format, ce = ie.type;
- if (!pt.textureFormatReadable(he))
+ 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) {
+ We.bindFramebuffer(H.FRAMEBUFFER, X);
+ const ie = _.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 (!pt.textureTypeReadable(ce))
+ if (!gt.textureTypeReadable(ce))
throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");
- const fe = G.createBuffer();
- G.bindBuffer(G.PIXEL_PACK_BUFFER, fe), G.bufferData(G.PIXEL_PACK_BUFFER, z.byteLength, G.STREAM_READ), G.readPixels(R, N, U, P, We.convert(he), We.convert(ce), 0);
- const Ae = T !== null ? Ge.get(T).__webglFramebuffer : null;
- ze.bindFramebuffer(G.FRAMEBUFFER, Ae);
- const _e = G.fenceSync(G.SYNC_GPU_COMMANDS_COMPLETE, 0);
- return G.flush(), await l_(G, _e, 4), G.bindBuffer(G.PIXEL_PACK_BUFFER, fe), G.getBufferSubData(G.PIXEL_PACK_BUFFER, 0, z), G.deleteBuffer(fe), G.deleteSync(_e), z;
+ 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 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;
} else
throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");
- }, this.copyFramebufferToTexture = function(E, R = null, N = 0) {
- const U = Math.pow(2, -N), P = Math.floor(E.image.width * U), z = Math.floor(E.image.height * U), j = R !== null ? R.x : 0, X = R !== null ? R.y : 0;
- L.setTexture2D(E, 0), G.copyTexSubImage2D(G.TEXTURE_2D, N, 0, 0, j, X, P, z), ze.unbindTexture();
+ }, 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();
};
- const B = G.createFramebuffer(), k = G.createFramebuffer();
- this.copyTextureToTexture = function(E, R, N = 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, De;
- const qe = E.isCompressedTexture ? E.mipmaps[z] : E.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;
+ 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;
else {
- const pn = Math.pow(2, -P);
- j = Math.floor(qe.width * pn), X = Math.floor(qe.height * pn), E.isDataArrayTexture ? ie = qe.depth : E.isData3DTexture ? ie = Math.floor(qe.depth * pn) : ie = 1, he = 0, ce = 0, fe = 0;
- }
- U !== null ? (Ae = U.x, _e = U.y, De = U.z) : (Ae = 0, _e = 0, De = 0);
- const He = We.convert(R.format), Ne = We.convert(R.type);
- let it;
- R.isData3DTexture ? (L.setTexture3D(R, 0), it = G.TEXTURE_3D) : R.isDataArrayTexture || R.isCompressedArrayTexture ? (L.setTexture2DArray(R, 0), it = G.TEXTURE_2D_ARRAY) : (L.setTexture2D(R, 0), it = G.TEXTURE_2D), G.pixelStorei(G.UNPACK_FLIP_Y_WEBGL, R.flipY), G.pixelStorei(G.UNPACK_PREMULTIPLY_ALPHA_WEBGL, R.premultiplyAlpha), G.pixelStorei(G.UNPACK_ALIGNMENT, R.unpackAlignment);
- const Le = G.getParameter(G.UNPACK_ROW_LENGTH), yt = G.getParameter(G.UNPACK_IMAGE_HEIGHT), en = G.getParameter(G.UNPACK_SKIP_PIXELS), xt = G.getParameter(G.UNPACK_SKIP_ROWS), At = G.getParameter(G.UNPACK_SKIP_IMAGES);
- G.pixelStorei(G.UNPACK_ROW_LENGTH, qe.width), G.pixelStorei(G.UNPACK_IMAGE_HEIGHT, qe.height), G.pixelStorei(G.UNPACK_SKIP_PIXELS, he), G.pixelStorei(G.UNPACK_SKIP_ROWS, ce), G.pixelStorei(G.UNPACK_SKIP_IMAGES, fe);
- const Ke = E.isDataArrayTexture || E.isData3DTexture, zt = R.isDataArrayTexture || R.isData3DTexture;
- if (E.isDepthTexture) {
- const pn = Ge.get(E), Nt = Ge.get(R), tn = Ge.get(pn.__renderTarget), uh = Ge.get(Nt.__renderTarget);
- ze.bindFramebuffer(G.READ_FRAMEBUFFER, tn.__webglFramebuffer), ze.bindFramebuffer(G.DRAW_FRAMEBUFFER, uh.__webglFramebuffer);
- for (let qs = 0; qs < ie; qs++)
- Ke && (G.framebufferTextureLayer(G.READ_FRAMEBUFFER, G.COLOR_ATTACHMENT0, Ge.get(E).__webglTexture, P, fe + qs), G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER, G.COLOR_ATTACHMENT0, Ge.get(R).__webglTexture, z, De + qs)), G.blitFramebuffer(he, ce, j, X, Ae, _e, j, X, G.DEPTH_BUFFER_BIT, G.NEAREST);
- ze.bindFramebuffer(G.READ_FRAMEBUFFER, null), ze.bindFramebuffer(G.DRAW_FRAMEBUFFER, null);
- } else if (P !== 0 || E.isRenderTargetTexture || Ge.has(E)) {
- const pn = Ge.get(E), Nt = Ge.get(R);
- ze.bindFramebuffer(G.READ_FRAMEBUFFER, B), ze.bindFramebuffer(G.DRAW_FRAMEBUFFER, k);
- for (let tn = 0; tn < ie; tn++)
- Ke ? G.framebufferTextureLayer(G.READ_FRAMEBUFFER, G.COLOR_ATTACHMENT0, pn.__webglTexture, P, fe + tn) : G.framebufferTexture2D(G.READ_FRAMEBUFFER, G.COLOR_ATTACHMENT0, G.TEXTURE_2D, pn.__webglTexture, P), zt ? G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER, G.COLOR_ATTACHMENT0, Nt.__webglTexture, z, De + tn) : G.framebufferTexture2D(G.DRAW_FRAMEBUFFER, G.COLOR_ATTACHMENT0, G.TEXTURE_2D, Nt.__webglTexture, z), P !== 0 ? G.blitFramebuffer(he, ce, j, X, Ae, _e, j, X, G.COLOR_BUFFER_BIT, G.NEAREST) : zt ? G.copyTexSubImage3D(it, z, Ae, _e, De + tn, he, ce, j, X) : G.copyTexSubImage2D(it, z, Ae, _e, he, ce, j, X);
- ze.bindFramebuffer(G.READ_FRAMEBUFFER, null), ze.bindFramebuffer(G.DRAW_FRAMEBUFFER, null);
+ 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;
+ }
+ U !== null ? (Ae = U.x, _e = U.y, Pe = U.z) : (Ae = 0, _e = 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);
+ 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);
+ 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);
+ 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);
+ We.bindFramebuffer(H.READ_FRAMEBUFFER, null), We.bindFramebuffer(H.DRAW_FRAMEBUFFER, null);
} else
- zt ? E.isDataTexture || E.isData3DTexture ? G.texSubImage3D(it, z, Ae, _e, De, j, X, ie, He, Ne, qe.data) : R.isCompressedArrayTexture ? G.compressedTexSubImage3D(it, z, Ae, _e, De, j, X, ie, He, qe.data) : G.texSubImage3D(it, z, Ae, _e, De, j, X, ie, He, Ne, qe) : E.isDataTexture ? G.texSubImage2D(G.TEXTURE_2D, z, Ae, _e, j, X, He, Ne, qe.data) : E.isCompressedTexture ? G.compressedTexSubImage2D(G.TEXTURE_2D, z, Ae, _e, qe.width, qe.height, He, qe.data) : G.texSubImage2D(G.TEXTURE_2D, z, Ae, _e, j, X, He, Ne, qe);
- G.pixelStorei(G.UNPACK_ROW_LENGTH, Le), G.pixelStorei(G.UNPACK_IMAGE_HEIGHT, yt), G.pixelStorei(G.UNPACK_SKIP_PIXELS, en), G.pixelStorei(G.UNPACK_SKIP_ROWS, xt), G.pixelStorei(G.UNPACK_SKIP_IMAGES, At), z === 0 && R.generateMipmaps && G.generateMipmap(it), ze.unbindTexture();
- }, this.copyTextureToTexture3D = function(E, R, N = null, U = null, P = 0) {
- return cl('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'), this.copyTextureToTexture(E, R, N, U, P);
- }, this.initRenderTarget = function(E) {
- Ge.get(E).__webglFramebuffer === void 0 && L.setupRenderTarget(E);
- }, this.initTexture = function(E) {
- E.isCubeTexture ? L.setTextureCube(E, 0) : E.isData3DTexture ? L.setTexture3D(E, 0) : E.isDataArrayTexture || E.isCompressedArrayTexture ? L.setTexture2DArray(E, 0) : L.setTexture2D(E, 0), ze.unbindTexture();
+ 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();
}, this.resetState = function() {
- w = 0, S = 0, T = null, ze.reset(), tt.reset();
+ w = 0, S = 0, T = null, We.reset(), nt.reset();
}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
}
/**
@@ -23520,7 +24136,7 @@ class EA {
* @readonly
*/
get coordinateSystem() {
- return is;
+ return ls;
}
/**
* Defines the output color space of the renderer.
@@ -23534,10 +24150,10 @@ class EA {
set outputColorSpace(e) {
this._outputColorSpace = e;
const t = this.getContext();
- t.drawingBufferColorSpace = mt._getDrawingBufferColorSpace(e), t.unpackColorSpace = mt._getUnpackColorSpace();
+ t.drawingBufferColorSpace = rt._getDrawingBufferColorSpace(e), t.unpackColorSpace = rt._getUnpackColorSpace();
}
}
-var _o = function() {
+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);
@@ -23550,9 +24166,9 @@ var _o = function() {
e.children[u].style.display = u === h ? "block" : "none";
i = h;
}
- var s = (performance || Date).now(), r = s, a = 0, o = t(new _o.Panel("FPS", "#0ff", "#002")), c = t(new _o.Panel("MS", "#0f0", "#020"));
+ 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 _o.Panel("MB", "#f08", "#201"));
+ var l = t(new Fo.Panel("MB", "#f08", "#201"));
return n(0), {
REVISION: 16,
dom: e,
@@ -23578,21 +24194,21 @@ var _o = function() {
setMode: n
};
};
-_o.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, m = 30 * a, g = document.createElement("canvas");
- g.width = o, g.height = c, g.style.cssText = "width:80px;height:48px";
- var A = g.getContext("2d");
- return A.font = "bold " + 9 * a + "px Helvetica,Arial,sans-serif", A.textBaseline = "top", A.fillStyle = t, A.fillRect(0, 0, o, c), A.fillStyle = e, A.fillText(i, l, h), A.fillRect(u, d, f, m), A.fillStyle = t, A.globalAlpha = 0.9, A.fillRect(u, d, f, m), {
- dom: g,
- update: function(p, y) {
- n = Math.min(n, p), s = Math.max(s, p), A.fillStyle = t, A.globalAlpha = 1, A.fillRect(0, 0, o, d), A.fillStyle = e, A.fillText(r(p) + " " + i + " (" + r(n) + "-" + r(s) + ")", l, h), A.drawImage(g, u + a, d, f - a, m, u, d, f - a, m), A.fillRect(u + f - a, d, a, m), A.fillStyle = t, A.globalAlpha = 0.9, A.fillRect(u + f - a, d, a, r((1 - p / y) * m));
+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 = 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));
}
};
};
-function _A(i, e) {
- if (e === LE)
+function ZA(i, e) {
+ if (e === b_)
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), i;
- if (e === ld || e === Gm) {
+ if (e === Ld || e === b0) {
let t = i.getIndex();
if (t === null) {
const a = [], o = i.getAttribute("position");
@@ -23604,7 +24220,7 @@ function _A(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 === Ld)
for (let a = 1; a <= n; a++)
s.push(t.getX(0)), s.push(t.getX(a)), s.push(t.getX(a + 1));
else
@@ -23616,7 +24232,7 @@ function _A(i, e) {
} else
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), i;
}
-class vf extends ps {
+class Zf extends fi {
/**
* Constructs a new glTF loader.
*
@@ -23624,39 +24240,39 @@ class vf extends ps {
*/
constructor(e) {
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
- return new bI(t);
+ return new x1(t);
}), this.register(function(t) {
- return new xI(t);
+ return new b1(t);
}), this.register(function(t) {
- return new MI(t);
+ return new M1(t);
}), this.register(function(t) {
- return new BI(t);
+ return new B1(t);
}), this.register(function(t) {
- return new TI(t);
+ return new T1(t);
}), this.register(function(t) {
- return new _I(t);
+ return new _1(t);
}), this.register(function(t) {
- return new yI(t);
+ return new y1(t);
}), this.register(function(t) {
- return new wI(t);
+ return new w1(t);
}), this.register(function(t) {
- return new vI(t);
+ return new v1(t);
}), this.register(function(t) {
- return new mI(t);
+ return new m1(t);
}), this.register(function(t) {
- return new CI(t);
+ return new C1(t);
}), this.register(function(t) {
- return new EI(t);
+ return new E1(t);
}), this.register(function(t) {
- return new II(t);
+ return new I1(t);
}), this.register(function(t) {
- return new SI(t);
+ return new S1(t);
}), this.register(function(t) {
- return new AI(t);
+ return new A1(t);
}), this.register(function(t) {
- return new RI(t);
+ return new R1(t);
}), this.register(function(t) {
- return new NI(t);
+ return new F1(t);
});
}
/**
@@ -23674,14 +24290,14 @@ class vf extends ps {
if (this.resourcePath !== "")
a = this.resourcePath;
else if (this.path !== "") {
- const l = da.extractUrlBase(e);
- a = da.resolveURL(l, this.path);
+ const l = wr.extractUrlBase(e);
+ a = wr.resolveURL(l, this.path);
} else
- a = da.extractUrlBase(e);
+ a = wr.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 Ps(this.manager);
+ }, 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) {
@@ -23756,14 +24372,14 @@ class vf extends ps {
if (typeof e == "string")
r = JSON.parse(e);
else if (e instanceof ArrayBuffer)
- if (c.decode(new Uint8Array(e, 0, 4)) === m0) {
+ if (c.decode(new Uint8Array(e, 0, 4)) === J0) {
try {
- a[ft.KHR_BINARY_GLTF] = new FI(e);
+ a[At.KHR_BINARY_GLTF] = new D1(e);
} catch (u) {
s && s(u);
return;
}
- r = JSON.parse(a[ft.KHR_BINARY_GLTF].content);
+ r = JSON.parse(a[At.KHR_BINARY_GLTF].content);
} else
r = JSON.parse(c.decode(e));
else
@@ -23772,7 +24388,7 @@ class vf extends ps {
s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
return;
}
- const l = new qI(r, {
+ const l = new q1(r, {
path: t || this.resourcePath || "",
crossOrigin: this.crossOrigin,
requestHeader: this.requestHeader,
@@ -23789,17 +24405,17 @@ class vf extends ps {
for (let h = 0; h < r.extensionsUsed.length; ++h) {
const u = r.extensionsUsed[h], d = r.extensionsRequired || [];
switch (u) {
- case ft.KHR_MATERIALS_UNLIT:
- a[u] = new gI();
+ case At.KHR_MATERIALS_UNLIT:
+ a[u] = new g1();
break;
- case ft.KHR_DRACO_MESH_COMPRESSION:
- a[u] = new DI(r, this.dracoLoader);
+ case At.KHR_DRACO_MESH_COMPRESSION:
+ a[u] = new N1(r, this.dracoLoader);
break;
- case ft.KHR_TEXTURE_TRANSFORM:
- a[u] = new LI();
+ case At.KHR_TEXTURE_TRANSFORM:
+ a[u] = new L1();
break;
- case ft.KHR_MESH_QUANTIZATION:
- a[u] = new PI();
+ case At.KHR_MESH_QUANTIZATION:
+ a[u] = new P1();
break;
default:
d.indexOf(u) >= 0 && o[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
@@ -23822,7 +24438,7 @@ class vf extends ps {
});
}
}
-function pI() {
+function p1() {
let i = {};
return {
get: function(e) {
@@ -23839,7 +24455,7 @@ function pI() {
}
};
}
-const ft = {
+const At = {
KHR_BINARY_GLTF: "KHR_binary_glTF",
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
@@ -23863,9 +24479,9 @@ const ft = {
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
};
-class AI {
+class A1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
+ this.parser = e, this.name = At.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
}
_markDefs() {
const e = this.parser, t = this.parser.json.nodes || [];
@@ -23880,23 +24496,23 @@ class AI {
if (s) return s;
const r = t.json, c = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
let l;
- const h = new je(16777215);
- c.color !== void 0 && h.setRGB(c.color[0], c.color[1], c.color[2], ln);
+ const h = new Le(16777215);
+ c.color !== void 0 && h.setRGB(c.color[0], c.color[1], c.color[2], An);
const u = c.range !== void 0 ? c.range : 0;
switch (c.type) {
case "directional":
- l = new l0(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 c0(h), l.distance = u;
+ l = new Kl(h), l.distance = u;
break;
case "spot":
- l = new uy(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 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);
break;
default:
throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
}
- return l.position.set(0, 0, 0), Xi(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
+ return l.position.set(0, 0, 0), ts(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
}
getDependency(e, t) {
if (e === "light")
@@ -23909,30 +24525,30 @@ class AI {
});
}
}
-class gI {
+class g1 {
constructor() {
- this.name = ft.KHR_MATERIALS_UNLIT;
+ this.name = At.KHR_MATERIALS_UNLIT;
}
getMaterialType() {
- return Ns;
+ return Os;
}
extendParams(e, t, n) {
const s = [];
- e.color = new je(1, 1, 1), e.opacity = 1;
+ e.color = new Le(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], ln), e.opacity = a[3];
+ 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, Kt));
+ r.baseColorTexture !== void 0 && s.push(n.assignTexture(e, "map", r.baseColorTexture, yt));
}
return Promise.all(s);
}
}
-class mI {
+class m1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_EMISSIVE_STRENGTH;
+ this.parser = e, this.name = At.KHR_MATERIALS_EMISSIVE_STRENGTH;
}
extendMaterialParams(e, t) {
const s = this.parser.json.materials[e];
@@ -23942,13 +24558,13 @@ class mI {
return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
}
}
-class bI {
+class x1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_CLEARCOAT;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -23962,13 +24578,13 @@ class bI {
return Promise.all(r);
}
}
-class xI {
+class b1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_DISPERSION;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const s = this.parser.json.materials[e];
@@ -23978,13 +24594,13 @@ class xI {
return t.dispersion = r.dispersion !== void 0 ? r.dispersion : 0, Promise.resolve();
}
}
-class EI {
+class E1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_IRIDESCENCE;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -23994,35 +24610,35 @@ class EI {
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 _I {
+class _1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_SHEEN;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
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 je(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
+ t.sheenColor = new Le(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], ln);
+ 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, Kt)), 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, yt)), a.sheenRoughnessTexture !== void 0 && r.push(n.assignTexture(t, "sheenRoughnessMap", a.sheenRoughnessTexture)), Promise.all(r);
}
}
-class yI {
+class y1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_TRANSMISSION;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24032,13 +24648,13 @@ class yI {
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 wI {
+class w1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_VOLUME;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24047,16 +24663,16 @@ class wI {
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 je().setRGB(o[0], o[1], o[2], ln), Promise.all(r);
+ return t.attenuationColor = new Le().setRGB(o[0], o[1], o[2], An), Promise.all(r);
}
}
-class vI {
+class v1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_IOR;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const s = this.parser.json.materials[e];
@@ -24066,13 +24682,13 @@ class vI {
return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
}
}
-class CI {
+class C1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_SPECULAR;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24081,16 +24697,16 @@ class CI {
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 je().setRGB(o[0], o[1], o[2], ln), a.specularColorTexture !== void 0 && r.push(n.assignTexture(t, "specularColorMap", a.specularColorTexture, Kt)), 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, yt)), Promise.all(r);
}
}
-class SI {
+class S1 {
constructor(e) {
- this.parser = e, this.name = ft.EXT_MATERIALS_BUMP;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24100,13 +24716,13 @@ class SI {
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 II {
+class I1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_MATERIALS_ANISOTROPY;
+ 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;
+ return !n.extensions || !n.extensions[this.name] ? null : Vi;
}
extendMaterialParams(e, t) {
const n = this.parser, s = n.json.materials[e];
@@ -24116,9 +24732,9 @@ class II {
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 MI {
+class M1 {
constructor(e) {
- this.parser = e, this.name = ft.KHR_TEXTURE_BASISU;
+ this.parser = e, this.name = At.KHR_TEXTURE_BASISU;
}
loadTexture(e) {
const t = this.parser, n = t.json, s = n.textures[e];
@@ -24133,9 +24749,9 @@ class MI {
return t.loadTextureImage(e, r.source, a);
}
}
-class BI {
+class B1 {
constructor(e) {
- this.parser = e, this.name = ft.EXT_TEXTURE_WEBP;
+ 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];
@@ -24150,9 +24766,9 @@ class BI {
return n.loadTextureImage(e, a.source, c);
}
}
-class TI {
+class T1 {
constructor(e) {
- this.parser = e, this.name = ft.EXT_TEXTURE_AVIF;
+ 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];
@@ -24167,9 +24783,9 @@ class TI {
return n.loadTextureImage(e, a.source, c);
}
}
-class RI {
+class R1 {
constructor(e) {
- this.name = ft.EXT_MESHOPT_COMPRESSION, this.parser = e;
+ this.name = At.EXT_MESHOPT_COMPRESSION, this.parser = e;
}
loadBufferView(e) {
const t = this.parser.json, n = t.bufferViews[e];
@@ -24193,9 +24809,9 @@ class RI {
return null;
}
}
-class NI {
+class F1 {
constructor(e) {
- this.name = ft.EXT_MESH_GPU_INSTANCING, this.parser = e;
+ this.name = At.EXT_MESH_GPU_INSTANCING, this.parser = e;
}
createNodeMesh(e) {
const t = this.parser.json, n = t.nodes[e];
@@ -24203,52 +24819,52 @@ class NI {
return null;
const s = t.meshes[n.mesh];
for (const l of s.primitives)
- if (l.mode !== Zn.TRIANGLES && l.mode !== Zn.TRIANGLE_STRIP && l.mode !== Zn.TRIANGLE_FAN && l.mode !== void 0)
+ if (l.mode !== ri.TRIANGLES && l.mode !== ri.TRIANGLE_STRIP && l.mode !== ri.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 m of u) {
- const g = new st(), A = new H(), p = new Xn(), y = new H(1, 1, 1), b = new n0(m.geometry, m.material, d);
- for (let _ = 0; _ < d; _++)
- c.TRANSLATION && A.fromBufferAttribute(c.TRANSLATION, _), c.ROTATION && p.fromBufferAttribute(c.ROTATION, _), c.SCALE && y.fromBufferAttribute(c.SCALE, _), b.setMatrixAt(_, g.compose(A, p, y));
- for (const _ in c)
- if (_ === "_COLOR_0") {
- const M = c[_];
- b.instanceColor = new dd(M.array, M.itemSize, M.normalized);
- } else _ !== "TRANSLATION" && _ !== "ROTATION" && _ !== "SCALE" && m.geometry.setAttribute(_, c[_]);
- kt.prototype.copy.call(b, m), this.parser.assignFinalMaterial(b), f.push(b);
+ 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);
+ 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));
+ for (const E in c)
+ if (E === "_COLOR_0") {
+ const I = c[E];
+ x.instanceColor = new Ud(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 m0 = "glTF", to = 12, yA = { JSON: 1313821514, BIN: 5130562 };
-class FI {
+const J0 = "glTF", ho = 12, $A = { JSON: 1313821514, BIN: 5130562 };
+class D1 {
constructor(e) {
- this.name = ft.KHR_BINARY_GLTF, this.content = null, this.body = null;
- const t = new DataView(e, 0, to), n = new TextDecoder();
+ this.name = At.KHR_BINARY_GLTF, this.content = null, this.body = null;
+ const t = new DataView(e, 0, ho), 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 !== m0)
+ }, this.header.magic !== J0)
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 - to, r = new DataView(e, to);
+ const s = this.header.length - ho, r = new DataView(e, ho);
let a = 0;
for (; a < s; ) {
const o = r.getUint32(a, !0);
a += 4;
const c = r.getUint32(a, !0);
- if (a += 4, c === yA.JSON) {
- const l = new Uint8Array(e, to + a, o);
+ if (a += 4, c === $A.JSON) {
+ const l = new Uint8Array(e, ho + a, o);
this.content = n.decode(l);
- } else if (c === yA.BIN) {
- const l = to + a;
+ } else if (c === $A.BIN) {
+ const l = ho + a;
this.body = e.slice(l, l + o);
}
a += o;
@@ -24257,52 +24873,52 @@ class FI {
throw new Error("THREE.GLTFLoader: JSON content not found.");
}
}
-class DI {
+class N1 {
constructor(e, t) {
if (!t)
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
- this.name = ft.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
+ 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();
+ const u = Vd[h] || h.toLowerCase();
o[u] = a[h];
}
for (const h in e.attributes) {
- const u = md[h] || h.toLowerCase();
+ const u = Vd[h] || h.toLowerCase();
if (a[h] !== void 0) {
- const d = n.accessors[e.attributes[h]], f = fa[d.componentType];
+ 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 m in f.attributes) {
- const g = f.attributes[m], A = c[m];
- A !== void 0 && (g.normalized = A);
+ for (const p in f.attributes) {
+ const m = f.attributes[p], g = c[p];
+ g !== void 0 && (m.normalized = g);
}
u(f);
- }, o, l, ln, d);
+ }, o, l, An, d);
});
});
}
}
-class LI {
+class L1 {
constructor() {
- this.name = ft.KHR_TEXTURE_TRANSFORM;
+ 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 PI {
+class P1 {
constructor() {
- this.name = ft.KHR_MESH_QUANTIZATION;
+ this.name = At.KHR_MESH_QUANTIZATION;
}
}
-class b0 extends Yo {
+class Z0 extends hc {
constructor(e, t, n, s) {
super(e, t, n, s);
}
@@ -24313,22 +24929,22 @@ class b0 extends Yo {
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, m = e * l, g = m - l, A = -2 * f + 3 * d, p = f - d, y = 1 - A, b = p - d + u;
- for (let _ = 0; _ !== o; _++) {
- const M = a[g + _ + o], w = a[g + _ + c] * h, S = a[m + _ + o], T = a[m + _] * h;
- r[_] = y * M + b * w + A * S + p * T;
+ 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;
+ 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;
}
return r;
}
}
-const kI = new Xn();
-class UI extends b0 {
+const k1 = new Jt();
+class U1 extends Z0 {
interpolate_(e, t, n, s) {
const r = super.interpolate_(e, t, n, s);
- return kI.fromArray(r).normalize().toArray(r), r;
+ return k1.fromArray(r).normalize().toArray(r), r;
}
}
-const Zn = {
+const ri = {
POINTS: 0,
LINES: 1,
LINE_LOOP: 2,
@@ -24336,25 +24952,25 @@ const Zn = {
TRIANGLES: 4,
TRIANGLE_STRIP: 5,
TRIANGLE_FAN: 6
-}, fa = {
+}, va = {
5120: Int8Array,
5121: Uint8Array,
5122: Int16Array,
5123: Uint16Array,
5125: Uint32Array,
5126: Float32Array
-}, wA = {
- 9728: Pn,
- 9729: qt,
- 9984: Nm,
- 9985: rl,
- 9986: lo,
- 9987: ii
-}, vA = {
- 33071: xi,
- 33648: Al,
- 10497: wa
-}, qh = {
+}, eg = {
+ 9728: Wn,
+ 9729: Xt,
+ 9984: h0,
+ 9985: yl,
+ 9986: bo,
+ 9987: hi
+}, tg = {
+ 33071: ti,
+ 33648: Dl,
+ 10497: Ws
+}, mu = {
SCALAR: 1,
VEC2: 2,
VEC3: 3,
@@ -24362,7 +24978,7 @@ const Zn = {
MAT2: 4,
MAT3: 9,
MAT4: 16
-}, md = {
+}, Vd = {
POSITION: "position",
NORMAL: "normal",
TANGENT: "tangent",
@@ -24373,41 +24989,41 @@ const Zn = {
COLOR_0: "color",
WEIGHTS_0: "skinWeight",
JOINTS_0: "skinIndex"
-}, vs = {
+}, Rs = {
scale: "scale",
translation: "position",
rotation: "quaternion",
weights: "morphTargetInfluences"
-}, OI = {
+}, O1 = {
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: Do,
- STEP: Fo
-}, Kh = {
+ LINEAR: Wo,
+ STEP: Vo
+}, xu = {
OPAQUE: "OPAQUE",
MASK: "MASK",
BLEND: "BLEND"
};
-function QI(i) {
- return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new Po({
+function Q1(i) {
+ return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new Yo({
color: 16777215,
emissive: 0,
metalness: 1,
roughness: 1,
transparent: !1,
depthTest: !0,
- side: us
+ side: bs
})), i.DefaultMaterial;
}
-function $s(i, e, t) {
+function or(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 Xi(i, e) {
+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 GI(i, e, t) {
+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];
@@ -24439,7 +25055,7 @@ function GI(i, e, t) {
return n && (i.morphAttributes.position = h), s && (i.morphAttributes.normal = u), r && (i.morphAttributes.color = d), i.morphTargetsRelative = !0, i;
});
}
-function HI(i, e) {
+function H1(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];
@@ -24453,22 +25069,22 @@ function HI(i, e) {
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
}
}
-function zI(i) {
+function z1(i) {
let e;
- const t = i.extensions && i.extensions[ft.KHR_DRACO_MESH_COMPRESSION];
- if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + jh(t.attributes) : e = i.indices + ":" + jh(i.attributes) + ":" + i.mode, i.targets !== void 0)
+ 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)
for (let n = 0, s = i.targets.length; n < s; n++)
- e += ":" + jh(i.targets[n]);
+ e += ":" + bu(i.targets[n]);
return e;
}
-function jh(i) {
+function bu(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 bd(i) {
+function Wd(i) {
switch (i) {
case Int8Array:
return 1 / 127;
@@ -24482,13 +25098,13 @@ function bd(i) {
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
}
}
-function VI(i) {
+function V1(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 WI = new st();
-class qI {
+const W1 = new De();
+class q1 {
constructor(e = {}, t = {}) {
- this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new pI(), 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 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 = {};
let n = !1, s = -1, r = !1, a = -1;
if (typeof navigator < "u") {
const o = navigator.userAgent;
@@ -24496,7 +25112,7 @@ class qI {
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 cy(this.options.manager) : this.textureLoader = new Ay(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ps(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 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);
}
setExtensions(e) {
this.extensions = e;
@@ -24526,7 +25142,7 @@ class qI {
parser: n,
userData: {}
};
- return $s(r, o, s), Xi(o, s), Promise.all(n._invokeAll(function(c) {
+ return or(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)
@@ -24704,10 +25320,10 @@ class qI {
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[ft.KHR_BINARY_GLTF].body);
+ return Promise.resolve(this.extensions[At.KHR_BINARY_GLTF].body);
const s = this.options;
return new Promise(function(r, a) {
- n.load(da.resolveURL(t.uri, s.path), r, void 0, function() {
+ n.load(wr.resolveURL(t.uri, s.path), r, void 0, function() {
a(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
});
});
@@ -24736,29 +25352,29 @@ class qI {
loadAccessor(e) {
const t = this, n = this.json, s = this.json.accessors[e];
if (s.bufferView === void 0 && s.sparse === void 0) {
- const a = qh[s.type], o = fa[s.componentType], c = s.normalized === !0, l = new o(s.count * a);
- return Promise.resolve(new _n(l, a, c));
+ const a = mu[s.type], o = va[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 = qh[s.type], l = fa[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, m = s.normalized === !0;
- let g, 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;
+ let m, g;
if (f && f !== u) {
- const p = Math.floor(d / f), y = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + p + ":" + s.count;
- let b = t.cache.get(y);
- b || (g = new l(o, p * f, s.count * f / h), b = new U_(g, f / h), t.cache.add(y, b)), A = new pf(b, c, d % f / h, m);
+ 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);
} else
- o === null ? g = new l(s.count * c) : g = new l(o, d, s.count * c), A = new _n(g, c, m);
+ o === null ? m = new l(s.count * c) : m = new l(o, d, s.count * c), g = new Bn(m, c, p);
if (s.sparse !== void 0) {
- const p = qh.SCALAR, y = fa[s.sparse.indices.componentType], b = s.sparse.indices.byteOffset || 0, _ = s.sparse.values.byteOffset || 0, M = new y(a[1], b, s.sparse.count * p), w = new l(a[2], _, s.sparse.count * c);
- o !== null && (A = new _n(A.array.slice(), A.itemSize, A.normalized)), A.normalized = !1;
- for (let S = 0, T = M.length; S < T; S++) {
- const C = M[S];
- if (A.setX(C, w[S * c]), c >= 2 && A.setY(C, w[S * c + 1]), c >= 3 && A.setZ(C, w[S * c + 2]), c >= 4 && A.setW(C, w[S * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
+ 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);
+ 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.");
}
- A.normalized = m;
+ g.normalized = p;
}
- return A;
+ return g;
});
}
/**
@@ -24784,7 +25400,7 @@ class qI {
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 = wA[d.magFilter] || qt, h.minFilter = wA[d.minFilter] || ii, h.wrapS = vA[d.wrapS] || wa, h.wrapT = vA[d.wrapT] || wa, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== Pn && h.minFilter !== qt, s.associations.set(h, { textures: e }), h;
+ 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;
}).catch(function() {
return null;
});
@@ -24806,14 +25422,14 @@ class qI {
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 m = d;
- t.isImageBitmapLoader === !0 && (m = function(g) {
- const A = new cn(g);
- A.needsUpdate = !0, d(A);
- }), t.load(da.resolveURL(u, r.path), m, void 0, f);
+ let p = d;
+ 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);
});
}).then(function(u) {
- return l === !0 && o.revokeObjectURL(c), Xi(u, a), u.userData.mimeType = a.mimeType || VI(a.uri), u;
+ return l === !0 && o.revokeObjectURL(c), ts(u, a), u.userData.mimeType = a.mimeType || V1(a.uri), u;
}).catch(function(u) {
throw console.error("THREE.GLTFLoader: Couldn't load texture", c), u;
});
@@ -24833,11 +25449,11 @@ class qI {
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[ft.KHR_TEXTURE_TRANSFORM]) {
- const o = n.extensions !== void 0 ? n.extensions[ft.KHR_TEXTURE_TRANSFORM] : void 0;
+ 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[ft.KHR_TEXTURE_TRANSFORM].extendTexture(a, o), r.associations.set(a, c);
+ 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;
@@ -24860,11 +25476,11 @@ class qI {
if (e.isPoints) {
const o = "PointsMaterial:" + n.uuid;
let c = this.cache.get(o);
- c || (c = new bf(), Fi.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 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;
} else if (e.isLine) {
const o = "LineBasicMaterial:" + n.uuid;
let c = this.cache.get(o);
- c || (c = new Xo(), Fi.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, this.cache.add(o, c)), n = c;
+ 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;
}
if (s || r || a) {
let o = "ClonedMaterial:" + n.uuid + ":";
@@ -24875,7 +25491,7 @@ class qI {
e.material = n;
}
getMaterialType() {
- return Po;
+ return Yo;
}
/**
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
@@ -24888,34 +25504,34 @@ class qI {
const t = this, n = this.json, s = this.extensions, r = n.materials[e];
let a;
const o = {}, c = r.extensions || {}, l = [];
- if (c[ft.KHR_MATERIALS_UNLIT]) {
- const u = s[ft.KHR_MATERIALS_UNLIT];
+ 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 je(1, 1, 1), o.opacity = 1, Array.isArray(u.baseColorFactor)) {
+ if (o.color = new Le(1, 1, 1), o.opacity = 1, Array.isArray(u.baseColorFactor)) {
const d = u.baseColorFactor;
- o.color.setRGB(d[0], d[1], d[2], ln), o.opacity = d[3];
+ 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, Kt)), 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, 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 = Ti);
- const h = r.alphaMode || Kh.OPAQUE;
- if (h === Kh.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, h === Kh.MASK && (o.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && a !== Ns && (l.push(t.assignTexture(o, "normalMap", r.normalTexture)), o.normalScale = new Ze(1, 1), r.normalTexture.scale !== void 0)) {
+ 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 u = r.normalTexture.scale;
o.normalScale.set(u, u);
}
- if (r.occlusionTexture !== void 0 && a !== Ns && (l.push(t.assignTexture(o, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (o.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && a !== Ns) {
+ if (r.occlusionTexture !== void 0 && a !== Os && (l.push(t.assignTexture(o, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (o.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && a !== Os) {
const u = r.emissiveFactor;
- o.emissive = new je().setRGB(u[0], u[1], u[2], ln);
+ o.emissive = new Le().setRGB(u[0], u[1], u[2], An);
}
- return r.emissiveTexture !== void 0 && a !== Ns && l.push(t.assignTexture(o, "emissiveMap", r.emissiveTexture, Kt)), Promise.all(l).then(function() {
+ return r.emissiveTexture !== void 0 && a !== Os && 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), Xi(u, r), t.associations.set(u, { materials: e }), r.extensions && $s(s, u, r), u;
+ return r.name && (u.name = r.name), ts(u, r), t.associations.set(u, { materials: e }), r.extensions && or(s, u, r), u;
});
}
/**
@@ -24926,7 +25542,7 @@ class qI {
* @return {string}
*/
createUniqueName(e) {
- const t = Ct.sanitizeNodeName(e || "");
+ const t = _t.sanitizeNodeName(e || "");
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
}
/**
@@ -24941,18 +25557,18 @@ class qI {
loadGeometries(e) {
const t = this, n = this.extensions, s = this.primitiveCache;
function r(o) {
- return n[ft.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o, t).then(function(c) {
- return CA(c, o, t);
+ return n[At.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o, t).then(function(c) {
+ return ng(c, o, t);
});
}
const a = [];
for (let o = 0, c = e.length; o < c; o++) {
- const l = e[o], h = zI(l), u = s[h];
+ const l = e[o], h = z1(l), u = s[h];
if (u)
a.push(u.promise);
else {
let d;
- l.extensions && l.extensions[ft.KHR_DRACO_MESH_COMPRESSION] ? d = r(l) : d = CA(new Hn(), l, t), s[h] = { primitive: l, promise: d }, a.push(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);
}
}
return Promise.all(a);
@@ -24967,39 +25583,39 @@ class qI {
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 ? QI(this.cache) : this.getDependency("material", a[c].material);
+ const h = a[c].material === void 0 ? Q1(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, m = h.length; f < m; f++) {
- const g = h[f], A = a[f];
- let p;
+ for (let f = 0, p = h.length; f < p; f++) {
+ const m = h[f], g = a[f];
+ let A;
const y = l[f];
- if (A.mode === Zn.TRIANGLES || A.mode === Zn.TRIANGLE_STRIP || A.mode === Zn.TRIANGLE_FAN || A.mode === void 0)
- p = r.isSkinnedMesh === !0 ? new Q_(g, y) : new Jt(g, y), p.isSkinnedMesh === !0 && p.normalizeSkinWeights(), A.mode === Zn.TRIANGLE_STRIP ? p.geometry = _A(p.geometry, Gm) : A.mode === Zn.TRIANGLE_FAN && (p.geometry = _A(p.geometry, ld));
- else if (A.mode === Zn.LINES)
- p = new zl(g, y);
- else if (A.mode === Zn.LINE_STRIP)
- p = new mf(g, y);
- else if (A.mode === Zn.LINE_LOOP)
- p = new W_(g, y);
- else if (A.mode === Zn.POINTS)
- p = new q_(g, y);
+ 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));
+ else if (g.mode === ri.LINES)
+ A = new ph(m, y);
+ else if (g.mode === ri.LINE_STRIP)
+ A = new fh(m, y);
+ else if (g.mode === ri.LINE_LOOP)
+ A = new My(m, y);
+ else if (g.mode === ri.POINTS)
+ A = new By(m, y);
else
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + A.mode);
- Object.keys(p.geometry.morphAttributes).length > 0 && HI(p, r), p.name = t.createUniqueName(r.name || "mesh_" + e), Xi(p, r), A.extensions && $s(s, p, A), t.assignFinalMaterial(p), u.push(p);
+ throw 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);
}
- for (let f = 0, m = u.length; f < m; f++)
+ 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 && $s(s, u[0], r), u[0];
- const d = new ur();
- r.extensions && $s(s, d, r), t.associations.set(d, { meshes: e });
- for (let f = 0, m = u.length; f < m; f++)
+ return r.extensions && or(s, u[0], r), u[0];
+ const d = new hs();
+ r.extensions && or(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;
});
@@ -25018,7 +25634,7 @@ class qI {
console.warn("THREE.GLTFLoader: Missing camera parameters.");
return;
}
- return n.type === "perspective" ? t = new vn(Vm.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new Ef(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), Xi(t, n), Promise.resolve(t);
+ 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);
}
/**
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -25037,12 +25653,12 @@ class qI {
const u = a[l];
if (u) {
o.push(u);
- const d = new st();
+ const d = new De();
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 Af(o, c);
+ return new dh(o, c);
});
}
/**
@@ -25055,8 +25671,8 @@ class qI {
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], m = s.samplers[f.sampler], g = f.target, A = g.node, p = s.parameters !== void 0 ? s.parameters[m.input] : m.input, y = s.parameters !== void 0 ? s.parameters[m.output] : m.output;
- g.node !== void 0 && (a.push(this.getDependency("node", A)), o.push(this.getDependency("accessor", p)), c.push(this.getDependency("accessor", y)), l.push(m), h.push(g));
+ 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));
}
return Promise.all([
Promise.all(a),
@@ -25065,17 +25681,17 @@ class qI {
Promise.all(l),
Promise.all(h)
]).then(function(u) {
- const d = u[0], f = u[1], m = u[2], g = u[3], A = u[4], p = [];
- for (let y = 0, b = d.length; y < b; y++) {
- const _ = d[y], M = f[y], w = m[y], S = g[y], T = A[y];
- if (_ === void 0) continue;
- _.updateMatrix && _.updateMatrix();
- const C = n._createAnimationTracks(_, M, w, S, T);
+ 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];
+ 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++)
- p.push(C[v]);
+ A.push(C[v]);
}
- return new pd(r, void 0, p);
+ return new ql(r, void 0, A);
});
}
createNodeMesh(e) {
@@ -25108,9 +25724,9 @@ class qI {
]).then(function(l) {
const h = l[0], u = l[1], d = l[2];
d !== null && h.traverse(function(f) {
- f.isSkinnedMesh && f.bind(d, WI);
+ f.isSkinnedMesh && f.bind(d, W1);
});
- for (let f = 0, m = u.length; f < m; f++)
+ for (let f = 0, p = u.length; f < p; f++)
h.add(u[f]);
return h;
});
@@ -25132,11 +25748,11 @@ class qI {
o.push(l);
}), this.nodeCache[e] = Promise.all(o).then(function(l) {
let h;
- if (r.isBone === !0 ? h = new t0() : l.length > 1 ? h = new ur() : l.length === 1 ? h = l[0] : h = new kt(), h !== l[0])
+ 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])
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), Xi(h, r), r.extensions && $s(n, h, r), r.matrix !== void 0) {
- const u = new st();
+ 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();
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);
@@ -25151,8 +25767,8 @@ class qI {
* @return {Promise<Group>}
*/
loadScene(e) {
- const t = this.extensions, n = this.json.scenes[e], s = this, r = new ur();
- n.name && (r.name = s.createUniqueName(n.name)), Xi(r, n), n.extensions && $s(t, r, n);
+ 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);
const a = n.nodes || [], o = [];
for (let c = 0, l = a.length; c < l; c++)
o.push(s.getDependency("node", a[c]));
@@ -25162,7 +25778,7 @@ class qI {
const l = (h) => {
const u = /* @__PURE__ */ new Map();
for (const [d, f] of s.associations)
- (d instanceof Fi || d instanceof cn) && u.set(d, f);
+ (d instanceof ui || d instanceof an) && u.set(d, f);
return h.traverse((d) => {
const f = s.associations.get(d);
f != null && u.set(d, f);
@@ -25173,41 +25789,41 @@ class qI {
}
_createAnimationTracks(e, t, n, s, r) {
const a = [], o = e.name ? e.name : e.uuid, c = [];
- vs[r.path] === vs.weights ? e.traverse(function(d) {
+ Rs[r.path] === Rs.weights ? e.traverse(function(d) {
d.morphTargetInfluences && c.push(d.name ? d.name : d.uuid);
}) : c.push(o);
let l;
- switch (vs[r.path]) {
- case vs.weights:
- l = Sa;
+ switch (Rs[r.path]) {
+ case Rs.weights:
+ l = Tr;
break;
- case vs.rotation:
- l = Ia;
+ case Rs.rotation:
+ l = Ks;
break;
- case vs.translation:
- case vs.scale:
- l = Ma;
+ case Rs.translation:
+ case Rs.scale:
+ l = Rr;
break;
default:
- n.itemSize === 1 ? l = Sa : l = Ma;
+ n.itemSize === 1 ? l = Tr : l = Rr;
break;
}
- const h = s.interpolation !== void 0 ? OI[s.interpolation] : Do, u = this._getArrayFromAccessor(n);
+ const h = s.interpolation !== void 0 ? O1[s.interpolation] : Wo, u = this._getArrayFromAccessor(n);
for (let d = 0, f = c.length; d < f; d++) {
- const m = new l(
- c[d] + "." + vs[r.path],
+ const p = new l(
+ c[d] + "." + Rs[r.path],
t.array,
u,
h
);
- s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(m), a.push(m);
+ s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p), a.push(p);
}
return a;
}
_getArrayFromAccessor(e) {
let t = e.array;
if (e.normalized) {
- const n = bd(t.constructor), s = new Float32Array(t.length);
+ const n = Wd(t.constructor), s = new Float32Array(t.length);
for (let r = 0, a = t.length; r < a; r++)
s[r] = t[r] * n;
t = s;
@@ -25216,21 +25832,21 @@ class qI {
}
_createCubicSplineTrackInterpolant(e) {
e.createInterpolant = function(n) {
- const s = this instanceof Ia ? UI : b0;
+ const s = this instanceof Ks ? U1 : Z0;
return new s(this.times, this.values, this.getValueSize() / 3, n);
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
}
}
-function KI(i, e, t) {
- const n = e.attributes, s = new Pi();
+function K1(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;
if (c !== void 0 && l !== void 0) {
if (s.set(
- new H(c[0], c[1], c[2]),
- new H(l[0], l[1], l[2])
+ new G(c[0], c[1], c[2]),
+ new G(l[0], l[1], l[2])
), o.normalized) {
- const h = bd(fa[o.componentType]);
+ const h = Wd(va[o.componentType]);
s.min.multiplyScalar(h), s.max.multiplyScalar(h);
}
} else {
@@ -25241,15 +25857,15 @@ function KI(i, e, t) {
return;
const r = e.targets;
if (r !== void 0) {
- const o = new H(), c = new H();
+ 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, m = d.max;
- if (f !== void 0 && m !== void 0) {
- if (c.setX(Math.max(Math.abs(f[0]), Math.abs(m[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(m[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(m[2]))), d.normalized) {
- const g = bd(fa[d.componentType]);
- c.multiplyScalar(g);
+ 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]);
+ c.multiplyScalar(m);
}
o.max(c);
} else
@@ -25259,10 +25875,10 @@ function KI(i, e, t) {
s.expandByVector(o);
}
i.boundingBox = s;
- const a = new ki();
+ const a = new zi();
s.getCenter(a.center), a.radius = s.min.distanceTo(s.max) / 2, i.boundingSphere = a;
}
-function CA(i, e, t) {
+function ng(i, e, t) {
const n = e.attributes, s = [];
function r(a, o) {
return t.getDependency("accessor", a).then(function(c) {
@@ -25270,7 +25886,7 @@ function CA(i, e, t) {
});
}
for (const a in n) {
- const o = md[a] || a.toLowerCase();
+ const o = Vd[a] || a.toLowerCase();
o in i.attributes || s.push(r(n[a], o));
}
if (e.indices !== void 0 && !i.index) {
@@ -25279,33 +25895,33 @@ function CA(i, e, t) {
});
s.push(a);
}
- return mt.workingColorSpace !== ln && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${mt.workingColorSpace}" not supported.`), Xi(i, e), KI(i, e, t), Promise.all(s).then(function() {
- return e.targets !== void 0 ? GI(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), K1(i, e, t), Promise.all(s).then(function() {
+ return e.targets !== void 0 ? G1(i, e.targets, t) : i;
});
}
-var jI = (function() {
+var j1 = (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(p) {
- r = p.instance, r.exports.__wasm_call_ctors();
+ 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(p) {
- for (var y = new Uint8Array(p.length), b = 0; b < p.length; ++b) {
- var _ = p.charCodeAt(b);
- y[b] = _ > 96 ? _ - 97 : _ > 64 ? _ - 39 : _ + 4;
- }
- for (var M = 0, b = 0; b < p.length; ++b)
- y[M++] = y[b] < 60 ? n[y[b]] : (y[b] - 60) * 64 + y[++b];
- return y.buffer.slice(0, M);
- }
- function c(p, y, b, _, M, w) {
- var S = r.exports.sbrk, T = b + 3 & -4, C = S(T * _), v = S(M.length), F = new Uint8Array(r.exports.memory.buffer);
- F.set(M, v);
- var K = p(C, b, _, v, M.length);
- if (K == 0 && w && w(C, T, _), y.set(F.subarray(C, C + b * _)), S(C - S(0)), K != 0)
+ function o(A) {
+ for (var y = 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;
+ }
+ 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);
+ }
+ 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)
throw new Error("Malformed buffer data: " + K);
}
var l = {
@@ -25318,68 +25934,68 @@ var jI = (function() {
TRIANGLES: "meshopt_decodeIndexBuffer",
INDICES: "meshopt_decodeIndexSequence"
}, u = [], d = 0;
- function f(p) {
+ function f(A) {
var y = {
- object: new Worker(p),
+ object: new Worker(A),
pending: 0,
requests: {}
};
- return y.object.onmessage = function(b) {
- var _ = b.data;
- y.pending -= _.count, y.requests[_.id][_.action](_.value), delete y.requests[_.id];
+ return y.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;
}
- function m(p) {
- 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() + A.toString(), b = new Blob([y], { type: "text/javascript" }), _ = URL.createObjectURL(b), M = 0; M < p; ++M)
- u[M] = f(_);
- URL.revokeObjectURL(_);
+ 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);
+ URL.revokeObjectURL(E);
}
- function g(p, y, b, _, M) {
+ 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]);
return new Promise(function(T, C) {
- var v = new Uint8Array(b), F = d++;
- w.pending += p, w.requests[F] = { resolve: T, reject: C }, w.object.postMessage({ id: F, count: p, size: y, source: v, mode: _, filter: M }, [v.buffer]);
+ 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]);
});
}
- function A(p) {
+ function g(A) {
a.then(function() {
- var y = p.data;
+ var y = A.data;
try {
- var b = new Uint8Array(y.count * y.size);
- c(r.exports[y.mode], b, y.count, y.size, y.source, r.exports[y.filter]), self.postMessage({ id: y.id, count: y.count, action: "resolve", value: b }, [b.buffer]);
- } catch (_) {
- self.postMessage({ id: y.id, count: y.count, action: "reject", value: _ });
+ 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]);
+ } catch (E) {
+ self.postMessage({ id: y.id, count: y.count, action: "reject", value: E });
}
});
}
return {
ready: a,
supported: !0,
- useWorkers: function(p) {
- m(p);
+ useWorkers: function(A) {
+ p(A);
},
- decodeVertexBuffer: function(p, y, b, _, M) {
- c(r.exports.meshopt_decodeVertexBuffer, p, y, b, _, r.exports[l[M]]);
+ decodeVertexBuffer: function(A, y, x, E, I) {
+ c(r.exports.meshopt_decodeVertexBuffer, A, y, x, E, r.exports[l[I]]);
},
- decodeIndexBuffer: function(p, y, b, _) {
- c(r.exports.meshopt_decodeIndexBuffer, p, y, b, _);
+ decodeIndexBuffer: function(A, y, x, E) {
+ c(r.exports.meshopt_decodeIndexBuffer, A, y, x, E);
},
- decodeIndexSequence: function(p, y, b, _) {
- c(r.exports.meshopt_decodeIndexSequence, p, y, b, _);
+ decodeIndexSequence: function(A, y, x, E) {
+ c(r.exports.meshopt_decodeIndexSequence, A, y, x, E);
},
- decodeGltfBuffer: function(p, y, b, _, M, w) {
- c(r.exports[h[M]], p, y, b, _, r.exports[l[w]]);
+ decodeGltfBuffer: function(A, y, x, E, I, w) {
+ c(r.exports[h[I]], A, y, x, E, r.exports[l[w]]);
},
- decodeGltfBufferAsync: function(p, y, b, _, M) {
- return u.length > 0 ? g(p, y, b, h[_], l[M]) : a.then(function() {
- var w = new Uint8Array(p * y);
- return c(r.exports[h[_]], w, p, y, b, r.exports[l[M]]), 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;
});
}
};
})();
-const SA = { type: "change" }, Cf = { type: "start" }, x0 = { type: "end" }, Uc = new jo(), IA = new Rs(), XI = Math.cos(70 * Vm.DEG2RAD), nn = new H(), Un = 2 * Math.PI, Bt = {
+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 = {
NONE: -1,
ROTATE: 0,
DOLLY: 1,
@@ -25388,8 +26004,8 @@ const SA = { type: "change" }, Cf = { type: "start" }, x0 = { type: "end" }, Uc
TOUCH_PAN: 4,
TOUCH_DOLLY_PAN: 5,
TOUCH_DOLLY_ROTATE: 6
-}, Xh = 1e-6;
-class YI extends Ry {
+}, Eu = 1e-6;
+class Y1 extends Rw {
/**
* Constructs a new controls instance.
*
@@ -25397,7 +26013,7 @@ class YI extends Ry {
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
*/
constructor(e, t = null) {
- super(e, t), this.state = Bt.NONE, this.target = new H(), this.cursor = new H(), 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: la.ROTATE, MIDDLE: la.DOLLY, RIGHT: la.PAN }, this.touches = { ONE: ta.ROTATE, TWO: ta.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new H(), this._lastQuaternion = new Xn(), this._lastTargetPosition = new H(), this._quat = new Xn().setFromUnitVectors(e.up, new H(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new jp(), this._sphericalDelta = new jp(), this._scale = 1, this._panOffset = new H(), 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 H(), this._mouse = new Ze(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = ZI.bind(this), this._onPointerDown = JI.bind(this), this._onPointerUp = $I.bind(this), this._onContextMenu = a1.bind(this), this._onMouseWheel = n1.bind(this), this._onKeyDown = i1.bind(this), this._onTouchStart = s1.bind(this), this._onTouchMove = r1.bind(this), this._onMouseDown = e1.bind(this), this._onMouseMove = t1.bind(this), this._interceptControlDown = o1.bind(this), this._interceptControlUp = c1.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: _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();
}
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";
@@ -25458,13 +26074,13 @@ class YI extends Ry {
* 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(SA), this.update(), this.state = Bt.NONE;
+ 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;
}
update(e = null) {
const t = this.object.position;
- nn.copy(t).sub(this.target), nn.applyQuaternion(this._quat), this._spherical.setFromVector3(nn), this.autoRotate && this.state === Bt.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);
+ ln.copy(t).sub(this.target), ln.applyQuaternion(this._quat), this._spherical.setFromVector3(ln), this.autoRotate && this.state === Ft.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
let n = this.minAzimuthAngle, s = this.maxAzimuthAngle;
- isFinite(n) && isFinite(s) && (n < -Math.PI ? n += Un : n > Math.PI && (n -= Un), s < -Math.PI ? s += Un : s > Math.PI && (s -= Un), n <= s ? this._spherical.theta = Math.max(n, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + s) / 2 ? Math.max(n, this._spherical.theta) : Math.min(s, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
+ isFinite(n) && isFinite(s) && (n < -Math.PI ? n += qn : n > Math.PI && (n -= qn), s < -Math.PI ? s += qn : s > Math.PI && (s -= qn), n <= s ? this._spherical.theta = Math.max(n, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + s) / 2 ? Math.max(n, this._spherical.theta) : Math.min(s, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
let r = !1;
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
this._spherical.radius = this._clampDistance(this._spherical.radius);
@@ -25472,31 +26088,31 @@ class YI extends Ry {
const a = this._spherical.radius;
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), r = a != this._spherical.radius;
}
- if (nn.setFromSpherical(this._spherical), nn.applyQuaternion(this._quatInverse), t.copy(this.target).add(nn), 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) {
+ if (ln.setFromSpherical(this._spherical), ln.applyQuaternion(this._quatInverse), t.copy(this.target).add(ln), 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 = nn.length();
+ const o = ln.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 H(this._mouse.x, this._mouse.y, 0);
+ 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 H(this._mouse.x, this._mouse.y, 0);
- l.unproject(this.object), this.object.position.sub(l).add(o), this.object.updateMatrixWorld(), a = nn.length();
+ 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 = ln.length();
} else
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
- a !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position) : (Uc.origin.copy(this.object.position), Uc.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(Uc.direction)) < XI ? this.object.lookAt(this.target) : (IA.setFromNormalAndCoplanarPoint(this.object.up, this.target), Uc.intersectPlane(IA, this.target))));
+ 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))));
} 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) > Xh || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Xh || this._lastTargetPosition.distanceToSquared(this.target) > Xh ? (this.dispatchEvent(SA), 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) > 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;
}
_getAutoRotationAngle(e) {
- return e !== null ? Un / 60 * this.autoRotateSpeed * e : Un / 60 / 60 * this.autoRotateSpeed;
+ return e !== null ? qn / 60 * this.autoRotateSpeed * e : qn / 60 / 60 * this.autoRotateSpeed;
}
_getZoomScale(e) {
const t = Math.abs(e * 0.01);
@@ -25509,18 +26125,18 @@ class YI extends Ry {
this._sphericalDelta.phi -= e;
}
_panLeft(e, t) {
- nn.setFromMatrixColumn(t, 0), nn.multiplyScalar(-e), this._panOffset.add(nn);
+ ln.setFromMatrixColumn(t, 0), ln.multiplyScalar(-e), this._panOffset.add(ln);
}
_panUp(e, t) {
- this.screenSpacePanning === !0 ? nn.setFromMatrixColumn(t, 1) : (nn.setFromMatrixColumn(t, 0), nn.crossVectors(this.object.up, nn)), nn.multiplyScalar(e), this._panOffset.add(nn);
+ this.screenSpacePanning === !0 ? ln.setFromMatrixColumn(t, 1) : (ln.setFromMatrixColumn(t, 0), ln.crossVectors(this.object.up, ln)), ln.multiplyScalar(e), this._panOffset.add(ln);
}
// deltaX and deltaY are in pixels; right and down are positive
_pan(e, t) {
const n = this.domElement;
if (this.object.isPerspectiveCamera) {
const s = this.object.position;
- nn.copy(s).sub(this.target);
- let r = nn.length();
+ ln.copy(s).sub(this.target);
+ let r = ln.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);
}
@@ -25555,7 +26171,7 @@ class YI extends Ry {
_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(Un * this._rotateDelta.x / t.clientHeight), this._rotateUp(Un * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
+ this._rotateLeft(qn * this._rotateDelta.x / t.clientHeight), this._rotateUp(qn * 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();
@@ -25570,16 +26186,16 @@ class YI extends Ry {
let t = !1;
switch (e.code) {
case this.keys.UP:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(Un * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
break;
case this.keys.BOTTOM:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-Un * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
break;
case this.keys.LEFT:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(Un * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
break;
case this.keys.RIGHT:
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-Un * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-qn * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
break;
}
t && (e.preventDefault(), this.update());
@@ -25619,7 +26235,7 @@ class YI extends Ry {
}
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
const t = this.domElement;
- this._rotateLeft(Un * this._rotateDelta.x / t.clientHeight), this._rotateUp(Un * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
+ this._rotateLeft(qn * this._rotateDelta.x / t.clientHeight), this._rotateUp(qn * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
}
_handleTouchMovePan(e) {
if (this._pointers.length === 1)
@@ -25685,16 +26301,16 @@ class YI extends Ry {
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
}
}
-function JI(i) {
+function J1(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 ZI(i) {
+function Z1(i) {
this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
}
-function $I(i) {
+function $1(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(x0), this.state = Bt.NONE;
+ this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent($0), this.state = Ft.NONE;
break;
case 1:
const e = this._pointers[0], t = this._pointerPositions[e];
@@ -25702,7 +26318,7 @@ function $I(i) {
break;
}
}
-function e1(i) {
+function eM(i) {
let e;
switch (i.button) {
case 0:
@@ -25718,143 +26334,143 @@ function e1(i) {
e = -1;
}
switch (e) {
- case la.DOLLY:
+ case _a.DOLLY:
if (this.enableZoom === !1) return;
- this._handleMouseDownDolly(i), this.state = Bt.DOLLY;
+ this._handleMouseDownDolly(i), this.state = Ft.DOLLY;
break;
- case la.ROTATE:
+ case _a.ROTATE:
if (i.ctrlKey || i.metaKey || i.shiftKey) {
if (this.enablePan === !1) return;
- this._handleMouseDownPan(i), this.state = Bt.PAN;
+ this._handleMouseDownPan(i), this.state = Ft.PAN;
} else {
if (this.enableRotate === !1) return;
- this._handleMouseDownRotate(i), this.state = Bt.ROTATE;
+ this._handleMouseDownRotate(i), this.state = Ft.ROTATE;
}
break;
- case la.PAN:
+ case _a.PAN:
if (i.ctrlKey || i.metaKey || i.shiftKey) {
if (this.enableRotate === !1) return;
- this._handleMouseDownRotate(i), this.state = Bt.ROTATE;
+ this._handleMouseDownRotate(i), this.state = Ft.ROTATE;
} else {
if (this.enablePan === !1) return;
- this._handleMouseDownPan(i), this.state = Bt.PAN;
+ this._handleMouseDownPan(i), this.state = Ft.PAN;
}
break;
default:
- this.state = Bt.NONE;
+ this.state = Ft.NONE;
}
- this.state !== Bt.NONE && this.dispatchEvent(Cf);
+ this.state !== Ft.NONE && this.dispatchEvent($f);
}
-function t1(i) {
+function tM(i) {
switch (this.state) {
- case Bt.ROTATE:
+ case Ft.ROTATE:
if (this.enableRotate === !1) return;
this._handleMouseMoveRotate(i);
break;
- case Bt.DOLLY:
+ case Ft.DOLLY:
if (this.enableZoom === !1) return;
this._handleMouseMoveDolly(i);
break;
- case Bt.PAN:
+ case Ft.PAN:
if (this.enablePan === !1) return;
this._handleMouseMovePan(i);
break;
}
}
-function n1(i) {
- this.enabled === !1 || this.enableZoom === !1 || this.state !== Bt.NONE || (i.preventDefault(), this.dispatchEvent(Cf), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(x0));
+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 i1(i) {
+function iM(i) {
this.enabled !== !1 && this._handleKeyDown(i);
}
-function s1(i) {
+function sM(i) {
switch (this._trackPointer(i), this._pointers.length) {
case 1:
switch (this.touches.ONE) {
- case ta.ROTATE:
+ case fa.ROTATE:
if (this.enableRotate === !1) return;
- this._handleTouchStartRotate(i), this.state = Bt.TOUCH_ROTATE;
+ this._handleTouchStartRotate(i), this.state = Ft.TOUCH_ROTATE;
break;
- case ta.PAN:
+ case fa.PAN:
if (this.enablePan === !1) return;
- this._handleTouchStartPan(i), this.state = Bt.TOUCH_PAN;
+ this._handleTouchStartPan(i), this.state = Ft.TOUCH_PAN;
break;
default:
- this.state = Bt.NONE;
+ this.state = Ft.NONE;
}
break;
case 2:
switch (this.touches.TWO) {
- case ta.DOLLY_PAN:
+ case fa.DOLLY_PAN:
if (this.enableZoom === !1 && this.enablePan === !1) return;
- this._handleTouchStartDollyPan(i), this.state = Bt.TOUCH_DOLLY_PAN;
+ this._handleTouchStartDollyPan(i), this.state = Ft.TOUCH_DOLLY_PAN;
break;
- case ta.DOLLY_ROTATE:
+ case fa.DOLLY_ROTATE:
if (this.enableZoom === !1 && this.enableRotate === !1) return;
- this._handleTouchStartDollyRotate(i), this.state = Bt.TOUCH_DOLLY_ROTATE;
+ this._handleTouchStartDollyRotate(i), this.state = Ft.TOUCH_DOLLY_ROTATE;
break;
default:
- this.state = Bt.NONE;
+ this.state = Ft.NONE;
}
break;
default:
- this.state = Bt.NONE;
+ this.state = Ft.NONE;
}
- this.state !== Bt.NONE && this.dispatchEvent(Cf);
+ this.state !== Ft.NONE && this.dispatchEvent($f);
}
-function r1(i) {
+function rM(i) {
switch (this._trackPointer(i), this.state) {
- case Bt.TOUCH_ROTATE:
+ case Ft.TOUCH_ROTATE:
if (this.enableRotate === !1) return;
this._handleTouchMoveRotate(i), this.update();
break;
- case Bt.TOUCH_PAN:
+ case Ft.TOUCH_PAN:
if (this.enablePan === !1) return;
this._handleTouchMovePan(i), this.update();
break;
- case Bt.TOUCH_DOLLY_PAN:
+ case Ft.TOUCH_DOLLY_PAN:
if (this.enableZoom === !1 && this.enablePan === !1) return;
this._handleTouchMoveDollyPan(i), this.update();
break;
- case Bt.TOUCH_DOLLY_ROTATE:
+ case Ft.TOUCH_DOLLY_ROTATE:
if (this.enableZoom === !1 && this.enableRotate === !1) return;
this._handleTouchMoveDollyRotate(i), this.update();
break;
default:
- this.state = Bt.NONE;
+ this.state = Ft.NONE;
}
}
-function a1(i) {
+function aM(i) {
this.enabled !== !1 && i.preventDefault();
}
-function o1(i) {
+function oM(i) {
i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
}
-function c1(i) {
+function cM(i) {
i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
}
-class l1 extends ud {
+class lM extends kd {
constructor() {
super();
- const e = new Pa();
+ const e = new Va();
e.deleteAttribute("uv");
- const t = new Po({ side: Ln }), n = new Po(), s = new c0(16777215, 900, 28, 2);
+ const t = new Yo({ side: Vn }), n = new Yo(), s = new Kl(16777215, 900, 28, 2);
s.position.set(0.418, 16.199, 0.3), this.add(s);
- const r = new Jt(e, t);
+ 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 n0(e, n, 6), o = new kt();
+ const a = new R0(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 Jt(e, jr(50));
+ const c = new Zt(e, ra(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 Jt(e, jr(50));
+ const l = new Zt(e, ra(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 Jt(e, jr(17));
+ const h = new Zt(e, ra(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 Jt(e, jr(43));
+ const u = new Zt(e, ra(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 Jt(e, jr(20));
+ const d = new Zt(e, ra(20));
d.position.set(3.235, 11.486, -12.541), d.scale.set(2.5, 2, 0.1), this.add(d);
- const f = new Jt(e, jr(100));
+ const f = new Zt(e, ra(100));
f.position.set(0, 20, 0), f.scale.set(1, 0.1, 1), this.add(f);
}
/**
@@ -25870,17 +26486,17 @@ class l1 extends ud {
t.dispose();
}
}
-function jr(i) {
- const e = new Ns();
+function ra(i) {
+ const e = new Os();
return e.color.setScalar(i), e;
}
-function h1(i) {
+function hM(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 ra(i, e) {
+function ma(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; )
@@ -25908,10 +26524,10 @@ function ra(i, e) {
}
return "unknown format";
}
-var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
+var rg = Array.prototype.forEach, uo = Array.prototype.slice, ue = {
BREAK: {},
extend: function(e) {
- return this.each(no.call(arguments, 1), function(t) {
+ return this.each(uo.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]);
@@ -25919,7 +26535,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
}, this), e;
},
defaults: function(e) {
- return this.each(no.call(arguments, 1), function(t) {
+ return this.each(uo.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]);
@@ -25927,16 +26543,16 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
}, this), e;
},
compose: function() {
- var e = no.call(arguments);
+ var e = uo.call(arguments);
return function() {
- for (var t = no.call(arguments), n = e.length - 1; n >= 0; n--)
+ for (var t = uo.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 (MA && e.forEach && e.forEach === MA)
+ if (rg && e.forEach && e.forEach === rg)
e.forEach(t, n);
else if (e.length === e.length + 0) {
var s = void 0, r = void 0;
@@ -25964,7 +26580,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
};
},
toArray: function(e) {
- return e.toArray ? e.toArray() : no.call(e);
+ return e.toArray ? e.toArray() : uo.call(e);
},
isUndefined: function(e) {
return e === void 0;
@@ -26000,7 +26616,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
isFunction: function(e) {
return e instanceof Function;
}
-}, u1 = [
+}, uM = [
{
litmus: ue.isString,
conversions: {
@@ -26012,7 +26628,7 @@ var MA = Array.prototype.forEach, no = 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: ra
+ write: ma
},
SIX_CHAR_HEX: {
read: function(e) {
@@ -26022,7 +26638,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
hex: parseInt("0x" + t[1].toString(), 0)
};
},
- write: ra
+ write: ma
},
CSS_RGB: {
read: function(e) {
@@ -26034,7 +26650,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
b: parseFloat(t[3])
};
},
- write: ra
+ write: ma
},
CSS_RGBA: {
read: function(e) {
@@ -26047,7 +26663,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
a: parseFloat(t[4])
};
},
- write: ra
+ write: ma
}
}
},
@@ -26177,17 +26793,17 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
}
}
}
-], io = void 0, Oc = void 0, xd = function() {
- Oc = !1;
+], fo = void 0, nl = void 0, qd = function() {
+ nl = !1;
var e = arguments.length > 1 ? ue.toArray(arguments) : arguments[0];
- return ue.each(u1, function(t) {
+ return ue.each(uM, function(t) {
if (t.litmus(e))
return ue.each(t.conversions, function(n, s) {
- if (io = n.read(e), Oc === !1 && io !== !1)
- return Oc = io, io.conversionName = s, io.conversion = n, ue.BREAK;
+ if (fo = n.read(e), nl === !1 && fo !== !1)
+ return nl = fo, fo.conversionName = s, fo.conversion = n, ue.BREAK;
}), ue.BREAK;
- }), Oc;
-}, BA = void 0, Il = {
+ }), nl;
+}, ag = void 0, jl = {
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 {
@@ -26220,16 +26836,16 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
return e >> t * 8 & 255;
},
hex_with_component: function(e, t, n) {
- return n << (BA = t * 8) | e & ~(255 << BA);
+ return n << (ag = t * 8) | e & ~(255 << ag);
}
-}, d1 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
+}, dM = 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;
-}, yi = function(i, e) {
+}, Ti = function(i, e) {
if (!(i instanceof e))
throw new TypeError("Cannot call a class as a function");
-}, wi = /* @__PURE__ */ (function() {
+}, Ri = /* @__PURE__ */ (function() {
function i(e, t) {
for (var n = 0; n < t.length; n++) {
var s = t[n];
@@ -26239,7 +26855,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
return function(e, t, n) {
return t && i(e.prototype, t), n && i(e, n), e;
};
-})(), Qs = function i(e, t, n) {
+})(), js = function i(e, t, n) {
e === null && (e = Function.prototype);
var s = Object.getOwnPropertyDescriptor(e, t);
if (s === void 0) {
@@ -26251,7 +26867,7 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
var a = s.get;
return a === void 0 ? void 0 : a.call(n);
}
-}, zs = function(i, e) {
+}, Js = 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, {
@@ -26262,25 +26878,25 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(i, e) : i.__proto__ = e);
-}, Vs = function(i, 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;
-}, bn = (function() {
+}, vn = (function() {
function i() {
- if (yi(this, i), this.__state = xd.apply(this, arguments), this.__state === !1)
+ if (Ti(this, i), this.__state = qd.apply(this, arguments), this.__state === !1)
throw new Error("Failed to interpret color arguments");
this.__state.a = this.__state.a || 1;
}
- return wi(i, [{
+ return Ri(i, [{
key: "toString",
value: function() {
- return ra(this);
+ return ma(this);
}
}, {
key: "toHexString",
value: function() {
- return ra(this, !0);
+ return ma(this, !0);
}
}, {
key: "toOriginal",
@@ -26289,49 +26905,49 @@ var MA = Array.prototype.forEach, no = Array.prototype.slice, ue = {
}
}]), i;
})();
-function Sf(i, e, t) {
+function ep(i, e, t) {
Object.defineProperty(i, e, {
get: function() {
- return this.__state.space === "RGB" ? this.__state[e] : (bn.recalculateRGB(this, e, t), this.__state[e]);
+ return this.__state.space === "RGB" ? this.__state[e] : (vn.recalculateRGB(this, e, t), this.__state[e]);
},
set: function(s) {
- this.__state.space !== "RGB" && (bn.recalculateRGB(this, e, t), this.__state.space = "RGB"), this.__state[e] = s;
+ this.__state.space !== "RGB" && (vn.recalculateRGB(this, e, t), this.__state.space = "RGB"), this.__state[e] = s;
}
});
}
-function If(i, e) {
+function tp(i, e) {
Object.defineProperty(i, e, {
get: function() {
- return this.__state.space === "HSV" ? this.__state[e] : (bn.recalculateHSV(this), this.__state[e]);
+ return this.__state.space === "HSV" ? this.__state[e] : (vn.recalculateHSV(this), this.__state[e]);
},
set: function(n) {
- this.__state.space !== "HSV" && (bn.recalculateHSV(this), this.__state.space = "HSV"), this.__state[e] = n;
+ this.__state.space !== "HSV" && (vn.recalculateHSV(this), this.__state.space = "HSV"), this.__state[e] = n;
}
});
}
-bn.recalculateRGB = function(i, e, t) {
+vn.recalculateRGB = function(i, e, t) {
if (i.__state.space === "HEX")
- i.__state[e] = Il.component_from_hex(i.__state.hex, t);
+ i.__state[e] = jl.component_from_hex(i.__state.hex, t);
else if (i.__state.space === "HSV")
- ue.extend(i.__state, Il.hsv_to_rgb(i.__state.h, i.__state.s, i.__state.v));
+ ue.extend(i.__state, jl.hsv_to_rgb(i.__state.h, i.__state.s, i.__state.v));
else
throw new Error("Corrupted color state");
};
-bn.recalculateHSV = function(i) {
- var e = Il.rgb_to_hsv(i.r, i.g, i.b);
+vn.recalculateHSV = function(i) {
+ var e = jl.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;
};
-bn.COMPONENTS = ["r", "g", "b", "h", "s", "v", "hex", "a"];
-Sf(bn.prototype, "r", 2);
-Sf(bn.prototype, "g", 1);
-Sf(bn.prototype, "b", 0);
-If(bn.prototype, "h");
-If(bn.prototype, "s");
-If(bn.prototype, "v");
-Object.defineProperty(bn.prototype, "a", {
+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");
+Object.defineProperty(vn.prototype, "a", {
get: function() {
return this.__state.a;
},
@@ -26339,19 +26955,19 @@ Object.defineProperty(bn.prototype, "a", {
this.__state.a = e;
}
});
-Object.defineProperty(bn.prototype, "hex", {
+Object.defineProperty(vn.prototype, "hex", {
get: function() {
- return this.__state.space !== "HEX" && (this.__state.hex = Il.rgb_to_hex(this.r, this.g, this.b), this.__state.space = "HEX"), this.__state.hex;
+ 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;
},
set: function(e) {
this.__state.space = "HEX", this.__state.hex = e;
}
});
-var Mr = (function() {
+var Or = (function() {
function i(e, t) {
- yi(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;
+ 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;
}
- return wi(i, [{
+ return Ri(i, [{
key: "onChange",
value: function(t) {
return this.__onChange = t, this;
@@ -26382,21 +26998,21 @@ var Mr = (function() {
return this.initialValue !== this.getValue();
}
}]), i;
-})(), f1 = {
+})(), fM = {
HTMLEvents: ["change"],
MouseEvents: ["click", "mousemove", "mousedown", "mouseup", "mouseover"],
KeyboardEvents: ["keydown"]
-}, E0 = {};
-ue.each(f1, function(i, e) {
+}, ex = {};
+ue.each(fM, function(i, e) {
ue.each(i, function(t) {
- E0[t] = e;
+ ex[t] = e;
});
});
-var p1 = /(\d+(\.\d+)?)px/;
-function Ci(i) {
+var pM = /(\d+(\.\d+)?)px/;
+function Di(i) {
if (i === "0" || ue.isUndefined(i))
return 0;
- var e = i.match(p1);
+ var e = i.match(pM);
return ue.isNull(e) ? 0 : parseFloat(e[1]);
}
var te = {
@@ -26411,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 = E0[t];
+ var r = n || {}, a = ex[t];
if (!a)
throw new Error("Event type " + t + " not supported.");
var o = document.createEvent(a);
@@ -26491,11 +27107,11 @@ var te = {
},
getWidth: function(e) {
var t = getComputedStyle(e);
- return Ci(t["border-left-width"]) + Ci(t["border-right-width"]) + Ci(t["padding-left"]) + Ci(t["padding-right"]) + Ci(t.width);
+ return Di(t["border-left-width"]) + Di(t["border-right-width"]) + Di(t["padding-left"]) + Di(t["padding-right"]) + Di(t.width);
},
getHeight: function(e) {
var t = getComputedStyle(e);
- return Ci(t["border-top-width"]) + Ci(t["border-bottom-width"]) + Ci(t["padding-top"]) + Ci(t["padding-bottom"]) + Ci(t.height);
+ return Di(t["border-top-width"]) + Di(t["border-bottom-width"]) + Di(t["padding-top"]) + Di(t["padding-bottom"]) + Di(t.height);
},
getOffset: function(e) {
var t = e, n = { left: 0, top: 0 };
@@ -26508,34 +27124,34 @@ var te = {
isActive: function(e) {
return e === document.activeElement && (e.type || e.href);
}
-}, _0 = (function(i) {
- zs(e, i);
+}, tx = (function(i) {
+ Js(e, i);
function e(t, n) {
- yi(this, e);
- var s = Vs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;
+ Ti(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 wi(e, [{
+ return Ri(e, [{
key: "setValue",
value: function(n) {
- var s = Qs(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, n);
+ var s = js(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);
+ 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;
-})(Mr), A1 = (function(i) {
- zs(e, i);
+})(Or), AM = (function(i) {
+ Js(e, i);
function e(t, n, s) {
- yi(this, e);
- var r = Vs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), a = s, o = r;
+ Ti(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) {
@@ -26550,23 +27166,23 @@ var te = {
o.setValue(l);
}), r.domElement.appendChild(r.__select), r;
}
- return wi(e, [{
+ return Ri(e, [{
key: "setValue",
value: function(n) {
- var s = Qs(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, n);
+ var s = js(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));
+ return te.isActive(this.__select) ? this : (this.__select.value = this.getValue(), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this));
}
}]), e;
-})(Mr), g1 = (function(i) {
- zs(e, i);
+})(Or), gM = (function(i) {
+ Js(e, i);
function e(t, n) {
- yi(this, e);
- var s = Vs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;
+ Ti(this, e);
+ var s = Zs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), r = s;
function a() {
r.setValue(r.__input.value);
}
@@ -26577,29 +27193,29 @@ var te = {
c.keyCode === 13 && this.blur();
}), s.updateDisplay(), s.domElement.appendChild(s.__input), s;
}
- return wi(e, [{
+ return Ri(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);
+ return te.isActive(this.__input) || (this.__input.value = this.getValue()), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);
}
}]), e;
-})(Mr);
-function TA(i) {
+})(Or);
+function og(i) {
var e = i.toString();
return e.indexOf(".") > -1 ? e.length - e.indexOf(".") - 1 : 0;
}
-var y0 = (function(i) {
- zs(e, i);
+var nx = (function(i) {
+ Js(e, i);
function e(t, n, s) {
- yi(this, e);
- var r = Vs(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 = TA(r.__impliedStep), r;
+ 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;
}
- return wi(e, [{
+ return Ri(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);
+ 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), js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, s);
}
}, {
key: "min",
@@ -26614,24 +27230,24 @@ var y0 = (function(i) {
}, {
key: "step",
value: function(n) {
- return this.__step = n, this.__impliedStep = n, this.__precision = TA(n), this;
+ return this.__step = n, this.__impliedStep = n, this.__precision = og(n), this;
}
}]), e;
-})(Mr);
-function m1(i, e) {
+})(Or);
+function mM(i, e) {
var t = Math.pow(10, e);
return Math.round(i * t) / t;
}
-var Ml = (function(i) {
- zs(e, i);
+var Xl = (function(i) {
+ Js(e, i);
function e(t, n, s) {
- yi(this, e);
- var r = Vs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n, s));
+ Ti(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 m = parseFloat(a.__input.value);
- ue.isNaN(m) || a.setValue(m);
+ var p = parseFloat(a.__input.value);
+ ue.isNaN(p) || a.setValue(p);
}
function l() {
a.__onFinishChange && a.__onFinishChange.call(a, a.getValue());
@@ -26639,90 +27255,90 @@ var Ml = (function(i) {
function h() {
l();
}
- function u(m) {
- var g = o - m.clientY;
- a.setValue(a.getValue() + g * a.__impliedStep), o = m.clientY;
+ 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(m) {
- te.bind(window, "mousemove", u), te.bind(window, "mouseup", d), o = m.clientY;
+ 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(m) {
- m.keyCode === 13 && (a.__truncationSuspended = !0, this.blur(), a.__truncationSuspended = !1, l());
+ 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 wi(e, [{
+ return Ri(e, [{
key: "updateDisplay",
value: function() {
- return this.__input.value = this.__truncationSuspended ? this.getValue() : m1(this.getValue(), this.__precision), Qs(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;
-})(y0);
-function RA(i, e, t, n, s) {
+})(nx);
+function cg(i, e, t, n, s) {
return n + (s - n) * ((i - e) / (t - e));
}
-var Ed = (function(i) {
- zs(e, i);
+var Kd = (function(i) {
+ Js(e, i);
function e(t, n, s, r, a) {
- yi(this, e);
- var o = Vs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n, { min: s, max: r, step: a })), c = o;
+ Ti(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(g) {
- document.activeElement.blur(), te.bind(window, "mousemove", h), te.bind(window, "mouseup", u), h(g);
+ function l(m) {
+ document.activeElement.blur(), te.bind(window, "mousemove", h), te.bind(window, "mouseup", u), h(m);
}
- function h(g) {
- g.preventDefault();
- var A = c.__background.getBoundingClientRect();
- return c.setValue(RA(g.clientX, A.left, A.right, c.__min, c.__max)), !1;
+ 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;
}
function u() {
te.unbind(window, "mousemove", h), te.unbind(window, "mouseup", u), c.__onFinishChange && c.__onFinishChange.call(c, c.getValue());
}
- function d(g) {
- g.touches.length === 1 && (te.bind(window, "touchmove", f), te.bind(window, "touchend", m), f(g));
+ function d(m) {
+ m.touches.length === 1 && (te.bind(window, "touchmove", f), te.bind(window, "touchend", p), f(m));
}
- function f(g) {
- var A = g.touches[0].clientX, p = c.__background.getBoundingClientRect();
- c.setValue(RA(A, p.left, p.right, c.__min, c.__max));
+ 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));
}
- function m() {
- te.unbind(window, "touchmove", f), te.unbind(window, "touchend", m), c.__onFinishChange && c.__onFinishChange.call(c, c.getValue());
+ 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 wi(e, [{
+ return Ri(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);
+ return this.__foreground.style.width = n * 100 + "%", js(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this);
}
}]), e;
-})(y0), w0 = (function(i) {
- zs(e, i);
+})(nx), ix = (function(i) {
+ Js(e, i);
function e(t, n, s) {
- yi(this, e);
- var r = Vs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)), a = r;
+ Ti(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 wi(e, [{
+ return Ri(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;
-})(Mr), _d = (function(i) {
- zs(e, i);
+})(Or), jd = (function(i) {
+ Js(e, i);
function e(t, n) {
- yi(this, e);
- var s = Vs(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n));
- s.__color = new bn(s.getValue()), s.__temp = new bn(0);
+ Ti(this, e);
+ var s = Zs(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(g) {
- g.keyCode === 13 && u.call(this);
+ 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");
@@ -26764,7 +27380,7 @@ var Ed = (function(i) {
width: "100%",
height: "100%",
background: "none"
- }), NA(a, "top", "rgba(0,0,0,0)", "#000"), ue.extend(s.__hue_field.style, {
+ }), lg(a, "top", "rgba(0,0,0,0)", "#000"), ue.extend(s.__hue_field.style, {
width: "15px",
height: "100px",
border: "1px solid #555",
@@ -26772,7 +27388,7 @@ var Ed = (function(i) {
position: "absolute",
top: "3px",
right: "3px"
- }), x1(s.__hue_field), ue.extend(s.__input.style, {
+ }), bM(s.__hue_field), ue.extend(s.__input.style, {
outline: "none",
textAlign: "center",
color: "#fff",
@@ -26780,45 +27396,45 @@ var Ed = (function(i) {
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(g) {
- f(g), te.bind(window, "mousemove", f), te.bind(window, "touchmove", f), te.bind(window, "mouseup", l), te.bind(window, "touchend", l);
+ 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(g) {
- m(g), te.bind(window, "mousemove", m), te.bind(window, "touchmove", m), te.bind(window, "mouseup", h), te.bind(window, "touchend", h);
+ 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", m), te.unbind(window, "touchmove", m), te.unbind(window, "mouseup", h), te.unbind(window, "touchend", h), d();
+ te.unbind(window, "mousemove", p), te.unbind(window, "touchmove", p), te.unbind(window, "mouseup", h), te.unbind(window, "touchend", h), d();
}
function u() {
- var g = xd(this.value);
- g !== !1 ? (r.__color.__state = g, r.setValue(r.__color.toOriginal())) : this.value = r.__color.toString();
+ var m = qd(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(g) {
- g.type.indexOf("touch") === -1 && g.preventDefault();
- var A = r.__saturation_field.getBoundingClientRect(), p = g.touches && g.touches[0] || g, y = p.clientX, b = p.clientY, _ = (y - A.left) / (A.right - A.left), M = 1 - (b - A.top) / (A.bottom - A.top);
- return M > 1 ? M = 1 : M < 0 && (M = 0), _ > 1 ? _ = 1 : _ < 0 && (_ = 0), r.__color.v = M, r.__color.s = _, r.setValue(r.__color.toOriginal()), !1;
+ 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;
}
- function m(g) {
- g.type.indexOf("touch") === -1 && g.preventDefault();
- var A = r.__hue_field.getBoundingClientRect(), p = g.touches && g.touches[0] || g, y = p.clientY, b = 1 - (y - A.top) / (A.bottom - A.top);
- return b > 1 ? b = 1 : b < 0 && (b = 0), r.__color.h = b * 360, 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);
+ return x > 1 ? x = 1 : x < 0 && (x = 0), r.__color.h = x * 360, r.setValue(r.__color.toOriginal()), !1;
}
return s;
}
- return wi(e, [{
+ return Ri(e, [{
key: "updateDisplay",
value: function() {
- var n = xd(this.getValue());
+ var n = qd(this.getValue());
if (n !== !1) {
var s = !1;
- ue.each(bn.COMPONENTS, function(o) {
+ ue.each(vn.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);
@@ -26830,23 +27446,23 @@ var Ed = (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, NA(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, lg(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;
-})(Mr), b1 = ["-moz-", "-o-", "-webkit-", "-ms-", ""];
-function NA(i, e, t, n) {
- i.style.background = "", ue.each(b1, function(s) {
+})(Or), xM = ["-moz-", "-o-", "-webkit-", "-ms-", ""];
+function lg(i, e, t, n) {
+ i.style.background = "", ue.each(xM, function(s) {
i.style.cssText += "background: " + s + "linear-gradient(" + e + ", " + t + " 0%, " + n + " 100%); ";
});
}
-function x1(i) {
+function bM(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 E1 = {
+var EM = {
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);
@@ -26860,7 +27476,7 @@ var E1 = {
} catch {
}
}
-}, _1 = `<div id="dg-save" class="dg dialogue">
+}, _M = `<div id="dg-save" class="dg dialogue">
Here's the new load parameter for your <code>GUI</code>'s constructor:
@@ -26880,16 +27496,16 @@ var E1 = {
</div>
-</div>`, y1 = function(e, t) {
+</div>`, yM = function(e, t) {
var n = e[t];
- return ue.isArray(arguments[2]) || ue.isObject(arguments[2]) ? new A1(e, t, arguments[2]) : ue.isNumber(n) ? ue.isNumber(arguments[2]) && ue.isNumber(arguments[3]) ? ue.isNumber(arguments[4]) ? new Ed(e, t, arguments[2], arguments[3], arguments[4]) : new Ed(e, t, arguments[2], arguments[3]) : ue.isNumber(arguments[4]) ? new Ml(e, t, { min: arguments[2], max: arguments[3], step: arguments[4] }) : new Ml(e, t, { min: arguments[2], max: arguments[3] }) : ue.isString(n) ? new g1(e, t) : ue.isFunction(n) ? new w0(e, t, "") : ue.isBoolean(n) ? new _0(e, t) : null;
+ 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;
};
-function w1(i) {
+function wM(i) {
setTimeout(i, 1e3 / 60);
}
-var v1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || w1, C1 = (function() {
+var vM = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || wM, CM = (function() {
function i() {
- yi(this, i), this.backgroundElement = document.createElement("div"), ue.extend(this.backgroundElement.style, {
+ Ti(this, i), this.backgroundElement = document.createElement("div"), ue.extend(this.backgroundElement.style, {
backgroundColor: "rgba(0,0,0,0.8)",
top: 0,
left: 0,
@@ -26911,7 +27527,7 @@ var v1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || w
e.hide();
});
}
- return wi(i, [{
+ return Ri(i, [{
key: "show",
value: function() {
var t = this;
@@ -26933,26 +27549,26 @@ var v1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || w
this.domElement.style.left = window.innerWidth / 2 - te.getWidth(this.domElement) / 2 + "px", this.domElement.style.top = window.innerHeight / 2 - te.getHeight(this.domElement) / 2 + "px";
}
}]), i;
-})(), S1 = h1(`.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}
+})(), 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}
`);
-E1.inject(S1);
-var FA = "dg", DA = 72, LA = 20, ko = "Default", uo = (function() {
+EM.inject(SM);
+var hg = "dg", ug = 72, dg = 20, Jo = "Default", yo = (function() {
try {
return !!window.localStorage;
} catch {
return !1;
}
-})(), yo = void 0, PA = !0, Zr = void 0, Yh = !1, v0 = [], Dt = function i(e) {
+})(), Do = void 0, fg = !0, ha = void 0, _u = !1, sx = [], 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, FA), 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, hg), 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: ko } : n.preset && (n.load.preset = n.preset), ue.isUndefined(n.parent) && n.hideable && v0.push(this), n.resizable = ue.isUndefined(n.parent) && n.resizable, n.autoPlace && ue.isUndefined(n.scrollable) && (n.scrollable = !0);
- var s = uo && localStorage.getItem($r(this, "isLocal")) === "true", r = void 0, a = void 0;
+ }), 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;
if (Object.defineProperties(
this,
{
@@ -26981,7 +27597,7 @@ var FA = "dg", DA = 72, LA = 20, ko = "Default", uo = (function() {
return t.parent ? t.getRoot().preset : n.load.preset;
},
set: function(d) {
- t.parent ? t.getRoot().preset = d : n.load.preset = d, T1(this), t.revert();
+ t.parent ? t.getRoot().preset = d : n.load.preset = d, TM(this), t.revert();
}
},
width: {
@@ -26989,7 +27605,7 @@ var FA = "dg", DA = 72, LA = 20, ko = "Default", uo = (function() {
return n.width;
},
set: function(d) {
- n.width = d, vd(t, d);
+ n.width = d, Jd(t, d);
}
},
name: {
@@ -27018,14 +27634,14 @@ var FA = "dg", DA = 72, LA = 20, ko = "Default", uo = (function() {
return s;
},
set: function(d) {
- uo && (s = d, d ? te.bind(window, "unload", r) : te.unbind(window, "unload", r), localStorage.setItem($r(t, "isLocal"), d));
+ yo && (s = d, d ? te.bind(window, "unload", r) : te.unbind(window, "unload", r), localStorage.setItem(ua(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), uo && s) {
+ if (this.closed = n.closed || !1, te.addClass(this.domElement, i.CLASS_MAIN), te.makeSelectable(this.domElement, !1), yo && s) {
t.useLocalStorage = !0;
- var o = localStorage.getItem($r(this, "gui"));
+ var o = localStorage.getItem(ua(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() {
@@ -27034,16 +27650,16 @@ var FA = "dg", DA = 72, LA = 20, ko = "Default", uo = (function() {
} else {
n.closed === void 0 && (n.closed = !0);
var c = document.createTextNode(n.name);
- te.addClass(c, "controller-name"), a = Mf(t, c);
+ te.addClass(c, "controller-name"), a = np(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) && (PA && (Zr = document.createElement("div"), te.addClass(Zr, FA), te.addClass(Zr, i.CLASS_AUTO_PLACE_CONTAINER), document.body.appendChild(Zr), PA = !1), Zr.appendChild(this.domElement), te.addClass(this.domElement, i.CLASS_AUTO_PLACE)), this.parent || vd(t, n.width)), this.__resizeHandler = function() {
+ 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() {
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 && B1(this), r = function() {
- uo && localStorage.getItem($r(t, "isLocal")) === "true" && localStorage.setItem($r(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 && BM(this), r = function() {
+ yo && localStorage.getItem(ua(t, "isLocal")) === "true" && localStorage.setItem(ua(t, "gui"), JSON.stringify(t.getSaveObject()));
}, this.saveToLocalStorageIfPossible = r;
function h() {
var u = t.getRoot();
@@ -27053,38 +27669,38 @@ var FA = "dg", DA = 72, LA = 20, ko = "Default", uo = (function() {
}
n.parent || h();
};
-Dt.toggleHide = function() {
- Yh = !Yh, ue.each(v0, function(i) {
- i.domElement.style.display = Yh ? "none" : "";
+kt.toggleHide = function() {
+ _u = !_u, ue.each(sx, function(i) {
+ i.domElement.style.display = _u ? "none" : "";
});
};
-Dt.CLASS_AUTO_PLACE = "a";
-Dt.CLASS_AUTO_PLACE_CONTAINER = "ac";
-Dt.CLASS_MAIN = "main";
-Dt.CLASS_CONTROLLER_ROW = "cr";
-Dt.CLASS_TOO_TALL = "taller-than-window";
-Dt.CLASS_CLOSED = "closed";
-Dt.CLASS_CLOSE_BUTTON = "close-button";
-Dt.CLASS_CLOSE_TOP = "close-top";
-Dt.CLASS_CLOSE_BOTTOM = "close-bottom";
-Dt.CLASS_DRAG = "drag";
-Dt.DEFAULT_WIDTH = 245;
-Dt.TEXT_CLOSED = "Close Controls";
-Dt.TEXT_OPEN = "Open Controls";
-Dt._keydownHandler = function(i) {
- document.activeElement.type !== "text" && (i.which === DA || i.keyCode === DA) && Dt.toggleHide();
+kt.CLASS_AUTO_PLACE = "a";
+kt.CLASS_AUTO_PLACE_CONTAINER = "ac";
+kt.CLASS_MAIN = "main";
+kt.CLASS_CONTROLLER_ROW = "cr";
+kt.CLASS_TOO_TALL = "taller-than-window";
+kt.CLASS_CLOSED = "closed";
+kt.CLASS_CLOSE_BUTTON = "close-button";
+kt.CLASS_CLOSE_TOP = "close-top";
+kt.CLASS_CLOSE_BOTTOM = "close-bottom";
+kt.CLASS_DRAG = "drag";
+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();
};
-te.bind(window, "keydown", Dt._keydownHandler, !1);
+te.bind(window, "keydown", kt._keydownHandler, !1);
ue.extend(
- Dt.prototype,
+ kt.prototype,
{
add: function(e, t) {
- return wo(this, e, t, {
+ return No(this, e, t, {
factoryArgs: Array.prototype.slice.call(arguments, 2)
});
},
addColor: function(e, t) {
- return wo(this, e, t, {
+ return No(this, e, t, {
color: !0
});
},
@@ -27098,24 +27714,24 @@ 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 && Zr.removeChild(this.domElement);
+ this.autoPlace && ha.removeChild(this.domElement);
var e = this;
ue.each(this.__folders, function(t) {
e.removeFolder(t);
- }), te.unbind(window, "keydown", Dt._keydownHandler, !1), kA(this);
+ }), te.unbind(window, "keydown", kt._keydownHandler, !1), pg(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 Dt(t);
+ var n = new kt(t);
this.__folders[e] = n;
- var s = Mf(this, n.domElement);
+ var s = np(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], kA(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);
var t = this;
ue.each(e.__folders, function(n) {
e.removeFolder(n);
@@ -27141,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 - LA < n ? (te.addClass(e.domElement, Dt.CLASS_TOO_TALL), e.__ul.style.height = window.innerHeight - t - LA + "px") : (te.removeClass(e.domElement, Dt.CLASS_TOO_TALL), e.__ul.style.height = "auto");
+ }), 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");
}
e.__resize_handle && ue.defer(function() {
e.__resize_handle.style.height = e.__ul.offsetHeight + "px";
@@ -27151,12 +27767,12 @@ ue.extend(
this.onResize();
}, 50),
remember: function() {
- if (ue.isUndefined(yo) && (yo = new C1(), yo.domElement.innerHTML = _1), this.parent)
+ if (ue.isUndefined(Do) && (Do = new CM(), Do.domElement.innerHTML = _M), 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 && M1(e), e.__rememberedObjects.indexOf(t) === -1 && e.__rememberedObjects.push(t);
- }), this.autoPlace && vd(this, this.width);
+ e.__rememberedObjects.length === 0 && MM(e), e.__rememberedObjects.indexOf(t) === -1 && e.__rememberedObjects.push(t);
+ }), this.autoPlace && Jd(this, this.width);
},
getRoot: function() {
for (var e = this; e.parent; )
@@ -27165,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] = Qc(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] = il(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] = Qc(this), yd(this, !1), this.saveToLocalStorageIfPossible();
+ this.load.remembered || (this.load.remembered = {}), this.load.remembered[this.preset] = il(this), Xd(this, !1), this.saveToLocalStorageIfPossible();
},
saveAs: function(e) {
- this.load.remembered || (this.load.remembered = {}, this.load.remembered[ko] = Qc(this, !0)), this.load.remembered[e] = Qc(this), this.preset = e, wd(this, e, !0), this.saveToLocalStorageIfPossible();
+ 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();
},
revert: function(e) {
ue.each(this.__controllers, function(t) {
- this.getRoot().load.remembered ? C0(e || this.getRoot(), t) : t.setValue(t.initialValue), t.__onFinishChange && t.__onFinishChange.call(t, t.getValue());
+ this.getRoot().load.remembered ? rx(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 || yd(this.getRoot(), !1);
+ }), e || Xd(this.getRoot(), !1);
},
listen: function(e) {
var t = this.__listening.length === 0;
- this.__listening.push(e), t && S0(this.__listening);
+ this.__listening.push(e), t && ax(this.__listening);
},
updateDisplay: function() {
ue.each(this.__controllers, function(e) {
@@ -27195,30 +27811,30 @@ ue.extend(
}
}
);
-function Mf(i, e, t) {
+function np(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 kA(i) {
+function pg(i) {
te.unbind(window, "resize", i.__resizeHandler), i.saveToLocalStorageIfPossible && te.unbind(window, "unload", i.saveToLocalStorageIfPossible);
}
-function yd(i, e) {
+function Xd(i, e) {
var t = i.__preset_select[i.__preset_select.selectedIndex];
e ? t.innerHTML = t.value + "*" : t.innerHTML = t.value;
}
-function I1(i, e, t) {
+function IM(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(), wo(i, t.object, t.property, {
+ return t.remove(), No(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(), wo(i, t.object, t.property, {
+ return t.remove(), No(i, t.object, t.property, {
before: c,
factoryArgs: [a]
});
@@ -27233,8 +27849,8 @@ function I1(i, e, t) {
remove: function() {
return t.__gui.remove(t), t;
}
- }), t instanceof Ed) {
- var n = new Ml(t.object, t.property, { min: t.__min, max: t.__max, step: t.__step });
+ }), t instanceof Kd) {
+ var n = new Xl(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() {
@@ -27242,12 +27858,12 @@ function I1(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 Ml) {
+ } else if (t instanceof Xl) {
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 = wo(i, t.object, t.property, {
+ var l = No(i, t.object, t.property, {
before: t.__li.nextElementSibling,
factoryArgs: [t.__min, t.__max, t.__step]
});
@@ -27256,24 +27872,24 @@ function I1(i, e, t) {
return a;
};
t.min = ue.compose(s, t.min), t.max = ue.compose(s, t.max);
- } else t instanceof _0 ? (te.bind(e, "click", function() {
+ } else t instanceof tx ? (te.bind(e, "click", function() {
te.fakeEvent(t.__checkbox, "click");
}), te.bind(t.__checkbox, "click", function(r) {
r.stopPropagation();
- })) : t instanceof w0 ? (te.bind(e, "click", function() {
+ })) : t instanceof ix ? (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 _d && (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() && yd(i.getRoot(), !0), r;
+ return i.getRoot().__preset_select && t.isModified() && Xd(i.getRoot(), !0), r;
}, t.setValue);
}
-function C0(i, e) {
+function rx(i, e) {
var t = i.getRoot(), n = t.__rememberedObjects.indexOf(e.object);
if (n !== -1) {
var s = t.__rememberedObjectIndecesToControllers[n];
@@ -27281,8 +27897,8 @@ function C0(i, e) {
var r = t.load.remembered, a = void 0;
if (r[i.preset])
a = r[i.preset];
- else if (r[ko])
- a = r[ko];
+ else if (r[Jo])
+ a = r[Jo];
else
return;
if (a[n] && a[n][e.property] !== void 0) {
@@ -27292,35 +27908,35 @@ function C0(i, e) {
}
}
}
-function wo(i, e, t, n) {
+function No(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 _d(e, t);
+ s = new jd(e, t);
else {
var r = [e, t].concat(n.factoryArgs);
- s = y1.apply(i, r);
+ s = yM.apply(i, r);
}
- n.before instanceof Mr && (n.before = n.before.__li), C0(i, s), te.addClass(s.domElement, "c");
+ n.before instanceof Or && (n.before = n.before.__li), rx(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 = Mf(i, o, n.before);
- return te.addClass(c, Dt.CLASS_CONTROLLER_ROW), s instanceof _d ? te.addClass(c, "color") : te.addClass(c, d1(s.getValue())), I1(i, c, s), i.__controllers.push(s), s;
+ 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;
}
-function $r(i, e) {
+function ua(i, e) {
return document.location.href + "." + e;
}
-function wd(i, e, t) {
+function Yd(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 UA(i, e) {
+function Ag(i, e) {
e.style.display = i.useLocalStorage ? "block" : "none";
}
-function M1(i) {
+function MM(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");
@@ -27333,22 +27949,22 @@ function M1(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) {
- wd(i, d, d === i.preset);
- }) : wd(i, ko, !1), te.bind(a, "change", function() {
+ Yd(i, d, d === i.preset);
+ }) : Yd(i, Jo, !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), uo) {
+ }), e.appendChild(a), e.appendChild(t), e.appendChild(n), e.appendChild(s), e.appendChild(r), yo) {
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($r(i, "isLocal")) === "true" && c.setAttribute("checked", "checked"), UA(i, o), te.bind(c, "change", function() {
- i.useLocalStorage = !i.useLocalStorage, UA(i, o);
+ 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);
});
}
var h = document.getElementById("dg-new-constructor");
te.bind(h, "keydown", function(u) {
- u.metaKey && (u.which === 67 || u.keyCode === 67) && yo.hide();
+ u.metaKey && (u.which === 67 || u.keyCode === 67) && Do.hide();
}), te.bind(t, "click", function() {
- h.innerHTML = JSON.stringify(i.getSaveObject(), void 0, 2), yo.show(), h.focus(), h.select();
+ h.innerHTML = JSON.stringify(i.getSaveObject(), void 0, 2), Do.show(), h.focus(), h.select();
}), te.bind(n, "click", function() {
i.save();
}), te.bind(s, "click", function() {
@@ -27358,7 +27974,7 @@ function M1(i) {
i.revert();
});
}
-function B1(i) {
+function BM(i) {
var e = void 0;
i.__resize_handle = document.createElement("div"), ue.extend(i.__resize_handle.style, {
width: "6px",
@@ -27371,17 +27987,17 @@ function B1(i) {
return r.preventDefault(), i.width += e - r.clientX, i.onResize(), e = r.clientX, !1;
}
function n() {
- te.removeClass(i.__closeButton, Dt.CLASS_DRAG), te.unbind(window, "mousemove", t), te.unbind(window, "mouseup", n);
+ te.removeClass(i.__closeButton, kt.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, Dt.CLASS_DRAG), te.bind(window, "mousemove", t), te.bind(window, "mouseup", n), !1;
+ return r.preventDefault(), e = r.clientX, te.addClass(i.__closeButton, kt.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 vd(i, e) {
+function Jd(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 Qc(i, e) {
+function il(i, e) {
var t = {};
return ue.each(i.__rememberedObjects, function(n, s) {
var r = {}, a = i.__rememberedObjectIndecesToControllers[s];
@@ -27390,19 +28006,19 @@ function Qc(i, e) {
}), t[s] = r;
}), t;
}
-function T1(i) {
+function TM(i) {
for (var e = 0; e < i.__preset_select.length; e++)
i.__preset_select[e].value === i.preset && (i.__preset_select.selectedIndex = e);
}
-function S0(i) {
- i.length !== 0 && v1.call(window, function() {
- S0(i);
+function ax(i) {
+ i.length !== 0 && vM.call(window, function() {
+ ax(i);
}), ue.each(i, function(e) {
e.updateDisplay();
});
}
-var R1 = Dt;
-const Gc = [
+var RM = kt;
+const sl = [
{
id: "",
name: "None",
@@ -27426,7 +28042,7 @@ const Gc = [
path: "https://storage.googleapis.com/donmccurdy-static/footprint_court_2k.exr",
format: ".exr"
}
-], N1 = [
+], FM = [
"BN",
"BN",
"BN",
@@ -27683,7 +28299,7 @@ const Gc = [
"L",
"L",
"L"
-], OA = [
+], gg = [
[697, 698, "ON"],
[706, 719, "ON"],
[722, 735, "ON"],
@@ -28399,12 +29015,12 @@ const Gc = [
[1048574, 1048575, "BN"],
[1114110, 1114111, "BN"]
];
-function F1(i) {
+function DM(i) {
if (i <= 255)
- return N1[i];
- let e = 0, t = OA.length - 1;
+ return FM[i];
+ let e = 0, t = gg.length - 1;
for (; e <= t; ) {
- const n = e + t >> 1, s = OA[n];
+ const n = e + t >> 1, s = gg[n];
if (i < s[0]) {
t = n - 1;
continue;
@@ -28417,7 +29033,7 @@ function F1(i) {
}
return "L";
}
-function D1(i) {
+function NM(i) {
const e = i.length;
if (e === 0)
return null;
@@ -28427,13 +29043,13 @@ function D1(i) {
const h = i.charCodeAt(l);
let u = h, d = 1;
if (h >= 55296 && h <= 56319 && l + 1 < e) {
- const m = i.charCodeAt(l + 1);
- m >= 56320 && m <= 57343 && (u = (h - 55296 << 10) + (m - 56320) + 65536, d = 2);
+ const p = i.charCodeAt(l + 1);
+ p >= 56320 && p <= 57343 && (u = (h - 55296 << 10) + (p - 56320) + 65536, d = 2);
}
- const f = F1(u);
+ const f = DM(u);
(f === "R" || f === "AL" || f === "AN") && (n = !0);
- for (let m = 0; m < d; m++)
- t[l + m] = f;
+ for (let p = 0; p < d; p++)
+ t[l + p] = f;
l += d;
}
if (!n)
@@ -28492,8 +29108,8 @@ function D1(i) {
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 g = l; g < h; g++)
- t[g] = f;
+ for (let m = l; m < h; m++)
+ t[m] = f;
l = h - 1;
}
for (let l = 0; l < e; l++)
@@ -28504,8 +29120,8 @@ function D1(i) {
}
return r;
}
-function L1(i, e) {
- const t = D1(i);
+function LM(i, e) {
+ const t = NM(i);
if (t === null)
return null;
const n = new Int8Array(e.length);
@@ -28513,35 +29129,35 @@ function L1(i, e) {
n[s] = t[e[s]];
return n;
}
-const P1 = /[ \t\n\r\f]+/g, k1 = /[\t\n\r\f]| {2,}|^ | $/;
-function U1(i) {
+const PM = /[ \t\n\r\f]+/g, kM = /[\t\n\r\f]| {2,}|^ | $/;
+function UM(i) {
const e = i ?? "normal";
return e === "pre-wrap" ? { mode: e, preserveOrdinarySpaces: !0, preserveHardBreaks: !0 } : { mode: e, preserveOrdinarySpaces: !1, preserveHardBreaks: !1 };
}
-function O1(i) {
- if (!k1.test(i))
+function OM(i) {
+ if (!kM.test(i))
return i;
- let e = i.replace(P1, " ");
+ let e = i.replace(PM, " ");
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 Q1(i) {
+function QM(i) {
return /[\r\f]/.test(i) ? i.replace(/\r\n/g, `
`).replace(/[\r\f]/g, `
`) : i.replace(/\r\n/g, `
`);
}
-let Jh = null, G1;
-function H1() {
- return Jh === null && (Jh = new Intl.Segmenter(G1, { granularity: "word" })), Jh;
+let yu = null, GM;
+function HM() {
+ return yu === null && (yu = new Intl.Segmenter(GM, { granularity: "word" })), yu;
}
-const z1 = new RegExp("\\p{Script=Arabic}", "u"), Kl = new RegExp("\\p{M}", "u"), I0 = new RegExp("\\p{Nd}", "u");
-function QA(i) {
- return z1.test(i);
+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);
}
-function GA(i) {
+function xg(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) {
+function Fr(i) {
for (let e = 0; e < i.length; e++) {
const t = i.charCodeAt(e);
if (!(t < 12288)) {
@@ -28549,39 +29165,39 @@ function _r(i) {
const n = i.charCodeAt(e + 1);
if (n >= 56320 && n <= 57343) {
const s = (t - 55296 << 10) + (n - 56320) + 65536;
- if (GA(s))
+ if (xg(s))
return !0;
e++;
continue;
}
}
- if (GA(t))
+ if (xg(t))
return !0;
}
}
return !1;
}
-function V1(i) {
- const e = Xl(i);
- return e !== null && (Bf.has(e) || yr.has(e));
+function VM(i) {
+ const e = Eh(i);
+ return e !== null && (ip.has(e) || Dr.has(e));
}
-const W1 = /* @__PURE__ */ new Set([
+const WM = /* @__PURE__ */ new Set([
" ",
" ",
"⁠",
"\uFEFF"
]);
-function q1(i) {
- return _r(i);
+function qM(i) {
+ return Fr(i);
}
-function K1(i) {
- const e = Xl(i);
- return e !== null && W1.has(e);
+function KM(i) {
+ const e = Eh(i);
+ return e !== null && WM.has(e);
}
-function j1(i) {
- return !V1(i) && !K1(i);
+function jM(i) {
+ return !VM(i) && !KM(i);
}
-const Bf = /* @__PURE__ */ new Set([
+const ip = /* @__PURE__ */ new Set([
",",
".",
"!",
@@ -28608,7 +29224,7 @@ const Bf = /* @__PURE__ */ new Set([
"ゞ",
"ヽ",
"ヾ"
-]), jl = /* @__PURE__ */ new Set([
+]), bh = /* @__PURE__ */ new Set([
'"',
"(",
"[",
@@ -28627,10 +29243,10 @@ const Bf = /* @__PURE__ */ new Set([
"〖",
"〘",
"〚"
-]), Tf = /* @__PURE__ */ new Set([
+]), sp = /* @__PURE__ */ new Set([
"'",
"’"
-]), yr = /* @__PURE__ */ new Set([
+]), Dr = /* @__PURE__ */ new Set([
".",
",",
"!",
@@ -28657,14 +29273,14 @@ const Bf = /* @__PURE__ */ new Set([
"»",
"›",
"…"
-]), X1 = /* @__PURE__ */ new Set([
+]), XM = /* @__PURE__ */ new Set([
":",
".",
"،",
"؛"
-]), Y1 = /* @__PURE__ */ new Set([
+]), YM = /* @__PURE__ */ new Set([
"၏"
-]), J1 = /* @__PURE__ */ new Set([
+]), JM = /* @__PURE__ */ new Set([
"”",
"’",
"»",
@@ -28677,39 +29293,39 @@ const Bf = /* @__PURE__ */ new Set([
"〕",
")"
]);
-function Z1(i) {
- if (Rf(i))
+function ZM(i) {
+ if (rp(i))
return !0;
let e = !1;
for (const t of i) {
- if (yr.has(t)) {
+ if (Dr.has(t)) {
e = !0;
continue;
}
- if (!(e && Kl.test(t)))
+ if (!(e && xh.test(t)))
return !1;
}
return e;
}
-function $1(i) {
+function $M(i) {
for (const e of i)
- if (!Bf.has(e) && !yr.has(e))
+ if (!ip.has(e) && !Dr.has(e))
return !1;
return i.length > 0;
}
-function eM(i) {
- if (Rf(i))
+function eB(i) {
+ if (rp(i))
return !0;
for (const e of i)
- if (!jl.has(e) && !Tf.has(e) && !Kl.test(e))
+ if (!bh.has(e) && !sp.has(e) && !xh.test(e))
return !1;
return i.length > 0;
}
-function Rf(i) {
+function rp(i) {
let e = !1;
for (const t of i)
- if (!(t === "\\" || Kl.test(t))) {
- if (jl.has(t) || yr.has(t) || Tf.has(t)) {
+ if (!(t === "\\" || xh.test(t))) {
+ if (bh.has(t) || Dr.has(t) || sp.has(t)) {
e = !0;
continue;
}
@@ -28717,7 +29333,7 @@ function Rf(i) {
}
return e;
}
-function M0(i, e) {
+function cx(i, e) {
const t = e - 1;
if (t <= 0)
return Math.max(t, 0);
@@ -28730,22 +29346,22 @@ function M0(i, e) {
const r = i.charCodeAt(s);
return r >= 55296 && r <= 56319 ? s : t;
}
-function Xl(i) {
+function Eh(i) {
if (i.length === 0)
return null;
- const e = M0(i, i.length);
+ const e = cx(i, i.length);
return i.slice(e);
}
-function tM(i) {
+function tB(i) {
const e = Array.from(i);
let t = e.length;
for (; t > 0; ) {
const n = e[t - 1];
- if (Kl.test(n)) {
+ if (xh.test(n)) {
t--;
continue;
}
- if (jl.has(n) || Tf.has(n)) {
+ if (bh.has(n) || sp.has(n)) {
t--;
continue;
}
@@ -28756,10 +29372,10 @@ function tM(i) {
tail: e.slice(t).join("")
};
}
-function nM(i, e, t) {
+function nB(i, e, t) {
return t === "text" && !e && i.length === 1 && i !== "-" && i !== "—" ? i : null;
}
-function HA(i, e, t, n) {
+function bg(i, e, t, n) {
const s = e[n], r = i[n];
if (s == null)
return r;
@@ -28769,32 +29385,32 @@ function HA(i, e, t, n) {
const o = s.repeat(a);
return i[n] = o, o;
}
-function zA(i, e) {
- return i && e !== null && X1.has(e);
+function Eg(i, e) {
+ return i && e !== null && XM.has(e);
}
-function iM(i) {
- const e = Xl(i);
- return e !== null && Y1.has(e);
+function iB(i) {
+ const e = Eh(i);
+ return e !== null && YM.has(e);
}
-function sM(i) {
+function sB(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 Cd(i) {
+function Zd(i) {
let e = i.length;
for (; e > 0; ) {
- const t = M0(i, e), n = i.slice(t, e);
- if (J1.has(n))
+ const t = cx(i, e), n = i.slice(t, e);
+ if (JM.has(n))
return !0;
- if (!yr.has(n))
+ if (!Dr.has(n))
return !1;
e = t;
}
return !1;
}
-function rM(i, e) {
+function rB(i, e) {
if (e.preserveOrdinarySpaces || e.preserveHardBreaks) {
if (i === " ")
return "preserved-space";
@@ -28806,66 +29422,66 @@ function rM(i, e) {
}
return i === " " ? "space" : i === " " || i === " " || i === "⁠" || i === "\uFEFF" ? "glue" : i === "​" ? "zero-width-break" : i === "­" ? "soft-hyphen" : "text";
}
-const aM = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;
-function si(i) {
+const aB = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;
+function di(i) {
return i.length === 1 ? i[0] : i.join("");
}
-function oM(i, e) {
+function oB(i, e) {
const t = [];
for (let n = i.length - 1; n >= 0; n--)
t.push(i[n]);
- return t.push(e), si(t);
+ return t.push(e), di(t);
}
-function cM(i, e, t, n) {
- if (!aM.test(i))
+function cB(i, e, t, n) {
+ if (!aB.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 = rM(h, n), d = u === "text" && e;
+ const u = rB(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: si(a),
+ text: di(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: si(a),
+ text: di(a),
isWordLike: c,
kind: r,
start: o
}), s;
}
-function Sd(i) {
+function $d(i) {
return i === "space" || i === "preserved-space" || i === "zero-width-break" || i === "hard-break";
}
-const lM = /^[A-Za-z][A-Za-z0-9+.-]*:$/;
-function hM(i, e) {
+const lB = /^[A-Za-z][A-Za-z0-9+.-]*:$/;
+function hB(i, e) {
const t = i.texts[e];
- return t.startsWith("www.") ? !0 : lM.test(t) && e + 1 < i.len && i.kinds[e + 1] === "text" && i.texts[e + 1] === "//";
+ return t.startsWith("www.") ? !0 : lB.test(t) && e + 1 < i.len && i.kinds[e + 1] === "text" && i.texts[e + 1] === "//";
}
-function uM(i) {
+function uB(i) {
return i.includes("?") && (i.includes("://") || i.startsWith("www."));
}
-function dM(i) {
+function dB(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" || !hM(i, a))
+ if (n[a] !== "text" || !hB(i, a))
continue;
const o = [e[a]];
let c = a + 1;
- for (; c < i.len && !Sd(n[c]); ) {
+ for (; c < i.len && !$d(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] = si(o);
+ e[a] = di(o);
}
let r = 0;
for (let a = 0; a < e.length; a++) {
@@ -28880,20 +29496,20 @@ function dM(i) {
starts: s
};
}
-function fM(i) {
+function fB(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]), !uM(a))
+ if (e.push(a), t.push(i.isWordLike[r]), n.push(i.kinds[r]), s.push(i.starts[r]), !uB(a))
continue;
const o = r + 1;
- if (o >= i.len || Sd(i.kinds[o]))
+ if (o >= i.len || $d(i.kinds[o]))
continue;
const c = [], l = i.starts[o];
let h = o;
- for (; h < i.len && !Sd(i.kinds[h]); )
+ for (; h < i.len && !$d(i.kinds[h]); )
c.push(i.texts[h]), h++;
- c.length > 0 && (e.push(si(c)), t.push(!0), n.push("text"), s.push(l), r = h - 1);
+ c.length > 0 && (e.push(di(c)), t.push(!0), n.push("text"), s.push(l), r = h - 1);
}
return {
len: e.length,
@@ -28903,7 +29519,7 @@ function fM(i) {
starts: s
};
}
-const pM = /* @__PURE__ */ new Set([
+const pB = /* @__PURE__ */ new Set([
":",
"-",
"/",
@@ -28913,31 +29529,31 @@ const pM = /* @__PURE__ */ new Set([
"+",
"–",
"—"
-]), VA = /^[A-Za-z0-9_]+[,:;]*$/, WA = /[,:;]+$/;
-function B0(i) {
+]), _g = /^[A-Za-z0-9_]+[,:;]*$/, yg = /[,:;]+$/;
+function lx(i) {
for (const e of i)
- if (I0.test(e))
+ if (ox.test(e))
return !0;
return !1;
}
-function Bl(i) {
+function Yl(i) {
if (i.length === 0)
return !1;
for (const e of i)
- if (!(I0.test(e) || pM.has(e)))
+ if (!(ox.test(e) || pB.has(e)))
return !1;
return !0;
}
-function AM(i) {
+function AB(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" && Bl(a) && B0(a)) {
+ if (o === "text" && Yl(a) && lx(a)) {
const c = [a];
let l = r + 1;
- for (; l < i.len && i.kinds[l] === "text" && Bl(i.texts[l]); )
+ for (; l < i.len && i.kinds[l] === "text" && Yl(i.texts[l]); )
c.push(i.texts[l]), l++;
- e.push(si(c)), t.push(!0), n.push("text"), s.push(i.starts[r]), r = l - 1;
+ e.push(di(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]);
@@ -28950,18 +29566,18 @@ function AM(i) {
starts: s
};
}
-function gM(i) {
+function gB(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 && VA.test(a)) {
+ if (o === "text" && c && _g.test(a)) {
const l = [a];
- let h = WA.test(a), u = r + 1;
- for (; h && u < i.len && i.kinds[u] === "text" && i.isWordLike[u] && VA.test(i.texts[u]); ) {
+ 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]); ) {
const d = i.texts[u];
- l.push(d), h = WA.test(d), u++;
+ l.push(d), h = yg.test(d), u++;
}
- e.push(si(l)), t.push(!0), n.push("text"), s.push(i.starts[r]), r = u - 1;
+ e.push(di(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]);
@@ -28974,7 +29590,7 @@ function gM(i) {
starts: s
};
}
-function mM(i) {
+function mB(i) {
const e = [], t = [], n = [], s = [];
for (let r = 0; r < i.len; r++) {
const a = i.texts[r];
@@ -28985,7 +29601,7 @@ function mM(i) {
const h = o[l];
if (!c)
break;
- (h.length === 0 || !B0(h) || !Bl(h)) && (c = !1);
+ (h.length === 0 || !lx(h) || !Yl(h)) && (c = !1);
}
if (c) {
let l = 0;
@@ -29006,7 +29622,7 @@ function mM(i) {
starts: s
};
}
-function bM(i) {
+function xB(i) {
const e = [], t = [], n = [], s = [];
let r = 0;
for (; r < i.len; ) {
@@ -29016,7 +29632,7 @@ function bM(i) {
const h = [a[0]], u = l;
for (r++; r < i.len && i.kinds[r] === "glue"; )
h.push(i.texts[r]), r++;
- const d = si(h);
+ const d = di(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 {
@@ -29030,14 +29646,14 @@ function bM(i) {
const h = [];
for (; r < i.len && i.kinds[r] === "glue"; )
h.push(i.texts[r]), r++;
- const u = si(h);
+ const u = di(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(si(a)), t.push(o), n.push(c), s.push(l);
+ e.push(di(a)), t.push(o), n.push(c), s.push(l);
}
return {
len: e.length,
@@ -29047,12 +29663,12 @@ function bM(i) {
starts: s
};
}
-function xM(i) {
+function bB(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]))
+ if (n[r] !== "text" || n[r + 1] !== "text" || !Fr(e[r]) || !Fr(e[r + 1]))
continue;
- const a = tM(e[r]);
+ const a = tB(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 {
@@ -29063,66 +29679,66 @@ function xM(i) {
starts: s
};
}
-function qA(i, e, t) {
- const n = H1();
+function wg(i, e, t) {
+ const n = HM();
let s = 0;
- const r = [], a = [], o = [], c = [], l = [], h = [], u = [], d = [], f = [], m = [], g = [], A = [];
+ const r = [], a = [], o = [], c = [], l = [], h = [], u = [], d = [], f = [], p = [], m = [], g = [];
for (const w of n.segment(i))
- for (const S of cM(w.segment, w.isWordLike ?? !1, w.index, t)) {
+ for (const S of cB(w.segment, w.isWordLike ?? !1, w.index, t)) {
let O = function() {
- h[D] !== null && (a[D] = [
- HA(r, h, u, D)
- ], h[D] = null), a[D].push(S.text), o[D] = o[D] || S.isWordLike, d[D] = d[D] || v, f[D] = f[D] || F, m[D] = q, g[D] = $, A[D] = zA(f[D], K);
+ 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);
};
- const T = S.kind === "text", C = nM(S.text, S.isWordLike, S.kind), v = _r(S.text), F = QA(S.text), K = Xl(S.text), q = Cd(S.text), $ = iM(S.text), D = s - 1;
- e.carryCJKAfterClosingQuote && T && s > 0 && c[D] === "text" && v && d[D] && m[D] || T && s > 0 && c[D] === "text" && $1(S.text) && d[D] || T && s > 0 && c[D] === "text" && g[D] ? O() : T && s > 0 && c[D] === "text" && S.isWordLike && F && A[D] ? (O(), o[D] = !0) : C !== null && s > 0 && c[D] === "text" && h[D] === C ? u[D] = (u[D] ?? 1) + 1 : T && !S.isWordLike && s > 0 && c[D] === "text" && (Z1(S.text) || S.text === "-" && o[D]) ? 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, m[s] = q, g[s] = $, A[s] = zA(F, K), s++);
+ 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++);
}
for (let w = 0; w < s; w++) {
if (h[w] !== null) {
- r[w] = HA(r, h, u, w);
+ r[w] = bg(r, h, u, w);
continue;
}
- r[w] = si(a[w]);
+ r[w] = di(a[w]);
}
for (let w = 1; w < s; w++)
- c[w] === "text" && !o[w] && Rf(r[w]) && c[w - 1] === "text" && (r[w - 1] += r[w], o[w - 1] = o[w - 1] || o[w], r[w] = "");
- const p = Array.from({ length: s }, () => null);
+ 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] = "");
+ const A = Array.from({ length: s }, () => null);
let y = -1;
for (let w = s - 1; w >= 0; w--) {
const S = r[w];
if (S.length !== 0) {
- if (c[w] === "text" && !o[w] && eM(S) && y >= 0 && c[y] === "text") {
- const T = p[y] ?? [];
- T.push(S), p[y] = T, l[y] = l[w], r[w] = "";
+ 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] = "";
continue;
}
y = w;
}
}
for (let w = 0; w < s; w++) {
- const S = p[w];
- S != null && (r[w] = oM(S, r[w]));
+ const S = A[w];
+ S != null && (r[w] = oB(S, r[w]));
}
- let b = 0;
+ let x = 0;
for (let w = 0; w < s; w++) {
const S = r[w];
- S.length !== 0 && (b !== w && (r[b] = S, o[b] = o[w], c[b] = c[w], l[b] = l[w]), b++);
+ S.length !== 0 && (x !== w && (r[x] = S, o[x] = o[w], c[x] = c[w], l[x] = l[w]), x++);
}
- r.length = b, o.length = b, c.length = b, l.length = b;
- const _ = bM({
- len: b,
+ r.length = x, o.length = x, c.length = x, l.length = x;
+ const E = xB({
+ len: x,
texts: r,
isWordLike: o,
kinds: c,
starts: l
- }), M = xM(gM(mM(AM(fM(dM(_))))));
- for (let w = 0; w < M.len - 1; w++) {
- const S = sM(M.texts[w]);
- S !== null && (M.kinds[w] !== "space" && M.kinds[w] !== "preserved-space" || M.kinds[w + 1] !== "text" || !QA(M.texts[w + 1]) || (M.texts[w] = S.space, M.isWordLike[w] = !1, M.kinds[w] = M.kinds[w] === "preserved-space" ? "preserved-space" : "space", M.texts[w + 1] = S.marks + M.texts[w + 1], M.starts[w + 1] = M.starts[w] + S.space.length));
+ }), 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));
}
- return M;
+ return I;
}
-function EM(i, e) {
+function EB(i, e) {
if (i.len === 0)
return [];
if (!e.preserveHardBreaks)
@@ -29145,26 +29761,26 @@ function EM(i, e) {
consumedEndSegmentIndex: i.len
}), t;
}
-function _M(i) {
+function _B(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(si(r)), t.push(a), n.push("text"), s.push(o), r = null);
+ r !== null && (e.push(di(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], m = i.isWordLike[u], g = i.starts[u];
+ const d = i.texts[u], f = i.kinds[u], p = i.isWordLike[u], m = i.starts[u];
if (f === "text") {
- const A = q1(d), p = j1(d);
+ const g = qM(d), A = jM(d);
if (r !== null && c && l) {
- r.push(d), a = a || m, c = c || A, l = p;
+ r.push(d), a = a || p, c = c || g, l = A;
continue;
}
- h(), r = [d], a = m, o = g, c = A, l = p;
+ h(), r = [d], a = p, o = m, c = g, l = A;
continue;
}
- h(), e.push(d), t.push(m), n.push(f), s.push(g);
+ h(), e.push(d), t.push(p), n.push(f), s.push(m);
}
return h(), {
len: e.length,
@@ -29174,8 +29790,8 @@ function _M(i) {
starts: s
};
}
-function yM(i, e, t = "normal", n = "normal") {
- const s = U1(t), r = s.mode === "pre-wrap" ? Q1(i) : O1(i);
+function yB(i, e, t = "normal", n = "normal") {
+ const s = UM(t), r = s.mode === "pre-wrap" ? QM(i) : OM(i);
if (r.length === 0)
return {
normalized: r,
@@ -29186,75 +29802,75 @@ function yM(i, e, t = "normal", n = "normal") {
kinds: [],
starts: []
};
- const a = n === "keep-all" ? _M(qA(r, e, s)) : qA(r, e, s);
+ const a = n === "keep-all" ? _B(wg(r, e, s)) : wg(r, e, s);
return {
normalized: r,
- chunks: EM(a, s),
+ chunks: EB(a, s),
...a
};
}
-let Xr = null;
-const KA = /* @__PURE__ */ new Map();
-let Yr = null;
-const wM = 96, vM = new RegExp("\\p{Emoji_Presentation}", "u"), CM = /[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;
-let Zh = null;
-const jA = /* @__PURE__ */ new Map();
-function Nf() {
- if (Xr !== null)
- return Xr;
+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;
if (typeof OffscreenCanvas < "u")
- return Xr = new OffscreenCanvas(1, 1).getContext("2d"), Xr;
+ return aa = new OffscreenCanvas(1, 1).getContext("2d"), aa;
if (typeof document < "u")
- return Xr = document.createElement("canvas").getContext("2d"), Xr;
+ return aa = document.createElement("canvas").getContext("2d"), aa;
throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.");
}
-function SM(i) {
- let e = KA.get(i);
- return e || (e = /* @__PURE__ */ new Map(), KA.set(i, e)), e;
+function SB(i) {
+ let e = vg.get(i);
+ return e || (e = /* @__PURE__ */ new Map(), vg.set(i, e)), e;
}
-function Fs(i, e) {
+function Qs(i, e) {
let t = e.get(i);
return t === void 0 && (t = {
- width: Nf().measureText(i).width,
- containsCJK: _r(i)
+ width: ap().measureText(i).width,
+ containsCJK: Fr(i)
}, e.set(i, t)), t;
}
-function Qa() {
- if (Yr !== null)
- return Yr;
+function Xa() {
+ if (oa !== null)
+ return oa;
if (typeof navigator > "u")
- return Yr = {
+ return oa = {
lineFitEpsilon: 5e-3,
carryCJKAfterClosingQuote: !1,
preferPrefixWidthsForBreakableRuns: !1,
preferEarlySoftHyphenBreak: !1
- }, Yr;
+ }, oa;
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 Yr = {
+ return oa = {
lineFitEpsilon: t ? 1 / 64 : 5e-3,
carryCJKAfterClosingQuote: n,
preferPrefixWidthsForBreakableRuns: t,
preferEarlySoftHyphenBreak: t
- }, Yr;
+ }, oa;
}
-function IM(i) {
+function IB(i) {
const e = i.match(/(\d+(?:\.\d+)?)\s*px/);
return e ? parseFloat(e[1]) : 16;
}
-function T0() {
- return Zh === null && (Zh = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Zh;
+function hx() {
+ return wu === null && (wu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), wu;
}
-function MM(i) {
- return vM.test(i) || i.includes("️");
+function MB(i) {
+ return vB.test(i) || i.includes("️");
}
-function BM(i) {
- return CM.test(i);
+function BB(i) {
+ return CB.test(i);
}
-function TM(i, e) {
- let t = jA.get(i);
+function TB(i, e) {
+ let t = Cg.get(i);
if (t !== void 0)
return t;
- const n = Nf();
+ const n = ap();
n.font = i;
const s = n.measureText("😀").width;
if (t = 0, s > e + 0.5 && typeof document < "u" && document.body !== null) {
@@ -29263,25 +29879,25 @@ function TM(i, e) {
const a = r.getBoundingClientRect().width;
document.body.removeChild(r), s - a > 0.5 && (t = s - a);
}
- return jA.set(i, t), t;
+ return Cg.set(i, t), t;
}
-function RM(i) {
+function RB(i) {
let e = 0;
- const t = T0();
+ const t = hx();
for (const n of t.segment(i))
- MM(n.segment) && e++;
+ MB(n.segment) && e++;
return e;
}
-function NM(i, e) {
- return e.emojiCount === void 0 && (e.emojiCount = RM(i)), e.emojiCount;
+function FB(i, e) {
+ return e.emojiCount === void 0 && (e.emojiCount = RB(i)), e.emojiCount;
}
-function dr(i, e, t) {
- return t === 0 ? e.width : e.width - NM(i, e) * t;
+function br(i, e, t) {
+ return t === 0 ? e.width : e.width - FB(i, e) * t;
}
-function FM(i, e, t, n, s) {
+function DB(i, e, t, n, s) {
if (e.breakableFitAdvances !== void 0)
return e.breakableFitAdvances;
- const r = T0(), a = [];
+ const r = hx(), a = [];
for (const h of r.segment(i))
a.push(h.segment);
if (a.length <= 1)
@@ -29289,23 +29905,23 @@ function FM(i, e, t, n, s) {
if (s === "sum-graphemes") {
const h = [];
for (const u of a) {
- const d = Fs(u, t);
- h.push(dr(u, d, n));
+ const d = Qs(u, t);
+ h.push(br(u, d, n));
}
return e.breakableFitAdvances = h, e.breakableFitAdvances;
}
- if (s === "pair-context" || a.length > wM) {
+ if (s === "pair-context" || a.length > wB) {
const h = [];
let u = null, d = 0;
for (const f of a) {
- const m = Fs(f, t), g = dr(f, m, n);
+ const p = Qs(f, t), m = br(f, p, n);
if (u === null)
- h.push(g);
+ h.push(m);
else {
- const A = u + f, p = Fs(A, t);
- h.push(dr(A, p, n) - d);
+ const g = u + f, A = Qs(g, t);
+ h.push(br(g, A, n) - d);
}
- u = f, d = g;
+ u = f, d = m;
}
return e.breakableFitAdvances = h, e.breakableFitAdvances;
}
@@ -29313,18 +29929,18 @@ function FM(i, e, t, n, s) {
let c = "", l = 0;
for (const h of a) {
c += h;
- const u = Fs(c, t), d = dr(c, u, n);
+ const u = Qs(c, t), d = br(c, u, n);
o.push(d - l), l = d;
}
return e.breakableFitAdvances = o, e.breakableFitAdvances;
}
-function DM(i, e) {
- const t = Nf();
+function NB(i, e) {
+ const t = ap();
t.font = i;
- const n = SM(i), s = IM(i), r = e ? TM(i, s) : 0;
+ const n = SB(i), s = IB(i), r = e ? TB(i, s) : 0;
return { cache: n, fontSize: s, emojiCorrection: r };
}
-function LM(i, e) {
+function LB(i, e) {
for (; e < i.widths.length; ) {
const t = i.kinds[e];
if (t !== "space" && t !== "zero-width-break" && t !== "soft-hyphen")
@@ -29333,13 +29949,13 @@ function LM(i, e) {
}
return e;
}
-function R0(i, e) {
+function ux(i, e) {
if (e <= 0)
return 0;
const t = i % e;
return Math.abs(t) <= 1e-6 ? e : e - t;
}
-function N0(i, e, t, n, s) {
+function dx(i, e, t, n, s) {
let r = 0, a = e;
for (; r < i.length; ) {
const o = a + i[r];
@@ -29349,7 +29965,7 @@ function N0(i, e, t, n, s) {
}
return { fitCount: r, fittedWidth: a };
}
-function PM(i, e) {
+function PB(i, e) {
let t = 0, n = i.chunks.length;
for (; t < n; ) {
const s = Math.floor((t + n) / 2);
@@ -29357,7 +29973,7 @@ function PM(i, e) {
}
return t < i.chunks.length ? t : -1;
}
-function F0(i, e, t) {
+function fx(i, e, t) {
let n = t.segmentIndex;
if (t.graphemeIndex > 0)
return e;
@@ -29372,33 +29988,33 @@ function F0(i, e, t) {
}
return s.consumedEndSegmentIndex >= i.widths.length ? -1 : (t.segmentIndex = s.consumedEndSegmentIndex, t.graphemeIndex = 0, e + 1);
}
-function Ff(i, e) {
+function op(i, e) {
if (e.segmentIndex >= i.widths.length)
return -1;
- const t = PM(i, e.segmentIndex);
- return t < 0 ? -1 : F0(i, t, e);
+ const t = PB(i, e.segmentIndex);
+ return t < 0 ? -1 : fx(i, t, e);
}
-function kM(i, e, t) {
+function kB(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 : F0(i, n, t);
+ return n >= i.chunks.length ? -1 : fx(i, n, t);
}
-function UM(i, e) {
- return i.simpleLineWalkFastPath ? D0(i, e) : Df(i, e);
+function UB(i, e) {
+ return i.simpleLineWalkFastPath ? px(i, e) : cp(i, e);
}
-function D0(i, e, t) {
+function px(i, e, t) {
const { widths: n, kinds: s, breakableFitAdvances: r } = i;
if (n.length === 0)
return 0;
- const o = Qa().lineFitEpsilon, c = e + o;
- let l = 0, h = 0, u = !1, d = 0, f = 0, m = 0, g = 0, A = -1, p = 0;
+ const o = Xa().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() {
- A = -1, p = 0;
+ g = -1, A = 0;
}
- function b(C = m, v = g, F = h) {
+ function x(C = p, v = m, F = h) {
l++, t?.({
startSegmentIndex: d,
startGraphemeIndex: f,
@@ -29407,104 +30023,104 @@ function D0(i, e, t) {
width: F
}), h = 0, u = !1, y();
}
- function _(C, v) {
- u = !0, d = C, f = 0, m = C + 1, g = 0, h = v;
+ function E(C, v) {
+ u = !0, d = C, f = 0, p = C + 1, m = 0, h = v;
}
- function M(C, v, F) {
- u = !0, d = C, f = v, m = C, g = v + 1, h = F;
+ function I(C, v, F) {
+ u = !0, d = C, f = v, p = C, m = v + 1, h = F;
}
function w(C, v) {
if (!u) {
- _(C, v);
+ E(C, v);
return;
}
- h += v, m = C + 1, g = 0;
+ 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 ? (b(), M(C, K, q)) : (h += q, m = C, g = K + 1) : M(C, K, q);
+ u ? h + q > c ? (x(), I(C, K, q)) : (h += q, p = C, m = K + 1) : I(C, K, q);
}
- u && m === C && g === F.length && (m = C + 1, g = 0);
+ u && p === C && m === F.length && (p = C + 1, m = 0);
}
let T = 0;
- for (; T < n.length && !(!u && (T = LM(i, T), T >= n.length)); ) {
+ for (; T < n.length && !(!u && (T = LB(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) : _(T, C), F && (A = T + 1, p = h - C), T++;
+ 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), b(T + 1, 0, h - C), T++;
+ w(T, C), x(T + 1, 0, h - C), T++;
continue;
}
- if (A >= 0) {
- if (m > A || m === A && g > 0) {
- b();
+ if (g >= 0) {
+ if (p > g || p === g && m > 0) {
+ x();
continue;
}
- b(A, 0, p);
+ x(g, 0, A);
continue;
}
if (C > e && r[T] !== null) {
- b(), S(T, 0), T++;
+ x(), S(T, 0), T++;
continue;
}
- b();
+ x();
continue;
}
- w(T, C), F && (A = T + 1, p = h - C), T++;
+ w(T, C), F && (g = T + 1, A = h - C), T++;
}
- return u && b(), l;
+ return u && x(), l;
}
-function Df(i, e, t) {
+function cp(i, e, t) {
if (i.simpleLineWalkFastPath)
- return D0(i, e, t);
+ return px(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 = Qa(), d = u.lineFitEpsilon, f = e + d;
- let m = 0, g = 0, A = !1, p = 0, y = 0, b = 0, _ = 0, M = -1, w = 0, S = 0, T = null;
+ 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;
function C() {
- M = -1, w = 0, S = 0, T = null;
+ I = -1, w = 0, S = 0, T = null;
}
- function v(Q = b, J = _, ee = g) {
- m++, t?.({
- startSegmentIndex: p,
+ function v(Q = x, J = E, ee = m) {
+ p++, t?.({
+ startSegmentIndex: A,
startGraphemeIndex: y,
endSegmentIndex: Q,
endGraphemeIndex: J,
width: ee
- }), g = 0, A = !1, C();
+ }), m = 0, g = !1, C();
}
function F(Q, J) {
- A = !0, p = Q, y = 0, b = Q + 1, _ = 0, g = J;
+ g = !0, A = Q, y = 0, x = Q + 1, E = 0, m = J;
}
function K(Q, J, ee) {
- A = !0, p = Q, y = J, b = Q, _ = J + 1, g = ee;
+ g = !0, A = Q, y = J, x = Q, E = J + 1, m = ee;
}
function q(Q, J) {
- if (!A) {
+ if (!g) {
F(Q, J);
return;
}
- g += J, b = Q + 1, _ = 0;
+ m += J, x = Q + 1, E = 0;
}
function $(Q, J, ee, ae) {
if (!J)
return;
const ye = Q === "tab" ? 0 : s[ee], Me = Q === "tab" ? ae : r[ee];
- M = ee + 1, w = g - ae + ye, S = g - ae + Me, T = Q;
+ I = ee + 1, w = m - ae + ye, S = m - ae + Me, T = Q;
}
- function D(Q, J) {
+ function N(Q, J) {
const ee = o[Q];
for (let ae = J; ae < ee.length; ae++) {
const ye = ee[ae];
- A ? g + ye > f ? (v(), K(Q, ae, ye)) : (g += ye, b = Q, _ = ae + 1) : K(Q, ae, ye);
+ g ? m + ye > f ? (v(), K(Q, ae, ye)) : (m += ye, x = Q, E = ae + 1) : K(Q, ae, ye);
}
- A && b === Q && _ === ee.length && (b = Q + 1, _ = 0);
+ g && x === Q && E === ee.length && (x = Q + 1, E = 0);
}
function O(Q) {
if (T !== "soft-hyphen")
@@ -29512,11 +30128,11 @@ function Df(i, e, t) {
const J = o[Q];
if (J == null)
return !1;
- const { fitCount: ee, fittedWidth: ae } = N0(J, g, e, d, c);
- return ee === 0 ? !1 : (g = ae, b = Q, _ = ee, C(), ee === J.length ? (b = Q + 1, _ = 0, !0) : (v(Q, ee, ae + c), D(Q, ee), !0));
+ 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));
}
function Y(Q) {
- m++, t?.({
+ p++, t?.({
startSegmentIndex: Q.startSegmentIndex,
startGraphemeIndex: 0,
endSegmentIndex: Q.consumedEndSegmentIndex,
@@ -29530,22 +30146,22 @@ function Df(i, e, t) {
Y(J);
continue;
}
- A = !1, g = 0, p = J.startSegmentIndex, y = 0, b = J.startSegmentIndex, _ = 0, C();
+ g = !1, m = 0, A = J.startSegmentIndex, y = 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" ? R0(g, l) : n[ee];
+ 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];
if (ae === "soft-hyphen") {
- A && (b = ee + 1, _ = 0, M = ee + 1, w = g + c, S = g + c, T = ae), ee++;
+ g && (x = ee + 1, E = 0, I = ee + 1, w = m + c, S = m + c, T = ae), ee++;
continue;
}
- if (!A) {
- Me > e && o[ee] !== null ? D(ee, 0) : F(ee, Me), $(ae, ye, ee, Me), ee++;
+ if (!g) {
+ Me > e && o[ee] !== null ? N(ee, 0) : F(ee, Me), $(ae, ye, ee, Me), ee++;
continue;
}
- if (g + Me > f) {
- const me = g + (ae === "tab" ? 0 : s[ee]), be = g + (ae === "tab" ? Me : r[ee]);
+ 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(M, 0, S);
+ v(I, 0, S);
continue;
}
if (T === "soft-hyphen" && O(ee)) {
@@ -29553,20 +30169,20 @@ function Df(i, e, t) {
continue;
}
if (ye && me <= f) {
- q(ee, Me), v(ee + 1, 0, be), ee++;
+ q(ee, Me), v(ee + 1, 0, xe), ee++;
continue;
}
- if (M >= 0 && w <= f) {
- if (b > M || b === M && _ > 0) {
+ if (I >= 0 && w <= f) {
+ if (x > I || x === I && E > 0) {
v();
continue;
}
- const xe = M;
- v(xe, 0, S), ee = xe;
+ const be = I;
+ v(be, 0, S), ee = be;
continue;
}
if (Me > e && o[ee] !== null) {
- v(), D(ee, 0), ee++;
+ v(), N(ee, 0), ee++;
continue;
}
v();
@@ -29574,151 +30190,151 @@ function Df(i, e, t) {
}
q(ee, Me), $(ae, ye, ee, Me), ee++;
}
- if (A) {
- const ae = M === J.consumedEndSegmentIndex ? S : g;
+ if (g) {
+ const ae = I === J.consumedEndSegmentIndex ? S : m;
v(J.consumedEndSegmentIndex, 0, ae);
}
}
- return m;
+ return p;
}
-function Lf(i, e, t, n) {
+function lp(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 = Qa(), f = d.lineFitEpsilon, m = n + f;
- let g = 0, A = !1, p = e.segmentIndex, y = e.graphemeIndex, b = -1, _ = 0, M = 0, w = null;
+ 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() {
- b = -1, _ = 0, M = 0, w = null;
+ x = -1, E = 0, I = 0, w = null;
}
- function T(D = p, O = y, Y = g) {
- return A ? (e.segmentIndex = D, e.graphemeIndex = O, Y) : null;
+ function T(N = A, O = y, Y = m) {
+ return g ? (e.segmentIndex = N, e.graphemeIndex = O, Y) : null;
}
- function C(D, O) {
- A = !0, p = D + 1, y = 0, g = O;
+ function C(N, O) {
+ g = !0, A = N + 1, y = 0, m = O;
}
- function v(D, O, Y) {
- A = !0, p = D, y = O + 1, g = Y;
+ function v(N, O, Y) {
+ g = !0, A = N, y = O + 1, m = Y;
}
- function F(D, O) {
- if (!A) {
- C(D, O);
+ function F(N, O) {
+ if (!g) {
+ C(N, O);
return;
}
- g += O, p = D + 1, y = 0;
+ m += O, A = N + 1, y = 0;
}
- function K(D, O, Y, Q) {
+ function K(N, O, Y, Q) {
if (!O)
return;
- const J = D === "tab" ? 0 : a[Y], ee = D === "tab" ? Q : o[Y];
- b = Y + 1, _ = g - Q + J, M = g - Q + ee, w = D;
+ 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(D, O) {
- const Y = l[D];
+ function q(N, O) {
+ const Y = l[N];
for (let Q = O; Q < Y.length; Q++) {
const J = Y[Q];
- if (!A)
- v(D, Q, J);
+ if (!g)
+ v(N, Q, J);
else {
- if (g + J > m)
+ if (m + J > p)
return T();
- g += J, p = D, y = Q + 1;
+ m += J, A = N, y = Q + 1;
}
}
- return A && p === D && y === Y.length && (p = D + 1, y = 0), null;
+ return g && A === N && y === Y.length && (A = N + 1, y = 0), null;
}
- function $(D) {
- if (w !== "soft-hyphen" || b < 0)
+ function $(N) {
+ if (w !== "soft-hyphen" || x < 0)
return null;
- const O = l[D] ?? null;
+ const O = l[N] ?? null;
if (O !== null) {
- const { fitCount: Y, fittedWidth: Q } = N0(O, g, n, f, h);
+ const { fitCount: Y, fittedWidth: Q } = dx(O, m, n, f, h);
if (Y === O.length)
- return g = Q, p = D + 1, y = 0, S(), null;
+ return m = Q, A = N + 1, y = 0, S(), null;
if (Y > 0)
- return T(D, Y, Q + h);
+ return T(N, Y, Q + h);
}
- return _ <= m ? T(b, 0, M) : null;
+ return E <= p ? T(x, 0, I) : 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" ? R0(g, u) : r[D];
+ 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];
if (O === "soft-hyphen" && Q === 0) {
- A && (p = D + 1, y = 0, b = D + 1, _ = g + h, M = g + h, w = O);
+ g && (A = N + 1, y = 0, x = N + 1, E = m + h, I = m + h, w = O);
continue;
}
- if (!A) {
+ if (!g) {
if (Q > 0) {
- const ae = q(D, Q);
+ const ae = q(N, Q);
if (ae !== null)
return ae;
- } else if (J > n && l[D] !== null) {
- const ae = q(D, 0);
+ } else if (J > n && l[N] !== null) {
+ const ae = q(N, 0);
if (ae !== null)
return ae;
} else
- C(D, J);
- K(O, Y, D, J);
+ C(N, J);
+ K(O, Y, N, J);
continue;
}
- if (g + J > m) {
- const ae = g + (O === "tab" ? 0 : a[D]), ye = g + (O === "tab" ? J : o[D]);
- if (w === "soft-hyphen" && d.preferEarlySoftHyphenBreak && _ <= m)
- return T(b, 0, M);
- const Me = $(D);
+ if (m + J > p) {
+ const ae = m + (O === "tab" ? 0 : a[N]), ye = 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 <= m)
- return F(D, J), T(D + 1, 0, ye);
- if (b >= 0 && _ <= m)
- return p > b || p === b && y > 0 ? T() : T(b, 0, M);
- if (J > n && l[D] !== null) {
+ if (Y && ae <= p)
+ return F(N, J), T(N + 1, 0, ye);
+ if (x >= 0 && E <= p)
+ return A > x || A === x && y > 0 ? T() : T(x, 0, I);
+ if (J > n && l[N] !== null) {
const se = T();
if (se !== null)
return se;
- const me = q(D, 0);
+ const me = q(N, 0);
if (me !== null)
return me;
}
return T();
}
- F(D, J), K(O, Y, D, J);
+ F(N, J), K(O, Y, N, J);
}
- return b === s.consumedEndSegmentIndex && y === 0 ? T(s.consumedEndSegmentIndex, 0, M) : T(s.consumedEndSegmentIndex, 0, g);
+ return x === s.consumedEndSegmentIndex && y === 0 ? T(s.consumedEndSegmentIndex, 0, I) : T(s.consumedEndSegmentIndex, 0, m);
}
-function L0(i, e, t) {
- const { widths: n, kinds: s, breakableFitAdvances: r } = i, o = Qa().lineFitEpsilon, c = t + o;
- let l = 0, h = !1, u = e.segmentIndex, d = e.graphemeIndex, f = -1, m = 0;
- for (let g = e.segmentIndex; g < n.length; g++) {
- const A = n[g], p = s[g], y = p === "space" || p === "preserved-space" || p === "tab" || p === "zero-width-break" || p === "soft-hyphen", b = g === e.segmentIndex ? e.graphemeIndex : 0, _ = r[g];
+function Ax(i, e, t) {
+ const { widths: n, kinds: s, breakableFitAdvances: r } = i, o = Xa().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];
if (!h) {
- if (b > 0 || A > t && _ !== null) {
- const M = _, w = M[b];
- h = !0, l = w, u = g, d = b + 1;
- for (let S = b + 1; S < M.length; S++) {
- const T = M[S];
+ 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 = g, d = S + 1;
+ l += T, u = m, d = S + 1;
}
- u === g && d === M.length && (u = g + 1, d = 0);
+ u === m && d === I.length && (u = m + 1, d = 0);
} else
- h = !0, l = A, u = g + 1, d = 0;
- y && (f = g + 1, m = l - A);
+ h = !0, l = g, u = m + 1, d = 0;
+ y && (f = m + 1, p = l - g);
continue;
}
- if (l + A > c)
- return y ? (e.segmentIndex = g + 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, m) : (e.segmentIndex = u, e.graphemeIndex = d, l);
- l += A, u = g + 1, d = 0, y && (f = g + 1, m = l - A);
+ 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 h ? (e.segmentIndex = u, e.graphemeIndex = d, l) : null;
}
-function Id(i, e, t) {
+function ef(i, e, t) {
const n = {
segmentIndex: e.segmentIndex,
graphemeIndex: e.graphemeIndex
- }, s = Ff(i, n);
+ }, s = op(i, n);
if (s < 0)
return null;
- const r = n.segmentIndex, a = n.graphemeIndex, o = i.simpleLineWalkFastPath ? L0(i, n, t) : Lf(i, n, s, t);
+ const r = n.segmentIndex, a = n.graphemeIndex, o = i.simpleLineWalkFastPath ? Ax(i, n, t) : lp(i, n, s, t);
return o === null ? null : {
startSegmentIndex: r,
startGraphemeIndex: a,
@@ -29727,11 +30343,11 @@ function Id(i, e, t) {
width: o
};
}
-function OM(i, e, t) {
- const n = Ff(i, e);
- return n < 0 ? null : i.simpleLineWalkFastPath ? L0(i, e, t) : Lf(i, e, n, t);
+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 QM(i, e) {
+function QB(i, e) {
if (i.widths.length === 0)
return {
lineCount: 0,
@@ -29743,15 +30359,15 @@ function QM(i, e) {
};
let n = 0, s = 0;
if (!i.simpleLineWalkFastPath) {
- let r = Ff(i, t);
+ let r = op(i, t);
for (; r >= 0; ) {
- const a = Lf(i, t, r, e);
+ const a = lp(i, t, r, e);
if (a === null)
return {
lineCount: n,
maxLineWidth: s
};
- n++, a > s && (s = a), r = kM(i, r, t);
+ n++, a > s && (s = a), r = kB(i, r, t);
}
return {
lineCount: n,
@@ -29759,7 +30375,7 @@ function QM(i, e) {
};
}
for (; ; ) {
- const r = OM(i, t, e);
+ const r = OB(i, t, e);
if (r === null)
return {
lineCount: n,
@@ -29768,11 +30384,11 @@ function QM(i, e) {
n++, r > s && (s = r);
}
}
-let $h = null, XA = /* @__PURE__ */ new WeakMap();
-function P0() {
- return $h === null && ($h = new Intl.Segmenter(void 0, { granularity: "grapheme" })), $h;
+let vu = null, Sg = /* @__PURE__ */ new WeakMap();
+function gx() {
+ return vu === null && (vu = new Intl.Segmenter(void 0, { granularity: "grapheme" })), vu;
}
-function GM(i) {
+function GB(i) {
return i ? {
widths: [],
lineEndFitAdvances: [],
@@ -29798,7 +30414,7 @@ function GM(i) {
chunks: []
};
}
-function HM(i, e) {
+function HB(i, e) {
const t = [];
let n = [], s = 0, r = !1, a = !1, o = !1;
function c() {
@@ -29808,20 +30424,20 @@ function HM(i, e) {
}), n = [], r = !1, a = !1, o = !1);
}
function l(u, d, f) {
- n = [u], s = d, r = f, a = Cd(u), o = jl.has(u);
+ n = [u], s = d, r = f, a = Zd(u), o = bh.has(u);
}
function h(u, d) {
n.push(u), r = r || d;
- const f = Cd(u);
- u.length === 1 && yr.has(u) ? a = a || f : a = f, o = !1;
+ const f = Zd(u);
+ u.length === 1 && Dr.has(u) ? a = a || f : a = f, o = !1;
}
- for (const u of P0().segment(i)) {
- const d = u.segment, f = _r(d);
+ for (const u of gx().segment(i)) {
+ const d = u.segment, f = Fr(d);
if (n.length === 0) {
l(d, u.index, f);
continue;
}
- if (o || Bf.has(d) || yr.has(d) || e.carryCJKAfterClosingQuote && f && a) {
+ if (o || ip.has(d) || Dr.has(d) || e.carryCJKAfterClosingQuote && f && a) {
h(d, f);
continue;
}
@@ -29833,80 +30449,80 @@ function HM(i, e) {
}
return c(), t;
}
-function zM(i, e, t, n) {
- const s = Qa(), { cache: r, emojiCorrection: a } = DM(e, BM(i.normalized)), o = dr("-", Fs("-", r), a), l = dr(" ", Fs(" ", r), a) * 8;
+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;
if (i.len === 0)
- return GM(t);
+ return GB(t);
const h = [], u = [], d = [], f = [];
- let m = i.chunks.length <= 1;
- const g = t ? [] : null, A = [], p = t ? [] : null, y = Array.from({ length: i.len });
- function b(S, T, C, v, F, K, q) {
- F !== "text" && F !== "space" && F !== "zero-width-break" && (m = !1), h.push(T), u.push(C), d.push(v), f.push(F), g?.push(K), A.push(q), p !== null && p.push(S);
+ 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);
}
- function _(S, T, C, v, F) {
- const K = Fs(S, r), q = dr(S, K, a), $ = T === "space" || T === "preserved-space" || T === "zero-width-break" ? 0 : q, D = T === "space" || T === "zero-width-break" ? 0 : q;
+ 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) {
let O = "sum-graphemes";
- Bl(S) ? O = "pair-context" : s.preferPrefixWidthsForBreakableRuns && (O = "segment-prefixes");
- const Y = FM(S, K, r, a, O);
- b(S, q, $, D, T, C, Y);
+ 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);
return;
}
- b(S, q, $, D, T, C, null);
+ x(S, q, $, N, 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];
if (v === "soft-hyphen") {
- b(T, 0, o, o, v, F, null);
+ x(T, 0, o, o, v, F, null);
continue;
}
if (v === "hard-break") {
- b(T, 0, 0, 0, v, F, null);
+ x(T, 0, 0, 0, v, F, null);
continue;
}
if (v === "tab") {
- b(T, 0, 0, 0, v, F, null);
+ x(T, 0, 0, 0, v, F, null);
continue;
}
- const K = Fs(T, r);
+ const K = Qs(T, r);
if (v === "text" && K.containsCJK) {
- const $ = HM(T, s);
- for (let D = 0; D < $.length; D++) {
- const O = $[D];
- _(O.text, "text", F + O.start, C, !_r(O.text));
+ 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));
}
continue;
}
- _(T, v, F, C, !0);
+ E(T, v, F, C, !0);
}
- const M = VM(i.chunks, y, h.length), w = g === null ? null : L1(i.normalized, g);
- return p !== null ? {
+ const I = VB(i.chunks, y, h.length), w = m === null ? null : LM(i.normalized, m);
+ return A !== null ? {
widths: h,
lineEndFitAdvances: u,
lineEndPaintAdvances: d,
kinds: f,
- simpleLineWalkFastPath: m,
+ simpleLineWalkFastPath: p,
segLevels: w,
- breakableFitAdvances: A,
+ breakableFitAdvances: g,
discretionaryHyphenWidth: o,
tabStopAdvance: l,
- chunks: M,
- segments: p
+ chunks: I,
+ segments: A
} : {
widths: h,
lineEndFitAdvances: u,
lineEndPaintAdvances: d,
kinds: f,
- simpleLineWalkFastPath: m,
+ simpleLineWalkFastPath: p,
segLevels: w,
- breakableFitAdvances: A,
+ breakableFitAdvances: g,
discretionaryHyphenWidth: o,
tabStopAdvance: l,
- chunks: M
+ chunks: I
};
}
-function VM(i, e, t) {
+function VB(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;
@@ -29918,47 +30534,47 @@ function VM(i, e, t) {
}
return n;
}
-function k0(i, e, t, n) {
- const r = yM(i, Qa(), n?.whiteSpace, "normal");
- return zM(r, e, t);
+function mx(i, e, t, n) {
+ const r = yB(i, Xa(), n?.whiteSpace, "normal");
+ return zB(r, e, t);
}
-function Hc(i, e, t) {
- return k0(i, e, !1, t);
+function rl(i, e, t) {
+ return mx(i, e, !1, t);
}
-function Tl(i, e, t) {
- return k0(i, e, !0, t);
+function Jl(i, e, t) {
+ return mx(i, e, !0, t);
}
-function WM(i, e, t) {
- const n = UM(i, e);
+function WB(i, e, t) {
+ const n = UB(i, e);
return { lineCount: n, height: n * t };
}
-function YA(i, e, t) {
+function Ig(i, e, t) {
let n = t.get(i);
if (n !== void 0)
return n;
n = [];
- const s = P0();
+ const s = gx();
for (const r of s.segment(e[i]))
n.push(r.segment);
return t.set(i, n), n;
}
-function U0(i) {
- let e = XA.get(i);
- return e !== void 0 || (e = /* @__PURE__ */ new Map(), XA.set(i, e)), e;
+function xx(i) {
+ let e = Sg.get(i);
+ return e !== void 0 || (e = /* @__PURE__ */ new Map(), Sg.set(i, e)), e;
}
-function qM(i, e, t, n) {
+function qB(i, e, t, n) {
return n > 0 && i[n - 1] === "soft-hyphen" && !(e === n && t > 0);
}
-function KM(i, e, t, n, s, r, a) {
+function KB(i, e, t, n, s, r, a) {
let o = "";
- const c = qM(e, n, s, r);
+ const c = qB(e, n, s, r);
for (let l = n; l < r; l++)
- e[l] === "soft-hyphen" || e[l] === "hard-break" || (l === n && s > 0 ? o += YA(l, i, t).slice(s).join("") : o += i[l]);
- return a > 0 ? (c && (o += "-"), o += YA(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 += 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;
}
-function O0(i, e, t, n, s, r, a) {
+function bx(i, e, t, n, s, r, a) {
return {
- text: KM(i.segments, i.kinds, e, n, s, r, a),
+ text: KB(i.segments, i.kinds, e, n, s, r, a),
width: t,
start: {
segmentIndex: n,
@@ -29970,10 +30586,10 @@ function O0(i, e, t, n, s, r, a) {
}
};
}
-function jM(i, e, t) {
- return O0(i, e, t.width, t.startSegmentIndex, t.startGraphemeIndex, t.endSegmentIndex, t.endGraphemeIndex);
+function jB(i, e, t) {
+ return bx(i, e, t.width, t.startSegmentIndex, t.startGraphemeIndex, t.endSegmentIndex, t.endGraphemeIndex);
}
-function XM(i) {
+function XB(i) {
return {
width: i.width,
start: {
@@ -29986,76 +30602,76 @@ function XM(i) {
}
};
}
-function YM(i, e) {
- return O0(i, U0(i), e.width, e.start.segmentIndex, e.start.graphemeIndex, e.end.segmentIndex, e.end.graphemeIndex);
+function YB(i, e) {
+ return bx(i, xx(i), e.width, e.start.segmentIndex, e.start.graphemeIndex, e.end.segmentIndex, e.end.graphemeIndex);
}
-function JM(i, e, t) {
- return i.widths.length === 0 ? 0 : Df(i, e, (n) => {
- t(XM(n));
+function JB(i, e, t) {
+ return i.widths.length === 0 ? 0 : cp(i, e, (n) => {
+ t(XB(n));
});
}
-function eu(i, e) {
- return QM(i, e);
+function Cu(i, e) {
+ return QB(i, e);
}
-function JA(i) {
+function Mg(i) {
let e = 0;
- return JM(i, Number.POSITIVE_INFINITY, (t) => {
+ return JB(i, Number.POSITIVE_INFINITY, (t) => {
t.width > e && (e = t.width);
}), e;
}
-function ZM(i, e, t) {
+function ZB(i, e, t) {
const n = [];
if (i.widths.length === 0)
return { lineCount: 0, height: 0, lines: n };
- const s = U0(i), r = Df(i, e, (a) => {
- n.push(jM(i, s, a));
+ const s = xx(i), r = cp(i, e, (a) => {
+ n.push(jB(i, s, a));
});
return { lineCount: r, height: r * t, lines: n };
}
-const $M = /[ \t\n\f\r]+/, ZA = /^[ \t\n\f\r]+/, $A = /[ \t\n\f\r]+$/, hl = { segmentIndex: 0, graphemeIndex: 0 }, Q0 = {
+const $B = /[ \t\n\f\r]+/, Bg = /^[ \t\n\f\r]+/, Tg = /[ \t\n\f\r]+$/, Il = { segmentIndex: 0, graphemeIndex: 0 }, Ex = {
itemIndex: 0,
segmentIndex: 0,
graphemeIndex: 0
};
-function tu(i) {
+function Su(i) {
return {
segmentIndex: i.segmentIndex,
graphemeIndex: i.graphemeIndex
};
}
-function eg(i) {
+function Rg(i) {
return i.segmentIndex === 0 && i.graphemeIndex === 0;
}
-function zc(i, e) {
+function al(i, e) {
const t = e.get(i);
if (t !== void 0)
return t;
- const n = JA(Tl("A A", i)), s = JA(Tl("AA", i)), r = Math.max(0, n - s);
+ const n = Mg(Jl("A A", i)), s = Mg(Jl("AA", i)), r = Math.max(0, n - s);
return e.set(i, r), r;
}
-function eB(i) {
- const e = Id(i, hl, Number.POSITIVE_INFINITY);
+function eT(i) {
+ const e = ef(i, Il, Number.POSITIVE_INFINITY);
return e === null ? null : {
endGraphemeIndex: e.endGraphemeIndex,
endSegmentIndex: e.endSegmentIndex,
width: e.width
};
}
-function tB(i, e) {
+function tT(i, e) {
return i === 0 && e > 0;
}
-function G0(i) {
+function _x(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 = ZA.test(a.text), c = $A.test(a.text), l = a.text.replace(ZA, "").replace($A, "");
+ const a = i[r], o = Bg.test(a.text), c = Tg.test(a.text), l = a.text.replace(Bg, "").replace(Tg, "");
if (l.length === 0) {
- $M.test(a.text) && s === 0 && (s = zc(a.font, n));
+ $B.test(a.text) && s === 0 && (s = al(a.font, n));
continue;
}
- const h = s > 0 ? s : o ? zc(a.font, n) : 0, u = Tl(l, a.font), d = eB(u);
+ const h = s > 0 ? s : o ? al(a.font, n) : 0, u = Jl(l, a.font), d = eT(u);
if (d === null) {
- s = c ? zc(a.font, n) : 0;
+ s = c ? al(a.font, n) : 0;
continue;
}
const f = {
@@ -30068,14 +30684,14 @@ function G0(i) {
prepared: u,
sourceItemIndex: r
};
- e.push(f), t[r] = f, s = c ? zc(a.font, n) : 0;
+ e.push(f), t[r] = f, s = c ? al(a.font, n) : 0;
}
return {
items: e,
itemsBySourceItemIndex: t
};
}
-function nB(i, e, t, n) {
+function nT(i, e, t, n) {
if (i.items.length === 0 || t.itemIndex >= i.items.length)
return null;
const s = Math.max(1, e);
@@ -30086,70 +30702,70 @@ function nB(i, e, t, n) {
};
e: for (; o < i.items.length; ) {
const l = i.items[o];
- if (!eg(c) && c.segmentIndex === l.endSegmentIndex && c.graphemeIndex === l.endGraphemeIndex) {
+ if (!Rg(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 = eg(c);
+ const h = r === 0 ? 0 : l.gapBefore, u = Rg(c);
if (l.break === "never") {
if (!u) {
o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
}
- const g = l.naturalWidth + l.extraWidth, A = h + g;
- if (r > 0 && A > a)
+ const m = l.naturalWidth + l.extraWidth, g = h + m;
+ if (r > 0 && g > a)
break e;
- n?.(l, h, g, tu(hl), {
+ n?.(l, h, m, Su(Il), {
segmentIndex: l.endSegmentIndex,
graphemeIndex: l.endGraphemeIndex
- }), r += A, a = Math.max(0, s - r), o++, c.segmentIndex = 0, c.graphemeIndex = 0;
+ }), 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 g = d + l.naturalWidth;
- if (g <= a) {
- n?.(l, h, l.naturalWidth + l.extraWidth, tu(hl), {
+ const m = d + l.naturalWidth;
+ if (m <= a) {
+ n?.(l, h, l.naturalWidth + l.extraWidth, Su(Il), {
segmentIndex: l.endSegmentIndex,
graphemeIndex: l.endGraphemeIndex
- }), r += g, a = Math.max(0, s - r), o++, c.segmentIndex = 0, c.graphemeIndex = 0;
+ }), r += m, a = Math.max(0, s - r), o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
}
}
- const f = Math.max(1, a - d), m = Id(l.prepared, c, f);
- if (m === null) {
+ const f = Math.max(1, a - d), p = ef(l.prepared, c, f);
+ if (p === null) {
o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
}
- if (c.segmentIndex === m.endSegmentIndex && c.graphemeIndex === m.endGraphemeIndex) {
+ if (c.segmentIndex === p.endSegmentIndex && c.graphemeIndex === p.endGraphemeIndex) {
o++, c.segmentIndex = 0, c.graphemeIndex = 0;
continue;
}
- if (r > 0 && u && h > 0 && tB(m.endSegmentIndex, m.endGraphemeIndex)) {
- const g = Id(l.prepared, hl, Math.max(1, s - l.extraWidth));
- if (g !== null && (g.endSegmentIndex > m.endSegmentIndex || g.endSegmentIndex === m.endSegmentIndex && g.endGraphemeIndex > m.endGraphemeIndex))
+ if (r > 0 && u && h > 0 && tT(p.endSegmentIndex, p.endGraphemeIndex)) {
+ const m = ef(l.prepared, Il, 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, m.width + l.extraWidth, tu(c), {
- segmentIndex: m.endSegmentIndex,
- graphemeIndex: m.endGraphemeIndex
- }), r += h + m.width + l.extraWidth, a = Math.max(0, s - r), m.endSegmentIndex === l.endSegmentIndex && m.endGraphemeIndex === l.endGraphemeIndex) {
+ if (n?.(l, h, p.width + l.extraWidth, Su(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 = m.endSegmentIndex, c.graphemeIndex = m.endGraphemeIndex;
+ 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 iB(i, e, t = Q0) {
+function iT(i, e, t = Ex) {
const n = i, s = {
itemIndex: t.itemIndex,
segmentIndex: t.segmentIndex,
graphemeIndex: t.graphemeIndex
- }, r = [], a = nB(n, e, s, (o, c, l, h, u) => {
+ }, r = [], a = nT(n, e, s, (o, c, l, h, u) => {
r.push({
itemIndex: o.sourceItemIndex,
gapBefore: c,
@@ -30164,14 +30780,14 @@ function iB(i, e, t = Q0) {
end: s
};
}
-function sB(i, e) {
- return YM(i.prepared, {
+function sT(i, e) {
+ return YB(i.prepared, {
width: e.occupiedWidth - i.extraWidth,
start: e.start,
end: e.end
}).text;
}
-function H0(i, e) {
+function yx(i, e) {
const t = i;
return {
fragments: e.fragments.map((n) => {
@@ -30180,24 +30796,24 @@ function H0(i, e) {
throw new Error("Missing rich-text inline item for fragment");
return {
...n,
- text: sB(s, n)
+ text: sT(s, n)
};
}),
width: e.width,
end: e.end
};
}
-function z0(i, e, t) {
- let n = 0, s = Q0;
+function wx(i, e, t) {
+ let n = 0, s = Ex;
for (; ; ) {
- const r = iB(i, e, s);
+ const r = iT(i, e, s);
if (r === null)
return n;
t(r), n++, s = r.end;
}
}
-const tg = "500 14px Inter, sans-serif", nu = "600 10px Inter, sans-serif", iu = "300 13px Inter, sans-serif", ng = "600 10px Inter, sans-serif", ig = "300 12px Inter, sans-serif", so = 18, Vc = 16, sn = 16, Si = 6, sg = 12, Wc = Math.min(window.devicePixelRatio || 1, 2), rB = "rgba(0, 0, 0, 0.75)", aB = "rgba(255, 255, 255, 0.08)", oB = "rgba(255, 255, 255, 0.9)", cB = "rgba(255, 255, 255, 0.30)", lB = "rgba(255, 255, 255, 0.85)", rg = "rgba(255, 255, 255, 0.08)", hB = "rgba(255, 255, 255, 0.45)", uB = "rgba(255, 255, 255, 0.08)", dB = "rgba(255, 255, 255, 0.7)";
-function fB(i) {
+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) {
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;
@@ -30224,29 +30840,29 @@ function fB(i) {
hasMorphs: c
};
}
-function ro(i) {
+function Ao(i) {
return i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString();
}
-function pB(i, e) {
+function pT(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 AB(i, e, t) {
- const n = fB(e), s = pB(n, t), r = [
- { label: "MESHES", value: ro(n.meshes) },
- { label: "VERTICES", value: ro(n.vertices) },
- { label: "TRIANGLES", value: ro(n.triangles) },
- { label: "MATERIALS", value: ro(n.materials) },
- { label: "TEXTURES", value: ro(n.textures) }
+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) }
];
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 = Hc("Model Info", tg), l = WM(c, o, so + 2), h = r.map((w) => {
+ const o = 200, c = rl("Model Info", Fg), l = WB(c, o, po + 2), h = r.map((w) => {
const S = [
- { text: w.label + " ", font: nu },
- { text: w.value, font: iu }
- ], T = G0(S), C = Hc(w.label, nu), v = eu(C, o), F = Hc(w.value, iu), K = eu(F, o);
+ { 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);
return {
...w,
labelWidth: v.maxLineWidth,
@@ -30254,112 +30870,112 @@ function AB(i, e, t) {
richPrepared: T
};
}), u = a.map((w) => {
- const S = Hc(w, ng), T = eu(S, 300);
- return { text: w, width: T.maxLineWidth + sg };
+ const S = rl(w, Dg), T = Cu(S, 300);
+ return { text: w, width: T.maxLineWidth + Lg };
});
let d = [], f = 0;
if (s) {
- const w = Tl(s, ig), S = ZM(w, o - sn, so);
+ const w = Jl(s, Ng), S = ZB(w, o - hn, po);
d = S.lines, f = S.height;
}
- const m = Math.max(
- l.width + sn * 2,
- ...h.map((w) => w.labelWidth + w.valueWidth + sn * 3)
- ), g = Math.max(m, 180);
- let A = 0;
+ const p = Math.max(
+ l.width + hn * 2,
+ ...h.map((w) => w.labelWidth + w.valueWidth + hn * 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 > g - sn * 2 && (S++, w = 0), w += T.width + 6;
- }), A = S * (Vc + 6) + Si;
- }
- const p = sn + l.height + Si + // title
- Si + // separator
- h.length * (so + Si) + // stat rows
- A + // chips
- (f > 0 ? Si + f : 0) + // description
- sn, y = document.createElement("canvas");
- y.width = g * Wc, y.height = p * Wc, y.style.width = g + "px", y.style.height = p + "px";
- const b = y.getContext("2d");
- b.scale(Wc, Wc), b.fillStyle = rB, su(b, 0, 0, g, p, 10), b.fill(), b.strokeStyle = aB, b.lineWidth = 1, su(b, 0.5, 0.5, g - 1, p - 1, 10), b.stroke();
- let _ = sn;
- if (b.font = tg, b.fillStyle = oB, b.textBaseline = "top", b.fillText("Model Info", sn, _), _ += l.height + Si, b.strokeStyle = rg, b.beginPath(), b.moveTo(sn, _), b.lineTo(g - sn, _), b.stroke(), _ += Si, h.forEach((w) => {
- b.font = nu, b.fillStyle = cB, b.textAlign = "left", b.fillText(w.label, sn, _), b.font = iu, b.fillStyle = lB, b.textAlign = "right", b.fillText(w.value, g - sn, _), b.textAlign = "left", _ += so + Si;
+ w > 0 && w + T.width > m - hn * 2 && (S++, w = 0), w += T.width + 6;
+ }), g = S * (ol + 6) + Ni;
+ }
+ const A = hn + l.height + Ni + // title
+ Ni + // separator
+ h.length * (po + Ni) + // stat rows
+ g + // 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();
+ 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;
}), u.length > 0) {
- let w = sn;
+ let w = hn;
u.forEach((S) => {
- w > sn && w + S.width > g - sn && (w = sn, _ += Vc + 6), b.fillStyle = uB, su(b, w, _, S.width, Vc, 4), b.fill(), b.font = ng, b.fillStyle = dB, b.textBaseline = "top", b.fillText(S.text, w + sg / 2, _ + 3), w += S.width + 6;
- }), _ += Vc + Si + 4;
+ 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;
}
- d.length > 0 && (b.strokeStyle = rg, b.beginPath(), b.moveTo(sn, _), b.lineTo(g - sn, _), b.stroke(), _ += Si, b.font = ig, b.fillStyle = hB, b.textBaseline = "top", d.forEach((w) => {
- b.fillText(w.text, sn, _), _ += so;
+ 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;
}));
- const M = document.createElement("div");
- return M.classList.add("model-info"), M.appendChild(y), i.appendChild(M), {
- el: M,
+ const I = document.createElement("div");
+ return I.classList.add("model-info"), I.appendChild(y), i.appendChild(I), {
+ el: I,
canvas: y,
remove() {
- M.remove();
+ I.remove();
}
};
}
-function su(i, e, t, n, s, r) {
+function Bu(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 gB = "500 11px Inter, sans-serif", ag = "300 10px Inter, sans-serif", Md = 10, V0 = 6, W0 = 14, qc = Math.min(window.devicePixelRatio || 1, 2), mB = 8;
-function bB(i) {
+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 e = [];
return i.traverse((t) => {
- if (e.length >= mB || !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: gB }
+ { text: t.name, font: gT }
];
- r > 0 && o.push({ text: " " + EB(r) + " verts", font: ag }), a && o.push({ text: " " + a, font: ag });
- const c = G0(o);
+ r > 0 && o.push({ text: " " + ET(r) + " verts", font: kg }), a && o.push({ text: " " + a, font: kg });
+ const c = _x(o);
let l = 0, h = 0;
- z0(c, 300, (g) => {
- const A = H0(c, g);
- l = Math.max(l, A.width), h++;
+ wx(c, 300, (m) => {
+ const g = yx(c, m);
+ l = Math.max(l, g.width), h++;
});
- const u = l + Md * 2, d = h * W0 + V0 * 2;
+ const u = l + tf * 2, d = h * Cx + vx * 2;
n && n.computeBoundingBox();
- const f = n ? n.boundingBox : null, m = new H();
- f ? (f.getCenter(m), m.applyMatrix4(t.matrixWorld)) : t.getWorldPosition(m), e.push({
+ 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: m,
+ position: p,
vertCount: r,
matType: a
});
}), e;
}
-function xB(i) {
+function bT(i) {
const { labelWidth: e, labelHeight: t, items: n, prepared: s } = i, r = document.createElement("canvas");
- r.width = e * qc, r.height = t * qc, r.style.width = e + "px", r.style.height = t + "px";
+ r.width = e * ll, r.height = t * ll, r.style.width = e + "px", r.style.height = t + "px";
const a = r.getContext("2d");
- a.scale(qc, qc), a.fillStyle = "rgba(0, 0, 0, 0.8)", og(a, 0, 0, e, t, 6), a.fill(), a.strokeStyle = "rgba(255, 255, 255, 0.1)", a.lineWidth = 1, og(a, 0.5, 0.5, e - 1, t - 1, 6), a.stroke(), a.textBaseline = "top";
- let o = V0;
- return z0(s, e - Md * 2, (c) => {
- const l = H0(s, c);
- let h = Md;
+ 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;
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 += W0;
+ }), o += Cx;
}), r;
}
-function EB(i) {
+function ET(i) {
return i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString();
}
-function og(i, e, t, n, s, r) {
+function Ug(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 ru = /* @__PURE__ */ new WeakMap();
-class _B extends ps {
+const Tu = /* @__PURE__ */ new WeakMap();
+class _T extends fi {
/**
* Constructs a new Draco loader.
*
@@ -30416,7 +31032,7 @@ class _B extends ps {
* @param {onErrorCallback} onError - Executed when errors occur.
*/
load(e, t, n, s) {
- const r = new Ps(this.manager);
+ 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);
@@ -30430,10 +31046,10 @@ class _B extends ps {
*/
parse(e, t, n = () => {
}) {
- this.decodeDracoFile(e, t, null, null, Kt, n).catch(n);
+ this.decodeDracoFile(e, t, null, null, yt, n).catch(n);
}
//
- decodeDracoFile(e, t, n, s, r = ln, a = () => {
+ decodeDracoFile(e, t, n, s, r = An, a = () => {
}) {
const o = {
attributeIDs: n || this.defaultAttributeIDs,
@@ -30445,8 +31061,8 @@ class _B extends ps {
}
decodeGeometry(e, t) {
const n = JSON.stringify(t);
- if (ru.has(e)) {
- const c = ru.get(e);
+ if (Tu.has(e)) {
+ const c = Tu.get(e);
if (c.key === n)
return c.promise;
if (e.byteLength === 0)
@@ -30460,28 +31076,28 @@ class _B extends ps {
}))).then((c) => this._createGeometry(c.geometry));
return o.catch(() => !0).then(() => {
s && r && this._releaseTask(s, r);
- }), ru.set(e, {
+ }), Tu.set(e, {
key: n,
promise: o
}), o;
}
_createGeometry(e) {
- const t = new Hn();
- e.index && t.setIndex(new _n(e.index.array, 1));
+ const t = new Tn();
+ e.index && t.setIndex(new Bn(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 _n(a, o);
+ const s = e.attributes[n], r = s.name, a = s.array, o = s.itemSize, c = new Bn(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 !== Kt) return;
- const n = new je();
+ if (t !== yt) return;
+ const n = new Le();
for (let s = 0, r = e.count; s < r; s++)
- n.fromBufferAttribute(e, s), mt.toWorkingColorSpace(n, Kt), e.setXYZ(s, n.r, n.g, n.b);
+ n.fromBufferAttribute(e, s), rt.toWorkingColorSpace(n, yt), e.setXYZ(s, n.r, n.g, n.b);
}
_loadLibrary(e, t) {
- const n = new Ps(this.manager);
+ 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);
});
@@ -30495,7 +31111,7 @@ class _B extends ps {
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 = yB.toString(), a = [
+ const r = yT.toString(), a = [
"/* draco decoder */",
s,
"",
@@ -30543,7 +31159,7 @@ class _B extends ps {
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
}
}
-function yB() {
+function yT() {
let i, e;
onmessage = function(a) {
const o = a.data;
@@ -30560,8 +31176,8 @@ function yB() {
e.then((h) => {
const u = h.draco, d = new u.Decoder();
try {
- const f = t(u, d, new Int8Array(c), l), m = f.attributes.map((g) => g.array.buffer);
- f.index && m.push(f.index.array.buffer), self.postMessage({ type: "decode", id: o.id, geometry: f }, m);
+ 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 {
@@ -30574,29 +31190,29 @@ function yB() {
function t(a, o, c, l) {
const h = l.attributeIDs, u = l.attributeTypes;
let d, f;
- const m = o.GetEncodedGeometryType(c);
- if (m === a.TRIANGULAR_MESH)
+ const p = o.GetEncodedGeometryType(c);
+ if (p === a.TRIANGULAR_MESH)
d = new a.Mesh(), f = o.DecodeArrayToMesh(c, c.byteLength, d);
- else if (m === a.POINT_CLOUD)
+ 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 g = { index: null, attributes: [] };
- for (const A in h) {
- const p = self[u[A]];
- let y, b;
+ const m = { index: null, attributes: [] };
+ for (const g in h) {
+ const A = self[u[g]];
+ let y, x;
if (l.useUniqueIDs)
- b = h[A], y = o.GetAttributeByUniqueId(d, b);
+ x = h[g], y = o.GetAttributeByUniqueId(d, x);
else {
- if (b = o.GetAttributeId(d, a[h[A]]), b === -1) continue;
- y = o.GetAttribute(d, b);
+ if (x = o.GetAttributeId(d, a[h[g]]), x === -1) continue;
+ y = o.GetAttribute(d, x);
}
- const _ = s(a, o, d, A, p, y);
- A === "color" && (_.vertexColorSpace = l.vertexColorSpace), g.attributes.push(_);
+ const E = s(a, o, d, g, A, y);
+ g === "color" && (E.vertexColorSpace = l.vertexColorSpace), m.attributes.push(E);
}
- return m === a.TRIANGULAR_MESH && (g.index = n(a, o, d)), a.destroy(d), g;
+ 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);
@@ -30605,10 +31221,10 @@ function yB() {
return a._free(d), { array: f, itemSize: 1 };
}
function s(a, o, c, l, h, u) {
- const d = u.num_components(), m = c.num_points() * d, g = m * h.BYTES_PER_ELEMENT, A = r(a, h), p = a._malloc(g);
- o.GetAttributeDataArrayForAllPoints(c, u, A, g, p);
- const y = new h(a.HEAPF32.buffer, p, m).slice();
- return a._free(p), {
+ 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();
+ return a._free(A), {
name: l,
array: y,
itemSize: d
@@ -30633,7 +31249,7 @@ function yB() {
}
}
}
-class wB {
+class wT {
/**
* Constructs a new Worker pool.
*
@@ -30699,13 +31315,13 @@ class wB {
this.workers.forEach((e) => e.terminate()), this.workersResolve.length = 0, this.workers.length = 0, this.queue.length = 0, this.workerStatus = 0;
}
}
-const vB = 0, cg = 2, CB = 1, lg = 2, SB = 0, IB = 1, MB = 10, BB = 0, q0 = 9, K0 = 15, j0 = 16, X0 = 22, Y0 = 37, J0 = 43, Z0 = 76, $0 = 83, eb = 97, tb = 100, nb = 103, ib = 109, sb = 165, rb = 166, Pf = 1000066e3;
-class TB {
+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 {
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 ao {
+class go {
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;
}
@@ -30744,69 +31360,69 @@ class ao {
return s < e && this._offset++, new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + n, s);
}
}
-const Sn = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
-function hg(i) {
+const Nn = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
+function Gg(i) {
return new TextDecoder().decode(i);
}
-function RB(i) {
- const e = new Uint8Array(i.buffer, i.byteOffset, Sn.length);
- if (e[0] !== Sn[0] || e[1] !== Sn[1] || e[2] !== Sn[2] || e[3] !== Sn[3] || e[4] !== Sn[4] || e[5] !== Sn[5] || e[6] !== Sn[6] || e[7] !== Sn[7] || e[8] !== Sn[8] || e[9] !== Sn[9] || e[10] !== Sn[10] || e[11] !== Sn[11]) throw new Error("Missing KTX 2.0 identifier.");
- const t = new TB(), n = 17 * Uint32Array.BYTES_PER_ELEMENT, s = new ao(i, Sn.length, n, !0);
+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);
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 ao(i, Sn.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 go(i, Nn.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 ao(i, a, o, !0), m = { 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: [] }, g = (m.descriptorBlockSize / 4 - 6) / 4;
- for (let Y = 0; Y < g; Y++) {
+ 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;
+ 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()), m.samples[Y] = Q;
- }
- t.dataFormatDescriptor.length = 0, t.dataFormatDescriptor.push(m);
- const A = new ao(i, c, l, !0);
- for (; A._offset < l; ) {
- const Y = A._nextUint32(), Q = A._scan(Y), J = hg(Q);
- if (t.keyValue[J] = A._nextUint8Array(Y - Q.byteLength - 1), J.match(/^ktx/i)) {
- const ee = hg(t.keyValue[J]);
+ 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);
+ for (; g._offset < l; ) {
+ const Y = g._nextUint32(), Q = g._scan(Y), J = Gg(Q);
+ if (t.keyValue[J] = g._nextUint8Array(Y - Q.byteLength - 1), J.match(/^ktx/i)) {
+ const ee = Gg(t.keyValue[J]);
t.keyValue[J] = ee.substring(0, ee.lastIndexOf("\0"));
}
- A._skip(Y % 4 ? 4 - Y % 4 : 0);
+ g._skip(Y % 4 ? 4 - Y % 4 : 0);
}
if (u <= 0) return t;
- const p = new ao(i, h, u, !0), y = p._nextUint16(), b = p._nextUint16(), _ = p._nextUint32(), M = p._nextUint32(), w = p._nextUint32(), S = p._nextUint32(), T = [];
- for (let Y = 0; Y < r; Y++) T.push({ imageFlags: p._nextUint32(), rgbSliceByteOffset: p._nextUint32(), rgbSliceByteLength: p._nextUint32(), alphaSliceByteOffset: p._nextUint32(), alphaSliceByteLength: p._nextUint32() });
- const C = h + p._offset, v = C + _, F = v + M, K = F + w, q = new Uint8Array(i.buffer, i.byteOffset + C, _), $ = new Uint8Array(i.buffer, i.byteOffset + v, M), D = new Uint8Array(i.buffer, i.byteOffset + F, w), O = new Uint8Array(i.buffer, i.byteOffset + K, S);
- return t.globalData = { endpointCount: y, selectorCount: b, imageDescs: T, endpointsData: q, selectorsData: $, tablesData: D, extendedData: O }, t;
-}
-let au, ji, Bd;
-const ou = { env: { emscripten_notify_memory_growth: function(i) {
- Bd = new Uint8Array(ji.exports.memory.buffer);
+ 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 = [];
+ 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;
+}
+let Ru, es, nf;
+const Fu = { env: { emscripten_notify_memory_growth: function(i) {
+ nf = new Uint8Array(es.exports.memory.buffer);
} } };
-class NB {
+class FT {
init() {
- return au || (au = typeof fetch < "u" ? fetch("data:application/wasm;base64," + ug).then((e) => e.arrayBuffer()).then((e) => WebAssembly.instantiate(e, ou)).then(this._init) : WebAssembly.instantiate(Buffer.from(ug, "base64"), ou).then(this._init), au);
+ 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);
}
_init(e) {
- ji = e.instance, ou.env.emscripten_notify_memory_growth(0);
+ es = e.instance, Fu.env.emscripten_notify_memory_growth(0);
}
decode(e, t = 0) {
- if (!ji) throw new Error("ZSTDDecoder: Await .init() before decoding.");
- const n = e.byteLength, s = ji.exports.malloc(n);
- Bd.set(e, s), t = t || Number(ji.exports.ZSTD_findDecompressedSize(s, n));
- const r = ji.exports.malloc(t), a = ji.exports.ZSTD_decompress(r, t, s, n), o = Bd.slice(r, r + a);
- return ji.exports.free(s), ji.exports.free(r), o;
+ 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);
+ return es.exports.free(s), es.exports.free(r), o;
}
}
-const ug = "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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/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", FB = "display-p3", DB = "display-p3-linear", cu = /* @__PURE__ */ new WeakMap();
-let lu = 0, hu;
-class ei extends ps {
+const Hg = "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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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", DT = "display-p3", NT = "display-p3-linear", Du = /* @__PURE__ */ new WeakMap();
+let Nu = 0, Lu;
+class oi extends fi {
/**
* Constructs a new KTX2 loader.
*
* @param {LoadingManager} [manager] - The loading manager.
*/
constructor(e) {
- super(e), this.transcoderPath = "", this.transcoderBinary = null, this.transcoderPending = null, this.workerPool = new wB(), this.workerSourceURL = "", this.workerConfig = null, typeof MSC_TRANSCODER < "u" && console.warn(
+ 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(
'THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'
);
}
@@ -30879,18 +31495,18 @@ class ei extends ps {
// TODO: Make this method private
init() {
if (!this.transcoderPending) {
- const e = new Ps(this.manager);
+ const e = new As(this.manager);
e.setPath(this.transcoderPath), e.setWithCredentials(this.withCredentials);
- const t = e.loadAsync("basis_transcoder.js"), n = new Ps(this.manager);
+ 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 = ei.BasisWorker.toString(), c = [
+ const o = oi.BasisWorker.toString(), c = [
"/* constants */",
- "let _EngineFormat = " + JSON.stringify(ei.EngineFormat),
- "let _EngineType = " + JSON.stringify(ei.EngineType),
- "let _TranscoderFormat = " + JSON.stringify(ei.TranscoderFormat),
- "let _BasisFormat = " + JSON.stringify(ei.BasisFormat),
+ "let _EngineFormat = " + JSON.stringify(oi.EngineFormat),
+ "let _EngineType = " + JSON.stringify(oi.EngineType),
+ "let _TranscoderFormat = " + JSON.stringify(oi.TranscoderFormat),
+ "let _BasisFormat = " + JSON.stringify(oi.BasisFormat),
"/* basis_transcoder.js */",
r,
"/* worker */",
@@ -30901,9 +31517,9 @@ class ei extends ps {
const l = new Worker(this.workerSourceURL), h = this.transcoderBinary.slice(0);
return l.postMessage({ type: "init", config: this.workerConfig, transcoderBinary: h }, [h]), l;
});
- }), lu > 0 && console.warn(
+ }), Nu > 0 && console.warn(
"THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."
- ), lu++;
+ ), Nu++;
}
return this.transcoderPending;
}
@@ -30919,7 +31535,7 @@ class ei extends ps {
load(e, t, n, s) {
if (this.workerConfig === null)
throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
- const r = new Ps(this.manager);
+ const r = new As(this.manager);
r.setResponseType("arraybuffer"), r.setWithCredentials(this.withCredentials), r.load(e, (a) => {
this.parse(a, t, s);
}, n, s);
@@ -30935,8 +31551,8 @@ class ei extends ps {
parse(e, t, n) {
if (this.workerConfig === null)
throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
- if (cu.has(e))
- return cu.get(e).promise.then(t).catch(n);
+ if (Du.has(e))
+ return Du.get(e).promise.then(t).catch(n);
this._createTexture(e).then((s) => t ? t(s) : null).catch(n);
}
_createTextureFrom(e, t) {
@@ -30944,12 +31560,12 @@ class ei extends ps {
if (n === "error") return Promise.reject(s);
let u;
if (t.faceCount === 6)
- u = new j_(r, c, l);
+ u = new Ry(r, c, l);
else {
const d = r[0].mipmaps;
- u = t.layerCount > 1 ? new K_(d, a, o, t.layerCount, c, l) : new Vl(d, a, o, c, l);
+ u = t.layerCount > 1 ? new Ty(d, a, o, t.layerCount, c, l) : new Ah(d, a, o, c, l);
}
- return u.minFilter = r[0].mipmaps.length === 1 ? qt : ii, u.magFilter = qt, u.generateMipmaps = !1, u.needsUpdate = !0, u.colorSpace = ab(t), u.premultiplyAlpha = !!(h & CB), u;
+ 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;
}
/**
* @private
@@ -30958,26 +31574,26 @@ class ei extends ps {
* @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
*/
async _createTexture(e, t = {}) {
- const n = RB(new Uint8Array(e)), s = n.vkFormat === Pf && n.dataFormatDescriptor[0].colorModel === 167;
- if (!(n.vkFormat === BB || s && !this.workerConfig.astcHDRSupported))
- return PB(n);
+ 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 a = t, o = this.init().then(() => this.workerPool.postMessage({ type: "transcode", buffer: e, taskConfig: a }, [e])).then((c) => this._createTextureFrom(c.data, n));
- return cu.set(e, { promise: o }), o;
+ return Du.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), lu--;
+ this.workerPool.dispose(), this.workerSourceURL && URL.revokeObjectURL(this.workerSourceURL), Nu--;
}
}
-ei.BasisFormat = {
+oi.BasisFormat = {
ETC1S: 0,
UASTC: 1,
UASTC_HDR: 2
};
-ei.TranscoderFormat = {
+oi.TranscoderFormat = {
ETC1: 0,
ETC2: 1,
BC1: 2,
@@ -30999,94 +31615,94 @@ ei.TranscoderFormat = {
RGB_HALF: 24,
RGBA_HALF: 25
};
-ei.EngineFormat = {
- RGBAFormat: on,
- RGBA_ASTC_4x4_Format: Ro,
- RGB_BPTC_UNSIGNED_Format: _l,
- RGBA_BPTC_Format: bo,
- RGBA_ETC2_EAC_Format: El,
- RGBA_PVRTC_4BPPV1_Format: ml,
- RGBA_S3TC_DXT5_Format: mo,
- RGB_ETC1_Format: bl,
- RGB_ETC2_Format: xl,
- RGB_PVRTC_4BPPV1_Format: gl,
- RGBA_S3TC_DXT1_Format: go
+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
};
-ei.EngineType = {
- UnsignedByteType: rn,
- HalfFloatType: Rn,
- FloatType: an
+oi.EngineType = {
+ UnsignedByteType: un,
+ HalfFloatType: Qn,
+ FloatType: fn
};
-ei.BasisWorker = function() {
+oi.BasisWorker = function() {
let i, e, t;
const n = _EngineFormat, s = _EngineType, r = _TranscoderFormat, a = _BasisFormat;
- self.addEventListener("message", function(m) {
- const g = m.data;
- switch (g.type) {
+ self.addEventListener("message", function(p) {
+ const m = p.data;
+ switch (m.type) {
case "init":
- i = g.config, o(g.transcoderBinary);
+ i = m.config, o(m.transcoderBinary);
break;
case "transcode":
e.then(() => {
try {
- const { faces: A, buffers: p, width: y, height: b, hasAlpha: _, format: M, type: w, dfdFlags: S } = c(g.buffer);
- self.postMessage({ type: "transcode", id: g.id, data: { faces: A, width: y, height: b, hasAlpha: _, format: M, type: w, dfdFlags: S } }, p);
- } catch (A) {
- console.error(A), self.postMessage({ type: "error", id: g.id, error: A.message });
+ 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);
+ } catch (g) {
+ console.error(g), self.postMessage({ type: "error", id: m.id, error: g.message });
}
});
break;
}
});
- function o(m) {
- e = new Promise((g) => {
- t = { wasmBinary: m, onRuntimeInitialized: g }, BASIS(t);
+ 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(m) {
- const g = new t.KTX2File(new Uint8Array(m));
- function A() {
- g.close(), g.delete();
- }
- if (!g.isValid())
- throw A(), new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");
- let p;
- if (g.isUASTC())
- p = a.UASTC;
- else if (g.isETC1S())
- p = a.ETC1S;
- else if (g.isHDR())
- p = a.UASTC_HDR;
+ 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 y = g.getWidth(), b = g.getHeight(), _ = g.getLayers() || 1, M = g.getLevels(), w = g.getFaces(), S = g.getHasAlpha(), T = g.getDFDFlags(), { transcoderFormat: C, engineFormat: v, engineType: F } = u(p, y, b, S);
- if (!y || !b || !M)
- throw A(), new Error("THREE.KTX2Loader: Invalid texture");
- if (!g.startTranscoding())
- throw A(), new Error("THREE.KTX2Loader: .startTranscoding failed");
+ 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)
+ 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 < M; O++) {
+ const N = [];
+ for (let O = 0; O < I; O++) {
const Y = [];
let Q, J;
- for (let ae = 0; ae < _; ae++) {
- const ye = g.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."), M > 1 ? (Q = ye.origWidth, J = ye.origHeight) : (Q = ye.width, J = ye.height);
- let Me = new Uint8Array(g.getImageTranscodedSizeInBytes(O, ae, 0, C));
- const se = g.transcodeImage(Me, O, ae, $, C, 0, -1, -1);
+ 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);
+ 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 A(), new Error("THREE.KTX2Loader: .transcodeImage failed.");
+ 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);
+ N.push({ data: ee, width: Q, height: J }), q.push(ee.buffer);
}
- K.push({ mipmaps: D, width: y, height: b, format: v, type: F });
+ K.push({ mipmaps: N, width: y, height: x, format: v, type: F });
}
- return A(), { faces: K, buffers: q, width: y, height: b, hasAlpha: S, dfdFlags: T, format: v, type: F };
+ return g(), { faces: K, buffers: q, width: y, height: x, hasAlpha: S, dfdFlags: T, format: v, type: F };
}
const l = [
{
@@ -31181,97 +31797,97 @@ ei.BasisWorker = function() {
// a historical accident shown to avoid performance pitfalls for Linux with
// Firefox & AMD GPU (RadeonSI). Further work needed.
// See https://github.com/mrdoob/three.js/pull/29730.
- [a.ETC1S]: l.filter((m) => m.basisFormat.includes(a.ETC1S)).sort((m, g) => m.priorityUASTC - g.priorityUASTC),
- [a.UASTC]: l.filter((m) => m.basisFormat.includes(a.UASTC)).sort((m, g) => m.priorityUASTC - g.priorityUASTC),
- [a.UASTC_HDR]: l.filter((m) => m.basisFormat.includes(a.UASTC_HDR)).sort((m, g) => m.priorityHDR - g.priorityHDR)
+ [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(m, g, A, p) {
- const y = h[m];
- for (let b = 0; b < y.length; b++) {
- const _ = y[b];
- if (_.if && !i[_.if] || !_.basisFormat.includes(m) || p && _.transcoderFormat.length < 2 || _.needsPowerOfTwo && !(d(g) && d(A))) continue;
- const M = _.transcoderFormat[p ? 1 : 0], w = _.engineFormat[p ? 1 : 0], S = _.engineType[0];
- return { transcoderFormat: M, engineFormat: w, engineType: S };
+ function u(p, m, g, A) {
+ const y = h[p];
+ for (let x = 0; x < y.length; x++) {
+ const E = y[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(m) {
- return m <= 2 ? !0 : (m & m - 1) === 0 && m !== 0;
+ function d(p) {
+ return p <= 2 ? !0 : (p & p - 1) === 0 && p !== 0;
}
- function f(m) {
- if (m.length === 1) return m[0];
- let g = 0;
- for (let y = 0; y < m.length; y++) {
- const b = m[y];
- g += b.byteLength;
+ 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];
+ m += x.byteLength;
}
- const A = new Uint8Array(g);
- let p = 0;
- for (let y = 0; y < m.length; y++) {
- const b = m[y];
- A.set(b, p), p += b.byteLength;
+ const g = new Uint8Array(m);
+ let A = 0;
+ for (let y = 0; y < p.length; y++) {
+ const x = p[y];
+ g.set(x, A), A += x.byteLength;
}
- return A;
+ return g;
}
};
-const LB = /* @__PURE__ */ new Set([on, hr, ns]), uu = {
- [ib]: on,
- [eb]: on,
- [Y0]: on,
- [J0]: on,
- [nb]: hr,
- [$0]: hr,
- [j0]: hr,
- [X0]: hr,
- [tb]: ns,
- [Z0]: ns,
- [K0]: ns,
- [q0]: ns,
- [Pf]: Ro,
- [rb]: No,
- [sb]: No
-}, du = {
- [ib]: an,
- [eb]: Rn,
- [Y0]: rn,
- [J0]: rn,
- [nb]: an,
- [$0]: Rn,
- [j0]: rn,
- [X0]: rn,
- [tb]: an,
- [Z0]: Rn,
- [K0]: rn,
- [q0]: rn,
- [Pf]: Rn,
- [rb]: rn,
- [sb]: rn
+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,
+ [Fx]: cs,
+ [Ix]: cs,
+ [Sx]: cs,
+ [hp]: Ho,
+ [Ox]: zo,
+ [Ux]: zo
+}, ku = {
+ [kx]: fn,
+ [Nx]: Qn,
+ [Tx]: 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
};
-async function PB(i) {
+async function PT(i) {
const { vkFormat: e } = i;
- if (uu[e] === void 0)
+ if (Pu[e] === void 0)
throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");
let t;
- i.supercompressionScheme === cg && (hu || (hu = new Promise(async (r) => {
- const a = new NB();
+ i.supercompressionScheme === Og && (Lu || (Lu = new Promise(async (r) => {
+ const a = new FT();
await a.init(), r(a);
- })), t = await hu);
+ })), t = await Lu);
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 === vB)
+ if (i.supercompressionScheme === vT)
h = l.levelData;
- else if (i.supercompressionScheme === cg)
+ else if (i.supercompressionScheme === Og)
h = t.decode(l.levelData, l.uncompressedByteLength);
else
throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");
let u;
- du[e] === an ? u = new Float32Array(
+ ku[e] === fn ? u = new Float32Array(
h.buffer,
h.byteOffset,
h.byteLength / Float32Array.BYTES_PER_ELEMENT
- ) : du[e] === Rn ? u = new Uint16Array(
+ ) : ku[e] === Qn ? u = new Uint16Array(
h.buffer,
h.byteOffset,
h.byteLength / Uint16Array.BYTES_PER_ELEMENT
@@ -31283,24 +31899,24 @@ async function PB(i) {
});
}
let s;
- if (LB.has(uu[e]))
- s = i.pixelDepth === 0 ? new Hl(n[0].data, i.pixelWidth, i.pixelHeight) : new Km(n[0].data, i.pixelWidth, i.pixelHeight, i.pixelDepth);
+ 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);
else {
if (i.pixelDepth > 0) throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");
- s = new Vl(n, i.pixelWidth, i.pixelHeight), s.minFilter = n.length === 1 ? qt : ii, s.magFilter = qt;
+ s = new Ah(n, i.pixelWidth, i.pixelHeight), s.minFilter = n.length === 1 ? Xt : hi, s.magFilter = Xt;
}
- return s.mipmaps = n, s.type = du[e], s.format = uu[e], s.colorSpace = ab(i), s.needsUpdate = !0, Promise.resolve(s);
+ return s.mipmaps = n, s.type = ku[e], s.format = Pu[e], s.colorSpace = Qx(i), s.needsUpdate = !0, Promise.resolve(s);
}
-function ab(i) {
+function Qx(i) {
const e = i.dataFormatDescriptor[0];
- return e.colorPrimaries === IB ? e.transferFunction === lg ? Kt : ln : e.colorPrimaries === MB ? e.transferFunction === lg ? FB : DB : (e.colorPrimaries === SB || console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`), Ai);
+ 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);
}
-const Kc = "[default]", Td = { ASSET_GENERATOR: "assetgenerator" }, Rl = new o0(), ob = "https://unpkg.com/[email protected]", kB = new _B(Rl).setDecoderPath(
- `${ob}/examples/jsm/libs/draco/gltf/`
-), UB = new ei(Rl).setTranscoderPath(
- `${ob}/examples/jsm/libs/basis/`
+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/`
);
-function dg(i, e) {
+function zg(i, e) {
const t = /* @__PURE__ */ new Set();
i.traverse((n) => {
if (!n.geometry) return;
@@ -31309,22 +31925,22 @@ function dg(i, e) {
});
});
}
-function OB(i) {
+function OT(i) {
const { state: e, options: t } = i;
- if (t.preset === Td.ASSET_GENERATOR) {
- const r = new ly();
+ if (t.preset === sf.ASSET_GENERATOR) {
+ const r = new uw();
r.name = "hemi_light", i.scene.add(r), i.lights.push(r);
return;
}
- const n = new py(e.ambientColor, e.ambientIntensity);
+ const n = new z0(e.ambientColor, e.ambientIntensity);
n.name = "ambient_light", i.defaultCamera.add(n);
- const s = new l0(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 QB(i) {
+function QT(i) {
i.lights.forEach((e) => e.parent.remove(e)), i.lights.length = 0;
}
-var ti = Uint8Array, aa = Uint16Array, GB = Int32Array, cb = new ti([
+var ci = Uint8Array, xa = Uint16Array, GT = Int32Array, Hx = new ci([
0,
0,
0,
@@ -31359,7 +31975,7 @@ var ti = Uint8Array, aa = Uint16Array, GB = Int32Array, cb = new ti([
0,
/* impossible */
0
-]), lb = new ti([
+]), zx = new ci([
0,
0,
0,
@@ -31393,65 +32009,65 @@ var ti = Uint8Array, aa = Uint16Array, GB = Int32Array, cb = new ti([
/* unused */
0,
0
-]), HB = new ti([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), hb = function(i, e) {
- for (var t = new aa(31), n = 0; n < 31; ++n)
+]), 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[n] = e += 1 << i[n - 1];
- for (var s = new GB(t[30]), n = 1; n < 30; ++n)
+ 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 };
-}, ub = hb(cb, 2), db = ub.b, zB = ub.r;
-db[28] = 258, zB[258] = 28;
-var VB = hb(lb, 0), WB = VB.b, Rd = new aa(32768);
-for (var Pt = 0; Pt < 32768; ++Pt) {
- var Cs = (Pt & 43690) >> 1 | (Pt & 21845) << 1;
- Cs = (Cs & 52428) >> 2 | (Cs & 13107) << 2, Cs = (Cs & 61680) >> 4 | (Cs & 3855) << 4, Rd[Pt] = ((Cs & 65280) >> 8 | (Cs & 255) << 8) >> 1;
-}
-var vo = (function(i, e, t) {
- for (var n = i.length, s = 0, r = new aa(e); s < n; ++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);
+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;
+}
+var Lo = (function(i, e, t) {
+ for (var n = i.length, s = 0, r = new xa(e); s < n; ++s)
i[s] && ++r[i[s] - 1];
- var a = new aa(e);
+ var a = new xa(e);
for (s = 1; s < e; ++s)
a[s] = a[s - 1] + r[s - 1] << 1;
var o;
if (t) {
- o = new aa(1 << e);
+ o = new xa(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[Rd[u] >> c] = l;
+ o[rf[u] >> c] = l;
} else
- for (o = new aa(n), s = 0; s < n; ++s)
- i[s] && (o[s] = Rd[a[i[s] - 1]++] >> 15 - i[s]);
+ for (o = new xa(n), s = 0; s < n; ++s)
+ i[s] && (o[s] = rf[a[i[s] - 1]++] >> 15 - i[s]);
return o;
-}), Zo = new ti(288);
-for (var Pt = 0; Pt < 144; ++Pt)
- Zo[Pt] = 8;
-for (var Pt = 144; Pt < 256; ++Pt)
- Zo[Pt] = 9;
-for (var Pt = 256; Pt < 280; ++Pt)
- Zo[Pt] = 7;
-for (var Pt = 280; Pt < 288; ++Pt)
- Zo[Pt] = 8;
-var fb = new ti(32);
-for (var Pt = 0; Pt < 32; ++Pt)
- fb[Pt] = 5;
-var qB = /* @__PURE__ */ vo(Zo, 9, 1), KB = /* @__PURE__ */ vo(fb, 5, 1), fu = function(i) {
+}), dc = new ci(288);
+for (var Ot = 0; Ot < 144; ++Ot)
+ dc[Ot] = 8;
+for (var Ot = 144; Ot < 256; ++Ot)
+ dc[Ot] = 9;
+for (var Ot = 256; Ot < 280; ++Ot)
+ dc[Ot] = 7;
+for (var Ot = 280; Ot < 288; ++Ot)
+ dc[Ot] = 8;
+var Kx = 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) {
for (var e = i[0], t = 1; t < i.length; ++t)
i[t] > e && (e = i[t]);
return e;
-}, hi = function(i, e, t) {
+}, bi = function(i, e, t) {
var n = e / 8 | 0;
return (i[n] | i[n + 1] << 8) >> (e & 7) & t;
-}, pu = function(i, e) {
+}, Ou = function(i, e) {
var t = e / 8 | 0;
return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7);
-}, jB = function(i) {
+}, jT = function(i) {
return (i + 7) / 8 | 0;
-}, XB = function(i, e, t) {
- return (t == null || t > i.length) && (t = i.length), new ti(i.subarray(e, t));
-}, YB = [
+}, XT = function(i, e, t) {
+ return (t == null || t > i.length) && (t = i.length), new ci(i.subarray(e, t));
+}, YT = [
"unexpected EOF",
"invalid block type",
"invalid length/literal",
@@ -31467,75 +32083,75 @@ var qB = /* @__PURE__ */ vo(Zo, 9, 1), KB = /* @__PURE__ */ vo(fb, 5, 1), fu = f
"stream finishing",
"invalid zip data"
// determined by unknown compression method
-], ui = function(i, e, t) {
- var n = new Error(e || YB[i]);
- if (n.code = i, Error.captureStackTrace && Error.captureStackTrace(n, ui), !t)
+], Ei = function(i, e, t) {
+ var n = new Error(e || YT[i]);
+ if (n.code = i, Error.captureStackTrace && Error.captureStackTrace(n, Ei), !t)
throw n;
return n;
-}, JB = function(i, e, t, n) {
+}, JT = function(i, e, t, n) {
var s = i.length, r = 0;
if (!s || e.f && !e.l)
- return t || new ti(0);
+ return t || new ci(0);
var a = !t, o = a || e.i != 2, c = e.i;
- a && (t = new ti(s * 3));
- var l = function(vt) {
- var lt = t.length;
- if (vt > lt) {
- var Je = new ti(Math.max(lt * 2, vt));
- Je.set(t), t = Je;
- }
- }, h = e.f || 0, u = e.p || 0, d = e.b || 0, f = e.l, m = e.d, g = e.m, A = e.n, p = s * 8;
+ a && (t = new ci(s * 3));
+ var l = function(It) {
+ var ht = t.length;
+ if (It > ht) {
+ var $e = new ci(Math.max(ht * 2, It));
+ $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 = hi(i, u, 1);
- var y = hi(i, u + 1, 3);
+ h = bi(i, u, 1);
+ var y = bi(i, u + 1, 3);
if (u += 3, y)
if (y == 1)
- f = qB, m = KB, g = 9, A = 5;
+ f = qT, p = KT, m = 9, g = 5;
else if (y == 2) {
- var w = hi(i, u, 31) + 257, S = hi(i, u + 10, 15) + 4, T = w + hi(i, u + 5, 31) + 1;
+ var w = bi(i, u, 31) + 257, S = bi(i, u + 10, 15) + 4, T = w + bi(i, u + 5, 31) + 1;
u += 14;
- for (var C = new ti(T), v = new ti(19), F = 0; F < S; ++F)
- v[HB[F]] = hi(i, u + F * 3, 7);
+ 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 = fu(v), q = (1 << K) - 1, $ = vo(v, K, 1), F = 0; F < T; ) {
- var D = $[hi(i, u, q)];
- u += D & 15;
- var b = D >> 4;
- if (b < 16)
- C[F++] = b;
+ 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;
+ if (x < 16)
+ C[F++] = x;
else {
var O = 0, Y = 0;
- for (b == 16 ? (Y = 3 + hi(i, u, 3), u += 2, O = C[F - 1]) : b == 17 ? (Y = 3 + hi(i, u, 7), u += 3) : b == 18 && (Y = 11 + hi(i, u, 127), u += 7); Y--; )
+ for (x == 16 ? (Y = 3 + bi(i, u, 3), u += 2, O = C[F - 1]) : x == 17 ? (Y = 3 + bi(i, u, 7), u += 3) : x == 18 && (Y = 11 + bi(i, u, 127), u += 7); Y--; )
C[F++] = O;
}
}
var Q = C.subarray(0, w), J = C.subarray(w);
- g = fu(Q), A = fu(J), f = vo(Q, g, 1), m = vo(J, A, 1);
+ m = Uu(Q), g = Uu(J), f = Lo(Q, m, 1), p = Lo(J, g, 1);
} else
- ui(1);
+ Ei(1);
else {
- var b = jB(u) + 4, _ = i[b - 4] | i[b - 3] << 8, M = b + _;
- if (M > s) {
- c && ui(0);
+ var x = jT(u) + 4, E = i[x - 4] | i[x - 3] << 8, I = x + E;
+ if (I > s) {
+ c && Ei(0);
break;
}
- o && l(d + _), t.set(i.subarray(b, M), d), e.b = d += _, e.p = u = M * 8, e.f = h;
+ 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 > p) {
- c && ui(0);
+ if (u > A) {
+ c && Ei(0);
break;
}
}
o && l(d + 131072);
- for (var ee = (1 << g) - 1, ae = (1 << A) - 1, ye = u; ; ye = u) {
- var O = f[pu(i, u) & ee], Me = O >> 4;
- if (u += O & 15, u > p) {
- c && ui(0);
+ for (var ee = (1 << m) - 1, ae = (1 << g) - 1, ye = u; ; ye = u) {
+ var O = f[Ou(i, u) & ee], Me = O >> 4;
+ if (u += O & 15, u > A) {
+ c && Ei(0);
break;
}
- if (O || ui(2), Me < 256)
+ if (O || Ei(2), Me < 256)
t[d++] = Me;
else if (Me == 256) {
ye = u, f = null;
@@ -31543,53 +32159,53 @@ var qB = /* @__PURE__ */ vo(Zo, 9, 1), KB = /* @__PURE__ */ vo(fb, 5, 1), fu = f
} else {
var se = Me - 254;
if (Me > 264) {
- var F = Me - 257, me = cb[F];
- se = hi(i, u, (1 << me) - 1) + db[F], u += me;
+ var F = Me - 257, me = Hx[F];
+ se = bi(i, u, (1 << me) - 1) + qx[F], u += me;
}
- var be = m[pu(i, u) & ae], xe = be >> 4;
- be || ui(3), u += be & 15;
- var J = WB[xe];
- if (xe > 3) {
- var me = lb[xe];
- J += pu(i, u) & (1 << me) - 1, u += me;
+ var xe = p[Ou(i, u) & ae], be = xe >> 4;
+ xe || Ei(3), u += xe & 15;
+ var J = WT[be];
+ if (be > 3) {
+ var me = zx[be];
+ J += Ou(i, u) & (1 << me) - 1, u += me;
}
- if (u > p) {
- c && ui(0);
+ if (u > A) {
+ c && Ei(0);
break;
}
o && l(d + 131072);
- var Pe = d + se;
+ var Ue = d + se;
if (d < J) {
- var $e = r - J, Qe = Math.min(J, Pe);
- for ($e + d < 0 && ui(3); d < Qe; ++d)
- t[d] = n[$e + d];
+ var et = r - J, He = Math.min(J, Ue);
+ for (et + d < 0 && Ei(3); d < He; ++d)
+ t[d] = n[et + d];
}
- for (; d < Pe; ++d)
+ for (; d < Ue; ++d)
t[d] = t[d - J];
}
}
- e.l = f, e.p = ye, e.b = d, e.f = h, f && (h = 1, e.m = g, e.d = m, e.n = A);
+ e.l = f, e.p = ye, 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 ? XB(t, 0, d) : t.subarray(0, d);
-}, ZB = /* @__PURE__ */ new ti(0), $B = function(i, e) {
- return ((i[0] & 15) != 8 || i[0] >> 4 > 7 || (i[0] << 8 | i[1]) % 31) && ui(6, "invalid zlib data"), (i[1] >> 5 & 1) == 1 && ui(6, "invalid zlib data: " + (i[1] & 32 ? "need" : "unexpected") + " dictionary"), (i[1] >> 3 & 4) + 2;
+ return d != t.length && a ? XT(t, 0, d) : t.subarray(0, d);
+}, ZT = /* @__PURE__ */ new ci(0), $T = 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 jc(i, e) {
- return JB(i.subarray($B(i), -4), { i: 2 }, e, e);
+function wo(i, e) {
+ return JT(i.subarray($T(i), -4), { i: 2 }, e, e);
}
-var eT = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), tT = 0;
+var eR = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), tR = 0;
try {
- eT.decode(ZB, { stream: !0 }), tT = 1;
+ eR.decode(ZT, { stream: !0 }), tR = 1;
} catch {
}
-class nT extends oy {
+class nR extends hw {
/**
* Constructs a new EXR loader.
*
* @param {LoadingManager} [manager] - The loading manager.
*/
constructor(e) {
- super(e), this.type = Rn;
+ super(e), this.type = Qn;
}
/**
* Parses the given EXR texture data.
@@ -31599,77 +32215,77 @@ class nT extends oy {
*/
parse(e) {
const C = Math.pow(2.7182818, 2.2);
- function v(x, B) {
+ function v(b, B) {
let k = 0;
for (let R = 0; R < 65536; ++R)
- (R == 0 || x[R >> 3] & 1 << (R & 7)) && (B[k++] = R);
- const E = k - 1;
+ (R == 0 || b[R >> 3] & 1 << (R & 7)) && (B[k++] = R);
+ const _ = k - 1;
for (; k < 65536; ) B[k++] = 0;
- return E;
+ return _;
}
- function F(x) {
+ function F(b) {
for (let B = 0; B < 16384; B++)
- x[B] = {}, x[B].len = 0, x[B].lit = 0, x[B].p = null;
+ b[B] = {}, b[B].len = 0, b[B].lit = 0, b[B].p = null;
}
const K = { l: 0, c: 0, lc: 0 };
- function q(x, B, k, E, R) {
- for (; k < x; )
- B = B << 8 | Be(E, R), k += 8;
- k -= x, K.l = B >> k & (1 << x) - 1, K.c = B, K.lc = k;
+ function q(b, B, k, _, R) {
+ for (; k < b; )
+ B = B << 8 | Be(_, R), k += 8;
+ k -= b, K.l = B >> k & (1 << b) - 1, K.c = B, K.lc = k;
}
const $ = new Array(59);
- function D(x) {
+ function N(b) {
for (let k = 0; k <= 58; ++k) $[k] = 0;
- for (let k = 0; k < 65537; ++k) $[x[k]] += 1;
+ for (let k = 0; k < 65537; ++k) $[b[k]] += 1;
let B = 0;
for (let k = 58; k > 0; --k) {
- const E = B + $[k] >> 1;
- $[k] = B, B = E;
+ const _ = B + $[k] >> 1;
+ $[k] = B, B = _;
}
for (let k = 0; k < 65537; ++k) {
- const E = x[k];
- E > 0 && (x[k] = E | $[E]++ << 6);
+ const _ = b[k];
+ _ > 0 && (b[k] = _ | $[_]++ << 6);
}
}
- function O(x, B, k, E, R, N) {
+ function O(b, B, k, _, R, D) {
const U = B;
let P = 0, z = 0;
- for (; E <= R; E++) {
+ for (; _ <= R; _++) {
if (U.value - B.value > k) return !1;
- q(6, P, z, x, U);
+ q(6, P, z, b, U);
const j = K.l;
- if (P = K.c, z = K.lc, N[E] = j, j == 63) {
+ if (P = K.c, z = K.lc, D[_] = j, j == 63) {
if (U.value - B.value > k)
throw new Error("Something wrong with hufUnpackEncTable");
- q(8, P, z, x, U);
+ q(8, P, z, b, U);
let X = K.l + 6;
- if (P = K.c, z = K.lc, E + X > R + 1)
+ if (P = K.c, z = K.lc, _ + X > R + 1)
throw new Error("Something wrong with hufUnpackEncTable");
- for (; X--; ) N[E++] = 0;
- E--;
+ for (; X--; ) D[_++] = 0;
+ _--;
} else if (j >= 59) {
let X = j - 59 + 2;
- if (E + X > R + 1)
+ if (_ + X > R + 1)
throw new Error("Something wrong with hufUnpackEncTable");
- for (; X--; ) N[E++] = 0;
- E--;
+ for (; X--; ) D[_++] = 0;
+ _--;
}
}
- D(N);
+ N(D);
}
- function Y(x) {
- return x & 63;
+ function Y(b) {
+ return b & 63;
}
- function Q(x) {
- return x >> 6;
+ function Q(b) {
+ return b >> 6;
}
- function J(x, B, k, E) {
+ function J(b, B, k, _) {
for (; B <= k; B++) {
- const R = Q(x[B]), N = Y(x[B]);
- if (R >> N)
+ const R = Q(b[B]), D = Y(b[B]);
+ if (R >> D)
throw new Error("Invalid table entry");
- if (N > 14) {
- const U = E[R >> N - 14];
+ if (D > 14) {
+ const U = _[R >> D - 14];
if (U.len)
throw new Error("Invalid table entry");
if (U.lit++, U.p) {
@@ -31680,104 +32296,104 @@ class nT extends oy {
} else
U.p = new Array(1);
U.p[U.lit - 1] = B;
- } else if (N) {
+ } else if (D) {
let U = 0;
- for (let P = 1 << 14 - N; P > 0; P--) {
- const z = E[(R << 14 - N) + U];
+ for (let P = 1 << 14 - D; P > 0; P--) {
+ const z = _[(R << 14 - D) + U];
if (z.len || z.p)
throw new Error("Invalid table entry");
- z.len = N, z.lit = B, U++;
+ z.len = D, z.lit = B, U++;
}
}
}
return !0;
}
const ee = { c: 0, lc: 0 };
- function ae(x, B, k, E) {
- x = x << 8 | Be(k, E), B += 8, ee.c = x, ee.lc = B;
+ function ae(b, B, k, _) {
+ b = b << 8 | Be(k, _), B += 8, ee.c = b, ee.lc = B;
}
const ye = { c: 0, lc: 0 };
- function Me(x, B, k, E, R, N, U, P, z) {
- if (x == B) {
- E < 8 && (ae(k, E, R, N), k = ee.c, E = ee.lc), E -= 8;
- let j = k >> E;
+ function Me(b, B, k, _, R, D, U, P, z) {
+ if (b == B) {
+ _ < 8 && (ae(k, _, R, D), k = ee.c, _ = ee.lc), _ -= 8;
+ let j = k >> _;
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++] = x;
+ U[P.value++] = b;
else
return !1;
- ye.c = k, ye.lc = E;
+ ye.c = k, ye.lc = _;
}
- function se(x) {
- return x & 65535;
+ function se(b) {
+ return b & 65535;
}
- function me(x) {
- const B = se(x);
+ function me(b) {
+ const B = se(b);
return B > 32767 ? B - 65536 : B;
}
- const be = { a: 0, b: 0 };
- function xe(x, B) {
- const k = me(x), R = me(B), N = k + (R & 1) + (R >> 1), U = N, P = N - R;
- be.a = U, be.b = P;
+ 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 Pe(x, B) {
- const k = se(x), E = se(B), R = k - (E >> 1) & 65535, N = E + R - 32768 & 65535;
- be.a = N, be.b = R;
+ function Ue(b, B) {
+ const k = se(b), _ = se(B), R = k - (_ >> 1) & 65535, D = _ + R - 32768 & 65535;
+ xe.a = D, xe.b = R;
}
- function $e(x, B, k, E, R, N, U) {
+ function et(b, B, k, _, 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 + N * (R - X), ce = N * j, fe = N * X, Ae = E * j, _e = E * X;
- let De, qe, He, Ne;
+ const he = ie + D * (R - X), ce = D * j, fe = D * X, Ae = _ * j, _e = _ * X;
+ let Pe, je, Ve, Fe;
for (; ie <= he; ie += fe) {
- let it = ie;
- const Le = ie + E * (k - X);
- for (; it <= Le; it += _e) {
- const yt = it + Ae, en = it + ce, xt = en + Ae;
- P ? (xe(x[it + B], x[en + B]), De = be.a, He = be.b, xe(x[yt + B], x[xt + B]), qe = be.a, Ne = be.b, xe(De, qe), x[it + B] = be.a, x[yt + B] = be.b, xe(He, Ne), x[en + B] = be.a, x[xt + B] = be.b) : (Pe(x[it + B], x[en + B]), De = be.a, He = be.b, Pe(x[yt + B], x[xt + B]), qe = be.a, Ne = be.b, Pe(De, qe), x[it + B] = be.a, x[yt + B] = be.b, Pe(He, Ne), x[en + B] = be.a, x[xt + B] = be.b);
+ 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);
}
if (k & j) {
- const yt = it + ce;
- P ? xe(x[it + B], x[yt + B]) : Pe(x[it + B], x[yt + B]), De = be.a, x[yt + B] = be.b, x[it + B] = De;
+ 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;
}
}
if (R & j) {
- let it = ie;
- const Le = ie + E * (k - X);
- for (; it <= Le; it += _e) {
- const yt = it + Ae;
- P ? xe(x[it + B], x[yt + B]) : Pe(x[it + B], x[yt + B]), De = be.a, x[yt + B] = be.b, x[it + B] = De;
+ 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;
}
}
X = j, j >>= 1;
}
return ie;
}
- function Qe(x, B, k, E, R, N, U, P, z) {
+ function He(b, B, k, _, R, D, U, P, z) {
let j = 0, X = 0;
- const ie = U, he = Math.trunc(E.value + (R + 7) / 8);
- for (; E.value < he; )
- for (ae(j, X, k, E), j = ee.c, X = ee.lc; X >= 14; ) {
+ 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 fe = j >> X - 14 & 16383, Ae = B[fe];
if (Ae.len)
- X -= Ae.len, Me(Ae.lit, N, j, X, k, E, P, z, ie), j = ye.c, X = ye.lc;
+ X -= Ae.len, Me(Ae.lit, D, j, X, k, _, P, z, ie), j = ye.c, X = ye.lc;
else {
if (!Ae.p)
throw new Error("hufDecode issues");
let _e;
for (_e = 0; _e < Ae.lit; _e++) {
- const De = Y(x[Ae.p[_e]]);
- for (; X < De && E.value < he; )
- ae(j, X, k, E), j = ee.c, X = ee.lc;
- if (X >= De && Q(x[Ae.p[_e]]) == (j >> X - De & (1 << De) - 1)) {
- X -= De, Me(Ae.p[_e], N, j, X, k, E, P, z, ie), j = ye.c, X = ye.lc;
+ 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;
break;
}
}
@@ -31789,173 +32405,173 @@ class nT extends oy {
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, E, P, z, ie), j = ye.c, X = ye.lc;
+ X -= fe.len, Me(fe.lit, D, j, X, k, _, P, z, ie), j = ye.c, X = ye.lc;
else
throw new Error("hufDecode issues");
}
return !0;
}
- function vt(x, B, k, E, R, N) {
- const U = { value: 0 }, P = k.value, z = Oe(B, k), j = Oe(B, k);
+ function It(b, B, k, _, R, D) {
+ const U = { value: 0 }, P = k.value, z = Ge(B, k), j = Ge(B, k);
k.value += 4;
- const X = Oe(B, k);
+ 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 = E - (k.value - P);
- if (O(x, k, ce, z, j, ie), X > 8 * (E - (k.value - P)))
+ const ce = _ - (k.value - P);
+ if (O(b, k, ce, z, j, ie), X > 8 * (_ - (k.value - P)))
throw new Error("Something wrong with hufUncompress");
- J(ie, z, j, he), Qe(ie, he, x, k, X, j, N, R, U);
+ J(ie, z, j, he), He(ie, he, b, k, X, j, D, R, U);
}
- function lt(x, B, k) {
- for (let E = 0; E < k; ++E)
- B[E] = x[B[E]];
+ function ht(b, B, k) {
+ for (let _ = 0; _ < k; ++_)
+ B[_] = b[B[_]];
}
- function Je(x) {
- for (let B = 1; B < x.length; B++) {
- const k = x[B - 1] + x[B] - 128;
- x[B] = k;
+ function $e(b) {
+ for (let B = 1; B < b.length; B++) {
+ const k = b[B - 1] + b[B] - 128;
+ b[B] = k;
}
}
- function G(x, B) {
- let k = 0, E = Math.floor((x.length + 1) / 2), R = 0;
- const N = x.length - 1;
- for (; !(R > N || (B[R++] = x[k++], R > N)); )
- B[R++] = x[E++];
+ 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[_++];
}
- function dn(x) {
- let B = x.byteLength;
+ function xn(b) {
+ let B = b.byteLength;
const k = new Array();
- let E = 0;
- const R = new DataView(x);
+ let _ = 0;
+ const R = new DataView(b);
for (; B > 0; ) {
- const N = R.getInt8(E++);
- if (N < 0) {
- const U = -N;
+ const D = R.getInt8(_++);
+ if (D < 0) {
+ const U = -D;
B -= U + 1;
for (let P = 0; P < U; P++)
- k.push(R.getUint8(E++));
+ k.push(R.getUint8(_++));
} else {
- const U = N;
+ const U = D;
B -= 2;
- const P = R.getUint8(E++);
+ const P = R.getUint8(_++);
for (let z = 0; z < U + 1; z++)
k.push(P);
}
}
return k;
}
- function dt(x, B, k, E, R, N) {
- let U = new DataView(N.buffer);
- const P = k[x.idx[0]].width, z = k[x.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), De = new Array(j), qe = new Array(j), He = new Array(j), Ne = new Array(j);
- for (let Le = 0; Le < j; ++Le)
- Ne[Le] = B[x.idx[Le]], _e[Le] = Le < 1 ? 0 : _e[Le - 1] + ie * he, De[Le] = new Float32Array(64), qe[Le] = new Uint16Array(64), He[Le] = new Uint16Array(ie * 64);
- for (let Le = 0; Le < he; ++Le) {
- let yt = 8;
- Le == he - 1 && (yt = fe);
- let en = 8;
- for (let At = 0; At < ie; ++At) {
- At == ie - 1 && (en = ce);
- for (let Ke = 0; Ke < j; ++Ke)
- qe[Ke].fill(0), qe[Ke][0] = R[_e[Ke]++], pt(Ae, E, qe[Ke]), ze(qe[Ke], De[Ke]), Rt(De[Ke]);
- Ge(De);
- for (let Ke = 0; Ke < j; ++Ke)
- L(De[Ke], He[Ke], At * 64);
+ 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);
+ 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);
+ for (let ke = 0; ke < he; ++ke) {
+ let St = 8;
+ ke == he - 1 && (St = 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]);
+ ze(Pe);
+ for (let Xe = 0; Xe < j; ++Xe)
+ L(Pe[Xe], Ve[Xe], xt * 64);
}
- let xt = 0;
- for (let At = 0; At < j; ++At) {
- const Ke = k[x.idx[At]].type;
- for (let zt = 8 * Le; zt < 8 * Le + yt; ++zt) {
- xt = Ne[At][zt];
- for (let pn = 0; pn < X; ++pn) {
- const Nt = pn * 64 + (zt & 7) * 8;
- U.setUint16(xt + 0 * Ke, He[At][Nt + 0], !0), U.setUint16(xt + 2 * Ke, He[At][Nt + 1], !0), U.setUint16(xt + 4 * Ke, He[At][Nt + 2], !0), U.setUint16(xt + 6 * Ke, He[At][Nt + 3], !0), U.setUint16(xt + 8 * Ke, He[At][Nt + 4], !0), U.setUint16(xt + 10 * Ke, He[At][Nt + 5], !0), U.setUint16(xt + 12 * Ke, He[At][Nt + 6], !0), U.setUint16(xt + 14 * Ke, He[At][Nt + 7], !0), xt += 16 * Ke;
+ 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) {
+ wt = Fe[xt][qt];
+ for (let En = 0; En < X; ++En) {
+ const Lt = En * 64 + (qt & 7) * 8;
+ U.setUint16(wt + 0 * Xe, Ve[xt][Lt + 0], !0), U.setUint16(wt + 2 * Xe, Ve[xt][Lt + 1], !0), U.setUint16(wt + 4 * Xe, Ve[xt][Lt + 2], !0), U.setUint16(wt + 6 * Xe, Ve[xt][Lt + 3], !0), U.setUint16(wt + 8 * Xe, Ve[xt][Lt + 4], !0), U.setUint16(wt + 10 * Xe, Ve[xt][Lt + 5], !0), U.setUint16(wt + 12 * Xe, Ve[xt][Lt + 6], !0), U.setUint16(wt + 14 * Xe, Ve[xt][Lt + 7], !0), wt += 16 * Xe;
}
}
if (X != ie)
- for (let zt = 8 * Le; zt < 8 * Le + yt; ++zt) {
- const pn = Ne[At][zt] + 8 * X * 2 * Ke, Nt = X * 64 + (zt & 7) * 8;
- for (let tn = 0; tn < en; ++tn)
- U.setUint16(pn + tn * 2 * Ke, He[At][Nt + tn], !0);
+ for (let qt = 8 * ke; qt < 8 * ke + St; ++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);
}
}
}
- const it = new Uint16Array(P);
- U = new DataView(N.buffer);
- for (let Le = 0; Le < j; ++Le) {
- k[x.idx[Le]].decoded = !0;
- const yt = k[x.idx[Le]].type;
- if (k[Le].type == 2)
- for (let en = 0; en < z; ++en) {
- const xt = Ne[Le][en];
- for (let At = 0; At < P; ++At)
- it[At] = U.getUint16(xt + At * 2 * yt, !0);
- for (let At = 0; At < P; ++At)
- U.setFloat32(xt + At * 2 * yt, ne(it[At]), !0);
+ const st = 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 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);
+ for (let xt = 0; xt < P; ++xt)
+ U.setFloat32(wt + xt * 2 * St, ne(st[xt]), !0);
}
}
}
- function pt(x, B, k) {
- let E, R = 1;
+ function gt(b, B, k) {
+ let _, R = 1;
for (; R < 64; )
- E = B[x.value], E == 65280 ? R = 64 : E >> 8 == 255 ? R += E & 255 : (k[R] = E, R++), x.value++;
+ _ = B[b.value], _ == 65280 ? R = 64 : _ >> 8 == 255 ? R += _ & 255 : (k[R] = _, R++), b.value++;
}
- function ze(x, B) {
- B[0] = ne(x[0]), B[1] = ne(x[1]), B[2] = ne(x[5]), B[3] = ne(x[6]), B[4] = ne(x[14]), B[5] = ne(x[15]), B[6] = ne(x[27]), B[7] = ne(x[28]), B[8] = ne(x[2]), B[9] = ne(x[4]), B[10] = ne(x[7]), B[11] = ne(x[13]), B[12] = ne(x[16]), B[13] = ne(x[26]), B[14] = ne(x[29]), B[15] = ne(x[42]), B[16] = ne(x[3]), B[17] = ne(x[8]), B[18] = ne(x[12]), B[19] = ne(x[17]), B[20] = ne(x[25]), B[21] = ne(x[30]), B[22] = ne(x[41]), B[23] = ne(x[43]), B[24] = ne(x[9]), B[25] = ne(x[11]), B[26] = ne(x[18]), B[27] = ne(x[24]), B[28] = ne(x[31]), B[29] = ne(x[40]), B[30] = ne(x[44]), B[31] = ne(x[53]), B[32] = ne(x[10]), B[33] = ne(x[19]), B[34] = ne(x[23]), B[35] = ne(x[32]), B[36] = ne(x[39]), B[37] = ne(x[45]), B[38] = ne(x[52]), B[39] = ne(x[54]), B[40] = ne(x[20]), B[41] = ne(x[22]), B[42] = ne(x[33]), B[43] = ne(x[38]), B[44] = ne(x[46]), B[45] = ne(x[51]), B[46] = ne(x[55]), B[47] = ne(x[60]), B[48] = ne(x[21]), B[49] = ne(x[34]), B[50] = ne(x[37]), B[51] = ne(x[47]), B[52] = ne(x[50]), B[53] = ne(x[56]), B[54] = ne(x[59]), B[55] = ne(x[61]), B[56] = ne(x[35]), B[57] = ne(x[36]), B[58] = ne(x[48]), B[59] = ne(x[49]), B[60] = ne(x[57]), B[61] = ne(x[58]), B[62] = ne(x[62]), B[63] = ne(x[63]);
+ 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 Rt(x) {
- const B = 0.5 * Math.cos(0.7853975), k = 0.5 * Math.cos(3.14159 / 16), E = 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);
+ 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);
for (let he = 0; he < 8; ++he) {
const ce = he * 8;
- z[0] = E * x[ce + 2], z[1] = U * x[ce + 2], z[2] = E * x[ce + 6], z[3] = U * x[ce + 6], j[0] = k * x[ce + 1] + R * x[ce + 3] + N * x[ce + 5] + P * x[ce + 7], j[1] = R * x[ce + 1] - P * x[ce + 3] - k * x[ce + 5] - N * x[ce + 7], j[2] = N * x[ce + 1] - k * x[ce + 3] + P * x[ce + 5] + R * x[ce + 7], j[3] = P * x[ce + 1] - N * x[ce + 3] + R * x[ce + 5] - k * x[ce + 7], X[0] = B * (x[ce + 0] + x[ce + 4]), X[3] = B * (x[ce + 0] - x[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], x[ce + 0] = ie[0] + j[0], x[ce + 1] = ie[1] + j[1], x[ce + 2] = ie[2] + j[2], x[ce + 3] = ie[3] + j[3], x[ce + 4] = ie[3] - j[3], x[ce + 5] = ie[2] - j[2], x[ce + 6] = ie[1] - j[1], x[ce + 7] = ie[0] - j[0];
+ 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];
}
for (let he = 0; he < 8; ++he)
- z[0] = E * x[16 + he], z[1] = U * x[16 + he], z[2] = E * x[48 + he], z[3] = U * x[48 + he], j[0] = k * x[8 + he] + R * x[24 + he] + N * x[40 + he] + P * x[56 + he], j[1] = R * x[8 + he] - P * x[24 + he] - k * x[40 + he] - N * x[56 + he], j[2] = N * x[8 + he] - k * x[24 + he] + P * x[40 + he] + R * x[56 + he], j[3] = P * x[8 + he] - N * x[24 + he] + R * x[40 + he] - k * x[56 + he], X[0] = B * (x[he] + x[32 + he]), X[3] = B * (x[he] - x[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], x[0 + he] = ie[0] + j[0], x[8 + he] = ie[1] + j[1], x[16 + he] = ie[2] + j[2], x[24 + he] = ie[3] + j[3], x[32 + he] = ie[3] - j[3], x[40 + he] = ie[2] - j[2], x[48 + he] = ie[1] - j[1], x[56 + he] = ie[0] - j[0];
+ 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];
}
- function Ge(x) {
+ function ze(b) {
for (let B = 0; B < 64; ++B) {
- const k = x[0][B], E = x[1][B], R = x[2][B];
- x[0][B] = k + 1.5747 * R, x[1][B] = k - 0.1873 * E - 0.4682 * R, x[2][B] = k + 1.8556 * E;
+ 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 * _;
}
}
- function L(x, B, k) {
- for (let E = 0; E < 64; ++E)
- B[k + E] = vp.toHalfFloat(I(x[E]));
+ function L(b, B, k) {
+ for (let _ = 0; _ < 64; ++_)
+ B[k + _] = Zp.toHalfFloat(M(b[_]));
}
- function I(x) {
- return x <= 1 ? Math.sign(x) * Math.pow(Math.abs(x), 2.2) : Math.sign(x) * Math.pow(C, Math.abs(x) - 1);
+ 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(x) {
- return new DataView(x.array.buffer, x.offset.value, x.size);
+ function Z(b) {
+ return new DataView(b.array.buffer, b.offset.value, b.size);
}
- function le(x) {
- const B = x.viewer.buffer.slice(x.offset.value, x.offset.value + x.size), k = new Uint8Array(dn(B)), E = new Uint8Array(k.length);
- return Je(k), G(k, E), new DataView(E.buffer);
+ 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);
}
- function pe(x) {
- const B = x.array.slice(x.offset.value, x.offset.value + x.size), k = jc(B), E = new Uint8Array(k.length);
- return Je(k), G(k, E), new DataView(E.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);
}
- function oe(x) {
- const B = x.viewer, k = { value: x.offset.value }, E = new Uint16Array(x.columns * x.lines * (x.inputChannels.length * x.type)), R = new Uint8Array(8192);
- let N = 0;
- const U = new Array(x.inputChannels.length);
- for (let fe = 0, Ae = x.inputChannels.length; fe < Ae; fe++)
- U[fe] = {}, U[fe].start = N, U[fe].end = U[fe].start, U[fe].nx = x.columns, U[fe].ny = x.lines, U[fe].size = x.type, N += U[fe].nx * U[fe].ny * U[fe].size;
+ 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 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;
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] = et(B, k);
- const j = new Uint16Array(65536), X = v(R, j), ie = Oe(B, k);
- vt(x.array, B, k, ie, E, N);
- for (let fe = 0; fe < x.inputChannels.length; ++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);
+ for (let fe = 0; fe < b.inputChannels.length; ++fe) {
const Ae = U[fe];
for (let _e = 0; _e < U[fe].size; ++_e)
- $e(
- E,
+ et(
+ _,
Ae.start + _e,
Ae.nx,
Ae.size,
@@ -31964,129 +32580,129 @@ class nT extends oy {
X
);
}
- lt(j, E, N);
+ ht(j, _, D);
let he = 0;
- const ce = new Uint8Array(E.buffer.byteLength);
- for (let fe = 0; fe < x.lines; fe++)
- for (let Ae = 0; Ae < x.inputChannels.length; Ae++) {
- const _e = U[Ae], De = _e.nx * _e.size, qe = new Uint8Array(E.buffer, _e.end * 2, De * 2);
- ce.set(qe, he), he += De * 2, _e.end += De;
+ const ce = new Uint8Array(_.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;
}
return new DataView(ce.buffer);
}
- function Ue(x) {
- const B = x.array.slice(x.offset.value, x.offset.value + x.size), k = jc(B), E = x.inputChannels.length * x.lines * x.columns * x.totalBytes, R = new ArrayBuffer(E), N = new DataView(R);
+ 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);
let U = 0, P = 0;
const z = new Array(4);
- for (let j = 0; j < x.lines; j++)
- for (let X = 0; X < x.inputChannels.length; X++) {
+ for (let j = 0; j < b.lines; j++)
+ for (let X = 0; X < b.inputChannels.length; X++) {
let ie = 0;
- switch (x.inputChannels[X].pixelType) {
+ switch (b.inputChannels[X].pixelType) {
case 1:
- z[0] = U, z[1] = z[0] + x.columns, U = z[1] + x.columns;
- for (let ce = 0; ce < x.columns; ++ce) {
+ 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;
+ ie += fe, D.setUint16(P, ie, !0), P += 2;
}
break;
case 2:
- z[0] = U, z[1] = z[0] + x.columns, z[2] = z[1] + x.columns, U = z[2] + x.columns;
- for (let ce = 0; ce < x.columns; ++ce) {
+ 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;
+ ie += fe, D.setUint32(P, ie, !0), P += 4;
}
break;
}
}
- return N;
- }
- function ve(x) {
- const B = x.viewer, k = { value: x.offset.value }, E = new Uint8Array(x.columns * x.lines * (x.inputChannels.length * x.type * 2)), R = {
- version: We(B, k),
- unknownUncompressedSize: We(B, k),
- unknownCompressedSize: We(B, k),
- acCompressedSize: We(B, k),
- dcCompressedSize: We(B, k),
- rleCompressedSize: We(B, k),
- rleUncompressedSize: We(B, k),
- rleRawSize: We(B, k),
- totalAcUncompressedCount: We(B, k),
- totalDcUncompressedCount: We(B, k),
- acCompression: We(B, k)
+ return D;
+ }
+ 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 = {
+ 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: " + Qi.compression + " version " + R.version + " is unsupported");
- const N = new Array();
+ throw new Error("EXRLoader.parse: " + qi.compression + " version " + R.version + " is unsupported");
+ const D = new Array();
let U = re(B, k) - 2;
for (; U > 0; ) {
- const Ae = Ve(B.buffer, k), _e = et(B, k), De = _e >> 2 & 3, qe = (_e >> 4) - 1, He = new Int8Array([qe])[0], Ne = et(B, k);
- N.push({
+ 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({
name: Ae,
- index: He,
- type: Ne,
- compression: De
+ index: Ve,
+ type: Fe,
+ compression: Pe
}), U -= Ae.length + 3;
}
- const P = Qi.channels, z = new Array(x.inputChannels.length);
- for (let Ae = 0; Ae < x.inputChannels.length; ++Ae) {
- const _e = z[Ae] = {}, De = P[Ae];
- _e.name = De.name, _e.compression = 0, _e.decoded = !1, _e.type = De.pixelType, _e.pLinear = De.pLinear, _e.width = x.columns, _e.height = x.lines;
+ 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 j = {
idx: new Array(3)
};
- for (let Ae = 0; Ae < x.inputChannels.length; ++Ae) {
+ for (let Ae = 0; Ae < b.inputChannels.length; ++Ae) {
const _e = z[Ae];
- for (let De = 0; De < N.length; ++De) {
- const qe = N[De];
- _e.name == qe.name && (_e.compression = qe.compression, qe.index >= 0 && (j.idx[qe.index] = Ae), _e.offset = 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);
}
}
let X, ie, he;
if (R.acCompressedSize > 0)
switch (R.acCompression) {
case 0:
- X = new Uint16Array(R.totalAcUncompressedCount), vt(x.array, B, k, R.acCompressedSize, X, R.totalAcUncompressedCount);
+ X = new Uint16Array(R.totalAcUncompressedCount), It(b.array, B, k, R.acCompressedSize, X, R.totalAcUncompressedCount);
break;
case 1:
- const Ae = x.array.slice(k.value, k.value + R.totalAcUncompressedCount), _e = jc(Ae);
+ const Ae = b.array.slice(k.value, k.value + R.totalAcUncompressedCount), _e = wo(Ae);
X = new Uint16Array(_e.buffer), k.value += R.totalAcUncompressedCount;
break;
}
if (R.dcCompressedSize > 0) {
const Ae = {
- array: x.array,
+ array: b.array,
offset: k,
size: R.dcCompressedSize
};
ie = new Uint16Array(pe(Ae).buffer), k.value += R.dcCompressedSize;
}
if (R.rleRawSize > 0) {
- const Ae = x.array.slice(k.value, k.value + R.rleCompressedSize), _e = jc(Ae);
- he = dn(_e.buffer), k.value += R.rleCompressedSize;
+ const Ae = b.array.slice(k.value, k.value + R.rleCompressedSize), _e = wo(Ae);
+ he = xn(_e.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 < x.lines; ++Ae)
+ for (let Ae = 0; Ae < b.lines; ++Ae)
for (let _e = 0; _e < z.length; ++_e)
- fe[_e].push(ce), ce += z[_e].width * x.type * 2;
- dt(j, fe, z, X, ie, E);
+ fe[_e].push(ce), ce += z[_e].width * b.type * 2;
+ pt(j, fe, z, X, ie, _);
for (let Ae = 0; Ae < z.length; ++Ae) {
const _e = z[Ae];
if (!_e.decoded)
switch (_e.compression) {
case 2:
- let De = 0, qe = 0;
- for (let He = 0; He < x.lines; ++He) {
- let Ne = fe[Ae][De];
- for (let it = 0; it < _e.width; ++it) {
- for (let Le = 0; Le < 2 * _e.type; ++Le)
- E[Ne++] = he[qe + Le * _e.width * _e.height];
- qe++;
+ 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];
+ je++;
}
- De++;
+ Pe++;
}
break;
// skip
@@ -32094,77 +32710,77 @@ class nT extends oy {
throw new Error("EXRLoader.parse: unsupported channel compression");
}
}
- return new DataView(E.buffer);
+ return new DataView(_.buffer);
}
- function Ve(x, B) {
- const k = new Uint8Array(x);
- let E = 0;
- for (; k[B.value + E] != 0; )
- E += 1;
+ function qe(b, B) {
+ const k = new Uint8Array(b);
+ let _ = 0;
+ for (; k[B.value + _] != 0; )
+ _ += 1;
const R = new TextDecoder().decode(
- k.slice(B.value, B.value + E)
+ k.slice(B.value, B.value + _)
);
- return B.value = B.value + E + 1, R;
+ return B.value = B.value + _ + 1, R;
}
- function Ye(x, B, k) {
- const E = new TextDecoder().decode(
- new Uint8Array(x).slice(B.value, B.value + k)
+ function Je(b, B, k) {
+ const _ = new TextDecoder().decode(
+ new Uint8Array(b).slice(B.value, B.value + k)
);
- return B.value = B.value + k, E;
+ return B.value = B.value + k, _;
}
- function Ee(x, B) {
- const k = ke(x, B), E = Oe(x, B);
- return [k, E];
+ function Ee(b, B) {
+ const k = Oe(b, B), _ = Ge(b, B);
+ return [k, _];
}
- function Re(x, B) {
- const k = Oe(x, B), E = Oe(x, B);
- return [k, E];
+ function Re(b, B) {
+ const k = Ge(b, B), _ = Ge(b, B);
+ return [k, _];
}
- function ke(x, B) {
- const k = x.getInt32(B.value, !0);
+ function Oe(b, B) {
+ const k = b.getInt32(B.value, !0);
return B.value = B.value + 4, k;
}
- function Oe(x, B) {
- const k = x.getUint32(B.value, !0);
+ function Ge(b, B) {
+ const k = b.getUint32(B.value, !0);
return B.value = B.value + 4, k;
}
- function Be(x, B) {
- const k = x[B.value];
+ function Be(b, B) {
+ const k = b[B.value];
return B.value = B.value + 1, k;
}
- function et(x, B) {
- const k = x.getUint8(B.value);
+ function tt(b, B) {
+ const k = b.getUint8(B.value);
return B.value = B.value + 1, k;
}
- const We = function(x, B) {
+ const Ke = function(b, B) {
let k;
- return "getBigInt64" in DataView.prototype ? k = Number(x.getBigInt64(B.value, !0)) : k = x.getUint32(B.value + 4, !0) + Number(x.getUint32(B.value, !0) << 32), B.value += 8, 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 tt(x, B) {
- const k = x.getFloat32(B.value, !0);
+ function nt(b, B) {
+ const k = b.getFloat32(B.value, !0);
return B.value += 4, k;
}
- function W(x, B) {
- return vp.toHalfFloat(tt(x, B));
+ function W(b, B) {
+ return Zp.toHalfFloat(nt(b, B));
}
- function ne(x) {
- const B = (x & 31744) >> 10, k = x & 1023;
- return (x >> 15 ? -1 : 1) * (B ? B === 31 ? k ? NaN : 1 / 0 : Math.pow(2, B - 15) * (1 + k / 1024) : 6103515625e-14 * (k / 1024));
+ 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(x, B) {
- const k = x.getUint16(B.value, !0);
+ function re(b, B) {
+ const k = b.getUint16(B.value, !0);
return B.value += 2, k;
}
- function de(x, B) {
- return ne(re(x, B));
+ function de(b, B) {
+ return ne(re(b, B));
}
- function Ie(x, B, k, E) {
- const R = k.value, N = [];
- for (; k.value < R + E - 1; ) {
- const U = Ve(B, k), P = ke(x, k), z = et(x, k);
+ function Ie(b, B, k, _) {
+ const R = k.value, D = [];
+ for (; k.value < R + _ - 1; ) {
+ const U = qe(B, k), P = Oe(b, k), z = tt(b, k);
k.value += 3;
- const j = ke(x, k), X = ke(x, k);
- N.push({
+ const j = Oe(b, k), X = Oe(b, k);
+ D.push({
name: U,
pixelType: P,
pLinear: z,
@@ -32172,13 +32788,13 @@ class nT extends oy {
ySampling: X
});
}
- return k.value += 1, N;
+ return k.value += 1, D;
}
- function Ce(x, B) {
- const k = tt(x, B), E = tt(x, B), R = tt(x, B), N = tt(x, B), U = tt(x, B), P = tt(x, B), z = tt(x, B), j = tt(x, B);
- return { redX: k, redY: E, greenX: R, greenY: N, blueX: U, blueY: P, whiteX: z, whiteY: j };
+ 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 };
}
- function nt(x, B) {
+ function it(b, B) {
const k = [
"NO_COMPRESSION",
"RLE_COMPRESSION",
@@ -32190,197 +32806,197 @@ class nT extends oy {
"B44A_COMPRESSION",
"DWAA_COMPRESSION",
"DWAB_COMPRESSION"
- ], E = et(x, B);
- return k[E];
+ ], _ = tt(b, B);
+ return k[_];
}
- function Ut(x, B) {
- const k = ke(x, B), E = ke(x, B), R = ke(x, B), N = ke(x, B);
- return { xMin: k, yMin: E, xMax: R, yMax: N };
+ 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 };
}
- function fn(x, B) {
+ function bn(b, B) {
const k = [
"INCREASING_Y",
"DECREASING_Y",
"RANDOM_Y"
- ], E = et(x, B);
- return k[E];
+ ], _ = tt(b, B);
+ return k[_];
}
- function _t(x, B) {
+ function Ct(b, B) {
const k = [
"ENVMAP_LATLONG",
"ENVMAP_CUBE"
- ], E = et(x, B);
- return k[E];
+ ], _ = tt(b, B);
+ return k[_];
}
- function zn(x, B) {
+ function Yn(b, B) {
const k = [
"ONE_LEVEL",
"MIPMAP_LEVELS",
"RIPMAP_LEVELS"
- ], E = [
+ ], _ = [
"ROUND_DOWN",
"ROUND_UP"
- ], R = Oe(x, B), N = Oe(x, B), U = et(x, B);
+ ], R = Ge(b, B), D = Ge(b, B), U = tt(b, B);
return {
xSize: R,
- ySize: N,
+ ySize: D,
levelMode: k[U & 15],
- roundingMode: E[U >> 4]
+ roundingMode: _[U >> 4]
};
}
- function ai(x, B) {
- const k = tt(x, B), E = tt(x, B);
- return [k, E];
- }
- function ac(x, B) {
- const k = tt(x, B), E = tt(x, B), R = tt(x, B);
- return [k, E, R];
- }
- function oc(x, B, k, E, R) {
- if (E === "string" || E === "stringvector" || E === "iccProfile")
- return Ye(B, k, R);
- if (E === "chlist")
- return Ie(x, B, k, R);
- if (E === "chromaticities")
- return Ce(x, k);
- if (E === "compression")
- return nt(x, k);
- if (E === "box2i")
- return Ut(x, k);
- if (E === "envmap")
- return _t(x, k);
- if (E === "tiledesc")
- return zn(x, k);
- if (E === "lineOrder")
- return fn(x, k);
- if (E === "float")
- return tt(x, k);
- if (E === "v2f")
- return ai(x, k);
- if (E === "v3f")
- return ac(x, k);
- if (E === "int")
- return ke(x, k);
- if (E === "rational")
- return Ee(x, k);
- if (E === "timecode")
- return Re(x, k);
- if (E === "preview")
+ function Ai(b, B) {
+ const k = nt(b, B), _ = nt(b, B);
+ return [k, _];
+ }
+ function Ec(b, B) {
+ const k = nt(b, B), _ = nt(b, B), R = nt(b, B);
+ return [k, _, R];
+ }
+ function _c(b, B, k, _, R) {
+ if (_ === "string" || _ === "stringvector" || _ === "iccProfile")
+ return Je(B, k, R);
+ if (_ === "chlist")
+ return Ie(b, B, k, R);
+ if (_ === "chromaticities")
+ return Ce(b, k);
+ if (_ === "compression")
+ return it(b, k);
+ if (_ === "box2i")
+ return Qt(b, k);
+ if (_ === "envmap")
+ return Ct(b, k);
+ if (_ === "tiledesc")
+ return Yn(b, k);
+ if (_ === "lineOrder")
+ return bn(b, k);
+ if (_ === "float")
+ return nt(b, k);
+ if (_ === "v2f")
+ return Ai(b, k);
+ if (_ === "v3f")
+ return Ec(b, k);
+ if (_ === "int")
+ return Oe(b, k);
+ if (_ === "rational")
+ return Ee(b, k);
+ if (_ === "timecode")
+ return Re(b, k);
+ if (_ === "preview")
return k.value += R, "skipped";
k.value += R;
}
- function Oi(x, B) {
- const k = Math.log2(x);
+ function Wi(b, B) {
+ const k = Math.log2(b);
return B == "ROUND_DOWN" ? Math.floor(k) : Math.ceil(k);
}
- function za(x, B, k) {
- let E = 0;
- switch (x.levelMode) {
+ function Za(b, B, k) {
+ let _ = 0;
+ switch (b.levelMode) {
case "ONE_LEVEL":
- E = 1;
+ _ = 1;
break;
case "MIPMAP_LEVELS":
- E = Oi(Math.max(B, k), x.roundingMode) + 1;
+ _ = Wi(Math.max(B, k), b.roundingMode) + 1;
break;
case "RIPMAP_LEVELS":
throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.");
}
- return E;
+ return _;
}
- function Va(x, B, k, E) {
- const R = new Array(x);
- for (let N = 0; N < x; N++) {
- const U = 1 << N;
+ function $a(b, B, k, _) {
+ const R = new Array(b);
+ for (let D = 0; D < b; D++) {
+ const U = 1 << D;
let P = B / U | 0;
- E == "ROUND_UP" && P * U < B && (P += 1);
+ _ == "ROUND_UP" && P * U < B && (P += 1);
const z = Math.max(P, 1);
- R[N] = (z + k - 1) / k | 0;
+ R[D] = (z + k - 1) / k | 0;
}
return R;
}
- function cc() {
- const x = this, B = x.offset, k = { value: 0 };
- for (let E = 0; E < x.tileCount; E++) {
- const R = ke(x.viewer, B), N = ke(x.viewer, B);
- B.value += 8, x.size = Oe(x.viewer, B);
- const U = R * x.blockWidth, P = N * x.blockHeight;
- x.columns = U + x.blockWidth > x.width ? x.width - U : x.blockWidth, x.lines = P + x.blockHeight > x.height ? x.height - P : x.blockHeight;
- const z = x.columns * x.totalBytes, X = x.size < x.lines * z ? x.uncompress(x) : Z(x);
- B.value += x.size;
- for (let ie = 0; ie < x.lines; ie++) {
- const he = ie * x.columns * x.totalBytes;
- for (let ce = 0; ce < x.inputChannels.length; ce++) {
- const fe = Qi.channels[ce].name, Ae = x.channelByteOffsets[fe] * x.columns, _e = x.decodeChannels[fe];
+ function yc() {
+ 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);
+ 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 = qi.channels[ce].name, Ae = b.channelByteOffsets[fe] * b.columns, _e = b.decodeChannels[fe];
if (_e === void 0) continue;
k.value = he + Ae;
- const De = (x.height - (1 + P + ie)) * x.outLineWidth;
- for (let qe = 0; qe < x.columns; qe++) {
- const He = De + (qe + U) * x.outputChannels + _e;
- x.byteArray[He] = x.getter(X, k);
+ 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;
+ b.byteArray[Ve] = b.getter(X, k);
}
}
}
}
}
- function Rr() {
- const x = this, B = x.offset, k = { value: 0 };
- for (let E = 0; E < x.height / x.blockHeight; E++) {
- const R = ke(x.viewer, B) - Qi.dataWindow.yMin;
- x.size = Oe(x.viewer, B), x.lines = R + x.blockHeight > x.height ? x.height - R : x.blockHeight;
- const N = x.columns * x.totalBytes, P = x.size < x.lines * N ? x.uncompress(x) : Z(x);
- B.value += x.size;
- for (let z = 0; z < x.blockHeight; z++) {
- const j = E * x.blockHeight, X = z + x.scanOrder(j);
- if (X >= x.height) continue;
- const ie = z * N, he = (x.height - 1 - X) * x.outLineWidth;
- for (let ce = 0; ce < x.inputChannels.length; ce++) {
- const fe = Qi.channels[ce].name, Ae = x.channelByteOffsets[fe] * x.columns, _e = x.decodeChannels[fe];
+ function Hr() {
+ const b = this, B = b.offset, k = { value: 0 };
+ for (let _ = 0; _ < b.height / b.blockHeight; _++) {
+ 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);
+ B.value += b.size;
+ for (let z = 0; z < b.blockHeight; z++) {
+ const j = _ * 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 = qi.channels[ce].name, Ae = b.channelByteOffsets[fe] * b.columns, _e = b.decodeChannels[fe];
if (_e !== void 0) {
k.value = ie + Ae;
- for (let De = 0; De < x.columns; De++) {
- const qe = he + De * x.outputChannels + _e;
- x.byteArray[qe] = x.getter(P, k);
+ for (let Pe = 0; Pe < b.columns; Pe++) {
+ const je = he + Pe * b.outputChannels + _e;
+ b.byteArray[je] = b.getter(P, k);
}
}
}
}
}
}
- function lc(x, B, k) {
- const E = {};
- if (x.getUint32(0, !0) != 20000630)
+ function wc(b, B, k) {
+ const _ = {};
+ if (b.getUint32(0, !0) != 20000630)
throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");
- E.version = x.getUint8(4);
- const R = x.getUint8(5);
- E.spec = {
+ _.version = b.getUint8(4);
+ const R = b.getUint8(5);
+ _.spec = {
singleTile: !!(R & 2),
longName: !!(R & 4),
deepFormat: !!(R & 8),
multiPart: !!(R & 16)
}, k.value = 8;
- let N = !0;
- for (; N; ) {
- const U = Ve(B, k);
+ let D = !0;
+ for (; D; ) {
+ const U = qe(B, k);
if (U === "")
- N = !1;
+ D = !1;
else {
- const P = Ve(B, k), z = Oe(x, k), j = oc(x, B, k, P, z);
- j === void 0 ? console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`) : E[U] = j;
+ 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;
}
}
if ((R & -7) != 0)
- throw console.error("THREE.EXRHeader:", E), new Error("THREE.EXRLoader: Provided file is currently unsupported.");
- return E;
+ throw console.error("THREE.EXRHeader:", _), new Error("THREE.EXRLoader: Provided file is currently unsupported.");
+ return _;
}
- function Nr(x, B, k, E, R) {
- const N = {
+ function zr(b, B, k, _, R) {
+ const D = {
size: 0,
viewer: B,
array: k,
- offset: E,
- width: x.dataWindow.xMax - x.dataWindow.xMin + 1,
- height: x.dataWindow.yMax - x.dataWindow.yMin + 1,
- inputChannels: x.channels,
+ offset: _,
+ width: b.dataWindow.xMax - b.dataWindow.xMin + 1,
+ height: b.dataWindow.yMax - b.dataWindow.yMin + 1,
+ inputChannels: b.channels,
channelByteOffsets: {},
scanOrder: null,
totalBytes: null,
@@ -32390,114 +33006,114 @@ class nT extends oy {
uncompress: null,
getter: null,
format: null,
- colorSpace: ln
+ colorSpace: An
};
- switch (x.compression) {
+ switch (b.compression) {
case "NO_COMPRESSION":
- N.blockHeight = 1, N.uncompress = Z;
+ D.blockHeight = 1, D.uncompress = Z;
break;
case "RLE_COMPRESSION":
- N.blockHeight = 1, N.uncompress = le;
+ D.blockHeight = 1, D.uncompress = le;
break;
case "ZIPS_COMPRESSION":
- N.blockHeight = 1, N.uncompress = pe;
+ D.blockHeight = 1, D.uncompress = pe;
break;
case "ZIP_COMPRESSION":
- N.blockHeight = 16, N.uncompress = pe;
+ D.blockHeight = 16, D.uncompress = pe;
break;
case "PIZ_COMPRESSION":
- N.blockHeight = 32, N.uncompress = oe;
+ D.blockHeight = 32, D.uncompress = oe;
break;
case "PXR24_COMPRESSION":
- N.blockHeight = 16, N.uncompress = Ue;
+ D.blockHeight = 16, D.uncompress = Qe;
break;
case "DWAA_COMPRESSION":
- N.blockHeight = 32, N.uncompress = ve;
+ D.blockHeight = 32, D.uncompress = ve;
break;
case "DWAB_COMPRESSION":
- N.blockHeight = 256, N.uncompress = ve;
+ D.blockHeight = 256, D.uncompress = ve;
break;
default:
- throw new Error("EXRLoader.parse: " + x.compression + " is unsupported");
+ throw new Error("EXRLoader.parse: " + b.compression + " is unsupported");
}
const U = {};
- for (const X of x.channels)
+ 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;
+ U[X.name] = !0, D.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 };
+ P = !U.A, D.outputChannels = 4, D.decodeChannels = { R: 0, G: 1, B: 2, A: 3 };
else if (U.Y)
- N.outputChannels = 1, N.decodeChannels = { Y: 0 };
+ D.outputChannels = 1, D.decodeChannels = { Y: 0 };
else
throw new Error("EXRLoader.parse: file contains unsupported data channels.");
- if (N.type == 1)
+ if (D.type == 1)
switch (R) {
- case an:
- N.getter = de;
+ case fn:
+ D.getter = de;
break;
- case Rn:
- N.getter = re;
+ case Qn:
+ D.getter = re;
break;
}
- else if (N.type == 2)
+ else if (D.type == 2)
switch (R) {
- case an:
- N.getter = tt;
+ case fn:
+ D.getter = nt;
break;
- case Rn:
- N.getter = W;
+ case Qn:
+ D.getter = W;
}
else
- throw new Error("EXRLoader.parse: unsupported pixelType " + N.type + " for " + x.compression + ".");
- N.columns = N.width;
- const z = N.width * N.height * N.outputChannels;
+ 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 an:
- N.byteArray = new Float32Array(z), P && N.byteArray.fill(1, 0, z);
+ case fn:
+ D.byteArray = new Float32Array(z), P && D.byteArray.fill(1, 0, z);
break;
- case Rn:
- N.byteArray = new Uint16Array(z), P && N.byteArray.fill(15360, 0, z);
+ case Qn:
+ 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 x.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, x.lineOrder === "INCREASING_Y" ? N.scanOrder = (X) => X : N.scanOrder = (X) => N.height - 1 - X, N.outputChannels == 4 ? (N.format = on, N.colorSpace = ln) : (N.format = ns, N.colorSpace = Ai), x.spec.singleTile) {
- N.blockHeight = x.tiles.ySize, N.blockWidth = x.tiles.xSize;
- const X = za(x.tiles, N.width, N.height), ie = Va(X, N.width, x.tiles.xSize, x.tiles.roundingMode), he = Va(X, N.height, x.tiles.ySize, x.tiles.roundingMode);
- N.tileCount = ie[0] * he[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];
for (let ce = 0; ce < X; ce++)
for (let fe = 0; fe < he[ce]; fe++)
for (let Ae = 0; Ae < ie[ce]; Ae++)
- We(B, E);
- N.decode = cc.bind(N);
+ Ke(B, _);
+ D.decode = yc.bind(D);
} else {
- N.blockWidth = N.width;
- const X = Math.ceil(N.height / N.blockHeight);
+ D.blockWidth = D.width;
+ const X = Math.ceil(D.height / D.blockHeight);
for (let ie = 0; ie < X; ie++)
- We(B, E);
- N.decode = Rr.bind(N);
- }
- return N;
- }
- const Wa = { value: 0 }, qa = new DataView(e), hh = new Uint8Array(e), Qi = lc(qa, e, Wa), gs = Nr(Qi, qa, hh, Wa, this.type);
- return gs.decode(), {
- header: Qi,
- width: gs.width,
- height: gs.height,
- data: gs.byteArray,
- format: gs.format,
- colorSpace: gs.colorSpace,
+ Ke(B, _);
+ D.decode = Hr.bind(D);
+ }
+ return D;
+ }
+ 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);
+ return ws.decode(), {
+ header: qi,
+ width: ws.width,
+ height: ws.height,
+ data: ws.byteArray,
+ format: ws.format,
+ colorSpace: ws.colorSpace,
type: this.type
};
}
@@ -32512,15 +33128,15 @@ class nT extends oy {
}
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);
+ a.colorSpace = o.colorSpace, a.minFilter = Xt, a.magFilter = Xt, a.generateMipmaps = !1, a.flipY = !1, t && t(a, o);
}
return super.load(e, r, n, s);
}
}
-function iT(i, e) {
+function iR(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 nT().load(
+ new nR().load(
n,
(a) => {
const o = i.pmremGenerator.fromEquirectangular(a).texture;
@@ -32531,29 +33147,1756 @@ function iT(i, e) {
);
});
}
-function sT(i) {
+function sR(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"), rT(i);
+ }, "image/png"), rR(i);
}
-function rT(i) {
+function rR(i) {
const e = document.createElement("div");
e.className = "screenshot-flash", i.el.appendChild(e), e.addEventListener("animationend", () => e.remove());
}
-function aT(i, e) {
- i.mixer && (i.mixer.stopAllAction(), i.mixer.uncacheRoot(i.mixer.getRoot()), i.mixer = null), i.clips = e, e.length && (i.mixer = new h0(i.content));
+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 oT(i) {
+function oR(i) {
i.clips.forEach((e) => {
i.mixer.clipAction(e).reset().play(), i.state.actionStates[e.name] = !0;
}), i.invalidate();
}
-const cT = 0.35;
-class lT {
+function jx(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 cR(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 lR(i, e, t, n) {
+ const s = jx(i, n, e), r = cR(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) {
+ 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, 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;
+ 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;
+ }
+ }
+ 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 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 = [];
+ 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 mt(0, 0, 0);
+ return a;
+}
+function dR(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 fR(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(dR(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);
+}
+class AR extends Fy {
+ /**
+ * Constructs a new NURBS curve.
+ *
+ * @param {number} degree - The NURBS degree.
+ * @param {Array<number>} knots - The knots as a flat array of numbers.
+ * @param {Array<Vector2|Vector3|Vector4>} controlPoints - An array holding control points.
+ * @param {number} [startKnot] - Index of the start knot into the `knots` array.
+ * @param {number} [endKnot] - Index of the end knot into the `knots` array.
+ */
+ 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 mt(l.x, l.y, l.z, l.w);
+ }
+ }
+ /**
+ * This method returns a vector in 3D space for the given interpolation factor.
+ *
+ * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
+ * @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
+ * @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);
+ return r.w !== 1 && r.divideScalar(r.w), n.set(r.x, r.y, r.z);
+ }
+ /**
+ * Returns a unit vector tangent for the given interpolation factor.
+ *
+ * @param {number} t - The interpolation factor.
+ * @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
+ * @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);
+ 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 mt(t[0], t[1], t[2], t[3])), this.startKnot = e.startKnot, this.endKnot = e.endKnot, this;
+ }
+}
+let ut, Yt, kn;
+class gR extends fi {
+ /**
+ * Constructs a new FBX loader.
+ *
+ * @param {LoadingManager} [manager] - The loading manager.
+ */
+ constructor(e) {
+ super(e);
+ }
+ /**
+ * Starts loading from the given URL and passes the loaded FBX asset
+ * to the `onLoad()` callback.
+ *
+ * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+ * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+ * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+ * @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);
+ 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);
+ }
+ /**
+ * Parses the given FBX data and returns the resulting group.
+ *
+ * @param {ArrayBuffer} FBXBuffer - The raw FBX data as an array buffer.
+ * @param {string} path - The URL base path.
+ * @return {Group} An object representing the parsed asset.
+ */
+ parse(e, t) {
+ if (yR(e))
+ ut = new _R().parse(e);
+ else {
+ const s = Jx(e);
+ if (!wR(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);
+ }
+ const n = new G0(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
+ return new mR(n, this.manager).parse(ut);
+ }
+}
+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);
+ return this.parseScene(s, r, n), kn;
+ }
+ // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
+ // and details the connection type
+ parseConnections() {
+ const e = /* @__PURE__ */ new Map();
+ return "Connections" in ut && ut.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;
+ }
+ // Parse FBXTree.Objects.Video for embedded image data
+ // These images are connected to textures in FBXTree.Objects.Textures
+ // via FBXTree.Connections.
+ parseImages() {
+ const e = {}, t = {};
+ if ("Video" in ut.Objects) {
+ const n = ut.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;
+ }
+ // Parse embedded image data in FBXTree.Video.Content
+ 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 }));
+ }
+ }
+ // Parse nodes in FBXTree.Objects.Texture
+ // These contain details such as UV scaling, cropping, rotation etc and are connected
+ // to images in FBXTree.Objects.Video
+ parseTextures(e) {
+ const t = /* @__PURE__ */ new Map();
+ if ("Texture" in ut.Objects) {
+ const n = ut.Objects.Texture;
+ for (const s in n) {
+ const r = this.parseTexture(n[s], e);
+ t.set(parseInt(s), r);
+ }
+ }
+ return t;
+ }
+ // Parse individual node in FBXTree.Objects.Texture
+ 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 ? Ws : ti, n.wrapT = o === 0 ? Ws : ti, "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;
+ }
+ // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
+ loadTexture(e, t) {
+ const n = /* @__PURE__ */ 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 an();
+ const a = r.path;
+ a || r.setPath(this.textureLoader.path);
+ const o = Yt.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;
+ }
+ // Parse nodes in FBXTree.Objects.Material
+ parseMaterials(e) {
+ const t = /* @__PURE__ */ new Map();
+ if ("Material" in ut.Objects) {
+ const n = ut.Objects.Material;
+ for (const s in n) {
+ const r = this.parseMaterial(n[s], e);
+ r !== null && t.set(parseInt(s), r);
+ }
+ }
+ return t;
+ }
+ // Parse single node in FBXTree.Objects.Material
+ // Materials are connected to texture maps in FBXTree.Objects.Textures
+ // FBX format currently only supports Lambert and Phong shading models
+ parseMaterial(e, t) {
+ const n = e.id, s = e.attrName;
+ let r = e.ShadingModel;
+ if (typeof r == "object" && (r = r.value), !Yt.has(n)) return null;
+ const a = this.parseParameters(e, t, n);
+ let o;
+ switch (r.toLowerCase()) {
+ case "phong":
+ o = new Xc();
+ break;
+ case "lambert":
+ o = new Jy();
+ break;
+ default:
+ console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', r), o = new Xc();
+ break;
+ }
+ return o.setValues(a), o.name = s, o;
+ }
+ // Parse FBX material and return parameters suitable for a three.js material
+ // Also parse the texture map and return any textures associated with the material
+ parseParameters(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));
+ const r = this;
+ return Yt.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 = Fl, 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;
+ // NOTE: Seems to be a copy of DisplacementColor
+ default:
+ console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", o);
+ break;
+ }
+ }), s;
+ }
+ // get a texture from the textureMap for use by a material.
+ getTexture(e, t) {
+ return "LayeredTexture" in ut.Objects && t in ut.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), t = Yt.get(t).children[0].ID), e.get(t);
+ }
+ // Parse nodes in FBXTree.Objects.Deformer
+ // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
+ // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
+ parseDeformers() {
+ const e = {}, t = {};
+ if ("Deformer" in ut.Objects) {
+ const n = ut.Objects.Deformer;
+ for (const s in n) {
+ const r = n[s], a = Yt.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
+ };
+ }
+ // Parse single nodes in FBXTree.Objects.Deformer
+ // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
+ // Each skin node represents a skeleton and each cluster node represents a bone
+ 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 De().fromArray(r.TransformLink.a)
+ // transform: new Matrix4().fromArray( boneNode.Transform.a ),
+ // linkMode: boneNode.Mode,
+ };
+ "Indexes" in r && (a.indices = r.Indexes.a, a.weights = r.Weights.a), n.push(a);
+ }), {
+ rawBones: n,
+ bones: []
+ };
+ }
+ // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
+ 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 = Yt.get(parseInt(r.ID)).children.filter(function(c) {
+ return c.relationship === void 0;
+ })[0].ID, n.push(o);
+ }
+ return n;
+ }
+ // create the main Group() to be returned by the loader
+ parseScene(e, t, n) {
+ kn = new hs();
+ const s = this.parseModels(e.skeletons, t, n), r = ut.Objects.Model, a = this;
+ s.forEach(function(c) {
+ const l = r[c.ID];
+ a.setLookAtProperties(c, l), Yt.get(c.ID).parents.forEach(function(u) {
+ const d = s.get(u.ID);
+ d !== void 0 && d.add(c);
+ }), c.parent === null && kn.add(c);
+ }), this.bindSkeleton(e.skeletons, t, s), this.addGlobalSceneSettings(), kn.traverse(function(c) {
+ 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);
+ c.applyMatrix4(l), c.updateWorldMatrix();
+ }
+ });
+ const o = new bR().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
+ parseModels(e, t, n) {
+ const s = /* @__PURE__ */ new Map(), r = ut.Objects.Model;
+ for (const a in r) {
+ const o = parseInt(a), c = r[a], l = Yt.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 zl();
+ break;
+ default:
+ h = new hs();
+ 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 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;
+ }
+ // create a PerspectiveCamera or OrthographicCamera
+ createCamera(e) {
+ let t, n;
+ if (e.children.forEach(function(s) {
+ const r = ut.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 Sn(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;
+ }
+ // Create a DirectionalLight, PointLight or SpotLight
+ createLight(e) {
+ let t, n;
+ if (e.children.forEach(function(s) {
+ const r = ut.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 = rt.toWorkingColorSpace(new Le().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 Kl(r, a, o, c);
+ break;
+ case 1:
+ 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);
+ break;
+ default:
+ console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new Kl(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 Xc({
+ name: fi.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 Xc();
+ o.push(l);
+ }
+ }
+ return r.FBX_Deformer ? (s = new T0(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({
+ name: fi.DEFAULT_MATERIAL_NAME,
+ color: 3342591,
+ linewidth: 1
+ });
+ return new fh(n, s);
+ }
+ // parse the model node for transform data
+ getTransformData(e, t) {
+ const n = {};
+ "InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder = 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;
+ }
+ setLookAtProperties(e, t) {
+ "LookAtProperty" in t && Yt.get(e.ID).children.forEach(function(s) {
+ if (s.relationship === "LookAtProperty") {
+ const r = ut.Objects.Model[s.ID];
+ if ("Lcl_Translation" in r) {
+ const a = r.Lcl_Translation.value;
+ e.target !== void 0 ? (e.target.position.fromArray(a), kn.add(e.target)) : e.lookAt(new G().fromArray(a));
+ }
+ }
+ });
+ }
+ bindSkeleton(e, t, n) {
+ const s = this.parsePoseNodes();
+ for (const r in e) {
+ const a = e[r];
+ Yt.get(parseInt(a.ID)).parents.forEach(function(c) {
+ 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]);
+ });
+ }
+ });
+ }
+ }
+ parsePoseNodes() {
+ const e = {};
+ if ("Pose" in ut.Objects) {
+ const t = ut.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 De().fromArray(r.Matrix.a);
+ }) : e[s.Node] = new De().fromArray(s.Matrix.a);
+ }
+ }
+ return e;
+ }
+ addGlobalSceneSettings() {
+ if ("GlobalSettings" in ut) {
+ 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));
+ }
+ }
+ "UnitScaleFactor" in ut.GlobalSettings && (kn.userData.unitScaleFactor = ut.GlobalSettings.UnitScaleFactor.value);
+ }
+ }
+}
+class xR {
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 vf(), this.onChange = null, this._gltfCache = /* @__PURE__ */ new Map(), this._animationDefs = [];
+ this.negativeMaterialIndices = !1;
+ }
+ // Parse nodes in FBXTree.Objects.Geometry
+ parse(e) {
+ const t = /* @__PURE__ */ new Map();
+ if ("Geometry" in ut.Objects) {
+ const n = ut.Objects.Geometry;
+ for (const s in n) {
+ const r = Yt.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;
+ }
+ // Parse single node in FBXTree.Objects.Geometry
+ parseGeometry(e, t, n) {
+ switch (t.attrType) {
+ case "Mesh":
+ return this.parseMeshGeometry(e, t, n);
+ case "NurbsCurve":
+ return this.parseNurbsGeometry(t);
+ }
+ }
+ // Parse single node mesh geometry in FBXTree.Objects.Geometry
+ parseMeshGeometry(e, t, n) {
+ const s = n.skeletons, r = [], a = e.parents.map(function(u) {
+ return ut.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 = 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);
+ return this.genGeometry(t, o, r, h);
+ }
+ // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
+ genGeometry(e, t, n, s) {
+ 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) {
+ const l = new at().getNormalMatrix(s), h = new en(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 en(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 = [], y = [];
+ if (a.push(f * 3, f * 3 + 1, f * 3 + 2), e.color) {
+ const x = ul(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) {
+ 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];
+ 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, y = E;
+ }
+ for (; y.length < 4; )
+ y.push(0), A.push(0);
+ for (let x = 0; x < 4; ++x)
+ h.push(y[x]), u.push(A[x]);
+ }
+ if (e.normal) {
+ const x = ul(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]);
+ }), s++, g && (d.genFace(t, e, a, m, o, c, l, h, u, s), n++, s = 0, a = [], o = [], c = [], l = [], h = [], u = []);
+ }), t;
+ }
+ // See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
+ 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) > 0.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 Ze(
+ e.dot(t),
+ e.dot(n)
+ );
+ }
+ // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
+ 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 = Wf.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 = ut.Objects.Geometry[o.geoID];
+ c !== void 0 && r.genMorphGeometry(e, t, c, s, o.name);
+ });
+ });
+ }
+ // a morph geometry node is similar to a standard node, and the node is also contained
+ // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
+ // and a special attribute Index defining which vertices of the original geometry are affected
+ // Normal and position attributes only have data for the vertices that are affected by the morph
+ 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 en(f.vertex, 3);
+ p.name = r || n.attrName, p.applyMatrix4(s), e.morphAttributes.position.push(p);
+ }
+ // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
+ 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
+ };
+ }
+ // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
+ 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
+ };
+ }
+ // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
+ 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 Le(); a < s.length; a += 4)
+ o.fromArray(s, a), rt.toWorkingColorSpace(o, yt), o.toArray(s, a);
+ return {
+ dataSize: 4,
+ buffer: s,
+ indices: r,
+ mappingType: t,
+ referenceType: n
+ };
+ }
+ // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
+ 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
+ };
+ }
+ // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
+ 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 Tn();
+ 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 mt().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 AR(n, s, r, o, c).getPoints(r.length * 12);
+ return new Tn().setFromPoints(h);
+ }
+}
+class bR {
+ // take raw animation clips and turn them into three.js animation clips
+ 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 (ut.Objects.AnimationCurve === void 0) return;
+ const e = this.parseAnimationCurveNodes();
+ this.parseAnimationCurves(e);
+ const t = this.parseAnimationLayers(e);
+ return this.parseAnimStacks(t);
+ }
+ // parse nodes in FBXTree.Objects.AnimationCurveNode
+ // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
+ // and is referenced by an AnimationLayer
+ parseAnimationCurveNodes() {
+ const e = ut.Objects.AnimationCurveNode, t = /* @__PURE__ */ 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;
+ }
+ // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
+ // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
+ // axis ( e.g. times and values of x rotation)
+ parseAnimationCurves(e) {
+ const t = ut.Objects.AnimationCurve;
+ for (const n in t) {
+ const s = {
+ id: t[n].id,
+ times: t[n].KeyTime.a.map(vR),
+ values: t[n].KeyValueFloat.a
+ }, r = Yt.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);
+ }
+ }
+ }
+ // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
+ // to various AnimationCurveNodes and is referenced by an AnimationStack node
+ // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
+ parseAnimationLayers(e) {
+ const t = ut.Objects.AnimationLayer, n = /* @__PURE__ */ new Map();
+ for (const s in t) {
+ const r = [], a = Yt.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 = Yt.get(c.ID).parents.filter(function(d) {
+ return d.relationship !== void 0;
+ })[0].ID;
+ if (u !== void 0) {
+ const d = ut.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]
+ };
+ 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;
+ }
+ }
+ r[l] && (r[l][h.attr] = h);
+ } else if (h.curves.morph !== void 0) {
+ if (r[l] === void 0) {
+ 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) : "",
+ morphName: ut.Objects.Deformer[u].attrName
+ };
+ r[l] = g;
+ }
+ r[l][h.attr] = h;
+ }
+ }
+ }), n.set(parseInt(s), r));
+ }
+ return n;
+ }
+ // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
+ // hierarchy. Each Stack node will be used to create an AnimationClip
+ parseAnimStacks(e) {
+ const t = ut.Objects.AnimationStack, n = {};
+ for (const s in t) {
+ const r = Yt.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 ql(e.name, -1, t);
+ }
+ generateTracks(e) {
+ const t = [];
+ let n = new G(), s = new G();
+ if (e.transform && e.transform.decompose(n, new Jt(), 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 Rr(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 = Zo(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]);
+ 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 Jt().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 = kn.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];
+ return new Tr(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
+ 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;
+ }
+ // Rotations are defined as Euler angles which can have values of any size
+ // These will be converted to quaternions which don't support values greater than
+ // PI, so we'll interpolate large rotations
+ interpolateRotations(e, t, n, s) {
+ const r = [], a = [];
+ r.push(e.times[0]), a.push(Cn.degToRad(e.values[0])), a.push(Cn.degToRad(t.values[0])), a.push(Cn.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(Cn.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(Cn.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), 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();
+ 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);
+ } else
+ r.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 {
+ 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 Xx(), 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], SR(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));
+ }
+ parseNodePropertyContinued(e) {
+ const t = this.getCurrentNode();
+ t.a += e, e.slice(-1) !== "," && (t.a = Gu(t.a));
+ }
+ // parse "Property70"
+ 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 = Gu(l);
+ break;
+ }
+ this.getPrevNode()[r] = {
+ type: a,
+ type2: o,
+ flag: c,
+ value: l
+ }, this.setCurrentProp(this.getPrevNode(), r);
+ }
+}
+class _R {
+ parse(e) {
+ const t = new Vg(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();
+ for (; !this.endOfContent(t); ) {
+ const r = this.parseNode(t, n);
+ r !== null && s.add(r.name, r);
+ }
+ return s;
+ }
+ // Check if reader has reached the end of content.
+ endOfContent(e) {
+ return e.size() % 16 === 0 ? (e.getOffset() + 160 + 16 & -16) >= e.size() : e.getOffset() + 160 + 16 >= e.size();
+ }
+ // recursively parse nodes until the end of the file is reached
+ 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 Vg(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;
+ // cannot happen but is required by the DeepScan
+ default:
+ throw new Error("THREE.FBXLoader: Unknown property type " + t);
+ }
+ }
+}
+class Vg {
+ 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;
+ }
+ // seems like true/false representation depends on exporter.
+ // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
+ // then sees LSB.
+ 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;
+ }
+ // JavaScript doesn't support 64-bit integer so calculate this here
+ // 1 << 32 will return 1 so using multiply operation instead here.
+ // There's a possibility that this method returns wrong value if the value
+ // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
+ // TODO: safely handle 64-bit integer
+ 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;
+ }
+ // Note: see getInt64() comment
+ 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 Xx {
+ add(e, t) {
+ this[e] = t;
+ }
+}
+function yR(i) {
+ const e = "Kaydara FBX Binary \0";
+ return i.byteLength >= e.length && e === Jx(i, 0, e.length);
+}
+function wR(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 Wg(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) {
+ return i / 46186158e3;
+}
+const CR = [];
+function ul(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 IR(CR, 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);
+ if (i.preRotation) {
+ const F = i.preRotation.map(Cn.degToRad);
+ F.push(p), t.makeRotationFromEuler(Qu.fromArray(F));
+ }
+ if (i.rotation) {
+ const F = i.rotation.map(Cn.degToRad);
+ F.push(i.eulerOrder || p), n.makeRotationFromEuler(Qu.fromArray(F));
+ }
+ if (i.postRotation) {
+ const F = i.postRotation.map(Cn.degToRad);
+ F.push(p), s.makeRotationFromEuler(Qu.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();
+ g.extractRotation(h);
+ const A = new De();
+ A.copyPosition(h);
+ const y = A.clone().invert().multiply(h), x = g.clone().invert().multiply(y), E = r, I = new De();
+ 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 De().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 De().copyPosition(T), v = h.clone().multiply(C);
+ return d.copyPosition(v), T = d.clone().multiply(I), T.premultiply(h.invert()), T;
+}
+function Zo(i) {
+ i = i || 0;
+ const e = [
+ "ZYX",
+ // -> XYZ extrinsic
+ "YZX",
+ // -> XZY extrinsic
+ "XZY",
+ // -> YZX extrinsic
+ "ZXY",
+ // -> YXZ extrinsic
+ "YXZ",
+ // -> ZXY extrinsic
+ "XYZ"
+ // -> ZYX extrinsic
+ //'SphericXYZ', // not possible to support
+ ];
+ 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) {
+ return i.split(",").map(function(t) {
+ return parseFloat(t);
+ });
+}
+function Jx(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) {
+ for (let t = 0, n = i.length, s = e.length; t < s; t++, n++)
+ i[n] = e[t];
+}
+function IR(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 {
+ 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 = [];
}
/**
* Attach the manager to a loaded model. Creates a new mixer.
@@ -32561,7 +34904,7 @@ class lT {
* @param {THREE.Object3D} model
*/
attach(e) {
- this.detach(), this.model = e, this.mixer = new h0(e), this.actions.clear(), this.currentAction = null, this.currentName = null;
+ this.detach(), this.model = e, this.mixer = new V0(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);
@@ -32601,15 +34944,20 @@ class lT {
if (this.clips.has(e))
return this.clips.get(e);
let s;
- this._gltfCache.has(t) ? s = this._gltfCache.get(t) : (s = await new Promise((a, o) => {
- this.loader.load(t, a, void 0, o);
- }), this._gltfCache.set(t, 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.animations.find((a) => a.name === n.clipName), r || (console.warn(`[AnimationManager] Clip "${n.clipName}" not found in ${t}, using first clip`), r = s.animations[0])) : r = s.animations[0], !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 ? Om : Qm), n.loop === !1 && (o.clampWhenFinished = !0), this.actions.set(e, o);
+ o.enabled = !0, o.setLoop(n.loop === !1 ? m0 : x0), n.loop === !1 && (o.clampWhenFinished = !0), this.actions.set(e, o);
}
return r;
}
@@ -32648,7 +34996,7 @@ class lT {
* @param {string} name
* @param {number} [duration] - Crossfade duration in seconds
*/
- crossfadeTo(e, t = cT) {
+ crossfadeTo(e, t = MR) {
if (e === this.currentName) return;
const n = this.actions.get(e);
if (!n) {
@@ -32681,25 +35029,27 @@ class lT {
_retargetClip(e, t) {
if (!this.model) return e;
const n = /* @__PURE__ */ new Set();
- if (this.model.traverse((o) => {
- o.isBone && n.add(o.name);
+ if (this.model.traverse((l) => {
+ l.isBone && n.add(l.name);
}), n.size === 0) return e;
const s = /* @__PURE__ */ new Set();
- for (const o of e.tracks) {
- const c = o.name.split(".")[0];
- s.add(c);
+ for (const l of e.tracks) {
+ const h = l.name.split(".")[0];
+ s.add(h);
}
let r = 0;
- for (const o of s)
- n.has(o) && r++;
+ for (const l of s)
+ n.has(l) && r++;
if (r / s.size > 0.5) return e;
const a = this._buildBoneNameMap(n, s);
- return a ? (e.tracks.map((o) => {
- const c = o.name.split("."), l = c[0], h = c.slice(1).join("."), u = a.get(l);
- if (!u) return null;
- const d = o.clone();
- return d.name = `${u}.${h}`, d;
- }).filter(Boolean), e.clone().resetDuration()) : e;
+ 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;
}
/**
* Attempts to build a bone name mapping between two skeleton naming conventions.
@@ -32743,15 +35093,15 @@ class lT {
this.detach(), this.clips.clear(), this._gltfCache.clear(), this._animationDefs = [];
}
}
-ss.enabled = !0;
-class pb {
+us.enabled = !0;
+class Zx {
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 lT(), this._animPanelEl = null, this.state = {
- environment: t.preset === Td.ASSET_GENERATOR ? Gc.find((r) => r.id === "footprint-court").name : Gc[1].name,
+ 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,
background: !1,
playbackSpeed: 1,
actionStates: {},
- camera: Kc,
+ camera: hl,
wireframe: !1,
skeleton: !1,
grid: !1,
@@ -32759,7 +35109,7 @@ class pb {
// Lights
punctualLights: !0,
exposure: 0,
- toneMapping: Hu,
+ toneMapping: Ad,
ambientIntensity: 0.3,
ambientColor: "#FFFFFF",
directIntensity: 0.8 * Math.PI,
@@ -32773,9 +35123,9 @@ class pb {
showLabels: !1,
// Avatar follow mode
followMode: "mouse"
- }, this.prevTime = 0, this.stats = new _o(), this.stats.dom.height = "48px", [].forEach.call(this.stats.dom.children, (r) => r.style.display = ""), this.backgroundColor = new je(this.state.bgColor), this.scene = new ud(), this.scene.background = this.backgroundColor;
- const n = t.preset === Td.ASSET_GENERATOR ? 0.8 * 180 / Math.PI : 60, s = e.clientWidth / e.clientHeight;
- this.defaultCamera = new vn(n, s, 0.01, 1e3), this.activeCamera = this.defaultCamera, this.scene.add(this.defaultCamera), this.renderer = window.renderer = new EA({ 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 Ad(this.renderer), this.pmremGenerator.compileEquirectangularShader(), this.neutralEnvironment = this.pmremGenerator.fromScene(new l1()).texture, this.controls = new YI(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 H(), 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 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 = () => {
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(
@@ -32822,16 +35172,16 @@ class pb {
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() {
- sT(this);
+ sR(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 = da.extractUrlBase(e);
+ const s = wr.extractUrlBase(e);
return new Promise((r, a) => {
- Rl.setURLModifier((l, h) => {
+ Zl.setURLModifier((l, h) => {
const u = t + decodeURI(l).replace(s, "").replace(/^(\.?\/)/, "");
if (n.has(u)) {
const d = n.get(u), f = URL.createObjectURL(d);
@@ -32839,7 +35189,7 @@ class pb {
}
return (h || "") + l;
});
- const o = new vf(Rl).setCrossOrigin("anonymous").setDRACOLoader(kB).setKTX2Loader(UB.detectSupport(this.renderer)).setMeshoptDecoder(jI), c = [];
+ const o = new Zf(Zl).setCrossOrigin("anonymous").setDRACOLoader(kT).setKTX2Loader(UT.detectSupport(this.renderer)).setMeshoptDecoder(j1), c = [];
o.load(
e,
(l) => {
@@ -32862,46 +35212,46 @@ class pb {
*/
setContent(e, t) {
this.clear(), e.updateMatrixWorld();
- const n = new Pi().setFromObject(e), s = n.getSize(new H()).length(), r = n.getCenter(new H());
- 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 H())) : (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(Kc), this.axesCamera.position.copy(this.defaultCamera.position), this.axesCamera.lookAt(this.axesScene.position), this.axesCamera.near = s / 100, this.axesCamera.far = s * 100, this.axesCamera.updateProjectionMatrix(), this.axesCorner.scale.set(s, s, s), this.controls.saveState(), this.scene.add(e), this.content = e, this.state.punctualLights = !0, this.content.traverse((a) => {
+ const n = new 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) => {
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) {
- aT(this, e);
+ aR(this, e);
}
playAllClips() {
- oT(this);
+ oR(this);
}
/**
* @param {string} name
*/
setCamera(e) {
- e === Kc ? (this.controls.enabled = !0, this.activeCamera = this.defaultCamera) : (this.controls.enabled = !1, this.content.traverse((t) => {
+ e === hl ? (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 ? OB(this) : !e.punctualLights && t.length && QB(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 ? 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();
}
updateEnvironment() {
- const e = Gc.filter(
+ const e = sl.filter(
(t) => t.name === this.state.environment
)[0];
- iT(this, e).then(({ envMap: t }) => {
+ iR(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)), dg(this.content, (e) => {
- e.wireframe = this.state.wireframe, e instanceof bf && (e.size = this.state.pointSize);
+ 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.content.traverse((e) => {
if (e.geometry && e.skeleton && this.state.skeleton) {
- const t = new By(e.skeleton.bones[0].parent);
+ const t = new Bw(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 Ty(), this.axesHelper = new Xp(), 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 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();
}
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();
@@ -32920,12 +35270,12 @@ class pb {
* See: https://stackoverflow.com/q/16226693/1314762
*/
updateModelInfo(e, t) {
- this.modelInfo && (this.modelInfo.remove(), this.modelInfo = null), this.state.showInfo && e && (this.modelInfo = AB(this.el, e, t));
+ this.modelInfo && (this.modelInfo.remove(), this.modelInfo = null), this.state.showInfo && e && (this.modelInfo = AT(this.el, e, t));
}
updateAnnotations() {
if (this.annotationEls.forEach((t) => t.el.remove()), this.annotationEls = [], !this.state.showLabels || !this.content) return;
- bB(this.content).forEach((t) => {
- const n = xB(t), s = document.createElement("div");
+ xT(this.content).forEach((t) => {
+ const n = bT(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();
}
@@ -32944,44 +35294,44 @@ class pb {
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 ud(), this.axesCamera = new vn(50, e / t, 0.1, 10), this.axesScene.add(this.axesCamera), this.axesRenderer = new EA({ 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 Xp(5), this.axesScene.add(this.axesCorner), this.axesDiv.appendChild(this.axesRenderer.domElement);
+ 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);
}
addGUI() {
- const e = window.innerWidth <= 700, t = this.gui = new R1({
+ const e = window.innerWidth <= 700, t = this.gui = new RM({
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 m = t.addFolder("Lighting");
- m.add(
+ const p = t.addFolder("Lighting");
+ p.add(
this.state,
"environment",
- Gc.map((w) => w.name)
+ sl.map((w) => w.name)
).onChange(() => this.updateEnvironment()), [
- m.add(this.state, "toneMapping", {
- Linear: Hu,
- "ACES Filmic": Tm
+ p.add(this.state, "toneMapping", {
+ Linear: Ad,
+ "ACES Filmic": c0
}),
- m.add(this.state, "exposure", -10, 10, 0.01),
- m.add(this.state, "punctualLights").listen(),
- m.add(this.state, "ambientIntensity", 0, 2),
- m.addColor(this.state, "ambientColor"),
- m.add(this.state, "directIntensity", 0, 4),
+ p.add(this.state, "exposure", -10, 10, 0.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),
// TODO(#116)
- m.addColor(this.state, "directColor")
+ 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 y = t.addFolder("Performance"), b = document.createElement("li");
- this.stats.dom.style.position = "static", b.appendChild(this.stats.dom), b.classList.add("gui-stats"), y.__ul.appendChild(b);
- const _ = document.createElement("div");
- this.el.appendChild(_), _.classList.add("gui-wrap"), _.classList.add("gui-wrap--hidden"), _.appendChild(t.domElement), this._guiWrap = _;
- const M = document.createElement("button");
- M.className = "gui-toggle", M.setAttribute("title", "Toggle advanced controls"), M.setAttribute("aria-label", "Toggle advanced controls"), M.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>', M.addEventListener("click", () => {
- const w = _.classList.toggle("gui-wrap--hidden");
- M.classList.toggle("gui-toggle--active", !w);
- }), this.el.appendChild(M), this._guiToggle = M, e ? t.close() : t.open();
+ 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 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";
@@ -32990,7 +35340,7 @@ class pb {
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 = [Kc].concat(e);
+ const n = [hl].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) => {
@@ -33103,7 +35453,7 @@ class pb {
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();
- }), dg(this.content, (e) => {
+ }), zg(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());
@@ -33121,7 +35471,7 @@ class pb {
}
}
}
-class hT {
+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;
}
@@ -33170,7 +35520,7 @@ class hT {
return { role: "assistant", content: n };
}
}
-class uT {
+class RR {
// Used when brain.provider === "none" — skills drive the agent.
async complete() {
return { text: "", toolCalls: [], stopReason: "end_turn" };
@@ -33182,13 +35532,13 @@ class uT {
return { role: "assistant", content: e || "" };
}
}
-function dT(i = {}) {
+function FR(i = {}) {
const e = i.provider || "anthropic";
- if (e === "anthropic") return new hT(i);
- if (e === "none") return new uT();
+ if (e === "anthropic") return new TR(i);
+ if (e === "none") return new RR();
throw new Error(`Unsupported provider: ${e}. Supported: anthropic, none`);
}
-class fT {
+class DR {
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;
}
@@ -33223,7 +35573,7 @@ class fT {
return e.find((t) => t.lang?.startsWith(this.lang.slice(0, 2))) || null;
}
}
-class pT {
+class NR {
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;
}
@@ -33263,7 +35613,7 @@ class pT {
return this._listening;
}
}
-class AT {
+class LR {
constructor({
voiceId: e,
modelId: t = "eleven_turbo_v2_5",
@@ -33420,20 +35770,20 @@ class AT {
this._startedFired = !1;
}
}
-function gT(i = {}) {
+function PR(i = {}) {
const e = i.provider || "browser";
if (e === "none") return null;
- if (e === "browser") return new fT(i);
- if (e === "elevenlabs") return new AT(i);
+ if (e === "browser") return new DR(i);
+ if (e === "elevenlabs") return new LR(i);
throw new Error(`TTS provider "${e}" not implemented yet`);
}
-function mT(i = {}) {
+function kR(i = {}) {
const e = i.provider || "browser";
if (e === "none") return null;
- if (e === "browser") return new pT(i);
+ if (e === "browser") return new NR(i);
throw new Error(`STT provider "${e}" not implemented yet`);
}
-const fg = [
+const qg = [
{
name: "wave",
description: "Wave at the user. Use for greetings, farewells, or acknowledgments.",
@@ -33508,7 +35858,25 @@ const fg = [
required: ["key", "name", "description", "type", "body"]
}
}
-], bT = {
+], UR = [
+ {
+ 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"]
+ }
+ }
+], OR = {
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 };
@@ -33542,13 +35910,13 @@ const fg = [
const s = e.agentId || "anon";
return e.stage.broadcast(s, { kind: "direct", to: t, text: n }), e.stage.routeMessage(s, t, n);
}
-}, xT = 8;
-class ET extends EventTarget {
+}, QR = 8;
+class GR 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 = dT({
+ super(), this.manifest = e || {}, this.viewer = t, this.memory = n, this.skills = s, this.stage = o, this.agentId = c, this.provider = FR({
...this.manifest.brain,
...r
- }), this.tts = gT({ ...this.manifest.voice?.tts, ...a.tts }), this.stt = mT({ ...this.manifest.voice?.stt, ...a.stt }), this.messages = [], this._busy = !1;
+ }), this.tts = PR({ ...this.manifest.voice?.tts, ...a.tts }), this.stt = kR({ ...this.manifest.voice?.stt, ...a.stt }), this.messages = [], this._busy = !1;
}
get systemPrompt() {
const e = [];
@@ -33561,8 +35929,8 @@ class ET extends EventTarget {
</memory>`), this.skills && e.push(this.skills.systemPrompt()), e.join("");
}
get tools() {
- const e = new Set(this.manifest.tools || fg.map((s) => s.name)), t = fg.filter((s) => e.has(s.name)), n = this.skills ? this.skills.allTools() : [];
- return [...t, ...n];
+ 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 : [];
+ return [...t, ...s, ...n];
}
async send(e, { voice: t = !1 } = {}) {
if (this._busy)
@@ -33580,7 +35948,7 @@ class ET extends EventTarget {
}
async _loop() {
let e = 0, t = "";
- for (; e++ < xT; ) {
+ for (; e++ < QR; ) {
const n = await this.provider.complete({
system: this.systemPrompt,
messages: this.messages,
@@ -33616,7 +35984,7 @@ class ET 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 = bT[e.name];
+ const s = OR[e.name];
if (!s) throw new Error(`Unknown tool: ${e.name}`);
return s(e.input, t);
}
@@ -33639,7 +36007,9 @@ class ET extends EventTarget {
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 })
+ call: async (e, t) => this._dispatchTool({ name: e, input: t }),
+ stage: this.stage,
+ agentId: this.agentId
};
}
async listen({ onInterim: e, onFinal: t } = {}) {
@@ -33663,23 +36033,23 @@ class ET extends EventTarget {
this.pause(), this.messages = [];
}
}
-const Nd = [
+const af = [
"https://dweb.link/ipfs/",
"https://cloudflare-ipfs.com/ipfs/",
"https://ipfs.io/ipfs/"
-], _T = "https://arweave.net/";
-function wr(i, e = 0) {
+], HR = "https://arweave.net/";
+function Nr(i, e = 0) {
if (!i) return i;
const t = i.match(/^ipfs:\/\/(.+)$/i);
if (t)
- return Nd[e % Nd.length] + t[1];
+ return af[e % af.length] + t[1];
const n = i.match(/^ar:\/\/(.+)$/i);
- return n ? _T + n[1] : i;
+ return n ? HR + n[1] : i;
}
-async function yT(i) {
+async function zR(i) {
let e;
- for (let t = 0; t < Nd.length; t++) {
- const n = wr(i, t);
+ for (let t = 0; t < af.length; t++) {
+ const n = Nr(i, t);
try {
const s = await fetch(n);
if (s.ok) return s;
@@ -33689,22 +36059,22 @@ async function yT(i) {
}
throw e || new Error("All IPFS gateways failed for " + i);
}
-const wT = {
+const VR = {
idle: "idle",
- wave: "wave",
- nod: "yes",
- shake: "no",
- think: "sitting",
- celebrate: "dance",
- concern: "standing",
- bow: "wave",
- point: "standing",
- shrug: "standing"
+ wave: "reaction",
+ nod: "reaction",
+ shake: "angry",
+ think: "pray",
+ celebrate: "celebrate",
+ concern: "defeated",
+ bow: "sitclap",
+ point: "reaction",
+ shrug: "defeated"
};
-function vT(i, e) {
- return e && e[i] ? e[i] : wT[i] ?? i;
+function WR(i, e) {
+ return e && e[i] ? e[i] : VR[i] ?? i;
}
-const pg = {
+const Kg = {
neutral: {
/* reset all */
},
@@ -33714,22 +36084,41 @@ const pg = {
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 CT {
+class qR {
constructor(e) {
- this.viewer = e, this._loader = new vf(), this._userTarget = new H(0, 1.6, 2), this._animationMap = {};
+ 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;
}
// Expose the underlying Three.js handles skills may need
get scene() {
return this.viewer.scene;
}
get mixer() {
- return this.viewer.mixer;
+ return this._groupMixer || this.viewer.mixer;
}
get clips() {
- return this.viewer.clips || [];
+ return this._groupClips || this.viewer.clips || [];
}
get content() {
- return this.viewer.content;
+ return this._group || this.viewer.content;
+ }
+ // Scope all scene operations to a sub-group (used by <agent-stage>).
+ 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;
}
/**
* Set the agent's animation slot override map (from meta.edits.animations).
@@ -33745,7 +36134,7 @@ class CT {
* @returns {string}
*/
resolveAnimationSlot(e) {
- return vT(e, this._animationMap);
+ return WR(e, this._animationMap);
}
// Delegate raw load for ad-hoc cases
async load(e, t = "", n = /* @__PURE__ */ new Map()) {
@@ -33753,16 +36142,16 @@ class CT {
}
// --- Animation ---
playClipByName(e, { loop: t = !1, fade_ms: n = 200 } = {}) {
- const s = this._findClip(e);
- if (s && this.viewer.mixer) {
- const a = this.viewer.mixer.clipAction(s);
- return a.reset(), a.setLoop(
+ const s = this._findClip(e), r = this.mixer;
+ if (s && r) {
+ const o = r.clipAction(s);
+ return o.reset(), o.setLoop(
t ? 2201 : 2200
/* LoopOnce */
- ), a.clampWhenFinished = !t, a.fadeIn(n / 1e3), a.play(), this.viewer.state.actionStates[s.name] = !0, this.viewer.invalidate(), !0;
+ ), 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 r = this.viewer?.animationManager;
- return r?.isLoaded(e) ? (t ? r.crossfadeTo(e, n / 1e3) : r.play(e), !0) : !1;
+ 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));
@@ -33776,25 +36165,25 @@ class CT {
return !1;
}
stopClip(e) {
- if (!this.viewer.mixer) return;
- const t = e ? this._findClip(e) : null;
- if (t) {
- const n = this.viewer.mixer.existingAction(t);
- n && n.fadeOut(0.2), this.viewer.state.actionStates[t.name] = !1;
- } else {
- this.viewer.mixer.stopAllAction();
- for (const n in this.viewer.state.actionStates) this.viewer.state.actionStates[n] = !1;
- }
+ const t = this.mixer;
+ if (!t) return;
+ const n = e ? this._findClip(e) : null;
+ if (n) {
+ const s = t.existingAction(n);
+ s && s.fadeOut(0.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);
- if (!this.viewer.mixer || !e) return !1;
- const n = this.viewer.mixer.clipAction(e);
- return n.reset(), n.fadeIn(t?.blend ?? 0.2), n.play(), this.viewer.invalidate(), !0;
+ const n = this.mixer;
+ if (!n || !e) return !1;
+ const s = n.clipAction(e);
+ return s.reset(), s.fadeIn(t?.blend ?? 0.2), s.play(), this.viewer._animating = !0, this.viewer.invalidate(), !0;
}
async loadClip(e) {
- const t = wr(e);
+ const t = Nr(e);
return new Promise((n, s) => {
this._loader.load(
t,
@@ -33805,7 +36194,7 @@ class CT {
});
}
async loadGLB(e) {
- const t = wr(e);
+ const t = Nr(e);
return new Promise((n, s) => {
this._loader.load(t, n, void 0, s);
});
@@ -33818,7 +36207,7 @@ class CT {
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 H ? e : e === "camera" ? this.viewer.activeCamera.position.clone() : e === "center" ? new H(0, 1, 0) : e === "user" ? this.viewer.renderer?.xr?.isPresenting ? this.viewer.renderer.xr.getCamera().position.clone() : this._userTarget.clone() : null;
+ 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;
@@ -33829,7 +36218,7 @@ class CT {
}
// --- Expression (morph targets) ---
setExpression(e, t = 1) {
- const n = pg[e] || pg.neutral;
+ const n = Kg[e] || Kg.neutral;
this.viewer.content && (this.viewer.content.traverse((s) => {
if (!(!s.morphTargetDictionary || !s.morphTargetInfluences)) {
for (let r = 0; r < s.morphTargetInfluences.length; r++)
@@ -33844,7 +36233,7 @@ class CT {
// --- Movement ---
moveTo(e, { duration: t = 600 } = {}) {
if (!this.viewer.content) return;
- const n = this.viewer.content.position.clone(), s = new H(e.x || 0, e.y || n.y, e.z || 0), r = performance.now(), a = (o) => {
+ 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 < 0.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);
};
@@ -33869,7 +36258,7 @@ class CT {
return this.clips.find((s) => s.name.toLowerCase() === n) || this.clips.find((s) => s.name.toLowerCase().includes(n));
}
}
-const ST = `// Sandbox worker — executes skill handlers in an isolated Web Worker scope.
+const KR = `// 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 */
@@ -34038,55 +36427,55 @@ function _handleResponse({ requestId, result, error }) {
}
}
`;
-let ni = null, pa = null;
-const Aa = /* @__PURE__ */ new Map(), Uo = /* @__PURE__ */ new Map(), ks = /* @__PURE__ */ new Map(), Yl = /* @__PURE__ */ new Map();
-let IT = 0, MT = 0;
-function Ag(i) {
+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) {
if (i == null) return null;
- const e = `@h:${++IT}`;
- return Yl.set(e, i), e;
+ const e = `@h:${++jR}`;
+ return _h.set(e, i), e;
}
-function BT(i) {
- return typeof i == "string" && i.startsWith("@h:") ? Yl.get(i) ?? i : i;
+function YR(i) {
+ return typeof i == "string" && i.startsWith("@h:") ? _h.get(i) ?? i : i;
}
-function TT(i) {
- return Array.isArray(i) ? i.map(BT) : i;
+function JR(i) {
+ return Array.isArray(i) ? i.map(YR) : i;
}
-function Ab() {
- if (!ni) {
- if (!pa) {
- const i = new Blob([ST], { type: "text/javascript" });
- pa = URL.createObjectURL(i);
+function $x() {
+ if (!li) {
+ if (!Ca) {
+ const i = new Blob([KR], { type: "text/javascript" });
+ Ca = URL.createObjectURL(i);
}
- ni = new Worker(pa), ni.onmessage = NT, ni.onerror = RT;
+ li = new Worker(Ca), li.onmessage = $R, li.onerror = ZR;
}
- return ni;
+ return li;
}
-function RT(i) {
- console.error("[sandbox] worker crashed:", i), ni = null, Aa.clear(), Uo.clear(), Yl.clear();
- for (const [, e] of ks) e.reject(new Error("Sandbox worker crashed"));
- ks.clear();
+function ZR(i) {
+ console.error("[sandbox] worker crashed:", i), li = null, Sa.clear(), $o.clear(), _h.clear();
+ for (const [, e] of zs) e.reject(new Error("Sandbox worker crashed"));
+ zs.clear();
}
-function NT({ data: i }) {
+function $R({ data: i }) {
switch (i.type) {
case "install-ack": {
- const e = Uo.get(i.skillURI);
- Uo.delete(i.skillURI), i.ok ? e?.resolve() : (Aa.delete(i.skillURI), e?.reject(new Error(i.error || "Install failed")));
+ 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")));
break;
}
case "request": {
- const { invocationId: e, requestId: t, method: n, args: s } = i, r = ks.get(e);
+ const { invocationId: e, requestId: t, method: n, args: s } = i, r = zs.get(e);
if (!r) {
- ni?.postMessage({
+ li?.postMessage({
type: "response",
requestId: t,
error: "No active invocation"
});
return;
}
- FT(n, s, r.mainCtx).then(
- (a) => ni?.postMessage({ type: "response", requestId: t, result: a ?? null }),
- (a) => ni?.postMessage({
+ eF(n, s, r.mainCtx).then(
+ (a) => li?.postMessage({ type: "response", requestId: t, result: a ?? null }),
+ (a) => li?.postMessage({
type: "response",
requestId: t,
error: a.message || String(a)
@@ -34095,15 +36484,15 @@ function NT({ data: i }) {
break;
}
case "invoke-result": {
- const { invocationId: e, result: t, error: n } = i, s = ks.get(e);
+ const { invocationId: e, result: t, error: n } = i, s = zs.get(e);
if (!s) return;
- ks.delete(e), n !== void 0 ? s.reject(new Error(n)) : s.resolve(t);
+ zs.delete(e), n !== void 0 ? s.reject(new Error(n)) : s.resolve(t);
break;
}
}
}
-async function FT(i, e, t) {
- const n = TT(e);
+async function eF(i, e, t) {
+ const n = JR(e);
switch (i) {
// viewer
case "viewer.play":
@@ -34137,11 +36526,11 @@ async function FT(i, e, t) {
// asset loading — results stored as handles because they're non-serializable
case "loadClip": {
const s = await t.loadClip?.(n[0]);
- return Ag(s);
+ return jg(s);
}
case "loadGLB": {
const s = await t.loadGLB?.(n[0]);
- return Ag(s);
+ return jg(s);
}
// speech
case "speak":
@@ -34155,18 +36544,18 @@ async function FT(i, e, t) {
throw new Error(`Unknown ctx method: ${i}`);
}
}
-async function DT(i, e) {
- if (Aa.has(i)) return Aa.get(i);
+async function tF(i, e) {
+ if (Sa.has(i)) return Sa.get(i);
const t = new Promise((n, s) => {
- Uo.set(i, { resolve: n, reject: s });
+ $o.set(i, { resolve: n, reject: s });
});
- return Aa.set(i, t), Ab().postMessage({ type: "install", skillURI: i, handlersSrc: e }), t;
+ return Sa.set(i, t), $x().postMessage({ type: "install", skillURI: i, handlersSrc: e }), t;
}
-async function LT(i, e, t, n, s) {
- await DT(i, n);
- const r = ++MT, a = Ab();
+async function nF(i, e, t, n, s) {
+ await tF(i, n);
+ const r = ++XR, a = $x();
return new Promise((o, c) => {
- ks.set(r, { resolve: o, reject: c, mainCtx: s }), a.postMessage({
+ zs.set(r, { resolve: o, reject: c, mainCtx: s }), a.postMessage({
type: "invoke",
invocationId: r,
skillURI: i,
@@ -34176,20 +36565,20 @@ async function LT(i, e, t, n, s) {
});
});
}
-function PT() {
- if (ni) {
- ni.terminate(), ni = null, pa && (URL.revokeObjectURL(pa), pa = null), Aa.clear(), Uo.clear(), Yl.clear();
- for (const [, i] of ks) i.reject(new Error("Sandbox terminated"));
- ks.clear();
+function iF() {
+ if (li) {
+ li.terminate(), li = null, Ca && (URL.revokeObjectURL(Ca), Ca = null), Sa.clear(), $o.clear(), _h.clear();
+ for (const [, i] of zs) i.reject(new Error("Sandbox terminated"));
+ zs.clear();
}
}
-function kT() {
- return { invoke: LT, terminate: PT };
+function sF() {
+ return { invoke: nF, terminate: iF };
}
-function UT(i, e) {
+function rF(i, e) {
return /^([a-z]+:|\/)/i.test(e) ? e : (i.endsWith("/") || (i += "/"), i + e);
}
-class OT {
+class aF {
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;
}
@@ -34203,7 +36592,7 @@ class OT {
}
if (!this.handlersSrc)
throw new Error(`Skill "${this.name}" has no handler source for tool "${e}"`);
- return kT().invoke(this.uri, e, t, this.handlersSrc, s);
+ return sF().invoke(this.uri, e, t, this.handlersSrc, s);
}
systemPromptFragment() {
return this.instructions ? `
@@ -34213,7 +36602,7 @@ ${this.instructions}
</skill>` : "";
}
}
-class QT {
+class oF {
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();
}
@@ -34226,7 +36615,7 @@ class QT {
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 OT({
+ ]), l = new aF({
uri: n,
manifest: s,
instructions: a,
@@ -34267,7 +36656,7 @@ class QT {
}
_resolveBundleURI(e, t) {
let n = e;
- return !/^([a-z]+:|\/)/i.test(e) && t && (n = UT(t, e)), n.endsWith("/") || (n += "/"), (n.startsWith("ipfs://") || n.startsWith("ar://")) && (n = wr(n)), n;
+ return !/^([a-z]+:|\/)/i.test(e) && t && (n = rF(t, e)), n.endsWith("/") || (n += "/"), (n.startsWith("ipfs://") || n.startsWith("ar://")) && (n = Nr(n)), n;
}
async _fetchJSON(e) {
const t = await this.fetchFn(e);
@@ -34307,9 +36696,9 @@ class QT {
}
}
}
-const GT = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
-function Xc(i) {
- const e = i.match(GT);
+const cF = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
+function dl(i) {
+ const e = i.match(cF);
if (!e) return { meta: {}, body: i };
const t = {};
for (const n of e[1].split(`
@@ -34319,32 +36708,32 @@ function Xc(i) {
}
return { meta: t, body: e[2] };
}
-function HT(i, e) {
+function lF(i, e) {
const t = ["---"];
for (const [n, s] of Object.entries(i)) t.push(`${n}: ${s}`);
return t.push("---", "", e), t.join(`
`);
}
-class Mi {
+class Pi {
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 === "none") return new Pi({ mode: "none", namespace: t });
+ if (e === "local") return Pi._loadLocal(t);
if (e === "ipfs" || e === "encrypted-ipfs")
- return Mi._loadIPFS({ mode: e, namespace: t, manifestURI: n, fetchFn: s });
+ return Pi._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 });
+ if (!n) return new Pi({ mode: "local", namespace: e });
const s = JSON.parse(n);
- return new Mi({ mode: "local", namespace: e, ...s });
+ return new Pi({ mode: "local", namespace: e, ...s });
} catch {
- return new Mi({ mode: "local", namespace: e });
+ return new Pi({ mode: "local", namespace: e });
}
}
static async _loadIPFS({ mode: e, namespace: t, manifestURI: n, fetchFn: s }) {
@@ -34360,18 +36749,18 @@ class Mi {
} catch {
}
}
- return new Mi({ mode: e, namespace: t, index: { text: o }, files: c });
+ return new Pi({ mode: e, namespace: t, index: { text: o }, files: c });
} catch {
- return new Mi({ mode: e, namespace: t });
+ return new Pi({ mode: e, namespace: t });
}
}
read(e) {
const t = e.endsWith(".md") ? e : `${e}.md`, n = this.files.get(t);
- return n ? Xc(n) : null;
+ return n ? dl(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 && Xc(l).meta.created || c, u = { name: t, description: n, type: s, created: h, updated: c };
- a && (u.decay = a), this.files.set(o, HT(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 && 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();
}
note(e, t) {
const n = { ts: (/* @__PURE__ */ new Date()).toISOString(), type: e, ...t };
@@ -34380,7 +36769,7 @@ class Mi {
async recall(e, { limit: t = 5 } = {}) {
const n = e.toLowerCase(), s = [];
for (const [r, a] of this.files) {
- const { meta: o, body: c } = Xc(a), l = `${o.name || ""} ${o.description || ""} ${c}`.toLowerCase();
+ const { meta: o, body: c } = dl(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);
@@ -34388,7 +36777,7 @@ class Mi {
_rebuildIndex() {
const e = { user: [], feedback: [], project: [], reference: [] };
for (const [s, r] of this.files) {
- const { meta: a } = Xc(r), o = a.type || "user";
+ const { meta: a } = dl(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" };
@@ -34451,8 +36840,8 @@ class Mi {
this._rebuildIndex(), this._persist();
}
}
-const zT = "6.16.0";
-function VT(i, e, t) {
+const hF = "6.16.0";
+function uF(i, e, t) {
const n = e.split("|").map((r) => r.trim());
for (let r = 0; r < n.length; r++)
switch (e) {
@@ -34468,18 +36857,18 @@ function VT(i, e, t) {
const s = new Error(`invalid value for type ${e}`);
throw s.code = "INVALID_ARGUMENT", s.argument = `value.${t}`, s.value = i, s;
}
-async function Bn(i) {
+async function Un(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 Xe(i, e, t) {
+function Ye(i, e, t) {
for (let n in e) {
let s = e[n];
const r = t ? t[n] : null;
- r && VT(s, r, n), Object.defineProperty(i, n, { enumerable: !0, value: s, writable: !1 });
+ r && uF(s, r, n), Object.defineProperty(i, n, { enumerable: !0, value: s, writable: !1 });
}
}
-function oa(i, e) {
+function ba(i, e) {
if (i == null)
return "null";
if (e == null && (e = /* @__PURE__ */ new Set()), typeof i == "object") {
@@ -34488,7 +36877,7 @@ function oa(i, e) {
e.add(i);
}
if (Array.isArray(i))
- return "[ " + i.map((t) => oa(t, e)).join(", ") + " ]";
+ return "[ " + i.map((t) => ba(t, e)).join(", ") + " ]";
if (i instanceof Uint8Array) {
const t = "0123456789abcdef";
let n = "0x";
@@ -34497,7 +36886,7 @@ function oa(i, e) {
return n;
}
if (typeof i == "object" && typeof i.toJSON == "function")
- return oa(i.toJSON(), e);
+ return ba(i.toJSON(), e);
switch (typeof i) {
case "boolean":
case "number":
@@ -34509,32 +36898,32 @@ function oa(i, e) {
return JSON.stringify(i);
case "object": {
const t = Object.keys(i);
- return t.sort(), "{ " + t.map((n) => `${oa(n, e)}: ${oa(i[n], e)}`).join(", ") + " }";
+ return t.sort(), "{ " + t.map((n) => `${ba(n, e)}: ${ba(i[n], e)}`).join(", ") + " }";
}
}
return "[ COULD NOT SERIALIZE ]";
}
-function En(i, e) {
+function Mn(i, e) {
return i && i.code === e;
}
-function kf(i) {
- return En(i, "CALL_EXCEPTION");
+function up(i) {
+ return Mn(i, "CALL_EXCEPTION");
}
-function Qt(i, e, t) {
+function Ht(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: ${oa(t)}`);
+ throw new Error(`value will overwrite populated values: ${ba(t)}`);
for (const a in t) {
if (a === "shortMessage")
continue;
const o = t[a];
- r.push(a + "=" + oa(o));
+ r.push(a + "=" + ba(o));
}
}
- r.push(`code=${e}`), r.push(`version=${zT}`), r.length && (i += " (" + r.join(", ") + ")");
+ r.push(`code=${e}`), r.push(`version=${hF}`), r.length && (i += " (" + r.join(", ") + ")");
}
let s;
switch (e) {
@@ -34548,16 +36937,16 @@ function Qt(i, e, t) {
default:
s = new Error(i);
}
- return Xe(s, { code: e }), t && Object.assign(s, t), s.shortMessage == null && Xe(s, { shortMessage: n }), s;
+ return Ye(s, { code: e }), t && Object.assign(s, t), s.shortMessage == null && Ye(s, { shortMessage: n }), s;
}
function ge(i, e, t, n) {
if (!i)
- throw Qt(e, t, n);
+ throw Ht(e, t, n);
}
function V(i, e, t, n) {
ge(i, e, "INVALID_ARGUMENT", { argument: t, value: n });
}
-function gb(i, e, t) {
+function eb(i, e, t) {
t == null && (t = ""), t && (t = ": " + t), ge(i >= e, "missing argument" + t, "MISSING_ARGUMENT", {
count: i,
expectedCount: e
@@ -34577,7 +36966,7 @@ function gb(i, e, t) {
}
return i;
}, []);
-function Jl(i, e, t) {
+function yh(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", {
@@ -34585,7 +36974,7 @@ function Jl(i, e, t) {
});
}
}
-function mb(i, e, t) {
+function tb(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)) {
@@ -34597,44 +36986,44 @@ function mb(i, e, t) {
}
V(!1, "invalid BytesLike value", e || "value", i);
}
-function ht(i, e) {
- return mb(i, e, !1);
+function dt(i, e) {
+ return tb(i, e, !1);
}
-function Tn(i, e) {
- return mb(i, e, !0);
+function On(i, e) {
+ return tb(i, e, !0);
}
-function Lt(i, e) {
+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 Uf(i) {
- return Lt(i, !0) || i instanceof Uint8Array;
+function dp(i) {
+ return Ut(i, !0) || i instanceof Uint8Array;
}
-const gg = "0123456789abcdef";
+const Xg = "0123456789abcdef";
function Se(i) {
- const e = ht(i);
+ const e = dt(i);
let t = "0x";
for (let n = 0; n < e.length; n++) {
const s = e[n];
- t += gg[(s & 240) >> 4] + gg[s & 15];
+ t += Xg[(s & 240) >> 4] + Xg[s & 15];
}
return t;
}
-function Ot(i) {
+function Gt(i) {
return "0x" + i.map((e) => Se(e).substring(2)).join("");
}
-function ga(i) {
- return Lt(i, !0) ? (i.length - 2) / 2 : ht(i).length;
+function Ia(i) {
+ return Ut(i, !0) ? (i.length - 2) / 2 : dt(i).length;
}
-function Vt(i, e, t) {
- const n = ht(i);
+function Kt(i, e, t) {
+ const n = dt(i);
return t != null && t > n.length && ge(!1, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
buffer: n,
length: n.length,
offset: t
}), Se(n.slice(e ?? 0, t ?? n.length));
}
-function bb(i, e, t) {
- const n = ht(i);
+function nb(i, e, t) {
+ const n = dt(i);
ge(e >= n.length, "padding exceeds data length", "BUFFER_OVERRUN", {
buffer: new Uint8Array(n),
length: e,
@@ -34643,36 +37032,36 @@ function bb(i, e, t) {
const s = new Uint8Array(e);
return s.fill(0), t ? s.set(n, e - n.length) : s.set(n, 0), Se(s);
}
-function ds(i, e) {
- return bb(i, e, !0);
+function Es(i, e) {
+ return nb(i, e, !0);
}
-function WT(i, e) {
- return bb(i, e, !1);
+function dF(i, e) {
+ return nb(i, e, !1);
}
-const $o = BigInt(0), bi = BigInt(1), ca = 9007199254740991;
-function qT(i, e) {
- const t = Zl(i, "value"), n = BigInt(ut(e, "width"));
- if (ge(t >> n === $o, "overflow", "NUMERIC_FAULT", {
+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", {
operation: "fromTwos",
fault: "overflow",
value: i
- }), t >> n - bi) {
- const s = (bi << n) - bi;
- return -((~t & s) + bi);
+ }), t >> n - Ii) {
+ const s = (Ii << n) - Ii;
+ return -((~t & s) + Ii);
}
return t;
}
-function xb(i, e) {
- let t = Fe(i, "value");
- const n = BigInt(ut(e, "width")), s = bi << n - bi;
- if (t < $o) {
+function ib(i, e) {
+ let t = Ne(i, "value");
+ const n = BigInt(ft(e, "width")), s = Ii << n - Ii;
+ if (t < fc) {
t = -t, ge(t <= s, "too low", "NUMERIC_FAULT", {
operation: "toTwos",
fault: "overflow",
value: i
});
- const r = (bi << n) - bi;
- return (~t & r) + bi;
+ const r = (Ii << n) - Ii;
+ return (~t & r) + Ii;
} else
ge(t < s, "too high", "NUMERIC_FAULT", {
operation: "toTwos",
@@ -34681,16 +37070,16 @@ function xb(i, e) {
});
return t;
}
-function fo(i, e) {
- const t = Zl(i, "value"), n = BigInt(ut(e, "bits"));
- return t & (bi << n) - bi;
+function vo(i, e) {
+ const t = wh(i, "value"), n = BigInt(ft(e, "bits"));
+ return t & (Ii << n) - Ii;
}
-function Fe(i, e) {
+function Ne(i, e) {
switch (typeof i) {
case "bigint":
return i;
case "number":
- return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -ca && i <= ca, "overflow", e || "value", i), BigInt(i);
+ return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -Ea && i <= Ea, "overflow", e || "value", i), BigInt(i);
case "string":
try {
if (i === "")
@@ -34702,52 +37091,52 @@ function Fe(i, e) {
}
V(!1, "invalid BigNumberish value", e || "value", i);
}
-function Zl(i, e) {
- const t = Fe(i, e);
- return ge(t >= $o, "unsigned value cannot be negative", "NUMERIC_FAULT", {
+function wh(i, e) {
+ const t = Ne(i, e);
+ return ge(t >= fc, "unsigned value cannot be negative", "NUMERIC_FAULT", {
fault: "overflow",
operation: "getUint",
value: i
}), t;
}
-const mg = "0123456789abcdef";
-function Of(i) {
+const Yg = "0123456789abcdef";
+function fp(i) {
if (i instanceof Uint8Array) {
let e = "0x0";
for (const t of i)
- e += mg[t >> 4], e += mg[t & 15];
+ e += Yg[t >> 4], e += Yg[t & 15];
return BigInt(e);
}
- return Fe(i);
+ return Ne(i);
}
-function ut(i, e) {
+function ft(i, e) {
switch (typeof i) {
case "bigint":
- return V(i >= -ca && i <= ca, "overflow", e || "value", i), Number(i);
+ return V(i >= -Ea && i <= Ea, "overflow", e || "value", i), Number(i);
case "number":
- return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -ca && i <= ca, "overflow", e || "value", i), i;
+ return V(Number.isInteger(i), "underflow", e || "value", i), V(i >= -Ea && i <= Ea, "overflow", e || "value", i), i;
case "string":
try {
if (i === "")
throw new Error("empty string");
- return ut(BigInt(i), e);
+ return ft(BigInt(i), e);
} catch (t) {
V(!1, `invalid numeric string: ${t.message}`, e || "value", i);
}
}
V(!1, "invalid numeric value", e || "value", i);
}
-function KT(i) {
- return ut(Of(i));
+function pF(i) {
+ return ft(fp(i));
}
-function Gs(i, e) {
- const t = Zl(i, "value");
+function Xs(i, e) {
+ const t = wh(i, "value");
let n = t.toString(16);
if (e == null)
n.length % 2 && (n = "0" + n);
else {
- const s = ut(e, "width");
- if (s === 0 && t === $o)
+ const s = ft(e, "width");
+ if (s === 0 && t === fc)
return "0x";
for (ge(s * 2 >= n.length, `value exceeds width (${s} bytes)`, "NUMERIC_FAULT", {
operation: "toBeHex",
@@ -34758,9 +37147,9 @@ function Gs(i, e) {
}
return "0x" + n;
}
-function $t(i, e) {
- const t = Zl(i, "value");
- if (t === $o)
+function rn(i, e) {
+ const t = wh(i, "value");
+ if (t === fc)
return new Uint8Array(0);
let n = t.toString(16);
n.length % 2 && (n = "0" + n);
@@ -34771,39 +37160,39 @@ function $t(i, e) {
}
return s;
}
-function pi(i) {
- let e = Se(Uf(i) ? i : $t(i)).substring(2);
+function wi(i) {
+ let e = Se(dp(i) ? i : rn(i)).substring(2);
for (; e.startsWith("0"); )
e = e.substring(1);
return e === "" && (e = "0"), "0x" + e;
}
-const bg = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+const Jg = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
BigInt(0);
-const xg = BigInt(58);
-function jT(i) {
- const e = ht(i);
- let t = Of(e), n = "";
+const Zg = BigInt(58);
+function AF(i) {
+ const e = dt(i);
+ let t = fp(e), n = "";
for (; t; )
- n = bg[Number(t % xg)] + n, t /= xg;
+ n = Jg[Number(t % Zg)] + n, t /= Zg;
for (let s = 0; s < e.length && !e[s]; s++)
- n = bg[0] + n;
+ n = Jg[0] + n;
return n;
}
-function XT(i) {
+function gF(i) {
i = atob(i);
const e = new Uint8Array(i.length);
for (let t = 0; t < i.length; t++)
e[t] = i.charCodeAt(t);
- return ht(e);
+ return dt(e);
}
-function YT(i) {
- const e = ht(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 Eb {
+class sb {
/**
* The event filter.
*/
@@ -34818,7 +37207,7 @@ class Eb {
* the %%listener%% and for %%filter%%.
*/
constructor(e, t, n) {
- this.#e = t, Xe(this, { emitter: e, filter: n });
+ this.#e = t, Ye(this, { emitter: e, filter: n });
}
/**
* Unregister the triggered listener for future events.
@@ -34827,10 +37216,10 @@ class Eb {
this.#e != null && await this.emitter.off(this.filter, this.#e);
}
}
-function JT(i, e, t, n, s) {
+function xF(i, e, t, n, s) {
V(!1, `invalid codepoint at offset ${e}; ${i}`, "bytes", t);
}
-function _b(i, e, t, n, s) {
+function rb(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++)
@@ -34839,17 +37228,17 @@ function _b(i, e, t, n, s) {
}
return i === "OVERRUN" ? t.length - e - 1 : 0;
}
-function ZT(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), _b(i, e, t));
+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));
}
-const $T = Object.freeze({
- error: JT,
- ignore: _b,
- replace: ZT
+const EF = Object.freeze({
+ error: xF,
+ ignore: rb,
+ replace: bF
});
-function eR(i, e) {
- e == null && (e = $T.error);
- const t = ht(i, "bytes"), n = [];
+function _F(i, e) {
+ e == null && (e = EF.error);
+ const t = dt(i, "bytes"), n = [];
let s = 0;
for (; s < t.length; ) {
const r = t[s++];
@@ -34899,7 +37288,7 @@ function eR(i, e) {
}
return n;
}
-function cs(i, e) {
+function gs(i, e) {
V(typeof i == "string", "invalid string value", "str", i);
let t = [];
for (let n = 0; n < i.length; n++) {
@@ -34919,13 +37308,13 @@ function cs(i, e) {
}
return new Uint8Array(t);
}
-function tR(i) {
+function yF(i) {
return i.map((e) => e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10 & 1023) + 55296, (e & 1023) + 56320))).join("");
}
-function Nl(i, e) {
- return tR(eR(i, e));
+function $l(i, e) {
+ return yF(_F(i, e));
}
-function yb(i) {
+function ab(i) {
async function e(t, n) {
ge(n == null || !n.cancelled, "request cancelled before sending", "CANCELLED");
const s = t.url.split(":")[0].toLowerCase();
@@ -34937,10 +37326,10 @@ function yb(i) {
});
let r = null;
const a = new AbortController(), o = setTimeout(() => {
- r = Qt("request timeout", "TIMEOUT"), a.abort();
+ r = Ht("request timeout", "TIMEOUT"), a.abort();
}, t.timeout);
n && n.addListener(() => {
- r = Qt("request cancelled", "CANCELLED"), a.abort();
+ r = Ht("request cancelled", "CANCELLED"), a.abort();
});
const c = Object.assign({}, i, {
method: t.method,
@@ -34956,8 +37345,8 @@ function yb(i) {
}
clearTimeout(o);
const h = {};
- l.headers.forEach((f, m) => {
- h[m.toLowerCase()] = f;
+ l.headers.forEach((f, p) => {
+ h[p.toLowerCase()] = f;
});
const u = await l.arrayBuffer(), d = u == null ? null : new Uint8Array(u);
return {
@@ -34969,44 +37358,44 @@ function yb(i) {
}
return e;
}
-const nR = 12, iR = 250;
-let Eg = yb();
-const sR = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"), rR = new RegExp("^ipfs://(ipfs/)?(.*)$", "i");
-let Au = !1;
-async function wb(i, 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) {
try {
- const t = i.match(sR);
+ const t = i.match(CF);
if (!t)
throw new Error("invalid data");
- return new Us(200, "OK", {
+ return new Vs(200, "OK", {
"content-type": t[1] || "text/plain"
- }, t[2] ? XT(t[3]) : oR(t[3]));
+ }, t[2] ? gF(t[3]) : MF(t[3]));
} catch {
- return new Us(599, "BAD REQUEST (invalid data: URI)", {}, null, new Li(i));
+ return new Vs(599, "BAD REQUEST (invalid data: URI)", {}, null, new Gi(i));
}
}
-function vb(i) {
+function cb(i) {
async function e(t, n) {
try {
- const s = t.match(rR);
+ const s = t.match(SF);
if (!s)
throw new Error("invalid link");
- return new Li(`${i}${s[2]}`);
+ return new Gi(`${i}${s[2]}`);
} catch {
- return new Us(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new Li(t));
+ return new Vs(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new Gi(t));
}
}
return e;
}
-const Yc = {
- data: wb,
- ipfs: vb("https://gateway.ipfs.io/ipfs/")
-}, Cb = /* @__PURE__ */ new WeakMap();
-class aR {
+const fl = {
+ data: ob,
+ ipfs: cb("https://gateway.ipfs.io/ipfs/")
+}, lb = /* @__PURE__ */ new WeakMap();
+class IF {
#e;
#t;
constructor(e) {
- this.#e = [], this.#t = !1, Cb.set(e, () => {
+ this.#e = [], this.#t = !1, lb.set(e, () => {
if (!this.#t) {
this.#t = !0;
for (const t of this.#e)
@@ -35029,12 +37418,12 @@ class aR {
ge(!this.cancelled, "cancelled", "CANCELLED", {});
}
}
-function Jc(i) {
+function pl(i) {
if (i == null)
throw new Error("missing signal; should not happen");
return i.checkSignal(), i;
}
-class Li {
+class Gi {
#e;
#t;
#n;
@@ -35086,11 +37475,11 @@ class Li {
if (e == null)
this.#r = void 0, this.#o = void 0;
else if (typeof e == "string")
- this.#r = cs(e), this.#o = "text/plain";
+ this.#r = gs(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 = cs(JSON.stringify(e)), this.#o = "application/json";
+ this.#r = gs(JSON.stringify(e)), this.#o = "application/json";
else
throw new Error("invalid body");
}
@@ -35122,7 +37511,7 @@ class Li {
*/
get headers() {
const e = Object.assign({}, this.#n);
- return this.#f && (e.authorization = `Basic ${YT(cs(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.
@@ -35257,7 +37646,7 @@ class Li {
* configurege a proxy or other agent.
*/
get getUrlFunc() {
- return this.#u || Eg;
+ return this.#u || $g;
}
set getUrlFunc(e) {
this.#u = e;
@@ -35270,8 +37659,8 @@ class Li {
*/
constructor(e) {
this.#a = String(e), this.#e = !1, this.#t = !0, this.#n = {}, this.#i = "", this.#s = 3e5, this.#h = {
- slotInterval: iR,
- maxAttempts: nR
+ slotInterval: vF,
+ maxAttempts: wF
}, this.#u = null;
}
toString() {
@@ -35287,19 +37676,19 @@ class Li {
async #d(e, t, n, s, r) {
if (e >= this.#h.maxAttempts)
return r.makeServerError("exceeded maximum retry limit");
- ge(_g() <= t, "timeout", "TIMEOUT", {
+ ge(em() <= t, "timeout", "TIMEOUT", {
operation: "request.send",
reason: "timeout",
request: s
- }), n > 0 && await cR(n);
+ }), n > 0 && await BF(n);
let a = this.clone();
const o = (a.url.split(":")[0] || "").toLowerCase();
- if (o in Yc) {
- const h = await Yc[o](a.url, Jc(s.#c));
- if (h instanceof Us) {
+ if (o in fl) {
+ const h = await fl[o](a.url, pl(s.#c));
+ if (h instanceof Vs) {
let u = h;
if (this.processFunc) {
- Jc(s.#c);
+ pl(s.#c);
try {
u = await this.processFunc(a, u);
} catch (d) {
@@ -35311,8 +37700,8 @@ class Li {
a = h;
}
this.preflightFunc && (a = await this.preflightFunc(a));
- const c = await this.getUrlFunc(a, Jc(s.#c));
- let l = new Us(c.statusCode, c.statusMessage, c.headers, c.body, s);
+ const c = await this.getUrlFunc(a, pl(s.#c));
+ let l = new Vs(c.statusCode, c.statusMessage, c.headers, c.body, s);
if (l.statusCode === 301 || l.statusCode === 302) {
try {
const h = l.headers.location || "";
@@ -35326,7 +37715,7 @@ class Li {
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) {
- Jc(s.#c);
+ pl(s.#c);
try {
l = await this.processFunc(a, l);
} catch (h) {
@@ -35341,7 +37730,7 @@ class Li {
* 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 aR(this), this.#d(0, _g() + this.timeout, 0, this, new Us(0, "", {}, null, this));
+ 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));
}
/**
* Cancels the inflight response, causing a ``CANCELLED``
@@ -35349,7 +37738,7 @@ class Li {
*/
cancel() {
ge(this.#c != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" });
- const e = Cb.get(this);
+ const e = lb.get(this);
if (!e)
throw new Error("missing signal; should not happen");
e();
@@ -35363,14 +37752,14 @@ class Li {
ge(this.method === "GET" && (t !== "https" || n !== "http") && e.match(/^https?:/), "unsupported redirect", "UNSUPPORTED_OPERATION", {
operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`
});
- const s = new Li(e);
+ const s = new Gi(e);
return s.method = "GET", s.allowGzip = this.allowGzip, s.timeout = this.timeout, s.#n = Object.assign({}, this.#n), this.#r && (s.#r = new Uint8Array(this.#r)), s.#o = this.#o, s;
}
/**
* Create a new copy of this request.
*/
clone() {
- const e = new Li(this.url);
+ const e = new Gi(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;
}
/**
@@ -35378,13 +37767,13 @@ class Li {
* registration.
*/
static lockConfig() {
- Au = !0;
+ Hu = !0;
}
/**
* Get the current Gateway function for %%scheme%%.
*/
static getGateway(e) {
- return Yc[e.toLowerCase()] || null;
+ return fl[e.toLowerCase()] || null;
}
/**
* Use the %%func%% when fetching URIs using %%scheme%%.
@@ -35397,9 +37786,9 @@ class Li {
static registerGateway(e, t) {
if (e = e.toLowerCase(), e === "http" || e === "https")
throw new Error(`cannot intercept ${e}; use registerGetUrl`);
- if (Au)
+ if (Hu)
throw new Error("gateways locked");
- Yc[e] = t;
+ fl[e] = t;
}
/**
* Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.
@@ -35410,9 +37799,9 @@ class Li {
* throws.
*/
static registerGetUrl(e) {
- if (Au)
+ if (Hu)
throw new Error("gateways locked");
- Eg = e;
+ $g = e;
}
/**
* Creates a getUrl function that fetches content from HTTP and
@@ -35426,7 +37815,7 @@ class Li {
* content.
*/
static createGetUrlFunc(e) {
- return yb(e);
+ return ab(e);
}
/**
* Creates a function that can "fetch" data URIs.
@@ -35438,7 +37827,7 @@ class Li {
* be useful in a wrapper to perfom custom data URI functionality.
*/
static createDataGateway() {
- return wb;
+ return ob;
}
/**
* Creates a function that will fetch IPFS (unvalidated) from
@@ -35448,10 +37837,10 @@ class Li {
* ``"https:/\/gateway.ipfs.io/ipfs/"``.
*/
static createIpfsGatewayFunc(e) {
- return vb(e);
+ return cb(e);
}
}
-class Us {
+class Vs {
#e;
#t;
#n;
@@ -35493,7 +37882,7 @@ class Us {
*/
get bodyText() {
try {
- return this.#i == null ? "" : Nl(this.#i);
+ return this.#i == null ? "" : $l(this.#i);
} catch {
ge(!1, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", {
operation: "bodyText",
@@ -35544,7 +37933,7 @@ class Us {
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 Us(599, n, this.headers, this.body, this.#s || void 0);
+ const s = new Vs(599, n, this.headers, this.body, this.#s || void 0);
return s.#a = { message: e, error: t }, s;
}
/**
@@ -35555,7 +37944,7 @@ class Us {
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 Xe(n, { stall: t, throttle: !0 }), n;
+ throw Ye(n, { stall: t, throttle: !0 }), n;
}
/**
* Get the header value for %%key%%, ignoring case.
@@ -35593,7 +37982,7 @@ class Us {
this.request && (n = this.request.url);
let s = null;
try {
- this.#i && (s = Nl(this.#i));
+ this.#i && (s = $l(this.#i));
} catch {
}
ge(!1, e, "SERVER_ERROR", {
@@ -35608,31 +37997,31 @@ class Us {
});
}
}
-function _g() {
+function em() {
return (/* @__PURE__ */ new Date()).getTime();
}
-function oR(i) {
- return cs(i.replace(/%([0-9a-f][0-9a-f])/gi, (e, t) => String.fromCharCode(parseInt(t, 16))));
+function MF(i) {
+ return gs(i.replace(/%([0-9a-f][0-9a-f])/gi, (e, t) => String.fromCharCode(parseInt(t, 16))));
}
-function cR(i) {
+function BF(i) {
return new Promise((e) => setTimeout(e, i));
}
-function lR(i) {
+function TF(i) {
let e = i.toString(16);
for (; e.length < 2; )
e = "0" + e;
return "0x" + e;
}
-function yg(i, e, t) {
+function tm(i, e, t) {
let n = 0;
for (let s = 0; s < t; s++)
n = n * 256 + i[e + s];
return n;
}
-function wg(i, e, t, n) {
+function nm(i, e, t, n) {
const s = [];
for (; t < e + 1 + n; ) {
- const r = Sb(i, t);
+ const r = hb(i, t);
s.push(r.result), t += r.consumed, ge(t <= e + 1 + n, "child data too short", "BUFFER_OVERRUN", {
buffer: i,
length: n,
@@ -35641,7 +38030,7 @@ function wg(i, e, t, n) {
}
return { consumed: 1 + n, result: s };
}
-function Sb(i, e) {
+function hb(i, e) {
ge(i.length !== 0, "data too short", "BUFFER_OVERRUN", {
buffer: i,
length: 0,
@@ -35657,15 +38046,15 @@ function Sb(i, e) {
if (i[e] >= 248) {
const n = i[e] - 247;
t(e + 1 + n);
- const s = yg(i, e + 1, n);
- return t(e + 1 + n + s), wg(i, e, e + 1 + n, n + s);
+ const s = tm(i, e + 1, n);
+ return t(e + 1 + n + s), nm(i, e, e + 1 + n, n + s);
} else if (i[e] >= 192) {
const n = i[e] - 192;
- return t(e + 1 + n), wg(i, e, e + 1, n);
+ return t(e + 1 + n), nm(i, e, e + 1, n);
} else if (i[e] >= 184) {
const n = i[e] - 183;
t(e + 1 + n);
- const s = yg(i, e + 1, n);
+ const s = tm(i, e + 1, n);
t(e + 1 + n + s);
const r = Se(i.slice(e + 1 + n, e + 1 + n + s));
return { consumed: 1 + n + s, result: r };
@@ -35675,61 +38064,61 @@ function Sb(i, e) {
const s = Se(i.slice(e + 1, e + 1 + n));
return { consumed: 1 + n, result: s };
}
- return { consumed: 1, result: lR(i[e]) };
+ return { consumed: 1, result: TF(i[e]) };
}
-function ec(i) {
- const e = ht(i, "data"), t = Sb(e, 0);
+function pc(i) {
+ const e = dt(i, "data"), t = hb(e, 0);
return V(t.consumed === e.length, "unexpected junk after rlp payload", "data", i), t.result;
}
-function vg(i) {
+function im(i) {
const e = [];
for (; i; )
e.unshift(i & 255), i >>= 8;
return e;
}
-function Ib(i) {
+function ub(i) {
if (Array.isArray(i)) {
let n = [];
if (i.forEach(function(r) {
- n = n.concat(Ib(r));
+ n = n.concat(ub(r));
}), n.length <= 55)
return n.unshift(192 + n.length), n;
- const s = vg(n.length);
+ const s = im(n.length);
return s.unshift(247 + s.length), s.concat(n);
}
- const e = Array.prototype.slice.call(ht(i, "object"));
+ const e = Array.prototype.slice.call(dt(i, "object"));
if (e.length === 1 && e[0] <= 127)
return e;
if (e.length <= 55)
return e.unshift(128 + e.length), e;
- const t = vg(e.length);
+ const t = im(e.length);
return t.unshift(183 + t.length), t.concat(e);
}
-const Cg = "0123456789abcdef";
-function ls(i) {
+const sm = "0123456789abcdef";
+function ms(i) {
let e = "0x";
- for (const t of Ib(i))
- e += Cg[t >> 4], e += Cg[t & 15];
+ for (const t of ub(i))
+ e += sm[t >> 4], e += sm[t & 15];
return e;
}
-const Nn = 32, Fd = new Uint8Array(Nn), hR = ["then"], Zc = {}, Mb = /* @__PURE__ */ new WeakMap();
-function or(i) {
- return Mb.get(i);
+const Gn = 32, of = new Uint8Array(Gn), RF = ["then"], Al = {}, db = /* @__PURE__ */ new WeakMap();
+function Ar(i) {
+ return db.get(i);
}
-function Sg(i, e) {
- Mb.set(i, e);
+function rm(i, e) {
+ db.set(i, e);
}
-function oo(i, e) {
+function mo(i, e) {
const t = new Error(`deferred error during ABI decoding triggered accessing ${i}`);
throw t.error = e, t;
}
-function Dd(i, e, t) {
- return i.indexOf(null) >= 0 ? e.map((n, s) => n instanceof rs ? Dd(or(n), n, t) : n) : i.reduce((n, s, r) => {
+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) => {
let a = e.getValue(s);
- return s in n || (t && a instanceof rs && (a = Dd(or(a), a, t)), n[s] = a), n;
+ return s in n || (t && a instanceof ds && (a = cf(Ar(a), a, t)), n[s] = a), n;
}, {});
}
-class rs extends Array {
+class ds extends Array {
// No longer used; but cannot be removed as it will remove the
// #private field from the .d.ts which may break backwards
// compatibility
@@ -35740,11 +38129,11 @@ class rs extends Array {
constructor(...e) {
const t = e[0];
let n = e[1], s = (e[2] || []).slice(), r = !0;
- t !== Zc && (n = e, s = [], r = !1), super(n.length), n.forEach((c, l) => {
+ t !== Al && (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 (Sg(this, Object.freeze(n.map((c, l) => {
+ if (rm(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)
@@ -35754,13 +38143,13 @@ class rs extends Array {
get: (c, l, h) => {
if (typeof l == "string") {
if (l.match(/^[0-9]+$/)) {
- const d = ut(l, "%index");
+ const d = ft(l, "%index");
if (d < 0 || d >= this.length)
throw new RangeError("out of result range");
const f = c[d];
- return f instanceof Error && oo(`index ${d}`, f), f;
+ return f instanceof Error && mo(`index ${d}`, f), f;
}
- if (hR.indexOf(l) >= 0)
+ if (RF.indexOf(l) >= 0)
return Reflect.get(c, l, h);
const u = c[l];
if (u instanceof Function)
@@ -35773,7 +38162,7 @@ class rs extends Array {
return Reflect.get(c, l, h);
}
});
- return Sg(o, or(this)), o;
+ return rm(o, Ar(this)), o;
}
/**
* Returns the Result as a normal Array. If %%deep%%, any children
@@ -35785,7 +38174,7 @@ class rs extends Array {
toArray(e) {
const t = [];
return this.forEach((n, s) => {
- n instanceof Error && oo(`index ${s}`, n), e && n instanceof rs && (n = n.toArray(e)), t.push(n);
+ n instanceof Error && mo(`index ${s}`, n), e && n instanceof ds && (n = n.toArray(e)), t.push(n);
}), t;
}
/**
@@ -35797,31 +38186,31 @@ class rs extends Array {
* any outstanding deferred errors.
*/
toObject(e) {
- const t = or(this);
+ const t = Ar(this);
return t.reduce((n, s, r) => (ge(s != null, `value at index ${r} unnamed`, "UNSUPPORTED_OPERATION", {
operation: "toObject()"
- }), Dd(t, this, e)), {});
+ }), cf(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 = or(this), s = [], r = [];
+ const n = Ar(this), s = [], r = [];
for (let a = e; a < t; a++)
s.push(this[a]), r.push(n[a]);
- return new rs(Zc, s, r);
+ return new ds(Al, s, r);
}
/**
* @_ignore
*/
filter(e, t) {
- const n = or(this), s = [], r = [];
+ const n = Ar(this), s = [], r = [];
for (let a = 0; a < this.length; a++) {
const o = this[a];
- o instanceof Error && oo(`index ${a}`, o), e.call(t, o, a, this) && (s.push(o), r.push(n[a]));
+ o instanceof Error && mo(`index ${a}`, o), e.call(t, o, a, this) && (s.push(o), r.push(n[a]));
}
- return new rs(Zc, s, r);
+ return new ds(Al, s, r);
}
/**
* @_ignore
@@ -35830,7 +38219,7 @@ class rs extends Array {
const n = [];
for (let s = 0; s < this.length; s++) {
const r = this[s];
- r instanceof Error && oo(`index ${s}`, r), n.push(e.call(t, r, s, this));
+ r instanceof Error && mo(`index ${s}`, r), n.push(e.call(t, r, s, this));
}
return n;
}
@@ -35843,25 +38232,25 @@ class rs extends Array {
* accessible by name.
*/
getValue(e) {
- const t = or(this).indexOf(e);
+ const t = Ar(this).indexOf(e);
if (t === -1)
return;
const n = this[t];
- return n instanceof Error && oo(`property ${JSON.stringify(e)}`, n.error), n;
+ return n instanceof Error && mo(`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 rs(Zc, e, t);
+ return new ds(Al, e, t);
}
}
-function Ig(i) {
- let e = $t(i);
- return ge(e.length <= Nn, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: e, length: Nn, offset: e.length }), e.length !== Nn && (e = Tn(Ot([Fd.slice(e.length % Nn), e]))), e;
+function am(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;
}
-class As {
+class ys {
// The coder name:
// - address, uint256, tuple, array, etc.
name;
@@ -35876,7 +38265,7 @@ class As {
// - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)
dynamic;
constructor(e, t, n, s) {
- Xe(this, { name: e, type: t, localName: n, dynamic: s }, {
+ Ye(this, { name: e, type: t, localName: n, dynamic: s }, {
name: "string",
type: "string",
localName: "string",
@@ -35887,7 +38276,7 @@ class As {
V(!1, e, this.localName, t);
}
}
-class Ld {
+class lf {
// An array of WordSize lengthed objects to concatenation
#e;
#t;
@@ -35895,7 +38284,7 @@ class Ld {
this.#e = [], this.#t = 0;
}
get data() {
- return Ot(this.#e);
+ return Gt(this.#e);
}
get length() {
return this.#t;
@@ -35904,28 +38293,28 @@ class Ld {
return this.#e.push(e), this.#t += e.length, e.length;
}
appendWriter(e) {
- return this.#n(Tn(e.data));
+ return this.#n(On(e.data));
}
// Arrayish item; pad on the right to *nearest* WordSize
writeBytes(e) {
- let t = Tn(e);
- const n = t.length % Nn;
- return n && (t = Tn(Ot([t, Fd.slice(n)]))), this.#n(t);
+ let t = On(e);
+ const n = t.length % Gn;
+ return n && (t = On(Gt([t, of.slice(n)]))), this.#n(t);
}
// Numeric item; pad on the left *to* WordSize
writeValue(e) {
- return this.#n(Ig(e));
+ return this.#n(am(e));
}
// Inserts a numeric place-holder, returning a callback that can
// be used to asjust the value later
writeUpdatableValue() {
const e = this.#e.length;
- return this.#e.push(Fd), this.#t += Nn, (t) => {
- this.#e[e] = Ig(t);
+ return this.#e.push(of), this.#t += Gn, (t) => {
+ this.#e[e] = am(t);
};
}
}
-class Qf {
+class pp {
// 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
@@ -35937,7 +38326,7 @@ class Qf {
#i;
#s;
constructor(e, t, n) {
- Xe(this, { allowLoose: !!t }), this.#e = Tn(e), this.#n = 0, this.#i = null, this.#s = n ?? 1024, this.#t = 0;
+ 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);
@@ -35955,7 +38344,7 @@ class Qf {
if (this.#i)
return this.#i.#a(e);
this.#n += e, ge(this.#s < 1 || this.#n <= this.#s * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
- buffer: Tn(this.#e),
+ buffer: On(this.#e),
offset: this.#t,
length: e,
info: {
@@ -35965,16 +38354,16 @@ class Qf {
});
}
#r(e, t, n) {
- let s = Math.ceil(t / Nn) * Nn;
+ let s = Math.ceil(t / Gn) * Gn;
return this.#t + s > this.#e.length && (this.allowLoose && n && this.#t + t <= this.#e.length ? s = t : ge(!1, "data out-of-bounds", "BUFFER_OVERRUN", {
- buffer: Tn(this.#e),
+ buffer: On(this.#e),
length: this.#e.length,
offset: this.#t + s
})), this.#e.slice(this.#t, this.#t + s);
}
// Create a sub-reader with the same underlying data, but offset
subReader(e) {
- const t = new Qf(this.#e.slice(this.#t + e), this.allowLoose, this.#s);
+ const t = new pp(this.#e.slice(this.#t + e), this.allowLoose, this.#s);
return t.#i = this, t;
}
// Read bytes
@@ -35984,81 +38373,81 @@ class Qf {
}
// Read a numeric values
readValue() {
- return Of(this.readBytes(Nn));
+ return fp(this.readBytes(Gn));
}
readIndex() {
- return KT(this.readBytes(Nn));
+ return pF(this.readBytes(Gn));
}
}
-function Fl(i) {
+function eh(i) {
if (!Number.isSafeInteger(i) || i < 0)
throw new Error(`Wrong positive integer: ${i}`);
}
-function Gf(i, ...e) {
+function Ap(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 uR(i) {
+function FF(i) {
if (typeof i != "function" || typeof i.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
- Fl(i.outputLen), Fl(i.blockLen);
+ eh(i.outputLen), eh(i.blockLen);
}
-function Ba(i, e = !0) {
+function ka(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 Bb(i, e) {
- Gf(i);
+function fb(i, e) {
+ Ap(i);
const t = e.outputLen;
if (i.length < t)
throw new Error(`digestInto() expects output buffer of length at least ${t}`);
}
-const gu = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
-const Tb = (i) => i instanceof Uint8Array, dR = (i) => new Uint32Array(i.buffer, i.byteOffset, Math.floor(i.byteLength / 4)), mu = (i) => new DataView(i.buffer, i.byteOffset, i.byteLength), Ii = (i, e) => i << 32 - e | i >>> e, fR = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
-if (!fR)
+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)
throw new Error("Non little-endian hardware is not supported");
-function pR(i) {
+function LF(i) {
if (typeof i != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof i}`);
return new Uint8Array(new TextEncoder().encode(i));
}
-function $l(i) {
- if (typeof i == "string" && (i = pR(i)), !Tb(i))
+function vh(i) {
+ if (typeof i == "string" && (i = LF(i)), !pb(i))
throw new Error(`expected Uint8Array, got ${typeof i}`);
return i;
}
-function AR(...i) {
+function PF(...i) {
const e = new Uint8Array(i.reduce((n, s) => n + s.length, 0));
let t = 0;
return i.forEach((n) => {
- if (!Tb(n))
+ if (!pb(n))
throw new Error("Uint8Array expected");
e.set(n, t), t += n.length;
}), e;
}
-class Hf {
+class gp {
// Safe version that clones internal state
clone() {
return this._cloneInto();
}
}
-function zf(i) {
- const e = (n) => i().update($l(n)).digest(), t = i();
+function mp(i) {
+ const e = (n) => i().update(vh(n)).digest(), t = i();
return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => i(), e;
}
-function gR(i = 32) {
- if (gu && typeof gu.getRandomValues == "function")
- return gu.getRandomValues(new Uint8Array(i));
+function kF(i = 32) {
+ if (zu && typeof zu.getRandomValues == "function")
+ return zu.getRandomValues(new Uint8Array(i));
throw new Error("crypto.getRandomValues must be defined");
}
-class Rb extends Hf {
+class Ab extends gp {
constructor(e, t) {
- super(), this.finished = !1, this.destroyed = !1, uR(e);
- const n = $l(t);
+ super(), this.finished = !1, this.destroyed = !1, FF(e);
+ const n = vh(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;
@@ -36072,10 +38461,10 @@ class Rb extends Hf {
this.oHash.update(r), r.fill(0);
}
update(e) {
- return Ba(this), this.iHash.update(e), this;
+ return ka(this), this.iHash.update(e), this;
}
digestInto(e) {
- Ba(this), Gf(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
+ ka(this), Ap(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);
@@ -36090,27 +38479,27 @@ class Rb extends Hf {
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
}
}
-const Nb = (i, e, t) => new Rb(i, e).update(t).digest();
-Nb.create = (i, e) => new Rb(i, e);
-function mR(i, e, t, n) {
+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) {
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 Fb extends Hf {
+class mb extends gp {
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 = mu(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 = Vu(this.buffer);
}
update(e) {
- Ba(this);
+ ka(this);
const { view: t, buffer: n, blockLen: s } = this;
- e = $l(e);
+ e = vh(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 = mu(e);
+ const c = Vu(e);
for (; s <= r - a; a += s)
this.process(c, a);
continue;
@@ -36120,14 +38509,14 @@ class Fb extends Hf {
return this.length += e.length, this.roundClean(), this;
}
digestInto(e) {
- Ba(this), Bb(e, this), this.finished = !0;
+ ka(this), fb(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;
- mR(n, s - 8, BigInt(this.length * 8), r), this.process(n, 0);
- const o = mu(e), c = this.outputLen;
+ UF(n, s - 8, BigInt(this.length * 8), r), this.process(n, 0);
+ const o = Vu(e), c = this.outputLen;
if (c % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const l = c / 4, h = this.get();
@@ -36148,7 +38537,7 @@ class Fb extends Hf {
return e.length = s, e.pos = o, e.finished = r, e.destroyed = a, s % t && e.buffer.set(n), e;
}
}
-const bR = (i, e, t) => i & e ^ ~i & t, xR = (i, e, t) => i & e ^ i & t ^ e & t, ER = /* @__PURE__ */ new Uint32Array([
+const OF = (i, e, t) => i & e ^ ~i & t, QF = (i, e, t) => i & e ^ i & t ^ e & t, GF = /* @__PURE__ */ new Uint32Array([
1116352408,
1899447441,
3049323471,
@@ -36213,7 +38602,7 @@ const bR = (i, e, t) => i & e ^ ~i & t, xR = (i, e, t) => i & e ^ i & t ^ e & t,
2756734187,
3204031479,
3329325298
-]), Ss = /* @__PURE__ */ new Uint32Array([
+]), Ds = /* @__PURE__ */ new Uint32Array([
1779033703,
3144134277,
1013904242,
@@ -36222,10 +38611,10 @@ const bR = (i, e, t) => i & e ^ ~i & t, xR = (i, e, t) => i & e ^ i & t ^ e & t,
2600822924,
528734635,
1541459225
-]), Is = /* @__PURE__ */ new Uint32Array(64);
-class _R extends Fb {
+]), Ns = /* @__PURE__ */ new Uint32Array(64);
+class HF extends mb {
constructor() {
- super(64, 32, 8, !1), this.A = Ss[0] | 0, this.B = Ss[1] | 0, this.C = Ss[2] | 0, this.D = Ss[3] | 0, this.E = Ss[4] | 0, this.F = Ss[5] | 0, this.G = Ss[6] | 0, this.H = Ss[7] | 0;
+ 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;
}
get() {
const { A: e, B: t, C: n, D: s, E: r, F: a, G: o, H: c } = this;
@@ -36237,66 +38626,66 @@ class _R extends Fb {
}
process(e, t) {
for (let u = 0; u < 16; u++, t += 4)
- Is[u] = e.getUint32(t, !1);
+ Ns[u] = e.getUint32(t, !1);
for (let u = 16; u < 64; u++) {
- const d = Is[u - 15], f = Is[u - 2], m = Ii(d, 7) ^ Ii(d, 18) ^ d >>> 3, g = Ii(f, 17) ^ Ii(f, 19) ^ f >>> 10;
- Is[u] = g + Is[u - 7] + m + Is[u - 16] | 0;
+ 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;
}
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 = Ii(o, 6) ^ Ii(o, 11) ^ Ii(o, 25), f = h + d + bR(o, c, l) + ER[u] + Is[u] | 0, g = (Ii(n, 2) ^ Ii(n, 13) ^ Ii(n, 22)) + xR(n, s, r) | 0;
- h = l, l = c, c = o, o = a + f | 0, a = r, r = s, s = n, n = f + g | 0;
+ 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;
+ 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() {
- Is.fill(0);
+ Ns.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
}
-const Db = /* @__PURE__ */ zf(() => new _R()), $c = /* @__PURE__ */ BigInt(2 ** 32 - 1), Pd = /* @__PURE__ */ BigInt(32);
-function Lb(i, e = !1) {
- return e ? { h: Number(i & $c), l: Number(i >> Pd & $c) } : { h: Number(i >> Pd & $c) | 0, l: Number(i & $c) | 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 };
}
-function Pb(i, e = !1) {
+function Eb(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 } = Lb(i[s], e);
+ const { h: r, l: a } = bb(i[s], e);
[t[s], n[s]] = [r, a];
}
return [t, n];
}
-const yR = (i, e) => BigInt(i >>> 0) << Pd | BigInt(e >>> 0), wR = (i, e, t) => i >>> t, vR = (i, e, t) => i << 32 - t | e >>> t, CR = (i, e, t) => i >>> t | e << 32 - t, SR = (i, e, t) => i << 32 - t | e >>> t, IR = (i, e, t) => i << 64 - t | e >>> t - 32, MR = (i, e, t) => i >>> t - 32 | e << 64 - t, BR = (i, e) => e, TR = (i, e) => i, kb = (i, e, t) => i << t | e >>> 32 - t, Ub = (i, e, t) => e << t | i >>> 32 - t, Ob = (i, e, t) => e << t - 32 | i >>> 64 - t, Qb = (i, e, t) => i << t - 32 | e >>> 64 - t;
-function RR(i, e, 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 s = (e >>> 0) + (n >>> 0);
return { h: i + t + (s / 2 ** 32 | 0) | 0, l: s | 0 };
}
-const NR = (i, e, t) => (i >>> 0) + (e >>> 0) + (t >>> 0), FR = (i, e, t, n) => e + t + n + (i / 2 ** 32 | 0) | 0, DR = (i, e, t, n) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0), LR = (i, e, t, n, s) => e + t + n + s + (i / 2 ** 32 | 0) | 0, PR = (i, e, t, n, s) => (i >>> 0) + (e >>> 0) + (t >>> 0) + (n >>> 0) + (s >>> 0), kR = (i, e, t, n, s, r) => e + t + n + s + r + (i / 2 ** 32 | 0) | 0, at = {
- fromBig: Lb,
- split: Pb,
- toBig: yR,
- shrSH: wR,
- shrSL: vR,
- rotrSH: CR,
- rotrSL: SR,
- rotrBH: IR,
- rotrBL: MR,
- rotr32H: BR,
- rotr32L: TR,
- rotlSH: kb,
- rotlSL: Ub,
- rotlBH: Ob,
- rotlBL: Qb,
- add: RR,
- add3L: NR,
- add3H: FR,
- add4L: DR,
- add4H: LR,
- add5H: kR,
- add5L: PR
-}, [UR, OR] = at.split([
+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([
"0x428a2f98d728ae22",
"0x7137449123ef65cd",
"0xb5c0fbcfec4d3b2f",
@@ -36377,45 +38766,45 @@ const NR = (i, e, t) => (i >>> 0) + (e >>> 0) + (t >>> 0), FR = (i, e, t, n) =>
"0x597f299cfc657e2a",
"0x5fcb6fab3ad6faec",
"0x6c44198c4a475817"
-].map((i) => BigInt(i))), Ms = /* @__PURE__ */ new Uint32Array(80), Bs = /* @__PURE__ */ new Uint32Array(80);
-class QR extends Fb {
+].map((i) => BigInt(i))), Ls = /* @__PURE__ */ new Uint32Array(80), Ps = /* @__PURE__ */ new Uint32Array(80);
+class oD extends mb {
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;
}
// prettier-ignore
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: m, Hh: g, Hl: A } = this;
- return [e, t, n, s, r, a, o, c, l, h, u, d, f, m, g, A];
+ 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];
}
// prettier-ignore
- set(e, t, n, s, r, a, o, c, l, h, u, d, f, m, g, A) {
- 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 = m | 0, this.Hh = g | 0, this.Hl = A | 0;
+ 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 b = 0; b < 16; b++, t += 4)
- Ms[b] = e.getUint32(t), Bs[b] = e.getUint32(t += 4);
- for (let b = 16; b < 80; b++) {
- const _ = Ms[b - 15] | 0, M = Bs[b - 15] | 0, w = at.rotrSH(_, M, 1) ^ at.rotrSH(_, M, 8) ^ at.shrSH(_, M, 7), S = at.rotrSL(_, M, 1) ^ at.rotrSL(_, M, 8) ^ at.shrSL(_, M, 7), T = Ms[b - 2] | 0, C = Bs[b - 2] | 0, v = at.rotrSH(T, C, 19) ^ at.rotrBH(T, C, 61) ^ at.shrSH(T, C, 6), F = at.rotrSL(T, C, 19) ^ at.rotrBL(T, C, 61) ^ at.shrSL(T, C, 6), K = at.add4L(S, F, Bs[b - 7], Bs[b - 16]), q = at.add4H(K, w, v, Ms[b - 7], Ms[b - 16]);
- Ms[b] = q | 0, Bs[b] = K | 0;
+ 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]);
+ 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: m, Gh: g, Gl: A, Hh: p, Hl: y } = this;
- for (let b = 0; b < 80; b++) {
- const _ = at.rotrSH(u, d, 14) ^ at.rotrSH(u, d, 18) ^ at.rotrBH(u, d, 41), M = at.rotrSL(u, d, 14) ^ at.rotrSL(u, d, 18) ^ at.rotrBL(u, d, 41), w = u & f ^ ~u & g, S = d & m ^ ~d & A, T = at.add5L(y, M, S, OR[b], Bs[b]), C = at.add5H(T, p, _, w, UR[b], Ms[b]), v = T | 0, F = at.rotrSH(n, s, 28) ^ at.rotrBH(n, s, 34) ^ at.rotrBH(n, s, 39), K = at.rotrSL(n, s, 28) ^ at.rotrBL(n, s, 34) ^ at.rotrBL(n, s, 39), q = n & r ^ n & o ^ r & o, $ = s & a ^ s & c ^ a & c;
- p = g | 0, y = A | 0, g = f | 0, A = m | 0, f = u | 0, m = d | 0, { h: u, l: d } = at.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 = at.add3L(v, K, $);
- n = at.add3H(D, C, F, q), s = D | 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;
+ 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;
}
- ({ h: n, l: s } = at.add(this.Ah | 0, this.Al | 0, n | 0, s | 0)), { h: r, l: a } = at.add(this.Bh | 0, this.Bl | 0, r | 0, a | 0), { h: o, l: c } = at.add(this.Ch | 0, this.Cl | 0, o | 0, c | 0), { h: l, l: h } = at.add(this.Dh | 0, this.Dl | 0, l | 0, h | 0), { h: u, l: d } = at.add(this.Eh | 0, this.El | 0, u | 0, d | 0), { h: f, l: m } = at.add(this.Fh | 0, this.Fl | 0, f | 0, m | 0), { h: g, l: A } = at.add(this.Gh | 0, this.Gl | 0, g | 0, A | 0), { h: p, l: y } = at.add(this.Hh | 0, this.Hl | 0, p | 0, y | 0), this.set(n, s, r, a, o, c, l, h, u, d, f, m, g, A, p, 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: 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);
}
roundClean() {
- Ms.fill(0), Bs.fill(0);
+ Ls.fill(0), Ps.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 GR = /* @__PURE__ */ zf(() => new QR());
-function HR() {
+const cD = /* @__PURE__ */ mp(() => new oD());
+function lD() {
if (typeof self < "u")
return self;
if (typeof window < "u")
@@ -36424,39 +38813,39 @@ function HR() {
return global;
throw new Error("unable to locate global object");
}
-const Mg = HR();
-Mg.crypto || Mg.msCrypto;
-function zR(i) {
+const om = lD();
+om.crypto || om.msCrypto;
+function hD(i) {
switch (i) {
case "sha256":
- return Db.create();
+ return xb.create();
case "sha512":
- return GR.create();
+ return cD.create();
}
V(!1, "invalid hashing algorithm name", "algorithm", i);
}
-const [Gb, Hb, zb] = [[], [], []], VR = /* @__PURE__ */ BigInt(0), co = /* @__PURE__ */ BigInt(1), WR = /* @__PURE__ */ BigInt(2), qR = /* @__PURE__ */ BigInt(7), KR = /* @__PURE__ */ BigInt(256), jR = /* @__PURE__ */ BigInt(113);
-for (let i = 0, e = co, t = 1, n = 0; i < 24; i++) {
- [t, n] = [n, (2 * t + 3 * n) % 5], Gb.push(2 * (5 * n + t)), Hb.push((i + 1) * (i + 2) / 2 % 64);
- let s = VR;
+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;
for (let r = 0; r < 7; r++)
- e = (e << co ^ (e >> qR) * jR) % KR, e & WR && (s ^= co << (co << /* @__PURE__ */ BigInt(r)) - co);
- zb.push(s);
+ e = (e << xo ^ (e >> fD) * AD) % pD, e & dD && (s ^= xo << (xo << /* @__PURE__ */ BigInt(r)) - xo);
+ Ib.push(s);
}
-const [XR, YR] = /* @__PURE__ */ Pb(zb, !0), Bg = (i, e, t) => t > 32 ? Ob(i, e, t) : kb(i, e, t), Tg = (i, e, t) => t > 32 ? Qb(i, e, t) : Ub(i, e, t);
-function JR(i, e = 24) {
+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 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 = Bg(l, h, 1) ^ t[o], d = Tg(l, h, 1) ^ t[o + 1];
+ 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];
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 = Hb[a], c = Bg(s, r, o), l = Tg(s, r, o), h = Gb[a];
+ const o = Sb[a], c = cm(s, r, o), l = lm(s, r, o), h = Cb[a];
s = i[h], r = i[h + 1], i[h] = c, i[h + 1] = l;
}
for (let a = 0; a < 50; a += 10) {
@@ -36465,24 +38854,24 @@ function JR(i, e = 24) {
for (let o = 0; o < 10; o++)
i[a + o] ^= ~t[(o + 2) % 10] & t[(o + 4) % 10];
}
- i[0] ^= XR[n], i[1] ^= YR[n];
+ i[0] ^= gD[n], i[1] ^= mD[n];
}
t.fill(0);
}
-class Vf extends Hf {
+class xp extends gp {
// 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, Fl(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, eh(n), 0 >= this.blockLen || this.blockLen >= 200)
throw new Error("Sha3 supports only keccak-f1600 function");
- this.state = new Uint8Array(200), this.state32 = dR(this.state);
+ this.state = new Uint8Array(200), this.state32 = DF(this.state);
}
keccak() {
- JR(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
+ xD(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
}
update(e) {
- Ba(this);
+ ka(this);
const { blockLen: t, state: n } = this;
- e = $l(e);
+ e = vh(e);
const s = e.length;
for (let r = 0; r < s; ) {
const a = Math.min(t - this.pos, s - r);
@@ -36500,7 +38889,7 @@ class Vf extends Hf {
e[n] ^= t, (t & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
}
writeInto(e) {
- Ba(this, !1), Gf(e), this.finish();
+ ka(this, !1), Ap(e), this.finish();
const t = this.state, { blockLen: n } = this;
for (let s = 0, r = e.length; s < r; ) {
this.posOut >= n && this.keccak();
@@ -36515,10 +38904,10 @@ class Vf extends Hf {
return this.writeInto(e);
}
xof(e) {
- return Fl(e), this.xofInto(new Uint8Array(e));
+ return eh(e), this.xofInto(new Uint8Array(e));
}
digestInto(e) {
- if (Bb(e, this), this.finished)
+ if (fb(e, this), this.finished)
throw new Error("digest() was already called");
return this.writeInto(e), this.destroy(), e;
}
@@ -36530,64 +38919,64 @@ class Vf extends Hf {
}
_cloneInto(e) {
const { blockLen: t, suffix: n, outputLen: s, rounds: r, enableXOF: a } = this;
- return e || (e = new Vf(t, n, s, a, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = n, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
+ 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;
}
}
-const ZR = (i, e, t) => zf(() => new Vf(e, i, t)), $R = /* @__PURE__ */ ZR(1, 136, 256 / 8);
-let Vb = !1;
-const Wb = function(i) {
- return $R(i);
+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);
};
-let qb = Wb;
-function Zt(i) {
- const e = ht(i, "data");
- return Se(qb(e));
-}
-Zt._ = Wb;
-Zt.lock = function() {
- Vb = !0;
+let Tb = Bb;
+function sn(i) {
+ const e = dt(i, "data");
+ return Se(Tb(e));
+}
+sn._ = Bb;
+sn.lock = function() {
+ Mb = !0;
};
-Zt.register = function(i) {
- if (Vb)
+sn.register = function(i) {
+ if (Mb)
throw new TypeError("keccak256 is locked");
- qb = i;
+ Tb = i;
};
-Object.freeze(Zt);
-const Kb = function(i) {
- return zR("sha256").update(i).digest();
+Object.freeze(sn);
+const Rb = function(i) {
+ return hD("sha256").update(i).digest();
};
-let jb = Kb, Xb = !1;
-function Ga(i) {
- const e = ht(i, "data");
- return Se(jb(e));
-}
-Ga._ = Kb;
-Ga.lock = function() {
- Xb = !0;
+let Fb = Rb, Db = !1;
+function Ya(i) {
+ const e = dt(i, "data");
+ return Se(Fb(e));
+}
+Ya._ = Rb;
+Ya.lock = function() {
+ Db = !0;
};
-Ga.register = function(i) {
- if (Xb)
+Ya.register = function(i) {
+ if (Db)
throw new Error("sha256 is locked");
- jb = i;
+ Fb = i;
};
-Object.freeze(Ga);
-Object.freeze(Ga);
+Object.freeze(Ya);
+Object.freeze(Ya);
BigInt(0);
-const eN = BigInt(1), tN = BigInt(2), eh = (i) => i instanceof Uint8Array, nN = /* @__PURE__ */ Array.from({ length: 256 }, (i, e) => e.toString(16).padStart(2, "0"));
-function Ta(i) {
- if (!eh(i))
+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))
throw new Error("Uint8Array expected");
let e = "";
for (let t = 0; t < i.length; t++)
- e += nN[i[t]];
+ e += wD[i[t]];
return e;
}
-function Wf(i) {
+function bp(i) {
if (typeof i != "string")
throw new Error("hex string expected, got " + typeof i);
return BigInt(i === "" ? "0" : `0x${i}`);
}
-function Oo(i) {
+function ec(i) {
if (typeof i != "string")
throw new Error("hex string expected, got " + typeof i);
const e = i.length;
@@ -36602,29 +38991,29 @@ function Oo(i) {
}
return t;
}
-function gr(i) {
- return Wf(Ta(i));
+function vr(i) {
+ return bp(Ua(i));
}
-function qf(i) {
- if (!eh(i))
+function Ep(i) {
+ if (!Ch(i))
throw new Error("Uint8Array expected");
- return Wf(Ta(Uint8Array.from(i).reverse()));
+ return bp(Ua(Uint8Array.from(i).reverse()));
}
-function Ra(i, e) {
- return Oo(i.toString(16).padStart(e * 2, "0"));
+function Oa(i, e) {
+ return ec(i.toString(16).padStart(e * 2, "0"));
}
-function Kf(i, e) {
- return Ra(i, e).reverse();
+function _p(i, e) {
+ return Oa(i, e).reverse();
}
-function di(i, e, t) {
+function _i(i, e, t) {
let n;
if (typeof e == "string")
try {
- n = Oo(e);
+ n = ec(e);
} catch (r) {
throw new Error(`${i} must be valid hex string, got "${e}". Cause: ${r}`);
}
- else if (eh(e))
+ else if (Ch(e))
n = Uint8Array.from(e);
else
throw new Error(`${i} must be hex string or Uint8Array`);
@@ -36633,28 +39022,28 @@ function di(i, e, t) {
throw new Error(`${i} expected ${t} bytes, got ${s}`);
return n;
}
-function Qo(...i) {
+function tc(...i) {
const e = new Uint8Array(i.reduce((n, s) => n + s.length, 0));
let t = 0;
return i.forEach((n) => {
- if (!eh(n))
+ if (!Ch(n))
throw new Error("Uint8Array expected");
e.set(n, t), t += n.length;
}), e;
}
-const jf = (i) => (tN << BigInt(i - 1)) - eN, bu = (i) => new Uint8Array(i), Rg = (i) => Uint8Array.from(i);
-function Yb(i, e, t) {
+const yp = (i) => (yD << BigInt(i - 1)) - _D, Wu = (i) => new Uint8Array(i), hm = (i) => Uint8Array.from(i);
+function Nb(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 = bu(i), s = bu(i), r = 0;
+ let n = Wu(i), s = Wu(i), r = 0;
const a = () => {
n.fill(1), s.fill(0), r = 0;
- }, o = (...u) => t(s, n, ...u), c = (u = bu()) => {
- s = o(Rg([0]), u), n = o(), u.length !== 0 && (s = o(Rg([1]), u), n = o());
+ }, 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());
}, l = () => {
if (r++ >= 1e3)
throw new Error("drbg: tried 1000 values");
@@ -36665,7 +39054,7 @@ function Yb(i, e, t) {
const f = n.slice();
d.push(f), u += n.length;
}
- return Qo(...d);
+ return tc(...d);
};
return (u, d) => {
a(), c(u);
@@ -36675,7 +39064,7 @@ function Yb(i, e, t) {
return a(), f;
};
}
-const iN = {
+const vD = {
bigint: (i) => typeof i == "bigint",
function: (i) => typeof i == "function",
boolean: (i) => typeof i == "boolean",
@@ -36686,9 +39075,9 @@ const iN = {
field: (i, e) => e.Fp.isValid(i),
hash: (i) => typeof i == "function" && Number.isSafeInteger(i.outputLen)
};
-function tc(i, e, t = {}) {
+function Ac(i, e, t = {}) {
const n = (s, r, a) => {
- const o = iN[r];
+ const o = vD[r];
if (typeof o != "function")
throw new Error(`Invalid validator "${r}", expected function`);
const c = i[s];
@@ -36701,65 +39090,65 @@ function tc(i, e, t = {}) {
n(s, r, !0);
return i;
}
-const sN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
+const CD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
- bitMask: jf,
- bytesToHex: Ta,
- bytesToNumberBE: gr,
- bytesToNumberLE: qf,
- concatBytes: Qo,
- createHmacDrbg: Yb,
- ensureBytes: di,
- hexToBytes: Oo,
- hexToNumber: Wf,
- numberToBytesBE: Ra,
- numberToBytesLE: Kf,
- validateObject: tc
+ bitMask: yp,
+ bytesToHex: Ua,
+ bytesToNumberBE: vr,
+ bytesToNumberLE: Ep,
+ concatBytes: tc,
+ createHmacDrbg: Nb,
+ ensureBytes: _i,
+ hexToBytes: ec,
+ hexToNumber: bp,
+ numberToBytesBE: Oa,
+ numberToBytesLE: _p,
+ validateObject: Ac
}, Symbol.toStringTag, { value: "Module" }));
-const mn = BigInt(0), Xt = BigInt(1), cr = BigInt(2), rN = BigInt(3), kd = BigInt(4), Ng = BigInt(5), Fg = BigInt(8);
+const wn = BigInt(0), tn = BigInt(1), gr = BigInt(2), SD = BigInt(3), uf = BigInt(4), um = BigInt(5), dm = BigInt(8);
BigInt(9);
BigInt(16);
-function On(i, e) {
+function Kn(i, e) {
const t = i % e;
- return t >= mn ? t : e + t;
+ return t >= wn ? t : e + t;
}
-function aN(i, e, t) {
- if (t <= mn || e < mn)
+function ID(i, e, t) {
+ if (t <= wn || e < wn)
throw new Error("Expected power/modulo > 0");
- if (t === Xt)
- return mn;
- let n = Xt;
- for (; e > mn; )
- e & Xt && (n = n * i % t), i = i * i % t, e >>= Xt;
+ if (t === tn)
+ return wn;
+ let n = tn;
+ for (; e > wn; )
+ e & tn && (n = n * i % t), i = i * i % t, e >>= tn;
return n;
}
-function Jn(i, e, t) {
+function si(i, e, t) {
let n = i;
- for (; e-- > mn; )
+ for (; e-- > wn; )
n *= n, n %= t;
return n;
}
-function Ud(i, e) {
- if (i === mn || e <= mn)
+function df(i, e) {
+ if (i === wn || e <= wn)
throw new Error(`invert: expected positive integers, got n=${i} mod=${e}`);
- let t = On(i, e), n = e, s = mn, r = Xt;
- for (; t !== mn; ) {
+ let t = Kn(i, e), n = e, s = wn, r = tn;
+ for (; t !== wn; ) {
const o = n / t, c = n % t, l = s - r * o;
n = t, t = c, s = r, r = l;
}
- if (n !== Xt)
+ if (n !== tn)
throw new Error("invert: does not exist");
- return On(s, e);
+ return Kn(s, e);
}
-function oN(i) {
- const e = (i - Xt) / cr;
+function MD(i) {
+ const e = (i - tn) / gr;
let t, n, s;
- for (t = i - Xt, n = 0; t % cr === mn; t /= cr, n++)
+ for (t = i - tn, n = 0; t % gr === wn; t /= gr, n++)
;
- for (s = cr; s < i && aN(s, e, i) !== i - Xt; s++)
+ for (s = gr; s < i && ID(s, e, i) !== i - tn; s++)
;
if (n === 1) {
- const a = (i + Xt) / kd;
+ const a = (i + tn) / uf;
return function(c, l) {
const h = c.pow(l, a);
if (!c.eql(c.sqr(h), l))
@@ -36767,7 +39156,7 @@ function oN(i) {
return h;
};
}
- const r = (t + Xt) / cr;
+ const r = (t + tn) / gr;
return function(o, c) {
if (o.pow(c, e) === o.neg(o.ONE))
throw new Error("Cannot find square root");
@@ -36776,17 +39165,17 @@ function oN(i) {
if (o.eql(d, o.ZERO))
return o.ZERO;
let f = 1;
- for (let g = o.sqr(d); f < l && !o.eql(g, o.ONE); f++)
- g = o.sqr(g);
- const m = o.pow(h, Xt << BigInt(l - f - 1));
- h = o.sqr(m), u = o.mul(u, m), d = o.mul(d, h), l = f;
+ for (let m = o.sqr(d); f < l && !o.eql(m, o.ONE); f++)
+ m = o.sqr(m);
+ const p = o.pow(h, tn << BigInt(l - f - 1));
+ h = o.sqr(p), u = o.mul(u, p), d = o.mul(d, h), l = f;
}
return u;
};
}
-function cN(i) {
- if (i % kd === rN) {
- const e = (i + Xt) / kd;
+function BD(i) {
+ if (i % uf === SD) {
+ const e = (i + tn) / uf;
return function(n, s) {
const r = n.pow(s, e);
if (!n.eql(n.sqr(r), s))
@@ -36794,18 +39183,18 @@ function cN(i) {
return r;
};
}
- if (i % Fg === Ng) {
- const e = (i - Ng) / Fg;
+ if (i % dm === um) {
+ const e = (i - um) / dm;
return function(n, s) {
- const r = n.mul(s, cr), a = n.pow(r, e), o = n.mul(s, a), c = n.mul(n.mul(o, cr), a), l = n.mul(o, n.sub(c, n.ONE));
+ 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));
if (!n.eql(n.sqr(l), s))
throw new Error("Cannot find square root");
return l;
};
}
- return oN(i);
+ return MD(i);
}
-const lN = [
+const TD = [
"create",
"isValid",
"is0",
@@ -36824,103 +39213,103 @@ const lN = [
"mulN",
"sqrN"
];
-function hN(i) {
+function RD(i) {
const e = {
ORDER: "bigint",
MASK: "bigint",
BYTES: "isSafeInteger",
BITS: "isSafeInteger"
- }, t = lN.reduce((n, s) => (n[s] = "function", n), e);
- return tc(i, t);
+ }, t = TD.reduce((n, s) => (n[s] = "function", n), e);
+ return Ac(i, t);
}
-function uN(i, e, t) {
- if (t < mn)
+function FD(i, e, t) {
+ if (t < wn)
throw new Error("Expected power > 0");
- if (t === mn)
+ if (t === wn)
return i.ONE;
- if (t === Xt)
+ if (t === tn)
return e;
let n = i.ONE, s = e;
- for (; t > mn; )
- t & Xt && (n = i.mul(n, s)), s = i.sqr(s), t >>= Xt;
+ for (; t > wn; )
+ t & tn && (n = i.mul(n, s)), s = i.sqr(s), t >>= tn;
return n;
}
-function dN(i, e) {
+function DD(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 Jb(i, e) {
+function Lb(i, e) {
const t = e !== void 0 ? e : i.toString(2).length, n = Math.ceil(t / 8);
return { nBitLength: t, nByteLength: n };
}
-function fN(i, e, t = !1, n = {}) {
- if (i <= mn)
+function ND(i, e, t = !1, n = {}) {
+ if (i <= wn)
throw new Error(`Expected Field ORDER > 0, got ${i}`);
- const { nBitLength: s, nByteLength: r } = Jb(i, e);
+ const { nBitLength: s, nByteLength: r } = Lb(i, e);
if (r > 2048)
throw new Error("Field lengths over 2048 bytes are not supported");
- const a = cN(i), o = Object.freeze({
+ const a = BD(i), o = Object.freeze({
ORDER: i,
BITS: s,
BYTES: r,
- MASK: jf(s),
- ZERO: mn,
- ONE: Xt,
- create: (c) => On(c, i),
+ MASK: yp(s),
+ ZERO: wn,
+ ONE: tn,
+ create: (c) => Kn(c, i),
isValid: (c) => {
if (typeof c != "bigint")
throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);
- return mn <= c && c < i;
+ return wn <= c && c < i;
},
- is0: (c) => c === mn,
- isOdd: (c) => (c & Xt) === Xt,
- neg: (c) => On(-c, i),
+ is0: (c) => c === wn,
+ isOdd: (c) => (c & tn) === tn,
+ neg: (c) => Kn(-c, i),
eql: (c, l) => c === l,
- sqr: (c) => On(c * c, i),
- add: (c, l) => On(c + l, i),
- sub: (c, l) => On(c - l, i),
- mul: (c, l) => On(c * l, i),
- pow: (c, l) => uN(o, c, l),
- div: (c, l) => On(c * Ud(l, i), i),
+ sqr: (c) => Kn(c * c, i),
+ add: (c, l) => Kn(c + l, i),
+ sub: (c, l) => Kn(c - l, i),
+ mul: (c, l) => Kn(c * l, i),
+ pow: (c, l) => FD(o, c, l),
+ div: (c, l) => Kn(c * df(l, i), i),
// Same as above, but doesn't normalize
sqrN: (c) => c * c,
addN: (c, l) => c + l,
subN: (c, l) => c - l,
mulN: (c, l) => c * l,
- inv: (c) => Ud(c, i),
+ inv: (c) => df(c, i),
sqrt: n.sqrt || ((c) => a(o, c)),
- invertBatch: (c) => dN(o, c),
+ invertBatch: (c) => DD(o, c),
// TODO: do we really need constant cmov?
// We don't have const-time bigints anyway, so probably will be not very useful
cmov: (c, l, h) => h ? l : c,
- toBytes: (c) => t ? Kf(c, r) : Ra(c, r),
+ toBytes: (c) => t ? _p(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) : gr(c);
+ return t ? Ep(c) : vr(c);
}
});
return Object.freeze(o);
}
-function Zb(i) {
+function Pb(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 $b(i) {
- const e = Zb(i);
+function kb(i) {
+ const e = Pb(i);
return e + Math.ceil(e / 2);
}
-function pN(i, e, t = !1) {
- const n = i.length, s = Zb(e), r = $b(e);
+function LD(i, e, t = !1) {
+ const n = i.length, s = Pb(e), r = kb(e);
if (n < 16 || n < r || n > 1024)
throw new Error(`expected ${r}-1024 bytes of input, got ${n}`);
- const a = t ? gr(i) : qf(i), o = On(a, e - Xt) + Xt;
- return t ? Kf(o, s) : Ra(o, s);
+ const a = t ? vr(i) : Ep(i), o = Kn(a, e - tn) + tn;
+ return t ? _p(o, s) : Oa(o, s);
}
-const AN = BigInt(0), xu = BigInt(1);
-function gN(i, e) {
+const PD = BigInt(0), qu = BigInt(1);
+function kD(i, e) {
const t = (s, r) => {
const a = r.negate();
return s ? a : r;
@@ -36933,8 +39322,8 @@ function gN(i, e) {
// non-const time multiplication ladder
unsafeLadder(s, r) {
let a = i.ZERO, o = s;
- for (; r > AN; )
- r & xu && (a = a.add(o)), o = o.double(), r >>= xu;
+ for (; r > PD; )
+ r & qu && (a = a.add(o)), o = o.double(), r >>= qu;
return a;
},
/**
@@ -36969,12 +39358,12 @@ function gN(i, e) {
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 m = 0; m < o; m++) {
- const g = m * c;
- let A = Number(a & u);
- a >>= f, A > c && (A -= d, a += xu);
- const p = g, y = g + Math.abs(A) - 1, b = m % 2 !== 0, _ = A < 0;
- A === 0 ? h = h.add(t(b, r[p])) : l = l.add(t(_, r[y]));
+ 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]));
}
return { p: l, f: h };
},
@@ -36985,8 +39374,8 @@ function gN(i, e) {
}
};
}
-function ex(i) {
- return hN(i.Fp), tc(i, {
+function Ub(i) {
+ return RD(i.Fp), Ac(i, {
n: "bigint",
h: "bigint",
Gx: "field",
@@ -36995,14 +39384,14 @@ function ex(i) {
nBitLength: "isSafeInteger",
nByteLength: "isSafeInteger"
}), Object.freeze({
- ...Jb(i.n, i.nBitLength),
+ ...Lb(i.n, i.nBitLength),
...i,
p: i.Fp.ORDER
});
}
-function mN(i) {
- const e = ex(i);
- tc(e, {
+function UD(i) {
+ const e = Ub(i);
+ Ac(e, {
a: "field",
b: "field"
}, {
@@ -37023,7 +39412,7 @@ function mN(i) {
}
return Object.freeze({ ...e });
}
-const { bytesToNumberBE: bN, hexToBytes: xN } = sN, fr = {
+const { bytesToNumberBE: OD, hexToBytes: QD } = CD, Er = {
// asn.1 DER encoding utils
Err: class extends Error {
constructor(e = "") {
@@ -37031,7 +39420,7 @@ const { bytesToNumberBE: bN, hexToBytes: xN } = sN, fr = {
}
},
_parseInt(i) {
- const { Err: e } = fr;
+ const { Err: e } = Er;
if (i.length < 2 || i[0] !== 2)
throw new e("Invalid signature integer tag");
const t = i[1], n = i.subarray(2, t + 2);
@@ -37041,10 +39430,10 @@ const { bytesToNumberBE: bN, hexToBytes: xN } = sN, fr = {
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: bN(n), l: i.subarray(t + 2) };
+ return { d: OD(n), l: i.subarray(t + 2) };
},
toSig(i) {
- const { Err: e } = fr, t = typeof i == "string" ? xN(i) : i;
+ const { Err: e } = Er, t = typeof i == "string" ? QD(i) : i;
if (!(t instanceof Uint8Array))
throw new Error("ui8a expected");
let n = t.length;
@@ -37052,7 +39441,7 @@ const { bytesToNumberBE: bN, hexToBytes: xN } = sN, fr = {
throw new e("Invalid signature tag");
if (t[1] !== n - 2)
throw new e("Invalid signature: incorrect length");
- const { d: s, l: r } = fr._parseInt(t.subarray(2)), { d: a, l: o } = fr._parseInt(r);
+ const { d: s, l: r } = Er._parseInt(t.subarray(2)), { d: a, l: o } = Er._parseInt(r);
if (o.length)
throw new e("Invalid signature: left bytes after parsing");
return { r: s, s: a };
@@ -37064,70 +39453,70 @@ const { bytesToNumberBE: bN, hexToBytes: xN } = sN, fr = {
}, 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}`;
}
-}, $i = BigInt(0), $n = BigInt(1);
+}, rs = BigInt(0), ai = BigInt(1);
BigInt(2);
-const Dg = BigInt(3);
+const fm = BigInt(3);
BigInt(4);
-function EN(i) {
- const e = mN(i), { Fp: t } = e, n = e.toBytes || ((m, g, A) => {
- const p = g.toAffine();
- return Qo(Uint8Array.from([4]), t.toBytes(p.x), t.toBytes(p.y));
- }), s = e.fromBytes || ((m) => {
- const g = m.subarray(1), A = t.fromBytes(g.subarray(0, t.BYTES)), p = t.fromBytes(g.subarray(t.BYTES, 2 * t.BYTES));
- return { x: A, y: p };
+function GD(i) {
+ const e = UD(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));
+ }), 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(m) {
- const { a: g, b: A } = e, p = t.sqr(m), y = t.mul(p, m);
- return t.add(t.add(y, t.mul(m, g)), 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);
}
if (!t.eql(t.sqr(e.Gy), r(e.Gx)))
throw new Error("bad generator point: equation left != right");
- function a(m) {
- return typeof m == "bigint" && $i < m && m < e.n;
+ function a(p) {
+ return typeof p == "bigint" && rs < p && p < e.n;
}
- function o(m) {
- if (!a(m))
+ function o(p) {
+ if (!a(p))
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
}
- function c(m) {
- const { allowedPrivateKeyLengths: g, nByteLength: A, wrapPrivateKey: p, n: y } = e;
- if (g && typeof m != "bigint") {
- if (m instanceof Uint8Array && (m = Ta(m)), typeof m != "string" || !g.includes(m.length))
+ function c(p) {
+ const { allowedPrivateKeyLengths: m, nByteLength: g, wrapPrivateKey: A, n: y } = 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");
- m = m.padStart(A * 2, "0");
+ p = p.padStart(g * 2, "0");
}
- let b;
+ let x;
try {
- b = typeof m == "bigint" ? m : gr(di("private key", m, A));
+ x = typeof p == "bigint" ? p : vr(_i("private key", p, g));
} catch {
- throw new Error(`private key must be ${A} bytes, hex or bigint, not ${typeof m}`);
+ throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`);
}
- return p && (b = On(b, y)), o(b), b;
+ return A && (x = Kn(x, y)), o(x), x;
}
const l = /* @__PURE__ */ new Map();
- function h(m) {
- if (!(m instanceof u))
+ function h(p) {
+ if (!(p instanceof u))
throw new Error("ProjectivePoint expected");
}
class u {
- constructor(g, A, p) {
- if (this.px = g, this.py = A, this.pz = p, g == null || !t.isValid(g))
+ 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 (A == null || !t.isValid(A))
+ if (g == null || !t.isValid(g))
throw new Error("y required");
- if (p == null || !t.isValid(p))
+ if (A == null || !t.isValid(A))
throw new Error("z required");
}
// Does not validate if the point is on-curve.
// Use fromHex instead, or call assertValidity() later.
- static fromAffine(g) {
- const { x: A, y: p } = g || {};
- if (!g || !t.isValid(A) || !t.isValid(p))
+ static fromAffine(m) {
+ const { x: g, y: A } = m || {};
+ if (!m || !t.isValid(g) || !t.isValid(A))
throw new Error("invalid affine point");
- if (g instanceof u)
+ if (m instanceof u)
throw new Error("projective point not allowed");
- const y = (b) => t.eql(b, t.ZERO);
- return y(A) && y(p) ? u.ZERO : new u(A, p, t.ONE);
+ const y = (x) => t.eql(x, t.ZERO);
+ return y(g) && y(A) ? u.ZERO : new u(g, A, t.ONE);
}
get x() {
return this.toAffine().x;
@@ -37141,25 +39530,25 @@ function EN(i) {
* so this improves performance massively.
* Optimization: converts a list of projective points to a list of identical points with Z=1.
*/
- static normalizeZ(g) {
- const A = t.invertBatch(g.map((p) => p.pz));
- return g.map((p, y) => p.toAffine(A[y])).map(u.fromAffine);
+ static normalizeZ(m) {
+ const g = t.invertBatch(m.map((A) => A.pz));
+ return m.map((A, y) => A.toAffine(g[y])).map(u.fromAffine);
}
/**
* Converts hash string or Uint8Array to Point.
* @param hex short/long ECDSA hex
*/
- static fromHex(g) {
- const A = u.fromAffine(s(di("pointHex", g)));
- return A.assertValidity(), A;
+ static fromHex(m) {
+ const g = u.fromAffine(s(_i("pointHex", m)));
+ return g.assertValidity(), g;
}
// Multiplies generator point by privateKey.
- static fromPrivateKey(g) {
- return u.BASE.multiply(c(g));
+ static fromPrivateKey(m) {
+ return u.BASE.multiply(c(m));
}
// "Private method", don't use it directly
- _setWindowSize(g) {
- this._WINDOW_SIZE = g, l.delete(this);
+ _setWindowSize(m) {
+ this._WINDOW_SIZE = m, l.delete(this);
}
// A point on curve is valid if it conforms to equation.
assertValidity() {
@@ -37168,27 +39557,27 @@ function EN(i) {
return;
throw new Error("bad point: ZERO");
}
- const { x: g, y: A } = this.toAffine();
- if (!t.isValid(g) || !t.isValid(A))
+ 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 p = t.sqr(A), y = r(g);
- if (!t.eql(p, y))
+ const A = t.sqr(g), y = r(m);
+ if (!t.eql(A, y))
throw new Error("bad point: equation left != right");
if (!this.isTorsionFree())
throw new Error("bad point: not in prime-order subgroup");
}
hasEvenY() {
- const { y: g } = this.toAffine();
+ const { y: m } = this.toAffine();
if (t.isOdd)
- return !t.isOdd(g);
+ return !t.isOdd(m);
throw new Error("Field doesn't support isOdd");
}
/**
* Compare one point to another.
*/
- equals(g) {
- h(g);
- const { px: A, py: p, pz: y } = this, { px: b, py: _, pz: M } = g, w = t.eql(t.mul(A, M), t.mul(b, y)), S = t.eql(t.mul(p, M), t.mul(_, y));
+ 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;
}
/**
@@ -37202,34 +39591,34 @@ function EN(i) {
// https://eprint.iacr.org/2015/1060, algorithm 3
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
double() {
- const { a: g, b: A } = e, p = t.mul(A, Dg), { px: y, py: b, pz: _ } = this;
- let M = t.ZERO, w = t.ZERO, S = t.ZERO, T = t.mul(y, y), C = t.mul(b, b), v = t.mul(_, _), F = t.mul(y, b);
- return F = t.add(F, F), S = t.mul(y, _), S = t.add(S, S), M = t.mul(g, S), w = t.mul(p, v), w = t.add(M, w), M = t.sub(C, w), w = t.add(C, w), w = t.mul(M, w), M = t.mul(F, M), S = t.mul(p, S), v = t.mul(g, v), F = t.sub(T, v), F = t.mul(g, 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(b, _), v = t.add(v, v), T = t.mul(v, F), M = t.sub(M, T), S = t.mul(v, C), S = t.add(S, S), S = t.add(S, S), new u(M, w, S);
+ 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);
}
// Renes-Costello-Batina exception-free addition formula.
// There is 30% faster Jacobian formula, but it is not complete.
// https://eprint.iacr.org/2015/1060, algorithm 1
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
- add(g) {
- h(g);
- const { px: A, py: p, pz: y } = this, { px: b, py: _, pz: M } = g;
+ 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, Dg);
- let F = t.mul(A, b), K = t.mul(p, _), q = t.mul(y, M), $ = t.add(A, p), D = t.add(b, _);
- $ = t.mul($, D), D = t.add(F, K), $ = t.sub($, D), D = t.add(A, y);
- let O = t.add(b, M);
- return D = t.mul(D, O), O = t.add(F, q), D = t.sub(D, O), O = t.add(p, y), w = t.add(_, M), 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), S = 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), S = t.add(S, 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, S, T);
+ 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);
}
- subtract(g) {
- return this.add(g.negate());
+ subtract(m) {
+ return this.add(m.negate());
}
is0() {
return this.equals(u.ZERO);
}
- wNAF(g) {
- return f.wNAFCached(this, l, g, (A) => {
- const p = t.invertBatch(A.map((y) => y.pz));
- return A.map((y, b) => y.toAffine(p[b])).map(u.fromAffine);
+ 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);
});
}
/**
@@ -37237,19 +39626,19 @@ function EN(i) {
* It's faster, but should only be used when you don't care about
* an exposed private key e.g. sig verification, which works over *public* keys.
*/
- multiplyUnsafe(g) {
- const A = u.ZERO;
- if (g === $i)
- return A;
- if (o(g), g === $n)
+ multiplyUnsafe(m) {
+ const g = u.ZERO;
+ if (m === rs)
+ return g;
+ if (o(m), m === ai)
return this;
- const { endo: p } = e;
- if (!p)
- return f.unsafeLadder(this, g);
- let { k1neg: y, k1: b, k2neg: _, k2: M } = p.splitScalar(g), w = A, S = A, T = this;
- for (; b > $i || M > $i; )
- b & $n && (w = w.add(T)), M & $n && (S = S.add(T)), T = T.double(), b >>= $n, M >>= $n;
- return y && (w = w.negate()), _ && (S = S.negate()), S = new u(t.mul(S.px, p.beta), S.py, S.pz), w.add(S);
+ 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);
}
/**
* Constant time multiplication.
@@ -37260,19 +39649,19 @@ function EN(i) {
* @param scalar by which the point would be multiplied
* @returns New point
*/
- multiply(g) {
- o(g);
- let A = g, p, y;
- const { endo: b } = e;
- if (b) {
- const { k1neg: _, k1: M, k2neg: w, k2: S } = b.splitScalar(A);
- let { p: T, f: C } = this.wNAF(M), { p: v, f: F } = this.wNAF(S);
- T = f.constTimeNegate(_, T), v = f.constTimeNegate(w, v), v = new u(t.mul(v.px, b.beta), v.py, v.pz), p = T.add(v), y = C.add(F);
+ multiply(m) {
+ o(m);
+ let g = m, A, y;
+ 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);
} else {
- const { p: _, f: M } = this.wNAF(A);
- p = _, y = M;
+ const { p: E, f: I } = this.wNAF(g);
+ A = E, y = I;
}
- return u.normalizeZ([p, y])[0];
+ return u.normalizeZ([A, y])[0];
}
/**
* Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
@@ -37280,44 +39669,44 @@ function EN(i) {
* The trick could be useful if both P and Q are not G (not in our case).
* @returns non-zero affine point
*/
- multiplyAndAddUnsafe(g, A, p) {
- const y = u.BASE, b = (M, w) => w === $i || w === $n || !M.equals(y) ? M.multiplyUnsafe(w) : M.multiply(w), _ = b(this, A).add(b(g, p));
- return _.is0() ? void 0 : _;
+ 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));
+ 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(g) {
- const { px: A, py: p, pz: y } = this, b = this.is0();
- g == null && (g = b ? t.ONE : t.inv(y));
- const _ = t.mul(A, g), M = t.mul(p, g), w = t.mul(y, g);
- if (b)
+ 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);
+ if (x)
return { x: t.ZERO, y: t.ZERO };
if (!t.eql(w, t.ONE))
throw new Error("invZ was invalid");
- return { x: _, y: M };
+ return { x: E, y: I };
}
isTorsionFree() {
- const { h: g, isTorsionFree: A } = e;
- if (g === $n)
+ const { h: m, isTorsionFree: g } = e;
+ if (m === ai)
return !0;
- if (A)
- return A(u, this);
+ if (g)
+ return g(u, this);
throw new Error("isTorsionFree() has not been declared for the elliptic curve");
}
clearCofactor() {
- const { h: g, clearCofactor: A } = e;
- return g === $n ? this : A ? A(u, this) : this.multiplyUnsafe(e.h);
+ const { h: m, clearCofactor: g } = e;
+ return m === ai ? this : g ? g(u, this) : this.multiplyUnsafe(e.h);
}
- toRawBytes(g = !0) {
- return this.assertValidity(), n(u, this, g);
+ toRawBytes(m = !0) {
+ return this.assertValidity(), n(u, this, m);
}
- toHex(g = !0) {
- return Ta(this.toRawBytes(g));
+ 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 = gN(u, e.endo ? Math.ceil(d / 2) : d);
+ const d = e.nBitLength, f = kD(u, e.endo ? Math.ceil(d / 2) : d);
return {
CURVE: e,
ProjectivePoint: u,
@@ -37326,9 +39715,9 @@ function EN(i) {
isWithinCurveOrder: a
};
}
-function _N(i) {
- const e = ex(i);
- return tc(e, {
+function HD(i) {
+ const e = Ub(i);
+ return Ac(e, {
hash: "hash",
hmac: "function",
randomBytes: "function"
@@ -37338,32 +39727,32 @@ function _N(i) {
lowS: "boolean"
}), Object.freeze({ lowS: !0, ...e });
}
-function yN(i) {
- const e = _N(i), { Fp: t, n } = e, s = t.BYTES + 1, r = 2 * t.BYTES + 1;
- function a(D) {
- return $i < D && D < t.ORDER;
+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 o(D) {
- return On(D, n);
+ function o(N) {
+ return Kn(N, n);
}
- function c(D) {
- return Ud(D, n);
+ function c(N) {
+ return df(N, n);
}
- const { ProjectivePoint: l, normPrivateKeyToScalar: h, weierstrassEquation: u, isWithinCurveOrder: d } = EN({
+ const { ProjectivePoint: l, normPrivateKeyToScalar: h, weierstrassEquation: u, isWithinCurveOrder: d } = GD({
...e,
- toBytes(D, O, Y) {
- const Q = O.toAffine(), J = t.toBytes(Q.x), ee = Qo;
+ toBytes(N, O, Y) {
+ const Q = O.toAffine(), J = t.toBytes(Q.x), ee = tc;
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);
+ fromBytes(N) {
+ const O = N.length, Y = N[0], Q = N.subarray(1);
if (O === s && (Y === 2 || Y === 3)) {
- const J = gr(Q);
+ const J = vr(Q);
if (!a(J))
throw new Error("Point is not on curve");
const ee = u(J);
let ae = t.sqrt(ee);
- const ye = (ae & $n) === $n;
+ const ye = (ae & ai) === ai;
return (Y & 1) === 1 !== ye && (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));
@@ -37371,29 +39760,29 @@ function yN(i) {
} else
throw new Error(`Point of length ${O} was invalid. Expected ${s} compressed bytes or ${r} uncompressed bytes`);
}
- }), f = (D) => Ta(Ra(D, e.nByteLength));
- function m(D) {
- const O = n >> $n;
- return D > O;
+ }), f = (N) => Ua(Oa(N, e.nByteLength));
+ function p(N) {
+ const O = n >> ai;
+ return N > O;
}
- function g(D) {
- return m(D) ? o(-D) : D;
+ function m(N) {
+ return p(N) ? o(-N) : N;
}
- const A = (D, O, Y) => gr(D.slice(O, Y));
- class p {
+ const g = (N, O, Y) => vr(N.slice(O, Y));
+ class A {
constructor(O, Y, Q) {
this.r = O, this.s = Y, this.recovery = Q, this.assertValidity();
}
// pair (bytes of r, bytes of s)
static fromCompact(O) {
const Y = e.nByteLength;
- return O = di("compactSignature", O, Y * 2), new p(A(O, 0, Y), A(O, Y, 2 * Y));
+ return O = _i("compactSignature", O, Y * 2), new A(g(O, 0, Y), g(O, Y, 2 * Y));
}
// DER encoded ECDSA signature
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
static fromDER(O) {
- const { r: Y, s: Q } = fr.toSig(di("DER", O));
- return new p(Y, Q);
+ const { r: Y, s: Q } = Er.toSig(_i("DER", O));
+ return new A(Y, Q);
}
assertValidity() {
if (!d(this.r))
@@ -37402,46 +39791,46 @@ function yN(i) {
throw new Error("s must be 0 < s < CURVE.n");
}
addRecoveryBit(O) {
- return new p(this.r, this.s, O);
+ return new A(this.r, this.s, O);
}
recoverPublicKey(O) {
- const { r: Y, s: Q, recovery: J } = this, ee = S(di("msgHash", O));
+ const { r: Y, s: Q, recovery: J } = this, ee = S(_i("msgHash", O));
if (J == null || ![0, 1, 2, 3].includes(J))
throw new Error("recovery id invalid");
const ae = J === 2 || J === 3 ? Y + e.n : Y;
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), be = o(Q * se), xe = l.BASE.multiplyAndAddUnsafe(Me, me, be);
- if (!xe)
+ 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);
+ if (!be)
throw new Error("point at infinify");
- return xe.assertValidity(), xe;
+ return be.assertValidity(), be;
}
// Signatures should be low-s, to prevent malleability.
hasHighS() {
- return m(this.s);
+ return p(this.s);
}
normalizeS() {
- return this.hasHighS() ? new p(this.r, o(-this.s), this.recovery) : this;
+ return this.hasHighS() ? new A(this.r, o(-this.s), this.recovery) : this;
}
// DER-encoded
toDERRawBytes() {
- return Oo(this.toDERHex());
+ return ec(this.toDERHex());
}
toDERHex() {
- return fr.hexFromSig({ r: this.r, s: this.s });
+ return Er.hexFromSig({ r: this.r, s: this.s });
}
// padded bytes of r, then padded bytes of s
toCompactRawBytes() {
- return Oo(this.toCompactHex());
+ return ec(this.toCompactHex());
}
toCompactHex() {
return f(this.r) + f(this.s);
}
}
const y = {
- isValidPrivateKey(D) {
+ isValidPrivateKey(N) {
try {
- return h(D), !0;
+ return h(N), !0;
} catch {
return !1;
}
@@ -37452,8 +39841,8 @@ function yN(i) {
* (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
*/
randomPrivateKey: () => {
- const D = $b(e.n);
- return pN(e.randomBytes(D), e.n);
+ const N = kb(e.n);
+ return LD(e.randomBytes(N), e.n);
},
/**
* Creates precompute table for an arbitrary EC point. Makes point "cached".
@@ -37463,136 +39852,136 @@ function yN(i) {
* const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
* fast.multiply(privKey); // much faster ECDH now
*/
- precompute(D = 8, O = l.BASE) {
- return O._setWindowSize(D), O.multiply(BigInt(3)), O;
+ precompute(N = 8, O = l.BASE) {
+ return O._setWindowSize(N), O.multiply(BigInt(3)), O;
}
};
- function b(D, O = !0) {
- return l.fromPrivateKey(D).toRawBytes(O);
+ function x(N, O = !0) {
+ return l.fromPrivateKey(N).toRawBytes(O);
}
- function _(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 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 M(D, O, Y = !0) {
- if (_(D))
+ function I(N, O, Y = !0) {
+ if (E(N))
throw new Error("first arg must be private key");
- if (!_(O))
+ if (!E(O))
throw new Error("second arg must be public key");
- return l.fromHex(O).multiply(h(D)).toRawBytes(Y);
+ return l.fromHex(O).multiply(h(N)).toRawBytes(Y);
}
- const w = e.bits2int || function(D) {
- const O = gr(D), Y = D.length * 8 - e.nBitLength;
+ const w = e.bits2int || function(N) {
+ const O = vr(N), Y = N.length * 8 - e.nBitLength;
return Y > 0 ? O >> BigInt(Y) : O;
- }, S = e.bits2int_modN || function(D) {
- return o(w(D));
- }, T = jf(e.nBitLength);
- function C(D) {
- if (typeof D != "bigint")
+ }, S = e.bits2int_modN || function(N) {
+ return o(w(N));
+ }, T = yp(e.nBitLength);
+ function C(N) {
+ if (typeof N != "bigint")
throw new Error("bigint expected");
- if (!($i <= D && D < T))
+ if (!(rs <= N && N < T))
throw new Error(`bigint expected < 2^${e.nBitLength}`);
- return Ra(D, e.nByteLength);
+ return Oa(N, e.nByteLength);
}
- function v(D, O, Y = F) {
- if (["recovered", "canonical"].some(($e) => $e in Y))
+ 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: ye } = Y;
- ee == null && (ee = !0), D = di("msgHash", D), ae && (D = di("prehashed msgHash", Q(D)));
- const Me = S(D), se = h(O), me = [C(se), C(Me)];
+ 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 $e = ye === !0 ? J(t.BYTES) : ye;
- me.push(di("extraEntropy", $e));
+ const et = ye === !0 ? J(t.BYTES) : ye;
+ me.push(_i("extraEntropy", et));
}
- const be = Qo(...me), xe = Me;
- function Pe($e) {
- const Qe = w($e);
- if (!d(Qe))
+ const xe = tc(...me), be = Me;
+ function Ue(et) {
+ const He = w(et);
+ if (!d(He))
return;
- const vt = c(Qe), lt = l.BASE.multiply(Qe).toAffine(), Je = o(lt.x);
- if (Je === $i)
+ const It = c(He), ht = l.BASE.multiply(He).toAffine(), $e = o(ht.x);
+ if ($e === rs)
return;
- const G = o(vt * o(xe + Je * se));
- if (G === $i)
+ const H = o(It * o(be + $e * se));
+ if (H === rs)
return;
- let dn = (lt.x === Je ? 0 : 2) | Number(lt.y & $n), dt = G;
- return ee && m(G) && (dt = g(G), dn ^= 1), new p(Je, dt, dn);
+ let xn = (ht.x === $e ? 0 : 2) | Number(ht.y & ai), pt = H;
+ return ee && p(H) && (pt = m(H), xn ^= 1), new A($e, pt, xn);
}
- return { seed: be, k2sig: Pe };
+ 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 Yb(ee.hash.outputLen, ee.nByteLength, ee.hmac)(Q, J);
+ 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);
}
l.BASE._setWindowSize(8);
- function $(D, O, Y, Q = K) {
- const J = D;
- if (O = di("msgHash", O), Y = di("publicKey", Y), "strict" in Q)
+ function $(N, O, Y, Q = K) {
+ const J = N;
+ if (O = _i("msgHash", O), Y = _i("publicKey", Y), "strict" in Q)
throw new Error("options.strict was renamed to lowS");
const { lowS: ee, prehash: ae } = Q;
let ye, Me;
try {
if (typeof J == "string" || J instanceof Uint8Array)
try {
- ye = p.fromDER(J);
- } catch (lt) {
- if (!(lt instanceof fr.Err))
- throw lt;
- ye = p.fromCompact(J);
+ ye = A.fromDER(J);
+ } catch (ht) {
+ if (!(ht instanceof Er.Err))
+ throw ht;
+ ye = A.fromCompact(J);
}
else if (typeof J == "object" && typeof J.r == "bigint" && typeof J.s == "bigint") {
- const { r: lt, s: Je } = J;
- ye = new p(lt, Je);
+ const { r: ht, s: $e } = J;
+ ye = new A(ht, $e);
} else
throw new Error("PARSE");
Me = l.fromHex(Y);
- } catch (lt) {
- if (lt.message === "PARSE")
+ } catch (ht) {
+ if (ht.message === "PARSE")
throw new Error("signature must be Signature instance, Uint8Array or hex string");
return !1;
}
if (ee && ye.hasHighS())
return !1;
ae && (O = e.hash(O));
- const { r: se, s: me } = ye, be = S(O), xe = c(me), Pe = o(be * xe), $e = o(se * xe), Qe = l.BASE.multiplyAndAddUnsafe(Me, Pe, $e)?.toAffine();
- return Qe ? o(Qe.x) === se : !1;
+ 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();
+ return He ? o(He.x) === se : !1;
}
return {
CURVE: e,
- getPublicKey: b,
- getSharedSecret: M,
+ getPublicKey: x,
+ getSharedSecret: I,
sign: q,
verify: $,
ProjectivePoint: l,
- Signature: p,
+ Signature: A,
utils: y
};
}
-function wN(i) {
+function VD(i) {
return {
hash: i,
- hmac: (e, ...t) => Nb(i, e, AR(...t)),
- randomBytes: gR
+ hmac: (e, ...t) => gb(i, e, PF(...t)),
+ randomBytes: kF
};
}
-function vN(i, e) {
- const t = (n) => yN({ ...i, ...wN(n) });
+function WD(i, e) {
+ const t = (n) => zD({ ...i, ...VD(n) });
return Object.freeze({ ...t(e), create: t });
}
-const tx = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), Lg = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), CN = BigInt(1), Od = BigInt(2), Pg = (i, e) => (i + e / Od) / e;
-function SN(i) {
- const e = tx, 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 = Jn(h, t, e) * h % e, d = Jn(u, t, e) * h % e, f = Jn(d, Od, e) * l % e, m = Jn(f, s, e) * f % e, g = Jn(m, r, e) * m % e, A = Jn(g, o, e) * g % e, p = Jn(A, c, e) * A % e, y = Jn(p, o, e) * g % e, b = Jn(y, t, e) * h % e, _ = Jn(b, a, e) * m % e, M = Jn(_, n, e) * l % e, w = Jn(M, Od, e);
- if (!Qd.eql(Qd.sqr(w), i))
+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))
throw new Error("Cannot find square root");
return w;
}
-const Qd = fN(tx, void 0, void 0, { sqrt: SN }), Ts = vN({
+const pf = ND(Ob, void 0, void 0, { sqrt: KD }), ks = WD({
a: BigInt(0),
b: BigInt(7),
- Fp: Qd,
- n: Lg,
+ Fp: pf,
+ n: pm,
// Base point (x, y) aka generator point
Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
@@ -37607,22 +39996,22 @@ const Qd = fN(tx, void 0, void 0, { sqrt: SN }), Ts = vN({
endo: {
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
splitScalar: (i) => {
- const e = Lg, t = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), n = -CN * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), s = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), r = t, a = BigInt("0x100000000000000000000000000000000"), o = Pg(r * i, e), c = Pg(-n * i, e);
- let l = On(i - o * t - c * s, e), h = On(-o * n - c * r, e);
+ 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);
+ 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)
throw new Error("splitScalar: Endomorphism failed, k=" + i);
return { k1neg: u, k1: l, k2neg: d, k2: h };
}
}
-}, Db);
+}, xb);
BigInt(0);
-Ts.ProjectivePoint;
-const Go = "0x0000000000000000000000000000000000000000", kg = "0x0000000000000000000000000000000000000000000000000000000000000000", Ug = BigInt(0), Og = BigInt(1), Gd = BigInt(2), Qg = BigInt(27), Gg = BigInt(28), el = BigInt(35), nx = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), IN = nx / Gd, MN = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), er = {};
-function Eu(i) {
- return ds($t(i), 32);
+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) {
+ return Es(rn(i), 32);
}
-class Gt {
+class zt {
#e;
#t;
#n;
@@ -37637,7 +40026,7 @@ class Gt {
return this.#e;
}
set r(e) {
- V(ga(e) === 32, "invalid r", "value", e), this.#e = Se(e);
+ V(Ia(e) === 32, "invalid r", "value", e), this.#e = Se(e);
}
/**
* The ``s`` value for a signature.
@@ -37646,7 +40035,7 @@ class Gt {
return V(parseInt(this.#t.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#t), this.#t;
}
set s(e) {
- V(ga(e) === 32, "invalid s", "value", e), this.#t = Se(e);
+ V(Ia(e) === 32, "invalid s", "value", e), this.#t = Se(e);
}
/**
* Return the s value, unchecked for EIP-2 compliance.
@@ -37663,7 +40052,7 @@ class Gt {
* Returns true if the Signature is valid for [[link-eip-2]] signatures.
*/
isValid() {
- return BigInt(this.#t) <= IN;
+ return BigInt(this.#t) <= jD;
}
/**
* The ``v`` value for a signature.
@@ -37679,7 +40068,7 @@ class Gt {
return this.#n;
}
set v(e) {
- const t = ut(e, "value");
+ const t = ft(e, "value");
V(t === 27 || t === 28, "invalid v", "v", e), this.#n = t;
}
/**
@@ -37695,7 +40084,7 @@ class Gt {
*/
get legacyChainId() {
const e = this.networkV;
- return e == null ? null : Gt.getChainId(e);
+ return e == null ? null : zt.getChainId(e);
}
/**
* The ``yParity`` for the signature.
@@ -37710,26 +40099,26 @@ class Gt {
* and ``s`` compacted into a single ``bytes32``.
*/
get yParityAndS() {
- const e = ht(this.s);
+ const e = dt(this.s);
return this.yParity && (e[0] |= 128), Se(e);
}
/**
* The [[link-eip-2098]] compact representation.
*/
get compactSerialized() {
- return Ot([this.r, this.yParityAndS]);
+ return Gt([this.r, this.yParityAndS]);
}
/**
* The serialized representation.
*/
get serialized() {
- return Ot([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]);
+ return Gt([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]);
}
/**
* @private
*/
constructor(e, t, n, s) {
- Jl(e, er, "Signature"), this.#e = t, this.#t = n, this.#n = s, this.#i = null;
+ yh(e, cr, "Signature"), this.#e = t, this.#t = n, this.#n = s, this.#i = null;
}
/**
* Returns the canonical signature.
@@ -37741,14 +40130,14 @@ class Gt {
getCanonical() {
if (this.isValid())
return this;
- const e = nx - BigInt(this._s), t = 55 - this.v, n = new Gt(er, this.r, Eu(e), t);
+ const e = Qb - BigInt(this._s), t = 55 - this.v, n = new zt(cr, this.r, Ku(e), t);
return this.networkV && (n.#i = this.networkV), n;
}
/**
* Returns a new identical [[Signature]].
*/
clone() {
- const e = new Gt(er, this.r, this._s, this.v);
+ const e = new zt(cr, this.r, this._s, this.v);
return this.networkV && (e.#i = this.networkV), e;
}
/**
@@ -37764,7 +40153,7 @@ class Gt {
v: this.v
};
}
- [MN]() {
+ [XD]() {
return this.toString();
}
toString() {
@@ -37781,8 +40170,8 @@ class Gt {
* //_result:
*/
static getChainId(e) {
- const t = Fe(e, "v");
- return t == Qg || t == Gg ? Ug : (V(t >= el, "invalid EIP-155 v", "v", e), (t - el) / Gd);
+ const t = Ne(e, "v");
+ return t == bm || t == Em ? mm : (V(t >= ml, "invalid EIP-155 v", "v", e), (t - ml) / Af);
}
/**
* Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
@@ -37799,7 +40188,7 @@ class Gt {
*
*/
static getChainIdV(e, t) {
- return Fe(e) * Gd + BigInt(35 + t - 27);
+ return Ne(e) * Af + BigInt(35 + t - 27);
}
/**
* Compute the normalized legacy transaction ``v`` from a ``yParirty``,
@@ -37823,8 +40212,8 @@ class Gt {
* //_error:
*/
static getNormalizedV(e) {
- const t = Fe(e);
- return t === Ug || t === Qg ? 27 : t === Og || t === Gg ? 28 : (V(t >= el, "invalid v", "v", e), t & Og ? 27 : 28);
+ 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);
}
/**
* Creates a new [[Signature]].
@@ -37839,44 +40228,44 @@ class Gt {
V(l, h, "signature", e);
}
if (e == null)
- return new Gt(er, kg, kg, 27);
+ return new zt(cr, gm, gm, 27);
if (typeof e == "string") {
- const l = ht(e, "signature");
+ 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 Gt(er, h, Se(u), d);
+ return u[0] &= 127, new zt(cr, h, Se(u), d);
}
if (l.length === 65) {
- const h = Se(l.slice(0, 32)), u = Se(l.slice(32, 64)), d = Gt.getNormalizedV(l[64]);
- return new Gt(er, h, u, d);
+ 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);
}
t(!1, "invalid raw signature length");
}
- if (e instanceof Gt)
+ if (e instanceof zt)
return e.clone();
const n = e.r;
t(n != null, "missing r");
- const s = Eu(n), r = (function(l, h) {
+ const s = Ku(n), r = (function(l, h) {
if (l != null)
- return Eu(l);
+ return Ku(l);
if (h != null) {
- t(Lt(h, 32), "invalid yParityAndS");
- const u = ht(h);
+ t(Ut(h, 32), "invalid yParityAndS");
+ const u = dt(h);
return u[0] &= 127, Se(u);
}
t(!1, "missing s");
})(e.s, e.yParityAndS), { networkV: a, v: o } = (function(l, h, u) {
if (l != null) {
- const d = Fe(l);
+ const d = Ne(l);
return {
- networkV: d >= el ? d : void 0,
- v: Gt.getNormalizedV(d)
+ networkV: d >= ml ? d : void 0,
+ v: zt.getNormalizedV(d)
};
}
if (h != null)
- return t(Lt(h, 32), "invalid yParityAndS"), { v: ht(h)[0] & 128 ? 28 : 27 };
+ return t(Ut(h, 32), "invalid yParityAndS"), { v: dt(h)[0] & 128 ? 28 : 27 };
if (u != null) {
- switch (ut(u, "sig.yParity")) {
+ switch (ft(u, "sig.yParity")) {
case 0:
return { v: 27 };
case 1:
@@ -37885,17 +40274,17 @@ class Gt {
t(!1, "invalid yParity");
}
t(!1, "missing v");
- })(e.v, e.yParityAndS, e.yParity), c = new Gt(er, s, r, o);
- return a && (c.#i = a), t(e.yParity == null || ut(e.yParity, "sig.yParity") === c.yParity, "yParity mismatch"), t(e.yParityAndS == null || e.yParityAndS === c.yParityAndS, "yParityAndS mismatch"), c;
+ })(e.v, e.yParityAndS, e.yParity), c = new zt(cr, 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;
}
}
-class es {
+class as {
#e;
/**
* Creates a new **SigningKey** for %%privateKey%%.
*/
constructor(e) {
- V(ga(e) === 32, "invalid private key", "privateKey", "[REDACTED]"), this.#e = Se(e);
+ V(Ia(e) === 32, "invalid private key", "privateKey", "[REDACTED]"), this.#e = Se(e);
}
/**
* The private key.
@@ -37910,7 +40299,7 @@ class es {
* characters long (the ``0x`` prefix and 130 hexadecimal nibbles).
*/
get publicKey() {
- return es.computePublicKey(this.#e);
+ return as.computePublicKey(this.#e);
}
/**
* The compressed public key.
@@ -37920,19 +40309,19 @@ class es {
* nibbles)
*/
get compressedPublicKey() {
- return es.computePublicKey(this.#e, !0);
+ return as.computePublicKey(this.#e, !0);
}
/**
* Return the signature of the signed %%digest%%.
*/
sign(e) {
- V(ga(e) === 32, "invalid digest length", "digest", e);
- const t = Ts.sign(Tn(e), Tn(this.#e), {
+ V(Ia(e) === 32, "invalid digest length", "digest", e);
+ const t = ks.sign(On(e), On(this.#e), {
lowS: !0
});
- return Gt.from({
- r: Gs(t.r, 32),
- s: Gs(t.s, 32),
+ return zt.from({
+ r: Xs(t.r, 32),
+ s: Xs(t.s, 32),
v: t.recovery ? 28 : 27
});
}
@@ -37959,8 +40348,8 @@ class es {
* //_result:
*/
computeSharedSecret(e) {
- const t = es.computePublicKey(e);
- return Se(Ts.getSharedSecret(Tn(this.#e), ht(t), !1));
+ const t = as.computePublicKey(e);
+ return Se(ks.getSharedSecret(On(this.#e), dt(t), !1));
}
/**
* Compute the public key for %%key%%, optionally %%compressed%%.
@@ -37988,16 +40377,16 @@ class es {
* //_result:
*/
static computePublicKey(e, t) {
- let n = ht(e, "key");
+ let n = dt(e, "key");
if (n.length === 32) {
- const r = Ts.getPublicKey(n, !!t);
+ const r = ks.getPublicKey(n, !!t);
return Se(r);
}
if (n.length === 64) {
const r = new Uint8Array(65);
r[0] = 4, r.set(n, 1), n = r;
}
- const s = Ts.ProjectivePoint.fromHex(n);
+ const s = ks.ProjectivePoint.fromHex(n);
return Se(s.toRawBytes(t));
}
/**
@@ -38019,11 +40408,11 @@ class es {
*
*/
static recoverPublicKey(e, t) {
- V(ga(e) === 32, "invalid digest length", "digest", e);
- const n = Gt.from(t);
- let s = Ts.Signature.fromCompact(Tn(Ot([n.r, n.s])));
+ V(Ia(e) === 32, "invalid digest length", "digest", e);
+ const n = zt.from(t);
+ let s = ks.Signature.fromCompact(On(Gt([n.r, n.s])));
s = s.addRecoveryBit(n.yParity);
- const r = s.recoverPublicKey(Tn(e));
+ const r = s.recoverPublicKey(On(e));
return V(r != null, "invalid signature for digest", "signature", t), "0x" + r.toHex(!1);
}
/**
@@ -38037,32 +40426,32 @@ class es {
* addresses from parent public keys and chain codes.
*/
static addPoints(e, t, n) {
- const s = Ts.ProjectivePoint.fromHex(es.computePublicKey(e).substring(2)), r = Ts.ProjectivePoint.fromHex(es.computePublicKey(t).substring(2));
+ const s = ks.ProjectivePoint.fromHex(as.computePublicKey(e).substring(2)), r = ks.ProjectivePoint.fromHex(as.computePublicKey(t).substring(2));
return "0x" + s.add(r).toHex(!!n);
}
}
-const BN = BigInt(0), TN = BigInt(36);
-function Hg(i) {
+const YD = BigInt(0), JD = BigInt(36);
+function _m(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 = ht(Zt(t));
+ const n = dt(sn(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 Xf = {};
+const wp = {};
for (let i = 0; i < 10; i++)
- Xf[String(i)] = String(i);
+ wp[String(i)] = String(i);
for (let i = 0; i < 26; i++)
- Xf[String.fromCharCode(65 + i)] = String(10 + i);
-const zg = 15;
-function RN(i) {
+ wp[String.fromCharCode(65 + i)] = String(10 + i);
+const ym = 15;
+function ZD(i) {
i = i.toUpperCase(), i = i.substring(4) + i.substring(0, 2) + "00";
- let e = i.split("").map((n) => Xf[n]).join("");
- for (; e.length >= zg; ) {
- let n = e.substring(0, zg);
+ let e = i.split("").map((n) => wp[n]).join("");
+ for (; e.length >= ym; ) {
+ let n = e.substring(0, ym);
e = parseInt(n, 10) % 97 + e.substring(n.length);
}
let t = String(98 - parseInt(e, 10) % 97);
@@ -38070,7 +40459,7 @@ function RN(i) {
t = "0" + t;
return t;
}
-const NN = (function() {
+const $D = (function() {
const i = {};
for (let e = 0; e < 36; e++) {
const t = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
@@ -38078,59 +40467,59 @@ const NN = (function() {
}
return i;
})();
-function FN(i) {
+function eN(i) {
i = i.toLowerCase();
- let e = BN;
+ let e = YD;
for (let t = 0; t < i.length; t++)
- e = e * TN + NN[i[t]];
+ e = e * JD + $D[i[t]];
return e;
}
-function St(i) {
+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 = Hg(i);
+ const e = _m(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) === RN(i), "bad icap checksum", "address", i);
- let e = FN(i.substring(4)).toString(16);
+ V(i.substring(2, 4) === ZD(i), "bad icap checksum", "address", i);
+ let e = eN(i.substring(4)).toString(16);
for (; e.length < 40; )
e = "0" + e;
- return Hg("0x" + e);
+ return _m("0x" + e);
}
V(!1, "invalid address", "address", i);
}
-function DN(i) {
- const e = St(i.from);
- let n = Fe(i.nonce, "tx.nonce").toString(16);
- return n === "0" ? n = "0x" : n.length % 2 ? n = "0x0" + n : n = "0x" + n, St(Vt(Zt(ls([e, n])), 12));
+function tN(i) {
+ const e = Mt(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, Mt(Kt(sn(ms([e, n])), 12));
}
-function ix(i) {
+function Gb(i) {
return i && typeof i.getAddress == "function";
}
-async function _u(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)), St(t);
+ 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 Fn(i, e) {
+function Hn(i, e) {
if (typeof i == "string")
- return i.match(/^0x[0-9a-f]{40}$/i) ? St(i) : (ge(e != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }), _u(i, e.resolveName(i)));
- if (ix(i))
- return _u(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 (Gb(i))
+ return ju(i, i.getAddress());
if (i && typeof i.then == "function")
- return _u(i, i);
+ return ju(i, i);
V(!1, "unsupported addressable value", "target", i);
}
-const Yi = {};
+const ns = {};
function Te(i, e) {
let t = !1;
- return e < 0 && (t = !0, e *= -1), new Wt(Yi, `${t ? "" : "u"}int${e}`, i, { signed: t, width: e });
+ return e < 0 && (t = !0, e *= -1), new jt(ns, `${t ? "" : "u"}int${e}`, i, { signed: t, width: e });
}
-function Et(i, e) {
- return new Wt(Yi, `bytes${e || ""}`, i, { size: e });
+function vt(i, e) {
+ return new jt(ns, `bytes${e || ""}`, i, { size: e });
}
-const Vg = /* @__PURE__ */ Symbol.for("_ethers_typed");
-class Wt {
+const wm = /* @__PURE__ */ Symbol.for("_ethers_typed");
+class jt {
/**
* The type, as a Solidity-compatible type.
*/
@@ -38148,7 +40537,7 @@ class Wt {
* @_ignore:
*/
constructor(e, t, n, s) {
- s == null && (s = null), Jl(Yi, e, "Typed"), Xe(this, { _typedSymbol: Vg, type: t, value: n }), this.#e = s, this.format();
+ s == null && (s = null), yh(ns, e, "Typed"), Ye(this, { _typedSymbol: wm, type: t, value: n }), this.#e = s, this.format();
}
/**
* Format the type as a Human-Readable type.
@@ -38222,7 +40611,7 @@ class Wt {
* Returns a new **Typed** of %%type%% with the %%value%%.
*/
static from(e, t) {
- return new Wt(Yi, e, t);
+ return new jt(ns, e, t);
}
/**
* Return a new ``uint8`` type for %%v%%.
@@ -38624,217 +41013,217 @@ class Wt {
* Return a new ``bytes1`` type for %%v%%.
*/
static bytes1(e) {
- return Et(e, 1);
+ return vt(e, 1);
}
/**
* Return a new ``bytes2`` type for %%v%%.
*/
static bytes2(e) {
- return Et(e, 2);
+ return vt(e, 2);
}
/**
* Return a new ``bytes3`` type for %%v%%.
*/
static bytes3(e) {
- return Et(e, 3);
+ return vt(e, 3);
}
/**
* Return a new ``bytes4`` type for %%v%%.
*/
static bytes4(e) {
- return Et(e, 4);
+ return vt(e, 4);
}
/**
* Return a new ``bytes5`` type for %%v%%.
*/
static bytes5(e) {
- return Et(e, 5);
+ return vt(e, 5);
}
/**
* Return a new ``bytes6`` type for %%v%%.
*/
static bytes6(e) {
- return Et(e, 6);
+ return vt(e, 6);
}
/**
* Return a new ``bytes7`` type for %%v%%.
*/
static bytes7(e) {
- return Et(e, 7);
+ return vt(e, 7);
}
/**
* Return a new ``bytes8`` type for %%v%%.
*/
static bytes8(e) {
- return Et(e, 8);
+ return vt(e, 8);
}
/**
* Return a new ``bytes9`` type for %%v%%.
*/
static bytes9(e) {
- return Et(e, 9);
+ return vt(e, 9);
}
/**
* Return a new ``bytes10`` type for %%v%%.
*/
static bytes10(e) {
- return Et(e, 10);
+ return vt(e, 10);
}
/**
* Return a new ``bytes11`` type for %%v%%.
*/
static bytes11(e) {
- return Et(e, 11);
+ return vt(e, 11);
}
/**
* Return a new ``bytes12`` type for %%v%%.
*/
static bytes12(e) {
- return Et(e, 12);
+ return vt(e, 12);
}
/**
* Return a new ``bytes13`` type for %%v%%.
*/
static bytes13(e) {
- return Et(e, 13);
+ return vt(e, 13);
}
/**
* Return a new ``bytes14`` type for %%v%%.
*/
static bytes14(e) {
- return Et(e, 14);
+ return vt(e, 14);
}
/**
* Return a new ``bytes15`` type for %%v%%.
*/
static bytes15(e) {
- return Et(e, 15);
+ return vt(e, 15);
}
/**
* Return a new ``bytes16`` type for %%v%%.
*/
static bytes16(e) {
- return Et(e, 16);
+ return vt(e, 16);
}
/**
* Return a new ``bytes17`` type for %%v%%.
*/
static bytes17(e) {
- return Et(e, 17);
+ return vt(e, 17);
}
/**
* Return a new ``bytes18`` type for %%v%%.
*/
static bytes18(e) {
- return Et(e, 18);
+ return vt(e, 18);
}
/**
* Return a new ``bytes19`` type for %%v%%.
*/
static bytes19(e) {
- return Et(e, 19);
+ return vt(e, 19);
}
/**
* Return a new ``bytes20`` type for %%v%%.
*/
static bytes20(e) {
- return Et(e, 20);
+ return vt(e, 20);
}
/**
* Return a new ``bytes21`` type for %%v%%.
*/
static bytes21(e) {
- return Et(e, 21);
+ return vt(e, 21);
}
/**
* Return a new ``bytes22`` type for %%v%%.
*/
static bytes22(e) {
- return Et(e, 22);
+ return vt(e, 22);
}
/**
* Return a new ``bytes23`` type for %%v%%.
*/
static bytes23(e) {
- return Et(e, 23);
+ return vt(e, 23);
}
/**
* Return a new ``bytes24`` type for %%v%%.
*/
static bytes24(e) {
- return Et(e, 24);
+ return vt(e, 24);
}
/**
* Return a new ``bytes25`` type for %%v%%.
*/
static bytes25(e) {
- return Et(e, 25);
+ return vt(e, 25);
}
/**
* Return a new ``bytes26`` type for %%v%%.
*/
static bytes26(e) {
- return Et(e, 26);
+ return vt(e, 26);
}
/**
* Return a new ``bytes27`` type for %%v%%.
*/
static bytes27(e) {
- return Et(e, 27);
+ return vt(e, 27);
}
/**
* Return a new ``bytes28`` type for %%v%%.
*/
static bytes28(e) {
- return Et(e, 28);
+ return vt(e, 28);
}
/**
* Return a new ``bytes29`` type for %%v%%.
*/
static bytes29(e) {
- return Et(e, 29);
+ return vt(e, 29);
}
/**
* Return a new ``bytes30`` type for %%v%%.
*/
static bytes30(e) {
- return Et(e, 30);
+ return vt(e, 30);
}
/**
* Return a new ``bytes31`` type for %%v%%.
*/
static bytes31(e) {
- return Et(e, 31);
+ return vt(e, 31);
}
/**
* Return a new ``bytes32`` type for %%v%%.
*/
static bytes32(e) {
- return Et(e, 32);
+ return vt(e, 32);
}
/**
* Return a new ``address`` type for %%v%%.
*/
static address(e) {
- return new Wt(Yi, "address", e);
+ return new jt(ns, "address", e);
}
/**
* Return a new ``bool`` type for %%v%%.
*/
static bool(e) {
- return new Wt(Yi, "bool", !!e);
+ return new jt(ns, "bool", !!e);
}
/**
* Return a new ``bytes`` type for %%v%%.
*/
static bytes(e) {
- return new Wt(Yi, "bytes", e);
+ return new jt(ns, "bytes", e);
}
/**
* Return a new ``string`` type for %%v%%.
*/
static string(e) {
- return new Wt(Yi, "string", e);
+ return new jt(ns, "string", e);
}
/**
* Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.
@@ -38852,13 +41241,13 @@ class Wt {
* Return a new ``uint8`` type for %%v%%.
*/
static overrides(e) {
- return new Wt(Yi, "overrides", Object.assign({}, e));
+ return new jt(ns, "overrides", Object.assign({}, e));
}
/**
* Returns true only if %%value%% is a [[Typed]] instance.
*/
static isTyped(e) {
- return e && typeof e == "object" && "_typedSymbol" in e && e._typedSymbol === Vg;
+ return e && typeof e == "object" && "_typedSymbol" in e && e._typedSymbol === wm;
}
/**
* If the value is a [[Typed]] instance, validates the underlying value
@@ -38868,7 +41257,7 @@ class Wt {
* object or values.
*/
static dereference(e, t) {
- if (Wt.isTyped(e)) {
+ if (jt.isTyped(e)) {
if (e.type !== t)
throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);
return e.value;
@@ -38876,7 +41265,7 @@ class Wt {
return e;
}
}
-class LN extends As {
+class nN extends ys {
constructor(e) {
super("address", "address", e, !1);
}
@@ -38884,19 +41273,19 @@ class LN extends As {
return "0x0000000000000000000000000000000000000000";
}
encode(e, t) {
- let n = Wt.dereference(t, "string");
+ let n = jt.dereference(t, "string");
try {
- n = St(n);
+ n = Mt(n);
} catch (s) {
return this._throwError(s.message, t);
}
return e.writeValue(n);
}
decode(e) {
- return St(Gs(e.readValue(), 20));
+ return Mt(Xs(e.readValue(), 20));
}
}
-class PN extends As {
+class iN extends ys {
coder;
constructor(e) {
super(e.name, e.type, "_", e.dynamic), this.coder = e;
@@ -38911,7 +41300,7 @@ class PN extends As {
return this.coder.decode(e);
}
}
-function sx(i, e, t) {
+function Hb(i, e, t) {
let n = [];
if (Array.isArray(t))
n = t;
@@ -38924,7 +41313,7 @@ function sx(i, e, t) {
} else
V(!1, "invalid tuple value", "tuple", t);
V(e.length === n.length, "types/value length mismatch", "tuple", t);
- let s = new Ld(), r = new Ld(), a = [];
+ let s = new lf(), r = new lf(), a = [];
e.forEach((c, l) => {
let h = n[l];
if (c.dynamic) {
@@ -38942,7 +41331,7 @@ function sx(i, e, t) {
let o = i.appendWriter(s);
return o += i.appendWriter(r), o;
}
-function rx(i, e) {
+function zb(i, e) {
let t = [], n = [], s = i.subReader(0);
return e.forEach((r) => {
let a = null;
@@ -38951,7 +41340,7 @@ function rx(i, e) {
try {
a = r.decode(c);
} catch (l) {
- if (En(l, "BUFFER_OVERRUN"))
+ if (Mn(l, "BUFFER_OVERRUN"))
throw l;
a = l, a.baseType = r.name, a.name = r.localName, a.type = r.type;
}
@@ -38959,21 +41348,21 @@ function rx(i, e) {
try {
a = r.decode(i);
} catch (o) {
- if (En(o, "BUFFER_OVERRUN"))
+ if (Mn(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);
- }), rs.fromItems(t, n);
+ }), ds.fromItems(t, n);
}
-class kN extends As {
+class sN extends ys {
coder;
length;
constructor(e, t, n) {
const s = e.type + "[" + (t >= 0 ? t : "") + "]", r = t === -1 || e.dynamic;
- super("array", s, n, r), Xe(this, { coder: e, length: t });
+ super("array", s, n, r), Ye(this, { coder: e, length: t });
}
defaultValue() {
const e = this.coder.defaultValue(), t = [];
@@ -38982,25 +41371,25 @@ class kN extends As {
return t;
}
encode(e, t) {
- const n = Wt.dereference(t, "array");
+ 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)), gb(n.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
+ s === -1 && (s = n.length, e.writeValue(n.length)), eb(n.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
let r = [];
for (let a = 0; a < n.length; a++)
r.push(this.coder);
- return sx(e, r, n);
+ return Hb(e, r, n);
}
decode(e) {
let t = this.length;
- t === -1 && (t = e.readIndex(), ge(t * Nn <= e.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: e.bytes, offset: t * Nn, length: e.dataLength }));
+ 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 PN(this.coder));
- return rx(e, n);
+ n.push(new iN(this.coder));
+ return zb(e, n);
}
}
-class UN extends As {
+class rN extends ys {
constructor(e) {
super("bool", "bool", e, !1);
}
@@ -39008,14 +41397,14 @@ class UN extends As {
return !1;
}
encode(e, t) {
- const n = Wt.dereference(t, "bool");
+ const n = jt.dereference(t, "bool");
return e.writeValue(n ? 1 : 0);
}
decode(e) {
return !!e.readValue();
}
}
-class ax extends As {
+class Vb extends ys {
constructor(e, t) {
super(e, e, t, !0);
}
@@ -39023,7 +41412,7 @@ class ax extends As {
return "0x";
}
encode(e, t) {
- t = Tn(t);
+ t = On(t);
let n = e.writeValue(t.length);
return n += e.writeBytes(t), n;
}
@@ -39031,7 +41420,7 @@ class ax extends As {
return e.readBytes(e.readIndex(), !0);
}
}
-class ON extends ax {
+class aN extends Vb {
constructor(e) {
super("bytes", e);
}
@@ -39039,25 +41428,25 @@ class ON extends ax {
return Se(super.decode(e));
}
}
-class QN extends As {
+class oN extends ys {
size;
constructor(e, t) {
let n = "bytes" + String(e);
- super(n, n, t, !1), Xe(this, { size: e }, { size: "number" });
+ 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 = Tn(Wt.dereference(t, this.type));
+ let n = On(jt.dereference(t, this.type));
return n.length !== this.size && this._throwError("incorrect data length", t), e.writeBytes(n);
}
decode(e) {
return Se(e.readBytes(this.size));
}
}
-const GN = new Uint8Array([]);
-class HN extends As {
+const cN = new Uint8Array([]);
+class lN extends ys {
constructor(e) {
super("null", "", e, !1);
}
@@ -39065,37 +41454,37 @@ class HN extends As {
return null;
}
encode(e, t) {
- return t != null && this._throwError("not null", t), e.writeBytes(GN);
+ return t != null && this._throwError("not null", t), e.writeBytes(cN);
}
decode(e) {
return e.readBytes(0), null;
}
}
-const zN = BigInt(0), VN = BigInt(1), WN = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
-class qN extends As {
+const hN = BigInt(0), uN = BigInt(1), dN = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
+class fN extends ys {
size;
signed;
constructor(e, t, n) {
const s = (t ? "int" : "uint") + e * 8;
- super(s, s, n, !1), Xe(this, { size: e, signed: t }, { size: "number", signed: "boolean" });
+ super(s, s, n, !1), Ye(this, { size: e, signed: t }, { size: "number", signed: "boolean" });
}
defaultValue() {
return 0;
}
encode(e, t) {
- let n = Fe(Wt.dereference(t, this.type)), s = fo(WN, Nn * 8);
+ let n = Ne(jt.dereference(t, this.type)), s = vo(dN, Gn * 8);
if (this.signed) {
- let r = fo(s, this.size * 8 - 1);
- (n > r || n < -(r + VN)) && this._throwError("value out-of-bounds", t), n = xb(n, 8 * Nn);
- } else (n < zN || n > fo(s, this.size * 8)) && this._throwError("value out-of-bounds", t);
+ 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);
return e.writeValue(n);
}
decode(e) {
- let t = fo(e.readValue(), this.size * 8);
- return this.signed && (t = qT(t, this.size * 8)), t;
+ let t = vo(e.readValue(), this.size * 8);
+ return this.signed && (t = fF(t, this.size * 8)), t;
}
}
-class KN extends ax {
+class pN extends Vb {
constructor(e) {
super("string", e);
}
@@ -39103,13 +41492,13 @@ class KN extends ax {
return "";
}
encode(e, t) {
- return super.encode(e, cs(Wt.dereference(t, "string")));
+ return super.encode(e, gs(jt.dereference(t, "string")));
}
decode(e) {
- return Nl(super.decode(e));
+ return $l(super.decode(e));
}
}
-class tl extends As {
+class xl extends ys {
coders;
constructor(e, t) {
let n = !1;
@@ -39118,7 +41507,7 @@ class tl extends As {
a.dynamic && (n = !0), s.push(a.type);
});
const r = "tuple(" + s.join(",") + ")";
- super("tuple", r, t, n), Xe(this, { coders: Object.freeze(e.slice()) });
+ super("tuple", r, t, n), Ye(this, { coders: Object.freeze(e.slice()) });
}
defaultValue() {
const e = [];
@@ -39135,82 +41524,82 @@ class tl extends As {
}), Object.freeze(e);
}
encode(e, t) {
- const n = Wt.dereference(t, "tuple");
- return sx(e, this.coders, n);
+ const n = jt.dereference(t, "tuple");
+ return Hb(e, this.coders, n);
}
decode(e) {
- return rx(e, this.coders);
+ return zb(e, this.coders);
}
}
-function yu(i, e) {
+function Xu(i, e) {
return {
- address: St(i),
- storageKeys: e.map((t, n) => (V(Lt(t, 32), "invalid slot", `storageKeys[${n}]`, t), t.toLowerCase()))
+ address: Mt(i),
+ storageKeys: e.map((t, n) => (V(Ut(t, 32), "invalid slot", `storageKeys[${n}]`, t), t.toLowerCase()))
};
}
-function Br(i) {
+function Qr(i) {
if (Array.isArray(i))
- return i.map((t, n) => Array.isArray(t) ? (V(t.length === 2, "invalid slot set", `value[${n}]`, t), yu(t[0], t[1])) : (V(t != null && typeof t == "object", "invalid address-slot set", "value", i), yu(t.address, t.storageKeys)));
+ 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)));
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 yu(t, Object.keys(n).sort());
+ return Xu(t, Object.keys(n).sort());
});
return e.sort((t, n) => t.address.localeCompare(n.address)), e;
}
-function ox(i) {
+function Wb(i) {
return {
- address: St(i.address),
- nonce: Fe(i.nonce != null ? i.nonce : 0),
- chainId: Fe(i.chainId != null ? i.chainId : 0),
- signature: Gt.from(i.signature)
+ address: Mt(i.address),
+ nonce: Ne(i.nonce != null ? i.nonce : 0),
+ chainId: Ne(i.chainId != null ? i.chainId : 0),
+ signature: zt.from(i.signature)
};
}
-function jN(i) {
+function AN(i) {
let e;
- return typeof i == "string" ? e = es.computePublicKey(i, !1) : e = i.publicKey, St(Zt("0x" + e.substring(4)).substring(26));
+ return typeof i == "string" ? e = as.computePublicKey(i, !1) : e = i.publicKey, Mt(sn("0x" + e.substring(4)).substring(26));
}
-function XN(i, e) {
- return jN(es.recoverPublicKey(i, e));
+function gN(i, e) {
+ return AN(as.recoverPublicKey(i, e));
}
-const gn = BigInt(0), YN = BigInt(2), JN = BigInt(27), ZN = BigInt(28), $N = BigInt(35), eF = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), tF = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), wu = 4096 * 32, ul = 128;
-function nF(i) {
+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) {
return { blobToKzgCommitment: (n) => {
if ("computeBlobProof" in i) {
if ("blobToKzgCommitment" in i && typeof i.blobToKzgCommitment == "function")
- return ht(i.blobToKzgCommitment(Se(n)));
+ return dt(i.blobToKzgCommitment(Se(n)));
} else if ("blobToKzgCommitment" in i && typeof i.blobToKzgCommitment == "function")
- return ht(i.blobToKzgCommitment(n));
+ return dt(i.blobToKzgCommitment(n));
if ("blobToKZGCommitment" in i && typeof i.blobToKZGCommitment == "function")
- return ht(i.blobToKZGCommitment(Se(n)));
+ return dt(i.blobToKZGCommitment(Se(n)));
V(!1, "unsupported KZG library", "kzg", i);
}, computeBlobKzgProof: (n, s) => {
if ("computeBlobProof" in i && typeof i.computeBlobProof == "function")
- return ht(i.computeBlobProof(Se(n), Se(s)));
+ return dt(i.computeBlobProof(Se(n), Se(s)));
if ("computeBlobKzgProof" in i && typeof i.computeBlobKzgProof == "function")
return i.computeBlobKzgProof(n, s);
if ("computeBlobKZGProof" in i && typeof i.computeBlobKZGProof == "function")
- return ht(i.computeBlobKZGProof(Se(n), Se(s)));
+ return dt(i.computeBlobKZGProof(Se(n), Se(s)));
V(!1, "unsupported KZG library", "kzg", i);
} };
}
-function Wg(i, e) {
+function vm(i, e) {
let t = i.toString(16);
for (; t.length < 2; )
t = "0" + t;
- return t += Ga(e).substring(4), "0x" + t;
+ return t += Ya(e).substring(4), "0x" + t;
}
-function Ha(i) {
- return i === "0x" ? null : St(i);
+function Ja(i) {
+ return i === "0x" ? null : Mt(i);
}
-function th(i, e) {
+function Sh(i, e) {
try {
- return Br(i);
+ return Qr(i);
} catch (t) {
V(!1, t.message, e, i);
}
}
-function iF(i, e) {
+function vN(i, e) {
try {
if (!Array.isArray(i))
throw new Error("authorizationList: invalid array");
@@ -39224,13 +41613,13 @@ function iF(i, e) {
if (!s[1])
throw new Error(`authorization[${n}]: null address`);
t.push({
- address: Ha(s[1]),
- nonce: Tt(s[2], "nonce"),
- chainId: Tt(s[0], "chainId"),
- signature: Gt.from({
- yParity: Tr(s[3], "yParity"),
- r: ds(s[4], 32),
- s: ds(s[5], 32)
+ address: Ja(s[1]),
+ nonce: Dt(s[2], "nonce"),
+ chainId: Dt(s[0], "chainId"),
+ signature: zt.from({
+ yParity: Gr(s[3], "yParity"),
+ r: Es(s[4], 32),
+ s: Es(s[5], 32)
})
});
}
@@ -39239,161 +41628,161 @@ function iF(i, e) {
V(!1, t.message, e, i);
}
}
-function Tr(i, e) {
- return i === "0x" ? 0 : ut(i, e);
+function Gr(i, e) {
+ return i === "0x" ? 0 : ft(i, e);
}
-function Tt(i, e) {
+function Dt(i, e) {
if (i === "0x")
- return gn;
- const t = Fe(i, e);
- return V(t <= eF, "value exceeds uint size", e, t), t;
+ return yn;
+ const t = Ne(i, e);
+ return V(t <= _N, "value exceeds uint size", e, t), t;
}
-function bt(i, e) {
- const t = Fe(i, "value"), n = $t(t);
+function Et(i, e) {
+ const t = Ne(i, "value"), n = rn(t);
return V(n.length <= 32, "value too large", `tx.${e}`, t), n;
}
-function nh(i) {
- return Br(i).map((e) => [e.address, e.storageKeys]);
+function Ih(i) {
+ return Qr(i).map((e) => [e.address, e.storageKeys]);
}
-function sF(i) {
+function CN(i) {
return i.map((e) => [
- bt(e.chainId, "chainId"),
+ Et(e.chainId, "chainId"),
e.address,
- bt(e.nonce, "nonce"),
- bt(e.signature.yParity, "yParity"),
- $t(e.signature.r),
- $t(e.signature._s)
+ Et(e.nonce, "nonce"),
+ Et(e.signature.yParity, "yParity"),
+ rn(e.signature.r),
+ rn(e.signature._s)
]);
}
-function rF(i, e) {
+function SN(i, e) {
V(Array.isArray(i), `invalid ${e}`, "value", i);
for (let t = 0; t < i.length; t++)
- V(Lt(i[t], 32), "invalid ${ param } hash", `value[${t}]`, i[t]);
+ V(Ut(i[t], 32), "invalid ${ param } hash", `value[${t}]`, i[t]);
return i;
}
-function aF(i) {
- const e = ec(i);
+function IN(i) {
+ const e = pc(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: Tt(e[1], "gasPrice"),
- gasLimit: Tt(e[2], "gasLimit"),
- to: Ha(e[3]),
- value: Tt(e[4], "value"),
+ 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: gn
+ chainId: yn
};
if (e.length === 6)
return t;
- const n = Tt(e[6], "v"), s = Tt(e[7], "r"), r = Tt(e[8], "s");
- if (s === gn && r === gn)
+ const n = Dt(e[6], "v"), s = Dt(e[7], "r"), r = Dt(e[8], "s");
+ if (s === yn && r === yn)
t.chainId = n;
else {
- let a = (n - $N) / YN;
- a < gn && (a = gn), t.chainId = a, V(a !== gn || n === JN || n === ZN, "non-canonical legacy v", "v", e[6]), t.signature = Gt.from({
- r: ds(e[7], 32),
- s: ds(e[8], 32),
+ 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({
+ r: Es(e[7], 32),
+ s: Es(e[8], 32),
v: n
});
}
return t;
}
-function oF(i, e) {
+function MN(i, e) {
const t = [
- bt(i.nonce, "nonce"),
- bt(i.gasPrice || 0, "gasPrice"),
- bt(i.gasLimit, "gasLimit"),
+ Et(i.nonce, "nonce"),
+ Et(i.gasPrice || 0, "gasPrice"),
+ Et(i.gasLimit, "gasLimit"),
i.to || "0x",
- bt(i.value, "value"),
+ Et(i.value, "value"),
i.data
];
- let n = gn;
- if (i.chainId != gn)
- n = Fe(i.chainId, "tx.chainId"), V(!e || e.networkV == null || e.legacyChainId === n, "tx.chainId/sig.v mismatch", "sig", e);
+ 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);
else if (i.signature) {
const r = i.signature.legacyChainId;
r != null && (n = r);
}
if (!e)
- return n !== gn && (t.push($t(n)), t.push("0x"), t.push("0x")), ls(t);
+ return n !== yn && (t.push(rn(n)), t.push("0x"), t.push("0x")), ms(t);
let s = BigInt(27 + e.yParity);
- return n !== gn ? s = Gt.getChainIdV(n, e.v) : BigInt(e.v) !== s && V(!1, "tx.chainId/sig.v mismatch", "sig", e), t.push($t(s)), t.push($t(e.r)), t.push($t(e._s)), ls(t);
+ 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);
}
-function ih(i, e) {
+function Mh(i, e) {
let t;
try {
- if (t = Tr(e[0], "yParity"), t !== 0 && t !== 1)
+ if (t = Gr(e[0], "yParity"), t !== 0 && t !== 1)
throw new Error("bad yParity");
} catch {
V(!1, "invalid yParity", "yParity", e[0]);
}
- const n = ds(e[1], 32), s = ds(e[2], 32), r = Gt.from({ r: n, s, yParity: t });
+ const n = Es(e[1], 32), s = Es(e[2], 32), r = zt.from({ r: n, s, yParity: t });
i.signature = r;
}
-function cF(i) {
- const e = ec(ht(i).slice(1));
+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));
const t = {
type: 2,
- chainId: Tt(e[0], "chainId"),
- nonce: Tr(e[1], "nonce"),
- maxPriorityFeePerGas: Tt(e[2], "maxPriorityFeePerGas"),
- maxFeePerGas: Tt(e[3], "maxFeePerGas"),
+ chainId: Dt(e[0], "chainId"),
+ nonce: Gr(e[1], "nonce"),
+ maxPriorityFeePerGas: Dt(e[2], "maxPriorityFeePerGas"),
+ maxFeePerGas: Dt(e[3], "maxFeePerGas"),
gasPrice: null,
- gasLimit: Tt(e[4], "gasLimit"),
- to: Ha(e[5]),
- value: Tt(e[6], "value"),
+ gasLimit: Dt(e[4], "gasLimit"),
+ to: Ja(e[5]),
+ value: Dt(e[6], "value"),
data: Se(e[7]),
- accessList: th(e[8], "accessList")
+ accessList: Sh(e[8], "accessList")
};
- return e.length === 9 || ih(t, e.slice(9)), t;
+ return e.length === 9 || Mh(t, e.slice(9)), t;
}
-function lF(i, e) {
+function TN(i, e) {
const t = [
- bt(i.chainId, "chainId"),
- bt(i.nonce, "nonce"),
- bt(i.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
- bt(i.maxFeePerGas || 0, "maxFeePerGas"),
- bt(i.gasLimit, "gasLimit"),
+ Et(i.chainId, "chainId"),
+ Et(i.nonce, "nonce"),
+ Et(i.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
+ Et(i.maxFeePerGas || 0, "maxFeePerGas"),
+ Et(i.gasLimit, "gasLimit"),
i.to || "0x",
- bt(i.value, "value"),
+ Et(i.value, "value"),
i.data,
- nh(i.accessList || [])
+ Ih(i.accessList || [])
];
- return e && (t.push(bt(e.yParity, "yParity")), t.push($t(e.r)), t.push($t(e.s))), Ot(["0x02", ls(t)]);
+ return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Gt(["0x02", ms(t)]);
}
-function hF(i) {
- const e = ec(ht(i).slice(1));
+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));
const t = {
type: 1,
- chainId: Tt(e[0], "chainId"),
- nonce: Tr(e[1], "nonce"),
- gasPrice: Tt(e[2], "gasPrice"),
- gasLimit: Tt(e[3], "gasLimit"),
- to: Ha(e[4]),
- value: Tt(e[5], "value"),
+ 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: th(e[7], "accessList")
+ accessList: Sh(e[7], "accessList")
};
- return e.length === 8 || ih(t, e.slice(8)), t;
+ return e.length === 8 || Mh(t, e.slice(8)), t;
}
-function uF(i, e) {
+function FN(i, e) {
const t = [
- bt(i.chainId, "chainId"),
- bt(i.nonce, "nonce"),
- bt(i.gasPrice || 0, "gasPrice"),
- bt(i.gasLimit, "gasLimit"),
+ Et(i.chainId, "chainId"),
+ Et(i.nonce, "nonce"),
+ Et(i.gasPrice || 0, "gasPrice"),
+ Et(i.gasLimit, "gasLimit"),
i.to || "0x",
- bt(i.value, "value"),
+ Et(i.value, "value"),
i.data,
- nh(i.accessList || [])
+ Ih(i.accessList || [])
];
- return e && (t.push(bt(e.yParity, "recoveryParam")), t.push($t(e.r)), t.push($t(e.s))), Ot(["0x01", ls(t)]);
+ return e && (t.push(Et(e.yParity, "recoveryParam")), t.push(rn(e.r)), t.push(rn(e.s))), Gt(["0x01", ms(t)]);
}
-function dF(i) {
- let e = ec(ht(i).slice(1)), t = "3", n = null, s = null;
+function DN(i) {
+ let e = pc(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];
@@ -39406,17 +41795,17 @@ function dF(i) {
});
e = e[0];
} else if (e.length === 5 && Array.isArray(e[0])) {
- t = "3 (EIP-7594 network format)", n = ut(e[1]);
+ 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 * ul === 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 * Ml === 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 < ul; u++)
- h.push(c[l * ul + u]);
+ for (let u = 0; u < Ml; u++)
+ h.push(c[l * Ml + u]);
s.push({
data: a[l],
commitment: o[l],
- proof: Ot(h)
+ proof: Gt(h)
});
}
e = e[0];
@@ -39424,50 +41813,50 @@ function dF(i) {
V(Array.isArray(e) && (e.length === 11 || e.length === 14), `invalid field count for transaction type: ${t}`, "data", Se(i));
const r = {
type: 3,
- chainId: Tt(e[0], "chainId"),
- nonce: Tr(e[1], "nonce"),
- maxPriorityFeePerGas: Tt(e[2], "maxPriorityFeePerGas"),
- maxFeePerGas: Tt(e[3], "maxFeePerGas"),
+ chainId: Dt(e[0], "chainId"),
+ nonce: Gr(e[1], "nonce"),
+ maxPriorityFeePerGas: Dt(e[2], "maxPriorityFeePerGas"),
+ maxFeePerGas: Dt(e[3], "maxFeePerGas"),
gasPrice: null,
- gasLimit: Tt(e[4], "gasLimit"),
- to: Ha(e[5]),
- value: Tt(e[6], "value"),
+ gasLimit: Dt(e[4], "gasLimit"),
+ to: Ja(e[5]),
+ value: Dt(e[6], "value"),
data: Se(e[7]),
- accessList: th(e[8], "accessList"),
- maxFeePerBlobGas: Tt(e[9], "maxFeePerBlobGas"),
+ accessList: Sh(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(Lt(r.blobVersionedHashes[a], 32), `invalid blobVersionedHash at index ${a}: must be length 32`, "data", i);
- return e.length === 11 || ih(r, e.slice(11)), r;
+ 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;
}
-function fF(i, e, t) {
+function NN(i, e, t) {
const n = [
- bt(i.chainId, "chainId"),
- bt(i.nonce, "nonce"),
- bt(i.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
- bt(i.maxFeePerGas || 0, "maxFeePerGas"),
- bt(i.gasLimit, "gasLimit"),
- i.to || Go,
- bt(i.value, "value"),
+ 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,
+ Et(i.value, "value"),
i.data,
- nh(i.accessList || []),
- bt(i.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),
- rF(i.blobVersionedHashes || [], "blobVersionedHashes")
+ Ih(i.accessList || []),
+ Et(i.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),
+ SN(i.blobVersionedHashes || [], "blobVersionedHashes")
];
- if (e && (n.push(bt(e.yParity, "yParity")), n.push($t(e.r)), n.push($t(e.s)), t)) {
+ 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 = $t(i.blobWrapperVersion), r = [];
+ const s = rn(i.blobWrapperVersion), r = [];
for (const { proof: a } of t) {
- const o = ht(a), c = o.length / ul;
+ const o = dt(a), c = o.length / Ml;
for (let l = 0; l < o.length; l += c)
r.push(o.subarray(l, l + c));
}
- return Ot([
+ return Gt([
"0x03",
- ls([
+ ms([
n,
s,
t.map((a) => a.data),
@@ -39476,9 +41865,9 @@ function fF(i, e, t) {
])
]);
}
- return Ot([
+ return Gt([
"0x03",
- ls([
+ ms([
n,
t.map((s) => s.data),
t.map((s) => s.commitment),
@@ -39486,43 +41875,43 @@ function fF(i, e, t) {
])
]);
}
- return Ot(["0x03", ls(n)]);
+ return Gt(["0x03", ms(n)]);
}
-function pF(i) {
- const e = ec(ht(i).slice(1));
+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));
const t = {
type: 4,
- chainId: Tt(e[0], "chainId"),
- nonce: Tr(e[1], "nonce"),
- maxPriorityFeePerGas: Tt(e[2], "maxPriorityFeePerGas"),
- maxFeePerGas: Tt(e[3], "maxFeePerGas"),
+ chainId: Dt(e[0], "chainId"),
+ nonce: Gr(e[1], "nonce"),
+ maxPriorityFeePerGas: Dt(e[2], "maxPriorityFeePerGas"),
+ maxFeePerGas: Dt(e[3], "maxFeePerGas"),
gasPrice: null,
- gasLimit: Tt(e[4], "gasLimit"),
- to: Ha(e[5]),
- value: Tt(e[6], "value"),
+ gasLimit: Dt(e[4], "gasLimit"),
+ to: Ja(e[5]),
+ value: Dt(e[6], "value"),
data: Se(e[7]),
- accessList: th(e[8], "accessList"),
- authorizationList: iF(e[9], "authorizationList")
+ accessList: Sh(e[8], "accessList"),
+ authorizationList: vN(e[9], "authorizationList")
};
- return e.length === 10 || ih(t, e.slice(10)), t;
+ return e.length === 10 || Mh(t, e.slice(10)), t;
}
-function AF(i, e) {
+function PN(i, e) {
const t = [
- bt(i.chainId, "chainId"),
- bt(i.nonce, "nonce"),
- bt(i.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
- bt(i.maxFeePerGas || 0, "maxFeePerGas"),
- bt(i.gasLimit, "gasLimit"),
+ Et(i.chainId, "chainId"),
+ Et(i.nonce, "nonce"),
+ Et(i.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
+ Et(i.maxFeePerGas || 0, "maxFeePerGas"),
+ Et(i.gasLimit, "gasLimit"),
i.to || "0x",
- bt(i.value, "value"),
+ Et(i.value, "value"),
i.data,
- nh(i.accessList || []),
- sF(i.authorizationList || [])
+ Ih(i.accessList || []),
+ CN(i.authorizationList || [])
];
- return e && (t.push(bt(e.yParity, "yParity")), t.push($t(e.r)), t.push($t(e.s))), Ot(["0x04", ls(t)]);
+ return e && (t.push(Et(e.yParity, "yParity")), t.push(rn(e.r)), t.push(rn(e.s))), Gt(["0x04", ms(t)]);
}
-class fi {
+class yi {
#e;
#t;
#n;
@@ -39539,7 +41928,7 @@ class fi {
#h;
#u;
#d;
- #b;
+ #x;
#g;
/**
* The transaction type.
@@ -39607,10 +41996,10 @@ class fi {
*/
get to() {
const e = this.#t;
- return e == null && this.type === 3 ? Go : e;
+ return e == null && this.type === 3 ? nc : e;
}
set to(e) {
- this.#t = e == null ? null : St(e);
+ this.#t = e == null ? null : Mt(e);
}
/**
* The transaction nonce.
@@ -39619,7 +42008,7 @@ class fi {
return this.#i;
}
set nonce(e) {
- this.#i = ut(e, "value");
+ this.#i = ft(e, "value");
}
/**
* The gas limit.
@@ -39628,7 +42017,7 @@ class fi {
return this.#s;
}
set gasLimit(e) {
- this.#s = Fe(e);
+ this.#s = Ne(e);
}
/**
* The gas price.
@@ -39638,10 +42027,10 @@ class fi {
*/
get gasPrice() {
const e = this.#a;
- return e == null && (this.type === 0 || this.type === 1) ? gn : e;
+ return e == null && (this.type === 0 || this.type === 1) ? yn : e;
}
set gasPrice(e) {
- this.#a = e == null ? null : Fe(e, "gasPrice");
+ this.#a = e == null ? null : Ne(e, "gasPrice");
}
/**
* The maximum priority fee per unit of gas to pay. On legacy
@@ -39649,10 +42038,10 @@ class fi {
*/
get maxPriorityFeePerGas() {
const e = this.#r;
- return e ?? (this.type === 2 || this.type === 3 ? gn : null);
+ return e ?? (this.type === 2 || this.type === 3 ? yn : null);
}
set maxPriorityFeePerGas(e) {
- this.#r = e == null ? null : Fe(e, "maxPriorityFeePerGas");
+ this.#r = e == null ? null : Ne(e, "maxPriorityFeePerGas");
}
/**
* The maximum total fee per unit of gas to pay. On legacy
@@ -39660,10 +42049,10 @@ class fi {
*/
get maxFeePerGas() {
const e = this.#o;
- return e ?? (this.type === 2 || this.type === 3 ? gn : null);
+ return e ?? (this.type === 2 || this.type === 3 ? yn : null);
}
set maxFeePerGas(e) {
- this.#o = e == null ? null : Fe(e, "maxFeePerGas");
+ this.#o = e == null ? null : Ne(e, "maxFeePerGas");
}
/**
* The transaction data. For ``init`` transactions this is the
@@ -39682,7 +42071,7 @@ class fi {
return this.#f;
}
set value(e) {
- this.#f = Fe(e, "value");
+ this.#f = Ne(e, "value");
}
/**
* The chain ID this transaction is valid on.
@@ -39691,7 +42080,7 @@ class fi {
return this.#l;
}
set chainId(e) {
- this.#l = Fe(e);
+ this.#l = Ne(e);
}
/**
* If signed, the signature for this transaction.
@@ -39700,7 +42089,7 @@ class fi {
return this.#p || null;
}
set signature(e) {
- this.#p = e == null ? null : Gt.from(e);
+ this.#p = e == null ? null : zt.from(e);
}
isValid() {
const e = this.signature;
@@ -39725,24 +42114,24 @@ class fi {
return e ?? (this.type === 1 || this.type === 2 || this.type === 3 ? [] : null);
}
set accessList(e) {
- this.#A = e == null ? null : Br(e);
+ this.#A = e == null ? null : Qr(e);
}
get authorizationList() {
- const e = this.#b || null;
+ const e = this.#x || null;
return e == null && this.type === 4 ? [] : e;
}
set authorizationList(e) {
- this.#b = e == null ? null : e.map((t) => ox(t));
+ this.#x = e == null ? null : e.map((t) => Wb(t));
}
/**
* The max fee per blob gas for Cancun transactions.
*/
get maxFeePerBlobGas() {
const e = this.#c;
- return e == null && this.type === 3 ? gn : e;
+ return e == null && this.type === 3 ? yn : e;
}
set maxFeePerBlobGas(e) {
- this.#c = e == null ? null : Fe(e, "maxFeePerBlobGas");
+ this.#c = e == null ? null : Ne(e, "maxFeePerBlobGas");
}
/**
* The BLOb versioned hashes for Cancun transactions.
@@ -39755,7 +42144,7 @@ class fi {
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(Lt(e[t], 32), "invalid blobVersionedHash", `value[${t}]`, e[t]);
+ V(Ut(e[t], 32), "invalid blobVersionedHash", `value[${t}]`, e[t]);
}
this.#h = e;
}
@@ -39798,13 +42187,13 @@ class fi {
const t = [], n = [];
for (let s = 0; s < e.length; s++) {
const r = e[s];
- if (Uf(r)) {
+ if (dp(r)) {
ge(this.#u, "adding a raw blob requires a KZG library", "UNSUPPORTED_OPERATION", {
operation: "set blobs()"
});
- let a = ht(r);
- if (V(a.length <= wu, "blob is too large", `blobs[${s}]`, r), a.length !== wu) {
- const l = new Uint8Array(wu);
+ let a = dt(r);
+ if (V(a.length <= Yu, "blob is too large", `blobs[${s}]`, r), a.length !== Yu) {
+ const l = new Uint8Array(Yu);
l.set(a), a = l;
}
const o = this.#u.blobToKzgCommitment(a), c = Se(this.#u.computeBlobKzgProof(a, o));
@@ -39812,10 +42201,10 @@ class fi {
data: Se(a),
commitment: Se(o),
proof: c
- }), n.push(Wg(1, o));
+ }), n.push(vm(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(Wg(1, o));
+ t.push({ data: a, commitment: o, proof: c }), n.push(vm(1, o));
}
}
this.#d = t, this.#h = n;
@@ -39824,7 +42213,7 @@ class fi {
return this.#u;
}
set kzg(e) {
- e == null ? this.#u = null : this.#u = nF(e);
+ e == null ? this.#u = null : this.#u = wN(e);
}
get blobWrapperVersion() {
return this.#g;
@@ -39836,13 +42225,13 @@ class fi {
* Creates a new Transaction with default values.
*/
constructor() {
- this.#e = null, this.#t = null, this.#i = 0, this.#s = gn, this.#a = null, this.#r = null, this.#o = null, this.#n = "0x", this.#f = gn, this.#l = gn, this.#p = null, this.#A = null, this.#c = null, this.#h = null, this.#u = null, this.#d = null, this.#b = null, this.#g = null;
+ 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;
}
/**
* The transaction hash, if signed. Otherwise, ``null``.
*/
get hash() {
- return this.signature == null ? null : Zt(this.#m(!0, !1));
+ return this.signature == null ? null : sn(this.#m(!0, !1));
}
/**
* The pre-image hash of this transaction.
@@ -39851,19 +42240,19 @@ class fi {
* this transaction.
*/
get unsignedHash() {
- return Zt(this.unsignedSerialized);
+ return sn(this.unsignedSerialized);
}
/**
* The sending address, if signed. Otherwise, ``null``.
*/
get from() {
- return this.signature == null ? null : XN(this.unsignedHash, this.signature.getCanonical());
+ return this.signature == null ? null : gN(this.unsignedHash, this.signature.getCanonical());
}
/**
* The public key of the sender, if signed. Otherwise, ``null``.
*/
get fromPublicKey() {
- return this.signature == null ? null : es.recoverPublicKey(this.unsignedHash, this.signature.getCanonical());
+ return this.signature == null ? null : as.recoverPublicKey(this.unsignedHash, this.signature.getCanonical());
}
/**
* Returns true if signed.
@@ -39879,15 +42268,15 @@ class fi {
const n = e ? this.signature : null;
switch (this.inferType()) {
case 0:
- return oF(this, n);
+ return MN(this, n);
case 1:
- return uF(this, n);
+ return FN(this, n);
case 2:
- return lF(this, n);
+ return TN(this, n);
case 3:
- return fF(this, n, t ? this.blobs : null);
+ return NN(this, n, t ? this.blobs : null);
case 4:
- return AF(this, n);
+ return PN(this, n);
}
ge(!1, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" });
}
@@ -39971,7 +42360,7 @@ class fi {
* Create a copy of this transaciton.
*/
clone() {
- return fi.from(this);
+ return yi.from(this);
}
/**
* Return a JSON-friendly object.
@@ -39994,7 +42383,7 @@ class fi {
accessList: this.accessList
};
}
- [tF]() {
+ [yN]() {
return this.toString();
}
toString() {
@@ -40020,39 +42409,39 @@ class fi {
*/
static from(e) {
if (e == null)
- return new fi();
+ return new yi();
if (typeof e == "string") {
- const n = ht(e);
+ const n = dt(e);
if (n[0] >= 127)
- return fi.from(aF(n));
+ return yi.from(IN(n));
switch (n[0]) {
case 1:
- return fi.from(hF(n));
+ return yi.from(RN(n));
case 2:
- return fi.from(cF(n));
+ return yi.from(BN(n));
case 3:
- return fi.from(dF(n));
+ return yi.from(DN(n));
case 4:
- return fi.from(pF(n));
+ return yi.from(LN(n));
}
ge(!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 = Gt.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;
+ const t = new yi();
+ 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 vr(i) {
- return Zt(cs(i));
+function Lr(i) {
+ return sn(gs(i));
}
-var gF = "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";
-const qg = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]), Kg = 4;
-function mF(i) {
+var kN = "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";
+const Cm = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]), Sm = 4;
+function UN(i) {
let e = 0;
function t() {
return i[e++] << 8 | i[e++];
}
let n = t(), s = 1, r = [0, 1];
- for (let M = 1; M < n; M++)
+ for (let I = 1; I < n; I++)
r.push(s += t());
let a = t(), o = e;
e += a;
@@ -40060,47 +42449,47 @@ function mF(i) {
function h() {
return c == 0 && (l = l << 8 | i[e++], c = 8), l >> --c & 1;
}
- const u = 31, d = 2 ** u, f = d >>> 1, m = f >> 1, g = d - 1;
- let A = 0;
- for (let M = 0; M < u; M++) A = A << 1 | h();
- let p = [], y = 0, b = d;
+ 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 M = Math.floor(((A - y + 1) * s - 1) / b), w = 0, S = n;
+ let I = Math.floor(((g - y + 1) * s - 1) / x), w = 0, S = n;
for (; S - w > 1; ) {
let v = w + S >>> 1;
- M < r[v] ? S = v : w = v;
+ I < r[v] ? S = v : w = v;
}
if (w == 0) break;
- p.push(w);
- let T = y + Math.floor(b * r[w] / s), C = y + Math.floor(b * r[w + 1] / s) - 1;
+ A.push(w);
+ let T = y + Math.floor(x * r[w] / s), C = y + Math.floor(x * r[w + 1] / s) - 1;
for (; ((T ^ C) & f) == 0; )
- A = A << 1 & g | h(), T = T << 1 & g, C = C << 1 & g | 1;
- for (; T & ~C & m; )
- A = A & f | A << 1 & g >>> 1 | h(), T = T << 1 ^ f, C = (C ^ f) << 1 | f | 1;
- y = T, b = 1 + C - T;
- }
- let _ = n - 4;
- return p.map((M) => {
- switch (M - _) {
+ 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;
+ }
+ let E = n - 4;
+ return A.map((I) => {
+ switch (I - E) {
case 3:
- return _ + 65792 + (i[o++] << 16 | i[o++] << 8 | i[o++]);
+ return E + 65792 + (i[o++] << 16 | i[o++] << 8 | i[o++]);
case 2:
- return _ + 256 + (i[o++] << 8 | i[o++]);
+ return E + 256 + (i[o++] << 8 | i[o++]);
case 1:
- return _ + i[o++];
+ return E + i[o++];
default:
- return M - 1;
+ return I - 1;
}
});
}
-function bF(i) {
+function ON(i) {
let e = 0;
return () => i[e++];
}
-function cx(i) {
- return bF(mF(xF(i)));
+function qb(i) {
+ return ON(UN(QN(i)));
}
-function xF(i) {
+function QN(i) {
let e = [];
[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s, r) => e[s.charCodeAt(0)] = r);
let t = i.length, n = new Uint8Array(6 * t >> 3);
@@ -40108,15 +42497,15 @@ function xF(i) {
o = o << 6 | e[i.charCodeAt(s)], a += 6, a >= 8 && (n[r++] = o >> (a -= 8));
return n;
}
-function EF(i) {
+function GN(i) {
return i & 1 ? ~i >> 1 : i >> 1;
}
-function _F(i, e) {
+function HN(i, e) {
let t = Array(i);
- for (let n = 0, s = 0; n < i; n++) t[n] = s += EF(e());
+ for (let n = 0, s = 0; n < i; n++) t[n] = s += GN(e());
return t;
}
-function Ho(i, e = 0) {
+function ic(i, e = 0) {
let t = [];
for (; ; ) {
let n = i(), s = i();
@@ -40128,27 +42517,27 @@ function Ho(i, e = 0) {
}
return t;
}
-function lx(i) {
- return zo(() => {
- let e = Ho(i);
+function Kb(i) {
+ return sc(() => {
+ let e = ic(i);
if (e.length) return e;
});
}
-function hx(i) {
+function jb(i) {
let e = [];
for (; ; ) {
let t = i();
if (t == 0) break;
- e.push(yF(t, i));
+ e.push(zN(t, i));
}
for (; ; ) {
let t = i() - 1;
if (t < 0) break;
- e.push(wF(t, i));
+ e.push(VN(t, i));
}
return e.flat();
}
-function zo(i) {
+function sc(i) {
let e = [];
for (; ; ) {
let t = i(e.length);
@@ -40157,15 +42546,15 @@ function zo(i) {
}
return e;
}
-function ux(i, e, t) {
+function Xb(i, e, t) {
let n = Array(i).fill().map(() => []);
for (let s = 0; s < e; s++)
- _F(i, t).forEach((r, a) => n[a].push(r));
+ HN(i, t).forEach((r, a) => n[a].push(r));
return n;
}
-function yF(i, e) {
- let t = 1 + e(), n = e(), s = zo(e);
- return ux(s.length, 1 + i, e).flatMap((a, o) => {
+function zN(i, e) {
+ let t = 1 + e(), n = e(), s = sc(e);
+ return Xb(s.length, 1 + i, e).flatMap((a, o) => {
let [c, ...l] = a;
return Array(s[o]).fill().map((h, u) => {
let d = u * n;
@@ -40173,16 +42562,16 @@ function yF(i, e) {
});
});
}
-function wF(i, e) {
+function VN(i, e) {
let t = 1 + e();
- return ux(t, 1 + i, e).map((s) => [s[0], s.slice(1)]);
+ return Xb(t, 1 + i, e).map((s) => [s[0], s.slice(1)]);
}
-function vF(i) {
- let e = [], t = Ho(i);
+function WN(i) {
+ let e = [], t = ic(i);
return s(n([]), []), e;
function n(r) {
- let a = i(), o = zo(() => {
- let c = Ho(i).map((l) => t[l]);
+ 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 };
@@ -40196,13 +42585,13 @@ function vF(i) {
}
}
}
-function CF(i) {
+function qN(i) {
return i.toString(16).toUpperCase().padStart(2, "0");
}
-function dx(i) {
- return `{${CF(i)}}`;
+function Yb(i) {
+ return `{${qN(i)}}`;
}
-function SF(i) {
+function KN(i) {
let e = [];
for (let t = 0, n = i.length; t < n; ) {
let s = i.codePointAt(t);
@@ -40210,7 +42599,7 @@ function SF(i) {
}
return e;
}
-function Na(i) {
+function Qa(i) {
let t = i.length;
if (t < 4096) return String.fromCodePoint(...i);
let n = [];
@@ -40218,69 +42607,69 @@ function Na(i) {
n.push(String.fromCodePoint(...i.slice(s, s += 4096)));
return n.join("");
}
-function IF(i, e) {
+function jN(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 MF = "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";
-const Vo = 44032, Dl = 4352, Ll = 4449, Pl = 4519, fx = 19, px = 21, Fa = 28, kl = px * Fa, BF = fx * kl, TF = Vo + BF, RF = Dl + fx, NF = Ll + px, FF = Pl + Fa;
-function po(i) {
+var XN = "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";
+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) {
return i >> 24 & 255;
}
-function Ax(i) {
+function $b(i) {
return i & 16777215;
}
-let Hd, jg, zd, dl;
-function DF() {
- let i = cx(MF);
- Hd = new Map(lx(i).flatMap((e, t) => e.map((n) => [n, t + 1 << 24]))), jg = new Set(Ho(i)), zd = /* @__PURE__ */ new Map(), dl = /* @__PURE__ */ new Map();
- for (let [e, t] of hx(i)) {
- if (!jg.has(e) && t.length == 2) {
- let [n, s] = t, r = dl.get(n);
- r || (r = /* @__PURE__ */ new Map(), dl.set(n, r)), r.set(s, e);
+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);
}
- zd.set(e, t.reverse());
+ mf.set(e, t.reverse());
}
}
-function gx(i) {
- return i >= Vo && i < TF;
+function eE(i) {
+ return i >= rc && i < JN;
}
-function LF(i, e) {
- if (i >= Dl && i < RF && e >= Ll && e < NF)
- return Vo + (i - Dl) * kl + (e - Ll) * Fa;
- if (gx(i) && e > Pl && e < FF && (i - Vo) % Fa == 0)
- return i + (e - Pl);
+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);
{
- let t = dl.get(i);
+ let t = Bl.get(i);
return t && (t = t.get(e), t) ? t : -1;
}
}
-function mx(i) {
- Hd || DF();
+function tE(i) {
+ gf || tL();
let e = [], t = [], n = !1;
function s(r) {
- let a = Hd.get(r);
+ let a = gf.get(r);
a && (n = !0, r |= a), e.push(r);
}
for (let r of i)
for (; ; ) {
if (r < 128)
e.push(r);
- else if (gx(r)) {
- let a = r - Vo, o = a / kl | 0, c = a % kl / Fa | 0, l = a % Fa;
- s(Dl + o), s(Ll + c), l > 0 && s(Pl + l);
+ 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 {
- let a = zd.get(r);
+ let a = mf.get(r);
a ? t.push(...a) : s(r);
}
if (!t.length) break;
r = t.pop();
}
if (n && e.length > 1) {
- let r = po(e[0]);
+ let r = Co(e[0]);
for (let a = 1; a < e.length; a++) {
- let o = po(e[a]);
+ let o = Co(e[a]);
if (o == 0 || r <= o) {
r = o;
continue;
@@ -40288,185 +42677,185 @@ function mx(i) {
let c = a - 1;
for (; ; ) {
let l = e[c + 1];
- if (e[c + 1] = e[c], e[c] = l, !c || (r = po(e[--c]), r <= o)) break;
+ if (e[c + 1] = e[c], e[c] = l, !c || (r = Co(e[--c]), r <= o)) break;
}
- r = po(e[a]);
+ r = Co(e[a]);
}
}
return e;
}
-function PF(i) {
+function iL(i) {
let e = [], t = [], n = -1, s = 0;
for (let r of i) {
- let a = po(r), o = Ax(r);
+ let a = Co(r), o = $b(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 = LF(n, o);
+ let c = nL(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 bx(i) {
- return mx(i).map(Ax);
+function nE(i) {
+ return tE(i).map($b);
}
-function kF(i) {
- return PF(mx(i));
+function sL(i) {
+ return iL(tE(i));
}
-const Xg = 45, xx = ".", Ex = 65039, _x = 1, Ul = (i) => Array.from(i);
-function Wo(i, e) {
+const Mm = 45, iE = ".", sE = 65039, rE = 1, rh = (i) => Array.from(i);
+function ac(i, e) {
return i.P.has(e) || i.Q.has(e);
}
-class UF extends Array {
+class rL extends Array {
get is_emoji() {
return !0;
}
// free tagging system
}
-let Vd, yx, pr, Wd, wx, ma, vu, ea, sr, Yg, qd;
-function Yf() {
- if (Vd) return;
- let i = cx(gF);
- const e = () => Ho(i), t = () => new Set(e()), n = (h, u) => u.forEach((d) => h.add(d));
- Vd = new Map(hx(i)), yx = t(), pr = e(), Wd = new Set(e().map((h) => pr[h])), pr = new Set(pr), wx = t(), t();
- let s = lx(i), r = i();
+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();
const a = () => {
let h = /* @__PURE__ */ new Set();
return e().forEach((u) => n(h, s[u])), n(h, e()), h;
};
- ma = zo((h) => {
- let u = zo(i).map((d) => d + 96);
+ Ma = sc((h) => {
+ let u = sc(i).map((d) => d + 96);
if (u.length) {
let d = h >= r;
- u[0] -= 32, u = Na(u), d && (u = `Restricted[${u}]`);
- let f = a(), m = a(), g = !i();
- return { N: u, P: f, Q: m, M: g, R: d };
+ u[0] -= 32, u = Qa(u), d && (u = `Restricted[${u}]`);
+ let f = a(), p = a(), m = !i();
+ return { N: u, P: f, Q: p, M: m, R: d };
}
- }), vu = t(), ea = /* @__PURE__ */ new Map();
- let o = e().concat(Ul(vu)).sort((h, u) => h - u);
+ }), Ju = t(), da = /* @__PURE__ */ new Map();
+ let o = e().concat(rh(Ju)).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), vu.has(h) || ea.set(h, f);
+ f.V.push(h), Ju.has(h) || da.set(h, f);
});
- for (let { V: h, M: u } of new Set(ea.values())) {
+ for (let { V: h, M: u } of new Set(da.values())) {
let d = [];
- for (let m of h) {
- let g = ma.filter((p) => Wo(p, m)), A = d.find(({ G: p }) => g.some((y) => p.has(y)));
- A || (A = { G: /* @__PURE__ */ new Set(), V: [] }, d.push(A)), A.V.push(m), n(A.G, g);
+ for (let p of h) {
+ let m = Ma.filter((A) => ac(A, p)), g = d.find(({ G: A }) => m.some((y) => A.has(y)));
+ g || (g = { G: /* @__PURE__ */ new Set(), V: [] }, d.push(g)), g.V.push(p), n(g.G, m);
}
- let f = d.flatMap((m) => Ul(m.G));
- for (let { G: m, V: g } of d) {
- let A = new Set(f.filter((p) => !m.has(p)));
- for (let p of g)
- u.set(p, A);
+ let f = d.flatMap((p) => rh(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);
}
}
- sr = /* @__PURE__ */ new Set();
+ dr = /* @__PURE__ */ new Set();
let c = /* @__PURE__ */ new Set();
- const l = (h) => sr.has(h) ? c.add(h) : sr.add(h);
- for (let h of ma) {
+ const l = (h) => dr.has(h) ? c.add(h) : dr.add(h);
+ for (let h of Ma) {
for (let u of h.P) l(u);
for (let u of h.Q) l(u);
}
- for (let h of sr)
- !ea.has(h) && !c.has(h) && ea.set(h, _x);
- n(sr, bx(sr)), Yg = vF(i).map((h) => UF.from(h)).sort(IF), qd = /* @__PURE__ */ new Map();
- for (let h of Yg) {
- let u = [qd];
+ 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 d of h) {
- let f = u.map((m) => {
- let g = m.get(d);
- return g || (g = /* @__PURE__ */ new Map(), m.set(d, g)), g;
+ let f = u.map((p) => {
+ let m = p.get(d);
+ return m || (m = /* @__PURE__ */ new Map(), p.set(d, m)), m;
});
- d === Ex ? u.push(...f) : u = f;
+ d === sE ? u.push(...f) : u = f;
}
for (let d of u)
d.V = h;
}
}
-function Jf(i) {
- return (vx(i) ? "" : `${Zf(sh([i]))} `) + dx(i);
+function Cp(i) {
+ return (cE(i) ? "" : `${Sp(Bh([i]))} `) + Yb(i);
}
-function Zf(i) {
+function Sp(i) {
return `"${i}"‎`;
}
-function OF(i) {
- if (i.length >= 4 && i[2] == Xg && i[3] == Xg)
- throw new Error(`invalid label extension: "${Na(i.slice(0, 4))}"`);
+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 QF(i) {
+function oL(i) {
for (let t = i.lastIndexOf(95); t > 0; )
if (i[--t] !== 95)
throw new Error("underscore allowed only at start");
}
-function GF(i) {
- let e = i[0], t = qg.get(e);
- if (t) throw Co(`leading ${t}`);
+function cL(i) {
+ let e = i[0], t = Cm.get(e);
+ if (t) throw Po(`leading ${t}`);
let n = i.length, s = -1;
for (let r = 1; r < n; r++) {
e = i[r];
- let a = qg.get(e);
+ let a = Cm.get(e);
if (a) {
- if (s == r) throw Co(`${t} + ${a}`);
+ if (s == r) throw Po(`${t} + ${a}`);
s = r + 1, t = a;
}
}
- if (s == n) throw Co(`trailing ${t}`);
+ if (s == n) throw Po(`trailing ${t}`);
}
-function sh(i, e = 1 / 0, t = dx) {
+function Bh(i, e = 1 / 0, t = Yb) {
let n = [];
- HF(i[0]) && n.push("◌"), i.length > e && (e >>= 1, i = [...i.slice(0, e), 8230, ...i.slice(-e)]);
+ lL(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];
- vx(o) && (n.push(Na(i.slice(s, a))), n.push(t(o)), s = a + 1);
+ cE(o) && (n.push(Qa(i.slice(s, a))), n.push(t(o)), s = a + 1);
}
- return n.push(Na(i.slice(s, r))), n.join("");
+ return n.push(Qa(i.slice(s, r))), n.join("");
}
-function HF(i) {
- return Yf(), pr.has(i);
+function lL(i) {
+ return vp(), _r.has(i);
}
-function vx(i) {
- return Yf(), wx.has(i);
+function cE(i) {
+ return vp(), oE.has(i);
}
-function zF(i) {
- return KF(VF(i, kF, YF));
+function hL(i) {
+ return pL(uL(i, sL, mL));
}
-function VF(i, e, t) {
+function uL(i, e, t) {
if (!i) return [];
- Yf();
+ vp();
let n = 0;
- return i.split(xx).map((s) => {
- let r = SF(s), a = {
+ return i.split(iE).map((s) => {
+ let r = KN(s), a = {
input: r,
offset: n
// codepoint, not substring!
};
n += r.length + 1;
try {
- let o = a.tokens = XF(r, e, t), c = o.length, l;
+ let o = a.tokens = gL(r, e, t), c = o.length, l;
if (!c)
throw new Error("empty label");
let h = a.output = o.flat();
- if (QF(h), !(a.emoji = c > 1 || o[0].is_emoji) && h.every((d) => d < 128))
- OF(h), l = "ASCII";
+ if (oL(h), !(a.emoji = c > 1 || o[0].is_emoji) && h.every((d) => d < 128))
+ aL(h), l = "ASCII";
else {
let d = o.flatMap((f) => f.is_emoji ? [] : f);
if (!d.length)
l = "Emoji";
else {
- if (pr.has(h[0])) throw Co("leading combining mark");
- for (let g = 1; g < c; g++) {
- let A = o[g];
- if (!A.is_emoji && pr.has(A[0]))
- throw Co(`emoji + combining mark: "${Na(o[g - 1])} + ${sh([A[0]])}"`);
+ if (_r.has(h[0])) throw Po("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]])}"`);
}
- GF(h);
- let f = Ul(new Set(d)), [m] = qF(f);
- jF(m, d), WF(m, f), l = m.N;
+ cL(h);
+ let f = rh(new Set(d)), [p] = fL(f);
+ AL(p, d), dL(p, f), l = p.N;
}
}
a.type = l;
@@ -40476,196 +42865,196 @@ function VF(i, e, t) {
return a;
});
}
-function WF(i, e) {
+function dL(i, e) {
let t, n = [];
for (let s of e) {
- let r = ea.get(s);
- if (r === _x) return;
+ let r = da.get(s);
+ if (r === rE) return;
if (r) {
let a = r.M.get(s);
- if (t = t ? t.filter((o) => a.has(o)) : Ul(a), !t.length) return;
+ if (t = t ? t.filter((o) => a.has(o)) : rh(a), !t.length) return;
} else
n.push(s);
}
if (t) {
for (let s of t)
- if (n.every((r) => Wo(s, r)))
+ if (n.every((r) => ac(s, r)))
throw new Error(`whole-script confusable: ${i.N}/${s.N}`);
}
}
-function qF(i) {
- let e = ma;
+function fL(i) {
+ let e = Ma;
for (let t of i) {
- let n = e.filter((s) => Wo(s, t));
+ let n = e.filter((s) => ac(s, t));
if (!n.length)
- throw ma.some((s) => Wo(s, t)) ? Sx(e[0], t) : Cx(t);
+ throw Ma.some((s) => ac(s, t)) ? hE(e[0], t) : lE(t);
if (e = n, n.length == 1) break;
}
return e;
}
-function KF(i) {
+function pL(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 ${Zf(sh(e, 63))}: ${s}`);
+ throw new Error(i.length == 1 ? s : `Invalid label ${Sp(Bh(e, 63))}: ${s}`);
}
- return Na(n);
- }).join(xx);
+ return Qa(n);
+ }).join(iE);
}
-function Cx(i) {
- return new Error(`disallowed character: ${Jf(i)}`);
+function lE(i) {
+ return new Error(`disallowed character: ${Cp(i)}`);
}
-function Sx(i, e) {
- let t = Jf(e), n = ma.find((s) => s.P.has(e));
+function hE(i, e) {
+ let t = Cp(e), n = Ma.find((s) => s.P.has(e));
return n && (t = `${n.N} ${t}`), new Error(`illegal mixture: ${i.N} + ${t}`);
}
-function Co(i) {
+function Po(i) {
return new Error(`illegal placement: ${i}`);
}
-function jF(i, e) {
+function AL(i, e) {
for (let t of e)
- if (!Wo(i, t))
- throw Sx(i, t);
+ if (!ac(i, t))
+ throw hE(i, t);
if (i.M) {
- let t = bx(e);
+ let t = nE(e);
for (let n = 1, s = t.length; n < s; n++)
- if (Wd.has(t[n])) {
+ if (bf.has(t[n])) {
let r = n + 1;
- for (let a; r < s && Wd.has(a = t[r]); r++)
+ for (let a; r < s && bf.has(a = t[r]); r++)
for (let o = n; o < r; o++)
if (t[o] == a)
- throw new Error(`duplicate non-spacing marks: ${Jf(a)}`);
- if (r - n > Kg)
- throw new Error(`excessive non-spacing marks: ${Zf(sh(t.slice(n - 1, r)))} (${r - n}/${Kg})`);
+ 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})`);
n = r;
}
}
}
-function XF(i, e, t) {
+function gL(i, e, t) {
let n = [], s = [];
for (i = i.slice().reverse(); i.length; ) {
- let r = JF(i);
+ let r = xL(i);
if (r)
s.length && (n.push(e(s)), s = []), n.push(t(r));
else {
let a = i.pop();
- if (sr.has(a))
+ if (dr.has(a))
s.push(a);
else {
- let o = Vd.get(a);
+ let o = xf.get(a);
if (o)
s.push(...o);
- else if (!yx.has(a))
- throw Cx(a);
+ else if (!aE.has(a))
+ throw lE(a);
}
}
}
return s.length && n.push(e(s)), n;
}
-function YF(i) {
- return i.filter((e) => e != Ex);
+function mL(i) {
+ return i.filter((e) => e != sE);
}
-function JF(i, e) {
- let t = qd, n, s = i.length;
+function xL(i, e) {
+ let t = Ef, 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 Ix = new Uint8Array(32);
-Ix.fill(0);
-function Jg(i) {
+const uE = new Uint8Array(32);
+uE.fill(0);
+function Tm(i) {
return V(i.length !== 0, "invalid ENS name; empty component", "comp", i), i;
}
-function Mx(i) {
- const e = cs(ZF(i)), t = [];
+function dE(i) {
+ const e = gs(bL(i)), t = [];
if (i.length === 0)
return t;
let n = 0;
for (let s = 0; s < e.length; s++)
- e[s] === 46 && (t.push(Jg(e.slice(n, s))), n = s + 1);
- return V(n < e.length, "invalid ENS name; empty component", "name", i), t.push(Jg(e.slice(n))), t;
+ 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;
}
-function ZF(i) {
+function bL(i) {
try {
if (i.length === 0)
throw new Error("empty label");
- return zF(i);
+ return hL(i);
} catch (e) {
V(!1, `invalid ENS name (${e.message})`, "name", i);
}
}
-function Kd(i) {
+function _f(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 = Ix;
- const t = Mx(i);
+ let e = uE;
+ const t = dE(i);
for (; t.length; )
- e = Zt(Ot([e, Zt(t.pop())]));
+ e = sn(Gt([e, sn(t.pop())]));
return Se(e);
}
-function $F(i, e) {
+function EL(i, e) {
const t = e;
- return V(t <= 255, "DNS encoded label cannot exceed 255", "length", t), Se(Ot(Mx(i).map((n) => {
+ return V(t <= 255, "DNS encoded label cannot exceed 255", "length", t), Se(Gt(dE(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 Bx = new Uint8Array(32);
-Bx.fill(0);
-const eD = BigInt(-1), Tx = BigInt(0), Rx = BigInt(1), tD = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
-function nD(i) {
- const e = ht(i), t = e.length % 32;
- return t ? Ot([e, Bx.slice(t)]) : Se(e);
+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 e = dt(i), t = e.length % 32;
+ return t ? Gt([e, fE.slice(t)]) : Se(e);
}
-const iD = Gs(Rx, 32), sD = Gs(Tx, 32), Zg = {
+const vL = Xs(AE, 32), CL = Xs(pE, 32), Rm = {
name: "string",
version: "string",
chainId: "uint256",
verifyingContract: "address",
salt: "bytes32"
-}, Cu = [
+}, Zu = [
"name",
"version",
"chainId",
"verifyingContract",
"salt"
];
-function $g(i) {
+function Fm(i) {
return function(e) {
return V(typeof e == "string", `invalid domain value for ${JSON.stringify(i)}`, `domain.${i}`, e), e;
};
}
-const rD = {
- name: $g("name"),
- version: $g("version"),
+const SL = {
+ name: Fm("name"),
+ version: Fm("version"),
chainId: function(i) {
- const e = Fe(i, "domain.chainId");
- return V(e >= 0, "invalid chain ID", "domain.chainId", i), Number.isSafeInteger(e) ? Number(e) : pi(e);
+ const e = Ne(i, "domain.chainId");
+ return V(e >= 0, "invalid chain ID", "domain.chainId", i), Number.isSafeInteger(e) ? Number(e) : wi(e);
},
verifyingContract: function(i) {
try {
- return St(i).toLowerCase();
+ return Mt(i).toLowerCase();
} catch {
}
V(!1, 'invalid domain value "verifyingContract"', "domain.verifyingContract", i);
},
salt: function(i) {
- const e = ht(i, "domain.salt");
+ const e = dt(i, "domain.salt");
return V(e.length === 32, 'invalid domain value "salt"', "domain.salt", i), Se(e);
}
};
-function Su(i) {
+function $u(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 = fo(tD, t ? n - 1 : n), r = t ? (s + Rx) * eD : Tx;
+ const s = vo(yL, t ? n - 1 : n), r = t ? (s + AE) * _L : pE;
return function(a) {
- const o = Fe(a, "value");
- return V(o >= r && o <= s, `value out-of-bounds for ${i}`, "value", o), Gs(t ? xb(o, 256) : o, 32);
+ 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);
};
}
}
@@ -40674,35 +43063,35 @@ function Su(i) {
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 = ht(n);
- return V(s.length === t, `invalid length for ${i}`, "value", n), nD(n);
+ const s = dt(n);
+ return V(s.length === t, `invalid length for ${i}`, "value", n), wL(n);
};
}
}
switch (i) {
case "address":
return function(e) {
- return ds(St(e), 32);
+ return Es(Mt(e), 32);
};
case "bool":
return function(e) {
- return e ? iD : sD;
+ return e ? vL : CL;
};
case "bytes":
return function(e) {
- return Zt(e);
+ return sn(e);
};
case "string":
return function(e) {
- return vr(e);
+ return Lr(e);
};
}
return null;
}
-function em(i, e) {
+function Dm(i, e) {
return `${i}(${e.map(({ name: t, type: n }) => n + " " + t).join(",")})`;
}
-function nl(i) {
+function bl(i) {
const e = i.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);
return e ? {
base: e[1],
@@ -40714,7 +43103,7 @@ function nl(i) {
}
} : { base: i };
}
-class qn {
+class $n {
/**
* The primary type for the structured [[types]].
*
@@ -40745,7 +43134,7 @@ class qn {
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 } = nl(h);
+ let { base: u, index: d } = bl(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);
@@ -40753,12 +43142,12 @@ class qn {
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 = nl(h.type).base;
- V(u !== c, `circular type reference to ${JSON.stringify(u)}`, "types", e), !Su(u) && (V(n.has(u), `unknown type ${JSON.stringify(u)}`, "types", e), n.get(u).push(c), t.get(c).add(u));
+ 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 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), Xe(this, { primaryType: a[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))
@@ -40772,7 +43161,7 @@ class qn {
o(this.primaryType, /* @__PURE__ */ new Set());
for (const [c, l] of s) {
const h = Array.from(l);
- h.sort(), this.#t.set(c, em(c, r[c]) + h.map((u) => em(u, r[u])).join(""));
+ h.sort(), this.#t.set(c, Dm(c, r[c]) + h.map((u) => Dm(u, r[u])).join(""));
}
}
/**
@@ -40784,28 +43173,28 @@ class qn {
}
#i(e) {
{
- const s = Su(e);
+ const s = $u(e);
if (s)
return s;
}
- const t = nl(e).array;
+ const t = bl(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(Zt)), Zt(Ot(o));
+ return this.#t.has(s) && (o = o.map(sn)), sn(Gt(o));
};
}
const n = this.types[e];
if (n) {
- const s = vr(this.#t.get(e));
+ const s = Lr(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) ? Zt(l) : l;
+ return this.#t.has(c) ? sn(l) : l;
});
- return a.unshift(s), Ot(a);
+ return a.unshift(s), Gt(a);
};
}
V(!1, `unknown type: ${e}`, "type", e);
@@ -40827,7 +43216,7 @@ class qn {
* Returns the hash of %%value%% for the type of %%name%%.
*/
hashStruct(e, t) {
- return Zt(this.encodeData(e, t));
+ return sn(this.encodeData(e, t));
}
/**
* Return the fulled encoded %%value%% for the [[types]].
@@ -40845,9 +43234,9 @@ class qn {
* @_ignore:
*/
_visit(e, t, n) {
- if (Su(e))
+ if ($u(e))
return n(e, t);
- const s = nl(e).array;
+ const s = bl(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];
@@ -40869,19 +43258,19 @@ class qn {
* Create a new **TypedDataEncoder** for %%types%%.
*/
static from(e) {
- return new qn(e);
+ return new $n(e);
}
/**
* Return the primary type for %%types%%.
*/
static getPrimaryType(e) {
- return qn.from(e).primaryType;
+ return $n.from(e).primaryType;
}
/**
* Return the hashed struct for %%value%% using %%types%% and %%name%%.
*/
static hashStruct(e, t, n) {
- return qn.from(t).hashStruct(e, n);
+ return $n.from(t).hashStruct(e, n);
}
/**
* Return the domain hash for %%domain%%.
@@ -40891,26 +43280,26 @@ class qn {
for (const n in e) {
if (e[n] == null)
continue;
- const s = Zg[n];
+ const s = Rm[n];
V(s, `invalid typed-data domain key: ${JSON.stringify(n)}`, "domain", e), t.push({ name: n, type: s });
}
- return t.sort((n, s) => Cu.indexOf(n.name) - Cu.indexOf(s.name)), qn.hashStruct("EIP712Domain", { EIP712Domain: t }, e);
+ return t.sort((n, s) => Zu.indexOf(n.name) - Zu.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 Ot([
+ return Gt([
"0x1901",
- qn.hashDomain(e),
- qn.from(t).hash(n)
+ $n.hashDomain(e),
+ $n.from(t).hash(n)
]);
}
/**
* Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
*/
static hash(e, t, n) {
- return Zt(qn.encode(e, t, n));
+ return sn($n.encode(e, t, n));
}
// Replaces all address types with ENS names with their looked up address
/**
@@ -40922,9 +43311,9 @@ class qn {
for (const o in e)
e[o] == null && delete e[o];
const r = {};
- e.verifyingContract && !Lt(e.verifyingContract, 20) && (r[e.verifyingContract] = "0x");
- const a = qn.from(t);
- a.visit(n, (o, c) => (o === "address" && !Lt(c, 20) && (r[c] = "0x"), c));
+ e.verifyingContract && !Ut(e.verifyingContract, 20) && (r[e.verifyingContract] = "0x");
+ const a = $n.from(t);
+ a.visit(n, (o, c) => (o === "address" && !Ut(c, 20) && (r[c] = "0x"), c));
for (const o in r)
r[o] = await s(o);
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 };
@@ -40934,13 +43323,13 @@ class qn {
* the JSON-RPC [[link-eip-712]] method.
*/
static getPayload(e, t, n) {
- qn.hashDomain(e);
+ $n.hashDomain(e);
const s = {}, r = [];
- Cu.forEach((c) => {
+ Zu.forEach((c) => {
const l = e[c];
- l != null && (s[c] = rD[c](l), r.push({ name: c, type: Zg[c] }));
+ l != null && (s[c] = SL[c](l), r.push({ name: c, type: Rm[c] }));
});
- const a = qn.from(t);
+ const a = $n.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), {
@@ -40949,9 +43338,9 @@ class qn {
primaryType: a.primaryType,
message: a.visit(n, (c, l) => {
if (c.match(/^bytes(\d*)/))
- return Se(ht(l));
+ return Se(dt(l));
if (c.match(/^u?int/))
- return Fe(l).toString();
+ return Ne(l).toString();
switch (c) {
case "address":
return l.toLowerCase();
@@ -40965,19 +43354,19 @@ class qn {
};
}
}
-function Dn(i) {
+function zn(i) {
const e = /* @__PURE__ */ new Set();
return i.forEach((t) => e.add(t)), Object.freeze(e);
}
-const aD = "external public payable override", oD = Dn(aD.split(" ")), Nx = "constant external internal payable private public pure view override", cD = Dn(Nx.split(" ")), Fx = "constructor error event fallback function receive struct", Dx = Dn(Fx.split(" ")), Lx = "calldata memory storage payable indexed", lD = Dn(Lx.split(" ")), hD = "tuple returns", uD = [Fx, Lx, hD, Nx].join(" "), dD = Dn(uD.split(" ")), fD = {
+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 = {
"(": "OPEN_PAREN",
")": "CLOSE_PAREN",
"[": "OPEN_BRACKET",
"]": "CLOSE_BRACKET",
",": "COMMA",
"@": "AT"
-}, pD = new RegExp("^(\\s*)"), AD = new RegExp("^([0-9]+)"), gD = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), Px = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), kx = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
-class ri {
+}, 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]*))$");
+class pi {
#e;
#t;
get offset() {
@@ -40990,13 +43379,13 @@ class ri {
this.#e = 0, this.#t = e.slice();
}
clone() {
- return new ri(this.#t);
+ return new pi(this.#t);
}
reset() {
this.#e = 0;
}
#n(e = 0, t = 0) {
- return new ri(this.#t.slice(e, t).map((n) => Object.freeze(Object.assign({}, n, {
+ return new pi(this.#t.slice(e, t).map((n) => Object.freeze(Object.assign({}, n, {
match: n.match - e,
linkBack: n.linkBack - e,
linkNext: n.linkNext - e
@@ -41069,18 +43458,18 @@ class ri {
return `<TokenString ${e.join(" ")}>`;
}
}
-function Ws(i) {
+function $s(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(pD);
+ let a = i.substring(r), o = a.match(LL);
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 = fD[a[0]] || "";
+ let l = NL[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);
@@ -41094,7 +43483,7 @@ function Ws(i) {
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 = ut(u);
+ h = u + h, e[e.length - 1].value = ft(u);
}
if (e.length === 0 || e[e.length - 1].type !== "BRACKET")
throw new Error("missing opening bracket");
@@ -41102,42 +43491,42 @@ function Ws(i) {
}
continue;
}
- if (o = a.match(gD), o) {
- if (c.text = o[1], r += c.text.length, dD.has(c.text)) {
+ if (o = a.match(kL), o) {
+ if (c.text = o[1], r += c.text.length, DL.has(c.text)) {
c.type = "KEYWORD";
continue;
}
- if (c.text.match(kx)) {
+ if (c.text.match(_E)) {
c.type = "TYPE";
continue;
}
c.type = "ID";
continue;
}
- if (o = a.match(AD), o) {
+ if (o = a.match(PL), 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 ri(e.map((a) => Object.freeze(a)));
+ return new pi(e.map((a) => Object.freeze(a)));
}
-function tm(i, e) {
+function Nm(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 rh(i, e) {
- if (e.peekKeyword(Dx)) {
+function Th(i, e) {
+ if (e.peekKeyword(xE)) {
const t = e.pop().text;
if (t !== i)
throw new Error(`expected ${i}, got ${t}`);
}
return e.popType("ID");
}
-function fs(i, e) {
+function _s(i, e) {
const t = /* @__PURE__ */ new Set();
for (; ; ) {
const n = i.peekType("KEYWORD");
@@ -41149,28 +43538,28 @@ function fs(i, e) {
}
return Object.freeze(t);
}
-function Ux(i) {
- let e = fs(i, cD);
- return tm(e, Dn("constant payable nonpayable".split(" "))), tm(e, Dn("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 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 hs(i, e) {
- return i.popParams().map((t) => Ft.from(t, e));
+function xs(i, e) {
+ return i.popParams().map((t) => Pt.from(t, e));
}
-function Ox(i) {
+function wE(i) {
if (i.peekType("AT")) {
if (i.pop(), i.peekType("NUMBER"))
- return Fe(i.pop().text);
+ return Ne(i.pop().text);
throw new Error("invalid gas");
}
return null;
}
-function Cr(i) {
+function Pr(i) {
if (i.length)
throw new Error(`unexpected tokens at offset ${i.offset}: ${i.toString()}`);
}
-const mD = new RegExp(/^(.*)\[([0-9]*)\]$/);
-function nm(i) {
- const e = i.match(kx);
+const UL = new RegExp(/^(.*)\[([0-9]*)\]$/);
+function Lm(i) {
+ const e = i.match(_E);
if (V(e, "invalid type", "type", i), i === "uint")
return "uint256";
if (i === "int")
@@ -41184,8 +43573,8 @@ function nm(i) {
}
return i;
}
-const Ht = {}, Gn = /* @__PURE__ */ Symbol.for("_ethers_internal"), im = "_ParamTypeInternal", sm = "_ErrorInternal", rm = "_EventInternal", am = "_ConstructorInternal", om = "_FallbackInternal", cm = "_FunctionInternal", lm = "_StructInternal";
-class Ft {
+const Vt = {}, Xn = /* @__PURE__ */ Symbol.for("_ethers_internal"), Pm = "_ParamTypeInternal", km = "_ErrorInternal", Um = "_EventInternal", Om = "_ConstructorInternal", Qm = "_FallbackInternal", Gm = "_FunctionInternal", Hm = "_StructInternal";
+class Pt {
/**
* The local name of the parameter (or ``""`` if unbound)
*/
@@ -41227,7 +43616,7 @@ class Ft {
* @private
*/
constructor(e, t, n, s, r, a, o, c) {
- if (Jl(e, Ht, "ParamType"), Object.defineProperty(this, Gn, { value: im }), a && (a = Object.freeze(a.slice())), s === "array") {
+ if (yh(e, Vt, "ParamType"), Object.defineProperty(this, Xn, { value: Pm }), a && (a = Object.freeze(a.slice())), s === "array") {
if (o == null || c == null)
throw new Error("");
} else if (o != null || c != null)
@@ -41237,7 +43626,7 @@ class Ft {
throw new Error("");
} else if (a != null)
throw new Error("");
- Xe(this, {
+ Ye(this, {
name: t,
type: n,
baseType: s,
@@ -41388,44 +43777,44 @@ class Ft {
* otherwise the ``indexed`` keyword will throw an error.
*/
static from(e, t) {
- if (Ft.isParamType(e))
+ if (Pt.isParamType(e))
return e;
if (typeof e == "string")
try {
- return Ft.from(Ws(e), t);
+ return Pt.from($s(e), t);
} catch {
V(!1, "invalid param type", "obj", e);
}
- else if (e instanceof ri) {
+ else if (e instanceof pi) {
let o = "", c = "", l = null;
- fs(e, Dn(["tuple"])).has("tuple") || e.peekType("OPEN_PAREN") ? (c = "tuple", l = e.popParams().map((g) => Ft.from(g)), o = `tuple(${l.map((g) => g.format()).join(",")})`) : (o = nm(e.popType("TYPE")), c = o);
+ _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);
let h = null, u = null;
for (; e.length && e.peekType("BRACKET"); ) {
- const g = e.pop();
- h = new Ft(Ht, "", o, c, null, l, u, h), u = g.value, o += g.text, c = "array", l = null;
+ 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 (fs(e, lD).has("indexed")) {
+ if (_s(e, TL).has("indexed")) {
if (!t)
throw new Error("");
d = !0;
}
- const m = e.peekType("ID") ? e.pop().text : "";
+ const p = e.peekType("ID") ? e.pop().text : "";
if (e.length)
throw new Error("leftover tokens");
- return new Ft(Ht, m, o, c, d, l, u, h);
+ return new Pt(Vt, p, o, c, d, l, u, h);
}
const n = e.name;
- V(!n || typeof n == "string" && n.match(Px), "invalid name", "obj.name", n);
+ V(!n || typeof n == "string" && n.match(EE), "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(mD);
+ let r = e.type, a = r.match(UL);
if (a) {
- const o = parseInt(a[2] || "-1"), c = Ft.from({
+ const o = parseInt(a[2] || "-1"), c = Pt.from({
type: a[1],
components: e.components
});
- return new Ft(Ht, n || "", r, "array", s, null, o, c);
+ return new Pt(Vt, n || "", r, "array", s, null, o, c);
}
if (r === "tuple" || r.startsWith(
"tuple("
@@ -41434,19 +43823,19 @@ class Ft {
"("
/* fix: ) */
)) {
- const o = e.components != null ? e.components.map((l) => Ft.from(l)) : null;
- return new Ft(Ht, n || "", r, "tuple", s, o, null, null);
+ 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 = nm(e.type), new Ft(Ht, n || "", r, r, s, null, null, null);
+ return r = Lm(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[Gn] === im;
+ return e && e[Xn] === Pm;
}
}
-class Sr {
+class kr {
/**
* The type of the fragment.
*/
@@ -41459,7 +43848,7 @@ class Sr {
* @private
*/
constructor(e, t, n) {
- Jl(e, Ht, "Fragment"), n = Object.freeze(n.slice()), Xe(this, { type: t, inputs: n });
+ yh(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
@@ -41468,42 +43857,42 @@ class Sr {
static from(e) {
if (typeof e == "string") {
try {
- Sr.from(JSON.parse(e));
+ kr.from(JSON.parse(e));
} catch {
}
- return Sr.from(Ws(e));
+ return kr.from($s(e));
}
- if (e instanceof ri)
- switch (e.peekKeyword(Dx)) {
+ if (e instanceof pi)
+ switch (e.peekKeyword(xE)) {
case "constructor":
- return as.from(e);
+ return fs.from(e);
case "error":
- return Qn.from(e);
+ return jn.from(e);
case "event":
- return Ri.from(e);
+ return Oi.from(e);
case "fallback":
case "receive":
- return Ji.from(e);
+ return is.from(e);
case "function":
- return Ni.from(e);
+ return Qi.from(e);
case "struct":
- return mr.from(e);
+ return Cr.from(e);
}
else if (typeof e == "object") {
switch (e.type) {
case "constructor":
- return as.from(e);
+ return fs.from(e);
case "error":
- return Qn.from(e);
+ return jn.from(e);
case "event":
- return Ri.from(e);
+ return Oi.from(e);
case "fallback":
case "receive":
- return Ji.from(e);
+ return is.from(e);
case "function":
- return Ni.from(e);
+ return Qi.from(e);
case "struct":
- return mr.from(e);
+ return Cr.from(e);
}
ge(!1, `unsupported type: ${e.type}`, "UNSUPPORTED_OPERATION", {
operation: "Fragment.from"
@@ -41515,34 +43904,34 @@ class Sr {
* Returns true if %%value%% is a [[ConstructorFragment]].
*/
static isConstructor(e) {
- return as.isFragment(e);
+ return fs.isFragment(e);
}
/**
* Returns true if %%value%% is an [[ErrorFragment]].
*/
static isError(e) {
- return Qn.isFragment(e);
+ return jn.isFragment(e);
}
/**
* Returns true if %%value%% is an [[EventFragment]].
*/
static isEvent(e) {
- return Ri.isFragment(e);
+ return Oi.isFragment(e);
}
/**
* Returns true if %%value%% is a [[FunctionFragment]].
*/
static isFunction(e) {
- return Ni.isFragment(e);
+ return Qi.isFragment(e);
}
/**
* Returns true if %%value%% is a [[StructFragment]].
*/
static isStruct(e) {
- return mr.isFragment(e);
+ return Cr.isFragment(e);
}
}
-class ah extends Sr {
+class Rh extends kr {
/**
* The name of the fragment.
*/
@@ -41551,24 +43940,24 @@ class ah extends Sr {
* @private
*/
constructor(e, t, n, s) {
- super(e, t, s), V(typeof n == "string" && n.match(Px), "invalid identifier", "name", n), s = Object.freeze(s.slice()), Xe(this, { name: n });
+ super(e, t, s), V(typeof n == "string" && n.match(EE), "invalid identifier", "name", n), s = Object.freeze(s.slice()), Ye(this, { name: n });
}
}
-function qo(i, e) {
+function oc(i, e) {
return "(" + e.map((t) => t.format(i)).join(i === "full" ? ", " : ",") + ")";
}
-class Qn extends ah {
+class jn extends Rh {
/**
* @private
*/
constructor(e, t, n) {
- super(e, "error", t, n), Object.defineProperty(this, Gn, { value: sm });
+ super(e, "error", t, n), Object.defineProperty(this, Xn, { value: km });
}
/**
* The Custom Error selector.
*/
get selector() {
- return vr(this.format("sighash")).substring(0, 10);
+ return Lr(this.format("sighash")).substring(0, 10);
}
/**
* Returns a string representation of this fragment as %%format%%.
@@ -41581,31 +43970,31 @@ class Qn extends ah {
inputs: this.inputs.map((n) => JSON.parse(n.format(e)))
});
const t = [];
- return e !== "sighash" && t.push("error"), t.push(this.name + qo(e, this.inputs)), t.join(" ");
+ return e !== "sighash" && t.push("error"), t.push(this.name + oc(e, this.inputs)), t.join(" ");
}
/**
* Returns a new **ErrorFragment** for %%obj%%.
*/
static from(e) {
- if (Qn.isFragment(e))
+ if (jn.isFragment(e))
return e;
if (typeof e == "string")
- return Qn.from(Ws(e));
- if (e instanceof ri) {
- const t = rh("error", e), n = hs(e);
- return Cr(e), new Qn(Ht, t, n);
+ return jn.from($s(e));
+ if (e instanceof pi) {
+ const t = Th("error", e), n = xs(e);
+ return Pr(e), new jn(Vt, t, n);
}
- return new Qn(Ht, e.name, e.inputs ? e.inputs.map(Ft.from) : []);
+ return new jn(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);
}
/**
* Returns ``true`` and provides a type guard if %%value%% is an
* **ErrorFragment**.
*/
static isFragment(e) {
- return e && e[Gn] === sm;
+ return e && e[Xn] === km;
}
}
-class Ri extends ah {
+class Oi extends Rh {
/**
* Whether this event is anonymous.
*/
@@ -41614,13 +44003,13 @@ class Ri extends ah {
* @private
*/
constructor(e, t, n, s) {
- super(e, "event", t, n), Object.defineProperty(this, Gn, { value: rm }), Xe(this, { anonymous: s });
+ super(e, "event", t, n), Object.defineProperty(this, Xn, { value: Um }), Ye(this, { anonymous: s });
}
/**
* The Event topic hash.
*/
get topicHash() {
- return vr(this.format("sighash"));
+ return Lr(this.format("sighash"));
}
/**
* Returns a string representation of this event as %%format%%.
@@ -41634,41 +44023,41 @@ class Ri extends ah {
inputs: this.inputs.map((n) => JSON.parse(n.format(e)))
});
const t = [];
- return e !== "sighash" && t.push("event"), t.push(this.name + qo(e, this.inputs)), e !== "sighash" && this.anonymous && t.push("anonymous"), t.join(" ");
+ return e !== "sighash" && t.push("event"), t.push(this.name + oc(e, this.inputs)), e !== "sighash" && this.anonymous && t.push("anonymous"), t.join(" ");
}
/**
* Return the topic hash for an event with %%name%% and %%params%%.
*/
static getTopicHash(e, t) {
- return t = (t || []).map((s) => Ft.from(s)), new Ri(Ht, e, t, !1).topicHash;
+ return t = (t || []).map((s) => Pt.from(s)), new Oi(Vt, e, t, !1).topicHash;
}
/**
* Returns a new **EventFragment** for %%obj%%.
*/
static from(e) {
- if (Ri.isFragment(e))
+ if (Oi.isFragment(e))
return e;
if (typeof e == "string")
try {
- return Ri.from(Ws(e));
+ return Oi.from($s(e));
} catch {
V(!1, "invalid event fragment", "obj", e);
}
- else if (e instanceof ri) {
- const t = rh("event", e), n = hs(e, !0), s = !!fs(e, Dn(["anonymous"])).has("anonymous");
- return Cr(e), new Ri(Ht, t, n, s);
+ 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);
}
- return new Ri(Ht, e.name, e.inputs ? e.inputs.map((t) => Ft.from(t, !0)) : [], !!e.anonymous);
+ return new Oi(Vt, e.name, e.inputs ? e.inputs.map((t) => Pt.from(t, !0)) : [], !!e.anonymous);
}
/**
* Returns ``true`` and provides a type guard if %%value%% is an
* **EventFragment**.
*/
static isFragment(e) {
- return e && e[Gn] === rm;
+ return e && e[Xn] === Um;
}
}
-class as extends Sr {
+class fs extends kr {
/**
* Whether the constructor can receive an endowment.
*/
@@ -41681,7 +44070,7 @@ class as extends Sr {
* @private
*/
constructor(e, t, n, s, r) {
- super(e, t, n), Object.defineProperty(this, Gn, { value: am }), Xe(this, { payable: s, gas: r });
+ super(e, t, n), Object.defineProperty(this, Xn, { value: Om }), Ye(this, { payable: s, gas: r });
}
/**
* Returns a string representation of this constructor as %%format%%.
@@ -41695,43 +44084,43 @@ class as extends Sr {
gas: this.gas != null ? this.gas : void 0,
inputs: this.inputs.map((n) => JSON.parse(n.format(e)))
});
- const t = [`constructor${qo(e, this.inputs)}`];
+ const t = [`constructor${oc(e, this.inputs)}`];
return this.payable && t.push("payable"), this.gas != null && t.push(`@${this.gas.toString()}`), t.join(" ");
}
/**
* Returns a new **ConstructorFragment** for %%obj%%.
*/
static from(e) {
- if (as.isFragment(e))
+ if (fs.isFragment(e))
return e;
if (typeof e == "string")
try {
- return as.from(Ws(e));
+ return fs.from($s(e));
} catch {
V(!1, "invalid constuctor fragment", "obj", e);
}
- else if (e instanceof ri) {
- fs(e, Dn(["constructor"]));
- const t = hs(e), n = !!fs(e, oD).has("payable"), s = Ox(e);
- return Cr(e), new as(Ht, "constructor", t, n, s);
+ 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);
}
- return new as(Ht, "constructor", e.inputs ? e.inputs.map(Ft.from) : [], !!e.payable, e.gas != null ? e.gas : null);
+ return new fs(Vt, "constructor", e.inputs ? e.inputs.map(Pt.from) : [], !!e.payable, e.gas != null ? e.gas : null);
}
/**
* Returns ``true`` and provides a type guard if %%value%% is a
* **ConstructorFragment**.
*/
static isFragment(e) {
- return e && e[Gn] === am;
+ return e && e[Xn] === Om;
}
}
-class Ji extends Sr {
+class is extends kr {
/**
* If the function can be sent value during invocation.
*/
payable;
constructor(e, t, n) {
- super(e, "fallback", t), Object.defineProperty(this, Gn, { value: om }), Xe(this, { payable: n });
+ super(e, "fallback", t), Object.defineProperty(this, Xn, { value: Qm }), Ye(this, { payable: n });
}
/**
* Returns a string representation of this fallback as %%format%%.
@@ -41748,34 +44137,34 @@ class Ji extends Sr {
* Returns a new **FallbackFragment** for %%obj%%.
*/
static from(e) {
- if (Ji.isFragment(e))
+ if (is.isFragment(e))
return e;
if (typeof e == "string")
try {
- return Ji.from(Ws(e));
+ return is.from($s(e));
} catch {
V(!1, "invalid fallback fragment", "obj", e);
}
- else if (e instanceof ri) {
- const t = e.toString(), n = e.peekKeyword(Dn(["fallback", "receive"]));
- if (V(n, "type must be fallback or receive", "obj", t), e.popKeyword(Dn(["fallback", "receive"])) === "receive") {
- const o = hs(e);
- return V(o.length === 0, "receive cannot have arguments", "obj.inputs", o), fs(e, Dn(["payable"])), Cr(e), new Ji(Ht, [], !0);
- }
- let r = hs(e);
- r.length ? V(r.length === 1 && r[0].type === "bytes", "invalid fallback inputs", "obj.inputs", r.map((o) => o.format("minimal")).join(", ")) : r = [Ft.from("bytes")];
- const a = Ux(e);
- if (V(a === "nonpayable" || a === "payable", "fallback cannot be constants", "obj.stateMutability", a), fs(e, Dn(["returns"])).has("returns")) {
- const o = hs(e);
+ else if (e instanceof pi) {
+ const t = e.toString(), n = e.peekKeyword(zn(["fallback", "receive"]));
+ if (V(n, "type must be fallback or receive", "obj", t), e.popKeyword(zn(["fallback", "receive"])) === "receive") {
+ 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);
+ }
+ 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 o = xs(e);
V(o.length === 1 && o[0].type === "bytes", "invalid fallback outputs", "obj.outputs", o.map((c) => c.format("minimal")).join(", "));
}
- return Cr(e), new Ji(Ht, r, a === "payable");
+ return Pr(e), new is(Vt, r, a === "payable");
}
if (e.type === "receive")
- return new Ji(Ht, [], !0);
+ return new is(Vt, [], !0);
if (e.type === "fallback") {
- const t = [Ft.from("bytes")], n = e.stateMutability === "payable";
- return new Ji(Ht, t, n);
+ const t = [Pt.from("bytes")], n = e.stateMutability === "payable";
+ return new is(Vt, t, n);
}
V(!1, "invalid fallback description", "obj", e);
}
@@ -41784,10 +44173,10 @@ class Ji extends Sr {
* **FallbackFragment**.
*/
static isFragment(e) {
- return e && e[Gn] === om;
+ return e && e[Xn] === Qm;
}
}
-class Ni extends ah {
+class Qi extends Rh {
/**
* If the function is constant (e.g. ``pure`` or ``view`` functions).
*/
@@ -41813,13 +44202,13 @@ class Ni extends ah {
* @private
*/
constructor(e, t, n, s, r, a) {
- super(e, "function", t, s), Object.defineProperty(this, Gn, { value: cm }), r = Object.freeze(r.slice()), Xe(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: Gm }), 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 vr(this.format("sighash")).substring(0, 10);
+ return Lr(this.format("sighash")).substring(0, 10);
}
/**
* Returns a string representation of this function as %%format%%.
@@ -41837,50 +44226,50 @@ class Ni extends ah {
outputs: this.outputs.map((n) => JSON.parse(n.format(e)))
});
const t = [];
- return e !== "sighash" && t.push("function"), t.push(this.name + qo(e, this.inputs)), e !== "sighash" && (this.stateMutability !== "nonpayable" && t.push(this.stateMutability), this.outputs && this.outputs.length && (t.push("returns"), t.push(qo(e, this.outputs))), this.gas != null && t.push(`@${this.gas.toString()}`)), t.join(" ");
+ 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 the selector for a function with %%name%% and %%params%%.
*/
static getSelector(e, t) {
- return t = (t || []).map((s) => Ft.from(s)), new Ni(Ht, e, "view", t, [], null).selector;
+ return t = (t || []).map((s) => Pt.from(s)), new Qi(Vt, e, "view", t, [], null).selector;
}
/**
* Returns a new **FunctionFragment** for %%obj%%.
*/
static from(e) {
- if (Ni.isFragment(e))
+ if (Qi.isFragment(e))
return e;
if (typeof e == "string")
try {
- return Ni.from(Ws(e));
+ return Qi.from($s(e));
} catch {
V(!1, "invalid function fragment", "obj", e);
}
- else if (e instanceof ri) {
- const n = rh("function", e), s = hs(e), r = Ux(e);
+ else if (e instanceof pi) {
+ const n = Th("function", e), s = xs(e), r = yE(e);
let a = [];
- fs(e, Dn(["returns"])).has("returns") && (a = hs(e));
- const o = Ox(e);
- return Cr(e), new Ni(Ht, n, r, s, a, o);
+ _s(e, zn(["returns"])).has("returns") && (a = xs(e));
+ const o = wE(e);
+ return Pr(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 Ni(Ht, e.name, t, e.inputs ? e.inputs.map(Ft.from) : [], e.outputs ? e.outputs.map(Ft.from) : [], e.gas != null ? e.gas : null);
+ return t == null && (t = "payable", typeof e.constant == "boolean" ? (t = "view", e.constant || (t = "payable", typeof e.payable == "boolean" && !e.payable && (t = "nonpayable"))) : typeof e.payable == "boolean" && !e.payable && (t = "nonpayable")), new 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);
}
/**
* Returns ``true`` and provides a type guard if %%value%% is a
* **FunctionFragment**.
*/
static isFragment(e) {
- return e && e[Gn] === cm;
+ return e && e[Xn] === Gm;
}
}
-class mr extends ah {
+class Cr extends Rh {
/**
* @private
*/
constructor(e, t, n) {
- super(e, "struct", t, n), Object.defineProperty(this, Gn, { value: lm });
+ super(e, "struct", t, n), Object.defineProperty(this, Xn, { value: Hm });
}
/**
* Returns a string representation of this struct as %%format%%.
@@ -41894,15 +44283,15 @@ class mr extends ah {
static from(e) {
if (typeof e == "string")
try {
- return mr.from(Ws(e));
+ return Cr.from($s(e));
} catch {
V(!1, "invalid struct fragment", "obj", e);
}
- else if (e instanceof ri) {
- const t = rh("struct", e), n = hs(e);
- return Cr(e), new mr(Ht, t, n);
+ else if (e instanceof pi) {
+ const t = Th("struct", e), n = xs(e);
+ return Pr(e), new Cr(Vt, t, n);
}
- return new mr(Ht, e.name, e.inputs ? e.inputs.map(Ft.from) : []);
+ return new Cr(Vt, e.name, e.inputs ? e.inputs.map(Pt.from) : []);
}
// @TODO: fix this return type
/**
@@ -41910,29 +44299,29 @@ class mr extends ah {
* **StructFragment**.
*/
static isFragment(e) {
- return e && e[Gn] === lm;
- }
-}
-const vi = /* @__PURE__ */ new Map();
-vi.set(0, "GENERIC_PANIC");
-vi.set(1, "ASSERT_FALSE");
-vi.set(17, "OVERFLOW");
-vi.set(18, "DIVIDE_BY_ZERO");
-vi.set(33, "ENUM_RANGE_ERROR");
-vi.set(34, "BAD_STORAGE_DATA");
-vi.set(49, "STACK_UNDERFLOW");
-vi.set(50, "ARRAY_RANGE_ERROR");
-vi.set(65, "OUT_OF_MEMORY");
-vi.set(81, "UNINITIALIZED_FUNCTION_CALL");
-const bD = new RegExp(/^bytes([0-9]*)$/), xD = new RegExp(/^(u?int)([0-9]*)$/);
-let Iu = null, hm = 1024;
-function ED(i, e, t, n) {
+ return e && e[Xn] === Hm;
+ }
+}
+const Fi = /* @__PURE__ */ new Map();
+Fi.set(0, "GENERIC_PANIC");
+Fi.set(1, "ASSERT_FALSE");
+Fi.set(17, "OVERFLOW");
+Fi.set(18, "DIVIDE_BY_ZERO");
+Fi.set(33, "ENUM_RANGE_ERROR");
+Fi.set(34, "BAD_STORAGE_DATA");
+Fi.set(49, "STACK_UNDERFLOW");
+Fi.set(50, "ARRAY_RANGE_ERROR");
+Fi.set(65, "OUT_OF_MEMORY");
+Fi.set(81, "UNINITIALIZED_FUNCTION_CALL");
+const OL = new RegExp(/^bytes([0-9]*)$/), QL = new RegExp(/^(u?int)([0-9]*)$/);
+let ed = null, zm = 1024;
+function GL(i, e, t, n) {
let s = "missing revert data", r = null;
const a = null;
let o = null;
if (t) {
s = "execution reverted";
- const l = ht(t);
+ const l = dt(t);
if (t = Se(t), l.length === 0)
s += " (no data present; likely require(false) occurred", r = "require(false)";
else if (l.length % 32 !== 4)
@@ -41954,7 +44343,7 @@ function ED(i, e, t, n) {
signature: "Panic(uint256)",
name: "Panic",
args: [h]
- }, r = `Panic due to ${vi.get(h) || "UNKNOWN"}(${h})`, s += `: ${r}`;
+ }, r = `Panic due to ${Fi.get(h) || "UNKNOWN"}(${h})`, s += `: ${r}`;
} catch {
s += " (could not decode panic code)";
}
@@ -41962,10 +44351,10 @@ function ED(i, e, t, n) {
s += " (unknown custom error)";
}
const c = {
- to: e.to ? St(e.to) : null,
+ to: e.to ? Mt(e.to) : null,
data: e.data || "0x"
};
- return e.from && (c.from = St(e.from)), Qt(s, "CALL_EXCEPTION", {
+ return e.from && (c.from = Mt(e.from)), Ht(s, "CALL_EXCEPTION", {
action: i,
data: t,
reason: r,
@@ -41974,32 +44363,32 @@ function ED(i, e, t, n) {
revert: o
});
}
-class Da {
+class Ha {
#e(e) {
if (e.isArray())
- return new kN(this.#e(e.arrayChildren), e.arrayLength, e.name);
+ return new sN(this.#e(e.arrayChildren), e.arrayLength, e.name);
if (e.isTuple())
- return new tl(e.components.map((n) => this.#e(n)), e.name);
+ return new xl(e.components.map((n) => this.#e(n)), e.name);
switch (e.baseType) {
case "address":
- return new LN(e.name);
+ return new nN(e.name);
case "bool":
- return new UN(e.name);
+ return new rN(e.name);
case "string":
- return new KN(e.name);
+ return new pN(e.name);
case "bytes":
- return new ON(e.name);
+ return new aN(e.name);
case "":
- return new HN(e.name);
+ return new lN(e.name);
}
- let t = e.type.match(xD);
+ let t = e.type.match(QL);
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 qN(n / 8, t[1] === "int", e.name);
+ 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);
}
- if (t = e.type.match(bD), t) {
+ if (t = e.type.match(OL), t) {
let n = parseInt(t[1]);
- return V(n !== 0 && n <= 32, "invalid bytes length", "param", e), new QN(n, e.name);
+ return V(n !== 0 && n <= 32, "invalid bytes length", "param", e), new oN(n, e.name);
}
V(!1, "invalid type", "type", e.type);
}
@@ -42010,8 +44399,8 @@ class Da {
* is by default ``false``.
*/
getDefaultValue(e) {
- const t = e.map((s) => this.#e(Ft.from(s)));
- return new tl(t, "_").defaultValue();
+ const t = e.map((s) => this.#e(Pt.from(s)));
+ return new xl(t, "_").defaultValue();
}
/**
* Encode the %%values%% as the %%types%% into ABI data.
@@ -42019,8 +44408,8 @@ class Da {
* @returns DataHexstring
*/
encode(e, t) {
- gb(t.length, e.length, "types/values length mismatch");
- const n = e.map((a) => this.#e(Ft.from(a))), s = new tl(n, "_"), r = new Ld();
+ 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();
return s.encode(r, t), r.data;
}
/**
@@ -42031,11 +44420,11 @@ class Da {
* padded event data emitted from ``external`` functions.
*/
decode(e, t, n) {
- const s = e.map((a) => this.#e(Ft.from(a)));
- return new tl(s, "_").decode(new Qf(t, n, hm));
+ const s = e.map((a) => this.#e(Pt.from(a)));
+ return new xl(s, "_").decode(new pp(t, n, zm));
}
static _setDefaultMaxInflation(e) {
- V(typeof e == "number" && Number.isInteger(e), "invalid defaultMaxInflation factor", "value", e), hm = e;
+ V(typeof e == "number" && Number.isInteger(e), "invalid defaultMaxInflation factor", "value", e), zm = e;
}
/**
* Returns the shared singleton instance of a default [[AbiCoder]].
@@ -42043,7 +44432,7 @@ class Da {
* On the first call, the instance is created internally.
*/
static defaultAbiCoder() {
- return Iu == null && (Iu = new Da()), Iu;
+ return ed == null && (ed = new Ha()), ed;
}
/**
* Returns an ethers-compatible [[CallExceptionError]] Error for the given
@@ -42051,10 +44440,10 @@ class Da {
* the Transaction %%tx%%.
*/
static getBuiltinCallException(e, t, n) {
- return ED(e, t, n, Da.defaultAbiCoder());
+ return GL(e, t, n, Ha.defaultAbiCoder());
}
}
-class _D {
+class HL {
/**
* The matching fragment for the ``topic0``.
*/
@@ -42080,7 +44469,7 @@ class _D {
*/
constructor(e, t, n) {
const s = e.name, r = e.format();
- Xe(this, {
+ Ye(this, {
fragment: e,
name: s,
signature: r,
@@ -42089,7 +44478,7 @@ class _D {
});
}
}
-class yD {
+class zL {
/**
* The matching fragment from the transaction ``data``.
*/
@@ -42119,7 +44508,7 @@ class yD {
*/
constructor(e, t, n, s) {
const r = e.name, a = e.format();
- Xe(this, {
+ Ye(this, {
fragment: e,
name: r,
args: n,
@@ -42129,7 +44518,7 @@ class yD {
});
}
}
-class wD {
+class VL {
/**
* The matching fragment.
*/
@@ -42155,7 +44544,7 @@ class wD {
*/
constructor(e, t, n) {
const s = e.name, r = e.format();
- Xe(this, {
+ Ye(this, {
fragment: e,
name: s,
args: n,
@@ -42164,7 +44553,7 @@ class wD {
});
}
}
-class um {
+class Vm {
/**
* The ``keccak256`` of the value logged.
*/
@@ -42185,10 +44574,10 @@ class um {
* @_ignore:
*/
constructor(e) {
- Xe(this, { hash: e, _isIndexed: !0 });
+ Ye(this, { hash: e, _isIndexed: !0 });
}
}
-const dm = {
+const Wm = {
0: "generic panic",
1: "assert(false)",
17: "arithmetic overflow",
@@ -42199,7 +44588,7 @@ const dm = {
50: "out-of-bounds access of an array or bytesN",
65: "out of memory",
81: "uninitialized function"
-}, fm = {
+}, qm = {
"0x08c379a0": {
signature: "Error(string)",
name: "Error",
@@ -42212,11 +44601,11 @@ const dm = {
inputs: ["uint256"],
reason: (i) => {
let e = "unknown panic code";
- return i >= 0 && i <= 255 && dm[i.toString()] && (e = dm[i.toString()]), `reverted with panic code 0x${i.toString(16)} (${e})`;
+ return i >= 0 && i <= 255 && Wm[i.toString()] && (e = Wm[i.toString()]), `reverted with panic code 0x${i.toString(16)} (${e})`;
}
}
};
-class lr {
+class mr {
/**
* All the Contract ABI members (i.e. methods, events, errors, etc).
*/
@@ -42247,11 +44636,11 @@ class lr {
const n = [];
for (const a of t)
try {
- n.push(Sr.from(a));
+ n.push(kr.from(a));
} catch (o) {
console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, o.message);
}
- Xe(this, {
+ Ye(this, {
fragments: Object.freeze(n)
});
let s = null, r = !1;
@@ -42263,7 +44652,7 @@ class lr {
console.log("duplicate definition - constructor");
return;
}
- Xe(this, { deploy: a });
+ 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);
@@ -42282,9 +44671,9 @@ class lr {
}
const l = a.format();
c.has(l) || c.set(l, a);
- }), this.deploy || Xe(this, {
- deploy: as.from("constructor()")
- }), Xe(this, { fallback: s, receive: r });
+ }), this.deploy || Ye(this, {
+ deploy: fs.from("constructor()")
+ }), Ye(this, { fallback: s, receive: r });
}
/**
* Returns the entire Human-Readable ABI, as an array of
@@ -42308,11 +44697,11 @@ class lr {
* data.
*/
getAbiCoder() {
- return Da.defaultAbiCoder();
+ return Ha.defaultAbiCoder();
}
// Find a function definition by any means necessary (unless it is ambiguous)
#s(e, t, n) {
- if (Lt(e)) {
+ if (Ut(e)) {
const r = e.toLowerCase();
for (const a of this.#n.values())
if (r === a.selector)
@@ -42329,7 +44718,7 @@ class lr {
if (t) {
const a = t.length > 0 ? t[t.length - 1] : null;
let o = t.length, c = !0;
- Wt.isTyped(a) && a.type === "overrides" && (c = !1, o--);
+ 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);
@@ -42337,7 +44726,7 @@ class lr {
for (let l = r.length - 1; l >= 0; l--) {
const h = r[l].inputs;
for (let u = 0; u < t.length; u++)
- if (Wt.isTyped(t[u])) {
+ if (jt.isTyped(t[u])) {
if (u >= h.length) {
if (t[u].type === "overrides")
continue;
@@ -42363,7 +44752,7 @@ class lr {
}
return r[0];
}
- const s = this.#n.get(Ni.from(e).format());
+ const s = this.#n.get(Qi.from(e).format());
return s || null;
}
/**
@@ -42410,7 +44799,7 @@ class lr {
}
// Find an event definition by any means necessary (unless it is ambiguous)
#a(e, t, n) {
- if (Lt(e)) {
+ if (Ut(e)) {
const r = e.toLowerCase();
for (const a of this.#t.values())
if (r === a.topicHash)
@@ -42430,7 +44819,7 @@ class lr {
for (let a = r.length - 1; a >= 0; a--) {
const o = r[a].inputs;
for (let c = 0; c < t.length; c++)
- if (Wt.isTyped(t[c]) && t[c].type !== o[c].baseType) {
+ if (jt.isTyped(t[c]) && t[c].type !== o[c].baseType) {
r.splice(a, 1);
break;
}
@@ -42444,7 +44833,7 @@ class lr {
}
return r[0];
}
- const s = this.#t.get(Ri.from(e).format());
+ const s = this.#t.get(Oi.from(e).format());
return s || null;
}
/**
@@ -42500,10 +44889,10 @@ class lr {
* the ABI, this will throw.
*/
getError(e, t) {
- if (Lt(e)) {
+ if (Ut(e)) {
const s = e.toLowerCase();
- if (fm[s])
- return Qn.from(fm[s].signature);
+ if (qm[s])
+ return jn.from(qm[s].signature);
for (const r of this.#e.values())
if (s === r.selector)
return r;
@@ -42517,17 +44906,17 @@ class lr {
/* fix:) */
)[0] === e && s.push(a);
if (s.length === 0)
- return e === "Error" ? Qn.from("error Error(string)") : e === "Panic" ? Qn.from("error Panic(uint256)") : null;
+ return e === "Error" ? jn.from("error Error(string)") : e === "Panic" ? jn.from("error Panic(uint256)") : null;
if (s.length > 1) {
const r = s.map((a) => JSON.stringify(a.format())).join(", ");
V(!1, `ambiguous error description (i.e. ${r})`, "name", e);
}
return s[0];
}
- if (e = Qn.from(e).format(), e === "Error(string)")
- return Qn.from("error Error(string)");
+ if (e = jn.from(e).format(), e === "Error(string)")
+ return jn.from("error Error(string)");
if (e === "Panic(uint256)")
- return Qn.from("error Panic(uint256)");
+ return jn.from("error Panic(uint256)");
const n = this.#e.get(e);
return n || null;
}
@@ -42597,7 +44986,7 @@ class lr {
const n = this.getError(e);
V(n, "unknown error", "fragment", e), e = n;
}
- return V(Vt(t, 0, 4) === e.selector, `data signature does not match error ${e.name}.`, "data", t), this._decodeParams(e.inputs, Vt(t, 4));
+ 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));
}
/**
* Encodes the transaction revert data for a call result that
@@ -42612,7 +45001,7 @@ class lr {
const n = this.getError(e);
V(n, "unknown error", "fragment", e), e = n;
}
- return Ot([
+ return Gt([
e.selector,
this._encodeParams(e.inputs, t || [])
]);
@@ -42630,7 +45019,7 @@ class lr {
const n = this.getFunction(e);
V(n, "unknown function", "fragment", e), e = n;
}
- return V(Vt(t, 0, 4) === e.selector, `data signature does not match function ${e.name}.`, "data", t), this._decodeParams(e.inputs, Vt(t, 4));
+ 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));
}
/**
* Encodes the ``tx.data`` for a transaction that calls the function
@@ -42642,7 +45031,7 @@ class lr {
const n = this.getFunction(e);
V(n, "unknown function", "fragment", e), e = n;
}
- return Ot([
+ return Gt([
e.selector,
this._encodeParams(e.inputs, t || [])
]);
@@ -42662,7 +45051,7 @@ class lr {
V(r, "unknown function", "fragment", e), e = r;
}
let n = "invalid length for result data";
- const s = Tn(t);
+ const s = On(t);
if (s.length % 32 === 0)
try {
return this.#i.decode(e.outputs, s);
@@ -42675,7 +45064,7 @@ class lr {
});
}
makeError(e, t) {
- const n = ht(e, "data"), s = Da.getBuiltinCallException("call", t, n);
+ const n = dt(e, "data"), s = Ha.getBuiltinCallException("call", t, n);
if (s.message.startsWith("execution reverted (unknown custom error)")) {
const o = Se(n.slice(0, 4)), c = this.getError(o);
if (c)
@@ -42751,7 +45140,7 @@ class lr {
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" ? vr(a) : r.type === "bytes" ? Zt(Se(a)) : (r.type === "bool" && typeof a == "boolean" ? a = a ? "0x01" : "0x00" : r.type.match(/^u?int/) ? a = Gs(a) : r.type.match(/^bytes/) ? a = WT(a, 32) : r.type === "address" && this.#i.encode(["address"], [a]), ds(Se(a), 32));
+ 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));
for (t.forEach((r, a) => {
const o = e.inputs[a];
if (!o.indexed) {
@@ -42773,9 +45162,9 @@ class lr {
const c = t[o];
if (a.indexed)
if (a.type === "string")
- n.push(vr(c));
+ n.push(Lr(c));
else if (a.type === "bytes")
- n.push(Zt(c));
+ n.push(sn(c));
else {
if (a.baseType === "tuple" || a.baseType === "array")
throw new Error("not implemented");
@@ -42796,35 +45185,35 @@ class lr {
}
if (n != null && !e.anonymous) {
const f = e.topicHash;
- V(Lt(n[0], 32) && n[0].toLowerCase() === f, "fragment/topic mismatch", "topics[0]", n[0]), n = n.slice(1);
+ V(Ut(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, m) => {
- f.indexed ? f.type === "string" || f.type === "bytes" || f.baseType === "tuple" || f.baseType === "array" ? (s.push(Ft.from({ type: "bytes32", name: f.name })), a.push(!0)) : (s.push(f), a.push(!1)) : (r.push(f), a.push(!1));
+ 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, Ot(n)) : null, c = this.#i.decode(r, t, !0), l = [], h = [];
+ 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, m) => {
- let g = null;
+ return e.inputs.forEach((f, p) => {
+ let m = null;
if (f.indexed)
if (o == null)
- g = new um(null);
- else if (a[m])
- g = new um(o[d++]);
+ m = new Vm(null);
+ else if (a[p])
+ m = new Vm(o[d++]);
else
try {
- g = o[d++];
- } catch (A) {
- g = A;
+ m = o[d++];
+ } catch (g) {
+ m = g;
}
else
try {
- g = c[u++];
- } catch (A) {
- g = A;
+ m = c[u++];
+ } catch (g) {
+ m = g;
}
- l.push(g), h.push(f.name || null);
- }), rs.fromItems(l, h);
+ l.push(m), h.push(f.name || null);
+ }), ds.fromItems(l, h);
}
/**
* Parses a transaction, finding the matching function and extracts
@@ -42833,11 +45222,11 @@ class lr {
* If the matching function cannot be found, return null.
*/
parseTransaction(e) {
- const t = ht(e.data, "tx.data"), n = Fe(e.value != null ? e.value : 0, "tx.value"), s = this.getFunction(Se(t.slice(0, 4)));
+ 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)));
if (!s)
return null;
const r = this.#i.decode(s.inputs, t.slice(4));
- return new yD(s, s.selector, r, n);
+ return new zL(s, s.selector, r, n);
}
parseCallResult(e) {
throw new Error("@TODO");
@@ -42850,7 +45239,7 @@ class lr {
*/
parseLog(e) {
const t = this.getEvent(e.topics[0]);
- return !t || t.anonymous ? null : new _D(t, t.topicHash, this.decodeEventLog(t, e.data, e.topics));
+ return !t || t.anonymous ? null : new HL(t, t.topicHash, this.decodeEventLog(t, e.data, e.topics));
}
/**
* Parses a revert data, finding the matching error and extracts
@@ -42859,11 +45248,11 @@ class lr {
* If the matching error cannot be found, returns null.
*/
parseError(e) {
- const t = Se(e), n = this.getError(Vt(t, 0, 4));
+ const t = Se(e), n = this.getError(Kt(t, 0, 4));
if (!n)
return null;
- const s = this.#i.decode(n.inputs, Vt(t, 4));
- return new wD(n, n.selector, s);
+ const s = this.#i.decode(n.inputs, Kt(t, 4));
+ return new VL(n, n.selector, s);
}
/**
* Creates a new [[Interface]] from the ABI %%value%%.
@@ -42872,17 +45261,17 @@ class lr {
* a JSON-encoded ABI or any Human-Readable ABI format.
*/
static from(e) {
- return e instanceof lr ? e : typeof e == "string" ? new lr(JSON.parse(e)) : typeof e.formatJson == "function" ? new lr(e.formatJson()) : typeof e.format == "function" ? new lr(e.format("json")) : new lr(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);
}
}
-const Qx = BigInt(0);
-function ba(i) {
+const vE = BigInt(0);
+function Ba(i) {
return i ?? null;
}
-function jt(i) {
+function $t(i) {
return i == null ? null : i.toString();
}
-class pm {
+class Km {
/**
* The gas price for legacy networks.
*/
@@ -42915,10 +45304,10 @@ class pm {
* %%maxPriorityFeePerGas%%.
*/
constructor(e, t, n) {
- Xe(this, {
- gasPrice: ba(e),
- maxFeePerGas: ba(t),
- maxPriorityFeePerGas: ba(n)
+ Ye(this, {
+ gasPrice: Ba(e),
+ maxFeePerGas: Ba(t),
+ maxPriorityFeePerGas: Ba(n)
});
}
/**
@@ -42928,24 +45317,24 @@ class pm {
const { gasPrice: e, maxFeePerGas: t, maxPriorityFeePerGas: n } = this;
return {
_type: "FeeData",
- gasPrice: jt(e),
- maxFeePerGas: jt(t),
- maxPriorityFeePerGas: jt(n)
+ gasPrice: $t(e),
+ maxFeePerGas: $t(t),
+ maxPriorityFeePerGas: $t(n)
};
}
}
-function Ol(i) {
+function ah(i) {
const e = {};
i.to && (e.to = i.to), i.from && (e.from = i.from), i.data && (e.data = Se(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] = Fe(i[s], `request.${s}`));
+ !(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] = ut(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) => Uf(s) ? Se(s) : Object.assign({}, s))), e;
+ !(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;
}
-class vD {
+class WL {
/**
* The provider connected to the block used to fetch additional details
* if necessary.
@@ -43051,9 +45440,9 @@ class vD {
* low-level library.
*/
constructor(e, t) {
- this.#e = e.transactions.map((n) => typeof n != "string" ? new ic(n, t) : n), Xe(this, {
+ this.#e = e.transactions.map((n) => typeof n != "string" ? new mc(n, t) : n), Ye(this, {
provider: t,
- hash: ba(e.hash),
+ hash: Ba(e.hash),
number: e.number,
timestamp: e.timestamp,
parentHash: e.parentHash,
@@ -43065,9 +45454,9 @@ class vD {
blobGasUsed: e.blobGasUsed,
excessBlobGas: e.excessBlobGas,
miner: e.miner,
- prevRandao: ba(e.prevRandao),
+ prevRandao: Ba(e.prevRandao),
extraData: e.extraData,
- baseFeePerGas: ba(e.baseFeePerGas),
+ baseFeePerGas: Ba(e.baseFeePerGas),
stateRoot: e.stateRoot,
receiptsRoot: e.receiptsRoot
});
@@ -43097,27 +45486,27 @@ class vD {
* Returns a JSON-friendly value.
*/
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: m, timestamp: g, transactions: A } = this;
+ 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: jt(e),
- difficulty: jt(t),
+ baseFeePerGas: $t(e),
+ difficulty: $t(t),
extraData: n,
- gasLimit: jt(s),
- gasUsed: jt(r),
- blobGasUsed: jt(this.blobGasUsed),
- excessBlobGas: jt(this.excessBlobGas),
+ gasLimit: $t(s),
+ gasUsed: $t(r),
+ blobGasUsed: $t(this.blobGasUsed),
+ excessBlobGas: $t(this.excessBlobGas),
hash: a,
miner: o,
prevRandao: c,
nonce: l,
number: h,
parentHash: u,
- timestamp: g,
+ timestamp: m,
parentBeaconBlockRoot: d,
stateRoot: f,
- receiptsRoot: m,
- transactions: A
+ receiptsRoot: p,
+ transactions: g
};
}
[Symbol.iterator]() {
@@ -43203,10 +45592,10 @@ class vD {
orphanedEvent() {
if (!this.isMined())
throw new Error("");
- return CD(this);
+ return qL(this);
}
}
-class nc {
+class gc {
/**
* The provider connected to the log used to fetch additional details
* if necessary.
@@ -43267,7 +45656,7 @@ class nc {
constructor(e, t) {
this.provider = t;
const n = Object.freeze(e.topics.slice());
- Xe(this, {
+ Ye(this, {
transactionHash: e.transactionHash,
blockHash: e.blockHash,
blockNumber: e.blockNumber,
@@ -43323,10 +45712,10 @@ class nc {
* @_ignore:
*/
removedEvent() {
- return SD(this);
+ return KL(this);
}
}
-class Gx {
+class CE {
/**
* The provider connected to the log used to fetch additional details
* if necessary.
@@ -43427,9 +45816,9 @@ class Gx {
* @_ignore:
*/
constructor(e, t) {
- this.#e = Object.freeze(e.logs.map((s) => new nc(s, t)));
- let n = Qx;
- e.effectiveGasPrice != null ? n = e.effectiveGasPrice : e.gasPrice != null && (n = e.gasPrice), Xe(this, {
+ this.#e = Object.freeze(e.logs.map((s) => new gc(s, t)));
+ let n = vE;
+ e.effectiveGasPrice != null ? n = e.effectiveGasPrice : e.gasPrice != null && (n = e.gasPrice), Ye(this, {
provider: t,
to: e.to,
from: e.from,
@@ -43480,12 +45869,12 @@ class Gx {
blockNumber: o,
//byzantium,
contractAddress: n,
- cumulativeGasUsed: jt(this.cumulativeGasUsed),
+ cumulativeGasUsed: $t(this.cumulativeGasUsed),
from: t,
- gasPrice: jt(this.gasPrice),
- blobGasUsed: jt(this.blobGasUsed),
- blobGasPrice: jt(this.blobGasPrice),
- gasUsed: jt(this.gasUsed),
+ gasPrice: $t(this.gasPrice),
+ blobGasUsed: $t(this.blobGasUsed),
+ blobGasPrice: $t(this.blobGasPrice),
+ gasUsed: $t(this.gasUsed),
hash: s,
index: r,
logs: l,
@@ -43550,16 +45939,16 @@ class Gx {
* @_ignore:
*/
removedEvent() {
- return zx(this);
+ return IE(this);
}
/**
* @_ignore:
*/
reorderedEvent(e) {
- return ge(!e || e.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }), Hx(this, e);
+ return ge(!e || e.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }), SE(this, e);
}
}
-class ic {
+class mc {
/**
* The provider this is connected to, which will influence how its
* methods will resolve its async inspection methods.
@@ -43696,21 +46085,21 @@ class ic {
blockNumber: e,
blockHash: t,
blobVersionedHashes: d,
- chainId: jt(this.chainId),
+ chainId: $t(this.chainId),
data: l,
from: o,
- gasLimit: jt(this.gasLimit),
- gasPrice: jt(this.gasPrice),
+ gasLimit: $t(this.gasLimit),
+ gasPrice: $t(this.gasPrice),
hash: s,
- maxFeePerGas: jt(this.maxFeePerGas),
- maxPriorityFeePerGas: jt(this.maxPriorityFeePerGas),
- maxFeePerBlobGas: jt(this.maxFeePerBlobGas),
+ maxFeePerGas: $t(this.maxFeePerGas),
+ maxPriorityFeePerGas: $t(this.maxPriorityFeePerGas),
+ maxFeePerBlobGas: $t(this.maxFeePerBlobGas),
nonce: c,
signature: h,
to: a,
index: n,
type: r,
- value: jt(this.value)
+ value: $t(this.value)
};
}
/**
@@ -43744,7 +46133,7 @@ class ic {
*/
async confirmations() {
if (this.blockNumber == null) {
- const { tx: t, blockNumber: n } = await Bn({
+ const { tx: t, blockNumber: n } = await Un({
tx: this.getTransaction(),
blockNumber: this.provider.getBlockNumber()
});
@@ -43767,7 +46156,7 @@ class ic {
const c = async () => {
if (o)
return null;
- const { blockNumber: d, nonce: f } = await Bn({
+ const { blockNumber: d, nonce: f } = await Un({
blockNumber: this.provider.getBlockNumber(),
nonce: this.provider.getTransactionCount(this.from)
});
@@ -43777,31 +46166,31 @@ class ic {
}
if (o)
return null;
- const m = await this.getTransaction();
- if (!(m && m.blockNumber != 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 g = await this.provider.getBlock(a, !0);
- if (g == null)
+ const m = await this.provider.getBlock(a, !0);
+ if (m == null)
return;
- for (const A of g)
- if (A === this.hash)
+ for (const g of m)
+ if (g === this.hash)
return;
- for (let A = 0; A < g.length; A++) {
- const p = await g.getTransaction(A);
- if (p.from === this.from && p.nonce === this.nonce) {
+ 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 y = await this.provider.getTransactionReceipt(p.hash);
+ const y = await this.provider.getTransactionReceipt(A.hash);
if (y == null || d - y.blockNumber + 1 < n)
return;
- let b = "replaced";
- p.data === this.data && p.to === this.to && p.value === this.value ? b = "repriced" : p.data === "0x" && p.from === p.to && p.value === Qx && (b = "cancelled"), ge(!1, "transaction was replaced", "TRANSACTION_REPLACED", {
- cancelled: b === "replaced" || b === "cancelled",
- reason: b,
- replacement: p.replaceableTransaction(r),
- hash: p.hash,
+ 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", {
+ cancelled: x === "replaced" || x === "cancelled",
+ reason: x,
+ replacement: A.replaceableTransaction(r),
+ hash: A.hash,
receipt: y
});
}
@@ -43834,46 +46223,46 @@ class ic {
} else if (await c(), n === 0)
return null;
return await new Promise((d, f) => {
- const m = [], g = () => {
- m.forEach((p) => p());
+ const p = [], m = () => {
+ p.forEach((A) => A());
};
- if (m.push(() => {
+ if (p.push(() => {
o = !0;
}), s > 0) {
- const p = setTimeout(() => {
- g(), f(Qt("wait for transaction timeout", "TIMEOUT"));
+ const A = setTimeout(() => {
+ m(), f(Ht("wait for transaction timeout", "TIMEOUT"));
}, s);
- m.push(() => {
- clearTimeout(p);
+ p.push(() => {
+ clearTimeout(A);
});
}
- const A = async (p) => {
- if (await p.confirmations() >= n) {
- g();
+ const g = async (A) => {
+ if (await A.confirmations() >= n) {
+ m();
try {
- d(l(p));
+ d(l(A));
} catch (y) {
f(y);
}
}
};
- if (m.push(() => {
- this.provider.off(this.hash, A);
- }), this.provider.on(this.hash, A), r >= 0) {
- const p = async () => {
+ if (p.push(() => {
+ this.provider.off(this.hash, g);
+ }), this.provider.on(this.hash, g), r >= 0) {
+ const A = async () => {
try {
await c();
} catch (y) {
- if (En(y, "TRANSACTION_REPLACED")) {
- g(), f(y);
+ if (Mn(y, "TRANSACTION_REPLACED")) {
+ m(), f(y);
return;
}
}
- o || this.provider.once("block", p);
+ o || this.provider.once("block", A);
};
- m.push(() => {
- this.provider.off("block", p);
- }), this.provider.once("block", p);
+ p.push(() => {
+ this.provider.off("block", A);
+ }), this.provider.once("block", A);
}
});
}
@@ -43933,14 +46322,14 @@ class ic {
* that evict this transaction.
*/
removedEvent() {
- return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), zx(this);
+ return ge(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }), IE(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()" }), Hx(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()" }), SE(this, e);
}
/**
* Returns a new TransactionResponse instance which has the ability to
@@ -43953,20 +46342,20 @@ class ic {
*/
replaceableTransaction(e) {
V(Number.isInteger(e) && e >= 0, "invalid startBlock", "startBlock", e);
- const t = new ic(this, this.provider);
+ const t = new mc(this, this.provider);
return t.#e = e, t;
}
}
-function CD(i) {
+function qL(i) {
return { orphan: "drop-block", hash: i.hash, number: i.number };
}
-function Hx(i, e) {
+function SE(i, e) {
return { orphan: "reorder-transaction", tx: i, other: e };
}
-function zx(i) {
+function IE(i) {
return { orphan: "drop-transaction", tx: i };
}
-function SD(i) {
+function KL(i) {
return { orphan: "drop-log", log: {
transactionHash: i.transactionHash,
blockHash: i.blockHash,
@@ -43977,7 +46366,7 @@ function SD(i) {
index: i.index
} };
}
-class $f extends nc {
+class Ip extends gc {
/**
* The Contract Interface.
*/
@@ -43996,7 +46385,7 @@ class $f extends nc {
constructor(e, t, n) {
super(e, e.provider);
const s = t.decodeEventLog(n, e.data, e.topics);
- Xe(this, { args: s, fragment: n, interface: t });
+ Ye(this, { args: s, fragment: n, interface: t });
}
/**
* The name of the event.
@@ -44011,7 +46400,7 @@ class $f extends nc {
return this.fragment.format();
}
}
-class Vx extends nc {
+class ME extends gc {
/**
* The error encounted when trying to decode the log.
*/
@@ -44020,10 +46409,10 @@ class Vx extends nc {
* @_ignore:
*/
constructor(e, t) {
- super(e, e.provider), Xe(this, { error: t });
+ super(e, e.provider), Ye(this, { error: t });
}
}
-class ID extends Gx {
+class jL extends CE {
#e;
/**
* @_ignore:
@@ -44040,15 +46429,15 @@ class ID extends Gx {
const t = e.topics.length ? this.#e.getEvent(e.topics[0]) : null;
if (t)
try {
- return new $f(e, this.#e, t);
+ return new Ip(e, this.#e, t);
} catch (n) {
- return new Vx(e, n);
+ return new ME(e, n);
}
return e;
});
}
}
-class ep extends ic {
+class Mp extends mc {
#e;
/**
* @_ignore:
@@ -44067,10 +46456,10 @@ class ep extends ic {
*/
async wait(e, t) {
const n = await super.wait(e, t);
- return n == null ? null : new ID(this.#e, this.provider, n);
+ return n == null ? null : new jL(this.#e, this.provider, n);
}
}
-class Wx extends Eb {
+class BE extends sb {
/**
* The log with no matching events.
*/
@@ -44079,7 +46468,7 @@ class Wx extends Eb {
* @_event:
*/
constructor(e, t, n, s) {
- super(e, t, n), Xe(this, { log: s });
+ super(e, t, n), Ye(this, { log: s });
}
/**
* Resolves to the block the event occured in.
@@ -44100,14 +46489,14 @@ class Wx extends Eb {
return await this.log.getTransactionReceipt();
}
}
-class MD extends Wx {
+class XL extends BE {
/**
* @_ignore:
*/
constructor(e, t, n, s, r) {
- super(e, t, n, new $f(r, e.interface, s));
+ super(e, t, n, new Ip(r, e.interface, s));
const a = e.interface.decodeEventLog(s, this.log.data, this.log.topics);
- Xe(this, { args: a, fragment: s });
+ Ye(this, { args: a, fragment: s });
}
/**
* The event name.
@@ -44122,36 +46511,36 @@ class MD extends Wx {
return this.fragment.format();
}
}
-const Am = BigInt(0);
-function qx(i) {
+const jm = BigInt(0);
+function TE(i) {
return i && typeof i.call == "function";
}
-function Kx(i) {
+function RE(i) {
return i && typeof i.estimateGas == "function";
}
-function oh(i) {
+function Fh(i) {
return i && typeof i.resolveName == "function";
}
-function jx(i) {
+function FE(i) {
return i && typeof i.sendTransaction == "function";
}
-function Xx(i) {
+function DE(i) {
if (i != null) {
- if (oh(i))
+ if (Fh(i))
return i;
if (i.provider)
return i.provider;
}
}
-class BD {
+class YL {
#e;
fragment;
constructor(e, t, n) {
- if (Xe(this, { fragment: t }), t.inputs.length < n.length)
+ if (Ye(this, { fragment: t }), t.inputs.length < n.length)
throw new Error("too many arguments");
- const s = Ir(e.runner, "resolveName"), r = oh(s) ? s : null;
+ const s = Ur(e.runner, "resolveName"), r = Fh(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) => Fn(d, r))) : Fn(u, r) : u)));
+ const a = await Promise.all(t.inputs.map((o, c) => n[c] == null ? null : o.walkAsync(n[c], (h, u) => h === "address" ? Array.isArray(u) ? Promise.all(u.map((d) => Hn(d, r))) : Hn(u, r) : u)));
return e.interface.encodeFilterTopics(t, a);
})();
}
@@ -44159,49 +46548,49 @@ class BD {
return this.#e;
}
}
-function Ir(i, 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 Ar(i) {
+function yr(i) {
return i == null ? null : i.provider || null;
}
-async function Yx(i, e) {
- const t = Wt.dereference(i, "overrides");
+async function NE(i, e) {
+ const t = jt.dereference(i, "overrides");
V(typeof t == "object", "invalid overrides parameter", "overrides", i);
- const n = Ol(t);
+ const n = ah(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 TD(i, e, t) {
- const n = Ir(i, "resolveName"), s = oh(n) ? n : null;
- return await Promise.all(e.map((r, a) => r.walkAsync(t[a], (o, c) => (c = Wt.dereference(c, o), o === "address" ? Fn(c, s) : c))));
+async function JL(i, e, t) {
+ const n = Ur(i, "resolveName"), s = Fh(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 RD(i) {
+function ZL(i) {
const e = async function(a) {
- const o = await Yx(a, ["data"]);
- o.to = await i.getAddress(), o.from && (o.from = await Fn(o.from, Xx(i.runner)));
- const c = i.interface, l = Fe(o.value || Am, "overrides.value") === Am, h = (o.data || "0x") === "0x";
+ 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";
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 = Ir(i.runner, "call");
- ge(qx(o), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
+ const o = Ur(i.runner, "call");
+ ge(TE(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 kf(l) && l.data ? i.interface.makeError(l.data, c) : l;
+ throw up(l) && l.data ? i.interface.makeError(l.data, c) : l;
}
}, n = async function(a) {
const o = i.runner;
- ge(jx(o), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
- const c = await o.sendTransaction(await e(a)), l = Ar(i.runner);
- return new ep(i.interface, l, c);
+ 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);
}, s = async function(a) {
- const o = Ir(i.runner, "estimateGas");
- return ge(Kx(o), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await o.estimateGas(await e(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));
}, r = async (a) => await n(a);
- return Xe(r, {
+ return Ye(r, {
_contract: i,
estimateGas: s,
populateTransaction: e,
@@ -44209,7 +46598,7 @@ function RD(i) {
staticCall: t
}), r;
}
-function ND(i, e) {
+function $L(i, e) {
const t = function(...l) {
const h = i.interface.getFunction(e, l);
return ge(h, "no matching fragment", "UNSUPPORTED_OPERATION", {
@@ -44219,10 +46608,10 @@ function ND(i, e) {
}, n = async function(...l) {
const h = t(...l);
let u = {};
- if (h.inputs.length + 1 === l.length && (u = await Yx(l.pop()), u.from && (u.from = await Fn(u.from, Xx(i.runner)))), h.inputs.length !== l.length)
+ 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)
throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");
- const d = await TD(i.runner, h.inputs, l);
- return Object.assign({}, u, await Bn({
+ const d = await JL(i.runner, h.inputs, l);
+ return Object.assign({}, u, await Un({
to: i.getAddress(),
data: i.interface.encodeFunctionData(h, d)
}));
@@ -44231,26 +46620,26 @@ function ND(i, e) {
return h.length === 1 ? h[0] : h;
}, r = async function(...l) {
const h = i.runner;
- ge(jx(h), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
- const u = await h.sendTransaction(await n(...l)), d = Ar(i.runner);
- return new ep(i.interface, d, u);
+ 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);
}, a = async function(...l) {
- const h = Ir(i.runner, "estimateGas");
- return ge(Kx(h), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }), await h.estimateGas(await n(...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));
}, o = async function(...l) {
- const h = Ir(i.runner, "call");
- ge(qx(h), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
+ const h = Ur(i.runner, "call");
+ ge(TE(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 (m) {
- throw kf(m) && m.data ? i.interface.makeError(m.data, u) : m;
+ } catch (p) {
+ throw up(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 Xe(c, {
+ return Ye(c, {
name: i.interface.getFunctionName(e),
_contract: i,
_key: e,
@@ -44272,7 +46661,7 @@ function ND(i, e) {
}
}), c;
}
-function FD(i, e) {
+function e2(i, e) {
const t = function(...s) {
const r = i.interface.getEvent(e, s);
return ge(r, "no matching fragment", "UNSUPPORTED_OPERATION", {
@@ -44280,9 +46669,9 @@ function FD(i, e) {
info: { key: e, args: s }
}), r;
}, n = function(...s) {
- return new BD(i, t(...s), s);
+ return new YL(i, t(...s), s);
};
- return Xe(n, {
+ return Ye(n, {
name: i.interface.getEventName(e),
_contract: i,
_key: e,
@@ -44299,27 +46688,27 @@ function FD(i, e) {
}
}), n;
}
-const Ql = /* @__PURE__ */ Symbol.for("_ethersInternal_contract"), Jx = /* @__PURE__ */ new WeakMap();
-function DD(i, e) {
- Jx.set(i[Ql], e);
+const oh = /* @__PURE__ */ Symbol.for("_ethersInternal_contract"), LE = /* @__PURE__ */ new WeakMap();
+function t2(i, e) {
+ LE.set(i[oh], e);
}
-function Kn(i) {
- return Jx.get(i[Ql]);
+function ei(i) {
+ return LE.get(i[oh]);
}
-function LD(i) {
+function n2(i) {
return i && typeof i == "object" && "getTopicFilter" in i && typeof i.getTopicFilter == "function" && i.fragment;
}
-async function tp(i, e) {
+async function Bp(i, e) {
let t, n = null;
if (Array.isArray(e)) {
const r = function(a) {
- if (Lt(a, 32))
+ if (Ut(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" ? Lt(e, 32) ? t = [e] : (n = i.interface.getEvent(e), V(n, "unknown fragment", "event", e), t = [n.topicHash]) : LD(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]) : n2(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;
@@ -44332,28 +46721,28 @@ async function tp(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 Ao(i, e) {
- const { subs: t } = Kn(i);
- return t.get((await tp(i, e)).tag) || null;
+async function So(i, e) {
+ const { subs: t } = ei(i);
+ return t.get((await Bp(i, e)).tag) || null;
}
-async function gm(i, e, t) {
- const n = Ar(i.runner);
+async function Xm(i, e, t) {
+ const n = yr(i.runner);
ge(n, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation: e });
- const { fragment: s, tag: r, topics: a } = await tp(i, t), { addr: o, subs: c } = Kn(i);
+ const { fragment: s, tag: r, topics: a } = await Bp(i, t), { addr: o, subs: c } = ei(i);
let l = c.get(r);
if (!l) {
- const u = { address: o || i, topics: a }, d = (A) => {
- let p = s;
- if (p == null)
+ const u = { address: o || i, topics: a }, d = (g) => {
+ let A = s;
+ if (A == null)
try {
- p = i.interface.getEvent(A.topics[0]);
+ A = i.interface.getEvent(g.topics[0]);
} catch {
}
- if (p) {
- const y = p, b = s ? i.interface.decodeEventLog(s, A.data, A.topics) : [];
- Xd(i, t, b, (_) => new MD(i, _, t, y, A));
+ 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));
} else
- Xd(i, t, [], (y) => new Wx(i, y, t, A));
+ wf(i, t, [], (y) => new BE(i, y, t, g));
};
let f = [];
l = { tag: r, listeners: [], start: () => {
@@ -44361,16 +46750,16 @@ async function gm(i, e, t) {
}, stop: async () => {
if (f.length == 0)
return;
- let A = f;
- f = [], await Promise.all(A), n.off(u, d);
+ let g = f;
+ f = [], await Promise.all(g), n.off(u, d);
} }, c.set(r, l);
}
return l;
}
-let jd = Promise.resolve();
-async function PD(i, e, t, n) {
- await jd;
- const s = await Ao(i, e);
+let yf = Promise.resolve();
+async function i2(i, e, t, n) {
+ await yf;
+ const s = await So(i, e);
if (!s)
return !1;
const r = s.listeners.length;
@@ -44382,18 +46771,18 @@ async function PD(i, e, t, n) {
} catch {
}
return !o;
- }), s.listeners.length === 0 && (s.stop(), Kn(i).subs.delete(s.tag)), r > 0;
+ }), s.listeners.length === 0 && (s.stop(), ei(i).subs.delete(s.tag)), r > 0;
}
-async function Xd(i, e, t, n) {
+async function wf(i, e, t, n) {
try {
- await jd;
+ await yf;
} catch {
}
- const s = PD(i, e, t, n);
- return jd = s, await s;
+ const s = i2(i, e, t, n);
+ return yf = s, await s;
}
-const il = ["then"];
-class So {
+const El = ["then"];
+class ko {
/**
* The target to connect to.
*
@@ -44421,7 +46810,7 @@ class So {
/**
* @_ignore:
*/
- [Ql];
+ [oh];
/**
* The fallback or receive function if any.
*/
@@ -44432,66 +46821,66 @@ class So {
* of.
*/
constructor(e, t, n, s) {
- V(typeof e == "string" || ix(e), "invalid value for Contract target", "target", e), n == null && (n = null);
- const r = lr.from(t);
- Xe(this, { target: e, runner: n, interface: r }), Object.defineProperty(this, Ql, { value: {} });
+ 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: {} });
let a, o = null, c = null;
if (s) {
- const u = Ar(n);
- c = new ep(this.interface, u, s);
+ const u = yr(n);
+ c = new Mp(this.interface, u, s);
}
let l = /* @__PURE__ */ new Map();
if (typeof e == "string")
- if (Lt(e))
+ if (Ut(e))
o = e, a = Promise.resolve(e);
else {
- const u = Ir(n, "resolveName");
- if (!oh(u))
- throw Qt("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", {
+ const u = Ur(n, "resolveName");
+ if (!Fh(u))
+ throw Ht("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", {
+ throw Ht("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", {
value: e
});
- return Kn(this).addr = d, d;
+ return ei(this).addr = d, d;
});
}
else
a = e.getAddress().then((u) => {
if (u == null)
throw new Error("TODO");
- return Kn(this).addr = u, u;
+ return ei(this).addr = u, u;
});
- DD(this, { addrPromise: a, addr: o, deployTx: c, subs: l });
+ t2(this, { addrPromise: a, addr: o, deployTx: c, subs: l });
const h = new Proxy({}, {
get: (u, d, f) => {
- if (typeof d == "symbol" || il.indexOf(d) >= 0)
+ if (typeof d == "symbol" || El.indexOf(d) >= 0)
return Reflect.get(u, d, f);
try {
return this.getEvent(d);
- } catch (m) {
- if (!En(m, "INVALID_ARGUMENT") || m.argument !== "key")
- throw m;
+ } catch (p) {
+ if (!Mn(p, "INVALID_ARGUMENT") || p.argument !== "key")
+ throw p;
}
},
- has: (u, d) => il.indexOf(d) >= 0 ? Reflect.has(u, d) : Reflect.has(u, d) || this.interface.hasEvent(String(d))
+ has: (u, d) => El.indexOf(d) >= 0 ? Reflect.has(u, d) : Reflect.has(u, d) || this.interface.hasEvent(String(d))
});
- return Xe(this, { filters: h }), Xe(this, {
- fallback: r.receive || r.fallback ? RD(this) : null
+ return Ye(this, { filters: h }), Ye(this, {
+ fallback: r.receive || r.fallback ? ZL(this) : null
}), new Proxy(this, {
get: (u, d, f) => {
- if (typeof d == "symbol" || d in u || il.indexOf(d) >= 0)
+ if (typeof d == "symbol" || d in u || El.indexOf(d) >= 0)
return Reflect.get(u, d, f);
try {
return u.getFunction(d);
- } catch (m) {
- if (!En(m, "INVALID_ARGUMENT") || m.argument !== "key")
- throw m;
+ } catch (p) {
+ if (!Mn(p, "INVALID_ARGUMENT") || p.argument !== "key")
+ throw p;
}
},
- has: (u, d) => typeof d == "symbol" || d in u || il.indexOf(d) >= 0 ? Reflect.has(u, d) : u.interface.hasFunction(d)
+ has: (u, d) => typeof d == "symbol" || d in u || El.indexOf(d) >= 0 ? Reflect.has(u, d) : u.interface.hasFunction(d)
});
}
/**
@@ -44499,26 +46888,26 @@ class So {
* a different %%runner%%.
*/
connect(e) {
- return new So(this.target, this.interface, e);
+ return new ko(this.target, this.interface, e);
}
/**
* Return a new Contract instance with the same ABI and runner, but
* a different %%target%%.
*/
attach(e) {
- return new So(e, this.interface, this.runner);
+ return new ko(e, this.interface, this.runner);
}
/**
* Return the resolved address of this Contract.
*/
async getAddress() {
- return await Kn(this).addrPromise;
+ return await ei(this).addrPromise;
}
/**
* Return the deployed bytecode or null if no bytecode is found.
*/
async getDeployedCode() {
- const e = Ar(this.runner);
+ const e = yr(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;
@@ -44533,7 +46922,7 @@ class So {
return await e.wait(), this;
if (await this.getDeployedCode() != null)
return this;
- const n = Ar(this.runner);
+ const n = yr(this.runner);
return ge(n != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }), new Promise((s, r) => {
const a = async () => {
try {
@@ -44554,7 +46943,7 @@ class So {
* [[ContractFactory]].
*/
deploymentTransaction() {
- return Kn(this).deployTx;
+ return ei(this).deployTx;
}
/**
* Return the function for a given name. This is useful when a contract
@@ -44562,7 +46951,7 @@ class So {
* when using a Contract programmatically.
*/
getFunction(e) {
- return typeof e != "string" && (e = e.format()), ND(this, e);
+ return typeof e != "string" && (e = e.format()), $L(this, e);
}
/**
* Return the event for a given name. This is useful when a contract
@@ -44570,7 +46959,7 @@ class So {
* when using a Contract programmatically.
*/
getEvent(e) {
- return typeof e != "string" && (e = e.format()), FD(this, e);
+ return typeof e != "string" && (e = e.format()), e2(this, e);
}
/**
* @_ignore:
@@ -44600,7 +46989,7 @@ class So {
*/
async queryFilter(e, t, n) {
t == null && (t = 0), n == null && (n = "latest");
- const { addr: s, addrPromise: r } = Kn(this), a = s || await r, { fragment: o, topics: c } = await tp(this, e), l = { address: a, topics: c, fromBlock: t, toBlock: n }, h = Ar(this.runner);
+ 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);
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)
@@ -44610,18 +46999,18 @@ class So {
}
if (d)
try {
- return new $f(u, this.interface, d);
+ return new Ip(u, this.interface, d);
} catch (f) {
- return new Vx(u, f);
+ return new ME(u, f);
}
- return new nc(u, h);
+ return new gc(u, h);
});
}
/**
* Add an event %%listener%% for the %%event%%.
*/
async on(e, t) {
- const n = await gm(this, "on", e);
+ const n = await Xm(this, "on", e);
return n.listeners.push({ listener: t, once: !1 }), n.start(), this;
}
/**
@@ -44629,7 +47018,7 @@ class So {
* after it is fired once.
*/
async once(e, t) {
- const n = await gm(this, "once", e);
+ const n = await Xm(this, "once", e);
return n.listeners.push({ listener: t, once: !0 }), n.start(), this;
}
/**
@@ -44638,7 +47027,7 @@ class So {
* Resolves to ``true`` if any listeners were called.
*/
async emit(e, ...t) {
- return await Xd(this, e, t, null);
+ return await wf(this, e, t, null);
}
/**
* Resolves to the number of listeners of %%event%% or the total number
@@ -44646,10 +47035,10 @@ class So {
*/
async listenerCount(e) {
if (e) {
- const s = await Ao(this, e);
+ const s = await So(this, e);
return s ? s.listeners.length : 0;
}
- const { subs: t } = Kn(this);
+ const { subs: t } = ei(this);
let n = 0;
for (const { listeners: s } of t.values())
n += s.length;
@@ -44661,10 +47050,10 @@ class So {
*/
async listeners(e) {
if (e) {
- const s = await Ao(this, e);
+ const s = await So(this, e);
return s ? s.listeners.map(({ listener: r }) => r) : [];
}
- const { subs: t } = Kn(this);
+ const { subs: t } = ei(this);
let n = [];
for (const { listeners: s } of t.values())
n = n.concat(s.map(({ listener: r }) => r));
@@ -44675,14 +47064,14 @@ class So {
* all listeners if unspecified.
*/
async off(e, t) {
- const n = await Ao(this, e);
+ const n = await So(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(), Kn(this).subs.delete(n.tag)), this;
+ return (t == null || n.listeners.length === 0) && (n.stop(), ei(this).subs.delete(n.tag)), this;
}
/**
* Remove all the listeners for %%event%% or remove all listeners if
@@ -44690,12 +47079,12 @@ class So {
*/
async removeAllListeners(e) {
if (e) {
- const t = await Ao(this, e);
+ const t = await So(this, e);
if (!t)
return this;
- t.stop(), Kn(this).subs.delete(t.tag);
+ t.stop(), ei(this).subs.delete(t.tag);
} else {
- const { subs: t } = Kn(this);
+ const { subs: t } = ei(this);
for (const { tag: n, stop: s } of t.values())
s(), t.delete(n);
}
@@ -44717,7 +47106,7 @@ class So {
* Create a new Class for the %%abi%%.
*/
static buildClass(e) {
- class t extends So {
+ class t extends ko {
constructor(s, r = null) {
super(s, e, r);
}
@@ -44731,15 +47120,15 @@ class So {
return n == null && (n = null), new this(e, t, n);
}
}
-function kD() {
- return So;
+function s2() {
+ return ko;
}
-class xa extends kD() {
+class Ta extends s2() {
}
-function Mu(i) {
+function td(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 UD {
+class r2 {
/**
* The name.
*/
@@ -44748,7 +47137,7 @@ class UD {
* Creates a new **MulticoinProviderPluing** for %%name%%.
*/
constructor(e) {
- Xe(this, { name: e });
+ Ye(this, { name: e });
}
connect(e) {
return this;
@@ -44772,13 +47161,13 @@ class UD {
throw new Error("unsupported coin");
}
}
-const Zx = new RegExp("^(ipfs)://(.*)$", "i"), mm = [
+const PE = new RegExp("^(ipfs)://(.*)$", "i"), Ym = [
new RegExp("^(https)://(.*)$", "i"),
new RegExp("^(data):(.*)$", "i"),
- Zx,
+ PE,
new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i")
];
-class Ea {
+class Ra {
/**
* The connected provider.
*/
@@ -44795,7 +47184,7 @@ class Ea {
#e;
#t;
constructor(e, t, n) {
- Xe(this, { provider: e, address: t, name: n }), this.#e = null, this.#t = new xa(t, [
+ Ye(this, { provider: e, address: t, name: n }), this.#e = null, this.#t = new Ta(t, [
"function supportsInterface(bytes4) view returns (bool)",
"function resolve(bytes, bytes) view returns (bytes)",
"function addr(bytes32) view returns (address)",
@@ -44812,7 +47201,7 @@ class Ea {
try {
return await this.#t.supportsInterface("0x9061b923");
} catch (e) {
- if (En(e, "CALL_EXCEPTION"))
+ if (Mn(e, "CALL_EXCEPTION"))
return !1;
throw this.#e = null, e;
}
@@ -44821,12 +47210,12 @@ class Ea {
async #n(e, t) {
t = (t || []).slice();
const n = this.#t.interface;
- t.unshift(Kd(this.name));
+ t.unshift(_f(this.name));
let s = null;
await this.supportsWildcard() && (s = n.getFunction(e), ge(s, "missing fragment", "UNKNOWN_ERROR", {
info: { funcName: e }
}), t = [
- $F(this.name, 255),
+ EL(this.name, 255),
n.encodeFunctionData(s, t)
], e = "resolve(bytes,bytes)"), t.push({
enableCcipRead: !0
@@ -44835,7 +47224,7 @@ class Ea {
const r = await this.#t[e](...t);
return s ? n.decodeFunctionResult(s, r)[0] : r;
} catch (r) {
- if (!En(r, "CALL_EXCEPTION"))
+ if (!Mn(r, "CALL_EXCEPTION"))
throw r;
}
return null;
@@ -44848,21 +47237,21 @@ class Ea {
if (e == null && (e = 60), e === 60)
try {
const r = await this.#n("addr(bytes32)");
- return r == null || r === Go ? null : r;
+ return r == null || r === nc ? null : r;
} catch (r) {
- if (En(r, "CALL_EXCEPTION"))
+ if (Mn(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 (Lt(a, 20))
- return St(a);
+ if (Ut(a, 20))
+ return Mt(a);
}
let t = null;
for (const r of this.provider.plugins)
- if (r instanceof UD && r.supportsCoinType(e)) {
+ if (r instanceof r2 && r.supportsCoinType(e)) {
t = r;
break;
}
@@ -44898,7 +47287,7 @@ class Ea {
if (t) {
const s = t[1] === "e3010170" ? "ipfs" : "ipns", r = parseInt(t[4], 16);
if (t[5].length === r * 2)
- return `${s}://${jT("0x" + t[2])}`;
+ return `${s}://${AF("0x" + t[2])}`;
}
const n = e.match(/^0xe40101fa011b20([0-9a-f]*)$/);
if (n && n[1].length === 64)
@@ -44934,8 +47323,8 @@ class Ea {
if (t == null)
return e.push({ type: "!avatar", value: "" }), { url: null, linkage: e };
e.push({ type: "avatar", value: t });
- for (let n = 0; n < mm.length; n++) {
- const s = t.match(mm[n]);
+ for (let n = 0; n < Ym.length; n++) {
+ const s = t.match(Ym[n]);
if (s == null)
continue;
const r = s[1].toLowerCase();
@@ -44944,7 +47333,7 @@ class Ea {
case "data":
return e.push({ type: "url", value: t }), { linkage: e, url: t };
case "ipfs": {
- const a = Mu(t);
+ const a = td(t);
return e.push({ type: "ipfs", value: t }), e.push({ type: "url", value: a }), { linkage: e, url: a };
}
case "erc721":
@@ -44957,7 +47346,7 @@ class Ea {
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 xa(c[0], [
+ const l = c[1], h = new Ta(c[0], [
// ERC-721
"function tokenURI(uint) view returns (string)",
"function ownerOf(uint) view returns (address)",
@@ -44966,22 +47355,22 @@ class Ea {
"function balanceOf(address, uint256) view returns (uint)"
], this.provider);
if (r === "erc721") {
- const g = await h.ownerOf(l);
- if (o !== g)
- return e.push({ type: "!owner", value: g }), { url: null, linkage: e };
- e.push({ type: "owner", value: g });
+ 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 g = await h.balanceOf(o, l);
- if (!g)
+ 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: g.toString() });
+ 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}", Gs(l, 32).substring(2)), e.push({ type: "metadata-url-expanded", value: u })), u.match(/^ipfs:/i) && (u = Mu(u)), e.push({ type: "metadata-url", value: u });
+ 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 });
let d = {};
- const f = await new Li(u).send();
+ const f = await new Gi(u).send();
f.assertOk();
try {
d = f.bodyJson;
@@ -44989,23 +47378,23 @@ class Ea {
try {
e.push({ type: "!metadata", value: f.bodyText });
} catch {
- const p = f.body;
- return p && e.push({ type: "!metadata", value: Se(p) }), { url: null, linkage: e };
+ const A = f.body;
+ return A && e.push({ type: "!metadata", value: Se(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 m = d.image;
- if (typeof m != "string")
+ let p = d.image;
+ if (typeof p != "string")
return e.push({ type: "!imageUrl", value: "" }), { url: null, linkage: e };
- if (!m.match(/^(https:\/\/|data:)/i)) {
- if (m.match(Zx) == null)
- return e.push({ type: "!imageUrl-ipfs", value: m }), { url: null, linkage: e };
- e.push({ type: "imageUrl-ipfs", value: m }), m = Mu(m);
+ if (!p.match(/^(https:\/\/|data:)/i)) {
+ if (p.match(PE) == null)
+ return e.push({ type: "!imageUrl-ipfs", value: p }), { url: null, linkage: e };
+ e.push({ type: "imageUrl-ipfs", value: p }), p = td(p);
}
- return e.push({ type: "url", value: m }), { linkage: e, url: m };
+ return e.push({ type: "url", value: p }), { linkage: e, url: p };
}
}
}
@@ -45021,14 +47410,14 @@ class Ea {
}), n.address;
}
static async #i(e, t) {
- const n = await Ea.getEnsAddress(e);
+ const n = await Ra.getEnsAddress(e);
try {
- const r = await new xa(n, [
+ const r = await new Ta(n, [
"function resolver(bytes32) view returns (address)"
- ], e).resolver(Kd(t), {
+ ], e).resolver(_f(t), {
enableCcipRead: !0
});
- return r === Go ? null : r;
+ return r === nc ? null : r;
} catch (s) {
throw s;
}
@@ -45043,22 +47432,22 @@ class Ea {
for (; ; ) {
if (n === "" || n === "." || t !== "eth" && n === "eth")
return null;
- const s = await Ea.#i(e, n);
+ const s = await Ra.#i(e, n);
if (s != null) {
- const r = new Ea(e, s, t);
+ const r = new Ra(e, s, t);
return n !== t && !await r.supportsWildcard() ? null : r;
}
n = n.split(".").slice(1).join(".");
}
}
}
-const bm = BigInt(0);
-function gt(i, e) {
+const Jm = BigInt(0);
+function bt(i, e) {
return (function(t) {
return t == null ? e : i(t);
});
}
-function Ko(i, e) {
+function cc(i, e) {
return ((t) => {
if (e && t == null)
return null;
@@ -45067,7 +47456,7 @@ function Ko(i, e) {
return t.map((n) => i(n));
});
}
-function sc(i, e) {
+function xc(i, e) {
return ((t) => {
const n = {};
for (const s in i) {
@@ -45090,7 +47479,7 @@ function sc(i, e) {
return n;
});
}
-function OD(i) {
+function a2(i) {
switch (i) {
case !0:
case "true":
@@ -45101,106 +47490,106 @@ function OD(i) {
}
V(!1, `invalid boolean; ${JSON.stringify(i)}`, "value", i);
}
-function La(i) {
- return V(Lt(i, !0), "invalid data", "value", i), i;
-}
-function xn(i) {
- return V(Lt(i, 32), "invalid hash", "value", i), i;
-}
-const QD = sc({
- address: St,
- blockHash: xn,
- blockNumber: ut,
- data: La,
- index: ut,
- removed: gt(OD, !1),
- topics: Ko(xn),
- transactionHash: xn,
- transactionIndex: ut
+function za(i) {
+ return V(Ut(i, !0), "invalid data", "value", i), i;
+}
+function In(i) {
+ return V(Ut(i, 32), "invalid hash", "value", i), i;
+}
+const o2 = xc({
+ address: Mt,
+ blockHash: In,
+ blockNumber: ft,
+ data: za,
+ index: ft,
+ removed: bt(a2, !1),
+ topics: cc(In),
+ transactionHash: In,
+ transactionIndex: ft
}, {
index: ["logIndex"]
});
-function GD(i) {
- return QD(i);
-}
-const HD = sc({
- hash: gt(xn),
- parentHash: xn,
- parentBeaconBlockRoot: gt(xn, null),
- number: ut,
- timestamp: ut,
- nonce: gt(La),
- difficulty: Fe,
- gasLimit: Fe,
- gasUsed: Fe,
- stateRoot: gt(xn, null),
- receiptsRoot: gt(xn, null),
- blobGasUsed: gt(Fe, null),
- excessBlobGas: gt(Fe, null),
- miner: gt(St),
- prevRandao: gt(xn, null),
- extraData: La,
- baseFeePerGas: gt(Fe)
+function c2(i) {
+ return o2(i);
+}
+const l2 = xc({
+ hash: bt(In),
+ parentHash: In,
+ parentBeaconBlockRoot: bt(In, 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),
+ miner: bt(Mt),
+ prevRandao: bt(In, null),
+ extraData: za,
+ baseFeePerGas: bt(Ne)
}, {
prevRandao: ["mixHash"]
});
-function zD(i) {
- const e = HD(i);
- return e.transactions = i.transactions.map((t) => typeof t == "string" ? t : $x(t)), e;
-}
-const VD = sc({
- transactionIndex: ut,
- blockNumber: ut,
- transactionHash: xn,
- address: St,
- topics: Ko(xn),
- data: La,
- index: ut,
- blockHash: xn
+function h2(i) {
+ const e = l2(i);
+ return e.transactions = i.transactions.map((t) => typeof t == "string" ? t : kE(t)), e;
+}
+const u2 = xc({
+ transactionIndex: ft,
+ blockNumber: ft,
+ transactionHash: In,
+ address: Mt,
+ topics: cc(In),
+ data: za,
+ index: ft,
+ blockHash: In
}, {
index: ["logIndex"]
});
-function WD(i) {
- return VD(i);
+function d2(i) {
+ return u2(i);
}
-const qD = sc({
- to: gt(St, null),
- from: gt(St, null),
- contractAddress: gt(St, null),
+const f2 = xc({
+ to: bt(Mt, null),
+ from: bt(Mt, null),
+ contractAddress: bt(Mt, null),
// should be allowNull(hash), but broken-EIP-658 support is handled in receipt
- index: ut,
- root: gt(Se),
- gasUsed: Fe,
- blobGasUsed: gt(Fe, null),
- logsBloom: gt(La),
- blockHash: xn,
- hash: xn,
- logs: Ko(WD),
- blockNumber: ut,
+ index: ft,
+ root: bt(Se),
+ gasUsed: Ne,
+ blobGasUsed: bt(Ne, null),
+ logsBloom: bt(za),
+ blockHash: In,
+ hash: In,
+ logs: cc(d2),
+ blockNumber: ft,
//confirmations: allowNull(getNumber, null),
- cumulativeGasUsed: Fe,
- effectiveGasPrice: gt(Fe),
- blobGasPrice: gt(Fe, null),
- status: gt(ut),
- type: gt(ut, 0)
+ cumulativeGasUsed: Ne,
+ effectiveGasPrice: bt(Ne),
+ blobGasPrice: bt(Ne, null),
+ status: bt(ft),
+ type: bt(ft, 0)
}, {
effectiveGasPrice: ["gasPrice"],
hash: ["transactionHash"],
index: ["transactionIndex"]
});
-function KD(i) {
- return qD(i);
+function p2(i) {
+ return f2(i);
}
-function $x(i) {
- i.to && Fe(i.to) === bm && (i.to = "0x0000000000000000000000000000000000000000");
- const e = sc({
- hash: xn,
+function kE(i) {
+ i.to && Ne(i.to) === Jm && (i.to = "0x0000000000000000000000000000000000000000");
+ const e = xc({
+ hash: In,
// Some nodes do not return this, usually test nodes (like Ganache)
- index: gt(ut, void 0),
- type: (t) => t === "0x" || t == null ? 0 : ut(t),
- accessList: gt(Br, null),
- blobVersionedHashes: gt(Ko(xn, !0), null),
- authorizationList: gt(Ko((t) => {
+ 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) => {
let n;
if (t.signature)
n = t.signature;
@@ -45209,41 +47598,41 @@ function $x(i) {
s === "0x1b" ? s = 0 : s === "0x1c" && (s = 1), n = Object.assign({}, t, { yParity: s });
}
return {
- address: St(t.address),
- chainId: Fe(t.chainId),
- nonce: Fe(t.nonce),
- signature: Gt.from(n)
+ address: Mt(t.address),
+ chainId: Ne(t.chainId),
+ nonce: Ne(t.nonce),
+ signature: zt.from(n)
};
}, !1), null),
- blockHash: gt(xn, null),
- blockNumber: gt(ut, null),
- transactionIndex: gt(ut, null),
- from: St,
+ blockHash: bt(In, null),
+ blockNumber: bt(ft, null),
+ transactionIndex: bt(ft, null),
+ from: Mt,
// either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set
- gasPrice: gt(Fe),
- maxPriorityFeePerGas: gt(Fe),
- maxFeePerGas: gt(Fe),
- maxFeePerBlobGas: gt(Fe, null),
- gasLimit: Fe,
- to: gt(St, null),
- value: Fe,
- nonce: ut,
- data: La,
- creates: gt(St, null),
- chainId: gt(Fe, null)
+ gasPrice: bt(Ne),
+ maxPriorityFeePerGas: bt(Ne),
+ maxFeePerGas: bt(Ne),
+ maxFeePerBlobGas: bt(Ne, null),
+ gasLimit: Ne,
+ to: bt(Mt, null),
+ value: Ne,
+ nonce: ft,
+ data: za,
+ creates: bt(Mt, null),
+ chainId: bt(Ne, null)
}, {
data: ["input"],
gasLimit: ["gas"],
index: ["transactionIndex"]
})(i);
- if (e.to == null && e.creates == null && (e.creates = DN(e)), (i.type === 1 || i.type === 2) && i.accessList == null && (e.accessList = []), i.signature ? e.signature = Gt.from(i.signature) : e.signature = Gt.from(i), e.chainId == null) {
+ 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) {
const t = e.signature.legacyChainId;
t != null && (e.chainId = t);
}
- return e.blockHash && Fe(e.blockHash) === bm && (e.blockHash = null), e;
+ return e.blockHash && Ne(e.blockHash) === Jm && (e.blockHash = null), e;
}
-const jD = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
-class rc {
+const A2 = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
+class bc {
/**
* The name of the plugin.
*
@@ -45255,16 +47644,16 @@ class rc {
* Creates a new **NetworkPlugin**.
*/
constructor(e) {
- Xe(this, { name: e });
+ Ye(this, { name: e });
}
/**
* Creates a copy of this plugin.
*/
clone() {
- return new rc(this.name);
+ return new bc(this.name);
}
}
-class ch extends rc {
+class Dh extends bc {
/**
* The block number to treat these values as valid from.
*
@@ -45308,13 +47697,13 @@ class ch extends rc {
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), Xe(this, n);
+ s("txBase", 21e3), s("txCreate", 32e3), s("txDataZero", 4), s("txDataNonzero", 16), s("txAccessListStorageKey", 1900), s("txAccessListAddress", 2400), Ye(this, n);
}
clone() {
- return new ch(this.effectiveBlock, this);
+ return new Dh(this.effectiveBlock, this);
}
}
-class lh extends rc {
+class Nh extends bc {
/**
* The ENS Registrty Contract address.
*/
@@ -45329,16 +47718,16 @@ class lh extends rc {
* if unspecified.
*/
constructor(e, t) {
- super("org.ethers.plugins.network.Ens"), Xe(this, {
- address: e || jD,
+ super("org.ethers.plugins.network.Ens"), Ye(this, {
+ address: e || A2,
targetNetwork: t ?? 1
});
}
clone() {
- return new lh(this.address, this.targetNetwork);
+ return new Nh(this.address, this.targetNetwork);
}
}
-class XD extends rc {
+class g2 extends bc {
#e;
#t;
/**
@@ -45365,8 +47754,8 @@ class XD extends rc {
return this;
}
}
-const Bu = /* @__PURE__ */ new Map();
-class jn {
+const nd = /* @__PURE__ */ new Map();
+class ni {
#e;
#t;
#n;
@@ -45374,7 +47763,7 @@ class jn {
* Creates a new **Network** for %%name%% and %%chainId%%.
*/
constructor(e, t) {
- this.#e = e, this.#t = Fe(t), this.#n = /* @__PURE__ */ new Map();
+ this.#e = e, this.#t = Ne(t), this.#n = /* @__PURE__ */ new Map();
}
/**
* Returns a JSON-compatible representation of a Network.
@@ -45401,7 +47790,7 @@ class jn {
return this.#t;
}
set chainId(e) {
- this.#t = Fe(e, "chainId");
+ this.#t = Ne(e, "chainId");
}
/**
* Returns true if %%other%% matches this network. Any chain ID
@@ -45415,14 +47804,14 @@ class jn {
return !1;
if (typeof e == "string") {
try {
- return this.chainId === Fe(e);
+ return this.chainId === Ne(e);
} catch {
}
return this.name === e;
}
if (typeof e == "number" || typeof e == "bigint") {
try {
- return this.chainId === Fe(e);
+ return this.chainId === Ne(e);
} catch {
}
return !1;
@@ -45430,7 +47819,7 @@ class jn {
if (typeof e == "object") {
if (e.chainId != null) {
try {
- return this.chainId === Fe(e.chainId);
+ return this.chainId === Ne(e.chainId);
} catch {
}
return !1;
@@ -45473,7 +47862,7 @@ class jn {
* Create a copy of this Network.
*/
clone() {
- const e = new jn(this.name, this.chainId);
+ const e = new ni(this.name, this.chainId);
return this.plugins.forEach((t) => {
e.attachPlugin(t.clone());
}), e;
@@ -45485,13 +47874,13 @@ class jn {
* values.
*/
computeIntrinsicGas(e) {
- const t = this.getPlugin("org.ethers.plugins.network.GasCost") || new ch();
+ const t = this.getPlugin("org.ethers.plugins.network.GasCost") || new Dh();
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);
+ const s = Qr(e.accessList);
for (const r in s)
n += t.txAccessListAddress + t.txAccessListStorageKey * s[r].storageKeys.length;
}
@@ -45501,22 +47890,22 @@ class jn {
* Returns a new Network for the %%network%% name or chainId.
*/
static from(e) {
- if (YD(), e == null)
- return jn.from("mainnet");
+ if (m2(), e == null)
+ return ni.from("mainnet");
if (typeof e == "number" && (e = BigInt(e)), typeof e == "string" || typeof e == "bigint") {
- const t = Bu.get(e);
+ const t = nd.get(e);
if (t)
return t();
if (typeof e == "bigint")
- return new jn("unknown", e);
+ 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 jn(e.name, e.chainId);
- return (e.ensAddress || e.ensNetwork != null) && t.attachPlugin(new lh(e.ensAddress, e.ensNetwork)), t;
+ const t = new ni(e.name, e.chainId);
+ return (e.ensAddress || e.ensNetwork != null) && t.attachPlugin(new Nh(e.ensAddress, e.ensNetwork)), t;
}
V(!1, "invalid network", "network", e);
}
@@ -45526,11 +47915,11 @@ class jn {
*/
static register(e, t) {
typeof e == "number" && (e = BigInt(e));
- const n = Bu.get(e);
- n && V(!1, `conflicting network for ${JSON.stringify(n.name)}`, "nameOrChainId", e), Bu.set(e, t);
+ const n = nd.get(e);
+ n && V(!1, `conflicting network for ${JSON.stringify(n.name)}`, "nameOrChainId", e), nd.set(e, t);
}
}
-function xm(i, e) {
+function Zm(i, e) {
const t = String(i);
if (!t.match(/^[0-9.]+$/))
throw new Error(`invalid gwei value: ${i}`);
@@ -45545,8 +47934,8 @@ function xm(i, e) {
}
return BigInt(n[0] + n[1]);
}
-function Em(i) {
- return new XD(i, async (e, t, n) => {
+function $m(i) {
+ return new g2(i, async (e, t, n) => {
n.setHeader("User-Agent", "ethers");
let s;
try {
@@ -45558,28 +47947,28 @@ function Em(i) {
const o = s.bodyJson.standard;
return {
gasPrice: a.gasPrice,
- maxFeePerGas: xm(o.maxFee, 9),
- maxPriorityFeePerGas: xm(o.maxPriorityFee, 9)
+ maxFeePerGas: Zm(o.maxFee, 9),
+ maxPriorityFeePerGas: Zm(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 _m = !1;
-function YD() {
- if (_m)
+let e0 = !1;
+function m2() {
+ if (e0)
return;
- _m = !0;
+ e0 = !0;
function i(e, t, n) {
const s = function() {
- const r = new jn(e, t);
- return n.ensNetwork != null && r.attachPlugin(new lh(null, n.ensNetwork)), r.attachPlugin(new ch()), (n.plugins || []).forEach((a) => {
+ 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) => {
r.attachPlugin(a);
}), r;
};
- jn.register(e, s), jn.register(t, s), n.altNames && n.altNames.forEach((r) => {
- jn.register(r, s);
+ 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, {
@@ -45587,22 +47976,22 @@ function YD() {
}), 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: [
- Em("https://gasstation.polygon.technology/v2")
+ $m("https://gasstation.polygon.technology/v2")
]
}), i("matic-amoy", 80002, {}), i("matic-mumbai", 80001, {
altNames: ["maticMumbai", "maticmum"],
plugins: [
- Em("https://gasstation-testnet.polygon.technology/v2")
+ $m("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 Yd(i) {
+function vf(i) {
return JSON.parse(JSON.stringify(i));
}
-class JD {
+class x2 {
#e;
#t;
#n;
@@ -45656,7 +48045,7 @@ class JD {
this.start();
}
}
-class np {
+class Tp {
#e;
#t;
#n;
@@ -45687,7 +48076,7 @@ class np {
this.start();
}
}
-class ZD extends np {
+class b2 extends Tp {
#e;
#t;
constructor(e, t) {
@@ -45701,16 +48090,16 @@ class ZD extends np {
n != null && (this.#t === -2 ? this.#t = n.number : n.number > this.#t && (t.emit(this.#e, n.number), this.#t = n.number));
}
}
-class $D extends np {
+class E2 extends Tp {
#e;
constructor(e, t) {
- super(e), this.#e = Yd(t);
+ super(e), this.#e = vf(t);
}
async _poll(e, t) {
throw new Error("@TODO");
}
}
-class eL extends np {
+class _2 extends Tp {
#e;
/**
* Create a new **PollingTransactionSubscriber** attached to
@@ -45724,7 +48113,7 @@ class eL extends np {
n && t.emit(this.#e, n);
}
}
-class ip {
+class Rp {
#e;
#t;
#n;
@@ -45737,12 +48126,12 @@ class ip {
* %%provider%%, listening for %%filter%%.
*/
constructor(e, t) {
- this.#e = e, this.#t = Yd(t), this.#n = this.#a.bind(this), this.#i = !1, this.#s = -2;
+ this.#e = e, this.#t = vf(t), this.#n = this.#a.bind(this), this.#i = !1, this.#s = -2;
}
async #a(e) {
if (this.#s === -2)
return;
- const t = Yd(this.#t);
+ const t = vf(this.#t);
t.fromBlock = this.#s + 1, t.toBlock = e;
const n = await this.#e.getLogs(t);
if (n.length === 0) {
@@ -45767,11 +48156,11 @@ class ip {
this.start();
}
}
-const tL = BigInt(2), nL = 10;
-function sl(i) {
+const y2 = BigInt(2), w2 = 10;
+function _l(i) {
return i && typeof i.then == "function";
}
-function fl(i, e) {
+function Tl(i, e) {
return i + ":" + JSON.stringify(e, (t, n) => {
if (n == null)
return "null";
@@ -45786,7 +48175,7 @@ function fl(i, e) {
return n;
});
}
-class eE {
+class UE {
/**
* The name fof the event.
*/
@@ -45795,7 +48184,7 @@ class eE {
* Create a new UnmanagedSubscriber with %%name%%.
*/
constructor(e) {
- Xe(this, { name: e });
+ Ye(this, { name: e });
}
start() {
}
@@ -45806,13 +48195,13 @@ class eE {
resume() {
}
}
-function iL(i) {
+function v2(i) {
return JSON.parse(JSON.stringify(i));
}
-function Jd(i) {
+function Cf(i) {
return i = Array.from(new Set(i).values()), i.sort(), i;
}
-async function Tu(i, e) {
+async function id(i, e) {
if (i == null)
throw new Error("invalid event");
if (Array.isArray(i) && (i = { topics: i }), typeof i == "string")
@@ -45826,38 +48215,38 @@ async function Tu(i, e) {
case "safe":
return { type: i, tag: i };
}
- if (Lt(i, 32)) {
+ if (Ut(i, 32)) {
const t = i.toLowerCase();
- return { type: "transaction", tag: fl("tx", { hash: t }), hash: t };
+ return { type: "transaction", tag: Tl("tx", { hash: t }), hash: t };
}
if (i.orphan) {
const t = i;
- return { type: "orphan", tag: fl("orphan", t), filter: iL(t) };
+ return { type: "orphan", tag: Tl("orphan", t), filter: v2(t) };
}
if (i.address || i.topics) {
const t = i, n = {
- topics: (t.topics || []).map((s) => s == null ? null : Array.isArray(s) ? Jd(s.map((r) => r.toLowerCase())) : s.toLowerCase())
+ topics: (t.topics || []).map((s) => s == null ? null : Array.isArray(s) ? Cf(s.map((r) => r.toLowerCase())) : s.toLowerCase())
};
if (t.address) {
const s = [], r = [], a = (o) => {
- Lt(o) ? s.push(o) : r.push((async () => {
- s.push(await Fn(o, e));
+ Ut(o) ? s.push(o) : r.push((async () => {
+ 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 = Jd(s.map((o) => o.toLowerCase()));
+ 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()));
}
- return { filter: n, tag: fl("event", n), type: "event" };
+ return { filter: n, tag: Tl("event", n), type: "event" };
}
V(!1, "unknown ProviderEvent", "event", i);
}
-function Ru() {
+function sd() {
return (/* @__PURE__ */ new Date()).getTime();
}
-const sL = {
+const C2 = {
cacheTimeout: 250,
pollingInterval: 4e3
};
-class rL {
+class S2 {
#e;
#t;
// null=unpaused, true=paused+dropWhilePaused, false=paused
@@ -45878,10 +48267,10 @@ class rL {
* [[Network]] if necessary.
*/
constructor(e, t) {
- if (this.#A = Object.assign({}, sL, t || {}), e === "any")
+ if (this.#A = Object.assign({}, C2, t || {}), e === "any")
this.#a = !0, this.#s = null;
else if (e) {
- const n = jn.from(e);
+ const n = ni.from(e);
this.#a = !1, this.#s = Promise.resolve(n), setTimeout(() => {
this.emit("network", n, null);
}, 0);
@@ -45934,7 +48323,7 @@ class rL {
const t = this.#A.cacheTimeout;
if (t < 0)
return await this._perform(e);
- const n = fl(e.method, e);
+ const n = Tl(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);
@@ -45948,7 +48337,7 @@ class rL {
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 Li(l);
+ const c = n[o], l = c.replace("{sender}", s).replace("{data}", r), h = new Gi(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 {
@@ -45978,7 +48367,7 @@ class rL {
* sub-class of [[Block]].
*/
_wrapBlock(e, t) {
- return new vD(zD(e), this);
+ return new WL(h2(e), this);
}
/**
* Provides the opportunity for a sub-class to wrap a log before
@@ -45986,7 +48375,7 @@ class rL {
* sub-class of [[Log]].
*/
_wrapLog(e, t) {
- return new nc(GD(e), this);
+ return new gc(c2(e), this);
}
/**
* Provides the opportunity for a sub-class to wrap a transaction
@@ -45994,7 +48383,7 @@ class rL {
* alternate sub-class of [[TransactionReceipt]].
*/
_wrapTransactionReceipt(e, t) {
- return new Gx(KD(e), this);
+ return new CE(p2(e), this);
}
/**
* Provides the opportunity for a sub-class to wrap a transaction
@@ -46002,7 +48391,7 @@ class rL {
* alternate sub-class of [[TransactionResponse]].
*/
_wrapTransactionResponse(e, t) {
- return new ic($x(e), this);
+ return new mc(kE(e), this);
}
/**
* Resolves to the Network, forcing a network detection using whatever
@@ -46029,7 +48418,7 @@ class rL {
}
// State
async getBlockNumber() {
- const e = ut(await this.#c({ method: "getBlockNumber" }), "%response");
+ const e = ft(await this.#c({ method: "getBlockNumber" }), "%response");
return this.#o >= 0 && (this.#o = e), e;
}
/**
@@ -46038,7 +48427,7 @@ class rL {
* address.
*/
_getAddress(e) {
- return Fn(e, this);
+ return Hn(e, this);
}
/**
* Returns or resolves to a valid block tag for %%blockTag%%, resolving
@@ -46056,10 +48445,10 @@ class rL {
case "safe":
return e;
}
- if (Lt(e))
- return Lt(e, 32) ? e : pi(e);
- if (typeof e == "bigint" && (e = ut(e, "blockTag")), typeof e == "number")
- return e >= 0 ? pi(e) : this.#o >= 0 ? pi(this.#o + e) : this.getBlockNumber().then((t) => pi(t + e));
+ if (Ut(e))
+ return Ut(e, 32) ? e : wi(e);
+ if (typeof e == "bigint" && (e = ft(e, "blockTag")), typeof e == "number")
+ return e >= 0 ? wi(e) : this.#o >= 0 ? wi(this.#o + e) : this.getBlockNumber().then((t) => wi(t + e));
V(!1, "invalid blockTag", "blockTag", e);
}
/**
@@ -46068,7 +48457,7 @@ class rL {
* filter.
*/
_getFilter(e) {
- const t = (e.topics || []).map((c) => c == null ? null : Array.isArray(c) ? Jd(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) ? Cf(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:
@@ -46102,17 +48491,17 @@ class rL {
* transaction.
*/
_getTransactionRequest(e) {
- const t = Ol(e), n = [];
+ const t = ah(e), n = [];
if (["to", "from"].forEach((s) => {
if (t[s] == null)
return;
- const r = Fn(t[s], this);
- sl(r) ? n.push((async function() {
+ const r = Hn(t[s], this);
+ _l(r) ? n.push((async function() {
t[s] = await r;
})()) : t[s] = r;
}), t.blockTag != null) {
const s = this._getBlockTag(t.blockTag);
- sl(s) ? n.push((async function() {
+ _l(s) ? n.push((async function() {
t.blockTag = await s;
})()) : t.blockTag = s;
}
@@ -46143,12 +48532,12 @@ class rL {
}
async getFeeData() {
const e = await this.getNetwork(), t = async () => {
- const { _block: s, gasPrice: r, priorityFee: a } = await Bn({
- _block: this.#b("latest", !1),
+ const { _block: s, gasPrice: r, priorityFee: a } = await Un({
+ _block: this.#x("latest", !1),
gasPrice: (async () => {
try {
const h = await this.#c({ method: "getGasPrice" });
- return Fe(h, "%response");
+ return Ne(h, "%response");
} catch {
}
return null;
@@ -46156,7 +48545,7 @@ class rL {
priorityFee: (async () => {
try {
const h = await this.#c({ method: "getPriorityFee" });
- return Fe(h, "%response");
+ return Ne(h, "%response");
} catch {
}
return null;
@@ -46164,35 +48553,35 @@ class rL {
});
let o = null, c = null;
const l = this._wrapBlock(s, e);
- return l && l.baseFeePerGas && (c = a ?? BigInt("1000000000"), o = l.baseFeePerGas * tL + c), new pm(r, o, c);
+ return l && l.baseFeePerGas && (c = a ?? BigInt("1000000000"), o = l.baseFeePerGas * y2 + c), new Km(r, o, c);
}, n = e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");
if (n) {
- const s = new Li(n.url), r = await n.processFunc(t, this, s);
- return new pm(r.gasPrice, r.maxFeePerGas, r.maxPriorityFeePerGas);
+ const s = new Gi(n.url), r = await n.processFunc(t, this, s);
+ return new Km(r.gasPrice, r.maxFeePerGas, r.maxPriorityFeePerGas);
}
return await t();
}
async estimateGas(e) {
let t = this._getTransactionRequest(e);
- return sl(t) && (t = await t), Fe(await this.#c({
+ return _l(t) && (t = await t), Ne(await this.#c({
method: "estimateGas",
transaction: t
}), "%response");
}
async #h(e, t, n) {
- ge(n < nL, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
+ ge(n < w2, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
reason: "TOO_MANY_REDIRECTS",
transaction: Object.assign({}, e, { blockTag: t, enableCcipRead: !0 })
});
- const s = Ol(e);
+ const s = ah(e);
try {
return Se(await this._perform({ method: "call", transaction: s, blockTag: t }));
} catch (r) {
- if (!this.disableCcipRead && kf(r) && r.data && n >= 0 && t === "latest" && s.to != null && Vt(r.data, 0, 4) === "0x556f1830") {
- const a = r.data, o = await Fn(s.to, this);
+ if (!this.disableCcipRead && up(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 = hL(Vt(r.data, 4));
+ c = R2(Kt(r.data, 4));
} catch (u) {
ge(!1, u.message, "OFFCHAIN_FAULT", {
reason: "BAD_DATA",
@@ -46220,7 +48609,7 @@ class rL {
});
const h = {
to: o,
- data: Ot([c.selector, lL([l, c.extraData])])
+ data: Gt([c.selector, T2([l, c.extraData])])
};
this.emit("debug", { action: "sendCcipReadCall", transaction: h });
try {
@@ -46234,14 +48623,14 @@ class rL {
}
}
async #u(e) {
- const { value: t } = await Bn({
+ const { value: t } = await Un({
network: this.getNetwork(),
value: e
});
return t;
}
async call(e) {
- const { tx: t, blockTag: n } = await Bn({
+ const { tx: t, blockTag: n } = await Un({
tx: this._getTransactionRequest(e),
blockTag: this._getBlockTag(e.blockTag)
});
@@ -46253,34 +48642,34 @@ class rL {
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 Fe(await this.#d({ method: "getBalance" }, e, t), "%response");
+ return Ne(await this.#d({ method: "getBalance" }, e, t), "%response");
}
async getTransactionCount(e, t) {
- return ut(await this.#d({ method: "getTransactionCount" }, e, t), "%response");
+ return ft(await this.#d({ method: "getTransactionCount" }, e, t), "%response");
}
async getCode(e, t) {
return Se(await this.#d({ method: "getCode" }, e, t));
}
async getStorage(e, t, n) {
- const s = Fe(t, "position");
+ const s = Ne(t, "position");
return Se(await this.#d({ method: "getStorage", position: s }, e, n));
}
// Write
async broadcastTransaction(e) {
- const { blockNumber: t, hash: n, network: s } = await Bn({
+ const { blockNumber: t, hash: n, network: s } = await Un({
blockNumber: this.getBlockNumber(),
hash: this._perform({
method: "broadcastTransaction",
signedTransaction: e
}),
network: this.getNetwork()
- }), r = fi.from(e);
+ }), r = yi.from(e);
if (r.hash !== n)
throw new Error("@TODO: the returned hash did not match");
return this._wrapTransactionResponse(r, s).replaceableTransaction(t);
}
- async #b(e, t) {
- if (Lt(e, 32))
+ async #x(e, t) {
+ if (Ut(e, 32))
return await this.#c({
method: "getBlock",
blockHash: e,
@@ -46295,21 +48684,21 @@ class rL {
}
// Queries
async getBlock(e, t) {
- const { network: n, params: s } = await Bn({
+ const { network: n, params: s } = await Un({
network: this.getNetwork(),
- params: this.#b(e, !!t)
+ params: this.#x(e, !!t)
});
return s == null ? null : this._wrapBlock(s, n);
}
async getTransaction(e) {
- const { network: t, params: n } = await Bn({
+ const { network: t, params: n } = await Un({
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 Bn({
+ const { network: t, params: n } = await Un({
network: this.getNetwork(),
params: this.#c({ method: "getTransactionReceipt", hash: e })
});
@@ -46324,7 +48713,7 @@ class rL {
return this._wrapTransactionReceipt(n, t);
}
async getTransactionResult(e) {
- const { result: t } = await Bn({
+ const { result: t } = await Un({
network: this.getNetwork(),
result: this.#c({ method: "getTransactionResult", hash: e })
});
@@ -46333,8 +48722,8 @@ class rL {
// Bloom-filter Queries
async getLogs(e) {
let t = this._getFilter(e);
- sl(t) && (t = await t);
- const { network: n, params: s } = await Bn({
+ _l(t) && (t = await t);
+ const { network: n, params: s } = await Un({
network: this.getNetwork(),
params: this.#c({ method: "getLogs", filter: t })
});
@@ -46347,7 +48736,7 @@ class rL {
});
}
async getResolver(e) {
- return await Ea.fromName(this, e);
+ return await Ra.fromName(this, e);
}
async getAvatar(e) {
const t = await this.getResolver(e);
@@ -46358,20 +48747,20 @@ class rL {
return t ? await t.getAddress() : null;
}
async lookupAddress(e) {
- e = St(e);
- const t = Kd(e.substring(2).toLowerCase() + ".addr.reverse");
+ e = Mt(e);
+ const t = _f(e.substring(2).toLowerCase() + ".addr.reverse");
try {
- const n = await Ea.getEnsAddress(this), r = await new xa(n, [
+ const n = await Ra.getEnsAddress(this), r = await new Ta(n, [
"function resolver(bytes32) view returns (address)"
], this).resolver(t);
- if (r == null || r === Go)
+ if (r == null || r === nc)
return null;
- const o = await new xa(r, [
+ const o = await new Ta(r, [
"function name(bytes32) view returns (string)"
], this).name(t);
return await this.resolveName(o) !== e ? null : o;
} catch (n) {
- if (En(n, "BAD_DATA") && n.value === "0x" || En(n, "CALL_EXCEPTION"))
+ if (Mn(n, "BAD_DATA") && n.value === "0x" || Mn(n, "CALL_EXCEPTION"))
return null;
throw n;
}
@@ -46394,7 +48783,7 @@ class rL {
this.once("block", c);
});
n != null && (o = setTimeout(() => {
- o != null && (o = null, this.off("block", c), a(Qt("timeout", "TIMEOUT", { reason: "timeout" })));
+ o != null && (o = null, this.off("block", c), a(Ht("timeout", "TIMEOUT", { reason: "timeout" })));
}, n)), c(await this.getBlockNumber());
});
}
@@ -46427,7 +48816,7 @@ class rL {
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: Ru() });
+ this.#l.set(n, { timer: r, func: s, time: sd() });
}
return n;
}
@@ -46447,20 +48836,20 @@ class rL {
case "debug":
case "error":
case "network":
- return new eE(e.type);
+ return new UE(e.type);
case "block": {
- const t = new JD(this);
+ const t = new x2(this);
return t.pollingInterval = this.pollingInterval, t;
}
case "safe":
case "finalized":
- return new ZD(this, e.type);
+ return new b2(this, e.type);
case "event":
- return new ip(this, e.filter);
+ return new Rp(this, e.filter);
case "transaction":
- return new eL(this, e.hash);
+ return new _2(this, e.hash);
case "orphan":
- return new $D(this, e.filter);
+ return new E2(this, e.filter);
}
throw new Error(`unsupported event: ${e.type}`);
}
@@ -46481,11 +48870,11 @@ class rL {
}
}
async #g(e, t) {
- let n = await Tu(e, this);
- return n.type === "event" && t && t.length > 0 && t[0].removed === !0 && (n = await Tu({ orphan: "drop-log", log: t[0] }, this)), this.#e.get(n.tag) || null;
+ 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;
}
async #m(e) {
- const t = await Tu(e, this), n = t.tag;
+ const t = await id(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;
}
@@ -46503,7 +48892,7 @@ class rL {
return !1;
const s = n.listeners.length;
return n.listeners = n.listeners.filter(({ listener: r, once: a }) => {
- const o = new Eb(this, a ? null : r, e);
+ const o = new sb(this, a ? null : r, e);
try {
r.call(this, ...t, o);
} catch {
@@ -46612,7 +49001,7 @@ class rL {
}
this._forEachSubscriber((t) => t.pause(e)), this.#n = !!e;
for (const t of this.#l.values())
- t.timer && clearTimeout(t.timer), t.time = Ru() - t.time;
+ t.timer && clearTimeout(t.timer), t.time = sd() - t.time;
}
/**
* Resume the provider.
@@ -46622,57 +49011,57 @@ class rL {
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 = Ru(), setTimeout(e.func, t);
+ t < 0 && (t = 0), e.time = sd(), setTimeout(e.func, t);
}
}
}
}
-function aL(i, e) {
+function I2(i, e) {
try {
- const t = Zd(i, e);
+ const t = Sf(i, e);
if (t)
- return Nl(t);
+ return $l(t);
} catch {
}
return null;
}
-function Zd(i, e) {
+function Sf(i, e) {
if (i === "0x")
return null;
try {
- const t = ut(Vt(i, e, e + 32)), n = ut(Vt(i, t, t + 32));
- return Vt(i, t + 32, t + 32 + n);
+ const t = ft(Kt(i, e, e + 32)), n = ft(Kt(i, t, t + 32));
+ return Kt(i, t + 32, t + 32 + n);
} catch {
}
return null;
}
-function ym(i) {
- const e = $t(i);
+function t0(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 oL(i) {
+function M2(i) {
if (i.length % 32 === 0)
return i;
const e = new Uint8Array(Math.ceil(i.length / 32) * 32);
return e.set(i), e;
}
-const cL = new Uint8Array([]);
-function lL(i) {
+const B2 = new Uint8Array([]);
+function T2(i) {
const e = [];
let t = 0;
for (let n = 0; n < i.length; n++)
- e.push(cL), t += 32;
+ e.push(B2), t += 32;
for (let n = 0; n < i.length; n++) {
- const s = ht(i[n]);
- e[n] = ym(t), e.push(ym(s.length)), e.push(oL(s)), t += 32 + Math.ceil(s.length / 32) * 32;
+ 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;
}
- return Ot(e);
+ return Gt(e);
}
-const wm = "0x0000000000000000000000000000000000000000000000000000000000000000";
-function hL(i) {
+const n0 = "0x0000000000000000000000000000000000000000000000000000000000000000";
+function R2(i) {
const e = {
sender: "",
urls: [],
@@ -46681,17 +49070,17 @@ function hL(i) {
extraData: "",
errorArgs: []
};
- ge(ga(i) >= 160, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {
+ ge(Ia(i) >= 160, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {
reason: "insufficient OffchainLookup data"
});
- const t = Vt(i, 0, 32);
- ge(Vt(t, 0, 12) === Vt(wm, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {
+ const t = Kt(i, 0, 32);
+ ge(Kt(t, 0, 12) === Kt(n0, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {
reason: "corrupt OffchainLookup sender"
- }), e.sender = Vt(t, 12);
+ }), e.sender = Kt(t, 12);
try {
- const n = [], s = ut(Vt(i, 32, 64)), r = ut(Vt(i, s, s + 32)), a = Vt(i, s + 32);
+ 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 = aL(a, o * 32);
+ const c = I2(a, o * 32);
if (c == null)
throw new Error("abort");
n.push(c);
@@ -46703,7 +49092,7 @@ function hL(i) {
});
}
try {
- const n = Zd(i, 64);
+ const n = Sf(i, 64);
if (n == null)
throw new Error("abort");
e.calldata = n;
@@ -46712,11 +49101,11 @@ function hL(i) {
reason: "corrupt OffchainLookup calldata"
});
}
- ge(Vt(i, 100, 128) === Vt(wm, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {
+ ge(Kt(i, 100, 128) === Kt(n0, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {
reason: "corrupt OffchainLookup callbaackSelector"
- }), e.selector = Vt(i, 96, 100);
+ }), e.selector = Kt(i, 96, 100);
try {
- const n = Zd(i, 128);
+ const n = Sf(i, 128);
if (n == null)
throw new Error("abort");
e.extraData = n;
@@ -46727,24 +49116,24 @@ function hL(i) {
}
return e.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((n) => e[n]), e;
}
-function tr(i, e) {
+function lr(i, e) {
if (i.provider)
return i.provider;
ge(!1, "missing provider", "UNSUPPORTED_OPERATION", { operation: e });
}
-async function vm(i, e) {
- let t = Ol(e);
- if (t.to != null && (t.to = Fn(t.to, i)), t.from != null) {
+async function i0(i, e) {
+ let t = ah(e);
+ if (t.to != null && (t.to = Hn(t.to, i)), t.from != null) {
const n = t.from;
t.from = Promise.all([
i.getAddress(),
- Fn(n, i)
+ Hn(n, i)
]).then(([s, r]) => (V(s.toLowerCase() === r.toLowerCase(), "transaction from mismatch", "tx.from", r), s));
} else
t.from = i.getAddress();
- return await Bn(t);
+ return await Un(t);
}
-class uL {
+class F2 {
/**
* The provider this signer is connected to.
*/
@@ -46753,20 +49142,20 @@ class uL {
* Creates a new Signer connected to %%provider%%.
*/
constructor(e) {
- Xe(this, { provider: e || null });
+ Ye(this, { provider: e || null });
}
async getNonce(e) {
- return tr(this, "getTransactionCount").getTransactionCount(await this.getAddress(), e);
+ return lr(this, "getTransactionCount").getTransactionCount(await this.getAddress(), e);
}
async populateCall(e) {
- return await vm(this, e);
+ return await i0(this, e);
}
async populateTransaction(e) {
- const t = tr(this, "populateTransaction"), n = await vm(this, e);
+ const t = lr(this, "populateTransaction"), n = await i0(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 = Fe(n.chainId);
+ const a = Ne(n.chainId);
V(a === s.chainId, "transaction chainId mismatch", "tx.chainId", e.chainId);
} else
n.chainId = s.chainId;
@@ -46794,25 +49183,25 @@ class uL {
});
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 Bn(n);
+ return await Un(n);
}
async populateAuthorization(e) {
const t = Object.assign({}, e);
- return t.chainId == null && (t.chainId = (await tr(this, "getNetwork").getNetwork()).chainId), t.nonce == null && (t.nonce = await this.getNonce()), t;
+ return t.chainId == null && (t.chainId = (await lr(this, "getNetwork").getNetwork()).chainId), t.nonce == null && (t.nonce = await this.getNonce()), t;
}
async estimateGas(e) {
- return tr(this, "estimateGas").estimateGas(await this.populateCall(e));
+ return lr(this, "estimateGas").estimateGas(await this.populateCall(e));
}
async call(e) {
- return tr(this, "call").call(await this.populateCall(e));
+ return lr(this, "call").call(await this.populateCall(e));
}
async resolveName(e) {
- return await tr(this, "resolveName").resolveName(e);
+ return await lr(this, "resolveName").resolveName(e);
}
async sendTransaction(e) {
- const t = tr(this, "sendTransaction"), n = await this.populateTransaction(e);
+ const t = lr(this, "sendTransaction"), n = await this.populateTransaction(e);
delete n.from;
- const s = fi.from(n);
+ const s = yi.from(n);
return await t.broadcastTransaction(await this.signTransaction(s));
}
// @TODO: in v7 move this to be abstract
@@ -46820,10 +49209,10 @@ class uL {
ge(!1, "authorization not implemented for this signer", "UNSUPPORTED_OPERATION", { operation: "authorize" });
}
}
-function dL(i) {
+function D2(i) {
return JSON.parse(JSON.stringify(i));
}
-class tE {
+class OE {
#e;
#t;
#n;
@@ -46863,7 +49252,7 @@ class tE {
try {
t = await this.#t;
} catch (r) {
- if (!En(r, "UNSUPPORTED_OPERATION") || r.operation !== "eth_newFilter")
+ if (!Mn(r, "UNSUPPORTED_OPERATION") || r.operation !== "eth_newFilter")
throw r;
}
if (t == null) {
@@ -46901,17 +49290,17 @@ class tE {
this.start();
}
}
-class fL extends tE {
+class N2 extends OE {
#e;
/**
* Creates a new **FilterIdEventSubscriber** attached to %%provider%%
* listening for %%filter%%.
*/
constructor(e, t) {
- super(e), this.#e = dL(t);
+ super(e), this.#e = D2(t);
}
_recover(e) {
- return new ip(e, this.#e);
+ return new Rp(e, this.#e);
}
async _subscribe(e) {
return await e.send("eth_newFilter", [this.#e]);
@@ -46921,7 +49310,7 @@ class fL extends tE {
e.emit(this.#e, e._wrapLog(n, e._network));
}
}
-class pL extends tE {
+class L2 extends OE {
async _subscribe(e) {
return await e.send("eth_newPendingTransactionFilter", []);
}
@@ -46930,28 +49319,28 @@ class pL extends tE {
e.emit("pending", n);
}
}
-const AL = "bigint,boolean,function,number,string,symbol".split(/,/g);
-function pl(i) {
- if (i == null || AL.indexOf(typeof i) >= 0 || typeof i.getAddress == "function")
+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")
return i;
if (Array.isArray(i))
- return i.map(pl);
+ return i.map(Rl);
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 gL(i) {
+function k2(i) {
return new Promise((e) => {
setTimeout(e, i);
});
}
-function Jr(i) {
+function la(i) {
return i && i.toLowerCase();
}
-function Cm(i) {
+function s0(i) {
return i && typeof i.pollingInterval == "number";
}
-const nE = {
+const QE = {
polling: !1,
staticNetwork: null,
batchStallTime: 10,
@@ -46960,10 +49349,10 @@ const nE = {
cacheTimeout: 250,
pollingInterval: 4e3
};
-class Nu extends uL {
+class rd extends F2 {
address;
constructor(e, t) {
- super(e), t = St(t), Xe(this, { address: t });
+ super(e), t = Mt(t), Ye(this, { address: t });
}
connect(e) {
ge(!1, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", {
@@ -46980,11 +49369,11 @@ class Nu extends uL {
// Returns just the hash of the transaction after sent, which is what
// the bare JSON-RPC API does;
async sendUncheckedTransaction(e) {
- const t = pl(e), n = [];
+ const t = Rl(e), n = [];
if (t.from) {
const r = t.from;
n.push((async () => {
- const a = await Fn(r, this.provider);
+ const a = await Hn(r, this.provider);
V(a != null && a.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", e), t.from = a;
})());
} else
@@ -46994,7 +49383,7 @@ class Nu extends uL {
})()), t.to != null) {
const r = t.to;
n.push((async () => {
- t.to = await Fn(r, this.provider);
+ t.to = await Hn(r, this.provider);
})());
}
n.length && await Promise.all(n);
@@ -47014,15 +49403,15 @@ class Nu extends uL {
return;
}
} catch (l) {
- if (En(l, "CANCELLED") || En(l, "BAD_DATA") || En(l, "NETWORK_ERROR") || En(l, "UNSUPPORTED_OPERATION")) {
+ if (Mn(l, "CANCELLED") || Mn(l, "BAD_DATA") || Mn(l, "NETWORK_ERROR") || Mn(l, "UNSUPPORTED_OPERATION")) {
l.info == null && (l.info = {}), l.info.sendTransactionHash = n, r(l);
return;
}
- if (En(l, "INVALID_ARGUMENT") && (o++, l.info == null && (l.info = {}), l.info.sendTransactionHash = n, o > 10)) {
+ if (Mn(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.emit("error", Ht("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error: l }));
}
this.provider._setTimeout(() => {
c();
@@ -47032,9 +49421,9 @@ class Nu extends uL {
});
}
async signTransaction(e) {
- const t = pl(e);
+ const t = Rl(e);
if (t.from) {
- const s = await Fn(t.from, this.provider);
+ const s = await Hn(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;
@@ -47042,20 +49431,20 @@ class Nu extends uL {
return await this.provider.send("eth_signTransaction", [n]);
}
async signMessage(e) {
- const t = typeof e == "string" ? cs(e) : e;
+ const t = typeof e == "string" ? gs(e) : e;
return await this.provider.send("personal_sign", [
Se(t),
this.address.toLowerCase()
]);
}
async signTypedData(e, t, n) {
- const s = pl(n), r = await qn.resolveNames(e, t, s, async (a) => {
- const o = await Fn(a);
+ const s = Rl(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;
});
return await this.provider.send("eth_signTypedData_v4", [
this.address.toLowerCase(),
- JSON.stringify(qn.getPayload(r.domain, t, r.value))
+ JSON.stringify($n.getPayload(r.domain, t, r.value))
]);
}
async unlock(e) {
@@ -47067,14 +49456,14 @@ class Nu extends uL {
}
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
async _legacySignMessage(e) {
- const t = typeof e == "string" ? cs(e) : e;
+ const t = typeof e == "string" ? gs(e) : e;
return await this.provider.send("eth_sign", [
this.address.toLowerCase(),
Se(t)
]);
}
}
-class mL extends rL {
+class U2 extends S2 {
#e;
// The next ID to use for the JSON-RPC ID field
#t;
@@ -47106,12 +49495,12 @@ class mL extends rL {
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 }));
+ o(Ht("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", {
+ const h = Ht("missing response for request", "BAD_DATA", {
value: r,
info: { payload: c }
});
@@ -47134,7 +49523,7 @@ class mL extends rL {
}, e);
}
constructor(e, t) {
- super(e, t), this.#t = 1, this.#e = Object.assign({}, nE, t || {}), this.#n = [], this.#i = null, this.#a = null, this.#r = null;
+ super(e, t), this.#t = 1, this.#e = Object.assign({}, QE, t || {}), this.#n = [], this.#i = null, this.#a = null, this.#r = null;
{
let s = null;
const r = new Promise((a) => {
@@ -47143,7 +49532,7 @@ class mL extends rL {
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 = jn.from(e))) : n && (V(e == null || n.matches(e), "staticNetwork MUST match network object", "options", t), this.#a = n);
+ typeof n == "boolean" ? (V(!n || e !== "any", "staticNetwork cannot be used on special network 'any'", "options", t), n && e != null && (this.#a = ni.from(e))) : n && (V(e == null || n.matches(e), "staticNetwork MUST match network object", "options", t), this.#a = n);
}
/**
* Returns the value associated with the option %%key%%.
@@ -47169,7 +49558,7 @@ class mL extends rL {
async _perform(e) {
if (e.method === "call" || e.method === "estimateGas") {
let n = e.transaction;
- if (n && n.type != null && Fe(n.type) && n.maxFeePerGas == null && n.maxPriorityFeePerGas == null) {
+ 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 })
@@ -47196,7 +49585,7 @@ class mL extends rL {
return e;
return this.#r ? await this.#r : this.ready ? (this.#r = (async () => {
try {
- const t = jn.from(Fe(await this.send("eth_chainId", [])));
+ const t = ni.from(Ne(await this.send("eth_chainId", [])));
return this.#r = null, t;
} catch (t) {
throw this.#r = null, t;
@@ -47216,7 +49605,7 @@ class mL extends rL {
throw this.#r = null, this.emit("debug", { action: "receiveRpcError", error: s }), s;
}
if (this.emit("debug", { action: "receiveRpcResult", result: n }), "result" in n)
- return jn.from(Fe(n.result));
+ return ni.from(Ne(n.result));
throw this.getRpcError(t, n);
})(), await this.#r);
}
@@ -47235,7 +49624,7 @@ class mL extends rL {
} 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 gL(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", Ht("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error: e } })), await k2(1e3);
}
this.#o();
})());
@@ -47256,7 +49645,7 @@ class mL extends rL {
* subscription management.
*/
_getSubscriber(e) {
- return e.type === "pending" ? new pL(this) : e.type === "event" ? this._getOption("polling") ? new ip(this, e.filter) : new fL(this, e.filter) : e.type === "orphan" && e.filter.orphan === "drop-log" ? new eE("orphan") : super._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);
}
/**
* Returns true only if the [[_start]] has been called.
@@ -47275,18 +49664,18 @@ class mL extends rL {
if (e[n] == null)
return;
let s = n;
- n === "gasLimit" && (s = "gas"), t[s] = pi(Fe(e[n], `tx.${n}`));
+ n === "gasLimit" && (s = "gas"), t[s] = wi(Ne(e[n], `tx.${n}`));
}), ["from", "to", "data"].forEach((n) => {
e[n] != null && (t[n] = Se(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 = ox(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);
return {
address: s.address,
- nonce: pi(s.nonce),
- chainId: pi(s.chainId),
- yParity: pi(s.signature.yParity),
- r: pi(s.signature.r),
- s: pi(s.signature.s)
+ nonce: wi(s.nonce),
+ chainId: wi(s.chainId),
+ yParity: wi(s.signature.yParity),
+ r: wi(s.signature.r),
+ s: wi(s.signature.s)
};
})), t;
}
@@ -47307,23 +49696,23 @@ class mL extends rL {
case "getBalance":
return {
method: "eth_getBalance",
- args: [Jr(e.address), e.blockTag]
+ args: [la(e.address), e.blockTag]
};
case "getTransactionCount":
return {
method: "eth_getTransactionCount",
- args: [Jr(e.address), e.blockTag]
+ args: [la(e.address), e.blockTag]
};
case "getCode":
return {
method: "eth_getCode",
- args: [Jr(e.address), e.blockTag]
+ args: [la(e.address), e.blockTag]
};
case "getStorage":
return {
method: "eth_getStorageAt",
args: [
- Jr(e.address),
+ la(e.address),
"0x" + e.position.toString(16),
e.blockTag
]
@@ -47366,7 +49755,7 @@ class mL extends rL {
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(Jr) : e.filter.address = Jr(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(la) : e.filter.address = la(e.filter.address)), { method: "eth_getLogs", args: [e.filter] };
}
return null;
}
@@ -47381,23 +49770,23 @@ class mL extends rL {
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", {
+ return Ht("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", {
+ return Ht("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 = $d(s), c = Da.getBuiltinCallException(n === "eth_call" ? "call" : "estimateGas", e.params[0], o ? o.data : null);
+ const o = If(s), c = Ha.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(EL(s));
+ const r = JSON.stringify(G2(s));
if (typeof s.message == "string" && s.message.match(/user denied|ethers-user-denied/i))
- return Qt("user rejected action", "ACTION_REJECTED", {
+ return Ht("user rejected action", "ACTION_REJECTED", {
action: {
eth_sign: "signMessage",
personal_sign: "signMessage",
@@ -47413,25 +49802,25 @@ class mL extends rL {
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", {
+ return Ht("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 } });
+ return Ht("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 } });
+ return Ht("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", {
+ return Ht("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", {
+ return a || s && s.details && s.details.startsWith("Unauthorized method:") && (a = !0), a ? Ht("unsupported operation", "UNSUPPORTED_OPERATION", {
operation: e.method,
info: { error: s, payload: e }
- }) : Qt("could not coalesce error", "UNKNOWN_ERROR", { error: s, payload: e });
+ }) : Ht("could not coalesce error", "UNKNOWN_ERROR", { error: s, payload: e });
}
/**
* Requests the %%method%% with %%params%% via the JSON-RPC protocol
@@ -47448,7 +49837,7 @@ class mL extends rL {
*/
send(e, t) {
if (this.destroyed)
- return Promise.reject(Qt("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: e }));
+ return Promise.reject(Ht("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: e }));
const n = this.#t++, s = new Promise((r, a) => {
this.#n.push({
resolve: r,
@@ -47477,38 +49866,38 @@ class mL extends rL {
const s = await t;
if (e >= s.length)
throw new Error("no such account");
- return new Nu(this, s[e]);
+ return new rd(this, s[e]);
}
- const { accounts: n } = await Bn({
+ const { accounts: n } = await Un({
network: this.getNetwork(),
accounts: t
});
- e = St(e);
+ e = Mt(e);
for (const s of n)
- if (St(s) === e)
- return new Nu(this, e);
+ if (Mt(s) === e)
+ return new rd(this, e);
throw new Error("invalid account");
}
async listAccounts() {
- return (await this.send("eth_accounts", [])).map((t) => new Nu(this, t));
+ return (await this.send("eth_accounts", [])).map((t) => new rd(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 }));
+ t(Ht("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: e.method }));
this.#n = [], super.destroy();
}
}
-class bL extends mL {
+class O2 extends U2 {
#e;
constructor(e, t) {
super(e, t);
let n = this._getOption("pollingInterval");
- n == null && (n = nE.pollingInterval), this.#e = n;
+ n == null && (n = QE.pollingInterval), this.#e = n;
}
_getSubscriber(e) {
const t = super._getSubscriber(e);
- return Cm(t) && (t.pollingInterval = this.#e), t;
+ return s0(t) && (t.pollingInterval = this.#e), t;
}
/**
* The polling interval (default: 4000 ms)
@@ -47520,14 +49909,14 @@ class bL extends mL {
if (!Number.isInteger(e) || e < 0)
throw new Error("invalid interval");
this.#e = e, this._forEachSubscriber((t) => {
- Cm(t) && (t.pollingInterval = this.#e);
+ s0(t) && (t.pollingInterval = this.#e);
});
}
}
-class xL extends bL {
+class Q2 extends O2 {
#e;
constructor(e, t, n) {
- e == null && (e = "http://localhost:8545"), super(t, n), typeof e == "string" ? this.#e = new Li(e) : this.#e = e.clone();
+ e == null && (e = "http://localhost:8545"), super(t, n), typeof e == "string" ? this.#e = new Gi(e) : this.#e = e.clone();
}
_getConnection() {
return this.#e.clone();
@@ -47544,14 +49933,14 @@ class xL extends bL {
return Array.isArray(s) || (s = [s]), s;
}
}
-function $d(i) {
+function If(i) {
if (i == null)
return null;
- if (typeof i.message == "string" && i.message.match(/revert/i) && Lt(i.data))
+ 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 = $d(i[e]);
+ const t = If(i[e]);
if (t)
return t;
}
@@ -47559,28 +49948,28 @@ function $d(i) {
}
if (typeof i == "string")
try {
- return $d(JSON.parse(i));
+ return If(JSON.parse(i));
} catch {
}
return null;
}
-function ef(i, e) {
+function Mf(i, e) {
if (i != null) {
if (typeof i.message == "string" && e.push(i.message), typeof i == "object")
for (const t in i)
- ef(i[t], e);
+ Mf(i[t], e);
if (typeof i == "string")
try {
- return ef(JSON.parse(i), e);
+ return Mf(JSON.parse(i), e);
} catch {
}
}
}
-function EL(i) {
+function G2(i) {
const e = [];
- return ef(i, e), e;
+ return Mf(i, e), e;
}
-const _L = [
+const H2 = [
// --- Registration ---
"function register() external returns (uint256 agentId)",
"function register(string agentURI) external returns (uint256 agentId)",
@@ -47601,120 +49990,126 @@ const _L = [
"function name() external view returns (string)",
"function symbol() external view returns (string)",
"function getVersion() external pure returns (string)",
+ // --- ERC-721 transfer ---
+ "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",
// --- Events ---
"event Registered(uint256 indexed agentId, string agentURI, address indexed owner)",
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
-], nr = {
+], hr = {
identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e",
reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713",
validationRegistry: "0x8004Cb1BF31DAf7788923b405b754f57acEB4272"
-}, In = {
+}, Ln = {
identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",
validationRegistry: ""
// not yet deployed on mainnet
-}, yL = {
+}, z2 = {
// Mainnets
- 1: In,
+ 1: Ln,
// Ethereum
- 10: In,
+ 10: Ln,
// Optimism
- 56: In,
+ 56: Ln,
// BSC
- 100: In,
+ 100: Ln,
// Gnosis
- 137: In,
+ 137: Ln,
// Polygon
- 250: In,
+ 250: Ln,
// Fantom
- 324: In,
+ 324: Ln,
// zkSync Era
- 1284: In,
+ 1284: Ln,
// Moonbeam
- 5e3: In,
+ 5e3: Ln,
// Mantle
- 8453: In,
+ 8453: Ln,
// Base
- 42161: In,
+ 42161: Ln,
// Arbitrum One
- 42220: In,
+ 42220: Ln,
// Celo
- 43114: In,
+ 43114: Ln,
// Avalanche
- 59144: In,
+ 59144: Ln,
// Linea
- 534352: In,
+ 534352: Ln,
// Scroll
// Testnets
- 97: nr,
+ 97: hr,
// BSC Testnet
- 11155111: nr,
+ 11155111: hr,
// Ethereum Sepolia
- 84532: nr,
+ 84532: hr,
// Base Sepolia
- 421614: nr,
+ 421614: hr,
// Arbitrum Sepolia
- 11155420: nr,
+ 11155420: hr,
// Optimism Sepolia
- 80002: nr,
+ 80002: hr,
// Polygon Amoy
- 43113: nr
+ 43113: hr
// Avalanche Fuji
-}, wL = {
+}, V2 = {
base: 8453,
"base-mainnet": 8453,
"base-sepolia": 84532,
ethereum: 1,
mainnet: 1
-}, vL = {
+}, W2 = {
8453: "https://mainnet.base.org",
84532: "https://sepolia.base.org",
1: "https://eth.llamarpc.com"
};
-async function Sm(i, { rpcURL: e, registry: t } = {}) {
+async function r0(i, { rpcURL: e, registry: t } = {}) {
if (!i) throw new Error("loadManifest: source required");
if (i.startsWith("agent://"))
- return CL(i, { rpcURL: e, registryOverride: t });
+ return q2(i, { rpcURL: e, registryOverride: t });
if (i.startsWith("ipfs://") || i.startsWith("ar://")) {
- const n = wr(i), s = await tf(n);
- return nf(s, { baseURI: sf(n) });
+ const n = Nr(i), s = await Bf(n);
+ return Tf(s, { baseURI: Rf(n) });
}
if (i.startsWith("http")) {
- const n = await tf(i);
- return nf(n, { baseURI: sf(i) });
+ const n = await Bf(i);
+ return Tf(n, { baseURI: Rf(i) });
}
throw new Error(`Unsupported manifest source: ${i}`);
}
-async function CL(i, { rpcURL: e, registryOverride: t }) {
+async function q2(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 = wL[s.toLowerCase()] || Number(s);
+ const [, s, r] = n, a = V2[s.toLowerCase()] || Number(s);
if (!a) throw new Error(`Unknown chain: ${s}`);
- const o = yL[a], c = t || o?.identityRegistry;
+ const o = z2[a], c = t || o?.identityRegistry;
if (!c)
throw new Error(`No registry deployed on chain ${a}. Pass registry= override.`);
- const l = new xL(e || vL[a]), h = new xa(c, _L, l), u = BigInt(r), d = await h.tokenURI(u);
+ const l = new Q2(e || W2[a]), h = new Ta(c, H2, l), u = BigInt(r), d = await h.tokenURI(u);
if (!d) throw new Error(`Agent ${r} on chain ${a} has no URI`);
- const f = wr(d), m = await tf(f), g = nf(m, { baseURI: sf(f) });
- return g.id = {
- ...g.id,
+ const f = Nr(d), p = await Bf(f), m = Tf(p, { baseURI: Rf(f) });
+ return m.id = {
+ ...m.id,
chain: s,
chainId: a,
registry: c,
agentId: r
- }, g;
+ }, m;
}
-async function tf(i) {
+async function Bf(i) {
let e;
try {
e = await fetch(i);
} catch {
- e = await yT(i);
+ e = await zR(i);
}
if (!e.ok) throw new Error(`Manifest fetch failed: ${i} (${e.status})`);
return e.json();
}
-function nf(i, { baseURI: e = "" } = {}) {
+function Tf(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;
@@ -47755,11 +50150,11 @@ function nf(i, { baseURI: e = "" } = {}) {
version: i.version || "0.1.0"
};
}
-function sf(i) {
+function Rf(i) {
const e = i.lastIndexOf("/");
return e >= 0 ? i.slice(0, e + 1) : i;
}
-async function SL(i, e) {
+async function K2(i, e) {
if (!i._baseURI) return null;
try {
const t = new URL(e, i._baseURI).href, n = await fetch(t);
@@ -47768,39 +50163,39 @@ async function SL(i, e) {
return null;
}
}
-class ts extends Error {
+class os extends Error {
constructor(e, t, { status: n } = {}) {
super(t), this.name = "AgentResolveError", this.code = e, n !== void 0 && (this.status = n);
}
}
-async function Im(i, { fetchFn: e }) {
+async function a0(i, { fetchFn: e }) {
let t;
try {
t = await e(i, { credentials: "include" });
} catch (n) {
- throw new ts("network", `network error fetching ${i}: ${n.message || n}`);
+ throw new os("network", `network error fetching ${i}: ${n.message || n}`);
}
if (t.status === 401 || t.status === 403)
- throw new ts("unauthorized", `unauthorized fetching ${i} (${t.status})`, { status: t.status });
+ throw new os("unauthorized", `unauthorized fetching ${i} (${t.status})`, { status: t.status });
if (t.status === 404)
- throw new ts("not_found", `resource not found: ${i}`, { status: 404 });
+ throw new os("not_found", `resource not found: ${i}`, { status: 404 });
if (!t.ok)
- throw new ts("network", `request failed: ${i} (${t.status})`, { status: t.status });
+ throw new os("network", `request failed: ${i} (${t.status})`, { status: t.status });
try {
return await t.json();
} catch (n) {
- throw new ts("network", `invalid JSON from ${i}: ${n.message || n}`);
+ throw new os("network", `invalid JSON from ${i}: ${n.message || n}`);
}
}
-async function IL(i, { origin: e = typeof location < "u" ? location.origin : "", fetchFn: t = fetch } = {}) {
- if (!i) throw new ts("not_found", "agentId required");
- const n = t.bind(typeof globalThis < "u" ? globalThis : void 0), r = (await Im(`${e}/api/agents/${encodeURIComponent(i)}`, { fetchFn: n }))?.agent;
- if (!r) throw new ts("not_found", `agent ${i} not found`);
+async function j2(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;
+ if (!r) throw new os("not_found", `agent ${i} not found`);
if (!r.avatar_id)
- throw new ts("no_avatar", `agent ${i} has no avatar bound`);
- const o = (await Im(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`, { fetchFn: n }))?.avatar;
+ 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;
if (!o || !o.url)
- throw new ts("no_avatar", `avatar ${r.avatar_id} has no 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) : [];
return {
spec: "agent-manifest/0.1",
@@ -47823,7 +50218,7 @@ async function IL(i, { origin: e = typeof location < "u" ? location.origin : "",
_source: "agent-id"
};
}
-const ML = ["inline", "floating", "section", "fullscreen"], BL = `
+const X2 = ["inline", "floating", "section", "fullscreen"], Y2 = `
:host {
display: block;
position: relative;
@@ -47988,7 +50383,7 @@ const ML = ["inline", "floating", "section", "fullscreen"], BL = `
font: 14px var(--agent-chat-font);
}
`;
-class iE extends HTMLElement {
+class GE extends HTMLElement {
static get observedAttributes() {
return ["src", "manifest", "body", "agent-id", "mode", "position", "width", "height", "voice", "api-key", "key-proxy", "responsive"];
}
@@ -48006,7 +50401,7 @@ class iE extends HTMLElement {
}
_renderShell() {
const e = document.createElement("style");
- e.textContent = BL, this.shadowRoot.appendChild(e);
+ e.textContent = Y2, 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");
@@ -48053,7 +50448,7 @@ class iE extends HTMLElement {
}
_applyLayout() {
const e = this.getAttribute("mode") || "inline";
- if (!ML.includes(e)) return;
+ if (!X2.includes(e)) return;
const t = this._isResponsive();
if (e === "floating") {
if (!this._pillActive) {
@@ -48117,21 +50512,21 @@ class iE extends HTMLElement {
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 SL(e, e.brain.instructions);
- c && (e.instructions = TL(c));
+ const c = await K2(e, e.brain.instructions);
+ c && (e.instructions = J2(c));
} 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 pb(this._stageEl, { kiosk: this.hasAttribute("kiosk") });
+ const t = new Zx(this._stageEl, { kiosk: this.hasAttribute("kiosk") });
this._viewer = t;
- const n = wr(e.body?.uri);
- n && await t.load(n, "", /* @__PURE__ */ new Map()), this._scene = new CT(t), this.dispatchEvent(new CustomEvent("agent:load-progress", { detail: { phase: "memory", pct: 0.6 } }));
+ 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";
- this._memory = await Mi.load({
+ this._memory = await Pi.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: 0.75 } })), this._skills = new QT({
+ }), this.dispatchEvent(new CustomEvent("agent:load-progress", { detail: { phase: "skills", pct: 0.75 } })), this._skills = new oF({
trust: this.getAttribute("skill-trust") || "owned-only",
ownerAddress: e.id?.owner
});
@@ -48148,7 +50543,7 @@ class iE extends HTMLElement {
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 ET({
+ o && (e.voice = e.voice || {}, e.voice.tts = { ...e.voice.tts || {}, ...o }), this._runtime = new GR({
manifest: e,
viewer: this._scene,
memory: this._memory,
@@ -48178,9 +50573,9 @@ class iE extends HTMLElement {
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"), Sm(e, { rpcURL: this.getAttribute("rpc-url"), registry: this.getAttribute("registry") });
- if (s) return IL(s);
- if (t) return Sm(t);
+ 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);
if (n) {
const r = this.getAttribute("instructions");
return {
@@ -48317,12 +50712,12 @@ class iE extends HTMLElement {
});
}
}
-function TL(i) {
+function J2(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", iE);
-const RL = ["row", "circle", "freeform"], NL = `
+customElements.get("agent-3d") || customElements.define("agent-3d", GE);
+const Z2 = ["row", "circle", "freeform"], $2 = `
:host {
display: block;
position: relative;
@@ -48343,7 +50738,7 @@ const RL = ["row", "circle", "freeform"], NL = `
pointer-events: none;
}
`;
-class FL extends HTMLElement {
+class eP extends HTMLElement {
static get observedAttributes() {
return ["formation"];
}
@@ -48370,14 +50765,14 @@ class FL extends HTMLElement {
}
get formation() {
const e = this.getAttribute("formation") || "row";
- return RL.includes(e) ? e : "row";
+ return Z2.includes(e) ? e : "row";
}
get viewer() {
return this._viewer;
}
_renderShell() {
const e = document.createElement("style");
- e.textContent = NL, this.shadowRoot.appendChild(e);
+ e.textContent = $2, 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");
@@ -48385,7 +50780,7 @@ class FL extends HTMLElement {
}
_initViewer() {
if (!this._initialized) {
- this._viewer = new pb(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 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();
try {
this._viewer.updateLights?.();
} catch {
@@ -48414,7 +50809,7 @@ class FL extends HTMLElement {
this._viewer?.scene.remove(n.group);
} catch {
}
- DL(n.group), this._repositionAll(), this.dispatchEvent(new CustomEvent("stage:agent-left", {
+ tP(n.group), this._repositionAll(), this.dispatchEvent(new CustomEvent("stage:agent-left", {
detail: { agentId: n.id, element: n.element },
bubbles: !0,
composed: !0
@@ -48482,7 +50877,7 @@ class FL extends HTMLElement {
if (n === "circle") {
const o = e / t * Math.PI * 2, c = Math.max(0.8, 0.4 * t);
return {
- world: new H(Math.sin(o) * c, 0, -Math.cos(o) * c + c * 0.5),
+ world: new G(Math.sin(o) * c, 0, -Math.cos(o) * c + c * 0.5),
dom: {
left: `${e * s * 100}%`,
top: "0",
@@ -48493,12 +50888,12 @@ class FL extends HTMLElement {
}
if (n === "freeform")
return {
- world: new H(0, 0, 0),
+ 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 H(a, 0, 0),
+ world: new G(a, 0, 0),
dom: {
left: `${e * s * 100}%`,
top: "0",
@@ -48508,7 +50903,7 @@ class FL extends HTMLElement {
};
}
}
-function DL(i) {
+function tP(i) {
i.traverse((e) => {
if (e.geometry)
try {
@@ -48534,23 +50929,23 @@ function DL(i) {
}
}), i.parent && i.parent.remove(i);
}
-customElements.get("agent-stage") || customElements.define("agent-stage", FL);
-const kL = (i = "agent-3d") => {
- customElements.get(i) || customElements.define(i, iE);
+customElements.get("agent-stage") || customElements.define("agent-stage", eP);
+const sP = (i = "agent-3d") => {
+ customElements.get(i) || customElements.define(i, GE);
};
export {
- iE as Agent3DElement,
- FL as AgentStageElement,
- Mi as Memory,
- ET as Runtime,
- CT as SceneController,
- OT as Skill,
- QT as SkillRegistry,
- pb as Viewer,
- kL as defineElement,
- SL as fetchRelative,
- yT as fetchWithFallback,
- Sm as loadManifest,
- nf as normalize,
- wr as resolveURI
+ GE as Agent3DElement,
+ eP 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
};
diff --git a/dist-lib/agent-3d.umd.cjs b/dist-lib/agent-3d.umd.cjs
index b72b8ab08..d09d47e5b 100644
--- a/dist-lib/agent-3d.umd.cjs
+++ b/dist-lib/agent-3d.umd.cjs
@@ -1,8 +1,8 @@
-(function(en,oc){typeof exports=="object"&&typeof module<"u"?oc(exports):typeof define=="function"&&define.amd?define(["exports"],oc):(en=typeof globalThis<"u"?globalThis:en||self,oc(en.Agent3D={}))})(this,(function(en){"use strict";const Nr={ROTATE:0,DOLLY:1,PAN:2},Fr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},fE=0,lp=1,pE=2,hp=1,AE=2,Qi=3,Gi=0,Sn=1,Ii=2,ms=0,Dr=1,up=2,dp=3,fp=4,gE=5,js=100,mE=101,bE=102,xE=103,EE=104,_E=200,yE=201,wE=202,vE=203,fh=204,ph=205,CE=206,SE=207,IE=208,ME=209,BE=210,TE=211,RE=212,NE=213,FE=214,Ah=0,gh=1,mh=2,Lr=3,bh=4,xh=5,Eh=6,_h=7,pp=0,DE=1,LE=2,bs=0,yh=1,PE=2,kE=3,Ap=4,UE=5,OE=6,QE=7,gp="attached",GE="detached",mp=300,Xs=301,Pr=302,wh=303,vh=304,cc=306,kr=1e3,oi=1001,lc=1002,In=1003,bp=1004,Va=1005,zt=1006,hc=1007,Jn=1008,tn=1009,xp=1010,Ep=1011,Wa=1012,Ch=1013,Ys=1014,nn=1015,Mn=1016,Sh=1017,Ih=1018,qa=1020,_p=35902,yp=1021,wp=1022,sn=1023,Ka=1026,ja=1027,Hi=1028,Mh=1029,Js=1030,Bh=1031,Th=1033,uc=33776,Xa=33777,dc=33778,Ya=33779,fc=35840,Rh=35841,pc=35842,Nh=35843,Ac=36196,gc=37492,mc=37496,Ja=37808,Fh=37809,Dh=37810,Lh=37811,Za=37812,Ph=37813,kh=37814,Uh=37815,Oh=37816,Qh=37817,Gh=37818,Hh=37819,zh=37820,Vh=37821,$a=36492,Wh=36494,bc=36495,vp=36283,qh=36284,Kh=36285,jh=36286,Cp=2200,Sp=2201,HE=2202,eo=2300,to=2301,Xh=2302,Ur=2400,Or=2401,xc=2402,Yh=2500,zE=2501,VE=0,Ip=1,Jh=2,WE=3200,qE=3201,Mp=0,KE=1,ci="",Kt="srgb",rn="srgb-linear",Ec="linear",Mt="srgb",Qr=7680,Bp=519,jE=512,XE=513,YE=514,Tp=515,JE=516,ZE=517,$E=518,e_=519,Zh=35044,Rp="300 es",zi=2e3,_c=2001;class xs{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 wn=["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 Np=1234567;const no=Math.PI/180,Gr=180/Math.PI;function li(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(wn[i&255]+wn[i>>8&255]+wn[i>>16&255]+wn[i>>24&255]+"-"+wn[e&255]+wn[e>>8&255]+"-"+wn[e>>16&15|64]+wn[e>>24&255]+"-"+wn[t&63|128]+wn[t>>8&255]+"-"+wn[t>>16&255]+wn[t>>24&255]+wn[n&255]+wn[n>>8&255]+wn[n>>16&255]+wn[n>>24&255]).toLowerCase()}function at(i,e,t){return Math.max(e,Math.min(t,i))}function $h(i,e){return(i%e+e)%e}function t_(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function n_(i,e,t){return i!==e?(t-i)/(e-i):0}function io(i,e,t){return(1-t)*i+t*e}function i_(i,e,t,n){return io(i,e,1-Math.exp(-t*n))}function s_(i,e=1){return e-Math.abs($h(i,e*2)-e)}function r_(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function a_(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function o_(i,e){return i+Math.floor(Math.random()*(e-i+1))}function c_(i,e){return i+Math.random()*(e-i)}function l_(i){return i*(.5-Math.random())}function h_(i){i!==void 0&&(Np=i);let e=Np+=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 u_(i){return i*no}function d_(i){return i*Gr}function f_(i){return(i&i-1)===0&&i!==0}function p_(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function A_(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function g_(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),m=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*m,c*f,o*l);break;case"YXY":i.set(c*f,o*h,c*m,o*l);break;case"ZYZ":i.set(c*m,c*f,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function hi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function It(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 Fp={DEG2RAD:no,RAD2DEG:Gr,generateUUID:li,clamp:at,euclideanModulo:$h,mapLinear:t_,inverseLerp:n_,lerp:io,damp:i_,pingpong:s_,smoothstep:r_,smootherstep:a_,randInt:o_,randFloat:c_,randFloatSpread:l_,seededRandom:h_,degToRad:u_,radToDeg:d_,isPowerOfTwo:f_,ceilPowerOfTwo:p_,floorPowerOfTwo:A_,setQuaternionFromProperEuler:g_,normalize:It,denormalize:hi};class Ze{constructor(e=0,t=0){Ze.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 rt{constructor(e,t,n,s,r,a,o,c,l){rt.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],m=n[8],g=s[0],A=s[3],p=s[6],y=s[1],b=s[4],_=s[7],M=s[2],w=s[5],S=s[8];return r[0]=a*g+o*y+c*M,r[3]=a*A+o*b+c*w,r[6]=a*p+o*_+c*S,r[1]=l*g+h*y+u*M,r[4]=l*A+h*b+u*w,r[7]=l*p+h*_+u*S,r[2]=d*g+f*y+m*M,r[5]=d*A+f*b+m*w,r[8]=d*p+f*_+m*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,m=t*u+n*d+s*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/m;return e[0]=u*g,e[1]=(s*l-h*n)*g,e[2]=(o*n-s*a)*g,e[3]=d*g,e[4]=(h*t-s*c)*g,e[5]=(s*r-o*t)*g,e[6]=f*g,e[7]=(n*c-l*t)*g,e[8]=(a*t-n*r)*g,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(eu.makeScale(e,t)),this}rotate(e){return this.premultiply(eu.makeRotation(-e)),this}translate(e,t){return this.premultiply(eu.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 eu=new rt;function Dp(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function so(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function m_(){const i=so("canvas");return i.style.display="block",i}const Lp={};function yc(i){i in Lp||(Lp[i]=!0,console.warn(i))}function b_(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 x_(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 E_(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 Pp=new rt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),kp=new rt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function __(){const i={enabled:!0,workingColorSpace:rn,spaces:{},convert:function(s,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Mt&&(s.r=Vi(s.r),s.g=Vi(s.g),s.b=Vi(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===Mt&&(s.r=Hr(s.r),s.g=Hr(s.g),s.b=Hr(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===ci?Ec: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({[rn]:{primaries:e,whitePoint:n,transfer:Ec,toXYZ:Pp,fromXYZ:kp,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Kt},outputColorSpaceConfig:{drawingBufferColorSpace:Kt}},[Kt]:{primaries:e,whitePoint:n,transfer:Mt,toXYZ:Pp,fromXYZ:kp,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Kt}}}),i}const At=__();function Vi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Hr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let zr;class y_{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{zr===void 0&&(zr=so("canvas")),zr.width=e.width,zr.height=e.height;const s=zr.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=zr}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=so("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]=Vi(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(Vi(t[n]/255)*255):t[n]=Vi(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 w_=0;class tu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:w_++}),this.uuid=li(),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(nu(s[a].image)):r.push(nu(s[a]))}else r=nu(s);n.url=r}return t||(e.images[this.uuid]=n),n}}function nu(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?y_.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 v_=0;class an extends xs{constructor(e=an.DEFAULT_IMAGE,t=an.DEFAULT_MAPPING,n=oi,s=oi,r=zt,a=Jn,o=sn,c=tn,l=an.DEFAULT_ANISOTROPY,h=ci){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:v_++}),this.uuid=li(),this.name="",this.source=new tu(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 rt,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!==mp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case kr:e.x=e.x-Math.floor(e.x);break;case oi:e.x=e.x<0?0:1;break;case lc: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 kr:e.y=e.y-Math.floor(e.y);break;case oi:e.y=e.y<0?0:1;break;case lc: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++}}an.DEFAULT_IMAGE=null,an.DEFAULT_MAPPING=mp,an.DEFAULT_ANISOTROPY=1;class _t{constructor(e=0,t=0,n=0,s=1){_t.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],m=c[9],g=c[2],A=c[6],p=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-g)<.01&&Math.abs(m-A)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+g)<.1&&Math.abs(m+A)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const b=(l+1)/2,_=(f+1)/2,M=(p+1)/2,w=(h+d)/4,S=(u+g)/4,T=(m+A)/4;return b>_&&b>M?b<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(b),s=w/n,r=S/n):_>M?_<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(_),n=w/s,r=T/s):M<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(M),n=S/r,s=T/r),this.set(n,s,r,t),this}let y=Math.sqrt((A-m)*(A-m)+(u-g)*(u-g)+(d-h)*(d-h));return Math.abs(y)<.001&&(y=1),this.x=(A-m)/y,this.y=(u-g)/y,this.z=(d-h)/y,this.w=Math.acos((l+f+p-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 C_ extends xs{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 _t(0,0,e,t),this.scissorTest=!1,this.viewport=new _t(0,0,e,t);const s={width:e,height:t,depth:this.depth};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},n);const r=new an(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 tu(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 Zs extends C_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Up extends an{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=In,this.minFilter=In,this.wrapR=oi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Op extends an{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=In,this.minFilter=In,this.wrapR=oi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Vn{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],m=r[a+2],g=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]=m,e[t+3]=g;return}if(u!==g||c!==d||l!==f||h!==m){let A=1-o;const p=c*d+l*f+h*m+u*g,y=p>=0?1:-1,b=1-p*p;if(b>Number.EPSILON){const M=Math.sqrt(b),w=Math.atan2(M,p*y);A=Math.sin(A*w)/M,o=Math.sin(o*w)/M}const _=o*y;if(c=c*A+d*_,l=l*A+f*_,h=h*A+m*_,u=u*A+g*_,A===1-o){const M=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=M,l*=M,h*=M,u*=M}}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],m=r[a+3];return e[t]=o*m+h*u+c*f-l*d,e[t+1]=c*m+h*d+l*u-o*f,e[t+2]=l*m+h*f+o*d-c*u,e[t+3]=h*m-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),m=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"YZX":this._x=d*h*u+l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u-d*f*m;break;case"XZY":this._x=d*h*u-l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u+d*f*m;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 H{constructor(e=0,t=0,n=0){H.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(Qp.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qp.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 H,Qp=new Vn;class Mi{constructor(e=new H(1/0,1/0,1/0),t=new H(-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(ui.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(ui.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=ui.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,ui):ui.fromBufferAttribute(r,a),ui.applyMatrix4(e.matrixWorld),this.expandByPoint(ui);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),wc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),wc.copy(n.boundingBox)),wc.applyMatrix4(e.matrixWorld),this.union(wc)}const s=e.children;for(let r=0,a=s.length;r<a;r++)this.expandByObject(s[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ui),ui.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(ro),vc.subVectors(this.max,ro),Vr.subVectors(e.a,ro),Wr.subVectors(e.b,ro),qr.subVectors(e.c,ro),Es.subVectors(Wr,Vr),_s.subVectors(qr,Wr),$s.subVectors(Vr,qr);let t=[0,-Es.z,Es.y,0,-_s.z,_s.y,0,-$s.z,$s.y,Es.z,0,-Es.x,_s.z,0,-_s.x,$s.z,0,-$s.x,-Es.y,Es.x,0,-_s.y,_s.x,0,-$s.y,$s.x,0];return!su(t,Vr,Wr,qr,vc)||(t=[1,0,0,0,1,0,0,0,1],!su(t,Vr,Wr,qr,vc))?!1:(Cc.crossVectors(Es,_s),t=[Cc.x,Cc.y,Cc.z],su(t,Vr,Wr,qr,vc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ui).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ui).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:(Wi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wi),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 Wi=[new H,new H,new H,new H,new H,new H,new H,new H],ui=new H,wc=new Mi,Vr=new H,Wr=new H,qr=new H,Es=new H,_s=new H,$s=new H,ro=new H,vc=new H,Cc=new H,er=new H;function su(i,e,t,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){er.fromArray(i,r);const o=s.x*Math.abs(er.x)+s.y*Math.abs(er.y)+s.z*Math.abs(er.z),c=e.dot(er),l=t.dot(er),h=n.dot(er);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const S_=new Mi,ao=new H,ru=new H;class Bi{constructor(e=new H,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):S_.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;ao.subVectors(e,this.center);const t=ao.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(ao,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):(ru.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ao.copy(e.center).add(ru)),this.expandByPoint(ao.copy(e.center).sub(ru))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const qi=new H,au=new H,Sc=new H,ys=new H,ou=new H,Ic=new H,cu=new H;class oo{constructor(e=new H,t=new H(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,qi)),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=qi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qi.copy(this.origin).addScaledVector(this.direction,t),qi.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){au.copy(e).add(t).multiplyScalar(.5),Sc.copy(t).sub(e).normalize(),ys.copy(this.origin).sub(au);const r=e.distanceTo(t)*.5,a=-this.direction.dot(Sc),o=ys.dot(this.direction),c=-ys.dot(Sc),l=ys.lengthSq(),h=Math.abs(1-a*a);let u,d,f,m;if(h>0)if(u=a*c-o,d=a*o-c,m=r*h,u>=0)if(d>=-m)if(d<=m){const g=1/h;u*=g,d*=g,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<=-m?(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<=m?(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(au).addScaledVector(Sc,d),f}intersectSphere(e,t){qi.subVectors(e.center,this.origin);const n=qi.dot(this.direction),s=qi.dot(qi)-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,qi)!==null}intersectTriangle(e,t,n,s,r){ou.subVectors(t,e),Ic.subVectors(n,e),cu.crossVectors(ou,Ic);let a=this.direction.dot(cu),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ys.subVectors(this.origin,e);const c=o*this.direction.dot(Ic.crossVectors(ys,Ic));if(c<0)return null;const l=o*this.direction.dot(ou.cross(ys));if(l<0||c+l>a)return null;const h=-o*ys.dot(cu);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 et{constructor(e,t,n,s,r,a,o,c,l,h,u,d,f,m,g,A){et.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,m,g,A)}set(e,t,n,s,r,a,o,c,l,h,u,d,f,m,g,A){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=s,p[1]=r,p[5]=a,p[9]=o,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=g,p[15]=A,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 et().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/Kr.setFromMatrixColumn(e,0).length(),r=1/Kr.setFromMatrixColumn(e,1).length(),a=1/Kr.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,m=o*h,g=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+m*l,t[5]=d-g*l,t[9]=-o*c,t[2]=g-d*l,t[6]=m+f*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*h,f=c*u,m=l*h,g=l*u;t[0]=d+g*o,t[4]=m*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-m,t[6]=g+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*h,f=c*u,m=l*h,g=l*u;t[0]=d-g*o,t[4]=-a*u,t[8]=m+f*o,t[1]=f+m*o,t[5]=a*h,t[9]=g-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,m=o*h,g=o*u;t[0]=c*h,t[4]=m*l-f,t[8]=d*l+g,t[1]=c*u,t[5]=g*l+d,t[9]=f*l-m,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,f=a*l,m=o*c,g=o*l;t[0]=c*h,t[4]=g-d*u,t[8]=m*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+m,t[10]=d-g*u}else if(e.order==="XZY"){const d=a*c,f=a*l,m=o*c,g=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+g,t[5]=a*h,t[9]=f*u-m,t[2]=m*u-f,t[6]=o*h,t[10]=g*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(I_,e,M_)}lookAt(e,t,n){const s=this.elements;return Wn.subVectors(e,t),Wn.lengthSq()===0&&(Wn.z=1),Wn.normalize(),ws.crossVectors(n,Wn),ws.lengthSq()===0&&(Math.abs(n.z)===1?Wn.x+=1e-4:Wn.z+=1e-4,Wn.normalize(),ws.crossVectors(n,Wn)),ws.normalize(),Mc.crossVectors(Wn,ws),s[0]=ws.x,s[4]=Mc.x,s[8]=Wn.x,s[1]=ws.y,s[5]=Mc.y,s[9]=Wn.y,s[2]=ws.z,s[6]=Mc.z,s[10]=Wn.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],m=n[2],g=n[6],A=n[10],p=n[14],y=n[3],b=n[7],_=n[11],M=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],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*S+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*S+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]=m*w+g*v+A*$+p*Q,r[6]=m*S+g*F+A*D+p*J,r[10]=m*T+g*K+A*O+p*ee,r[14]=m*C+g*q+A*Y+p*ae,r[3]=y*w+b*v+_*$+M*Q,r[7]=y*S+b*F+_*D+M*J,r[11]=y*T+b*K+_*O+M*ee,r[15]=y*C+b*q+_*Y+M*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],m=e[3],g=e[7],A=e[11],p=e[15];return m*(+r*c*u-s*l*u-r*o*d+n*l*d+s*o*f-n*c*f)+g*(+t*c*f-t*l*d+r*a*d-s*a*f+s*l*h-r*c*h)+A*(+t*l*u-t*o*f-r*a*u+n*a*f+r*o*h-n*l*h)+p*(-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],m=e[12],g=e[13],A=e[14],p=e[15],y=u*A*l-g*d*l+g*c*f-o*A*f-u*c*p+o*d*p,b=m*d*l-h*A*l-m*c*f+a*A*f+h*c*p-a*d*p,_=h*g*l-m*u*l+m*o*f-a*g*f-h*o*p+a*u*p,M=m*u*c-h*g*c-m*o*d+a*g*d+h*o*A-a*u*A,w=t*y+n*b+s*_+r*M;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]=(g*d*r-u*A*r-g*s*f+n*A*f+u*s*p-n*d*p)*S,e[2]=(o*A*r-g*c*r+g*s*l-n*A*l-o*s*p+n*c*p)*S,e[3]=(u*c*r-o*d*r-u*s*l+n*d*l+o*s*f-n*c*f)*S,e[4]=b*S,e[5]=(h*A*r-m*d*r+m*s*f-t*A*f-h*s*p+t*d*p)*S,e[6]=(m*c*r-a*A*r-m*s*l+t*A*l+a*s*p-t*c*p)*S,e[7]=(a*d*r-h*c*r+h*s*l-t*d*l-a*s*f+t*c*f)*S,e[8]=_*S,e[9]=(m*u*r-h*g*r-m*n*f+t*g*f+h*n*p-t*u*p)*S,e[10]=(a*g*r-m*o*r+m*n*l-t*g*l-a*n*p+t*o*p)*S,e[11]=(h*o*r-a*u*r-h*n*l+t*u*l+a*n*f-t*o*f)*S,e[12]=M*S,e[13]=(h*g*s-m*u*s+m*n*d-t*g*d-h*n*A+t*u*A)*S,e[14]=(m*o*s-a*g*s-m*n*c+t*g*c+a*n*A-t*o*A)*S,e[15]=(a*u*s-h*o*s+h*n*c-t*u*c-a*n*d+t*o*d)*S,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,m=r*u,g=a*h,A=a*u,p=o*u,y=c*l,b=c*h,_=c*u,M=n.x,w=n.y,S=n.z;return s[0]=(1-(g+p))*M,s[1]=(f+_)*M,s[2]=(m-b)*M,s[3]=0,s[4]=(f-_)*w,s[5]=(1-(d+p))*w,s[6]=(A+y)*w,s[7]=0,s[8]=(m+b)*S,s[9]=(A-y)*S,s[10]=(1-(d+g))*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=Kr.set(s[0],s[1],s[2]).length();const a=Kr.set(s[4],s[5],s[6]).length(),o=Kr.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],di.copy(this);const l=1/r,h=1/a,u=1/o;return di.elements[0]*=l,di.elements[1]*=l,di.elements[2]*=l,di.elements[4]*=h,di.elements[5]*=h,di.elements[6]*=h,di.elements[8]*=u,di.elements[9]*=u,di.elements[10]*=u,t.setFromRotationMatrix(di),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,s,r,a,o=zi){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,m;if(o===zi)f=-(a+r)/(a-r),m=-2*a*r/(a-r);else if(o===_c)f=-a/(a-r),m=-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]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,s,r,a,o=zi){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 m,g;if(o===zi)m=(a+r)*u,g=-2*u;else if(o===_c)m=r*u,g=-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]=g,c[14]=-m,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 Kr=new H,di=new et,I_=new H(0,0,0),M_=new H(1,1,1),ws=new H,Mc=new H,Wn=new H,Gp=new et,Hp=new Vn;class Ti{constructor(e=0,t=0,n=0,s=Ti.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 Gp.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gp,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Hp.setFromEuler(this),this.setFromQuaternion(Hp,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}}Ti.DEFAULT_ORDER="XYZ";class zp{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 B_=0;const Vp=new H,jr=new Vn,Ki=new et,Bc=new H,co=new H,T_=new H,R_=new Vn,Wp=new H(1,0,0),qp=new H(0,1,0),Kp=new H(0,0,1),jp={type:"added"},N_={type:"removed"},Xr={type:"childadded",child:null},lu={type:"childremoved",child:null};class Pt extends xs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:B_++}),this.uuid=li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Pt.DEFAULT_UP.clone();const e=new H,t=new Ti,n=new Vn,s=new H(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 et},normalMatrix:{value:new rt}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=Pt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new zp,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 jr.setFromAxisAngle(e,t),this.quaternion.multiply(jr),this}rotateOnWorldAxis(e,t){return jr.setFromAxisAngle(e,t),this.quaternion.premultiply(jr),this}rotateX(e){return this.rotateOnAxis(Wp,e)}rotateY(e){return this.rotateOnAxis(qp,e)}rotateZ(e){return this.rotateOnAxis(Kp,e)}translateOnAxis(e,t){return Vp.copy(e).applyQuaternion(this.quaternion),this.position.add(Vp.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Wp,e)}translateY(e){return this.translateOnAxis(qp,e)}translateZ(e){return this.translateOnAxis(Kp,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ki.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Bc.copy(e):Bc.set(e,t,n);const s=this.parent;this.updateWorldMatrix(!0,!1),co.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ki.lookAt(co,Bc,this.up):Ki.lookAt(Bc,co,this.up),this.quaternion.setFromRotationMatrix(Ki),s&&(Ki.extractRotation(s.matrixWorld),jr.setFromRotationMatrix(Ki),this.quaternion.premultiply(jr.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(jp),Xr.child=e,this.dispatchEvent(Xr),Xr.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(N_),lu.child=e,this.dispatchEvent(lu),lu.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),Ki.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ki.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ki),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(jp),Xr.child=e,this.dispatchEvent(Xr),Xr.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(co,e,T_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(co,R_,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),m=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),m.length>0&&(n.nodes=m)}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}}Pt.DEFAULT_UP=new H(0,1,0),Pt.DEFAULT_MATRIX_AUTO_UPDATE=!0,Pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const fi=new H,ji=new H,hu=new H,Xi=new H,Yr=new H,Jr=new H,Xp=new H,uu=new H,du=new H,fu=new H,pu=new _t,Au=new _t,gu=new _t;class pi{constructor(e=new H,t=new H,n=new H){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,s){s.subVectors(n,t),fi.subVectors(e,t),s.cross(fi);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){fi.subVectors(s,t),ji.subVectors(n,t),hu.subVectors(e,t);const a=fi.dot(fi),o=fi.dot(ji),c=fi.dot(hu),l=ji.dot(ji),h=ji.dot(hu),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,m=(a*h-o*c)*d;return r.set(1-f-m,m,f)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,Xi)===null?!1:Xi.x>=0&&Xi.y>=0&&Xi.x+Xi.y<=1}static getInterpolation(e,t,n,s,r,a,o,c){return this.getBarycoord(e,t,n,s,Xi)===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,Xi.x),c.addScaledVector(a,Xi.y),c.addScaledVector(o,Xi.z),c)}static getInterpolatedAttribute(e,t,n,s,r,a){return pu.setScalar(0),Au.setScalar(0),gu.setScalar(0),pu.fromBufferAttribute(e,t),Au.fromBufferAttribute(e,n),gu.fromBufferAttribute(e,s),a.setScalar(0),a.addScaledVector(pu,r.x),a.addScaledVector(Au,r.y),a.addScaledVector(gu,r.z),a}static isFrontFacing(e,t,n,s){return fi.subVectors(n,t),ji.subVectors(e,t),fi.cross(ji).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 fi.subVectors(this.c,this.b),ji.subVectors(this.a,this.b),fi.cross(ji).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return pi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return pi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,r){return pi.getInterpolation(e,this.a,this.b,this.c,t,n,s,r)}containsPoint(e){return pi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return pi.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;Yr.subVectors(s,n),Jr.subVectors(r,n),uu.subVectors(e,n);const c=Yr.dot(uu),l=Jr.dot(uu);if(c<=0&&l<=0)return t.copy(n);du.subVectors(e,s);const h=Yr.dot(du),u=Jr.dot(du);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(Yr,a);fu.subVectors(e,r);const f=Yr.dot(fu),m=Jr.dot(fu);if(m>=0&&f<=m)return t.copy(r);const g=f*l-c*m;if(g<=0&&l>=0&&m<=0)return o=l/(l-m),t.copy(n).addScaledVector(Jr,o);const A=h*m-f*u;if(A<=0&&u-h>=0&&f-m>=0)return Xp.subVectors(r,s),o=(u-h)/(u-h+(f-m)),t.copy(s).addScaledVector(Xp,o);const p=1/(A+g+d);return a=g*p,o=d*p,t.copy(n).addScaledVector(Yr,a).addScaledVector(Jr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Yp={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},vs={h:0,s:0,l:0},Tc={h:0,s:0,l:0};function mu(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 qe=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=Kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,At.toWorkingColorSpace(this,t),this}setRGB(e,t,n,s=At.workingColorSpace){return this.r=e,this.g=t,this.b=n,At.toWorkingColorSpace(this,s),this}setHSL(e,t,n,s=At.workingColorSpace){if(e=$h(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=mu(a,r,e+1/3),this.g=mu(a,r,e),this.b=mu(a,r,e-1/3)}return At.toWorkingColorSpace(this,s),this}setStyle(e,t=Kt){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=Kt){const n=Yp[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=Vi(e.r),this.g=Vi(e.g),this.b=Vi(e.b),this}copyLinearToSRGB(e){return this.r=Hr(e.r),this.g=Hr(e.g),this.b=Hr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Kt){return At.fromWorkingColorSpace(vn.copy(this),e),Math.round(at(vn.r*255,0,255))*65536+Math.round(at(vn.g*255,0,255))*256+Math.round(at(vn.b*255,0,255))}getHexString(e=Kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=At.workingColorSpace){At.fromWorkingColorSpace(vn.copy(this),t);const n=vn.r,s=vn.g,r=vn.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=At.workingColorSpace){return At.fromWorkingColorSpace(vn.copy(this),t),e.r=vn.r,e.g=vn.g,e.b=vn.b,e}getStyle(e=Kt){At.fromWorkingColorSpace(vn.copy(this),e);const t=vn.r,n=vn.g,s=vn.b;return e!==Kt?`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(vs),this.setHSL(vs.h+e,vs.s+t,vs.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(vs),e.getHSL(Tc);const n=io(vs.h,Tc.h,t),s=io(vs.s,Tc.s,t),r=io(vs.l,Tc.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 vn=new qe;qe.NAMES=Yp;let F_=0;class Ri extends xs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:F_++}),this.uuid=li(),this.name="",this.type="Material",this.blending=Dr,this.side=Gi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=fh,this.blendDst=ph,this.blendEquation=js,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new qe(0,0,0),this.blendAlpha=0,this.depthFunc=Lr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Bp,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}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!==Dr&&(n.blending=this.blending),this.side!==Gi&&(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!==fh&&(n.blendSrc=this.blendSrc),this.blendDst!==ph&&(n.blendDst=this.blendDst),this.blendEquation!==js&&(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!==Lr&&(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!==Bp&&(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){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 Cs extends Ri{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new qe(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 Ti,this.combine=pp,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 Yi=D_();function D_(){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 L_(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=at(i,-65504,65504),Yi.floatView[0]=i;const e=Yi.uint32View[0],t=e>>23&511;return Yi.baseTable[t]+((e&8388607)>>Yi.shiftTable[t])}function P_(i){const e=i>>10;return Yi.uint32View[0]=Yi.mantissaTable[Yi.offsetTable[e]+(i&1023)]+Yi.exponentTable[e],Yi.floatView[0]}class Jp{static toHalfFloat(e){return L_(e)}static fromHalfFloat(e){return P_(e)}}const Yt=new H,Rc=new Ze;let k_=0;class En{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:k_++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Zh,this.updateRanges=[],this.gpuType=nn,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++)Rc.fromBufferAttribute(this,t),Rc.applyMatrix3(e),this.setXY(t,Rc.x,Rc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Yt.fromBufferAttribute(this,t),Yt.applyMatrix3(e),this.setXYZ(t,Yt.x,Yt.y,Yt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Yt.fromBufferAttribute(this,t),Yt.applyMatrix4(e),this.setXYZ(t,Yt.x,Yt.y,Yt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Yt.fromBufferAttribute(this,t),Yt.applyNormalMatrix(e),this.setXYZ(t,Yt.x,Yt.y,Yt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Yt.fromBufferAttribute(this,t),Yt.transformDirection(e),this.setXYZ(t,Yt.x,Yt.y,Yt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=hi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=It(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=hi(t,this.array)),t}setX(e,t){return this.normalized&&(t=It(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=hi(t,this.array)),t}setY(e,t){return this.normalized&&(t=It(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=hi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=It(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=hi(t,this.array)),t}setW(e,t){return this.normalized&&(t=It(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=It(t,this.array),n=It(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=It(t,this.array),n=It(n,this.array),s=It(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=It(t,this.array),n=It(n,this.array),s=It(s,this.array),r=It(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!==Zh&&(e.usage=this.usage),e}}class Zp extends En{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class $p extends En{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Bn extends En{constructor(e,t,n){super(new Float32Array(e),t,n)}}let U_=0;const Zn=new et,bu=new Pt,Zr=new H,qn=new Mi,lo=new Mi,fn=new H;class On extends xs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:U_++}),this.uuid=li(),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(Dp(e)?$p:Zp)(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 rt().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 Zn.makeRotationFromQuaternion(e),this.applyMatrix4(Zn),this}rotateX(e){return Zn.makeRotationX(e),this.applyMatrix4(Zn),this}rotateY(e){return Zn.makeRotationY(e),this.applyMatrix4(Zn),this}rotateZ(e){return Zn.makeRotationZ(e),this.applyMatrix4(Zn),this}translate(e,t,n){return Zn.makeTranslation(e,t,n),this.applyMatrix4(Zn),this}scale(e,t,n){return Zn.makeScale(e,t,n),this.applyMatrix4(Zn),this}lookAt(e){return bu.lookAt(e),bu.updateMatrix(),this.applyMatrix4(bu.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.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 Bn(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 Mi);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 H(-1/0,-1/0,-1/0),new H(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];qn.setFromBufferAttribute(r),this.morphTargetsRelative?(fn.addVectors(this.boundingBox.min,qn.min),this.boundingBox.expandByPoint(fn),fn.addVectors(this.boundingBox.max,qn.max),this.boundingBox.expandByPoint(fn)):(this.boundingBox.expandByPoint(qn.min),this.boundingBox.expandByPoint(qn.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 Bi);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 H,1/0);return}if(e){const n=this.boundingSphere.center;if(qn.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];lo.setFromBufferAttribute(o),this.morphTargetsRelative?(fn.addVectors(qn.min,lo.min),qn.expandByPoint(fn),fn.addVectors(qn.max,lo.max),qn.expandByPoint(fn)):(qn.expandByPoint(lo.min),qn.expandByPoint(lo.max))}qn.getCenter(n);let s=0;for(let r=0,a=e.count;r<a;r++)fn.fromBufferAttribute(e,r),s=Math.max(s,n.distanceToSquared(fn));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++)fn.fromBufferAttribute(o,l),c&&(Zr.fromBufferAttribute(e,l),fn.add(Zr)),s=Math.max(s,n.distanceToSquared(fn))}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 En(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let T=0;T<n.count;T++)o[T]=new H,c[T]=new H;const l=new H,h=new H,u=new H,d=new Ze,f=new Ze,m=new Ze,g=new H,A=new H;function p(T,C,v){l.fromBufferAttribute(n,T),h.fromBufferAttribute(n,C),u.fromBufferAttribute(n,v),d.fromBufferAttribute(r,T),f.fromBufferAttribute(r,C),m.fromBufferAttribute(r,v),h.sub(l),u.sub(l),f.sub(d),m.sub(d);const F=1/(f.x*m.y-m.x*f.y);isFinite(F)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(F),A.copy(u).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(F),o[T].add(g),o[C].add(g),o[v].add(g),c[T].add(A),c[C].add(A),c[v].add(A))}let y=this.groups;y.length===0&&(y=[{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 q=F,$=F+K;q<$;q+=3)p(e.getX(q+0),e.getX(q+1),e.getX(q+2))}const b=new H,_=new H,M=new H,w=new H;function S(T){M.fromBufferAttribute(s,T),w.copy(M);const C=o[T];b.copy(C),b.sub(M.multiplyScalar(M.dot(C))).normalize(),_.crossVectors(w,C);const F=_.dot(c[T])<0?-1:1;a.setXYZW(T,b.x,b.y,b.z,F)}for(let T=0,C=y.length;T<C;++T){const v=y[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 En(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 H,r=new H,a=new H,o=new H,c=new H,l=new H,h=new H,u=new H;if(e)for(let d=0,f=e.count;d<f;d+=3){const m=e.getX(d+0),g=e.getX(d+1),A=e.getX(d+2);s.fromBufferAttribute(t,m),r.fromBufferAttribute(t,g),a.fromBufferAttribute(t,A),h.subVectors(a,r),u.subVectors(s,r),h.cross(u),o.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),l.fromBufferAttribute(n,A),o.add(h),c.add(h),l.add(h),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(g,c.x,c.y,c.z),n.setXYZ(A,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++)fn.fromBufferAttribute(e,t),fn.normalize(),e.setXYZ(t,fn.x,fn.y,fn.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,m=0;for(let g=0,A=c.length;g<A;g++){o.isInterleavedBufferAttribute?f=c[g]*o.data.stride+o.offset:f=c[g]*h;for(let p=0;p<h;p++)d[m++]=l[f++]}return new En(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new On,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 eA=new et,tr=new oo,Nc=new Bi,tA=new H,Fc=new H,Dc=new H,Lc=new H,xu=new H,Pc=new H,nA=new H,kc=new H;class Jt extends Pt{constructor(e=new On,t=new Cs){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){Pc.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const h=o[c],u=r[c];h!==0&&(xu.fromBufferAttribute(u,e),a?Pc.addScaledVector(xu,h):Pc.addScaledVector(xu.sub(t),h))}t.add(Pc)}return t}raycast(e,t){const n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Nc.copy(n.boundingSphere),Nc.applyMatrix4(r),tr.copy(e.ray).recast(e.near),!(Nc.containsPoint(tr.origin)===!1&&(tr.intersectSphere(Nc,tA)===null||tr.origin.distanceToSquared(tA)>(e.far-e.near)**2))&&(eA.copy(r).invert(),tr.copy(e.ray).applyMatrix4(eA),!(n.boundingBox!==null&&tr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,tr)))}_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 m=0,g=d.length;m<g;m++){const A=d[m],p=a[A.materialIndex],y=Math.max(A.start,f.start),b=Math.min(o.count,Math.min(A.start+A.count,f.start+f.count));for(let _=y,M=b;_<M;_+=3){const w=o.getX(_),S=o.getX(_+1),T=o.getX(_+2);s=Uc(this,p,e,n,l,h,u,w,S,T),s&&(s.faceIndex=Math.floor(_/3),s.face.materialIndex=A.materialIndex,t.push(s))}}else{const m=Math.max(0,f.start),g=Math.min(o.count,f.start+f.count);for(let A=m,p=g;A<p;A+=3){const y=o.getX(A),b=o.getX(A+1),_=o.getX(A+2);s=Uc(this,a,e,n,l,h,u,y,b,_),s&&(s.faceIndex=Math.floor(A/3),t.push(s))}}else if(c!==void 0)if(Array.isArray(a))for(let m=0,g=d.length;m<g;m++){const A=d[m],p=a[A.materialIndex],y=Math.max(A.start,f.start),b=Math.min(c.count,Math.min(A.start+A.count,f.start+f.count));for(let _=y,M=b;_<M;_+=3){const w=_,S=_+1,T=_+2;s=Uc(this,p,e,n,l,h,u,w,S,T),s&&(s.faceIndex=Math.floor(_/3),s.face.materialIndex=A.materialIndex,t.push(s))}}else{const m=Math.max(0,f.start),g=Math.min(c.count,f.start+f.count);for(let A=m,p=g;A<p;A+=3){const y=A,b=A+1,_=A+2;s=Uc(this,a,e,n,l,h,u,y,b,_),s&&(s.faceIndex=Math.floor(A/3),t.push(s))}}}}function O_(i,e,t,n,s,r,a,o){let c;if(e.side===Sn?c=n.intersectTriangle(a,r,s,!0,o):c=n.intersectTriangle(s,r,a,e.side===Gi,o),c===null)return null;kc.copy(o),kc.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(kc);return l<t.near||l>t.far?null:{distance:l,point:kc.clone(),object:i}}function Uc(i,e,t,n,s,r,a,o,c,l){i.getVertexPosition(o,Fc),i.getVertexPosition(c,Dc),i.getVertexPosition(l,Lc);const h=O_(i,e,t,n,Fc,Dc,Lc,nA);if(h){const u=new H;pi.getBarycoord(nA,Fc,Dc,Lc,u),s&&(h.uv=pi.getInterpolatedAttribute(s,o,c,l,u,new Ze)),r&&(h.uv1=pi.getInterpolatedAttribute(r,o,c,l,u,new Ze)),a&&(h.normal=pi.getInterpolatedAttribute(a,o,c,l,u,new H),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new H,materialIndex:0};pi.getNormal(Fc,Dc,Lc,d.normal),h.face=d,h.barycoord=u}return h}class $r extends On{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;m("z","y","x",-1,-1,n,t,e,a,r,0),m("z","y","x",1,-1,n,t,-e,a,r,1),m("x","z","y",1,1,e,n,t,s,a,2),m("x","z","y",1,-1,e,n,-t,s,a,3),m("x","y","z",1,-1,e,t,n,s,r,4),m("x","y","z",-1,-1,e,t,-n,s,r,5),this.setIndex(c),this.setAttribute("position",new Bn(l,3)),this.setAttribute("normal",new Bn(h,3)),this.setAttribute("uv",new Bn(u,2));function m(g,A,p,y,b,_,M,w,S,T,C){const v=_/S,F=M/T,K=_/2,q=M/2,$=w/2,D=S+1,O=T+1;let Y=0,Q=0;const J=new H;for(let ee=0;ee<O;ee++){const ae=ee*F-q;for(let ye=0;ye<D;ye++){const Me=ye*v-K;J[g]=Me*y,J[A]=ae*b,J[p]=$,l.push(J.x,J.y,J.z),J[g]=0,J[A]=0,J[p]=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 ee=0;ee<T;ee++)for(let ae=0;ae<S;ae++){const ye=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(ye,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 $r(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ea(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 Tn(i){const e={};for(let t=0;t<i.length;t++){const n=ea(i[t]);for(const s in n)e[s]=n[s]}return e}function Q_(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:At.workingColorSpace}const G_={clone:ea,merge:Tn};var H_=`void main() {
+(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[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,I=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*I;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]=_*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}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,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() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-}`,z_=`void main() {
+}`,I_=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
-}`;class Ss extends Ri{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=H_,this.fragmentShader=z_,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=ea(e.uniforms),this.uniformsGroups=Q_(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 sA extends Pt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new et,this.projectionMatrix=new et,this.projectionMatrixInverse=new et,this.coordinateSystem=zi}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 Is=new H,rA=new Ze,aA=new Ze;class Cn extends sA{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=Gr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(no*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Gr*2*Math.atan(Math.tan(no*.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){Is.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Is.x,Is.y).multiplyScalar(-e/Is.z),Is.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Is.x,Is.y).multiplyScalar(-e/Is.z)}getViewSize(e,t){return this.getViewBounds(e,rA,aA),t.subVectors(aA,rA)}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(no*.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 ta=-90,na=1;class V_ extends Pt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Cn(ta,na,e,t);s.layers=this.layers,this.add(s);const r=new Cn(ta,na,e,t);r.layers=this.layers,this.add(r);const a=new Cn(ta,na,e,t);a.layers=this.layers,this.add(a);const o=new Cn(ta,na,e,t);o.layers=this.layers,this.add(o);const c=new Cn(ta,na,e,t);c.layers=this.layers,this.add(c);const l=new Cn(ta,na,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===zi)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===_c)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(),m=e.xr.enabled;e.xr.enabled=!1;const g=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=g,e.setRenderTarget(n,5,s),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class oA extends an{constructor(e=[],t=Xs,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 W_ extends Zs{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 oA(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:zt}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 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:`
varying vec3 vWorldDirection;
@@ -37,9 +37,9 @@
gl_FragColor = texture2D( tEquirect, sampleUV );
}
- `},s=new $r(5,5,5),r=new Ss({name:"CubemapFromEquirect",uniforms:ea(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Sn,blending:ms});r.uniforms.tEquirect.value=t;const a=new Jt(s,r),o=t.minFilter;return t.minFilter===Jn&&(t.minFilter=zt),new V_(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 nr extends Pt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const q_={type:"move"};class Eu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new nr,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 nr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new nr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H),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 g of e.hand.values()){const A=t.getJointPose(g,n),p=this._getHandJoint(l,g);A!==null&&(p.matrix.fromArray(A.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=A.radius),p.visible=A!==null}const h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;l.inputState.pinching&&d>f+m?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-m&&(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(q_)))}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 nr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class _u extends Pt{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 Ti,this.environmentIntensity=1,this.environmentRotation=new Ti,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 K_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Zh,this.updateRanges=[],this.version=0,this.uuid=li()}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=li()),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=li()),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 Rn=new H;class yu{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++)Rn.fromBufferAttribute(this,t),Rn.applyMatrix4(e),this.setXYZ(t,Rn.x,Rn.y,Rn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Rn.fromBufferAttribute(this,t),Rn.applyNormalMatrix(e),this.setXYZ(t,Rn.x,Rn.y,Rn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Rn.fromBufferAttribute(this,t),Rn.transformDirection(e),this.setXYZ(t,Rn.x,Rn.y,Rn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=hi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=It(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=It(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=It(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=It(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=It(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=hi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=hi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=hi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=hi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=It(t,this.array),n=It(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=It(t,this.array),n=It(n,this.array),s=It(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=It(t,this.array),n=It(n,this.array),s=It(s,this.array),r=It(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 En(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 yu(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 cA=new H,lA=new _t,hA=new _t,j_=new H,uA=new et,Oc=new H,wu=new Bi,dA=new et,vu=new oo;class X_ extends Jt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=gp,this.bindMatrix=new et,this.bindMatrixInverse=new et,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Mi),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Oc),this.boundingBox.expandByPoint(Oc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Bi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Oc),this.boundingSphere.expandByPoint(Oc)}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(),wu.copy(this.boundingSphere),wu.applyMatrix4(s),e.ray.intersectsSphere(wu)!==!1&&(dA.copy(s).invert(),vu.copy(e.ray).applyMatrix4(dA),!(this.boundingBox!==null&&vu.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,vu)))}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 _t,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===gp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===GE?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,s=this.geometry;lA.fromBufferAttribute(s.attributes.skinIndex,e),hA.fromBufferAttribute(s.attributes.skinWeight,e),cA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=hA.getComponent(r);if(a!==0){const o=lA.getComponent(r);uA.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(j_.copy(cA).applyMatrix4(uA),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class fA extends Pt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Qc extends an{constructor(e=null,t=1,n=1,s,r,a,o,c,l=In,h=In,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 pA=new et,Y_=new et;class Cu{constructor(e=[],t=[]){this.uuid=li(),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 et)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new et;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:Y_;pA.multiplyMatrices(o,t[r]),pA.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new Cu(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 Qc(t,e,e,sn,nn);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 fA),this.bones.push(a),this.boneInverses.push(new et().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 Su extends En{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 ia=new et,AA=new et,Gc=[],gA=new Mi,J_=new et,ho=new Jt,uo=new Bi;class mA extends Jt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Su(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,J_)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Mi),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ia),gA.copy(e.boundingBox).applyMatrix4(ia),this.boundingBox.union(gA)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Bi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ia),uo.copy(e.boundingSphere).applyMatrix4(ia),this.boundingSphere.union(uo)}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(ho.geometry=this.geometry,ho.material=this.material,ho.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),uo.copy(this.boundingSphere),uo.applyMatrix4(n),e.ray.intersectsSphere(uo)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,ia),AA.multiplyMatrices(n,ia),ho.matrixWorld=AA,ho.raycast(e,Gc);for(let a=0,o=Gc.length;a<o;a++){const c=Gc[a];c.instanceId=r,c.object=this,t.push(c)}Gc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Su(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 Qc(new Float32Array(s*this.count),s,this.count,Hi,nn));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 Iu=new H,Z_=new H,$_=new rt;class Ms{constructor(e=new H(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=Iu.subVectors(n,t).cross(Z_.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(Iu),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||$_.getNormalMatrix(e),s=this.coplanarPoint(Iu).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 ir=new Bi,Hc=new H;class Mu{constructor(e=new Ms,t=new Ms,n=new Ms,s=new Ms,r=new Ms,a=new Ms){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=zi){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],m=s[9],g=s[10],A=s[11],p=s[12],y=s[13],b=s[14],_=s[15];if(n[0].setComponents(c-r,d-l,A-f,_-p).normalize(),n[1].setComponents(c+r,d+l,A+f,_+p).normalize(),n[2].setComponents(c+a,d+h,A+m,_+y).normalize(),n[3].setComponents(c-a,d-h,A-m,_-y).normalize(),n[4].setComponents(c-o,d-u,A-g,_-b).normalize(),t===zi)n[5].setComponents(c+o,d+u,A+g,_+b).normalize();else if(t===_c)n[5].setComponents(o,u,g,b).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(),ir.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ir.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ir)}intersectsSprite(e){return ir.center.set(0,0,0),ir.radius=.7071067811865476,ir.applyMatrix4(e.matrixWorld),this.intersectsSphere(ir)}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(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)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 fo extends Ri{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new qe(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 zc=new H,Vc=new H,bA=new et,po=new oo,Wc=new Bi,Bu=new H,xA=new H;class Tu extends Pt{constructor(e=new On,t=new fo){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++)zc.fromBufferAttribute(t,s-1),Vc.fromBufferAttribute(t,s),n[s]=n[s-1],n[s]+=zc.distanceTo(Vc);e.setAttribute("lineDistance",new Bn(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(),Wc.copy(n.boundingSphere),Wc.applyMatrix4(s),Wc.radius+=r,e.ray.intersectsSphere(Wc)===!1)return;bA.copy(s).invert(),po.copy(e.ray).applyMatrix4(bA);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),m=Math.min(h.count,a.start+a.count);for(let g=f,A=m-1;g<A;g+=l){const p=h.getX(g),y=h.getX(g+1),b=qc(this,e,po,c,p,y,g);b&&t.push(b)}if(this.isLineLoop){const g=h.getX(m-1),A=h.getX(f),p=qc(this,e,po,c,g,A,m-1);p&&t.push(p)}}else{const f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let g=f,A=m-1;g<A;g+=l){const p=qc(this,e,po,c,g,g+1,g);p&&t.push(p)}if(this.isLineLoop){const g=qc(this,e,po,c,m-1,f,m-1);g&&t.push(g)}}}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 qc(i,e,t,n,s,r,a){const o=i.geometry.attributes.position;if(zc.fromBufferAttribute(o,s),Vc.fromBufferAttribute(o,r),t.distanceSqToSegment(zc,Vc,Bu,xA)>n)return;Bu.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Bu);if(!(l<e.near||l>e.far))return{distance:l,point:xA.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const EA=new H,_A=new H;class Kc extends Tu{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)EA.fromBufferAttribute(t,s),_A.fromBufferAttribute(t,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+EA.distanceTo(_A);e.setAttribute("lineDistance",new Bn(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ey extends Tu{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ru extends Ri{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new qe(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 et,Nu=new oo,jc=new Bi,Xc=new H;class ty extends Pt{constructor(e=new On,t=new Ru){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(),jc.copy(n.boundingSphere),jc.applyMatrix4(s),jc.radius+=r,e.ray.intersectsSphere(jc)===!1)return;yA.copy(s).invert(),Nu.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 m=d,g=f;m<g;m++){const A=l.getX(m);Xc.fromBufferAttribute(u,A),wA(Xc,A,c,s,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let m=d,g=f;m<g;m++)Xc.fromBufferAttribute(u,m),wA(Xc,m,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 wA(i,e,t,n,s,r,a){const o=Nu.distanceSqToPoint(i);if(o<t){const c=new H;Nu.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 Yc extends an{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 ny extends Yc{constructor(e,t,n,s,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=oi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class iy extends Yc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Xs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class vA extends an{constructor(e,t,n=Ys,s,r,a,o=In,c=In,l,h=Ka){if(h!==Ka&&h!==ja)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 tu(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 Jc extends On{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=[],m=[],g=[],A=[];for(let p=0;p<h;p++){const y=p*d-a;for(let b=0;b<l;b++){const _=b*u-r;m.push(_,-y,0),g.push(0,0,1),A.push(b/o),A.push(1-p/c)}}for(let p=0;p<c;p++)for(let y=0;y<o;y++){const b=y+l*p,_=y+l*(p+1),M=y+1+l*(p+1),w=y+1+l*p;f.push(b,_,w),f.push(_,M,w)}this.setIndex(f),this.setAttribute("position",new Bn(m,3)),this.setAttribute("normal",new Bn(g,3)),this.setAttribute("uv",new Bn(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jc(e.width,e.height,e.widthSegments,e.heightSegments)}}class Ao extends Ri{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new qe(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 qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mp,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 Ti,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 Ni extends Ao{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 Ze(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 qe(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 qe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new qe(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 sy extends Ri{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=WE,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 ry 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 Zc(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function ay(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function oy(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 CA(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 SA(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 go{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 cy extends go{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:Ur,endingEnd:Ur}}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 Or:r=e,o=2*t-n;break;case xc: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 Or:a=e,c=2*n-t;break;case xc: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,m=(n-t)/(s-t),g=m*m,A=g*m,p=-d*A+2*d*g-d*m,y=(1+d)*A+(-1.5-2*d)*g+(-.5+d)*m+1,b=(-1-f)*A+(1.5+f)*g+.5*m,_=f*A-f*g;for(let M=0;M!==o;++M)r[M]=p*a[h+M]+y*a[l+M]+b*a[c+M]+_*a[u+M];return r}}class IA extends go{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 ly extends go{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class Ai{constructor(e,t,n,s){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Zc(t,this.TimeBufferType),this.values=Zc(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Zc(e.times,Array),values:Zc(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(n.interpolation=s)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new ly(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new IA(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new cy(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case eo:t=this.InterpolantFactoryMethodDiscrete;break;case to:t=this.InterpolantFactoryMethodLinear;break;case Xh: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 eo;case this.InterpolantFactoryMethodLinear:return to;case this.InterpolantFactoryMethodSmooth:return Xh}}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&&ay(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()===Xh,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 m=0;m!==n;++m){const g=t[u+m];if(g!==t[d+m]||g!==t[f+m]){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}}Ai.prototype.ValueTypeName="",Ai.prototype.TimeBufferType=Float32Array,Ai.prototype.ValueBufferType=Float32Array,Ai.prototype.DefaultInterpolation=to;class sa extends Ai{constructor(e,t,n){super(e,t,n)}}sa.prototype.ValueTypeName="bool",sa.prototype.ValueBufferType=Array,sa.prototype.DefaultInterpolation=eo,sa.prototype.InterpolantFactoryMethodLinear=void 0,sa.prototype.InterpolantFactoryMethodSmooth=void 0;class MA extends Ai{constructor(e,t,n,s){super(e,t,n,s)}}MA.prototype.ValueTypeName="color";class ra extends Ai{constructor(e,t,n,s){super(e,t,n,s)}}ra.prototype.ValueTypeName="number";class hy extends go{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)Vn.slerpFlat(r,0,a,l-o,a,l,c);return r}}class aa extends Ai{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new hy(this.times,this.values,this.getValueSize(),e)}}aa.prototype.ValueTypeName="quaternion",aa.prototype.InterpolantFactoryMethodSmooth=void 0;class oa extends Ai{constructor(e,t,n){super(e,t,n)}}oa.prototype.ValueTypeName="string",oa.prototype.ValueBufferType=Array,oa.prototype.DefaultInterpolation=eo,oa.prototype.InterpolantFactoryMethodLinear=void 0,oa.prototype.InterpolantFactoryMethodSmooth=void 0;class ca extends Ai{constructor(e,t,n,s){super(e,t,n,s)}}ca.prototype.ValueTypeName="vector";class Fu{constructor(e="",t=-1,n=[],s=Yh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=s,this.uuid=li(),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(dy(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(Ai.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=oy(c);c=CA(c,1,h),l=CA(l,1,h),!s&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new ra(".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,m,g){if(f.length!==0){const A=[],p=[];SA(f,A,p,m),A.length!==0&&g.push(new u(d,A,p))}},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 m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let g=0;g<d[m].morphTargets.length;g++)f[d[m].morphTargets[g]]=-1;for(const g in f){const A=[],p=[];for(let y=0;y!==d[m].morphTargets.length;++y){const b=d[m];A.push(b.time),p.push(b.morphTarget===g?1:0)}s.push(new ra(".morphTargetInfluence["+g+"]",A,p))}c=f.length*a}else{const f=".bones["+t[u].name+"]";n(ca,f+".position",d,"pos",s),n(aa,f+".quaternion",d,"rot",s),n(ca,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 uy(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ra;case"vector":case"vector2":case"vector3":case"vector4":return ca;case"color":return MA;case"quaternion":return aa;case"bool":case"boolean":return sa;case"string":return oa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function dy(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=uy(i.type);if(i.times===void 0){const t=[],n=[];SA(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 Ji={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 BA{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],m=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return m}return null}}}const fy=new BA;class Zi{constructor(e){this.manager=e!==void 0?e:fy,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}}Zi.DEFAULT_MATERIAL_NAME="__DEFAULT";const $i={};class py extends Error{constructor(e,t){super(e),this.response=t}}class Bs extends Zi{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=Ji.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if($i[e]!==void 0){$i[e].push({onLoad:t,onProgress:n,onError:s});return}$i[e]=[],$i[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=$i[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,m=f!==0;let g=0;const A=new ReadableStream({start(p){y();function y(){u.read().then(({done:b,value:_})=>{if(b)p.close();else{g+=_.byteLength;const M=new ProgressEvent("progress",{lengthComputable:m,loaded:g,total:f});for(let w=0,S=h.length;w<S;w++){const T=h[w];T.onProgress&&T.onProgress(M)}p.enqueue(_),y()}},b=>{p.error(b)})}}});return new Response(A)}else throw new py(`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(m=>f.decode(m))}}}).then(l=>{Ji.add(e,l);const h=$i[e];delete $i[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{const h=$i[e];if(h===void 0)throw this.manager.itemError(e),l;delete $i[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 Ay extends Zi{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=Ji.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o=so("img");function c(){h(),Ji.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 gy extends Zi{constructor(e){super(e)}load(e,t,n,s){const r=this,a=new Qc,o=new Bs(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:oi,a.wrapT=l.wrapT!==void 0?l.wrapT:oi,a.magFilter=l.magFilter!==void 0?l.magFilter:zt,a.minFilter=l.minFilter!==void 0?l.minFilter:zt,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=Jn),l.mipmapCount===1&&(a.minFilter=zt),l.generateMipmaps!==void 0&&(a.generateMipmaps=l.generateMipmaps),a.needsUpdate=!0,t&&t(a,l)},n,s),a}}class my extends Zi{constructor(e){super(e)}load(e,t,n,s){const r=new an,a=new Ay(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 mo extends Pt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new qe(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 by extends mo{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Pt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new qe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Du=new et,TA=new H,RA=new H;class Lu{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=tn,this.map=null,this.mapPass=null,this.matrix=new et,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Mu,this._frameExtents=new Ze(1,1),this._viewportCount=1,this._viewports=[new _t(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;TA.setFromMatrixPosition(e.matrixWorld),t.position.copy(TA),RA.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(RA),t.updateMatrixWorld(),Du.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Du),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Du)}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 xy extends Lu{constructor(){super(new Cn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=Gr*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 Ey extends mo{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(Pt.DEFAULT_UP),this.updateMatrix(),this.target=new Pt,this.distance=n,this.angle=s,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new xy}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 NA=new et,bo=new H,Pu=new H;class _y extends Lu{constructor(){super(new Cn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ze(4,2),this._viewportCount=6,this._viewports=[new _t(2,1,1,1),new _t(0,1,1,1),new _t(3,1,1,1),new _t(1,1,1,1),new _t(3,0,1,1),new _t(1,0,1,1)],this._cubeDirections=[new H(1,0,0),new H(-1,0,0),new H(0,0,1),new H(0,0,-1),new H(0,1,0),new H(0,-1,0)],this._cubeUps=[new H(0,1,0),new H(0,1,0),new H(0,1,0),new H(0,1,0),new H(0,0,1),new H(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()),bo.setFromMatrixPosition(e.matrixWorld),n.position.copy(bo),Pu.copy(n.position),Pu.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Pu),n.updateMatrixWorld(),s.makeTranslation(-bo.x,-bo.y,-bo.z),NA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(NA)}}class FA extends mo{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 _y}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 ku extends sA{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 yy extends Lu{constructor(){super(new ku(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DA extends mo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Pt.DEFAULT_UP),this.updateMatrix(),this.target=new Pt,this.shadow=new yy}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class wy extends mo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class la{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 vy extends Zi{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=Ji.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 Ji.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){s&&s(l),Ji.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Ji.add(e,c),r.manager.itemStart(e)}}class Cy extends Cn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Sy{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){Vn.slerpFlat(e,t,e,t,e,n,s)}_slerpAdditive(e,t,n,s,r){const a=this._workIndex*r;Vn.multiplyQuaternionsFlat(e,a,e,t,e,n),Vn.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 Uu="\\[\\]\\.:\\/",Iy=new RegExp("["+Uu+"]","g"),Ou="[^"+Uu+"]",My="[^"+Uu.replace("\\.","")+"]",By=/((?:WC+[\/:])*)/.source.replace("WC",Ou),Ty=/(WCOD+)?/.source.replace("WCOD",My),Ry=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ou),Ny=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ou),Fy=new RegExp("^"+By+Ty+Ry+Ny+"$"),Dy=["material","materials","bones","map"];class Ly{constructor(e,t,n){const s=n||vt.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 vt{constructor(e,t,n){this.path=t,this.parsedPath=n||vt.parseTrackName(t),this.node=vt.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 vt.Composite(e,t,n):new vt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Iy,"")}static parseTrackName(e){const t=Fy.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);Dy.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=vt.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}}vt.Composite=Ly,vt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},vt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},vt.prototype.GetterByBindingType=[vt.prototype._getValue_direct,vt.prototype._getValue_array,vt.prototype._getValue_arrayElement,vt.prototype._getValue_toArray],vt.prototype.SetterByBindingTypeAndVersioning=[[vt.prototype._setValue_direct,vt.prototype._setValue_direct_setNeedsUpdate,vt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[vt.prototype._setValue_array,vt.prototype._setValue_array_setNeedsUpdate,vt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[vt.prototype._setValue_arrayElement,vt.prototype._setValue_arrayElement_setNeedsUpdate,vt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[vt.prototype._setValue_fromArray,vt.prototype._setValue_fromArray_setNeedsUpdate,vt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Py{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:Ur,endingEnd:Ur};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=Sp,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 zE:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Yh: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===HE;if(e===0)return r===-1?s:a&&(r&1)===1?t-s:s;if(n===Cp){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=Or,s.endingEnd=Or):(e?s.endingStart=this.zeroSlopeAtStart?Or:Ur:s.endingStart=xc,t?s.endingEnd=this.zeroSlopeAtEnd?Or:Ur:s.endingEnd=xc)}_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 ky=new Float32Array(1);class LA extends xs{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 m=h[f];if(m!==void 0)++m.referenceCount,a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,c,f));continue}const g=t&&t._propertyBindings[u].binding.parsedPath;m=new Sy(vt.create(n,f,g),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,c,f),a[u]=m}o[u].resultBuffer=m.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 IA(new Float32Array(2),new Float32Array(2),1,ky),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"?Fu.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=Yh),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 Py(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"?Fu.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 PA{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 Ts=new H,$c=new et,Qu=new et;class Uy extends Kc{constructor(e){const t=kA(e),n=new On,s=[],r=[],a=new qe(0,0,1),o=new qe(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 Bn(s,3)),n.setAttribute("color",new Bn(r,3));const c=new fo({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");Qu.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<t.length;r++){const o=t[r];o.parent&&o.parent.isBone&&($c.multiplyMatrices(Qu,o.matrixWorld),Ts.setFromMatrixPosition($c),s.setXYZ(a,Ts.x,Ts.y,Ts.z),$c.multiplyMatrices(Qu,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)}dispose(){this.geometry.dispose(),this.material.dispose()}}function kA(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push(...kA(i.children[t]));return e}class Oy extends Kc{constructor(e=10,t=10,n=4473924,s=8947848){n=new qe(n),s=new qe(s);const r=t/2,a=e/t,o=e/2,c=[],l=[];for(let d=0,f=0,m=-o;d<=t;d++,m+=a){c.push(-o,0,m,o,0,m),c.push(m,0,-o,m,0,o);const g=d===r?n:s;g.toArray(l,f),f+=3,g.toArray(l,f),f+=3,g.toArray(l,f),f+=3,g.toArray(l,f),f+=3}const h=new On;h.setAttribute("position",new Bn(c,3)),h.setAttribute("color",new Bn(l,3));const u=new fo({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class UA extends Kc{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 On;s.setAttribute("position",new Bn(t,3)),s.setAttribute("color",new Bn(n,3));const r=new fo({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,t,n){const s=new qe,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 Qy extends xs{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 OA(i,e,t,n){const s=Gy(n);switch(t){case yp:return i*e;case Hi:return i*e/s.components*s.byteLength;case Mh:return i*e/s.components*s.byteLength;case Js:return i*e*2/s.components*s.byteLength;case Bh:return i*e*2/s.components*s.byteLength;case wp:return i*e*3/s.components*s.byteLength;case sn:return i*e*4/s.components*s.byteLength;case Th:return i*e*4/s.components*s.byteLength;case uc:case Xa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case dc:case Ya:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Rh:case Nh:return Math.max(i,16)*Math.max(e,8)/4;case fc:case pc:return Math.max(i,8)*Math.max(e,8)/2;case Ac:case gc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case mc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Ja:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Fh:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Dh:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case Za:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Ph:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case kh:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Uh:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Qh:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Gh:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Hh:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case zh:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case $a:case Wh:case bc:return Math.ceil(i/4)*Math.ceil(e/4)*16;case vp:case qh:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Kh:case jh:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Gy(i){switch(i){case tn:case xp:return{byteLength:1,components:1};case Wa:case Ep:case Mn:return{byteLength:2,components:1};case Sh:case Ih:return{byteLength:2,components:4};case Ys:case Ch:case nn:return{byteLength:4,components:1};case _p:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"176"}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="176");function QA(){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 Hy(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,m)=>f.start-m.start);let d=0;for(let f=1;f<u.length;f++){const m=u[d],g=u[f];g.start<=m.start+m.count+1?m.count=Math.max(m.count,g.start+g.count-m.start):(++d,u[d]=g)}u.length=d+1;for(let f=0,m=u.length;f<m;f++){const g=u[f];i.bufferSubData(l,g.start*h.BYTES_PER_ELEMENT,h,g.start,g.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 zy=`#ifdef USE_ALPHAHASH
+ `},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
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
-#endif`,Vy=`#ifdef USE_ALPHAHASH
+#endif`,Vw=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -74,20 +74,20 @@
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
-#endif`,Wy=`#ifdef USE_ALPHAMAP
+#endif`,Ww=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
-#endif`,qy=`#ifdef USE_ALPHAMAP
+#endif`,qw=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,Ky=`#ifdef USE_ALPHATEST
+#endif`,Kw=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
-#endif`,jy=`#ifdef USE_ALPHATEST
+#endif`,jw=`#ifdef USE_ALPHATEST
uniform float alphaTest;
-#endif`,Xy=`#ifdef USE_AOMAP
+#endif`,Xw=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
@@ -100,10 +100,10 @@
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
-#endif`,Yy=`#ifdef USE_AOMAP
+#endif`,Yw=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
-#endif`,Jy=`#ifdef USE_BATCHING
+#endif`,Jw=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
@@ -137,15 +137,15 @@
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
-#endif`,Zy=`#ifdef USE_BATCHING
+#endif`,Zw=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
-#endif`,$y=`vec3 transformed = vec3( position );
+#endif`,$w=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
-#endif`,ew=`vec3 objectNormal = vec3( normal );
+#endif`,ev=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
-#endif`,tw=`float G_BlinnPhong_Implicit( ) {
+#endif`,tv=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -159,7 +159,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
-} // validated`,nw=`#ifdef USE_IRIDESCENCE
+} // validated`,nv=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
@@ -222,7 +222,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
}
return max( I, vec3( 0.0 ) );
}
-#endif`,iw=`#ifdef USE_BUMPMAP
+#endif`,iv=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
@@ -243,7 +243,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
-#endif`,sw=`#if NUM_CLIPPING_PLANES > 0
+#endif`,sv=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
@@ -289,26 +289,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
if ( clipped ) discard;
#endif
#endif
-#endif`,rw=`#if NUM_CLIPPING_PLANES > 0
+#endif`,rv=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
-#endif`,aw=`#if NUM_CLIPPING_PLANES > 0
+#endif`,av=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
-#endif`,ow=`#if NUM_CLIPPING_PLANES > 0
+#endif`,ov=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
-#endif`,cw=`#if defined( USE_COLOR_ALPHA )
+#endif`,cv=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
-#endif`,lw=`#if defined( USE_COLOR_ALPHA )
+#endif`,lv=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
-#endif`,hw=`#if defined( USE_COLOR_ALPHA )
+#endif`,hv=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
-#endif`,uw=`#if defined( USE_COLOR_ALPHA )
+#endif`,uv=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec3( 1.0 );
@@ -322,7 +322,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
-#endif`,dw=`#define PI 3.141592653589793
+#endif`,dv=`#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`,fw=`#ifdef ENVMAP_TYPE_CUBE_UV
+} // validated`,fv=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
@@ -489,7 +489,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
-#endif`,pw=`vec3 transformedNormal = objectNormal;
+#endif`,pv=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
@@ -518,21 +518,21 @@ transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
-#endif`,Aw=`#ifdef USE_DISPLACEMENTMAP
+#endif`,Av=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
-#endif`,gw=`#ifdef USE_DISPLACEMENTMAP
+#endif`,gv=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
-#endif`,mw=`#ifdef USE_EMISSIVEMAP
+#endif`,mv=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
-#endif`,bw=`#ifdef USE_EMISSIVEMAP
+#endif`,xv=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
-#endif`,xw="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ew=`vec4 LinearTransferOETF( in vec4 value ) {
+#endif`,bv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ev=`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 );
-}`,_w=`#ifdef USE_ENVMAP
+}`,yv=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
@@ -569,7 +569,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
-#endif`,yw=`#ifdef USE_ENVMAP
+#endif`,_v=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
@@ -579,7 +579,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform sampler2D envMap;
#endif
-#endif`,ww=`#ifdef USE_ENVMAP
+#endif`,wv=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
@@ -590,7 +590,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
varying vec3 vReflect;
#endif
-#endif`,vw=`#ifdef USE_ENVMAP
+#endif`,vv=`#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`,Cw=`#ifdef USE_ENVMAP
+#endif`,Cv=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
@@ -618,18 +618,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
-#endif`,Sw=`#ifdef USE_FOG
+#endif`,Sv=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
-#endif`,Iw=`#ifdef USE_FOG
+#endif`,Iv=`#ifdef USE_FOG
varying float vFogDepth;
-#endif`,Mw=`#ifdef USE_FOG
+#endif`,Mv=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
-#endif`,Bw=`#ifdef USE_FOG
+#endif`,Bv=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
@@ -638,7 +638,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform float fogNear;
uniform float fogFar;
#endif
-#endif`,Tw=`#ifdef USE_GRADIENTMAP
+#endif`,Tv=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -650,12 +650,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
-}`,Rw=`#ifdef USE_LIGHTMAP
+}`,Rv=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
-#endif`,Nw=`LambertMaterial material;
+#endif`,Fv=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
-material.specularStrength = specularStrength;`,Fw=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,Dv=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
@@ -669,7 +669,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Dw=`uniform bool receiveShadow;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Nv=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
@@ -785,7 +785,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
-#endif`,Lw=`#ifdef USE_ENVMAP
+#endif`,Lv=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -818,8 +818,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
#endif
}
#endif
-#endif`,Pw=`ToonMaterial material;
-material.diffuseColor = diffuseColor.rgb;`,kw=`varying vec3 vViewPosition;
+#endif`,Pv=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,kv=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
@@ -831,11 +831,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Uw=`BlinnPhongMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Uv=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
-material.specularStrength = specularStrength;`,Ow=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,Ov=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
@@ -852,7 +852,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Qw=`PhysicalMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Qv=`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`,Gw=`struct PhysicalMaterial {
+#endif`,Gv=`struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
@@ -1239,7 +1239,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
-}`,Hw=`
+}`,Hv=`
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`,zw=`#if defined( RE_IndirectDiffuse )
+#endif`,zv=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1373,32 +1373,32 @@ IncidentLight directLight;
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
-#endif`,Vw=`#if defined( RE_IndirectDiffuse )
+#endif`,Vv=`#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`,Ww=`#if defined( USE_LOGDEPTHBUF )
+#endif`,Wv=`#if defined( USE_LOGDEPTHBUF )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
-#endif`,qw=`#if defined( USE_LOGDEPTHBUF )
+#endif`,qv=`#if defined( USE_LOGDEPTHBUF )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,Kw=`#ifdef USE_LOGDEPTHBUF
+#endif`,Kv=`#ifdef USE_LOGDEPTHBUF
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,jw=`#ifdef USE_LOGDEPTHBUF
+#endif`,jv=`#ifdef USE_LOGDEPTHBUF
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
-#endif`,Xw=`#ifdef USE_MAP
+#endif`,Xv=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
-#endif`,Yw=`#ifdef USE_MAP
+#endif`,Yv=`#ifdef USE_MAP
uniform sampler2D map;
-#endif`,Jw=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+#endif`,Jv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
@@ -1410,7 +1410,7 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
-#endif`,Zw=`#if defined( USE_POINTS_UV )
+#endif`,Zv=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1422,19 +1422,19 @@ IncidentLight directLight;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,$w=`float metalnessFactor = metalness;
+#endif`,$v=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
-#endif`,ev=`#ifdef USE_METALNESSMAP
+#endif`,eC=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
-#endif`,tv=`#ifdef USE_INSTANCING_MORPH
+#endif`,tC=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
-#endif`,nv=`#if defined( USE_MORPHCOLORS )
+#endif`,nC=`#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`,iv=`#ifdef USE_MORPHNORMALS
+#endif`,iC=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,sv=`#ifdef USE_MORPHTARGETS
+#endif`,sC=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1462,12 +1462,12 @@ IncidentLight directLight;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
-#endif`,rv=`#ifdef USE_MORPHTARGETS
+#endif`,rC=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,av=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#endif`,aC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
@@ -1508,7 +1508,7 @@ IncidentLight directLight;
tbn2[1] *= faceDirection;
#endif
#endif
-vec3 nonPerturbedNormal = normal;`,ov=`#ifdef USE_NORMALMAP_OBJECTSPACE
+vec3 nonPerturbedNormal = normal;`,oC=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
@@ -1523,25 +1523,25 @@ vec3 nonPerturbedNormal = normal;`,ov=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
-#endif`,cv=`#ifndef FLAT_SHADED
+#endif`,cC=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,lv=`#ifndef FLAT_SHADED
+#endif`,lC=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,hv=`#ifndef FLAT_SHADED
+#endif`,hC=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
-#endif`,uv=`#ifdef USE_NORMALMAP
+#endif`,uC=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
@@ -1563,13 +1563,13 @@ vec3 nonPerturbedNormal = normal;`,ov=`#ifdef USE_NORMALMAP_OBJECTSPACE
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
-#endif`,dv=`#ifdef USE_CLEARCOAT
+#endif`,dC=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
-#endif`,fv=`#ifdef USE_CLEARCOAT_NORMALMAP
+#endif`,fC=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
-#endif`,pv=`#ifdef USE_CLEARCOATMAP
+#endif`,pC=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
@@ -1578,18 +1578,18 @@ vec3 nonPerturbedNormal = normal;`,ov=`#ifdef USE_NORMALMAP_OBJECTSPACE
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
-#endif`,Av=`#ifdef USE_IRIDESCENCEMAP
+#endif`,AC=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
-#endif`,gv=`#ifdef OPAQUE
+#endif`,gC=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,mv=`vec3 packNormalToRGB( const in vec3 normal ) {
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,mC=`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 );
-}`,bv=`#ifdef PREMULTIPLIED_ALPHA
+}`,xC=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
-#endif`,xv=`vec4 mvPosition = vec4( transformed, 1.0 );
+#endif`,bC=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
@@ -1668,22 +1668,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
-gl_Position = projectionMatrix * mvPosition;`,Ev=`#ifdef DITHERING
+gl_Position = projectionMatrix * mvPosition;`,EC=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
-#endif`,_v=`#ifdef DITHERING
+#endif`,yC=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
-#endif`,yv=`float roughnessFactor = roughness;
+#endif`,_C=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
-#endif`,wv=`#ifdef USE_ROUGHNESSMAP
+#endif`,wC=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
-#endif`,vv=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,vC=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
@@ -1869,7 +1869,7 @@ gl_Position = projectionMatrix * mvPosition;`,Ev=`#ifdef DITHERING
}
return mix( 1.0, shadow, shadowIntensity );
}
-#endif`,Cv=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,CC=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
@@ -1910,7 +1910,7 @@ gl_Position = projectionMatrix * mvPosition;`,Ev=`#ifdef DITHERING
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
-#endif`,Sv=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+#endif`,SC=`#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;`,Ev=`#ifdef DITHERING
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
-#endif`,Iv=`float getShadowMask() {
+#endif`,IC=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
@@ -1974,12 +1974,12 @@ gl_Position = projectionMatrix * mvPosition;`,Ev=`#ifdef DITHERING
#endif
#endif
return shadow;
-}`,Mv=`#ifdef USE_SKINNING
+}`,MC=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
-#endif`,Bv=`#ifdef USE_SKINNING
+#endif`,BC=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
@@ -1994,7 +1994,7 @@ gl_Position = projectionMatrix * mvPosition;`,Ev=`#ifdef DITHERING
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
-#endif`,Tv=`#ifdef USE_SKINNING
+#endif`,TC=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2002,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,Ev=`#ifdef DITHERING
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
-#endif`,Rv=`#ifdef USE_SKINNING
+#endif`,RC=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
@@ -2013,17 +2013,17 @@ gl_Position = projectionMatrix * mvPosition;`,Ev=`#ifdef DITHERING
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
-#endif`,Nv=`float specularStrength;
+#endif`,FC=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
-#endif`,Fv=`#ifdef USE_SPECULARMAP
+#endif`,DC=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
-#endif`,Dv=`#if defined( TONE_MAPPING )
+#endif`,NC=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
-#endif`,Lv=`#ifndef saturate
+#endif`,LC=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
@@ -2120,7 +2120,7 @@ vec3 NeutralToneMapping( vec3 color ) {
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
-vec3 CustomToneMapping( vec3 color ) { return color; }`,Pv=`#ifdef USE_TRANSMISSION
+vec3 CustomToneMapping( vec3 color ) { return color; }`,PC=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
@@ -2141,7 +2141,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Pv=`#ifdef USE_TRANSMISS
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
-#endif`,kv=`#ifdef USE_TRANSMISSION
+#endif`,kC=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
@@ -2267,7 +2267,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Pv=`#ifdef USE_TRANSMISS
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
-#endif`,Uv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,UC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2337,7 +2337,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Pv=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,Ov=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,OC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2431,7 +2431,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Pv=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,Qv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,QC=`#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; }`,Pv=`#ifdef USE_TRANSMISS
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
-#endif`,Gv=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+#endif`,GC=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
@@ -2511,7 +2511,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Pv=`#ifdef USE_TRANSMISS
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
-#endif`;const ot={alphahash_fragment:zy,alphahash_pars_fragment:Vy,alphamap_fragment:Wy,alphamap_pars_fragment:qy,alphatest_fragment:Ky,alphatest_pars_fragment:jy,aomap_fragment:Xy,aomap_pars_fragment:Yy,batching_pars_vertex:Jy,batching_vertex:Zy,begin_vertex:$y,beginnormal_vertex:ew,bsdfs:tw,iridescence_fragment:nw,bumpmap_pars_fragment:iw,clipping_planes_fragment:sw,clipping_planes_pars_fragment:rw,clipping_planes_pars_vertex:aw,clipping_planes_vertex:ow,color_fragment:cw,color_pars_fragment:lw,color_pars_vertex:hw,color_vertex:uw,common:dw,cube_uv_reflection_fragment:fw,defaultnormal_vertex:pw,displacementmap_pars_vertex:Aw,displacementmap_vertex:gw,emissivemap_fragment:mw,emissivemap_pars_fragment:bw,colorspace_fragment:xw,colorspace_pars_fragment:Ew,envmap_fragment:_w,envmap_common_pars_fragment:yw,envmap_pars_fragment:ww,envmap_pars_vertex:vw,envmap_physical_pars_fragment:Lw,envmap_vertex:Cw,fog_vertex:Sw,fog_pars_vertex:Iw,fog_fragment:Mw,fog_pars_fragment:Bw,gradientmap_pars_fragment:Tw,lightmap_pars_fragment:Rw,lights_lambert_fragment:Nw,lights_lambert_pars_fragment:Fw,lights_pars_begin:Dw,lights_toon_fragment:Pw,lights_toon_pars_fragment:kw,lights_phong_fragment:Uw,lights_phong_pars_fragment:Ow,lights_physical_fragment:Qw,lights_physical_pars_fragment:Gw,lights_fragment_begin:Hw,lights_fragment_maps:zw,lights_fragment_end:Vw,logdepthbuf_fragment:Ww,logdepthbuf_pars_fragment:qw,logdepthbuf_pars_vertex:Kw,logdepthbuf_vertex:jw,map_fragment:Xw,map_pars_fragment:Yw,map_particle_fragment:Jw,map_particle_pars_fragment:Zw,metalnessmap_fragment:$w,metalnessmap_pars_fragment:ev,morphinstance_vertex:tv,morphcolor_vertex:nv,morphnormal_vertex:iv,morphtarget_pars_vertex:sv,morphtarget_vertex:rv,normal_fragment_begin:av,normal_fragment_maps:ov,normal_pars_fragment:cv,normal_pars_vertex:lv,normal_vertex:hv,normalmap_pars_fragment:uv,clearcoat_normal_fragment_begin:dv,clearcoat_normal_fragment_maps:fv,clearcoat_pars_fragment:pv,iridescence_pars_fragment:Av,opaque_fragment:gv,packing:mv,premultiplied_alpha_fragment:bv,project_vertex:xv,dithering_fragment:Ev,dithering_pars_fragment:_v,roughnessmap_fragment:yv,roughnessmap_pars_fragment:wv,shadowmap_pars_fragment:vv,shadowmap_pars_vertex:Cv,shadowmap_vertex:Sv,shadowmask_pars_fragment:Iv,skinbase_vertex:Mv,skinning_pars_vertex:Bv,skinning_vertex:Tv,skinnormal_vertex:Rv,specularmap_fragment:Nv,specularmap_pars_fragment:Fv,tonemapping_fragment:Dv,tonemapping_pars_fragment:Lv,transmission_fragment:Pv,transmission_pars_fragment:kv,uv_pars_fragment:Uv,uv_pars_vertex:Ov,uv_vertex:Qv,worldpos_vertex:Gv,background_vert:`varying vec2 vUv;
+#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;
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 qe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rt}},envmap:{envMap:{value:null},envMapRotation:{value:new rt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new rt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rt},normalScale:{value:new Ze(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new qe(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 qe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0},uvTransform:{value:new rt}},sprite:{diffuse:{value:new qe(16777215)},opacity:{value:1},center:{value:new Ze(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}}},Fi={basic:{uniforms:Tn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:ot.meshbasic_vert,fragmentShader:ot.meshbasic_frag},lambert:{uniforms:Tn([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 qe(0)}}]),vertexShader:ot.meshlambert_vert,fragmentShader:ot.meshlambert_frag},phong:{uniforms:Tn([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 qe(0)},specular:{value:new qe(1118481)},shininess:{value:30}}]),vertexShader:ot.meshphong_vert,fragmentShader:ot.meshphong_frag},standard:{uniforms:Tn([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 qe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ot.meshphysical_vert,fragmentShader:ot.meshphysical_frag},toon:{uniforms:Tn([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new qe(0)}}]),vertexShader:ot.meshtoon_vert,fragmentShader:ot.meshtoon_frag},matcap:{uniforms:Tn([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:ot.meshmatcap_vert,fragmentShader:ot.meshmatcap_frag},points:{uniforms:Tn([we.points,we.fog]),vertexShader:ot.points_vert,fragmentShader:ot.points_frag},dashed:{uniforms:Tn([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ot.linedashed_vert,fragmentShader:ot.linedashed_frag},depth:{uniforms:Tn([we.common,we.displacementmap]),vertexShader:ot.depth_vert,fragmentShader:ot.depth_frag},normal:{uniforms:Tn([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:ot.meshnormal_vert,fragmentShader:ot.meshnormal_frag},sprite:{uniforms:Tn([we.sprite,we.fog]),vertexShader:ot.sprite_vert,fragmentShader:ot.sprite_frag},background:{uniforms:{uvTransform:{value:new rt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ot.background_vert,fragmentShader:ot.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new rt}},vertexShader:ot.backgroundCube_vert,fragmentShader:ot.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ot.cube_vert,fragmentShader:ot.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ot.equirect_vert,fragmentShader:ot.equirect_frag},distanceRGBA:{uniforms:Tn([we.common,we.displacementmap,{referencePosition:{value:new H},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ot.distanceRGBA_vert,fragmentShader:ot.distanceRGBA_frag},shadow:{uniforms:Tn([we.lights,we.fog,{color:{value:new qe(0)},opacity:{value:1}}]),vertexShader:ot.shadow_vert,fragmentShader:ot.shadow_frag}};Fi.physical={uniforms:Tn([Fi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rt},clearcoatNormalScale:{value:new Ze(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rt},sheen:{value:0},sheenColor:{value:new qe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rt},transmissionSamplerSize:{value:new Ze},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rt},attenuationDistance:{value:0},attenuationColor:{value:new qe(0)},specularColor:{value:new qe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rt},anisotropyVector:{value:new Ze},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rt}}]),vertexShader:ot.meshphysical_vert,fragmentShader:ot.meshphysical_frag};const el={r:0,b:0,g:0},sr=new Ti,Hv=new et;function zv(i,e,t,n,s,r,a){const o=new qe(0);let c=r===!0?0:1,l,h,u=null,d=0,f=null;function m(b){let _=b.isScene===!0?b.background:null;return _&&_.isTexture&&(_=(b.backgroundBlurriness>0?t:e).get(_)),_}function g(b){let _=!1;const M=m(b);M===null?p(o,c):M&&M.isColor&&(p(M,1),_=!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||_)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function A(b,_){const M=m(_);M&&(M.isCubeTexture||M.mapping===cc)?(h===void 0&&(h=new Jt(new $r(1,1,1),new Ss({name:"BackgroundCubeMaterial",uniforms:ea(Fi.backgroundCube.uniforms),vertexShader:Fi.backgroundCube.vertexShader,fragmentShader:Fi.backgroundCube.fragmentShader,side:Sn,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)),sr.copy(_.backgroundRotation),sr.x*=-1,sr.y*=-1,sr.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(sr.y*=-1,sr.z*=-1),h.material.uniforms.envMap.value=M,h.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Hv.makeRotationFromEuler(sr)),h.material.toneMapped=At.getTransfer(M.colorSpace)!==Mt,(u!==M||d!==M.version||f!==i.toneMapping)&&(h.material.needsUpdate=!0,u=M,d=M.version,f=i.toneMapping),h.layers.enableAll(),b.unshift(h,h.geometry,h.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new Jt(new Jc(2,2),new Ss({name:"BackgroundMaterial",uniforms:ea(Fi.background.uniforms),vertexShader:Fi.background.vertexShader,fragmentShader:Fi.background.fragmentShader,side:Gi,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=M,l.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,l.material.toneMapped=At.getTransfer(M.colorSpace)!==Mt,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(u!==M||d!==M.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=M,d=M.version,f=i.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null))}function p(b,_){b.getRGB(el,iA(i)),n.buffers.color.setClear(el.r,el.g,el.b,_,a)}function y(){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(b,_=1){o.set(b),c=_,p(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(b){c=b,p(o,c)},render:g,addToRenderList:A,dispose:y}}function Vv(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&&m(v,q,K,$),$!==null&&e.update($,i.ELEMENT_ARRAY_BUFFER),(D||a)&&(a=!1,_(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 m(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 g(){const v=r.newAttributes;for(let F=0,K=v.length;F<K;F++)v[F]=0}function A(v){p(v,0)}function p(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 y(){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 b(v,F,K,q,$,D,O){O===!0?i.vertexAttribIPointer(v,F,K,$,D):i.vertexAttribPointer(v,F,K,q,$,D)}function _(v,F,K,q){g();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,be=se===i.INT||se===i.UNSIGNED_INT||J.gpuType===Ch;if(J.isInterleavedBufferAttribute){const xe=J.data,Pe=xe.stride,$e=J.offset;if(xe.isInstancedInterleavedBuffer){for(let Qe=0;Qe<Q.locationSize;Qe++)p(Q.location+Qe,xe.meshPerAttribute);v.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=xe.meshPerAttribute*xe.count)}else for(let Qe=0;Qe<Q.locationSize;Qe++)A(Q.location+Qe);i.bindBuffer(i.ARRAY_BUFFER,Me);for(let Qe=0;Qe<Q.locationSize;Qe++)b(Q.location+Qe,ae/Q.locationSize,se,ee,Pe*me,($e+ae/Q.locationSize*Qe)*me,be)}else{if(J.isInstancedBufferAttribute){for(let xe=0;xe<Q.locationSize;xe++)p(Q.location+xe,J.meshPerAttribute);v.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let xe=0;xe<Q.locationSize;xe++)A(Q.location+xe);i.bindBuffer(i.ARRAY_BUFFER,Me);for(let xe=0;xe<Q.locationSize;xe++)b(Q.location+xe,ae/Q.locationSize,se,ee,ae*me,ae/Q.locationSize*xe*me,be)}}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)}}}}y()}function M(){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:M,releaseStatesOfGeometry:w,releaseStatesOfProgram:S,initAttributes:g,enableAttribute:A,disableUnusedAttributes:y}}function Wv(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 m=0;m<u;m++)f+=h[m];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 m=0;m<l.length;m++)a(l[m],h[m],d[m]);else{f.multiDrawArraysInstancedWEBGL(n,l,0,h,0,d,0,u);let m=0;for(let g=0;g<u;g++)m+=h[g]*d[g];t.update(m,n,1)}}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function qv(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!==sn&&n.convert(S)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(S){const T=S===Mn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(S!==tn&&n.convert(S)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&S!==nn&&!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),m=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_TEXTURE_SIZE),A=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),y=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),b=i.getParameter(i.MAX_VARYING_VECTORS),_=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),M=m>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:m,maxTextureSize:g,maxCubemapSize:A,maxAttributes:p,maxVertexUniforms:y,maxVaryings:b,maxFragmentUniforms:_,vertexTextures:M,maxSamples:w}}function Kv(i){const e=this;let t=null,n=0,s=!1,r=!1;const a=new Ms,o=new rt,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 m=u.clippingPlanes,g=u.clipIntersection,A=u.clipShadows,p=i.get(u);if(!s||m===null||m.length===0||r&&!A)r?h(null):l();else{const y=r?0:n,b=y*4;let _=p.clippingState||null;c.value=_,_=h(m,d,b,f);for(let M=0;M!==b;++M)_[M]=t[M];p.clippingState=_,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=y}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,m){const g=u!==null?u.length:0;let A=null;if(g!==0){if(A=c.value,m!==!0||A===null){const p=f+g*4,y=d.matrixWorldInverse;o.getNormalMatrix(y),(A===null||A.length<p)&&(A=new Float32Array(p));for(let b=0,_=f;b!==g;++b,_+=4)a.copy(u[b]).applyMatrix4(y,o),a.normal.toArray(A,_),A[_+3]=a.constant}c.value=A,c.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,A}}function jv(i){let e=new WeakMap;function t(a,o){return o===wh?a.mapping=Xs:o===vh&&(a.mapping=Pr),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===wh||o===vh)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 W_(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 ha=4,GA=[.125,.215,.35,.446,.526,.582],rr=20,Gu=new ku,HA=new qe;let Hu=null,zu=0,Vu=0,Wu=!1;const ar=(1+Math.sqrt(5))/2,ua=1/ar,zA=[new H(-ar,ua,0),new H(ar,ua,0),new H(-ua,0,ar),new H(ua,0,ar),new H(0,ar,-ua),new H(0,ar,ua),new H(-1,1,-1),new H(1,1,-1),new H(-1,1,1),new H(1,1,1)],Xv=new H;class qu{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=Xv}=r;Hu=this._renderer.getRenderTarget(),zu=this._renderer.getActiveCubeFace(),Vu=this._renderer.getActiveMipmapLevel(),Wu=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=qA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=WA(),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(Hu,zu,Vu),this._renderer.xr.enabled=Wu,e.scissorTest=!1,tl(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Xs||e.mapping===Pr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Hu=this._renderer.getRenderTarget(),zu=this._renderer.getActiveCubeFace(),Vu=this._renderer.getActiveMipmapLevel(),Wu=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:zt,minFilter:zt,generateMipmaps:!1,type:Mn,format:sn,colorSpace:rn,depthBuffer:!1},s=VA(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=VA(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Yv(r)),this._blurMaterial=Jv(r,e,t)}return s}_compileMaterial(e){const t=new Jt(this._lodPlanes[0],e);this._renderer.compile(t,Gu)}_sceneToCubeUV(e,t,n,s,r){const c=new Cn(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(HA),u.toneMapping=bs,u.autoClear=!1;const m=new Cs({name:"PMREM.Background",side:Sn,depthWrite:!1,depthTest:!1}),g=new Jt(new $r,m);let A=!1;const p=e.background;p?p.isColor&&(m.color.copy(p),e.background=null,A=!0):(m.color.copy(HA),A=!0);for(let y=0;y<6;y++){const b=y%3;b===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)):b===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]));const _=this._cubeSize;tl(s,b*_,y>2?_:0,_,_),u.setRenderTarget(s),A&&u.render(g,c),u.render(e,c)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,s=e.mapping===Xs||e.mapping===Pr;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=qA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=WA());const r=s?this._cubemapMaterial:this._equirectMaterial,a=new Jt(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=e;const c=this._cubeSize;tl(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Gu)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const s=this._lodPlanes.length;for(let r=1;r<s;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=zA[(s-r-1)%zA.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 Jt(this._lodPlanes[s],l),d=l.uniforms,f=this._sizeLods[n]-1,m=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*rr-1),g=r/m,A=isFinite(r)?1+Math.floor(h*g):rr;A>rr&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to ${rr}`);const p=[];let y=0;for(let S=0;S<rr;++S){const T=S/g,C=Math.exp(-T*T/2);p.push(C),S===0?y+=C:S<A&&(y+=2*C)}for(let S=0;S<p.length;S++)p[S]=p[S]/y;d.envMap.value=e.texture,d.samples.value=A,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:b}=this;d.dTheta.value=m,d.mipInt.value=b-n;const _=this._sizeLods[s],M=3*_*(s>b-ha?s-b+ha:0),w=4*(this._cubeSize-_);tl(t,M,w,3*_,2*_),c.setRenderTarget(t),c.render(u,Gu)}}function Yv(i){const e=[],t=[],n=[];let s=i;const r=i-ha+1+GA.length;for(let a=0;a<r;a++){const o=Math.pow(2,s);t.push(o);let c=1/o;a>i-ha?c=GA[a-i+ha-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,m=6,g=3,A=2,p=1,y=new Float32Array(g*m*f),b=new Float32Array(A*m*f),_=new Float32Array(p*m*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];y.set(C,g*m*w),b.set(d,A*m*w);const v=[w,w,w,w,w,w];_.set(v,p*m*w)}const M=new On;M.setAttribute("position",new En(y,g)),M.setAttribute("uv",new En(b,A)),M.setAttribute("faceIndex",new En(_,p)),e.push(M),s>ha&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function VA(i,e,t){const n=new Zs(i,e,t);return n.texture.mapping=cc,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function tl(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function Jv(i,e,t){const n=new Float32Array(rr),s=new H(0,1,0);return new Ss({name:"SphericalGaussianBlur",defines:{n:rr,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:Ku(),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 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:`
precision mediump float;
precision mediump int;
@@ -3623,7 +3623,7 @@ void main() {
}
}
- `,blending:ms,depthTest:!1,depthWrite:!1})}function WA(){return new Ss({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ku(),fragmentShader:`
+ `,blending:vs,depthTest:!1,depthWrite:!1})}function wg(){return new Ns({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:bd(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3642,7 +3642,7 @@ void main() {
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
- `,blending:ms,depthTest:!1,depthWrite:!1})}function qA(){return new Ss({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ku(),fragmentShader:`
+ `,blending:vs,depthTest:!1,depthWrite:!1})}function vg(){return new Ns({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:bd(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3658,7 +3658,7 @@ void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
- `,blending:ms,depthTest:!1,depthWrite:!1})}function Ku(){return`
+ `,blending:vs,depthTest:!1,depthWrite:!1})}function bd(){return`
precision mediump float;
precision mediump int;
@@ -3713,17 +3713,17 @@ void main() {
gl_Position = vec4( position, 1.0 );
}
- `}function Zv(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===wh||c===vh,h=c===Xs||c===Pr;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 qu(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 qu(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 $v(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&&yc("THREE.WebGLRenderer: "+n+" extension not supported."),s}}}function eC(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 m in d.attributes)e.remove(d.attributes[m]);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,m=u.attributes.position;let g=0;if(f!==null){const y=f.array;g=f.version;for(let b=0,_=y.length;b<_;b+=3){const M=y[b+0],w=y[b+1],S=y[b+2];d.push(M,w,w,S,S,M)}}else if(m!==void 0){const y=m.array;g=m.version;for(let b=0,_=y.length/3-1;b<_;b+=3){const M=b+0,w=b+1,S=b+2;d.push(M,w,w,S,S,M)}}else return;const A=new(Dp(d)?$p:Zp)(d,1);A.version=g;const p=r.get(u);p&&e.remove(p),r.set(u,A)}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 tC(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,m){m!==0&&(i.drawElementsInstanced(n,f,r,d*a,m),t.update(f,n,m))}function h(d,f,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,r,d,0,m);let A=0;for(let p=0;p<m;p++)A+=f[p];t.update(A,n,1)}function u(d,f,m,g){if(m===0)return;const A=e.get("WEBGL_multi_draw");if(A===null)for(let p=0;p<d.length;p++)l(d[p]/a,f[p],g[p]);else{A.multiDrawElementsInstancedWEBGL(n,f,0,r,d,0,g,0,m);let p=0;for(let y=0;y<m;y++)p+=f[y]*g[y];t.update(p,n,1)}}this.setMode=s,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function nC(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 iC(i,e,t){const n=new WeakMap,s=new _t;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,m=o.morphAttributes.normal!==void 0,g=o.morphAttributes.color!==void 0,A=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],y=o.morphAttributes.color||[];let b=0;f===!0&&(b=1),m===!0&&(b=2),g===!0&&(b=3);let _=o.attributes.position.count*b,M=1;_>e.maxTextureSize&&(M=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const w=new Float32Array(_*M*4*u),S=new Up(w,_,M,u);S.type=nn,S.needsUpdate=!0;const T=b*4;for(let v=0;v<u;v++){const F=A[v],K=p[v],q=y[v],$=_*M*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),m===!0&&(s.fromBufferAttribute(K,D),w[$+O+4]=s.x,w[$+O+5]=s.y,w[$+O+6]=s.z,w[$+O+7]=0),g===!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(_,M)},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 g=0;g<l.length;g++)f+=l[g];const m=o.morphTargetsRelative?1:1-f;c.getUniforms().setValue(i,"morphTargetBaseInfluence",m),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 sC(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 KA=new an,jA=new vA(1,1),XA=new Up,YA=new Op,JA=new oA,ZA=[],$A=[],eg=new Float32Array(16),tg=new Float32Array(9),ng=new Float32Array(4);function da(i,e,t){const n=i[0];if(n<=0||n>0)return i;const s=e*t;let r=ZA[s];if(r===void 0&&(r=new Float32Array(s),ZA[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 on(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 cn(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function nl(i,e){let t=$A[e];t===void 0&&(t=new Int32Array(e),$A[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function rC(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function aC(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(on(t,e))return;i.uniform2fv(this.addr,e),cn(t,e)}}function oC(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(on(t,e))return;i.uniform3fv(this.addr,e),cn(t,e)}}function cC(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(on(t,e))return;i.uniform4fv(this.addr,e),cn(t,e)}}function lC(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(on(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),cn(t,e)}else{if(on(t,n))return;ng.set(n),i.uniformMatrix2fv(this.addr,!1,ng),cn(t,n)}}function hC(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(on(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),cn(t,e)}else{if(on(t,n))return;tg.set(n),i.uniformMatrix3fv(this.addr,!1,tg),cn(t,n)}}function uC(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(on(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),cn(t,e)}else{if(on(t,n))return;eg.set(n),i.uniformMatrix4fv(this.addr,!1,eg),cn(t,n)}}function dC(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function fC(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(on(t,e))return;i.uniform2iv(this.addr,e),cn(t,e)}}function pC(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(on(t,e))return;i.uniform3iv(this.addr,e),cn(t,e)}}function AC(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(on(t,e))return;i.uniform4iv(this.addr,e),cn(t,e)}}function gC(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function mC(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(on(t,e))return;i.uniform2uiv(this.addr,e),cn(t,e)}}function bC(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(on(t,e))return;i.uniform3uiv(this.addr,e),cn(t,e)}}function xC(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(on(t,e))return;i.uniform4uiv(this.addr,e),cn(t,e)}}function EC(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?(jA.compareFunction=Tp,r=jA):r=KA,t.setTexture2D(e||r,s)}function _C(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture3D(e||YA,s)}function yC(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTextureCube(e||JA,s)}function wC(i,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture2DArray(e||XA,s)}function vC(i){switch(i){case 5126:return rC;case 35664:return aC;case 35665:return oC;case 35666:return cC;case 35674:return lC;case 35675:return hC;case 35676:return uC;case 5124:case 35670:return dC;case 35667:case 35671:return fC;case 35668:case 35672:return pC;case 35669:case 35673:return AC;case 5125:return gC;case 36294:return mC;case 36295:return bC;case 36296:return xC;case 35678:case 36198:case 36298:case 36306:case 35682:return EC;case 35679:case 36299:case 36307:return _C;case 35680:case 36300:case 36308:case 36293:return yC;case 36289:case 36303:case 36311:case 36292:return wC}}function CC(i,e){i.uniform1fv(this.addr,e)}function SC(i,e){const t=da(e,this.size,2);i.uniform2fv(this.addr,t)}function IC(i,e){const t=da(e,this.size,3);i.uniform3fv(this.addr,t)}function MC(i,e){const t=da(e,this.size,4);i.uniform4fv(this.addr,t)}function BC(i,e){const t=da(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function TC(i,e){const t=da(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function RC(i,e){const t=da(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function NC(i,e){i.uniform1iv(this.addr,e)}function FC(i,e){i.uniform2iv(this.addr,e)}function DC(i,e){i.uniform3iv(this.addr,e)}function LC(i,e){i.uniform4iv(this.addr,e)}function PC(i,e){i.uniform1uiv(this.addr,e)}function kC(i,e){i.uniform2uiv(this.addr,e)}function UC(i,e){i.uniform3uiv(this.addr,e)}function OC(i,e){i.uniform4uiv(this.addr,e)}function QC(i,e,t){const n=this.cache,s=e.length,r=nl(t,s);on(n,r)||(i.uniform1iv(this.addr,r),cn(n,r));for(let a=0;a!==s;++a)t.setTexture2D(e[a]||KA,r[a])}function GC(i,e,t){const n=this.cache,s=e.length,r=nl(t,s);on(n,r)||(i.uniform1iv(this.addr,r),cn(n,r));for(let a=0;a!==s;++a)t.setTexture3D(e[a]||YA,r[a])}function HC(i,e,t){const n=this.cache,s=e.length,r=nl(t,s);on(n,r)||(i.uniform1iv(this.addr,r),cn(n,r));for(let a=0;a!==s;++a)t.setTextureCube(e[a]||JA,r[a])}function zC(i,e,t){const n=this.cache,s=e.length,r=nl(t,s);on(n,r)||(i.uniform1iv(this.addr,r),cn(n,r));for(let a=0;a!==s;++a)t.setTexture2DArray(e[a]||XA,r[a])}function VC(i){switch(i){case 5126:return CC;case 35664:return SC;case 35665:return IC;case 35666:return MC;case 35674:return BC;case 35675:return TC;case 35676:return RC;case 5124:case 35670:return NC;case 35667:case 35671:return FC;case 35668:case 35672:return DC;case 35669:case 35673:return LC;case 5125:return PC;case 36294:return kC;case 36295:return UC;case 36296:return OC;case 35678:case 36198:case 36298:case 36306:case 35682:return QC;case 35679:case 36299:case 36307:return GC;case 35680:case 36300:case 36308:case 36293:return HC;case 36289:case 36303:case 36311:case 36292:return zC}}class WC{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=vC(t.type)}}class qC{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=VC(t.type)}}class KC{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 ju=/(\w+)(\])?(\[|\.)?/g;function ig(i,e){i.seq.push(e),i.map[e.id]=e}function jC(i,e,t){const n=i.name,s=n.length;for(ju.lastIndex=0;;){const r=ju.exec(n),a=ju.lastIndex;let o=r[1];const c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===s){ig(t,l===void 0?new WC(o,i,e):new qC(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new KC(o),ig(t,u)),t=u}}}class il{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);jC(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 sg(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const XC=37297;let YC=0;function JC(i,e){const t=i.split(`
+ `}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(`
`),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 rg=new rt;function ZC(i){At._getMatrix(rg,At.workingColorSpace,i);const e=`mat3( ${rg.elements.map(t=>t.toFixed(4))} )`;switch(At.getTransfer(i)){case Ec:return[e,"LinearTransferOETF"];case Mt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ag(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 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()+`
`+s+`
-`+JC(i.getShaderSource(e),a)}else return s}function $C(i,e){const t=ZC(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
-`)}function eS(i,e){let t;switch(e){case yh:t="Linear";break;case PE:t="Reinhard";break;case kE:t="Cineon";break;case Ap:t="ACESFilmic";break;case OE:t="AgX";break;case QE:t="Neutral";break;case UE:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const sl=new H;function tS(){At.getLuminanceCoefficients(sl);const i=sl.x.toFixed(4),e=sl.y.toFixed(4),t=sl.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
-`)}function nS(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(xo).join(`
-`)}function iS(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
-`)}function sS(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 xo(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 cg(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const rS=/^[ \t]*#include +<([\w\d./]+)>/gm;function Xu(i){return i.replace(rS,oS)}const aS=new Map;function oS(i,e){let t=ot[e];if(t===void 0){const n=aS.get(e);if(n!==void 0)t=ot[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 Xu(t)}const cS=/#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 lg(i){return i.replace(cS,lS)}function lS(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;
+`+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;
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 hS(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===hp?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===AE?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Qi&&(e="SHADOWMAP_TYPE_VSM"),e}function uS(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Xs:case Pr:e="ENVMAP_TYPE_CUBE";break;case cc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function dS(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===Pr&&(e="ENVMAP_MODE_REFRACTION"),e}function fS(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case pp:e="ENVMAP_BLENDING_MULTIPLY";break;case DE:e="ENVMAP_BLENDING_MIX";break;case LE:e="ENVMAP_BLENDING_ADD";break}return e}function pS(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 AS(i,e,t,n){const s=i.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=hS(t),l=uS(t),h=dS(t),u=fS(t),d=pS(t),f=nS(t),m=iS(r),g=s.createProgram();let A,p,y=t.glslVersion?"#version "+t.glslVersion+`
-`:"";t.isRawShaderMaterial?(A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(xo).join(`
+#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(`
+`),g.length>0&&(g+=`
+`),A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Ro).join(`
`),A.length>0&&(A+=`
-`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(xo).join(`
-`),p.length>0&&(p+=`
-`)):(A=[hg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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(xo).join(`
-`),p=[hg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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!==bs?"#define TONE_MAPPING":"",t.toneMapping!==bs?ot.tonemapping_pars_fragment:"",t.toneMapping!==bs?eS("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ot.colorspace_pars_fragment,$C("linearToOutputTexel",t.outputColorSpace),tS(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
-`].filter(xo).join(`
-`)),a=Xu(a),a=og(a,t),a=cg(a,t),o=Xu(o),o=og(o,t),o=cg(o,t),a=lg(a),o=lg(o),t.isRawShaderMaterial!==!0&&(y=`#version 300 es
-`,A=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
+`)):(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=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
-`+A,p=["#define varying in",t.glslVersion===Rp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Rp?"":"#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===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(`
`)+`
-`+p);const b=y+A+a,_=y+p+o,M=sg(s,s.VERTEX_SHADER,b),w=sg(s,s.FRAGMENT_SHADER,_);s.attachShader(g,M),s.attachShader(g,w),t.index0AttributeName!==void 0?s.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(g,0,"position"),s.linkProgram(g);function S(F){if(i.debug.checkShaderErrors){const K=s.getProgramInfoLog(g).trim(),q=s.getShaderInfoLog(M).trim(),$=s.getShaderInfoLog(w).trim();let D=!0,O=!0;if(s.getProgramParameter(g,s.LINK_STATUS)===!1)if(D=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,g,M,w);else{const Y=ag(s,M,"vertex"),Q=ag(s,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(g,s.VALIDATE_STATUS)+`
+`+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)+`
Material Name: `+F.name+`
Material Type: `+F.type+`
Program Info Log: `+K+`
`+Y+`
-`+Q)}else K!==""?console.warn("THREE.WebGLProgram: Program Info Log:",K):(q===""||$==="")&&(O=!1);O&&(F.diagnostics={runnable:D,programLog:K,vertexShader:{log:q,prefix:A},fragmentShader:{log:$,prefix:p}})}s.deleteShader(M),s.deleteShader(w),T=new il(s,g),C=sS(s,g)}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(g,XC)),v},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=YC++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=w,this}let gS=0;class mS{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 bS(e),t.set(e,n)),n}}class bS{constructor(e){this.id=gS++,this.code=e,this.usedTimes=0}}function xS(i,e,t,n,s,r,a){const o=new zp,c=new mS,l=new Set,h=[],u=s.logarithmicDepthBuffer,d=s.vertexTextures;let f=s.precision;const m={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 g(C){return l.add(C),C===0?"uv":`uv${C}`}function A(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===cc?Y.image.height:null,J=m[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 ye=0;D.morphAttributes.position!==void 0&&(ye=1),D.morphAttributes.normal!==void 0&&(ye=2),D.morphAttributes.color!==void 0&&(ye=3);let Me,se,me,be;if(J){const yt=Fi[J];Me=yt.vertexShader,se=yt.fragmentShader}else Me=C.vertexShader,se=C.fragmentShader,c.update(C),me=c.getVertexShaderID(C),be=c.getFragmentShaderID(C);const xe=i.getRenderTarget(),Pe=i.state.buffers.depth.getReversed(),$e=q.isInstancedMesh===!0,Qe=q.isBatchedMesh===!0,St=!!C.map,ut=!!C.matcap,Je=!!Y,G=!!C.aoMap,mn=!!C.lightMap,dt=!!C.bumpMap,pt=!!C.normalMap,ze=!!C.displacementMap,Rt=!!C.emissiveMap,Ge=!!C.metalnessMap,L=!!C.roughnessMap,I=C.anisotropy>0,Z=C.clearcoat>0,le=C.dispersion>0,Ae=C.iridescence>0,oe=C.sheen>0,Ue=C.transmission>0,ve=I&&!!C.anisotropyMap,Ve=Z&&!!C.clearcoatMap,Ye=Z&&!!C.clearcoatNormalMap,Ee=Z&&!!C.clearcoatRoughnessMap,Ne=Ae&&!!C.iridescenceMap,ke=Ae&&!!C.iridescenceThicknessMap,Oe=oe&&!!C.sheenColorMap,Te=oe&&!!C.sheenRoughnessMap,tt=!!C.specularMap,We=!!C.specularColorMap,nt=!!C.specularIntensityMap,W=Ue&&!!C.transmissionMap,ne=Ue&&!!C.thicknessMap,re=!!C.gradientMap,de=!!C.alphaMap,Ie=C.alphaTest>0,Se=!!C.alphaHash,it=!!C.extensions;let Ot=bs;C.toneMapped&&(xe===null||xe.isXRRenderTarget===!0)&&(Ot=i.toneMapping);const bn={shaderID:J,shaderType:C.type,shaderName:C.name,vertexShader:Me,fragmentShader:se,defines:C.defines,customVertexShaderID:me,customFragmentShaderID:be,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:f,batching:Qe,batchingColor:Qe&&q._colorsTexture!==null,instancing:$e,instancingColor:$e&&q.instanceColor!==null,instancingMorph:$e&&q.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:xe===null?i.outputColorSpace:xe.isXRRenderTarget===!0?xe.texture.colorSpace:rn,alphaToCoverage:!!C.alphaToCoverage,map:St,matcap:ut,envMap:Je,envMapMode:Je&&Y.mapping,envMapCubeUVHeight:Q,aoMap:G,lightMap:mn,bumpMap:dt,normalMap:pt,displacementMap:d&&ze,emissiveMap:Rt,normalMapObjectSpace:pt&&C.normalMapType===KE,normalMapTangentSpace:pt&&C.normalMapType===Mp,metalnessMap:Ge,roughnessMap:L,anisotropy:I,anisotropyMap:ve,clearcoat:Z,clearcoatMap:Ve,clearcoatNormalMap:Ye,clearcoatRoughnessMap:Ee,dispersion:le,iridescence:Ae,iridescenceMap:Ne,iridescenceThicknessMap:ke,sheen:oe,sheenColorMap:Oe,sheenRoughnessMap:Te,specularMap:tt,specularColorMap:We,specularIntensityMap:nt,transmission:Ue,transmissionMap:W,thicknessMap:ne,gradientMap:re,opaque:C.transparent===!1&&C.blending===Dr&&C.alphaToCoverage===!1,alphaMap:de,alphaTest:Ie,alphaHash:Se,combine:C.combine,mapUv:St&&g(C.map.channel),aoMapUv:G&&g(C.aoMap.channel),lightMapUv:mn&&g(C.lightMap.channel),bumpMapUv:dt&&g(C.bumpMap.channel),normalMapUv:pt&&g(C.normalMap.channel),displacementMapUv:ze&&g(C.displacementMap.channel),emissiveMapUv:Rt&&g(C.emissiveMap.channel),metalnessMapUv:Ge&&g(C.metalnessMap.channel),roughnessMapUv:L&&g(C.roughnessMap.channel),anisotropyMapUv:ve&&g(C.anisotropyMap.channel),clearcoatMapUv:Ve&&g(C.clearcoatMap.channel),clearcoatNormalMapUv:Ye&&g(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ee&&g(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Ne&&g(C.iridescenceMap.channel),iridescenceThicknessMapUv:ke&&g(C.iridescenceThicknessMap.channel),sheenColorMapUv:Oe&&g(C.sheenColorMap.channel),sheenRoughnessMapUv:Te&&g(C.sheenRoughnessMap.channel),specularMapUv:tt&&g(C.specularMap.channel),specularColorMapUv:We&&g(C.specularColorMap.channel),specularIntensityMapUv:nt&&g(C.specularIntensityMap.channel),transmissionMapUv:W&&g(C.transmissionMap.channel),thicknessMapUv:ne&&g(C.thicknessMap.channel),alphaMapUv:de&&g(C.alphaMap.channel),vertexTangents:!!D.attributes.tangent&&(pt||I),vertexColors:C.vertexColors,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,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:Pe,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:ye,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:Ot,decodeVideoTexture:St&&C.map.isVideoTexture===!0&&At.getTransfer(C.map.colorSpace)===Mt,decodeVideoTextureEmissive:Rt&&C.emissiveMap.isVideoTexture===!0&&At.getTransfer(C.emissiveMap.colorSpace)===Mt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Ii,flipSided:C.side===Sn,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:it&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(it&&C.extensions.multiDraw===!0||Qe)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return bn.vertexUv1s=l.has(1),bn.vertexUv2s=l.has(2),bn.vertexUv3s=l.has(3),l.clear(),bn}function p(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&&(y(v,C),b(v,C),v.push(i.outputColorSpace)),v.push(C.customProgramCacheKey),v.join()}function y(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 b(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 _(C){const v=m[C.type];let F;if(v){const K=Fi[v];F=G_.clone(K.uniforms)}else F=C.uniforms;return F}function M(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 AS(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:A,getProgramCacheKey:p,getUniforms:_,acquireProgram:M,releaseProgram:w,releaseShaderCache:S,programs:h,dispose:T}}function ES(){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 _S(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 ug(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 dg(){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,m,g,A){let p=i[e];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:g,group:A},i[e]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=u.renderOrder,p.z=g,p.group=A),e++,p}function o(u,d,f,m,g,A){const p=a(u,d,f,m,g,A);f.transmission>0?n.push(p):f.transparent===!0?s.push(p):t.push(p)}function c(u,d,f,m,g,A){const p=a(u,d,f,m,g,A);f.transmission>0?n.unshift(p):f.transparent===!0?s.unshift(p):t.unshift(p)}function l(u,d){t.length>1&&t.sort(u||_S),n.length>1&&n.sort(d||ug),s.length>1&&s.sort(d||ug)}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 yS(){let i=new WeakMap;function e(n,s){const r=i.get(n);let a;return r===void 0?(a=new dg,i.set(n,[a])):s>=r.length?(a=new dg,r.push(a)):a=r[s],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function wS(){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 H,color:new qe};break;case"SpotLight":t={position:new H,direction:new H,color:new qe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new H,color:new qe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new H,skyColor:new qe,groundColor:new qe};break;case"RectAreaLight":t={color:new qe,position:new H,halfWidth:new H,halfHeight:new H};break}return i[e.id]=t,t}}}function vS(){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 Ze};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let CS=0;function SS(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function IS(i){const e=new wS,t=vS(),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 H);const s=new H,r=new et,a=new et;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,m=0,g=0,A=0,p=0,y=0,b=0,_=0,M=0,w=0,S=0;l.sort(SS);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);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]=D,n.directionalShadowMatrix[f]=F.shadow.matrix,y++}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[g]=O;const Y=F.shadow;if(F.map&&(n.spotLightMap[M]=F.map,M++,Y.updateMatrices(F),F.castShadow&&w++),n.spotLightMatrix[g]=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[g]=Q,n.spotShadowMap[g]=D,_++}g++}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[A]=O,A++}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[m]=Q,n.pointShadowMap[m]=D,n.pointShadowMatrix[m]=F.shadow.matrix,b++}n.point[m]=O,m++}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[p]=O,p++}}A>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!==m||T.spotLength!==g||T.rectAreaLength!==A||T.hemiLength!==p||T.numDirectionalShadows!==y||T.numPointShadows!==b||T.numSpotShadows!==_||T.numSpotMaps!==M||T.numLightProbes!==S)&&(n.directional.length=f,n.spot.length=g,n.rectArea.length=A,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=_,n.spotShadowMap.length=_,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=_+M-w,n.spotLightMap.length=M,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=S,T.directionalLength=f,T.pointLength=m,T.spotLength=g,T.rectAreaLength=A,T.hemiLength=p,T.numDirectionalShadows=y,T.numPointShadows=b,T.numSpotShadows=_,T.numSpotMaps=M,T.numLightProbes=S,n.version=CS++)}function c(l,h){let u=0,d=0,f=0,m=0,g=0;const A=h.matrixWorldInverse;for(let p=0,y=l.length;p<y;p++){const b=l[p];if(b.isDirectionalLight){const _=n.directional[u];_.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),_.direction.sub(s),_.direction.transformDirection(A),u++}else if(b.isSpotLight){const _=n.spot[f];_.position.setFromMatrixPosition(b.matrixWorld),_.position.applyMatrix4(A),_.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),_.direction.sub(s),_.direction.transformDirection(A),f++}else if(b.isRectAreaLight){const _=n.rectArea[m];_.position.setFromMatrixPosition(b.matrixWorld),_.position.applyMatrix4(A),a.identity(),r.copy(b.matrixWorld),r.premultiply(A),a.extractRotation(r),_.halfWidth.set(b.width*.5,0,0),_.halfHeight.set(0,b.height*.5,0),_.halfWidth.applyMatrix4(a),_.halfHeight.applyMatrix4(a),m++}else if(b.isPointLight){const _=n.point[d];_.position.setFromMatrixPosition(b.matrixWorld),_.position.applyMatrix4(A),d++}else if(b.isHemisphereLight){const _=n.hemi[g];_.direction.setFromMatrixPosition(b.matrixWorld),_.direction.transformDirection(A),g++}}}return{setup:o,setupView:c,state:n}}function fg(i){const e=new IS(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 MS(i){let e=new WeakMap;function t(s,r=0){const a=e.get(s);let o;return a===void 0?(o=new fg(i),e.set(s,[o])):r>=a.length?(o=new fg(i),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const BS=`void main() {
+`+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() {
gl_Position = vec4( position, 1.0 );
-}`,TS=`uniform sampler2D shadow_pass;
+}`,TI=`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 RS(i,e,t){let n=new Mu;const s=new Ze,r=new Ze,a=new _t,o=new sy({depthPacking:qE}),c=new ry,l={},h=t.maxTextureSize,u={[Gi]:Sn,[Sn]:Gi,[Ii]:Ii},d=new Ss({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ze},radius:{value:4}},vertexShader:BS,fragmentShader:TS}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new On;m.setAttribute("position",new En(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new Jt(m,d),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=hp;let p=this.type;this.render=function(w,S,T){if(A.enabled===!1||A.autoUpdate===!1&&A.needsUpdate===!1||w.length===0)return;const C=i.getRenderTarget(),v=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),K=i.state;K.setBlending(ms),K.buffers.color.setClear(1,1,1,1),K.buffers.depth.setTest(!0),K.setScissorTest(!1);const q=p!==Qi&&this.type===Qi,$=p===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:In,magFilter:In}:{};Q.map!==null&&Q.map.dispose(),Q.map=new Zs(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);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(),_(S,T,Q.camera,Y,this.type)}Q.isPointLightShadow!==!0&&this.type===Qi&&y(Q,T),Q.needsUpdate=!1}p=this.type,A.needsUpdate=!1,i.setRenderTarget(C,v,F)};function y(w,S){const T=e.update(g);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 Zs(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,g,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,g,null)}function b(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 D=$[q];D===void 0&&(D=v.clone(),$[q]=D,S.addEventListener("dispose",M)),v=D}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 _(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 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=b(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 D=b(w,$,C,v);w.onBeforeShadow(i,w,S,T,q,D,null),i.renderBufferDirect(T,null,q,D,w,null),w.onAfterShadow(i,w,S,T,q,D,null)}}const K=w.children;for(let q=0,$=K.length;q<$;q++)_(K[q],S,T,C,v)}function M(w){w.target.removeEventListener("dispose",M);for(const T in l){const C=l[T],v=w.target.uuid;v in C&&(C[v].dispose(),delete C[v])}}}const NS={[Ah]:gh,[mh]:Eh,[bh]:_h,[Lr]:xh,[gh]:Ah,[Eh]:mh,[_h]:bh,[xh]:Lr};function FS(i,e){function t(){let W=!1;const ne=new _t;let re=null;const de=new _t(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,it,Ot,bn){bn===!0&&(Ie*=Ot,Se*=Ot,it*=Ot),ne.set(Ie,Se,it,Ot),de.equals(ne)===!1&&(i.clearColor(Ie,Se,it,Ot),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 it=e.get("EXT_clip_control");Se?it.clipControlEXT(it.LOWER_LEFT_EXT,it.ZERO_TO_ONE_EXT):it.clipControlEXT(it.LOWER_LEFT_EXT,it.NEGATIVE_ONE_TO_ONE_EXT),ne=Se;const Ot=Ie;Ie=null,this.setClear(Ot)}},getReversed:function(){return ne},setTest:function(Se){Se?xe(i.DEPTH_TEST):Pe(i.DEPTH_TEST)},setMask:function(Se){re!==Se&&!W&&(i.depthMask(Se),re=Se)},setFunc:function(Se){if(ne&&(Se=NS[Se]),de!==Se){switch(Se){case Ah:i.depthFunc(i.NEVER);break;case gh:i.depthFunc(i.ALWAYS);break;case mh:i.depthFunc(i.LESS);break;case Lr:i.depthFunc(i.LEQUAL);break;case bh:i.depthFunc(i.EQUAL);break;case xh:i.depthFunc(i.GEQUAL);break;case Eh:i.depthFunc(i.GREATER);break;case _h: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,it=null,Ot=null,bn=null;return{setTest:function(yt){W||(yt?xe(i.STENCIL_TEST):Pe(i.STENCIL_TEST))},setMask:function(yt){ne!==yt&&!W&&(i.stencilMask(yt),ne=yt)},setFunc:function(yt,Yn,Si){(re!==yt||de!==Yn||Ie!==Si)&&(i.stencilFunc(yt,Yn,Si),re=yt,de=Yn,Ie=Si)},setOp:function(yt,Yn,Si){(Se!==yt||it!==Yn||Ot!==Si)&&(i.stencilOp(yt,Yn,Si),Se=yt,it=Yn,Ot=Si)},setLocked:function(yt){W=yt},setClear:function(yt){bn!==yt&&(i.clearStencil(yt),bn=yt)},reset:function(){W=!1,ne=null,re=null,de=null,Ie=null,Se=null,it=null,Ot=null,bn=null}}}const r=new t,a=new n,o=new s,c=new WeakMap,l=new WeakMap;let h={},u={},d=new WeakMap,f=[],m=null,g=!1,A=null,p=null,y=null,b=null,_=null,M=null,w=null,S=new qe(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 _t().fromArray(ae),se=new _t().fromArray(ye);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 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);return Se}const be={};be[i.TEXTURE_2D]=me(i.TEXTURE_2D,i.TEXTURE_2D,1),be[i.TEXTURE_CUBE_MAP]=me(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),be[i.TEXTURE_2D_ARRAY]=me(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),be[i.TEXTURE_3D]=me(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),xe(i.DEPTH_TEST),a.setFunc(Lr),dt(!1),pt(lp),xe(i.CULL_FACE),G(ms);function xe(W){h[W]!==!0&&(i.enable(W),h[W]=!0)}function Pe(W){h[W]!==!1&&(i.disable(W),h[W]=!1)}function $e(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 Qe(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,it=Ie.length;Se<it;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 St(W){return m!==W?(i.useProgram(W),m=W,!0):!1}const ut={[js]:i.FUNC_ADD,[mE]:i.FUNC_SUBTRACT,[bE]:i.FUNC_REVERSE_SUBTRACT};ut[xE]=i.MIN,ut[EE]=i.MAX;const Je={[_E]:i.ZERO,[yE]:i.ONE,[wE]:i.SRC_COLOR,[fh]:i.SRC_ALPHA,[BE]:i.SRC_ALPHA_SATURATE,[IE]:i.DST_COLOR,[CE]:i.DST_ALPHA,[vE]:i.ONE_MINUS_SRC_COLOR,[ph]:i.ONE_MINUS_SRC_ALPHA,[ME]:i.ONE_MINUS_DST_COLOR,[SE]:i.ONE_MINUS_DST_ALPHA,[TE]:i.CONSTANT_COLOR,[RE]:i.ONE_MINUS_CONSTANT_COLOR,[NE]:i.CONSTANT_ALPHA,[FE]:i.ONE_MINUS_CONSTANT_ALPHA};function G(W,ne,re,de,Ie,Se,it,Ot,bn,yt){if(W===ms){g===!0&&(Pe(i.BLEND),g=!1);return}if(g===!1&&(xe(i.BLEND),g=!0),W!==gE){if(W!==A||yt!==C){if((p!==js||_!==js)&&(i.blendEquation(i.FUNC_ADD),p=js,_=js),yt)switch(W){case Dr:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case up:i.blendFunc(i.ONE,i.ONE);break;case dp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case fp: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 Dr:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case up:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case dp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case fp:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}y=null,b=null,M=null,w=null,S.set(0,0,0),T=0,A=W,C=yt}return}Ie=Ie||ne,Se=Se||re,it=it||de,(ne!==p||Ie!==_)&&(i.blendEquationSeparate(ut[ne],ut[Ie]),p=ne,_=Ie),(re!==y||de!==b||Se!==M||it!==w)&&(i.blendFuncSeparate(Je[re],Je[de],Je[Se],Je[it]),y=re,b=de,M=Se,w=it),(Ot.equals(S)===!1||bn!==T)&&(i.blendColor(Ot.r,Ot.g,Ot.b,bn),S.copy(Ot),T=bn),A=W,C=!1}function mn(W,ne){W.side===Ii?Pe(i.CULL_FACE):xe(i.CULL_FACE);let re=W.side===Sn;ne&&(re=!re),dt(re),W.blending===Dr&&W.transparent===!1?G(ms):G(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)),Rt(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),W.alphaToCoverage===!0?xe(i.SAMPLE_ALPHA_TO_COVERAGE):Pe(i.SAMPLE_ALPHA_TO_COVERAGE)}function dt(W){v!==W&&(W?i.frontFace(i.CW):i.frontFace(i.CCW),v=W)}function pt(W){W!==fE?(xe(i.CULL_FACE),W!==F&&(W===lp?i.cullFace(i.BACK):W===pE?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Pe(i.CULL_FACE),F=W}function ze(W){W!==K&&(O&&i.lineWidth(W),K=W)}function Rt(W,ne,re){W?(xe(i.POLYGON_OFFSET_FILL),(q!==ne||$!==re)&&(i.polygonOffset(ne,re),q=ne,$=re)):Pe(i.POLYGON_OFFSET_FILL)}function Ge(W){W?xe(i.SCISSOR_TEST):Pe(i.SCISSOR_TEST)}function L(W){W===void 0&&(W=i.TEXTURE0+D-1),J!==W&&(i.activeTexture(W),J=W)}function I(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||be[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 Ue(){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 Ve(){try{i.compressedTexSubImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ye(){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 ke(){try{i.texImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Oe(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 tt(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 We(W,ne){const de=l.get(ne).get(W);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=new WeakMap,f=[],m=null,g=!1,A=null,p=null,y=null,b=null,_=null,M=null,w=null,S=new qe(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:xe,disable:Pe,bindFramebuffer:$e,drawBuffers:Qe,useProgram:St,setBlending:G,setMaterial:mn,setFlipSided:dt,setCullFace:pt,setLineWidth:ze,setPolygonOffset:Rt,setScissorTest:Ge,activeTexture:L,bindTexture:I,unbindTexture:Z,compressedTexImage2D:le,compressedTexImage3D:Ae,texImage2D:Ne,texImage3D:ke,updateUBOMapping:tt,uniformBlockBinding:We,texStorage2D:Ye,texStorage3D:Ee,texSubImage2D:oe,texSubImage3D:Ue,compressedTexSubImage2D:ve,compressedTexSubImage3D:Ve,scissor:Oe,viewport:Te,reset:nt}}function DS(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=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 m(L,I){return f?new OffscreenCanvas(L,I):so("canvas")}function g(L,I,Z){let le=1;const Ae=Ge(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),Ue=Math.floor(le*Ae.height);u===void 0&&(u=m(oe,Ue));const ve=I?m(oe,Ue):u;return ve.width=oe,ve.height=Ue,ve.getContext("2d").drawImage(L,0,0,oe,Ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+oe+"x"+Ue+")."),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 A(L){return L.generateMipmaps}function p(L){i.generateMipmap(L)}function y(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 b(L,I,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=I;if(I===i.RED&&(Z===i.FLOAT&&(oe=i.R32F),Z===i.HALF_FLOAT&&(oe=i.R16F),Z===i.UNSIGNED_BYTE&&(oe=i.R8)),I===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)),I===i.RG&&(Z===i.FLOAT&&(oe=i.RG32F),Z===i.HALF_FLOAT&&(oe=i.RG16F),Z===i.UNSIGNED_BYTE&&(oe=i.RG8)),I===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)),I===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)),I===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)),I===i.RGB&&Z===i.UNSIGNED_INT_5_9_9_9_REV&&(oe=i.RGB9_E5),I===i.RGBA){const Ue=Ae?Ec:At.getTransfer(le);Z===i.FLOAT&&(oe=i.RGBA32F),Z===i.HALF_FLOAT&&(oe=i.RGBA16F),Z===i.UNSIGNED_BYTE&&(oe=Ue===Mt?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 _(L,I){let Z;return L?I===null||I===Ys||I===qa?Z=i.DEPTH24_STENCIL8:I===nn?Z=i.DEPTH32F_STENCIL8:I===Wa&&(Z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):I===null||I===Ys||I===qa?Z=i.DEPTH_COMPONENT24:I===nn?Z=i.DEPTH_COMPONENT32F:I===Wa&&(Z=i.DEPTH_COMPONENT16),Z}function M(L,I){return A(L)===!0||L.isFramebufferTexture&&L.minFilter!==In&&L.minFilter!==zt?Math.log2(Math.max(I.width,I.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?I.mipmaps.length:1}function w(L){const I=L.target;I.removeEventListener("dispose",w),T(I),I.isVideoTexture&&h.delete(I)}function S(L){const I=L.target;I.removeEventListener("dispose",S),v(I)}function T(L){const I=n.get(L);if(I.__webglInit===void 0)return;const Z=L.source,le=d.get(Z);if(le){const Ae=le[I.__cacheKey];Ae.usedTimes--,Ae.usedTimes===0&&C(L),Object.keys(le).length===0&&d.delete(Z)}n.remove(L)}function C(L){const I=n.get(L);i.deleteTexture(I.__webglTexture);const Z=L.source,le=d.get(Z);delete le[I.__cacheKey],a.memory.textures--}function v(L){const I=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(I.__webglFramebuffer[le]))for(let Ae=0;Ae<I.__webglFramebuffer[le].length;Ae++)i.deleteFramebuffer(I.__webglFramebuffer[le][Ae]);else i.deleteFramebuffer(I.__webglFramebuffer[le]);I.__webglDepthbuffer&&i.deleteRenderbuffer(I.__webglDepthbuffer[le])}else{if(Array.isArray(I.__webglFramebuffer))for(let le=0;le<I.__webglFramebuffer.length;le++)i.deleteFramebuffer(I.__webglFramebuffer[le]);else i.deleteFramebuffer(I.__webglFramebuffer);if(I.__webglDepthbuffer&&i.deleteRenderbuffer(I.__webglDepthbuffer),I.__webglMultisampledFramebuffer&&i.deleteFramebuffer(I.__webglMultisampledFramebuffer),I.__webglColorRenderbuffer)for(let le=0;le<I.__webglColorRenderbuffer.length;le++)I.__webglColorRenderbuffer[le]&&i.deleteRenderbuffer(I.__webglColorRenderbuffer[le]);I.__webglDepthRenderbuffer&&i.deleteRenderbuffer(I.__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 I=[];return I.push(L.wrapS),I.push(L.wrapT),I.push(L.wrapR||0),I.push(L.magFilter),I.push(L.minFilter),I.push(L.anisotropy),I.push(L.internalFormat),I.push(L.format),I.push(L.type),I.push(L.generateMipmaps),I.push(L.premultiplyAlpha),I.push(L.flipY),I.push(L.unpackAlignment),I.push(L.colorSpace),I.join()}function D(L,I){const Z=n.get(L);if(L.isVideoTexture&&ze(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,I);return}}t.bindTexture(i.TEXTURE_2D,Z.__webglTexture,i.TEXTURE0+I)}function O(L,I){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){se(Z,L,I);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Z.__webglTexture,i.TEXTURE0+I)}function Y(L,I){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){se(Z,L,I);return}t.bindTexture(i.TEXTURE_3D,Z.__webglTexture,i.TEXTURE0+I)}function Q(L,I){const Z=n.get(L);if(L.version>0&&Z.__version!==L.version){me(Z,L,I);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture,i.TEXTURE0+I)}const J={[kr]:i.REPEAT,[oi]:i.CLAMP_TO_EDGE,[lc]:i.MIRRORED_REPEAT},ee={[In]:i.NEAREST,[bp]:i.NEAREST_MIPMAP_NEAREST,[Va]:i.NEAREST_MIPMAP_LINEAR,[zt]:i.LINEAR,[hc]:i.LINEAR_MIPMAP_NEAREST,[Jn]:i.LINEAR_MIPMAP_LINEAR},ae={[jE]:i.NEVER,[e_]:i.ALWAYS,[XE]:i.LESS,[Tp]:i.LEQUAL,[YE]:i.EQUAL,[$E]:i.GEQUAL,[JE]:i.GREATER,[ZE]:i.NOTEQUAL};function ye(L,I){if(I.type===nn&&e.has("OES_texture_float_linear")===!1&&(I.magFilter===zt||I.magFilter===hc||I.magFilter===Va||I.magFilter===Jn||I.minFilter===zt||I.minFilter===hc||I.minFilter===Va||I.minFilter===Jn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(L,i.TEXTURE_WRAP_S,J[I.wrapS]),i.texParameteri(L,i.TEXTURE_WRAP_T,J[I.wrapT]),(L===i.TEXTURE_3D||L===i.TEXTURE_2D_ARRAY)&&i.texParameteri(L,i.TEXTURE_WRAP_R,J[I.wrapR]),i.texParameteri(L,i.TEXTURE_MAG_FILTER,ee[I.magFilter]),i.texParameteri(L,i.TEXTURE_MIN_FILTER,ee[I.minFilter]),I.compareFunction&&(i.texParameteri(L,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(L,i.TEXTURE_COMPARE_FUNC,ae[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(I.magFilter===In||I.minFilter!==Va&&I.minFilter!==Jn||I.type===nn&&e.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||n.get(I).__currentAnisotropy){const Z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(L,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,s.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy}}}function Me(L,I){let Z=!1;L.__webglInit===void 0&&(L.__webglInit=!0,I.addEventListener("dispose",w));const le=I.source;let Ae=d.get(le);Ae===void 0&&(Ae={},d.set(le,Ae));const oe=$(I);if(oe!==L.__cacheKey){Ae[oe]===void 0&&(Ae[oe]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Z=!0),Ae[oe].usedTimes++;const Ue=Ae[L.__cacheKey];Ue!==void 0&&(Ae[L.__cacheKey].usedTimes--,Ue.usedTimes===0&&C(I)),L.__cacheKey=oe,L.__webglTexture=Ae[oe].texture}return Z}function se(L,I,Z){let le=i.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(le=i.TEXTURE_2D_ARRAY),I.isData3DTexture&&(le=i.TEXTURE_3D);const Ae=Me(L,I),oe=I.source;t.bindTexture(le,L.__webglTexture,i.TEXTURE0+Z);const Ue=n.get(oe);if(oe.version!==Ue.__version||Ae===!0){t.activeTexture(i.TEXTURE0+Z);const ve=At.getPrimaries(At.workingColorSpace),Ve=I.colorSpace===ci?null:At.getPrimaries(I.colorSpace),Ye=I.colorSpace===ci||ve===Ve?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,I.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,I.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ye);let Ee=g(I.image,!1,s.maxTextureSize);Ee=Rt(I,Ee);const Ne=r.convert(I.format,I.colorSpace),ke=r.convert(I.type);let Oe=b(I.internalFormat,Ne,ke,I.colorSpace,I.isVideoTexture);ye(le,I);let Te;const tt=I.mipmaps,We=I.isVideoTexture!==!0,nt=Ue.__version===void 0||Ae===!0,W=oe.dataReady,ne=M(I,Ee);if(I.isDepthTexture)Oe=_(I.format===ja,I.type),nt&&(We?t.texStorage2D(i.TEXTURE_2D,1,Oe,Ee.width,Ee.height):t.texImage2D(i.TEXTURE_2D,0,Oe,Ee.width,Ee.height,0,Ne,ke,null));else if(I.isDataTexture)if(tt.length>0){We&&nt&&t.texStorage2D(i.TEXTURE_2D,ne,Oe,tt[0].width,tt[0].height);for(let re=0,de=tt.length;re<de;re++)Te=tt[re],We?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,Ne,ke,Te.data):t.texImage2D(i.TEXTURE_2D,re,Oe,Te.width,Te.height,0,Ne,ke,Te.data);I.generateMipmaps=!1}else We?(nt&&t.texStorage2D(i.TEXTURE_2D,ne,Oe,Ee.width,Ee.height),W&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Ee.width,Ee.height,Ne,ke,Ee.data)):t.texImage2D(i.TEXTURE_2D,0,Oe,Ee.width,Ee.height,0,Ne,ke,Ee.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){We&&nt&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Oe,tt[0].width,tt[0].height,Ee.depth);for(let re=0,de=tt.length;re<de;re++)if(Te=tt[re],I.format!==sn)if(Ne!==null)if(We){if(W)if(I.layerUpdates.size>0){const Ie=OA(Te.width,Te.height,I.format,I.type);for(const Se of I.layerUpdates){const it=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,it)}I.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,Oe,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 We?W&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,re,0,0,0,Te.width,Te.height,Ee.depth,Ne,ke,Te.data):t.texImage3D(i.TEXTURE_2D_ARRAY,re,Oe,Te.width,Te.height,Ee.depth,0,Ne,ke,Te.data)}else{We&&nt&&t.texStorage2D(i.TEXTURE_2D,ne,Oe,tt[0].width,tt[0].height);for(let re=0,de=tt.length;re<de;re++)Te=tt[re],I.format!==sn?Ne!==null?We?W&&t.compressedTexSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,Ne,Te.data):t.compressedTexImage2D(i.TEXTURE_2D,re,Oe,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):We?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,Te.width,Te.height,Ne,ke,Te.data):t.texImage2D(i.TEXTURE_2D,re,Oe,Te.width,Te.height,0,Ne,ke,Te.data)}else if(I.isDataArrayTexture)if(We){if(nt&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Oe,Ee.width,Ee.height,Ee.depth),W)if(I.layerUpdates.size>0){const re=OA(Ee.width,Ee.height,I.format,I.type);for(const de of I.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,ke,Ie)}I.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ee.width,Ee.height,Ee.depth,Ne,ke,Ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Oe,Ee.width,Ee.height,Ee.depth,0,Ne,ke,Ee.data);else if(I.isData3DTexture)We?(nt&&t.texStorage3D(i.TEXTURE_3D,ne,Oe,Ee.width,Ee.height,Ee.depth),W&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ee.width,Ee.height,Ee.depth,Ne,ke,Ee.data)):t.texImage3D(i.TEXTURE_3D,0,Oe,Ee.width,Ee.height,Ee.depth,0,Ne,ke,Ee.data);else if(I.isFramebufferTexture){if(nt)if(We)t.texStorage2D(i.TEXTURE_2D,ne,Oe,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,Oe,re,de,0,Ne,ke,null),re>>=1,de>>=1}}else if(tt.length>0){if(We&&nt){const re=Ge(tt[0]);t.texStorage2D(i.TEXTURE_2D,ne,Oe,re.width,re.height)}for(let re=0,de=tt.length;re<de;re++)Te=tt[re],We?W&&t.texSubImage2D(i.TEXTURE_2D,re,0,0,Ne,ke,Te):t.texImage2D(i.TEXTURE_2D,re,Oe,Ne,ke,Te);I.generateMipmaps=!1}else if(We){if(nt){const re=Ge(Ee);t.texStorage2D(i.TEXTURE_2D,ne,Oe,re.width,re.height)}W&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Ne,ke,Ee)}else t.texImage2D(i.TEXTURE_2D,0,Oe,Ne,ke,Ee);A(I)&&p(le),Ue.__version=oe.version,I.onUpdate&&I.onUpdate(I)}L.__version=I.version}function me(L,I,Z){if(I.image.length!==6)return;const le=Me(L,I),Ae=I.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 Ue=At.getPrimaries(At.workingColorSpace),ve=I.colorSpace===ci?null:At.getPrimaries(I.colorSpace),Ve=I.colorSpace===ci||Ue===ve?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,I.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,I.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ve);const Ye=I.isCompressedTexture||I.image[0].isCompressedTexture,Ee=I.image[0]&&I.image[0].isDataTexture,Ne=[];for(let de=0;de<6;de++)!Ye&&!Ee?Ne[de]=g(I.image[de],!0,s.maxCubemapSize):Ne[de]=Ee?I.image[de].image:I.image[de],Ne[de]=Rt(I,Ne[de]);const ke=Ne[0],Oe=r.convert(I.format,I.colorSpace),Te=r.convert(I.type),tt=b(I.internalFormat,Oe,Te,I.colorSpace),We=I.isVideoTexture!==!0,nt=oe.__version===void 0||le===!0,W=Ae.dataReady;let ne=M(I,ke);ye(i.TEXTURE_CUBE_MAP,I);let re;if(Ye){We&&nt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,tt,ke.width,ke.height);for(let de=0;de<6;de++){re=Ne[de].mipmaps;for(let Ie=0;Ie<re.length;Ie++){const Se=re[Ie];I.format!==sn?Oe!==null?We?W&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie,0,0,Se.width,Se.height,Oe,Se.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie,tt,Se.width,Se.height,0,Se.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):We?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie,0,0,Se.width,Se.height,Oe,Te,Se.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie,tt,Se.width,Se.height,0,Oe,Te,Se.data)}}}else{if(re=I.mipmaps,We&&nt){re.length>0&&ne++;const de=Ge(Ne[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,tt,de.width,de.height)}for(let de=0;de<6;de++)if(Ee){We?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ne[de].width,Ne[de].height,Oe,Te,Ne[de].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,tt,Ne[de].width,Ne[de].height,0,Oe,Te,Ne[de].data);for(let Ie=0;Ie<re.length;Ie++){const it=re[Ie].image[de].image;We?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+1,0,0,it.width,it.height,Oe,Te,it.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+1,tt,it.width,it.height,0,Oe,Te,it.data)}}else{We?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Oe,Te,Ne[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,tt,Oe,Te,Ne[de]);for(let Ie=0;Ie<re.length;Ie++){const Se=re[Ie];We?W&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+1,0,0,Oe,Te,Se.image[de]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+de,Ie+1,tt,Oe,Te,Se.image[de])}}}A(I)&&p(i.TEXTURE_CUBE_MAP),oe.__version=Ae.version,I.onUpdate&&I.onUpdate(I)}L.__version=I.version}function be(L,I,Z,le,Ae,oe){const Ue=r.convert(Z.format,Z.colorSpace),ve=r.convert(Z.type),Ve=b(Z.internalFormat,Ue,ve,Z.colorSpace),Ye=n.get(I),Ee=n.get(Z);if(Ee.__renderTarget=I,!Ye.__hasExternalTextures){const Ne=Math.max(1,I.width>>oe),ke=Math.max(1,I.height>>oe);Ae===i.TEXTURE_3D||Ae===i.TEXTURE_2D_ARRAY?t.texImage3D(Ae,oe,Ve,Ne,ke,I.depth,0,Ue,ve,null):t.texImage2D(Ae,oe,Ve,Ne,ke,0,Ue,ve,null)}t.bindFramebuffer(i.FRAMEBUFFER,L),pt(I)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,le,Ae,Ee.__webglTexture,0,dt(I)):(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 xe(L,I,Z){if(i.bindRenderbuffer(i.RENDERBUFFER,L),I.depthBuffer){const le=I.depthTexture,Ae=le&&le.isDepthTexture?le.type:null,oe=_(I.stencilBuffer,Ae),Ue=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ve=dt(I);pt(I)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ve,oe,I.width,I.height):Z?i.renderbufferStorageMultisample(i.RENDERBUFFER,ve,oe,I.width,I.height):i.renderbufferStorage(i.RENDERBUFFER,oe,I.width,I.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ue,i.RENDERBUFFER,L)}else{const le=I.textures;for(let Ae=0;Ae<le.length;Ae++){const oe=le[Ae],Ue=r.convert(oe.format,oe.colorSpace),ve=r.convert(oe.type),Ve=b(oe.internalFormat,Ue,ve,oe.colorSpace),Ye=dt(I);Z&&pt(I)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ye,Ve,I.width,I.height):pt(I)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ye,Ve,I.width,I.height):i.renderbufferStorage(i.RENDERBUFFER,Ve,I.width,I.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Pe(L,I){if(I&&I.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,L),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const le=n.get(I.depthTexture);le.__renderTarget=I,(!le.__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),D(I.depthTexture,0);const Ae=le.__webglTexture,oe=dt(I);if(I.depthTexture.format===Ka)pt(I)?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(I.depthTexture.format===ja)pt(I)?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 $e(L){const I=n.get(L),Z=L.isWebGLCubeRenderTarget===!0;if(I.__boundDepthTexture!==L.depthTexture){const le=L.depthTexture;if(I.__depthDisposeCallback&&I.__depthDisposeCallback(),le){const Ae=()=>{delete I.__boundDepthTexture,delete I.__depthDisposeCallback,le.removeEventListener("dispose",Ae)};le.addEventListener("dispose",Ae),I.__depthDisposeCallback=Ae}I.__boundDepthTexture=le}if(L.depthTexture&&!I.__autoAllocateDepthBuffer){if(Z)throw new Error("target.depthTexture not supported in Cube render targets");const le=L.texture.mipmaps;le&&le.length>0?Pe(I.__webglFramebuffer[0],L):Pe(I.__webglFramebuffer,L)}else if(Z){I.__webglDepthbuffer=[];for(let le=0;le<6;le++)if(t.bindFramebuffer(i.FRAMEBUFFER,I.__webglFramebuffer[le]),I.__webglDepthbuffer[le]===void 0)I.__webglDepthbuffer[le]=i.createRenderbuffer(),xe(I.__webglDepthbuffer[le],L,!1);else{const Ae=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=I.__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,I.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer===void 0)I.__webglDepthbuffer=i.createRenderbuffer(),xe(I.__webglDepthbuffer,L,!1);else{const Ae=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=I.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ae,i.RENDERBUFFER,oe)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Qe(L,I,Z){const le=n.get(L);I!==void 0&&be(le.__webglFramebuffer,L,L.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Z!==void 0&&$e(L)}function St(L){const I=L.texture,Z=n.get(L),le=n.get(I);L.addEventListener("dispose",S);const Ae=L.textures,oe=L.isWebGLCubeRenderTarget===!0,Ue=Ae.length>1;if(Ue||(le.__webglTexture===void 0&&(le.__webglTexture=i.createTexture()),le.__version=I.version,a.memory.textures++),oe){Z.__webglFramebuffer=[];for(let ve=0;ve<6;ve++)if(I.mipmaps&&I.mipmaps.length>0){Z.__webglFramebuffer[ve]=[];for(let Ve=0;Ve<I.mipmaps.length;Ve++)Z.__webglFramebuffer[ve][Ve]=i.createFramebuffer()}else Z.__webglFramebuffer[ve]=i.createFramebuffer()}else{if(I.mipmaps&&I.mipmaps.length>0){Z.__webglFramebuffer=[];for(let ve=0;ve<I.mipmaps.length;ve++)Z.__webglFramebuffer[ve]=i.createFramebuffer()}else Z.__webglFramebuffer=i.createFramebuffer();if(Ue)for(let ve=0,Ve=Ae.length;ve<Ve;ve++){const Ye=n.get(Ae[ve]);Ye.__webglTexture===void 0&&(Ye.__webglTexture=i.createTexture(),a.memory.textures++)}if(L.samples>0&&pt(L)===!1){Z.__webglMultisampledFramebuffer=i.createFramebuffer(),Z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let ve=0;ve<Ae.length;ve++){const Ve=Ae[ve];Z.__webglColorRenderbuffer[ve]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Z.__webglColorRenderbuffer[ve]);const Ye=r.convert(Ve.format,Ve.colorSpace),Ee=r.convert(Ve.type),Ne=b(Ve.internalFormat,Ye,Ee,Ve.colorSpace,L.isXRRenderTarget===!0),ke=dt(L);i.renderbufferStorageMultisample(i.RENDERBUFFER,ke,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(),xe(Z.__webglDepthRenderbuffer,L,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(oe){t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture),ye(i.TEXTURE_CUBE_MAP,I);for(let ve=0;ve<6;ve++)if(I.mipmaps&&I.mipmaps.length>0)for(let Ve=0;Ve<I.mipmaps.length;Ve++)be(Z.__webglFramebuffer[ve][Ve],L,I,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Ve);else be(Z.__webglFramebuffer[ve],L,I,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0);A(I)&&p(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ue){for(let ve=0,Ve=Ae.length;ve<Ve;ve++){const Ye=Ae[ve],Ee=n.get(Ye);t.bindTexture(i.TEXTURE_2D,Ee.__webglTexture),ye(i.TEXTURE_2D,Ye),be(Z.__webglFramebuffer,L,Ye,i.COLOR_ATTACHMENT0+ve,i.TEXTURE_2D,0),A(Ye)&&p(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,I),I.mipmaps&&I.mipmaps.length>0)for(let Ve=0;Ve<I.mipmaps.length;Ve++)be(Z.__webglFramebuffer[Ve],L,I,i.COLOR_ATTACHMENT0,ve,Ve);else be(Z.__webglFramebuffer,L,I,i.COLOR_ATTACHMENT0,ve,0);A(I)&&p(ve),t.unbindTexture()}L.depthBuffer&&$e(L)}function ut(L){const I=L.textures;for(let Z=0,le=I.length;Z<le;Z++){const Ae=I[Z];if(A(Ae)){const oe=y(L),Ue=n.get(Ae).__webglTexture;t.bindTexture(oe,Ue),p(oe),t.unbindTexture()}}}const Je=[],G=[];function mn(L){if(L.samples>0){if(pt(L)===!1){const I=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,Ue=n.get(L),ve=I.length>1;if(ve)for(let Ye=0;Ye<I.length;Ye++)t.bindFramebuffer(i.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ye,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Ue.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ye,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer);const Ve=L.texture.mipmaps;Ve&&Ve.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ue.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ue.__webglFramebuffer);for(let Ye=0;Ye<I.length;Ye++){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,Ue.__webglColorRenderbuffer[Ye]);const Ee=n.get(I[Ye]).__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&&(Je.length=0,G.length=0,Je.push(i.COLOR_ATTACHMENT0+Ye),L.depthBuffer&&L.resolveDepthBuffer===!1&&(Je.push(oe),G.push(oe),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,G)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,Je))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ve)for(let Ye=0;Ye<I.length;Ye++){t.bindFramebuffer(i.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ye,i.RENDERBUFFER,Ue.__webglColorRenderbuffer[Ye]);const Ee=n.get(I[Ye]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Ue.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ye,i.TEXTURE_2D,Ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer)}else if(L.depthBuffer&&L.resolveDepthBuffer===!1&&c){const I=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[I])}}}function dt(L){return Math.min(s.maxSamples,L.samples)}function pt(L){const I=n.get(L);return L.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function ze(L){const I=a.render.frame;h.get(L)!==I&&(h.set(L,I),L.update())}function Rt(L,I){const Z=L.colorSpace,le=L.format,Ae=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||Z!==rn&&Z!==ci&&(At.getTransfer(Z)===Mt?(le!==sn||Ae!==tn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Z)),I}function Ge(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=Qe,this.setupRenderTarget=St,this.updateRenderTargetMipmap=ut,this.updateMultisampleRenderTarget=mn,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=be,this.useMultisampledRTT=pt}function LS(i,e){function t(n,s=ci){let r;const a=At.getTransfer(s);if(n===tn)return i.UNSIGNED_BYTE;if(n===Sh)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ih)return i.UNSIGNED_SHORT_5_5_5_1;if(n===_p)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===xp)return i.BYTE;if(n===Ep)return i.SHORT;if(n===Wa)return i.UNSIGNED_SHORT;if(n===Ch)return i.INT;if(n===Ys)return i.UNSIGNED_INT;if(n===nn)return i.FLOAT;if(n===Mn)return i.HALF_FLOAT;if(n===yp)return i.ALPHA;if(n===wp)return i.RGB;if(n===sn)return i.RGBA;if(n===Ka)return i.DEPTH_COMPONENT;if(n===ja)return i.DEPTH_STENCIL;if(n===Hi)return i.RED;if(n===Mh)return i.RED_INTEGER;if(n===Js)return i.RG;if(n===Bh)return i.RG_INTEGER;if(n===Th)return i.RGBA_INTEGER;if(n===uc||n===Xa||n===dc||n===Ya)if(a===Mt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===uc)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===dc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ya)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===uc)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xa)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===dc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ya)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===fc||n===Rh||n===pc||n===Nh)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===fc)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Rh)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===pc)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Nh)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Ac||n===gc||n===mc)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Ac||n===gc)return a===Mt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===mc)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Ja||n===Fh||n===Dh||n===Lh||n===Za||n===Ph||n===kh||n===Uh||n===Oh||n===Qh||n===Gh||n===Hh||n===zh||n===Vh)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Ja)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Fh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Dh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Za)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ph)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===kh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Uh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Qh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Gh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Hh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===zh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Vh)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===$a||n===Wh||n===bc)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===$a)return a===Mt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===bc)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===vp||n===qh||n===Kh||n===jh)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===$a)return r.COMPRESSED_RED_RGTC1_EXT;if(n===qh)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Kh)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===jh)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===qa?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const PS=`
+}`;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=`
void main() {
gl_Position = vec4( position, 1.0 );
-}`,kS=`
+}`,kI=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
@@ -3816,7 +3816,7 @@ void main() {
}
-}`;class US{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const s=new an,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 Ss({vertexShader:PS,fragmentShader:kS,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Jt(new Jc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class OS extends xs{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,m=null;const g=new US,A=t.getContextAttributes();let p=null,y=null;const b=[],_=[],M=new Ze;let w=null;const S=new Cn;S.viewport=new _t;const T=new Cn;T.viewport=new _t;const C=[S,T],v=new Cy;let F=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let me=b[se];return me===void 0&&(me=new Eu,b[se]=me),me.getTargetRaySpace()},this.getControllerGrip=function(se){let me=b[se];return me===void 0&&(me=new Eu,b[se]=me),me.getGripSpace()},this.getHand=function(se){let me=b[se];return me===void 0&&(me=new Eu,b[se]=me),me.getHandSpace()};function q(se){const me=_.indexOf(se.inputSource);if(me===-1)return;const be=b[me];be!==void 0&&(be.update(se.inputSource,se.frame,l||a),be.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<b.length;se++){const me=_[se];me!==null&&(_[se]=null,b[se].disconnect(me))}F=null,K=null,g.reset(),e.setRenderTarget(p),f=null,d=null,u=null,s=null,y=null,Me.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(M.width,M.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 m},this.getSession=function(){return s},this.setSession=async function(se){if(s=se,s!==null){if(p=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),A.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(M),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let be=null,xe=null,Pe=null;A.depth&&(Pe=A.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,be=A.stencil?ja:Ka,xe=A.stencil?qa:Ys);const $e={colorFormat:t.RGBA8,depthFormat:Pe,scaleFactor:r};u=new XRWebGLBinding(s,t),d=u.createProjectionLayer($e),s.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new Zs(d.textureWidth,d.textureHeight,{format:sn,type:tn,depthTexture:new vA(d.textureWidth,d.textureHeight,xe,void 0,void 0,void 0,void 0,void 0,void 0,be),stencilBuffer:A.stencil,colorSpace:e.outputColorSpace,samples:A.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const be={antialias:A.antialias,alpha:!0,depth:A.depth,stencil:A.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(s,t,be),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new Zs(f.framebufferWidth,f.framebufferHeight,{format:sn,type:tn,colorSpace:e.outputColorSpace,stencilBuffer:A.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}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"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function D(se){for(let me=0;me<se.removed.length;me++){const be=se.removed[me],xe=_.indexOf(be);xe>=0&&(_[xe]=null,b[xe].disconnect(be))}for(let me=0;me<se.added.length;me++){const be=se.added[me];let xe=_.indexOf(be);if(xe===-1){for(let $e=0;$e<b.length;$e++)if($e>=_.length){_.push(be),xe=$e;break}else if(_[$e]===null){_[$e]=be,xe=$e;break}if(xe===-1)break}const Pe=b[xe];Pe&&Pe.connect(be)}}const O=new H,Y=new H;function Q(se,me,be){O.setFromMatrixPosition(me.matrixWorld),Y.setFromMatrixPosition(be.matrixWorld);const xe=O.distanceTo(Y),Pe=me.projectionMatrix.elements,$e=be.projectionMatrix.elements,Qe=Pe[14]/(Pe[10]-1),St=Pe[14]/(Pe[10]+1),ut=(Pe[9]+1)/Pe[5],Je=(Pe[9]-1)/Pe[5],G=(Pe[8]-1)/Pe[0],mn=($e[8]+1)/$e[0],dt=Qe*G,pt=Qe*mn,ze=xe/(-G+mn),Rt=ze*-G;if(me.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Rt),se.translateZ(ze),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),Pe[10]===-1)se.projectionMatrix.copy(me.projectionMatrix),se.projectionMatrixInverse.copy(me.projectionMatrixInverse);else{const Ge=Qe+ze,L=St+ze,I=dt-Rt,Z=pt+(xe-Rt),le=ut*St/L*Ge,Ae=Je*St/L*Ge;se.projectionMatrix.makePerspective(I,Z,le,Ae,Ge,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,be=se.far;g.texture!==null&&(g.depthNear>0&&(me=g.depthNear),g.depthFar>0&&(be=g.depthFar)),v.near=T.near=S.near=me,v.far=T.far=S.far=be,(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 xe=se.parent,Pe=v.cameras;J(v,xe);for(let $e=0;$e<Pe.length;$e++)J(Pe[$e],xe);Pe.length===2?Q(v,S,T):v.projectionMatrix.copy(S.projectionMatrix),ee(se,v,xe)};function ee(se,me,be){be===null?se.matrix.copy(me.matrixWorld):(se.matrix.copy(be.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=Gr*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 g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(v)};let ae=null;function ye(se,me){if(h=me.getViewerPose(l||a),m=me,h!==null){const be=h.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let xe=!1;be.length!==v.cameras.length&&(v.cameras.length=0,xe=!0);for(let Qe=0;Qe<be.length;Qe++){const St=be[Qe];let ut=null;if(f!==null)ut=f.getViewport(St);else{const G=u.getViewSubImage(d,St);ut=G.viewport,Qe===0&&(e.setRenderTargetTextures(y,G.colorTexture,G.depthStencilTexture),e.setRenderTarget(y))}let Je=C[Qe];Je===void 0&&(Je=new Cn,Je.layers.enable(Qe),Je.viewport=new _t,C[Qe]=Je),Je.matrix.fromArray(St.transform.matrix),Je.matrix.decompose(Je.position,Je.quaternion,Je.scale),Je.projectionMatrix.fromArray(St.projectionMatrix),Je.projectionMatrixInverse.copy(Je.projectionMatrix).invert(),Je.viewport.set(ut.x,ut.y,ut.width,ut.height),Qe===0&&(v.matrix.copy(Je.matrix),v.matrix.decompose(v.position,v.quaternion,v.scale)),xe===!0&&v.cameras.push(Je)}const Pe=s.enabledFeatures;if(Pe&&Pe.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&u){const Qe=u.getDepthInformation(be[0]);Qe&&Qe.isValid&&Qe.texture&&g.init(e,Qe,s.renderState)}}for(let be=0;be<b.length;be++){const xe=_[be],Pe=b[be];xe!==null&&Pe!==void 0&&Pe.update(xe,me,l||a)}ae&&ae(se,me),me.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:me}),m=null}const Me=new QA;Me.setAnimationLoop(ye),this.setAnimationLoop=function(se){ae=se},this.dispose=function(){}}}const or=new Ti,QS=new et;function GS(i,e){function t(A,p){A.matrixAutoUpdate===!0&&A.updateMatrix(),p.value.copy(A.matrix)}function n(A,p){p.color.getRGB(A.fogColor.value,iA(i)),p.isFog?(A.fogNear.value=p.near,A.fogFar.value=p.far):p.isFogExp2&&(A.fogDensity.value=p.density)}function s(A,p,y,b,_){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(A,p):p.isMeshToonMaterial?(r(A,p),u(A,p)):p.isMeshPhongMaterial?(r(A,p),h(A,p)):p.isMeshStandardMaterial?(r(A,p),d(A,p),p.isMeshPhysicalMaterial&&f(A,p,_)):p.isMeshMatcapMaterial?(r(A,p),m(A,p)):p.isMeshDepthMaterial?r(A,p):p.isMeshDistanceMaterial?(r(A,p),g(A,p)):p.isMeshNormalMaterial?r(A,p):p.isLineBasicMaterial?(a(A,p),p.isLineDashedMaterial&&o(A,p)):p.isPointsMaterial?c(A,p,y,b):p.isSpriteMaterial?l(A,p):p.isShadowMaterial?(A.color.value.copy(p.color),A.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(A,p){A.opacity.value=p.opacity,p.color&&A.diffuse.value.copy(p.color),p.emissive&&A.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(A.map.value=p.map,t(p.map,A.mapTransform)),p.alphaMap&&(A.alphaMap.value=p.alphaMap,t(p.alphaMap,A.alphaMapTransform)),p.bumpMap&&(A.bumpMap.value=p.bumpMap,t(p.bumpMap,A.bumpMapTransform),A.bumpScale.value=p.bumpScale,p.side===Sn&&(A.bumpScale.value*=-1)),p.normalMap&&(A.normalMap.value=p.normalMap,t(p.normalMap,A.normalMapTransform),A.normalScale.value.copy(p.normalScale),p.side===Sn&&A.normalScale.value.negate()),p.displacementMap&&(A.displacementMap.value=p.displacementMap,t(p.displacementMap,A.displacementMapTransform),A.displacementScale.value=p.displacementScale,A.displacementBias.value=p.displacementBias),p.emissiveMap&&(A.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,A.emissiveMapTransform)),p.specularMap&&(A.specularMap.value=p.specularMap,t(p.specularMap,A.specularMapTransform)),p.alphaTest>0&&(A.alphaTest.value=p.alphaTest);const y=e.get(p),b=y.envMap,_=y.envMapRotation;b&&(A.envMap.value=b,or.copy(_),or.x*=-1,or.y*=-1,or.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(or.y*=-1,or.z*=-1),A.envMapRotation.value.setFromMatrix4(QS.makeRotationFromEuler(or)),A.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,A.reflectivity.value=p.reflectivity,A.ior.value=p.ior,A.refractionRatio.value=p.refractionRatio),p.lightMap&&(A.lightMap.value=p.lightMap,A.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,A.lightMapTransform)),p.aoMap&&(A.aoMap.value=p.aoMap,A.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,A.aoMapTransform))}function a(A,p){A.diffuse.value.copy(p.color),A.opacity.value=p.opacity,p.map&&(A.map.value=p.map,t(p.map,A.mapTransform))}function o(A,p){A.dashSize.value=p.dashSize,A.totalSize.value=p.dashSize+p.gapSize,A.scale.value=p.scale}function c(A,p,y,b){A.diffuse.value.copy(p.color),A.opacity.value=p.opacity,A.size.value=p.size*y,A.scale.value=b*.5,p.map&&(A.map.value=p.map,t(p.map,A.uvTransform)),p.alphaMap&&(A.alphaMap.value=p.alphaMap,t(p.alphaMap,A.alphaMapTransform)),p.alphaTest>0&&(A.alphaTest.value=p.alphaTest)}function l(A,p){A.diffuse.value.copy(p.color),A.opacity.value=p.opacity,A.rotation.value=p.rotation,p.map&&(A.map.value=p.map,t(p.map,A.mapTransform)),p.alphaMap&&(A.alphaMap.value=p.alphaMap,t(p.alphaMap,A.alphaMapTransform)),p.alphaTest>0&&(A.alphaTest.value=p.alphaTest)}function h(A,p){A.specular.value.copy(p.specular),A.shininess.value=Math.max(p.shininess,1e-4)}function u(A,p){p.gradientMap&&(A.gradientMap.value=p.gradientMap)}function d(A,p){A.metalness.value=p.metalness,p.metalnessMap&&(A.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,A.metalnessMapTransform)),A.roughness.value=p.roughness,p.roughnessMap&&(A.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,A.roughnessMapTransform)),p.envMap&&(A.envMapIntensity.value=p.envMapIntensity)}function f(A,p,y){A.ior.value=p.ior,p.sheen>0&&(A.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),A.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(A.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,A.sheenColorMapTransform)),p.sheenRoughnessMap&&(A.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,A.sheenRoughnessMapTransform))),p.clearcoat>0&&(A.clearcoat.value=p.clearcoat,A.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(A.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,A.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(A.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,A.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(A.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,A.clearcoatNormalMapTransform),A.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Sn&&A.clearcoatNormalScale.value.negate())),p.dispersion>0&&(A.dispersion.value=p.dispersion),p.iridescence>0&&(A.iridescence.value=p.iridescence,A.iridescenceIOR.value=p.iridescenceIOR,A.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],A.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(A.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,A.iridescenceMapTransform)),p.iridescenceThicknessMap&&(A.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,A.iridescenceThicknessMapTransform))),p.transmission>0&&(A.transmission.value=p.transmission,A.transmissionSamplerMap.value=y.texture,A.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(A.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,A.transmissionMapTransform)),A.thickness.value=p.thickness,p.thicknessMap&&(A.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,A.thicknessMapTransform)),A.attenuationDistance.value=p.attenuationDistance,A.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(A.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(A.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,A.anisotropyMapTransform))),A.specularIntensity.value=p.specularIntensity,A.specularColor.value.copy(p.specularColor),p.specularColorMap&&(A.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,A.specularColorMapTransform)),p.specularIntensityMap&&(A.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,A.specularIntensityMapTransform))}function m(A,p){p.matcap&&(A.matcap.value=p.matcap)}function g(A,p){const y=e.get(p).light;A.referencePosition.value.setFromMatrixPosition(y.matrixWorld),A.nearDistance.value=y.shadow.camera.near,A.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function HS(i,e,t,n){let s={},r={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,b){const _=b.program;n.uniformBlockBinding(y,_)}function l(y,b){let _=s[y.id];_===void 0&&(m(y),_=h(y),s[y.id]=_,y.addEventListener("dispose",A));const M=b.program;n.updateUBOMapping(y,M);const w=e.render.frame;r[y.id]!==w&&(d(y),r[y.id]=w)}function h(y){const b=u();y.__bindingPointIndex=b;const _=i.createBuffer(),M=y.__size,w=y.usage;return i.bindBuffer(i.UNIFORM_BUFFER,_),i.bufferData(i.UNIFORM_BUFFER,M,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,b,_),_}function u(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const b=s[y.id],_=y.uniforms,M=y.__cache;i.bindBuffer(i.UNIFORM_BUFFER,b);for(let w=0,S=_.length;w<S;w++){const T=Array.isArray(_[w])?_[w]:[_[w]];for(let C=0,v=T.length;C<v;C++){const F=T[C];if(f(F,w,C,M)===!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=g(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(y,b,_,M){const w=y.value,S=b+"_"+_;if(M[S]===void 0)return typeof w=="number"||typeof w=="boolean"?M[S]=w:M[S]=w.clone(),!0;{const T=M[S];if(typeof w=="number"||typeof w=="boolean"){if(T!==w)return M[S]=w,!0}else if(T.equals(w)===!1)return T.copy(w),!0}return!1}function m(y){const b=y.uniforms;let _=0;const M=16;for(let S=0,T=b.length;S<T;S++){const C=Array.isArray(b[S])?b[S]:[b[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,D=q.length;$<D;$++){const O=q[$],Y=g(O),Q=_%M,J=Q%Y.boundary,ee=Q+J;_+=J,ee!==0&&M-ee<Y.storage&&(_+=M-ee),K.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=_,_+=Y.storage}}}const w=_%M;return w>0&&(_+=M-w),y.__size=_,y.__cache={},this}function g(y){const b={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(b.boundary=4,b.storage=4):y.isVector2?(b.boundary=8,b.storage=8):y.isVector3||y.isColor?(b.boundary=16,b.storage=12):y.isVector4?(b.boundary=16,b.storage=16):y.isMatrix3?(b.boundary=48,b.storage=48):y.isMatrix4?(b.boundary=64,b.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),b}function A(y){const b=y.target;b.removeEventListener("dispose",A);const _=a.indexOf(b.__bindingPointIndex);a.splice(_,1),i.deleteBuffer(s[b.id]),delete s[b.id],delete r[b.id]}function p(){for(const y in s)i.deleteBuffer(s[y]);a=[],s={},r={}}return{bind:c,update:l,dispose:p}}class pg{constructor(e={}){const{canvas:t=m_(),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 m=new Uint32Array(4),g=new Int32Array(4);let A=null,p=null;const y=[],b=[];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=bs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const _=this;let M=!1;this._outputColorSpace=Kt;let w=0,S=0,T=null,C=-1,v=null;const F=new _t,K=new _t;let q=null;const $=new qe(0);let D=0,O=t.width,Y=t.height,Q=1,J=null,ee=null;const ae=new _t(0,0,O,Y),ye=new _t(0,0,O,Y);let Me=!1;const se=new Mu;let me=!1,be=!1;const xe=new et,Pe=new et,$e=new H,Qe=new _t,St={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ut=!1;function Je(){return T===null?Q:1}let G=n;function mn(E,R){return t.getContext(E,R)}try{const E={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),G===null){const R="webgl2";if(G=mn(R,E),G===null)throw mn(R)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let dt,pt,ze,Rt,Ge,L,I,Z,le,Ae,oe,Ue,ve,Ve,Ye,Ee,Ne,ke,Oe,Te,tt,We,nt,W;function ne(){dt=new $v(G),dt.init(),We=new LS(G,dt),pt=new qv(G,dt,e,We),ze=new FS(G,dt),pt.reverseDepthBuffer&&d&&ze.buffers.depth.setReversed(!0),Rt=new nC(G),Ge=new ES,L=new DS(G,dt,ze,Ge,pt,We,Rt),I=new jv(_),Z=new Zv(_),le=new Hy(G),nt=new Vv(G,le),Ae=new eC(G,le,Rt,nt),oe=new sC(G,Ae,le,Rt),Oe=new iC(G,pt,L),Ee=new Kv(Ge),Ue=new xS(_,I,Z,dt,pt,nt,Ee),ve=new GS(_,Ge),Ve=new yS,Ye=new MS(dt),ke=new zv(_,I,Z,ze,oe,f,c),Ne=new RS(_,oe,pt),W=new HS(G,Rt,pt,ze),Te=new Wv(G,dt,Rt),tt=new tC(G,dt,Rt),Rt.programs=Ue.programs,_.capabilities=pt,_.extensions=dt,_.properties=Ge,_.renderLists=Ve,_.shadowMap=Ne,_.state=ze,_.info=Rt}ne();const re=new OS(_,G);this.xr=re,this.getContext=function(){return G},this.getContextAttributes=function(){return G.getContextAttributes()},this.forceContextLoss=function(){const E=dt.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=dt.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return Q},this.setPixelRatio=function(E){E!==void 0&&(Q=E,this.setSize(O,Y,!1))},this.getSize=function(E){return E.set(O,Y)},this.setSize=function(E,R,N=!0){if(re.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}O=E,Y=R,t.width=Math.floor(E*Q),t.height=Math.floor(R*Q),N===!0&&(t.style.width=E+"px",t.style.height=R+"px"),this.setViewport(0,0,E,R)},this.getDrawingBufferSize=function(E){return E.set(O*Q,Y*Q).floor()},this.setDrawingBufferSize=function(E,R,N){O=E,Y=R,Q=N,t.width=Math.floor(E*N),t.height=Math.floor(R*N),this.setViewport(0,0,E,R)},this.getCurrentViewport=function(E){return E.copy(F)},this.getViewport=function(E){return E.copy(ae)},this.setViewport=function(E,R,N,U){E.isVector4?ae.set(E.x,E.y,E.z,E.w):ae.set(E,R,N,U),ze.viewport(F.copy(ae).multiplyScalar(Q).round())},this.getScissor=function(E){return E.copy(ye)},this.setScissor=function(E,R,N,U){E.isVector4?ye.set(E.x,E.y,E.z,E.w):ye.set(E,R,N,U),ze.scissor(K.copy(ye).multiplyScalar(Q).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(E){ze.setScissorTest(Me=E)},this.setOpaqueSort=function(E){J=E},this.setTransparentSort=function(E){ee=E},this.getClearColor=function(E){return E.copy(ke.getClearColor())},this.setClearColor=function(){ke.setClearColor(...arguments)},this.getClearAlpha=function(){return ke.getClearAlpha()},this.setClearAlpha=function(){ke.setClearAlpha(...arguments)},this.clear=function(E=!0,R=!0,N=!0){let U=0;if(E){let P=!1;if(T!==null){const z=T.texture.format;P=z===Th||z===Bh||z===Mh}if(P){const z=T.texture.type,j=z===tn||z===Ys||z===Wa||z===qa||z===Sh||z===Ih,X=ke.getClearColor(),ie=ke.getClearAlpha(),he=X.r,ce=X.g,fe=X.b;j?(m[0]=he,m[1]=ce,m[2]=fe,m[3]=ie,G.clearBufferuiv(G.COLOR,0,m)):(g[0]=he,g[1]=ce,g[2]=fe,g[3]=ie,G.clearBufferiv(G.COLOR,0,g))}else U|=G.COLOR_BUFFER_BIT}R&&(U|=G.DEPTH_BUFFER_BIT),N&&(U|=G.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),G.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),ke.dispose(),Ve.dispose(),Ye.dispose(),Ge.dispose(),I.dispose(),Z.dispose(),oe.dispose(),nt.dispose(),W.dispose(),Ue.dispose(),re.dispose(),re.removeEventListener("sessionstart",lh),re.removeEventListener("sessionend",hh),As.stop()};function de(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),M=!0}function Ie(){console.log("THREE.WebGLRenderer: Context Restored."),M=!1;const E=Rt.autoReset,R=Ne.enabled,N=Ne.autoUpdate,U=Ne.needsUpdate,P=Ne.type;ne(),Rt.autoReset=E,Ne.enabled=R,Ne.autoUpdate=N,Ne.needsUpdate=U,Ne.type=P}function Se(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function it(E){const R=E.target;R.removeEventListener("dispose",it),Ot(R)}function Ot(E){bn(E),Ge.remove(E)}function bn(E){const R=Ge.get(E).programs;R!==void 0&&(R.forEach(function(N){Ue.releaseProgram(N)}),E.isShaderMaterial&&Ue.releaseShaderCache(E))}this.renderBufferDirect=function(E,R,N,U,P,z){R===null&&(R=St);const j=P.isMesh&&P.matrixWorld.determinant()<0,X=op(E,R,N,U,P);ze.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,_e=(ce.start+ce.count)*he;z!==null&&(ge=Math.max(ge,z.start*he),_e=Math.min(_e,(z.start+z.count)*he)),ie!==null?(ge=Math.max(ge,0),_e=Math.min(_e,ie.count)):fe!=null&&(ge=Math.max(ge,0),_e=Math.min(_e,fe.count));const De=_e-ge;if(De<0||De===1/0)return;nt.setup(P,U,X,N,ie);let Ke,He=Te;if(ie!==null&&(Ke=le.get(ie),He=tt,He.setIndex(Ke)),P.isMesh)U.wireframe===!0?(ze.setLineWidth(U.wireframeLinewidth*Je()),He.setMode(G.LINES)):He.setMode(G.TRIANGLES);else if(P.isLine){let Fe=U.linewidth;Fe===void 0&&(Fe=1),ze.setLineWidth(Fe*Je()),P.isLineSegments?He.setMode(G.LINES):P.isLineLoop?He.setMode(G.LINE_LOOP):He.setMode(G.LINE_STRIP)}else P.isPoints?He.setMode(G.POINTS):P.isSprite&&He.setMode(G.TRIANGLES);if(P.isBatchedMesh)if(P._multiDrawInstances!==null)yc("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),He.renderMultiDrawInstances(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount,P._multiDrawInstances);else if(dt.get("WEBGL_multi_draw"))He.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else{const Fe=P._multiDrawStarts,st=P._multiDrawCounts,Le=P._multiDrawCount,wt=ie?le.get(ie).bytesPerElement:1,un=Ge.get(U).currentProgram.getUniforms();for(let Et=0;Et<Le;Et++)un.setValue(G,"_gl_DrawID",Et),He.render(Fe[Et]/wt,st[Et])}else if(P.isInstancedMesh)He.renderInstances(ge,De,P.count);else if(N.isInstancedBufferGeometry){const Fe=N._maxInstanceCount!==void 0?N._maxInstanceCount:1/0,st=Math.min(N.instanceCount,Fe);He.renderInstances(ge,De,st)}else He.render(ge,De)};function yt(E,R,N){E.transparent===!0&&E.side===Ii&&E.forceSinglePass===!1?(E.side=Sn,E.needsUpdate=!0,za(E,R,N),E.side=Gi,E.needsUpdate=!0,za(E,R,N),E.side=Ii):za(E,R,N)}this.compile=function(E,R,N=null){N===null&&(N=E),p=Ye.get(N),p.init(R),b.push(p),N.traverseVisible(function(P){P.isLight&&P.layers.test(R.layers)&&(p.pushLight(P),P.castShadow&&p.pushShadow(P))}),E!==N&&E.traverseVisible(function(P){P.isLight&&P.layers.test(R.layers)&&(p.pushLight(P),P.castShadow&&p.pushShadow(P))}),p.setupLights();const U=new Set;return E.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];yt(X,N,P),U.add(X)}else yt(z,N,P),U.add(z)}),p=b.pop(),U},this.compileAsync=function(E,R,N=null){const U=this.compile(E,R,N);return new Promise(P=>{function z(){if(U.forEach(function(j){Ge.get(j).currentProgram.isReady()&&U.delete(j)}),U.size===0){P(E);return}setTimeout(z,10)}dt.get("KHR_parallel_shader_compile")!==null?z():setTimeout(z,10)})};let Yn=null;function Si(E){Yn&&Yn(E)}function lh(){As.stop()}function hh(){As.start()}const As=new QA;As.setAnimationLoop(Si),typeof self<"u"&&As.setContext(self),this.setAnimationLoop=function(E){Yn=E,re.setAnimationLoop(E),E===null?As.stop():As.start()},re.addEventListener("sessionstart",lh),re.addEventListener("sessionend",hh),this.render=function(E,R){if(R!==void 0&&R.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),R.parent===null&&R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),re.enabled===!0&&re.isPresenting===!0&&(re.cameraAutoUpdate===!0&&re.updateCamera(R),R=re.getCamera()),E.isScene===!0&&E.onBeforeRender(_,E,R,T),p=Ye.get(E,b.length),p.init(R),b.push(p),Pe.multiplyMatrices(R.projectionMatrix,R.matrixWorldInverse),se.setFromProjectionMatrix(Pe),be=this.localClippingEnabled,me=Ee.init(this.clippingPlanes,be),A=Ve.get(E,y.length),A.init(),y.push(A),re.enabled===!0&&re.isPresenting===!0){const z=_.xr.getDepthSensingMesh();z!==null&&ic(z,R,-1/0,_.sortObjects)}ic(E,R,0,_.sortObjects),A.finish(),_.sortObjects===!0&&A.sort(J,ee),ut=re.enabled===!1||re.isPresenting===!1||re.hasDepthSensing()===!1,ut&&ke.addToRenderList(A,E),this.info.render.frame++,me===!0&&Ee.beginShadows();const N=p.state.shadowsArray;Ne.render(N,E,R),me===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();const U=A.opaque,P=A.transmissive;if(p.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];uh(U,P,E,ie)}ut&&ke.render(E);for(let j=0,X=z.length;j<X;j++){const ie=z[j];sc(A,E,ie,ie.viewport)}}else P.length>0&&uh(U,P,E,R),ut&&ke.render(E),sc(A,E,R);T!==null&&S===0&&(L.updateMultisampleRenderTarget(T),L.updateRenderTargetMipmap(T)),E.isScene===!0&&E.onAfterRender(_,E,R),nt.resetDefaultState(),C=-1,v=null,b.pop(),b.length>0?(p=b[b.length-1],me===!0&&Ee.setGlobalState(_.clippingPlanes,p.state.camera)):p=null,y.pop(),y.length>0?A=y[y.length-1]:A=null};function ic(E,R,N,U){if(E.visible===!1)return;if(E.layers.test(R.layers)){if(E.isGroup)N=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(R);else if(E.isLight)p.pushLight(E),E.castShadow&&p.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||se.intersectsSprite(E)){U&&Qe.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Pe);const j=oe.update(E),X=E.material;X.visible&&A.push(E,j,X,N,Qe.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||se.intersectsObject(E))){const j=oe.update(E),X=E.material;if(U&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Qe.copy(E.boundingSphere.center)):(j.boundingSphere===null&&j.computeBoundingSphere(),Qe.copy(j.boundingSphere.center)),Qe.applyMatrix4(E.matrixWorld).applyMatrix4(Pe)),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&&A.push(E,j,ge,N,Qe.z,fe)}}else X.visible&&A.push(E,j,X,N,Qe.z,null)}}const z=E.children;for(let j=0,X=z.length;j<X;j++)ic(z[j],R,N,U)}function sc(E,R,N,U){const P=E.opaque,z=E.transmissive,j=E.transparent;p.setupLightsView(N),me===!0&&Ee.setGlobalState(_.clippingPlanes,N),U&&ze.viewport(F.copy(U)),P.length>0&&Ha(P,R,N),z.length>0&&Ha(z,R,N),j.length>0&&Ha(j,R,N),ze.buffers.depth.setTest(!0),ze.buffers.depth.setMask(!0),ze.buffers.color.setMask(!0),ze.setPolygonOffset(!1)}function uh(E,R,N,U){if((N.isScene===!0?N.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[U.id]===void 0&&(p.state.transmissionRenderTarget[U.id]=new Zs(1,1,{generateMipmaps:!0,type:dt.has("EXT_color_buffer_half_float")||dt.has("EXT_color_buffer_float")?Mn:tn,minFilter:Jn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:At.workingColorSpace}));const z=p.state.transmissionRenderTarget[U.id],j=U.viewport||F;z.setSize(j.z*_.transmissionResolutionScale,j.w*_.transmissionResolutionScale);const X=_.getRenderTarget();_.setRenderTarget(z),_.getClearColor($),D=_.getClearAlpha(),D<1&&_.setClearColor(16777215,.5),_.clear(),ut&&ke.render(N);const ie=_.toneMapping;_.toneMapping=bs;const he=U.viewport;if(U.viewport!==void 0&&(U.viewport=void 0),p.setupLightsView(U),me===!0&&Ee.setGlobalState(_.clippingPlanes,U),Ha(E,N,U),L.updateMultisampleRenderTarget(z),L.updateRenderTargetMipmap(z),dt.has("WEBGL_multisampled_render_to_texture")===!1){let ce=!1;for(let fe=0,ge=R.length;fe<ge;fe++){const _e=R[fe],De=_e.object,Ke=_e.geometry,He=_e.material,Fe=_e.group;if(He.side===Ii&&De.layers.test(U.layers)){const st=He.side;He.side=Sn,He.needsUpdate=!0,dh(De,N,U,Ke,He,Fe),He.side=st,He.needsUpdate=!0,ce=!0}}ce===!0&&(L.updateMultisampleRenderTarget(z),L.updateRenderTargetMipmap(z))}_.setRenderTarget(X),_.setClearColor($,D),he!==void 0&&(U.viewport=he),_.toneMapping=ie}function Ha(E,R,N){const U=R.isScene===!0?R.overrideMaterial:null;for(let P=0,z=E.length;P<z;P++){const j=E[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)&&dh(X,R,N,ie,ce,he)}}function dh(E,R,N,U,P,z){E.onBeforeRender(_,R,N,U,P,z),E.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),P.onBeforeRender(_,R,N,U,E,z),P.transparent===!0&&P.side===Ii&&P.forceSinglePass===!1?(P.side=Sn,P.needsUpdate=!0,_.renderBufferDirect(N,R,U,P,E,z),P.side=Gi,P.needsUpdate=!0,_.renderBufferDirect(N,R,U,P,E,z),P.side=Ii):_.renderBufferDirect(N,R,U,P,E,z),E.onAfterRender(_,R,N,U,P,z)}function za(E,R,N){R.isScene!==!0&&(R=St);const U=Ge.get(E),P=p.state.lights,z=p.state.shadowsArray,j=P.state.version,X=Ue.getParameters(E,P.state,z,R,N),ie=Ue.getProgramCacheKey(X);let he=U.programs;U.environment=E.isMeshStandardMaterial?R.environment:null,U.fog=R.fog,U.envMap=(E.isMeshStandardMaterial?Z:I).get(E.envMap||U.environment),U.envMapRotation=U.environment!==null&&E.envMap===null?R.environmentRotation:E.envMapRotation,he===void 0&&(E.addEventListener("dispose",it),he=new Map,U.programs=he);let ce=he.get(ie);if(ce!==void 0){if(U.currentProgram===ce&&U.lightsStateVersion===j)return ac(E,X),ce}else X.uniforms=Ue.getUniforms(E),E.onBeforeCompile(X,_),ce=Ue.acquireProgram(X,ie),he.set(ie,ce),U.uniforms=X.uniforms;const fe=U.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(fe.clippingPlanes=Ee.uniform),ac(E,X),U.needsLights=Ks(E),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 rc(E){if(E.uniformsList===null){const R=E.currentProgram.getUniforms();E.uniformsList=il.seqWithValue(R.seq,E.uniforms)}return E.uniformsList}function ac(E,R){const N=Ge.get(E);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(E,R,N,U,P){R.isScene!==!0&&(R=St),L.resetTextureUnits();const z=R.fog,j=U.isMeshStandardMaterial?R.environment:null,X=T===null?_.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:rn,ie=(U.isMeshStandardMaterial?Z:I).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,_e=!!N.morphAttributes.color;let De=bs;U.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(De=_.toneMapping);const Ke=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,He=Ke!==void 0?Ke.length:0,Fe=Ge.get(U),st=p.state.lights;if(me===!0&&(be===!0||E!==v)){const Lt=E===v&&U.id===C;Ee.setState(U,E,Lt)}let Le=!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!==ge||Fe.morphColors!==_e||Fe.toneMapping!==De||Fe.morphTargetsCount!==He)&&(Le=!0):(Le=!0,Fe.__version=U.version);let wt=Fe.currentProgram;Le===!0&&(wt=za(U,R,P));let un=!1,Et=!1,bt=!1;const je=wt.getUniforms(),qt=Fe.uniforms;if(ze.useProgram(wt.program)&&(un=!0,Et=!0,bt=!0),U.id!==C&&(C=U.id,Et=!0),un||v!==E){ze.buffers.depth.getReversed()?(xe.copy(E.projectionMatrix),x_(xe),E_(xe),je.setValue(G,"projectionMatrix",xe)):je.setValue(G,"projectionMatrix",E.projectionMatrix),je.setValue(G,"viewMatrix",E.matrixWorldInverse);const dn=je.map.cameraPosition;dn!==void 0&&dn.setValue(G,$e.setFromMatrixPosition(E.matrixWorld)),pt.logarithmicDepthBuffer&&je.setValue(G,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&je.setValue(G,"isOrthographic",E.isOrthographicCamera===!0),v!==E&&(v=E,Et=!0,bt=!0)}if(P.isSkinnedMesh){je.setOptional(G,P,"bindMatrix"),je.setOptional(G,P,"bindMatrixInverse");const Lt=P.skeleton;Lt&&(Lt.boneTexture===null&&Lt.computeBoneTexture(),je.setValue(G,"boneTexture",Lt.boneTexture,L))}P.isBatchedMesh&&(je.setOptional(G,P,"batchingTexture"),je.setValue(G,"batchingTexture",P._matricesTexture,L),je.setOptional(G,P,"batchingIdTexture"),je.setValue(G,"batchingIdTexture",P._indirectTexture,L),je.setOptional(G,P,"batchingColorTexture"),P._colorsTexture!==null&&je.setValue(G,"batchingColorTexture",P._colorsTexture,L));const xn=N.morphAttributes;if((xn.position!==void 0||xn.normal!==void 0||xn.color!==void 0)&&Oe.update(P,N,wt),(Et||Fe.receiveShadow!==P.receiveShadow)&&(Fe.receiveShadow=P.receiveShadow,je.setValue(G,"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),Et&&(je.setValue(G,"toneMappingExposure",_.toneMappingExposure),Fe.needsLights&&gs(qt,bt),z&&U.fog===!0&&ve.refreshFogUniforms(qt,z),ve.refreshMaterialUniforms(qt,U,Q,Y,p.state.transmissionRenderTarget[E.id]),il.upload(G,rc(Fe),qt,L)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(il.upload(G,rc(Fe),qt,L),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&je.setValue(G,"center",P.center),je.setValue(G,"modelViewMatrix",P.modelViewMatrix),je.setValue(G,"normalMatrix",P.normalMatrix),je.setValue(G,"modelMatrix",P.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const Lt=U.uniformsGroups;for(let dn=0,cp=Lt.length;dn<cp;dn++){const Rr=Lt[dn];W.update(Rr,wt),W.bind(Rr,wt)}}return wt}function gs(E,R){E.ambientLightColor.needsUpdate=R,E.lightProbe.needsUpdate=R,E.directionalLights.needsUpdate=R,E.directionalLightShadows.needsUpdate=R,E.pointLights.needsUpdate=R,E.pointLightShadows.needsUpdate=R,E.spotLights.needsUpdate=R,E.spotLightShadows.needsUpdate=R,E.rectAreaLights.needsUpdate=R,E.hemisphereLights.needsUpdate=R}function Ks(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(E,R,N){const U=Ge.get(E);U.__autoAllocateDepthBuffer=E.resolveDepthBuffer===!1,U.__autoAllocateDepthBuffer===!1&&(U.__useRenderToTexture=!1),Ge.get(E.texture).__webglTexture=R,Ge.get(E.depthTexture).__webglTexture=U.__autoAllocateDepthBuffer?void 0:N,U.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(E,R){const N=Ge.get(E);N.__webglFramebuffer=R,N.__useDefaultFramebuffer=R===void 0};const x=G.createFramebuffer();this.setRenderTarget=function(E,R=0,N=0){T=E,w=R,S=N;let U=!0,P=null,z=!1,j=!1;if(E){const ie=Ge.get(E);if(ie.__useDefaultFramebuffer!==void 0)ze.bindFramebuffer(G.FRAMEBUFFER,null),U=!1;else if(ie.__webglFramebuffer===void 0)L.setupRenderTarget(E);else if(ie.__hasExternalTextures)L.rebindTextures(E,Ge.get(E.texture).__webglTexture,Ge.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const fe=E.depthTexture;if(ie.__boundDepthTexture!==fe){if(fe!==null&&Ge.has(fe)&&(E.width!==fe.image.width||E.height!==fe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");L.setupDepthRenderbuffer(E)}}const he=E.texture;(he.isData3DTexture||he.isDataArrayTexture||he.isCompressedArrayTexture)&&(j=!0);const ce=Ge.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(ce[R])?P=ce[R][N]:P=ce[R],z=!0):E.samples>0&&L.useMultisampledRTT(E)===!1?P=Ge.get(E).__webglMultisampledFramebuffer:Array.isArray(ce)?P=ce[N]:P=ce,F.copy(E.viewport),K.copy(E.scissor),q=E.scissorTest}else F.copy(ae).multiplyScalar(Q).floor(),K.copy(ye).multiplyScalar(Q).floor(),q=Me;if(N!==0&&(P=x),ze.bindFramebuffer(G.FRAMEBUFFER,P)&&U&&ze.drawBuffers(E,P),ze.viewport(F),ze.scissor(K),ze.setScissorTest(q),z){const ie=Ge.get(E.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_CUBE_MAP_POSITIVE_X+R,ie.__webglTexture,N)}else if(j){const ie=Ge.get(E.texture),he=R;G.framebufferTextureLayer(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,ie.__webglTexture,N,he)}else if(E!==null&&N!==0){const ie=Ge.get(E.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,ie.__webglTexture,N)}C=-1},this.readRenderTargetPixels=function(E,R,N,U,P,z,j){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let X=Ge.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&j!==void 0&&(X=X[j]),X){ze.bindFramebuffer(G.FRAMEBUFFER,X);try{const ie=E.texture,he=ie.format,ce=ie.type;if(!pt.textureFormatReadable(he)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!pt.textureTypeReadable(ce)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}R>=0&&R<=E.width-U&&N>=0&&N<=E.height-P&&G.readPixels(R,N,U,P,We.convert(he),We.convert(ce),z)}finally{const ie=T!==null?Ge.get(T).__webglFramebuffer:null;ze.bindFramebuffer(G.FRAMEBUFFER,ie)}}},this.readRenderTargetPixelsAsync=async function(E,R,N,U,P,z,j){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let X=Ge.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&j!==void 0&&(X=X[j]),X)if(R>=0&&R<=E.width-U&&N>=0&&N<=E.height-P){ze.bindFramebuffer(G.FRAMEBUFFER,X);const ie=E.texture,he=ie.format,ce=ie.type;if(!pt.textureFormatReadable(he))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!pt.textureTypeReadable(ce))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const fe=G.createBuffer();G.bindBuffer(G.PIXEL_PACK_BUFFER,fe),G.bufferData(G.PIXEL_PACK_BUFFER,z.byteLength,G.STREAM_READ),G.readPixels(R,N,U,P,We.convert(he),We.convert(ce),0);const ge=T!==null?Ge.get(T).__webglFramebuffer:null;ze.bindFramebuffer(G.FRAMEBUFFER,ge);const _e=G.fenceSync(G.SYNC_GPU_COMMANDS_COMPLETE,0);return G.flush(),await b_(G,_e,4),G.bindBuffer(G.PIXEL_PACK_BUFFER,fe),G.getBufferSubData(G.PIXEL_PACK_BUFFER,0,z),G.deleteBuffer(fe),G.deleteSync(_e),z}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,R=null,N=0){const U=Math.pow(2,-N),P=Math.floor(E.image.width*U),z=Math.floor(E.image.height*U),j=R!==null?R.x:0,X=R!==null?R.y:0;L.setTexture2D(E,0),G.copyTexSubImage2D(G.TEXTURE_2D,N,0,0,j,X,P,z),ze.unbindTexture()};const B=G.createFramebuffer(),k=G.createFramebuffer();this.copyTextureToTexture=function(E,R,N=null,U=null,P=0,z=null){z===null&&(P!==0?(yc("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,_e,De;const Ke=E.isCompressedTexture?E.mipmaps[z]:E.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 xn=Math.pow(2,-P);j=Math.floor(Ke.width*xn),X=Math.floor(Ke.height*xn),E.isDataArrayTexture?ie=Ke.depth:E.isData3DTexture?ie=Math.floor(Ke.depth*xn):ie=1,he=0,ce=0,fe=0}U!==null?(ge=U.x,_e=U.y,De=U.z):(ge=0,_e=0,De=0);const He=We.convert(R.format),Fe=We.convert(R.type);let st;R.isData3DTexture?(L.setTexture3D(R,0),st=G.TEXTURE_3D):R.isDataArrayTexture||R.isCompressedArrayTexture?(L.setTexture2DArray(R,0),st=G.TEXTURE_2D_ARRAY):(L.setTexture2D(R,0),st=G.TEXTURE_2D),G.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,R.flipY),G.pixelStorei(G.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),G.pixelStorei(G.UNPACK_ALIGNMENT,R.unpackAlignment);const Le=G.getParameter(G.UNPACK_ROW_LENGTH),wt=G.getParameter(G.UNPACK_IMAGE_HEIGHT),un=G.getParameter(G.UNPACK_SKIP_PIXELS),Et=G.getParameter(G.UNPACK_SKIP_ROWS),bt=G.getParameter(G.UNPACK_SKIP_IMAGES);G.pixelStorei(G.UNPACK_ROW_LENGTH,Ke.width),G.pixelStorei(G.UNPACK_IMAGE_HEIGHT,Ke.height),G.pixelStorei(G.UNPACK_SKIP_PIXELS,he),G.pixelStorei(G.UNPACK_SKIP_ROWS,ce),G.pixelStorei(G.UNPACK_SKIP_IMAGES,fe);const je=E.isDataArrayTexture||E.isData3DTexture,qt=R.isDataArrayTexture||R.isData3DTexture;if(E.isDepthTexture){const xn=Ge.get(E),Lt=Ge.get(R),dn=Ge.get(xn.__renderTarget),cp=Ge.get(Lt.__renderTarget);ze.bindFramebuffer(G.READ_FRAMEBUFFER,dn.__webglFramebuffer),ze.bindFramebuffer(G.DRAW_FRAMEBUFFER,cp.__webglFramebuffer);for(let Rr=0;Rr<ie;Rr++)je&&(G.framebufferTextureLayer(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,Ge.get(E).__webglTexture,P,fe+Rr),G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,Ge.get(R).__webglTexture,z,De+Rr)),G.blitFramebuffer(he,ce,j,X,ge,_e,j,X,G.DEPTH_BUFFER_BIT,G.NEAREST);ze.bindFramebuffer(G.READ_FRAMEBUFFER,null),ze.bindFramebuffer(G.DRAW_FRAMEBUFFER,null)}else if(P!==0||E.isRenderTargetTexture||Ge.has(E)){const xn=Ge.get(E),Lt=Ge.get(R);ze.bindFramebuffer(G.READ_FRAMEBUFFER,B),ze.bindFramebuffer(G.DRAW_FRAMEBUFFER,k);for(let dn=0;dn<ie;dn++)je?G.framebufferTextureLayer(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,xn.__webglTexture,P,fe+dn):G.framebufferTexture2D(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,xn.__webglTexture,P),qt?G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,Lt.__webglTexture,z,De+dn):G.framebufferTexture2D(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,Lt.__webglTexture,z),P!==0?G.blitFramebuffer(he,ce,j,X,ge,_e,j,X,G.COLOR_BUFFER_BIT,G.NEAREST):qt?G.copyTexSubImage3D(st,z,ge,_e,De+dn,he,ce,j,X):G.copyTexSubImage2D(st,z,ge,_e,he,ce,j,X);ze.bindFramebuffer(G.READ_FRAMEBUFFER,null),ze.bindFramebuffer(G.DRAW_FRAMEBUFFER,null)}else qt?E.isDataTexture||E.isData3DTexture?G.texSubImage3D(st,z,ge,_e,De,j,X,ie,He,Fe,Ke.data):R.isCompressedArrayTexture?G.compressedTexSubImage3D(st,z,ge,_e,De,j,X,ie,He,Ke.data):G.texSubImage3D(st,z,ge,_e,De,j,X,ie,He,Fe,Ke):E.isDataTexture?G.texSubImage2D(G.TEXTURE_2D,z,ge,_e,j,X,He,Fe,Ke.data):E.isCompressedTexture?G.compressedTexSubImage2D(G.TEXTURE_2D,z,ge,_e,Ke.width,Ke.height,He,Ke.data):G.texSubImage2D(G.TEXTURE_2D,z,ge,_e,j,X,He,Fe,Ke);G.pixelStorei(G.UNPACK_ROW_LENGTH,Le),G.pixelStorei(G.UNPACK_IMAGE_HEIGHT,wt),G.pixelStorei(G.UNPACK_SKIP_PIXELS,un),G.pixelStorei(G.UNPACK_SKIP_ROWS,Et),G.pixelStorei(G.UNPACK_SKIP_IMAGES,bt),z===0&&R.generateMipmaps&&G.generateMipmap(st),ze.unbindTexture()},this.copyTextureToTexture3D=function(E,R,N=null,U=null,P=0){return yc('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(E,R,N,U,P)},this.initRenderTarget=function(E){Ge.get(E).__webglFramebuffer===void 0&&L.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?L.setTextureCube(E,0):E.isData3DTexture?L.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?L.setTexture2DArray(E,0):L.setTexture2D(E,0),ze.unbindTexture()},this.resetState=function(){w=0,S=0,T=null,ze.reset(),nt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=At._getDrawingBufferColorSpace(e),t.unpackColorSpace=At._getUnpackColorSpace()}}var Eo=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 Eo.Panel("FPS","#0ff","#002")),c=t(new Eo.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new Eo.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}};Eo.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,m=30*a,g=document.createElement("canvas");g.width=o,g.height=c,g.style.cssText="width:80px;height:48px";var A=g.getContext("2d");return A.font="bold "+9*a+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=t,A.fillRect(0,0,o,c),A.fillStyle=e,A.fillText(i,l,h),A.fillRect(u,d,f,m),A.fillStyle=t,A.globalAlpha=.9,A.fillRect(u,d,f,m),{dom:g,update:function(p,y){n=Math.min(n,p),s=Math.max(s,p),A.fillStyle=t,A.globalAlpha=1,A.fillRect(0,0,o,d),A.fillStyle=e,A.fillText(r(p)+" "+i+" ("+r(n)+"-"+r(s)+")",l,h),A.drawImage(g,u+a,d,f-a,m,u,d,f-a,m),A.fillRect(u+f-a,d,a,m),A.fillStyle=t,A.globalAlpha=.9,A.fillRect(u+f-a,d,a,r((1-p/y)*m))}}};function Ag(i,e){if(e===VE)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===Jh||e===Ip){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===Jh)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 Yu extends Zi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new KS(t)}),this.register(function(t){return new jS(t)}),this.register(function(t){return new iI(t)}),this.register(function(t){return new sI(t)}),this.register(function(t){return new rI(t)}),this.register(function(t){return new YS(t)}),this.register(function(t){return new JS(t)}),this.register(function(t){return new ZS(t)}),this.register(function(t){return new $S(t)}),this.register(function(t){return new qS(t)}),this.register(function(t){return new eI(t)}),this.register(function(t){return new XS(t)}),this.register(function(t){return new nI(t)}),this.register(function(t){return new tI(t)}),this.register(function(t){return new VS(t)}),this.register(function(t){return new aI(t)}),this.register(function(t){return new oI(t)})}load(e,t,n,s){const r=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=la.extractUrlBase(e);a=la.resolveURL(l,this.path)}else a=la.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 Bs(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))===gg){try{a[ft.KHR_BINARY_GLTF]=new cI(e)}catch(u){s&&s(u);return}r=JSON.parse(a[ft.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 _I(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 ft.KHR_MATERIALS_UNLIT:a[u]=new WS;break;case ft.KHR_DRACO_MESH_COMPRESSION:a[u]=new lI(r,this.dracoLoader);break;case ft.KHR_TEXTURE_TRANSFORM:a[u]=new hI;break;case ft.KHR_MESH_QUANTIZATION:a[u]=new uI;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 zS(){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 ft={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 VS{constructor(e){this.parser=e,this.name=ft.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 qe(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],rn);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new DA(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new FA(h),l.distance=u;break;case"spot":l=new Ey(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),es(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 WS{constructor(){this.name=ft.KHR_MATERIALS_UNLIT}getMaterialType(){return Cs}extendParams(e,t,n){const s=[];e.color=new qe(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],rn),e.opacity=a[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",r.baseColorTexture,Kt))}return Promise.all(s)}}class qS{constructor(e){this.parser=e,this.name=ft.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 KS{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 Ze(o,o)}return Promise.all(r)}}class jS{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 XS{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 YS{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 qe(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],rn)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,Kt)),a.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class JS{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 ZS{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 qe().setRGB(o[0],o[1],o[2],rn),Promise.all(r)}}class $S{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 eI{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 qe().setRGB(o[0],o[1],o[2],rn),a.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,Kt)),Promise.all(r)}}class tI{constructor(e){this.parser=e,this.name=ft.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 nI{constructor(e){this.parser=e,this.name=ft.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Ni}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 iI{constructor(e){this.parser=e,this.name=ft.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 sI{constructor(e){this.parser=e,this.name=ft.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 rI{constructor(e){this.parser=e,this.name=ft.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 aI{constructor(e){this.name=ft.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 oI{constructor(e){this.name=ft.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!==$n.TRIANGLES&&l.mode!==$n.TRIANGLE_STRIP&&l.mode!==$n.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 m of u){const g=new et,A=new H,p=new Vn,y=new H(1,1,1),b=new mA(m.geometry,m.material,d);for(let _=0;_<d;_++)c.TRANSLATION&&A.fromBufferAttribute(c.TRANSLATION,_),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,_),c.SCALE&&y.fromBufferAttribute(c.SCALE,_),b.setMatrixAt(_,g.compose(A,p,y));for(const _ in c)if(_==="_COLOR_0"){const M=c[_];b.instanceColor=new Su(M.array,M.itemSize,M.normalized)}else _!=="TRANSLATION"&&_!=="ROTATION"&&_!=="SCALE"&&m.geometry.setAttribute(_,c[_]);Pt.prototype.copy.call(b,m),this.parser.assignFinalMaterial(b),f.push(b)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}}const gg="glTF",_o=12,mg={JSON:1313821514,BIN:5130562};class cI{constructor(e){this.name=ft.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,_o),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!==gg)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-_o,r=new DataView(e,_o);let a=0;for(;a<s;){const o=r.getUint32(a,!0);a+=4;const c=r.getUint32(a,!0);if(a+=4,c===mg.JSON){const l=new Uint8Array(e,_o+a,o);this.content=n.decode(l)}else if(c===mg.BIN){const l=_o+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class lI{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ft.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=Zu[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=Zu[h]||h.toLowerCase();if(a[h]!==void 0){const d=n.accessors[e.attributes[h]],f=fa[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 m in f.attributes){const g=f.attributes[m],A=c[m];A!==void 0&&(g.normalized=A)}u(f)},o,l,rn,d)})})}}class hI{constructor(){this.name=ft.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 uI{constructor(){this.name=ft.KHR_MESH_QUANTIZATION}}class bg extends go{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,m=e*l,g=m-l,A=-2*f+3*d,p=f-d,y=1-A,b=p-d+u;for(let _=0;_!==o;_++){const M=a[g+_+o],w=a[g+_+c]*h,S=a[m+_+o],T=a[m+_]*h;r[_]=y*M+b*w+A*S+p*T}return r}}const dI=new Vn;class fI extends bg{interpolate_(e,t,n,s){const r=super.interpolate_(e,t,n,s);return dI.fromArray(r).normalize().toArray(r),r}}const $n={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},fa={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},xg={9728:In,9729:zt,9984:bp,9985:hc,9986:Va,9987:Jn},Eg={33071:oi,33648:lc,10497:kr},Ju={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Zu={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"},Rs={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pI={CUBICSPLINE:void 0,LINEAR:to,STEP:eo},$u={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function AI(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new Ao({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Gi})),i.DefaultMaterial}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 es(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 gI(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 mI(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 bI(i){let e;const t=i.extensions&&i.extensions[ft.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+ed(t.attributes):e=i.indices+":"+ed(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,s=i.targets.length;n<s;n++)e+=":"+ed(i.targets[n]);return e}function ed(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 td(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 xI(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 EI=new et;class _I{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new zS,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 my(this.options.manager):this.textureLoader=new vy(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Bs(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 cr(r,o,s),es(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[ft.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(r,a){n.load(la.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=Ju[s.type],o=fa[s.componentType],c=s.normalized===!0,l=new o(s.count*a);return Promise.resolve(new En(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=Ju[s.type],l=fa[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,m=s.normalized===!0;let g,A;if(f&&f!==u){const p=Math.floor(d/f),y="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+p+":"+s.count;let b=t.cache.get(y);b||(g=new l(o,p*f,s.count*f/h),b=new K_(g,f/h),t.cache.add(y,b)),A=new yu(b,c,d%f/h,m)}else o===null?g=new l(s.count*c):g=new l(o,d,s.count*c),A=new En(g,c,m);if(s.sparse!==void 0){const p=Ju.SCALAR,y=fa[s.sparse.indices.componentType],b=s.sparse.indices.byteOffset||0,_=s.sparse.values.byteOffset||0,M=new y(a[1],b,s.sparse.count*p),w=new l(a[2],_,s.sparse.count*c);o!==null&&(A=new En(A.array.slice(),A.itemSize,A.normalized)),A.normalized=!1;for(let S=0,T=M.length;S<T;S++){const C=M[S];if(A.setX(C,w[S*c]),c>=2&&A.setY(C,w[S*c+1]),c>=3&&A.setZ(C,w[S*c+2]),c>=4&&A.setW(C,w[S*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}A.normalized=m}return A})}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=xg[d.magFilter]||zt,h.minFilter=xg[d.minFilter]||Jn,h.wrapS=Eg[d.wrapS]||kr,h.wrapT=Eg[d.wrapT]||kr,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==In&&h.minFilter!==zt,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 m=d;t.isImageBitmapLoader===!0&&(m=function(g){const A=new an(g);A.needsUpdate=!0,d(A)}),t.load(la.resolveURL(u,r.path),m,void 0,f)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),es(u,a),u.userData.mimeType=a.mimeType||xI(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[ft.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[ft.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=r.associations.get(a);a=r.extensions[ft.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 Ru,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 fo,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 Ao}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[ft.KHR_MATERIALS_UNLIT]){const u=s[ft.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{const u=r.pbrMetallicRoughness||{};if(o.color=new qe(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],rn),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,Kt)),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=Ii);const h=r.alphaMode||$u.OPAQUE;if(h===$u.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===$u.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==Cs&&(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)}if(r.occlusionTexture!==void 0&&a!==Cs&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==Cs){const u=r.emissiveFactor;o.emissive=new qe().setRGB(u[0],u[1],u[2],rn)}return r.emissiveTexture!==void 0&&a!==Cs&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,Kt)),Promise.all(l).then(function(){const u=new a(o);return r.name&&(u.name=r.name),es(u,r),t.associations.set(u,{materials:e}),r.extensions&&cr(s,u,r),u})}createUniqueName(e){const t=vt.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[ft.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=bI(l),u=s[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[ft.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=_g(new On,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?AI(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,m=h.length;f<m;f++){const g=h[f],A=a[f];let p;const y=l[f];if(A.mode===$n.TRIANGLES||A.mode===$n.TRIANGLE_STRIP||A.mode===$n.TRIANGLE_FAN||A.mode===void 0)p=r.isSkinnedMesh===!0?new X_(g,y):new Jt(g,y),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),A.mode===$n.TRIANGLE_STRIP?p.geometry=Ag(p.geometry,Ip):A.mode===$n.TRIANGLE_FAN&&(p.geometry=Ag(p.geometry,Jh));else if(A.mode===$n.LINES)p=new Kc(g,y);else if(A.mode===$n.LINE_STRIP)p=new Tu(g,y);else if(A.mode===$n.LINE_LOOP)p=new ey(g,y);else if(A.mode===$n.POINTS)p=new ty(g,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(p.geometry.morphAttributes).length>0&&mI(p,r),p.name=t.createUniqueName(r.name||"mesh_"+e),es(p,r),A.extensions&&cr(s,p,A),t.assignFinalMaterial(p),u.push(p)}for(let f=0,m=u.length;f<m;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return r.extensions&&cr(s,u[0],r),u[0];const d=new nr;r.extensions&&cr(s,d,r),t.associations.set(d,{meshes:e});for(let f=0,m=u.length;f<m;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 Cn(Fp.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new ku(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),es(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 et;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 Cu(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],m=s.samplers[f.sampler],g=f.target,A=g.node,p=s.parameters!==void 0?s.parameters[m.input]:m.input,y=s.parameters!==void 0?s.parameters[m.output]:m.output;g.node!==void 0&&(a.push(this.getDependency("node",A)),o.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",y)),l.push(m),h.push(g))}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],m=u[2],g=u[3],A=u[4],p=[];for(let y=0,b=d.length;y<b;y++){const _=d[y],M=f[y],w=m[y],S=g[y],T=A[y];if(_===void 0)continue;_.updateMatrix&&_.updateMatrix();const C=n._createAnimationTracks(_,M,w,S,T);if(C)for(let v=0;v<C.length;v++)p.push(C[v])}return new Fu(r,void 0,p)})}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,EI)});for(let f=0,m=u.length;f<m;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 fA:l.length>1?h=new nr:l.length===1?h=l[0]:h=new Pt,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),es(h,r),r.extensions&&cr(n,h,r),r.matrix!==void 0){const u=new et;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 nr;n.name&&(r.name=s.createUniqueName(n.name)),es(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]));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 an)&&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=[];Rs[r.path]===Rs.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(Rs[r.path]){case Rs.weights:l=ra;break;case Rs.rotation:l=aa;break;case Rs.translation:case Rs.scale:l=ca;break;default:n.itemSize===1?l=ra:l=ca;break}const h=s.interpolation!==void 0?pI[s.interpolation]:to,u=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d<f;d++){const m=new l(c[d]+"."+Rs[r.path],t.array,u,h);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),a.push(m)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=td(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 aa?fI:bg;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function yI(i,e,t){const n=e.attributes,s=new Mi;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 H(c[0],c[1],c[2]),new H(l[0],l[1],l[2])),o.normalized){const h=td(fa[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 H,c=new H;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,m=d.max;if(f!==void 0&&m!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(m[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(m[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(m[2]))),d.normalized){const g=td(fa[d.componentType]);c.multiplyScalar(g)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(o)}i.boundingBox=s;const a=new Bi;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=Zu[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 At.workingColorSpace!==rn&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${At.workingColorSpace}" not supported.`),es(i,e),yI(i,e,t),Promise.all(s).then(function(){return e.targets!==void 0?gI(i,e.targets,t):i})}var wI=(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(p){r=p.instance,r.exports.__wasm_call_ctors()});function o(p){for(var y=new Uint8Array(p.length),b=0;b<p.length;++b){var _=p.charCodeAt(b);y[b]=_>96?_-97:_>64?_-39:_+4}for(var M=0,b=0;b<p.length;++b)y[M++]=y[b]<60?n[y[b]]:(y[b]-60)*64+y[++b];return y.buffer.slice(0,M)}function c(p,y,b,_,M,w){var S=r.exports.sbrk,T=b+3&-4,C=S(T*_),v=S(M.length),F=new Uint8Array(r.exports.memory.buffer);F.set(M,v);var K=p(C,b,_,v,M.length);if(K==0&&w&&w(C,T,_),y.set(F.subarray(C,C+b*_)),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(p){var y={object:new Worker(p),pending:0,requests:{}};return y.object.onmessage=function(b){var _=b.data;y.pending-=_.count,y.requests[_.id][_.action](_.value),delete y.requests[_.id]},y}function m(p){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()+A.toString(),b=new Blob([y],{type:"text/javascript"}),_=URL.createObjectURL(b),M=0;M<p;++M)u[M]=f(_);URL.revokeObjectURL(_)}function g(p,y,b,_,M){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(b),F=d++;w.pending+=p,w.requests[F]={resolve:T,reject:C},w.object.postMessage({id:F,count:p,size:y,source:v,mode:_,filter:M},[v.buffer])})}function A(p){a.then(function(){var y=p.data;try{var b=new Uint8Array(y.count*y.size);c(r.exports[y.mode],b,y.count,y.size,y.source,r.exports[y.filter]),self.postMessage({id:y.id,count:y.count,action:"resolve",value:b},[b.buffer])}catch(_){self.postMessage({id:y.id,count:y.count,action:"reject",value:_})}})}return{ready:a,supported:!0,useWorkers:function(p){m(p)},decodeVertexBuffer:function(p,y,b,_,M){c(r.exports.meshopt_decodeVertexBuffer,p,y,b,_,r.exports[l[M]])},decodeIndexBuffer:function(p,y,b,_){c(r.exports.meshopt_decodeIndexBuffer,p,y,b,_)},decodeIndexSequence:function(p,y,b,_){c(r.exports.meshopt_decodeIndexSequence,p,y,b,_)},decodeGltfBuffer:function(p,y,b,_,M,w){c(r.exports[h[M]],p,y,b,_,r.exports[l[w]])},decodeGltfBufferAsync:function(p,y,b,_,M){return u.length>0?g(p,y,b,h[_],l[M]):a.then(function(){var w=new Uint8Array(p*y);return c(r.exports[h[_]],w,p,y,b,r.exports[l[M]]),w})}}})();const yg={type:"change"},nd={type:"start"},wg={type:"end"},rl=new oo,vg=new Ms,vI=Math.cos(70*Fp.DEG2RAD),ln=new H,Qn=2*Math.PI,Bt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},id=1e-6;class CI extends Qy{constructor(e,t=null){super(e,t),this.state=Bt.NONE,this.target=new H,this.cursor=new H,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:Nr.ROTATE,MIDDLE:Nr.DOLLY,RIGHT:Nr.PAN},this.touches={ONE:Fr.ROTATE,TWO:Fr.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new H,this._lastQuaternion=new Vn,this._lastTargetPosition=new H,this._quat=new Vn().setFromUnitVectors(e.up,new H(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new PA,this._sphericalDelta=new PA,this._scale=1,this._panOffset=new H,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 H,this._mouse=new Ze,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=II.bind(this),this._onPointerDown=SI.bind(this),this._onPointerUp=MI.bind(this),this._onContextMenu=LI.bind(this),this._onMouseWheel=RI.bind(this),this._onKeyDown=NI.bind(this),this._onTouchStart=FI.bind(this),this._onTouchMove=DI.bind(this),this._onMouseDown=BI.bind(this),this._onMouseMove=TI.bind(this),this._interceptControlDown=PI.bind(this),this._interceptControlUp=kI.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(yg),this.update(),this.state=Bt.NONE}update(e=null){const t=this.object.position;ln.copy(t).sub(this.target),ln.applyQuaternion(this._quat),this._spherical.setFromVector3(ln),this.autoRotate&&this.state===Bt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(n)&&isFinite(s)&&(n<-Math.PI?n+=Qn:n>Math.PI&&(n-=Qn),s<-Math.PI?s+=Qn:s>Math.PI&&(s-=Qn),n<=s?this._spherical.theta=Math.max(n,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+s)/2?Math.max(n,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);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(ln.setFromSpherical(this._spherical),ln.applyQuaternion(this._quatInverse),t.copy(this.target).add(ln),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=ln.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 H(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 H(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=ln.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(rl.origin.copy(this.object.position),rl.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(rl.direction))<vI?this.object.lookAt(this.target):(vg.setFromNormalAndCoplanarPoint(this.object.up,this.target),rl.intersectPlane(vg,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)>id||8*(1-this._lastQuaternion.dot(this.object.quaternion))>id||this._lastTargetPosition.distanceToSquared(this.target)>id?(this.dispatchEvent(yg),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}_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){ln.setFromMatrixColumn(t,0),ln.multiplyScalar(-e),this._panOffset.add(ln)}_panUp(e,t){this.screenSpacePanning===!0?ln.setFromMatrixColumn(t,1):(ln.setFromMatrixColumn(t,0),ln.crossVectors(this.object.up,ln)),ln.multiplyScalar(e),this._panOffset.add(ln)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;ln.copy(s).sub(this.target);let r=ln.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(Qn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Qn*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(Qn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Qn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Qn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Qn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;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(Qn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Qn*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 Ze,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 SI(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 II(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function MI(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(wg),this.state=Bt.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 BI(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 Nr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Bt.DOLLY;break;case Nr.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Bt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Bt.ROTATE}break;case Nr.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Bt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Bt.PAN}break;default:this.state=Bt.NONE}this.state!==Bt.NONE&&this.dispatchEvent(nd)}function TI(i){switch(this.state){case Bt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Bt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Bt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function RI(i){this.enabled===!1||this.enableZoom===!1||this.state!==Bt.NONE||(i.preventDefault(),this.dispatchEvent(nd),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(wg))}function NI(i){this.enabled!==!1&&this._handleKeyDown(i)}function FI(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Fr.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Bt.TOUCH_ROTATE;break;case Fr.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Bt.TOUCH_PAN;break;default:this.state=Bt.NONE}break;case 2:switch(this.touches.TWO){case Fr.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Bt.TOUCH_DOLLY_PAN;break;case Fr.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Bt.TOUCH_DOLLY_ROTATE;break;default:this.state=Bt.NONE}break;default:this.state=Bt.NONE}this.state!==Bt.NONE&&this.dispatchEvent(nd)}function DI(i){switch(this._trackPointer(i),this.state){case Bt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Bt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Bt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Bt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Bt.NONE}}function LI(i){this.enabled!==!1&&i.preventDefault()}function PI(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function kI(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class UI extends _u{constructor(){super();const e=new $r;e.deleteAttribute("uv");const t=new Ao({side:Sn}),n=new Ao,s=new FA(16777215,900,28,2);s.position.set(.418,16.199,.3),this.add(s);const r=new Jt(e,t);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const a=new mA(e,n,6),o=new Pt;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 Jt(e,pa(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);const l=new Jt(e,pa(50));l.position.set(-16.109,18.021,-8.207),l.scale.set(.1,2.425,2.751),this.add(l);const h=new Jt(e,pa(17));h.position.set(14.904,12.198,-1.832),h.scale.set(.15,4.265,6.331),this.add(h);const u=new Jt(e,pa(43));u.position.set(-.462,8.89,14.52),u.scale.set(4.38,5.441,.088),this.add(u);const d=new Jt(e,pa(20));d.position.set(3.235,11.486,-12.541),d.scale.set(2.5,2,.1),this.add(d);const f=new Jt(e,pa(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 pa(i){const e=new Cs;return e.color.setScalar(i),e}function OI(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 Aa(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 Cg=Array.prototype.forEach,yo=Array.prototype.slice,ue={BREAK:{},extend:function(e){return this.each(yo.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(yo.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=yo.call(arguments);return function(){for(var t=yo.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e){if(Cg&&e.forEach&&e.forEach===Cg)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():yo.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}},QI=[{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:Aa},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:Aa},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:Aa},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:Aa}}},{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}}}}}],wo=void 0,al=void 0,sd=function(){al=!1;var e=arguments.length>1?ue.toArray(arguments):arguments[0];return ue.each(QI,function(t){if(t.litmus(e))return ue.each(t.conversions,function(n,s){if(wo=n.read(e),al===!1&&wo!==!1)return al=wo,wo.conversionName=s,wo.conversion=n,ue.BREAK}),ue.BREAK}),al},Sg=void 0,ol={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<<(Sg=t*8)|e&~(255<<Sg)}},GI=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},gi=function(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")},mi=(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}})(),Ns=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)}},Fs=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)},Ds=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},pn=(function(){function i(){if(gi(this,i),this.__state=sd.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return mi(i,[{key:"toString",value:function(){return Aa(this)}},{key:"toHexString",value:function(){return Aa(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]:(pn.recalculateRGB(this,e,t),this.__state[e])},set:function(s){this.__state.space!=="RGB"&&(pn.recalculateRGB(this,e,t),this.__state.space="RGB"),this.__state[e]=s}})}function ad(i,e){Object.defineProperty(i,e,{get:function(){return this.__state.space==="HSV"?this.__state[e]:(pn.recalculateHSV(this),this.__state[e])},set:function(n){this.__state.space!=="HSV"&&(pn.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=n}})}pn.recalculateRGB=function(i,e,t){if(i.__state.space==="HEX")i.__state[e]=ol.component_from_hex(i.__state.hex,t);else if(i.__state.space==="HSV")ue.extend(i.__state,ol.hsv_to_rgb(i.__state.h,i.__state.s,i.__state.v));else throw new Error("Corrupted color state")},pn.recalculateHSV=function(i){var e=ol.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},pn.COMPONENTS=["r","g","b","h","s","v","hex","a"],rd(pn.prototype,"r",2),rd(pn.prototype,"g",1),rd(pn.prototype,"b",0),ad(pn.prototype,"h"),ad(pn.prototype,"s"),ad(pn.prototype,"v"),Object.defineProperty(pn.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(pn.prototype,"hex",{get:function(){return this.__state.space!=="HEX"&&(this.__state.hex=ol.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 lr=(function(){function i(e,t){gi(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 mi(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})(),HI={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},Ig={};ue.each(HI,function(i,e){ue.each(i,function(t){Ig[t]=e})});var zI=/(\d+(\.\d+)?)px/;function Di(i){if(i==="0"||ue.isUndefined(i))return 0;var e=i.match(zI);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=Ig[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 Di(t["border-left-width"])+Di(t["border-right-width"])+Di(t["padding-left"])+Di(t["padding-right"])+Di(t.width)},getHeight:function(e){var t=getComputedStyle(e);return Di(t["border-top-width"])+Di(t["border-bottom-width"])+Di(t["padding-top"])+Di(t["padding-bottom"])+Di(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};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)}},Mg=(function(i){Fs(e,i);function e(t,n){gi(this,e);var s=Ds(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 mi(e,[{key:"setValue",value:function(n){var s=Ns(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),Ns(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(lr),VI=(function(i){Fs(e,i);function e(t,n,s){gi(this,e);var r=Ds(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 mi(e,[{key:"setValue",value:function(n){var s=Ns(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(),Ns(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e})(lr),WI=(function(i){Fs(e,i);function e(t,n){gi(this,e);var s=Ds(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 mi(e,[{key:"updateDisplay",value:function(){return te.isActive(this.__input)||(this.__input.value=this.getValue()),Ns(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(lr);function Bg(i){var e=i.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var Tg=(function(i){Fs(e,i);function e(t,n,s){gi(this,e);var r=Ds(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=Bg(r.__impliedStep),r}return mi(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),Ns(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=Bg(n),this}}]),e})(lr);function qI(i,e){var t=Math.pow(10,e);return Math.round(i*t)/t}var cl=(function(i){Fs(e,i);function e(t,n,s){gi(this,e);var r=Ds(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,s));r.__truncationSuspended=!1;var a=r,o=void 0;function c(){var m=parseFloat(a.__input.value);ue.isNaN(m)||a.setValue(m)}function l(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(){l()}function u(m){var g=o-m.clientY;a.setValue(a.getValue()+g*a.__impliedStep),o=m.clientY}function d(){te.unbind(window,"mousemove",u),te.unbind(window,"mouseup",d),l()}function f(m){te.bind(window,"mousemove",u),te.bind(window,"mouseup",d),o=m.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(m){m.keyCode===13&&(a.__truncationSuspended=!0,this.blur(),a.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return mi(e,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():qI(this.getValue(),this.__precision),Ns(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(Tg);function Rg(i,e,t,n,s){return n+(s-n)*((i-e)/(t-e))}var od=(function(i){Fs(e,i);function e(t,n,s,r,a){gi(this,e);var o=Ds(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(g){document.activeElement.blur(),te.bind(window,"mousemove",h),te.bind(window,"mouseup",u),h(g)}function h(g){g.preventDefault();var A=c.__background.getBoundingClientRect();return c.setValue(Rg(g.clientX,A.left,A.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(g){g.touches.length===1&&(te.bind(window,"touchmove",f),te.bind(window,"touchend",m),f(g))}function f(g){var A=g.touches[0].clientX,p=c.__background.getBoundingClientRect();c.setValue(Rg(A,p.left,p.right,c.__min,c.__max))}function m(){te.unbind(window,"touchmove",f),te.unbind(window,"touchend",m),c.__onFinishChange&&c.__onFinishChange.call(c,c.getValue())}return o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return mi(e,[{key:"updateDisplay",value:function(){var n=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=n*100+"%",Ns(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e})(Tg),Ng=(function(i){Fs(e,i);function e(t,n,s){gi(this,e);var r=Ds(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 mi(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})(lr),cd=(function(i){Fs(e,i);function e(t,n){gi(this,e);var s=Ds(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));s.__color=new pn(s.getValue()),s.__temp=new pn(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(g){g.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"}),Fg(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"}),jI(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(g){f(g),te.bind(window,"mousemove",f),te.bind(window,"touchmove",f),te.bind(window,"mouseup",l),te.bind(window,"touchend",l)}function c(g){m(g),te.bind(window,"mousemove",m),te.bind(window,"touchmove",m),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",m),te.unbind(window,"touchmove",m),te.unbind(window,"mouseup",h),te.unbind(window,"touchend",h),d()}function u(){var g=sd(this.value);g!==!1?(r.__color.__state=g,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(g){g.type.indexOf("touch")===-1&&g.preventDefault();var A=r.__saturation_field.getBoundingClientRect(),p=g.touches&&g.touches[0]||g,y=p.clientX,b=p.clientY,_=(y-A.left)/(A.right-A.left),M=1-(b-A.top)/(A.bottom-A.top);return M>1?M=1:M<0&&(M=0),_>1?_=1:_<0&&(_=0),r.__color.v=M,r.__color.s=_,r.setValue(r.__color.toOriginal()),!1}function m(g){g.type.indexOf("touch")===-1&&g.preventDefault();var A=r.__hue_field.getBoundingClientRect(),p=g.touches&&g.touches[0]||g,y=p.clientY,b=1-(y-A.top)/(A.bottom-A.top);return b>1?b=1:b<0&&(b=0),r.__color.h=b*360,r.setValue(r.__color.toOriginal()),!1}return s}return mi(e,[{key:"updateDisplay",value:function(){var n=sd(this.getValue());if(n!==!1){var s=!1;ue.each(pn.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,Fg(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})(lr),KI=["-moz-","-o-","-webkit-","-ms-",""];function Fg(i,e,t,n){i.style.background="",ue.each(KI,function(s){i.style.cssText+="background: "+s+"linear-gradient("+e+", "+t+" 0%, "+n+" 100%); "})}function jI(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 XI={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{}}},YI=`<div id="dg-save" class="dg dialogue">
+}`;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;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 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">
Here's the new load parameter for your <code>GUI</code>'s constructor:
@@ -3836,18 +3836,18 @@ void main() {
</div>
-</div>`,JI=function(e,t){var n=e[t];return ue.isArray(arguments[2])||ue.isObject(arguments[2])?new VI(e,t,arguments[2]):ue.isNumber(n)?ue.isNumber(arguments[2])&&ue.isNumber(arguments[3])?ue.isNumber(arguments[4])?new od(e,t,arguments[2],arguments[3],arguments[4]):new od(e,t,arguments[2],arguments[3]):ue.isNumber(arguments[4])?new cl(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new cl(e,t,{min:arguments[2],max:arguments[3]}):ue.isString(n)?new WI(e,t):ue.isFunction(n)?new Ng(e,t,""):ue.isBoolean(n)?new Mg(e,t):null};function ZI(i){setTimeout(i,1e3/60)}var $I=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||ZI,e1=(function(){function i(){gi(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 mi(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})(),t1=OI(`.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}
-`);XI.inject(t1);var Dg="dg",Lg=72,Pg=20,vo="Default",Co=(function(){try{return!!window.localStorage}catch{return!1}})(),So=void 0,kg=!0,ga=void 0,ld=!1,Ug=[],Nt=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,Dg),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:vo}:n.preset&&(n.load.preset=n.preset),ue.isUndefined(n.parent)&&n.hideable&&Ug.push(this),n.resizable=ue.isUndefined(n.parent)&&n.resizable,n.autoPlace&&ue.isUndefined(n.scrollable)&&(n.scrollable=!0);var s=Co&&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,r1(this),t.revert()}},width:{get:function(){return n.width},set:function(d){n.width=d,fd(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){Co&&(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),Co&&s){t.useLocalStorage=!0;var o=localStorage.getItem(ma(this,"gui"));o&&(n.load=JSON.parse(o))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=i.TEXT_CLOSED,te.addClass(this.__closeButton,i.CLASS_CLOSE_BUTTON),n.closeOnTop?(te.addClass(this.__closeButton,i.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(te.addClass(this.__closeButton,i.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),te.bind(this.__closeButton,"click",function(){t.closed=!t.closed})}else{n.closed===void 0&&(n.closed=!0);var c=document.createTextNode(n.name);te.addClass(c,"controller-name"),a=hd(t,c);var l=function(d){return d.preventDefault(),t.closed=!t.closed,!1};te.addClass(this.__ul,i.CLASS_CLOSED),te.addClass(a,"title"),te.bind(a,"click",l),n.closed||(this.closed=!1)}n.autoPlace&&(ue.isUndefined(n.parent)&&(kg&&(ga=document.createElement("div"),te.addClass(ga,Dg),te.addClass(ga,i.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ga),kg=!1),ga.appendChild(this.domElement),te.addClass(this.domElement,i.CLASS_AUTO_PLACE)),this.parent||fd(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&&s1(this),r=function(){Co&&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()};Nt.toggleHide=function(){ld=!ld,ue.each(Ug,function(i){i.domElement.style.display=ld?"none":""})},Nt.CLASS_AUTO_PLACE="a",Nt.CLASS_AUTO_PLACE_CONTAINER="ac",Nt.CLASS_MAIN="main",Nt.CLASS_CONTROLLER_ROW="cr",Nt.CLASS_TOO_TALL="taller-than-window",Nt.CLASS_CLOSED="closed",Nt.CLASS_CLOSE_BUTTON="close-button",Nt.CLASS_CLOSE_TOP="close-top",Nt.CLASS_CLOSE_BOTTOM="close-bottom",Nt.CLASS_DRAG="drag",Nt.DEFAULT_WIDTH=245,Nt.TEXT_CLOSED="Close Controls",Nt.TEXT_OPEN="Open Controls",Nt._keydownHandler=function(i){document.activeElement.type!=="text"&&(i.which===Lg||i.keyCode===Lg)&&Nt.toggleHide()},te.bind(window,"keydown",Nt._keydownHandler,!1),ue.extend(Nt.prototype,{add:function(e,t){return Io(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return Io(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&&ga.removeChild(this.domElement);var e=this;ue.each(this.__folders,function(t){e.removeFolder(t)}),te.unbind(window,"keydown",Nt._keydownHandler,!1),Og(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 Nt(t);this.__folders[e]=n;var s=hd(this,n.domElement);return te.addClass(s,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],Og(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-Pg<n?(te.addClass(e.domElement,Nt.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-Pg+"px"):(te.removeClass(e.domElement,Nt.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(So)&&(So=new e1,So.domElement.innerHTML=YI),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&&i1(e),e.__rememberedObjects.indexOf(t)===-1&&e.__rememberedObjects.push(t)}),this.autoPlace&&fd(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]=ll(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]=ll(this),ud(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[vo]=ll(this,!0)),this.load.remembered[e]=ll(this),this.preset=e,dd(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){ue.each(this.__controllers,function(t){this.getRoot().load.remembered?Qg(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||ud(this.getRoot(),!1)},listen:function(e){var t=this.__listening.length===0;this.__listening.push(e),t&&Hg(this.__listening)},updateDisplay:function(){ue.each(this.__controllers,function(e){e.updateDisplay()}),ue.each(this.__folders,function(e){e.updateDisplay()})}});function hd(i,e,t){var n=document.createElement("li");return e&&n.appendChild(e),t?i.__ul.insertBefore(n,t):i.__ul.appendChild(n),i.onResize(),n}function Og(i){te.unbind(window,"resize",i.__resizeHandler),i.saveToLocalStorageIfPossible&&te.unbind(window,"unload",i.saveToLocalStorageIfPossible)}function ud(i,e){var t=i.__preset_select[i.__preset_select.selectedIndex];e?t.innerHTML=t.value+"*":t.innerHTML=t.value}function n1(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(),Io(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(),Io(i,t.object,t.property,{before:c,factoryArgs:[a]})}},name:function(a){return t.__li.firstElementChild.firstElementChild.innerHTML=a,t},listen:function(){return t.__gui.listen(t),t},remove:function(){return t.__gui.remove(t),t}}),t instanceof od){var n=new cl(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 cl){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=Io(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 Mg?(te.bind(e,"click",function(){te.fakeEvent(t.__checkbox,"click")}),te.bind(t.__checkbox,"click",function(r){r.stopPropagation()})):t instanceof Ng?(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 cd&&(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()&&ud(i.getRoot(),!0),r},t.setValue)}function Qg(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[vo])a=r[vo];else return;if(a[n]&&a[n][e.property]!==void 0){var o=a[n][e.property];e.initialValue=o,e.setValue(o)}}}}function Io(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 cd(e,t);else{var r=[e,t].concat(n.factoryArgs);s=JI.apply(i,r)}n.before instanceof lr&&(n.before=n.before.__li),Qg(i,s),te.addClass(s.domElement,"c");var a=document.createElement("span");te.addClass(a,"property-name"),a.innerHTML=s.property;var o=document.createElement("div");o.appendChild(a),o.appendChild(s.domElement);var c=hd(i,o,n.before);return te.addClass(c,Nt.CLASS_CONTROLLER_ROW),s instanceof cd?te.addClass(c,"color"):te.addClass(c,GI(s.getValue())),n1(i,c,s),i.__controllers.push(s),s}function ma(i,e){return document.location.href+"."+e}function dd(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 Gg(i,e){e.style.display=i.useLocalStorage?"block":"none"}function i1(i){var e=i.__save_row=document.createElement("li");te.addClass(i.domElement,"has-save"),i.__ul.insertBefore(e,i.__ul.firstChild),te.addClass(e,"save-row");var t=document.createElement("span");t.innerHTML="&nbsp;",te.addClass(t,"button gears");var n=document.createElement("span");n.innerHTML="Save",te.addClass(n,"button"),te.addClass(n,"save");var s=document.createElement("span");s.innerHTML="New",te.addClass(s,"button"),te.addClass(s,"save-as");var r=document.createElement("span");r.innerHTML="Revert",te.addClass(r,"button"),te.addClass(r,"revert");var a=i.__preset_select=document.createElement("select");if(i.load&&i.load.remembered?ue.each(i.load.remembered,function(u,d){dd(i,d,d===i.preset)}):dd(i,vo,!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),Co){var o=document.getElementById("dg-local-explain"),c=document.getElementById("dg-local-storage"),l=document.getElementById("dg-save-locally");l.style.display="block",localStorage.getItem(ma(i,"isLocal"))==="true"&&c.setAttribute("checked","checked"),Gg(i,o),te.bind(c,"change",function(){i.useLocalStorage=!i.useLocalStorage,Gg(i,o)})}var h=document.getElementById("dg-new-constructor");te.bind(h,"keydown",function(u){u.metaKey&&(u.which===67||u.keyCode===67)&&So.hide()}),te.bind(t,"click",function(){h.innerHTML=JSON.stringify(i.getSaveObject(),void 0,2),So.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 s1(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,Nt.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,Nt.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 fd(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 ll(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 r1(i){for(var e=0;e<i.__preset_select.length;e++)i.__preset_select[e].value===i.preset&&(i.__preset_select.selectedIndex=e)}function Hg(i){i.length!==0&&$I.call(window,function(){Hg(i)}),ue.each(i,function(e){e.updateDisplay()})}var a1=Nt;const hl=[{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"}],o1=["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"],zg=[[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 c1(i){if(i<=255)return o1[i];let e=0,t=zg.length-1;for(;e<=t;){const n=e+t>>1,s=zg[n];if(i<s[0]){t=n-1;continue}if(i>s[1]){e=n+1;continue}return s[2]}return"L"}function l1(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 m=i.charCodeAt(l+1);m>=56320&&m<=57343&&(u=(h-55296<<10)+(m-56320)+65536,d=2)}const f=c1(u);(f==="R"||f==="AL"||f==="AN")&&(n=!0);for(let m=0;m<d;m++)t[l+m]=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 g=l;g<h;g++)t[g]=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 h1(i,e){const t=l1(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 u1=/[ \t\n\r\f]+/g,d1=/[\t\n\r\f]| {2,}|^ | $/;function f1(i){const e=i??"normal";return e==="pre-wrap"?{mode:e,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:e,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function p1(i){if(!d1.test(i))return i;let e=i.replace(u1," ");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 A1(i){return/[\r\f]/.test(i)?i.replace(/\r\n/g,`
+</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="&nbsp;",te.addClass(t,"button gears");var n=document.createElement("span");n.innerHTML="Save",te.addClass(n,"button"),te.addClass(n,"save");var s=document.createElement("span");s.innerHTML="New",te.addClass(s,"button"),te.addClass(s,"save-as");var r=document.createElement("span");r.innerHTML="Revert",te.addClass(r,"button"),te.addClass(r,"revert");var a=i.__preset_select=document.createElement("select");if(i.load&&i.load.remembered?ue.each(i.load.remembered,function(u,d){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,`
`).replace(/[\r\f]/g,`
`):i.replace(/\r\n/g,`
-`)}let pd=null,g1;function m1(){return pd===null&&(pd=new Intl.Segmenter(g1,{granularity:"word"})),pd}const b1=new RegExp("\\p{Script=Arabic}","u"),ul=new RegExp("\\p{M}","u"),Vg=new RegExp("\\p{Nd}","u");function Wg(i){return b1.test(i)}function qg(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 hr(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(qg(s))return!0;e++;continue}}if(qg(t))return!0}}return!1}function x1(i){const e=fl(i);return e!==null&&(Ad.has(e)||ur.has(e))}const E1=new Set([" "," ","⁠","\uFEFF"]);function _1(i){return hr(i)}function y1(i){const e=fl(i);return e!==null&&E1.has(e)}function w1(i){return!x1(i)&&!y1(i)}const Ad=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),dl=new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),gd=new Set(["'","’"]),ur=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),v1=new Set([":",".","،","؛"]),C1=new Set(["၏"]),S1=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function I1(i){if(md(i))return!0;let e=!1;for(const t of i){if(ur.has(t)){e=!0;continue}if(!(e&&ul.test(t)))return!1}return e}function M1(i){for(const e of i)if(!Ad.has(e)&&!ur.has(e))return!1;return i.length>0}function B1(i){if(md(i))return!0;for(const e of i)if(!dl.has(e)&&!gd.has(e)&&!ul.test(e))return!1;return i.length>0}function md(i){let e=!1;for(const t of i)if(!(t==="\\"||ul.test(t))){if(dl.has(t)||ur.has(t)||gd.has(t)){e=!0;continue}return!1}return e}function Kg(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 fl(i){if(i.length===0)return null;const e=Kg(i,i.length);return i.slice(e)}function T1(i){const e=Array.from(i);let t=e.length;for(;t>0;){const n=e[t-1];if(ul.test(n)){t--;continue}if(dl.has(n)||gd.has(n)){t--;continue}break}return t<=0||t===e.length?null:{head:e.slice(0,t).join(""),tail:e.slice(t).join("")}}function R1(i,e,t){return t==="text"&&!e&&i.length===1&&i!=="-"&&i!=="—"?i:null}function jg(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 Xg(i,e){return i&&e!==null&&v1.has(e)}function N1(i){const e=fl(i);return e!==null&&C1.has(e)}function F1(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 bd(i){let e=i.length;for(;e>0;){const t=Kg(i,e),n=i.slice(t,e);if(S1.has(n))return!0;if(!ur.has(n))return!1;e=t}return!1}function D1(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 L1=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function ei(i){return i.length===1?i[0]:i.join("")}function P1(i,e){const t=[];for(let n=i.length-1;n>=0;n--)t.push(i[n]);return t.push(e),ei(t)}function k1(i,e,t,n){if(!L1.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=D1(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:ei(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:ei(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 U1=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function O1(i,e){const t=i.texts[e];return t.startsWith("www.")?!0:U1.test(t)&&e+1<i.len&&i.kinds[e+1]==="text"&&i.texts[e+1]==="//"}function Q1(i){return i.includes("?")&&(i.includes("://")||i.startsWith("www."))}function G1(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"||!O1(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]=ei(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 H1(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]),!Q1(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(ei(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 z1=new Set([":","-","/","×",",",".","+","–","—"]),Yg=/^[A-Za-z0-9_]+[,:;]*$/,Jg=/[,:;]+$/;function Zg(i){for(const e of i)if(Vg.test(e))return!0;return!1}function pl(i){if(i.length===0)return!1;for(const e of i)if(!(Vg.test(e)||z1.has(e)))return!1;return!0}function V1(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"&&pl(a)&&Zg(a)){const c=[a];let l=r+1;for(;l<i.len&&i.kinds[l]==="text"&&pl(i.texts[l]);)c.push(i.texts[l]),l++;e.push(ei(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 W1(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&&Yg.test(a)){const l=[a];let h=Jg.test(a),u=r+1;for(;h&&u<i.len&&i.kinds[u]==="text"&&i.isWordLike[u]&&Yg.test(i.texts[u]);){const d=i.texts[u];l.push(d),h=Jg.test(d),u++}e.push(ei(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 q1(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||!Zg(h)||!pl(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 K1(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=ei(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=ei(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(ei(a)),t.push(o),n.push(c),s.push(l)}return{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function j1(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"||!hr(e[r])||!hr(e[r+1]))continue;const a=T1(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 $g(i,e,t){const n=m1();let s=0;const r=[],a=[],o=[],c=[],l=[],h=[],u=[],d=[],f=[],m=[],g=[],A=[];for(const w of n.segment(i))for(const S of k1(w.segment,w.isWordLike??!1,w.index,t)){let O=function(){h[D]!==null&&(a[D]=[jg(r,h,u,D)],h[D]=null),a[D].push(S.text),o[D]=o[D]||S.isWordLike,d[D]=d[D]||v,f[D]=f[D]||F,m[D]=q,g[D]=$,A[D]=Xg(f[D],K)};const T=S.kind==="text",C=R1(S.text,S.isWordLike,S.kind),v=hr(S.text),F=Wg(S.text),K=fl(S.text),q=bd(S.text),$=N1(S.text),D=s-1;e.carryCJKAfterClosingQuote&&T&&s>0&&c[D]==="text"&&v&&d[D]&&m[D]||T&&s>0&&c[D]==="text"&&M1(S.text)&&d[D]||T&&s>0&&c[D]==="text"&&g[D]?O():T&&s>0&&c[D]==="text"&&S.isWordLike&&F&&A[D]?(O(),o[D]=!0):C!==null&&s>0&&c[D]==="text"&&h[D]===C?u[D]=(u[D]??1)+1:T&&!S.isWordLike&&s>0&&c[D]==="text"&&(I1(S.text)||S.text==="-"&&o[D])?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,m[s]=q,g[s]=$,A[s]=Xg(F,K),s++)}for(let w=0;w<s;w++){if(h[w]!==null){r[w]=jg(r,h,u,w);continue}r[w]=ei(a[w])}for(let w=1;w<s;w++)c[w]==="text"&&!o[w]&&md(r[w])&&c[w-1]==="text"&&(r[w-1]+=r[w],o[w-1]=o[w-1]||o[w],r[w]="");const p=Array.from({length:s},()=>null);let y=-1;for(let w=s-1;w>=0;w--){const S=r[w];if(S.length!==0){if(c[w]==="text"&&!o[w]&&B1(S)&&y>=0&&c[y]==="text"){const T=p[y]??[];T.push(S),p[y]=T,l[y]=l[w],r[w]="";continue}y=w}}for(let w=0;w<s;w++){const S=p[w];S!=null&&(r[w]=P1(S,r[w]))}let b=0;for(let w=0;w<s;w++){const S=r[w];S.length!==0&&(b!==w&&(r[b]=S,o[b]=o[w],c[b]=c[w],l[b]=l[w]),b++)}r.length=b,o.length=b,c.length=b,l.length=b;const _=K1({len:b,texts:r,isWordLike:o,kinds:c,starts:l}),M=j1(W1(q1(V1(H1(G1(_))))));for(let w=0;w<M.len-1;w++){const S=F1(M.texts[w]);S!==null&&(M.kinds[w]!=="space"&&M.kinds[w]!=="preserved-space"||M.kinds[w+1]!=="text"||!Wg(M.texts[w+1])||(M.texts[w]=S.space,M.isWordLike[w]=!1,M.kinds[w]=M.kinds[w]==="preserved-space"?"preserved-space":"space",M.texts[w+1]=S.marks+M.texts[w+1],M.starts[w+1]=M.starts[w]+S.space.length))}return M}function X1(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 Y1(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(ei(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],m=i.isWordLike[u],g=i.starts[u];if(f==="text"){const A=_1(d),p=w1(d);if(r!==null&&c&&l){r.push(d),a=a||m,c=c||A,l=p;continue}h(),r=[d],a=m,o=g,c=A,l=p;continue}h(),e.push(d),t.push(m),n.push(f),s.push(g)}return h(),{len:e.length,texts:e,isWordLike:t,kinds:n,starts:s}}function J1(i,e,t="normal",n="normal"){const s=f1(t),r=s.mode==="pre-wrap"?A1(i):p1(i);if(r.length===0)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const a=n==="keep-all"?Y1($g(r,e,s)):$g(r,e,s);return{normalized:r,chunks:X1(a,s),...a}}let ba=null;const em=new Map;let xa=null;const Z1=96,$1=new RegExp("\\p{Emoji_Presentation}","u"),eM=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Ed=null;const tm=new Map;function _d(){if(ba!==null)return ba;if(typeof OffscreenCanvas<"u")return ba=new OffscreenCanvas(1,1).getContext("2d"),ba;if(typeof document<"u")return ba=document.createElement("canvas").getContext("2d"),ba;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function tM(i){let e=em.get(i);return e||(e=new Map,em.set(i,e)),e}function Ls(i,e){let t=e.get(i);return t===void 0&&(t={width:_d().measureText(i).width,containsCJK:hr(i)},e.set(i,t)),t}function Ea(){if(xa!==null)return xa;if(typeof navigator>"u")return xa={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},xa;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 xa={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},xa}function nM(i){const e=i.match(/(\d+(?:\.\d+)?)\s*px/);return e?parseFloat(e[1]):16}function nm(){return Ed===null&&(Ed=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ed}function iM(i){return $1.test(i)||i.includes("️")}function sM(i){return eM.test(i)}function rM(i,e){let t=tm.get(i);if(t!==void 0)return t;const n=_d();n.font=i;const s=n.measureText("😀").width;if(t=0,s>e+.5&&typeof document<"u"&&document.body!==null){const r=document.createElement("span");r.style.font=i,r.style.display="inline-block",r.style.visibility="hidden",r.style.position="absolute",r.textContent="😀",document.body.appendChild(r);const a=r.getBoundingClientRect().width;document.body.removeChild(r),s-a>.5&&(t=s-a)}return tm.set(i,t),t}function aM(i){let e=0;const t=nm();for(const n of t.segment(i))iM(n.segment)&&e++;return e}function oM(i,e){return e.emojiCount===void 0&&(e.emojiCount=aM(i)),e.emojiCount}function dr(i,e,t){return t===0?e.width:e.width-oM(i,e)*t}function cM(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=Ls(u,t);h.push(dr(u,d,n))}return e.breakableFitAdvances=h,e.breakableFitAdvances}if(s==="pair-context"||a.length>Z1){const h=[];let u=null,d=0;for(const f of a){const m=Ls(f,t),g=dr(f,m,n);if(u===null)h.push(g);else{const A=u+f,p=Ls(A,t);h.push(dr(A,p,n)-d)}u=f,d=g}return e.breakableFitAdvances=h,e.breakableFitAdvances}const o=[];let c="",l=0;for(const h of a){c+=h;const u=Ls(c,t),d=dr(c,u,n);o.push(d-l),l=d}return e.breakableFitAdvances=o,e.breakableFitAdvances}function lM(i,e){const t=_d();t.font=i;const n=tM(i),s=nM(i),r=e?rM(i,s):0;return{cache:n,fontSize:s,emojiCorrection:r}}function hM(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 im(i,e){if(e<=0)return 0;const t=i%e;return Math.abs(t)<=1e-6?e:e-t}function sm(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 uM(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 rm(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 yd(i,e){if(e.segmentIndex>=i.widths.length)return-1;const t=uM(i,e.segmentIndex);return t<0?-1:rm(i,t,e)}function dM(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:rm(i,n,t)}function fM(i,e){return i.simpleLineWalkFastPath?am(i,e):wd(i,e)}function am(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i;if(n.length===0)return 0;const o=Ea().lineFitEpsilon,c=e+o;let l=0,h=0,u=!1,d=0,f=0,m=0,g=0,A=-1,p=0;function y(){A=-1,p=0}function b(C=m,v=g,F=h){l++,t?.({startSegmentIndex:d,startGraphemeIndex:f,endSegmentIndex:C,endGraphemeIndex:v,width:F}),h=0,u=!1,y()}function _(C,v){u=!0,d=C,f=0,m=C+1,g=0,h=v}function M(C,v,F){u=!0,d=C,f=v,m=C,g=v+1,h=F}function w(C,v){if(!u){_(C,v);return}h+=v,m=C+1,g=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?(b(),M(C,K,q)):(h+=q,m=C,g=K+1):M(C,K,q)}u&&m===C&&g===F.length&&(m=C+1,g=0)}let T=0;for(;T<n.length&&!(!u&&(T=hM(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):_(T,C),F&&(A=T+1,p=h-C),T++;continue}if(h+C>c){if(F){w(T,C),b(T+1,0,h-C),T++;continue}if(A>=0){if(m>A||m===A&&g>0){b();continue}b(A,0,p);continue}if(C>e&&r[T]!==null){b(),S(T,0),T++;continue}b();continue}w(T,C),F&&(A=T+1,p=h-C),T++}return u&&b(),l}function wd(i,e,t){if(i.simpleLineWalkFastPath)return am(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=Ea(),d=u.lineFitEpsilon,f=e+d;let m=0,g=0,A=!1,p=0,y=0,b=0,_=0,M=-1,w=0,S=0,T=null;function C(){M=-1,w=0,S=0,T=null}function v(Q=b,J=_,ee=g){m++,t?.({startSegmentIndex:p,startGraphemeIndex:y,endSegmentIndex:Q,endGraphemeIndex:J,width:ee}),g=0,A=!1,C()}function F(Q,J){A=!0,p=Q,y=0,b=Q+1,_=0,g=J}function K(Q,J,ee){A=!0,p=Q,y=J,b=Q,_=J+1,g=ee}function q(Q,J){if(!A){F(Q,J);return}g+=J,b=Q+1,_=0}function $(Q,J,ee,ae){if(!J)return;const ye=Q==="tab"?0:s[ee],Me=Q==="tab"?ae:r[ee];M=ee+1,w=g-ae+ye,S=g-ae+Me,T=Q}function D(Q,J){const ee=o[Q];for(let ae=J;ae<ee.length;ae++){const ye=ee[ae];A?g+ye>f?(v(),K(Q,ae,ye)):(g+=ye,b=Q,_=ae+1):K(Q,ae,ye)}A&&b===Q&&_===ee.length&&(b=Q+1,_=0)}function O(Q){if(T!=="soft-hyphen")return!1;const J=o[Q];if(J==null)return!1;const{fitCount:ee,fittedWidth:ae}=sm(J,g,e,d,c);return ee===0?!1:(g=ae,b=Q,_=ee,C(),ee===J.length?(b=Q+1,_=0,!0):(v(Q,ee,ae+c),D(Q,ee),!0))}function Y(Q){m++,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}A=!1,g=0,p=J.startSegmentIndex,y=0,b=J.startSegmentIndex,_=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"?im(g,l):n[ee];if(ae==="soft-hyphen"){A&&(b=ee+1,_=0,M=ee+1,w=g+c,S=g+c,T=ae),ee++;continue}if(!A){Me>e&&o[ee]!==null?D(ee,0):F(ee,Me),$(ae,ye,ee,Me),ee++;continue}if(g+Me>f){const me=g+(ae==="tab"?0:s[ee]),be=g+(ae==="tab"?Me:r[ee]);if(T==="soft-hyphen"&&u.preferEarlySoftHyphenBreak&&w<=f){v(M,0,S);continue}if(T==="soft-hyphen"&&O(ee)){ee++;continue}if(ye&&me<=f){q(ee,Me),v(ee+1,0,be),ee++;continue}if(M>=0&&w<=f){if(b>M||b===M&&_>0){v();continue}const xe=M;v(xe,0,S),ee=xe;continue}if(Me>e&&o[ee]!==null){v(),D(ee,0),ee++;continue}v();continue}q(ee,Me),$(ae,ye,ee,Me),ee++}if(A){const ae=M===J.consumedEndSegmentIndex?S:g;v(J.consumedEndSegmentIndex,0,ae)}}return m}function vd(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=Ea(),f=d.lineFitEpsilon,m=n+f;let g=0,A=!1,p=e.segmentIndex,y=e.graphemeIndex,b=-1,_=0,M=0,w=null;function S(){b=-1,_=0,M=0,w=null}function T(D=p,O=y,Y=g){return A?(e.segmentIndex=D,e.graphemeIndex=O,Y):null}function C(D,O){A=!0,p=D+1,y=0,g=O}function v(D,O,Y){A=!0,p=D,y=O+1,g=Y}function F(D,O){if(!A){C(D,O);return}g+=O,p=D+1,y=0}function K(D,O,Y,Q){if(!O)return;const J=D==="tab"?0:a[Y],ee=D==="tab"?Q:o[Y];b=Y+1,_=g-Q+J,M=g-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(!A)v(D,Q,J);else{if(g+J>m)return T();g+=J,p=D,y=Q+1}}return A&&p===D&&y===Y.length&&(p=D+1,y=0),null}function $(D){if(w!=="soft-hyphen"||b<0)return null;const O=l[D]??null;if(O!==null){const{fitCount:Y,fittedWidth:Q}=sm(O,g,n,f,h);if(Y===O.length)return g=Q,p=D+1,y=0,S(),null;if(Y>0)return T(D,Y,Q+h)}return _<=m?T(b,0,M):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"?im(g,u):r[D];if(O==="soft-hyphen"&&Q===0){A&&(p=D+1,y=0,b=D+1,_=g+h,M=g+h,w=O);continue}if(!A){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(g+J>m){const ae=g+(O==="tab"?0:a[D]),ye=g+(O==="tab"?J:o[D]);if(w==="soft-hyphen"&&d.preferEarlySoftHyphenBreak&&_<=m)return T(b,0,M);const Me=$(D);if(Me!==null)return Me;if(Y&&ae<=m)return F(D,J),T(D+1,0,ye);if(b>=0&&_<=m)return p>b||p===b&&y>0?T():T(b,0,M);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 b===s.consumedEndSegmentIndex&&y===0?T(s.consumedEndSegmentIndex,0,M):T(s.consumedEndSegmentIndex,0,g)}function om(i,e,t){const{widths:n,kinds:s,breakableFitAdvances:r}=i,o=Ea().lineFitEpsilon,c=t+o;let l=0,h=!1,u=e.segmentIndex,d=e.graphemeIndex,f=-1,m=0;for(let g=e.segmentIndex;g<n.length;g++){const A=n[g],p=s[g],y=p==="space"||p==="preserved-space"||p==="tab"||p==="zero-width-break"||p==="soft-hyphen",b=g===e.segmentIndex?e.graphemeIndex:0,_=r[g];if(!h){if(b>0||A>t&&_!==null){const M=_,w=M[b];h=!0,l=w,u=g,d=b+1;for(let S=b+1;S<M.length;S++){const T=M[S];if(l+T>c)return e.segmentIndex=u,e.graphemeIndex=d,l;l+=T,u=g,d=S+1}u===g&&d===M.length&&(u=g+1,d=0)}else h=!0,l=A,u=g+1,d=0;y&&(f=g+1,m=l-A);continue}if(l+A>c)return y?(e.segmentIndex=g+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,m):(e.segmentIndex=u,e.graphemeIndex=d,l);l+=A,u=g+1,d=0,y&&(f=g+1,m=l-A)}return h?(e.segmentIndex=u,e.graphemeIndex=d,l):null}function Cd(i,e,t){const n={segmentIndex:e.segmentIndex,graphemeIndex:e.graphemeIndex},s=yd(i,n);if(s<0)return null;const r=n.segmentIndex,a=n.graphemeIndex,o=i.simpleLineWalkFastPath?om(i,n,t):vd(i,n,s,t);return o===null?null:{startSegmentIndex:r,startGraphemeIndex:a,endSegmentIndex:n.segmentIndex,endGraphemeIndex:n.graphemeIndex,width:o}}function pM(i,e,t){const n=yd(i,e);return n<0?null:i.simpleLineWalkFastPath?om(i,e,t):vd(i,e,n,t)}function AM(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=yd(i,t);for(;r>=0;){const a=vd(i,t,r,e);if(a===null)return{lineCount:n,maxLineWidth:s};n++,a>s&&(s=a),r=dM(i,r,t)}return{lineCount:n,maxLineWidth:s}}for(;;){const r=pM(i,t,e);if(r===null)return{lineCount:n,maxLineWidth:s};n++,r>s&&(s=r)}}let Sd=null,cm=new WeakMap;function lm(){return Sd===null&&(Sd=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Sd}function gM(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 mM(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=bd(u),o=dl.has(u)}function h(u,d){n.push(u),r=r||d;const f=bd(u);u.length===1&&ur.has(u)?a=a||f:a=f,o=!1}for(const u of lm().segment(i)){const d=u.segment,f=hr(d);if(n.length===0){l(d,u.index,f);continue}if(o||Ad.has(d)||ur.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 bM(i,e,t,n){const s=Ea(),{cache:r,emojiCorrection:a}=lM(e,sM(i.normalized)),o=dr("-",Ls("-",r),a),l=dr(" ",Ls(" ",r),a)*8;if(i.len===0)return gM(t);const h=[],u=[],d=[],f=[];let m=i.chunks.length<=1;const g=t?[]:null,A=[],p=t?[]:null,y=Array.from({length:i.len});function b(S,T,C,v,F,K,q){F!=="text"&&F!=="space"&&F!=="zero-width-break"&&(m=!1),h.push(T),u.push(C),d.push(v),f.push(F),g?.push(K),A.push(q),p!==null&&p.push(S)}function _(S,T,C,v,F){const K=Ls(S,r),q=dr(S,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&&S.length>1){let O="sum-graphemes";pl(S)?O="pair-context":s.preferPrefixWidthsForBreakableRuns&&(O="segment-prefixes");const Y=cM(S,K,r,a,O);b(S,q,$,D,T,C,Y);return}b(S,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];if(v==="soft-hyphen"){b(T,0,o,o,v,F,null);continue}if(v==="hard-break"){b(T,0,0,0,v,F,null);continue}if(v==="tab"){b(T,0,0,0,v,F,null);continue}const K=Ls(T,r);if(v==="text"&&K.containsCJK){const $=mM(T,s);for(let D=0;D<$.length;D++){const O=$[D];_(O.text,"text",F+O.start,C,!hr(O.text))}continue}_(T,v,F,C,!0)}const M=xM(i.chunks,y,h.length),w=g===null?null:h1(i.normalized,g);return p!==null?{widths:h,lineEndFitAdvances:u,lineEndPaintAdvances:d,kinds:f,simpleLineWalkFastPath:m,segLevels:w,breakableFitAdvances:A,discretionaryHyphenWidth:o,tabStopAdvance:l,chunks:M,segments:p}:{widths:h,lineEndFitAdvances:u,lineEndPaintAdvances:d,kinds:f,simpleLineWalkFastPath:m,segLevels:w,breakableFitAdvances:A,discretionaryHyphenWidth:o,tabStopAdvance:l,chunks:M}}function xM(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=J1(i,Ea(),n?.whiteSpace,"normal");return bM(r,e,t)}function Al(i,e,t){return hm(i,e,!1,t)}function gl(i,e,t){return hm(i,e,!0,t)}function ML(i){return i}function EM(i,e,t){const n=fM(i,e);return{lineCount:n,height:n*t}}function um(i,e,t){let n=t.get(i);if(n!==void 0)return n;n=[];const s=lm();for(const r of s.segment(e[i]))n.push(r.segment);return t.set(i,n),n}function dm(i){let e=cm.get(i);return e!==void 0||(e=new Map,cm.set(i,e)),e}function _M(i,e,t,n){return n>0&&i[n-1]==="soft-hyphen"&&!(e===n&&t>0)}function yM(i,e,t,n,s,r,a){let o="";const c=_M(e,n,s,r);for(let l=n;l<r;l++)e[l]==="soft-hyphen"||e[l]==="hard-break"||(l===n&&s>0?o+=um(l,i,t).slice(s).join(""):o+=i[l]);return a>0?(c&&(o+="-"),o+=um(r,i,t).slice(n===r?s:0,a).join("")):c&&(o+="-"),o}function fm(i,e,t,n,s,r,a){return{text:yM(i.segments,i.kinds,e,n,s,r,a),width:t,start:{segmentIndex:n,graphemeIndex:s},end:{segmentIndex:r,graphemeIndex:a}}}function wM(i,e,t){return fm(i,e,t.width,t.startSegmentIndex,t.startGraphemeIndex,t.endSegmentIndex,t.endGraphemeIndex)}function vM(i){return{width:i.width,start:{segmentIndex:i.startSegmentIndex,graphemeIndex:i.startGraphemeIndex},end:{segmentIndex:i.endSegmentIndex,graphemeIndex:i.endGraphemeIndex}}}function CM(i,e){return fm(i,dm(i),e.width,e.start.segmentIndex,e.start.graphemeIndex,e.end.segmentIndex,e.end.graphemeIndex)}function SM(i,e,t){return i.widths.length===0?0:wd(i,e,n=>{t(vM(n))})}function Id(i,e){return AM(i,e)}function pm(i){let e=0;return SM(i,Number.POSITIVE_INFINITY,t=>{t.width>e&&(e=t.width)}),e}function IM(i,e,t){const n=[];if(i.widths.length===0)return{lineCount:0,height:0,lines:n};const s=dm(i),r=wd(i,e,a=>{n.push(wM(i,s,a))});return{lineCount:r,height:r*t,lines:n}}const MM=/[ \t\n\f\r]+/,Am=/^[ \t\n\f\r]+/,gm=/[ \t\n\f\r]+$/,ml={segmentIndex:0,graphemeIndex:0},mm={itemIndex:0,segmentIndex:0,graphemeIndex:0};function BL(i){return i}function Md(i){return{segmentIndex:i.segmentIndex,graphemeIndex:i.graphemeIndex}}function bm(i){return i.segmentIndex===0&&i.graphemeIndex===0}function bl(i,e){const t=e.get(i);if(t!==void 0)return t;const n=pm(gl("A A",i)),s=pm(gl("AA",i)),r=Math.max(0,n-s);return e.set(i,r),r}function BM(i){const e=Cd(i,ml,Number.POSITIVE_INFINITY);return e===null?null:{endGraphemeIndex:e.endGraphemeIndex,endSegmentIndex:e.endSegmentIndex,width:e.width}}function TM(i,e){return i===0&&e>0}function xm(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=Am.test(a.text),c=gm.test(a.text),l=a.text.replace(Am,"").replace(gm,"");if(l.length===0){MM.test(a.text)&&s===0&&(s=bl(a.font,n));continue}const h=s>0?s:o?bl(a.font,n):0,u=gl(l,a.font),d=BM(u);if(d===null){s=c?bl(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?bl(a.font,n):0}return{items:e,itemsBySourceItemIndex:t}}function RM(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(!bm(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=bm(c);if(l.break==="never"){if(!u){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}const g=l.naturalWidth+l.extraWidth,A=h+g;if(r>0&&A>a)break e;n?.(l,h,g,Md(ml),{segmentIndex:l.endSegmentIndex,graphemeIndex:l.endGraphemeIndex}),r+=A,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 g=d+l.naturalWidth;if(g<=a){n?.(l,h,l.naturalWidth+l.extraWidth,Md(ml),{segmentIndex:l.endSegmentIndex,graphemeIndex:l.endGraphemeIndex}),r+=g,a=Math.max(0,s-r),o++,c.segmentIndex=0,c.graphemeIndex=0;continue}}const f=Math.max(1,a-d),m=Cd(l.prepared,c,f);if(m===null){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}if(c.segmentIndex===m.endSegmentIndex&&c.graphemeIndex===m.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}if(r>0&&u&&h>0&&TM(m.endSegmentIndex,m.endGraphemeIndex)){const g=Cd(l.prepared,ml,Math.max(1,s-l.extraWidth));if(g!==null&&(g.endSegmentIndex>m.endSegmentIndex||g.endSegmentIndex===m.endSegmentIndex&&g.endGraphemeIndex>m.endGraphemeIndex))break e}if(n?.(l,h,m.width+l.extraWidth,Md(c),{segmentIndex:m.endSegmentIndex,graphemeIndex:m.endGraphemeIndex}),r+=h+m.width+l.extraWidth,a=Math.max(0,s-r),m.endSegmentIndex===l.endSegmentIndex&&m.endGraphemeIndex===l.endGraphemeIndex){o++,c.segmentIndex=0,c.graphemeIndex=0;continue}c.segmentIndex=m.endSegmentIndex,c.graphemeIndex=m.endGraphemeIndex;break}return r===0?null:(t.itemIndex=o,t.segmentIndex=c.segmentIndex,t.graphemeIndex=c.graphemeIndex,r)}function NM(i,e,t=mm){const n=i,s={itemIndex:t.itemIndex,segmentIndex:t.segmentIndex,graphemeIndex:t.graphemeIndex},r=[],a=RM(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 FM(i,e){return CM(i.prepared,{width:e.occupiedWidth-i.extraWidth,start:e.start,end:e.end}).text}function Em(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:FM(s,n)}}),width:e.width,end:e.end}}function _m(i,e,t){let n=0,s=mm;for(;;){const r=NM(i,e,s);if(r===null)return n;t(r),n++,s=r.end}}const ym="500 14px Inter, sans-serif",Bd="600 10px Inter, sans-serif",Td="300 13px Inter, sans-serif",wm="600 10px Inter, sans-serif",vm="300 12px Inter, sans-serif",Mo=18,xl=16,hn=16,Li=6,Cm=12,El=Math.min(window.devicePixelRatio||1,2),DM="rgba(0, 0, 0, 0.75)",LM="rgba(255, 255, 255, 0.08)",PM="rgba(255, 255, 255, 0.9)",kM="rgba(255, 255, 255, 0.30)",UM="rgba(255, 255, 255, 0.85)",Sm="rgba(255, 255, 255, 0.08)",OM="rgba(255, 255, 255, 0.45)",QM="rgba(255, 255, 255, 0.08)",GM="rgba(255, 255, 255, 0.7)";function HM(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 Bo(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function zM(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 VM(i,e,t){const n=HM(e),s=zM(n,t),r=[{label:"MESHES",value:Bo(n.meshes)},{label:"VERTICES",value:Bo(n.vertices)},{label:"TRIANGLES",value:Bo(n.triangles)},{label:"MATERIALS",value:Bo(n.materials)},{label:"TEXTURES",value:Bo(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=Al("Model Info",ym),l=EM(c,o,Mo+2),h=r.map(w=>{const S=[{text:w.label+" ",font:Bd},{text:w.value,font:Td}],T=xm(S),C=Al(w.label,Bd),v=Id(C,o),F=Al(w.value,Td),K=Id(F,o);return{...w,labelWidth:v.maxLineWidth,valueWidth:K.maxLineWidth,richPrepared:T}}),u=a.map(w=>{const S=Al(w,wm),T=Id(S,300);return{text:w,width:T.maxLineWidth+Cm}});let d=[],f=0;if(s){const w=gl(s,vm),S=IM(w,o-hn,Mo);d=S.lines,f=S.height}const m=Math.max(l.width+hn*2,...h.map(w=>w.labelWidth+w.valueWidth+hn*3)),g=Math.max(m,180);let A=0;if(u.length>0){let w=0,S=1;u.forEach(T=>{w>0&&w+T.width>g-hn*2&&(S++,w=0),w+=T.width+6}),A=S*(xl+6)+Li}const p=hn+l.height+Li+Li+h.length*(Mo+Li)+A+(f>0?Li+f:0)+hn,y=document.createElement("canvas");y.width=g*El,y.height=p*El,y.style.width=g+"px",y.style.height=p+"px";const b=y.getContext("2d");b.scale(El,El),b.fillStyle=DM,Rd(b,0,0,g,p,10),b.fill(),b.strokeStyle=LM,b.lineWidth=1,Rd(b,.5,.5,g-1,p-1,10),b.stroke();let _=hn;if(b.font=ym,b.fillStyle=PM,b.textBaseline="top",b.fillText("Model Info",hn,_),_+=l.height+Li,b.strokeStyle=Sm,b.beginPath(),b.moveTo(hn,_),b.lineTo(g-hn,_),b.stroke(),_+=Li,h.forEach(w=>{b.font=Bd,b.fillStyle=kM,b.textAlign="left",b.fillText(w.label,hn,_),b.font=Td,b.fillStyle=UM,b.textAlign="right",b.fillText(w.value,g-hn,_),b.textAlign="left",_+=Mo+Li}),u.length>0){let w=hn;u.forEach(S=>{w>hn&&w+S.width>g-hn&&(w=hn,_+=xl+6),b.fillStyle=QM,Rd(b,w,_,S.width,xl,4),b.fill(),b.font=wm,b.fillStyle=GM,b.textBaseline="top",b.fillText(S.text,w+Cm/2,_+3),w+=S.width+6}),_+=xl+Li+4}d.length>0&&(b.strokeStyle=Sm,b.beginPath(),b.moveTo(hn,_),b.lineTo(g-hn,_),b.stroke(),_+=Li,b.font=vm,b.fillStyle=OM,b.textBaseline="top",d.forEach(w=>{b.fillText(w.text,hn,_),_+=Mo}));const M=document.createElement("div");return M.classList.add("model-info"),M.appendChild(y),i.appendChild(M),{el:M,canvas:y,remove(){M.remove()}}}function Rd(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 WM="500 11px Inter, sans-serif",Im="300 10px Inter, sans-serif",Nd=10,Mm=6,Bm=14,_l=Math.min(window.devicePixelRatio||1,2),qM=8;function KM(i){const e=[];return i.traverse(t=>{if(e.length>=qM||!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:WM}];r>0&&o.push({text:" "+XM(r)+" verts",font:Im}),a&&o.push({text:" "+a,font:Im});const c=xm(o);let l=0,h=0;_m(c,300,g=>{const A=Em(c,g);l=Math.max(l,A.width),h++});const u=l+Nd*2,d=h*Bm+Mm*2;n&&n.computeBoundingBox();const f=n?n.boundingBox:null,m=new H;f?(f.getCenter(m),m.applyMatrix4(t.matrixWorld)):t.getWorldPosition(m),e.push({name:t.name,items:o,prepared:c,labelWidth:u,labelHeight:d,position:m,vertCount:r,matType:a})}),e}function jM(i){const{labelWidth:e,labelHeight:t,items:n,prepared:s}=i,r=document.createElement("canvas");r.width=e*_l,r.height=t*_l,r.style.width=e+"px",r.style.height=t+"px";const a=r.getContext("2d");a.scale(_l,_l),a.fillStyle="rgba(0, 0, 0, 0.8)",Tm(a,0,0,e,t,6),a.fill(),a.strokeStyle="rgba(255, 255, 255, 0.1)",a.lineWidth=1,Tm(a,.5,.5,e-1,t-1,6),a.stroke(),a.textBaseline="top";let o=Mm;return _m(s,e-Nd*2,c=>{const l=Em(s,c);let h=Nd;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+=Bm}),r}function XM(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString()}function Tm(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 Fd=new WeakMap;class YM extends Zi{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 Bs(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,Kt,n).catch(n)}decodeDracoFile(e,t,n,s,r=rn,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(Fd.has(e)){const c=Fd.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)}),Fd.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new On;e.index&&t.setIndex(new En(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 En(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!==Kt)return;const n=new qe;for(let s=0,r=e.count;s<r;s++)n.fromBufferAttribute(e,s),At.toWorkingColorSpace(n,Kt),e.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new Bs(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=JM.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 JM(){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),m=f.attributes.map(g=>g.array.buffer);f.index&&m.push(f.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:f},m)}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 m=o.GetEncodedGeometryType(c);if(m===a.TRIANGULAR_MESH)d=new a.Mesh,f=o.DecodeArrayToMesh(c,c.byteLength,d);else if(m===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 g={index:null,attributes:[]};for(const A in h){const p=self[u[A]];let y,b;if(l.useUniqueIDs)b=h[A],y=o.GetAttributeByUniqueId(d,b);else{if(b=o.GetAttributeId(d,a[h[A]]),b===-1)continue;y=o.GetAttribute(d,b)}const _=s(a,o,d,A,p,y);A==="color"&&(_.vertexColorSpace=l.vertexColorSpace),g.attributes.push(_)}return m===a.TRIANGULAR_MESH&&(g.index=n(a,o,d)),a.destroy(d),g}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(),m=c.num_points()*d,g=m*h.BYTES_PER_ELEMENT,A=r(a,h),p=a._malloc(g);o.GetAttributeDataArrayForAllPoints(c,u,A,g,p);const y=new h(a.HEAPF32.buffer,p,m).slice();return a._free(p),{name:l,array:y,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 ZM{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 $M=0,Rm=2,eB=1,Nm=2,tB=0,nB=1,iB=10,sB=0,Fm=9,Dm=15,Lm=16,Pm=22,km=37,Um=43,Om=76,Qm=83,Gm=97,Hm=100,zm=103,Vm=109,Wm=165,qm=166,Dd=1000066e3;class rB{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 To{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 Nn=[171,75,84,88,32,50,48,187,13,10,26,10];function Km(i){return new TextDecoder().decode(i)}function aB(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 rB,n=17*Uint32Array.BYTES_PER_ELEMENT,s=new To(i,Nn.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 To(i,Nn.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 To(i,a,o,!0),m={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:[]},g=(m.descriptorBlockSize/4-6)/4;for(let Y=0;Y<g;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()),m.samples[Y]=Q}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(m);const A=new To(i,c,l,!0);for(;A._offset<l;){const Y=A._nextUint32(),Q=A._scan(Y),J=Km(Q);if(t.keyValue[J]=A._nextUint8Array(Y-Q.byteLength-1),J.match(/^ktx/i)){const ee=Km(t.keyValue[J]);t.keyValue[J]=ee.substring(0,ee.lastIndexOf("\0"))}A._skip(Y%4?4-Y%4:0)}if(u<=0)return t;const p=new To(i,h,u,!0),y=p._nextUint16(),b=p._nextUint16(),_=p._nextUint32(),M=p._nextUint32(),w=p._nextUint32(),S=p._nextUint32(),T=[];for(let Y=0;Y<r;Y++)T.push({imageFlags:p._nextUint32(),rgbSliceByteOffset:p._nextUint32(),rgbSliceByteLength:p._nextUint32(),alphaSliceByteOffset:p._nextUint32(),alphaSliceByteLength:p._nextUint32()});const C=h+p._offset,v=C+_,F=v+M,K=F+w,q=new Uint8Array(i.buffer,i.byteOffset+C,_),$=new Uint8Array(i.buffer,i.byteOffset+v,M),D=new Uint8Array(i.buffer,i.byteOffset+F,w),O=new Uint8Array(i.buffer,i.byteOffset+K,S);return t.globalData={endpointCount:y,selectorCount:b,imageDescs:T,endpointsData:q,selectorsData:$,tablesData:D,extendedData:O},t}let Ld,ts,Pd;const kd={env:{emscripten_notify_memory_growth:function(i){Pd=new Uint8Array(ts.exports.memory.buffer)}}};class oB{init(){return Ld||(Ld=typeof fetch<"u"?fetch("data:application/wasm;base64,"+jm).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,kd)).then(this._init):WebAssembly.instantiate(Buffer.from(jm,"base64"),kd).then(this._init),Ld)}_init(e){ts=e.instance,kd.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!ts)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,s=ts.exports.malloc(n);Pd.set(e,s),t=t||Number(ts.exports.ZSTD_findDecompressedSize(s,n));const r=ts.exports.malloc(t),a=ts.exports.ZSTD_decompress(r,t,s,n),o=Pd.slice(r,r+a);return ts.exports.free(s),ts.exports.free(r),o}}const jm="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",cB="display-p3",lB="display-p3-linear",Ud=new WeakMap;let Od=0,Qd;class ti extends Zi{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new ZM,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 Bs(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new Bs(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=ti.BasisWorker.toString(),c=["/* constants */","let _EngineFormat = "+JSON.stringify(ti.EngineFormat),"let _EngineType = "+JSON.stringify(ti.EngineType),"let _TranscoderFormat = "+JSON.stringify(ti.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(ti.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})}),Od>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Od++}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 Bs(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(Ud.has(e))return Ud.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 iy(r,c,l);else{const d=r[0].mipmaps;u=t.layerCount>1?new ny(d,a,o,t.layerCount,c,l):new Yc(d,a,o,c,l)}return u.minFilter=r[0].mipmaps.length===1?zt:Jn,u.magFilter=zt,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=Xm(t),u.premultiplyAlpha=!!(h&eB),u}async _createTexture(e,t={}){const n=aB(new Uint8Array(e)),s=n.vkFormat===Dd&&n.dataFormatDescriptor[0].colorModel===167;if(!(n.vkFormat===sB||s&&!this.workerConfig.astcHDRSupported))return uB(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 Ud.set(e,{promise:o}),o}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Od--}}ti.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},ti.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},ti.EngineFormat={RGBAFormat:sn,RGBA_ASTC_4x4_Format:Ja,RGB_BPTC_UNSIGNED_Format:bc,RGBA_BPTC_Format:$a,RGBA_ETC2_EAC_Format:mc,RGBA_PVRTC_4BPPV1_Format:pc,RGBA_S3TC_DXT5_Format:Ya,RGB_ETC1_Format:Ac,RGB_ETC2_Format:gc,RGB_PVRTC_4BPPV1_Format:fc,RGBA_S3TC_DXT1_Format:Xa},ti.EngineType={UnsignedByteType:tn,HalfFloatType:Mn,FloatType:nn},ti.BasisWorker=function(){let i,e,t;const n=_EngineFormat,s=_EngineType,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(m){const g=m.data;switch(g.type){case"init":i=g.config,o(g.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:A,buffers:p,width:y,height:b,hasAlpha:_,format:M,type:w,dfdFlags:S}=c(g.buffer);self.postMessage({type:"transcode",id:g.id,data:{faces:A,width:y,height:b,hasAlpha:_,format:M,type:w,dfdFlags:S}},p)}catch(A){console.error(A),self.postMessage({type:"error",id:g.id,error:A.message})}});break}});function o(m){e=new Promise(g=>{t={wasmBinary:m,onRuntimeInitialized:g},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function c(m){const g=new t.KTX2File(new Uint8Array(m));function A(){g.close(),g.delete()}if(!g.isValid())throw A(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let p;if(g.isUASTC())p=a.UASTC;else if(g.isETC1S())p=a.ETC1S;else if(g.isHDR())p=a.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const y=g.getWidth(),b=g.getHeight(),_=g.getLayers()||1,M=g.getLevels(),w=g.getFaces(),S=g.getHasAlpha(),T=g.getDFDFlags(),{transcoderFormat:C,engineFormat:v,engineType:F}=u(p,y,b,S);if(!y||!b||!M)throw A(),new Error("THREE.KTX2Loader: Invalid texture");if(!g.startTranscoding())throw A(),new Error("THREE.KTX2Loader: .startTranscoding failed");const K=[],q=[];for(let $=0;$<w;$++){const D=[];for(let O=0;O<M;O++){const Y=[];let Q,J;for(let ae=0;ae<_;ae++){const ye=g.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."),M>1?(Q=ye.origWidth,J=ye.origHeight):(Q=ye.width,J=ye.height);let Me=new Uint8Array(g.getImageTranscodedSizeInBytes(O,ae,0,C));const se=g.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 A(),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:y,height:b,format:v,type:F})}return A(),{faces:K,buffers:q,width:y,height:b,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(m=>m.basisFormat.includes(a.ETC1S)).sort((m,g)=>m.priorityUASTC-g.priorityUASTC),[a.UASTC]:l.filter(m=>m.basisFormat.includes(a.UASTC)).sort((m,g)=>m.priorityUASTC-g.priorityUASTC),[a.UASTC_HDR]:l.filter(m=>m.basisFormat.includes(a.UASTC_HDR)).sort((m,g)=>m.priorityHDR-g.priorityHDR)};function u(m,g,A,p){const y=h[m];for(let b=0;b<y.length;b++){const _=y[b];if(_.if&&!i[_.if]||!_.basisFormat.includes(m)||p&&_.transcoderFormat.length<2||_.needsPowerOfTwo&&!(d(g)&&d(A)))continue;const M=_.transcoderFormat[p?1:0],w=_.engineFormat[p?1:0],S=_.engineType[0];return{transcoderFormat:M,engineFormat:w,engineType:S}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function d(m){return m<=2?!0:(m&m-1)===0&&m!==0}function f(m){if(m.length===1)return m[0];let g=0;for(let y=0;y<m.length;y++){const b=m[y];g+=b.byteLength}const A=new Uint8Array(g);let p=0;for(let y=0;y<m.length;y++){const b=m[y];A.set(b,p),p+=b.byteLength}return A}};const hB=new Set([sn,Js,Hi]),Gd={[Vm]:sn,[Gm]:sn,[km]:sn,[Um]:sn,[zm]:Js,[Qm]:Js,[Lm]:Js,[Pm]:Js,[Hm]:Hi,[Om]:Hi,[Dm]:Hi,[Fm]:Hi,[Dd]:Ja,[qm]:Za,[Wm]:Za},Hd={[Vm]:nn,[Gm]:Mn,[km]:tn,[Um]:tn,[zm]:nn,[Qm]:Mn,[Lm]:tn,[Pm]:tn,[Hm]:nn,[Om]:Mn,[Dm]:tn,[Fm]:tn,[Dd]:Mn,[qm]:tn,[Wm]:tn};async function uB(i){const{vkFormat:e}=i;if(Gd[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;i.supercompressionScheme===Rm&&(Qd||(Qd=new Promise(async r=>{const a=new oB;await a.init(),r(a)})),t=await Qd);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===$M)h=l.levelData;else if(i.supercompressionScheme===Rm)h=t.decode(l.levelData,l.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let u;Hd[e]===nn?u=new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):Hd[e]===Mn?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(hB.has(Gd[e]))s=i.pixelDepth===0?new Qc(n[0].data,i.pixelWidth,i.pixelHeight):new Op(n[0].data,i.pixelWidth,i.pixelHeight,i.pixelDepth);else{if(i.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new Yc(n,i.pixelWidth,i.pixelHeight),s.minFilter=n.length===1?zt:Jn,s.magFilter=zt}return s.mipmaps=n,s.type=Hd[e],s.format=Gd[e],s.colorSpace=Xm(i),s.needsUpdate=!0,Promise.resolve(s)}function Xm(i){const e=i.dataFormatDescriptor[0];return e.colorPrimaries===nB?e.transferFunction===Nm?Kt:rn:e.colorPrimaries===iB?e.transferFunction===Nm?cB:lB:(e.colorPrimaries===tB||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),ci)}const yl="[default]",zd={ASSET_GENERATOR:"assetgenerator"},wl=new BA,Ym="https://unpkg.com/[email protected]",dB=new YM(wl).setDecoderPath(`${Ym}/examples/jsm/libs/draco/gltf/`),fB=new ti(wl).setTranscoderPath(`${Ym}/examples/jsm/libs/basis/`);function Jm(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 pB(i){const{state:e,options:t}=i;if(t.preset===zd.ASSET_GENERATOR){const r=new by;r.name="hemi_light",i.scene.add(r),i.lights.push(r);return}const n=new wy(e.ambientColor,e.ambientIntensity);n.name="ambient_light",i.defaultCamera.add(n);const s=new DA(e.directColor,e.directIntensity);s.position.set(.5,0,.866),s.name="main_light",i.defaultCamera.add(s),i.lights.push(n,s)}function AB(i){i.lights.forEach(e=>e.parent.remove(e)),i.lights.length=0}var ni=Uint8Array,_a=Uint16Array,gB=Int32Array,Zm=new ni([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]),$m=new ni([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]),mB=new ni([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),e0=function(i,e){for(var t=new _a(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var s=new gB(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}},t0=e0(Zm,2),n0=t0.b,bB=t0.r;n0[28]=258,bB[258]=28;for(var xB=e0($m,0),EB=xB.b,Vd=new _a(32768),kt=0;kt<32768;++kt){var Ps=(kt&43690)>>1|(kt&21845)<<1;Ps=(Ps&52428)>>2|(Ps&13107)<<2,Ps=(Ps&61680)>>4|(Ps&3855)<<4,Vd[kt]=((Ps&65280)>>8|(Ps&255)<<8)>>1}for(var Ro=(function(i,e,t){for(var n=i.length,s=0,r=new _a(e);s<n;++s)i[s]&&++r[i[s]-1];var a=new _a(e);for(s=1;s<e;++s)a[s]=a[s-1]+r[s-1]<<1;var o;if(t){o=new _a(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[Vd[u]>>c]=l}else for(o=new _a(n),s=0;s<n;++s)i[s]&&(o[s]=Vd[a[i[s]-1]++]>>15-i[s]);return o}),No=new ni(288),kt=0;kt<144;++kt)No[kt]=8;for(var kt=144;kt<256;++kt)No[kt]=9;for(var kt=256;kt<280;++kt)No[kt]=7;for(var kt=280;kt<288;++kt)No[kt]=8;for(var i0=new ni(32),kt=0;kt<32;++kt)i0[kt]=5;var _B=Ro(No,9,1),yB=Ro(i0,5,1),Wd=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},qd=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},wB=function(i){return(i+7)/8|0},vB=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new ni(i.subarray(e,t))},CB=["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"],xi=function(i,e,t){var n=new Error(e||CB[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,xi),!t)throw n;return n},SB=function(i,e,t,n){var s=i.length,r=0;if(!s||e.f&&!e.l)return t||new ni(0);var a=!t,o=a||e.i!=2,c=e.i;a&&(t=new ni(s*3));var l=function(St){var ut=t.length;if(St>ut){var Je=new ni(Math.max(ut*2,St));Je.set(t),t=Je}},h=e.f||0,u=e.p||0,d=e.b||0,f=e.l,m=e.d,g=e.m,A=e.n,p=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=_B,m=yB,g=9,A=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;u+=14;for(var C=new ni(T),v=new ni(19),F=0;F<S;++F)v[mB[F]]=bi(i,u+F*3,7);u+=S*3;for(var K=Wd(v),q=(1<<K)-1,$=Ro(v,K,1),F=0;F<T;){var D=$[bi(i,u,q)];u+=D&15;var b=D>>4;if(b<16)C[F++]=b;else{var O=0,Y=0;for(b==16?(Y=3+bi(i,u,3),u+=2,O=C[F-1]):b==17?(Y=3+bi(i,u,7),u+=3):b==18&&(Y=11+bi(i,u,127),u+=7);Y--;)C[F++]=O}}var Q=C.subarray(0,w),J=C.subarray(w);g=Wd(Q),A=Wd(J),f=Ro(Q,g,1),m=Ro(J,A,1)}else xi(1);else{var b=wB(u)+4,_=i[b-4]|i[b-3]<<8,M=b+_;if(M>s){c&&xi(0);break}o&&l(d+_),t.set(i.subarray(b,M),d),e.b=d+=_,e.p=u=M*8,e.f=h;continue}if(u>p){c&&xi(0);break}}o&&l(d+131072);for(var ee=(1<<g)-1,ae=(1<<A)-1,ye=u;;ye=u){var O=f[qd(i,u)&ee],Me=O>>4;if(u+=O&15,u>p){c&&xi(0);break}if(O||xi(2),Me<256)t[d++]=Me;else if(Me==256){ye=u,f=null;break}else{var se=Me-254;if(Me>264){var F=Me-257,me=Zm[F];se=bi(i,u,(1<<me)-1)+n0[F],u+=me}var be=m[qd(i,u)&ae],xe=be>>4;be||xi(3),u+=be&15;var J=EB[xe];if(xe>3){var me=$m[xe];J+=qd(i,u)&(1<<me)-1,u+=me}if(u>p){c&&xi(0);break}o&&l(d+131072);var Pe=d+se;if(d<J){var $e=r-J,Qe=Math.min(J,Pe);for($e+d<0&&xi(3);d<Qe;++d)t[d]=n[$e+d]}for(;d<Pe;++d)t[d]=t[d-J]}}e.l=f,e.p=ye,e.b=d,e.f=h,f&&(h=1,e.m=g,e.d=m,e.n=A)}while(!h);return d!=t.length&&a?vB(t,0,d):t.subarray(0,d)},IB=new ni(0),MB=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&xi(6,"invalid zlib data"),(i[1]>>5&1)==1&&xi(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function vl(i,e){return SB(i.subarray(MB(i),-4),{i:2},e,e)}var BB=typeof TextDecoder<"u"&&new TextDecoder,TB=0;try{BB.decode(IB,{stream:!0}),TB=1}catch{}class RB extends gy{constructor(e){super(e),this.type=Mn}parse(e){const C=Math.pow(2.7182818,2.2);function v(x,B){let k=0;for(let R=0;R<65536;++R)(R==0||x[R>>3]&1<<(R&7))&&(B[k++]=R);const E=k-1;for(;k<65536;)B[k++]=0;return E}function F(x){for(let B=0;B<16384;B++)x[B]={},x[B].len=0,x[B].lit=0,x[B].p=null}const K={l:0,c:0,lc:0};function q(x,B,k,E,R){for(;k<x;)B=B<<8|Te(E,R),k+=8;k-=x,K.l=B>>k&(1<<x)-1,K.c=B,K.lc=k}const $=new Array(59);function D(x){for(let k=0;k<=58;++k)$[k]=0;for(let k=0;k<65537;++k)$[x[k]]+=1;let B=0;for(let k=58;k>0;--k){const E=B+$[k]>>1;$[k]=B,B=E}for(let k=0;k<65537;++k){const E=x[k];E>0&&(x[k]=E|$[E]++<<6)}}function O(x,B,k,E,R,N){const U=B;let P=0,z=0;for(;E<=R;E++){if(U.value-B.value>k)return!1;q(6,P,z,x,U);const j=K.l;if(P=K.c,z=K.lc,N[E]=j,j==63){if(U.value-B.value>k)throw new Error("Something wrong with hufUnpackEncTable");q(8,P,z,x,U);let X=K.l+6;if(P=K.c,z=K.lc,E+X>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;X--;)N[E++]=0;E--}else if(j>=59){let X=j-59+2;if(E+X>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;X--;)N[E++]=0;E--}}D(N)}function Y(x){return x&63}function Q(x){return x>>6}function J(x,B,k,E){for(;B<=k;B++){const R=Q(x[B]),N=Y(x[B]);if(R>>N)throw new Error("Invalid table entry");if(N>14){const U=E[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=E[(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(x,B,k,E){x=x<<8|Te(k,E),B+=8,ee.c=x,ee.lc=B}const ye={c:0,lc:0};function Me(x,B,k,E,R,N,U,P,z){if(x==B){E<8&&(ae(k,E,R,N),k=ee.c,E=ee.lc),E-=8;let j=k>>E;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++]=x;else return!1;ye.c=k,ye.lc=E}function se(x){return x&65535}function me(x){const B=se(x);return B>32767?B-65536:B}const be={a:0,b:0};function xe(x,B){const k=me(x),R=me(B),N=k+(R&1)+(R>>1),U=N,P=N-R;be.a=U,be.b=P}function Pe(x,B){const k=se(x),E=se(B),R=k-(E>>1)&65535,N=E+R-32768&65535;be.a=N,be.b=R}function $e(x,B,k,E,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=E*j,_e=E*X;let De,Ke,He,Fe;for(;ie<=he;ie+=fe){let st=ie;const Le=ie+E*(k-X);for(;st<=Le;st+=_e){const wt=st+ge,un=st+ce,Et=un+ge;P?(xe(x[st+B],x[un+B]),De=be.a,He=be.b,xe(x[wt+B],x[Et+B]),Ke=be.a,Fe=be.b,xe(De,Ke),x[st+B]=be.a,x[wt+B]=be.b,xe(He,Fe),x[un+B]=be.a,x[Et+B]=be.b):(Pe(x[st+B],x[un+B]),De=be.a,He=be.b,Pe(x[wt+B],x[Et+B]),Ke=be.a,Fe=be.b,Pe(De,Ke),x[st+B]=be.a,x[wt+B]=be.b,Pe(He,Fe),x[un+B]=be.a,x[Et+B]=be.b)}if(k&j){const wt=st+ce;P?xe(x[st+B],x[wt+B]):Pe(x[st+B],x[wt+B]),De=be.a,x[wt+B]=be.b,x[st+B]=De}}if(R&j){let st=ie;const Le=ie+E*(k-X);for(;st<=Le;st+=_e){const wt=st+ge;P?xe(x[st+B],x[wt+B]):Pe(x[st+B],x[wt+B]),De=be.a,x[wt+B]=be.b,x[st+B]=De}}X=j,j>>=1}return ie}function Qe(x,B,k,E,R,N,U,P,z){let j=0,X=0;const ie=U,he=Math.trunc(E.value+(R+7)/8);for(;E.value<he;)for(ae(j,X,k,E),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,E,P,z,ie),j=ye.c,X=ye.lc;else{if(!ge.p)throw new Error("hufDecode issues");let _e;for(_e=0;_e<ge.lit;_e++){const De=Y(x[ge.p[_e]]);for(;X<De&&E.value<he;)ae(j,X,k,E),j=ee.c,X=ee.lc;if(X>=De&&Q(x[ge.p[_e]])==(j>>X-De&(1<<De)-1)){X-=De,Me(ge.p[_e],N,j,X,k,E,P,z,ie),j=ye.c,X=ye.lc;break}}if(_e==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,E,P,z,ie),j=ye.c,X=ye.lc;else throw new Error("hufDecode issues")}return!0}function St(x,B,k,E,R,N){const U={value:0},P=k.value,z=Oe(B,k),j=Oe(B,k);k.value+=4;const X=Oe(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=E-(k.value-P);if(O(x,k,ce,z,j,ie),X>8*(E-(k.value-P)))throw new Error("Something wrong with hufUncompress");J(ie,z,j,he),Qe(ie,he,x,k,X,j,N,R,U)}function ut(x,B,k){for(let E=0;E<k;++E)B[E]=x[B[E]]}function Je(x){for(let B=1;B<x.length;B++){const k=x[B-1]+x[B]-128;x[B]=k}}function G(x,B){let k=0,E=Math.floor((x.length+1)/2),R=0;const N=x.length-1;for(;!(R>N||(B[R++]=x[k++],R>N));)B[R++]=x[E++]}function mn(x){let B=x.byteLength;const k=new Array;let E=0;const R=new DataView(x);for(;B>0;){const N=R.getInt8(E++);if(N<0){const U=-N;B-=U+1;for(let P=0;P<U;P++)k.push(R.getUint8(E++))}else{const U=N;B-=2;const P=R.getUint8(E++);for(let z=0;z<U+1;z++)k.push(P)}}return k}function dt(x,B,k,E,R,N){let U=new DataView(N.buffer);const P=k[x.idx[0]].width,z=k[x.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},_e=new Array(j),De=new Array(j),Ke=new Array(j),He=new Array(j),Fe=new Array(j);for(let Le=0;Le<j;++Le)Fe[Le]=B[x.idx[Le]],_e[Le]=Le<1?0:_e[Le-1]+ie*he,De[Le]=new Float32Array(64),Ke[Le]=new Uint16Array(64),He[Le]=new Uint16Array(ie*64);for(let Le=0;Le<he;++Le){let wt=8;Le==he-1&&(wt=fe);let un=8;for(let bt=0;bt<ie;++bt){bt==ie-1&&(un=ce);for(let je=0;je<j;++je)Ke[je].fill(0),Ke[je][0]=R[_e[je]++],pt(ge,E,Ke[je]),ze(Ke[je],De[je]),Rt(De[je]);Ge(De);for(let je=0;je<j;++je)L(De[je],He[je],bt*64)}let Et=0;for(let bt=0;bt<j;++bt){const je=k[x.idx[bt]].type;for(let qt=8*Le;qt<8*Le+wt;++qt){Et=Fe[bt][qt];for(let xn=0;xn<X;++xn){const Lt=xn*64+(qt&7)*8;U.setUint16(Et+0*je,He[bt][Lt+0],!0),U.setUint16(Et+2*je,He[bt][Lt+1],!0),U.setUint16(Et+4*je,He[bt][Lt+2],!0),U.setUint16(Et+6*je,He[bt][Lt+3],!0),U.setUint16(Et+8*je,He[bt][Lt+4],!0),U.setUint16(Et+10*je,He[bt][Lt+5],!0),U.setUint16(Et+12*je,He[bt][Lt+6],!0),U.setUint16(Et+14*je,He[bt][Lt+7],!0),Et+=16*je}}if(X!=ie)for(let qt=8*Le;qt<8*Le+wt;++qt){const xn=Fe[bt][qt]+8*X*2*je,Lt=X*64+(qt&7)*8;for(let dn=0;dn<un;++dn)U.setUint16(xn+dn*2*je,He[bt][Lt+dn],!0)}}}const st=new Uint16Array(P);U=new DataView(N.buffer);for(let Le=0;Le<j;++Le){k[x.idx[Le]].decoded=!0;const wt=k[x.idx[Le]].type;if(k[Le].type==2)for(let un=0;un<z;++un){const Et=Fe[Le][un];for(let bt=0;bt<P;++bt)st[bt]=U.getUint16(Et+bt*2*wt,!0);for(let bt=0;bt<P;++bt)U.setFloat32(Et+bt*2*wt,ne(st[bt]),!0)}}}function pt(x,B,k){let E,R=1;for(;R<64;)E=B[x.value],E==65280?R=64:E>>8==255?R+=E&255:(k[R]=E,R++),x.value++}function ze(x,B){B[0]=ne(x[0]),B[1]=ne(x[1]),B[2]=ne(x[5]),B[3]=ne(x[6]),B[4]=ne(x[14]),B[5]=ne(x[15]),B[6]=ne(x[27]),B[7]=ne(x[28]),B[8]=ne(x[2]),B[9]=ne(x[4]),B[10]=ne(x[7]),B[11]=ne(x[13]),B[12]=ne(x[16]),B[13]=ne(x[26]),B[14]=ne(x[29]),B[15]=ne(x[42]),B[16]=ne(x[3]),B[17]=ne(x[8]),B[18]=ne(x[12]),B[19]=ne(x[17]),B[20]=ne(x[25]),B[21]=ne(x[30]),B[22]=ne(x[41]),B[23]=ne(x[43]),B[24]=ne(x[9]),B[25]=ne(x[11]),B[26]=ne(x[18]),B[27]=ne(x[24]),B[28]=ne(x[31]),B[29]=ne(x[40]),B[30]=ne(x[44]),B[31]=ne(x[53]),B[32]=ne(x[10]),B[33]=ne(x[19]),B[34]=ne(x[23]),B[35]=ne(x[32]),B[36]=ne(x[39]),B[37]=ne(x[45]),B[38]=ne(x[52]),B[39]=ne(x[54]),B[40]=ne(x[20]),B[41]=ne(x[22]),B[42]=ne(x[33]),B[43]=ne(x[38]),B[44]=ne(x[46]),B[45]=ne(x[51]),B[46]=ne(x[55]),B[47]=ne(x[60]),B[48]=ne(x[21]),B[49]=ne(x[34]),B[50]=ne(x[37]),B[51]=ne(x[47]),B[52]=ne(x[50]),B[53]=ne(x[56]),B[54]=ne(x[59]),B[55]=ne(x[61]),B[56]=ne(x[35]),B[57]=ne(x[36]),B[58]=ne(x[48]),B[59]=ne(x[49]),B[60]=ne(x[57]),B[61]=ne(x[58]),B[62]=ne(x[62]),B[63]=ne(x[63])}function Rt(x){const B=.5*Math.cos(.7853975),k=.5*Math.cos(3.14159/16),E=.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]=E*x[ce+2],z[1]=U*x[ce+2],z[2]=E*x[ce+6],z[3]=U*x[ce+6],j[0]=k*x[ce+1]+R*x[ce+3]+N*x[ce+5]+P*x[ce+7],j[1]=R*x[ce+1]-P*x[ce+3]-k*x[ce+5]-N*x[ce+7],j[2]=N*x[ce+1]-k*x[ce+3]+P*x[ce+5]+R*x[ce+7],j[3]=P*x[ce+1]-N*x[ce+3]+R*x[ce+5]-k*x[ce+7],X[0]=B*(x[ce+0]+x[ce+4]),X[3]=B*(x[ce+0]-x[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],x[ce+0]=ie[0]+j[0],x[ce+1]=ie[1]+j[1],x[ce+2]=ie[2]+j[2],x[ce+3]=ie[3]+j[3],x[ce+4]=ie[3]-j[3],x[ce+5]=ie[2]-j[2],x[ce+6]=ie[1]-j[1],x[ce+7]=ie[0]-j[0]}for(let he=0;he<8;++he)z[0]=E*x[16+he],z[1]=U*x[16+he],z[2]=E*x[48+he],z[3]=U*x[48+he],j[0]=k*x[8+he]+R*x[24+he]+N*x[40+he]+P*x[56+he],j[1]=R*x[8+he]-P*x[24+he]-k*x[40+he]-N*x[56+he],j[2]=N*x[8+he]-k*x[24+he]+P*x[40+he]+R*x[56+he],j[3]=P*x[8+he]-N*x[24+he]+R*x[40+he]-k*x[56+he],X[0]=B*(x[he]+x[32+he]),X[3]=B*(x[he]-x[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],x[0+he]=ie[0]+j[0],x[8+he]=ie[1]+j[1],x[16+he]=ie[2]+j[2],x[24+he]=ie[3]+j[3],x[32+he]=ie[3]-j[3],x[40+he]=ie[2]-j[2],x[48+he]=ie[1]-j[1],x[56+he]=ie[0]-j[0]}function Ge(x){for(let B=0;B<64;++B){const k=x[0][B],E=x[1][B],R=x[2][B];x[0][B]=k+1.5747*R,x[1][B]=k-.1873*E-.4682*R,x[2][B]=k+1.8556*E}}function L(x,B,k){for(let E=0;E<64;++E)B[k+E]=Jp.toHalfFloat(I(x[E]))}function I(x){return x<=1?Math.sign(x)*Math.pow(Math.abs(x),2.2):Math.sign(x)*Math.pow(C,Math.abs(x)-1)}function Z(x){return new DataView(x.array.buffer,x.offset.value,x.size)}function le(x){const B=x.viewer.buffer.slice(x.offset.value,x.offset.value+x.size),k=new Uint8Array(mn(B)),E=new Uint8Array(k.length);return Je(k),G(k,E),new DataView(E.buffer)}function Ae(x){const B=x.array.slice(x.offset.value,x.offset.value+x.size),k=vl(B),E=new Uint8Array(k.length);return Je(k),G(k,E),new DataView(E.buffer)}function oe(x){const B=x.viewer,k={value:x.offset.value},E=new Uint16Array(x.columns*x.lines*(x.inputChannels.length*x.type)),R=new Uint8Array(8192);let N=0;const U=new Array(x.inputChannels.length);for(let fe=0,ge=x.inputChannels.length;fe<ge;fe++)U[fe]={},U[fe].start=N,U[fe].end=U[fe].start,U[fe].nx=x.columns,U[fe].ny=x.lines,U[fe].size=x.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]=tt(B,k);const j=new Uint16Array(65536),X=v(R,j),ie=Oe(B,k);St(x.array,B,k,ie,E,N);for(let fe=0;fe<x.inputChannels.length;++fe){const ge=U[fe];for(let _e=0;_e<U[fe].size;++_e)$e(E,ge.start+_e,ge.nx,ge.size,ge.ny,ge.nx*ge.size,X)}ut(j,E,N);let he=0;const ce=new Uint8Array(E.buffer.byteLength);for(let fe=0;fe<x.lines;fe++)for(let ge=0;ge<x.inputChannels.length;ge++){const _e=U[ge],De=_e.nx*_e.size,Ke=new Uint8Array(E.buffer,_e.end*2,De*2);ce.set(Ke,he),he+=De*2,_e.end+=De}return new DataView(ce.buffer)}function Ue(x){const B=x.array.slice(x.offset.value,x.offset.value+x.size),k=vl(B),E=x.inputChannels.length*x.lines*x.columns*x.totalBytes,R=new ArrayBuffer(E),N=new DataView(R);let U=0,P=0;const z=new Array(4);for(let j=0;j<x.lines;j++)for(let X=0;X<x.inputChannels.length;X++){let ie=0;switch(x.inputChannels[X].pixelType){case 1:z[0]=U,z[1]=z[0]+x.columns,U=z[1]+x.columns;for(let ce=0;ce<x.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]+x.columns,z[2]=z[1]+x.columns,U=z[2]+x.columns;for(let ce=0;ce<x.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(x){const B=x.viewer,k={value:x.offset.value},E=new Uint8Array(x.columns*x.lines*(x.inputChannels.length*x.type*2)),R={version:We(B,k),unknownUncompressedSize:We(B,k),unknownCompressedSize:We(B,k),acCompressedSize:We(B,k),dcCompressedSize:We(B,k),rleCompressedSize:We(B,k),rleUncompressedSize:We(B,k),rleRawSize:We(B,k),totalAcUncompressedCount:We(B,k),totalDcUncompressedCount:We(B,k),acCompression:We(B,k)};if(R.version<2)throw new Error("EXRLoader.parse: "+gs.compression+" version "+R.version+" is unsupported");const N=new Array;let U=re(B,k)-2;for(;U>0;){const ge=Ve(B.buffer,k),_e=tt(B,k),De=_e>>2&3,Ke=(_e>>4)-1,He=new Int8Array([Ke])[0],Fe=tt(B,k);N.push({name:ge,index:He,type:Fe,compression:De}),U-=ge.length+3}const P=gs.channels,z=new Array(x.inputChannels.length);for(let ge=0;ge<x.inputChannels.length;++ge){const _e=z[ge]={},De=P[ge];_e.name=De.name,_e.compression=0,_e.decoded=!1,_e.type=De.pixelType,_e.pLinear=De.pLinear,_e.width=x.columns,_e.height=x.lines}const j={idx:new Array(3)};for(let ge=0;ge<x.inputChannels.length;++ge){const _e=z[ge];for(let De=0;De<N.length;++De){const Ke=N[De];_e.name==Ke.name&&(_e.compression=Ke.compression,Ke.index>=0&&(j.idx[Ke.index]=ge),_e.offset=ge)}}let X,ie,he;if(R.acCompressedSize>0)switch(R.acCompression){case 0:X=new Uint16Array(R.totalAcUncompressedCount),St(x.array,B,k,R.acCompressedSize,X,R.totalAcUncompressedCount);break;case 1:const ge=x.array.slice(k.value,k.value+R.totalAcUncompressedCount),_e=vl(ge);X=new Uint16Array(_e.buffer),k.value+=R.totalAcUncompressedCount;break}if(R.dcCompressedSize>0){const ge={array:x.array,offset:k,size:R.dcCompressedSize};ie=new Uint16Array(Ae(ge).buffer),k.value+=R.dcCompressedSize}if(R.rleRawSize>0){const ge=x.array.slice(k.value,k.value+R.rleCompressedSize),_e=vl(ge);he=mn(_e.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<x.lines;++ge)for(let _e=0;_e<z.length;++_e)fe[_e].push(ce),ce+=z[_e].width*x.type*2;dt(j,fe,z,X,ie,E);for(let ge=0;ge<z.length;++ge){const _e=z[ge];if(!_e.decoded)switch(_e.compression){case 2:let De=0,Ke=0;for(let He=0;He<x.lines;++He){let Fe=fe[ge][De];for(let st=0;st<_e.width;++st){for(let Le=0;Le<2*_e.type;++Le)E[Fe++]=he[Ke+Le*_e.width*_e.height];Ke++}De++}break;default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(E.buffer)}function Ve(x,B){const k=new Uint8Array(x);let E=0;for(;k[B.value+E]!=0;)E+=1;const R=new TextDecoder().decode(k.slice(B.value,B.value+E));return B.value=B.value+E+1,R}function Ye(x,B,k){const E=new TextDecoder().decode(new Uint8Array(x).slice(B.value,B.value+k));return B.value=B.value+k,E}function Ee(x,B){const k=ke(x,B),E=Oe(x,B);return[k,E]}function Ne(x,B){const k=Oe(x,B),E=Oe(x,B);return[k,E]}function ke(x,B){const k=x.getInt32(B.value,!0);return B.value=B.value+4,k}function Oe(x,B){const k=x.getUint32(B.value,!0);return B.value=B.value+4,k}function Te(x,B){const k=x[B.value];return B.value=B.value+1,k}function tt(x,B){const k=x.getUint8(B.value);return B.value=B.value+1,k}const We=function(x,B){let k;return"getBigInt64"in DataView.prototype?k=Number(x.getBigInt64(B.value,!0)):k=x.getUint32(B.value+4,!0)+Number(x.getUint32(B.value,!0)<<32),B.value+=8,k};function nt(x,B){const k=x.getFloat32(B.value,!0);return B.value+=4,k}function W(x,B){return Jp.toHalfFloat(nt(x,B))}function ne(x){const B=(x&31744)>>10,k=x&1023;return(x>>15?-1:1)*(B?B===31?k?NaN:1/0:Math.pow(2,B-15)*(1+k/1024):6103515625e-14*(k/1024))}function re(x,B){const k=x.getUint16(B.value,!0);return B.value+=2,k}function de(x,B){return ne(re(x,B))}function Ie(x,B,k,E){const R=k.value,N=[];for(;k.value<R+E-1;){const U=Ve(B,k),P=ke(x,k),z=tt(x,k);k.value+=3;const j=ke(x,k),X=ke(x,k);N.push({name:U,pixelType:P,pLinear:z,xSampling:j,ySampling:X})}return k.value+=1,N}function Se(x,B){const k=nt(x,B),E=nt(x,B),R=nt(x,B),N=nt(x,B),U=nt(x,B),P=nt(x,B),z=nt(x,B),j=nt(x,B);return{redX:k,redY:E,greenX:R,greenY:N,blueX:U,blueY:P,whiteX:z,whiteY:j}}function it(x,B){const k=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],E=tt(x,B);return k[E]}function Ot(x,B){const k=ke(x,B),E=ke(x,B),R=ke(x,B),N=ke(x,B);return{xMin:k,yMin:E,xMax:R,yMax:N}}function bn(x,B){const k=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],E=tt(x,B);return k[E]}function yt(x,B){const k=["ENVMAP_LATLONG","ENVMAP_CUBE"],E=tt(x,B);return k[E]}function Yn(x,B){const k=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],E=["ROUND_DOWN","ROUND_UP"],R=Oe(x,B),N=Oe(x,B),U=tt(x,B);return{xSize:R,ySize:N,levelMode:k[U&15],roundingMode:E[U>>4]}}function Si(x,B){const k=nt(x,B),E=nt(x,B);return[k,E]}function lh(x,B){const k=nt(x,B),E=nt(x,B),R=nt(x,B);return[k,E,R]}function hh(x,B,k,E,R){if(E==="string"||E==="stringvector"||E==="iccProfile")return Ye(B,k,R);if(E==="chlist")return Ie(x,B,k,R);if(E==="chromaticities")return Se(x,k);if(E==="compression")return it(x,k);if(E==="box2i")return Ot(x,k);if(E==="envmap")return yt(x,k);if(E==="tiledesc")return Yn(x,k);if(E==="lineOrder")return bn(x,k);if(E==="float")return nt(x,k);if(E==="v2f")return Si(x,k);if(E==="v3f")return lh(x,k);if(E==="int")return ke(x,k);if(E==="rational")return Ee(x,k);if(E==="timecode")return Ne(x,k);if(E==="preview")return k.value+=R,"skipped";k.value+=R}function As(x,B){const k=Math.log2(x);return B=="ROUND_DOWN"?Math.floor(k):Math.ceil(k)}function ic(x,B,k){let E=0;switch(x.levelMode){case"ONE_LEVEL":E=1;break;case"MIPMAP_LEVELS":E=As(Math.max(B,k),x.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return E}function sc(x,B,k,E){const R=new Array(x);for(let N=0;N<x;N++){const U=1<<N;let P=B/U|0;E=="ROUND_UP"&&P*U<B&&(P+=1);const z=Math.max(P,1);R[N]=(z+k-1)/k|0}return R}function uh(){const x=this,B=x.offset,k={value:0};for(let E=0;E<x.tileCount;E++){const R=ke(x.viewer,B),N=ke(x.viewer,B);B.value+=8,x.size=Oe(x.viewer,B);const U=R*x.blockWidth,P=N*x.blockHeight;x.columns=U+x.blockWidth>x.width?x.width-U:x.blockWidth,x.lines=P+x.blockHeight>x.height?x.height-P:x.blockHeight;const z=x.columns*x.totalBytes,X=x.size<x.lines*z?x.uncompress(x):Z(x);B.value+=x.size;for(let ie=0;ie<x.lines;ie++){const he=ie*x.columns*x.totalBytes;for(let ce=0;ce<x.inputChannels.length;ce++){const fe=gs.channels[ce].name,ge=x.channelByteOffsets[fe]*x.columns,_e=x.decodeChannels[fe];if(_e===void 0)continue;k.value=he+ge;const De=(x.height-(1+P+ie))*x.outLineWidth;for(let Ke=0;Ke<x.columns;Ke++){const He=De+(Ke+U)*x.outputChannels+_e;x.byteArray[He]=x.getter(X,k)}}}}}function Ha(){const x=this,B=x.offset,k={value:0};for(let E=0;E<x.height/x.blockHeight;E++){const R=ke(x.viewer,B)-gs.dataWindow.yMin;x.size=Oe(x.viewer,B),x.lines=R+x.blockHeight>x.height?x.height-R:x.blockHeight;const N=x.columns*x.totalBytes,P=x.size<x.lines*N?x.uncompress(x):Z(x);B.value+=x.size;for(let z=0;z<x.blockHeight;z++){const j=E*x.blockHeight,X=z+x.scanOrder(j);if(X>=x.height)continue;const ie=z*N,he=(x.height-1-X)*x.outLineWidth;for(let ce=0;ce<x.inputChannels.length;ce++){const fe=gs.channels[ce].name,ge=x.channelByteOffsets[fe]*x.columns,_e=x.decodeChannels[fe];if(_e!==void 0){k.value=ie+ge;for(let De=0;De<x.columns;De++){const Ke=he+De*x.outputChannels+_e;x.byteArray[Ke]=x.getter(P,k)}}}}}}function dh(x,B,k){const E={};if(x.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");E.version=x.getUint8(4);const R=x.getUint8(5);E.spec={singleTile:!!(R&2),longName:!!(R&4),deepFormat:!!(R&8),multiPart:!!(R&16)},k.value=8;let N=!0;for(;N;){const U=Ve(B,k);if(U==="")N=!1;else{const P=Ve(B,k),z=Oe(x,k),j=hh(x,B,k,P,z);j===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`):E[U]=j}}if((R&-7)!=0)throw console.error("THREE.EXRHeader:",E),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return E}function za(x,B,k,E,R){const N={size:0,viewer:B,array:k,offset:E,width:x.dataWindow.xMax-x.dataWindow.xMin+1,height:x.dataWindow.yMax-x.dataWindow.yMin+1,inputChannels:x.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:rn};switch(x.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=Ue;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: "+x.compression+" is unsupported")}const U={};for(const X of x.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 nn:N.getter=de;break;case Mn:N.getter=re;break}else if(N.type==2)switch(R){case nn:N.getter=nt;break;case Mn:N.getter=W}else throw new Error("EXRLoader.parse: unsupported pixelType "+N.type+" for "+x.compression+".");N.columns=N.width;const z=N.width*N.height*N.outputChannels;switch(R){case nn:N.byteArray=new Float32Array(z),P&&N.byteArray.fill(1,0,z);break;case Mn: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 x.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,x.lineOrder==="INCREASING_Y"?N.scanOrder=X=>X:N.scanOrder=X=>N.height-1-X,N.outputChannels==4?(N.format=sn,N.colorSpace=rn):(N.format=Hi,N.colorSpace=ci),x.spec.singleTile){N.blockHeight=x.tiles.ySize,N.blockWidth=x.tiles.xSize;const X=ic(x.tiles,N.width,N.height),ie=sc(X,N.width,x.tiles.xSize,x.tiles.roundingMode),he=sc(X,N.height,x.tiles.ySize,x.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++)We(B,E);N.decode=uh.bind(N)}else{N.blockWidth=N.width;const X=Math.ceil(N.height/N.blockHeight);for(let ie=0;ie<X;ie++)We(B,E);N.decode=Ha.bind(N)}return N}const rc={value:0},ac=new DataView(e),op=new Uint8Array(e),gs=dh(ac,e,rc),Ks=za(gs,ac,op,rc,this.type);return Ks.decode(),{header:gs,width:Ks.width,height:Ks.height,data:Ks.byteArray,format:Ks.format,colorSpace:Ks.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=zt,a.magFilter=zt,a.generateMipmaps=!1,a.flipY=!1,t&&t(a,o)}return super.load(e,r,n,s)}}function NB(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 RB().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 FB(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"),DB(i)}function DB(i){const e=document.createElement("div");e.className="screenshot-flash",i.el.appendChild(e),e.addEventListener("animationend",()=>e.remove())}function LB(i,e){i.mixer&&(i.mixer.stopAllAction(),i.mixer.uncacheRoot(i.mixer.getRoot()),i.mixer=null),i.clips=e,e.length&&(i.mixer=new LA(i.content))}function PB(i){i.clips.forEach(e=>{i.mixer.clipAction(e).reset().play(),i.state.actionStates[e.name]=!0}),i.invalidate()}const kB=.35;class UB{constructor(){this.model=null,this.mixer=null,this.clips=new Map,this.actions=new Map,this.currentName=null,this.currentAction=null,this.loader=new Yu,this.onChange=null,this._gltfCache=new Map,this._animationDefs=[]}attach(e){this.detach(),this.model=e,this.mixer=new LA(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;this._gltfCache.has(t)?s=this._gltfCache.get(t):(s=await new Promise((a,o)=>{this.loader.load(t,a,void 0,o)}),this._gltfCache.set(t,s));let r;if(n.clipName?(r=s.animations.find(a=>a.name===n.clipName),r||(console.warn(`[AnimationManager] Clip "${n.clipName}" not found in ${t}, using first clip`),r=s.animations[0])):r=s.animations[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?Cp:Sp),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=kB){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(o=>{o.isBone&&n.add(o.name)}),n.size===0)return e;const s=new Set;for(const o of e.tracks){const c=o.name.split(".")[0];s.add(c)}let r=0;for(const o of s)n.has(o)&&r++;if(r/s.size>.5)return e;const a=this._buildBoneNameMap(n,s);return a?(e.tracks.map(o=>{const c=o.name.split("."),l=c[0],h=c.slice(1).join("."),u=a.get(l);if(!u)return null;const d=o.clone();return d.name=`${u}.${h}`,d}).filter(Boolean),e.clone().resetDuration()):e}_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=[]}}Ji.enabled=!0;class Kd{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 UB,this._animPanelEl=null,this.state={environment:t.preset===zd.ASSET_GENERATOR?hl.find(r=>r.id==="footprint-court").name:hl[1].name,background:!1,playbackSpeed:1,actionStates:{},camera:yl,wireframe:!1,skeleton:!1,grid:!1,autoRotate:!1,punctualLights:!0,exposure:0,toneMapping:yh,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 Eo,this.stats.dom.height="48px",[].forEach.call(this.stats.dom.children,r=>r.style.display=""),this.backgroundColor=new qe(this.state.bgColor),this.scene=new _u,this.scene.background=this.backgroundColor;const n=t.preset===zd.ASSET_GENERATOR?.8*180/Math.PI:60,s=e.clientWidth/e.clientHeight;this.defaultCamera=new Cn(n,s,.01,1e3),this.activeCamera=this.defaultCamera,this.scene.add(this.defaultCamera),this.renderer=window.renderer=new pg({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 qu(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.neutralEnvironment=this.pmremGenerator.fromScene(new UI).texture,this.controls=new CI(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 H,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(){FB(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=la.extractUrlBase(e);return new Promise((r,a)=>{wl.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 Yu(wl).setCrossOrigin("anonymous").setDRACOLoader(dB).setKTX2Loader(fB.detectSupport(this.renderer)).setMeshoptDecoder(wI),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 Mi().setFromObject(e),s=n.getSize(new H).length(),r=n.getCenter(new H);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 H)):(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){LB(this,e)}playAllClips(){PB(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?pB(this):!e.punctualLights&&t.length&&AB(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=hl.filter(t=>t.name===this.state.environment)[0];NB(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)),Jm(this.content,e=>{e.wireframe=this.state.wireframe,e instanceof Ru&&(e.size=this.state.pointSize)}),this.content.traverse(e=>{if(e.geometry&&e.skeleton&&this.state.skeleton){const t=new Uy(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 Oy,this.axesHelper=new UA,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=VM(this.el,e,t))}updateAnnotations(){if(this.annotationEls.forEach(t=>t.el.remove()),this.annotationEls=[],!this.state.showLabels||!this.content)return;KM(this.content).forEach(t=>{const n=jM(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 _u,this.axesCamera=new Cn(50,e/t,.1,10),this.axesScene.add(this.axesCamera),this.axesRenderer=new pg({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 UA(5),this.axesScene.add(this.axesCorner),this.axesDiv.appendChild(this.axesRenderer.domElement)}addGUI(){const e=window.innerWidth<=700,t=this.gui=new a1({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 m=t.addFolder("Lighting");m.add(this.state,"environment",hl.map(w=>w.name)).onChange(()=>this.updateEnvironment()),[m.add(this.state,"toneMapping",{Linear:yh,"ACES Filmic":Ap}),m.add(this.state,"exposure",-10,10,.01),m.add(this.state,"punctualLights").listen(),m.add(this.state,"ambientIntensity",0,2),m.addColor(this.state,"ambientColor"),m.add(this.state,"directIntensity",0,4),m.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 y=t.addFolder("Performance"),b=document.createElement("li");this.stats.dom.style.position="static",b.appendChild(this.stats.dom),b.classList.add("gui-stats"),y.__ul.appendChild(b);const _=document.createElement("div");this.el.appendChild(_),_.classList.add("gui-wrap"),_.classList.add("gui-wrap--hidden"),_.appendChild(t.domElement),this._guiWrap=_;const M=document.createElement("button");M.className="gui-toggle",M.setAttribute("title","Toggle advanced controls"),M.setAttribute("aria-label","Toggle advanced controls"),M.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>',M.addEventListener("click",()=>{const w=_.classList.toggle("gui-wrap--hidden");M.classList.toggle("gui-toggle--active",!w)}),this.el.appendChild(M),this._guiToggle=M,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()}),Jm(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 OB{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 QB{async complete(){return{text:"",toolCalls:[],stopReason:"end_turn"}}formatToolResults(){return{role:"user",content:[]}}formatAssistantWithToolCalls(e){return{role:"assistant",content:e||""}}}function GB(i={}){const e=i.provider||"anthropic";if(e==="anthropic")return new OB(i);if(e==="none")return new QB;throw new Error(`Unsupported provider: ${e}. Supported: anthropic, none`)}class HB{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 zB{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 VB{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 WB(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new HB(i);if(e==="elevenlabs")return new VB(i);throw new Error(`TTS provider "${e}" not implemented yet`)}function qB(i={}){const e=i.provider||"browser";if(e==="none")return null;if(e==="browser")return new zB(i);throw new Error(`STT provider "${e}" not implemented yet`)}const s0=[{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"]}}],KB={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)}},jB=8;class r0 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=GB({...this.manifest.brain,...r}),this.tts=WB({...this.manifest.voice?.tts,...a.tts}),this.stt=qB({...this.manifest.voice?.stt,...a.stt}),this.messages=[],this._busy=!1}get systemPrompt(){const e=[];return this.manifest.instructions&&e.push(this.manifest.instructions),this.memory&&e.push(`
+`)}let Qd=null,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="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",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(`
<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||s0.map(s=>s.name)),t=s0.filter(s=>e.has(s.name)),n=this.skills?this.skills.allTools():[];return[...t,...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++<jB;){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=KB[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})}}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 jd=["https://dweb.link/ipfs/","https://cloudflare-ipfs.com/ipfs/","https://ipfs.io/ipfs/"],XB="https://arweave.net/";function ks(i,e=0){if(!i)return i;const t=i.match(/^ipfs:\/\/(.+)$/i);if(t)return jd[e%jd.length]+t[1];const n=i.match(/^ar:\/\/(.+)$/i);return n?XB+n[1]:i}async function a0(i){let e;for(let t=0;t<jd.length;t++){const n=ks(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 YB={idle:"idle",wave:"wave",nod:"yes",shake:"no",think:"sitting",celebrate:"dance",concern:"standing",bow:"wave",point:"standing",shrug:"standing"};function JB(i,e){return e&&e[i]?e[i]:YB[i]??i}const o0={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 c0{constructor(e){this.viewer=e,this._loader=new Yu,this._userTarget=new H(0,1.6,2),this._animationMap={}}get scene(){return this.viewer.scene}get mixer(){return this.viewer.mixer}get clips(){return this.viewer.clips||[]}get content(){return this.viewer.content}setAnimationMap(e){this._animationMap=e||{}}resolveAnimationSlot(e){return JB(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);if(s&&this.viewer.mixer){const a=this.viewer.mixer.clipAction(s);return a.reset(),a.setLoop(t?2201:2200),a.clampWhenFinished=!t,a.fadeIn(n/1e3),a.play(),this.viewer.state.actionStates[s.name]=!0,this.viewer.invalidate(),!0}const r=this.viewer?.animationManager;return r?.isLoaded(e)?(t?r.crossfadeTo(e,n/1e3):r.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){if(!this.viewer.mixer)return;const t=e?this._findClip(e):null;if(t){const n=this.viewer.mixer.existingAction(t);n&&n.fadeOut(.2),this.viewer.state.actionStates[t.name]=!1}else{this.viewer.mixer.stopAllAction();for(const n in this.viewer.state.actionStates)this.viewer.state.actionStates[n]=!1}this.viewer.invalidate()}async play(e,t){if(typeof e=="string")return this.playClipByName(e,t);if(!this.viewer.mixer||!e)return!1;const n=this.viewer.mixer.clipAction(e);return n.reset(),n.fadeIn(t?.blend??.2),n.play(),this.viewer.invalidate(),!0}async loadClip(e){const t=ks(e);return new Promise((n,s)=>{this._loader.load(t,r=>n(r.animations?.[0]||null),void 0,s)})}async loadGLB(e){const t=ks(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 H?e:e==="camera"?this.viewer.activeCamera.position.clone():e==="center"?new H(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=o0[e]||o0.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 H(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 ZB=`// 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||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.
// 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 ii=null,ya=null;const wa=new Map,Fo=new Map,Us=new Map,Cl=new Map;let $B=0,eT=0;function l0(i){if(i==null)return null;const e=`@h:${++$B}`;return Cl.set(e,i),e}function tT(i){return typeof i=="string"&&i.startsWith("@h:")?Cl.get(i)??i:i}function nT(i){return Array.isArray(i)?i.map(tT):i}function h0(){if(!ii){if(!ya){const i=new Blob([ZB],{type:"text/javascript"});ya=URL.createObjectURL(i)}ii=new Worker(ya),ii.onmessage=sT,ii.onerror=iT}return ii}function iT(i){console.error("[sandbox] worker crashed:",i),ii=null,wa.clear(),Fo.clear(),Cl.clear();for(const[,e]of Us)e.reject(new Error("Sandbox worker crashed"));Us.clear()}function sT({data:i}){switch(i.type){case"install-ack":{const e=Fo.get(i.skillURI);Fo.delete(i.skillURI),i.ok?e?.resolve():(wa.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=Us.get(e);if(!r){ii?.postMessage({type:"response",requestId:t,error:"No active invocation"});return}rT(n,s,r.mainCtx).then(a=>ii?.postMessage({type:"response",requestId:t,result:a??null}),a=>ii?.postMessage({type:"response",requestId:t,error:a.message||String(a)}));break}case"invoke-result":{const{invocationId:e,result:t,error:n}=i,s=Us.get(e);if(!s)return;Us.delete(e),n!==void 0?s.reject(new Error(n)):s.resolve(t);break}}}async function rT(i,e,t){const n=nT(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 l0(s)}case"loadGLB":{const s=await t.loadGLB?.(n[0]);return l0(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 aT(i,e){if(wa.has(i))return wa.get(i);const t=new Promise((n,s)=>{Fo.set(i,{resolve:n,reject:s})});return wa.set(i,t),h0().postMessage({type:"install",skillURI:i,handlersSrc:e}),t}async function oT(i,e,t,n,s){await aT(i,n);const r=++eT,a=h0();return new Promise((o,c)=>{Us.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 cT(){if(ii){ii.terminate(),ii=null,ya&&(URL.revokeObjectURL(ya),ya=null),wa.clear(),Fo.clear(),Cl.clear();for(const[,i]of Us)i.reject(new Error("Sandbox terminated"));Us.clear()}}function lT(){return{invoke:oT,terminate:cT}}function hT(i,e){return/^([a-z]+:|\/)/i.test(e)?e:(i.endsWith("/")||(i+="/"),i+e)}class u0{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 lT().invoke(this.uri,e,t,this.handlersSrc,s)}systemPromptFragment(){return this.instructions?`
+`;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?`
<skill name="${this.name}" version="${this.version}">
${this.instructions}
-</skill>`:""}}class d0{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 u0({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=hT(t,e)),n.endsWith("/")||(n+="/"),(n.startsWith("ipfs://")||n.startsWith("ar://"))&&(n=ks(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 uT=/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;function Sl(i){const e=i.match(uT);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 dT(i,e){const t=["---"];for(const[n,s]of Object.entries(i))t.push(`${n}: ${s}`);return t.push("---","",e),t.join(`
-`)}class Ei{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 Ei({mode:"none",namespace:t});if(e==="local")return Ei._loadLocal(t);if(e==="ipfs"||e==="encrypted-ipfs")return Ei._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 Ei({mode:"local",namespace:e});const s=JSON.parse(n);return new Ei({mode:"local",namespace:e,...s})}catch{return new Ei({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 Ei({mode:e,namespace:t,index:{text:o},files:c})}catch{return new Ei({mode:e,namespace:t})}}read(e){const t=e.endsWith(".md")?e:`${e}.md`,n=this.files.get(t);return n?Sl(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&&Sl(l).meta.created||c,u={name:t,description:n,type:s,created:h,updated:c};a&&(u.decay=a),this.files.set(o,dT(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}=Sl(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}=Sl(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 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(`
`)}_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 fT="6.16.0";function pT(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 Fn(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 Xe(i,e,t){for(let n in e){let s=e[n];const r=t?t[n]:null;r&&pT(s,r,n),Object.defineProperty(i,n,{enumerable:!0,value:s,writable:!1})}}function va(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=>va(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 va(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=>`${va(n,e)}: ${va(i[n],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function _n(i,e){return i&&i.code===e}function Xd(i){return _n(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: ${va(t)}`);for(const a in t){if(a==="shortMessage")continue;const o=t[a];r.push(a+"="+va(o))}}r.push(`code=${e}`),r.push(`version=${fT}`),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 Xe(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&Xe(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 f0(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 Il(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 p0(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 lt(i,e){return p0(i,e,!1)}function Dn(i,e){return p0(i,e,!0)}function Ft(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 Yd(i){return Ft(i,!0)||i instanceof Uint8Array}const A0="0123456789abcdef";function Ce(i){const e=lt(i);let t="0x";for(let n=0;n<e.length;n++){const s=e[n];t+=A0[(s&240)>>4]+A0[s&15]}return t}function Ut(i){return"0x"+i.map(e=>Ce(e).substring(2)).join("")}function Ca(i){return Ft(i,!0)?(i.length-2)/2:lt(i).length}function Vt(i,e,t){const n=lt(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 g0(i,e,t){const n=lt(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 ns(i,e){return g0(i,e,!0)}function AT(i,e){return g0(i,e,!1)}const Do=BigInt(0),_i=BigInt(1),Sa=9007199254740991;function gT(i,e){const t=Ml(i,"value"),n=BigInt(ht(e,"width"));if(pe(t>>n===Do,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:i}),t>>n-_i){const s=(_i<<n)-_i;return-((~t&s)+_i)}return t}function m0(i,e){let t=Re(i,"value");const n=BigInt(ht(e,"width")),s=_i<<n-_i;if(t<Do){t=-t,pe(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:i});const r=(_i<<n)-_i;return(~t&r)+_i}else pe(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:i});return t}function Lo(i,e){const t=Ml(i,"value"),n=BigInt(ht(e,"bits"));return t&(_i<<n)-_i}function Re(i,e){switch(typeof i){case"bigint":return i;case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-Sa&&i<=Sa,"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 Ml(i,e){const t=Re(i,e);return pe(t>=Do,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:i}),t}const b0="0123456789abcdef";function Jd(i){if(i instanceof Uint8Array){let e="0x0";for(const t of i)e+=b0[t>>4],e+=b0[t&15];return BigInt(e)}return Re(i)}function ht(i,e){switch(typeof i){case"bigint":return V(i>=-Sa&&i<=Sa,"overflow",e||"value",i),Number(i);case"number":return V(Number.isInteger(i),"underflow",e||"value",i),V(i>=-Sa&&i<=Sa,"overflow",e||"value",i),i;case"string":try{if(i==="")throw new Error("empty string");return ht(BigInt(i),e)}catch(t){V(!1,`invalid numeric string: ${t.message}`,e||"value",i)}}V(!1,"invalid numeric value",e||"value",i)}function mT(i){return ht(Jd(i))}function Os(i,e){const t=Ml(i,"value");let n=t.toString(16);if(e==null)n.length%2&&(n="0"+n);else{const s=ht(e,"width");if(s===0&&t===Do)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 Zt(i,e){const t=Ml(i,"value");if(t===Do)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 yi(i){let e=Ce(Yd(i)?i:Zt(i)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const x0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const E0=BigInt(58);function bT(i){const e=lt(i);let t=Jd(e),n="";for(;t;)n=x0[Number(t%E0)]+n,t/=E0;for(let s=0;s<e.length&&!e[s];s++)n=x0[0]+n;return n}function xT(i){i=atob(i);const e=new Uint8Array(i.length);for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return lt(e)}function ET(i){const e=lt(i);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}class _0{filter;emitter;#e;constructor(e,t,n){this.#e=t,Xe(this,{emitter:e,filter:n})}async removeListener(){this.#e!=null&&await this.emitter.off(this.filter,this.#e)}}function _T(i,e,t,n,s){V(!1,`invalid codepoint at offset ${e}; ${i}`,"bytes",t)}function y0(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 yT(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),y0(i,e,t))}const wT=Object.freeze({error:_T,ignore:y0,replace:yT});function vT(i,e){e==null&&(e=wT.error);const t=lt(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 is(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 CT(i){return i.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Bl(i,e){return CT(vT(i,e))}function w0(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,m)=>{h[m.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 ST=12,IT=250;let v0=w0();const MT=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),BT=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Zd=!1;async function C0(i,e){try{const t=i.match(MT);if(!t)throw new Error("invalid data");return new Qs(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?xT(t[3]):RT(t[3]))}catch{return new Qs(599,"BAD REQUEST (invalid data: URI)",{},null,new Pi(i))}}function S0(i){async function e(t,n){try{const s=t.match(BT);if(!s)throw new Error("invalid link");return new Pi(`${i}${s[2]}`)}catch{return new Qs(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Pi(t))}}return e}const Tl={data:C0,ipfs:S0("https://gateway.ipfs.io/ipfs/")},I0=new WeakMap;class TT{#e;#t;constructor(e){this.#e=[],this.#t=!1,I0.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 Rl(i){if(i==null)throw new Error("missing signal; should not happen");return i.checkSignal(),i}class Pi{#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=is(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=is(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 ${ET(is(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||v0}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:IT,maxAttempts:ST},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(M0()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),n>0&&await NT(n);let a=this.clone();const o=(a.url.split(":")[0]||"").toLowerCase();if(o in Tl){const h=await Tl[o](a.url,Rl(s.#c));if(h instanceof Qs){let u=h;if(this.processFunc){Rl(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,Rl(s.#c));let l=new Qs(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){Rl(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 TT(this),this.#d(0,M0()+this.timeout,0,this,new Qs(0,"",{},null,this))}cancel(){pe(this.#c!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=I0.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 Pi(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 Pi(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(){Zd=!0}static getGateway(e){return Tl[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(Zd)throw new Error("gateways locked");Tl[e]=t}static registerGetUrl(e){if(Zd)throw new Error("gateways locked");v0=e}static createGetUrlFunc(e){return w0(e)}static createDataGateway(){return C0}static createIpfsGatewayFunc(e){return S0(e)}}class Qs{#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?"":Bl(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 Qs(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 Xe(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=Bl(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 M0(){return new Date().getTime()}function RT(i){return is(i.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function NT(i){return new Promise(e=>setTimeout(e,i))}function FT(i){let e=i.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function B0(i,e,t){let n=0;for(let s=0;s<t;s++)n=n*256+i[e+s];return n}function T0(i,e,t,n){const s=[];for(;t<e+1+n;){const r=R0(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 R0(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=B0(i,e+1,n);return t(e+1+n+s),T0(i,e,e+1+n,n+s)}else if(i[e]>=192){const n=i[e]-192;return t(e+1+n),T0(i,e,e+1,n)}else if(i[e]>=184){const n=i[e]-183;t(e+1+n);const s=B0(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:FT(i[e])}}function Po(i){const e=lt(i,"data"),t=R0(e,0);return V(t.consumed===e.length,"unexpected junk after rlp payload","data",i),t.result}function N0(i){const e=[];for(;i;)e.unshift(i&255),i>>=8;return e}function F0(i){if(Array.isArray(i)){let n=[];if(i.forEach(function(r){n=n.concat(F0(r))}),n.length<=55)return n.unshift(192+n.length),n;const s=N0(n.length);return s.unshift(247+s.length),s.concat(n)}const e=Array.prototype.slice.call(lt(i,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=N0(e.length);return t.unshift(183+t.length),t.concat(e)}const D0="0123456789abcdef";function ss(i){let e="0x";for(const t of F0(i))e+=D0[t>>4],e+=D0[t&15];return e}const Ln=32,$d=new Uint8Array(Ln),DT=["then"],Nl={},L0=new WeakMap;function fr(i){return L0.get(i)}function P0(i,e){L0.set(i,e)}function ko(i,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${i}`);throw t.error=e,t}function ef(i,e,t){return i.indexOf(null)>=0?e.map((n,s)=>n instanceof rs?ef(fr(n),n,t):n):i.reduce((n,s,r)=>{let a=e.getValue(s);return s in n||(t&&a instanceof rs&&(a=ef(fr(a),a,t)),n[s]=a),n},{})}class rs extends Array{#e;constructor(...e){const t=e[0];let n=e[1],s=(e[2]||[]).slice(),r=!0;t!==Nl&&(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(P0(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=ht(l,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const f=c[d];return f instanceof Error&&ko(`index ${d}`,f),f}if(DT.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 P0(o,fr(this)),o}toArray(e){const t=[];return this.forEach((n,s)=>{n instanceof Error&&ko(`index ${s}`,n),e&&n instanceof rs&&(n=n.toArray(e)),t.push(n)}),t}toObject(e){const t=fr(this);return t.reduce((n,s,r)=>(pe(s!=null,`value at index ${r} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),ef(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=fr(this),s=[],r=[];for(let a=e;a<t;a++)s.push(this[a]),r.push(n[a]);return new rs(Nl,s,r)}filter(e,t){const n=fr(this),s=[],r=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&ko(`index ${a}`,o),e.call(t,o,a,this)&&(s.push(o),r.push(n[a]))}return new rs(Nl,s,r)}map(e,t){const n=[];for(let s=0;s<this.length;s++){const r=this[s];r instanceof Error&&ko(`index ${s}`,r),n.push(e.call(t,r,s,this))}return n}getValue(e){const t=fr(this).indexOf(e);if(t===-1)return;const n=this[t];return n instanceof Error&&ko(`property ${JSON.stringify(e)}`,n.error),n}static fromItems(e,t){return new rs(Nl,e,t)}}function k0(i){let e=Zt(i);return pe(e.length<=Ln,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Ln,offset:e.length}),e.length!==Ln&&(e=Dn(Ut([$d.slice(e.length%Ln),e]))),e}class as{name;type;localName;dynamic;constructor(e,t,n,s){Xe(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 Ut(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(Dn(e.data))}writeBytes(e){let t=Dn(e);const n=t.length%Ln;return n&&(t=Dn(Ut([t,$d.slice(n)]))),this.#n(t)}writeValue(e){return this.#n(k0(e))}writeUpdatableValue(){const e=this.#e.length;return this.#e.push($d),this.#t+=Ln,t=>{this.#e[e]=k0(t)}}}class nf{allowLoose;#e;#t;#n;#i;#s;constructor(e,t,n){Xe(this,{allowLoose:!!t}),this.#e=Dn(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:Dn(this.#e),offset:this.#t,length:e,info:{bytesRead:this.#n,dataLength:this.dataLength}})}#r(e,t,n){let s=Math.ceil(t/Ln)*Ln;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:Dn(this.#e),length:this.#e.length,offset:this.#t+s})),this.#e.slice(this.#t,this.#t+s)}subReader(e){const t=new nf(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 Jd(this.readBytes(Ln))}readIndex(){return mT(this.readBytes(Ln))}}function Fl(i){if(!Number.isSafeInteger(i)||i<0)throw new Error(`Wrong positive integer: ${i}`)}function sf(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 LT(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Fl(i.outputLen),Fl(i.blockLen)}function Ia(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 U0(i,e){sf(i);const t=e.outputLen;if(i.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const rf=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;const O0=i=>i instanceof Uint8Array,PT=i=>new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)),af=i=>new DataView(i.buffer,i.byteOffset,i.byteLength),ki=(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 kT(i){if(typeof i!="string")throw new Error(`utf8ToBytes expected string, got ${typeof i}`);return new Uint8Array(new TextEncoder().encode(i))}function Dl(i){if(typeof i=="string"&&(i=kT(i)),!O0(i))throw new Error(`expected Uint8Array, got ${typeof i}`);return i}function UT(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!O0(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}class of{clone(){return this._cloneInto()}}function cf(i){const e=n=>i().update(Dl(n)).digest(),t=i();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>i(),e}function OT(i=32){if(rf&&typeof rf.getRandomValues=="function")return rf.getRandomValues(new Uint8Array(i));throw new Error("crypto.getRandomValues must be defined")}class Q0 extends of{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,LT(e);const n=Dl(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 Ia(this),this.iHash.update(e),this}digestInto(e){Ia(this),sf(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 G0=(i,e,t)=>new Q0(i,e).update(t).digest();G0.create=(i,e)=>new Q0(i,e);function QT(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 H0 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=af(this.buffer)}update(e){Ia(this);const{view:t,buffer:n,blockLen:s}=this;e=Dl(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=af(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){Ia(this),U0(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;QT(n,s-8,BigInt(this.length*8),r),this.process(n,0);const o=af(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 GT=(i,e,t)=>i&e^~i&t,HT=(i,e,t)=>i&e^i&t^e&t,zT=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]),Gs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Hs=new Uint32Array(64);class VT extends H0{constructor(){super(64,32,8,!1),this.A=Gs[0]|0,this.B=Gs[1]|0,this.C=Gs[2]|0,this.D=Gs[3]|0,this.E=Gs[4]|0,this.F=Gs[5]|0,this.G=Gs[6]|0,this.H=Gs[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)Hs[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const d=Hs[u-15],f=Hs[u-2],m=ki(d,7)^ki(d,18)^d>>>3,g=ki(f,17)^ki(f,19)^f>>>10;Hs[u]=g+Hs[u-7]+m+Hs[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=ki(o,6)^ki(o,11)^ki(o,25),f=h+d+GT(o,c,l)+zT[u]+Hs[u]|0,g=(ki(n,2)^ki(n,13)^ki(n,22))+HT(n,s,r)|0;h=l,l=c,c=o,o=a+f|0,a=r,r=s,s=n,n=f+g|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(){Hs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const z0=cf(()=>new VT),Ll=BigInt(2**32-1),lf=BigInt(32);function V0(i,e=!1){return e?{h:Number(i&Ll),l:Number(i>>lf&Ll)}:{h:Number(i>>lf&Ll)|0,l:Number(i&Ll)|0}}function W0(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}=V0(i[s],e);[t[s],n[s]]=[r,a]}return[t,n]}const WT=(i,e)=>BigInt(i>>>0)<<lf|BigInt(e>>>0),qT=(i,e,t)=>i>>>t,KT=(i,e,t)=>i<<32-t|e>>>t,jT=(i,e,t)=>i>>>t|e<<32-t,XT=(i,e,t)=>i<<32-t|e>>>t,YT=(i,e,t)=>i<<64-t|e>>>t-32,JT=(i,e,t)=>i>>>t-32|e<<64-t,ZT=(i,e)=>e,$T=(i,e)=>i,q0=(i,e,t)=>i<<t|e>>>32-t,K0=(i,e,t)=>e<<t|i>>>32-t,j0=(i,e,t)=>e<<t-32|i>>>64-t,X0=(i,e,t)=>i<<t-32|e>>>64-t;function eR(i,e,t,n){const s=(e>>>0)+(n>>>0);return{h:i+t+(s/2**32|0)|0,l:s|0}}const ct={fromBig:V0,split:W0,toBig:WT,shrSH:qT,shrSL:KT,rotrSH:jT,rotrSL:XT,rotrBH:YT,rotrBL:JT,rotr32H:ZT,rotr32L:$T,rotlSH:q0,rotlSL:K0,rotlBH:j0,rotlBL:X0,add:eR,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)},[tR,nR]=ct.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))),zs=new Uint32Array(80),Vs=new Uint32Array(80);class iR extends H0{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:m,Hh:g,Hl:A}=this;return[e,t,n,s,r,a,o,c,l,h,u,d,f,m,g,A]}set(e,t,n,s,r,a,o,c,l,h,u,d,f,m,g,A){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=m|0,this.Hh=g|0,this.Hl=A|0}process(e,t){for(let b=0;b<16;b++,t+=4)zs[b]=e.getUint32(t),Vs[b]=e.getUint32(t+=4);for(let b=16;b<80;b++){const _=zs[b-15]|0,M=Vs[b-15]|0,w=ct.rotrSH(_,M,1)^ct.rotrSH(_,M,8)^ct.shrSH(_,M,7),S=ct.rotrSL(_,M,1)^ct.rotrSL(_,M,8)^ct.shrSL(_,M,7),T=zs[b-2]|0,C=Vs[b-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,Vs[b-7],Vs[b-16]),q=ct.add4H(K,w,v,zs[b-7],zs[b-16]);zs[b]=q|0,Vs[b]=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:m,Gh:g,Gl:A,Hh:p,Hl:y}=this;for(let b=0;b<80;b++){const _=ct.rotrSH(u,d,14)^ct.rotrSH(u,d,18)^ct.rotrBH(u,d,41),M=ct.rotrSL(u,d,14)^ct.rotrSL(u,d,18)^ct.rotrBL(u,d,41),w=u&f^~u&g,S=d&m^~d&A,T=ct.add5L(y,M,S,nR[b],Vs[b]),C=ct.add5H(T,p,_,w,tR[b],zs[b]),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;p=g|0,y=A|0,g=f|0,A=m|0,f=u|0,m=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:m}=ct.add(this.Fh|0,this.Fl|0,f|0,m|0),{h:g,l:A}=ct.add(this.Gh|0,this.Gl|0,g|0,A|0),{h:p,l:y}=ct.add(this.Hh|0,this.Hl|0,p|0,y|0),this.set(n,s,r,a,o,c,l,h,u,d,f,m,g,A,p,y)}roundClean(){zs.fill(0),Vs.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 sR=cf(()=>new iR);function rR(){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 Y0=rR();Y0.crypto||Y0.msCrypto;function aR(i){switch(i){case"sha256":return z0.create();case"sha512":return sR.create()}V(!1,"invalid hashing algorithm name","algorithm",i)}const[J0,Z0,$0]=[[],[],[]],oR=BigInt(0),Uo=BigInt(1),cR=BigInt(2),lR=BigInt(7),hR=BigInt(256),uR=BigInt(113);for(let i=0,e=Uo,t=1,n=0;i<24;i++){[t,n]=[n,(2*t+3*n)%5],J0.push(2*(5*n+t)),Z0.push((i+1)*(i+2)/2%64);let s=oR;for(let r=0;r<7;r++)e=(e<<Uo^(e>>lR)*uR)%hR,e&cR&&(s^=Uo<<(Uo<<BigInt(r))-Uo);$0.push(s)}const[dR,fR]=W0($0,!0),eb=(i,e,t)=>t>32?j0(i,e,t):q0(i,e,t),tb=(i,e,t)=>t>32?X0(i,e,t):K0(i,e,t);function pR(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=eb(l,h,1)^t[o],d=tb(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=Z0[a],c=eb(s,r,o),l=tb(s,r,o),h=J0[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]^=dR[n],i[1]^=fR[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,Fl(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=PT(this.state)}keccak(){pR(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Ia(this);const{blockLen:t,state:n}=this;e=Dl(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){Ia(this,!1),sf(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 Fl(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(U0(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 AR=((i,e,t)=>cf(()=>new hf(e,i,t)))(1,136,256/8);let nb=!1;const ib=function(i){return AR(i)};let sb=ib;function $t(i){const e=lt(i,"data");return Ce(sb(e))}$t._=ib,$t.lock=function(){nb=!0},$t.register=function(i){if(nb)throw new TypeError("keccak256 is locked");sb=i},Object.freeze($t);const rb=function(i){return aR("sha256").update(i).digest()};let ab=rb,ob=!1;function Ma(i){const e=lt(i,"data");return Ce(ab(e))}Ma._=rb,Ma.lock=function(){ob=!0},Ma.register=function(i){if(ob)throw new Error("sha256 is locked");ab=i},Object.freeze(Ma),Object.freeze(Ma);BigInt(0);const gR=BigInt(1),mR=BigInt(2),Pl=i=>i instanceof Uint8Array,bR=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ba(i){if(!Pl(i))throw new Error("Uint8Array expected");let e="";for(let t=0;t<i.length;t++)e+=bR[i[t]];return e}function uf(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return BigInt(i===""?"0":`0x${i}`)}function Oo(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 pr(i){return uf(Ba(i))}function df(i){if(!Pl(i))throw new Error("Uint8Array expected");return uf(Ba(Uint8Array.from(i).reverse()))}function Ta(i,e){return Oo(i.toString(16).padStart(e*2,"0"))}function ff(i,e){return Ta(i,e).reverse()}function wi(i,e,t){let n;if(typeof e=="string")try{n=Oo(e)}catch(r){throw new Error(`${i} must be valid hex string, got "${e}". Cause: ${r}`)}else if(Pl(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 Qo(...i){const e=new Uint8Array(i.reduce((n,s)=>n+s.length,0));let t=0;return i.forEach(n=>{if(!Pl(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}const pf=i=>(mR<<BigInt(i-1))-gR,Af=i=>new Uint8Array(i),cb=i=>Uint8Array.from(i);function lb(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=Af(i),s=Af(i),r=0;const a=()=>{n.fill(1),s.fill(0),r=0},o=(...u)=>t(s,n,...u),c=(u=Af())=>{s=o(cb([0]),u),n=o(),u.length!==0&&(s=o(cb([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 Qo(...d)};return(u,d)=>{a(),c(u);let f;for(;!(f=d(l()));)c();return a(),f}}const xR={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 Go(i,e,t={}){const n=(s,r,a)=>{const o=xR[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 ER=Object.freeze(Object.defineProperty({__proto__:null,bitMask:pf,bytesToHex:Ba,bytesToNumberBE:pr,bytesToNumberLE:df,concatBytes:Qo,createHmacDrbg:lb,ensureBytes:wi,hexToBytes:Oo,hexToNumber:uf,numberToBytesBE:Ta,numberToBytesLE:ff,validateObject:Go},Symbol.toStringTag,{value:"Module"}));const An=BigInt(0),jt=BigInt(1),Ar=BigInt(2),_R=BigInt(3),gf=BigInt(4),hb=BigInt(5),ub=BigInt(8);BigInt(9),BigInt(16);function Gn(i,e){const t=i%e;return t>=An?t:e+t}function yR(i,e,t){if(t<=An||e<An)throw new Error("Expected power/modulo > 0");if(t===jt)return An;let n=jt;for(;e>An;)e&jt&&(n=n*i%t),i=i*i%t,e>>=jt;return n}function si(i,e,t){let n=i;for(;e-- >An;)n*=n,n%=t;return n}function mf(i,e){if(i===An||e<=An)throw new Error(`invert: expected positive integers, got n=${i} mod=${e}`);let t=Gn(i,e),n=e,s=An,r=jt;for(;t!==An;){const o=n/t,c=n%t,l=s-r*o;n=t,t=c,s=r,r=l}if(n!==jt)throw new Error("invert: does not exist");return Gn(s,e)}function wR(i){const e=(i-jt)/Ar;let t,n,s;for(t=i-jt,n=0;t%Ar===An;t/=Ar,n++);for(s=Ar;s<i&&yR(s,e,i)!==i-jt;s++);if(n===1){const a=(i+jt)/gf;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+jt)/Ar;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 g=o.sqr(d);f<l&&!o.eql(g,o.ONE);f++)g=o.sqr(g);const m=o.pow(h,jt<<BigInt(l-f-1));h=o.sqr(m),u=o.mul(u,m),d=o.mul(d,h),l=f}return u}}function vR(i){if(i%gf===_R){const e=(i+jt)/gf;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%ub===hb){const e=(i-hb)/ub;return function(n,s){const r=n.mul(s,Ar),a=n.pow(r,e),o=n.mul(s,a),c=n.mul(n.mul(o,Ar),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 wR(i)}const CR=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function SR(i){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=CR.reduce((n,s)=>(n[s]="function",n),e);return Go(i,t)}function IR(i,e,t){if(t<An)throw new Error("Expected power > 0");if(t===An)return i.ONE;if(t===jt)return e;let n=i.ONE,s=e;for(;t>An;)t&jt&&(n=i.mul(n,s)),s=i.sqr(s),t>>=jt;return n}function MR(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 db(i,e){const t=e!==void 0?e:i.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function BR(i,e,t=!1,n={}){if(i<=An)throw new Error(`Expected Field ORDER > 0, got ${i}`);const{nBitLength:s,nByteLength:r}=db(i,e);if(r>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=vR(i),o=Object.freeze({ORDER:i,BITS:s,BYTES:r,MASK:pf(s),ZERO:An,ONE:jt,create:c=>Gn(c,i),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return An<=c&&c<i},is0:c=>c===An,isOdd:c=>(c&jt)===jt,neg:c=>Gn(-c,i),eql:(c,l)=>c===l,sqr:c=>Gn(c*c,i),add:(c,l)=>Gn(c+l,i),sub:(c,l)=>Gn(c-l,i),mul:(c,l)=>Gn(c*l,i),pow:(c,l)=>IR(o,c,l),div:(c,l)=>Gn(c*mf(l,i),i),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>mf(c,i),sqrt:n.sqrt||(c=>a(o,c)),invertBatch:c=>MR(o,c),cmov:(c,l,h)=>h?l:c,toBytes:c=>t?ff(c,r):Ta(c,r),fromBytes:c=>{if(c.length!==r)throw new Error(`Fp.fromBytes: expected ${r}, got ${c.length}`);return t?df(c):pr(c)}});return Object.freeze(o)}function fb(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 pb(i){const e=fb(i);return e+Math.ceil(e/2)}function TR(i,e,t=!1){const n=i.length,s=fb(e),r=pb(e);if(n<16||n<r||n>1024)throw new Error(`expected ${r}-1024 bytes of input, got ${n}`);const a=t?pr(i):df(i),o=Gn(a,e-jt)+jt;return t?ff(o,s):Ta(o,s)}const RR=BigInt(0),bf=BigInt(1);function NR(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>RR;)r&bf&&(a=a.add(o)),o=o.double(),r>>=bf;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 m=0;m<o;m++){const g=m*c;let A=Number(a&u);a>>=f,A>c&&(A-=d,a+=bf);const p=g,y=g+Math.abs(A)-1,b=m%2!==0,_=A<0;A===0?h=h.add(t(b,r[p])):l=l.add(t(_,r[y]))}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 Ab(i){return SR(i.Fp),Go(i,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...db(i.n,i.nBitLength),...i,p:i.Fp.ORDER})}function FR(i){const e=Ab(i);Go(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:DR,hexToBytes:LR}=ER,gr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(i){const{Err:e}=gr;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:DR(n),l:i.subarray(t+2)}},toSig(i){const{Err:e}=gr,t=typeof i=="string"?LR(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}=gr._parseInt(t.subarray(2)),{d:a,l:o}=gr._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}`}},os=BigInt(0),ri=BigInt(1);BigInt(2);const gb=BigInt(3);BigInt(4);function PR(i){const e=FR(i),{Fp:t}=e,n=e.toBytes||((m,g,A)=>{const p=g.toAffine();return Qo(Uint8Array.from([4]),t.toBytes(p.x),t.toBytes(p.y))}),s=e.fromBytes||(m=>{const g=m.subarray(1),A=t.fromBytes(g.subarray(0,t.BYTES)),p=t.fromBytes(g.subarray(t.BYTES,2*t.BYTES));return{x:A,y:p}});function r(m){const{a:g,b:A}=e,p=t.sqr(m),y=t.mul(p,m);return t.add(t.add(y,t.mul(m,g)),A)}if(!t.eql(t.sqr(e.Gy),r(e.Gx)))throw new Error("bad generator point: equation left != right");function a(m){return typeof m=="bigint"&&os<m&&m<e.n}function o(m){if(!a(m))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(m){const{allowedPrivateKeyLengths:g,nByteLength:A,wrapPrivateKey:p,n:y}=e;if(g&&typeof m!="bigint"){if(m instanceof Uint8Array&&(m=Ba(m)),typeof m!="string"||!g.includes(m.length))throw new Error("Invalid key");m=m.padStart(A*2,"0")}let b;try{b=typeof m=="bigint"?m:pr(wi("private key",m,A))}catch{throw new Error(`private key must be ${A} bytes, hex or bigint, not ${typeof m}`)}return p&&(b=Gn(b,y)),o(b),b}const l=new Map;function h(m){if(!(m instanceof u))throw new Error("ProjectivePoint expected")}class u{constructor(g,A,p){if(this.px=g,this.py=A,this.pz=p,g==null||!t.isValid(g))throw new Error("x required");if(A==null||!t.isValid(A))throw new Error("y required");if(p==null||!t.isValid(p))throw new Error("z required")}static fromAffine(g){const{x:A,y:p}=g||{};if(!g||!t.isValid(A)||!t.isValid(p))throw new Error("invalid affine point");if(g instanceof u)throw new Error("projective point not allowed");const y=b=>t.eql(b,t.ZERO);return y(A)&&y(p)?u.ZERO:new u(A,p,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(g){const A=t.invertBatch(g.map(p=>p.pz));return g.map((p,y)=>p.toAffine(A[y])).map(u.fromAffine)}static fromHex(g){const A=u.fromAffine(s(wi("pointHex",g)));return A.assertValidity(),A}static fromPrivateKey(g){return u.BASE.multiply(c(g))}_setWindowSize(g){this._WINDOW_SIZE=g,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:g,y:A}=this.toAffine();if(!t.isValid(g)||!t.isValid(A))throw new Error("bad point: x or y not FE");const p=t.sqr(A),y=r(g);if(!t.eql(p,y))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:g}=this.toAffine();if(t.isOdd)return!t.isOdd(g);throw new Error("Field doesn't support isOdd")}equals(g){h(g);const{px:A,py:p,pz:y}=this,{px:b,py:_,pz:M}=g,w=t.eql(t.mul(A,M),t.mul(b,y)),S=t.eql(t.mul(p,M),t.mul(_,y));return w&&S}negate(){return new u(this.px,t.neg(this.py),this.pz)}double(){const{a:g,b:A}=e,p=t.mul(A,gb),{px:y,py:b,pz:_}=this;let M=t.ZERO,w=t.ZERO,S=t.ZERO,T=t.mul(y,y),C=t.mul(b,b),v=t.mul(_,_),F=t.mul(y,b);return F=t.add(F,F),S=t.mul(y,_),S=t.add(S,S),M=t.mul(g,S),w=t.mul(p,v),w=t.add(M,w),M=t.sub(C,w),w=t.add(C,w),w=t.mul(M,w),M=t.mul(F,M),S=t.mul(p,S),v=t.mul(g,v),F=t.sub(T,v),F=t.mul(g,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(b,_),v=t.add(v,v),T=t.mul(v,F),M=t.sub(M,T),S=t.mul(v,C),S=t.add(S,S),S=t.add(S,S),new u(M,w,S)}add(g){h(g);const{px:A,py:p,pz:y}=this,{px:b,py:_,pz:M}=g;let w=t.ZERO,S=t.ZERO,T=t.ZERO;const C=e.a,v=t.mul(e.b,gb);let F=t.mul(A,b),K=t.mul(p,_),q=t.mul(y,M),$=t.add(A,p),D=t.add(b,_);$=t.mul($,D),D=t.add(F,K),$=t.sub($,D),D=t.add(A,y);let O=t.add(b,M);return D=t.mul(D,O),O=t.add(F,q),D=t.sub(D,O),O=t.add(p,y),w=t.add(_,M),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),S=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),S=t.add(S,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,S,T)}subtract(g){return this.add(g.negate())}is0(){return this.equals(u.ZERO)}wNAF(g){return f.wNAFCached(this,l,g,A=>{const p=t.invertBatch(A.map(y=>y.pz));return A.map((y,b)=>y.toAffine(p[b])).map(u.fromAffine)})}multiplyUnsafe(g){const A=u.ZERO;if(g===os)return A;if(o(g),g===ri)return this;const{endo:p}=e;if(!p)return f.unsafeLadder(this,g);let{k1neg:y,k1:b,k2neg:_,k2:M}=p.splitScalar(g),w=A,S=A,T=this;for(;b>os||M>os;)b&ri&&(w=w.add(T)),M&ri&&(S=S.add(T)),T=T.double(),b>>=ri,M>>=ri;return y&&(w=w.negate()),_&&(S=S.negate()),S=new u(t.mul(S.px,p.beta),S.py,S.pz),w.add(S)}multiply(g){o(g);let A=g,p,y;const{endo:b}=e;if(b){const{k1neg:_,k1:M,k2neg:w,k2:S}=b.splitScalar(A);let{p:T,f:C}=this.wNAF(M),{p:v,f:F}=this.wNAF(S);T=f.constTimeNegate(_,T),v=f.constTimeNegate(w,v),v=new u(t.mul(v.px,b.beta),v.py,v.pz),p=T.add(v),y=C.add(F)}else{const{p:_,f:M}=this.wNAF(A);p=_,y=M}return u.normalizeZ([p,y])[0]}multiplyAndAddUnsafe(g,A,p){const y=u.BASE,b=(M,w)=>w===os||w===ri||!M.equals(y)?M.multiplyUnsafe(w):M.multiply(w),_=b(this,A).add(b(g,p));return _.is0()?void 0:_}toAffine(g){const{px:A,py:p,pz:y}=this,b=this.is0();g==null&&(g=b?t.ONE:t.inv(y));const _=t.mul(A,g),M=t.mul(p,g),w=t.mul(y,g);if(b)return{x:t.ZERO,y:t.ZERO};if(!t.eql(w,t.ONE))throw new Error("invZ was invalid");return{x:_,y:M}}isTorsionFree(){const{h:g,isTorsionFree:A}=e;if(g===ri)return!0;if(A)return A(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:g,clearCofactor:A}=e;return g===ri?this:A?A(u,this):this.multiplyUnsafe(e.h)}toRawBytes(g=!0){return this.assertValidity(),n(u,this,g)}toHex(g=!0){return Ba(this.toRawBytes(g))}}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=NR(u,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:r,isWithinCurveOrder:a}}function kR(i){const e=Ab(i);return Go(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function UR(i){const e=kR(i),{Fp:t,n}=e,s=t.BYTES+1,r=2*t.BYTES+1;function a(D){return os<D&&D<t.ORDER}function o(D){return Gn(D,n)}function c(D){return mf(D,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:h,weierstrassEquation:u,isWithinCurveOrder:d}=PR({...e,toBytes(D,O,Y){const Q=O.toAffine(),J=t.toBytes(Q.x),ee=Qo;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=pr(Q);if(!a(J))throw new Error("Point is not on curve");const ee=u(J);let ae=t.sqrt(ee);const ye=(ae&ri)===ri;return(Y&1)===1!==ye&&(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=>Ba(Ta(D,e.nByteLength));function m(D){const O=n>>ri;return D>O}function g(D){return m(D)?o(-D):D}const A=(D,O,Y)=>pr(D.slice(O,Y));class p{constructor(O,Y,Q){this.r=O,this.s=Y,this.recovery=Q,this.assertValidity()}static fromCompact(O){const Y=e.nByteLength;return O=wi("compactSignature",O,Y*2),new p(A(O,0,Y),A(O,Y,2*Y))}static fromDER(O){const{r:Y,s:Q}=gr.toSig(wi("DER",O));return new p(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 p(this.r,this.s,O)}recoverPublicKey(O){const{r:Y,s:Q,recovery:J}=this,ee=S(wi("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),be=o(Q*se),xe=l.BASE.multiplyAndAddUnsafe(Me,me,be);if(!xe)throw new Error("point at infinify");return xe.assertValidity(),xe}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Oo(this.toDERHex())}toDERHex(){return gr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Oo(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const y={isValidPrivateKey(D){try{return h(D),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const D=pb(e.n);return TR(e.randomBytes(D),e.n)},precompute(D=8,O=l.BASE){return O._setWindowSize(D),O.multiply(BigInt(3)),O}};function b(D,O=!0){return l.fromPrivateKey(D).toRawBytes(O)}function _(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 M(D,O,Y=!0){if(_(D))throw new Error("first arg must be private key");if(!_(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=pr(D),Y=D.length*8-e.nBitLength;return Y>0?O>>BigInt(Y):O},S=e.bits2int_modN||function(D){return o(w(D))},T=pf(e.nBitLength);function C(D){if(typeof D!="bigint")throw new Error("bigint expected");if(!(os<=D&&D<T))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Ta(D,e.nByteLength)}function v(D,O,Y=F){if(["recovered","canonical"].some($e=>$e 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),D=wi("msgHash",D),ae&&(D=wi("prehashed msgHash",Q(D)));const Me=S(D),se=h(O),me=[C(se),C(Me)];if(ye!=null){const $e=ye===!0?J(t.BYTES):ye;me.push(wi("extraEntropy",$e))}const be=Qo(...me),xe=Me;function Pe($e){const Qe=w($e);if(!d(Qe))return;const St=c(Qe),ut=l.BASE.multiply(Qe).toAffine(),Je=o(ut.x);if(Je===os)return;const G=o(St*o(xe+Je*se));if(G===os)return;let mn=(ut.x===Je?0:2)|Number(ut.y&ri),dt=G;return ee&&m(G)&&(dt=g(G),mn^=1),new p(Je,dt,mn)}return{seed:be,k2sig:Pe}}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 lb(ee.hash.outputLen,ee.nByteLength,ee.hmac)(Q,J)}l.BASE._setWindowSize(8);function $(D,O,Y,Q=K){const J=D;if(O=wi("msgHash",O),Y=wi("publicKey",Y),"strict"in Q)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:ae}=Q;let ye,Me;try{if(typeof J=="string"||J instanceof Uint8Array)try{ye=p.fromDER(J)}catch(ut){if(!(ut instanceof gr.Err))throw ut;ye=p.fromCompact(J)}else if(typeof J=="object"&&typeof J.r=="bigint"&&typeof J.s=="bigint"){const{r:ut,s:Je}=J;ye=new p(ut,Je)}else throw new Error("PARSE");Me=l.fromHex(Y)}catch(ut){if(ut.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&ye.hasHighS())return!1;ae&&(O=e.hash(O));const{r:se,s:me}=ye,be=S(O),xe=c(me),Pe=o(be*xe),$e=o(se*xe),Qe=l.BASE.multiplyAndAddUnsafe(Me,Pe,$e)?.toAffine();return Qe?o(Qe.x)===se:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:M,sign:q,verify:$,ProjectivePoint:l,Signature:p,utils:y}}function OR(i){return{hash:i,hmac:(e,...t)=>G0(i,e,UT(...t)),randomBytes:OT}}function QR(i,e){const t=n=>UR({...i,...OR(n)});return Object.freeze({...t(e),create:t})}const mb=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),bb=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),GR=BigInt(1),xf=BigInt(2),xb=(i,e)=>(i+e/xf)/e;function HR(i){const e=mb,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,xf,e)*l%e,m=si(f,s,e)*f%e,g=si(m,r,e)*m%e,A=si(g,o,e)*g%e,p=si(A,c,e)*A%e,y=si(p,o,e)*g%e,b=si(y,t,e)*h%e,_=si(b,a,e)*m%e,M=si(_,n,e)*l%e,w=si(M,xf,e);if(!Ef.eql(Ef.sqr(w),i))throw new Error("Cannot find square root");return w}const Ef=BR(mb,void 0,void 0,{sqrt:HR}),Ws=QR({a:BigInt(0),b:BigInt(7),Fp:Ef,n:bb,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:i=>{const e=bb,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-GR*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),r=t,a=BigInt("0x100000000000000000000000000000000"),o=xb(r*i,e),c=xb(-n*i,e);let l=Gn(i-o*t-c*s,e),h=Gn(-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}}}},z0);BigInt(0),Ws.ProjectivePoint;const Ho="0x0000000000000000000000000000000000000000",Eb="0x0000000000000000000000000000000000000000000000000000000000000000",_b=BigInt(0),yb=BigInt(1),_f=BigInt(2),wb=BigInt(27),vb=BigInt(28),kl=BigInt(35),Cb=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),zR=Cb/_f,VR=Symbol.for("nodejs.util.inspect.custom"),mr={};function yf(i){return ns(Zt(i),32)}class Gt{#e;#t;#n;#i;get r(){return this.#e}set r(e){V(Ca(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(Ca(e)===32,"invalid s","value",e),this.#t=Ce(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=zR}get v(){return this.#n}set v(e){const t=ht(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:Gt.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=lt(this.s);return this.yParity&&(e[0]|=128),Ce(e)}get compactSerialized(){return Ut([this.r,this.yParityAndS])}get serialized(){return Ut([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,n,s){Il(e,mr,"Signature"),this.#e=t,this.#t=n,this.#n=s,this.#i=null}getCanonical(){if(this.isValid())return this;const e=Cb-BigInt(this._s),t=55-this.v,n=new Gt(mr,this.r,yf(e),t);return this.networkV&&(n.#i=this.networkV),n}clone(){const e=new Gt(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}}[VR](){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=Re(e,"v");return t==wb||t==vb?_b:(V(t>=kl,"invalid EIP-155 v","v",e),(t-kl)/_f)}static getChainIdV(e,t){return Re(e)*_f+BigInt(35+t-27)}static getNormalizedV(e){const t=Re(e);return t===_b||t===wb?27:t===yb||t===vb?28:(V(t>=kl,"invalid v","v",e),t&yb?27:28)}static from(e){function t(l,h){V(l,h,"signature",e)}if(e==null)return new Gt(mr,Eb,Eb,27);if(typeof e=="string"){const l=lt(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 Gt(mr,h,Ce(u),d)}if(l.length===65){const h=Ce(l.slice(0,32)),u=Ce(l.slice(32,64)),d=Gt.getNormalizedV(l[64]);return new Gt(mr,h,u,d)}t(!1,"invalid raw signature length")}if(e instanceof Gt)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(Ft(h,32),"invalid yParityAndS");const u=lt(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=Re(l);return{networkV:d>=kl?d:void 0,v:Gt.getNormalizedV(d)}}if(h!=null)return t(Ft(h,32),"invalid yParityAndS"),{v:lt(h)[0]&128?28:27};if(u!=null){switch(ht(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 Gt(mr,s,r,o);return a&&(c.#i=a),t(e.yParity==null||ht(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}}class cs{#e;constructor(e){V(Ca(e)===32,"invalid private key","privateKey","[REDACTED]"),this.#e=Ce(e)}get privateKey(){return this.#e}get publicKey(){return cs.computePublicKey(this.#e)}get compressedPublicKey(){return cs.computePublicKey(this.#e,!0)}sign(e){V(Ca(e)===32,"invalid digest length","digest",e);const t=Ws.sign(Dn(e),Dn(this.#e),{lowS:!0});return Gt.from({r:Os(t.r,32),s:Os(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=cs.computePublicKey(e);return Ce(Ws.getSharedSecret(Dn(this.#e),lt(t),!1))}static computePublicKey(e,t){let n=lt(e,"key");if(n.length===32){const r=Ws.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=Ws.ProjectivePoint.fromHex(n);return Ce(s.toRawBytes(t))}static recoverPublicKey(e,t){V(Ca(e)===32,"invalid digest length","digest",e);const n=Gt.from(t);let s=Ws.Signature.fromCompact(Dn(Ut([n.r,n.s])));s=s.addRecoveryBit(n.yParity);const r=s.recoverPublicKey(Dn(e));return V(r!=null,"invalid signature for digest","signature",t),"0x"+r.toHex(!1)}static addPoints(e,t,n){const s=Ws.ProjectivePoint.fromHex(cs.computePublicKey(e).substring(2)),r=Ws.ProjectivePoint.fromHex(cs.computePublicKey(t).substring(2));return"0x"+s.add(r).toHex(!!n)}}const WR=BigInt(0),qR=BigInt(36);function Sb(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=lt($t(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 wf={};for(let i=0;i<10;i++)wf[String(i)]=String(i);for(let i=0;i<26;i++)wf[String.fromCharCode(65+i)]=String(10+i);const Ib=15;function KR(i){i=i.toUpperCase(),i=i.substring(4)+i.substring(0,2)+"00";let e=i.split("").map(n=>wf[n]).join("");for(;e.length>=Ib;){let n=e.substring(0,Ib);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 jR=(function(){const i={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];i[t]=BigInt(e)}return i})();function XR(i){i=i.toLowerCase();let e=WR;for(let t=0;t<i.length;t++)e=e*qR+jR[i[t]];return e}function Ct(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=Sb(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)===KR(i),"bad icap checksum","address",i);let e=XR(i.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return Sb("0x"+e)}V(!1,"invalid address","address",i)}function YR(i){const e=Ct(i.from);let n=Re(i.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,Ct(Vt($t(ss([e,n])),12))}function Mb(i){return i&&typeof i.getAddress=="function"}async function vf(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)),Ct(t)}function Pn(i,e){if(typeof i=="string")return i.match(/^0x[0-9a-f]{40}$/i)?Ct(i):(pe(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),vf(i,e.resolveName(i)));if(Mb(i))return vf(i,i.getAddress());if(i&&typeof i.then=="function")return vf(i,i);V(!1,"unsupported addressable value","target",i)}const ls={};function Be(i,e){let t=!1;return e<0&&(t=!0,e*=-1),new Wt(ls,`${t?"":"u"}int${e}`,i,{signed:t,width:e})}function xt(i,e){return new Wt(ls,`bytes${e||""}`,i,{size:e})}const Bb=Symbol.for("_ethers_typed");class Wt{type;value;#e;_typedSymbol;constructor(e,t,n,s){s==null&&(s=null),Il(ls,e,"Typed"),Xe(this,{_typedSymbol:Bb,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 Wt(ls,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 xt(e,1)}static bytes2(e){return xt(e,2)}static bytes3(e){return xt(e,3)}static bytes4(e){return xt(e,4)}static bytes5(e){return xt(e,5)}static bytes6(e){return xt(e,6)}static bytes7(e){return xt(e,7)}static bytes8(e){return xt(e,8)}static bytes9(e){return xt(e,9)}static bytes10(e){return xt(e,10)}static bytes11(e){return xt(e,11)}static bytes12(e){return xt(e,12)}static bytes13(e){return xt(e,13)}static bytes14(e){return xt(e,14)}static bytes15(e){return xt(e,15)}static bytes16(e){return xt(e,16)}static bytes17(e){return xt(e,17)}static bytes18(e){return xt(e,18)}static bytes19(e){return xt(e,19)}static bytes20(e){return xt(e,20)}static bytes21(e){return xt(e,21)}static bytes22(e){return xt(e,22)}static bytes23(e){return xt(e,23)}static bytes24(e){return xt(e,24)}static bytes25(e){return xt(e,25)}static bytes26(e){return xt(e,26)}static bytes27(e){return xt(e,27)}static bytes28(e){return xt(e,28)}static bytes29(e){return xt(e,29)}static bytes30(e){return xt(e,30)}static bytes31(e){return xt(e,31)}static bytes32(e){return xt(e,32)}static address(e){return new Wt(ls,"address",e)}static bool(e){return new Wt(ls,"bool",!!e)}static bytes(e){return new Wt(ls,"bytes",e)}static string(e){return new Wt(ls,"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 Wt(ls,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===Bb}static dereference(e,t){if(Wt.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}}class JR extends as{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=Wt.dereference(t,"string");try{n=Ct(n)}catch(s){return this._throwError(s.message,t)}return e.writeValue(n)}decode(e){return Ct(Os(e.readValue(),20))}}class ZR extends as{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}function Tb(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 Rb(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(_n(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(_n(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)}),rs.fromItems(t,n)}class $R extends as{coder;length;constructor(e,t,n){const s=e.type+"["+(t>=0?t:"")+"]",r=t===-1||e.dynamic;super("array",s,n,r),Xe(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=Wt.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)),f0(n.length,s,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let a=0;a<n.length;a++)r.push(this.coder);return Tb(e,r,n)}decode(e){let t=this.length;t===-1&&(t=e.readIndex(),pe(t*Ln<=e.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:e.bytes,offset:t*Ln,length:e.dataLength}));let n=[];for(let s=0;s<t;s++)n.push(new ZR(this.coder));return Rb(e,n)}}class eN extends as{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const n=Wt.dereference(t,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class Nb extends as{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Dn(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class tN extends Nb{constructor(e){super("bytes",e)}decode(e){return Ce(super.decode(e))}}class nN extends as{size;constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),Xe(this,{size:e},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,t){let n=Dn(Wt.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 iN=new Uint8Array([]);class sN extends as{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(iN)}decode(e){return e.readBytes(0),null}}const rN=BigInt(0),aN=BigInt(1),oN=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class cN extends as{size;signed;constructor(e,t,n){const s=(t?"int":"uint")+e*8;super(s,s,n,!1),Xe(this,{size:e,signed:t},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(e,t){let n=Re(Wt.dereference(t,this.type)),s=Lo(oN,Ln*8);if(this.signed){let r=Lo(s,this.size*8-1);(n>r||n<-(r+aN))&&this._throwError("value out-of-bounds",t),n=m0(n,8*Ln)}else(n<rN||n>Lo(s,this.size*8))&&this._throwError("value out-of-bounds",t);return e.writeValue(n)}decode(e){let t=Lo(e.readValue(),this.size*8);return this.signed&&(t=gT(t,this.size*8)),t}}class lN extends Nb{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,is(Wt.dereference(t,"string")))}decode(e){return Bl(super.decode(e))}}class Ul extends as{coders;constructor(e,t){let n=!1;const s=[];e.forEach(a=>{a.dynamic&&(n=!0),s.push(a.type)});const r="tuple("+s.join(",")+")";super("tuple",r,t,n),Xe(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=Wt.dereference(t,"tuple");return Tb(e,this.coders,n)}decode(e){return Rb(e,this.coders)}}function Cf(i,e){return{address:Ct(i),storageKeys:e.map((t,n)=>(V(Ft(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),Cf(t[0],t[1])):(V(t!=null&&typeof t=="object","invalid address-slot set","value",i),Cf(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 Cf(t,Object.keys(n).sort())});return e.sort((t,n)=>t.address.localeCompare(n.address)),e}function Fb(i){return{address:Ct(i.address),nonce:Re(i.nonce!=null?i.nonce:0),chainId:Re(i.chainId!=null?i.chainId:0),signature:Gt.from(i.signature)}}function hN(i){let e;return typeof i=="string"?e=cs.computePublicKey(i,!1):e=i.publicKey,Ct($t("0x"+e.substring(4)).substring(26))}function uN(i,e){return hN(cs.recoverPublicKey(i,e))}const gn=BigInt(0),dN=BigInt(2),fN=BigInt(27),pN=BigInt(28),AN=BigInt(35),gN=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),mN=Symbol.for("nodejs.util.inspect.custom"),Sf=4096*32,Ol=128;function bN(i){return{blobToKzgCommitment:n=>{if("computeBlobProof"in i){if("blobToKzgCommitment"in i&&typeof i.blobToKzgCommitment=="function")return lt(i.blobToKzgCommitment(Ce(n)))}else if("blobToKzgCommitment"in i&&typeof i.blobToKzgCommitment=="function")return lt(i.blobToKzgCommitment(n));if("blobToKZGCommitment"in i&&typeof i.blobToKZGCommitment=="function")return lt(i.blobToKZGCommitment(Ce(n)));V(!1,"unsupported KZG library","kzg",i)},computeBlobKzgProof:(n,s)=>{if("computeBlobProof"in i&&typeof i.computeBlobProof=="function")return lt(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 lt(i.computeBlobKZGProof(Ce(n),Ce(s)));V(!1,"unsupported KZG library","kzg",i)}}}function Db(i,e){let t=i.toString(16);for(;t.length<2;)t="0"+t;return t+=Ma(e).substring(4),"0x"+t}function Ra(i){return i==="0x"?null:Ct(i)}function Ql(i,e){try{return br(i)}catch(t){V(!1,t.message,e,i)}}function xN(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:Ra(s[1]),nonce:Tt(s[2],"nonce"),chainId:Tt(s[0],"chainId"),signature:Gt.from({yParity:xr(s[3],"yParity"),r:ns(s[4],32),s:ns(s[5],32)})})}return t}catch(t){V(!1,t.message,e,i)}}function xr(i,e){return i==="0x"?0:ht(i,e)}function Tt(i,e){if(i==="0x")return gn;const t=Re(i,e);return V(t<=gN,"value exceeds uint size",e,t),t}function gt(i,e){const t=Re(i,"value"),n=Zt(t);return V(n.length<=32,"value too large",`tx.${e}`,t),n}function Gl(i){return br(i).map(e=>[e.address,e.storageKeys])}function EN(i){return i.map(e=>[gt(e.chainId,"chainId"),e.address,gt(e.nonce,"nonce"),gt(e.signature.yParity,"yParity"),Zt(e.signature.r),Zt(e.signature._s)])}function _N(i,e){V(Array.isArray(i),`invalid ${e}`,"value",i);for(let t=0;t<i.length;t++)V(Ft(i[t],32),"invalid ${ param } hash",`value[${t}]`,i[t]);return i}function yN(i){const e=Po(i);V(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",i);const t={type:0,nonce:xr(e[0],"nonce"),gasPrice:Tt(e[1],"gasPrice"),gasLimit:Tt(e[2],"gasLimit"),to:Ra(e[3]),value:Tt(e[4],"value"),data:Ce(e[5]),chainId:gn};if(e.length===6)return t;const n=Tt(e[6],"v"),s=Tt(e[7],"r"),r=Tt(e[8],"s");if(s===gn&&r===gn)t.chainId=n;else{let a=(n-AN)/dN;a<gn&&(a=gn),t.chainId=a,V(a!==gn||n===fN||n===pN,"non-canonical legacy v","v",e[6]),t.signature=Gt.from({r:ns(e[7],32),s:ns(e[8],32),v:n})}return t}function wN(i,e){const t=[gt(i.nonce,"nonce"),gt(i.gasPrice||0,"gasPrice"),gt(i.gasLimit,"gasLimit"),i.to||"0x",gt(i.value,"value"),i.data];let n=gn;if(i.chainId!=gn)n=Re(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!==gn&&(t.push(Zt(n)),t.push("0x"),t.push("0x")),ss(t);let s=BigInt(27+e.yParity);return n!==gn?s=Gt.getChainIdV(n,e.v):BigInt(e.v)!==s&&V(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(Zt(s)),t.push(Zt(e.r)),t.push(Zt(e._s)),ss(t)}function Hl(i,e){let t;try{if(t=xr(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{V(!1,"invalid yParity","yParity",e[0])}const n=ns(e[1],32),s=ns(e[2],32),r=Gt.from({r:n,s,yParity:t});i.signature=r}function vN(i){const e=Po(lt(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:Tt(e[0],"chainId"),nonce:xr(e[1],"nonce"),maxPriorityFeePerGas:Tt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Tt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Tt(e[4],"gasLimit"),to:Ra(e[5]),value:Tt(e[6],"value"),data:Ce(e[7]),accessList:Ql(e[8],"accessList")};return e.length===9||Hl(t,e.slice(9)),t}function CN(i,e){const t=[gt(i.chainId,"chainId"),gt(i.nonce,"nonce"),gt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),gt(i.maxFeePerGas||0,"maxFeePerGas"),gt(i.gasLimit,"gasLimit"),i.to||"0x",gt(i.value,"value"),i.data,Gl(i.accessList||[])];return e&&(t.push(gt(e.yParity,"yParity")),t.push(Zt(e.r)),t.push(Zt(e.s))),Ut(["0x02",ss(t)])}function SN(i){const e=Po(lt(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:Tt(e[0],"chainId"),nonce:xr(e[1],"nonce"),gasPrice:Tt(e[2],"gasPrice"),gasLimit:Tt(e[3],"gasLimit"),to:Ra(e[4]),value:Tt(e[5],"value"),data:Ce(e[6]),accessList:Ql(e[7],"accessList")};return e.length===8||Hl(t,e.slice(8)),t}function IN(i,e){const t=[gt(i.chainId,"chainId"),gt(i.nonce,"nonce"),gt(i.gasPrice||0,"gasPrice"),gt(i.gasLimit,"gasLimit"),i.to||"0x",gt(i.value,"value"),i.data,Gl(i.accessList||[])];return e&&(t.push(gt(e.yParity,"recoveryParam")),t.push(Zt(e.r)),t.push(Zt(e.s))),Ut(["0x01",ss(t)])}function MN(i){let e=Po(lt(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=ht(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*Ol===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<Ol;u++)h.push(c[l*Ol+u]);s.push({data:a[l],commitment:o[l],proof:Ut(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:Tt(e[0],"chainId"),nonce:xr(e[1],"nonce"),maxPriorityFeePerGas:Tt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Tt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Tt(e[4],"gasLimit"),to:Ra(e[5]),value:Tt(e[6],"value"),data:Ce(e[7]),accessList:Ql(e[8],"accessList"),maxFeePerBlobGas:Tt(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(Ft(r.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",i);return e.length===11||Hl(r,e.slice(11)),r}function BN(i,e,t){const n=[gt(i.chainId,"chainId"),gt(i.nonce,"nonce"),gt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),gt(i.maxFeePerGas||0,"maxFeePerGas"),gt(i.gasLimit,"gasLimit"),i.to||Ho,gt(i.value,"value"),i.data,Gl(i.accessList||[]),gt(i.maxFeePerBlobGas||0,"maxFeePerBlobGas"),_N(i.blobVersionedHashes||[],"blobVersionedHashes")];if(e&&(n.push(gt(e.yParity,"yParity")),n.push(Zt(e.r)),n.push(Zt(e.s)),t)){if(i.blobWrapperVersion!=null){const s=Zt(i.blobWrapperVersion),r=[];for(const{proof:a}of t){const o=lt(a),c=o.length/Ol;for(let l=0;l<o.length;l+=c)r.push(o.subarray(l,l+c))}return Ut(["0x03",ss([n,s,t.map(a=>a.data),t.map(a=>a.commitment),r])])}return Ut(["0x03",ss([n,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])])}return Ut(["0x03",ss(n)])}function TN(i){const e=Po(lt(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:Tt(e[0],"chainId"),nonce:xr(e[1],"nonce"),maxPriorityFeePerGas:Tt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Tt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Tt(e[4],"gasLimit"),to:Ra(e[5]),value:Tt(e[6],"value"),data:Ce(e[7]),accessList:Ql(e[8],"accessList"),authorizationList:xN(e[9],"authorizationList")};return e.length===10||Hl(t,e.slice(10)),t}function RN(i,e){const t=[gt(i.chainId,"chainId"),gt(i.nonce,"nonce"),gt(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),gt(i.maxFeePerGas||0,"maxFeePerGas"),gt(i.gasLimit,"gasLimit"),i.to||"0x",gt(i.value,"value"),i.data,Gl(i.accessList||[]),EN(i.authorizationList||[])];return e&&(t.push(gt(e.yParity,"yParity")),t.push(Zt(e.r)),t.push(Zt(e.s))),Ut(["0x04",ss(t)])}class vi{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;#c;#h;#u;#d;#b;#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?Ho:e}set to(e){this.#t=e==null?null:Ct(e)}get nonce(){return this.#i}set nonce(e){this.#i=ht(e,"value")}get gasLimit(){return this.#s}set gasLimit(e){this.#s=Re(e)}get gasPrice(){const e=this.#a;return e==null&&(this.type===0||this.type===1)?gn:e}set gasPrice(e){this.#a=e==null?null:Re(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#r;return e??(this.type===2||this.type===3?gn:null)}set maxPriorityFeePerGas(e){this.#r=e==null?null:Re(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#o;return e??(this.type===2||this.type===3?gn:null)}set maxFeePerGas(e){this.#o=e==null?null:Re(e,"maxFeePerGas")}get data(){return this.#n}set data(e){this.#n=Ce(e)}get value(){return this.#f}set value(e){this.#f=Re(e,"value")}get chainId(){return this.#l}set chainId(e){this.#l=Re(e)}get signature(){return this.#p||null}set signature(e){this.#p=e==null?null:Gt.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.#b||null;return e==null&&this.type===4?[]:e}set authorizationList(e){this.#b=e==null?null:e.map(t=>Fb(t))}get maxFeePerBlobGas(){const e=this.#c;return e==null&&this.type===3?gn:e}set maxFeePerBlobGas(e){this.#c=e==null?null:Re(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(Ft(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(Yd(r)){pe(this.#u,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let a=lt(r);if(V(a.length<=Sf,"blob is too large",`blobs[${s}]`,r),a.length!==Sf){const l=new Uint8Array(Sf);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(Db(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(Db(1,o))}}this.#d=t,this.#h=n}get kzg(){return this.#u}set kzg(e){e==null?this.#u=null:this.#u=bN(e)}get blobWrapperVersion(){return this.#g}set blobWrapperVersion(e){this.#g=e}constructor(){this.#e=null,this.#t=null,this.#i=0,this.#s=gn,this.#a=null,this.#r=null,this.#o=null,this.#n="0x",this.#f=gn,this.#l=gn,this.#p=null,this.#A=null,this.#c=null,this.#h=null,this.#u=null,this.#d=null,this.#b=null,this.#g=null}get hash(){return this.signature==null?null:$t(this.#m(!0,!1))}get unsignedHash(){return $t(this.unsignedSerialized)}get from(){return this.signature==null?null:uN(this.unsignedHash,this.signature.getCanonical())}get fromPublicKey(){return this.signature==null?null:cs.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 wN(this,n);case 1:return IN(this,n);case 2:return CN(this,n);case 3:return BN(this,n,t?this.blobs:null);case 4:return RN(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 vi.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}}[mN](){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 vi;if(typeof e=="string"){const n=lt(e);if(n[0]>=127)return vi.from(yN(n));switch(n[0]){case 1:return vi.from(SN(n));case 2:return vi.from(vN(n));case 3:return vi.from(MN(n));case 4:return vi.from(TN(n))}pe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new vi;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=Gt.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 Er(i){return $t(is(i))}var NN="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";const Lb=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Pb=4;function FN(i){let e=0;function t(){return i[e++]<<8|i[e++]}let n=t(),s=1,r=[0,1];for(let M=1;M<n;M++)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,m=f>>1,g=d-1;let A=0;for(let M=0;M<u;M++)A=A<<1|h();let p=[],y=0,b=d;for(;;){let M=Math.floor(((A-y+1)*s-1)/b),w=0,S=n;for(;S-w>1;){let v=w+S>>>1;M<r[v]?S=v:w=v}if(w==0)break;p.push(w);let T=y+Math.floor(b*r[w]/s),C=y+Math.floor(b*r[w+1]/s)-1;for(;((T^C)&f)==0;)A=A<<1&g|h(),T=T<<1&g,C=C<<1&g|1;for(;T&~C&m;)A=A&f|A<<1&g>>>1|h(),T=T<<1^f,C=(C^f)<<1|f|1;y=T,b=1+C-T}let _=n-4;return p.map(M=>{switch(M-_){case 3:return _+65792+(i[o++]<<16|i[o++]<<8|i[o++]);case 2:return _+256+(i[o++]<<8|i[o++]);case 1:return _+i[o++];default:return M-1}})}function DN(i){let e=0;return()=>i[e++]}function kb(i){return DN(FN(LN(i)))}function LN(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 PN(i){return i&1?~i>>1:i>>1}function kN(i,e){let t=Array(i);for(let n=0,s=0;n<i;n++)t[n]=s+=PN(e());return t}function zo(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 Ub(i){return Vo(()=>{let e=zo(i);if(e.length)return e})}function Ob(i){let e=[];for(;;){let t=i();if(t==0)break;e.push(UN(t,i))}for(;;){let t=i()-1;if(t<0)break;e.push(ON(t,i))}return e.flat()}function Vo(i){let e=[];for(;;){let t=i(e.length);if(!t)break;e.push(t)}return e}function Qb(i,e,t){let n=Array(i).fill().map(()=>[]);for(let s=0;s<e;s++)kN(i,t).forEach((r,a)=>n[a].push(r));return n}function UN(i,e){let t=1+e(),n=e(),s=Vo(e);return Qb(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 ON(i,e){let t=1+e();return Qb(t,1+i,e).map(s=>[s[0],s.slice(1)])}function QN(i){let e=[],t=zo(i);return s(n([]),[]),e;function n(r){let a=i(),o=Vo(()=>{let c=zo(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 GN(i){return i.toString(16).toUpperCase().padStart(2,"0")}function Gb(i){return`{${GN(i)}}`}function HN(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 Na(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 zN(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 VN="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";const Wo=44032,zl=4352,Vl=4449,Wl=4519,Hb=19,zb=21,Fa=28,ql=zb*Fa,WN=Hb*ql,qN=Wo+WN,KN=zl+Hb,jN=Vl+zb,XN=Wl+Fa;function qo(i){return i>>24&255}function Vb(i){return i&16777215}let If,Wb,Mf,Kl;function YN(){let i=kb(VN);If=new Map(Ub(i).flatMap((e,t)=>e.map(n=>[n,t+1<<24]))),Wb=new Set(zo(i)),Mf=new Map,Kl=new Map;for(let[e,t]of Ob(i)){if(!Wb.has(e)&&t.length==2){let[n,s]=t,r=Kl.get(n);r||(r=new Map,Kl.set(n,r)),r.set(s,e)}Mf.set(e,t.reverse())}}function qb(i){return i>=Wo&&i<qN}function JN(i,e){if(i>=zl&&i<KN&&e>=Vl&&e<jN)return Wo+(i-zl)*ql+(e-Vl)*Fa;if(qb(i)&&e>Wl&&e<XN&&(i-Wo)%Fa==0)return i+(e-Wl);{let t=Kl.get(i);return t&&(t=t.get(e),t)?t:-1}}function Kb(i){If||YN();let e=[],t=[],n=!1;function s(r){let a=If.get(r);a&&(n=!0,r|=a),e.push(r)}for(let r of i)for(;;){if(r<128)e.push(r);else if(qb(r)){let a=r-Wo,o=a/ql|0,c=a%ql/Fa|0,l=a%Fa;s(zl+o),s(Vl+c),l>0&&s(Wl+l)}else{let a=Mf.get(r);a?t.push(...a):s(r)}if(!t.length)break;r=t.pop()}if(n&&e.length>1){let r=qo(e[0]);for(let a=1;a<e.length;a++){let o=qo(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=qo(e[--c]),r<=o))break}r=qo(e[a])}}return e}function ZN(i){let e=[],t=[],n=-1,s=0;for(let r of i){let a=qo(r),o=Vb(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=JN(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 jb(i){return Kb(i).map(Vb)}function $N(i){return ZN(Kb(i))}const Xb=45,Yb=".",Jb=65039,Zb=1,jl=i=>Array.from(i);function Ko(i,e){return i.P.has(e)||i.Q.has(e)}class eF extends Array{get is_emoji(){return!0}}let Bf,$b,_r,Tf,ex,Da,Rf,La,yr,tx,Nf;function Ff(){if(Bf)return;let i=kb(NN);const e=()=>zo(i),t=()=>new Set(e()),n=(h,u)=>u.forEach(d=>h.add(d));Bf=new Map(Ob(i)),$b=t(),_r=e(),Tf=new Set(e().map(h=>_r[h])),_r=new Set(_r),ex=t(),t();let s=Ub(i),r=i();const a=()=>{let h=new Set;return e().forEach(u=>n(h,s[u])),n(h,e()),h};Da=Vo(h=>{let u=Vo(i).map(d=>d+96);if(u.length){let d=h>=r;u[0]-=32,u=Na(u),d&&(u=`Restricted[${u}]`);let f=a(),m=a(),g=!i();return{N:u,P:f,Q:m,M:g,R:d}}}),Rf=t(),La=new Map;let o=e().concat(jl(Rf)).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),Rf.has(h)||La.set(h,f)});for(let{V:h,M:u}of new Set(La.values())){let d=[];for(let m of h){let g=Da.filter(p=>Ko(p,m)),A=d.find(({G:p})=>g.some(y=>p.has(y)));A||(A={G:new Set,V:[]},d.push(A)),A.V.push(m),n(A.G,g)}let f=d.flatMap(m=>jl(m.G));for(let{G:m,V:g}of d){let A=new Set(f.filter(p=>!m.has(p)));for(let p of g)u.set(p,A)}}yr=new Set;let c=new Set;const l=h=>yr.has(h)?c.add(h):yr.add(h);for(let h of Da){for(let u of h.P)l(u);for(let u of h.Q)l(u)}for(let h of yr)!La.has(h)&&!c.has(h)&&La.set(h,Zb);n(yr,jb(yr)),tx=QN(i).map(h=>eF.from(h)).sort(zN),Nf=new Map;for(let h of tx){let u=[Nf];for(let d of h){let f=u.map(m=>{let g=m.get(d);return g||(g=new Map,m.set(d,g)),g});d===Jb?u.push(...f):u=f}for(let d of u)d.V=h}}function Df(i){return(nx(i)?"":`${Lf(Xl([i]))} `)+Gb(i)}function Lf(i){return`"${i}"‎`}function tF(i){if(i.length>=4&&i[2]==Xb&&i[3]==Xb)throw new Error(`invalid label extension: "${Na(i.slice(0,4))}"`)}function nF(i){for(let t=i.lastIndexOf(95);t>0;)if(i[--t]!==95)throw new Error("underscore allowed only at start")}function iF(i){let e=i[0],t=Lb.get(e);if(t)throw jo(`leading ${t}`);let n=i.length,s=-1;for(let r=1;r<n;r++){e=i[r];let a=Lb.get(e);if(a){if(s==r)throw jo(`${t} + ${a}`);s=r+1,t=a}}if(s==n)throw jo(`trailing ${t}`)}function Xl(i,e=1/0,t=Gb){let n=[];sF(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];nx(o)&&(n.push(Na(i.slice(s,a))),n.push(t(o)),s=a+1)}return n.push(Na(i.slice(s,r))),n.join("")}function sF(i){return Ff(),_r.has(i)}function nx(i){return Ff(),ex.has(i)}function rF(i){return lF(aF(i,$N,dF))}function aF(i,e,t){if(!i)return[];Ff();let n=0;return i.split(Yb).map(s=>{let r=HN(s),a={input:r,offset:n};n+=r.length+1;try{let o=a.tokens=uF(r,e,t),c=o.length,l;if(!c)throw new Error("empty label");let h=a.output=o.flat();if(nF(h),!(a.emoji=c>1||o[0].is_emoji)&&h.every(d=>d<128))tF(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 jo("leading combining mark");for(let g=1;g<c;g++){let A=o[g];if(!A.is_emoji&&_r.has(A[0]))throw jo(`emoji + combining mark: "${Na(o[g-1])} + ${Xl([A[0]])}"`)}iF(h);let f=jl(new Set(d)),[m]=cF(f);hF(m,d),oF(m,f),l=m.N}}a.type=l}catch(o){a.error=o}return a})}function oF(i,e){let t,n=[];for(let s of e){let r=La.get(s);if(r===Zb)return;if(r){let a=r.M.get(s);if(t=t?t.filter(o=>a.has(o)):jl(a),!t.length)return}else n.push(s)}if(t){for(let s of t)if(n.every(r=>Ko(s,r)))throw new Error(`whole-script confusable: ${i.N}/${s.N}`)}}function cF(i){let e=Da;for(let t of i){let n=e.filter(s=>Ko(s,t));if(!n.length)throw Da.some(s=>Ko(s,t))?sx(e[0],t):ix(t);if(e=n,n.length==1)break}return e}function lF(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 ${Lf(Xl(e,63))}: ${s}`)}return Na(n)}).join(Yb)}function ix(i){return new Error(`disallowed character: ${Df(i)}`)}function sx(i,e){let t=Df(e),n=Da.find(s=>s.P.has(e));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${i.N} + ${t}`)}function jo(i){return new Error(`illegal placement: ${i}`)}function hF(i,e){for(let t of e)if(!Ko(i,t))throw sx(i,t);if(i.M){let t=jb(e);for(let n=1,s=t.length;n<s;n++)if(Tf.has(t[n])){let r=n+1;for(let a;r<s&&Tf.has(a=t[r]);r++)for(let o=n;o<r;o++)if(t[o]==a)throw new Error(`duplicate non-spacing marks: ${Df(a)}`);if(r-n>Pb)throw new Error(`excessive non-spacing marks: ${Lf(Xl(t.slice(n-1,r)))} (${r-n}/${Pb})`);n=r}}}function uF(i,e,t){let n=[],s=[];for(i=i.slice().reverse();i.length;){let r=fF(i);if(r)s.length&&(n.push(e(s)),s=[]),n.push(t(r));else{let a=i.pop();if(yr.has(a))s.push(a);else{let o=Bf.get(a);if(o)s.push(...o);else if(!$b.has(a))throw ix(a)}}}return s.length&&n.push(e(s)),n}function dF(i){return i.filter(e=>e!=Jb)}function fF(i,e){let t=Nf,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 rx=new Uint8Array(32);rx.fill(0);function ax(i){return V(i.length!==0,"invalid ENS name; empty component","comp",i),i}function ox(i){const e=is(pF(i)),t=[];if(i.length===0)return t;let n=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(ax(e.slice(n,s))),n=s+1);return V(n<e.length,"invalid ENS name; empty component","name",i),t.push(ax(e.slice(n))),t}function pF(i){try{if(i.length===0)throw new Error("empty label");return rF(i)}catch(e){V(!1,`invalid ENS name (${e.message})`,"name",i)}}function Pf(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=rx;const t=ox(i);for(;t.length;)e=$t(Ut([e,$t(t.pop())]));return Ce(e)}function AF(i,e){const t=e;return V(t<=255,"DNS encoded label cannot exceed 255","length",t),Ce(Ut(ox(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 cx=new Uint8Array(32);cx.fill(0);const gF=BigInt(-1),lx=BigInt(0),hx=BigInt(1),mF=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function bF(i){const e=lt(i),t=e.length%32;return t?Ut([e,cx.slice(t)]):Ce(e)}const xF=Os(hx,32),EF=Os(lx,32),ux={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},kf=["name","version","chainId","verifyingContract","salt"];function dx(i){return function(e){return V(typeof e=="string",`invalid domain value for ${JSON.stringify(i)}`,`domain.${i}`,e),e}}const _F={name:dx("name"),version:dx("version"),chainId:function(i){const e=Re(i,"domain.chainId");return V(e>=0,"invalid chain ID","domain.chainId",i),Number.isSafeInteger(e)?Number(e):yi(e)},verifyingContract:function(i){try{return Ct(i).toLowerCase()}catch{}V(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",i)},salt:function(i){const e=lt(i,"domain.salt");return V(e.length===32,'invalid domain value "salt"',"domain.salt",i),Ce(e)}};function Uf(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=Lo(mF,t?n-1:n),r=t?(s+hx)*gF:lx;return function(a){const o=Re(a,"value");return V(o>=r&&o<=s,`value out-of-bounds for ${i}`,"value",o),Os(t?m0(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=lt(n);return V(s.length===t,`invalid length for ${i}`,"value",n),bF(n)}}}switch(i){case"address":return function(e){return ns(Ct(e),32)};case"bool":return function(e){return e?xF:EF};case"bytes":return function(e){return $t(e)};case"string":return function(e){return Er(e)}}return null}function fx(i,e){return`${i}(${e.map(({name:t,type:n})=>n+" "+t).join(",")})`}function Yl(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 Kn{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}=Yl(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=Yl(h.type).base;V(u!==c,`circular type reference to ${JSON.stringify(u)}`,"types",e),!Uf(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),Xe(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,fx(c,r[c])+h.map(u=>fx(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=Uf(e);if(s)return s}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($t)),$t(Ut(o))}}const n=this.types[e];if(n){const s=Er(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)?$t(l):l});return a.unshift(s),Ut(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 $t(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(Uf(e))return n(e,t);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];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 Kn(e)}static getPrimaryType(e){return Kn.from(e).primaryType}static hashStruct(e,t,n){return Kn.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){if(e[n]==null)continue;const s=ux[n];V(s,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:s})}return t.sort((n,s)=>kf.indexOf(n.name)-kf.indexOf(s.name)),Kn.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return Ut(["0x1901",Kn.hashDomain(e),Kn.from(t).hash(n)])}static hash(e,t,n){return $t(Kn.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&&!Ft(e.verifyingContract,20)&&(r[e.verifyingContract]="0x");const a=Kn.from(t);a.visit(n,(o,c)=>(o==="address"&&!Ft(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){Kn.hashDomain(e);const s={},r=[];kf.forEach(c=>{const l=e[c];l!=null&&(s[c]=_F[c](l),r.push({name:c,type:ux[c]}))});const a=Kn.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(lt(l));if(c.match(/^u?int/))return Re(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 kn(i){const e=new Set;return i.forEach(t=>e.add(t)),Object.freeze(e)}const yF=kn("external public payable override".split(" ")),px="constant external internal payable private public pure view override",wF=kn(px.split(" ")),Ax="constructor error event fallback function receive struct",gx=kn(Ax.split(" ")),mx="calldata memory storage payable indexed",vF=kn(mx.split(" ")),CF=[Ax,mx,"tuple returns",px].join(" "),SF=kn(CF.split(" ")),IF={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},MF=new RegExp("^(\\s*)"),BF=new RegExp("^([0-9]+)"),TF=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),bx=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),xx=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 qs(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(MF);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=IF[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=ht(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(TF),o){if(c.text=o[1],r+=c.text.length,SF.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(xx)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match(BF),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 Ex(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 Jl(i,e){if(e.peekKeyword(gx)){const t=e.pop().text;if(t!==i)throw new Error(`expected ${i}, got ${t}`)}return e.popType("ID")}function hs(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 _x(i){let e=hs(i,wF);return Ex(e,kn("constant payable nonpayable".split(" "))),Ex(e,kn("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 us(i,e){return i.popParams().map(t=>Dt.from(t,e))}function yx(i){if(i.peekType("AT")){if(i.pop(),i.peekType("NUMBER"))return Re(i.pop().text);throw new Error("invalid gas")}return null}function wr(i){if(i.length)throw new Error(`unexpected tokens at offset ${i.offset}: ${i.toString()}`)}const RF=new RegExp(/^(.*)\[([0-9]*)\]$/);function wx(i){const e=i.match(xx);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 Ht={},Hn=Symbol.for("_ethers_internal"),vx="_ParamTypeInternal",Cx="_ErrorInternal",Sx="_EventInternal",Ix="_ConstructorInternal",Mx="_FallbackInternal",Bx="_FunctionInternal",Tx="_StructInternal";class Dt{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,n,s,r,a,o,c){if(Il(e,Ht,"ParamType"),Object.defineProperty(this,Hn,{value:vx}),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("");Xe(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(Dt.isParamType(e))return e;if(typeof e=="string")try{return Dt.from(qs(e),t)}catch{V(!1,"invalid param type","obj",e)}else if(e instanceof ai){let o="",c="",l=null;hs(e,kn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",l=e.popParams().map(g=>Dt.from(g)),o=`tuple(${l.map(g=>g.format()).join(",")})`):(o=wx(e.popType("TYPE")),c=o);let h=null,u=null;for(;e.length&&e.peekType("BRACKET");){const g=e.pop();h=new Dt(Ht,"",o,c,null,l,u,h),u=g.value,o+=g.text,c="array",l=null}let d=null;if(hs(e,vF).has("indexed")){if(!t)throw new Error("");d=!0}const m=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Dt(Ht,m,o,c,d,l,u,h)}const n=e.name;V(!n||typeof n=="string"&&n.match(bx),"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(RF);if(a){const o=parseInt(a[2]||"-1"),c=Dt.from({type:a[1],components:e.components});return new Dt(Ht,n||"",r,"array",s,null,o,c)}if(r==="tuple"||r.startsWith("tuple(")||r.startsWith("(")){const o=e.components!=null?e.components.map(l=>Dt.from(l)):null;return new Dt(Ht,n||"",r,"tuple",s,o,null,null)}return r=wx(e.type),new Dt(Ht,n||"",r,r,s,null,null,null)}static isParamType(e){return e&&e[Hn]===vx}}class vr{type;inputs;constructor(e,t,n){Il(e,Ht,"Fragment"),n=Object.freeze(n.slice()),Xe(this,{type:t,inputs:n})}static from(e){if(typeof e=="string"){try{vr.from(JSON.parse(e))}catch{}return vr.from(qs(e))}if(e instanceof ai)switch(e.peekKeyword(gx)){case"constructor":return ds.from(e);case"error":return zn.from(e);case"event":return Ui.from(e);case"fallback":case"receive":return fs.from(e);case"function":return Oi.from(e);case"struct":return Cr.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return ds.from(e);case"error":return zn.from(e);case"event":return Ui.from(e);case"fallback":case"receive":return fs.from(e);case"function":return Oi.from(e);case"struct":return Cr.from(e)}pe(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}V(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return ds.isFragment(e)}static isError(e){return zn.isFragment(e)}static isEvent(e){return Ui.isFragment(e)}static isFunction(e){return Oi.isFragment(e)}static isStruct(e){return Cr.isFragment(e)}}class Zl extends vr{name;constructor(e,t,n,s){super(e,t,s),V(typeof n=="string"&&n.match(bx),"invalid identifier","name",n),s=Object.freeze(s.slice()),Xe(this,{name:n})}}function Xo(i,e){return"("+e.map(t=>t.format(i)).join(i==="full"?", ":",")+")"}class zn extends Zl{constructor(e,t,n){super(e,"error",t,n),Object.defineProperty(this,Hn,{value:Cx})}get selector(){return Er(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+Xo(e,this.inputs)),t.join(" ")}static from(e){if(zn.isFragment(e))return e;if(typeof e=="string")return zn.from(qs(e));if(e instanceof ai){const t=Jl("error",e),n=us(e);return wr(e),new zn(Ht,t,n)}return new zn(Ht,e.name,e.inputs?e.inputs.map(Dt.from):[])}static isFragment(e){return e&&e[Hn]===Cx}}class Ui extends Zl{anonymous;constructor(e,t,n,s){super(e,"event",t,n),Object.defineProperty(this,Hn,{value:Sx}),Xe(this,{anonymous:s})}get topicHash(){return Er(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+Xo(e,this.inputs)),e!=="sighash"&&this.anonymous&&t.push("anonymous"),t.join(" ")}static getTopicHash(e,t){return t=(t||[]).map(s=>Dt.from(s)),new Ui(Ht,e,t,!1).topicHash}static from(e){if(Ui.isFragment(e))return e;if(typeof e=="string")try{return Ui.from(qs(e))}catch{V(!1,"invalid event fragment","obj",e)}else if(e instanceof ai){const t=Jl("event",e),n=us(e,!0),s=!!hs(e,kn(["anonymous"])).has("anonymous");return wr(e),new Ui(Ht,t,n,s)}return new Ui(Ht,e.name,e.inputs?e.inputs.map(t=>Dt.from(t,!0)):[],!!e.anonymous)}static isFragment(e){return e&&e[Hn]===Sx}}class ds extends vr{payable;gas;constructor(e,t,n,s,r){super(e,t,n),Object.defineProperty(this,Hn,{value:Ix}),Xe(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${Xo(e,this.inputs)}`];return this.payable&&t.push("payable"),this.gas!=null&&t.push(`@${this.gas.toString()}`),t.join(" ")}static from(e){if(ds.isFragment(e))return e;if(typeof e=="string")try{return ds.from(qs(e))}catch{V(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof ai){hs(e,kn(["constructor"]));const t=us(e),n=!!hs(e,yF).has("payable"),s=yx(e);return wr(e),new ds(Ht,"constructor",t,n,s)}return new ds(Ht,"constructor",e.inputs?e.inputs.map(Dt.from):[],!!e.payable,e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[Hn]===Ix}}class fs extends vr{payable;constructor(e,t,n){super(e,"fallback",t),Object.defineProperty(this,Hn,{value:Mx}),Xe(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(fs.isFragment(e))return e;if(typeof e=="string")try{return fs.from(qs(e))}catch{V(!1,"invalid fallback fragment","obj",e)}else if(e instanceof ai){const t=e.toString(),n=e.peekKeyword(kn(["fallback","receive"]));if(V(n,"type must be fallback or receive","obj",t),e.popKeyword(kn(["fallback","receive"]))==="receive"){const o=us(e);return V(o.length===0,"receive cannot have arguments","obj.inputs",o),hs(e,kn(["payable"])),wr(e),new fs(Ht,[],!0)}let r=us(e);r.length?V(r.length===1&&r[0].type==="bytes","invalid fallback inputs","obj.inputs",r.map(o=>o.format("minimal")).join(", ")):r=[Dt.from("bytes")];const a=_x(e);if(V(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),hs(e,kn(["returns"])).has("returns")){const o=us(e);V(o.length===1&&o[0].type==="bytes","invalid fallback outputs","obj.outputs",o.map(c=>c.format("minimal")).join(", "))}return wr(e),new fs(Ht,r,a==="payable")}if(e.type==="receive")return new fs(Ht,[],!0);if(e.type==="fallback"){const t=[Dt.from("bytes")],n=e.stateMutability==="payable";return new fs(Ht,t,n)}V(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[Hn]===Mx}}class Oi extends Zl{constant;outputs;stateMutability;payable;gas;constructor(e,t,n,s,r,a){super(e,"function",t,s),Object.defineProperty(this,Hn,{value:Bx}),r=Object.freeze(r.slice()),Xe(this,{constant:n==="view"||n==="pure",gas:a,outputs:r,payable:n==="payable",stateMutability:n})}get selector(){return Er(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+Xo(e,this.inputs)),e!=="sighash"&&(this.stateMutability!=="nonpayable"&&t.push(this.stateMutability),this.outputs&&this.outputs.length&&(t.push("returns"),t.push(Xo(e,this.outputs))),this.gas!=null&&t.push(`@${this.gas.toString()}`)),t.join(" ")}static getSelector(e,t){return t=(t||[]).map(s=>Dt.from(s)),new Oi(Ht,e,"view",t,[],null).selector}static from(e){if(Oi.isFragment(e))return e;if(typeof e=="string")try{return Oi.from(qs(e))}catch{V(!1,"invalid function fragment","obj",e)}else if(e instanceof ai){const n=Jl("function",e),s=us(e),r=_x(e);let a=[];hs(e,kn(["returns"])).has("returns")&&(a=us(e));const o=yx(e);return wr(e),new Oi(Ht,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 Oi(Ht,e.name,t,e.inputs?e.inputs.map(Dt.from):[],e.outputs?e.outputs.map(Dt.from):[],e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[Hn]===Bx}}class Cr extends Zl{constructor(e,t,n){super(e,"struct",t,n),Object.defineProperty(this,Hn,{value:Tx})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Cr.from(qs(e))}catch{V(!1,"invalid struct fragment","obj",e)}else if(e instanceof ai){const t=Jl("struct",e),n=us(e);return wr(e),new Cr(Ht,t,n)}return new Cr(Ht,e.name,e.inputs?e.inputs.map(Dt.from):[])}static isFragment(e){return e&&e[Hn]===Tx}}const Ci=new Map;Ci.set(0,"GENERIC_PANIC"),Ci.set(1,"ASSERT_FALSE"),Ci.set(17,"OVERFLOW"),Ci.set(18,"DIVIDE_BY_ZERO"),Ci.set(33,"ENUM_RANGE_ERROR"),Ci.set(34,"BAD_STORAGE_DATA"),Ci.set(49,"STACK_UNDERFLOW"),Ci.set(50,"ARRAY_RANGE_ERROR"),Ci.set(65,"OUT_OF_MEMORY"),Ci.set(81,"UNINITIALIZED_FUNCTION_CALL");const NF=new RegExp(/^bytes([0-9]*)$/),FF=new RegExp(/^(u?int)([0-9]*)$/);let Of=null,Rx=1024;function DF(i,e,t,n){let s="missing revert data",r=null;const a=null;let o=null;if(t){s="execution reverted";const l=lt(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 ${Ci.get(h)||"UNKNOWN"}(${h})`,s+=`: ${r}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?Ct(e.to):null,data:e.data||"0x"};return e.from&&(c.from=Ct(e.from)),Qt(s,"CALL_EXCEPTION",{action:i,data:t,reason:r,transaction:c,invocation:a,revert:o})}class Pa{#e(e){if(e.isArray())return new $R(this.#e(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new Ul(e.components.map(n=>this.#e(n)),e.name);switch(e.baseType){case"address":return new JR(e.name);case"bool":return new eN(e.name);case"string":return new lN(e.name);case"bytes":return new tN(e.name);case"":return new sN(e.name)}let t=e.type.match(FF);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 cN(n/8,t[1]==="int",e.name)}if(t=e.type.match(NF),t){let n=parseInt(t[1]);return V(n!==0&&n<=32,"invalid bytes length","param",e),new nN(n,e.name)}V(!1,"invalid type","type",e.type)}getDefaultValue(e){const t=e.map(s=>this.#e(Dt.from(s)));return new Ul(t,"_").defaultValue()}encode(e,t){f0(t.length,e.length,"types/values length mismatch");const n=e.map(a=>this.#e(Dt.from(a))),s=new Ul(n,"_"),r=new tf;return s.encode(r,t),r.data}decode(e,t,n){const s=e.map(a=>this.#e(Dt.from(a)));return new Ul(s,"_").decode(new nf(t,n,Rx))}static _setDefaultMaxInflation(e){V(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Rx=e}static defaultAbiCoder(){return Of==null&&(Of=new Pa),Of}static getBuiltinCallException(e,t,n){return DF(e,t,n,Pa.defaultAbiCoder())}}class LF{fragment;name;signature;topic;args;constructor(e,t,n){const s=e.name,r=e.format();Xe(this,{fragment:e,name:s,signature:r,topic:t,args:n})}}class PF{fragment;name;args;signature;selector;value;constructor(e,t,n,s){const r=e.name,a=e.format();Xe(this,{fragment:e,name:r,args:n,signature:a,selector:t,value:s})}}class kF{fragment;name;args;signature;selector;constructor(e,t,n){const s=e.name,r=e.format();Xe(this,{fragment:e,name:s,args:n,signature:r,selector:t})}}class Nx{hash;_isIndexed;static isIndexed(e){return!!(e&&e._isIndexed)}constructor(e){Xe(this,{hash:e,_isIndexed:!0})}}const Fx={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"},Dx={"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&&Fx[i.toString()]&&(e=Fx[i.toString()]),`reverted with panic code 0x${i.toString(16)} (${e})`}}};class Sr{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(vr.from(a))}catch(o){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,o.message)}Xe(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}Xe(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||Xe(this,{deploy:ds.from("constructor()")}),Xe(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 Pa.defaultAbiCoder()}#s(e,t,n){if(Ft(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;Wt.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(Wt.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(Oi.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(Ft(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(Wt.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(Ui.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(Ft(e)){const s=e.toLowerCase();if(Dx[s])return zn.from(Dx[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"?zn.from("error Error(string)"):e==="Panic"?zn.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=zn.from(e).format(),e==="Error(string)")return zn.from("error Error(string)");if(e==="Panic(uint256)")return zn.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(Vt(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);V(n,"unknown error","fragment",e),e=n}return Ut([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(Vt(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);V(n,"unknown function","fragment",e),e=n}return Ut([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=Dn(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=lt(e,"data"),s=Pa.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"?Er(a):r.type==="bytes"?$t(Ce(a)):(r.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":r.type.match(/^u?int/)?a=Os(a):r.type.match(/^bytes/)?a=AT(a,32):r.type==="address"&&this.#i.encode(["address"],[a]),ns(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(Er(c));else if(a.type==="bytes")n.push($t(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(Ft(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,m)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(s.push(Dt.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,Ut(n)):null,c=this.#i.decode(r,t,!0),l=[],h=[];let u=0,d=0;return e.inputs.forEach((f,m)=>{let g=null;if(f.indexed)if(o==null)g=new Nx(null);else if(a[m])g=new Nx(o[d++]);else try{g=o[d++]}catch(A){g=A}else try{g=c[u++]}catch(A){g=A}l.push(g),h.push(f.name||null)}),rs.fromItems(l,h)}parseTransaction(e){const t=lt(e.data,"tx.data"),n=Re(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 PF(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 LF(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=Ce(e),n=this.getError(Vt(t,0,4));if(!n)return null;const s=this.#i.decode(n.inputs,Vt(t,4));return new kF(n,n.selector,s)}static from(e){return e instanceof Sr?e:typeof e=="string"?new Sr(JSON.parse(e)):typeof e.formatJson=="function"?new Sr(e.formatJson()):typeof e.format=="function"?new Sr(e.format("json")):new Sr(e)}}const Lx=BigInt(0);function ka(i){return i??null}function Xt(i){return i==null?null:i.toString()}class Px{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,t,n){Xe(this,{gasPrice:ka(e),maxFeePerGas:ka(t),maxPriorityFeePerGas:ka(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:Xt(e),maxFeePerGas:Xt(t),maxPriorityFeePerGas:Xt(n)}}}function $l(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]=Re(i[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in i)||i[s]==null||(e[s]=ht(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=>Yd(s)?Ce(s):Object.assign({},s))),e}class UF{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 Jo(n,t):n),Xe(this,{provider:t,hash:ka(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:ka(e.prevRandao),extraData:e.extraData,baseFeePerGas:ka(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:m,timestamp:g,transactions:A}=this;return{_type:"Block",baseFeePerGas:Xt(e),difficulty:Xt(t),extraData:n,gasLimit:Xt(s),gasUsed:Xt(r),blobGasUsed:Xt(this.blobGasUsed),excessBlobGas:Xt(this.excessBlobGas),hash:a,miner:o,prevRandao:c,nonce:l,number:h,parentHash:u,timestamp:g,parentBeaconBlockRoot:d,stateRoot:f,receiptsRoot:m,transactions:A}}[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 OF(this)}}class Yo{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(e,t){this.provider=t;const n=Object.freeze(e.topics.slice());Xe(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 QF(this)}}class kx{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 Yo(s,t)));let n=Lx;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Xe(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:Xt(this.cumulativeGasUsed),from:t,gasPrice:Xt(this.gasPrice),blobGasUsed:Xt(this.blobGasUsed),blobGasPrice:Xt(this.blobGasPrice),gasUsed:Xt(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 Ox(this)}reorderedEvent(e){return pe(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),Ux(this,e)}}class Jo{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:Xt(this.chainId),data:l,from:o,gasLimit:Xt(this.gasLimit),gasPrice:Xt(this.gasPrice),hash:s,maxFeePerGas:Xt(this.maxFeePerGas),maxPriorityFeePerGas:Xt(this.maxPriorityFeePerGas),maxFeePerBlobGas:Xt(this.maxFeePerBlobGas),nonce:c,signature:h,to:a,index:n,type:r,value:Xt(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 Fn({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 Fn({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(f<this.nonce){r=d;return}if(o)return null;const m=await this.getTransaction();if(!(m&&m.blockNumber!=null))for(a===-1&&(a=r-3,a<this.#e&&(a=this.#e));a<=d;){if(o)return null;const g=await this.provider.getBlock(a,!0);if(g==null)return;for(const A of g)if(A===this.hash)return;for(let A=0;A<g.length;A++){const p=await g.getTransaction(A);if(p.from===this.from&&p.nonce===this.nonce){if(o)return null;const y=await this.provider.getTransactionReceipt(p.hash);if(y==null||d-y.blockNumber+1<n)return;let b="replaced";p.data===this.data&&p.to===this.to&&p.value===this.value?b="repriced":p.data==="0x"&&p.from===p.to&&p.value===Lx&&(b="cancelled"),pe(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:b==="replaced"||b==="cancelled",reason:b,replacement:p.replaceableTransaction(r),hash:p.hash,receipt:y})}}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 m=[],g=()=>{m.forEach(p=>p())};if(m.push(()=>{o=!0}),s>0){const p=setTimeout(()=>{g(),f(Qt("wait for transaction timeout","TIMEOUT"))},s);m.push(()=>{clearTimeout(p)})}const A=async p=>{if(await p.confirmations()>=n){g();try{d(l(p))}catch(y){f(y)}}};if(m.push(()=>{this.provider.off(this.hash,A)}),this.provider.on(this.hash,A),r>=0){const p=async()=>{try{await c()}catch(y){if(_n(y,"TRANSACTION_REPLACED")){g(),f(y);return}}o||this.provider.once("block",p)};m.push(()=>{this.provider.off("block",p)}),this.provider.once("block",p)}})}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()"}),Ox(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()"}),Ux(this,e)}replaceableTransaction(e){V(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new Jo(this,this.provider);return t.#e=e,t}}function OF(i){return{orphan:"drop-block",hash:i.hash,number:i.number}}function Ux(i,e){return{orphan:"reorder-transaction",tx:i,other:e}}function Ox(i){return{orphan:"drop-transaction",tx:i}}function QF(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 Qf extends Yo{interface;fragment;args;constructor(e,t,n){super(e,e.provider);const s=t.decodeEventLog(n,e.data,e.topics);Xe(this,{args:s,fragment:n,interface:t})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class Qx extends Yo{error;constructor(e,t){super(e,e.provider),Xe(this,{error:t})}}class GF extends kx{#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 Qf(e,this.#e,t)}catch(n){return new Qx(e,n)}return e})}}class Gf extends Jo{#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 GF(this.#e,this.provider,n)}}class Gx extends _0{log;constructor(e,t,n,s){super(e,t,n),Xe(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 HF extends Gx{constructor(e,t,n,s,r){super(e,t,n,new Qf(r,e.interface,s));const a=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Xe(this,{args:a,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const Hx=BigInt(0);function zx(i){return i&&typeof i.call=="function"}function Vx(i){return i&&typeof i.estimateGas=="function"}function eh(i){return i&&typeof i.resolveName=="function"}function Wx(i){return i&&typeof i.sendTransaction=="function"}function qx(i){if(i!=null){if(eh(i))return i;if(i.provider)return i.provider}}class zF{#e;fragment;constructor(e,t,n){if(Xe(this,{fragment:t}),t.inputs.length<n.length)throw new Error("too many arguments");const s=Ir(e.runner,"resolveName"),r=eh(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=>Pn(d,r))):Pn(u,r):u)));return e.interface.encodeFilterTopics(t,a)})()}getTopicFilter(){return this.#e}}function Ir(i,e){return i==null?null:typeof i[e]=="function"?i:i.provider&&typeof i.provider[e]=="function"?i.provider:null}function Mr(i){return i==null?null:i.provider||null}async function Kx(i,e){const t=Wt.dereference(i,"overrides");V(typeof t=="object","invalid overrides parameter","overrides",i);const n=$l(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 VF(i,e,t){const n=Ir(i,"resolveName"),s=eh(n)?n:null;return await Promise.all(e.map((r,a)=>r.walkAsync(t[a],(o,c)=>(c=Wt.dereference(c,o),o==="address"?Pn(c,s):c))))}function WF(i){const e=async function(a){const o=await Kx(a,["data"]);o.to=await i.getAddress(),o.from&&(o.from=await Pn(o.from,qx(i.runner)));const c=i.interface,l=Re(o.value||Hx,"overrides.value")===Hx,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=Ir(i.runner,"call");pe(zx(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 Xd(l)&&l.data?i.interface.makeError(l.data,c):l}},n=async function(a){const o=i.runner;pe(Wx(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),l=Mr(i.runner);return new Gf(i.interface,l,c)},s=async function(a){const o=Ir(i.runner,"estimateGas");return pe(Vx(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 Xe(r,{_contract:i,estimateGas:s,populateTransaction:e,send:n,staticCall:t}),r}function qF(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 Kx(l.pop()),u.from&&(u.from=await Pn(u.from,qx(i.runner)))),h.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await VF(i.runner,h.inputs,l);return Object.assign({},u,await Fn({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(Wx(h),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const u=await h.sendTransaction(await n(...l)),d=Mr(i.runner);return new Gf(i.interface,d,u)},a=async function(...l){const h=Ir(i.runner,"estimateGas");return pe(Vx(h),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await h.estimateGas(await n(...l))},o=async function(...l){const h=Ir(i.runner,"call");pe(zx(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(m){throw Xd(m)&&m.data?i.interface.makeError(m.data,u):m}const f=t(...l);return i.interface.decodeFunctionResult(f,d)},c=async(...l)=>t(...l).constant?await s(...l):await r(...l);return Xe(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 KF(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 zF(i,t(...s),s)};return Xe(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 th=Symbol.for("_ethersInternal_contract"),jx=new WeakMap;function jF(i,e){jx.set(i[th],e)}function jn(i){return jx.get(i[th])}function XF(i){return i&&typeof i=="object"&&"getTopicFilter"in i&&typeof i.getTopicFilter=="function"&&i.fragment}async function Hf(i,e){let t,n=null;if(Array.isArray(e)){const r=function(a){if(Ft(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"?Ft(e,32)?t=[e]:(n=i.interface.getEvent(e),V(n,"unknown fragment","event",e),t=[n.topicHash]):XF(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 Zo(i,e){const{subs:t}=jn(i);return t.get((await Hf(i,e)).tag)||null}async function Xx(i,e,t){const n=Mr(i.runner);pe(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:r,topics:a}=await Hf(i,t),{addr:o,subs:c}=jn(i);let l=c.get(r);if(!l){const u={address:o||i,topics:a},d=A=>{let p=s;if(p==null)try{p=i.interface.getEvent(A.topics[0])}catch{}if(p){const y=p,b=s?i.interface.decodeEventLog(s,A.data,A.topics):[];Vf(i,t,b,_=>new HF(i,_,t,y,A))}else Vf(i,t,[],y=>new Gx(i,y,t,A))};let f=[];l={tag:r,listeners:[],start:()=>{f.length||f.push(n.on(u,d))},stop:async()=>{if(f.length==0)return;let A=f;f=[],await Promise.all(A),n.off(u,d)}},c.set(r,l)}return l}let zf=Promise.resolve();async function YF(i,e,t,n){await zf;const s=await Zo(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(),jn(i).subs.delete(s.tag)),r>0}async function Vf(i,e,t,n){try{await zf}catch{}const s=YF(i,e,t,n);return zf=s,await s}const nh=["then"];class $o{target;interface;runner;filters;[th];fallback;constructor(e,t,n,s){V(typeof e=="string"||Mb(e),"invalid value for Contract target","target",e),n==null&&(n=null);const r=Sr.from(t);Xe(this,{target:e,runner:n,interface:r}),Object.defineProperty(this,th,{value:{}});let a,o=null,c=null;if(s){const u=Mr(n);c=new Gf(this.interface,u,s)}let l=new Map;if(typeof e=="string")if(Ft(e))o=e,a=Promise.resolve(e);else{const u=Ir(n,"resolveName");if(!eh(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 jn(this).addr=d,d})}else a=e.getAddress().then(u=>{if(u==null)throw new Error("TODO");return jn(this).addr=u,u});jF(this,{addrPromise:a,addr:o,deployTx:c,subs:l});const h=new Proxy({},{get:(u,d,f)=>{if(typeof d=="symbol"||nh.indexOf(d)>=0)return Reflect.get(u,d,f);try{return this.getEvent(d)}catch(m){if(!_n(m,"INVALID_ARGUMENT")||m.argument!=="key")throw m}},has:(u,d)=>nh.indexOf(d)>=0?Reflect.has(u,d):Reflect.has(u,d)||this.interface.hasEvent(String(d))});return Xe(this,{filters:h}),Xe(this,{fallback:r.receive||r.fallback?WF(this):null}),new Proxy(this,{get:(u,d,f)=>{if(typeof d=="symbol"||d in u||nh.indexOf(d)>=0)return Reflect.get(u,d,f);try{return u.getFunction(d)}catch(m){if(!_n(m,"INVALID_ARGUMENT")||m.argument!=="key")throw m}},has:(u,d)=>typeof d=="symbol"||d in u||nh.indexOf(d)>=0?Reflect.has(u,d):u.interface.hasFunction(d)})}connect(e){return new $o(this.target,this.interface,e)}attach(e){return new $o(e,this.interface,this.runner)}async getAddress(){return await jn(this).addrPromise}async getDeployedCode(){const e=Mr(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=Mr(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 jn(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),qF(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),KF(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}=jn(this),a=s||await r,{fragment:o,topics:c}=await Hf(this,e),l={address:a,topics:c,fromBlock:t,toBlock:n},h=Mr(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 Qf(u,this.interface,d)}catch(f){return new Qx(u,f)}return new Yo(u,h)})}async on(e,t){const n=await Xx(this,"on",e);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(e,t){const n=await Xx(this,"once",e);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(e,...t){return await Vf(this,e,t,null)}async listenerCount(e){if(e){const s=await Zo(this,e);return s?s.listeners.length:0}const{subs:t}=jn(this);let n=0;for(const{listeners:s}of t.values())n+=s.length;return n}async listeners(e){if(e){const s=await Zo(this,e);return s?s.listeners.map(({listener:r})=>r):[]}const{subs:t}=jn(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 Zo(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(),jn(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const t=await Zo(this,e);if(!t)return this;t.stop(),jn(this).subs.delete(t.tag)}else{const{subs:t}=jn(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 $o{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 JF(){return $o}class Ua extends JF(){}function Wf(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 ZF{name;constructor(e){Xe(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 Yx=new RegExp("^(ipfs)://(.*)$","i"),Jx=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Yx,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class Oa{provider;address;name;#e;#t;constructor(e,t,n){Xe(this,{provider:e,address:t,name:n}),this.#e=null,this.#t=new Ua(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(_n(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(Pf(this.name));let s=null;await this.supportsWildcard()&&(s=n.getFunction(e),pe(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[AF(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(!_n(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===Ho?null:r}catch(r){if(_n(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(Ft(a,20))return Ct(a)}let t=null;for(const r of this.provider.plugins)if(r instanceof ZF&&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}://${bT("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<Jx.length;n++){const s=t.match(Jx[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=Wf(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 Ua(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 g=await h.ownerOf(l);if(o!==g)return e.push({type:"!owner",value:g}),{url:null,linkage:e};e.push({type:"owner",value:g})}else if(r==="erc1155"){const g=await h.balanceOf(o,l);if(!g)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:g.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}",Os(l,32).substring(2)),e.push({type:"metadata-url-expanded",value:u})),u.match(/^ipfs:/i)&&(u=Wf(u)),e.push({type:"metadata-url",value:u});let d={};const f=await new Pi(u).send();f.assertOk();try{d=f.bodyJson}catch{try{e.push({type:"!metadata",value:f.bodyText})}catch{const p=f.body;return p&&e.push({type:"!metadata",value:Ce(p)}),{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 m=d.image;if(typeof m!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!m.match(/^(https:\/\/|data:)/i)){if(m.match(Yx)==null)return e.push({type:"!imageUrl-ipfs",value:m}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:m}),m=Wf(m)}return e.push({type:"url",value:m}),{linkage:e,url:m}}}}}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 Oa.getEnsAddress(e);try{const r=await new Ua(n,["function resolver(bytes32) view returns (address)"],e).resolver(Pf(t),{enableCcipRead:!0});return r===Ho?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 Oa.#i(e,n);if(s!=null){const r=new Oa(e,s,t);return n!==t&&!await r.supportsWildcard()?null:r}n=n.split(".").slice(1).join(".")}}}const Zx=BigInt(0);function mt(i,e){return(function(t){return t==null?e:i(t)})}function ec(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 tc(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 $F(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 Qa(i){return V(Ft(i,!0),"invalid data","value",i),i}function yn(i){return V(Ft(i,32),"invalid hash","value",i),i}const eD=tc({address:Ct,blockHash:yn,blockNumber:ht,data:Qa,index:ht,removed:mt($F,!1),topics:ec(yn),transactionHash:yn,transactionIndex:ht},{index:["logIndex"]});function tD(i){return eD(i)}const nD=tc({hash:mt(yn),parentHash:yn,parentBeaconBlockRoot:mt(yn,null),number:ht,timestamp:ht,nonce:mt(Qa),difficulty:Re,gasLimit:Re,gasUsed:Re,stateRoot:mt(yn,null),receiptsRoot:mt(yn,null),blobGasUsed:mt(Re,null),excessBlobGas:mt(Re,null),miner:mt(Ct),prevRandao:mt(yn,null),extraData:Qa,baseFeePerGas:mt(Re)},{prevRandao:["mixHash"]});function iD(i){const e=nD(i);return e.transactions=i.transactions.map(t=>typeof t=="string"?t:$x(t)),e}const sD=tc({transactionIndex:ht,blockNumber:ht,transactionHash:yn,address:Ct,topics:ec(yn),data:Qa,index:ht,blockHash:yn},{index:["logIndex"]});function rD(i){return sD(i)}const aD=tc({to:mt(Ct,null),from:mt(Ct,null),contractAddress:mt(Ct,null),index:ht,root:mt(Ce),gasUsed:Re,blobGasUsed:mt(Re,null),logsBloom:mt(Qa),blockHash:yn,hash:yn,logs:ec(rD),blockNumber:ht,cumulativeGasUsed:Re,effectiveGasPrice:mt(Re),blobGasPrice:mt(Re,null),status:mt(ht),type:mt(ht,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function oD(i){return aD(i)}function $x(i){i.to&&Re(i.to)===Zx&&(i.to="0x0000000000000000000000000000000000000000");const e=tc({hash:yn,index:mt(ht,void 0),type:t=>t==="0x"||t==null?0:ht(t),accessList:mt(br,null),blobVersionedHashes:mt(ec(yn,!0),null),authorizationList:mt(ec(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:Ct(t.address),chainId:Re(t.chainId),nonce:Re(t.nonce),signature:Gt.from(n)}},!1),null),blockHash:mt(yn,null),blockNumber:mt(ht,null),transactionIndex:mt(ht,null),from:Ct,gasPrice:mt(Re),maxPriorityFeePerGas:mt(Re),maxFeePerGas:mt(Re),maxFeePerBlobGas:mt(Re,null),gasLimit:Re,to:mt(Ct,null),value:Re,nonce:ht,data:Qa,creates:mt(Ct,null),chainId:mt(Re,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(i);if(e.to==null&&e.creates==null&&(e.creates=YR(e)),(i.type===1||i.type===2)&&i.accessList==null&&(e.accessList=[]),i.signature?e.signature=Gt.from(i.signature):e.signature=Gt.from(i),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&Re(e.blockHash)===Zx&&(e.blockHash=null),e}const cD="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class nc{name;constructor(e){Xe(this,{name:e})}clone(){return new nc(this.name)}}class ih extends nc{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),Xe(this,n)}clone(){return new ih(this.effectiveBlock,this)}}class sh extends nc{address;targetNetwork;constructor(e,t){super("org.ethers.plugins.network.Ens"),Xe(this,{address:e||cD,targetNetwork:t??1})}clone(){return new sh(this.address,this.targetNetwork)}}class lD extends nc{#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 qf=new Map;class Xn{#e;#t;#n;constructor(e,t){this.#e=e,this.#t=Re(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=Re(e,"chainId")}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Re(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Re(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Re(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 Xn(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 ih;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(hD(),e==null)return Xn.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=qf.get(e);if(t)return t();if(typeof e=="bigint")return new Xn("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 Xn(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new sh(e.ensAddress,e.ensNetwork)),t}V(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const n=qf.get(e);n&&V(!1,`conflicting network for ${JSON.stringify(n.name)}`,"nameOrChainId",e),qf.set(e,t)}}function eE(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 tE(i){return new lD(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:eE(o.maxFee,9),maxPriorityFeePerGas:eE(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 nE=!1;function hD(){if(nE)return;nE=!0;function i(e,t,n){const s=function(){const r=new Xn(e,t);return n.ensNetwork!=null&&r.attachPlugin(new sh(null,n.ensNetwork)),r.attachPlugin(new ih),(n.plugins||[]).forEach(a=>{r.attachPlugin(a)}),r};Xn.register(e,s),Xn.register(t,s),n.altNames&&n.altNames.forEach(r=>{Xn.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:[tE("https://gasstation.polygon.technology/v2")]}),i("matic-amoy",80002,{}),i("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[tE("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 Kf(i){return JSON.parse(JSON.stringify(i))}class uD{#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 jf{#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 dD extends jf{#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 fD extends jf{#e;constructor(e,t){super(e),this.#e=Kf(t)}async _poll(e,t){throw new Error("@TODO")}}class pD extends jf{#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 Xf{#e;#t;#n;#i;#s;constructor(e,t){this.#e=e,this.#t=Kf(t),this.#n=this.#a.bind(this),this.#i=!1,this.#s=-2}async#a(e){if(this.#s===-2)return;const t=Kf(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 AD=BigInt(2),gD=10;function rh(i){return i&&typeof i.then=="function"}function ah(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 iE{name;constructor(e){Xe(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function mD(i){return JSON.parse(JSON.stringify(i))}function Yf(i){return i=Array.from(new Set(i).values()),i.sort(),i}async function Jf(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(Ft(i,32)){const t=i.toLowerCase();return{type:"transaction",tag:ah("tx",{hash:t}),hash:t}}if(i.orphan){const t=i;return{type:"orphan",tag:ah("orphan",t),filter:mD(t)}}if(i.address||i.topics){const t=i,n={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?Yf(s.map(r=>r.toLowerCase())):s.toLowerCase())};if(t.address){const s=[],r=[],a=o=>{Ft(o)?s.push(o):r.push((async()=>{s.push(await Pn(o,e))})())};Array.isArray(t.address)?t.address.forEach(a):a(t.address),r.length&&await Promise.all(r),n.address=Yf(s.map(o=>o.toLowerCase()))}return{filter:n,tag:ah("event",n),type:"event"}}V(!1,"unknown ProviderEvent","event",i)}function Zf(){return new Date().getTime()}const bD={cacheTimeout:250,pollingInterval:4e3};class xD{#e;#t;#n;#i;#s;#a;#r;#o;#f;#l;#p;#A;constructor(e,t){if(this.#A=Object.assign({},bD,t||{}),e==="any")this.#a=!0,this.#s=null;else if(e){const n=Xn.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=ah(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 Pi(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 UF(iD(e),this)}_wrapLog(e,t){return new Yo(tD(e),this)}_wrapTransactionReceipt(e,t){return new kx(oD(e),this)}_wrapTransactionResponse(e,t){return new Jo($x(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=ht(await this.#c({method:"getBlockNumber"}),"%response");return this.#o>=0&&(this.#o=e),e}_getAddress(e){return Pn(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(Ft(e))return Ft(e,32)?e:yi(e);if(typeof e=="bigint"&&(e=ht(e,"blockTag")),typeof e=="number")return e>=0?yi(e):this.#o>=0?yi(this.#o+e):this.getBlockNumber().then(t=>yi(t+e));V(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?Yf(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=$l(e),n=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const r=Pn(t[s],this);rh(r)?n.push((async function(){t[s]=await r})()):t[s]=r}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);rh(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 Fn({_block:this.#b("latest",!1),gasPrice:(async()=>{try{const h=await this.#c({method:"getGasPrice"});return Re(h,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const h=await this.#c({method:"getPriorityFee"});return Re(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*AD+c),new Px(r,o,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const s=new Pi(n.url),r=await n.processFunc(t,this,s);return new Px(r.gasPrice,r.maxFeePerGas,r.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return rh(t)&&(t=await t),Re(await this.#c({method:"estimateGas",transaction:t}),"%response")}async#h(e,t,n){pe(n<gD,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=$l(e);try{return Ce(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(r){if(!this.disableCcipRead&&Xd(r)&&r.data&&n>=0&&t==="latest"&&s.to!=null&&Vt(r.data,0,4)==="0x556f1830"){const a=r.data,o=await Pn(s.to,this);let c;try{c=vD(Vt(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:Ut([c.selector,wD([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 Fn({network:this.getNetwork(),value:e});return t}async call(e){const{tx:t,blockTag:n}=await Fn({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 Re(await this.#d({method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return ht(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=Re(t,"position");return Ce(await this.#d({method:"getStorage",position:s},e,n))}async broadcastTransaction(e){const{blockNumber:t,hash:n,network:s}=await Fn({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),r=vi.from(e);if(r.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(r,s).replaceableTransaction(t)}async#b(e,t){if(Ft(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 Fn({network:this.getNetwork(),params:this.#b(e,!!t)});return s==null?null:this._wrapBlock(s,n)}async getTransaction(e){const{network:t,params:n}=await Fn({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 Fn({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 Fn({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:e})});return t==null?null:Ce(t)}async getLogs(e){let t=this._getFilter(e);rh(t)&&(t=await t);const{network:n,params:s}=await Fn({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 Oa.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=Ct(e);const t=Pf(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await Oa.getEnsAddress(this),r=await new Ua(n,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(r==null||r===Ho)return null;const o=await new Ua(r,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(o)!==e?null:o}catch(n){if(_n(n,"BAD_DATA")&&n.value==="0x"||_n(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:Zf()})}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 iE(e.type);case"block":{const t=new uD(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new dD(this,e.type);case"event":return new Xf(this,e.filter);case"transaction":return new pD(this,e.hash);case"orphan":return new fD(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 Jf(e,this);return n.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(n=await Jf({orphan:"drop-log",log:t[0]},this)),this.#e.get(n.tag)||null}async#m(e){const t=await Jf(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 _0(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=Zf()-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=Zf(),setTimeout(e.func,t)}}}}function ED(i,e){try{const t=$f(i,e);if(t)return Bl(t)}catch{}return null}function $f(i,e){if(i==="0x")return null;try{const t=ht(Vt(i,e,e+32)),n=ht(Vt(i,t,t+32));return Vt(i,t+32,t+32+n)}catch{}return null}function sE(i){const e=Zt(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 _D(i){if(i.length%32===0)return i;const e=new Uint8Array(Math.ceil(i.length/32)*32);return e.set(i),e}const yD=new Uint8Array([]);function wD(i){const e=[];let t=0;for(let n=0;n<i.length;n++)e.push(yD),t+=32;for(let n=0;n<i.length;n++){const s=lt(i[n]);e[n]=sE(t),e.push(sE(s.length)),e.push(_D(s)),t+=32+Math.ceil(s.length/32)*32}return Ut(e)}const rE="0x0000000000000000000000000000000000000000000000000000000000000000";function vD(i){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};pe(Ca(i)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Vt(i,0,32);pe(Vt(t,0,12)===Vt(rE,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Vt(t,12);try{const n=[],s=ht(Vt(i,32,64)),r=ht(Vt(i,s,s+32)),a=Vt(i,s+32);for(let o=0;o<r;o++){const c=ED(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=$f(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(Vt(i,100,128)===Vt(rE,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Vt(i,96,100);try{const n=$f(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 Br(i,e){if(i.provider)return i.provider;pe(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function aE(i,e){let t=$l(e);if(t.to!=null&&(t.to=Pn(t.to,i)),t.from!=null){const n=t.from;t.from=Promise.all([i.getAddress(),Pn(n,i)]).then(([s,r])=>(V(s.toLowerCase()===r.toLowerCase(),"transaction from mismatch","tx.from",r),s))}else t.from=i.getAddress();return await Fn(t)}class CD{provider;constructor(e){Xe(this,{provider:e||null})}async getNonce(e){return Br(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await aE(this,e)}async populateTransaction(e){const t=Br(this,"populateTransaction"),n=await aE(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=Re(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 Fn(n)}async populateAuthorization(e){const t=Object.assign({},e);return t.chainId==null&&(t.chainId=(await Br(this,"getNetwork").getNetwork()).chainId),t.nonce==null&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return Br(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Br(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Br(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=Br(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const s=vi.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 SD(i){return JSON.parse(JSON.stringify(i))}class oE{#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(!_n(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 ID extends oE{#e;constructor(e,t){super(e),this.#e=SD(t)}_recover(e){return new Xf(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 MD extends oE{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const n of t)e.emit("pending",n)}}const BD="bigint,boolean,function,number,string,symbol".split(/,/g);function oh(i){if(i==null||BD.indexOf(typeof i)>=0||typeof i.getAddress=="function")return i;if(Array.isArray(i))return i.map(oh);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 TD(i){return new Promise(e=>{setTimeout(e,i)})}function Ga(i){return i&&i.toLowerCase()}function cE(i){return i&&typeof i.pollingInterval=="number"}const lE={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class ep extends CD{address;constructor(e,t){super(e),t=Ct(t),Xe(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=oh(e),n=[];if(t.from){const r=t.from;n.push((async()=>{const a=await Pn(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 Pn(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(_n(l,"CANCELLED")||_n(l,"BAD_DATA")||_n(l,"NETWORK_ERROR")||_n(l,"UNSUPPORTED_OPERATION")){l.info==null&&(l.info={}),l.info.sendTransactionHash=n,r(l);return}if(_n(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=oh(e);if(t.from){const s=await Pn(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"?is(e):e;return await this.provider.send("personal_sign",[Ce(t),this.address.toLowerCase()])}async signTypedData(e,t,n){const s=oh(n),r=await Kn.resolveNames(e,t,s,async a=>{const o=await Pn(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(Kn.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"?is(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ce(t)])}}class RD extends xD{#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({},lE,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=Xn.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&&Re(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=Xn.from(Re(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 Xn.from(Re(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 TD(1e3)}this.#o()})())}async _waitUntilReady(){if(this.#s!=null)return await this.#s.promise}_getSubscriber(e){return e.type==="pending"?new MD(this):e.type==="event"?this._getOption("polling")?new Xf(this,e.filter):new ID(this,e.filter):e.type==="orphan"&&e.filter.orphan==="drop-log"?new iE("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]=yi(Re(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=Fb(n);return{address:s.address,nonce:yi(s.nonce),chainId:yi(s.chainId),yParity:yi(s.signature.yParity),r:yi(s.signature.r),s:yi(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:[Ga(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Ga(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[Ga(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Ga(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(Ga):e.filter.address=Ga(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=tp(s),c=Pa.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(DD(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 ep(this,s[e])}const{accounts:n}=await Fn({network:this.getNetwork(),accounts:t});e=Ct(e);for(const s of n)if(Ct(s)===e)return new ep(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(t=>new ep(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 ND extends RD{#e;constructor(e,t){super(e,t);let n=this._getOption("pollingInterval");n==null&&(n=lE.pollingInterval),this.#e=n}_getSubscriber(e){const t=super._getSubscriber(e);return cE(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=>{cE(t)&&(t.pollingInterval=this.#e)})}}class FD extends ND{#e;constructor(e,t,n){e==null&&(e="http://localhost:8545"),super(t,n),typeof e=="string"?this.#e=new Pi(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 tp(i){if(i==null)return null;if(typeof i.message=="string"&&i.message.match(/revert/i)&&Ft(i.data))return{message:i.message,data:i.data};if(typeof i=="object"){for(const e in i){const t=tp(i[e]);if(t)return t}return null}if(typeof i=="string")try{return tp(JSON.parse(i))}catch{}return null}function np(i,e){if(i!=null){if(typeof i.message=="string"&&e.push(i.message),typeof i=="object")for(const t in i)np(i[t],e);if(typeof i=="string")try{return np(JSON.parse(i),e)}catch{}}}function DD(i){const e=[];return np(i,e),e}const LD=["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)","event Registered(uint256 indexed agentId, string agentURI, address indexed owner)","event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"],Tr={identityRegistry:"0x8004A818BFB912233c491871b3d84c89A494BD9e",reputationRegistry:"0x8004B663056A597Dffe9eCcC1965A193B7388713",validationRegistry:"0x8004Cb1BF31DAf7788923b405b754f57acEB4272"},Un={identityRegistry:"0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",reputationRegistry:"0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",validationRegistry:""},PD={1:Un,10:Un,56:Un,100:Un,137:Un,250:Un,324:Un,1284:Un,5e3:Un,8453:Un,42161:Un,42220:Un,43114:Un,59144:Un,534352:Un,97:Tr,11155111:Tr,84532:Tr,421614:Tr,11155420:Tr,80002:Tr,43113:Tr},kD={base:8453,"base-mainnet":8453,"base-sepolia":84532,ethereum:1,mainnet:1},UD={8453:"https://mainnet.base.org",84532:"https://sepolia.base.org",1:"https://eth.llamarpc.com"};async function ip(i,{rpcURL:e,registry:t}={}){if(!i)throw new Error("loadManifest: source required");if(i.startsWith("agent://"))return OD(i,{rpcURL:e,registryOverride:t});if(i.startsWith("ipfs://")||i.startsWith("ar://")){const n=ks(i),s=await sp(n);return ch(s,{baseURI:rp(n)})}if(i.startsWith("http")){const n=await sp(i);return ch(n,{baseURI:rp(i)})}throw new Error(`Unsupported manifest source: ${i}`)}async function OD(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=kD[s.toLowerCase()]||Number(s);if(!a)throw new Error(`Unknown chain: ${s}`);const o=PD[a],c=t||o?.identityRegistry;if(!c)throw new Error(`No registry deployed on chain ${a}. Pass registry= override.`);const l=new FD(e||UD[a]),h=new Ua(c,LD,l),u=BigInt(r),d=await h.tokenURI(u);if(!d)throw new Error(`Agent ${r} on chain ${a} has no URI`);const f=ks(d),m=await sp(f),g=ch(m,{baseURI:rp(f)});return g.id={...g.id,chain:s,chainId:a,registry:c,agentId:r},g}async function sp(i){let e;try{e=await fetch(i)}catch{e=await a0(i)}if(!e.ok)throw new Error(`Manifest fetch failed: ${i} (${e.status})`);return e.json()}function ch(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 rp(i){const e=i.lastIndexOf("/");return e>=0?i.slice(0,e+1):i}async function hE(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 ps extends Error{constructor(e,t,{status:n}={}){super(t),this.name="AgentResolveError",this.code=e,n!==void 0&&(this.status=n)}}async function uE(i,{fetchFn:e}){let t;try{t=await e(i,{credentials:"include"})}catch(n){throw new ps("network",`network error fetching ${i}: ${n.message||n}`)}if(t.status===401||t.status===403)throw new ps("unauthorized",`unauthorized fetching ${i} (${t.status})`,{status:t.status});if(t.status===404)throw new ps("not_found",`resource not found: ${i}`,{status:404});if(!t.ok)throw new ps("network",`request failed: ${i} (${t.status})`,{status:t.status});try{return await t.json()}catch(n){throw new ps("network",`invalid JSON from ${i}: ${n.message||n}`)}}async function QD(i,{origin:e=typeof location<"u"?location.origin:"",fetchFn:t=fetch}={}){if(!i)throw new ps("not_found","agentId required");const n=t.bind(typeof globalThis<"u"?globalThis:void 0),r=(await uE(`${e}/api/agents/${encodeURIComponent(i)}`,{fetchFn:n}))?.agent;if(!r)throw new ps("not_found",`agent ${i} not found`);if(!r.avatar_id)throw new ps("no_avatar",`agent ${i} has no avatar bound`);const o=(await uE(`${e}/api/avatars/${encodeURIComponent(r.avatar_id)}`,{fetchFn:n}))?.avatar;if(!o||!o.url)throw new ps("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 GD=["inline","floating","section","fullscreen"],HD=`
+`)}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+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+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="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";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=`
:host {
display: block;
position: relative;
@@ -4189,7 +4189,7 @@ ${this.instructions}
padding: 16px;
font: 14px var(--agent-chat-font);
}
-`;class ap 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=HD,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(!GD.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 hE(e,e.brain.instructions);c&&(e.instructions=zD(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 Kd(this._stageEl,{kiosk:this.hasAttribute("kiosk")});this._viewer=t;const n=ks(e.body?.uri);n&&await t.load(n,"",new Map),this._scene=new c0(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 Ei.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 d0({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 r0({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"),ip(e,{rpcURL:this.getAttribute("rpc-url"),registry:this.getAttribute("registry")});if(s)return QD(s);if(t)return ip(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 zD(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",ap);const VD=["row","circle","freeform"],WD=`
+`;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=`
:host {
display: block;
position: relative;
@@ -4209,4 +4209,4 @@ ${this.instructions}
position: absolute;
pointer-events: none;
}
-`;class dE 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 VD.includes(e)?e:"row"}get viewer(){return this._viewer}_renderShell(){const e=document.createElement("style");e.textContent=WD,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 Kd(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{}qD(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 H(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 H(0,0,0),dom:{left:"0",top:"0",width:"100%",height:"100%"}};const a=(e-(t-1)/2)*1.1;return{world:new H(a,0,0),dom:{left:`${e*s*100}%`,top:"0",width:`${s*100}%`,height:"100%"}}}}function qD(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",dE);const KD=(i="agent-3d")=>{customElements.get(i)||customElements.define(i,ap)};en.Agent3DElement=ap,en.AgentStageElement=dE,en.Memory=Ei,en.Runtime=r0,en.SceneController=c0,en.Skill=u0,en.SkillRegistry=d0,en.Viewer=Kd,en.defineElement=KD,en.fetchRelative=hE,en.fetchWithFallback=a0,en.loadManifest=ip,en.normalize=ch,en.resolveURI=ks,Object.defineProperty(en,Symbol.toStringTag,{value:"Module"})}));
+`;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"})}));
diff --git a/dist-lib/agent/index.html b/dist-lib/agent/index.html
index 3cea49fcb..51a0be609 100644
--- a/dist-lib/agent/index.html
+++ b/dist-lib/agent/index.html
@@ -214,6 +214,194 @@
text-align: center;
padding: 2rem;
}
+
+ /* ── Hub actions row ────────────────────────────────────────────────── */
+
+ .agent-hub-actions {
+ display: flex;
+ gap: 0.5rem;
+ flex-wrap: wrap;
+ padding: 0.75rem 1rem;
+ border-top: 1px solid rgba(255,255,255,0.06);
+ border-bottom: 1px solid rgba(255,255,255,0.06);
+ }
+
+ .agent-hub-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.382rem;
+ background: rgba(255,255,255,0.05);
+ border: 1px solid rgba(255,255,255,0.1);
+ color: rgba(255,255,255,0.7);
+ font-size: 0.718rem;
+ font-family: inherit;
+ padding: 0.382rem 0.75rem;
+ border-radius: 999px;
+ cursor: pointer;
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
+ white-space: nowrap;
+ }
+
+ .agent-hub-btn:hover:not(:disabled) {
+ background: rgba(255,255,255,0.1);
+ border-color: rgba(255,255,255,0.2);
+ color: rgba(255,255,255,0.95);
+ }
+
+ .agent-hub-btn:disabled {
+ opacity: 0.5;
+ cursor: default;
+ }
+
+ .agent-hub-btn svg {
+ flex-shrink: 0;
+ opacity: 0.7;
+ }
+
+ .agent-hub-opt {
+ font-size: 0.618rem;
+ opacity: 0.45;
+ }
+
+ .hub-btn--deployed {
+ border-color: rgba(134,239,172,0.25);
+ color: #86efac;
+ }
+
+ .hub-btn--deployed svg {
+ opacity: 0.9;
+ }
+
+ /* ── Embed modal ────────────────────────────────────────────────────── */
+
+ .aem-overlay {
+ position: fixed;
+ inset: 0;
+ background: rgba(0,0,0,0.65);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 9000;
+ opacity: 0;
+ transition: opacity 0.15s;
+ }
+
+ .aem-overlay.aem-open {
+ opacity: 1;
+ }
+
+ .aem-modal {
+ background: #0f0f18;
+ border: 1px solid rgba(255,255,255,0.1);
+ border-radius: 12px;
+ width: min(480px, calc(100vw - 2rem));
+ max-height: calc(100vh - 4rem);
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ box-shadow: 0 24px 80px rgba(0,0,0,0.6);
+ }
+
+ .aem-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 1rem 1.25rem;
+ border-bottom: 1px solid rgba(255,255,255,0.07);
+ }
+
+ .aem-title {
+ font-size: 0.875rem;
+ font-weight: 500;
+ color: rgba(255,255,255,0.85);
+ }
+
+ .aem-close {
+ background: none;
+ border: none;
+ color: rgba(255,255,255,0.4);
+ font-size: 1.25rem;
+ line-height: 1;
+ cursor: pointer;
+ padding: 0.25rem;
+ border-radius: 4px;
+ }
+
+ .aem-close:hover { color: rgba(255,255,255,0.8); }
+
+ .aem-body {
+ padding: 1rem 1.25rem 1.25rem;
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+ }
+
+ .aem-tabs {
+ display: flex;
+ gap: 0.382rem;
+ }
+
+ .aem-tab {
+ background: transparent;
+ border: 1px solid rgba(255,255,255,0.1);
+ color: rgba(255,255,255,0.45);
+ font-size: 0.618rem;
+ padding: 0.236rem 0.618rem;
+ border-radius: 999px;
+ cursor: pointer;
+ font-family: inherit;
+ transition: background 0.12s, color 0.12s;
+ }
+
+ .aem-tab.active {
+ background: rgba(255,255,255,0.08);
+ color: rgba(255,255,255,0.9);
+ border-color: rgba(255,255,255,0.2);
+ }
+
+ .aem-snippet-wrap {
+ position: relative;
+ }
+
+ .aem-snippet {
+ background: rgba(255,255,255,0.04);
+ border: 1px solid rgba(255,255,255,0.08);
+ border-radius: 8px;
+ padding: 0.75rem 1rem;
+ padding-right: 4rem;
+ font-family: monospace;
+ font-size: 0.618rem;
+ color: rgba(255,255,255,0.6);
+ white-space: pre-wrap;
+ word-break: break-all;
+ line-height: 1.6;
+ margin: 0;
+ }
+
+ .aem-copy {
+ position: absolute;
+ top: 0.382rem;
+ right: 0.382rem;
+ background: rgba(255,255,255,0.06);
+ border: 1px solid rgba(255,255,255,0.1);
+ color: rgba(255,255,255,0.6);
+ font-size: 0.618rem;
+ padding: 0.236rem 0.618rem;
+ border-radius: 6px;
+ cursor: pointer;
+ font-family: inherit;
+ transition: background 0.12s, color 0.12s;
+ }
+
+ .aem-copy:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.1); }
+ .aem-copy.aem-copied { color: #86efac; border-color: rgba(134,239,172,0.3); }
+
+ .aem-note {
+ font-size: 0.618rem;
+ color: rgba(255,255,255,0.25);
+ margin: 0;
+ line-height: 1.5;
+ }
</style>
</head>
<body>
@@ -258,16 +446,29 @@
</div>
<script type="module">
- import { AgentIdentity } from '/src/agent-identity.js';
- import { AgentMemory } from '/src/agent-memory.js';
- import { AgentSkills } from '/src/agent-skills.js';
- import { AgentHome } from '/src/agent-home.js';
- import { protocol } from '/src/agent-protocol.js';
+ import { AgentIdentity } from '/src/agent-identity.js';
+ import { AgentMemory } from '/src/agent-memory.js';
+ import { AgentSkills } from '/src/agent-skills.js';
+ import { AgentHome } from '/src/agent-home.js';
+ import { protocol } from '/src/agent-protocol.js';
+ import { renderHubActions } from '/src/agent-hub-actions.js';
// Pull agent id from URL: /agent/:id
const agentId = location.pathname.split('/').filter(Boolean).pop();
async function main() {
+ // Fetch raw API response first — it includes user_id only for owners.
+ let rawAgent = null;
+ if (agentId) {
+ try {
+ const resp = await fetch(`/api/agents/${agentId}`, { credentials: 'include' });
+ if (resp.ok) {
+ const data = await resp.json();
+ rawAgent = data.agent || null;
+ }
+ } catch {}
+ }
+
const identity = new AgentIdentity({ agentId: agentId || undefined, autoLoad: false });
await identity.load();
@@ -283,6 +484,13 @@
const home = new AgentHome(container, identity, protocol, null);
await home.render();
+ // Inject hub actions if the viewer is the owner (user_id present = owner)
+ const isOwner = Boolean(rawAgent?.user_id);
+ if (isOwner) {
+ const panel = container.querySelector('.agent-home-panel');
+ if (panel) renderHubActions(panel, identity, rawAgent);
+ }
+
// Render skills catalog
if (identity.skills?.length) {
const skills = new AgentSkills(protocol, identity.memory);
@@ -318,7 +526,8 @@
let current = 'iframe';
const render = () => { embedCode.textContent = snippets[current]; };
render();
- embedSection.style.display = '';
+ // Hide the bottom embed section for owners — they have the modal via the hub Embed button.
+ if (!isOwner) embedSection.style.display = '';
embedPreview.href = embedUrl;
document.getElementById('agent-embed-settings').href = '/dashboard/embed-policy?agent=' + identity.id;
diff --git a/dist-lib/animations/Angry.fbx b/dist-lib/animations/Angry.fbx
new file mode 100644
index 000000000..2387334bd
Binary files /dev/null and b/dist-lib/animations/Angry.fbx differ
diff --git a/dist-lib/animations/Capoeira.fbx b/dist-lib/animations/Capoeira.fbx
new file mode 100644
index 000000000..bf77dd891
Binary files /dev/null and b/dist-lib/animations/Capoeira.fbx differ
diff --git a/dist-lib/animations/Cover To Stand.fbx b/dist-lib/animations/Cover To Stand.fbx
new file mode 100644
index 000000000..8cac554e4
Binary files /dev/null and b/dist-lib/animations/Cover To Stand.fbx differ
diff --git a/dist-lib/animations/Crouch To Stand.fbx b/dist-lib/animations/Crouch To Stand.fbx
new file mode 100644
index 000000000..f1e45e85a
Binary files /dev/null and b/dist-lib/animations/Crouch To Stand.fbx differ
diff --git a/dist-lib/animations/Defeated.fbx b/dist-lib/animations/Defeated.fbx
new file mode 100644
index 000000000..3bb0d2b9d
Binary files /dev/null and b/dist-lib/animations/Defeated.fbx differ
diff --git a/dist-lib/animations/Dodging Right.fbx b/dist-lib/animations/Dodging Right.fbx
new file mode 100644
index 000000000..8d1ab9a40
Binary files /dev/null and b/dist-lib/animations/Dodging Right.fbx differ
diff --git a/dist-lib/animations/Dying.fbx b/dist-lib/animations/Dying.fbx
new file mode 100644
index 000000000..2a1ea164b
Binary files /dev/null and b/dist-lib/animations/Dying.fbx differ
diff --git a/dist-lib/animations/Falling.fbx b/dist-lib/animations/Falling.fbx
new file mode 100644
index 000000000..1c666b403
Binary files /dev/null and b/dist-lib/animations/Falling.fbx differ
diff --git a/dist-lib/animations/Goalkeeper Scoop.fbx b/dist-lib/animations/Goalkeeper Scoop.fbx
new file mode 100644
index 000000000..6318a8508
Binary files /dev/null and b/dist-lib/animations/Goalkeeper Scoop.fbx differ
diff --git a/dist-lib/animations/Header Soccerball.fbx b/dist-lib/animations/Header Soccerball.fbx
new file mode 100644
index 000000000..a7a106545
Binary files /dev/null and b/dist-lib/animations/Header Soccerball.fbx differ
diff --git a/dist-lib/animations/Hip Hop Dancing.fbx b/dist-lib/animations/Hip Hop Dancing.fbx
new file mode 100644
index 000000000..2e929cff1
Binary files /dev/null and b/dist-lib/animations/Hip Hop Dancing.fbx differ
diff --git a/dist-lib/animations/Joyful Jump.fbx b/dist-lib/animations/Joyful Jump.fbx
new file mode 100644
index 000000000..5ab7757e8
Binary files /dev/null and b/dist-lib/animations/Joyful Jump.fbx differ
diff --git a/dist-lib/animations/Jumping Down (1).fbx b/dist-lib/animations/Jumping Down (1).fbx
new file mode 100644
index 000000000..749d534b2
Binary files /dev/null and b/dist-lib/animations/Jumping Down (1).fbx differ
diff --git a/dist-lib/animations/Jumping Down (2).fbx b/dist-lib/animations/Jumping Down (2).fbx
new file mode 100644
index 000000000..42a8bad60
Binary files /dev/null and b/dist-lib/animations/Jumping Down (2).fbx differ
diff --git a/dist-lib/animations/Jumping Down.fbx b/dist-lib/animations/Jumping Down.fbx
new file mode 100644
index 000000000..c2b06dd22
Binary files /dev/null and b/dist-lib/animations/Jumping Down.fbx differ
diff --git a/dist-lib/animations/Kiss.fbx b/dist-lib/animations/Kiss.fbx
new file mode 100644
index 000000000..7014980fd
Binary files /dev/null and b/dist-lib/animations/Kiss.fbx differ
diff --git a/dist-lib/animations/Old Man Idle.fbx b/dist-lib/animations/Old Man Idle.fbx
new file mode 100644
index 000000000..008bf7d39
Binary files /dev/null and b/dist-lib/animations/Old Man Idle.fbx differ
diff --git a/dist-lib/animations/Praying.fbx b/dist-lib/animations/Praying.fbx
new file mode 100644
index 000000000..0c0c6e392
Binary files /dev/null and b/dist-lib/animations/Praying.fbx differ
diff --git a/dist-lib/animations/Reaction.fbx b/dist-lib/animations/Reaction.fbx
new file mode 100644
index 000000000..e14231714
Binary files /dev/null and b/dist-lib/animations/Reaction.fbx differ
diff --git a/dist-lib/animations/Removing Driver.fbx b/dist-lib/animations/Removing Driver.fbx
new file mode 100644
index 000000000..d2b6c6b12
Binary files /dev/null and b/dist-lib/animations/Removing Driver.fbx differ
diff --git a/dist-lib/animations/Rumba Dancing.fbx b/dist-lib/animations/Rumba Dancing.fbx
new file mode 100644
index 000000000..4827bbdc4
Binary files /dev/null and b/dist-lib/animations/Rumba Dancing.fbx differ
diff --git a/dist-lib/animations/Shoved Reaction With Spin.fbx b/dist-lib/animations/Shoved Reaction With Spin.fbx
new file mode 100644
index 000000000..e25d3fa9a
Binary files /dev/null and b/dist-lib/animations/Shoved Reaction With Spin.fbx differ
diff --git a/dist-lib/animations/Silly Dancing.fbx b/dist-lib/animations/Silly Dancing.fbx
new file mode 100644
index 000000000..be6966da5
Binary files /dev/null and b/dist-lib/animations/Silly Dancing.fbx differ
diff --git a/dist-lib/animations/Sitting Clap.fbx b/dist-lib/animations/Sitting Clap.fbx
new file mode 100644
index 000000000..2ba238f91
Binary files /dev/null and b/dist-lib/animations/Sitting Clap.fbx differ
diff --git a/dist-lib/animations/Sitting Laughing.fbx b/dist-lib/animations/Sitting Laughing.fbx
new file mode 100644
index 000000000..715d4bfa5
Binary files /dev/null and b/dist-lib/animations/Sitting Laughing.fbx differ
diff --git a/dist-lib/animations/Standing Cover Turn.fbx b/dist-lib/animations/Standing Cover Turn.fbx
new file mode 100644
index 000000000..618b9feb8
Binary files /dev/null and b/dist-lib/animations/Standing Cover Turn.fbx differ
diff --git a/dist-lib/animations/Stepping Backward.fbx b/dist-lib/animations/Stepping Backward.fbx
new file mode 100644
index 000000000..cc1761563
Binary files /dev/null and b/dist-lib/animations/Stepping Backward.fbx differ
diff --git a/dist-lib/animations/Taunt.fbx b/dist-lib/animations/Taunt.fbx
new file mode 100644
index 000000000..9ce3ecea5
Binary files /dev/null and b/dist-lib/animations/Taunt.fbx differ
diff --git a/dist-lib/animations/Thriller Part 3.fbx b/dist-lib/animations/Thriller Part 3.fbx
new file mode 100644
index 000000000..cb79ebd8b
Binary files /dev/null and b/dist-lib/animations/Thriller Part 3.fbx differ
diff --git a/dist-lib/animations/Walk Strafe Left.fbx b/dist-lib/animations/Walk Strafe Left.fbx
new file mode 100644
index 000000000..71db4e322
Binary files /dev/null and b/dist-lib/animations/Walk Strafe Left.fbx differ
diff --git a/dist-lib/animations/manifest.json b/dist-lib/animations/manifest.json
index 7ceee1ecc..b6f2105df 100644
--- a/dist-lib/animations/manifest.json
+++ b/dist-lib/animations/manifest.json
@@ -1,114 +1,128 @@
[
+ {
+ "name": "idle",
+ "url": "/animations/Old Man Idle.fbx",
+ "label": "Idle",
+ "icon": "🧍",
+ "loop": true
+ },
{
"name": "dance",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Dance",
+ "url": "/animations/Hip Hop Dancing.fbx",
"label": "Dance",
"icon": "💃",
"loop": true
},
{
- "name": "death",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Death",
- "label": "Death",
+ "name": "celebrate",
+ "url": "/animations/Joyful Jump.fbx",
+ "label": "Celebrate",
+ "icon": "🎉",
+ "loop": false
+ },
+ {
+ "name": "angry",
+ "url": "/animations/Angry.fbx",
+ "label": "Angry",
+ "icon": "😡",
+ "loop": false
+ },
+ {
+ "name": "defeated",
+ "url": "/animations/Defeated.fbx",
+ "label": "Defeated",
+ "icon": "😞",
+ "loop": false
+ },
+ {
+ "name": "dying",
+ "url": "/animations/Dying.fbx",
+ "label": "Dying",
"icon": "💀",
"loop": false
},
{
- "name": "idle",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Idle",
- "label": "Idle",
- "icon": "🧍",
- "loop": true
+ "name": "falling",
+ "url": "/animations/Falling.fbx",
+ "label": "Falling",
+ "icon": "🪂",
+ "loop": false
},
{
"name": "jump",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Jump",
+ "url": "/animations/Joyful Jump.fbx",
"label": "Jump",
"icon": "🦘",
"loop": false
},
{
- "name": "no",
- "url": "/animations/robotexpressive.glb",
- "clipName": "No",
- "label": "No",
- "icon": "🚫",
+ "name": "kiss",
+ "url": "/animations/Kiss.fbx",
+ "label": "Kiss",
+ "icon": "💋",
"loop": false
},
{
- "name": "punch",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Punch",
- "label": "Punch",
- "icon": "👊",
+ "name": "pray",
+ "url": "/animations/Praying.fbx",
+ "label": "Pray",
+ "icon": "🙏",
"loop": false
},
{
- "name": "running",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Running",
- "label": "Running",
- "icon": "🏃",
- "loop": true
+ "name": "reaction",
+ "url": "/animations/Reaction.fbx",
+ "label": "Reaction",
+ "icon": "😲",
+ "loop": false
},
{
- "name": "sitting",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Sitting",
- "label": "Sitting",
- "icon": "🪑",
+ "name": "rumba",
+ "url": "/animations/Rumba Dancing.fbx",
+ "label": "Rumba",
+ "icon": "🕺",
"loop": true
},
{
- "name": "standing",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Standing",
- "label": "Standing",
- "icon": "🧍",
+ "name": "silly",
+ "url": "/animations/Silly Dancing.fbx",
+ "label": "Silly Dance",
+ "icon": "🤪",
"loop": true
},
{
- "name": "thumbsup",
- "url": "/animations/robotexpressive.glb",
- "clipName": "ThumbsUp",
- "label": "ThumbsUp",
- "icon": "👍",
+ "name": "sitclap",
+ "url": "/animations/Sitting Clap.fbx",
+ "label": "Sit Clap",
+ "icon": "👏",
"loop": false
},
{
- "name": "walking",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Walking",
- "label": "Walking",
- "icon": "🚶",
- "loop": true
+ "name": "sitlaugh",
+ "url": "/animations/Sitting Laughing.fbx",
+ "label": "Sit Laugh",
+ "icon": "😂",
+ "loop": false
},
{
- "name": "walkjump",
- "url": "/animations/robotexpressive.glb",
- "clipName": "WalkJump",
- "label": "WalkJump",
- "icon": "▶",
+ "name": "taunt",
+ "url": "/animations/Taunt.fbx",
+ "label": "Taunt",
+ "icon": "😝",
"loop": false
},
{
- "name": "wave",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Wave",
- "label": "Wave",
- "icon": "👋",
- "loop": false
+ "name": "thriller",
+ "url": "/animations/Thriller Part 3.fbx",
+ "label": "Thriller",
+ "icon": "🧟",
+ "loop": true
},
{
- "name": "yes",
- "url": "/animations/robotexpressive.glb",
- "clipName": "Yes",
- "label": "Yes",
- "icon": "✅",
- "loop": false
+ "name": "capoeira",
+ "url": "/animations/Capoeira.fbx",
+ "label": "Capoeira",
+ "icon": "🥋",
+ "loop": true
}
]
diff --git a/dist-lib/dashboard/dashboard.js b/dist-lib/dashboard/dashboard.js
index d4b9a4d86..6e3c3ebaa 100644
--- a/dist-lib/dashboard/dashboard.js
+++ b/dist-lib/dashboard/dashboard.js
@@ -1,6 +1,8 @@
// Dashboard single-file app. Uses native DOM — no framework.
// Keeps bundle small and ensures anything rendering <model-viewer> works without bundler.
+import { AvatarCreator } from '../../src/avatar-creator.js';
+
export const state = { user: null };
export const api = {
@@ -19,6 +21,9 @@ export const api = {
deleteWidget: (id) => j('DELETE', `/api/widgets/${encodeURIComponent(id)}`),
duplicateWidget: (id) => j('POST', `/api/widgets/${encodeURIComponent(id)}/duplicate`),
widgetStats: (id) => j('GET', `/api/widgets/${encodeURIComponent(id)}/stats`),
+ createAvatarSession: (id) => j('POST', `/api/avatars/${id}/session`),
+ getAvatarVersions: (id) => j('GET', `/api/avatars/${id}/versions`),
+ patchAgent: (agentId, patch) => j('PUT', `/api/agents/${agentId}`, patch),
};
async function j(method, path, body) {
@@ -31,13 +36,21 @@ async function j(method, path, body) {
const data = res.headers.get('content-type')?.includes('application/json')
? await res.json()
: null;
- if (!res.ok) throw Object.assign(new Error((data && data.error_description) || res.statusText), { status: res.status, data });
+ if (!res.ok)
+ throw Object.assign(new Error((data && data.error_description) || res.statusText), {
+ status: res.status,
+ data,
+ });
return data;
}
export function signOut() {
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }).finally(() => {
- try { localStorage.removeItem('3dagent:auth-hint'); } catch { /* ignore */ }
+ try {
+ localStorage.removeItem('3dagent:auth-hint');
+ } catch {
+ /* ignore */
+ }
location.href = '/';
});
}
@@ -45,7 +58,9 @@ export function signOut() {
export function navigate(tab) {
// Support #edit/<id> sub-routes for per-avatar edit screens.
const [base, ...rest] = (tab || 'avatars').split('/');
- document.querySelectorAll('aside a').forEach((a) => a.classList.toggle('active', a.dataset.tab === base));
+ document
+ .querySelectorAll('aside a')
+ .forEach((a) => a.classList.toggle('active', a.dataset.tab === base));
const main = document.getElementById('main');
main.innerHTML = '';
const renderer = tabs[base] || tabs.avatars;
@@ -94,10 +109,11 @@ function avatarCard(a) {
<p class="meta">${a.size_bytes ? fmtSize(a.size_bytes) : ''} · ${esc(a.visibility)} · ${new Date(a.created_at).toLocaleDateString()}</p>
<div class="row" style="gap:6px; margin-bottom:10px">${a.tags.map((t) => `<span class="tag">${esc(t)}</span>`).join('')}</div>
<div class="row" style="justify-content:space-between">
- <select data-vis>${['private','unlisted','public'].map((v) => `<option ${v===a.visibility?'selected':''} value="${v}">${v}</option>`).join('')}</select>
+ <select data-vis>${['private', 'unlisted', 'public'].map((v) => `<option ${v === a.visibility ? 'selected' : ''} value="${v}">${v}</option>`).join('')}</select>
<div class="row" style="gap:6px">
<a class="btn sec" href="#edit/${encodeURIComponent(a.id)}">Edit</a>
<button class="btn sec" data-replace>Replace GLB</button>
+ <a class="btn sec" href="/deploy?avatar=${encodeURIComponent(a.id)}" title="Mint as ERC-8004 agent">Deploy on-chain</a>
<button class="btn sec" data-del>Delete</button>
</div>
</div>
@@ -105,14 +121,18 @@ function avatarCard(a) {
el.querySelector('[data-vis]').addEventListener('change', async (e) => {
try {
await api.patchAvatar(a.id, { visibility: e.target.value });
- } catch (err) { alert(err.message); }
+ } catch (err) {
+ alert(err.message);
+ }
});
el.querySelector('[data-del]').addEventListener('click', async () => {
if (!confirm(`Delete "${a.name}"?`)) return;
try {
await api.deleteAvatar(a.id);
el.remove();
- } catch (err) { alert(err.message); }
+ } catch (err) {
+ alert(err.message);
+ }
});
el.querySelector('[data-replace]').addEventListener('click', () => replaceGlbFlow(a, el));
return el;
@@ -127,7 +147,8 @@ function replaceGlbFlow(a, cardEl) {
const warn = document.createElement('div');
warn.setAttribute('data-glb-warn', '');
- warn.style.cssText = 'margin:8px 0; padding:10px; background:rgba(255,165,0,.08); border:1px solid rgba(255,165,0,.25); border-radius:8px; font-size:12px; color:#d4aa44';
+ warn.style.cssText =
+ 'margin:8px 0; padding:10px; background:rgba(255,165,0,.08); border:1px solid rgba(255,165,0,.25); border-radius:8px; font-size:12px; color:#d4aa44';
warn.innerHTML = `
<p style="margin:0 0 8px">&#9888; This bypasses Avaturn &#8212; your avatar may not animate correctly if not rigged to the Mixamo skeleton.</p>
<div class="row" style="gap:6px">
@@ -170,14 +191,18 @@ async function doReplaceUpload(a, file, warnEl, cardEl) {
}
// MIME type check
- if (file.type && file.type !== 'model/gltf-binary' && file.type !== 'application/octet-stream') {
+ if (
+ file.type &&
+ file.type !== 'model/gltf-binary' &&
+ file.type !== 'application/octet-stream'
+ ) {
say(`Unexpected file type "${file.type}". Expected model/gltf-binary.`, true);
return;
}
// Magic number check: first 4 bytes must be 'glTF' (0x46546C67 little-endian)
const header = await file.slice(0, 4).arrayBuffer();
- if (new DataView(header).getUint32(0, true) !== 0x46546C67) {
+ if (new DataView(header).getUint32(0, true) !== 0x46546c67) {
say('Not a valid GLB \u2014 magic number check failed. Renamed files are rejected.', true);
return;
}
@@ -215,7 +240,9 @@ async function doReplaceUpload(a, file, warnEl, cardEl) {
}
if (boneMatch !== null && boneMatch < 0.5) {
- say(`Uploaded. \u26a0 Animations may not play \u2014 skeleton mismatch (${Math.round(boneMatch * 100)}% Mixamo bone match).`);
+ say(
+ `Uploaded. \u26a0 Animations may not play \u2014 skeleton mismatch (${Math.round(boneMatch * 100)}% Mixamo bone match).`,
+ );
} else {
say('Replaced! Your agent now uses the new GLB.');
}
@@ -229,16 +256,33 @@ async function doReplaceUpload(a, file, warnEl, cardEl) {
// Returns a ratio 0..1, or null if the file has no parseable node names.
function checkMixamoSkeleton(buffer) {
const MIXAMO_BONES = new Set([
- 'Hips', 'Spine', 'Spine1', 'Spine2', 'Neck', 'Head',
- 'LeftShoulder', 'LeftArm', 'LeftForeArm', 'LeftHand',
- 'RightShoulder', 'RightArm', 'RightForeArm', 'RightHand',
- 'LeftUpLeg', 'LeftLeg', 'LeftFoot', 'LeftToeBase',
- 'RightUpLeg', 'RightLeg', 'RightFoot', 'RightToeBase',
+ 'Hips',
+ 'Spine',
+ 'Spine1',
+ 'Spine2',
+ 'Neck',
+ 'Head',
+ 'LeftShoulder',
+ 'LeftArm',
+ 'LeftForeArm',
+ 'LeftHand',
+ 'RightShoulder',
+ 'RightArm',
+ 'RightForeArm',
+ 'RightHand',
+ 'LeftUpLeg',
+ 'LeftLeg',
+ 'LeftFoot',
+ 'LeftToeBase',
+ 'RightUpLeg',
+ 'RightLeg',
+ 'RightFoot',
+ 'RightToeBase',
]);
try {
const view = new DataView(buffer);
const chunkLen = view.getUint32(12, true);
- if (view.getUint32(16, true) !== 0x4E4F534A) return null; // chunk 0 is not JSON
+ if (view.getUint32(16, true) !== 0x4e4f534a) return null; // chunk 0 is not JSON
const json = JSON.parse(new TextDecoder().decode(new Uint8Array(buffer, 20, chunkLen)));
const nodes = (json.nodes || []).filter((n) => n.name);
if (!nodes.length) return null;
@@ -282,9 +326,16 @@ function renderUpload(root) {
content_type: file.type || 'model/gltf-binary',
});
progress.textContent = `Uploading ${fmtSize(file.size)}…`;
- await uploadToR2(upload_url, file, (pct) => (progress.textContent = `Uploading ${pct}%…`));
+ await uploadToR2(
+ upload_url,
+ file,
+ (pct) => (progress.textContent = `Uploading ${pct}%…`),
+ );
progress.textContent = 'Finalizing…';
- const tags = (root.querySelector('#tags').value || '').split(',').map((s) => s.trim()).filter(Boolean);
+ const tags = (root.querySelector('#tags').value || '')
+ .split(',')
+ .map((s) => s.trim())
+ .filter(Boolean);
const { avatar } = await api.createAvatar({
storage_key,
name: root.querySelector('#name').value,
@@ -310,8 +361,12 @@ function uploadToR2(url, file, onProgress) {
const xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.setRequestHeader('content-type', file.type || 'model/gltf-binary');
- xhr.upload.onprogress = (e) => e.lengthComputable && onProgress(Math.round((e.loaded / e.total) * 100));
- xhr.onload = () => (xhr.status >= 200 && xhr.status < 300 ? resolve() : reject(new Error(`Upload failed (${xhr.status})`)));
+ xhr.upload.onprogress = (e) =>
+ e.lengthComputable && onProgress(Math.round((e.loaded / e.total) * 100));
+ xhr.onload = () =>
+ xhr.status >= 200 && xhr.status < 300
+ ? resolve()
+ : reject(new Error(`Upload failed (${xhr.status})`));
xhr.onerror = () => reject(new Error('Network error during upload'));
xhr.send(file);
});
@@ -322,8 +377,8 @@ function uploadToR2(url, file, onProgress) {
// camera capture, selfie-to-mesh, and returns a GLB URL via postMessage.
// We fetch that GLB and run it through the same R2 upload path as manual uploads.
const RPM_SUBDOMAIN = 'demo'; // any public RPM subdomain works for self-serve
-const RPM_ORIGIN = `https://${RPM_SUBDOMAIN}.readyplayer.me`;
-const RPM_SRC = `${RPM_ORIGIN}/avatar?frameApi&bodyType=fullbody&clearCache=true`;
+const RPM_ORIGIN = `https://${RPM_SUBDOMAIN}.readyplayer.me`;
+const RPM_SRC = `${RPM_ORIGIN}/avatar?frameApi&bodyType=fullbody&clearCache=true`;
function renderCreate(root) {
root.innerHTML = `
@@ -348,11 +403,11 @@ function renderCreate(root) {
</div>
`;
- const launchBtn = root.querySelector('#rpm-launch');
+ const launchBtn = root.querySelector('#rpm-launch');
const restartBtn = root.querySelector('#rpm-restart');
- const intro = root.querySelector('#rpm-intro');
- const iframe = root.querySelector('#rpm-iframe');
- const progress = root.querySelector('#rpm-progress');
+ const intro = root.querySelector('#rpm-intro');
+ const iframe = root.querySelector('#rpm-iframe');
+ const progress = root.querySelector('#rpm-progress');
const say = (msg, isError = false) => {
progress.style.display = 'block';
@@ -377,7 +432,11 @@ function renderCreate(root) {
// Ready Player Me → subscribe to all events once its frame is ready.
if (data.eventName === 'v1.frame.ready') {
iframe.contentWindow?.postMessage(
- JSON.stringify({ target: 'readyplayerme', type: 'subscribe', eventName: 'v1.**' }),
+ JSON.stringify({
+ target: 'readyplayerme',
+ type: 'subscribe',
+ eventName: 'v1.**',
+ }),
RPM_ORIGIN,
);
return;
@@ -385,12 +444,17 @@ function renderCreate(root) {
if (data.eventName === 'v1.avatar.exported') {
const glbUrl = data.data?.url;
- if (!glbUrl) { say('No avatar URL returned', true); return; }
+ if (!glbUrl) {
+ say('No avatar URL returned', true);
+ return;
+ }
say('Fetching avatar…');
try {
const avatar = await saveRpmAvatar(glbUrl);
say(`Saved "${avatar.name}". Redirecting…`);
- setTimeout(() => { location.hash = 'avatars'; }, 600);
+ setTimeout(() => {
+ location.hash = 'avatars';
+ }, 600);
} catch (err) {
say(err.message || 'Failed to save avatar', true);
}
@@ -416,7 +480,11 @@ function renderCreate(root) {
function parseRpmMessage(raw) {
if (!raw) return null;
if (typeof raw === 'object') return raw;
- try { return JSON.parse(raw); } catch { return null; }
+ try {
+ return JSON.parse(raw);
+ } catch {
+ return null;
+ }
}
async function saveRpmAvatar(sourceUrl) {
@@ -437,7 +505,10 @@ async function saveRpmAvatar(sourceUrl) {
const xhr = new XMLHttpRequest();
xhr.open('PUT', upload_url);
xhr.setRequestHeader('content-type', contentType);
- xhr.onload = () => (xhr.status >= 200 && xhr.status < 300 ? resolve() : reject(new Error(`Upload failed (${xhr.status})`)));
+ xhr.onload = () =>
+ xhr.status >= 200 && xhr.status < 300
+ ? resolve()
+ : reject(new Error(`Upload failed (${xhr.status})`));
xhr.onerror = () => reject(new Error('Network error during upload'));
xhr.send(blob);
});
@@ -456,7 +527,9 @@ async function saveRpmAvatar(sourceUrl) {
// Wire the new avatar straight into the caller's default agent identity so
// the selfie immediately becomes the agent's body across the site.
- await attachAvatarToDefaultAgent(avatar.id).catch((e) => console.warn('attach to agent skipped:', e.message));
+ await attachAvatarToDefaultAgent(avatar.id).catch((e) =>
+ console.warn('attach to agent skipped:', e.message),
+ );
return avatar;
}
@@ -476,7 +549,10 @@ async function attachAvatarToDefaultAgent(avatarId) {
// ── Edit avatar ─────────────────────────────────────────────────────────────
async function renderEdit(root, params = []) {
const id = params[0];
- if (!id) { location.hash = 'avatars'; return; }
+ if (!id) {
+ location.hash = 'avatars';
+ return;
+ }
root.innerHTML = `
<div class="toolbar">
@@ -494,7 +570,9 @@ async function renderEdit(root, params = []) {
const body = root.querySelector('#edit-body');
let avatar;
try {
- const res = await fetch(`/api/avatars/${encodeURIComponent(id)}`, { credentials: 'include' });
+ const res = await fetch(`/api/avatars/${encodeURIComponent(id)}`, {
+ credentials: 'include',
+ });
if (!res.ok) throw new Error((await res.json()).error_description || res.statusText);
avatar = (await res.json()).avatar;
} catch (err) {
@@ -507,9 +585,11 @@ async function renderEdit(root, params = []) {
<div style="display:grid; grid-template-columns:minmax(260px,1fr) minmax(260px,2fr); gap:20px; align-items:start">
<div class="card" style="padding:10px">
<div class="preview" style="aspect-ratio:1/1; margin:0; background:#0f0f17; border-radius:10px; overflow:hidden">
- ${previewUrl
- ? `<model-viewer src="${attr(previewUrl)}" camera-controls auto-rotate shadow-intensity="1" exposure="1" tone-mapping="aces" style="width:100%;height:100%"></model-viewer>`
- : `<div style="display:grid;place-items:center;height:100%;color:#555;font-size:12px">Preview unavailable</div>`}
+ ${
+ previewUrl
+ ? `<model-viewer src="${attr(previewUrl)}" camera-controls auto-rotate shadow-intensity="1" exposure="1" tone-mapping="aces" style="width:100%;height:100%"></model-viewer>`
+ : `<div style="display:grid;place-items:center;height:100%;color:#555;font-size:12px">Preview unavailable</div>`
+ }
</div>
<p class="muted" style="margin:10px 4px 0">${fmtSize(avatar.size_bytes || 0)} · ${esc(avatar.source || 'upload')}</p>
</div>
@@ -518,7 +598,7 @@ async function renderEdit(root, params = []) {
<label style="display:block;margin-top:12px">Description<textarea id="edesc" rows="3" style="width:100%">${esc(avatar.description || '')}</textarea></label>
<label style="display:block;margin-top:12px">Visibility
<select id="evis" style="width:100%">
- ${['private','unlisted','public'].map((v) => `<option ${v===avatar.visibility?'selected':''} value="${v}">${v}</option>`).join('')}
+ ${['private', 'unlisted', 'public'].map((v) => `<option ${v === avatar.visibility ? 'selected' : ''} value="${v}">${v}</option>`).join('')}
</select>
</label>
<label style="display:block;margin-top:12px">Tags (comma separated)<input id="etags" value="${attr((avatar.tags || []).join(', '))}" style="width:100%"></label>
@@ -537,7 +617,10 @@ async function renderEdit(root, params = []) {
msg.style.color = '#888';
msg.textContent = 'Saving…';
try {
- const tags = (body.querySelector('#etags').value || '').split(',').map((s) => s.trim()).filter(Boolean);
+ const tags = (body.querySelector('#etags').value || '')
+ .split(',')
+ .map((s) => s.trim())
+ .filter(Boolean);
await api.patchAvatar(id, {
name: body.querySelector('#ename').value.trim(),
description: body.querySelector('#edesc').value.trim() || undefined,
@@ -590,21 +673,37 @@ async function renderKeys(root) {
async function refresh() {
try {
const { keys } = await api.listKeys();
- if (!keys.length) { klist.innerHTML = '<div class="muted">No keys yet.</div>'; return; }
- klist.innerHTML = keys.map((k) => `
+ if (!keys.length) {
+ klist.innerHTML = '<div class="muted">No keys yet.</div>';
+ return;
+ }
+ klist.innerHTML = keys
+ .map(
+ (k) => `
<div class="key-row">
<div>
<div><code>${esc(k.prefix)}…</code> — ${esc(k.name)}</div>
- <div class="muted">scope: ${esc(k.scope)} · created ${new Date(k.created_at).toLocaleDateString()}${k.revoked_at?` · <b style="color:#f88">revoked</b>`:''}</div>
+ <div class="muted">scope: ${esc(k.scope)} · created ${new Date(k.created_at).toLocaleDateString()}${k.revoked_at ? ` · <b style="color:#f88">revoked</b>` : ''}</div>
</div>
${k.revoked_at ? '' : `<button class="btn sec" data-id="${esc(k.id)}">Revoke</button>`}
</div>
- `).join('');
- klist.querySelectorAll('button[data-id]').forEach((b) => b.addEventListener('click', async () => {
- if (!confirm('Revoke this key?')) return;
- try { await api.revokeKey(b.dataset.id); refresh(); } catch (e) { alert(e.message); }
- }));
- } catch (e) { klist.innerHTML = `<div class="err">${esc(e.message)}</div>`; }
+ `,
+ )
+ .join('');
+ klist.querySelectorAll('button[data-id]').forEach((b) =>
+ b.addEventListener('click', async () => {
+ if (!confirm('Revoke this key?')) return;
+ try {
+ await api.revokeKey(b.dataset.id);
+ refresh();
+ } catch (e) {
+ alert(e.message);
+ }
+ }),
+ );
+ } catch (e) {
+ klist.innerHTML = `<div class="err">${esc(e.message)}</div>`;
+ }
}
root.querySelector('#new').addEventListener('submit', async (e) => {
e.preventDefault();
@@ -621,7 +720,9 @@ async function renderKeys(root) {
`;
root.querySelector('#kname').value = '';
refresh();
- } catch (err) { alert(err.message); }
+ } catch (err) {
+ alert(err.message);
+ }
});
refresh();
}
@@ -638,11 +739,17 @@ function renderMcp(root) {
<h3 class="section">Claude Desktop / Claude Code (remote)</h3>
<p class="muted">Add a Custom Connector in Claude. When prompted, sign in with your 3D Agent account.</p>
- <pre><code>${esc(JSON.stringify({
- mcpServers: {
- '3d-agent': { url: `${origin}/api/mcp` }
- }
- }, null, 2))}</code></pre>
+ <pre><code>${esc(
+ JSON.stringify(
+ {
+ mcpServers: {
+ '3d-agent': { url: `${origin}/api/mcp` },
+ },
+ },
+ null,
+ 2,
+ ),
+ )}</code></pre>
<h3 class="section">Programmatic (API key)</h3>
<p class="muted">Bypass OAuth for server-to-server usage. Pass key as a bearer token.</p>
@@ -691,69 +798,69 @@ async function renderEmbed(root) {
const origin = location.origin;
const embedUrl = `${origin}/agent/${encodeURIComponent(agent.id)}/embed`;
- const homeUrl = `${origin}/agent/${encodeURIComponent(agent.id)}`;
+ const homeUrl = `${origin}/agent/${encodeURIComponent(agent.id)}`;
const iframeSnippet = `<iframe src="${embedUrl}" allow="camera; microphone" style="width:320px;height:420px;border:0;border-radius:16px;overflow:hidden" title="${esc(agent.name || 'Agent')}"></iframe>`;
const lobehubSnippet = [
- "// Drop into a Lobehub fork — renders the agent alongside the chat panel",
- "// and forwards assistant messages to it so the avatar speaks/emotes.",
+ '// Drop into a Lobehub fork — renders the agent alongside the chat panel',
+ '// and forwards assistant messages to it so the avatar speaks/emotes.',
"import { useEffect, useRef } from 'react';",
- "",
- "export function AgentSidecar({ latestAssistantMessage }) {",
+ '',
+ 'export function AgentSidecar({ latestAssistantMessage }) {',
` const AGENT_ID = ${JSON.stringify(agent.id)};`,
` const EMBED_URL = ${JSON.stringify(embedUrl)};`,
- " const ref = useRef(null);",
- "",
- " useEffect(() => {",
- " if (!ref.current || !latestAssistantMessage) return;",
- " ref.current.contentWindow?.postMessage({",
- " __agent: AGENT_ID,",
+ ' const ref = useRef(null);',
+ '',
+ ' useEffect(() => {',
+ ' if (!ref.current || !latestAssistantMessage) return;',
+ ' ref.current.contentWindow?.postMessage({',
+ ' __agent: AGENT_ID,',
" type: 'action',",
" action: { type: 'speak', payload: { text: latestAssistantMessage.text } },",
" }, '*');",
- " }, [latestAssistantMessage]);",
- "",
- " return <iframe ref={ref} src={EMBED_URL} allow=\"camera; microphone\"",
- " style={{ width: 320, height: 420, border: 0, borderRadius: 16 }} />;",
- "}",
+ ' }, [latestAssistantMessage]);',
+ '',
+ ' return <iframe ref={ref} src={EMBED_URL} allow="camera; microphone"',
+ ' style={{ width: 320, height: 420, border: 0, borderRadius: 16 }} />;',
+ '}',
].join('\n');
const claudeSnippet = [
- "<!-- Paste into Claude as an HTML Artifact. The avatar renders live. -->",
+ '<!-- Paste into Claude as an HTML Artifact. The avatar renders live. -->',
`<iframe src="${embedUrl}"`,
- " style=\"width:100%;height:480px;border:0;border-radius:16px\"",
- " allow=\"camera; microphone\"></iframe>",
+ ' style="width:100%;height:480px;border:0;border-radius:16px"',
+ ' allow="camera; microphone"></iframe>',
].join('\n');
const postMessageSnippet = [
- "// From any host page, make the avatar speak + emote:",
+ '// From any host page, make the avatar speak + emote:',
"const frame = document.querySelector('iframe');",
- "frame.contentWindow.postMessage({",
+ 'frame.contentWindow.postMessage({',
` __agent: ${JSON.stringify(agent.id)},`,
" type: 'action',",
" action: { type: 'speak', payload: { text: 'Hello from the host app' } },",
"}, '*');",
- "",
- "// Listen for agent readiness:",
+ '',
+ '// Listen for agent readiness:',
"window.addEventListener('message', (e) => {",
` if (e.data?.__agent === ${JSON.stringify(agent.id)} && e.data.type === 'ready') {`,
" console.log('agent online:', e.data.name);",
- " }",
- "});",
+ ' }',
+ '});',
].join('\n');
const sdkSnippet = [
- "<!-- Drop-in SDK around the postMessage Bridge v1. -->",
- "<!-- See /agent/" + agent.id + "/embed for the wire contract. -->",
+ '<!-- Drop-in SDK around the postMessage Bridge v1. -->',
+ '<!-- See /agent/' + agent.id + '/embed for the wire contract. -->',
`<iframe id="agent" src="${embedUrl}" allow="camera; microphone"`,
- " style=\"width:320px;height:420px;border:0;border-radius:16px\"></iframe>",
+ ' style="width:320px;height:420px;border:0;border-radius:16px"></iframe>',
`<script src="${origin}/embed-sdk.js"></script>`,
- "<script>",
+ '<script>',
" const bridge = Agent3D.connect(document.getElementById('agent'), {",
` agentId: ${JSON.stringify(agent.id)},`,
" onReady: ({ version, capabilities }) => console.log('ready', version, capabilities),",
" onAction: (action) => console.log('iframe emitted', action),",
" onResize: (h) => console.log('preferred height', h),",
" onError: (err) => console.warn('bridge error', err.message),",
- " });",
+ ' });',
" bridge.ready.then(() => bridge.send({ type: 'speak', payload: { text: 'Hi from host' } }));",
- "</script>",
+ '</script>',
].join('\n');
body.innerHTML = `
@@ -765,13 +872,17 @@ async function renderEmbed(root) {
<a href="${attr(homeUrl)}" target="_blank" class="muted">Home page →</a>
</div>
<p class="muted" style="padding:0 6px">Agent ID <code>${esc(agent.id)}</code></p>
- ${agent.wallet_address ? `
+ ${
+ agent.wallet_address
+ ? `
<p class="muted" style="padding:0 6px; margin-top:6px; line-height:1.4">
Agent wallet<br>
<code style="font-size:11px; word-break:break-all">${esc(agent.wallet_address)}</code><br>
<span style="font-size:11px">Server-held. Agents sign autonomously via <code style="font-size:11px">POST /api/agents/${esc(agent.id)}/sign</code>.</span>
</p>
- ` : ''}
+ `
+ : ''
+ }
</div>
<div>
${snippetBlock('Universal iframe (any site)', iframeSnippet, 'html')}
@@ -797,7 +908,9 @@ async function renderEmbed(root) {
await navigator.clipboard.writeText(target.textContent);
const original = btn.textContent;
btn.textContent = 'Copied';
- setTimeout(() => { btn.textContent = original; }, 1200);
+ setTimeout(() => {
+ btn.textContent = original;
+ }, 1200);
} catch {
btn.textContent = 'Copy failed';
}
@@ -850,8 +963,8 @@ function onchainCard(agent) {
// Attach the click handler after the embed DOM has been rendered. Called from
// renderEmbed below via a mutation after body.innerHTML is set.
function bindOnchainDeploy(body, agent) {
- const btn = body.querySelector('#onchain-deploy');
- const log = body.querySelector('#onchain-log');
+ const btn = body.querySelector('#onchain-deploy');
+ const log = body.querySelector('#onchain-log');
const token = body.querySelector('#onchain-ipfs-token');
if (!btn) return;
@@ -871,8 +984,11 @@ function bindOnchainDeploy(body, agent) {
try {
say('Fetching avatar GLB…');
- const avRes = await fetch(`/api/avatars/${encodeURIComponent(agent.avatar_id)}`, { credentials: 'include' });
- if (!avRes.ok) throw new Error((await avRes.json()).error_description || 'avatar fetch failed');
+ const avRes = await fetch(`/api/avatars/${encodeURIComponent(agent.avatar_id)}`, {
+ credentials: 'include',
+ });
+ if (!avRes.ok)
+ throw new Error((await avRes.json()).error_description || 'avatar fetch failed');
const avatarRow = (await avRes.json()).avatar;
const glbUrl = avatarRow.url || avatarRow.model_url;
if (!glbUrl) throw new Error('avatar has no URL');
@@ -892,19 +1008,30 @@ function bindOnchainDeploy(body, agent) {
say(`Persisting onchain IDs to your account…`);
const wallet = window.ethereum?.selectedAddress || '';
- const chainId = Number((await window.ethereum?.request?.({ method: 'eth_chainId' })) || 0) || undefined;
+ const chainId =
+ Number((await window.ethereum?.request?.({ method: 'eth_chainId' })) || 0) ||
+ undefined;
await fetch(`/api/agents/${encodeURIComponent(agent.id)}/wallet`, {
method: 'POST',
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
wallet_address: wallet,
- chain_id: chainId ? parseInt(chainId.toString(16) === chainId.toString() ? chainId : String(chainId), 10) || null : null,
+ chain_id: chainId
+ ? parseInt(
+ chainId.toString(16) === chainId.toString()
+ ? chainId
+ : String(chainId),
+ 10,
+ ) || null
+ : null,
erc8004_agent_id: result.agentId,
}),
});
- say(`✓ Done. agentId=${result.agentId}, registration=ipfs://${result.registrationCID}, tx=${result.txHash}`);
+ say(
+ `✓ Done. agentId=${result.agentId}, registration=ipfs://${result.registrationCID}, tx=${result.txHash}`,
+ );
} catch (err) {
say(err.message || String(err), true);
} finally {
@@ -945,10 +1072,11 @@ function bindMyAgents(body) {
list.innerHTML = '';
try {
- const [{ connectWallet, getIdentityRegistry }, { REGISTRY_DEPLOYMENTS }] = await Promise.all([
- import('/src/erc8004/agent-registry.js'),
- import('/src/erc8004/abi.js'),
- ]);
+ const [{ connectWallet, getIdentityRegistry }, { REGISTRY_DEPLOYMENTS }] =
+ await Promise.all([
+ import('/src/erc8004/agent-registry.js'),
+ import('/src/erc8004/abi.js'),
+ ]);
const { signer, address, chainId } = await connectWallet();
const deployment = REGISTRY_DEPLOYMENTS[chainId];
@@ -965,7 +1093,9 @@ function bindMyAgents(body) {
const dbPromise = fetch(
`/api/agents/by-wallet?address=${encodeURIComponent(address)}&chain_id=${chainId}`,
{ credentials: 'include' },
- ).then((r) => (r.ok ? r.json() : { agents: [] })).catch(() => ({ agents: [] }));
+ )
+ .then((r) => (r.ok ? r.json() : { agents: [] }))
+ .catch(() => ({ agents: [] }));
if (balance === 0) {
const { agents: dbAgents = [] } = await dbPromise;
@@ -997,7 +1127,9 @@ function bindMyAgents(body) {
try {
const owner = await registry.ownerOf(id);
if (owner.toLowerCase() === address.toLowerCase()) tokenIds.push(id);
- } catch { /* token burned/transferred — skip */ }
+ } catch {
+ /* token burned/transferred — skip */
+ }
}
}
@@ -1018,14 +1150,20 @@ function bindMyAgents(body) {
async function fetchTokenMeta(registry, tokenId) {
let uri = '';
let meta = null;
- try { uri = await registry.tokenURI(tokenId); } catch { /* no URI set */ }
+ try {
+ uri = await registry.tokenURI(tokenId);
+ } catch {
+ /* no URI set */
+ }
if (uri) {
const httpUrl = uriToHttp(uri);
try {
const r = await fetch(httpUrl);
const ct = r.headers.get('content-type') || '';
if (r.ok && ct.includes('json')) meta = await r.json();
- } catch { /* metadata unreachable */ }
+ } catch {
+ /* metadata unreachable */
+ }
}
return { id: tokenId, uri, meta };
}
@@ -1033,7 +1171,7 @@ async function fetchTokenMeta(registry, tokenId) {
function uriToHttp(uri) {
if (!uri) return '';
if (uri.startsWith('ipfs://')) return `https://ipfs.io/ipfs/${uri.slice(7)}`;
- if (uri.startsWith('ar://')) return `https://arweave.net/${uri.slice(5)}`;
+ if (uri.startsWith('ar://')) return `https://arweave.net/${uri.slice(5)}`;
return uri;
}
@@ -1054,7 +1192,8 @@ function renderAgentRows(list, onchainAgents, dbAgents) {
const el = document.createElement('div');
el.className = 'row';
- el.style.cssText = 'gap:12px; padding:10px; border:1px solid #2a2a34; border-radius:10px; align-items:flex-start';
+ el.style.cssText =
+ 'gap:12px; padding:10px; border:1px solid #2a2a34; border-radius:10px; align-items:flex-start';
el.innerHTML = `
<div style="flex:0 0 64px; width:64px; height:64px; border-radius:8px; background:#0f0f17; overflow:hidden; display:flex; align-items:center; justify-content:center">
${img ? `<img src="${attr(img)}" alt="" style="max-width:100%;max-height:100%;object-fit:cover" onerror="this.remove()">` : '<span class="muted" style="font-size:10px">no image</span>'}
@@ -1076,12 +1215,15 @@ function renderAgentRows(list, onchainAgents, dbAgents) {
// Surface DB rows that aren't on-chain yet (e.g. registration failed).
for (const a of dbAgents) {
- const hasOnchain = a.erc8004_agent_id != null && onchainAgents.some((o) => String(o.id) === String(a.erc8004_agent_id));
+ const hasOnchain =
+ a.erc8004_agent_id != null &&
+ onchainAgents.some((o) => String(o.id) === String(a.erc8004_agent_id));
if (hasOnchain) continue;
const el = document.createElement('div');
el.className = 'row';
- el.style.cssText = 'gap:12px; padding:10px; border:1px dashed #2a2a34; border-radius:10px; align-items:flex-start; opacity:.85';
+ el.style.cssText =
+ 'gap:12px; padding:10px; border:1px dashed #2a2a34; border-radius:10px; align-items:flex-start; opacity:.85';
el.innerHTML = `
<div style="flex:0 0 64px; width:64px; height:64px; border-radius:8px; background:#0f0f17; display:flex; align-items:center; justify-content:center">
<span class="muted" style="font-size:10px">db only</span>
@@ -1112,22 +1254,30 @@ function renderBilling(root) {
// the dashboard is for managing what already exists.
const WIDGET_TYPE_META = {
- 'turntable': { label: 'Turntable', color: '#6a5cff' },
- 'animation-gallery': { label: 'Animations', color: '#ff5ca8' },
- 'talking-agent': { label: 'Talking Agent', color: '#00e5a0' },
- 'passport': { label: 'Passport', color: '#f0c14b' },
- 'hotspot-tour': { label: 'Hotspot Tour', color: '#5cc8ff' },
+ turntable: { label: 'Turntable', color: '#6a5cff' },
+ 'animation-gallery': { label: 'Animations', color: '#ff5ca8' },
+ 'talking-agent': { label: 'Talking Agent', color: '#00e5a0' },
+ passport: { label: 'Passport', color: '#f0c14b' },
+ 'hotspot-tour': { label: 'Hotspot Tour', color: '#5cc8ff' },
};
const WIDGET_PREFS_KEY = 'dashboard.widgets.prefs';
const DEFAULT_WIDGET_PREFS = { sort: 'updated', type: '', q: '' };
function loadWidgetPrefs() {
- try { return { ...DEFAULT_WIDGET_PREFS, ...JSON.parse(localStorage.getItem(WIDGET_PREFS_KEY) || '{}') }; }
- catch { return { ...DEFAULT_WIDGET_PREFS }; }
+ try {
+ return {
+ ...DEFAULT_WIDGET_PREFS,
+ ...JSON.parse(localStorage.getItem(WIDGET_PREFS_KEY) || '{}'),
+ };
+ } catch {
+ return { ...DEFAULT_WIDGET_PREFS };
+ }
}
function saveWidgetPrefs(prefs) {
- try { localStorage.setItem(WIDGET_PREFS_KEY, JSON.stringify(prefs)); } catch {}
+ try {
+ localStorage.setItem(WIDGET_PREFS_KEY, JSON.stringify(prefs));
+ } catch {}
}
async function renderWidgets(root) {
@@ -1146,14 +1296,18 @@ async function renderWidgets(root) {
<label class="sr-only" for="w-type">Filter by type</label>
<select id="w-type" aria-label="Filter by widget type">
<option value="">All types</option>
- ${Object.entries(WIDGET_TYPE_META).map(([t, m]) =>
- `<option value="${attr(t)}" ${prefs.type===t?'selected':''}>${esc(m.label)}</option>`).join('')}
+ ${Object.entries(WIDGET_TYPE_META)
+ .map(
+ ([t, m]) =>
+ `<option value="${attr(t)}" ${prefs.type === t ? 'selected' : ''}>${esc(m.label)}</option>`,
+ )
+ .join('')}
</select>
<label class="sr-only" for="w-sort">Sort widgets</label>
<select id="w-sort" aria-label="Sort widgets">
- <option value="updated" ${prefs.sort==='updated'?'selected':''}>Recently updated</option>
- <option value="views" ${prefs.sort==='views' ?'selected':''}>Most viewed</option>
- <option value="name" ${prefs.sort==='name' ?'selected':''}>Name (A–Z)</option>
+ <option value="updated" ${prefs.sort === 'updated' ? 'selected' : ''}>Recently updated</option>
+ <option value="views" ${prefs.sort === 'views' ? 'selected' : ''}>Most viewed</option>
+ <option value="name" ${prefs.sort === 'name' ? 'selected' : ''}>Name (A–Z)</option>
</select>
<span id="w-count" class="muted" aria-live="polite"></span>
</div>
@@ -1189,25 +1343,45 @@ async function renderWidgets(root) {
return;
}
const filtered = applyWidgetFilters(widgets, prefs);
- countEl.textContent = filtered.length === widgets.length
- ? `${widgets.length} widget${widgets.length===1?'':'s'}`
- : `${filtered.length} of ${widgets.length}`;
+ countEl.textContent =
+ filtered.length === widgets.length
+ ? `${widgets.length} widget${widgets.length === 1 ? '' : 's'}`
+ : `${filtered.length} of ${widgets.length}`;
list.innerHTML = '';
if (!filtered.length) {
list.innerHTML = `<div class="empty" style="grid-column:1/-1">No widgets match the current filters.</div>`;
return;
}
for (const w of filtered) {
- const card = widgetCard(w, { reload: rerender, mutate: (next) => mutateLocal(widgets, w.id, next), remove: () => { widgets = widgets.filter((x) => x.id !== w.id); rerender(); } });
+ const card = widgetCard(w, {
+ reload: rerender,
+ mutate: (next) => mutateLocal(widgets, w.id, next),
+ remove: () => {
+ widgets = widgets.filter((x) => x.id !== w.id);
+ rerender();
+ },
+ });
list.appendChild(card);
const ifr = card.querySelector('iframe[data-src]');
if (ifr) observer.observe(ifr);
}
}
- root.querySelector('#w-search').addEventListener('input', (e) => { prefs.q = e.target.value; saveWidgetPrefs(prefs); rerender(); });
- root.querySelector('#w-type').addEventListener('change', (e) => { prefs.type = e.target.value; saveWidgetPrefs(prefs); rerender(); });
- root.querySelector('#w-sort').addEventListener('change', (e) => { prefs.sort = e.target.value; saveWidgetPrefs(prefs); rerender(); });
+ root.querySelector('#w-search').addEventListener('input', (e) => {
+ prefs.q = e.target.value;
+ saveWidgetPrefs(prefs);
+ rerender();
+ });
+ root.querySelector('#w-type').addEventListener('change', (e) => {
+ prefs.type = e.target.value;
+ saveWidgetPrefs(prefs);
+ rerender();
+ });
+ root.querySelector('#w-sort').addEventListener('change', (e) => {
+ prefs.sort = e.target.value;
+ saveWidgetPrefs(prefs);
+ rerender();
+ });
rerender();
}
@@ -1225,8 +1399,8 @@ function applyWidgetFilters(widgets, prefs) {
if (q) out = out.filter((w) => (w.name || '').toLowerCase().includes(q));
}
out = [...out];
- if (prefs.sort === 'name') out.sort((a, b) => (a.name || '').localeCompare(b.name || ''));
- if (prefs.sort === 'views') out.sort((a, b) => (b.view_count || 0) - (a.view_count || 0));
+ if (prefs.sort === 'name') out.sort((a, b) => (a.name || '').localeCompare(b.name || ''));
+ if (prefs.sort === 'views') out.sort((a, b) => (b.view_count || 0) - (a.view_count || 0));
if (prefs.sort === 'updated' || !prefs.sort) {
out.sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at));
}
@@ -1253,7 +1427,7 @@ function widgetCard(w, ctx) {
<div class="row" style="justify-content:space-between; gap:8px">
<span class="meta">${formatViewCount(w.view_count)} · updated ${timeAgo(w.updated_at)}</span>
<label class="toggle" title="${w.is_public ? 'Public — anyone with the URL can view' : 'Private — only you can view'}">
- <input type="checkbox" data-public ${w.is_public?'checked':''}>
+ <input type="checkbox" data-public ${w.is_public ? 'checked' : ''}>
<span class="track"></span>
<span class="label">${w.is_public ? 'Public' : 'Private'}</span>
</label>
@@ -1275,7 +1449,12 @@ function widgetCard(w, ctx) {
const toggleInput = card.querySelector('input[data-public]');
toggleInput.addEventListener('change', async () => {
const next = toggleInput.checked;
- if (!next && !confirm('Making this widget private will break any existing embeds on other sites. Continue?')) {
+ if (
+ !next &&
+ !confirm(
+ 'Making this widget private will break any existing embeds on other sites. Continue?',
+ )
+ ) {
toggleInput.checked = true;
return;
}
@@ -1298,7 +1477,9 @@ function widgetCard(w, ctx) {
toast('Duplicated');
// Re-fetch via navigate so the new row's avatar join is populated.
navigate('widgets');
- } catch (err) { toast(err.message || 'Duplicate failed', true); }
+ } catch (err) {
+ toast(err.message || 'Duplicate failed', true);
+ }
});
card.querySelector('[data-delete]').addEventListener('click', async () => {
if (!confirm(`Delete "${w.name || 'this widget'}"? This cannot be undone.`)) return;
@@ -1308,7 +1489,9 @@ function widgetCard(w, ctx) {
card.style.opacity = '0';
setTimeout(() => ctx.remove(), 220);
toast('Deleted');
- } catch (err) { toast(err.message || 'Delete failed', true); }
+ } catch (err) {
+ toast(err.message || 'Delete failed', true);
+ }
});
return card;
@@ -1329,7 +1512,8 @@ function beginRename(card, w, ctx) {
let settled = false;
const restore = (text) => {
- if (settled) return; settled = true;
+ if (settled) return;
+ settled = true;
const h = document.createElement('h3');
h.textContent = text;
h.title = 'Double-click to rename';
@@ -1338,14 +1522,22 @@ function beginRename(card, w, ctx) {
};
input.addEventListener('keydown', (e) => {
- if (e.key === 'Enter') { e.preventDefault(); commit(); }
- else if (e.key === 'Escape') { e.preventDefault(); restore(original); }
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ commit();
+ } else if (e.key === 'Escape') {
+ e.preventDefault();
+ restore(original);
+ }
});
input.addEventListener('blur', commit);
async function commit() {
const next = input.value.trim();
- if (!next || next === original) { restore(original); return; }
+ if (!next || next === original) {
+ restore(original);
+ return;
+ }
try {
await api.patchWidget(w.id, { name: next });
ctx.mutate({ name: next });
@@ -1361,16 +1553,23 @@ function beginRename(card, w, ctx) {
function lazyIframeObserver() {
if (typeof IntersectionObserver === 'undefined') {
// Fallback — eagerly hydrate. Old browsers shouldn't pay this a/b cost.
- return { observe(el) { hydrate(el); } };
+ return {
+ observe(el) {
+ hydrate(el);
+ },
+ };
}
- const io = new IntersectionObserver((entries) => {
- for (const entry of entries) {
- if (entry.isIntersecting) {
- hydrate(entry.target);
- io.unobserve(entry.target);
+ const io = new IntersectionObserver(
+ (entries) => {
+ for (const entry of entries) {
+ if (entry.isIntersecting) {
+ hydrate(entry.target);
+ io.unobserve(entry.target);
+ }
}
- }
- }, { rootMargin: '120px' });
+ },
+ { rootMargin: '120px' },
+ );
return io;
function hydrate(el) {
const src = el.getAttribute('data-src');
@@ -1389,7 +1588,7 @@ async function openWidgetDrawer(w, ctx) {
drawer.tabIndex = -1;
const previewSrc = `/#widget=${encodeURIComponent(w.id)}&kiosk=true&preview=1`;
- const pageUrl = `${location.origin}/w/${encodeURIComponent(w.id)}`;
+ const pageUrl = `${location.origin}/w/${encodeURIComponent(w.id)}`;
const iframeSnippet = makeIframeSnippet(w, pageUrl, 600, 600);
const scriptSnippet = `<script async src="${location.origin}/embed.js" data-widget="${esc(w.id)}"></script>`;
const meta = WIDGET_TYPE_META[w.type] || { label: w.type, color: '#888' };
@@ -1437,15 +1636,24 @@ async function openWidgetDrawer(w, ctx) {
document.body.appendChild(overlay);
document.body.appendChild(drawer);
- requestAnimationFrame(() => { overlay.classList.add('open'); drawer.classList.add('open'); });
+ requestAnimationFrame(() => {
+ overlay.classList.add('open');
+ drawer.classList.add('open');
+ });
drawer.focus();
const close = () => {
overlay.classList.remove('open');
drawer.classList.remove('open');
- setTimeout(() => { overlay.remove(); drawer.remove(); document.removeEventListener('keydown', onKey); }, 220);
+ setTimeout(() => {
+ overlay.remove();
+ drawer.remove();
+ document.removeEventListener('keydown', onKey);
+ }, 220);
+ };
+ const onKey = (e) => {
+ if (e.key === 'Escape') close();
};
- const onKey = (e) => { if (e.key === 'Escape') close(); };
document.addEventListener('keydown', onKey);
overlay.addEventListener('click', close);
drawer.querySelector('[data-close]').addEventListener('click', close);
@@ -1464,7 +1672,9 @@ async function openWidgetDrawer(w, ctx) {
toast('Deleted');
close();
ctx?.remove?.();
- } catch (err) { toast(err.message || 'Delete failed', true); }
+ } catch (err) {
+ toast(err.message || 'Delete failed', true);
+ }
});
// Stats — load async, render sparkline.
@@ -1472,15 +1682,17 @@ async function openWidgetDrawer(w, ctx) {
const { stats } = await api.widgetStats(w.id);
drawer.querySelector('#stats-region').innerHTML = renderStatsPanel(w, stats);
} catch (err) {
- drawer.querySelector('#stats-region').innerHTML = `<div class="err">${esc(err.message || 'Failed to load stats')}</div>`;
+ drawer.querySelector('#stats-region').innerHTML =
+ `<div class="err">${esc(err.message || 'Failed to load stats')}</div>`;
}
}
function renderStatsPanel(w, stats) {
const total7d = (stats.recent_views_7d || []).reduce((s, d) => s + (d.count || 0), 0);
- const chatLine = stats.chat_count !== null && stats.chat_count !== undefined
- ? `<div class="stat"><div class="n">${formatNum(stats.chat_count)}</div><div class="l">Chats (lifetime)</div></div>`
- : '';
+ const chatLine =
+ stats.chat_count !== null && stats.chat_count !== undefined
+ ? `<div class="stat"><div class="n">${formatNum(stats.chat_count)}</div><div class="l">Chats (lifetime)</div></div>`
+ : '';
const lastSeen = stats.last_viewed_at
? `<div class="muted" style="margin-top:4px; font-size:12px">Last viewed ${timeAgo(stats.last_viewed_at)}</div>`
: '';
@@ -1504,7 +1716,9 @@ function renderStatsPanel(w, stats) {
function sparkline(days) {
if (!days.length) return '<div class="muted" style="font-size:12px">No views yet</div>';
- const W = 480, H = 60, P = 4;
+ const W = 480,
+ H = 60,
+ P = 4;
const max = Math.max(1, ...days.map((d) => d.count || 0));
const stepX = (W - 2 * P) / Math.max(1, days.length - 1);
const pts = days.map((d, i) => {
@@ -1512,13 +1726,19 @@ function sparkline(days) {
const y = H - P - ((d.count || 0) / max) * (H - 2 * P);
return [x, y];
});
- const linePath = pts.map((p, i) => (i === 0 ? `M${p[0].toFixed(1)},${p[1].toFixed(1)}` : `L${p[0].toFixed(1)},${p[1].toFixed(1)}`)).join(' ');
- const areaPath = `${linePath} L${pts[pts.length-1][0].toFixed(1)},${H-P} L${pts[0][0].toFixed(1)},${H-P} Z`;
+ const linePath = pts
+ .map((p, i) =>
+ i === 0
+ ? `M${p[0].toFixed(1)},${p[1].toFixed(1)}`
+ : `L${p[0].toFixed(1)},${p[1].toFixed(1)}`,
+ )
+ .join(' ');
+ const areaPath = `${linePath} L${pts[pts.length - 1][0].toFixed(1)},${H - P} L${pts[0][0].toFixed(1)},${H - P} Z`;
const allZero = days.every((d) => !d.count);
- const labels = `${esc(days[0].day)} → ${esc(days[days.length-1].day)}`;
+ const labels = `${esc(days[0].day)} → ${esc(days[days.length - 1].day)}`;
return `
<svg class="spark" viewBox="0 0 ${W} ${H}" preserveAspectRatio="none" role="img" aria-label="Views over the last 7 days, ${days.map((d) => `${d.day}: ${d.count}`).join(', ')}">
- <line class="axis" x1="${P}" y1="${H-P}" x2="${W-P}" y2="${H-P}"></line>
+ <line class="axis" x1="${P}" y1="${H - P}" x2="${W - P}" y2="${H - P}"></line>
${allZero ? '' : `<path class="area" d="${areaPath}"></path><path class="line" d="${linePath}"></path>`}
</svg>
<div class="muted" style="font-size:11px; display:flex; justify-content:space-between; padding:0 4px">
@@ -1531,10 +1751,10 @@ function sparkline(days) {
// ── Share modal ─────────────────────────────────────────────────────────────
function openShareModal(w) {
const SIZES = [
- { label: 'Small', width: 320, height: 320 },
- { label: 'Medium', width: 600, height: 600 },
+ { label: 'Small', width: 320, height: 320 },
+ { label: 'Medium', width: 600, height: 600 },
{ label: 'Banner', width: 1200, height: 400 },
- { label: 'Custom', width: 0, height: 0 },
+ { label: 'Custom', width: 0, height: 0 },
];
let active = 1;
let dim = { ...SIZES[active] };
@@ -1547,11 +1767,11 @@ function openShareModal(w) {
<h2>Share "${esc(w.name || 'widget')}"</h2>
<p class="sub">Pick a size, copy the iframe, and you're done.</p>
<div class="size-presets" role="tablist">
- ${SIZES.map((s, i) => `<button type="button" data-i="${i}" class="${i===active?'active':''}" role="tab" aria-selected="${i===active}">${esc(s.label)}${s.width?` (${s.width}×${s.height})`:''}</button>`).join('')}
+ ${SIZES.map((s, i) => `<button type="button" data-i="${i}" class="${i === active ? 'active' : ''}" role="tab" aria-selected="${i === active}">${esc(s.label)}${s.width ? ` (${s.width}×${s.height})` : ''}</button>`).join('')}
</div>
<div class="size-inputs">
- <label class="muted" style="font-size:12px">W <input id="m-w" type="number" min="120" max="2000" value="${dim.width||600}"></label>
- <label class="muted" style="font-size:12px">H <input id="m-h" type="number" min="120" max="2000" value="${dim.height||600}"></label>
+ <label class="muted" style="font-size:12px">W <input id="m-w" type="number" min="120" max="2000" value="${dim.width || 600}"></label>
+ <label class="muted" style="font-size:12px">H <input id="m-h" type="number" min="120" max="2000" value="${dim.height || 600}"></label>
</div>
<div style="background:#0f0f17; border:1px solid var(--border); border-radius:10px; padding:12px; margin-bottom:12px">
<div class="muted" style="font-size:11px; margin-bottom:8px">Live preview (scaled to fit)</div>
@@ -1579,7 +1799,8 @@ function openShareModal(w) {
const snippet = makeIframeSnippet(w, pageUrl, dim.width, dim.height);
snipEl.textContent = snippet;
// Live preview at scaled size — fit within 320×320 while preserving ratio.
- const maxW = 320, maxH = 320;
+ const maxW = 320,
+ maxH = 320;
const scale = Math.min(maxW / dim.width, maxH / dim.height, 1);
previewEl.innerHTML = `<iframe src="/#widget=${encodeURIComponent(w.id)}&kiosk=true&preview=1" style="width:${dim.width}px; height:${dim.height}px; border:0; transform:scale(${scale}); transform-origin:center" title="Preview"></iframe>`;
previewEl.style.width = `${dim.width * scale}px`;
@@ -1593,7 +1814,8 @@ function openShareModal(w) {
});
if (SIZES[i].width) {
dim = { width: SIZES[i].width, height: SIZES[i].height };
- wInput.value = dim.width; hInput.value = dim.height;
+ wInput.value = dim.width;
+ hInput.value = dim.height;
}
refresh();
}
@@ -1601,7 +1823,10 @@ function openShareModal(w) {
b.addEventListener('click', () => setPreset(Number(b.dataset.i)));
});
const onDimChange = () => {
- dim = { width: clampInt(wInput.value, 120, 2000, 600), height: clampInt(hInput.value, 120, 2000, 600) };
+ dim = {
+ width: clampInt(wInput.value, 120, 2000, 600),
+ height: clampInt(hInput.value, 120, 2000, 600),
+ };
// Switch to "Custom" preset when typing.
setPresetSilent(SIZES.length - 1);
refresh();
@@ -1618,13 +1843,22 @@ function openShareModal(w) {
const close = () => {
overlay.classList.remove('open');
- setTimeout(() => { overlay.remove(); document.removeEventListener('keydown', onKey); }, 200);
+ setTimeout(() => {
+ overlay.remove();
+ document.removeEventListener('keydown', onKey);
+ }, 200);
+ };
+ const onKey = (e) => {
+ if (e.key === 'Escape') close();
};
- const onKey = (e) => { if (e.key === 'Escape') close(); };
document.addEventListener('keydown', onKey);
- overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) close();
+ });
overlay.querySelector('#m-close').addEventListener('click', close);
- overlay.querySelector('#m-copy').addEventListener('click', (e) => copyToClipboard(snipEl.textContent, e.currentTarget));
+ overlay
+ .querySelector('#m-copy')
+ .addEventListener('click', (e) => copyToClipboard(snipEl.textContent, e.currentTarget));
refresh();
}
@@ -1648,7 +1882,9 @@ async function copyToClipboard(text, btn) {
if (btn) {
const orig = btn.textContent;
btn.textContent = 'Copied';
- setTimeout(() => { btn.textContent = orig; }, 1100);
+ setTimeout(() => {
+ btn.textContent = orig;
+ }, 1100);
}
} catch {
toast('Copy failed — select and ⌘C manually', true);
@@ -1662,11 +1898,18 @@ function toast(message, isError = false) {
clearTimeout(_toastTimer);
const el = document.createElement('div');
el.className = 'toast';
- if (isError) { el.style.color = '#ffb3b3'; el.style.borderColor = 'rgba(255,92,92,.4)'; }
+ if (isError) {
+ el.style.color = '#ffb3b3';
+ el.style.borderColor = 'rgba(255,92,92,.4)';
+ }
el.setAttribute('role', isError ? 'alert' : 'status');
el.textContent = message;
document.body.appendChild(el);
- _toastTimer = setTimeout(() => { el.style.opacity = '0'; el.style.transition = 'opacity .25s'; setTimeout(() => el.remove(), 260); }, 2200);
+ _toastTimer = setTimeout(() => {
+ el.style.opacity = '0';
+ el.style.transition = 'opacity .25s';
+ setTimeout(() => el.remove(), 260);
+ }, 2200);
}
function timeAgo(ts) {
@@ -1674,22 +1917,22 @@ function timeAgo(ts) {
const then = new Date(ts).getTime();
const now = Date.now();
const sec = Math.max(1, Math.round((now - then) / 1000));
- if (sec < 60) return `${sec}s ago`;
+ if (sec < 60) return `${sec}s ago`;
const min = Math.round(sec / 60);
- if (min < 60) return `${min}m ago`;
- const hr = Math.round(min / 60);
- if (hr < 24) return `${hr}h ago`;
+ if (min < 60) return `${min}m ago`;
+ const hr = Math.round(min / 60);
+ if (hr < 24) return `${hr}h ago`;
const day = Math.round(hr / 24);
- if (day < 30) return `${day}d ago`;
- const mo = Math.round(day / 30);
- if (mo < 12) return `${mo}mo ago`;
+ if (day < 30) return `${day}d ago`;
+ const mo = Math.round(day / 30);
+ if (mo < 12) return `${mo}mo ago`;
return `${Math.round(mo / 12)}y ago`;
}
function formatNum(n) {
const v = Number(n || 0);
- if (v < 1000) return String(v);
- if (v < 10000) return (v / 1000).toFixed(1).replace(/\.0$/, '') + 'k';
+ if (v < 1000) return String(v);
+ if (v < 10000) return (v / 1000).toFixed(1).replace(/\.0$/, '') + 'k';
if (v < 1_000_000) return Math.round(v / 1000) + 'k';
return (v / 1_000_000).toFixed(1).replace(/\.0$/, '') + 'M';
}
@@ -1718,20 +1961,30 @@ async function renderAnimations(root) {
try {
const res = await api.getAgentMe();
agent = res?.agent;
- if (!agent) { body.innerHTML = `<div class="empty">No agent found. <a href="#create">Create one first.</a></div>`; return; }
+ if (!agent) {
+ body.innerHTML = `<div class="empty">No agent found. <a href="#create">Create one first.</a></div>`;
+ return;
+ }
if (agent.avatar_id) {
try {
const av = await api.getAvatar(agent.avatar_id);
avatarUrl = av?.avatar?.url || av?.avatar?.model_url;
- } catch { /* no avatar URL */ }
+ } catch {
+ /* no avatar URL */
+ }
}
} catch (e) {
- body.innerHTML = `<div class="err">${esc(e.message)}</div>`; return;
+ body.innerHTML = `<div class="err">${esc(e.message)}</div>`;
+ return;
}
let animations = Array.isArray(agent.meta?.animations) ? [...agent.meta.animations] : [];
let presets = [];
- try { presets = await fetch('/animations/presets.json').then((r) => r.json()); } catch { /* presets unavailable */ }
+ try {
+ presets = await fetch('/animations/presets.json').then((r) => r.json());
+ } catch {
+ /* presets unavailable */
+ }
let saveTimer;
const statusEl = document.createElement('p');
@@ -1747,7 +2000,9 @@ async function renderAnimations(root) {
await api.patchAgentAnimations(agent.id, animations);
statusEl.style.color = '#9a8cff';
statusEl.textContent = 'Saved.';
- setTimeout(() => { if (statusEl.textContent === 'Saved.') statusEl.textContent = ''; }, 2000);
+ setTimeout(() => {
+ if (statusEl.textContent === 'Saved.') statusEl.textContent = '';
+ }, 2000);
} catch (err) {
statusEl.style.color = '#ffb3b3';
statusEl.textContent = err.message || 'Save failed.';
@@ -1755,14 +2010,17 @@ async function renderAnimations(root) {
}, 500);
}
- function isAttached(name) { return animations.some((a) => a.name.toLowerCase() === name.toLowerCase()); }
+ function isAttached(name) {
+ return animations.some((a) => a.name.toLowerCase() === name.toLowerCase());
+ }
let listEl, presetGridEl;
function renderClipList() {
listEl.innerHTML = '';
if (!animations.length) {
- listEl.innerHTML = '<div class="muted" style="padding:12px 0">No clips attached yet.</div>';
+ listEl.innerHTML =
+ '<div class="muted" style="padding:12px 0">No clips attached yet.</div>';
return;
}
for (const clip of animations) {
@@ -1790,7 +2048,9 @@ async function renderAnimations(root) {
renderPresetGrid();
debounceSync();
});
- row.querySelector('.preview-btn').addEventListener('click', () => openAnimPreview(clip, avatarUrl));
+ row.querySelector('.preview-btn').addEventListener('click', () =>
+ openAnimPreview(clip, avatarUrl),
+ );
listEl.appendChild(row);
}
}
@@ -1805,8 +2065,18 @@ async function renderAnimations(root) {
tile.innerHTML = `<div class="icon">${esc(p.icon || '🎬')}</div><div class="label">${esc(p.label || p.name)}</div>`;
tile.title = attached ? 'Already attached' : `Add "${p.name}"`;
tile.addEventListener('click', () => {
- if (isAttached(p.name)) { toast('Already attached'); return; }
- animations.push({ name: p.name, url: p.url, loop: p.loop !== false, clipName: p.clipName || undefined, source: 'preset', addedAt: new Date().toISOString() });
+ if (isAttached(p.name)) {
+ toast('Already attached');
+ return;
+ }
+ animations.push({
+ name: p.name,
+ url: p.url,
+ loop: p.loop !== false,
+ clipName: p.clipName || undefined,
+ source: 'preset',
+ addedAt: new Date().toISOString(),
+ });
renderClipList();
renderPresetGrid();
debounceSync();
@@ -1879,18 +2149,46 @@ async function renderAnimations(root) {
const name = nameEl.value.trim();
const file = fileEl.files?.[0];
uploadErr.textContent = '';
- if (!name) { uploadErr.textContent = 'Name is required.'; return; }
- if (name.length > 60) { uploadErr.textContent = 'Name too long (max 60 chars).'; return; }
- if (isAttached(name)) { uploadErr.textContent = `"${name}" is already attached.`; return; }
- if (!file) { uploadErr.textContent = 'Select a .glb file.'; return; }
+ if (!name) {
+ uploadErr.textContent = 'Name is required.';
+ return;
+ }
+ if (name.length > 60) {
+ uploadErr.textContent = 'Name too long (max 60 chars).';
+ return;
+ }
+ if (isAttached(name)) {
+ uploadErr.textContent = `"${name}" is already attached.`;
+ return;
+ }
+ if (!file) {
+ uploadErr.textContent = 'Select a .glb file.';
+ return;
+ }
uploadBtn.disabled = true;
uploadProgress.textContent = 'Requesting upload URL…';
try {
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'anim';
- const { upload_url, storage_key } = await api.presignAnimation({ size_bytes: file.size, content_type: 'model/gltf-binary', slug });
+ const slug =
+ name
+ .toLowerCase()
+ .replace(/[^a-z0-9]+/g, '-')
+ .replace(/^-|-$/g, '') || 'anim';
+ const { upload_url, storage_key } = await api.presignAnimation({
+ size_bytes: file.size,
+ content_type: 'model/gltf-binary',
+ slug,
+ });
uploadProgress.textContent = `Uploading ${fmtSize(file.size)}…`;
- await _uploadXHR(upload_url, file, (pct) => { uploadProgress.textContent = `Uploading ${pct}%…`; });
- animations.push({ name, url: storage_key, loop: true, source: 'custom', addedAt: new Date().toISOString() });
+ await _uploadXHR(upload_url, file, (pct) => {
+ uploadProgress.textContent = `Uploading ${pct}%…`;
+ });
+ animations.push({
+ name,
+ url: storage_key,
+ loop: true,
+ source: 'custom',
+ addedAt: new Date().toISOString(),
+ });
renderClipList();
renderPresetGrid();
debounceSync();
@@ -1911,8 +2209,12 @@ function _uploadXHR(url, file, onProgress) {
const xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.setRequestHeader('content-type', 'model/gltf-binary');
- xhr.upload.onprogress = (e) => e.lengthComputable && onProgress(Math.round((e.loaded / e.total) * 100));
- xhr.onload = () => (xhr.status >= 200 && xhr.status < 300 ? resolve() : reject(new Error(`Upload failed (${xhr.status})`)));
+ xhr.upload.onprogress = (e) =>
+ e.lengthComputable && onProgress(Math.round((e.loaded / e.total) * 100));
+ xhr.onload = () =>
+ xhr.status >= 200 && xhr.status < 300
+ ? resolve()
+ : reject(new Error(`Upload failed (${xhr.status})`));
xhr.onerror = () => reject(new Error('Network error'));
xhr.send(file);
});
@@ -1922,11 +2224,19 @@ let _animPreviewEl = null;
async function _ensureAgent3DLib() {
if (customElements.get('agent-3d')) return true;
- try { await import('/dist-lib/agent-3d.js'); return true; } catch { return false; }
+ try {
+ await import('/dist-lib/agent-3d.js');
+ return true;
+ } catch {
+ return false;
+ }
}
async function openAnimPreview(clip, avatarUrl) {
- if (!avatarUrl) { toast('No avatar URL available for preview', true); return; }
+ if (!avatarUrl) {
+ toast('No avatar URL available for preview', true);
+ return;
+ }
let overlay = document.getElementById('anim-preview-overlay');
if (!overlay) {
@@ -1945,7 +2255,9 @@ async function openAnimPreview(clip, avatarUrl) {
`;
document.body.appendChild(overlay);
overlay.querySelector('#ap-close').addEventListener('click', closeAnimPreview);
- overlay.addEventListener('click', (e) => { if (e.target === overlay) closeAnimPreview(); });
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) closeAnimPreview();
+ });
}
closeAnimPreview();
@@ -1957,7 +2269,10 @@ async function openAnimPreview(clip, avatarUrl) {
status.textContent = 'Loading library…';
const ok = await _ensureAgent3DLib();
- if (!ok) { status.textContent = 'Could not load 3D viewer.'; return; }
+ if (!ok) {
+ status.textContent = 'Could not load 3D viewer.';
+ return;
+ }
const el = document.createElement('agent-3d');
el.setAttribute('body', avatarUrl);
@@ -1970,23 +2285,44 @@ async function openAnimPreview(clip, avatarUrl) {
status.textContent = 'Loading avatar…';
try {
await new Promise((resolve, reject) => {
- const onReady = () => { el.removeEventListener('agent:ready', onReady); el.removeEventListener('agent:error', onErr); resolve(); };
- const onErr = (e) => { el.removeEventListener('agent:ready', onReady); el.removeEventListener('agent:error', onErr); reject(new Error(e.detail?.error?.message || 'load failed')); };
+ const onReady = () => {
+ el.removeEventListener('agent:ready', onReady);
+ el.removeEventListener('agent:error', onErr);
+ resolve();
+ };
+ const onErr = (e) => {
+ el.removeEventListener('agent:ready', onReady);
+ el.removeEventListener('agent:error', onErr);
+ reject(new Error(e.detail?.error?.message || 'load failed'));
+ };
el.addEventListener('agent:ready', onReady);
el.addEventListener('agent:error', onErr);
});
- } catch (e) { status.textContent = `Error: ${e.message}`; return; }
+ } catch (e) {
+ status.textContent = `Error: ${e.message}`;
+ return;
+ }
let hasBones = false;
- el._scene?.content?.traverse?.((n) => { if (n.isBone) hasBones = true; });
- if (!hasBones) { status.textContent = 'This avatar has no skeleton — clips cannot be previewed.'; return; }
+ el._scene?.content?.traverse?.((n) => {
+ if (n.isBone) hasBones = true;
+ });
+ if (!hasBones) {
+ status.textContent = 'This avatar has no skeleton — clips cannot be previewed.';
+ return;
+ }
status.textContent = `Loading clip "${clip.name}"…`;
try {
const gltf = await el._scene.loadGLB(clip.url);
const clips = gltf?.animations || [];
- const target = clip.clipName ? (clips.find((c) => c.name === clip.clipName) || clips[0]) : clips[0];
- if (!target) { status.textContent = 'No animation found in clip file.'; return; }
+ const target = clip.clipName
+ ? clips.find((c) => c.name === clip.clipName) || clips[0]
+ : clips[0];
+ if (!target) {
+ status.textContent = 'No animation found in clip file.';
+ return;
+ }
await el._scene.play(target, { blend: 0.35 });
status.textContent = `Playing "${clip.name}"`;
} catch (e) {
@@ -1996,8 +2332,12 @@ async function openAnimPreview(clip, avatarUrl) {
function closeAnimPreview() {
if (_animPreviewEl) {
- try { _animPreviewEl.destroy?.(); } catch {}
- try { _animPreviewEl.remove(); } catch {}
+ try {
+ _animPreviewEl.destroy?.();
+ } catch {}
+ try {
+ _animPreviewEl.remove();
+ } catch {}
_animPreviewEl = null;
}
const stage = document.getElementById('ap-stage');
@@ -2007,6 +2347,17 @@ function closeAnimPreview() {
}
// ── utils ───────────────────────────────────────────────────────────────────
-function fmtSize(b) { if (b < 1024) return b + ' B'; if (b < 1024*1024) return (b/1024).toFixed(1) + ' KB'; return (b/1024/1024).toFixed(1) + ' MB'; }
-function esc(s) { return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;' }[c])); }
-function attr(s) { return esc(s); }
+function fmtSize(b) {
+ if (b < 1024) return b + ' B';
+ if (b < 1024 * 1024) return (b / 1024).toFixed(1) + ' KB';
+ return (b / 1024 / 1024).toFixed(1) + ' MB';
+}
+function esc(s) {
+ return String(s ?? '').replace(
+ /[&<>"']/g,
+ (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c],
+ );
+}
+function attr(s) {
+ return esc(s);
+}
diff --git a/dist-lib/register.html b/dist-lib/register.html
deleted file mode 100644
index 6aa2c0284..000000000
--- a/dist-lib/register.html
+++ /dev/null
@@ -1,92 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width,initial-scale=1">
-<title>Create account · 3D Agent</title>
-<link rel="icon" href="/favicon.ico">
-<meta name="privy-app-id" content="">
-<style>
- :root { color-scheme: dark; --accent:#6a5cff; --accent2:#ff5ca8; }
- * { box-sizing: border-box; }
- body { font: 15px/1.5 -apple-system,system-ui,Segoe UI,Roboto,sans-serif; background:radial-gradient(1200px 600px at 50% -100px,#1a1a2e 0,#080814 60%); color:#eee; margin:0; min-height:100vh; display:grid; place-items:center; padding:24px; }
- a { color:#9a8cff; }
- .card { background:#14141c; border:1px solid #2a2a36; border-radius:16px; padding:32px; max-width:400px; width:100%; box-shadow:0 10px 40px rgba(0,0,0,.5); }
- h1 { font-size:22px; margin:0 0 4px; letter-spacing:-0.01em; }
- .sub { color:#888; margin:0 0 24px; font-size:14px; }
- label { display:block; font-size:13px; color:#aaa; margin:14px 0 6px; }
- input { width:100%; padding:11px 13px; background:#0f0f17; border:1px solid #2a2a36; border-radius:9px; color:#eee; font-size:15px; }
- input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(106,92,255,.15); }
- .hint { font-size:12px; color:#666; margin-top:5px; }
- button { width:100%; margin-top:20px; padding:12px 16px; border:0; border-radius:10px; background:linear-gradient(135deg,var(--accent),var(--accent2)); color:#fff; font-weight:600; font-size:15px; cursor:pointer; }
- button:disabled { opacity:.6; cursor:default; }
- .err { margin-top:14px; padding:10px 12px; background:rgba(255,92,92,.1); border:1px solid rgba(255,92,92,.3); border-radius:8px; color:#ffb3b3; font-size:13px; display:none; }
- .foot { margin-top:20px; text-align:center; font-size:13px; color:#888; }
- .brand { font-size:12px; letter-spacing:.1em; text-transform:uppercase; color:var(--accent); margin:0 0 8px; }
- .wallet-btn { background:#1c1c28; border:1px solid #2a2a36; color:#eee; font-weight:500; margin-top:12px; display:flex; align-items:center; justify-content:center; gap:8px; }
- .wallet-btn:hover { background:#22222e; border-color:var(--accent); }
- .divider { display:flex; align-items:center; gap:12px; margin:22px 0 4px; color:#555; font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
- .divider::before, .divider::after { content:''; flex:1; height:1px; background:#2a2a36; }
- .wallet-icon { width:18px; height:18px; }
-</style>
-</head>
-<body>
-<form class="card" id="f">
- <p class="brand">3D Agent</p>
- <h1>Create your account</h1>
- <p class="sub">Free plan: 10 avatars, 250 MB storage.</p>
- <label for="name">Name</label>
- <input id="name" type="text" autocomplete="name" maxlength="80">
- <label for="email">Email</label>
- <input id="email" type="email" autocomplete="email" required>
- <label for="password">Password</label>
- <input id="password" type="password" autocomplete="new-password" required minlength="10">
- <div class="hint">At least 10 characters.</div>
- <button id="submit" type="submit">Create account</button>
- <div class="divider">or</div>
- <button id="privy" type="button" class="wallet-btn" style="background:linear-gradient(135deg,var(--accent),var(--accent2)); border-color:transparent; color:#fff">
- <svg class="wallet-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M20 21a8 8 0 0 0-16 0"/></svg>
- Continue with Privy
- </button>
- <button id="wallet" type="button" class="wallet-btn">
- <svg class="wallet-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="20" height="14" rx="2"/><path d="M16 12h2"/></svg>
- Continue with MetaMask
- </button>
- <div class="err" id="err"></div>
- <p class="foot">Already have one? <a href="/login">Sign in</a></p>
-</form>
-<script type="module" src="/wallet-login.js"></script>
-<script>
-const params = new URLSearchParams(location.search);
-const next = params.get('next') || '/dashboard/';
-const form = document.getElementById('f');
-const err = document.getElementById('err');
-const btn = document.getElementById('submit');
-form.addEventListener('submit', async (e) => {
- e.preventDefault();
- err.style.display = 'none';
- btn.disabled = true; btn.textContent = 'Creating…';
- try {
- const res = await fetch('/api/auth/register', {
- method: 'POST',
- credentials: 'include',
- headers: { 'content-type': 'application/json' },
- body: JSON.stringify({
- email: document.getElementById('email').value,
- password: document.getElementById('password').value,
- display_name: document.getElementById('name').value || undefined,
- }),
- });
- const data = await res.json();
- if (!res.ok) throw new Error(data.error_description || 'Sign-up failed');
- try { localStorage.setItem('3dagent:auth-hint', JSON.stringify({ authed: true, ts: Date.now() })); } catch { /* ignore */ }
- location.href = next;
- } catch (e) {
- err.textContent = e.message;
- err.style.display = 'block';
- btn.disabled = false; btn.textContent = 'Create account';
- }
-});
-</script>
-</body>
-</html>
diff --git a/package.json b/package.json
index 064338ab9..8875e652f 100644
--- a/package.json
+++ b/package.json
@@ -37,14 +37,15 @@
"dev:lib": "TARGET=lib vite",
"build": "vite build",
"build:lib": "TARGET=lib vite build",
- "build:all": "npm run build && npm run build:lib",
+ "publish:lib": "node scripts/publish-lib.mjs",
+ "build:all": "npm run build && npm run build:lib && npm run publish:lib",
"clean": "rm -rf dist/* dist-lib/* || true",
"generate-icons": "node scripts/generate-pwa-icons.mjs",
"fetch-animations": "node scripts/download-animations.mjs",
"test": "echo 'No tests configured' && exit 0",
"verify": "prettier --check . && vite build",
"format": "prettier --write .",
- "deploy": "npm run build && vercel --local-config vercel.json --prod",
+ "deploy": "npm run build:all && vercel --local-config vercel.json --prod",
"postversion": "git push && git push --tags"
},
"dependencies": {
diff --git a/scripts/publish-lib.mjs b/scripts/publish-lib.mjs
new file mode 100644
index 000000000..7fc0234c6
--- /dev/null
+++ b/scripts/publish-lib.mjs
@@ -0,0 +1,90 @@
+#!/usr/bin/env node
+// Copies the CDN bundle from dist-lib/ into dist/agent-3d/<version>/
+// and moving aliases (<major>, <major>.<minor>, latest). Emits SRI hashes
+// and a versions.json manifest so embedders can pin with integrity.
+//
+// Run after `vite build && TARGET=lib vite build` — see npm run build:all.
+
+import { readFileSync, writeFileSync, mkdirSync, existsSync, copyFileSync } from 'node:fs';
+import { createHash } from 'node:crypto';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const here = dirname(fileURLToPath(import.meta.url));
+const root = resolve(here, '..');
+
+const pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8'));
+const version = pkg.version;
+const match = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(version);
+if (!match) {
+ console.error(`[publish-lib] package.json version "${version}" is not semver`);
+ process.exit(1);
+}
+const [, major, minor] = match;
+
+const srcDir = resolve(root, 'dist-lib');
+const destRoot = resolve(root, 'dist', 'agent-3d');
+
+const files = [
+ { name: 'agent-3d.js', required: true },
+ { name: 'agent-3d.umd.cjs', required: true },
+];
+
+for (const f of files) {
+ const p = resolve(srcDir, f.name);
+ if (!existsSync(p)) {
+ if (f.required) {
+ console.error(`[publish-lib] missing ${p} — did you run \`npm run build:lib\`?`);
+ process.exit(1);
+ }
+ f.skip = true;
+ }
+}
+
+mkdirSync(destRoot, { recursive: true });
+
+const channels = [version, `${major}.${minor}`, major, 'latest'];
+const sri = {};
+
+for (const f of files) {
+ if (f.skip) continue;
+ const bytes = readFileSync(resolve(srcDir, f.name));
+ const hash = createHash('sha384').update(bytes).digest('base64');
+ sri[f.name] = `sha384-${hash}`;
+
+ for (const channel of channels) {
+ const outDir = resolve(destRoot, channel);
+ mkdirSync(outDir, { recursive: true });
+ writeFileSync(resolve(outDir, f.name), bytes);
+ }
+}
+
+// Per-version SRI sidecars under the immutable path only.
+const immutableDir = resolve(destRoot, version);
+writeFileSync(
+ resolve(immutableDir, 'integrity.json'),
+ JSON.stringify({ version, integrity: sri }, null, '\t') + '\n',
+);
+
+const versions = {
+ latest: version,
+ channels: {
+ [version]: { integrity: sri, immutable: true },
+ [`${major}.${minor}`]: { tracks: `>=${major}.${minor}.0 <${major}.${Number(minor) + 1}.0` },
+ [major]: { tracks: `>=${major}.0.0 <${Number(major) + 1}.0.0` },
+ latest: { tracks: '*' },
+ },
+ publishedAt: new Date().toISOString(),
+};
+writeFileSync(resolve(destRoot, 'versions.json'), JSON.stringify(versions, null, '\t') + '\n');
+
+const sizes = files
+ .filter((f) => !f.skip)
+ .map((f) => {
+ const bytes = readFileSync(resolve(srcDir, f.name)).byteLength;
+ return `${f.name}: ${(bytes / 1024).toFixed(1)} KiB`;
+ })
+ .join(', ');
+
+console.log(`[publish-lib] v${version} → dist/agent-3d/{${channels.join(',')}}/ (${sizes})`);
+for (const [name, hash] of Object.entries(sri)) console.log(`[publish-lib] ${name} ${hash}`);
diff --git a/specs/EMBED_SPEC.md b/specs/EMBED_SPEC.md
index 0f7a83050..ae4e7cae3 100644
--- a/specs/EMBED_SPEC.md
+++ b/specs/EMBED_SPEC.md
@@ -16,89 +16,89 @@ That's the full install for 95% of users. Everything below is optional.
### Source (pick one)
-| Attribute | Form | Example |
-|---|---|---|
-| `src` | on-chain URI | `agent://base/42` |
-| `manifest` | IPFS or HTTPS manifest URL | `ipfs://bafy.../manifest.json` |
-| `body` | bare GLB (ad-hoc agent) | `ipfs://bafy.../cz.glb` or `./cz.glb` |
+| Attribute | Form | Example |
+| ---------- | -------------------------- | ------------------------------------- |
+| `src` | on-chain URI | `agent://base/42` |
+| `manifest` | IPFS or HTTPS manifest URL | `ipfs://bafy.../manifest.json` |
+| `body` | bare GLB (ad-hoc agent) | `ipfs://bafy.../cz.glb` or `./cz.glb` |
When multiple are set, priority is `src` > `manifest` > `body`.
### Body / scene
-| Attribute | Type | Default | Notes |
-|---|---|---|---|
-| `poster` | URL | none | image shown during load |
-| `environment` | preset name or HDRI URL | `neutral` | tone-mapped IBL |
-| `camera-controls` | boolean | off | orbit, pan, zoom |
-| `auto-rotate` | boolean | off | slow Y-axis rotation |
-| `ar` | boolean | off | WebXR / Scene Viewer / Quick Look |
-| `shadows` | boolean | on | contact + soft shadows |
-| `exposure` | number | 1.0 | tone-map exposure |
-| `background` | CSS color or `transparent` | transparent | canvas clear color |
-| `skybox` | URL | none | HDRI as visible sky |
+| Attribute | Type | Default | Notes |
+| ----------------- | -------------------------- | ----------- | --------------------------------- |
+| `poster` | URL | none | image shown during load |
+| `environment` | preset name or HDRI URL | `neutral` | tone-mapped IBL |
+| `camera-controls` | boolean | off | orbit, pan, zoom |
+| `auto-rotate` | boolean | off | slow Y-axis rotation |
+| `ar` | boolean | off | WebXR / Scene Viewer / Quick Look |
+| `shadows` | boolean | on | contact + soft shadows |
+| `exposure` | number | 1.0 | tone-map exposure |
+| `background` | CSS color or `transparent` | transparent | canvas clear color |
+| `skybox` | URL | none | HDRI as visible sky |
### Brain
-| Attribute | Type | Default | Notes |
-|---|---|---|---|
-| `brain` | model id | from manifest | `claude-opus-4-6`, `none`, etc. |
-| `api-key` | string | none | **dev use only** — prefer `key-proxy` |
-| `key-proxy` | URL | none | your backend that injects API keys safely |
-| `instructions` | URL or inline | from manifest | overrides manifest's instructions.md |
-| `thinking` | `auto`\|`always`\|`never` | `auto` | extended thinking hint |
+| Attribute | Type | Default | Notes |
+| -------------- | ------------------------- | ------------- | ----------------------------------------- |
+| `brain` | model id | from manifest | `claude-opus-4-6`, `none`, etc. |
+| `api-key` | string | none | **dev use only** — prefer `key-proxy` |
+| `key-proxy` | URL | none | your backend that injects API keys safely |
+| `instructions` | URL or inline | from manifest | overrides manifest's instructions.md |
+| `thinking` | `auto`\|`always`\|`never` | `auto` | extended thinking hint |
### Voice
-| Attribute | Type | Default | Notes |
-|---|---|---|---|
-| `voice` | boolean | on if voice in manifest | master on/off for speech I/O |
-| `tts` | provider id | browser | overrides manifest |
-| `stt` | provider id | browser | overrides manifest |
-| `mic` | `push-to-talk`\|`continuous`\|`off` | `push-to-talk` | mic policy |
+| Attribute | Type | Default | Notes |
+| --------- | ----------------------------------- | ----------------------- | ---------------------------- |
+| `voice` | boolean | on if voice in manifest | master on/off for speech I/O |
+| `tts` | provider id | browser | overrides manifest |
+| `stt` | provider id | browser | overrides manifest |
+| `mic` | `push-to-talk`\|`continuous`\|`off` | `push-to-talk` | mic policy |
### Skills
-| Attribute | Type | Notes |
-|---|---|---|
-| `skills` | comma-separated URIs | adds to (or replaces with `skills-only`) manifest skills |
-| `skills-only` | boolean | use only `skills` attribute, ignore manifest |
-| `skill-trust` | `any`\|`whitelist`\|`owned-only` | overrides manifest default |
+| Attribute | Type | Notes |
+| ------------- | -------------------------------- | -------------------------------------------------------- |
+| `skills` | comma-separated URIs | adds to (or replaces with `skills-only`) manifest skills |
+| `skills-only` | boolean | use only `skills` attribute, ignore manifest |
+| `skill-trust` | `any`\|`whitelist`\|`owned-only` | overrides manifest default |
### Memory
-| Attribute | Type | Default | Notes |
-|---|---|---|---|
-| `memory` | `local`\|`ipfs`\|`encrypted-ipfs`\|`none` | from manifest | override storage mode |
-| `memory-key` | string | `agentId` | namespace under which memory is stored |
+| Attribute | Type | Default | Notes |
+| ------------ | ----------------------------------------- | ------------- | -------------------------------------- |
+| `memory` | `local`\|`ipfs`\|`encrypted-ipfs`\|`none` | from manifest | override storage mode |
+| `memory-key` | string | `agentId` | namespace under which memory is stored |
### Layout / embed mode
-| Attribute | Type | Default | Notes |
-|---|---|---|---|
-| `mode` | `inline`\|`floating`\|`section`\|`fullscreen` | `inline` | see "Modes" below |
-| `position` | `bottom-right`\|`bottom-left`\|`top-right`\|`top-left`\|`bottom-center` | `bottom-right` | for `floating` mode |
-| `offset` | CSS length pair | `24px 24px` | distance from edge in floating mode |
-| `width` | CSS length | `100%` (inline), `320px` (floating) | |
-| `height` | CSS length | `100%` (inline), `480px` (floating) | |
-| `scale` | number | `1.0` | camera zoom multiplier, independent of pixel size |
-| `responsive` | boolean | on | applies `clamp()`-based mobile shrinking |
+| Attribute | Type | Default | Notes |
+| ------------ | ----------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------- |
+| `mode` | `inline`\|`floating`\|`section`\|`fullscreen` | `inline` | see "Modes" below |
+| `position` | `bottom-right`\|`bottom-left`\|`top-right`\|`top-left`\|`bottom-center` | `bottom-right` | for `floating` mode |
+| `offset` | CSS length pair | `24px 24px` | distance from edge in floating mode |
+| `width` | CSS length | `100%` (inline), `320px` (floating) | |
+| `height` | CSS length | `100%` (inline), `480px` (floating) | |
+| `scale` | number | `1.0` | camera zoom multiplier, independent of pixel size |
+| `responsive` | boolean | on | applies `clamp()`-based mobile shrinking |
### Identity / chain
-| Attribute | Type | Notes |
-|---|---|---|
-| `chain` | `base`\|`base-sepolia`\|`ethereum` | override the chain in `src="agent://..."` |
-| `registry` | 0x address | override deployed registry |
-| `wallet` | `auto`\|`metamask`\|`walletconnect`\|`none` | wallet connection policy for registration flows |
+| Attribute | Type | Notes |
+| ---------- | ------------------------------------------- | ----------------------------------------------- |
+| `chain` | `base`\|`base-sepolia`\|`ethereum` | override the chain in `src="agent://..."` |
+| `registry` | 0x address | override deployed registry |
+| `wallet` | `auto`\|`metamask`\|`walletconnect`\|`none` | wallet connection policy for registration flows |
### Dev / debug
-| Attribute | Notes |
-|---|---|
-| `kiosk` | hides all UI chrome (validator, controls, chat) |
-| `debug` | overlays scene graph, tool-call log, memory inspector |
-| `editor` | mounts the embed editor instead of the live agent |
+| Attribute | Notes |
+| --------- | ----------------------------------------------------- |
+| `kiosk` | hides all UI chrome (validator, controls, chat) |
+| `debug` | overlays scene graph, tool-call log, memory inspector |
+| `editor` | mounts the embed editor instead of the live agent |
## Modes
@@ -118,12 +118,12 @@ Fixed-position bubble. Does not affect document flow.
```html
<agent-3d
- src="agent://base/42"
- mode="floating"
- position="bottom-right"
- offset="24px 24px"
- width="320px"
- height="420px"
+ src="agent://base/42"
+ mode="floating"
+ position="bottom-right"
+ offset="24px 24px"
+ width="320px"
+ height="420px"
></agent-3d>
```
@@ -135,7 +135,7 @@ Fills a parent container with aspect-ratio preservation. Ideal for hero sections
```html
<section class="hero">
- <agent-3d src="..." mode="section"></agent-3d>
+ <agent-3d src="..." mode="section"></agent-3d>
</section>
```
@@ -144,9 +144,7 @@ Fills a parent container with aspect-ratio preservation. Ideal for hero sections
Takes over the viewport with a close button. Useful for mobile.
```html
-<button onclick="document.querySelector('agent-3d').openFullscreen()">
- Meet Coach Leo
-</button>
+<button onclick="document.querySelector('agent-3d').openFullscreen()">Meet Coach Leo</button>
<agent-3d src="..." mode="fullscreen"></agent-3d>
```
@@ -154,21 +152,21 @@ Takes over the viewport with a close button. Useful for mobile.
```html
<agent-3d src="agent://base/42">
- <!-- Shown before model loads -->
- <div slot="poster">
- <img src="./leo.webp" alt="Coach Leo">
- </div>
+ <!-- Shown before model loads -->
+ <div slot="poster">
+ <img src="./leo.webp" alt="Coach Leo" />
+ </div>
- <!-- Shown if loading fails -->
- <div slot="error">Couldn't reach Coach Leo. Try again?</div>
+ <!-- Shown if loading fails -->
+ <div slot="error">Couldn't reach Coach Leo. Try again?</div>
- <!-- AR button (inherits <model-viewer> pattern) -->
- <button slot="ar-button">View in your space</button>
+ <!-- AR button (inherits <model-viewer> pattern) -->
+ <button slot="ar-button">View in your space</button>
- <!-- Custom chat UI override -->
- <div slot="chat">
- <!-- host their own chat; hook events below -->
- </div>
+ <!-- Custom chat UI override -->
+ <div slot="chat">
+ <!-- host their own chat; hook events below -->
+ </div>
</agent-3d>
```
@@ -176,22 +174,22 @@ Takes over the viewport with a close button. Useful for mobile.
All events bubble and compose (`composed: true`).
-| Event | Detail | When |
-|---|---|---|
-| `agent:ready` | `{ agent, manifest }` | fully mounted, skills loaded, brain connected |
-| `agent:load-progress` | `{ phase, pct }` | `"body"` \| `"skills"` \| `"memory"` with 0–1 |
-| `agent:error` | `{ phase, error }` | anything fatal |
-| `skill:loaded` | `{ name, uri }` | per skill |
-| `skill:tool-called` | `{ tool, args, result }` | every tool call |
-| `brain:thinking` | `{ content }` | streamed thinking tokens (if enabled) |
-| `brain:message` | `{ role, content }` | each assistant or user turn |
-| `voice:speech-start` | `{ text }` | TTS begins |
-| `voice:speech-end` | `{}` | TTS ends |
-| `voice:listen-start` | `{}` | mic opens |
-| `voice:transcript` | `{ text, final }` | STT chunks |
-| `memory:write` | `{ key, type }` | memory updated |
-| `chain:resolved` | `{ chain, agentId, cid }` | on-chain lookup succeeded |
-| `chain:tx` | `{ hash, kind }` | registration / update tx submitted |
+| Event | Detail | When |
+| --------------------- | ------------------------- | --------------------------------------------- |
+| `agent:ready` | `{ agent, manifest }` | fully mounted, skills loaded, brain connected |
+| `agent:load-progress` | `{ phase, pct }` | `"body"` \| `"skills"` \| `"memory"` with 0–1 |
+| `agent:error` | `{ phase, error }` | anything fatal |
+| `skill:loaded` | `{ name, uri }` | per skill |
+| `skill:tool-called` | `{ tool, args, result }` | every tool call |
+| `brain:thinking` | `{ content }` | streamed thinking tokens (if enabled) |
+| `brain:message` | `{ role, content }` | each assistant or user turn |
+| `voice:speech-start` | `{ text }` | TTS begins |
+| `voice:speech-end` | `{}` | TTS ends |
+| `voice:listen-start` | `{}` | mic opens |
+| `voice:transcript` | `{ text, final }` | STT chunks |
+| `memory:write` | `{ key, type }` | memory updated |
+| `chain:resolved` | `{ chain, agentId, cid }` | on-chain lookup succeeded |
+| `chain:tx` | `{ hash, kind }` | registration / update tx submitted |
## JS API
@@ -240,13 +238,13 @@ For themers and designers. All opt-in; defaults match `<model-viewer>`-style neu
```css
agent-3d {
- --agent-bubble-radius: 16px;
- --agent-accent: #3b82f6;
- --agent-surface: rgba(17, 24, 39, 0.9);
- --agent-on-surface: #f9fafb;
- --agent-chat-font: system-ui, sans-serif;
- --agent-mic-glow: #22c55e;
- --agent-shadow: 0 20px 60px rgba(0,0,0,0.3);
+ --agent-bubble-radius: 16px;
+ --agent-accent: #3b82f6;
+ --agent-surface: rgba(17, 24, 39, 0.9);
+ --agent-on-surface: #f9fafb;
+ --agent-chat-font: system-ui, sans-serif;
+ --agent-mic-glow: #22c55e;
+ --agent-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
```
@@ -284,8 +282,8 @@ If the script fails to load, the element falls back to:
```html
<agent-3d src="agent://base/42">
- <!-- this content shows if JS disabled or script blocked -->
- <img src="./leo-poster.webp" alt="Coach Leo (3D agent, requires JavaScript)">
+ <!-- this content shows if JS disabled or script blocked -->
+ <img src="./leo-poster.webp" alt="Coach Leo (3D agent, requires JavaScript)" />
</agent-3d>
```
@@ -306,10 +304,40 @@ The editor's "Copy Embed" output is a plain `<agent-3d>` with no `editor` attrib
- Works inside React (`<agent-3d />`), Vue, Svelte, Angular, plain HTML, WordPress, Webflow, Notion embeds, Shopify, Ghost, Framer.
- iOS Safari: WebXR unsupported — AR falls back to Quick Look (USDZ export).
+## Install / CDN
+
+The bundle is published from the main app's deploy at `https://3dagent.vercel.app/agent-3d/`. Three URL channels, pick based on how strict you need updates:
+
+| Path | Cache | Use when |
+| ----------------------------------------------- | ----------------------------- | --------------------------------------------------------- |
+| `/agent-3d/<MAJOR>.<MINOR>.<PATCH>/agent-3d.js` | `max-age=31536000, immutable` | **production** — pin exact bytes, always combine with SRI |
+| `/agent-3d/<MAJOR>.<MINOR>/agent-3d.js` | `max-age=300` | follow patch releases automatically |
+| `/agent-3d/<MAJOR>/agent-3d.js` | `max-age=300` | follow minor + patch releases |
+| `/agent-3d/latest/agent-3d.js` | `max-age=300` | demos / prototypes only — never in production |
+
+**Recommended snippet** (pinned + SRI):
+
+```html
+<script
+ type="module"
+ src="https://3dagent.vercel.app/agent-3d/1.5.1/agent-3d.js"
+ integrity="sha384-…"
+ crossorigin="anonymous"
+></script>
+
+<agent-3d src="agent://base/42"></agent-3d>
+```
+
+The current SRI hash for each release lives in `/agent-3d/<version>/integrity.json`. The full release manifest (channels, current version, publish time) is `/agent-3d/versions.json` (max-age 60s).
+
+UMD build available at the same path with `agent-3d.umd.cjs` if you can't use ES modules.
+
+All bundle responses ship `access-control-allow-origin: *` and `cross-origin-resource-policy: cross-origin`, so the script loads fine from any origin.
+
## Versioning
- Element spec: `embed/0.1` — breaking changes bump minor until 1.0.
-- CDN URL pinning: `https://cdn.3d-agent.io/[email protected]` (SRI-hashed).
+- Bundle version: tracks `package.json` `version` of the main repo. Pinning a `<MAJOR>.<MINOR>.<PATCH>` URL is the only forever-stable option — moving channels can ship security fixes that may include behavior changes within their semver range.
## See also
diff --git a/src/erc8004/abi.js b/src/erc8004/abi.js
index a384b66d3..3f215670d 100644
--- a/src/erc8004/abi.js
+++ b/src/erc8004/abi.js
@@ -34,6 +34,13 @@ export const IDENTITY_REGISTRY_ABI = [
'function symbol() external view returns (string)',
'function getVersion() external pure returns (string)',
+ // --- ERC-721 transfer ---
+ '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',
+
// --- Events ---
'event Registered(uint256 indexed agentId, string agentURI, address indexed owner)',
'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)',
@@ -76,30 +83,30 @@ const MAINNET = {
*/
export const REGISTRY_DEPLOYMENTS = {
// Mainnets
- 1: MAINNET, // Ethereum
- 10: MAINNET, // Optimism
- 56: MAINNET, // BSC
- 100: MAINNET, // Gnosis
- 137: MAINNET, // Polygon
- 250: MAINNET, // Fantom
- 324: MAINNET, // zkSync Era
- 1284: MAINNET, // Moonbeam
- 5000: MAINNET, // Mantle
- 8453: MAINNET, // Base
- 42161: MAINNET, // Arbitrum One
- 42220: MAINNET, // Celo
- 43114: MAINNET, // Avalanche
- 59144: MAINNET, // Linea
- 534352: MAINNET, // Scroll
+ 1: MAINNET, // Ethereum
+ 10: MAINNET, // Optimism
+ 56: MAINNET, // BSC
+ 100: MAINNET, // Gnosis
+ 137: MAINNET, // Polygon
+ 250: MAINNET, // Fantom
+ 324: MAINNET, // zkSync Era
+ 1284: MAINNET, // Moonbeam
+ 5000: MAINNET, // Mantle
+ 8453: MAINNET, // Base
+ 42161: MAINNET, // Arbitrum One
+ 42220: MAINNET, // Celo
+ 43114: MAINNET, // Avalanche
+ 59144: MAINNET, // Linea
+ 534352: MAINNET, // Scroll
// Testnets
- 97: TESTNET, // BSC Testnet
+ 97: TESTNET, // BSC Testnet
11155111: TESTNET, // Ethereum Sepolia
- 84532: TESTNET, // Base Sepolia
- 421614: TESTNET, // Arbitrum Sepolia
+ 84532: TESTNET, // Base Sepolia
+ 421614: TESTNET, // Arbitrum Sepolia
11155420: TESTNET, // Optimism Sepolia
- 80002: TESTNET, // Polygon Amoy
- 43113: TESTNET, // Avalanche Fuji
+ 80002: TESTNET, // Polygon Amoy
+ 43113: TESTNET, // Avalanche Fuji
};
/**
diff --git a/src/erc8004/explore.js b/src/erc8004/explore.js
index bdeb09a50..10b8ef758 100644
--- a/src/erc8004/explore.js
+++ b/src/erc8004/explore.js
@@ -1,138 +1,774 @@
/**
- * Public explore page — a cross-chain gallery of ERC-8004 agents that resolve
- * to a 3D avatar. Entry point is `/explore`.
+ * /explore — the public on-chain avatar browser.
*
- * Flow:
- * 1. For each supported chain, scan recent `Registered` events.
- * 2. Fetch the registration JSON behind each agent's URI.
- * 3. Keep only entries where `findAvatar3D(metadata)` returns a URL.
- * 4. Render a grid of cards linking to `/a/<chainId>/<agentId>`.
+ * Paste any of the following into the big input and see every matching
+ * ERC-8004 registered 3D avatar on every supported chain:
*
- * No wallet required — uses public RPCs from CHAIN_META. Scans are bounded
- * (`blocks`, `limitPerChain`) so a single open of the page doesn't blow up
- * public endpoints. Metadata fetches run concurrently with a cap.
+ * - EVM address (0x…40 hex) → all agents owned by that wallet
+ * - ENS name (vitalik.eth) → resolved to address then fanned out
+ * - Transaction hash (0x…64 hex) → every Registered event in that tx
+ * - Agent ID (6443) → same id on every chain (fan-out)
+ * - agent:// URI (agent://base/123) → precise single lookup
+ *
+ * Empty query → latest Registered events on Base mainnet (fallback: BSC Testnet).
+ *
+ * Clicking a card opens /a/<chainId>/<agentId> which renders the 3D avatar via
+ * app.js `_loadOnChainAgent`.
+ *
+ * Lazy-loaded by src/app.js `_showExplorePage`.
*/
-import { supportedChainIds, CHAIN_META } from './chain-meta.js';
-import { listRegisteredEvents, fetchAgentMetadata, findAvatar3D } from './queries.js';
+import {
+ autoResolve,
+ detectInputType,
+ hydrateAgent,
+ INPUT_TYPES,
+ DEFAULT_FAN_OUT_CHAINS,
+ splitChainsByNet,
+} from './resolve-avatar.js';
+import { listRegisteredEvents } from './queries.js';
+import { CHAIN_META } from './chain-meta.js';
+import { resolveURI } from '../ipfs.js';
-const SCAN_BLOCKS = 250000;
-const LIMIT_PER_CHAIN = 25;
-const METADATA_CONCURRENCY = 6;
+const RECENT_KEY = '3dagent.explore.recent';
+const CHAINS_KEY = '3dagent.explore.chains';
+const RECENT_MAX = 8;
+const FEATURED_CHAIN_ID = 8453;
+const FEATURED_FALLBACK_CHAIN_ID = 97;
+const FEATURED_COUNT = 12;
+const FEATURED_SCAN_BLOCKS = 250000;
-function esc(s) {
- return String(s ?? '').replace(/[&<>"']/g, (c) => ({
- '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;',
- }[c]));
-}
+const esc = (s) =>
+ String(s ?? '').replace(
+ /[&<>"']/g,
+ (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c],
+ );
+
+const shortAddr = (a) => (a ? `${a.slice(0, 6)}…${a.slice(-4)}` : '');
+
+const INPUT_TYPE_LABEL = {
+ [INPUT_TYPES.ADDRESS]: 'Wallet address',
+ [INPUT_TYPES.ENS]: 'ENS name',
+ [INPUT_TYPES.TX_HASH]: 'Transaction hash',
+ [INPUT_TYPES.AGENT_ID]: 'Agent ID',
+ [INPUT_TYPES.AGENT_URI]: 'agent:// URI',
+ [INPUT_TYPES.UNKNOWN]: 'Unrecognized',
+};
+
+const EXAMPLES = [
+ { label: 'Agent #1 on Base', value: 'agent://base/1' },
+ { label: 'vitalik.eth', value: 'vitalik.eth' },
+ { label: 'Agent #1', value: '1' },
+];
/**
- * Render the explore page into `container`. Takes over that element.
+ * Entry point called by app.js `_showExplorePage`.
* @param {HTMLElement} container
*/
-export async function renderExplorePage(container) {
- container.innerHTML = `
- <div class="explore-head">
- <h1>Explore on-chain 3D agents</h1>
- <p class="explore-sub">Every card below is an ERC-8004 agent whose registration metadata points at a 3D avatar. Click to load it in the viewer.</p>
- <div class="explore-meta" id="explore-meta">Scanning chains…</div>
- </div>
- <div class="explore-grid" id="explore-grid"></div>
- <div class="explore-foot" id="explore-foot"></div>
- `;
+export function renderExplorePage(container) {
+ const page = new ExplorePage(container);
+ page.mount();
+ return page;
+}
- const grid = container.querySelector('#explore-grid');
- const meta = container.querySelector('#explore-meta');
- const foot = container.querySelector('#explore-foot');
+// ───────────────────────────────────────────────────────────────────────────
+// ExplorePage
+// ───────────────────────────────────────────────────────────────────────────
- const chains = supportedChainIds();
- let scanned = 0;
- let found = 0;
+class ExplorePage {
+ /** @param {HTMLElement} container */
+ constructor(container) {
+ this.container = container;
+ this._chains = loadChainSelection();
+ this._results = [];
+ this._query = '';
+ this._queryType = INPUT_TYPES.UNKNOWN;
+ this._resolvedAddress = '';
+ this._loading = false;
+ this._perChainState = new Map();
+ this._filter = 'all';
+ this._abortCounter = 0;
+ this._onHashChange = () => this._loadFromURL({ replace: false });
+ }
- const updateStatus = () => {
- meta.textContent = `Scanned ${scanned}/${chains.length} chains · ${found} live 3D agents`;
- };
- updateStatus();
+ mount() {
+ this.container.innerHTML = `
+ <div class="explore-shell">
+ <header class="explore-hero">
+ <div class="explore-hero-inner">
+ <div class="explore-eyebrow">ERC-8004 · On-chain avatars</div>
+ <h1 class="explore-title">See anyone's 3D self.</h1>
+ <p class="explore-subtitle">
+ Paste a wallet, ENS name, transaction, or agent ID to resolve every
+ on-chain avatar they've minted — across every supported chain.
+ </p>
+ <form class="explore-form" data-role="form" autocomplete="off">
+ <div class="explore-input-wrap">
+ <input
+ class="explore-input"
+ name="q"
+ placeholder="0xabc… · vitalik.eth · tx hash · agent ID"
+ spellcheck="false"
+ autocapitalize="off"
+ />
+ <button type="submit" class="explore-btn explore-btn--primary">Resolve</button>
+ </div>
+ <div class="explore-input-meta" data-role="inputMeta"></div>
+ </form>
+ <div class="explore-examples" data-role="examples"></div>
+ </div>
+ </header>
- // Run chains in parallel — event queries on different RPCs are independent.
- await Promise.all(chains.map(async (chainId) => {
- const chainMeta = CHAIN_META[chainId];
- try {
- const events = await listRegisteredEvents({
- chainId,
- blocks: SCAN_BLOCKS,
- limit: LIMIT_PER_CHAIN,
+ <section class="explore-controls">
+ <div class="explore-controls-row">
+ <strong class="explore-controls-lbl">Chains</strong>
+ <div class="explore-chain-chips" data-role="chainChips"></div>
+ <div class="explore-controls-spacer"></div>
+ <div class="explore-progress" data-role="progress" hidden></div>
+ </div>
+ </section>
+
+ <section class="explore-results" data-role="results"></section>
+ </div>
+ `;
+
+ this._renderExamples();
+ this._renderChainChips();
+ this._bindForm();
+
+ window.addEventListener('hashchange', this._onHashChange);
+ window.addEventListener('popstate', this._onHashChange);
+
+ this._loadFromURL({ replace: true });
+ }
+
+ destroy() {
+ window.removeEventListener('hashchange', this._onHashChange);
+ window.removeEventListener('popstate', this._onHashChange);
+ }
+
+ // ── URL ↔ state ───────────────────────────────────────────────────────
+
+ _loadFromURL({ replace }) {
+ const { q } = parseURL();
+ const input = this.container.querySelector('.explore-input');
+ if (q) {
+ input.value = q;
+ this._query = q;
+ this._runResolve(q, { pushHistory: false });
+ } else {
+ input.value = '';
+ this._query = '';
+ this._results = [];
+ this._showFeatured();
+ }
+ this._updateInputMeta(input.value);
+ }
+
+ _pushURL(q) {
+ const url = new URL(location.href);
+ if (q) url.searchParams.set('q', q);
+ else url.searchParams.delete('q');
+ history.pushState({}, '', url.toString());
+ }
+
+ // ── Input ─────────────────────────────────────────────────────────────
+
+ _bindForm() {
+ const form = this.container.querySelector('[data-role="form"]');
+ const input = form.querySelector('.explore-input');
+ form.addEventListener('submit', (e) => {
+ e.preventDefault();
+ const q = input.value.trim();
+ if (!q) return;
+ this._pushURL(q);
+ this._runResolve(q);
+ });
+ input.addEventListener('input', () => this._updateInputMeta(input.value));
+ }
+
+ _updateInputMeta(value) {
+ const el = this.container.querySelector('[data-role="inputMeta"]');
+ const v = String(value || '').trim();
+ if (!v) {
+ el.innerHTML = '';
+ el.className = 'explore-input-meta';
+ return;
+ }
+ const type = detectInputType(v);
+ const label = INPUT_TYPE_LABEL[type];
+ const cls = type === INPUT_TYPES.UNKNOWN ? 'explore-inputmeta--warn' : 'explore-inputmeta--ok';
+ el.className = `explore-input-meta ${cls}`;
+ el.textContent = `Detected: ${label}`;
+ }
+
+ _renderExamples() {
+ const recent = loadRecent();
+ const root = this.container.querySelector('[data-role="examples"]');
+ const entries = recent.length ? recent : EXAMPLES;
+ root.innerHTML = `
+ <span class="explore-examples-lbl">${recent.length ? 'Recent:' : 'Try:'}</span>
+ ${entries
+ .map(
+ (e) => `
+ <button type="button" class="explore-example" data-q="${esc(e.value || e)}">${esc(e.label || e.value || e)}</button>
+ `,
+ )
+ .join('')}
+ `;
+ this._wireExampleClicks(root);
+ }
+
+ // ── Chain chips ───────────────────────────────────────────────────────
+
+ _renderChainChips() {
+ const root = this.container.querySelector('[data-role="chainChips"]');
+ const { mainnet, testnet } = splitChainsByNet();
+ const chipHTML = (id) => {
+ const m = CHAIN_META[id];
+ if (!m) return '';
+ const active = this._chains.includes(id);
+ return `
+ <button type="button"
+ class="explore-chain-chip ${active ? 'explore-chain-chip--active' : ''} ${m.testnet ? 'explore-chain-chip--testnet' : ''}"
+ data-chain="${id}"
+ title="${esc(m.name)}"
+ >
+ <span class="explore-chain-dot"></span>
+ ${esc(m.shortName || m.name)}
+ </button>
+ `;
+ };
+ root.innerHTML = `
+ <div class="explore-chain-group">${mainnet.map(chipHTML).join('')}</div>
+ <div class="explore-chain-divider">·</div>
+ <div class="explore-chain-group explore-chain-group--testnet">
+ ${testnet.map(chipHTML).join('')}
+ </div>
+ <button type="button" class="explore-chain-presets-btn" data-role="preset-main">Mainnets</button>
+ <button type="button" class="explore-chain-presets-btn" data-role="preset-all">All</button>
+ `;
+ root.querySelectorAll('.explore-chain-chip').forEach((chip) => {
+ chip.addEventListener('click', () => {
+ const id = Number(chip.dataset.chain);
+ const idx = this._chains.indexOf(id);
+ if (idx >= 0) this._chains.splice(idx, 1);
+ else this._chains.push(id);
+ saveChainSelection(this._chains);
+ this._renderChainChips();
+ if (this._query) this._runResolve(this._query, { pushHistory: false });
});
- await runWithConcurrency(events, METADATA_CONCURRENCY, async (ev) => {
- const meta = await fetchAgentMetadata(ev.agentURI);
- if (!meta.ok) return;
- const glb = findAvatar3D(meta.data);
- if (!glb) return;
- found += 1;
- renderCard(grid, {
- chainId,
- chainName: chainMeta?.shortName || chainMeta?.name || String(chainId),
- agentId: ev.agentId.toString(),
- owner: ev.owner,
- metadata: meta.data,
- glb,
- });
- updateStatus();
+ });
+ root.querySelector('[data-role="preset-main"]').addEventListener('click', () => {
+ const { mainnet } = splitChainsByNet();
+ this._chains = mainnet.slice();
+ saveChainSelection(this._chains);
+ this._renderChainChips();
+ if (this._query) this._runResolve(this._query, { pushHistory: false });
+ });
+ root.querySelector('[data-role="preset-all"]').addEventListener('click', () => {
+ const { mainnet, testnet } = splitChainsByNet();
+ this._chains = [...mainnet, ...testnet];
+ saveChainSelection(this._chains);
+ this._renderChainChips();
+ if (this._query) this._runResolve(this._query, { pushHistory: false });
+ });
+ }
+
+ // ── Resolve ───────────────────────────────────────────────────────────
+
+ async _runResolve(rawInput, { pushHistory = true } = {}) {
+ const q = String(rawInput || '').trim();
+ if (!q) return;
+
+ this._query = q;
+ this._queryType = detectInputType(q);
+ this._resolvedAddress = '';
+ this._perChainState = new Map();
+ this._loading = true;
+ this._abortCounter++;
+ const thisAbort = this._abortCounter;
+
+ pushRecent(q);
+ this._renderExamples();
+
+ const chains = this._chains.length ? this._chains.slice() : DEFAULT_FAN_OUT_CHAINS.slice();
+ this._renderProgress(chains);
+ this._renderResultsSkeleton();
+
+ try {
+ const { type, resolvedAddress, results } = await autoResolve({
+ input: q,
+ chainIds: chains,
+ ethProvider: window.ethereum,
+ onProgress: (chainId, stage, payload) => {
+ if (thisAbort !== this._abortCounter) return;
+ this._perChainState.set(chainId, { stage, payload });
+ this._renderProgress(chains);
+ },
});
+ if (thisAbort !== this._abortCounter) return;
+
+ this._queryType = type;
+ this._resolvedAddress = resolvedAddress || '';
+ this._results = results || [];
+ this._loading = false;
+ this._renderResults();
+ this._hideProgress();
} catch (err) {
- console.warn(`[explore] chain ${chainId} scan failed:`, err.message);
- } finally {
- scanned += 1;
- updateStatus();
+ if (thisAbort !== this._abortCounter) return;
+ this._loading = false;
+ this._hideProgress();
+ this._renderError(err.message || String(err));
+ }
+ }
+
+ // ── Progress HUD ──────────────────────────────────────────────────────
+
+ _renderProgress(chains) {
+ const root = this.container.querySelector('[data-role="progress"]');
+ if (!this._loading) {
+ root.hidden = true;
+ return;
+ }
+ root.hidden = false;
+ const done = chains.filter((c) => this._perChainState.get(c)?.stage === 'done').length;
+ const errored = chains.filter((c) => this._perChainState.get(c)?.stage === 'error').length;
+ root.innerHTML = `
+ <span class="explore-progress-spinner"></span>
+ <span>Resolving ${done}/${chains.length} chains${errored ? ` · ${errored} errored` : ''}</span>
+ `;
+ }
+
+ _hideProgress() {
+ const root = this.container.querySelector('[data-role="progress"]');
+ root.hidden = true;
+ }
+
+ // ── Results ───────────────────────────────────────────────────────────
+
+ _renderResultsSkeleton() {
+ const out = this.container.querySelector('[data-role="results"]');
+ const chains = this._chains.length ? this._chains : DEFAULT_FAN_OUT_CHAINS;
+ const n = this._queryType === INPUT_TYPES.AGENT_ID ? chains.length : 6;
+ out.innerHTML = `
+ <div class="explore-grid" aria-busy="true">
+ ${Array.from({ length: n })
+ .map(
+ () => `
+ <div class="explore-card explore-card--skel">
+ <div class="explore-skel-img"></div>
+ <div class="explore-skel-line"></div>
+ <div class="explore-skel-line explore-skel-line--short"></div>
+ </div>
+ `,
+ )
+ .join('')}
+ </div>
+ `;
+ }
+
+ _renderResults() {
+ const out = this.container.querySelector('[data-role="results"]');
+ const results = this._results;
+ const summary = this._renderSummary();
+
+ if (!results.length) {
+ out.innerHTML = `
+ ${summary}
+ <div class="explore-empty">
+ <div class="explore-empty-art">🫥</div>
+ <h3>No on-chain avatars found.</h3>
+ <p>${renderNoMatchCopy(this._queryType, this._query)}</p>
+ <div class="explore-empty-ideas">
+ ${EXAMPLES.map(
+ (e) => `
+ <button type="button" class="explore-example" data-q="${esc(e.value)}">${esc(e.label)}</button>
+ `,
+ ).join('')}
+ </div>
+ </div>
+ `;
+ this._wireExampleClicks(out);
+ return;
+ }
+
+ const filterBar = results.length >= 3 ? this._renderFilterBar() : '';
+ const visible = this._applyFilter(results);
+
+ out.innerHTML = `
+ ${summary}
+ ${filterBar}
+ <div class="explore-grid">
+ ${visible.map((r) => renderCard(r)).join('')}
+ </div>
+ `;
+
+ this._wireCards(out);
+ if (filterBar) this._wireFilterBar(out);
+ }
+
+ _renderSummary() {
+ const n = this._results.length;
+ if (!this._query) return '';
+ const type = this._queryType;
+ let title = '';
+ let sub = '';
+
+ const with3D = this._results.filter((r) => !!r.avatarUri).length;
+
+ if (type === INPUT_TYPES.ADDRESS || type === INPUT_TYPES.ENS) {
+ const who = this._resolvedAddress || this._query;
+ title =
+ n === 0
+ ? `No agents owned by ${esc(shortAddr(who))}`
+ : `${n} agent${n === 1 ? '' : 's'} owned by ${esc(shortAddr(who))}`;
+ if (type === INPUT_TYPES.ENS && this._resolvedAddress) {
+ sub = `${esc(this._query)} → <code>${esc(this._resolvedAddress)}</code>`;
+ } else if (who) {
+ sub = `<code>${esc(who)}</code>`;
+ }
+ } else if (type === INPUT_TYPES.TX_HASH) {
+ title =
+ n === 0
+ ? `No Registered events in this transaction`
+ : `${n} agent${n === 1 ? '' : 's'} minted in this transaction`;
+ sub = `<code>${esc(this._query)}</code>`;
+ } else if (type === INPUT_TYPES.AGENT_ID) {
+ title =
+ n === 0
+ ? `Agent #${esc(this._query)} not found on any selected chain`
+ : `Agent #${esc(this._query)} on ${n} chain${n === 1 ? '' : 's'}`;
+ } else if (type === INPUT_TYPES.AGENT_URI) {
+ title = n === 0 ? `Agent not found` : `Agent on ${esc(this._results[0]?.chainName || '?')}`;
+ sub = `<code>${esc(this._query)}</code>`;
}
- }));
- if (found === 0) {
- foot.innerHTML = `
- <p>No 3D agents indexed yet on the scanned window.</p>
- <p><a href="/deploy" class="explore-cta">Deploy yours →</a></p>
+ return `
+ <div class="explore-summary">
+ <div class="explore-summary-head">
+ <h2 class="explore-summary-title">${title}</h2>
+ ${n ? `<span class="explore-summary-stat">${with3D} with 3D body · ${n - with3D} metadata-only</span>` : ''}
+ </div>
+ ${sub ? `<div class="explore-summary-sub">${sub}</div>` : ''}
+ </div>
`;
- } else {
- foot.innerHTML = `<p><a href="/deploy" class="explore-cta">Deploy your agent on-chain →</a></p>`;
+ }
+
+ _renderFilterBar() {
+ const filters = [
+ { id: 'all', label: 'All' },
+ { id: '3d', label: '3D body' },
+ { id: 'x402', label: 'x402 💳' },
+ { id: 'a2a', label: 'A2A' },
+ { id: 'mcp', label: 'MCP' },
+ ];
+ return `
+ <div class="explore-filterbar" data-role="filterbar">
+ ${filters
+ .map(
+ (f) => `
+ <button type="button"
+ class="explore-filter ${this._filter === f.id ? 'explore-filter--active' : ''}"
+ data-filter="${f.id}"
+ >${esc(f.label)}</button>
+ `,
+ )
+ .join('')}
+ </div>
+ `;
+ }
+
+ _wireFilterBar(out) {
+ out.querySelectorAll('[data-role="filterbar"] .explore-filter').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ this._filter = btn.dataset.filter;
+ this._renderResults();
+ });
+ });
+ }
+
+ _applyFilter(results) {
+ switch (this._filter) {
+ case '3d':
+ return results.filter((r) => !!r.avatarUri);
+ case 'x402':
+ return results.filter((r) => !!r.x402);
+ case 'a2a':
+ return results.filter((r) => r.serviceTypes?.includes('A2A'));
+ case 'mcp':
+ return results.filter((r) => r.serviceTypes?.includes('MCP'));
+ default:
+ return results;
+ }
+ }
+
+ _wireCards(root) {
+ root.querySelectorAll('[data-role="card-copy"]').forEach((btn) => {
+ btn.addEventListener('click', (e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ const url = new URL(btn.dataset.share, location.origin).href;
+ if (navigator.clipboard?.writeText) {
+ navigator.clipboard.writeText(url).then(
+ () => flashToast('Link copied'),
+ () => flashToast('Copy failed', true),
+ );
+ } else {
+ flashToast(url);
+ }
+ });
+ });
+ }
+
+ _wireExampleClicks(root) {
+ root.querySelectorAll('.explore-example').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ const q = btn.dataset.q;
+ this.container.querySelector('.explore-input').value = q;
+ this._updateInputMeta(q);
+ this._pushURL(q);
+ this._runResolve(q);
+ });
+ });
+ }
+
+ _renderError(message) {
+ const out = this.container.querySelector('[data-role="results"]');
+ out.innerHTML = `
+ <div class="explore-error">
+ <strong>Couldn't resolve.</strong>
+ <p>${esc(message)}</p>
+ <div class="explore-empty-ideas">
+ ${EXAMPLES.map(
+ (e) => `
+ <button type="button" class="explore-example" data-q="${esc(e.value)}">${esc(e.label)}</button>
+ `,
+ ).join('')}
+ </div>
+ </div>
+ `;
+ this._wireExampleClicks(out);
+ }
+
+ // ── Featured (no query) ───────────────────────────────────────────────
+
+ async _showFeatured() {
+ const out = this.container.querySelector('[data-role="results"]');
+ out.innerHTML = `
+ <div class="explore-featured-head">
+ <h2>Recently minted on ${esc(CHAIN_META[FEATURED_CHAIN_ID]?.name || 'Base')}</h2>
+ <p class="explore-muted">Latest <code>Registered</code> events on the canonical Identity Registry.</p>
+ </div>
+ <div class="explore-grid" aria-busy="true" data-role="featured">
+ ${Array.from({ length: FEATURED_COUNT })
+ .map(
+ () => `
+ <div class="explore-card explore-card--skel">
+ <div class="explore-skel-img"></div>
+ <div class="explore-skel-line"></div>
+ <div class="explore-skel-line explore-skel-line--short"></div>
+ </div>
+ `,
+ )
+ .join('')}
+ </div>
+ `;
+
+ const featured = await fetchFeatured();
+ const grid = this.container.querySelector('[data-role="featured"]');
+ if (!grid) return;
+
+ if (!featured.length) {
+ grid.outerHTML = `
+ <div class="explore-empty">
+ <div class="explore-empty-art">✨</div>
+ <h3>No recent Registered events indexed.</h3>
+ <p class="explore-muted">Paste an address or agent ID above to look one up.</p>
+ </div>
+ `;
+ return;
+ }
+
+ grid.innerHTML = featured.map((r) => renderCard(r)).join('');
+ this._wireCards(grid.parentElement || grid);
}
}
-function renderCard(grid, { chainId, chainName, agentId, owner, metadata, glb }) {
- const card = document.createElement('a');
- card.className = 'explore-card';
- card.href = `/a/${chainId}/${agentId}`;
-
- const name = metadata.name ? String(metadata.name) : `Agent #${agentId}`;
- const desc = metadata.description ? String(metadata.description).slice(0, 140) : '';
- const img = typeof metadata.image === 'string' ? metadata.image : '';
- const thumbHtml = img
- ? `<div class="explore-card__thumb" style="background-image:url('${esc(resolveUri(img))}')"></div>`
- : `<div class="explore-card__thumb explore-card__thumb--none">3D</div>`;
-
- card.innerHTML = `
- ${thumbHtml}
- <div class="explore-card__body">
- <div class="explore-card__name">${esc(name)}</div>
- <div class="explore-card__chain">${esc(chainName)} · #${esc(agentId)}</div>
- ${desc ? `<div class="explore-card__desc">${esc(desc)}</div>` : ''}
- </div>
+// ───────────────────────────────────────────────────────────────────────────
+// Card
+// ───────────────────────────────────────────────────────────────────────────
+
+/** @param {import('./resolve-avatar.js').AvatarResult} r */
+function renderCard(r) {
+ const chainMeta = CHAIN_META[r.chainId];
+ const img = r.image ? resolveURI(r.image) : '';
+ const chainShort = chainMeta?.shortName || chainMeta?.name || `#${r.chainId}`;
+ const chainBadge = `
+ <span class="explore-chain-badge ${chainMeta?.testnet ? 'explore-chain-badge--testnet' : ''}" title="${esc(chainMeta?.name || '')}">
+ ${esc(chainShort)}
+ </span>
`;
- grid.appendChild(card);
+ const title = esc(r.name || `Agent #${r.agentId}`);
+ const id = `#${esc(r.agentId)}`;
+ const ownerLine = r.owner
+ ? `<a class="explore-owner" href="${esc(r.ownerExplorerUrl)}" target="_blank" rel="noopener" title="${esc(r.owner)}">Owner ${esc(shortAddr(r.owner))} ↗</a>`
+ : '';
+ const descLine = r.description
+ ? `<p class="explore-card-desc">${esc(truncate(r.description, 140))}</p>`
+ : '';
+
+ const tags = [];
+ if (r.avatarUri) tags.push(`<span class="explore-tag explore-tag--3d">3D</span>`);
+ if (r.x402) tags.push(`<span class="explore-tag explore-tag--x402">x402 💳</span>`);
+ for (const t of r.serviceTypes || []) {
+ if (t === 'A2A') tags.push(`<span class="explore-tag">A2A</span>`);
+ else if (t === 'MCP') tags.push(`<span class="explore-tag">MCP</span>`);
+ else if (t === 'OASF') tags.push(`<span class="explore-tag">OASF</span>`);
+ }
+
+ const errLine = r.error ? `<div class="explore-card-err">${esc(r.error)}</div>` : '';
+ const viewerUrl = r.viewerUrl;
+ const explorerUrl = r.tokenExplorerUrl;
+
+ return `
+ <article class="explore-card">
+ <a class="explore-card-thumb" href="${esc(viewerUrl)}" aria-label="Open Agent #${esc(r.agentId)} in 3D viewer">
+ ${img ? `<img src="${esc(img)}" alt="" loading="lazy" />` : `<div class="explore-card-ph">🤖</div>`}
+ ${chainBadge}
+ ${r.avatarUri ? `<span class="explore-card-3dpill">▶ 3D</span>` : ''}
+ </a>
+ <div class="explore-card-body">
+ <div class="explore-card-head">
+ <a class="explore-card-title" href="${esc(viewerUrl)}">${title}</a>
+ <span class="explore-card-id">${id}</span>
+ </div>
+ ${descLine}
+ <div class="explore-card-tags">${tags.join('')}</div>
+ ${ownerLine}
+ ${errLine}
+ <div class="explore-card-actions">
+ <a class="explore-btn explore-btn--sm explore-btn--primary" href="${esc(viewerUrl)}">Open 3D ↗</a>
+ ${explorerUrl ? `<a class="explore-btn explore-btn--sm" href="${esc(explorerUrl)}" target="_blank" rel="noopener">Explorer ↗</a>` : ''}
+ <button type="button" class="explore-btn explore-btn--sm explore-btn--ghost"
+ data-role="card-copy" data-share="${esc(viewerUrl)}" title="Copy shareable link">Share</button>
+ </div>
+ </div>
+ </article>
+ `;
+}
+
+function truncate(s, n) {
+ s = String(s || '');
+ return s.length > n ? s.slice(0, n - 1) + '…' : s;
}
-function resolveUri(uri) {
- if (!uri) return '';
- if (uri.startsWith('ipfs://')) return 'https://ipfs.io/ipfs/' + uri.slice(7);
- if (uri.startsWith('ar://')) return 'https://arweave.net/' + uri.slice(5);
- return uri;
+function renderNoMatchCopy(type, query) {
+ switch (type) {
+ case INPUT_TYPES.ADDRESS:
+ return `We scanned the selected chains — this wallet hasn't minted any ERC-8004 agents there yet.`;
+ case INPUT_TYPES.ENS:
+ return `ENS resolved, but the address owns no ERC-8004 agents on the selected chains.`;
+ case INPUT_TYPES.TX_HASH:
+ return `This tx has no <code>Registered</code> events from the ERC-8004 Identity Registry on the selected chains.`;
+ case INPUT_TYPES.AGENT_ID:
+ return `Agent #${esc(query)} isn't minted on any selected chain. Try enabling more chains above.`;
+ default:
+ return `Nothing resolved. Try an address, ENS name, tx hash, or agent ID.`;
+ }
}
-async function runWithConcurrency(items, limit, fn) {
- const iterator = items[Symbol.iterator]();
- const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
- for (const item of iterator) {
- try { await fn(item); } catch { /* swallow per-item */ }
+// ───────────────────────────────────────────────────────────────────────────
+// Toast
+// ───────────────────────────────────────────────────────────────────────────
+
+function flashToast(text, isError = false) {
+ const toast = document.createElement('div');
+ toast.className = 'erc8004-toast' + (isError ? ' erc8004-toast--error' : '');
+ toast.textContent = text;
+ document.body.appendChild(toast);
+ setTimeout(() => toast.remove(), 1800);
+}
+
+// ───────────────────────────────────────────────────────────────────────────
+// Featured loader
+// ───────────────────────────────────────────────────────────────────────────
+
+async function fetchFeatured() {
+ const tryChain = async (chainId) => {
+ try {
+ const events = await listRegisteredEvents({
+ chainId,
+ blocks: FEATURED_SCAN_BLOCKS,
+ limit: FEATURED_COUNT,
+ ethProvider: window.ethereum,
+ });
+ if (!events.length) return [];
+ const hydrated = await Promise.all(
+ events.map((ev) =>
+ hydrateAgent({ chainId, agentId: ev.agentId, ethProvider: window.ethereum }),
+ ),
+ );
+ return hydrated;
+ } catch {
+ return [];
}
- });
- await Promise.all(workers);
+ };
+ const primary = await tryChain(FEATURED_CHAIN_ID);
+ if (primary.length) return primary;
+ return tryChain(FEATURED_FALLBACK_CHAIN_ID);
+}
+
+// ───────────────────────────────────────────────────────────────────────────
+// Persistence
+// ───────────────────────────────────────────────────────────────────────────
+
+function parseURL() {
+ const url = new URL(location.href);
+ const q = url.searchParams.get('q') || '';
+ return { q };
+}
+
+function loadRecent() {
+ try {
+ const raw = localStorage.getItem(RECENT_KEY);
+ if (!raw) return [];
+ const arr = JSON.parse(raw);
+ if (!Array.isArray(arr)) return [];
+ return arr.slice(0, RECENT_MAX);
+ } catch {
+ return [];
+ }
+}
+
+function pushRecent(value) {
+ try {
+ const recent = loadRecent();
+ const idx = recent.findIndex((r) => (r.value || r) === value);
+ if (idx >= 0) recent.splice(idx, 1);
+ recent.unshift({ label: value, value });
+ localStorage.setItem(RECENT_KEY, JSON.stringify(recent.slice(0, RECENT_MAX)));
+ } catch {
+ /* quota / disabled */
+ }
+}
+
+function loadChainSelection() {
+ try {
+ const raw = localStorage.getItem(CHAINS_KEY);
+ if (!raw) return DEFAULT_FAN_OUT_CHAINS.slice();
+ const arr = JSON.parse(raw);
+ if (!Array.isArray(arr) || !arr.length) return DEFAULT_FAN_OUT_CHAINS.slice();
+ return arr.map(Number).filter(Boolean);
+ } catch {
+ return DEFAULT_FAN_OUT_CHAINS.slice();
+ }
+}
+
+function saveChainSelection(arr) {
+ try {
+ localStorage.setItem(CHAINS_KEY, JSON.stringify(arr));
+ } catch {
+ /* quota / disabled */
+ }
}
diff --git a/src/erc8004/register-ui.js b/src/erc8004/register-ui.js
index 499d4fba4..04bd3ae79 100644
--- a/src/erc8004/register-ui.js
+++ b/src/erc8004/register-ui.js
@@ -42,9 +42,17 @@ import {
listRegisteredEvents,
getAgentOnchain,
fetchAgentMetadata,
+ findAvatar3D,
getRegistryVersion,
getTotalSupply,
} from './queries.js';
+import {
+ detectInputType,
+ resolveByAddress,
+ resolveByTxHash,
+ resolveENSAddress,
+ INPUT_TYPES,
+} from './resolve-avatar.js';
// ───────────────────────────────────────────────────────────────────────────
// Templates (for the Templates tab → prefills Create)
@@ -483,22 +491,33 @@ export class RegisterUI {
return detail?.url || null;
}
- async _linkAgentToAccount({ agentId, chainId, txHash }) {
- if (!this._backendAgentId || !this.wallet) return;
+ async _linkAgentToAccount({ agentId, chainId, txHash, throwOnError = false }) {
+ if (!this._backendAgentId || !this.wallet) {
+ if (throwOnError) throw new Error('Sign in and connect a wallet first');
+ return;
+ }
try {
- await fetch(`/api/agents/${encodeURIComponent(this._backendAgentId)}/wallet`, {
- method: 'POST',
- credentials: 'include',
- headers: { 'content-type': 'application/json' },
- body: JSON.stringify({
- wallet_address: this.wallet.address,
- chain_id: chainId,
- erc8004_agent_id: agentId,
- tx_hash: txHash,
- }),
- });
+ const res = await fetch(
+ `/api/agents/${encodeURIComponent(this._backendAgentId)}/wallet`,
+ {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ wallet_address: this.wallet.address,
+ chain_id: chainId,
+ erc8004_agent_id: agentId,
+ tx_hash: txHash,
+ }),
+ },
+ );
+ if (!res.ok) {
+ const text = await res.text().catch(() => res.status);
+ throw new Error(`link failed (${res.status}): ${text}`);
+ }
} catch (err) {
console.warn('[erc8004] Failed to link on-chain agentId to account:', err.message);
+ if (throwOnError) throw err;
}
}
@@ -555,6 +574,27 @@ export class RegisterUI {
const step = this.wizardStep;
body.innerHTML = `
<div class="erc8004-wizard">
+ <div class="erc8004-quickstart" data-role="quickstart">
+ <div class="erc8004-quickstart-title">How would you like to start?</div>
+ <div class="erc8004-quickstart-grid">
+ <button class="erc8004-quickstart-btn" data-role="qs-saved" ${this._signedIn ? '' : 'disabled'}>
+ <div class="erc8004-quickstart-btn-title">🧑 My saved agent</div>
+ <div class="erc8004-quickstart-btn-hint">Prefill from the agent linked to your account.</div>
+ </button>
+ <button class="erc8004-quickstart-btn" data-role="qs-current">
+ <div class="erc8004-quickstart-btn-title">🪄 Current session</div>
+ <div class="erc8004-quickstart-btn-hint">Use the avatar loaded in the viewer right now.</div>
+ </button>
+ <button class="erc8004-quickstart-btn" data-role="qs-scratch">
+ <div class="erc8004-quickstart-btn-title">📝 From scratch</div>
+ <div class="erc8004-quickstart-btn-hint">Metadata-only agent — add a GLB later if you want.</div>
+ </button>
+ <button class="erc8004-quickstart-btn" data-role="qs-update">
+ <div class="erc8004-quickstart-btn-title">✏️ Update on-chain</div>
+ <div class="erc8004-quickstart-btn-hint">Edit an agent you've already registered.</div>
+ </button>
+ </div>
+ </div>
<ol class="erc8004-steps">
${[1, 2, 3, 4]
.map(
@@ -570,6 +610,18 @@ export class RegisterUI {
<div class="erc8004-wizard-body" data-role="wizard-body"></div>
</div>
`;
+ body.querySelector('[data-role="qs-saved"]').addEventListener('click', () =>
+ this._applyQuickStart('saved'),
+ );
+ body.querySelector('[data-role="qs-current"]').addEventListener('click', () =>
+ this._applyQuickStart('current'),
+ );
+ body.querySelector('[data-role="qs-scratch"]').addEventListener('click', () =>
+ this._applyQuickStart('scratch'),
+ );
+ body.querySelector('[data-role="qs-update"]').addEventListener('click', () =>
+ this._applyQuickStart('update'),
+ );
const wbody = body.querySelector('[data-role="wizard-body"]');
if (step === 1) this._renderStepIdentity(wbody);
else if (step === 2) this._renderStepServices(wbody);
@@ -577,6 +629,63 @@ export class RegisterUI {
else this._renderStepDeploy(wbody);
}
+ /**
+ * Apply one of the Step-0 quick-start modes. Resets wizard state appropriately
+ * and returns to Step 1. Signed-in-only modes bail with a toast if no session.
+ */
+ async _applyQuickStart(mode) {
+ if (mode === 'update') {
+ this._setTab('my');
+ this._toast('Pick an agent and click "Edit on-chain ✏️".');
+ return;
+ }
+ if (mode === 'scratch') {
+ this.form = {
+ name: '',
+ description: '',
+ imageUrl: '',
+ glbUrl: '',
+ glbFile: null,
+ savedAvatar: null,
+ avatarSource: 'skip',
+ services: [],
+ apiToken: this.form.apiToken || '',
+ };
+ this.wizardStep = 1;
+ this._renderActiveTab();
+ return;
+ }
+ if (mode === 'current') {
+ this.form.avatarSource = this.form.glbUrl ? 'current' : 'upload';
+ this.wizardStep = 1;
+ this._renderActiveTab();
+ return;
+ }
+ if (mode === 'saved') {
+ if (!this._signedIn) {
+ this._toast('Sign in to use a saved agent.', true);
+ return;
+ }
+ try {
+ const res = await fetch('/api/agents/me', { credentials: 'include' });
+ const body = await res.json().catch(() => ({}));
+ const agent = body?.agent;
+ if (!agent) {
+ this._toast('No saved agent on this account yet.', true);
+ return;
+ }
+ this.form.name = agent.name || this.form.name;
+ this.form.description = agent.description || this.form.description;
+ this.form.avatarSource = 'saved';
+ this.wizardStep = 1;
+ this._renderActiveTab();
+ this._loadSavedAvatars?.();
+ } catch (err) {
+ this._toast('Could not load saved agent: ' + err.message, true);
+ }
+ }
+ }
+
_renderStepIdentity(body) {
body.innerHTML = `
<h3 class="erc8004-h3">Agent Identity</h3>
@@ -1323,9 +1432,11 @@ export class RegisterUI {
const name = meta.ok ? meta.data.name || `Agent #${agentId}` : `Agent #${agentId}`;
const description = meta.ok ? meta.data.description : '';
const image = meta.ok ? meta.data.image : '';
+ const glbUrl = meta.ok ? findAvatar3D(meta.data) : null;
const hasX402 = meta.ok && (meta.data.x402Support || meta.data.x402);
card._meta = meta.ok ? meta.data : null;
card._owner = owner;
+ const publicUrl = `/a/${this.selectedChainId}/${agentId}`;
const isOwner =
this.wallet && owner && this.wallet.address.toLowerCase() === owner.toLowerCase();
@@ -1342,13 +1453,16 @@ export class RegisterUI {
<span class="erc8004-tag">#${agentId}</span>
${hasX402 ? `<span class="erc8004-tag erc8004-tag--x402">x402 💳</span>` : ''}
${isOwner ? `<span class="erc8004-tag erc8004-tag--owner">You own this</span>` : ''}
+ ${glbUrl ? `<span class="erc8004-tag" title="Resolvable 3D avatar">3D</span>` : ''}
</div>
${description ? `<p class="erc8004-p erc8004-clip">${esc(description)}</p>` : ''}
<div class="erc8004-agent-card-actions">
${tokenUrl ? `<a class="erc8004-link" href="${esc(tokenUrl)}" target="_blank" rel="noopener">Details ↗</a>` : ''}
- <a class="erc8004-link" href="#agent=${agentId}">Open in viewer</a>
+ ${glbUrl ? `<a class="erc8004-link" href="${esc(publicUrl)}">Open in 3D ↗</a>` : `<a class="erc8004-link" href="#agent=${agentId}">Open in viewer</a>`}
${opts.withQR && tokenUrl ? `<button type="button" class="erc8004-link" data-role="qr">QR</button>` : ''}
${opts.withEdit ? `<button type="button" class="erc8004-link" data-role="edit">Edit on-chain ✏️</button>` : ''}
+ ${isOwner ? `<button type="button" class="erc8004-link" data-role="redeploy">Deploy on another chain 🌐</button>` : ''}
+ ${isOwner ? `<button type="button" class="erc8004-link" data-role="transfer">Transfer 🔁</button>` : ''}
${showLink ? `<button type="button" class="erc8004-link" data-role="link">Link to my account 🔗</button>` : ''}
</div>
</div>
@@ -1369,6 +1483,16 @@ export class RegisterUI {
this._openEditModal({ agentId, currentMeta: card._meta, card }),
);
}
+ const redeployBtn = card.querySelector('[data-role="redeploy"]');
+ if (redeployBtn)
+ redeployBtn.addEventListener('click', () =>
+ this._openRedeployModal({ agentId, currentMeta: card._meta }),
+ );
+ const transferBtn = card.querySelector('[data-role="transfer"]');
+ if (transferBtn)
+ transferBtn.addEventListener('click', () =>
+ this._openTransferModal({ agentId, card }),
+ );
const linkBtn = card.querySelector('[data-role="link"]');
if (linkBtn)
linkBtn.addEventListener('click', async () => {
@@ -1378,6 +1502,7 @@ export class RegisterUI {
await this._linkAgentToAccount({
agentId: Number(agentId),
chainId: this.selectedChainId,
+ throwOnError: true,
});
linkBtn.textContent = 'Linked ✓';
this._toast('Agent linked to your account');
@@ -1612,17 +1737,187 @@ export class RegisterUI {
say('Agent URI updated ✓');
}
+ // -----------------------------------------------------------------------
+ // Transfer ownership — ERC-721 safeTransferFrom
+ // -----------------------------------------------------------------------
+
+ _openTransferModal({ agentId, card }) {
+ const modal = document.createElement('div');
+ modal.className = 'erc8004-modal';
+ modal.innerHTML = `
+ <div class="erc8004-modal-card">
+ <div class="erc8004-modal-head">
+ <div class="erc8004-h4" style="margin:0">Transfer Agent #${String(agentId)}</div>
+ <button class="erc8004-btn erc8004-btn--x" data-role="close" title="Close">✕</button>
+ </div>
+ <p class="erc8004-muted erc8004-small">Transfers the agent NFT to a new owner on <b>${esc(CHAIN_META[this.selectedChainId]?.name || '?')}</b>. The new owner gains full control — they can update the URI, transfer it again, or burn it.</p>
+ <label class="erc8004-label">Recipient address
+ <input class="erc8004-input" name="to" placeholder="0x…" />
+ </label>
+ <div class="erc8004-log" data-role="log"></div>
+ <div class="erc8004-row" style="justify-content:flex-end">
+ <button class="erc8004-btn" data-role="cancel">Cancel</button>
+ <button class="erc8004-btn erc8004-btn--primary" data-role="go">Transfer</button>
+ </div>
+ </div>
+ `;
+ this.el.appendChild(modal);
+ const close = () => modal.remove();
+ modal.addEventListener('click', (e) => {
+ if (e.target === modal) close();
+ });
+ modal.querySelector('[data-role="close"]').addEventListener('click', close);
+ modal.querySelector('[data-role="cancel"]').addEventListener('click', close);
+
+ modal.querySelector('[data-role="go"]').addEventListener('click', async () => {
+ const btn = modal.querySelector('[data-role="go"]');
+ const log = modal.querySelector('[data-role="log"]');
+ const say = (msg, err = false) => {
+ const line = document.createElement('div');
+ line.className = 'erc8004-log-line' + (err ? ' erc8004-log-error' : '');
+ line.textContent = msg;
+ log.appendChild(line);
+ };
+ const to = modal.querySelector('[name="to"]').value.trim();
+ if (!/^0x[0-9a-fA-F]{40}$/.test(to)) {
+ say('Invalid recipient address.', true);
+ return;
+ }
+ btn.disabled = true;
+ try {
+ say('Connecting wallet…');
+ const { signer, address } = await connectWallet();
+ const registry = getIdentityRegistry(this.selectedChainId, signer);
+ say('Submitting safeTransferFrom…');
+ const tx = await registry['safeTransferFrom(address,address,uint256)'](
+ address,
+ to,
+ agentId,
+ );
+ say(`Transaction: ${tx.hash}`);
+ await tx.wait();
+ say('Transfer complete ✓');
+ this._toast('Agent transferred');
+ close();
+ if (card) this._fillAgentCard(card, agentId, { withQR: true, withEdit: true });
+ } catch (err) {
+ say('Transfer failed: ' + (err.shortMessage || err.message || String(err)), true);
+ btn.disabled = false;
+ }
+ });
+ }
+
+ // -----------------------------------------------------------------------
+ // Deploy on another chain — re-mint using the current agent's metadata
+ // -----------------------------------------------------------------------
+
+ _openRedeployModal({ agentId, currentMeta }) {
+ const meta = currentMeta || {};
+ const chainOptions = supportedChainIds()
+ .filter((id) => id !== this.selectedChainId)
+ .map(
+ (id) =>
+ `<option value="${id}">${esc(CHAIN_META[id]?.name || id)} ${CHAIN_META[id]?.testnet ? '(testnet)' : ''}</option>`,
+ )
+ .join('');
+
+ const modal = document.createElement('div');
+ modal.className = 'erc8004-modal';
+ modal.innerHTML = `
+ <div class="erc8004-modal-card">
+ <div class="erc8004-modal-head">
+ <div class="erc8004-h4" style="margin:0">Deploy #${String(agentId)} on another chain</div>
+ <button class="erc8004-btn erc8004-btn--x" data-role="close" title="Close">✕</button>
+ </div>
+ <p class="erc8004-muted erc8004-small">Mints a new agent on the selected chain reusing this agent's name, description, image, and 3D body. The new agent gets its own on-chain ID — nothing about the original changes.</p>
+ <label class="erc8004-label">Target chain
+ <select class="erc8004-input" name="chain">${chainOptions}</select>
+ </label>
+ <label class="erc8004-label">Pinata JWT (optional)
+ <input class="erc8004-input" name="apiToken" placeholder="leave blank for R2 backend" />
+ </label>
+ <div class="erc8004-log" data-role="log"></div>
+ <div class="erc8004-row" style="justify-content:flex-end">
+ <button class="erc8004-btn" data-role="cancel">Cancel</button>
+ <button class="erc8004-btn erc8004-btn--primary" data-role="go">Deploy</button>
+ </div>
+ </div>
+ `;
+ this.el.appendChild(modal);
+ const close = () => modal.remove();
+ modal.addEventListener('click', (e) => {
+ if (e.target === modal) close();
+ });
+ modal.querySelector('[data-role="close"]').addEventListener('click', close);
+ modal.querySelector('[data-role="cancel"]').addEventListener('click', close);
+
+ modal.querySelector('[data-role="go"]').addEventListener('click', async () => {
+ const btn = modal.querySelector('[data-role="go"]');
+ const log = modal.querySelector('[data-role="log"]');
+ const say = (msg, err = false) => {
+ const line = document.createElement('div');
+ line.className = 'erc8004-log-line' + (err ? ' erc8004-log-error' : '');
+ line.textContent = msg;
+ log.appendChild(line);
+ };
+ const targetChainId = Number(modal.querySelector('[name="chain"]').value);
+ const apiToken = modal.querySelector('[name="apiToken"]').value.trim() || undefined;
+ btn.disabled = true;
+ try {
+ say(`Switching wallet to ${CHAIN_META[targetChainId]?.name || targetChainId}…`);
+ await switchChain(targetChainId);
+ const existingGlb = (meta.services || []).find(
+ (s) => s?.name === 'avatar' && s?.endpoint,
+ )?.endpoint;
+ let glbFile = null;
+ if (existingGlb) {
+ glbFile = await this._fetchUrlAsFile(
+ existingGlb.startsWith('ipfs://')
+ ? 'https://ipfs.io/ipfs/' + existingGlb.slice(7)
+ : existingGlb,
+ say,
+ '3D body',
+ );
+ }
+ const preservedServices = (meta.services || []).filter(
+ (s) => s?.name !== 'avatar' && s?.name !== '3D',
+ );
+ say('Registering on new chain…');
+ const result = await registerAgent({
+ glbFile,
+ name: meta.name || `Agent #${agentId}`,
+ description: meta.description || '',
+ imageUrl: meta.image || '',
+ apiToken,
+ services: preservedServices,
+ x402Support: !!(meta.x402Support || meta.x402),
+ onStatus: (m) => say(m),
+ });
+ say(`Deployed! New agentId = ${result.agentId} on chain ${targetChainId}`);
+ this._toast(`Deployed as #${result.agentId} on ${CHAIN_META[targetChainId]?.name}`);
+ close();
+ } catch (err) {
+ say('Deploy failed: ' + (err.shortMessage || err.message || String(err)), true);
+ btn.disabled = false;
+ }
+ });
+ }
+
// -----------------------------------------------------------------------
// Tab: Search
// -----------------------------------------------------------------------
_renderSearch(body) {
if (!this._searchFilter) this._searchFilter = 'all';
+ const chainName = esc(CHAIN_META[this.selectedChainId]?.name);
body.innerHTML = `
<h3 class="erc8004-h3">Agent Search</h3>
- <p class="erc8004-p">Find a registered agent by its on-chain ID on <b>${esc(CHAIN_META[this.selectedChainId]?.name)}</b>.</p>
+ <p class="erc8004-p">
+ Look up agents on <b>${chainName}</b> by ID, wallet address, ENS name, tx hash, or <code>agent://</code> URI.
+ Need cross-chain? <a class="erc8004-link" href="/explore" target="_blank" rel="noopener">Open /explore ↗</a>.
+ </p>
<div class="erc8004-row">
- <input class="erc8004-input" name="q" placeholder="Agent ID (e.g., 6443)" />
+ <input class="erc8004-input" name="q" placeholder="Agent ID · 0x address · ENS · tx hash · agent://chain/id" />
<button class="erc8004-btn erc8004-btn--primary" data-role="go">Search</button>
</div>
<div class="erc8004-filter-chips" data-role="chips">
@@ -1651,18 +1946,82 @@ export class RegisterUI {
});
const go = async () => {
- const id = q.value.trim();
- if (!/^\d+$/.test(id)) {
- out.innerHTML = `<div class="erc8004-log-error">Enter a numeric Agent ID.</div>`;
- return;
- }
- out.innerHTML = `<div class="erc8004-muted">Loading #${id}…</div>`;
+ const raw = q.value.trim();
+ if (!raw) return;
+ const type = detectInputType(raw);
+ out.innerHTML = `<div class="erc8004-muted">Resolving…</div>`;
+
try {
- const card = document.createElement('div');
- card.className = 'erc8004-agent-card';
+ let agentIds = [];
+ if (type === INPUT_TYPES.AGENT_ID) {
+ agentIds = [BigInt(raw)];
+ } else if (type === INPUT_TYPES.AGENT_URI) {
+ const match = raw.match(/^agent:\/\/([^/]+)\/(\d+)$/i);
+ if (!match) throw new Error('Malformed agent:// URI');
+ const aliases = {
+ base: 8453,
+ 'base-sepolia': 84532,
+ ethereum: 1,
+ mainnet: 1,
+ optimism: 10,
+ arbitrum: 42161,
+ polygon: 137,
+ bsc: 56,
+ };
+ const uriChain = aliases[match[1].toLowerCase()] || Number(match[1]);
+ if (uriChain !== this.selectedChainId) {
+ out.innerHTML = `<div class="erc8004-log-error">
+ This agent is on <b>${esc(CHAIN_META[uriChain]?.name || `Chain ${uriChain}`)}</b>, not the selected chain.
+ <a class="erc8004-link" href="/explore?q=${encodeURIComponent(raw)}" target="_blank" rel="noopener">Open in /explore ↗</a>
+ </div>`;
+ return;
+ }
+ agentIds = [BigInt(match[2])];
+ } else if (type === INPUT_TYPES.ADDRESS) {
+ const results = await resolveByAddress({
+ address: raw,
+ chainIds: [this.selectedChainId],
+ ethProvider: window.ethereum,
+ });
+ agentIds = results.map((r) => BigInt(r.agentId));
+ } else if (type === INPUT_TYPES.ENS) {
+ const addr = await resolveENSAddress(raw);
+ const results = await resolveByAddress({
+ address: addr,
+ chainIds: [this.selectedChainId],
+ ethProvider: window.ethereum,
+ });
+ agentIds = results.map((r) => BigInt(r.agentId));
+ } else if (type === INPUT_TYPES.TX_HASH) {
+ const results = await resolveByTxHash({
+ txHash: raw,
+ chainId: this.selectedChainId,
+ ethProvider: window.ethereum,
+ });
+ agentIds = results.map((r) => BigInt(r.agentId));
+ } else {
+ out.innerHTML = `<div class="erc8004-log-error">Unrecognized input. Try an agent ID, 0x address, ENS name, tx hash, or agent:// URI.</div>`;
+ return;
+ }
+
+ if (!agentIds.length) {
+ out.innerHTML = `
+ <div class="erc8004-muted">
+ No agents resolved on ${chainName} for <code>${esc(raw)}</code>.
+ <a class="erc8004-link" href="/explore?q=${encodeURIComponent(raw)}" target="_blank" rel="noopener">Try across all chains ↗</a>
+ </div>
+ `;
+ return;
+ }
+
out.innerHTML = '';
- out.appendChild(card);
- await this._fillAgentCard(card, BigInt(id), { withQR: true });
+ for (const id of agentIds) {
+ const card = document.createElement('div');
+ card.className = 'erc8004-agent-card';
+ card.innerHTML = `<div class="erc8004-muted">Loading #${id}…</div>`;
+ out.appendChild(card);
+ this._fillAgentCard(card, id, { withQR: true, withEdit: true });
+ }
this._applySearchFilter(out);
} catch (err) {
out.innerHTML = `<div class="erc8004-log-error">${esc(err.message)}</div>`;
diff --git a/style.css b/style.css
index a9e06f9d7..59dfff1d5 100644
--- a/style.css
+++ b/style.css
@@ -1125,6 +1125,681 @@ footer .separator {
color: #ff7a7a;
}
+/* /explore — cross-chain on-chain avatar browser.
+ *
+ * Search ANY input (address / ENS / tx / agent ID / agent:// URI) and see every
+ * matching ERC-8004 registered 3D avatar as a gallery, grouped by chain.
+ * Implementation: src/erc8004/explore.js → src/erc8004/resolve-avatar.js.
+ */
+.explore-shell {
+ max-width: 1200px;
+ margin: 0 auto;
+}
+
+/* Hero */
+.explore-hero {
+ padding: var(--space-xl) 0 var(--space-lg);
+}
+.explore-hero-inner {
+ max-width: 780px;
+ margin: 0 auto;
+ text-align: center;
+}
+.explore-eyebrow {
+ display: inline-block;
+ padding: var(--space-3xs) var(--space-sm);
+ margin-bottom: var(--space-sm);
+ background: rgba(99, 102, 241, 0.12);
+ border: 1px solid rgba(99, 102, 241, 0.3);
+ border-radius: 999px;
+ font-size: var(--text-xs);
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: rgba(165, 180, 252, 0.95);
+}
+.explore-title {
+ margin: 0 0 var(--space-sm);
+ font-size: clamp(1.8rem, 4vw, 2.6rem);
+ line-height: 1.1;
+ letter-spacing: -0.02em;
+ color: #fff;
+}
+.explore-subtitle {
+ margin: 0 auto var(--space-lg);
+ max-width: 560px;
+ color: rgba(255, 255, 255, 0.65);
+ line-height: 1.5;
+}
+
+/* Search form */
+.explore-form {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: var(--space-xs);
+ margin: 0 auto;
+ max-width: 680px;
+}
+.explore-input-wrap {
+ display: flex;
+ width: 100%;
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 14px;
+ overflow: hidden;
+ transition:
+ border-color 0.15s ease,
+ box-shadow 0.15s ease;
+}
+.explore-input-wrap:focus-within {
+ border-color: rgba(123, 97, 255, 0.65);
+ box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.18);
+}
+.explore-input {
+ flex: 1;
+ min-width: 0;
+ padding: var(--space-md) var(--space-lg);
+ background: transparent;
+ border: none;
+ outline: none;
+ color: #fff;
+ font-family: inherit;
+ font-size: var(--text-base);
+}
+.explore-input::placeholder {
+ color: rgba(255, 255, 255, 0.35);
+}
+.explore-input-meta {
+ font-size: var(--text-xs);
+ color: rgba(255, 255, 255, 0.45);
+ min-height: 1em;
+}
+.explore-inputmeta--ok {
+ color: rgba(134, 239, 172, 0.9);
+}
+.explore-inputmeta--warn {
+ color: rgba(253, 186, 116, 0.9);
+}
+
+/* Examples / recent searches */
+.explore-examples {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ gap: var(--space-xs);
+ margin-top: var(--space-md);
+}
+.explore-examples-lbl {
+ color: rgba(255, 255, 255, 0.4);
+ font-size: var(--text-xs);
+ margin-right: var(--space-2xs);
+}
+.explore-example {
+ padding: var(--space-3xs) var(--space-sm);
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 999px;
+ color: rgba(255, 255, 255, 0.75);
+ font-family: inherit;
+ font-size: var(--text-xs);
+ cursor: pointer;
+ transition:
+ background 0.15s ease,
+ border-color 0.15s ease;
+}
+.explore-example:hover {
+ background: rgba(255, 255, 255, 0.1);
+ border-color: rgba(255, 255, 255, 0.2);
+ color: #fff;
+}
+
+/* Controls bar (chain chips + progress) */
+.explore-controls {
+ position: sticky;
+ top: var(--header-h, 0);
+ z-index: 3;
+ padding: var(--space-sm) 0;
+ margin: 0 0 var(--space-md);
+ background: rgba(8, 8, 20, 0.82);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
+}
+.explore-controls-row {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: var(--space-sm);
+}
+.explore-controls-lbl {
+ color: rgba(255, 255, 255, 0.45);
+ font-size: var(--text-xs);
+ text-transform: uppercase;
+ letter-spacing: 0.08em;
+}
+.explore-controls-spacer {
+ flex: 1;
+}
+.explore-chain-chips {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: var(--space-2xs);
+}
+.explore-chain-group {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-2xs);
+}
+.explore-chain-group--testnet {
+ opacity: 0.85;
+}
+.explore-chain-divider {
+ color: rgba(255, 255, 255, 0.25);
+ padding: 0 var(--space-2xs);
+}
+.explore-chain-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-2xs);
+ padding: 3px var(--space-sm);
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 999px;
+ color: rgba(255, 255, 255, 0.55);
+ font-family: inherit;
+ font-size: var(--text-xs);
+ cursor: pointer;
+ transition:
+ background 0.15s ease,
+ border-color 0.15s ease,
+ color 0.15s ease;
+}
+.explore-chain-chip:hover {
+ color: #fff;
+ border-color: rgba(255, 255, 255, 0.2);
+}
+.explore-chain-chip--active {
+ background: rgba(123, 97, 255, 0.18);
+ border-color: rgba(123, 97, 255, 0.5);
+ color: #fff;
+}
+.explore-chain-chip--testnet .explore-chain-dot {
+ background: rgba(253, 186, 116, 0.8);
+}
+.explore-chain-dot {
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ background: rgba(134, 239, 172, 0.8);
+}
+.explore-chain-chip--active.explore-chain-chip .explore-chain-dot {
+ box-shadow: 0 0 6px currentColor;
+}
+.explore-chain-presets-btn {
+ padding: 3px var(--space-sm);
+ background: transparent;
+ border: 1px dashed rgba(255, 255, 255, 0.15);
+ border-radius: 999px;
+ color: rgba(255, 255, 255, 0.5);
+ font-family: inherit;
+ font-size: var(--text-xs);
+ cursor: pointer;
+ transition: all 0.15s ease;
+}
+.explore-chain-presets-btn:hover {
+ color: #fff;
+ border-color: rgba(255, 255, 255, 0.3);
+}
+
+/* Progress HUD */
+.explore-progress {
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-xs);
+ font-size: var(--text-xs);
+ color: rgba(255, 255, 255, 0.6);
+}
+.explore-progress-spinner {
+ width: 12px;
+ height: 12px;
+ border: 2px solid rgba(255, 255, 255, 0.15);
+ border-top-color: rgba(165, 180, 252, 0.95);
+ border-radius: 50%;
+ animation: explore-spin 0.7s linear infinite;
+}
+@keyframes explore-spin {
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+/* Results area */
+.explore-results {
+ padding-bottom: var(--space-2xl);
+}
+.explore-summary {
+ margin: var(--space-md) 0;
+}
+.explore-summary-head {
+ display: flex;
+ align-items: baseline;
+ flex-wrap: wrap;
+ gap: var(--space-sm);
+}
+.explore-summary-title {
+ margin: 0;
+ font-size: var(--text-lg);
+ color: #fff;
+ font-weight: 500;
+}
+.explore-summary-stat {
+ color: rgba(255, 255, 255, 0.5);
+ font-size: var(--text-xs);
+}
+.explore-summary-sub {
+ margin-top: var(--space-2xs);
+ color: rgba(255, 255, 255, 0.55);
+ font-size: var(--text-xs);
+ word-break: break-all;
+}
+.explore-summary-sub code {
+ background: rgba(255, 255, 255, 0.05);
+ padding: 2px 6px;
+ border-radius: 4px;
+}
+
+/* Filter chips */
+.explore-filterbar {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-2xs);
+ margin: var(--space-sm) 0 var(--space-md);
+}
+.explore-filter {
+ padding: 4px var(--space-md);
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 999px;
+ color: rgba(255, 255, 255, 0.65);
+ font-family: inherit;
+ font-size: var(--text-xs);
+ cursor: pointer;
+ transition:
+ background 0.15s ease,
+ border-color 0.15s ease;
+}
+.explore-filter:hover {
+ background: rgba(255, 255, 255, 0.08);
+ color: #fff;
+}
+.explore-filter--active {
+ background: rgba(123, 97, 255, 0.2);
+ border-color: rgba(123, 97, 255, 0.55);
+ color: #fff;
+}
+
+/* Grid + cards */
+.explore-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
+ gap: var(--space-md);
+}
+.explore-card {
+ display: flex;
+ flex-direction: column;
+ background: rgba(255, 255, 255, 0.03);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 14px;
+ overflow: hidden;
+ transition:
+ transform 0.15s ease,
+ border-color 0.15s ease,
+ box-shadow 0.15s ease;
+}
+.explore-card:hover {
+ transform: translateY(-2px);
+ border-color: rgba(123, 97, 255, 0.4);
+ box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
+}
+.explore-card-thumb {
+ position: relative;
+ aspect-ratio: 1 / 1;
+ background: linear-gradient(135deg, #131226 0%, #1a1a2e 100%);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ overflow: hidden;
+ text-decoration: none;
+}
+.explore-card-thumb img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+.explore-card-ph {
+ font-size: 2.4rem;
+ opacity: 0.35;
+}
+.explore-chain-badge {
+ position: absolute;
+ top: var(--space-2xs);
+ left: var(--space-2xs);
+ padding: 2px var(--space-xs);
+ background: rgba(8, 8, 20, 0.75);
+ border: 1px solid rgba(255, 255, 255, 0.15);
+ border-radius: 999px;
+ color: #fff;
+ font-size: 10px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ backdrop-filter: blur(6px);
+ -webkit-backdrop-filter: blur(6px);
+}
+.explore-chain-badge--testnet {
+ color: rgba(253, 186, 116, 0.95);
+ border-color: rgba(253, 186, 116, 0.35);
+}
+.explore-card-3dpill {
+ position: absolute;
+ right: var(--space-2xs);
+ bottom: var(--space-2xs);
+ padding: 3px var(--space-sm);
+ background: rgba(123, 97, 255, 0.9);
+ border-radius: 999px;
+ color: #fff;
+ font-size: 10px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.explore-card-body {
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-2xs);
+ padding: var(--space-sm) var(--space-md) var(--space-md);
+}
+.explore-card-head {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: var(--space-xs);
+}
+.explore-card-title {
+ color: #fff;
+ font-weight: 600;
+ text-decoration: none;
+ line-height: 1.25;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-line-clamp: 1;
+ -webkit-box-orient: vertical;
+}
+.explore-card-title:hover {
+ text-decoration: underline;
+}
+.explore-card-id {
+ color: rgba(255, 255, 255, 0.4);
+ font-size: var(--text-xs);
+ font-variant-numeric: tabular-nums;
+}
+.explore-card-desc {
+ margin: 0;
+ color: rgba(255, 255, 255, 0.65);
+ font-size: var(--text-xs);
+ line-height: 1.45;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+.explore-card-tags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 4px;
+ min-height: 16px;
+}
+.explore-tag {
+ padding: 1px var(--space-xs);
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 4px;
+ color: rgba(255, 255, 255, 0.7);
+ font-size: 10px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.explore-tag--3d {
+ color: rgba(165, 243, 252, 0.95);
+ border-color: rgba(165, 243, 252, 0.35);
+ background: rgba(14, 165, 233, 0.08);
+}
+.explore-tag--x402 {
+ color: rgba(253, 230, 138, 0.95);
+ border-color: rgba(253, 230, 138, 0.35);
+ background: rgba(245, 158, 11, 0.08);
+}
+.explore-owner {
+ color: rgba(255, 255, 255, 0.5);
+ font-size: var(--text-xs);
+ text-decoration: none;
+ font-family: ui-monospace, Menlo, monospace;
+}
+.explore-owner:hover {
+ color: #fff;
+ text-decoration: underline;
+}
+.explore-card-err {
+ color: rgba(248, 113, 113, 0.85);
+ font-size: var(--text-xs);
+}
+.explore-card-actions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-2xs);
+ margin-top: var(--space-xs);
+}
+
+/* Buttons (explore-scoped, not the erc8004 ones) */
+.explore-btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: var(--space-2xs);
+ padding: var(--space-sm) var(--space-lg);
+ background: rgba(255, 255, 255, 0.08);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 10px;
+ color: #fff;
+ font-family: inherit;
+ font-size: var(--text-sm);
+ font-weight: 500;
+ cursor: pointer;
+ text-decoration: none;
+ transition:
+ background 0.15s ease,
+ border-color 0.15s ease,
+ transform 0.1s ease;
+}
+.explore-btn:hover {
+ background: rgba(255, 255, 255, 0.14);
+ border-color: rgba(255, 255, 255, 0.2);
+}
+.explore-btn:active {
+ transform: scale(0.98);
+}
+.explore-btn--sm {
+ padding: 4px var(--space-sm);
+ font-size: var(--text-xs);
+ border-radius: 8px;
+}
+.explore-btn--primary {
+ background: linear-gradient(135deg, #7b61ff 0%, #5e42ff 100%);
+ border-color: rgba(123, 97, 255, 0.7);
+ color: #fff;
+ box-shadow: 0 4px 14px rgba(123, 97, 255, 0.35);
+}
+.explore-btn--primary:hover {
+ background: linear-gradient(135deg, #8a73ff 0%, #6f56ff 100%);
+ border-color: rgba(158, 138, 255, 0.9);
+}
+.explore-btn--ghost {
+ background: transparent;
+ border-color: rgba(255, 255, 255, 0.1);
+ color: rgba(255, 255, 255, 0.65);
+}
+.explore-btn--ghost:hover {
+ color: #fff;
+ background: rgba(255, 255, 255, 0.05);
+}
+
+/* Skeleton cards (loading state) */
+.explore-card--skel {
+ background: rgba(255, 255, 255, 0.02);
+ pointer-events: none;
+}
+.explore-skel-img {
+ aspect-ratio: 1 / 1;
+ background: linear-gradient(
+ 110deg,
+ rgba(255, 255, 255, 0.03) 30%,
+ rgba(255, 255, 255, 0.07) 50%,
+ rgba(255, 255, 255, 0.03) 70%
+ );
+ background-size: 200% 100%;
+ animation: explore-shimmer 1.4s ease-in-out infinite;
+}
+.explore-skel-line {
+ height: 10px;
+ margin: var(--space-sm) var(--space-md);
+ background: rgba(255, 255, 255, 0.05);
+ border-radius: 4px;
+}
+.explore-skel-line--short {
+ width: 60%;
+}
+@keyframes explore-shimmer {
+ 0% {
+ background-position: 200% 0;
+ }
+ 100% {
+ background-position: -200% 0;
+ }
+}
+
+/* Featured (no-query) header */
+.explore-featured-head {
+ margin: var(--space-md) 0 var(--space-md);
+}
+.explore-featured-head h2 {
+ margin: 0 0 var(--space-2xs);
+ font-size: var(--text-lg);
+ color: #fff;
+ font-weight: 500;
+}
+
+/* Empty + error states */
+.explore-empty,
+.explore-error {
+ padding: var(--space-xl);
+ text-align: center;
+ background: rgba(255, 255, 255, 0.02);
+ border: 1px dashed rgba(255, 255, 255, 0.1);
+ border-radius: 14px;
+ color: rgba(255, 255, 255, 0.7);
+}
+.explore-empty h3,
+.explore-error strong {
+ color: #fff;
+ font-weight: 600;
+ display: block;
+ margin: 0 0 var(--space-xs);
+}
+.explore-empty p,
+.explore-error p {
+ margin: 0 auto var(--space-md);
+ max-width: 520px;
+ font-size: var(--text-sm);
+ color: rgba(255, 255, 255, 0.6);
+}
+.explore-empty-art {
+ font-size: 3rem;
+ margin-bottom: var(--space-sm);
+}
+.explore-empty-ideas {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: var(--space-xs);
+}
+.explore-muted {
+ color: rgba(255, 255, 255, 0.5);
+ font-size: var(--text-xs);
+}
+
+@media screen and (max-width: 640px) {
+ .explore-title {
+ font-size: 2rem;
+ }
+ .explore-controls {
+ position: static;
+ }
+ .explore-grid {
+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
+ gap: var(--space-sm);
+ }
+ .explore-card-thumb .explore-chain-badge {
+ font-size: 9px;
+ }
+}
+
+/* Create-tab Step 0 — quickstart mode picker above the 4-step wizard. */
+.erc8004-quickstart {
+ margin-bottom: var(--space-md);
+ padding: var(--space-sm) var(--space-md);
+ background: rgba(255, 255, 255, 0.03);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 10px;
+}
+.erc8004-quickstart-title {
+ font-weight: 600;
+ margin-bottom: var(--space-xs);
+}
+.erc8004-quickstart-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
+ gap: var(--space-sm);
+}
+.erc8004-quickstart-btn {
+ display: block;
+ text-align: left;
+ padding: var(--space-sm);
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 8px;
+ color: inherit;
+ cursor: pointer;
+ transition:
+ border-color 0.12s ease,
+ background 0.12s ease;
+}
+.erc8004-quickstart-btn:hover:not(:disabled) {
+ border-color: rgba(255, 255, 255, 0.3);
+ background: rgba(255, 255, 255, 0.07);
+}
+.erc8004-quickstart-btn:disabled {
+ opacity: 0.45;
+ cursor: not-allowed;
+}
+.erc8004-quickstart-btn-title {
+ font-weight: 600;
+ margin-bottom: 2px;
+}
+.erc8004-quickstart-btn-hint {
+ font-size: var(--text-xs);
+ color: rgba(255, 255, 255, 0.6);
+}
+
.erc8004-register--page {
position: static;
inset: auto;
@@ -3929,6 +4604,12 @@ body[data-viewer-mode='main'][data-authed='false'] .auth-gate {
border-color: rgba(124, 58, 237, 0.4);
}
+.erc8004-tag--owner {
+ background: var(--accent-soft);
+ color: var(--accent);
+ border-color: var(--accent);
+}
+
/* Batch tab */
.erc8004-batch-drop {
height: 140px;
@@ -4055,7 +4736,9 @@ body[data-viewer-mode='main'][data-authed='false'] .auth-gate {
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: var(--radius-md);
cursor: pointer;
- transition: border-color 0.15s, background 0.15s;
+ transition:
+ border-color 0.15s,
+ background 0.15s;
}
.erc8004-avatar-source:hover {
@@ -4161,7 +4844,9 @@ body[data-viewer-mode='main'][data-authed='false'] .auth-gate {
text-align: left;
color: inherit;
font-family: inherit;
- transition: border-color 0.15s, background 0.15s;
+ transition:
+ border-color 0.15s,
+ background 0.15s;
}
.erc8004-saved-card:hover {
diff --git a/vercel.json b/vercel.json
index f2305c7ee..92fb46414 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,78 +1,124 @@
{
- "public": true,
- "routes": [
- { "src": "/\\.well-known/oauth-authorization-server", "dest": "/api/wk-oauth-authorization-server" },
- { "src": "/\\.well-known/oauth-protected-resource", "dest": "/api/wk-oauth-protected-resource" },
- { "src": "/api/mcp/\\.well-known/oauth-protected-resource", "dest": "/api/wk-oauth-protected-resource" },
+ "public": true,
+ "routes": [
+ {
+ "src": "/\\.well-known/oauth-authorization-server",
+ "dest": "/api/wk-oauth-authorization-server"
+ },
+ {
+ "src": "/\\.well-known/oauth-protected-resource",
+ "dest": "/api/wk-oauth-protected-resource"
+ },
+ {
+ "src": "/api/mcp/\\.well-known/oauth-protected-resource",
+ "dest": "/api/wk-oauth-protected-resource"
+ },
- { "src": "/oauth/authorize", "dest": "/api/oauth/authorize" },
- { "src": "/oauth/consent", "dest": "/api/oauth/authorize" },
- { "src": "/oauth/token", "dest": "/api/oauth/token" },
- { "src": "/oauth/register", "dest": "/api/oauth/register" },
- { "src": "/oauth/revoke", "dest": "/api/oauth/revoke" },
- { "src": "/oauth/introspect", "dest": "/api/oauth/introspect" },
+ { "src": "/oauth/authorize", "dest": "/api/oauth/authorize" },
+ { "src": "/oauth/consent", "dest": "/api/oauth/authorize" },
+ { "src": "/oauth/token", "dest": "/api/oauth/token" },
+ { "src": "/oauth/register", "dest": "/api/oauth/register" },
+ { "src": "/oauth/revoke", "dest": "/api/oauth/revoke" },
+ { "src": "/oauth/introspect", "dest": "/api/oauth/introspect" },
- { "src": "/login", "dest": "/public/login.html" },
- { "src": "/deploy", "dest": "/app.html" },
- { "src": "/dashboard", "dest": "/public/dashboard/index.html" },
- { "src": "/dashboard/", "dest": "/public/dashboard/index.html" },
- { "src": "/dashboard/(.*)", "dest": "/public/dashboard/$1" },
- { "src": "/studio", "dest": "/public/studio/index.html" },
- { "src": "/studio/", "dest": "/public/studio/index.html" },
- { "src": "/studio/(.*)", "dest": "/public/studio/$1" },
+ { "src": "/login", "dest": "/public/login.html" },
+ { "src": "/deploy", "dest": "/app.html" },
+ { "src": "/dashboard", "dest": "/public/dashboard/index.html" },
+ { "src": "/dashboard/", "dest": "/public/dashboard/index.html" },
+ { "src": "/dashboard/(.*)", "dest": "/public/dashboard/$1" },
+ { "src": "/studio", "dest": "/public/studio/index.html" },
+ { "src": "/studio/", "dest": "/public/studio/index.html" },
+ { "src": "/studio/(.*)", "dest": "/public/studio/$1" },
- { "src": "/api/agents/me", "dest": "/api/agents" },
- { "src": "/api/agents/by-wallet", "dest": "/api/agents/by-wallet" },
- { "src": "/api/agents/([^/]+)/wallet", "dest": "/api/agents/[id]" },
- { "src": "/api/agents/([^/]+)/embed-policy", "dest": "/api/agents/[id]/embed-policy?id=$1" },
- { "src": "/api/agents/([^/]+)/sign", "dest": "/api/agents/[id]/sign?id=$1" },
- { "src": "/api/agents/([^/]+)", "dest": "/api/agents/[id]" },
- { "src": "/api/agents", "dest": "/api/agents" },
- { "src": "/api/agent-actions", "dest": "/api/agent-actions" },
- { "src": "/api/agent-memory/([^/]+)", "dest": "/api/agent-memory" },
- { "src": "/api/agent-memory", "dest": "/api/agent-memory" },
- { "src": "/api/agent/([^/]+)/og", "dest": "/api/agent-og?id=$1" },
- { "src": "/api/oembed", "dest": "/api/agent-oembed" },
- { "src": "/agent/([^/]+)/edit", "dest": "/agent-edit.html" },
- { "src": "/agent/([^/]+)/embed", "dest": "/agent-embed.html" },
- { "src": "/agent/([^/]+)", "dest": "/agent-home.html" },
- { "src": "/agent", "dest": "/agent-home.html" },
+ { "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/agents/([^/]+)/embed-policy",
+ "dest": "/api/agents/[id]/embed-policy?id=$1"
+ },
+ { "src": "/api/agents/([^/]+)/sign", "dest": "/api/agents/[id]/sign?id=$1" },
+ { "src": "/api/agents/([^/]+)", "dest": "/api/agents/[id]" },
+ { "src": "/api/agents", "dest": "/api/agents" },
+ { "src": "/api/agent-actions", "dest": "/api/agent-actions" },
+ { "src": "/api/agent-memory/([^/]+)", "dest": "/api/agent-memory" },
+ { "src": "/api/agent-memory", "dest": "/api/agent-memory" },
+ { "src": "/api/agent/([^/]+)/og", "dest": "/api/agent-og?id=$1" },
+ { "src": "/api/oembed", "dest": "/api/agent-oembed" },
+ { "src": "/agent/([^/]+)/edit", "dest": "/agent-edit.html" },
+ { "src": "/agent/([^/]+)/embed", "dest": "/agent-embed.html" },
+ { "src": "/agent/([^/]+)", "dest": "/agent-home.html" },
+ { "src": "/agent", "dest": "/agent-home.html" },
- { "src": "/api/widgets/oembed", "dest": "/api/widgets/oembed" },
- { "src": "/api/widgets/page", "dest": "/api/widgets/page" },
- { "src": "/api/widgets/([A-Za-z0-9_-]+)/og", "dest": "/api/widgets/og?id=$1" },
- { "src": "/api/widgets/([A-Za-z0-9_-]+)/view", "dest": "/api/widgets/view?id=$1" },
- { "src": "/api/widgets/([A-Za-z0-9_-]+)/duplicate","dest": "/api/widgets/[id]/duplicate?id=$1" },
- { "src": "/api/widgets/([A-Za-z0-9_-]+)/stats", "dest": "/api/widgets/[id]/stats?id=$1" },
- { "src": "/api/widgets", "dest": "/api/widgets" },
- { "src": "/api/widgets/([A-Za-z0-9_-]+)", "dest": "/api/widgets/[id]?id=$1" },
- { "src": "/w/([A-Za-z0-9_-]+)", "dest": "/api/widgets/page?id=$1" },
- { "src": "/widgets", "dest": "/public/widgets-gallery/index.html" },
- { "src": "/widgets/", "dest": "/public/widgets-gallery/index.html" },
- { "src": "/widgets/(.*)", "dest": "/public/widgets-gallery/$1" },
- { "src": "/docs/widgets", "dest": "/public/docs-widgets.html" },
+ { "src": "/api/widgets/oembed", "dest": "/api/widgets/oembed" },
+ { "src": "/api/widgets/page", "dest": "/api/widgets/page" },
+ { "src": "/api/widgets/([A-Za-z0-9_-]+)/og", "dest": "/api/widgets/og?id=$1" },
+ { "src": "/api/widgets/([A-Za-z0-9_-]+)/view", "dest": "/api/widgets/view?id=$1" },
+ {
+ "src": "/api/widgets/([A-Za-z0-9_-]+)/duplicate",
+ "dest": "/api/widgets/[id]/duplicate?id=$1"
+ },
+ { "src": "/api/widgets/([A-Za-z0-9_-]+)/stats", "dest": "/api/widgets/[id]/stats?id=$1" },
+ { "src": "/api/widgets", "dest": "/api/widgets" },
+ { "src": "/api/widgets/([A-Za-z0-9_-]+)", "dest": "/api/widgets/[id]?id=$1" },
+ { "src": "/w/([A-Za-z0-9_-]+)", "dest": "/api/widgets/page?id=$1" },
+ { "src": "/widgets", "dest": "/public/widgets-gallery/index.html" },
+ { "src": "/widgets/", "dest": "/public/widgets-gallery/index.html" },
+ { "src": "/widgets/(.*)", "dest": "/public/widgets-gallery/$1" },
+ { "src": "/docs/widgets", "dest": "/public/docs-widgets.html" },
- { "src": "/api/(.*)", "dest": "/api/$1" },
+ { "src": "/api/(.*)", "dest": "/api/$1" },
- {
- "src": "/assets/(.*)",
- "headers": { "cache-control": "max-age=604800, public" },
- "dest": "/assets/$1"
- },
- {
- "src": "/\\.well-known/(.*)",
- "headers": { "cache-control": "max-age=86400, public" },
- "dest": "/public/.well-known/$1"
- },
- { "src": "/robots.txt", "dest": "/public/robots.txt" },
- { "src": "/sitemap.xml", "dest": "/public/sitemap.xml" },
- { "src": "/app", "dest": "/app.html" },
- { "src": "/features", "dest": "/features.html" },
- { "src": "/create", "dest": "/create.html" },
- { "src": "/create/", "dest": "/create.html" },
- { "src": "/home", "dest": "/home.html" },
- { "src": "/explore", "dest": "/app.html" },
- { "src": "/a/(.*)", "dest": "/app.html" },
- { "src": "/(.*)", "dest": "/public/$1" }
- ]
+ {
+ "src": "/agent-3d/([0-9]+\\.[0-9]+\\.[0-9]+(?:-[A-Za-z0-9.-]+)?)/(.*)",
+ "headers": {
+ "cache-control": "public, max-age=31536000, immutable",
+ "access-control-allow-origin": "*",
+ "access-control-allow-methods": "GET, HEAD, OPTIONS",
+ "cross-origin-resource-policy": "cross-origin",
+ "timing-allow-origin": "*"
+ },
+ "dest": "/agent-3d/$1/$2"
+ },
+ {
+ "src": "/agent-3d/(latest|[0-9]+|[0-9]+\\.[0-9]+)/(.*)",
+ "headers": {
+ "cache-control": "public, max-age=300, s-maxage=300, stale-while-revalidate=86400",
+ "access-control-allow-origin": "*",
+ "access-control-allow-methods": "GET, HEAD, OPTIONS",
+ "cross-origin-resource-policy": "cross-origin",
+ "timing-allow-origin": "*"
+ },
+ "dest": "/agent-3d/$1/$2"
+ },
+ {
+ "src": "/agent-3d/versions\\.json",
+ "headers": {
+ "cache-control": "public, max-age=60, s-maxage=60",
+ "access-control-allow-origin": "*"
+ },
+ "dest": "/agent-3d/versions.json"
+ },
+
+ {
+ "src": "/assets/(.*)",
+ "headers": { "cache-control": "max-age=604800, public" },
+ "dest": "/assets/$1"
+ },
+ {
+ "src": "/\\.well-known/(.*)",
+ "headers": { "cache-control": "max-age=86400, public" },
+ "dest": "/public/.well-known/$1"
+ },
+ { "src": "/robots.txt", "dest": "/public/robots.txt" },
+ { "src": "/sitemap.xml", "dest": "/public/sitemap.xml" },
+ { "src": "/app", "dest": "/app.html" },
+ { "src": "/features", "dest": "/features.html" },
+ { "src": "/create", "dest": "/create.html" },
+ { "src": "/create/", "dest": "/create.html" },
+ { "src": "/home", "dest": "/home.html" },
+ { "src": "/explore", "dest": "/app.html" },
+ { "src": "/a/(.*)", "dest": "/app.html" },
+ { "src": "/(.*)", "dest": "/public/$1" }
+ ]
}
diff --git a/vite.config.js b/vite.config.js
index 915f77604..5915f1587 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -30,7 +30,7 @@ const appConfig = {
embed: resolve(__dirname, 'embed.html'),
create: resolve(__dirname, 'create.html'),
'agent-home': resolve(__dirname, 'agent-home.html'),
- 'agent-edit': resolve(__dirname, 'agent-edit.html'),
+ 'agent-edit': resolve(__dirname, 'agent-edit.html'),
'agent-embed': resolve(__dirname, 'agent-embed.html'),
},
},
@@ -41,26 +41,30 @@ const appConfig = {
configureServer(server) {
const root = resolve(__dirname);
const fileMap = {
- '/app': resolve(root, 'app.html'),
- '/login': resolve(root, 'public/login.html'),
- '/deploy': resolve(root, 'app.html'),
- '/explore': resolve(root, 'app.html'),
- '/features': resolve(root, 'features.html'),
- '/create': resolve(root, 'create.html'),
- '/dashboard': resolve(root, 'public/dashboard/index.html'),
- '/studio': resolve(root, 'public/studio/index.html'),
- '/widgets': resolve(root, 'public/widgets-gallery/index.html'),
+ '/app': resolve(root, 'app.html'),
+ '/login': resolve(root, 'public/login.html'),
+ '/deploy': resolve(root, 'app.html'),
+ '/explore': resolve(root, 'app.html'),
+ '/features': resolve(root, 'features.html'),
+ '/create': resolve(root, 'create.html'),
+ '/dashboard': resolve(root, 'public/dashboard/index.html'),
+ '/studio': resolve(root, 'public/studio/index.html'),
+ '/widgets': resolve(root, 'public/widgets-gallery/index.html'),
'/docs/widgets': resolve(root, 'public/docs-widgets.html'),
- '/agent': resolve(root, 'agent-home.html'),
+ '/agent': resolve(root, 'agent-home.html'),
};
server.middlewares.use(async (req, res, next) => {
const path = (req.url || '/').split('?')[0];
let filePath = fileMap[path];
- if (!filePath && /^\/agent\/[^/]+\/edit$/.test(path)) filePath = resolve(root, 'agent-edit.html');
- else if (!filePath && /^\/agent\/[^/]+\/embed$/.test(path)) filePath = resolve(root, 'agent-embed.html');
- else if (!filePath && /^\/agent\/[^/]+$/.test(path)) filePath = resolve(root, 'agent-home.html');
+ if (!filePath && /^\/agent\/[^/]+\/edit$/.test(path))
+ filePath = resolve(root, 'agent-edit.html');
+ else if (!filePath && /^\/agent\/[^/]+\/embed$/.test(path))
+ filePath = resolve(root, 'agent-embed.html');
+ else if (!filePath && /^\/agent\/[^/]+$/.test(path))
+ filePath = resolve(root, 'agent-home.html');
// /a/<chainId>/<agentId> — public on-chain agent viewer.
- else if (!filePath && /^\/a\/[^/]+(?:\/[^/]+){1,2}$/.test(path)) filePath = resolve(root, 'app.html');
+ else if (!filePath && /^\/a\/[^/]+(?:\/[^/]+){1,2}$/.test(path))
+ filePath = resolve(root, 'app.html');
if (!filePath) return next();
try {
const html = readFileSync(filePath, 'utf8');
@@ -79,7 +83,8 @@ const appConfig = {
manifest: {
name: '3D Agent — AI-Powered 3D Model Viewer',
short_name: '3D Agent',
- description: 'Drag and drop glTF, GLB, and 3D files to preview instantly in your browser.',
+ description:
+ 'Drag and drop glTF, GLB, and 3D files to preview instantly in your browser.',
theme_color: '#000000',
background_color: '#080814',
display: 'standalone',
@@ -88,7 +93,12 @@ const appConfig = {
icons: [
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
- { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' },
+ {
+ src: 'pwa-512x512.png',
+ sizes: '512x512',
+ type: 'image/png',
+ purpose: 'any maskable',
+ },
],
},
workbox: {
@@ -133,7 +143,7 @@ const libConfig = {
entry: resolve(__dirname, 'src/lib.js'),
name: 'Agent3D',
formats: ['es', 'umd'],
- fileName: (format) => format === 'es' ? 'agent-3d.js' : 'agent-3d.umd.cjs',
+ fileName: (format) => (format === 'es' ? 'agent-3d.js' : 'agent-3d.umd.cjs'),
},
rollupOptions: {
// No externals — we want a self-contained drop-in embed.