@taole/giftstage 0.1.17 → 0.1.19

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.
@@ -1300,7 +1300,7 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1300
1300
  }
1301
1301
  try {
1302
1302
  this.device.queue.copyExternalImageToTexture({ source: E, flipY: !0 }, B, [r, o]);
1303
- } catch (w) {
1303
+ } catch (f) {
1304
1304
  this.drawVideoLikeSourceToTextureRegion(
1305
1305
  n.texture,
1306
1306
  r,
@@ -1428,12 +1428,12 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1428
1428
  }
1429
1429
  const E = a * this.uniformSlotStride, r = A.uniforms.u_projection;
1430
1430
  if (n.needsTexture) {
1431
- const l = A.uniforms.u_transform, f = l instanceof Float32Array && l.length >= 16 ? l : TQ, u = A.uniforms.u_atlasRemap, y = u instanceof Float32Array && u.length >= 4 ? u : qQ, m = typeof A.uniforms.u_opacity == "number" ? A.uniforms.u_opacity : 1;
1431
+ const l = A.uniforms.u_transform, u = l instanceof Float32Array && l.length >= 16 ? l : TQ, w = A.uniforms.u_atlasRemap, y = w instanceof Float32Array && w.length >= 4 ? w : qQ, m = typeof A.uniforms.u_opacity == "number" ? A.uniforms.u_opacity : 1;
1432
1432
  if (r instanceof Float32Array && r.length >= 16) {
1433
1433
  const p = this.uniformScratch160;
1434
- p.set(r.subarray(0, 16), 0), p.set(f.subarray(0, 16), 16), p.set(y.subarray(0, 4), 32), p[36] = m, p[37] = 0, p[38] = 0, p[39] = 0, this.device.queue.writeBuffer(this.uniformBuffer, E, p.buffer, p.byteOffset, 160);
1434
+ p.set(r.subarray(0, 16), 0), p.set(u.subarray(0, 16), 16), p.set(y.subarray(0, 4), 32), p[36] = m, p[37] = 0, p[38] = 0, p[39] = 0, this.device.queue.writeBuffer(this.uniformBuffer, E, p.buffer, p.byteOffset, 160);
1435
1435
  } else
1436
- this.device.queue.writeBuffer(this.uniformBuffer, E + 64, f.buffer, f.byteOffset, 64), this.device.queue.writeBuffer(this.uniformBuffer, E + 128, y.buffer, y.byteOffset, 16), this.device.queue.writeBuffer(
1436
+ this.device.queue.writeBuffer(this.uniformBuffer, E + 64, u.buffer, u.byteOffset, 64), this.device.queue.writeBuffer(this.uniformBuffer, E + 128, y.buffer, y.byteOffset, 16), this.device.queue.writeBuffer(
1437
1437
  this.uniformBuffer,
1438
1438
  E + 144,
1439
1439
  new Float32Array([m, 0, 0, 0])
@@ -1446,7 +1446,7 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1446
1446
  64
1447
1447
  );
1448
1448
  if (n.needsTexture) {
1449
- const l = A.textures.length > 0 ? A.textures[0] : null, f = l ? this.textures.get(l.id) : null, u = (e = f == null ? void 0 : f.view) != null ? e : this.dummyTextureView, y = (g = l == null ? void 0 : l.id) != null ? g : 0, m = `${s}\0${y}`;
1449
+ const l = A.textures.length > 0 ? A.textures[0] : null, u = l ? this.textures.get(l.id) : null, w = (e = u == null ? void 0 : u.view) != null ? e : this.dummyTextureView, y = (g = l == null ? void 0 : l.id) != null ? g : 0, m = `${s}\0${y}`;
1450
1450
  let p = this.textureBindGroupCache.get(m);
1451
1451
  p || (p = this.device.createBindGroup({
1452
1452
  layout: n.bindGroupLayout,
@@ -1455,7 +1455,7 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1455
1455
  binding: 0,
1456
1456
  resource: { buffer: this.uniformBuffer, offset: 0, size: 160 }
1457
1457
  },
1458
- { binding: 1, resource: u },
1458
+ { binding: 1, resource: w },
1459
1459
  { binding: 2, resource: this.sampler }
1460
1460
  ]
1461
1461
  }), this.textureBindGroupCache.set(m, p)), B.setBindGroup(0, p, [E]);
@@ -1471,8 +1471,8 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1471
1471
  })), B.setBindGroup(0, n.uniformOnlyBindGroup, [E]);
1472
1472
  const o = this.buffers.get(A.vertexBuffer.id), h = this.buffers.get(A.indexBuffer.id);
1473
1473
  if (!o || !h) return;
1474
- const c = A.vertexBuffer.id, w = A.indexBuffer.id;
1475
- this.lastVertexBufferId !== c && (B.setVertexBuffer(0, o.buffer), this.lastVertexBufferId = c), this.lastIndexBufferId !== w && (B.setIndexBuffer(h.buffer, "uint32"), this.lastIndexBufferId = w), B.drawIndexed(A.indexCount);
1474
+ const c = A.vertexBuffer.id, f = A.indexBuffer.id;
1475
+ this.lastVertexBufferId !== c && (B.setVertexBuffer(0, o.buffer), this.lastVertexBufferId = c), this.lastIndexBufferId !== f && (B.setIndexBuffer(h.buffer, "uint32"), this.lastIndexBufferId = f), B.drawIndexed(A.indexCount);
1476
1476
  }
1477
1477
  /** One `drawIndexed` with `instanceCount` for all SVGA sprites sharing the same atlas. */
1478
1478
  drawInstancedSvga(A) {
@@ -1504,12 +1504,12 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1504
1504
  n.byteOffset,
1505
1505
  h
1506
1506
  );
1507
- const w = A.textures[0], l = w ? this.textures.get(w.id) : null, f = (e = l == null ? void 0 : l.view) != null ? e : this.dummyTextureView, u = (g = w == null ? void 0 : w.id) != null ? g : 0, y = `${C}\0${u}`;
1507
+ const f = A.textures[0], l = f ? this.textures.get(f.id) : null, u = (e = l == null ? void 0 : l.view) != null ? e : this.dummyTextureView, w = (g = f == null ? void 0 : f.id) != null ? g : 0, y = `${C}\0${w}`;
1508
1508
  let m = this.textureBindGroupCache.get(y);
1509
1509
  m || (m = this.device.createBindGroup({
1510
1510
  layout: Q.instancedTextureBindGroupLayout,
1511
1511
  entries: [
1512
- { binding: 0, resource: f },
1512
+ { binding: 0, resource: u },
1513
1513
  { binding: 1, resource: this.sampler }
1514
1514
  ]
1515
1515
  }), this.textureBindGroupCache.set(y, m)), I.setBindGroup(0, Q.instancedDataBindGroup, [c]), this.lastInstancedTextureBindGroup !== m && (I.setBindGroup(1, m), this.lastInstancedTextureBindGroup = m);
@@ -1548,15 +1548,15 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1548
1548
  n.byteOffset,
1549
1549
  o
1550
1550
  );
1551
- const c = A.textures[0], w = c ? this.textures.get(c.id) : null, l = (e = w == null ? void 0 : w.view) != null ? e : this.dummyTextureView, u = `alpha-video-instanced:none\0${(g = c == null ? void 0 : c.id) != null ? g : 0}`;
1552
- let y = this.textureBindGroupCache.get(u);
1551
+ const c = A.textures[0], f = c ? this.textures.get(c.id) : null, l = (e = f == null ? void 0 : f.view) != null ? e : this.dummyTextureView, w = `alpha-video-instanced:none\0${(g = c == null ? void 0 : c.id) != null ? g : 0}`;
1552
+ let y = this.textureBindGroupCache.get(w);
1553
1553
  y || (y = this.device.createBindGroup({
1554
1554
  layout: C.instancedTextureBindGroupLayout,
1555
1555
  entries: [
1556
1556
  { binding: 0, resource: l },
1557
1557
  { binding: 1, resource: this.sampler }
1558
1558
  ]
1559
- }), this.textureBindGroupCache.set(u, y)), I.setBindGroup(0, C.instancedDataBindGroup, [h]), this.lastInstancedTextureBindGroup !== y && (I.setBindGroup(1, y), this.lastInstancedTextureBindGroup = y);
1559
+ }), this.textureBindGroupCache.set(w, y)), I.setBindGroup(0, C.instancedDataBindGroup, [h]), this.lastInstancedTextureBindGroup !== y && (I.setBindGroup(1, y), this.lastInstancedTextureBindGroup = y);
1560
1560
  const m = A.vertexBuffer.id, p = A.indexBuffer.id;
1561
1561
  this.lastVertexBufferId !== m && (I.setVertexBuffer(0, E.buffer), this.lastVertexBufferId = m), this.lastIndexBufferId !== p && (I.setIndexBuffer(r.buffer, "uint32"), this.lastIndexBufferId = p), I.drawIndexed(A.indexCount, s, 0, 0, 0);
1562
1562
  }
@@ -1591,15 +1591,15 @@ const TQ = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), q
1591
1591
  n.byteOffset,
1592
1592
  o
1593
1593
  );
1594
- const c = A.textures[0], w = c ? this.textures.get(c.id) : null, l = (e = w == null ? void 0 : w.view) != null ? e : this.dummyTextureView, u = `vap-instanced:none\0${(g = c == null ? void 0 : c.id) != null ? g : 0}`;
1595
- let y = this.textureBindGroupCache.get(u);
1594
+ const c = A.textures[0], f = c ? this.textures.get(c.id) : null, l = (e = f == null ? void 0 : f.view) != null ? e : this.dummyTextureView, w = `vap-instanced:none\0${(g = c == null ? void 0 : c.id) != null ? g : 0}`;
1595
+ let y = this.textureBindGroupCache.get(w);
1596
1596
  y || (y = this.device.createBindGroup({
1597
1597
  layout: C.instancedTextureBindGroupLayout,
1598
1598
  entries: [
1599
1599
  { binding: 0, resource: l },
1600
1600
  { binding: 1, resource: this.sampler }
1601
1601
  ]
1602
- }), this.textureBindGroupCache.set(u, y)), I.setBindGroup(0, C.instancedDataBindGroup, [h]), this.lastInstancedTextureBindGroup !== y && (I.setBindGroup(1, y), this.lastInstancedTextureBindGroup = y);
1602
+ }), this.textureBindGroupCache.set(w, y)), I.setBindGroup(0, C.instancedDataBindGroup, [h]), this.lastInstancedTextureBindGroup !== y && (I.setBindGroup(1, y), this.lastInstancedTextureBindGroup = y);
1603
1603
  const m = A.vertexBuffer.id, p = A.indexBuffer.id;
1604
1604
  this.lastVertexBufferId !== m && (I.setVertexBuffer(0, E.buffer), this.lastVertexBufferId = m), this.lastIndexBufferId !== p && (I.setIndexBuffer(r.buffer, "uint32"), this.lastIndexBufferId = p), I.drawIndexed(A.indexCount, s, 0, 0, 0);
1605
1605
  }
