@kubohiroya/turbowarp-bubble 0.6.0 → 0.8.0

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.
@@ -3499,25 +3499,25 @@ var { values: xt } = U, { AK: St, AL: W, AP: Ct, AS: wt, B2: Tt, BA: Et, BB: Dt,
3499
3499
  Lt,
3500
3500
  q,
3501
3501
  on
3502
- ]), Y = Symbol("PASS"), X = Symbol("NO_BREAK"), gn = Symbol("MAY_BREAK"), _n = Symbol("MUST_BREAK");
3503
- function vn(e) {
3502
+ ]), Y = Symbol("PASS"), X = Symbol("NO_BREAK"), Z = Symbol("MAY_BREAK"), gn = Symbol("MUST_BREAK");
3503
+ function _n(e) {
3504
3504
  return e.cur.cls === -1 && e.next.cls !== -2 ? X : Y;
3505
3505
  }
3506
+ function vn(e) {
3507
+ return e.next.cls === -2 && (e.cur.len === 0 || e.cur.len !== e.prevChunk) ? gn : Y;
3508
+ }
3506
3509
  function yn(e) {
3507
- return e.next.cls === -2 && (e.cur.len === 0 || e.cur.len !== e.prevChunk) ? _n : Y;
3510
+ return e.cur.cls === Ot ? gn : Y;
3508
3511
  }
3509
3512
  function bn(e) {
3510
- return e.cur.cls === Ot ? _n : Y;
3511
- }
3512
- function xn(e) {
3513
3513
  switch (e.cur.cls) {
3514
- case Nt: return e.next.cls === Jt ? X : _n;
3514
+ case Nt: return e.next.cls === Jt ? X : gn;
3515
3515
  case Jt:
3516
- case Xt: return _n;
3516
+ case Xt: return gn;
3517
3517
  }
3518
3518
  return Y;
3519
3519
  }
