@kubohiroya/turbowarp-bubble 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -266,15 +266,15 @@ var C = 480, w = 360, T = 100, E = 50, D = 1, O = 128, k = {
266
266
  rubyGap: D
267
267
  });
268
268
  function M(e, t, n) {
269
- let r = L(t, n), i = e.split("\n").map((e) => ({
269
+ let r = R(t, n), i = e.split("\n").map((e) => ({
270
270
  text: e,
271
- width: V(e, r.fontSize)
271
+ width: ee(e, r.fontSize)
272
272
  })), a = Math.max(1, ...i.map((e) => e.width)), o = Math.max(1, Math.ceil(a + r.padding * 2)), s = Math.max(1, Math.ceil(r.lineHeight * i.length + r.padding * 2)), c = t.alignment === "center" ? o / 2 : t.alignment === "right" ? o - r.padding : r.padding, l = Object.freeze(i.map((e, t) => Object.freeze({
273
273
  baseline: r.padding + r.fontSize + r.lineHeight * t,
274
274
  text: e.text,
275
275
  width: e.width,
276
276
  x: c
277
- }))), u = R(t, r);
277
+ }))), u = z(t, r);
278
278
  return Object.freeze({
279
279
  height: s,
280
280
  lines: l,
@@ -284,8 +284,8 @@ function M(e, t, n) {
284
284
  });
285
285
  }
