@taole/giftstage 0.3.5 → 0.3.6

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.
@@ -476,7 +476,7 @@ function mC(C, A) {
476
476
  const e = new Float32Array(g), i = te(e, new Uint32Array(Q));
477
477
  return i.length === 0 ? null : { vertices: e, indices: i };
478
478
  }
479
- var oe = Object.defineProperty, se = (C, A, g) => A in C ? oe(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, Xg = (C, A, g) => se(C, typeof A != "symbol" ? A + "" : A, g);
479
+ var oe = Object.defineProperty, se = (C, A, g) => A in C ? oe(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, QI = (C, A, g) => se(C, typeof A != "symbol" ? A + "" : A, g);
480
480
  function ne(C) {
481
481
  if (C.length !== 1 || C[0].length !== 4) return null;
482
482
  const A = C[0], g = A.map((n) => n.x), I = A.map((n) => n.y), B = Math.min(...g), Q = Math.min(...I), E = Math.max(...g), e = Math.max(...I);
@@ -509,18 +509,15 @@ function* _Q(C, A = !1) {
509
509
  }
510
510
  class $Q {
511
511
  constructor() {
512
- Xg(this, "paths", /* @__PURE__ */ new Map()), Xg(this, "tables", /* @__PURE__ */ new WeakMap()), Xg(this, "resourcePaths", /* @__PURE__ */ new WeakMap()), Xg(this, "pathUsers", /* @__PURE__ */ new Map()), Xg(this, "released", /* @__PURE__ */ new WeakSet()), Xg(this, "hits", 0), Xg(this, "trackHits", !1);
512
+ QI(this, "paths", /* @__PURE__ */ new Map()), QI(this, "tables", /* @__PURE__ */ new WeakMap()), QI(this, "resourcePaths", /* @__PURE__ */ new WeakMap()), QI(this, "pathUsers", /* @__PURE__ */ new Map()), QI(this, "hits", 0), QI(this, "trackHits", !1);
513
513
  }
514
514
  retain(A, g) {
515
515
  var I;
516
- if (this.released.has(A))
517
- throw new DOMException("SVGA clip resource released", "AbortError");
518
516
  let B = this.resourcePaths.get(A);
519
517
  B || (B = /* @__PURE__ */ new Set(), this.resourcePaths.set(A, B)), B.has(g) || (B.add(g), this.pathUsers.set(g, ((I = this.pathUsers.get(g)) != null ? I : 0) + 1));
520
518
  }
521
519
  release(A) {
522
520
  var g, I;
523
- this.released.add(A);
524
521
  const B = [];
525
522
  for (const Q of (g = this.resourcePaths.get(A)) != null ? g : []) {
526
523
  const E = ((I = this.pathUsers.get(Q)) != null ? I : 1) - 1;
@@ -596,7 +593,7 @@ function* AE(C, A = le) {
596
593
  if (((g = C.frameData[G * 9 + 8]) != null ? g : 0) < 0.05) continue;
597
594
  const S = (I = C.shapesIndex[G]) != null ? I : -1, M = S >= 0 && !!C.shapePresence[S], N = (B = C.clipPathIndex[G]) != null ? B : -1, U = N < 0 ? 0 : (Q = C.clipKinds[N]) != null ? Q : 0;
598
595
  if (U === 1) continue;
599
- const p = u * 7, k = C.atlas[p + 2], m = !!C.atlas[p + 1];
596
+ const K = u * 7, k = C.atlas[K + 2], m = !!C.atlas[K + 1];
600
597
  if (!M && !m) continue;
601
598
  const H = !M && m && !!U && !!C.clipRects[N * 5];
602
599
  U && !H && t.push(2, u, S, N, k), M && t.push(1, u, S, N, k), m && t.push(U && !H ? 3 : 0, u, S, N, k, H), U && !H && t.push(4, u, S, N, k);
@@ -610,20 +607,20 @@ function* AE(C, A = le) {
610
607
  let S = 2166136261;
611
608
  for (let U = u; U < G; U++) {
612
609
  yield;
613
- for (let p = 0; p < 6; p++) S = A(S, t.get(U, p));
610
+ for (let K = 0; K < 6; K++) S = A(S, t.get(U, K));
614
611
  if (t.get(U, 5))
615
- for (let p = 1; p < 5; p++)
616
- S = A(S, C.clipRects[t.get(U, 3) * 5 + p]);
612
+ for (let K = 1; K < 5; K++)
613
+ S = A(S, C.clipRects[t.get(U, 3) * 5 + K]);
617
614
  }
618
615
  let M = 0;
619
616
  const N = (E = s.get(S)) != null ? E : [];
620
617
  for (const U of N) {
621
- const p = a[U];
622
- if (a[U + 1] - p !== G - u) continue;
618
+ const K = a[U];
619
+ if (a[U + 1] - K !== G - u) continue;
623
620
  let k = !0;
624
621
  for (let m = u; m < G && k; m++) {
625
622
  yield;
626
- const H = p + m - u;
623
+ const H = K + m - u;
627
624
  for (let v = 0; v < 6; v++)
628
625
  if (t.get(m, v) !== t.get(H, v)) {
629
626
  k = !1;
@@ -700,15 +697,15 @@ function* De(C) {
700
697
  }
701
698
  return A;
702
699
  }
703
- function QA(C = "Operation aborted") {
700
+ function CA(C = "Operation aborted") {
704
701
  const A = new Error(C);
705
702
  return A.name = "AbortError", A;
706
703
  }
707
- function Kg(C) {
708
- return C instanceof Error ? C.name === "AbortError" ? !0 : "cause" in C && Kg(C.cause) : !1;
704
+ function Mg(C) {
705
+ return C instanceof Error ? C.name === "AbortError" ? !0 : "cause" in C && Mg(C.cause) : !1;
709
706
  }
710
- function L(C, A) {
711
- if (C != null && C.aborted) throw QA(A);
707
+ function J(C, A) {
708
+ if (C != null && C.aborted) throw CA(A);
712
709
  }
713
710
  var we = Object.defineProperty, ye = (C, A, g) => A in C ? we(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, BB = (C, A, g) => ye(C, typeof A != "symbol" ? A + "" : A, g);
714
711
  const gE = 1e3 / 60, Fe = 2, de = 12, Ge = 0.25;
@@ -806,20 +803,20 @@ class Ue {
806
803
  };
807
804
  }
808
805
  }
809
- async function Ig(C, A = {}, g = "command-build") {
806
+ async function tg(C, A = {}, g = "command-build") {
810
807
  var I, B;
811
808
  const Q = OA({ maxBudgetMs: A.frameBudgetMs }), E = A.profile ? performance.now() : 0;
812
809
  let e = A.profile ? performance.now() : 0, i = !0;
813
810
  try {
814
811
  for (; ; ) {
815
- if (L(A.signal), (I = A.checkActive) == null || I.call(A), Q.shouldYield()) {
812
+ if (J(A.signal), (I = A.checkActive) == null || I.call(A), Q.shouldYield()) {
816
813
  A.profile && A.profile.record(g, performance.now() - e), i = !1;
817
814
  const a = Q.yield();
818
815
  if (A.signal) {
819
816
  const o = A.signal;
820
817
  await new Promise((s, n) => {
821
818
  const r = () => {
822
- c(), n(QA("SVGA preparation canceled"));
819
+ c(), n(CA("SVGA preparation canceled"));
823
820
  }, c = () => o.removeEventListener("abort", r);
824
821
  if (o.aborted) {
825
822
  r();
@@ -894,7 +891,7 @@ function Dn(C) {
894
891
  return g.value;
895
892
  }
896
893
  function ke(C, A = {}) {
897
- return Ig(BE(C, A), A);
894
+ return tg(BE(C, A), A);
898
895
  }
899
896
  const CE = `var L = Object.defineProperty, q = (n, o, a) => o in n ? L(n, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[o] = a, T = (n, o, a) => q(n, typeof o != "symbol" ? o + "" : o, a);
900
897
  const F = 1024;
@@ -1148,13 +1145,13 @@ class me {
1148
1145
  return this.active >= this.maxConcurrent || this.waiters.length ? null : (this.active++, this.createRelease(A));
1149
1146
  }
1150
1147
  acquire(A, g = "foreground") {
1151
- if (A != null && A.aborted) return Promise.reject(QA("SVGA worker task aborted"));
1148
+ if (A != null && A.aborted) return Promise.reject(CA("SVGA worker task aborted"));
1152
1149
  const I = this.tryAcquire(g);
1153
1150
  return I ? Promise.resolve(I) : new Promise((B, Q) => {
1154
1151
  const E = { resolve: B, reject: Q, signal: A, priority: g };
1155
1152
  A && (E.onAbort = () => {
1156
1153
  const e = this.waiters.indexOf(E);
1157
- e >= 0 && this.waiters.splice(e, 1), Q(QA("SVGA worker task aborted"));
1154
+ e >= 0 && this.waiters.splice(e, 1), Q(CA("SVGA worker task aborted"));
1158
1155
  }, A.addEventListener("abort", E.onAbort, { once: !0 })), this.waiters.push(E);
1159
1156
  });
1160
1157
  }
@@ -1165,7 +1162,7 @@ class me {
1165
1162
  };
1166
1163
  }
1167
1164
  run(A, g, I = "foreground") {
1168
- if (g != null && g.aborted) return Promise.reject(QA("SVGA worker task aborted"));
1165
+ if (g != null && g.aborted) return Promise.reject(CA("SVGA worker task aborted"));
1169
1166
  const B = this.tryAcquire();
1170
1167
  return B ? this.execute(A, B) : this.acquire(g, I).then((Q) => this.execute(A, Q));
1171
1168
  }
@@ -1181,7 +1178,7 @@ class me {
1181
1178
  const g = this.waiters.findIndex((E) => E.priority === "foreground"), I = this.waiters.findIndex((E) => E.priority === "background"), B = I >= 0 && (g < 0 || this.foregroundStreak >= 8) ? I : g, Q = this.waiters.splice(B < 0 ? 0 : B, 1)[0];
1182
1179
  if (Q) {
1183
1180
  if (Q.signal && Q.onAbort && Q.signal.removeEventListener("abort", Q.onAbort), (A = Q.signal) != null && A.aborted) {
1184
- Q.reject(QA("SVGA worker task aborted"));
1181
+ Q.reject(CA("SVGA worker task aborted"));
1185
1182
  continue;
1186
1183
  }
1187
1184
  this.active++, Q.resolve(this.createRelease(Q.priority));
@@ -1199,51 +1196,51 @@ function GC(C, A, g = "foreground") {
1199
1196
  function QE(C, A = "foreground") {
1200
1197
  return FC.acquire(C, A);
1201
1198
  }
1202
- let zg, Je = 1;
1203
- const gI = /* @__PURE__ */ new Map();
1199
+ let jg, Je = 1;
1200
+ const AI = /* @__PURE__ */ new Map();
1204
1201
  function Le() {
1205
- if (zg) return zg;
1202
+ if (jg) return jg;
1206
1203
  const C = new Ye(), A = (g) => {
1207
- zg === C && (zg = void 0), C.terminate();
1208
- for (const [I, B] of gI)
1209
- B.owner === C && (gI.delete(I), B.reject(g));
1204
+ jg === C && (jg = void 0), C.terminate();
1205
+ for (const [I, B] of AI)
1206
+ B.owner === C && (AI.delete(I), B.reject(g));
1210
1207
  };
1211
1208
  return C.addEventListener("message", (g) => {
1212
- const I = g.data, B = I && gI.get(I.id);
1213
- !B || B.owner !== C || B.generation !== I.generation || (gI.delete(I.id), ["paused", "complete", "error"].includes(I.type) ? B.resolve(I) : B.reject(new Error("Invalid SVGA command response")));
1209
+ const I = g.data, B = I && AI.get(I.id);
1210
+ !B || B.owner !== C || B.generation !== I.generation || (AI.delete(I.id), ["paused", "complete", "error"].includes(I.type) ? B.resolve(I) : B.reject(new Error("Invalid SVGA command response")));
1214
1211
  }), C.addEventListener(
1215
1212
  "error",
1216
1213
  (g) => A(new Error(g.message || "SVGA command worker failed"))
1217
1214
  ), C.addEventListener(
1218
1215
  "messageerror",
1219
1216
  () => A(new Error("SVGA command worker deserialization failed"))
1220
- ), zg = C, C;
1217
+ ), jg = C, C;
1221
1218
  }
1222
1219
  async function He(C, A, g) {
1223
1220
  var I, B, Q, E, e;
1224
1221
  if (typeof Worker == "undefined") throw new Error("SVGA command Worker unavailable");
1225
- L(g.signal), (I = g.checkActive) == null || I.call(g);
1222
+ J(g.signal), (I = g.checkActive) == null || I.call(g);
1226
1223
  const i = Le(), t = Je++, a = t;
1227
1224
  let o = !0;
1228
1225
  try {
1229
1226
  for (; ; ) {
1230
- if ((B = g.checkActive) == null || B.call(g), L(g.signal), zg !== i) throw new Error("SVGA command worker restarted while queued");
1227
+ if ((B = g.checkActive) == null || B.call(g), J(g.signal), jg !== i) throw new Error("SVGA command worker restarted while queued");
1231
1228
  const s = g.profile ? performance.now() : 0, n = await QE(g.signal, "background");
1232
1229
  g.profile && (g.profile.phase("worker-queue").elapsedMs += performance.now() - s);
1233
1230
  let r;
1234
1231
  try {
1235
- if ((Q = g.checkActive) == null || Q.call(g), L(g.signal), zg !== i) throw new Error("SVGA command worker restarted while queued");
1232
+ if ((Q = g.checkActive) == null || Q.call(g), J(g.signal), jg !== i) throw new Error("SVGA command worker restarted while queued");
1236
1233
  r = await new Promise((c, h) => {
1237
1234
  var l;
1238
1235
  const w = () => {
1239
1236
  var d;
1240
- clearTimeout(y), (d = g.signal) == null || d.removeEventListener("abort", D), gI.delete(t);
1237
+ clearTimeout(y), (d = g.signal) == null || d.removeEventListener("abort", D), AI.delete(t);
1241
1238
  }, D = () => {
1242
- w(), h(QA("SVGA command task aborted"));
1239
+ w(), h(CA("SVGA command task aborted"));
1243
1240
  }, y = setTimeout(() => {
1244
1241
  w(), h(new Error("SVGA command worker response timeout"));
1245
1242
  }, 3e4);
1246
- gI.set(t, {
1243
+ AI.set(t, {
1247
1244
  owner: i,
1248
1245
  generation: a,
1249
1246
  resolve: (d) => {
@@ -1271,7 +1268,7 @@ async function He(C, A, g) {
1271
1268
  } finally {
1272
1269
  n();
1273
1270
  }
1274
- if (o = !1, (E = g.checkActive) == null || E.call(g), L(g.signal), g.profile)
1271
+ if (o = !1, (E = g.checkActive) == null || E.call(g), J(g.signal), g.profile)
1275
1272
  for (const c of (e = r.samples) != null ? e : []) {
1276
1273
  if (!["command-build", "frame-pack"].includes(c.phase) || !Number.isFinite(c.executionMs) || c.executionMs < 0)
1277
1274
  throw new Error("Invalid worker profile");
@@ -1285,7 +1282,7 @@ async function He(C, A, g) {
1285
1282
  }
1286
1283
  }
1287
1284
  } finally {
1288
- gI.delete(t);
1285
+ AI.delete(t);
1289
1286
  try {
1290
1287
  i.postMessage({ type: "cancel", id: t, generation: a });
1291
1288
  } catch (s) {
@@ -1381,22 +1378,22 @@ async function qe(C, A, g = {}) {
1381
1378
  var I, B, Q, E;
1382
1379
  const e = () => {
1383
1380
  var n;
1384
- L(g.signal), (n = g.checkActive) == null || n.call(g);
1385
- }, i = { ...g, checkActive: e }, t = (B = (I = g.clipAnalysis) == null ? void 0 : I.hits) != null ? B : 0, a = await Ig(
1381
+ J(g.signal), (n = g.checkActive) == null || n.call(g);
1382
+ }, i = { ...g, checkActive: e }, t = (B = (I = g.clipAnalysis) == null ? void 0 : I.hits) != null ? B : 0, a = await tg(
1386
1383
  IE(C, g),
1387
1384
  i,
1388
1385
  "clip-prepare"
1389
1386
  );
1390
1387
  if (g.profile && (g.profile.phase("clip-prepare").cacheHits = ((E = (Q = g.clipAnalysis) == null ? void 0 : Q.hits) != null ? E : 0) - t), g.useWorker !== !1)
1391
1388
  try {
1392
- const n = await Ig(
1389
+ const n = await tg(
1393
1390
  xe(a),
1394
1391
  i,
1395
1392
  "input-copy"
1396
1393
  );
1397
1394
  g.profile && (g.profile.phase("input-copy").bytes = Object.values(n).filter(ArrayBuffer.isView).reduce((c, h) => c + h.byteLength, 0));
1398
1395
  const r = await He(n, A, i);
1399
- return await Ig(
1396
+ return await tg(
1400
1397
  be(r, a, A),
1401
1398
  i,
1402
1399
  "validation"
@@ -1405,14 +1402,14 @@ async function qe(C, A, g = {}) {
1405
1402
  e(), g.profile && (g.profile.fallbackReason = String(n));
1406
1403
  }
1407
1404
  e();
1408
- const o = A ? await Ig(AE(a), i, "command-build") : void 0, s = await Ig(
1405
+ const o = A ? await tg(AE(a), i, "command-build") : void 0, s = await tg(
1409
1406
  De(a.frameData),
1410
1407
  i,
1411
1408
  "frame-pack"
1412
1409
  );
1413
1410
  return { commandTable: o, packed: s };
1414
1411
  }
1415
- const BI = 12, EE = 32 * 1024 * 1024, uC = EE, TC = 8, VI = 12, _g = 9, $g = 13, fg = 9, cI = 4, pI = 6, ve = `#version 300 es\r
1412
+ const II = 12, EE = 32 * 1024 * 1024, uC = EE, TC = 8, VI = 12, zg = 9, _g = 13, fg = 9, cI = 4, pI = 6, ve = `#version 300 es\r
1416
1413
  precision highp float;\r
1417
1414
  \r
1418
1415
  layout(location = 0) in vec3 a_position;\r
@@ -3484,7 +3481,7 @@ function qg(C, A) {
3484
3481
  `${A} rejected (${C.reason})${C.message ? `: ${C.message}` : ""}`
3485
3482
  );
3486
3483
  }
3487
- const Ag = 16, Ug = Object.freeze({
3484
+ const Ag = 16, kg = Object.freeze({
3488
3485
  parentA: 0,
3489
3486
  parentB: 1,
3490
3487
  parentC: 2,
@@ -5342,14 +5339,14 @@ const hg = class BA {
5342
5339
  ), M = S * Float32Array.BYTES_PER_ELEMENT;
5343
5340
  if (S < SI || S % 4 !== 0 || G.buffer.size < M || G.buffer.size % M !== 0)
5344
5341
  return;
5345
- const N = (o = A.svgaFrameTableFrameCount) != null ? o : A.frameTableFrameCount, U = (s = A.svgaFrameTableSpriteCount) != null ? s : A.frameTableSpriteCount, p = Math.floor(
5342
+ const N = (o = A.svgaFrameTableFrameCount) != null ? o : A.frameTableFrameCount, U = (s = A.svgaFrameTableSpriteCount) != null ? s : A.frameTableSpriteCount, K = Math.floor(
5346
5343
  Number.isFinite(N) ? N : (F == null ? void 0 : F.backend) === "webgpu" ? F.frameCount : 0
5347
5344
  ), k = Math.floor(f.buffer.size / BA.SVGA_FRAME_TABLE_ROW_BYTES), m = Math.floor(
5348
- Number.isFinite(U) ? U : (F == null ? void 0 : F.backend) === "webgpu" ? F.spriteCount : p > 0 ? k / p : 0
5345
+ Number.isFinite(U) ? U : (F == null ? void 0 : F.backend) === "webgpu" ? F.spriteCount : K > 0 ? k / K : 0
5349
5346
  );
5350
- if (p < 1 || m < 1 || p * m > k || !Number.isSafeInteger(p) || !Number.isSafeInteger(m))
5347
+ if (K < 1 || m < 1 || K * m > k || !Number.isSafeInteger(K) || !Number.isSafeInteger(m))
5351
5348
  return;
5352
- const H = A.instanceData, v = A.svgaFrameTableSlotStates, j = Math.floor((n = A.svgaFrameTableSlotStateCount) != null ? n : 0), T = Math.floor((r = A.svgaFrameTableSpritesPerSlot) != null ? r : 0), b = v != null && j > 0 && T > 0 && j * T === y && v.length >= j * Ag, X = !b && H != null && H.length >= y * Ag, Z = this.resolveSVGAFrameTableSlotUniform(A, y, p);
5349
+ const H = A.instanceData, v = A.svgaFrameTableSlotStates, j = Math.floor((n = A.svgaFrameTableSlotStateCount) != null ? n : 0), T = Math.floor((r = A.svgaFrameTableSpritesPerSlot) != null ? r : 0), b = v != null && j > 0 && T > 0 && j * T === y && v.length >= j * Ag, X = !b && H != null && H.length >= y * Ag, Z = this.resolveSVGAFrameTableSlotUniform(A, y, K);
5353
5350
  if (!Z) return;
5354
5351
  let EA = Z.metadataBase;
5355
5352
  if (b)
@@ -5358,7 +5355,7 @@ const hg = class BA {
5358
5355
  let hA = -1;
5359
5356
  for (let oA = 0; oA < y; oA++) {
5360
5357
  const rA = Math.floor(
5361
- (c = H[oA * Ag + Ug.metadataBase]) != null ? c : -1
5358
+ (c = H[oA * Ag + kg.metadataBase]) != null ? c : -1
5362
5359
  );
5363
5360
  rA > hA && (hA = rA);
5364
5361
  }
@@ -5367,23 +5364,23 @@ const hg = class BA {
5367
5364
  EA += y;
5368
5365
  if (Z.metadataBase < 0 || !D && (EA < 1 || EA > G.buffer.size / M))
5369
5366
  return;
5370
- const UA = b ? v : H, cA = X || b ? (b ? j : y) * Ag * Float32Array.BYTES_PER_ELEMENT : Math.min(64, f.buffer.size), IA = (h = A.svgaFrameTableSlotStateUploadId) != null ? h : -1, Bg = b && IA >= 0 && IA === this.svgaCompactSlotStateUploadId && cA === this.svgaCompactSlotStateByteLength, CA = Bg ? this.svgaCompactSlotStateStorageBase : X || b ? this.instancedStorageRingOffset : 0;
5371
- if ((X || b) && (CA < 0 || CA + cA > Lg)) return;
5372
- (X || b) && !Bg && (this.instancedStorageRingOffset += eI(
5367
+ const UA = b ? v : H, cA = X || b ? (b ? j : y) * Ag * Float32Array.BYTES_PER_ELEMENT : Math.min(64, f.buffer.size), IA = (h = A.svgaFrameTableSlotStateUploadId) != null ? h : -1, Ig = b && IA >= 0 && IA === this.svgaCompactSlotStateUploadId && cA === this.svgaCompactSlotStateByteLength, QA = Ig ? this.svgaCompactSlotStateStorageBase : X || b ? this.instancedStorageRingOffset : 0;
5368
+ if ((X || b) && (QA < 0 || QA + cA > Lg)) return;
5369
+ (X || b) && !Ig && (this.instancedStorageRingOffset += eI(
5373
5370
  cA,
5374
5371
  this.storageBindOffsetAlign
5375
- ), this.writeInstancedStorageShadow(CA, UA, cA), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += cA, b && IA >= 0 && (this.svgaCompactSlotStateUploadId = IA, this.svgaCompactSlotStateStorageBase = CA, this.svgaCompactSlotStateByteLength = cA));
5372
+ ), this.writeInstancedStorageShadow(QA, UA, cA), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += cA, b && IA >= 0 && (this.svgaCompactSlotStateUploadId = IA, this.svgaCompactSlotStateStorageBase = QA, this.svgaCompactSlotStateByteLength = cA));
5376
5373
  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((l = A.motionTrackSampleCount) != null ? l : 0), og = Math.floor(V != null ? V : -1), PA = (og + 1) * LA * 8 * 4, KA = og >= 0 && LA >= 1 && (W == null ? void 0 : W.usage) === "storage" && (pA == null ? void 0 : pA.usage) === "uniform" && W.buffer.size >= PA && pA.buffer.size >= 32, vA = A.stencil === "test" ? "test" : A.stencil === "write" ? "write" : A.stencil === "clear" ? "clear" : this.frameUsesStencil ? "pass" : "none", nA = D ? this.ensureSVGAFrameTableMeshPipeline(
5377
5374
  A.shader,
5378
5375
  vA
5379
5376
  ) : this.ensureSVGAFrameTablePipeline(vA === "test" ? "test" : vA === "pass" ? "pass" : "none");
5380
5377
  this.lastDrawPipeline !== nA.pipeline && (w.setPipeline(nA.pipeline), this.lastDrawPipeline = nA.pipeline, this.lastInstancedTextureBindGroup = null);
5381
- const J = vA === "test" || vA === "write" ? 1 : 0;
5382
- this.frameUsesStencil && this.lastStencilRef !== J && (w.setStencilReference(J), this.lastStencilRef = J);
5378
+ const L = vA === "test" || vA === "write" ? 1 : 0;
5379
+ this.frameUsesStencil && this.lastStencilRef !== L && (w.setStencilReference(L), this.lastStencilRef = L);
5383
5380
  const eA = A.uniforms.u_projection;
5384
5381
  if (!(eA instanceof Float32Array) || eA.length < 16) return;
5385
- const Cg = this.buffers.get(A.vertexBuffer.id), AA = this.buffers.get(A.indexBuffer.id);
5386
- if (!Cg || !AA) return;
5382
+ const Bg = this.buffers.get(A.vertexBuffer.id), AA = this.buffers.get(A.indexBuffer.id);
5383
+ if (!Bg || !AA) return;
5387
5384
  const DA = A.textures[0];
5388
5385
  if (!DA) return;
5389
5386
  const gA = this.textures.get(DA.id);
@@ -5391,7 +5388,7 @@ const hg = class BA {
5391
5388
  const mg = this.reserveSVGAFrameTableUniform(
5392
5389
  eA,
5393
5390
  Z,
5394
- p,
5391
+ K,
5395
5392
  m,
5396
5393
  y,
5397
5394
  KA ? og : null,
@@ -5400,7 +5397,7 @@ const hg = class BA {
5400
5397
  S / 4
5401
5398
  );
5402
5399
  if (mg == null) return;
5403
- const Jg = KA ? W.buffer : f.buffer, Qg = KA ? pA.buffer : this.uniformBuffer, dA = X || b ? this.ensureInstancedStorageBuffer() : f.buffer;
5400
+ const Jg = KA ? W.buffer : f.buffer, Cg = KA ? pA.buffer : this.uniformBuffer, dA = X || b ? this.ensureInstancedStorageBuffer() : f.buffer;
5404
5401
  if (dA.size < cA) return;
5405
5402
  const SA = b ? "slots" : X ? "hybrid" : "direct", GA = `${d.id}:${u.id}:${KA ? YA.id : 0}:${KA ? kA.id : 0}:${SA}:${cA}`;
5406
5403
  let iA = this.svgaFrameTableDataBindGroupCache.get(GA);
@@ -5425,7 +5422,7 @@ const hg = class BA {
5425
5422
  },
5426
5423
  {
5427
5424
  binding: 4,
5428
- resource: { buffer: Qg, offset: 0, size: 32 }
5425
+ resource: { buffer: Cg, offset: 0, size: 32 }
5429
5426
  },
5430
5427
  {
5431
5428
  binding: 5,
@@ -5436,7 +5433,7 @@ const hg = class BA {
5436
5433
  }
5437
5434
  }
5438
5435
  ]
5439
- }), this.svgaFrameTableDataBindGroupCache.set(GA, iA)), w.setBindGroup(0, iA, [mg, CA]);
5436
+ }), this.svgaFrameTableDataBindGroupCache.set(GA, iA)), w.setBindGroup(0, iA, [mg, QA]);
5440
5437
  const tA = DA.id;
5441
5438
  let aA = this.instancedTextureBindGroupCache.get(tA);
5442
5439
  aA || (aA = this.device.createBindGroup({
@@ -5445,23 +5442,23 @@ const hg = class BA {
5445
5442
  { binding: 0, resource: gA.view },
5446
5443
  { binding: 1, resource: this.sampler }
5447
5444
  ]
5448
- }), this.instancedTextureBindGroupCache.set(tA, aA)), w.setBindGroup(1, aA), this.lastVertexBufferId !== A.vertexBuffer.id && (w.setVertexBuffer(0, Cg.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, y, 0, 0, 0), this.recordSubmittedDraw();
5445
+ }), this.instancedTextureBindGroupCache.set(tA, aA)), w.setBindGroup(1, aA), 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, y, 0, 0, 0), this.recordSubmittedDraw();
5449
5446
  }
5450
5447
  resolveSVGAFrameTableSlotUniform(A, g, I) {
5451
- var B, Q, E, e, i, t, a, o, s, n, r, c, h, l, w, D, y, R, F, d, f, u, G, S, M, N, U, p, k, m, H, v, j, T, b, X, Z, EA, UA, FA, cA, IA, Bg, CA, V, YA, kA, W, pA, LA, og, PA, KA, vA, nA;
5452
- const J = (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, Cg = A.uniforms.u_clipRect, AA = A.svgaFrameTableParentAffine, DA = A.svgaFrameTableParentTranslate, gA = A.svgaFrameTableClipRect, mg = A.svgaFrameIndex != null || A.svgaFrameTableFrameIndex != null || A.frameTableFrameIndex != null, Jg = A.svgaFrameTableOpacity != null || typeof A.uniforms.u_opacity == "number", Qg = A.uniforms.u_projection;
5453
- if (!(Qg instanceof Float32Array) || Qg.length < 16) return null;
5454
- let dA = 1, SA = 0, GA = 0, iA = 1, tA = 0, aA = 0, hA = (E = A.svgaFrameTableOpacity) != null ? E : typeof A.uniforms.u_opacity == "number" ? A.uniforms.u_opacity : 1, oA = (t = (i = (e = A.svgaFrameIndex) != null ? e : A.svgaFrameTableFrameIndex) != null ? i : A.frameTableFrameIndex) != null ? t : 0, rA = 0, uA = 0, RA = this.canvas.width, TA = this.canvas.height, Eg = 0, Zg = (a = A.svgaFrameTableAtlasPage) != null ? a : -1, jA = (c = (r = (n = (s = (o = A.svgaFrameTableMetadataBase) != null ? o : A.svgaFrameTableSpriteBase) != null ? s : A.frameTableSpriteBase) != null ? n : A.svgaSpriteMetadataBase) != null ? r : A.svgaSpriteBase) != null ? c : 0;
5448
+ var B, Q, E, e, i, t, a, o, s, n, r, c, h, l, w, D, y, R, F, d, f, u, G, S, M, N, U, K, k, m, H, v, j, T, b, X, Z, EA, UA, FA, cA, IA, Ig, QA, V, YA, kA, W, pA, LA, og, PA, KA, vA, nA;
5449
+ 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, gA = A.svgaFrameTableClipRect, mg = A.svgaFrameIndex != null || A.svgaFrameTableFrameIndex != null || A.frameTableFrameIndex != null, Jg = A.svgaFrameTableOpacity != null || typeof A.uniforms.u_opacity == "number", Cg = A.uniforms.u_projection;
5450
+ if (!(Cg instanceof Float32Array) || Cg.length < 16) return null;
5451
+ let dA = 1, SA = 0, GA = 0, iA = 1, tA = 0, aA = 0, hA = (E = A.svgaFrameTableOpacity) != null ? E : typeof A.uniforms.u_opacity == "number" ? A.uniforms.u_opacity : 1, oA = (t = (i = (e = A.svgaFrameIndex) != null ? e : A.svgaFrameTableFrameIndex) != null ? i : A.frameTableFrameIndex) != null ? t : 0, rA = 0, uA = 0, RA = this.canvas.width, TA = this.canvas.height, Qg = 0, Zg = (a = A.svgaFrameTableAtlasPage) != null ? a : -1, jA = (c = (r = (n = (s = (o = A.svgaFrameTableMetadataBase) != null ? o : A.svgaFrameTableSpriteBase) != null ? s : A.frameTableSpriteBase) != null ? n : A.svgaSpriteMetadataBase) != null ? r : A.svgaSpriteBase) != null ? c : 0;
5455
5452
  if (AA && AA.length >= 4)
5456
- dA = (h = AA[0]) != null ? h : dA, SA = (l = AA[1]) != null ? l : SA, GA = (w = AA[2]) != null ? w : GA, iA = (D = AA[3]) != null ? D : iA, DA && DA.length >= 2 && (tA = (y = DA[0]) != null ? y : tA, aA = (R = DA[1]) != null ? R : aA), gA && gA.length >= 4 && (rA = (F = gA[0]) != null ? F : rA, uA = (d = gA[1]) != null ? d : uA, RA = (f = gA[2]) != null ? f : RA, TA = (u = gA[3]) != null ? u : TA, Eg = 1);
5457
- else if (J && J.length >= 13)
5458
- dA = (G = J[0]) != null ? G : dA, SA = (S = J[1]) != null ? S : SA, GA = (M = J[2]) != null ? M : GA, iA = (N = J[3]) != null ? N : iA, tA = (U = J[4]) != null ? U : tA, aA = (p = J[5]) != null ? p : aA, Jg || (hA = (k = J[6]) != null ? k : hA), mg || (oA = (m = J[7]) != null ? m : oA), rA = (H = J[8]) != null ? H : rA, uA = (v = J[9]) != null ? v : uA, RA = (j = J[10]) != null ? j : RA, TA = (T = J[11]) != null ? T : TA, Eg = ((b = J[12]) != null ? b : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && J.length >= 14 && (jA = (X = J[13]) != null ? X : jA);
5453
+ dA = (h = AA[0]) != null ? h : dA, SA = (l = AA[1]) != null ? l : SA, GA = (w = AA[2]) != null ? w : GA, iA = (D = AA[3]) != null ? D : iA, DA && DA.length >= 2 && (tA = (y = DA[0]) != null ? y : tA, aA = (R = DA[1]) != null ? R : aA), gA && gA.length >= 4 && (rA = (F = gA[0]) != null ? F : rA, uA = (d = gA[1]) != null ? d : uA, RA = (f = gA[2]) != null ? f : RA, TA = (u = gA[3]) != null ? u : TA, Qg = 1);
5454
+ else if (L && L.length >= 13)
5455
+ dA = (G = L[0]) != null ? G : dA, SA = (S = L[1]) != null ? S : SA, GA = (M = L[2]) != null ? M : GA, iA = (N = L[3]) != null ? N : iA, tA = (U = L[4]) != null ? U : tA, aA = (K = L[5]) != null ? K : aA, Jg || (hA = (k = L[6]) != null ? k : hA), mg || (oA = (m = L[7]) != null ? m : oA), rA = (H = L[8]) != null ? H : rA, uA = (v = L[9]) != null ? v : uA, RA = (j = L[10]) != null ? j : RA, TA = (T = L[11]) != null ? T : TA, Qg = ((b = L[12]) != null ? b : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && L.length >= 14 && (jA = (X = L[13]) != null ? X : jA);
5459
5456
  else if (eA instanceof Float32Array && eA.length >= 16) {
5460
5457
  dA = (Z = eA[0]) != null ? Z : dA, SA = (EA = eA[1]) != null ? EA : SA, GA = (UA = eA[4]) != null ? UA : GA, iA = (FA = eA[5]) != null ? FA : iA, tA = (cA = eA[12]) != null ? cA : tA, aA = (IA = eA[13]) != null ? IA : aA;
5461
- const QI = Cg instanceof Float32Array && Cg.length >= 4 ? Cg : gA;
5462
- QI && QI.length >= 4 && (rA = (Bg = QI[0]) != null ? Bg : rA, uA = (CA = QI[1]) != null ? CA : uA, RA = (V = QI[2]) != null ? V : RA, TA = (YA = QI[3]) != null ? YA : TA, Eg = typeof A.uniforms.u_clipEnabled == "number" ? A.uniforms.u_clipEnabled > 0.5 ? 1 : 0 : 1);
5458
+ const CI = Bg instanceof Float32Array && Bg.length >= 4 ? Bg : gA;
5459
+ CI && CI.length >= 4 && (rA = (Ig = CI[0]) != null ? Ig : rA, uA = (QA = CI[1]) != null ? QA : uA, RA = (V = CI[2]) != null ? V : RA, TA = (YA = CI[3]) != null ? YA : TA, Qg = typeof A.uniforms.u_clipEnabled == "number" ? A.uniforms.u_clipEnabled > 0.5 ? 1 : 0 : 1);
5463
5460
  }
5464
- return AA && J && J.length >= 13 && (DA || (tA = (kA = J[4]) != null ? kA : tA, aA = (W = J[5]) != null ? W : aA), Jg || (hA = (pA = J[6]) != null ? pA : hA), mg || (oA = (LA = J[7]) != null ? LA : oA), gA || (rA = (og = J[8]) != null ? og : rA, uA = (PA = J[9]) != null ? PA : uA, RA = (KA = J[10]) != null ? KA : RA, TA = (vA = J[11]) != null ? vA : TA, Eg = ((nA = J[12]) != null ? nA : 0) > 0.5 ? 1 : 0)), Number.isFinite(hA) || (hA = 1), Number.isFinite(oA) || (oA = 0), Number.isFinite(jA) || (jA = 0), Number.isFinite(Zg) || (Zg = -1), oA = Math.max(0, Math.min(I - 1, Math.floor(oA))), jA = Math.max(0, Math.floor(jA)), ![dA, SA, GA, iA, tA, aA, hA].every(Number.isFinite) || g < 1 ? null : {
5461
+ return AA && L && L.length >= 13 && (DA || (tA = (kA = L[4]) != null ? kA : tA, aA = (W = L[5]) != null ? W : aA), Jg || (hA = (pA = L[6]) != null ? pA : hA), mg || (oA = (LA = L[7]) != null ? LA : oA), gA || (rA = (og = L[8]) != null ? og : rA, uA = (PA = L[9]) != null ? PA : uA, RA = (KA = L[10]) != null ? KA : RA, TA = (vA = L[11]) != null ? vA : TA, Qg = ((nA = L[12]) != null ? nA : 0) > 0.5 ? 1 : 0)), Number.isFinite(hA) || (hA = 1), Number.isFinite(oA) || (oA = 0), Number.isFinite(jA) || (jA = 0), Number.isFinite(Zg) || (Zg = -1), oA = Math.max(0, Math.min(I - 1, Math.floor(oA))), jA = Math.max(0, Math.floor(jA)), ![dA, SA, GA, iA, tA, aA, hA].every(Number.isFinite) || g < 1 ? null : {
5465
5462
  parentA: dA,
5466
5463
  parentB: SA,
5467
5464
  parentC: GA,
@@ -5474,7 +5471,7 @@ const hg = class BA {
5474
5471
  clipY0: uA,
5475
5472
  clipX1: RA,
5476
5473
  clipY1: TA,
5477
- clipEnabled: Eg,
5474
+ clipEnabled: Qg,
5478
5475
  metadataBase: jA,
5479
5476
  atlasPage: Math.max(-1, Math.floor(Zg))
5480
5477
  };
@@ -6251,9 +6248,9 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6251
6248
  `[WebGL2] invalid SVGA frame table dimensions ${t}x${a}`
6252
6249
  );
6253
6250
  const o = t * a;
6254
- if (!Number.isSafeInteger(o) || A.length !== o * BI)
6251
+ if (!Number.isSafeInteger(o) || A.length !== o * II)
6255
6252
  throw new RangeError(
6256
- `[WebGL2] SVGA frame table requires ${o * BI} floats, got ${A.length}`
6253
+ `[WebGL2] SVGA frame table requires ${o * II} floats, got ${A.length}`
6257
6254
  );
6258
6255
  const s = this.createLinearFloatTableTexture(
6259
6256
  A,
@@ -6298,7 +6295,7 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6298
6295
  spriteCount: t,
6299
6296
  frameCount: a,
6300
6297
  atlasPageCount: w,
6301
- strideFloats: BI,
6298
+ strideFloats: II,
6302
6299
  byteLength: A.byteLength,
6303
6300
  ...c ? {
6304
6301
  spriteMetadataTexture: c
@@ -6548,20 +6545,20 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6548
6545
  return i !== t.length && (this.svgaSlotStateUploadScratch.length < i && (this.svgaSlotStateUploadScratch = new Float32Array(i)), this.svgaSlotStateUploadScratch.fill(0, 0, i), this.svgaSlotStateUploadScratch.set(t), a = this.svgaSlotStateUploadScratch.subarray(0, i)), B.texSubImage2D(B.TEXTURE_2D, 0, 0, 0, E, e, B.RGBA, B.FLOAT, a, 0), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += g * Ag * Float32Array.BYTES_PER_ELEMENT, this.svgaSlotStateUploadId = I, { width: E, height: e };
6549
6546
  }
6550
6547
  resolveSVGAFrameTableSlotState(A, g) {
6551
- var I, B, Q, E, e, i, t, a, o, s, n, r, c, h, l, w, D, y, R, F, d, f, u, G, S, M, N, U, p, k, m, H, v, j, T, b, X, Z, EA, UA, FA, cA, IA, Bg, CA, V, YA, kA, W, pA, LA, og, PA, KA, vA;
6552
- const nA = A.uniforms, J = (B = (I = A.svgaFrameTableSlotState) != null ? I : A.svgaSlotState) != null ? B : nA.u_svgaSlotState instanceof Float32Array ? nA.u_svgaSlotState : nA.u_slotState instanceof Float32Array ? nA.u_slotState : null, eA = nA.u_transform, Cg = nA.u_clipRect, AA = A.svgaFrameTableParentAffine, DA = A.svgaFrameTableParentTranslate, gA = A.svgaFrameTableClipRect, mg = A.svgaFrameIndex != null || A.svgaFrameTableFrameIndex != null || A.frameTableFrameIndex != null, Jg = A.svgaFrameTableOpacity != null || typeof nA.u_opacity == "number";
6553
- let Qg = 1, dA = 0, SA = 0, GA = 1, iA = 0, tA = 0, aA = (Q = A.svgaFrameTableOpacity) != null ? Q : typeof nA.u_opacity == "number" ? nA.u_opacity : 1, hA = (i = (e = (E = A.svgaFrameIndex) != null ? E : A.svgaFrameTableFrameIndex) != null ? e : A.frameTableFrameIndex) != null ? i : 0, oA = 0, rA = 0, uA = this.canvas.width, RA = this.canvas.height, TA = 0, Eg = (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, Zg = (r = A.svgaFrameTableAtlasPage) != null ? r : -1;
6548
+ var I, B, Q, E, e, i, t, a, o, s, n, r, c, h, l, w, D, y, R, F, d, f, u, G, S, M, N, U, K, k, m, H, v, j, T, b, X, Z, EA, UA, FA, cA, IA, Ig, QA, V, YA, kA, W, pA, LA, og, PA, KA, vA;
6549
+ const nA = A.uniforms, L = (B = (I = A.svgaFrameTableSlotState) != null ? I : A.svgaSlotState) != null ? B : nA.u_svgaSlotState instanceof Float32Array ? nA.u_svgaSlotState : nA.u_slotState instanceof Float32Array ? nA.u_slotState : null, eA = nA.u_transform, Bg = nA.u_clipRect, AA = A.svgaFrameTableParentAffine, DA = A.svgaFrameTableParentTranslate, gA = A.svgaFrameTableClipRect, mg = A.svgaFrameIndex != null || A.svgaFrameTableFrameIndex != null || A.frameTableFrameIndex != null, Jg = A.svgaFrameTableOpacity != null || typeof nA.u_opacity == "number";
6550
+ let Cg = 1, dA = 0, SA = 0, GA = 1, iA = 0, tA = 0, aA = (Q = A.svgaFrameTableOpacity) != null ? Q : typeof nA.u_opacity == "number" ? nA.u_opacity : 1, hA = (i = (e = (E = A.svgaFrameIndex) != null ? E : A.svgaFrameTableFrameIndex) != null ? e : A.frameTableFrameIndex) != null ? i : 0, oA = 0, rA = 0, uA = this.canvas.width, RA = 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, Zg = (r = A.svgaFrameTableAtlasPage) != null ? r : -1;
6554
6551
  if (AA && AA.length >= 4)
6555
- Qg = (c = AA[0]) != null ? c : Qg, dA = (h = AA[1]) != null ? h : dA, SA = (l = AA[2]) != null ? l : SA, GA = (w = AA[3]) != null ? w : GA, DA && DA.length >= 2 && (iA = (D = DA[0]) != null ? D : iA, tA = (y = DA[1]) != null ? y : tA), gA && gA.length >= 4 && (oA = (R = gA[0]) != null ? R : oA, rA = (F = gA[1]) != null ? F : rA, uA = (d = gA[2]) != null ? d : uA, RA = (f = gA[3]) != null ? f : RA, TA = 1);
6556
- else if (J && J.length >= 13)
6557
- Qg = (u = J[0]) != null ? u : Qg, dA = (G = J[1]) != null ? G : dA, SA = (S = J[2]) != null ? S : SA, GA = (M = J[3]) != null ? M : GA, iA = (N = J[4]) != null ? N : iA, tA = (U = J[5]) != null ? U : tA, Jg || (aA = (p = J[6]) != null ? p : aA), mg || (hA = (k = J[7]) != null ? k : hA), oA = (m = J[8]) != null ? m : oA, rA = (H = J[9]) != null ? H : rA, uA = (v = J[10]) != null ? v : uA, RA = (j = J[11]) != null ? j : RA, TA = ((T = J[12]) != null ? T : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && J.length >= 14 && (Eg = (b = J[13]) != null ? b : Eg);
6552
+ Cg = (c = AA[0]) != null ? c : Cg, dA = (h = AA[1]) != null ? h : dA, SA = (l = AA[2]) != null ? l : SA, GA = (w = AA[3]) != null ? w : GA, DA && DA.length >= 2 && (iA = (D = DA[0]) != null ? D : iA, tA = (y = DA[1]) != null ? y : tA), gA && gA.length >= 4 && (oA = (R = gA[0]) != null ? R : oA, rA = (F = gA[1]) != null ? F : rA, uA = (d = gA[2]) != null ? d : uA, RA = (f = gA[3]) != null ? f : RA, TA = 1);
6553
+ else if (L && L.length >= 13)
6554
+ Cg = (u = L[0]) != null ? u : Cg, dA = (G = L[1]) != null ? G : dA, SA = (S = L[2]) != null ? S : SA, GA = (M = L[3]) != null ? M : GA, iA = (N = L[4]) != null ? N : iA, tA = (U = L[5]) != null ? U : tA, Jg || (aA = (K = L[6]) != null ? K : aA), mg || (hA = (k = L[7]) != null ? k : hA), oA = (m = L[8]) != null ? m : oA, rA = (H = L[9]) != null ? H : rA, uA = (v = L[10]) != null ? v : uA, RA = (j = L[11]) != null ? j : RA, TA = ((T = L[12]) != null ? T : 0) > 0.5 ? 1 : 0, A.svgaFrameTableMetadataBase == null && A.svgaFrameTableSpriteBase == null && A.frameTableSpriteBase == null && A.svgaSpriteMetadataBase == null && A.svgaSpriteBase == null && L.length >= 14 && (Qg = (b = L[13]) != null ? b : Qg);
6558
6555
  else if (eA instanceof Float32Array && eA.length >= 16) {
6559
- Qg = (X = eA[0]) != null ? X : Qg, dA = (Z = eA[1]) != null ? Z : dA, SA = (EA = eA[4]) != null ? EA : SA, GA = (UA = eA[5]) != null ? UA : GA, iA = (FA = eA[12]) != null ? FA : iA, tA = (cA = eA[13]) != null ? cA : tA;
6560
- const jA = Cg instanceof Float32Array && Cg.length >= 4 ? Cg : gA;
6561
- jA && jA.length >= 4 && (oA = (IA = jA[0]) != null ? IA : oA, rA = (Bg = jA[1]) != null ? Bg : rA, uA = (CA = jA[2]) != null ? CA : uA, RA = (V = jA[3]) != null ? V : RA, TA = typeof nA.u_clipEnabled == "number" ? nA.u_clipEnabled > 0.5 ? 1 : 0 : 1);
6556
+ Cg = (X = eA[0]) != null ? X : Cg, dA = (Z = eA[1]) != null ? Z : dA, SA = (EA = eA[4]) != null ? EA : SA, GA = (UA = eA[5]) != null ? UA : GA, iA = (FA = eA[12]) != null ? FA : iA, tA = (cA = eA[13]) != null ? cA : tA;
6557
+ const jA = Bg instanceof Float32Array && Bg.length >= 4 ? Bg : gA;
6558
+ jA && jA.length >= 4 && (oA = (IA = jA[0]) != null ? IA : oA, rA = (Ig = jA[1]) != null ? Ig : rA, uA = (QA = jA[2]) != null ? QA : uA, RA = (V = jA[3]) != null ? V : RA, TA = typeof nA.u_clipEnabled == "number" ? nA.u_clipEnabled > 0.5 ? 1 : 0 : 1);
6562
6559
  }
6563
- return AA && J && J.length >= 13 && (DA || (iA = (YA = J[4]) != null ? YA : iA, tA = (kA = J[5]) != null ? kA : tA), Jg || (aA = (W = J[6]) != null ? W : aA), mg || (hA = (pA = J[7]) != null ? pA : hA), gA || (oA = (LA = J[8]) != null ? LA : oA, rA = (og = J[9]) != null ? og : rA, uA = (PA = J[10]) != null ? PA : uA, RA = (KA = J[11]) != null ? KA : RA, TA = ((vA = J[12]) != null ? vA : 0) > 0.5 ? 1 : 0)), Number.isFinite(aA) || (aA = 1), Number.isFinite(hA) || (hA = 0), Number.isFinite(Eg) || (Eg = 0), Number.isFinite(Zg) || (Zg = -1), hA = Math.max(0, Math.min(Math.max(1, g) - 1, Math.floor(hA))), Eg = Math.max(0, Math.floor(Eg)), [Qg, dA, SA, GA, iA, tA, aA, oA, rA, uA, RA].every(Number.isFinite) ? {
6564
- parentA: Qg,
6560
+ return AA && L && L.length >= 13 && (DA || (iA = (YA = L[4]) != null ? YA : iA, tA = (kA = L[5]) != null ? kA : tA), Jg || (aA = (W = L[6]) != null ? W : aA), mg || (hA = (pA = L[7]) != null ? pA : hA), gA || (oA = (LA = L[8]) != null ? LA : oA, rA = (og = L[9]) != null ? og : rA, uA = (PA = L[10]) != null ? PA : uA, RA = (KA = L[11]) != null ? KA : RA, TA = ((vA = L[12]) != null ? vA : 0) > 0.5 ? 1 : 0)), Number.isFinite(aA) || (aA = 1), Number.isFinite(hA) || (hA = 0), Number.isFinite(Qg) || (Qg = 0), Number.isFinite(Zg) || (Zg = -1), hA = Math.max(0, Math.min(Math.max(1, g) - 1, Math.floor(hA))), Qg = Math.max(0, Math.floor(Qg)), [Cg, dA, SA, GA, iA, tA, aA, oA, rA, uA, RA].every(Number.isFinite) ? {
6561
+ parentA: Cg,
6565
6562
  parentB: dA,
6566
6563
  parentC: SA,
6567
6564
  parentD: GA,
@@ -6574,7 +6571,7 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6574
6571
  clipX1: uA,
6575
6572
  clipY1: RA,
6576
6573
  clipEnabled: TA,
6577
- metadataBase: Eg,
6574
+ metadataBase: Qg,
6578
6575
  atlasPage: Math.max(-1, Math.floor(Zg))
6579
6576
  } : null;
6580
6577
  }
@@ -6602,12 +6599,12 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6602
6599
  this.rejectSVGAFastPathDraw();
6603
6600
  return;
6604
6601
  }
6605
- const p = (a = (i = (e = A.svgaSpriteMetadataTexture) != null ? e : A.svgaSpriteMetadata) != null ? i : A.spriteMetadataTexture) != null ? a : (M == null ? void 0 : M.backend) === "webgl2" && (t = M.spriteMetadataTexture) != null ? t : null;
6606
- if (!p) {
6602
+ const K = (a = (i = (e = A.svgaSpriteMetadataTexture) != null ? e : A.svgaSpriteMetadata) != null ? i : A.spriteMetadataTexture) != null ? a : (M == null ? void 0 : M.backend) === "webgl2" && (t = M.spriteMetadataTexture) != null ? t : null;
6603
+ if (!K) {
6607
6604
  this.rejectSVGAFastPathDraw();
6608
6605
  return;
6609
6606
  }
6610
- const k = this.textures.get(p.id);
6607
+ const k = this.textures.get(K.id);
6611
6608
  if (!k) {
6612
6609
  this.rejectSVGAFastPathDraw();
6613
6610
  return;
@@ -6616,7 +6613,7 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6616
6613
  Number.isFinite(m) ? m : (M == null ? void 0 : M.backend) === "webgl2" ? M.frameCount : 0
6617
6614
  ), j = Math.floor(
6618
6615
  Number.isFinite(H) ? H : (M == null ? void 0 : M.backend) === "webgl2" ? M.spriteCount : 0
6619
- ), T = Math.floor((n = A.instanceCount) != null ? n : 0), b = A.instanceData, X = A.svgaFrameTableSlotStates, Z = Math.floor((r = A.svgaFrameTableSlotStateCount) != null ? r : 0), EA = Math.floor((c = A.svgaFrameTableSpritesPerSlot) != null ? c : 0), UA = X != null && Z > 0 && EA > 0 && Z * EA === T && X.length >= Z * Ag, FA = !UA && b != null && b.length >= T * Ag, cA = U.width * U.height, IA = k.width * k.height, CA = Math.floor(
6616
+ ), T = Math.floor((n = A.instanceCount) != null ? n : 0), b = A.instanceData, X = A.svgaFrameTableSlotStates, Z = Math.floor((r = A.svgaFrameTableSlotStateCount) != null ? r : 0), EA = Math.floor((c = A.svgaFrameTableSpritesPerSlot) != null ? c : 0), UA = X != null && Z > 0 && EA > 0 && Z * EA === T && X.length >= Z * Ag, FA = !UA && b != null && b.length >= T * Ag, cA = U.width * U.height, IA = k.width * k.height, QA = Math.floor(
6620
6617
  (h = A.svgaSpriteMetadataStrideFloats) != null ? h : zC
6621
6618
  ) / 4, V = this.resolveSVGAFrameTableSlotState(A, v);
6622
6619
  let YA = (l = V == null ? void 0 : V.metadataBase) != null ? l : -1;
@@ -6627,14 +6624,14 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6627
6624
  let AA = -1;
6628
6625
  for (let DA = 0; DA < T; DA++) {
6629
6626
  const gA = Math.floor(
6630
- (w = b[DA * Ag + Ug.metadataBase]) != null ? w : -1
6627
+ (w = b[DA * Ag + kg.metadataBase]) != null ? w : -1
6631
6628
  );
6632
6629
  gA > AA && (AA = gA);
6633
6630
  }
6634
6631
  YA = AA + 1;
6635
6632
  } else
6636
6633
  YA += T;
6637
- if (T < 1 || T > 2048 || v < 1 || j < 1 || !Number.isSafeInteger(v) || !Number.isSafeInteger(j) || !Number.isSafeInteger(CA) || CA < 2 || v * j * 3 > cA || !V || V.metadataBase < 0 || YA < 1 || YA * CA > IA) {
6634
+ if (T < 1 || T > 2048 || v < 1 || j < 1 || !Number.isSafeInteger(v) || !Number.isSafeInteger(j) || !Number.isSafeInteger(QA) || QA < 2 || v * j * 3 > cA || !V || V.metadataBase < 0 || YA < 1 || YA * QA > IA) {
6638
6635
  this.rejectSVGAFastPathDraw();
6639
6636
  return;
6640
6637
  }
@@ -6649,7 +6646,7 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6649
6646
  return;
6650
6647
  }
6651
6648
  const og = (D = A.stencil) != null ? D : "none";
6652
- og === "test" ? (G.enable(G.STENCIL_TEST), G.stencilFunc(G.EQUAL, 1, 255), G.stencilOp(G.KEEP, G.KEEP, G.KEEP), G.stencilMask(0), G.colorMask(!0, !0, !0, !0)) : (G.disable(G.STENCIL_TEST), G.colorMask(!0, !0, !0, !0)), this.cachedDrawProgram !== kA && (G.useProgram(W.program), this.cachedDrawProgram = kA), G.activeTexture(G.TEXTURE0), this.cachedTex0Id !== pA.id && (G.bindTexture(G.TEXTURE_2D, LA.texture), this.cachedTex0Id = pA.id), G.activeTexture(G.TEXTURE1), this.cachedFrameTableId !== N.id && (G.bindTexture(G.TEXTURE_2D, U.texture), this.cachedFrameTableId = N.id), G.activeTexture(G.TEXTURE2), this.cachedFrameMetadataId !== p.id && (G.bindTexture(G.TEXTURE_2D, k.texture), this.cachedFrameMetadataId = p.id);
6649
+ og === "test" ? (G.enable(G.STENCIL_TEST), G.stencilFunc(G.EQUAL, 1, 255), G.stencilOp(G.KEEP, G.KEEP, G.KEEP), G.stencilMask(0), G.colorMask(!0, !0, !0, !0)) : (G.disable(G.STENCIL_TEST), G.colorMask(!0, !0, !0, !0)), this.cachedDrawProgram !== kA && (G.useProgram(W.program), this.cachedDrawProgram = kA), G.activeTexture(G.TEXTURE0), this.cachedTex0Id !== pA.id && (G.bindTexture(G.TEXTURE_2D, LA.texture), this.cachedTex0Id = pA.id), G.activeTexture(G.TEXTURE1), this.cachedFrameTableId !== N.id && (G.bindTexture(G.TEXTURE_2D, U.texture), this.cachedFrameTableId = N.id), G.activeTexture(G.TEXTURE2), this.cachedFrameMetadataId !== K.id && (G.bindTexture(G.TEXTURE_2D, k.texture), this.cachedFrameMetadataId = K.id);
6653
6650
  let PA = null;
6654
6651
  if (UA && (PA = this.uploadSVGASlotStates(
6655
6652
  X,
@@ -6666,20 +6663,20 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6666
6663
  vA[0] = U.width, vA[1] = U.height;
6667
6664
  const nA = this.svgaMetadataSizeScratch;
6668
6665
  nA[0] = k.width, nA[1] = k.height;
6669
- const J = G;
6670
- if (W.tableInfoLoc && ((y = J.uniform4iv) == null || y.call(J, W.tableInfoLoc, KA)), W.frameTableSizeLoc && ((R = J.uniform2iv) == null || R.call(J, W.frameTableSizeLoc, vA)), W.spriteMetadataSizeLoc && ((F = J.uniform2iv) == null || F.call(J, W.spriteMetadataSizeLoc, nA)), W.spriteMetadataStrideLoc && G.uniform1i(W.spriteMetadataStrideLoc, CA), W.spriteBaseLoc && G.uniform1i(W.spriteBaseLoc, V.metadataBase), W.frameIndexLoc && G.uniform1i(W.frameIndexLoc, V.frameIndex), W.parentAffineLoc && G.uniform4f(W.parentAffineLoc, V.parentA, V.parentB, V.parentC, V.parentD), W.parentTranslateLoc && G.uniform2f(W.parentTranslateLoc, V.tx, V.ty), W.slotOpacityLoc && G.uniform1f(W.slotOpacityLoc, V.opacity), W.atlasPageLoc && G.uniform1i(W.atlasPageLoc, V.atlasPage), W.clipRectLoc && G.uniform4f(W.clipRectLoc, V.clipX0, V.clipY0, V.clipX1, V.clipY1), W.clipEnabledLoc && G.uniform1f(W.clipEnabledLoc, V.clipEnabled), W.canvasHeightLoc && G.uniform1f(W.canvasHeightLoc, this.canvas.height), W.instanceStateEnabledLoc && G.uniform1f(W.instanceStateEnabledLoc, FA ? 1 : 0), W.compactSlotStateEnabledLoc && G.uniform1f(W.compactSlotStateEnabledLoc, UA ? 1 : 0), W.spritesPerSlotLoc && G.uniform1i(W.spritesPerSlotLoc, UA ? EA : 1), W.slotStateSizeLoc) {
6666
+ const L = G;
6667
+ if (W.tableInfoLoc && ((y = L.uniform4iv) == null || y.call(L, W.tableInfoLoc, KA)), W.frameTableSizeLoc && ((R = L.uniform2iv) == null || R.call(L, W.frameTableSizeLoc, vA)), W.spriteMetadataSizeLoc && ((F = L.uniform2iv) == null || F.call(L, W.spriteMetadataSizeLoc, nA)), W.spriteMetadataStrideLoc && G.uniform1i(W.spriteMetadataStrideLoc, QA), W.spriteBaseLoc && G.uniform1i(W.spriteBaseLoc, V.metadataBase), W.frameIndexLoc && G.uniform1i(W.frameIndexLoc, V.frameIndex), W.parentAffineLoc && G.uniform4f(W.parentAffineLoc, V.parentA, V.parentB, V.parentC, V.parentD), W.parentTranslateLoc && G.uniform2f(W.parentTranslateLoc, V.tx, V.ty), W.slotOpacityLoc && G.uniform1f(W.slotOpacityLoc, V.opacity), W.atlasPageLoc && G.uniform1i(W.atlasPageLoc, V.atlasPage), W.clipRectLoc && G.uniform4f(W.clipRectLoc, V.clipX0, V.clipY0, V.clipX1, V.clipY1), W.clipEnabledLoc && G.uniform1f(W.clipEnabledLoc, V.clipEnabled), W.canvasHeightLoc && G.uniform1f(W.canvasHeightLoc, this.canvas.height), W.instanceStateEnabledLoc && G.uniform1f(W.instanceStateEnabledLoc, FA ? 1 : 0), W.compactSlotStateEnabledLoc && G.uniform1f(W.compactSlotStateEnabledLoc, UA ? 1 : 0), W.spritesPerSlotLoc && G.uniform1i(W.spritesPerSlotLoc, UA ? EA : 1), W.slotStateSizeLoc) {
6671
6668
  const AA = new Int32Array([
6672
6669
  (d = PA == null ? void 0 : PA.width) != null ? d : 1,
6673
6670
  (f = PA == null ? void 0 : PA.height) != null ? f : 1
6674
6671
  ]);
6675
- (u = J.uniform2iv) == null || u.call(J, W.slotStateSizeLoc, AA);
6672
+ (u = L.uniform2iv) == null || u.call(L, W.slotStateSizeLoc, AA);
6676
6673
  }
6677
- const eA = this.buffers.get(A.vertexBuffer.id), Cg = this.buffers.get(A.indexBuffer.id);
6678
- if (!eA || !Cg) {
6674
+ const eA = this.buffers.get(A.vertexBuffer.id), Bg = this.buffers.get(A.indexBuffer.id);
6675
+ if (!eA || !Bg) {
6679
6676
  this.rejectSVGAFastPathDraw();
6680
6677
  return;
6681
6678
  }
6682
- if (this.bindCachedVertexArray(kA, A.vertexBuffer.id, A.indexBuffer.id) && (G.bindBuffer(G.ARRAY_BUFFER, eA.buffer), G.bindBuffer(G.ELEMENT_ARRAY_BUFFER, Cg.buffer), this.setupAttributes(kA)), FA) {
6679
+ if (this.bindCachedVertexArray(kA, A.vertexBuffer.id, A.indexBuffer.id) && (G.bindBuffer(G.ARRAY_BUFFER, eA.buffer), G.bindBuffer(G.ELEMENT_ARRAY_BUFFER, Bg.buffer), this.setupAttributes(kA)), FA) {
6683
6680
  const AA = this.ensureInstancedSvgaInstanceBuffer();
6684
6681
  G.bindBuffer(G.ARRAY_BUFFER, AA), G.bufferSubData(G.ARRAY_BUFFER, 0, b, 0, T * Ag), this.performanceSVGADynamicUploadWrites++, this.performanceSVGADynamicUploadBytes += T * Ag * Float32Array.BYTES_PER_ELEMENT;
6685
6682
  const DA = 16 * Float32Array.BYTES_PER_ELEMENT;
@@ -6712,8 +6709,8 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6712
6709
  if (!N) return;
6713
6710
  const U = (a = A.stencil) != null ? a : "none";
6714
6711
  U === "clear" ? (h.enable(h.STENCIL_TEST), h.stencilFunc(h.ALWAYS, 0, 255), h.stencilOp(h.KEEP, h.KEEP, h.REPLACE), h.stencilMask(255), h.colorMask(!1, !1, !1, !1)) : U === "write" ? (h.enable(h.STENCIL_TEST), h.stencilFunc(h.ALWAYS, 1, 255), h.stencilOp(h.KEEP, h.KEEP, h.REPLACE), h.stencilMask(255), h.colorMask(!1, !1, !1, !1)) : U === "test" ? (h.enable(h.STENCIL_TEST), h.stencilFunc(h.EQUAL, 1, 255), h.stencilOp(h.KEEP, h.KEEP, h.KEEP), h.stencilMask(0), h.colorMask(!0, !0, !0, !0)) : (h.disable(h.STENCIL_TEST), h.colorMask(!0, !0, !0, !0)), this.cachedDrawProgram !== M && (h.useProgram(N.program), this.cachedDrawProgram = M), h.activeTexture(h.TEXTURE0), this.cachedTex0Id !== D.id && (h.bindTexture(h.TEXTURE_2D, y.texture), this.cachedTex0Id = D.id), this.applyProjectionUniform(N, M, A.uniforms.u_projection), this.svgaTableInfoScratch[0] = R, this.svgaTableInfoScratch[1] = F, this.svgaTableInfoScratch[2] = 3, this.svgaTableInfoScratch[3] = 0, this.svgaTableSizeScratch[0] = y.width, this.svgaTableSizeScratch[1] = y.height;
6715
- const p = h;
6716
- N.tableInfoLoc && ((o = p.uniform4iv) == null || o.call(p, N.tableInfoLoc, this.svgaTableInfoScratch)), N.frameTableSizeLoc && ((s = p.uniform2iv) == null || s.call(p, N.frameTableSizeLoc, this.svgaTableSizeScratch)), N.spriteBaseLoc && h.uniform1i(N.spriteBaseLoc, S.metadataBase), N.frameIndexLoc && h.uniform1i(N.frameIndexLoc, S.frameIndex), N.parentAffineLoc && h.uniform4f(
6712
+ const K = h;
6713
+ N.tableInfoLoc && ((o = K.uniform4iv) == null || o.call(K, N.tableInfoLoc, this.svgaTableInfoScratch)), N.frameTableSizeLoc && ((s = K.uniform2iv) == null || s.call(K, N.frameTableSizeLoc, this.svgaTableSizeScratch)), N.spriteBaseLoc && h.uniform1i(N.spriteBaseLoc, S.metadataBase), N.frameIndexLoc && h.uniform1i(N.frameIndexLoc, S.frameIndex), N.parentAffineLoc && h.uniform4f(
6717
6714
  N.parentAffineLoc,
6718
6715
  S.parentA,
6719
6716
  S.parentB,
@@ -6733,7 +6730,7 @@ const EB = "svga-frame-table-instanced-premul", zC = 8, Ji = new Float32Array([1
6733
6730
  A.svgaFrameTableSlotStateUploadId
6734
6731
  ), !k))
6735
6732
  return;
6736
- N.compactSlotStateEnabledLoc && h.uniform1f(N.compactSlotStateEnabledLoc, G ? 1 : 0), N.slotStateSizeLoc && (this.svgaTableSizeScratch[0] = (n = k == null ? void 0 : k.width) != null ? n : 1, this.svgaTableSizeScratch[1] = (r = k == null ? void 0 : k.height) != null ? r : 1, (c = p.uniform2iv) == null || c.call(p, N.slotStateSizeLoc, this.svgaTableSizeScratch));
6733
+ N.compactSlotStateEnabledLoc && h.uniform1f(N.compactSlotStateEnabledLoc, G ? 1 : 0), N.slotStateSizeLoc && (this.svgaTableSizeScratch[0] = (n = k == null ? void 0 : k.width) != null ? n : 1, this.svgaTableSizeScratch[1] = (r = k == null ? void 0 : k.height) != null ? r : 1, (c = K.uniform2iv) == null || c.call(K, N.slotStateSizeLoc, this.svgaTableSizeScratch));
6737
6734
  const m = this.buffers.get(A.vertexBuffer.id), H = this.buffers.get(A.indexBuffer.id);
6738
6735
  !m || !H || (this.bindCachedVertexArray(M, A.vertexBuffer.id, A.indexBuffer.id) && (h.bindBuffer(h.ARRAY_BUFFER, m.buffer), h.bindBuffer(h.ELEMENT_ARRAY_BUFFER, H.buffer), this.setupAttributes(M)), h.drawElementsInstanced(h.TRIANGLES, A.indexCount, h.UNSIGNED_INT, 0, d), this.recordSubmittedDraw(), U !== "none" && (h.disable(h.STENCIL_TEST), h.colorMask(!0, !0, !0, !0)));
6739
6736
  }
@@ -7466,9 +7463,9 @@ function Vg(C) {
7466
7463
  sy: C.height / Math.max(1, g)
7467
7464
  };
7468
7465
  }
7469
- const AI = 9, Pi = { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 };
7466
+ const $g = 9, Pi = { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 };
7470
7467
  function aE(C, A, g) {
7471
- return (C * g + A) * AI;
7468
+ return (C * g + A) * $g;
7472
7469
  }
7473
7470
  function ji(C, A, g) {
7474
7471
  var I, B;
@@ -7482,7 +7479,7 @@ function oE(C, A) {
7482
7479
  if (a <= 0)
7483
7480
  for (const D of C)
7484
7481
  a = Math.max(a, D.frames.length);
7485
- const o = C.map((D) => D.imageKey), s = new Float32Array(t * a * AI), n = [], r = /* @__PURE__ */ new Map(), c = new Int32Array(t * a).fill(-1), h = [], l = new Int32Array(t * a).fill(-1);
7482
+ const o = C.map((D) => D.imageKey), s = new Float32Array(t * a * $g), n = [], r = /* @__PURE__ */ new Map(), c = new Int32Array(t * a).fill(-1), h = [], l = new Int32Array(t * a).fill(-1);
7486
7483
  let w = !1;
7487
7484
  for (let D = 0; D < t; D++) {
7488
7485
  const y = C[D];
@@ -7513,14 +7510,14 @@ function oE(C, A) {
7513
7510
  l[D * a + d] = F, w = !0;
7514
7511
  continue;
7515
7512
  }
7516
- const p = U.every(
7513
+ const K = U.every(
7517
7514
  (k) => k.kind !== "keep"
7518
7515
  ) ? U : U.filter((k) => k.kind !== "keep");
7519
- if (p.length === 0) {
7516
+ if (K.length === 0) {
7520
7517
  R = null, F = -1;
7521
7518
  continue;
7522
7519
  }
7523
- R = p, F = h.length, h.push(p), l[D * a + d] = F, w = !0;
7520
+ R = K, F = h.length, h.push(K), l[D * a + d] = F, w = !0;
7524
7521
  }
7525
7522
  }
7526
7523
  return {
@@ -7553,12 +7550,12 @@ function vg(C, A) {
7553
7550
  return A.allFramesInsideViewBox = B, B;
7554
7551
  }
7555
7552
  function xB(C, A, g) {
7556
- const I = Math.floor(C.length / $g), B = Math.floor(A.length / (cI * fg)), Q = Math.floor(g.length / pI), E = Math.min(I, B, Q);
7553
+ const I = Math.floor(C.length / _g), B = Math.floor(A.length / (cI * fg)), Q = Math.floor(g.length / pI), E = Math.min(I, B, Q);
7557
7554
  for (let e = 0; e < E; e++) {
7558
- const i = e * $g, t = C[i], a = C[i + 1], o = C[i + 2], s = C[i + 3], n = C[i + 4], r = C[i + 5], c = C[i + 6], h = C[i + 7], l = C[i + 8], w = C[i + 9], D = C[i + 10], y = C[i + 11], R = C[i + 12], F = c, d = h, f = o * t + c, u = s * t + h, G = o * t + n * a + c, S = s * t + r * a + h, M = n * a + c, N = r * a + h, U = e * cI * fg;
7555
+ const i = e * _g, t = C[i], a = C[i + 1], o = C[i + 2], s = C[i + 3], n = C[i + 4], r = C[i + 5], c = C[i + 6], h = C[i + 7], l = C[i + 8], w = C[i + 9], D = C[i + 10], y = C[i + 11], R = C[i + 12], F = c, d = h, f = o * t + c, u = s * t + h, G = o * t + n * a + c, S = s * t + r * a + h, M = n * a + c, N = r * a + h, U = e * cI * fg;
7559
7556
  A[U] = F, A[U + 1] = d, A[U + 2] = 0, A[U + 3] = 1, A[U + 4] = 1, A[U + 5] = 1, A[U + 6] = l, A[U + 7] = w, A[U + 8] = D;
7560
- const p = U + fg;
7561
- A[p] = f, A[p + 1] = u, A[p + 2] = 0, A[p + 3] = 1, A[p + 4] = 1, A[p + 5] = 1, A[p + 6] = l, A[p + 7] = y, A[p + 8] = D;
7557
+ const K = U + fg;
7558
+ A[K] = f, A[K + 1] = u, A[K + 2] = 0, A[K + 3] = 1, A[K + 4] = 1, A[K + 5] = 1, A[K + 6] = l, A[K + 7] = y, A[K + 8] = D;
7562
7559
  const k = U + 2 * fg;
7563
7560
  A[k] = G, A[k + 1] = S, A[k + 2] = 0, A[k + 3] = 1, A[k + 4] = 1, A[k + 5] = 1, A[k + 6] = l, A[k + 7] = y, A[k + 8] = R;
7564
7561
  const m = U + 3 * fg;
@@ -7675,9 +7672,9 @@ function Ct(C, A) {
7675
7672
  function kB(C, A) {
7676
7673
  return C = C >>> 0, hI().subarray(C / 1, C / 1 + A);
7677
7674
  }
7678
- let Pg = null;
7675
+ let Og = null;
7679
7676
  function gQ() {
7680
- return (Pg === null || Pg.buffer.detached === !0 || Pg.buffer.detached === void 0 && Pg.buffer !== _.memory.buffer) && (Pg = new DataView(_.memory.buffer)), Pg;
7677
+ return (Og === null || Og.buffer.detached === !0 || Og.buffer.detached === void 0 && Og.buffer !== _.memory.buffer) && (Og = new DataView(_.memory.buffer)), Og;
7681
7678
  }
7682
7679
  let MI = null;
7683
7680
  function Qt() {
@@ -7755,7 +7752,7 @@ const KI = new TextEncoder();
7755
7752
  });
7756
7753
  let qA = 0, _;
7757
7754
  function hE(C, A) {
7758
- return _ = C.exports, Pg = null, MI = null, NI = null, UI = null, kI = null, _.__wbindgen_start(), _;
7755
+ return _ = C.exports, Og = null, MI = null, NI = null, UI = null, kI = null, _.__wbindgen_start(), _;
7759
7756
  }
7760
7757
  async function ot(C, A) {
7761
7758
  if (typeof Response == "function" && C instanceof Response) {
@@ -9104,7 +9101,7 @@ function mt() {
9104
9101
  Q.reject(new Error(`SVGA clip worker returned no mesh for fillable path: ${i.path}`));
9105
9102
  return;
9106
9103
  }
9107
- const t = { vertices: i.vertices, indices: i.indices }, a = await Ig(FB(t), { profile: Q.profile, frameBudgetMs: Q.frameBudgetMs, checkActive: () => L(Q.signal) }, "validation");
9104
+ const t = { vertices: i.vertices, indices: i.indices }, a = await tg(FB(t), { profile: Q.profile, frameBudgetMs: Q.frameBudgetMs, checkActive: () => J(Q.signal) }, "validation");
9108
9105
  if (a) {
9109
9106
  Q.reject(new Error(`SVGA clip worker returned invalid mesh for ${i.path}: ${a}`));
9110
9107
  return;
@@ -9146,7 +9143,7 @@ function Jt(C, A = {}) {
9146
9143
  return Promise.reject(new Error("SVGA clip worker request contains duplicate paths"));
9147
9144
  const g = A.profile ? performance.now() : 0;
9148
9145
  return GC(() => {
9149
- A.profile && (A.profile.phase("worker-queue").elapsedMs += performance.now() - g), L(A.signal, "SVGA clip worker task aborted");
9146
+ A.profile && (A.profile.phase("worker-queue").elapsedMs += performance.now() - g), J(A.signal, "SVGA clip worker task aborted");
9150
9147
  const I = mt(), B = Kt++;
9151
9148
  return new Promise((Q, E) => {
9152
9149
  var e, i;
@@ -9166,7 +9163,7 @@ function Jt(C, A = {}) {
9166
9163
  I.postMessage({ type: "cancel-svga-clip-meshes", id: B });
9167
9164
  } catch (a) {
9168
9165
  }
9169
- E(QA("SVGA clip worker task aborted"));
9166
+ E(CA("SVGA clip worker task aborted"));
9170
9167
  }, dI.set(B, t), (e = A.signal) != null && e.aborted) {
9171
9168
  t.onAbort();
9172
9169
  return;
@@ -9189,14 +9186,14 @@ function Jt(C, A = {}) {
9189
9186
  });
9190
9187
  }, A.signal);
9191
9188
  }
9192
- var Lt = Object.defineProperty, Ht = (C, A, g) => A in C ? Lt(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, K = (C, A, g) => Ht(C, typeof A != "symbol" ? A + "" : A, g);
9189
+ var Lt = Object.defineProperty, Ht = (C, A, g) => A in C ? Lt(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, p = (C, A, g) => Ht(C, typeof A != "symbol" ? A + "" : A, g);
9193
9190
  const zA = 2048, eQ = 13, XB = 14, iI = Ag;
9194
9191
  class lI extends Error {
9195
9192
  constructor(A) {
9196
9193
  super("SVGA FastPath submission rejected; replaying frame through CPU Reference"), this.entity = A, this.name = "SVGAFastPathFrameReplayError";
9197
9194
  }
9198
9195
  }
9199
- class jg extends Error {
9196
+ class Pg extends Error {
9200
9197
  constructor(A) {
9201
9198
  super(A), this.name = "SVGAStencilTransactionError";
9202
9199
  }
@@ -9214,32 +9211,32 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9214
9211
  * pick up the now-available precise clip.
9215
9212
  */
9216
9213
  constructor(A, g, I) {
9217
- this.onClipMeshReady = A, this.onHybridValidationFailure = g, this.onRuntimeDiagnostic = I, K(this, "pool", new St()), K(this, "vertexBufHandles", []), K(this, "indexBufHandles", []), K(this, "clipSpriteVertBufHandles", []), K(this, "clipSpriteIdxBufHandles", []), K(this, "batchDrawCursor", 0), K(this, "clipSpriteDrawCursor", 0), K(this, "canvasWidth", 0), K(this, "canvasHeight", 0), K(this, "projCacheW", 0), K(this, "projCacheH", 0), K(this, "projCache", null), K(this, "clipMeshCache", /* @__PURE__ */ new Map()), K(this, "clipMeshStates", /* @__PURE__ */ new Map()), K(this, "clipMeshStateWaiters", /* @__PURE__ */ new Map()), K(this, "clipMeshGeneration", 0), K(this, "clipMeshProducerController", new AbortController()), K(this, "clipMeshProducerTasks", /* @__PURE__ */ new Set()), K(this, "clipResourceProducers", /* @__PURE__ */ new Map()), K(this, "destroyed", !1), K(this, "clipMeshDestroyed", !1), K(this, "clipAnalysis", new $Q()), K(this, "clipMeshesWithBuffers", /* @__PURE__ */ new Set()), K(this, "clipMeshRefCounts", /* @__PURE__ */ new Map()), K(this, "entityRetainedClipMeshes", /* @__PURE__ */ new WeakMap()), K(this, "pendingClipMeshPaths", /* @__PURE__ */ new Set()), K(this, "clipMeshBuildInFlight", !1), K(this, "stencilTransactionState", "idle"), K(this, "clipFrameDataScratch", new Float32Array($g)), K(this, "staticBatchCacheRowScratch", new Float32Array($g)), K(this, "instancedFrameDataScratch", new Float32Array(
9214
+ this.onClipMeshReady = A, this.onHybridValidationFailure = g, this.onRuntimeDiagnostic = I, p(this, "pool", new St()), p(this, "vertexBufHandles", []), p(this, "indexBufHandles", []), p(this, "clipSpriteVertBufHandles", []), p(this, "clipSpriteIdxBufHandles", []), p(this, "batchDrawCursor", 0), p(this, "clipSpriteDrawCursor", 0), p(this, "canvasWidth", 0), p(this, "canvasHeight", 0), p(this, "projCacheW", 0), p(this, "projCacheH", 0), p(this, "projCache", null), p(this, "clipMeshCache", /* @__PURE__ */ new Map()), p(this, "clipMeshStates", /* @__PURE__ */ new Map()), p(this, "clipMeshStateWaiters", /* @__PURE__ */ new Map()), p(this, "clipMeshGeneration", 0), p(this, "clipMeshProducerController", new AbortController()), p(this, "clipMeshProducerTasks", /* @__PURE__ */ new Set()), p(this, "clipResourceProducers", /* @__PURE__ */ new Map()), p(this, "clipPreparationOwners", /* @__PURE__ */ new WeakMap()), p(this, "liveClipPreparationControllers", /* @__PURE__ */ new Set()), p(this, "clipTableOwnerCounts", /* @__PURE__ */ new WeakMap()), p(this, "destroyed", !1), p(this, "clipMeshDestroyed", !1), p(this, "clipAnalysis", new $Q()), p(this, "clipMeshesWithBuffers", /* @__PURE__ */ new Set()), p(this, "clipMeshRefCounts", /* @__PURE__ */ new Map()), p(this, "entityRetainedClipMeshes", /* @__PURE__ */ new WeakMap()), p(this, "pendingClipMeshPaths", /* @__PURE__ */ new Set()), p(this, "clipMeshBuildInFlight", !1), p(this, "stencilTransactionState", "idle"), p(this, "clipFrameDataScratch", new Float32Array(_g)), p(this, "staticBatchCacheRowScratch", new Float32Array(_g)), p(this, "instancedFrameDataScratch", new Float32Array(
9218
9215
  zA * eQ
9219
- )), K(this, "instancedFrameDataWords", new Uint32Array(this.instancedFrameDataScratch.buffer)), K(this, "timelineBatchDataScratch", new Float32Array(
9216
+ )), p(this, "instancedFrameDataWords", new Uint32Array(this.instancedFrameDataScratch.buffer)), p(this, "timelineBatchDataScratch", new Float32Array(
9220
9217
  zA * iI
9221
- )), K(this, "timelineBatchFrameScratch", new Int32Array(zA)), K(this, "timelineDirectSlotDataScratch", new Float32Array(
9218
+ )), p(this, "timelineBatchFrameScratch", new Int32Array(zA)), p(this, "timelineDirectSlotDataScratch", new Float32Array(
9222
9219
  zA * iI
9223
- )), K(this, "clipSpriteVertsScratch", null), K(this, "clipSpriteIndicesScratch", null), K(this, "clipMaskBatchTransformsScratch", new Float32Array(0)), K(this, "instancedQuadVB", null), K(this, "instancedQuadIB", null), K(this, "whiteTexture", null), K(this, "shapeMeshCache", /* @__PURE__ */ new WeakMap()), K(this, "shapeMeshesWithBuffers", /* @__PURE__ */ new Set()), K(this, "shapeMeshRefCounts", /* @__PURE__ */ new Map()), K(this, "entityRetainedShapeMeshes", /* @__PURE__ */ new WeakMap()), K(this, "clipTransformMat", new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), K(this, "shapeTransformMat", new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), K(this, "slotScissor", { x: 0, y: 0, w: 0, h: 0 }), K(this, "slotClipX0", 0), K(this, "slotClipY0", 0), K(this, "slotClipX1", 0), K(this, "slotClipY1", 0), K(this, "slotScissorActive", !1), K(this, "sharedClipStencilActive", !1), K(this, "layoutScratch", {
9220
+ )), p(this, "clipSpriteVertsScratch", null), p(this, "clipSpriteIndicesScratch", null), p(this, "clipMaskBatchTransformsScratch", new Float32Array(0)), p(this, "instancedQuadVB", null), p(this, "instancedQuadIB", null), p(this, "whiteTexture", null), p(this, "shapeMeshCache", /* @__PURE__ */ new WeakMap()), p(this, "shapeMeshesWithBuffers", /* @__PURE__ */ new Set()), p(this, "shapeMeshRefCounts", /* @__PURE__ */ new Map()), p(this, "entityRetainedShapeMeshes", /* @__PURE__ */ new WeakMap()), p(this, "clipTransformMat", new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), p(this, "shapeTransformMat", new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), p(this, "slotScissor", { x: 0, y: 0, w: 0, h: 0 }), p(this, "slotClipX0", 0), p(this, "slotClipY0", 0), p(this, "slotClipX1", 0), p(this, "slotClipY1", 0), p(this, "slotScissorActive", !1), p(this, "sharedClipStencilActive", !1), p(this, "layoutScratch", {
9224
9221
  scaleX: 1,
9225
9222
  scaleY: 1,
9226
9223
  width: 0,
9227
9224
  height: 0,
9228
9225
  offsetX: 0,
9229
9226
  offsetY: 0
9230
- }), K(this, "spriteWorkPool", []), K(this, "spriteWorkCursor", 0), K(this, "batchSpritesScratch", []), K(this, "drawGroupScratch", []), K(this, "directSlotsScratch", []), K(this, "hybridSlotsScratch", []), K(this, "timelineSlotStateUploadId", 0), K(this, "sharedSlotLayerWorkPool", []), K(this, "sharedSlotLayerWorksScratch", []), K(this, "clipLayerBatchPool", []), K(this, "clipLayerBatchesScratch", []), K(this, "entityHasShapesCache", /* @__PURE__ */ new WeakMap()), K(this, "entityFrameClipModeCache", /* @__PURE__ */ new WeakMap()), K(this, "gpuMotionEntityEligibilityCache", /* @__PURE__ */ new WeakMap()), K(this, "entityClipMeshArrayCache", /* @__PURE__ */ new WeakMap()), K(this, "affineScratch", { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 }), K(this, "plainInstancedTexturesScratch", []), K(this, "plainInstancedUniformsScratch", {
9227
+ }), p(this, "spriteWorkPool", []), p(this, "spriteWorkCursor", 0), p(this, "batchSpritesScratch", []), p(this, "drawGroupScratch", []), p(this, "directSlotsScratch", []), p(this, "hybridSlotsScratch", []), p(this, "timelineSlotStateUploadId", 0), p(this, "sharedSlotLayerWorkPool", []), p(this, "sharedSlotLayerWorksScratch", []), p(this, "clipLayerBatchPool", []), p(this, "clipLayerBatchesScratch", []), p(this, "entityHasShapesCache", /* @__PURE__ */ new WeakMap()), p(this, "entityFrameClipModeCache", /* @__PURE__ */ new WeakMap()), p(this, "gpuMotionEntityEligibilityCache", /* @__PURE__ */ new WeakMap()), p(this, "entityClipMeshArrayCache", /* @__PURE__ */ new WeakMap()), p(this, "affineScratch", { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 }), p(this, "plainInstancedTexturesScratch", []), p(this, "plainInstancedUniformsScratch", {
9231
9228
  u_projection: new Float32Array(16),
9232
9229
  u_atlas: 0
9233
- }), K(this, "plainInstancedDrawCommand", {
9230
+ }), p(this, "plainInstancedDrawCommand", {
9234
9231
  shader: "svga-instanced-premul",
9235
9232
  vertexBuffer: null,
9236
9233
  indexBuffer: null,
9237
9234
  indexCount: 6,
9238
9235
  textures: this.plainInstancedTexturesScratch,
9239
9236
  uniforms: this.plainInstancedUniformsScratch
9240
- }), K(this, "timelineTexturesScratch", []), K(this, "timelineUniformsScratch", {
9237
+ }), p(this, "timelineTexturesScratch", []), p(this, "timelineUniformsScratch", {
9241
9238
  u_projection: new Float32Array(16)
9242
- }), K(this, "timelineSlotStateScratch", new Float32Array(XB)), K(this, "timelineSlotStateCache", /* @__PURE__ */ new Map()), K(this, "timelineRenderableFrameCache", /* @__PURE__ */ new Map()), K(this, "timelineOriginScratch", { x: 0, y: 0 }), K(this, "timelineDrawCommand", {
9239
+ }), p(this, "timelineSlotStateScratch", new Float32Array(XB)), p(this, "timelineSlotStateCache", /* @__PURE__ */ new Map()), p(this, "timelineRenderableFrameCache", /* @__PURE__ */ new Map()), p(this, "timelineOriginScratch", { x: 0, y: 0 }), p(this, "timelineDrawCommand", {
9243
9240
  shader: "svga-frame-table-instanced-premul",
9244
9241
  vertexBuffer: null,
9245
9242
  indexBuffer: null,
@@ -9247,7 +9244,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9247
9244
  textures: this.timelineTexturesScratch,
9248
9245
  uniforms: this.timelineUniformsScratch,
9249
9246
  stencil: "none"
9250
- }), K(this, "timelineShapeDrawCommand", {
9247
+ }), p(this, "timelineShapeDrawCommand", {
9251
9248
  shader: "svga-frame-table-shape-premul",
9252
9249
  vertexBuffer: null,
9253
9250
  indexBuffer: null,
@@ -9255,7 +9252,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9255
9252
  textures: this.timelineTexturesScratch,
9256
9253
  uniforms: this.timelineUniformsScratch,
9257
9254
  stencil: "none"
9258
- }), K(this, "timelineClipDrawCommand", {
9255
+ }), p(this, "timelineClipDrawCommand", {
9259
9256
  shader: "svga-frame-table-clip-mask",
9260
9257
  vertexBuffer: null,
9261
9258
  indexBuffer: null,
@@ -9263,20 +9260,20 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9263
9260
  textures: this.timelineTexturesScratch,
9264
9261
  uniforms: this.timelineUniformsScratch,
9265
9262
  stencil: "write"
9266
- }), K(this, "plainBatchTexturesScratch", []), K(this, "plainBatchUniformsScratch", {
9263
+ }), p(this, "plainBatchTexturesScratch", []), p(this, "plainBatchUniformsScratch", {
9267
9264
  u_projection: new Float32Array(16),
9268
9265
  u_atlas: 0
9269
- }), K(this, "plainBatchDrawCommand", {
9266
+ }), p(this, "plainBatchDrawCommand", {
9270
9267
  shader: "svga-batch-premul",
9271
9268
  vertexBuffer: null,
9272
9269
  indexBuffer: null,
9273
9270
  indexCount: 0,
9274
9271
  textures: this.plainBatchTexturesScratch,
9275
9272
  uniforms: this.plainBatchUniformsScratch
9276
- }), K(this, "clipInstancedTexturesScratch", []), K(this, "clipInstancedUniformsScratch", {
9273
+ }), p(this, "clipInstancedTexturesScratch", []), p(this, "clipInstancedUniformsScratch", {
9277
9274
  u_projection: new Float32Array(16),
9278
9275
  u_atlas: 0
9279
- }), K(this, "clipInstancedDrawCommand", {
9276
+ }), p(this, "clipInstancedDrawCommand", {
9280
9277
  shader: "svga-instanced-premul",
9281
9278
  vertexBuffer: null,
9282
9279
  indexBuffer: null,
@@ -9285,10 +9282,10 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9285
9282
  textures: this.clipInstancedTexturesScratch,
9286
9283
  uniforms: this.clipInstancedUniformsScratch,
9287
9284
  stencil: "test"
9288
- }), K(this, "clipBatchTexturesScratch", []), K(this, "clipBatchUniformsScratch", {
9285
+ }), p(this, "clipBatchTexturesScratch", []), p(this, "clipBatchUniformsScratch", {
9289
9286
  u_projection: new Float32Array(16),
9290
9287
  u_atlas: 0
9291
- }), K(this, "clipBatchDrawCommand", {
9288
+ }), p(this, "clipBatchDrawCommand", {
9292
9289
  shader: "svga-batch-premul",
9293
9290
  vertexBuffer: null,
9294
9291
  indexBuffer: null,
@@ -9296,19 +9293,19 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9296
9293
  textures: this.clipBatchTexturesScratch,
9297
9294
  uniforms: this.clipBatchUniformsScratch,
9298
9295
  stencil: "test"
9299
- }), K(this, "clipMaskTexturesScratch", []), K(this, "clipMaskUniformsScratch", {
9296
+ }), p(this, "clipMaskTexturesScratch", []), p(this, "clipMaskUniformsScratch", {
9300
9297
  u_projection: new Float32Array(16),
9301
9298
  u_transform: this.clipTransformMat
9302
- }), K(this, "clipMaskDrawCommand", {
9299
+ }), p(this, "clipMaskDrawCommand", {
9303
9300
  shader: "clip-mask",
9304
9301
  vertexBuffer: null,
9305
9302
  indexBuffer: null,
9306
9303
  indexCount: 0,
9307
9304
  textures: this.clipMaskTexturesScratch,
9308
9305
  uniforms: this.clipMaskUniformsScratch
9309
- }), K(this, "clipMaskInstancedUniformsScratch", {
9306
+ }), p(this, "clipMaskInstancedUniformsScratch", {
9310
9307
  u_projection: new Float32Array(16)
9311
- }), K(this, "clipMaskInstancedDrawCommand", {
9308
+ }), p(this, "clipMaskInstancedDrawCommand", {
9312
9309
  shader: "clip-mask-instanced",
9313
9310
  vertexBuffer: null,
9314
9311
  indexBuffer: null,
@@ -9317,11 +9314,11 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9317
9314
  instanceData: this.clipMaskBatchTransformsScratch,
9318
9315
  textures: this.clipMaskTexturesScratch,
9319
9316
  uniforms: this.clipMaskInstancedUniformsScratch
9320
- }), K(this, "shapeTexturesScratch", []), K(this, "shapeUniformsScratch", {
9317
+ }), p(this, "shapeTexturesScratch", []), p(this, "shapeUniformsScratch", {
9321
9318
  u_projection: new Float32Array(16),
9322
9319
  u_transform: new Float32Array(16),
9323
9320
  u_opacity: 1
9324
- }), K(this, "shapeDrawCommand", {
9321
+ }), p(this, "shapeDrawCommand", {
9325
9322
  shader: "svga-batch-premul",
9326
9323
  vertexBuffer: null,
9327
9324
  indexBuffer: null,
@@ -9357,7 +9354,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9357
9354
  }
9358
9355
  endFrame() {
9359
9356
  if (this.assertRendererAlive(), this.stencilTransactionState !== "idle")
9360
- throw new jg(
9357
+ throw new Pg(
9361
9358
  `SVGA stencil transaction ended in ${this.stencilTransactionState}`
9362
9359
  );
9363
9360
  }
@@ -9423,15 +9420,15 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9423
9420
  let Q = this.stencilTransactionState;
9424
9421
  if (B === "write") {
9425
9422
  if (this.stencilTransactionState === "content-tested")
9426
- throw new jg("stencil write attempted after content test without clear");
9423
+ throw new Pg("stencil write attempted after content test without clear");
9427
9424
  Q = "mask-written";
9428
9425
  } else if (B === "test") {
9429
9426
  if (this.stencilTransactionState === "idle")
9430
- throw new jg("stencil test attempted without a mask");
9427
+ throw new Pg("stencil test attempted without a mask");
9431
9428
  Q = "content-tested";
9432
9429
  } else if (B === "clear") {
9433
9430
  if (this.stencilTransactionState === "idle")
9434
- throw new jg("stencil clear attempted without a mask");
9431
+ throw new Pg("stencil clear attempted without a mask");
9435
9432
  Q = "idle";
9436
9433
  }
9437
9434
  try {
@@ -9447,7 +9444,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9447
9444
  throw new Hg();
9448
9445
  return !1;
9449
9446
  } catch (E) {
9450
- if (E instanceof jg || E instanceof Hg) throw E;
9447
+ if (E instanceof Pg || E instanceof Hg) throw E;
9451
9448
  const e = E instanceof Error ? E.message : String(E);
9452
9449
  if (!this.emitRuntimeDiagnostic({
9453
9450
  type: B === "none" ? "backend-operation-rejected" : "stencil-transaction-failure",
@@ -9525,7 +9522,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9525
9522
  const S = g[D + G], M = this.resolveRenderableFrame(S, o);
9526
9523
  if (M == null) break;
9527
9524
  const N = this.resolveTimelineSlotState(S, M, c.spriteBase), U = G * iI;
9528
- R.set(N.subarray(0, XB), U), R[U + Ug.atlasPage] = c.textureIndex, R[U + Ug.motionTrackPlusOne] = ((t = (i = S.motionTrackBinding) == null ? void 0 : i.trackIndex) != null ? t : -1) + 1, S.svgaFrameTableState.frameIndex = M, S.svgaDrawBatchMode = "multi-slot", S.svgaDrawCompatibleInstanceCount = y, F++;
9525
+ R.set(N.subarray(0, XB), U), R[U + kg.atlasPage] = c.textureIndex, R[U + kg.motionTrackPlusOne] = ((t = (i = S.motionTrackBinding) == null ? void 0 : i.trackIndex) != null ? t : -1) + 1, S.svgaFrameTableState.frameIndex = M, S.svgaDrawBatchMode = "multi-slot", S.svgaDrawCompatibleInstanceCount = y, F++;
9529
9526
  }
9530
9527
  if (F !== y) {
9531
9528
  for (let G = 0; G < y; G++) {
@@ -9587,6 +9584,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9587
9584
  }
9588
9585
  isFrameClipReady(A, g) {
9589
9586
  var I, B, Q, E;
9587
+ this.retainClipPreparation(A);
9590
9588
  const e = A.spriteTable;
9591
9589
  if (g < 0 || g >= e.frameCount) return !1;
9592
9590
  const i = A.svgaHybridCommandTable;
@@ -9602,12 +9600,12 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9602
9600
  }
9603
9601
  let t = !0;
9604
9602
  for (let a = 0; a < e.spriteCount; a++) {
9605
- const o = (a * e.frameCount + g) * AI;
9603
+ const o = (a * e.frameCount + g) * $g;
9606
9604
  if (e.frameData[o + 8] < 0.05) continue;
9607
9605
  const s = (E = e.clipPathIndex[a * e.frameCount + g]) != null ? E : -1;
9608
9606
  if (s < 0) continue;
9609
9607
  const n = e.clipPaths[s];
9610
- if (!n || this.getClipGeometryKind(n) === "empty") continue;
9608
+ if (!n || (this.clipAnalysis.retain(e, n), this.getClipGeometryKind(n) === "empty")) continue;
9611
9609
  const r = this.clipMeshStates.get(n);
9612
9610
  if (!((r == null ? void 0 : r.status) === "valid" || (r == null ? void 0 : r.status) === "empty")) {
9613
9611
  if ((r == null ? void 0 : r.status) === "invalid") {
@@ -9628,7 +9626,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9628
9626
  if (Q !== 255) return Q;
9629
9627
  let E = 0, e = !1;
9630
9628
  for (let i = 0; i < I.spriteCount; i++) {
9631
- const t = (i * I.frameCount + g) * AI;
9629
+ const t = (i * I.frameCount + g) * $g;
9632
9630
  if (I.frameData[t + 8] < 0.05) continue;
9633
9631
  const a = this.getClipMeshForSprite(A, i, g);
9634
9632
  if (a === void 0) {
@@ -9650,12 +9648,37 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9650
9648
  return e || (B[g] = E), E;
9651
9649
  }
9652
9650
  async prewarmClipMeshes(A, g = {}) {
9653
- const I = await Ig(this.collectClipPathsSteps(A.spriteTable), g, "clip-prepare");
9654
- return I.length === 0 ? 0 : this.buildMissingClipMeshes(I, g);
9651
+ return this.prewarmEntityClipMeshes(A, void 0, g);
9655
9652
  }
9656
9653
  async prewarmClipMeshesForFrame(A, g, I = {}) {
9657
- const B = await Ig(this.collectClipPathsSteps(A.spriteTable, g), I, "clip-prepare");
9658
- return B.length === 0 ? 0 : this.buildMissingClipMeshes(B, I);
9654
+ return this.prewarmEntityClipMeshes(A, g, I);
9655
+ }
9656
+ retainClipPreparation(A) {
9657
+ var g;
9658
+ if (this.clipMeshDestroyed) throw CA("SVGA renderer destroyed during clip prewarm");
9659
+ let I = this.clipPreparationOwners.get(A);
9660
+ if (!I) {
9661
+ I = new AbortController(), this.clipPreparationOwners.set(A, I), this.liveClipPreparationControllers.add(I);
9662
+ const B = A.spriteTable;
9663
+ this.clipTableOwnerCounts.set(B, ((g = this.clipTableOwnerCounts.get(B)) != null ? g : 0) + 1);
9664
+ }
9665
+ return J(I.signal, "SVGA clip resource released"), I;
9666
+ }
9667
+ async prewarmEntityClipMeshes(A, g, I) {
9668
+ var B, Q;
9669
+ J(I.signal, "SVGA clip prewarm aborted"), (B = I.checkActive) == null || B.call(I);
9670
+ const E = this.retainClipPreparation(A), e = I.signal ? new AbortController() : null, i = () => e.abort();
9671
+ e && (E.signal.addEventListener("abort", i, { once: !0 }), I.signal.addEventListener("abort", i, { once: !0 }));
9672
+ const t = (Q = e == null ? void 0 : e.signal) != null ? Q : E.signal, a = { ...I, signal: t, checkActive: () => {
9673
+ var o;
9674
+ J(t, "SVGA clip prewarm aborted"), (o = I.checkActive) == null || o.call(I), J(t, "SVGA clip prewarm aborted");
9675
+ } };
9676
+ try {
9677
+ const o = await tg(this.collectClipPathsSteps(A.spriteTable, g), a, "clip-prepare");
9678
+ return o.length === 0 ? 0 : await this.buildMissingClipMeshes(o, a);
9679
+ } finally {
9680
+ e && (E.signal.removeEventListener("abort", i), I.signal.removeEventListener("abort", i));
9681
+ }
9659
9682
  }
9660
9683
  /**
9661
9684
  * Precompiles every immutable Shape group and uploads its static mesh once.
@@ -9750,16 +9773,26 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9750
9773
  }
9751
9774
  }
9752
9775
  releaseClipPreparation(A) {
9753
- for (const g of this.clipAnalysis.release(A.spriteTable)) {
9754
- this.pendingClipMeshPaths.delete(g), this.clipMeshStates.delete(g), this.clipMeshCache.delete(g);
9755
- const I = this.clipMeshStateWaiters.get(g);
9756
- this.clipMeshStateWaiters.delete(g);
9757
- for (const B of I != null ? I : [])
9758
- B.signal && B.onAbort && B.signal.removeEventListener("abort", B.onAbort), B.reject(QA("SVGA clip resource released"));
9776
+ var g;
9777
+ let I = this.clipPreparationOwners.get(A);
9778
+ if (I != null && I.signal.aborted) return;
9779
+ const B = !!I;
9780
+ I || (I = new AbortController(), this.clipPreparationOwners.set(A, I)), I.abort(), this.liveClipPreparationControllers.delete(I), this.entityClipMeshArrayCache.delete(A), this.entityFrameClipModeCache.delete(A);
9781
+ const Q = ((g = this.clipTableOwnerCounts.get(A.spriteTable)) != null ? g : 0) - Number(B);
9782
+ if (Q > 0) {
9783
+ this.clipTableOwnerCounts.set(A.spriteTable, Q);
9784
+ return;
9785
+ }
9786
+ this.clipTableOwnerCounts.delete(A.spriteTable);
9787
+ for (const E of this.clipAnalysis.release(A.spriteTable)) {
9788
+ this.pendingClipMeshPaths.delete(E), this.clipMeshStates.delete(E), this.clipMeshCache.delete(E);
9789
+ const e = this.clipMeshStateWaiters.get(E);
9790
+ this.clipMeshStateWaiters.delete(E);
9791
+ for (const i of e != null ? e : [])
9792
+ i.signal && i.onAbort && i.signal.removeEventListener("abort", i.onAbort), i.reject(CA("SVGA clip resource released"));
9759
9793
  }
9760
- for (const [g, I] of this.clipResourceProducers)
9761
- I.every((B) => !this.clipMeshStates.has(B)) && g.abort();
9762
- this.entityClipMeshArrayCache.delete(A);
9794
+ for (const [E, e] of this.clipResourceProducers)
9795
+ e.every((i) => !this.clipMeshStates.has(i)) && E.abort();
9763
9796
  }
9764
9797
  *collectClipPathsSteps(A, g) {
9765
9798
  var I;
@@ -9768,7 +9801,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9768
9801
  for (let E = 0; E < Q; E++) {
9769
9802
  (E & 127) === 0 && (yield);
9770
9803
  const e = g == null ? -1 : E * A.frameCount + g;
9771
- if (e >= 0 && A.frameData[e * AI + 8] < 0.05) continue;
9804
+ if (e >= 0 && A.frameData[e * $g + 8] < 0.05) continue;
9772
9805
  const i = e < 0 ? E : (I = A.clipPathIndex[e]) != null ? I : -1, t = A.clipPaths[i];
9773
9806
  t && (this.clipAnalysis.retain(A, t), B.add(t));
9774
9807
  }
@@ -9780,8 +9813,8 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9780
9813
  */
9781
9814
  async buildMissingClipMeshes(A, g = {}) {
9782
9815
  var I, B;
9783
- if (L(g.signal, "SVGA clip prewarm aborted"), (I = g.checkActive) == null || I.call(g), this.clipMeshDestroyed)
9784
- throw QA("SVGA renderer destroyed during clip prewarm");
9816
+ if (J(g.signal, "SVGA clip prewarm aborted"), (I = g.checkActive) == null || I.call(g), this.clipMeshDestroyed)
9817
+ throw CA("SVGA renderer destroyed during clip prewarm");
9785
9818
  const Q = A.find((e) => {
9786
9819
  var i;
9787
9820
  return ((i = this.clipMeshStates.get(e)) == null ? void 0 : i.status) === "invalid";
@@ -9798,7 +9831,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9798
9831
  workerTimeSliceMs: g.workerTimeSliceMs,
9799
9832
  useWorker: g.useWorker,
9800
9833
  profile: g.profile
9801
- }), await this.waitForClipMeshPaths(A, g.signal), L(g.signal, "SVGA clip prewarm aborted"), (B = g.checkActive) == null || B.call(g), A.reduce((e, i) => {
9834
+ }), await this.waitForClipMeshPaths(A, g.signal), J(g.signal, "SVGA clip prewarm aborted"), (B = g.checkActive) == null || B.call(g), A.reduce((e, i) => {
9802
9835
  var t;
9803
9836
  return e + +(((t = this.clipMeshStates.get(i)) == null ? void 0 : t.status) === "valid");
9804
9837
  }, 0);
@@ -9823,7 +9856,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9823
9856
  E,
9824
9857
  B.signal
9825
9858
  ).catch((i) => {
9826
- this.clipMeshDestroyed && Kg(i) || this.failClipMeshProducer(A, I, i, E);
9859
+ this.clipMeshDestroyed && Mg(i) || this.failClipMeshProducer(A, I, i, E);
9827
9860
  }).finally(() => {
9828
9861
  this.clipMeshProducerTasks.delete(e), this.clipResourceProducers.delete(B), this.clipMeshProducerController.signal.removeEventListener("abort", Q);
9829
9862
  });
@@ -9839,7 +9872,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9839
9872
  /** Worker-first shared production with exactly one main-thread fallback. */
9840
9873
  async runClipMeshProducer(A, g, I, B, Q) {
9841
9874
  var E, e, i, t;
9842
- if (L(Q, "SVGA clip producer aborted"), I.useWorker !== !1 && yE())
9875
+ if (J(Q, "SVGA clip producer aborted"), I.useWorker !== !1 && yE())
9843
9876
  try {
9844
9877
  const n = await Jt(A, {
9845
9878
  workerTimeSliceMs: I.workerTimeSliceMs,
@@ -9851,7 +9884,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9851
9884
  !Q.aborted && ((l = this.clipMeshStates.get(c)) == null ? void 0 : l.generation) === g && this.clipAnalysis.set(c, h);
9852
9885
  }
9853
9886
  });
9854
- L(Q, "SVGA clip producer aborted");
9887
+ J(Q, "SVGA clip producer aborted");
9855
9888
  const r = function* () {
9856
9889
  for (const c of A) {
9857
9890
  yield;
@@ -9873,11 +9906,11 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9873
9906
  });
9874
9907
  }
9875
9908
  }.call(this);
9876
- await Ig(r, { ...I, signal: Q }, "validation");
9909
+ await tg(r, { ...I, signal: Q }, "validation");
9877
9910
  return;
9878
9911
  } catch (n) {
9879
9912
  if (Q.aborted)
9880
- throw Kg(n) ? n : QA("SVGA clip producer aborted");
9913
+ throw Mg(n) ? n : CA("SVGA clip producer aborted");
9881
9914
  B.push({
9882
9915
  type: "clip-protocol-error",
9883
9916
  message: n instanceof Error ? n.message : String(n)
@@ -9888,20 +9921,20 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9888
9921
  });
9889
9922
  let o = 0, s = null;
9890
9923
  for (const n of A) {
9891
- L(Q, "SVGA clip producer aborted");
9924
+ J(Q, "SVGA clip producer aborted");
9892
9925
  const r = this.clipMeshStates.get(n);
9893
9926
  if (!((r == null ? void 0 : r.status) !== "building" || r.generation !== g)) {
9894
9927
  try {
9895
- const c = { signal: Q, profile: I.profile, frameBudgetMs: I.frameBudgetMs, checkActive: () => L(Q) }, h = await Ig(yC(n), c, "clip-prepare"), l = await Ig(_Q(h, !n.trim()), c, "clip-prepare");
9928
+ const c = { signal: Q, profile: I.profile, frameBudgetMs: I.frameBudgetMs, checkActive: () => J(Q) }, h = await tg(yC(n), c, "clip-prepare"), l = await tg(_Q(h, !n.trim()), c, "clip-prepare");
9896
9929
  if (((e = this.clipMeshStates.get(n)) == null ? void 0 : e.generation) !== g) continue;
9897
9930
  if (this.clipAnalysis.set(n, l), l.kind === "empty") {
9898
9931
  this.publishClipMeshState(n, { status: "empty", generation: g, attempts: r.attempts + 1 });
9899
9932
  continue;
9900
9933
  }
9901
- const w = I.profile ? I.profile.measure("clip-prepare", () => mC(h)) : mC(h), D = w ? await Ig(FB(w), c, "validation") : "triangulation produced no mesh";
9934
+ const w = I.profile ? I.profile.measure("clip-prepare", () => mC(h)) : mC(h), D = w ? await tg(FB(w), c, "validation") : "triangulation produced no mesh";
9902
9935
  if (!w || D)
9903
9936
  throw new Error(D || "triangulation produced no mesh");
9904
- if (L(Q), ((i = this.clipMeshStates.get(n)) == null ? void 0 : i.generation) !== g) continue;
9937
+ if (J(Q), ((i = this.clipMeshStates.get(n)) == null ? void 0 : i.generation) !== g) continue;
9905
9938
  this.publishClipMeshState(n, {
9906
9939
  status: "valid",
9907
9940
  mesh: w,
@@ -9909,7 +9942,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9909
9942
  attempts: r.attempts + 1
9910
9943
  });
9911
9944
  } catch (c) {
9912
- if (Q.aborted) throw QA("SVGA clip producer aborted");
9945
+ if (Q.aborted) throw CA("SVGA clip producer aborted");
9913
9946
  if (((t = this.clipMeshStates.get(n)) == null ? void 0 : t.generation) !== g) continue;
9914
9947
  const h = c instanceof Error ? c.message : String(c);
9915
9948
  this.publishClipMeshState(n, {
@@ -9922,7 +9955,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9922
9955
  message: `${n}: ${h}`
9923
9956
  }), s != null || (s = new Error(`SVGA clip mesh invalid for ${n}: ${h}`));
9924
9957
  }
9925
- o++, o < A.length && a.shouldYield() && (await a.yield(), L(Q, "SVGA clip producer aborted"));
9958
+ o++, o < A.length && a.shouldYield() && (await a.yield(), J(Q, "SVGA clip producer aborted"));
9926
9959
  }
9927
9960
  }
9928
9961
  if (this.emitClipProducerDiagnosticsAfterTerminal(
@@ -9976,13 +10009,13 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
9976
10009
  }
9977
10010
  waitForClipMeshPath(A, g) {
9978
10011
  if (this.clipMeshDestroyed)
9979
- return Promise.reject(QA("SVGA renderer destroyed during clip prewarm"));
10012
+ return Promise.reject(CA("SVGA renderer destroyed during clip prewarm"));
9980
10013
  const I = this.clipMeshStates.get(A);
9981
- return (I == null ? void 0 : I.status) === "valid" || (I == null ? void 0 : I.status) === "empty" ? Promise.resolve() : (I == null ? void 0 : I.status) === "invalid" ? Promise.reject(new Error(`SVGA clip mesh invalid for ${A}: ${I.reason}`)) : g != null && g.aborted ? Promise.reject(QA("SVGA clip prewarm aborted")) : new Promise((B, Q) => {
10014
+ return (I == null ? void 0 : I.status) === "valid" || (I == null ? void 0 : I.status) === "empty" ? Promise.resolve() : (I == null ? void 0 : I.status) === "invalid" ? Promise.reject(new Error(`SVGA clip mesh invalid for ${A}: ${I.reason}`)) : g != null && g.aborted ? Promise.reject(CA("SVGA clip prewarm aborted")) : new Promise((B, Q) => {
9982
10015
  const E = { resolve: B, reject: Q, signal: g };
9983
10016
  let e = this.clipMeshStateWaiters.get(A);
9984
10017
  e || (e = /* @__PURE__ */ new Set(), this.clipMeshStateWaiters.set(A, e)), E.onAbort = () => {
9985
- e.delete(E), e.size === 0 && this.clipMeshStateWaiters.delete(A), Q(QA("SVGA clip prewarm aborted"));
10018
+ e.delete(E), e.size === 0 && this.clipMeshStateWaiters.delete(A), Q(CA("SVGA clip prewarm aborted"));
9986
10019
  }, e.add(E), g == null || g.addEventListener("abort", E.onAbort, { once: !0 });
9987
10020
  });
9988
10021
  }
@@ -10024,7 +10057,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10024
10057
  try {
10025
10058
  await this.buildMissingClipMeshes(A);
10026
10059
  } catch (g) {
10027
- console.warn("[GiftStage:SVGA] deferred clip mesh build failed", g);
10060
+ Mg(g) || console.warn("[GiftStage:SVGA] deferred clip mesh build failed", g);
10028
10061
  } finally {
10029
10062
  if (this.clipMeshBuildInFlight = !1, this.clipMeshDestroyed) {
10030
10063
  this.pendingClipMeshPaths.clear();
@@ -10036,11 +10069,11 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10036
10069
  async hydrateClipMeshesCooperative(A, g = {}) {
10037
10070
  const I = function* () {
10038
10071
  for (const [B, Q] of A != null ? A : []) {
10039
- if (yield, this.clipMeshDestroyed) throw QA("SVGA renderer destroyed");
10072
+ if (yield, this.clipMeshDestroyed) throw CA("SVGA renderer destroyed");
10040
10073
  !Q || this.clipMeshStates.has(B) || (yield* FB(Q)) == null && (this.clipMeshStates.has(B) || this.publishClipMeshState(B, { status: "valid", mesh: Q, generation: ++this.clipMeshGeneration, attempts: 1 }));
10041
10074
  }
10042
10075
  }.call(this);
10043
- await Ig(I, g, "validation");
10076
+ await tg(I, g, "validation");
10044
10077
  }
10045
10078
  hydrateClipMeshes(A) {
10046
10079
  if (!(!A || A.size === 0))
@@ -10087,8 +10120,8 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10087
10120
  }
10088
10121
  const l = XA(A), w = A.width * rg(A), D = A.height * cg(A), y = l === "cover" ? w : Math.min(h.width, w), R = l === "cover" ? D : Math.min(h.height, D), F = l === "cover" ? A.x : A.x + h.offsetX, d = l === "cover" ? A.y : A.y + h.offsetY;
10089
10122
  Sg(A, F, d, y, R, this.slotScissor);
10090
- const f = (t = A.rotation) != null ? t : 0, u = Math.cos(f), G = Math.sin(f), S = pB(A, this.timelineOriginScratch), M = A.x + h.offsetX, N = A.y + h.offsetY, U = M - S.x, p = N - S.y, k = this.timelineSlotStateScratch;
10091
- return k[0] = u * h.scaleX, k[1] = G * h.scaleX, k[2] = -G * h.scaleY, k[3] = u * h.scaleY, k[4] = S.x + u * U - G * p, k[5] = S.y + G * U + u * p, k[6] = A.opacity, k[7] = g, k[8] = (a = B == null ? void 0 : B.x0) != null ? a : Math.floor(this.slotScissor.x), k[9] = (o = B == null ? void 0 : B.y0) != null ? o : Math.floor(this.slotScissor.y), k[10] = (s = B == null ? void 0 : B.x1) != null ? s : Math.ceil(this.slotScissor.x + this.slotScissor.w), k[11] = (n = B == null ? void 0 : B.y1) != null ? n : Math.ceil(this.slotScissor.y + this.slotScissor.h), k[12] = 1, k[13] = I, k;
10123
+ const f = (t = A.rotation) != null ? t : 0, u = Math.cos(f), G = Math.sin(f), S = pB(A, this.timelineOriginScratch), M = A.x + h.offsetX, N = A.y + h.offsetY, U = M - S.x, K = N - S.y, k = this.timelineSlotStateScratch;
10124
+ return k[0] = u * h.scaleX, k[1] = G * h.scaleX, k[2] = -G * h.scaleY, k[3] = u * h.scaleY, k[4] = S.x + u * U - G * K, k[5] = S.y + G * U + u * K, k[6] = A.opacity, k[7] = g, k[8] = (a = B == null ? void 0 : B.x0) != null ? a : Math.floor(this.slotScissor.x), k[9] = (o = B == null ? void 0 : B.y0) != null ? o : Math.floor(this.slotScissor.y), k[10] = (s = B == null ? void 0 : B.x1) != null ? s : Math.ceil(this.slotScissor.x + this.slotScissor.w), k[11] = (n = B == null ? void 0 : B.y1) != null ? n : Math.ceil(this.slotScissor.y + this.slotScissor.h), k[12] = 1, k[13] = I, k;
10092
10125
  }
10093
10126
  resolveCachedTimelineSlotState(A, g) {
10094
10127
  const I = this.timelineSlotStateCache.get(A);
@@ -10147,6 +10180,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10147
10180
  }
10148
10181
  getClipMeshByIndex(A, g) {
10149
10182
  if (g < 0) return null;
10183
+ this.retainClipPreparation(A);
10150
10184
  const I = A.spriteTable;
10151
10185
  let B = this.entityClipMeshArrayCache.get(A);
10152
10186
  (!B || B.length !== I.clipPaths.length) && (B = new Array(I.clipPaths.length), this.entityClipMeshArrayCache.set(A, B));
@@ -10154,7 +10188,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10154
10188
  if (Q !== void 0) return Q;
10155
10189
  const E = I.clipPaths[g];
10156
10190
  if (!E) return null;
10157
- if (this.getClipGeometryKind(E) === "empty")
10191
+ if (this.clipAnalysis.retain(I, E), this.getClipGeometryKind(E) === "empty")
10158
10192
  return this.clipMeshStates.has(E) || this.publishClipMeshState(E, {
10159
10193
  status: "empty",
10160
10194
  generation: ++this.clipMeshGeneration,
@@ -10215,7 +10249,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10215
10249
  const a = this.timelineBatchDataScratch;
10216
10250
  for (let s = 0; s < g.length; s++) {
10217
10251
  const n = g[s], r = this.timelineBatchFrameScratch[s], c = this.resolveTimelineSlotState(n, r, 0), h = s * iI;
10218
- a.set(c.subarray(0, XB), h), a[h + Ug.atlasPage] = -1, a[h + Ug.motionTrackPlusOne] = ((E = (Q = n.motionTrackBinding) == null ? void 0 : Q.trackIndex) != null ? E : -1) + 1, n.svgaFrameTableState.frameIndex = r, n.svgaDrawBatchMode = "hybrid-scheduled", n.svgaDrawCompatibleInstanceCount = g.length;
10252
+ a.set(c.subarray(0, XB), h), a[h + kg.atlasPage] = -1, a[h + kg.motionTrackPlusOne] = ((E = (Q = n.motionTrackBinding) == null ? void 0 : Q.trackIndex) != null ? E : -1) + 1, n.svgaFrameTableState.frameIndex = r, n.svgaDrawBatchMode = "hybrid-scheduled", n.svgaDrawCompatibleInstanceCount = g.length;
10219
10253
  }
10220
10254
  const o = {
10221
10255
  states: a,
@@ -10288,14 +10322,14 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10288
10322
  if (!R || !F) return !1;
10289
10323
  const d = (E = F.runFrameOffsets[I]) != null ? E : 0, f = (e = F.runFrameOffsets[I + 1]) != null ? e : d, u = (i = R.atlasTextureHandles) != null && i.length ? R.atlasTextureHandles : R.atlasTextureHandle ? [R.atlasTextureHandle] : [];
10290
10324
  for (let N = d; N < f; N++) {
10291
- const U = (t = F.runOperationStarts[N]) != null ? t : 0, p = F.runTypes[N], k = U * 3;
10292
- if (p === EI || p === LB) {
10325
+ const U = (t = F.runOperationStarts[N]) != null ? t : 0, K = F.runTypes[N], k = U * 3;
10326
+ if (K === EI || K === LB) {
10293
10327
  const m = (a = F.meshReferences[k + 1]) != null ? a : -1, H = this.getClipMeshByIndex(R, m);
10294
10328
  if (!H || H.indices.length < 3) return !1;
10295
- } else if (p === JB) {
10329
+ } else if (K === JB) {
10296
10330
  const m = (o = F.meshReferences[k]) != null ? o : -1, H = R.spriteTable.shapesTable[m], v = H ? this.getShapeMesh(H) : null;
10297
10331
  if (!v || v.indices.length < 3) return !1;
10298
- } else if (p === bC || p === qC) {
10332
+ } else if (K === bC || K === qC) {
10299
10333
  const m = (s = F.meshReferences[k + 2]) != null ? s : -1;
10300
10334
  if (m < 0 || !u[m]) return !1;
10301
10335
  }
@@ -10305,8 +10339,8 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10305
10339
  try {
10306
10340
  Q || (g.svgaDrawBatchMode = "hybrid-scheduled", g.svgaDrawCompatibleInstanceCount = 1);
10307
10341
  for (let N = d; N < f; N++) {
10308
- const U = (r = F.runOperationStarts[N]) != null ? r : 0, p = F.runTypes[N], k = (c = F.runOperationCounts[N]) != null ? c : 1, m = (h = F.spriteIndices[U]) != null ? h : 0, H = U * 3, v = (l = F.meshReferences[H]) != null ? l : -1, j = (w = F.meshReferences[H + 1]) != null ? w : -1, T = (D = F.meshReferences[H + 2]) != null ? D : 0;
10309
- if (p === bC) {
10342
+ const U = (r = F.runOperationStarts[N]) != null ? r : 0, K = F.runTypes[N], k = (c = F.runOperationCounts[N]) != null ? c : 1, m = (h = F.spriteIndices[U]) != null ? h : 0, H = U * 3, v = (l = F.meshReferences[H]) != null ? l : -1, j = (w = F.meshReferences[H + 1]) != null ? w : -1, T = (D = F.meshReferences[H + 2]) != null ? D : 0;
10343
+ if (K === bC) {
10310
10344
  const b = u[T], X = Math.max(
10311
10345
  1,
10312
10346
  Math.floor(zA / ((y = Q == null ? void 0 : Q.slotCount) != null ? y : 1))
@@ -10328,7 +10362,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10328
10362
  }
10329
10363
  continue;
10330
10364
  }
10331
- if (p === qC) {
10365
+ if (K === qC) {
10332
10366
  const b = u[T];
10333
10367
  if (Q && (Q.spritesPerSlot = 1), !b || !this.drawTimelineRange(
10334
10368
  A,
@@ -10342,7 +10376,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10342
10376
  void 0,
10343
10377
  Q
10344
10378
  )) return !1;
10345
- } else if (p === JB) {
10379
+ } else if (K === JB) {
10346
10380
  const b = R.spriteTable.shapesTable[v], X = b ? this.getShapeMesh(b) : null;
10347
10381
  if (!X || X.indices.length === 0) return !1;
10348
10382
  const Z = this.ensureShapeMeshBuffers(A, X);
@@ -10359,7 +10393,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10359
10393
  B,
10360
10394
  Q
10361
10395
  )) return !1;
10362
- } else if (p === EI || p === LB) {
10396
+ } else if (K === EI || K === LB) {
10363
10397
  const b = this.getClipMeshByIndex(R, j);
10364
10398
  if (!b || b.indices.length === 0) return !1;
10365
10399
  const X = this.ensureClipMeshBuffers(A, b);
@@ -10372,7 +10406,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10372
10406
  X.indexBuf,
10373
10407
  b.indices.length,
10374
10408
  "svga-frame-table-clip-mask",
10375
- p === EI ? "write" : "clear",
10409
+ K === EI ? "write" : "clear",
10376
10410
  B,
10377
10411
  Q
10378
10412
  )) return !1;
@@ -10397,8 +10431,8 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10397
10431
  for (const h of g) {
10398
10432
  const l = h.videoEntity, w = this.resolveRenderableFrame(h, l);
10399
10433
  if (w == null) continue;
10400
- const D = l.params.viewBoxWidth, y = l.params.viewBoxHeight, R = XA(h), F = this.canUseGpuMotion(h), d = wg(h, D, y, this.layoutScratch, F), f = d.scaleX, u = d.scaleY, G = h.width * rg(h), S = h.height * cg(h), M = R === "cover" ? G : Math.min(d.width, G), N = R === "cover" ? S : Math.min(d.height, S), U = R === "cover" ? h.x : h.x + d.offsetX, p = R === "cover" ? h.y : h.y + d.offsetY;
10401
- Sg(h, U, p, M, N, this.slotScissor), this.updateSlotClipBounds();
10434
+ const D = l.params.viewBoxWidth, y = l.params.viewBoxHeight, R = XA(h), F = this.canUseGpuMotion(h), d = wg(h, D, y, this.layoutScratch, F), f = d.scaleX, u = d.scaleY, G = h.width * rg(h), S = h.height * cg(h), M = R === "cover" ? G : Math.min(d.width, G), N = R === "cover" ? S : Math.min(d.height, S), U = R === "cover" ? h.x : h.x + d.offsetX, K = R === "cover" ? h.y : h.y + d.offsetY;
10435
+ Sg(h, U, K, M, N, this.slotScissor), this.updateSlotClipBounds();
10402
10436
  const k = (A.type === "webgl2" || A.type === "webgpu") && !l.spriteTable.hasAnyShapes && !((I = h.svgaSlotTextures) != null && I.size), m = !k && R !== "cover" && !h.rotation && !((B = h.svgaSlotTextures) != null && B.size) && l.spriteTable.allFramesInsideViewBox === !0;
10403
10437
  if (k || m)
10404
10438
  this.slotScissorActive && (r.length > 0 && (this.drawBatch(A, r, c, n), r.length = 0, c = null), A.resetScissor(), this.slotScissorActive = !1);
@@ -10433,7 +10467,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10433
10467
  }
10434
10468
  let T = j ? [] : null;
10435
10469
  for (let b = 0; b < l.spriteTable.spriteCount; b++) {
10436
- const X = l.spriteTable, Z = (b * X.frameCount + w) * AI;
10470
+ const X = l.spriteTable, Z = (b * X.frameCount + w) * $g;
10437
10471
  if (X.frameData[Z + 8] * h.opacity < 0.05) continue;
10438
10472
  const EA = (i = X.clipPathIndex[b * X.frameCount + w]) != null ? i : -1, UA = EA >= 0 ? X.clipPaths[EA] : void 0;
10439
10473
  if (UA && this.getClipGeometryKind(UA) === "empty") continue;
@@ -10446,8 +10480,8 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10446
10480
  u,
10447
10481
  d.offsetX,
10448
10482
  d.offsetY
10449
- ), Bg = (t = X.imageKeys[b]) != null ? t : "", CA = this.resolveSpriteTextureInto(h, Bg, IA);
10450
- if (!CA && !cA) {
10483
+ ), Ig = (t = X.imageKeys[b]) != null ? t : "", QA = this.resolveSpriteTextureInto(h, Ig, IA);
10484
+ if (!QA && !cA) {
10451
10485
  this.spriteWorkCursor--;
10452
10486
  continue;
10453
10487
  }
@@ -10459,7 +10493,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10459
10493
  continue;
10460
10494
  }
10461
10495
  if (cA) {
10462
- T = null, r.length > 0 && (this.drawBatch(A, r, c, n), r.length = 0, c = null), V && V.indices.length > 0 ? (this.drawShapeFrame(A, IA, FA, V, n), CA && this.drawClippedSprite(A, IA, V, n)) : (this.drawShapeFrame(A, IA, FA, V, n), CA && this.drawSingleSprite(A, IA, n));
10496
+ T = null, r.length > 0 && (this.drawBatch(A, r, c, n), r.length = 0, c = null), V && V.indices.length > 0 ? (this.drawShapeFrame(A, IA, FA, V, n), QA && this.drawClippedSprite(A, IA, V, n)) : (this.drawShapeFrame(A, IA, FA, V, n), QA && this.drawSingleSprite(A, IA, n));
10463
10497
  continue;
10464
10498
  }
10465
10499
  V && V.indices.length > 0 ? (T = null, r.length > 0 && (this.drawBatch(A, r, c, n), r.length = 0, c = null), this.drawClippedSprite(A, IA, V, n)) : IA.override ? (T && T.push(this.captureStaticBatchCacheEntry(IA, !0)), r.length > 0 && (this.drawBatch(A, r, c, n), r.length = 0, c = null), this.drawSingleSprite(A, IA, n)) : (T && T.push(this.captureStaticBatchCacheEntry(IA, !1)), c && c.id !== IA.handle.id && (this.drawBatch(A, r, c, n), r.length = 0, c = null), r.push(IA), c = IA.handle, r.length >= zA && (this.drawBatch(A, r, c, n), r.length = 0, c = null));
@@ -10540,7 +10574,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10540
10574
  for (let r = 0; r < n.spriteCount; r++) {
10541
10575
  this.resetClipLayerBatches();
10542
10576
  for (const c of a) {
10543
- const h = (r * n.frameCount + c.renderFrame) * AI;
10577
+ const h = (r * n.frameCount + c.renderFrame) * $g;
10544
10578
  if (n.frameData[h + 8] * c.slot.opacity < 0.05) continue;
10545
10579
  const l = (E = n.clipPathIndex[r * n.frameCount + c.renderFrame]) != null ? E : -1, w = l >= 0 ? n.clipPaths[l] : void 0;
10546
10580
  if (w && this.getClipGeometryKind(w) === "empty") continue;
@@ -10643,8 +10677,8 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10643
10677
  t[d] = F.a, t[d + 1] = F.b, t[d + 2] = F.c, t[d + 3] = F.d, t[d + 4] = F.tx, t[d + 5] = F.ty;
10644
10678
  let f = 1 / 0, u = 1 / 0, G = -1 / 0, S = -1 / 0;
10645
10679
  for (let M = 0; M < 4; M++) {
10646
- const N = M & 1 ? a.x1 : a.x0, U = M & 2 ? a.y1 : a.y0, p = F.a * N + F.c * U + F.tx, k = F.b * N + F.d * U + F.ty;
10647
- p < f && (f = p), k < u && (u = k), p > G && (G = p), k > S && (S = k);
10680
+ const N = M & 1 ? a.x1 : a.x0, U = M & 2 ? a.y1 : a.y0, K = F.a * N + F.c * U + F.tx, k = F.b * N + F.d * U + F.ty;
10681
+ K < f && (f = K), k < u && (u = k), K > G && (G = K), k > S && (S = k);
10648
10682
  }
10649
10683
  if (f < R.clipX0 || u < R.clipY0 || G > R.clipX1 || S > R.clipY1)
10650
10684
  return !1;
@@ -10672,7 +10706,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10672
10706
  try {
10673
10707
  if (o) {
10674
10708
  if (!this.submitPreparedTimelineWorks(A, s))
10675
- throw new jg(
10709
+ throw new Pg(
10676
10710
  "batched timeline stencil test became unavailable after mask write"
10677
10711
  );
10678
10712
  } else
@@ -10815,10 +10849,10 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10815
10849
  this.drawBatchInstancedWebGL(A, g, Q, I, B);
10816
10850
  return;
10817
10851
  }
10818
- const E = this.pool.getFloat32(Q * $g);
10852
+ const E = this.pool.getFloat32(Q * _g);
10819
10853
  for (let w = 0; w < Q; w++)
10820
10854
  this.packFrameData(E, w, g[w]);
10821
- const e = Q * cI * fg, i = Q * pI, t = this.pool.getFloat32B(e), a = this.pool.getUint32(i), o = new Float32Array(E.buffer, 0, Q * $g), s = new Float32Array(t.buffer, 0, e), n = new Uint32Array(a.buffer, 0, i);
10855
+ const e = Q * cI * fg, i = Q * pI, t = this.pool.getFloat32B(e), a = this.pool.getUint32(i), o = new Float32Array(E.buffer, 0, Q * _g), s = new Float32Array(t.buffer, 0, e), n = new Uint32Array(a.buffer, 0, i);
10822
10856
  (!mI() || TB(o, s, n) === null) && xB(o, s, n);
10823
10857
  const r = this.batchDrawCursor++, c = this.ensureVertexBuffer(A, r, s), h = this.ensureIndexBuffer(A, r, n), l = this.plainBatchDrawCommand;
10824
10858
  l.vertexBuffer = c, l.indexBuffer = h, l.indexCount = i, this.plainBatchTexturesScratch[0] = I, this.plainBatchTexturesScratch.length = 1, this.plainBatchUniformsScratch.u_projection = B, this.requireBackendDraw(A, l, "CPU reference batch");
@@ -10894,7 +10928,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
10894
10928
  const l = this.resolveRenderableFrame(h.slot, o);
10895
10929
  if (l == null) return null;
10896
10930
  const w = this.resolveCachedTimelineSlotState(h.slot, l), D = c * iI;
10897
- n.set(w.subarray(0, 8), D), n[D + 8] = h.clipX0, n[D + 9] = h.clipY0, n[D + 10] = h.clipX1, n[D + 11] = h.clipY1, n[D + 12] = 1, n[D + Ug.metadataBase] = h.spriteIndex, n[D + Ug.atlasPage] = (t = h.rect.textureIndex) != null ? t : -1, n[D + Ug.motionTrackPlusOne] = 1, h.slot.svgaFrameTableState.frameIndex = l;
10931
+ n.set(w.subarray(0, 8), D), n[D + 8] = h.clipX0, n[D + 9] = h.clipY0, n[D + 10] = h.clipX1, n[D + 11] = h.clipY1, n[D + 12] = 1, n[D + kg.metadataBase] = h.spriteIndex, n[D + kg.atlasPage] = (t = h.rect.textureIndex) != null ? t : -1, n[D + kg.motionTrackPlusOne] = 1, h.slot.svgaFrameTableState.frameIndex = l;
10898
10932
  }
10899
10933
  this.ensureInstancedQuadBuffers(A);
10900
10934
  const r = this.timelineDrawCommand;
@@ -11119,7 +11153,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
11119
11153
  return i.a = g, i.b = I, i.c = B, i.d = Q, i.tx = E, i.ty = e, Yt(A, i, i);
11120
11154
  }
11121
11155
  packFrameData(A, g, I) {
11122
- this.packFrameDataAt(A, g * $g, I);
11156
+ this.packFrameDataAt(A, g * _g, I);
11123
11157
  }
11124
11158
  packInstancedFrameData(A, g, I, B) {
11125
11159
  const Q = g * eQ;
@@ -11169,8 +11203,8 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
11169
11203
  S,
11170
11204
  M + B.x + w,
11171
11205
  N + B.y + D
11172
- ), { a: p, b: k, c: m, d: H, tx: v, ty: j } = U;
11173
- A[g] = y, A[g + 1] = R, A[g + 2] = p, A[g + 3] = k, A[g + 4] = m, A[g + 5] = H, A[g + 6] = v, A[g + 7] = j, A[g + 8] = n * (I.gpuMotion ? 1 : B.opacity), A[g + 9] = r.x, A[g + 10] = r.y, A[g + 11] = r.x + r.w, A[g + 12] = r.y + r.h;
11206
+ ), { a: K, b: k, c: m, d: H, tx: v, ty: j } = U;
11207
+ A[g] = y, A[g + 1] = R, A[g + 2] = K, A[g + 3] = k, A[g + 4] = m, A[g + 5] = H, A[g + 6] = v, A[g + 7] = j, A[g + 8] = n * (I.gpuMotion ? 1 : B.opacity), A[g + 9] = r.x, A[g + 10] = r.y, A[g + 11] = r.x + r.w, A[g + 12] = r.y + r.h;
11174
11208
  }
11175
11209
  /** Resolve atlas/override texture into a pooled SpriteWork entry. Returns false when missing. */
11176
11210
  resolveSpriteTextureInto(A, g, I) {
@@ -11194,7 +11228,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
11194
11228
  l * t + i.x + o,
11195
11229
  w * a + i.y + s
11196
11230
  ), { a: F, b: d, c: f, d: u, tx: G, ty: S } = R, M = !!B && B.indices.length > 0;
11197
- let N = !1, U = null, p = null, k = !1;
11231
+ let N = !1, U = null, K = null, k = !1;
11198
11232
  if (M) {
11199
11233
  const v = this.getClipRect(B);
11200
11234
  if (v && ((E = i.rotation) != null ? E : 0) === 0 && aB(F, d, f, u)) {
@@ -11204,13 +11238,13 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
11204
11238
  }
11205
11239
  N = !0;
11206
11240
  } else {
11207
- U = this.ensureClipMeshBuffers(A, B), p = this.packClipTransform(F, d, f, u, G, S);
11241
+ U = this.ensureClipMeshBuffers(A, B), K = this.packClipTransform(F, d, f, u, G, S);
11208
11242
  const j = this.clipMaskDrawCommand;
11209
- j.vertexBuffer = U.vertexBuf, j.indexBuffer = U.indexBuf, j.indexCount = B.indices.length, j.stencil = "write", this.clipMaskUniformsScratch.u_projection = Q, this.clipMaskUniformsScratch.u_transform = p, this.requireBackendDraw(A, j, "shape stencil write"), k = g.handle != null, k && (this.sharedClipStencilActive = !0);
11243
+ j.vertexBuffer = U.vertexBuf, j.indexBuffer = U.indexBuf, j.indexCount = B.indices.length, j.stencil = "write", this.clipMaskUniformsScratch.u_projection = Q, this.clipMaskUniformsScratch.u_transform = K, this.requireBackendDraw(A, j, "shape stencil write"), k = g.handle != null, k && (this.sharedClipStencilActive = !0);
11210
11244
  }
11211
11245
  }
11212
11246
  const m = this.ensureShapeMeshBuffers(A, e), H = this.shapeDrawCommand;
11213
- H.vertexBuffer = m.vertexBuf, H.indexBuffer = m.indexBuf, H.indexCount = e.indices.length, H.stencil = M ? "test" : "none", this.shapeTexturesScratch[0] = y, this.shapeTexturesScratch.length = 1, this.shapeUniformsScratch.u_projection = Q, this.shapeUniformsScratch.u_transform = this.packShapeTransform(F, d, f, u, G, S), this.shapeUniformsScratch.u_opacity = D * i.opacity, this.requireBackendDraw(A, H, "shape draw"), U && p && B && !k && this.clearClipStencil(A, B, U, p, Q), N && this.restoreSlotScissor(A);
11247
+ H.vertexBuffer = m.vertexBuf, H.indexBuffer = m.indexBuf, H.indexCount = e.indices.length, H.stencil = M ? "test" : "none", this.shapeTexturesScratch[0] = y, this.shapeTexturesScratch.length = 1, this.shapeUniformsScratch.u_projection = Q, this.shapeUniformsScratch.u_transform = this.packShapeTransform(F, d, f, u, G, S), this.shapeUniformsScratch.u_opacity = D * i.opacity, this.requireBackendDraw(A, H, "shape draw"), U && K && B && !k && this.clearClipStencil(A, B, U, K, Q), N && this.restoreSlotScissor(A);
11214
11248
  }
11215
11249
  /**
11216
11250
  * Clear the shared mask after a shape-first clip merge once the sprite sibling has drawn.
@@ -11388,6 +11422,7 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
11388
11422
  var B;
11389
11423
  const Q = A.spriteTable, E = (B = Q.clipPathIndex[g * Q.frameCount + I]) != null ? B : -1;
11390
11424
  if (E < 0) return null;
11425
+ this.retainClipPreparation(A);
11391
11426
  let e = this.entityClipMeshArrayCache.get(A);
11392
11427
  (!e || e.length !== Q.clipPaths.length) && (e = new Array(Q.clipPaths.length), this.entityClipMeshArrayCache.set(A, e));
11393
11428
  const i = e[E];
@@ -11464,13 +11499,15 @@ const iB = 6, tB = { x: 0, y: 0, w: 1, h: 1 }, SC = class nC {
11464
11499
  this.shapeMeshesWithBuffers.clear(), this.instancedQuadVB && A.deleteBuffer(this.instancedQuadVB), this.instancedQuadIB && A.deleteBuffer(this.instancedQuadIB), this.whiteTexture && A.deleteTexture(this.whiteTexture), this.pool.destroy();
11465
11500
  for (const g of this.clipMeshStateWaiters.values())
11466
11501
  for (const I of g)
11467
- I.signal && I.onAbort && I.signal.removeEventListener("abort", I.onAbort), I.reject(QA("SVGA renderer destroyed during clip prewarm"));
11468
- this.clipMeshStateWaiters.clear(), this.clipMeshProducerTasks.clear(), this.clipMeshCache.clear(), this.clipMeshStates.clear(), this.clipAnalysis.clear(), this.pendingClipMeshPaths.clear(), this.vertexBufHandles = [], this.indexBufHandles = [], this.clipSpriteVertBufHandles = [], this.clipSpriteIdxBufHandles = [], this.instancedQuadVB = null, this.instancedQuadIB = null, this.whiteTexture = null, this.projCache = null;
11502
+ I.signal && I.onAbort && I.signal.removeEventListener("abort", I.onAbort), I.reject(CA("SVGA renderer destroyed during clip prewarm"));
11503
+ this.clipMeshStateWaiters.clear(), this.clipMeshProducerTasks.clear(), this.clipMeshCache.clear(), this.clipMeshStates.clear();
11504
+ for (const g of this.liveClipPreparationControllers) g.abort();
11505
+ this.liveClipPreparationControllers.clear(), this.clipTableOwnerCounts = /* @__PURE__ */ new WeakMap(), this.clipAnalysis.clear(), this.pendingClipMeshPaths.clear(), this.vertexBufHandles = [], this.indexBufHandles = [], this.clipSpriteVertBufHandles = [], this.clipSpriteIdxBufHandles = [], this.instancedQuadVB = null, this.instancedQuadIB = null, this.whiteTexture = null, this.projCache = null;
11469
11506
  }
11470
11507
  }
11471
11508
  };
11472
- K(SC, "INSTANCED_QUAD_VERTS", new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]));
11473
- K(SC, "INSTANCED_QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
11509
+ p(SC, "INSTANCED_QUAD_VERTS", new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]));
11510
+ p(SC, "INSTANCED_QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
11474
11511
  let xt = SC;
11475
11512
  const iQ = 1e-4;
11476
11513
  function aB(C, A, g, I) {
@@ -11496,7 +11533,7 @@ function bt(C, A) {
11496
11533
  return t !== 15 ? null : { x: g, y: I, w: E, h: e };
11497
11534
  }
11498
11535
  var qt = Object.defineProperty, vt = (C, A, g) => A in C ? qt(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, lg = (C, A, g) => vt(C, typeof A != "symbol" ? A + "" : A, g);
11499
- const Tt = 4, Wt = 128 * 1024 * 1024, Vt = 2048 * 1024 * 1024, Zt = "gift-stage-resource-cache", Xt = 3, Gg = "resources", sg = "resourceMeta", xg = "cacheState", Og = "totalBytes", tQ = "byUpdatedAt", Ot = 3e4;
11536
+ const Tt = 4, Wt = 128 * 1024 * 1024, Vt = 2048 * 1024 * 1024, Zt = "gift-stage-resource-cache", Xt = 3, Gg = "resources", sg = "resourceMeta", xg = "cacheState", Xg = "totalBytes", tQ = "byUpdatedAt", Ot = 3e4;
11500
11537
  class Pt {
11501
11538
  constructor(A) {
11502
11539
  lg(this, "maxConcurrent"), lg(this, "active", 0), lg(this, "queue", []), this.maxConcurrent = Math.max(1, A);
@@ -11523,7 +11560,7 @@ class Pt {
11523
11560
  function jt() {
11524
11561
  return typeof indexedDB != "undefined";
11525
11562
  }
11526
- function Yg(C) {
11563
+ function pg(C) {
11527
11564
  return C.length * 2;
11528
11565
  }
11529
11566
  function zt(C) {
@@ -11536,19 +11573,19 @@ function zt(C) {
11536
11573
  for (const e of Object.values((A = C.images) != null ? A : {}))
11537
11574
  B += e.byteLength;
11538
11575
  for (const e of (g = C.imageEntries) != null ? g : [])
11539
- B += Yg(e.key) + 16;
11576
+ B += pg(e.key) + 16;
11540
11577
  for (const e of C.audios)
11541
- B += Yg(e.audioKey) + 32;
11578
+ B += pg(e.audioKey) + 32;
11542
11579
  const E = C.spriteTable;
11543
11580
  (!Q || E.frameData.buffer !== Q) && (B += E.frameData.byteLength), (!Q || E.clipPathIndex.buffer !== Q) && (B += E.clipPathIndex.byteLength), (!Q || E.shapesIndex.buffer !== Q) && (B += E.shapesIndex.byteLength);
11544
- for (const e of E.imageKeys) B += Yg(e);
11545
- for (const e of E.clipPaths) B += Yg(e);
11581
+ for (const e of E.imageKeys) B += pg(e);
11582
+ for (const e of E.clipPaths) B += pg(e);
11546
11583
  for (const e of E.shapesTable)
11547
- for (const i of e) B += Yg((I = i.pathData) != null ? I : "") + 96;
11584
+ for (const i of e) B += pg((I = i.pathData) != null ? I : "") + 96;
11548
11585
  return B;
11549
11586
  }
11550
11587
  function _t(C) {
11551
- return typeof C == "string" ? Yg(C) : C.byteLength;
11588
+ return typeof C == "string" ? pg(C) : C.byteLength;
11552
11589
  }
11553
11590
  class $t {
11554
11591
  constructor() {
@@ -11578,13 +11615,13 @@ class $t {
11578
11615
  const I = `text:${A}`, B = this.getMemory(I, "text");
11579
11616
  if (B != null) return B;
11580
11617
  const Q = await this.getPersistent(I, "text");
11581
- return Q != null ? (this.setMemory(I, "text", Q, Yg(Q)), Q) : this.getOrCreatePending(
11618
+ return Q != null ? (this.setMemory(I, "text", Q, pg(Q)), Q) : this.getOrCreatePending(
11582
11619
  I,
11583
11620
  () => this.limiter.run(async () => {
11584
11621
  const E = await fetch(A, { mode: "cors", signal: g });
11585
11622
  if (!E.ok) throw new Error(`fetch failed ${E.status}`);
11586
11623
  const e = await E.text();
11587
- return this.setMemory(I, "text", e, Yg(e)), this.setPersistent(I, "text", e), e;
11624
+ return this.setMemory(I, "text", e, pg(e)), this.setPersistent(I, "text", e), e;
11588
11625
  })
11589
11626
  );
11590
11627
  }
@@ -11592,7 +11629,7 @@ class $t {
11592
11629
  const I = `json:${A}`, B = this.getMemory(I, "json");
11593
11630
  if (B != null) return B;
11594
11631
  const Q = await this.fetchText(A, g), E = JSON.parse(Q);
11595
- return this.setMemory(I, "json", E, Yg(Q)), E;
11632
+ return this.setMemory(I, "json", E, pg(Q)), E;
11596
11633
  }
11597
11634
  getSVGAWorkerPayload(A) {
11598
11635
  return this.getMemory(A, "svga-payload");
@@ -11658,7 +11695,7 @@ class $t {
11658
11695
  ])
11659
11696
  I.objectStoreNames.contains(E) && I.deleteObjectStore(E);
11660
11697
  I.createObjectStore(Gg, { keyPath: "key" }), I.createObjectStore(sg, { keyPath: "key" }).createIndex(tQ, "updatedAt", { unique: !1 }), I.createObjectStore(xg, { keyPath: "key" }).put({
11661
- key: Og,
11698
+ key: Xg,
11662
11699
  totalBytes: 0
11663
11700
  });
11664
11701
  }, g.onsuccess = () => A(g.result), g.onerror = () => A(null), g.onblocked = () => A(null);
@@ -11708,7 +11745,7 @@ class $t {
11708
11745
  e.oncomplete = () => E(), e.onerror = () => E(), e.onabort = () => E();
11709
11746
  const i = e.objectStore(Gg), t = e.objectStore(sg), a = e.objectStore(xg), o = t.get(A);
11710
11747
  o.onsuccess = () => {
11711
- const s = o.result, n = a.get(Og);
11748
+ const s = o.result, n = a.get(Xg);
11712
11749
  n.onsuccess = () => {
11713
11750
  var r, c;
11714
11751
  const h = n.result, l = Math.max(
@@ -11721,7 +11758,7 @@ class $t {
11721
11758
  sizeBytes: Q,
11722
11759
  updatedAt: Date.now()
11723
11760
  }), a.put({
11724
- key: Og,
11761
+ key: Xg,
11725
11762
  totalBytes: l
11726
11763
  });
11727
11764
  };
@@ -11761,7 +11798,7 @@ class $t {
11761
11798
  "readwrite"
11762
11799
  );
11763
11800
  I.oncomplete = () => g(), I.onerror = () => g(), I.onabort = () => g();
11764
- const B = I.objectStore(Gg), Q = I.objectStore(sg), E = I.objectStore(xg), e = E.get(Og);
11801
+ const B = I.objectStore(Gg), Q = I.objectStore(sg), E = I.objectStore(xg), e = E.get(Xg);
11765
11802
  e.onsuccess = () => {
11766
11803
  var i;
11767
11804
  const t = e.result;
@@ -11772,7 +11809,7 @@ class $t {
11772
11809
  const s = o.result;
11773
11810
  if (!s || a <= this.maxPersistentBytes) {
11774
11811
  E.put({
11775
- key: Og,
11812
+ key: Xg,
11776
11813
  totalBytes: a
11777
11814
  });
11778
11815
  return;
@@ -11797,12 +11834,12 @@ class $t {
11797
11834
  B.oncomplete = () => I(), B.onerror = () => I(), B.onabort = () => I();
11798
11835
  const Q = B.objectStore(Gg), E = B.objectStore(sg), e = B.objectStore(xg), i = E.get(A);
11799
11836
  i.onsuccess = () => {
11800
- const t = i.result, a = e.get(Og);
11837
+ const t = i.result, a = e.get(Xg);
11801
11838
  a.onsuccess = () => {
11802
11839
  var o, s;
11803
11840
  const n = a.result;
11804
11841
  Q.delete(A), E.delete(A), e.put({
11805
- key: Og,
11842
+ key: Xg,
11806
11843
  totalBytes: Math.max(
11807
11844
  0,
11808
11845
  ((o = n == null ? void 0 : n.totalBytes) != null ? o : 0) - ((s = t == null ? void 0 : t.sizeBytes) != null ? s : 0)
@@ -11823,7 +11860,7 @@ function Aa(C) {
11823
11860
  function rC(C) {
11824
11861
  return yg.runLimited(C);
11825
11862
  }
11826
- function CI(C, A) {
11863
+ function BI(C, A) {
11827
11864
  return yg.fetchArrayBuffer(C, A);
11828
11865
  }
11829
11866
  function ga(C, A) {
@@ -11857,7 +11894,7 @@ async function oQ(C) {
11857
11894
  throw new Error("VAP config missing rgbFrame or aFrame");
11858
11895
  return A;
11859
11896
  }
11860
- function II(C, A = { w: 0, h: 0 }) {
11897
+ function gI(C, A = { w: 0, h: 0 }) {
11861
11898
  const [, , g, I] = C.rgbFrame, B = C.w > 0 ? C.w : g, Q = C.h > 0 ? C.h : I;
11862
11899
  return A.w = B > 0 && Q > 0 ? B : C.videoW, A.h = B > 0 && Q > 0 ? Q : C.videoH, A;
11863
11900
  }
@@ -12146,7 +12183,7 @@ async function la(C, A, g, I) {
12146
12183
  for (let F = 0; F < r; F++) {
12147
12184
  const d = (h * r + F) * 9, f = (B = a.frameData[d]) != null ? B : 0, u = (Q = a.frameData[d + 1]) != null ? Q : 0, G = (E = a.frameData[d + 2]) != null ? E : 1, S = (e = a.frameData[d + 3]) != null ? e : 0, M = (i = a.frameData[d + 4]) != null ? i : 0, N = (t = a.frameData[d + 5]) != null ? t : 1;
12148
12185
  if (l = Math.max(l, f), w = Math.max(w, u), f > 0 && u > 0) {
12149
- const U = Math.abs(G) * f + Math.abs(M) * u, p = Math.abs(S) * f + Math.abs(N) * u, k = U > 0 ? U / f : 1, m = p > 0 ? p / u : 1, H = Math.min(k || 1, m || 1);
12186
+ const U = Math.abs(G) * f + Math.abs(M) * u, K = Math.abs(S) * f + Math.abs(N) * u, k = U > 0 ? U / f : 1, m = K > 0 ? K / u : 1, H = Math.min(k || 1, m || 1);
12150
12187
  GI(H) && (D = Math.min(D, H));
12151
12188
  }
12152
12189
  F + 1 < r && g.shouldYield() && (await g.yield(), I == null || I());
@@ -12356,38 +12393,38 @@ function rQ(C, A, g, I, B = !0) {
12356
12393
  for (let F = 0; F < C.height; F++) {
12357
12394
  const d = Math.min(t - 1, Math.max(0, o + Math.floor(F / C.height * n))), f = Math.min(t - 1, Math.max(0, c + Math.floor(F / C.height * l)));
12358
12395
  for (let u = 0; u < C.width; u++) {
12359
- const G = Math.min(i - 1, Math.max(0, a + Math.floor(u / C.width * s))), S = Math.min(i - 1, Math.max(0, r + Math.floor(u / C.width * h))), M = (d * i + G) * 4, N = (f * i + S) * 4, U = w[N] / 255, p = (F * C.width + u) * 4, k = B ? 1 : U;
12360
- y[p] = Math.round(w[M] * k), y[p + 1] = Math.round(w[M + 1] * k), y[p + 2] = Math.round(w[M + 2] * k), y[p + 3] = Math.round(U * 255);
12396
+ const G = Math.min(i - 1, Math.max(0, a + Math.floor(u / C.width * s))), S = Math.min(i - 1, Math.max(0, r + Math.floor(u / C.width * h))), M = (d * i + G) * 4, N = (f * i + S) * 4, U = w[N] / 255, K = (F * C.width + u) * 4, k = B ? 1 : U;
12397
+ y[K] = Math.round(w[M] * k), y[K + 1] = Math.round(w[M + 1] * k), y[K + 2] = Math.round(w[M + 2] * k), y[K + 3] = Math.round(U * 255);
12361
12398
  }
12362
12399
  }
12363
12400
  const R = (Q = C.frameMap.get(I)) != null ? Q : [];
12364
12401
  for (const F of R) {
12365
12402
  const d = (E = C.resources) == null ? void 0 : E.get(String(F.srcId));
12366
12403
  if (!d) continue;
12367
- const [f, u, G, S] = F.frame, [M, N, U, p] = F.mFrame;
12368
- if (G <= 0 || S <= 0 || U <= 0 || p <= 0) continue;
12404
+ const [f, u, G, S] = F.frame, [M, N, U, K] = F.mFrame;
12405
+ if (G <= 0 || S <= 0 || U <= 0 || K <= 0) continue;
12369
12406
  (C.scratchCanvas.width !== G || C.scratchCanvas.height !== S) && (C.scratchCanvas.width = Math.max(1, Math.round(G)), C.scratchCanvas.height = Math.max(1, Math.round(S))), C.scratchCtx.clearRect(0, 0, C.scratchCanvas.width, C.scratchCanvas.height), C.scratchCtx.drawImage(d.source, 0, 0, C.scratchCanvas.width, C.scratchCanvas.height);
12370
12407
  const k = C.scratchCtx.getImageData(0, 0, C.scratchCanvas.width, C.scratchCanvas.height).data, m = Math.max(0, Math.floor(f)), H = Math.max(0, Math.floor(u)), v = Math.min(C.width, Math.ceil(f + G)), j = Math.min(C.height, Math.ceil(u + S));
12371
12408
  for (let T = H; T < j; T++) {
12372
12409
  const b = Math.min(
12373
12410
  C.scratchCanvas.height - 1,
12374
12411
  Math.max(0, Math.floor((T - u) / S * C.scratchCanvas.height))
12375
- ), X = Math.min(t - 1, Math.max(0, N + Math.floor((T - u) / S * p)));
12412
+ ), X = Math.min(t - 1, Math.max(0, N + Math.floor((T - u) / S * K)));
12376
12413
  for (let Z = m; Z < v; Z++) {
12377
12414
  const EA = Math.min(
12378
12415
  C.scratchCanvas.width - 1,
12379
12416
  Math.max(0, Math.floor((Z - f) / G * C.scratchCanvas.width))
12380
- ), UA = Math.min(i - 1, Math.max(0, M + Math.floor((Z - f) / G * U))), FA = (b * C.scratchCanvas.width + EA) * 4, cA = (X * i + UA) * 4, IA = k[FA + 3] / 255, Bg = w[cA] / 255, CA = IA * Bg;
12381
- if (CA <= 0) continue;
12382
- const V = (T * C.width + Z) * 4, YA = k[FA] / 255 * CA, kA = k[FA + 1] / 255 * CA, W = k[FA + 2] / 255 * CA, pA = y[V + 3] / 255, LA = 1 - CA;
12383
- y[V] = Math.round((YA + y[V] / 255 * LA) * 255), y[V + 1] = Math.round((kA + y[V + 1] / 255 * LA) * 255), y[V + 2] = Math.round((W + y[V + 2] / 255 * LA) * 255), y[V + 3] = Math.round((CA + pA * LA) * 255);
12417
+ ), UA = Math.min(i - 1, Math.max(0, M + Math.floor((Z - f) / G * U))), FA = (b * C.scratchCanvas.width + EA) * 4, cA = (X * i + UA) * 4, IA = k[FA + 3] / 255, Ig = w[cA] / 255, QA = IA * Ig;
12418
+ if (QA <= 0) continue;
12419
+ const V = (T * C.width + Z) * 4, YA = k[FA] / 255 * QA, kA = k[FA + 1] / 255 * QA, W = k[FA + 2] / 255 * QA, pA = y[V + 3] / 255, LA = 1 - QA;
12420
+ y[V] = Math.round((YA + y[V] / 255 * LA) * 255), y[V + 1] = Math.round((kA + y[V + 1] / 255 * LA) * 255), y[V + 2] = Math.round((W + y[V + 2] / 255 * LA) * 255), y[V + 3] = Math.round((QA + pA * LA) * 255);
12384
12421
  }
12385
12422
  }
12386
12423
  }
12387
12424
  return C.compositeCtx.putImageData(D, 0, 0), C.compositeCanvas;
12388
12425
  }
12389
12426
  var Sa = Object.defineProperty, Ma = (C, A, g) => A in C ? Sa(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, O = (C, A, g) => Ma(C, typeof A != "symbol" ? A + "" : A, g);
12390
- const jB = 1024, cQ = 32, _I = class Ng {
12427
+ const jB = 1024, cQ = 32, _I = class Ug {
12391
12428
  constructor(A) {
12392
12429
  O(this, "instancedQuadVB", null), O(this, "instancedQuadIB", null), O(this, "quadVB", null), O(this, "quadIB", null), O(this, "rgbaWebGLQuadVB", null), O(this, "rgbaTopLeftQuadVB", null), O(this, "rgbaQuadIB", null), O(this, "wcDbgFirstDraw", /* @__PURE__ */ new Set()), O(this, "wcDbgNullWarns", /* @__PURE__ */ new Map()), O(this, "htmlGate"), O(this, "lastWcFrameRef", /* @__PURE__ */ new Map()), O(this, "scratchAtlasRemap", new Float32Array(4)), O(this, "instancePackScratch", new Float32Array(jB * cQ)), O(this, "scratchTransform", new Float32Array(16)), O(this, "contentSizeScratch", { w: 0, h: 0 }), O(this, "rgbUVScratch", { left: 0, right: 0, top: 0, bottom: 0 }), O(this, "alphaUVScratch", { left: 0, right: 0, top: 0, bottom: 0 }), O(this, "maskUVScratch", { left: 0, right: 0, top: 0, bottom: 0 }), O(this, "processedHtmlGatesScratch", /* @__PURE__ */ new Set()), O(this, "vapVertexScratch", new Float32Array(24)), O(this, "layoutScratch", {
12393
12430
  scaleX: 1,
@@ -12529,7 +12566,7 @@ const jB = 1024, cQ = 32, _I = class Ng {
12529
12566
  for (const a of g.values())
12530
12567
  a.type !== "vap" || a.state !== "playing" && a.state !== "fly" && a.state !== "stopped" || a.vapMixState || !a.videoElement && !a.webcodecsPlayback || !a.videoTextureHandle || XA(a) === "cover" || !a.vapConfig || I.push(a);
12531
12568
  if (I.length === 0) return;
12532
- this.instancedQuadVB || (this.instancedQuadVB = A.createBuffer(Ng.QUAD_VERTS, "vertex"), this.instancedQuadIB = A.createBuffer(Ng.QUAD_INDICES, "index"));
12569
+ this.instancedQuadVB || (this.instancedQuadVB = A.createBuffer(Ug.QUAD_VERTS, "vertex"), this.instancedQuadIB = A.createBuffer(Ug.QUAD_INDICES, "index"));
12533
12570
  const B = A.canvas.width, Q = A.canvas.height;
12534
12571
  let E;
12535
12572
  this.projCache && this.projCacheW === B && this.projCacheH === Q ? E = this.projCache : (this.projCacheW = B, this.projCacheH = Q, this.projCache = Tg(0, B, Q, 0, -1, 1), E = this.projCache);
@@ -12558,7 +12595,7 @@ const jB = 1024, cQ = 32, _I = class Ng {
12558
12595
  /** mat4 + atlasRemap + rgb/alpha UV rects (`computeVAPUV` order). */
12559
12596
  fillVapInstanceData(A, g, I) {
12560
12597
  var B, Q, E, e;
12561
- const i = A.vapConfig, { info: t } = i, a = t.videoW > 0 ? t.videoW : (Q = (B = A.webcodecsPlayback) == null ? void 0 : B.videoWidth) != null ? Q : 1, o = t.videoH > 0 ? t.videoH : (e = (E = A.webcodecsPlayback) == null ? void 0 : E.videoHeight) != null ? e : 1, s = this.scratchTransform, { w: n, h: r } = II(t, this.contentSizeScratch), c = wg(A, n, r, this.layoutScratch);
12598
+ const i = A.vapConfig, { info: t } = i, a = t.videoW > 0 ? t.videoW : (Q = (B = A.webcodecsPlayback) == null ? void 0 : B.videoWidth) != null ? Q : 1, o = t.videoH > 0 ? t.videoH : (e = (E = A.webcodecsPlayback) == null ? void 0 : E.videoHeight) != null ? e : 1, s = this.scratchTransform, { w: n, h: r } = gI(t, this.contentSizeScratch), c = wg(A, n, r, this.layoutScratch);
12562
12599
  sI(
12563
12600
  A,
12564
12601
  A.x + c.offsetX,
@@ -12618,7 +12655,7 @@ const jB = 1024, cQ = 32, _I = class Ng {
12618
12655
  console.warn("[GiftStage:WC] VAP vapConfig missing — draw skipped", { giftId: g.id });
12619
12656
  return;
12620
12657
  }
12621
- const { info: o } = a, s = o.videoW > 0 ? o.videoW : (B = (I = g.webcodecsPlayback) == null ? void 0 : I.videoWidth) != null ? B : 1, n = o.videoH > 0 ? o.videoH : (E = (Q = g.webcodecsPlayback) == null ? void 0 : Q.videoHeight) != null ? E : 1, r = this.scratchTransform, c = XA(g), { w: h, h: l } = II(o, this.contentSizeScratch), w = wg(g, h, l, this.layoutScratch);
12658
+ const { info: o } = a, s = o.videoW > 0 ? o.videoW : (B = (I = g.webcodecsPlayback) == null ? void 0 : I.videoWidth) != null ? B : 1, n = o.videoH > 0 ? o.videoH : (E = (Q = g.webcodecsPlayback) == null ? void 0 : Q.videoHeight) != null ? E : 1, r = this.scratchTransform, c = XA(g), { w: h, h: l } = gI(o, this.contentSizeScratch), w = wg(g, h, l, this.layoutScratch);
12622
12659
  sI(
12623
12660
  g,
12624
12661
  g.x + w.offsetX,
@@ -12628,7 +12665,7 @@ const jB = 1024, cQ = 32, _I = class Ng {
12628
12665
  r
12629
12666
  );
12630
12667
  const D = RI(o.rgbFrame, s, n, this.rgbUVScratch), y = RI(o.aFrame, s, n, this.alphaUVScratch), R = g.videoTextureHandle, F = dB(R.width, R.height, g.wcAtlasRect, this.scratchAtlasRemap), d = this.vapVertexScratch;
12631
- d[0] = 0, d[1] = 0, d[2] = D.left, d[3] = D.top, d[4] = y.left, d[5] = y.top, d[6] = 1, d[7] = 0, d[8] = D.right, d[9] = D.top, d[10] = y.right, d[11] = y.top, d[12] = 1, d[13] = 1, d[14] = D.right, d[15] = D.bottom, d[16] = y.right, d[17] = y.bottom, d[18] = 0, d[19] = 1, d[20] = D.left, d[21] = D.bottom, d[22] = y.left, d[23] = y.bottom, this.quadVB = this.ensureBuffer(A, this.quadVB, d, "vertex"), this.quadIB || (this.quadIB = A.createBuffer(Ng.QUAD_INDICES, "index"));
12668
+ d[0] = 0, d[1] = 0, d[2] = D.left, d[3] = D.top, d[4] = y.left, d[5] = y.top, d[6] = 1, d[7] = 0, d[8] = D.right, d[9] = D.top, d[10] = y.right, d[11] = y.top, d[12] = 1, d[13] = 1, d[14] = D.right, d[15] = D.bottom, d[16] = y.right, d[17] = y.bottom, d[18] = 0, d[19] = 1, d[20] = D.left, d[21] = D.bottom, d[22] = y.left, d[23] = y.bottom, this.quadVB = this.ensureBuffer(A, this.quadVB, d, "vertex"), this.quadIB || (this.quadIB = A.createBuffer(Ug.QUAD_INDICES, "index"));
12632
12669
  const f = this.geometryDrawCommand;
12633
12670
  if (f.vertexBuffer = this.quadVB, f.indexBuffer = this.quadIB, this.geometryTexturesScratch[0] = g.videoTextureHandle, this.geometryTexturesScratch.length = 1, this.geometryUniformsScratch.u_projection = t, this.geometryUniformsScratch.u_transform = r, this.geometryUniformsScratch.u_atlasRemap = F, this.geometryUniformsScratch.u_opacity = g.opacity, this.geometryUniformsScratch.u_rgbPremultiplied = g.options.videoRGBAlphaMode !== "straight" ? 1 : 0, c === "cover") {
12634
12671
  const u = Sg(
@@ -12650,7 +12687,7 @@ const jB = 1024, cQ = 32, _I = class Ng {
12650
12687
  const E = g.vapConfig;
12651
12688
  if (!E || !g.vapMixState || g.vapMixState.mode !== "composited" || !g.videoTextureHandle)
12652
12689
  return;
12653
- const e = this.scratchTransform, i = XA(g), { w: t, h: a } = II(
12690
+ const e = this.scratchTransform, i = XA(g), { w: t, h: a } = gI(
12654
12691
  E.info,
12655
12692
  this.contentSizeScratch
12656
12693
  ), o = wg(g, t, a, this.layoutScratch);
@@ -12665,9 +12702,9 @@ const jB = 1024, cQ = 32, _I = class Ng {
12665
12702
  const s = !!g.vapMixState.composer || A.type === "webgpu";
12666
12703
  let n = s ? this.rgbaTopLeftQuadVB : this.rgbaWebGLQuadVB;
12667
12704
  if (n || (n = A.createBuffer(
12668
- s ? Ng.RGBA_QUAD_VERTS_WEBGPU : Ng.RGBA_QUAD_VERTS_WEBGL,
12705
+ s ? Ug.RGBA_QUAD_VERTS_WEBGPU : Ug.RGBA_QUAD_VERTS_WEBGL,
12669
12706
  "vertex"
12670
- ), s ? this.rgbaTopLeftQuadVB = n : this.rgbaWebGLQuadVB = n), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(Ng.QUAD_INDICES, "index")), i === "cover") {
12707
+ ), s ? this.rgbaTopLeftQuadVB = n : this.rgbaWebGLQuadVB = n), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(Ug.QUAD_INDICES, "index")), i === "cover") {
12671
12708
  const c = Sg(
12672
12709
  g,
12673
12710
  g.x,
@@ -12692,10 +12729,10 @@ const jB = 1024, cQ = 32, _I = class Ng {
12692
12729
  const i = A.canvas.width, t = A.canvas.height;
12693
12730
  let a;
12694
12731
  this.projCache && this.projCacheW === i && this.projCacheH === t ? a = this.projCache : (this.projCacheW = i, this.projCacheH = t, this.projCache = Tg(0, i, t, 0, -1, 1), a = this.projCache), this.rgbaTopLeftQuadVB || (this.rgbaTopLeftQuadVB = A.createBuffer(
12695
- Ng.RGBA_QUAD_VERTS_WEBGPU,
12732
+ Ug.RGBA_QUAD_VERTS_WEBGPU,
12696
12733
  "vertex"
12697
- )), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(Ng.QUAD_INDICES, "index"));
12698
- const { info: o } = B, { w: s, h: n } = II(o, this.contentSizeScratch), r = wg(g, s, n, this.layoutScratch);
12734
+ )), this.rgbaQuadIB || (this.rgbaQuadIB = A.createBuffer(Ug.QUAD_INDICES, "index"));
12735
+ const { info: o } = B, { w: s, h: n } = gI(o, this.contentSizeScratch), r = wg(g, s, n, this.layoutScratch);
12699
12736
  if (XA(g) === "cover") {
12700
12737
  const y = Sg(
12701
12738
  g,
@@ -13016,23 +13053,23 @@ sA(NC, "QUAD_VERTS", new Float32Array([
13016
13053
  ]));
13017
13054
  sA(NC, "QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
13018
13055
  let Ya = NC;
13019
- var pa = Object.defineProperty, Ka = (C, A, g) => A in C ? pa(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, tg = (C, A, g) => Ka(C, typeof A != "symbol" ? A + "" : A, g);
13056
+ var pa = Object.defineProperty, Ka = (C, A, g) => A in C ? pa(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, ig = (C, A, g) => Ka(C, typeof A != "symbol" ? A + "" : A, g);
13020
13057
  const UC = class hC {
13021
13058
  constructor() {
13022
- tg(this, "quadVB", null), tg(this, "quadIB", null), tg(this, "scratchTransform", new Float32Array(16)), tg(this, "layoutScratch", {
13059
+ ig(this, "quadVB", null), ig(this, "quadIB", null), ig(this, "scratchTransform", new Float32Array(16)), ig(this, "layoutScratch", {
13023
13060
  scaleX: 1,
13024
13061
  scaleY: 1,
13025
13062
  width: 0,
13026
13063
  height: 0,
13027
13064
  offsetX: 0,
13028
13065
  offsetY: 0
13029
- }), tg(this, "clipScratch", { x: 0, y: 0, w: 0, h: 0 }), tg(this, "projCacheW", 0), tg(this, "projCacheH", 0), tg(this, "projCache", null), tg(this, "texturesScratch", []), tg(this, "uniformsScratch", {
13066
+ }), ig(this, "clipScratch", { x: 0, y: 0, w: 0, h: 0 }), ig(this, "projCacheW", 0), ig(this, "projCacheH", 0), ig(this, "projCache", null), ig(this, "texturesScratch", []), ig(this, "uniformsScratch", {
13030
13067
  u_projection: new Float32Array(16),
13031
13068
  u_transform: this.scratchTransform,
13032
13069
  u_atlasRemap: GE,
13033
13070
  u_opacity: 1,
13034
13071
  u_video: 0
13035
- }), tg(this, "drawCommand", {
13072
+ }), ig(this, "drawCommand", {
13036
13073
  shader: "rgba-textured",
13037
13074
  vertexBuffer: null,
13038
13075
  indexBuffer: null,
@@ -13072,7 +13109,7 @@ const UC = class hC {
13072
13109
  this.quadVB && A.deleteBuffer(this.quadVB), this.quadIB && A.deleteBuffer(this.quadIB), this.quadVB = null, this.quadIB = null, this.projCache = null;
13073
13110
  }
13074
13111
  };
13075
- tg(UC, "QUAD_VERTS", new Float32Array([
13112
+ ig(UC, "QUAD_VERTS", new Float32Array([
13076
13113
  0,
13077
13114
  0,
13078
13115
  0,
@@ -13090,7 +13127,7 @@ tg(UC, "QUAD_VERTS", new Float32Array([
13090
13127
  0,
13091
13128
  1
13092
13129
  ]));
13093
- tg(UC, "QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
13130
+ ig(UC, "QUAD_INDICES", new Uint32Array([0, 1, 2, 0, 2, 3]));
13094
13131
  let ma = UC;
13095
13132
  var Ja = Object.defineProperty, La = (C, A, g) => A in C ? Ja(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, oB = (C, A, g) => La(C, typeof A != "symbol" ? A + "" : A, g);
13096
13133
  class Ha {
@@ -14229,7 +14266,7 @@ class uB {
14229
14266
  abortPreparedFrame(A) {
14230
14267
  if (this.destroyed) return !1;
14231
14268
  let g = !0;
14232
- if (this.svgaBatch.abortFrame(), this.destroyed || A instanceof jg && (this.emitRuntimeDiagnostic({
14269
+ if (this.svgaBatch.abortFrame(), this.destroyed || A instanceof Pg && (this.emitRuntimeDiagnostic({
14233
14270
  type: "stencil-transaction-failure",
14234
14271
  message: A.message
14235
14272
  }), this.destroyed))
@@ -15270,7 +15307,7 @@ async function YE(C, A) {
15270
15307
  for (let w = 0; w < g; w++)
15271
15308
  I.push(C.string()), await A();
15272
15309
  C.pad4();
15273
- const B = C.u32(), Q = g * B * _g;
15310
+ const B = C.u32(), Q = g * B * zg;
15274
15311
  C.pad4();
15275
15312
  const E = C.position, e = new Float32Array(C.sourceBuffer(), E, Q);
15276
15313
  C.skip(Q * 4), await A();
@@ -15356,9 +15393,9 @@ let Yo = class {
15356
15393
  };
15357
15394
  async function pE(C, A, g, I) {
15358
15395
  const B = OA({ maxBudgetMs: g }), Q = async () => {
15359
- L(I, "SVGA payload deserialization aborted"), B.shouldYield() && await B.yield(), L(I, "SVGA payload deserialization aborted");
15396
+ J(I, "SVGA payload deserialization aborted"), B.shouldYield() && await B.yield(), J(I, "SVGA payload deserialization aborted");
15360
15397
  };
15361
- L(I, "SVGA payload deserialization aborted");
15398
+ J(I, "SVGA payload deserialization aborted");
15362
15399
  const E = new Yo(C);
15363
15400
  if (E.u32() !== No) throw new Error("Invalid SVGA worker payload magic");
15364
15401
  if (E.u16() !== Uo) throw new Error("Unsupported SVGA worker payload version");
@@ -15382,7 +15419,7 @@ async function pE(C, A, g, I) {
15382
15419
  s.push({ key: h, offset: l.offset, length: l.length }), await Q();
15383
15420
  }
15384
15421
  const r = await YE(E, Q);
15385
- return (e & 2) !== 0 && (r.allFramesInsideViewBox = (e & 1) !== 0), L(I, "SVGA payload deserialization aborted"), {
15422
+ return (e & 2) !== 0 && (r.allFramesInsideViewBox = (e & 1) !== 0), J(I, "SVGA payload deserialization aborted"), {
15386
15423
  version: i,
15387
15424
  params: t,
15388
15425
  audios: a,
@@ -16952,7 +16989,7 @@ function mo() {
16952
16989
  }
16953
16990
  function Jo(C, A = {}) {
16954
16991
  return GC(() => {
16955
- L(A.signal, "SVGA parser worker task aborted");
16992
+ J(A.signal, "SVGA parser worker task aborted");
16956
16993
  const g = mo(), I = Ko++;
16957
16994
  return new Promise((B, Q) => {
16958
16995
  var E, e;
@@ -16966,7 +17003,7 @@ function Jo(C, A = {}) {
16966
17003
  if (i.onAbort = () => {
16967
17004
  RB(
16968
17005
  g,
16969
- QA("SVGA parser worker task aborted"),
17006
+ CA("SVGA parser worker task aborted"),
16970
17007
  I
16971
17008
  );
16972
17009
  }, Dg.set(I, i), (E = A.signal) != null && E.aborted) {
@@ -17157,20 +17194,20 @@ function qo() {
17157
17194
  }
17158
17195
  async function vo(C, A, g) {
17159
17196
  const I = OA({ maxBudgetMs: A }), B = new Uint8Array(C.byteLength), Q = 64 * 1024;
17160
- L(g, "SVGA image decode aborted");
17197
+ J(g, "SVGA image decode aborted");
17161
17198
  for (let E = 0; E < C.byteLength; E += Q) {
17162
17199
  const e = Math.min(E + Q, C.byteLength);
17163
- B.set(C.subarray(E, e), E), e < C.byteLength && I.shouldYield() && await I.yield(), L(g, "SVGA image decode aborted");
17200
+ B.set(C.subarray(E, e), E), e < C.byteLength && I.shouldYield() && await I.yield(), J(g, "SVGA image decode aborted");
17164
17201
  }
17165
17202
  return B.buffer;
17166
17203
  }
17167
17204
  async function To(C, A, g = {}) {
17168
17205
  return GC(async () => {
17169
- L(g.signal, "SVGA image decode aborted");
17206
+ J(g.signal, "SVGA image decode aborted");
17170
17207
  const I = bo(), B = /* @__PURE__ */ new Map(), Q = Math.max(1, Math.min(256, Math.floor(A)));
17171
17208
  try {
17172
17209
  for (let E = 0; E < C.length; E += Q) {
17173
- L(g.signal, "SVGA image decode aborted");
17210
+ J(g.signal, "SVGA image decode aborted");
17174
17211
  const e = C.slice(E, E + Q), i = [], t = [];
17175
17212
  for (const [s, n] of e) {
17176
17213
  const r = await vo(
@@ -17191,7 +17228,7 @@ async function To(C, A, g = {}) {
17191
17228
  if (h.onAbort = () => {
17192
17229
  fB(
17193
17230
  I,
17194
- QA("SVGA image decode aborted"),
17231
+ CA("SVGA image decode aborted"),
17195
17232
  a
17196
17233
  );
17197
17234
  }, PI.set(a, h), (r = g.signal) != null && r.aborted) {
@@ -17215,7 +17252,7 @@ async function To(C, A, g = {}) {
17215
17252
  );
17216
17253
  }
17217
17254
  });
17218
- L(g.signal, "SVGA image decode aborted");
17255
+ J(g.signal, "SVGA image decode aborted");
17219
17256
  for (const s of o.results)
17220
17257
  s.bitmap && B.set(s.key, s.bitmap);
17221
17258
  }
@@ -17238,21 +17275,21 @@ function Zo(C, A) {
17238
17275
  }
17239
17276
  async function SB(C, A, g) {
17240
17277
  const I = OA({ maxBudgetMs: A }), B = new Uint8Array(C.byteLength), Q = 64 * 1024;
17241
- L(g, "SVGA parse aborted");
17278
+ J(g, "SVGA parse aborted");
17242
17279
  for (let E = 0; E < C.byteLength; E += Q) {
17243
17280
  const e = Math.min(E + Q, C.byteLength);
17244
- B.set(C.subarray(E, e), E), e < C.byteLength && I.shouldYield() && await I.yield(), L(g, "SVGA parse aborted");
17281
+ B.set(C.subarray(E, e), E), e < C.byteLength && I.shouldYield() && await I.yield(), J(g, "SVGA parse aborted");
17245
17282
  }
17246
17283
  return B.buffer;
17247
17284
  }
17248
17285
  async function Xo(C, A, g) {
17249
17286
  const I = [], B = /* @__PURE__ */ new Map(), Q = OA({ maxBudgetMs: A });
17250
17287
  for (const [E, e] of C.images) {
17251
- if (L(g, "SVGA image collection aborted"), Zo(E, e)) {
17288
+ if (J(g, "SVGA image collection aborted"), Zo(E, e)) {
17252
17289
  B.set(E, await SB(e, A, g));
17253
17290
  continue;
17254
17291
  }
17255
- e.length !== 0 && (I.push([E, e]), Q.shouldYield() && await Q.yield(), L(g, "SVGA image collection aborted"));
17292
+ e.length !== 0 && (I.push([E, e]), Q.shouldYield() && await Q.yield(), J(g, "SVGA image collection aborted"));
17256
17293
  }
17257
17294
  return { imageEntries: I, audioBlobs: B };
17258
17295
  }
@@ -17262,7 +17299,7 @@ async function pQ(C, A, g, I) {
17262
17299
  });
17263
17300
  try {
17264
17301
  for (let e = 0; e < C.length; e += Q) {
17265
- L(I, "SVGA image decode aborted");
17302
+ J(I, "SVGA image decode aborted");
17266
17303
  const i = C.slice(e, e + Q);
17267
17304
  await Promise.all(
17268
17305
  i.map(async ([t, a]) => {
@@ -17271,10 +17308,10 @@ async function pQ(C, A, g, I) {
17271
17308
  premultiplyAlpha: "none"
17272
17309
  });
17273
17310
  if (I != null && I.aborted)
17274
- throw o.close(), QA("SVGA image decode aborted");
17311
+ throw o.close(), CA("SVGA image decode aborted");
17275
17312
  B.set(t, o);
17276
17313
  } catch (o) {
17277
- if (Kg(o)) throw o;
17314
+ if (Mg(o)) throw o;
17278
17315
  }
17279
17316
  })
17280
17317
  ), e + Q < C.length && E.shouldYield() && await E.yield();
@@ -17294,7 +17331,7 @@ async function KQ(C, A, g) {
17294
17331
  });
17295
17332
  try {
17296
17333
  for (let i = 0; i < C.length; ) {
17297
- L(g, "SVGA image decode aborted");
17334
+ J(g, "SVGA image decode aborted");
17298
17335
  const t = typeof performance != "undefined" ? performance.now() : 0, a = Math.min(i + B, C.length), o = C.slice(i, a);
17299
17336
  await Promise.all(
17300
17337
  o.map(async ([r, c]) => {
@@ -17303,10 +17340,10 @@ async function KQ(C, A, g) {
17303
17340
  premultiplyAlpha: "none"
17304
17341
  });
17305
17342
  if (g != null && g.aborted)
17306
- throw h.close(), QA("SVGA image decode aborted");
17343
+ throw h.close(), CA("SVGA image decode aborted");
17307
17344
  I.set(r, h);
17308
17345
  } catch (h) {
17309
- if (Kg(h)) throw h;
17346
+ if (Mg(h)) throw h;
17310
17347
  }
17311
17348
  })
17312
17349
  );
@@ -17353,7 +17390,7 @@ async function Po(C, A) {
17353
17390
  signal: A == null ? void 0 : A.signal
17354
17391
  });
17355
17392
  } catch (i) {
17356
- if (Kg(i)) throw i;
17393
+ if (Mg(i)) throw i;
17357
17394
  console.warn("[GiftStage:SVGA] image decode worker failed, using main thread", i), E = I.imageDecodeAdaptiveOnMainThread ? await KQ(
17358
17395
  B,
17359
17396
  I.imageDecodeFrameBudgetMs,
@@ -17378,7 +17415,7 @@ async function Po(C, A) {
17378
17415
  );
17379
17416
  if ((g = A == null ? void 0 : A.signal) != null && g.aborted) {
17380
17417
  for (const i of E.values()) i.close();
17381
- throw QA("SVGA parse aborted");
17418
+ throw CA("SVGA parse aborted");
17382
17419
  }
17383
17420
  return { movie: C, imageBitmaps: E, audioBlobs: Q };
17384
17421
  }
@@ -17403,7 +17440,7 @@ function IC(C, A) {
17403
17440
  const Q = (e) => {
17404
17441
  B || (B = !0, A == null || A.removeEventListener("abort", E), C.consumers = Math.max(0, C.consumers - 1), C.consumers === 0 && !C.settled && C.controller.abort(), e());
17405
17442
  }, E = () => {
17406
- Q(() => I(QA("SVGA parse aborted")));
17443
+ Q(() => I(CA("SVGA parse aborted")));
17407
17444
  };
17408
17445
  if (A != null && A.aborted) {
17409
17446
  E();
@@ -17416,7 +17453,7 @@ function IC(C, A) {
17416
17453
  });
17417
17454
  }
17418
17455
  async function LE(C, A, g, I, B) {
17419
- if (L(B == null ? void 0 : B.signal, "SVGA parse aborted"), !A) {
17456
+ if (J(B == null ? void 0 : B.signal, "SVGA parse aborted"), !A) {
17420
17457
  const t = DB.get(C);
17421
17458
  if (t)
17422
17459
  return vg(t.params, t.spriteTable), t;
@@ -17432,7 +17469,7 @@ async function LE(C, A, g, I, B) {
17432
17469
  }
17433
17470
  const Q = new AbortController(), E = Q.signal, e = rC(async () => {
17434
17471
  var t;
17435
- if (L(E, "SVGA parse aborted"), I)
17472
+ if (J(E, "SVGA parse aborted"), I)
17436
17473
  try {
17437
17474
  const w = typeof C == "string" && g.byteOffset === 0 && g.byteLength === g.buffer.byteLength ? g.buffer : await SB(
17438
17475
  g,
@@ -17444,12 +17481,12 @@ async function LE(C, A, g, I, B) {
17444
17481
  mainThreadFrameBudgetMs: B == null ? void 0 : B.svgaLoadFrameBudgetMs,
17445
17482
  signal: E
17446
17483
  });
17447
- return L(E, "SVGA parse aborted"), vg(D.params, D.spriteTable), YQ(B == null ? void 0 : B.svgaParseProfile, D), A ? aQ(A, D) : DB.set(C, D), D;
17484
+ return J(E, "SVGA parse aborted"), vg(D.params, D.spriteTable), YQ(B == null ? void 0 : B.svgaParseProfile, D), A ? aQ(A, D) : DB.set(C, D), D;
17448
17485
  } catch (l) {
17449
- if (Kg(l)) throw l;
17450
- console.warn("[GiftStage:SVGA] worker parse failed, using main thread", l), g = typeof C == "string" ? new Uint8Array(await CI(C)) : new Uint8Array(C);
17486
+ if (Mg(l)) throw l;
17487
+ console.warn("[GiftStage:SVGA] worker parse failed, using main thread", l), g = typeof C == "string" ? new Uint8Array(await BI(C)) : new Uint8Array(C);
17451
17488
  }
17452
- L(E, "SVGA parse aborted");
17489
+ J(E, "SVGA parse aborted");
17453
17490
  const a = B != null && B.svgaParseProfile ? HA() : 0;
17454
17491
  let o;
17455
17492
  const s = await Io(
@@ -17459,11 +17496,11 @@ async function LE(C, A, g, I, B) {
17459
17496
  o = l;
17460
17497
  } : void 0
17461
17498
  );
17462
- L(E, "SVGA parse aborted");
17499
+ J(E, "SVGA parse aborted");
17463
17500
  let n, r, c, h;
17464
17501
  if (mI()) {
17465
17502
  const l = B != null && B.svgaParseProfile ? HA() : 0, w = B != null && B.svgaParseProfile ? wt(s) : null, D = (t = w == null ? void 0 : w.payload) != null ? t : Dt(s);
17466
- if (L(E, "SVGA parse aborted"), D) {
17503
+ if (J(E, "SVGA parse aborted"), D) {
17467
17504
  B != null && B.svgaParseProfile && (r = {
17468
17505
  path: "wasmDecodeSVGAPayload",
17469
17506
  operation: "protobufDecodeAndPayloadBuild",
@@ -17486,7 +17523,7 @@ async function LE(C, A, g, I, B) {
17486
17523
  } else {
17487
17524
  const y = B != null && B.svgaParseProfile ? HA() : 0;
17488
17525
  let R = lt(s);
17489
- if (L(E, "SVGA parse aborted"), B != null && B.svgaParseProfile && R)
17526
+ if (J(E, "SVGA parse aborted"), B != null && B.svgaParseProfile && R)
17490
17527
  r = {
17491
17528
  path: "wasmDecodeSVGA",
17492
17529
  operation: "protobufDecodeAndObjectConvert",
@@ -17496,7 +17533,7 @@ async function LE(C, A, g, I, B) {
17496
17533
  };
17497
17534
  else {
17498
17535
  const d = B != null && B.svgaParseProfile ? HA() : 0;
17499
- R = fQ(s), L(E, "SVGA parse aborted"), B != null && B.svgaParseProfile && (r = {
17536
+ R = fQ(s), J(E, "SVGA parse aborted"), B != null && B.svgaParseProfile && (r = {
17500
17537
  path: "jsDecodeSVGAProto",
17501
17538
  operation: "protobufDecode",
17502
17539
  inputBytes: s.byteLength,
@@ -17516,7 +17553,7 @@ async function LE(C, A, g, I, B) {
17516
17553
  }
17517
17554
  } else {
17518
17555
  const l = B != null && B.svgaParseProfile ? HA() : 0, w = fQ(s);
17519
- L(E, "SVGA parse aborted"), B != null && B.svgaParseProfile && (r = {
17556
+ J(E, "SVGA parse aborted"), B != null && B.svgaParseProfile && (r = {
17520
17557
  path: "jsDecodeSVGAProto",
17521
17558
  operation: "protobufDecode",
17522
17559
  inputBytes: s.byteLength,
@@ -17540,7 +17577,7 @@ async function LE(C, A, g, I, B) {
17540
17577
  payloadSerializeMs: c,
17541
17578
  payloadDeserializeMs: h
17542
17579
  }
17543
- }, YQ(!0, n)), L(E, "SVGA parse aborted"), A ? aQ(A, n) : DB.set(C, n), n;
17580
+ }, YQ(!0, n)), J(E, "SVGA parse aborted"), A ? aQ(A, n) : DB.set(C, n), n;
17544
17581
  }), i = {
17545
17582
  controller: Q,
17546
17583
  consumers: 0,
@@ -17552,11 +17589,11 @@ async function LE(C, A, g, I, B) {
17552
17589
  }), A ? sB.set(A, i) : nB.set(C, i), IC(i, B == null ? void 0 : B.signal);
17553
17590
  }
17554
17591
  async function jo(C, A) {
17555
- L(A == null ? void 0 : A.signal, "SVGA parse aborted");
17592
+ J(A == null ? void 0 : A.signal, "SVGA parse aborted");
17556
17593
  let g;
17557
17594
  const I = typeof C == "string" ? `svga-payload:${C}` : null;
17558
17595
  if (typeof C == "string") {
17559
- if (g = new Uint8Array(await CI(C)), L(A == null ? void 0 : A.signal, "SVGA parse aborted"), I) {
17596
+ if (g = new Uint8Array(await BI(C)), J(A == null ? void 0 : A.signal, "SVGA parse aborted"), I) {
17560
17597
  const E = MC(I);
17561
17598
  if (E) return E.params;
17562
17599
  }
@@ -17569,11 +17606,11 @@ async function jo(C, A) {
17569
17606
  return dC(A == null ? void 0 : A.svgaWorkerTaskConcurrency), (await LE(C, I, g, B, A)).params;
17570
17607
  }
17571
17608
  async function BC(C, A) {
17572
- L(A == null ? void 0 : A.signal, "SVGA parse aborted");
17609
+ J(A == null ? void 0 : A.signal, "SVGA parse aborted");
17573
17610
  let g;
17574
17611
  const I = typeof C == "string" ? `svga-payload:${C}` : null;
17575
17612
  if (typeof C == "string") {
17576
- if (g = new Uint8Array(await CI(C)), L(A == null ? void 0 : A.signal, "SVGA parse aborted"), I) {
17613
+ if (g = new Uint8Array(await BI(C)), J(A == null ? void 0 : A.signal, "SVGA parse aborted"), I) {
17577
17614
  const E = MC(I);
17578
17615
  if (E)
17579
17616
  return rC(
@@ -18087,7 +18124,7 @@ async function Qs(C, A) {
18087
18124
  return Promise.reject(new Error("SVGA atlas worker unavailable"));
18088
18125
  const g = await QE(A.signal);
18089
18126
  try {
18090
- L(A.signal, "SVGA atlas worker task aborted");
18127
+ J(A.signal, "SVGA atlas worker task aborted");
18091
18128
  const I = [], B = [];
18092
18129
  for (const [e, i] of C)
18093
18130
  I.push(e), B.push(i);
@@ -18112,7 +18149,7 @@ async function Qs(C, A) {
18112
18149
  MB(
18113
18150
  Q,
18114
18151
  new Wg("SVGA atlas worker task aborted", {
18115
- cause: QA("SVGA atlas worker task aborted")
18152
+ cause: CA("SVGA atlas worker task aborted")
18116
18153
  }),
18117
18154
  E
18118
18155
  );
@@ -18203,9 +18240,9 @@ async function ts(C, A, g, I, B) {
18203
18240
  const E = OA({
18204
18241
  maxBudgetMs: B == null ? void 0 : B.mainThreadFrameBudgetMs
18205
18242
  }), e = async () => {
18206
- L(B == null ? void 0 : B.signal, "SVGA atlas build aborted"), E.shouldYield() && await E.yield(), L(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18243
+ J(B == null ? void 0 : B.signal, "SVGA atlas build aborted"), E.shouldYield() && await E.yield(), J(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18207
18244
  };
18208
- L(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18245
+ J(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18209
18246
  const i = [];
18210
18247
  for (const [s, n] of C)
18211
18248
  i.push({ key: s, width: n.width, height: n.height }), await e();
@@ -18221,16 +18258,16 @@ async function ts(C, A, g, I, B) {
18221
18258
  const a = /* @__PURE__ */ new Map(), o = [];
18222
18259
  try {
18223
18260
  for (let s = 0; s < t.length; s++) {
18224
- L(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18261
+ J(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18225
18262
  const n = t[s], r = Es(n.atlasW, n.atlasH), c = es(r);
18226
18263
  if (!c) throw new Error("Atlas: 2d context unavailable");
18227
18264
  c.clearRect(0, 0, n.atlasW, n.atlasH);
18228
18265
  for (let w = 0; w < n.rects.length; w++) {
18229
18266
  const D = n.rects[w], y = C.get(D.key);
18230
- c.drawImage(y, D.x, D.y, D.w, D.h), gs(r, c, D, n.atlasW, n.atlasH, I), w + 1 < n.rects.length && E.shouldYield() && await E.yield(), L(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18267
+ c.drawImage(y, D.x, D.y, D.w, D.h), gs(r, c, D, n.atlasW, n.atlasH, I), w + 1 < n.rects.length && E.shouldYield() && await E.yield(), J(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18231
18268
  }
18232
18269
  const h = (B == null ? void 0 : B.captureEncodedPng) === !0 ? is(r) : void 0;
18233
- L(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18270
+ J(B == null ? void 0 : B.signal, "SVGA atlas build aborted");
18234
18271
  const l = A.createTexture(r, {
18235
18272
  width: n.atlasW,
18236
18273
  height: n.atlasH,
@@ -18281,7 +18318,7 @@ async function as(C, A, g, I, B) {
18281
18318
  });
18282
18319
  try {
18283
18320
  for (let a = 0; a < E.pages.length; a++) {
18284
- L(B == null ? void 0 : B.signal, "SVGA atlas upload aborted");
18321
+ J(B == null ? void 0 : B.signal, "SVGA atlas upload aborted");
18285
18322
  const o = E.pages[a], s = A.createTexture(o.bitmap, {
18286
18323
  width: o.width,
18287
18324
  height: o.height,
@@ -18298,7 +18335,7 @@ async function as(C, A, g, I, B) {
18298
18335
  atlasWidth: o.width,
18299
18336
  atlasHeight: o.height,
18300
18337
  encodedPngBytesPromise: (B == null ? void 0 : B.captureEncodedPng) === !0 ? o.pngBytesPromise : void 0
18301
- }), a + 1 < E.pages.length && t.shouldYield() && await t.yield(), L(B == null ? void 0 : B.signal, "SVGA atlas upload aborted");
18338
+ }), a + 1 < E.pages.length && t.shouldYield() && await t.yield(), J(B == null ? void 0 : B.signal, "SVGA atlas upload aborted");
18302
18339
  }
18303
18340
  } catch (a) {
18304
18341
  for (const o of E.pages)
@@ -18346,7 +18383,7 @@ function qE() {
18346
18383
  throw rB = null, C;
18347
18384
  })), rB;
18348
18385
  }
18349
- var ns = Object.defineProperty, rs = (C, A, g) => A in C ? ns(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, eg = (C, A, g) => rs(C, typeof A != "symbol" ? A + "" : A, g);
18386
+ var ns = Object.defineProperty, rs = (C, A, g) => A in C ? ns(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, Eg = (C, A, g) => rs(C, typeof A != "symbol" ? A + "" : A, g);
18350
18387
  const cs = 800;
18351
18388
  function hs(C) {
18352
18389
  return C.startsWith("avc1") || C.startsWith("avc3");
@@ -18450,7 +18487,7 @@ async function Fs(C, A) {
18450
18487
  }
18451
18488
  class ds {
18452
18489
  constructor(A, g, I, B, Q, E, e, i) {
18453
- this.decodeOrder = A, this.presTimes = g, this.timescale = I, this.codec = B, this.description = Q, this.duration = E, this.callbacks = e, eg(this, "decoder", null), eg(this, "nextChunk", 0), eg(this, "chunksFed", 0), eg(this, "targetNeedIdx"), eg(this, "lastPostedMax", -1), eg(this, "minPosted", Number.POSITIVE_INFINITY), eg(this, "playbackNeedFloor"), eg(this, "freeSlots", 0), eg(this, "eosClosed", !1), eg(this, "pumpScheduled", !1), eg(this, "pumping", !1), eg(this, "destroyed", !1), eg(this, "onDecoderDequeue", () => this.schedulePump()), this.targetNeedIdx = i, this.playbackNeedFloor = nI(g, E, 0), this.freeSlots = Math.max(1, i - this.playbackNeedFloor + 1), this.schedulePump();
18490
+ this.decodeOrder = A, this.presTimes = g, this.timescale = I, this.codec = B, this.description = Q, this.duration = E, this.callbacks = e, Eg(this, "decoder", null), Eg(this, "nextChunk", 0), Eg(this, "chunksFed", 0), Eg(this, "targetNeedIdx"), Eg(this, "lastPostedMax", -1), Eg(this, "minPosted", Number.POSITIVE_INFINITY), Eg(this, "playbackNeedFloor"), Eg(this, "freeSlots", 0), Eg(this, "eosClosed", !1), Eg(this, "pumpScheduled", !1), Eg(this, "pumping", !1), Eg(this, "destroyed", !1), Eg(this, "onDecoderDequeue", () => this.schedulePump()), this.targetNeedIdx = i, this.playbackNeedFloor = nI(g, E, 0), this.freeSlots = Math.max(1, i - this.playbackNeedFloor + 1), this.schedulePump();
18454
18491
  }
18455
18492
  /** Raise the decode target and/or update main-thread ring headroom; resumes the pump if idle. */
18456
18493
  ensure(A, g) {
@@ -19008,7 +19045,7 @@ class rI {
19008
19045
  }
19009
19046
  }
19010
19047
  async function ms(C, A) {
19011
- return CI(C, A);
19048
+ return BI(C, A);
19012
19049
  }
19013
19050
  function vQ(C, A, g, I, B) {
19014
19051
  const Q = Math.max(1, Math.floor(A)), E = Math.max(1, Math.floor(g)), e = Math.max(1, C.width * rg(C)), i = Math.max(1, C.height * cg(C));
@@ -19021,7 +19058,7 @@ function vQ(C, A, g, I, B) {
19021
19058
  else {
19022
19059
  if (!B)
19023
19060
  return t = Math.min(1, e / Q, i / E), EC(Q, E, t);
19024
- ({ w: o, h: s } = II(B.info));
19061
+ ({ w: o, h: s } = gI(B.info));
19025
19062
  }
19026
19063
  if (!(o > 0) || !(s > 0))
19027
19064
  return t = Math.min(1, e / Q, i / E), EC(Q, E, t);
@@ -19035,7 +19072,7 @@ function EC(C, A, g) {
19035
19072
  const I = Math.max(1, Math.min(C, Math.ceil(C * g))), B = Math.max(1, Math.min(A, Math.ceil(A * g)));
19036
19073
  return { w: I, h: B };
19037
19074
  }
19038
- var Js = Object.defineProperty, Ls = (C, A, g) => A in C ? Js(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, ig = (C, A, g) => Ls(C, typeof A != "symbol" ? A + "" : A, g);
19075
+ var Js = Object.defineProperty, Ls = (C, A, g) => A in C ? Js(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, eg = (C, A, g) => Ls(C, typeof A != "symbol" ? A + "" : A, g);
19039
19076
  const zI = 9;
19040
19077
  function Hs(C, A) {
19041
19078
  if (typeof document == "undefined" || typeof document.createElement != "function")
@@ -19210,7 +19247,7 @@ function Ws(C, A, g, I, B = new Float32Array(
19210
19247
  }
19211
19248
  class Vs {
19212
19249
  constructor(A, g, I, B, Q, E = !0) {
19213
- this.config = A, this.frameMap = g, ig(this, "canvas"), ig(this, "gl"), ig(this, "program"), ig(this, "vertexShader"), ig(this, "fragmentShader"), ig(this, "vertexBuffer"), ig(this, "videoTexture"), ig(this, "imagePosLoc"), ig(this, "imagePositionsScratch"), ig(this, "resourceEntries"), ig(this, "textureUnitBySrcId", /* @__PURE__ */ new Map()), ig(this, "videoTextureWidth", 1), ig(this, "videoTextureHeight", 1);
19250
+ this.config = A, this.frameMap = g, eg(this, "canvas"), eg(this, "gl"), eg(this, "program"), eg(this, "vertexShader"), eg(this, "fragmentShader"), eg(this, "vertexBuffer"), eg(this, "videoTexture"), eg(this, "imagePosLoc"), eg(this, "imagePositionsScratch"), eg(this, "resourceEntries"), eg(this, "textureUnitBySrcId", /* @__PURE__ */ new Map()), eg(this, "videoTextureWidth", 1), eg(this, "videoTextureHeight", 1);
19214
19251
  var e;
19215
19252
  if (I.size === 0) throw new Error("VAP mix composer requires at least one slot resource");
19216
19253
  this.canvas = Hs(B, Q);
@@ -19300,14 +19337,14 @@ class Vs {
19300
19337
  g == null || g.loseContext();
19301
19338
  }
19302
19339
  }
19303
- var Zs = Object.defineProperty, Xs = (C, A, g) => A in C ? Zs(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, pg = (C, A, g) => Xs(C, typeof A != "symbol" ? A + "" : A, g);
19304
- const vE = 1397178947, TE = 14, Os = 8, kg = 64 * 1024;
19340
+ var Zs = Object.defineProperty, Xs = (C, A, g) => A in C ? Zs(C, A, { enumerable: !0, configurable: !0, writable: !0, value: g }) : C[A] = g, Kg = (C, A, g) => Xs(C, typeof A != "symbol" ? A + "" : A, g);
19341
+ const vE = 1397178947, TE = 14, Os = 8, Yg = 64 * 1024;
19305
19342
  function WE(C) {
19306
19343
  return C + 3 & -4;
19307
19344
  }
19308
19345
  class Ps {
19309
19346
  constructor(A = 1024) {
19310
- pg(this, "buffer"), pg(this, "view"), pg(this, "bytes"), pg(this, "offset", 0), pg(this, "encoder", new TextEncoder()), this.buffer = new ArrayBuffer(A), this.view = new DataView(this.buffer), this.bytes = new Uint8Array(this.buffer);
19347
+ Kg(this, "buffer"), Kg(this, "view"), Kg(this, "bytes"), Kg(this, "offset", 0), Kg(this, "encoder", new TextEncoder()), this.buffer = new ArrayBuffer(A), this.view = new DataView(this.buffer), this.bytes = new Uint8Array(this.buffer);
19311
19348
  }
19312
19349
  ensure(A) {
19313
19350
  const g = this.offset + A;
@@ -19323,8 +19360,8 @@ class Ps {
19323
19360
  let B = this.buffer.byteLength;
19324
19361
  for (; B < I; ) B *= 2;
19325
19362
  const Q = new ArrayBuffer(B), E = new Uint8Array(Q);
19326
- for (let e = 0; e < this.offset; e += kg) {
19327
- const i = Math.min(e + kg, this.offset);
19363
+ for (let e = 0; e < this.offset; e += Yg) {
19364
+ const i = Math.min(e + Yg, this.offset);
19328
19365
  E.set(this.bytes.subarray(e, i), e), i < this.offset && await (g == null ? void 0 : g());
19329
19366
  }
19330
19367
  this.buffer = Q, this.view = new DataView(this.buffer), this.bytes = E;
@@ -19355,8 +19392,8 @@ class Ps {
19355
19392
  }
19356
19393
  async rawBytesCooperative(A, g) {
19357
19394
  await this.ensureCooperative(A.byteLength, g);
19358
- for (let I = 0; I < A.byteLength; I += kg) {
19359
- const B = Math.min(I + kg, A.byteLength);
19395
+ for (let I = 0; I < A.byteLength; I += Yg) {
19396
+ const B = Math.min(I + Yg, A.byteLength);
19360
19397
  this.bytes.set(A.subarray(I, B), this.offset), this.offset += B - I, B < A.byteLength && await (g == null ? void 0 : g());
19361
19398
  }
19362
19399
  }
@@ -19375,8 +19412,8 @@ class Ps {
19375
19412
  }
19376
19413
  async finishCooperative(A) {
19377
19414
  const g = new Uint8Array(this.offset), I = this.bytes.subarray(0, this.offset);
19378
- for (let B = 0; B < I.byteLength; B += kg) {
19379
- const Q = Math.min(B + kg, I.byteLength);
19415
+ for (let B = 0; B < I.byteLength; B += Yg) {
19416
+ const Q = Math.min(B + Yg, I.byteLength);
19380
19417
  g.set(I.subarray(B, Q), B), Q < I.byteLength && A.shouldYield() && await A.yield();
19381
19418
  }
19382
19419
  return g.buffer;
@@ -19384,7 +19421,7 @@ class Ps {
19384
19421
  }
19385
19422
  class js {
19386
19423
  constructor(A) {
19387
- this.buffer = A, pg(this, "view"), pg(this, "bytes"), pg(this, "offset", 0), pg(this, "decoder", new TextDecoder()), this.view = new DataView(A), this.bytes = new Uint8Array(A);
19424
+ this.buffer = A, Kg(this, "view"), Kg(this, "bytes"), Kg(this, "offset", 0), Kg(this, "decoder", new TextDecoder()), this.view = new DataView(A), this.bytes = new Uint8Array(A);
19388
19425
  }
19389
19426
  get position() {
19390
19427
  return this.offset;
@@ -19423,8 +19460,8 @@ class js {
19423
19460
  const g = this.u32(), I = this.bytes.subarray(this.offset, this.offset + g);
19424
19461
  this.offset += g;
19425
19462
  const B = new Uint8Array(g);
19426
- for (let Q = 0; Q < g; Q += kg) {
19427
- const E = Math.min(Q + kg, g);
19463
+ for (let Q = 0; Q < g; Q += Yg) {
19464
+ const E = Math.min(Q + Yg, g);
19428
19465
  B.set(I.subarray(Q, E), Q), E < g && A.shouldYield() && await A.yield();
19429
19466
  }
19430
19467
  return B.buffer;
@@ -19459,7 +19496,7 @@ async function ng(C) {
19459
19496
  }
19460
19497
  async function zs(C, A) {
19461
19498
  var g, I, B;
19462
- const Q = C.spriteTable, E = OA({ maxBudgetMs: A }), e = () => ng(E), i = new Ps(Os + VE(C) + kg);
19499
+ const Q = C.spriteTable, E = OA({ maxBudgetMs: A }), e = () => ng(E), i = new Ps(Os + VE(C) + Yg);
19463
19500
  i.u32(vE), i.u16(TE), i.u16(
19464
19501
  Q.allFramesInsideViewBox === void 0 ? 0 : 2 | (Q.allFramesInsideViewBox ? 1 : 0)
19465
19502
  ), i.f32(C.params.viewBoxWidth), i.f32(C.params.viewBoxHeight), i.f32(C.params.fps), i.u32(C.params.frames), i.u32(C.atlasPages.length);
@@ -19623,7 +19660,7 @@ function VQ(C, A) {
19623
19660
  A == null || A.removeEventListener("abort", i), Q.onload = null, Q.onerror = null;
19624
19661
  }, e = (t) => {
19625
19662
  E(), URL.revokeObjectURL(B), I(t);
19626
- }, i = () => e(QA("Image decoding aborted"));
19663
+ }, i = () => e(CA("Image decoding aborted"));
19627
19664
  Q.onload = () => {
19628
19665
  E();
19629
19666
  const t = Q.naturalWidth || Q.width, a = Q.naturalHeight || Q.height;
@@ -19642,24 +19679,24 @@ function VQ(C, A) {
19642
19679
  });
19643
19680
  }
19644
19681
  async function eC(C, A) {
19645
- L(A, "Image loading aborted");
19646
- const g = typeof C == "string" ? await CI(C, A) : C;
19647
- L(A, "Image loading aborted");
19682
+ J(A, "Image loading aborted");
19683
+ const g = typeof C == "string" ? await BI(C, A) : C;
19684
+ J(A, "Image loading aborted");
19648
19685
  const I = new Uint8Array(g), B = new Blob([I], { type: In(C, I) });
19649
19686
  if (typeof createImageBitmap == "function") {
19650
19687
  let Q = null;
19651
19688
  try {
19652
19689
  Q = await createImageBitmap(B, { premultiplyAlpha: "premultiply" });
19653
19690
  } catch (E) {
19654
- L(A, "Image decoding aborted");
19691
+ J(A, "Image decoding aborted");
19655
19692
  try {
19656
19693
  Q = await createImageBitmap(B);
19657
19694
  } catch (e) {
19658
- return L(A, "Image decoding aborted"), VQ(B, A);
19695
+ return J(A, "Image decoding aborted"), VQ(B, A);
19659
19696
  }
19660
19697
  }
19661
19698
  if (A != null && A.aborted)
19662
- throw Q.close(), QA("Image decoding aborted");
19699
+ throw Q.close(), CA("Image decoding aborted");
19663
19700
  if (Q.width <= 0 || Q.height <= 0)
19664
19701
  throw Q.close(), new Error("Decoded image has invalid dimensions");
19665
19702
  return {
@@ -19684,18 +19721,18 @@ function ZE(C, A, g) {
19684
19721
  }
19685
19722
  function Bn(C, A) {
19686
19723
  var g;
19687
- if (C.length % _g !== 0)
19724
+ if (C.length % zg !== 0)
19688
19725
  throw new RangeError(
19689
- `SVGA frameData length must be a multiple of ${_g}, got ${C.length}`
19726
+ `SVGA frameData length must be a multiple of ${zg}, got ${C.length}`
19690
19727
  );
19691
- const I = C.length / _g, B = I * BI, Q = A != null ? A : new Float32Array(B);
19728
+ const I = C.length / zg, B = I * II, Q = A != null ? A : new Float32Array(B);
19692
19729
  if (Q.length < B)
19693
19730
  throw new RangeError(
19694
19731
  `SVGA packed output is too small: need ${B} floats, got ${Q.length}`
19695
19732
  );
19696
19733
  for (let E = 0; E < I; E++) {
19697
- const e = E * _g, i = E * BI;
19698
- for (let t = 0; t < _g; t++)
19734
+ const e = E * zg, i = E * II;
19735
+ for (let t = 0; t < zg; t++)
19699
19736
  Q[i + t] = (g = C[e + t]) != null ? g : 0;
19700
19737
  Q[i + 9] = 0, Q[i + 10] = 0, Q[i + 11] = 0;
19701
19738
  }
@@ -19704,8 +19741,8 @@ function Bn(C, A) {
19704
19741
  function Un(C, A) {
19705
19742
  return Bn(C, A);
19706
19743
  }
19707
- function KB(C, A, g = BI) {
19708
- const I = FI(C) ? C : 0, B = FI(A) ? A : 0, Q = FI(g) ? g : BI;
19744
+ function KB(C, A, g = II) {
19745
+ const I = FI(C) ? C : 0, B = FI(A) ? A : 0, Q = FI(g) ? g : II;
19709
19746
  return ZE(I, B, Q) * Float32Array.BYTES_PER_ELEMENT;
19710
19747
  }
19711
19748
  function kn(C, A, g = uC) {
@@ -19796,7 +19833,7 @@ function XQ(C) {
19796
19833
  C,
19797
19834
  "device-capability"
19798
19835
  );
19799
- const c = (e = C.frameDataLength) != null ? e : i == null ? void 0 : i.frameData.length, h = ZE(t, a, _g);
19836
+ const c = (e = C.frameDataLength) != null ? e : i == null ? void 0 : i.frameData.length, h = ZE(t, a, zg);
19800
19837
  if (t <= 0 || a <= 0 || !Number.isFinite(h) || c != null && c !== h)
19801
19838
  return ug(
19802
19839
  "cpu-reference",
@@ -20124,7 +20161,7 @@ function hn(C) {
20124
20161
  const lA = "GiftStage load canceled";
20125
20162
  class jQ extends Error {
20126
20163
  }
20127
- function Mg(C) {
20164
+ function Ng(C) {
20128
20165
  let A = !1;
20129
20166
  return () => {
20130
20167
  A || (A = !0, C());
@@ -20212,7 +20249,7 @@ const Fg = class _A {
20212
20249
  if (!this.isSlotLoadActive(A)) throw new Error(lA);
20213
20250
  }
20214
20251
  isLoadCanceled(A) {
20215
- return Kg(A) || A instanceof Error && A.message === lA;
20252
+ return Mg(A) || A instanceof Error && A.message === lA;
20216
20253
  }
20217
20254
  currentCanvasCssSize() {
20218
20255
  const A = this.canvas.clientWidth || this.options.container.clientWidth || window.innerWidth || 0, g = this.canvas.clientHeight || this.options.container.clientHeight || window.innerHeight || 0;
@@ -20229,7 +20266,7 @@ const Fg = class _A {
20229
20266
  }
20230
20267
  case "vap": {
20231
20268
  if (!A.config) throw new Error("VAP requires config");
20232
- const I = await oQ(A.config), B = II(I.info);
20269
+ const I = await oQ(A.config), B = gI(I.info);
20233
20270
  return { width: B.w, height: B.h };
20234
20271
  }
20235
20272
  case "alphaVideo":
@@ -20355,7 +20392,7 @@ const Fg = class _A {
20355
20392
  getGiftRenderInfo(A) {
20356
20393
  var g, I, B, Q, E, e, i, t, a, o, s, n, r, c, h, l, w, D, y, R, F, d, f, u, G, S;
20357
20394
  if (A.type !== "svga") return null;
20358
- const M = A.videoEntity, N = (I = (g = A.svgaFrameTableState) != null ? g : M == null ? void 0 : M.svgaFrameTableState) != null ? I : null, U = M == null ? void 0 : M.spriteTable, p = M ? (Q = (B = M.atlasTextureHandles) == null ? void 0 : B.length) != null ? Q : M.atlasTextureHandle ? 1 : 0 : 0, k = M && (i = (e = (E = this.manager) == null ? void 0 : E.countCompatibleSVGAInstances) == null ? void 0 : e.call(E, M)) != null ? i : 0;
20395
+ const M = A.videoEntity, N = (I = (g = A.svgaFrameTableState) != null ? g : M == null ? void 0 : M.svgaFrameTableState) != null ? I : null, U = M == null ? void 0 : M.spriteTable, K = M ? (Q = (B = M.atlasTextureHandles) == null ? void 0 : B.length) != null ? Q : M.atlasTextureHandle ? 1 : 0 : 0, k = M && (i = (e = (E = this.manager) == null ? void 0 : E.countCompatibleSVGAInstances) == null ? void 0 : e.call(E, M)) != null ? i : 0;
20359
20396
  if (N) {
20360
20397
  const m = N.renderInfo.selectedPath, H = m === "cpu-reference", v = (t = N.renderInfo.frameTableBytes) != null ? t : N.renderInfo.tableBytes, j = (s = (o = (a = M == null ? void 0 : M.svgaHybridCommandTable) == null ? void 0 : a.byteLength) != null ? o : N.renderInfo.commandTableBytes) != null ? s : 0;
20361
20398
  return {
@@ -20367,7 +20404,7 @@ const Fg = class _A {
20367
20404
  spriteCount: (h = U == null ? void 0 : U.spriteCount) != null ? h : N.renderInfo.spriteCount,
20368
20405
  frameCount: (l = U == null ? void 0 : U.frameCount) != null ? l : N.renderInfo.frameCount,
20369
20406
  compatibleInstanceCount: k,
20370
- atlasPageCount: p,
20407
+ atlasPageCount: K,
20371
20408
  tableBytes: N.renderInfo.tableBytes,
20372
20409
  frameTableBytes: v,
20373
20410
  commandTableBytes: j,
@@ -20388,7 +20425,7 @@ const Fg = class _A {
20388
20425
  spriteCount: (u = U == null ? void 0 : U.spriteCount) != null ? u : 0,
20389
20426
  frameCount: (G = U == null ? void 0 : U.frameCount) != null ? G : 0,
20390
20427
  compatibleInstanceCount: k,
20391
- atlasPageCount: p,
20428
+ atlasPageCount: K,
20392
20429
  tableBytes: 0,
20393
20430
  frameTableBytes: 0,
20394
20431
  commandTableBytes: 0,
@@ -20418,7 +20455,7 @@ const Fg = class _A {
20418
20455
  }
20419
20456
  async addGift(A) {
20420
20457
  var g, I, B, Q, E, e, i, t, a, o, s, n;
20421
- if (console.info("[GiftStage] addGift await ready…", A.type), await this.ready, L(A.signal, lA), console.info("[GiftStage] addGift ready, loading…", A.type), this.destroyed) throw new Error("GiftStage is destroyed");
20458
+ if (console.info("[GiftStage] addGift await ready…", A.type), await this.ready, J(A.signal, lA), console.info("[GiftStage] addGift ready, loading…", A.type), this.destroyed) throw new Error("GiftStage is destroyed");
20422
20459
  let r = null;
20423
20460
  A.type === "image" && (r = await this.acquireImageTexture(A.source, A.signal));
20424
20461
  let c;
@@ -20501,7 +20538,7 @@ const Fg = class _A {
20501
20538
  resume: () => {
20502
20539
  var u, G, S, M, N;
20503
20540
  if (F.paused = !1, (u = this.manager) == null || u.postAnimator.resumeForGift(F.id), (G = this.manager) == null || G.invalidate({ resetClock: !0 }), (S = this.manager) == null || S.syncVideoPlaybackForSlot(F), F.type === "svga" && F.videoEntity && !F.playbackScopeControlled) {
20504
- const U = F.videoEntity.params.fps, p = F.videoEntity.params.frames, k = F.loopCount * p + F.currentFrame + F.accumulatedTime * U;
20541
+ const U = F.videoEntity.params.fps, K = F.videoEntity.params.frames, k = F.loopCount * K + F.currentFrame + F.accumulatedTime * U;
20505
20542
  (M = this.manager) == null || M.audioManager.syncPlaybackScopeFrame(F, k), F.svgaInitialFrameEmitted !== !0 && ((N = F.onFrame) == null || N.call(F, F.currentFrame, d), F.svgaInitialFrameEmitted = !0);
20506
20543
  }
20507
20544
  F.videoElement && !F.releaseSharedVideoPlayback && this.armHtmlVideoPlaybackWatchdog(F, F.videoElement);
@@ -20568,7 +20605,7 @@ const Fg = class _A {
20568
20605
  atlasRects: (Q = o == null ? void 0 : o.rects) != null ? Q : /* @__PURE__ */ new Map(),
20569
20606
  audioBuffers: /* @__PURE__ */ new Map()
20570
20607
  };
20571
- await this.finishLoadSVGA(A, n, a), A.releaseSharedSVGAAsset = Mg(() => this.deleteSVGAAtlasTextures(n)), s = !0, this.assertSlotLoadActive(A), E && (o != null && o.encodedPngBytesPromises) && Promise.all(o.encodedPngBytesPromises).then((r) => {
20608
+ await this.finishLoadSVGA(A, n, a), A.releaseSharedSVGAAsset = Ng(() => this.deleteSVGAAtlasTextures(n)), s = !0, this.assertSlotLoadActive(A), E && (o != null && o.encodedPngBytesPromises) && Promise.all(o.encodedPngBytesPromises).then((r) => {
20572
20609
  r.some((c) => !c) || cB(
20573
20610
  E,
20574
20611
  {
@@ -20638,7 +20675,7 @@ const Fg = class _A {
20638
20675
  const E = (i) => {
20639
20676
  Q || (Q = !0, g == null || g.removeEventListener("abort", e), A.consumers = Math.max(0, A.consumers - 1), A.consumers === 0 && !A.settled && A.controller.abort(), i());
20640
20677
  }, e = () => {
20641
- E(() => B(QA(lA)));
20678
+ E(() => B(CA(lA)));
20642
20679
  };
20643
20680
  if (g != null && g.aborted) {
20644
20681
  e();
@@ -20655,7 +20692,7 @@ const Fg = class _A {
20655
20692
  const t = await $s(A, {
20656
20693
  frameBudgetMs: this.options.svgaLoadFrameBudgetMs
20657
20694
  });
20658
- if (L(g, lA), t) {
20695
+ if (J(g, lA), t) {
20659
20696
  const s = await this.createCachedSVGAAtlasTextures(t.atlasPages, g);
20660
20697
  try {
20661
20698
  await ((I = this.manager) == null ? void 0 : I.hydrateSVGAClipMeshesCooperative(t.clipMeshes, { frameBudgetMs: this.options.svgaLoadFrameBudgetMs, signal: g }));
@@ -20696,7 +20733,7 @@ const Fg = class _A {
20696
20733
  try {
20697
20734
  o = await this.buildSVGAAtlasIfNeeded(a.imageBitmaps, !0, !0, g);
20698
20735
  } catch (c) {
20699
- if (Kg(c) || !(c instanceof Wg)) throw c;
20736
+ if (Mg(c) || !(c instanceof Wg)) throw c;
20700
20737
  for (const h of a.imageBitmaps.values()) h.close();
20701
20738
  a = await BC(A, this.svgaParseOptions(g)), o = await this.buildSVGAAtlasIfNeeded(a.imageBitmaps, !0, !1, g);
20702
20739
  }
@@ -20709,7 +20746,7 @@ const Fg = class _A {
20709
20746
  atlasRects: (i = o == null ? void 0 : o.rects) != null ? i : /* @__PURE__ */ new Map(),
20710
20747
  audioBuffers: /* @__PURE__ */ new Map()
20711
20748
  };
20712
- if (L(g, lA), o && o.encodedPngBytesPromises) {
20749
+ if (J(g, lA), o && o.encodedPngBytesPromises) {
20713
20750
  const c = o, h = o.encodedPngBytesPromises;
20714
20751
  this.svgaPersistentCacheWriters.set(r, async (l) => {
20715
20752
  const w = await Promise.all(h);
@@ -20746,7 +20783,7 @@ const Fg = class _A {
20746
20783
  { frameBudgetMs: this.options.svgaLoadFrameBudgetMs }
20747
20784
  );
20748
20785
  });
20749
- return L(g, lA), {
20786
+ return J(g, lA), {
20750
20787
  entity: r,
20751
20788
  audioBlobs: n
20752
20789
  };
@@ -20771,7 +20808,7 @@ const Fg = class _A {
20771
20808
  );
20772
20809
  try {
20773
20810
  for (let e = 0; e < A.length; e++) {
20774
- L(g, lA);
20811
+ J(g, lA);
20775
20812
  const i = A[e], t = await E[e];
20776
20813
  try {
20777
20814
  if (this.destroyed || !this.backend) throw new Error(lA);
@@ -20786,7 +20823,7 @@ const Fg = class _A {
20786
20823
  } finally {
20787
20824
  t.close();
20788
20825
  }
20789
- e + 1 < A.length && Q.shouldYield() && await Q.yield(), L(g, lA);
20826
+ e + 1 < A.length && Q.shouldYield() && await Q.yield(), J(g, lA);
20790
20827
  }
20791
20828
  return B;
20792
20829
  } catch (e) {
@@ -20966,7 +21003,7 @@ const Fg = class _A {
20966
21003
  profile: r
20967
21004
  }), U = N.commandTable;
20968
21005
  this.assertSVGAFrameTableActive(A);
20969
- const p = S + G.metadata.byteLength, k = (w = U == null ? void 0 : U.byteLength) != null ? w : 0, m = p + k, H = this.svgaGpuFrameTableBudgetBytes();
21006
+ const K = S + G.metadata.byteLength, k = (w = U == null ? void 0 : U.byteLength) != null ? w : 0, m = K + k, H = this.svgaGpuFrameTableBudgetBytes();
20970
21007
  if (!Number.isFinite(m) || !G.runs.length && !u.hasAnyShapes) {
20971
21008
  const b = !G.runs.length && !u.hasAnyShapes ? "validation-failed" : "table-too-large-or-budget";
20972
21009
  s.renderInfo = {
@@ -21018,7 +21055,7 @@ const Fg = class _A {
21018
21055
  budgetBytes: H,
21019
21056
  atlasPageCount: G.atlasPageCount
21020
21057
  });
21021
- if (T.tableBytes = m, T.frameTableBytes = p, T.commandTableBytes = k, T.selectedPath === "gpu-hybrid" && (A.svgaHybridCommandTable = U, await this.ensureSVGAHybridSchedulePrepared(A), this.destroyed || this.svgaBackendLost || this.releasedSVGATimelineEntities.has(A))) {
21058
+ if (T.tableBytes = m, T.frameTableBytes = K, T.commandTableBytes = k, T.selectedPath === "gpu-hybrid" && (A.svgaHybridCommandTable = U, await this.ensureSVGAHybridSchedulePrepared(A), this.destroyed || this.svgaBackendLost || this.releasedSVGATimelineEntities.has(A))) {
21022
21059
  (y = e.deleteSVGAFrameTable) == null || y.call(e, f), this.rollbackSVGAFrameTableReservation(A);
21023
21060
  return;
21024
21061
  }
@@ -21273,8 +21310,8 @@ const Fg = class _A {
21273
21310
  var I, B;
21274
21311
  const Q = (I = this.svgaPersistentCacheWriters) == null ? void 0 : I.get(A);
21275
21312
  if (!Q || (B = this.svgaPersistentCacheWritePromises) != null && B.has(A)) return;
21276
- const E = g.then(() => Q(this.manager.snapshotSVGAClipMeshes(A))).catch((e) => {
21277
- console.warn("[GiftStage:SVGA] persistent cache write failed", e);
21313
+ const E = g.then(() => (this.assertSVGAFrameTableActive(A), Q(this.manager.snapshotSVGAClipMeshes(A)))).catch((e) => {
21314
+ this.isLoadCanceled(e) || console.warn("[GiftStage:SVGA] persistent cache write failed", e);
21278
21315
  });
21279
21316
  this.svgaPersistentCacheWritePromises.set(A, E);
21280
21317
  }
@@ -21316,7 +21353,7 @@ const Fg = class _A {
21316
21353
  async tryWebCodecsPlayback(A, g) {
21317
21354
  if (!this.shouldTryWebCodecs()) return null;
21318
21355
  try {
21319
- const I = typeof A == "string" ? await CI(A, g) : A;
21356
+ const I = typeof A == "string" ? await BI(A, g) : A;
21320
21357
  if (g != null && g.aborted) throw new Error(lA);
21321
21358
  return await rI.create(I, g, {
21322
21359
  useWorker: this.options.webCodecsDecodeInWorker !== !1,
@@ -21341,7 +21378,7 @@ const Fg = class _A {
21341
21378
  return I ? {
21342
21379
  playback: I,
21343
21380
  sharedState: null,
21344
- release: Mg(() => I.destroy())
21381
+ release: Ng(() => I.destroy())
21345
21382
  } : null;
21346
21383
  }
21347
21384
  async acquireSharedWebCodecsPlayback(A, g) {
@@ -21356,7 +21393,7 @@ const Fg = class _A {
21356
21393
  return t.refs++, {
21357
21394
  playback: t.playback,
21358
21395
  sharedState: t,
21359
- release: Mg(() => this.releaseSharedWebCodecsPlayback(t))
21396
+ release: Ng(() => this.releaseSharedWebCodecsPlayback(t))
21360
21397
  };
21361
21398
  }
21362
21399
  let e = this.pendingSharedWebCodecsPlaybacks.get(A);
@@ -21365,7 +21402,7 @@ const Fg = class _A {
21365
21402
  return i ? (i.refs++, {
21366
21403
  playback: i.playback,
21367
21404
  sharedState: i,
21368
- release: Mg(() => this.releaseSharedWebCodecsPlayback(i))
21405
+ release: Ng(() => this.releaseSharedWebCodecsPlayback(i))
21369
21406
  }) : null;
21370
21407
  }
21371
21408
  createPendingSharedWebCodecsPlayback(A) {
@@ -21486,7 +21523,7 @@ const Fg = class _A {
21486
21523
  const g = this.sharedWebCodecsSurfaces.get(A);
21487
21524
  return g ? (g.refs++, {
21488
21525
  surface: g.surface,
21489
- release: Mg(() => this.releaseSharedWebCodecsSurface(g))
21526
+ release: Ng(() => this.releaseSharedWebCodecsSurface(g))
21490
21527
  }) : null;
21491
21528
  }
21492
21529
  createSharedWebCodecsSurface(A, g, I, B, Q, E) {
@@ -21503,7 +21540,7 @@ const Fg = class _A {
21503
21540
  };
21504
21541
  return this.sharedWebCodecsSurfaces.set(A, e), {
21505
21542
  surface: e.surface,
21506
- release: Mg(() => this.releaseSharedWebCodecsSurface(e))
21543
+ release: Ng(() => this.releaseSharedWebCodecsSurface(e))
21507
21544
  };
21508
21545
  }
21509
21546
  releaseSharedWebCodecsSurface(A) {
@@ -21531,7 +21568,7 @@ const Fg = class _A {
21531
21568
  throw s.status === "fulfilled" && ((B = s.value) == null || B.release()), o.status === "rejected" ? o.reason : s.status === "rejected" ? s.reason : new Error(lA);
21532
21569
  const { config: n, vapResources: r } = o.value, c = s.value;
21533
21570
  if (A.vapConfig = n, r.size > 0) {
21534
- const D = II(n.info), y = Ra(n);
21571
+ const D = gI(n.info), y = Ra(n);
21535
21572
  let R = null;
21536
21573
  if (this.backend.type === "webgpu" || this.backend.type === "webgl2")
21537
21574
  try {
@@ -21943,7 +21980,7 @@ const Fg = class _A {
21943
21980
  }
21944
21981
  }
21945
21982
  async fetchSharedVideoSource(A) {
21946
- const g = new Blob([await CI(A)]), I = this.sharedVideoSources.get(A), B = URL.createObjectURL(g);
21983
+ const g = new Blob([await BI(A)]), I = this.sharedVideoSources.get(A), B = URL.createObjectURL(g);
21947
21984
  return I && (I.objectUrl = B, I.refs === 0 && (URL.revokeObjectURL(B), this.sharedVideoSources.delete(A))), B;
21948
21985
  }
21949
21986
  releaseSharedVideoSource(A) {
@@ -22013,7 +22050,7 @@ const Fg = class _A {
22013
22050
  if (typeof A != "string") {
22014
22051
  const E = await eC(A, g);
22015
22052
  try {
22016
- if (L(g, "Image loading aborted"), this.destroyed || !this.backend) throw new Error("GiftStage is destroyed");
22053
+ if (J(g, "Image loading aborted"), this.destroyed || !this.backend) throw new Error("GiftStage is destroyed");
22017
22054
  const e = this.backend.createTexture(E.source, {
22018
22055
  width: E.width,
22019
22056
  height: E.height,
@@ -22025,7 +22062,7 @@ const Fg = class _A {
22025
22062
  texture: e,
22026
22063
  width: E.width,
22027
22064
  height: E.height,
22028
- release: Mg(() => {
22065
+ release: Ng(() => {
22029
22066
  var i;
22030
22067
  return (i = this.backend) == null ? void 0 : i.deleteTexture(e);
22031
22068
  })
@@ -22040,7 +22077,7 @@ const Fg = class _A {
22040
22077
  texture: I.texture,
22041
22078
  width: I.width,
22042
22079
  height: I.height,
22043
- release: Mg(() => this.releaseSharedImageTexture(A))
22080
+ release: Ng(() => this.releaseSharedImageTexture(A))
22044
22081
  };
22045
22082
  let B = this.pendingSharedImageTextures.get(A);
22046
22083
  if (!B) {
@@ -22075,11 +22112,11 @@ const Fg = class _A {
22075
22112
  B.then(E, E);
22076
22113
  }
22077
22114
  const Q = await B;
22078
- return L(g, "Image loading aborted"), Q.refs++, {
22115
+ return J(g, "Image loading aborted"), Q.refs++, {
22079
22116
  texture: Q.texture,
22080
22117
  width: Q.width,
22081
22118
  height: Q.height,
22082
- release: Mg(() => this.releaseSharedImageTexture(A))
22119
+ release: Ng(() => this.releaseSharedImageTexture(A))
22083
22120
  };
22084
22121
  }
22085
22122
  releaseSharedImageTexture(A) {
@@ -22194,13 +22231,13 @@ const Fg = class _A {
22194
22231
  }
22195
22232
  async preload(A, g, I) {
22196
22233
  var B, Q;
22197
- if (await this.ready, L(I, "GiftStage preload canceled"), this.destroyed) throw new Error("GiftStage is destroyed");
22234
+ if (await this.ready, J(I, "GiftStage preload canceled"), this.destroyed) throw new Error("GiftStage is destroyed");
22198
22235
  let E = !1;
22199
22236
  if (A === "svga") {
22200
22237
  if (typeof g != "string")
22201
22238
  throw new Error("SVGA preload lease currently requires a URL source");
22202
22239
  const i = await this.acquireSharedSVGAEntity(g, I), { entity: t } = i;
22203
- await this.ensureSVGAFrameTable(t), L(I, "GiftStage preload canceled");
22240
+ await this.ensureSVGAFrameTable(t), J(I, "GiftStage preload canceled");
22204
22241
  const a = t.spriteTable;
22205
22242
  return {
22206
22243
  metadata: {
@@ -22469,7 +22506,7 @@ export {
22469
22506
  uB as RenderManager,
22470
22507
  xt as SVGABatchRenderer,
22471
22508
  uC as SVGA_FRAME_TABLE_BUDGET_BYTES,
22472
- BI as SVGA_FRAME_TABLE_FLOATS,
22509
+ II as SVGA_FRAME_TABLE_FLOATS,
22473
22510
  EE as SVGA_GPU_FRAME_TABLE_BUDGET_BYTES,
22474
22511
  LB as SVGA_HYBRID_OP_CLIP_CLEAR,
22475
22512
  qC as SVGA_HYBRID_OP_CLIP_TEST,