@taole/giftstage 0.3.1 → 0.3.2

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.
@@ -3932,12 +3932,12 @@ const hg = class CA {
3932
3932
  rA,
3933
3933
  this.storageBindOffsetAlign
3934
3934
  ), this.writeInstancedStorageShadow(QA, UA, rA), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += rA, x && BA >= 0 && (this.svgaCompactSlotStateUploadId = BA, this.svgaCompactSlotStateStorageBase = QA, this.svgaCompactSlotStateByteLength = rA));
3935
- const V = A.motionTrackIndex, YA = A.motionTrackBuffer, kA = A.motionTrackGlobalsBuffer, W = YA ? this.buffers.get(YA.id) : null, pA = kA ? this.buffers.get(kA.id) : null, LA = Math.floor((D = A.motionTrackSampleCount) != null ? D : 0), ag = Math.floor(V != null ? V : -1), OA = (ag + 1) * LA * 8 * 4, KA = ag >= 0 && LA >= 1 && (W == null ? void 0 : W.usage) === "storage" && (pA == null ? void 0 : pA.usage) === "uniform" && W.buffer.size >= OA && pA.buffer.size >= 32, qA = A.stencil === "test" ? "test" : A.stencil === "write" ? "write" : A.stencil === "clear" ? "clear" : this.frameUsesStencil ? "pass" : "none", sA = l ? this.ensureSVGAFrameTableMeshPipeline(
3935
+ const V = A.motionTrackIndex, YA = A.motionTrackBuffer, kA = A.motionTrackGlobalsBuffer, W = YA ? this.buffers.get(YA.id) : null, pA = kA ? this.buffers.get(kA.id) : null, LA = Math.floor((D = A.motionTrackSampleCount) != null ? D : 0), ag = Math.floor(V != null ? V : -1), OA = (ag + 1) * LA * 8 * 4, KA = ag >= 0 && LA >= 1 && (W == null ? void 0 : W.usage) === "storage" && (pA == null ? void 0 : pA.usage) === "uniform" && W.buffer.size >= OA && pA.buffer.size >= 32, TA = A.stencil === "test" ? "test" : A.stencil === "write" ? "write" : A.stencil === "clear" ? "clear" : this.frameUsesStencil ? "pass" : "none", sA = l ? this.ensureSVGAFrameTableMeshPipeline(
3936
3936
  A.shader,
3937
- qA
3938
- ) : this.ensureSVGAFrameTablePipeline(qA === "test" ? "test" : qA === "pass" ? "pass" : "none");
3937
+ TA
3938
+ ) : this.ensureSVGAFrameTablePipeline(TA === "test" ? "test" : TA === "pass" ? "pass" : "none");
3939
3939
  this.lastDrawPipeline !== sA.pipeline && (w.setPipeline(sA.pipeline), this.lastDrawPipeline = sA.pipeline, this.lastInstancedTextureBindGroup = null);
3940
- const L = qA === "test" || qA === "write" ? 1 : 0;
3940
+ const L = TA === "test" || TA === "write" ? 1 : 0;
3941
3941
  this.frameUsesStencil && this.lastStencilRef !== L && (w.setStencilReference(L), this.lastStencilRef = L);
3942
3942
  const EA = A.uniforms.u_projection;
3943
3943
  if (!(EA instanceof Float32Array) || EA.length < 16) return;
@@ -4007,20 +4007,20 @@ const hg = class CA {
4007
4007
  }), this.instancedTextureBindGroupCache.set(eA, tA)), w.setBindGroup(1, tA), this.lastVertexBufferId !== A.vertexBuffer.id && (w.setVertexBuffer(0, Bg.buffer), this.lastVertexBufferId = A.vertexBuffer.id), this.lastIndexBufferId !== A.indexBuffer.id && (w.setIndexBuffer(AA.buffer, "uint32"), this.lastIndexBufferId = A.indexBuffer.id), w.drawIndexed(A.indexCount, F, 0, 0, 0), this.recordSubmittedDraw();
4008
4008
  }
