@taole/giftstage 0.1.30 → 0.1.31

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.
@@ -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
- }, hA = {
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
- hA.svgaBatchPremul,
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
- hA.svgaBatchPremul,
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
- hA.vap,
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
- hA.vapMixOverlay,
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
- hA.alphaVideo,
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
- hA.rgbaTextured,
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, hA.svgaInstancedPremul, A), g = this.pipelines.get(I)), g;
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: hA.vapInstanced }), E = {
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: hA.alphaVideoInstanced }), E = {
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: hA.clipMask }), g = this.device.createRenderPipeline({
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,
@@ -1810,7 +1810,7 @@ function AB(B, A, I) {
1810
1810
  }
1811
1811
  return g;
1812
1812
  }
1813
- function cA(B, A, I) {
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 rA = class JA {
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 = cA(A, p.svgaBatchPremul.vert, p.svgaBatchPremul.frag);
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 = cA(
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 = cA(A, p.vap.vert, p.vap.frag);
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 = cA(A, p.vapMixOverlay.vert, p.vapMixOverlay.frag);
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 = cA(A, p.alphaVideo.vert, p.alphaVideo.frag);
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 = cA(A, p.rgbaTextured.vert, p.rgbaTextured.frag);
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 = cA(
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 = cA(A, p.vapInstanced.vert, p.vapInstanced.frag);
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 = cA(A, p.clipMask.vert, p.clipMask.frag);
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, JA.INST_SVGA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedSvgaInstanceGLBuffer = I;
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 > JA.INST_SVGA_GL_MAX) {
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, JA.INST_ALPHA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedAlphaInstanceGLBuffer = I;
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 > JA.INST_ALPHA_GL_MAX) {
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, JA.INST_VAP_GL_BYTES, A.DYNAMIC_DRAW), this.instancedVapInstanceGLBuffer = I;
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 > JA.INST_VAP_GL_MAX) {
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(rA, "INST_SVGA_GL_MAX", 2048);
2360
- m(rA, "INST_SVGA_GL_BYTES", rA.INST_SVGA_GL_MAX * 52);
2361
- m(rA, "INST_ALPHA_GL_MAX", 1024);
2362
- m(rA, "INST_ALPHA_GL_BYTES", rA.INST_ALPHA_GL_MAX * 48);
2363
- m(rA, "INST_VAP_GL_MAX", 1024);
2364
- m(rA, "INST_VAP_GL_BYTES", rA.INST_VAP_GL_MAX * 128);
2365
- let cC = rA;
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, uA = 13, nA = 9, VA = 4, iI = 6, xg = 9, YC = { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 };
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
  }
@@ -2865,17 +2865,17 @@ function zB(B, A) {
2865
2865
  };
2866
2866
  }
2867
2867
  function gg(B, A, I) {
2868
- const g = Math.floor(B.length / uA), Q = Math.floor(A.length / (VA * nA)), C = Math.floor(I.length / iI), E = Math.min(g, Q, C);
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 * uA, 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], n = B[i + 7], F = B[i + 8], c = B[i + 9], r = B[i + 10], G = B[i + 11], M = B[i + 12], y = w, R = n, S = t * e + w, N = s * e + n, U = t * e + D * a + w, L = s * e + h * a + n, l = D * a + w, f = h * a + n, d = o * VA * nA;
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], n = B[i + 7], F = B[i + 8], c = B[i + 9], r = B[i + 10], G = B[i + 11], M = B[i + 12], y = w, R = n, S = t * e + w, N = s * e + n, U = t * e + D * a + w, L = s * e + h * a + n, l = D * a + w, f = h * a + n, d = o * vA * cA;
2871
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] = F, A[d + 7] = c, A[d + 8] = r;
2872
- const u = d + nA;
2872
+ const u = d + cA;
2873
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] = F, A[u + 7] = G, A[u + 8] = r;
2874
- const K = d + 2 * nA;
2874
+ const K = d + 2 * cA;
2875
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] = F, A[K + 7] = G, A[K + 8] = M;
2876
- const x = d + 3 * nA;
2876
+ const x = d + 3 * cA;
2877
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] = F, A[x + 7] = c, A[x + 8] = M;
2878
- const X = o * iI, gA = o * VA;
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, vA().subarray(B / 1, B / 1 + A);
2988
+ return B = B >>> 0, XA().subarray(B / 1, B / 1 + A);
2989
2989
  }
