@taole/giftstage 0.1.30 → 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 +8 -2
- package/dist/core/gift-stage.d.ts +8 -0
- package/dist/gift-stage.cjs.js +7 -7
- package/dist/gift-stage.es.js +829 -736
- package/dist/types/index.d.ts +11 -0
- package/package.json +1 -1
package/dist/gift-stage.es.js
CHANGED
|
@@ -694,7 +694,7 @@ fn fs(f: VOut) -> @location(0) vec4f {\r
|
|
|
694
694
|
alphaVideoInstanced: { vert: zQ, frag: _g },
|
|
695
695
|
rgbaTextured: { vert: jQ, frag: PQ },
|
|
696
696
|
clipMask: { vert: $Q, frag: AC }
|
|
697
|
-
},
|
|
697
|
+
}, nA = {
|
|
698
698
|
svgaBatchPremul: IC,
|
|
699
699
|
svgaInstancedPremul: eC,
|
|
700
700
|
vap: gC,
|
|
@@ -806,7 +806,7 @@ const AA = class _ {
|
|
|
806
806
|
});
|
|
807
807
|
this.createTexturedPipeline(
|
|
808
808
|
"svga-batch-premul:none",
|
|
809
|
-
|
|
809
|
+
nA.svgaBatchPremul,
|
|
810
810
|
A,
|
|
811
811
|
[
|
|
812
812
|
{ shaderLocation: 0, offset: 0, format: "float32x3" },
|
|
@@ -817,7 +817,7 @@ const AA = class _ {
|
|
|
817
817
|
"none"
|
|
818
818
|
), this.createTexturedPipeline(
|
|
819
819
|
"svga-batch-premul:test",
|
|
820
|
-
|
|
820
|
+
nA.svgaBatchPremul,
|
|
821
821
|
A,
|
|
822
822
|
[
|
|
823
823
|
{ shaderLocation: 0, offset: 0, format: "float32x3" },
|
|
@@ -828,7 +828,7 @@ const AA = class _ {
|
|
|
828
828
|
"test"
|
|
829
829
|
), this.createClipMaskPipeline(g), this.createTexturedPipeline(
|
|
830
830
|
"vap:none",
|
|
831
|
-
|
|
831
|
+
nA.vap,
|
|
832
832
|
A,
|
|
833
833
|
[
|
|
834
834
|
{ shaderLocation: 0, offset: 0, format: "float32x2" },
|
|
@@ -839,7 +839,7 @@ const AA = class _ {
|
|
|
839
839
|
"none"
|
|
840
840
|
), this.createTexturedPipeline(
|
|
841
841
|
"vap-mix-overlay:none",
|
|
842
|
-
|
|
842
|
+
nA.vapMixOverlay,
|
|
843
843
|
I,
|
|
844
844
|
[
|
|
845
845
|
{ shaderLocation: 0, offset: 0, format: "float32x2" },
|
|
@@ -850,7 +850,7 @@ const AA = class _ {
|
|
|
850
850
|
2
|
|
851
851
|
), this.createTexturedPipeline(
|
|
852
852
|
"alpha-video:none",
|
|
853
|
-
|
|
853
|
+
nA.alphaVideo,
|
|
854
854
|
A,
|
|
855
855
|
[
|
|
856
856
|
{ shaderLocation: 0, offset: 0, format: "float32x2" },
|
|
@@ -860,7 +860,7 @@ const AA = class _ {
|
|
|
860
860
|
"none"
|
|
861
861
|
), this.createTexturedPipeline(
|
|
862
862
|
"rgba-textured:none",
|
|
863
|
-
|
|
863
|
+
nA.rgbaTextured,
|
|
864
864
|
A,
|
|
865
865
|
[
|
|
866
866
|
{ shaderLocation: 0, offset: 0, format: "float32x2" },
|
|
@@ -885,7 +885,7 @@ const AA = class _ {
|
|
|
885
885
|
ensureInstancedSvgaPipeline(A = "none") {
|
|
886
886
|
const I = `svga-instanced-premul:${A}`;
|
|
887
887
|
let g = this.pipelines.get(I);
|
|
888
|
-
return g || (this.createInstancedSvgaPipeline(I,
|
|
888
|
+
return g || (this.createInstancedSvgaPipeline(I, nA.svgaInstancedPremul, A), g = this.pipelines.get(I)), g;
|
|
889
889
|
}
|
|
890
890
|
ensureInstancedAlphaPipeline() {
|
|
891
891
|
const A = "alpha-video-instanced:none";
|
|
@@ -1004,7 +1004,7 @@ const AA = class _ {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
]
|
|
1007
|
-
}), Q = this.instancedTextureBindGroupLayout, C = this.device.createShaderModule({ code:
|
|
1007
|
+
}), Q = this.instancedTextureBindGroupLayout, C = this.device.createShaderModule({ code: nA.vapInstanced }), E = {
|
|
1008
1008
|
format: "depth24plus-stencil8",
|
|
1009
1009
|
depthWriteEnabled: !1,
|
|
1010
1010
|
depthCompare: "always",
|
|
@@ -1088,7 +1088,7 @@ const AA = class _ {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
1090
|
]
|
|
1091
|
-
}), Q = this.instancedTextureBindGroupLayout, C = this.device.createShaderModule({ code:
|
|
1091
|
+
}), Q = this.instancedTextureBindGroupLayout, C = this.device.createShaderModule({ code: nA.alphaVideoInstanced }), E = {
|
|
1092
1092
|
format: "depth24plus-stencil8",
|
|
1093
1093
|
depthWriteEnabled: !1,
|
|
1094
1094
|
depthCompare: "always",
|
|
@@ -1201,7 +1201,7 @@ const AA = class _ {
|
|
|
1201
1201
|
this.pipelines.set(A, { pipeline: a, bindGroupLayout: g, textureCount: o });
|
|
1202
1202
|
}
|
|
1203
1203
|
createClipMaskPipeline(A) {
|
|
1204
|
-
const I = this.device.createShaderModule({ code:
|
|
1204
|
+
const I = this.device.createShaderModule({ code: nA.clipMask }), g = this.device.createRenderPipeline({
|
|
1205
1205
|
layout: this.device.createPipelineLayout({ bindGroupLayouts: [A] }),
|
|
1206
1206
|
vertex: {
|
|
1207
1207
|
module: I,
|
|
@@ -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);
|
|
@@ -1810,7 +1810,7 @@ function AB(B, A, I) {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
return g;
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1813
|
+
function GA(B, A, I) {
|
|
1814
1814
|
const g = AB(B, B.VERTEX_SHADER, A), Q = AB(B, B.FRAGMENT_SHADER, I), C = B.createProgram();
|
|
1815
1815
|
if (!C)
|
|
1816
1816
|
throw B.deleteShader(g), B.deleteShader(Q), new Error("Failed to create program");
|
|
@@ -1839,7 +1839,7 @@ function rI(B) {
|
|
|
1839
1839
|
return typeof A.displayHeight == "number" && A.displayHeight > 0 ? A.displayHeight : typeof A.codedHeight == "number" && A.codedHeight > 0 ? A.codedHeight : typeof A.videoHeight == "number" && A.videoHeight > 0 ? A.videoHeight : typeof A.naturalHeight == "number" && A.naturalHeight > 0 ? A.naturalHeight : typeof A.height == "number" && A.height > 0 ? A.height : 0;
|
|
1840
1840
|
}
|
|
1841
1841
|
var nC = Object.defineProperty, rC = (B, A, I) => A in B ? nC(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, m = (B, A, I) => rC(B, typeof A != "symbol" ? A + "" : A, I);
|
|
1842
|
-
const
|
|
1842
|
+
const FA = class fA {
|
|
1843
1843
|
constructor(A, I = !0) {
|
|
1844
1844
|
m(this, "type", "webgl2"), m(this, "canvas"), m(this, "maxTextureSize", 4096), m(this, "antialias"), m(this, "gl"), m(this, "nextId", 1), m(this, "buffers", /* @__PURE__ */ new Map()), m(this, "textures", /* @__PURE__ */ new Map()), m(this, "programs", /* @__PURE__ */ new Map()), m(this, "vertexArrays", /* @__PURE__ */ new Map()), m(this, "cachedDrawProgram", null), m(this, "cachedTex0Id", null), m(this, "cachedProjectionRef", null), m(this, "cachedProjectionShader", null), m(this, "videoUploadCanvas", null), m(this, "videoUploadCtx", null), m(this, "videoElementPreferCanvasBridge", wC()), m(this, "videoElementDirectUploadValidated", !1), m(this, "instancedSvgaInstanceGLBuffer", null), m(this, "instancedAlphaInstanceGLBuffer", null), m(this, "instancedVapInstanceGLBuffer", null), this.canvas = A, this.antialias = I;
|
|
1845
1845
|
}
|
|
@@ -1857,12 +1857,12 @@ const rA = class JA {
|
|
|
1857
1857
|
this.gl = A, this.maxTextureSize = A.getParameter(A.MAX_TEXTURE_SIZE) || this.maxTextureSize, A.enable(A.BLEND), A.blendFunc(A.ONE, A.ONE_MINUS_SRC_ALPHA), A.clearColor(0, 0, 0, 0), A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), A.pixelStorei(A.UNPACK_COLORSPACE_CONVERSION_WEBGL, A.NONE), this.initPrograms();
|
|
1858
1858
|
}
|
|
1859
1859
|
initPrograms() {
|
|
1860
|
-
const A = this.gl, I =
|
|
1860
|
+
const A = this.gl, I = GA(A, p.svgaBatchPremul.vert, p.svgaBatchPremul.frag);
|
|
1861
1861
|
this.programs.set("svga-batch-premul", {
|
|
1862
1862
|
program: I,
|
|
1863
1863
|
uniforms: this.getUniforms(I, ["u_projection", "u_atlas"])
|
|
1864
1864
|
});
|
|
1865
|
-
const g =
|
|
1865
|
+
const g = GA(
|
|
1866
1866
|
A,
|
|
1867
1867
|
p.svgaInstancedPremul.vert,
|
|
1868
1868
|
p.svgaInstancedPremul.frag
|
|
@@ -1871,7 +1871,7 @@ const rA = class JA {
|
|
|
1871
1871
|
program: g,
|
|
1872
1872
|
uniforms: this.getUniforms(g, ["u_projection", "u_atlas"])
|
|
1873
1873
|
});
|
|
1874
|
-
const Q =
|
|
1874
|
+
const Q = GA(A, p.vap.vert, p.vap.frag);
|
|
1875
1875
|
this.programs.set("vap", {
|
|
1876
1876
|
program: Q,
|
|
1877
1877
|
uniforms: this.getUniforms(Q, [
|
|
@@ -1883,7 +1883,7 @@ const rA = class JA {
|
|
|
1883
1883
|
"u_rgbPremultiplied"
|
|
1884
1884
|
])
|
|
1885
1885
|
});
|
|
1886
|
-
const C =
|
|
1886
|
+
const C = GA(A, p.vapMixOverlay.vert, p.vapMixOverlay.frag);
|
|
1887
1887
|
this.programs.set("vap-mix-overlay", {
|
|
1888
1888
|
program: C,
|
|
1889
1889
|
uniforms: this.getUniforms(C, [
|
|
@@ -1895,7 +1895,7 @@ const rA = class JA {
|
|
|
1895
1895
|
"u_opacity"
|
|
1896
1896
|
])
|
|
1897
1897
|
});
|
|
1898
|
-
const E =
|
|
1898
|
+
const E = GA(A, p.alphaVideo.vert, p.alphaVideo.frag);
|
|
1899
1899
|
this.programs.set("alpha-video", {
|
|
1900
1900
|
program: E,
|
|
1901
1901
|
uniforms: this.getUniforms(E, [
|
|
@@ -1907,7 +1907,7 @@ const rA = class JA {
|
|
|
1907
1907
|
"u_rgbPremultiplied"
|
|
1908
1908
|
])
|
|
1909
1909
|
});
|
|
1910
|
-
const o =
|
|
1910
|
+
const o = GA(A, p.rgbaTextured.vert, p.rgbaTextured.frag);
|
|
1911
1911
|
this.programs.set("rgba-textured", {
|
|
1912
1912
|
program: o,
|
|
1913
1913
|
uniforms: this.getUniforms(o, [
|
|
@@ -1918,7 +1918,7 @@ const rA = class JA {
|
|
|
1918
1918
|
"u_opacity"
|
|
1919
1919
|
])
|
|
1920
1920
|
});
|
|
1921
|
-
const i =
|
|
1921
|
+
const i = GA(
|
|
1922
1922
|
A,
|
|
1923
1923
|
p.alphaVideoInstanced.vert,
|
|
1924
1924
|
p.alphaVideoInstanced.frag
|
|
@@ -1927,12 +1927,12 @@ const rA = class JA {
|
|
|
1927
1927
|
program: i,
|
|
1928
1928
|
uniforms: this.getUniforms(i, ["u_projection", "u_video"])
|
|
1929
1929
|
});
|
|
1930
|
-
const e =
|
|
1930
|
+
const e = GA(A, p.vapInstanced.vert, p.vapInstanced.frag);
|
|
1931
1931
|
this.programs.set("vap-instanced", {
|
|
1932
1932
|
program: e,
|
|
1933
1933
|
uniforms: this.getUniforms(e, ["u_projection", "u_video"])
|
|
1934
1934
|
});
|
|
1935
|
-
const a =
|
|
1935
|
+
const a = GA(A, p.clipMask.vert, p.clipMask.frag);
|
|
1936
1936
|
this.programs.set("clip-mask", {
|
|
1937
1937
|
program: a,
|
|
1938
1938
|
uniforms: this.getUniforms(a, ["u_projection", "u_transform"])
|
|
@@ -2197,7 +2197,7 @@ const rA = class JA {
|
|
|
2197
2197
|
if (!this.instancedSvgaInstanceGLBuffer) {
|
|
2198
2198
|
const I = A.createBuffer();
|
|
2199
2199
|
if (!I) throw new Error("createBuffer failed");
|
|
2200
|
-
A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, I), A.bufferData(A.ARRAY_BUFFER,
|
|
2200
|
+
A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, I), A.bufferData(A.ARRAY_BUFFER, fA.INST_SVGA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedSvgaInstanceGLBuffer = I;
|
|
2201
2201
|
}
|
|
2202
2202
|
return this.instancedSvgaInstanceGLBuffer;
|
|
2203
2203
|
}
|
|
@@ -2205,7 +2205,7 @@ const rA = class JA {
|
|
|
2205
2205
|
var I, g;
|
|
2206
2206
|
const Q = this.gl, C = (I = A.instanceCount) != null ? I : 0, E = A.instanceData;
|
|
2207
2207
|
if (C < 1 || !E || E.length < C * 13) return;
|
|
2208
|
-
if (C >
|
|
2208
|
+
if (C > fA.INST_SVGA_GL_MAX) {
|
|
2209
2209
|
console.warn("[WebGL2] svga-instanced-premul: instanceCount exceeds max", C);
|
|
2210
2210
|
return;
|
|
2211
2211
|
}
|
|
@@ -2242,7 +2242,7 @@ const rA = class JA {
|
|
|
2242
2242
|
if (!this.instancedAlphaInstanceGLBuffer) {
|
|
2243
2243
|
const I = A.createBuffer();
|
|
2244
2244
|
if (!I) throw new Error("createBuffer failed");
|
|
2245
|
-
A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, I), A.bufferData(A.ARRAY_BUFFER,
|
|
2245
|
+
A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, I), A.bufferData(A.ARRAY_BUFFER, fA.INST_ALPHA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedAlphaInstanceGLBuffer = I;
|
|
2246
2246
|
}
|
|
2247
2247
|
return this.instancedAlphaInstanceGLBuffer;
|
|
2248
2248
|
}
|
|
@@ -2250,7 +2250,7 @@ const rA = class JA {
|
|
|
2250
2250
|
var I;
|
|
2251
2251
|
const g = this.gl, Q = (I = A.instanceCount) != null ? I : 0, C = A.instanceData;
|
|
2252
2252
|
if (Q < 1 || !C || C.length < Q * 12) return;
|
|
2253
|
-
if (Q >
|
|
2253
|
+
if (Q > fA.INST_ALPHA_GL_MAX) {
|
|
2254
2254
|
console.warn("[WebGL2] alpha-video-instanced: instanceCount exceeds max", Q);
|
|
2255
2255
|
return;
|
|
2256
2256
|
}
|
|
@@ -2296,7 +2296,7 @@ const rA = class JA {
|
|
|
2296
2296
|
if (!this.instancedVapInstanceGLBuffer) {
|
|
2297
2297
|
const I = A.createBuffer();
|
|
2298
2298
|
if (!I) throw new Error("createBuffer failed");
|
|
2299
|
-
A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, I), A.bufferData(A.ARRAY_BUFFER,
|
|
2299
|
+
A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, I), A.bufferData(A.ARRAY_BUFFER, fA.INST_VAP_GL_BYTES, A.DYNAMIC_DRAW), this.instancedVapInstanceGLBuffer = I;
|
|
2300
2300
|
}
|
|
2301
2301
|
return this.instancedVapInstanceGLBuffer;
|
|
2302
2302
|
}
|
|
@@ -2304,7 +2304,7 @@ const rA = class JA {
|
|
|
2304
2304
|
var I;
|
|
2305
2305
|
const g = this.gl, Q = (I = A.instanceCount) != null ? I : 0, C = A.instanceData;
|
|
2306
2306
|
if (Q < 1 || !C || C.length < Q * 32) return;
|
|
2307
|
-
if (Q >
|
|
2307
|
+
if (Q > fA.INST_VAP_GL_MAX) {
|
|
2308
2308
|
console.warn("[WebGL2] vap-instanced: instanceCount exceeds max", Q);
|
|
2309
2309
|
return;
|
|
2310
2310
|
}
|
|
@@ -2356,13 +2356,13 @@ const rA = class JA {
|
|
|
2356
2356
|
I == null || I.loseContext();
|
|
2357
2357
|
}
|
|
2358
2358
|
};
|
|
2359
|
-
m(
|
|
2360
|
-
m(
|
|
2361
|
-
m(
|
|
2362
|
-
m(
|
|
2363
|
-
m(
|
|
2364
|
-
m(
|
|
2365
|
-
let cC =
|
|
2359
|
+
m(FA, "INST_SVGA_GL_MAX", 2048);
|
|
2360
|
+
m(FA, "INST_SVGA_GL_BYTES", FA.INST_SVGA_GL_MAX * 52);
|
|
2361
|
+
m(FA, "INST_ALPHA_GL_MAX", 1024);
|
|
2362
|
+
m(FA, "INST_ALPHA_GL_BYTES", FA.INST_ALPHA_GL_MAX * 48);
|
|
2363
|
+
m(FA, "INST_VAP_GL_MAX", 1024);
|
|
2364
|
+
m(FA, "INST_VAP_GL_BYTES", FA.INST_VAP_GL_MAX * 128);
|
|
2365
|
+
let cC = FA;
|
|
2366
2366
|
var FC = Object.defineProperty, GC = (B, A, I) => A in B ? FC(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, P = (B, A, I) => GC(B, typeof A != "symbol" ? A + "" : A, I);
|
|
2367
2367
|
function RC(B, A) {
|
|
2368
2368
|
let I = B.replace(/^#version\s+300\s+es\s*/m, "");
|
|
@@ -2790,7 +2790,7 @@ function dg(B) {
|
|
|
2790
2790
|
sy: B.height / Math.max(1, I)
|
|
2791
2791
|
};
|
|
2792
2792
|
}
|
|
2793
|
-
const UC = 9,
|
|
2793
|
+
const UC = 9, HA = 13, cA = 9, vA = 4, iI = 6, xg = 9, YC = { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 };
|
|
2794
2794
|
function dC(B, A, I) {
|
|
2795
2795
|
return (B * I + A) * xg;
|
|
2796
2796
|
}
|
|
@@ -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,23 +2859,23 @@ 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
|
-
const g = Math.floor(B.length /
|
|
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 *
|
|
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] =
|
|
2872
|
-
const u = d +
|
|
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] =
|
|
2874
|
-
const K = d + 2 *
|
|
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] =
|
|
2876
|
-
const x = d + 3 *
|
|
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] =
|
|
2878
|
-
const X = o * iI, gA = 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], 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
|
+
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] = n, A[u + 7] = G, A[u + 8] = F;
|
|
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] = n, A[K + 7] = G, A[K + 8] = M;
|
|
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] = n, A[x + 7] = c, A[x + 8] = M;
|
|
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
|
}
|
|
2881
2881
|
return E;
|
|
@@ -2985,11 +2985,11 @@ function xC(B, A) {
|
|
|
2985
2985
|
return B = B >>> 0, AQ().subarray(B / 4, B / 4 + A);
|
|
2986
2986
|
}
|
|
2987
2987
|
function _I(B, A) {
|
|
2988
|
-
return B = B >>> 0,
|
|
2988
|
+
return B = B >>> 0, XA().subarray(B / 1, B / 1 + A);
|
|
2989
2989
|
}
|
|
2990
|
-
let
|
|
2990
|
+
let uA = null;
|
|
2991
2991
|
function CB() {
|
|
2992
|
-
return (
|
|
2992
|
+
return (uA === null || uA.buffer.detached === !0 || uA.buffer.detached === void 0 && uA.buffer !== J.memory.buffer) && (uA = new DataView(J.memory.buffer)), uA;
|
|
2993
2993
|
}
|
|
2994
2994
|
let II = null;
|
|
2995
2995
|
function bC() {
|
|
@@ -3007,7 +3007,7 @@ function AQ() {
|
|
|
3007
3007
|
return (BI === null || BI.byteLength === 0) && (BI = new Uint32Array(J.memory.buffer)), BI;
|
|
3008
3008
|
}
|
|
3009
3009
|
let QI = null;
|
|
3010
|
-
function
|
|
3010
|
+
function XA() {
|
|
3011
3011
|
return (QI === null || QI.byteLength === 0) && (QI = new Uint8Array(J.memory.buffer)), QI;
|
|
3012
3012
|
}
|
|
3013
3013
|
function IQ(B, A) {
|
|
@@ -3016,7 +3016,7 @@ function IQ(B, A) {
|
|
|
3016
3016
|
}
|
|
3017
3017
|
function $I(B, A) {
|
|
3018
3018
|
const I = A(B.length * 1, 1) >>> 0;
|
|
3019
|
-
return
|
|
3019
|
+
return XA().set(B, I / 1), IA = B.length, I;
|
|
3020
3020
|
}
|
|
3021
3021
|
function EB(B, A) {
|
|
3022
3022
|
const I = A(B.length * 4, 4) >>> 0;
|
|
@@ -3029,10 +3029,10 @@ function WC(B, A) {
|
|
|
3029
3029
|
function ZC(B, A, I) {
|
|
3030
3030
|
if (I === void 0) {
|
|
3031
3031
|
const o = oI.encode(B), i = A(o.length, 1) >>> 0;
|
|
3032
|
-
return
|
|
3032
|
+
return XA().subarray(i, i + o.length).set(o), IA = o.length, i;
|
|
3033
3033
|
}
|
|
3034
3034
|
let g = B.length, Q = A(g, 1) >>> 0;
|
|
3035
|
-
const C =
|
|
3035
|
+
const C = XA();
|
|
3036
3036
|
let E = 0;
|
|
3037
3037
|
for (; E < g; E++) {
|
|
3038
3038
|
const o = B.charCodeAt(E);
|
|
@@ -3041,7 +3041,7 @@ function ZC(B, A, I) {
|
|
|
3041
3041
|
}
|
|
3042
3042
|
if (E !== g) {
|
|
3043
3043
|
E !== 0 && (B = B.slice(E)), Q = I(Q, g, g = E + B.length * 3, 1) >>> 0;
|
|
3044
|
-
const o =
|
|
3044
|
+
const o = XA().subarray(Q + E, Q + g), i = oI.encodeInto(B, o);
|
|
3045
3045
|
E += i.written, Q = I(Q, g, E, 1) >>> 0;
|
|
3046
3046
|
}
|
|
3047
3047
|
return IA = E, Q;
|
|
@@ -3055,7 +3055,7 @@ mI.decode();
|
|
|
3055
3055
|
const VC = 2146435072;
|
|
3056
3056
|
let Qg = 0;
|
|
3057
3057
|
function vC(B, A) {
|
|
3058
|
-
return Qg += A, Qg >= VC && (mI = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), mI.decode(), Qg = A), mI.decode(
|
|
3058
|
+
return Qg += A, Qg >= VC && (mI = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), mI.decode(), Qg = A), mI.decode(XA().subarray(B, B + A));
|
|
3059
3059
|
}
|
|
3060
3060
|
const oI = new TextEncoder();
|
|
3061
3061
|
"encodeInto" in oI || (oI.encodeInto = function(B, A) {
|
|
@@ -3067,7 +3067,7 @@ const oI = new TextEncoder();
|
|
|
3067
3067
|
});
|
|
3068
3068
|
let IA = 0, J;
|
|
3069
3069
|
function gQ(B, A) {
|
|
3070
|
-
return J = B.exports,
|
|
3070
|
+
return J = B.exports, uA = null, II = null, gI = null, BI = null, QI = null, J.__wbindgen_start(), J;
|
|
3071
3071
|
}
|
|
3072
3072
|
async function XC(B, A) {
|
|
3073
3073
|
if (typeof Response == "function" && B instanceof Response) {
|
|
@@ -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
|
}
|
|
@@ -3357,11 +3357,11 @@ class eE {
|
|
|
3357
3357
|
this.floatPoolA = null, this.floatPoolB = null, this.uint32Pool = null;
|
|
3358
3358
|
}
|
|
3359
3359
|
}
|
|
3360
|
-
function
|
|
3360
|
+
function qA(B, A, I, g, Q, C) {
|
|
3361
3361
|
const E = 1 / (B - A), o = 1 / (I - g), i = 1 / (Q - C), e = new Float32Array(16);
|
|
3362
3362
|
return e[0] = -2 * E, e[5] = -2 * o, e[10] = 2 * i, e[12] = (B + A) * E, e[13] = (g + I) * o, e[14] = (Q + C) * i, e[15] = 1, e;
|
|
3363
3363
|
}
|
|
3364
|
-
function
|
|
3364
|
+
function rA(B, A, I) {
|
|
3365
3365
|
return B + (A - B) * I;
|
|
3366
3366
|
}
|
|
3367
3367
|
function og(B, A, I) {
|
|
@@ -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
|
}
|
|
@@ -3532,11 +3532,11 @@ function wE(B, A, I, g) {
|
|
|
3532
3532
|
function eg(B, A, I) {
|
|
3533
3533
|
return (B.x - I.x) * (A.y - I.y) - (A.x - I.x) * (B.y - I.y);
|
|
3534
3534
|
}
|
|
3535
|
-
function
|
|
3535
|
+
function DA(B) {
|
|
3536
3536
|
var A;
|
|
3537
3537
|
return (A = B.options.objectFit) != null ? A : "contain";
|
|
3538
3538
|
}
|
|
3539
|
-
function
|
|
3539
|
+
function dA(B, A, I, g) {
|
|
3540
3540
|
const Q = g != null ? g : {
|
|
3541
3541
|
scaleX: 1,
|
|
3542
3542
|
scaleY: 1,
|
|
@@ -3544,7 +3544,7 @@ function UA(B, A, I, g) {
|
|
|
3544
3544
|
height: 0,
|
|
3545
3545
|
offsetX: 0,
|
|
3546
3546
|
offsetY: 0
|
|
3547
|
-
}, C = B.width * B.scale, E = B.height * B.scale, o =
|
|
3547
|
+
}, C = B.width * B.scale, E = B.height * B.scale, o = DA(B);
|
|
3548
3548
|
if (!(A > 0) || !(I > 0))
|
|
3549
3549
|
return Q.scaleX = 1, Q.scaleY = 1, Q.width = C, Q.height = E, Q.offsetX = 0, Q.offsetY = 0, Q;
|
|
3550
3550
|
if (o === "fill")
|
|
@@ -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;
|
|
@@ -4548,8 +4548,8 @@ function $(B = "Operation aborted") {
|
|
|
4548
4548
|
const A = new Error(B);
|
|
4549
4549
|
return A.name = "AbortError", A;
|
|
4550
4550
|
}
|
|
4551
|
-
function
|
|
4552
|
-
return B instanceof Error ? B.name === "AbortError" ? !0 : "cause" in B &&
|
|
4551
|
+
function JA(B) {
|
|
4552
|
+
return B instanceof Error ? B.name === "AbortError" ? !0 : "cause" in B && JA(B.cause) : !1;
|
|
4553
4553
|
}
|
|
4554
4554
|
function Y(B, A) {
|
|
4555
4555
|
if (B != null && B.aborted) throw $(A);
|
|
@@ -4744,7 +4744,7 @@ class XE {
|
|
|
4744
4744
|
}
|
|
4745
4745
|
}
|
|
4746
4746
|
const tg = new XE();
|
|
4747
|
-
function
|
|
4747
|
+
function CA(B = {}) {
|
|
4748
4748
|
return {
|
|
4749
4749
|
get budgetMs() {
|
|
4750
4750
|
return tg.budgetMs(B);
|
|
@@ -4772,7 +4772,7 @@ function Zg(B, A = { x: 0, y: 0 }) {
|
|
|
4772
4772
|
const I = B.options.transformOrigin;
|
|
4773
4773
|
return A.x = B.x + sB(I == null ? void 0 : I.x, B.width, B.options.width) * B.scale, A.y = B.y + sB(I == null ? void 0 : I.y, B.height, B.options.height) * B.scale, A;
|
|
4774
4774
|
}
|
|
4775
|
-
function
|
|
4775
|
+
function ZA(B, A, I, g, Q, C) {
|
|
4776
4776
|
const E = B.rotation || 0, o = Math.cos(E), i = Math.sin(E), e = Zg(B), a = A - e.x, t = I - e.y;
|
|
4777
4777
|
return C[0] = o * g, C[1] = i * g, C[2] = 0, C[3] = 0, C[4] = -i * Q, C[5] = o * Q, C[6] = 0, C[7] = 0, C[8] = 0, C[9] = 0, C[10] = 1, C[11] = 0, C[12] = e.x + o * a - i * t, C[13] = e.y + i * a + o * t, C[14] = 0, C[15] = 1, C;
|
|
4778
4778
|
}
|
|
@@ -4783,7 +4783,7 @@ function OE(B, A, I = A) {
|
|
|
4783
4783
|
const Q = Math.cos(g), C = Math.sin(g), E = Zg(B), { a: o, b: i, c: e, d: a, tx: t, ty: s } = A, D = t - E.x, h = s - E.y;
|
|
4784
4784
|
return I.a = Q * o - C * i, I.b = C * o + Q * i, I.c = Q * e - C * a, I.d = C * e + Q * a, I.tx = E.x + Q * D - C * h, I.ty = E.y + C * D + Q * h, I;
|
|
4785
4785
|
}
|
|
4786
|
-
function
|
|
4786
|
+
function pA(B, A, I, g, Q) {
|
|
4787
4787
|
const C = B.rotation || 0;
|
|
4788
4788
|
if (C === 0) return { x: A, y: I, w: g, h: Q };
|
|
4789
4789
|
const E = Math.cos(C), o = Math.sin(C), i = Zg(B), e = [
|
|
@@ -4794,15 +4794,15 @@ function qA(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
|
}
|
|
4802
|
-
var jE = Object.defineProperty, PE = (B, A, I) => A in B ? jE(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
4802
|
+
var jE = Object.defineProperty, PE = (B, A, I) => A in B ? jE(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, q = (B, A, I) => PE(B, typeof A != "symbol" ? A + "" : A, I);
|
|
4803
4803
|
const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
4804
4804
|
constructor() {
|
|
4805
|
-
|
|
4805
|
+
q(this, "pool", new eE()), q(this, "vertexBufHandles", []), q(this, "indexBufHandles", []), q(this, "clipSpriteVertBufHandles", []), q(this, "clipSpriteIdxBufHandles", []), q(this, "batchDrawCursor", 0), q(this, "clipSpriteDrawCursor", 0), q(this, "canvasWidth", 0), q(this, "canvasHeight", 0), q(this, "projCacheW", 0), q(this, "projCacheH", 0), q(this, "projCache", null), q(this, "clipMeshCache", /* @__PURE__ */ new Map()), q(this, "clipMeshesWithBuffers", /* @__PURE__ */ new Set()), q(this, "clipFrameDataScratch", new Float32Array(HA)), q(this, "instancedFrameDataScratch", new Float32Array(sg * HA)), q(this, "clipSpriteVertsScratch", null), q(this, "clipSpriteIndicesScratch", null), q(this, "shapeVertsScratch", null), q(this, "instancedQuadVB", null), q(this, "instancedQuadIB", null), q(this, "whiteTexture", null), q(this, "shapeMeshCache", /* @__PURE__ */ new WeakMap()), q(this, "clipTransformMat", new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), q(this, "slotScissor", { x: 0, y: 0, w: 0, h: 0 }), q(this, "spriteWorkPool", []), q(this, "spriteWorkCursor", 0), q(this, "batchSpritesScratch", []), q(this, "drawGroupScratch", []), q(this, "entityHasShapesCache", /* @__PURE__ */ new WeakMap()), q(this, "affineScratch", { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 });
|
|
4806
4806
|
}
|
|
4807
4807
|
beginFrame(A) {
|
|
4808
4808
|
this.batchDrawCursor = 0, this.clipSpriteDrawCursor = 0;
|
|
@@ -4841,10 +4841,10 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
4841
4841
|
this.clipMeshCache.set(D, (Q = s.get(D)) != null ? Q : null);
|
|
4842
4842
|
return i.length;
|
|
4843
4843
|
} catch (s) {
|
|
4844
|
-
if (
|
|
4844
|
+
if (JA(s)) throw s;
|
|
4845
4845
|
console.warn("[GiftStage:SVGA] clip mesh worker failed, using main thread", s);
|
|
4846
4846
|
}
|
|
4847
|
-
const a =
|
|
4847
|
+
const a = CA({
|
|
4848
4848
|
maxBudgetMs: Math.max(1, (C = I.frameBudgetMs) != null ? C : 8)
|
|
4849
4849
|
});
|
|
4850
4850
|
let t = 0;
|
|
@@ -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 =
|
|
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 =
|
|
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;
|
|
@@ -4946,7 +4946,7 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
4946
4946
|
this.spriteWorkCursor = 0;
|
|
4947
4947
|
}
|
|
4948
4948
|
getProjection() {
|
|
4949
|
-
return this.projCache && this.projCacheW === this.canvasWidth && this.projCacheH === this.canvasHeight ? this.projCache : (this.projCacheW = this.canvasWidth, this.projCacheH = this.canvasHeight, this.projCache =
|
|
4949
|
+
return this.projCache && this.projCacheW === this.canvasWidth && this.projCacheH === this.canvasHeight ? this.projCache : (this.projCacheW = this.canvasWidth, this.projCacheH = this.canvasHeight, this.projCache = qA(0, this.canvasWidth, this.canvasHeight, 0, -1, 1), this.projCache);
|
|
4950
4950
|
}
|
|
4951
4951
|
drawBatch(A, I, g, Q) {
|
|
4952
4952
|
const C = Math.min(I.length, sg);
|
|
@@ -4955,16 +4955,16 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
4955
4955
|
this.drawBatchInstancedWebGL(A, I, C, g, Q);
|
|
4956
4956
|
return;
|
|
4957
4957
|
}
|
|
4958
|
-
const E = this.pool.getFloat32(C *
|
|
4959
|
-
for (let
|
|
4960
|
-
this.packFrameData(E,
|
|
4961
|
-
const o = C *
|
|
4958
|
+
const E = this.pool.getFloat32(C * HA);
|
|
4959
|
+
for (let n = 0; n < C; n++)
|
|
4960
|
+
this.packFrameData(E, n, I[n]);
|
|
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,
|
|
@@ -5028,7 +5028,7 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5028
5028
|
}
|
|
5029
5029
|
const l = this.clipFrameDataScratch;
|
|
5030
5030
|
this.packFrameData(l, 0, I);
|
|
5031
|
-
const f =
|
|
5031
|
+
const f = vA * cA, d = iI;
|
|
5032
5032
|
(!this.clipSpriteVertsScratch || this.clipSpriteVertsScratch.length < f) && (this.clipSpriteVertsScratch = new Float32Array(f)), (!this.clipSpriteIndicesScratch || this.clipSpriteIndicesScratch.length < d) && (this.clipSpriteIndicesScratch = new Uint32Array(d));
|
|
5033
5033
|
const u = this.clipSpriteVertsScratch, K = this.clipSpriteIndicesScratch;
|
|
5034
5034
|
(!eI() || Eg(l, u, K) === null) && gg(l, u, K);
|
|
@@ -5040,7 +5040,7 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5040
5040
|
A,
|
|
5041
5041
|
x,
|
|
5042
5042
|
K.subarray(0, d)
|
|
5043
|
-
),
|
|
5043
|
+
), LA = {
|
|
5044
5044
|
shader: "svga-batch-premul",
|
|
5045
5045
|
vertexBuffer: X,
|
|
5046
5046
|
indexBuffer: gA,
|
|
@@ -5049,7 +5049,7 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5049
5049
|
uniforms: { u_projection: Q, u_atlas: 0 },
|
|
5050
5050
|
stencil: "test"
|
|
5051
5051
|
};
|
|
5052
|
-
A.draw(
|
|
5052
|
+
A.draw(LA), this.clearClipStencil(A, g, N, U, Q);
|
|
5053
5053
|
}
|
|
5054
5054
|
/** Rect clip in canvas space intersected with the slot scissor. Returns false when fully clipped. */
|
|
5055
5055
|
applyClipRectScissor(A, I, g, Q, C, E) {
|
|
@@ -5088,7 +5088,7 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5088
5088
|
}
|
|
5089
5089
|
const Q = this.clipFrameDataScratch;
|
|
5090
5090
|
this.packFrameData(Q, 0, I);
|
|
5091
|
-
const C =
|
|
5091
|
+
const C = vA * cA, E = iI;
|
|
5092
5092
|
(!this.clipSpriteVertsScratch || this.clipSpriteVertsScratch.length < C) && (this.clipSpriteVertsScratch = new Float32Array(C)), (!this.clipSpriteIndicesScratch || this.clipSpriteIndicesScratch.length < E) && (this.clipSpriteIndicesScratch = new Uint32Array(E));
|
|
5093
5093
|
const o = this.clipSpriteVertsScratch, i = this.clipSpriteIndicesScratch;
|
|
5094
5094
|
(!eI() || Eg(Q, o, i) === null) && gg(Q, o, i);
|
|
@@ -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
|
-
const
|
|
5133
|
-
G = w.logicalWidth, M = w.logicalHeight, y = Math.max(0, (
|
|
5132
|
+
const LA = C || w.logicalWidth, W = E || w.logicalHeight;
|
|
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 *
|
|
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
|
-
), { a: y, b: R, c: S, d: N, tx: U, ty: L } = M, l = o.vertices, f = l.length / 6 *
|
|
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
|
-
for (let W = 0,
|
|
5171
|
-
const kI = l[W],
|
|
5172
|
-
d[
|
|
5170
|
+
for (let W = 0, eA = 0; W < l.length; W += 6, eA += cA) {
|
|
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] * 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) {
|
|
@@ -5195,11 +5195,11 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5195
5195
|
A,
|
|
5196
5196
|
X,
|
|
5197
5197
|
d.subarray(0, f)
|
|
5198
|
-
),
|
|
5198
|
+
), LA = this.ensureClipSpriteIndexBuffer(A, X, o.indices);
|
|
5199
5199
|
A.draw({
|
|
5200
5200
|
shader: "svga-batch-premul",
|
|
5201
5201
|
vertexBuffer: gA,
|
|
5202
|
-
indexBuffer:
|
|
5202
|
+
indexBuffer: LA,
|
|
5203
5203
|
indexCount: o.indices.length,
|
|
5204
5204
|
textures: [G],
|
|
5205
5205
|
uniforms: { u_projection: C, u_atlas: 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) {
|
|
@@ -5381,8 +5381,8 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
|
|
|
5381
5381
|
this.clipMeshesWithBuffers.clear(), this.instancedQuadVB && A.deleteBuffer(this.instancedQuadVB), this.instancedQuadIB && A.deleteBuffer(this.instancedQuadIB), this.whiteTexture && A.deleteTexture(this.whiteTexture), this.pool.destroy(), this.clipMeshCache.clear(), this.vertexBufHandles = [], this.indexBufHandles = [], this.clipSpriteVertBufHandles = [], this.clipSpriteIdxBufHandles = [], this.instancedQuadVB = null, this.instancedQuadIB = null, this.whiteTexture = null, this.projCache = null;
|
|
5382
5382
|
}
|
|
5383
5383
|
};
|
|
5384
|
-
|
|
5385
|
-
|
|
5384
|
+
q(Vg, "INSTANCED_QUAD_VERTS", new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]));
|
|
5385
|
+
q(Vg, "INSTANCED_QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
|
|
5386
5386
|
let zE = Vg;
|
|
5387
5387
|
const DB = 1e-4;
|
|
5388
5388
|
function hB(B, A, I, g) {
|
|
@@ -5401,17 +5401,17 @@ 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 };
|
|
5409
5409
|
}
|
|
5410
|
-
var $E = Object.defineProperty, Ai = (B, A, I) => A in B ? $E(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
5411
|
-
const Ii = 4, gi = 128 * 1024 * 1024, Bi = 2048 * 1024 * 1024, Qi = "gift-stage-resource-cache", Ci = 2,
|
|
5410
|
+
var $E = Object.defineProperty, Ai = (B, A, I) => A in B ? $E(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, tA = (B, A, I) => Ai(B, typeof A != "symbol" ? A + "" : A, I);
|
|
5411
|
+
const Ii = 4, gi = 128 * 1024 * 1024, Bi = 2048 * 1024 * 1024, Qi = "gift-stage-resource-cache", Ci = 2, EA = "resources", hg = "byUpdatedAt", Ei = 3e4;
|
|
5412
5412
|
class ii {
|
|
5413
5413
|
constructor(A) {
|
|
5414
|
-
|
|
5414
|
+
tA(this, "maxConcurrent"), tA(this, "active", 0), tA(this, "queue", []), this.maxConcurrent = Math.max(1, A);
|
|
5415
5415
|
}
|
|
5416
5416
|
setMaxConcurrent(A) {
|
|
5417
5417
|
this.maxConcurrent = Math.max(1, A), this.drain();
|
|
@@ -5436,7 +5436,7 @@ class ii {
|
|
|
5436
5436
|
function oi() {
|
|
5437
5437
|
return typeof indexedDB != "undefined";
|
|
5438
5438
|
}
|
|
5439
|
-
function
|
|
5439
|
+
function MA(B) {
|
|
5440
5440
|
return B.length * 2;
|
|
5441
5441
|
}
|
|
5442
5442
|
function ei(B) {
|
|
@@ -5448,23 +5448,23 @@ function ei(B) {
|
|
|
5448
5448
|
for (const E of Object.values((A = B.images) != null ? A : {}))
|
|
5449
5449
|
Q += E.byteLength;
|
|
5450
5450
|
for (const E of (I = B.imageEntries) != null ? I : [])
|
|
5451
|
-
Q +=
|
|
5451
|
+
Q += MA(E.key) + 16;
|
|
5452
5452
|
for (const E of B.audios)
|
|
5453
|
-
Q +=
|
|
5453
|
+
Q += MA(E.audioKey) + 32;
|
|
5454
5454
|
const C = B.spriteTable;
|
|
5455
5455
|
Q += C.frameData.byteLength, Q += C.clipPathIndex.byteLength, Q += C.shapesIndex.byteLength;
|
|
5456
|
-
for (const E of C.imageKeys) Q +=
|
|
5457
|
-
for (const E of C.clipPaths) Q +=
|
|
5456
|
+
for (const E of C.imageKeys) Q += MA(E);
|
|
5457
|
+
for (const E of C.clipPaths) Q += MA(E);
|
|
5458
5458
|
for (const E of C.shapesTable)
|
|
5459
|
-
for (const o of E) Q +=
|
|
5459
|
+
for (const o of E) Q += MA((g = o.pathData) != null ? g : "") + 96;
|
|
5460
5460
|
return Q;
|
|
5461
5461
|
}
|
|
5462
5462
|
function wg(B) {
|
|
5463
|
-
return typeof B == "string" ?
|
|
5463
|
+
return typeof B == "string" ? MA(B) : B.byteLength;
|
|
5464
5464
|
}
|
|
5465
5465
|
class ai {
|
|
5466
5466
|
constructor() {
|
|
5467
|
-
|
|
5467
|
+
tA(this, "limiter", new ii(Ii)), tA(this, "pending", /* @__PURE__ */ new Map()), tA(this, "memory", /* @__PURE__ */ new Map()), tA(this, "memoryBytes", 0), tA(this, "maxMemoryBytes", gi), tA(this, "maxPersistentBytes", Bi), tA(this, "dbPromise", null), tA(this, "persistentTrimPromise", null);
|
|
5468
5468
|
}
|
|
5469
5469
|
configure(A) {
|
|
5470
5470
|
(A == null ? void 0 : A.maxConcurrent) != null && this.limiter.setMaxConcurrent(A.maxConcurrent), (A == null ? void 0 : A.maxMemoryBytes) != null && A.maxMemoryBytes > 0 && (this.maxMemoryBytes = A.maxMemoryBytes, this.trimMemory()), (A == null ? void 0 : A.maxPersistentBytes) != null && A.maxPersistentBytes > 0 && (this.maxPersistentBytes = A.maxPersistentBytes, this.schedulePersistentTrim());
|
|
@@ -5490,13 +5490,13 @@ class ai {
|
|
|
5490
5490
|
const g = `text:${A}`, Q = this.getMemory(g, "text");
|
|
5491
5491
|
if (Q != null) return Q;
|
|
5492
5492
|
const C = await this.getPersistent(g, "text");
|
|
5493
|
-
return C != null ? (this.setMemory(g, "text", C,
|
|
5493
|
+
return C != null ? (this.setMemory(g, "text", C, MA(C)), C) : this.getOrCreatePending(
|
|
5494
5494
|
g,
|
|
5495
5495
|
() => this.limiter.run(async () => {
|
|
5496
5496
|
const E = await fetch(A, { mode: "cors", signal: I });
|
|
5497
5497
|
if (!E.ok) throw new Error(`fetch failed ${E.status}`);
|
|
5498
5498
|
const o = await E.text();
|
|
5499
|
-
return this.setMemory(g, "text", o,
|
|
5499
|
+
return this.setMemory(g, "text", o, MA(o)), this.setPersistent(g, "text", o), o;
|
|
5500
5500
|
})
|
|
5501
5501
|
);
|
|
5502
5502
|
}
|
|
@@ -5504,7 +5504,7 @@ class ai {
|
|
|
5504
5504
|
const g = `json:${A}`, Q = this.getMemory(g, "json");
|
|
5505
5505
|
if (Q != null) return Q;
|
|
5506
5506
|
const C = await this.fetchText(A, I), E = JSON.parse(C);
|
|
5507
|
-
return this.setMemory(g, "json", E,
|
|
5507
|
+
return this.setMemory(g, "json", E, MA(C)), E;
|
|
5508
5508
|
}
|
|
5509
5509
|
getSVGAWorkerPayload(A) {
|
|
5510
5510
|
return this.getMemory(A, "svga-payload");
|
|
@@ -5564,7 +5564,7 @@ class ai {
|
|
|
5564
5564
|
I.onupgradeneeded = () => {
|
|
5565
5565
|
const g = I.result;
|
|
5566
5566
|
let Q;
|
|
5567
|
-
g.objectStoreNames.contains(
|
|
5567
|
+
g.objectStoreNames.contains(EA) ? Q = I.transaction.objectStore(EA) : Q = g.createObjectStore(EA, { keyPath: "key" }), Q.indexNames.contains(hg) || Q.createIndex(hg, "updatedAt", { unique: !1 });
|
|
5568
5568
|
}, I.onsuccess = () => A(I.result), I.onerror = () => A(null), I.onblocked = () => A(null);
|
|
5569
5569
|
} catch (I) {
|
|
5570
5570
|
A(null);
|
|
@@ -5575,9 +5575,9 @@ class ai {
|
|
|
5575
5575
|
const g = await this.openDb();
|
|
5576
5576
|
return g ? new Promise((Q) => {
|
|
5577
5577
|
try {
|
|
5578
|
-
const C = g.transaction(
|
|
5578
|
+
const C = g.transaction(EA, "readonly");
|
|
5579
5579
|
C.onerror = () => Q(null), C.onabort = () => Q(null);
|
|
5580
|
-
const o = C.objectStore(
|
|
5580
|
+
const o = C.objectStore(EA).get(A);
|
|
5581
5581
|
o.onsuccess = () => {
|
|
5582
5582
|
const i = o.result;
|
|
5583
5583
|
if (!i || i.kind !== I) {
|
|
@@ -5606,9 +5606,9 @@ class ai {
|
|
|
5606
5606
|
const C = wg(g);
|
|
5607
5607
|
await new Promise((E) => {
|
|
5608
5608
|
try {
|
|
5609
|
-
const o = Q.transaction(
|
|
5609
|
+
const o = Q.transaction(EA, "readwrite");
|
|
5610
5610
|
o.onerror = () => E(), o.onabort = () => E();
|
|
5611
|
-
const e = o.objectStore(
|
|
5611
|
+
const e = o.objectStore(EA).put({
|
|
5612
5612
|
key: A,
|
|
5613
5613
|
kind: I,
|
|
5614
5614
|
value: g,
|
|
@@ -5625,9 +5625,9 @@ class ai {
|
|
|
5625
5625
|
const I = await this.openDb();
|
|
5626
5626
|
I && await new Promise((g) => {
|
|
5627
5627
|
try {
|
|
5628
|
-
const Q = I.transaction(
|
|
5628
|
+
const Q = I.transaction(EA, "readwrite");
|
|
5629
5629
|
Q.onerror = () => g(), Q.onabort = () => g();
|
|
5630
|
-
const E = Q.objectStore(
|
|
5630
|
+
const E = Q.objectStore(EA).put(A);
|
|
5631
5631
|
E.onsuccess = () => g(), E.onerror = () => g();
|
|
5632
5632
|
} catch (Q) {
|
|
5633
5633
|
g();
|
|
@@ -5643,9 +5643,9 @@ class ai {
|
|
|
5643
5643
|
const A = await this.openDb();
|
|
5644
5644
|
A && await new Promise((I) => {
|
|
5645
5645
|
try {
|
|
5646
|
-
const g = A.transaction(
|
|
5646
|
+
const g = A.transaction(EA, "readwrite");
|
|
5647
5647
|
g.oncomplete = () => I(), g.onerror = () => I(), g.onabort = () => I();
|
|
5648
|
-
const Q = g.objectStore(
|
|
5648
|
+
const Q = g.objectStore(EA), C = Q.index(hg), E = [];
|
|
5649
5649
|
let o = 0;
|
|
5650
5650
|
const i = C.openCursor();
|
|
5651
5651
|
i.onsuccess = () => {
|
|
@@ -5671,9 +5671,9 @@ class ai {
|
|
|
5671
5671
|
const I = await this.openDb();
|
|
5672
5672
|
I && await new Promise((g) => {
|
|
5673
5673
|
try {
|
|
5674
|
-
const Q = I.transaction(
|
|
5674
|
+
const Q = I.transaction(EA, "readwrite");
|
|
5675
5675
|
Q.onerror = () => g(), Q.onabort = () => g();
|
|
5676
|
-
const E = Q.objectStore(
|
|
5676
|
+
const E = Q.objectStore(EA).delete(A);
|
|
5677
5677
|
E.onsuccess = () => g(), E.onerror = () => g();
|
|
5678
5678
|
} catch (Q) {
|
|
5679
5679
|
g();
|
|
@@ -5681,39 +5681,39 @@ class ai {
|
|
|
5681
5681
|
});
|
|
5682
5682
|
}
|
|
5683
5683
|
}
|
|
5684
|
-
const
|
|
5684
|
+
const hA = new ai();
|
|
5685
5685
|
function ti(B) {
|
|
5686
|
-
|
|
5686
|
+
hA.configure(B);
|
|
5687
5687
|
}
|
|
5688
5688
|
function fg(B) {
|
|
5689
|
-
return
|
|
5689
|
+
return hA.runLimited(B);
|
|
5690
5690
|
}
|
|
5691
|
-
function
|
|
5692
|
-
return
|
|
5691
|
+
function xA(B, A) {
|
|
5692
|
+
return hA.fetchArrayBuffer(B, A);
|
|
5693
5693
|
}
|
|
5694
5694
|
function si(B, A) {
|
|
5695
|
-
return
|
|
5695
|
+
return hA.fetchJSON(B, A);
|
|
5696
5696
|
}
|
|
5697
5697
|
function vg(B) {
|
|
5698
|
-
return
|
|
5698
|
+
return hA.getSVGAWorkerPayload(B);
|
|
5699
5699
|
}
|
|
5700
5700
|
function wB(B, A) {
|
|
5701
|
-
|
|
5701
|
+
hA.setSVGAWorkerPayload(B, A);
|
|
5702
5702
|
}
|
|
5703
5703
|
function Di(B, A) {
|
|
5704
|
-
return
|
|
5704
|
+
return hA.getMemoryValue(B, A);
|
|
5705
5705
|
}
|
|
5706
5706
|
function aQ(B, A, I, g) {
|
|
5707
|
-
|
|
5707
|
+
hA.setMemoryValue(B, A, I, g);
|
|
5708
5708
|
}
|
|
5709
5709
|
function hi(B) {
|
|
5710
|
-
return
|
|
5710
|
+
return hA.getPersistedArrayBuffer(B);
|
|
5711
5711
|
}
|
|
5712
5712
|
function wi(B, A) {
|
|
5713
|
-
return
|
|
5713
|
+
return hA.setPersistedArrayBuffer(B, A);
|
|
5714
5714
|
}
|
|
5715
5715
|
function ni(B) {
|
|
5716
|
-
return
|
|
5716
|
+
return hA.deletePersistedValue(B);
|
|
5717
5717
|
}
|
|
5718
5718
|
async function nB(B) {
|
|
5719
5719
|
const A = typeof B == "string" ? await si(B) : B;
|
|
@@ -5722,7 +5722,7 @@ async function nB(B) {
|
|
|
5722
5722
|
throw new Error("VAP config missing rgbFrame or aFrame");
|
|
5723
5723
|
return A;
|
|
5724
5724
|
}
|
|
5725
|
-
function
|
|
5725
|
+
function mA(B) {
|
|
5726
5726
|
const [, , A, I] = B.rgbFrame, g = B.w > 0 ? B.w : A, Q = B.h > 0 ? B.h : I;
|
|
5727
5727
|
return g > 0 && Q > 0 ? { w: g, h: Q } : { w: B.videoW, h: B.videoH };
|
|
5728
5728
|
}
|
|
@@ -5735,10 +5735,10 @@ function $A(B, A, I) {
|
|
|
5735
5735
|
bottom: (I - Q - E) / I
|
|
5736
5736
|
};
|
|
5737
5737
|
}
|
|
5738
|
-
var ri = Object.defineProperty, ci = (B, A, I) => A in B ? ri(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
5738
|
+
var ri = Object.defineProperty, ci = (B, A, I) => A in B ? ri(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, iA = (B, A, I) => ci(B, typeof A != "symbol" ? A + "" : A, I);
|
|
5739
5739
|
class tQ {
|
|
5740
5740
|
constructor() {
|
|
5741
|
-
|
|
5741
|
+
iA(this, "frameInfo", /* @__PURE__ */ new Map()), iA(this, "pending", /* @__PURE__ */ new Set()), iA(this, "lastHandle", /* @__PURE__ */ new Map()), iA(this, "started", /* @__PURE__ */ new Set()), iA(this, "firstUploaded", /* @__PURE__ */ new Set()), iA(this, "forceTimeFallback", /* @__PURE__ */ new Set()), iA(this, "lastArmAt", /* @__PURE__ */ new Map()), iA(this, "lastCallbackAt", /* @__PURE__ */ new Map()), iA(this, "lastProgressAt", /* @__PURE__ */ new Map()), iA(this, "lastRecoveryAt", /* @__PURE__ */ new Map()), iA(this, "stallLogged", /* @__PURE__ */ new Set()), iA(this, "stagnationLogged", /* @__PURE__ */ new Set()), iA(this, "lastTimeFallback", /* @__PURE__ */ new Map());
|
|
5742
5742
|
}
|
|
5743
5743
|
/**
|
|
5744
5744
|
* Returns true when `updateTexture` should run for this slot: first time, or a new decoded frame was signaled.
|
|
@@ -5870,12 +5870,12 @@ const Fi = 3;
|
|
|
5870
5870
|
function Gi() {
|
|
5871
5871
|
return typeof document != "undefined" && typeof document.createElement == "function";
|
|
5872
5872
|
}
|
|
5873
|
-
function
|
|
5873
|
+
function OA(B, A) {
|
|
5874
5874
|
if (!Gi()) throw new Error("Canvas rendering is unavailable in this environment");
|
|
5875
5875
|
const I = document.createElement("canvas");
|
|
5876
5876
|
return I.width = Math.max(1, Math.round(B)), I.height = Math.max(1, Math.round(A)), I;
|
|
5877
5877
|
}
|
|
5878
|
-
function
|
|
5878
|
+
function jA(B, A) {
|
|
5879
5879
|
const I = B.getContext("2d", A);
|
|
5880
5880
|
if (!I) throw new Error("Failed to acquire 2D canvas context");
|
|
5881
5881
|
return I;
|
|
@@ -5898,7 +5898,7 @@ function vI(B) {
|
|
|
5898
5898
|
g.crossOrigin = "anonymous", g.onload = () => A(g), g.onerror = () => I(new Error(`Failed to load image: ${B}`)), g.src = B;
|
|
5899
5899
|
});
|
|
5900
5900
|
}
|
|
5901
|
-
function
|
|
5901
|
+
function PA(B) {
|
|
5902
5902
|
if (typeof HTMLImageElement != "undefined" && B instanceof HTMLImageElement)
|
|
5903
5903
|
return { width: B.naturalWidth || B.width, height: B.naturalHeight || B.height };
|
|
5904
5904
|
if (typeof HTMLCanvasElement != "undefined" && B instanceof HTMLCanvasElement)
|
|
@@ -5916,8 +5916,8 @@ function jA(B) {
|
|
|
5916
5916
|
}
|
|
5917
5917
|
function ug(B) {
|
|
5918
5918
|
if (typeof ImageData != "undefined" && B instanceof ImageData) {
|
|
5919
|
-
const A =
|
|
5920
|
-
return
|
|
5919
|
+
const A = OA(B.width, B.height);
|
|
5920
|
+
return jA(A).putImageData(B, 0, 0), A;
|
|
5921
5921
|
}
|
|
5922
5922
|
return B;
|
|
5923
5923
|
}
|
|
@@ -5932,7 +5932,7 @@ function Mi(B, A, I) {
|
|
|
5932
5932
|
color: (Q = B.color) != null ? Q : I
|
|
5933
5933
|
} : { font: A, color: I };
|
|
5934
5934
|
}
|
|
5935
|
-
function
|
|
5935
|
+
function zA(B) {
|
|
5936
5936
|
return typeof B == "number" && Number.isFinite(B) && B > 0;
|
|
5937
5937
|
}
|
|
5938
5938
|
function Ni(B, A) {
|
|
@@ -5943,7 +5943,7 @@ function Si(B) {
|
|
|
5943
5943
|
const A = typeof B == "string" ? B : B == null ? void 0 : B.font, I = A ? /(\d+(?:\.\d+)?)px\b/.exec(A) : null;
|
|
5944
5944
|
if (!I) return;
|
|
5945
5945
|
const g = Number(I[1]);
|
|
5946
|
-
return
|
|
5946
|
+
return zA(g) ? g : void 0;
|
|
5947
5947
|
}
|
|
5948
5948
|
function cB(B, A, I, g) {
|
|
5949
5949
|
const Q = B.measureText(A), C = Q.width / I, E = (Q.actualBoundingBoxAscent || 0) + (Q.actualBoundingBoxDescent || 0), o = E > 0 ? E / I : g;
|
|
@@ -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 =
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
});
|
|
@@ -6017,8 +6017,8 @@ async function ki(B, A, I, g) {
|
|
|
6017
6017
|
return D;
|
|
6018
6018
|
}
|
|
6019
6019
|
function ng(B, A) {
|
|
6020
|
-
if (
|
|
6021
|
-
return !
|
|
6020
|
+
if (zA(B))
|
|
6021
|
+
return !zA(A) || A === 1 ? B : B / A;
|
|
6022
6022
|
}
|
|
6023
6023
|
async function Ui(B, A, I, g = 1) {
|
|
6024
6024
|
var Q, C, E;
|
|
@@ -6042,7 +6042,7 @@ async function Ui(B, A, I, g = 1) {
|
|
|
6042
6042
|
};
|
|
6043
6043
|
}
|
|
6044
6044
|
if (Ri(B)) {
|
|
6045
|
-
const i = typeof B.image == "string" ? await vI(B.image) : B.image, e =
|
|
6045
|
+
const i = typeof B.image == "string" ? await vI(B.image) : B.image, e = PA(i);
|
|
6046
6046
|
return {
|
|
6047
6047
|
source: i,
|
|
6048
6048
|
mode: (E = B.mode) != null ? E : "replace",
|
|
@@ -6051,7 +6051,7 @@ async function Ui(B, A, I, g = 1) {
|
|
|
6051
6051
|
};
|
|
6052
6052
|
}
|
|
6053
6053
|
if (typeof B == "string") {
|
|
6054
|
-
const i = await vI(B), e =
|
|
6054
|
+
const i = await vI(B), e = PA(i);
|
|
6055
6055
|
return {
|
|
6056
6056
|
source: i,
|
|
6057
6057
|
mode: "replace",
|
|
@@ -6059,7 +6059,7 @@ async function Ui(B, A, I, g = 1) {
|
|
|
6059
6059
|
logicalHeight: Math.max(1, e.height || I)
|
|
6060
6060
|
};
|
|
6061
6061
|
}
|
|
6062
|
-
const o =
|
|
6062
|
+
const o = PA(B);
|
|
6063
6063
|
return {
|
|
6064
6064
|
source: B,
|
|
6065
6065
|
mode: "replace",
|
|
@@ -6071,7 +6071,7 @@ async function Yi(B, A, I, g = {}) {
|
|
|
6071
6071
|
var Q, C, E;
|
|
6072
6072
|
const o = /* @__PURE__ */ new Map();
|
|
6073
6073
|
if (!I) return o;
|
|
6074
|
-
const i = Object.entries(I), e =
|
|
6074
|
+
const i = Object.entries(I), e = CA({
|
|
6075
6075
|
maxBudgetMs: g.frameBudgetMs
|
|
6076
6076
|
}), a = await ki(
|
|
6077
6077
|
A,
|
|
@@ -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
|
|
@@ -6150,7 +6150,7 @@ async function fi(B, A) {
|
|
|
6150
6150
|
if (Q == null) continue;
|
|
6151
6151
|
if (g.srcType === "txt") {
|
|
6152
6152
|
if (rB(Q)) {
|
|
6153
|
-
const e = ug(Q), a =
|
|
6153
|
+
const e = ug(Q), a = PA(e);
|
|
6154
6154
|
I.set(String(g.srcId), {
|
|
6155
6155
|
source: e,
|
|
6156
6156
|
width: Math.max(1, a.width),
|
|
@@ -6168,7 +6168,7 @@ async function fi(B, A) {
|
|
|
6168
6168
|
}
|
|
6169
6169
|
const C = rB(Q) || typeof Q == "string" || hQ(Q) ? Q : null;
|
|
6170
6170
|
if (!C) continue;
|
|
6171
|
-
const E = await Li(C), o =
|
|
6171
|
+
const E = await Li(C), o = PA(E);
|
|
6172
6172
|
I.set(String(g.srcId), {
|
|
6173
6173
|
source: E,
|
|
6174
6174
|
width: Math.max(1, o.width),
|
|
@@ -6190,27 +6190,27 @@ function ui(B) {
|
|
|
6190
6190
|
return I;
|
|
6191
6191
|
}
|
|
6192
6192
|
function Hi(B, A) {
|
|
6193
|
-
const I =
|
|
6193
|
+
const I = OA(B, A), g = OA(B, A), Q = OA(1, 1);
|
|
6194
6194
|
return {
|
|
6195
6195
|
compositeCanvas: I,
|
|
6196
|
-
compositeCtx:
|
|
6196
|
+
compositeCtx: jA(I),
|
|
6197
6197
|
rawCanvas: g,
|
|
6198
|
-
rawCtx:
|
|
6198
|
+
rawCtx: jA(g),
|
|
6199
6199
|
scratchCanvas: Q,
|
|
6200
|
-
scratchCtx:
|
|
6200
|
+
scratchCtx: jA(Q)
|
|
6201
6201
|
};
|
|
6202
6202
|
}
|
|
6203
6203
|
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
|
}
|
|
@@ -6221,27 +6221,27 @@ function FB(B, A, I, g, Q = !0) {
|
|
|
6221
6221
|
const [S, N, U, L] = y.frame, [l, f, d, u] = y.mFrame;
|
|
6222
6222
|
if (U <= 0 || L <= 0 || d <= 0 || u <= 0) continue;
|
|
6223
6223
|
(B.scratchCanvas.width !== U || B.scratchCanvas.height !== L) && (B.scratchCanvas.width = Math.max(1, Math.round(U)), B.scratchCanvas.height = Math.max(1, Math.round(L))), B.scratchCtx.clearRect(0, 0, B.scratchCanvas.width, B.scratchCanvas.height), B.scratchCtx.drawImage(R.source, 0, 0, B.scratchCanvas.width, B.scratchCanvas.height);
|
|
6224
|
-
const K = B.scratchCtx.getImageData(0, 0, B.scratchCanvas.width, B.scratchCanvas.height).data, x = Math.max(0, Math.floor(S)), X = Math.max(0, Math.floor(N)), gA = Math.min(B.width, Math.ceil(S + U)),
|
|
6225
|
-
for (let W = X; W <
|
|
6226
|
-
const
|
|
6224
|
+
const K = B.scratchCtx.getImageData(0, 0, B.scratchCanvas.width, B.scratchCanvas.height).data, x = Math.max(0, Math.floor(S)), X = Math.max(0, Math.floor(N)), gA = Math.min(B.width, Math.ceil(S + U)), LA = Math.min(B.height, Math.ceil(N + L));
|
|
6225
|
+
for (let W = X; W < LA; W++) {
|
|
6226
|
+
const eA = Math.min(
|
|
6227
6227
|
B.scratchCanvas.height - 1,
|
|
6228
6228
|
Math.max(0, Math.floor((W - N) / L * B.scratchCanvas.height))
|
|
6229
6229
|
), kI = Math.min(e - 1, Math.max(0, f + Math.floor((W - N) / L * u)));
|
|
6230
|
-
for (let
|
|
6230
|
+
for (let SA = x; SA < gA; SA++) {
|
|
6231
6231
|
const fQ = Math.min(
|
|
6232
6232
|
B.scratchCanvas.width - 1,
|
|
6233
|
-
Math.max(0, Math.floor((
|
|
6234
|
-
), uQ = Math.min(i - 1, Math.max(0, l + Math.floor((
|
|
6235
|
-
if (
|
|
6236
|
-
const
|
|
6237
|
-
G[
|
|
6233
|
+
Math.max(0, Math.floor((SA - S) / U * B.scratchCanvas.width))
|
|
6234
|
+
), uQ = Math.min(i - 1, Math.max(0, l + Math.floor((SA - S) / U * d))), UI = (eA * B.scratchCanvas.width + fQ) * 4, HQ = (kI * i + uQ) * 4, qQ = K[UI + 3] / 255, pQ = c[HQ] / 255, bA = qQ * pQ;
|
|
6235
|
+
if (bA <= 0) continue;
|
|
6236
|
+
const lA = (W * B.width + SA) * 4, mQ = K[UI] / 255 * bA, xQ = K[UI + 1] / 255 * bA, bQ = K[UI + 2] / 255 * bA, TQ = G[lA + 3] / 255, YI = 1 - bA;
|
|
6237
|
+
G[lA] = Math.round((mQ + G[lA] / 255 * YI) * 255), G[lA + 1] = Math.round((xQ + G[lA + 1] / 255 * YI) * 255), G[lA + 2] = Math.round((bQ + G[lA + 2] / 255 * YI) * 255), G[lA + 3] = Math.round((bA + TQ * YI) * 255);
|
|
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
|
-
const rg = 1024, GB = 32, lI = class
|
|
6244
|
+
const rg = 1024, GB = 32, lI = class RA {
|
|
6245
6245
|
constructor() {
|
|
6246
6246
|
T(this, "instancedQuadVB", null), T(this, "instancedQuadIB", null), T(this, "quadVB", null), T(this, "quadIB", null), T(this, "rgbaWebGLQuadVB", null), T(this, "rgbaTopLeftQuadVB", null), T(this, "rgbaQuadIB", null), T(this, "wcDbgFirstDraw", /* @__PURE__ */ new Set()), T(this, "wcDbgNullWarns", /* @__PURE__ */ new Map()), T(this, "htmlGate", new tQ()), T(this, "lastWcFrameRef", /* @__PURE__ */ new Map()), T(this, "scratchAtlasRemap", new Float32Array(4)), T(this, "instancePackScratch", new Float32Array(rg * GB)), T(this, "scratchTransform", new Float32Array(16)), T(this, "processedHtmlGatesScratch", /* @__PURE__ */ new Set()), T(this, "vapVertexScratch", new Float32Array(24)), T(this, "projCacheW", 0), T(this, "projCacheH", 0), T(this, "projCache", null);
|
|
6247
6247
|
}
|
|
@@ -6302,7 +6302,7 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6302
6302
|
g.vapMixState.mode === "direct" ? this.drawMixedDirectGeometry(A, g) : this.drawMixedGeometry(A, g);
|
|
6303
6303
|
continue;
|
|
6304
6304
|
}
|
|
6305
|
-
(A.type === "webgpu" || A.type === "webgl2") &&
|
|
6305
|
+
(A.type === "webgpu" || A.type === "webgl2") && DA(g) !== "cover" || this.drawGeometry(A, g);
|
|
6306
6306
|
}
|
|
6307
6307
|
}
|
|
6308
6308
|
drawSlot(A, I) {
|
|
@@ -6320,12 +6320,12 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6320
6320
|
drawInstancedVapBatches(A, I) {
|
|
6321
6321
|
const g = [];
|
|
6322
6322
|
for (const e of I.values())
|
|
6323
|
-
e.type !== "vap" || e.state !== "playing" && e.state !== "fly" && e.state !== "stopped" || e.vapMixState || !e.videoElement && !e.webcodecsPlayback || !e.videoTextureHandle ||
|
|
6323
|
+
e.type !== "vap" || e.state !== "playing" && e.state !== "fly" && e.state !== "stopped" || e.vapMixState || !e.videoElement && !e.webcodecsPlayback || !e.videoTextureHandle || DA(e) === "cover" || !e.vapConfig || g.push(e);
|
|
6324
6324
|
if (g.length === 0) return;
|
|
6325
|
-
this.instancedQuadVB || (this.instancedQuadVB = A.createBuffer(
|
|
6325
|
+
this.instancedQuadVB || (this.instancedQuadVB = A.createBuffer(RA.QUAD_VERTS, "vertex"), this.instancedQuadIB = A.createBuffer(RA.QUAD_INDICES, "index"));
|
|
6326
6326
|
const Q = A.canvas.width, C = A.canvas.height;
|
|
6327
6327
|
let E;
|
|
6328
|
-
this.projCache && this.projCacheW === Q && this.projCacheH === C ? E = this.projCache : (this.projCacheW = Q, this.projCacheH = C, this.projCache =
|
|
6328
|
+
this.projCache && this.projCacheW === Q && this.projCacheH === C ? E = this.projCache : (this.projCacheW = Q, this.projCacheH = C, this.projCache = qA(0, Q, C, 0, -1, 1), E = this.projCache);
|
|
6329
6329
|
const o = /* @__PURE__ */ new Map();
|
|
6330
6330
|
for (const e of g) {
|
|
6331
6331
|
const a = e.videoTextureHandle.id;
|
|
@@ -6356,8 +6356,8 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6356
6356
|
/** mat4 + atlasRemap + rgb/alpha UV rects (`computeVAPUV` order). */
|
|
6357
6357
|
fillVapInstanceData(A, I, g) {
|
|
6358
6358
|
var Q, C, E, o;
|
|
6359
|
-
const i = A.vapConfig, { info: e } = i, a = e.videoW > 0 ? e.videoW : (C = (Q = A.webcodecsPlayback) == null ? void 0 : Q.videoWidth) != null ? C : 1, t = e.videoH > 0 ? e.videoH : (o = (E = A.webcodecsPlayback) == null ? void 0 : E.videoHeight) != null ? o : 1, s = this.scratchTransform, { w: D, h } =
|
|
6360
|
-
|
|
6359
|
+
const i = A.vapConfig, { info: e } = i, a = e.videoW > 0 ? e.videoW : (C = (Q = A.webcodecsPlayback) == null ? void 0 : Q.videoWidth) != null ? C : 1, t = e.videoH > 0 ? e.videoH : (o = (E = A.webcodecsPlayback) == null ? void 0 : E.videoHeight) != null ? o : 1, s = this.scratchTransform, { w: D, h } = mA(e), w = dA(A, D, h);
|
|
6360
|
+
ZA(
|
|
6361
6361
|
A,
|
|
6362
6362
|
A.x + w.offsetX,
|
|
6363
6363
|
A.y + w.offsetY,
|
|
@@ -6365,10 +6365,10 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
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;
|
|
@@ -6410,14 +6410,14 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6410
6410
|
var g, Q, C, E;
|
|
6411
6411
|
const o = A.canvas.width, i = A.canvas.height;
|
|
6412
6412
|
let e;
|
|
6413
|
-
this.projCache && this.projCacheW === o && this.projCacheH === i ? e = this.projCache : (this.projCacheW = o, this.projCacheH = i, this.projCache =
|
|
6413
|
+
this.projCache && this.projCacheW === o && this.projCacheH === i ? e = this.projCache : (this.projCacheW = o, this.projCacheH = i, this.projCache = qA(0, o, i, 0, -1, 1), e = this.projCache);
|
|
6414
6414
|
const a = I.vapConfig;
|
|
6415
6415
|
if (!a) {
|
|
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 =
|
|
6420
|
-
|
|
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
|
+
ZA(
|
|
6421
6421
|
I,
|
|
6422
6422
|
I.x + c.offsetX,
|
|
6423
6423
|
I.y + c.offsetY,
|
|
@@ -6425,8 +6425,8 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
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,
|
|
@@ -6443,7 +6443,7 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6443
6443
|
}
|
|
6444
6444
|
};
|
|
6445
6445
|
if (w === "cover") {
|
|
6446
|
-
const N =
|
|
6446
|
+
const N = pA(
|
|
6447
6447
|
I,
|
|
6448
6448
|
I.x,
|
|
6449
6449
|
I.y,
|
|
@@ -6457,12 +6457,12 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6457
6457
|
drawMixedGeometry(A, I) {
|
|
6458
6458
|
const g = A.canvas.width, Q = A.canvas.height;
|
|
6459
6459
|
let C;
|
|
6460
|
-
this.projCache && this.projCacheW === g && this.projCacheH === Q ? C = this.projCache : (this.projCacheW = g, this.projCacheH = Q, this.projCache =
|
|
6460
|
+
this.projCache && this.projCacheW === g && this.projCacheH === Q ? C = this.projCache : (this.projCacheW = g, this.projCacheH = Q, this.projCache = qA(0, g, Q, 0, -1, 1), C = this.projCache);
|
|
6461
6461
|
const E = I.vapConfig;
|
|
6462
6462
|
if (!E || !I.vapMixState || I.vapMixState.mode !== "composited" || !I.videoTextureHandle)
|
|
6463
6463
|
return;
|
|
6464
|
-
const o = this.scratchTransform, i =
|
|
6465
|
-
|
|
6464
|
+
const o = this.scratchTransform, i = DA(I), { w: e, h: a } = mA(E.info), t = dA(I, e, a);
|
|
6465
|
+
ZA(
|
|
6466
6466
|
I,
|
|
6467
6467
|
I.x + t.offsetX,
|
|
6468
6468
|
I.y + t.offsetY,
|
|
@@ -6473,10 +6473,10 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6473
6473
|
const s = !!I.vapMixState.composer || A.type === "webgpu";
|
|
6474
6474
|
let D = s ? this.rgbaTopLeftQuadVB : this.rgbaWebGLQuadVB;
|
|
6475
6475
|
if (D || (D = A.createBuffer(
|
|
6476
|
-
s ?
|
|
6476
|
+
s ? RA.RGBA_QUAD_VERTS_WEBGPU : RA.RGBA_QUAD_VERTS_WEBGL,
|
|
6477
6477
|
"vertex"
|
|
6478
|
-
), s ? this.rgbaTopLeftQuadVB = D : this.rgbaWebGLQuadVB = D), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(
|
|
6479
|
-
const h =
|
|
6478
|
+
), s ? this.rgbaTopLeftQuadVB = D : this.rgbaWebGLQuadVB = D), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(RA.QUAD_INDICES, "index")), i === "cover") {
|
|
6479
|
+
const h = pA(
|
|
6480
6480
|
I,
|
|
6481
6481
|
I.x,
|
|
6482
6482
|
I.y,
|
|
@@ -6509,13 +6509,13 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6509
6509
|
if (!E || E.length === 0) return;
|
|
6510
6510
|
const o = A.canvas.width, i = A.canvas.height;
|
|
6511
6511
|
let e;
|
|
6512
|
-
this.projCache && this.projCacheW === o && this.projCacheH === i ? e = this.projCache : (this.projCacheW = o, this.projCacheH = i, this.projCache =
|
|
6513
|
-
|
|
6512
|
+
this.projCache && this.projCacheW === o && this.projCacheH === i ? e = this.projCache : (this.projCacheW = o, this.projCacheH = i, this.projCache = qA(0, o, i, 0, -1, 1), e = this.projCache), this.rgbaTopLeftQuadVB || (this.rgbaTopLeftQuadVB = A.createBuffer(
|
|
6513
|
+
RA.RGBA_QUAD_VERTS_WEBGPU,
|
|
6514
6514
|
"vertex"
|
|
6515
|
-
)), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(
|
|
6516
|
-
const { info: a } = g, { w: t, h: s } =
|
|
6517
|
-
if (
|
|
6518
|
-
const c =
|
|
6515
|
+
)), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(RA.QUAD_INDICES, "index"));
|
|
6516
|
+
const { info: a } = g, { w: t, h: s } = mA(a), D = dA(I, t, s);
|
|
6517
|
+
if (DA(I) === "cover") {
|
|
6518
|
+
const c = pA(
|
|
6519
6519
|
I,
|
|
6520
6520
|
I.x,
|
|
6521
6521
|
I.y,
|
|
@@ -6524,7 +6524,7 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
6524
6524
|
);
|
|
6525
6525
|
A.setScissor(c.x, c.y, c.w, c.h);
|
|
6526
6526
|
} else {
|
|
6527
|
-
const c =
|
|
6527
|
+
const c = pA(
|
|
6528
6528
|
I,
|
|
6529
6529
|
I.x + D.offsetX,
|
|
6530
6530
|
I.y + D.offsetY,
|
|
@@ -6533,31 +6533,31 @@ const rg = 1024, GB = 32, lI = class FA {
|
|
|
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(
|
|
6543
6543
|
I,
|
|
6544
6544
|
I.x + D.offsetX + G * D.scaleX,
|
|
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
|
|
@@ -6753,7 +6753,7 @@ const RB = 1024, yB = 12, Xg = class EI {
|
|
|
6753
6753
|
const o = this.instancePackScratch;
|
|
6754
6754
|
for (const i of I.values()) {
|
|
6755
6755
|
if (i.type !== "alphaVideo" || i.state !== "playing" && i.state !== "fly" && i.state !== "stopped" || !i.videoElement && !i.webcodecsPlayback || !i.videoTextureHandle) continue;
|
|
6756
|
-
if (
|
|
6756
|
+
if (DA(i) === "cover" || ((g = i.rotation) != null ? g : 0) !== 0) {
|
|
6757
6757
|
Q && C > 0 && E && (this.flushInstancedBatch(A, Q, C, E), Q = null, C = 0), this.drawGeometry(A, i);
|
|
6758
6758
|
continue;
|
|
6759
6759
|
}
|
|
@@ -6768,7 +6768,7 @@ const RB = 1024, yB = 12, Xg = class EI {
|
|
|
6768
6768
|
}
|
|
6769
6769
|
/** Writes rect + atlas remap + opacity at `floatOffset` into `out`. */
|
|
6770
6770
|
fillAlphaInstanceData(A, I, g) {
|
|
6771
|
-
const Q = EI.alphaVideoContentSize(A, this.contentSizeScratch), C =
|
|
6771
|
+
const Q = EI.alphaVideoContentSize(A, this.contentSizeScratch), C = dA(A, Q.w, Q.h, this.layoutScratch);
|
|
6772
6772
|
I[g + 0] = A.x + C.offsetX, I[g + 1] = A.y + C.offsetY, I[g + 2] = C.width, I[g + 3] = C.height;
|
|
6773
6773
|
const E = A.videoTextureHandle, o = VI(E.width, E.height, A.wcAtlasRect, this.scratchAtlasRemap);
|
|
6774
6774
|
I.set(o, g + 4), I[g + 8] = A.opacity, I[g + 9] = A.options.videoRGBAlphaMode !== "straight" ? 1 : 0, I[g + 10] = 0, I[g + 11] = 0;
|
|
@@ -6784,8 +6784,8 @@ const RB = 1024, yB = 12, Xg = class EI {
|
|
|
6784
6784
|
return A.releaseSharedVideoTexture && A.videoTextureHandle ? `shared:${A.videoTextureHandle.id}` : A.id;
|
|
6785
6785
|
}
|
|
6786
6786
|
drawGeometry(A, I) {
|
|
6787
|
-
const g = this.getProjection(A), Q = this.scratchTransform, C =
|
|
6788
|
-
|
|
6787
|
+
const g = this.getProjection(A), Q = this.scratchTransform, C = DA(I), E = EI.alphaVideoContentSize(I, this.contentSizeScratch), o = dA(I, E.w, E.h, this.layoutScratch);
|
|
6788
|
+
ZA(
|
|
6789
6789
|
I,
|
|
6790
6790
|
I.x + o.offsetX,
|
|
6791
6791
|
I.y + o.offsetY,
|
|
@@ -6795,7 +6795,7 @@ const RB = 1024, yB = 12, Xg = class EI {
|
|
|
6795
6795
|
), this.ensureQuadBuffers(A);
|
|
6796
6796
|
const i = I.videoTextureHandle, e = VI(i.width, i.height, I.wcAtlasRect, this.scratchAtlasRemap), a = this.geometryDrawCommand;
|
|
6797
6797
|
if (a.vertexBuffer = this.quadVB, a.indexBuffer = this.quadIB, this.geometryTexturesScratch[0] = i, this.geometryTexturesScratch.length = 1, this.geometryUniformsScratch.u_projection = g, this.geometryUniformsScratch.u_transform = Q, this.geometryUniformsScratch.u_atlasRemap = e, this.geometryUniformsScratch.u_opacity = I.opacity, this.geometryUniformsScratch.u_rgbPremultiplied = I.options.videoRGBAlphaMode !== "straight" ? 1 : 0, C === "cover") {
|
|
6798
|
-
const t =
|
|
6798
|
+
const t = pA(
|
|
6799
6799
|
I,
|
|
6800
6800
|
I.x,
|
|
6801
6801
|
I.y,
|
|
@@ -6811,7 +6811,7 @@ const RB = 1024, yB = 12, Xg = class EI {
|
|
|
6811
6811
|
}
|
|
6812
6812
|
getProjection(A) {
|
|
6813
6813
|
const I = A.canvas.width, g = A.canvas.height;
|
|
6814
|
-
return this.projCache && this.projCacheW === I && this.projCacheH === g ? this.projCache : (this.projCacheW = I, this.projCacheH = g, this.projCache =
|
|
6814
|
+
return this.projCache && this.projCacheW === I && this.projCacheH === g ? this.projCache : (this.projCacheW = I, this.projCacheH = g, this.projCache = qA(0, I, g, 0, -1, 1), this.projCache);
|
|
6815
6815
|
}
|
|
6816
6816
|
destroy(A) {
|
|
6817
6817
|
this.quadVB && A.deleteBuffer(this.quadVB), this.quadIB && A.deleteBuffer(this.quadIB), this.quadVB = null, this.quadIB = null, this.projCache = null, this.projCacheW = 0, this.projCacheH = 0, this.lastWcFrameRef.clear(), this.processedHtmlGatesScratch.clear();
|
|
@@ -6837,22 +6837,22 @@ b(Xg, "QUAD_VERTS", new Float32Array([
|
|
|
6837
6837
|
]));
|
|
6838
6838
|
b(Xg, "QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
|
|
6839
6839
|
let Ti = Xg;
|
|
6840
|
-
var Wi = Object.defineProperty, Zi = (B, A, I) => A in B ? Wi(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
6840
|
+
var Wi = Object.defineProperty, Zi = (B, A, I) => A in B ? Wi(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, UA = (B, A, I) => Zi(B, typeof A != "symbol" ? A + "" : A, I);
|
|
6841
6841
|
const Og = class Hg {
|
|
6842
6842
|
constructor() {
|
|
6843
|
-
|
|
6843
|
+
UA(this, "quadVB", null), UA(this, "quadIB", null), UA(this, "scratchTransform", new Float32Array(16)), UA(this, "projCacheW", 0), UA(this, "projCacheH", 0), UA(this, "projCache", null);
|
|
6844
6844
|
}
|
|
6845
6845
|
drawSlot(A, I) {
|
|
6846
6846
|
if (I.type !== "image" || !I.imageTextureHandle || I.state !== "playing" && I.state !== "fly" && I.state !== "stopped") return;
|
|
6847
|
-
const g = I.imageTextureHandle, Q =
|
|
6848
|
-
|
|
6847
|
+
const g = I.imageTextureHandle, Q = dA(I, g.width, g.height), C = I.x + Q.offsetX, E = I.y + Q.offsetY;
|
|
6848
|
+
ZA(I, C, E, Q.width, Q.height, this.scratchTransform);
|
|
6849
6849
|
let o = this.quadVB;
|
|
6850
6850
|
o || (o = A.createBuffer(Hg.QUAD_VERTS, "vertex"), this.quadVB = o), this.quadIB || (this.quadIB = A.createBuffer(Hg.QUAD_INDICES, "index"));
|
|
6851
6851
|
const i = A.canvas.width, e = A.canvas.height;
|
|
6852
|
-
(!this.projCache || this.projCacheW !== i || this.projCacheH !== e) && (this.projCacheW = i, this.projCacheH = e, this.projCache =
|
|
6853
|
-
const a =
|
|
6852
|
+
(!this.projCache || this.projCacheW !== i || this.projCacheH !== e) && (this.projCacheW = i, this.projCacheH = e, this.projCache = qA(0, i, e, 0, -1, 1));
|
|
6853
|
+
const a = DA(I) === "cover";
|
|
6854
6854
|
if (a) {
|
|
6855
|
-
const t =
|
|
6855
|
+
const t = pA(
|
|
6856
6856
|
I,
|
|
6857
6857
|
I.x,
|
|
6858
6858
|
I.y,
|
|
@@ -6880,7 +6880,7 @@ const Og = class Hg {
|
|
|
6880
6880
|
this.quadVB && A.deleteBuffer(this.quadVB), this.quadIB && A.deleteBuffer(this.quadIB), this.quadVB = null, this.quadIB = null, this.projCache = null;
|
|
6881
6881
|
}
|
|
6882
6882
|
};
|
|
6883
|
-
|
|
6883
|
+
UA(Og, "QUAD_VERTS", new Float32Array([
|
|
6884
6884
|
0,
|
|
6885
6885
|
0,
|
|
6886
6886
|
0,
|
|
@@ -6898,7 +6898,7 @@ lA(Og, "QUAD_VERTS", new Float32Array([
|
|
|
6898
6898
|
0,
|
|
6899
6899
|
1
|
|
6900
6900
|
]));
|
|
6901
|
-
|
|
6901
|
+
UA(Og, "QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
|
|
6902
6902
|
let Vi = Og;
|
|
6903
6903
|
var vi = Object.defineProperty, Xi = (B, A, I) => A in B ? vi(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, uI = (B, A, I) => Xi(B, typeof A != "symbol" ? A + "" : A, I);
|
|
6904
6904
|
class Oi {
|
|
@@ -7012,11 +7012,11 @@ class Oi {
|
|
|
7012
7012
|
Q.startTime < 0 && (Q.startTime = I);
|
|
7013
7013
|
const C = og((((g = Q.pausedAt) != null ? g : I) - Q.startTime) / Q.duration, 0, 1), E = Q.easing(C);
|
|
7014
7014
|
return {
|
|
7015
|
-
x:
|
|
7016
|
-
y:
|
|
7017
|
-
scale:
|
|
7018
|
-
opacity:
|
|
7019
|
-
rotation:
|
|
7015
|
+
x: rA(Q.startX, Q.targetX, E),
|
|
7016
|
+
y: rA(Q.startY, Q.targetY, E),
|
|
7017
|
+
scale: rA(Q.startScale, Q.targetScale, E),
|
|
7018
|
+
opacity: rA(Q.startOpacity, Q.targetOpacity, E),
|
|
7019
|
+
rotation: rA(Q.startRotation, Q.targetRotation, E)
|
|
7020
7020
|
};
|
|
7021
7021
|
}
|
|
7022
7022
|
applyAnimatedState(A, I) {
|
|
@@ -7025,7 +7025,7 @@ class Oi {
|
|
|
7025
7025
|
if (!Q) return !1;
|
|
7026
7026
|
Q.startTime < 0 && (Q.startTime = I);
|
|
7027
7027
|
const C = og((((g = Q.pausedAt) != null ? g : I) - Q.startTime) / Q.duration, 0, 1), E = Q.easing(C);
|
|
7028
|
-
return A.x =
|
|
7028
|
+
return A.x = rA(Q.startX, Q.targetX, E), A.y = rA(Q.startY, Q.targetY, E), A.scale = rA(Q.startScale, Q.targetScale, E), A.opacity = rA(Q.startOpacity, Q.targetOpacity, E), A.rotation = rA(Q.startRotation, Q.targetRotation, E), !0;
|
|
7029
7029
|
}
|
|
7030
7030
|
hasAnimation(A) {
|
|
7031
7031
|
return this.animations.has(A);
|
|
@@ -7142,10 +7142,10 @@ class zi {
|
|
|
7142
7142
|
}), this.ctx = null, this.gainNode = null;
|
|
7143
7143
|
}
|
|
7144
7144
|
}
|
|
7145
|
-
var _i = Object.defineProperty, $i = (B, A, I) => A in B ? _i(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
7145
|
+
var _i = Object.defineProperty, $i = (B, A, I) => A in B ? _i(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, TA = (B, A, I) => $i(B, typeof A != "symbol" ? A + "" : A, I);
|
|
7146
7146
|
class Ao {
|
|
7147
7147
|
constructor(A, I) {
|
|
7148
|
-
|
|
7148
|
+
TA(this, "atlasW"), TA(this, "atlasH"), TA(this, "rowY", 0), TA(this, "rowH", 0), TA(this, "rowX", 0), TA(this, "slots", /* @__PURE__ */ new Map()), this.atlasW = Math.max(64, Math.floor(A)), this.atlasH = Math.max(64, Math.floor(I));
|
|
7149
7149
|
}
|
|
7150
7150
|
get size() {
|
|
7151
7151
|
return { w: this.atlasW, h: this.atlasH };
|
|
@@ -7195,7 +7195,7 @@ class Qo {
|
|
|
7195
7195
|
}
|
|
7196
7196
|
releaseSlotResources(A) {
|
|
7197
7197
|
var I, g, Q, C, E, o, i, e, a;
|
|
7198
|
-
if ((I = A.loadAbortController) == null || I.abort(), A.loadAbortController = null, this.wcDbgTickOnce.delete(A.id), A.type === "vap" && (this.vapRenderer.releaseHtmlVideo(A), this.vapRenderer.clearWebCodecsFrameRef(A.id), (Q = (g = A.vapMixState) == null ? void 0 : g.composer) == null || Q.destroy(), (C = A.vapMixState) != null && C.resourceTextures)) {
|
|
7198
|
+
if ((I = A.loadAbortController) == null || I.abort(), A.loadAbortController = null, A.videoPlaybackWatchdogTimer != null && (clearTimeout(A.videoPlaybackWatchdogTimer), A.videoPlaybackWatchdogTimer = null), this.wcDbgTickOnce.delete(A.id), A.type === "vap" && (this.vapRenderer.releaseHtmlVideo(A), this.vapRenderer.clearWebCodecsFrameRef(A.id), (Q = (g = A.vapMixState) == null ? void 0 : g.composer) == null || Q.destroy(), (C = A.vapMixState) != null && C.resourceTextures)) {
|
|
7199
7199
|
for (const t of A.vapMixState.resourceTextures.values())
|
|
7200
7200
|
this.backend.deleteTexture(t);
|
|
7201
7201
|
A.vapMixState.resourceTextures.clear();
|
|
@@ -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";
|
|
@@ -7536,19 +7536,19 @@ class Qo {
|
|
|
7536
7536
|
function NB() {
|
|
7537
7537
|
return typeof DecompressionStream != "undefined";
|
|
7538
7538
|
}
|
|
7539
|
-
function
|
|
7539
|
+
function QA() {
|
|
7540
7540
|
return typeof performance != "undefined" ? performance.now() : Date.now();
|
|
7541
7541
|
}
|
|
7542
7542
|
function rQ(B) {
|
|
7543
7543
|
return B instanceof Error ? `${B.name}: ${B.message}` : String(B);
|
|
7544
7544
|
}
|
|
7545
7545
|
async function Co(B, A, I) {
|
|
7546
|
-
const g = I ?
|
|
7546
|
+
const g = I ? QA() : 0, Q = I ? {
|
|
7547
7547
|
inputBytes: B.byteLength,
|
|
7548
7548
|
nativeAvailable: NB(),
|
|
7549
7549
|
nativeAttempts: []
|
|
7550
|
-
} : null, C = (o, i) => (Q && (Q.selectedPath = i, Q.outputBytes = o.byteLength, Q.totalMs =
|
|
7551
|
-
throw Q && (Q.error = rQ(o), Q.totalMs =
|
|
7550
|
+
} : null, C = (o, i) => (Q && (Q.selectedPath = i, Q.outputBytes = o.byteLength, Q.totalMs = QA() - g, I == null || I(Q)), o), E = (o) => {
|
|
7551
|
+
throw Q && (Q.error = rQ(o), Q.totalMs = QA() - g, I == null || I(Q)), o;
|
|
7552
7552
|
};
|
|
7553
7553
|
if (NB())
|
|
7554
7554
|
try {
|
|
@@ -7556,8 +7556,8 @@ async function Co(B, A, I) {
|
|
|
7556
7556
|
} catch (o) {
|
|
7557
7557
|
}
|
|
7558
7558
|
try {
|
|
7559
|
-
const o = Q ?
|
|
7560
|
-
return Q && (Q.wasmMs =
|
|
7559
|
+
const o = Q ? QA() : 0, i = A();
|
|
7560
|
+
return Q && (Q.wasmMs = QA() - o), i ? C(i, "wasm") : C(await SB(B, Q != null ? Q : void 0), "native-retry");
|
|
7561
7561
|
} catch (o) {
|
|
7562
7562
|
return E(o);
|
|
7563
7563
|
}
|
|
@@ -7577,7 +7577,7 @@ async function SB(B, A) {
|
|
|
7577
7577
|
throw new Error("No inflate implementation available (need WASM or DecompressionStream)");
|
|
7578
7578
|
}
|
|
7579
7579
|
async function cg(B, A, I) {
|
|
7580
|
-
const g = I ?
|
|
7580
|
+
const g = I ? QA() : 0, Q = I ? {
|
|
7581
7581
|
format: A,
|
|
7582
7582
|
inputBytes: B.byteLength,
|
|
7583
7583
|
inputChunks: 1,
|
|
@@ -7590,28 +7590,28 @@ async function cg(B, A, I) {
|
|
|
7590
7590
|
status: "failed"
|
|
7591
7591
|
} : null;
|
|
7592
7592
|
try {
|
|
7593
|
-
const C = new DecompressionStream(A), E = C.writable.getWriter(), o = C.readable.getReader(), i = Q ?
|
|
7593
|
+
const C = new DecompressionStream(A), E = C.writable.getWriter(), o = C.readable.getReader(), i = Q ? QA() : 0, e = Promise.resolve(
|
|
7594
7594
|
E.write(new Uint8Array(B.buffer, B.byteOffset, B.byteLength))
|
|
7595
7595
|
), a = Promise.resolve(E.close());
|
|
7596
7596
|
e.catch(() => {
|
|
7597
7597
|
}), a.catch(() => {
|
|
7598
|
-
}), Q && (Q.writerSubmitMs =
|
|
7598
|
+
}), Q && (Q.writerSubmitMs = QA() - i);
|
|
7599
7599
|
const t = [];
|
|
7600
7600
|
let s = 0;
|
|
7601
|
-
const D = Q ?
|
|
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
|
-
await Promise.all([e, a]), Q && (Q.readMs =
|
|
7608
|
-
const h = Q ?
|
|
7609
|
-
let
|
|
7610
|
-
for (const
|
|
7611
|
-
w.set(
|
|
7612
|
-
return Q && (Q.concatMs =
|
|
7607
|
+
await Promise.all([e, a]), Q && (Q.readMs = QA() - D, Q.outputChunks = t.length, Q.outputBytes = s);
|
|
7608
|
+
const h = Q ? QA() : 0, w = new Uint8Array(s);
|
|
7609
|
+
let r = 0;
|
|
7610
|
+
for (const n of t)
|
|
7611
|
+
w.set(n, r), r += n.length;
|
|
7612
|
+
return Q && (Q.concatMs = QA() - h, Q.totalMs = QA() - g, Q.status = "success"), w;
|
|
7613
7613
|
} catch (C) {
|
|
7614
|
-
throw Q && (Q.totalMs =
|
|
7614
|
+
throw Q && (Q.totalMs = QA() - g, Q.error = rQ(C)), C;
|
|
7615
7615
|
} finally {
|
|
7616
7616
|
Q && (I == null || I.push(Q));
|
|
7617
7617
|
}
|
|
@@ -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
|
}
|
|
@@ -8316,7 +8316,7 @@ let uo = class {
|
|
|
8316
8316
|
}
|
|
8317
8317
|
};
|
|
8318
8318
|
async function RQ(B, A, I, g) {
|
|
8319
|
-
const Q =
|
|
8319
|
+
const Q = CA({ maxBudgetMs: I }), C = async () => {
|
|
8320
8320
|
Y(g, "SVGA payload deserialization aborted"), Q.shouldYield() && await Q.yield(), Y(g, "SVGA payload deserialization aborted");
|
|
8321
8321
|
};
|
|
8322
8322
|
Y(g, "SVGA payload deserialization aborted");
|
|
@@ -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"), {
|
|
@@ -9834,11 +9834,11 @@ function Ho(B) {
|
|
|
9834
9834
|
}
|
|
9835
9835
|
}
|
|
9836
9836
|
let tI = null, qo = 1;
|
|
9837
|
-
const
|
|
9837
|
+
const sA = /* @__PURE__ */ new Map();
|
|
9838
9838
|
function JB() {
|
|
9839
9839
|
return typeof performance != "undefined" ? performance.now() : Date.now();
|
|
9840
9840
|
}
|
|
9841
|
-
function
|
|
9841
|
+
function WA(B) {
|
|
9842
9842
|
B.signal && B.onAbort && B.signal.removeEventListener("abort", B.onAbort);
|
|
9843
9843
|
}
|
|
9844
9844
|
function XI(B, A, I) {
|
|
@@ -9847,8 +9847,8 @@ function XI(B, A, I) {
|
|
|
9847
9847
|
B.terminate();
|
|
9848
9848
|
} catch (g) {
|
|
9849
9849
|
}
|
|
9850
|
-
for (const [g, Q] of
|
|
9851
|
-
Q.owner === B && (
|
|
9850
|
+
for (const [g, Q] of sA)
|
|
9851
|
+
Q.owner === B && (sA.delete(g), WA(Q), Q.reject(
|
|
9852
9852
|
I == null || g === I ? A : new Error("SVGA parser worker restarted after another request was canceled")
|
|
9853
9853
|
));
|
|
9854
9854
|
}
|
|
@@ -9858,10 +9858,10 @@ function po() {
|
|
|
9858
9858
|
tI = B, B.addEventListener("message", (A) => {
|
|
9859
9859
|
const I = A.data;
|
|
9860
9860
|
if (!I || I.type !== "parse-svga-result" || I.id == null) return;
|
|
9861
|
-
const g =
|
|
9861
|
+
const g = sA.get(I.id);
|
|
9862
9862
|
if (!(!g || g.owner !== B))
|
|
9863
9863
|
if (I.error)
|
|
9864
|
-
|
|
9864
|
+
sA.delete(I.id), WA(g), g.reject(new Error(I.error));
|
|
9865
9865
|
else if (I.result) {
|
|
9866
9866
|
const Q = I.result;
|
|
9867
9867
|
if (Q.buffer && Object.prototype.toString.call(Q.buffer) === "[object ArrayBuffer]") {
|
|
@@ -9873,17 +9873,17 @@ function po() {
|
|
|
9873
9873
|
g.signal
|
|
9874
9874
|
).then((E) => {
|
|
9875
9875
|
var o;
|
|
9876
|
-
if (
|
|
9877
|
-
|
|
9876
|
+
if (sA.get(I.id) !== g) return;
|
|
9877
|
+
sA.delete(I.id), WA(g);
|
|
9878
9878
|
const i = (o = E.__debug) == null ? void 0 : o.parser;
|
|
9879
9879
|
i && typeof i == "object" && !Array.isArray(i) && (i.payloadDeserializeMs = JB() - C), g.resolve(E);
|
|
9880
9880
|
}, (E) => {
|
|
9881
|
-
|
|
9881
|
+
sA.get(I.id) === g && (sA.delete(I.id), WA(g), g.reject(E instanceof Error ? E : new Error(String(E))));
|
|
9882
9882
|
});
|
|
9883
9883
|
} else
|
|
9884
|
-
|
|
9884
|
+
sA.delete(I.id), WA(g), g.resolve(I.result);
|
|
9885
9885
|
} else
|
|
9886
|
-
|
|
9886
|
+
sA.delete(I.id), WA(g), g.reject(new Error("SVGA worker: empty result"));
|
|
9887
9887
|
}), B.addEventListener("error", (A) => {
|
|
9888
9888
|
XI(B, new Error(A.message || "SVGA parser worker error"));
|
|
9889
9889
|
}), B.addEventListener("messageerror", () => {
|
|
@@ -9911,7 +9911,7 @@ function mo(B, A = {}) {
|
|
|
9911
9911
|
$("SVGA parser worker task aborted"),
|
|
9912
9912
|
g
|
|
9913
9913
|
);
|
|
9914
|
-
},
|
|
9914
|
+
}, sA.set(g, i), (E = A.signal) != null && E.aborted) {
|
|
9915
9915
|
i.onAbort();
|
|
9916
9916
|
return;
|
|
9917
9917
|
}
|
|
@@ -10098,7 +10098,7 @@ function Zo() {
|
|
|
10098
10098
|
return typeof Worker != "undefined" && typeof createImageBitmap == "function";
|
|
10099
10099
|
}
|
|
10100
10100
|
async function Vo(B, A, I) {
|
|
10101
|
-
const g =
|
|
10101
|
+
const g = CA({ maxBudgetMs: A }), Q = new Uint8Array(B.byteLength), C = 64 * 1024;
|
|
10102
10102
|
Y(I, "SVGA image decode aborted");
|
|
10103
10103
|
for (let E = 0; E < B.byteLength; E += C) {
|
|
10104
10104
|
const o = Math.min(E + C, B.byteLength);
|
|
@@ -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,
|
|
@@ -10179,7 +10179,7 @@ function jo(B, A) {
|
|
|
10179
10179
|
return !!(B.startsWith("audio") || A.length >= 3 && A[0] === Rg[0] && A[1] === Rg[1] && A[2] === Rg[2]);
|
|
10180
10180
|
}
|
|
10181
10181
|
async function jI(B, A, I) {
|
|
10182
|
-
const g =
|
|
10182
|
+
const g = CA({ maxBudgetMs: A }), Q = new Uint8Array(B.byteLength), C = 64 * 1024;
|
|
10183
10183
|
Y(I, "SVGA parse aborted");
|
|
10184
10184
|
for (let E = 0; E < B.byteLength; E += C) {
|
|
10185
10185
|
const o = Math.min(E + C, B.byteLength);
|
|
@@ -10188,7 +10188,7 @@ async function jI(B, A, I) {
|
|
|
10188
10188
|
return Q.buffer;
|
|
10189
10189
|
}
|
|
10190
10190
|
async function Po(B, A, I) {
|
|
10191
|
-
const g = [], Q = /* @__PURE__ */ new Map(), C =
|
|
10191
|
+
const g = [], Q = /* @__PURE__ */ new Map(), C = CA({ maxBudgetMs: A });
|
|
10192
10192
|
for (const [E, o] of B.images) {
|
|
10193
10193
|
if (Y(I, "SVGA image collection aborted"), jo(E, o)) {
|
|
10194
10194
|
Q.set(E, await jI(o, A, I));
|
|
@@ -10199,7 +10199,7 @@ async function Po(B, A, I) {
|
|
|
10199
10199
|
return { imageEntries: g, audioBlobs: Q };
|
|
10200
10200
|
}
|
|
10201
10201
|
async function uB(B, A, I, g) {
|
|
10202
|
-
const Q = /* @__PURE__ */ new Map(), C = Math.max(2, Math.min(32, Math.floor(A))), E =
|
|
10202
|
+
const Q = /* @__PURE__ */ new Map(), C = Math.max(2, Math.min(32, Math.floor(A))), E = CA({
|
|
10203
10203
|
maxBudgetMs: Math.max(2, I)
|
|
10204
10204
|
});
|
|
10205
10205
|
try {
|
|
@@ -10216,7 +10216,7 @@ async function uB(B, A, I, g) {
|
|
|
10216
10216
|
throw t.close(), $("SVGA image decode aborted");
|
|
10217
10217
|
Q.set(e, t);
|
|
10218
10218
|
} catch (t) {
|
|
10219
|
-
if (
|
|
10219
|
+
if (JA(t)) throw t;
|
|
10220
10220
|
}
|
|
10221
10221
|
})
|
|
10222
10222
|
), o + C < B.length && E.shouldYield() && await E.yield();
|
|
@@ -10231,7 +10231,7 @@ async function HB(B, A, I) {
|
|
|
10231
10231
|
const g = /* @__PURE__ */ new Map();
|
|
10232
10232
|
if (B.length === 0) return g;
|
|
10233
10233
|
let Q = 4;
|
|
10234
|
-
const C = 2, E = 24, o =
|
|
10234
|
+
const C = 2, E = 24, o = CA({
|
|
10235
10235
|
maxBudgetMs: Math.max(2, A)
|
|
10236
10236
|
});
|
|
10237
10237
|
try {
|
|
@@ -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 (
|
|
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
|
);
|
|
@@ -10295,7 +10295,7 @@ async function _o(B, A) {
|
|
|
10295
10295
|
signal: A == null ? void 0 : A.signal
|
|
10296
10296
|
});
|
|
10297
10297
|
} catch (i) {
|
|
10298
|
-
if (
|
|
10298
|
+
if (JA(i)) throw i;
|
|
10299
10299
|
console.warn("[GiftStage:SVGA] image decode worker failed, using main thread", i), E = g.imageDecodeAdaptiveOnMainThread ? await HB(
|
|
10300
10300
|
Q,
|
|
10301
10301
|
g.imageDecodeFrameBudgetMs,
|
|
@@ -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 (
|
|
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 = {
|
|
@@ -10496,7 +10496,7 @@ async function $o(B, A) {
|
|
|
10496
10496
|
let I;
|
|
10497
10497
|
const g = typeof B == "string" ? `svga-payload:${B}` : null;
|
|
10498
10498
|
if (typeof B == "string") {
|
|
10499
|
-
if (I = new Uint8Array(await
|
|
10499
|
+
if (I = new Uint8Array(await xA(B)), Y(A == null ? void 0 : A.signal, "SVGA parse aborted"), g) {
|
|
10500
10500
|
const E = vg(g);
|
|
10501
10501
|
if (E) return E.params;
|
|
10502
10502
|
}
|
|
@@ -10513,7 +10513,7 @@ async function Ng(B, A) {
|
|
|
10513
10513
|
let I;
|
|
10514
10514
|
const g = typeof B == "string" ? `svga-payload:${B}` : null;
|
|
10515
10515
|
if (typeof B == "string") {
|
|
10516
|
-
if (I = new Uint8Array(await
|
|
10516
|
+
if (I = new Uint8Array(await xA(B)), Y(A == null ? void 0 : A.signal, "SVGA parse aborted"), g) {
|
|
10517
10517
|
const E = vg(g);
|
|
10518
10518
|
if (E)
|
|
10519
10519
|
return fg(
|
|
@@ -10927,7 +10927,7 @@ function Ce(B) {
|
|
|
10927
10927
|
);
|
|
10928
10928
|
}
|
|
10929
10929
|
}
|
|
10930
|
-
class
|
|
10930
|
+
class KA extends Error {
|
|
10931
10931
|
constructor(A, I) {
|
|
10932
10932
|
super(A, I), this.name = "SVGAAtlasWorkerBuildError";
|
|
10933
10933
|
}
|
|
@@ -10945,7 +10945,7 @@ function PI(B, A, I) {
|
|
|
10945
10945
|
}
|
|
10946
10946
|
for (const [g, Q] of NI)
|
|
10947
10947
|
Q.owner === B && (NI.delete(g), wI(Q), Q.releaseGate(), Q.reject(
|
|
10948
|
-
I == null || g === I ? A : new
|
|
10948
|
+
I == null || g === I ? A : new KA(
|
|
10949
10949
|
"SVGA atlas worker restarted after another request was canceled"
|
|
10950
10950
|
)
|
|
10951
10951
|
));
|
|
@@ -10977,7 +10977,7 @@ function ie() {
|
|
|
10977
10977
|
return;
|
|
10978
10978
|
}
|
|
10979
10979
|
if (NI.delete(C.id), C.error) {
|
|
10980
|
-
wI(E), E.releaseGate(), E.reject(new
|
|
10980
|
+
wI(E), E.releaseGate(), E.reject(new KA(C.error));
|
|
10981
10981
|
return;
|
|
10982
10982
|
}
|
|
10983
10983
|
const o = (g = C.pages) != null ? g : [];
|
|
@@ -11008,12 +11008,12 @@ function ie() {
|
|
|
11008
11008
|
}), B.addEventListener("error", (A) => {
|
|
11009
11009
|
PI(
|
|
11010
11010
|
B,
|
|
11011
|
-
new
|
|
11011
|
+
new KA(A.message || "SVGA atlas worker error")
|
|
11012
11012
|
);
|
|
11013
11013
|
}), B.addEventListener("messageerror", () => {
|
|
11014
11014
|
PI(
|
|
11015
11015
|
B,
|
|
11016
|
-
new
|
|
11016
|
+
new KA("SVGA atlas worker message deserialization failed")
|
|
11017
11017
|
);
|
|
11018
11018
|
});
|
|
11019
11019
|
}
|
|
@@ -11035,7 +11035,7 @@ async function oe(B, A) {
|
|
|
11035
11035
|
try {
|
|
11036
11036
|
C = ie();
|
|
11037
11037
|
} catch (o) {
|
|
11038
|
-
throw I(), new
|
|
11038
|
+
throw I(), new KA("SVGA atlas worker creation failed", { cause: o });
|
|
11039
11039
|
}
|
|
11040
11040
|
const E = Ee++;
|
|
11041
11041
|
return await new Promise((o, i) => {
|
|
@@ -11051,7 +11051,7 @@ async function oe(B, A) {
|
|
|
11051
11051
|
if (t.onAbort = () => {
|
|
11052
11052
|
PI(
|
|
11053
11053
|
C,
|
|
11054
|
-
new
|
|
11054
|
+
new KA("SVGA atlas worker task aborted", {
|
|
11055
11055
|
cause: $("SVGA atlas worker task aborted")
|
|
11056
11056
|
}),
|
|
11057
11057
|
E
|
|
@@ -11079,7 +11079,7 @@ async function oe(B, A) {
|
|
|
11079
11079
|
} catch (s) {
|
|
11080
11080
|
PI(
|
|
11081
11081
|
C,
|
|
11082
|
-
new
|
|
11082
|
+
new KA("SVGA atlas worker postMessage failed", {
|
|
11083
11083
|
cause: s
|
|
11084
11084
|
})
|
|
11085
11085
|
);
|
|
@@ -11140,7 +11140,7 @@ function UQ(B, A) {
|
|
|
11140
11140
|
}
|
|
11141
11141
|
async function se(B, A, I, g, Q) {
|
|
11142
11142
|
var C;
|
|
11143
|
-
const E =
|
|
11143
|
+
const E = CA({
|
|
11144
11144
|
maxBudgetMs: Q == null ? void 0 : Q.mainThreadFrameBudgetMs
|
|
11145
11145
|
}), o = async () => {
|
|
11146
11146
|
Y(Q == null ? void 0 : Q.signal, "SVGA atlas build aborted"), E.shouldYield() && await E.yield(), Y(Q == null ? void 0 : Q.signal, "SVGA atlas build aborted");
|
|
@@ -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) {
|
|
@@ -11216,7 +11216,7 @@ async function De(B, A, I, g, Q) {
|
|
|
11216
11216
|
h: a.h,
|
|
11217
11217
|
textureIndex: a.textureIndex
|
|
11218
11218
|
});
|
|
11219
|
-
const i = [], e =
|
|
11219
|
+
const i = [], e = CA({
|
|
11220
11220
|
maxBudgetMs: Q == null ? void 0 : Q.mainThreadFrameBudgetMs
|
|
11221
11221
|
});
|
|
11222
11222
|
try {
|
|
@@ -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);
|
|
@@ -11592,7 +11592,7 @@ function WB(B, A, I) {
|
|
|
11592
11592
|
});
|
|
11593
11593
|
}
|
|
11594
11594
|
let Je = 1;
|
|
11595
|
-
class
|
|
11595
|
+
class VA {
|
|
11596
11596
|
constructor(A, I, g, Q, C, E, o, i, e, a, t) {
|
|
11597
11597
|
O(this, "duration"), O(this, "videoWidth"), O(this, "videoHeight"), O(this, "timesSec"), O(this, "worker"), O(this, "workerMsgId"), O(this, "streaming"), O(this, "ring"), O(this, "frames"), O(this, "maxDecodedFrames"), O(this, "decodeAheadFrames"), O(this, "lastWrapped", -1), O(this, "lastEnsureNeedIdx", -1), O(this, "lastEnsureFreeSlots", -1), O(this, "destroyed", !1), this.duration = A, this.videoWidth = I, this.videoHeight = g, this.timesSec = Q, this.worker = C, this.workerMsgId = E, this.streaming = o, this.ring = i, this.frames = e, this.maxDecodedFrames = a, this.decodeAheadFrames = t;
|
|
11598
11598
|
}
|
|
@@ -11609,22 +11609,22 @@ class ZA {
|
|
|
11609
11609
|
if (typeof A == "string" ? e = await Le(A, I) : e = A, E && typeof Worker != "undefined") {
|
|
11610
11610
|
const a = e.slice(0);
|
|
11611
11611
|
try {
|
|
11612
|
-
return await
|
|
11612
|
+
return await VA.createViaWorker(a, o, i);
|
|
11613
11613
|
} catch (t) {
|
|
11614
11614
|
console.warn("[GiftStage:WC] Worker decode failed, falling back to main thread", t);
|
|
11615
11615
|
}
|
|
11616
11616
|
}
|
|
11617
|
-
return
|
|
11617
|
+
return VA.createOnMainThread(e, o, i);
|
|
11618
11618
|
}
|
|
11619
11619
|
static async createViaWorker(A, I, g) {
|
|
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 ZA {
|
|
|
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,15 +11655,15 @@ class ZA {
|
|
|
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=[${
|
|
11666
|
-
), new
|
|
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
|
+
), new VA(
|
|
11667
11667
|
o,
|
|
11668
11668
|
i,
|
|
11669
11669
|
e,
|
|
@@ -11692,7 +11692,7 @@ class ZA {
|
|
|
11692
11692
|
), a = i[i.length - 1], t = Ne(Q.durationSec, e, i), s = Q.videoWidth || a.displayWidth || a.codedWidth || 0, D = Q.videoHeight || a.displayHeight || a.codedHeight || 0, h = e.length > 0 ? e[0] : 0, w = e.length > 0 ? e[e.length - 1] : 0;
|
|
11693
11693
|
return console.info(
|
|
11694
11694
|
`[GiftStage:WC] main decode ok frames=${i.length} duration=${t.toFixed(4)}s size=${s}x${D} times=[${h.toFixed(4)} … ${w.toFixed(4)}]`
|
|
11695
|
-
), new
|
|
11695
|
+
), new VA(
|
|
11696
11696
|
t,
|
|
11697
11697
|
s,
|
|
11698
11698
|
D,
|
|
@@ -11772,12 +11772,12 @@ class ZA {
|
|
|
11772
11772
|
}
|
|
11773
11773
|
}
|
|
11774
11774
|
async function Le(B, A) {
|
|
11775
|
-
return
|
|
11775
|
+
return xA(B, A);
|
|
11776
11776
|
}
|
|
11777
11777
|
function ZB(B, A, I, g, Q) {
|
|
11778
11778
|
const C = Math.max(1, Math.floor(A)), E = Math.max(1, Math.floor(I)), o = Math.max(1, B.width * B.scale), i = Math.max(1, B.height * B.scale);
|
|
11779
11779
|
let e;
|
|
11780
|
-
const a =
|
|
11780
|
+
const a = DA(B);
|
|
11781
11781
|
if (a === "contain" || a === "cover") {
|
|
11782
11782
|
let t, s;
|
|
11783
11783
|
if (g === "alphaVideo")
|
|
@@ -11785,7 +11785,7 @@ function ZB(B, A, I, g, Q) {
|
|
|
11785
11785
|
else {
|
|
11786
11786
|
if (!Q)
|
|
11787
11787
|
return e = Math.min(1, o / C, i / E), kg(C, E, e);
|
|
11788
|
-
({ w: t, h: s } =
|
|
11788
|
+
({ w: t, h: s } = mA(Q.info));
|
|
11789
11789
|
}
|
|
11790
11790
|
if (!(t > 0) || !(s > 0))
|
|
11791
11791
|
return e = Math.min(1, o / C, i / E), kg(C, E, e);
|
|
@@ -11799,7 +11799,7 @@ function kg(B, A, I) {
|
|
|
11799
11799
|
const g = Math.max(1, Math.min(B, Math.ceil(B * I))), Q = Math.max(1, Math.min(A, Math.ceil(A * I)));
|
|
11800
11800
|
return { w: g, h: Q };
|
|
11801
11801
|
}
|
|
11802
|
-
var fe = Object.defineProperty, ue = (B, A, I) => A in B ? fe(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
11802
|
+
var fe = Object.defineProperty, ue = (B, A, I) => A in B ? fe(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, oA = (B, A, I) => ue(B, typeof A != "symbol" ? A + "" : A, I);
|
|
11803
11803
|
const SI = 9;
|
|
11804
11804
|
function He(B, A) {
|
|
11805
11805
|
if (typeof document == "undefined" || typeof document.createElement != "function")
|
|
@@ -11967,14 +11967,14 @@ 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
|
}
|
|
11975
11975
|
class We {
|
|
11976
11976
|
constructor(A, I, g, Q, C, E = !0) {
|
|
11977
|
-
this.config = A, this.frameMap = I,
|
|
11977
|
+
this.config = A, this.frameMap = I, oA(this, "canvas"), oA(this, "gl"), oA(this, "program"), oA(this, "vertexShader"), oA(this, "fragmentShader"), oA(this, "vertexBuffer"), oA(this, "videoTexture"), oA(this, "imagePosLoc"), oA(this, "imagePositionsScratch"), oA(this, "resourceEntries"), oA(this, "textureUnitBySrcId", /* @__PURE__ */ new Map()), oA(this, "videoTextureWidth", 1), oA(this, "videoTextureHeight", 1);
|
|
11978
11978
|
var o;
|
|
11979
11979
|
if (g.size === 0) throw new Error("VAP mix composer requires at least one slot resource");
|
|
11980
11980
|
this.canvas = He(Q, C);
|
|
@@ -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);
|
|
@@ -12064,14 +12064,14 @@ class We {
|
|
|
12064
12064
|
I == null || I.loseContext();
|
|
12065
12065
|
}
|
|
12066
12066
|
}
|
|
12067
|
-
var Ze = Object.defineProperty, Ve = (B, A, I) => A in B ? Ze(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
12068
|
-
const dQ = 1397178947, KQ = 14, ve = 8,
|
|
12067
|
+
var Ze = Object.defineProperty, Ve = (B, A, I) => A in B ? Ze(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, NA = (B, A, I) => Ve(B, typeof A != "symbol" ? A + "" : A, I);
|
|
12068
|
+
const dQ = 1397178947, KQ = 14, ve = 8, yA = 64 * 1024;
|
|
12069
12069
|
function JQ(B) {
|
|
12070
12070
|
return B + 3 & -4;
|
|
12071
12071
|
}
|
|
12072
12072
|
class Xe {
|
|
12073
12073
|
constructor(A = 1024) {
|
|
12074
|
-
|
|
12074
|
+
NA(this, "buffer"), NA(this, "view"), NA(this, "bytes"), NA(this, "offset", 0), NA(this, "encoder", new TextEncoder()), this.buffer = new ArrayBuffer(A), this.view = new DataView(this.buffer), this.bytes = new Uint8Array(this.buffer);
|
|
12075
12075
|
}
|
|
12076
12076
|
ensure(A) {
|
|
12077
12077
|
const I = this.offset + A;
|
|
@@ -12087,8 +12087,8 @@ class Xe {
|
|
|
12087
12087
|
let Q = this.buffer.byteLength;
|
|
12088
12088
|
for (; Q < g; ) Q *= 2;
|
|
12089
12089
|
const C = new ArrayBuffer(Q), E = new Uint8Array(C);
|
|
12090
|
-
for (let o = 0; o < this.offset; o +=
|
|
12091
|
-
const i = Math.min(o +
|
|
12090
|
+
for (let o = 0; o < this.offset; o += yA) {
|
|
12091
|
+
const i = Math.min(o + yA, this.offset);
|
|
12092
12092
|
E.set(this.bytes.subarray(o, i), o), i < this.offset && await (I == null ? void 0 : I());
|
|
12093
12093
|
}
|
|
12094
12094
|
this.buffer = C, this.view = new DataView(this.buffer), this.bytes = E;
|
|
@@ -12119,8 +12119,8 @@ class Xe {
|
|
|
12119
12119
|
}
|
|
12120
12120
|
async rawBytesCooperative(A, I) {
|
|
12121
12121
|
await this.ensureCooperative(A.byteLength, I);
|
|
12122
|
-
for (let g = 0; g < A.byteLength; g +=
|
|
12123
|
-
const Q = Math.min(g +
|
|
12122
|
+
for (let g = 0; g < A.byteLength; g += yA) {
|
|
12123
|
+
const Q = Math.min(g + yA, A.byteLength);
|
|
12124
12124
|
this.bytes.set(A.subarray(g, Q), this.offset), this.offset += Q - g, Q < A.byteLength && await (I == null ? void 0 : I());
|
|
12125
12125
|
}
|
|
12126
12126
|
}
|
|
@@ -12139,8 +12139,8 @@ class Xe {
|
|
|
12139
12139
|
}
|
|
12140
12140
|
async finishCooperative(A) {
|
|
12141
12141
|
const I = new Uint8Array(this.offset), g = this.bytes.subarray(0, this.offset);
|
|
12142
|
-
for (let Q = 0; Q < g.byteLength; Q +=
|
|
12143
|
-
const C = Math.min(Q +
|
|
12142
|
+
for (let Q = 0; Q < g.byteLength; Q += yA) {
|
|
12143
|
+
const C = Math.min(Q + yA, g.byteLength);
|
|
12144
12144
|
I.set(g.subarray(Q, C), Q), C < g.byteLength && A.shouldYield() && await A.yield();
|
|
12145
12145
|
}
|
|
12146
12146
|
return I.buffer;
|
|
@@ -12148,7 +12148,7 @@ class Xe {
|
|
|
12148
12148
|
}
|
|
12149
12149
|
class Oe {
|
|
12150
12150
|
constructor(A) {
|
|
12151
|
-
this.buffer = A,
|
|
12151
|
+
this.buffer = A, NA(this, "view"), NA(this, "bytes"), NA(this, "offset", 0), NA(this, "decoder", new TextDecoder()), this.view = new DataView(A), this.bytes = new Uint8Array(A);
|
|
12152
12152
|
}
|
|
12153
12153
|
get position() {
|
|
12154
12154
|
return this.offset;
|
|
@@ -12187,8 +12187,8 @@ class Oe {
|
|
|
12187
12187
|
const I = this.u32(), g = this.bytes.subarray(this.offset, this.offset + I);
|
|
12188
12188
|
this.offset += I;
|
|
12189
12189
|
const Q = new Uint8Array(I);
|
|
12190
|
-
for (let C = 0; C < I; C +=
|
|
12191
|
-
const E = Math.min(C +
|
|
12190
|
+
for (let C = 0; C < I; C += yA) {
|
|
12191
|
+
const E = Math.min(C + yA, I);
|
|
12192
12192
|
Q.set(g.subarray(C, E), C), E < I && A.shouldYield() && await A.yield();
|
|
12193
12193
|
}
|
|
12194
12194
|
return Q.buffer;
|
|
@@ -12218,24 +12218,24 @@ function LQ(B) {
|
|
|
12218
12218
|
for (const E of C) g += ((I = (A = E.pathData) == null ? void 0 : A.length) != null ? I : 0) * 2 + 96;
|
|
12219
12219
|
return g;
|
|
12220
12220
|
}
|
|
12221
|
-
async function
|
|
12221
|
+
async function aA(B) {
|
|
12222
12222
|
B.shouldYield() && await B.yield();
|
|
12223
12223
|
}
|
|
12224
12224
|
async function je(B, A) {
|
|
12225
12225
|
var I, g, Q;
|
|
12226
|
-
const C = B.spriteTable, E =
|
|
12226
|
+
const C = B.spriteTable, E = CA({ maxBudgetMs: A }), o = () => aA(E), i = new Xe(ve + LQ(B) + yA);
|
|
12227
12227
|
i.u32(dQ), i.u16(KQ), i.u16(0), i.f32(B.params.viewBoxWidth), i.f32(B.params.viewBoxHeight), i.f32(B.params.fps), i.u32(B.params.frames), i.u32(B.atlasPages.length);
|
|
12228
12228
|
for (const e of B.atlasPages)
|
|
12229
|
-
i.u32(e.width), i.u32(e.height), await i.bytesValueCooperative(new Uint8Array(e.imageBytes), o), await
|
|
12229
|
+
i.u32(e.width), i.u32(e.height), await i.bytesValueCooperative(new Uint8Array(e.imageBytes), o), await aA(E);
|
|
12230
12230
|
i.u32(B.atlasRects.size);
|
|
12231
12231
|
for (const [e, a] of B.atlasRects)
|
|
12232
|
-
await i.stringCooperative(e, o), i.u32((I = a.textureIndex) != null ? I : 0), i.f32(a.x), i.f32(a.y), i.f32(a.w), i.f32(a.h), await
|
|
12232
|
+
await i.stringCooperative(e, o), i.u32((I = a.textureIndex) != null ? I : 0), i.f32(a.x), i.f32(a.y), i.f32(a.w), i.f32(a.h), await aA(E);
|
|
12233
12233
|
i.u32(B.audios.length);
|
|
12234
12234
|
for (const e of B.audios)
|
|
12235
|
-
await i.stringCooperative(e.audioKey, o), i.u32(e.startFrame), i.u32(e.endFrame), i.f32(e.startTime), i.f32(e.totalTime), await
|
|
12235
|
+
await i.stringCooperative(e.audioKey, o), i.u32(e.startFrame), i.u32(e.endFrame), i.f32(e.startTime), i.f32(e.totalTime), await aA(E);
|
|
12236
12236
|
i.u32(B.audioBlobs.size);
|
|
12237
12237
|
for (const [e, a] of B.audioBlobs)
|
|
12238
|
-
await i.stringCooperative(e, o), await i.bytesValueCooperative(new Uint8Array(a), o), await
|
|
12238
|
+
await i.stringCooperative(e, o), await i.bytesValueCooperative(new Uint8Array(a), o), await aA(E);
|
|
12239
12239
|
if (await Uo(i, C, o), i.u32((Q = (g = B.clipMeshes) == null ? void 0 : g.size) != null ? Q : 0), B.clipMeshes)
|
|
12240
12240
|
for (const [e, a] of B.clipMeshes)
|
|
12241
12241
|
await i.stringCooperative(e, o), await i.bytesValueCooperative(
|
|
@@ -12244,11 +12244,11 @@ async function je(B, A) {
|
|
|
12244
12244
|
), await i.bytesValueCooperative(
|
|
12245
12245
|
new Uint8Array(a.indices.buffer, a.indices.byteOffset, a.indices.byteLength),
|
|
12246
12246
|
o
|
|
12247
|
-
), await
|
|
12247
|
+
), await aA(E);
|
|
12248
12248
|
return i.finishCooperative(E);
|
|
12249
12249
|
}
|
|
12250
12250
|
async function Pe(B, A) {
|
|
12251
|
-
const I =
|
|
12251
|
+
const I = CA({ maxBudgetMs: A }), g = new Oe(B);
|
|
12252
12252
|
if (g.u32() !== dQ) throw new Error("Invalid SVGA cache binary magic");
|
|
12253
12253
|
if (g.u16() !== KQ) throw new Error("Unsupported SVGA cache binary version");
|
|
12254
12254
|
g.u16();
|
|
@@ -12258,39 +12258,39 @@ 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(),
|
|
12272
12272
|
w: g.f32(),
|
|
12273
12273
|
h: g.f32()
|
|
12274
|
-
}), await
|
|
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(),
|
|
12281
12281
|
endFrame: g.u32(),
|
|
12282
12282
|
startTime: g.f32(),
|
|
12283
12283
|
totalTime: g.f32()
|
|
12284
|
-
}), await
|
|
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
|
-
const D = await GQ(g, () =>
|
|
12291
|
-
for (let
|
|
12292
|
-
const
|
|
12293
|
-
|
|
12290
|
+
const D = await GQ(g, () => aA(I)), h = g.u32(), w = /* @__PURE__ */ new Map();
|
|
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,
|
|
@@ -12324,15 +12324,15 @@ async function Ug(B, A, I = {}) {
|
|
|
12324
12324
|
const g = await je(A, I.frameBudgetMs);
|
|
12325
12325
|
aQ(pg(B), "svga-asset", A, Math.max(g.byteLength, LQ(A))), await wi(mg(B), g);
|
|
12326
12326
|
}
|
|
12327
|
-
function
|
|
12327
|
+
function YA(B) {
|
|
12328
12328
|
return typeof B == "number" && Number.isFinite(B) && B > 0;
|
|
12329
12329
|
}
|
|
12330
12330
|
function _e(B, A) {
|
|
12331
|
-
const I =
|
|
12331
|
+
const I = YA(B) ? B * 0.5 : 0, g = YA(A) ? A : 0;
|
|
12332
12332
|
return { width: I, height: g };
|
|
12333
12333
|
}
|
|
12334
12334
|
function $e(B, A, I, g) {
|
|
12335
|
-
const Q =
|
|
12335
|
+
const Q = YA(A.width) ? A.width : void 0, C = YA(A.height) ? A.height : void 0, E = YA(B.width) ? B.width : void 0, o = YA(B.height) ? B.height : void 0, i = B.useOriginalSize === !0;
|
|
12336
12336
|
if (E && o)
|
|
12337
12337
|
return { width: E, height: o };
|
|
12338
12338
|
if (E)
|
|
@@ -12346,7 +12346,7 @@ function $e(B, A, I, g) {
|
|
|
12346
12346
|
height: o
|
|
12347
12347
|
} : { width: o, height: o };
|
|
12348
12348
|
let e = Q != null ? Q : 0, a = C != null ? C : 0;
|
|
12349
|
-
if (e > 0 && a > 0 &&
|
|
12349
|
+
if (e > 0 && a > 0 && YA(I) && YA(g) && (!i || e > I || a > g)) {
|
|
12350
12350
|
const t = Math.min(I / e, g / a);
|
|
12351
12351
|
e *= t, a *= t;
|
|
12352
12352
|
}
|
|
@@ -12402,7 +12402,7 @@ function XB(B, A) {
|
|
|
12402
12402
|
}
|
|
12403
12403
|
async function Yg(B, A) {
|
|
12404
12404
|
Y(A, "Image loading aborted");
|
|
12405
|
-
const I = typeof B == "string" ? await
|
|
12405
|
+
const I = typeof B == "string" ? await xA(B, A) : B;
|
|
12406
12406
|
Y(A, "Image loading aborted");
|
|
12407
12407
|
const g = new Uint8Array(I), Q = new Blob([g], { type: Aa(B, g) });
|
|
12408
12408
|
if (typeof createImageBitmap == "function") {
|
|
@@ -12431,7 +12431,7 @@ async function Yg(B, A) {
|
|
|
12431
12431
|
}
|
|
12432
12432
|
return XB(Q, A);
|
|
12433
12433
|
}
|
|
12434
|
-
var Ia = Object.defineProperty, ga = (B, A, I) => A in B ? Ia(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I,
|
|
12434
|
+
var Ia = Object.defineProperty, ga = (B, A, I) => A in B ? Ia(B, A, { enumerable: !0, configurable: !0, writable: !0, value: I }) : B[A] = I, H = (B, A, I) => ga(B, typeof A != "symbol" ? A + "" : A, I);
|
|
12435
12435
|
function OB(B) {
|
|
12436
12436
|
return Number.isFinite(B) ? Math.max(0, Math.min(1, B)) : 1;
|
|
12437
12437
|
}
|
|
@@ -12439,7 +12439,7 @@ function Ba(B) {
|
|
|
12439
12439
|
return "delayMs" in B;
|
|
12440
12440
|
}
|
|
12441
12441
|
const v = "GiftStage load canceled";
|
|
12442
|
-
function
|
|
12442
|
+
function kA(B) {
|
|
12443
12443
|
let A = !1;
|
|
12444
12444
|
return () => {
|
|
12445
12445
|
A || (A = !0, B());
|
|
@@ -12451,9 +12451,9 @@ function Qa(B, A = typeof navigator != "undefined" ? navigator.hardwareConcurren
|
|
|
12451
12451
|
const I = A != null && Number.isFinite(A) && A > 0 ? Math.floor(A) : 4;
|
|
12452
12452
|
return Math.max(1, Math.min(4, Math.floor(I / 2)));
|
|
12453
12453
|
}
|
|
12454
|
-
const
|
|
12454
|
+
const wA = class BA {
|
|
12455
12455
|
constructor(A) {
|
|
12456
|
-
|
|
12456
|
+
H(this, "sharedSVGAEntities", /* @__PURE__ */ new Map()), H(this, "pendingSharedSVGAEntities", /* @__PURE__ */ new Map()), H(this, "sharedVideoSources", /* @__PURE__ */ new Map()), H(this, "sharedHtmlVideos", /* @__PURE__ */ new Map()), H(this, "sharedVideoTextures", /* @__PURE__ */ new Map()), H(this, "pendingSharedHtmlVideos", /* @__PURE__ */ new Map()), H(this, "sharedImageTextures", /* @__PURE__ */ new Map()), H(this, "pendingSharedImageTextures", /* @__PURE__ */ new Map()), H(this, "sharedWebCodecsPlaybacks", /* @__PURE__ */ new Map()), H(this, "pendingSharedWebCodecsPlaybacks", /* @__PURE__ */ new Map()), H(this, "sharedWebCodecsSurfaces", /* @__PURE__ */ new Map()), H(this, "completedPlaybackSlots", /* @__PURE__ */ new Set()), H(this, "playbackCompleteWaiters", /* @__PURE__ */ new Map()), H(this, "canvas"), H(this, "backend", null), H(this, "manager", null), H(this, "options"), H(this, "ready"), H(this, "destroyed", !1), H(this, "resizeObserver", null), H(this, "nextRenderOrder", 0), H(this, "nextSharedWebCodecsPlaybackId", 1), H(this, "nextSharedWebCodecsSurfaceId", 1), H(this, "onWindowLayout", () => {
|
|
12457
12457
|
this.destroyed || this.syncCanvasSize();
|
|
12458
12458
|
}), 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();
|
|
12459
12459
|
}
|
|
@@ -12474,8 +12474,8 @@ const zA = class fA {
|
|
|
12474
12474
|
var A, I;
|
|
12475
12475
|
this.syncCanvasSize(), await new Promise((E) => requestAnimationFrame(() => E())), this.syncCanvasSize(), ti({
|
|
12476
12476
|
maxConcurrent: this.resourcePipelineConcurrency(),
|
|
12477
|
-
maxMemoryBytes:
|
|
12478
|
-
maxPersistentBytes:
|
|
12477
|
+
maxMemoryBytes: BA.DEFAULT_RESOURCE_CACHE_MEMORY_BYTES,
|
|
12478
|
+
maxPersistentBytes: BA.DEFAULT_RESOURCE_CACHE_PERSISTENT_BYTES
|
|
12479
12479
|
}), Tg((A = this.options.svgaWorkerTaskConcurrency) != null ? A : 1);
|
|
12480
12480
|
const g = (I = this.options.preferWebGPU) != null ? I : !0, Q = this.options.antialias, [C] = await Promise.all([
|
|
12481
12481
|
yC(this.canvas, g, Q, this.options.forceWebGL1 === !0),
|
|
@@ -12513,7 +12513,7 @@ const zA = class fA {
|
|
|
12513
12513
|
if (!this.isSlotLoadActive(A)) throw new Error(v);
|
|
12514
12514
|
}
|
|
12515
12515
|
isLoadCanceled(A) {
|
|
12516
|
-
return
|
|
12516
|
+
return JA(A) || A instanceof Error && A.message === v;
|
|
12517
12517
|
}
|
|
12518
12518
|
currentCanvasCssSize() {
|
|
12519
12519
|
const A = this.canvas.clientWidth || this.options.container.clientWidth || window.innerWidth || 0, I = this.canvas.clientHeight || this.options.container.clientHeight || window.innerHeight || 0;
|
|
@@ -12530,7 +12530,7 @@ const zA = class fA {
|
|
|
12530
12530
|
}
|
|
12531
12531
|
case "vap": {
|
|
12532
12532
|
if (!A.config) throw new Error("VAP requires config");
|
|
12533
|
-
const I = await nB(A.config), g =
|
|
12533
|
+
const I = await nB(A.config), g = mA(I.info);
|
|
12534
12534
|
return { width: g.w, height: g.h };
|
|
12535
12535
|
}
|
|
12536
12536
|
case "alphaVideo":
|
|
@@ -12634,16 +12634,16 @@ const zA = class fA {
|
|
|
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 zA = class fA {
|
|
|
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,
|
|
@@ -12697,6 +12697,8 @@ const zA = class fA {
|
|
|
12697
12697
|
loopCount: 0,
|
|
12698
12698
|
videoEntity: null,
|
|
12699
12699
|
loadAbortController: new AbortController(),
|
|
12700
|
+
videoPlaybackWatchdogTimer: null,
|
|
12701
|
+
videoPlaybackCompletionStarted: !1,
|
|
12700
12702
|
svgaSlotTextures: void 0,
|
|
12701
12703
|
videoElement: null,
|
|
12702
12704
|
releaseMediaSource: null,
|
|
@@ -12708,59 +12710,60 @@ const zA = class fA {
|
|
|
12708
12710
|
releaseWebCodecsPlayback: null,
|
|
12709
12711
|
wcPlaybackTime: 0,
|
|
12710
12712
|
videoTextureHandle: null,
|
|
12711
|
-
imageTextureHandle: (Q =
|
|
12712
|
-
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,
|
|
12713
12715
|
webcodecsSurface: null,
|
|
12714
12716
|
releaseWebCodecsSurface: null,
|
|
12715
12717
|
vapMixState: null,
|
|
12718
|
+
onFrame: s.onFrame,
|
|
12716
12719
|
onComplete: void 0
|
|
12717
12720
|
};
|
|
12718
|
-
let
|
|
12719
|
-
|
|
12720
|
-
id:
|
|
12721
|
-
type:
|
|
12721
|
+
let c;
|
|
12722
|
+
c = {
|
|
12723
|
+
id: D,
|
|
12724
|
+
type: s.type,
|
|
12722
12725
|
pause: () => {
|
|
12723
|
-
var
|
|
12724
|
-
n.paused = !0, (
|
|
12726
|
+
var G;
|
|
12727
|
+
n.paused = !0, (G = this.manager) == null || G.postAnimator.pauseForGift(n.id);
|
|
12725
12728
|
},
|
|
12726
12729
|
resume: () => {
|
|
12727
|
-
var
|
|
12728
|
-
n.paused = !1, (
|
|
12730
|
+
var G;
|
|
12731
|
+
n.paused = !1, (G = this.manager) == null || G.postAnimator.resumeForGift(n.id);
|
|
12729
12732
|
},
|
|
12730
12733
|
destroy: () => {
|
|
12731
|
-
this.removeGift(
|
|
12734
|
+
this.removeGift(D);
|
|
12732
12735
|
},
|
|
12733
|
-
animate: (
|
|
12736
|
+
animate: (G) => this.createGiftAnimationChain(n, c, G)
|
|
12734
12737
|
};
|
|
12735
|
-
const
|
|
12736
|
-
n.onComplete = (
|
|
12737
|
-
this.markGiftPlaybackComplete(n.id),
|
|
12738
|
-
}, 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);
|
|
12739
12742
|
try {
|
|
12740
|
-
switch (
|
|
12743
|
+
switch (s.type) {
|
|
12741
12744
|
case "svga":
|
|
12742
12745
|
await this.loadSVGA(n);
|
|
12743
12746
|
break;
|
|
12744
12747
|
case "vap":
|
|
12745
|
-
await this.loadVAP(n,
|
|
12748
|
+
await this.loadVAP(n, s);
|
|
12746
12749
|
break;
|
|
12747
12750
|
case "alphaVideo":
|
|
12748
|
-
await this.loadAlphaVideo(n,
|
|
12751
|
+
await this.loadAlphaVideo(n, s);
|
|
12749
12752
|
break;
|
|
12750
12753
|
case "image":
|
|
12751
12754
|
break;
|
|
12752
12755
|
}
|
|
12753
|
-
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", {
|
|
12754
12757
|
giftId: n.id,
|
|
12755
12758
|
type: n.type,
|
|
12756
12759
|
layoutBufPx: { x: n.x, y: n.y, w: n.width, h: n.height }
|
|
12757
|
-
}),
|
|
12758
|
-
} catch (
|
|
12759
|
-
if (this.isLoadCanceled(
|
|
12760
|
-
return ((
|
|
12761
|
-
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)));
|
|
12762
12765
|
}
|
|
12763
|
-
return
|
|
12766
|
+
return c;
|
|
12764
12767
|
}
|
|
12765
12768
|
async loadSVGA(A) {
|
|
12766
12769
|
var I, g, Q, C;
|
|
@@ -12797,10 +12800,10 @@ const zA = class fA {
|
|
|
12797
12800
|
audios: i.audios,
|
|
12798
12801
|
audioBlobs: a,
|
|
12799
12802
|
atlasRects: t.rects,
|
|
12800
|
-
atlasPages: t.pages.map((w,
|
|
12803
|
+
atlasPages: t.pages.map((w, r) => ({
|
|
12801
12804
|
width: w.atlasWidth,
|
|
12802
12805
|
height: w.atlasHeight,
|
|
12803
|
-
imageBytes: h[
|
|
12806
|
+
imageBytes: h[r]
|
|
12804
12807
|
}))
|
|
12805
12808
|
},
|
|
12806
12809
|
{ frameBudgetMs: this.options.svgaLoadFrameBudgetMs }
|
|
@@ -12895,8 +12898,8 @@ const zA = class fA {
|
|
|
12895
12898
|
try {
|
|
12896
12899
|
a = await this.buildSVGAAtlasIfNeeded(e.imageBitmaps, !0, !0, I);
|
|
12897
12900
|
} catch (w) {
|
|
12898
|
-
if (
|
|
12899
|
-
for (const
|
|
12901
|
+
if (JA(w) || !(w instanceof KA)) throw w;
|
|
12902
|
+
for (const r of e.imageBitmaps.values()) r.close();
|
|
12900
12903
|
e = await Ng(A, this.svgaParseOptions(I)), a = await this.buildSVGAAtlasIfNeeded(e.imageBitmaps, !0, !1, I);
|
|
12901
12904
|
}
|
|
12902
12905
|
const { movie: t, audioBlobs: s } = e, D = {
|
|
@@ -12916,9 +12919,9 @@ const zA = class fA {
|
|
|
12916
12919
|
});
|
|
12917
12920
|
const h = this.manager.snapshotSVGAClipMeshes(D);
|
|
12918
12921
|
if (Y(I, v), a && a.encodedPngBytesPromises) {
|
|
12919
|
-
const w = a,
|
|
12920
|
-
Promise.all(
|
|
12921
|
-
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(
|
|
12922
12925
|
A,
|
|
12923
12926
|
{
|
|
12924
12927
|
params: t.params,
|
|
@@ -12926,10 +12929,10 @@ const zA = class fA {
|
|
|
12926
12929
|
audios: t.audios,
|
|
12927
12930
|
audioBlobs: s,
|
|
12928
12931
|
atlasRects: w.rects,
|
|
12929
|
-
atlasPages: w.pages.map((c,
|
|
12932
|
+
atlasPages: w.pages.map((c, F) => ({
|
|
12930
12933
|
width: c.atlasWidth,
|
|
12931
12934
|
height: c.atlasHeight,
|
|
12932
|
-
imageBytes: F
|
|
12935
|
+
imageBytes: n[F]
|
|
12933
12936
|
})),
|
|
12934
12937
|
clipMeshes: h
|
|
12935
12938
|
},
|
|
@@ -12965,7 +12968,7 @@ const zA = class fA {
|
|
|
12965
12968
|
}
|
|
12966
12969
|
async createCachedSVGAAtlasTextures(A, I) {
|
|
12967
12970
|
var g;
|
|
12968
|
-
const Q = [], C =
|
|
12971
|
+
const Q = [], C = CA({
|
|
12969
12972
|
maxBudgetMs: this.svgaAtlasFrameBudgetMs()
|
|
12970
12973
|
});
|
|
12971
12974
|
try {
|
|
@@ -13011,7 +13014,7 @@ const zA = class fA {
|
|
|
13011
13014
|
}
|
|
13012
13015
|
async finishLoadSVGA(A, I, g) {
|
|
13013
13016
|
var Q;
|
|
13014
|
-
const C =
|
|
13017
|
+
const C = CA({
|
|
13015
13018
|
maxBudgetMs: this.options.svgaLoadFrameBudgetMs
|
|
13016
13019
|
});
|
|
13017
13020
|
let E = 0;
|
|
@@ -13035,7 +13038,7 @@ const zA = class fA {
|
|
|
13035
13038
|
}
|
|
13036
13039
|
svgaAtlasMaxSize() {
|
|
13037
13040
|
var A, I, g;
|
|
13038
|
-
const Q = (A = this.options.svgaAtlasMaxSize) != null ? A :
|
|
13041
|
+
const Q = (A = this.options.svgaAtlasMaxSize) != null ? A : BA.SVGA_ATLAS_MAX_SIZE, C = (g = (I = this.backend) == null ? void 0 : I.maxTextureSize) != null ? g : Q;
|
|
13039
13042
|
return Math.max(64, Math.min(C, Q));
|
|
13040
13043
|
}
|
|
13041
13044
|
async buildSVGAAtlasIfNeeded(A, I, g = !0, Q) {
|
|
@@ -13045,7 +13048,7 @@ const zA = class fA {
|
|
|
13045
13048
|
A,
|
|
13046
13049
|
this.backend,
|
|
13047
13050
|
this.svgaAtlasMaxSize(),
|
|
13048
|
-
|
|
13051
|
+
BA.SVGA_ATLAS_PADDING,
|
|
13049
13052
|
{
|
|
13050
13053
|
captureEncodedPng: I,
|
|
13051
13054
|
maxPages: this.svgaAtlasMaxPages(),
|
|
@@ -13060,8 +13063,8 @@ const zA = class fA {
|
|
|
13060
13063
|
var A;
|
|
13061
13064
|
return Math.max(1, Math.floor((A = this.options.svgaAtlasMaxPages) != null ? A : 4));
|
|
13062
13065
|
}
|
|
13063
|
-
shouldTryWebCodecs() {
|
|
13064
|
-
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";
|
|
13065
13068
|
}
|
|
13066
13069
|
/** DevTools: filter by `[GiftStage]` to see WebCodecs vs <video> per gift. */
|
|
13067
13070
|
logPlaybackBackend(A, I, g) {
|
|
@@ -13071,9 +13074,9 @@ const zA = class fA {
|
|
|
13071
13074
|
async tryWebCodecsPlayback(A, I) {
|
|
13072
13075
|
if (!this.shouldTryWebCodecs()) return null;
|
|
13073
13076
|
try {
|
|
13074
|
-
const g = typeof A == "string" ? await
|
|
13077
|
+
const g = typeof A == "string" ? await xA(A, I) : A;
|
|
13075
13078
|
if (I != null && I.aborted) throw new Error(v);
|
|
13076
|
-
return await
|
|
13079
|
+
return await VA.create(g, I, {
|
|
13077
13080
|
useWorker: this.options.webCodecsDecodeInWorker !== !1,
|
|
13078
13081
|
maxDecodedFrames: this.options.webCodecsMaxDecodedFrames,
|
|
13079
13082
|
decodeAheadFrames: this.options.webCodecsDecodeAheadFrames
|
|
@@ -13085,7 +13088,7 @@ const zA = class fA {
|
|
|
13085
13088
|
}
|
|
13086
13089
|
}
|
|
13087
13090
|
async acquireWebCodecsPlayback(A, I) {
|
|
13088
|
-
if (!this.shouldTryWebCodecs()) return null;
|
|
13091
|
+
if (!this.shouldTryWebCodecs(A)) return null;
|
|
13089
13092
|
if (this.options.shareIdenticalVideoPlayback !== !1 && A.loop === 0 && typeof A.source == "string") {
|
|
13090
13093
|
const Q = this.normalizeSharedVideoSourceKey(A.source);
|
|
13091
13094
|
if (Q) return this.acquireSharedWebCodecsPlayback(Q, I);
|
|
@@ -13094,14 +13097,14 @@ const zA = class fA {
|
|
|
13094
13097
|
return g ? {
|
|
13095
13098
|
playback: g,
|
|
13096
13099
|
sharedState: null,
|
|
13097
|
-
release:
|
|
13100
|
+
release: kA(() => g.destroy())
|
|
13098
13101
|
} : null;
|
|
13099
13102
|
}
|
|
13100
13103
|
async acquireSharedWebCodecsPlayback(A, I) {
|
|
13101
13104
|
var g;
|
|
13102
13105
|
const Q = performance.now(), C = Math.max(
|
|
13103
13106
|
0,
|
|
13104
|
-
(g = this.options.sharedVideoPlaybackWindowMs) != null ? g :
|
|
13107
|
+
(g = this.options.sharedVideoPlaybackWindowMs) != null ? g : BA.DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS
|
|
13105
13108
|
), E = this.sharedWebCodecsPlaybacks.get(A);
|
|
13106
13109
|
if (E) {
|
|
13107
13110
|
for (const e of E)
|
|
@@ -13109,7 +13112,7 @@ const zA = class fA {
|
|
|
13109
13112
|
return e.refs++, {
|
|
13110
13113
|
playback: e.playback,
|
|
13111
13114
|
sharedState: e,
|
|
13112
|
-
release:
|
|
13115
|
+
release: kA(() => this.releaseSharedWebCodecsPlayback(e))
|
|
13113
13116
|
};
|
|
13114
13117
|
}
|
|
13115
13118
|
let o = this.pendingSharedWebCodecsPlaybacks.get(A);
|
|
@@ -13118,7 +13121,7 @@ const zA = class fA {
|
|
|
13118
13121
|
return i ? (i.refs++, {
|
|
13119
13122
|
playback: i.playback,
|
|
13120
13123
|
sharedState: i,
|
|
13121
|
-
release:
|
|
13124
|
+
release: kA(() => this.releaseSharedWebCodecsPlayback(i))
|
|
13122
13125
|
}) : null;
|
|
13123
13126
|
}
|
|
13124
13127
|
createPendingSharedWebCodecsPlayback(A) {
|
|
@@ -13190,8 +13193,8 @@ const zA = class fA {
|
|
|
13190
13193
|
if (e && e.width > 0 && e.height > 0) {
|
|
13191
13194
|
const h = `${i.id}:atlas:${e.width}x${e.height}:${C}x${E}`, w = this.retainSharedWebCodecsSurface(h);
|
|
13192
13195
|
if (w) return w;
|
|
13193
|
-
const
|
|
13194
|
-
|
|
13196
|
+
const r = this.nextSharedWebCodecsSurfaceId++, n = `wc-shared-surface:${r}`, c = this.manager.tryAllocateWebCodecsAtlas(
|
|
13197
|
+
n,
|
|
13195
13198
|
C,
|
|
13196
13199
|
E,
|
|
13197
13200
|
e
|
|
@@ -13206,16 +13209,16 @@ const zA = class fA {
|
|
|
13206
13209
|
c.rect.w,
|
|
13207
13210
|
c.rect.h
|
|
13208
13211
|
);
|
|
13209
|
-
} catch (
|
|
13210
|
-
throw this.manager.releaseWebCodecsAtlasAllocation(
|
|
13212
|
+
} catch (F) {
|
|
13213
|
+
throw this.manager.releaseWebCodecsAtlasAllocation(n), F;
|
|
13211
13214
|
}
|
|
13212
13215
|
return this.createSharedWebCodecsSurface(
|
|
13213
13216
|
h,
|
|
13214
|
-
|
|
13217
|
+
r,
|
|
13215
13218
|
c.handle,
|
|
13216
13219
|
I,
|
|
13217
13220
|
c.rect,
|
|
13218
|
-
|
|
13221
|
+
n
|
|
13219
13222
|
);
|
|
13220
13223
|
}
|
|
13221
13224
|
}
|
|
@@ -13239,7 +13242,7 @@ const zA = class fA {
|
|
|
13239
13242
|
const I = this.sharedWebCodecsSurfaces.get(A);
|
|
13240
13243
|
return I ? (I.refs++, {
|
|
13241
13244
|
surface: I.surface,
|
|
13242
|
-
release:
|
|
13245
|
+
release: kA(() => this.releaseSharedWebCodecsSurface(I))
|
|
13243
13246
|
}) : null;
|
|
13244
13247
|
}
|
|
13245
13248
|
createSharedWebCodecsSurface(A, I, g, Q, C, E) {
|
|
@@ -13256,7 +13259,7 @@ const zA = class fA {
|
|
|
13256
13259
|
};
|
|
13257
13260
|
return this.sharedWebCodecsSurfaces.set(A, o), {
|
|
13258
13261
|
surface: o.surface,
|
|
13259
|
-
release:
|
|
13262
|
+
release: kA(() => this.releaseSharedWebCodecsSurface(o))
|
|
13260
13263
|
};
|
|
13261
13264
|
}
|
|
13262
13265
|
releaseSharedWebCodecsSurface(A) {
|
|
@@ -13273,15 +13276,15 @@ const zA = class fA {
|
|
|
13273
13276
|
this.assertSlotLoadActive(A), A.vapConfig = o;
|
|
13274
13277
|
const i = await fi(o, I.vapSlots);
|
|
13275
13278
|
if (this.assertSlotLoadActive(A), i.size > 0) {
|
|
13276
|
-
const D =
|
|
13279
|
+
const D = mA(o.info), h = ui(o);
|
|
13277
13280
|
let w = null;
|
|
13278
13281
|
if (this.backend.type === "webgpu" || this.backend.type === "webgl2")
|
|
13279
13282
|
try {
|
|
13280
13283
|
w = this.createVAPMixResourceTextures(i);
|
|
13281
|
-
} catch (
|
|
13284
|
+
} catch (r) {
|
|
13282
13285
|
console.warn(
|
|
13283
13286
|
"[GiftStage] VAP main-context mixed textures failed; falling back to compositor",
|
|
13284
|
-
|
|
13287
|
+
r
|
|
13285
13288
|
);
|
|
13286
13289
|
}
|
|
13287
13290
|
if (w)
|
|
@@ -13295,9 +13298,9 @@ const zA = class fA {
|
|
|
13295
13298
|
lastSourceRef: null
|
|
13296
13299
|
};
|
|
13297
13300
|
else {
|
|
13298
|
-
let
|
|
13301
|
+
let r = null, n = null;
|
|
13299
13302
|
try {
|
|
13300
|
-
|
|
13303
|
+
r = new We(
|
|
13301
13304
|
o,
|
|
13302
13305
|
h,
|
|
13303
13306
|
i,
|
|
@@ -13305,8 +13308,8 @@ const zA = class fA {
|
|
|
13305
13308
|
D.h,
|
|
13306
13309
|
I.videoRGBAlphaMode !== "straight"
|
|
13307
13310
|
);
|
|
13308
|
-
} catch (
|
|
13309
|
-
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);
|
|
13310
13313
|
}
|
|
13311
13314
|
const c = this.backend.createEmptyTexture(D.w, D.h, {
|
|
13312
13315
|
filter: "linear"
|
|
@@ -13316,12 +13319,12 @@ const zA = class fA {
|
|
|
13316
13319
|
texture: c,
|
|
13317
13320
|
width: D.w,
|
|
13318
13321
|
height: D.h,
|
|
13319
|
-
composer:
|
|
13322
|
+
composer: r,
|
|
13320
13323
|
frameMap: h,
|
|
13321
|
-
resources:
|
|
13324
|
+
resources: r ? void 0 : i,
|
|
13322
13325
|
lastFrameIndex: -1,
|
|
13323
13326
|
lastSourceRef: null,
|
|
13324
|
-
...
|
|
13327
|
+
...n != null ? n : {}
|
|
13325
13328
|
}, A.videoTextureHandle = c;
|
|
13326
13329
|
}
|
|
13327
13330
|
}
|
|
@@ -13334,22 +13337,22 @@ const zA = class fA {
|
|
|
13334
13337
|
if (!D)
|
|
13335
13338
|
throw this.releaseAttachedWebCodecsPlayback(A), new Error("WebCodecs: missing first frame");
|
|
13336
13339
|
if (!A.vapMixState || A.vapMixState.mode === "direct") {
|
|
13337
|
-
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(
|
|
13338
13341
|
A,
|
|
13339
13342
|
D,
|
|
13340
13343
|
w,
|
|
13341
|
-
n,
|
|
13342
|
-
c,
|
|
13343
13344
|
r,
|
|
13344
|
-
|
|
13345
|
+
c,
|
|
13346
|
+
F,
|
|
13347
|
+
n
|
|
13345
13348
|
);
|
|
13346
13349
|
if (G)
|
|
13347
13350
|
this.attachSharedWebCodecsSurface(A, G);
|
|
13348
13351
|
else {
|
|
13349
|
-
const M =
|
|
13352
|
+
const M = n ? this.manager.tryAllocateWebCodecsAtlas(
|
|
13350
13353
|
A.id,
|
|
13351
13354
|
c,
|
|
13352
|
-
|
|
13355
|
+
F,
|
|
13353
13356
|
this.options.webCodecsVideoAtlas
|
|
13354
13357
|
) : null;
|
|
13355
13358
|
M ? (A.videoTextureHandle = M.handle, A.wcAtlasRect = M.rect, this.backend.updateTextureRegion(
|
|
@@ -13358,10 +13361,10 @@ const zA = class fA {
|
|
|
13358
13361
|
M.rect.x,
|
|
13359
13362
|
M.rect.y,
|
|
13360
13363
|
c,
|
|
13361
|
-
|
|
13364
|
+
F
|
|
13362
13365
|
)) : A.videoTextureHandle = this.backend.createTexture(D, {
|
|
13363
13366
|
width: w,
|
|
13364
|
-
height:
|
|
13367
|
+
height: r,
|
|
13365
13368
|
filter: "linear"
|
|
13366
13369
|
});
|
|
13367
13370
|
}
|
|
@@ -13388,7 +13391,11 @@ const zA = class fA {
|
|
|
13388
13391
|
if (!this.isSlotLoadActive(A))
|
|
13389
13392
|
throw (Q = D.release) == null || Q.call(D), new Error(v);
|
|
13390
13393
|
A.releaseMediaSource = (C = D.release) != null ? C : null;
|
|
13391
|
-
const h = this.createVideo(
|
|
13394
|
+
const h = this.createVideo(
|
|
13395
|
+
D.src,
|
|
13396
|
+
I.loop === 0,
|
|
13397
|
+
I.mute !== !1
|
|
13398
|
+
);
|
|
13392
13399
|
A.videoElement = h;
|
|
13393
13400
|
}
|
|
13394
13401
|
const s = A.videoElement;
|
|
@@ -13405,7 +13412,7 @@ const zA = class fA {
|
|
|
13405
13412
|
A.releaseSharedVideoPlayback || this.bindVideoLoopOnEnded(A, s), this.logPlaybackBackend(
|
|
13406
13413
|
A,
|
|
13407
13414
|
"video",
|
|
13408
|
-
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"
|
|
13409
13416
|
);
|
|
13410
13417
|
}
|
|
13411
13418
|
createVAPMixResourceTextures(A) {
|
|
@@ -13450,17 +13457,17 @@ const zA = class fA {
|
|
|
13450
13457
|
if (w)
|
|
13451
13458
|
this.attachSharedWebCodecsSurface(A, w);
|
|
13452
13459
|
else {
|
|
13453
|
-
const
|
|
13460
|
+
const n = this.manager.tryAllocateWebCodecsAtlas(
|
|
13454
13461
|
A.id,
|
|
13455
13462
|
D,
|
|
13456
13463
|
h,
|
|
13457
13464
|
this.options.webCodecsVideoAtlas
|
|
13458
13465
|
);
|
|
13459
|
-
|
|
13460
|
-
|
|
13466
|
+
n ? (A.videoTextureHandle = n.handle, A.wcAtlasRect = n.rect, this.backend.updateTextureRegion(
|
|
13467
|
+
n.handle,
|
|
13461
13468
|
a,
|
|
13462
|
-
|
|
13463
|
-
|
|
13469
|
+
n.rect.x,
|
|
13470
|
+
n.rect.y,
|
|
13464
13471
|
D,
|
|
13465
13472
|
h
|
|
13466
13473
|
)) : A.videoTextureHandle = this.backend.createTexture(a, {
|
|
@@ -13470,11 +13477,11 @@ const zA = class fA {
|
|
|
13470
13477
|
});
|
|
13471
13478
|
}
|
|
13472
13479
|
A.videoElement = null;
|
|
13473
|
-
const
|
|
13480
|
+
const r = A.videoTextureHandle;
|
|
13474
13481
|
console.info("[GiftStage:WC] alphaVideo texture", {
|
|
13475
13482
|
giftId: A.id,
|
|
13476
13483
|
atlas: !!A.wcAtlasRect,
|
|
13477
|
-
tex: `${
|
|
13484
|
+
tex: `${r.width}x${r.height}`,
|
|
13478
13485
|
frame0: `${a.displayWidth}x${a.displayHeight}`,
|
|
13479
13486
|
atlasCell: A.wcAtlasRect ? `${A.wcAtlasRect.w}x${A.wcAtlasRect.h}` : void 0
|
|
13480
13487
|
}), this.logPlaybackBackend(A, "webcodecs");
|
|
@@ -13490,7 +13497,11 @@ const zA = class fA {
|
|
|
13490
13497
|
if (!this.isSlotLoadActive(A))
|
|
13491
13498
|
throw (Q = a.release) == null || Q.call(a), new Error(v);
|
|
13492
13499
|
A.releaseMediaSource = (C = a.release) != null ? C : null;
|
|
13493
|
-
const t = this.createVideo(
|
|
13500
|
+
const t = this.createVideo(
|
|
13501
|
+
a.src,
|
|
13502
|
+
I.loop === 0,
|
|
13503
|
+
I.mute !== !1
|
|
13504
|
+
);
|
|
13494
13505
|
A.videoElement = t;
|
|
13495
13506
|
}
|
|
13496
13507
|
const e = A.videoElement;
|
|
@@ -13507,7 +13518,7 @@ const zA = class fA {
|
|
|
13507
13518
|
A.releaseSharedVideoPlayback || this.bindVideoLoopOnEnded(A, e), this.logPlaybackBackend(
|
|
13508
13519
|
A,
|
|
13509
13520
|
"video",
|
|
13510
|
-
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"
|
|
13511
13522
|
);
|
|
13512
13523
|
}
|
|
13513
13524
|
/**
|
|
@@ -13516,44 +13527,103 @@ const zA = class fA {
|
|
|
13516
13527
|
*/
|
|
13517
13528
|
bindVideoLoopOnEnded(A, I) {
|
|
13518
13529
|
I.addEventListener("ended", () => {
|
|
13519
|
-
var g
|
|
13530
|
+
var g;
|
|
13520
13531
|
if (A.state !== "playing") return;
|
|
13521
|
-
const
|
|
13522
|
-
if (
|
|
13532
|
+
const Q = (g = A.options.loop) != null ? g : 1;
|
|
13533
|
+
if (Q === 0) {
|
|
13523
13534
|
I.currentTime = 0, I.play();
|
|
13524
13535
|
return;
|
|
13525
13536
|
}
|
|
13526
|
-
if (A.loopCount++, A.loopCount >=
|
|
13527
|
-
|
|
13528
|
-
E = {
|
|
13529
|
-
id: A.id,
|
|
13530
|
-
type: A.type,
|
|
13531
|
-
pause: () => {
|
|
13532
|
-
},
|
|
13533
|
-
resume: () => {
|
|
13534
|
-
},
|
|
13535
|
-
destroy: () => this.removeGift(A.id),
|
|
13536
|
-
animate: (o) => this.createGiftAnimationChain(A, E, o)
|
|
13537
|
-
}, (Q = A.onComplete) == null || Q.call(A, E), A.state = A.options.clearsAfterStop === !1 ? "stopped" : "finished";
|
|
13537
|
+
if (A.loopCount++, A.loopCount >= Q) {
|
|
13538
|
+
this.completeHtmlVideoPlayback(A);
|
|
13538
13539
|
return;
|
|
13539
13540
|
}
|
|
13540
|
-
I.currentTime = 0, I.play()
|
|
13541
|
-
|
|
13541
|
+
I.currentTime = 0, I.play().catch(() => {
|
|
13542
|
+
});
|
|
13543
|
+
}), this.armHtmlVideoPlaybackWatchdog(A, I);
|
|
13544
|
+
}
|
|
13545
|
+
clearHtmlVideoPlaybackWatchdog(A) {
|
|
13546
|
+
A.videoPlaybackWatchdogTimer != null && (clearTimeout(A.videoPlaybackWatchdogTimer), A.videoPlaybackWatchdogTimer = null);
|
|
13542
13547
|
}
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13548
|
+
completeHtmlVideoPlayback(A) {
|
|
13549
|
+
var I;
|
|
13550
|
+
if (A.state !== "playing" || A.videoPlaybackCompletionStarted) return;
|
|
13551
|
+
A.videoPlaybackCompletionStarted = !0, this.clearHtmlVideoPlaybackWatchdog(A);
|
|
13552
|
+
let g;
|
|
13553
|
+
g = {
|
|
13554
|
+
id: A.id,
|
|
13555
|
+
type: A.type,
|
|
13556
|
+
pause: () => {
|
|
13557
|
+
},
|
|
13558
|
+
resume: () => {
|
|
13559
|
+
},
|
|
13560
|
+
destroy: () => this.removeGift(A.id),
|
|
13561
|
+
animate: (Q) => this.createGiftAnimationChain(A, g, Q)
|
|
13562
|
+
};
|
|
13563
|
+
try {
|
|
13564
|
+
(I = A.onComplete) == null || I.call(A, g);
|
|
13565
|
+
} finally {
|
|
13566
|
+
A.state = A.options.clearsAfterStop === !1 ? "stopped" : "finished";
|
|
13567
|
+
}
|
|
13568
|
+
}
|
|
13569
|
+
armHtmlVideoPlaybackWatchdog(A, I) {
|
|
13570
|
+
var g;
|
|
13571
|
+
this.clearHtmlVideoPlaybackWatchdog(A);
|
|
13572
|
+
const Q = (g = A.options.loop) != null ? g : 1, C = I.duration;
|
|
13573
|
+
if (Q <= 0 || !Number.isFinite(C) || C <= 0) return;
|
|
13574
|
+
const E = Math.max(1, Math.ceil(Q)), o = C * E * 1e3;
|
|
13575
|
+
if (!Number.isFinite(o)) return;
|
|
13576
|
+
const i = Math.min(
|
|
13577
|
+
BA.HTML_VIDEO_WATCHDOG_MAX_GRACE_MS,
|
|
13578
|
+
Math.max(
|
|
13579
|
+
BA.HTML_VIDEO_WATCHDOG_MIN_GRACE_MS,
|
|
13580
|
+
o * BA.HTML_VIDEO_WATCHDOG_GRACE_RATIO
|
|
13581
|
+
)
|
|
13582
|
+
), e = performance.now() + o + i, a = () => {
|
|
13583
|
+
if (A.state === "finished" || A.state === "stopped") {
|
|
13584
|
+
A.videoPlaybackWatchdogTimer = null;
|
|
13585
|
+
return;
|
|
13586
|
+
}
|
|
13587
|
+
const t = e - performance.now();
|
|
13588
|
+
if (t > 0) {
|
|
13589
|
+
A.videoPlaybackWatchdogTimer = setTimeout(
|
|
13590
|
+
a,
|
|
13591
|
+
Math.min(t, BA.MAX_TIMER_DELAY_MS)
|
|
13592
|
+
);
|
|
13593
|
+
return;
|
|
13594
|
+
}
|
|
13595
|
+
A.videoPlaybackWatchdogTimer = null, A.state === "playing" && (console.warn("[GiftStage] HTMLVideo playback timed out; completing gift", {
|
|
13596
|
+
giftId: A.id,
|
|
13597
|
+
type: A.type,
|
|
13598
|
+
duration: C,
|
|
13599
|
+
loop: E
|
|
13600
|
+
}), this.completeHtmlVideoPlayback(A));
|
|
13601
|
+
};
|
|
13602
|
+
A.videoPlaybackWatchdogTimer = setTimeout(
|
|
13603
|
+
a,
|
|
13604
|
+
Math.min(o + i, BA.MAX_TIMER_DELAY_MS)
|
|
13605
|
+
);
|
|
13606
|
+
}
|
|
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;
|
|
13546
13610
|
}
|
|
13547
13611
|
waitVideoMetadata(A) {
|
|
13548
13612
|
return new Promise((I, g) => {
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13613
|
+
let Q = !1, C = null;
|
|
13614
|
+
const E = () => {
|
|
13615
|
+
A.removeEventListener("loadedmetadata", i), A.removeEventListener("error", e), C != null && clearTimeout(C), C = null;
|
|
13616
|
+
}, o = (a) => {
|
|
13617
|
+
Q || (Q = !0, E(), a());
|
|
13618
|
+
}, i = () => {
|
|
13619
|
+
o(I);
|
|
13620
|
+
}, e = () => {
|
|
13621
|
+
o(() => g(new Error("Video metadata load failed")));
|
|
13555
13622
|
};
|
|
13556
|
-
A.addEventListener("loadedmetadata",
|
|
13623
|
+
A.addEventListener("loadedmetadata", i), A.addEventListener("error", e), C = setTimeout(
|
|
13624
|
+
() => o(() => g(new Error("Video metadata load timed out"))),
|
|
13625
|
+
BA.HTML_VIDEO_READY_TIMEOUT_MS
|
|
13626
|
+
), A.readyState >= HTMLMediaElement.HAVE_METADATA && o(I);
|
|
13557
13627
|
});
|
|
13558
13628
|
}
|
|
13559
13629
|
async probeVideoNaturalSize(A, I = "video") {
|
|
@@ -13607,7 +13677,7 @@ const zA = class fA {
|
|
|
13607
13677
|
}
|
|
13608
13678
|
}
|
|
13609
13679
|
async fetchSharedVideoSource(A) {
|
|
13610
|
-
const I = new Blob([await
|
|
13680
|
+
const I = new Blob([await xA(A)]), g = this.sharedVideoSources.get(A), Q = URL.createObjectURL(I);
|
|
13611
13681
|
return g && (g.objectUrl = Q, g.refs === 0 && (URL.revokeObjectURL(Q), this.sharedVideoSources.delete(A))), Q;
|
|
13612
13682
|
}
|
|
13613
13683
|
releaseSharedVideoSource(A) {
|
|
@@ -13619,41 +13689,41 @@ const zA = class fA {
|
|
|
13619
13689
|
if (this.options.shareIdenticalVideoPlayback === !1 || I.loop !== 0 || typeof I.source != "string" || A.type === "vap" && A.vapMixState) return null;
|
|
13620
13690
|
const C = this.normalizeSharedVideoSourceKey(I.source);
|
|
13621
13691
|
if (!C) return null;
|
|
13622
|
-
const E = (g = this.options.sharedVideoPlaybackWindowMs) != null ? g :
|
|
13623
|
-
if (
|
|
13624
|
-
return
|
|
13625
|
-
cacheKey:
|
|
13626
|
-
video:
|
|
13627
|
-
ready:
|
|
13628
|
-
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)
|
|
13629
13699
|
});
|
|
13630
|
-
let
|
|
13631
|
-
|
|
13632
|
-
var
|
|
13633
|
-
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);
|
|
13634
13704
|
return {
|
|
13635
|
-
video:
|
|
13636
|
-
ready:
|
|
13637
|
-
releaseSource: (
|
|
13705
|
+
video: w,
|
|
13706
|
+
ready: r,
|
|
13707
|
+
releaseSource: (D = h.release) != null ? D : null
|
|
13638
13708
|
};
|
|
13639
|
-
})(), this.pendingSharedHtmlVideos.set(
|
|
13640
|
-
let
|
|
13709
|
+
})(), this.pendingSharedHtmlVideos.set(E, a));
|
|
13710
|
+
let t;
|
|
13641
13711
|
try {
|
|
13642
|
-
|
|
13643
|
-
} catch (
|
|
13644
|
-
throw this.pendingSharedHtmlVideos.delete(
|
|
13712
|
+
t = await a;
|
|
13713
|
+
} catch (D) {
|
|
13714
|
+
throw this.pendingSharedHtmlVideos.delete(E), D;
|
|
13645
13715
|
}
|
|
13646
|
-
let
|
|
13647
|
-
return
|
|
13716
|
+
let s = this.sharedHtmlVideos.get(E);
|
|
13717
|
+
return s ? s.refs++ : (s = {
|
|
13648
13718
|
refs: 1,
|
|
13649
|
-
video: a.video,
|
|
13650
|
-
ready: a.ready,
|
|
13651
|
-
releaseSource: (Q = a.releaseSource) != null ? Q : null
|
|
13652
|
-
}, this.sharedHtmlVideos.set(C, t)), this.pendingSharedHtmlVideos.delete(C), {
|
|
13653
|
-
cacheKey: C,
|
|
13654
13719
|
video: t.video,
|
|
13655
13720
|
ready: t.ready,
|
|
13656
|
-
|
|
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)
|
|
13657
13727
|
};
|
|
13658
13728
|
}
|
|
13659
13729
|
acquireSharedVideoTexture(A, I) {
|
|
@@ -13689,7 +13759,7 @@ const zA = class fA {
|
|
|
13689
13759
|
texture: o,
|
|
13690
13760
|
width: E.width,
|
|
13691
13761
|
height: E.height,
|
|
13692
|
-
release:
|
|
13762
|
+
release: kA(() => {
|
|
13693
13763
|
var i;
|
|
13694
13764
|
return (i = this.backend) == null ? void 0 : i.deleteTexture(o);
|
|
13695
13765
|
})
|
|
@@ -13704,7 +13774,7 @@ const zA = class fA {
|
|
|
13704
13774
|
texture: g.texture,
|
|
13705
13775
|
width: g.width,
|
|
13706
13776
|
height: g.height,
|
|
13707
|
-
release:
|
|
13777
|
+
release: kA(() => this.releaseSharedImageTexture(A))
|
|
13708
13778
|
};
|
|
13709
13779
|
let Q = this.pendingSharedImageTextures.get(A);
|
|
13710
13780
|
if (!Q) {
|
|
@@ -13743,7 +13813,7 @@ const zA = class fA {
|
|
|
13743
13813
|
texture: C.texture,
|
|
13744
13814
|
width: C.width,
|
|
13745
13815
|
height: C.height,
|
|
13746
|
-
release:
|
|
13816
|
+
release: kA(() => this.releaseSharedImageTexture(A))
|
|
13747
13817
|
};
|
|
13748
13818
|
}
|
|
13749
13819
|
releaseSharedImageTexture(A) {
|
|
@@ -13778,20 +13848,38 @@ const zA = class fA {
|
|
|
13778
13848
|
}
|
|
13779
13849
|
waitVideoReady(A) {
|
|
13780
13850
|
return new Promise((I, g) => {
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13851
|
+
let Q = !1, C = !1, E = null;
|
|
13852
|
+
const o = () => {
|
|
13853
|
+
A.removeEventListener("canplay", a), A.removeEventListener("error", t), E != null && clearTimeout(E), E = null;
|
|
13854
|
+
}, i = (s) => {
|
|
13855
|
+
Q || (Q = !0, o(), s());
|
|
13856
|
+
}, e = async () => {
|
|
13857
|
+
if (!(C || Q)) {
|
|
13858
|
+
C = !0;
|
|
13859
|
+
try {
|
|
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);
|
|
13870
|
+
} catch (s) {
|
|
13871
|
+
i(() => g(s));
|
|
13872
|
+
}
|
|
13788
13873
|
}
|
|
13789
|
-
},
|
|
13790
|
-
|
|
13791
|
-
},
|
|
13792
|
-
|
|
13874
|
+
}, a = () => {
|
|
13875
|
+
e();
|
|
13876
|
+
}, t = () => {
|
|
13877
|
+
i(() => g(new Error("Video load failed")));
|
|
13793
13878
|
};
|
|
13794
|
-
A.addEventListener("canplay",
|
|
13879
|
+
A.addEventListener("canplay", a), A.addEventListener("error", t), E = setTimeout(
|
|
13880
|
+
() => i(() => g(new Error("Video ready timed out"))),
|
|
13881
|
+
BA.HTML_VIDEO_READY_TIMEOUT_MS
|
|
13882
|
+
), A.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA && e();
|
|
13795
13883
|
});
|
|
13796
13884
|
}
|
|
13797
13885
|
removeGift(A) {
|
|
@@ -13862,12 +13950,17 @@ const zA = class fA {
|
|
|
13862
13950
|
});
|
|
13863
13951
|
}
|
|
13864
13952
|
};
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13953
|
+
H(wA, "SVGA_ATLAS_MAX_SIZE", 2048);
|
|
13954
|
+
H(wA, "SVGA_ATLAS_PADDING", 2);
|
|
13955
|
+
H(wA, "DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS", 100);
|
|
13956
|
+
H(wA, "HTML_VIDEO_READY_TIMEOUT_MS", 15e3);
|
|
13957
|
+
H(wA, "HTML_VIDEO_WATCHDOG_MIN_GRACE_MS", 2e3);
|
|
13958
|
+
H(wA, "HTML_VIDEO_WATCHDOG_MAX_GRACE_MS", 1e4);
|
|
13959
|
+
H(wA, "HTML_VIDEO_WATCHDOG_GRACE_RATIO", 0.2);
|
|
13960
|
+
H(wA, "MAX_TIMER_DELAY_MS", 2147e6);
|
|
13961
|
+
H(wA, "DEFAULT_RESOURCE_CACHE_MEMORY_BYTES", 128 * 1024 * 1024);
|
|
13962
|
+
H(wA, "DEFAULT_RESOURCE_CACHE_PERSISTENT_BYTES", 2048 * 1024 * 1024);
|
|
13963
|
+
let na = wA;
|
|
13871
13964
|
export {
|
|
13872
13965
|
Ti as AlphaVideoRenderer,
|
|
13873
13966
|
zi as AudioManager,
|
|
@@ -13878,7 +13971,7 @@ export {
|
|
|
13878
13971
|
Qo as RenderManager,
|
|
13879
13972
|
zE as SVGABatchRenderer,
|
|
13880
13973
|
mi as VAPRenderer,
|
|
13881
|
-
|
|
13974
|
+
VA as WebCodecsMp4Playback,
|
|
13882
13975
|
QB as WebGL1Backend,
|
|
13883
13976
|
cC as WebGL2Backend,
|
|
13884
13977
|
hC as WebGPUBackend,
|
|
@@ -13901,9 +13994,9 @@ export {
|
|
|
13901
13994
|
SB as inflateJS,
|
|
13902
13995
|
zC as initWasm,
|
|
13903
13996
|
eI as isWasmReady,
|
|
13904
|
-
|
|
13997
|
+
rA as lerp,
|
|
13905
13998
|
aa as linear,
|
|
13906
|
-
|
|
13999
|
+
qA as ortho,
|
|
13907
14000
|
Ng as parseSVGA,
|
|
13908
14001
|
nB as parseVAPConfig
|
|
13909
14002
|
};
|