@@ -2412,10 +2412,10 @@ class SB {
2412
2412
  function EC() {
2413
2413
  return typeof GPUQueue != "undefined" && typeof GPUQueue.prototype.copyExternalImageToTexture == "function";
2414
2414
  }
2415
- function yf() {
2415
+ function mf() {
2416
2416
  return typeof navigator != "undefined" && "gpu" in navigator && EC();
2417
2417
  }
2418
- function mf() {
2418
+ function Gf() {
2419
2419
  if (typeof document == "undefined") return !1;
2420
2420
  try {
2421
2421
  return document.createElement("canvas").getContext("webgl2") !== null;
@@ -2423,7 +2423,7 @@ function mf() {
2423
2423
  return !1;
2424
2424
  }
2425
2425
  }
2426
- function Gf() {
2426
+ function Ff() {
2427
2427
  if (typeof document == "undefined") return !1;
2428
2428
  try {
2429
2429
  return document.createElement("canvas").getContext("webgl") !== null;
@@ -2431,7 +2431,7 @@ function Gf() {
2431
2431
  return !1;
2432
2432
  }
2433
2433
  }
2434
- function Ff() {
2434
+ function Sf() {
2435
2435
  return typeof SharedArrayBuffer != "undefined" && typeof Atomics != "undefined";
2436
2436
  }
2437
2437
  function PQ() {
@@ -2489,14 +2489,14 @@ const MA = 13, fA = 9, XA = 4, Ss = 6;
2489
2489
  function Fn(i, A, t) {
2490
2490
  const e = Math.floor(i.length / MA), g = Math.floor(A.length / (XA * fA)), I = Math.floor(t.length / Ss), s = Math.min(e, g, I);
2491
2491
  for (let n = 0; n < s; n++) {
2492
- const B = n * MA, C = i[B], Q = i[B + 1], a = i[B + 2], E = i[B + 3], r = i[B + 4], o = i[B + 5], h = i[B + 6], c = i[B + 7], w = i[B + 8], l = i[B + 9], f = i[B + 10], u = i[B + 11], y = i[B + 12], m = h, p = c, N = a * C + h, U = E * C + c, S = a * C + r * Q + h, b = E * C + o * Q + c, R = r * Q + h, J = o * Q + c, M = n * XA * fA;
2493
- A[M] = m, A[M + 1] = p, A[M + 2] = 0, A[M + 3] = 1, A[M + 4] = 1, A[M + 5] = 1, A[M + 6] = w, A[M + 7] = l, A[M + 8] = f;
2492
+ const B = n * MA, C = i[B], Q = i[B + 1], a = i[B + 2], E = i[B + 3], r = i[B + 4], o = i[B + 5], h = i[B + 6], c = i[B + 7], f = i[B + 8], l = i[B + 9], u = i[B + 10], w = i[B + 11], y = i[B + 12], m = h, p = c, N = a * C + h, U = E * C + c, S = a * C + r * Q + h, b = E * C + o * Q + c, R = r * Q + h, J = o * Q + c, M = n * XA * fA;
2493
+ A[M] = m, A[M + 1] = p, A[M + 2] = 0, A[M + 3] = 1, A[M + 4] = 1, A[M + 5] = 1, A[M + 6] = f, A[M + 7] = l, A[M + 8] = u;
2494
2494
  const T = M + fA;
2495
- A[T] = N, A[T + 1] = U, A[T + 2] = 0, A[T + 3] = 1, A[T + 4] = 1, A[T + 5] = 1, A[T + 6] = w, A[T + 7] = u, A[T + 8] = f;
2495
+ A[T] = N, A[T + 1] = U, A[T + 2] = 0, A[T + 3] = 1, A[T + 4] = 1, A[T + 5] = 1, A[T + 6] = f, A[T + 7] = w, A[T + 8] = u;
2496
2496
  const Y = M + 2 * fA;
2497
- A[Y] = S, A[Y + 1] = b, A[Y + 2] = 0, A[Y + 3] = 1, A[Y + 4] = 1, A[Y + 5] = 1, A[Y + 6] = w, A[Y + 7] = u, A[Y + 8] = y;
2497
+ A[Y] = S, A[Y + 1] = b, A[Y + 2] = 0, A[Y + 3] = 1, A[Y + 4] = 1, A[Y + 5] = 1, A[Y + 6] = f, A[Y + 7] = w, A[Y + 8] = y;
2498
2498
  const q = M + 3 * fA;
2499
- A[q] = R, A[q + 1] = J, A[q + 2] = 0, A[q + 3] = 1, A[q + 4] = 1, A[q + 5] = 1, A[q + 6] = w, A[q + 7] = l, A[q + 8] = y;
2499
+ A[q] = R, A[q + 1] = J, A[q + 2] = 0, A[q + 3] = 1, A[q + 4] = 1, A[q + 5] = 1, A[q + 6] = f, A[q + 7] = l, A[q + 8] = y;
2500
2500
  const $ = n * Ss, j = n * XA;
2501
2501
  t[$] = j, t[$ + 1] = j + 1, t[$ + 2] = j + 2, t[$ + 3] = j, t[$ + 4] = j + 2, t[$ + 5] = j + 3;
2502
2502
  }
@@ -2760,13 +2760,13 @@ function la(i) {
2760
2760
  );
2761
2761
  const E = ((I = i.sprites) != null ? I : []).map(da), r = ((s = i.audios) != null ? s : []).map(
2762
2762
  (o) => {
2763
- var h, c, w, l, f;
2763
+ var h, c, f, l, u;
2764
2764
  return {
2765
2765
  audioKey: (h = o.audio_key) != null ? h : "",
2766
2766
  startFrame: (c = o.start_frame) != null ? c : 0,
2767
- endFrame: (w = o.end_frame) != null ? w : 0,
2767
+ endFrame: (f = o.end_frame) != null ? f : 0,
2768
2768
  startTime: (l = o.start_time) != null ? l : 0,
2769
- totalTime: (f = o.total_time) != null ? f : 0
2769
+ totalTime: (u = o.total_time) != null ? u : 0
2770
2770
  };
2771
2771
  }
2772
2772
  );
@@ -2776,10 +2776,10 @@ function da(i) {
2776
2776
  var A, t;
2777
2777
  let e = null;
2778
2778
  const g = ((A = i.frames) != null ? A : []).map((I) => {
2779
- var s, n, B, C, Q, a, E, r, o, h, c, w, l;
2780
- const f = Array.isArray(I.shapes) ? I.shapes : [];
2781
- let u;
2782
- return f.length === 0 ? (e = null, u = null) : ((s = f[0]) == null ? void 0 : s.kind) === "keep" ? u = e : (u = wa(f), e = u), {
2779
+ var s, n, B, C, Q, a, E, r, o, h, c, f, l;
2780
+ const u = Array.isArray(I.shapes) ? I.shapes : [];
2781
+ let w;
2782
+ return u.length === 0 ? (e = null, w = null) : ((s = u[0]) == null ? void 0 : s.kind) === "keep" ? w = e : (w = wa(u), e = w), {
2783
2783
  alpha: (n = I.alpha) != null ? n : 0,
2784
2784
  layout: I.layout ? {
2785
2785
  x: (B = I.layout.x) != null ? B : 0,
@@ -2793,10 +2793,10 @@ function da(i) {
2793
2793
  c: (o = I.transform.c) != null ? o : 0,
2794
2794
  d: (h = I.transform.d) != null ? h : 1,
2795
2795
  tx: (c = I.transform.tx) != null ? c : 0,
2796
- ty: (w = I.transform.ty) != null ? w : 0
2796
+ ty: (f = I.transform.ty) != null ? f : 0
2797
2797
  } : null,
2798
2798
  clipPath: (l = I.clip_path) != null ? l : "",
2799
- shapes: u
2799
+ shapes: w
2800
2800
  };
2801
2801
  });
2802
2802
  return {
@@ -2844,7 +2844,7 @@ function wa(i) {
2844
2844
  for (const h of i) {
2845
2845
  const c = h == null ? void 0 : h.kind;
2846
2846
  if (c !== "path" && c !== "rect" && c !== "ellipse") continue;
2847
- const w = {
2847
+ const f = {
2848
2848
  kind: c,
2849
2849
  pathData: (A = h.path_data) != null ? A : h.pathData,
2850
2850
  rect: h.rect ? {
@@ -2863,7 +2863,7 @@ function wa(i) {
2863
2863
  style: fa(h.style),
2864
2864
  transform: ua(h.transform)
2865
2865
  };
2866
- o.push(w);
2866
+ o.push(f);
2867
2867
  }
2868
2868
  return o.length > 0 ? o : null;
2869
2869
  }
@@ -2960,29 +2960,29 @@ function MB(i) {
2960
2960
  break;
2961
2961
  case "C": {
2962
2962
  for (; Q < C.length && !isNaN(parseFloat(C[Q])); ) {
2963
- const r = a(), o = a(), h = a(), c = a(), w = a(), l = a();
2964
- Zs(t, e, g, r, o, h, c, w, l), n = h, B = c, e = w, g = l;
2963
+ const r = a(), o = a(), h = a(), c = a(), f = a(), l = a();
2964
+ Zs(t, e, g, r, o, h, c, f, l), n = h, B = c, e = f, g = l;
2965
2965
  }
2966
2966
  break;
2967
2967
  }
2968
2968
  case "c": {
2969
2969
  for (; Q < C.length && !isNaN(parseFloat(C[Q])); ) {
2970
- const r = e + a(), o = g + a(), h = e + a(), c = g + a(), w = e + a(), l = g + a();
2971
- Zs(t, e, g, r, o, h, c, w, l), n = h, B = c, e = w, g = l;
2970
+ const r = e + a(), o = g + a(), h = e + a(), c = g + a(), f = e + a(), l = g + a();
2971
+ Zs(t, e, g, r, o, h, c, f, l), n = h, B = c, e = f, g = l;
2972
2972
  }
2973
2973
  break;
2974
2974
  }
2975
2975
  case "S": {
2976
2976
  for (; Q < C.length && !isNaN(parseFloat(C[Q])); ) {
2977
- const r = 2 * e - n, o = 2 * g - B, h = a(), c = a(), w = a(), l = a();
2978
- Zs(t, e, g, r, o, h, c, w, l), n = h, B = c, e = w, g = l;
2977
+ const r = 2 * e - n, o = 2 * g - B, h = a(), c = a(), f = a(), l = a();
2978
+ Zs(t, e, g, r, o, h, c, f, l), n = h, B = c, e = f, g = l;
2979
2979
  }
2980
2980
  break;
2981
2981
  }
2982
2982
  case "s": {
2983
2983
  for (; Q < C.length && !isNaN(parseFloat(C[Q])); ) {
2984
- const r = 2 * e - n, o = 2 * g - B, h = e + a(), c = g + a(), w = e + a(), l = g + a();
2985
- Zs(t, e, g, r, o, h, c, w, l), n = h, B = c, e = w, g = l;
2984
+ const r = 2 * e - n, o = 2 * g - B, h = e + a(), c = g + a(), f = e + a(), l = g + a();
2985
+ Zs(t, e, g, r, o, h, c, f, l), n = h, B = c, e = f, g = l;
2986
2986
  }
2987
2987
  break;
2988
2988
  }
@@ -3041,8 +3041,8 @@ function bB(i) {
3041
3041
  const Q = e[(C - 1 + B) % B], a = e[C], E = e[(C + 1) % B], r = i[Q], o = i[a], h = i[E], c = (o.x - r.x) * (h.y - r.y) - (o.y - r.y) * (h.x - r.x);
3042
3042
  if (!(I ? c > 0 : c < 0)) continue;
3043
3043
  let l = !1;
3044
- for (let f = 0; f < B; f++)
3045
- if (!(f === (C - 1 + B) % B || f === C || f === (C + 1) % B) && Na(i[e[f]], r, o, h)) {
3044
+ for (let u = 0; u < B; u++)
3045
+ if (!(u === (C - 1 + B) % B || u === C || u === (C + 1) % B) && Na(i[e[u]], r, o, h)) {
3046
3046
  l = !0;
3047
3047
  break;
3048
3048
  }
@@ -3129,8 +3129,8 @@ const Mn = 2048, aB = class AB {
3129
3129
  const e = this.getProjection(), g = [];
3130
3130
  let I = null;
3131
3131
  for (const s of t) {
3132
- const n = s.videoEntity, B = n.params.viewBoxWidth, C = n.params.viewBoxHeight, Q = uA(s), a = At(s, B, C), E = a.scaleX, r = a.scaleY, o = s.width * s.scale, h = s.height * s.scale, c = Q === "cover" ? o : Math.min(a.width, o), w = Q === "cover" ? h : Math.min(a.height, h), l = s.x, f = s.y, u = s.x, y = s.y;
3133
- g.length > 0 && (this.drawBatch(A, g, I, e), g.length = 0, I = null), A.setScissor(l, f, c, w), s.x = u + a.offsetX, s.y = y + a.offsetY;
3132
+ const n = s.videoEntity, B = n.params.viewBoxWidth, C = n.params.viewBoxHeight, Q = uA(s), a = At(s, B, C), E = a.scaleX, r = a.scaleY, o = s.width * s.scale, h = s.height * s.scale, c = Q === "cover" ? o : Math.min(a.width, o), f = Q === "cover" ? h : Math.min(a.height, h), l = s.x, u = s.y, w = s.x, y = s.y;
3133
+ g.length > 0 && (this.drawBatch(A, g, I, e), g.length = 0, I = null), A.setScissor(l, u, c, f), s.x = w + a.offsetX, s.y = y + a.offsetY;
3134
3134
  for (const m of n.sprites) {
3135
3135
  if (s.currentFrame < 0 || s.currentFrame >= m.frames.length) continue;
3136
3136
  const p = m.frames[s.currentFrame];
@@ -3146,7 +3146,7 @@ const Mn = 2048, aB = class AB {
3146
3146
  const J = !R.binding.override && (!I || I.id === R.binding.handle.id);
3147
3147
  b && b.indices.length > 0 ? (g.length > 0 && (this.drawBatch(A, g, I, e), g.length = 0, I = null), this.drawClippedSprite(A, R, b, e)) : J ? (g.push(R), I = R.binding.handle, g.length >= Mn && (this.drawBatch(A, g, I, e), g.length = 0, I = null)) : (g.length > 0 && (this.drawBatch(A, g, I, e), g.length = 0, I = null), this.drawSingleSprite(A, R, e));
3148
3148
  }
3149
- g.length > 0 && (this.drawBatch(A, g, I, e), g.length = 0, I = null), s.x = u, s.y = y;
3149
+ g.length > 0 && (this.drawBatch(A, g, I, e), g.length = 0, I = null), s.x = w, s.y = y;
3150
3150
  }
3151
3151
  g.length > 0 && this.drawBatch(A, g, I, e), A.resetScissor();
3152
3152
  }
@@ -3161,9 +3161,9 @@ const Mn = 2048, aB = class AB {
3161
3161
  return;
3162
3162
  }
3163
3163
  const s = this.pool.getFloat32(I * MA);
3164
- for (let w = 0; w < I; w++) {
3165
- const { slot: l, frame: f, binding: u, sx: y, sy: m } = t[w];
3166
- this.packFrameData(s, w, l, f, u, y, m);
3164
+ for (let f = 0; f < I; f++) {
3165
+ const { slot: l, frame: u, binding: w, sx: y, sy: m } = t[f];
3166
+ this.packFrameData(s, f, l, u, w, y, m);
3167
3167
  }
3168
3168
  const n = I * XA * fA, B = I * Ss, C = this.pool.getFloat32B(n), Q = this.pool.getUint32(B), a = new Float32Array(s.buffer, 0, I * MA), E = new Float32Array(C.buffer, 0, n), r = new Uint32Array(Q.buffer, 0, B);
3169
3169
  (!Rs() || Rn(a, E, r) === null) && Fn(a, E, r);
@@ -3197,12 +3197,12 @@ const Mn = 2048, aB = class AB {
3197
3197
  }
3198
3198
  drawClippedSprite(A, t, e, g) {
3199
3199
  var I, s, n, B, C, Q;
3200
- const { slot: a, frame: E, binding: r, sx: o, sy: h } = t, c = E.transform, w = ((I = c == null ? void 0 : c.a) != null ? I : 1) * o, l = ((s = c == null ? void 0 : c.b) != null ? s : 0) * h, f = ((n = c == null ? void 0 : c.c) != null ? n : 0) * o, u = ((B = c == null ? void 0 : c.d) != null ? B : 1) * h, y = ((C = c == null ? void 0 : c.tx) != null ? C : 0) * o + a.x, m = ((Q = c == null ? void 0 : c.ty) != null ? Q : 0) * h + a.y, p = e.vertices;
3200
+ const { slot: a, frame: E, binding: r, sx: o, sy: h } = t, c = E.transform, f = ((I = c == null ? void 0 : c.a) != null ? I : 1) * o, l = ((s = c == null ? void 0 : c.b) != null ? s : 0) * h, u = ((n = c == null ? void 0 : c.c) != null ? n : 0) * o, w = ((B = c == null ? void 0 : c.d) != null ? B : 1) * h, y = ((C = c == null ? void 0 : c.tx) != null ? C : 0) * o + a.x, m = ((Q = c == null ? void 0 : c.ty) != null ? Q : 0) * h + a.y, p = e.vertices;
3201
3201
  (!this.clipTransformedVertsScratch || this.clipTransformedVertsScratch.length < p.length) && (this.clipTransformedVertsScratch = new Float32Array(p.length));
3202
3202
  const N = this.clipTransformedVertsScratch;
3203
3203
  for (let Z = 0; Z < p.length; Z += 2) {
3204
3204
  const pA = p[Z], rA = p[Z + 1];
3205
- N[Z] = w * pA + f * rA + y, N[Z + 1] = l * pA + u * rA + m;
3205
+ N[Z] = f * pA + u * rA + y, N[Z + 1] = l * pA + w * rA + m;
3206
3206
  }
3207
3207
  const U = this.clipMaskDrawCursor++, S = this.ensureClipVertexBuffer(
3208
3208
  A,
@@ -3279,15 +3279,15 @@ const Mn = 2048, aB = class AB {
3279
3279
  });
3280
3280
  }
3281
3281
  packFrameData(A, t, e, g, I, s, n) {
3282
- var B, C, Q, a, E, r, o, h, c, w, l, f;
3283
- const u = g.layout, y = g.transform, m = I.rect, p = I.override;
3284
- let N = (C = (B = u == null ? void 0 : u.width) != null ? B : p == null ? void 0 : p.logicalWidth) != null ? C : 0, U = (a = (Q = u == null ? void 0 : u.height) != null ? Q : p == null ? void 0 : p.logicalHeight) != null ? a : 0, S = 0, b = 0;
3282
+ var B, C, Q, a, E, r, o, h, c, f, l, u;
3283
+ const w = g.layout, y = g.transform, m = I.rect, p = I.override;
3284
+ let N = (C = (B = w == null ? void 0 : w.width) != null ? B : p == null ? void 0 : p.logicalWidth) != null ? C : 0, U = (a = (Q = w == null ? void 0 : w.height) != null ? Q : p == null ? void 0 : p.logicalHeight) != null ? a : 0, S = 0, b = 0;
3285
3285
  if ((p == null ? void 0 : p.mode) === "dynamic") {
3286
- const j = (E = u == null ? void 0 : u.width) != null ? E : p.logicalWidth, _A = (r = u == null ? void 0 : u.height) != null ? r : p.logicalHeight;
3286
+ const j = (E = w == null ? void 0 : w.width) != null ? E : p.logicalWidth, _A = (r = w == null ? void 0 : w.height) != null ? r : p.logicalHeight;
3287
3287
  N = p.logicalWidth, U = p.logicalHeight, S = Math.max(0, (j - N) * 0.5), b = Math.max(0, (_A - U) * 0.5);
3288
3288
  }
3289
- const R = t * MA, J = ((o = y == null ? void 0 : y.a) != null ? o : 1) * s, M = ((h = y == null ? void 0 : y.b) != null ? h : 0) * n, T = ((c = y == null ? void 0 : y.c) != null ? c : 0) * s, Y = ((w = y == null ? void 0 : y.d) != null ? w : 1) * n;
3290
- let q = ((l = y == null ? void 0 : y.tx) != null ? l : 0) * s + J * S + T * b + e.x, $ = ((f = y == null ? void 0 : y.ty) != null ? f : 0) * n + M * S + Y * b + e.y;
3289
+ const R = t * MA, J = ((o = y == null ? void 0 : y.a) != null ? o : 1) * s, M = ((h = y == null ? void 0 : y.b) != null ? h : 0) * n, T = ((c = y == null ? void 0 : y.c) != null ? c : 0) * s, Y = ((f = y == null ? void 0 : y.d) != null ? f : 1) * n;
3290
+ let q = ((l = y == null ? void 0 : y.tx) != null ? l : 0) * s + J * S + T * b + e.x, $ = ((u = y == null ? void 0 : y.ty) != null ? u : 0) * n + M * S + Y * b + e.y;
3291
3291
  A[R] = N, A[R + 1] = U, A[R + 2] = J, A[R + 3] = M, A[R + 4] = T, A[R + 5] = Y, A[R + 6] = q, A[R + 7] = $, A[R + 8] = g.alpha * e.opacity, A[R + 9] = m.x, A[R + 10] = m.y, A[R + 11] = m.x + m.w, A[R + 12] = m.y + m.h;
3292
3292
  }
3293
3293
  resolveSpriteTextureBinding(A, t) {
@@ -3307,7 +3307,7 @@ const Mn = 2048, aB = class AB {
3307
3307
  };
3308
3308
  }
3309
3309
  drawShapeFrame(A, t, e, g, I, s, n) {
3310
- var B, C, Q, a, E, r, o, h, c, w, l, f, u;
3310
+ var B, C, Q, a, E, r, o, h, c, f, l, u, w;
3311
3311
  const y = this.getShapeMesh((B = e.shapes) != null ? B : null);
3312
3312
  if (!y || y.indices.length === 0) return;
3313
3313
  const m = this.getWhiteTexture(A), p = e.transform, N = ((C = p == null ? void 0 : p.a) != null ? C : 1) * g, U = ((Q = p == null ? void 0 : p.b) != null ? Q : 0) * I, S = ((a = p == null ? void 0 : p.c) != null ? a : 0) * g, b = ((E = p == null ? void 0 : p.d) != null ? E : 1) * I, R = ((r = p == null ? void 0 : p.tx) != null ? r : 0) * g + t.x, J = ((o = p == null ? void 0 : p.ty) != null ? o : 0) * I + t.y, M = y.vertices, T = M.length / 6 * fA;
@@ -3319,7 +3319,7 @@ const Mn = 2048, aB = class AB {
3319
3319
  }
3320
3320
  let q = null, $ = null;
3321
3321
  if (s && s.indices.length > 0) {
3322
- const L = e.transform, Z = ((h = L == null ? void 0 : L.a) != null ? h : 1) * g, pA = ((c = L == null ? void 0 : L.b) != null ? c : 0) * I, rA = ((w = L == null ? void 0 : L.c) != null ? w : 0) * g, wn = ((l = L == null ? void 0 : L.d) != null ? l : 1) * I, Dn = ((f = L == null ? void 0 : L.tx) != null ? f : 0) * g + t.x, pn = ((u = L == null ? void 0 : L.ty) != null ? u : 0) * I + t.y, CA = s.vertices;
3322
+ const L = e.transform, Z = ((h = L == null ? void 0 : L.a) != null ? h : 1) * g, pA = ((c = L == null ? void 0 : L.b) != null ? c : 0) * I, rA = ((f = L == null ? void 0 : L.c) != null ? f : 0) * g, wn = ((l = L == null ? void 0 : L.d) != null ? l : 1) * I, Dn = ((u = L == null ? void 0 : L.tx) != null ? u : 0) * g + t.x, pn = ((w = L == null ? void 0 : L.ty) != null ? w : 0) * I + t.y, CA = s.vertices;
3323
3323
  (!this.clipTransformedVertsScratch || this.clipTransformedVertsScratch.length < CA.length) && (this.clipTransformedVertsScratch = new Float32Array(CA.length));
3324
3324
  const oA = this.clipTransformedVertsScratch;
3325
3325
  for (let NA = 0; NA < CA.length; NA += 2) {
@@ -3454,8 +3454,8 @@ const Mn = 2048, aB = class AB {
3454
3454
  for (let n = 0; n < A.length; n++) {
3455
3455
  const B = A[n], C = A[(n + 1) % A.length], Q = C.x - B.x, a = C.y - B.y, E = Math.hypot(Q, a);
3456
3456
  if (E <= 1e-4) continue;
3457
- const r = -a / E * s, o = Q / E * s, h = g.length / 6, c = this.clamp01(t.r), w = this.clamp01(t.g), l = this.clamp01(t.b), f = this.clamp01(t.a);
3458
- g.push(B.x - r, B.y - o, c, w, l, f), g.push(B.x + r, B.y + o, c, w, l, f), g.push(C.x + r, C.y + o, c, w, l, f), g.push(C.x - r, C.y - o, c, w, l, f), I.push(h, h + 1, h + 2, h + 2, h + 3, h);
3457
+ const r = -a / E * s, o = Q / E * s, h = g.length / 6, c = this.clamp01(t.r), f = this.clamp01(t.g), l = this.clamp01(t.b), u = this.clamp01(t.a);
3458
+ g.push(B.x - r, B.y - o, c, f, l, u), g.push(B.x + r, B.y + o, c, f, l, u), g.push(C.x + r, C.y + o, c, f, l, u), g.push(C.x - r, C.y - o, c, f, l, u), I.push(h, h + 1, h + 2, h + 2, h + 3, h);
3459
3459
  }
3460
3460
  }
3461
3461
  clamp01(A) {
@@ -4123,18 +4123,18 @@ function sE(i, A, t, e, g, I, s, n) {
4123
4123
  }
4124
4124
  function pC(i, A, t, e) {
4125
4125
  var g, I, s, n, B, C;
4126
- const Q = Math.max(1, e.scale || 1), a = Math.max(1, Math.round(i)), E = Math.max(1, Math.round(A)), r = et(1, 1), o = it(r), h = (g = e.color) != null ? g : "#ffffff", c = Math.max(0, (I = e.padding) != null ? I : 2), w = Math.max(1, a - c * 2), l = Math.max(1, E - c * 2), f = Math.max(
4126
+ const Q = Math.max(1, e.scale || 1), a = Math.max(1, Math.round(i)), E = Math.max(1, Math.round(A)), r = et(1, 1), o = it(r), h = (g = e.color) != null ? g : "#ffffff", c = Math.max(0, (I = e.padding) != null ? I : 2), f = Math.max(1, a - c * 2), l = Math.max(1, E - c * 2), u = Math.max(
4127
4127
  1,
4128
4128
  (B = (n = (s = e.maxFontSize) != null ? s : e.fontSize) != null ? n : IE(e.fontStyle)) != null ? B : Math.max(8, l)
4129
- ), u = Math.max(1, Math.min((C = e.minFontSize) != null ? C : 8, f)), y = h, m = `${e.style === "b" ? "bold " : ""}${f * Q}px Arial`, p = iE(e.fontStyle, m, y), N = (M) => gE(p.font, M * Q), U = sE(
4129
+ ), w = Math.max(1, Math.min((C = e.minFontSize) != null ? C : 8, u)), y = h, m = `${e.style === "b" ? "bold " : ""}${u * Q}px Arial`, p = iE(e.fontStyle, m, y), N = (M) => gE(p.font, M * Q), U = sE(
4130
4130
  o,
4131
4131
  t,
4132
4132
  Q,
4133
4133
  N,
4134
- w,
4134
+ f,
4135
4135
  l,
4136
- u,
4137
- rs(e.fontSize) ? Math.min(e.fontSize, f) : f
4136
+ w,
4137
+ rs(e.fontSize) ? Math.min(e.fontSize, u) : u
4138
4138
  ), S = e.sizing === "intrinsic" ? Math.max(1, Math.min(a, Math.ceil(U.metrics.width + c * 2))) : a, b = e.sizing === "intrinsic" ? Math.max(1, Math.min(E, Math.ceil(U.metrics.height + c * 2))) : E, R = et(S * Q, b * Q), J = it(R);
4139
4139
  return J.clearRect(0, 0, R.width, R.height), J.textAlign = "center", J.textBaseline = "middle", J.font = N(U.fontSize), J.fillStyle = p.color, J.fillText(t, R.width / 2, R.height / 2), { canvas: R, logicalWidth: S, logicalHeight: b };
4140
4140
  }
@@ -4146,8 +4146,8 @@ function nE(i, A) {
4146
4146
  for (const E of s.frames) {
4147
4147
  const r = (e = (t = E.layout) == null ? void 0 : t.width) != null ? e : 0, o = (I = (g = E.layout) == null ? void 0 : g.height) != null ? I : 0;
4148
4148
  if (n = Math.max(n, r), B = Math.max(B, o), r > 0 && o > 0 && E.transform) {
4149
- const h = Math.abs(E.transform.a) * r + Math.abs(E.transform.c) * o, c = Math.abs(E.transform.b) * r + Math.abs(E.transform.d) * o, w = h > 0 ? h / r : 1, l = c > 0 ? c / o : 1, f = Math.min(w || 1, l || 1);
4150
- rs(f) && (C = Math.min(C, f));
4149
+ const h = Math.abs(E.transform.a) * r + Math.abs(E.transform.c) * o, c = Math.abs(E.transform.b) * r + Math.abs(E.transform.d) * o, f = h > 0 ? h / r : 1, l = c > 0 ? c / o : 1, u = Math.min(f || 1, l || 1);
4150
+ rs(u) && (C = Math.min(C, u));
4151
4151
  }
4152
4152
  }
4153
4153
  const Q = rs(C) ? C : 1;
@@ -4334,19 +4334,19 @@ function HB(i, A, t, e) {
4334
4334
  throw new Error("VAP CPU compositor state is incomplete");
4335
4335
  const { info: I } = A, s = I.videoW || i.width, n = I.videoH || i.height, [B, C, Q, a] = I.rgbFrame, [E, r, o, h] = I.aFrame;
4336
4336
  (i.rawCanvas.width !== s || i.rawCanvas.height !== n) && (i.rawCanvas.width = s, i.rawCanvas.height = n), i.rawCtx.clearRect(0, 0, s, n), i.rawCtx.drawImage(t, 0, 0, s, n);
4337
- const c = i.rawCtx.getImageData(0, 0, s, n).data, w = i.compositeCtx.createImageData(i.width, i.height), l = w.data;
4338
- for (let u = 0; u < i.height; u++) {
4339
- const y = Math.min(n - 1, Math.max(0, C + Math.floor(u / i.height * a))), m = Math.min(n - 1, Math.max(0, r + Math.floor(u / i.height * h)));
4337
+ const c = i.rawCtx.getImageData(0, 0, s, n).data, f = i.compositeCtx.createImageData(i.width, i.height), l = f.data;
4338
+ for (let w = 0; w < i.height; w++) {
4339
+ const y = Math.min(n - 1, Math.max(0, C + Math.floor(w / i.height * a))), m = Math.min(n - 1, Math.max(0, r + Math.floor(w / i.height * h)));
4340
4340
  for (let p = 0; p < i.width; p++) {
4341
- const N = Math.min(s - 1, Math.max(0, B + Math.floor(p / i.width * Q))), U = Math.min(s - 1, Math.max(0, E + Math.floor(p / i.width * o))), S = (y * s + N) * 4, b = (m * s + U) * 4, R = c[b] / 255, J = (u * i.width + p) * 4;
4341
+ const N = Math.min(s - 1, Math.max(0, B + Math.floor(p / i.width * Q))), U = Math.min(s - 1, Math.max(0, E + Math.floor(p / i.width * o))), S = (y * s + N) * 4, b = (m * s + U) * 4, R = c[b] / 255, J = (w * i.width + p) * 4;
4342
4342
  l[J] = Math.round(c[S] * R), l[J + 1] = Math.round(c[S + 1] * R), l[J + 2] = Math.round(c[S + 2] * R), l[J + 3] = Math.round(R * 255);
4343
4343
  }
4344
4344
  }
4345
- const f = (g = i.frameMap.get(e)) != null ? g : [];
4346
- for (const u of f) {
4347
- const y = i.resources.get(String(u.srcId));
4345
+ const u = (g = i.frameMap.get(e)) != null ? g : [];
4346
+ for (const w of u) {
4347
+ const y = i.resources.get(String(w.srcId));
4348
4348
  if (!y) continue;
4349
- const [m, p, N, U] = u.frame, [S, b, R, J] = u.mFrame;
4349
+ const [m, p, N, U] = w.frame, [S, b, R, J] = w.mFrame;
4350
4350
  if (N <= 0 || U <= 0 || R <= 0 || J <= 0) continue;
4351
4351
  (i.scratchCanvas.width !== N || i.scratchCanvas.height !== U) && (i.scratchCanvas.width = Math.max(1, Math.round(N)), i.scratchCanvas.height = Math.max(1, Math.round(U))), i.scratchCtx.clearRect(0, 0, i.scratchCanvas.width, i.scratchCanvas.height), i.scratchCtx.drawImage(y.source, 0, 0, i.scratchCanvas.width, i.scratchCanvas.height);
4352
4352
  const M = i.scratchCtx.getImageData(0, 0, i.scratchCanvas.width, i.scratchCanvas.height).data, T = Math.max(0, Math.floor(m)), Y = Math.max(0, Math.floor(p)), q = Math.min(i.width, Math.ceil(m + N)), $ = Math.min(i.height, Math.ceil(p + U));
@@ -4366,7 +4366,7 @@ function HB(i, A, t, e) {
4366
4366
  }
4367
4367
  }
4368
4368
  }
4369
- return i.compositeCtx.putImageData(w, 0, 0), i.compositeCanvas;
4369
+ return i.compositeCtx.putImageData(f, 0, 0), i.compositeCanvas;
4370
4370
  }
4371
4371
  var lE = Object.defineProperty, dE = (i, A, t) => A in i ? lE(i, A, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[A] = t, X = (i, A, t) => dE(i, typeof A != "symbol" ? A + "" : A, t);
4372
4372
  const Ln = 1024, _n = 32, Hs = class ms {
@@ -4485,10 +4485,10 @@ const Ln = 1024, _n = 32, Hs = class ms {
4485
4485
  var g, I, s, n;
4486
4486
  const B = A.vapConfig, { info: C } = B, Q = C.videoW > 0 ? C.videoW : (I = (g = A.webcodecsPlayback) == null ? void 0 : g.videoWidth) != null ? I : 1, a = C.videoH > 0 ? C.videoH : (n = (s = A.webcodecsPlayback) == null ? void 0 : s.videoHeight) != null ? n : 1, E = this.scratchTransform, { w: r, h: o } = tt(C), h = At(A, r, o);
4487
4487
  E[0] = h.width, E[5] = h.height, E[10] = 1, E[12] = A.x + h.offsetX, E[13] = A.y + h.offsetY, E[15] = 1, t.set(E, e);
4488
- const c = Ws(C.rgbFrame, Q, a), w = Ws(C.aFrame, Q, a), l = A.videoTextureHandle, f = rn(l.width, l.height, A.wcAtlasRect, this.scratchAtlasRemap);
4489
- t.set(f, e + 16);
4490
- const u = e + 20;
4491
- t[u + 0] = c.left, t[u + 1] = c.right, t[u + 2] = c.top, t[u + 3] = c.bottom, t[u + 4] = w.left, t[u + 5] = w.right, t[u + 6] = w.top, t[u + 7] = w.bottom, t[u + 8] = A.opacity, t[u + 9] = 0, t[u + 10] = 0, t[u + 11] = 0;
4488
+ const c = Ws(C.rgbFrame, Q, a), f = Ws(C.aFrame, Q, a), l = A.videoTextureHandle, u = rn(l.width, l.height, A.wcAtlasRect, this.scratchAtlasRemap);
4489
+ t.set(u, e + 16);
4490
+ const w = e + 20;
4491
+ t[w + 0] = c.left, t[w + 1] = c.right, t[w + 2] = c.top, t[w + 3] = c.bottom, t[w + 4] = f.left, t[w + 5] = f.right, t[w + 6] = f.top, t[w + 7] = f.bottom, t[w + 8] = A.opacity, t[w + 9] = 0, t[w + 10] = 0, t[w + 11] = 0;
4492
4492
  }
4493
4493
  syncMixedTexture(A, t) {
4494
4494
  var e;
@@ -4523,33 +4523,33 @@ const Ln = 1024, _n = 32, Hs = class ms {
4523
4523
  console.warn("[GiftStage:WC] VAP vapConfig missing — draw skipped", { giftId: t.id });
4524
4524
  return;
4525
4525
  }
4526
- const { info: a } = Q, E = a.videoW > 0 ? a.videoW : (g = (e = t.webcodecsPlayback) == null ? void 0 : e.videoWidth) != null ? g : 1, r = a.videoH > 0 ? a.videoH : (s = (I = t.webcodecsPlayback) == null ? void 0 : I.videoHeight) != null ? s : 1, o = new Float32Array(16), h = uA(t), { w: c, h: w } = tt(a), l = At(t, c, w);
4526
+ const { info: a } = Q, E = a.videoW > 0 ? a.videoW : (g = (e = t.webcodecsPlayback) == null ? void 0 : e.videoWidth) != null ? g : 1, r = a.videoH > 0 ? a.videoH : (s = (I = t.webcodecsPlayback) == null ? void 0 : I.videoHeight) != null ? s : 1, o = new Float32Array(16), h = uA(t), { w: c, h: f } = tt(a), l = At(t, c, f);
4527
4527
  o[0] = l.width, o[5] = l.height, o[10] = 1, o[12] = t.x + l.offsetX, o[13] = t.y + l.offsetY, o[15] = 1;
4528
- const f = Ws(a.rgbFrame, E, r), u = Ws(a.aFrame, E, r), y = t.videoTextureHandle, m = rn(y.width, y.height, t.wcAtlasRect, this.scratchAtlasRemap), p = new Float32Array([
4528
+ const u = Ws(a.rgbFrame, E, r), w = Ws(a.aFrame, E, r), y = t.videoTextureHandle, m = rn(y.width, y.height, t.wcAtlasRect, this.scratchAtlasRemap), p = new Float32Array([
4529
4529
  0,
4530
4530
  0,
4531
- f.left,
4532
- f.top,
4533
4531
  u.left,
4534
4532
  u.top,
4533
+ w.left,
4534
+ w.top,
4535
4535
  1,
4536
4536
  0,
4537
- f.right,
4538
- f.top,
4539
4537
  u.right,
4540
4538
  u.top,
4539
+ w.right,
4540
+ w.top,
4541
4541
  1,
4542
4542
  1,
4543
- f.right,
4544
- f.bottom,
4545
4543
  u.right,
4546
4544
  u.bottom,
4545
+ w.right,
4546
+ w.bottom,
4547
4547
  0,
4548
4548
  1,
4549
- f.left,
4550
- f.bottom,
4551
4549
  u.left,
4552
- u.bottom
4550
+ u.bottom,
4551
+ w.left,
4552
+ w.bottom
4553
4553
  ]);
4554
4554
  this.quadVB = this.ensureBuffer(A, this.quadVB, p, "vertex"), this.quadIB = this.ensureBuffer(A, this.quadIB, this.quadIndices, "index");
4555
4555
  const N = {
@@ -7209,33 +7209,33 @@ async function Rr(i, A, t = 4096, e = 2, g) {
7209
7209
  throw new Error("No atlas pages built");
7210
7210
  const C = /* @__PURE__ */ new Map(), Q = [];
7211
7211
  for (let o = 0; o < B.length; o++) {
7212
- const h = B[o], c = Gr(h.atlasW, h.atlasH), w = Fr(c);
7213
- if (!w) throw new Error("Atlas: 2d context unavailable");
7214
- w.clearRect(0, 0, h.atlasW, h.atlasH);
7215
- for (let u = 0; u < h.rects.length; u += Vn) {
7216
- const y = h.rects.slice(u, u + Vn);
7212
+ const h = B[o], c = Gr(h.atlasW, h.atlasH), f = Fr(c);
7213
+ if (!f) throw new Error("Atlas: 2d context unavailable");
7214
+ f.clearRect(0, 0, h.atlasW, h.atlasH);
7215
+ for (let w = 0; w < h.rects.length; w += Vn) {
7216
+ const y = h.rects.slice(w, w + Vn);
7217
7217
  for (const m of y) {
7218
7218
  const p = i.get(m.key);
7219
- w.drawImage(p, m.x, m.y, m.w, m.h), Sr(c, w, m, h.atlasW, h.atlasH, e);
7219
+ f.drawImage(p, m.x, m.y, m.w, m.h), Sr(c, f, m, h.atlasW, h.atlasH, e);
7220
7220
  }
7221
- u + Vn < h.rects.length && await wr();
7221
+ w + Vn < h.rects.length && await wr();
7222
7222
  }
7223
- const l = (g == null ? void 0 : g.captureEncodedPng) === !0 ? Nr(c) : void 0, f = A.createTexture(c, {
7223
+ const l = (g == null ? void 0 : g.captureEncodedPng) === !0 ? Nr(c) : void 0, u = A.createTexture(c, {
7224
7224
  width: h.atlasW,
7225
7225
  height: h.atlasH,
7226
7226
  filter: "linear",
7227
7227
  premultiplyAlpha: !0
7228
7228
  });
7229
- for (const u of h.rects)
7230
- C.set(u.key, {
7231
- x: u.x / h.atlasW,
7232
- y: u.y / h.atlasH,
7233
- w: u.w / h.atlasW,
7234
- h: u.h / h.atlasH,
7229
+ for (const w of h.rects)
7230
+ C.set(w.key, {
7231
+ x: w.x / h.atlasW,
7232
+ y: w.y / h.atlasH,
7233
+ w: w.w / h.atlasW,
7234
+ h: w.h / h.atlasH,
7235
7235
  textureIndex: o
7236
7236
  });
7237
7237
  Q.push({
7238
- textureHandle: f,
7238
+ textureHandle: u,
7239
7239
  atlasWidth: h.atlasW,
7240
7240
  atlasHeight: h.atlasH,
7241
7241
  encodedPngBytesPromise: l
@@ -7253,26 +7253,26 @@ async function Rr(i, A, t = 4096, e = 2, g) {
7253
7253
  encodedPngBytesPromises: E.length > 0 ? E : void 0
7254
7254
  };
7255
7255
  }
7256
- function Sf(i) {
7256
+ function Nf(i) {
7257
7257
  return i;
7258
7258
  }
7259
- function Nf(i) {
7259
+ function Rf(i) {
7260
7260
  return i * i;
7261
7261
  }
7262
- function Rf(i) {
7262
+ function Uf(i) {
7263
7263
  return i * (2 - i);
7264
7264
  }
7265
- function Uf(i) {
7265
+ function kf(i) {
7266
7266
  return i < 0.5 ? 2 * i * i : -1 + (4 - 2 * i) * i;
7267
7267
  }
7268
7268
  function Ur(i) {
7269
7269
  const A = i - 1;
7270
7270
  return A * A * A + 1;
7271
7271
  }
7272
- function kf(i) {
7272
+ function Mf(i) {
7273
7273
  return i < 0.5 ? 4 * i * i * i : (i - 1) * (2 * i - 2) * (2 * i - 2) + 1;
7274
7274
  }
7275
- function Mf(i) {
7275
+ function xf(i) {
7276
7276
  return 1 + 2.70158 * Math.pow(i - 1, 3) + 1.70158 * Math.pow(i - 1, 2);
7277
7277
  }
7278
7278
  var kr = Object.defineProperty, RC = (i, A) => {
@@ -11559,9 +11559,9 @@ var fn = class extends V {
11559
11559
  buildTrakSampleLists(A) {
11560
11560
  let t, e, g, I, s, n;
11561
11561
  A.samples = [], A.samples_duration = 0, A.samples_size = 0;
11562
- const B = A.mdia.minf.stbl.stco || A.mdia.minf.stbl.co64, C = A.mdia.minf.stbl.stsc, Q = A.mdia.minf.stbl.stsz || A.mdia.minf.stbl.stz2, a = A.mdia.minf.stbl.stts, E = A.mdia.minf.stbl.ctts, r = A.mdia.minf.stbl.stss, o = A.mdia.minf.stbl.stsd, h = A.mdia.minf.stbl.subs, c = A.mdia.minf.stbl.stdp, w = A.mdia.minf.stbl.sbgps, l = A.mdia.minf.stbl.sgpds;
11563
- let f = -1, u = -1, y = -1, m = -1, p = 0, N = 0, U = 0;
11564
- if (kA.initSampleGroups(A, void 0, w, l), typeof Q != "undefined") {
11562
+ const B = A.mdia.minf.stbl.stco || A.mdia.minf.stbl.co64, C = A.mdia.minf.stbl.stsc, Q = A.mdia.minf.stbl.stsz || A.mdia.minf.stbl.stz2, a = A.mdia.minf.stbl.stts, E = A.mdia.minf.stbl.ctts, r = A.mdia.minf.stbl.stss, o = A.mdia.minf.stbl.stsd, h = A.mdia.minf.stbl.subs, c = A.mdia.minf.stbl.stdp, f = A.mdia.minf.stbl.sbgps, l = A.mdia.minf.stbl.sgpds;
11563
+ let u = -1, w = -1, y = -1, m = -1, p = 0, N = 0, U = 0;
11564
+ if (kA.initSampleGroups(A, void 0, f, l), typeof Q != "undefined") {
11565
11565
  for (t = 0; t < Q.sample_sizes.length; t++) {
11566
11566
  const S = {
11567
11567
  number: t,
@@ -11570,7 +11570,7 @@ var fn = class extends V {
11570
11570
  alreadyRead: 0,
11571
11571
  size: Q.sample_sizes[t]
11572
11572
  };
11573
- A.samples[t] = S, A.samples_size += S.size, t === 0 ? (g = 1, e = 0, S.chunk_index = g, S.chunk_run_index = e, n = C.samples_per_chunk[e], s = 0, e + 1 < C.first_chunk.length ? I = C.first_chunk[e + 1] - 1 : I = 1 / 0) : t < n ? (S.chunk_index = g, S.chunk_run_index = e) : (g++, S.chunk_index = g, s = 0, g <= I || (e++, e + 1 < C.first_chunk.length ? I = C.first_chunk[e + 1] - 1 : I = 1 / 0), S.chunk_run_index = e, n += C.samples_per_chunk[e]), S.description_index = C.sample_description_index[S.chunk_run_index] - 1, S.description = o.entries[S.description_index], S.offset = B.chunk_offsets[S.chunk_index - 1] + s, s += S.size, t > f && (u++, f < 0 && (f = 0), f += a.sample_counts[u]), t > 0 ? (A.samples[t - 1].duration = a.sample_deltas[u], A.samples_duration += A.samples[t - 1].duration, S.dts = A.samples[t - 1].dts + A.samples[t - 1].duration) : S.dts = 0, E ? (t >= y && (m++, y < 0 && (y = 0), y += E.sample_counts[m]), S.cts = A.samples[t].dts + E.sample_offsets[m]) : S.cts = S.dts, r ? (t === r.sample_numbers[p] - 1 ? (S.is_sync = !0, p++) : (S.is_sync = !1, S.degradation_priority = 0), h && h.entries[N].sample_delta + U === t + 1 && (S.subsamples = h.entries[N].subsamples, U += h.entries[N].sample_delta, N++)) : S.is_sync = !0, kA.process_sdtp(A.mdia.minf.stbl.sdtp, S, S.number), c ? S.degradation_priority = c.priority[t] : S.degradation_priority = 0, h && h.entries[N].sample_delta + U === t && (S.subsamples = h.entries[N].subsamples, U += h.entries[N].sample_delta), (w.length > 0 || l.length > 0) && kA.setSampleGroupProperties(A, S, t, A.sample_groups_info);
11573
+ A.samples[t] = S, A.samples_size += S.size, t === 0 ? (g = 1, e = 0, S.chunk_index = g, S.chunk_run_index = e, n = C.samples_per_chunk[e], s = 0, e + 1 < C.first_chunk.length ? I = C.first_chunk[e + 1] - 1 : I = 1 / 0) : t < n ? (S.chunk_index = g, S.chunk_run_index = e) : (g++, S.chunk_index = g, s = 0, g <= I || (e++, e + 1 < C.first_chunk.length ? I = C.first_chunk[e + 1] - 1 : I = 1 / 0), S.chunk_run_index = e, n += C.samples_per_chunk[e]), S.description_index = C.sample_description_index[S.chunk_run_index] - 1, S.description = o.entries[S.description_index], S.offset = B.chunk_offsets[S.chunk_index - 1] + s, s += S.size, t > u && (w++, u < 0 && (u = 0), u += a.sample_counts[w]), t > 0 ? (A.samples[t - 1].duration = a.sample_deltas[w], A.samples_duration += A.samples[t - 1].duration, S.dts = A.samples[t - 1].dts + A.samples[t - 1].duration) : S.dts = 0, E ? (t >= y && (m++, y < 0 && (y = 0), y += E.sample_counts[m]), S.cts = A.samples[t].dts + E.sample_offsets[m]) : S.cts = S.dts, r ? (t === r.sample_numbers[p] - 1 ? (S.is_sync = !0, p++) : (S.is_sync = !1, S.degradation_priority = 0), h && h.entries[N].sample_delta + U === t + 1 && (S.subsamples = h.entries[N].subsamples, U += h.entries[N].sample_delta, N++)) : S.is_sync = !0, kA.process_sdtp(A.mdia.minf.stbl.sdtp, S, S.number), c ? S.degradation_priority = c.priority[t] : S.degradation_priority = 0, h && h.entries[N].sample_delta + U === t && (S.subsamples = h.entries[N].subsamples, U += h.entries[N].sample_delta), (f.length > 0 || l.length > 0) && kA.setSampleGroupProperties(A, S, t, A.sample_groups_info);
11574
11574
  }
11575
11575
  t > 0 && (A.samples[t - 1].duration = Math.max(A.mdia.mdhd.duration - A.samples[t - 1].dts, 0), A.samples_duration += A.samples[t - 1].duration);
11576
11576
  }
@@ -11595,32 +11595,32 @@ var fn = class extends V {
11595
11595
  const h = A - 1;
11596
11596
  let c = g;
11597
11597
  r.flags & bs ? c = r.sample_flags[o] : o === 0 && r.flags & sn && (c = r.first_sample_flags);
11598
- let w = e;
11599
- r.flags & xs && (w = r.sample_size[o]), Q.samples_size += w;
11598
+ let f = e;
11599
+ r.flags & xs && (f = r.sample_size[o]), Q.samples_size += f;
11600
11600
  let l = t;
11601
11601
  r.flags & Ms && (l = r.sample_duration[o]), Q.samples_duration += l;
11602
- let f;
11603
- Q.first_traf_merged || o > 0 ? f = Q.samples[Q.samples.length - 1].dts + Q.samples[Q.samples.length - 1].duration : (C.tfdt ? f = C.tfdt.baseMediaDecodeTime : f = 0, Q.first_traf_merged = !0);
11604
- let u = f;
11605
- r.flags & Ys && (u = f + r.sample_composition_time_offset[o]);
11602
+ let u;
11603
+ Q.first_traf_merged || o > 0 ? u = Q.samples[Q.samples.length - 1].dts + Q.samples[Q.samples.length - 1].duration : (C.tfdt ? u = C.tfdt.baseMediaDecodeTime : u = 0, Q.first_traf_merged = !0);
11604
+ let w = u;
11605
+ r.flags & Ys && (w = u + r.sample_composition_time_offset[o]);
11606
11606
  const y = !!(C.tfhd.flags & An), m = !!(C.tfhd.flags & XB), p = !!(r.flags & ks);
11607
11607
  let N = 0;
11608
11608
  y ? N = C.tfhd.base_data_offset : m || E === 0 ? N = n.start : N = I;
11609
11609
  let U;
11610
- E === 0 && o === 0 ? p ? U = N + r.data_offset : U = N : U = I, I = U + w;
11610
+ E === 0 && o === 0 ? p ? U = N + r.data_offset : U = N : U = I, I = U + f;
11611
11611
  const S = C.sample_number;
11612
11612
  C.sample_number++;
11613
11613
  const b = {
11614
- cts: u,
11614
+ cts: w,
11615
11615
  description_index: h,
11616
11616
  description: Q.mdia.minf.stbl.stsd.entries[h],
11617
- dts: f,
11617
+ dts: u,
11618
11618
  duration: l,
11619
11619
  moof_number: this.lastMoofIndex,
11620
11620
  number_in_traf: S,
11621
11621
  number: Q.samples.length,
11622
11622
  offset: U,
11623
- size: w,
11623
+ size: f,
11624
11624
  timescale: Q.mdia.mdhd.timescale,
11625
11625
  track_id: Q.tkhd.track_id,
11626
11626
  is_sync: !(c >> 16 & 1),
@@ -12051,14 +12051,14 @@ var fn = class extends V {
12051
12051
  o.flags = 1, r.addEntry(o);
12052
12052
  const h = C.addBox(new HC());
12053
12053
  h.addBox(new IQ()).addEntry(a);
12054
- const w = h.addBox(new nQ());
12055
- w.sample_counts = [], w.sample_deltas = [];
12054
+ const f = h.addBox(new nQ());
12055
+ f.sample_counts = [], f.sample_deltas = [];
12056
12056
  const l = h.addBox(new gQ());
12057
12057
  l.first_chunk = [], l.samples_per_chunk = [], l.sample_description_index = [];
12058
- const f = h.addBox(new eQ());
12059
- f.chunk_offsets = [];
12060
- const u = h.addBox(new sQ());
12061
- u.sample_sizes = [];
12058
+ const u = h.addBox(new eQ());
12059
+ u.chunk_offsets = [];
12060
+ const w = h.addBox(new sQ());
12061
+ w.sample_sizes = [];
12062
12062
  const y = this.moov.mvex.addBox(new BB());
12063
12063
  return y.track_id = t.id, y.default_sample_description_index = t.default_sample_description_index || 1, y.default_sample_duration = t.default_sample_duration || 0, y.default_sample_size = t.default_sample_size || 0, y.default_sample_flags = t.default_sample_flags || 0, this.buildTrakSampleLists(e), t.id;
12064
12064
  }
@@ -12079,7 +12079,7 @@ var fn = class extends V {
12079
12079
  } = {}) {
12080
12080
  const h = this.getTrackById(A);
12081
12081
  if (h === void 0) return;
12082
- const c = e ? e - 1 : 0, w = {
12082
+ const c = e ? e - 1 : 0, f = {
12083
12083
  number: h.samples.length,
12084
12084
  track_id: h.tkhd.track_id,
12085
12085
  timescale: h.mdia.mdhd.timescale,
@@ -12100,11 +12100,11 @@ var fn = class extends V {
12100
12100
  offset: o,
12101
12101
  subsamples: r
12102
12102
  };
12103
- h.samples.push(w), h.samples_size += w.size, h.samples_duration += w.duration, h.first_dts === void 0 && (h.first_dts = s), this.processSamples();
12104
- const l = this.addBox(this.createMoof([w]));
12103
+ h.samples.push(f), h.samples_size += f.size, h.samples_duration += f.duration, h.first_dts === void 0 && (h.first_dts = s), this.processSamples();
12104
+ const l = this.addBox(this.createMoof([f]));
12105
12105
  l.computeSize(), l.trafs[0].truns[0].data_offset = l.size + 8;
12106
- const f = this.addBox(new Cn());
12107
- return f.data = new Uint8Array(t), w;
12106
+ const u = this.addBox(new Cn());
12107
+ return u.data = new Uint8Array(t), f;
12108
12108
  }
12109
12109
  /** @bundle isofile-advanced-creation.js */
12110
12110
  createMoof(A) {
@@ -14011,7 +14011,7 @@ function Yd(i) {
14011
14011
  return;
14012
14012
  }
14013
14013
  const o = [];
14014
- e.onSamples = (c, w, l) => {
14014
+ e.onSamples = (c, f, l) => {
14015
14015
  o.push(...l);
14016
14016
  }, e.setExtractionOptions(r.id, null, {
14017
14017
  nbSamples: Math.max(r.nb_samples, 1)
@@ -14075,9 +14075,9 @@ async function Jd(i, A, t, e) {
14075
14075
  if (t.length === 0)
14076
14076
  return { frames: [], timesSec: new Float64Array(0) };
14077
14077
  const s = [...t].sort((o, h) => {
14078
- var c, w, l, f;
14079
- const u = ((w = (c = o.dts) != null ? c : o.cts) != null ? w : 0) - ((f = (l = h.dts) != null ? l : h.cts) != null ? f : 0);
14080
- return u !== 0 ? u : 0;
14078
+ var c, f, l, u;
14079
+ const w = ((f = (c = o.dts) != null ? c : o.cts) != null ? f : 0) - ((u = (l = h.dts) != null ? l : h.cts) != null ? u : 0);
14080
+ return w !== 0 ? w : 0;
14081
14081
  }), n = [], B = new VideoDecoder({
14082
14082
  output: (o) => {
14083
14083
  n.push(o);
@@ -14091,16 +14091,16 @@ async function Jd(i, A, t, e) {
14091
14091
  for (const o of s) {
14092
14092
  const h = o.data;
14093
14093
  if (!h || h.byteLength === 0) continue;
14094
- const c = (I = (g = o.cts) != null ? g : o.dts) != null ? I : 0, w = Math.round(c / e * 1e6), l = o.duration && e > 0 ? Math.round(o.duration / e * 1e6) : void 0, f = new Uint8Array(h.byteLength);
14095
- f.set(h);
14096
- const u = new EncodedVideoChunk({
14094
+ const c = (I = (g = o.cts) != null ? g : o.dts) != null ? I : 0, f = Math.round(c / e * 1e6), l = o.duration && e > 0 ? Math.round(o.duration / e * 1e6) : void 0, u = new Uint8Array(h.byteLength);
14095
+ u.set(h);
14096
+ const w = new EncodedVideoChunk({
14097
14097
  type: o.is_sync ? "key" : "delta",
14098
- timestamp: w,
14098
+ timestamp: f,
14099
14099
  duration: l,
14100
- data: f
14100
+ data: u
14101
14101
  });
14102
14102
  try {
14103
- B.decode(u);
14103
+ B.decode(w);
14104
14104
  } catch (y) {
14105
14105
  console.error("[GiftStage:WC] decoder.decode failed", { chunkIndex: Q, err: y });
14106
14106
  try {
@@ -21372,19 +21372,19 @@ class OA {
21372
21372
  const g = new vd(), I = Wd++, s = new Zd(t);
21373
21373
  let n = 0, B = 0, C = 0, Q = new Float64Array(0), a = !1, E = null;
21374
21374
  const r = (l) => {
21375
- const f = l.data;
21376
- if (!(!f || f.id !== I)) {
21377
- if (f.type === "meta") {
21378
- n = f.duration, B = f.videoWidth, C = f.videoHeight;
21379
- const u = f.timesSec;
21380
- Q = Float64Array.from(u), a = !0;
21375
+ const u = l.data;
21376
+ if (!(!u || u.id !== I)) {
21377
+ if (u.type === "meta") {
21378
+ n = u.duration, B = u.videoWidth, C = u.videoHeight;
21379
+ const w = u.timesSec;
21380
+ Q = Float64Array.from(w), a = !0;
21381
21381
  return;
21382
21382
  }
21383
- if (f.type === "frame") {
21384
- s.set(f.index, f.frame);
21383
+ if (u.type === "frame") {
21384
+ s.set(u.index, u.frame);
21385
21385
  return;
21386
21386
  }
21387
- f.type !== "eos" && f.type === "error" && (E = new Error(f.message));
21387
+ u.type !== "eos" && u.type === "error" && (E = new Error(u.message));
21388
21388
  }
21389
21389
  }, o = (l) => {
21390
21390
  E = new Error(l.message || "Worker error");
@@ -21403,14 +21403,14 @@ class OA {
21403
21403
  );
21404
21404
  try {
21405
21405
  if (await sC(() => a || E != null, 6e4, "meta"), E) throw E;
21406
- const l = n > 0 ? n : 1e-6, f = jn(Q, l, 0);
21407
- if (await sC(() => E != null || s.bestAtOrBefore(f) != null, 6e4, "first frame"), E) throw E;
21406
+ const l = n > 0 ? n : 1e-6, u = jn(Q, l, 0);
21407
+ if (await sC(() => E != null || s.bestAtOrBefore(u) != null, 6e4, "first frame"), E) throw E;
21408
21408
  } catch (l) {
21409
21409
  throw g.removeEventListener("message", r), g.removeEventListener("error", o), g.terminate(), s.clear(), l instanceof Error ? l : new Error(String(l));
21410
21410
  }
21411
- const c = Q.length > 0 ? Q[0] : 0, w = Q.length > 0 ? Q[Q.length - 1] : 0;
21411
+ const c = Q.length > 0 ? Q[0] : 0, f = Q.length > 0 ? Q[Q.length - 1] : 0;
21412
21412
  return console.info(
21413
- `[GiftStage:WC] worker streaming ready frames=${Q.length} duration=${n.toFixed(4)}s size=${B}x${C} times=[${c.toFixed(4)} … ${w.toFixed(4)}] ring=${t}`
21413
+ `[GiftStage:WC] worker streaming ready frames=${Q.length} duration=${n.toFixed(4)}s size=${B}x${C} times=[${c.toFixed(4)} … ${f.toFixed(4)}] ring=${t}`
21414
21414
  ), new OA(
21415
21415
  n,
21416
21416
  B,
@@ -21700,8 +21700,8 @@ function gf(i, A, t, e) {
21700
21700
  const Q = t.get(String(C.srcId));
21701
21701
  if (!Q) continue;
21702
21702
  if (B + ln > g.length) break;
21703
- const [a, E, r, o] = C.frame, [h, c, w, l] = C.mFrame, f = dn(a + s, E + n, r, o, i.info.videoW, i.info.videoH), u = dn(h, c, w, l, i.info.videoW, i.info.videoH);
21704
- g[B++] = Q, g[B++] = f[0], g[B++] = f[1], g[B++] = f[2], g[B++] = f[3], g[B++] = u[0], g[B++] = u[1], g[B++] = u[2], g[B++] = u[3];
21703
+ const [a, E, r, o] = C.frame, [h, c, f, l] = C.mFrame, u = dn(a + s, E + n, r, o, i.info.videoW, i.info.videoH), w = dn(h, c, f, l, i.info.videoW, i.info.videoH);
21704
+ g[B++] = Q, g[B++] = u[0], g[B++] = u[1], g[B++] = u[2], g[B++] = u[3], g[B++] = w[0], g[B++] = w[1], g[B++] = w[2], g[B++] = w[3];
21705
21705
  }
21706
21706
  return g;
21707
21707
  }
@@ -21730,19 +21730,19 @@ class If {
21730
21730
  this.gl = n;
21731
21731
  const B = Math.max(1, n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)), C = Math.max(0, B - 1), Q = [];
21732
21732
  let a = 1;
21733
- for (const f of (s = A.src) != null ? s : []) {
21734
- const u = e.get(String(f.srcId));
21735
- if (!u) continue;
21733
+ for (const u of (s = A.src) != null ? s : []) {
21734
+ const w = e.get(String(u.srcId));
21735
+ if (!w) continue;
21736
21736
  if (a > C) {
21737
21737
  console.warn("[GiftStage] VAP mixed resources exceed texture unit limit, skipping", {
21738
- srcId: f.srcId,
21739
- srcTag: f.srcTag,
21738
+ srcId: u.srcId,
21739
+ srcTag: u.srcTag,
21740
21740
  maxUnits: B
21741
21741
  });
21742
21742
  continue;
21743
21743
  }
21744
- const y = CC(n, a, u.source, !0), m = {
21745
- srcId: String(f.srcId),
21744
+ const y = CC(n, a, w.source, !0), m = {
21745
+ srcId: String(u.srcId),
21746
21746
  unit: a,
21747
21747
  texture: y
21748
21748
  };
@@ -21759,15 +21759,15 @@ class If {
21759
21759
  this.program = E.program, this.vertexShader = E.vertexShader, this.fragmentShader = E.fragmentShader, this.imagePosLoc = n.getUniformLocation(this.program, "image_pos"), this.videoTexture = CC(n, 0);
21760
21760
  const r = n.getUniformLocation(this.program, "u_image_video");
21761
21761
  r !== null && n.uniform1i(r, 0);
21762
- for (const f of this.resourceEntries) {
21763
- const u = n.getUniformLocation(this.program, `u_image${f.unit}`);
21764
- u !== null && n.uniform1i(u, f.unit);
21762
+ for (const u of this.resourceEntries) {
21763
+ const w = n.getUniformLocation(this.program, `u_image${u.unit}`);
21764
+ w !== null && n.uniform1i(w, u.unit);
21765
21765
  }
21766
21766
  const o = n.createBuffer();
21767
21767
  if (!o) throw new Error("Failed to create VAP mix vertex buffer");
21768
21768
  this.vertexBuffer = o, n.bindBuffer(n.ARRAY_BUFFER, this.vertexBuffer), n.bufferData(n.ARRAY_BUFFER, Af(A.info), n.STATIC_DRAW);
21769
- const h = 6 * Float32Array.BYTES_PER_ELEMENT, c = n.getAttribLocation(this.program, "a_position"), w = n.getAttribLocation(this.program, "a_texCoord"), l = n.getAttribLocation(this.program, "a_alpha_texCoord");
21770
- n.enableVertexAttribArray(c), n.vertexAttribPointer(c, 2, n.FLOAT, !1, h, 0), n.enableVertexAttribArray(w), n.vertexAttribPointer(w, 2, n.FLOAT, !1, h, 2 * Float32Array.BYTES_PER_ELEMENT), n.enableVertexAttribArray(l), n.vertexAttribPointer(l, 2, n.FLOAT, !1, h, 4 * Float32Array.BYTES_PER_ELEMENT), n.viewport(0, 0, this.canvas.width, this.canvas.height), n.disable(n.BLEND), n.disable(n.DEPTH_TEST), n.clearColor(0, 0, 0, 0), n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL, n.NONE);
21769
+ const h = 6 * Float32Array.BYTES_PER_ELEMENT, c = n.getAttribLocation(this.program, "a_position"), f = n.getAttribLocation(this.program, "a_texCoord"), l = n.getAttribLocation(this.program, "a_alpha_texCoord");
21770
+ n.enableVertexAttribArray(c), n.vertexAttribPointer(c, 2, n.FLOAT, !1, h, 0), n.enableVertexAttribArray(f), n.vertexAttribPointer(f, 2, n.FLOAT, !1, h, 2 * Float32Array.BYTES_PER_ELEMENT), n.enableVertexAttribArray(l), n.vertexAttribPointer(l, 2, n.FLOAT, !1, h, 4 * Float32Array.BYTES_PER_ELEMENT), n.viewport(0, 0, this.canvas.width, this.canvas.height), n.disable(n.BLEND), n.disable(n.DEPTH_TEST), n.clearColor(0, 0, 0, 0), n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL, n.NONE);
21771
21771
  }
21772
21772
  render(A, t) {
21773
21773
  const e = this.gl;
@@ -21986,8 +21986,8 @@ function lf(i) {
21986
21986
  const a = A.u32(), E = [];
21987
21987
  for (let r = 0; r < a; r++) {
21988
21988
  const o = A.string(), h = A.u32(), c = [];
21989
- for (let w = 0; w < h; w++) {
21990
- const l = A.u8(), f = A.f32(), u = l & 1 ? {
21989
+ for (let f = 0; f < h; f++) {
21990
+ const l = A.u8(), u = A.f32(), w = l & 1 ? {
21991
21991
  x: A.f32(),
21992
21992
  y: A.f32(),
21993
21993
  width: A.f32(),
@@ -22006,7 +22006,7 @@ function lf(i) {
22006
22006
  p = [];
22007
22007
  for (let U = 0; U < N; U++) p.push(hf(A));
22008
22008
  }
22009
- c.push({ alpha: f, layout: u, transform: y, clipPath: m, shapes: p });
22009
+ c.push({ alpha: u, layout: w, transform: y, clipPath: m, shapes: p });
22010
22010
  }
22011
22011
  E.push({ imageKey: o, frames: c });
22012
22012
  }
@@ -22073,11 +22073,14 @@ var wf = Object.defineProperty, Df = (i, A, t) => A in i ? wf(i, A, { enumerable
22073
22073
  function aC(i) {
22074
22074
  return Number.isFinite(i) ? Math.max(0, Math.min(1, i)) : 1;
22075
22075
  }
22076
+ function pf(i) {
22077
+ return "delayMs" in i;
22078
+ }
22076
22079
  const cs = class WA {
22077
22080
  constructor(A) {
22078
22081
  z(this, "sharedSVGAEntities", /* @__PURE__ */ new Map()), z(this, "pendingSharedSVGAEntities", /* @__PURE__ */ new Map()), z(this, "sharedVideoSources", /* @__PURE__ */ new Map()), z(this, "sharedHtmlVideos", /* @__PURE__ */ new Map()), z(this, "sharedVideoTextures", /* @__PURE__ */ new Map()), z(this, "pendingSharedHtmlVideos", /* @__PURE__ */ new Map()), z(this, "completedPlaybackSlots", /* @__PURE__ */ new Set()), z(this, "playbackCompleteWaiters", /* @__PURE__ */ new Map()), z(this, "canvas"), z(this, "backend", null), z(this, "manager", null), z(this, "options"), z(this, "ready"), z(this, "destroyed", !1), z(this, "resizeObserver", null), z(this, "nextRenderOrder", 0), z(this, "onWindowLayout", () => {
22079
22082
  this.destroyed || this.syncCanvasSize();
22080
- }), this.options = A, this.canvas = document.createElement("canvas"), this.canvas.style.cssText = "position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:9999;", A.container.appendChild(this.canvas), this.ready = this.init();
22083
+ }), this.options = A, this.canvas = document.createElement("canvas"), this.canvas.style.cssText = "position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:9999;", A.container.appendChild(this.canvas), this.ready = this.init();
22081
22084
  }
22082
22085
  backingStoreDpr() {
22083
22086
  const A = this.options.resolution;
@@ -22187,44 +22190,56 @@ const cs = class WA {
22187
22190
  }
22188
22191
  createGiftAnimationChain(A, t, e) {
22189
22192
  const g = Array.isArray(e) ? [...e] : e ? [e] : [], I = [];
22190
- let s = !1;
22191
- const n = {
22192
- to: (B) => {
22193
+ let s = !1, n = !1, B = null, C = null;
22194
+ const Q = (E) => new Promise((r) => {
22195
+ if (n) {
22196
+ r();
22197
+ return;
22198
+ }
22199
+ C = r, B = setTimeout(() => {
22200
+ B = null, C = null, r();
22201
+ }, Math.max(0, E));
22202
+ }), a = {
22203
+ to: (E) => {
22204
+ if (s) throw new Error("Gift animation chain has already started");
22205
+ return g.push(E), a;
22206
+ },
22207
+ then: (E) => {
22193
22208
  if (s) throw new Error("Gift animation chain has already started");
22194
- return g.push(B), n;
22209
+ return g.push(E), a;
22195
22210
  },
22196
- then: (B) => {
22211
+ delay: (E) => {
22197
22212
  if (s) throw new Error("Gift animation chain has already started");
22198
- return g.push(B), n;
22213
+ return g.push({ delayMs: Math.max(0, E) }), a;
22199
22214
  },
22200
- onComplete: (B) => {
22215
+ onComplete: (E) => {
22201
22216
  if (s) throw new Error("Gift animation chain has already started");
22202
- return I.push(B), n;
22217
+ return I.push(E), a;
22203
22218
  },
22204
- start: async (B = "immediate") => {
22205
- var C, Q;
22219
+ start: async (E = "immediate") => {
22220
+ var r, o;
22206
22221
  s = !0;
22207
- const a = (C = this.manager) == null ? void 0 : C.getSlot(A.id);
22208
- if (!a || a.state === "finished") return t;
22209
- B === "afterGiftComplete" && await this.waitForGiftPlaybackComplete(A.id);
22210
- let E = !1;
22211
- for (const r of g) {
22212
- if (!((Q = this.manager) != null && Q.getSlot(A.id)) || A.state === "finished") {
22213
- E = !0;
22222
+ const h = (r = this.manager) == null ? void 0 : r.getSlot(A.id);
22223
+ if (!h || h.state === "finished") return t;
22224
+ E === "afterGiftComplete" && await this.waitForGiftPlaybackComplete(A.id);
22225
+ let c = !1;
22226
+ for (const f of g) {
22227
+ if (n || !((o = this.manager) != null && o.getSlot(A.id)) || A.state === "finished") {
22228
+ c = !0;
22214
22229
  break;
22215
22230
  }
22216
- await this.runGiftAnimationStep(A, t, r);
22231
+ pf(f) ? await Q(f.delayMs) : await this.runGiftAnimationStep(A, t, f);
22217
22232
  }
22218
- if (!E)
22219
- for (const r of I) r(t);
22233
+ if (!c && !n)
22234
+ for (const f of I) f(t);
22220
22235
  return t;
22221
22236
  },
22222
22237
  cancel: () => {
22223
- var B;
22224
- (B = this.manager) == null || B.postAnimator.cancelForGift(A.id);
22238
+ var E;
22239
+ n = !0, B != null && (clearTimeout(B), B = null), C == null || C(), C = null, (E = this.manager) == null || E.postAnimator.cancelForGift(A.id);
22225
22240
  }
22226
22241
  };
22227
- return n;
22242
+ return a;
22228
22243
  }
22229
22244
  async addGift(A) {
22230
22245
  var t, e, g, I;
@@ -22578,12 +22593,12 @@ const cs = class WA {
22578
22593
  h
22579
22594
  );
22580
22595
  else {
22581
- const w = this.backend.createTexture(Q, {
22596
+ const f = this.backend.createTexture(Q, {
22582
22597
  width: E,
22583
22598
  height: r,
22584
22599
  filter: "linear"
22585
22600
  });
22586
- A.videoTextureHandle = w;
22601
+ A.videoTextureHandle = f;
22587
22602
  }
22588
22603
  }
22589
22604
  A.videoElement = null;
@@ -22954,12 +22969,12 @@ z(cs, "SVGA_ATLAS_PADDING", 2);
22954
22969
  z(cs, "DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS", 100);
22955
22970
  z(cs, "DEFAULT_RESOURCE_CACHE_MEMORY_BYTES", 128 * 1024 * 1024);
22956
22971
  z(cs, "DEFAULT_RESOURCE_CACHE_PERSISTENT_BYTES", 2048 * 1024 * 1024);
22957
- let xf = cs;
22972
+ let bf = cs;
22958
22973
  export {
22959
22974
  DE as AlphaVideoRenderer,
22960
22975
  NE as AudioManager,
22961
22976
  ya as BufferPool,
22962
- xf as GiftStage,
22977
+ bf as GiftStage,
22963
22978
  GE as PostAnimator,
22964
22979
  YE as RenderManager,
22965
22980
  ka as SVGABatchRenderer,
@@ -22970,25 +22985,25 @@ export {
22970
22985
  VQ as WebGPUBackend,
22971
22986
  Rr as buildAtlas,
22972
22987
  Fn as buildBatchVerticesJS,
22973
- Ff as canSharedArrayBuffer,
22974
- Gf as canWebGL1,
22975
- mf as canWebGL2,
22976
- yf as canWebGPU,
22988
+ Sf as canSharedArrayBuffer,
22989
+ Ff as canWebGL1,
22990
+ Gf as canWebGL2,
22991
+ mf as canWebGPU,
22977
22992
  kB as clamp,
22978
22993
  $Q as createBackend,
22979
22994
  tr as decodeSVGAProto,
22980
- kf as easeInOutCubic,
22981
- Uf as easeInOutQuad,
22982
- Nf as easeInQuad,
22983
- Mf as easeOutBack,
22995
+ Mf as easeInOutCubic,
22996
+ kf as easeInOutQuad,
22997
+ Rf as easeInQuad,
22998
+ xf as easeOutBack,
22984
22999
  Ur as easeOutCubic,
22985
- Rf as easeOutQuad,
23000
+ Uf as easeOutQuad,
22986
23001
  Ga as generateId,
22987
23002
  LE as inflateJS,
22988
23003
  oa as initWasm,
22989
23004
  Rs as isWasmReady,
22990
23005
  zs as lerp,
22991
- Sf as linear,
23006
+ Nf as linear,
22992
23007
  $A as ortho,
22993
23008
  WB as parseSVGA,
22994
23009
  LB as parseVAPConfig