@vrism/viewer-sdk
Version:
React and Vanilla JavaScript SDK for embedding 3D product viewers powered by Verge3D technology
1,121 lines • 1.8 MB
JavaScript
const yl = "4.5.1", La = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, z4 = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, zg = 0, Jd = 1, Vg = 2, V4 = 3, xn = 0, zr = 1, kr = 2, Fr = 3, Gi = 4, Pa = 5, Ba = 6, Wi = 0, ri = 1, Hi = 2, $d = 3, Bi = 0, Na = 1, bl = 2, eh = 3, th = 4, vr = 5, ii = 100, xm = 101, ym = 102, ih = 103, oh = 104, Kl = 200, Ji = 201, bm = 202, Cm = 203, ja = 204, Go = 205, Mm = 206, Sm = 207, Em = 208, wm = 209, Tm = 210, Gg = 0, kg = 1, Qg = 2, ku = 3, Wg = 4, Hg = 5, Yg = 6, Xg = 7, Zl = 0, jg = 1, qg = 2, ko = 0, cd = 1, Kg = 2, Zg = 3, Jg = 4, $g = 5, ud = 6, dd = 7, Im = 8, G4 = 300, Gn = 301, kn = 302, Cl = 303, Ml = 304, Qn = 306, Yi = 1e3, mt = 1001, Ga = 1002, lt = 1003, In = 1004, k4 = 1004, Da = 1005, Q4 = 1005, Le = 1006, Jl = 1007, W4 = 1007, Ni = 1008, H4 = 1008, Gt = 1009, ev = 1010, tv = 1011, Rm = 1012, iv = 1013, mr = 1014, St = 1015, _t = 1016, ov = 1017, rv = 1018, Oa = 1020, av = 1021, nv = 1022, Qe = 1023, sv = 1024, lv = 1025, Qr = 1026, ka = 1027, pr = 1028, cv = 1029, uv = 1030, dv = 1031, hv = 1033, yn = 33776, Ec = 33777, wc = 33778, bn = 33779, Sl = 35840, rh = 35841, El = 35842, ah = 35843, hd = 36196, wl = 37492, Tl = 37496, Il = 37808, nh = 37809, sh = 37810, lh = 37811, ch = 37812, uh = 37813, dh = 37814, hh = 37815, fh = 37816, ph = 37817, mh = 37818, gh = 37819, vh = 37820, Ah = 37821, Rl = 36492, Y4 = 2200, X4 = 2201, j4 = 2202, q4 = 2300, K4 = 2301, Z4 = 2302, J4 = 2400, $4 = 2401, eI = 2402, tI = 2500, Lm = 2501, fv = 0, Pm = 1, Ll = 2, bi = 3e3, Ze = 3001, iI = 3200, fd = 3201, oI = 3202, Bm = 3301, pv = 3302, qr = 0, mv = 1, rI = "", fo = "srgb", Pl = "srgb-linear", aI = 0, nI = 7680, sI = 7681, lI = 7682, cI = 7683, uI = 34055, dI = 34056, hI = 5386, fI = 512, pI = 513, mI = 514, gI = 515, vI = 516, AI = 517, _I = 518, xI = 519, yI = 35044, bI = 35048, CI = 35040, MI = 35045, SI = 35049, EI = 35041, wI = 35046, TI = 35050, II = 35042, RI = "100", _h = "300 es", Qu = 1035, gv = "ALL", xh = "__V3DL__96695f2165", LI = 0, PI = 1, BI = 2, NI = 3, DI = 4, OI = 5, FI = 0, UI = 1, zI = 2, VI = 3, Wu = 0, GI = 1, kI = 0, QI = 1, WI = 2, pn = 0, HI = 1, YI = 0, XI = 1, jI = 2;
class Ci {
addEventListener(e, t) {
this._listeners === void 0 && (this._listeners = {});
const i = this._listeners;
i[e] === void 0 && (i[e] = []), i[e].indexOf(t) === -1 && i[e].push(t);
}
hasEventListener(e, t) {
if (this._listeners === void 0) return !1;
const i = this._listeners;
return i[e] !== void 0 && i[e].indexOf(t) !== -1;
}
removeEventListener(e, t) {
if (this._listeners === void 0) return;
const i = this._listeners[e];
if (i !== void 0) {
const o = i.indexOf(t);
o !== -1 && i.splice(o, 1);
}
}
dispatchEvent(e) {
if (this._listeners === void 0) return;
const t = this._listeners[e.type];
if (t !== void 0) {
e.target = this;
const i = t.slice(0);
for (let o = 0, r = i.length; o < r; o++) i[o].call(this, e);
e.target = null;
}
}
}
const ai = ["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 yh = 1234567;
const Qo = Math.PI / 180, Qa = 180 / Math.PI;
function yi() {
const s = 4294967295 * Math.random() | 0, e = 4294967295 * Math.random() | 0, t = 4294967295 * Math.random() | 0, i = 4294967295 * Math.random() | 0;
return (ai[255 & s] + ai[s >> 8 & 255] + ai[s >> 16 & 255] + ai[s >> 24 & 255] + "-" + ai[255 & e] + ai[e >> 8 & 255] + "-" + ai[e >> 16 & 15 | 64] + ai[e >> 24 & 255] + "-" + ai[63 & t | 128] + ai[t >> 8 & 255] + "-" + ai[t >> 16 & 255] + ai[t >> 24 & 255] + ai[255 & i] + ai[i >> 8 & 255] + ai[i >> 16 & 255] + ai[i >> 24 & 255]).toLowerCase();
}
function Ye(s, e = 0, t = 1) {
return Math.max(e, Math.min(t, s));
}
function pd(s, e) {
return (s % e + e) % e;
}
function vv(s, e, t, i, o) {
return i + (s - e) * (o - i) / (t - e);
}
function Av(s, e, t) {
return s !== e ? (t - s) / (e - s) : 0;
}
function Uo(s, e, t) {
return (1 - t) * s + t * e;
}
function _v(s, e, t, i) {
return Uo(s, e, 1 - Math.exp(-t * i));
}
function xv(s, e = 1) {
return e - Math.abs(pd(s, 2 * e) - e);
}
function yv(s, e, t) {
return s <= e ? 0 : s >= t ? 1 : (s = (s - e) / (t - e)) * s * (3 - 2 * s);
}
function Hu(s, e, t) {
return s <= e ? 0 : s >= t ? 1 : (s = (s - e) / (t - e)) * s * s * (s * (6 * s - 15) + 10);
}
function bv(s, e) {
return s + Math.floor(Math.random() * (e - s + 1));
}
function Cv(s, e) {
return s + Math.random() * (e - s);
}
function Mv(s) {
return s * (0.5 - Math.random());
}
function Sv(s) {
s !== void 0 && (yh = s);
let e = yh += 1831565813;
return e = Math.imul(e ^ e >>> 15, 1 | e), e ^= e + Math.imul(e ^ e >>> 7, 61 | e), ((e ^ e >>> 14) >>> 0) / 4294967296;
}
function Wn(s) {
return s * Qo;
}
function md(s) {
return s * Qa;
}
function Yu(s) {
return (s & s - 1) == 0 && s !== 0;
}
function Nm(s) {
return Math.pow(2, Math.ceil(Math.log(s) / Math.LN2));
}
function Bl(s) {
return Math.pow(2, Math.floor(Math.log(s) / Math.LN2));
}
function Ev(s, e, t, i, o) {
const r = Math.cos, a = Math.sin, n = r(t / 2), l = a(t / 2), c = r((e + i) / 2), u = a((e + i) / 2), d = r((e - i) / 2), h = a((e - i) / 2), f = r((i - e) / 2), m = a((i - e) / 2);
switch (o) {
case "XYX":
s.set(n * u, l * d, l * h, n * c);
break;
case "YZY":
s.set(l * h, n * u, l * d, n * c);
break;
case "ZXZ":
s.set(l * d, l * h, n * u, n * c);
break;
case "XZX":
s.set(n * u, l * m, l * f, n * c);
break;
case "YXY":
s.set(l * f, n * u, l * m, n * c);
break;
case "ZYZ":
s.set(l * m, l * f, n * u, n * c);
break;
default:
console.warn("v3d.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + o);
}
}
function zo(s, e) {
switch (e.constructor) {
case Float32Array:
return s;
case Uint16Array:
return s / 65535;
case Uint8Array:
return s / 255;
case Int16Array:
return Math.max(s / 32767, -1);
case Int8Array:
return Math.max(s / 127, -1);
default:
throw new Error("Invalid component type.");
}
}
function ut(s, e) {
switch (e.constructor) {
case Float32Array:
return s;
case Uint16Array:
return Math.round(65535 * s);
case Uint8Array:
return Math.round(255 * s);
case Int16Array:
return Math.round(32767 * s);
case Int8Array:
return Math.round(127 * s);
default:
throw new Error("Invalid component type.");
}
}
function Rn(s) {
let e = 5381, t = s.length;
for (; t; ) e = 33 * e ^ s.charCodeAt(--t);
return e >>> 0;
}
function Dm(s, e, t, i) {
let o = Math.exp(-t / i);
return s * o + (1 - o) * e;
}
function Wt(s, e, t, i, o) {
let r = Dm(s, e, t, i);
return Math.abs(s - e) < o && (r = e), r;
}
function Ln(s) {
return Ye(s - 2 * Math.PI * Math.floor(s / (2 * Math.PI)), 0, 2 * Math.PI);
}
function pl(s) {
let e = s + Math.PI;
return e %= 2 * Math.PI, e += 2 * Math.PI, e %= 2 * Math.PI, e -= Math.PI, e;
}
function gd(s, e, t) {
let i = Ln(s - e), o = Ln(t - e);
return i > o && (i = i < o / 2 + Math.PI ? o : 0), i + e;
}
var qI = Object.freeze({ __proto__: null, DEG2RAD: Qo, RAD2DEG: Qa, angleToRange_0_2Pi: Ln, angleToRange_mPi_Pi: pl, ceilPowerOfTwo: Nm, clamp: Ye, clampAngle: gd, damp: _v, degToRad: Wn, denormalize: zo, euclideanModulo: pd, expAverage: Dm, expAverageClamp: Wt, floorPowerOfTwo: Bl, generateUUID: yi, hashString: Rn, inverseLerp: Av, isPowerOfTwo: Yu, lerp: Uo, mapLinear: vv, normalize: ut, pingpong: xv, radToDeg: md, randFloat: Cv, randFloatSpread: Mv, randInt: bv, seededRandom: Sv, setQuaternionFromProperEuler: Ev, smootherstep: Hu, smoothstep: yv });
class ie {
constructor(e = 0, t = 0) {
ie.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, i = this.y, o = e.elements;
return this.x = o[0] * t + o[3] * i + o[6], this.y = o[1] * t + o[4] * i + o[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 = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this;
}
clampScalar(e, t) {
return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this;
}
clampLength(e, t) {
const i = this.length();
return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i)));
}
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 = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(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;
}
distanceTo(e) {
return Math.sqrt(this.distanceToSquared(e));
}
distanceToSquared(e) {
const t = this.x - e.x, i = this.y - e.y;
return t * t + i * i;
}
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, i) {
return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, 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 i = Math.cos(t), o = Math.sin(t), r = this.x - e.x, a = this.y - e.y;
return this.x = r * i - a * o + e.x, this.y = r * o + a * i + e.y, this;
}
random() {
return this.x = Math.random(), this.y = Math.random(), this;
}
*[Symbol.iterator]() {
yield this.x, yield this.y;
}
}
class si {
constructor() {
si.prototype.isMatrix3 = !0, this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
set(e, t, i, o, r, a, n, l, c) {
const u = this.elements;
return u[0] = e, u[1] = o, u[2] = n, u[3] = t, u[4] = r, u[5] = l, u[6] = i, u[7] = a, u[8] = c, this;
}
identity() {
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
}
copy(e) {
const t = this.elements, i = e.elements;
return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], this;
}
extractBasis(e, t, i) {
return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), i.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 i = e.elements, o = t.elements, r = this.elements, a = i[0], n = i[3], l = i[6], c = i[1], u = i[4], d = i[7], h = i[2], f = i[5], m = i[8], p = o[0], g = o[3], v = o[6], A = o[1], x = o[4], S = o[7], w = o[2], R = o[5], P = o[8];
return r[0] = a * p + n * A + l * w, r[3] = a * g + n * x + l * R, r[6] = a * v + n * S + l * P, r[1] = c * p + u * A + d * w, r[4] = c * g + u * x + d * R, r[7] = c * v + u * S + d * P, r[2] = h * p + f * A + m * w, r[5] = h * g + f * x + m * R, r[8] = h * v + f * S + m * P, 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], i = e[1], o = e[2], r = e[3], a = e[4], n = e[5], l = e[6], c = e[7], u = e[8];
return t * a * u - t * n * c - i * r * u + i * n * l + o * r * c - o * a * l;
}
invert() {
const e = this.elements, t = e[0], i = e[1], o = e[2], r = e[3], a = e[4], n = e[5], l = e[6], c = e[7], u = e[8], d = u * a - n * c, h = n * l - u * r, f = c * r - a * l, m = t * d + i * h + o * f;
if (m === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
const p = 1 / m;
return e[0] = d * p, e[1] = (o * c - u * i) * p, e[2] = (n * i - o * a) * p, e[3] = h * p, e[4] = (u * t - o * l) * p, e[5] = (o * r - n * t) * p, e[6] = f * p, e[7] = (i * l - c * t) * p, e[8] = (a * t - i * r) * p, 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, i, o, r, a, n) {
const l = Math.cos(r), c = Math.sin(r);
return this.set(i * l, i * c, -i * (l * a + c * n) + a + e, -o * c, o * l, -o * (-c * a + l * n) + n + t, 0, 0, 1), this;
}
scale(e, t) {
return this.premultiply(Tc.makeScale(e, t)), this;
}
rotate(e) {
return this.premultiply(Tc.makeRotation(-e)), this;
}
translate(e, t) {
return this.premultiply(Tc.makeTranslation(e, t)), this;
}
makeTranslation(e, t) {
return this.set(1, 0, e, 0, 1, t, 0, 0, 1), this;
}
makeRotation(e) {
const t = Math.cos(e), i = Math.sin(e);
return this.set(t, -i, 0, i, 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, i = e.elements;
for (let o = 0; o < 9; o++) if (t[o] !== i[o]) return !1;
return !0;
}
fromArray(e, t = 0) {
for (let i = 0; i < 9; i++) this.elements[i] = e[i + t];
return this;
}
toArray(e = [], t = 0) {
const i = this.elements;
return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e;
}
clone() {
return new this.constructor().fromArray(this.elements);
}
}
const Tc = new si();
function KI(s) {
if (s.length === 0) return 1 / 0;
let e = s[0];
for (let t = 1, i = s.length; t < i; ++t) s[t] < e && (e = s[t]);
return e;
}
function wv(s) {
if (s.length === 0) return -1 / 0;
let e = s[0];
for (let t = 1, i = s.length; t < i; ++t) s[t] > e && (e = s[t]);
return e;
}
function Om(s) {
for (let e = s.length - 1; e >= 0; --e) if (s[e] >= 65535) return !0;
return !1;
}
const Tv = { Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array };
function Ea(s, e) {
return new Tv[s](e);
}
function Pn(s) {
return document.createElementNS("http://www.w3.org/1999/xhtml", s);
}
function J(s) {
return s !== void 0;
}
function Iv(s, e, t) {
for (let i = 0; i < s.length; i++) s[i] = Ye(s[i], e, t);
return s;
}
function bh(s) {
var r, a;
const e = (r = s.match(/^(\d+).(\d+).(\d+)(?: (.*))?$/)) != null ? r : [];
let t = Number(e[1]), i = Number(e[2]), o = Number(e[3]);
return t = Number.isNaN(t) ? 0 : t, i = Number.isNaN(i) ? 0 : i, o = Number.isNaN(o) ? 0 : o, { major: t, minor: i, patch: o, pre: (a = e[4]) != null ? a : "" };
}
function Ch(s) {
var i;
if (s === "") return 1 / 0;
const e = (i = s.match(/^pre(\d+)$/)) != null ? i : [];
let t = Number(e[1]);
return t = Number.isNaN(t) ? 0 : t, t;
}
function ZI(s, e) {
const t = bh(s), i = bh(e);
let o = i.major - t.major;
return o === 0 && (o = i.minor - t.minor, o === 0 && (o = i.patch - t.patch, o === 0 && (o = Ch(i.pre) - Ch(t.pre)))), Math.sign(o);
}
function Bn(s) {
return `${s % 1 ? s : `${s}.0`}`;
}
function Nl() {
return typeof window < "u" ? window : typeof self < "u" ? self : global;
}
const Sr = {};
function vd(s = "") {
const e = document.getElementsByTagName("script");
let t = s;
for (let i = e.length - 1; i >= 0; --i) {
const o = e[i].src, r = o.search(/\/v3d[\w.]+js/);
r > -1 && (t = o.substr(0, r) + "/" + s);
}
return t;
}
function Rv(s, e = function(i) {
}, t = function(i) {
}) {
Sr[s] = Sr[s] || { status: 0, loadCallbacks: [], errorCallbacks: [] };
const i = Sr[s];
if (i.status == 4) return void e(s);
if (i.loadCallbacks.push(e), i.errorCallbacks.push(t), i.status > 0) return;
let o = vd(s);
const r = document.createElement("script");
r.type = "text/javascript", r.src = o, (function(a) {
r.onload = function() {
Sr[a].loadCallbacks.forEach(function(n) {
n(a);
}), Sr[a].status = 4;
}, r.onerror = function() {
Sr[a].errorCallbacks.forEach(function(n) {
n(a);
}), Sr[a].status = 0;
};
})(s), document.getElementsByTagName("head")[0].appendChild(r), i.status = 3;
}
function Lv(s, e, t = 0) {
const i = function(r, a, n, l) {
const c = performance.now();
return e(r, a, n), c - l > t ? (l = c, new Promise(function(u) {
setTimeout(function() {
u(l);
}, 1);
})) : l;
};
let o = Promise.resolve(performance.now());
return s.forEach(function(r, a, n) {
o = o.then(i.bind(null, r, a, n));
}), o;
}
function Wr(s) {
return s < 0.04045 ? 0.0773993808 * s : Math.pow(0.9478672986 * s + 0.0521327014, 2.4);
}
function ml(s) {
return s < 31308e-7 ? 12.92 * s : 1.055 * Math.pow(s, 0.41666) - 0.055;
}
const Ic = { [fo]: { [Pl]: Wr }, [Pl]: { [fo]: ml } }, ni = { legacyMode: !0, get workingColorSpace() {
return Pl;
}, set workingColorSpace(s) {
console.warn("v3d.ColorManagement: .workingColorSpace is readonly.");
}, convert: function(s, e, t) {
if (this.legacyMode || e === t || !e || !t) return s;
if (Ic[e] && Ic[e][t] !== void 0) {
const i = Ic[e][t];
return s.r = i(s.r), s.g = i(s.g), s.b = i(s.b), s;
}
throw new Error("Unsupported color space conversion.");
}, fromWorkingColorSpace: function(s, e) {
return this.convert(s, this.workingColorSpace, e);
}, toWorkingColorSpace: function(s, e) {
return this.convert(s, e, this.workingColorSpace);
} }, Fm = { 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 }, Qt = { r: 0, g: 0, b: 0 }, ji = { h: 0, s: 0, l: 0 }, os = { h: 0, s: 0, l: 0 };
function Rc(s, e, t) {
return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? s + 6 * (e - s) * t : t < 0.5 ? e : t < 2 / 3 ? s + 6 * (e - s) * (2 / 3 - t) : s;
}
function rs(s, e) {
return e.r = s.r, e.g = s.g, e.b = s.b, e;
}
class ge {
constructor(e, t, i) {
return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, t === void 0 && i === void 0 ? this.set(e) : this.setRGB(e, t, i);
}
set(e) {
return e && e.isColor ? this.copy(e) : typeof e == "number" ? this.setHex(e) : typeof e == "string" && this.setStyle(e), this;
}
setScalar(e) {
return this.r = e, this.g = e, this.b = e, this;
}
setHex(e, t = fo) {
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (255 & e) / 255, ni.toWorkingColorSpace(this, t), this;
}
setRGB(e, t, i, o = ni.workingColorSpace) {
return this.r = e, this.g = t, this.b = i, ni.toWorkingColorSpace(this, o), this;
}
setHSL(e, t, i, o = ni.workingColorSpace) {
if (e = pd(e, 1), t = Ye(t, 0, 1), i = Ye(i, 0, 1), t === 0) this.r = this.g = this.b = i;
else {
const r = i <= 0.5 ? i * (1 + t) : i + t - i * t, a = 2 * i - r;
this.r = Rc(a, r, e + 1 / 3), this.g = Rc(a, r, e), this.b = Rc(a, r, e - 1 / 3);
}
return ni.toWorkingColorSpace(this, o), this;
}
setStyle(e, t = fo) {
function i(r) {
r !== void 0 && parseFloat(r) < 1 && console.warn("v3d.Color: Alpha component of " + e + " will be ignored.");
}
let o;
if (o = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)) {
let r;
const a = o[1], n = o[2];
switch (a) {
case "rgb":
case "rgba":
if (r = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)) return this.r = Math.min(255, parseInt(r[1], 10)) / 255, this.g = Math.min(255, parseInt(r[2], 10)) / 255, this.b = Math.min(255, parseInt(r[3], 10)) / 255, ni.toWorkingColorSpace(this, t), i(r[4]), this;
if (r = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)) return this.r = Math.min(100, parseInt(r[1], 10)) / 100, this.g = Math.min(100, parseInt(r[2], 10)) / 100, this.b = Math.min(100, parseInt(r[3], 10)) / 100, ni.toWorkingColorSpace(this, t), i(r[4]), this;
break;
case "hsl":
case "hsla":
if (r = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)) {
const l = parseFloat(r[1]) / 360, c = parseFloat(r[2]) / 100, u = parseFloat(r[3]) / 100;
return i(r[4]), this.setHSL(l, c, u, t);
}
}
} else if (o = /^\#([A-Fa-f\d]+)$/.exec(e)) {
const r = o[1], a = r.length;
if (a === 3) return this.r = parseInt(r.charAt(0) + r.charAt(0), 16) / 255, this.g = parseInt(r.charAt(1) + r.charAt(1), 16) / 255, this.b = parseInt(r.charAt(2) + r.charAt(2), 16) / 255, ni.toWorkingColorSpace(this, t), this;
if (a === 6) return this.r = parseInt(r.charAt(0) + r.charAt(1), 16) / 255, this.g = parseInt(r.charAt(2) + r.charAt(3), 16) / 255, this.b = parseInt(r.charAt(4) + r.charAt(5), 16) / 255, ni.toWorkingColorSpace(this, t), this;
}
return e && e.length > 0 ? this.setColorName(e, t) : this;
}
setColorName(e, t = fo) {
const i = Fm[e.toLowerCase()];
return i !== void 0 ? this.setHex(i, t) : console.warn("v3d.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 = Wr(e.r), this.g = Wr(e.g), this.b = Wr(e.b), this;
}
copyLinearToSRGB(e) {
return this.r = ml(e.r), this.g = ml(e.g), this.b = ml(e.b), this;
}
convertSRGBToLinear() {
return this.copySRGBToLinear(this), this;
}
convertLinearToSRGB() {
return this.copyLinearToSRGB(this), this;
}
getHex(e = fo) {
return ni.fromWorkingColorSpace(rs(this, Qt), e), Ye(255 * Qt.r, 0, 255) << 16 ^ Ye(255 * Qt.g, 0, 255) << 8 ^ Ye(255 * Qt.b, 0, 255) << 0;
}
getHexString(e = fo) {
return ("000000" + this.getHex(e).toString(16)).slice(-6);
}
getHSL(e, t = ni.workingColorSpace) {
ni.fromWorkingColorSpace(rs(this, Qt), t);
const i = Qt.r, o = Qt.g, r = Qt.b, a = Math.max(i, o, r), n = Math.min(i, o, r);
let l, c;
const u = (n + a) / 2;
if (n === a) l = 0, c = 0;
else {
const d = a - n;
switch (c = u <= 0.5 ? d / (a + n) : d / (2 - a - n), a) {
case i:
l = (o - r) / d + (o < r ? 6 : 0);
break;
case o:
l = (r - i) / d + 2;
break;
case r:
l = (i - o) / d + 4;
}
l /= 6;
}
return e.h = l, e.s = c, e.l = u, e;
}
getRGB(e, t = ni.workingColorSpace) {
return ni.fromWorkingColorSpace(rs(this, Qt), t), e.r = Qt.r, e.g = Qt.g, e.b = Qt.b, e;
}
getStyle(e = fo) {
return ni.fromWorkingColorSpace(rs(this, Qt), e), e !== fo ? `color(${e} ${Qt.r} ${Qt.g} ${Qt.b})` : `rgb(${255 * Qt.r | 0},${255 * Qt.g | 0},${255 * Qt.b | 0})`;
}
offsetHSL(e, t, i) {
return this.getHSL(ji), ji.h += e, ji.s += t, ji.l += i, this.setHSL(ji.h, ji.s, ji.l), this;
}
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, i) {
return this.r = e.r + (t.r - e.r) * i, this.g = e.g + (t.g - e.g) * i, this.b = e.b + (t.b - e.b) * i, this;
}
lerpHSL(e, t) {
this.getHSL(ji), e.getHSL(os);
const i = Uo(ji.h, os.h, t), o = Uo(ji.s, os.s, t), r = Uo(ji.l, os.l, t);
return this.setHSL(i, o, r), this;
}
equals(e) {
return e.r === this.r && e.g === this.g && e.b === this.b;
}
fromArray(e, t = 0) {
return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this;
}
toArray(e = [], t = 0) {
return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e;
}
fromBufferAttribute(e, t) {
return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), this;
}
toJSON() {
return this.getHex();
}
*[Symbol.iterator]() {
yield this.r, yield this.g, yield this.b;
}
}
let Jr;
ge.NAMES = Fm;
class Um {
static getDataURL(e) {
if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src;
let t;
if (e instanceof HTMLCanvasElement) t = e;
else {
Jr === void 0 && (Jr = Pn("canvas")), Jr.width = e.width, Jr.height = e.height;
const i = Jr.getContext("2d");
e instanceof ImageData ? i.putImageData(e, 0, 0) : i.drawImage(e, 0, 0, e.width, e.height), t = Jr;
}
return t.width > 2048 || t.height > 2048 ? (console.warn("v3d.ImageUtils.getDataURL: Image converted to jpg for performance reasons", e), t.toDataURL("image/jpeg", 0.6)) : t.toDataURL("image/png");
}
static sRGBToLinear(e) {
if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap) {
const t = Pn("canvas");
t.width = e.width, t.height = e.height;
const i = t.getContext("2d");
i.drawImage(e, 0, 0, e.width, e.height);
const o = i.getImageData(0, 0, e.width, e.height), r = o.data;
for (let a = 0; a < r.length; a++) r[a] = 255 * Wr(r[a] / 255);
return i.putImageData(o, 0, 0), t;
}
if (e.data) {
const t = e.data.slice(0);
for (let i = 0; i < t.length; i++) t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[i] = Math.floor(255 * Wr(t[i] / 255)) : t[i] = Wr(t[i]);
return { data: t, width: e.width, height: e.height };
}
return console.warn("v3d.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
}
}
let wa = class {
constructor(s = null) {
this.isSource = !0, this.uuid = yi(), this.data = s, this.version = 0;
}
set needsUpdate(s) {
s === !0 && this.version++;
}
toJSON(s) {
const e = s === void 0 || typeof s == "string";
if (!e && s.images[this.uuid] !== void 0) return s.images[this.uuid];
const t = { uuid: this.uuid, url: "" }, i = this.data;
if (i !== null) {
let o;
if (Array.isArray(i)) {
o = [];
for (let r = 0, a = i.length; r < a; r++) i[r].isDataTexture ? o.push(Lc(i[r].image)) : o.push(Lc(i[r]));
} else o = Lc(i);
t.url = o;
}
return e || (s.images[this.uuid] = t), t;
}
};
function Lc(s) {
return typeof HTMLImageElement < "u" && s instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && s instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && s instanceof ImageBitmap ? Um.getDataURL(s) : s.data ? { data: Array.from(s.data), width: s.width, height: s.height, type: s.data.constructor.name } : (console.warn("v3d.Texture: Unable to serialize Texture."), {});
}
let Pv = 0;
class yt extends Ci {
constructor(e = yt.DEFAULT_IMAGE, t = yt.DEFAULT_MAPPING, i = mt, o = mt, r = Le, a = Ni, n = Qe, l = Gt, c = yt.DEFAULT_ANISOTROPY, u = bi) {
super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: Pv++ }), this.uuid = yi(), this.name = "", this.source = new wa(e), this.mipmaps = [], this.mapping = t, this.wrapS = i, this.wrapT = o, this.magFilter = r, this.minFilter = a, this.anisotropy = c, this.format = n, this.internalFormat = null, this.type = l, this.offset = new ie(0, 0), this.repeat = new ie(1, 1), this.center = new ie(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new si(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = u, this.userData = {}, this.version = 0, this.onUpdate = null, this.isRenderTargetTexture = !1, this.needsPMREMUpdate = !1;
}
get image() {
return this.source.data;
}
set image(e) {
this.source.data = e;
}
updateMatrix() {
this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);
}
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.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.encoding = e.encoding, 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 i = { metadata: { version: 4.5, type: "Texture", generator: "Texture.toJSON" }, uuid: this.uuid, name: this.name, image: this.source.toJSON(e).uuid, mapping: this.mapping, 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, type: this.type, encoding: this.encoding, 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 && (i.userData = this.userData), t || (e.textures[this.uuid] = i), i;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
transformUv(e) {
if (this.mapping !== 300) return e;
if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) {
case Yi:
e.x = e.x - Math.floor(e.x);
break;
case mt:
e.x = e.x < 0 ? 0 : 1;
break;
case Ga:
Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x);
}
if (e.y < 0 || e.y > 1) switch (this.wrapT) {
case Yi:
e.y = e.y - Math.floor(e.y);
break;
case mt:
e.y = e.y < 0 ? 0 : 1;
break;
case Ga:
Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y);
}
return this.flipY && (e.y = 1 - e.y), e;
}
set needsUpdate(e) {
e === !0 && (this.version++, this.source.needsUpdate = !0);
}
}
yt.DEFAULT_IMAGE = null, yt.DEFAULT_MAPPING = 300, yt.DEFAULT_ANISOTROPY = 1;
class Re {
constructor(e = 0, t = 0, i = 0, o = 1) {
Re.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = i, this.w = o;
}
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, i, o) {
return this.x = e, this.y = t, this.z = i, this.w = o, 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, i = this.y, o = this.z, r = this.w, a = e.elements;
return this.x = a[0] * t + a[4] * i + a[8] * o + a[12] * r, this.y = a[1] * t + a[5] * i + a[9] * o + a[13] * r, this.z = a[2] * t + a[6] * i + a[10] * o + a[14] * r, this.w = a[3] * t + a[7] * i + a[11] * o + a[15] * r, 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, i, o, r;
const a = e.elements, n = a[0], l = a[4], c = a[8], u = a[1], d = a[5], h = a[9], f = a[2], m = a[6], p = a[10];
if (Math.abs(l - u) < 0.01 && Math.abs(c - f) < 0.01 && Math.abs(h - m) < 0.01) {
if (Math.abs(l + u) < 0.1 && Math.abs(c + f) < 0.1 && Math.abs(h + m) < 0.1 && Math.abs(n + d + p - 3) < 0.1) return this.set(1, 0, 0, 0), this;
t = Math.PI;
const v = (n + 1) / 2, A = (d + 1) / 2, x = (p + 1) / 2, S = (l + u) / 4, w = (c + f) / 4, R = (h + m) / 4;
return v > A && v > x ? v < 0.01 ? (i = 0, o = 0.707106781, r = 0.707106781) : (i = Math.sqrt(v), o = S / i, r = w / i) : A > x ? A < 0.01 ? (i = 0.707106781, o = 0, r = 0.707106781) : (o = Math.sqrt(A), i = S / o, r = R / o) : x < 0.01 ? (i = 0.707106781, o = 0.707106781, r = 0) : (r = Math.sqrt(x), i = w / r, o = R / r), this.set(i, o, r, t), this;
}
let g = Math.sqrt((m - h) * (m - h) + (c - f) * (c - f) + (u - l) * (u - l));
return Math.abs(g) < 1e-3 && (g = 1), this.x = (m - h) / g, this.y = (c - f) / g, this.z = (u - l) / g, this.w = Math.acos((n + d + p - 1) / 2), 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 = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this.w = Math.max(e.w, Math.min(t.w, this.w)), this;
}
clampScalar(e, t) {
return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this.w = Math.max(e, Math.min(t, this.w)), this;
}
clampLength(e, t) {
const i = this.length();
return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i)));
}
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 = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(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, i) {
return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this.z = e.z + (t.z - e.z) * i, this.w = e.w + (t.w - e.w) * i, 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 et extends Ci {
constructor(e = 1, t = 1, i = {}) {
super(), this.isWebGLRenderTarget = !0, this.width = e, this.height = t, this.depth = 1, this.scissor = new Re(0, 0, e, t), this.scissorTest = !1, this.viewport = new Re(0, 0, e, t);
const o = { width: e, height: t, depth: 1 };
this.texture = new yt(o, i.mapping, i.wrapS, i.wrapT, i.magFilter, i.minFilter, i.format, i.type, i.anisotropy, i.encoding), this.texture.isRenderTargetTexture = !0, this.texture.flipY = !1, this.texture.generateMipmaps = i.generateMipmaps !== void 0 && i.generateMipmaps, this.texture.internalFormat = i.internalFormat !== void 0 ? i.internalFormat : null, this.texture.minFilter = i.minFilter !== void 0 ? i.minFilter : Le, this.depthBuffer = i.depthBuffer === void 0 || i.depthBuffer, this.stencilBuffer = i.stencilBuffer !== void 0 && i.stencilBuffer, this.depthTexture = i.depthTexture !== void 0 ? i.depthTexture : null, this.samples = i.samples !== void 0 ? i.samples : 0;
}
setSize(e, t, i = 1) {
this.width === e && this.height === t && this.depth === i || (this.width = e, this.height = t, this.depth = i, this.texture.image.width = e, this.texture.image.height = t, this.texture.image.depth = i, 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.viewport.copy(e.viewport), this.texture = e.texture.clone(), this.texture.isRenderTargetTexture = !0;
const t = Object.assign({}, e.texture.image);
return this.texture.source = new wa(t), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, e.depthTexture !== null && (this.depthTexture = e.depthTexture.clone()), this.samples = e.samples, this;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
}
class $l extends yt {
constructor(e = null, t = 1, i = 1, o = 1) {
super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: i, depth: o }, this.magFilter = lt, this.minFilter = lt, this.wrapR = mt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}
class JI extends et {
constructor(e = 1, t = 1, i = 1) {
super(e, t), this.isWebGLArrayRenderTarget = !0, this.depth = i, this.texture = new $l(null, e, t, i), this.texture.isRenderTargetTexture = !0;
}
}
class Ad extends yt {
constructor(e = null, t = 1, i = 1, o = 1) {
super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: i, depth: o }, this.magFilter = lt, this.minFilter = lt, this.wrapR = mt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}
class $I extends et {
constructor(e = 1, t = 1, i = 1) {
super(e, t), this.isWebGL3DRenderTarget = !0, this.depth = i, this.texture = new Ad(null, e, t, i), this.texture.isRenderTargetTexture = !0;
}
}
class Mh extends et {
constructor(e = 1, t = 1, i = 1, o = {}) {
super(e, t, o), this.isWebGLMultipleRenderTargets = !0;
const r = this.texture;
this.texture = [];
for (let a = 0; a < i; a++) this.texture[a] = r.clone(), this.texture[a].isRenderTargetTexture = !0;
}
setSize(e, t, i = 1) {
if (this.width !== e || this.height !== t || this.depth !== i) {
this.width = e, this.height = t, this.depth = i;
for (let o = 0, r = this.texture.length; o < r; o++) this.texture[o].image.width = e, this.texture[o].image.height = t, this.texture[o].image.depth = i;
this.dispose();
}
return this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t), this;
}
copy(e) {
this.dispose(), this.width = e.width, this.height = e.height, this.depth = e.depth, this.viewport.set(0, 0, this.width, this.height), this.scissor.set(0, 0, this.width, this.height), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, e.depthTexture !== null && (this.depthTexture = e.depthTexture.clone()), this.texture.length = 0;
for (let t = 0, i = e.texture.length; t < i; t++) this.texture[t] = e.texture[t].clone(), this.tex