3520
- function Sn(e) {
3520
+ function xn(e) {
3521
3521
  switch (e.next.cls) {
3522
3522
  case Ot:
3523
3523
  case Nt:
@@ -3526,10 +3526,10 @@ function Sn(e) {
3526
3526
  }
3527
3527
  return Y;
3528
3528
  }
3529
- function Cn(e) {
3529
+ function Sn(e) {
3530
3530
  return e.cur.cls !== en && (e.RI = 0), e.spaces ? (e.next.cls !== q && (e.spaces = !1), X) : Y;
3531
3531
  }
3532
- function wn(e) {
3532
+ function Cn(e) {
3533
3533
  if (e.next.cls === on) return X;
3534
3534
  if (e.next.cls === q) switch (e.cur.cls) {
3535
3535
  case on:
@@ -3542,25 +3542,25 @@ function wn(e) {
3542
3542
  }
3543
3543
  return Y;
3544
3544
  }
3545
- function Tn(e) {
3546
- return e.LB8 ? (e.LB8 = !1, gn) : e.cur.cls === on ? e.next.cls === q ? (e.LB8 = !0, X) : gn : Y;
3545
+ function wn(e) {
3546
+ return e.LB8 ? (e.LB8 = !1, Z) : e.cur.cls === on ? e.next.cls === q ? (e.LB8 = !0, X) : Z : Y;
3547
3547
  }
3548
- function En(e) {
3548
+ function Tn(e) {
3549
3549
  return e.cur.cls === sn ? X : Y;
3550
3550
  }
3551
- function Dn(e) {
3551
+ function En(e) {
3552
3552
  return !ln.has(e.cur.cls) && (e.next.cls === jt || e.next.cls === sn) ? (e.next.ignored = !0, X) : Y;
3553
3553
  }
3554
- function On(e) {
3554
+ function Dn(e) {
3555
3555
  return e.cur.cls === jt && (e.cur.cls = W), e.next.cls === jt && (e.next.cls = W), Y;
3556
3556
  }
3557
- function kn(e) {
3557
+ function On(e) {
3558
3558
  return e.next.cls === an || e.cur.cls === an ? X : Y;
3559
3559
  }
3560
- function An(e) {
3560
+ function kn(e) {
3561
3561
  return e.cur.cls === Lt ? X : Y;
3562
3562
  }
3563
- function jn(e) {
3563
+ function An(e) {
3564
3564
  if (e.next.cls === Lt) switch (e.cur.cls) {
3565
3565
  case q:
3566
3566
  case Et:
@@ -3570,7 +3570,7 @@ function jn(e) {
3570
3570
  }
3571
3571
  return Y;
3572
3572
  }
3573
- function Mn(e) {
3573
+ function jn(e) {
3574
3574
  switch (e.next.cls) {
3575
3575
  case At:
3576
3576
  case Mt:
@@ -3579,46 +3579,46 @@ function Mn(e) {
3579
3579
  }
3580
3580
  return Y;
3581
3581
  }
3582
- function Nn(e) {
3582
+ function Mn(e) {
3583
3583
  return e.cur.cls === Yt ? (e.next.cls === q && (e.spaces = !0), X) : Y;
3584
3584
  }
3585
- function Pn(e) {
3585
+ function Nn(e) {
3586
3586
  return hn.has(e.prev.cls) && /^\p{Pi}$/u.test(e.cur.char) && e.cur.cls === J ? (e.spaces = !0, X) : Y;
3587
3587
  }
3588
- function Fn(e) {
3588
+ function Pn(e) {
3589
3589
  if (/^\p{gc=Pf}$/u.test(e.next.char) && e.next.cls === J) {
3590
3590
  let t = e.afterNext();
3591
3591
  if (!t || mn.has(t.cls)) return X;
3592
3592
  }
3593
3593
  return Y;
3594
3594
  }
3595
- function In(e) {
3596
- return e.cur.cls === q && e.next.cls === Wt && e.afterNext()?.cls === K ? gn : Y;
3595
+ function Fn(e) {
3596
+ return e.cur.cls === q && e.next.cls === Wt && e.afterNext()?.cls === K ? Z : Y;
3597
3597
  }
3598
- function Ln(e) {
3598
+ function In(e) {
3599
3599
  return e.next.cls === Wt ? X : Y;
3600
3600
  }
3601
- function Rn(e) {
3601
+ function Ln(e) {
3602
3602
  if (e.cur.cls === At || e.cur.cls === Mt) {
3603
3603
  if (e.classAfterSpaces(e.cur.len) === Zt) return e.next.cls === q && (e.spaces = !0), X;
3604
3604
  if (e.next.cls === q) return X;
3605
3605
  }
3606
3606
  return Y;
3607
3607
  }
3608
- function zn(e) {
3608
+ function Rn(e) {
3609
3609
  if (e.cur.cls === Tt) {
3610
3610
  if (e.classAfterSpaces(e.cur.len) === Tt) return e.next.cls === q && (e.spaces = !0), X;
3611
3611
  if (e.next.cls === q) return X;
3612
3612
  }
3613
3613
  return Y;
3614
3614
  }
3615
- function Bn(e) {
3616
- return e.cur.cls === q ? gn : Y;
3615
+ function zn(e) {
3616
+ return e.cur.cls === q ? Z : Y;
3617
3617
  }
3618
- function Vn(e) {
3618
+ function Bn(e) {
3619
3619
  return e.next.cls === J && !/^\p{Pi}$/u.test(e.next.char) || e.cur.cls === J && !/^\p{Pf}$/u.test(e.cur.char) ? X : Y;
3620
3620
  }
3621
- function Hn(e) {
3621
+ function Vn(e) {
3622
3622
  if (!U.get(e.cur.cp) && e.next.cls === J) return X;
3623
3623
  if (e.next.cls === J) {
3624
3624
  let t = e.afterNext();
@@ -3626,10 +3626,10 @@ function Hn(e) {
3626
3626
  }
3627
3627
  return e.cur.cls === J && !U.get(e.next.cp) || (e.prev.cls === -1 || !U.get(e.prev.cp)) && e.cur.cls === J ? X : Y;
3628
3628
  }
3629
- function Un(e) {
3630
- return e.cur.cls === kt || e.next.cls === kt ? gn : Y;
3629
+ function Hn(e) {
3630
+ return e.cur.cls === kt || e.next.cls === kt ? Z : Y;
3631
3631
  }
3632
- var Wn = /* @__PURE__ */ new Set([
3632
+ var Un = /* @__PURE__ */ new Set([
3633
3633
  -1,
3634
3634
  Ot,
3635
3635
  Nt,
@@ -3640,10 +3640,10 @@ var Wn = /* @__PURE__ */ new Set([
3640
3640
  kt,
3641
3641
  Lt
3642
3642
  ]);
3643
- function Gn(e) {
3644
- return Wn.has(e.prev.cls) && (e.cur.cls === Vt || e.cur.cls === Bt) && (e.next.cls === W || e.next.cls === G) ? X : Y;
3643
+ function Wn(e) {
3644
+ return Un.has(e.prev.cls) && (e.cur.cls === Vt || e.cur.cls === Bt) && (e.next.cls === W || e.next.cls === G) ? X : Y;
3645
3645
  }
3646
- function Kn(e) {
3646
+ function Gn(e) {
3647
3647
  if (e.cur.cls === Dt) return X;
3648
3648
  switch (e.next.cls) {
3649
3649
  case Et:
@@ -3653,16 +3653,16 @@ function Kn(e) {
3653
3653
  }
3654
3654
  return Y;
3655
3655
  }
3656
- function qn(e) {
3656
+ function Kn(e) {
3657
3657
  return e.prev.cls === G && (e.cur.cls === Vt || e.cur.cls === Bt) && e.next.cls !== G ? X : Y;
3658
3658
  }
3659
- function Jn(e) {
3659
+ function qn(e) {
3660
3660
  return e.cur.cls === tn && e.next.cls === G ? X : Y;
3661
3661
  }
3662
- function Yn(e) {
3662
+ function Jn(e) {
3663
3663
  return e.next.cls === Ut ? X : Y;
3664
3664
  }
3665
- function Xn(e) {
3665
+ function Yn(e) {
3666
3666
  switch (e.cur.cls) {
3667
3667
  case W:
3668
3668
  case G:
@@ -3672,16 +3672,16 @@ function Xn(e) {
3672
3672
  }
3673
3673
  return Y;
3674
3674
  }
3675
- function Zn(e) {
3675
+ function Xn(e) {
3676
3676
  return e.cur.cls === $t && un.has(e.next.cls) || e.next.cls === Qt && un.has(e.cur.cls) ? X : Y;
3677
3677
  }
3678
- function Qn(e) {
3678
+ function Zn(e) {
3679
3679
  return (e.cur.cls === $t || e.cur.cls === Qt) && (e.next.cls === W || e.next.cls === G) || (e.cur.cls === W || e.cur.cls === G) && (e.next.cls === $t || e.next.cls === Qt) ? X : Y;
3680
3680
  }
3681
- var $n = /* @__PURE__ */ new Set([Qt, $t]), er = /* @__PURE__ */ new Set([At, Mt]);
3682
- function tr(e) {
3681
+ var Qn = /* @__PURE__ */ new Set([Qt, $t]), $n = /* @__PURE__ */ new Set([At, Mt]);
3682
+ function er(e) {
3683
3683
  let t = null;
3684
- if ($n.has(e.next.cls) ? t = er.has(e.cur.cls) ? e.prev.len : e.cur.len : e.next.cls === K && (t = e.cur.len), t !== null) SyIsLoop: for (let { cls: n } of e.codePoints(t, !1)) switch (n) {
3684
+ if (Qn.has(e.next.cls) ? t = $n.has(e.cur.cls) ? e.prev.len : e.cur.len : e.next.cls === K && (t = e.cur.len), t !== null) SyIsLoop: for (let { cls: n } of e.codePoints(t, !1)) switch (n) {
3685
3685
  case tn:
3686
3686
  case Wt: continue;
3687
3687
  case K: return X;
@@ -3695,7 +3695,7 @@ function tr(e) {
3695
3695
  }
3696
3696
  return e.cur.cls === Vt && e.next.cls === K || e.cur.cls === Wt && e.next.cls === K ? X : Y;
3697
3697
  }
3698
- function nr(e) {
3698
+ function tr(e) {
3699
3699
  switch (e.cur.cls) {
3700
3700
  case Gt:
3701
3701
  if (dn.has(e.next.cls)) return X;
@@ -3709,7 +3709,7 @@ function nr(e) {
3709
3709
  }
3710
3710
  return Y;
3711
3711
  }
3712
- function rr(e) {
3712
+ function nr(e) {
3713
3713
  switch (e.cur.cls) {
3714
3714
  case Gt:
3715
3715
  case qt:
@@ -3722,20 +3722,20 @@ function rr(e) {
3722
3722
  }
3723
3723
  return Y;
3724
3724
  }
3725
- function ar(e) {
3725
+ function rr(e) {
3726
3726
  return (e.cur.cls === W || e.cur.cls === G) && (e.next.cls === W || e.next.cls === G) ? X : Y;
3727
3727
  }
3728
- function or(e) {
3728
+ function ar(e) {
3729
3729
  let { prev: t, cur: n, next: r } = e;
3730
3730
  function i(e) {
3731
3731
  return e.cls === St || e.char === "◌" || e.cls === wt;
3732
3732
  }
3733
3733
  return n.cls === Ct && i(r) || i(n) && (r.cls === nn || r.cls === rn) || i(t) && n.cls === rn && (r.cls === St || r.char === "◌") || i(n) && i(r) && e.afterNext()?.cls === nn ? X : Y;
3734
3734
  }
3735
- function sr(e) {
3735
+ function or(e) {
3736
3736
  return e.cur.cls === Wt && (e.next.cls === W || e.next.cls === G) ? X : Y;
3737
3737
  }
3738
- function cr(e) {
3738
+ function sr(e) {
3739
3739
  switch (e.cur.cls) {
3740
3740
  case W:
3741
3741
  case G:
@@ -3746,19 +3746,20 @@ function cr(e) {
3746
3746
  }
3747
3747
  return Y;
3748
3748
  }
3749
- function lr(e) {
3749
+ function cr(e) {
3750
3750
  if (e.cur.cls === en) {
3751
3751
  if (e.next.cls === en && ++e.RI % 2 != 0) return X;
3752
3752
  } else e.RI = 0;
3753
3753
  return Y;
3754
3754
  }
3755
- function ur(e) {
3755
+ function lr(e) {
3756
3756
  return e.cur.cls === Pt && e.next.cls === Ft || e.next.cls === Ft && /^\p{ExtPict}$/u.test(e.cur.char) && /^\p{gc=Cn}$/u.test(e.cur.char) ? X : Y;
3757
3757
  }
3758
- function dr() {
3759
- return gn;
3758
+ function ur() {
3759
+ return Z;
3760
3760
  }
3761
- var fr = [
3761
+ var dr = [
3762
+ _n,
3762
3763
  vn,
3763
3764
  yn,
3764
3765
  bn,
@@ -3784,15 +3785,15 @@ var fr = [
3784
3785
  Bn,
3785
3786
  Vn,
3786
3787
  Hn,
3787
- Un,
3788
+ Wn,
3789
+ Kn,
3788
3790
  Gn,
3789
3791
  qn,
3790
- Kn,
3791
3792
  Jn,
3792
3793
  Yn,
3793
3794
  Xn,
3794
3795
  Zn,
3795
- Qn,
3796
+ er,
3796
3797
  tr,
3797
3798
  nr,
3798
3799
  rr,
@@ -3801,9 +3802,8 @@ var fr = [
3801
3802
  sr,
3802
3803
  cr,
3803
3804
  lr,
3804
- ur,
3805
- dr
3806
- ], pr = class {
3805
+ ur
3806
+ ], fr = class {
3807
3807
  #e;
3808
3808
  constructor(e = {}) {
3809
3809
  if (this.#e = {
@@ -3811,7 +3811,7 @@ var fr = [
3811
3811
  example7: !1,
3812
3812
  verbose: !1,
3813
3813
  ...e
3814
- }, this.rules = [...fr], this.#e.example7) throw Error("'example7' flag deprecated");
3814
+ }, this.rules = [...dr], this.#e.example7) throw Error("'example7' flag deprecated");
3815
3815
  this.#e.verbose && this.rules.unshift((e) => (console.log(e.cur.len, e), Y));
3816
3816
  }
3817
3817
  removeRule(...e) {
@@ -3839,8 +3839,8 @@ var fr = [
3839
3839
  switch (n) {
3840
3840
  case Y: break;
3841
3841
  case X: return this.#e.verbose && console.log(` ${t.name}: NO_BREAK`), null;
3842
- case gn: return this.#e.verbose && console.log(` ${t.name}: MAY_BREAK`), new H(e.cur.len);
3843
- case _n: return this.#e.verbose && console.log(` ${t.name}: MUST_BREAK`), new H(e.cur.len, !0);
3842
+ case Z: return this.#e.verbose && console.log(` ${t.name}: MAY_BREAK`), new H(e.cur.len);
3843
+ case gn: return this.#e.verbose && console.log(` ${t.name}: MUST_BREAK`), new H(e.cur.len, !0);
3844
3844
  default: throw Error(`Invalid state: "${n}"`);
3845
3845
  }
3846
3846
  }
@@ -3858,37 +3858,37 @@ var fr = [
3858
3858
  };
3859
3859
  //#endregion
3860
3860
  //#region src/text-layout.ts
3861
- function mr(e, t) {
3861
+ function pr(e, t) {
3862
3862
  let n = new Intl.Segmenter(t, { granularity: "grapheme" }), r = /* @__PURE__ */ new Set([0]);
3863
3863
  for (let t of n.segment(e)) r.add(t.index + t.segment.length);
3864
3864
  return r;
3865
3865
  }
3866
- var hr = class {
3867
- #e = new pr();
3866
+ var mr = class {
3867
+ #e = new fr();
3868
3868
  #t;
3869
3869
  constructor(e = "ja") {
3870
3870
  this.#t = e;
3871
3871
  }
3872
3872
  getBreakOpportunities(e) {
3873
- let t = mr(e, this.#t), n = /* @__PURE__ */ new Map();
3873
+ let t = pr(e, this.#t), n = /* @__PURE__ */ new Map();
3874
3874
  for (let r of this.#e.breaks(e)) t.has(r.position) && n.set(r.position, (n.get(r.position) ?? !1) || r.required);
3875
3875
  return Object.freeze([...n].sort(([e], [t]) => e - t).map(([e, t]) => Object.freeze({
3876
3876
  position: e,
3877
3877
  required: t
3878
3878
  })));
3879
3879
  }
3880
- }, gr = /* @__PURE__ */ new Map(), _r = /\r\n|[\n\r\v\f\u0085\u2028\u2029]/gu;
3881
- function vr(e) {
3882
- let t = gr.get(e);
3880
+ }, hr = /* @__PURE__ */ new Map(), gr = /\r\n|[\n\r\v\f\u0085\u2028\u2029]/gu;
3881
+ function _r(e) {
3882
+ let t = hr.get(e);
3883
3883
  if (t) return t;
3884
- let n = new hr(e);
3885
- return gr.set(e, n), n;
3884
+ let n = new mr(e);
3885
+ return hr.set(e, n), n;
3886
3886
  }
3887
- function yr(e, t) {
3887
+ function vr(e, t) {
3888
3888
  if (!Number.isFinite(e) || e < 0) throw TypeError(`${t} must return a non-negative finite number.`);
3889
3889
  return e;
3890
3890
  }
3891
- function br(e, t, n) {
3891
+ function yr(e, t, n) {
3892
3892
  let r = /* @__PURE__ */ new Map();
3893
3893
  for (let i of t.getBreakOpportunities(e)) {
3894
3894
  let { position: t, required: a } = i;
@@ -3899,28 +3899,28 @@ function br(e, t, n) {
3899
3899
  required: t
3900
3900
  }));
3901
3901
  }
3902
- function xr(e, t, n, r, i) {
3902
+ function br(e, t, n, r, i) {
3903
3903
  if (e.length === 0) return [{
3904
3904
  text: "",
3905
3905
  start: t,
3906
3906
  end: t,
3907
3907
  width: 0
3908
3908
  }];
3909
- let a = mr(e, i), o = [...a].sort((e, t) => e - t), s = br(e, r, a), c = [], l = 0;
3909
+ let a = pr(e, i), o = [...a].sort((e, t) => e - t), s = yr(e, r, a), c = [], l = 0;
3910
3910
  for (; l < e.length;) {
3911
3911
  let r = s.find((e) => e.position > l && e.required)?.position ?? e.length, i, a = 0;
3912
3912
  for (let t of s) {
3913
3913
  if (t.position <= l || t.position > r) continue;
3914
- let o = e.slice(l, t.position), s = yr(n.measureText(o), "measureText");
3914
+ let o = e.slice(l, t.position), s = vr(n.measureText(o), "measureText");
3915
3915
  s <= n.maxWidth && (i = t.position, a = s);
3916
3916
  }
3917
3917
  if (i === void 0) {
3918
3918
  let t = o.filter((e) => e > l && e <= r);
3919
3919
  for (let r of t) {
3920
- let t = e.slice(l, r), o = yr(n.measureText(t), "measureText");
3920
+ let t = e.slice(l, r), o = vr(n.measureText(t), "measureText");
3921
3921
  o <= n.maxWidth && (i = r, a = o);
3922
3922
  }
3923
- i === void 0 && (i = t[0] ?? r, a = yr(n.measureText(e.slice(l, i)), "measureText"));
3923
+ i === void 0 && (i = t[0] ?? r, a = vr(n.measureText(e.slice(l, i)), "measureText"));
3924
3924
  }
3925
3925
  c.push({
3926
3926
  text: e.slice(l, i),
@@ -3931,37 +3931,37 @@ function xr(e, t, n, r, i) {
3931
3931
  }
3932
3932
  return c;
3933
3933
  }
3934
- function Sr(e) {
3934
+ function xr(e) {
3935
3935
  if (typeof e.text != "string") throw TypeError("text must be a string.");
3936
3936
  if (!Number.isFinite(e.maxWidth) || e.maxWidth <= 0) throw TypeError("maxWidth must be a positive finite number.");
3937
3937
  if (typeof e.measureText != "function") throw TypeError("measureText must be a function.");
3938
- let t = e.locale ?? "ja", n = e.lineBreakProvider ?? vr(t), r = [], i = 0;
3939
- for (let a of e.text.matchAll(_r)) {
3938
+ let t = e.locale ?? "ja", n = e.lineBreakProvider ?? _r(t), r = [], i = 0;
3939
+ for (let a of e.text.matchAll(gr)) {
3940
3940
  let o = a.index;
3941
- r.push(...xr(e.text.slice(i, o), i, e, n, t)), i = o + a[0].length;
3941
+ r.push(...br(e.text.slice(i, o), i, e, n, t)), i = o + a[0].length;
3942
3942
  }
3943
- return r.push(...xr(e.text.slice(i), i, e, n, t)), Object.freeze({
3943
+ return r.push(...br(e.text.slice(i), i, e, n, t)), Object.freeze({
3944
3944
  lines: Object.freeze(r.map((e) => Object.freeze(e))),
3945
3945
  maxLineWidth: Math.max(0, ...r.map((e) => e.width))
3946
3946
  });
3947
3947
  }
3948
3948
  //#endregion
3949
3949
  //#region src/reveal.ts
3950
- var Cr = Object.freeze([
3950
+ var Sr = Object.freeze([
3951
3951
  "CHARACTER",
3952
3952
  "WORD",
3953
3953
  "LINE",
3954
3954
  "BLOCK"
3955
3955
  ]);
3956
- function wr(e) {
3956
+ function Cr(e) {
3957
3957
  let t = globalThis.Intl?.Segmenter;
3958
3958
  return typeof t == "function" ? [...new t(void 0, { granularity: "grapheme" }).segment(e)].map(({ segment: e }) => e) : Array.from(e);
3959
3959
  }
3960
- function Tr(e) {
3961
- if (typeof e != "string" || !Cr.includes(e)) throw TypeError("Bubble reveal unit must be CHARACTER, WORD, LINE, or BLOCK.");
3960
+ function wr(e) {
3961
+ if (typeof e != "string" || !Sr.includes(e)) throw TypeError("Bubble reveal unit must be CHARACTER, WORD, LINE, or BLOCK.");
3962
3962
  return e;
3963
3963
  }
3964
- function Er(e) {
3964
+ function Tr(e) {
3965
3965
  if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("Bubble reveal must be an object.");
3966
3966
  let t = e, n = /* @__PURE__ */ new Set([
3967
3967
  "unit",
@@ -3972,7 +3972,7 @@ function Er(e) {
3972
3972
  "sound"
3973
3973
  ]);
3974
3974
  if (Object.keys(t).filter((e) => !n.has(e)).length > 0 || t.unit === void 0) throw TypeError("Bubble reveal has unknown or missing properties.");
3975
- let r = Tr(t.unit), i = t.delimiters ?? " \r\n";
3975
+ let r = wr(t.unit), i = t.delimiters ?? " \r\n";
3976
3976
  if (typeof i != "string" || i.length === 0) throw TypeError("Bubble WORD delimiters must be a non-empty string.");
3977
3977
  let a = t.showDelimiters ?? !1;
3978
3978
  if (typeof a != "boolean") throw TypeError("Bubble reveal showDelimiters must be boolean.");
@@ -3991,16 +3991,16 @@ function Er(e) {
3991
3991
  ...c === void 0 ? {} : { sound: c }
3992
3992
  });
3993
3993
  }
3994
- function Dr(e, t, n) {
3994
+ function Er(e, t, n) {
3995
3995
  let r = new Set(Array.from(t)), i = [], a = "";
3996
- for (let t of wr(e)) a += t, r.has(t) && ((n || a.slice(0, -t.length).length > 0) && i.push(n ? a : a.slice(0, -t.length)), a = "");
3996
+ for (let t of Cr(e)) a += t, r.has(t) && ((n || a.slice(0, -t.length).length > 0) && i.push(n ? a : a.slice(0, -t.length)), a = "");
3997
3997
  return a.length > 0 && i.push(a), i.filter((e) => e.length > 0);
3998
3998
  }
3999
- function Or(e, t) {
3999
+ function Dr(e, t) {
4000
4000
  if (e.length === 0) return Object.freeze([""]);
4001
- if (t.unit === "CHARACTER") return Object.freeze(wr(e));
4001
+ if (t.unit === "CHARACTER") return Object.freeze(Cr(e));
4002
4002
  if (t.unit === "WORD") {
4003
- let n = Dr(e, t.delimiters, t.showDelimiters);
4003
+ let n = Er(e, t.delimiters, t.showDelimiters);
4004
4004
  if (t.showDelimiters) return Object.freeze(n);
4005
4005
  let r = [], i = 0;
4006
4006
  for (let a of n) {
@@ -4018,21 +4018,59 @@ function Or(e, t) {
4018
4018
  let i = r;
4019
4019
  return Object.freeze(i.length > 0 ? i : [e]);
4020
4020
  }
4021
- function kr(e, t) {
4021
+ function Or(e, t) {
4022
4022
  return e.slice(0, Math.max(0, Math.min(t, e.length))).join("");
4023
4023
  }
4024
4024
  //#endregion
4025
+ //#region src/portrait-layout.ts
4026
+ var kr = Object.freeze([
4027
+ "left",
4028
+ "right",
4029
+ "top-left",
4030
+ "top-right",
4031
+ "bottom-left",
4032
+ "bottom-right"
4033
+ ]), Ar = "left", jr = Object.freeze({
4034
+ x: 0,
4035
+ y: 0,
4036
+ zoomPercent: 100
4037
+ }), Mr = 0;
4038
+ function Nr(e) {
4039
+ if (typeof e != "string") throw TypeError("Bubble portrait placement must be a string.");
4040
+ let t = e.trim().toLowerCase().replaceAll("_", "-");
4041
+ if (!kr.includes(t)) throw TypeError(`Unsupported Bubble portrait placement: ${e}`);
4042
+ return t;
4043
+ }
4044
+ function Pr(e) {
4045
+ if (!Array.isArray(e) || e.length !== 2 && e.length !== 3) throw TypeError("Bubble portrait offset must be [x, y] or [x, y, zoom].");
4046
+ let [t, n, r = 100] = e;
4047
+ if (![
4048
+ t,
4049
+ n,
4050
+ r
4051
+ ].every(Number.isFinite) || r <= 0) throw TypeError("Bubble portrait offset values must be finite and zoom positive.");
4052
+ return Object.freeze({
4053
+ x: t,
4054
+ y: n,
4055
+ zoomPercent: r
4056
+ });
4057
+ }
4058
+ function Fr(e) {
4059
+ if (typeof e != "number" || !Number.isFinite(e) || e < 0) throw TypeError("Bubble portrait corner radius must be zero or greater.");
4060
+ return e;
4061
+ }
4062
+ //#endregion
4025
4063
  //#region src/composition.ts
4026
- var Z = class extends Error {
4064
+ var Q = class extends Error {
4027
4065
  code;
4028
4066
  constructor(e, t) {
4029
4067
  super(t), this.name = "BubbleCompositionError", this.code = e;
4030
4068
  }
4031
- }, Ar = /* @__PURE__ */ new Set(["say", "think"]), jr = /* @__PURE__ */ new Set([
4069
+ }, Ir = /* @__PURE__ */ new Set(["say", "think"]), Lr = /* @__PURE__ */ new Set([
4032
4070
  "idle",
4033
4071
  "talking",
4034
4072
  "awaiting-continue"
4035
- ]), Mr = /* @__PURE__ */ new Set([
4073
+ ]), Rr = /* @__PURE__ */ new Set([
4036
4074
  "fadeIn",
4037
4075
  "fadeOut",
4038
4076
  "floatIn",
@@ -4044,50 +4082,64 @@ var Z = class extends Error {
4044
4082
  "shake",
4045
4083
  "explode",
4046
4084
  "animateBubbleShape"
4047
- ]), Nr = /* @__PURE__ */ new Set([
4085
+ ]), zr = /* @__PURE__ */ new Set([
4048
4086
  "linear",
4049
4087
  "easeIn",
4050
4088
  "easeOut",
4051
4089
  "easeInOut"
4052
4090
  ]);
4053
- function Q(e) {
4091
+ function $(e) {
4054
4092
  return typeof e == "object" && !!e && !Array.isArray(e);
4055
4093
  }
4056
- function Pr(e, t, n, r) {
4094
+ function Br(e, t, n, r) {
4057
4095
  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));
4058
- if (a.length > 0 || o.length > 0) throw new Z("BUBBLE-COMPOSITION-001", `${r} has missing or unknown properties.`);
4096
+ if (a.length > 0 || o.length > 0) throw new Q("BUBBLE-COMPOSITION-001", `${r} has missing or unknown properties.`);
4059
4097
  }
4060
- function $(e, t) {
4061
- if (typeof e != "string" || e.trim().length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
4098
+ function Vr(e, t) {
4099
+ if (typeof e != "string" || e.trim().length === 0) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
4062
4100
  return e.trim();
4063
4101
  }
4064
- function Fr(e, t) {
4065
- if (typeof e != "string" || e.length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
4102
+ function Hr(e, t) {
4103
+ if (typeof e != "string" || e.length === 0) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
4066
4104
  return e;
4067
4105
  }
4068
- function Ir(e, t, n) {
4069
- if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
4070
- if (Pr(e, ["frames", "frameIntervalSeconds"], [], t), !Array.isArray(e.frames) || e.frames.length < n) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frames must contain at least ${n} image asset name${n === 1 ? "" : "s"}.`);
4071
- let r = Object.freeze(e.frames.map((e, n) => Fr(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
4072
- if (typeof i != "number" || !Number.isFinite(i) || i <= 0) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frameIntervalSeconds must be a positive finite number.`);
4106
+ function Ur(e, t, n) {
4107
+ if (!$(e)) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
4108
+ if (Br(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"}.`);
4109
+ let r = Object.freeze(e.frames.map((e, n) => Hr(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
4110
+ if (typeof i != "number" || !Number.isFinite(i) || i <= 0) throw new Q("BUBBLE-COMPOSITION-001", `${t}.frameIntervalSeconds must be a positive finite number.`);
4073
4111
  return Object.freeze({
4074
4112
  frames: r,
4075
4113
  frameIntervalSeconds: i
4076
4114
  });
4077
4115
  }
4078
- function Lr(e) {
4079
- if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
4080
- Pr(e, ["base"], ["blink", "lipSync"], "Bubble portrait");
4081
- let t = e.blink === void 0 ? void 0 : Ir(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : Ir(e.lipSync, "Bubble portrait lip-sync", 1);
4116
+ function Wr(e) {
4117
+ if (!$(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
4118
+ Br(e, ["base"], [
4119
+ "blink",
4120
+ "lipSync",
4121
+ "placement",
4122
+ "offset",
4123
+ "cornerRadius"
4124
+ ], "Bubble portrait");
4125
+ let t = e.blink === void 0 ? void 0 : Ur(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : Ur(e.lipSync, "Bubble portrait lip-sync", 1), r, i, a;
4126
+ try {
4127
+ r = Nr(e.placement ?? "left"), i = e.offset === void 0 ? jr : Pr(e.offset), a = Fr(e.cornerRadius ?? 0);
4128
+ } catch (e) {
4129
+ throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble portrait layout is invalid.");
4130
+ }
4082
4131
  return Object.freeze({
4083
- base: Fr(e.base, "Bubble portrait base"),
4132
+ base: Hr(e.base, "Bubble portrait base"),
4084
4133
  ...t === void 0 ? {} : { blink: t },
4085
- ...n === void 0 ? {} : { lipSync: n }
4134
+ ...n === void 0 ? {} : { lipSync: n },
4135
+ placement: r,
4136
+ offset: i,
4137
+ cornerRadius: a
4086
4138
  });
4087
4139
  }
4088
- function Rr(e, t) {
4089
- if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
4090
- if (Pr(e, ["name"], [
4140
+ function Gr(e, t) {
4141
+ if (!$(e)) throw new Q("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
4142
+ if (Br(e, ["name"], [
4091
4143
  "durationSeconds",
4092
4144
  "ease",
4093
4145
  "direction",
@@ -4095,19 +4147,19 @@ function Rr(e, t) {
4095
4147
  "relativeScale",
4096
4148
  "speed",
4097
4149
  "visualStyle"
4098
- ], t), !Mr.has(e.name)) throw new Z("BUBBLE-COMPOSITION-001", `${t}.name is not a supported Bubble motion.`);
4150
+ ], t), !Rr.has(e.name)) throw new Q("BUBBLE-COMPOSITION-001", `${t}.name is not a supported Bubble motion.`);
4099
4151
  let n = (n, r, i = !1) => {
4100
4152
  let a = e[n];
4101
4153
  if (a !== void 0) {
4102
- if (typeof a != "number" || !Number.isFinite(a) || a < r || i && !Number.isInteger(a)) throw new Z("BUBBLE-COMPOSITION-001", `${t}.${n} is invalid.`);
4154
+ if (typeof a != "number" || !Number.isFinite(a) || a < r || i && !Number.isInteger(a)) throw new Q("BUBBLE-COMPOSITION-001", `${t}.${n} is invalid.`);
4103
4155
  return a;
4104
4156
  }
4105
4157
  }, r = n("durationSeconds", 0), i = n("count", 1, !0), a = n("relativeScale", 0), o = n("speed", 0), s = e.direction;
4106
- if (s !== void 0 && typeof s != "number" && typeof s != "string") throw new Z("BUBBLE-COMPOSITION-001", `${t}.direction is invalid.`);
4158
+ if (s !== void 0 && typeof s != "number" && typeof s != "string") throw new Q("BUBBLE-COMPOSITION-001", `${t}.direction is invalid.`);
4107
4159
  let c = e.ease ?? "easeInOut";
4108
- if (typeof c != "string" || !Nr.has(c)) throw new Z("BUBBLE-COMPOSITION-001", `${t}.ease is invalid.`);
4160
+ if (typeof c != "string" || !zr.has(c)) throw new Q("BUBBLE-COMPOSITION-001", `${t}.ease is invalid.`);
4109
4161
  let l = e.visualStyle;
4110
- if (l !== void 0 && (typeof l != "string" || !M.includes(l))) throw new Z("BUBBLE-COMPOSITION-001", `${t}.visualStyle is invalid.`);
4162
+ if (l !== void 0 && (typeof l != "string" || !M.includes(l))) throw new Q("BUBBLE-COMPOSITION-001", `${t}.visualStyle is invalid.`);
4111
4163
  return Object.freeze({
4112
4164
  name: e.name,
4113
4165
  ...r === void 0 ? {} : { durationSeconds: r },
@@ -4119,10 +4171,10 @@ function Rr(e, t) {
4119
4171
  ...l === void 0 ? {} : { visualStyle: l }
4120
4172
  });
4121
4173
  }
4122
- function zr(e) {
4174
+ function Kr(e) {
4123
4175
  if (e === void 0) return;
4124
- if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
4125
- Pr(e, [], [
4176
+ if (!$(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
4177
+ Br(e, [], [
4126
4178
  "voice",
4127
4179
  "reveal",
4128
4180
  "finish"
@@ -4134,13 +4186,13 @@ function zr(e) {
4134
4186
  "finish"
4135
4187
  ]) {
4136
4188
  let r = e[n];
4137
- r !== void 0 && (t[n] = Fr(r, `Bubble audio ${n}`));
4189
+ r !== void 0 && (t[n] = Hr(r, `Bubble audio ${n}`));
4138
4190
  }
4139
4191
  return Object.freeze(t);
4140
4192
  }
4141
- function Br(e) {
4142
- if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
4143
- Pr(e, ["name", "textStyle"], [
4193
+ function qr(e) {
4194
+ if (!$(e)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
4195
+ Br(e, ["name", "textStyle"], [
4144
4196
  "placement",
4145
4197
  "maxWidth",
4146
4198
  "textLocale",
@@ -4155,35 +4207,35 @@ function Br(e) {
4155
4207
  "showAnimation",
4156
4208
  "hideAnimation"
4157
4209
  ], "Bubble style");
4158
- let t = e.portrait === void 0 ? void 0 : Lr(e.portrait), n = e.continueIndicator === void 0 ? void 0 : Ir(e.continueIndicator, "Bubble continue indicator", 2), r;
4210
+ let t = e.portrait === void 0 ? void 0 : Wr(e.portrait), n = e.continueIndicator === void 0 ? void 0 : Ur(e.continueIndicator, "Bubble continue indicator", 2), r;
4159
4211
  if (e.reveal !== void 0) try {
4160
- r = Er(e.reveal);
4212
+ r = Tr(e.reveal);
4161
4213
  } catch (e) {
4162
- throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
4214
+ throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
4163
4215
  }
4164
- let i = zr(e.audio), a = e.showAnimation === void 0 ? void 0 : Rr(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : Rr(e.hideAnimation, "Bubble hideAnimation"), s;
4216
+ let i = Kr(e.audio), a = e.showAnimation === void 0 ? void 0 : Gr(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : Gr(e.hideAnimation, "Bubble hideAnimation"), s;
4165
4217
  try {
4166
4218
  s = y(e.placement ?? "up-right");
4167
4219
  } catch (e) {
4168
- throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble placement is invalid.");
4220
+ throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble placement is invalid.");
4169
4221
  }
4170
4222
  let c, l, u;
4171
4223
  try {
4172
4224
  c = T(e.distance ?? 12), l = E(e.tailLength ?? 18), u = e.offset === void 0 ? C : D(e.offset);
4173
4225
  } catch (e) {
4174
- throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble actor-relative transform is invalid.");
4226
+ throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble actor-relative transform is invalid.");
4175
4227
  }
4176
4228
  let d = e.visualStyle ?? "NORMAL";
4177
- if (typeof d != "string" || !M.includes(d)) throw new Z("BUBBLE-COMPOSITION-001", `Unsupported Bubble visual style: ${String(d)}`);
4229
+ if (typeof d != "string" || !M.includes(d)) throw new Q("BUBBLE-COMPOSITION-001", `Unsupported Bubble visual style: ${String(d)}`);
4178
4230
  let f;
4179
4231
  if (e.maxWidth !== void 0) {
4180
- if (typeof e.maxWidth != "number" || !Number.isFinite(e.maxWidth) || e.maxWidth <= 0) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style maxWidth must be a positive finite number.");
4232
+ 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.");
4181
4233
  f = e.maxWidth;
4182
4234
  }
4183
- let p = e.textLocale === void 0 ? void 0 : $(e.textLocale, "Bubble style text locale");
4235
+ let p = e.textLocale === void 0 ? void 0 : Vr(e.textLocale, "Bubble style text locale");
4184
4236
  return Object.freeze({
4185
- name: $(e.name, "Bubble style name"),
4186
- textStyle: $(e.textStyle, "Bubble text style name"),
4237
+ name: Vr(e.name, "Bubble style name"),
4238
+ textStyle: Vr(e.textStyle, "Bubble text style name"),
4187
4239
  ...f === void 0 ? {} : { maxWidth: f },
4188
4240
  ...p === void 0 ? {} : { textLocale: p },
4189
4241
  placement: s,
@@ -4199,81 +4251,81 @@ function Br(e) {
4199
4251
  ...o === void 0 ? {} : { hideAnimation: o }
4200
4252
  });
4201
4253
  }
4202
- function Vr(e) {
4254
+ function Jr(e) {
4203
4255
  if (e !== void 0) {
4204
- if (!Q(e) || typeof e.applyToTarget != "function" || typeof e.getMimeType != "function" || typeof e.isRegistered != "function") throw TypeError("Bubble image capability must provide applyToTarget, getMimeType, and isRegistered.");
4256
+ if (!$(e) || typeof e.applyToTarget != "function" || typeof e.getMimeType != "function" || typeof e.isRegistered != "function") throw TypeError("Bubble image capability must provide applyToTarget, getMimeType, and isRegistered.");
4205
4257
  return e;
4206
4258
  }
4207
4259
  }
4208
- function Hr(e) {
4260
+ function Yr(e) {
4209
4261
  if (e !== void 0) {
4210
- if (!Q(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
4262
+ if (!$(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
4211
4263
  if (e.isRegistered !== void 0 && typeof e.isRegistered != "function") throw TypeError("Bubble audio capability isRegistered must be a function.");
4212
4264
  if (e.getMimeType !== void 0 && typeof e.getMimeType != "function") throw TypeError("Bubble audio capability getMimeType must be a function.");
4213
4265
  return e;
4214
4266
  }
4215
4267
  }
4216
- function Ur(e) {
4217
- if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", "Bubble image assets require an image capability. Provide options.imageResolver.");
4268
+ function Xr(e) {
4269
+ if (e === void 0) throw new Q("BUBBLE-COMPOSITION-006", "Bubble image assets require an image capability. Provide options.imageResolver.");
4218
4270
  return e;
4219
4271
  }
4220
- function Wr(e) {
4221
- if (!Q(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble text capability must provide setText and releaseTarget.");
4272
+ function Zr(e) {
4273
+ if (!$(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble text capability must provide setText and releaseTarget.");
4222
4274
  return e;
4223
4275
  }
4224
- function Gr() {
4276
+ function Qr() {
4225
4277
  return Object.freeze({
4226
4278
  setTimeout: (e, t) => globalThis.setTimeout(e, t),
4227
4279
  clearTimeout: (e) => globalThis.clearTimeout(e)
4228
4280
  });
4229
4281
  }
4230
- function Kr(e) {
4231
- if (!Q(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
4282
+ function $r(e) {
4283
+ if (!$(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
4232
4284
  return e;
4233
4285
  }
4234
- function qr(e, t) {
4235
- if (!Q(e) || typeof e.id != "string" || e.id.length === 0 || typeof e.isStage != "boolean") throw new Z("BUBBLE-COMPOSITION-004", `${t} must provide id and isStage.`);
4286
+ function ei(e, t) {
4287
+ if (!$(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.`);
4236
4288
  return e;
4237
4289
  }
4238
- function Jr(e) {
4239
- if (typeof e != "object" || !e) throw new Z("BUBBLE-COMPOSITION-004", "Bubble text target must be a non-null object.");
4290
+ function ti(e) {
4291
+ if (typeof e != "object" || !e) throw new Q("BUBBLE-COMPOSITION-004", "Bubble text target must be a non-null object.");
4240
4292
  return e;
4241
4293
  }
4242
- function Yr(e, t) {
4243
- if (!Q(e) || !Q(e.targets) || typeof e.setLayerVisible != "function" || typeof e.updateStyle != "function" || typeof e.show != "function" || typeof e.hide != "function" || typeof e.dispose != "function") throw new Z("BUBBLE-COMPOSITION-004", "Bubble surface is invalid.");
4294
+ function ni(e, t) {
4295
+ if (!$(e) || !$(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.");
4244
4296
  let n = e.targets;
4245
- Jr(n.text);
4297
+ ti(n.text);
4246
4298
  let r = /* @__PURE__ */ new Set(), i = (e, t) => {
4247
4299
  let i = n[e];
4248
4300
  if (!t && i === void 0) return;
4249
- let a = qr(i, `Bubble surface ${e}`);
4250
- if (r.has(a.id)) throw new Z("BUBBLE-COMPOSITION-004", "Bubble image layers must use distinct target IDs.");
4301
+ let a = ei(i, `Bubble surface ${e}`);
4302
+ if (r.has(a.id)) throw new Q("BUBBLE-COMPOSITION-004", "Bubble image layers must use distinct target IDs.");
4251
4303
  r.add(a.id);
4252
4304
  };
4253
4305
  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;
4254
4306
  }
4255
- function Xr(e, t) {
4256
- if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble image capability is required for: ${t}. Provide options.imageResolver.`);
4257
- if (!e.isRegistered(t)) throw new Z("BUBBLE-COMPOSITION-003", `Bubble image asset is not registered: ${t}`);
4258
- if (!e.getMimeType(t).startsWith("image/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not an image: ${t}`);
4307
+ function ri(e, t) {
4308
+ if (e === void 0) throw new Q("BUBBLE-COMPOSITION-006", `Bubble image capability is required for: ${t}. Provide options.imageResolver.`);
4309
+ if (!e.isRegistered(t)) throw new Q("BUBBLE-COMPOSITION-003", `Bubble image asset is not registered: ${t}`);
4310
+ if (!e.getMimeType(t).startsWith("image/")) throw new Q("BUBBLE-COMPOSITION-003", `Bubble asset is not an image: ${t}`);
4259
4311
  }
4260
- function Zr(e, t) {
4261
- if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble audio assets require an audio capability: ${t}. Provide options.audio.`);
4262
- if (e.isRegistered?.(t) === !1) throw new Z("BUBBLE-COMPOSITION-003", `Bubble audio asset is not registered: ${t}`);
4312
+ function ii(e, t) {
4313
+ if (e === void 0) throw new Q("BUBBLE-COMPOSITION-006", `Bubble audio assets require an audio capability: ${t}. Provide options.audio.`);
4314
+ if (e.isRegistered?.(t) === !1) throw new Q("BUBBLE-COMPOSITION-003", `Bubble audio asset is not registered: ${t}`);
4263
4315
  let n = e.getMimeType?.(t);
4264
- if (n !== void 0 && !n.startsWith("audio/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not audio: ${t}`);
4316
+ if (n !== void 0 && !n.startsWith("audio/")) throw new Q("BUBBLE-COMPOSITION-003", `Bubble asset is not audio: ${t}`);
4265
4317
  }
4266
- function Qr(e) {
4318
+ function ai(e) {
4267
4319
  return [...e.portrait === void 0 ? [] : [
4268
4320
  e.portrait.base,
4269
4321
  ...e.portrait.blink?.frames ?? [],
4270
4322
  ...e.portrait.lipSync?.frames ?? []
4271
4323
  ], ...e.continueIndicator?.frames ?? []];
4272
4324
  }
4273
- function $r(e, t, n) {
4325
+ function oi(e, t, n) {
4274
4326
  if (t.maxWidth === void 0) return e;
4275
- if (typeof n.measureText != "function") throw new Z("BUBBLE-COMPOSITION-007", "Bubble style maxWidth requires the text capability measureText method.");
4276
- return Sr({
4327
+ if (typeof n.measureText != "function") throw new Q("BUBBLE-COMPOSITION-007", "Bubble style maxWidth requires the text capability measureText method.");
4328
+ return xr({
4277
4329
  text: e,
4278
4330
  maxWidth: t.maxWidth,
4279
4331
  ...t.textLocale === void 0 ? {} : { locale: t.textLocale },
@@ -4283,11 +4335,11 @@ function $r(e, t, n) {
4283
4335
  }) ?? 0
4284
4336
  }).lines.map(({ text: e }) => e).join("\n");
4285
4337
  }
4286
- function ei(e, t) {
4338
+ function si(e, t) {
4287
4339
  if (e.length === 1) throw e[0];
4288
4340
  if (e.length > 1) throw AggregateError(e, t);
4289
4341
  }
4290
- function ti(e) {
4342
+ function ci(e) {
4291
4343
  let t = !1, n = 0, r = 0, i, a = Promise.resolve(), o = async (t) => {
4292
4344
  let n = e.animation.frames[t];
4293
4345
  n !== void 0 && await e.imageResolver.applyToTarget(n, e.target);
@@ -4322,41 +4374,41 @@ function ti(e) {
4322
4374
  }
4323
4375
  });
4324
4376
  }
4325
- function ni(e) {
4326
- if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
4327
- if (Pr(e, [
4377
+ function li(e) {
4378
+ if (!$(e)) throw new Q("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
4379
+ if (Br(e, [
4328
4380
  "actor",
4329
4381
  "actorKey",
4330
4382
  "kind",
4331
4383
  "text",
4332
4384
  "styleName"
4333
- ], ["animationMode", "reveal"], "Show bubble input"), !Ar.has(e.kind)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble kind must be say or think.");
4334
- if (typeof e.text != "string") throw new Z("BUBBLE-COMPOSITION-001", "Bubble text must be a string.");
4385
+ ], ["animationMode", "reveal"], "Show bubble input"), !Ir.has(e.kind)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble kind must be say or think.");
4386
+ if (typeof e.text != "string") throw new Q("BUBBLE-COMPOSITION-001", "Bubble text must be a string.");
4335
4387
  let t = e.animationMode ?? "talking";
4336
- if (!jr.has(t)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid.");
4388
+ if (!Lr.has(t)) throw new Q("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid.");
4337
4389
  let n;
4338
4390
  if (e.reveal !== void 0) try {
4339
- n = Er(e.reveal);
4391
+ n = Tr(e.reveal);
4340
4392
  } catch (e) {
4341
- throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
4393
+ throw new Q("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
4342
4394
  }
4343
4395
  return {
4344
4396
  actor: e.actor,
4345
- actorKey: $(e.actorKey, "Bubble actor key"),
4397
+ actorKey: Vr(e.actorKey, "Bubble actor key"),
4346
4398
  kind: e.kind,
4347
4399
  text: e.text,
4348
- styleName: $(e.styleName, "Bubble style name"),
4400
+ styleName: Vr(e.styleName, "Bubble style name"),
4349
4401
  animationMode: t,
4350
4402
  ...n === void 0 ? {} : { reveal: n }
4351
4403
  };
4352
4404
  }
4353
- function ri(e) {
4354
- if (!Q(e)) throw TypeError("Bubble composition options must be an object.");
4355
- let t = Vr(e.imageResolver), n = Hr(e.audio), r = Wr(e.textCapability);
4405
+ function ui(e) {
4406
+ if (!$(e)) throw TypeError("Bubble composition options must be an object.");
4407
+ let t = Jr(e.imageResolver), n = Yr(e.audio), r = Zr(e.textCapability);
4356
4408
  if (typeof e.createSurface != "function") throw TypeError("Bubble composition createSurface must be a function.");
4357
4409
  if (e.onAnimationError !== void 0 && typeof e.onAnimationError != "function") throw TypeError("Bubble composition onAnimationError must be a function.");
4358
- let i = Kr(e.scheduler ?? Gr()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
4359
- if (c) throw new Z("BUBBLE-COMPOSITION-005", "Bubble composition has been disposed.");
4410
+ let i = $r(e.scheduler ?? Qr()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
4411
+ if (c) throw new Q("BUBBLE-COMPOSITION-005", "Bubble composition has been disposed.");
4360
4412
  }, u = async (e, t) => {
4361
4413
  let n = (s.get(e) ?? Promise.resolve()).catch(() => void 0).then(t);
4362
4414
  s.set(e, n);
@@ -4368,15 +4420,15 @@ function ri(e) {
4368
4420
  }, d = async (s) => {
4369
4421
  l();
4370
4422
  let c = a.get(s.styleName);
4371
- if (!c) throw new Z("BUBBLE-COMPOSITION-002", `Bubble style is not defined: ${s.styleName}`);
4423
+ if (!c) throw new Q("BUBBLE-COMPOSITION-002", `Bubble style is not defined: ${s.styleName}`);
4372
4424
  let u = c;
4373
4425
  s.reveal !== void 0 && (u = Object.freeze({
4374
4426
  ...c,
4375
4427
  reveal: s.reveal
4376
4428
  }));
4377
4429
  let d = s.text, f = (e) => {
4378
- let n = new Set(Qr(e)), r = n.size === 0 ? void 0 : Ur(t);
4379
- for (let e of n) Xr(r, e);
4430
+ let n = new Set(ai(e)), r = n.size === 0 ? void 0 : Xr(t);
4431
+ for (let e of n) ri(r, e);
4380
4432
  return r;
4381
4433
  }, p = f(u);
4382
4434
  for (let e of [
@@ -4384,13 +4436,13 @@ function ri(e) {
4384
4436
  u.audio?.reveal,
4385
4437
  u.audio?.finish,
4386
4438
  u.reveal?.sound
4387
- ]) e !== void 0 && Zr(n, e);
4439
+ ]) e !== void 0 && ii(n, e);
4388
4440
  let m = async (e, t = !1) => {
4389
4441
  e !== void 0 && n !== void 0 && await n.playSound(e, { untilDone: t });
4390
4442
  }, h = async (e, t, n) => {
4391
- let r = Qr(e).length === 0 ? void 0 : Ur(t), i = [];
4443
+ let r = ai(e).length === 0 ? void 0 : Xr(t), i = [];
4392
4444
  if (e.portrait) {
4393
- let t = Ur(r);
4445
+ let t = Xr(r);
4394
4446
  i.push(Promise.resolve(t.applyToTarget(e.portrait.base, n.targets.portraitBase)));
4395
4447
  let a = e.portrait.blink?.frames[0];
4396
4448
  a !== void 0 && i.push(Promise.resolve(t.applyToTarget(a, n.targets.portraitBlink)));
@@ -4399,47 +4451,47 @@ function ri(e) {
4399
4451
  }
4400
4452
  let a = e.continueIndicator?.frames[0];
4401
4453
  if (a !== void 0) {
4402
- let e = Ur(r);
4454
+ let e = Xr(r);
4403
4455
  i.push(Promise.resolve(e.applyToTarget(a, n.targets.continueIndicator)));
4404
4456
  }
4405
4457
  await Promise.all(i);
4406
4458
  }, g = (t, n, r) => {
4407
- x = t.portrait?.blink === void 0 ? void 0 : ti({
4459
+ x = t.portrait?.blink === void 0 ? void 0 : ci({
4408
4460
  actorKey: s.actorKey,
4409
4461
  layer: "portraitBlink",
4410
4462
  animation: t.portrait.blink,
4411
4463
  target: r.targets.portraitBlink,
4412
- imageResolver: Ur(n),
4464
+ imageResolver: Xr(n),
4413
4465
  scheduler: i,
4414
4466
  ...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
4415
- }), S = t.portrait?.lipSync === void 0 ? void 0 : ti({
4467
+ }), S = t.portrait?.lipSync === void 0 ? void 0 : ci({
4416
4468
  actorKey: s.actorKey,
4417
4469
  layer: "portraitLipSync",
4418
4470
  animation: t.portrait.lipSync,
4419
4471
  target: r.targets.portraitLipSync,
4420
- imageResolver: Ur(n),
4472
+ imageResolver: Xr(n),
4421
4473
  scheduler: i,
4422
4474
  ...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
4423
- }), C = t.continueIndicator === void 0 ? void 0 : ti({
4475
+ }), C = t.continueIndicator === void 0 ? void 0 : ci({
4424
4476
  actorKey: s.actorKey,
4425
4477
  layer: "continueIndicator",
4426
4478
  animation: t.continueIndicator,
4427
4479
  target: r.targets.continueIndicator,
4428
- imageResolver: Ur(n),
4480
+ imageResolver: Xr(n),
4429
4481
  scheduler: i,
4430
4482
  ...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
4431
4483
  });
4432
4484
  }, _ = o.get(s.actorKey);
4433
4485
  _ && await _.close();
4434
- let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? Or(s.text, w) : Object.freeze([s.text]), E = w ? Math.min(1, T.length) : 1, D, ee = 0;
4486
+ let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? Dr(s.text, w) : Object.freeze([s.text]), E = w ? Math.min(1, T.length) : 1, D, ee = 0;
4435
4487
  try {
4436
- v = Yr(await e.createSurface(Object.freeze({
4488
+ v = ni(await e.createSurface(Object.freeze({
4437
4489
  actor: s.actor,
4438
4490
  actorKey: s.actorKey,
4439
4491
  kind: s.kind,
4440
4492
  style: u
4441
4493
  })), u);
4442
- let t = $r(s.text, u, r);
4494
+ let t = oi(s.text, u, r);
4443
4495
  w?.layout === "RESERVED" && (r.setText({
4444
4496
  styleName: u.textStyle,
4445
4497
  target: v.targets.text,
@@ -4447,15 +4499,15 @@ function ri(e) {
4447
4499
  }), v.captureTextLayout?.()), r.setText({
4448
4500
  styleName: u.textStyle,
4449
4501
  target: v.targets.text,
4450
- text: $r(w ? kr(T, E) : s.text, u, r)
4502
+ text: oi(w ? Or(T, E) : s.text, u, r)
4451
4503
  }), y = !0, await h(u, p, v), g(u, p, v);
4452
4504
  let a = "idle", c = !1, l = Promise.resolve(), _ = async () => {
4453
4505
  if (!v) return;
4454
- let e = w ? kr(T, E) : d;
4506
+ let e = w ? Or(T, E) : d;
4455
4507
  r.setText({
4456
4508
  styleName: u.textStyle,
4457
4509
  target: v.targets.text,
4458
- text: $r(e, u, r)
4510
+ text: oi(e, u, r)
4459
4511
  }), await v.show();
4460
4512
  }, O = () => {
4461
4513
  ee += 1, D !== void 0 && i.clearTimeout(D), D = void 0;
@@ -4481,44 +4533,44 @@ function ri(e) {
4481
4533
  return a;
4482
4534
  },
4483
4535
  setText(e) {
4484
- return c ? Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : typeof e == "string" ? (l = l.then(async () => {
4485
- v && (O(), d = e, w ? (T = Or(e, w), E = Math.min(1, T.length), w.layout === "RESERVED" && (r.setText({
4536
+ return c ? Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : typeof e == "string" ? (l = l.then(async () => {
4537
+ v && (O(), d = e, w ? (T = Dr(e, w), E = Math.min(1, T.length), w.layout === "RESERVED" && (r.setText({
4486
4538
  styleName: u.textStyle,
4487
4539
  target: v.targets.text,
4488
- text: $r(e, u, r)
4540
+ text: oi(e, u, r)
4489
4541
  }), v.captureTextLayout?.()), await _(), k()) : await _());
4490
- }), l) : Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble text must be a string."));
4542
+ }), l) : Promise.reject(new Q("BUBBLE-COMPOSITION-001", "Bubble text must be a string."));
4491
4543
  },
4492
4544
  updateStyle(e) {
4493
- if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4545
+ if (c) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4494
4546
  let t;
4495
4547
  try {
4496
- t = Br(e);
4548
+ t = qr(e);
4497
4549
  } catch (e) {
4498
4550
  return Promise.reject(e);
4499
4551
  }
4500
4552
  return l = l.then(async () => {
4501
4553
  if (!v) return;
4502
- Yr(v, t);
4554
+ ni(v, t);
4503
4555
  let e = f(t);
4504
4556
  for (let e of [
4505
4557
  t.audio?.voice,
4506
4558
  t.audio?.reveal,
4507
4559
  t.audio?.finish,
4508
4560
  t.reveal?.sound
4509
- ]) e !== void 0 && Zr(n, e);
4561
+ ]) e !== void 0 && ii(n, e);
4510
4562
  await Promise.all([
4511
4563
  x?.stop(),
4512
4564
  S?.stop(),
4513
4565
  C?.stop()
4514
- ]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? Or(d, w) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, O(), w?.layout === "RESERVED" && (r.setText({
4566
+ ]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? Dr(d, w) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, O(), w?.layout === "RESERVED" && (r.setText({
4515
4567
  styleName: t.textStyle,
4516
4568
  target: v.targets.text,
4517
- text: $r(d, t, r)
4569
+ text: oi(d, t, r)
4518
4570
  }), v.captureTextLayout?.()), r.setText({
4519
4571
  styleName: t.textStyle,
4520
4572
  target: v.targets.text,
4521
- text: $r(d, t, r)
4573
+ text: oi(d, t, r)
4522
4574
  }), g(t, e, v), await Promise.all([
4523
4575
  v.setLayerVisible("portraitBase", t.portrait !== void 0),
4524
4576
  v.setLayerVisible("portraitBlink", t.portrait?.blink !== void 0),
@@ -4530,31 +4582,31 @@ function ri(e) {
4530
4582
  }), l;
4531
4583
  },
4532
4584
  setAnimationMode(e) {
4533
- return c ? Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : jr.has(e) ? (l = l.then(() => A(e)), l) : Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid."));
4585
+ return c ? Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : Lr.has(e) ? (l = l.then(() => A(e)), l) : Promise.reject(new Q("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid."));
4534
4586
  },
4535
4587
  revealNext() {
4536
- if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4588
+ if (c) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4537
4589
  let e = !1;
4538
4590
  return l = l.then(async () => {
4539
4591
  e = await te(), e && k();
4540
4592
  }), l.then(() => e);
4541
4593
  },
4542
4594
  revealAll() {
4543
- return c ? Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : (l = l.then(async () => {
4595
+ return c ? Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : (l = l.then(async () => {
4544
4596
  if (O(), w) for (; await te(););
4545
4597
  }), l);
4546
4598
  },
4547
4599
  finish(e = {}) {
4548
- if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4600
+ if (c) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4549
4601
  let t = e.timeoutSeconds ?? 0;
4550
- return !Number.isFinite(t) || t < 0 ? Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble finish timeoutSeconds must be zero or greater.")) : e.condition !== void 0 && typeof e.condition != "function" ? Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble finish condition must be a function.")) : (l = l.then(async () => {
4551
- if (O(), e.unit !== void 0 && (w = Er({
4602
+ 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.")) : (l = l.then(async () => {
4603
+ if (O(), e.unit !== void 0 && (w = Tr({
4552
4604
  ...w ?? {},
4553
4605
  unit: e.unit
4554
- }), T = Or(d, w), E = Math.min(1, T.length), w.layout === "RESERVED" && v && (r.setText({
4606
+ }), T = Dr(d, w), E = Math.min(1, T.length), w.layout === "RESERVED" && v && (r.setText({
4555
4607
  styleName: u.textStyle,
4556
4608
  target: v.targets.text,
4557
- text: $r(d, u, r)
4609
+ text: oi(d, u, r)
4558
4610
  }), v.captureTextLayout?.())), w) for (; await te(););
4559
4611
  let n = e.condition;
4560
4612
  if (n === void 0 && t === 0) {
@@ -4585,10 +4637,10 @@ function ri(e) {
4585
4637
  }), l);
4586
4638
  },
4587
4639
  animate(e) {
4588
- if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4640
+ if (c) return Promise.reject(new Q("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
4589
4641
  let t;
4590
4642
  try {
4591
- t = Rr(e, "Bubble motion");
4643
+ t = Gr(e, "Bubble motion");
4592
4644
  } catch (e) {
4593
4645
  return Promise.reject(e);
4594
4646
  }
@@ -4631,7 +4683,7 @@ function ri(e) {
4631
4683
  } catch (t) {
4632
4684
  e.push(t);
4633
4685
  }
4634
- o.get(s.actorKey) === j && o.delete(s.actorKey), ei(e, `Failed to close bubble: ${s.actorKey}`);
4686
+ o.get(s.actorKey) === j && o.delete(s.actorKey), si(e, `Failed to close bubble: ${s.actorKey}`);
4635
4687
  }
4636
4688
  });
4637
4689
  return o.set(s.actorKey, j), k(), u.showAnimation !== void 0 && await j.animate(u.showAnimation), j;
@@ -4663,34 +4715,34 @@ function ri(e) {
4663
4715
  return Object.freeze({
4664
4716
  defineStyle(e) {
4665
4717
  l();
4666
- let t = Br(e);
4718
+ let t = qr(e);
4667
4719
  a.set(t.name, t);
4668
4720
  },
4669
4721
  hasActiveBubble(e) {
4670
- return o.has($(e, "Bubble actor key"));
4722
+ return o.has(Vr(e, "Bubble actor key"));
4671
4723
  },
4672
4724
  async show(e) {
4673
4725
  l();
4674
- let t = ni(e);
4726
+ let t = li(e);
4675
4727
  return u(t.actorKey, () => d(t));
4676
4728
  },
4677
4729
  releaseTarget(e) {
4678
4730
  l();
4679
- let t = $(e, "Bubble actor key");
4731
+ let t = Vr(e, "Bubble actor key");
4680
4732
  return u(t, async () => {
4681
4733
  await o.get(t)?.close();
4682
4734
  });
4683
4735
  },
4684
4736
  async releaseAll() {
4685
- l(), await Promise.allSettled([...s.values()]), ei((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
4737
+ l(), await Promise.allSettled([...s.values()]), si((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
4686
4738
  },
4687
4739
  async dispose() {
4688
4740
  if (c) return;
4689
4741
  c = !0, await Promise.allSettled([...s.values()]);
4690
4742
  let e = await Promise.allSettled([...o.values()].map((e) => e.close()));
4691
- a.clear(), ei(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
4743
+ a.clear(), si(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
4692
4744
  }
4693
4745
  });
4694
4746
  }
4695
4747
  //#endregion
4696
- export { Z as BubbleCompositionError, hr as UnicodeLineBreakProvider, ee as actorRelativeBubbleCenter, d as bubbleBackgroundRegions, be as bubbleBodyCenterOffset, u as bubbleDirectionAliases, l as bubbleDirectionNames, Cr as bubbleRevealUnits, M as bubbleVisualStyles, ri as createBubbleComposition, x as defaultBubbleDistance, C as defaultBubbleOffset, f as defaultBubblePlacementInput, S as defaultBubbleTailLength, T as normalizeBubbleDistance, D as normalizeBubbleOffset, y as normalizeBubblePlacement, Er as normalizeBubbleReveal, E as normalizeBubbleTailLength, Se as renderBubbleSvg, kr as revealedBubbleText, Or as splitBubbleText, Sr as wrapText };
4748
+ export { Q as BubbleCompositionError, mr as UnicodeLineBreakProvider, ee as actorRelativeBubbleCenter, d as bubbleBackgroundRegions, be as bubbleBodyCenterOffset, u as bubbleDirectionAliases, l as bubbleDirectionNames, kr as bubblePortraitPlacements, Sr as bubbleRevealUnits, M as bubbleVisualStyles, ui as createBubbleComposition, x as defaultBubbleDistance, C as defaultBubbleOffset, f as defaultBubblePlacementInput, Mr as defaultBubblePortraitCornerRadius, jr as defaultBubblePortraitOffset, Ar as defaultBubblePortraitPlacement, S as defaultBubbleTailLength, T as normalizeBubbleDistance, D as normalizeBubbleOffset, y as normalizeBubblePlacement, Fr as normalizeBubblePortraitCornerRadius, Pr as normalizeBubblePortraitOffset, Nr as normalizeBubblePortraitPlacement, Tr as normalizeBubbleReveal, E as normalizeBubbleTailLength, Se as renderBubbleSvg, Or as revealedBubbleText, Dr as splitBubbleText, xr as wrapText };