4009
4009
  resolveSVGAFrameTableSlotUniform(A, g, I) {
4010
- var B, Q, E, i, e, t, a, o, s, n, r, h, c, D, w, l, F, d, y, G, f, u, R, M, N, S, Y, U, k, m, J, q, _, Z, x, X, v, gA, UA, yA, rA, BA, Ig, QA, V, YA, kA, W, pA, LA, ag, OA, KA, qA, sA;
4010
+ var B, Q, E, i, e, t, a, o, s, n, r, h, c, D, w, l, F, d, y, G, f, u, R, M, N, S, Y, U, k, m, J, q, _, Z, x, X, v, gA, UA, yA, rA, BA, Ig, QA, V, YA, kA, W, pA, LA, ag, OA, KA, TA, sA;
4011
4011
  const L = (Q = (B = A.svgaFrameTableSlotState) != null ? B : A.svgaSlotState) != null ? Q : A.uniforms.u_svgaSlotState instanceof Float32Array ? A.uniforms.u_svgaSlotState : A.uniforms.u_slotState instanceof Float32Array ? A.uniforms.u_slotState : null, EA = A.uniforms.u_transform, Bg = A.uniforms.u_clipRect, AA = A.svgaFrameTableParentAffine, DA = A.svgaFrameTableParentTranslate, IA = A.svgaFrameTableClipRect, pg = A.svgaFrameIndex != null || A.svgaFrameTableFrameIndex != null || A.frameTableFrameIndex != null, Kg = A.svgaFrameTableOpacity != null || typeof A.uniforms.u_opacity == "number", Cg = A.uniforms.u_projection;
4012
4012
  if (!(Cg instanceof Float32Array) || Cg.length < 16) return null;
4013
- let GA = 1, fA = 0, dA = 0, iA = 1, eA = 0, tA = 0, hA = (E = A.svgaFrameTableOpacity) != null ? E : typeof A.uniforms.u_opacity == "number" ? A.uniforms.u_opacity : 1, aA = (t = (e = (i = A.svgaFrameIndex) != null ? i : A.svgaFrameTableFrameIndex) != null ? e : A.frameTableFrameIndex) != null ? t : 0, nA = 0, RA = 0, uA = this.canvas.width, TA = this.canvas.height, Qg = 0, Wg = (a = A.svgaFrameTableAtlasPage) != null ? a : -1, PA = (h = (r = (n = (s = (o = A.svgaFrameTableMetadataBase) != null ? o : A.svgaFrameTableSpriteBase) != null ? s : A.frameTableSpriteBase) != null ? n : A.svgaSpriteMetadataBase) != null ? r : A.svgaSpriteBase) != null ? h : 0;
4013
+ let GA = 1, fA = 0, dA = 0, iA = 1, eA = 0, tA = 0, hA = (E = A.svgaFrameTableOpacity) != null ? E : typeof A.uniforms.u_opacity == "number" ? A.uniforms.u_opacity : 1, aA = (t = (e = (i = A.svgaFrameIndex) != null ? i : A.svgaFrameTableFrameIndex) != null ? e : A.frameTableFrameIndex) != null ? t : 0, nA = 0, RA = 0, uA = this.canvas.width, vA = this.canvas.height, Qg = 0, Wg = (a = A.svgaFrameTableAtlasPage) != null ? a : -1, PA = (h = (r = (n = (s = (o = A.svgaFrameTableMetadataBase) != null ? o : A.svgaFrameTableSpriteBase) != null ? s : A.frameTableSpriteBase) != null ? n : A.svgaSpriteMetadataBase) != null ? r : A.svgaSpriteBase) != null ? h : 0;
4014
4014
  if (AA && AA.length >= 4)
4015
- GA = (c = AA[0]) != null ? c : GA, fA = (D = AA[1]) != null ? D : fA, dA = (w = AA[2]) != null ? w : dA, iA = (l = AA[3]) != null ? l : iA, DA && DA.length >= 2 && (eA = (F = DA[0]) != null ? F : eA, tA = (d = DA[1]) != null ? d : tA), IA && IA.length >= 4 && (nA = (y = IA[0]) != null ? y : nA, RA = (G = IA[1]) != null ? G : RA, uA = (f = IA[2]) != null ? f : uA, TA = (u = IA[3]) != null ? u : TA, Qg = 1);
4015
+ GA = (c = AA[0]) != null ? c : GA, fA = (D = AA[1]) != null ? D : fA, dA = (w = AA[2]) != null ? w : dA, iA = (l = AA[3]) != null ? l : iA, DA && DA.length >= 2 && (eA = (F = DA[0]) != null ? F : eA, tA = (d = DA[1]) != null ? d : tA), IA && IA.length >= 4 && (nA = (y = IA[0]) != null ? y : nA, RA = (G = IA[1]) != null ? G : RA, uA = (f = IA[2]) != null ? f : uA, vA = (u = IA[3]) != null ? u : vA, Qg = 1);
4016
4016
  else if (L && L.length >= 13)
4017
- GA = (R = L[0]) != null ? R : GA, fA = (M = L[1]) != null ? M : fA, dA = (N = L[2]) != null ? N : dA, iA = (S = L[3]) != null ? S : iA, eA = (Y = L[4]) != null ? Y : eA, tA = (U = L[5]) != null ? U : tA, Kg || (hA = (k = L[6]) != null ? k : hA), pg || (aA = (m = L[7]) != null ? m : aA), nA = (J = L[8]) != null ? J : nA, RA = (q = L[9]) != null ? q : RA, uA = (_ = L[10]) != null ? _ : uA, TA = (Z = L[11]) != null ? Z : TA, Qg = ((x = L[12]) != null ? x : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && L.length >= 14 && (PA = (X = L[13]) != null ? X : PA);
4017
+ GA = (R = L[0]) != null ? R : GA, fA = (M = L[1]) != null ? M : fA, dA = (N = L[2]) != null ? N : dA, iA = (S = L[3]) != null ? S : iA, eA = (Y = L[4]) != null ? Y : eA, tA = (U = L[5]) != null ? U : tA, Kg || (hA = (k = L[6]) != null ? k : hA), pg || (aA = (m = L[7]) != null ? m : aA), nA = (J = L[8]) != null ? J : nA, RA = (q = L[9]) != null ? q : RA, uA = (_ = L[10]) != null ? _ : uA, vA = (Z = L[11]) != null ? Z : vA, Qg = ((x = L[12]) != null ? x : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && L.length >= 14 && (PA = (X = L[13]) != null ? X : PA);
4018
4018
  else if (EA instanceof Float32Array && EA.length >= 16) {
4019
4019
  GA = (v = EA[0]) != null ? v : GA, fA = (gA = EA[1]) != null ? gA : fA, dA = (UA = EA[4]) != null ? UA : dA, iA = (yA = EA[5]) != null ? yA : iA, eA = (rA = EA[12]) != null ? rA : eA, tA = (BA = EA[13]) != null ? BA : tA;
4020
4020
  const _g = Bg instanceof Float32Array && Bg.length >= 4 ? Bg : IA;
4021
- _g && _g.length >= 4 && (nA = (Ig = _g[0]) != null ? Ig : nA, RA = (QA = _g[1]) != null ? QA : RA, uA = (V = _g[2]) != null ? V : uA, TA = (YA = _g[3]) != null ? YA : TA, Qg = typeof A.uniforms.u_clipEnabled == "number" ? A.uniforms.u_clipEnabled > 0.5 ? 1 : 0 : 1);
4021
+ _g && _g.length >= 4 && (nA = (Ig = _g[0]) != null ? Ig : nA, RA = (QA = _g[1]) != null ? QA : RA, uA = (V = _g[2]) != null ? V : uA, vA = (YA = _g[3]) != null ? YA : vA, Qg = typeof A.uniforms.u_clipEnabled == "number" ? A.uniforms.u_clipEnabled > 0.5 ? 1 : 0 : 1);
4022
4022
  }
4023
- return AA && L && L.length >= 13 && (DA || (eA = (kA = L[4]) != null ? kA : eA, tA = (W = L[5]) != null ? W : tA), Kg || (hA = (pA = L[6]) != null ? pA : hA), pg || (aA = (LA = L[7]) != null ? LA : aA), IA || (nA = (ag = L[8]) != null ? ag : nA, RA = (OA = L[9]) != null ? OA : RA, uA = (KA = L[10]) != null ? KA : uA, TA = (qA = L[11]) != null ? qA : TA, Qg = ((sA = L[12]) != null ? sA : 0) > 0.5 ? 1 : 0)), Number.isFinite(hA) || (hA = 1), Number.isFinite(aA) || (aA = 0), Number.isFinite(PA) || (PA = 0), Number.isFinite(Wg) || (Wg = -1), aA = Math.max(0, Math.min(I - 1, Math.floor(aA))), PA = Math.max(0, Math.floor(PA)), ![GA, fA, dA, iA, eA, tA, hA].every(Number.isFinite) || g < 1 ? null : {
4023
+ return AA && L && L.length >= 13 && (DA || (eA = (kA = L[4]) != null ? kA : eA, tA = (W = L[5]) != null ? W : tA), Kg || (hA = (pA = L[6]) != null ? pA : hA), pg || (aA = (LA = L[7]) != null ? LA : aA), IA || (nA = (ag = L[8]) != null ? ag : nA, RA = (OA = L[9]) != null ? OA : RA, uA = (KA = L[10]) != null ? KA : uA, vA = (TA = L[11]) != null ? TA : vA, Qg = ((sA = L[12]) != null ? sA : 0) > 0.5 ? 1 : 0)), Number.isFinite(hA) || (hA = 1), Number.isFinite(aA) || (aA = 0), Number.isFinite(PA) || (PA = 0), Number.isFinite(Wg) || (Wg = -1), aA = Math.max(0, Math.min(I - 1, Math.floor(aA))), PA = Math.max(0, Math.floor(PA)), ![GA, fA, dA, iA, eA, tA, hA].every(Number.isFinite) || g < 1 ? null : {
4024
4024
  parentA: GA,
4025
4025
  parentB: fA,
4026
4026
  parentC: dA,
@@ -4032,7 +4032,7 @@ const hg = class CA {
4032
4032
  clipX0: nA,
4033
4033
  clipY0: RA,
4034
4034
  clipX1: uA,
4035
- clipY1: TA,
4035
+ clipY1: vA,
4036
4036
  clipEnabled: Qg,
4037
4037
  metadataBase: PA,
4038
4038
  atlasPage: Math.max(-1, Math.floor(Wg))
@@ -4234,7 +4234,7 @@ function dC(C, A, g) {
4234
4234
  }
4235
4235
  return I;
4236
4236
  }
4237
- function vA(C, A, g) {
4237
+ function WA(C, A, g) {
4238
4238
  const I = dC(C, C.VERTEX_SHADER, A), B = dC(C, C.FRAGMENT_SHADER, g), Q = C.createProgram();
4239
4239
  if (!Q)
4240
4240
  throw C.deleteShader(I), C.deleteShader(B), new Error("Failed to create program");
@@ -4263,7 +4263,7 @@ function pI(C) {
4263
4263
  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;
4264
4264
  }
4265
4265
  var si = Object.defineProperty, ni = (C, A, g) => A in C ? si(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, H = (C, A, g) => ni(C, typeof A != "symbol" ? A + "" : A, g);
4266
- const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), hi = new Float32Array([1, 1]), SA = class xA {
4266
+ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), hi = new Float32Array([1, 1]), SA = class bA {
4267
4267
  constructor(A, g = !0) {
4268
4268
  H(this, "type", "webgl2"), H(this, "supportsAtomicFrameReplay", !0), H(this, "canvas"), H(this, "maxTextureSize", 4096), H(this, "antialias"), H(this, "gl"), H(this, "nextId", 1), H(this, "buffers", /* @__PURE__ */ new Map()), H(this, "textures", /* @__PURE__ */ new Map()), H(this, "frameTables", /* @__PURE__ */ new Map()), H(this, "ownedFrameTableMetadataIds", /* @__PURE__ */ new Set()), H(this, "programs", /* @__PURE__ */ new Map()), H(this, "vertexArrays", /* @__PURE__ */ new Map()), H(this, "cachedDrawProgram", null), H(this, "cachedTex0Id", null), H(this, "cachedFrameTableId", null), H(this, "cachedFrameMetadataId", null), H(this, "cachedProjectionRef", null), H(this, "cachedProjectionShader", null), H(this, "videoUploadCanvas", null), H(this, "videoUploadCtx", null), H(this, "videoElementPreferCanvasBridge", oi()), H(this, "videoElementDirectUploadValidated", !1), H(this, "maxVertexTextureImageUnits", 0), H(this, "svgaFrameTableSupported", !1), H(this, "instancedSvgaInstanceGLBuffer", null), H(this, "svgaSlotStateTexture", null), H(this, "svgaSlotStateTextureWidth", 0), H(this, "svgaSlotStateTextureHeight", 0), H(this, "svgaSlotStateUploadScratch", new Float32Array(0)), H(this, "svgaSlotStateUploadId", -1), H(this, "svgaTableInfoScratch", new Int32Array(4)), H(this, "svgaTableSizeScratch", new Int32Array(2)), H(this, "svgaMetadataSizeScratch", new Int32Array(2)), H(this, "instancedClipMaskGLBuffer", null), H(this, "instancedAlphaInstanceGLBuffer", null), H(this, "performanceBufferWrites", 0), H(this, "performanceBufferWriteBytes", 0), H(this, "performanceStorageBufferWrites", 0), H(this, "performanceStorageBufferWriteBytes", 0), H(this, "performanceSubmittedDrawCalls", 0), H(this, "performanceRejectedDrawCalls", 0), H(this, "performanceSVGADynamicUploadWrites", 0), H(this, "performanceSVGADynamicUploadBytes", 0), H(this, "runtimeSubmittedDrawCalls", 0), H(this, "runtimeRejectedDrawCalls", 0), H(this, "currentDrawResult", $(
4269
4269
  "invalid-command",
@@ -4322,19 +4322,19 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
4322
4322
  this.currentDrawRecorded = !0, this.currentDrawResult.submitted && (this.currentDrawResult = $("invalid-command", "WebGL2 draw was rejected")), this.performanceRejectedDrawCalls++, this.runtimeRejectedDrawCalls++;
4323
4323
  }
4324
4324
  initPrograms() {
4325
- const A = this.gl, g = vA(A, P.svgaBatchPremul.vert, P.svgaBatchPremul.frag);
4325
+ const A = this.gl, g = WA(A, P.svgaBatchPremul.vert, P.svgaBatchPremul.frag);
4326
4326
  this.programs.set(
4327
4327
  "svga-batch-premul",
4328
4328
  this.makeProgramEntry(g, { transform: !0, opacity: !0 })
4329
4329
  ), this.bindProgramSamplers(g, { u_atlas: 0 });
4330
- const I = vA(
4330
+ const I = WA(
4331
4331
  A,
4332
4332
  P.svgaInstancedPremul.vert,
4333
4333
  P.svgaInstancedPremul.frag
4334
4334
  );
4335
4335
  if (this.programs.set("svga-instanced-premul", this.makeProgramEntry(I)), this.bindProgramSamplers(I, { u_atlas: 0 }), this.maxVertexTextureImageUnits >= 2 && this.maxTextureSize >= 3)
4336
4336
  try {
4337
- const n = vA(
4337
+ const n = WA(
4338
4338
  A,
4339
4339
  P.svgaFrameTableInstancedPremul.vert,
4340
4340
  P.svgaFrameTableInstancedPremul.frag
@@ -4369,7 +4369,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
4369
4369
  u_spriteMetadata: 2,
4370
4370
  u_slotStates: 3
4371
4371
  });
4372
- const r = vA(
4372
+ const r = WA(
4373
4373
  A,
4374
4374
  P.svgaFrameTableShape.vert,
4375
4375
  P.svgaFrameTableShape.frag
@@ -4393,7 +4393,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
4393
4393
  compactSlotStateEnabled: !0
4394
4394
  })
4395
4395
  ), this.bindProgramSamplers(r, { u_frameTable: 0, u_slotStates: 3 });
4396
- const h = vA(
4396
+ const h = WA(
4397
4397
  A,
4398
4398
  P.svgaFrameTableClipMask.vert,
4399
4399
  P.svgaFrameTableClipMask.frag
@@ -4419,7 +4419,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
4419
4419
  } catch (n) {
4420
4420
  this.svgaFrameTableSupported = !1, console.warn("[WebGL2] SVGA frame-table shader unavailable; using CPU reference path.", n);
4421
4421
  }
4422
- const B = vA(A, P.vap.vert, P.vap.frag);
4422
+ const B = WA(A, P.vap.vert, P.vap.frag);
4423
4423
  this.programs.set(
4424
4424
  "vap",
4425
4425
  this.makeProgramEntry(B, {
@@ -4429,12 +4429,12 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
4429
4429
  rgbPremultiplied: !0
4430
4430
  })
4431
4431
  ), this.bindProgramSamplers(B, { u_video: 0 });
4432
- const Q = vA(A, P.vapMixOverlay.vert, P.vapMixOverlay.frag);
4432
+ const Q = WA(A, P.vapMixOverlay.vert, P.vapMixOverlay.frag);
4433
4433
  this.programs.set(
4434
4434
  "vap-mix-overlay",
4435
4435
  this.makeProgramEntry(Q, { transform: !0, atlasRemap: !0, opacity: !0 })
4436
4436
  ), this.bindProgramSamplers(Q, { u_resource: 0, u_video: 1 });
4437
- const E = vA(A, P.alphaVideo.vert, P.alphaVideo.frag);
4437
+ const E = WA(A, P.alphaVideo.vert, P.alphaVideo.frag);
4438
4438
  this.programs.set(
4439
4439
  "alpha-video",
4440
4440
  this.makeProgramEntry(E, {
@@ -4444,28 +4444,28 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
4444
4444
  rgbPremultiplied: !0
4445
4445
  })
4446
4446
  ), this.bindProgramSamplers(E, { u_video: 0 });
4447
- const i = vA(A, P.rgbaTextured.vert, P.rgbaTextured.frag);
4447
+ const i = WA(A, P.rgbaTextured.vert, P.rgbaTextured.frag);
4448
4448
  this.programs.set(
4449
4449
  "rgba-textured",
4450
4450
  this.makeProgramEntry(i, { transform: !0, atlasRemap: !0, opacity: !0 })
4451
4451
  ), this.bindProgramSamplers(i, { u_video: 0 });
4452
- const e = vA(
4452
+ const e = WA(
4453
4453
  A,
4454
4454
  P.alphaVideoInstanced.vert,
4455
4455
  P.alphaVideoInstanced.frag
4456
4456
  );
4457
4457
  this.programs.set("alpha-video-instanced", this.makeProgramEntry(e)), this.bindProgramSamplers(e, { u_video: 0 });
4458
- const t = vA(A, P.vapInstanced.vert, P.vapInstanced.frag);
4458
+ const t = WA(A, P.vapInstanced.vert, P.vapInstanced.frag);
4459
4459
  this.programs.set("vap-instanced", this.makeProgramEntry(t)), this.bindProgramSamplers(t, { u_video: 0 });
4460
- const a = vA(A, P.clipMask.vert, P.clipMask.frag);
4460
+ const a = WA(A, P.clipMask.vert, P.clipMask.frag);
4461
4461
  this.programs.set("clip-mask", this.makeProgramEntry(a, { transform: !0 }));
4462
- const o = vA(
4462
+ const o = WA(
4463
4463
  A,
4464
4464
  P.clipMaskInstanced.vert,
4465
4465
  P.clipMaskInstanced.frag
4466
4466
  );
4467
4467
  this.programs.set("clip-mask-instanced", this.makeProgramEntry(o));
4468
- const s = vA(
4468
+ const s = WA(
4469
4469
  A,
4470
4470
  P.particleInstanced.vert,
4471
4471
  P.particleInstanced.frag
@@ -4475,7 +4475,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
4475
4475
  ensureParticleSpriteProgram() {
4476
4476
  let A = this.programs.get("particle-sprite-instanced");
4477
4477
  if (A) return A;
4478
- const g = vA(
4478
+ const g = WA(
4479
4479
  this.gl,
4480
4480
  P.particleSpriteInstanced.vert,
4481
4481
  P.particleSpriteInstanced.frag
@@ -5081,7 +5081,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5081
5081
  if (!this.instancedSvgaInstanceGLBuffer) {
5082
5082
  const g = A.createBuffer();
5083
5083
  if (!g) throw new Error("createBuffer failed");
5084
- A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, g), A.bufferData(A.ARRAY_BUFFER, xA.INST_SVGA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedSvgaInstanceGLBuffer = g;
5084
+ A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, g), A.bufferData(A.ARRAY_BUFFER, bA.INST_SVGA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedSvgaInstanceGLBuffer = g;
5085
5085
  }
5086
5086
  return this.instancedSvgaInstanceGLBuffer;
5087
5087
  }
@@ -5099,19 +5099,19 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5099
5099
  return e !== t.length && (this.svgaSlotStateUploadScratch.length < e && (this.svgaSlotStateUploadScratch = new Float32Array(e)), this.svgaSlotStateUploadScratch.fill(0, 0, e), this.svgaSlotStateUploadScratch.set(t), a = this.svgaSlotStateUploadScratch.subarray(0, e)), B.texSubImage2D(B.TEXTURE_2D, 0, 0, 0, E, i, B.RGBA, B.FLOAT, a, 0), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += g * $A * Float32Array.BYTES_PER_ELEMENT, this.svgaSlotStateUploadId = I, { width: E, height: i };
5100
5100
  }
5101
5101
  resolveSVGAFrameTableSlotState(A, g) {
5102
- var I, B, Q, E, i, e, t, a, o, s, n, r, h, c, D, w, l, F, d, y, G, f, u, R, M, N, S, Y, U, k, m, J, q, _, Z, x, X, v, gA, UA, yA, rA, BA, Ig, QA, V, YA, kA, W, pA, LA, ag, OA, KA, qA;
5102
+ var I, B, Q, E, i, e, t, a, o, s, n, r, h, c, D, w, l, F, d, y, G, f, u, R, M, N, S, Y, U, k, m, J, q, _, Z, x, X, v, gA, UA, yA, rA, BA, Ig, QA, V, YA, kA, W, pA, LA, ag, OA, KA, TA;
5103
5103
  const sA = A.uniforms, L = (B = (I = A.svgaFrameTableSlotState) != null ? I : A.svgaSlotState) != null ? B : sA.u_svgaSlotState instanceof Float32Array ? sA.u_svgaSlotState : sA.u_slotState instanceof Float32Array ? sA.u_slotState : null, EA = sA.u_transform, Bg = sA.u_clipRect, AA = A.svgaFrameTableParentAffine, DA = A.svgaFrameTableParentTranslate, IA = A.svgaFrameTableClipRect, pg = A.svgaFrameIndex != null || A.svgaFrameTableFrameIndex != null || A.frameTableFrameIndex != null, Kg = A.svgaFrameTableOpacity != null || typeof sA.u_opacity == "number";
5104
- let Cg = 1, GA = 0, fA = 0, dA = 1, iA = 0, eA = 0, tA = (Q = A.svgaFrameTableOpacity) != null ? Q : typeof sA.u_opacity == "number" ? sA.u_opacity : 1, hA = (e = (i = (E = A.svgaFrameIndex) != null ? E : A.svgaFrameTableFrameIndex) != null ? i : A.frameTableFrameIndex) != null ? e : 0, aA = 0, nA = 0, RA = this.canvas.width, uA = this.canvas.height, TA = 0, Qg = (n = (s = (o = (a = (t = A.svgaFrameTableMetadataBase) != null ? t : A.svgaFrameTableSpriteBase) != null ? a : A.frameTableSpriteBase) != null ? o : A.svgaSpriteMetadataBase) != null ? s : A.svgaSpriteBase) != null ? n : 0, Wg = (r = A.svgaFrameTableAtlasPage) != null ? r : -1;
5104
+ let Cg = 1, GA = 0, fA = 0, dA = 1, iA = 0, eA = 0, tA = (Q = A.svgaFrameTableOpacity) != null ? Q : typeof sA.u_opacity == "number" ? sA.u_opacity : 1, hA = (e = (i = (E = A.svgaFrameIndex) != null ? E : A.svgaFrameTableFrameIndex) != null ? i : A.frameTableFrameIndex) != null ? e : 0, aA = 0, nA = 0, RA = this.canvas.width, uA = this.canvas.height, vA = 0, Qg = (n = (s = (o = (a = (t = A.svgaFrameTableMetadataBase) != null ? t : A.svgaFrameTableSpriteBase) != null ? a : A.frameTableSpriteBase) != null ? o : A.svgaSpriteMetadataBase) != null ? s : A.svgaSpriteBase) != null ? n : 0, Wg = (r = A.svgaFrameTableAtlasPage) != null ? r : -1;
5105
5105
  if (AA && AA.length >= 4)
5106
- Cg = (h = AA[0]) != null ? h : Cg, GA = (c = AA[1]) != null ? c : GA, fA = (D = AA[2]) != null ? D : fA, dA = (w = AA[3]) != null ? w : dA, DA && DA.length >= 2 && (iA = (l = DA[0]) != null ? l : iA, eA = (F = DA[1]) != null ? F : eA), IA && IA.length >= 4 && (aA = (d = IA[0]) != null ? d : aA, nA = (y = IA[1]) != null ? y : nA, RA = (G = IA[2]) != null ? G : RA, uA = (f = IA[3]) != null ? f : uA, TA = 1);
5106
+ Cg = (h = AA[0]) != null ? h : Cg, GA = (c = AA[1]) != null ? c : GA, fA = (D = AA[2]) != null ? D : fA, dA = (w = AA[3]) != null ? w : dA, DA && DA.length >= 2 && (iA = (l = DA[0]) != null ? l : iA, eA = (F = DA[1]) != null ? F : eA), IA && IA.length >= 4 && (aA = (d = IA[0]) != null ? d : aA, nA = (y = IA[1]) != null ? y : nA, RA = (G = IA[2]) != null ? G : RA, uA = (f = IA[3]) != null ? f : uA, vA = 1);
5107
5107
  else if (L && L.length >= 13)
5108
- Cg = (u = L[0]) != null ? u : Cg, GA = (R = L[1]) != null ? R : GA, fA = (M = L[2]) != null ? M : fA, dA = (N = L[3]) != null ? N : dA, iA = (S = L[4]) != null ? S : iA, eA = (Y = L[5]) != null ? Y : eA, Kg || (tA = (U = L[6]) != null ? U : tA), pg || (hA = (k = L[7]) != null ? k : hA), aA = (m = L[8]) != null ? m : aA, nA = (J = L[9]) != null ? J : nA, RA = (q = L[10]) != null ? q : RA, uA = (_ = L[11]) != null ? _ : uA, TA = ((Z = L[12]) != null ? Z : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && L.length >= 14 && (Qg = (x = L[13]) != null ? x : Qg);
5108
+ Cg = (u = L[0]) != null ? u : Cg, GA = (R = L[1]) != null ? R : GA, fA = (M = L[2]) != null ? M : fA, dA = (N = L[3]) != null ? N : dA, iA = (S = L[4]) != null ? S : iA, eA = (Y = L[5]) != null ? Y : eA, Kg || (tA = (U = L[6]) != null ? U : tA), pg || (hA = (k = L[7]) != null ? k : hA), aA = (m = L[8]) != null ? m : aA, nA = (J = L[9]) != null ? J : nA, RA = (q = L[10]) != null ? q : RA, uA = (_ = L[11]) != null ? _ : uA, vA = ((Z = L[12]) != null ? Z : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && L.length >= 14 && (Qg = (x = L[13]) != null ? x : Qg);
5109
5109
  else if (EA instanceof Float32Array && EA.length >= 16) {
5110
5110
  Cg = (X = EA[0]) != null ? X : Cg, GA = (v = EA[1]) != null ? v : GA, fA = (gA = EA[4]) != null ? gA : fA, dA = (UA = EA[5]) != null ? UA : dA, iA = (yA = EA[12]) != null ? yA : iA, eA = (rA = EA[13]) != null ? rA : eA;
5111
5111
  const PA = Bg instanceof Float32Array && Bg.length >= 4 ? Bg : IA;
5112
- PA && PA.length >= 4 && (aA = (BA = PA[0]) != null ? BA : aA, nA = (Ig = PA[1]) != null ? Ig : nA, RA = (QA = PA[2]) != null ? QA : RA, uA = (V = PA[3]) != null ? V : uA, TA = typeof sA.u_clipEnabled == "number" ? sA.u_clipEnabled > 0.5 ? 1 : 0 : 1);
5112
+ PA && PA.length >= 4 && (aA = (BA = PA[0]) != null ? BA : aA, nA = (Ig = PA[1]) != null ? Ig : nA, RA = (QA = PA[2]) != null ? QA : RA, uA = (V = PA[3]) != null ? V : uA, vA = typeof sA.u_clipEnabled == "number" ? sA.u_clipEnabled > 0.5 ? 1 : 0 : 1);
5113
5113
  }
5114
- return AA && L && L.length >= 13 && (DA || (iA = (YA = L[4]) != null ? YA : iA, eA = (kA = L[5]) != null ? kA : eA), Kg || (tA = (W = L[6]) != null ? W : tA), pg || (hA = (pA = L[7]) != null ? pA : hA), IA || (aA = (LA = L[8]) != null ? LA : aA, nA = (ag = L[9]) != null ? ag : nA, RA = (OA = L[10]) != null ? OA : RA, uA = (KA = L[11]) != null ? KA : uA, TA = ((qA = L[12]) != null ? qA : 0) > 0.5 ? 1 : 0)), Number.isFinite(tA) || (tA = 1), Number.isFinite(hA) || (hA = 0), Number.isFinite(Qg) || (Qg = 0), Number.isFinite(Wg) || (Wg = -1), hA = Math.max(0, Math.min(Math.max(1, g) - 1, Math.floor(hA))), Qg = Math.max(0, Math.floor(Qg)), [Cg, GA, fA, dA, iA, eA, tA, aA, nA, RA, uA].every(Number.isFinite) ? {
5114
+ return AA && L && L.length >= 13 && (DA || (iA = (YA = L[4]) != null ? YA : iA, eA = (kA = L[5]) != null ? kA : eA), Kg || (tA = (W = L[6]) != null ? W : tA), pg || (hA = (pA = L[7]) != null ? pA : hA), IA || (aA = (LA = L[8]) != null ? LA : aA, nA = (ag = L[9]) != null ? ag : nA, RA = (OA = L[10]) != null ? OA : RA, uA = (KA = L[11]) != null ? KA : uA, vA = ((TA = L[12]) != null ? TA : 0) > 0.5 ? 1 : 0)), Number.isFinite(tA) || (tA = 1), Number.isFinite(hA) || (hA = 0), Number.isFinite(Qg) || (Qg = 0), Number.isFinite(Wg) || (Wg = -1), hA = Math.max(0, Math.min(Math.max(1, g) - 1, Math.floor(hA))), Qg = Math.max(0, Math.floor(Qg)), [Cg, GA, fA, dA, iA, eA, tA, aA, nA, RA, uA].every(Number.isFinite) ? {
5115
5115
  parentA: Cg,
5116
5116
  parentB: GA,
5117
5117
  parentC: fA,
@@ -5124,7 +5124,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5124
5124
  clipY0: nA,
5125
5125
  clipX1: RA,
5126
5126
  clipY1: uA,
5127
- clipEnabled: TA,
5127
+ clipEnabled: vA,
5128
5128
  metadataBase: Qg,
5129
5129
  atlasPage: Math.max(-1, Math.floor(Wg))
5130
5130
  } : null;
@@ -5213,12 +5213,12 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5213
5213
  this.applyProjectionUniform(W, kA, A.uniforms.u_projection);
5214
5214
  const KA = this.svgaTableInfoScratch;
5215
5215
  KA[0] = q, KA[1] = _, KA[2] = 3, KA[3] = 0;
5216
- const qA = this.svgaTableSizeScratch;
5217
- qA[0] = Y.width, qA[1] = Y.height;
5216
+ const TA = this.svgaTableSizeScratch;
5217
+ TA[0] = Y.width, TA[1] = Y.height;
5218
5218
  const sA = this.svgaMetadataSizeScratch;
5219
5219
  sA[0] = k.width, sA[1] = k.height;
5220
5220
  const L = R;
5221
- if (W.tableInfoLoc && ((F = L.uniform4iv) == null || F.call(L, W.tableInfoLoc, KA)), W.frameTableSizeLoc && ((d = L.uniform2iv) == null || d.call(L, W.frameTableSizeLoc, qA)), W.spriteMetadataSizeLoc && ((y = L.uniform2iv) == null || y.call(L, W.spriteMetadataSizeLoc, sA)), W.spriteMetadataStrideLoc && R.uniform1i(W.spriteMetadataStrideLoc, QA), W.spriteBaseLoc && R.uniform1i(W.spriteBaseLoc, V.metadataBase), W.frameIndexLoc && R.uniform1i(W.frameIndexLoc, V.frameIndex), W.parentAffineLoc && R.uniform4f(W.parentAffineLoc, V.parentA, V.parentB, V.parentC, V.parentD), W.parentTranslateLoc && R.uniform2f(W.parentTranslateLoc, V.tx, V.ty), W.slotOpacityLoc && R.uniform1f(W.slotOpacityLoc, V.opacity), W.atlasPageLoc && R.uniform1i(W.atlasPageLoc, V.atlasPage), W.clipRectLoc && R.uniform4f(W.clipRectLoc, V.clipX0, V.clipY0, V.clipX1, V.clipY1), W.clipEnabledLoc && R.uniform1f(W.clipEnabledLoc, V.clipEnabled), W.canvasHeightLoc && R.uniform1f(W.canvasHeightLoc, this.canvas.height), W.instanceStateEnabledLoc && R.uniform1f(W.instanceStateEnabledLoc, yA ? 1 : 0), W.compactSlotStateEnabledLoc && R.uniform1f(W.compactSlotStateEnabledLoc, UA ? 1 : 0), W.spritesPerSlotLoc && R.uniform1i(W.spritesPerSlotLoc, UA ? gA : 1), W.slotStateSizeLoc) {
5221
+ if (W.tableInfoLoc && ((F = L.uniform4iv) == null || F.call(L, W.tableInfoLoc, KA)), W.frameTableSizeLoc && ((d = L.uniform2iv) == null || d.call(L, W.frameTableSizeLoc, TA)), W.spriteMetadataSizeLoc && ((y = L.uniform2iv) == null || y.call(L, W.spriteMetadataSizeLoc, sA)), W.spriteMetadataStrideLoc && R.uniform1i(W.spriteMetadataStrideLoc, QA), W.spriteBaseLoc && R.uniform1i(W.spriteBaseLoc, V.metadataBase), W.frameIndexLoc && R.uniform1i(W.frameIndexLoc, V.frameIndex), W.parentAffineLoc && R.uniform4f(W.parentAffineLoc, V.parentA, V.parentB, V.parentC, V.parentD), W.parentTranslateLoc && R.uniform2f(W.parentTranslateLoc, V.tx, V.ty), W.slotOpacityLoc && R.uniform1f(W.slotOpacityLoc, V.opacity), W.atlasPageLoc && R.uniform1i(W.atlasPageLoc, V.atlasPage), W.clipRectLoc && R.uniform4f(W.clipRectLoc, V.clipX0, V.clipY0, V.clipX1, V.clipY1), W.clipEnabledLoc && R.uniform1f(W.clipEnabledLoc, V.clipEnabled), W.canvasHeightLoc && R.uniform1f(W.canvasHeightLoc, this.canvas.height), W.instanceStateEnabledLoc && R.uniform1f(W.instanceStateEnabledLoc, yA ? 1 : 0), W.compactSlotStateEnabledLoc && R.uniform1f(W.compactSlotStateEnabledLoc, UA ? 1 : 0), W.spritesPerSlotLoc && R.uniform1i(W.spritesPerSlotLoc, UA ? gA : 1), W.slotStateSizeLoc) {
5222
5222
  const AA = new Int32Array([
5223
5223
  (G = OA == null ? void 0 : OA.width) != null ? G : 1,
5224
5224
  (f = OA == null ? void 0 : OA.height) != null ? f : 1
@@ -5340,8 +5340,8 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5340
5340
  drawInstancedSvgaGL(A) {
5341
5341
  var g, I;
5342
5342
  const B = this.gl, Q = (g = A.instanceCount) != null ? g : 0, E = A.instanceData;
5343
- if (Q < 1 || !E || E.length < Q * xA.INST_SVGA_GL_FLOATS) return;
5344
- if (Q > xA.INST_SVGA_GL_MAX) {
5343
+ if (Q < 1 || !E || E.length < Q * bA.INST_SVGA_GL_FLOATS) return;
5344
+ if (Q > bA.INST_SVGA_GL_MAX) {
5345
5345
  console.warn("[WebGL2] svga-instanced-premul: instanceCount exceeds max", Q);
5346
5346
  return;
5347
5347
  }
@@ -5360,8 +5360,8 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5360
5360
  const a = this.buffers.get(A.vertexBuffer.id), o = this.buffers.get(A.indexBuffer.id);
5361
5361
  if (!a || !o) return;
5362
5362
  const s = this.ensureInstancedSvgaInstanceBuffer();
5363
- if (B.bindBuffer(B.ARRAY_BUFFER, s), B.bufferSubData(B.ARRAY_BUFFER, 0, E, 0, Q * xA.INST_SVGA_GL_FLOATS), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += Q * xA.INST_SVGA_GL_FLOATS * Float32Array.BYTES_PER_ELEMENT, this.bindCachedVertexArray(e, A.vertexBuffer.id, A.indexBuffer.id)) {
5364
- const n = xA.INST_SVGA_GL_STRIDE;
5363
+ if (B.bindBuffer(B.ARRAY_BUFFER, s), B.bufferSubData(B.ARRAY_BUFFER, 0, E, 0, Q * bA.INST_SVGA_GL_FLOATS), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += Q * bA.INST_SVGA_GL_FLOATS * Float32Array.BYTES_PER_ELEMENT, this.bindCachedVertexArray(e, A.vertexBuffer.id, A.indexBuffer.id)) {
5364
+ const n = bA.INST_SVGA_GL_STRIDE;
5365
5365
  B.bindBuffer(B.ARRAY_BUFFER, s), B.enableVertexAttribArray(1), B.vertexAttribPointer(1, 4, B.FLOAT, !1, n, 0), B.vertexAttribDivisor(1, 1), B.enableVertexAttribArray(2), B.vertexAttribPointer(2, 3, B.FLOAT, !1, n, 16), B.vertexAttribDivisor(2, 1), B.enableVertexAttribArray(3), B.vertexAttribPointer(3, 4, B.FLOAT, !1, n, 28), B.vertexAttribDivisor(3, 1), B.enableVertexAttribArray(4), B.vertexAttribIPointer(4, 2, B.UNSIGNED_INT, n, 44), B.vertexAttribDivisor(4, 1), B.bindBuffer(B.ARRAY_BUFFER, a.buffer), B.enableVertexAttribArray(0), B.vertexAttribPointer(0, 2, B.FLOAT, !1, 8, 0), B.vertexAttribDivisor(0, 0), B.bindBuffer(B.ELEMENT_ARRAY_BUFFER, o.buffer);
5366
5366
  }
5367
5367
  B.drawElementsInstanced(B.TRIANGLES, A.indexCount, B.UNSIGNED_INT, 0, Q), this.recordSubmittedDraw(), i !== "none" && (B.disable(B.STENCIL_TEST), B.colorMask(!0, !0, !0, !0));
@@ -5373,7 +5373,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5373
5373
  if (!g) throw new Error("createBuffer failed");
5374
5374
  A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, g), A.bufferData(
5375
5375
  A.ARRAY_BUFFER,
5376
- xA.INST_CLIP_MASK_GL_BYTES,
5376
+ bA.INST_CLIP_MASK_GL_BYTES,
5377
5377
  A.DYNAMIC_DRAW
5378
5378
  ), this.instancedClipMaskGLBuffer = g;
5379
5379
  }
@@ -5382,9 +5382,9 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5382
5382
  drawInstancedClipMaskGL(A) {
5383
5383
  var g, I;
5384
5384
  const B = this.gl, Q = (g = A.instanceCount) != null ? g : 0, E = A.instanceData;
5385
- if (Q < 1 || !E || E.length < Q * xA.INST_CLIP_MASK_GL_FLOATS)
5385
+ if (Q < 1 || !E || E.length < Q * bA.INST_CLIP_MASK_GL_FLOATS)
5386
5386
  return;
5387
- if (Q > xA.INST_CLIP_MASK_GL_MAX) {
5387
+ if (Q > bA.INST_CLIP_MASK_GL_MAX) {
5388
5388
  console.warn(
5389
5389
  "[WebGL2] clip-mask-instanced: instanceCount exceeds max",
5390
5390
  Q
@@ -5403,9 +5403,9 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5403
5403
  0,
5404
5404
  E,
5405
5405
  0,
5406
- Q * xA.INST_CLIP_MASK_GL_FLOATS
5406
+ Q * bA.INST_CLIP_MASK_GL_FLOATS
5407
5407
  ), this.bindCachedVertexArray(i, A.vertexBuffer.id, A.indexBuffer.id)) {
5408
- const n = xA.INST_CLIP_MASK_GL_STRIDE;
5408
+ const n = bA.INST_CLIP_MASK_GL_STRIDE;
5409
5409
  B.bindBuffer(B.ARRAY_BUFFER, s), B.enableVertexAttribArray(1), B.vertexAttribPointer(1, 4, B.FLOAT, !1, n, 0), B.vertexAttribDivisor(1, 1), B.enableVertexAttribArray(2), B.vertexAttribPointer(2, 2, B.FLOAT, !1, n, 16), B.vertexAttribDivisor(2, 1), B.bindBuffer(B.ARRAY_BUFFER, t.buffer), B.enableVertexAttribArray(0), B.vertexAttribPointer(0, 2, B.FLOAT, !1, 8, 0), B.vertexAttribDivisor(0, 0), B.bindBuffer(B.ELEMENT_ARRAY_BUFFER, a.buffer);
5410
5410
  }
5411
5411
  B.drawElementsInstanced(
@@ -5421,7 +5421,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5421
5421
  if (!this.instancedAlphaInstanceGLBuffer) {
5422
5422
  const g = A.createBuffer();
5423
5423
  if (!g) throw new Error("createBuffer failed");
5424
- A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, g), A.bufferData(A.ARRAY_BUFFER, xA.INST_ALPHA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedAlphaInstanceGLBuffer = g;
5424
+ A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, g), A.bufferData(A.ARRAY_BUFFER, bA.INST_ALPHA_GL_BYTES, A.DYNAMIC_DRAW), this.instancedAlphaInstanceGLBuffer = g;
5425
5425
  }
5426
5426
  return this.instancedAlphaInstanceGLBuffer;
5427
5427
  }
@@ -5429,7 +5429,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5429
5429
  var g;
5430
5430
  const I = this.gl, B = (g = A.instanceCount) != null ? g : 0, Q = A.instanceData;
5431
5431
  if (B < 1 || !Q || Q.length < B * 12) return;
5432
- if (B > xA.INST_ALPHA_GL_MAX) {
5432
+ if (B > bA.INST_ALPHA_GL_MAX) {
5433
5433
  console.warn("[WebGL2] alpha-video-instanced: instanceCount exceeds max", B);
5434
5434
  return;
5435
5435
  }
@@ -5464,7 +5464,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5464
5464
  if (!this.instancedVapInstanceGLBuffer) {
5465
5465
  const g = A.createBuffer();
5466
5466
  if (!g) throw new Error("createBuffer failed");
5467
- A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, g), A.bufferData(A.ARRAY_BUFFER, xA.INST_VAP_GL_BYTES, A.DYNAMIC_DRAW), this.instancedVapInstanceGLBuffer = g;
5467
+ A.bindVertexArray(null), A.bindBuffer(A.ARRAY_BUFFER, g), A.bufferData(A.ARRAY_BUFFER, bA.INST_VAP_GL_BYTES, A.DYNAMIC_DRAW), this.instancedVapInstanceGLBuffer = g;
5468
5468
  }
5469
5469
  return this.instancedVapInstanceGLBuffer;
5470
5470
  }
@@ -5472,7 +5472,7 @@ const vI = "svga-frame-table-instanced-premul", uC = 8, ri = new Float32Array([1
5472
5472
  var g;
5473
5473
  const I = this.gl, B = (g = A.instanceCount) != null ? g : 0, Q = A.instanceData;
5474
5474
  if (B < 1 || !Q || Q.length < B * 32) return;
5475
- if (B > xA.INST_VAP_GL_MAX) {
5475
+ if (B > bA.INST_VAP_GL_MAX) {
5476
5476
  console.warn("[WebGL2] vap-instanced: instanceCount exceeds max", B);
5477
5477
  return;
5478
5478
  }
@@ -6120,32 +6120,32 @@ function fB(C, A, g) {
6120
6120
  return E;
6121
6121
  }
6122
6122
  function Ni(C, A, g) {
6123
- const I = UC(C, z.__wbindgen_malloc), B = bA;
6124
- var Q = UC(A, z.__wbindgen_malloc), E = bA, i = JQ(g, z.__wbindgen_malloc), e = bA;
6123
+ const I = UC(C, z.__wbindgen_malloc), B = qA;
6124
+ var Q = UC(A, z.__wbindgen_malloc), E = qA, i = JQ(g, z.__wbindgen_malloc), e = qA;
6125
6125
  return z.build_batch_vertices(I, B, Q, E, A, i, e, g) >>> 0;
6126
6126
  }
6127
6127
  function Ui(C) {
6128
- const A = yB(C, z.__wbindgen_malloc), g = bA, I = z.decode_svga(A, g);
6128
+ const A = yB(C, z.__wbindgen_malloc), g = qA, I = z.decode_svga(A, g);
6129
6129
  if (I[2])
6130
6130
  throw KI(I[1]);
6131
6131
  return KI(I[0]);
6132
6132
  }
6133
6133
  function ki(C) {
6134
- const A = yB(C, z.__wbindgen_malloc), g = bA, I = z.decode_svga_payload(A, g);
6134
+ const A = yB(C, z.__wbindgen_malloc), g = qA, I = z.decode_svga_payload(A, g);
6135
6135
  if (I[3])
6136
6136
  throw KI(I[2]);
6137
6137
  var B = FB(I[0], I[1]).slice();
6138
6138
  return z.__wbindgen_free(I[0], I[1] * 1, 1), B;
6139
6139
  }
6140
6140
  function Yi(C) {
6141
- const A = yB(C, z.__wbindgen_malloc), g = bA, I = z.decode_svga_payload_profiled(A, g);
6141
+ const A = yB(C, z.__wbindgen_malloc), g = qA, I = z.decode_svga_payload_profiled(A, g);
6142
6142
  if (I[3])
6143
6143
  throw KI(I[2]);
6144
6144
  var B = FB(I[0], I[1]).slice();
6145
6145
  return z.__wbindgen_free(I[0], I[1] * 1, 1), B;
6146
6146
  }
6147
6147
  function pi(C) {
6148
- const A = yB(C, z.__wbindgen_malloc), g = bA, I = z.inflate(A, g);
6148
+ const A = yB(C, z.__wbindgen_malloc), g = qA, I = z.inflate(A, g);
6149
6149
  if (I[3])
6150
6150
  throw KI(I[2]);
6151
6151
  var B = FB(I[0], I[1]).slice();
@@ -6158,7 +6158,7 @@ function Ki() {
6158
6158
  return z.take_svga_payload_profile();
6159
6159
  }
6160
6160
  function mi(C, A) {
6161
- const g = xi(C, z.__wbindgen_malloc), I = bA, B = JQ(A, z.__wbindgen_malloc), Q = bA, E = z.triangulate_clip_polygons(g, I, B, Q);
6161
+ const g = xi(C, z.__wbindgen_malloc), I = qA, B = JQ(A, z.__wbindgen_malloc), Q = qA, E = z.triangulate_clip_polygons(g, I, B, Q);
6162
6162
  var i = Ji(E[0], E[1]).slice();
6163
6163
  return z.__wbindgen_free(E[0], E[1] * 4, 4), i;
6164
6164
  }
@@ -6171,7 +6171,7 @@ function KQ() {
6171
6171
  return Error(MB(A, g));
6172
6172
  },
6173
6173
  __wbg_String_8564e559799eccda: function(A, g) {
6174
- const I = String(g), B = bi(I, z.__wbindgen_malloc, z.__wbindgen_realloc), Q = bA;
6174
+ const I = String(g), B = bi(I, z.__wbindgen_malloc, z.__wbindgen_realloc), Q = qA;
6175
6175
  NC().setInt32(A + 4, Q, !0), NC().setInt32(A + 0, B, !0);
6176
6176
  },
6177
6177
  __wbg___wbindgen_copy_to_typed_array_a4db337751e0b328: function(A, g, I) {
@@ -6251,24 +6251,24 @@ function iI() {
6251
6251
  }
6252
6252
  function JQ(C, A) {
6253
6253
  const g = A(C.length * 4, 4) >>> 0;
6254
- return mQ().set(C, g / 4), bA = C.length, g;
6254
+ return mQ().set(C, g / 4), qA = C.length, g;
6255
6255
  }
6256
6256
  function yB(C, A) {
6257
6257
  const g = A(C.length * 1, 1) >>> 0;
6258
- return iI().set(C, g / 1), bA = C.length, g;
6258
+ return iI().set(C, g / 1), qA = C.length, g;
6259
6259
  }
6260
6260
  function UC(C, A) {
6261
6261
  const g = A(C.length * 4, 4) >>> 0;
6262
- return Li().set(C, g / 4), bA = C.length, g;
6262
+ return Li().set(C, g / 4), qA = C.length, g;
6263
6263
  }
6264
6264
  function xi(C, A) {
6265
6265
  const g = A(C.length * 8, 8) >>> 0;
6266
- return Hi().set(C, g / 8), bA = C.length, g;
6266
+ return Hi().set(C, g / 8), qA = C.length, g;
6267
6267
  }
6268
6268
  function bi(C, A, g) {
6269
6269
  if (g === void 0) {
6270
6270
  const i = dI.encode(C), e = A(i.length, 1) >>> 0;
6271
- return iI().subarray(e, e + i.length).set(i), bA = i.length, e;
6271
+ return iI().subarray(e, e + i.length).set(i), qA = i.length, e;
6272
6272
  }
6273
6273
  let I = C.length, B = A(I, 1) >>> 0;
6274
6274
  const Q = iI();
@@ -6283,7 +6283,7 @@ function bi(C, A, g) {
6283
6283
  const i = iI().subarray(B + E, B + I), e = dI.encodeInto(C, i);
6284
6284
  E += e.written, B = g(B, I, E, 1) >>> 0;
6285
6285
  }
6286
- return bA = E, B;
6286
+ return qA = E, B;
6287
6287
  }
6288
6288
  function KI(C) {
6289
6289
  const A = z.__wbindgen_externrefs.get(C);
@@ -6304,7 +6304,7 @@ const dI = new TextEncoder();
6304
6304
  written: g.length
6305
6305
  };
6306
6306
  });
6307
- let bA = 0, z;
6307
+ let qA = 0, z;
6308
6308
  function LQ(C, A) {
6309
6309
  return z = C.exports, Zg = null, DI = null, lI = null, wI = null, FI = null, z.__wbindgen_start(), z;
6310
6310
  }
@@ -11112,10 +11112,10 @@ function hI(C, A, g, I = { left: 0, right: 0, top: 0, bottom: 0 }) {
11112
11112
  const [B, Q, E, i] = C;
11113
11113
  return I.left = B / A, I.right = (B + E) / A, I.top = (g - Q) / g, I.bottom = (g - Q - i) / g, I;
11114
11114
  }
11115
- var lt = Object.defineProperty, wt = (C, A, g) => A in C ? lt(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, WA = (C, A, g) => wt(C, typeof A != "symbol" ? A + "" : A, g);
11115
+ var lt = Object.defineProperty, wt = (C, A, g) => A in C ? lt(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, VA = (C, A, g) => wt(C, typeof A != "symbol" ? A + "" : A, g);
11116
11116
  class jQ {
11117
11117
  constructor(A) {
11118
- WA(this, "onFrameAvailable"), WA(this, "frameInfo", /* @__PURE__ */ new Map()), WA(this, "pending", /* @__PURE__ */ new Set()), WA(this, "lastHandle", /* @__PURE__ */ new Map()), WA(this, "started", /* @__PURE__ */ new Set()), WA(this, "firstUploaded", /* @__PURE__ */ new Set()), WA(this, "forceTimeFallback", /* @__PURE__ */ new Set()), WA(this, "lastArmAt", /* @__PURE__ */ new Map()), WA(this, "lastCallbackAt", /* @__PURE__ */ new Map()), WA(this, "lastProgressAt", /* @__PURE__ */ new Map()), WA(this, "lastRecoveryAt", /* @__PURE__ */ new Map()), WA(this, "stallLogged", /* @__PURE__ */ new Set()), WA(this, "stagnationLogged", /* @__PURE__ */ new Set()), WA(this, "lastTimeFallback", /* @__PURE__ */ new Map()), WA(this, "healthTimers", /* @__PURE__ */ new Map()), this.onFrameAvailable = A;
11118
+ VA(this, "onFrameAvailable"), VA(this, "frameInfo", /* @__PURE__ */ new Map()), VA(this, "pending", /* @__PURE__ */ new Set()), VA(this, "lastHandle", /* @__PURE__ */ new Map()), VA(this, "started", /* @__PURE__ */ new Set()), VA(this, "firstUploaded", /* @__PURE__ */ new Set()), VA(this, "forceTimeFallback", /* @__PURE__ */ new Set()), VA(this, "lastArmAt", /* @__PURE__ */ new Map()), VA(this, "lastCallbackAt", /* @__PURE__ */ new Map()), VA(this, "lastProgressAt", /* @__PURE__ */ new Map()), VA(this, "lastRecoveryAt", /* @__PURE__ */ new Map()), VA(this, "stallLogged", /* @__PURE__ */ new Set()), VA(this, "stagnationLogged", /* @__PURE__ */ new Set()), VA(this, "lastTimeFallback", /* @__PURE__ */ new Map()), VA(this, "healthTimers", /* @__PURE__ */ new Map()), this.onFrameAvailable = A;
11119
11119
  }
11120
11120
  /**
11121
11121
  * Returns true when `updateTexture` should run for this slot: first time, or a new decoded frame was signaled.
@@ -18967,10 +18967,10 @@ class _B {
18967
18967
  this._released || (this._released = !0, this.gpuGlobalsBuffer && ((A = this.backend) == null || A.deleteBuffer(this.gpuGlobalsBuffer)), this.table.release());
18968
18968
  }
18969
18969
  }
18970
- var ls = Object.defineProperty, ws = (C, A, g) => A in C ? ls(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, VA = (C, A, g) => ws(C, typeof A != "symbol" ? A + "" : A, g);
18970
+ var ls = Object.defineProperty, ws = (C, A, g) => A in C ? ls(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, xA = (C, A, g) => ws(C, typeof A != "symbol" ? A + "" : A, g);
18971
18971
  class Fs {
18972
18972
  constructor(A, g = `scope-${xQ()}`) {
18973
- VA(this, "id"), VA(this, "host"), VA(this, "controller", new AbortController()), VA(this, "gifts", /* @__PURE__ */ new Map()), VA(this, "tracks", /* @__PURE__ */ new Set()), VA(this, "bindings", /* @__PURE__ */ new Set()), VA(this, "particleBatches", /* @__PURE__ */ new Set()), VA(this, "particleBatchGroups", /* @__PURE__ */ new Set()), VA(this, "frameListeners", /* @__PURE__ */ new Set()), VA(this, "finishListeners", /* @__PURE__ */ new Set()), VA(this, "unregisterController"), VA(this, "_state", "idle"), VA(this, "_currentTimeMs", 0), VA(this, "durationMs", 0), VA(this, "lastTickAtMs", 0), this.host = A, this.id = g, this.unregisterController = A.registerFrameController(this);
18973
+ xA(this, "id"), xA(this, "host"), xA(this, "controller", new AbortController()), xA(this, "gifts", /* @__PURE__ */ new Map()), xA(this, "tracks", /* @__PURE__ */ new Set()), xA(this, "bindings", /* @__PURE__ */ new Set()), xA(this, "particleBatches", /* @__PURE__ */ new Set()), xA(this, "particleBatchGroups", /* @__PURE__ */ new Set()), xA(this, "frameListeners", /* @__PURE__ */ new Set()), xA(this, "finishListeners", /* @__PURE__ */ new Set()), xA(this, "unregisterController"), xA(this, "_state", "idle"), xA(this, "_currentTimeMs", 0), xA(this, "durationMs", 0), xA(this, "lastTickAtMs", 0), xA(this, "playbackRevision", 0), this.host = A, this.id = g, this.unregisterController = A.registerFrameController(this);
18974
18974
  }
18975
18975
  get signal() {
18976
18976
  return this.controller.signal;
@@ -18999,7 +18999,11 @@ class Fs {
18999
18999
  createMotionTrack(A) {
19000
19000
  this.assertAlive();
19001
19001
  const g = new _B(this.host.backend, A);
19002
- return this.tracks.add(g), g;
19002
+ this.tracks.add(g);
19003
+ const I = g.release.bind(g);
19004
+ return g.release = () => {
19005
+ I(), this.tracks.delete(g);
19006
+ }, g;
19003
19007
  }
19004
19008
  createParticleBatch(A) {
19005
19009
  this.assertAlive();
@@ -19053,47 +19057,48 @@ class Fs {
19053
19057
  }
19054
19058
  start(A) {
19055
19059
  var g;
19056
- this.assertAlive(), this.durationMs = Math.max(0, A.durationMs), this._currentTimeMs = Math.max(0, Math.min(this.durationMs, (g = A.fromMs) != null ? g : 0)), this.lastTickAtMs = performance.now(), this._state = "playing";
19060
+ this.assertAlive(), this.playbackRevision++, this.durationMs = Math.max(0, A.durationMs), this._currentTimeMs = Math.max(0, Math.min(this.durationMs, (g = A.fromMs) != null ? g : 0)), this.lastTickAtMs = performance.now(), this._state = "playing";
19057
19061
  for (const I of this.gifts.values()) I.resume();
19058
19062
  this.applyMediaTime(this._currentTimeMs, !0, !0), this.applyAll(this._currentTimeMs), this.applyParticleTime(this._currentTimeMs), this.host.invalidate(!0);
19059
19063
  }
19060
19064
  pause() {
19061
19065
  if (this._state === "playing") {
19062
- this._state = "paused";
19066
+ this.playbackRevision++, this._state = "paused";
19063
19067
  for (const A of this.gifts.values()) A.pause();
19064
19068
  }
19065
19069
  }
19066
19070
  resume() {
19067
19071
  if (this._state === "paused") {
19068
- this.lastTickAtMs = performance.now(), this._state = "playing";
19072
+ this.playbackRevision++, this.lastTickAtMs = performance.now(), this._state = "playing";
19069
19073
  for (const A of this.gifts.values()) A.resume();
19070
19074
  this.applyMediaTime(this._currentTimeMs, !1, !0), this.host.invalidate(!0);
19071
19075
  }
19072
19076
  }
19073
19077
  seek(A) {
19074
- this.assertAlive(), this._currentTimeMs = Math.max(0, Math.min(this.durationMs, A)), this._state === "playing" && (this.lastTickAtMs = performance.now()), this.applyAll(this._currentTimeMs), this.applyParticleTime(this._currentTimeMs), this.applyMediaTime(this._currentTimeMs, !1, !0), this.emitFrame(0), this.host.invalidate();
19078
+ this.assertAlive(), this.playbackRevision++, this._currentTimeMs = Math.max(0, Math.min(this.durationMs, A)), this._state === "playing" && (this.lastTickAtMs = performance.now()), this.applyAll(this._currentTimeMs), this.applyParticleTime(this._currentTimeMs), this.applyMediaTime(this._currentTimeMs, !1, !0), this.emitFrame(0), this.host.invalidate();
19075
19079
  }
19076
19080
  stop() {
19077
19081
  if (!(this._state === "destroyed" || this._state === "stopped")) {
19078
- this._state = "stopped";
19082
+ this.playbackRevision++, this._state = "stopped";
19079
19083
  for (const A of this.gifts.values()) A.pause();
19080
19084
  this.host.invalidate();
19081
19085
  }
19082
19086
  }
19083
19087
  tick(A, g) {
19084
19088
  if (this._state !== "playing") return !1;
19085
- const I = Math.max(0, g), B = this.lastTickAtMs > 0 ? Math.max(0, A - this.lastTickAtMs) : I, Q = Math.min(I, B);
19086
- if (this.lastTickAtMs = A, this._currentTimeMs = Math.min(this.durationMs, this._currentTimeMs + Q), this.applyAll(this._currentTimeMs), this.applyParticleTime(this._currentTimeMs), this.applyMediaTime(this._currentTimeMs), this.emitFrame(Q), this._currentTimeMs >= this.durationMs) {
19089
+ const I = this.playbackRevision, B = Math.max(0, g), Q = this.lastTickAtMs > 0 ? Math.max(0, A - this.lastTickAtMs) : B, E = Math.min(B, Q);
19090
+ if (this.lastTickAtMs = A, this._currentTimeMs = Math.min(this.durationMs, this._currentTimeMs + E), this.applyAll(this._currentTimeMs), this.applyParticleTime(this._currentTimeMs), this.applyMediaTime(this._currentTimeMs), I !== this.playbackRevision || (this.emitFrame(E), I !== this.playbackRevision)) return !0;
19091
+ if (this._currentTimeMs >= this.durationMs) {
19087
19092
  this._state = "stopped";
19088
- for (const E of this.gifts.values()) E.pause();
19089
- for (const E of this.finishListeners) E();
19093
+ for (const i of this.gifts.values()) i.pause();
19094
+ for (const i of this.finishListeners) i();
19090
19095
  }
19091
19096
  return !0;
19092
19097
  }
19093
19098
  destroy() {
19094
19099
  var A;
19095
19100
  if (this._state !== "destroyed") {
19096
- this._state = "destroyed", this.controller.abort(), (A = this.unregisterController) == null || A.call(this), this.unregisterController = null;
19101
+ this.playbackRevision++, this._state = "destroyed", this.controller.abort(), (A = this.unregisterController) == null || A.call(this), this.unregisterController = null;
19097
19102
  for (const g of this.bindings) this.bindings.delete(g);
19098
19103
  for (const g of this.gifts.values()) this.host.removeGift(g.id);
19099
19104
  this.gifts.clear();
@@ -21277,11 +21282,27 @@ const Fg = class zA {
21277
21282
  preload: (e, t, a) => this.preload(e, t, a),
21278
21283
  createParticleAtlas: async (e) => {
21279
21284
  const t = await this.createParticleAtlas(e);
21280
- return I.add(t), t;
21285
+ I.add(t);
21286
+ const a = t.destroy.bind(t);
21287
+ return t.destroy = () => {
21288
+ try {
21289
+ a();
21290
+ } finally {
21291
+ I.delete(t);
21292
+ }
21293
+ }, t;
21281
21294
  },
21282
21295
  createPlaybackScope: (e) => {
21283
21296
  const t = this.createPlaybackScope(e);
21284
- return g.add(t), t;
21297
+ g.add(t);
21298
+ const a = t.destroy.bind(t);
21299
+ return t.destroy = () => {
21300
+ try {
21301
+ a();
21302
+ } finally {
21303
+ g.delete(t);
21304
+ }
21305
+ }, t;
21285
21306
  }
21286
21307
  }, Q = await A.setup(B);
21287
21308
  let E = !1;
@@ -16,6 +16,7 @@ export declare class PlaybackScopeImpl implements PlaybackScope, PlaybackFrameCo
16
16
  private _currentTimeMs;
17
17
  private durationMs;
18
18
  private lastTickAtMs;
19
+ private playbackRevision;
19
20
  constructor(host: PlaybackScopeHost, id?: string);
20
21
  get signal(): AbortSignal;
21
22
  get state(): PlaybackScopeState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/giftstage",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "High-performance WebGPU/WebGL gift animation player unifying SVGA, VAP, AlphaVideo, and images",
5
5
  "type": "module",
6
6
  "main": "dist/gift-stage.cjs",