@taole/giftstage 0.1.31 → 0.1.32
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/README.md +5 -0
- package/dist/gift-stage.cjs.js +5 -5
- package/dist/gift-stage.es.js +402 -384
- package/dist/types/index.d.ts +7 -0
- package/package.json +1 -1
package/dist/gift-stage.es.js
CHANGED
|
@@ -1446,12 +1446,12 @@ const AA = class _ {
|
|
|
1446
1446
|
if (typeof VideoFrame != "undefined" && I instanceof VideoFrame) {
|
|
1447
1447
|
const s = I, D = s.displayWidth || s.codedWidth, h = s.displayHeight || s.codedHeight;
|
|
1448
1448
|
if (!D || !h) return;
|
|
1449
|
-
const w = C != null ? C : D,
|
|
1450
|
-
if (w !== D ||
|
|
1449
|
+
const w = C != null ? C : D, r = E != null ? E : h;
|
|
1450
|
+
if (w !== D || r !== h) {
|
|
1451
1451
|
this.drawVideoLikeSourceToTextureRegion(
|
|
1452
1452
|
o.texture,
|
|
1453
1453
|
w,
|
|
1454
|
-
|
|
1454
|
+
r,
|
|
1455
1455
|
s,
|
|
1456
1456
|
i.origin.x,
|
|
1457
1457
|
i.origin.y
|
|
@@ -1480,12 +1480,12 @@ const AA = class _ {
|
|
|
1480
1480
|
if (I instanceof HTMLVideoElement) {
|
|
1481
1481
|
const s = I, D = s.videoWidth, h = s.videoHeight;
|
|
1482
1482
|
if (s.readyState < HTMLMediaElement.HAVE_CURRENT_DATA || !D || !h) return;
|
|
1483
|
-
const w = C != null ? C : D,
|
|
1484
|
-
if (w !== D ||
|
|
1483
|
+
const w = C != null ? C : D, r = E != null ? E : h;
|
|
1484
|
+
if (w !== D || r !== h) {
|
|
1485
1485
|
this.drawVideoLikeSourceToTextureRegion(
|
|
1486
1486
|
o.texture,
|
|
1487
1487
|
w,
|
|
1488
|
-
|
|
1488
|
+
r,
|
|
1489
1489
|
s,
|
|
1490
1490
|
i.origin.x,
|
|
1491
1491
|
i.origin.y
|
|
@@ -1610,20 +1610,20 @@ const AA = class _ {
|
|
|
1610
1610
|
console.warn("[WebGPU] uniform slot overflow; increase maxUniformSlots");
|
|
1611
1611
|
return;
|
|
1612
1612
|
}
|
|
1613
|
-
const
|
|
1613
|
+
const r = w * this.uniformSlotStride, n = A.uniforms.u_projection;
|
|
1614
1614
|
if (t.textureCount > 0) {
|
|
1615
1615
|
const y = A.uniforms.u_transform, R = y instanceof Float32Array && y.length >= 16 ? y : $g, S = A.uniforms.u_atlasRemap, N = S instanceof Float32Array && S.length >= 4 ? S : sC, U = typeof A.uniforms.u_opacity == "number" ? A.uniforms.u_opacity : 1, L = typeof A.uniforms.u_rgbPremultiplied == "number" ? A.uniforms.u_rgbPremultiplied : 1;
|
|
1616
|
-
if (
|
|
1616
|
+
if (n instanceof Float32Array && n.length >= 16) {
|
|
1617
1617
|
const l = this.uniformScratch160;
|
|
1618
|
-
l.set(
|
|
1618
|
+
l.set(n.length === 16 ? n : n.subarray(0, 16), 0), l.set(R.length === 16 ? R : R.subarray(0, 16), 16), l.set(N.length === 4 ? N : N.subarray(0, 4), 32), l[36] = U, l[37] = L, l[38] = 0, l[39] = 0, this.device.queue.writeBuffer(this.uniformBuffer, r, l.buffer, l.byteOffset, 160);
|
|
1619
1619
|
} else {
|
|
1620
|
-
this.device.queue.writeBuffer(this.uniformBuffer,
|
|
1620
|
+
this.device.queue.writeBuffer(this.uniformBuffer, r + 64, R.buffer, R.byteOffset, 64), this.device.queue.writeBuffer(this.uniformBuffer, r + 128, N.buffer, N.byteOffset, 16);
|
|
1621
1621
|
const l = this.uniformOpacityScratch;
|
|
1622
|
-
l[0] = U, l[1] = L, l[2] = 0, l[3] = 0, this.device.queue.writeBuffer(this.uniformBuffer,
|
|
1622
|
+
l[0] = U, l[1] = L, l[2] = 0, l[3] = 0, this.device.queue.writeBuffer(this.uniformBuffer, r + 144, l);
|
|
1623
1623
|
}
|
|
1624
|
-
} else if (
|
|
1624
|
+
} else if (n instanceof Float32Array && n.length >= 16) {
|
|
1625
1625
|
const y = A.uniforms.u_transform, R = y instanceof Float32Array && y.length >= 16 ? y : $g, S = this.uniformScratch128;
|
|
1626
|
-
S.set(
|
|
1626
|
+
S.set(n.length === 16 ? n : n.subarray(0, 16), 0), S.set(R.length === 16 ? R : R.subarray(0, 16), 16), this.device.queue.writeBuffer(this.uniformBuffer, r, S.buffer, S.byteOffset, 128);
|
|
1627
1627
|
}
|
|
1628
1628
|
if (t.textureCount === 1) {
|
|
1629
1629
|
const y = A.textures.length > 0 ? A.textures[0] : null, R = y ? this.textures.get(y.id) : null, S = (g = R == null ? void 0 : R.view) != null ? g : this.dummyTextureView, N = (Q = y == null ? void 0 : y.id) != null ? Q : 0;
|
|
@@ -1638,7 +1638,7 @@ const AA = class _ {
|
|
|
1638
1638
|
{ binding: 1, resource: S },
|
|
1639
1639
|
{ binding: 2, resource: this.sampler }
|
|
1640
1640
|
]
|
|
1641
|
-
}), this.texturedBindGroupCache.set(N, U)), s.setBindGroup(0, U, [
|
|
1641
|
+
}), this.texturedBindGroupCache.set(N, U)), s.setBindGroup(0, U, [r]);
|
|
1642
1642
|
} else if (t.textureCount === 2) {
|
|
1643
1643
|
const y = A.textures[0], R = A.textures[1], S = y ? this.textures.get(y.id) : null, N = R ? this.textures.get(R.id) : null, U = (C = y == null ? void 0 : y.id) != null ? C : 0, L = (E = R == null ? void 0 : R.id) != null ? E : 0;
|
|
1644
1644
|
let l = this.dualTexturedBindGroupCache.get(U);
|
|
@@ -1655,7 +1655,7 @@ const AA = class _ {
|
|
|
1655
1655
|
{ binding: 2, resource: (i = N == null ? void 0 : N.view) != null ? i : this.dummyTextureView },
|
|
1656
1656
|
{ binding: 3, resource: this.sampler }
|
|
1657
1657
|
]
|
|
1658
|
-
}), l.set(L, f)), s.setBindGroup(0, f, [
|
|
1658
|
+
}), l.set(L, f)), s.setBindGroup(0, f, [r]);
|
|
1659
1659
|
} else
|
|
1660
1660
|
t.uniformOnlyBindGroup || (t.uniformOnlyBindGroup = this.device.createBindGroup({
|
|
1661
1661
|
layout: t.bindGroupLayout,
|
|
@@ -1665,11 +1665,11 @@ const AA = class _ {
|
|
|
1665
1665
|
resource: { buffer: this.uniformBuffer, offset: 0, size: 128 }
|
|
1666
1666
|
}
|
|
1667
1667
|
]
|
|
1668
|
-
})), s.setBindGroup(0, t.uniformOnlyBindGroup, [
|
|
1669
|
-
const c = this.buffers.get(A.vertexBuffer.id),
|
|
1670
|
-
if (!c || !
|
|
1668
|
+
})), s.setBindGroup(0, t.uniformOnlyBindGroup, [r]);
|
|
1669
|
+
const c = this.buffers.get(A.vertexBuffer.id), F = this.buffers.get(A.indexBuffer.id);
|
|
1670
|
+
if (!c || !F) return;
|
|
1671
1671
|
const G = A.vertexBuffer.id, M = A.indexBuffer.id;
|
|
1672
|
-
this.lastVertexBufferId !== G && (s.setVertexBuffer(0, c.buffer), this.lastVertexBufferId = G), this.lastIndexBufferId !== M && (s.setIndexBuffer(
|
|
1672
|
+
this.lastVertexBufferId !== G && (s.setVertexBuffer(0, c.buffer), this.lastVertexBufferId = G), this.lastIndexBufferId !== M && (s.setIndexBuffer(F.buffer, "uint32"), this.lastIndexBufferId = M), s.drawIndexed(A.indexCount);
|
|
1673
1673
|
}
|
|
1674
1674
|
/** One `drawIndexed` with `instanceCount` for all SVGA sprites sharing the same atlas. */
|
|
1675
1675
|
drawInstancedSvga(A) {
|
|
@@ -1689,13 +1689,13 @@ const AA = class _ {
|
|
|
1689
1689
|
const h = this.buffers.get(A.vertexBuffer.id), w = this.buffers.get(A.indexBuffer.id);
|
|
1690
1690
|
if (!h || !w) return;
|
|
1691
1691
|
this.ensureInstancedProjection(D);
|
|
1692
|
-
const
|
|
1693
|
-
if (
|
|
1692
|
+
const r = E * _.SVGA_INSTANCED_STRIDE, n = this.instancedStorageRingOffset, c = this.ensureInstancedStorageBuffer();
|
|
1693
|
+
if (n + _.INSTANCED_SVGA_CHUNK_BYTES > c.size) {
|
|
1694
1694
|
console.warn("[WebGPU] instanced SVGA storage ring full");
|
|
1695
1695
|
return;
|
|
1696
1696
|
}
|
|
1697
|
-
this.instancedStorageRingOffset += Ig(
|
|
1698
|
-
const
|
|
1697
|
+
this.instancedStorageRingOffset += Ig(r, this.storageBindOffsetAlign), this.device.queue.writeBuffer(c, n, o.buffer, o.byteOffset, r);
|
|
1698
|
+
const F = A.textures[0], G = F ? this.textures.get(F.id) : null, M = (g = G == null ? void 0 : G.view) != null ? g : this.dummyTextureView, y = (Q = F == null ? void 0 : F.id) != null ? Q : 0;
|
|
1699
1699
|
let R = this.instancedTextureBindGroupCache.get(y);
|
|
1700
1700
|
R || (R = this.device.createBindGroup({
|
|
1701
1701
|
layout: this.instancedTextureBindGroupLayout,
|
|
@@ -1703,7 +1703,7 @@ const AA = class _ {
|
|
|
1703
1703
|
{ binding: 0, resource: M },
|
|
1704
1704
|
{ binding: 1, resource: this.sampler }
|
|
1705
1705
|
]
|
|
1706
|
-
}), this.instancedTextureBindGroupCache.set(y, R)), C.setBindGroup(0, a.instancedDataBindGroup, [
|
|
1706
|
+
}), this.instancedTextureBindGroupCache.set(y, R)), C.setBindGroup(0, a.instancedDataBindGroup, [n]), this.lastInstancedTextureBindGroup !== R && (C.setBindGroup(1, R), this.lastInstancedTextureBindGroup = R);
|
|
1707
1707
|
const S = A.vertexBuffer.id, N = A.indexBuffer.id;
|
|
1708
1708
|
this.lastVertexBufferId !== S && (C.setVertexBuffer(0, h.buffer), this.lastVertexBufferId = S), this.lastIndexBufferId !== N && (C.setIndexBuffer(w.buffer, "uint32"), this.lastIndexBufferId = N), C.drawIndexed(A.indexCount, E, 0, 0, 0);
|
|
1709
1709
|
}
|
|
@@ -1723,18 +1723,18 @@ const AA = class _ {
|
|
|
1723
1723
|
const s = this.buffers.get(A.vertexBuffer.id), D = this.buffers.get(A.indexBuffer.id);
|
|
1724
1724
|
if (!s || !D) return;
|
|
1725
1725
|
this.ensureInstancedProjection(t);
|
|
1726
|
-
const h = E * _.ALPHA_INSTANCED_STRIDE, w = this.instancedStorageRingOffset,
|
|
1727
|
-
if (w + _.INSTANCED_ALPHA_CHUNK_BYTES >
|
|
1726
|
+
const h = E * _.ALPHA_INSTANCED_STRIDE, w = this.instancedStorageRingOffset, r = this.ensureInstancedStorageBuffer();
|
|
1727
|
+
if (w + _.INSTANCED_ALPHA_CHUNK_BYTES > r.size) {
|
|
1728
1728
|
console.warn("[WebGPU] instanced alpha storage ring full");
|
|
1729
1729
|
return;
|
|
1730
1730
|
}
|
|
1731
|
-
this.instancedStorageRingOffset += Ig(h, this.storageBindOffsetAlign), this.device.queue.writeBuffer(
|
|
1732
|
-
const
|
|
1731
|
+
this.instancedStorageRingOffset += Ig(h, this.storageBindOffsetAlign), this.device.queue.writeBuffer(r, w, o.buffer, o.byteOffset, h);
|
|
1732
|
+
const n = A.textures[0], c = n ? this.textures.get(n.id) : null, F = (g = c == null ? void 0 : c.view) != null ? g : this.dummyTextureView, G = (Q = n == null ? void 0 : n.id) != null ? Q : 0;
|
|
1733
1733
|
let M = this.instancedTextureBindGroupCache.get(G);
|
|
1734
1734
|
M || (M = this.device.createBindGroup({
|
|
1735
1735
|
layout: this.instancedTextureBindGroupLayout,
|
|
1736
1736
|
entries: [
|
|
1737
|
-
{ binding: 0, resource:
|
|
1737
|
+
{ binding: 0, resource: F },
|
|
1738
1738
|
{ binding: 1, resource: this.sampler }
|
|
1739
1739
|
]
|
|
1740
1740
|
}), this.instancedTextureBindGroupCache.set(G, M)), C.setBindGroup(0, e.instancedDataBindGroup, [w]), this.lastInstancedTextureBindGroup !== M && (C.setBindGroup(1, M), this.lastInstancedTextureBindGroup = M);
|
|
@@ -1756,18 +1756,18 @@ const AA = class _ {
|
|
|
1756
1756
|
const s = this.buffers.get(A.vertexBuffer.id), D = this.buffers.get(A.indexBuffer.id);
|
|
1757
1757
|
if (!s || !D) return;
|
|
1758
1758
|
this.ensureInstancedProjection(t);
|
|
1759
|
-
const h = E * _.VAP_INSTANCED_STRIDE, w = this.instancedStorageRingOffset,
|
|
1760
|
-
if (w + _.INSTANCED_VAP_CHUNK_BYTES >
|
|
1759
|
+
const h = E * _.VAP_INSTANCED_STRIDE, w = this.instancedStorageRingOffset, r = this.ensureInstancedStorageBuffer();
|
|
1760
|
+
if (w + _.INSTANCED_VAP_CHUNK_BYTES > r.size) {
|
|
1761
1761
|
console.warn("[WebGPU] instanced VAP storage ring full");
|
|
1762
1762
|
return;
|
|
1763
1763
|
}
|
|
1764
|
-
this.instancedStorageRingOffset += Ig(h, this.storageBindOffsetAlign), this.device.queue.writeBuffer(
|
|
1765
|
-
const
|
|
1764
|
+
this.instancedStorageRingOffset += Ig(h, this.storageBindOffsetAlign), this.device.queue.writeBuffer(r, w, o.buffer, o.byteOffset, h);
|
|
1765
|
+
const n = A.textures[0], c = n ? this.textures.get(n.id) : null, F = (g = c == null ? void 0 : c.view) != null ? g : this.dummyTextureView, G = (Q = n == null ? void 0 : n.id) != null ? Q : 0;
|
|
1766
1766
|
let M = this.instancedTextureBindGroupCache.get(G);
|
|
1767
1767
|
M || (M = this.device.createBindGroup({
|
|
1768
1768
|
layout: this.instancedTextureBindGroupLayout,
|
|
1769
1769
|
entries: [
|
|
1770
|
-
{ binding: 0, resource:
|
|
1770
|
+
{ binding: 0, resource: F },
|
|
1771
1771
|
{ binding: 1, resource: this.sampler }
|
|
1772
1772
|
]
|
|
1773
1773
|
}), this.instancedTextureBindGroupCache.set(G, M)), C.setBindGroup(0, e.instancedDataBindGroup, [w]), this.lastInstancedTextureBindGroup !== M && (C.setBindGroup(1, M), this.lastInstancedTextureBindGroup = M);
|
|
@@ -2809,15 +2809,15 @@ function zB(B, A) {
|
|
|
2809
2809
|
const e = B.length;
|
|
2810
2810
|
let a = A != null ? A : 0;
|
|
2811
2811
|
if (a <= 0)
|
|
2812
|
-
for (const
|
|
2813
|
-
a = Math.max(a,
|
|
2814
|
-
const t = B.map((
|
|
2812
|
+
for (const F of B)
|
|
2813
|
+
a = Math.max(a, F.frames.length);
|
|
2814
|
+
const t = B.map((F) => F.imageKey), s = new Float32Array(e * a * xg), D = [], h = /* @__PURE__ */ new Map(), w = new Int32Array(e * a).fill(-1), r = [], n = new Int32Array(e * a).fill(-1);
|
|
2815
2815
|
let c = !1;
|
|
2816
|
-
for (let
|
|
2817
|
-
const G = B[
|
|
2816
|
+
for (let F = 0; F < e; F++) {
|
|
2817
|
+
const G = B[F];
|
|
2818
2818
|
let M = null, y = -1;
|
|
2819
2819
|
for (let R = 0; R < a; R++) {
|
|
2820
|
-
const S = G.frames[R], N = dC(
|
|
2820
|
+
const S = G.frames[R], N = dC(F, R, a);
|
|
2821
2821
|
if (!S) {
|
|
2822
2822
|
s[N + 2] = 1, s[N + 5] = 1;
|
|
2823
2823
|
continue;
|
|
@@ -2827,7 +2827,7 @@ function zB(B, A) {
|
|
|
2827
2827
|
const f = (o = S.clipPath) != null ? o : "";
|
|
2828
2828
|
if (f.length > 0) {
|
|
2829
2829
|
let K = h.get(f);
|
|
2830
|
-
K === void 0 && (K = D.length, D.push(f), h.set(f, K)), w[
|
|
2830
|
+
K === void 0 && (K = D.length, D.push(f), h.set(f, K)), w[F * a + R] = K;
|
|
2831
2831
|
}
|
|
2832
2832
|
const d = S.shapes;
|
|
2833
2833
|
if (!d || d.length === 0) {
|
|
@@ -2835,11 +2835,11 @@ function zB(B, A) {
|
|
|
2835
2835
|
continue;
|
|
2836
2836
|
}
|
|
2837
2837
|
if (((i = d[0]) == null ? void 0 : i.kind) === "keep") {
|
|
2838
|
-
y >= 0 && (F
|
|
2838
|
+
y >= 0 && (n[F * a + R] = y, c = !0);
|
|
2839
2839
|
continue;
|
|
2840
2840
|
}
|
|
2841
2841
|
if (M !== null && d === M && y >= 0) {
|
|
2842
|
-
F
|
|
2842
|
+
n[F * a + R] = y, c = !0;
|
|
2843
2843
|
continue;
|
|
2844
2844
|
}
|
|
2845
2845
|
const u = d.every(
|
|
@@ -2849,7 +2849,7 @@ function zB(B, A) {
|
|
|
2849
2849
|
M = null, y = -1;
|
|
2850
2850
|
continue;
|
|
2851
2851
|
}
|
|
2852
|
-
M = u, y =
|
|
2852
|
+
M = u, y = r.length, r.push(u), n[F * a + R] = y, c = !0;
|
|
2853
2853
|
}
|
|
2854
2854
|
}
|
|
2855
2855
|
return {
|
|
@@ -2859,22 +2859,22 @@ function zB(B, A) {
|
|
|
2859
2859
|
frameData: s,
|
|
2860
2860
|
clipPaths: D,
|
|
2861
2861
|
clipPathIndex: w,
|
|
2862
|
-
shapesTable:
|
|
2863
|
-
shapesIndex:
|
|
2862
|
+
shapesTable: r,
|
|
2863
|
+
shapesIndex: n,
|
|
2864
2864
|
hasAnyShapes: c
|
|
2865
2865
|
};
|
|
2866
2866
|
}
|
|
2867
2867
|
function gg(B, A, I) {
|
|
2868
2868
|
const g = Math.floor(B.length / HA), Q = Math.floor(A.length / (vA * cA)), C = Math.floor(I.length / iI), E = Math.min(g, Q, C);
|
|
2869
2869
|
for (let o = 0; o < E; o++) {
|
|
2870
|
-
const i = o * HA, e = B[i], a = B[i + 1], t = B[i + 2], s = B[i + 3], D = B[i + 4], h = B[i + 5], w = B[i + 6],
|
|
2871
|
-
A[d] = y, A[d + 1] = R, A[d + 2] = 0, A[d + 3] = 1, A[d + 4] = 1, A[d + 5] = 1, A[d + 6] =
|
|
2870
|
+
const i = o * HA, e = B[i], a = B[i + 1], t = B[i + 2], s = B[i + 3], D = B[i + 4], h = B[i + 5], w = B[i + 6], r = B[i + 7], n = B[i + 8], c = B[i + 9], F = B[i + 10], G = B[i + 11], M = B[i + 12], y = w, R = r, S = t * e + w, N = s * e + r, U = t * e + D * a + w, L = s * e + h * a + r, l = D * a + w, f = h * a + r, d = o * vA * cA;
|
|
2871
|
+
A[d] = y, A[d + 1] = R, A[d + 2] = 0, A[d + 3] = 1, A[d + 4] = 1, A[d + 5] = 1, A[d + 6] = n, A[d + 7] = c, A[d + 8] = F;
|
|
2872
2872
|
const u = d + cA;
|
|
2873
|
-
A[u] = S, A[u + 1] = N, A[u + 2] = 0, A[u + 3] = 1, A[u + 4] = 1, A[u + 5] = 1, A[u + 6] =
|
|
2873
|
+
A[u] = S, A[u + 1] = N, A[u + 2] = 0, A[u + 3] = 1, A[u + 4] = 1, A[u + 5] = 1, A[u + 6] = n, A[u + 7] = G, A[u + 8] = F;
|
|
2874
2874
|
const K = d + 2 * cA;
|
|
2875
|
-
A[K] = U, A[K + 1] = L, A[K + 2] = 0, A[K + 3] = 1, A[K + 4] = 1, A[K + 5] = 1, A[K + 6] =
|
|
2875
|
+
A[K] = U, A[K + 1] = L, A[K + 2] = 0, A[K + 3] = 1, A[K + 4] = 1, A[K + 5] = 1, A[K + 6] = n, A[K + 7] = G, A[K + 8] = M;
|
|
2876
2876
|
const x = d + 3 * cA;
|
|
2877
|
-
A[x] = l, A[x + 1] = f, A[x + 2] = 0, A[x + 3] = 1, A[x + 4] = 1, A[x + 5] = 1, A[x + 6] =
|
|
2877
|
+
A[x] = l, A[x + 1] = f, A[x + 2] = 0, A[x + 3] = 1, A[x + 4] = 1, A[x + 5] = 1, A[x + 6] = n, A[x + 7] = c, A[x + 8] = M;
|
|
2878
2878
|
const X = o * iI, gA = o * vA;
|
|
2879
2879
|
I[X] = gA, I[X + 1] = gA + 1, I[X + 2] = gA + 2, I[X + 3] = gA, I[X + 4] = gA + 2, I[X + 5] = gA + 3;
|
|
2880
2880
|
}
|
|
@@ -3213,13 +3213,13 @@ function gE(B) {
|
|
|
3213
3213
|
);
|
|
3214
3214
|
const s = ((C = B.sprites) != null ? C : []).map(BE), D = ((E = B.audios) != null ? E : []).map(
|
|
3215
3215
|
(h) => {
|
|
3216
|
-
var w,
|
|
3216
|
+
var w, r, n, c, F;
|
|
3217
3217
|
return {
|
|
3218
3218
|
audioKey: (w = h.audio_key) != null ? w : "",
|
|
3219
|
-
startFrame: (
|
|
3220
|
-
endFrame: (
|
|
3219
|
+
startFrame: (r = h.start_frame) != null ? r : 0,
|
|
3220
|
+
endFrame: (n = h.end_frame) != null ? n : 0,
|
|
3221
3221
|
startTime: (c = h.start_time) != null ? c : 0,
|
|
3222
|
-
totalTime: (
|
|
3222
|
+
totalTime: (F = h.total_time) != null ? F : 0
|
|
3223
3223
|
};
|
|
3224
3224
|
}
|
|
3225
3225
|
);
|
|
@@ -3235,10 +3235,10 @@ function BE(B) {
|
|
|
3235
3235
|
var A, I;
|
|
3236
3236
|
let g = null;
|
|
3237
3237
|
const Q = ((A = B.frames) != null ? A : []).map((C) => {
|
|
3238
|
-
var E, o, i, e, a, t, s, D, h, w,
|
|
3239
|
-
const
|
|
3238
|
+
var E, o, i, e, a, t, s, D, h, w, r;
|
|
3239
|
+
const n = Array.isArray(C.shapes) ? C.shapes : [];
|
|
3240
3240
|
let c;
|
|
3241
|
-
return
|
|
3241
|
+
return n.length === 0 ? (g = null, c = null) : ((E = n[0]) == null ? void 0 : E.kind) === "keep" ? c = g : (c = EE(n), g = c), {
|
|
3242
3242
|
alpha: (o = C.alpha) != null ? o : 0,
|
|
3243
3243
|
layout: C.layout ? {
|
|
3244
3244
|
width: (i = C.layout.width) != null ? i : 0,
|
|
@@ -3252,7 +3252,7 @@ function BE(B) {
|
|
|
3252
3252
|
tx: (h = C.transform.tx) != null ? h : 0,
|
|
3253
3253
|
ty: (w = C.transform.ty) != null ? w : 0
|
|
3254
3254
|
} : null,
|
|
3255
|
-
clipPath: (
|
|
3255
|
+
clipPath: (r = C.clip_path) != null ? r : "",
|
|
3256
3256
|
shapes: c
|
|
3257
3257
|
};
|
|
3258
3258
|
});
|
|
@@ -3299,10 +3299,10 @@ function EE(B) {
|
|
|
3299
3299
|
if (!Array.isArray(B) || B.length === 0) return null;
|
|
3300
3300
|
const h = [];
|
|
3301
3301
|
for (const w of B) {
|
|
3302
|
-
const
|
|
3303
|
-
if (
|
|
3304
|
-
const
|
|
3305
|
-
kind:
|
|
3302
|
+
const r = w == null ? void 0 : w.kind;
|
|
3303
|
+
if (r !== "path" && r !== "rect" && r !== "ellipse") continue;
|
|
3304
|
+
const n = {
|
|
3305
|
+
kind: r,
|
|
3306
3306
|
pathData: (A = w.path_data) != null ? A : w.pathData,
|
|
3307
3307
|
rect: w.rect ? {
|
|
3308
3308
|
x: (I = w.rect.x) != null ? I : 0,
|
|
@@ -3320,7 +3320,7 @@ function EE(B) {
|
|
|
3320
3320
|
style: QE(w.style),
|
|
3321
3321
|
transform: CE(w.transform)
|
|
3322
3322
|
};
|
|
3323
|
-
h.push(
|
|
3323
|
+
h.push(n);
|
|
3324
3324
|
}
|
|
3325
3325
|
return h.length > 0 ? h : null;
|
|
3326
3326
|
}
|
|
@@ -3417,43 +3417,43 @@ function QQ(B) {
|
|
|
3417
3417
|
break;
|
|
3418
3418
|
case "C": {
|
|
3419
3419
|
for (; a < e.length && !isNaN(parseFloat(e[a])); ) {
|
|
3420
|
-
const D = t(), h = t(), w = t(),
|
|
3421
|
-
KI(I, g, Q, D, h, w,
|
|
3420
|
+
const D = t(), h = t(), w = t(), r = t(), n = t(), c = t();
|
|
3421
|
+
KI(I, g, Q, D, h, w, r, n, c), o = w, i = r, g = n, Q = c;
|
|
3422
3422
|
}
|
|
3423
3423
|
break;
|
|
3424
3424
|
}
|
|
3425
3425
|
case "c": {
|
|
3426
3426
|
for (; a < e.length && !isNaN(parseFloat(e[a])); ) {
|
|
3427
|
-
const D = g + t(), h = Q + t(), w = g + t(),
|
|
3428
|
-
KI(I, g, Q, D, h, w,
|
|
3427
|
+
const D = g + t(), h = Q + t(), w = g + t(), r = Q + t(), n = g + t(), c = Q + t();
|
|
3428
|
+
KI(I, g, Q, D, h, w, r, n, c), o = w, i = r, g = n, Q = c;
|
|
3429
3429
|
}
|
|
3430
3430
|
break;
|
|
3431
3431
|
}
|
|
3432
3432
|
case "S": {
|
|
3433
3433
|
for (; a < e.length && !isNaN(parseFloat(e[a])); ) {
|
|
3434
|
-
const D = 2 * g - o, h = 2 * Q - i, w = t(),
|
|
3435
|
-
KI(I, g, Q, D, h, w,
|
|
3434
|
+
const D = 2 * g - o, h = 2 * Q - i, w = t(), r = t(), n = t(), c = t();
|
|
3435
|
+
KI(I, g, Q, D, h, w, r, n, c), o = w, i = r, g = n, Q = c;
|
|
3436
3436
|
}
|
|
3437
3437
|
break;
|
|
3438
3438
|
}
|
|
3439
3439
|
case "s": {
|
|
3440
3440
|
for (; a < e.length && !isNaN(parseFloat(e[a])); ) {
|
|
3441
|
-
const D = 2 * g - o, h = 2 * Q - i, w = g + t(),
|
|
3442
|
-
KI(I, g, Q, D, h, w,
|
|
3441
|
+
const D = 2 * g - o, h = 2 * Q - i, w = g + t(), r = Q + t(), n = g + t(), c = Q + t();
|
|
3442
|
+
KI(I, g, Q, D, h, w, r, n, c), o = w, i = r, g = n, Q = c;
|
|
3443
3443
|
}
|
|
3444
3444
|
break;
|
|
3445
3445
|
}
|
|
3446
3446
|
case "Q": {
|
|
3447
3447
|
for (; a < e.length && !isNaN(parseFloat(e[a])); ) {
|
|
3448
|
-
const D = t(), h = t(), w = t(),
|
|
3449
|
-
eB(I, g, Q, D, h, w,
|
|
3448
|
+
const D = t(), h = t(), w = t(), r = t();
|
|
3449
|
+
eB(I, g, Q, D, h, w, r), o = D, i = h, g = w, Q = r;
|
|
3450
3450
|
}
|
|
3451
3451
|
break;
|
|
3452
3452
|
}
|
|
3453
3453
|
case "q": {
|
|
3454
3454
|
for (; a < e.length && !isNaN(parseFloat(e[a])); ) {
|
|
3455
|
-
const D = g + t(), h = Q + t(), w = g + t(),
|
|
3456
|
-
eB(I, g, Q, D, h, w,
|
|
3455
|
+
const D = g + t(), h = Q + t(), w = g + t(), r = Q + t();
|
|
3456
|
+
eB(I, g, Q, D, h, w, r), o = D, i = h, g = w, Q = r;
|
|
3457
3457
|
}
|
|
3458
3458
|
break;
|
|
3459
3459
|
}
|
|
@@ -3495,11 +3495,11 @@ function DE(B) {
|
|
|
3495
3495
|
let o = !1;
|
|
3496
3496
|
const i = g.length;
|
|
3497
3497
|
for (let e = 0; e < i; e++) {
|
|
3498
|
-
const a = g[(e - 1 + i) % i], t = g[e], s = g[(e + 1) % i], D = B[a], h = B[t], w = B[s],
|
|
3499
|
-
if (!(C ?
|
|
3498
|
+
const a = g[(e - 1 + i) % i], t = g[e], s = g[(e + 1) % i], D = B[a], h = B[t], w = B[s], r = (h.x - D.x) * (w.y - D.y) - (h.y - D.y) * (w.x - D.x);
|
|
3499
|
+
if (!(C ? r > 0 : r < 0)) continue;
|
|
3500
3500
|
let c = !1;
|
|
3501
|
-
for (let
|
|
3502
|
-
if (!(
|
|
3501
|
+
for (let F = 0; F < i; F++)
|
|
3502
|
+
if (!(F === (e - 1 + i) % i || F === e || F === (e + 1) % i) && wE(B[g[F]], D, h, w)) {
|
|
3503
3503
|
c = !0;
|
|
3504
3504
|
break;
|
|
3505
3505
|
}
|
|
@@ -3620,18 +3620,18 @@ function cE(B) {
|
|
|
3620
3620
|
function FE(B, A, I, g) {
|
|
3621
3621
|
const Q = B.prev, C = B, E = B.next;
|
|
3622
3622
|
if (V(Q, C, E) >= 0) return !1;
|
|
3623
|
-
const o = Q.x, i = C.x, e = E.x, a = Q.y, t = C.y, s = E.y, D = Math.min(o, i, e), h = Math.min(a, t, s), w = Math.max(o, i, e),
|
|
3624
|
-
let
|
|
3625
|
-
for (;
|
|
3626
|
-
if (
|
|
3623
|
+
const o = Q.x, i = C.x, e = E.x, a = Q.y, t = C.y, s = E.y, D = Math.min(o, i, e), h = Math.min(a, t, s), w = Math.max(o, i, e), r = Math.max(a, t, s), n = Kg(D, h, A, I, g), c = Kg(w, r, A, I, g);
|
|
3624
|
+
let F = B.prevZ, G = B.nextZ;
|
|
3625
|
+
for (; F && F.z >= n && G && G.z <= c; ) {
|
|
3626
|
+
if (F.x >= D && F.x <= w && F.y >= h && F.y <= r && F !== Q && F !== E && CI(o, a, i, t, e, s, F.x, F.y) && V(F.prev, F, F.next) >= 0 || (F = F.prevZ, G.x >= D && G.x <= w && G.y >= h && G.y <= r && G !== Q && G !== E && CI(o, a, i, t, e, s, G.x, G.y) && V(G.prev, G, G.next) >= 0)) return !1;
|
|
3627
3627
|
G = G.nextZ;
|
|
3628
3628
|
}
|
|
3629
|
-
for (;
|
|
3630
|
-
if (
|
|
3631
|
-
|
|
3629
|
+
for (; F && F.z >= n; ) {
|
|
3630
|
+
if (F.x >= D && F.x <= w && F.y >= h && F.y <= r && F !== Q && F !== E && CI(o, a, i, t, e, s, F.x, F.y) && V(F.prev, F, F.next) >= 0) return !1;
|
|
3631
|
+
F = F.prevZ;
|
|
3632
3632
|
}
|
|
3633
3633
|
for (; G && G.z <= c; ) {
|
|
3634
|
-
if (G.x >= D && G.x <= w && G.y >= h && G.y <=
|
|
3634
|
+
if (G.x >= D && G.x <= w && G.y >= h && G.y <= r && G !== Q && G !== E && CI(o, a, i, t, e, s, G.x, G.y) && V(G.prev, G, G.next) >= 0) return !1;
|
|
3635
3635
|
G = G.nextZ;
|
|
3636
3636
|
}
|
|
3637
3637
|
return !0;
|
|
@@ -4794,8 +4794,8 @@ function pA(B, A, I, g, Q) {
|
|
|
4794
4794
|
];
|
|
4795
4795
|
let a = 1 / 0, t = 1 / 0, s = -1 / 0, D = -1 / 0;
|
|
4796
4796
|
for (const [h, w] of e) {
|
|
4797
|
-
const
|
|
4798
|
-
a = Math.min(a, c), t = Math.min(t,
|
|
4797
|
+
const r = h - i.x, n = w - i.y, c = i.x + E * r - o * n, F = i.y + o * r + E * n;
|
|
4798
|
+
a = Math.min(a, c), t = Math.min(t, F), s = Math.max(s, c), D = Math.max(D, F);
|
|
4799
4799
|
}
|
|
4800
4800
|
return { x: a, y: t, w: s - a, h: D - t };
|
|
4801
4801
|
}
|
|
@@ -4880,9 +4880,9 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
4880
4880
|
C.length = 0;
|
|
4881
4881
|
let E = null;
|
|
4882
4882
|
for (const o of I) {
|
|
4883
|
-
const i = o.videoEntity, e = i.params.viewBoxWidth, a = i.params.viewBoxHeight, t = DA(o), s = dA(o, e, a), D = s.scaleX, h = s.scaleY, w = o.width * o.scale,
|
|
4883
|
+
const i = o.videoEntity, e = i.params.viewBoxWidth, a = i.params.viewBoxHeight, t = DA(o), s = dA(o, e, a), D = s.scaleX, h = s.scaleY, w = o.width * o.scale, r = o.height * o.scale, n = t === "cover" ? w : Math.min(s.width, w), c = t === "cover" ? r : Math.min(s.height, r), F = t === "cover" ? o.x : o.x + s.offsetX, G = t === "cover" ? o.y : o.y + s.offsetY;
|
|
4884
4884
|
C.length > 0 && (this.drawBatch(A, C, E, Q), C.length = 0, E = null);
|
|
4885
|
-
const M = pA(o,
|
|
4885
|
+
const M = pA(o, F, G, n, c);
|
|
4886
4886
|
A.setScissor(M.x, M.y, M.w, M.h), this.slotScissor.x = M.x, this.slotScissor.y = M.y, this.slotScissor.w = M.w, this.slotScissor.h = M.h;
|
|
4887
4887
|
for (let y = 0; y < i.spriteTable.spriteCount; y++) {
|
|
4888
4888
|
const R = i.spriteTable, S = o.currentFrame;
|
|
@@ -4956,15 +4956,15 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
4956
4956
|
return;
|
|
4957
4957
|
}
|
|
4958
4958
|
const E = this.pool.getFloat32(C * HA);
|
|
4959
|
-
for (let
|
|
4960
|
-
this.packFrameData(E,
|
|
4959
|
+
for (let n = 0; n < C; n++)
|
|
4960
|
+
this.packFrameData(E, n, I[n]);
|
|
4961
4961
|
const o = C * vA * cA, i = C * iI, e = this.pool.getFloat32B(o), a = this.pool.getUint32(i), t = new Float32Array(E.buffer, 0, C * HA), s = new Float32Array(e.buffer, 0, o), D = new Uint32Array(a.buffer, 0, i);
|
|
4962
4962
|
(!eI() || Eg(t, s, D) === null) && gg(t, s, D);
|
|
4963
|
-
const h = this.batchDrawCursor++, w = this.ensureVertexBuffer(A, h, s),
|
|
4963
|
+
const h = this.batchDrawCursor++, w = this.ensureVertexBuffer(A, h, s), r = this.ensureIndexBuffer(A, h, D);
|
|
4964
4964
|
A.draw({
|
|
4965
4965
|
shader: "svga-batch-premul",
|
|
4966
4966
|
vertexBuffer: w,
|
|
4967
|
-
indexBuffer:
|
|
4967
|
+
indexBuffer: r,
|
|
4968
4968
|
indexCount: i,
|
|
4969
4969
|
textures: [g],
|
|
4970
4970
|
uniforms: { u_projection: Q, u_atlas: 0 }
|
|
@@ -4988,20 +4988,20 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
4988
4988
|
}
|
|
4989
4989
|
drawClippedSprite(A, I, g, Q) {
|
|
4990
4990
|
var C;
|
|
4991
|
-
const { slot: E, sx: o, sy: i, offsetX: e, offsetY: a, a: t, b: s, c: D, d: h, tx: w, ty:
|
|
4991
|
+
const { slot: E, sx: o, sy: i, offsetX: e, offsetY: a, a: t, b: s, c: D, d: h, tx: w, ty: r } = I, n = this.rotateTransform(
|
|
4992
4992
|
E,
|
|
4993
4993
|
t * o,
|
|
4994
4994
|
s * i,
|
|
4995
4995
|
D * o,
|
|
4996
4996
|
h * i,
|
|
4997
4997
|
w * o + E.x + e,
|
|
4998
|
-
|
|
4999
|
-
), { a: c, b:
|
|
5000
|
-
if (S && ((C = E.rotation) != null ? C : 0) === 0 && hB(c,
|
|
4998
|
+
r * i + E.y + a
|
|
4999
|
+
), { a: c, b: F, c: G, d: M, tx: y, ty: R } = n, S = this.getClipRect(g);
|
|
5000
|
+
if (S && ((C = E.rotation) != null ? C : 0) === 0 && hB(c, F, G, M)) {
|
|
5001
5001
|
this.applyClipRectScissor(A, S, c, M, y, R) && this.drawSingleSprite(A, I, Q), this.restoreSlotScissor(A);
|
|
5002
5002
|
return;
|
|
5003
5003
|
}
|
|
5004
|
-
const N = this.ensureClipMeshBuffers(A, g), U = this.packClipTransform(c,
|
|
5004
|
+
const N = this.ensureClipMeshBuffers(A, g), U = this.packClipTransform(c, F, G, M, y, R), L = {
|
|
5005
5005
|
shader: "clip-mask",
|
|
5006
5006
|
vertexBuffer: N.vertexBuf,
|
|
5007
5007
|
indexBuffer: N.indexBuf,
|
|
@@ -5126,20 +5126,20 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5126
5126
|
return i.a = I, i.b = g, i.c = Q, i.d = C, i.tx = E, i.ty = o, OE(A, i, i);
|
|
5127
5127
|
}
|
|
5128
5128
|
packFrameData(A, I, g) {
|
|
5129
|
-
const { slot: Q, layoutW: C, layoutH: E, a: o, b: i, c: e, d: a, tx: t, ty: s, alpha: D, rect: h, override: w, sx:
|
|
5129
|
+
const { slot: Q, layoutW: C, layoutH: E, a: o, b: i, c: e, d: a, tx: t, ty: s, alpha: D, rect: h, override: w, sx: r, sy: n, offsetX: c, offsetY: F } = g;
|
|
5130
5130
|
let G = C || (w == null ? void 0 : w.logicalWidth) || 0, M = E || (w == null ? void 0 : w.logicalHeight) || 0, y = 0, R = 0;
|
|
5131
5131
|
if ((w == null ? void 0 : w.mode) === "dynamic") {
|
|
5132
5132
|
const LA = C || w.logicalWidth, W = E || w.logicalHeight;
|
|
5133
5133
|
G = w.logicalWidth, M = w.logicalHeight, y = Math.max(0, (LA - G) * 0.5), R = Math.max(0, (W - M) * 0.5);
|
|
5134
5134
|
}
|
|
5135
|
-
const S = I * HA, N = o *
|
|
5135
|
+
const S = I * HA, N = o * r, U = i * n, L = e * r, l = a * n, f = this.rotateTransform(
|
|
5136
5136
|
Q,
|
|
5137
5137
|
N,
|
|
5138
5138
|
U,
|
|
5139
5139
|
L,
|
|
5140
5140
|
l,
|
|
5141
|
-
t *
|
|
5142
|
-
s *
|
|
5141
|
+
t * r + N * y + L * R + Q.x + c,
|
|
5142
|
+
s * n + U * y + l * R + Q.y + F
|
|
5143
5143
|
), { a: d, b: u, c: K, d: x, tx: X, ty: gA } = f;
|
|
5144
5144
|
A[S] = G, A[S + 1] = M, A[S + 2] = d, A[S + 3] = u, A[S + 4] = K, A[S + 5] = x, A[S + 6] = X, A[S + 7] = gA, A[S + 8] = D * Q.opacity, A[S + 9] = h.x, A[S + 10] = h.y, A[S + 11] = h.x + h.w, A[S + 12] = h.y + h.h;
|
|
5145
5145
|
}
|
|
@@ -5156,20 +5156,20 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5156
5156
|
var E;
|
|
5157
5157
|
const o = this.getShapeMesh(g);
|
|
5158
5158
|
if (!o || o.indices.length === 0) return;
|
|
5159
|
-
const { slot: i, sx: e, sy: a, offsetX: t, offsetY: s, a: D, b: h, c: w, d:
|
|
5159
|
+
const { slot: i, sx: e, sy: a, offsetX: t, offsetY: s, a: D, b: h, c: w, d: r, tx: n, ty: c, alpha: F } = I, G = this.getWhiteTexture(A), M = this.rotateTransform(
|
|
5160
5160
|
i,
|
|
5161
5161
|
D * e,
|
|
5162
5162
|
h * a,
|
|
5163
5163
|
w * e,
|
|
5164
|
-
|
|
5165
|
-
|
|
5164
|
+
r * a,
|
|
5165
|
+
n * e + i.x + t,
|
|
5166
5166
|
c * a + i.y + s
|
|
5167
5167
|
), { a: y, b: R, c: S, d: N, tx: U, ty: L } = M, l = o.vertices, f = l.length / 6 * cA;
|
|
5168
5168
|
(!this.shapeVertsScratch || this.shapeVertsScratch.length < f) && (this.shapeVertsScratch = new Float32Array(f));
|
|
5169
5169
|
const d = this.shapeVertsScratch;
|
|
5170
5170
|
for (let W = 0, eA = 0; W < l.length; W += 6, eA += cA) {
|
|
5171
5171
|
const kI = l[W], SA = l[W + 1];
|
|
5172
|
-
d[eA] = y * kI + S * SA + U, d[eA + 1] = R * kI + N * SA + L, d[eA + 2] = 0, d[eA + 3] = l[W + 2], d[eA + 4] = l[W + 3], d[eA + 5] = l[W + 4], d[eA + 6] = l[W + 5] *
|
|
5172
|
+
d[eA] = y * kI + S * SA + U, d[eA + 1] = R * kI + N * SA + L, d[eA + 2] = 0, d[eA + 3] = l[W + 2], d[eA + 4] = l[W + 3], d[eA + 5] = l[W + 4], d[eA + 6] = l[W + 5] * F * i.opacity, d[eA + 7] = 0.5, d[eA + 8] = 0.5;
|
|
5173
5173
|
}
|
|
5174
5174
|
let u = !1, K = null, x = null;
|
|
5175
5175
|
if (Q && Q.indices.length > 0) {
|
|
@@ -5298,8 +5298,8 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5298
5298
|
for (let o = 0; o < A.length; o++) {
|
|
5299
5299
|
const i = A[o], e = A[(o + 1) % A.length], a = e.x - i.x, t = e.y - i.y, s = Math.hypot(a, t);
|
|
5300
5300
|
if (s <= 1e-4) continue;
|
|
5301
|
-
const D = -t / s * E, h = a / s * E, w = Q.length / 6,
|
|
5302
|
-
Q.push(i.x - D, i.y - h,
|
|
5301
|
+
const D = -t / s * E, h = a / s * E, w = Q.length / 6, r = this.clamp01(I.r), n = this.clamp01(I.g), c = this.clamp01(I.b), F = this.clamp01(I.a);
|
|
5302
|
+
Q.push(i.x - D, i.y - h, r, n, c, F), Q.push(i.x + D, i.y + h, r, n, c, F), Q.push(e.x + D, e.y + h, r, n, c, F), Q.push(e.x - D, e.y - h, r, n, c, F), C.push(w, w + 1, w + 2, w + 2, w + 3, w);
|
|
5303
5303
|
}
|
|
5304
5304
|
}
|
|
5305
5305
|
clamp01(A) {
|
|
@@ -5401,8 +5401,8 @@ function _E(B, A) {
|
|
|
5401
5401
|
const i = Math.max(E, o) * 1e-4 + 1e-6;
|
|
5402
5402
|
let e = 0;
|
|
5403
5403
|
for (let a = 0; a < 8; a += 2) {
|
|
5404
|
-
const t = B[a], s = B[a + 1], D = Math.abs(t - I) <= i, h = Math.abs(t - Q) <= i, w = Math.abs(s - g) <= i,
|
|
5405
|
-
if (!D && !h || !w && !
|
|
5404
|
+
const t = B[a], s = B[a + 1], D = Math.abs(t - I) <= i, h = Math.abs(t - Q) <= i, w = Math.abs(s - g) <= i, r = Math.abs(s - C) <= i;
|
|
5405
|
+
if (!D && !h || !w && !r) return null;
|
|
5406
5406
|
e |= 1 << ((D ? 0 : 1) | (w ? 0 : 2));
|
|
5407
5407
|
}
|
|
5408
5408
|
return e !== 15 ? null : { x: I, y: g, w: E, h: o };
|
|
@@ -5964,32 +5964,32 @@ function li(B, A, I, g, Q, C, E, o) {
|
|
|
5964
5964
|
}
|
|
5965
5965
|
function wQ(B, A, I, g) {
|
|
5966
5966
|
var Q, C, E, o, i, e;
|
|
5967
|
-
const a = Math.max(1, g.scale || 1), t = Math.max(1, Math.round(B)), s = Math.max(1, Math.round(A)), D = OA(1, 1), h = jA(D), w = (Q = g.color) != null ? Q : "#ffffff",
|
|
5967
|
+
const a = Math.max(1, g.scale || 1), t = Math.max(1, Math.round(B)), s = Math.max(1, Math.round(A)), D = OA(1, 1), h = jA(D), w = (Q = g.color) != null ? Q : "#ffffff", r = Math.max(0, (C = g.padding) != null ? C : 2), n = Math.max(1, t - r * 2), c = Math.max(1, s - r * 2), F = Math.max(
|
|
5968
5968
|
1,
|
|
5969
5969
|
(i = (o = (E = g.maxFontSize) != null ? E : g.fontSize) != null ? o : Si(g.fontStyle)) != null ? i : Math.max(8, c)
|
|
5970
|
-
), G = Math.max(1, Math.min((e = g.minFontSize) != null ? e : 8,
|
|
5970
|
+
), G = Math.max(1, Math.min((e = g.minFontSize) != null ? e : 8, F)), M = w, y = `${g.style === "b" ? "bold " : ""}${F * a}px Arial`, R = Mi(g.fontStyle, y, M), S = (d) => Ni(R.font, d * a), N = li(
|
|
5971
5971
|
h,
|
|
5972
5972
|
I,
|
|
5973
5973
|
a,
|
|
5974
5974
|
S,
|
|
5975
|
-
|
|
5975
|
+
n,
|
|
5976
5976
|
c,
|
|
5977
5977
|
G,
|
|
5978
|
-
zA(g.fontSize) ? Math.min(g.fontSize,
|
|
5979
|
-
), U = g.sizing === "intrinsic" ? Math.max(1, Math.min(t, Math.ceil(N.metrics.width +
|
|
5978
|
+
zA(g.fontSize) ? Math.min(g.fontSize, F) : F
|
|
5979
|
+
), U = g.sizing === "intrinsic" ? Math.max(1, Math.min(t, Math.ceil(N.metrics.width + r * 2))) : t, L = g.sizing === "intrinsic" ? Math.max(1, Math.min(s, Math.ceil(N.metrics.height + r * 2))) : s, l = OA(U * a, L * a), f = jA(l);
|
|
5980
5980
|
return f.clearRect(0, 0, l.width, l.height), f.textAlign = "center", f.textBaseline = "middle", f.font = S(N.fontSize), f.fillStyle = R.color, f.fillText(I, l.width / 2, l.height / 2), { canvas: l, logicalWidth: U, logicalHeight: L };
|
|
5981
5981
|
}
|
|
5982
5982
|
async function ki(B, A, I, g) {
|
|
5983
5983
|
var Q, C, E, o, i, e;
|
|
5984
5984
|
const a = B.spriteTable, t = new Set(A), s = /* @__PURE__ */ new Map();
|
|
5985
5985
|
for (let w = 0; w < a.imageKeys.length; w++) {
|
|
5986
|
-
const
|
|
5987
|
-
t.has(
|
|
5986
|
+
const r = a.imageKeys[w];
|
|
5987
|
+
t.has(r) && s.set(r, w);
|
|
5988
5988
|
}
|
|
5989
5989
|
const D = /* @__PURE__ */ new Map(), { frameCount: h } = a;
|
|
5990
5990
|
for (const w of A) {
|
|
5991
|
-
const
|
|
5992
|
-
if (
|
|
5991
|
+
const r = s.get(w);
|
|
5992
|
+
if (r == null) {
|
|
5993
5993
|
const y = B.atlasRects.get(w);
|
|
5994
5994
|
D.set(w, {
|
|
5995
5995
|
width: (y == null ? void 0 : y.w) || 1,
|
|
@@ -5998,18 +5998,18 @@ async function ki(B, A, I, g) {
|
|
|
5998
5998
|
});
|
|
5999
5999
|
continue;
|
|
6000
6000
|
}
|
|
6001
|
-
let
|
|
6001
|
+
let n = 0, c = 0, F = Number.POSITIVE_INFINITY;
|
|
6002
6002
|
for (let y = 0; y < h; y++) {
|
|
6003
|
-
const R = (
|
|
6004
|
-
if (
|
|
6003
|
+
const R = (r * h + y) * 9, S = (Q = a.frameData[R]) != null ? Q : 0, N = (C = a.frameData[R + 1]) != null ? C : 0, U = (E = a.frameData[R + 2]) != null ? E : 1, L = (o = a.frameData[R + 3]) != null ? o : 0, l = (i = a.frameData[R + 4]) != null ? i : 0, f = (e = a.frameData[R + 5]) != null ? e : 1;
|
|
6004
|
+
if (n = Math.max(n, S), c = Math.max(c, N), S > 0 && N > 0) {
|
|
6005
6005
|
const d = Math.abs(U) * S + Math.abs(l) * N, u = Math.abs(L) * S + Math.abs(f) * N, K = d > 0 ? d / S : 1, x = u > 0 ? u / N : 1, X = Math.min(K || 1, x || 1);
|
|
6006
|
-
zA(X) && (
|
|
6006
|
+
zA(X) && (F = Math.min(F, X));
|
|
6007
6007
|
}
|
|
6008
6008
|
y + 1 < h && I.shouldYield() && (await I.yield(), g == null || g());
|
|
6009
6009
|
}
|
|
6010
|
-
const G = zA(
|
|
6010
|
+
const G = zA(F) ? F : 1, M = B.atlasRects.get(w);
|
|
6011
6011
|
D.set(w, {
|
|
6012
|
-
width:
|
|
6012
|
+
width: n || (M == null ? void 0 : M.w) || 1,
|
|
6013
6013
|
height: c || (M == null ? void 0 : M.h) || 1,
|
|
6014
6014
|
renderScale: G
|
|
6015
6015
|
});
|
|
@@ -6087,14 +6087,14 @@ async function Yi(B, A, I, g = {}) {
|
|
|
6087
6087
|
h.width,
|
|
6088
6088
|
h.height,
|
|
6089
6089
|
h.renderScale
|
|
6090
|
-
),
|
|
6091
|
-
width:
|
|
6090
|
+
), r = PA(w.source), n = r.width || h.width, c = r.height || h.height, F = B.createTexture(w.source, {
|
|
6091
|
+
width: n,
|
|
6092
6092
|
height: c,
|
|
6093
6093
|
filter: "linear",
|
|
6094
6094
|
premultiplyAlpha: !0
|
|
6095
6095
|
});
|
|
6096
6096
|
o.set(s, {
|
|
6097
|
-
texture:
|
|
6097
|
+
texture: F,
|
|
6098
6098
|
mode: w.mode,
|
|
6099
6099
|
logicalWidth: w.logicalWidth,
|
|
6100
6100
|
logicalHeight: w.logicalHeight
|
|
@@ -6204,13 +6204,13 @@ function FB(B, A, I, g, Q = !0) {
|
|
|
6204
6204
|
var C, E;
|
|
6205
6205
|
if (!B.compositeCanvas || !B.compositeCtx || !B.rawCanvas || !B.rawCtx || !B.scratchCanvas || !B.scratchCtx)
|
|
6206
6206
|
throw new Error("VAP CPU compositor state is incomplete");
|
|
6207
|
-
const { info: o } = A, i = o.videoW || B.width, e = o.videoH || B.height, [a, t, s, D] = o.rgbFrame, [h, w,
|
|
6207
|
+
const { info: o } = A, i = o.videoW || B.width, e = o.videoH || B.height, [a, t, s, D] = o.rgbFrame, [h, w, r, n] = o.aFrame;
|
|
6208
6208
|
(B.rawCanvas.width !== i || B.rawCanvas.height !== e) && (B.rawCanvas.width = i, B.rawCanvas.height = e), B.rawCtx.clearRect(0, 0, i, e), B.rawCtx.drawImage(I, 0, 0, i, e);
|
|
6209
|
-
const c = B.rawCtx.getImageData(0, 0, i, e).data,
|
|
6209
|
+
const c = B.rawCtx.getImageData(0, 0, i, e).data, F = B.compositeCtx.createImageData(B.width, B.height), G = F.data;
|
|
6210
6210
|
for (let y = 0; y < B.height; y++) {
|
|
6211
|
-
const R = Math.min(e - 1, Math.max(0, t + Math.floor(y / B.height * D))), S = Math.min(e - 1, Math.max(0, w + Math.floor(y / B.height *
|
|
6211
|
+
const R = Math.min(e - 1, Math.max(0, t + Math.floor(y / B.height * D))), S = Math.min(e - 1, Math.max(0, w + Math.floor(y / B.height * n)));
|
|
6212
6212
|
for (let N = 0; N < B.width; N++) {
|
|
6213
|
-
const U = Math.min(i - 1, Math.max(0, a + Math.floor(N / B.width * s))), L = Math.min(i - 1, Math.max(0, h + Math.floor(N / B.width *
|
|
6213
|
+
const U = Math.min(i - 1, Math.max(0, a + Math.floor(N / B.width * s))), L = Math.min(i - 1, Math.max(0, h + Math.floor(N / B.width * r))), l = (R * i + U) * 4, f = (S * i + L) * 4, d = c[f] / 255, u = (y * B.width + N) * 4, K = Q ? 1 : d;
|
|
6214
6214
|
G[u] = Math.round(c[l] * K), G[u + 1] = Math.round(c[l + 1] * K), G[u + 2] = Math.round(c[l + 2] * K), G[u + 3] = Math.round(d * 255);
|
|
6215
6215
|
}
|
|
6216
6216
|
}
|
|
@@ -6238,7 +6238,7 @@ function FB(B, A, I, g, Q = !0) {
|
|
|
6238
6238
|
}
|
|
6239
6239
|
}
|
|
6240
6240
|
}
|
|
6241
|
-
return B.compositeCtx.putImageData(
|
|
6241
|
+
return B.compositeCtx.putImageData(F, 0, 0), B.compositeCanvas;
|
|
6242
6242
|
}
|
|
6243
6243
|
var qi = Object.defineProperty, pi = (B, A, I) => A in B ? qi(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, T = (B, A, I) => pi(B, typeof A != "symbol" ? A + "" : A, I);
|
|
6244
6244
|
const rg = 1024, GB = 32, lI = class RA {
|
|
@@ -6365,10 +6365,10 @@ const rg = 1024, GB = 32, lI = class RA {
|
|
|
6365
6365
|
w.height,
|
|
6366
6366
|
s
|
|
6367
6367
|
), I.set(s, g);
|
|
6368
|
-
const
|
|
6369
|
-
I.set(
|
|
6368
|
+
const r = $A(e.rgbFrame, a, t), n = $A(e.aFrame, a, t), c = A.videoTextureHandle, F = VI(c.width, c.height, A.wcAtlasRect, this.scratchAtlasRemap);
|
|
6369
|
+
I.set(F, g + 16);
|
|
6370
6370
|
const G = g + 20;
|
|
6371
|
-
I[G + 0] =
|
|
6371
|
+
I[G + 0] = r.left, I[G + 1] = r.right, I[G + 2] = r.top, I[G + 3] = r.bottom, I[G + 4] = n.left, I[G + 5] = n.right, I[G + 6] = n.top, I[G + 7] = n.bottom, I[G + 8] = A.opacity, I[G + 9] = A.options.videoRGBAlphaMode !== "straight" ? 1 : 0, I[G + 10] = 0, I[G + 11] = 0;
|
|
6372
6372
|
}
|
|
6373
6373
|
syncMixedTexture(A, I) {
|
|
6374
6374
|
var g;
|
|
@@ -6416,7 +6416,7 @@ const rg = 1024, GB = 32, lI = class RA {
|
|
|
6416
6416
|
console.warn("[GiftStage:WC] VAP vapConfig missing — draw skipped", { giftId: I.id });
|
|
6417
6417
|
return;
|
|
6418
6418
|
}
|
|
6419
|
-
const { info: t } = a, s = t.videoW > 0 ? t.videoW : (Q = (g = I.webcodecsPlayback) == null ? void 0 : g.videoWidth) != null ? Q : 1, D = t.videoH > 0 ? t.videoH : (E = (C = I.webcodecsPlayback) == null ? void 0 : C.videoHeight) != null ? E : 1, h = this.scratchTransform, w = DA(I), { w:
|
|
6419
|
+
const { info: t } = a, s = t.videoW > 0 ? t.videoW : (Q = (g = I.webcodecsPlayback) == null ? void 0 : g.videoWidth) != null ? Q : 1, D = t.videoH > 0 ? t.videoH : (E = (C = I.webcodecsPlayback) == null ? void 0 : C.videoHeight) != null ? E : 1, h = this.scratchTransform, w = DA(I), { w: r, h: n } = mA(t), c = dA(I, r, n);
|
|
6420
6420
|
ZA(
|
|
6421
6421
|
I,
|
|
6422
6422
|
I.x + c.offsetX,
|
|
@@ -6425,8 +6425,8 @@ const rg = 1024, GB = 32, lI = class RA {
|
|
|
6425
6425
|
c.height,
|
|
6426
6426
|
h
|
|
6427
6427
|
);
|
|
6428
|
-
const
|
|
6429
|
-
R[0] = 0, R[1] = 0, R[2] =
|
|
6428
|
+
const F = $A(t.rgbFrame, s, D), G = $A(t.aFrame, s, D), M = I.videoTextureHandle, y = VI(M.width, M.height, I.wcAtlasRect, this.scratchAtlasRemap), R = this.vapVertexScratch;
|
|
6429
|
+
R[0] = 0, R[1] = 0, R[2] = F.left, R[3] = F.top, R[4] = G.left, R[5] = G.top, R[6] = 1, R[7] = 0, R[8] = F.right, R[9] = F.top, R[10] = G.right, R[11] = G.top, R[12] = 1, R[13] = 1, R[14] = F.right, R[15] = F.bottom, R[16] = G.right, R[17] = G.bottom, R[18] = 0, R[19] = 1, R[20] = F.left, R[21] = F.bottom, R[22] = G.left, R[23] = G.bottom, this.quadVB = this.ensureBuffer(A, this.quadVB, R, "vertex"), this.quadIB || (this.quadIB = A.createBuffer(RA.QUAD_INDICES, "index"));
|
|
6430
6430
|
const S = {
|
|
6431
6431
|
shader: "vap",
|
|
6432
6432
|
vertexBuffer: this.quadVB,
|
|
@@ -6533,10 +6533,10 @@ const rg = 1024, GB = 32, lI = class RA {
|
|
|
6533
6533
|
);
|
|
6534
6534
|
A.setScissor(c.x, c.y, c.w, c.h);
|
|
6535
6535
|
}
|
|
6536
|
-
const h = a.videoW > 0 ? a.videoW : C.width, w = a.videoH > 0 ? a.videoH : C.height,
|
|
6536
|
+
const h = a.videoW > 0 ? a.videoW : C.width, w = a.videoH > 0 ? a.videoH : C.height, r = this.scratchTransform, n = this.scratchAtlasRemap;
|
|
6537
6537
|
for (const c of E) {
|
|
6538
|
-
const
|
|
6539
|
-
if (!
|
|
6538
|
+
const F = Q.resourceTextures.get(String(c.srcId));
|
|
6539
|
+
if (!F) continue;
|
|
6540
6540
|
const [G, M, y, R] = c.frame, [, , S, N] = c.mFrame;
|
|
6541
6541
|
if (y <= 0 || R <= 0 || S <= 0 || N <= 0) continue;
|
|
6542
6542
|
ZA(
|
|
@@ -6545,19 +6545,19 @@ const rg = 1024, GB = 32, lI = class RA {
|
|
|
6545
6545
|
I.y + D.offsetY + M * D.scaleY,
|
|
6546
6546
|
y * D.scaleX,
|
|
6547
6547
|
R * D.scaleY,
|
|
6548
|
-
|
|
6548
|
+
r
|
|
6549
6549
|
);
|
|
6550
6550
|
const U = $A(c.mFrame, h, w);
|
|
6551
|
-
|
|
6551
|
+
n[0] = U.left, n[1] = U.right, n[2] = U.top, n[3] = U.bottom, A.draw({
|
|
6552
6552
|
shader: "vap-mix-overlay",
|
|
6553
6553
|
vertexBuffer: this.rgbaTopLeftQuadVB,
|
|
6554
6554
|
indexBuffer: this.rgbaQuadIB,
|
|
6555
6555
|
indexCount: 6,
|
|
6556
|
-
textures: [
|
|
6556
|
+
textures: [F, C],
|
|
6557
6557
|
uniforms: {
|
|
6558
6558
|
u_projection: e,
|
|
6559
|
-
u_transform:
|
|
6560
|
-
u_atlasRemap:
|
|
6559
|
+
u_transform: r,
|
|
6560
|
+
u_atlasRemap: n,
|
|
6561
6561
|
u_opacity: I.opacity,
|
|
6562
6562
|
u_resource: 0,
|
|
6563
6563
|
u_video: 1
|
|
@@ -7363,16 +7363,16 @@ class Qo {
|
|
|
7363
7363
|
(g = A.onComplete) == null || g.call(A, I), A.state = A.options.clearsAfterStop === !1 ? "stopped" : "finished";
|
|
7364
7364
|
}
|
|
7365
7365
|
tickSVGA(A, I, g, Q) {
|
|
7366
|
-
var C;
|
|
7367
|
-
const
|
|
7368
|
-
if (
|
|
7369
|
-
const
|
|
7366
|
+
var C, E;
|
|
7367
|
+
const o = A.videoEntity, i = o.params.fps, e = o.params.frames;
|
|
7368
|
+
if (i <= 0 || e <= 0) return !1;
|
|
7369
|
+
const a = 1 / i, t = A.currentFrame;
|
|
7370
7370
|
A.accumulatedTime += I;
|
|
7371
|
-
const
|
|
7372
|
-
if (
|
|
7373
|
-
A.accumulatedTime -=
|
|
7374
|
-
const
|
|
7375
|
-
return
|
|
7371
|
+
const s = Math.floor(A.accumulatedTime / a);
|
|
7372
|
+
if (s <= 0) return !1;
|
|
7373
|
+
A.accumulatedTime -= s * a;
|
|
7374
|
+
const D = (C = A.options.loop) != null ? C : 1, h = A.loopCount * e + A.currentFrame + s;
|
|
7375
|
+
return D === 0 ? (A.loopCount = Math.floor(h / e), A.currentFrame = h % e) : h >= D * e ? (A.loopCount = D, A.currentFrame = e - 1, this.onGiftPlayComplete(A, g, Q)) : (A.loopCount = Math.floor(h / e), A.currentFrame = h % e), A.currentFrame = Math.max(0, Math.min(A.currentFrame, e - 1)), A.currentFrame !== t && (this.audioManager.tickFrame(A, A.currentFrame, g), (E = A.onFrame) == null || E.call(A, A.currentFrame, g)), A.currentFrame !== t;
|
|
7376
7376
|
}
|
|
7377
7377
|
onGiftPlayComplete(A, I, g) {
|
|
7378
7378
|
var Q;
|
|
@@ -7496,8 +7496,8 @@ class Qo {
|
|
|
7496
7496
|
case "svga": {
|
|
7497
7497
|
const s = A.videoEntity, D = (I = s == null ? void 0 : s.atlasTextureHandles) != null && I.length ? s.atlasTextureHandles : (g = s == null ? void 0 : s.atlasTextureHandle) != null ? g : null, h = A.svgaSlotTextures && A.svgaSlotTextures.size > 0 ? 1 : 0;
|
|
7498
7498
|
if (t && t.d0 === D && t.d1 === h) return t.key;
|
|
7499
|
-
const
|
|
7500
|
-
return A.batchKeyCache = { key:
|
|
7499
|
+
const r = `svga:${((Q = s == null ? void 0 : s.atlasTextureHandles) != null && Q.length ? s.atlasTextureHandles : s != null && s.atlasTextureHandle ? [s.atlasTextureHandle] : []).map((n) => n.id).join(",")}:${h}`;
|
|
7500
|
+
return A.batchKeyCache = { key: r, d0: D, d1: h, d2: null }, r;
|
|
7501
7501
|
}
|
|
7502
7502
|
case "vap": {
|
|
7503
7503
|
const s = A.videoTextureHandle, D = !!A.vapMixState, h = (C = A.options.objectFit) != null ? C : "contain";
|
|
@@ -7600,15 +7600,15 @@ async function cg(B, A, I) {
|
|
|
7600
7600
|
let s = 0;
|
|
7601
7601
|
const D = Q ? QA() : 0;
|
|
7602
7602
|
for (; ; ) {
|
|
7603
|
-
const { done:
|
|
7604
|
-
if (
|
|
7603
|
+
const { done: n, value: c } = await o.read();
|
|
7604
|
+
if (n) break;
|
|
7605
7605
|
t.push(c), s += c.length;
|
|
7606
7606
|
}
|
|
7607
7607
|
await Promise.all([e, a]), Q && (Q.readMs = QA() - D, Q.outputChunks = t.length, Q.outputBytes = s);
|
|
7608
7608
|
const h = Q ? QA() : 0, w = new Uint8Array(s);
|
|
7609
|
-
let
|
|
7610
|
-
for (const
|
|
7611
|
-
w.set(
|
|
7609
|
+
let r = 0;
|
|
7610
|
+
for (const n of t)
|
|
7611
|
+
w.set(n, r), r += n.length;
|
|
7612
7612
|
return Q && (Q.concatMs = QA() - h, Q.totalMs = QA() - g, Q.status = "success"), w;
|
|
7613
7613
|
} catch (C) {
|
|
7614
7614
|
throw Q && (Q.totalMs = QA() - g, Q.error = rQ(C)), C;
|
|
@@ -8243,13 +8243,13 @@ async function GQ(B, A) {
|
|
|
8243
8243
|
B.skip(a * 4), await A();
|
|
8244
8244
|
const D = B.u32(), h = [];
|
|
8245
8245
|
for (let c = 0; c < D; c++) {
|
|
8246
|
-
const
|
|
8247
|
-
for (let M = 0; M <
|
|
8246
|
+
const F = B.u32(), G = [];
|
|
8247
|
+
for (let M = 0; M < F; M++)
|
|
8248
8248
|
G.push(ko(B)), await A();
|
|
8249
8249
|
h.push(G);
|
|
8250
8250
|
}
|
|
8251
8251
|
B.pad4();
|
|
8252
|
-
const w = I * Q,
|
|
8252
|
+
const w = I * Q, r = B.position, n = new Int32Array(B.sourceBuffer(), r, w);
|
|
8253
8253
|
return B.skip(w * 4), await A(), {
|
|
8254
8254
|
spriteCount: I,
|
|
8255
8255
|
frameCount: Q,
|
|
@@ -8258,7 +8258,7 @@ async function GQ(B, A) {
|
|
|
8258
8258
|
clipPaths: e,
|
|
8259
8259
|
clipPathIndex: s,
|
|
8260
8260
|
shapesTable: h,
|
|
8261
|
-
shapesIndex:
|
|
8261
|
+
shapesIndex: n,
|
|
8262
8262
|
hasAnyShapes: B.u8() !== 0
|
|
8263
8263
|
};
|
|
8264
8264
|
}
|
|
@@ -8340,8 +8340,8 @@ async function RQ(B, A, I, g) {
|
|
|
8340
8340
|
}), await C();
|
|
8341
8341
|
const t = [], s = E.u32();
|
|
8342
8342
|
for (let h = 0; h < s; h++) {
|
|
8343
|
-
const w = E.string(),
|
|
8344
|
-
t.push({ key: w, offset:
|
|
8343
|
+
const w = E.string(), r = E.bytesRef();
|
|
8344
|
+
t.push({ key: w, offset: r.offset, length: r.length }), await C();
|
|
8345
8345
|
}
|
|
8346
8346
|
const D = await GQ(E, C);
|
|
8347
8347
|
return Y(g, "SVGA payload deserialization aborted"), {
|
|
@@ -10124,24 +10124,24 @@ async function vo(B, A, I = {}) {
|
|
|
10124
10124
|
}
|
|
10125
10125
|
const a = To++, t = await new Promise((s, D) => {
|
|
10126
10126
|
var h, w;
|
|
10127
|
-
const
|
|
10127
|
+
const r = {
|
|
10128
10128
|
owner: g,
|
|
10129
10129
|
signal: I.signal,
|
|
10130
10130
|
resolve: s,
|
|
10131
10131
|
reject: D
|
|
10132
10132
|
};
|
|
10133
|
-
if (
|
|
10133
|
+
if (r.onAbort = () => {
|
|
10134
10134
|
OI(
|
|
10135
10135
|
g,
|
|
10136
10136
|
$("SVGA image decode aborted"),
|
|
10137
10137
|
a
|
|
10138
10138
|
);
|
|
10139
|
-
}, MI.set(a,
|
|
10140
|
-
|
|
10139
|
+
}, MI.set(a, r), (h = I.signal) != null && h.aborted) {
|
|
10140
|
+
r.onAbort();
|
|
10141
10141
|
return;
|
|
10142
10142
|
}
|
|
10143
|
-
(w = I.signal) == null || w.addEventListener("abort",
|
|
10144
|
-
const
|
|
10143
|
+
(w = I.signal) == null || w.addEventListener("abort", r.onAbort, { once: !0 });
|
|
10144
|
+
const n = {
|
|
10145
10145
|
type: "decode-batch",
|
|
10146
10146
|
id: a,
|
|
10147
10147
|
items: i,
|
|
@@ -10149,7 +10149,7 @@ async function vo(B, A, I = {}) {
|
|
|
10149
10149
|
maxConcurrency: I.maxConcurrency
|
|
10150
10150
|
};
|
|
10151
10151
|
try {
|
|
10152
|
-
g.postMessage(
|
|
10152
|
+
g.postMessage(n, e);
|
|
10153
10153
|
} catch (c) {
|
|
10154
10154
|
OI(
|
|
10155
10155
|
g,
|
|
@@ -10241,14 +10241,14 @@ async function HB(B, A, I) {
|
|
|
10241
10241
|
await Promise.all(
|
|
10242
10242
|
t.map(async ([h, w]) => {
|
|
10243
10243
|
try {
|
|
10244
|
-
const
|
|
10244
|
+
const r = await createImageBitmap(new Blob([new Uint8Array(w)]), {
|
|
10245
10245
|
premultiplyAlpha: "none"
|
|
10246
10246
|
});
|
|
10247
10247
|
if (I != null && I.aborted)
|
|
10248
|
-
throw
|
|
10249
|
-
g.set(h,
|
|
10250
|
-
} catch (
|
|
10251
|
-
if (JA(
|
|
10248
|
+
throw r.close(), $("SVGA image decode aborted");
|
|
10249
|
+
g.set(h, r);
|
|
10250
|
+
} catch (r) {
|
|
10251
|
+
if (JA(r)) throw r;
|
|
10252
10252
|
}
|
|
10253
10253
|
})
|
|
10254
10254
|
);
|
|
@@ -10378,16 +10378,16 @@ async function SQ(B, A, I, g, Q) {
|
|
|
10378
10378
|
I,
|
|
10379
10379
|
Q == null ? void 0 : Q.svgaLoadFrameBudgetMs,
|
|
10380
10380
|
E
|
|
10381
|
-
),
|
|
10381
|
+
), F = await mo(c, {
|
|
10382
10382
|
profile: Q == null ? void 0 : Q.svgaParseProfile,
|
|
10383
10383
|
workerTimeSliceMs: Q == null ? void 0 : Q.svgaWorkerFrameBudgetMs,
|
|
10384
10384
|
mainThreadFrameBudgetMs: Q == null ? void 0 : Q.svgaLoadFrameBudgetMs,
|
|
10385
10385
|
signal: E
|
|
10386
10386
|
});
|
|
10387
|
-
return Y(E, "SVGA parse aborted"), fB(Q == null ? void 0 : Q.svgaParseProfile,
|
|
10388
|
-
} catch (
|
|
10389
|
-
if (JA(
|
|
10390
|
-
console.warn("[GiftStage:SVGA] worker parse failed, using main thread",
|
|
10387
|
+
return Y(E, "SVGA parse aborted"), fB(Q == null ? void 0 : Q.svgaParseProfile, F), A ? wB(A, F) : bI.set(B, F), F;
|
|
10388
|
+
} catch (n) {
|
|
10389
|
+
if (JA(n)) throw n;
|
|
10390
|
+
console.warn("[GiftStage:SVGA] worker parse failed, using main thread", n), I = typeof B == "string" ? new Uint8Array(await xA(B)) : new Uint8Array(B);
|
|
10391
10391
|
}
|
|
10392
10392
|
Y(E, "SVGA parse aborted");
|
|
10393
10393
|
const a = Q != null && Q.svgaParseProfile ? z() : 0;
|
|
@@ -10395,25 +10395,25 @@ async function SQ(B, A, I, g, Q) {
|
|
|
10395
10395
|
const s = await Co(
|
|
10396
10396
|
I,
|
|
10397
10397
|
() => eI() && _C(I),
|
|
10398
|
-
Q != null && Q.svgaParseProfile ? (
|
|
10399
|
-
t =
|
|
10398
|
+
Q != null && Q.svgaParseProfile ? (n) => {
|
|
10399
|
+
t = n;
|
|
10400
10400
|
} : void 0
|
|
10401
10401
|
);
|
|
10402
10402
|
Y(E, "SVGA parse aborted");
|
|
10403
|
-
let D, h, w,
|
|
10403
|
+
let D, h, w, r;
|
|
10404
10404
|
if (eI()) {
|
|
10405
|
-
const
|
|
10406
|
-
if (Y(E, "SVGA parse aborted"),
|
|
10405
|
+
const n = Q != null && Q.svgaParseProfile ? z() : 0, c = Q != null && Q.svgaParseProfile ? IE(s) : null, F = (e = c == null ? void 0 : c.payload) != null ? e : AE(s);
|
|
10406
|
+
if (Y(E, "SVGA parse aborted"), F) {
|
|
10407
10407
|
Q != null && Q.svgaParseProfile && (h = {
|
|
10408
10408
|
path: "wasmDecodeSVGAPayload",
|
|
10409
10409
|
operation: "protobufDecodeAndPayloadBuild",
|
|
10410
10410
|
inputBytes: s.byteLength,
|
|
10411
|
-
outputBytes:
|
|
10412
|
-
totalMs: z() -
|
|
10411
|
+
outputBytes: F.byteLength,
|
|
10412
|
+
totalMs: z() - n,
|
|
10413
10413
|
wasm: c == null ? void 0 : c.profile
|
|
10414
10414
|
});
|
|
10415
|
-
const G = Q != null && Q.svgaParseProfile ? z() : 0, M =
|
|
10416
|
-
|
|
10415
|
+
const G = Q != null && Q.svgaParseProfile ? z() : 0, M = F.byteOffset === 0 && F.byteLength === F.buffer.byteLength ? F.buffer : await jI(
|
|
10416
|
+
F,
|
|
10417
10417
|
Q == null ? void 0 : Q.svgaLoadFrameBudgetMs,
|
|
10418
10418
|
E
|
|
10419
10419
|
);
|
|
@@ -10422,7 +10422,7 @@ async function SQ(B, A, I, g, Q) {
|
|
|
10422
10422
|
void 0,
|
|
10423
10423
|
Q == null ? void 0 : Q.svgaLoadFrameBudgetMs,
|
|
10424
10424
|
E
|
|
10425
|
-
), Q != null && Q.svgaParseProfile && (
|
|
10425
|
+
), Q != null && Q.svgaParseProfile && (r = z() - G);
|
|
10426
10426
|
} else {
|
|
10427
10427
|
const G = Q != null && Q.svgaParseProfile ? z() : 0;
|
|
10428
10428
|
let M = $C(s);
|
|
@@ -10455,19 +10455,19 @@ async function SQ(B, A, I, g, Q) {
|
|
|
10455
10455
|
), Q != null && Q.svgaParseProfile && (w = z() - y);
|
|
10456
10456
|
}
|
|
10457
10457
|
} else {
|
|
10458
|
-
const
|
|
10458
|
+
const n = Q != null && Q.svgaParseProfile ? z() : 0, c = UB(s);
|
|
10459
10459
|
Y(E, "SVGA parse aborted"), Q != null && Q.svgaParseProfile && (h = {
|
|
10460
10460
|
path: "jsDecodeSVGAProto",
|
|
10461
10461
|
operation: "protobufDecode",
|
|
10462
10462
|
inputBytes: s.byteLength,
|
|
10463
|
-
totalMs: z() -
|
|
10463
|
+
totalMs: z() - n
|
|
10464
10464
|
});
|
|
10465
|
-
const
|
|
10465
|
+
const F = Q != null && Q.svgaParseProfile ? z() : 0;
|
|
10466
10466
|
D = await pB(
|
|
10467
10467
|
c,
|
|
10468
10468
|
Q == null ? void 0 : Q.svgaLoadFrameBudgetMs,
|
|
10469
10469
|
E
|
|
10470
|
-
), Q != null && Q.svgaParseProfile && (w = z() -
|
|
10470
|
+
), Q != null && Q.svgaParseProfile && (w = z() - F);
|
|
10471
10471
|
}
|
|
10472
10472
|
return Q != null && Q.svgaParseProfile && (D.__debug = {
|
|
10473
10473
|
parser: {
|
|
@@ -10478,7 +10478,7 @@ async function SQ(B, A, I, g, Q) {
|
|
|
10478
10478
|
inflate: t,
|
|
10479
10479
|
protobuf: h,
|
|
10480
10480
|
payloadSerializeMs: w,
|
|
10481
|
-
payloadDeserializeMs:
|
|
10481
|
+
payloadDeserializeMs: r
|
|
10482
10482
|
}
|
|
10483
10483
|
}, fB(!0, D)), Y(E, "SVGA parse aborted"), A ? wB(A, D) : bI.set(B, D), D;
|
|
10484
10484
|
}), i = {
|
|
@@ -11166,12 +11166,12 @@ async function se(B, A, I, g, Q) {
|
|
|
11166
11166
|
if (!w) throw new Error("Atlas: 2d context unavailable");
|
|
11167
11167
|
w.clearRect(0, 0, D.atlasW, D.atlasH);
|
|
11168
11168
|
for (let c = 0; c < D.rects.length; c++) {
|
|
11169
|
-
const
|
|
11170
|
-
w.drawImage(G,
|
|
11169
|
+
const F = D.rects[c], G = B.get(F.key);
|
|
11170
|
+
w.drawImage(G, F.x, F.y, F.w, F.h), Qe(h, w, F, D.atlasW, D.atlasH, g), c + 1 < D.rects.length && E.shouldYield() && await E.yield(), Y(Q == null ? void 0 : Q.signal, "SVGA atlas build aborted");
|
|
11171
11171
|
}
|
|
11172
|
-
const
|
|
11172
|
+
const r = (Q == null ? void 0 : Q.captureEncodedPng) === !0 ? te(h) : void 0;
|
|
11173
11173
|
Y(Q == null ? void 0 : Q.signal, "SVGA atlas build aborted");
|
|
11174
|
-
const
|
|
11174
|
+
const n = A.createTexture(h, {
|
|
11175
11175
|
width: D.atlasW,
|
|
11176
11176
|
height: D.atlasH,
|
|
11177
11177
|
filter: "linear",
|
|
@@ -11186,10 +11186,10 @@ async function se(B, A, I, g, Q) {
|
|
|
11186
11186
|
textureIndex: s
|
|
11187
11187
|
});
|
|
11188
11188
|
t.push({
|
|
11189
|
-
textureHandle:
|
|
11189
|
+
textureHandle: n,
|
|
11190
11190
|
atlasWidth: D.atlasW,
|
|
11191
11191
|
atlasHeight: D.atlasH,
|
|
11192
|
-
encodedPngBytesPromise:
|
|
11192
|
+
encodedPngBytesPromise: r
|
|
11193
11193
|
});
|
|
11194
11194
|
}
|
|
11195
11195
|
} catch (s) {
|
|
@@ -11327,12 +11327,12 @@ async function Ge(B) {
|
|
|
11327
11327
|
return;
|
|
11328
11328
|
}
|
|
11329
11329
|
const w = [];
|
|
11330
|
-
Q.onSamples = (
|
|
11331
|
-
w.push(...
|
|
11330
|
+
Q.onSamples = (n, c, F) => {
|
|
11331
|
+
w.push(...F);
|
|
11332
11332
|
}, Q.setExtractionOptions(h.id, null, {
|
|
11333
11333
|
nbSamples: Math.max(h.nb_samples, 1)
|
|
11334
11334
|
}), Q.start();
|
|
11335
|
-
const
|
|
11335
|
+
const r = h.timescale > 0 ? h.duration / h.timescale : E.duration / (E.timescale || 1);
|
|
11336
11336
|
if (w.length === 0) {
|
|
11337
11337
|
g(new Error("mp4box: extraction produced no samples"));
|
|
11338
11338
|
return;
|
|
@@ -11340,7 +11340,7 @@ async function Ge(B) {
|
|
|
11340
11340
|
I({
|
|
11341
11341
|
codec: h.codec,
|
|
11342
11342
|
timescale: h.timescale,
|
|
11343
|
-
durationSec: Number.isFinite(
|
|
11343
|
+
durationSec: Number.isFinite(r) ? r : 0,
|
|
11344
11344
|
videoWidth: (a = (e = (i = h.video) == null ? void 0 : i.width) != null ? e : h.track_width) != null ? a : 0,
|
|
11345
11345
|
videoHeight: (D = (s = (t = h.video) == null ? void 0 : t.height) != null ? s : h.track_height) != null ? D : 0,
|
|
11346
11346
|
samples: w
|
|
@@ -11391,8 +11391,8 @@ async function Me(B, A, I, g) {
|
|
|
11391
11391
|
if (I.length === 0)
|
|
11392
11392
|
return { frames: [], timesSec: new Float64Array(0) };
|
|
11393
11393
|
const E = [...I].sort((h, w) => {
|
|
11394
|
-
var
|
|
11395
|
-
const G = ((
|
|
11394
|
+
var r, n, c, F;
|
|
11395
|
+
const G = ((n = (r = h.dts) != null ? r : h.cts) != null ? n : 0) - ((F = (c = w.dts) != null ? c : w.cts) != null ? F : 0);
|
|
11396
11396
|
return G !== 0 ? G : 0;
|
|
11397
11397
|
}), o = [], i = new VideoDecoder({
|
|
11398
11398
|
output: (h) => {
|
|
@@ -11407,13 +11407,13 @@ async function Me(B, A, I, g) {
|
|
|
11407
11407
|
for (const h of E) {
|
|
11408
11408
|
const w = h.data;
|
|
11409
11409
|
if (!w || w.byteLength === 0) continue;
|
|
11410
|
-
const
|
|
11411
|
-
|
|
11410
|
+
const r = (C = (Q = h.cts) != null ? Q : h.dts) != null ? C : 0, n = Math.round(r / g * 1e6), c = h.duration && g > 0 ? Math.round(h.duration / g * 1e6) : void 0, F = new Uint8Array(w.byteLength);
|
|
11411
|
+
F.set(w);
|
|
11412
11412
|
const G = new EncodedVideoChunk({
|
|
11413
11413
|
type: h.is_sync ? "key" : "delta",
|
|
11414
|
-
timestamp:
|
|
11414
|
+
timestamp: n,
|
|
11415
11415
|
duration: c,
|
|
11416
|
-
data:
|
|
11416
|
+
data: F
|
|
11417
11417
|
});
|
|
11418
11418
|
try {
|
|
11419
11419
|
i.decode(G);
|
|
@@ -11620,11 +11620,11 @@ class VA {
|
|
|
11620
11620
|
const Q = new le(), C = Je++, E = new Ke(I);
|
|
11621
11621
|
let o = 0, i = 0, e = 0, a = new Float64Array(0), t = !1, s = null;
|
|
11622
11622
|
const D = (c) => {
|
|
11623
|
-
const
|
|
11624
|
-
if (!(!
|
|
11625
|
-
if (
|
|
11626
|
-
o =
|
|
11627
|
-
const G =
|
|
11623
|
+
const F = c.data;
|
|
11624
|
+
if (!(!F || F.id !== C)) {
|
|
11625
|
+
if (F.type === "meta") {
|
|
11626
|
+
o = F.duration, i = F.videoWidth, e = F.videoHeight;
|
|
11627
|
+
const G = F.timesSec;
|
|
11628
11628
|
a = new Float64Array(
|
|
11629
11629
|
G.buffer,
|
|
11630
11630
|
G.byteOffset,
|
|
@@ -11632,11 +11632,11 @@ class VA {
|
|
|
11632
11632
|
), t = !0;
|
|
11633
11633
|
return;
|
|
11634
11634
|
}
|
|
11635
|
-
if (
|
|
11636
|
-
E.set(
|
|
11635
|
+
if (F.type === "frame") {
|
|
11636
|
+
E.set(F.index, F.frame);
|
|
11637
11637
|
return;
|
|
11638
11638
|
}
|
|
11639
|
-
|
|
11639
|
+
F.type !== "eos" && F.type === "error" && (s = new Error(F.message));
|
|
11640
11640
|
}
|
|
11641
11641
|
}, h = (c) => {
|
|
11642
11642
|
s = new Error(c.message || "Worker error");
|
|
@@ -11655,14 +11655,14 @@ class VA {
|
|
|
11655
11655
|
);
|
|
11656
11656
|
try {
|
|
11657
11657
|
if (await WB(() => t || s != null, 6e4, "meta"), s) throw s;
|
|
11658
|
-
const c = o > 0 ? o : 1e-6,
|
|
11659
|
-
if (await WB(() => s != null || E.bestAtOrBefore(
|
|
11658
|
+
const c = o > 0 ? o : 1e-6, F = lg(a, c, 0);
|
|
11659
|
+
if (await WB(() => s != null || E.bestAtOrBefore(F) != null, 6e4, "first frame"), s) throw s;
|
|
11660
11660
|
} catch (c) {
|
|
11661
11661
|
throw Q.removeEventListener("message", D), Q.removeEventListener("error", h), Q.terminate(), E.clear(), c instanceof Error ? c : new Error(String(c));
|
|
11662
11662
|
}
|
|
11663
|
-
const
|
|
11663
|
+
const r = a.length > 0 ? a[0] : 0, n = a.length > 0 ? a[a.length - 1] : 0;
|
|
11664
11664
|
return console.info(
|
|
11665
|
-
`[GiftStage:WC] worker streaming ready frames=${a.length} duration=${o.toFixed(4)}s size=${i}x${e} times=[${
|
|
11665
|
+
`[GiftStage:WC] worker streaming ready frames=${a.length} duration=${o.toFixed(4)}s size=${i}x${e} times=[${r.toFixed(4)} … ${n.toFixed(4)}] ring=${I}`
|
|
11666
11666
|
), new VA(
|
|
11667
11667
|
o,
|
|
11668
11668
|
i,
|
|
@@ -11967,8 +11967,8 @@ function Te(B, A, I, g, Q = new Float32Array(
|
|
|
11967
11967
|
const a = I.get(String(e.srcId));
|
|
11968
11968
|
if (!a) continue;
|
|
11969
11969
|
if (i + SI > Q.length) break;
|
|
11970
|
-
const [t, s, D, h] = e.frame, [w,
|
|
11971
|
-
Q[i++] = a, Q[i++] =
|
|
11970
|
+
const [t, s, D, h] = e.frame, [w, r, n, c] = e.mFrame, F = zI(t + E, s + o, D, h, B.info.videoW, B.info.videoH), G = zI(w, r, n, c, B.info.videoW, B.info.videoH);
|
|
11971
|
+
Q[i++] = a, Q[i++] = F[0], Q[i++] = F[1], Q[i++] = F[2], Q[i++] = F[3], Q[i++] = G[0], Q[i++] = G[1], Q[i++] = G[2], Q[i++] = G[3];
|
|
11972
11972
|
}
|
|
11973
11973
|
return Q;
|
|
11974
11974
|
}
|
|
@@ -12021,16 +12021,16 @@ class We {
|
|
|
12021
12021
|
this.imagePositionsScratch = new Float32Array(
|
|
12022
12022
|
w * SI
|
|
12023
12023
|
);
|
|
12024
|
-
const
|
|
12024
|
+
const r = be(
|
|
12025
12025
|
this.resourceEntries.length,
|
|
12026
12026
|
w,
|
|
12027
12027
|
e
|
|
12028
|
-
),
|
|
12029
|
-
this.program =
|
|
12028
|
+
), n = qe(a, r.vertex, r.fragment);
|
|
12029
|
+
this.program = n.program, this.vertexShader = n.vertexShader, this.fragmentShader = n.fragmentShader, this.imagePosLoc = a.getUniformLocation(this.program, "image_pos"), this.videoTexture = vB(a, 0);
|
|
12030
12030
|
const c = a.getUniformLocation(this.program, "u_image_video");
|
|
12031
12031
|
c !== null && a.uniform1i(c, 0);
|
|
12032
|
-
const
|
|
12033
|
-
|
|
12032
|
+
const F = a.getUniformLocation(this.program, "u_rgbPremultiplied");
|
|
12033
|
+
F !== null && a.uniform1f(F, E ? 1 : 0);
|
|
12034
12034
|
for (const N of this.resourceEntries) {
|
|
12035
12035
|
const U = a.getUniformLocation(this.program, `u_image${N.unit}`);
|
|
12036
12036
|
U !== null && a.uniform1i(U, N.unit);
|
|
@@ -12258,14 +12258,14 @@ async function Pe(B, A) {
|
|
|
12258
12258
|
fps: g.f32(),
|
|
12259
12259
|
frames: g.u32()
|
|
12260
12260
|
}, C = g.u32(), E = [];
|
|
12261
|
-
for (let
|
|
12262
|
-
const
|
|
12263
|
-
E.push({ width:
|
|
12261
|
+
for (let r = 0; r < C; r++) {
|
|
12262
|
+
const n = g.u32(), c = g.u32(), F = await g.ownedBytesValueCooperative(I);
|
|
12263
|
+
E.push({ width: n, height: c, imageBytes: F }), await aA(I);
|
|
12264
12264
|
}
|
|
12265
12265
|
const o = g.u32(), i = /* @__PURE__ */ new Map();
|
|
12266
|
-
for (let
|
|
12267
|
-
const
|
|
12268
|
-
i.set(
|
|
12266
|
+
for (let r = 0; r < o; r++) {
|
|
12267
|
+
const n = g.string(), c = g.u32();
|
|
12268
|
+
i.set(n, {
|
|
12269
12269
|
textureIndex: c,
|
|
12270
12270
|
x: g.f32(),
|
|
12271
12271
|
y: g.f32(),
|
|
@@ -12274,7 +12274,7 @@ async function Pe(B, A) {
|
|
|
12274
12274
|
}), await aA(I);
|
|
12275
12275
|
}
|
|
12276
12276
|
const e = g.u32(), a = [];
|
|
12277
|
-
for (let
|
|
12277
|
+
for (let r = 0; r < e; r++)
|
|
12278
12278
|
a.push({
|
|
12279
12279
|
audioKey: g.string(),
|
|
12280
12280
|
startFrame: g.u32(),
|
|
@@ -12283,14 +12283,14 @@ async function Pe(B, A) {
|
|
|
12283
12283
|
totalTime: g.f32()
|
|
12284
12284
|
}), await aA(I);
|
|
12285
12285
|
const t = g.u32(), s = /* @__PURE__ */ new Map();
|
|
12286
|
-
for (let
|
|
12287
|
-
const
|
|
12288
|
-
s.set(
|
|
12286
|
+
for (let r = 0; r < t; r++) {
|
|
12287
|
+
const n = g.string();
|
|
12288
|
+
s.set(n, await g.ownedBytesValueCooperative(I)), await aA(I);
|
|
12289
12289
|
}
|
|
12290
12290
|
const D = await GQ(g, () => aA(I)), h = g.u32(), w = /* @__PURE__ */ new Map();
|
|
12291
|
-
for (let
|
|
12292
|
-
const
|
|
12293
|
-
|
|
12291
|
+
for (let r = 0; r < h; r++) {
|
|
12292
|
+
const n = g.string(), c = new Float32Array(await g.ownedBytesValueCooperative(I)), F = new Uint32Array(await g.ownedBytesValueCooperative(I));
|
|
12293
|
+
n && c.length >= 6 && F.length >= 3 && w.set(n, { vertices: c, indices: F }), await aA(I);
|
|
12294
12294
|
}
|
|
12295
12295
|
return {
|
|
12296
12296
|
params: Q,
|
|
@@ -12634,16 +12634,16 @@ const wA = class BA {
|
|
|
12634
12634
|
const w = (D = this.manager) == null ? void 0 : D.getSlot(A.id);
|
|
12635
12635
|
if (!w || w.state === "finished") return I;
|
|
12636
12636
|
s === "afterGiftComplete" && await this.waitForGiftPlaybackComplete(A.id);
|
|
12637
|
-
let
|
|
12638
|
-
for (const
|
|
12637
|
+
let r = !1;
|
|
12638
|
+
for (const n of Q) {
|
|
12639
12639
|
if (o || !((h = this.manager) != null && h.getSlot(A.id)) || A.state === "finished") {
|
|
12640
|
-
|
|
12640
|
+
r = !0;
|
|
12641
12641
|
break;
|
|
12642
12642
|
}
|
|
12643
|
-
Ba(
|
|
12643
|
+
Ba(n) ? await a(n.delayMs) : await this.runGiftAnimationStep(A, I, n);
|
|
12644
12644
|
}
|
|
12645
|
-
if (!
|
|
12646
|
-
for (const
|
|
12645
|
+
if (!r && !o)
|
|
12646
|
+
for (const n of C) n(I);
|
|
12647
12647
|
return I;
|
|
12648
12648
|
},
|
|
12649
12649
|
cancel: () => {
|
|
@@ -12654,42 +12654,42 @@ const wA = class BA {
|
|
|
12654
12654
|
return t;
|
|
12655
12655
|
}
|
|
12656
12656
|
async addGift(A) {
|
|
12657
|
-
var I, g, Q, C, E, o, i, e;
|
|
12657
|
+
var I, g, Q, C, E, o, i, e, a;
|
|
12658
12658
|
if (console.info("[GiftStage] addGift await ready…", A.type), await this.ready, console.info("[GiftStage] addGift ready, loading…", A.type), this.destroyed) throw new Error("GiftStage is destroyed");
|
|
12659
|
-
let
|
|
12660
|
-
A.type === "image" && (
|
|
12661
|
-
let
|
|
12659
|
+
let t = null;
|
|
12660
|
+
A.type === "image" && (t = await this.acquireImageTexture(A.source));
|
|
12661
|
+
let s;
|
|
12662
12662
|
try {
|
|
12663
|
-
|
|
12663
|
+
s = await this.normalizeAddGiftOptions(
|
|
12664
12664
|
A,
|
|
12665
|
-
|
|
12665
|
+
t ? { width: t.width, height: t.height } : void 0
|
|
12666
12666
|
);
|
|
12667
|
-
} catch (
|
|
12668
|
-
throw
|
|
12667
|
+
} catch (G) {
|
|
12668
|
+
throw t == null || t.release(), G;
|
|
12669
12669
|
}
|
|
12670
12670
|
if (this.destroyed)
|
|
12671
|
-
throw
|
|
12672
|
-
const
|
|
12673
|
-
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12671
|
+
throw t == null || t.release(), new Error("GiftStage is destroyed");
|
|
12672
|
+
const D = tE(), { sx: h, sy: w } = dg(this.canvas), r = nQ(
|
|
12673
|
+
s.x,
|
|
12674
|
+
s.y,
|
|
12675
|
+
s.width,
|
|
12676
|
+
s.height,
|
|
12677
12677
|
this.canvas.clientWidth,
|
|
12678
12678
|
this.canvas.clientHeight
|
|
12679
12679
|
), n = {
|
|
12680
|
-
id:
|
|
12681
|
-
type:
|
|
12680
|
+
id: D,
|
|
12681
|
+
type: s.type,
|
|
12682
12682
|
state: "loading",
|
|
12683
|
-
options:
|
|
12684
|
-
zIndex: (I =
|
|
12683
|
+
options: s,
|
|
12684
|
+
zIndex: (I = s.zIndex) != null ? I : 0,
|
|
12685
12685
|
renderOrder: this.nextRenderOrder++,
|
|
12686
|
-
x:
|
|
12687
|
-
y:
|
|
12688
|
-
width:
|
|
12689
|
-
height:
|
|
12686
|
+
x: r.x * h,
|
|
12687
|
+
y: r.y * w,
|
|
12688
|
+
width: s.width * h,
|
|
12689
|
+
height: s.height * w,
|
|
12690
12690
|
scale: 1,
|
|
12691
|
-
opacity: OB((g =
|
|
12692
|
-
rotation: Number.isFinite(
|
|
12691
|
+
opacity: OB((g = s.opacity) != null ? g : 1),
|
|
12692
|
+
rotation: Number.isFinite(s.rotation) ? s.rotation : 0,
|
|
12693
12693
|
paused: !1,
|
|
12694
12694
|
currentFrame: 0,
|
|
12695
12695
|
accumulatedTime: 0,
|
|
@@ -12710,59 +12710,60 @@ const wA = class BA {
|
|
|
12710
12710
|
releaseWebCodecsPlayback: null,
|
|
12711
12711
|
wcPlaybackTime: 0,
|
|
12712
12712
|
videoTextureHandle: null,
|
|
12713
|
-
imageTextureHandle: (Q =
|
|
12714
|
-
releaseSharedImageTexture: (C =
|
|
12713
|
+
imageTextureHandle: (Q = t == null ? void 0 : t.texture) != null ? Q : null,
|
|
12714
|
+
releaseSharedImageTexture: (C = t == null ? void 0 : t.release) != null ? C : null,
|
|
12715
12715
|
webcodecsSurface: null,
|
|
12716
12716
|
releaseWebCodecsSurface: null,
|
|
12717
12717
|
vapMixState: null,
|
|
12718
|
+
onFrame: s.onFrame,
|
|
12718
12719
|
onComplete: void 0
|
|
12719
12720
|
};
|
|
12720
|
-
let
|
|
12721
|
-
|
|
12722
|
-
id:
|
|
12723
|
-
type:
|
|
12721
|
+
let c;
|
|
12722
|
+
c = {
|
|
12723
|
+
id: D,
|
|
12724
|
+
type: s.type,
|
|
12724
12725
|
pause: () => {
|
|
12725
|
-
var
|
|
12726
|
-
n.paused = !0, (
|
|
12726
|
+
var G;
|
|
12727
|
+
n.paused = !0, (G = this.manager) == null || G.postAnimator.pauseForGift(n.id);
|
|
12727
12728
|
},
|
|
12728
12729
|
resume: () => {
|
|
12729
|
-
var
|
|
12730
|
-
n.paused = !1, (
|
|
12730
|
+
var G;
|
|
12731
|
+
n.paused = !1, (G = this.manager) == null || G.postAnimator.resumeForGift(n.id);
|
|
12731
12732
|
},
|
|
12732
12733
|
destroy: () => {
|
|
12733
|
-
this.removeGift(
|
|
12734
|
+
this.removeGift(D);
|
|
12734
12735
|
},
|
|
12735
|
-
animate: (
|
|
12736
|
+
animate: (G) => this.createGiftAnimationChain(n, c, G)
|
|
12736
12737
|
};
|
|
12737
|
-
const
|
|
12738
|
-
n.onComplete = (
|
|
12739
|
-
this.markGiftPlaybackComplete(n.id),
|
|
12740
|
-
}, this.manager.addSlot(n,
|
|
12738
|
+
const F = s.onComplete;
|
|
12739
|
+
n.onComplete = (G) => {
|
|
12740
|
+
this.markGiftPlaybackComplete(n.id), F == null || F(G);
|
|
12741
|
+
}, this.manager.addSlot(n, c);
|
|
12741
12742
|
try {
|
|
12742
|
-
switch (
|
|
12743
|
+
switch (s.type) {
|
|
12743
12744
|
case "svga":
|
|
12744
12745
|
await this.loadSVGA(n);
|
|
12745
12746
|
break;
|
|
12746
12747
|
case "vap":
|
|
12747
|
-
await this.loadVAP(n,
|
|
12748
|
+
await this.loadVAP(n, s);
|
|
12748
12749
|
break;
|
|
12749
12750
|
case "alphaVideo":
|
|
12750
|
-
await this.loadAlphaVideo(n,
|
|
12751
|
+
await this.loadAlphaVideo(n, s);
|
|
12751
12752
|
break;
|
|
12752
12753
|
case "image":
|
|
12753
12754
|
break;
|
|
12754
12755
|
}
|
|
12755
|
-
this.assertSlotLoadActive(n), n.state = "playing",
|
|
12756
|
+
this.assertSlotLoadActive(n), n.state = "playing", s.type === "svga" && n.videoEntity && (this.manager.audioManager.tickFrame(n, n.currentFrame, c), (E = n.onFrame) == null || E.call(n, n.currentFrame, c)), n.webcodecsPlayback && console.info("[GiftStage:WC] gift playing", {
|
|
12756
12757
|
giftId: n.id,
|
|
12757
12758
|
type: n.type,
|
|
12758
12759
|
layoutBufPx: { x: n.x, y: n.y, w: n.width, h: n.height }
|
|
12759
|
-
}),
|
|
12760
|
-
} catch (
|
|
12761
|
-
if (this.isLoadCanceled(
|
|
12762
|
-
return ((
|
|
12763
|
-
n.state = "finished", (
|
|
12760
|
+
}), s.type === "image" && !(s.duration > 0) && this.markGiftPlaybackComplete(n.id);
|
|
12761
|
+
} catch (G) {
|
|
12762
|
+
if (this.isLoadCanceled(G))
|
|
12763
|
+
return ((o = this.manager) == null ? void 0 : o.getSlot(n.id)) === n ? this.manager.removeSlot(n.id) : (i = this.manager) == null || i.releaseSlotResources(n), c;
|
|
12764
|
+
n.state = "finished", (a = (e = this.options).onError) == null || a.call(e, G instanceof Error ? G : new Error(String(G)));
|
|
12764
12765
|
}
|
|
12765
|
-
return
|
|
12766
|
+
return c;
|
|
12766
12767
|
}
|
|
12767
12768
|
async loadSVGA(A) {
|
|
12768
12769
|
var I, g, Q, C;
|
|
@@ -12799,10 +12800,10 @@ const wA = class BA {
|
|
|
12799
12800
|
audios: i.audios,
|
|
12800
12801
|
audioBlobs: a,
|
|
12801
12802
|
atlasRects: t.rects,
|
|
12802
|
-
atlasPages: t.pages.map((w,
|
|
12803
|
+
atlasPages: t.pages.map((w, r) => ({
|
|
12803
12804
|
width: w.atlasWidth,
|
|
12804
12805
|
height: w.atlasHeight,
|
|
12805
|
-
imageBytes: h[
|
|
12806
|
+
imageBytes: h[r]
|
|
12806
12807
|
}))
|
|
12807
12808
|
},
|
|
12808
12809
|
{ frameBudgetMs: this.options.svgaLoadFrameBudgetMs }
|
|
@@ -12898,7 +12899,7 @@ const wA = class BA {
|
|
|
12898
12899
|
a = await this.buildSVGAAtlasIfNeeded(e.imageBitmaps, !0, !0, I);
|
|
12899
12900
|
} catch (w) {
|
|
12900
12901
|
if (JA(w) || !(w instanceof KA)) throw w;
|
|
12901
|
-
for (const
|
|
12902
|
+
for (const r of e.imageBitmaps.values()) r.close();
|
|
12902
12903
|
e = await Ng(A, this.svgaParseOptions(I)), a = await this.buildSVGAAtlasIfNeeded(e.imageBitmaps, !0, !1, I);
|
|
12903
12904
|
}
|
|
12904
12905
|
const { movie: t, audioBlobs: s } = e, D = {
|
|
@@ -12918,9 +12919,9 @@ const wA = class BA {
|
|
|
12918
12919
|
});
|
|
12919
12920
|
const h = this.manager.snapshotSVGAClipMeshes(D);
|
|
12920
12921
|
if (Y(I, v), a && a.encodedPngBytesPromises) {
|
|
12921
|
-
const w = a,
|
|
12922
|
-
Promise.all(
|
|
12923
|
-
I != null && I.aborted ||
|
|
12922
|
+
const w = a, r = a.encodedPngBytesPromises;
|
|
12923
|
+
Promise.all(r).then((n) => {
|
|
12924
|
+
I != null && I.aborted || n.some((c) => !c) || Ug(
|
|
12924
12925
|
A,
|
|
12925
12926
|
{
|
|
12926
12927
|
params: t.params,
|
|
@@ -12928,10 +12929,10 @@ const wA = class BA {
|
|
|
12928
12929
|
audios: t.audios,
|
|
12929
12930
|
audioBlobs: s,
|
|
12930
12931
|
atlasRects: w.rects,
|
|
12931
|
-
atlasPages: w.pages.map((c,
|
|
12932
|
+
atlasPages: w.pages.map((c, F) => ({
|
|
12932
12933
|
width: c.atlasWidth,
|
|
12933
12934
|
height: c.atlasHeight,
|
|
12934
|
-
imageBytes: F
|
|
12935
|
+
imageBytes: n[F]
|
|
12935
12936
|
})),
|
|
12936
12937
|
clipMeshes: h
|
|
12937
12938
|
},
|
|
@@ -13062,8 +13063,8 @@ const wA = class BA {
|
|
|
13062
13063
|
var A;
|
|
13063
13064
|
return Math.max(1, Math.floor((A = this.options.svgaAtlasMaxPages) != null ? A : 4));
|
|
13064
13065
|
}
|
|
13065
|
-
shouldTryWebCodecs() {
|
|
13066
|
-
return this.options.preferWebCodecs === !0 && typeof VideoDecoder != "undefined";
|
|
13066
|
+
shouldTryWebCodecs(A) {
|
|
13067
|
+
return (A == null ? void 0 : A.mute) !== !1 && this.options.preferWebCodecs === !0 && typeof VideoDecoder != "undefined";
|
|
13067
13068
|
}
|
|
13068
13069
|
/** DevTools: filter by `[GiftStage]` to see WebCodecs vs <video> per gift. */
|
|
13069
13070
|
logPlaybackBackend(A, I, g) {
|
|
@@ -13087,7 +13088,7 @@ const wA = class BA {
|
|
|
13087
13088
|
}
|
|
13088
13089
|
}
|
|
13089
13090
|
async acquireWebCodecsPlayback(A, I) {
|
|
13090
|
-
if (!this.shouldTryWebCodecs()) return null;
|
|
13091
|
+
if (!this.shouldTryWebCodecs(A)) return null;
|
|
13091
13092
|
if (this.options.shareIdenticalVideoPlayback !== !1 && A.loop === 0 && typeof A.source == "string") {
|
|
13092
13093
|
const Q = this.normalizeSharedVideoSourceKey(A.source);
|
|
13093
13094
|
if (Q) return this.acquireSharedWebCodecsPlayback(Q, I);
|
|
@@ -13192,8 +13193,8 @@ const wA = class BA {
|
|
|
13192
13193
|
if (e && e.width > 0 && e.height > 0) {
|
|
13193
13194
|
const h = `${i.id}:atlas:${e.width}x${e.height}:${C}x${E}`, w = this.retainSharedWebCodecsSurface(h);
|
|
13194
13195
|
if (w) return w;
|
|
13195
|
-
const
|
|
13196
|
-
|
|
13196
|
+
const r = this.nextSharedWebCodecsSurfaceId++, n = `wc-shared-surface:${r}`, c = this.manager.tryAllocateWebCodecsAtlas(
|
|
13197
|
+
n,
|
|
13197
13198
|
C,
|
|
13198
13199
|
E,
|
|
13199
13200
|
e
|
|
@@ -13208,16 +13209,16 @@ const wA = class BA {
|
|
|
13208
13209
|
c.rect.w,
|
|
13209
13210
|
c.rect.h
|
|
13210
13211
|
);
|
|
13211
|
-
} catch (
|
|
13212
|
-
throw this.manager.releaseWebCodecsAtlasAllocation(
|
|
13212
|
+
} catch (F) {
|
|
13213
|
+
throw this.manager.releaseWebCodecsAtlasAllocation(n), F;
|
|
13213
13214
|
}
|
|
13214
13215
|
return this.createSharedWebCodecsSurface(
|
|
13215
13216
|
h,
|
|
13216
|
-
|
|
13217
|
+
r,
|
|
13217
13218
|
c.handle,
|
|
13218
13219
|
I,
|
|
13219
13220
|
c.rect,
|
|
13220
|
-
|
|
13221
|
+
n
|
|
13221
13222
|
);
|
|
13222
13223
|
}
|
|
13223
13224
|
}
|
|
@@ -13280,10 +13281,10 @@ const wA = class BA {
|
|
|
13280
13281
|
if (this.backend.type === "webgpu" || this.backend.type === "webgl2")
|
|
13281
13282
|
try {
|
|
13282
13283
|
w = this.createVAPMixResourceTextures(i);
|
|
13283
|
-
} catch (
|
|
13284
|
+
} catch (r) {
|
|
13284
13285
|
console.warn(
|
|
13285
13286
|
"[GiftStage] VAP main-context mixed textures failed; falling back to compositor",
|
|
13286
|
-
|
|
13287
|
+
r
|
|
13287
13288
|
);
|
|
13288
13289
|
}
|
|
13289
13290
|
if (w)
|
|
@@ -13297,9 +13298,9 @@ const wA = class BA {
|
|
|
13297
13298
|
lastSourceRef: null
|
|
13298
13299
|
};
|
|
13299
13300
|
else {
|
|
13300
|
-
let
|
|
13301
|
+
let r = null, n = null;
|
|
13301
13302
|
try {
|
|
13302
|
-
|
|
13303
|
+
r = new We(
|
|
13303
13304
|
o,
|
|
13304
13305
|
h,
|
|
13305
13306
|
i,
|
|
@@ -13307,8 +13308,8 @@ const wA = class BA {
|
|
|
13307
13308
|
D.h,
|
|
13308
13309
|
I.videoRGBAlphaMode !== "straight"
|
|
13309
13310
|
);
|
|
13310
|
-
} catch (
|
|
13311
|
-
console.warn("[GiftStage] VAP mixed rendering fell back to CPU compositor",
|
|
13311
|
+
} catch (F) {
|
|
13312
|
+
console.warn("[GiftStage] VAP mixed rendering fell back to CPU compositor", F), n = Hi(D.w, D.h);
|
|
13312
13313
|
}
|
|
13313
13314
|
const c = this.backend.createEmptyTexture(D.w, D.h, {
|
|
13314
13315
|
filter: "linear"
|
|
@@ -13318,12 +13319,12 @@ const wA = class BA {
|
|
|
13318
13319
|
texture: c,
|
|
13319
13320
|
width: D.w,
|
|
13320
13321
|
height: D.h,
|
|
13321
|
-
composer:
|
|
13322
|
+
composer: r,
|
|
13322
13323
|
frameMap: h,
|
|
13323
|
-
resources:
|
|
13324
|
+
resources: r ? void 0 : i,
|
|
13324
13325
|
lastFrameIndex: -1,
|
|
13325
13326
|
lastSourceRef: null,
|
|
13326
|
-
...
|
|
13327
|
+
...n != null ? n : {}
|
|
13327
13328
|
}, A.videoTextureHandle = c;
|
|
13328
13329
|
}
|
|
13329
13330
|
}
|
|
@@ -13336,22 +13337,22 @@ const wA = class BA {
|
|
|
13336
13337
|
if (!D)
|
|
13337
13338
|
throw this.releaseAttachedWebCodecsPlayback(A), new Error("WebCodecs: missing first frame");
|
|
13338
13339
|
if (!A.vapMixState || A.vapMixState.mode === "direct") {
|
|
13339
|
-
const w = D.displayWidth || D.codedWidth,
|
|
13340
|
+
const w = D.displayWidth || D.codedWidth, r = D.displayHeight || D.codedHeight, n = !A.vapMixState, { w: c, h: F } = ZB(A, w, r, "vap", o), G = this.acquireSharedWebCodecsSurface(
|
|
13340
13341
|
A,
|
|
13341
13342
|
D,
|
|
13342
13343
|
w,
|
|
13343
|
-
n,
|
|
13344
|
-
c,
|
|
13345
13344
|
r,
|
|
13346
|
-
|
|
13345
|
+
c,
|
|
13346
|
+
F,
|
|
13347
|
+
n
|
|
13347
13348
|
);
|
|
13348
13349
|
if (G)
|
|
13349
13350
|
this.attachSharedWebCodecsSurface(A, G);
|
|
13350
13351
|
else {
|
|
13351
|
-
const M =
|
|
13352
|
+
const M = n ? this.manager.tryAllocateWebCodecsAtlas(
|
|
13352
13353
|
A.id,
|
|
13353
13354
|
c,
|
|
13354
|
-
|
|
13355
|
+
F,
|
|
13355
13356
|
this.options.webCodecsVideoAtlas
|
|
13356
13357
|
) : null;
|
|
13357
13358
|
M ? (A.videoTextureHandle = M.handle, A.wcAtlasRect = M.rect, this.backend.updateTextureRegion(
|
|
@@ -13360,10 +13361,10 @@ const wA = class BA {
|
|
|
13360
13361
|
M.rect.x,
|
|
13361
13362
|
M.rect.y,
|
|
13362
13363
|
c,
|
|
13363
|
-
|
|
13364
|
+
F
|
|
13364
13365
|
)) : A.videoTextureHandle = this.backend.createTexture(D, {
|
|
13365
13366
|
width: w,
|
|
13366
|
-
height:
|
|
13367
|
+
height: r,
|
|
13367
13368
|
filter: "linear"
|
|
13368
13369
|
});
|
|
13369
13370
|
}
|
|
@@ -13390,7 +13391,11 @@ const wA = class BA {
|
|
|
13390
13391
|
if (!this.isSlotLoadActive(A))
|
|
13391
13392
|
throw (Q = D.release) == null || Q.call(D), new Error(v);
|
|
13392
13393
|
A.releaseMediaSource = (C = D.release) != null ? C : null;
|
|
13393
|
-
const h = this.createVideo(
|
|
13394
|
+
const h = this.createVideo(
|
|
13395
|
+
D.src,
|
|
13396
|
+
I.loop === 0,
|
|
13397
|
+
I.mute !== !1
|
|
13398
|
+
);
|
|
13394
13399
|
A.videoElement = h;
|
|
13395
13400
|
}
|
|
13396
13401
|
const s = A.videoElement;
|
|
@@ -13407,7 +13412,7 @@ const wA = class BA {
|
|
|
13407
13412
|
A.releaseSharedVideoPlayback || this.bindVideoLoopOnEnded(A, s), this.logPlaybackBackend(
|
|
13408
13413
|
A,
|
|
13409
13414
|
"video",
|
|
13410
|
-
this.shouldTryWebCodecs() ? "fallback after WebCodecs unavailable or failed" : "preferWebCodecs off or no VideoDecoder"
|
|
13415
|
+
I.mute === !1 ? "WebCodecs disabled for audible playback" : this.shouldTryWebCodecs(I) ? "fallback after WebCodecs unavailable or failed" : "preferWebCodecs off or no VideoDecoder"
|
|
13411
13416
|
);
|
|
13412
13417
|
}
|
|
13413
13418
|
createVAPMixResourceTextures(A) {
|
|
@@ -13452,17 +13457,17 @@ const wA = class BA {
|
|
|
13452
13457
|
if (w)
|
|
13453
13458
|
this.attachSharedWebCodecsSurface(A, w);
|
|
13454
13459
|
else {
|
|
13455
|
-
const
|
|
13460
|
+
const n = this.manager.tryAllocateWebCodecsAtlas(
|
|
13456
13461
|
A.id,
|
|
13457
13462
|
D,
|
|
13458
13463
|
h,
|
|
13459
13464
|
this.options.webCodecsVideoAtlas
|
|
13460
13465
|
);
|
|
13461
|
-
|
|
13462
|
-
|
|
13466
|
+
n ? (A.videoTextureHandle = n.handle, A.wcAtlasRect = n.rect, this.backend.updateTextureRegion(
|
|
13467
|
+
n.handle,
|
|
13463
13468
|
a,
|
|
13464
|
-
|
|
13465
|
-
|
|
13469
|
+
n.rect.x,
|
|
13470
|
+
n.rect.y,
|
|
13466
13471
|
D,
|
|
13467
13472
|
h
|
|
13468
13473
|
)) : A.videoTextureHandle = this.backend.createTexture(a, {
|
|
@@ -13472,11 +13477,11 @@ const wA = class BA {
|
|
|
13472
13477
|
});
|
|
13473
13478
|
}
|
|
13474
13479
|
A.videoElement = null;
|
|
13475
|
-
const
|
|
13480
|
+
const r = A.videoTextureHandle;
|
|
13476
13481
|
console.info("[GiftStage:WC] alphaVideo texture", {
|
|
13477
13482
|
giftId: A.id,
|
|
13478
13483
|
atlas: !!A.wcAtlasRect,
|
|
13479
|
-
tex: `${
|
|
13484
|
+
tex: `${r.width}x${r.height}`,
|
|
13480
13485
|
frame0: `${a.displayWidth}x${a.displayHeight}`,
|
|
13481
13486
|
atlasCell: A.wcAtlasRect ? `${A.wcAtlasRect.w}x${A.wcAtlasRect.h}` : void 0
|
|
13482
13487
|
}), this.logPlaybackBackend(A, "webcodecs");
|
|
@@ -13492,7 +13497,11 @@ const wA = class BA {
|
|
|
13492
13497
|
if (!this.isSlotLoadActive(A))
|
|
13493
13498
|
throw (Q = a.release) == null || Q.call(a), new Error(v);
|
|
13494
13499
|
A.releaseMediaSource = (C = a.release) != null ? C : null;
|
|
13495
|
-
const t = this.createVideo(
|
|
13500
|
+
const t = this.createVideo(
|
|
13501
|
+
a.src,
|
|
13502
|
+
I.loop === 0,
|
|
13503
|
+
I.mute !== !1
|
|
13504
|
+
);
|
|
13496
13505
|
A.videoElement = t;
|
|
13497
13506
|
}
|
|
13498
13507
|
const e = A.videoElement;
|
|
@@ -13509,7 +13518,7 @@ const wA = class BA {
|
|
|
13509
13518
|
A.releaseSharedVideoPlayback || this.bindVideoLoopOnEnded(A, e), this.logPlaybackBackend(
|
|
13510
13519
|
A,
|
|
13511
13520
|
"video",
|
|
13512
|
-
this.shouldTryWebCodecs() ? "fallback after WebCodecs unavailable or failed" : "preferWebCodecs off or no VideoDecoder"
|
|
13521
|
+
I.mute === !1 ? "WebCodecs disabled for audible playback" : this.shouldTryWebCodecs(I) ? "fallback after WebCodecs unavailable or failed" : "preferWebCodecs off or no VideoDecoder"
|
|
13513
13522
|
);
|
|
13514
13523
|
}
|
|
13515
13524
|
/**
|
|
@@ -13595,9 +13604,9 @@ const wA = class BA {
|
|
|
13595
13604
|
Math.min(o + i, BA.MAX_TIMER_DELAY_MS)
|
|
13596
13605
|
);
|
|
13597
13606
|
}
|
|
13598
|
-
createVideo(A, I) {
|
|
13599
|
-
const
|
|
13600
|
-
return
|
|
13607
|
+
createVideo(A, I, g = !0) {
|
|
13608
|
+
const Q = document.createElement("video");
|
|
13609
|
+
return Q.crossOrigin = "anonymous", Q.autoplay = !0, Q.preload = "auto", Q.muted = g, Q.defaultMuted = g, Q.playsInline = !0, Q.setAttribute("playsinline", ""), Q.setAttribute("webkit-playsinline", "true"), Q.loop = I, Q.style.cssText = "display:none;", Q.src = A, document.body.appendChild(Q), Q.load(), Q;
|
|
13601
13610
|
}
|
|
13602
13611
|
waitVideoMetadata(A) {
|
|
13603
13612
|
return new Promise((I, g) => {
|
|
@@ -13680,41 +13689,41 @@ const wA = class BA {
|
|
|
13680
13689
|
if (this.options.shareIdenticalVideoPlayback === !1 || I.loop !== 0 || typeof I.source != "string" || A.type === "vap" && A.vapMixState) return null;
|
|
13681
13690
|
const C = this.normalizeSharedVideoSourceKey(I.source);
|
|
13682
13691
|
if (!C) return null;
|
|
13683
|
-
const E = (g = this.options.sharedVideoPlaybackWindowMs) != null ? g : BA.DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS,
|
|
13684
|
-
if (
|
|
13685
|
-
return
|
|
13686
|
-
cacheKey:
|
|
13687
|
-
video:
|
|
13688
|
-
ready:
|
|
13689
|
-
release: () => this.releaseSharedHtmlVideo(
|
|
13692
|
+
const E = `${C}::muted=${I.mute !== !1 ? 1 : 0}`, o = (g = this.options.sharedVideoPlaybackWindowMs) != null ? g : BA.DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS, i = Math.max(0, o) / 1e3, e = this.sharedHtmlVideos.get(E);
|
|
13693
|
+
if (e)
|
|
13694
|
+
return e.video.currentTime > i ? null : (e.refs++, {
|
|
13695
|
+
cacheKey: E,
|
|
13696
|
+
video: e.video,
|
|
13697
|
+
ready: e.ready,
|
|
13698
|
+
release: () => this.releaseSharedHtmlVideo(E)
|
|
13690
13699
|
});
|
|
13691
|
-
let
|
|
13692
|
-
|
|
13693
|
-
var
|
|
13694
|
-
const
|
|
13700
|
+
let a = this.pendingSharedHtmlVideos.get(E);
|
|
13701
|
+
a || (a = (async () => {
|
|
13702
|
+
var D;
|
|
13703
|
+
const h = await this.acquireVideoPlaybackSource(I.source), w = this.createVideo(h.src, !0, I.mute !== !1), r = this.waitVideoReady(w);
|
|
13695
13704
|
return {
|
|
13696
|
-
video:
|
|
13697
|
-
ready:
|
|
13698
|
-
releaseSource: (
|
|
13705
|
+
video: w,
|
|
13706
|
+
ready: r,
|
|
13707
|
+
releaseSource: (D = h.release) != null ? D : null
|
|
13699
13708
|
};
|
|
13700
|
-
})(), this.pendingSharedHtmlVideos.set(
|
|
13701
|
-
let
|
|
13709
|
+
})(), this.pendingSharedHtmlVideos.set(E, a));
|
|
13710
|
+
let t;
|
|
13702
13711
|
try {
|
|
13703
|
-
|
|
13704
|
-
} catch (
|
|
13705
|
-
throw this.pendingSharedHtmlVideos.delete(
|
|
13712
|
+
t = await a;
|
|
13713
|
+
} catch (D) {
|
|
13714
|
+
throw this.pendingSharedHtmlVideos.delete(E), D;
|
|
13706
13715
|
}
|
|
13707
|
-
let
|
|
13708
|
-
return
|
|
13716
|
+
let s = this.sharedHtmlVideos.get(E);
|
|
13717
|
+
return s ? s.refs++ : (s = {
|
|
13709
13718
|
refs: 1,
|
|
13710
|
-
video: a.video,
|
|
13711
|
-
ready: a.ready,
|
|
13712
|
-
releaseSource: (Q = a.releaseSource) != null ? Q : null
|
|
13713
|
-
}, this.sharedHtmlVideos.set(C, t)), this.pendingSharedHtmlVideos.delete(C), {
|
|
13714
|
-
cacheKey: C,
|
|
13715
13719
|
video: t.video,
|
|
13716
13720
|
ready: t.ready,
|
|
13717
|
-
|
|
13721
|
+
releaseSource: (Q = t.releaseSource) != null ? Q : null
|
|
13722
|
+
}, this.sharedHtmlVideos.set(E, s)), this.pendingSharedHtmlVideos.delete(E), {
|
|
13723
|
+
cacheKey: E,
|
|
13724
|
+
video: s.video,
|
|
13725
|
+
ready: s.ready,
|
|
13726
|
+
release: () => this.releaseSharedHtmlVideo(E)
|
|
13718
13727
|
};
|
|
13719
13728
|
}
|
|
13720
13729
|
acquireSharedVideoTexture(A, I) {
|
|
@@ -13848,7 +13857,16 @@ const wA = class BA {
|
|
|
13848
13857
|
if (!(C || Q)) {
|
|
13849
13858
|
C = !0;
|
|
13850
13859
|
try {
|
|
13851
|
-
|
|
13860
|
+
try {
|
|
13861
|
+
await A.play();
|
|
13862
|
+
} catch (s) {
|
|
13863
|
+
if (A.muted) throw s;
|
|
13864
|
+
console.warn(
|
|
13865
|
+
"[GiftStage] audible HTMLVideo autoplay was blocked; retrying muted",
|
|
13866
|
+
s
|
|
13867
|
+
), A.muted = !0, A.defaultMuted = !0, await A.play();
|
|
13868
|
+
}
|
|
13869
|
+
await this.waitForFirstVideoFrame(A), i(I);
|
|
13852
13870
|
} catch (s) {
|
|
13853
13871
|
i(() => g(s));
|
|
13854
13872
|
}
|