2990
- let LA = null;
2990
+ let uA = null;
2991
2991
  function CB() {
2992
- return (LA === null || LA.buffer.detached === !0 || LA.buffer.detached === void 0 && LA.buffer !== J.memory.buffer) && (LA = new DataView(J.memory.buffer)), LA;
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 vA() {
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 vA().set(B, I / 1), IA = B.length, I;
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 vA().subarray(i, i + o.length).set(o), IA = o.length, i;
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 = vA();
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 = vA().subarray(Q + E, Q + g), i = oI.encodeInto(B, 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(vA().subarray(B, B + A));
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, LA = null, II = null, gI = null, BI = null, QI = null, J.__wbindgen_start(), J;
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) {
@@ -3357,11 +3357,11 @@ class eE {
3357
3357
  this.floatPoolA = null, this.floatPoolB = null, this.uint32Pool = null;
3358
3358
  }
3359
3359
  }
3360
- function HA(B, A, I, g, Q, C) {
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 wA(B, A, I) {
3364
+ function rA(B, A, I) {
3365
3365
  return B + (A - B) * I;
3366
3366
  }
3367
3367
  function og(B, A, I) {
@@ -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 sA(B) {
3535
+ function DA(B) {
3536
3536
  var A;
3537
3537
  return (A = B.options.objectFit) != null ? A : "contain";
3538
3538
  }
3539
- function UA(B, A, I, g) {
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 = sA(B);
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")
@@ -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 dA(B) {
4552
- return B instanceof Error ? B.name === "AbortError" ? !0 : "cause" in B && dA(B.cause) : !1;
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 QA(B = {}) {
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 WA(B, A, I, g, Q, C) {
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 qA(B, A, I, g, Q) {
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 = [
@@ -4799,10 +4799,10 @@ function qA(B, A, I, g, Q) {
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, H = (B, A, I) => PE(B, typeof A != "symbol" ? A + "" : 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
- H(this, "pool", new eE()), H(this, "vertexBufHandles", []), H(this, "indexBufHandles", []), H(this, "clipSpriteVertBufHandles", []), H(this, "clipSpriteIdxBufHandles", []), H(this, "batchDrawCursor", 0), H(this, "clipSpriteDrawCursor", 0), H(this, "canvasWidth", 0), H(this, "canvasHeight", 0), H(this, "projCacheW", 0), H(this, "projCacheH", 0), H(this, "projCache", null), H(this, "clipMeshCache", /* @__PURE__ */ new Map()), H(this, "clipMeshesWithBuffers", /* @__PURE__ */ new Set()), H(this, "clipFrameDataScratch", new Float32Array(uA)), H(this, "instancedFrameDataScratch", new Float32Array(sg * uA)), H(this, "clipSpriteVertsScratch", null), H(this, "clipSpriteIndicesScratch", null), H(this, "shapeVertsScratch", null), H(this, "instancedQuadVB", null), H(this, "instancedQuadIB", null), H(this, "whiteTexture", null), H(this, "shapeMeshCache", /* @__PURE__ */ new WeakMap()), H(this, "clipTransformMat", new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), H(this, "slotScissor", { x: 0, y: 0, w: 0, h: 0 }), H(this, "spriteWorkPool", []), H(this, "spriteWorkCursor", 0), H(this, "batchSpritesScratch", []), H(this, "drawGroupScratch", []), H(this, "entityHasShapesCache", /* @__PURE__ */ new WeakMap()), H(this, "affineScratch", { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 });
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 (dA(s)) throw s;
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 = QA({
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 = sA(o), s = UA(o, e, a), D = s.scaleX, h = s.scaleY, w = o.width * o.scale, n = o.height * o.scale, F = t === "cover" ? w : Math.min(s.width, w), c = t === "cover" ? n : Math.min(s.height, n), r = t === "cover" ? o.x : o.x + s.offsetX, G = t === "cover" ? o.y : o.y + s.offsetY;
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, n = o.height * o.scale, F = t === "cover" ? w : Math.min(s.width, w), c = t === "cover" ? n : Math.min(s.height, n), r = 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 = qA(o, r, G, F, c);
4885
+ const M = pA(o, r, G, F, 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 = HA(0, this.canvasWidth, this.canvasHeight, 0, -1, 1), 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,10 +4955,10 @@ 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 * uA);
4958
+ const E = this.pool.getFloat32(C * HA);
4959
4959
  for (let F = 0; F < C; F++)
4960
4960
  this.packFrameData(E, F, I[F]);
4961
- const o = C * VA * nA, i = C * iI, e = this.pool.getFloat32B(o), a = this.pool.getUint32(i), t = new Float32Array(E.buffer, 0, C * uA), s = new Float32Array(e.buffer, 0, o), D = new Uint32Array(a.buffer, 0, i);
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
4963
  const h = this.batchDrawCursor++, w = this.ensureVertexBuffer(A, h, s), n = this.ensureIndexBuffer(A, h, D);
4964
4964
  A.draw({
@@ -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 = VA * nA, d = iI;
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
- ), KA = {
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(KA), this.clearClipStencil(A, g, N, U, Q);
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 = VA * nA, E = iI;
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);
@@ -5129,10 +5129,10 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
5129
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: n, sy: F, offsetX: c, offsetY: r } = 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 KA = C || w.logicalWidth, W = E || w.logicalHeight;
5133
- G = w.logicalWidth, M = w.logicalHeight, y = Math.max(0, (KA - G) * 0.5), R = Math.max(0, (W - M) * 0.5);
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 * uA, N = o * n, U = i * F, L = e * n, l = a * F, f = this.rotateTransform(
5135
+ const S = I * HA, N = o * n, U = i * F, L = e * n, l = a * F, f = this.rotateTransform(
5136
5136
  Q,
5137
5137
  N,
5138
5138
  U,
@@ -5164,12 +5164,12 @@ const sg = 2048, Dg = { x: 0, y: 0, w: 1, h: 1 }, Vg = class Lg {
5164
5164
  n * a,
5165
5165
  F * 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 * nA;
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, oA = 0; W < l.length; W += 6, oA += nA) {
5171
- const kI = l[W], MA = l[W + 1];
5172
- d[oA] = y * kI + S * MA + U, d[oA + 1] = R * kI + N * MA + L, d[oA + 2] = 0, d[oA + 3] = l[W + 2], d[oA + 4] = l[W + 3], d[oA + 5] = l[W + 4], d[oA + 6] = l[W + 5] * r * i.opacity, d[oA + 7] = 0.5, d[oA + 8] = 0.5;
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] * r * 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
- ), KA = this.ensureClipSpriteIndexBuffer(A, X, o.indices);
5198
+ ), LA = this.ensureClipSpriteIndexBuffer(A, X, o.indices);
5199
5199
  A.draw({
5200
5200
  shader: "svga-batch-premul",
5201
5201
  vertexBuffer: gA,
5202
- indexBuffer: KA,
5202
+ indexBuffer: LA,
5203
5203
  indexCount: o.indices.length,
5204
5204
  textures: [G],
5205
5205
  uniforms: { u_projection: C, u_atlas: 0 },
@@ -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
- H(Vg, "INSTANCED_QUAD_VERTS", new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]));
5385
- H(Vg, "INSTANCED_QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
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) {
@@ -5407,11 +5407,11 @@ function _E(B, A) {
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, aA = (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, CA = "resources", hg = "byUpdatedAt", Ei = 3e4;
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
- aA(this, "maxConcurrent"), aA(this, "active", 0), aA(this, "queue", []), this.maxConcurrent = Math.max(1, A);
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 RA(B) {
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 += RA(E.key) + 16;
5451
+ Q += MA(E.key) + 16;
5452
5452
  for (const E of B.audios)
5453
- Q += RA(E.audioKey) + 32;
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 += RA(E);
5457
- for (const E of C.clipPaths) Q += RA(E);
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 += RA((g = o.pathData) != null ? g : "") + 96;
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" ? RA(B) : B.byteLength;
5463
+ return typeof B == "string" ? MA(B) : B.byteLength;
5464
5464
  }
5465
5465
  class ai {
5466
5466
  constructor() {
5467
- aA(this, "limiter", new ii(Ii)), aA(this, "pending", /* @__PURE__ */ new Map()), aA(this, "memory", /* @__PURE__ */ new Map()), aA(this, "memoryBytes", 0), aA(this, "maxMemoryBytes", gi), aA(this, "maxPersistentBytes", Bi), aA(this, "dbPromise", null), aA(this, "persistentTrimPromise", null);
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, RA(C)), C) : this.getOrCreatePending(
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, RA(o)), this.setPersistent(g, "text", o), 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, RA(C)), 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(CA) ? Q = I.transaction.objectStore(CA) : Q = g.createObjectStore(CA, { keyPath: "key" }), Q.indexNames.contains(hg) || Q.createIndex(hg, "updatedAt", { unique: !1 });
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(CA, "readonly");
5578
+ const C = g.transaction(EA, "readonly");
5579
5579
  C.onerror = () => Q(null), C.onabort = () => Q(null);
5580
- const o = C.objectStore(CA).get(A);
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(CA, "readwrite");
5609
+ const o = Q.transaction(EA, "readwrite");
5610
5610
  o.onerror = () => E(), o.onabort = () => E();
5611
- const e = o.objectStore(CA).put({
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(CA, "readwrite");
5628
+ const Q = I.transaction(EA, "readwrite");
5629
5629
  Q.onerror = () => g(), Q.onabort = () => g();
5630
- const E = Q.objectStore(CA).put(A);
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(CA, "readwrite");
5646
+ const g = A.transaction(EA, "readwrite");
5647
5647
  g.oncomplete = () => I(), g.onerror = () => I(), g.onabort = () => I();
5648
- const Q = g.objectStore(CA), C = Q.index(hg), E = [];
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(CA, "readwrite");
5674
+ const Q = I.transaction(EA, "readwrite");
5675
5675
  Q.onerror = () => g(), Q.onabort = () => g();
5676
- const E = Q.objectStore(CA).delete(A);
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 DA = new ai();
5684
+ const hA = new ai();
5685
5685
  function ti(B) {
5686
- DA.configure(B);
5686
+ hA.configure(B);
5687
5687
  }
5688
5688
  function fg(B) {
5689
- return DA.runLimited(B);
5689
+ return hA.runLimited(B);
5690
5690
  }
5691
- function mA(B, A) {
5692
- return DA.fetchArrayBuffer(B, A);
5691
+ function xA(B, A) {
5692
+ return hA.fetchArrayBuffer(B, A);
5693
5693
  }
5694
5694
  function si(B, A) {
5695
- return DA.fetchJSON(B, A);
5695
+ return hA.fetchJSON(B, A);
5696
5696
  }
5697
5697
  function vg(B) {
5698
- return DA.getSVGAWorkerPayload(B);
5698
+ return hA.getSVGAWorkerPayload(B);
5699
5699
  }
5700
5700
  function wB(B, A) {
5701
- DA.setSVGAWorkerPayload(B, A);
5701
+ hA.setSVGAWorkerPayload(B, A);
5702
5702
  }
5703
5703
  function Di(B, A) {
5704
- return DA.getMemoryValue(B, A);
5704
+ return hA.getMemoryValue(B, A);
5705
5705
  }
5706
5706
  function aQ(B, A, I, g) {
5707
- DA.setMemoryValue(B, A, I, g);
5707
+ hA.setMemoryValue(B, A, I, g);
5708
5708
  }
5709
5709
  function hi(B) {
5710
- return DA.getPersistedArrayBuffer(B);
5710
+ return hA.getPersistedArrayBuffer(B);
5711
5711
  }
5712
5712
  function wi(B, A) {
5713
- return DA.setPersistedArrayBuffer(B, A);
5713
+ return hA.setPersistedArrayBuffer(B, A);
5714
5714
  }
5715
5715
  function ni(B) {
5716
- return DA.deletePersistedValue(B);
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 pA(B) {
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, EA = (B, A, I) => ci(B, typeof A != "symbol" ? A + "" : 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
- EA(this, "frameInfo", /* @__PURE__ */ new Map()), EA(this, "pending", /* @__PURE__ */ new Set()), EA(this, "lastHandle", /* @__PURE__ */ new Map()), EA(this, "started", /* @__PURE__ */ new Set()), EA(this, "firstUploaded", /* @__PURE__ */ new Set()), EA(this, "forceTimeFallback", /* @__PURE__ */ new Set()), EA(this, "lastArmAt", /* @__PURE__ */ new Map()), EA(this, "lastCallbackAt", /* @__PURE__ */ new Map()), EA(this, "lastProgressAt", /* @__PURE__ */ new Map()), EA(this, "lastRecoveryAt", /* @__PURE__ */ new Map()), EA(this, "stallLogged", /* @__PURE__ */ new Set()), EA(this, "stagnationLogged", /* @__PURE__ */ new Set()), EA(this, "lastTimeFallback", /* @__PURE__ */ new Map());
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 XA(B, A) {
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 OA(B, A) {
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 jA(B) {
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 = XA(B.width, B.height);
5920
- return OA(A).putImageData(B, 0, 0), A;
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 PA(B) {
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 PA(g) ? g : void 0;
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,7 +5964,7 @@ 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 = XA(1, 1), h = OA(D), w = (Q = g.color) != null ? Q : "#ffffff", n = Math.max(0, (C = g.padding) != null ? C : 2), F = Math.max(1, t - n * 2), c = Math.max(1, s - n * 2), r = Math.max(
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", n = Math.max(0, (C = g.padding) != null ? C : 2), F = Math.max(1, t - n * 2), c = Math.max(1, s - n * 2), r = 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
5970
  ), G = Math.max(1, Math.min((e = g.minFontSize) != null ? e : 8, r)), M = w, y = `${g.style === "b" ? "bold " : ""}${r * a}px Arial`, R = Mi(g.fontStyle, y, M), S = (d) => Ni(R.font, d * a), N = li(
@@ -5975,8 +5975,8 @@ function wQ(B, A, I, g) {
5975
5975
  F,
5976
5976
  c,
5977
5977
  G,
5978
- PA(g.fontSize) ? Math.min(g.fontSize, r) : r
5979
- ), U = g.sizing === "intrinsic" ? Math.max(1, Math.min(t, Math.ceil(N.metrics.width + n * 2))) : t, L = g.sizing === "intrinsic" ? Math.max(1, Math.min(s, Math.ceil(N.metrics.height + n * 2))) : s, l = XA(U * a, L * a), f = OA(l);
5978
+ zA(g.fontSize) ? Math.min(g.fontSize, r) : r
5979
+ ), U = g.sizing === "intrinsic" ? Math.max(1, Math.min(t, Math.ceil(N.metrics.width + n * 2))) : t, L = g.sizing === "intrinsic" ? Math.max(1, Math.min(s, Math.ceil(N.metrics.height + n * 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) {
@@ -6003,11 +6003,11 @@ async function ki(B, A, I, g) {
6003
6003
  const R = (n * 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
6004
  if (F = Math.max(F, 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
- PA(X) && (r = Math.min(r, X));
6006
+ zA(X) && (r = Math.min(r, X));
6007
6007
  }
6008
6008
  y + 1 < h && I.shouldYield() && (await I.yield(), g == null || g());
6009
6009
  }
6010
- const G = PA(r) ? r : 1, M = B.atlasRects.get(w);
6010
+ const G = zA(r) ? r : 1, M = B.atlasRects.get(w);
6011
6011
  D.set(w, {
6012
6012
  width: F || (M == null ? void 0 : M.w) || 1,
6013
6013
  height: c || (M == null ? void 0 : M.h) || 1,
@@ -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 (PA(B))
6021
- return !PA(A) || A === 1 ? B : B / A;
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 = jA(i);
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 = jA(i);
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 = jA(B);
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 = QA({
6074
+ const i = Object.entries(I), e = CA({
6075
6075
  maxBudgetMs: g.frameBudgetMs
6076
6076
  }), a = await ki(
6077
6077
  A,
@@ -6087,7 +6087,7 @@ async function Yi(B, A, I, g = {}) {
6087
6087
  h.width,
6088
6088
  h.height,
6089
6089
  h.renderScale
6090
- ), n = jA(w.source), F = n.width || h.width, c = n.height || h.height, r = B.createTexture(w.source, {
6090
+ ), n = PA(w.source), F = n.width || h.width, c = n.height || h.height, r = B.createTexture(w.source, {
6091
6091
  width: F,
6092
6092
  height: c,
6093
6093
  filter: "linear",
@@ -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 = jA(e);
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 = jA(E);
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,14 +6190,14 @@ function ui(B) {
6190
6190
  return I;
6191
6191
  }
6192
6192
  function Hi(B, A) {
6193
- const I = XA(B, A), g = XA(B, A), Q = XA(1, 1);
6193
+ const I = OA(B, A), g = OA(B, A), Q = OA(1, 1);
6194
6194
  return {
6195
6195
  compositeCanvas: I,
6196
- compositeCtx: OA(I),
6196
+ compositeCtx: jA(I),
6197
6197
  rawCanvas: g,
6198
- rawCtx: OA(g),
6198
+ rawCtx: jA(g),
6199
6199
  scratchCanvas: Q,
6200
- scratchCtx: OA(Q)
6200
+ scratchCtx: jA(Q)
6201
6201
  };
6202
6202
  }
6203
6203
  function FB(B, A, I, g, Q = !0) {
@@ -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)), KA = Math.min(B.height, Math.ceil(N + L));
6225
- for (let W = X; W < KA; W++) {
6226
- const oA = Math.min(
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 MA = x; MA < gA; MA++) {
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((MA - S) / U * B.scratchCanvas.width))
6234
- ), uQ = Math.min(i - 1, Math.max(0, l + Math.floor((MA - S) / U * d))), UI = (oA * B.scratchCanvas.width + fQ) * 4, HQ = (kI * i + uQ) * 4, qQ = K[UI + 3] / 255, pQ = c[HQ] / 255, xA = qQ * pQ;
6235
- if (xA <= 0) continue;
6236
- const NA = (W * B.width + MA) * 4, mQ = K[UI] / 255 * xA, xQ = K[UI + 1] / 255 * xA, bQ = K[UI + 2] / 255 * xA, TQ = G[NA + 3] / 255, YI = 1 - xA;
6237
- G[NA] = Math.round((mQ + G[NA] / 255 * YI) * 255), G[NA + 1] = Math.round((xQ + G[NA + 1] / 255 * YI) * 255), G[NA + 2] = Math.round((bQ + G[NA + 2] / 255 * YI) * 255), G[NA + 3] = Math.round((xA + TQ * YI) * 255);
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
6241
  return B.compositeCtx.putImageData(r, 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 FA {
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") && sA(g) !== "cover" || this.drawGeometry(A, g);
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 || sA(e) === "cover" || !e.vapConfig || g.push(e);
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(FA.QUAD_VERTS, "vertex"), this.instancedQuadIB = A.createBuffer(FA.QUAD_INDICES, "index"));
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 = HA(0, Q, C, 0, -1, 1), E = 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 } = pA(e), w = UA(A, D, h);
6360
- WA(
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,
@@ -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 = HA(0, o, i, 0, -1, 1), e = 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 = sA(I), { w: n, h: F } = pA(t), c = UA(I, n, F);
6420
- WA(
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: n, h: F } = mA(t), c = dA(I, n, F);
6420
+ ZA(
6421
6421
  I,
6422
6422
  I.x + c.offsetX,
6423
6423
  I.y + c.offsetY,
@@ -6426,7 +6426,7 @@ const rg = 1024, GB = 32, lI = class FA {
6426
6426
  h
6427
6427
  );
6428
6428
  const r = $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] = r.left, R[3] = r.top, R[4] = G.left, R[5] = G.top, R[6] = 1, R[7] = 0, R[8] = r.right, R[9] = r.top, R[10] = G.right, R[11] = G.top, R[12] = 1, R[13] = 1, R[14] = r.right, R[15] = r.bottom, R[16] = G.right, R[17] = G.bottom, R[18] = 0, R[19] = 1, R[20] = r.left, R[21] = r.bottom, R[22] = G.left, R[23] = G.bottom, this.quadVB = this.ensureBuffer(A, this.quadVB, R, "vertex"), this.quadIB || (this.quadIB = A.createBuffer(FA.QUAD_INDICES, "index"));
6429
+ R[0] = 0, R[1] = 0, R[2] = r.left, R[3] = r.top, R[4] = G.left, R[5] = G.top, R[6] = 1, R[7] = 0, R[8] = r.right, R[9] = r.top, R[10] = G.right, R[11] = G.top, R[12] = 1, R[13] = 1, R[14] = r.right, R[15] = r.bottom, R[16] = G.right, R[17] = G.bottom, R[18] = 0, R[19] = 1, R[20] = r.left, R[21] = r.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 = qA(
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 = HA(0, g, Q, 0, -1, 1), C = 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 = sA(I), { w: e, h: a } = pA(E.info), t = UA(I, e, a);
6465
- WA(
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 ? FA.RGBA_QUAD_VERTS_WEBGPU : FA.RGBA_QUAD_VERTS_WEBGL,
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(FA.QUAD_INDICES, "index")), i === "cover") {
6479
- const h = qA(
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 = HA(0, o, i, 0, -1, 1), e = this.projCache), this.rgbaTopLeftQuadVB || (this.rgbaTopLeftQuadVB = A.createBuffer(
6513
- FA.RGBA_QUAD_VERTS_WEBGPU,
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(FA.QUAD_INDICES, "index"));
6516
- const { info: a } = g, { w: t, h: s } = pA(a), D = UA(I, t, s);
6517
- if (sA(I) === "cover") {
6518
- const c = qA(
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 = qA(
6527
+ const c = pA(
6528
6528
  I,
6529
6529
  I.x + D.offsetX,
6530
6530
  I.y + D.offsetY,
@@ -6539,7 +6539,7 @@ const rg = 1024, GB = 32, lI = class FA {
6539
6539
  if (!r) 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
- WA(
6542
+ ZA(
6543
6543
  I,
6544
6544
  I.x + D.offsetX + G * D.scaleX,
6545
6545
  I.y + D.offsetY + M * D.scaleY,
@@ -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 (sA(i) === "cover" || ((g = i.rotation) != null ? g : 0) !== 0) {
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 = UA(A, Q.w, Q.h, this.layoutScratch);
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 = sA(I), E = EI.alphaVideoContentSize(I, this.contentSizeScratch), o = UA(I, E.w, E.h, this.layoutScratch);
6788
- WA(
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 = qA(
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 = HA(0, I, g, 0, -1, 1), 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, lA = (B, A, I) => Zi(B, typeof A != "symbol" ? A + "" : 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
- lA(this, "quadVB", null), lA(this, "quadIB", null), lA(this, "scratchTransform", new Float32Array(16)), lA(this, "projCacheW", 0), lA(this, "projCacheH", 0), lA(this, "projCache", null);
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 = UA(I, g.width, g.height), C = I.x + Q.offsetX, E = I.y + Q.offsetY;
6848
- WA(I, C, E, Q.width, Q.height, this.scratchTransform);
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 = HA(0, i, e, 0, -1, 1));
6853
- const a = sA(I) === "cover";
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 = qA(
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
- lA(Og, "QUAD_VERTS", new Float32Array([
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
- lA(Og, "QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
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: wA(Q.startX, Q.targetX, E),
7016
- y: wA(Q.startY, Q.targetY, E),
7017
- scale: wA(Q.startScale, Q.targetScale, E),
7018
- opacity: wA(Q.startOpacity, Q.targetOpacity, E),
7019
- rotation: wA(Q.startRotation, Q.targetRotation, E)
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 = wA(Q.startX, Q.targetX, E), A.y = wA(Q.startY, Q.targetY, E), A.scale = wA(Q.startScale, Q.targetScale, E), A.opacity = wA(Q.startOpacity, Q.targetOpacity, E), A.rotation = wA(Q.startRotation, Q.targetRotation, E), !0;
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, bA = (B, A, I) => $i(B, typeof A != "symbol" ? A + "" : 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
- bA(this, "atlasW"), bA(this, "atlasH"), bA(this, "rowY", 0), bA(this, "rowH", 0), bA(this, "rowX", 0), bA(this, "slots", /* @__PURE__ */ new Map()), this.atlasW = Math.max(64, Math.floor(A)), this.atlasH = Math.max(64, Math.floor(I));
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();
@@ -7536,19 +7536,19 @@ class Qo {
7536
7536
  function NB() {
7537
7537
  return typeof DecompressionStream != "undefined";
7538
7538
  }
7539
- function BA() {
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 ? BA() : 0, Q = 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 = BA() - g, I == null || I(Q)), o), E = (o) => {
7551
- throw Q && (Q.error = rQ(o), Q.totalMs = BA() - g, I == null || I(Q)), o;
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 ? BA() : 0, i = A();
7560
- return Q && (Q.wasmMs = BA() - o), i ? C(i, "wasm") : C(await SB(B, Q != null ? Q : void 0), "native-retry");
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 ? BA() : 0, Q = 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 ? BA() : 0, e = Promise.resolve(
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 = BA() - i);
7598
+ }), Q && (Q.writerSubmitMs = QA() - i);
7599
7599
  const t = [];
7600
7600
  let s = 0;
7601
- const D = Q ? BA() : 0;
7601
+ const D = Q ? QA() : 0;
7602
7602
  for (; ; ) {
7603
7603
  const { done: F, value: c } = await o.read();
7604
7604
  if (F) break;
7605
7605
  t.push(c), s += c.length;
7606
7606
  }
7607
- await Promise.all([e, a]), Q && (Q.readMs = BA() - D, Q.outputChunks = t.length, Q.outputBytes = s);
7608
- const h = Q ? BA() : 0, w = new Uint8Array(s);
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
7609
  let n = 0;
7610
7610
  for (const F of t)
7611
7611
  w.set(F, n), n += F.length;
7612
- return Q && (Q.concatMs = BA() - h, Q.totalMs = BA() - g, Q.status = "success"), w;
7612
+ return Q && (Q.concatMs = QA() - h, Q.totalMs = QA() - g, Q.status = "success"), w;
7613
7613
  } catch (C) {
7614
- throw Q && (Q.totalMs = BA() - g, Q.error = rQ(C)), C;
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
  }
@@ -8316,7 +8316,7 @@ let uo = class {
8316
8316
  }
8317
8317
  };
8318
8318
  async function RQ(B, A, I, g) {
8319
- const Q = QA({ maxBudgetMs: I }), C = async () => {
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");
@@ -9834,11 +9834,11 @@ function Ho(B) {
9834
9834
  }
9835
9835
  }
9836
9836
  let tI = null, qo = 1;
9837
- const tA = /* @__PURE__ */ new Map();
9837
+ const sA = /* @__PURE__ */ new Map();
9838
9838
  function JB() {
9839
9839
  return typeof performance != "undefined" ? performance.now() : Date.now();
9840
9840
  }
9841
- function TA(B) {
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 tA)
9851
- Q.owner === B && (tA.delete(g), TA(Q), Q.reject(
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 = tA.get(I.id);
9861
+ const g = sA.get(I.id);
9862
9862
  if (!(!g || g.owner !== B))
9863
9863
  if (I.error)
9864
- tA.delete(I.id), TA(g), g.reject(new Error(I.error));
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 (tA.get(I.id) !== g) return;
9877
- tA.delete(I.id), TA(g);
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
- tA.get(I.id) === g && (tA.delete(I.id), TA(g), g.reject(E instanceof Error ? E : new Error(String(E))));
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
- tA.delete(I.id), TA(g), g.resolve(I.result);
9884
+ sA.delete(I.id), WA(g), g.resolve(I.result);
9885
9885
  } else
9886
- tA.delete(I.id), TA(g), g.reject(new Error("SVGA worker: empty result"));
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
- }, tA.set(g, i), (E = A.signal) != null && E.aborted) {
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 = QA({ maxBudgetMs: A }), Q = new Uint8Array(B.byteLength), C = 64 * 1024;
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);
@@ -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 = QA({ maxBudgetMs: A }), Q = new Uint8Array(B.byteLength), C = 64 * 1024;
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 = QA({ maxBudgetMs: A });
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 = QA({
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 (dA(t)) throw t;
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 = QA({
10234
+ const C = 2, E = 24, o = CA({
10235
10235
  maxBudgetMs: Math.max(2, A)
10236
10236
  });
10237
10237
  try {
@@ -10248,7 +10248,7 @@ async function HB(B, A, I) {
10248
10248
  throw n.close(), $("SVGA image decode aborted");
10249
10249
  g.set(h, n);
10250
10250
  } catch (n) {
10251
- if (dA(n)) throw n;
10251
+ if (JA(n)) throw n;
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 (dA(i)) throw i;
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,
@@ -10386,8 +10386,8 @@ async function SQ(B, A, I, g, Q) {
10386
10386
  });
10387
10387
  return Y(E, "SVGA parse aborted"), fB(Q == null ? void 0 : Q.svgaParseProfile, r), A ? wB(A, r) : bI.set(B, r), r;
10388
10388
  } catch (F) {
10389
- if (dA(F)) throw F;
10390
- console.warn("[GiftStage:SVGA] worker parse failed, using main thread", F), I = typeof B == "string" ? new Uint8Array(await mA(B)) : new Uint8Array(B);
10389
+ if (JA(F)) throw F;
10390
+ console.warn("[GiftStage:SVGA] worker parse failed, using main thread", F), 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;
@@ -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 mA(B)), Y(A == null ? void 0 : A.signal, "SVGA parse aborted"), g) {
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 mA(B)), Y(A == null ? void 0 : A.signal, "SVGA parse aborted"), g) {
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 YA extends Error {
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 YA(
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 YA(C.error));
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 YA(A.message || "SVGA atlas worker error")
11011
+ new KA(A.message || "SVGA atlas worker error")
11012
11012
  );
11013
11013
  }), B.addEventListener("messageerror", () => {
11014
11014
  PI(
11015
11015
  B,
11016
- new YA("SVGA atlas worker message deserialization failed")
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 YA("SVGA atlas worker creation failed", { cause: o });
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 YA("SVGA atlas worker task aborted", {
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 YA("SVGA atlas worker postMessage failed", {
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 = QA({
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");
@@ -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 = QA({
11219
+ const i = [], e = CA({
11220
11220
  maxBudgetMs: Q == null ? void 0 : Q.mainThreadFrameBudgetMs
11221
11221
  });
11222
11222
  try {
@@ -11592,7 +11592,7 @@ function WB(B, A, I) {
11592
11592
  });
11593
11593
  }
11594
11594
  let Je = 1;
11595
- class ZA {
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,12 +11609,12 @@ 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 ZA.createViaWorker(a, o, i);
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 ZA.createOnMainThread(e, o, i);
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);
@@ -11663,7 +11663,7 @@ class ZA {
11663
11663
  const n = a.length > 0 ? a[0] : 0, F = a.length > 0 ? a[a.length - 1] : 0;
11664
11664
  return console.info(
11665
11665
  `[GiftStage:WC] worker streaming ready frames=${a.length} duration=${o.toFixed(4)}s size=${i}x${e} times=[${n.toFixed(4)} … ${F.toFixed(4)}] ring=${I}`
11666
- ), new ZA(
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 ZA(
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 mA(B, A);
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 = sA(B);
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 } = pA(Q.info));
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, iA = (B, A, I) => ue(B, typeof A != "symbol" ? A + "" : 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")
@@ -11974,7 +11974,7 @@ function Te(B, A, I, g, Q = new Float32Array(
11974
11974
  }
11975
11975
  class We {
11976
11976
  constructor(A, I, g, Q, C, E = !0) {
11977
- this.config = A, this.frameMap = I, iA(this, "canvas"), iA(this, "gl"), iA(this, "program"), iA(this, "vertexShader"), iA(this, "fragmentShader"), iA(this, "vertexBuffer"), iA(this, "videoTexture"), iA(this, "imagePosLoc"), iA(this, "imagePositionsScratch"), iA(this, "resourceEntries"), iA(this, "textureUnitBySrcId", /* @__PURE__ */ new Map()), iA(this, "videoTextureWidth", 1), iA(this, "videoTextureHeight", 1);
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);
@@ -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, yA = (B, A, I) => Ve(B, typeof A != "symbol" ? A + "" : A, I);
12068
- const dQ = 1397178947, KQ = 14, ve = 8, GA = 64 * 1024;
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
- yA(this, "buffer"), yA(this, "view"), yA(this, "bytes"), yA(this, "offset", 0), yA(this, "encoder", new TextEncoder()), this.buffer = new ArrayBuffer(A), this.view = new DataView(this.buffer), this.bytes = new Uint8Array(this.buffer);
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 += GA) {
12091
- const i = Math.min(o + GA, this.offset);
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 += GA) {
12123
- const Q = Math.min(g + GA, A.byteLength);
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 += GA) {
12143
- const C = Math.min(Q + GA, g.byteLength);
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, yA(this, "view"), yA(this, "bytes"), yA(this, "offset", 0), yA(this, "decoder", new TextDecoder()), this.view = new DataView(A), this.bytes = new Uint8Array(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 += GA) {
12191
- const E = Math.min(C + GA, I);
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 eA(B) {
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 = QA({ maxBudgetMs: A }), o = () => eA(E), i = new Xe(ve + LQ(B) + GA);
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 eA(E);
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 eA(E);
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 eA(E);
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 eA(E);
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 eA(E);
12247
+ ), await aA(E);
12248
12248
  return i.finishCooperative(E);
12249
12249
  }
12250
12250
  async function Pe(B, A) {
12251
- const I = QA({ maxBudgetMs: A }), g = new Oe(B);
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();
@@ -12260,7 +12260,7 @@ async function Pe(B, A) {
12260
12260
  }, C = g.u32(), E = [];
12261
12261
  for (let n = 0; n < C; n++) {
12262
12262
  const F = g.u32(), c = g.u32(), r = await g.ownedBytesValueCooperative(I);
12263
- E.push({ width: F, height: c, imageBytes: r }), await eA(I);
12263
+ E.push({ width: F, height: c, imageBytes: r }), await aA(I);
12264
12264
  }
12265
12265
  const o = g.u32(), i = /* @__PURE__ */ new Map();
12266
12266
  for (let n = 0; n < o; n++) {
@@ -12271,7 +12271,7 @@ async function Pe(B, A) {
12271
12271
  y: g.f32(),
12272
12272
  w: g.f32(),
12273
12273
  h: g.f32()
12274
- }), await eA(I);
12274
+ }), await aA(I);
12275
12275
  }
12276
12276
  const e = g.u32(), a = [];
12277
12277
  for (let n = 0; n < e; n++)
@@ -12281,16 +12281,16 @@ async function Pe(B, A) {
12281
12281
  endFrame: g.u32(),
12282
12282
  startTime: g.f32(),
12283
12283
  totalTime: g.f32()
12284
- }), await eA(I);
12284
+ }), await aA(I);
12285
12285
  const t = g.u32(), s = /* @__PURE__ */ new Map();
12286
12286
  for (let n = 0; n < t; n++) {
12287
12287
  const F = g.string();
12288
- s.set(F, await g.ownedBytesValueCooperative(I)), await eA(I);
12288
+ s.set(F, await g.ownedBytesValueCooperative(I)), await aA(I);
12289
12289
  }
12290
- const D = await GQ(g, () => eA(I)), h = g.u32(), w = /* @__PURE__ */ new Map();
12290
+ const D = await GQ(g, () => aA(I)), h = g.u32(), w = /* @__PURE__ */ new Map();
12291
12291
  for (let n = 0; n < h; n++) {
12292
12292
  const F = g.string(), c = new Float32Array(await g.ownedBytesValueCooperative(I)), r = new Uint32Array(await g.ownedBytesValueCooperative(I));
12293
- F && c.length >= 6 && r.length >= 3 && w.set(F, { vertices: c, indices: r }), await eA(I);
12293
+ F && c.length >= 6 && r.length >= 3 && w.set(F, { vertices: c, indices: r }), 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 kA(B) {
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 = kA(B) ? B * 0.5 : 0, g = kA(A) ? A : 0;
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 = kA(A.width) ? A.width : void 0, C = kA(A.height) ? A.height : void 0, E = kA(B.width) ? B.width : void 0, o = kA(B.height) ? B.height : void 0, i = B.useOriginalSize === !0;
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 && kA(I) && kA(g) && (!i || e > I || a > g)) {
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 mA(B, A) : B;
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, q = (B, A, I) => ga(B, typeof A != "symbol" ? A + "" : 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 SA(B) {
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 zA = class fA {
12454
+ const wA = class BA {
12455
12455
  constructor(A) {
12456
- q(this, "sharedSVGAEntities", /* @__PURE__ */ new Map()), q(this, "pendingSharedSVGAEntities", /* @__PURE__ */ new Map()), q(this, "sharedVideoSources", /* @__PURE__ */ new Map()), q(this, "sharedHtmlVideos", /* @__PURE__ */ new Map()), q(this, "sharedVideoTextures", /* @__PURE__ */ new Map()), q(this, "pendingSharedHtmlVideos", /* @__PURE__ */ new Map()), q(this, "sharedImageTextures", /* @__PURE__ */ new Map()), q(this, "pendingSharedImageTextures", /* @__PURE__ */ new Map()), q(this, "sharedWebCodecsPlaybacks", /* @__PURE__ */ new Map()), q(this, "pendingSharedWebCodecsPlaybacks", /* @__PURE__ */ new Map()), q(this, "sharedWebCodecsSurfaces", /* @__PURE__ */ new Map()), q(this, "completedPlaybackSlots", /* @__PURE__ */ new Set()), q(this, "playbackCompleteWaiters", /* @__PURE__ */ new Map()), q(this, "canvas"), q(this, "backend", null), q(this, "manager", null), q(this, "options"), q(this, "ready"), q(this, "destroyed", !1), q(this, "resizeObserver", null), q(this, "nextRenderOrder", 0), q(this, "nextSharedWebCodecsPlaybackId", 1), q(this, "nextSharedWebCodecsSurfaceId", 1), q(this, "onWindowLayout", () => {
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: fA.DEFAULT_RESOURCE_CACHE_MEMORY_BYTES,
12478
- maxPersistentBytes: fA.DEFAULT_RESOURCE_CACHE_PERSISTENT_BYTES
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 dA(A) || A instanceof Error && A.message === v;
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 = pA(I.info);
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":
@@ -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,
@@ -12895,7 +12897,7 @@ const zA = class fA {
12895
12897
  try {
12896
12898
  a = await this.buildSVGAAtlasIfNeeded(e.imageBitmaps, !0, !0, I);
12897
12899
  } catch (w) {
12898
- if (dA(w) || !(w instanceof YA)) throw w;
12900
+ if (JA(w) || !(w instanceof KA)) throw w;
12899
12901
  for (const n of e.imageBitmaps.values()) n.close();
12900
12902
  e = await Ng(A, this.svgaParseOptions(I)), a = await this.buildSVGAAtlasIfNeeded(e.imageBitmaps, !0, !1, I);
12901
12903
  }
@@ -12965,7 +12967,7 @@ const zA = class fA {
12965
12967
  }
12966
12968
  async createCachedSVGAAtlasTextures(A, I) {
12967
12969
  var g;
12968
- const Q = [], C = QA({
12970
+ const Q = [], C = CA({
12969
12971
  maxBudgetMs: this.svgaAtlasFrameBudgetMs()
12970
12972
  });
12971
12973
  try {
@@ -13011,7 +13013,7 @@ const zA = class fA {
13011
13013
  }
13012
13014
  async finishLoadSVGA(A, I, g) {
13013
13015
  var Q;
13014
- const C = QA({
13016
+ const C = CA({
13015
13017
  maxBudgetMs: this.options.svgaLoadFrameBudgetMs
13016
13018
  });
13017
13019
  let E = 0;
@@ -13035,7 +13037,7 @@ const zA = class fA {
13035
13037
  }
13036
13038
  svgaAtlasMaxSize() {
13037
13039
  var A, I, g;
13038
- const Q = (A = this.options.svgaAtlasMaxSize) != null ? A : fA.SVGA_ATLAS_MAX_SIZE, C = (g = (I = this.backend) == null ? void 0 : I.maxTextureSize) != null ? g : Q;
13040
+ 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
13041
  return Math.max(64, Math.min(C, Q));
13040
13042
  }
13041
13043
  async buildSVGAAtlasIfNeeded(A, I, g = !0, Q) {
@@ -13045,7 +13047,7 @@ const zA = class fA {
13045
13047
  A,
13046
13048
  this.backend,
13047
13049
  this.svgaAtlasMaxSize(),
13048
- fA.SVGA_ATLAS_PADDING,
13050
+ BA.SVGA_ATLAS_PADDING,
13049
13051
  {
13050
13052
  captureEncodedPng: I,
13051
13053
  maxPages: this.svgaAtlasMaxPages(),
@@ -13071,9 +13073,9 @@ const zA = class fA {
13071
13073
  async tryWebCodecsPlayback(A, I) {
13072
13074
  if (!this.shouldTryWebCodecs()) return null;
13073
13075
  try {
13074
- const g = typeof A == "string" ? await mA(A, I) : A;
13076
+ const g = typeof A == "string" ? await xA(A, I) : A;
13075
13077
  if (I != null && I.aborted) throw new Error(v);
13076
- return await ZA.create(g, I, {
13078
+ return await VA.create(g, I, {
13077
13079
  useWorker: this.options.webCodecsDecodeInWorker !== !1,
13078
13080
  maxDecodedFrames: this.options.webCodecsMaxDecodedFrames,
13079
13081
  decodeAheadFrames: this.options.webCodecsDecodeAheadFrames
@@ -13094,14 +13096,14 @@ const zA = class fA {
13094
13096
  return g ? {
13095
13097
  playback: g,
13096
13098
  sharedState: null,
13097
- release: SA(() => g.destroy())
13099
+ release: kA(() => g.destroy())
13098
13100
  } : null;
13099
13101
  }
13100
13102
  async acquireSharedWebCodecsPlayback(A, I) {
13101
13103
  var g;
13102
13104
  const Q = performance.now(), C = Math.max(
13103
13105
  0,
13104
- (g = this.options.sharedVideoPlaybackWindowMs) != null ? g : fA.DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS
13106
+ (g = this.options.sharedVideoPlaybackWindowMs) != null ? g : BA.DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS
13105
13107
  ), E = this.sharedWebCodecsPlaybacks.get(A);
13106
13108
  if (E) {
13107
13109
  for (const e of E)
@@ -13109,7 +13111,7 @@ const zA = class fA {
13109
13111
  return e.refs++, {
13110
13112
  playback: e.playback,
13111
13113
  sharedState: e,
13112
- release: SA(() => this.releaseSharedWebCodecsPlayback(e))
13114
+ release: kA(() => this.releaseSharedWebCodecsPlayback(e))
13113
13115
  };
13114
13116
  }
13115
13117
  let o = this.pendingSharedWebCodecsPlaybacks.get(A);
@@ -13118,7 +13120,7 @@ const zA = class fA {
13118
13120
  return i ? (i.refs++, {
13119
13121
  playback: i.playback,
13120
13122
  sharedState: i,
13121
- release: SA(() => this.releaseSharedWebCodecsPlayback(i))
13123
+ release: kA(() => this.releaseSharedWebCodecsPlayback(i))
13122
13124
  }) : null;
13123
13125
  }
13124
13126
  createPendingSharedWebCodecsPlayback(A) {
@@ -13239,7 +13241,7 @@ const zA = class fA {
13239
13241
  const I = this.sharedWebCodecsSurfaces.get(A);
13240
13242
  return I ? (I.refs++, {
13241
13243
  surface: I.surface,
13242
- release: SA(() => this.releaseSharedWebCodecsSurface(I))
13244
+ release: kA(() => this.releaseSharedWebCodecsSurface(I))
13243
13245
  }) : null;
13244
13246
  }
13245
13247
  createSharedWebCodecsSurface(A, I, g, Q, C, E) {
@@ -13256,7 +13258,7 @@ const zA = class fA {
13256
13258
  };
13257
13259
  return this.sharedWebCodecsSurfaces.set(A, o), {
13258
13260
  surface: o.surface,
13259
- release: SA(() => this.releaseSharedWebCodecsSurface(o))
13261
+ release: kA(() => this.releaseSharedWebCodecsSurface(o))
13260
13262
  };
13261
13263
  }
13262
13264
  releaseSharedWebCodecsSurface(A) {
@@ -13273,7 +13275,7 @@ const zA = class fA {
13273
13275
  this.assertSlotLoadActive(A), A.vapConfig = o;
13274
13276
  const i = await fi(o, I.vapSlots);
13275
13277
  if (this.assertSlotLoadActive(A), i.size > 0) {
13276
- const D = pA(o.info), h = ui(o);
13278
+ const D = mA(o.info), h = ui(o);
13277
13279
  let w = null;
13278
13280
  if (this.backend.type === "webgpu" || this.backend.type === "webgl2")
13279
13281
  try {
@@ -13516,29 +13518,82 @@ const zA = class fA {
13516
13518
  */
13517
13519
  bindVideoLoopOnEnded(A, I) {
13518
13520
  I.addEventListener("ended", () => {
13519
- var g, Q;
13521
+ var g;
13520
13522
  if (A.state !== "playing") return;
13521
- const C = (g = A.options.loop) != null ? g : 1;
13522
- if (C === 0) {
13523
+ const Q = (g = A.options.loop) != null ? g : 1;
13524
+ if (Q === 0) {
13523
13525
  I.currentTime = 0, I.play();
13524
13526
  return;
13525
13527
  }
13526
- if (A.loopCount++, A.loopCount >= C) {
13527
- let E;
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";
13528
+ if (A.loopCount++, A.loopCount >= Q) {
13529
+ this.completeHtmlVideoPlayback(A);
13538
13530
  return;
13539
13531
  }
13540
- I.currentTime = 0, I.play();
13541
- });
13532
+ I.currentTime = 0, I.play().catch(() => {
13533
+ });
13534
+ }), this.armHtmlVideoPlaybackWatchdog(A, I);
13535
+ }
13536
+ clearHtmlVideoPlaybackWatchdog(A) {
13537
+ A.videoPlaybackWatchdogTimer != null && (clearTimeout(A.videoPlaybackWatchdogTimer), A.videoPlaybackWatchdogTimer = null);
13538
+ }
13539
+ completeHtmlVideoPlayback(A) {
13540
+ var I;
13541
+ if (A.state !== "playing" || A.videoPlaybackCompletionStarted) return;
13542
+ A.videoPlaybackCompletionStarted = !0, this.clearHtmlVideoPlaybackWatchdog(A);
13543
+ let g;
13544
+ g = {
13545
+ id: A.id,
13546
+ type: A.type,
13547
+ pause: () => {
13548
+ },
13549
+ resume: () => {
13550
+ },
13551
+ destroy: () => this.removeGift(A.id),
13552
+ animate: (Q) => this.createGiftAnimationChain(A, g, Q)
13553
+ };
13554
+ try {
13555
+ (I = A.onComplete) == null || I.call(A, g);
13556
+ } finally {
13557
+ A.state = A.options.clearsAfterStop === !1 ? "stopped" : "finished";
13558
+ }
13559
+ }
13560
+ armHtmlVideoPlaybackWatchdog(A, I) {
13561
+ var g;
13562
+ this.clearHtmlVideoPlaybackWatchdog(A);
13563
+ const Q = (g = A.options.loop) != null ? g : 1, C = I.duration;
13564
+ if (Q <= 0 || !Number.isFinite(C) || C <= 0) return;
13565
+ const E = Math.max(1, Math.ceil(Q)), o = C * E * 1e3;
13566
+ if (!Number.isFinite(o)) return;
13567
+ const i = Math.min(
13568
+ BA.HTML_VIDEO_WATCHDOG_MAX_GRACE_MS,
13569
+ Math.max(
13570
+ BA.HTML_VIDEO_WATCHDOG_MIN_GRACE_MS,
13571
+ o * BA.HTML_VIDEO_WATCHDOG_GRACE_RATIO
13572
+ )
13573
+ ), e = performance.now() + o + i, a = () => {
13574
+ if (A.state === "finished" || A.state === "stopped") {
13575
+ A.videoPlaybackWatchdogTimer = null;
13576
+ return;
13577
+ }
13578
+ const t = e - performance.now();
13579
+ if (t > 0) {
13580
+ A.videoPlaybackWatchdogTimer = setTimeout(
13581
+ a,
13582
+ Math.min(t, BA.MAX_TIMER_DELAY_MS)
13583
+ );
13584
+ return;
13585
+ }
13586
+ A.videoPlaybackWatchdogTimer = null, A.state === "playing" && (console.warn("[GiftStage] HTMLVideo playback timed out; completing gift", {
13587
+ giftId: A.id,
13588
+ type: A.type,
13589
+ duration: C,
13590
+ loop: E
13591
+ }), this.completeHtmlVideoPlayback(A));
13592
+ };
13593
+ A.videoPlaybackWatchdogTimer = setTimeout(
13594
+ a,
13595
+ Math.min(o + i, BA.MAX_TIMER_DELAY_MS)
13596
+ );
13542
13597
  }
13543
13598
  createVideo(A, I) {
13544
13599
  const g = document.createElement("video");
@@ -13546,14 +13601,20 @@ const zA = class fA {
13546
13601
  }
13547
13602
  waitVideoMetadata(A) {
13548
13603
  return new Promise((I, g) => {
13549
- const Q = () => {
13550
- A.removeEventListener("loadedmetadata", C), A.removeEventListener("error", E);
13551
- }, C = () => {
13552
- Q(), I();
13553
- }, E = () => {
13554
- Q(), g(new Error("Video metadata load failed"));
13604
+ let Q = !1, C = null;
13605
+ const E = () => {
13606
+ A.removeEventListener("loadedmetadata", i), A.removeEventListener("error", e), C != null && clearTimeout(C), C = null;
13607
+ }, o = (a) => {
13608
+ Q || (Q = !0, E(), a());
13609
+ }, i = () => {
13610
+ o(I);
13611
+ }, e = () => {
13612
+ o(() => g(new Error("Video metadata load failed")));
13555
13613
  };
13556
- A.addEventListener("loadedmetadata", C), A.addEventListener("error", E), A.readyState >= HTMLMediaElement.HAVE_METADATA && (Q(), I());
13614
+ A.addEventListener("loadedmetadata", i), A.addEventListener("error", e), C = setTimeout(
13615
+ () => o(() => g(new Error("Video metadata load timed out"))),
13616
+ BA.HTML_VIDEO_READY_TIMEOUT_MS
13617
+ ), A.readyState >= HTMLMediaElement.HAVE_METADATA && o(I);
13557
13618
  });
13558
13619
  }
13559
13620
  async probeVideoNaturalSize(A, I = "video") {
@@ -13607,7 +13668,7 @@ const zA = class fA {
13607
13668
  }
13608
13669
  }
13609
13670
  async fetchSharedVideoSource(A) {
13610
- const I = new Blob([await mA(A)]), g = this.sharedVideoSources.get(A), Q = URL.createObjectURL(I);
13671
+ const I = new Blob([await xA(A)]), g = this.sharedVideoSources.get(A), Q = URL.createObjectURL(I);
13611
13672
  return g && (g.objectUrl = Q, g.refs === 0 && (URL.revokeObjectURL(Q), this.sharedVideoSources.delete(A))), Q;
13612
13673
  }
13613
13674
  releaseSharedVideoSource(A) {
@@ -13619,7 +13680,7 @@ const zA = class fA {
13619
13680
  if (this.options.shareIdenticalVideoPlayback === !1 || I.loop !== 0 || typeof I.source != "string" || A.type === "vap" && A.vapMixState) return null;
13620
13681
  const C = this.normalizeSharedVideoSourceKey(I.source);
13621
13682
  if (!C) return null;
13622
- const E = (g = this.options.sharedVideoPlaybackWindowMs) != null ? g : fA.DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS, o = Math.max(0, E) / 1e3, i = this.sharedHtmlVideos.get(C);
13683
+ const E = (g = this.options.sharedVideoPlaybackWindowMs) != null ? g : BA.DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS, o = Math.max(0, E) / 1e3, i = this.sharedHtmlVideos.get(C);
13623
13684
  if (i)
13624
13685
  return i.video.currentTime > o ? null : (i.refs++, {
13625
13686
  cacheKey: C,
@@ -13689,7 +13750,7 @@ const zA = class fA {
13689
13750
  texture: o,
13690
13751
  width: E.width,
13691
13752
  height: E.height,
13692
- release: SA(() => {
13753
+ release: kA(() => {
13693
13754
  var i;
13694
13755
  return (i = this.backend) == null ? void 0 : i.deleteTexture(o);
13695
13756
  })
@@ -13704,7 +13765,7 @@ const zA = class fA {
13704
13765
  texture: g.texture,
13705
13766
  width: g.width,
13706
13767
  height: g.height,
13707
- release: SA(() => this.releaseSharedImageTexture(A))
13768
+ release: kA(() => this.releaseSharedImageTexture(A))
13708
13769
  };
13709
13770
  let Q = this.pendingSharedImageTextures.get(A);
13710
13771
  if (!Q) {
@@ -13743,7 +13804,7 @@ const zA = class fA {
13743
13804
  texture: C.texture,
13744
13805
  width: C.width,
13745
13806
  height: C.height,
13746
- release: SA(() => this.releaseSharedImageTexture(A))
13807
+ release: kA(() => this.releaseSharedImageTexture(A))
13747
13808
  };
13748
13809
  }
13749
13810
  releaseSharedImageTexture(A) {
@@ -13778,20 +13839,29 @@ const zA = class fA {
13778
13839
  }
13779
13840
  waitVideoReady(A) {
13780
13841
  return new Promise((I, g) => {
13781
- const Q = () => {
13782
- A.removeEventListener("canplay", E), A.removeEventListener("error", o);
13783
- }, C = async () => {
13784
- try {
13785
- await A.play(), await this.waitForFirstVideoFrame(A), I();
13786
- } catch (i) {
13787
- g(i);
13842
+ let Q = !1, C = !1, E = null;
13843
+ const o = () => {
13844
+ A.removeEventListener("canplay", a), A.removeEventListener("error", t), E != null && clearTimeout(E), E = null;
13845
+ }, i = (s) => {
13846
+ Q || (Q = !0, o(), s());
13847
+ }, e = async () => {
13848
+ if (!(C || Q)) {
13849
+ C = !0;
13850
+ try {
13851
+ await A.play(), await this.waitForFirstVideoFrame(A), i(I);
13852
+ } catch (s) {
13853
+ i(() => g(s));
13854
+ }
13788
13855
  }
13789
- }, E = () => {
13790
- Q(), C();
13791
- }, o = () => {
13792
- Q(), g(new Error("Video load failed"));
13856
+ }, a = () => {
13857
+ e();
13858
+ }, t = () => {
13859
+ i(() => g(new Error("Video load failed")));
13793
13860
  };
13794
- A.addEventListener("canplay", E), A.addEventListener("error", o), A.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA && (Q(), C());
13861
+ A.addEventListener("canplay", a), A.addEventListener("error", t), E = setTimeout(
13862
+ () => i(() => g(new Error("Video ready timed out"))),
13863
+ BA.HTML_VIDEO_READY_TIMEOUT_MS
13864
+ ), A.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA && e();
13795
13865
  });
13796
13866
  }
13797
13867
  removeGift(A) {
@@ -13862,12 +13932,17 @@ const zA = class fA {
13862
13932
  });
13863
13933
  }
13864
13934
  };
13865
- q(zA, "SVGA_ATLAS_MAX_SIZE", 2048);
13866
- q(zA, "SVGA_ATLAS_PADDING", 2);
13867
- q(zA, "DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS", 100);
13868
- q(zA, "DEFAULT_RESOURCE_CACHE_MEMORY_BYTES", 128 * 1024 * 1024);
13869
- q(zA, "DEFAULT_RESOURCE_CACHE_PERSISTENT_BYTES", 2048 * 1024 * 1024);
13870
- let na = zA;
13935
+ H(wA, "SVGA_ATLAS_MAX_SIZE", 2048);
13936
+ H(wA, "SVGA_ATLAS_PADDING", 2);
13937
+ H(wA, "DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS", 100);
13938
+ H(wA, "HTML_VIDEO_READY_TIMEOUT_MS", 15e3);
13939
+ H(wA, "HTML_VIDEO_WATCHDOG_MIN_GRACE_MS", 2e3);
13940
+ H(wA, "HTML_VIDEO_WATCHDOG_MAX_GRACE_MS", 1e4);
13941
+ H(wA, "HTML_VIDEO_WATCHDOG_GRACE_RATIO", 0.2);
13942
+ H(wA, "MAX_TIMER_DELAY_MS", 2147e6);
13943
+ H(wA, "DEFAULT_RESOURCE_CACHE_MEMORY_BYTES", 128 * 1024 * 1024);
13944
+ H(wA, "DEFAULT_RESOURCE_CACHE_PERSISTENT_BYTES", 2048 * 1024 * 1024);
13945
+ let na = wA;
13871
13946
  export {
13872
13947
  Ti as AlphaVideoRenderer,
13873
13948
  zi as AudioManager,
@@ -13878,7 +13953,7 @@ export {
13878
13953
  Qo as RenderManager,
13879
13954
  zE as SVGABatchRenderer,
13880
13955
  mi as VAPRenderer,
13881
- ZA as WebCodecsMp4Playback,
13956
+ VA as WebCodecsMp4Playback,
13882
13957
  QB as WebGL1Backend,
13883
13958
  cC as WebGL2Backend,
13884
13959
  hC as WebGPUBackend,
@@ -13901,9 +13976,9 @@ export {
13901
13976
  SB as inflateJS,
13902
13977
  zC as initWasm,
13903
13978
  eI as isWasmReady,
13904
- wA as lerp,
13979
+ rA as lerp,
13905
13980
  aa as linear,
13906
- HA as ortho,
13981
+ qA as ortho,
13907
13982
  Ng as parseSVGA,
13908
13983
  nB as parseVAPConfig
13909
13984
  };