286
286
  function N(e, t, n, r) {
287
- let i = L(t, n), a = i.fontSize * (t.rubyFontPercent / T), o = t.rubyGap * i.fontScale, s = Object.freeze({
288
- ...R(t, i),
287
+ let i = R(t, n), a = i.fontSize * (t.rubyFontPercent / T), o = t.rubyGap * i.fontScale, s = Object.freeze({
288
+ ...z(t, i),
289
289
  rubyFontPercent: t.rubyFontPercent,
290
290
  rubyFontSize: a,
291
291
  rubyGap: o
@@ -300,7 +300,7 @@ function N(e, t, n, r) {
300
300
  type: "ruby"
301
301
  });
302
302
  u.push(e);
303
- let r = V(n.base, i.fontSize), o = V(n.reading, a);
303
+ let r = ee(n.base, i.fontSize), o = ee(n.reading, a);
304
304
  d.push({
305
305
  base: n.base,
306
306
  baseWidth: r,
@@ -312,7 +312,7 @@ function N(e, t, n, r) {
312
312
  });
313
313
  continue;
314
314
  }
315
- for (let e of z(n.text)) {
315
+ for (let e of B(n.text)) {
316
316
  if (e.segment === "\n") {
317
317
  d.push("break");
318
318
  continue;
@@ -328,7 +328,7 @@ function N(e, t, n, r) {
328
328
  reveal: n,
329
329
  text: e.segment,
330
330
  type: "text",
331
- width: V(e.segment, i.fontSize)
331
+ width: ee(e.segment, i.fontSize)
332
332
  });
333
333
  }
334
334
  }
@@ -419,14 +419,14 @@ function I(e, t) {
419
419
  let n = e.trim();
420
420
  return n === "" ? t : n.toLowerCase() === "transparent" || /^#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/iu.test(n) || globalThis.CSS?.supports?.("color", n) ? n : t;
421
421
  }
422
- function ee(e) {
422
+ function L(e) {
423
423
  let t = e.trim(), n = [...t].some((e) => {
424
424
  let t = e.codePointAt(0) ?? 0;
425
425
  return t <= 31 || t === 127 || ",;{}".includes(e);
426
426
  });
427
427
  return t === "" || t.length > O || n ? A.font : t;
428
428
  }
429
- function L(e, t) {
429
+ function R(e, t) {
430
430
  let n = Math.min(t[0] / C, t[1] / w), r = n * (e.fontPercent / T);
431
431
  return {
432
432
  cornerRadius: k.cornerRadius * n,
@@ -436,7 +436,7 @@ function L(e, t) {
436
436
  padding: k.padding * n
437
437
  };
438
438
  }
439
- function R(e, t) {
439
+ function z(e, t) {
440
440
  return Object.freeze({
441
441
  alignment: e.alignment,
442
442
  backgroundColor: e.backgroundColor,
@@ -449,9 +449,9 @@ function R(e, t) {
449
449
  textColor: e.textColor
450
450
  });
451
451
  }
452
- function z(e) {
452
+ function B(e) {
453
453
  let t = [], n = "", r = 0, i = !1, a = 0;
454
- for (let o of e) !(n !== "" && (i || o === "‍" || B(o))) && n !== "" && (t.push({
454
+ for (let o of e) !(n !== "" && (i || o === "‍" || V(o))) && n !== "" && (t.push({
455
455
  end: a,
456
456
  segment: n,
457
457
  start: r
@@ -462,12 +462,12 @@ function z(e) {
462
462
  start: r
463
463
  }), t;
464
464
  }
465
- function B(e) {
465
+ function V(e) {
466
466
  if (/\p{Mark}/u.test(e)) return !0;
467
467
  let t = e.codePointAt(0) ?? 0;
468
468
  return t >= 65024 && t <= 65039 || t >= 917760 && t <= 917999 || t >= 127995 && t <= 127999;
469
469
  }
470
- function V(e, t) {
470
+ function ee(e, t) {
471
471
  let n = 0;
472
472
  for (let t of e) {
473
473
  if (/\p{Mark}/u.test(t)) continue;
@@ -494,7 +494,7 @@ function H(e) {
494
494
  function U(e) {
495
495
  return String(Math.round(e * 1e3) / 1e3);
496
496
  }
497
- var te = l.blocks, ne = l.menus, re = "https://kubohiroya.github.io/turbowarp-svg-text/", ie = "default", ae = 100, oe = 50, W = 1, se = 1, ce = 1e3, le = 10, ue = 100, de = 0, fe = 100, pe = d.blockIconURI, me = class {
497
+ var te = l.blocks, ne = l.menus, re = "https://kubohiroya.github.io/turbowarp-svg-text/", ie = "default", ae = 100, W = 50, oe = 1, se = 1, ce = 1e3, le = 10, ue = 100, de = 0, fe = 100, pe = d.blockIconURI, me = class {
498
498
  constructor(e = Scratch.vm?.runtime, t = {}) {
499
499
  if (this.styles = /* @__PURE__ */ new Map([[ie, j]]), this.textActors = /* @__PURE__ */ new Map(), !e) throw Error("SVG Text requires the TurboWarp VM.");
500
500
  this.runtime = e, this.castToString = t.castToString ?? Scratch.Cast.toString, (t.listenForRuntimeEvents ?? !0) && this.runtime.on("STAGE_SIZE_CHANGED", () => {
@@ -574,14 +574,14 @@ var te = l.blocks, ne = l.menus, re = "https://kubohiroya.github.io/turbowarp-sv
574
574
  return Number.isFinite(t) ? Math.min(ce, Math.max(se, t)) : ae;
575
575
  }
576
576
  normalizeRubyFontPercent(e) {
577
- if (typeof e == "string" && e.trim() === "") return oe;
577
+ if (typeof e == "string" && e.trim() === "") return W;
578
578
  let t = Number(e);
579
- return Number.isFinite(t) ? Math.min(ue, Math.max(le, t)) : oe;
579
+ return Number.isFinite(t) ? Math.min(ue, Math.max(le, t)) : W;
580
580
  }
581
581
  normalizeRubyGap(e) {
582
- if (typeof e == "string" && e.trim() === "") return W;
582
+ if (typeof e == "string" && e.trim() === "") return oe;
583
583
  let t = Number(e);
584
- return Number.isFinite(t) ? Math.min(fe, Math.max(de, t)) : W;
584
+ return Number.isFinite(t) ? Math.min(fe, Math.max(de, t)) : oe;
585
585
  }
586
586
  normalizeMessage(e) {
587
587
  return this.castToString(e).replace(/\\r\\n|\\n|\\r/gu, "\n");
@@ -594,7 +594,7 @@ var te = l.blocks, ne = l.menus, re = "https://kubohiroya.github.io/turbowarp-sv
594
594
  return I(this.castToString(e), t);
595
595
  }
596
596
  normalizeFont(e) {
597
- return ee(this.castToString(e));
597
+ return L(this.castToString(e));
598
598
  }
599
599
  getNativeSize() {
600
600
  let e = this.runtime.renderer?.getNativeSize?.();
@@ -698,7 +698,7 @@ function Ae(e) {
698
698
  return Object.freeze({
699
699
  alignment: e.alignment ?? A.alignment,
700
700
  backgroundColor: I(e.backgroundColor ?? "", A.backgroundColor),
701
- font: ee(e.font ?? ""),
701
+ font: L(e.font ?? ""),
702
702
  fontPercent: e.fontPercent ?? A.fontPercent,
703
703
  rubyFontPercent: e.rubyFontPercent ?? j.rubyFontPercent,
704
704
  rubyGap: e.rubyGap ?? j.rubyGap,
@@ -1260,7 +1260,7 @@ var it = /* @__PURE__ */ o(((e, t) => {
1260
1260
  for (i = 0; i < r.t; ++i) t[i + n.t] = n.am(0, r[i], t, i, 0, n.t);
1261
1261
  t.s = 0, t.clamp(), this.s != e.s && c.ZERO.subTo(t, t);
1262
1262
  }
1263
- function ee(e) {
1263
+ function L(e) {
1264
1264
  for (var t = this.abs(), n = e.t = 2 * t.t; --n >= 0;) e[n] = 0;
1265
1265
  for (n = 0; n < t.t - 1; ++n) {
1266
1266
  var r = t.am(n, t[n], e, 2 * n, 0, 1);
@@ -1268,7 +1268,7 @@ var it = /* @__PURE__ */ o(((e, t) => {
1268
1268
  }
1269
1269
  e.t > 0 && (e[e.t - 1] += t.am(n, t[n], e, 2 * n, 0, 1)), e.s = 0, e.clamp();
1270
1270
  }
1271
- function L(e, t, n) {
1271
+ function R(e, t, n) {
1272
1272
  var r = e.abs();
1273
1273
  if (!(r.t <= 0)) {
1274
1274
  var i = this.abs();
@@ -1291,17 +1291,17 @@ var it = /* @__PURE__ */ o(((e, t) => {
1291
1291
  }
1292
1292
  }
1293
1293
  }
1294
- function R(e) {
1294
+ function z(e) {
1295
1295
  var t = l();
1296
1296
  return this.abs().divRemTo(e, null, t), this.s < 0 && t.compareTo(c.ZERO) > 0 && e.subTo(t, t), t;
1297
1297
  }
1298
- function z(e) {
1298
+ function B(e) {
1299
1299
  this.m = e;
1300
1300
  }
1301
- function B(e) {
1301
+ function V(e) {
1302
1302
  return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
1303
1303
  }
1304
- function V(e) {
1304
+ function ee(e) {
1305
1305
  return e;
1306
1306
  }
1307
1307
  function H(e) {
@@ -1313,7 +1313,7 @@ var it = /* @__PURE__ */ o(((e, t) => {
1313
1313
  function te(e, t) {
1314
1314
  e.squareTo(t), this.reduce(t);
1315
1315
  }
1316
- z.prototype.convert = B, z.prototype.revert = V, z.prototype.reduce = H, z.prototype.mulTo = U, z.prototype.sqrTo = te;
1316
+ B.prototype.convert = V, B.prototype.revert = ee, B.prototype.reduce = H, B.prototype.mulTo = U, B.prototype.sqrTo = te;
1317
1317
  function ne() {
1318
1318
  if (this.t < 1) return 0;
1319
1319
  var e = this[0];
@@ -1332,7 +1332,7 @@ var it = /* @__PURE__ */ o(((e, t) => {
1332
1332
  var t = l();
1333
1333
  return e.copyTo(t), this.reduce(t), t;
1334
1334
  }
1335
- function oe(e) {
1335
+ function W(e) {
1336
1336
  for (; e.t <= this.mt2;) e[e.t++] = 0;
1337
1337
  for (var t = 0; t < this.m.t; ++t) {
1338
1338
  var n = e[t] & 32767, r = n * this.mpl + ((n * this.mph + (e[t] >> 15) * this.mpl & this.um) << 15) & e.DM;
@@ -1340,13 +1340,13 @@ var it = /* @__PURE__ */ o(((e, t) => {
1340
1340
  }
1341
1341
  e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
1342
1342
  }
1343
- function W(e, t) {
1343
+ function oe(e, t) {
1344
1344
  e.squareTo(t), this.reduce(t);
1345
1345
  }
1346
1346
  function se(e, t, n) {
1347
1347
  e.multiplyTo(t, n), this.reduce(n);
1348
1348
  }
1349
- re.prototype.convert = ie, re.prototype.revert = ae, re.prototype.reduce = oe, re.prototype.mulTo = se, re.prototype.sqrTo = W;
1349
+ re.prototype.convert = ie, re.prototype.revert = ae, re.prototype.reduce = W, re.prototype.mulTo = se, re.prototype.sqrTo = oe;
1350
1350
  function ce() {
1351
1351
  return (this.t > 0 ? this[0] & 1 : this.s) == 0;
1352
1352
  }
@@ -1361,10 +1361,10 @@ var it = /* @__PURE__ */ o(((e, t) => {
1361
1361
  return t.revert(n);
1362
1362
  }
1363
1363
  function ue(e, t) {
1364
- var n = e < 256 || t.isEven() ? new z(t) : new re(t);
1364
+ var n = e < 256 || t.isEven() ? new B(t) : new re(t);
1365
1365
  return this.exp(e, n);
1366
1366
  }
1367
- c.prototype.copyTo = b, c.prototype.fromInt = x, c.prototype.fromString = C, c.prototype.clamp = w, c.prototype.dlShiftTo = j, c.prototype.drShiftTo = M, c.prototype.lShiftTo = N, c.prototype.rShiftTo = P, c.prototype.subTo = F, c.prototype.multiplyTo = I, c.prototype.squareTo = ee, c.prototype.divRemTo = L, c.prototype.invDigit = ne, c.prototype.isEven = ce, c.prototype.exp = le, c.prototype.toString = T, c.prototype.negate = E, c.prototype.abs = D, c.prototype.compareTo = O, c.prototype.bitLength = A, c.prototype.mod = R, c.prototype.modPowInt = ue, c.ZERO = S(0), c.ONE = S(1);
1367
+ c.prototype.copyTo = b, c.prototype.fromInt = x, c.prototype.fromString = C, c.prototype.clamp = w, c.prototype.dlShiftTo = j, c.prototype.drShiftTo = M, c.prototype.lShiftTo = N, c.prototype.rShiftTo = P, c.prototype.subTo = F, c.prototype.multiplyTo = I, c.prototype.squareTo = L, c.prototype.divRemTo = R, c.prototype.invDigit = ne, c.prototype.isEven = ce, c.prototype.exp = le, c.prototype.toString = T, c.prototype.negate = E, c.prototype.abs = D, c.prototype.compareTo = O, c.prototype.bitLength = A, c.prototype.mod = z, c.prototype.modPowInt = ue, c.ZERO = S(0), c.ONE = S(1);
1368
1368
  function de() {
1369
1369
  var e = l();
1370
1370
  return this.copyTo(e), e;
@@ -1621,7 +1621,7 @@ var it = /* @__PURE__ */ o(((e, t) => {
1621
1621
  function pt(e, t) {
1622
1622
  var n = e.bitLength(), r, i = S(1), a;
1623
1623
  if (n <= 0) return i;
1624
- r = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, a = n < 8 ? new z(t) : t.isEven() ? new st(t) : new re(t);
1624
+ r = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, a = n < 8 ? new B(t) : t.isEven() ? new st(t) : new re(t);
1625
1625
  var o = [], s = 3, c = r - 1, u = (1 << r) - 1;
1626
1626
  if (o[1] = a.convert(this), r > 1) {
1627
1627
  var d = l();
@@ -3635,41 +3635,103 @@ var ut = Object.freeze([
3635
3635
  function pt(...e) {
3636
3636
  return e.some((e) => e === "THINKING" || e === "DREAMING") ? dt : ft;
3637
3637
  }
3638
- function mt(e) {
3638
+ var mt = 2, ht = 400, gt = /* @__PURE__ */ new Map(), K = 128;
3639
+ function _t(e, t, n) {
3640
+ switch (e) {
3641
+ case "NO_BUBBLE": return;
3642
+ case "THINKING":
3643
+ case "DREAMING": return Lt(t, n);
3644
+ case "YELLING": return Bt(t, n);
3645
+ case "WAVY": return Vt(t, n);
3646
+ case "ANNOUNCEMENT": return Ct(t, n, 13, 30);
3647
+ case "NORMAL":
3648
+ case "OFF_PANEL":
3649
+ case "WHISPERING":
3650
+ case "NARRATION": return Ct(t, n);
3651
+ }
3652
+ }
3653
+ function vt(e, t) {
3654
+ let n = !1;
3655
+ for (let r = 0, i = t.length - 1; r < t.length; i = r, r += 1) {
3656
+ let a = t[r], o = t[i];
3657
+ !a || !o || a.y > e.y != o.y > e.y && e.x < (o.x - a.x) * (e.y - a.y) / (o.y - a.y) + a.x && (n = !n);
3658
+ }
3659
+ return n;
3660
+ }
3661
+ function yt(e, t, n, r, i) {
3662
+ let a = r / 2 + 6, o = i / 2 + 6, s = t / 2 - a, c = t / 2 + a, l = n / 2 - o, u = n / 2 + o, d = (t, n) => +!vt({
3663
+ x: t,
3664
+ y: n
3665
+ }, e), f = 0, p = Math.max(1, Math.ceil((c - s) / 4)), m = Math.max(1, Math.ceil((u - l) / 4));
3666
+ for (let e = 0; e <= p; e += 1) {
3667
+ let t = s + (c - s) * e / p;
3668
+ f += d(t, l) + d(t, u);
3669
+ }
3670
+ for (let e = 1; e < m; e += 1) {
3671
+ let t = l + (u - l) * e / m;
3672
+ f += d(s, t) + d(c, t);
3673
+ }
3674
+ for (let t of e) t.x > s && t.x < c && t.y > l && t.y < u && (f += 1);
3675
+ return f;
3676
+ }
3677
+ function q(e) {
3678
+ let t = Math.max(0, e.contentWidth), n = Math.max(0, e.contentHeight);
3679
+ if (!Number.isFinite(t) || !Number.isFinite(n)) throw TypeError("Bubble content size must be finite.");
3680
+ let r = [...new Set(e.styles)], i = `${r.join(",")}:${t}:${n}`, a = gt.get(i);
3681
+ if (a) return a;
3682
+ let o = (e, i) => r.reduce((r, a) => {
3683
+ let o = _t(a, e, i);
3684
+ return o ? r + yt(o, e, i, t, n) : r;
3685
+ }, 0), s = pt(...r), c = Math.max(t + 48, s.width), l = Math.max(n + 48, s.height);
3686
+ for (let e = 0; e < ht && o(c, l) > 0; e += 1) {
3687
+ let e = o(c + mt, l), t = o(c, l + mt);
3688
+ e <= t && (c += mt), t <= e && (l += mt);
3689
+ }
3690
+ let u = Object.freeze({
3691
+ height: l,
3692
+ width: c
3693
+ });
3694
+ if (gt.size >= K) {
3695
+ let e = gt.keys().next().value;
3696
+ e !== void 0 && gt.delete(e);
3697
+ }
3698
+ return gt.set(i, u), u;
3699
+ }
3700
+ function bt(e) {
3639
3701
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
3640
3702
  }
3641
- function ht(e, t) {
3703
+ function xt(e, t) {
3642
3704
  let n = e ?? t;
3643
3705
  if (!Number.isFinite(n) || n <= 0) throw TypeError("Bubble SVG dimensions must be positive and finite.");
3644
3706
  return n;
3645
3707
  }
3646
- function gt(e) {
3708
+ function St(e) {
3647
3709
  if (e === null) return null;
3648
3710
  let t = e ?? 180;
3649
3711
  if (!Number.isFinite(t)) throw TypeError("tailDirection must be finite.");
3650
3712
  return (t % 360 + 360) % 360;
3651
3713
  }
3652
- function K(e, t, n = 18) {
3653
- let r = e - 24, i = t - 24;
3714
+ function Ct(e, t, n = 18, r = 24) {
3715
+ let i = r, a = r, o = e - r, s = t - r;
3654
3716
  return [
3655
3717
  {
3656
- centerX: r - n,
3657
- centerY: 24 + n,
3718
+ centerX: o - n,
3719
+ centerY: a + n,
3658
3720
  start: -90
3659
3721
  },
3660
3722
  {
3661
- centerX: r - n,
3662
- centerY: i - n,
3723
+ centerX: o - n,
3724
+ centerY: s - n,
3663
3725
  start: 0
3664
3726
  },
3665
3727
  {
3666
- centerX: 24 + n,
3667
- centerY: i - n,
3728
+ centerX: i + n,
3729
+ centerY: s - n,
3668
3730
  start: 90
3669
3731
  },
3670
3732
  {
3671
- centerX: 24 + n,
3672
- centerY: 24 + n,
3733
+ centerX: i + n,
3734
+ centerY: a + n,
3673
3735
  start: 180
3674
3736
  }
3675
3737
  ].flatMap(({ centerX: e, centerY: t, start: r }) => Array.from({ length: 11 }, (i, a) => {
@@ -3680,24 +3742,24 @@ function K(e, t, n = 18) {
3680
3742
  };
3681
3743
  }));
3682
3744
  }
3683
- function _t(e, t) {
3745
+ function wt(e, t) {
3684
3746
  return e.x * t.y - e.y * t.x;
3685
3747
  }
3686
- function vt(e, t) {
3748
+ function Tt(e, t) {
3687
3749
  return {
3688
3750
  x: e.x - t.x,
3689
3751
  y: e.y - t.y
3690
3752
  };
3691
3753
  }
3692
- function yt(e, t) {
3754
+ function Et(e, t) {
3693
3755
  return Math.hypot(e.x - t.x, e.y - t.y);
3694
3756
  }
3695
- function q(e, t, n, r) {
3757
+ function Dt(e, t, n, r) {
3696
3758
  let i = t, a = r;
3697
3759
  for (; a > 0;) {
3698
3760
  let t = (i + n + e.length) % e.length, r = e[i], o = e[t];
3699
3761
  if (!r || !o) throw Error("Bubble border path is invalid.");
3700
- let s = yt(r, o);
3762
+ let s = Et(r, o);
3701
3763
  if (a <= s) {
3702
3764
  let e = a / s;
3703
3765
  return {
@@ -3711,14 +3773,14 @@ function q(e, t, n, r) {
3711
3773
  if (!o) throw Error("Bubble border path is empty.");
3712
3774
  return o;
3713
3775
  }
3714
- function bt(e, t, n, r, i) {
3776
+ function Ot(e, t, n, r, i) {
3715
3777
  let a;
3716
3778
  for (let r = 0; r < e.length; r += 1) {
3717
3779
  let i = e[r], o = e[(r + 1) % e.length];
3718
3780
  if (!i || !o) continue;
3719
- let s = vt(o, i), c = _t(n, s);
3781
+ let s = Tt(o, i), c = wt(n, s);
3720
3782
  if (Math.abs(c) < 1e-9) continue;
3721
- let l = vt(i, t), u = _t(l, s) / c, d = _t(l, n) / c;
3783
+ let l = Tt(i, t), u = wt(l, s) / c, d = wt(l, n) / c;
3722
3784
  u < 0 || d < -1e-9 || d > 1 + 1e-9 || a && u >= a.rayScale || (a = {
3723
3785
  edgeIndex: r,
3724
3786
  point: {
@@ -3736,58 +3798,58 @@ function bt(e, t, n, r, i) {
3736
3798
  ], s = a.edgeIndex + 1;
3737
3799
  return {
3738
3800
  borderPoint: a.point,
3739
- base: [q(o, s, -1, 9), q(o, s, 1, 9)],
3801
+ base: [Dt(o, s, -1, 9), Dt(o, s, 1, 9)],
3740
3802
  tip: {
3741
3803
  x: i?.x ?? t.x + n.x * (a.rayScale + r),
3742
3804
  y: i?.y ?? t.y + n.y * (a.rayScale + r)
3743
3805
  }
3744
3806
  };
3745
3807
  }
3746
- function xt(e) {
3808
+ function kt(e) {
3747
3809
  let t = e * Math.PI / 180;
3748
3810
  return {
3749
3811
  x: Math.sin(t),
3750
3812
  y: -Math.cos(t)
3751
3813
  };
3752
3814
  }
3753
- function St(e, t, n, r) {
3815
+ function At(e, t, n, r) {
3754
3816
  return {
3755
3817
  x: n.x + (e.x - t.x) * r,
3756
3818
  y: n.y + (e.y - t.y) * r
3757
3819
  };
3758
3820
  }
3759
- function Ct(e, t, n, r, i, a) {
3821
+ function jt(e, t, n, r, i, a) {
3760
3822
  let o = {
3761
3823
  x: t / 2,
3762
3824
  y: n / 2
3763
- }, s = xt(r), c = bt(e, o, s, i), l = yt(o, c.borderPoint), u = a.scalePercent / 100, d = {
3825
+ }, s = kt(r), c = Ot(e, o, s, i), l = Et(o, c.borderPoint), u = a.scalePercent / 100, d = {
3764
3826
  x: o.x - s.x * l * (u - 1) + a.x,
3765
3827
  y: o.y - s.y * l * (u - 1) - a.y
3766
3828
  };
3767
3829
  return {
3768
- body: e.map((e) => St(e, o, d, u)),
3830
+ body: e.map((e) => At(e, o, d, u)),
3769
3831
  bodyCenter: d,
3770
3832
  tip: c.tip
3771
3833
  };
3772
3834
  }
3773
- function wt(e) {
3835
+ function Mt(e) {
3774
3836
  let t = e[0];
3775
3837
  if (!t) throw Error("Bubble polygon is empty.");
3776
3838
  return `M ${t.x.toFixed(4)} ${t.y.toFixed(4)} ${e.slice(1).map(({ x: e, y: t }) => `L ${e.toFixed(4)} ${t.toFixed(4)}`).join(" ")} Z`;
3777
3839
  }
3778
- function Tt(e) {
3840
+ function Nt(e) {
3779
3841
  return Math.abs(e.reduce((t, n, r) => {
3780
3842
  let i = e[(r + 1) % e.length];
3781
3843
  return i ? t + n.x * i.y - i.x * n.y : t;
3782
3844
  }, 0) / 2);
3783
3845
  }
3784
- function Et(e, t, n, r = "") {
3785
- return `<path d="${wt(e)}" fill="${t}" stroke="${n}" stroke-width="3" stroke-linejoin="round" ${r}/>`;
3846
+ function Pt(e, t, n, r = "") {
3847
+ return `<path d="${Mt(e)}" fill="${t}" stroke="${n}" stroke-width="3" stroke-linejoin="round" ${r}/>`;
3786
3848
  }
3787
- function Dt(e, t, n, r, i, a = "") {
3788
- let o = vt(n, t), s = Math.hypot(o.x, o.y);
3849
+ function Ft(e, t, n, r, i, a = "") {
3850
+ let o = Tt(n, t), s = Math.hypot(o.x, o.y);
3789
3851
  if (!(s > 0)) throw TypeError("Bubble body center and tail tip must differ.");
3790
- let c = bt(e, t, {
3852
+ let c = Ot(e, t, {
3791
3853
  x: o.x / s,
3792
3854
  y: o.y / s
3793
3855
  }, 0, n), l = (e) => e.map(({ x: e, y: t }) => [e, t]), u = at.default.union([l(e)], [[l([
@@ -3799,53 +3861,57 @@ function Dt(e, t, n, r, i, a = "") {
3799
3861
  let d = u.map((e) => e.map(([e, t]) => ({
3800
3862
  x: e,
3801
3863
  y: t
3802
- }))).sort((e, t) => Tt(t) - Tt(e))[0];
3864
+ }))).sort((e, t) => Nt(t) - Nt(e))[0];
3803
3865
  if (!d) throw Error("JSClipper returned an empty Bubble outline.");
3804
- return `<path d="${wt(d)}" fill="${r}" stroke="${i}" stroke-width="3" stroke-linejoin="round" data-boolean-operation="union" data-tail-base-on-border="true" ${a}/>`;
3866
+ return `<path d="${Mt(d)}" fill="${r}" stroke="${i}" stroke-width="3" stroke-linejoin="round" data-boolean-operation="union" data-tail-base-on-border="true" ${a}/>`;
3805
3867
  }
3806
- function Ot(e) {
3807
- let t = e[0];
3808
- if (!t || e.length < 3) throw TypeError("Smooth Bubble path requires at least three points.");
3809
- let n = (e) => e.toFixed(4), r = e.map((t, r) => {
3810
- let i = e[(r - 1 + e.length) % e.length], a = e[(r + 1) % e.length], o = e[(r + 2) % e.length];
3811
- if (!i || !a || !o) throw Error("Smooth Bubble path is invalid.");
3812
- let s = {
3813
- x: t.x + (a.x - i.x) / 6,
3814
- y: t.y + (a.y - i.y) / 6
3815
- }, c = {
3816
- x: a.x - (o.x - t.x) / 6,
3817
- y: a.y - (o.y - t.y) / 6
3868
+ var It = Object.freeze([
3869
+ 1,
3870
+ .78,
3871
+ 1.14,
3872
+ .88,
3873
+ 1.06,
3874
+ .8,
3875
+ 1.2,
3876
+ .92
3877
+ ]);
3878
+ function Lt(e, t) {
3879
+ let n = e - 48, r = t - 48, i = e / 2, a = t / 2, o = Math.min(40, Math.max(22, 20 + Math.min(n, r) * .12 + Math.max(n, r) * .03)), s = o * .34, c = Math.max(1, n / 2 - s), l = Math.max(1, r / 2 - s), u = (e) => {
3880
+ let t = Math.cos(e), n = Math.sin(e);
3881
+ return {
3882
+ x: i + c * Math.sign(t) * Math.abs(t) ** (2 / 3),
3883
+ y: a + l * Math.sign(n) * Math.abs(n) ** (2 / 3)
3818
3884
  };
3819
- return `C ${n(s.x)} ${n(s.y)} ${n(c.x)} ${n(c.y)} ${n(a.x)} ${n(a.y)}`;
3885
+ }, d = [0], f = u(-Math.PI / 2);
3886
+ for (let e = 1; e <= 720; e += 1) {
3887
+ let t = u(-Math.PI / 2 + e * Math.PI * 2 / 720);
3888
+ d.push((d[e - 1] ?? 0) + Math.hypot(t.x - f.x, t.y - f.y)), f = t;
3889
+ }
3890
+ let p = d[720] ?? 0, m = It.reduce((e, t) => e + t, 0), h = Math.max(8, Math.round(p / (o * m) * It.length)), g = Array.from({ length: h }, (e, t) => It[t % It.length] ?? 1), _ = g.reduce((e, t) => e + t, 0), v = (e) => {
3891
+ let t = 0, n = 720;
3892
+ for (; n - t > 1;) {
3893
+ let r = t + n >> 1;
3894
+ (d[r] ?? 0) <= e ? t = r : n = r;
3895
+ }
3896
+ let r = d[t] ?? 0, i = d[n] ?? r, a = i > r ? (e - r) / (i - r) : 0;
3897
+ return u(-Math.PI / 2 + (t + a) * Math.PI * 2 / 720);
3898
+ }, y = 0;
3899
+ return g.map((e) => {
3900
+ let t = v(y / _ * p);
3901
+ return y += e, t;
3820
3902
  });
3821
- return `M ${n(t.x)} ${n(t.y)} ${r.join(" ")} Z`;
3822
3903
  }
3823
- function kt(e, t, n, r) {
3824
- let i = e - 24, a = t - 24, o = i - 24, s = a - 24, c = (e, t) => ({
3825
- x: 24 + o * e,
3826
- y: 24 + s * t
3904
+ function Rt(e, t, n, r) {
3905
+ let i = (e) => e.toFixed(4), a = Lt(e, t), o = a[0];
3906
+ if (!o) throw Error("Cloud Bubble path is invalid.");
3907
+ let s = a.map((e, t) => {
3908
+ let n = a[t] ?? o, r = a[(t + 1) % a.length] ?? o, s = Math.hypot(r.x - n.x, r.y - n.y) * .56;
3909
+ return `A ${i(s)} ${i(s)} 0 0 1 ${i(r.x)} ${i(r.y)}`;
3827
3910
  });
3828
- return `<path d="${Ot([
3829
- c(0, .5),
3830
- c(.03, .3),
3831
- c(.18, .2),
3832
- c(.28, .04),
3833
- c(.5, .16),
3834
- c(.68, .03),
3835
- c(.84, .18),
3836
- c(.98, .3),
3837
- c(1, .52),
3838
- c(.95, .7),
3839
- c(.82, .82),
3840
- c(.68, .97),
3841
- c(.5, .84),
3842
- c(.32, .97),
3843
- c(.18, .82),
3844
- c(.03, .7)
3845
- ])}" fill="${n}" stroke="${r}" stroke-width="3" stroke-linejoin="round"/>`;
3846
- }
3847
- function At(e, t, n, r, i, a) {
3848
- let o = vt(n, t), s = Math.hypot(o.x, o.y), c = bt(e, t, {
3911
+ return `<path d="M ${i(o.x)} ${i(o.y)} ${s.join(" ")} Z" fill="${n}" stroke="${r}" stroke-width="3" stroke-linejoin="round"/>`;
3912
+ }
3913
+ function zt(e, t, n, r, i, a) {
3914
+ let o = Tt(n, t), s = Math.hypot(o.x, o.y), c = Ot(e, t, {
3849
3915
  x: o.x / s,
3850
3916
  y: o.y / s
3851
3917
  }, 0, n), l = {
@@ -3873,7 +3939,7 @@ function At(e, t, n, r, i, a) {
3873
3939
  radius: 3.5
3874
3940
  }]).map(({ ratio: e, radius: t }) => `<circle cx="${l.x + (c.tip.x - l.x) * e}" cy="${l.y + (c.tip.y - l.y) * e}" r="${t}" fill="${r}" stroke="${i}" stroke-width="2"/>`).join("");
3875
3941
  }
3876
- function jt(e, t) {
3942
+ function Bt(e, t) {
3877
3943
  let n = e / 2, r = t / 2;
3878
3944
  return Array.from({ length: 28 }, (i, a) => {
3879
3945
  let o = a * Math.PI * 2 / 28 - Math.PI / 2, s = a % 2 == 0, c = s ? e / 2 - 6 : e / 2 - 22, l = s ? t / 2 - 6 : t / 2 - 22;
@@ -3883,7 +3949,7 @@ function jt(e, t) {
3883
3949
  };
3884
3950
  });
3885
3951
  }
3886
- function Mt(e, t) {
3952
+ function Vt(e, t) {
3887
3953
  let n = e - 24, r = t - 24, i = Array.from({ length: 21 }, (e, t) => {
3888
3954
  let n = t / 20;
3889
3955
  return {
@@ -3916,61 +3982,70 @@ function Mt(e, t) {
3916
3982
  }))
3917
3983
  ];
3918
3984
  }
3919
- function Nt(e, t, n) {
3920
- return e === "YELLING" ? jt(t, n) : e === "WAVY" ? Mt(t, n) : K(t, n);
3985
+ function Ht(e, t, n) {
3986
+ return e === "YELLING" ? Bt(t, n) : e === "WAVY" ? Vt(t, n) : Ct(t, n);
3921
3987
  }
3922
- function Pt(e) {
3923
- let t = pt(e.style), n = Math.max(ht(e.width, 220), t.width), r = Math.max(ht(e.height, 112), t.height), i = gt(e.tailDirection);
3988
+ function Ut(e) {
3989
+ let t = pt(e.style), n = Math.max(xt(e.width, 220), t.width), r = Math.max(xt(e.height, 112), t.height), i = St(e.tailDirection);
3924
3990
  if (i === null) throw TypeError("Bubble body center offset requires a tail direction.");
3925
3991
  let a = ct(e.tailLength ?? ot), o = lt(e.offset), s = {
3926
3992
  x: n / 2,
3927
3993
  y: r / 2
3928
- }, c = Ct(Nt(e.style, n, r), n, r, i, a, o);
3994
+ }, c = jt(Ht(e.style, n, r), n, r, i, a, o);
3929
3995
  return Object.freeze({
3930
3996
  x: c.bodyCenter.x - s.x,
3931
3997
  y: c.bodyCenter.y - s.y
3932
3998
  });
3933
3999
  }
3934
- function Ft(e, t, n, r, i, a, o, s) {
3935
- let c = K(t, n), l = (e) => r === null ? e : Ct(e, t, n, r, o, s).body, u = (e, c = "") => {
3936
- if (r === null) return Et(e, i, a, c);
3937
- let l = Ct(e, t, n, r, o, s);
3938
- return Dt(l.body, l.bodyCenter, l.tip, i, a, c);
4000
+ function Wt(e, t, n, r, i, a, o, s) {
4001
+ let c = Ct(t, n), l = (e) => r === null ? e : jt(e, t, n, r, o, s).body, u = (e, c = "") => {
4002
+ if (r === null) return Pt(e, i, a, c);
4003
+ let l = jt(e, t, n, r, o, s);
4004
+ return Ft(l.body, l.bodyCenter, l.tip, i, a, c);
3939
4005
  };
3940
4006
  switch (e) {
3941
4007
  case "NO_BUBBLE": return "";
3942
4008
  case "THINKING":
3943
4009
  case "DREAMING": {
3944
- if (r === null) return kt(t, n, i, a);
3945
- let l = Ct(c, t, n, r, o, s), u = s.scalePercent / 100, d = {
4010
+ if (r === null) return Rt(t, n, i, a);
4011
+ let l = jt(c, t, n, r, o, s), u = s.scalePercent / 100, d = {
3946
4012
  x: t / 2,
3947
4013
  y: n / 2
3948
4014
  }, f = l.bodyCenter.x - d.x * u, p = l.bodyCenter.y - d.y * u;
3949
- return `${At(l.body, l.bodyCenter, l.tip, i, a, e === "DREAMING")}<g transform="translate(${f} ${p}) scale(${u})">${kt(t, n, i, a)}</g>`;
4015
+ return `${zt(l.body, l.bodyCenter, l.tip, i, a, e === "DREAMING")}<g transform="translate(${f} ${p}) scale(${u})">${Rt(t, n, i, a)}</g>`;
3950
4016
  }
3951
- case "YELLING": return u(jt(t, n));
3952
- case "WAVY": return u(Mt(t, n));
4017
+ case "YELLING": return u(Bt(t, n));
4018
+ case "WAVY": return u(Vt(t, n));
3953
4019
  case "WHISPERING": return u(c, "stroke-dasharray=\"5 5\"");
3954
- case "ANNOUNCEMENT": return `${u(c)}<rect x="30" y="30" width="${t - 60}" height="${n - 60}" rx="13" fill="none" stroke="${a}" stroke-width="1.5"/>`;
3955
- case "NARRATION": return Et(l(c), i, a);
4020
+ case "ANNOUNCEMENT": {
4021
+ let e = Ct(t, n, 13, 30), i = r === null ? e : (() => {
4022
+ let { bodyCenter: i } = jt(c, t, n, r, o, s), a = {
4023
+ x: t / 2,
4024
+ y: n / 2
4025
+ }, l = s.scalePercent / 100;
4026
+ return e.map((e) => At(e, a, i, l));
4027
+ })();
4028
+ return `${u(c)}<path d="${Mt(i)}" fill="none" stroke="${a}" stroke-width="1.5" stroke-linejoin="round" data-bubble-inner-frame="true"/>`;
4029
+ }
4030
+ case "NARRATION": return Pt(l(c), i, a);
3956
4031
  case "OFF_PANEL": return u(c);
3957
4032
  case "NORMAL": return u(c);
3958
4033
  }
3959
4034
  }
3960
- function It(e) {
4035
+ function Gt(e) {
3961
4036
  if (!ut.includes(e.style)) throw TypeError(`Unsupported Bubble visual style: ${String(e.style)}`);
3962
4037
  if (!Array.isArray(e.lines) || e.lines.some((e) => typeof e != "string")) throw TypeError("lines must be an array of strings.");
3963
- let t = ht(e.width, 220), n = ht(e.height, 112), r = ht(e.fontSize, 15), i = gt(e.tailDirection), a = ct(e.tailLength ?? ot), o = e.offset === void 0 ? st : lt(e.offset), s = e.shapeTransition;
4038
+ let t = xt(e.width, 220), n = xt(e.height, 112), r = xt(e.fontSize, 15), i = St(e.tailDirection), a = ct(e.tailLength ?? ot), o = e.offset === void 0 ? st : lt(e.offset), s = e.shapeTransition;
3964
4039
  if (s !== void 0 && (!ut.includes(s.from) || !ut.includes(s.to) || !Number.isFinite(s.progress) || s.progress < 0 || s.progress > 1)) throw TypeError("Bubble shape transition is invalid.");
3965
4040
  let c = pt(e.style, ...s === void 0 ? [] : [s.from, s.to]), l = Math.max(t, c.width), u = Math.max(n, c.height), d = e.fillColor ?? "#fff4cc", f = e.borderColor ?? "#6f5b45", p = e.textColor ?? "#25283a", m = e.fontFamily ?? "Noto Sans JP, sans-serif", h = r * 1.35, g = u / 2 - (e.lines.length - 1) * h / 2 + r * .35, _ = i === null ? 1 : o.scalePercent / 100, v = i === null ? {
3966
4041
  x: l / 2,
3967
4042
  y: u / 2
3968
- } : Ct(K(l, u), l, u, i, a, o).bodyCenter, y = e.lines.map((e, t) => `<text x="${v.x}" y="${v.y + (g + t * h - u / 2) * _}" text-anchor="middle" fill="${mt(p)}" font-family="${mt(m)}" font-size="${r * _}">${mt(e)}</text>`).join(""), b = s === void 0 ? Ft(e.style, l, u, i, d, f, a, o) : `<g opacity="${(1 - s.progress).toFixed(4)}">${Ft(s.from, l, u, i, d, f, a, o)}</g><g opacity="${s.progress.toFixed(4)}">${Ft(s.to, l, u, i, d, f, a, o)}</g>`, x = mt(e.title ?? `${e.style} bubble`), S = s === void 0 ? "" : ` data-bubble-shape-transition-from="${s.from}" data-bubble-shape-transition-to="${s.to}" data-bubble-shape-transition-progress="${s.progress.toFixed(4)}"`;
4043
+ } : jt(Ct(l, u), l, u, i, a, o).bodyCenter, y = e.lines.map((e, t) => `<text x="${v.x}" y="${v.y + (g + t * h - u / 2) * _}" text-anchor="middle" fill="${bt(p)}" font-family="${bt(m)}" font-size="${r * _}">${bt(e)}</text>`).join(""), b = s === void 0 ? Wt(e.style, l, u, i, d, f, a, o) : `<g opacity="${(1 - s.progress).toFixed(4)}">${Wt(s.from, l, u, i, d, f, a, o)}</g><g opacity="${s.progress.toFixed(4)}">${Wt(s.to, l, u, i, d, f, a, o)}</g>`, x = bt(e.title ?? `${e.style} bubble`), S = s === void 0 ? "" : ` data-bubble-shape-transition-from="${s.from}" data-bubble-shape-transition-to="${s.to}" data-bubble-shape-transition-progress="${s.progress.toFixed(4)}"`;
3969
4044
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${u}" viewBox="0 0 ${l} ${u}" role="img" data-bubble-renderer="canonical" data-bubble-style="${e.style}" data-bubble-body-width="${l}" data-bubble-body-height="${u}"${S}><title>${x}</title>${b}${y}</svg>`;
3970
4045
  }
3971
4046
  //#endregion
3972
4047
  //#region node_modules/.pnpm/@cto.af+unicode-trie-runtime@3.2.9/node_modules/@cto.af/unicode-trie-runtime/constants.js
3973
- var Lt = 2048, Rt = 2112, zt = Uint8Array, Bt = Uint16Array, Vt = Int32Array, Ht = new zt([
4048
+ var Kt = 2048, qt = 2112, Jt = Uint8Array, Yt = Uint16Array, Xt = Int32Array, Zt = new Jt([
3974
4049
  0,
3975
4050
  0,
3976
4051
  0,
@@ -4003,7 +4078,7 @@ var Lt = 2048, Rt = 2112, zt = Uint8Array, Bt = Uint16Array, Vt = Int32Array, Ht
4003
4078
  0,
4004
4079
  0,
4005
4080
  0
4006
- ]), Ut = new zt([
4081
+ ]), Qt = new Jt([
4007
4082
  0,
4008
4083
  0,
4009
4084
  0,
@@ -4036,7 +4111,7 @@ var Lt = 2048, Rt = 2112, zt = Uint8Array, Bt = Uint16Array, Vt = Int32Array, Ht
4036
4111
  13,
4037
4112
  0,
4038
4113
  0
4039
- ]), Wt = new zt([
4114
+ ]), $t = new Jt([
4040
4115
  16,
4041
4116
  17,
4042
4117
  18,
@@ -4056,51 +4131,51 @@ var Lt = 2048, Rt = 2112, zt = Uint8Array, Bt = Uint16Array, Vt = Int32Array, Ht
4056
4131
  14,
4057
4132
  1,
4058
4133
  15
4059
- ]), Gt = function(e, t) {
4060
- for (var n = new Bt(31), r = 0; r < 31; ++r) n[r] = t += 1 << e[r - 1];
4061
- for (var i = new Vt(n[30]), r = 1; r < 30; ++r) for (var a = n[r]; a < n[r + 1]; ++a) i[a] = a - n[r] << 5 | r;
4134
+ ]), en = function(e, t) {
4135
+ for (var n = new Yt(31), r = 0; r < 31; ++r) n[r] = t += 1 << e[r - 1];
4136
+ for (var i = new Xt(n[30]), r = 1; r < 30; ++r) for (var a = n[r]; a < n[r + 1]; ++a) i[a] = a - n[r] << 5 | r;
4062
4137
  return {
4063
4138
  b: n,
4064
4139
  r: i
4065
4140
  };
4066
- }, Kt = Gt(Ht, 2), qt = Kt.b, Jt = Kt.r;
4067
- qt[28] = 258, Jt[258] = 28;
4068
- var Yt = Gt(Ut, 0), Xt = Yt.b;
4069
- Yt.r;
4070
- for (var Zt = new Bt(32768), J = 0; J < 32768; ++J) {
4071
- var Qt = (J & 43690) >> 1 | (J & 21845) << 1;
4072
- Qt = (Qt & 52428) >> 2 | (Qt & 13107) << 2, Qt = (Qt & 61680) >> 4 | (Qt & 3855) << 4, Zt[J] = ((Qt & 65280) >> 8 | (Qt & 255) << 8) >> 1;
4073
- }
4074
- for (var $t = (function(e, t, n) {
4075
- for (var r = e.length, i = 0, a = new Bt(t); i < r; ++i) e[i] && ++a[e[i] - 1];
4076
- var o = new Bt(t);
4141
+ }, tn = en(Zt, 2), nn = tn.b, rn = tn.r;
4142
+ nn[28] = 258, rn[258] = 28;
4143
+ var an = en(Qt, 0), on = an.b;
4144
+ an.r;
4145
+ for (var sn = new Yt(32768), J = 0; J < 32768; ++J) {
4146
+ var cn = (J & 43690) >> 1 | (J & 21845) << 1;
4147
+ cn = (cn & 52428) >> 2 | (cn & 13107) << 2, cn = (cn & 61680) >> 4 | (cn & 3855) << 4, sn[J] = ((cn & 65280) >> 8 | (cn & 255) << 8) >> 1;
4148
+ }
4149
+ for (var ln = (function(e, t, n) {
4150
+ for (var r = e.length, i = 0, a = new Yt(t); i < r; ++i) e[i] && ++a[e[i] - 1];
4151
+ var o = new Yt(t);
4077
4152
  for (i = 1; i < t; ++i) o[i] = o[i - 1] + a[i - 1] << 1;
4078
4153
  var s;
4079
4154
  if (n) {
4080
- s = new Bt(1 << t);
4155
+ s = new Yt(1 << t);
4081
4156
  var c = 15 - t;
4082
- for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], u = t - e[i], d = o[e[i] - 1]++ << u, f = d | (1 << u) - 1; d <= f; ++d) s[Zt[d] >> c] = l;
4083
- } else for (s = new Bt(r), i = 0; i < r; ++i) e[i] && (s[i] = Zt[o[e[i] - 1]++] >> 15 - e[i]);
4157
+ for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], u = t - e[i], d = o[e[i] - 1]++ << u, f = d | (1 << u) - 1; d <= f; ++d) s[sn[d] >> c] = l;
4158
+ } else for (s = new Yt(r), i = 0; i < r; ++i) e[i] && (s[i] = sn[o[e[i] - 1]++] >> 15 - e[i]);
4084
4159
  return s;
4085
- }), en = new zt(288), J = 0; J < 144; ++J) en[J] = 8;
4086
- for (var J = 144; J < 256; ++J) en[J] = 9;
4087
- for (var J = 256; J < 280; ++J) en[J] = 7;
4088
- for (var J = 280; J < 288; ++J) en[J] = 8;
4089
- for (var tn = new zt(32), J = 0; J < 32; ++J) tn[J] = 5;
4090
- var nn = /*#__PURE__*/ $t(en, 9, 1), rn = /*#__PURE__*/ $t(tn, 5, 1), an = function(e) {
4160
+ }), un = new Jt(288), J = 0; J < 144; ++J) un[J] = 8;
4161
+ for (var J = 144; J < 256; ++J) un[J] = 9;
4162
+ for (var J = 256; J < 280; ++J) un[J] = 7;
4163
+ for (var J = 280; J < 288; ++J) un[J] = 8;
4164
+ for (var dn = new Jt(32), J = 0; J < 32; ++J) dn[J] = 5;
4165
+ var fn = /*#__PURE__*/ ln(un, 9, 1), pn = /*#__PURE__*/ ln(dn, 5, 1), mn = function(e) {
4091
4166
  for (var t = e[0], n = 1; n < e.length; ++n) e[n] > t && (t = e[n]);
4092
4167
  return t;
4093
- }, on = function(e, t, n) {
4168
+ }, hn = function(e, t, n) {
4094
4169
  var r = t / 8 | 0;
4095
4170
  return (e[r] | e[r + 1] << 8) >> (t & 7) & n;
4096
- }, sn = function(e, t) {
4171
+ }, gn = function(e, t) {
4097
4172
  var n = t / 8 | 0;
4098
4173
  return (e[n] | e[n + 1] << 8 | e[n + 2] << 16) >> (t & 7);
4099
- }, cn = function(e) {
4174
+ }, _n = function(e) {
4100
4175
  return (e + 7) / 8 | 0;
4101
- }, ln = function(e, t, n) {
4102
- return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new zt(e.subarray(t, n));
4103
- }, un = [
4176
+ }, vn = function(e, t, n) {
4177
+ return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new Jt(e.subarray(t, n));
4178
+ }, yn = [
4104
4179
  "unexpected EOF",
4105
4180
  "invalid block type",
4106
4181
  "invalid length/literal",
@@ -4115,121 +4190,121 @@ var nn = /*#__PURE__*/ $t(en, 9, 1), rn = /*#__PURE__*/ $t(tn, 5, 1), an = funct
4115
4190
  "filename too long",
4116
4191
  "stream finishing",
4117
4192
  "invalid zip data"
4118
- ], dn = function(e, t, n) {
4119
- var r = Error(t || un[e]);
4120
- if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r, dn), !n) throw r;
4193
+ ], bn = function(e, t, n) {
4194
+ var r = Error(t || yn[e]);
4195
+ if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r, bn), !n) throw r;
4121
4196
  return r;
4122
- }, fn = function(e, t, n, r) {
4197
+ }, xn = function(e, t, n, r) {
4123
4198
  var i = e.length, a = r ? r.length : 0;
4124
- if (!i || t.f && !t.l) return n || new zt(0);
4199
+ if (!i || t.f && !t.l) return n || new Jt(0);
4125
4200
  var o = !n, s = o || t.i != 2, c = t.i;
4126
- o && (n = new zt(i * 3));
4201
+ o && (n = new Jt(i * 3));
4127
4202
  var l = function(e) {
4128
4203
  var t = n.length;
4129
4204
  if (e > t) {
4130
- var r = new zt(Math.max(t * 2, e));
4205
+ var r = new Jt(Math.max(t * 2, e));
4131
4206
  r.set(n), n = r;
4132
4207
  }
4133
4208
  }, u = t.f || 0, d = t.p || 0, f = t.b || 0, p = t.l, m = t.d, h = t.m, g = t.n, _ = i * 8;
4134
4209
  do {
4135
4210
  if (!p) {
4136
- u = on(e, d, 1);
4137
- var v = on(e, d + 1, 3);
4211
+ u = hn(e, d, 1);
4212
+ var v = hn(e, d + 1, 3);
4138
4213
  if (d += 3, !v) {
4139
- var y = cn(d) + 4, b = e[y - 4] | e[y - 3] << 8, x = y + b;
4214
+ var y = _n(d) + 4, b = e[y - 4] | e[y - 3] << 8, x = y + b;
4140
4215
  if (x > i) {
4141
- c && dn(0);
4216
+ c && bn(0);
4142
4217
  break;
4143
4218
  }
4144
4219
  s && l(f + b), n.set(e.subarray(y, x), f), t.b = f += b, t.p = d = x * 8, t.f = u;
4145
4220
  continue;
4146
4221
  }
4147
- if (v == 1) p = nn, m = rn, h = 9, g = 5;
4222
+ if (v == 1) p = fn, m = pn, h = 9, g = 5;
4148
4223
  else if (v == 2) {
4149
- var S = on(e, d, 31) + 257, C = on(e, d + 10, 15) + 4, w = S + on(e, d + 5, 31) + 1;
4224
+ var S = hn(e, d, 31) + 257, C = hn(e, d + 10, 15) + 4, w = S + hn(e, d + 5, 31) + 1;
4150
4225
  d += 14;
4151
- for (var T = new zt(w), E = new zt(19), D = 0; D < C; ++D) E[Wt[D]] = on(e, d + D * 3, 7);
4226
+ for (var T = new Jt(w), E = new Jt(19), D = 0; D < C; ++D) E[$t[D]] = hn(e, d + D * 3, 7);
4152
4227
  d += C * 3;
4153
- for (var O = an(E), k = (1 << O) - 1, A = $t(E, O, 1), D = 0; D < w;) {
4154
- var j = A[on(e, d, k)];
4228
+ for (var O = mn(E), k = (1 << O) - 1, A = ln(E, O, 1), D = 0; D < w;) {
4229
+ var j = A[hn(e, d, k)];
4155
4230
  d += j & 15;
4156
4231
  var y = j >> 4;
4157
4232
  if (y < 16) T[D++] = y;
4158
4233
  else {
4159
4234
  var M = 0, N = 0;
4160
- for (y == 16 ? (N = 3 + on(e, d, 3), d += 2, M = T[D - 1]) : y == 17 ? (N = 3 + on(e, d, 7), d += 3) : y == 18 && (N = 11 + on(e, d, 127), d += 7); N--;) T[D++] = M;
4235
+ for (y == 16 ? (N = 3 + hn(e, d, 3), d += 2, M = T[D - 1]) : y == 17 ? (N = 3 + hn(e, d, 7), d += 3) : y == 18 && (N = 11 + hn(e, d, 127), d += 7); N--;) T[D++] = M;
4161
4236
  }
4162
4237
  }
4163
4238
  var P = T.subarray(0, S), F = T.subarray(S);
4164
- h = an(P), g = an(F), p = $t(P, h, 1), m = $t(F, g, 1);
4165
- } else dn(1);
4239
+ h = mn(P), g = mn(F), p = ln(P, h, 1), m = ln(F, g, 1);
4240
+ } else bn(1);
4166
4241
  if (d > _) {
4167
- c && dn(0);
4242
+ c && bn(0);
4168
4243
  break;
4169
4244
  }
4170
4245
  }
4171
4246
  s && l(f + 131072);
4172
- for (var I = (1 << h) - 1, ee = (1 << g) - 1, L = d;; L = d) {
4173
- var M = p[sn(e, d) & I], R = M >> 4;
4247
+ for (var I = (1 << h) - 1, L = (1 << g) - 1, R = d;; R = d) {
4248
+ var M = p[gn(e, d) & I], z = M >> 4;
4174
4249
  if (d += M & 15, d > _) {
4175
- c && dn(0);
4250
+ c && bn(0);
4176
4251
  break;
4177
4252
  }
4178
- if (M || dn(2), R < 256) n[f++] = R;
4179
- else if (R == 256) {
4180
- L = d, p = null;
4253
+ if (M || bn(2), z < 256) n[f++] = z;
4254
+ else if (z == 256) {
4255
+ R = d, p = null;
4181
4256
  break;
4182
4257
  } else {
4183
- var z = R - 254;
4184
- if (R > 264) {
4185
- var D = R - 257, B = Ht[D];
4186
- z = on(e, d, (1 << B) - 1) + qt[D], d += B;
4258
+ var B = z - 254;
4259
+ if (z > 264) {
4260
+ var D = z - 257, V = Zt[D];
4261
+ B = hn(e, d, (1 << V) - 1) + nn[D], d += V;
4187
4262
  }
4188
- var V = m[sn(e, d) & ee], H = V >> 4;
4189
- V || dn(3), d += V & 15;
4190
- var F = Xt[H];
4263
+ var ee = m[gn(e, d) & L], H = ee >> 4;
4264
+ ee || bn(3), d += ee & 15;
4265
+ var F = on[H];
4191
4266
  if (H > 3) {
4192
- var B = Ut[H];
4193
- F += sn(e, d) & (1 << B) - 1, d += B;
4267
+ var V = Qt[H];
4268
+ F += gn(e, d) & (1 << V) - 1, d += V;
4194
4269
  }
4195
4270
  if (d > _) {
4196
- c && dn(0);
4271
+ c && bn(0);
4197
4272
  break;
4198
4273
  }
4199
4274
  s && l(f + 131072);
4200
- var U = f + z;
4275
+ var U = f + B;
4201
4276
  if (f < F) {
4202
4277
  var te = a - F, ne = Math.min(F, U);
4203
- for (te + f < 0 && dn(3); f < ne; ++f) n[f] = r[te + f];
4278
+ for (te + f < 0 && bn(3); f < ne; ++f) n[f] = r[te + f];
4204
4279
  }
4205
4280
  for (; f < U; ++f) n[f] = n[f - F];
4206
4281
  }
4207
4282
  }
4208
- t.l = p, t.p = L, t.b = f, t.f = u, p && (u = 1, t.m = h, t.d = m, t.n = g);
4283
+ t.l = p, t.p = R, t.b = f, t.f = u, p && (u = 1, t.m = h, t.d = m, t.n = g);
4209
4284
  } while (!u);
4210
- return f != n.length && o ? ln(n, 0, f) : n.subarray(0, f);
4211
- }, pn = /*#__PURE__*/ new zt(0), mn = function(e) {
4212
- (e[0] != 31 || e[1] != 139 || e[2] != 8) && dn(6, "invalid gzip data");
4285
+ return f != n.length && o ? vn(n, 0, f) : n.subarray(0, f);
4286
+ }, Sn = /*#__PURE__*/ new Jt(0), Cn = function(e) {
4287
+ (e[0] != 31 || e[1] != 139 || e[2] != 8) && bn(6, "invalid gzip data");
4213
4288
  var t = e[3], n = 10;
4214
4289
  t & 4 && (n += (e[10] | e[11] << 8) + 2);
4215
4290
  for (var r = (t >> 3 & 1) + (t >> 4 & 1); r > 0; r -= !e[n++]);
4216
4291
  return n + (t & 2);
4217
- }, hn = function(e) {
4292
+ }, wn = function(e) {
4218
4293
  var t = e.length;
4219
4294
  return (e[t - 4] | e[t - 3] << 8 | e[t - 2] << 16 | e[t - 1] << 24) >>> 0;
4220
4295
  };
4221
- function gn(e, t) {
4222
- var n = mn(e);
4223
- return n + 8 > e.length && dn(6, "invalid gzip data"), fn(e.subarray(n, -8), { i: 2 }, t && t.out || new zt(hn(e)), t && t.dictionary);
4296
+ function Tn(e, t) {
4297
+ var n = Cn(e);
4298
+ return n + 8 > e.length && bn(6, "invalid gzip data"), xn(e.subarray(n, -8), { i: 2 }, t && t.out || new Jt(wn(e)), t && t.dictionary);
4224
4299
  }
4225
- var _n = typeof TextDecoder < "u" && /*#__PURE__*/ new TextDecoder();
4300
+ var En = typeof TextDecoder < "u" && /*#__PURE__*/ new TextDecoder();
4226
4301
  try {
4227
- _n.decode(pn, { stream: !0 });
4302
+ En.decode(Sn, { stream: !0 });
4228
4303
  } catch {}
4229
4304
  //#endregion
4230
4305
  //#region node_modules/.pnpm/@cto.af+unicode-trie-runtime@3.2.9/node_modules/@cto.af/unicode-trie-runtime/swap.js
4231
- var vn = new Uint8Array(new Uint32Array([305419896]).buffer)[0] === 18;
4232
- function yn(e) {
4306
+ var Dn = new Uint8Array(new Uint32Array([305419896]).buffer)[0] === 18;
4307
+ function On(e) {
4233
4308
  let t = e.length;
4234
4309
  for (let n = 0; n < t; n += 4) [e[n], e[n + 1], e[n + 2], e[n + 3]] = [
4235
4310
  e[n + 3],
@@ -4238,15 +4313,15 @@ function yn(e) {
4238
4313
  e[n]
4239
4314
  ];
4240
4315
  }
4241
- function bn(e) {}
4242
- var xn = vn ? yn : bn, Sn = new TextDecoder(), Cn = class e {
4316
+ function kn(e) {}
4317
+ var An = Dn ? On : kn, jn = new TextDecoder(), Mn = class e {
4243
4318
  constructor(e) {
4244
4319
  if (e instanceof Uint8Array) {
4245
4320
  let t = 0, n = new DataView(e.buffer);
4246
4321
  if (this.highStart = n.getUint32(0, !0), this.errorValue = n.getUint32(4, !0), t = n.getUint32(8, !0), t !== 4294967295) throw Error("Trie created with old version of @cto.af/unicode-trie.");
4247
4322
  if (t = n.getUint32(12, !0), 16 + t > e.byteLength) throw RangeError("Invalid input length");
4248
4323
  let r = e.subarray(16 + t);
4249
- this.values = r.length ? JSON.parse(Sn.decode(gn(r))) : [], e = gn(e.subarray(16, 16 + t)), xn(e), this.data = new Int32Array(e.buffer);
4324
+ this.values = r.length ? JSON.parse(jn.decode(Tn(r))) : [], e = Tn(e.subarray(16, 16 + t)), An(e), this.data = new Int32Array(e.buffer);
4250
4325
  } else ({data: this.data, highStart: this.highStart, errorValue: this.errorValue, values: this.values = []} = e);
4251
4326
  }
4252
4327
  static fromBase64(t) {
@@ -4259,10 +4334,10 @@ var xn = vn ? yn : bn, Sn = new TextDecoder(), Cn = class e {
4259
4334
  let n = (this.data[e >> 5] << 2) + (e & 31);
4260
4335
  t = this.data[n];
4261
4336
  } else if (e <= 65535) {
4262
- let n = (this.data[Lt + (e - 55296 >> 5)] << 2) + (e & 31);
4337
+ let n = (this.data[Kt + (e - 55296 >> 5)] << 2) + (e & 31);
4263
4338
  t = this.data[n];
4264
4339
  } else if (e < this.highStart) {
4265
- let n = this.data[Rt - 32 + (e >> 11)];
4340
+ let n = this.data[qt - 32 + (e >> 11)];
4266
4341
  n = this.data[n + (e >> 5 & 63)], n = (n << 2) + (e & 31), t = this.data[n];
4267
4342
  } else t = this.data[this.data.length - 4];
4268
4343
  return t;
@@ -4271,26 +4346,26 @@ var xn = vn ? yn : bn, Sn = new TextDecoder(), Cn = class e {
4271
4346
  let t = this.get(e);
4272
4347
  return this.values[t] ?? t;
4273
4348
  }
4274
- }, wn = Cn.fromBase64("AAgOAAEAAAD/////nRQAAB+LCAC4xcFoAgPtnQnwlkUdx1+URLxABcUUghTEEK8Cmwp0LJAa\n MRrFbBSPSXHSAUYNdFQoBWMKyQrUCo/EyMIjD3TIAxXJM5NBHBm0RDSPzDOVdAz7/nB/07bt\n s8/e+/zhfef9zD7HPs/e129/u8/yzVutVWANeBl079xq9QJ9wUCwDxjqYQ4DI8BoMBYcBY4D\n 48FEw3NTwDTp/BxwAZgJLgaXgCvAAnADuA3cDe4Hj0rPLQerwLPgJfAaeBe8Az4EnT/Ram0D\n eoBdwe5gENgX0DsOhHkQGAlGgTHgaHACGA8mgilgGpgBLgJzweVgPlgIbgF3iPOl4BGwAqwG\n a8Er4C2wDnwEumzRanUDPUFv0B8MBgeAL4BDwNfAN8C3wIngO+A0cCZowd/nwrwA/Eic/wzm\n L8EMHM+HuRDcDP4g7t8Hk3hYmI8BCv+TwvwLTOZvglfBawKyQ7wrjv8Ns1OXVqsroPNuwuwJ\n szfoL86JwTgeIp3HYJj0vhE4Hg3GgnHgZMDhnYDjyWCqZP9CHM8Gc8S1y2BeBa4FvweLxPN3\n wVwq7Dwirp0KVuB4NVgLXgSvg/fA+6C1Jf6gO+gF+oI9wQa3YQ4FwwDlwREwR4Mj+L6GY3Dv\n eMN9OY7JPAV2Jwn7Z8E8F0wHs8AcMA9cA64Dt4I7wT3gQfA4eAI8DdaKd7wizLdgvg86dUWa\n g+1BL0D3+sIcAAaLc5X9xfUDYR4EDlUYJR2PAUeCY8FJ4DRwJjgXTAezwBwwD1wDrgO3gjuF\n G/fAfBA8Js5XwnwaPF/htypeFfbfhvm+w7OdtkL6Axe3thP2uSzuhPM+YICA6tZ9YA4FwwGV\n 55F0XTBGOlY5GhwHxoOJYAqYBn4AfiyOLwVXgvnSc9dKxzeC28XxEoNbbdq0iQvXEe24aNOm\n TZs2bdq0aePC0ob55yFhPg5IHlI3Rl4Je8+I/vALMN+T7v3DMN5+B/c+BJ23hhwQ0LUeMM+G\n OQrshuM9AMkJ94b5WfBF8GVwKPg6+CYgOc7xME8BLFsiJuH8LPA9MFO8/yJhMnNxfjm4AlwJ\n rgK/AleD+e177Xvte+177XvR7/0O3ARuBSQzLcmd8ENJSoe/TZsmE9qfvR9l7FHwhNL3c+Ep\n zbPP4trz4FXwT/AB2Gyb/7WzJc67g16gLxgIBgOasxkCcxgoXf/c2+1jDu7ean0fLDbwDvjc\n 9pi7Aj8H8r1V4vxlmLvtgLlCMBesBNvs+PG9g2GeBxaB5aB7j1brOczh9UN8nAiuBs8BGg8c\n BqgP/xOqI2n+VvAQzile53T6L6NwLts5G+eLwSpxfT3M4dtiTg0sAevB8O1wDuT35GZJA9yX\n 461NmzZtNiXWow6cTrpKaCNGU3uhtPNjcW0cOEFq28fjeAI4HUwWz8iQbIvsrYM5VTw3HSbp\n Fs2EebG4dpnGPYL0hM4n3SfcXyDsLhTmzTBvA3eI86VKn6MK0lshfao/kt9x/pjk7ydFW7lG\n vIt0rl4W99+EuQ58BEh3jP3bBW1oVxHObjjeCfQB7B7bG8DXYJ5OelYwvwS+Ath9fuY0KT4O\n E88dKcxjYJIs8NswT5WeVSG/k/0zYOcccL54nuLvh+QHmD8V5jJA8fILnP8Lz10N87eAdMRu\n grlY9Bfo/AGYfwYrxPl9eOdqHK8l/+D47zDfFv76AOZmyFeTcLwVzB1AL9AXDAT7gSFgGBgB\n yH87ks4ZjseK86+CcdQ+a8JI90/GvQniPtufjPOp4vkLYc4Gc8Hl4NfgesP7Fin3OE3uwvVl\n 4BGwQrKzGsd/BS+C18Hb4APhdif0J7sC1unbHsf83C7SMd3vh/O9yC4YCoaBQ8Aoyd4YHB8J\n jgUngVMBlQ8qG2dI9nScg/sXgJngYsnupTi+EvxG+DMnXI7UuCZuNPjn9pqwboxQOeXwc50Q\n gyUinh8wxPfDFfeW4/qqAvmmaVDb6PvsGiX+XvLM2/1Qb76xEZeLGOlEdTC1i+tEnNMx1Z8f\n ivPOGJtvDXYEJNfw9eeueL4uHLvDziBA/Rb5+gG4Rvq0n5feQTKJXHp8rlBfaiT8R7KcKnnV\n 4Yb42BQ4wjL9joG9E8Apjul9uBL3TS+/kxC+74LzGpAvTHl7BvznUyYuwnM05iGoLM/F+Tzl\n XdyHqStbZM4S5/PxjoXgJvEuWqvAdkmuKIeL6hV5TET9e6r/qsJPazHIvBfveQgsF248BXMF\n 1YcOcXGERXv4AslIPeNXhuL3TVFnroO5HmwB2WtT8j21Mdsa/NMT93qDDevFkJ79Fbsb1s7g\n 2hDLMFE/cZh434iAeKD3jDY8T/fHGu5TuMfVuH+y8KeOCeJZPp+cIU1JD4fcmiq5NVvIIaqe\n oXJyIezPBpeAK8AC8Xxvi/5YXd1+A951C6C1R4uFeTdMurdMmC78Cc+sBM+ANdLzNF/xBlgH\n PpKud8G8xXagB9gZ9AF0fQ+Yg8QxcQCOh4rz4TBHimM5TQ/HNT5egHDQfdZFOkrcI/nEcTge\n Dyh+JsKcIt41TZgzYM5S3j9H8gsxD+dXSe4x10rXrleeyc2iwu6XhsJ/F8WBqMeJ/ysfBpaJ\n PNKReXzzThvYDKd1YFn0hscg/tsALZ21ec4GsTS0hWLZou4kDX9oaELHdI1EeiT24ntUtVGX\n g0yq7igpbCD7BL2HIXfl89RQWCgMHJ7ckPuUlpj63XBO8Y9pyE2aTf2nK5NQC4hWvuvoKfIl\n lXkqGwzlz50EfMx1BOVhztP8HNvdWXlWhp6Xz8ndlOWN/V6K0u43Dc4fch7gc9s4U/OU/Azn\n vZLkKrdNheqTKnzeVxff/FOvc19D/dW9SzZjkuKdMfPmxlrn5Ix3mzzWBKhs9NL4l9rxqj5J\n 06HwcD6W8zQf01iDzLrfLhmpc1vNVza/qvGXnP7UZ2PUcZlLnHOcksk0KZ+nyGe2412KW13c\n p65rOQ3qwmCyo8afzi7bsY2PmPV4yfYqZl7qKO1F6nhyreNs6rvY+S9XnOjaai7TssxAHqfn\n 8GuV/9XrVfZi5PVcZaXK367u636hfuP8bCtL8u3np+6vURhK9BObUPZjxm+scZ0810DkrFfV\n 8uY6zgotWy5ygSq35DJYlyZqedWVX5s2UTeeqQqT6pZr+vJ4QRc/fF1uj6rCZYprU1hypG/d\n sRznpnS1Sd+6dKzLa3X5wzZ9dfWEa5/Mtfzq0qRE+vqWX10eqErfkL6tOubxLb8s1zG54RLO\n nPWzb/3pkl9z1J8ufcQqP9fl9ao6w9Re6cKsS7u6a3Xto2s81NWvpjxqW/5s5IEpxpncTtr2\n 4XPWpbHGWa79Idv0NMWZKR5i1aemn+38oxwum2dKpm+M9jJm+pr6RrHSV9eH9dXnyN0XijEO\n i5GedX16VzluqvZXHr9UpY1P/9a1zSs176m2kbb+NY13qvKLjYwqtP1V/eLT//5kQ1B/1G8I\n eZ/LfA3LgUzxw8dVcZYiLuvcjB33IX7wybe6NKM+gox8jfRq+JjSi87l+ViGrut0buvaqdhy\n QPKj3MawSbqApBfLZoi81kcuXqV3XXc9VHbeBH0L+nF5N7W/Nm2NnBer+rasD9bEute1flTD\n lst9Ux1vK8PWjZFD+x27Fma3wvQujG/fMFQ/0iX/hD7f9PClnr9OHX8+Mh65PTS1Iyn9UULX\n M/b8vq9uKf9ID7KkjkvOtOe+om/8cxvu6meXubpY+jcuc0Wx3TeNBVOH33e+LKQ+rZM55pQd\n cNz3kc4578rygFhy7Fj1H4872f88FpD1hNV1Iy76tbnr35Dyn1v3yCT3KhEnJdpnG1mui46u\n ryzBNNaiH5eH0HFfbPlWqvouVX0ZKjdW65S68XQqfWC1nJSUO8eoj0OfjxGGUjI1V/erZGIh\n P507n8qIa7z1tXinLK/sZwnb/7TS7+drNtj43+Y9sttN00121aMOnR+wTb/UuIZ/d4FrfydV\n PSOXCRmf+jfl/E9KuUMpuVPMfnKMdQIucze69X6m8YPvngAl9yOwqWNt5Wsu+hSp9xRoytr0\n UN3tunhPHQ91brDsoqqOZSivyed7iDzXX8p/JJ8le2QSA4C8lwntkcP7bvGxfC7bJfaUIDd5\n j7CqsiCv/dYh+4HcIbkTYdpLgOWwbNdk31R/k/tqnKpy2oGB43o1H9js0cPhk/ebUfegsZVT\n h8pW5D2aVNQ9nFzQPStf4+MQN4jYfZ4Q+TDndzUNTfqAVfs7uazFtc03KfaP0u3LZYvP877u\n ++6zpf5SuOfiJ9+w6PylXtPdZ1Pdx80UZ1VxoYahLl/Y7tflUxbqwhyr7OjioCpuTOexymmM\n 99vGWe5960LdoT5PrDlkNn39yrIdFzdTxKkqa0o9n5NyfjbFL6T9i03O9jTEjVT9CZt61qWe\n DAmTbX1rkw4ubWysflyu/Uh19Utdv8QUb/wevs/vlN3YK0J95hvGWP26FP0CXV0ix6XOfmi8\n lNw7tlSc284PqXnZlKf5umpfVx7Ue3K5q4onnT9079H5h8ubyX5VGZHfIVOiPynLz2RkPSTV\n /2p/0NZM2Ufw7dPm3tveJp46kn5prDC7miXDUCoOc7QdKeU9KeZZbNZTsw6ZKjPna6G6jLZ6\n v6Y9S0rqHMbaN8j3flUbVIdpnonTleaP+JsiapunntfVOer7WUdXNw+jCyvNYxE6P9Ix+7Mu\n TCa3uM3mb9JUmfLe1q59N19yulXnD5dfU/yRyn/8vR2Cr9H8JB/btsm29undfCw/56tbVmVX\n d53nXtV0+Iw4rjNTk8udOvdtwl13j1B1YuT5b04HMpsW/7HCr8t/dF0Of846J3W9HPtdNnUf\n x7UvpdsiV1mJjawiFLWODEm73G1mLF1J2/GB7X7UtvqhJeeTfPc4T7mPtLpuWqWJ66malIZV\n Oq6uerCp9Oh1dlzCzrpIudKf92/hsZbP+hIbHa0Q/fQYe/v4lmd5T5s6veq6vYViyzJT69KV\n 2t/FlN451zKFrm3i9U0264J0fQOX9U5Vfe6S+xPRL8VaHJe8rK69qpNJqe92jX81XX3X2fr8\n XPaHsq1PdPWWa12Sag1GaXmwT98pZ/2vy8+h7e8gsHdGcrvn+ou5l5j6K7GfmPobXJiY4xLb\n d9C3GKnM2H7Xkd7j+z1I03X5ftWxjd9KwDLy0mNPV/fUtSCh4wyeF5DXS8nzWnSd9Jqrfrye\n UWfa3NP1O131E9TnTDItvs/rn9Qwm9y3lS/yuiSdDK2J32LmH61l4/l7DpMcFl0cy/HpKvNU\n 5Z6yuzmgsPj4PZX78jydfMzx1BFk7Gr61smlU9yXf7w+UL7Pa5Fc9pe3lTntI+YJYvTvQ9Y9\n x9gbNOU66lxyYJPsuqPtBRpjvW7uX6n9Y3LpfMUe8+fYy6sJ+99x2QyVR1TJrEvlz9Lxmzq8\n Kct+jO8mpnIrV35pYv3rso+6j2w1RzkxpWeOslpV38Xey7lJ7XVVnDdFVyDn2o2m7A1s871r\n U3+hbp661LfjbL6l6vL9O5v5uiqdcd/9mG3sVrlrktHl3m+5Ln46Qply/f51rDq2afV3U92P\n 9Z2CVPu71+kExf4uhm265Mpfcrjl9S+p/WGjb9FEeYmrHlhsXTLb772b2v3U8bKvoAk6VaQ3\n ZdqvWf2FytNd9g1W/c57VNf9+JuMuXT+ZJ1tnZ6T7U+un1PXpSm/BxKiZ+b6nUC5P+bybdoU\n 3wWR9zP1WcOrrtc06dG7rA9gf6lzCCVlQKl1cKvW16r7MjdxPqHue3m55l5M6yRy1q8p6i+d\n GzbfR5Dtqeeu1D2rulVlp+67ulXfzlDPqS/AP52us+kb5aoetdp226wrqOtHuvxc9InlsMrX\n 5HCkgvtULt80VtPB5tvHlLbU51R1leQ+nW0ftknjClM7Ktf7Pt9n161FKfULHbeU/P5brO/5\n 8PeveZ2l+s31OpmmizxP5z/VrssvNP7Vb9XbUGr+LWSdWKr4c/lemct7U/1KfJcs5nfiXNcz\n Va3lCf2OXi75c+gaSd/4SyH/pmds+8G2fWCbvmwMeZapf6v2g9hU16vF7l/65K8cc6uh7bIs\n W8jdLyyxp4BPPOru6+Qx8rd8beIyhew8xjoMtU8l90dcyldseUOJPpPLevpc7ZnvL8f4oaRO\n ad34WVeefPYVSdG+27T7vPdESj0VV5leyvXoufQvffKZTpZmGy+27UNKfYCc5dWmj2fbp44Z\n P6G/WN9X1cl8beoieS7ad7+PGP14nz1ATO1q3Xx2jHnpWO1xR1uPovumYQndrFD9uyrdvpD4\n b9L8Yaz9wxl5bbVu/XlT9j2X/Rr6Hl7brYPd0V1jM5bOk+84oUn7xpeeH7IhVJ7j25+IrU9s\n ig+XOi7lGMtGj9pGB903/kuMQVPuORpjv7+c35AvvYYkNO1CviFvU4/HkF+qe2ZTG+VTn1bt\n fV7y5/PtqNR76oeuy4zlH3n/9ND3qPuxu7xb3cuj7heahiXq4ljrC1R5vm5M39HGFz7yzRLr\n k1PoMMfcPzeGvDPWPssxw6Rzo8QcXmp3XGSSHX2/Et08k67f5dtmuupKN2FvMpOsKObeDnVx\n k3ofp1h6VrFIVVdV7T2fYm9013l7k/5rbNlKaBuXso7LLV+K1d67uuWiJ19ShhcjvUP97FsO\n Q+V7pdfDpy5rtv2qEPkU7XFY0v3Q+Oc8FpqHdHV9Xf415XFbPTPfPk7qNWsufow9vkqlz6v+\n eA4udH9l3XxtiA5ZyN5XpvxSNzdetRdQlWnKjzbP695Xt9+WTz/bJk5y6tDVlYHUe0Crv9Bv\n vMf+bnzq79DHenfs/ZD3y4TO7b0S7vPM8Z5yL2mTG1XXKcyMLh5093OzvwbVfzr/1hHDby7u\n ufhH5z/Vrm1YZPsheUtn2pQh+RnfMmCqy3PN7aSeN0oRtrp8m6oONOXflHVfrnj0ccdU1lVS\n yYu7Ssjz96ZwxEgz13rX1c3Y+Sp2vJve7eN+zP3nYsojYunAhMq1cs2vM1X9J99+Q2g+d+1z\n 5OznpXJD1zcKcc/U33KN39TzgCnr4lz95Fz1cW79kxT6SDF00UruT5ZDZ8Xl9x83MV0I0CwB\n AB+LCAC4xcFoAgMdjksWhCAMBO/CelYzJ4gMCqiI4t/n/a9hyk29JN3p5DL7bj7GTQrbKypR\n dDVVywyhZCz4xkUhnSIj5EExoFoQisIfbICE2WJOoAESSK7wecCscDJSxRXMbBAlfLCyIbTh\n T8tr5/YikvVFSYq3dURbKo/gf+Q3zBCELycCXW/uB2mPjCb8AAAA"), Tn = Object.fromEntries(wn.values.map((e, t) => [e, t])), { values: En } = wn, { AI: Dn, AL: On, CJ: kn, CM: An, NS: jn, SA: Mn, SG: Nn, SP: Pn, XX: Fn } = Tn;
4275
- function In(e) {
4349
+ }, Nn = Mn.fromBase64("AAgOAAEAAAD/////nRQAAB+LCAC4xcFoAgPtnQnwlkUdx1+URLxABcUUghTEEK8Cmwp0LJAa\n MRrFbBSPSXHSAUYNdFQoBWMKyQrUCo/EyMIjD3TIAxXJM5NBHBm0RDSPzDOVdAz7/nB/07bt\n s8/e+/zhfef9zD7HPs/e129/u8/yzVutVWANeBl079xq9QJ9wUCwDxjqYQ4DI8BoMBYcBY4D\n 48FEw3NTwDTp/BxwAZgJLgaXgCvAAnADuA3cDe4Hj0rPLQerwLPgJfAaeBe8Az4EnT/Ram0D\n eoBdwe5gENgX0DsOhHkQGAlGgTHgaHACGA8mgilgGpgBLgJzweVgPlgIbgF3iPOl4BGwAqwG\n a8Er4C2wDnwEumzRanUDPUFv0B8MBgeAL4BDwNfAN8C3wIngO+A0cCZowd/nwrwA/Eic/wzm\n L8EMHM+HuRDcDP4g7t8Hk3hYmI8BCv+TwvwLTOZvglfBawKyQ7wrjv8Ns1OXVqsroPNuwuwJ\n szfoL86JwTgeIp3HYJj0vhE4Hg3GgnHgZMDhnYDjyWCqZP9CHM8Gc8S1y2BeBa4FvweLxPN3\n wVwq7Dwirp0KVuB4NVgLXgSvg/fA+6C1Jf6gO+gF+oI9wQa3YQ4FwwDlwREwR4Mj+L6GY3Dv\n eMN9OY7JPAV2Jwn7Z8E8F0wHs8AcMA9cA64Dt4I7wT3gQfA4eAI8DdaKd7wizLdgvg86dUWa\n g+1BL0D3+sIcAAaLc5X9xfUDYR4EDlUYJR2PAUeCY8FJ4DRwJjgXTAezwBwwD1wDrgO3gjuF\n G/fAfBA8Js5XwnwaPF/htypeFfbfhvm+w7OdtkL6Axe3thP2uSzuhPM+YICA6tZ9YA4FwwGV\n 55F0XTBGOlY5GhwHxoOJYAqYBn4AfiyOLwVXgvnSc9dKxzeC28XxEoNbbdq0iQvXEe24aNOm\n TZs2bdq0aePC0ob55yFhPg5IHlI3Rl4Je8+I/vALMN+T7v3DMN5+B/c+BJ23hhwQ0LUeMM+G\n OQrshuM9AMkJ94b5WfBF8GVwKPg6+CYgOc7xME8BLFsiJuH8LPA9MFO8/yJhMnNxfjm4AlwJ\n rgK/AleD+e177Xvte+177XvR7/0O3ARuBSQzLcmd8ENJSoe/TZsmE9qfvR9l7FHwhNL3c+Ep\n zbPP4trz4FXwT/AB2Gyb/7WzJc67g16gLxgIBgOasxkCcxgoXf/c2+1jDu7ean0fLDbwDvjc\n 9pi7Aj8H8r1V4vxlmLvtgLlCMBesBNvs+PG9g2GeBxaB5aB7j1brOczh9UN8nAiuBs8BGg8c\n BqgP/xOqI2n+VvAQzile53T6L6NwLts5G+eLwSpxfT3M4dtiTg0sAevB8O1wDuT35GZJA9yX\n 461NmzZtNiXWow6cTrpKaCNGU3uhtPNjcW0cOEFq28fjeAI4HUwWz8iQbIvsrYM5VTw3HSbp\n Fs2EebG4dpnGPYL0hM4n3SfcXyDsLhTmzTBvA3eI86VKn6MK0lshfao/kt9x/pjk7ydFW7lG\n vIt0rl4W99+EuQ58BEh3jP3bBW1oVxHObjjeCfQB7B7bG8DXYJ5OelYwvwS+Ath9fuY0KT4O\n E88dKcxjYJIs8NswT5WeVSG/k/0zYOcccL54nuLvh+QHmD8V5jJA8fILnP8Lz10N87eAdMRu\n grlY9Bfo/AGYfwYrxPl9eOdqHK8l/+D47zDfFv76AOZmyFeTcLwVzB1AL9AXDAT7gSFgGBgB\n yH87ks4ZjseK86+CcdQ+a8JI90/GvQniPtufjPOp4vkLYc4Gc8Hl4NfgesP7Fin3OE3uwvVl\n 4BGwQrKzGsd/BS+C18Hb4APhdif0J7sC1unbHsf83C7SMd3vh/O9yC4YCoaBQ8Aoyd4YHB8J\n jgUngVMBlQ8qG2dI9nScg/sXgJngYsnupTi+EvxG+DMnXI7UuCZuNPjn9pqwboxQOeXwc50Q\n gyUinh8wxPfDFfeW4/qqAvmmaVDb6PvsGiX+XvLM2/1Qb76xEZeLGOlEdTC1i+tEnNMx1Z8f\n ivPOGJtvDXYEJNfw9eeueL4uHLvDziBA/Rb5+gG4Rvq0n5feQTKJXHp8rlBfaiT8R7KcKnnV\n 4Yb42BQ4wjL9joG9E8Apjul9uBL3TS+/kxC+74LzGpAvTHl7BvznUyYuwnM05iGoLM/F+Tzl\n XdyHqStbZM4S5/PxjoXgJvEuWqvAdkmuKIeL6hV5TET9e6r/qsJPazHIvBfveQgsF248BXMF\n 1YcOcXGERXv4AslIPeNXhuL3TVFnroO5HmwB2WtT8j21Mdsa/NMT93qDDevFkJ79Fbsb1s7g\n 2hDLMFE/cZh434iAeKD3jDY8T/fHGu5TuMfVuH+y8KeOCeJZPp+cIU1JD4fcmiq5NVvIIaqe\n oXJyIezPBpeAK8AC8Xxvi/5YXd1+A951C6C1R4uFeTdMurdMmC78Cc+sBM+ANdLzNF/xBlgH\n PpKud8G8xXagB9gZ9AF0fQ+Yg8QxcQCOh4rz4TBHimM5TQ/HNT5egHDQfdZFOkrcI/nEcTge\n Dyh+JsKcIt41TZgzYM5S3j9H8gsxD+dXSe4x10rXrleeyc2iwu6XhsJ/F8WBqMeJ/ysfBpaJ\n PNKReXzzThvYDKd1YFn0hscg/tsALZ21ec4GsTS0hWLZou4kDX9oaELHdI1EeiT24ntUtVGX\n g0yq7igpbCD7BL2HIXfl89RQWCgMHJ7ckPuUlpj63XBO8Y9pyE2aTf2nK5NQC4hWvuvoKfIl\n lXkqGwzlz50EfMx1BOVhztP8HNvdWXlWhp6Xz8ndlOWN/V6K0u43Dc4fch7gc9s4U/OU/Azn\n vZLkKrdNheqTKnzeVxff/FOvc19D/dW9SzZjkuKdMfPmxlrn5Ix3mzzWBKhs9NL4l9rxqj5J\n 06HwcD6W8zQf01iDzLrfLhmpc1vNVza/qvGXnP7UZ2PUcZlLnHOcksk0KZ+nyGe2412KW13c\n p65rOQ3qwmCyo8afzi7bsY2PmPV4yfYqZl7qKO1F6nhyreNs6rvY+S9XnOjaai7TssxAHqfn\n 8GuV/9XrVfZi5PVcZaXK367u636hfuP8bCtL8u3np+6vURhK9BObUPZjxm+scZ0810DkrFfV\n 8uY6zgotWy5ygSq35DJYlyZqedWVX5s2UTeeqQqT6pZr+vJ4QRc/fF1uj6rCZYprU1hypG/d\n sRznpnS1Sd+6dKzLa3X5wzZ9dfWEa5/Mtfzq0qRE+vqWX10eqErfkL6tOubxLb8s1zG54RLO\n nPWzb/3pkl9z1J8ufcQqP9fl9ao6w9Re6cKsS7u6a3Xto2s81NWvpjxqW/5s5IEpxpncTtr2\n 4XPWpbHGWa79Idv0NMWZKR5i1aemn+38oxwum2dKpm+M9jJm+pr6RrHSV9eH9dXnyN0XijEO\n i5GedX16VzluqvZXHr9UpY1P/9a1zSs176m2kbb+NY13qvKLjYwqtP1V/eLT//5kQ1B/1G8I\n eZ/LfA3LgUzxw8dVcZYiLuvcjB33IX7wybe6NKM+gox8jfRq+JjSi87l+ViGrut0buvaqdhy\n QPKj3MawSbqApBfLZoi81kcuXqV3XXc9VHbeBH0L+nF5N7W/Nm2NnBer+rasD9bEute1flTD\n lst9Ux1vK8PWjZFD+x27Fma3wvQujG/fMFQ/0iX/hD7f9PClnr9OHX8+Mh65PTS1Iyn9UULX\n M/b8vq9uKf9ID7KkjkvOtOe+om/8cxvu6meXubpY+jcuc0Wx3TeNBVOH33e+LKQ+rZM55pQd\n cNz3kc4578rygFhy7Fj1H4872f88FpD1hNV1Iy76tbnr35Dyn1v3yCT3KhEnJdpnG1mui46u\n ryzBNNaiH5eH0HFfbPlWqvouVX0ZKjdW65S68XQqfWC1nJSUO8eoj0OfjxGGUjI1V/erZGIh\n P507n8qIa7z1tXinLK/sZwnb/7TS7+drNtj43+Y9sttN00121aMOnR+wTb/UuIZ/d4FrfydV\n PSOXCRmf+jfl/E9KuUMpuVPMfnKMdQIucze69X6m8YPvngAl9yOwqWNt5Wsu+hSp9xRoytr0\n UN3tunhPHQ91brDsoqqOZSivyed7iDzXX8p/JJ8le2QSA4C8lwntkcP7bvGxfC7bJfaUIDd5\n j7CqsiCv/dYh+4HcIbkTYdpLgOWwbNdk31R/k/tqnKpy2oGB43o1H9js0cPhk/ebUfegsZVT\n h8pW5D2aVNQ9nFzQPStf4+MQN4jYfZ4Q+TDndzUNTfqAVfs7uazFtc03KfaP0u3LZYvP877u\n ++6zpf5SuOfiJ9+w6PylXtPdZ1Pdx80UZ1VxoYahLl/Y7tflUxbqwhyr7OjioCpuTOexymmM\n 99vGWe5960LdoT5PrDlkNn39yrIdFzdTxKkqa0o9n5NyfjbFL6T9i03O9jTEjVT9CZt61qWe\n DAmTbX1rkw4ubWysflyu/Uh19Utdv8QUb/wevs/vlN3YK0J95hvGWP26FP0CXV0ix6XOfmi8\n lNw7tlSc284PqXnZlKf5umpfVx7Ue3K5q4onnT9079H5h8ubyX5VGZHfIVOiPynLz2RkPSTV\n /2p/0NZM2Ufw7dPm3tveJp46kn5prDC7miXDUCoOc7QdKeU9KeZZbNZTsw6ZKjPna6G6jLZ6\n v6Y9S0rqHMbaN8j3flUbVIdpnonTleaP+JsiapunntfVOer7WUdXNw+jCyvNYxE6P9Ix+7Mu\n TCa3uM3mb9JUmfLe1q59N19yulXnD5dfU/yRyn/8vR2Cr9H8JB/btsm29undfCw/56tbVmVX\n d53nXtV0+Iw4rjNTk8udOvdtwl13j1B1YuT5b04HMpsW/7HCr8t/dF0Of846J3W9HPtdNnUf\n x7UvpdsiV1mJjawiFLWODEm73G1mLF1J2/GB7X7UtvqhJeeTfPc4T7mPtLpuWqWJ66malIZV\n Oq6uerCp9Oh1dlzCzrpIudKf92/hsZbP+hIbHa0Q/fQYe/v4lmd5T5s6veq6vYViyzJT69KV\n 2t/FlN451zKFrm3i9U0264J0fQOX9U5Vfe6S+xPRL8VaHJe8rK69qpNJqe92jX81XX3X2fr8\n XPaHsq1PdPWWa12Sag1GaXmwT98pZ/2vy8+h7e8gsHdGcrvn+ou5l5j6K7GfmPobXJiY4xLb\n d9C3GKnM2H7Xkd7j+z1I03X5ftWxjd9KwDLy0mNPV/fUtSCh4wyeF5DXS8nzWnSd9Jqrfrye\n UWfa3NP1O131E9TnTDItvs/rn9Qwm9y3lS/yuiSdDK2J32LmH61l4/l7DpMcFl0cy/HpKvNU\n 5Z6yuzmgsPj4PZX78jydfMzx1BFk7Gr61smlU9yXf7w+UL7Pa5Fc9pe3lTntI+YJYvTvQ9Y9\n x9gbNOU66lxyYJPsuqPtBRpjvW7uX6n9Y3LpfMUe8+fYy6sJ+99x2QyVR1TJrEvlz9Lxmzq8\n Kct+jO8mpnIrV35pYv3rso+6j2w1RzkxpWeOslpV38Xey7lJ7XVVnDdFVyDn2o2m7A1s871r\n U3+hbp661LfjbL6l6vL9O5v5uiqdcd/9mG3sVrlrktHl3m+5Ln46Qply/f51rDq2afV3U92P\n 9Z2CVPu71+kExf4uhm265Mpfcrjl9S+p/WGjb9FEeYmrHlhsXTLb772b2v3U8bKvoAk6VaQ3\n ZdqvWf2FytNd9g1W/c57VNf9+JuMuXT+ZJ1tnZ6T7U+un1PXpSm/BxKiZ+b6nUC5P+bybdoU\n 3wWR9zP1WcOrrtc06dG7rA9gf6lzCCVlQKl1cKvW16r7MjdxPqHue3m55l5M6yRy1q8p6i+d\n GzbfR5Dtqeeu1D2rulVlp+67ulXfzlDPqS/AP52us+kb5aoetdp226wrqOtHuvxc9InlsMrX\n 5HCkgvtULt80VtPB5tvHlLbU51R1leQ+nW0ftknjClM7Ktf7Pt9n161FKfULHbeU/P5brO/5\n 8PeveZ2l+s31OpmmizxP5z/VrssvNP7Vb9XbUGr+LWSdWKr4c/lemct7U/1KfJcs5nfiXNcz\n Va3lCf2OXi75c+gaSd/4SyH/pmds+8G2fWCbvmwMeZapf6v2g9hU16vF7l/65K8cc6uh7bIs\n W8jdLyyxp4BPPOru6+Qx8rd8beIyhew8xjoMtU8l90dcyldseUOJPpPLevpc7ZnvL8f4oaRO\n ad34WVeefPYVSdG+27T7vPdESj0VV5leyvXoufQvffKZTpZmGy+27UNKfYCc5dWmj2fbp44Z\n P6G/WN9X1cl8beoieS7ad7+PGP14nz1ATO1q3Xx2jHnpWO1xR1uPovumYQndrFD9uyrdvpD4\n b9L8Yaz9wxl5bbVu/XlT9j2X/Rr6Hl7brYPd0V1jM5bOk+84oUn7xpeeH7IhVJ7j25+IrU9s\n ig+XOi7lGMtGj9pGB903/kuMQVPuORpjv7+c35AvvYYkNO1CviFvU4/HkF+qe2ZTG+VTn1bt\n fV7y5/PtqNR76oeuy4zlH3n/9ND3qPuxu7xb3cuj7heahiXq4ljrC1R5vm5M39HGFz7yzRLr\n k1PoMMfcPzeGvDPWPssxw6Rzo8QcXmp3XGSSHX2/Et08k67f5dtmuupKN2FvMpOsKObeDnVx\n k3ofp1h6VrFIVVdV7T2fYm9013l7k/5rbNlKaBuXso7LLV+K1d67uuWiJ19ShhcjvUP97FsO\n Q+V7pdfDpy5rtv2qEPkU7XFY0v3Q+Oc8FpqHdHV9Xf415XFbPTPfPk7qNWsufow9vkqlz6v+\n eA4udH9l3XxtiA5ZyN5XpvxSNzdetRdQlWnKjzbP695Xt9+WTz/bJk5y6tDVlYHUe0Crv9Bv\n vMf+bnzq79DHenfs/ZD3y4TO7b0S7vPM8Z5yL2mTG1XXKcyMLh5093OzvwbVfzr/1hHDby7u\n ufhH5z/Vrm1YZPsheUtn2pQh+RnfMmCqy3PN7aSeN0oRtrp8m6oONOXflHVfrnj0ccdU1lVS\n yYu7Ssjz96ZwxEgz13rX1c3Y+Sp2vJve7eN+zP3nYsojYunAhMq1cs2vM1X9J99+Q2g+d+1z\n 5OznpXJD1zcKcc/U33KN39TzgCnr4lz95Fz1cW79kxT6SDF00UruT5ZDZ8Xl9x83MV0I0CwB\n AB+LCAC4xcFoAgMdjksWhCAMBO/CelYzJ4gMCqiI4t/n/a9hyk29JN3p5DL7bj7GTQrbKypR\n dDVVywyhZCz4xkUhnSIj5EExoFoQisIfbICE2WJOoAESSK7wecCscDJSxRXMbBAlfLCyIbTh\n T8tr5/YikvVFSYq3dURbKo/gf+Q3zBCELycCXW/uB2mPjCb8AAAA"), Pn = Object.fromEntries(Nn.values.map((e, t) => [e, t])), { values: Fn } = Nn, { AI: In, AL: Ln, CJ: Rn, CM: zn, NS: Bn, SA: Vn, SG: Hn, SP: Un, XX: Wn } = Pn;
4350
+ function Gn(e) {
4276
4351
  switch (e) {
4277
4352
  case null: return null;
4278
4353
  case -1: return "sot";
4279
4354
  case -2: return "eot";
4280
- default: return En[e];
4355
+ default: return Fn[e];
4281
4356
  }
4282
4357
  }
4283
- function Ln(e, t) {
4358
+ function Kn(e, t) {
4284
4359
  switch (e) {
4285
- case Dn:
4286
- case Nn:
4287
- case Fn: return On;
4288
- case Mn: return /^[\p{gc=Mn}\p{gc=Mc}]$/u.test(t) ? An : On;
4289
- case kn: return jn;
4360
+ case In:
4361
+ case Hn:
4362
+ case Wn: return Ln;
4363
+ case Vn: return /^[\p{gc=Mn}\p{gc=Mc}]$/u.test(t) ? zn : Ln;
4364
+ case Rn: return Bn;
4290
4365
  }
4291
4366
  return e;
4292
4367
  }
4293
- var Rn = class {
4368
+ var qn = class {
4294
4369
  cp = -Infinity;
4295
4370
  cls = -1;
4296
4371
  char = "";
@@ -4300,15 +4375,15 @@ var Rn = class {
4300
4375
  this.cls = e, this.cp = t, this.char = n, this.len = r;
4301
4376
  }
4302
4377
  [Symbol.for("nodejs.util.inspect.custom")](e, t, n) {
4303
- return `${In(this.cls)}(${this.cp.toString(16).padStart(4, "0")}:${JSON.stringify(this.char)})${this.ignored ? "Ig" : ""}`;
4378
+ return `${Gn(this.cls)}(${this.cp.toString(16).padStart(4, "0")}:${JSON.stringify(this.char)})${this.ignored ? "Ig" : ""}`;
4304
4379
  }
4305
- }, zn = class {
4380
+ }, Jn = class {
4306
4381
  str = "";
4307
4382
  len = 0;
4308
4383
  prevChunk = 0;
4309
- prev = new Rn(-1, -Infinity, "", 0);
4310
- cur = new Rn(-1, -Infinity, "", 0);
4311
- next = new Rn(-1, -Infinity, "", 0);
4384
+ prev = new qn(-1, -Infinity, "", 0);
4385
+ cur = new qn(-1, -Infinity, "", 0);
4386
+ next = new qn(-1, -Infinity, "", 0);
4312
4387
  LB8 = !1;
4313
4388
  spaces = !1;
4314
4389
  RI = 0;
@@ -4321,13 +4396,13 @@ var Rn = class {
4321
4396
  this.next.ignored ? this.cur.len = this.next.len : (this.prev = this.cur, this.cur = this.next), this.next = e;
4322
4397
  }
4323
4398
  pushEnd() {
4324
- this.push(new Rn(-2, Infinity, "", this.next.len));
4399
+ this.push(new qn(-2, Infinity, "", this.next.len));
4325
4400
  }
4326
4401
  *codePoints(e, t = !0) {
4327
4402
  if (t) for (; e < this.len;) if (e === this.cur.len && this.next.cls >= 0) yield this.next, e += this.next.char.length;
4328
4403
  else {
4329
- let t = this.str.codePointAt(e), n = String.fromCodePoint(t), r = wn.get(t);
4330
- e += n.length, yield new Rn(Ln(r, n), t, n, e);
4404
+ let t = this.str.codePointAt(e), n = String.fromCodePoint(t), r = Nn.get(t);
4405
+ e += n.length, yield new qn(Kn(r, n), t, n, e);
4331
4406
  }
4332
4407
  else for (; e > 0;) if (e === this.cur.len) yield this.cur, e -= this.cur.char.length;
4333
4408
  else if (e === this.prev.len) yield this.prev, e -= this.prev.char.length;
@@ -4335,11 +4410,11 @@ var Rn = class {
4335
4410
  let t = e - 1, n = this.str.charCodeAt(t);
4336
4411
  n >= 56320 && n <= 57343 && t--;
4337
4412
  let r = this.str.codePointAt(t), i = String.fromCodePoint(r);
4338
- yield new Rn(Ln(wn.get(r), i), r, i, e), e = t;
4413
+ yield new qn(Kn(Nn.get(r), i), r, i, e), e = t;
4339
4414
  }
4340
4415
  }
4341
4416
  classAfterSpaces(e) {
4342
- for (let { cls: t } of this.codePoints(e)) if (t !== Pn) return t;
4417
+ for (let { cls: t } of this.codePoints(e)) if (t !== Un) return t;
4343
4418
  return -2;
4344
4419
  }
4345
4420
  afterNext(e = 1) {
@@ -4353,335 +4428,326 @@ var Rn = class {
4353
4428
  let r = `${n(this.prev)} => ${n(this.cur)} => ${n(this.next)}`;
4354
4429
  return this.LB8 && (r += " LB8"), this.spaces && (r += " spaces"), this.RI > 0 && (r += ` RI: ${this.RI}`), this.props && (r += ` ${JSON.stringify(this.props)}`), r;
4355
4430
  }
4356
- }, Bn = class {
4431
+ }, Yn = class {
4357
4432
  string = void 0;
4358
4433
  props = void 0;
4359
4434
  constructor(e, t = !1) {
4360
4435
  this.position = e, this.required = t;
4361
4436
  }
4362
- }, Vn = Cn.fromBase64("AAAEAAAAAAD/////wQIAAB+LCAC1xcFoAgPtmj1IHUEQxzd5FiaEkMLSKqQIViEQCEmTjyqk\n SUgR7OySTrHxdVoIYqUg2AgqFhYWFhYidpYqKDaClVZaqJWF2qj/xT1cjjtv772Z3T1uHvzY\n 753d2b252ds3+1SpRbAMVkGSrlMo5LNjIfqoB/uEfR2Ao5yy4zb7PgUX4Brcgo6GUi9AF+gG\n r0EPeAc+AN3mM8KvJu6DH0bWb08yeyEneV77rHia/yjbMvEBxJum7mCqzQjSo1beuBWfRFy3\n 1fHpR2QJgiAIgiAIgiAIQpoZc45c8HhGd2WJYUyy5oIgCP5oRPhuEQQh7vvPVuAe34q5x1lH\n uJFh15J7HRt9Z7MJ9iKwg1fP72kG4osqz3ynUlNPHjhC2i5/9UypX8DOa6bSa0hfAbsf33zE\n /EPLr7NtOYj4zlTfD+v7dG0r8uzhXM39qEPH9TtBvTNwUXK9dyv0frzE3DSxje8mZ0yNjuz8\n zlT+S6T1OnQh7M5oo+f+Bvk67EGY/OfiPeKfTL5+hr6ZuM13k/cT4R/QC86tMfdZbf4a2Un6\n H9L9OXNIGCoo12yDYdR7mzG+tP8yhjoTpt607tuh/6r7b1VG7yv5ya/OP7iZQXEdYyi9UNel\n WKM83YTQE/f8qftudz9y7G/OdWlXLxTPYRm9cu+ZMutMaYuK2tnjyqpb5jnPa8+xH7n3eJFO\n ivRGbTNC6su3PeHYM0V7OxZ/hUtWLP5ZFfzDmMYQSieU8qj78rF3fMsI+axX5fwWYvw+5t9u\n f0VnNR964yh31bdLOce8qfYb11ndVWeUvibHfCj8tZD2LNZvTRyyW/GfQr1/OM8gob/LcPn8\n If3iVmVT23Iu/69KaxHzOYn6XenTNw1551DW/3V5X7v6c9Tfh7jPX9TrFtqOhjgPttqeW28u\n 33192kvqs2vW7w7BeyuJcEoAAB+LCAC1xcFoAgOLVvJT0lGKVIoFANHfAiwJAAAA");
4363
- Object.fromEntries(Vn.values.map((e, t) => [e, t]));
4364
- var { values: Hn } = Vn, { AK: Un, AL: Wn, AP: Gn, AS: Kn, B2: qn, BA: Jn, BB: Yn, BK: Xn, CB: Zn, CL: Qn, CM: $n, CP: er, CR: tr, EB: nr, EM: rr, EX: ar, GL: or, H2: sr, H3: cr, HH: lr, HL: ur, HY: dr, ID: fr, IN: pr, IS: mr, JL: hr, JT: gr, JV: _r, LF: vr, NU: yr, OP: br, NL: xr, NS: Sr, PO: Cr, PR: wr, RI: Tr, SP: Y, SY: Er, QU: Dr, VF: Or, VI: kr, WJ: Ar, ZW: jr, ZWJ: Mr } = Tn, Nr = /* @__PURE__ */ new Set([
4365
- Wn,
4366
- ur,
4367
- yr
4368
- ]), Pr = /* @__PURE__ */ new Set([
4369
- Xn,
4370
- tr,
4371
- vr,
4372
- xr,
4437
+ }, Xn = Mn.fromBase64("AAAEAAAAAAD/////wQIAAB+LCAC1xcFoAgPtmj1IHUEQxzd5FiaEkMLSKqQIViEQCEmTjyqk\n SUgR7OySTrHxdVoIYqUg2AgqFhYWFhYidpYqKDaClVZaqJWF2qj/xT1cjjtv772Z3T1uHvzY\n 753d2b252ds3+1SpRbAMVkGSrlMo5LNjIfqoB/uEfR2Ao5yy4zb7PgUX4Brcgo6GUi9AF+gG\n r0EPeAc+AN3mM8KvJu6DH0bWb08yeyEneV77rHia/yjbMvEBxJum7mCqzQjSo1beuBWfRFy3\n 1fHpR2QJgiAIgiAIgiAIQpoZc45c8HhGd2WJYUyy5oIgCP5oRPhuEQQh7vvPVuAe34q5x1lH\n uJFh15J7HRt9Z7MJ9iKwg1fP72kG4osqz3ynUlNPHjhC2i5/9UypX8DOa6bSa0hfAbsf33zE\n /EPLr7NtOYj4zlTfD+v7dG0r8uzhXM39qEPH9TtBvTNwUXK9dyv0frzE3DSxje8mZ0yNjuz8\n zlT+S6T1OnQh7M5oo+f+Bvk67EGY/OfiPeKfTL5+hr6ZuM13k/cT4R/QC86tMfdZbf4a2Un6\n H9L9OXNIGCoo12yDYdR7mzG+tP8yhjoTpt607tuh/6r7b1VG7yv5ya/OP7iZQXEdYyi9UNel\n WKM83YTQE/f8qftudz9y7G/OdWlXLxTPYRm9cu+ZMutMaYuK2tnjyqpb5jnPa8+xH7n3eJFO\n ivRGbTNC6su3PeHYM0V7OxZ/hUtWLP5ZFfzDmMYQSieU8qj78rF3fMsI+axX5fwWYvw+5t9u\n f0VnNR964yh31bdLOce8qfYb11ndVWeUvibHfCj8tZD2LNZvTRyyW/GfQr1/OM8gob/LcPn8\n If3iVmVT23Iu/69KaxHzOYn6XenTNw1551DW/3V5X7v6c9Tfh7jPX9TrFtqOhjgPttqeW28u\n 33192kvqs2vW7w7BeyuJcEoAAB+LCAC1xcFoAgOLVvJT0lGKVIoFANHfAiwJAAAA");
4438
+ Object.fromEntries(Xn.values.map((e, t) => [e, t]));
4439
+ var { values: Zn } = Xn, { AK: Qn, AL: $n, AP: er, AS: tr, B2: nr, BA: rr, BB: ar, BK: or, CB: sr, CL: cr, CM: lr, CP: ur, CR: dr, EB: fr, EM: pr, EX: mr, GL: hr, H2: gr, H3: _r, HH: vr, HL: yr, HY: br, ID: xr, IN: Sr, IS: Cr, JL: wr, JT: Tr, JV: Er, LF: Dr, NU: Or, OP: kr, NL: Ar, NS: jr, PO: Mr, PR: Nr, RI: Pr, SP: Y, SY: Fr, QU: Ir, VF: Lr, VI: Rr, WJ: zr, ZW: Br, ZWJ: Vr } = Pn, Hr = /* @__PURE__ */ new Set([
4440
+ $n,
4441
+ yr,
4442
+ Or
4443
+ ]), Ur = /* @__PURE__ */ new Set([
4444
+ or,
4445
+ dr,
4446
+ Dr,
4447
+ Ar,
4373
4448
  Y,
4374
- jr
4375
- ]), Fr = /* @__PURE__ */ new Set([
4449
+ Br
4450
+ ]), Wr = /* @__PURE__ */ new Set([
4451
+ xr,
4376
4452
  fr,
4377
- nr,
4378
- rr
4379
- ]), Ir = /* @__PURE__ */ new Set([
4380
- hr,
4381
- _r,
4382
- sr,
4383
- cr
4384
- ]), Lr = /* @__PURE__ */ new Set([
4385
- hr,
4386
- _r,
4453
+ pr
4454
+ ]), Gr = /* @__PURE__ */ new Set([
4455
+ wr,
4456
+ Er,
4387
4457
  gr,
4388
- sr,
4389
- cr
4390
- ]), Rr = /* @__PURE__ */ new Set([_r, gr]), zr = /* @__PURE__ */ new Set([
4458
+ _r
4459
+ ]), Kr = /* @__PURE__ */ new Set([
4460
+ wr,
4461
+ Er,
4462
+ Tr,
4463
+ gr,
4464
+ _r
4465
+ ]), qr = /* @__PURE__ */ new Set([Er, Tr]), Jr = /* @__PURE__ */ new Set([
4391
4466
  Y,
4467
+ hr,
4468
+ zr,
4469
+ cr,
4470
+ Ir,
4471
+ ur,
4472
+ mr,
4473
+ Cr,
4474
+ Fr,
4392
4475
  or,
4393
- Ar,
4394
- Qn,
4476
+ dr,
4395
4477
  Dr,
4396
- er,
4397
- ar,
4398
- mr,
4399
- Er,
4400
- Xn,
4401
- tr,
4402
- vr,
4403
- xr,
4404
- jr
4405
- ]), Br = /* @__PURE__ */ new Set([
4478
+ Ar,
4479
+ Br
4480
+ ]), Yr = /* @__PURE__ */ new Set([
4406
4481
  -1,
4407
- Xn,
4408
- tr,
4409
- vr,
4410
- xr,
4411
- br,
4412
- Dr,
4413
4482
  or,
4483
+ dr,
4484
+ Dr,
4485
+ Ar,
4486
+ kr,
4487
+ Ir,
4488
+ hr,
4414
4489
  Y,
4415
- jr
4416
- ]), X = Symbol("PASS"), Z = Symbol("NO_BREAK"), Vr = Symbol("MAY_BREAK"), Hr = Symbol("MUST_BREAK");
4417
- function Ur(e) {
4490
+ Br
4491
+ ]), X = Symbol("PASS"), Z = Symbol("NO_BREAK"), Xr = Symbol("MAY_BREAK"), Zr = Symbol("MUST_BREAK");
4492
+ function Qr(e) {
4418
4493
  return e.cur.cls === -1 && e.next.cls !== -2 ? Z : X;
4419
4494
  }
4420
- function Wr(e) {
4421
- return e.next.cls === -2 && (e.cur.len === 0 || e.cur.len !== e.prevChunk) ? Hr : X;
4495
+ function $r(e) {
4496
+ return e.next.cls === -2 && (e.cur.len === 0 || e.cur.len !== e.prevChunk) ? Zr : X;
4422
4497
  }
4423
- function Gr(e) {
4424
- return e.cur.cls === Xn ? Hr : X;
4498
+ function ei(e) {
4499
+ return e.cur.cls === or ? Zr : X;
4425
4500
  }
4426
- function Kr(e) {
4501
+ function ti(e) {
4427
4502
  switch (e.cur.cls) {
4428
- case tr: return e.next.cls === vr ? Z : Hr;
4429
- case vr:
4430
- case xr: return Hr;
4503
+ case dr: return e.next.cls === Dr ? Z : Zr;
4504
+ case Dr:
4505
+ case Ar: return Zr;
4431
4506
  }
4432
4507
  return X;
4433
4508
  }
4434
- function qr(e) {
4509
+ function ni(e) {
4435
4510
  switch (e.next.cls) {
4436
- case Xn:
4437
- case tr:
4438
- case vr:
4439
- case xr: return Z;
4511
+ case or:
4512
+ case dr:
4513
+ case Dr:
4514
+ case Ar: return Z;
4440
4515
  }
4441
4516
  return X;
4442
4517
  }
4443
- function Jr(e) {
4444
- return e.cur.cls !== Tr && (e.RI = 0), e.spaces ? (e.next.cls !== Y && (e.spaces = !1), Z) : X;
4518
+ function ri(e) {
4519
+ return e.cur.cls !== Pr && (e.RI = 0), e.spaces ? (e.next.cls !== Y && (e.spaces = !1), Z) : X;
4445
4520
  }
4446
- function Yr(e) {
4447
- if (e.next.cls === jr) return Z;
4521
+ function ii(e) {
4522
+ if (e.next.cls === Br) return Z;
4448
4523
  if (e.next.cls === Y) switch (e.cur.cls) {
4449
- case jr:
4450
- case br:
4451
- case Dr:
4452
- case Qn:
4453
- case er:
4454
- case qn: break;
4524
+ case Br:
4525
+ case kr:
4526
+ case Ir:
4527
+ case cr:
4528
+ case ur:
4529
+ case nr: break;
4455
4530
  default: return Z;
4456
4531
  }
4457
4532
  return X;
4458
4533
  }
4459
- function Xr(e) {
4460
- return e.LB8 ? (e.LB8 = !1, Vr) : e.cur.cls === jr ? e.next.cls === Y ? (e.LB8 = !0, Z) : Vr : X;
4534
+ function ai(e) {
4535
+ return e.LB8 ? (e.LB8 = !1, Xr) : e.cur.cls === Br ? e.next.cls === Y ? (e.LB8 = !0, Z) : Xr : X;
4461
4536
  }
4462
- function Zr(e) {
4463
- return e.cur.cls === Mr ? Z : X;
4537
+ function oi(e) {
4538
+ return e.cur.cls === Vr ? Z : X;
4464
4539
  }
4465
- function Qr(e) {
4466
- return !Pr.has(e.cur.cls) && (e.next.cls === $n || e.next.cls === Mr) ? (e.next.ignored = !0, Z) : X;
4540
+ function si(e) {
4541
+ return !Ur.has(e.cur.cls) && (e.next.cls === lr || e.next.cls === Vr) ? (e.next.ignored = !0, Z) : X;
4467
4542
  }
4468
- function $r(e) {
4469
- return e.cur.cls === $n && (e.cur.cls = Wn), e.next.cls === $n && (e.next.cls = Wn), X;
4543
+ function ci(e) {
4544
+ return e.cur.cls === lr && (e.cur.cls = $n), e.next.cls === lr && (e.next.cls = $n), X;
4470
4545
  }
4471
- function ei(e) {
4472
- return e.next.cls === Ar || e.cur.cls === Ar ? Z : X;
4546
+ function li(e) {
4547
+ return e.next.cls === zr || e.cur.cls === zr ? Z : X;
4473
4548
  }
4474
- function ti(e) {
4475
- return e.cur.cls === or ? Z : X;
4549
+ function ui(e) {
4550
+ return e.cur.cls === hr ? Z : X;
4476
4551
  }
4477
- function ni(e) {
4478
- if (e.next.cls === or) switch (e.cur.cls) {
4552
+ function di(e) {
4553
+ if (e.next.cls === hr) switch (e.cur.cls) {
4479
4554
  case Y:
4480
- case Jn:
4481
- case dr:
4482
- case lr: return X;
4555
+ case rr:
4556
+ case br:
4557
+ case vr: return X;
4483
4558
  default: return Z;
4484
4559
  }
4485
4560
  return X;
4486
4561
  }
4487
- function ri(e) {
4562
+ function fi(e) {
4488
4563
  switch (e.next.cls) {
4489
- case Qn:
4490
- case er:
4491
- case ar:
4492
- case Er: return Z;
4564
+ case cr:
4565
+ case ur:
4566
+ case mr:
4567
+ case Fr: return Z;
4493
4568
  }
4494
4569
  return X;
4495
4570
  }
4496
- function ii(e) {
4497
- return e.cur.cls === br ? (e.next.cls === Y && (e.spaces = !0), Z) : X;
4571
+ function pi(e) {
4572
+ return e.cur.cls === kr ? (e.next.cls === Y && (e.spaces = !0), Z) : X;
4498
4573
  }
4499
- function ai(e) {
4500
- return Br.has(e.prev.cls) && /^\p{Pi}$/u.test(e.cur.char) && e.cur.cls === Dr ? (e.spaces = !0, Z) : X;
4574
+ function mi(e) {
4575
+ return Yr.has(e.prev.cls) && /^\p{Pi}$/u.test(e.cur.char) && e.cur.cls === Ir ? (e.spaces = !0, Z) : X;
4501
4576
  }
4502
- function oi(e) {
4503
- if (/^\p{gc=Pf}$/u.test(e.next.char) && e.next.cls === Dr) {
4577
+ function hi(e) {
4578
+ if (/^\p{gc=Pf}$/u.test(e.next.char) && e.next.cls === Ir) {
4504
4579
  let t = e.afterNext();
4505
- if (!t || zr.has(t.cls)) return Z;
4580
+ if (!t || Jr.has(t.cls)) return Z;
4506
4581
  }
4507
4582
  return X;
4508
4583
  }
4509
- function si(e) {
4510
- return e.cur.cls === Y && e.next.cls === mr && e.afterNext()?.cls === yr ? Vr : X;
4584
+ function gi(e) {
4585
+ return e.cur.cls === Y && e.next.cls === Cr && e.afterNext()?.cls === Or ? Xr : X;
4511
4586
  }
4512
- function ci(e) {
4513
- return e.next.cls === mr ? Z : X;
4587
+ function _i(e) {
4588
+ return e.next.cls === Cr ? Z : X;
4514
4589
  }
4515
- function li(e) {
4516
- if (e.cur.cls === Qn || e.cur.cls === er) {
4517
- if (e.classAfterSpaces(e.cur.len) === Sr) return e.next.cls === Y && (e.spaces = !0), Z;
4590
+ function vi(e) {
4591
+ if (e.cur.cls === cr || e.cur.cls === ur) {
4592
+ if (e.classAfterSpaces(e.cur.len) === jr) return e.next.cls === Y && (e.spaces = !0), Z;
4518
4593
  if (e.next.cls === Y) return Z;
4519
4594
  }
4520
4595
  return X;
4521
4596
  }
4522
- function ui(e) {
4523
- if (e.cur.cls === qn) {
4524
- if (e.classAfterSpaces(e.cur.len) === qn) return e.next.cls === Y && (e.spaces = !0), Z;
4597
+ function yi(e) {
4598
+ if (e.cur.cls === nr) {
4599
+ if (e.classAfterSpaces(e.cur.len) === nr) return e.next.cls === Y && (e.spaces = !0), Z;
4525
4600
  if (e.next.cls === Y) return Z;
4526
4601
  }
4527
4602
  return X;
4528
4603
  }
4529
- function di(e) {
4530
- return e.cur.cls === Y ? Vr : X;
4604
+ function bi(e) {
4605
+ return e.cur.cls === Y ? Xr : X;
4531
4606
  }
4532
- function fi(e) {
4533
- return e.next.cls === Dr && !/^\p{Pi}$/u.test(e.next.char) || e.cur.cls === Dr && !/^\p{Pf}$/u.test(e.cur.char) ? Z : X;
4607
+ function xi(e) {
4608
+ return e.next.cls === Ir && !/^\p{Pi}$/u.test(e.next.char) || e.cur.cls === Ir && !/^\p{Pf}$/u.test(e.cur.char) ? Z : X;
4534
4609
  }
4535
- function pi(e) {
4536
- if (!Vn.get(e.cur.cp) && e.next.cls === Dr) return Z;
4537
- if (e.next.cls === Dr) {
4610
+ function Si(e) {
4611
+ if (!Xn.get(e.cur.cp) && e.next.cls === Ir) return Z;
4612
+ if (e.next.cls === Ir) {
4538
4613
  let t = e.afterNext();
4539
- if (!t || !Vn.get(t.cp)) return Z;
4614
+ if (!t || !Xn.get(t.cp)) return Z;
4540
4615
  }
4541
- return e.cur.cls === Dr && !Vn.get(e.next.cp) || (e.prev.cls === -1 || !Vn.get(e.prev.cp)) && e.cur.cls === Dr ? Z : X;
4616
+ return e.cur.cls === Ir && !Xn.get(e.next.cp) || (e.prev.cls === -1 || !Xn.get(e.prev.cp)) && e.cur.cls === Ir ? Z : X;
4542
4617
  }
4543
- function mi(e) {
4544
- return e.cur.cls === Zn || e.next.cls === Zn ? Vr : X;
4618
+ function Ci(e) {
4619
+ return e.cur.cls === sr || e.next.cls === sr ? Xr : X;
4545
4620
  }
4546
- var hi = /* @__PURE__ */ new Set([
4621
+ var wi = /* @__PURE__ */ new Set([
4547
4622
  -1,
4548
- Xn,
4549
- tr,
4550
- vr,
4551
- xr,
4623
+ or,
4624
+ dr,
4625
+ Dr,
4626
+ Ar,
4552
4627
  Y,
4553
- jr,
4554
- Zn,
4555
- or
4628
+ Br,
4629
+ sr,
4630
+ hr
4556
4631
  ]);
4557
- function gi(e) {
4558
- return hi.has(e.prev.cls) && (e.cur.cls === dr || e.cur.cls === lr) && (e.next.cls === Wn || e.next.cls === ur) ? Z : X;
4632
+ function Ti(e) {
4633
+ return wi.has(e.prev.cls) && (e.cur.cls === br || e.cur.cls === vr) && (e.next.cls === $n || e.next.cls === yr) ? Z : X;
4559
4634
  }
4560
- function _i(e) {
4561
- if (e.cur.cls === Yn) return Z;
4635
+ function Ei(e) {
4636
+ if (e.cur.cls === ar) return Z;
4562
4637
  switch (e.next.cls) {
4563
- case Jn:
4564
- case lr:
4565
- case dr:
4566
- case Sr: return Z;
4638
+ case rr:
4639
+ case vr:
4640
+ case br:
4641
+ case jr: return Z;
4567
4642
  }
4568
4643
  return X;
4569
4644
  }
4570
- function vi(e) {
4571
- return e.prev.cls === ur && (e.cur.cls === dr || e.cur.cls === lr) && e.next.cls !== ur ? Z : X;
4645
+ function Di(e) {
4646
+ return e.prev.cls === yr && (e.cur.cls === br || e.cur.cls === vr) && e.next.cls !== yr ? Z : X;
4572
4647
  }
4573
- function yi(e) {
4574
- return e.cur.cls === Er && e.next.cls === ur ? Z : X;
4648
+ function Oi(e) {
4649
+ return e.cur.cls === Fr && e.next.cls === yr ? Z : X;
4575
4650
  }
4576
- function bi(e) {
4577
- return e.next.cls === pr ? Z : X;
4651
+ function ki(e) {
4652
+ return e.next.cls === Sr ? Z : X;
4578
4653
  }
4579
- function xi(e) {
4654
+ function Ai(e) {
4580
4655
  switch (e.cur.cls) {
4581
- case Wn:
4582
- case ur:
4583
- if (e.next.cls === yr) return Z;
4656
+ case $n:
4657
+ case yr:
4658
+ if (e.next.cls === Or) return Z;
4584
4659
  break;
4585
- case yr: if (e.next.cls === Wn || e.next.cls === ur) return Z;
4660
+ case Or: if (e.next.cls === $n || e.next.cls === yr) return Z;
4586
4661
  }
4587
4662
  return X;
4588
4663
  }
4589
- function Si(e) {
4590
- return e.cur.cls === wr && Fr.has(e.next.cls) || e.next.cls === Cr && Fr.has(e.cur.cls) ? Z : X;
4664
+ function ji(e) {
4665
+ return e.cur.cls === Nr && Wr.has(e.next.cls) || e.next.cls === Mr && Wr.has(e.cur.cls) ? Z : X;
4591
4666
  }
4592
- function Ci(e) {
4593
- return (e.cur.cls === wr || e.cur.cls === Cr) && (e.next.cls === Wn || e.next.cls === ur) || (e.cur.cls === Wn || e.cur.cls === ur) && (e.next.cls === wr || e.next.cls === Cr) ? Z : X;
4667
+ function Mi(e) {
4668
+ return (e.cur.cls === Nr || e.cur.cls === Mr) && (e.next.cls === $n || e.next.cls === yr) || (e.cur.cls === $n || e.cur.cls === yr) && (e.next.cls === Nr || e.next.cls === Mr) ? Z : X;
4594
4669
  }
4595
- var wi = /* @__PURE__ */ new Set([Cr, wr]), Ti = /* @__PURE__ */ new Set([Qn, er]);
4596
- function Ei(e) {
4670
+ var Ni = /* @__PURE__ */ new Set([Mr, Nr]), Pi = /* @__PURE__ */ new Set([cr, ur]);
4671
+ function Fi(e) {
4597
4672
  let t = null;
4598
- if (wi.has(e.next.cls) ? t = Ti.has(e.cur.cls) ? e.prev.len : e.cur.len : e.next.cls === yr && (t = e.cur.len), t !== null) SyIsLoop: for (let { cls: n } of e.codePoints(t, !1)) switch (n) {
4599
- case Er:
4600
- case mr: continue;
4601
- case yr: return Z;
4673
+ if (Ni.has(e.next.cls) ? t = Pi.has(e.cur.cls) ? e.prev.len : e.cur.len : e.next.cls === Or && (t = e.cur.len), t !== null) SyIsLoop: for (let { cls: n } of e.codePoints(t, !1)) switch (n) {
4674
+ case Fr:
4675
+ case Cr: continue;
4676
+ case Or: return Z;
4602
4677
  default: break SyIsLoop;
4603
4678
  }
4604
- if (e.cur.cls === Cr || e.cur.cls === wr) {
4605
- if (e.next.cls === br) {
4679
+ if (e.cur.cls === Mr || e.cur.cls === Nr) {
4680
+ if (e.next.cls === kr) {
4606
4681
  let t = e.afterNext();
4607
- if (t && (t.cls === yr || t.cls === mr && e.afterNext(2)?.cls === yr)) return Z;
4608
- } else if (e.next.cls === yr) return Z;
4682
+ if (t && (t.cls === Or || t.cls === Cr && e.afterNext(2)?.cls === Or)) return Z;
4683
+ } else if (e.next.cls === Or) return Z;
4609
4684
  }
4610
- return e.cur.cls === dr && e.next.cls === yr || e.cur.cls === mr && e.next.cls === yr ? Z : X;
4685
+ return e.cur.cls === br && e.next.cls === Or || e.cur.cls === Cr && e.next.cls === Or ? Z : X;
4611
4686
  }
4612
- function Di(e) {
4687
+ function Ii(e) {
4613
4688
  switch (e.cur.cls) {
4614
- case hr:
4615
- if (Ir.has(e.next.cls)) return Z;
4616
- break;
4617
- case _r:
4618
- case sr:
4619
- if (Rr.has(e.next.cls)) return Z;
4689
+ case wr:
4690
+ if (Gr.has(e.next.cls)) return Z;
4620
4691
  break;
4692
+ case Er:
4621
4693
  case gr:
4622
- case cr: if (e.next.cls === gr) return Z;
4694
+ if (qr.has(e.next.cls)) return Z;
4695
+ break;
4696
+ case Tr:
4697
+ case _r: if (e.next.cls === Tr) return Z;
4623
4698
  }
4624
4699
  return X;
4625
4700
  }
4626
- function Oi(e) {
4701
+ function Li(e) {
4627
4702
  switch (e.cur.cls) {
4628
- case hr:
4629
- case _r:
4703
+ case wr:
4704
+ case Er:
4705
+ case Tr:
4630
4706
  case gr:
4631
- case sr:
4632
- case cr:
4633
- if (e.next.cls === Cr) return Z;
4707
+ case _r:
4708
+ if (e.next.cls === Mr) return Z;
4634
4709
  break;
4635
- case wr: if (Lr.has(e.next.cls)) return Z;
4710
+ case Nr: if (Kr.has(e.next.cls)) return Z;
4636
4711
  }
4637
4712
  return X;
4638
4713
  }
4639
- function ki(e) {
4640
- return (e.cur.cls === Wn || e.cur.cls === ur) && (e.next.cls === Wn || e.next.cls === ur) ? Z : X;
4714
+ function Ri(e) {
4715
+ return (e.cur.cls === $n || e.cur.cls === yr) && (e.next.cls === $n || e.next.cls === yr) ? Z : X;
4641
4716
  }
4642
- function Ai(e) {
4717
+ function zi(e) {
4643
4718
  let { prev: t, cur: n, next: r } = e;
4644
4719
  function i(e) {
4645
- return e.cls === Un || e.char === "◌" || e.cls === Kn;
4720
+ return e.cls === Qn || e.char === "◌" || e.cls === tr;
4646
4721
  }
4647
- return n.cls === Gn && i(r) || i(n) && (r.cls === Or || r.cls === kr) || i(t) && n.cls === kr && (r.cls === Un || r.char === "◌") || i(n) && i(r) && e.afterNext()?.cls === Or ? Z : X;
4722
+ return n.cls === er && i(r) || i(n) && (r.cls === Lr || r.cls === Rr) || i(t) && n.cls === Rr && (r.cls === Qn || r.char === "◌") || i(n) && i(r) && e.afterNext()?.cls === Lr ? Z : X;
4648
4723
  }
4649
- function ji(e) {
4650
- return e.cur.cls === mr && (e.next.cls === Wn || e.next.cls === ur) ? Z : X;
4724
+ function Bi(e) {
4725
+ return e.cur.cls === Cr && (e.next.cls === $n || e.next.cls === yr) ? Z : X;
4651
4726
  }
4652
- function Mi(e) {
4727
+ function Vi(e) {
4653
4728
  switch (e.cur.cls) {
4654
- case Wn:
4655
- case ur:
4729
+ case $n:
4656
4730
  case yr:
4657
- if (e.next.cls === br && !Vn.get(e.next.cp)) return Z;
4731
+ case Or:
4732
+ if (e.next.cls === kr && !Xn.get(e.next.cp)) return Z;
4658
4733
  break;
4659
- case er: if (!Vn.get(e.cur.cp) && Nr.has(e.next.cls)) return Z;
4734
+ case ur: if (!Xn.get(e.cur.cp) && Hr.has(e.next.cls)) return Z;
4660
4735
  }
4661
4736
  return X;
4662
4737
  }
4663
- function Ni(e) {
4664
- if (e.cur.cls === Tr) {
4665
- if (e.next.cls === Tr && ++e.RI % 2 != 0) return Z;
4738
+ function Hi(e) {
4739
+ if (e.cur.cls === Pr) {
4740
+ if (e.next.cls === Pr && ++e.RI % 2 != 0) return Z;
4666
4741
  } else e.RI = 0;
4667
4742
  return X;
4668
4743
  }
4669
- function Pi(e) {
4670
- return e.cur.cls === nr && e.next.cls === rr || e.next.cls === rr && /^\p{ExtPict}$/u.test(e.cur.char) && /^\p{gc=Cn}$/u.test(e.cur.char) ? Z : X;
4671
- }
4672
- function Fi() {
4673
- return Vr;
4674
- }
4675
- var Ii = [
4676
- Ur,
4677
- Wr,
4678
- Gr,
4679
- Kr,
4680
- qr,
4681
- Jr,
4682
- Yr,
4683
- Xr,
4684
- Zr,
4744
+ function Ui(e) {
4745
+ return e.cur.cls === fr && e.next.cls === pr || e.next.cls === pr && /^\p{ExtPict}$/u.test(e.cur.char) && /^\p{gc=Cn}$/u.test(e.cur.char) ? Z : X;
4746
+ }
4747
+ function Wi() {
4748
+ return Xr;
4749
+ }
4750
+ var Gi = [
4685
4751
  Qr,
4686
4752
  $r,
4687
4753
  ei,
@@ -4699,25 +4765,34 @@ var Ii = [
4699
4765
  fi,
4700
4766
  pi,
4701
4767
  mi,
4768
+ hi,
4702
4769
  gi,
4703
- vi,
4704
4770
  _i,
4771
+ vi,
4705
4772
  yi,
4706
4773
  bi,
4707
4774
  xi,
4708
4775
  Si,
4709
4776
  Ci,
4710
- Ei,
4777
+ Ti,
4711
4778
  Di,
4779
+ Ei,
4712
4780
  Oi,
4713
4781
  ki,
4714
4782
  Ai,
4715
4783
  ji,
4716
4784
  Mi,
4717
- Ni,
4718
- Pi,
4719
- Fi
4720
- ], Li = class {
4785
+ Fi,
4786
+ Ii,
4787
+ Li,
4788
+ Ri,
4789
+ zi,
4790
+ Bi,
4791
+ Vi,
4792
+ Hi,
4793
+ Ui,
4794
+ Wi
4795
+ ], Ki = class {
4721
4796
  #e;
4722
4797
  constructor(e = {}) {
4723
4798
  if (this.#e = {
@@ -4725,7 +4800,7 @@ var Ii = [
4725
4800
  example7: !1,
4726
4801
  verbose: !1,
4727
4802
  ...e
4728
- }, this.rules = [...Ii], this.#e.example7) throw Error("'example7' flag deprecated");
4803
+ }, this.rules = [...Gi], this.#e.example7) throw Error("'example7' flag deprecated");
4729
4804
  this.#e.verbose && this.rules.unshift((e) => (console.log(e.cur.len, e), X));
4730
4805
  }
4731
4806
  removeRule(...e) {
@@ -4753,8 +4828,8 @@ var Ii = [
4753
4828
  switch (n) {
4754
4829
  case X: break;
4755
4830
  case Z: return this.#e.verbose && console.log(` ${t.name}: NO_BREAK`), null;
4756
- case Vr: return this.#e.verbose && console.log(` ${t.name}: MAY_BREAK`), new Bn(e.cur.len);
4757
- case Hr: return this.#e.verbose && console.log(` ${t.name}: MUST_BREAK`), new Bn(e.cur.len, !0);
4831
+ case Xr: return this.#e.verbose && console.log(` ${t.name}: MAY_BREAK`), new Yn(e.cur.len);
4832
+ case Zr: return this.#e.verbose && console.log(` ${t.name}: MUST_BREAK`), new Yn(e.cur.len, !0);
4758
4833
  default: throw Error(`Invalid state: "${n}"`);
4759
4834
  }
4760
4835
  }
@@ -4765,44 +4840,44 @@ var Ii = [
4765
4840
  t && (this.#e.string && (t.string = e.str.slice(e.prevChunk, e.cur.len)), e.props &&= (t.props = e.props, void 0), yield t, e.prevChunk = e.cur.len);
4766
4841
  }
4767
4842
  *breaks(e) {
4768
- let t = new zn(e);
4843
+ let t = new Jn(e);
4769
4844
  for (let e of t.codePoints(0)) t.push(e), yield* this.#n(t);
4770
4845
  t.pushEnd(), yield* this.#n(t);
4771
4846
  }
4772
4847
  };
4773
4848
  //#endregion
4774
4849
  //#region src/text-layout.ts
4775
- function Ri(e, t) {
4850
+ function qi(e, t) {
4776
4851
  let n = new Intl.Segmenter(t, { granularity: "grapheme" }), r = /* @__PURE__ */ new Set([0]);
4777
4852
  for (let t of n.segment(e)) r.add(t.index + t.segment.length);
4778
4853
  return r;
4779
4854
  }
4780
- var zi = class {
4781
- #e = new Li();
4855
+ var Ji = class {
4856
+ #e = new Ki();
4782
4857
  #t;
4783
4858
  constructor(e = "ja") {
4784
4859
  this.#t = e;
4785
4860
  }
4786
4861
  getBreakOpportunities(e) {
4787
- let t = Ri(e, this.#t), n = /* @__PURE__ */ new Map();
4862
+ let t = qi(e, this.#t), n = /* @__PURE__ */ new Map();
4788
4863
  for (let r of this.#e.breaks(e)) t.has(r.position) && n.set(r.position, (n.get(r.position) ?? !1) || r.required);
4789
4864
  return Object.freeze([...n].sort(([e], [t]) => e - t).map(([e, t]) => Object.freeze({
4790
4865
  position: e,
4791
4866
  required: t
4792
4867
  })));
4793
4868
  }
4794
- }, Bi = /* @__PURE__ */ new Map(), Vi = /\r\n|[\n\r\v\f\u0085\u2028\u2029]/gu;
4795
- function Hi(e) {
4796
- let t = Bi.get(e);
4869
+ }, Yi = /* @__PURE__ */ new Map(), Xi = /\r\n|[\n\r\v\f\u0085\u2028\u2029]/gu;
4870
+ function Zi(e) {
4871
+ let t = Yi.get(e);
4797
4872
  if (t) return t;
4798
- let n = new zi(e);
4799
- return Bi.set(e, n), n;
4873
+ let n = new Ji(e);
4874
+ return Yi.set(e, n), n;
4800
4875
  }
4801
- function Ui(e, t) {
4876
+ function Qi(e, t) {
4802
4877
  if (!Number.isFinite(e) || e < 0) throw TypeError(`${t} must return a non-negative finite number.`);
4803
4878
  return e;
4804
4879
  }
4805
- function Wi(e, t, n) {
4880
+ function $i(e, t, n) {
4806
4881
  let r = /* @__PURE__ */ new Map();
4807
4882
  for (let i of t.getBreakOpportunities(e)) {
4808
4883
  let { position: t, required: a } = i;
@@ -4813,28 +4888,28 @@ function Wi(e, t, n) {
4813
4888
  required: t
4814
4889
  }));
4815
4890
  }
4816
- function Gi(e, t, n, r, i) {
4891
+ function ea(e, t, n, r, i) {
4817
4892
  if (e.length === 0) return [{
4818
4893
  text: "",
4819
4894
  start: t,
4820
4895
  end: t,
4821
4896
  width: 0
4822
4897
  }];
4823
- let a = Ri(e, i), o = [...a].sort((e, t) => e - t), s = Wi(e, r, a), c = [], l = 0;
4898
+ let a = qi(e, i), o = [...a].sort((e, t) => e - t), s = $i(e, r, a), c = [], l = 0;
4824
4899
  for (; l < e.length;) {
4825
4900
  let r = s.find((e) => e.position > l && e.required)?.position ?? e.length, i, a = 0;
4826
4901
  for (let t of s) {
4827
4902
  if (t.position <= l || t.position > r) continue;
4828
- let o = e.slice(l, t.position), s = Ui(n.measureText(o), "measureText");
4903
+ let o = e.slice(l, t.position), s = Qi(n.measureText(o), "measureText");
4829
4904
  s <= n.maxWidth && (i = t.position, a = s);
4830
4905
  }
4831
4906
  if (i === void 0) {
4832
4907
  let t = o.filter((e) => e > l && e <= r);
4833
4908
  for (let r of t) {
4834
- let t = e.slice(l, r), o = Ui(n.measureText(t), "measureText");
4909
+ let t = e.slice(l, r), o = Qi(n.measureText(t), "measureText");
4835
4910
  o <= n.maxWidth && (i = r, a = o);
4836
4911
  }
4837
- i === void 0 && (i = t[0] ?? r, a = Ui(n.measureText(e.slice(l, i)), "measureText"));
4912
+ i === void 0 && (i = t[0] ?? r, a = Qi(n.measureText(e.slice(l, i)), "measureText"));
4838
4913
  }
4839
4914
  c.push({
4840
4915
  text: e.slice(l, i),
@@ -4845,38 +4920,38 @@ function Gi(e, t, n, r, i) {
4845
4920
  }
4846
4921
  return c;
4847
4922
  }
4848
- function Ki(e) {
4923
+ function ta(e) {
4849
4924
  if (typeof e.text != "string") throw TypeError("text must be a string.");
4850
4925
  if (!Number.isFinite(e.maxWidth) || e.maxWidth <= 0) throw TypeError("maxWidth must be a positive finite number.");
4851
4926
  if (typeof e.measureText != "function") throw TypeError("measureText must be a function.");
4852
- let t = e.locale ?? "ja", n = e.lineBreakProvider ?? Hi(t), r = [], i = 0;
4853
- for (let a of e.text.matchAll(Vi)) {
4927
+ let t = e.locale ?? "ja", n = e.lineBreakProvider ?? Zi(t), r = [], i = 0;
4928
+ for (let a of e.text.matchAll(Xi)) {
4854
4929
  let o = a.index;
4855
- r.push(...Gi(e.text.slice(i, o), i, e, n, t)), i = o + a[0].length;
4930
+ r.push(...ea(e.text.slice(i, o), i, e, n, t)), i = o + a[0].length;
4856
4931
  }
4857
- return r.push(...Gi(e.text.slice(i), i, e, n, t)), Object.freeze({
4932
+ return r.push(...ea(e.text.slice(i), i, e, n, t)), Object.freeze({
4858
4933
  lines: Object.freeze(r.map((e) => Object.freeze(e))),
4859
4934
  maxLineWidth: Math.max(0, ...r.map((e) => e.width))
4860
4935
  });
4861
4936
  }
4862
4937
  //#endregion
4863
4938
  //#region src/content-run.ts
4864
- function qi(e) {
4939
+ function na(e) {
4865
4940
  return typeof e == "object" && !!e && !Array.isArray(e);
4866
4941
  }
4867
- function Ji(e, t) {
4942
+ function ra(e, t) {
4868
4943
  let n = /* @__PURE__ */ new Set(["type", ...t]), r = Object.keys(e).filter((e) => !n.has(e));
4869
4944
  if (r.length > 0) throw TypeError(`Bubble content run has unknown properties: ${r.join(", ")}.`);
4870
4945
  for (let n of t) if (typeof e[n] != "string") throw TypeError(`Bubble content run ${n} must be a string.`);
4871
4946
  }
4872
- function Yi(e) {
4873
- if (!qi(e)) throw TypeError("Bubble content run must be an object.");
4874
- if (e.type === "text") return Ji(e, ["text"]), Object.freeze({
4947
+ function ia(e) {
4948
+ if (!na(e)) throw TypeError("Bubble content run must be an object.");
4949
+ if (e.type === "text") return ra(e, ["text"]), Object.freeze({
4875
4950
  text: e.text,
4876
4951
  type: "text"
4877
4952
  });
4878
4953
  if (e.type === "ruby") {
4879
- Ji(e, ["base", "reading"]);
4954
+ ra(e, ["base", "reading"]);
4880
4955
  let t = e.base, n = e.reading;
4881
4956
  if (t.length === 0) throw TypeError("Bubble ruby run base must not be empty.");
4882
4957
  if (n.length === 0) throw TypeError("Bubble ruby run reading must not be empty.");
@@ -4888,25 +4963,25 @@ function Yi(e) {
4888
4963
  }
4889
4964
  throw TypeError("Bubble content run type must be text or ruby.");
4890
4965
  }
4891
- function Xi(e) {
4966
+ function aa(e) {
4892
4967
  if (typeof e == "string") return Object.freeze([Object.freeze({
4893
4968
  text: e,
4894
4969
  type: "text"
4895
4970
  })]);
4896
4971
  if (!Array.isArray(e)) throw TypeError("Bubble text must be a string or content run array.");
4897
- let t = e.map((e) => Yi(e)).filter((e) => e.type !== "text" || e.text.length > 0);
4972
+ let t = e.map((e) => ia(e)).filter((e) => e.type !== "text" || e.text.length > 0);
4898
4973
  return t.length === 0 ? Object.freeze([Object.freeze({
4899
4974
  text: "",
4900
4975
  type: "text"
4901
4976
  })]) : Object.freeze(t);
4902
4977
  }
4903
- function Zi(e) {
4978
+ function oa(e) {
4904
4979
  return e.every((e) => e.type === "text");
4905
4980
  }
4906
- function Qi(e) {
4981
+ function sa(e) {
4907
4982
  return e.map((e) => e.type === "ruby" ? e.base : e.text).join("");
4908
4983
  }
4909
- function $i(e) {
4984
+ function ca(e) {
4910
4985
  let t = [];
4911
4986
  for (let n of e) {
4912
4987
  let e = t[t.length - 1];
@@ -4923,21 +4998,21 @@ function $i(e) {
4923
4998
  }
4924
4999
  //#endregion
4925
5000
  //#region src/reveal.ts
4926
- var ea = Object.freeze([
5001
+ var la = Object.freeze([
4927
5002
  "CHARACTER",
4928
5003
  "WORD",
4929
5004
  "LINE",
4930
5005
  "BLOCK"
4931
5006
  ]);
4932
- function ta(e) {
5007
+ function ua(e) {
4933
5008
  let t = globalThis.Intl?.Segmenter;
4934
5009
  return typeof t == "function" ? [...new t(void 0, { granularity: "grapheme" }).segment(e)].map(({ segment: e }) => e) : Array.from(e);
4935
5010
  }
4936
- function na(e) {
4937
- if (typeof e != "string" || !ea.includes(e)) throw TypeError("Bubble reveal unit must be CHARACTER, WORD, LINE, or BLOCK.");
5011
+ function da(e) {
5012
+ if (typeof e != "string" || !la.includes(e)) throw TypeError("Bubble reveal unit must be CHARACTER, WORD, LINE, or BLOCK.");
4938
5013
  return e;
4939
5014
  }
4940
- function ra(e) {
5015
+ function fa(e) {
4941
5016
  if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("Bubble reveal must be an object.");
4942
5017
  let t = e, n = /* @__PURE__ */ new Set([
4943
5018
  "unit",
@@ -4948,7 +5023,7 @@ function ra(e) {
4948
5023
  "sound"
4949
5024
  ]);
4950
5025
  if (Object.keys(t).filter((e) => !n.has(e)).length > 0 || t.unit === void 0) throw TypeError("Bubble reveal has unknown or missing properties.");
4951
- let r = na(t.unit), i = t.delimiters ?? " \r\n";
5026
+ let r = da(t.unit), i = t.delimiters ?? " \r\n";
4952
5027
  if (typeof i != "string" || i.length === 0) throw TypeError("Bubble WORD delimiters must be a non-empty string.");
4953
5028
  let a = t.showDelimiters ?? !1;
4954
5029
  if (typeof a != "boolean") throw TypeError("Bubble reveal showDelimiters must be boolean.");
@@ -4967,16 +5042,16 @@ function ra(e) {
4967
5042
  ...c === void 0 ? {} : { sound: c }
4968
5043
  });
4969
5044
  }
4970
- function ia(e, t, n) {
5045
+ function pa(e, t, n) {
4971
5046
  let r = new Set(Array.from(t)), i = [], a = "";
4972
- for (let t of ta(e)) a += t, r.has(t) && ((n || a.slice(0, -t.length).length > 0) && i.push(n ? a : a.slice(0, -t.length)), a = "");
5047
+ for (let t of ua(e)) a += t, r.has(t) && ((n || a.slice(0, -t.length).length > 0) && i.push(n ? a : a.slice(0, -t.length)), a = "");
4973
5048
  return a.length > 0 && i.push(a), i.filter((e) => e.length > 0);
4974
5049
  }
4975
- function aa(e, t) {
5050
+ function ma(e, t) {
4976
5051
  if (e.length === 0) return Object.freeze([""]);
4977
- if (t.unit === "CHARACTER") return Object.freeze(ta(e));
5052
+ if (t.unit === "CHARACTER") return Object.freeze(ua(e));
4978
5053
  if (t.unit === "WORD") {
4979
- let n = ia(e, t.delimiters, t.showDelimiters);
5054
+ let n = pa(e, t.delimiters, t.showDelimiters);
4980
5055
  if (t.showDelimiters) return Object.freeze(n);
4981
5056
  let r = [], i = 0;
4982
5057
  for (let a of n) {
@@ -4994,18 +5069,18 @@ function aa(e, t) {
4994
5069
  let i = r;
4995
5070
  return Object.freeze(i.length > 0 ? i : [e]);
4996
5071
  }
4997
- function oa(e) {
4998
- return Object.freeze($i(Object.freeze([...e])));
5072
+ function ha(e) {
5073
+ return Object.freeze(ca(Object.freeze([...e])));
4999
5074
  }
5000
- function sa(e) {
5075
+ function ga(e) {
5001
5076
  return Object.freeze({
5002
5077
  text: e,
5003
5078
  type: "text"
5004
5079
  });
5005
5080
  }
5006
- function ca(e, t) {
5081
+ function _a(e, t) {
5007
5082
  let n = [], r = [], i = () => {
5008
- r.length !== 0 && (n.push(oa(r)), r = []);
5083
+ r.length !== 0 && (n.push(ha(r)), r = []);
5009
5084
  };
5010
5085
  for (let n of e) {
5011
5086
  if (n.type === "ruby") {
@@ -5013,53 +5088,53 @@ function ca(e, t) {
5013
5088
  continue;
5014
5089
  }
5015
5090
  if (t === "LINE") {
5016
- for (let e of n.text.split(/(?<=\n)/u)) e.length !== 0 && (r.push(sa(e)), e.endsWith("\n") && i());
5091
+ for (let e of n.text.split(/(?<=\n)/u)) e.length !== 0 && (r.push(ga(e)), e.endsWith("\n") && i());
5017
5092
  continue;
5018
5093
  }
5019
5094
  let e = n.text.split(/(\n{2,})/u);
5020
- for (let [t, n] of e.entries()) n.length !== 0 && (r.push(sa(n)), t % 2 == 1 && i());
5095
+ for (let [t, n] of e.entries()) n.length !== 0 && (r.push(ga(n)), t % 2 == 1 && i());
5021
5096
  }
5022
- return i(), Object.freeze(n.length > 0 ? n : [oa(e)]);
5097
+ return i(), Object.freeze(n.length > 0 ? n : [ha(e)]);
5023
5098
  }
5024
- function la(e, t) {
5025
- if (Zi(e)) return Object.freeze(aa(Qi(e), t).map((e) => Object.freeze([sa(e)])));
5026
- if (t.unit === "LINE" || t.unit === "BLOCK") return ca(e, t.unit);
5099
+ function va(e, t) {
5100
+ if (oa(e)) return Object.freeze(ma(sa(e), t).map((e) => Object.freeze([ga(e)])));
5101
+ if (t.unit === "LINE" || t.unit === "BLOCK") return _a(e, t.unit);
5027
5102
  let n = [];
5028
5103
  for (let r of e) {
5029
5104
  if (r.type === "ruby") {
5030
5105
  n.push(Object.freeze([r]));
5031
5106
  continue;
5032
5107
  }
5033
- let e = t.unit === "CHARACTER" ? ta(r.text) : ia(r.text, t.delimiters, t.showDelimiters);
5034
- for (let t of e) n.push(Object.freeze([sa(t)]));
5108
+ let e = t.unit === "CHARACTER" ? ua(r.text) : pa(r.text, t.delimiters, t.showDelimiters);
5109
+ for (let t of e) n.push(Object.freeze([ga(t)]));
5035
5110
  }
5036
- return Object.freeze(n.length > 0 ? n : [Object.freeze([sa("")])]);
5111
+ return Object.freeze(n.length > 0 ? n : [Object.freeze([ga("")])]);
5037
5112
  }
5038
- function ua(e, t) {
5113
+ function ya(e, t) {
5039
5114
  let n = e.slice(0, Math.max(0, Math.min(t, e.length)));
5040
- return $i(Object.freeze(n.flat()));
5115
+ return ca(Object.freeze(n.flat()));
5041
5116
  }
5042
5117
  //#endregion
5043
5118
  //#region src/portrait-layout.ts
5044
- var da = Object.freeze([
5119
+ var ba = Object.freeze([
5045
5120
  "left",
5046
5121
  "right",
5047
5122
  "top-left",
5048
5123
  "top-right",
5049
5124
  "bottom-left",
5050
5125
  "bottom-right"
5051
- ]), fa = Object.freeze({
5126
+ ]), xa = Object.freeze({
5052
5127
  x: 0,
5053
5128
  y: 0,
5054
5129
  zoomPercent: 100
5055
5130
  });
5056
- function pa(e) {
5131
+ function Sa(e) {
5057
5132
  if (typeof e != "string") throw TypeError("Bubble portrait placement must be a string.");
5058
5133
  let t = e.trim().toLowerCase().replaceAll("_", "-");
5059
- if (!da.includes(t)) throw TypeError(`Unsupported Bubble portrait placement: ${e}`);
5134
+ if (!ba.includes(t)) throw TypeError(`Unsupported Bubble portrait placement: ${e}`);
5060
5135
  return t;
5061
5136
  }
5062
- function ma(e) {
5137
+ function Ca(e) {
5063
5138
  if (!Array.isArray(e) || e.length !== 2 && e.length !== 3) throw TypeError("Bubble portrait offset must be [x, y] or [x, y, zoom].");
5064
5139
  let [t, n, r = 100] = e;
5065
5140
  if (![
@@ -5073,11 +5148,11 @@ function ma(e) {
5073
5148
  zoomPercent: r
5074
5149
  });
5075
5150
  }
5076
- function ha(e) {
5151
+ function wa(e) {
5077
5152
  if (typeof e != "number" || !Number.isFinite(e) || e < 0) throw TypeError("Bubble portrait corner radius must be zero or greater.");
5078
5153
  return e;
5079
5154
  }
5080
- var ga = Object.freeze([
5155
+ var Ta = Object.freeze([
5081
5156
  "placement",
5082
5157
  "maxWidth",
5083
5158
  "textLocale",
@@ -5092,13 +5167,13 @@ var ga = Object.freeze([
5092
5167
  "showAnimation",
5093
5168
  "hideAnimation"
5094
5169
  ]);
5095
- function _a(e) {
5170
+ function Ea(e) {
5096
5171
  return typeof e == "object" && !!e && !Array.isArray(e);
5097
5172
  }
5098
- function va(e) {
5099
- return !_a(e) || typeof e.textStyle != "string" || e.textStyle.trim() !== "default" ? "custom" : ga.every((t) => e[t] === void 0) ? "scratch-default" : "custom";
5173
+ function Da(e) {
5174
+ return !Ea(e) || typeof e.textStyle != "string" || e.textStyle.trim() !== "default" ? "custom" : Ta.every((t) => e[t] === void 0) ? "scratch-default" : "custom";
5100
5175
  }
5101
- function ya(e) {
5176
+ function Oa(e) {
5102
5177
  let t = 0;
5103
5178
  for (let n of e) if (!/\p{Mark}/u.test(n)) {
5104
5179
  if (/\s/u.test(n)) {
@@ -5109,8 +5184,8 @@ function ya(e) {
5109
5184
  }
5110
5185
  return t * 14;
5111
5186
  }
5112
- function ba(e, t = ya) {
5113
- let n = Ki({
5187
+ function ka(e, t = Oa) {
5188
+ let n = ta({
5114
5189
  text: e.slice(0, 330),
5115
5190
  maxWidth: 170,
5116
5191
  measureText: (e) => {
@@ -5118,9 +5193,9 @@ function ba(e, t = ya) {
5118
5193
  try {
5119
5194
  n = t(e);
5120
5195
  } catch {
5121
- return ya(e);
5196
+ return Oa(e);
5122
5197
  }
5123
- return Number.isFinite(n) && n >= 0 ? n : ya(e);
5198
+ return Number.isFinite(n) && n >= 0 ? n : Oa(e);
5124
5199
  }
5125
5200
  }), r = Object.freeze(n.lines.map((e) => Object.freeze({
5126
5201
  text: e.text,
@@ -5132,7 +5207,7 @@ function ba(e, t = ya) {
5132
5207
  text: r.map((e) => e.text).join("\n")
5133
5208
  });
5134
5209
  }
5135
- function xa(e) {
5210
+ function Aa(e) {
5136
5211
  let t = Math.max(1, e.lines.length), n = Math.max(e.maxLineWidth, 50) + 20, r = 16 * t + 20;
5137
5212
  return Object.freeze({
5138
5213
  bodyHeight: r + 4,
@@ -5143,7 +5218,7 @@ function xa(e) {
5143
5218
  width: n + 4
5144
5219
  });
5145
5220
  }
5146
- function Sa(e) {
5221
+ function ja(e) {
5147
5222
  let t = -e.stageWidth / 2, n = e.stageWidth / 2, r = e.stageHeight / 2, i = e.pointsLeft;
5148
5223
  !i && e.width + e.bounds.right > n && e.bounds.left - e.width > t ? i = !0 : i && e.bounds.left - e.width < t && e.width + e.bounds.right < n && (i = !1);
5149
5224
  let a = i ? Math.min(n - e.width, Math.max(t, e.bounds.left - e.width)) : Math.max(t, Math.min(n - e.width, e.bounds.right)), o = Math.min(r, e.bounds.bottom + e.height);
@@ -5155,10 +5230,10 @@ function Sa(e) {
5155
5230
  top: o
5156
5231
  });
5157
5232
  }
5158
- function Ca(e) {
5233
+ function Ma(e) {
5159
5234
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
5160
5235
  }
5161
- function wa(e) {
5236
+ function Na(e) {
5162
5237
  let { paddedHeight: t, paddedWidth: n } = e, r = Math.min(16, n / 2, t / 2);
5163
5238
  return [
5164
5239
  `M ${r} ${t}`,
@@ -5171,16 +5246,16 @@ function wa(e) {
5171
5246
  `Q ${n} ${t} ${n - r} ${t}`
5172
5247
  ].join(" ");
5173
5248
  }
5174
- function Ta(e) {
5249
+ function Pa(e) {
5175
5250
  let { paddedHeight: t, paddedWidth: n } = e;
5176
- return `<path d="${`${wa(e)} C ${n - 16} ${t + 4} ${n - 12} ${t + 8} ${n - 12} ${t + 10} Q ${n - 12} ${t + 12} ${n - 14} ${t + 12} C ${n - 17} ${t + 12} ${n - 27} ${t + 8} ${n - 32} ${t} Z`}" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" stroke-linejoin="round" paint-order="stroke fill"/>`;
5251
+ return `<path d="${`${Na(e)} C ${n - 16} ${t + 4} ${n - 12} ${t + 8} ${n - 12} ${t + 10} Q ${n - 12} ${t + 12} ${n - 14} ${t + 12} C ${n - 17} ${t + 12} ${n - 27} ${t + 8} ${n - 32} ${t} Z`}" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" stroke-linejoin="round" paint-order="stroke fill"/>`;
5177
5252
  }
5178
- function Ea(e) {
5253
+ function Fa(e) {
5179
5254
  let { paddedHeight: t, paddedWidth: n } = e;
5180
- return `<path d="${`${wa(e)} L ${n - 28} ${t} A 4 4 0 0 1 ${n - 36} ${t} Z`}" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" stroke-linejoin="round" paint-order="stroke fill"/><circle cx="${n - 25.25}" cy="${t + 7.25}" r="2.25" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" paint-order="stroke fill"/><circle cx="${n - 17.5}" cy="${t + 9.5}" r="1.5" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" paint-order="stroke fill"/>`;
5255
+ return `<path d="${`${Na(e)} L ${n - 28} ${t} A 4 4 0 0 1 ${n - 36} ${t} Z`}" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" stroke-linejoin="round" paint-order="stroke fill"/><circle cx="${n - 25.25}" cy="${t + 7.25}" r="2.25" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" paint-order="stroke fill"/><circle cx="${n - 17.5}" cy="${t + 9.5}" r="1.5" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" paint-order="stroke fill"/>`;
5181
5256
  }
5182
- function Da(e) {
5183
- let t = xa(e.layout), n = e.kind === "say" ? Ta(t) : Ea(t), r = e.pointsLeft ? "translate(2 2)" : `translate(${t.width} 0) scale(-1 1) translate(2 2)`, i = e.layout.lines.map((e, t) => `<text x="12" y="${24.6 + 16 * t}" fill="#575E75" font-family="Helvetica, sans-serif" font-size="14" xml:space="preserve">${Ca(e.text)}</text>`).join(""), a = Ca(e.title ?? `${e.kind} bubble`);
5257
+ function Ia(e) {
5258
+ let t = Aa(e.layout), n = e.kind === "say" ? Pa(t) : Fa(t), r = e.pointsLeft ? "translate(2 2)" : `translate(${t.width} 0) scale(-1 1) translate(2 2)`, i = e.layout.lines.map((e, t) => `<text x="12" y="${24.6 + 16 * t}" fill="#575E75" font-family="Helvetica, sans-serif" font-size="14" xml:space="preserve">${Ma(e.text)}</text>`).join(""), a = Ma(e.title ?? `${e.kind} bubble`);
5184
5259
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${t.width}" height="${t.height}" viewBox="0 0 ${t.width} ${t.height}" role="img" data-bubble-profile="scratch-default" data-bubble-kind="${e.kind}"><title>${a}</title><g transform="${r}">${n}</g>${i}</svg>`;
5185
5260
  }
5186
5261
  //#endregion
@@ -5190,11 +5265,11 @@ var Q = class extends Error {
5190
5265
  constructor(e, t) {
5191
5266
  super(t), this.name = "BubbleCompositionError", this.code = e;
5192
5267
  }
5193
- }, Oa = /* @__PURE__ */ new Set(["say", "think"]), ka = /* @__PURE__ */ new Set([
5268
+ }, La = /* @__PURE__ */ new Set(["say", "think"]), Ra = /* @__PURE__ */ new Set([
5194
5269
  "idle",
5195
5270
  "talking",
5196
5271
  "awaiting-continue"
5197
- ]), Aa = /* @__PURE__ */ new Set([
5272
+ ]), za = /* @__PURE__ */ new Set([
5198
5273
  "fadeIn",
5199
5274
  "fadeOut",
5200
5275
  "floatIn",
@@ -5206,54 +5281,54 @@ var Q = class extends Error {
5206
5281
  "shake",
5207
5282
  "explode",
5208
5283
  "animateBubbleShape"
5209
- ]), ja = /* @__PURE__ */ new Set([
5284
+ ]), Ba = /* @__PURE__ */ new Set([
5210
5285
  "linear",
5211
5286
  "easeIn",
5212
5287
  "easeOut",
5213
5288
  "easeInOut"
5214
5289
  ]);
5215
- function Ma(e) {
5290
+ function Va(e) {
5216
5291
  return typeof e == "object" && !!e && !Array.isArray(e);
5217
5292
  }
5218
- function Na(e, t, n, r) {
5293
+ function Ha(e, t, n, r) {
5219
5294
  let i = /* @__PURE__ */ new Set([...t, ...n]), a = t.filter((t) => !Object.prototype.hasOwnProperty.call(e, t)), o = Object.keys(e).filter((e) => !i.has(e));
5220
5295
  if (a.length > 0 || o.length > 0) throw new Q("BUBBLE-COMPOSITION-001", `${r} has missing or unknown properties.`);
5221
5296
  }
5222
- function Pa(e, t) {
5297
+ function Ua(e, t) {
5223
5298
  if (typeof e != "string" || e.trim().length === 0) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
5224
5299
  return e.trim();
5225
5300
  }
5226
- function Fa(e, t) {
5301
+ function Wa(e, t) {
5227
5302
  if (typeof e != "string" || e.length === 0) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
5228
5303
  return e;
5229
5304
  }
5230
- function Ia(e, t, n) {
5231
- if (!Ma(e)) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
5232
- if (Na(e, ["frames", "frameIntervalSeconds"], [], t), !Array.isArray(e.frames) || e.frames.length < n) throw new Q("BUBBLE-COMPOSITION-001", `${t}.frames must contain at least ${n} image asset name${n === 1 ? "" : "s"}.`);
5233
- let r = Object.freeze(e.frames.map((e, n) => Fa(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
5305
+ function Ga(e, t, n) {
5306
+ if (!Va(e)) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
5307
+ if (Ha(e, ["frames", "frameIntervalSeconds"], [], t), !Array.isArray(e.frames) || e.frames.length < n) throw new Q("BUBBLE-COMPOSITION-001", `${t}.frames must contain at least ${n} image asset name${n === 1 ? "" : "s"}.`);
5308
+ let r = Object.freeze(e.frames.map((e, n) => Wa(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
5234
5309
  if (typeof i != "number" || !Number.isFinite(i) || i <= 0) throw new Q("BUBBLE-COMPOSITION-001", `${t}.frameIntervalSeconds must be a positive finite number.`);
5235
5310
  return Object.freeze({
5236
5311
  frames: r,
5237
5312
  frameIntervalSeconds: i
5238
5313
  });
5239
5314
  }
5240
- function La(e) {
5241
- if (!Ma(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
5242
- Na(e, ["base"], [
5315
+ function Ka(e) {
5316
+ if (!Va(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
5317
+ Ha(e, ["base"], [
5243
5318
  "blink",
5244
5319
  "lipSync",
5245
5320
  "placement",
5246
5321
  "offset",
5247
5322
  "cornerRadius"
5248
5323
  ], "Bubble portrait");
5249
- let t = e.blink === void 0 ? void 0 : Ia(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : Ia(e.lipSync, "Bubble portrait lip-sync", 1), r, i, a;
5324
+ let t = e.blink === void 0 ? void 0 : Ga(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : Ga(e.lipSync, "Bubble portrait lip-sync", 1), r, i, a;
5250
5325
  try {
5251
- r = pa(e.placement ?? "left"), i = e.offset === void 0 ? fa : ma(e.offset), a = ha(e.cornerRadius ?? 0);
5326
+ r = Sa(e.placement ?? "left"), i = e.offset === void 0 ? xa : Ca(e.offset), a = wa(e.cornerRadius ?? 0);
5252
5327
  } catch (e) {
5253
5328
  throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble portrait layout is invalid.");
5254
5329
  }
5255
5330
  return Object.freeze({
5256
- base: Fa(e.base, "Bubble portrait base"),
5331
+ base: Wa(e.base, "Bubble portrait base"),
5257
5332
  ...t === void 0 ? {} : { blink: t },
5258
5333
  ...n === void 0 ? {} : { lipSync: n },
5259
5334
  placement: r,
@@ -5261,9 +5336,9 @@ function La(e) {
5261
5336
  cornerRadius: a
5262
5337
  });
5263
5338
  }
5264
- function Ra(e, t) {
5265
- if (!Ma(e)) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
5266
- if (Na(e, ["name"], [
5339
+ function qa(e, t) {
5340
+ if (!Va(e)) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
5341
+ if (Ha(e, ["name"], [
5267
5342
  "durationSeconds",
5268
5343
  "ease",
5269
5344
  "direction",
@@ -5271,7 +5346,7 @@ function Ra(e, t) {
5271
5346
  "relativeScale",
5272
5347
  "speed",
5273
5348
  "visualStyle"
5274
- ], t), !Aa.has(e.name)) throw new Q("BUBBLE-COMPOSITION-001", `${t}.name is not a supported Bubble motion.`);
5349
+ ], t), !za.has(e.name)) throw new Q("BUBBLE-COMPOSITION-001", `${t}.name is not a supported Bubble motion.`);
5275
5350
  let n = (n, r, i = !1) => {
5276
5351
  let a = e[n];
5277
5352
  if (a !== void 0) {
@@ -5281,7 +5356,7 @@ function Ra(e, t) {
5281
5356
  }, r = n("durationSeconds", 0), i = n("count", 1, !0), a = n("relativeScale", 0), o = n("speed", 0), s = e.direction;
5282
5357
  if (s !== void 0 && typeof s != "number" && typeof s != "string") throw new Q("BUBBLE-COMPOSITION-001", `${t}.direction is invalid.`);
5283
5358
  let c = e.ease ?? "easeInOut";
5284
- if (typeof c != "string" || !ja.has(c)) throw new Q("BUBBLE-COMPOSITION-001", `${t}.ease is invalid.`);
5359
+ if (typeof c != "string" || !Ba.has(c)) throw new Q("BUBBLE-COMPOSITION-001", `${t}.ease is invalid.`);
5285
5360
  let l = e.visualStyle;
5286
5361
  if (l !== void 0 && (typeof l != "string" || !ut.includes(l))) throw new Q("BUBBLE-COMPOSITION-001", `${t}.visualStyle is invalid.`);
5287
5362
  return Object.freeze({
@@ -5295,10 +5370,10 @@ function Ra(e, t) {
5295
5370
  ...l === void 0 ? {} : { visualStyle: l }
5296
5371
  });
5297
5372
  }
5298
- function za(e) {
5373
+ function Ja(e) {
5299
5374
  if (e === void 0) return;
5300
- if (!Ma(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
5301
- Na(e, [], [
5375
+ if (!Va(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
5376
+ Ha(e, [], [
5302
5377
  "voice",
5303
5378
  "reveal",
5304
5379
  "finish"
@@ -5310,13 +5385,13 @@ function za(e) {
5310
5385
  "finish"
5311
5386
  ]) {
5312
5387
  let r = e[n];
5313
- r !== void 0 && (t[n] = Fa(r, `Bubble audio ${n}`));
5388
+ r !== void 0 && (t[n] = Wa(r, `Bubble audio ${n}`));
5314
5389
  }
5315
5390
  return Object.freeze(t);
5316
5391
  }
5317
- function Ba(e) {
5318
- if (!Ma(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
5319
- Na(e, ["name", "textStyle"], [
5392
+ function Ya(e) {
5393
+ if (!Va(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
5394
+ Ha(e, ["name", "textStyle"], [
5320
5395
  "placement",
5321
5396
  "maxWidth",
5322
5397
  "textLocale",
@@ -5331,13 +5406,13 @@ function Ba(e) {
5331
5406
  "showAnimation",
5332
5407
  "hideAnimation"
5333
5408
  ], "Bubble style");
5334
- let t = e.portrait === void 0 ? void 0 : La(e.portrait), n = e.continueIndicator === void 0 ? void 0 : Ia(e.continueIndicator, "Bubble continue indicator", 2), r;
5409
+ let t = e.portrait === void 0 ? void 0 : Ka(e.portrait), n = e.continueIndicator === void 0 ? void 0 : Ga(e.continueIndicator, "Bubble continue indicator", 2), r;
5335
5410
  if (e.reveal !== void 0) try {
5336
- r = ra(e.reveal);
5411
+ r = fa(e.reveal);
5337
5412
  } catch (e) {
5338
5413
  throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
5339
5414
  }
5340
- let i = za(e.audio), a = e.showAnimation === void 0 ? void 0 : Ra(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : Ra(e.hideAnimation, "Bubble hideAnimation"), s;
5415
+ let i = Ja(e.audio), a = e.showAnimation === void 0 ? void 0 : qa(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : qa(e.hideAnimation, "Bubble hideAnimation"), s;
5341
5416
  try {
5342
5417
  s = Xe(e.placement ?? "up-right");
5343
5418
  } catch (e) {
@@ -5356,10 +5431,10 @@ function Ba(e) {
5356
5431
  if (typeof e.maxWidth != "number" || !Number.isFinite(e.maxWidth) || e.maxWidth <= 0) throw new Q("BUBBLE-COMPOSITION-001", "Bubble style maxWidth must be a positive finite number.");
5357
5432
  f = e.maxWidth;
5358
5433
  }
5359
- let p = e.textLocale === void 0 ? void 0 : Pa(e.textLocale, "Bubble style text locale"), m = va(e);
5434
+ let p = e.textLocale === void 0 ? void 0 : Ua(e.textLocale, "Bubble style text locale"), m = Da(e);
5360
5435
  return Object.freeze({
5361
- name: Pa(e.name, "Bubble style name"),
5362
- textStyle: Pa(e.textStyle, "Bubble text style name"),
5436
+ name: Ua(e.name, "Bubble style name"),
5437
+ textStyle: Ua(e.textStyle, "Bubble text style name"),
5363
5438
  layoutProfile: m,
5364
5439
  ...f === void 0 ? {} : { maxWidth: f },
5365
5440
  ...p === void 0 ? {} : { textLocale: p },
@@ -5376,97 +5451,97 @@ function Ba(e) {
5376
5451
  ...o === void 0 ? {} : { hideAnimation: o }
5377
5452
  });
5378
5453
  }
5379
- function Va(e) {
5454
+ function Xa(e) {
5380
5455
  if (e !== void 0) {
5381
- if (!Ma(e) || typeof e.applyToTarget != "function" || typeof e.getMimeType != "function" || typeof e.isRegistered != "function") throw TypeError("Bubble image capability must provide applyToTarget, getMimeType, and isRegistered.");
5456
+ if (!Va(e) || typeof e.applyToTarget != "function" || typeof e.getMimeType != "function" || typeof e.isRegistered != "function") throw TypeError("Bubble image capability must provide applyToTarget, getMimeType, and isRegistered.");
5382
5457
  return e;
5383
5458
  }
5384
5459
  }
5385
- function Ha(e) {
5460
+ function Za(e) {
5386
5461
  if (e !== void 0) {
5387
- if (!Ma(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
5462
+ if (!Va(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
5388
5463
  if (e.isRegistered !== void 0 && typeof e.isRegistered != "function") throw TypeError("Bubble audio capability isRegistered must be a function.");
5389
5464
  if (e.getMimeType !== void 0 && typeof e.getMimeType != "function") throw TypeError("Bubble audio capability getMimeType must be a function.");
5390
5465
  return e;
5391
5466
  }
5392
5467
  }
5393
- function Ua(e) {
5468
+ function Qa(e) {
5394
5469
  if (e === void 0) throw new Q("BUBBLE-COMPOSITION-006", "Bubble image assets require an image capability. Provide options.imageResolver.");
5395
5470
  return e;
5396
5471
  }
5397
- function Wa(e) {
5398
- if (!Ma(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble text capability must provide setText and releaseTarget.");
5472
+ function $a(e) {
5473
+ if (!Va(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble text capability must provide setText and releaseTarget.");
5399
5474
  return e;
5400
5475
  }
5401
- function Ga() {
5476
+ function eo() {
5402
5477
  return Object.freeze({
5403
5478
  setTimeout: (e, t) => globalThis.setTimeout(e, t),
5404
5479
  clearTimeout: (e) => globalThis.clearTimeout(e)
5405
5480
  });
5406
5481
  }
5407
- function Ka(e) {
5408
- if (!Ma(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
5482
+ function to(e) {
5483
+ if (!Va(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
5409
5484
  return e;
5410
5485
  }
5411
- function qa(e, t) {
5412
- if (!Ma(e) || typeof e.id != "string" || e.id.length === 0 || typeof e.isStage != "boolean") throw new Q("BUBBLE-COMPOSITION-004", `${t} must provide id and isStage.`);
5486
+ function no(e, t) {
5487
+ if (!Va(e) || typeof e.id != "string" || e.id.length === 0 || typeof e.isStage != "boolean") throw new Q("BUBBLE-COMPOSITION-004", `${t} must provide id and isStage.`);
5413
5488
  return e;
5414
5489
  }
5415
- function Ja(e) {
5490
+ function ro(e) {
5416
5491
  if (typeof e != "object" || !e) throw new Q("BUBBLE-COMPOSITION-004", "Bubble text target must be a non-null object.");
5417
5492
  return e;
5418
5493
  }
5419
- function Ya(e, t) {
5420
- if (!Ma(e) || !Ma(e.targets) || typeof e.setLayerVisible != "function" || typeof e.updateStyle != "function" || typeof e.show != "function" || typeof e.hide != "function" || typeof e.dispose != "function") throw new Q("BUBBLE-COMPOSITION-004", "Bubble surface is invalid.");
5494
+ function io(e, t) {
5495
+ if (!Va(e) || !Va(e.targets) || typeof e.setLayerVisible != "function" || typeof e.updateStyle != "function" || typeof e.show != "function" || typeof e.hide != "function" || typeof e.dispose != "function") throw new Q("BUBBLE-COMPOSITION-004", "Bubble surface is invalid.");
5421
5496
  let n = e.targets;
5422
- Ja(n.text);
5497
+ ro(n.text);
5423
5498
  let r = /* @__PURE__ */ new Set(), i = (e, t) => {
5424
5499
  let i = n[e];
5425
5500
  if (!t && i === void 0) return;
5426
- let a = qa(i, `Bubble surface ${e}`);
5501
+ let a = no(i, `Bubble surface ${e}`);
5427
5502
  if (r.has(a.id)) throw new Q("BUBBLE-COMPOSITION-004", "Bubble image layers must use distinct target IDs.");
5428
5503
  r.add(a.id);
5429
5504
  };
5430
5505
  return i("portraitBase", t.portrait !== void 0), i("portraitBlink", t.portrait?.blink !== void 0), i("portraitLipSync", t.portrait?.lipSync !== void 0), i("continueIndicator", t.continueIndicator !== void 0), e;
5431
5506
  }
5432
- function Xa(e, t) {
5507
+ function ao(e, t) {
5433
5508
  if (e === void 0) throw new Q("BUBBLE-COMPOSITION-006", `Bubble image capability is required for: ${t}. Provide options.imageResolver.`);
5434
5509
  if (!e.isRegistered(t)) throw new Q("BUBBLE-COMPOSITION-003", `Bubble image asset is not registered: ${t}`);
5435
5510
  if (!e.getMimeType(t).startsWith("image/")) throw new Q("BUBBLE-COMPOSITION-003", `Bubble asset is not an image: ${t}`);
5436
5511
  }
5437
- function Za(e, t) {
5512
+ function oo(e, t) {
5438
5513
  if (e === void 0) throw new Q("BUBBLE-COMPOSITION-006", `Bubble audio assets require an audio capability: ${t}. Provide options.audio.`);
5439
5514
  if (e.isRegistered?.(t) === !1) throw new Q("BUBBLE-COMPOSITION-003", `Bubble audio asset is not registered: ${t}`);
5440
5515
  let n = e.getMimeType?.(t);
5441
5516
  if (n !== void 0 && !n.startsWith("audio/")) throw new Q("BUBBLE-COMPOSITION-003", `Bubble asset is not audio: ${t}`);
5442
5517
  }
5443
- function Qa(e) {
5518
+ function so(e) {
5444
5519
  return [...e.portrait === void 0 ? [] : [
5445
5520
  e.portrait.base,
5446
5521
  ...e.portrait.blink?.frames ?? [],
5447
5522
  ...e.portrait.lipSync?.frames ?? []
5448
5523
  ], ...e.continueIndicator?.frames ?? []];
5449
5524
  }
5450
- function $a(e) {
5525
+ function co(e) {
5451
5526
  let t = e.setRichText;
5452
5527
  if (typeof t != "function") throw new Q("BUBBLE-COMPOSITION-007", "Bubble ruby content requires the text capability setRichText method.");
5453
5528
  return t;
5454
5529
  }
5455
- function eo(e, t, n, r) {
5456
- return !Zi(e) && typeof r.splitRichText == "function" ? r.splitRichText({
5530
+ function lo(e, t, n, r) {
5531
+ return !oa(e) && typeof r.splitRichText == "function" ? r.splitRichText({
5457
5532
  reveal: t,
5458
5533
  runs: e,
5459
5534
  styleName: n
5460
- }) : la(e, t);
5535
+ }) : va(e, t);
5461
5536
  }
5462
- function to(e, t, n) {
5463
- if (t.layoutProfile === "scratch-default") return ba(e, (e) => typeof n.measureText == "function" ? n.measureText({
5537
+ function uo(e, t, n) {
5538
+ if (t.layoutProfile === "scratch-default") return ka(e, (e) => typeof n.measureText == "function" ? n.measureText({
5464
5539
  styleName: t.textStyle,
5465
5540
  text: e
5466
5541
  }) : NaN).text;
5467
5542
  if (t.maxWidth === void 0) return e;
5468
5543
  if (typeof n.measureText != "function") throw new Q("BUBBLE-COMPOSITION-007", "Bubble style maxWidth requires the text capability measureText method.");
5469
- return Ki({
5544
+ return ta({
5470
5545
  text: e,
5471
5546
  maxWidth: t.maxWidth,
5472
5547
  ...t.textLocale === void 0 ? {} : { locale: t.textLocale },
@@ -5476,11 +5551,11 @@ function to(e, t, n) {
5476
5551
  }) ?? 0
5477
5552
  }).lines.map(({ text: e }) => e).join("\n");
5478
5553
  }
5479
- function no(e, t) {
5554
+ function fo(e, t) {
5480
5555
  if (e.length === 1) throw e[0];
5481
5556
  if (e.length > 1) throw AggregateError(e, t);
5482
5557
  }
5483
- function ro(e) {
5558
+ function po(e) {
5484
5559
  let t = !1, n = 0, r = 0, i, a = Promise.resolve(), o = async (t) => {
5485
5560
  let n = e.animation.frames[t];
5486
5561
  n !== void 0 && await e.imageResolver.applyToTarget(n, e.target);
@@ -5515,45 +5590,45 @@ function ro(e) {
5515
5590
  }
5516
5591
  });
5517
5592
  }
5518
- function io(e) {
5519
- if (!Ma(e)) throw new Q("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
5520
- if (Na(e, [
5593
+ function mo(e) {
5594
+ if (!Va(e)) throw new Q("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
5595
+ if (Ha(e, [
5521
5596
  "actor",
5522
5597
  "actorKey",
5523
5598
  "kind",
5524
5599
  "text",
5525
5600
  "styleName"
5526
- ], ["animationMode", "reveal"], "Show bubble input"), !Oa.has(e.kind)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble kind must be say or think.");
5601
+ ], ["animationMode", "reveal"], "Show bubble input"), !La.has(e.kind)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble kind must be say or think.");
5527
5602
  let t;
5528
5603
  try {
5529
- t = Xi(e.text);
5604
+ t = aa(e.text);
5530
5605
  } catch (e) {
5531
5606
  throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble text is invalid.");
5532
5607
  }
5533
5608
  let n = e.animationMode ?? "talking";
5534
- if (!ka.has(n)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid.");
5609
+ if (!Ra.has(n)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid.");
5535
5610
  let r;
5536
5611
  if (e.reveal !== void 0) try {
5537
- r = ra(e.reveal);
5612
+ r = fa(e.reveal);
5538
5613
  } catch (e) {
5539
5614
  throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
5540
5615
  }
5541
5616
  return {
5542
5617
  actor: e.actor,
5543
- actorKey: Pa(e.actorKey, "Bubble actor key"),
5618
+ actorKey: Ua(e.actorKey, "Bubble actor key"),
5544
5619
  kind: e.kind,
5545
5620
  content: t,
5546
- styleName: Pa(e.styleName, "Bubble style name"),
5621
+ styleName: Ua(e.styleName, "Bubble style name"),
5547
5622
  animationMode: n,
5548
5623
  ...r === void 0 ? {} : { reveal: r }
5549
5624
  };
5550
5625
  }
5551
- function ao(e) {
5552
- if (!Ma(e)) throw TypeError("Bubble composition options must be an object.");
5553
- let t = Va(e.imageResolver), n = Ha(e.audio), r = Wa(e.textCapability);
5626
+ function ho(e) {
5627
+ if (!Va(e)) throw TypeError("Bubble composition options must be an object.");
5628
+ let t = Xa(e.imageResolver), n = Za(e.audio), r = $a(e.textCapability);
5554
5629
  if (typeof e.createSurface != "function") throw TypeError("Bubble composition createSurface must be a function.");
5555
5630
  if (e.onAnimationError !== void 0 && typeof e.onAnimationError != "function") throw TypeError("Bubble composition onAnimationError must be a function.");
5556
- let i = Ka(e.scheduler ?? Ga()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
5631
+ let i = to(e.scheduler ?? eo()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
5557
5632
  if (c) throw new Q("BUBBLE-COMPOSITION-005", "Bubble composition has been disposed.");
5558
5633
  }, u = async (e, t) => {
5559
5634
  let n = (s.get(e) ?? Promise.resolve()).catch(() => void 0).then(t);
@@ -5574,8 +5649,8 @@ function ao(e) {
5574
5649
  reveal: s.reveal
5575
5650
  }));
5576
5651
  let d = s.content, f = (e) => {
5577
- let n = new Set(Qa(e)), r = n.size === 0 ? void 0 : Ua(t);
5578
- for (let e of n) Xa(r, e);
5652
+ let n = new Set(so(e)), r = n.size === 0 ? void 0 : Qa(t);
5653
+ for (let e of n) ao(r, e);
5579
5654
  return r;
5580
5655
  }, p = f(u);
5581
5656
  for (let e of [
@@ -5583,13 +5658,13 @@ function ao(e) {
5583
5658
  u.audio?.reveal,
5584
5659
  u.audio?.finish,
5585
5660
  u.reveal?.sound
5586
- ]) e !== void 0 && Za(n, e);
5661
+ ]) e !== void 0 && oo(n, e);
5587
5662
  let m = async (e, t = !1) => {
5588
5663
  e !== void 0 && n !== void 0 && await n.playSound(e, { untilDone: t });
5589
5664
  }, h = async (e, t, n) => {
5590
- let r = Qa(e).length === 0 ? void 0 : Ua(t), i = [];
5665
+ let r = so(e).length === 0 ? void 0 : Qa(t), i = [];
5591
5666
  if (e.portrait) {
5592
- let t = Ua(r);
5667
+ let t = Qa(r);
5593
5668
  i.push(Promise.resolve(t.applyToTarget(e.portrait.base, n.targets.portraitBase)));
5594
5669
  let a = e.portrait.blink?.frames[0];
5595
5670
  a !== void 0 && i.push(Promise.resolve(t.applyToTarget(a, n.targets.portraitBlink)));
@@ -5598,63 +5673,63 @@ function ao(e) {
5598
5673
  }
5599
5674
  let a = e.continueIndicator?.frames[0];
5600
5675
  if (a !== void 0) {
5601
- let e = Ua(r);
5676
+ let e = Qa(r);
5602
5677
  i.push(Promise.resolve(e.applyToTarget(a, n.targets.continueIndicator)));
5603
5678
  }
5604
5679
  await Promise.all(i);
5605
5680
  }, g = (t, n, r) => {
5606
- x = t.portrait?.blink === void 0 ? void 0 : ro({
5681
+ x = t.portrait?.blink === void 0 ? void 0 : po({
5607
5682
  actorKey: s.actorKey,
5608
5683
  layer: "portraitBlink",
5609
5684
  animation: t.portrait.blink,
5610
5685
  target: r.targets.portraitBlink,
5611
- imageResolver: Ua(n),
5686
+ imageResolver: Qa(n),
5612
5687
  scheduler: i,
5613
5688
  ...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
5614
- }), S = t.portrait?.lipSync === void 0 ? void 0 : ro({
5689
+ }), S = t.portrait?.lipSync === void 0 ? void 0 : po({
5615
5690
  actorKey: s.actorKey,
5616
5691
  layer: "portraitLipSync",
5617
5692
  animation: t.portrait.lipSync,
5618
5693
  target: r.targets.portraitLipSync,
5619
- imageResolver: Ua(n),
5694
+ imageResolver: Qa(n),
5620
5695
  scheduler: i,
5621
5696
  ...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
5622
- }), C = t.continueIndicator === void 0 ? void 0 : ro({
5697
+ }), C = t.continueIndicator === void 0 ? void 0 : po({
5623
5698
  actorKey: s.actorKey,
5624
5699
  layer: "continueIndicator",
5625
5700
  animation: t.continueIndicator,
5626
5701
  target: r.targets.continueIndicator,
5627
- imageResolver: Ua(n),
5702
+ imageResolver: Qa(n),
5628
5703
  scheduler: i,
5629
5704
  ...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
5630
5705
  });
5631
5706
  }, _ = o.get(s.actorKey);
5632
5707
  _ && await _.close();
5633
- let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? eo(s.content, w, u.textStyle, r) : Object.freeze([s.content]), E = w ? Math.min(1, T.length) : 1, D, O = 0;
5708
+ let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? lo(s.content, w, u.textStyle, r) : Object.freeze([s.content]), E = w ? Math.min(1, T.length) : 1, D, O = 0;
5634
5709
  try {
5635
- v = Ya(await e.createSurface(Object.freeze({
5710
+ v = io(await e.createSurface(Object.freeze({
5636
5711
  actor: s.actor,
5637
5712
  actorKey: s.actorKey,
5638
5713
  kind: s.kind,
5639
5714
  style: u
5640
5715
  })), u);
5641
5716
  let t = (e, t, n) => {
5642
- $a(r)({
5717
+ co(r)({
5643
5718
  runs: e,
5644
5719
  styleName: t.textStyle,
5645
5720
  target: n,
5646
5721
  ...t.maxWidth === void 0 ? {} : { maxWidth: t.maxWidth }
5647
5722
  }), y = !0;
5648
- }, a = () => !Zi(d), c = async (e, n = u) => {
5723
+ }, a = () => !oa(d), c = async (e, n = u) => {
5649
5724
  if (a()) {
5650
5725
  if (!v) return;
5651
5726
  if (n.layoutProfile === "scratch-default" && v.renderScratchText) throw new Q("BUBBLE-COMPOSITION-007", "Bubble ruby content requires a rich text capability; the scratch-default surface renders plain text only.");
5652
5727
  t(e, n, v.targets.text);
5653
5728
  return;
5654
5729
  }
5655
- let i = Qi(e);
5730
+ let i = sa(e);
5656
5731
  if (n.layoutProfile === "scratch-default" && v?.renderScratchText) {
5657
- let e = ba(i, (e) => typeof r.measureText == "function" ? r.measureText({
5732
+ let e = ka(i, (e) => typeof r.measureText == "function" ? r.measureText({
5658
5733
  styleName: n.textStyle,
5659
5734
  text: e
5660
5735
  }) : NaN);
@@ -5664,19 +5739,19 @@ function ao(e) {
5664
5739
  v && (r.setText({
5665
5740
  styleName: n.textStyle,
5666
5741
  target: v.targets.text,
5667
- text: to(i, n, r)
5742
+ text: uo(i, n, r)
5668
5743
  }), y = !0);
5669
5744
  }, l = (e, n = u) => {
5670
5745
  v && (a() ? t(e, n, v.targets.text) : (r.setText({
5671
5746
  styleName: n.textStyle,
5672
5747
  target: v.targets.text,
5673
- text: to(Qi(e), n, r)
5748
+ text: uo(sa(e), n, r)
5674
5749
  }), y = !0), v.captureTextLayout?.());
5675
5750
  };
5676
- w?.layout === "RESERVED" && l(s.content), await c(w ? ua(T, E) : s.content), await h(u, p, v), g(u, p, v);
5751
+ w?.layout === "RESERVED" && l(s.content), await c(w ? ya(T, E) : s.content), await h(u, p, v), g(u, p, v);
5677
5752
  let _ = "idle", k = !1, A = Promise.resolve(), j = async () => {
5678
5753
  if (!v) return;
5679
- let e = w ? ua(T, E) : d;
5754
+ let e = w ? ya(T, E) : d;
5680
5755
  await c(e), await v.show();
5681
5756
  }, M = () => {
5682
5757
  O += 1, D !== void 0 && i.clearTimeout(D), D = void 0;
@@ -5705,37 +5780,37 @@ function ao(e) {
5705
5780
  if (k) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
5706
5781
  let t;
5707
5782
  try {
5708
- t = Xi(e);
5783
+ t = aa(e);
5709
5784
  } catch (e) {
5710
5785
  return Promise.reject(new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble text is invalid."));
5711
5786
  }
5712
5787
  return A = A.then(async () => {
5713
- v && (M(), d = t, w ? (T = eo(t, w, u.textStyle, r), E = Math.min(1, T.length), w.layout === "RESERVED" && l(t), await j(), P()) : await j());
5788
+ v && (M(), d = t, w ? (T = lo(t, w, u.textStyle, r), E = Math.min(1, T.length), w.layout === "RESERVED" && l(t), await j(), P()) : await j());
5714
5789
  }), A;
5715
5790
  },
5716
5791
  updateStyle(e) {
5717
5792
  if (k) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
5718
5793
  let t;
5719
5794
  try {
5720
- t = Ba(e);
5795
+ t = Ya(e);
5721
5796
  } catch (e) {
5722
5797
  return Promise.reject(e);
5723
5798
  }
5724
5799
  return A = A.then(async () => {
5725
5800
  if (!v) return;
5726
- Ya(v, t);
5801
+ io(v, t);
5727
5802
  let e = f(t);
5728
5803
  for (let e of [
5729
5804
  t.audio?.voice,
5730
5805
  t.audio?.reveal,
5731
5806
  t.audio?.finish,
5732
5807
  t.reveal?.sound
5733
- ]) e !== void 0 && Za(n, e);
5808
+ ]) e !== void 0 && oo(n, e);
5734
5809
  await Promise.all([
5735
5810
  x?.stop(),
5736
5811
  S?.stop(),
5737
5812
  C?.stop()
5738
- ]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? eo(d, w, t.textStyle, r) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, M(), w?.layout === "RESERVED" && l(d, t), await c(d, t), g(t, e, v), await Promise.all([
5813
+ ]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? lo(d, w, t.textStyle, r) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, M(), w?.layout === "RESERVED" && l(d, t), await c(d, t), g(t, e, v), await Promise.all([
5739
5814
  v.setLayerVisible("portraitBase", t.portrait !== void 0),
5740
5815
  v.setLayerVisible("portraitBlink", t.portrait?.blink !== void 0),
5741
5816
  v.setLayerVisible("portraitLipSync", !1),
@@ -5746,7 +5821,7 @@ function ao(e) {
5746
5821
  }), A;
5747
5822
  },
5748
5823
  setAnimationMode(e) {
5749
- return k ? Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : ka.has(e) ? (A = A.then(() => F(e)), A) : Promise.reject(new Q("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid."));
5824
+ return k ? Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : Ra.has(e) ? (A = A.then(() => F(e)), A) : Promise.reject(new Q("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid."));
5750
5825
  },
5751
5826
  revealNext() {
5752
5827
  if (k) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
@@ -5764,10 +5839,10 @@ function ao(e) {
5764
5839
  if (k) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
5765
5840
  let t = e.timeoutSeconds ?? 0;
5766
5841
  return !Number.isFinite(t) || t < 0 ? Promise.reject(new Q("BUBBLE-COMPOSITION-001", "Bubble finish timeoutSeconds must be zero or greater.")) : e.condition !== void 0 && typeof e.condition != "function" ? Promise.reject(new Q("BUBBLE-COMPOSITION-001", "Bubble finish condition must be a function.")) : (A = A.then(async () => {
5767
- if (M(), e.unit !== void 0 && (w = ra({
5842
+ if (M(), e.unit !== void 0 && (w = fa({
5768
5843
  ...w ?? {},
5769
5844
  unit: e.unit
5770
- }), T = eo(d, w, u.textStyle, r), E = Math.min(1, T.length), w.layout === "RESERVED" && v && l(d)), w) for (; await N(););
5845
+ }), T = lo(d, w, u.textStyle, r), E = Math.min(1, T.length), w.layout === "RESERVED" && v && l(d)), w) for (; await N(););
5771
5846
  let n = e.condition;
5772
5847
  if (n === void 0 && t === 0) {
5773
5848
  await m(u.audio?.finish);
@@ -5800,7 +5875,7 @@ function ao(e) {
5800
5875
  if (k) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
5801
5876
  let t;
5802
5877
  try {
5803
- t = Ra(e, "Bubble motion");
5878
+ t = qa(e, "Bubble motion");
5804
5879
  } catch (e) {
5805
5880
  return Promise.reject(e);
5806
5881
  }
@@ -5846,7 +5921,7 @@ function ao(e) {
5846
5921
  } catch (t) {
5847
5922
  e.push(t);
5848
5923
  }
5849
- o.get(s.actorKey) === I && o.delete(s.actorKey), no(e, `Failed to close bubble: ${s.actorKey}`);
5924
+ o.get(s.actorKey) === I && o.delete(s.actorKey), fo(e, `Failed to close bubble: ${s.actorKey}`);
5850
5925
  }
5851
5926
  });
5852
5927
  return o.set(s.actorKey, I), P(), u.showAnimation !== void 0 && await I.animate(u.showAnimation), I;
@@ -5878,85 +5953,85 @@ function ao(e) {
5878
5953
  return Object.freeze({
5879
5954
  defineStyle(e) {
5880
5955
  l();
5881
- let t = Ba(e);
5956
+ let t = Ya(e);
5882
5957
  a.set(t.name, t);
5883
5958
  },
5884
5959
  hasActiveBubble(e) {
5885
- return o.has(Pa(e, "Bubble actor key"));
5960
+ return o.has(Ua(e, "Bubble actor key"));
5886
5961
  },
5887
5962
  async show(e) {
5888
5963
  l();
5889
- let t = io(e);
5964
+ let t = mo(e);
5890
5965
  return u(t.actorKey, () => d(t));
5891
5966
  },
5892
5967
  releaseTarget(e) {
5893
5968
  l();
5894
- let t = Pa(e, "Bubble actor key");
5969
+ let t = Ua(e, "Bubble actor key");
5895
5970
  return u(t, async () => {
5896
5971
  await o.get(t)?.close();
5897
5972
  });
5898
5973
  },
5899
5974
  async releaseAll() {
5900
- l(), await Promise.allSettled([...s.values()]), no((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
5975
+ l(), await Promise.allSettled([...s.values()]), fo((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
5901
5976
  },
5902
5977
  async dispose() {
5903
5978
  if (c) return;
5904
5979
  c = !0, await Promise.allSettled([...s.values()]);
5905
5980
  let e = await Promise.allSettled([...o.values()].map((e) => e.close()));
5906
- a.clear(), no(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
5981
+ a.clear(), fo(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
5907
5982
  }
5908
5983
  });
5909
5984
  }
5910
5985
  //#endregion
5911
5986
  //#region src/turbowarp-svg-text-adapter.ts
5912
- function oo(e) {
5987
+ function go(e) {
5913
5988
  return typeof e == "object" && !!e && !Array.isArray(e);
5914
5989
  }
5915
- function so(e) {
5916
- if (!oo(e) || typeof e.setText != "function" || typeof e.releaseTextActor != "function") throw TypeError("TurboWarp-SVG-Text adapter requires setText and releaseTextActor.");
5990
+ function _o(e) {
5991
+ if (!go(e) || typeof e.setText != "function" || typeof e.releaseTextActor != "function") throw TypeError("TurboWarp-SVG-Text adapter requires setText and releaseTextActor.");
5917
5992
  return e;
5918
5993
  }
5919
- function co(e) {
5920
- if (!oo(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("SVG Text composition adapter requires setText and releaseTarget.");
5994
+ function vo(e) {
5995
+ if (!go(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("SVG Text composition adapter requires setText and releaseTarget.");
5921
5996
  return e;
5922
5997
  }
5923
- function lo(e) {
5924
- if (!oo(e) || typeof e.layoutText != "function") throw TypeError("SVG Text overlay adapter requires the layoutText composition API.");
5998
+ function yo(e) {
5999
+ if (!go(e) || typeof e.layoutText != "function") throw TypeError("SVG Text overlay adapter requires the layoutText composition API.");
5925
6000
  return e;
5926
6001
  }
5927
- function uo(e, t) {
6002
+ function bo(e, t) {
5928
6003
  let n = Number(e);
5929
6004
  if (!Number.isFinite(n)) throw TypeError(`${t} must be a finite number.`);
5930
6005
  return n;
5931
6006
  }
5932
- function fo(e) {
5933
- if (!oo(e) || !oo(e.style) || !Array.isArray(e.lines)) throw TypeError("SVG Text layout result is invalid.");
6007
+ function xo(e) {
6008
+ if (!go(e) || !go(e.style) || !Array.isArray(e.lines)) throw TypeError("SVG Text layout result is invalid.");
5934
6009
  let t = e.style, n = t.alignment;
5935
6010
  if (n !== "left" && n !== "center" && n !== "right") throw TypeError("SVG Text layout alignment is invalid.");
5936
- let r = uo(e.width, "SVG Text layout width"), i = uo(e.height, "SVG Text layout height"), a = Object.freeze(e.lines.map((e) => {
5937
- if (!oo(e) || typeof e.text != "string") throw TypeError("SVG Text layout line is invalid.");
6011
+ let r = bo(e.width, "SVG Text layout width"), i = bo(e.height, "SVG Text layout height"), a = Object.freeze(e.lines.map((e) => {
6012
+ if (!go(e) || typeof e.text != "string") throw TypeError("SVG Text layout line is invalid.");
5938
6013
  return Object.freeze({
5939
- baseline: uo(e.baseline, "SVG Text line baseline") - i / 2,
6014
+ baseline: bo(e.baseline, "SVG Text line baseline") - i / 2,
5940
6015
  text: e.text,
5941
- x: uo(e.x, "SVG Text line x") - r / 2
6016
+ x: bo(e.x, "SVG Text line x") - r / 2
5942
6017
  });
5943
6018
  }));
5944
6019
  return Object.freeze({
5945
6020
  alignment: n,
5946
6021
  backgroundColor: String(t.backgroundColor),
5947
- backgroundCornerRadius: uo(t.cornerRadius, "SVG Text corner radius"),
6022
+ backgroundCornerRadius: bo(t.cornerRadius, "SVG Text corner radius"),
5948
6023
  fill: String(t.textColor),
5949
6024
  fontFamily: String(t.font),
5950
- fontSize: uo(t.fontSize, "SVG Text font size"),
6025
+ fontSize: bo(t.fontSize, "SVG Text font size"),
5951
6026
  height: i,
5952
- lineHeight: uo(t.lineHeight, "SVG Text line height"),
6027
+ lineHeight: bo(t.lineHeight, "SVG Text line height"),
5953
6028
  lines: a,
5954
6029
  preserveWhitespace: e.preserveWhitespace !== !1,
5955
6030
  width: r
5956
6031
  });
5957
6032
  }
5958
- function po(e) {
5959
- let t = so(e);
6033
+ function So(e) {
6034
+ let t = _o(e);
5960
6035
  return Object.freeze({
5961
6036
  setText({ styleName: e, target: n, text: r }) {
5962
6037
  t.setText({
@@ -5973,8 +6048,8 @@ function po(e) {
5973
6048
  }
5974
6049
  });
5975
6050
  }
5976
- function mo(e) {
5977
- let t = co(e), n = {
6051
+ function Co(e) {
6052
+ let t = vo(e), n = {
5978
6053
  setText({ styleName: e, target: n, text: r }) {
5979
6054
  t.setText({
5980
6055
  styleName: e,
@@ -6002,11 +6077,11 @@ function mo(e) {
6002
6077
  ...e === void 0 ? {} : { maxWidth: e }
6003
6078
  }) ?? 0), Object.freeze(n);
6004
6079
  }
6005
- function ho(e) {
6006
- let t = lo(e);
6080
+ function wo(e) {
6081
+ let t = yo(e);
6007
6082
  return Object.freeze({
6008
6083
  layoutText({ nativeSize: e, styleName: n, text: r }) {
6009
- return fo(t.layoutText({
6084
+ return xo(t.layoutText({
6010
6085
  nativeSize: [e.width, e.height],
6011
6086
  styleName: n,
6012
6087
  text: r
@@ -6018,17 +6093,17 @@ function ho(e) {
6018
6093
  styleName: n,
6019
6094
  text: r
6020
6095
  });
6021
- return Math.max(1, ...i.lines.map((e) => uo(e.width, "SVG Text line width")));
6096
+ return Math.max(1, ...i.lines.map((e) => bo(e.width, "SVG Text line width")));
6022
6097
  }
6023
6098
  });
6024
6099
  }
6025
- function go(e) {
6026
- if (!oo(e) || typeof e.getLayoutCapability != "function") throw TypeError("TurboWarp-SVG-Text overlay adapter requires SVG Text 0.8.1 getLayoutCapability().");
6027
- return ho(e.getLayoutCapability());
6100
+ function To(e) {
6101
+ if (!go(e) || typeof e.getLayoutCapability != "function") throw TypeError("TurboWarp-SVG-Text overlay adapter requires SVG Text 0.8.1 getLayoutCapability().");
6102
+ return wo(e.getLayoutCapability());
6028
6103
  }
6029
6104
  //#endregion
6030
6105
  //#region src/asset-manager-image-adapter.ts
6031
- var _o = /* @__PURE__ */ new Set([
6106
+ var Eo = /* @__PURE__ */ new Set([
6032
6107
  "image/avif",
6033
6108
  "image/gif",
6034
6109
  "image/jpeg",
@@ -6036,37 +6111,37 @@ var _o = /* @__PURE__ */ new Set([
6036
6111
  "image/svg+xml",
6037
6112
  "image/webp"
6038
6113
  ]);
6039
- function vo(e) {
6114
+ function Do(e) {
6040
6115
  return typeof e == "object" && !!e && !Array.isArray(e);
6041
6116
  }
6042
- function yo(e) {
6117
+ function Oo(e) {
6043
6118
  let t = e.split(";", 1)[0]?.trim().toLowerCase() ?? "";
6044
6119
  return t === "image/jpg" || t === "image/pjpeg" ? "image/jpeg" : t === "image/x-png" ? "image/png" : t;
6045
6120
  }
6046
- function bo(e) {
6047
- return _o.has(yo(e));
6121
+ function ko(e) {
6122
+ return Eo.has(Oo(e));
6048
6123
  }
6049
- function xo(e) {
6050
- if (!vo(e) || typeof e.url != "string" || !e.url.startsWith("blob:") || typeof e.mimeType != "string" || !bo(e.mimeType) || typeof e.width != "number" || !Number.isFinite(e.width) || e.width <= 0 || typeof e.height != "number" || !Number.isFinite(e.height) || e.height <= 0 || typeof e.release != "function") throw TypeError("Asset Manager DOM image resources must provide a supported MIME type, positive intrinsic dimensions, a blob URL, and release().");
6124
+ function Ao(e) {
6125
+ if (!Do(e) || typeof e.url != "string" || !e.url.startsWith("blob:") || typeof e.mimeType != "string" || !ko(e.mimeType) || typeof e.width != "number" || !Number.isFinite(e.width) || e.width <= 0 || typeof e.height != "number" || !Number.isFinite(e.height) || e.height <= 0 || typeof e.release != "function") throw TypeError("Asset Manager DOM image resources must provide a supported MIME type, positive intrinsic dimensions, a blob URL, and release().");
6051
6126
  return e;
6052
6127
  }
6053
- function So(e) {
6054
- if (!vo(e) || typeof e.isRegistered != "function" || typeof e.getMimeType != "function" || typeof e.resolveDOMImageResource != "function") throw TypeError("Asset Manager DOM image capability is invalid.");
6128
+ function jo(e) {
6129
+ if (!Do(e) || typeof e.isRegistered != "function" || typeof e.getMimeType != "function" || typeof e.resolveDOMImageResource != "function") throw TypeError("Asset Manager DOM image capability is invalid.");
6055
6130
  let t = e;
6056
6131
  return Object.freeze({
6057
6132
  isRegistered(e) {
6058
- return t.isRegistered(e) && bo(t.getMimeType(e));
6133
+ return t.isRegistered(e) && ko(t.getMimeType(e));
6059
6134
  },
6060
6135
  getMimeType(e) {
6061
- return yo(t.getMimeType(e));
6136
+ return Oo(t.getMimeType(e));
6062
6137
  },
6063
6138
  async resolveImage(e) {
6064
- let n = yo(t.getMimeType(e));
6065
- if (!t.isRegistered(e) || !bo(n)) throw TypeError("Asset Manager image is not registered with a Bubble-compatible MIME type.");
6139
+ let n = Oo(t.getMimeType(e));
6140
+ if (!t.isRegistered(e) || !ko(n)) throw TypeError("Asset Manager image is not registered with a Bubble-compatible MIME type.");
6066
6141
  let r = await t.resolveDOMImageResource(e);
6067
6142
  try {
6068
- xo(r);
6069
- let e = yo(r.mimeType);
6143
+ Ao(r);
6144
+ let e = Oo(r.mimeType);
6070
6145
  if (e !== n) throw TypeError("Asset Manager DOM image resource MIME type changed during resolution.");
6071
6146
  return Object.freeze({
6072
6147
  height: r.height,
@@ -6084,11 +6159,11 @@ function So(e) {
6084
6159
  }
6085
6160
  //#endregion
6086
6161
  //#region src/surface-motion.ts
6087
- function Co(e) {
6162
+ function Mo(e) {
6088
6163
  return Math.max(0, Math.min(1, e));
6089
6164
  }
6090
- function wo(e, t) {
6091
- let n = Co(e);
6165
+ function No(e, t) {
6166
+ let n = Mo(e);
6092
6167
  switch (t) {
6093
6168
  case "linear": return n;
6094
6169
  case "easeIn": return n * n;
@@ -6097,14 +6172,14 @@ function wo(e, t) {
6097
6172
  default: return n;
6098
6173
  }
6099
6174
  }
6100
- function To(e, t, n) {
6175
+ function Po(e, t, n) {
6101
6176
  let r = Math.max(0, t * 1e3);
6102
6177
  return r === 0 ? (n(1), Promise.resolve()) : new Promise((t, i) => {
6103
6178
  let a = 0, o, s = () => {
6104
6179
  let c = Math.min(16, r - a);
6105
6180
  a += c;
6106
6181
  try {
6107
- n(Co(a / r));
6182
+ n(Mo(a / r));
6108
6183
  } catch (t) {
6109
6184
  o !== void 0 && e.clearTimeout(o), i(t);
6110
6185
  return;
@@ -6120,33 +6195,33 @@ function To(e, t, n) {
6120
6195
  }
6121
6196
  //#endregion
6122
6197
  //#region src/svg-overlay-surface.ts
6123
- var Eo = "http://www.w3.org/2000/svg", Do = "http://www.w3.org/XML/1998/namespace", Oo = 96, ko = 18, Ao = 8, jo = 16, Mo = Symbol("BubbleSvgOverlayTextTarget"), No = Symbol("BubbleSvgOverlayImageTarget"), Po = 0, Fo = Object.freeze(["scratch-render", "svg-overlay"]), Io = "svg-overlay", Lo = "error";
6124
- function Ro(e) {
6198
+ var Fo = "http://www.w3.org/2000/svg", Io = "http://www.w3.org/XML/1998/namespace", Lo = 96, Ro = 18, zo = 8, Bo = 16, Vo = Symbol("BubbleSvgOverlayTextTarget"), Ho = Symbol("BubbleSvgOverlayImageTarget"), Uo = 0, Wo = Object.freeze(["scratch-render", "svg-overlay"]), Go = "svg-overlay", Ko = "error";
6199
+ function qo(e) {
6125
6200
  return typeof e == "object" && !!e && !Array.isArray(e);
6126
6201
  }
6127
- function zo(e) {
6202
+ function Jo(e) {
6128
6203
  let t = e.getNativeSize(), n = Array.isArray(t) ? Number(t[0]) : NaN, r = Array.isArray(t) ? Number(t[1]) : NaN;
6129
6204
  return Object.freeze({
6130
6205
  width: n > 0 ? n : 480,
6131
6206
  height: r > 0 ? r : 360
6132
6207
  });
6133
6208
  }
6134
- function Bo(e, t) {
6209
+ function Yo(e, t) {
6135
6210
  let n = Number(e);
6136
6211
  if (!Number.isFinite(n) || n <= 0) throw TypeError(`${t} must be a positive finite number.`);
6137
6212
  return n;
6138
6213
  }
6139
- function Vo(e, t) {
6214
+ function Xo(e, t) {
6140
6215
  if (typeof e != "string" || e.length === 0 || e.length > 128) throw TypeError(`${t} must be a non-empty color string.`);
6141
6216
  if (/url\s*\(|[<>;]/iu.test(e)) throw TypeError(`${t} contains a disallowed SVG value.`);
6142
6217
  return e;
6143
6218
  }
6144
- function Ho(e) {
6219
+ function Zo(e) {
6145
6220
  if (typeof e != "string" || e.length === 0 || e.length > 256 || /url\s*\(|[<>{};]/iu.test(e)) throw TypeError("SVG overlay fontFamily is invalid.");
6146
6221
  return e;
6147
6222
  }
6148
- function Uo(e) {
6149
- if (!Ro(e) || !Array.isArray(e.lines)) throw TypeError("SVG overlay text layout is invalid.");
6223
+ function Qo(e) {
6224
+ if (!qo(e) || !Array.isArray(e.lines)) throw TypeError("SVG overlay text layout is invalid.");
6150
6225
  let t = e.alignment;
6151
6226
  if (t !== "left" && t !== "center" && t !== "right") throw TypeError("SVG overlay text alignment is invalid.");
6152
6227
  let n = e.fontStyle;
@@ -6155,7 +6230,7 @@ function Uo(e) {
6155
6230
  if (r !== void 0 && r !== "normal" && r !== "bold" && (!Number.isFinite(r) || Number(r) < 1 || Number(r) > 1e3)) throw TypeError("SVG overlay fontWeight is invalid.");
6156
6231
  let i = Object.freeze(e.lines.map((e) => {
6157
6232
  if (typeof e == "string") return e;
6158
- if (!Ro(e) || typeof e.text != "string") throw TypeError("SVG overlay text lines must be strings or positioned line records.");
6233
+ if (!qo(e) || typeof e.text != "string") throw TypeError("SVG overlay text lines must be strings or positioned line records.");
6159
6234
  let t = e.x !== void 0;
6160
6235
  if (t !== (e.baseline !== void 0)) throw TypeError("SVG overlay positioned text lines require both x and baseline.");
6161
6236
  if (t && (!Number.isFinite(e.x) || !Number.isFinite(e.baseline))) throw TypeError("SVG overlay text line coordinates must be finite numbers.");
@@ -6166,19 +6241,19 @@ function Uo(e) {
6166
6241
  baseline: Number(e.baseline)
6167
6242
  } : {}
6168
6243
  });
6169
- })), a = e.backgroundColor === void 0 ? void 0 : Vo(e.backgroundColor, "SVG overlay backgroundColor"), o = e.backgroundCornerRadius === void 0 ? void 0 : Number(e.backgroundCornerRadius);
6244
+ })), a = e.backgroundColor === void 0 ? void 0 : Xo(e.backgroundColor, "SVG overlay backgroundColor"), o = e.backgroundCornerRadius === void 0 ? void 0 : Number(e.backgroundCornerRadius);
6170
6245
  if (o !== void 0 && (!Number.isFinite(o) || o < 0)) throw TypeError("SVG overlay backgroundCornerRadius must be a non-negative finite number.");
6171
6246
  let s = e.preserveWhitespace;
6172
6247
  if (s !== void 0 && typeof s != "boolean") throw TypeError("SVG overlay preserveWhitespace must be a boolean.");
6173
6248
  return Object.freeze({
6174
6249
  alignment: t,
6175
- fill: Vo(e.fill, "SVG overlay text fill"),
6176
- fontFamily: Ho(e.fontFamily),
6177
- fontSize: Bo(e.fontSize, "SVG overlay fontSize"),
6178
- height: Bo(e.height, "SVG overlay text height"),
6179
- lineHeight: Bo(e.lineHeight, "SVG overlay lineHeight"),
6250
+ fill: Xo(e.fill, "SVG overlay text fill"),
6251
+ fontFamily: Zo(e.fontFamily),
6252
+ fontSize: Yo(e.fontSize, "SVG overlay fontSize"),
6253
+ height: Yo(e.height, "SVG overlay text height"),
6254
+ lineHeight: Yo(e.lineHeight, "SVG overlay lineHeight"),
6180
6255
  lines: i,
6181
- width: Bo(e.width, "SVG overlay text width"),
6256
+ width: Yo(e.width, "SVG overlay text width"),
6182
6257
  ...a === void 0 ? {} : { backgroundColor: a },
6183
6258
  ...o === void 0 ? {} : { backgroundCornerRadius: o },
6184
6259
  ...n === void 0 ? {} : { fontStyle: n },
@@ -6186,21 +6261,21 @@ function Uo(e) {
6186
6261
  ...s === void 0 ? {} : { preserveWhitespace: s }
6187
6262
  });
6188
6263
  }
6189
- function Wo(e, t) {
6264
+ function $o(e, t) {
6190
6265
  let n = {
6191
6266
  width: 180,
6192
6267
  height: 48
6193
6268
  }, r, i, a, o = (r) => {
6194
- let i = Uo(r), a = [];
6269
+ let i = Qo(r), a = [];
6195
6270
  if (i.backgroundColor !== void 0 && i.backgroundColor !== "transparent") {
6196
- let t = e.createElementNS(Eo, "rect");
6271
+ let t = e.createElementNS(Fo, "rect");
6197
6272
  t.setAttribute("x", String(-i.width / 2)), t.setAttribute("y", String(-i.height / 2)), t.setAttribute("width", String(i.width)), t.setAttribute("height", String(i.height)), t.setAttribute("fill", i.backgroundColor), i.backgroundCornerRadius !== void 0 && t.setAttribute("rx", String(i.backgroundCornerRadius)), a.push(t);
6198
6273
  }
6199
- let o = e.createElementNS(Eo, "text"), s = i.alignment === "left" ? "start" : i.alignment === "right" ? "end" : "middle", c = i.alignment === "left" ? -i.width / 2 : i.alignment === "right" ? i.width / 2 : 0;
6200
- o.setAttribute("text-anchor", s), o.setAttribute("fill", i.fill), o.setAttribute("font-family", i.fontFamily), o.setAttribute("font-size", String(i.fontSize)), i.preserveWhitespace !== !1 && o.setAttributeNS(Do, "xml:space", "preserve"), i.fontStyle !== void 0 && o.setAttribute("font-style", i.fontStyle), i.fontWeight !== void 0 && o.setAttribute("font-weight", String(i.fontWeight));
6274
+ let o = e.createElementNS(Fo, "text"), s = i.alignment === "left" ? "start" : i.alignment === "right" ? "end" : "middle", c = i.alignment === "left" ? -i.width / 2 : i.alignment === "right" ? i.width / 2 : 0;
6275
+ o.setAttribute("text-anchor", s), o.setAttribute("fill", i.fill), o.setAttribute("font-family", i.fontFamily), o.setAttribute("font-size", String(i.fontSize)), i.preserveWhitespace !== !1 && o.setAttributeNS(Io, "xml:space", "preserve"), i.fontStyle !== void 0 && o.setAttribute("font-style", i.fontStyle), i.fontWeight !== void 0 && o.setAttribute("font-weight", String(i.fontWeight));
6201
6276
  let l = -Math.max(i.fontSize, (i.lines.length - 1) * i.lineHeight + i.fontSize) / 2 + i.fontSize;
6202
6277
  i.lines.forEach((t, n) => {
6203
- let r = e.createElementNS(Eo, "tspan"), a = typeof t == "string" ? void 0 : t;
6278
+ let r = e.createElementNS(Fo, "tspan"), a = typeof t == "string" ? void 0 : t;
6204
6279
  r.setAttribute("x", String(a?.x ?? c)), r.setAttribute("y", String(a?.baseline ?? l + n * i.lineHeight)), r.textContent = typeof t == "string" ? t : t.text, o.appendChild(r);
6205
6280
  }), a.push(o), t.replaceChildren(...a), n = {
6206
6281
  width: i.width,
@@ -6208,7 +6283,7 @@ function Wo(e, t) {
6208
6283
  };
6209
6284
  };
6210
6285
  return Object.freeze({
6211
- [Mo]: !0,
6286
+ [Vo]: !0,
6212
6287
  group: t,
6213
6288
  captureLayout() {
6214
6289
  i = r, a = { ...n };
@@ -6230,7 +6305,7 @@ function Wo(e, t) {
6230
6305
  },
6231
6306
  refresh() {
6232
6307
  if (i !== void 0) {
6233
- let e = Uo(i());
6308
+ let e = Qo(i());
6234
6309
  a = {
6235
6310
  width: e.width,
6236
6311
  height: e.height
@@ -6243,29 +6318,29 @@ function Wo(e, t) {
6243
6318
  }
6244
6319
  });
6245
6320
  }
6246
- function Go(e) {
6321
+ function es(e) {
6247
6322
  let t = e;
6248
- if (t?.[Mo] !== !0) throw TypeError("SVG overlay text target is invalid.");
6323
+ if (t?.[Vo] !== !0) throw TypeError("SVG overlay text target is invalid.");
6249
6324
  return t;
6250
6325
  }
6251
- function Ko(e, t) {
6252
- if (!Ro(e) || typeof e.layoutText != "function") throw TypeError("SVG overlay backend requires a text layout capability.");
6326
+ function ts(e, t) {
6327
+ if (!qo(e) || typeof e.layoutText != "function") throw TypeError("SVG overlay backend requires a text layout capability.");
6253
6328
  let n = e;
6254
6329
  return Object.freeze({
6255
6330
  setText({ styleName: e, target: r, text: i }) {
6256
- let a = Go(r), o = () => n.layoutText({
6257
- nativeSize: zo(t),
6331
+ let a = es(r), o = () => n.layoutText({
6332
+ nativeSize: Jo(t),
6258
6333
  styleName: e,
6259
6334
  text: i
6260
6335
  });
6261
6336
  a.render(o(), o);
6262
6337
  },
6263
6338
  releaseTarget(e) {
6264
- Go(e).clear();
6339
+ es(e).clear();
6265
6340
  },
6266
6341
  measureText({ styleName: e, text: r }) {
6267
- let i = zo(t);
6268
- return Bo(n.measureText?.({
6342
+ let i = Jo(t);
6343
+ return Yo(n.measureText?.({
6269
6344
  nativeSize: i,
6270
6345
  styleName: e,
6271
6346
  text: r
@@ -6277,7 +6352,7 @@ function Ko(e, t) {
6277
6352
  }
6278
6353
  });
6279
6354
  }
6280
- function qo(e) {
6355
+ function ns(e) {
6281
6356
  return !(/* @__PURE__ */ new Set([
6282
6357
  "image/avif",
6283
6358
  "image/gif",
@@ -6287,11 +6362,11 @@ function qo(e) {
6287
6362
  "image/webp"
6288
6363
  ])).has(e.mimeType.toLowerCase()) || e.mimeType.toLowerCase() === "image/svg+xml" && e.svgSecurity !== "sanitized" ? !1 : e.src.startsWith("blob:") ? typeof e.release == "function" : /^data:image\/(?:avif|gif|jpeg|png|webp);base64,/iu.test(e.src);
6289
6364
  }
6290
- async function Jo(e) {
6365
+ async function rs(e) {
6291
6366
  await e?.release?.();
6292
6367
  }
6293
- function Yo(e, t, n) {
6294
- let r = e.createElementNS(Eo, "image");
6368
+ function is(e, t, n) {
6369
+ let r = e.createElementNS(Fo, "image");
6295
6370
  r.setAttribute("preserveAspectRatio", "xMidYMid meet"), n.appendChild(r);
6296
6371
  let i, a = {
6297
6372
  width: 1,
@@ -6302,22 +6377,22 @@ function Yo(e, t, n) {
6302
6377
  return s(), Object.freeze({
6303
6378
  id: t,
6304
6379
  isStage: !1,
6305
- [No]: !0,
6380
+ [Ho]: !0,
6306
6381
  group: n,
6307
6382
  async applyResource(e) {
6308
6383
  let t = o + 1;
6309
6384
  o = t;
6310
6385
  try {
6311
- if (Bo(e.width, "SVG overlay image width"), Bo(e.height, "SVG overlay image height"), typeof e.mimeType != "string" || !e.mimeType.startsWith("image/") || typeof e.src != "string" || !qo(e)) throw TypeError("SVG overlay image resources must use a supported MIME type, a releasable blob URL or approved raster data URL, and sanitized SVG metadata when applicable.");
6386
+ if (Yo(e.width, "SVG overlay image width"), Yo(e.height, "SVG overlay image height"), typeof e.mimeType != "string" || !e.mimeType.startsWith("image/") || typeof e.src != "string" || !ns(e)) throw TypeError("SVG overlay image resources must use a supported MIME type, a releasable blob URL or approved raster data URL, and sanitized SVG metadata when applicable.");
6312
6387
  } catch (t) {
6313
- throw await Jo(e), t;
6388
+ throw await rs(e), t;
6314
6389
  }
6315
6390
  if (t !== o) {
6316
- await Jo(e);
6391
+ await rs(e);
6317
6392
  return;
6318
6393
  }
6319
6394
  let n = i;
6320
- i = e, r.setAttribute("href", e.src), await Jo(n);
6395
+ i = e, r.setAttribute("href", e.src), await rs(n);
6321
6396
  },
6322
6397
  getSize() {
6323
6398
  return i ? {
@@ -6331,7 +6406,7 @@ function Yo(e, t, n) {
6331
6406
  async release() {
6332
6407
  o += 1;
6333
6408
  let e = i;
6334
- i = void 0, r.removeAttribute("href"), await Jo(e);
6409
+ i = void 0, r.removeAttribute("href"), await rs(e);
6335
6410
  },
6336
6411
  setDisplaySize(e) {
6337
6412
  a = e, s();
@@ -6341,13 +6416,13 @@ function Yo(e, t, n) {
6341
6416
  }
6342
6417
  });
6343
6418
  }
6344
- function Xo(e) {
6419
+ function as(e) {
6345
6420
  let t = e;
6346
- if (t?.[No] !== !0) throw TypeError("SVG overlay image target is invalid.");
6421
+ if (t?.[Ho] !== !0) throw TypeError("SVG overlay image target is invalid.");
6347
6422
  return t;
6348
6423
  }
6349
- function Zo(e) {
6350
- if (!Ro(e) || typeof e.isRegistered != "function" || typeof e.getMimeType != "function" || typeof e.resolveImage != "function") throw TypeError("SVG overlay image capability is invalid.");
6424
+ function os(e) {
6425
+ if (!qo(e) || typeof e.isRegistered != "function" || typeof e.getMimeType != "function" || typeof e.resolveImage != "function") throw TypeError("SVG overlay image capability is invalid.");
6351
6426
  let t = e;
6352
6427
  return Object.freeze({
6353
6428
  isRegistered(e) {
@@ -6357,15 +6432,15 @@ function Zo(e) {
6357
6432
  return t.getMimeType(e);
6358
6433
  },
6359
6434
  async applyToTarget(e, n) {
6360
- await Xo(n).applyResource(await t.resolveImage(e));
6435
+ await as(n).applyResource(await t.resolveImage(e));
6361
6436
  }
6362
6437
  });
6363
6438
  }
6364
- function Qo(e, t) {
6365
- let n = t.createElementNS(Eo, "svg");
6366
- n.setAttribute("xmlns", Eo), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.setAttribute("data-bubble-render-backend", "svg-overlay"), n.style.display = "block", n.style.overflow = "hidden", n.style.pointerEvents = "none";
6439
+ function ss(e, t) {
6440
+ let n = t.createElementNS(Fo, "svg");
6441
+ n.setAttribute("xmlns", Fo), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.setAttribute("data-bubble-render-backend", "svg-overlay"), n.style.display = "block", n.style.overflow = "hidden", n.style.pointerEvents = "none";
6367
6442
  let r = /* @__PURE__ */ new Set(), i = !1, a = () => {
6368
- let t = zo(e);
6443
+ let t = Jo(e);
6369
6444
  return n.setAttribute("width", String(t.width)), n.setAttribute("height", String(t.height)), n.setAttribute("viewBox", `0 0 ${t.width} ${t.height}`), t;
6370
6445
  };
6371
6446
  return Object.freeze({
@@ -6387,7 +6462,7 @@ function Qo(e, t) {
6387
6462
  updateNativeSize: a
6388
6463
  });
6389
6464
  }
6390
- function $o(e) {
6465
+ function cs(e) {
6391
6466
  try {
6392
6467
  let t = e.getBoundsForBubble?.();
6393
6468
  if (t && [
@@ -6405,21 +6480,21 @@ function $o(e) {
6405
6480
  top: n
6406
6481
  };
6407
6482
  }
6408
- function es(e, t, n) {
6483
+ function ls(e, t, n) {
6409
6484
  return n < t ? (t + n) / 2 : Math.min(n, Math.max(t, e));
6410
6485
  }
6411
- function ts(e) {
6486
+ function us(e) {
6412
6487
  let t = Ze(e);
6413
6488
  return (Math.atan2(-t.x, -t.y) * 180 / Math.PI % 360 + 360) % 360;
6414
6489
  }
6415
- var ns = /* @__PURE__ */ new Set([
6490
+ var ds = /* @__PURE__ */ new Set([
6416
6491
  "circle",
6417
6492
  "g",
6418
6493
  "path",
6419
6494
  "rect",
6420
6495
  "text",
6421
6496
  "title"
6422
- ]), rs = /* @__PURE__ */ new Set([
6497
+ ]), fs = /* @__PURE__ */ new Set([
6423
6498
  "cx",
6424
6499
  "cy",
6425
6500
  "d",
@@ -6444,46 +6519,46 @@ var ns = /* @__PURE__ */ new Set([
6444
6519
  "x",
6445
6520
  "y"
6446
6521
  ]);
6447
- function is(e, t) {
6522
+ function ps(e, t) {
6448
6523
  let n = e.localName;
6449
- if (!ns.has(n)) throw TypeError(`Bubble body SVG element is not allowed: ${n}`);
6450
- let r = t.createElementNS(Eo, n);
6524
+ if (!ds.has(n)) throw TypeError(`Bubble body SVG element is not allowed: ${n}`);
6525
+ let r = t.createElementNS(Fo, n);
6451
6526
  for (let t of e.getAttributeNames()) {
6452
- if (!rs.has(t)) throw TypeError(`Bubble body SVG attribute is not allowed: ${t}`);
6527
+ if (!fs.has(t)) throw TypeError(`Bubble body SVG attribute is not allowed: ${t}`);
6453
6528
  let n = e.getAttribute(t) ?? "";
6454
6529
  if (/javascript:|url\s*\(/iu.test(n)) throw TypeError("Bubble body SVG contains an unsafe attribute value.");
6455
6530
  r.setAttribute(t, n);
6456
6531
  }
6457
6532
  (n === "title" || n === "text") && (r.textContent = e.textContent ?? "");
6458
- for (let n of Array.from(e.children)) r.appendChild(is(n, t));
6533
+ for (let n of Array.from(e.children)) r.appendChild(ps(n, t));
6459
6534
  return r;
6460
6535
  }
6461
- function as(e, t, n) {
6536
+ function ms(e, t, n) {
6462
6537
  let r = n.defaultView?.DOMParser;
6463
6538
  if (!r) throw TypeError("SVG overlay backend requires DOMParser.");
6464
6539
  let i = new r().parseFromString(t, "image/svg+xml");
6465
6540
  if (i.querySelector("parsererror")) throw TypeError("Canonical Bubble body SVG could not be parsed.");
6466
- let a = Array.from(i.documentElement.children).map((e) => is(e, n));
6541
+ let a = Array.from(i.documentElement.children).map((e) => ps(e, n));
6467
6542
  e.replaceChildren(...a);
6468
6543
  }
6469
- function os(e, t, n = 1) {
6544
+ function hs(e, t, n = 1) {
6470
6545
  let r = e.getSize(), i = Math.min(t / r.width, t / r.height), a = {
6471
6546
  width: r.width * i * n,
6472
6547
  height: r.height * i * n
6473
6548
  };
6474
6549
  return e.setDisplaySize(a), a;
6475
6550
  }
6476
- function ss(e, t, n, r, i, a) {
6477
- let { document: o, renderer: s } = e, c = Po;
6478
- Po += 1;
6479
- let l = o.createElementNS(Eo, "g");
6551
+ function gs(e, t, n, r, i, a) {
6552
+ let { document: o, renderer: s } = e, c = Uo;
6553
+ Uo += 1;
6554
+ let l = o.createElementNS(Fo, "g");
6480
6555
  l.setAttribute("data-bubble-surface", `${n}:${c}`);
6481
- let u = o.createElementNS(Eo, "g");
6556
+ let u = o.createElementNS(Fo, "g");
6482
6557
  u.setAttribute("data-bubble-layer", "body"), l.appendChild(u);
6483
6558
  let d = (e) => {
6484
- let t = o.createElementNS(Eo, "g");
6559
+ let t = o.createElementNS(Fo, "g");
6485
6560
  return t.setAttribute("data-bubble-layer", e), t.setAttribute("visibility", "hidden"), l.appendChild(t), t;
6486
- }, f = Yo(o, `bubble:${n}:${c}:portrait-base`, d("portrait-base")), p = Yo(o, `bubble:${n}:${c}:portrait-blink`, d("portrait-blink")), m = Yo(o, `bubble:${n}:${c}:portrait-lip-sync`, d("portrait-lip-sync")), h = d("text"), g = Wo(o, h), _ = Yo(o, `bubble:${n}:${c}:continue-indicator`, d("continue-indicator")), v = Object.freeze({
6561
+ }, f = is(o, `bubble:${n}:${c}:portrait-base`, d("portrait-base")), p = is(o, `bubble:${n}:${c}:portrait-blink`, d("portrait-blink")), m = is(o, `bubble:${n}:${c}:portrait-lip-sync`, d("portrait-lip-sync")), h = d("text"), g = $o(o, h), _ = is(o, `bubble:${n}:${c}:continue-indicator`, d("continue-indicator")), v = Object.freeze({
6487
6562
  text: g,
6488
6563
  portraitBase: f,
6489
6564
  portraitBlink: p,
@@ -6494,22 +6569,22 @@ function ss(e, t, n, r, i, a) {
6494
6569
  ["portraitBlink", p],
6495
6570
  ["portraitLipSync", m],
6496
6571
  ["continueIndicator", _]
6497
- ]), b = /* @__PURE__ */ new Map(), x = `bubble-portrait-clip-${c}`, S = o.createElementNS(Eo, "defs"), C = o.createElementNS(Eo, "clipPath"), w = o.createElementNS(Eo, "rect");
6572
+ ]), b = /* @__PURE__ */ new Map(), x = `bubble-portrait-clip-${c}`, S = o.createElementNS(Fo, "defs"), C = o.createElementNS(Fo, "clipPath"), w = o.createElementNS(Fo, "rect");
6498
6573
  C.setAttribute("id", x), C.appendChild(w), S.appendChild(C), l.insertBefore(S, u);
6499
6574
  let T = i, E = !1, D = !1, O = "", k = [0, 0], A = 1, j = 1, M = [0, 0], N, P, F = !1, I = (t = e.updateNativeSize()) => {
6500
6575
  let n = t.width / 2 + M[0], r = t.height / 2 - M[1], i = n + k[0], a = r - k[1];
6501
6576
  l.setAttribute("transform", `translate(${i} ${a}) scale(${A}) translate(${-n} ${-r})`), l.setAttribute("opacity", String(j));
6502
- }, ee = (e) => e === "continueIndicator" ? T.continueIndicator !== void 0 : e === "portraitBase" ? T.portrait !== void 0 : e === "portraitBlink" ? T.portrait?.blink !== void 0 : T.portrait?.lipSync !== void 0, L = (e) => {
6577
+ }, L = (e) => e === "continueIndicator" ? T.continueIndicator !== void 0 : e === "portraitBase" ? T.portrait !== void 0 : e === "portraitBlink" ? T.portrait?.blink !== void 0 : T.portrait?.lipSync !== void 0, R = (e) => {
6503
6578
  let n = T.placement.basis === "background" || t.visible !== !1, r = D && n && j > 0, i = T.layoutProfile === "scratch-default" && P !== void 0;
6504
6579
  l.setAttribute("visibility", r ? "visible" : "hidden"), u.setAttribute("visibility", r && (i || T.visualStyle !== "NO_BUBBLE") ? "visible" : "hidden"), h.setAttribute("visibility", r && !i ? "visible" : "hidden");
6505
- for (let [e, t] of y) t.setVisible(r && ee(e) && (b.get(e) ?? !1));
6580
+ for (let [e, t] of y) t.setVisible(r && L(e) && (b.get(e) ?? !1));
6506
6581
  I(e);
6507
- }, R = () => {
6582
+ }, z = () => {
6508
6583
  if (E) return;
6509
6584
  let n = e.updateNativeSize();
6510
6585
  if (T.layoutProfile === "scratch-default" && P !== void 0) {
6511
- let e = xa(P), i = Sa({
6512
- bounds: $o(t),
6586
+ let e = Aa(P), i = ja({
6587
+ bounds: cs(t),
6513
6588
  height: e.height,
6514
6589
  pointsLeft: F,
6515
6590
  stageHeight: n.height,
@@ -6522,30 +6597,34 @@ function ss(e, t, n, r, i, a) {
6522
6597
  layout: P,
6523
6598
  pointsLeft: F
6524
6599
  });
6525
- a !== O && (as(u, Da({
6600
+ a !== O && (ms(u, Ia({
6526
6601
  kind: r,
6527
6602
  layout: P,
6528
6603
  pointsLeft: F,
6529
6604
  title: `${T.name} ${r} Bubble`
6530
- }), o), O = a), u.setAttribute("data-bubble-style", "SCRATCH_DEFAULT"), u.setAttribute("data-bubble-profile", "scratch-default"), u.setAttribute("data-bubble-kind", r), u.setAttribute("data-bubble-body-width", String(e.width)), u.setAttribute("data-bubble-body-height", String(e.height)), u.setAttribute("transform", `translate(${n.width / 2 + i.left} ${n.height / 2 - i.top})`), L(n);
6605
+ }), o), O = a), u.setAttribute("data-bubble-style", "SCRATCH_DEFAULT"), u.setAttribute("data-bubble-profile", "scratch-default"), u.setAttribute("data-bubble-kind", r), u.setAttribute("data-bubble-body-width", String(e.width)), u.setAttribute("data-bubble-body-height", String(e.height)), u.setAttribute("transform", `translate(${n.width / 2 + i.left} ${n.height / 2 - i.top})`), R(n);
6531
6606
  return;
6532
6607
  }
6533
6608
  u.removeAttribute("data-bubble-profile"), u.removeAttribute("data-bubble-kind");
6534
6609
  let i = T.placement.basis === "actor" ? T.offset.scalePercent / 100 : 1, a = g.getCapturedSize() ?? g.getSize(), s = {
6535
6610
  width: a.width * i,
6536
6611
  height: a.height * i
6537
- }, c = (T.portrait?.offset.zoomPercent ?? 100) / 100, l = T.portrait !== void 0, d = l ? os(f, Oo * c, i) : {
6612
+ }, c = (T.portrait?.offset.zoomPercent ?? 100) / 100, l = T.portrait !== void 0, d = l ? hs(f, Lo * c, i) : {
6538
6613
  width: 0,
6539
6614
  height: 0
6540
6615
  };
6541
- for (let e of [p, m]) l && os(e, Oo * c, i);
6542
- let v = os(_, ko, i), y = d.width + (l ? Ao * i : 0) + s.width, b = Math.max(d.height, s.height), S = pt(T.visualStyle, ...N === void 0 ? [] : [N.from, N.to]), C = Math.max(y / i + 48, S.width), D = Math.max(b / i + 48, S.height), k = Math.max(y, (C - 48) * i), A = Math.max(b, (D - 48) * i), j = -n.width / 2, I = n.width / 2, ee = n.height / 2, R = -n.height / 2, z, B;
6543
- if (T.placement.basis === "background") z = 0, B = T.placement.region === "HEADER_LIKE" ? ee - jo - A / 2 : T.placement.region === "FOOTER_LIKE" ? R + jo + A / 2 : 0;
6616
+ for (let e of [p, m]) l && hs(e, Lo * c, i);
6617
+ let v = hs(_, Ro, i), y = d.width + (l ? zo * i : 0) + s.width, b = Math.max(d.height, s.height), { width: S, height: C } = q({
6618
+ contentWidth: y / i,
6619
+ contentHeight: b / i,
6620
+ styles: [T.visualStyle, ...N === void 0 ? [] : [N.from, N.to]]
6621
+ }), D = Math.max(y, (S - 48) * i), k = Math.max(b, (C - 48) * i), A = -n.width / 2, j = n.width / 2, I = n.height / 2, L = -n.height / 2, z, B;
6622
+ if (T.placement.basis === "background") z = 0, B = T.placement.region === "HEADER_LIKE" ? I - Bo - k / 2 : T.placement.region === "FOOTER_LIKE" ? L + Bo + k / 2 : 0;
6544
6623
  else {
6545
6624
  let e = rt({
6546
- bounds: $o(t),
6547
- bubbleWidth: k,
6548
- bubbleHeight: A,
6625
+ bounds: cs(t),
6626
+ bubbleWidth: D,
6627
+ bubbleHeight: k,
6549
6628
  direction: T.placement.direction,
6550
6629
  distance: T.distance,
6551
6630
  tailLength: T.tailLength,
@@ -6553,8 +6632,8 @@ function ss(e, t, n, r, i, a) {
6553
6632
  });
6554
6633
  z = e.x, B = e.y;
6555
6634
  }
6556
- z = es(z, j + k / 2, I - k / 2), B = es(B, R + A / 2, ee - A / 2), M = [z, B];
6557
- let V = T.placement.basis === "actor" ? ts(T.placement.direction) : null, H = T.placement.basis === "actor" ? [
6635
+ z = ls(z, A + D / 2, j - D / 2), B = ls(B, L + k / 2, I - k / 2), M = [z, B];
6636
+ let V = T.placement.basis === "actor" ? us(T.placement.direction) : null, ee = T.placement.basis === "actor" ? [
6558
6637
  T.offset.x,
6559
6638
  T.offset.y,
6560
6639
  T.offset.scalePercent
@@ -6562,66 +6641,66 @@ function ss(e, t, n, r, i, a) {
6562
6641
  0,
6563
6642
  0,
6564
6643
  100
6565
- ], U = V === null ? {
6644
+ ], H = V === null ? {
6566
6645
  x: 0,
6567
6646
  y: 0
6568
- } : Pt({
6647
+ } : Ut({
6569
6648
  style: T.visualStyle,
6570
- width: C,
6571
- height: D,
6649
+ width: S,
6650
+ height: C,
6572
6651
  tailDirection: V,
6573
6652
  tailLength: T.tailLength,
6574
- offset: H
6575
- }), te = JSON.stringify({
6576
- baseBubbleHeight: D,
6577
- baseBubbleWidth: C,
6578
- bodyOffset: H,
6653
+ offset: ee
6654
+ }), U = JSON.stringify({
6655
+ baseBubbleHeight: C,
6656
+ baseBubbleWidth: S,
6657
+ bodyOffset: ee,
6579
6658
  shapeTransition: N,
6580
6659
  tailDirection: V,
6581
6660
  tailLength: T.tailLength,
6582
6661
  visualStyle: T.visualStyle
6583
6662
  });
6584
- te !== O && (as(u, It({
6663
+ U !== O && (ms(u, Gt({
6585
6664
  style: T.visualStyle,
6586
6665
  lines: [],
6587
- width: C,
6588
- height: D,
6666
+ width: S,
6667
+ height: C,
6589
6668
  tailDirection: V,
6590
6669
  tailLength: T.tailLength,
6591
- offset: H,
6670
+ offset: ee,
6592
6671
  title: `${T.name} Bubble body`,
6593
6672
  ...N === void 0 ? {} : { shapeTransition: N }
6594
- }), o), O = te), u.setAttribute("data-bubble-style", T.visualStyle), u.setAttribute("data-bubble-body-width", String(C)), u.setAttribute("data-bubble-body-height", String(D)), N === void 0 ? (u.removeAttribute("data-bubble-shape-transition-from"), u.removeAttribute("data-bubble-shape-transition-to"), u.removeAttribute("data-bubble-shape-transition-progress")) : (u.setAttribute("data-bubble-shape-transition-from", N.from), u.setAttribute("data-bubble-shape-transition-to", N.to), u.setAttribute("data-bubble-shape-transition-progress", String(N.progress)));
6595
- let ne = z - U.x, re = B + U.y;
6596
- u.setAttribute("transform", `translate(${n.width / 2 + ne - C / 2} ${n.height / 2 - re - D / 2})`);
6597
- let ie = z - y / 2, ae = T.portrait?.placement ?? "left", oe = ae.endsWith("right"), W = (T.portrait?.offset.x ?? 0) * i, se = (T.portrait?.offset.y ?? 0) * i, ce = (oe ? ie + s.width + Ao * i : ie) + d.width / 2 + W, le = B;
6598
- ae.startsWith("top-") ? le = B + b / 2 - d.height / 2 : ae.startsWith("bottom-") && (le = B - b / 2 + d.height / 2), le += se;
6599
- let ue = (oe || !l ? ie : ie + d.width + Ao * i) + s.width / 2, de = (e, t) => `translate(${n.width / 2 + e} ${n.height / 2 - t})`;
6673
+ }), o), O = U), u.setAttribute("data-bubble-style", T.visualStyle), u.setAttribute("data-bubble-body-width", String(S)), u.setAttribute("data-bubble-body-height", String(C)), N === void 0 ? (u.removeAttribute("data-bubble-shape-transition-from"), u.removeAttribute("data-bubble-shape-transition-to"), u.removeAttribute("data-bubble-shape-transition-progress")) : (u.setAttribute("data-bubble-shape-transition-from", N.from), u.setAttribute("data-bubble-shape-transition-to", N.to), u.setAttribute("data-bubble-shape-transition-progress", String(N.progress)));
6674
+ let te = z - H.x, ne = B + H.y;
6675
+ u.setAttribute("transform", `translate(${n.width / 2 + te - S / 2} ${n.height / 2 - ne - C / 2})`);
6676
+ let re = z - y / 2, ie = T.portrait?.placement ?? "left", ae = ie.endsWith("right"), W = (T.portrait?.offset.x ?? 0) * i, oe = (T.portrait?.offset.y ?? 0) * i, se = (ae ? re + s.width + zo * i : re) + d.width / 2 + W, ce = B;
6677
+ ie.startsWith("top-") ? ce = B + b / 2 - d.height / 2 : ie.startsWith("bottom-") && (ce = B - b / 2 + d.height / 2), ce += oe;
6678
+ let le = (ae || !l ? re : re + d.width + zo * i) + s.width / 2, ue = (e, t) => `translate(${n.width / 2 + e} ${n.height / 2 - t})`;
6600
6679
  for (let e of [
6601
6680
  f,
6602
6681
  p,
6603
6682
  m
6604
- ]) e.group.setAttribute("transform", de(ce, le));
6605
- h.setAttribute("transform", `${de(ue, B)} scale(${i})`);
6606
- let fe = ue + s.width / 2 - v.width / 2 - Ao * i, pe = B - s.height / 2 + v.height / 2 + Ao * i;
6607
- _.group.setAttribute("transform", de(fe, pe));
6608
- let me = Math.min(T.portrait?.cornerRadius ?? 0, d.width / 2, d.height / 2);
6609
- w.setAttribute("x", String(-d.width / 2)), w.setAttribute("y", String(-d.height / 2)), w.setAttribute("width", String(d.width)), w.setAttribute("height", String(d.height)), w.setAttribute("rx", String(me));
6683
+ ]) e.group.setAttribute("transform", ue(se, ce));
6684
+ h.setAttribute("transform", `${ue(le, B)} scale(${i})`);
6685
+ let de = le + s.width / 2 - v.width / 2 - zo * i, fe = B - s.height / 2 + v.height / 2 + zo * i;
6686
+ _.group.setAttribute("transform", ue(de, fe));
6687
+ let pe = Math.min(T.portrait?.cornerRadius ?? 0, d.width / 2, d.height / 2);
6688
+ w.setAttribute("x", String(-d.width / 2)), w.setAttribute("y", String(-d.height / 2)), w.setAttribute("width", String(d.width)), w.setAttribute("height", String(d.height)), w.setAttribute("rx", String(pe));
6610
6689
  for (let e of [
6611
6690
  f,
6612
6691
  p,
6613
6692
  m
6614
- ]) me > 0 ? e.group.setAttribute("clip-path", `url(#${x})`) : e.group.removeAttribute("clip-path");
6615
- L(n);
6616
- }, z = t.onTargetVisualChange, B = (e) => {
6617
- z?.(e), R();
6618
- }, V = () => {
6619
- g.refresh(), R();
6693
+ ]) pe > 0 ? e.group.setAttribute("clip-path", `url(#${x})`) : e.group.removeAttribute("clip-path");
6694
+ R(n);
6695
+ }, B = t.onTargetVisualChange, V = (e) => {
6696
+ B?.(e), z();
6697
+ }, ee = () => {
6698
+ g.refresh(), z();
6620
6699
  };
6621
- return e.acquire(l), T.placement.basis === "actor" && (t.onTargetVisualChange = B), s.on?.("NativeSizeChanged", V), Object.freeze({
6700
+ return e.acquire(l), T.placement.basis === "actor" && (t.onTargetVisualChange = V), s.on?.("NativeSizeChanged", ee), Object.freeze({
6622
6701
  targets: v,
6623
6702
  setLayerVisible(e, t) {
6624
- E || (b.set(e, t), L());
6703
+ E || (b.set(e, t), R());
6625
6704
  },
6626
6705
  async updateStyle(e) {
6627
6706
  if (E) return;
@@ -6634,53 +6713,53 @@ function ss(e, t, n, r, i, a) {
6634
6713
  let r = T.placement.basis === "actor";
6635
6714
  T = e, k = [0, 0], A = 1, j = 1, N = void 0, O = "", e.reveal?.layout !== "RESERVED" && g.clearCapturedLayout();
6636
6715
  let i = T.placement.basis === "actor";
6637
- r && !i ? t.onTargetVisualChange === B && (t.onTargetVisualChange = z ?? null) : !r && i && (t.onTargetVisualChange = B), R();
6716
+ r && !i ? t.onTargetVisualChange === V && (t.onTargetVisualChange = B ?? null) : !r && i && (t.onTargetVisualChange = V), z();
6638
6717
  },
6639
6718
  captureTextLayout() {
6640
- E || (g.captureLayout(), R());
6719
+ E || (g.captureLayout(), z());
6641
6720
  },
6642
6721
  clearTextLayout() {
6643
- g.clearCapturedLayout(), R();
6722
+ g.clearCapturedLayout(), z();
6644
6723
  },
6645
6724
  renderScratchText(e) {
6646
- E || (P = e, O = "", R());
6725
+ E || (P = e, O = "", z());
6647
6726
  },
6648
6727
  async animate(e) {
6649
6728
  if (E) return;
6650
6729
  let t = Math.max(0, e.durationSeconds ?? 0), n = () => {
6651
- E || L();
6652
- }, r = (t) => wo(t, e.ease ?? "easeInOut");
6730
+ E || R();
6731
+ }, r = (t) => No(t, e.ease ?? "easeInOut");
6653
6732
  if (e.name === "fadeIn" || e.name === "floatIn" || e.name === "zoomIn" || e.name === "riseUp") {
6654
6733
  D = !0;
6655
6734
  let i = e.name === "floatIn" || e.name === "riseUp" ? [0, 16] : [0, 0], o = e.name === "zoomIn" ? .01 : 1;
6656
- k = i, A = o, j = e.name === "fadeIn" ? 0 : 1, n(), await To(a, t, (t) => {
6735
+ k = i, A = o, j = e.name === "fadeIn" ? 0 : 1, n(), await Po(a, t, (t) => {
6657
6736
  let a = r(t);
6658
6737
  k = [i[0] * (1 - a), i[1] * (1 - a)], A = o + (1 - o) * a, j = e.name === "fadeIn" ? a : 1, n();
6659
- }), k = [0, 0], A = 1, j = 1, R();
6738
+ }), k = [0, 0], A = 1, j = 1, z();
6660
6739
  return;
6661
6740
  }
6662
6741
  if (e.name === "fadeOut" || e.name === "floatOut" || e.name === "zoomOut" || e.name === "sink") {
6663
6742
  let i = e.name === "floatOut" || e.name === "sink" ? [0, -16] : [0, 0], o = e.name === "zoomOut" ? .01 : 1;
6664
- await To(a, t, (t) => {
6743
+ await Po(a, t, (t) => {
6665
6744
  let a = r(t);
6666
6745
  k = [i[0] * a, i[1] * a], A = 1 + (o - 1) * a, j = e.name === "fadeOut" ? 1 - a : 1, n();
6667
- }), D = !1, L(), k = [0, 0], A = 1, j = 1;
6746
+ }), D = !1, R(), k = [0, 0], A = 1, j = 1;
6668
6747
  return;
6669
6748
  }
6670
6749
  if (e.name === "shake") {
6671
6750
  let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .08, s = Ze(typeof e.direction == "number" ? e.direction : e.direction ?? "right");
6672
- await To(a, o, (e) => {
6751
+ await Po(a, o, (e) => {
6673
6752
  let t = Math.sin(r(e) * i * Math.PI * 2) * 5;
6674
6753
  k = [s.x * t, s.y * t], n();
6675
- }), k = [0, 0], R();
6754
+ }), k = [0, 0], z();
6676
6755
  return;
6677
6756
  }
6678
6757
  if (e.name === "explode") {
6679
6758
  let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .12, s = e.relativeScale ?? 1.15;
6680
- await To(a, o, (e) => {
6759
+ await Po(a, o, (e) => {
6681
6760
  let t = Math.abs(Math.sin(r(e) * i * Math.PI));
6682
6761
  A = 1 + (s - 1) * t, n();
6683
- }), A = 1, R();
6762
+ }), A = 1, z();
6684
6763
  return;
6685
6764
  }
6686
6765
  if (e.name === "animateBubbleShape") {
@@ -6689,21 +6768,21 @@ function ss(e, t, n, r, i, a) {
6689
6768
  from: r,
6690
6769
  to: n,
6691
6770
  progress: 0
6692
- }, R(), await To(a, t, (a) => {
6693
- let o = t === 0 ? 1 : Co(a * Math.max(i, 1));
6771
+ }, z(), await Po(a, t, (a) => {
6772
+ let o = t === 0 ? 1 : Mo(a * Math.max(i, 1));
6694
6773
  N = {
6695
6774
  from: r,
6696
6775
  to: n,
6697
- progress: wo(o, e.ease ?? "easeInOut")
6698
- }, O = "", R();
6699
- }), N = void 0, O = "", R();
6776
+ progress: No(o, e.ease ?? "easeInOut")
6777
+ }, O = "", z();
6778
+ }), N = void 0, O = "", z();
6700
6779
  }
6701
6780
  },
6702
6781
  show() {
6703
- E || (D = !0, R());
6782
+ E || (D = !0, z());
6704
6783
  },
6705
6784
  hide() {
6706
- E || (D = !1, L());
6785
+ E || (D = !1, R());
6707
6786
  },
6708
6787
  async dispose() {
6709
6788
  if (E) return;
@@ -6716,8 +6795,8 @@ function ss(e, t, n, r, i, a) {
6716
6795
  }
6717
6796
  };
6718
6797
  r(() => {
6719
- t.onTargetVisualChange === B && (t.onTargetVisualChange = z ?? null);
6720
- }), r(() => s.off?.("NativeSizeChanged", V)), r(() => e.release(l)), r(() => g.clear());
6798
+ t.onTargetVisualChange === V && (t.onTargetVisualChange = B ?? null);
6799
+ }), r(() => s.off?.("NativeSizeChanged", ee)), r(() => e.release(l)), r(() => g.clear());
6721
6800
  let i = await Promise.allSettled([...y.values()].map((e) => e.release()));
6722
6801
  if (n.push(...i.flatMap((e) => e.status === "rejected" ? [e.reason] : [])), n.length === 1) throw n[0];
6723
6802
  if (n.length > 1) throw AggregateError(n, "Failed to dispose SVG overlay Bubble surface.");
@@ -6726,17 +6805,17 @@ function ss(e, t, n, r, i, a) {
6726
6805
  }
6727
6806
  //#endregion
6728
6807
  //#region src/turbowarp-adapter.ts
6729
- var cs = "sprite", ls = 96, us = 18, ds = 8, fs = 16, ps = 0, $ = class extends Error {
6808
+ var _s = "sprite", vs = 96, ys = 18, bs = 8, xs = 16, Ss = 0, $ = class extends Error {
6730
6809
  code;
6731
6810
  constructor(e, t) {
6732
6811
  super(t), this.name = "BubbleRuntimeAdapterError", this.code = e;
6733
6812
  }
6734
6813
  };
6735
- function ms(e) {
6814
+ function Cs(e) {
6736
6815
  return typeof e == "object" && !!e && !Array.isArray(e);
6737
6816
  }
6738
- function hs(e) {
6739
- if (!ms(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp renderer.");
6817
+ function ws(e) {
6818
+ if (!Cs(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp renderer.");
6740
6819
  let t = [
6741
6820
  "createSVGSkin",
6742
6821
  "createDrawable",
@@ -6752,41 +6831,41 @@ function hs(e) {
6752
6831
  if (t.some((t) => typeof e[t] != "function")) throw new $("BUBBLE-RUNTIME-001", `Bubble renderer must provide ${t.join(", ")}.`);
6753
6832
  return e;
6754
6833
  }
6755
- function gs(e) {
6834
+ function Ts(e) {
6756
6835
  let t = e ?? "svg-overlay";
6757
6836
  if (t !== "scratch-render" && t !== "svg-overlay") throw new $("BUBBLE-RUNTIME-004", "Bubble bubbleRenderBackend must be scratch-render or svg-overlay.");
6758
6837
  return t;
6759
6838
  }
6760
- function _s(e) {
6839
+ function Es(e) {
6761
6840
  let t = e ?? "error";
6762
6841
  if (t !== "error" && t !== "fallback") throw new $("BUBBLE-RUNTIME-004", "Bubble svgOverlayUnsupportedBehavior must be error or fallback.");
6763
6842
  return t;
6764
6843
  }
6765
- function vs(e) {
6844
+ function Ds(e) {
6766
6845
  let t = e ?? (globalThis.document === void 0 ? void 0 : globalThis.document);
6767
6846
  if (t !== void 0) {
6768
- if (!ms(t) || typeof t.createElementNS != "function") throw new $("BUBBLE-RUNTIME-004", "Bubble SVG overlay document must provide createElementNS().");
6847
+ if (!Cs(t) || typeof t.createElementNS != "function") throw new $("BUBBLE-RUNTIME-004", "Bubble SVG overlay document must provide createElementNS().");
6769
6848
  return t;
6770
6849
  }
6771
6850
  }
6772
- function ys(e, t, n) {
6851
+ function Os(e, t, n) {
6773
6852
  if (typeof e.addOverlay != "function" || typeof e.removeOverlay != "function") return "the renderer does not provide addOverlay() and removeOverlay()";
6774
6853
  if (t === void 0) return "the host does not provide a DOM document";
6775
6854
  if (typeof t.defaultView?.DOMParser != "function") return "the host document does not provide DOMParser";
6776
- if (!ms(n) || typeof n.layoutText != "function") return "a host-neutral svgOverlayTextCapability is not available";
6855
+ if (!Cs(n) || typeof n.layoutText != "function") return "a host-neutral svgOverlayTextCapability is not available";
6777
6856
  }
6778
- function bs() {
6857
+ function ks() {
6779
6858
  let e = Be(), t = /* @__PURE__ */ new Set(), n = (n) => {
6780
6859
  e.defineStyle({
6781
6860
  name: n,
6782
6861
  backgroundColor: "transparent"
6783
6862
  }), t.add(n);
6784
6863
  };
6785
- return n("default"), ho(Object.freeze({ layoutText(r) {
6864
+ return n("default"), wo(Object.freeze({ layoutText(r) {
6786
6865
  return t.has(r.styleName) || n(r.styleName), e.layoutText(r);
6787
6866
  } }));
6788
6867
  }
6789
- function xs(e) {
6868
+ function As(e) {
6790
6869
  let t = Ve({ runtime: e }), n = /* @__PURE__ */ new Set(), r = (e) => {
6791
6870
  t.defineStyle({
6792
6871
  name: e,
@@ -6795,7 +6874,7 @@ function xs(e) {
6795
6874
  }, i = (e) => {
6796
6875
  n.has(e) || r(e);
6797
6876
  };
6798
- return r("default"), mo(Object.freeze({
6877
+ return r("default"), Co(Object.freeze({
6799
6878
  setText(e) {
6800
6879
  i(e.styleName), t.setText(e);
6801
6880
  },
@@ -6807,17 +6886,17 @@ function xs(e) {
6807
6886
  }
6808
6887
  }));
6809
6888
  }
6810
- function Ss(e) {
6811
- if (!ms(e) || typeof e.isLoaded != "function" || typeof e.getAssetMimeType != "function" || typeof e.resolveSkin != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-cache or provide options.imageResolver before using image features.");
6889
+ function js(e) {
6890
+ if (!Cs(e) || typeof e.isLoaded != "function" || typeof e.getAssetMimeType != "function" || typeof e.resolveSkin != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-cache or provide options.imageResolver before using image features.");
6812
6891
  return e;
6813
6892
  }
6814
- function Cs(e) {
6815
- if (!ms(e) || typeof e.getDOMImageCapability != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble SVG overlay image assets require @kubohiroya/turbowarp-asset-cache 0.1.0 or a host-provided options.svgOverlayImageCapability.");
6893
+ function Ms(e) {
6894
+ if (!Cs(e) || typeof e.getDOMImageCapability != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble SVG overlay image assets require @kubohiroya/turbowarp-asset-cache 0.1.0 or a host-provided options.svgOverlayImageCapability.");
6816
6895
  let t = e.getDOMImageCapability();
6817
- if (!ms(t) || typeof t.isRegistered != "function" || typeof t.getMimeType != "function" || typeof t.resolveDOMImageResource != "function") throw new $("BUBBLE-RUNTIME-002", "Asset Manager did not provide a valid DOM image capability.");
6896
+ if (!Cs(t) || typeof t.isRegistered != "function" || typeof t.getMimeType != "function" || typeof t.resolveDOMImageResource != "function") throw new $("BUBBLE-RUNTIME-002", "Asset Manager did not provide a valid DOM image capability.");
6818
6897
  return t;
6819
6898
  }
6820
- function ws(e) {
6899
+ function Ns(e) {
6821
6900
  try {
6822
6901
  let t = e.getBoundsForBubble?.();
6823
6902
  if (t && [
@@ -6835,7 +6914,7 @@ function ws(e) {
6835
6914
  top: n
6836
6915
  };
6837
6916
  }
6838
- function Ts(e, t, n) {
6917
+ function Ps(e, t, n) {
6839
6918
  let r = e.getCurrentSkinSize(t.drawableID);
6840
6919
  if (!Array.isArray(r) || r.length < 2) return n;
6841
6920
  let i = Number(r[0]), a = Number(r[1]);
@@ -6844,8 +6923,8 @@ function Ts(e, t, n) {
6844
6923
  height: a
6845
6924
  };
6846
6925
  }
6847
- function Es(e, t, n, r = 1) {
6848
- let i = Ts(e, t, {
6926
+ function Fs(e, t, n, r = 1) {
6927
+ let i = Ps(e, t, {
6849
6928
  width: n,
6850
6929
  height: n
6851
6930
  }), a = Math.min(n / i.width, n / i.height) * r;
@@ -6855,35 +6934,35 @@ function Es(e, t, n, r = 1) {
6855
6934
  scalePercent: a * 100
6856
6935
  };
6857
6936
  }
6858
- function Ds(e, t, n) {
6937
+ function Is(e, t, n) {
6859
6938
  let r = Math.min(n, e / 2, t / 2), i = e - r, a = t - r;
6860
6939
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}" viewBox="0 0 ${e} ${t}">
6861
6940
  <path d="M0 0H${e}V${t}H0Z M${r} 0H${i}A${r} ${r} 0 0 1 ${e} ${r}V${a}A${r} ${r} 0 0 1 ${i} ${t}H${r}A${r} ${r} 0 0 1 0 ${a}V${r}A${r} ${r} 0 0 1 ${r} 0Z" fill="#fff4cc" fill-rule="evenodd" data-bubble-portrait-corner-radius="${r}"/>
6862
6941
  </svg>`;
6863
6942
  }
6864
- function Os(e, t, n) {
6943
+ function Ls(e, t, n) {
6865
6944
  return n < t ? (t + n) / 2 : Math.min(n, Math.max(t, e));
6866
6945
  }
6867
- function ks(e, t, n, r, i) {
6946
+ function Rs(e, t, n, r, i) {
6868
6947
  let a = t + r * 2, o = n + i * 2;
6869
6948
  return e.replace(/<svg\b[^>]*>/u, (e) => e.replace(/\bwidth="[^"]*"/u, `width="${a}"`).replace(/\bheight="[^"]*"/u, `height="${o}"`).replace(/\bviewBox="[^"]*"/u, `viewBox="${-r} ${-i} ${a} ${o}"`));
6870
6949
  }
6871
- function As(e) {
6950
+ function zs(e) {
6872
6951
  let t = Ze(e);
6873
6952
  return (Math.atan2(-t.x, -t.y) * 180 / Math.PI % 360 + 360) % 360;
6874
6953
  }
6875
- function js(e, t, n, r, i, a) {
6876
- let o = e.renderer, s = ps;
6877
- ps += 1;
6954
+ function Bs(e, t, n, r, i, a) {
6955
+ let o = e.renderer, s = Ss;
6956
+ Ss += 1;
6878
6957
  let c = [], l, u, d = (e) => {
6879
- let t = o.createDrawable(cs);
6958
+ let t = o.createDrawable(_s);
6880
6959
  if (!Number.isInteger(t) || t < 0) throw new $("BUBBLE-RUNTIME-001", `TurboWarp did not create the Bubble ${e} drawable.`);
6881
6960
  let r = Object.freeze({
6882
6961
  id: `bubble:${n}:${s}:${e}`,
6883
6962
  isStage: !1,
6884
6963
  drawableID: t
6885
6964
  });
6886
- return c.push(r), o.updateDrawableVisible(t, !1), o.setDrawableOrder?.(t, Infinity, cs), r;
6965
+ return c.push(r), o.updateDrawableVisible(t, !1), o.setDrawableOrder?.(t, Infinity, _s), r;
6887
6966
  };
6888
6967
  try {
6889
6968
  let n = d("body"), s = i.portrait ? d("portrait-base") : void 0, f = i.portrait?.blink ? d("portrait-blink") : void 0, p = i.portrait?.lipSync ? d("portrait-lip-sync") : void 0, m = i.portrait ? d("portrait-corner-mask") : void 0, h = d("text"), g = i.continueIndicator ? d("continue-indicator") : void 0, _ = Object.freeze({
@@ -6909,8 +6988,8 @@ function js(e, t, n, r, i, a) {
6909
6988
  }, I = () => {
6910
6989
  if (x) return;
6911
6990
  if (w.layoutProfile === "scratch-default" && M !== void 0) {
6912
- let e = o.getNativeSize(), i = Array.isArray(e) && Number(e[0]) > 0 ? Number(e[0]) : 480, a = Array.isArray(e) && Number(e[1]) > 0 ? Number(e[1]) : 360, s = xa(M), c = Sa({
6913
- bounds: ws(t),
6991
+ let e = o.getNativeSize(), i = Array.isArray(e) && Number(e[0]) > 0 ? Number(e[0]) : 480, a = Array.isArray(e) && Number(e[1]) > 0 ? Number(e[1]) : 360, s = Aa(M), c = ja({
6992
+ bounds: Ns(t),
6914
6993
  height: s.height,
6915
6994
  pointsLeft: N,
6916
6995
  stageHeight: a,
@@ -6924,7 +7003,7 @@ function js(e, t, n, r, i, a) {
6924
7003
  pointsLeft: N
6925
7004
  });
6926
7005
  if (u !== S) {
6927
- let e = o.createSVGSkin(Da({
7006
+ let e = o.createSVGSkin(Ia({
6928
7007
  kind: r,
6929
7008
  layout: M,
6930
7009
  pointsLeft: N,
@@ -6942,7 +7021,7 @@ function js(e, t, n, r, i, a) {
6942
7021
  o.updateDrawableScale(n.drawableID, [100, 100]), o.updateDrawablePosition(n.drawableID, [c.centerX, c.centerY]), E.set(n.drawableID, [c.centerX, c.centerY]), D.set(n.drawableID, [100, 100]), F();
6943
7022
  return;
6944
7023
  }
6945
- let e = w.placement.basis === "actor" ? w.offset.scalePercent / 100 : 1, i = T ?? Ts(o, h, {
7024
+ let e = w.placement.basis === "actor" ? w.offset.scalePercent / 100 : 1, i = T ?? Ps(o, h, {
6946
7025
  width: 180,
6947
7026
  height: 48
6948
7027
  });
@@ -6950,36 +7029,40 @@ function js(e, t, n, r, i, a) {
6950
7029
  let a = {
6951
7030
  width: i.width * e,
6952
7031
  height: i.height * e
6953
- }, c = ls * ((w.portrait?.offset.zoomPercent ?? 100) / 100), d = s !== void 0 && w.portrait !== void 0, _ = d ? Es(o, s, c, e) : {
7032
+ }, c = vs * ((w.portrait?.offset.zoomPercent ?? 100) / 100), d = s !== void 0 && w.portrait !== void 0, _ = d ? Fs(o, s, c, e) : {
6954
7033
  width: 0,
6955
7034
  height: 0,
6956
7035
  scalePercent: 0
6957
7036
  }, v = /* @__PURE__ */ new Map();
6958
7037
  d && v.set(s.drawableID, _.scalePercent);
6959
7038
  for (let t of [f, p]) if (t && d) {
6960
- let n = Es(o, t, c, e);
7039
+ let n = Fs(o, t, c, e);
6961
7040
  v.set(t.drawableID, n.scalePercent);
6962
7041
  }
6963
- let y = g ? Es(o, g, us, e) : {
7042
+ let y = g ? Fs(o, g, ys, e) : {
6964
7043
  width: 0,
6965
7044
  height: 0,
6966
7045
  scalePercent: 0
6967
- }, b = _.width + (d ? ds * e : 0) + a.width, O = Math.max(_.height, a.height), k = pt(w.visualStyle, ...j === void 0 ? [] : [j.from, j.to]), A = Math.max(b / e + 48, k.width), I = Math.max(O / e + 48, k.height), ee = Math.max(b, (A - 48) * e), L = Math.max(O, (I - 48) * e), R = o.getNativeSize(), z = Array.isArray(R) && Number(R[0]) > 0 ? Number(R[0]) : 480, B = Array.isArray(R) && Number(R[1]) > 0 ? Number(R[1]) : 360, V = -z / 2, H = z / 2, U = B / 2, te = -B / 2, ne = V + ee / 2, re = H - ee / 2, ie = te + L / 2, ae = U - L / 2, oe, W;
6968
- if (w.placement.basis === "background") oe = 0, W = w.placement.region === "HEADER_LIKE" ? U - fs - L / 2 : w.placement.region === "FOOTER_LIKE" ? te + fs + L / 2 : 0;
7046
+ }, b = _.width + (d ? bs * e : 0) + a.width, O = Math.max(_.height, a.height), { width: k, height: A } = q({
7047
+ contentWidth: b / e,
7048
+ contentHeight: O / e,
7049
+ styles: [w.visualStyle, ...j === void 0 ? [] : [j.from, j.to]]
7050
+ }), I = Math.max(b, (k - 48) * e), L = Math.max(O, (A - 48) * e), R = o.getNativeSize(), z = Array.isArray(R) && Number(R[0]) > 0 ? Number(R[0]) : 480, B = Array.isArray(R) && Number(R[1]) > 0 ? Number(R[1]) : 360, V = -z / 2, ee = z / 2, H = B / 2, U = -B / 2, te = V + I / 2, ne = ee - I / 2, re = U + L / 2, ie = H - L / 2, ae, W;
7051
+ if (w.placement.basis === "background") ae = 0, W = w.placement.region === "HEADER_LIKE" ? H - xs - L / 2 : w.placement.region === "FOOTER_LIKE" ? U + xs + L / 2 : 0;
6969
7052
  else {
6970
7053
  let e = rt({
6971
- bounds: ws(t),
6972
- bubbleWidth: ee,
7054
+ bounds: Ns(t),
7055
+ bubbleWidth: I,
6973
7056
  bubbleHeight: L,
6974
7057
  direction: w.placement.direction,
6975
7058
  distance: w.distance,
6976
7059
  tailLength: w.tailLength,
6977
7060
  offset: w.offset
6978
7061
  });
6979
- oe = e.x, W = e.y;
7062
+ ae = e.x, W = e.y;
6980
7063
  }
6981
- oe = Os(oe, ne, re), W = Os(W, ie, ae);
6982
- let se = w.placement.basis === "actor" ? As(w.placement.direction) : null, ce = w.placement.basis === "actor" ? [
7064
+ ae = Ls(ae, te, ne), W = Ls(W, re, ie);
7065
+ let oe = w.placement.basis === "actor" ? zs(w.placement.direction) : null, se = w.placement.basis === "actor" ? [
6983
7066
  w.offset.x,
6984
7067
  w.offset.y,
6985
7068
  w.offset.scalePercent
@@ -6987,39 +7070,39 @@ function js(e, t, n, r, i, a) {
6987
7070
  0,
6988
7071
  0,
6989
7072
  100
6990
- ], le = se === null ? {
7073
+ ], ce = oe === null ? {
6991
7074
  x: 0,
6992
7075
  y: 0
6993
- } : Pt({
7076
+ } : Ut({
6994
7077
  style: w.visualStyle,
6995
- width: A,
6996
- height: I,
6997
- tailDirection: se,
7078
+ width: k,
7079
+ height: A,
7080
+ tailDirection: oe,
6998
7081
  tailLength: w.tailLength,
6999
- offset: ce
7000
- }), ue = Math.abs(ce[0]) + A * Math.abs(e - 1) + Math.max(0, w.tailLength - 18) + 8, de = Math.abs(ce[1]) + I * Math.abs(e - 1) + Math.max(0, w.tailLength - 18) + 8, fe = JSON.stringify({
7001
- baseBubbleHeight: I,
7002
- baseBubbleWidth: A,
7003
- bodyOffset: ce,
7004
- tailDirection: se,
7082
+ offset: se
7083
+ }), le = Math.abs(se[0]) + k * Math.abs(e - 1) + Math.max(0, w.tailLength - 18) + 8, ue = Math.abs(se[1]) + A * Math.abs(e - 1) + Math.max(0, w.tailLength - 18) + 8, de = JSON.stringify({
7084
+ baseBubbleHeight: A,
7085
+ baseBubbleWidth: k,
7086
+ bodyOffset: se,
7087
+ tailDirection: oe,
7005
7088
  tailLength: w.tailLength,
7006
- viewportExtraX: ue,
7007
- viewportExtraY: de,
7089
+ viewportExtraX: le,
7090
+ viewportExtraY: ue,
7008
7091
  visualStyle: w.visualStyle,
7009
7092
  shapeTransition: j
7010
7093
  });
7011
- if (fe !== S) {
7012
- let e = ks(It({
7094
+ if (de !== S) {
7095
+ let e = Rs(Gt({
7013
7096
  style: w.visualStyle,
7014
7097
  lines: [],
7015
- width: A,
7016
- height: I,
7017
- tailDirection: se,
7098
+ width: k,
7099
+ height: A,
7100
+ tailDirection: oe,
7018
7101
  tailLength: w.tailLength,
7019
- offset: ce,
7102
+ offset: se,
7020
7103
  title: `${w.name} Bubble body`,
7021
7104
  ...j === void 0 ? {} : { shapeTransition: j }
7022
- }), A, I, ue, de), t = o.createSVGSkin(e);
7105
+ }), k, A, le, ue), t = o.createSVGSkin(e);
7023
7106
  if (!Number.isInteger(t) || t < 0) throw new $("BUBBLE-RUNTIME-001", "TurboWarp did not create the Bubble body SVG skin.");
7024
7107
  try {
7025
7108
  o.updateDrawableSkinId(n.drawableID, t);
@@ -7027,17 +7110,17 @@ function js(e, t, n, r, i, a) {
7027
7110
  throw o.destroySkin(t), e;
7028
7111
  }
7029
7112
  let r = l;
7030
- l = t, S = fe, r !== void 0 && o.destroySkin(r);
7113
+ l = t, S = de, r !== void 0 && o.destroySkin(r);
7031
7114
  }
7032
- o.updateDrawableScale(n.drawableID, [100, 100]), o.updateDrawablePosition(n.drawableID, [oe - le.x, W + le.y]);
7033
- let pe = oe - b / 2, me = w.portrait?.placement ?? "left", he = me.endsWith("right"), ge = (w.portrait?.offset.x ?? 0) * e, _e = (w.portrait?.offset.y ?? 0) * e, ve = (he ? pe + a.width + ds * e : pe) + _.width / 2 + ge, ye = W;
7034
- me.startsWith("top-") ? ye = W + O / 2 - _.height / 2 : me.startsWith("bottom-") && (ye = W - O / 2 + _.height / 2), ye += _e;
7035
- let be = (he || !d ? pe : pe + _.width + ds * e) + a.width / 2;
7115
+ o.updateDrawableScale(n.drawableID, [100, 100]), o.updateDrawablePosition(n.drawableID, [ae - ce.x, W + ce.y]);
7116
+ let fe = ae - b / 2, pe = w.portrait?.placement ?? "left", me = pe.endsWith("right"), he = (w.portrait?.offset.x ?? 0) * e, ge = (w.portrait?.offset.y ?? 0) * e, _e = (me ? fe + a.width + bs * e : fe) + _.width / 2 + he, ve = W;
7117
+ pe.startsWith("top-") ? ve = W + O / 2 - _.height / 2 : pe.startsWith("bottom-") && (ve = W - O / 2 + _.height / 2), ve += ge;
7118
+ let ye = (me || !d ? fe : fe + _.width + bs * e) + a.width / 2;
7036
7119
  for (let e of [
7037
7120
  s,
7038
7121
  f,
7039
7122
  p
7040
- ]) e && o.updateDrawablePosition(e.drawableID, [ve, ye]);
7123
+ ]) e && o.updateDrawablePosition(e.drawableID, [_e, ve]);
7041
7124
  if (m) {
7042
7125
  let t = _.width / e, n = _.height / e, r = Math.min(w.portrait?.cornerRadius ?? 0, t / 2, n / 2), i = r > 0 ? JSON.stringify({
7043
7126
  maskHeight: n,
@@ -7047,7 +7130,7 @@ function js(e, t, n, r, i, a) {
7047
7130
  if (i !== C) {
7048
7131
  let e = u;
7049
7132
  if (u = void 0, C = i, r > 0) {
7050
- let e = o.createSVGSkin(Ds(t, n, r));
7133
+ let e = o.createSVGSkin(Is(t, n, r));
7051
7134
  if (!Number.isInteger(e) || e < 0) throw new $("BUBBLE-RUNTIME-001", "TurboWarp did not create the Bubble portrait corner mask SVG skin.");
7052
7135
  try {
7053
7136
  o.updateDrawableSkinId(m.drawableID, e), u = e;
@@ -7057,13 +7140,13 @@ function js(e, t, n, r, i, a) {
7057
7140
  }
7058
7141
  e !== void 0 && o.destroySkin(e);
7059
7142
  }
7060
- o.updateDrawablePosition(m.drawableID, [ve, ye]);
7143
+ o.updateDrawablePosition(m.drawableID, [_e, ve]);
7061
7144
  }
7062
- o.updateDrawablePosition(h.drawableID, [be, W]), g && o.updateDrawablePosition(g.drawableID, [be + a.width / 2 - y.width / 2 - ds * e, W - a.height / 2 + y.height / 2 + ds * e]);
7063
- let xe = (e, t) => {
7145
+ o.updateDrawablePosition(h.drawableID, [ye, W]), g && o.updateDrawablePosition(g.drawableID, [ye + a.width / 2 - y.width / 2 - bs * e, W - a.height / 2 + y.height / 2 + bs * e]);
7146
+ let be = (e, t) => {
7064
7147
  e && E.set(e.drawableID, t);
7065
7148
  };
7066
- xe(n, [oe - le.x, W + le.y]), xe(h, [be, W]), xe(s, [ve, ye]), xe(f, [ve, ye]), xe(p, [ve, ye]), xe(m, [ve, ye]), D.set(n.drawableID, [100, 100]), D.set(h.drawableID, [e * 100, e * 100]);
7149
+ be(n, [ae - ce.x, W + ce.y]), be(h, [ye, W]), be(s, [_e, ve]), be(f, [_e, ve]), be(p, [_e, ve]), be(m, [_e, ve]), D.set(n.drawableID, [100, 100]), D.set(h.drawableID, [e * 100, e * 100]);
7067
7150
  for (let e of [
7068
7151
  s,
7069
7152
  f,
@@ -7073,11 +7156,11 @@ function js(e, t, n, r, i, a) {
7073
7156
  let t = v.get(e.drawableID) ?? 0;
7074
7157
  D.set(e.drawableID, [t, t]);
7075
7158
  }
7076
- m && D.set(m.drawableID, [e * 100, e * 100]), g && D.set(g.drawableID, [y.scalePercent, y.scalePercent]), g && xe(g, [be + a.width / 2 - y.width / 2 - ds * e, W - a.height / 2 + y.height / 2 + ds * e]), P(), F();
7077
- }, ee = t.onTargetVisualChange, L = (e) => {
7078
- ee?.(e), I();
7079
- }, R = () => I();
7080
- return w.placement.basis === "actor" && (t.onTargetVisualChange = L), o.on?.("NativeSizeChanged", R), Object.freeze({
7159
+ m && D.set(m.drawableID, [e * 100, e * 100]), g && D.set(g.drawableID, [y.scalePercent, y.scalePercent]), g && be(g, [ye + a.width / 2 - y.width / 2 - bs * e, W - a.height / 2 + y.height / 2 + bs * e]), P(), F();
7160
+ }, L = t.onTargetVisualChange, R = (e) => {
7161
+ L?.(e), I();
7162
+ }, z = () => I();
7163
+ return w.placement.basis === "actor" && (t.onTargetVisualChange = R), o.on?.("NativeSizeChanged", z), Object.freeze({
7081
7164
  targets: _,
7082
7165
  setLayerVisible(e, t) {
7083
7166
  x || (y.set(e, t), F());
@@ -7087,10 +7170,10 @@ function js(e, t, n, r, i, a) {
7087
7170
  let n = w.placement.basis === "actor";
7088
7171
  w = e, O = [0, 0], k = 1, A = 1, j = void 0, e.reveal?.layout !== "RESERVED" && (T = void 0);
7089
7172
  let r = w.placement.basis === "actor";
7090
- n && !r ? t.onTargetVisualChange === L && (t.onTargetVisualChange = ee ?? null) : !n && r && (t.onTargetVisualChange = L), I();
7173
+ n && !r ? t.onTargetVisualChange === R && (t.onTargetVisualChange = L ?? null) : !n && r && (t.onTargetVisualChange = R), I();
7091
7174
  },
7092
7175
  captureTextLayout() {
7093
- x || (T = Ts(o, h, {
7176
+ x || (T = Ps(o, h, {
7094
7177
  width: 180,
7095
7178
  height: 48
7096
7179
  }), I());
@@ -7105,11 +7188,11 @@ function js(e, t, n, r, i, a) {
7105
7188
  if (x) return;
7106
7189
  let t = Math.max(0, e.durationSeconds ?? 0), n = () => {
7107
7190
  x || (P(), F());
7108
- }, r = (t) => wo(t, e.ease ?? "easeInOut");
7191
+ }, r = (t) => No(t, e.ease ?? "easeInOut");
7109
7192
  if (e.name === "fadeIn" || e.name === "floatIn" || e.name === "zoomIn" || e.name === "riseUp") {
7110
7193
  b = !0;
7111
7194
  let i = e.name === "floatIn" || e.name === "riseUp" ? [0, 16] : [0, 0], o = e.name === "zoomIn" ? .01 : 1;
7112
- O = i, k = o, A = e.name === "fadeIn" ? 0 : 1, n(), await To(a, t, (t) => {
7195
+ O = i, k = o, A = e.name === "fadeIn" ? 0 : 1, n(), await Po(a, t, (t) => {
7113
7196
  let a = r(t);
7114
7197
  O = [i[0] * (1 - a), i[1] * (1 - a)], k = o + (1 - o) * a, A = e.name === "fadeIn" ? a : 1, n();
7115
7198
  }), O = [0, 0], k = 1, A = 1, I();
@@ -7117,7 +7200,7 @@ function js(e, t, n, r, i, a) {
7117
7200
  }
7118
7201
  if (e.name === "fadeOut" || e.name === "floatOut" || e.name === "zoomOut" || e.name === "sink") {
7119
7202
  let i = e.name === "floatOut" || e.name === "sink" ? [0, -16] : [0, 0], o = e.name === "zoomOut" ? .01 : 1;
7120
- O = [0, 0], k = 1, A = 1, n(), await To(a, t, (t) => {
7203
+ O = [0, 0], k = 1, A = 1, n(), await Po(a, t, (t) => {
7121
7204
  let a = r(t);
7122
7205
  O = [i[0] * a, i[1] * a], k = 1 + (o - 1) * a, A = e.name === "fadeOut" ? 1 - a : 1, n();
7123
7206
  }), O = i, k = o, A = e.name === "fadeOut" ? 0 : 1, n(), b = !1, F(), O = [0, 0], k = 1, A = 1;
@@ -7125,7 +7208,7 @@ function js(e, t, n, r, i, a) {
7125
7208
  }
7126
7209
  if (e.name === "shake") {
7127
7210
  let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .08, s = Ze(typeof e.direction == "number" ? e.direction : e.direction ?? "right") ?? Ze("right");
7128
- O = [0, 0], await To(a, o, (e) => {
7211
+ O = [0, 0], await Po(a, o, (e) => {
7129
7212
  let t = r(e) * i * Math.PI * 2, a = Math.sin(t) * 5;
7130
7213
  O = [s.x * a, s.y * a], n();
7131
7214
  }), O = [0, 0], I();
@@ -7133,7 +7216,7 @@ function js(e, t, n, r, i, a) {
7133
7216
  }
7134
7217
  if (e.name === "explode") {
7135
7218
  let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .12, s = e.relativeScale ?? 1.15;
7136
- await To(a, o, (e) => {
7219
+ await Po(a, o, (e) => {
7137
7220
  let t = r(e), a = Math.abs(Math.sin(t * i * Math.PI));
7138
7221
  k = 1 + (s - 1) * a, n();
7139
7222
  }), k = 1, I();
@@ -7145,12 +7228,12 @@ function js(e, t, n, r, i, a) {
7145
7228
  from: r,
7146
7229
  to: n,
7147
7230
  progress: 0
7148
- }, I(), await To(a, t, (a) => {
7149
- let o = t === 0 ? 1 : Co(a * Math.max(i, 1) / 1);
7231
+ }, I(), await Po(a, t, (a) => {
7232
+ let o = t === 0 ? 1 : Mo(a * Math.max(i, 1) / 1);
7150
7233
  j = {
7151
7234
  from: r,
7152
7235
  to: n,
7153
- progress: wo(o, e.ease ?? "easeInOut")
7236
+ progress: No(o, e.ease ?? "easeInOut")
7154
7237
  }, I();
7155
7238
  }), j = void 0, I();
7156
7239
  return;
@@ -7164,49 +7247,49 @@ function js(e, t, n, r, i, a) {
7164
7247
  },
7165
7248
  dispose() {
7166
7249
  if (!x) {
7167
- x = !0, o.off?.("NativeSizeChanged", R), w.placement.basis === "actor" && t.onTargetVisualChange === L && (t.onTargetVisualChange = ee ?? null);
7168
- for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID, cs);
7250
+ x = !0, o.off?.("NativeSizeChanged", z), w.placement.basis === "actor" && t.onTargetVisualChange === R && (t.onTargetVisualChange = L ?? null);
7251
+ for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID, _s);
7169
7252
  l !== void 0 && (o.destroySkin(l), l = void 0), u !== void 0 && (o.destroySkin(u), u = void 0), e.requestRedraw?.();
7170
7253
  }
7171
7254
  }
7172
7255
  });
7173
7256
  } catch (e) {
7174
- for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID, cs);
7257
+ for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID, _s);
7175
7258
  throw l !== void 0 && o.destroySkin(l), u !== void 0 && o.destroySkin(u), e;
7176
7259
  }
7177
7260
  }
7178
- function Ms(e, t = {}) {
7179
- if (!ms(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp runtime.");
7180
- let n = e, r = hs(n.renderer), i = gs(t.bubbleRenderBackend), a, o;
7261
+ function Vs(e, t = {}) {
7262
+ if (!Cs(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp runtime.");
7263
+ let n = e, r = ws(n.renderer), i = Ts(t.bubbleRenderBackend), a, o;
7181
7264
  if (i === "svg-overlay") {
7182
7265
  if (t.svgOverlayTextCapability !== void 0) a = t.svgOverlayTextCapability;
7183
- else if (n.ext_kubohiroyasvgtext === void 0) a = bs();
7266
+ else if (n.ext_kubohiroyasvgtext === void 0) a = ks();
7184
7267
  else try {
7185
- a = go(n.ext_kubohiroyasvgtext);
7268
+ a = To(n.ext_kubohiroyasvgtext);
7186
7269
  } catch (e) {
7187
7270
  o = e instanceof Error ? e.message : String(e);
7188
7271
  }
7189
7272
  }
7190
- let s = _s(t.svgOverlayUnsupportedBehavior), c = i === "svg-overlay" ? vs(t.document) : void 0, l = i === "svg-overlay" ? o ?? ys(r, c, a) : void 0;
7273
+ let s = Es(t.svgOverlayUnsupportedBehavior), c = i === "svg-overlay" ? Ds(t.document) : void 0, l = i === "svg-overlay" ? o ?? Os(r, c, a) : void 0;
7191
7274
  if (i === "svg-overlay" && l !== void 0 && s === "error") throw new $("BUBBLE-RUNTIME-004", `Bubble SVG overlay backend is unavailable because ${l}. Use scratch-render or install the required public upstream capability.`);
7192
7275
  let u = i === "svg-overlay" && l === void 0 ? "svg-overlay" : "scratch-render", d = t.scheduler ?? {
7193
7276
  setTimeout: (e, t) => globalThis.setTimeout(e, t),
7194
7277
  clearTimeout: (e) => globalThis.clearTimeout(e)
7195
- }, f = () => n.ext_kubohiroyaassetcache ?? n.ext_kubohiroyaassetmanager, p = () => Ss(f()), m, h = () => (m ??= Cs(f()), m), g;
7278
+ }, f = () => n.ext_kubohiroyaassetcache ?? n.ext_kubohiroyaassetmanager, p = () => js(f()), m, h = () => (m ??= Ms(f()), m), g;
7196
7279
  if (u === "svg-overlay") try {
7197
- g = Ko(a, r);
7280
+ g = ts(a, r);
7198
7281
  } catch (e) {
7199
7282
  throw new $("BUBBLE-RUNTIME-004", `Bubble SVG overlay text capability is invalid: ${e instanceof Error ? e.message : String(e)}`);
7200
7283
  }
7201
7284
  else if (t.textCapability !== void 0) g = t.textCapability;
7202
7285
  else try {
7203
- g = n.ext_kubohiroyasvgtext === void 0 ? xs(n) : po(n.ext_kubohiroyasvgtext);
7286
+ g = n.ext_kubohiroyasvgtext === void 0 ? As(n) : So(n.ext_kubohiroyasvgtext);
7204
7287
  } catch (e) {
7205
7288
  throw new $("BUBBLE-RUNTIME-003", `Bubble could not initialize the scratch-render text provider: ${e instanceof Error ? e.message : String(e)}`);
7206
7289
  }
7207
7290
  let _;
7208
7291
  if (u === "svg-overlay") try {
7209
- _ = Zo(t.svgOverlayImageCapability ?? So(Object.freeze({
7292
+ _ = os(t.svgOverlayImageCapability ?? jo(Object.freeze({
7210
7293
  isRegistered(e) {
7211
7294
  return h().isRegistered(e);
7212
7295
  },
@@ -7231,7 +7314,7 @@ function Ms(e, t = {}) {
7231
7314
  let i = t.drawableID;
7232
7315
  if (!Number.isInteger(i) || i < 0) throw new $("BUBBLE-RUNTIME-001", "Bubble image target drawable is invalid.");
7233
7316
  let a = await p().resolveSkin(e);
7234
- if (!ms(a) || !Number.isInteger(a.skinId) || a.skinId < 0) throw new $("BUBBLE-RUNTIME-002", `Asset Manager did not resolve an image skin: ${String(e)}`);
7317
+ if (!Cs(a) || !Number.isInteger(a.skinId) || a.skinId < 0) throw new $("BUBBLE-RUNTIME-002", `Asset Manager did not resolve an image skin: ${String(e)}`);
7235
7318
  r.updateDrawableSkinId(i, a.skinId), n.requestRedraw?.();
7236
7319
  }
7237
7320
  };
@@ -7247,18 +7330,18 @@ function Ms(e, t = {}) {
7247
7330
  if (typeof r != "function") throw new $("BUBBLE-RUNTIME-002", "TurboWarp-Asset-Manager does not provide audio playback.");
7248
7331
  await r.call(n, { NAME: e });
7249
7332
  }
7250
- }, y = u === "svg-overlay" ? Qo(r, c) : void 0;
7251
- return ao({
7333
+ }, y = u === "svg-overlay" ? ss(r, c) : void 0;
7334
+ return ho({
7252
7335
  ..._ === void 0 ? {} : { imageResolver: _ },
7253
7336
  audio: v,
7254
7337
  textCapability: g,
7255
7338
  createSurface({ actor: e, actorKey: t, kind: r, style: i }) {
7256
- if (!ms(e) || typeof e.id != "string") throw new $("BUBBLE-RUNTIME-001", "Bubble actor target is invalid.");
7257
- return u === "svg-overlay" ? ss(y, e, t, r, i, d) : js(n, e, t, r, i, d);
7339
+ if (!Cs(e) || typeof e.id != "string") throw new $("BUBBLE-RUNTIME-001", "Bubble actor target is invalid.");
7340
+ return u === "svg-overlay" ? gs(y, e, t, r, i, d) : Bs(n, e, t, r, i, d);
7258
7341
  },
7259
7342
  ...t.scheduler === void 0 ? {} : { scheduler: t.scheduler },
7260
7343
  ...t.onAnimationError === void 0 ? {} : { onAnimationError: t.onAnimationError }
7261
7344
  });
7262
7345
  }
7263
7346
  //#endregion
7264
- export { $ as BubbleRuntimeAdapterError, Fo as bubbleRenderBackends, So as createAssetManagerSvgOverlayImageCapability, Zo as createSvgOverlayImageAdapter, ss as createSvgOverlaySurface, Qo as createSvgOverlaySurfaceManager, Ko as createSvgOverlayTextAdapter, mo as createSvgTextCompositionCapability, ho as createSvgTextOverlayTextCapability, Ms as createTurboWarpBubbleComposition, po as createTurboWarpSvgTextCapability, go as createTurboWarpSvgTextOverlayTextCapability, Lo as defaultBubbleOverlayUnsupportedBehavior, Io as defaultBubbleRenderBackend };
7347
+ export { $ as BubbleRuntimeAdapterError, Wo as bubbleRenderBackends, jo as createAssetManagerSvgOverlayImageCapability, os as createSvgOverlayImageAdapter, gs as createSvgOverlaySurface, ss as createSvgOverlaySurfaceManager, ts as createSvgOverlayTextAdapter, Co as createSvgTextCompositionCapability, wo as createSvgTextOverlayTextCapability, Vs as createTurboWarpBubbleComposition, So as createTurboWarpSvgTextCapability, To as createTurboWarpSvgTextOverlayTextCapability, Ko as defaultBubbleOverlayUnsupportedBehavior, Go as defaultBubbleRenderBackend };