@applemusic-like-lyrics/core 0.2.0-alpha.4 → 0.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/amll-core.js CHANGED
@@ -1,16 +1,16 @@
1
- var Ee = Object.defineProperty;
2
- var Pe = (d, t, e) => t in d ? Ee(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e;
3
- var f = (d, t, e) => Pe(d, typeof t != "symbol" ? t + "" : t, e);
4
- import { Application as ve } from "@pixi/app";
5
- import { Texture as ze } from "@pixi/core";
6
- import { Container as ke } from "@pixi/display";
7
- import { BlurFilter as X } from "@pixi/filter-blur";
8
- import { BulgePinchFilter as ut } from "@pixi/filter-bulge-pinch";
9
- import { ColorMatrixFilter as Dt } from "@pixi/filter-color-matrix";
10
- import { Sprite as yt } from "@pixi/sprite";
11
- class Ie {
1
+ var be = Object.defineProperty;
2
+ var xe = (m, t, e) => t in m ? be(m, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[t] = e;
3
+ var f = (m, t, e) => xe(m, typeof t != "symbol" ? t + "" : t, e);
4
+ import { Application as Te } from "@pixi/app";
5
+ import { Texture as we } from "@pixi/core";
6
+ import { Container as Se } from "@pixi/display";
7
+ import { BlurFilter as tt } from "@pixi/filter-blur";
8
+ import { BulgePinchFilter as yt } from "@pixi/filter-bulge-pinch";
9
+ import { ColorMatrixFilter as kt } from "@pixi/filter-color-matrix";
10
+ import { Sprite as gt } from "@pixi/sprite";
11
+ class Ee {
12
12
  }
13
- class re extends Ie {
13
+ class re extends Ee {
14
14
  constructor(e) {
15
15
  super();
16
16
  f(this, "observer");
@@ -57,7 +57,7 @@ class re extends Ie {
57
57
  return this.canvas;
58
58
  }
59
59
  }
60
- const N = 1e-6, Vt = new Float32Array([
60
+ const N = 1e-6, Ut = new Float32Array([
61
61
  1,
62
62
  0,
63
63
  0,
@@ -108,7 +108,7 @@ const N = 1e-6, Vt = new Float32Array([
108
108
  ]) : super(e, 0, 16);
109
109
  break;
110
110
  default:
111
- super(Vt);
111
+ super(Ut);
112
112
  break;
113
113
  }
114
114
  }
@@ -141,7 +141,7 @@ const N = 1e-6, Vt = new Float32Array([
141
141
  * @returns `this`
142
142
  */
143
143
  identity() {
144
- return this.set(Vt), this;
144
+ return this.set(Ut), this;
145
145
  }
146
146
  /**
147
147
  * Multiplies this {@link Mat4} against another one
@@ -395,9 +395,9 @@ const N = 1e-6, Vt = new Float32Array([
395
395
  * @returns `out` or `null` if the matrix is not invertable
396
396
  */
397
397
  static invert(t, e) {
398
- const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], o = e[5], c = e[6], h = e[7], l = e[8], p = e[9], u = e[10], y = e[11], L = e[12], m = e[13], g = e[14], b = e[15], S = s * o - i * a, x = s * c - n * a, T = s * h - r * a, E = i * c - n * o, w = i * h - r * o, z = n * h - r * c, v = l * m - p * L, k = l * g - u * L, P = l * b - y * L, D = p * g - u * m, A = p * b - y * m, O = u * b - y * g;
399
- let I = S * O - x * A + T * D + E * P - w * k + z * v;
400
- return I ? (I = 1 / I, t[0] = (o * O - c * A + h * D) * I, t[1] = (n * A - i * O - r * D) * I, t[2] = (m * z - g * w + b * E) * I, t[3] = (u * w - p * z - y * E) * I, t[4] = (c * P - a * O - h * k) * I, t[5] = (s * O - n * P + r * k) * I, t[6] = (g * T - L * z - b * x) * I, t[7] = (l * z - u * T + y * x) * I, t[8] = (a * A - o * P + h * v) * I, t[9] = (i * P - s * A - r * v) * I, t[10] = (L * w - m * T + b * S) * I, t[11] = (p * T - l * w - y * S) * I, t[12] = (o * k - a * D - c * v) * I, t[13] = (s * D - i * k + n * v) * I, t[14] = (m * x - L * E - g * S) * I, t[15] = (l * E - p * x + u * S) * I, t) : null;
398
+ const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], o = e[5], h = e[6], c = e[7], l = e[8], p = e[9], u = e[10], g = e[11], M = e[12], d = e[13], y = e[14], b = e[15], w = s * o - i * a, L = s * h - n * a, x = s * c - r * a, S = i * h - n * o, T = i * c - r * o, z = n * c - r * h, P = l * d - p * M, I = l * y - u * M, v = l * b - g * M, D = p * y - u * d, F = p * b - g * d, R = u * b - g * y;
399
+ let k = w * R - L * F + x * D + S * v - T * I + z * P;
400
+ return k ? (k = 1 / k, t[0] = (o * R - h * F + c * D) * k, t[1] = (n * F - i * R - r * D) * k, t[2] = (d * z - y * T + b * S) * k, t[3] = (u * T - p * z - g * S) * k, t[4] = (h * v - a * R - c * I) * k, t[5] = (s * R - n * v + r * I) * k, t[6] = (y * x - M * z - b * L) * k, t[7] = (l * z - u * x + g * L) * k, t[8] = (a * F - o * v + c * P) * k, t[9] = (i * v - s * F - r * P) * k, t[10] = (M * T - d * x + b * w) * k, t[11] = (p * x - l * T - g * w) * k, t[12] = (o * I - a * D - h * P) * k, t[13] = (s * D - i * I + n * P) * k, t[14] = (d * L - M * S - y * w) * k, t[15] = (l * S - p * L + u * w) * k, t) : null;
401
401
  }
402
402
  /**
403
403
  * Calculates the adjugate of a {@link Mat4}
@@ -408,8 +408,8 @@ const N = 1e-6, Vt = new Float32Array([
408
408
  * @returns `out`
409
409
  */
410
410
  static adjoint(t, e) {
411
- const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], o = e[5], c = e[6], h = e[7], l = e[8], p = e[9], u = e[10], y = e[11], L = e[12], m = e[13], g = e[14], b = e[15], S = s * o - i * a, x = s * c - n * a, T = s * h - r * a, E = i * c - n * o, w = i * h - r * o, z = n * h - r * c, v = l * m - p * L, k = l * g - u * L, P = l * b - y * L, D = p * g - u * m, A = p * b - y * m, O = u * b - y * g;
412
- return t[0] = o * O - c * A + h * D, t[1] = n * A - i * O - r * D, t[2] = m * z - g * w + b * E, t[3] = u * w - p * z - y * E, t[4] = c * P - a * O - h * k, t[5] = s * O - n * P + r * k, t[6] = g * T - L * z - b * x, t[7] = l * z - u * T + y * x, t[8] = a * A - o * P + h * v, t[9] = i * P - s * A - r * v, t[10] = L * w - m * T + b * S, t[11] = p * T - l * w - y * S, t[12] = o * k - a * D - c * v, t[13] = s * D - i * k + n * v, t[14] = m * x - L * E - g * S, t[15] = l * E - p * x + u * S, t;
411
+ const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], o = e[5], h = e[6], c = e[7], l = e[8], p = e[9], u = e[10], g = e[11], M = e[12], d = e[13], y = e[14], b = e[15], w = s * o - i * a, L = s * h - n * a, x = s * c - r * a, S = i * h - n * o, T = i * c - r * o, z = n * c - r * h, P = l * d - p * M, I = l * y - u * M, v = l * b - g * M, D = p * y - u * d, F = p * b - g * d, R = u * b - g * y;
412
+ return t[0] = o * R - h * F + c * D, t[1] = n * F - i * R - r * D, t[2] = d * z - y * T + b * S, t[3] = u * T - p * z - g * S, t[4] = h * v - a * R - c * I, t[5] = s * R - n * v + r * I, t[6] = y * x - M * z - b * L, t[7] = l * z - u * x + g * L, t[8] = a * F - o * v + c * P, t[9] = i * v - s * F - r * P, t[10] = M * T - d * x + b * w, t[11] = p * x - l * T - g * w, t[12] = o * I - a * D - h * P, t[13] = s * D - i * I + n * P, t[14] = d * L - M * S - y * w, t[15] = l * S - p * L + u * w, t;
413
413
  }
414
414
  /**
415
415
  * Calculates the determinant of a {@link Mat4}
@@ -419,8 +419,8 @@ const N = 1e-6, Vt = new Float32Array([
419
419
  * @returns determinant of a
420
420
  */
421
421
  static determinant(t) {
422
- const e = t[0], s = t[1], i = t[2], n = t[3], r = t[4], a = t[5], o = t[6], c = t[7], h = t[8], l = t[9], p = t[10], u = t[11], y = t[12], L = t[13], m = t[14], g = t[15], b = e * a - s * r, S = e * o - i * r, x = s * o - i * a, T = h * L - l * y, E = h * m - p * y, w = l * m - p * L, z = e * w - s * E + i * T, v = r * w - a * E + o * T, k = h * x - l * S + p * b, P = y * x - L * S + m * b;
423
- return c * z - n * v + g * k - u * P;
422
+ const e = t[0], s = t[1], i = t[2], n = t[3], r = t[4], a = t[5], o = t[6], h = t[7], c = t[8], l = t[9], p = t[10], u = t[11], g = t[12], M = t[13], d = t[14], y = t[15], b = e * a - s * r, w = e * o - i * r, L = s * o - i * a, x = c * M - l * g, S = c * d - p * g, T = l * d - p * M, z = e * T - s * S + i * x, P = r * T - a * S + o * x, I = c * L - l * w + p * b, v = g * L - M * w + d * b;
423
+ return h * z - n * P + y * I - u * v;
424
424
  }
425
425
  /**
426
426
  * Multiplies two {@link Mat4}s
@@ -432,9 +432,9 @@ const N = 1e-6, Vt = new Float32Array([
432
432
  * @returns `out`
433
433
  */
434
434
  static multiply(t, e, s) {
435
- const i = e[0], n = e[1], r = e[2], a = e[3], o = e[4], c = e[5], h = e[6], l = e[7], p = e[8], u = e[9], y = e[10], L = e[11], m = e[12], g = e[13], b = e[14], S = e[15];
436
- let x = s[0], T = s[1], E = s[2], w = s[3];
437
- return t[0] = x * i + T * o + E * p + w * m, t[1] = x * n + T * c + E * u + w * g, t[2] = x * r + T * h + E * y + w * b, t[3] = x * a + T * l + E * L + w * S, x = s[4], T = s[5], E = s[6], w = s[7], t[4] = x * i + T * o + E * p + w * m, t[5] = x * n + T * c + E * u + w * g, t[6] = x * r + T * h + E * y + w * b, t[7] = x * a + T * l + E * L + w * S, x = s[8], T = s[9], E = s[10], w = s[11], t[8] = x * i + T * o + E * p + w * m, t[9] = x * n + T * c + E * u + w * g, t[10] = x * r + T * h + E * y + w * b, t[11] = x * a + T * l + E * L + w * S, x = s[12], T = s[13], E = s[14], w = s[15], t[12] = x * i + T * o + E * p + w * m, t[13] = x * n + T * c + E * u + w * g, t[14] = x * r + T * h + E * y + w * b, t[15] = x * a + T * l + E * L + w * S, t;
435
+ const i = e[0], n = e[1], r = e[2], a = e[3], o = e[4], h = e[5], c = e[6], l = e[7], p = e[8], u = e[9], g = e[10], M = e[11], d = e[12], y = e[13], b = e[14], w = e[15];
436
+ let L = s[0], x = s[1], S = s[2], T = s[3];
437
+ return t[0] = L * i + x * o + S * p + T * d, t[1] = L * n + x * h + S * u + T * y, t[2] = L * r + x * c + S * g + T * b, t[3] = L * a + x * l + S * M + T * w, L = s[4], x = s[5], S = s[6], T = s[7], t[4] = L * i + x * o + S * p + T * d, t[5] = L * n + x * h + S * u + T * y, t[6] = L * r + x * c + S * g + T * b, t[7] = L * a + x * l + S * M + T * w, L = s[8], x = s[9], S = s[10], T = s[11], t[8] = L * i + x * o + S * p + T * d, t[9] = L * n + x * h + S * u + T * y, t[10] = L * r + x * c + S * g + T * b, t[11] = L * a + x * l + S * M + T * w, L = s[12], x = s[13], S = s[14], T = s[15], t[12] = L * i + x * o + S * p + T * d, t[13] = L * n + x * h + S * u + T * y, t[14] = L * r + x * c + S * g + T * b, t[15] = L * a + x * l + S * M + T * w, t;
438
438
  }
439
439
  /**
440
440
  * Alias for {@link Mat4.multiply}
@@ -457,8 +457,8 @@ const N = 1e-6, Vt = new Float32Array([
457
457
  if (e === t)
458
458
  t[12] = e[0] * i + e[4] * n + e[8] * r + e[12], t[13] = e[1] * i + e[5] * n + e[9] * r + e[13], t[14] = e[2] * i + e[6] * n + e[10] * r + e[14], t[15] = e[3] * i + e[7] * n + e[11] * r + e[15];
459
459
  else {
460
- const a = e[0], o = e[1], c = e[2], h = e[3], l = e[4], p = e[5], u = e[6], y = e[7], L = e[8], m = e[9], g = e[10], b = e[11];
461
- t[0] = a, t[1] = o, t[2] = c, t[3] = h, t[4] = l, t[5] = p, t[6] = u, t[7] = y, t[8] = L, t[9] = m, t[10] = g, t[11] = b, t[12] = a * i + l * n + L * r + e[12], t[13] = o * i + p * n + m * r + e[13], t[14] = c * i + u * n + g * r + e[14], t[15] = h * i + y * n + b * r + e[15];
460
+ const a = e[0], o = e[1], h = e[2], c = e[3], l = e[4], p = e[5], u = e[6], g = e[7], M = e[8], d = e[9], y = e[10], b = e[11];
461
+ t[0] = a, t[1] = o, t[2] = h, t[3] = c, t[4] = l, t[5] = p, t[6] = u, t[7] = g, t[8] = M, t[9] = d, t[10] = y, t[11] = b, t[12] = a * i + l * n + M * r + e[12], t[13] = o * i + p * n + d * r + e[13], t[14] = h * i + u * n + y * r + e[14], t[15] = c * i + g * n + b * r + e[15];
462
462
  }
463
463
  return t;
464
464
  }
@@ -490,8 +490,8 @@ const N = 1e-6, Vt = new Float32Array([
490
490
  if (o < N)
491
491
  return null;
492
492
  o = 1 / o, n *= o, r *= o, a *= o;
493
- const c = Math.sin(s), h = Math.cos(s), l = 1 - h, p = e[0], u = e[1], y = e[2], L = e[3], m = e[4], g = e[5], b = e[6], S = e[7], x = e[8], T = e[9], E = e[10], w = e[11], z = n * n * l + h, v = r * n * l + a * c, k = a * n * l - r * c, P = n * r * l - a * c, D = r * r * l + h, A = a * r * l + n * c, O = n * a * l + r * c, I = r * a * l - n * c, Y = a * a * l + h;
494
- return t[0] = p * z + m * v + x * k, t[1] = u * z + g * v + T * k, t[2] = y * z + b * v + E * k, t[3] = L * z + S * v + w * k, t[4] = p * P + m * D + x * A, t[5] = u * P + g * D + T * A, t[6] = y * P + b * D + E * A, t[7] = L * P + S * D + w * A, t[8] = p * O + m * I + x * Y, t[9] = u * O + g * I + T * Y, t[10] = y * O + b * I + E * Y, t[11] = L * O + S * I + w * Y, e !== t && (t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t;
493
+ const h = Math.sin(s), c = Math.cos(s), l = 1 - c, p = e[0], u = e[1], g = e[2], M = e[3], d = e[4], y = e[5], b = e[6], w = e[7], L = e[8], x = e[9], S = e[10], T = e[11], z = n * n * l + c, P = r * n * l + a * h, I = a * n * l - r * h, v = n * r * l - a * h, D = r * r * l + c, F = a * r * l + n * h, R = n * a * l + r * h, k = r * a * l - n * h, $ = a * a * l + c;
494
+ return t[0] = p * z + d * P + L * I, t[1] = u * z + y * P + x * I, t[2] = g * z + b * P + S * I, t[3] = M * z + w * P + T * I, t[4] = p * v + d * D + L * F, t[5] = u * v + y * D + x * F, t[6] = g * v + b * D + S * F, t[7] = M * v + w * D + T * F, t[8] = p * R + d * k + L * $, t[9] = u * R + y * k + x * $, t[10] = g * R + b * k + S * $, t[11] = M * R + w * k + T * $, e !== t && (t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t;
495
495
  }
496
496
  /**
497
497
  * Rotates a matrix by the given angle around the X axis
@@ -503,8 +503,8 @@ const N = 1e-6, Vt = new Float32Array([
503
503
  * @returns `out`
504
504
  */
505
505
  static rotateX(t, e, s) {
506
- let i = Math.sin(s), n = Math.cos(s), r = e[4], a = e[5], o = e[6], c = e[7], h = e[8], l = e[9], p = e[10], u = e[11];
507
- return e !== t && (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[4] = r * n + h * i, t[5] = a * n + l * i, t[6] = o * n + p * i, t[7] = c * n + u * i, t[8] = h * n - r * i, t[9] = l * n - a * i, t[10] = p * n - o * i, t[11] = u * n - c * i, t;
506
+ let i = Math.sin(s), n = Math.cos(s), r = e[4], a = e[5], o = e[6], h = e[7], c = e[8], l = e[9], p = e[10], u = e[11];
507
+ return e !== t && (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[4] = r * n + c * i, t[5] = a * n + l * i, t[6] = o * n + p * i, t[7] = h * n + u * i, t[8] = c * n - r * i, t[9] = l * n - a * i, t[10] = p * n - o * i, t[11] = u * n - h * i, t;
508
508
  }
509
509
  /**
510
510
  * Rotates a matrix by the given angle around the Y axis
@@ -516,8 +516,8 @@ const N = 1e-6, Vt = new Float32Array([
516
516
  * @returns `out`
517
517
  */
518
518
  static rotateY(t, e, s) {
519
- let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], o = e[2], c = e[3], h = e[8], l = e[9], p = e[10], u = e[11];
520
- return e !== t && (t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n - h * i, t[1] = a * n - l * i, t[2] = o * n - p * i, t[3] = c * n - u * i, t[8] = r * i + h * n, t[9] = a * i + l * n, t[10] = o * i + p * n, t[11] = c * i + u * n, t;
519
+ let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], o = e[2], h = e[3], c = e[8], l = e[9], p = e[10], u = e[11];
520
+ return e !== t && (t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n - c * i, t[1] = a * n - l * i, t[2] = o * n - p * i, t[3] = h * n - u * i, t[8] = r * i + c * n, t[9] = a * i + l * n, t[10] = o * i + p * n, t[11] = h * i + u * n, t;
521
521
  }
522
522
  /**
523
523
  * Rotates a matrix by the given angle around the Z axis
@@ -529,8 +529,8 @@ const N = 1e-6, Vt = new Float32Array([
529
529
  * @returns `out`
530
530
  */
531
531
  static rotateZ(t, e, s) {
532
- let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], o = e[2], c = e[3], h = e[4], l = e[5], p = e[6], u = e[7];
533
- return e !== t && (t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n + h * i, t[1] = a * n + l * i, t[2] = o * n + p * i, t[3] = c * n + u * i, t[4] = h * n - r * i, t[5] = l * n - a * i, t[6] = p * n - o * i, t[7] = u * n - c * i, t;
532
+ let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], o = e[2], h = e[3], c = e[4], l = e[5], p = e[6], u = e[7];
533
+ return e !== t && (t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n + c * i, t[1] = a * n + l * i, t[2] = o * n + p * i, t[3] = h * n + u * i, t[4] = c * n - r * i, t[5] = l * n - a * i, t[6] = p * n - o * i, t[7] = u * n - h * i, t;
534
534
  }
535
535
  /**
536
536
  * Creates a {@link Mat4} from a vector translation
@@ -580,8 +580,8 @@ const N = 1e-6, Vt = new Float32Array([
580
580
  if (a < N)
581
581
  return null;
582
582
  a = 1 / a, i *= a, n *= a, r *= a;
583
- const o = Math.sin(e), c = Math.cos(e), h = 1 - c;
584
- return t[0] = i * i * h + c, t[1] = n * i * h + r * o, t[2] = r * i * h - n * o, t[3] = 0, t[4] = i * n * h - r * o, t[5] = n * n * h + c, t[6] = r * n * h + i * o, t[7] = 0, t[8] = i * r * h + n * o, t[9] = n * r * h - i * o, t[10] = r * r * h + c, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
583
+ const o = Math.sin(e), h = Math.cos(e), c = 1 - h;
584
+ return t[0] = i * i * c + h, t[1] = n * i * c + r * o, t[2] = r * i * c - n * o, t[3] = 0, t[4] = i * n * c - r * o, t[5] = n * n * c + h, t[6] = r * n * c + i * o, t[7] = 0, t[8] = i * r * c + n * o, t[9] = n * r * c - i * o, t[10] = r * r * c + h, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
585
585
  }
586
586
  /**
587
587
  * Creates a matrix from the given angle around the X axis
@@ -648,8 +648,8 @@ const N = 1e-6, Vt = new Float32Array([
648
648
  * @returns `out`
649
649
  */
650
650
  static fromRotationTranslation(t, e, s) {
651
- const i = e[0], n = e[1], r = e[2], a = e[3], o = i + i, c = n + n, h = r + r, l = i * o, p = i * c, u = i * h, y = n * c, L = n * h, m = r * h, g = a * o, b = a * c, S = a * h;
652
- return t[0] = 1 - (y + m), t[1] = p + S, t[2] = u - b, t[3] = 0, t[4] = p - S, t[5] = 1 - (l + m), t[6] = L + g, t[7] = 0, t[8] = u + b, t[9] = L - g, t[10] = 1 - (l + y), t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
651
+ const i = e[0], n = e[1], r = e[2], a = e[3], o = i + i, h = n + n, c = r + r, l = i * o, p = i * h, u = i * c, g = n * h, M = n * c, d = r * c, y = a * o, b = a * h, w = a * c;
652
+ return t[0] = 1 - (g + d), t[1] = p + w, t[2] = u - b, t[3] = 0, t[4] = p - w, t[5] = 1 - (l + d), t[6] = M + y, t[7] = 0, t[8] = u + b, t[9] = M - y, t[10] = 1 - (l + g), t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
653
653
  }
654
654
  /**
655
655
  * Sets a {@link Mat4} from a {@link Quat2}.
@@ -660,9 +660,9 @@ const N = 1e-6, Vt = new Float32Array([
660
660
  * @returns `out`
661
661
  */
662
662
  static fromQuat2(t, e) {
663
- const s = -e[0], i = -e[1], n = -e[2], r = e[3], a = e[4], o = e[5], c = e[6], h = e[7];
663
+ const s = -e[0], i = -e[1], n = -e[2], r = e[3], a = e[4], o = e[5], h = e[6], c = e[7];
664
664
  let l = s * s + i * i + n * n + r * r;
665
- return l > 0 ? (j[0] = (a * r + h * s + o * n - c * i) * 2 / l, j[1] = (o * r + h * i + c * s - a * n) * 2 / l, j[2] = (c * r + h * n + a * i - o * s) * 2 / l) : (j[0] = (a * r + h * s + o * n - c * i) * 2, j[1] = (o * r + h * i + c * s - a * n) * 2, j[2] = (c * r + h * n + a * i - o * s) * 2), B.fromRotationTranslation(t, e, j), t;
665
+ return l > 0 ? (Y[0] = (a * r + c * s + o * n - h * i) * 2 / l, Y[1] = (o * r + c * i + h * s - a * n) * 2 / l, Y[2] = (h * r + c * n + a * i - o * s) * 2 / l) : (Y[0] = (a * r + c * s + o * n - h * i) * 2, Y[1] = (o * r + c * i + h * s - a * n) * 2, Y[2] = (h * r + c * n + a * i - o * s) * 2), B.fromRotationTranslation(t, e, Y), t;
666
666
  }
667
667
  /**
668
668
  * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}
@@ -673,9 +673,9 @@ const N = 1e-6, Vt = new Float32Array([
673
673
  * @returns `out` or `null` if the matrix is not invertable
674
674
  */
675
675
  static normalFromMat4(t, e) {
676
- const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], o = e[5], c = e[6], h = e[7], l = e[8], p = e[9], u = e[10], y = e[11], L = e[12], m = e[13], g = e[14], b = e[15], S = s * o - i * a, x = s * c - n * a, T = s * h - r * a, E = i * c - n * o, w = i * h - r * o, z = n * h - r * c, v = l * m - p * L, k = l * g - u * L, P = l * b - y * L, D = p * g - u * m, A = p * b - y * m, O = u * b - y * g;
677
- let I = S * O - x * A + T * D + E * P - w * k + z * v;
678
- return I ? (I = 1 / I, t[0] = (o * O - c * A + h * D) * I, t[1] = (c * P - a * O - h * k) * I, t[2] = (a * A - o * P + h * v) * I, t[3] = 0, t[4] = (n * A - i * O - r * D) * I, t[5] = (s * O - n * P + r * k) * I, t[6] = (i * P - s * A - r * v) * I, t[7] = 0, t[8] = (m * z - g * w + b * E) * I, t[9] = (g * T - L * z - b * x) * I, t[10] = (L * w - m * T + b * S) * I, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) : null;
676
+ const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], o = e[5], h = e[6], c = e[7], l = e[8], p = e[9], u = e[10], g = e[11], M = e[12], d = e[13], y = e[14], b = e[15], w = s * o - i * a, L = s * h - n * a, x = s * c - r * a, S = i * h - n * o, T = i * c - r * o, z = n * c - r * h, P = l * d - p * M, I = l * y - u * M, v = l * b - g * M, D = p * y - u * d, F = p * b - g * d, R = u * b - g * y;
677
+ let k = w * R - L * F + x * D + S * v - T * I + z * P;
678
+ return k ? (k = 1 / k, t[0] = (o * R - h * F + c * D) * k, t[1] = (h * v - a * R - c * I) * k, t[2] = (a * F - o * v + c * P) * k, t[3] = 0, t[4] = (n * F - i * R - r * D) * k, t[5] = (s * R - n * v + r * I) * k, t[6] = (i * v - s * F - r * P) * k, t[7] = 0, t[8] = (d * z - y * T + b * S) * k, t[9] = (y * x - M * z - b * L) * k, t[10] = (M * T - d * x + b * w) * k, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) : null;
679
679
  }
680
680
  /**
681
681
  * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}
@@ -689,8 +689,8 @@ const N = 1e-6, Vt = new Float32Array([
689
689
  * @returns `out`
690
690
  */
691
691
  static normalFromMat4Fast(t, e) {
692
- const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], o = e[6], c = e[8], h = e[9], l = e[10];
693
- return t[0] = a * l - l * h, t[1] = o * c - c * l, t[2] = r * h - h * c, t[3] = 0, t[4] = h * n - l * i, t[5] = l * s - c * n, t[6] = c * i - h * s, t[7] = 0, t[8] = i * o - n * a, t[9] = n * r - s * o, t[10] = s * a - i * r, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
692
+ const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], o = e[6], h = e[8], c = e[9], l = e[10];
693
+ return t[0] = a * l - l * c, t[1] = o * h - h * l, t[2] = r * c - c * h, t[3] = 0, t[4] = c * n - l * i, t[5] = l * s - h * n, t[6] = h * i - c * s, t[7] = 0, t[8] = i * o - n * a, t[9] = n * r - s * o, t[10] = s * a - i * r, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
694
694
  }
695
695
  /**
696
696
  * Returns the translation vector component of a transformation
@@ -719,8 +719,8 @@ const N = 1e-6, Vt = new Float32Array([
719
719
  * @return {vec3} out
720
720
  */
721
721
  static getScaling(t, e) {
722
- const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], o = e[6], c = e[8], h = e[9], l = e[10];
723
- return t[0] = Math.sqrt(s * s + i * i + n * n), t[1] = Math.sqrt(r * r + a * a + o * o), t[2] = Math.sqrt(c * c + h * h + l * l), t;
722
+ const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], o = e[6], h = e[8], c = e[9], l = e[10];
723
+ return t[0] = Math.sqrt(s * s + i * i + n * n), t[1] = Math.sqrt(r * r + a * a + o * o), t[2] = Math.sqrt(h * h + c * c + l * l), t;
724
724
  }
725
725
  /**
726
726
  * Returns a quaternion representing the rotational component
@@ -734,10 +734,10 @@ const N = 1e-6, Vt = new Float32Array([
734
734
  * @return `out`
735
735
  */
736
736
  static getRotation(t, e) {
737
- B.getScaling(j, e);
738
- const s = 1 / j[0], i = 1 / j[1], n = 1 / j[2], r = e[0] * s, a = e[1] * i, o = e[2] * n, c = e[4] * s, h = e[5] * i, l = e[6] * n, p = e[8] * s, u = e[9] * i, y = e[10] * n, L = r + h + y;
739
- let m = 0;
740
- return L > 0 ? (m = Math.sqrt(L + 1) * 2, t[3] = 0.25 * m, t[0] = (l - u) / m, t[1] = (p - o) / m, t[2] = (a - c) / m) : r > h && r > y ? (m = Math.sqrt(1 + r - h - y) * 2, t[3] = (l - u) / m, t[0] = 0.25 * m, t[1] = (a + c) / m, t[2] = (p + o) / m) : h > y ? (m = Math.sqrt(1 + h - r - y) * 2, t[3] = (p - o) / m, t[0] = (a + c) / m, t[1] = 0.25 * m, t[2] = (l + u) / m) : (m = Math.sqrt(1 + y - r - h) * 2, t[3] = (a - c) / m, t[0] = (p + o) / m, t[1] = (l + u) / m, t[2] = 0.25 * m), t;
737
+ B.getScaling(Y, e);
738
+ const s = 1 / Y[0], i = 1 / Y[1], n = 1 / Y[2], r = e[0] * s, a = e[1] * i, o = e[2] * n, h = e[4] * s, c = e[5] * i, l = e[6] * n, p = e[8] * s, u = e[9] * i, g = e[10] * n, M = r + c + g;
739
+ let d = 0;
740
+ return M > 0 ? (d = Math.sqrt(M + 1) * 2, t[3] = 0.25 * d, t[0] = (l - u) / d, t[1] = (p - o) / d, t[2] = (a - h) / d) : r > c && r > g ? (d = Math.sqrt(1 + r - c - g) * 2, t[3] = (l - u) / d, t[0] = 0.25 * d, t[1] = (a + h) / d, t[2] = (p + o) / d) : c > g ? (d = Math.sqrt(1 + c - r - g) * 2, t[3] = (p - o) / d, t[0] = (a + h) / d, t[1] = 0.25 * d, t[2] = (l + u) / d) : (d = Math.sqrt(1 + g - r - c) * 2, t[3] = (a - h) / d, t[0] = (p + o) / d, t[1] = (l + u) / d, t[2] = 0.25 * d), t;
741
741
  }
742
742
  /**
743
743
  * Decomposes a transformation matrix into its rotation, translation
@@ -752,11 +752,11 @@ const N = 1e-6, Vt = new Float32Array([
752
752
  */
753
753
  static decompose(t, e, s, i) {
754
754
  e[0] = i[12], e[1] = i[13], e[2] = i[14];
755
- const n = i[0], r = i[1], a = i[2], o = i[4], c = i[5], h = i[6], l = i[8], p = i[9], u = i[10];
756
- s[0] = Math.sqrt(n * n + r * r + a * a), s[1] = Math.sqrt(o * o + c * c + h * h), s[2] = Math.sqrt(l * l + p * p + u * u);
757
- const y = 1 / s[0], L = 1 / s[1], m = 1 / s[2], g = n * y, b = r * L, S = a * m, x = o * y, T = c * L, E = h * m, w = l * y, z = p * L, v = u * m, k = g + T + v;
758
- let P = 0;
759
- return k > 0 ? (P = Math.sqrt(k + 1) * 2, t[3] = 0.25 * P, t[0] = (E - z) / P, t[1] = (w - S) / P, t[2] = (b - x) / P) : g > T && g > v ? (P = Math.sqrt(1 + g - T - v) * 2, t[3] = (E - z) / P, t[0] = 0.25 * P, t[1] = (b + x) / P, t[2] = (w + S) / P) : T > v ? (P = Math.sqrt(1 + T - g - v) * 2, t[3] = (w - S) / P, t[0] = (b + x) / P, t[1] = 0.25 * P, t[2] = (E + z) / P) : (P = Math.sqrt(1 + v - g - T) * 2, t[3] = (b - x) / P, t[0] = (w + S) / P, t[1] = (E + z) / P, t[2] = 0.25 * P), t;
755
+ const n = i[0], r = i[1], a = i[2], o = i[4], h = i[5], c = i[6], l = i[8], p = i[9], u = i[10];
756
+ s[0] = Math.sqrt(n * n + r * r + a * a), s[1] = Math.sqrt(o * o + h * h + c * c), s[2] = Math.sqrt(l * l + p * p + u * u);
757
+ const g = 1 / s[0], M = 1 / s[1], d = 1 / s[2], y = n * g, b = r * M, w = a * d, L = o * g, x = h * M, S = c * d, T = l * g, z = p * M, P = u * d, I = y + x + P;
758
+ let v = 0;
759
+ return I > 0 ? (v = Math.sqrt(I + 1) * 2, t[3] = 0.25 * v, t[0] = (S - z) / v, t[1] = (T - w) / v, t[2] = (b - L) / v) : y > x && y > P ? (v = Math.sqrt(1 + y - x - P) * 2, t[3] = (S - z) / v, t[0] = 0.25 * v, t[1] = (b + L) / v, t[2] = (T + w) / v) : x > P ? (v = Math.sqrt(1 + x - y - P) * 2, t[3] = (T - w) / v, t[0] = (b + L) / v, t[1] = 0.25 * v, t[2] = (S + z) / v) : (v = Math.sqrt(1 + P - y - x) * 2, t[3] = (b - L) / v, t[0] = (T + w) / v, t[1] = (S + z) / v, t[2] = 0.25 * v), t;
760
760
  }
761
761
  /**
762
762
  * Creates a matrix from a quaternion rotation, vector translation and vector scale
@@ -777,8 +777,8 @@ const N = 1e-6, Vt = new Float32Array([
777
777
  * @returns `out`
778
778
  */
779
779
  static fromRotationTranslationScale(t, e, s, i) {
780
- const n = e[0], r = e[1], a = e[2], o = e[3], c = n + n, h = r + r, l = a + a, p = n * c, u = n * h, y = n * l, L = r * h, m = r * l, g = a * l, b = o * c, S = o * h, x = o * l, T = i[0], E = i[1], w = i[2];
781
- return t[0] = (1 - (L + g)) * T, t[1] = (u + x) * T, t[2] = (y - S) * T, t[3] = 0, t[4] = (u - x) * E, t[5] = (1 - (p + g)) * E, t[6] = (m + b) * E, t[7] = 0, t[8] = (y + S) * w, t[9] = (m - b) * w, t[10] = (1 - (p + L)) * w, t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
780
+ const n = e[0], r = e[1], a = e[2], o = e[3], h = n + n, c = r + r, l = a + a, p = n * h, u = n * c, g = n * l, M = r * c, d = r * l, y = a * l, b = o * h, w = o * c, L = o * l, x = i[0], S = i[1], T = i[2];
781
+ return t[0] = (1 - (M + y)) * x, t[1] = (u + L) * x, t[2] = (g - w) * x, t[3] = 0, t[4] = (u - L) * S, t[5] = (1 - (p + y)) * S, t[6] = (d + b) * S, t[7] = 0, t[8] = (g + w) * T, t[9] = (d - b) * T, t[10] = (1 - (p + M)) * T, t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
782
782
  }
783
783
  /**
784
784
  * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
@@ -802,8 +802,8 @@ const N = 1e-6, Vt = new Float32Array([
802
802
  * @returns `out`
803
803
  */
804
804
  static fromRotationTranslationScaleOrigin(t, e, s, i, n) {
805
- const r = e[0], a = e[1], o = e[2], c = e[3], h = r + r, l = a + a, p = o + o, u = r * h, y = r * l, L = r * p, m = a * l, g = a * p, b = o * p, S = c * h, x = c * l, T = c * p, E = i[0], w = i[1], z = i[2], v = n[0], k = n[1], P = n[2], D = (1 - (m + b)) * E, A = (y + T) * E, O = (L - x) * E, I = (y - T) * w, Y = (1 - (u + b)) * w, ht = (g + S) * w, lt = (L + x) * z, Yt = (g - S) * z, Ut = (1 - (u + m)) * z;
806
- return t[0] = D, t[1] = A, t[2] = O, t[3] = 0, t[4] = I, t[5] = Y, t[6] = ht, t[7] = 0, t[8] = lt, t[9] = Yt, t[10] = Ut, t[11] = 0, t[12] = s[0] + v - (D * v + I * k + lt * P), t[13] = s[1] + k - (A * v + Y * k + Yt * P), t[14] = s[2] + P - (O * v + ht * k + Ut * P), t[15] = 1, t;
805
+ const r = e[0], a = e[1], o = e[2], h = e[3], c = r + r, l = a + a, p = o + o, u = r * c, g = r * l, M = r * p, d = a * l, y = a * p, b = o * p, w = h * c, L = h * l, x = h * p, S = i[0], T = i[1], z = i[2], P = n[0], I = n[1], v = n[2], D = (1 - (d + b)) * S, F = (g + x) * S, R = (M - L) * S, k = (g - x) * T, $ = (1 - (u + b)) * T, V = (y + w) * T, G = (M + L) * z, J = (y - w) * z, Q = (1 - (u + d)) * z;
806
+ return t[0] = D, t[1] = F, t[2] = R, t[3] = 0, t[4] = k, t[5] = $, t[6] = V, t[7] = 0, t[8] = G, t[9] = J, t[10] = Q, t[11] = 0, t[12] = s[0] + P - (D * P + k * I + G * v), t[13] = s[1] + I - (F * P + $ * I + J * v), t[14] = s[2] + v - (R * P + V * I + Q * v), t[15] = 1, t;
807
807
  }
808
808
  /**
809
809
  * Calculates a 4x4 matrix from the given quaternion
@@ -814,8 +814,8 @@ const N = 1e-6, Vt = new Float32Array([
814
814
  * @returns `out`
815
815
  */
816
816
  static fromQuat(t, e) {
817
- const s = e[0], i = e[1], n = e[2], r = e[3], a = s + s, o = i + i, c = n + n, h = s * a, l = i * a, p = i * o, u = n * a, y = n * o, L = n * c, m = r * a, g = r * o, b = r * c;
818
- return t[0] = 1 - p - L, t[1] = l + b, t[2] = u - g, t[3] = 0, t[4] = l - b, t[5] = 1 - h - L, t[6] = y + m, t[7] = 0, t[8] = u + g, t[9] = y - m, t[10] = 1 - h - p, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
817
+ const s = e[0], i = e[1], n = e[2], r = e[3], a = s + s, o = i + i, h = n + n, c = s * a, l = i * a, p = i * o, u = n * a, g = n * o, M = n * h, d = r * a, y = r * o, b = r * h;
818
+ return t[0] = 1 - p - M, t[1] = l + b, t[2] = u - y, t[3] = 0, t[4] = l - b, t[5] = 1 - c - M, t[6] = g + d, t[7] = 0, t[8] = u + y, t[9] = g - d, t[10] = 1 - c - p, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
819
819
  }
820
820
  /**
821
821
  * Generates a frustum matrix with the given bounds
@@ -834,10 +834,10 @@ const N = 1e-6, Vt = new Float32Array([
834
834
  * @returns `out`
835
835
  */
836
836
  static frustumNO(t, e, s, i, n, r, a = 1 / 0) {
837
- const o = 1 / (s - e), c = 1 / (n - i);
838
- if (t[0] = r * 2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 * c, t[6] = 0, t[7] = 0, t[8] = (s + e) * o, t[9] = (n + i) * c, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, a != null && a !== 1 / 0) {
839
- const h = 1 / (r - a);
840
- t[10] = (a + r) * h, t[14] = 2 * a * r * h;
837
+ const o = 1 / (s - e), h = 1 / (n - i);
838
+ if (t[0] = r * 2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 * h, t[6] = 0, t[7] = 0, t[8] = (s + e) * o, t[9] = (n + i) * h, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, a != null && a !== 1 / 0) {
839
+ const c = 1 / (r - a);
840
+ t[10] = (a + r) * c, t[14] = 2 * a * r * c;
841
841
  } else
842
842
  t[10] = -1, t[14] = -2 * r;
843
843
  return t;
@@ -867,10 +867,10 @@ const N = 1e-6, Vt = new Float32Array([
867
867
  * @returns `out`
868
868
  */
869
869
  static frustumZO(t, e, s, i, n, r, a = 1 / 0) {
870
- const o = 1 / (s - e), c = 1 / (n - i);
871
- if (t[0] = r * 2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 * c, t[6] = 0, t[7] = 0, t[8] = (s + e) * o, t[9] = (n + i) * c, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, a != null && a !== 1 / 0) {
872
- const h = 1 / (r - a);
873
- t[10] = a * h, t[14] = a * r * h;
870
+ const o = 1 / (s - e), h = 1 / (n - i);
871
+ if (t[0] = r * 2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 * h, t[6] = 0, t[7] = 0, t[8] = (s + e) * o, t[9] = (n + i) * h, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, a != null && a !== 1 / 0) {
872
+ const c = 1 / (r - a);
873
+ t[10] = a * c, t[14] = a * r * c;
874
874
  } else
875
875
  t[10] = -1, t[14] = -r;
876
876
  return t;
@@ -943,8 +943,8 @@ const N = 1e-6, Vt = new Float32Array([
943
943
  * @deprecated
944
944
  */
945
945
  static perspectiveFromFieldOfView(t, e, s, i) {
946
- const n = Math.tan(e.upDegrees * Math.PI / 180), r = Math.tan(e.downDegrees * Math.PI / 180), a = Math.tan(e.leftDegrees * Math.PI / 180), o = Math.tan(e.rightDegrees * Math.PI / 180), c = 2 / (a + o), h = 2 / (n + r);
947
- return t[0] = c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = h, t[6] = 0, t[7] = 0, t[8] = -((a - o) * c * 0.5), t[9] = (n - r) * h * 0.5, t[10] = i / (s - i), t[11] = -1, t[12] = 0, t[13] = 0, t[14] = i * s / (s - i), t[15] = 0, t;
946
+ const n = Math.tan(e.upDegrees * Math.PI / 180), r = Math.tan(e.downDegrees * Math.PI / 180), a = Math.tan(e.leftDegrees * Math.PI / 180), o = Math.tan(e.rightDegrees * Math.PI / 180), h = 2 / (a + o), c = 2 / (n + r);
947
+ return t[0] = h, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = c, t[6] = 0, t[7] = 0, t[8] = -((a - o) * h * 0.5), t[9] = (n - r) * c * 0.5, t[10] = i / (s - i), t[11] = -1, t[12] = 0, t[13] = 0, t[14] = i * s / (s - i), t[15] = 0, t;
948
948
  }
949
949
  /**
950
950
  * Generates a orthogonal projection matrix with the given bounds.
@@ -962,8 +962,8 @@ const N = 1e-6, Vt = new Float32Array([
962
962
  * @returns `out`
963
963
  */
964
964
  static orthoNO(t, e, s, i, n, r, a) {
965
- const o = 1 / (e - s), c = 1 / (i - n), h = 1 / (r - a);
966
- return t[0] = -2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * c, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 2 * h, t[11] = 0, t[12] = (e + s) * o, t[13] = (n + i) * c, t[14] = (a + r) * h, t[15] = 1, t;
965
+ const o = 1 / (e - s), h = 1 / (i - n), c = 1 / (r - a);
966
+ return t[0] = -2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * h, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 2 * c, t[11] = 0, t[12] = (e + s) * o, t[13] = (n + i) * h, t[14] = (a + r) * c, t[15] = 1, t;
967
967
  }
968
968
  /**
969
969
  * Alias for {@link Mat4.orthoNO}
@@ -989,8 +989,8 @@ const N = 1e-6, Vt = new Float32Array([
989
989
  * @returns `out`
990
990
  */
991
991
  static orthoZO(t, e, s, i, n, r, a) {
992
- const o = 1 / (e - s), c = 1 / (i - n), h = 1 / (r - a);
993
- return t[0] = -2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * c, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = h, t[11] = 0, t[12] = (e + s) * o, t[13] = (n + i) * c, t[14] = r * h, t[15] = 1, t;
992
+ const o = 1 / (e - s), h = 1 / (i - n), c = 1 / (r - a);
993
+ return t[0] = -2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * h, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = c, t[11] = 0, t[12] = (e + s) * o, t[13] = (n + i) * h, t[14] = r * c, t[15] = 1, t;
994
994
  }
995
995
  /**
996
996
  * Generates a look-at matrix with the given eye position, focal point, and up axis.
@@ -1004,15 +1004,15 @@ const N = 1e-6, Vt = new Float32Array([
1004
1004
  * @returns `out`
1005
1005
  */
1006
1006
  static lookAt(t, e, s, i) {
1007
- const n = e[0], r = e[1], a = e[2], o = i[0], c = i[1], h = i[2], l = s[0], p = s[1], u = s[2];
1007
+ const n = e[0], r = e[1], a = e[2], o = i[0], h = i[1], c = i[2], l = s[0], p = s[1], u = s[2];
1008
1008
  if (Math.abs(n - l) < N && Math.abs(r - p) < N && Math.abs(a - u) < N)
1009
1009
  return B.identity(t);
1010
- let y = n - l, L = r - p, m = a - u, g = 1 / Math.sqrt(y * y + L * L + m * m);
1011
- y *= g, L *= g, m *= g;
1012
- let b = c * m - h * L, S = h * y - o * m, x = o * L - c * y;
1013
- g = Math.sqrt(b * b + S * S + x * x), g ? (g = 1 / g, b *= g, S *= g, x *= g) : (b = 0, S = 0, x = 0);
1014
- let T = L * x - m * S, E = m * b - y * x, w = y * S - L * b;
1015
- return g = Math.sqrt(T * T + E * E + w * w), g ? (g = 1 / g, T *= g, E *= g, w *= g) : (T = 0, E = 0, w = 0), t[0] = b, t[1] = T, t[2] = y, t[3] = 0, t[4] = S, t[5] = E, t[6] = L, t[7] = 0, t[8] = x, t[9] = w, t[10] = m, t[11] = 0, t[12] = -(b * n + S * r + x * a), t[13] = -(T * n + E * r + w * a), t[14] = -(y * n + L * r + m * a), t[15] = 1, t;
1010
+ let g = n - l, M = r - p, d = a - u, y = 1 / Math.sqrt(g * g + M * M + d * d);
1011
+ g *= y, M *= y, d *= y;
1012
+ let b = h * d - c * M, w = c * g - o * d, L = o * M - h * g;
1013
+ y = Math.sqrt(b * b + w * w + L * L), y ? (y = 1 / y, b *= y, w *= y, L *= y) : (b = 0, w = 0, L = 0);
1014
+ let x = M * L - d * w, S = d * b - g * L, T = g * w - M * b;
1015
+ return y = Math.sqrt(x * x + S * S + T * T), y ? (y = 1 / y, x *= y, S *= y, T *= y) : (x = 0, S = 0, T = 0), t[0] = b, t[1] = x, t[2] = g, t[3] = 0, t[4] = w, t[5] = S, t[6] = M, t[7] = 0, t[8] = L, t[9] = T, t[10] = d, t[11] = 0, t[12] = -(b * n + w * r + L * a), t[13] = -(x * n + S * r + T * a), t[14] = -(g * n + M * r + d * a), t[15] = 1, t;
1016
1016
  }
1017
1017
  /**
1018
1018
  * Generates a matrix that makes something look at something else.
@@ -1025,11 +1025,11 @@ const N = 1e-6, Vt = new Float32Array([
1025
1025
  * @returns `out`
1026
1026
  */
1027
1027
  static targetTo(t, e, s, i) {
1028
- const n = e[0], r = e[1], a = e[2], o = i[0], c = i[1], h = i[2];
1029
- let l = n - s[0], p = r - s[1], u = a - s[2], y = l * l + p * p + u * u;
1030
- y > 0 && (y = 1 / Math.sqrt(y), l *= y, p *= y, u *= y);
1031
- let L = c * u - h * p, m = h * l - o * u, g = o * p - c * l;
1032
- return y = L * L + m * m + g * g, y > 0 && (y = 1 / Math.sqrt(y), L *= y, m *= y, g *= y), t[0] = L, t[1] = m, t[2] = g, t[3] = 0, t[4] = p * g - u * m, t[5] = u * L - l * g, t[6] = l * m - p * L, t[7] = 0, t[8] = l, t[9] = p, t[10] = u, t[11] = 0, t[12] = n, t[13] = r, t[14] = a, t[15] = 1, t;
1028
+ const n = e[0], r = e[1], a = e[2], o = i[0], h = i[1], c = i[2];
1029
+ let l = n - s[0], p = r - s[1], u = a - s[2], g = l * l + p * p + u * u;
1030
+ g > 0 && (g = 1 / Math.sqrt(g), l *= g, p *= g, u *= g);
1031
+ let M = h * u - c * p, d = c * l - o * u, y = o * p - h * l;
1032
+ return g = M * M + d * d + y * y, g > 0 && (g = 1 / Math.sqrt(g), M *= g, d *= g, y *= g), t[0] = M, t[1] = d, t[2] = y, t[3] = 0, t[4] = p * y - u * d, t[5] = u * M - l * y, t[6] = l * d - p * M, t[7] = 0, t[8] = l, t[9] = p, t[10] = u, t[11] = 0, t[12] = n, t[13] = r, t[14] = a, t[15] = 1, t;
1033
1033
  }
1034
1034
  /**
1035
1035
  * Returns Frobenius norm of a {@link Mat4}
@@ -1117,8 +1117,8 @@ const N = 1e-6, Vt = new Float32Array([
1117
1117
  * @returns True if the matrices are equal, false otherwise.
1118
1118
  */
1119
1119
  static equals(t, e) {
1120
- const s = t[0], i = t[1], n = t[2], r = t[3], a = t[4], o = t[5], c = t[6], h = t[7], l = t[8], p = t[9], u = t[10], y = t[11], L = t[12], m = t[13], g = t[14], b = t[15], S = e[0], x = e[1], T = e[2], E = e[3], w = e[4], z = e[5], v = e[6], k = e[7], P = e[8], D = e[9], A = e[10], O = e[11], I = e[12], Y = e[13], ht = e[14], lt = e[15];
1121
- return Math.abs(s - S) <= N * Math.max(1, Math.abs(s), Math.abs(S)) && Math.abs(i - x) <= N * Math.max(1, Math.abs(i), Math.abs(x)) && Math.abs(n - T) <= N * Math.max(1, Math.abs(n), Math.abs(T)) && Math.abs(r - E) <= N * Math.max(1, Math.abs(r), Math.abs(E)) && Math.abs(a - w) <= N * Math.max(1, Math.abs(a), Math.abs(w)) && Math.abs(o - z) <= N * Math.max(1, Math.abs(o), Math.abs(z)) && Math.abs(c - v) <= N * Math.max(1, Math.abs(c), Math.abs(v)) && Math.abs(h - k) <= N * Math.max(1, Math.abs(h), Math.abs(k)) && Math.abs(l - P) <= N * Math.max(1, Math.abs(l), Math.abs(P)) && Math.abs(p - D) <= N * Math.max(1, Math.abs(p), Math.abs(D)) && Math.abs(u - A) <= N * Math.max(1, Math.abs(u), Math.abs(A)) && Math.abs(y - O) <= N * Math.max(1, Math.abs(y), Math.abs(O)) && Math.abs(L - I) <= N * Math.max(1, Math.abs(L), Math.abs(I)) && Math.abs(m - Y) <= N * Math.max(1, Math.abs(m), Math.abs(Y)) && Math.abs(g - ht) <= N * Math.max(1, Math.abs(g), Math.abs(ht)) && Math.abs(b - lt) <= N * Math.max(1, Math.abs(b), Math.abs(lt));
1120
+ const s = t[0], i = t[1], n = t[2], r = t[3], a = t[4], o = t[5], h = t[6], c = t[7], l = t[8], p = t[9], u = t[10], g = t[11], M = t[12], d = t[13], y = t[14], b = t[15], w = e[0], L = e[1], x = e[2], S = e[3], T = e[4], z = e[5], P = e[6], I = e[7], v = e[8], D = e[9], F = e[10], R = e[11], k = e[12], $ = e[13], V = e[14], G = e[15];
1121
+ return Math.abs(s - w) <= N * Math.max(1, Math.abs(s), Math.abs(w)) && Math.abs(i - L) <= N * Math.max(1, Math.abs(i), Math.abs(L)) && Math.abs(n - x) <= N * Math.max(1, Math.abs(n), Math.abs(x)) && Math.abs(r - S) <= N * Math.max(1, Math.abs(r), Math.abs(S)) && Math.abs(a - T) <= N * Math.max(1, Math.abs(a), Math.abs(T)) && Math.abs(o - z) <= N * Math.max(1, Math.abs(o), Math.abs(z)) && Math.abs(h - P) <= N * Math.max(1, Math.abs(h), Math.abs(P)) && Math.abs(c - I) <= N * Math.max(1, Math.abs(c), Math.abs(I)) && Math.abs(l - v) <= N * Math.max(1, Math.abs(l), Math.abs(v)) && Math.abs(p - D) <= N * Math.max(1, Math.abs(p), Math.abs(D)) && Math.abs(u - F) <= N * Math.max(1, Math.abs(u), Math.abs(F)) && Math.abs(g - R) <= N * Math.max(1, Math.abs(g), Math.abs(R)) && Math.abs(M - k) <= N * Math.max(1, Math.abs(M), Math.abs(k)) && Math.abs(d - $) <= N * Math.max(1, Math.abs(d), Math.abs($)) && Math.abs(y - V) <= N * Math.max(1, Math.abs(y), Math.abs(V)) && Math.abs(b - G) <= N * Math.max(1, Math.abs(b), Math.abs(G));
1122
1122
  }
1123
1123
  /**
1124
1124
  * Returns a string representation of a {@link Mat4}
@@ -1136,14 +1136,14 @@ const N = 1e-6, Vt = new Float32Array([
1136
1136
  */
1137
1137
  f(B, "BYTE_LENGTH", 16 * Float32Array.BYTES_PER_ELEMENT);
1138
1138
  let _ = B;
1139
- const j = new Float32Array(3);
1139
+ const Y = new Float32Array(3);
1140
1140
  _.prototype.mul = _.prototype.multiply;
1141
1141
  _.sub = _.subtract;
1142
1142
  _.mul = _.multiply;
1143
1143
  _.frustum = _.frustumNO;
1144
1144
  _.perspective = _.perspectiveNO;
1145
1145
  _.ortho = _.orthoNO;
1146
- const H = class H extends Float32Array {
1146
+ const U = class U extends Float32Array {
1147
1147
  /**
1148
1148
  * Create a {@link Vec3}.
1149
1149
  */
@@ -1268,7 +1268,7 @@ const H = class H extends Float32Array {
1268
1268
  * Equivalent to `Vec3.str(this);`
1269
1269
  */
1270
1270
  get str() {
1271
- return H.str(this);
1271
+ return U.str(this);
1272
1272
  }
1273
1273
  //===================
1274
1274
  // Instances methods
@@ -1369,7 +1369,7 @@ const H = class H extends Float32Array {
1369
1369
  * @returns Distance between `this` and `b`
1370
1370
  */
1371
1371
  distance(t) {
1372
- return H.distance(this, t);
1372
+ return U.distance(this, t);
1373
1373
  }
1374
1374
  /**
1375
1375
  * Alias for {@link Vec3.distance}
@@ -1385,7 +1385,7 @@ const H = class H extends Float32Array {
1385
1385
  * @returns Squared distance between `this` and `b`
1386
1386
  */
1387
1387
  squaredDistance(t) {
1388
- return H.squaredDistance(this, t);
1388
+ return U.squaredDistance(this, t);
1389
1389
  }
1390
1390
  /**
1391
1391
  * Alias for {@link Vec3.squaredDistance}
@@ -1437,7 +1437,7 @@ const H = class H extends Float32Array {
1437
1437
  * @returns `this`
1438
1438
  */
1439
1439
  normalize() {
1440
- return H.normalize(this, this);
1440
+ return U.normalize(this, this);
1441
1441
  }
1442
1442
  //================
1443
1443
  // Static methods
@@ -1449,7 +1449,7 @@ const H = class H extends Float32Array {
1449
1449
  * @returns a new 3D vector
1450
1450
  */
1451
1451
  static create() {
1452
- return new H();
1452
+ return new U();
1453
1453
  }
1454
1454
  /**
1455
1455
  * Creates a new vec3 initialized with values from an existing vector
@@ -1459,7 +1459,7 @@ const H = class H extends Float32Array {
1459
1459
  * @returns a new 3D vector
1460
1460
  */
1461
1461
  static clone(t) {
1462
- return new H(t);
1462
+ return new U(t);
1463
1463
  }
1464
1464
  /**
1465
1465
  * Calculates the magnitude (length) of a {@link Vec3}
@@ -1509,7 +1509,7 @@ const H = class H extends Float32Array {
1509
1509
  * @returns a new 3D vector
1510
1510
  */
1511
1511
  static fromValues(t, e, s) {
1512
- return new H(t, e, s);
1512
+ return new U(t, e, s);
1513
1513
  }
1514
1514
  /**
1515
1515
  * Copy the values from one vec3 to another
@@ -1809,8 +1809,8 @@ const H = class H extends Float32Array {
1809
1809
  * @returns `out`
1810
1810
  */
1811
1811
  static cross(t, e, s) {
1812
- const i = e[0], n = e[1], r = e[2], a = s[0], o = s[1], c = s[2];
1813
- return t[0] = n * c - r * o, t[1] = r * a - i * c, t[2] = i * o - n * a, t;
1812
+ const i = e[0], n = e[1], r = e[2], a = s[0], o = s[1], h = s[2];
1813
+ return t[0] = n * h - r * o, t[1] = r * a - i * h, t[2] = i * o - n * a, t;
1814
1814
  }
1815
1815
  /**
1816
1816
  * Performs a linear interpolation between two vec3's
@@ -1837,7 +1837,7 @@ const H = class H extends Float32Array {
1837
1837
  * @returns `out`
1838
1838
  */
1839
1839
  static slerp(t, e, s, i) {
1840
- const n = Math.acos(Math.min(Math.max(H.dot(e, s), -1), 1)), r = Math.sin(n), a = Math.sin((1 - i) * n) / r, o = Math.sin(i * n) / r;
1840
+ const n = Math.acos(Math.min(Math.max(U.dot(e, s), -1), 1)), r = Math.sin(n), a = Math.sin((1 - i) * n) / r, o = Math.sin(i * n) / r;
1841
1841
  return t[0] = a * e[0] + o * s[0], t[1] = a * e[1] + o * s[1], t[2] = a * e[2] + o * s[2], t;
1842
1842
  }
1843
1843
  /**
@@ -1853,8 +1853,8 @@ const H = class H extends Float32Array {
1853
1853
  * @returns `out`
1854
1854
  */
1855
1855
  static hermite(t, e, s, i, n, r) {
1856
- const a = r * r, o = a * (2 * r - 3) + 1, c = a * (r - 2) + r, h = a * (r - 1), l = a * (3 - 2 * r);
1857
- return t[0] = e[0] * o + s[0] * c + i[0] * h + n[0] * l, t[1] = e[1] * o + s[1] * c + i[1] * h + n[1] * l, t[2] = e[2] * o + s[2] * c + i[2] * h + n[2] * l, t;
1856
+ const a = r * r, o = a * (2 * r - 3) + 1, h = a * (r - 2) + r, c = a * (r - 1), l = a * (3 - 2 * r);
1857
+ return t[0] = e[0] * o + s[0] * h + i[0] * c + n[0] * l, t[1] = e[1] * o + s[1] * h + i[1] * c + n[1] * l, t[2] = e[2] * o + s[2] * h + i[2] * c + n[2] * l, t;
1858
1858
  }
1859
1859
  /**
1860
1860
  * Performs a bezier interpolation with two control points
@@ -1869,8 +1869,8 @@ const H = class H extends Float32Array {
1869
1869
  * @returns `out`
1870
1870
  */
1871
1871
  static bezier(t, e, s, i, n, r) {
1872
- const a = 1 - r, o = a * a, c = r * r, h = o * a, l = 3 * r * o, p = 3 * c * a, u = c * r;
1873
- return t[0] = e[0] * h + s[0] * l + i[0] * p + n[0] * u, t[1] = e[1] * h + s[1] * l + i[1] * p + n[1] * u, t[2] = e[2] * h + s[2] * l + i[2] * p + n[2] * u, t;
1872
+ const a = 1 - r, o = a * a, h = r * r, c = o * a, l = 3 * r * o, p = 3 * h * a, u = h * r;
1873
+ return t[0] = e[0] * c + s[0] * l + i[0] * p + n[0] * u, t[1] = e[1] * c + s[1] * l + i[1] * p + n[1] * u, t[2] = e[2] * c + s[2] * l + i[2] * p + n[2] * u, t;
1874
1874
  }
1875
1875
  /**
1876
1876
  * Generates a random vector with the given scale
@@ -1930,8 +1930,8 @@ const H = class H extends Float32Array {
1930
1930
  * @returns `out`
1931
1931
  */
1932
1932
  static transformQuat(t, e, s) {
1933
- const i = s[0], n = s[1], r = s[2], a = s[3] * 2, o = e[0], c = e[1], h = e[2], l = n * h - r * c, p = r * o - i * h, u = i * c - n * o, y = (n * u - r * p) * 2, L = (r * l - i * u) * 2, m = (i * p - n * l) * 2;
1934
- return t[0] = o + l * a + y, t[1] = c + p * a + L, t[2] = h + u * a + m, t;
1933
+ const i = s[0], n = s[1], r = s[2], a = s[3] * 2, o = e[0], h = e[1], c = e[2], l = n * c - r * h, p = r * o - i * c, u = i * h - n * o, g = (n * u - r * p) * 2, M = (r * l - i * u) * 2, d = (i * p - n * l) * 2;
1934
+ return t[0] = o + l * a + g, t[1] = h + p * a + M, t[2] = c + u * a + d, t;
1935
1935
  }
1936
1936
  /**
1937
1937
  * Rotate a 3D vector around the x-axis
@@ -1976,8 +1976,8 @@ const H = class H extends Float32Array {
1976
1976
  * @returns The angle in radians
1977
1977
  */
1978
1978
  static angle(t, e) {
1979
- const s = t[0], i = t[1], n = t[2], r = e[0], a = e[1], o = e[2], c = Math.sqrt((s * s + i * i + n * n) * (r * r + a * a + o * o)), h = c && H.dot(t, e) / c;
1980
- return Math.acos(Math.min(Math.max(h, -1), 1));
1979
+ const s = t[0], i = t[1], n = t[2], r = e[0], a = e[1], o = e[2], h = Math.sqrt((s * s + i * i + n * n) * (r * r + a * a + o * o)), c = h && U.dot(t, e) / h;
1980
+ return Math.acos(Math.min(Math.max(c, -1), 1));
1981
1981
  }
1982
1982
  /**
1983
1983
  * Set the components of a vec3 to zero
@@ -2026,23 +2026,23 @@ const H = class H extends Float32Array {
2026
2026
  /**
2027
2027
  * The number of bytes in a {@link Vec3}.
2028
2028
  */
2029
- f(H, "BYTE_LENGTH", 3 * Float32Array.BYTES_PER_ELEMENT);
2030
- let W = H;
2031
- W.prototype.sub = W.prototype.subtract;
2032
- W.prototype.mul = W.prototype.multiply;
2033
- W.prototype.div = W.prototype.divide;
2034
- W.prototype.dist = W.prototype.distance;
2035
- W.prototype.sqrDist = W.prototype.squaredDistance;
2036
- W.sub = W.subtract;
2037
- W.mul = W.multiply;
2038
- W.div = W.divide;
2039
- W.dist = W.distance;
2040
- W.sqrDist = W.squaredDistance;
2041
- W.sqrLen = W.squaredLength;
2042
- W.mag = W.magnitude;
2043
- W.length = W.magnitude;
2044
- W.len = W.magnitude;
2045
- const U = class U extends Float32Array {
2029
+ f(U, "BYTE_LENGTH", 3 * Float32Array.BYTES_PER_ELEMENT);
2030
+ let O = U;
2031
+ O.prototype.sub = O.prototype.subtract;
2032
+ O.prototype.mul = O.prototype.multiply;
2033
+ O.prototype.div = O.prototype.divide;
2034
+ O.prototype.dist = O.prototype.distance;
2035
+ O.prototype.sqrDist = O.prototype.squaredDistance;
2036
+ O.sub = O.subtract;
2037
+ O.mul = O.multiply;
2038
+ O.div = O.divide;
2039
+ O.dist = O.distance;
2040
+ O.sqrDist = O.squaredDistance;
2041
+ O.sqrLen = O.squaredLength;
2042
+ O.mag = O.magnitude;
2043
+ O.length = O.magnitude;
2044
+ O.len = O.magnitude;
2045
+ const X = class X extends Float32Array {
2046
2046
  /**
2047
2047
  * Create a {@link Vec4}.
2048
2048
  */
@@ -2173,7 +2173,7 @@ const U = class U extends Float32Array {
2173
2173
  * Equivalent to `Vec4.str(this);`
2174
2174
  */
2175
2175
  get str() {
2176
- return U.str(this);
2176
+ return X.str(this);
2177
2177
  }
2178
2178
  //===================
2179
2179
  // Instances methods
@@ -2274,7 +2274,7 @@ const U = class U extends Float32Array {
2274
2274
  * @returns Distance between `this` and `b`
2275
2275
  */
2276
2276
  distance(t) {
2277
- return U.distance(this, t);
2277
+ return X.distance(this, t);
2278
2278
  }
2279
2279
  /**
2280
2280
  * Alias for {@link Vec4.distance}
@@ -2290,7 +2290,7 @@ const U = class U extends Float32Array {
2290
2290
  * @returns Squared distance between `this` and `b`
2291
2291
  */
2292
2292
  squaredDistance(t) {
2293
- return U.squaredDistance(this, t);
2293
+ return X.squaredDistance(this, t);
2294
2294
  }
2295
2295
  /**
2296
2296
  * Alias for {@link Vec4.squaredDistance}
@@ -2342,7 +2342,7 @@ const U = class U extends Float32Array {
2342
2342
  * @returns `this`
2343
2343
  */
2344
2344
  normalize() {
2345
- return U.normalize(this, this);
2345
+ return X.normalize(this, this);
2346
2346
  }
2347
2347
  //===================
2348
2348
  // Static methods
@@ -2354,7 +2354,7 @@ const U = class U extends Float32Array {
2354
2354
  * @returns a new 4D vector
2355
2355
  */
2356
2356
  static create() {
2357
- return new U();
2357
+ return new X();
2358
2358
  }
2359
2359
  /**
2360
2360
  * Creates a new {@link Vec4} initialized with values from an existing vector
@@ -2364,7 +2364,7 @@ const U = class U extends Float32Array {
2364
2364
  * @returns a new 4D vector
2365
2365
  */
2366
2366
  static clone(t) {
2367
- return new U(t);
2367
+ return new X(t);
2368
2368
  }
2369
2369
  /**
2370
2370
  * Creates a new {@link Vec4} initialized with the given values
@@ -2377,7 +2377,7 @@ const U = class U extends Float32Array {
2377
2377
  * @returns a new 4D vector
2378
2378
  */
2379
2379
  static fromValues(t, e, s, i) {
2380
- return new U(t, e, s, i);
2380
+ return new X(t, e, s, i);
2381
2381
  }
2382
2382
  /**
2383
2383
  * Copy the values from one {@link Vec4} to another
@@ -2714,8 +2714,8 @@ const U = class U extends Float32Array {
2714
2714
  * @returns result
2715
2715
  */
2716
2716
  static cross(t, e, s, i) {
2717
- const n = s[0] * i[1] - s[1] * i[0], r = s[0] * i[2] - s[2] * i[0], a = s[0] * i[3] - s[3] * i[0], o = s[1] * i[2] - s[2] * i[1], c = s[1] * i[3] - s[3] * i[1], h = s[2] * i[3] - s[3] * i[2], l = e[0], p = e[1], u = e[2], y = e[3];
2718
- return t[0] = p * h - u * c + y * o, t[1] = -(l * h) + u * a - y * r, t[2] = l * c - p * a + y * n, t[3] = -(l * o) + p * r - u * n, t;
2717
+ const n = s[0] * i[1] - s[1] * i[0], r = s[0] * i[2] - s[2] * i[0], a = s[0] * i[3] - s[3] * i[0], o = s[1] * i[2] - s[2] * i[1], h = s[1] * i[3] - s[3] * i[1], c = s[2] * i[3] - s[3] * i[2], l = e[0], p = e[1], u = e[2], g = e[3];
2718
+ return t[0] = p * c - u * h + g * o, t[1] = -(l * c) + u * a - g * r, t[2] = l * h - p * a + g * n, t[3] = -(l * o) + p * r - u * n, t;
2719
2719
  }
2720
2720
  /**
2721
2721
  * Performs a linear interpolation between two {@link Vec4}'s
@@ -2788,8 +2788,8 @@ const U = class U extends Float32Array {
2788
2788
  * @returns `out`
2789
2789
  */
2790
2790
  static transformQuat(t, e, s) {
2791
- const i = e[0], n = e[1], r = e[2], a = s[0], o = s[1], c = s[2], h = s[3], l = h * i + o * r - c * n, p = h * n + c * i - a * r, u = h * r + a * n - o * i, y = -a * i - o * n - c * r;
2792
- return t[0] = l * h + y * -a + p * -c - u * -o, t[1] = p * h + y * -o + u * -a - l * -c, t[2] = u * h + y * -c + l * -o - p * -a, t[3] = e[3], t;
2791
+ const i = e[0], n = e[1], r = e[2], a = s[0], o = s[1], h = s[2], c = s[3], l = c * i + o * r - h * n, p = c * n + h * i - a * r, u = c * r + a * n - o * i, g = -a * i - o * n - h * r;
2792
+ return t[0] = l * c + g * -a + p * -h - u * -o, t[1] = p * c + g * -o + u * -a - l * -h, t[2] = u * c + g * -h + l * -o - p * -a, t[3] = e[3], t;
2793
2793
  }
2794
2794
  /**
2795
2795
  * Set the components of a {@link Vec4} to zero
@@ -2831,30 +2831,30 @@ const U = class U extends Float32Array {
2831
2831
  * @returns True if the vectors are equal, false otherwise.
2832
2832
  */
2833
2833
  static equals(t, e) {
2834
- const s = t[0], i = t[1], n = t[2], r = t[3], a = e[0], o = e[1], c = e[2], h = e[3];
2835
- return Math.abs(s - a) <= N * Math.max(1, Math.abs(s), Math.abs(a)) && Math.abs(i - o) <= N * Math.max(1, Math.abs(i), Math.abs(o)) && Math.abs(n - c) <= N * Math.max(1, Math.abs(n), Math.abs(c)) && Math.abs(r - h) <= N * Math.max(1, Math.abs(r), Math.abs(h));
2834
+ const s = t[0], i = t[1], n = t[2], r = t[3], a = e[0], o = e[1], h = e[2], c = e[3];
2835
+ return Math.abs(s - a) <= N * Math.max(1, Math.abs(s), Math.abs(a)) && Math.abs(i - o) <= N * Math.max(1, Math.abs(i), Math.abs(o)) && Math.abs(n - h) <= N * Math.max(1, Math.abs(n), Math.abs(h)) && Math.abs(r - c) <= N * Math.max(1, Math.abs(r), Math.abs(c));
2836
2836
  }
2837
2837
  };
2838
2838
  /**
2839
2839
  * The number of bytes in a {@link Vec4}.
2840
2840
  */
2841
- f(U, "BYTE_LENGTH", 4 * Float32Array.BYTES_PER_ELEMENT);
2842
- let F = U;
2843
- F.prototype.sub = F.prototype.subtract;
2844
- F.prototype.mul = F.prototype.multiply;
2845
- F.prototype.div = F.prototype.divide;
2846
- F.prototype.dist = F.prototype.distance;
2847
- F.prototype.sqrDist = F.prototype.squaredDistance;
2848
- F.sub = F.subtract;
2849
- F.mul = F.multiply;
2850
- F.div = F.divide;
2851
- F.dist = F.distance;
2852
- F.sqrDist = F.squaredDistance;
2853
- F.sqrLen = F.squaredLength;
2854
- F.mag = F.magnitude;
2855
- F.length = F.magnitude;
2856
- F.len = F.magnitude;
2857
- const V = class V extends Float32Array {
2841
+ f(X, "BYTE_LENGTH", 4 * Float32Array.BYTES_PER_ELEMENT);
2842
+ let A = X;
2843
+ A.prototype.sub = A.prototype.subtract;
2844
+ A.prototype.mul = A.prototype.multiply;
2845
+ A.prototype.div = A.prototype.divide;
2846
+ A.prototype.dist = A.prototype.distance;
2847
+ A.prototype.sqrDist = A.prototype.squaredDistance;
2848
+ A.sub = A.subtract;
2849
+ A.mul = A.multiply;
2850
+ A.div = A.divide;
2851
+ A.dist = A.distance;
2852
+ A.sqrDist = A.squaredDistance;
2853
+ A.sqrLen = A.squaredLength;
2854
+ A.mag = A.magnitude;
2855
+ A.length = A.magnitude;
2856
+ A.len = A.magnitude;
2857
+ const Z = class Z extends Float32Array {
2858
2858
  /**
2859
2859
  * Create a {@link Vec2}.
2860
2860
  */
@@ -2957,7 +2957,7 @@ const V = class V extends Float32Array {
2957
2957
  * Equivalent to `Vec2.str(this);`
2958
2958
  */
2959
2959
  get str() {
2960
- return V.str(this);
2960
+ return Z.str(this);
2961
2961
  }
2962
2962
  //===================
2963
2963
  // Instances methods
@@ -3059,7 +3059,7 @@ const V = class V extends Float32Array {
3059
3059
  * @returns Distance between `this` and `b`
3060
3060
  */
3061
3061
  distance(t) {
3062
- return V.distance(this, t);
3062
+ return Z.distance(this, t);
3063
3063
  }
3064
3064
  /**
3065
3065
  * Alias for {@link Vec2.distance}
@@ -3075,7 +3075,7 @@ const V = class V extends Float32Array {
3075
3075
  * @returns Squared distance between `this` and `b`
3076
3076
  */
3077
3077
  squaredDistance(t) {
3078
- return V.squaredDistance(this, t);
3078
+ return Z.squaredDistance(this, t);
3079
3079
  }
3080
3080
  /**
3081
3081
  * Alias for {@link Vec2.squaredDistance}
@@ -3127,7 +3127,7 @@ const V = class V extends Float32Array {
3127
3127
  * @returns `this`
3128
3128
  */
3129
3129
  normalize() {
3130
- return V.normalize(this, this);
3130
+ return Z.normalize(this, this);
3131
3131
  }
3132
3132
  //================
3133
3133
  // Static methods
@@ -3139,7 +3139,7 @@ const V = class V extends Float32Array {
3139
3139
  * @returns A new 2D vector
3140
3140
  */
3141
3141
  static create() {
3142
- return new V();
3142
+ return new Z();
3143
3143
  }
3144
3144
  /**
3145
3145
  * Creates a new {@link Vec2} initialized with values from an existing vector
@@ -3149,7 +3149,7 @@ const V = class V extends Float32Array {
3149
3149
  * @returns A new 2D vector
3150
3150
  */
3151
3151
  static clone(t) {
3152
- return new V(t);
3152
+ return new Z(t);
3153
3153
  }
3154
3154
  /**
3155
3155
  * Creates a new {@link Vec2} initialized with the given values
@@ -3160,7 +3160,7 @@ const V = class V extends Float32Array {
3160
3160
  * @returns A new 2D vector
3161
3161
  */
3162
3162
  static fromValues(t, e) {
3163
- return new V(t, e);
3163
+ return new Z(t, e);
3164
3164
  }
3165
3165
  /**
3166
3166
  * Copy the values from one {@link Vec2} to another
@@ -3638,29 +3638,29 @@ const V = class V extends Float32Array {
3638
3638
  /**
3639
3639
  * The number of bytes in a {@link Vec2}.
3640
3640
  */
3641
- f(V, "BYTE_LENGTH", 2 * Float32Array.BYTES_PER_ELEMENT);
3642
- let R = V;
3643
- R.prototype.sub = R.prototype.subtract;
3644
- R.prototype.mul = R.prototype.multiply;
3645
- R.prototype.div = R.prototype.divide;
3646
- R.prototype.dist = R.prototype.distance;
3647
- R.prototype.sqrDist = R.prototype.squaredDistance;
3648
- R.sub = R.subtract;
3649
- R.mul = R.multiply;
3650
- R.div = R.divide;
3651
- R.dist = R.distance;
3652
- R.sqrDist = R.squaredDistance;
3653
- R.sqrLen = R.squaredLength;
3654
- R.mag = R.magnitude;
3655
- R.length = R.magnitude;
3656
- R.len = R.magnitude;
3657
- function De(d) {
3641
+ f(Z, "BYTE_LENGTH", 2 * Float32Array.BYTES_PER_ELEMENT);
3642
+ let C = Z;
3643
+ C.prototype.sub = C.prototype.subtract;
3644
+ C.prototype.mul = C.prototype.multiply;
3645
+ C.prototype.div = C.prototype.divide;
3646
+ C.prototype.dist = C.prototype.distance;
3647
+ C.prototype.sqrDist = C.prototype.squaredDistance;
3648
+ C.sub = C.subtract;
3649
+ C.mul = C.multiply;
3650
+ C.div = C.divide;
3651
+ C.dist = C.distance;
3652
+ C.sqrDist = C.squaredDistance;
3653
+ C.sqrLen = C.squaredLength;
3654
+ C.mag = C.magnitude;
3655
+ C.length = C.magnitude;
3656
+ C.len = C.magnitude;
3657
+ function ve(m) {
3658
3658
  return new Promise((t, e) => {
3659
3659
  const s = document.createElement("img");
3660
- s.onload = () => t(s), s.onerror = e, s.src = d, s.crossOrigin = "anonymous", s.loading = "eager";
3660
+ s.onload = () => t(s), s.onerror = e, s.src = m, s.crossOrigin = "anonymous", s.loading = "eager";
3661
3661
  });
3662
3662
  }
3663
- function Fe(d) {
3663
+ function Pe(m) {
3664
3664
  return new Promise((t, e) => {
3665
3665
  const s = document.createElement("video");
3666
3666
  let i = !1, n = !1, r = !1;
@@ -3686,260 +3686,282 @@ function Fe(d) {
3686
3686
  function a() {
3687
3687
  i && n && !r && t(s);
3688
3688
  }
3689
- s.src = d, s.playsInline = !0, s.crossOrigin = "anonymous", s.autoplay = !0, s.loop = !0, s.muted = !0, s.play();
3689
+ s.src = m, s.playsInline = !0, s.crossOrigin = "anonymous", s.autoplay = !0, s.loop = !0, s.muted = !0, s.play();
3690
3690
  });
3691
3691
  }
3692
- function ae(d, t = !1) {
3693
- return t ? Fe(d) : De(d);
3692
+ function ae(m, t = !1) {
3693
+ return t ? Pe(m) : ve(m);
3694
3694
  }
3695
- function oe(d) {
3695
+ function oe(m) {
3696
3696
  return new Promise((t, e) => {
3697
- (d instanceof HTMLImageElement ? d.complete : d.readyState >= 3) ? t(d) : (d.onload = () => t(d), d.onerror = e);
3697
+ (m instanceof HTMLImageElement ? m.complete : m.readyState >= 3) ? t(m) : (m.onload = () => t(m), m.onerror = e);
3698
3698
  });
3699
3699
  }
3700
- function _e(d, t, e) {
3701
- const s = d.data, i = d.width, n = d.height;
3702
- let r, a, o, c, h, l, p, u, y, L, m, g, b;
3703
- const S = i - 1, x = n - 1, T = t + 1, E = t + T, w = t + 1, z = t + w, v = 1 / (E * z), k = [], P = [], D = [], A = [], O = [], I = [];
3700
+ function ze(m, t, e) {
3701
+ const s = m.data, i = m.width, n = m.height;
3702
+ let r, a, o, h, c, l, p, u, g, M, d, y, b;
3703
+ const w = i - 1, L = n - 1, x = t + 1, S = t + x, T = t + 1, z = t + T, P = 1 / (S * z), I = [], v = [], D = [], F = [], R = [], k = [];
3704
3704
  for (; e-- > 0; ) {
3705
- for (b = g = 0, l = 0; l < n; l++) {
3706
- for (r = s[b] * T, a = s[b + 1] * T, o = s[b + 2] * T, c = s[b + 3] * T, p = 1; p <= t; p++)
3707
- u = b + ((p > S ? S : p) << 2), r += s[u++], a += s[u++], o += s[u++], c += s[u];
3708
- for (h = 0; h < i; h++)
3709
- k[g] = r, P[g] = a, D[g] = o, A[g] = c, l === 0 && (O[h] = Math.min(h + T, S) << 2, I[h] = Math.max(h - t, 0) << 2), y = b + O[h], L = b + I[h], r += s[y++] - s[L++], a += s[y++] - s[L++], o += s[y++] - s[L++], c += s[y] - s[L], g++;
3705
+ for (b = y = 0, l = 0; l < n; l++) {
3706
+ for (r = s[b] * x, a = s[b + 1] * x, o = s[b + 2] * x, h = s[b + 3] * x, p = 1; p <= t; p++)
3707
+ u = b + ((p > w ? w : p) << 2), r += s[u++], a += s[u++], o += s[u++], h += s[u];
3708
+ for (c = 0; c < i; c++)
3709
+ I[y] = r, v[y] = a, D[y] = o, F[y] = h, l === 0 && (R[c] = Math.min(c + x, w) << 2, k[c] = Math.max(c - t, 0) << 2), g = b + R[c], M = b + k[c], r += s[g++] - s[M++], a += s[g++] - s[M++], o += s[g++] - s[M++], h += s[g] - s[M], y++;
3710
3710
  b += i << 2;
3711
3711
  }
3712
- for (h = 0; h < i; h++) {
3713
- for (m = h, r = k[m] * w, a = P[m] * w, o = D[m] * w, c = A[m] * w, p = 1; p <= t; p++)
3714
- m += p > x ? 0 : i, r += k[m], a += P[m], o += D[m], c += A[m];
3715
- for (g = h << 2, l = 0; l < n; l++)
3716
- s[g] = r * v + 0.5 | 0, s[g + 1] = a * v + 0.5 | 0, s[g + 2] = o * v + 0.5 | 0, s[g + 3] = c * v + 0.5 | 0, h === 0 && (O[l] = Math.min(l + w, x) * i, I[l] = Math.max(l - t, 0) * i), y = h + O[l], L = h + I[l], r += k[y] - k[L], a += P[y] - P[L], o += D[y] - D[L], c += A[y] - A[L], g += i << 2;
3712
+ for (c = 0; c < i; c++) {
3713
+ for (d = c, r = I[d] * T, a = v[d] * T, o = D[d] * T, h = F[d] * T, p = 1; p <= t; p++)
3714
+ d += p > L ? 0 : i, r += I[d], a += v[d], o += D[d], h += F[d];
3715
+ for (y = c << 2, l = 0; l < n; l++)
3716
+ s[y] = r * P + 0.5 | 0, s[y + 1] = a * P + 0.5 | 0, s[y + 2] = o * P + 0.5 | 0, s[y + 3] = h * P + 0.5 | 0, c === 0 && (R[l] = Math.min(l + T, L) * i, k[l] = Math.max(l - t, 0) * i), g = c + R[l], M = c + k[l], r += I[g] - I[M], a += v[g] - v[M], o += D[g] - D[M], h += F[g] - F[M], y += i << 2;
3717
3717
  }
3718
3718
  }
3719
3719
  }
3720
- function Ae(d, t) {
3721
- const e = d.data;
3720
+ function Ie(m, t) {
3721
+ const e = m.data;
3722
3722
  for (let s = 0; s < e.length; s += 4) {
3723
3723
  const i = e[s], n = e[s + 1], r = e[s + 2], a = e[s + 3], o = i * 0.3 + n * 0.59 + r * 0.11;
3724
3724
  e[s] = o * (1 - t) + i * t, e[s + 1] = o * (1 - t) + n * t, e[s + 2] = o * (1 - t) + r * t, e[s + 3] = a;
3725
3725
  }
3726
3726
  }
3727
- function Re(d, t) {
3728
- const e = d.data;
3727
+ function ke(m, t) {
3728
+ const e = m.data;
3729
3729
  for (let s = 0; s < e.length; s += 4) {
3730
3730
  const i = e[s], n = e[s + 1], r = e[s + 2], a = e[s + 3];
3731
3731
  e[s] = i * t, e[s + 1] = n * t, e[s + 2] = r * t, e[s + 3] = a;
3732
3732
  }
3733
3733
  }
3734
- function Gt(d, t) {
3735
- const e = d.data;
3734
+ function Yt(m, t) {
3735
+ const e = m.data;
3736
3736
  for (let s = 0; s < e.length; s += 4) {
3737
3737
  const i = e[s], n = e[s + 1], r = e[s + 2], a = e[s + 3];
3738
3738
  e[s] = (i - 128) * t + 128, e[s + 1] = (n - 128) * t + 128, e[s + 2] = (r - 128) * t + 128, e[s + 3] = a;
3739
3739
  }
3740
3740
  }
3741
- const M = (d, t, e, s, i = 0, n = 0, r = 1, a = 1) => Object.freeze({ cx: d, cy: t, x: e, y: s, ur: i, vr: n, up: r, vp: a }), K = (d, t, e) => Object.freeze({ width: d, height: t, conf: e }), Xt = [
3741
+ const E = (m, t, e, s, i = 0, n = 0, r = 1, a = 1) => Object.freeze({ cx: m, cy: t, x: e, y: s, ur: i, vr: n, up: r, vp: a }), pt = (m, t, e) => Object.freeze({ width: m, height: t, conf: e }), jt = [
3742
3742
  // TODO: 竖屏推荐
3743
- K(5, 5, [
3744
- M(0, 0, -1, -1, 0, 0, 1, 1),
3745
- M(1, 0, -0.5, -1, 0, 0, 1, 1),
3746
- M(2, 0, 0, -1, 0, 0, 1, 1),
3747
- M(3, 0, 0.5, -1, 0, 0, 1, 1),
3748
- M(4, 0, 1, -1, 0, 0, 1, 1),
3749
- M(0, 1, -1, -0.5, 0, 0, 1, 1),
3750
- M(1, 1, -0.5, -0.5, 0, 0, 1, 1),
3751
- M(2, 1, -0.0052029684413368305, -0.6131420587090777, 0, 0, 1, 1),
3752
- M(3, 1, 0.5884227308309977, -0.3990805107556692, 0, 0, 1, 1),
3753
- M(4, 1, 1, -0.5, 0, 0, 1, 1),
3754
- M(0, 2, -1, 0, 0, 0, 1, 1),
3755
- M(1, 2, -0.4210024670505933, -0.11895058380429502, 0, 0, 1, 1),
3756
- M(2, 2, -0.1019613423315412, -0.023812118047224606, 0, -47, 0.629, 0.849),
3757
- M(3, 2, 0.40275125660925437, -0.06345314544600389, 0, 0, 1, 1),
3758
- M(4, 2, 1, 0, 0, 0, 1, 1),
3759
- M(0, 3, -1, 0.5, 0, 0, 1, 1),
3760
- M(1, 3, 0.06801958477287173, 0.5205913248960121, -31, -45, 1, 1),
3761
- M(2, 3, 0.21446469120128908, 0.29331610114301043, 6, -56, 0.566, 1.321),
3762
- M(3, 3, 0.5, 0.5, 0, 0, 1, 1),
3763
- M(4, 3, 1, 0.5, 0, 0, 1, 1),
3764
- M(0, 4, -1, 1, 0, 0, 1, 1),
3765
- M(1, 4, -0.31378372841550195, 1, 0, 0, 1, 1),
3766
- M(2, 4, 0.26153633255328046, 1, 0, 0, 1, 1),
3767
- M(3, 4, 0.5, 1, 0, 0, 1, 1),
3768
- M(4, 4, 1, 1, 0, 0, 1, 1)
3769
- ]),
3770
- K(6, 6, [
3771
- M(0, 0, -1, -1, 0, 0, 1, 1),
3772
- M(1, 0, -0.6, -1, 0, 0, 1, 1),
3773
- M(2, 0, -0.19999999999999996, -1, 0, 0, 1, 1),
3774
- M(3, 0, 0.19999999999999996, -1, 0, 0, 1, 1),
3775
- M(4, 0, 0.6000000000000001, -1, 0, 0, 1, 1),
3776
- M(5, 0, 1, -1, 0, 0, 1, 1),
3777
- M(0, 1, -1, -0.6, 0, 0, 1, 1),
3778
- M(1, 1, -0.6, -0.6, 0, 0, 1, 1),
3779
- M(2, 1, -0.10980661589020635, -0.4108069757237176, 0, 0, 1, 1),
3780
- M(3, 1, 0.37398525356081525, -0.437252891735175, 0, 0, 1, 1),
3781
- M(4, 1, 0.6000000000000001, -0.6, 0, 0, 1, 1),
3782
- M(5, 1, 1, -0.6, 0, 0, 1, 1),
3783
- M(0, 2, -1, -0.19999999999999996, 0, 0, 1, 1),
3784
- M(1, 2, -0.5125306585683541, -0.1780829148228924, 0, 0, 1, 1),
3785
- M(2, 2, -0.19999999999999996, -0.19999999999999996, 0, 0, 1, 1),
3786
- M(3, 2, 0.19999999999999996, -0.19999999999999996, 0, 0, 1, 1),
3787
- M(4, 2, 0.6485698281140977, -0.1939504644297667, 0, 0, 1, 1),
3788
- M(5, 2, 1, -0.19999999999999996, 0, 0, 1, 1),
3789
- M(0, 3, -1, 0.19999999999999996, 0, 0, 1, 1),
3790
- M(1, 3, -0.7321983182109801, 0.23447337495584342, 0, 0, 1, 1),
3791
- M(2, 3, -0.46545901721636285, 0.4619082526543773, 0, 0, 1, 1),
3792
- M(3, 3, -0.12549716300753677, 0.4275285618394826, -65, -36, 1.195, 2.296),
3793
- M(4, 3, 0.3582947064434847, -0.04320874316445944, 0, 0, 1, 1),
3794
- M(5, 3, 1, 0.19999999999999996, 0, 0, 1, 1),
3795
- M(0, 4, -1, 0.6000000000000001, 0, 0, 1, 1),
3796
- M(1, 4, -0.742658682955867, 0.6549634395380164, 0, 0, 1, 1),
3797
- M(2, 4, -0.3843911904434889, 0.7475241455781174, 0, 0, 0.535, 0.66),
3798
- M(3, 4, 0.07847994951775883, 0.7263674127689514, 0, 0, 1, 1),
3799
- M(4, 4, 0.6000000000000001, 0.6000000000000001, 0, 0, 1, 1),
3800
- M(5, 4, 1, 0.6000000000000001, 0, 0, 1, 1),
3801
- M(0, 5, -1, 1, 0, 0, 1, 1),
3802
- M(1, 5, -0.6, 1, 0, 0, 1, 1),
3803
- M(2, 5, -0.19999999999999996, 1, 0, 0, 1, 1),
3804
- M(3, 5, 0.19999999999999996, 1, 0, 0, 1, 1),
3805
- M(4, 5, 0.6000000000000001, 1, 0, 0, 1, 1),
3806
- M(5, 5, 1, 1, 0, 0, 1, 1)
3743
+ pt(5, 5, [
3744
+ E(0, 0, -1, -1, 0, 0, 1, 1),
3745
+ E(1, 0, -0.5, -1, 0, 0, 1, 1),
3746
+ E(2, 0, 0, -1, 0, 0, 1, 1),
3747
+ E(3, 0, 0.5, -1, 0, 0, 1, 1),
3748
+ E(4, 0, 1, -1, 0, 0, 1, 1),
3749
+ E(0, 1, -1, -0.5, 0, 0, 1, 1),
3750
+ E(1, 1, -0.5, -0.5, 0, 0, 1, 1),
3751
+ E(2, 1, -0.0052029684413368305, -0.6131420587090777, 0, 0, 1, 1),
3752
+ E(3, 1, 0.5884227308309977, -0.3990805107556692, 0, 0, 1, 1),
3753
+ E(4, 1, 1, -0.5, 0, 0, 1, 1),
3754
+ E(0, 2, -1, 0, 0, 0, 1, 1),
3755
+ E(1, 2, -0.4210024670505933, -0.11895058380429502, 0, 0, 1, 1),
3756
+ E(2, 2, -0.1019613423315412, -0.023812118047224606, 0, -47, 0.629, 0.849),
3757
+ E(3, 2, 0.40275125660925437, -0.06345314544600389, 0, 0, 1, 1),
3758
+ E(4, 2, 1, 0, 0, 0, 1, 1),
3759
+ E(0, 3, -1, 0.5, 0, 0, 1, 1),
3760
+ E(1, 3, 0.06801958477287173, 0.5205913248960121, -31, -45, 1, 1),
3761
+ E(2, 3, 0.21446469120128908, 0.29331610114301043, 6, -56, 0.566, 1.321),
3762
+ E(3, 3, 0.5, 0.5, 0, 0, 1, 1),
3763
+ E(4, 3, 1, 0.5, 0, 0, 1, 1),
3764
+ E(0, 4, -1, 1, 0, 0, 1, 1),
3765
+ E(1, 4, -0.31378372841550195, 1, 0, 0, 1, 1),
3766
+ E(2, 4, 0.26153633255328046, 1, 0, 0, 1, 1),
3767
+ E(3, 4, 0.5, 1, 0, 0, 1, 1),
3768
+ E(4, 4, 1, 1, 0, 0, 1, 1)
3807
3769
  ]),
3808
3770
  // TODO: 横屏推荐
3809
- K(4, 4, [
3810
- M(0, 0, -1, -1, 0, 0, 1, 1),
3811
- M(1, 0, -0.33333333333333337, -1, 0, 0, 1, 1),
3812
- M(2, 0, 0.33333333333333326, -1, 0, 0, 1, 1),
3813
- M(3, 0, 1, -1, 0, 0, 1, 1),
3814
- M(0, 1, -1, -0.04495399932657351, 0, 0, 1, 1),
3815
- M(1, 1, -0.24056117520129328, -0.22465999020104, 0, 0, 1, 1),
3816
- M(2, 1, 0.334758885767489, -0.00531297192779423, 0, 0, 1, 1),
3817
- M(3, 1, 0.9989920470678106, -0.3382976020775408, 8, 0, 0.566, 1.792),
3818
- M(0, 2, -1, 0.33333333333333326, 0, 0, 1, 1),
3819
- M(1, 2, -0.3425497314639411, -27501607956947893e-21, 0, 0, 1, 1),
3820
- M(2, 2, 0.3321437945812673, 0.1981776353859399, 0, 0, 1, 1),
3821
- M(3, 2, 1, 0.0766118180296832, 0, 0, 1, 1),
3822
- M(0, 3, -1, 1, 0, 0, 1, 1),
3823
- M(1, 3, -0.33333333333333337, 1, 0, 0, 1, 1),
3824
- M(2, 3, 0.33333333333333326, 1, 0, 0, 1, 1),
3825
- M(3, 3, 1, 1, 0, 0, 1, 1)
3771
+ pt(4, 4, [
3772
+ E(0, 0, -1, -1, 0, 0, 1, 1),
3773
+ E(1, 0, -0.33333333333333337, -1, 0, 0, 1, 1),
3774
+ E(2, 0, 0.33333333333333326, -1, 0, 0, 1, 1),
3775
+ E(3, 0, 1, -1, 0, 0, 1, 1),
3776
+ E(0, 1, -1, -0.04495399932657351, 0, 0, 1, 1),
3777
+ E(1, 1, -0.24056117520129328, -0.22465999020104, 0, 0, 1, 1),
3778
+ E(2, 1, 0.334758885767489, -0.00531297192779423, 0, 0, 1, 1),
3779
+ E(3, 1, 0.9989920470678106, -0.3382976020775408, 8, 0, 0.566, 1.792),
3780
+ E(0, 2, -1, 0.33333333333333326, 0, 0, 1, 1),
3781
+ E(1, 2, -0.3425497314639411, -27501607956947893e-21, 0, 0, 1, 1),
3782
+ E(2, 2, 0.3321437945812673, 0.1981776353859399, 0, 0, 1, 1),
3783
+ E(3, 2, 1, 0.0766118180296832, 0, 0, 1, 1),
3784
+ E(0, 3, -1, 1, 0, 0, 1, 1),
3785
+ E(1, 3, -0.33333333333333337, 1, 0, 0, 1, 1),
3786
+ E(2, 3, 0.33333333333333326, 1, 0, 0, 1, 1),
3787
+ E(3, 3, 1, 1, 0, 0, 1, 1)
3826
3788
  ]),
3827
- K(4, 4, [
3828
- M(0, 0, -1, -1, 0, 0, 1, 2.075),
3829
- M(1, 0, -0.33333333333333337, -1, 0, 0, 1, 1),
3830
- M(2, 0, 0.33333333333333326, -1, 0, 0, 1, 1),
3831
- M(3, 0, 1, -1, 0, 0, 1, 1),
3832
- M(0, 1, -1, -0.4545779491139603, 0, 0, 1, 1),
3833
- M(1, 1, -0.33333333333333337, -0.33333333333333337, 0, 0, 1, 1),
3834
- M(2, 1, 0.0889403142626457, -0.6025711180694033, -32, 45, 1, 1),
3835
- M(3, 1, 1, -0.33333333333333337, 0, 0, 1, 1),
3836
- M(0, 2, -1, -0.07402408608567845, 1, 0, 1, 0.094),
3837
- M(1, 2, -0.2719422694359541, 0.09775369930903222, 25, -18, 1.321, 0),
3838
- M(2, 2, 0.19877414408395877, 0.4307383294587789, 48, -40, 0.755, 0.975),
3839
- M(3, 2, 1, 0.33333333333333326, -37, 0, 1, 1),
3840
- M(0, 3, -1, 1, 0, 0, 1, 1),
3841
- M(1, 3, -0.33333333333333337, 1, 0, 0, 1, 1),
3842
- M(2, 3, 0.5125850864305672, 1, -20, -18, 0, 1.604),
3843
- M(3, 3, 1, 1, 0, 0, 1, 1)
3789
+ pt(4, 4, [
3790
+ E(0, 0, -1, -1, 0, 0, 1, 2.075),
3791
+ E(1, 0, -0.33333333333333337, -1, 0, 0, 1, 1),
3792
+ E(2, 0, 0.33333333333333326, -1, 0, 0, 1, 1),
3793
+ E(3, 0, 1, -1, 0, 0, 1, 1),
3794
+ E(0, 1, -1, -0.4545779491139603, 0, 0, 1, 1),
3795
+ E(1, 1, -0.33333333333333337, -0.33333333333333337, 0, 0, 1, 1),
3796
+ E(2, 1, 0.0889403142626457, -0.6025711180694033, -32, 45, 1, 1),
3797
+ E(3, 1, 1, -0.33333333333333337, 0, 0, 1, 1),
3798
+ E(0, 2, -1, -0.07402408608567845, 1, 0, 1, 0.094),
3799
+ E(1, 2, -0.2719422694359541, 0.09775369930903222, 25, -18, 1.321, 0),
3800
+ E(2, 2, 0.19877414408395877, 0.4307383294587789, 48, -40, 0.755, 0.975),
3801
+ E(3, 2, 1, 0.33333333333333326, -37, 0, 1, 1),
3802
+ E(0, 3, -1, 1, 0, 0, 1, 1),
3803
+ E(1, 3, -0.33333333333333337, 1, 0, 0, 1, 1),
3804
+ E(2, 3, 0.5125850864305672, 1, -20, -18, 0, 1.604),
3805
+ E(3, 3, 1, 1, 0, 0, 1, 1)
3844
3806
  ]),
3845
- K(4, 4, [
3846
- M(0, 0, -1, -1, 0, 0, 1, 1),
3847
- M(1, 0, -0.04704442742088466, -1, 0, 14, 2.013, 3.522),
3848
- M(2, 0, 0.5910378220172194, -1, 0, 0, 1, 1),
3849
- M(3, 0, 1, -1, 0, 0, 1, 1),
3850
- M(0, 1, -1, -0.33333333333333337, 0, 0, 1, 1),
3851
- M(1, 1, -0.13072734537998032, -0.20616084408160962, 0, 0, 1, 1),
3852
- M(2, 1, 0.5178152688030109, -0.45722068427387885, 0, 0, 1, 1),
3853
- M(3, 1, 1, -0.5021471819924956, 0, 0, 1, 1),
3854
- M(0, 2, -1, 0.33333333333333326, 0, 0, 1, 1),
3855
- M(1, 2, -0.4210024670505933, 0.2563178089041497, 0, 0, 1, 1),
3856
- M(2, 2, 0.11247613493864139, -0.050239469646410795, 4, -2, 0.849, 1.132),
3857
- M(3, 2, 1, -0.08195229156543427, 0, 0, 1, 1),
3858
- M(0, 3, -1, 1, 0, 0, 1, 1),
3859
- M(1, 3, -0.33333333333333337, 1, 0, 0, 1, 1),
3860
- M(2, 3, 0.33333333333333326, 1, 0, 0, 1, 1),
3861
- M(3, 3, 1, 1, 0, 0, 1, 1)
3862
- ]),
3863
- K(5, 5, [
3864
- M(0, 0, -1, -1, 0, 0, 1, 1),
3865
- M(1, 0, -0.632824853134554, -1, 0, -31, 1.101, 1.038),
3866
- M(2, 0, -0.1019613423315412, -1, 0, 0, 1, 1),
3867
- M(3, 0, 0.7348678372594151, -1, 0, 39, 0.66, 2.421),
3868
- M(4, 0, 1, -1, 0, 0, 1, 1),
3869
- M(0, 1, -1, -0.5, 0, 0, 1, 1),
3870
- M(1, 1, -0.7165077710936496, -0.5100753874722515, 0, 0, 0.629, 1),
3871
- M(2, 1, -0.5491419351754585, -0.4149369217151808, 16, 25, 1, 1.478),
3872
- M(3, 1, 0.5021247216856803, -0.5523591500309495, 0, 44, 0.629, 1.509),
3873
- M(4, 1, 1, -0.5, 0, 0, 1, 1),
3874
- M(0, 2, -1, 0, 0, 0, 1, 1),
3875
- M(1, 2, -0.6851266768589888, -0.013241177407550042, 0, 0, 1, 1),
3876
- M(2, 2, -0.36347046095371505, -0.09252323220510883, -23, -31, 1, 1),
3877
- M(3, 2, 0.08371013189020227, -0.11630784864437649, 0, 0, 0.409, 1),
3878
- M(4, 2, 1, -0.002670236767875478, 0, 0, 1, 1),
3879
- M(0, 3, -1, 0.5, 0, 0, 1, 1),
3880
- M(1, 3, -0.3294742755328324, 0.6844409048109668, -3, 19, 1.415, 1),
3881
- M(2, 3, 0.028793216979545733, 0.36202721530089466, 6, 0, 1.541, 0.472),
3882
- M(3, 3, 0.5230454511754543, 0.2801024253434172, 10, -42, 0, 1.352),
3883
- M(4, 3, 1, 0.5, -3, 0, 1.981, 2.17),
3884
- M(0, 4, -1, 1, 0, 0, 1, 1),
3885
- M(1, 4, -0.48114956433369327, 1, 0, 53, 0, 1.509),
3886
- M(2, 4, 0, 1, 0, 0, 1, 1),
3887
- M(3, 4, 0.6093434603207717, 1, 0, 0, 0.629, 1),
3888
- M(4, 4, 1, 1, 0, 0, 1, 1)
3807
+ pt(5, 5, [
3808
+ E(0, 0, -1, -1, 0, 0, 1, 1),
3809
+ E(1, 0, -0.4501953125, -1, 0, 55, 1, 2.075),
3810
+ E(2, 0, 0.1953125, -1, 0, 0, 1, 1),
3811
+ E(3, 0, 0.4580078125, -1, 0, -25, 1, 1),
3812
+ E(4, 0, 1, -1, 0, 0, 1, 1),
3813
+ E(0, 1, -1, -0.2514475377525607, -16, 0, 2.327, 0.943),
3814
+ E(1, 1, -0.55859375, -0.6609325945787148, 47, 0, 2.358, 0.377),
3815
+ E(2, 1, 0.232421875, -0.5244375756366635, -66, -25, 1.855, 1.164),
3816
+ E(3, 1, 0.685546875, -0.3753706470552125, 0, 0, 1, 1),
3817
+ E(4, 1, 1, -0.6699125300354287, 0, 0, 1, 1),
3818
+ E(0, 2, -1, 0.035910396862284255, 0, 0, 1, 1),
3819
+ E(1, 2, -0.4921875, 0.005378616309457018, 90, 23, 1, 1.981),
3820
+ E(2, 2, 0.021484375, -0.1365043639066228, 0, 42, 1, 1),
3821
+ E(3, 2, 0.4765625, 0.05925822904974043, -30, 0, 1.95, 0.44),
3822
+ E(4, 2, 1, 0.251428847823418, 0, 0, 1, 1),
3823
+ E(0, 3, -1, 0.6968336464764276, -68, 0, 1, 0.786),
3824
+ E(1, 3, -0.6904296875, 0.5890744209958608, -68, 0, 1, 1),
3825
+ E(2, 3, 0.1845703125, 0.3879238667654693, 61, 0, 1, 1),
3826
+ E(3, 3, 0.60546875, 0.4633553246018661, -47, -59, 0.849, 1.73),
3827
+ E(4, 3, 1, 0.6214021886400309, -33, 0, 0.377, 1.604),
3828
+ E(0, 4, -1, 1, 0, 0, 1, 1),
3829
+ E(1, 4, -0.5, 1, 0, -73, 1, 1),
3830
+ E(2, 4, -0.3271484375, 1, 0, -24, 0.314, 2.704),
3831
+ E(3, 4, 0.5, 1, 0, 0, 1, 1),
3832
+ E(4, 4, 1, 1, 0, 0, 1, 1)
3889
3833
  ])
3890
- ], Ce = `precision highp float;
3891
-
3892
- varying vec3 v_color;
3893
- varying vec2 v_uv;
3894
- uniform sampler2D u_texture;
3895
- uniform float u_time;
3896
- uniform float u_volume;
3897
- uniform float u_alpha;
3898
-
3899
- /* Gradient noise from Jorge Jimenez's presentation: */
3900
- /* http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare */
3901
- float gradientNoise(in vec2 uv) {
3902
- return fract(52.9829189 * fract(dot(uv, vec2(0.06711056, 0.00583715))));
3834
+ ], j = (m, t) => Math.random() * (t - m) + m;
3835
+ function De(m, t, e) {
3836
+ return Math.min(Math.max(m, t), e);
3837
+ }
3838
+ function Fe(m, t, e) {
3839
+ const s = De((e - m) / (t - m), 0, 1);
3840
+ return s * s * (3 - 2 * s);
3841
+ }
3842
+ function Ae(m, t, e, s = 2, i = 0.5, n = 0.1) {
3843
+ let r = [], a = i;
3844
+ for (let c = 0; c < e; c++) {
3845
+ r[c] = [];
3846
+ for (let l = 0; l < t; l++)
3847
+ r[c][l] = m[c * t + l];
3848
+ }
3849
+ const o = [
3850
+ [1, 2, 1],
3851
+ [2, 4, 2],
3852
+ [1, 2, 1]
3853
+ ], h = 16;
3854
+ for (let c = 0; c < s; c++) {
3855
+ const l = [];
3856
+ for (let p = 0; p < e; p++) {
3857
+ l[p] = [];
3858
+ for (let u = 0; u < t; u++) {
3859
+ if (u === 0 || u === t - 1 || p === 0 || p === e - 1) {
3860
+ l[p][u] = r[p][u];
3861
+ continue;
3862
+ }
3863
+ let g = 0, M = 0, d = 0, y = 0, b = 0, w = 0;
3864
+ for (let V = -1; V <= 1; V++)
3865
+ for (let G = -1; G <= 1; G++) {
3866
+ const J = o[V + 1][G + 1], Q = r[p + V][u + G];
3867
+ g += Q.x * J, M += Q.y * J, d += Q.ur * J, y += Q.vr * J, b += Q.up * J, w += Q.vp * J;
3868
+ }
3869
+ const L = g / h, x = M / h, S = d / h, T = y / h, z = b / h, P = w / h, I = r[p][u], v = I.x * (1 - a) + L * a, D = I.y * (1 - a) + x * a, F = I.ur * (1 - a) + S * a, R = I.vr * (1 - a) + T * a, k = I.up * (1 - a) + z * a, $ = I.vp * (1 - a) + P * a;
3870
+ l[p][u] = E(u, p, v, D, F, R, k, $);
3871
+ }
3872
+ }
3873
+ r = l, a = Math.min(1, Math.max(a + n, 0));
3874
+ }
3875
+ for (let c = 0; c < e; c++)
3876
+ for (let l = 0; l < t; l++)
3877
+ m[c * t + l] = r[c][l];
3878
+ }
3879
+ function Mt(m, t) {
3880
+ return _e(Math.sin(m * 12.9898 + t * 78.233) * 43758.5453);
3903
3881
  }
3904
-
3905
- vec2 rot(vec2 v, float a) {
3906
- float s = sin(a);
3907
- float c = cos(a);
3908
- mat2 m = mat2(c, s, -s, c);
3909
- return m * v;
3882
+ function _e(m) {
3883
+ return m - Math.floor(m);
3910
3884
  }
3911
-
3912
- void main() {
3913
- float dither = (1.0 / 255.0) * gradientNoise(gl_FragCoord.xy) - (0.5 / 255.0);
3914
- vec4 result = texture2D(u_texture, rot(v_uv * max(1.0, 1.0 + u_volume), u_time + u_volume));
3915
- result *= vec4(v_color, u_alpha);
3916
- result *= vec4(1.0 - u_volume * 0.1);
3917
- result += vec4(dither);
3918
- gl_FragColor = result;
3885
+ function Re(m, t) {
3886
+ const e = Math.floor(m), s = Math.floor(t), i = e + 1, n = s + 1, r = m - e, a = t - s, o = r * r * (3 - 2 * r), h = a * a * (3 - 2 * a), c = Mt(e, s), l = Mt(i, s), p = Mt(e, n), u = Mt(i, n), g = c * (1 - o) + l * o, M = p * (1 - o) + u * o;
3887
+ return g * (1 - h) + M * h;
3919
3888
  }
3920
- `, Oe = `precision highp float;
3921
-
3922
- attribute vec2 a_pos;
3923
- attribute vec3 a_color;
3924
- attribute vec2 a_uv;
3925
- varying vec3 v_color;
3926
- varying vec2 v_uv;
3927
-
3928
- uniform float u_aspect;
3929
-
3930
- void main() {
3931
- v_color = a_color;
3932
- v_uv = a_uv;
3933
- vec2 pos = a_pos;
3934
- if (u_aspect > 1.0) {
3935
- pos.y *= u_aspect;
3936
- } else {
3937
- pos.x /= u_aspect;
3889
+ function Ce(m, t, e, s = 1e-3) {
3890
+ const i = m(t + s, e), n = m(t - s, e), r = m(t, e + s), a = m(t, e - s), o = (i - n) / (2 * s), h = (r - a) / (2 * s), c = Math.sqrt(o * o + h * h) || 1;
3891
+ return [o / c, h / c];
3892
+ }
3893
+ function Oe(m, t, e = j(0.4, 0.6), s = j(0.3, 0.6), i = 0.8, n = Math.floor(j(3, 5)), r = j(0.2, 0.3), a = j(-0.1, -0.05)) {
3894
+ const o = m, h = t, c = [], l = 2 / (o - 1), p = 2 / (h - 1);
3895
+ for (let u = 0; u < h; u++)
3896
+ for (let g = 0; g < o; g++) {
3897
+ const M = g / (o - 1) * 2 - 1, d = u / (h - 1) * 2 - 1, y = g === 0 || g === o - 1 || u === 0 || u === h - 1, b = y ? 0 : j(-e * l, e * l), w = y ? 0 : j(-e * p, e * p);
3898
+ let L = M + b, x = d + w;
3899
+ const S = y ? 0 : j(-60, 60), T = y ? 0 : j(-60, 60), z = y ? 1 : j(0.8, 1.2), P = y ? 1 : j(0.8, 1.2);
3900
+ if (!y) {
3901
+ const I = (M + 1) / 2, v = (d + 1) / 2, [D, F] = Ce(Re, I, v, 1e-3);
3902
+ let R = D * s, k = F * s;
3903
+ const $ = Math.min(I, 1 - I, v, 1 - v), V = Fe(0, 1, $);
3904
+ R *= V, k *= V, L = L * (1 - i) + (L + R) * i, x = x * (1 - i) + (x + k) * i;
3905
+ }
3906
+ c.push(E(g, u, L, x, S, T, z, P));
3938
3907
  }
3939
- gl_Position = vec4(pos, 0.0, 1.0);
3908
+ return Ae(c, o, h, n, r, a), pt(o, h, c);
3940
3909
  }
3910
+ const Ne = `precision highp float;\r
3911
+ \r
3912
+ varying vec3 v_color;\r
3913
+ varying vec2 v_uv;\r
3914
+ uniform sampler2D u_texture;\r
3915
+ uniform float u_time;\r
3916
+ uniform float u_volume;\r
3917
+ uniform float u_alpha;\r
3918
+ \r
3919
+ /* Gradient noise from Jorge Jimenez's presentation: */\r
3920
+ /* http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare */\r
3921
+ float gradientNoise(in vec2 uv) {\r
3922
+ return fract(52.9829189 * fract(dot(uv, vec2(0.06711056, 0.00583715))));\r
3923
+ }\r
3924
+ \r
3925
+ vec2 rot(vec2 v, float a) {\r
3926
+ float s = sin(a);\r
3927
+ float c = cos(a);\r
3928
+ mat2 m = mat2(c, s, -s, c);\r
3929
+ return m * v;\r
3930
+ }\r
3931
+ \r
3932
+ void main() {\r
3933
+ float dither = (1.0 / 255.0) * gradientNoise(gl_FragCoord.xy) - (0.5 / 255.0);\r
3934
+ vec2 centeredUV = v_uv - vec2(0.2);\r
3935
+ vec2 rotatedUV = rot(centeredUV, (u_time + u_volume) * 2.0);\r
3936
+ vec2 finalUV = rotatedUV * max(0.001, 1.0 - u_volume * 2.0) + vec2(0.5);\r
3937
+ vec4 result = texture2D(u_texture, finalUV);\r
3938
+ result *= vec4(v_color, u_alpha);\r
3939
+ result *= vec4(max(0.5, 1.0 - u_volume / 2.0));\r
3940
+ result += vec4(dither);\r
3941
+ gl_FragColor = result;\r
3942
+ }`, We = `precision highp float;\r
3943
+ \r
3944
+ attribute vec2 a_pos;\r
3945
+ attribute vec3 a_color;\r
3946
+ attribute vec2 a_uv;\r
3947
+ varying vec3 v_color;\r
3948
+ varying vec2 v_uv;\r
3949
+ \r
3950
+ uniform float u_aspect;\r
3951
+ \r
3952
+ void main() {\r
3953
+ v_color = a_color;\r
3954
+ v_uv = a_uv;\r
3955
+ vec2 pos = a_pos;\r
3956
+ if (u_aspect > 1.0) {\r
3957
+ pos.y *= u_aspect;\r
3958
+ } else {\r
3959
+ pos.x /= u_aspect;\r
3960
+ }\r
3961
+ gl_Position = vec4(pos, 0.0, 1.0);\r
3962
+ }\r
3941
3963
  `;
3942
- class We {
3964
+ class Be {
3943
3965
  constructor(t, e, s, i = "unknown") {
3944
3966
  f(this, "gl");
3945
3967
  f(this, "program");
@@ -3955,8 +3977,8 @@ class We {
3955
3977
  for (let a = 0; a < n; a++) {
3956
3978
  const o = t.getActiveAttrib(this.program, a);
3957
3979
  if (!o) continue;
3958
- const c = t.getAttribLocation(this.program, o.name);
3959
- c !== -1 && (r[o.name] = c);
3980
+ const h = t.getAttribLocation(this.program, o.name);
3981
+ h !== -1 && (r[o.name] = h);
3960
3982
  }
3961
3983
  this.attrs = r;
3962
3984
  }
@@ -4003,7 +4025,7 @@ class We {
4003
4025
  t.deleteShader(this.vertexShader), t.deleteShader(this.fragmentShader), t.deleteProgram(this.program);
4004
4026
  }
4005
4027
  }
4006
- class Ne {
4028
+ class qe {
4007
4029
  constructor(t, e, s, i) {
4008
4030
  f(this, "vertexWidth", 0);
4009
4031
  f(this, "vertexHeight", 0);
@@ -4069,8 +4091,8 @@ class Ne {
4069
4091
  this.vertexData = s, this.indexData = i;
4070
4092
  for (let r = 0; r < e; r++)
4071
4093
  for (let a = 0; a < t; a++) {
4072
- const o = a / (t - 1) * 2 - 1, c = r / (e - 1) * 2 - 1;
4073
- this.setVertexPos(a, r, o || 0, c || 0), this.setVertexColor(a, r, 1, 1, 1), this.setVertexUV(a, r, a / (t - 1), r / (e - 1));
4094
+ const o = a / (t - 1) * 2 - 1, h = r / (e - 1) * 2 - 1;
4095
+ this.setVertexPos(a, r, o || 0, h || 0), this.setVertexColor(a, r, 1, 1, 1), this.setVertexUV(a, r, a / (t - 1), r / (e - 1));
4074
4096
  }
4075
4097
  for (let r = 0; r < e - 1; r++)
4076
4098
  for (let a = 0; a < t - 1; a++)
@@ -4096,12 +4118,12 @@ class Ne {
4096
4118
  this.gl.deleteBuffer(this.vertexBuffer), this.gl.deleteBuffer(this.indexBuffer);
4097
4119
  }
4098
4120
  }
4099
- class Be {
4121
+ class $e {
4100
4122
  constructor() {
4101
- f(this, "color", W.fromValues(1, 1, 1));
4102
- f(this, "location", R.fromValues(0, 0));
4103
- f(this, "uTangent", R.fromValues(0, 0));
4104
- f(this, "vTangent", R.fromValues(0, 0));
4123
+ f(this, "color", O.fromValues(1, 1, 1));
4124
+ f(this, "location", C.fromValues(0, 0));
4125
+ f(this, "uTangent", C.fromValues(0, 0));
4126
+ f(this, "vTangent", C.fromValues(0, 0));
4105
4127
  f(this, "_uRot", 0);
4106
4128
  f(this, "_vRot", 0);
4107
4129
  f(this, "_uScale", 1);
@@ -4139,27 +4161,27 @@ class Be {
4139
4161
  this.vTangent[0] = -Math.sin(this._vRot) * this._vScale, this.vTangent[1] = Math.cos(this._vRot) * this._vScale;
4140
4162
  }
4141
4163
  }
4142
- const ct = _.fromValues(2, -2, 1, 1, -3, 3, -2, -1, 0, 0, 1, 0, 1, 0, 0, 0), pt = _.clone(ct).transpose(), Z = F.create(), gt = F.create(), tt = F.create(), et = _.create(), st = _.create();
4143
- function $e(d, t, e, s, i = R.create()) {
4144
- Z[0] = d ** 3, Z[1] = d ** 2, Z[2] = d, Z[3] = 1, gt.copy(Z), tt[0] = t ** 3, tt[1] = t ** 2, tt[2] = t, tt[3] = 1, et.copy(e).transpose(), _.mul(et, et, ct), _.mul(et, pt, et), F.transformMat4(Z, Z, et);
4145
- const n = tt.dot(Z);
4146
- st.copy(s).transpose(), _.mul(st, st, ct), _.mul(st, pt, st), F.transformMat4(gt, gt, st);
4147
- const r = tt.dot(gt);
4164
+ const dt = _.fromValues(2, -2, 1, 1, -3, 3, -2, -1, 0, 0, 1, 0, 1, 0, 0, 0), ft = _.clone(dt).transpose(), et = A.create(), Lt = A.create(), nt = A.create(), rt = _.create(), at = _.create();
4165
+ function Ve(m, t, e, s, i = C.create()) {
4166
+ et[0] = m ** 3, et[1] = m ** 2, et[2] = m, et[3] = 1, Lt.copy(et), nt[0] = t ** 3, nt[1] = t ** 2, nt[2] = t, nt[3] = 1, rt.copy(e).transpose(), _.mul(rt, rt, dt), _.mul(rt, ft, rt), A.transformMat4(et, et, rt);
4167
+ const n = nt.dot(et);
4168
+ at.copy(s).transpose(), _.mul(at, at, dt), _.mul(at, ft, at), A.transformMat4(Lt, Lt, at);
4169
+ const r = nt.dot(Lt);
4148
4170
  return i.x = n, i.y = r, i;
4149
4171
  }
4150
- function Zt(d, t, e, s, i, n = _.create()) {
4151
- const r = (c) => c.location[i], a = (c) => c.uTangent[i], o = (c) => c.vTangent[i];
4152
- return n[0] = r(d), n[1] = r(t), n[2] = o(d), n[3] = o(t), n[4] = r(e), n[5] = r(s), n[6] = o(e), n[7] = o(s), n[8] = a(d), n[9] = a(t), n[10] = 0, n[11] = 0, n[12] = a(e), n[13] = a(s), n[14] = 0, n[15] = 0, n;
4172
+ function Gt(m, t, e, s, i, n = _.create()) {
4173
+ const r = (h) => h.location[i], a = (h) => h.uTangent[i], o = (h) => h.vTangent[i];
4174
+ return n[0] = r(m), n[1] = r(t), n[2] = o(m), n[3] = o(t), n[4] = r(e), n[5] = r(s), n[6] = o(e), n[7] = o(s), n[8] = a(m), n[9] = a(t), n[10] = 0, n[11] = 0, n[12] = a(e), n[13] = a(s), n[14] = 0, n[15] = 0, n;
4153
4175
  }
4154
- function Ft(d, t, e, s, i, n = _.create()) {
4176
+ function Dt(m, t, e, s, i, n = _.create()) {
4155
4177
  const r = (a) => a.color[i];
4156
- return n.fill(0), n[0] = r(d), n[1] = r(t), n[4] = r(e), n[5] = r(s), n;
4178
+ return n.fill(0), n[0] = r(m), n[1] = r(t), n[4] = r(e), n[5] = r(s), n;
4157
4179
  }
4158
- const G = F.create(), Lt = F.create(), Mt = F.create(), J = F.create(), it = _.create(), nt = _.create(), rt = _.create(), bt = W.create();
4159
- function qe(d, t, e, s, i) {
4160
- return G[0] = d ** 3, G[1] = d ** 2, G[2] = d, G[3] = 1, Lt.copy(G), Mt.copy(G), J[0] = t ** 3, J[1] = t ** 2, J[2] = t, J[3] = 1, it.copy(e).transpose(), _.mul(it, it, ct), _.mul(it, pt, it), F.transformMat4(G, G, it), bt.r = J.dot(G), nt.copy(s).transpose(), _.mul(nt, nt, ct), _.mul(nt, pt, nt), F.transformMat4(Lt, Lt, nt), bt.g = J.dot(Lt), rt.copy(i).transpose(), _.mul(rt, rt, ct), _.mul(rt, pt, rt), F.transformMat4(Mt, Mt, rt), bt.b = J.dot(Mt), bt;
4180
+ const K = A.create(), bt = A.create(), xt = A.create(), st = A.create(), ot = _.create(), ct = _.create(), ht = _.create(), Tt = O.create();
4181
+ function He(m, t, e, s, i) {
4182
+ return K[0] = m ** 3, K[1] = m ** 2, K[2] = m, K[3] = 1, bt.copy(K), xt.copy(K), st[0] = t ** 3, st[1] = t ** 2, st[2] = t, st[3] = 1, ot.copy(e).transpose(), _.mul(ot, ot, dt), _.mul(ot, ft, ot), A.transformMat4(K, K, ot), Tt.r = st.dot(K), ct.copy(s).transpose(), _.mul(ct, ct, dt), _.mul(ct, ft, ct), A.transformMat4(bt, bt, ct), Tt.g = st.dot(bt), ht.copy(i).transpose(), _.mul(ht, ht, dt), _.mul(ht, ft, ht), A.transformMat4(xt, xt, ht), Tt.b = st.dot(xt), Tt;
4161
4183
  }
4162
- class He {
4184
+ class Ue {
4163
4185
  constructor(t, e) {
4164
4186
  f(this, "_width", 0);
4165
4187
  f(this, "_height", 0);
@@ -4182,20 +4204,20 @@ class He {
4182
4204
  return this._height;
4183
4205
  }
4184
4206
  }
4185
- class je extends Ne {
4207
+ class Ye extends qe {
4186
4208
  constructor(e, s, i, n) {
4187
4209
  super(e, s, i, n);
4188
4210
  /**
4189
4211
  * 细分级别,越大曲线越平滑,但是性能消耗也越大
4190
4212
  */
4191
4213
  f(this, "_subDivisions", 10);
4192
- f(this, "_controlPoints", new He(3, 3));
4214
+ f(this, "_controlPoints", new Ue(3, 3));
4193
4215
  f(this, "uMX", _.create());
4194
4216
  f(this, "uMY", _.create());
4195
4217
  f(this, "uMR", _.create());
4196
4218
  f(this, "uMG", _.create());
4197
4219
  f(this, "uMB", _.create());
4198
- f(this, "tmpV2", R.create());
4220
+ f(this, "tmpV2", C.create());
4199
4221
  this.resizeControlPoints(3, 3), Object.seal(this);
4200
4222
  }
4201
4223
  setWireFrame(e) {
@@ -4223,7 +4245,7 @@ class je extends Ne {
4223
4245
  this._controlPoints.resize(e, s);
4224
4246
  for (let i = 0; i < s; i++)
4225
4247
  for (let n = 0; n < e; n++) {
4226
- const r = new Be();
4248
+ const r = new $e();
4227
4249
  r.location.x = n / (e - 1) * 2 - 1, r.location.y = i / (s - 1) * 2 - 1, r.uTangent.x = 2 / (e - 1), r.vTangent.y = 2 / (s - 1), this._controlPoints.set(n, i, r);
4228
4250
  }
4229
4251
  this.resetSubdivition(this._subDivisions);
@@ -4247,31 +4269,31 @@ class je extends Ne {
4247
4269
  const e = this._subDivisions - 1, s = e * (this._controlPoints.height - 1), i = e * (this._controlPoints.width - 1);
4248
4270
  for (let n = 0; n < this._controlPoints.width - 1; n++)
4249
4271
  for (let r = 0; r < this._controlPoints.height - 1; r++) {
4250
- const a = this._controlPoints.get(n, r), o = this._controlPoints.get(n, r + 1), c = this._controlPoints.get(n + 1, r), h = this._controlPoints.get(n + 1, r + 1), l = Zt(a, o, c, h, "x", this.uMX), p = Zt(a, o, c, h, "y", this.uMY), u = Ft(a, o, c, h, "r", this.uMR), y = Ft(a, o, c, h, "g", this.uMG), L = Ft(a, o, c, h, "b", this.uMB), m = n / (this._controlPoints.width - 1), g = r / (this._controlPoints.height - 1);
4272
+ const a = this._controlPoints.get(n, r), o = this._controlPoints.get(n, r + 1), h = this._controlPoints.get(n + 1, r), c = this._controlPoints.get(n + 1, r + 1), l = Gt(a, o, h, c, "x", this.uMX), p = Gt(a, o, h, c, "y", this.uMY), u = Dt(a, o, h, c, "r", this.uMR), g = Dt(a, o, h, c, "g", this.uMG), M = Dt(a, o, h, c, "b", this.uMB), d = n / (this._controlPoints.width - 1), y = r / (this._controlPoints.height - 1);
4251
4273
  for (let b = 0; b < this._subDivisions; b++)
4252
- for (let S = 0; S < this._subDivisions; S++) {
4253
- const x = r * this._subDivisions + b, T = n * this._subDivisions + S, [E, w] = $e(
4274
+ for (let w = 0; w < this._subDivisions; w++) {
4275
+ const L = r * this._subDivisions + b, x = n * this._subDivisions + w, [S, T] = Ve(
4254
4276
  b / e,
4255
- S / e,
4277
+ w / e,
4256
4278
  l,
4257
4279
  p,
4258
4280
  this.tmpV2
4259
4281
  );
4260
- this.setVertexPos(x, T, E, w), this.setVertexUV(x, T, m + S / i, 1 - g - b / s);
4261
- const [z, v, k] = qe(
4282
+ this.setVertexPos(L, x, S, T), this.setVertexUV(L, x, d + w / i, 1 - y - b / s);
4283
+ const [z, P, I] = He(
4262
4284
  b / e,
4263
- S / e,
4285
+ w / e,
4264
4286
  u,
4265
- y,
4266
- L
4287
+ g,
4288
+ M
4267
4289
  );
4268
- this.setVertexColor(x, T, z, v, k);
4290
+ this.setVertexColor(L, x, z, P, I);
4269
4291
  }
4270
4292
  }
4271
4293
  this.update();
4272
4294
  }
4273
4295
  }
4274
- class Jt {
4296
+ class Xt {
4275
4297
  constructor(t, e) {
4276
4298
  f(this, "tex");
4277
4299
  this.gl = t;
@@ -4293,17 +4315,18 @@ class Jt {
4293
4315
  this.gl.deleteTexture(this.tex);
4294
4316
  }
4295
4317
  }
4296
- function Ye(d, t) {
4297
- if ("OffscreenCanvas" in window) return new OffscreenCanvas(d, t);
4318
+ function je(m, t) {
4319
+ if ("OffscreenCanvas" in window) return new OffscreenCanvas(m, t);
4298
4320
  const e = document.createElement("canvas");
4299
- return e.width = d, e.height = t, e;
4321
+ return e.width = m, e.height = t, e;
4300
4322
  }
4301
- class Li extends re {
4323
+ class hi extends re {
4302
4324
  constructor(e) {
4303
4325
  super(e);
4304
4326
  f(this, "gl");
4305
4327
  f(this, "lastFrameTime", 0);
4306
4328
  f(this, "frameTime", 0);
4329
+ f(this, "currentImageData");
4307
4330
  f(this, "lastTickTime", 0);
4308
4331
  f(this, "volume", 0);
4309
4332
  f(this, "tickHandle", 0);
@@ -4312,22 +4335,23 @@ class Li extends re {
4312
4335
  f(this, "staticMode", !1);
4313
4336
  f(this, "mainProgram");
4314
4337
  f(this, "manualControl", !1);
4315
- f(this, "reduceImageSizeCanvas", Ye(
4338
+ f(this, "reduceImageSizeCanvas", je(
4316
4339
  32,
4317
4340
  32
4318
4341
  ));
4319
- f(this, "targetSize", R.fromValues(0, 0));
4320
- f(this, "currentSize", R.fromValues(0, 0));
4342
+ f(this, "targetSize", C.fromValues(0, 0));
4343
+ f(this, "currentSize", C.fromValues(0, 0));
4344
+ f(this, "isNoCover", !0);
4321
4345
  f(this, "meshStates", []);
4322
4346
  f(this, "_disposed", !1);
4323
4347
  f(this, "onTickBinded", this.onTick.bind(this));
4324
4348
  f(this, "supportTextureFloat", !0);
4325
4349
  const s = e.getContext("webgl");
4326
4350
  if (!s) throw new Error("WebGL not supported");
4327
- s.getExtension("EXT_color_buffer_float") || console.warn("EXT_color_buffer_float not supported"), s.getExtension("EXT_float_blend") || (console.warn("EXT_float_blend not supported"), this.supportTextureFloat = !1), s.getExtension("OES_texture_float_linear") || console.warn("OES_texture_float_linear not supported"), s.getExtension("OES_texture_float") || (this.supportTextureFloat = !1, console.warn("OES_texture_float not supported")), this.gl = s, s.enable(s.BLEND), s.enable(s.DEPTH_TEST), s.depthFunc(s.ALWAYS), this.mainProgram = new We(
4351
+ s.getExtension("EXT_color_buffer_float") || console.warn("EXT_color_buffer_float not supported"), s.getExtension("EXT_float_blend") || (console.warn("EXT_float_blend not supported"), this.supportTextureFloat = !1), s.getExtension("OES_texture_float_linear") || console.warn("OES_texture_float_linear not supported"), s.getExtension("OES_texture_float") || (this.supportTextureFloat = !1, console.warn("OES_texture_float not supported")), this.gl = s, s.enable(s.BLEND), s.enable(s.DEPTH_TEST), s.depthFunc(s.ALWAYS), this.mainProgram = new Be(
4328
4352
  s,
4329
- Oe,
4330
- Ce,
4353
+ We,
4354
+ Ne,
4331
4355
  "main-program-mg"
4332
4356
  ), this.requestTick();
4333
4357
  }
@@ -4363,7 +4387,7 @@ class Li extends re {
4363
4387
  this.requestTick();
4364
4388
  return;
4365
4389
  }
4366
- this.frameTime += i, this.onRedraw(this.frameTime, i) && this.staticMode ? this.staticMode && (this.lastFrameTime = Number.NaN) : this.requestTick(), this.lastTickTime = e;
4390
+ this.frameTime += i * this.flowSpeed, this.onRedraw(this.frameTime, i) && this.staticMode ? this.staticMode && (this.lastFrameTime = Number.NaN) : this.requestTick(), this.lastTickTime = e;
4367
4391
  }
4368
4392
  checkIfResize() {
4369
4393
  const [e, s] = [this.targetSize.x, this.targetSize.y], [i, n] = [this.currentSize.x, this.currentSize.y];
@@ -4376,14 +4400,26 @@ class Li extends re {
4376
4400
  onRedraw(e, s) {
4377
4401
  const i = this.meshStates[this.meshStates.length - 1];
4378
4402
  let n = !1;
4379
- if (i) {
4380
- if (i.mesh.bind(), this.manualControl && i.mesh.updateMesh(), i.alpha = Math.min(1, i.alpha + s / 500), i.alpha >= 1) {
4381
- const a = this.meshStates.splice(0, this.meshStates.length - 1);
4403
+ if (i)
4404
+ if (i.mesh.bind(), this.manualControl && i.mesh.updateMesh(), this.isNoCover) {
4405
+ for (const o of this.meshStates)
4406
+ o.alpha = Math.max(0, o.alpha - s / 500);
4407
+ const a = this.meshStates.filter((o) => o.alpha === 0);
4408
+ this.meshStates = this.meshStates.filter((o) => o.alpha > 0);
4382
4409
  for (const o of a)
4383
4410
  o.mesh.dispose(), o.texture.dispose();
4411
+ this.meshStates.length === 0 && (n = !0);
4412
+ } else {
4413
+ if (i.alpha = Math.min(
4414
+ 1,
4415
+ i.alpha + s / 500
4416
+ ), i.alpha >= 1) {
4417
+ const a = this.meshStates.splice(0, this.meshStates.length - 1);
4418
+ for (const o of a)
4419
+ o.mesh.dispose(), o.texture.dispose();
4420
+ }
4421
+ this.meshStates.length === 1 && i.alpha >= 1 && (n = !0);
4384
4422
  }
4385
- this.meshStates.length === 1 && i.alpha >= 1 && (n = !0);
4386
- }
4387
4423
  const r = this.gl;
4388
4424
  r.bindFramebuffer(r.FRAMEBUFFER, null), r.blendFunc(r.SRC_ALPHA, r.ONE_MINUS_SRC_ALPHA), r.clear(r.COLOR_BUFFER_BIT), this.checkIfResize(), this.mainProgram.use(), r.activeTexture(r.TEXTURE0), this.mainProgram.setUniform1f("u_time", e / 1e4), this.mainProgram.setUniform1f(
4389
4425
  "u_aspect",
@@ -4412,8 +4448,10 @@ class Li extends re {
4412
4448
  this.paused = !1, this.requestTick();
4413
4449
  }
4414
4450
  async setAlbum(e, s) {
4415
- if (typeof e == "string" && e.trim().length === 0)
4416
- throw new Error("Empty album url");
4451
+ if (e === void 0 || typeof e == "string" && e.trim().length === 0) {
4452
+ this.isNoCover = !0;
4453
+ return;
4454
+ }
4417
4455
  let i = null, n = 5;
4418
4456
  for (; !i && n > 0; )
4419
4457
  try {
@@ -4427,40 +4465,44 @@ class Li extends re {
4427
4465
  }
4428
4466
  ), n--;
4429
4467
  }
4430
- if (!i) return;
4468
+ if (!i) {
4469
+ console.error("Failed to load album resource", e), this.isNoCover = !0;
4470
+ return;
4471
+ }
4472
+ this.isNoCover = !1;
4431
4473
  const r = this.reduceImageSizeCanvas, a = r.getContext("2d", {
4432
4474
  willReadFrequently: !0
4433
4475
  });
4434
4476
  if (!a) throw new Error("Failed to create canvas context");
4435
4477
  a.clearRect(0, 0, r.width, r.height);
4436
- const o = i instanceof HTMLVideoElement ? i.videoWidth : i.naturalWidth, c = i instanceof HTMLVideoElement ? i.videoHeight : i.naturalHeight;
4437
- if (o * c === 0) throw new Error("Invalid image size");
4438
- a.drawImage(i, 0, 0, o, c, 0, 0, r.width, r.height);
4439
- const h = a.getImageData(0, 0, r.width, r.height);
4440
- if (Gt(h, 0.4), Ae(h, 3), Gt(h, 1.7), Re(h, 0.75), _e(h, 2, 4), this.manualControl && this.meshStates.length > 0)
4441
- this.meshStates[0].texture.dispose(), this.meshStates[0].texture = new Jt(this.gl, h);
4478
+ const o = i instanceof HTMLVideoElement ? i.videoWidth : i.naturalWidth, h = i instanceof HTMLVideoElement ? i.videoHeight : i.naturalHeight;
4479
+ if (o * h === 0) throw new Error("Invalid image size");
4480
+ a.drawImage(i, 0, 0, o, h, 0, 0, r.width, r.height);
4481
+ const c = a.getImageData(0, 0, r.width, r.height);
4482
+ if (Yt(c, 0.4), Ie(c, 3), Yt(c, 1.7), ke(c, 0.75), ze(c, 2, 4), this.manualControl && this.meshStates.length > 0)
4483
+ this.meshStates[0].texture.dispose(), this.meshStates[0].texture = new Xt(this.gl, c);
4442
4484
  else {
4443
- const l = new je(
4485
+ const l = new Ye(
4444
4486
  this.gl,
4445
4487
  this.mainProgram.attrs.a_pos,
4446
4488
  this.mainProgram.attrs.a_color,
4447
4489
  this.mainProgram.attrs.a_uv
4448
4490
  );
4449
4491
  l.resetSubdivition(15);
4450
- const p = Xt[Math.floor(Math.random() * Xt.length)];
4492
+ const p = Math.random() > 0.8 ? Oe(6, 6) : jt[Math.floor(Math.random() * jt.length)];
4451
4493
  l.resizeControlPoints(p.width, p.height);
4452
- const u = 2 / (p.width - 1), y = 2 / (p.height - 1);
4453
- for (const g of p.conf) {
4454
- const b = l.getControlPoint(g.cx, g.cy);
4455
- b.location.x = g.x, b.location.y = g.y, b.uRot = g.ur * Math.PI / 180, b.vRot = g.vr * Math.PI / 180, b.uScale = u * g.up, b.vScale = y * g.vp;
4494
+ const u = 2 / (p.width - 1), g = 2 / (p.height - 1);
4495
+ for (const y of p.conf) {
4496
+ const b = l.getControlPoint(y.cx, y.cy);
4497
+ b.location.x = y.x, b.location.y = y.y, b.uRot = y.ur * Math.PI / 180, b.vRot = y.vr * Math.PI / 180, b.uScale = u * y.up, b.vScale = g * y.vp;
4456
4498
  }
4457
- l.updateMesh();
4458
- const L = new Jt(this.gl, h), m = {
4499
+ l.updateMesh(), this.currentImageData = c;
4500
+ const M = new Xt(this.gl, c), d = {
4459
4501
  mesh: l,
4460
- texture: L,
4502
+ texture: M,
4461
4503
  alpha: 0
4462
4504
  };
4463
- this.meshStates.push(m);
4505
+ this.meshStates.push(d);
4464
4506
  }
4465
4507
  this.requestTick();
4466
4508
  }
@@ -4475,13 +4517,13 @@ class Li extends re {
4475
4517
  e.mesh.dispose(), e.texture.dispose();
4476
4518
  }
4477
4519
  }
4478
- class Ue extends ke {
4520
+ class Ge extends Se {
4479
4521
  constructor() {
4480
4522
  super(...arguments);
4481
4523
  f(this, "time", 0);
4482
4524
  }
4483
4525
  }
4484
- class Mi extends re {
4526
+ class li extends re {
4485
4527
  constructor(e) {
4486
4528
  super(e);
4487
4529
  f(this, "app");
@@ -4503,7 +4545,7 @@ class Mi extends re {
4503
4545
  ), n.position.set(this.app.screen.width / 2, this.app.screen.height / 2), r.position.set(this.app.screen.width / 2, this.app.screen.height / 2), s.width = a * Math.sqrt(2), s.height = s.width, i.width = a * 0.8, i.height = i.width, n.width = a * 0.5, n.height = n.width, r.width = a * 0.25, r.height = r.width, this.curContainer.time += e * this.flowSpeed, s.rotation += e / 1e3 * this.flowSpeed, i.rotation -= e / 500 * this.flowSpeed, n.rotation += e / 1e3 * this.flowSpeed, r.rotation -= e / 750 * this.flowSpeed, n.x = this.app.screen.width / 2 + this.app.screen.width / 4 * Math.cos(this.curContainer.time / 1e3 * 0.75), n.y = this.app.screen.height / 2 + this.app.screen.width / 4 * Math.cos(this.curContainer.time / 1e3 * 0.75), r.x = this.app.screen.width / 2 + this.app.screen.width / 4 * 0.1 + Math.cos(this.curContainer.time * 6e-3 * 0.75), r.y = this.app.screen.height / 2 + this.app.screen.width / 4 * 0.1 + Math.cos(this.curContainer.time * 6e-3 * 0.75), this.curContainer.alpha >= 1 && this.lastContainer.size === 0 && this.staticMode && this.app.ticker.stop();
4504
4546
  }
4505
4547
  });
4506
- this.canvas = e, this.app = new ve({
4548
+ this.canvas = e, this.app = new Te({
4507
4549
  view: e,
4508
4550
  resizeTo: this.canvas,
4509
4551
  powerPreference: "low-power",
@@ -4517,34 +4559,34 @@ class Mi extends re {
4517
4559
  super.setRenderScale(e), this.rebuildFilters();
4518
4560
  }
4519
4561
  rebuildFilters() {
4520
- const e = Math.min(this.canvas.width, this.canvas.height), s = Math.max(this.canvas.width, this.canvas.height), i = new Dt();
4562
+ const e = Math.min(this.canvas.width, this.canvas.height), s = Math.max(this.canvas.width, this.canvas.height), i = new kt();
4521
4563
  i.saturate(1.2, !1);
4522
- const n = new Dt();
4564
+ const n = new kt();
4523
4565
  n.brightness(0.6, !1);
4524
- const r = new Dt();
4566
+ const r = new kt();
4525
4567
  r.contrast(0.3, !0);
4526
4568
  for (const a of this.app.stage.filters ?? [])
4527
4569
  a.destroy();
4528
- this.app.stage.filters = [], this.app.stage.filters.push(new X(5, 1)), this.app.stage.filters.push(new X(10, 1)), this.app.stage.filters.push(new X(20, 2)), this.app.stage.filters.push(new X(40, 2)), this.app.stage.filters.push(new X(80, 2)), e > 768 && this.app.stage.filters.push(new X(160, 4)), e > 768 * 2 && this.app.stage.filters.push(new X(320, 4)), this.app.stage.filters.push(i, n, r), this.app.stage.filters.push(new X(5, 1)), Math.random() > 0.5 ? (this.app.stage.filters.push(
4529
- new ut({
4570
+ this.app.stage.filters = [], this.app.stage.filters.push(new tt(5, 1)), this.app.stage.filters.push(new tt(10, 1)), this.app.stage.filters.push(new tt(20, 2)), this.app.stage.filters.push(new tt(40, 2)), this.app.stage.filters.push(new tt(80, 2)), e > 768 && this.app.stage.filters.push(new tt(160, 4)), e > 768 * 2 && this.app.stage.filters.push(new tt(320, 4)), this.app.stage.filters.push(i, n, r), this.app.stage.filters.push(new tt(5, 1)), Math.random() > 0.5 ? (this.app.stage.filters.push(
4571
+ new yt({
4530
4572
  radius: (s + e) / 2,
4531
4573
  strength: 1,
4532
4574
  center: [0.25, 1]
4533
4575
  })
4534
4576
  ), this.app.stage.filters.push(
4535
- new ut({
4577
+ new yt({
4536
4578
  radius: (s + e) / 2,
4537
4579
  strength: 1,
4538
4580
  center: [0.75, 0]
4539
4581
  })
4540
4582
  )) : (this.app.stage.filters.push(
4541
- new ut({
4583
+ new yt({
4542
4584
  radius: (s + e) / 2,
4543
4585
  strength: 1,
4544
4586
  center: [0.75, 1]
4545
4587
  })
4546
4588
  ), this.app.stage.filters.push(
4547
- new ut({
4589
+ new yt({
4548
4590
  radius: (s + e) / 2,
4549
4591
  strength: 1,
4550
4592
  center: [0.25, 0]
@@ -4569,26 +4611,26 @@ class Mi extends re {
4569
4611
  }
4570
4612
  async setAlbum(e, s) {
4571
4613
  var p, u;
4572
- if (typeof e == "string" && e.trim().length === 0)
4614
+ if (!e || typeof e == "string" && e.trim().length === 0)
4573
4615
  return;
4574
4616
  let i = null, n = 5, r = null;
4575
4617
  for (; !((u = (p = r == null ? void 0 : r.baseTexture) == null ? void 0 : p.resource) != null && u.valid) && n > 0; )
4576
4618
  try {
4577
- typeof e == "string" ? i = await ae(e, s) : i = await oe(e), r = ze.from(i, {
4619
+ typeof e == "string" ? i = await ae(e, s) : i = await oe(e), r = we.from(i, {
4578
4620
  resourceOptions: {
4579
4621
  autoLoad: !1
4580
4622
  }
4581
4623
  }), await r.baseTexture.resource.load();
4582
- } catch (y) {
4624
+ } catch (g) {
4583
4625
  console.warn(
4584
4626
  `failed on loading album image, retrying (${n})`,
4585
4627
  e,
4586
- y
4628
+ g
4587
4629
  ), r = null, n--;
4588
4630
  }
4589
4631
  if (!r) return;
4590
- const a = new Ue(), o = new yt(r), c = new yt(r), h = new yt(r), l = new yt(r);
4591
- o.anchor.set(0.5, 0.5), c.anchor.set(0.5, 0.5), h.anchor.set(0.5, 0.5), l.anchor.set(0.5, 0.5), o.rotation = Math.random() * Math.PI * 2, c.rotation = Math.random() * Math.PI * 2, h.rotation = Math.random() * Math.PI * 2, l.rotation = Math.random() * Math.PI * 2, a.addChild(o, c, h, l), this.curContainer && this.lastContainer.add(this.curContainer), this.curContainer = a, this.app.stage.addChild(a), this.curContainer.alpha = 0, this.app.ticker.start();
4632
+ const a = new Ge(), o = new gt(r), h = new gt(r), c = new gt(r), l = new gt(r);
4633
+ o.anchor.set(0.5, 0.5), h.anchor.set(0.5, 0.5), c.anchor.set(0.5, 0.5), l.anchor.set(0.5, 0.5), o.rotation = Math.random() * Math.PI * 2, h.rotation = Math.random() * Math.PI * 2, c.rotation = Math.random() * Math.PI * 2, l.rotation = Math.random() * Math.PI * 2, a.addChild(o, h, c, l), this.curContainer && this.lastContainer.add(this.curContainer), this.curContainer = a, this.app.stage.addChild(a), this.curContainer.alpha = 0, this.app.ticker.start();
4592
4634
  }
4593
4635
  dispose() {
4594
4636
  super.dispose(), this.app.ticker.remove(this.onTick), this.app.destroy(!0);
@@ -4641,60 +4683,51 @@ class ce {
4641
4683
  this.renderer.dispose(), this.element.remove();
4642
4684
  }
4643
4685
  }
4644
- const Ve = "_lyricLine_lennj_6", Ge = "_dirty_lennj_26", Xe = "_lyricBgLine_lennj_42", Ze = "_active_lennj_51", Je = "_hasDuetLine_lennj_63", Qe = "_lyricDuetLine_lennj_64", Ke = "_lyricMainLine_lennj_78", ts = "_emphasizeWrapper_lennj_88", es = "_emphasize_lennj_88", ss = "_lyricSubLine_lennj_111", is = "_disableSpring_lennj_118", ns = "_interludeDots_lennj_123", rs = "_enabled_lennj_135", as = "_duet_lennj_149", os = "_tmpDisableTransition_lennj_161", C = {
4645
- lyricLine: Ve,
4646
- dirty: Ge,
4647
- lyricBgLine: Xe,
4648
- active: Ze,
4649
- hasDuetLine: Je,
4650
- lyricDuetLine: Qe,
4651
- lyricMainLine: Ke,
4652
- emphasizeWrapper: ts,
4653
- emphasize: es,
4654
- lyricSubLine: ss,
4655
- disableSpring: is,
4656
- interludeDots: ns,
4657
- enabled: rs,
4658
- duet: as,
4686
+ const Xe = "_lyricLine_1vq69_6", Ze = "_lyricBgLine_1vq69_42", Je = "_active_1vq69_51", Qe = "_hasDuetLine_1vq69_63", Ke = "_lyricDuetLine_1vq69_64", ts = "_lyricMainLine_1vq69_83", es = "_emphasizeWrapper_1vq69_93", ss = "_emphasize_1vq69_93", is = "_lyricSubLine_1vq69_116", ns = "_disableSpring_1vq69_123", rs = "_interludeDots_1vq69_128", as = "_enabled_1vq69_140", os = "_tmpDisableTransition_1vq69_166", W = {
4687
+ lyricLine: Xe,
4688
+ lyricBgLine: Ze,
4689
+ active: Je,
4690
+ hasDuetLine: Qe,
4691
+ lyricDuetLine: Ke,
4692
+ lyricMainLine: ts,
4693
+ emphasizeWrapper: es,
4694
+ emphasize: ss,
4695
+ lyricSubLine: is,
4696
+ disableSpring: ns,
4697
+ interludeDots: rs,
4698
+ enabled: as,
4659
4699
  tmpDisableTransition: os
4660
- };
4661
- function he(d, t = 20) {
4662
- let e = 0;
4663
- return (...i) => {
4664
- clearTimeout(e), e = setTimeout(() => d(...i), t);
4665
- };
4666
- }
4667
- const le = -1, kt = 0, Et = 1, Pt = 2, Ot = 3, Wt = 4, Nt = 5, Bt = 6, de = 7, me = 8, Qt = typeof self == "object" ? self : globalThis, cs = (d, t) => {
4668
- const e = (i, n) => (d.set(n, i), i), s = (i) => {
4669
- if (d.has(i))
4670
- return d.get(i);
4700
+ }, he = -1, zt = 0, ut = 1, vt = 2, Ot = 3, Nt = 4, Wt = 5, Bt = 6, le = 7, de = 8, Zt = typeof self == "object" ? self : globalThis, cs = (m, t) => {
4701
+ const e = (i, n) => (m.set(n, i), i), s = (i) => {
4702
+ if (m.has(i))
4703
+ return m.get(i);
4671
4704
  const [n, r] = t[i];
4672
4705
  switch (n) {
4673
- case kt:
4674
- case le:
4706
+ case zt:
4707
+ case he:
4675
4708
  return e(r, i);
4676
- case Et: {
4709
+ case ut: {
4677
4710
  const a = e([], i);
4678
4711
  for (const o of r)
4679
4712
  a.push(s(o));
4680
4713
  return a;
4681
4714
  }
4682
- case Pt: {
4715
+ case vt: {
4683
4716
  const a = e({}, i);
4684
- for (const [o, c] of r)
4685
- a[s(o)] = s(c);
4717
+ for (const [o, h] of r)
4718
+ a[s(o)] = s(h);
4686
4719
  return a;
4687
4720
  }
4688
4721
  case Ot:
4689
4722
  return e(new Date(r), i);
4690
- case Wt: {
4723
+ case Nt: {
4691
4724
  const { source: a, flags: o } = r;
4692
4725
  return e(new RegExp(a, o), i);
4693
4726
  }
4694
- case Nt: {
4727
+ case Wt: {
4695
4728
  const a = e(/* @__PURE__ */ new Map(), i);
4696
- for (const [o, c] of r)
4697
- a.set(s(o), s(c));
4729
+ for (const [o, h] of r)
4730
+ a.set(s(o), s(h));
4698
4731
  return a;
4699
4732
  }
4700
4733
  case Bt: {
@@ -4703,73 +4736,83 @@ const le = -1, kt = 0, Et = 1, Pt = 2, Ot = 3, Wt = 4, Nt = 5, Bt = 6, de = 7, m
4703
4736
  a.add(s(o));
4704
4737
  return a;
4705
4738
  }
4706
- case de: {
4739
+ case le: {
4707
4740
  const { name: a, message: o } = r;
4708
- return e(new Qt[a](o), i);
4741
+ return e(new Zt[a](o), i);
4709
4742
  }
4710
- case me:
4743
+ case de:
4711
4744
  return e(BigInt(r), i);
4712
4745
  case "BigInt":
4713
4746
  return e(Object(BigInt(r)), i);
4747
+ case "ArrayBuffer":
4748
+ return e(new Uint8Array(r).buffer, r);
4749
+ case "DataView": {
4750
+ const { buffer: a } = new Uint8Array(r);
4751
+ return e(new DataView(a), r);
4752
+ }
4714
4753
  }
4715
- return e(new Qt[n](r), i);
4754
+ return e(new Zt[n](r), i);
4716
4755
  };
4717
4756
  return s;
4718
- }, Kt = (d) => cs(/* @__PURE__ */ new Map(), d)(0), at = "", { toString: hs } = {}, { keys: ls } = Object, dt = (d) => {
4719
- const t = typeof d;
4720
- if (t !== "object" || !d)
4721
- return [kt, t];
4722
- const e = hs.call(d).slice(8, -1);
4757
+ }, Jt = (m) => cs(/* @__PURE__ */ new Map(), m)(0), lt = "", { toString: hs } = {}, { keys: ls } = Object, mt = (m) => {
4758
+ const t = typeof m;
4759
+ if (t !== "object" || !m)
4760
+ return [zt, t];
4761
+ const e = hs.call(m).slice(8, -1);
4723
4762
  switch (e) {
4724
4763
  case "Array":
4725
- return [Et, at];
4764
+ return [ut, lt];
4726
4765
  case "Object":
4727
- return [Pt, at];
4766
+ return [vt, lt];
4728
4767
  case "Date":
4729
- return [Ot, at];
4768
+ return [Ot, lt];
4730
4769
  case "RegExp":
4731
- return [Wt, at];
4770
+ return [Nt, lt];
4732
4771
  case "Map":
4733
- return [Nt, at];
4772
+ return [Wt, lt];
4734
4773
  case "Set":
4735
- return [Bt, at];
4774
+ return [Bt, lt];
4775
+ case "DataView":
4776
+ return [ut, e];
4736
4777
  }
4737
- return e.includes("Array") ? [Et, e] : e.includes("Error") ? [de, e] : [Pt, e];
4738
- }, xt = ([d, t]) => d === kt && (t === "function" || t === "symbol"), ds = (d, t, e, s) => {
4778
+ return e.includes("Array") ? [ut, e] : e.includes("Error") ? [le, e] : [vt, e];
4779
+ }, wt = ([m, t]) => m === zt && (t === "function" || t === "symbol"), ds = (m, t, e, s) => {
4739
4780
  const i = (r, a) => {
4740
4781
  const o = s.push(r) - 1;
4741
4782
  return e.set(a, o), o;
4742
4783
  }, n = (r) => {
4743
4784
  if (e.has(r))
4744
4785
  return e.get(r);
4745
- let [a, o] = dt(r);
4786
+ let [a, o] = mt(r);
4746
4787
  switch (a) {
4747
- case kt: {
4748
- let h = r;
4788
+ case zt: {
4789
+ let c = r;
4749
4790
  switch (o) {
4750
4791
  case "bigint":
4751
- a = me, h = r.toString();
4792
+ a = de, c = r.toString();
4752
4793
  break;
4753
4794
  case "function":
4754
4795
  case "symbol":
4755
- if (d)
4796
+ if (m)
4756
4797
  throw new TypeError("unable to serialize " + o);
4757
- h = null;
4798
+ c = null;
4758
4799
  break;
4759
4800
  case "undefined":
4760
- return i([le], r);
4801
+ return i([he], r);
4761
4802
  }
4762
- return i([a, h], r);
4803
+ return i([a, c], r);
4763
4804
  }
4764
- case Et: {
4765
- if (o)
4766
- return i([o, [...r]], r);
4767
- const h = [], l = i([a, h], r);
4805
+ case ut: {
4806
+ if (o) {
4807
+ let p = r;
4808
+ return o === "DataView" ? p = new Uint8Array(r.buffer) : o === "ArrayBuffer" && (p = new Uint8Array(r)), i([o, [...p]], r);
4809
+ }
4810
+ const c = [], l = i([a, c], r);
4768
4811
  for (const p of r)
4769
- h.push(n(p));
4812
+ c.push(n(p));
4770
4813
  return l;
4771
4814
  }
4772
- case Pt: {
4815
+ case vt: {
4773
4816
  if (o)
4774
4817
  switch (o) {
4775
4818
  case "BigInt":
@@ -4781,48 +4824,48 @@ const le = -1, kt = 0, Et = 1, Pt = 2, Ot = 3, Wt = 4, Nt = 5, Bt = 6, de = 7, m
4781
4824
  }
4782
4825
  if (t && "toJSON" in r)
4783
4826
  return n(r.toJSON());
4784
- const h = [], l = i([a, h], r);
4827
+ const c = [], l = i([a, c], r);
4785
4828
  for (const p of ls(r))
4786
- (d || !xt(dt(r[p]))) && h.push([n(p), n(r[p])]);
4829
+ (m || !wt(mt(r[p]))) && c.push([n(p), n(r[p])]);
4787
4830
  return l;
4788
4831
  }
4789
4832
  case Ot:
4790
4833
  return i([a, r.toISOString()], r);
4791
- case Wt: {
4792
- const { source: h, flags: l } = r;
4793
- return i([a, { source: h, flags: l }], r);
4794
- }
4795
4834
  case Nt: {
4796
- const h = [], l = i([a, h], r);
4835
+ const { source: c, flags: l } = r;
4836
+ return i([a, { source: c, flags: l }], r);
4837
+ }
4838
+ case Wt: {
4839
+ const c = [], l = i([a, c], r);
4797
4840
  for (const [p, u] of r)
4798
- (d || !(xt(dt(p)) || xt(dt(u)))) && h.push([n(p), n(u)]);
4841
+ (m || !(wt(mt(p)) || wt(mt(u)))) && c.push([n(p), n(u)]);
4799
4842
  return l;
4800
4843
  }
4801
4844
  case Bt: {
4802
- const h = [], l = i([a, h], r);
4845
+ const c = [], l = i([a, c], r);
4803
4846
  for (const p of r)
4804
- (d || !xt(dt(p))) && h.push(n(p));
4847
+ (m || !wt(mt(p))) && c.push(n(p));
4805
4848
  return l;
4806
4849
  }
4807
4850
  }
4808
- const { message: c } = r;
4809
- return i([a, { name: o, message: c }], r);
4851
+ const { message: h } = r;
4852
+ return i([a, { name: o, message: h }], r);
4810
4853
  };
4811
4854
  return n;
4812
- }, te = (d, { json: t, lossy: e } = {}) => {
4855
+ }, Qt = (m, { json: t, lossy: e } = {}) => {
4813
4856
  const s = [];
4814
- return ds(!(t || e), !!t, /* @__PURE__ */ new Map(), s)(d), s;
4815
- }, ee = typeof structuredClone == "function" ? (
4857
+ return ds(!(t || e), !!t, /* @__PURE__ */ new Map(), s)(m), s;
4858
+ }, Kt = typeof structuredClone == "function" ? (
4816
4859
  /* c8 ignore start */
4817
- (d, t) => t && ("json" in t || "lossy" in t) ? Kt(te(d, t)) : structuredClone(d)
4818
- ) : (d, t) => Kt(te(d, t)), ms = (d, t) => d.size === t.size && [...d].every((e) => t.has(e)), ps = (d) => /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u.test(d);
4819
- function fs(d) {
4820
- return (e) => (d(e + 1e-3) - d(e - 1e-3)) / (2 * 1e-3);
4860
+ (m, t) => t && ("json" in t || "lossy" in t) ? Jt(Qt(m, t)) : structuredClone(m)
4861
+ ) : (m, t) => Jt(Qt(m, t)), ms = (m, t) => m.size === t.size && [...m].every((e) => t.has(e)), ps = (m) => /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u.test(m);
4862
+ function fs(m) {
4863
+ return (e) => (m(e + 1e-3) - m(e - 1e-3)) / (2 * 1e-3);
4821
4864
  }
4822
- function se(d) {
4823
- return fs(d);
4865
+ function te(m) {
4866
+ return fs(m);
4824
4867
  }
4825
- class vt {
4868
+ class Pt {
4826
4869
  constructor(t = 0) {
4827
4870
  f(this, "currentPosition", 0);
4828
4871
  f(this, "targetPosition", 0);
@@ -4843,7 +4886,7 @@ class vt {
4843
4886
  this.targetPosition,
4844
4887
  0,
4845
4888
  this.params
4846
- ), this.getV = se(this.currentSolver), this.getV2 = se(this.getV);
4889
+ ), this.getV = te(this.currentSolver), this.getV2 = te(this.getV);
4847
4890
  }
4848
4891
  arrived() {
4849
4892
  return Math.abs(this.targetPosition - this.currentPosition) < 0.01 && this.getV(this.currentTime) < 0.01 && this.getV2(this.currentTime) < 0.01 && this.queueParams === void 0 && this.queuePosition === void 0;
@@ -4877,43 +4920,43 @@ class vt {
4877
4920
  return this.currentPosition;
4878
4921
  }
4879
4922
  }
4880
- function us(d, t, e, s = 0, i) {
4881
- const n = (i == null ? void 0 : i.soft) ?? !1, r = (i == null ? void 0 : i.stiffness) ?? 100, a = (i == null ? void 0 : i.damping) ?? 10, o = (i == null ? void 0 : i.mass) ?? 1, c = e - d;
4923
+ function us(m, t, e, s = 0, i) {
4924
+ const n = (i == null ? void 0 : i.soft) ?? !1, r = (i == null ? void 0 : i.stiffness) ?? 100, a = (i == null ? void 0 : i.damping) ?? 10, o = (i == null ? void 0 : i.mass) ?? 1, h = e - m;
4882
4925
  if (n || 1 <= a / (2 * Math.sqrt(r * o))) {
4883
- const y = -Math.sqrt(r / o), L = -y * c - t;
4884
- return (m) => (m -= s, m < 0 ? d : e - (c + m * L) * Math.E ** (m * y));
4926
+ const g = -Math.sqrt(r / o), M = -g * h - t;
4927
+ return (d) => (d -= s, d < 0 ? m : e - (h + d * M) * Math.E ** (d * g));
4885
4928
  }
4886
- const h = Math.sqrt(4 * o * r - a ** 2), l = (a * c - 2 * o * t) / h, p = 0.5 * h / o, u = -(0.5 * a) / o;
4887
- return (y) => (y -= s, y < 0 ? d : e - (Math.cos(y * p) * c + Math.sin(y * p) * l) * Math.E ** (y * u));
4929
+ const c = Math.sqrt(4 * o * r - a ** 2), l = (a * h - 2 * o * t) / c, p = 0.5 * c / o, u = -(0.5 * a) / o;
4930
+ return (g) => (g -= s, g < 0 ? m : e - (Math.cos(g * p) * h + Math.sin(g * p) * l) * Math.E ** (g * u));
4888
4931
  }
4889
- const At = [], Rt = [];
4932
+ const _t = [], Rt = [];
4890
4933
  let Ct = !1;
4891
4934
  function ys() {
4892
- let d = Rt.shift();
4893
- for (; d; ) {
4935
+ let m = Rt.shift();
4936
+ for (; m; ) {
4894
4937
  try {
4895
- d.resolve(d.task());
4938
+ m.resolve(m.task());
4896
4939
  } catch (t) {
4897
- d.reject(t);
4940
+ m.reject(t);
4898
4941
  }
4899
- d = Rt.shift();
4942
+ m = Rt.shift();
4900
4943
  }
4901
- for (d = At.shift(); d; ) {
4944
+ for (m = _t.shift(); m; ) {
4902
4945
  try {
4903
- d.resolve(d.task());
4946
+ m.resolve(m.task());
4904
4947
  } catch (t) {
4905
- d.reject(t);
4948
+ m.reject(t);
4906
4949
  }
4907
- d = At.shift();
4950
+ m = _t.shift();
4908
4951
  }
4909
4952
  Ct = !1;
4910
4953
  }
4911
- function pe() {
4954
+ function me() {
4912
4955
  Ct || (Ct = !0, requestAnimationFrame(ys));
4913
4956
  }
4914
- function ft(d) {
4957
+ function pe(m) {
4915
4958
  const t = {
4916
- task: d,
4959
+ task: m,
4917
4960
  resolve: () => {
4918
4961
  },
4919
4962
  reject: () => {
@@ -4921,11 +4964,11 @@ function ft(d) {
4921
4964
  }, e = new Promise((s, i) => {
4922
4965
  t.resolve = s, t.reject = i;
4923
4966
  });
4924
- return At.push(t), pe(), e;
4967
+ return _t.push(t), me(), e;
4925
4968
  }
4926
- function ot(d) {
4969
+ function ee(m) {
4927
4970
  const t = {
4928
- task: d,
4971
+ task: m,
4929
4972
  resolve: () => {
4930
4973
  },
4931
4974
  reject: () => {
@@ -4933,7 +4976,7 @@ function ot(d) {
4933
4976
  }, e = new Promise((s, i) => {
4934
4977
  t.resolve = s, t.reject = i;
4935
4978
  });
4936
- return Rt.push(t), pe(), e;
4979
+ return Rt.push(t), me(), e;
4937
4980
  }
4938
4981
  class gs {
4939
4982
  constructor(t) {
@@ -4944,14 +4987,14 @@ class gs {
4944
4987
  // 由 LyricPlayer 来设置
4945
4988
  f(this, "lineSize", [0, 0]);
4946
4989
  f(this, "lineTransforms", {
4947
- posX: new vt(0),
4948
- posY: new vt(0)
4990
+ posX: new Pt(0),
4991
+ posY: new Pt(0)
4949
4992
  });
4950
4993
  f(this, "lastStyle", "");
4951
- this.lyricPlayer = t, this.element.setAttribute("class", C.lyricLine), this.rebuildStyle();
4994
+ this.lyricPlayer = t, this.element.setAttribute("class", W.lyricLine), this.rebuildStyle();
4952
4995
  }
4953
4996
  async measureSize() {
4954
- return await ft(() => [
4997
+ return await pe(() => [
4955
4998
  this.element.clientWidth,
4956
4999
  this.element.clientHeight
4957
5000
  ]);
@@ -4970,8 +5013,8 @@ class gs {
4970
5013
  return this.element;
4971
5014
  }
4972
5015
  setTransform(t = this.left, e = this.top, s = !1, i = 0) {
4973
- this.left = t, this.top = e, this.delay = i * 1e3 | 0, s || !this.lyricPlayer.getEnableSpring() ? (s && this.element.classList.add(C.tmpDisableTransition), this.lineTransforms.posX.setPosition(t), this.lineTransforms.posY.setPosition(e), this.lyricPlayer.getEnableSpring() ? this.rebuildStyle() : this.show(), s && requestAnimationFrame(() => {
4974
- this.element.classList.remove(C.tmpDisableTransition);
5016
+ this.left = t, this.top = e, this.delay = i * 1e3 | 0, s || !this.lyricPlayer.getEnableSpring() ? (s && this.element.classList.add(W.tmpDisableTransition), this.lineTransforms.posX.setPosition(t), this.lineTransforms.posY.setPosition(e), this.lyricPlayer.getEnableSpring() ? this.rebuildStyle() : this.show(), s && requestAnimationFrame(() => {
5017
+ this.element.classList.remove(W.tmpDisableTransition);
4975
5018
  })) : (this.lineTransforms.posX.setTargetPosition(t, i), this.lineTransforms.posY.setTargetPosition(e, i));
4976
5019
  }
4977
5020
  update(t = 0) {
@@ -4985,14 +5028,14 @@ class gs {
4985
5028
  this.element.remove();
4986
5029
  }
4987
5030
  }
4988
- function Ls(d) {
5031
+ function Ms(m) {
4989
5032
  const e = 2.5949095;
4990
- return d < 0.5 ? (2 * d) ** 2 * ((e + 1) * 2 * d - e) / 2 : ((2 * d - 2) ** 2 * ((e + 1) * (d * 2 - 2) + e) + 2) / 2;
5033
+ return m < 0.5 ? (2 * m) ** 2 * ((e + 1) * 2 * m - e) / 2 : ((2 * m - 2) ** 2 * ((e + 1) * (m * 2 - 2) + e) + 2) / 2;
4991
5034
  }
4992
- function Ms(d) {
4993
- return d === 1 ? 1 : 1 - 2 ** (-10 * d);
5035
+ function Ls(m) {
5036
+ return m === 1 ? 1 : 1 - 2 ** (-10 * m);
4994
5037
  }
4995
- const Q = (d, t, e) => Math.max(d, Math.min(t, e));
5038
+ const it = (m, t, e) => Math.max(m, Math.min(t, e));
4996
5039
  class bs {
4997
5040
  constructor() {
4998
5041
  f(this, "element", document.createElement("div"));
@@ -5006,7 +5049,7 @@ class bs {
5006
5049
  f(this, "currentInterlude");
5007
5050
  f(this, "currentTime", 0);
5008
5051
  f(this, "targetBreatheDuration", 1500);
5009
- this.element.className = C.interludeDots, this.element.appendChild(this.dot0), this.element.appendChild(this.dot1), this.element.appendChild(this.dot2);
5052
+ this.element.className = W.interludeDots, this.element.appendChild(this.dot0), this.element.appendChild(this.dot1), this.element.appendChild(this.dot2);
5010
5053
  }
5011
5054
  getElement() {
5012
5055
  return this.element;
@@ -5015,13 +5058,13 @@ class bs {
5015
5058
  this.left = t, this.top = e, this.update();
5016
5059
  }
5017
5060
  setInterlude(t) {
5018
- this.currentInterlude = t, this.currentTime = (t == null ? void 0 : t[0]) ?? 0, t ? this.element.classList.add(C.enabled) : this.element.classList.remove(C.enabled);
5061
+ this.currentInterlude = t, this.currentTime = (t == null ? void 0 : t[0]) ?? 0, t ? this.element.classList.add(W.enabled) : this.element.classList.remove(W.enabled);
5019
5062
  }
5020
5063
  pause() {
5021
- this.playing = !1, this.element.classList.remove(C.playing);
5064
+ this.playing = !1, this.element.classList.remove(W.playing);
5022
5065
  }
5023
5066
  resume() {
5024
- this.playing = !0, this.element.classList.add(C.playing);
5067
+ this.playing = !0, this.element.classList.add(W.playing);
5025
5068
  }
5026
5069
  update(t = 0) {
5027
5070
  if (!this.playing) return;
@@ -5034,37 +5077,37 @@ class bs {
5034
5077
  if (i <= s) {
5035
5078
  const n = s / Math.ceil(s / this.targetBreatheDuration);
5036
5079
  let r = 1, a = 1;
5037
- r *= Math.sin(1.5 * Math.PI - i / n * 2) / 20 + 1, i < 2e3 && (r *= Ms(i / 2e3)), i < 500 ? a = 0 : i < 1e3 && (a *= (i - 500) / 500), s - i < 750 && (r *= 1 - Ls(
5080
+ r *= Math.sin(1.5 * Math.PI - i / n * 2) / 20 + 1, i < 2e3 && (r *= Ls(i / 2e3)), i < 500 ? a = 0 : i < 1e3 && (a *= (i - 500) / 500), s - i < 750 && (r *= 1 - Ms(
5038
5081
  (750 - (s - i)) / 750 / 2
5039
- )), s - i < 375 && (a *= Q(
5082
+ )), s - i < 375 && (a *= it(
5040
5083
  0,
5041
5084
  (s - i) / 375,
5042
5085
  1
5043
5086
  ));
5044
5087
  const o = Math.max(0, s - 750);
5045
5088
  r = Math.max(0, r) * 0.7, e += ` scale(${r})`;
5046
- const c = Q(
5089
+ const h = it(
5047
5090
  0.25,
5048
5091
  i * 3 / o * 0.75,
5049
5092
  1
5050
- ), h = Q(
5093
+ ), c = it(
5051
5094
  0.25,
5052
5095
  (i - o / 3) * 3 / o * 0.75,
5053
5096
  1
5054
- ), l = Q(
5097
+ ), l = it(
5055
5098
  0.25,
5056
5099
  (i - o / 3 * 2) * 3 / o * 0.75,
5057
5100
  1
5058
5101
  );
5059
- this.dot0.style.opacity = `${Q(
5102
+ this.dot0.style.opacity = `${it(
5060
5103
  0,
5061
- Math.max(0, a * c),
5104
+ Math.max(0, a * h),
5062
5105
  1
5063
- )}`, this.dot1.style.opacity = `${Q(
5106
+ )}`, this.dot1.style.opacity = `${it(
5064
5107
  0,
5065
- Math.max(0, a * h),
5108
+ Math.max(0, a * c),
5066
5109
  1
5067
- )}`, this.dot2.style.opacity = `${Q(
5110
+ )}`, this.dot2.style.opacity = `${it(
5068
5111
  0,
5069
5112
  Math.max(0, a * l),
5070
5113
  1
@@ -5078,12 +5121,15 @@ class bs {
5078
5121
  this.element.remove();
5079
5122
  }
5080
5123
  }
5081
- class $t extends EventTarget {
5124
+ class qt extends EventTarget {
5082
5125
  constructor() {
5083
5126
  super();
5084
5127
  f(this, "element", document.createElement("div"));
5085
5128
  f(this, "currentTime", 0);
5129
+ /** @internal */
5086
5130
  f(this, "lyricLinesSize", /* @__PURE__ */ new WeakMap());
5131
+ /** @internal */
5132
+ f(this, "lyricLineElementMap", /* @__PURE__ */ new WeakMap());
5087
5133
  f(this, "currentLyricLines", []);
5088
5134
  // protected currentLyricLineObjects: LyricLineBase[] = [];
5089
5135
  f(this, "processedLines", []);
@@ -5139,39 +5185,65 @@ class $t extends EventTarget {
5139
5185
  });
5140
5186
  f(this, "scrolledHandler", 0);
5141
5187
  f(this, "isScrolled", !1);
5188
+ /** @internal */
5142
5189
  f(this, "resizeObserver", new ResizeObserver((e) => {
5143
- const s = e[0].contentRect;
5144
- this.size[0] = s.width, this.size[1] = s.height, this.onResize();
5190
+ let s = !1, i = !1;
5191
+ for (const n of e)
5192
+ if (n.target === this.element) {
5193
+ const r = n.contentRect;
5194
+ this.size[0] = r.width, this.size[1] = r.height, i = !0;
5195
+ } else if (n.target === this.interludeDots.getElement())
5196
+ this.interludeDotsSize[0] = n.target.clientWidth, this.interludeDotsSize[1] = n.target.clientHeight, s = !0;
5197
+ else if (n.target === this.bottomLine.getElement()) {
5198
+ const r = [
5199
+ n.target.clientWidth,
5200
+ n.target.clientHeight
5201
+ ], a = this.bottomLine.lineSize;
5202
+ (r[0] !== a[0] || r[1] !== a[1]) && (this.bottomLine.lineSize = r, s = !0);
5203
+ } else {
5204
+ const r = this.lyricLineElementMap.get(n.target);
5205
+ if (r) {
5206
+ const a = [
5207
+ n.target.clientWidth,
5208
+ n.target.clientHeight
5209
+ ], o = this.lyricLinesSize.get(
5210
+ r
5211
+ ) ?? [0, 0];
5212
+ (a[0] !== o[0] || a[1] !== o[1]) && (this.lyricLinesSize.set(r, a), r.onLineSizeChange(a), s = !0);
5213
+ }
5214
+ }
5215
+ s && this.calcLayout(!0), i && this.onResize();
5145
5216
  }));
5146
5217
  f(this, "wordFadeWidth", 0.5);
5147
5218
  f(this, "targetAlignIndex", 0);
5148
- this.resizeObserver.observe(this.element), this.element.classList.add(C.lyricPlayer), this.element.appendChild(this.interludeDots.getElement()), this.element.appendChild(this.bottomLine.getElement()), this.interludeDots.setTransform(0, 200), window.addEventListener("pageshow", this.onPageShow), window.addEventListener("pagehide", this.onPageHide);
5149
- let e = 0, s = "none", i = 0, n = 0, r = 0, a = Symbol("amll-scroll"), o = 0, c = 0;
5150
- this.element.addEventListener("touchstart", (h) => {
5151
- this.beginScrollHandler() && (h.preventDefault(), e = this.scrollOffset, i = h.touches[0].screenY, o = i, n = Date.now(), r = 0);
5152
- }), this.element.addEventListener("touchmove", (h) => {
5219
+ f(this, "isPlaying", !0);
5220
+ this.resizeObserver.observe(this.element), this.resizeObserver.observe(this.interludeDots.getElement()), this.element.classList.add(W.lyricPlayer), this.element.appendChild(this.interludeDots.getElement()), this.element.appendChild(this.bottomLine.getElement()), this.interludeDots.setTransform(0, 200), window.addEventListener("pageshow", this.onPageShow), window.addEventListener("pagehide", this.onPageHide);
5221
+ let e = 0, s = "none", i = 0, n = 0, r = 0, a = Symbol("amll-scroll"), o = 0, h = 0;
5222
+ this.element.addEventListener("touchstart", (c) => {
5223
+ this.beginScrollHandler() && (c.preventDefault(), e = this.scrollOffset, i = c.touches[0].screenY, o = i, n = Date.now(), r = 0);
5224
+ }), this.element.addEventListener("touchmove", (c) => {
5153
5225
  if (this.beginScrollHandler()) {
5154
- h.preventDefault();
5155
- const l = h.touches[0].screenY, p = l - i, u = l - o, y = u > 0 ? "down" : u < 0 ? "up" : "none";
5156
- s !== y ? (s = y, e = this.scrollOffset, i = l, n = Date.now()) : this.scrollOffset = e - p, o = l, c = Date.now(), this.limitScrollOffset(), this.calcLayout(!0);
5226
+ c.preventDefault();
5227
+ const l = c.touches[0].screenY, p = l - i, u = l - o, g = u > 0 ? "down" : u < 0 ? "up" : "none";
5228
+ s !== g ? (s = g, e = this.scrollOffset, i = l, n = Date.now()) : this.scrollOffset = e - p, o = l, h = Date.now(), this.limitScrollOffset(), this.calcLayout(!0);
5157
5229
  }
5158
- }), this.element.addEventListener("touchend", (h) => {
5230
+ }), this.element.addEventListener("touchend", (c) => {
5159
5231
  if (this.beginScrollHandler()) {
5160
- h.preventDefault(), i = 0;
5232
+ c.preventDefault(), i = 0;
5161
5233
  const l = Date.now();
5162
- if (l - c > 100) return this.endScrollHandler();
5234
+ if (l - h > 100) return this.endScrollHandler();
5163
5235
  const p = l - n;
5164
5236
  r = (this.scrollOffset - e) / p * 1e3;
5165
5237
  let u = 0;
5166
- const y = Symbol("amll-scroll");
5167
- a = y;
5168
- const L = (m) => {
5169
- u || (u = m), a === y && this.beginScrollHandler() && (this.scrollOffset += r * (m - u) / 1e3, r *= 0.99, this.limitScrollOffset(), this.calcLayout(!0), Math.abs(r) > 1 && !this.scrollBoundary.includes(this.scrollOffset) && requestAnimationFrame(L), this.endScrollHandler(), u = m);
5238
+ const g = Symbol("amll-scroll");
5239
+ a = g;
5240
+ const M = (d) => {
5241
+ u || (u = d), a === g && this.beginScrollHandler() && (this.scrollOffset += r * (d - u) / 1e3, r *= 0.99, this.limitScrollOffset(), this.calcLayout(!0), Math.abs(r) > 1 && !this.scrollBoundary.includes(this.scrollOffset) && requestAnimationFrame(M), this.endScrollHandler(), u = d);
5170
5242
  };
5171
- requestAnimationFrame(L), this.endScrollHandler();
5243
+ requestAnimationFrame(M), this.endScrollHandler();
5172
5244
  }
5173
- }), this.element.addEventListener("wheel", (h) => {
5174
- this.beginScrollHandler() && (h.deltaMode === h.DOM_DELTA_PIXEL ? (this.scrollOffset += h.deltaY, this.limitScrollOffset(), this.calcLayout(!0)) : (this.scrollOffset += h.deltaY * 50, this.limitScrollOffset(), this.calcLayout(!1)), this.endScrollHandler());
5245
+ }), this.element.addEventListener("wheel", (c) => {
5246
+ this.beginScrollHandler() && (c.deltaMode === c.DOM_DELTA_PIXEL ? (this.scrollOffset += c.deltaY, this.limitScrollOffset(), this.calcLayout(!0)) : (this.scrollOffset += c.deltaY * 50, this.limitScrollOffset(), this.calcLayout(!1)), this.endScrollHandler());
5175
5247
  });
5176
5248
  }
5177
5249
  beginScrollHandler() {
@@ -5270,7 +5342,7 @@ class $t extends EventTarget {
5270
5342
  * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一
5271
5343
  */
5272
5344
  setEnableSpring(e = !0) {
5273
- this.disableSpring = !e, e ? this.element.classList.remove(C.disableSpring) : this.element.classList.add(C.disableSpring), this.calcLayout(!0);
5345
+ this.disableSpring = !e, e ? this.element.classList.remove(W.disableSpring) : this.element.classList.add(W.disableSpring), this.calcLayout(!0);
5274
5346
  }
5275
5347
  /**
5276
5348
  * 获取当前是否启用了物理弹簧
@@ -5331,23 +5403,20 @@ class $t extends EventTarget {
5331
5403
  * @param initialTime 初始时间,默认为 0
5332
5404
  */
5333
5405
  setLyricLines(e, s = 0) {
5334
- this.initialLayoutFinished = !1;
5406
+ this.initialLayoutFinished = !0;
5335
5407
  for (const i of e)
5336
5408
  for (const n of i.words)
5337
5409
  n.word = n.word.replace(/\s+/g, " ");
5338
- this.lastCurrentTime = s, this.currentTime = s, this.currentLyricLines = ee(e), this.processedLines = ee(e), this.isNonDynamic = !0;
5410
+ this.lastCurrentTime = s, this.currentTime = s, this.currentLyricLines = Kt(e), this.processedLines = Kt(e), this.isNonDynamic = !0;
5339
5411
  for (const i of this.processedLines)
5340
5412
  if (i.words.length > 1) {
5341
5413
  this.isNonDynamic = !1;
5342
5414
  break;
5343
5415
  }
5344
5416
  this.hasDuetLine = this.processedLines.some((i) => i.isDuet), this.processedLines.forEach((i, n, r) => {
5345
- const a = r[n + 1];
5346
- i.words[i.words.length - 1] && (a ? a.startTime > i.endTime && (i.endTime = Math.min(i.endTime + 1500, a.startTime)) : i.endTime = i.endTime + 1500);
5347
- }), this.processedLines.forEach((i, n, r) => {
5348
5417
  if (i.isBG) return;
5349
5418
  const a = r[n + 1];
5350
- a != null && a.isBG && (a.startTime = Math.min(a.startTime, i.startTime));
5419
+ a != null && a.isBG && (a.startTime = Math.min(a.startTime, i.startTime), a.endTime = Math.max(a.endTime, i.endTime));
5351
5420
  });
5352
5421
  for (const i of this.currentLyricLineObjects)
5353
5422
  i.dispose();
@@ -5361,54 +5430,54 @@ class $t extends EventTarget {
5361
5430
  * @param time 当前播放进度,单位为毫秒
5362
5431
  */
5363
5432
  setCurrentTime(e, s = !1) {
5364
- var a, o, c, h, l, p, u, y, L;
5433
+ var a, o, h, c, l, p, u, g, M;
5365
5434
  if (this.currentTime = e, !this.initialLayoutFinished && !s) return;
5366
5435
  const i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
5367
- for (const m of this.hotLines) {
5368
- const g = this.processedLines[m];
5369
- if (g) {
5370
- if (g.isBG) return;
5371
- const b = this.processedLines[m + 1];
5436
+ for (const d of this.hotLines) {
5437
+ const y = this.processedLines[d];
5438
+ if (y) {
5439
+ if (y.isBG) continue;
5440
+ const b = this.processedLines[d + 1];
5372
5441
  if (b != null && b.isBG) {
5373
- const S = this.processedLines[m + 2], x = Math.min(g.startTime, b == null ? void 0 : b.startTime), T = Math.min(
5374
- Math.max(g.endTime, (S == null ? void 0 : S.startTime) ?? Number.MAX_VALUE),
5375
- Math.max(g.endTime, b == null ? void 0 : b.endTime)
5442
+ const w = this.processedLines[d + 2], L = Math.min(y.startTime, b == null ? void 0 : b.startTime), x = Math.min(
5443
+ Math.max(y.endTime, (w == null ? void 0 : w.startTime) ?? Number.MAX_VALUE),
5444
+ Math.max(y.endTime, b == null ? void 0 : b.endTime)
5376
5445
  );
5377
- (x > e || T <= e) && (this.hotLines.delete(m), i.add(m), this.hotLines.delete(m + 1), i.add(m + 1), s && ((a = this.currentLyricLineObjects[m]) == null || a.disable(), (o = this.currentLyricLineObjects[m + 1]) == null || o.disable()));
5378
- } else (g.startTime > e || g.endTime <= e) && (this.hotLines.delete(m), i.add(m), s && ((c = this.currentLyricLineObjects[m]) == null || c.disable()));
5446
+ (L > e || x <= e) && (this.hotLines.delete(d), i.add(d), this.hotLines.delete(d + 1), i.add(d + 1), s && ((a = this.currentLyricLineObjects[d]) == null || a.disable(), (o = this.currentLyricLineObjects[d + 1]) == null || o.disable()));
5447
+ } else (y.startTime > e || y.endTime <= e) && (this.hotLines.delete(d), i.add(d), s && ((h = this.currentLyricLineObjects[d]) == null || h.disable()));
5379
5448
  } else
5380
- this.hotLines.delete(m), i.add(m), s && ((h = this.currentLyricLineObjects[m]) == null || h.disable());
5449
+ this.hotLines.delete(d), i.add(d), s && ((c = this.currentLyricLineObjects[d]) == null || c.disable());
5381
5450
  }
5382
- this.currentLyricLineObjects.forEach((m, g, b) => {
5383
- var x, T;
5384
- const S = m.getLine();
5385
- !S.isBG && S.startTime <= e && S.endTime > e && (this.hotLines.has(g) || (this.hotLines.add(g), r.add(g), s && m.enable(), (T = (x = b[g + 1]) == null ? void 0 : x.getLine()) != null && T.isBG && (this.hotLines.add(g + 1), r.add(g + 1), s && b[g + 1].enable())));
5451
+ this.currentLyricLineObjects.forEach((d, y, b) => {
5452
+ var L, x;
5453
+ const w = d.getLine();
5454
+ !w.isBG && w.startTime <= e && w.endTime > e && (this.hotLines.has(y) || (this.hotLines.add(y), r.add(y), s && d.enable(), (x = (L = b[y + 1]) == null ? void 0 : L.getLine()) != null && x.isBG && (this.hotLines.add(y + 1), r.add(y + 1), s && b[y + 1].enable())));
5386
5455
  });
5387
- for (const m of this.bufferedLines)
5388
- this.hotLines.has(m) || (n.add(m), s && ((l = this.currentLyricLineObjects[m]) == null || l.disable()));
5456
+ for (const d of this.bufferedLines)
5457
+ this.hotLines.has(d) || (n.add(d), s && ((l = this.currentLyricLineObjects[d]) == null || l.disable()));
5389
5458
  if (s) {
5390
5459
  this.bufferedLines.size > 0 ? this.scrollToIndex = Math.min(...this.bufferedLines) : this.scrollToIndex = this.processedLines.findIndex(
5391
- (m) => m.startTime >= e
5460
+ (d) => d.startTime >= e
5392
5461
  ), this.bufferedLines.clear();
5393
- for (const m of this.hotLines)
5394
- this.bufferedLines.add(m);
5395
- this.calcLayout(!0);
5462
+ for (const d of this.hotLines)
5463
+ this.bufferedLines.add(d);
5464
+ this.calcLayout();
5396
5465
  } else if (n.size > 0 || r.size > 0)
5397
5466
  if (n.size === 0 && r.size > 0) {
5398
- for (const m of r)
5399
- this.bufferedLines.add(m), (p = this.currentLyricLineObjects[m]) == null || p.enable();
5467
+ for (const d of r)
5468
+ this.bufferedLines.add(d), (p = this.currentLyricLineObjects[d]) == null || p.enable();
5400
5469
  this.scrollToIndex = Math.min(...this.bufferedLines), this.calcLayout();
5401
5470
  } else if (r.size === 0 && n.size > 0) {
5402
5471
  if (ms(n, this.bufferedLines)) {
5403
- for (const m of this.bufferedLines)
5404
- this.hotLines.has(m) || (this.bufferedLines.delete(m), (u = this.currentLyricLineObjects[m]) == null || u.disable());
5472
+ for (const d of this.bufferedLines)
5473
+ this.hotLines.has(d) || (this.bufferedLines.delete(d), (u = this.currentLyricLineObjects[d]) == null || u.disable());
5405
5474
  this.calcLayout();
5406
5475
  }
5407
5476
  } else {
5408
- for (const m of r)
5409
- this.bufferedLines.add(m), (y = this.currentLyricLineObjects[m]) == null || y.enable();
5410
- for (const m of n)
5411
- this.bufferedLines.delete(m), (L = this.currentLyricLineObjects[m]) == null || L.disable();
5477
+ for (const d of r)
5478
+ this.bufferedLines.add(d), (g = this.currentLyricLineObjects[d]) == null || g.enable();
5479
+ for (const d of n)
5480
+ this.bufferedLines.delete(d), (M = this.currentLyricLineObjects[d]) == null || M.disable();
5412
5481
  this.bufferedLines.size > 0 && (this.scrollToIndex = Math.min(...this.bufferedLines)), this.calcLayout();
5413
5482
  }
5414
5483
  this.lastCurrentTime = e;
@@ -5430,59 +5499,54 @@ class $t extends EventTarget {
5430
5499
  * @param force 是否不经过动画直接修改布局定位
5431
5500
  * @param reflow 是否进行重新布局(重新计算每行歌词大小)
5432
5501
  */
5433
- async calcLayout(e, s) {
5434
- var y;
5435
- s && (await Promise.all(
5436
- this.currentLyricLineObjects.map(async (L) => {
5437
- const m = await L.measureSize();
5438
- this.lyricLinesSize.set(L, m);
5439
- })
5440
- ), this.interludeDotsSize[0] = this.interludeDots.getElement().clientWidth, this.interludeDotsSize[1] = this.interludeDots.getElement().clientHeight, this.bottomLine.lineSize = await this.bottomLine.measureSize());
5441
- const i = this.getCurrentInterlude();
5442
- let n = -this.scrollOffset, r = this.scrollToIndex, a = 0;
5443
- i ? (a = i[1] - i[0], a >= 4e3 && this.currentLyricLineObjects[i[2] + 1] && (r = i[2] + 1)) : this.interludeDots.setInterlude(void 0);
5444
- const o = this.currentLyricLineObjects.slice(0, r).reduce(
5445
- (L, m) => {
5446
- var g;
5447
- return L + (m.getLine().isBG ? 0 : ((g = this.lyricLinesSize.get(m)) == null ? void 0 : g[1]) ?? 0);
5502
+ async calcLayout(e = !1) {
5503
+ var g;
5504
+ const s = this.getCurrentInterlude();
5505
+ let i = -this.scrollOffset, n = this.scrollToIndex, r = 0;
5506
+ s ? (r = s[1] - s[0], r >= 4e3 && this.currentLyricLineObjects[s[2] + 1] && (n = s[2] + 1)) : this.interludeDots.setInterlude(void 0);
5507
+ const a = this.size[1] / 5, o = this.currentLyricLineObjects.slice(0, n).reduce(
5508
+ (M, d) => {
5509
+ var y;
5510
+ return M + (d.getLine().isBG && this.isPlaying ? 0 : ((y = this.lyricLinesSize.get(d)) == null ? void 0 : y[1]) ?? a);
5448
5511
  },
5449
5512
  0
5450
5513
  );
5451
- this.scrollBoundary[0] = -o, n -= o, n += this.size[1] * this.alignPosition;
5452
- const c = this.currentLyricLineObjects[r];
5453
- if (this.targetAlignIndex = r, c) {
5454
- const L = ((y = this.lyricLinesSize.get(c)) == null ? void 0 : y[1]) ?? 0;
5514
+ this.scrollBoundary[0] = -o, i -= o, i += this.size[1] * this.alignPosition;
5515
+ const h = this.currentLyricLineObjects[n];
5516
+ if (this.targetAlignIndex = n, h) {
5517
+ const M = ((g = this.lyricLinesSize.get(h)) == null ? void 0 : g[1]) ?? a;
5455
5518
  switch (this.alignAnchor) {
5456
5519
  case "bottom":
5457
- n -= L;
5520
+ i -= M;
5458
5521
  break;
5459
5522
  case "center":
5460
- n -= L / 2;
5523
+ i -= M / 2;
5461
5524
  break;
5462
5525
  }
5463
5526
  }
5464
- const h = Math.max(...this.bufferedLines);
5465
- let l = 0, p = 0.05, u = !1;
5466
- this.currentLyricLineObjects.forEach((L, m) => {
5467
- var w, z;
5468
- const g = this.bufferedLines.has(m), b = g || m >= this.scrollToIndex && m < h, S = L.getLine();
5469
- !u && a >= 4e3 && (m === this.scrollToIndex && (i == null ? void 0 : i[2]) === -2 || m === this.scrollToIndex + 1) && (u = !0, this.interludeDots.setTransform(0, n + 10), i && this.interludeDots.setInterlude([i[0], i[1]]), n += this.interludeDotsSize[1] + 40);
5470
- let x;
5471
- this.hidePassedLines ? m < (i ? i[2] + 1 : this.scrollToIndex) ? x = 0 : g ? x = 0.85 : x = this.isNonDynamic ? 0.2 : 1 : g ? x = 0.85 : x = this.isNonDynamic ? 0.2 : 1;
5472
- let T = 0;
5473
- this.enableBlur && (b ? T = 0 : (T = 1, m < this.scrollToIndex ? T += Math.abs(this.scrollToIndex - m) + 1 : T += Math.abs(
5474
- m - Math.max(this.scrollToIndex, h)
5527
+ const c = Math.max(...this.bufferedLines);
5528
+ let l = 0, p = e ? 0 : 0.05, u = !1;
5529
+ this.currentLyricLineObjects.forEach((M, d) => {
5530
+ var z, P;
5531
+ const y = this.bufferedLines.has(d), b = y || d >= this.scrollToIndex && d < c, w = M.getLine();
5532
+ !u && r >= 4e3 && (d === this.scrollToIndex && (s == null ? void 0 : s[2]) === -2 || d === this.scrollToIndex + 1) && (u = !0, this.interludeDots.setTransform(0, i), s && this.interludeDots.setInterlude([s[0], s[1]]), i += this.interludeDotsSize[1]);
5533
+ let L;
5534
+ this.hidePassedLines ? d < (s ? s[2] + 1 : this.scrollToIndex) && this.isPlaying ? L = 1e-5 : y ? L = 0.85 : L = this.isNonDynamic ? 0.2 : 1 : y ? L = 0.85 : L = this.isNonDynamic ? 0.2 : 1;
5535
+ let x = 0;
5536
+ this.enableBlur && (b ? x = 0 : (x = 1, d < this.scrollToIndex ? x += Math.abs(this.scrollToIndex - d) + 1 : x += Math.abs(
5537
+ d - Math.max(this.scrollToIndex, c)
5475
5538
  )));
5476
- const E = this.enableScale ? 97 : 100;
5477
- L.setTransform(
5478
- n,
5479
- b ? 100 : S.isBG ? 75 : E,
5480
- x,
5481
- window.innerWidth <= 1024 ? T * 0.8 : T,
5482
- e,
5539
+ const S = this.enableScale ? 97 : 100;
5540
+ let T = 100;
5541
+ !b && this.isPlaying && (w.isBG ? T = 75 : T = S), M.setTransform(
5542
+ i,
5543
+ T,
5544
+ L,
5545
+ window.innerWidth <= 1024 ? x * 0.8 : x,
5546
+ !1,
5483
5547
  l
5484
- ), S.isBG && b ? n += ((w = this.lyricLinesSize.get(L)) == null ? void 0 : w[1]) ?? 0 : S.isBG || (n += ((z = this.lyricLinesSize.get(L)) == null ? void 0 : z[1]) ?? 0), n >= 0 && !this.isSeeking && (S.isBG || (l += p), m >= this.scrollToIndex && (p /= 1.05));
5485
- }), this.scrollBoundary[1] = n + this.scrollOffset - this.size[1] / 2, this.bottomLine.setTransform(0, n, e, l);
5548
+ ), w.isBG && (b || !this.isPlaying) ? i += ((z = this.lyricLinesSize.get(M)) == null ? void 0 : z[1]) ?? a : w.isBG || (i += ((P = this.lyricLinesSize.get(M)) == null ? void 0 : P[1]) ?? a), i >= 0 && !this.isSeeking && (w.isBG || (l += p), d >= this.scrollToIndex && (p /= 1.05));
5549
+ }), this.scrollBoundary[1] = i + this.scrollOffset - this.size[1] / 2, this.bottomLine.setTransform(0, i, !1, l);
5486
5550
  }
5487
5551
  /**
5488
5552
  * 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。
@@ -5522,16 +5586,16 @@ class $t extends EventTarget {
5522
5586
  s.getLine().isBG ? s.lineTransforms.scale.updateParams(this.scaleForBGSpringParams) : s.lineTransforms.scale.updateParams(this.scaleSpringParams);
5523
5587
  }
5524
5588
  /**
5525
- * 暂停部分效果演出,目前会暂停播放间奏点的动画
5589
+ * 暂停部分效果演出,目前会暂停播放间奏点的动画,且将背景歌词显示出来
5526
5590
  */
5527
5591
  pause() {
5528
- this.interludeDots.pause();
5592
+ this.interludeDots.pause(), this.isPlaying && (this.isPlaying = !1, this.calcLayout());
5529
5593
  }
5530
5594
  /**
5531
5595
  * 恢复部分效果演出,目前会恢复播放间奏点的动画
5532
5596
  */
5533
5597
  resume() {
5534
- this.interludeDots.resume();
5598
+ this.interludeDots.resume(), this.isPlaying || (this.isPlaying = !0, this.calcLayout());
5535
5599
  }
5536
5600
  /**
5537
5601
  * 更新动画,这个函数应该被逐帧调用或者在以下情况下调用一次:
@@ -5589,7 +5653,7 @@ class $t extends EventTarget {
5589
5653
  this.element.remove(), window.removeEventListener("pageshow", this.onPageShow), window.removeEventListener("pagehide", this.onPageHide);
5590
5654
  }
5591
5655
  }
5592
- class q extends EventTarget {
5656
+ class H extends EventTarget {
5593
5657
  constructor() {
5594
5658
  super(...arguments);
5595
5659
  f(this, "top", 0);
@@ -5598,10 +5662,12 @@ class q extends EventTarget {
5598
5662
  f(this, "opacity", 1);
5599
5663
  f(this, "delay", 0);
5600
5664
  f(this, "lineTransforms", {
5601
- posY: new vt(0),
5602
- scale: new vt(100)
5665
+ posY: new Pt(0),
5666
+ scale: new Pt(100)
5603
5667
  });
5604
5668
  }
5669
+ onLineSizeChange(e) {
5670
+ }
5605
5671
  setTransform(e = this.top, s = this.scale, i = this.opacity, n = this.blur, r = !1, a = 0) {
5606
5672
  this.top = e, this.scale = s, this.opacity = i, this.blur = n, this.delay = a;
5607
5673
  }
@@ -5621,67 +5687,73 @@ class q extends EventTarget {
5621
5687
  dispose() {
5622
5688
  }
5623
5689
  }
5624
- function xs(d) {
5625
- return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
5626
- }
5627
- var Ts = 4, ws = 1e-3, Ss = 1e-7, Es = 10, mt = 11, Tt = 1 / (mt - 1), Ps = typeof Float32Array == "function";
5628
- function fe(d, t) {
5629
- return 1 - 3 * t + 3 * d;
5630
- }
5631
- function ue(d, t) {
5632
- return 3 * t - 6 * d;
5633
- }
5634
- function ye(d) {
5635
- return 3 * d;
5636
- }
5637
- function zt(d, t, e) {
5638
- return ((fe(t, e) * d + ue(t, e)) * d + ye(t)) * d;
5639
- }
5640
- function ge(d, t, e) {
5641
- return 3 * fe(t, e) * d * d + 2 * ue(t, e) * d + ye(t);
5690
+ function xs(m) {
5691
+ return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
5642
5692
  }
5643
- function vs(d, t, e, s, i) {
5644
- var n, r, a = 0;
5645
- do
5646
- r = t + (e - t) / 2, n = zt(r, s, i) - d, n > 0 ? e = r : t = r;
5647
- while (Math.abs(n) > Ss && ++a < Es);
5648
- return r;
5649
- }
5650
- function zs(d, t, e, s) {
5651
- for (var i = 0; i < Ts; ++i) {
5652
- var n = ge(t, e, s);
5653
- if (n === 0)
5654
- return t;
5655
- var r = zt(t, e, s) - d;
5656
- t -= r / n;
5657
- }
5658
- return t;
5659
- }
5660
- function ks(d) {
5661
- return d;
5693
+ var Ft, se;
5694
+ function Ts() {
5695
+ if (se) return Ft;
5696
+ se = 1;
5697
+ var m = 4, t = 1e-3, e = 1e-7, s = 10, i = 11, n = 1 / (i - 1), r = typeof Float32Array == "function";
5698
+ function a(M, d) {
5699
+ return 1 - 3 * d + 3 * M;
5700
+ }
5701
+ function o(M, d) {
5702
+ return 3 * d - 6 * M;
5703
+ }
5704
+ function h(M) {
5705
+ return 3 * M;
5706
+ }
5707
+ function c(M, d, y) {
5708
+ return ((a(d, y) * M + o(d, y)) * M + h(d)) * M;
5709
+ }
5710
+ function l(M, d, y) {
5711
+ return 3 * a(d, y) * M * M + 2 * o(d, y) * M + h(d);
5712
+ }
5713
+ function p(M, d, y, b, w) {
5714
+ var L, x, S = 0;
5715
+ do
5716
+ x = d + (y - d) / 2, L = c(x, b, w) - M, L > 0 ? y = x : d = x;
5717
+ while (Math.abs(L) > e && ++S < s);
5718
+ return x;
5719
+ }
5720
+ function u(M, d, y, b) {
5721
+ for (var w = 0; w < m; ++w) {
5722
+ var L = l(d, y, b);
5723
+ if (L === 0)
5724
+ return d;
5725
+ var x = c(d, y, b) - M;
5726
+ d -= x / L;
5727
+ }
5728
+ return d;
5729
+ }
5730
+ function g(M) {
5731
+ return M;
5732
+ }
5733
+ return Ft = function(d, y, b, w) {
5734
+ if (!(0 <= d && d <= 1 && 0 <= b && b <= 1))
5735
+ throw new Error("bezier x values must be in [0, 1] range");
5736
+ if (d === y && b === w)
5737
+ return g;
5738
+ for (var L = r ? new Float32Array(i) : new Array(i), x = 0; x < i; ++x)
5739
+ L[x] = c(x * n, d, b);
5740
+ function S(T) {
5741
+ for (var z = 0, P = 1, I = i - 1; P !== I && L[P] <= T; ++P)
5742
+ z += n;
5743
+ --P;
5744
+ var v = (T - L[P]) / (L[P + 1] - L[P]), D = z + v * n, F = l(D, d, b);
5745
+ return F >= t ? u(T, D, d, b) : F === 0 ? D : p(T, z, z + n, d, b);
5746
+ }
5747
+ return function(z) {
5748
+ return z === 0 ? 0 : z === 1 ? 1 : c(S(z), y, w);
5749
+ };
5750
+ }, Ft;
5662
5751
  }
5663
- var Is = function(t, e, s, i) {
5664
- if (!(0 <= t && t <= 1 && 0 <= s && s <= 1))
5665
- throw new Error("bezier x values must be in [0, 1] range");
5666
- if (t === e && s === i)
5667
- return ks;
5668
- for (var n = Ps ? new Float32Array(mt) : new Array(mt), r = 0; r < mt; ++r)
5669
- n[r] = zt(r * Tt, t, s);
5670
- function a(o) {
5671
- for (var c = 0, h = 1, l = mt - 1; h !== l && n[h] <= o; ++h)
5672
- c += Tt;
5673
- --h;
5674
- var p = (o - n[h]) / (n[h + 1] - n[h]), u = c + p * Tt, y = ge(u, t, s);
5675
- return y >= ws ? zs(o, u, t, s) : y === 0 ? u : vs(o, c, c + Tt, t, s);
5676
- }
5677
- return function(c) {
5678
- return c === 0 ? 0 : c === 1 ? 1 : zt(a(c), e, i);
5679
- };
5680
- };
5681
- const It = /* @__PURE__ */ xs(Is), Ds = /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u;
5682
- function qt(d) {
5752
+ var ws = Ts();
5753
+ const It = /* @__PURE__ */ xs(ws), Ss = /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u;
5754
+ function $t(m) {
5683
5755
  const t = [];
5684
- for (const n of d) {
5756
+ for (const n of m) {
5685
5757
  const r = n.word.replace(/\s/g, "").length, a = n.word.split(" ").filter((o) => o.trim().length > 0);
5686
5758
  if (a.length > 1) {
5687
5759
  n.word.startsWith(" ") && t.push({
@@ -5691,19 +5763,19 @@ function qt(d) {
5691
5763
  obscene: !1
5692
5764
  });
5693
5765
  let o = 0;
5694
- for (const c of a) {
5695
- const h = {
5696
- word: c,
5766
+ for (const h of a) {
5767
+ const c = {
5768
+ word: h,
5697
5769
  obscene: n.obscene,
5698
5770
  startTime: n.startTime + o / r * (n.endTime - n.startTime),
5699
- endTime: n.startTime + (o + c.length) / r * (n.endTime - n.startTime)
5771
+ endTime: n.startTime + (o + h.length) / r * (n.endTime - n.startTime)
5700
5772
  };
5701
- t.push(h), t.push({
5773
+ t.push(c), t.push({
5702
5774
  word: " ",
5703
5775
  startTime: 0,
5704
5776
  endTime: 0,
5705
5777
  obscene: !1
5706
- }), o += c.length;
5778
+ }), o += h.length;
5707
5779
  }
5708
5780
  n.word.endsWith(" ") || t.pop();
5709
5781
  } else
@@ -5715,11 +5787,11 @@ function qt(d) {
5715
5787
  const i = [];
5716
5788
  for (const n of t) {
5717
5789
  const r = n.word;
5718
- e.push(r), s.push(n), r.length > 0 && r.trim().length === 0 ? (e.pop(), s.pop(), s.length === 1 ? i.push(s[0]) : s.length > 1 && i.push(s), i.push(n), e = [], s = []) : (!/^\s*[^\s]*\s*$/.test(e.join("")) || Ds.test(r)) && (e.pop(), s.pop(), s.length === 1 ? i.push(s[0]) : s.length > 1 && i.push(s), e = [r], s = [n]);
5790
+ e.push(r), s.push(n), r.length > 0 && r.trim().length === 0 ? (e.pop(), s.pop(), s.length === 1 ? i.push(s[0]) : s.length > 1 && i.push(s), i.push(n), e = [], s = []) : (!/^\s*[^\s]*\s*$/.test(e.join("")) || Ss.test(r)) && (e.pop(), s.pop(), s.length === 1 ? i.push(s[0]) : s.length > 1 && i.push(s), e = [r], s = [n]);
5719
5791
  }
5720
5792
  return s.length === 1 ? i.push(s[0]) : i.push(s), i;
5721
5793
  }
5722
- function Le() {
5794
+ function fe() {
5723
5795
  return [
5724
5796
  1,
5725
5797
  0,
@@ -5739,69 +5811,53 @@ function Le() {
5739
5811
  1
5740
5812
  ];
5741
5813
  }
5742
- function Me(d, t = 1, e = { x: 0, y: 0 }) {
5814
+ function ue(m, t = 1, e = { x: 0, y: 0 }) {
5743
5815
  const [s, i] = [e.x, e.y];
5744
5816
  return [
5745
- d[0] * t,
5746
- d[1] * t,
5747
- d[2] * t,
5748
- d[3],
5749
- d[4] * t,
5750
- d[5] * t,
5751
- d[6] * t,
5752
- d[7],
5753
- d[8] * t,
5754
- d[9] * t,
5755
- d[10] * t,
5756
- d[11],
5757
- d[12] - s * t + s,
5758
- d[13] - i * t + i,
5759
- d[14],
5760
- d[15]
5817
+ m[0] * t,
5818
+ m[1] * t,
5819
+ m[2] * t,
5820
+ m[3],
5821
+ m[4] * t,
5822
+ m[5] * t,
5823
+ m[6] * t,
5824
+ m[7],
5825
+ m[8] * t,
5826
+ m[9] * t,
5827
+ m[10] * t,
5828
+ m[11],
5829
+ m[12] - s * t + s,
5830
+ m[13] - i * t + i,
5831
+ m[14],
5832
+ m[15]
5761
5833
  ];
5762
5834
  }
5763
- function be(d, t = 4) {
5835
+ function ye(m, t = 4) {
5764
5836
  const e = (s, i) => s.toFixed(t);
5765
- return `matrix3d(${d.map(e).join(", ")})`;
5837
+ return `matrix3d(${m.map(e).join(", ")})`;
5766
5838
  }
5767
- function xe(d) {
5768
- const t = [];
5769
- function e() {
5770
- const s = t[0];
5771
- s && d(...s.args).then((i) => {
5772
- s.resolve(i);
5773
- }).catch((i) => {
5774
- s.reject(i);
5775
- }).finally(() => {
5776
- t.shift(), t.length > 0 && e();
5777
- });
5778
- }
5779
- return (...s) => new Promise((i, n) => {
5780
- t.push({ resolve: i, reject: n, args: s }), t.length === 1 && e();
5781
- });
5782
- }
5783
- const wt = 32, Te = (d, t) => (e) => Math.min(1, Math.max(0, (e - d) / (t - d))), Ht = 0.5, Fs = Te(0, Ht), _s = Te(Ht, 1), As = It(0.2, 0.4, 0.58, 1), Rs = It(0.3, 0, 0.58, 1), Cs = (d) => (t) => t < d ? As(Fs(t)) : 1 - Rs(_s(t));
5784
- function ie(d, t = 0, e = "rgba(0,0,0,var(--bright-mask-alpha, 1.0))", s = "rgba(0,0,0,var(--dark-mask-alpha, 1.0))") {
5785
- const i = 2 + d + t, n = d / i, r = (1 - n) / 2;
5839
+ const St = 32, ge = (m, t) => (e) => Math.min(1, Math.max(0, (e - m) / (t - m))), Vt = 0.5, Es = ge(0, Vt), vs = ge(Vt, 1), Ps = It(0.2, 0.4, 0.58, 1), zs = It(0.3, 0, 0.58, 1), Is = (m) => (t) => t < m ? Ps(Es(t)) : 1 - zs(vs(t));
5840
+ function ie(m, t = 0, e = "rgba(0,0,0,var(--bright-mask-alpha, 1.0))", s = "rgba(0,0,0,var(--dark-mask-alpha, 1.0))") {
5841
+ const i = 2 + m + t, n = m / i, r = (1 - n) / 2;
5786
5842
  return [
5787
5843
  `linear-gradient(to right,${e} ${r * 100}%,${s} ${(r + n) * 100}%)`,
5788
5844
  i
5789
5845
  ];
5790
5846
  }
5791
- let Os = class extends MouseEvent {
5847
+ let ks = class extends MouseEvent {
5792
5848
  constructor(t, e) {
5793
5849
  super(e.type, e), this.line = t;
5794
5850
  }
5795
5851
  };
5796
- function Ws(d) {
5797
- const t = d.match(/matrix\(([^)]+)\)/);
5852
+ function Ds(m) {
5853
+ const t = m.match(/matrix\(([^)]+)\)/);
5798
5854
  if (t) {
5799
5855
  const e = t[1].split(", "), s = Number.parseFloat(e[0]), i = Number.parseFloat(e[3]);
5800
5856
  return (s + i) / 2;
5801
5857
  }
5802
5858
  return 1;
5803
5859
  }
5804
- let Ns = class extends q {
5860
+ let Fs = class extends H {
5805
5861
  constructor(e, s = {
5806
5862
  words: [],
5807
5863
  translatedLyric: "",
@@ -5818,7 +5874,7 @@ let Ns = class extends q {
5818
5874
  f(this, "lineSize", [0, 0]);
5819
5875
  f(this, "listenersMap", /* @__PURE__ */ new Map());
5820
5876
  f(this, "onMouseEvent", (e) => {
5821
- const s = new Os(this, e);
5877
+ const s = new ks(this, e);
5822
5878
  for (const i of this.listenersMap.get(e.type) ?? [])
5823
5879
  i.call(this, s);
5824
5880
  if (!this.dispatchEvent(s) || s.defaultPrevented)
@@ -5826,27 +5882,12 @@ let Ns = class extends q {
5826
5882
  });
5827
5883
  f(this, "isEnabled", !1);
5828
5884
  f(this, "lastWord");
5829
- f(this, "measureLockMark", !1);
5830
- f(this, "measureLock", xe(
5831
- async (e) => {
5832
- this.measureLockMark || (this.measureLockMark = !0, this._hide && await ot(() => {
5833
- this._prevParentEl.appendChild(this.element), this.element.style.display = "", this.element.style.visibility = "hidden";
5834
- }), await e(), this._hide && await ot(() => {
5835
- this._prevParentEl.removeChild(this.element), this.element.style.display = "none", this.element.style.visibility = "";
5836
- }), this.measureLockMark = !1);
5837
- }
5838
- ));
5839
5885
  f(this, "_hide", !0);
5840
5886
  f(this, "_prevParentEl");
5841
5887
  f(this, "lastStyle", "");
5842
- f(this, "maskImageDirty", !1);
5843
- f(this, "markImageDirtyPromiseResolve", /* @__PURE__ */ new Set());
5844
- f(this, "markImageDirtyPromise", new Promise((e) => {
5845
- this.markImageDirtyPromiseResolve.add(e);
5846
- }));
5847
- this.lyricPlayer = e, this.lyricLine = s, this._prevParentEl = e.getElement(), this.element.setAttribute("class", C.lyricLine), this.lyricLine.isBG && this.element.classList.add(C.lyricBgLine), this.lyricLine.isDuet && this.element.classList.add(C.lyricDuetLine), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div"));
5888
+ this.lyricPlayer = e, this.lyricLine = s, this._prevParentEl = e.getElement(), e.resizeObserver.observe(this.element), this.element.setAttribute("class", W.lyricLine), this.lyricLine.isBG && this.element.classList.add(W.lyricBgLine), this.lyricLine.isDuet && this.element.classList.add(W.lyricDuetLine), this.lineTransforms.posY.setPosition(window.innerHeight * 2), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div"));
5848
5889
  const i = this.element.children[0], n = this.element.children[1], r = this.element.children[2];
5849
- i.setAttribute("class", C.lyricMainLine), n.setAttribute("class", C.lyricSubLine), r.setAttribute("class", C.lyricSubLine), this.rebuildElement(), this.rebuildStyle(), this.markMaskImageDirty("Initial construction");
5890
+ i.setAttribute("class", W.lyricMainLine), n.setAttribute("class", W.lyricSubLine), r.setAttribute("class", W.lyricSubLine), this.rebuildElement(), this.rebuildStyle();
5850
5891
  }
5851
5892
  addMouseEventListener(e, s, i) {
5852
5893
  if (s) {
@@ -5868,7 +5909,7 @@ let Ns = class extends q {
5868
5909
  return !0;
5869
5910
  }
5870
5911
  async enable(e = this.lyricLine.startTime) {
5871
- this.isEnabled = !0, this.element.classList.add(C.active), await this.waitMaskImageUpdated();
5912
+ this.isEnabled = !0, this.element.classList.add(W.active);
5872
5913
  const s = this.element.children[0];
5873
5914
  for (const i of this.splittedWords) {
5874
5915
  for (const n of i.elementAnimations)
@@ -5879,18 +5920,18 @@ let Ns = class extends q {
5879
5920
  Math.max(0, e - this.lyricLine.startTime)
5880
5921
  ), n.playbackRate = 1, n.play();
5881
5922
  }
5882
- s.classList.add(C.active);
5923
+ s.classList.add(W.active);
5883
5924
  }
5884
5925
  disable() {
5885
- this.isEnabled = !1, this.element.classList.remove(C.active);
5926
+ this.isEnabled = !1, this.element.classList.remove(W.active);
5886
5927
  const e = this.element.children[0];
5887
5928
  for (const s of this.splittedWords)
5888
5929
  for (const i of s.elementAnimations)
5889
5930
  (i.id === "float-word" || i.id.includes("emphasize-word-float-only")) && (i.playbackRate = -1, i.play());
5890
- e.classList.remove(C.active);
5931
+ e.classList.remove(W.active);
5891
5932
  }
5892
5933
  async resume() {
5893
- if (await this.waitMaskImageUpdated(), !!this.isEnabled)
5934
+ if (this.isEnabled)
5894
5935
  for (const e of this.splittedWords) {
5895
5936
  for (const s of e.elementAnimations)
5896
5937
  (!this.lastWord || this.splittedWords.indexOf(this.lastWord) < this.splittedWords.indexOf(e)) && s.play();
@@ -5899,7 +5940,7 @@ let Ns = class extends q {
5899
5940
  }
5900
5941
  }
5901
5942
  async pause() {
5902
- if (await this.waitMaskImageUpdated(), !!this.isEnabled)
5943
+ if (this.isEnabled)
5903
5944
  for (const e of this.splittedWords) {
5904
5945
  for (const s of e.elementAnimations)
5905
5946
  s.pause();
@@ -5913,23 +5954,14 @@ let Ns = class extends q {
5913
5954
  for (const n of i.maskAnimations)
5914
5955
  n.currentTime = Math.min(this.totalDuration, Math.max(0, s)), n.playbackRate = 1, s >= 0 && s < this.totalDuration ? n.play() : n.pause();
5915
5956
  }
5916
- async measureSize() {
5917
- return await this.measureLock(async () => {
5918
- const e = await ft(() => [
5919
- this.element.clientWidth,
5920
- this.element.clientHeight
5921
- ]);
5922
- this.lineSize = e;
5923
- }), this.lineSize;
5924
- }
5925
5957
  getLine() {
5926
5958
  return this.lyricLine;
5927
5959
  }
5928
5960
  show() {
5929
- this._hide = !1, !this.measureLockMark && !this.element.parentElement && this._prevParentEl.appendChild(this.element), this.rebuildStyle();
5961
+ this._hide = !1, this.element.parentElement || (this._prevParentEl.appendChild(this.element), this.lyricPlayer.resizeObserver.observe(this.element)), this.rebuildStyle();
5930
5962
  }
5931
5963
  hide() {
5932
- this._hide = !0, !this.measureLockMark && this.element.parentElement && this._prevParentEl.removeChild(this.element);
5964
+ this._hide = !0, this.element.parentElement && (this._prevParentEl.removeChild(this.element), this.lyricPlayer.resizeObserver.unobserve(this.element));
5933
5965
  }
5934
5966
  rebuildStyle() {
5935
5967
  let e = "";
@@ -5944,7 +5976,7 @@ let Ns = class extends q {
5944
5976
  e.innerText = this.lyricLine.words.map((r) => r.word).join(""), s.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
5945
5977
  return;
5946
5978
  }
5947
- const n = qt(this.lyricLine.words);
5979
+ const n = $t(this.lyricLine.words);
5948
5980
  e.innerHTML = "";
5949
5981
  for (const r of n)
5950
5982
  if (Array.isArray(r)) {
@@ -5958,19 +5990,19 @@ let Ns = class extends q {
5958
5990
  wordType: "normal",
5959
5991
  obscene: !1
5960
5992
  }
5961
- ), o = r.map((l) => q.shouldEmphasize(l)).reduce((l, p) => l || p, q.shouldEmphasize(a)), c = document.createElement("span");
5962
- c.classList.add(C.emphasizeWrapper);
5963
- const h = [];
5993
+ ), o = r.map((l) => H.shouldEmphasize(l)).reduce((l, p) => l || p, H.shouldEmphasize(a)), h = document.createElement("span");
5994
+ h.classList.add(W.emphasizeWrapper);
5995
+ const c = [];
5964
5996
  for (const l of r) {
5965
5997
  const p = document.createElement("span");
5966
5998
  if (o) {
5967
- p.classList.add(C.emphasize);
5999
+ p.classList.add(W.emphasize);
5968
6000
  const u = [];
5969
- for (const L of l.word.trim().split("")) {
5970
- const m = document.createElement("span");
5971
- m.innerText = L, u.push(m), h.push(m), p.appendChild(m);
6001
+ for (const M of l.word.trim().split("")) {
6002
+ const d = document.createElement("span");
6003
+ d.innerText = M, u.push(d), c.push(d), p.appendChild(d);
5972
6004
  }
5973
- const y = {
6005
+ const g = {
5974
6006
  ...l,
5975
6007
  mainElement: p,
5976
6008
  subElements: u,
@@ -5981,7 +6013,7 @@ let Ns = class extends q {
5981
6013
  padding: 0,
5982
6014
  shouldEmphasize: o
5983
6015
  };
5984
- this.splittedWords.push(y);
6016
+ this.splittedWords.push(g);
5985
6017
  } else
5986
6018
  p.innerText = l.word, this.splittedWords.push({
5987
6019
  ...l,
@@ -5994,20 +6026,20 @@ let Ns = class extends q {
5994
6026
  padding: 0,
5995
6027
  shouldEmphasize: o
5996
6028
  });
5997
- c.appendChild(p);
6029
+ h.appendChild(p);
5998
6030
  }
5999
6031
  o && this.splittedWords[this.splittedWords.length - 1].elementAnimations.push(
6000
6032
  ...this.initEmphasizeAnimation(
6001
6033
  a,
6002
- h,
6034
+ c,
6003
6035
  a.endTime - a.startTime,
6004
6036
  a.startTime - this.lyricLine.startTime
6005
6037
  )
6006
- ), a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(c), a.word.trimEnd() !== a.word && q.shouldEmphasize(a) && e.appendChild(document.createTextNode(" "));
6038
+ ), a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(h), a.word.trimEnd() !== a.word && H.shouldEmphasize(a) && e.appendChild(document.createTextNode(" "));
6007
6039
  } else if (r.word.trim().length === 0)
6008
6040
  e.appendChild(document.createTextNode(" "));
6009
6041
  else {
6010
- const a = q.shouldEmphasize(r), o = document.createElement("span"), c = {
6042
+ const a = H.shouldEmphasize(r), o = document.createElement("span"), h = {
6011
6043
  ...r,
6012
6044
  mainElement: o,
6013
6045
  subElements: [],
@@ -6018,26 +6050,26 @@ let Ns = class extends q {
6018
6050
  padding: 0,
6019
6051
  shouldEmphasize: a
6020
6052
  };
6021
- if (q.shouldEmphasize(r)) {
6022
- o.classList.add(C.emphasize);
6023
- const h = [];
6053
+ if (H.shouldEmphasize(r)) {
6054
+ o.classList.add(W.emphasize);
6055
+ const c = [];
6024
6056
  for (const p of r.word.trim().split("")) {
6025
6057
  const u = document.createElement("span");
6026
- u.innerText = p, h.push(u), o.appendChild(u);
6058
+ u.innerText = p, c.push(u), o.appendChild(u);
6027
6059
  }
6028
- c.subElements = h;
6029
- const l = Math.abs(c.endTime - c.startTime);
6030
- c.elementAnimations.push(
6060
+ h.subElements = c;
6061
+ const l = Math.abs(h.endTime - h.startTime);
6062
+ h.elementAnimations.push(
6031
6063
  ...this.initEmphasizeAnimation(
6032
6064
  r,
6033
- h,
6065
+ c,
6034
6066
  l,
6035
- c.startTime - this.lyricLine.startTime
6067
+ h.startTime - this.lyricLine.startTime
6036
6068
  )
6037
6069
  );
6038
6070
  } else
6039
6071
  o.innerText = r.word.trim();
6040
- r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(o), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(c);
6072
+ r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(o), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(h);
6041
6073
  }
6042
6074
  s.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
6043
6075
  }
@@ -6069,95 +6101,70 @@ let Ns = class extends q {
6069
6101
  // 为了避免产生锯齿抖动感,使用 matrix3d 来实现缩放和位移
6070
6102
  initEmphasizeAnimation(e, s, i, n) {
6071
6103
  const r = Math.max(0, n);
6072
- let a = Math.max(1e3, i), o = [], c = a / 2e3;
6073
- c = c > 1 ? Math.sqrt(c) : c ** 3;
6074
- let h = a / 3e3;
6075
- h = h > 1 ? Math.sqrt(h) : h ** 3, c *= 0.6, h *= 0.5, this.lyricLine.words.length > 0 && e.word.includes(
6104
+ let a = Math.max(1e3, i), o = [], h = a / 2e3;
6105
+ h = h > 1 ? Math.sqrt(h) : h ** 3;
6106
+ let c = a / 3e3;
6107
+ c = c > 1 ? Math.sqrt(c) : c ** 3, h *= 0.6, c *= 0.5, this.lyricLine.words.length > 0 && e.word.includes(
6076
6108
  this.lyricLine.words[this.lyricLine.words.length - 1].word
6077
- ) && (c *= 1.6, h *= 1.5, a *= 1.2), c = Math.min(1.2, c), h = Math.min(0.8, h);
6078
- const l = Number.isFinite(a) ? a : 0, p = Cs(Ht);
6079
- return o = s.flatMap((u, y, L) => {
6080
- const m = r + a / 2.5 / L.length * y, g = [], b = new Array(wt).fill(0).map((E, w) => {
6081
- const z = (w + 1) / wt, v = p(z), k = p(z) * h, P = Me(Le(), 1 + v * 0.1 * c), D = -v * 0.03 * c * (L.length / 2 - y), A = -v * 0.025 * c;
6109
+ ) && (h *= 1.6, c *= 1.5, a *= 1.2), h = Math.min(1.2, h), c = Math.min(0.8, c);
6110
+ const l = Number.isFinite(a) ? a : 0, p = Is(Vt);
6111
+ return o = s.flatMap((u, g, M) => {
6112
+ const d = r + a / 2.5 / M.length * g, y = [], b = new Array(St).fill(0).map((S, T) => {
6113
+ const z = (T + 1) / St, P = p(z), I = p(z) * c, v = ue(fe(), 1 + P * 0.1 * h), D = -P * 0.03 * h * (M.length / 2 - g), F = -P * 0.025 * h;
6082
6114
  return {
6083
6115
  offset: z,
6084
- transform: `${be(
6085
- P,
6116
+ transform: `${ye(
6117
+ v,
6086
6118
  4
6087
- )} translate(${D}em, ${A}em)`,
6119
+ )} translate(${D}em, ${F}em)`,
6088
6120
  textShadow: `0 0 ${Math.min(
6089
6121
  0.3,
6090
- h * 0.3
6091
- )}em rgba(255, 255, 255, ${k})`
6122
+ c * 0.3
6123
+ )}em rgba(255, 255, 255, ${I})`
6092
6124
  };
6093
- }), S = u.animate(b, {
6125
+ }), w = u.animate(b, {
6094
6126
  duration: l,
6095
- delay: Number.isFinite(m) ? m : 0,
6096
- id: `emphasize-word-${u.innerText}-${y}`,
6127
+ delay: Number.isFinite(d) ? d : 0,
6128
+ id: `emphasize-word-${u.innerText}-${g}`,
6097
6129
  iterations: 1,
6098
6130
  composite: "replace",
6099
6131
  fill: "both"
6100
6132
  });
6101
- S.onfinish = () => {
6102
- S.pause();
6103
- }, S.pause(), g.push(S);
6104
- const x = new Array(wt).fill(0).map((E, w) => {
6105
- const z = (w + 1) / wt;
6106
- let v = Math.sin(z * Math.PI);
6107
- return this.lyricLine.isBG && (v *= 2), {
6133
+ w.onfinish = () => {
6134
+ w.pause();
6135
+ }, w.pause(), y.push(w);
6136
+ const L = new Array(St).fill(0).map((S, T) => {
6137
+ const z = (T + 1) / St;
6138
+ let P = Math.sin(z * Math.PI);
6139
+ return this.lyricLine.isBG && (P *= 2), {
6108
6140
  offset: z,
6109
- transform: `translateY(${-v * 0.05}em)`
6141
+ transform: `translateY(${-P * 0.05}em)`
6110
6142
  };
6111
- }), T = u.animate(x, {
6143
+ }), x = u.animate(L, {
6112
6144
  duration: l * 1.4,
6113
- delay: Number.isFinite(m) ? m - 400 : 0,
6145
+ delay: Number.isFinite(d) ? d - 400 : 0,
6114
6146
  id: "emphasize-word-float",
6115
6147
  iterations: 1,
6116
6148
  composite: "add",
6117
6149
  fill: "both"
6118
6150
  });
6119
- return T.onfinish = () => {
6120
- T.pause();
6121
- }, T.pause(), g.push(T), g;
6151
+ return x.onfinish = () => {
6152
+ x.pause();
6153
+ }, x.pause(), y.push(x), y;
6122
6154
  }), o;
6123
6155
  }
6124
6156
  get totalDuration() {
6125
6157
  return this.lyricLine.endTime - this.lyricLine.startTime;
6126
6158
  }
6127
- markMaskImageDirty(e = "") {
6128
- this.maskImageDirty = !0, this.element.classList.contains(C.dirty) || this.element.classList.add(C.dirty);
6129
- const s = Promise.all([
6130
- this.markImageDirtyPromise,
6131
- new Promise((i) => {
6132
- this.markImageDirtyPromiseResolve.add(i);
6133
- })
6134
- ]).then(() => {
6135
- });
6136
- return this.markImageDirtyPromise = s, s;
6137
- }
6138
- waitMaskImageUpdated() {
6139
- return this.markImageDirtyPromise;
6159
+ onLineSizeChange(e) {
6160
+ this.updateMaskImageSync();
6140
6161
  }
6141
- async updateMaskImage() {
6142
- this.maskImageDirty = !1, await this.measureLock(async () => {
6143
- await Promise.all(
6144
- this.splittedWords.map(async (e) => {
6145
- const s = e.mainElement;
6146
- s ? await ft(() => {
6147
- e.padding = Number.parseFloat(
6148
- getComputedStyle(s).paddingLeft
6149
- ), e.width = s.clientWidth - e.padding * 2, e.height = s.clientHeight - e.padding * 2;
6150
- }) : (e.width = 0, e.height = 0, e.padding = 0), e.width * e.height === 0 && console.warn("Word size is zero");
6151
- })
6152
- ), await ot(() => {
6153
- this.lyricPlayer.supportMaskImage ? this.generateWebAnimationBasedMaskImage() : this.generateCalcBasedMaskImage();
6154
- });
6155
- });
6156
- for (const e of this.markImageDirtyPromiseResolve)
6157
- e(), this.markImageDirtyPromiseResolve.delete(e);
6158
- await ot(() => {
6159
- this.element.classList.remove(C.dirty);
6160
- });
6162
+ updateMaskImageSync() {
6163
+ for (const e of this.splittedWords) {
6164
+ const s = e.mainElement;
6165
+ s ? (e.padding = Number.parseFloat(getComputedStyle(s).paddingLeft), e.width = s.clientWidth - e.padding * 2, e.height = s.clientHeight - e.padding * 2) : (e.width = 0, e.height = 0, e.padding = 0);
6166
+ }
6167
+ this.lyricPlayer.supportMaskImage ? this.generateWebAnimationBasedMaskImage() : this.generateCalcBasedMaskImage(), this.isEnabled && this.enable(this.lyricPlayer.getCurrentTime());
6161
6168
  }
6162
6169
  generateCalcBasedMaskImage() {
6163
6170
  for (const e of this.splittedWords) {
@@ -6168,8 +6175,8 @@ let Ns = class extends q {
6168
6175
  i / e.width
6169
6176
  ), a = `${r * 100}% 100%`;
6170
6177
  this.lyricPlayer.supportMaskImage ? (s.style.maskImage = n, s.style.maskRepeat = "no-repeat", s.style.maskOrigin = "left", s.style.maskSize = a) : (s.style.webkitMaskImage = n, s.style.webkitMaskRepeat = "no-repeat", s.style.webkitMaskOrigin = "left", s.style.webkitMaskSize = a);
6171
- const o = e.width + i, c = `clamp(${-o}px,calc(${-o}px + (var(--amll-player-time) - ${e.startTime})*${o / Math.abs(e.endTime - e.startTime)}px),0px) 0px, left top`;
6172
- s.style.maskPosition = c, s.style.webkitMaskPosition = c;
6178
+ const o = e.width + i, h = `clamp(${-o}px,calc(${-o}px + (var(--amll-player-time) - ${e.startTime})*${o / Math.abs(e.endTime - e.startTime)}px),0px) 0px, left top`;
6179
+ s.style.maskPosition = h, s.style.webkitMaskPosition = h;
6173
6180
  }
6174
6181
  }
6175
6182
  }
@@ -6183,57 +6190,57 @@ let Ns = class extends q {
6183
6190
  if (n) {
6184
6191
  const r = s.height * this.lyricPlayer.getWordFadeWidth(), [a, o] = ie(
6185
6192
  r / (s.width + s.padding * 2)
6186
- ), c = `${o * 100}% 100%`;
6187
- this.lyricPlayer.supportMaskImage ? (n.style.maskImage = a, n.style.maskRepeat = "no-repeat", n.style.maskOrigin = "left", n.style.maskSize = c) : (n.style.webkitMaskImage = a, n.style.webkitMaskRepeat = "no-repeat", n.style.webkitMaskOrigin = "left", n.style.webkitMaskSize = c);
6188
- const h = this.splittedWords.slice(0, i).reduce((x, T) => x + T.width, 0) + (this.splittedWords[0] ? r : 0), l = -(s.width + s.padding * 2 + r), p = (x) => Math.max(l, Math.min(0, x));
6189
- let u = -h - s.width - s.padding - r, y = 0;
6190
- const L = [];
6191
- let m = u, g = 0;
6193
+ ), h = `${o * 100}% 100%`;
6194
+ this.lyricPlayer.supportMaskImage ? (n.style.maskImage = a, n.style.maskRepeat = "no-repeat", n.style.maskOrigin = "left", n.style.maskSize = h) : (n.style.webkitMaskImage = a, n.style.webkitMaskRepeat = "no-repeat", n.style.webkitMaskOrigin = "left", n.style.webkitMaskSize = h);
6195
+ const c = this.splittedWords.slice(0, i).reduce((L, x) => L + x.width, 0) + (this.splittedWords[0] ? r : 0), l = -(s.width + s.padding * 2 + r), p = (L) => Math.max(l, Math.min(0, L));
6196
+ let u = -c - s.width - s.padding - r, g = 0;
6197
+ const M = [];
6198
+ let d = u, y = 0;
6192
6199
  const b = () => {
6193
- const x = u - m, T = Math.max(0, Math.min(1, y)), E = T - g, w = Math.abs(E / x);
6194
- if (u > l && m < l) {
6195
- const k = Math.abs(m - l) * w, P = `${p(m)}px 0`, D = {
6196
- offset: g + k,
6197
- maskPosition: P
6200
+ const L = u - d, x = Math.max(0, Math.min(1, g)), S = x - y, T = Math.abs(S / L);
6201
+ if (u > l && d < l) {
6202
+ const I = Math.abs(d - l) * T, v = `${p(d)}px 0`, D = {
6203
+ offset: y + I,
6204
+ maskPosition: v
6198
6205
  };
6199
- L.push(D);
6206
+ M.push(D);
6200
6207
  }
6201
- if (u > 0 && m < 0) {
6202
- const k = Math.abs(m) * w, P = `${p(u)}px 0`, D = {
6203
- offset: g + k,
6204
- maskPosition: P
6208
+ if (u > 0 && d < 0) {
6209
+ const I = Math.abs(d) * T, v = `${p(u)}px 0`, D = {
6210
+ offset: y + I,
6211
+ maskPosition: v
6205
6212
  };
6206
- L.push(D);
6213
+ M.push(D);
6207
6214
  }
6208
- const z = `${p(u)}px 0`, v = {
6209
- offset: T,
6215
+ const z = `${p(u)}px 0`, P = {
6216
+ offset: x,
6210
6217
  maskPosition: z
6211
6218
  };
6212
- L.push(v), m = u, g = T;
6219
+ M.push(P), d = u, y = x;
6213
6220
  };
6214
6221
  b();
6215
- let S = 0;
6216
- this.splittedWords.forEach((x, T) => {
6222
+ let w = 0;
6223
+ this.splittedWords.forEach((L, x) => {
6217
6224
  {
6218
- const E = x.startTime - this.lyricLine.startTime, w = E - S;
6219
- y += w / e, w > 0 && b(), S = E;
6225
+ const S = L.startTime - this.lyricLine.startTime, T = S - w;
6226
+ g += T / e, T > 0 && b(), w = S;
6220
6227
  }
6221
6228
  {
6222
- const E = x.endTime - x.startTime;
6223
- y += E / e, u += x.width, T === 0 && (u += r * 1.5), T === this.splittedWords.length - 1 && (u += r * 0.5), E > 0 && b(), S += E;
6229
+ const S = L.endTime - L.startTime;
6230
+ g += S / e, u += L.width, x === 0 && (u += r * 1.5), x === this.splittedWords.length - 1 && (u += r * 0.5), S > 0 && b(), w += S;
6224
6231
  }
6225
6232
  });
6226
- for (const x of s.maskAnimations)
6227
- x.cancel();
6233
+ for (const L of s.maskAnimations)
6234
+ L.cancel();
6228
6235
  try {
6229
- const x = n.animate(L, {
6236
+ const L = n.animate(M, {
6230
6237
  duration: e || 1,
6231
6238
  id: `fade-word-${s.word}-${i}`,
6232
6239
  fill: "both"
6233
6240
  });
6234
- x.pause(), s.maskAnimations = [x];
6235
- } catch (x) {
6236
- console.warn("应用渐变动画发生错误", L, e, x);
6241
+ L.pause(), s.maskAnimations = [L];
6242
+ } catch (L) {
6243
+ console.warn("应用渐变动画发生错误", M, e, L);
6237
6244
  }
6238
6245
  }
6239
6246
  });
@@ -6243,20 +6250,17 @@ let Ns = class extends q {
6243
6250
  }
6244
6251
  setTransform(e = this.top, s = this.scale, i = 1, n = 0, r = !1, a = 0) {
6245
6252
  super.setTransform(e, s, i, n, r, a);
6246
- const o = this.isInSight, c = this.lyricPlayer.getEnableSpring();
6253
+ const o = this.isInSight, h = this.lyricPlayer.getEnableSpring();
6247
6254
  this.top = e, this.scale = s, this.delay = a * 1e3 | 0;
6248
- const h = this.element.children[0];
6249
- if (h.style.opacity = `${i}`, r || !c) {
6250
- if (this.blur = Math.min(32, n), r && this.element.classList.add(C.tmpDisableTransition), this.lineTransforms.posY.setPosition(e), this.lineTransforms.scale.setPosition(s), c)
6255
+ const c = this.element.children[0];
6256
+ if (c.style.opacity = `${i}`, r || !h)
6257
+ if (this.blur = Math.min(32, n), this.lineTransforms.posY.setPosition(e), this.lineTransforms.scale.setPosition(s), h)
6251
6258
  this.rebuildStyle();
6252
6259
  else {
6253
6260
  const l = this.isInSight;
6254
6261
  o || l ? this.show() : this.hide();
6255
6262
  }
6256
- r && requestAnimationFrame(() => {
6257
- this.element.classList.remove(C.tmpDisableTransition);
6258
- });
6259
- } else if (this.lineTransforms.posY.setTargetPosition(e, a), this.lineTransforms.scale.setTargetPosition(s), this.blur !== Math.min(32, n)) {
6263
+ else if (this.lineTransforms.posY.setTargetPosition(e, a), this.lineTransforms.scale.setTargetPosition(s), this.blur !== Math.min(32, n)) {
6260
6264
  this.blur = Math.min(32, n);
6261
6265
  const l = n.toFixed(3);
6262
6266
  this.element.style.filter = `blur(${l}px)`;
@@ -6264,7 +6268,7 @@ let Ns = class extends q {
6264
6268
  }
6265
6269
  update(e = 0) {
6266
6270
  if (this.lyricPlayer.getEnableSpring())
6267
- if (this.lineTransforms.posY.update(e), this.lineTransforms.scale.update(e), this.isInSight ? (this.show(), this.maskImageDirty && this.updateMaskImage()) : this.hide(), this.lyricPlayer.getEnableSpring())
6271
+ if (this.lineTransforms.posY.update(e), this.lineTransforms.scale.update(e), this.isInSight ? this.show() : this.hide(), this.lyricPlayer.getEnableSpring())
6268
6272
  this.element.style.setProperty(
6269
6273
  "--bright-mask-alpha",
6270
6274
  `${Math.max(
@@ -6285,7 +6289,7 @@ let Ns = class extends q {
6285
6289
  ) * 0.2 + 0.2}`
6286
6290
  );
6287
6291
  else {
6288
- const i = window.getComputedStyle(this.element).transform, n = Ws(i);
6292
+ const i = window.getComputedStyle(this.element).transform, n = Ds(i);
6289
6293
  this.element.style.setProperty(
6290
6294
  "--bright-mask-alpha",
6291
6295
  `${Math.max(0, Math.min(1, (n - 0.97) / 0.03)) * 0.8 + 0.2}`
@@ -6299,7 +6303,8 @@ let Ns = class extends q {
6299
6303
  return `[位移: ${this.top}; 缩放: ${this.scale}; 延时: ${this.delay}]`;
6300
6304
  }
6301
6305
  get isInSight() {
6302
- const e = this.lineTransforms.posY.getCurrentPosition(), s = this.lineSize[1], i = e + s, n = this.lyricPlayer.size[1];
6306
+ var r;
6307
+ const e = this.lineTransforms.posY.getCurrentPosition(), s = ((r = this.lyricPlayer.lyricLinesSize.get(this)) == null ? void 0 : r[1]) ?? 0, i = e + s, n = this.lyricPlayer.size[1];
6303
6308
  return !(e > n + s || i < -s);
6304
6309
  }
6305
6310
  disposeElements() {
@@ -6316,31 +6321,23 @@ let Ns = class extends q {
6316
6321
  this.splittedWords = [];
6317
6322
  }
6318
6323
  dispose() {
6319
- this.disposeElements(), this.element.remove();
6324
+ this.disposeElements(), this.lyricPlayer.resizeObserver.unobserve(this.element), this.element.remove();
6320
6325
  }
6321
6326
  };
6322
- class we extends MouseEvent {
6327
+ class Me extends MouseEvent {
6323
6328
  constructor(t, e, s) {
6324
6329
  super(`line-${s.type}`, s), this.lineIndex = t, this.line = e;
6325
6330
  }
6326
6331
  }
6327
- class Bs extends $t {
6332
+ class pi extends qt {
6328
6333
  constructor() {
6329
6334
  super();
6330
6335
  f(this, "currentLyricLineObjects", []);
6331
- f(this, "debounceCalcLayout", he(
6332
- () => this.calcLayout(!0, !0).then(
6333
- () => this.currentLyricLineObjects.map(async (e, s) => {
6334
- e.markMaskImageDirty("DomLyricPlayer onResize"), await e.waitMaskImageUpdated(), this.hotLines.has(s) && (e.enable(this.currentTime), e.resume());
6335
- })
6336
- ),
6337
- 1e3
6338
- ));
6339
6336
  f(this, "supportPlusLighter", CSS.supports("mix-blend-mode", "plus-lighter"));
6340
6337
  f(this, "supportMaskImage", CSS.supports("mask-image", "none"));
6341
6338
  f(this, "innerSize", [0, 0]);
6342
6339
  f(this, "onLineClickedHandler", (e) => {
6343
- const s = new we(
6340
+ const s = new Me(
6344
6341
  this.lyricLinesIndexes.get(e.line) ?? -1,
6345
6342
  e.line,
6346
6343
  e
@@ -6350,16 +6347,11 @@ class Bs extends $t {
6350
6347
  f(this, "_baseFontSize", Number.parseFloat(
6351
6348
  getComputedStyle(this.element).fontSize
6352
6349
  ));
6353
- this.onResize(), this.element.classList.add("amll-lyric-player", "dom"), this.disableSpring && this.element.classList.add(C.disableSpring);
6350
+ this.onResize(), this.element.classList.add("amll-lyric-player", "dom"), this.disableSpring && this.element.classList.add(W.disableSpring);
6354
6351
  }
6355
6352
  onResize() {
6356
6353
  const e = getComputedStyle(this.element);
6357
- this._baseFontSize = Number.parseFloat(e.fontSize);
6358
- const s = this.element.clientWidth - Number.parseFloat(e.paddingLeft) - Number.parseFloat(e.paddingRight), i = this.element.clientHeight - Number.parseFloat(e.paddingTop) - Number.parseFloat(e.paddingBottom);
6359
- this.innerSize[0] = s, this.innerSize[1] = i, this.rebuildStyle();
6360
- for (const n of this.currentLyricLineObjects)
6361
- n.getElement().classList.contains(C.dirty) || n.getElement().classList.add(C.dirty);
6362
- this.debounceCalcLayout();
6354
+ this._baseFontSize = Number.parseFloat(e.fontSize), this.rebuildStyle();
6363
6355
  }
6364
6356
  /**
6365
6357
  * 是否为非逐词歌词
@@ -6372,16 +6364,11 @@ class Bs extends $t {
6372
6364
  return this._baseFontSize;
6373
6365
  }
6374
6366
  rebuildStyle() {
6375
- const e = this.innerSize[0], s = this.innerSize[1];
6376
- this.element.style.setProperty("--amll-lp-width", `${e.toFixed(4)}px`), this.element.style.setProperty(
6377
- "--amll-lp-height",
6378
- `${s.toFixed(4)}px`
6379
- );
6380
6367
  }
6381
6368
  setWordFadeWidth(e = 0.5) {
6382
6369
  super.setWordFadeWidth(e);
6383
6370
  for (const s of this.currentLyricLineObjects)
6384
- s.markMaskImageDirty("DomLyricPlayer setWordFadeWidth");
6371
+ s.updateMaskImageSync();
6385
6372
  }
6386
6373
  /**
6387
6374
  * 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误
@@ -6389,28 +6376,29 @@ class Bs extends $t {
6389
6376
  * @param initialTime 初始时间,默认为 0
6390
6377
  */
6391
6378
  setLyricLines(e, s = 0) {
6392
- super.setLyricLines(e, s), this.hasDuetLine ? this.element.classList.add(C.hasDuetLine) : this.element.classList.remove(C.hasDuetLine);
6379
+ super.setLyricLines(e, s), this.hasDuetLine ? this.element.classList.add(W.hasDuetLine) : this.element.classList.remove(W.hasDuetLine), this.supportMaskImage || this.element.style.setProperty("--amll-player-time", `${s}`);
6393
6380
  for (const i of this.currentLyricLineObjects)
6394
6381
  i.removeMouseEventListener("click", this.onLineClickedHandler), i.removeMouseEventListener("contextmenu", this.onLineClickedHandler), i.dispose();
6395
6382
  this.currentLyricLineObjects = this.processedLines.map((i, n) => {
6396
- const r = new Ns(this, i);
6397
- return r.addMouseEventListener("click", this.onLineClickedHandler), r.addMouseEventListener("contextmenu", this.onLineClickedHandler), this.element.appendChild(r.getElement()), this.lyricLinesIndexes.set(r, n), r.markMaskImageDirty("DomLyricPlayer setLyricLines"), r;
6398
- }), this.setLinePosXSpringParams({}), this.setLinePosYSpringParams({}), this.setLineScaleSpringParams({}), this.calcLayout(!0, !0).then(() => {
6399
- this.initialLayoutFinished = !0;
6400
- });
6383
+ const r = new Fs(this, i);
6384
+ return r.addMouseEventListener("click", this.onLineClickedHandler), r.addMouseEventListener("contextmenu", this.onLineClickedHandler), this.element.appendChild(r.getElement()), this.lyricLinesIndexes.set(r, n), this.lyricLineElementMap.set(r.getElement(), r), r;
6385
+ }), this.setLinePosXSpringParams({}), this.setLinePosYSpringParams({}), this.setLineScaleSpringParams({}), this.calcLayout(!0);
6401
6386
  }
6402
6387
  pause() {
6403
- super.pause(), this.interludeDots.pause();
6388
+ super.pause(), this.element.classList.remove("playing"), this.interludeDots.pause();
6404
6389
  for (const e of this.currentLyricLineObjects)
6405
6390
  e.pause();
6406
6391
  }
6407
6392
  resume() {
6408
- super.resume(), this.interludeDots.resume();
6393
+ super.resume(), this.element.classList.add("playing"), this.interludeDots.resume();
6409
6394
  for (const e of this.currentLyricLineObjects)
6410
6395
  e.resume();
6411
6396
  }
6412
6397
  update(e = 0) {
6413
- if (!this.initialLayoutFinished || (super.update(e), !this.isPageVisible)) return;
6398
+ if (!this.initialLayoutFinished || (super.update(e), this.supportMaskImage || this.element.style.setProperty(
6399
+ "--amll-player-time",
6400
+ `${this.currentTime}`
6401
+ ), !this.isPageVisible)) return;
6414
6402
  const s = e / 1e3;
6415
6403
  this.interludeDots.update(e), this.bottomLine.update(s);
6416
6404
  for (const i of this.currentLyricLineObjects)
@@ -6423,19 +6411,19 @@ class Bs extends $t {
6423
6411
  this.bottomLine.dispose(), this.interludeDots.dispose();
6424
6412
  }
6425
6413
  }
6426
- const $s = /^\s+/, qs = /^[\p{L}0-9!"#$%&’()*+,-./:;<=>?@\[\]^_`\{|\}~]+/iu;
6427
- function* Hs(d, t, e, s = 0) {
6428
- let i = s, n = 0, r = 0, a = 0, o = !1, c = null;
6429
- const h = d.measureText(" ");
6414
+ const As = /^\s+/, _s = /^[\p{L}0-9!"#$%&’()*+,-./:;<=>?@\[\]^_`\{|\}~]+/iu;
6415
+ function* Rs(m, t, e, s = 0) {
6416
+ let i = s, n = 0, r = 0, a = 0, o = !1, h = null;
6417
+ const c = m.measureText(" ");
6430
6418
  for (; a < t.length; ) {
6431
6419
  const l = t.substring(a);
6432
- if (c = l.match($s), c) {
6433
- o = !0, r = a, a += c[0].length;
6420
+ if (h = l.match(As), h) {
6421
+ o = !0, r = a, a += h[0].length;
6434
6422
  continue;
6435
6423
  }
6436
- if (c = l.match(qs), c) {
6437
- a += c[0].length;
6438
- const p = c[0], u = d.measureText(p);
6424
+ if (h = l.match(_s), h) {
6425
+ a += h[0].length;
6426
+ const p = h[0], u = m.measureText(p);
6439
6427
  i + u.width > e.maxWidth && (i = 0, n++, o = !1), o && (o = !1, yield {
6440
6428
  text: " ",
6441
6429
  index: r,
@@ -6443,20 +6431,20 @@ function* Hs(d, t, e, s = 0) {
6443
6431
  width: 0,
6444
6432
  height: e.fontSize,
6445
6433
  x: i
6446
- }, i += h.width);
6447
- let y = "", L = null;
6448
- for (const m of p) {
6449
- const g = d.measureText(`${y}${m}`), b = d.measureText(m);
6450
- y !== "" && (i = i + g.width - b.width), i + b.width > e.maxWidth && (i = 0, n++), yield {
6451
- text: m,
6434
+ }, i += c.width);
6435
+ let g = "", M = null;
6436
+ for (const d of p) {
6437
+ const y = m.measureText(`${g}${d}`), b = m.measureText(d);
6438
+ g !== "" && (i = i + y.width - b.width), i + b.width > e.maxWidth && (i = 0, n++), yield {
6439
+ text: d,
6452
6440
  index: a,
6453
6441
  lineIndex: n,
6454
6442
  width: b.width,
6455
6443
  height: e.fontSize,
6456
6444
  x: i
6457
- }, y = m, L = b;
6445
+ }, g = d, M = b;
6458
6446
  }
6459
- L && (i += L.width);
6447
+ M && (i += M.width);
6460
6448
  continue;
6461
6449
  }
6462
6450
  {
@@ -6467,8 +6455,8 @@ function* Hs(d, t, e, s = 0) {
6467
6455
  width: 0,
6468
6456
  height: e.fontSize,
6469
6457
  x: i
6470
- }, i += h.width);
6471
- const p = d.measureText(t[a]);
6458
+ }, i += c.width);
6459
+ const p = m.measureText(t[a]);
6472
6460
  i + p.width > e.maxWidth && (i = 0, n++), yield {
6473
6461
  text: t[a],
6474
6462
  index: a,
@@ -6482,7 +6470,7 @@ function* Hs(d, t, e, s = 0) {
6482
6470
  }
6483
6471
  return { x: i, lineIndex: n };
6484
6472
  }
6485
- function* _t(d, t, e, s = 0) {
6473
+ function* At(m, t, e, s = 0) {
6486
6474
  let i = {
6487
6475
  text: "",
6488
6476
  index: 0,
@@ -6491,13 +6479,13 @@ function* _t(d, t, e, s = 0) {
6491
6479
  height: 0,
6492
6480
  x: 0
6493
6481
  };
6494
- for (const n of Hs(d, t, e, s))
6482
+ for (const n of Rs(m, t, e, s))
6495
6483
  n.lineIndex !== i.lineIndex ? (i.text.length && (yield i), i = {
6496
6484
  ...n
6497
6485
  }) : (i.text += n.text, i.width = n.x + n.width);
6498
6486
  i.text.length && (yield i);
6499
6487
  }
6500
- class js extends q {
6488
+ class Cs extends H {
6501
6489
  constructor(e, s = {
6502
6490
  words: [],
6503
6491
  translatedLyric: "",
@@ -6540,17 +6528,16 @@ class js extends q {
6540
6528
  const e = {
6541
6529
  fontSize: this.player.baseFontSize,
6542
6530
  maxWidth: this.player.size[0] - 50,
6543
- lineHeight: this.player.baseFontSize,
6544
- uniformSpace: !0
6531
+ lineHeight: this.player.baseFontSize
6545
6532
  }, s = this.player.ctx;
6546
6533
  this.player.setFontSize(1);
6547
- for (const r of qt(this.line.words))
6534
+ for (const r of $t(this.line.words))
6548
6535
  Array.isArray(r) && r.length;
6549
6536
  this.layoutWords = [
6550
- [..._t(s, this.line.words.map((r) => r.word).join(""), e)]
6537
+ [...At(s, this.line.words.map((r) => r.word).join(""), e)]
6551
6538
  ], this.player.setFontSize(0.5), this.translatedLayoutWords = [
6552
- ..._t(s, this.line.translatedLyric, e)
6553
- ], this.romanLayoutWords = [..._t(s, this.line.romanLyric, e)], this.measureSize(), this.lineCanvas.width = this.player.ctx.canvas.width, this.lineCanvas.height = this.lineSize[1] * devicePixelRatio;
6539
+ ...At(s, this.line.translatedLyric, e)
6540
+ ], this.romanLayoutWords = [...At(s, this.line.romanLyric, e)], this.measureSize(), this.lineCanvas.width = this.player.ctx.canvas.width, this.lineCanvas.height = this.lineSize[1] * devicePixelRatio;
6554
6541
  const i = this.lineCanvas.getContext("2d");
6555
6542
  i.globalAlpha = 1, this.player.setFontSize(1), i.font = s.font, i.scale(devicePixelRatio, devicePixelRatio), i.fillStyle = "white", i.textBaseline = "top", i.textAlign = "left", i.font = `${this.player.baseFontSize}px ${this.player.baseFontFamily}`;
6556
6543
  let n = 0;
@@ -6600,7 +6587,7 @@ class js extends q {
6600
6587
  s.save(), s.fillStyle = "white", s.filter = `blur(${this.blur}px)`, s.textRendering = "geometricPrecision", s.globalAlpha = this.opacity, s.translate(0, this.lineTransforms.posY.getCurrentPosition()), s.scale(1 / devicePixelRatio, 1 / devicePixelRatio), this.lineCanvas.width * this.lineCanvas.height > 0 && s.drawImage(this.lineCanvas, 0, 0), s.restore();
6601
6588
  }
6602
6589
  }
6603
- class Ti extends $t {
6590
+ class fi extends qt {
6604
6591
  constructor() {
6605
6592
  super();
6606
6593
  f(this, "canvasElement", document.createElement("canvas"));
@@ -6623,8 +6610,8 @@ class Ti extends $t {
6623
6610
  }
6624
6611
  setLyricLines(e, s) {
6625
6612
  super.setLyricLines(e, s), this.currentLyricLineObjects = this.processedLines.map(
6626
- (i) => new js(this, i)
6627
- ), this.setLinePosXSpringParams({}), this.setLinePosYSpringParams({}), this.setLineScaleSpringParams({}), this.calcLayout(!0, !0);
6613
+ (i) => new Cs(this, i)
6614
+ ), this.setLinePosYSpringParams({}), this.setLineScaleSpringParams({}), this.calcLayout(!0, !0);
6628
6615
  }
6629
6616
  onResize() {
6630
6617
  const e = getComputedStyle(this.element);
@@ -6651,40 +6638,60 @@ class Ti extends $t {
6651
6638
  s.restore(), s.font = `15px ${this.baseFontFamily}`, s.fillStyle = "#FFFFFF55", s.textAlign = "right", s.fillText("CanvasLyricPlayer 播放器", i - 16, n - 16);
6652
6639
  }
6653
6640
  }
6654
- const Ys = "_lyricLine_1ygrf_6", Us = "_lyricBgLine_1ygrf_33", Vs = "_active_1ygrf_42", Gs = "_hasDuetLine_1ygrf_54", Xs = "_lyricDuetLine_1ygrf_55", Zs = "_lyricMainLine_1ygrf_69", Js = "_lyricSubLine_1ygrf_79", Qs = "_interludeDots_1ygrf_86", Ks = "_enabled_1ygrf_97", ti = "_duet_1ygrf_111", ei = "_tmpDisableTransition_1ygrf_123", $ = {
6655
- lyricLine: Ys,
6656
- lyricBgLine: Us,
6657
- active: Vs,
6658
- hasDuetLine: Gs,
6659
- lyricDuetLine: Xs,
6660
- lyricMainLine: Zs,
6661
- lyricSubLine: Js,
6662
- interludeDots: Qs,
6663
- enabled: Ks,
6664
- duet: ti,
6665
- tmpDisableTransition: ei
6666
- }, St = 32, Se = (d, t) => (e) => Math.min(1, Math.max(0, (e - d) / (t - d))), jt = 0.5, si = Se(0, jt), ii = Se(jt, 1), ni = It(0.2, 0.4, 0.58, 1), ri = It(0.3, 0, 0.58, 1), ai = (d) => (t) => t < d ? ni(si(t)) : 1 - ri(ii(t));
6667
- function ne(d, t = 0, e = "rgba(0,0,0,var(--bright-mask-alpha, 1.0))", s = "rgba(0,0,0,var(--dark-mask-alpha, 1.0))") {
6668
- const i = 2 + d + t, n = d / i, r = (1 - n) / 2;
6641
+ function Os(m, t = 20) {
6642
+ let e = 0;
6643
+ return (...i) => {
6644
+ clearTimeout(e), e = setTimeout(() => m(...i), t);
6645
+ };
6646
+ }
6647
+ const Ns = "_lyricLine_1ygrf_6", Ws = "_lyricBgLine_1ygrf_33", Bs = "_active_1ygrf_42", qs = "_hasDuetLine_1ygrf_54", $s = "_lyricDuetLine_1ygrf_55", Vs = "_lyricMainLine_1ygrf_69", Hs = "_lyricSubLine_1ygrf_79", Us = "_tmpDisableTransition_1ygrf_123", q = {
6648
+ lyricLine: Ns,
6649
+ lyricBgLine: Ws,
6650
+ active: Bs,
6651
+ hasDuetLine: qs,
6652
+ lyricDuetLine: $s,
6653
+ lyricMainLine: Vs,
6654
+ lyricSubLine: Hs,
6655
+ tmpDisableTransition: Us
6656
+ };
6657
+ function Ys(m) {
6658
+ const t = [];
6659
+ function e() {
6660
+ const s = t[0];
6661
+ s && m(...s.args).then((i) => {
6662
+ s.resolve(i);
6663
+ }).catch((i) => {
6664
+ s.reject(i);
6665
+ }).finally(() => {
6666
+ t.shift(), t.length > 0 && e();
6667
+ });
6668
+ }
6669
+ return (...s) => new Promise((i, n) => {
6670
+ t.push({ resolve: i, reject: n, args: s }), t.length === 1 && e();
6671
+ });
6672
+ }
6673
+ const Et = 32, Le = (m, t) => (e) => Math.min(1, Math.max(0, (e - m) / (t - m))), Ht = 0.5, js = Le(0, Ht), Gs = Le(Ht, 1), Xs = It(0.2, 0.4, 0.58, 1), Zs = It(0.3, 0, 0.58, 1), Js = (m) => (t) => t < m ? Xs(js(t)) : 1 - Zs(Gs(t));
6674
+ function ne(m, t = 0, e = "rgba(0,0,0,var(--bright-mask-alpha, 1.0))", s = "rgba(0,0,0,var(--dark-mask-alpha, 1.0))") {
6675
+ const i = 2 + m + t, n = m / i, r = (1 - n) / 2;
6669
6676
  return [
6670
6677
  `linear-gradient(to right,${e} ${r * 100}%,${s} ${(r + n) * 100}%)`,
6671
6678
  i
6672
6679
  ];
6673
6680
  }
6674
- class oi extends MouseEvent {
6681
+ class Qs extends MouseEvent {
6675
6682
  constructor(t, e) {
6676
6683
  super(e.type, e), this.line = t;
6677
6684
  }
6678
6685
  }
6679
- function ci(d) {
6680
- const t = d.match(/matrix\(([^)]+)\)/);
6686
+ function Ks(m) {
6687
+ const t = m.match(/matrix\(([^)]+)\)/);
6681
6688
  if (t) {
6682
6689
  const e = t[1].split(", "), s = Number.parseFloat(e[0]), i = Number.parseFloat(e[3]);
6683
6690
  return (s + i) / 2;
6684
6691
  }
6685
6692
  return 1;
6686
6693
  }
6687
- class hi extends q {
6694
+ class ti extends H {
6688
6695
  constructor(e, s = {
6689
6696
  words: [],
6690
6697
  translatedLyric: "",
@@ -6701,7 +6708,7 @@ class hi extends q {
6701
6708
  f(this, "lineSize", [0, 0]);
6702
6709
  f(this, "listenersMap", /* @__PURE__ */ new Map());
6703
6710
  f(this, "onMouseEvent", (e) => {
6704
- const s = new oi(this, e);
6711
+ const s = new Qs(this, e);
6705
6712
  for (const i of this.listenersMap.get(e.type) ?? [])
6706
6713
  i.call(this, s);
6707
6714
  if (!this.dispatchEvent(s) || s.defaultPrevented)
@@ -6710,7 +6717,7 @@ class hi extends q {
6710
6717
  f(this, "isEnabled", !1);
6711
6718
  f(this, "lastWord");
6712
6719
  f(this, "measureLockMark", !1);
6713
- f(this, "measureLock", xe(
6720
+ f(this, "measureLock", Ys(
6714
6721
  async (e) => {
6715
6722
  this.measureLockMark || (this.measureLockMark = !0, await e(), this.measureLockMark = !1);
6716
6723
  }
@@ -6722,9 +6729,9 @@ class hi extends q {
6722
6729
  f(this, "markImageDirtyPromise", new Promise((e) => {
6723
6730
  this.markImageDirtyPromiseResolve.add(e);
6724
6731
  }));
6725
- this.lyricPlayer = e, this.lyricLine = s, this._prevParentEl = e.getElement(), this.element.setAttribute("class", $.lyricLine), this.lyricLine.isBG && this.element.classList.add($.lyricBgLine), this.lyricLine.isDuet && this.element.classList.add($.lyricDuetLine), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div"));
6732
+ this.lyricPlayer = e, this.lyricLine = s, this._prevParentEl = e.getElement(), this.element.setAttribute("class", q.lyricLine), this.lyricLine.isBG && this.element.classList.add(q.lyricBgLine), this.lyricLine.isDuet && this.element.classList.add(q.lyricDuetLine), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div"));
6726
6733
  const i = this.element.children[0], n = this.element.children[1], r = this.element.children[2];
6727
- i.setAttribute("class", $.lyricMainLine), n.setAttribute("class", $.lyricSubLine), r.setAttribute("class", $.lyricSubLine), this.rebuildElement(), this.rebuildStyle(), this.markMaskImageDirty("Initial construction");
6734
+ i.setAttribute("class", q.lyricMainLine), n.setAttribute("class", q.lyricSubLine), r.setAttribute("class", q.lyricSubLine), this.rebuildElement(), this.rebuildStyle(), this.markMaskImageDirty("Initial construction");
6728
6735
  }
6729
6736
  addMouseEventListener(e, s, i) {
6730
6737
  if (s) {
@@ -6746,7 +6753,7 @@ class hi extends q {
6746
6753
  return !0;
6747
6754
  }
6748
6755
  async enable(e = this.lyricLine.startTime) {
6749
- this.isEnabled = !0, this.element.classList.add($.active), await this.waitMaskImageUpdated();
6756
+ this.isEnabled = !0, this.element.classList.add(q.active), await this.waitMaskImageUpdated();
6750
6757
  const s = this.element.children[0];
6751
6758
  for (const i of this.splittedWords) {
6752
6759
  for (const n of i.elementAnimations)
@@ -6757,15 +6764,15 @@ class hi extends q {
6757
6764
  Math.max(0, e - this.lyricLine.startTime)
6758
6765
  ), n.playbackRate = 1, n.play();
6759
6766
  }
6760
- s.classList.add($.active);
6767
+ s.classList.add(q.active);
6761
6768
  }
6762
6769
  disable() {
6763
- this.isEnabled = !1, this.element.classList.remove($.active);
6770
+ this.isEnabled = !1, this.element.classList.remove(q.active);
6764
6771
  const e = this.element.children[0];
6765
6772
  for (const s of this.splittedWords)
6766
6773
  for (const i of s.elementAnimations)
6767
6774
  (i.id === "float-word" || i.id.includes("emphasize-word-float-only")) && (i.playbackRate = -1, i.play());
6768
- e.classList.remove($.active);
6775
+ e.classList.remove(q.active);
6769
6776
  }
6770
6777
  async resume() {
6771
6778
  if (await this.waitMaskImageUpdated(), !!this.isEnabled)
@@ -6791,15 +6798,6 @@ class hi extends q {
6791
6798
  for (const n of i.maskAnimations)
6792
6799
  n.currentTime = Math.min(this.totalDuration, Math.max(0, s)), n.playbackRate = 1, s >= 0 && s < this.totalDuration ? n.play() : n.pause();
6793
6800
  }
6794
- async measureSize() {
6795
- return await this.measureLock(async () => {
6796
- const e = await ft(() => [
6797
- this.element.clientWidth,
6798
- this.element.clientHeight
6799
- ]);
6800
- this.lineSize = e;
6801
- }), this.lineSize;
6802
- }
6803
6801
  getLine() {
6804
6802
  return this.lyricLine;
6805
6803
  }
@@ -6817,7 +6815,7 @@ class hi extends q {
6817
6815
  e.innerText = this.lyricLine.words.map((r) => r.word).join(""), s.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
6818
6816
  return;
6819
6817
  }
6820
- const n = qt(this.lyricLine.words);
6818
+ const n = $t(this.lyricLine.words);
6821
6819
  e.innerHTML = "";
6822
6820
  for (const r of n)
6823
6821
  if (Array.isArray(r)) {
@@ -6831,19 +6829,19 @@ class hi extends q {
6831
6829
  wordType: "normal",
6832
6830
  obscene: !1
6833
6831
  }
6834
- ), o = r.map((l) => q.shouldEmphasize(l)).reduce((l, p) => l || p, q.shouldEmphasize(a)), c = document.createElement("span");
6835
- c.classList.add($.emphasizeWrapper);
6836
- const h = [];
6832
+ ), o = r.map((l) => H.shouldEmphasize(l)).reduce((l, p) => l || p, H.shouldEmphasize(a)), h = document.createElement("span");
6833
+ h.classList.add(q.emphasizeWrapper);
6834
+ const c = [];
6837
6835
  for (const l of r) {
6838
6836
  const p = document.createElement("span");
6839
6837
  if (o) {
6840
- p.classList.add($.emphasize);
6838
+ p.classList.add(q.emphasize);
6841
6839
  const u = [];
6842
- for (const L of l.word.trim().split("")) {
6843
- const m = document.createElement("span");
6844
- m.innerText = L, u.push(m), h.push(m), p.appendChild(m);
6840
+ for (const M of l.word.trim().split("")) {
6841
+ const d = document.createElement("span");
6842
+ d.innerText = M, u.push(d), c.push(d), p.appendChild(d);
6845
6843
  }
6846
- const y = {
6844
+ const g = {
6847
6845
  ...l,
6848
6846
  mainElement: p,
6849
6847
  subElements: u,
@@ -6856,7 +6854,7 @@ class hi extends q {
6856
6854
  padding: 0,
6857
6855
  shouldEmphasize: o
6858
6856
  };
6859
- this.splittedWords.push(y);
6857
+ this.splittedWords.push(g);
6860
6858
  } else
6861
6859
  p.innerText = l.word, this.splittedWords.push({
6862
6860
  ...l,
@@ -6871,20 +6869,20 @@ class hi extends q {
6871
6869
  padding: 0,
6872
6870
  shouldEmphasize: o
6873
6871
  });
6874
- c.appendChild(p);
6872
+ h.appendChild(p);
6875
6873
  }
6876
6874
  o && this.splittedWords[this.splittedWords.length - 1].elementAnimations.push(
6877
6875
  ...this.initEmphasizeAnimation(
6878
6876
  a,
6879
- h,
6877
+ c,
6880
6878
  a.endTime - a.startTime,
6881
6879
  a.startTime - this.lyricLine.startTime
6882
6880
  )
6883
- ), a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(c), a.word.trimEnd() !== a.word && q.shouldEmphasize(a) && e.appendChild(document.createTextNode(" "));
6881
+ ), a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(h), a.word.trimEnd() !== a.word && H.shouldEmphasize(a) && e.appendChild(document.createTextNode(" "));
6884
6882
  } else if (r.word.trim().length === 0)
6885
6883
  e.appendChild(document.createTextNode(" "));
6886
6884
  else {
6887
- const a = q.shouldEmphasize(r), o = document.createElement("span"), c = {
6885
+ const a = H.shouldEmphasize(r), o = document.createElement("span"), h = {
6888
6886
  ...r,
6889
6887
  mainElement: o,
6890
6888
  subElements: [],
@@ -6897,26 +6895,26 @@ class hi extends q {
6897
6895
  padding: 0,
6898
6896
  shouldEmphasize: a
6899
6897
  };
6900
- if (q.shouldEmphasize(r)) {
6901
- o.classList.add($.emphasize);
6902
- const h = [];
6898
+ if (H.shouldEmphasize(r)) {
6899
+ o.classList.add(q.emphasize);
6900
+ const c = [];
6903
6901
  for (const p of r.word.trim().split("")) {
6904
6902
  const u = document.createElement("span");
6905
- u.innerText = p, h.push(u), o.appendChild(u);
6903
+ u.innerText = p, c.push(u), o.appendChild(u);
6906
6904
  }
6907
- c.subElements = h;
6908
- const l = Math.abs(c.endTime - c.startTime);
6909
- c.elementAnimations.push(
6905
+ h.subElements = c;
6906
+ const l = Math.abs(h.endTime - h.startTime);
6907
+ h.elementAnimations.push(
6910
6908
  ...this.initEmphasizeAnimation(
6911
6909
  r,
6912
- h,
6910
+ c,
6913
6911
  l,
6914
- c.startTime - this.lyricLine.startTime
6912
+ h.startTime - this.lyricLine.startTime
6915
6913
  )
6916
6914
  );
6917
6915
  } else
6918
6916
  o.innerText = r.word.trim();
6919
- r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(o), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(c);
6917
+ r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(o), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(h);
6920
6918
  }
6921
6919
  s.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
6922
6920
  }
@@ -6948,63 +6946,63 @@ class hi extends q {
6948
6946
  // 为了避免产生锯齿抖动感,使用 matrix3d 来实现缩放和位移
6949
6947
  initEmphasizeAnimation(e, s, i, n) {
6950
6948
  const r = Math.max(0, n);
6951
- let a = Math.max(1e3, i), o = [], c = a / 2e3;
6952
- c = c > 1 ? Math.sqrt(c) : c ** 3;
6953
- let h = a / 3e3;
6954
- h = h > 1 ? Math.sqrt(h) : h ** 3, c *= 0.6, h *= 0.5, this.lyricLine.words.length > 0 && e.word.includes(
6949
+ let a = Math.max(1e3, i), o = [], h = a / 2e3;
6950
+ h = h > 1 ? Math.sqrt(h) : h ** 3;
6951
+ let c = a / 3e3;
6952
+ c = c > 1 ? Math.sqrt(c) : c ** 3, h *= 0.6, c *= 0.5, this.lyricLine.words.length > 0 && e.word.includes(
6955
6953
  this.lyricLine.words[this.lyricLine.words.length - 1].word
6956
- ) && (c *= 1.6, h *= 1.5, a *= 1.2), c = Math.min(1.2, c), h = Math.min(0.8, h);
6957
- const l = Number.isFinite(a) ? a : 0, p = ai(jt);
6958
- return o = s.flatMap((u, y, L) => {
6959
- const m = r + a / 2.5 / L.length * y, g = [], b = new Array(St).fill(0).map((E, w) => {
6960
- const z = (w + 1) / St, v = p(z), k = p(z) * h, P = Me(Le(), 1 + v * 0.1 * c), D = -v * 0.03 * c * (L.length / 2 - y), A = -v * 0.025 * c;
6954
+ ) && (h *= 1.6, c *= 1.5, a *= 1.2), h = Math.min(1.2, h), c = Math.min(0.8, c);
6955
+ const l = Number.isFinite(a) ? a : 0, p = Js(Ht);
6956
+ return o = s.flatMap((u, g, M) => {
6957
+ const d = r + a / 2.5 / M.length * g, y = [], b = new Array(Et).fill(0).map((S, T) => {
6958
+ const z = (T + 1) / Et, P = p(z), I = p(z) * c, v = ue(fe(), 1 + P * 0.1 * h), D = -P * 0.03 * h * (M.length / 2 - g), F = -P * 0.025 * h;
6961
6959
  return {
6962
6960
  offset: z,
6963
- transform: `${be(
6964
- P,
6961
+ transform: `${ye(
6962
+ v,
6965
6963
  4
6966
- )} translate(${D}em, ${A}em)`,
6964
+ )} translate(${D}em, ${F}em)`,
6967
6965
  textShadow: `0 0 ${Math.min(
6968
6966
  0.3,
6969
- h * 0.3
6970
- )}em rgba(255, 255, 255, ${k})`
6967
+ c * 0.3
6968
+ )}em rgba(255, 255, 255, ${I})`
6971
6969
  };
6972
- }), S = u.animate(b, {
6970
+ }), w = u.animate(b, {
6973
6971
  duration: l,
6974
- delay: Number.isFinite(m) ? m : 0,
6975
- id: `emphasize-word-${u.innerText}-${y}`,
6972
+ delay: Number.isFinite(d) ? d : 0,
6973
+ id: `emphasize-word-${u.innerText}-${g}`,
6976
6974
  iterations: 1,
6977
6975
  composite: "replace",
6978
6976
  fill: "both"
6979
6977
  });
6980
- S.onfinish = () => {
6981
- S.pause();
6982
- }, S.pause(), g.push(S);
6983
- const x = new Array(St).fill(0).map((E, w) => {
6984
- const z = (w + 1) / St;
6985
- let v = Math.sin(z * Math.PI);
6986
- return this.lyricLine.isBG && (v *= 2), {
6978
+ w.onfinish = () => {
6979
+ w.pause();
6980
+ }, w.pause(), y.push(w);
6981
+ const L = new Array(Et).fill(0).map((S, T) => {
6982
+ const z = (T + 1) / Et;
6983
+ let P = Math.sin(z * Math.PI);
6984
+ return this.lyricLine.isBG && (P *= 2), {
6987
6985
  offset: z,
6988
- transform: `translateY(${-v * 0.05}em)`
6986
+ transform: `translateY(${-P * 0.05}em)`
6989
6987
  };
6990
- }), T = u.animate(x, {
6988
+ }), x = u.animate(L, {
6991
6989
  duration: l * 1.4,
6992
- delay: Number.isFinite(m) ? m - 400 : 0,
6990
+ delay: Number.isFinite(d) ? d - 400 : 0,
6993
6991
  id: "emphasize-word-float",
6994
6992
  iterations: 1,
6995
6993
  composite: "add",
6996
6994
  fill: "both"
6997
6995
  });
6998
- return T.onfinish = () => {
6999
- T.pause();
7000
- }, T.pause(), g.push(T), g;
6996
+ return x.onfinish = () => {
6997
+ x.pause();
6998
+ }, x.pause(), y.push(x), y;
7001
6999
  }), o;
7002
7000
  }
7003
7001
  get totalDuration() {
7004
7002
  return this.lyricLine.endTime - this.lyricLine.startTime;
7005
7003
  }
7006
7004
  markMaskImageDirty(e = "") {
7007
- this.maskImageDirty = !0, this.element.classList.contains($.dirty) || this.element.classList.add($.dirty);
7005
+ this.maskImageDirty = !0, this.element.classList.contains(q.dirty) || this.element.classList.add(q.dirty);
7008
7006
  const s = Promise.all([
7009
7007
  this.markImageDirtyPromise,
7010
7008
  new Promise((i) => {
@@ -7018,25 +7016,29 @@ class hi extends q {
7018
7016
  return this.markImageDirtyPromise;
7019
7017
  }
7020
7018
  async updateMaskImage() {
7021
- this.maskImageDirty = !1, await this.measureLock(async () => {
7022
- await Promise.all(
7023
- this.splittedWords.map(async (e) => {
7024
- const s = e.mainElement;
7025
- s ? await ft(() => {
7026
- e.padding = Number.parseFloat(
7027
- getComputedStyle(s).paddingLeft
7028
- ), e.width = s.clientWidth - e.padding * 2, e.height = s.clientHeight - e.padding * 2;
7029
- }) : (e.width = 0, e.height = 0, e.padding = 0), e.width * e.height === 0 && console.warn("Word size is zero");
7030
- })
7031
- ), await ot(() => {
7032
- this.lyricPlayer.supportMaskImage ? this.generateWebAnimationBasedMaskImage() : this.generateCalcBasedMaskImage();
7019
+ if (this.element.checkVisibility({
7020
+ contentVisibilityAuto: !0
7021
+ })) {
7022
+ this.maskImageDirty = !1, await this.measureLock(async () => {
7023
+ await Promise.all(
7024
+ this.splittedWords.map(async (e) => {
7025
+ const s = e.mainElement;
7026
+ s ? await pe(() => {
7027
+ e.padding = Number.parseFloat(
7028
+ getComputedStyle(s).paddingLeft
7029
+ ), e.width = s.clientWidth - e.padding * 2, e.height = s.clientHeight - e.padding * 2;
7030
+ }) : (e.width = 0, e.height = 0, e.padding = 0), e.width * e.height === 0 && console.warn("Word size is zero");
7031
+ })
7032
+ ), await ee(() => {
7033
+ this.lyricPlayer.supportMaskImage ? this.generateWebAnimationBasedMaskImage() : this.generateCalcBasedMaskImage();
7034
+ });
7033
7035
  });
7034
- });
7035
- for (const e of this.markImageDirtyPromiseResolve)
7036
- e(), this.markImageDirtyPromiseResolve.delete(e);
7037
- await ot(() => {
7038
- this.element.classList.remove($.dirty);
7039
- });
7036
+ for (const e of this.markImageDirtyPromiseResolve)
7037
+ e(), this.markImageDirtyPromiseResolve.delete(e);
7038
+ await ee(() => {
7039
+ this.element.classList.remove(q.dirty);
7040
+ });
7041
+ }
7040
7042
  }
7041
7043
  generateCalcBasedMaskImage() {
7042
7044
  for (const e of this.splittedWords) {
@@ -7047,8 +7049,8 @@ class hi extends q {
7047
7049
  i / e.width
7048
7050
  ), a = `${r * 100}% 100%`;
7049
7051
  this.lyricPlayer.supportMaskImage ? (s.style.maskImage = n, s.style.maskRepeat = "no-repeat", s.style.maskOrigin = "left", s.style.maskSize = a) : (s.style.webkitMaskImage = n, s.style.webkitMaskRepeat = "no-repeat", s.style.webkitMaskOrigin = "left", s.style.webkitMaskSize = a);
7050
- const o = e.width + i, c = `clamp(${-o}px,calc(${-o}px + (var(--amll-player-time) - ${e.startTime})*${o / Math.abs(e.endTime - e.startTime)}px),0px) 0px, left top`;
7051
- s.style.maskPosition = c, s.style.webkitMaskPosition = c;
7052
+ const o = e.width + i, h = `clamp(${-o}px,calc(${-o}px + (var(--amll-player-time) - ${e.startTime})*${o / Math.abs(e.endTime - e.startTime)}px),0px) 0px, left top`;
7053
+ s.style.maskPosition = h, s.style.webkitMaskPosition = h;
7052
7054
  }
7053
7055
  }
7054
7056
  }
@@ -7062,57 +7064,57 @@ class hi extends q {
7062
7064
  if (n) {
7063
7065
  const r = s.height * this.lyricPlayer.getWordFadeWidth(), [a, o] = ne(
7064
7066
  r / (s.width + s.padding * 2)
7065
- ), c = `${o * 100}% 100%`;
7066
- this.lyricPlayer.supportMaskImage ? (n.style.maskImage = a, n.style.maskRepeat = "no-repeat", n.style.maskOrigin = "left", n.style.maskSize = c) : (n.style.webkitMaskImage = a, n.style.webkitMaskRepeat = "no-repeat", n.style.webkitMaskOrigin = "left", n.style.webkitMaskSize = c);
7067
- const h = this.splittedWords.slice(0, i).reduce((x, T) => x + T.width, 0) + (this.splittedWords[0] ? r : 0), l = -(s.width + s.padding * 2 + r), p = (x) => Math.max(l, Math.min(0, x));
7068
- let u = -h - s.width - s.padding - r, y = 0;
7069
- const L = [];
7070
- let m = u, g = 0;
7067
+ ), h = `${o * 100}% 100%`;
7068
+ this.lyricPlayer.supportMaskImage ? (n.style.maskImage = a, n.style.maskRepeat = "no-repeat", n.style.maskOrigin = "left", n.style.maskSize = h) : (n.style.webkitMaskImage = a, n.style.webkitMaskRepeat = "no-repeat", n.style.webkitMaskOrigin = "left", n.style.webkitMaskSize = h);
7069
+ const c = this.splittedWords.slice(0, i).reduce((L, x) => L + x.width, 0) + (this.splittedWords[0] ? r : 0), l = -(s.width + s.padding * 2 + r), p = (L) => Math.max(l, Math.min(0, L));
7070
+ let u = -c - s.width - s.padding - r, g = 0;
7071
+ const M = [];
7072
+ let d = u, y = 0;
7071
7073
  const b = () => {
7072
- const x = u - m, T = Math.max(0, Math.min(1, y)), E = T - g, w = Math.abs(E / x);
7073
- if (u > l && m < l) {
7074
- const k = Math.abs(m - l) * w, P = `${p(m)}px 0`, D = {
7075
- offset: g + k,
7076
- maskPosition: P
7074
+ const L = u - d, x = Math.max(0, Math.min(1, g)), S = x - y, T = Math.abs(S / L);
7075
+ if (u > l && d < l) {
7076
+ const I = Math.abs(d - l) * T, v = `${p(d)}px 0`, D = {
7077
+ offset: y + I,
7078
+ maskPosition: v
7077
7079
  };
7078
- L.push(D);
7080
+ M.push(D);
7079
7081
  }
7080
- if (u > 0 && m < 0) {
7081
- const k = Math.abs(m) * w, P = `${p(u)}px 0`, D = {
7082
- offset: g + k,
7083
- maskPosition: P
7082
+ if (u > 0 && d < 0) {
7083
+ const I = Math.abs(d) * T, v = `${p(u)}px 0`, D = {
7084
+ offset: y + I,
7085
+ maskPosition: v
7084
7086
  };
7085
- L.push(D);
7087
+ M.push(D);
7086
7088
  }
7087
- const z = `${p(u)}px 0`, v = {
7088
- offset: T,
7089
+ const z = `${p(u)}px 0`, P = {
7090
+ offset: x,
7089
7091
  maskPosition: z
7090
7092
  };
7091
- L.push(v), m = u, g = T;
7093
+ M.push(P), d = u, y = x;
7092
7094
  };
7093
7095
  b();
7094
- let S = 0;
7095
- this.splittedWords.forEach((x, T) => {
7096
+ let w = 0;
7097
+ this.splittedWords.forEach((L, x) => {
7096
7098
  {
7097
- const E = x.startTime - this.lyricLine.startTime, w = E - S;
7098
- y += w / e, w > 0 && b(), S = E;
7099
+ const S = L.startTime - this.lyricLine.startTime, T = S - w;
7100
+ g += T / e, T > 0 && b(), w = S;
7099
7101
  }
7100
7102
  {
7101
- const E = x.endTime - x.startTime;
7102
- y += E / e, u += x.width, T === 0 && (u += r * 1.5), T === this.splittedWords.length - 1 && (u += r * 0.5), E > 0 && b(), S += E;
7103
+ const S = L.endTime - L.startTime;
7104
+ g += S / e, u += L.width, x === 0 && (u += r * 1.5), x === this.splittedWords.length - 1 && (u += r * 0.5), S > 0 && b(), w += S;
7103
7105
  }
7104
7106
  });
7105
- for (const x of s.maskAnimations)
7106
- x.cancel();
7107
+ for (const L of s.maskAnimations)
7108
+ L.cancel();
7107
7109
  try {
7108
- const x = n.animate(L, {
7110
+ const L = n.animate(M, {
7109
7111
  duration: e || 1,
7110
7112
  id: `fade-word-${s.word}-${i}`,
7111
7113
  fill: "both"
7112
7114
  });
7113
- x.pause(), s.maskAnimations = [x];
7114
- } catch (x) {
7115
- console.warn("应用渐变动画发生错误", L, e, x);
7115
+ L.pause(), s.maskAnimations = [L];
7116
+ } catch (L) {
7117
+ console.warn("应用渐变动画发生错误", M, e, L);
7116
7118
  }
7117
7119
  }
7118
7120
  });
@@ -7122,18 +7124,18 @@ class hi extends q {
7122
7124
  }
7123
7125
  setTransform(e = this.top, s = this.scale, i = 1, n = 0, r = !1, a = 0) {
7124
7126
  super.setTransform(e, s, i, n, r, a);
7125
- const o = this.isInSight, c = this.lyricPlayer.getEnableSpring();
7127
+ const o = this.isInSight, h = this.lyricPlayer.getEnableSpring();
7126
7128
  this.top = e, this.scale = s, this.delay = a * 1e3 | 0;
7127
- const h = this.element.children[0];
7128
- if (h.style.opacity = `${i}`, r || !c) {
7129
- if (r && this.element.classList.add($.tmpDisableTransition), this.lineTransforms.posY.setPosition(e), this.lineTransforms.scale.setPosition(s), c)
7129
+ const c = this.element.children[0];
7130
+ if (c.style.opacity = `${i}`, r || !h) {
7131
+ if (r && this.element.classList.add(q.tmpDisableTransition), this.lineTransforms.posY.setPosition(e), this.lineTransforms.scale.setPosition(s), h)
7130
7132
  this.rebuildStyle();
7131
7133
  else {
7132
7134
  const l = this.isInSight;
7133
7135
  o || l ? this.show() : this.hide();
7134
7136
  }
7135
7137
  r && requestAnimationFrame(() => {
7136
- this.element.classList.remove($.tmpDisableTransition);
7138
+ this.element.classList.remove(q.tmpDisableTransition);
7137
7139
  });
7138
7140
  } else
7139
7141
  this.lineTransforms.posY.setTargetPosition(e, a), this.lineTransforms.scale.setTargetPosition(s);
@@ -7161,7 +7163,7 @@ class hi extends q {
7161
7163
  ) * 0.2 + 0.2}`
7162
7164
  );
7163
7165
  else {
7164
- const i = window.getComputedStyle(this.element).transform, n = ci(i);
7166
+ const i = window.getComputedStyle(this.element).transform, n = Ks(i);
7165
7167
  this.element.style.setProperty(
7166
7168
  "--bright-mask-alpha",
7167
7169
  `${Math.max(0, Math.min(1, (n - 0.97) / 0.03)) * 0.8 + 0.2}`
@@ -7195,11 +7197,11 @@ class hi extends q {
7195
7197
  this.disposeElements(), this.element.remove();
7196
7198
  }
7197
7199
  }
7198
- class wi extends $t {
7200
+ class ui extends qt {
7199
7201
  constructor() {
7200
7202
  super();
7201
7203
  f(this, "currentLyricLineObjects", []);
7202
- f(this, "debounceCalcLayout", he(
7204
+ f(this, "debounceCalcLayout", Os(
7203
7205
  () => this.calcLayout(!0, !0).then(
7204
7206
  () => this.currentLyricLineObjects.map(async (e, s) => {
7205
7207
  e.markMaskImageDirty("DomLyricPlayer onResize"), await e.waitMaskImageUpdated(), this.hotLines.has(s) && (e.enable(this.currentTime), e.resume());
@@ -7211,7 +7213,7 @@ class wi extends $t {
7211
7213
  f(this, "supportMaskImage", CSS.supports("mask-image", "none"));
7212
7214
  f(this, "innerSize", [0, 0]);
7213
7215
  f(this, "onLineClickedHandler", (e) => {
7214
- const s = new we(
7216
+ const s = new Me(
7215
7217
  this.lyricLinesIndexes.get(e.line) ?? -1,
7216
7218
  e.line,
7217
7219
  e
@@ -7221,7 +7223,7 @@ class wi extends $t {
7221
7223
  f(this, "_baseFontSize", Number.parseFloat(
7222
7224
  getComputedStyle(this.element).fontSize
7223
7225
  ));
7224
- this.onResize(), this.element.classList.add("amll-lyric-player", "dom-slim"), this.disableSpring && this.element.classList.add($.disableSpring);
7226
+ this.onResize(), this.element.classList.add("amll-lyric-player", "dom-slim"), this.disableSpring && this.element.classList.add(q.disableSpring);
7225
7227
  }
7226
7228
  onResize() {
7227
7229
  const e = getComputedStyle(this.element);
@@ -7257,11 +7259,11 @@ class wi extends $t {
7257
7259
  * @param initialTime 初始时间,默认为 0
7258
7260
  */
7259
7261
  setLyricLines(e, s = 0) {
7260
- super.setLyricLines(e, s), this.hasDuetLine ? this.element.classList.add($.hasDuetLine) : this.element.classList.remove($.hasDuetLine);
7262
+ super.setLyricLines(e, s), this.hasDuetLine ? this.element.classList.add(q.hasDuetLine) : this.element.classList.remove(q.hasDuetLine);
7261
7263
  for (const i of this.currentLyricLineObjects)
7262
7264
  i.removeMouseEventListener("click", this.onLineClickedHandler), i.removeMouseEventListener("contextmenu", this.onLineClickedHandler), i.dispose();
7263
7265
  this.currentLyricLineObjects = this.processedLines.map((i, n) => {
7264
- const r = new hi(this, i);
7266
+ const r = new ti(this, i);
7265
7267
  return r.addMouseEventListener("click", this.onLineClickedHandler), r.addMouseEventListener("contextmenu", this.onLineClickedHandler), this.element.appendChild(r.getElement()), this.lyricLinesIndexes.set(r, n), r.markMaskImageDirty("DomLyricPlayer setLyricLines"), r;
7266
7268
  }), this.setLinePosXSpringParams({}), this.setLinePosYSpringParams({}), this.setLineScaleSpringParams({}), this.calcLayout(!0, !0).then(() => {
7267
7269
  this.initialLayoutFinished = !0;
@@ -7285,30 +7287,27 @@ class wi extends $t {
7285
7287
  i.update(s);
7286
7288
  }
7287
7289
  async calcLayout(e, s) {
7288
- var r;
7289
7290
  await super.calcLayout(e, s);
7290
- let i = this.currentLyricLineObjects.slice(0, this.targetAlignIndex).reduce(
7291
- (a, o) => {
7292
- var c;
7293
- return a + (o.getLine().isBG ? 0 : ((c = this.lyricLinesSize.get(o)) == null ? void 0 : c[1]) ?? 0);
7294
- },
7295
- 0
7296
- );
7297
- i -= this.size[1] * this.alignPosition;
7298
- const n = this.currentLyricLineObjects[this.targetAlignIndex];
7299
- if (n) {
7300
- const a = ((r = this.lyricLinesSize.get(n)) == null ? void 0 : r[1]) ?? 0;
7291
+ const i = this.currentLyricLineObjects[this.targetAlignIndex], n = i.getElement(), r = n.checkVisibility({
7292
+ contentVisibilityAuto: !0
7293
+ }), a = this.element.getBoundingClientRect().top;
7294
+ r || n.scrollIntoView({
7295
+ block: "center",
7296
+ behavior: "instant"
7297
+ });
7298
+ const o = n.clientHeight;
7299
+ let c = n.getBoundingClientRect().top - a - this.size[1] * this.alignPosition;
7300
+ if (i)
7301
7301
  switch (this.alignAnchor) {
7302
7302
  case "bottom":
7303
- i += a;
7303
+ c += o;
7304
7304
  break;
7305
7305
  case "center":
7306
- i += a / 2;
7306
+ c += o / 2;
7307
7307
  break;
7308
7308
  }
7309
- }
7310
- this.element.scrollTo({
7311
- top: i,
7309
+ this.element.scrollBy({
7310
+ top: c,
7312
7311
  behavior: "smooth"
7313
7312
  });
7314
7313
  }
@@ -7319,18 +7318,17 @@ class wi extends $t {
7319
7318
  this.bottomLine.dispose(), this.interludeDots.dispose();
7320
7319
  }
7321
7320
  }
7322
- const Si = Bs;
7323
7321
  export {
7324
- Ie as AbstractBaseRenderer,
7322
+ Ee as AbstractBaseRenderer,
7325
7323
  ce as BackgroundRender,
7326
7324
  re as BaseRenderer,
7327
- Ti as CanvasLyricPlayer,
7328
- Bs as DomLyricPlayer,
7329
- wi as DomSlimLyricPlayer,
7330
- we as LyricLineMouseEvent,
7331
- Si as LyricPlayer,
7332
- $t as LyricPlayerBase,
7333
- Li as MeshGradientRenderer,
7334
- Mi as PixiRenderer
7325
+ fi as CanvasLyricPlayer,
7326
+ pi as DomLyricPlayer,
7327
+ ui as DomSlimLyricPlayer,
7328
+ Me as LyricLineMouseEvent,
7329
+ pi as LyricPlayer,
7330
+ qt as LyricPlayerBase,
7331
+ hi as MeshGradientRenderer,
7332
+ li as PixiRenderer
7335
7333
  };
7336
7334
  //# sourceMappingURL=amll-core.js.map