@konoui/mjimage 0.9.0 → 0.11.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const vn = "MS Gothic, sans-serif", wt = {
1
+ const Sn = "MS Gothic, sans-serif", wt = {
2
2
  WIDTH: 66,
3
3
  HEIGHT: 90,
4
4
  TEXT_SCALE: 0.8,
@@ -6,7 +6,7 @@ const vn = "MS Gothic, sans-serif", wt = {
6
6
  }, en = {
7
7
  WIDTH: 125,
8
8
  HEIGHT: 27.5
9
- }, bs = { BASE: 40 }, X = ",", p = {
9
+ }, Is = { BASE: 40 }, X = ",", p = {
10
10
  /**
11
11
  * 萬子
12
12
  */
@@ -27,7 +27,7 @@ const vn = "MS Gothic, sans-serif", wt = {
27
27
  * 裏牌
28
28
  */
29
29
  BACK: "_"
30
- }, g = {
30
+ }, m = {
31
31
  /**
32
32
  * ツモ牌を表す
33
33
  */
@@ -148,7 +148,7 @@ const vn = "MS Gothic, sans-serif", wt = {
148
148
  [_.S]: "南",
149
149
  [_.W]: "西",
150
150
  [_.N]: "北"
151
- }, Sn = {
151
+ }, On = {
152
152
  [k.E1]: "東1局",
153
153
  [k.E2]: "東2局",
154
154
  [k.E3]: "東3局",
@@ -170,7 +170,7 @@ function I(s, t) {
170
170
  if (!s)
171
171
  throw new Error(t);
172
172
  }
173
- class Lo {
173
+ class Go {
174
174
  ctx = null;
175
175
  strText;
176
176
  numText;
@@ -197,13 +197,13 @@ class Lo {
197
197
  };
198
198
  measureTableFontContext = (t) => {
199
199
  const e = this.measureFontContext(
200
- vn,
201
- bs.BASE * t
200
+ Sn,
201
+ Is.BASE * t
202
202
  );
203
203
  return e.textHeight = e.textWidth, e.numHeight = e.numWidth, e;
204
204
  };
205
205
  }
206
- class As {
206
+ class Ns {
207
207
  input;
208
208
  position;
209
209
  nextPosition;
@@ -237,29 +237,29 @@ class As {
237
237
  const fe = (s, t) => {
238
238
  if (s.t == t.t) {
239
239
  if (O(s) && O(t)) {
240
- if (s.has(g.RED)) return -1;
241
- if (t.has(g.RED)) return 1;
240
+ if (s.has(m.RED)) return -1;
241
+ if (t.has(m.RED)) return 1;
242
242
  }
243
243
  return s.n - t.n;
244
244
  }
245
245
  const e = [p.M, p.P, p.S, p.Z, p.BACK];
246
246
  return e.indexOf(s.t) - e.indexOf(t.t);
247
- }, Is = (s, t) => {
247
+ }, Ts = (s, t) => {
248
248
  const e = [
249
- g.HORIZONTAL,
250
- g.TSUMO,
251
- g.RON,
252
- g.IMAGE_DORA,
253
- g.COLOR_GRAYSCALE,
254
- g.RED
249
+ m.HORIZONTAL,
250
+ m.TSUMO,
251
+ m.RON,
252
+ m.IMAGE_DORA,
253
+ m.COLOR_GRAYSCALE,
254
+ m.RED
255
255
  ];
256
256
  return e.indexOf(s) - e.indexOf(t);
257
- }, Ns = (s) => {
257
+ }, vs = (s) => {
258
258
  const t = [];
259
259
  s.forEach((n, i) => {
260
- n.has(g.HORIZONTAL) && t.push(i);
260
+ n.has(m.HORIZONTAL) && t.push(i);
261
261
  });
262
- const e = s.filter((n) => !n.has(g.HORIZONTAL)).sort(fe);
262
+ const e = s.filter((n) => !n.has(m.HORIZONTAL)).sort(fe);
263
263
  return t.forEach((n) => {
264
264
  e.splice(n, 0, s[n]);
265
265
  }), e;
@@ -267,7 +267,7 @@ const fe = (s, t) => {
267
267
  function O(s) {
268
268
  return s.isNum() && s.n == 5;
269
269
  }
270
- function Ts(s) {
270
+ function Ss(s) {
271
271
  const t = Object.values(p).find((e) => e === s);
272
272
  return t ? [t, !0] : [p.BACK, !1];
273
273
  }
@@ -287,7 +287,7 @@ class y {
287
287
  * 文字列の牌を返す。
288
288
  */
289
289
  toString() {
290
- return this.t === p.BACK ? this.t : `${[...this.ops].sort(Is).join("")}${this.n}${this.t}`;
290
+ return this.t === p.BACK ? this.t : `${[...this.ops].sort(Ts).join("")}${this.n}${this.t}`;
291
291
  }
292
292
  toJSON() {
293
293
  return this.toString();
@@ -327,7 +327,7 @@ class T {
327
327
  _type;
328
328
  constructor(t, e) {
329
329
  if (this._tiles = t, this._type = e, this.isCalled()) {
330
- this._tiles = Ns(this._tiles);
330
+ this._tiles = vs(this._tiles);
331
331
  return;
332
332
  }
333
333
  if (this._type != E.IMAGE_DISCARD) {
@@ -414,7 +414,7 @@ class T {
414
414
  return e && (n[e.idx] = e.tile), ne(n, this._type);
415
415
  }
416
416
  }
417
- const _t = (s) => s[0].t === p.BACK ? s.join("") : `${s.map((e) => e.toString().slice(0, -1)).join("")}${s[0].t}`, De = (s) => {
417
+ const bt = (s) => s[0].t === p.BACK ? s.join("") : `${s.map((e) => e.toString().slice(0, -1)).join("")}${s[0].t}`, De = (s) => {
418
418
  if (s.length == 0) return "";
419
419
  let t = s[0].t, e = "";
420
420
  for (const i of s) {
@@ -432,7 +432,7 @@ class V extends T {
432
432
  return T.deserialize({ tiles: t, type: E.CHI });
433
433
  }
434
434
  toString() {
435
- return _t(this.tiles);
435
+ return bt(this.tiles);
436
436
  }
437
437
  }
438
438
  class U extends T {
@@ -443,7 +443,7 @@ class U extends T {
443
443
  return T.deserialize({ tiles: t, type: E.PON });
444
444
  }
445
445
  toString() {
446
- return _t(this.tiles);
446
+ return bt(this.tiles);
447
447
  }
448
448
  }
449
449
  class R extends T {
@@ -452,7 +452,7 @@ class R extends T {
452
452
  if (e.length < t.length) {
453
453
  if (O(n)) {
454
454
  const i = new y(n.t, 5);
455
- super([i.clone({ add: g.RED }), i, i, i], E.AN_KAN);
455
+ super([i.clone({ add: m.RED }), i, i, i], E.AN_KAN);
456
456
  return;
457
457
  }
458
458
  super([n, n, n, n], E.AN_KAN);
@@ -470,7 +470,7 @@ class R extends T {
470
470
  * ブロックを構成する裏返しの牌を含む牌の配列を返す。
471
471
  */
472
472
  get tilesWithBack() {
473
- const t = this.tiles[0].clone({ remove: g.RED }), e = O(t) ? t.clone({ add: g.RED }) : t;
473
+ const t = this.tiles[0].clone({ remove: m.RED }), e = O(t) ? t.clone({ add: m.RED }) : t;
474
474
  return [new y(p.BACK, 0), e, t, new y(p.BACK, 0)];
475
475
  }
476
476
  static from(t) {
@@ -488,10 +488,10 @@ class z extends T {
488
488
  return T.deserialize({ tiles: t, type: E.DAI_KAN });
489
489
  }
490
490
  toString() {
491
- return _t(this.tiles);
491
+ return bt(this.tiles);
492
492
  }
493
493
  }
494
- class H extends T {
494
+ class P extends T {
495
495
  constructor(t) {
496
496
  super(t, E.SHO_KAN);
497
497
  }
@@ -503,11 +503,11 @@ class H extends T {
503
503
  * カカンした牌はポンした牌の前に追加される。
504
504
  */
505
505
  static fromPon(t, e) {
506
- const n = t.tiles.findIndex((r) => r.has(g.HORIZONTAL)), i = [...t.tiles];
507
- return i.splice(n, 0, e.clone({ add: g.HORIZONTAL })), new H(i);
506
+ const n = t.tiles.findIndex((r) => r.has(m.HORIZONTAL)), i = [...t.tiles];
507
+ return i.splice(n, 0, e.clone({ add: m.HORIZONTAL })), new P(i);
508
508
  }
509
509
  toString() {
510
- return _t(this.tiles);
510
+ return bt(this.tiles);
511
511
  }
512
512
  }
513
513
  class C extends T {
@@ -515,13 +515,13 @@ class C extends T {
515
515
  super([t, e], E.PAIR);
516
516
  }
517
517
  toString() {
518
- return _t(this.tiles);
518
+ return bt(this.tiles);
519
519
  }
520
520
  static from(t) {
521
521
  return T.deserialize({ tiles: t, type: E.PAIR });
522
522
  }
523
523
  }
524
- class K extends T {
524
+ class L extends T {
525
525
  constructor(t) {
526
526
  super(t, E.THREE);
527
527
  }
@@ -529,7 +529,7 @@ class K extends T {
529
529
  return T.deserialize({ tiles: t, type: E.THREE });
530
530
  }
531
531
  toString() {
532
- return _t(this.tiles);
532
+ return bt(this.tiles);
533
533
  }
534
534
  }
535
535
  class gt extends T {
@@ -540,10 +540,10 @@ class gt extends T {
540
540
  return T.deserialize({ tiles: t, type: E.RUN });
541
541
  }
542
542
  toString() {
543
- return _t(this.tiles);
543
+ return bt(this.tiles);
544
544
  }
545
545
  }
546
- class On extends T {
546
+ class kn extends T {
547
547
  constructor(t) {
548
548
  super([t], E.ISOLATED);
549
549
  }
@@ -568,7 +568,7 @@ class Tt extends T {
568
568
  return De(this.tiles);
569
569
  }
570
570
  }
571
- class Ke extends T {
571
+ class Le extends T {
572
572
  constructor(t, e) {
573
573
  super(t, e);
574
574
  }
@@ -579,9 +579,9 @@ class Ke extends T {
579
579
  const ne = (s, t) => {
580
580
  switch (t) {
581
581
  case E.CHI:
582
- const e = s.find((i) => i.has(g.HORIZONTAL));
582
+ const e = s.find((i) => i.has(m.HORIZONTAL));
583
583
  I(e != null, `chi block does not have horizontal ops: ${s}`);
584
- const n = s.filter((i) => !i.has(g.HORIZONTAL));
584
+ const n = s.filter((i) => !i.has(m.HORIZONTAL));
585
585
  return new V([e, n[0], n[1]]);
586
586
  case E.PON:
587
587
  return new U([s[0], s[1], s[2]]);
@@ -590,19 +590,19 @@ const ne = (s, t) => {
590
590
  case E.DAI_KAN:
591
591
  return new z(s);
592
592
  case E.SHO_KAN:
593
- return new H(s);
593
+ return new P(s);
594
594
  case E.THREE:
595
- return new K(s);
595
+ return new L(s);
596
596
  case E.RUN:
597
597
  return new gt(s);
598
598
  case E.PAIR:
599
599
  return new C(s[0], s[1]);
600
600
  case E.ISOLATED:
601
- return new On(s[0]);
601
+ return new kn(s[0]);
602
602
  case E.HAND:
603
603
  return new Tt(s);
604
604
  default:
605
- return new Ke(s, t);
605
+ return new Le(s, t);
606
606
  }
607
607
  };
608
608
  class D {
@@ -630,7 +630,7 @@ class D {
630
630
  * セパレータ前後は一つのブロックを意味する。
631
631
  */
632
632
  tileSeparators() {
633
- const t = new As(this.input), e = [];
633
+ const t = new Ns(this.input), e = [];
634
634
  let n = [];
635
635
  for (this.validate(this.input); ; ) {
636
636
  t.skipWhitespace();
@@ -646,15 +646,15 @@ class D {
646
646
  e.push(new y(r, 0)), t.readChar();
647
647
  continue;
648
648
  }
649
- e.push(...Ss(n, r)), n = [], t.readChar();
649
+ e.push(...ks(n, r)), n = [], t.readChar();
650
650
  continue;
651
651
  } else {
652
- const [a, c] = Os(t);
652
+ const [a, c] = Cs(t);
653
653
  if (c) {
654
654
  n.push(a), t.readChar();
655
655
  continue;
656
656
  }
657
- const [l, d] = kn(i);
657
+ const [l, d] = Cn(i);
658
658
  if (!d) throw new Error(`expected a number but got: ${i}`);
659
659
  n.push({ n: l });
660
660
  }
@@ -666,12 +666,12 @@ class D {
666
666
  }
667
667
  reconstruct(t) {
668
668
  if (t.length > 18) return t;
669
- const e = t.findIndex((a) => a instanceof y && a.has(g.TSUMO));
669
+ const e = t.findIndex((a) => a instanceof y && a.has(m.TSUMO));
670
670
  if (e < 0) return t;
671
671
  const n = t.findIndex((a) => a === X);
672
672
  if (n > -1 && e > n) return t;
673
673
  const i = n < 0 ? t.length : n, r = t.slice(0, i), o = r[e];
674
- return r.some((a) => a instanceof y && a.has(g.HORIZONTAL)) ? t : [
674
+ return r.some((a) => a instanceof y && a.has(m.HORIZONTAL)) ? t : [
675
675
  ...r.slice(0, e),
676
676
  ...r.slice(e + 1, i),
677
677
  X,
@@ -708,14 +708,14 @@ class D {
708
708
  function nn(s) {
709
709
  if (s.length === 0) return E.UNKNOWN;
710
710
  if (s.length === 1)
711
- return s[0].has(g.IMAGE_DORA) ? E.IMAGE_DORA : s[0].has(g.TSUMO) ? E.TSUMO : E.HAND;
712
- const t = s.every((r) => r.equals(s[0])), e = s.filter((r) => r.has(g.HORIZONTAL)).length, n = s.filter(
713
- (r) => r.has(g.TSUMO) || r.has(g.IMAGE_DORA)
711
+ return s[0].has(m.IMAGE_DORA) ? E.IMAGE_DORA : s[0].has(m.TSUMO) ? E.TSUMO : E.HAND;
712
+ const t = s.every((r) => r.equals(s[0])), e = s.filter((r) => r.has(m.HORIZONTAL)).length, n = s.filter(
713
+ (r) => r.has(m.TSUMO) || r.has(m.IMAGE_DORA)
714
714
  ).length, i = s.filter((r) => r.t == p.BACK).length;
715
715
  if (n > 0) return E.UNKNOWN;
716
716
  if (e == 0 && i == 0) return E.HAND;
717
717
  if (s.length === 3 && i === 0)
718
- return t ? E.PON : e == 1 && vs(s) ? E.CHI : E.IMAGE_DISCARD;
718
+ return t ? E.PON : e == 1 && Os(s) ? E.CHI : E.IMAGE_DISCARD;
719
719
  if (s.length == 4 && i == 2) return E.AN_KAN;
720
720
  if (s.length == 4 && t) {
721
721
  if (e == 1) return E.DAI_KAN;
@@ -723,7 +723,7 @@ function nn(s) {
723
723
  }
724
724
  return e == 1 || n == 0 ? E.IMAGE_DISCARD : E.UNKNOWN;
725
725
  }
726
- function vs(s) {
726
+ function Os(s) {
727
727
  const t = [...s].sort(fe);
728
728
  if (t.some((n) => t[0].t != n.t)) return !1;
729
729
  const e = t.map((n) => n.n);
@@ -731,14 +731,14 @@ function vs(s) {
731
731
  if (e[n] != e[n + 1] - 1) return !1;
732
732
  return !0;
733
733
  }
734
- function Ss(s, t) {
734
+ function ks(s, t) {
735
735
  return s.map((e) => {
736
736
  let n = new y(t, e.n, e.ops);
737
- return n.isNum() && n.n == 0 && (n = n.clone({ n: 5, add: g.RED })), n;
737
+ return n.isNum() && n.n == 0 && (n = n.clone({ n: 5, add: m.RED })), n;
738
738
  });
739
739
  }
740
740
  function sn(s, t) {
741
- const [e, n] = Ts(s);
741
+ const [e, n] = Ss(s);
742
742
  if (n) return [e, !0];
743
743
  if ((s === "w" || s === "d") && t.length > 0) {
744
744
  for (let r = 0; r < t.length; r++) {
@@ -749,49 +749,46 @@ function sn(s, t) {
749
749
  }
750
750
  return [p.BACK, !1];
751
751
  }
752
- function kn(s) {
752
+ function Cn(s) {
753
753
  const t = Number(s), e = 0 <= t && t <= 9;
754
754
  return [t, e];
755
755
  }
756
- function Os(s) {
757
- const t = Object.values(g);
756
+ function Cs(s) {
757
+ const t = Object.values(m);
758
758
  if (!t.includes(s.char)) return [new y(p.BACK, 0), !1];
759
759
  const e = [];
760
760
  for (let n = 0; n < 4; n++) {
761
761
  const i = s.peekCharN(n);
762
762
  if (t.includes(i)) e.push(i);
763
763
  else {
764
- const [r, o] = kn(i);
764
+ const [r, o] = Cn(i);
765
765
  if (!o) break;
766
766
  for (const c of e) s.readChar();
767
767
  const a = new y(p.BACK, r, e);
768
- if (a.has(g.RED) && a.n != 5)
768
+ if (a.has(m.RED) && a.n != 5)
769
769
  throw new Error(`red dora operator can only be used with 5, got: ${r}`);
770
- if (a.has(g.IMAGE_DORA) && a.has(g.TSUMO))
770
+ if (a.has(m.IMAGE_DORA) && a.has(m.TSUMO))
771
771
  throw new Error("cannot specify both dora and tsumo operators");
772
772
  return [a, !0];
773
773
  }
774
774
  }
775
775
  return [new y(p.BACK, 0), !1];
776
776
  }
777
- function W(s, t = !1) {
778
- const e = {
779
- [_.E]: s,
780
- [_.S]: s,
781
- [_.W]: s,
782
- [_.N]: s
777
+ function W(s) {
778
+ return {
779
+ [_.E]: s(),
780
+ [_.S]: s(),
781
+ [_.W]: s(),
782
+ [_.N]: s()
783
783
  };
784
- if (t)
785
- for (let n of Object.values(_)) e[n] = structuredClone(s);
786
- return e;
787
784
  }
788
785
  const te = (s) => {
789
786
  let t = s.substring(0, 2), e = Number(s.substring(2, 3));
790
787
  return e == 4 ? (e = 1, t = vt(t)) : e++, `${t}${e}`;
791
- }, zo = (s) => te(te(te(s))), ks = (s) => s.substring(0, 2), vt = (s) => {
788
+ }, Zo = (s) => te(te(te(s))), Rs = (s) => s.substring(0, 2), vt = (s) => {
792
789
  let t = Number(s.toString()[0]);
793
790
  return t = t % 4 + 1, `${t}${p.Z}`;
794
- }, Le = (s) => {
791
+ }, Ke = (s) => {
795
792
  let t = Number(s.toString()[0]);
796
793
  const e = [1, 4, 3, 2], n = e.indexOf(t);
797
794
  return `${e[(n + 1) % e.length]}${p.Z}`;
@@ -835,12 +832,12 @@ function ze(...s) {
835
832
  }
836
833
  }
837
834
  }
838
- function Cs(...s) {
835
+ function Ms(...s) {
839
836
  return ze(...s);
840
837
  }
841
- const { cos: Rs, sin: Ms, PI: xs } = Math;
842
- function $s(s, t, e) {
843
- const n = Rs(s), i = Ms(s), r = {
838
+ const { cos: xs, sin: $s, PI: Ps } = Math;
839
+ function Hs(s, t, e) {
840
+ const n = xs(s), i = $s(s), r = {
844
841
  a: n,
845
842
  c: -i,
846
843
  e: 0,
@@ -854,17 +851,17 @@ function $s(s, t, e) {
854
851
  Ne(-t, -e)
855
852
  ]);
856
853
  }
857
- function Hs(s, t = void 0, e = void 0) {
858
- return $s(s * xs / 180, t, e);
854
+ function Bs(s, t = void 0, e = void 0) {
855
+ return Hs(s * Ps / 180, t, e);
859
856
  }
860
- function Ps(s) {
861
- return Bs(s);
857
+ function Ws(s) {
858
+ return Ds(s);
862
859
  }
863
- function Bs(s) {
860
+ function Ds(s) {
864
861
  return `matrix(${s.a},${s.b},${s.c},${s.d},${s.e},${s.f})`;
865
862
  }
866
- const Cn = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", Ws = Cn + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", Ds = "[" + Cn + "][" + Ws + "]*", Ks = new RegExp("^" + Ds + "$");
867
- function Rn(s, t) {
863
+ const Rn = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", Ls = Rn + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", Ks = "[" + Rn + "][" + Ls + "]*", zs = new RegExp("^" + Ks + "$");
864
+ function Mn(s, t) {
868
865
  const e = [];
869
866
  let n = t.exec(s);
870
867
  for (; n; ) {
@@ -878,19 +875,19 @@ function Rn(s, t) {
878
875
  return e;
879
876
  }
880
877
  const pe = function(s) {
881
- const t = Ks.exec(s);
878
+ const t = zs.exec(s);
882
879
  return !(t === null || typeof t > "u");
883
880
  };
884
- function Ls(s) {
881
+ function Us(s) {
885
882
  return typeof s < "u";
886
883
  }
887
- const zs = {
884
+ const js = {
888
885
  allowBooleanAttributes: !1,
889
886
  //A tag can have attributes without any value
890
887
  unpairedTags: []
891
888
  };
892
- function Us(s, t) {
893
- t = Object.assign({}, zs, t);
889
+ function Fs(s, t) {
890
+ t = Object.assign({}, js, t);
894
891
  const e = [];
895
892
  let n = !1, i = !1;
896
893
  s[0] === "\uFEFF" && (s = s.substr(1));
@@ -909,11 +906,11 @@ function Us(s, t) {
909
906
  for (; r < s.length && s[r] !== ">" && s[r] !== " " && s[r] !== " " && s[r] !== `
910
907
  ` && s[r] !== "\r"; r++)
911
908
  c += s[r];
912
- if (c = c.trim(), c[c.length - 1] === "/" && (c = c.substring(0, c.length - 1), r--), !Xs(c)) {
909
+ if (c = c.trim(), c[c.length - 1] === "/" && (c = c.substring(0, c.length - 1), r--), !Qs(c)) {
913
910
  let h;
914
911
  return c.trim().length === 0 ? h = "Invalid space after '<'." : h = "Tag '" + c + "' is an invalid name.", v("InvalidTag", h, $(s, r));
915
912
  }
916
- const l = Gs(s, r);
913
+ const l = Ys(s, r);
917
914
  if (l === !1)
918
915
  return v("InvalidAttr", "Attributes for '" + c + "' have open quote.", $(s, r));
919
916
  let d = l.value;
@@ -962,7 +959,7 @@ function Us(s, t) {
962
959
  } else
963
960
  break;
964
961
  else if (s[r] === "&") {
965
- const h = Vs(s, r);
962
+ const h = Xs(s, r);
966
963
  if (h == -1)
967
964
  return v("InvalidChar", "char '&' is not expected.", $(s, r));
968
965
  r = h;
@@ -1025,11 +1022,11 @@ function ln(s, t) {
1025
1022
  }
1026
1023
  return t;
1027
1024
  }
1028
- const js = '"', Fs = "'";
1029
- function Gs(s, t) {
1025
+ const Gs = '"', Zs = "'";
1026
+ function Ys(s, t) {
1030
1027
  let e = "", n = "", i = !1;
1031
1028
  for (; t < s.length; t++) {
1032
- if (s[t] === js || s[t] === Fs)
1029
+ if (s[t] === Gs || s[t] === Zs)
1033
1030
  n === "" ? n = s[t] : n !== s[t] || (n = "");
1034
1031
  else if (s[t] === ">" && n === "") {
1035
1032
  i = !0;
@@ -1043,9 +1040,9 @@ function Gs(s, t) {
1043
1040
  tagClosed: i
1044
1041
  };
1045
1042
  }
1046
- const Zs = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
1043
+ const Vs = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
1047
1044
  function hn(s, t) {
1048
- const e = Rn(s, Zs), n = {};
1045
+ const e = Mn(s, Vs), n = {};
1049
1046
  for (let i = 0; i < e.length; i++) {
1050
1047
  if (e[i][1].length === 0)
1051
1048
  return v("InvalidAttr", "Attribute '" + e[i][2] + "' has no space in starting.", Wt(e[i]));
@@ -1054,7 +1051,7 @@ function hn(s, t) {
1054
1051
  if (e[i][3] === void 0 && !t.allowBooleanAttributes)
1055
1052
  return v("InvalidAttr", "boolean attribute '" + e[i][2] + "' is not allowed.", Wt(e[i]));
1056
1053
  const r = e[i][2];
1057
- if (!Js(r))
1054
+ if (!qs(r))
1058
1055
  return v("InvalidAttr", "Attribute '" + r + "' is an invalid name.", Wt(e[i]));
1059
1056
  if (!n.hasOwnProperty(r))
1060
1057
  n[r] = 1;
@@ -1063,7 +1060,7 @@ function hn(s, t) {
1063
1060
  }
1064
1061
  return !0;
1065
1062
  }
1066
- function Ys(s, t) {
1063
+ function Js(s, t) {
1067
1064
  let e = /\d/;
1068
1065
  for (s[t] === "x" && (t++, e = /[\da-fA-F]/); t < s.length; t++) {
1069
1066
  if (s[t] === ";")
@@ -1073,11 +1070,11 @@ function Ys(s, t) {
1073
1070
  }
1074
1071
  return -1;
1075
1072
  }
1076
- function Vs(s, t) {
1073
+ function Xs(s, t) {
1077
1074
  if (t++, s[t] === ";")
1078
1075
  return -1;
1079
1076
  if (s[t] === "#")
1080
- return t++, Ys(s, t);
1077
+ return t++, Js(s, t);
1081
1078
  let e = 0;
1082
1079
  for (; t < s.length; t++, e++)
1083
1080
  if (!(s[t].match(/\w/) && e < 20)) {
@@ -1097,10 +1094,10 @@ function v(s, t, e) {
1097
1094
  }
1098
1095
  };
1099
1096
  }
1100
- function Js(s) {
1097
+ function qs(s) {
1101
1098
  return pe(s);
1102
1099
  }
1103
- function Xs(s) {
1100
+ function Qs(s) {
1104
1101
  return pe(s);
1105
1102
  }
1106
1103
  function $(s, t) {
@@ -1114,7 +1111,7 @@ function $(s, t) {
1114
1111
  function Wt(s) {
1115
1112
  return s.startIndex + s[1].length;
1116
1113
  }
1117
- const qs = {
1114
+ const ti = {
1118
1115
  preserveOrder: !1,
1119
1116
  attributeNamePrefix: "@_",
1120
1117
  attributesGroupName: !1,
@@ -1158,11 +1155,11 @@ const qs = {
1158
1155
  },
1159
1156
  // skipEmptyListItem: false
1160
1157
  captureMetaData: !1
1161
- }, Qs = function(s) {
1162
- return Object.assign({}, qs, s);
1158
+ }, ei = function(s) {
1159
+ return Object.assign({}, ti, s);
1163
1160
  };
1164
1161
  let se;
1165
- typeof Symbol != "function" ? se = "@@xmlMetadata" : se = Symbol("XML Node Metadata");
1162
+ typeof Symbol != "function" ? se = "@@xmlMetadata" : se = /* @__PURE__ */ Symbol("XML Node Metadata");
1166
1163
  class ft {
1167
1164
  constructor(t) {
1168
1165
  this.tagname = t, this.child = [], this[":@"] = {};
@@ -1178,7 +1175,7 @@ class ft {
1178
1175
  return se;
1179
1176
  }
1180
1177
  }
1181
- class ti {
1178
+ class ni {
1182
1179
  constructor(t) {
1183
1180
  this.suppressValidationErr = !t;
1184
1181
  }
@@ -1192,10 +1189,13 @@ class ti {
1192
1189
  if (r && lt(t, "!ENTITY", e)) {
1193
1190
  e += 7;
1194
1191
  let c, l;
1195
- [c, l, e] = this.readEntityExp(t, e + 1, this.suppressValidationErr), l.indexOf("&") === -1 && (n[c] = {
1196
- regx: RegExp(`&${c};`, "g"),
1197
- val: l
1198
- });
1192
+ if ([c, l, e] = this.readEntityExp(t, e + 1, this.suppressValidationErr), l.indexOf("&") === -1) {
1193
+ const d = c.replace(/[.\-+*:]/g, "\\.");
1194
+ n[c] = {
1195
+ regx: RegExp(`&${d};`, "g"),
1196
+ val: l
1197
+ };
1198
+ }
1199
1199
  } else if (r && lt(t, "!ELEMENT", e)) {
1200
1200
  e += 8;
1201
1201
  const { index: c } = this.readElementExp(t, e + 1);
@@ -1220,11 +1220,11 @@ class ti {
1220
1220
  return { entities: n, i: e };
1221
1221
  }
1222
1222
  readEntityExp(t, e) {
1223
- e = P(t, e);
1223
+ e = H(t, e);
1224
1224
  let n = "";
1225
1225
  for (; e < t.length && !/\s/.test(t[e]) && t[e] !== '"' && t[e] !== "'"; )
1226
1226
  n += t[e], e++;
1227
- if (Dt(n), e = P(t, e), !this.suppressValidationErr) {
1227
+ if (Dt(n), e = H(t, e), !this.suppressValidationErr) {
1228
1228
  if (t.substring(e, e + 6).toUpperCase() === "SYSTEM")
1229
1229
  throw new Error("External entities are not supported");
1230
1230
  if (t[e] === "%")
@@ -1234,18 +1234,18 @@ class ti {
1234
1234
  return [e, i] = this.readIdentifierVal(t, e, "entity"), e--, [n, i, e];
1235
1235
  }
1236
1236
  readNotationExp(t, e) {
1237
- e = P(t, e);
1237
+ e = H(t, e);
1238
1238
  let n = "";
1239
1239
  for (; e < t.length && !/\s/.test(t[e]); )
1240
1240
  n += t[e], e++;
1241
- !this.suppressValidationErr && Dt(n), e = P(t, e);
1241
+ !this.suppressValidationErr && Dt(n), e = H(t, e);
1242
1242
  const i = t.substring(e, e + 6).toUpperCase();
1243
1243
  if (!this.suppressValidationErr && i !== "SYSTEM" && i !== "PUBLIC")
1244
1244
  throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);
1245
- e += i.length, e = P(t, e);
1245
+ e += i.length, e = H(t, e);
1246
1246
  let r = null, o = null;
1247
1247
  if (i === "PUBLIC")
1248
- [e, r] = this.readIdentifierVal(t, e, "publicIdentifier"), e = P(t, e), (t[e] === '"' || t[e] === "'") && ([e, o] = this.readIdentifierVal(t, e, "systemIdentifier"));
1248
+ [e, r] = this.readIdentifierVal(t, e, "publicIdentifier"), e = H(t, e), (t[e] === '"' || t[e] === "'") && ([e, o] = this.readIdentifierVal(t, e, "systemIdentifier"));
1249
1249
  else if (i === "SYSTEM" && ([e, o] = this.readIdentifierVal(t, e, "systemIdentifier"), !this.suppressValidationErr && !o))
1250
1250
  throw new Error("Missing mandatory system identifier for SYSTEM notation");
1251
1251
  return { notationName: n, publicIdentifier: r, systemIdentifier: o, index: --e };
@@ -1262,13 +1262,13 @@ class ti {
1262
1262
  return e++, [e, i];
1263
1263
  }
1264
1264
  readElementExp(t, e) {
1265
- e = P(t, e);
1265
+ e = H(t, e);
1266
1266
  let n = "";
1267
1267
  for (; e < t.length && !/\s/.test(t[e]); )
1268
1268
  n += t[e], e++;
1269
1269
  if (!this.suppressValidationErr && !pe(n))
1270
1270
  throw new Error(`Invalid element name: "${n}"`);
1271
- e = P(t, e);
1271
+ e = H(t, e);
1272
1272
  let i = "";
1273
1273
  if (t[e] === "E" && lt(t, "MPTY", e)) e += 4;
1274
1274
  else if (t[e] === "A" && lt(t, "NY", e)) e += 2;
@@ -1286,20 +1286,20 @@ class ti {
1286
1286
  };
1287
1287
  }
1288
1288
  readAttlistExp(t, e) {
1289
- e = P(t, e);
1289
+ e = H(t, e);
1290
1290
  let n = "";
1291
1291
  for (; e < t.length && !/\s/.test(t[e]); )
1292
1292
  n += t[e], e++;
1293
- Dt(n), e = P(t, e);
1293
+ Dt(n), e = H(t, e);
1294
1294
  let i = "";
1295
1295
  for (; e < t.length && !/\s/.test(t[e]); )
1296
1296
  i += t[e], e++;
1297
1297
  if (!Dt(i))
1298
1298
  throw new Error(`Invalid attribute name: "${i}"`);
1299
- e = P(t, e);
1299
+ e = H(t, e);
1300
1300
  let r = "";
1301
1301
  if (t.substring(e, e + 8).toUpperCase() === "NOTATION") {
1302
- if (r = "NOTATION", e += 8, e = P(t, e), t[e] !== "(")
1302
+ if (r = "NOTATION", e += 8, e = H(t, e), t[e] !== "(")
1303
1303
  throw new Error(`Expected '(', found "${t[e]}"`);
1304
1304
  e++;
1305
1305
  let a = [];
@@ -1309,7 +1309,7 @@ class ti {
1309
1309
  c += t[e], e++;
1310
1310
  if (c = c.trim(), !Dt(c))
1311
1311
  throw new Error(`Invalid notation name: "${c}"`);
1312
- a.push(c), t[e] === "|" && (e++, e = P(t, e));
1312
+ a.push(c), t[e] === "|" && (e++, e = H(t, e));
1313
1313
  }
1314
1314
  if (t[e] !== ")")
1315
1315
  throw new Error("Unterminated list of notations");
@@ -1321,7 +1321,7 @@ class ti {
1321
1321
  if (!this.suppressValidationErr && !a.includes(r.toUpperCase()))
1322
1322
  throw new Error(`Invalid attribute type: "${r}"`);
1323
1323
  }
1324
- e = P(t, e);
1324
+ e = H(t, e);
1325
1325
  let o = "";
1326
1326
  return t.substring(e, e + 8).toUpperCase() === "#REQUIRED" ? (o = "#REQUIRED", e += 8) : t.substring(e, e + 7).toUpperCase() === "#IMPLIED" ? (o = "#IMPLIED", e += 7) : [e, o] = this.readIdentifierVal(t, e, "ATTLIST"), {
1327
1327
  elementName: n,
@@ -1332,7 +1332,7 @@ class ti {
1332
1332
  };
1333
1333
  }
1334
1334
  }
1335
- const P = (s, t) => {
1335
+ const H = (s, t) => {
1336
1336
  for (; t < s.length && /\s/.test(s[t]); )
1337
1337
  t++;
1338
1338
  return t;
@@ -1347,7 +1347,7 @@ function Dt(s) {
1347
1347
  return s;
1348
1348
  throw new Error(`Invalid entity name ${s}`);
1349
1349
  }
1350
- const ei = /^[-+]?0x[a-fA-F0-9]+$/, ni = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, si = {
1350
+ const si = /^[-+]?0x[a-fA-F0-9]+$/, ii = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, ri = {
1351
1351
  hex: !0,
1352
1352
  // oct: false,
1353
1353
  leadingZeros: !0,
@@ -1355,20 +1355,20 @@ const ei = /^[-+]?0x[a-fA-F0-9]+$/, ni = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, s
1355
1355
  eNotation: !0
1356
1356
  //skipLike: /regex/
1357
1357
  };
1358
- function ii(s, t = {}) {
1359
- if (t = Object.assign({}, si, t), !s || typeof s != "string") return s;
1358
+ function oi(s, t = {}) {
1359
+ if (t = Object.assign({}, ri, t), !s || typeof s != "string") return s;
1360
1360
  let e = s.trim();
1361
1361
  if (t.skipLike !== void 0 && t.skipLike.test(e)) return s;
1362
1362
  if (s === "0") return 0;
1363
- if (t.hex && ei.test(e))
1364
- return ci(e, 16);
1365
- if (e.search(/.+[eE].+/) !== -1)
1366
- return oi(s, e, t);
1363
+ if (t.hex && si.test(e))
1364
+ return hi(e, 16);
1365
+ if (e.includes("e") || e.includes("E"))
1366
+ return ci(s, e, t);
1367
1367
  {
1368
- const n = ni.exec(e);
1368
+ const n = ii.exec(e);
1369
1369
  if (n) {
1370
1370
  const i = n[1] || "", r = n[2];
1371
- let o = ai(n[3]);
1371
+ let o = li(n[3]);
1372
1372
  const a = i ? (
1373
1373
  // 0., -00., 000.
1374
1374
  s[r.length + 1] === "."
@@ -1389,10 +1389,10 @@ function ii(s, t = {}) {
1389
1389
  return s;
1390
1390
  }
1391
1391
  }
1392
- const ri = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
1393
- function oi(s, t, e) {
1392
+ const ai = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
1393
+ function ci(s, t, e) {
1394
1394
  if (!e.eNotation) return s;
1395
- const n = t.match(ri);
1395
+ const n = t.match(ai);
1396
1396
  if (n) {
1397
1397
  let i = n[1] || "";
1398
1398
  const r = n[3].indexOf("e") === -1 ? "E" : "e", o = n[2], a = i ? (
@@ -1403,23 +1403,23 @@ function oi(s, t, e) {
1403
1403
  } else
1404
1404
  return s;
1405
1405
  }
1406
- function ai(s) {
1406
+ function li(s) {
1407
1407
  return s && s.indexOf(".") !== -1 && (s = s.replace(/0+$/, ""), s === "." ? s = "0" : s[0] === "." ? s = "0" + s : s[s.length - 1] === "." && (s = s.substring(0, s.length - 1))), s;
1408
1408
  }
1409
- function ci(s, t) {
1409
+ function hi(s, t) {
1410
1410
  if (parseInt) return parseInt(s, t);
1411
1411
  if (Number.parseInt) return Number.parseInt(s, t);
1412
1412
  if (window && window.parseInt) return window.parseInt(s, t);
1413
1413
  throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
1414
1414
  }
1415
- function Mn(s) {
1415
+ function xn(s) {
1416
1416
  return typeof s == "function" ? s : Array.isArray(s) ? (t) => {
1417
1417
  for (const e of s)
1418
1418
  if (typeof e == "string" && t === e || e instanceof RegExp && e.test(t))
1419
1419
  return !0;
1420
1420
  } : () => !1;
1421
1421
  }
1422
- class li {
1422
+ class di {
1423
1423
  constructor(t) {
1424
1424
  if (this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
1425
1425
  apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
@@ -1440,9 +1440,9 @@ class li {
1440
1440
  copyright: { regex: /&(copy|#169);/g, val: "©" },
1441
1441
  reg: { regex: /&(reg|#174);/g, val: "®" },
1442
1442
  inr: { regex: /&(inr|#8377);/g, val: "₹" },
1443
- num_dec: { regex: /&#([0-9]{1,7});/g, val: (e, n) => String.fromCodePoint(Number.parseInt(n, 10)) },
1444
- num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (e, n) => String.fromCodePoint(Number.parseInt(n, 16)) }
1445
- }, this.addExternalEntities = hi, this.parseXml = gi, this.parseTextData = di, this.resolveNameSpace = ui, this.buildAttributesMap = pi, this.isItStopNode = Ei, this.replaceEntitiesValue = yi, this.readStopNodeData = bi, this.saveTextToParentTag = wi, this.addChild = mi, this.ignoreAttributesFn = Mn(this.options.ignoreAttributes), this.options.stopNodes && this.options.stopNodes.length > 0) {
1443
+ num_dec: { regex: /&#([0-9]{1,7});/g, val: (e, n) => dn(n, 10, "&#") },
1444
+ num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (e, n) => dn(n, 16, "&#x") }
1445
+ }, this.addExternalEntities = ui, this.parseXml = yi, this.parseTextData = fi, this.resolveNameSpace = pi, this.buildAttributesMap = mi, this.isItStopNode = _i, this.replaceEntitiesValue = Ei, this.readStopNodeData = Ii, this.saveTextToParentTag = bi, this.addChild = wi, this.ignoreAttributesFn = xn(this.options.ignoreAttributes), this.options.stopNodes && this.options.stopNodes.length > 0) {
1446
1446
  this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
1447
1447
  for (let e = 0; e < this.options.stopNodes.length; e++) {
1448
1448
  const n = this.options.stopNodes[e];
@@ -1451,24 +1451,24 @@ class li {
1451
1451
  }
1452
1452
  }
1453
1453
  }
1454
- function hi(s) {
1454
+ function ui(s) {
1455
1455
  const t = Object.keys(s);
1456
1456
  for (let e = 0; e < t.length; e++) {
1457
- const n = t[e];
1457
+ const n = t[e], i = n.replace(/[.\-+*:]/g, "\\.");
1458
1458
  this.lastEntities[n] = {
1459
- regex: new RegExp("&" + n + ";", "g"),
1459
+ regex: new RegExp("&" + i + ";", "g"),
1460
1460
  val: s[n]
1461
1461
  };
1462
1462
  }
1463
1463
  }
1464
- function di(s, t, e, n, i, r, o) {
1464
+ function fi(s, t, e, n, i, r, o) {
1465
1465
  if (s !== void 0 && (this.options.trimValues && !n && (s = s.trim()), s.length > 0)) {
1466
1466
  o || (s = this.replaceEntitiesValue(s));
1467
1467
  const a = this.options.tagValueProcessor(t, s, e, i, r);
1468
1468
  return a == null ? s : typeof a != typeof s || a !== s ? a : this.options.trimValues ? ve(s, this.options.parseTagValue, this.options.numberParseOptions) : s.trim() === s ? ve(s, this.options.parseTagValue, this.options.numberParseOptions) : s;
1469
1469
  }
1470
1470
  }
1471
- function ui(s) {
1471
+ function pi(s) {
1472
1472
  if (this.options.removeNSPrefix) {
1473
1473
  const t = s.split(":"), e = s.charAt(0) === "/" ? "/" : "";
1474
1474
  if (t[0] === "xmlns")
@@ -1477,41 +1477,41 @@ function ui(s) {
1477
1477
  }
1478
1478
  return s;
1479
1479
  }
1480
- const fi = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
1481
- function pi(s, t, e) {
1480
+ const gi = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
1481
+ function mi(s, t) {
1482
1482
  if (this.options.ignoreAttributes !== !0 && typeof s == "string") {
1483
- const n = Rn(s, fi), i = n.length, r = {};
1484
- for (let o = 0; o < i; o++) {
1485
- const a = this.resolveNameSpace(n[o][1]);
1486
- if (this.ignoreAttributesFn(a, t))
1483
+ const e = Mn(s, gi), n = e.length, i = {};
1484
+ for (let r = 0; r < n; r++) {
1485
+ const o = this.resolveNameSpace(e[r][1]);
1486
+ if (this.ignoreAttributesFn(o, t))
1487
1487
  continue;
1488
- let c = n[o][4], l = this.options.attributeNamePrefix + a;
1489
- if (a.length)
1490
- if (this.options.transformAttributeName && (l = this.options.transformAttributeName(l)), l === "__proto__" && (l = "#__proto__"), c !== void 0) {
1491
- this.options.trimValues && (c = c.trim()), c = this.replaceEntitiesValue(c);
1492
- const d = this.options.attributeValueProcessor(a, c, t);
1493
- d == null ? r[l] = c : typeof d != typeof c || d !== c ? r[l] = d : r[l] = ve(
1494
- c,
1488
+ let a = e[r][4], c = this.options.attributeNamePrefix + o;
1489
+ if (o.length)
1490
+ if (this.options.transformAttributeName && (c = this.options.transformAttributeName(c)), c === "__proto__" && (c = "#__proto__"), a !== void 0) {
1491
+ this.options.trimValues && (a = a.trim()), a = this.replaceEntitiesValue(a);
1492
+ const l = this.options.attributeValueProcessor(o, a, t);
1493
+ l == null ? i[c] = a : typeof l != typeof a || l !== a ? i[c] = l : i[c] = ve(
1494
+ a,
1495
1495
  this.options.parseAttributeValue,
1496
1496
  this.options.numberParseOptions
1497
1497
  );
1498
- } else this.options.allowBooleanAttributes && (r[l] = !0);
1498
+ } else this.options.allowBooleanAttributes && (i[c] = !0);
1499
1499
  }
1500
- if (!Object.keys(r).length)
1500
+ if (!Object.keys(i).length)
1501
1501
  return;
1502
1502
  if (this.options.attributesGroupName) {
1503
- const o = {};
1504
- return o[this.options.attributesGroupName] = r, o;
1503
+ const r = {};
1504
+ return r[this.options.attributesGroupName] = i, r;
1505
1505
  }
1506
- return r;
1506
+ return i;
1507
1507
  }
1508
1508
  }
1509
- const gi = function(s) {
1509
+ const yi = function(s) {
1510
1510
  s = s.replace(/\r\n?/g, `
1511
1511
  `);
1512
1512
  const t = new ft("!xml");
1513
1513
  let e = t, n = "", i = "";
1514
- const r = new ti(this.options.processEntities);
1514
+ const r = new ni(this.options.processEntities);
1515
1515
  for (let o = 0; o < s.length; o++)
1516
1516
  if (s[o] === "<")
1517
1517
  if (s[o + 1] === "/") {
@@ -1532,7 +1532,7 @@ const gi = function(s) {
1532
1532
  if (!c) throw new Error("Pi Tag is not closed.");
1533
1533
  if (n = this.saveTextToParentTag(n, e, i), !(this.options.ignoreDeclaration && c.tagName === "?xml" || this.options.ignorePiTags)) {
1534
1534
  const l = new ft(c.tagName);
1535
- l.add(this.options.textNodeName, ""), c.tagName !== c.tagExp && c.attrExpPresent && (l[":@"] = this.buildAttributesMap(c.tagExp, i, c.tagName)), this.addChild(e, l, i, o);
1535
+ l.add(this.options.textNodeName, ""), c.tagName !== c.tagExp && c.attrExpPresent && (l[":@"] = this.buildAttributesMap(c.tagExp, i)), this.addChild(e, l, i, o);
1536
1536
  }
1537
1537
  o = c.closeIndex + 1;
1538
1538
  } else if (s.substr(o + 1, 3) === "!--") {
@@ -1553,8 +1553,12 @@ const gi = function(s) {
1553
1553
  } else {
1554
1554
  let c = Te(s, o, this.options.removeNSPrefix), l = c.tagName;
1555
1555
  const d = c.rawTagName;
1556
- let h = c.tagExp, u = c.attrExpPresent, m = c.closeIndex;
1557
- this.options.transformTagName && (l = this.options.transformTagName(l)), e && n && e.tagname !== "!xml" && (n = this.saveTextToParentTag(n, e, i, !1));
1556
+ let h = c.tagExp, u = c.attrExpPresent, g = c.closeIndex;
1557
+ if (this.options.transformTagName) {
1558
+ const b = this.options.transformTagName(l);
1559
+ h === l && (h = b), l = b;
1560
+ }
1561
+ e && n && e.tagname !== "!xml" && (n = this.saveTextToParentTag(n, e, i, !1));
1558
1562
  const f = e;
1559
1563
  f && this.options.unpairedTags.indexOf(f.tagname) !== -1 && (e = this.tagsNodeStack.pop(), i = i.substring(0, i.lastIndexOf("."))), l !== t.tagname && (i += i ? "." + l : l);
1560
1564
  const w = o;
@@ -1565,34 +1569,40 @@ const gi = function(s) {
1565
1569
  else if (this.options.unpairedTags.indexOf(l) !== -1)
1566
1570
  o = c.closeIndex;
1567
1571
  else {
1568
- const S = this.readStopNodeData(s, d, m + 1);
1572
+ const S = this.readStopNodeData(s, d, g + 1);
1569
1573
  if (!S) throw new Error(`Unexpected end of ${d}`);
1570
1574
  o = S.i, b = S.tagContent;
1571
1575
  }
1572
1576
  const A = new ft(l);
1573
- l !== h && u && (A[":@"] = this.buildAttributesMap(h, i, l)), b && (b = this.parseTextData(b, l, i, !0, u, !0, !0)), i = i.substr(0, i.lastIndexOf(".")), A.add(this.options.textNodeName, b), this.addChild(e, A, i, w);
1577
+ l !== h && u && (A[":@"] = this.buildAttributesMap(
1578
+ h,
1579
+ i
1580
+ )), b && (b = this.parseTextData(b, l, i, !0, u, !0, !0)), i = i.substr(0, i.lastIndexOf(".")), A.add(this.options.textNodeName, b), this.addChild(e, A, i, w);
1574
1581
  } else {
1575
1582
  if (h.length > 0 && h.lastIndexOf("/") === h.length - 1) {
1576
- l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), i = i.substr(0, i.length - 1), h = l) : h = h.substr(0, h.length - 1), this.options.transformTagName && (l = this.options.transformTagName(l));
1583
+ if (l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), i = i.substr(0, i.length - 1), h = l) : h = h.substr(0, h.length - 1), this.options.transformTagName) {
1584
+ const A = this.options.transformTagName(l);
1585
+ h === l && (h = A), l = A;
1586
+ }
1577
1587
  const b = new ft(l);
1578
- l !== h && u && (b[":@"] = this.buildAttributesMap(h, i, l)), this.addChild(e, b, i, w), i = i.substr(0, i.lastIndexOf("."));
1588
+ l !== h && u && (b[":@"] = this.buildAttributesMap(h, i)), this.addChild(e, b, i, w), i = i.substr(0, i.lastIndexOf("."));
1579
1589
  } else {
1580
1590
  const b = new ft(l);
1581
- this.tagsNodeStack.push(e), l !== h && u && (b[":@"] = this.buildAttributesMap(h, i, l)), this.addChild(e, b, i, w), e = b;
1591
+ this.tagsNodeStack.push(e), l !== h && u && (b[":@"] = this.buildAttributesMap(h, i)), this.addChild(e, b, i, w), e = b;
1582
1592
  }
1583
- n = "", o = m;
1593
+ n = "", o = g;
1584
1594
  }
1585
1595
  }
1586
1596
  else
1587
1597
  n += s[o];
1588
1598
  return t.child;
1589
1599
  };
1590
- function mi(s, t, e, n) {
1600
+ function wi(s, t, e, n) {
1591
1601
  this.options.captureMetaData || (n = void 0);
1592
1602
  const i = this.options.updateTag(t.tagname, e, t[":@"]);
1593
1603
  i === !1 || (typeof i == "string" && (t.tagname = i), s.addChild(t, n));
1594
1604
  }
1595
- const yi = function(s) {
1605
+ const Ei = function(s) {
1596
1606
  if (this.options.processEntities) {
1597
1607
  for (let t in this.docTypeEntities) {
1598
1608
  const e = this.docTypeEntities[t];
@@ -1611,7 +1621,7 @@ const yi = function(s) {
1611
1621
  }
1612
1622
  return s;
1613
1623
  };
1614
- function wi(s, t, e, n) {
1624
+ function bi(s, t, e, n) {
1615
1625
  return s && (n === void 0 && (n = t.child.length === 0), s = this.parseTextData(
1616
1626
  s,
1617
1627
  t.tagname,
@@ -1621,10 +1631,10 @@ function wi(s, t, e, n) {
1621
1631
  n
1622
1632
  ), s !== void 0 && s !== "" && t.add(this.options.textNodeName, s), s = ""), s;
1623
1633
  }
1624
- function Ei(s, t, e, n) {
1634
+ function _i(s, t, e, n) {
1625
1635
  return !!(t && t.has(n) || s && s.has(e));
1626
1636
  }
1627
- function _i(s, t, e = ">") {
1637
+ function Ai(s, t, e = ">") {
1628
1638
  let n, i = "";
1629
1639
  for (let r = t; r < s.length; r++) {
1630
1640
  let o = s[r];
@@ -1655,7 +1665,7 @@ function mt(s, t, e, n) {
1655
1665
  return i + t.length - 1;
1656
1666
  }
1657
1667
  function Te(s, t, e, n = ">") {
1658
- const i = _i(s, t + 1, n);
1668
+ const i = Ai(s, t + 1, n);
1659
1669
  if (!i) return;
1660
1670
  let r = i.data;
1661
1671
  const o = i.index, a = r.search(/\s/);
@@ -1674,7 +1684,7 @@ function Te(s, t, e, n = ">") {
1674
1684
  rawTagName: d
1675
1685
  };
1676
1686
  }
1677
- function bi(s, t, e) {
1687
+ function Ii(s, t, e) {
1678
1688
  const n = e;
1679
1689
  let i = 1;
1680
1690
  for (; e < s.length; e++)
@@ -1701,19 +1711,23 @@ function bi(s, t, e) {
1701
1711
  function ve(s, t, e) {
1702
1712
  if (t && typeof s == "string") {
1703
1713
  const n = s.trim();
1704
- return n === "true" ? !0 : n === "false" ? !1 : ii(s, e);
1714
+ return n === "true" ? !0 : n === "false" ? !1 : oi(s, e);
1705
1715
  } else
1706
- return Ls(s) ? s : "";
1716
+ return Us(s) ? s : "";
1717
+ }
1718
+ function dn(s, t, e) {
1719
+ const n = Number.parseInt(s, t);
1720
+ return n >= 0 && n <= 1114111 ? String.fromCodePoint(n) : e + s + ";";
1707
1721
  }
1708
1722
  const we = ft.getMetaDataSymbol();
1709
- function Ai(s, t) {
1710
- return xn(s, t);
1723
+ function Ni(s, t) {
1724
+ return $n(s, t);
1711
1725
  }
1712
- function xn(s, t, e) {
1726
+ function $n(s, t, e) {
1713
1727
  let n;
1714
1728
  const i = {};
1715
1729
  for (let r = 0; r < s.length; r++) {
1716
- const o = s[r], a = Ii(o);
1730
+ const o = s[r], a = Ti(o);
1717
1731
  let c = "";
1718
1732
  if (e === void 0 ? c = a : c = e + "." + a, a === t.textNodeName)
1719
1733
  n === void 0 ? n = o[a] : n += "" + o[a];
@@ -1721,22 +1735,22 @@ function xn(s, t, e) {
1721
1735
  if (a === void 0)
1722
1736
  continue;
1723
1737
  if (o[a]) {
1724
- let l = xn(o[a], t, c);
1725
- const d = Ti(l, t);
1726
- o[we] !== void 0 && (l[we] = o[we]), o[":@"] ? Ni(l, o[":@"], c, t) : Object.keys(l).length === 1 && l[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? l = l[t.textNodeName] : Object.keys(l).length === 0 && (t.alwaysCreateTextNode ? l[t.textNodeName] = "" : l = ""), i[a] !== void 0 && i.hasOwnProperty(a) ? (Array.isArray(i[a]) || (i[a] = [i[a]]), i[a].push(l)) : t.isArray(a, c, d) ? i[a] = [l] : i[a] = l;
1738
+ let l = $n(o[a], t, c);
1739
+ const d = Si(l, t);
1740
+ o[we] !== void 0 && (l[we] = o[we]), o[":@"] ? vi(l, o[":@"], c, t) : Object.keys(l).length === 1 && l[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? l = l[t.textNodeName] : Object.keys(l).length === 0 && (t.alwaysCreateTextNode ? l[t.textNodeName] = "" : l = ""), i[a] !== void 0 && i.hasOwnProperty(a) ? (Array.isArray(i[a]) || (i[a] = [i[a]]), i[a].push(l)) : t.isArray(a, c, d) ? i[a] = [l] : i[a] = l;
1727
1741
  }
1728
1742
  }
1729
1743
  }
1730
1744
  return typeof n == "string" ? n.length > 0 && (i[t.textNodeName] = n) : n !== void 0 && (i[t.textNodeName] = n), i;
1731
1745
  }
1732
- function Ii(s) {
1746
+ function Ti(s) {
1733
1747
  const t = Object.keys(s);
1734
1748
  for (let e = 0; e < t.length; e++) {
1735
1749
  const n = t[e];
1736
1750
  if (n !== ":@") return n;
1737
1751
  }
1738
1752
  }
1739
- function Ni(s, t, e, n) {
1753
+ function vi(s, t, e, n) {
1740
1754
  if (t) {
1741
1755
  const i = Object.keys(t), r = i.length;
1742
1756
  for (let o = 0; o < r; o++) {
@@ -1745,13 +1759,13 @@ function Ni(s, t, e, n) {
1745
1759
  }
1746
1760
  }
1747
1761
  }
1748
- function Ti(s, t) {
1762
+ function Si(s, t) {
1749
1763
  const { textNodeName: e } = t, n = Object.keys(s).length;
1750
1764
  return !!(n === 0 || n === 1 && (s[e] || typeof s[e] == "boolean" || s[e] === 0));
1751
1765
  }
1752
- class vi {
1766
+ class Oi {
1753
1767
  constructor(t) {
1754
- this.externalEntities = {}, this.options = Qs(t);
1768
+ this.externalEntities = {}, this.options = ei(t);
1755
1769
  }
1756
1770
  /**
1757
1771
  * Parse XML dats to JS object
@@ -1765,14 +1779,14 @@ class vi {
1765
1779
  throw new Error("XML data is accepted in String or Bytes[] form.");
1766
1780
  if (e) {
1767
1781
  e === !0 && (e = {});
1768
- const r = Us(t, e);
1782
+ const r = Fs(t, e);
1769
1783
  if (r !== !0)
1770
1784
  throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`);
1771
1785
  }
1772
- const n = new li(this.options);
1786
+ const n = new di(this.options);
1773
1787
  n.addExternalEntities(this.externalEntities);
1774
1788
  const i = n.parseXml(t);
1775
- return this.options.preserveOrder || i === void 0 ? i : Ai(i, this.options);
1789
+ return this.options.preserveOrder || i === void 0 ? i : Ni(i, this.options);
1776
1790
  }
1777
1791
  /**
1778
1792
  * Add Entity which is not by default supported by this library
@@ -1802,21 +1816,21 @@ class vi {
1802
1816
  return ft.getMetaDataSymbol();
1803
1817
  }
1804
1818
  }
1805
- const Si = `
1819
+ const ki = `
1806
1820
  `;
1807
- function Oi(s, t) {
1821
+ function Ci(s, t) {
1808
1822
  let e = "";
1809
- return t.format && t.indentBy.length > 0 && (e = Si), $n(s, t, "", e);
1823
+ return t.format && t.indentBy.length > 0 && (e = ki), Pn(s, t, "", e);
1810
1824
  }
1811
- function $n(s, t, e, n) {
1825
+ function Pn(s, t, e, n) {
1812
1826
  let i = "", r = !1;
1813
1827
  for (let o = 0; o < s.length; o++) {
1814
- const a = s[o], c = ki(a);
1828
+ const a = s[o], c = Ri(a);
1815
1829
  if (c === void 0) continue;
1816
1830
  let l = "";
1817
1831
  if (e.length === 0 ? l = c : l = `${e}.${c}`, c === t.textNodeName) {
1818
1832
  let f = a[c];
1819
- Ci(l, t) || (f = t.tagValueProcessor(c, f), f = Hn(f, t)), r && (i += n), i += f, r = !1;
1833
+ Mi(l, t) || (f = t.tagValueProcessor(c, f), f = Hn(f, t)), r && (i += n), i += f, r = !1;
1820
1834
  continue;
1821
1835
  } else if (c === t.cdataPropName) {
1822
1836
  r && (i += n), i += `<![CDATA[${a[c][0][t.textNodeName]}]]>`, r = !1;
@@ -1825,19 +1839,19 @@ function $n(s, t, e, n) {
1825
1839
  i += n + `<!--${a[c][0][t.textNodeName]}-->`, r = !0;
1826
1840
  continue;
1827
1841
  } else if (c[0] === "?") {
1828
- const f = dn(a[":@"], t), w = c === "?xml" ? "" : n;
1842
+ const f = un(a[":@"], t), w = c === "?xml" ? "" : n;
1829
1843
  let b = a[c][0][t.textNodeName];
1830
1844
  b = b.length !== 0 ? " " + b : "", i += w + `<${c}${b}${f}?>`, r = !0;
1831
1845
  continue;
1832
1846
  }
1833
1847
  let d = n;
1834
1848
  d !== "" && (d += t.indentBy);
1835
- const h = dn(a[":@"], t), u = n + `<${c}${h}`, m = $n(a[c], t, l, d);
1836
- t.unpairedTags.indexOf(c) !== -1 ? t.suppressUnpairedNode ? i += u + ">" : i += u + "/>" : (!m || m.length === 0) && t.suppressEmptyNode ? i += u + "/>" : m && m.endsWith(">") ? i += u + `>${m}${n}</${c}>` : (i += u + ">", m && n !== "" && (m.includes("/>") || m.includes("</")) ? i += n + t.indentBy + m + n : i += m, i += `</${c}>`), r = !0;
1849
+ const h = un(a[":@"], t), u = n + `<${c}${h}`, g = Pn(a[c], t, l, d);
1850
+ t.unpairedTags.indexOf(c) !== -1 ? t.suppressUnpairedNode ? i += u + ">" : i += u + "/>" : (!g || g.length === 0) && t.suppressEmptyNode ? i += u + "/>" : g && g.endsWith(">") ? i += u + `>${g}${n}</${c}>` : (i += u + ">", g && n !== "" && (g.includes("/>") || g.includes("</")) ? i += n + t.indentBy + g + n : i += g, i += `</${c}>`), r = !0;
1837
1851
  }
1838
1852
  return i;
1839
1853
  }
1840
- function ki(s) {
1854
+ function Ri(s) {
1841
1855
  const t = Object.keys(s);
1842
1856
  for (let e = 0; e < t.length; e++) {
1843
1857
  const n = t[e];
@@ -1845,7 +1859,7 @@ function ki(s) {
1845
1859
  return n;
1846
1860
  }
1847
1861
  }
1848
- function dn(s, t) {
1862
+ function un(s, t) {
1849
1863
  let e = "";
1850
1864
  if (s && !t.ignoreAttributes)
1851
1865
  for (let n in s) {
@@ -1855,7 +1869,7 @@ function dn(s, t) {
1855
1869
  }
1856
1870
  return e;
1857
1871
  }
1858
- function Ci(s, t) {
1872
+ function Mi(s, t) {
1859
1873
  s = s.substr(0, s.length - t.textNodeName.length - 1);
1860
1874
  let e = s.substr(s.lastIndexOf(".") + 1);
1861
1875
  for (let n in t.stopNodes)
@@ -1870,7 +1884,7 @@ function Hn(s, t) {
1870
1884
  }
1871
1885
  return s;
1872
1886
  }
1873
- const Ri = {
1887
+ const xi = {
1874
1888
  attributeNamePrefix: "@_",
1875
1889
  attributesGroupName: !1,
1876
1890
  textNodeName: "#text",
@@ -1905,16 +1919,16 @@ const Ri = {
1905
1919
  oneListGroup: !1
1906
1920
  };
1907
1921
  function ot(s) {
1908
- this.options = Object.assign({}, Ri, s), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
1922
+ this.options = Object.assign({}, xi, s), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
1909
1923
  return !1;
1910
- } : (this.ignoreAttributesFn = Mn(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = $i), this.processTextOrObjNode = Mi, this.options.format ? (this.indentate = xi, this.tagEndChar = `>
1924
+ } : (this.ignoreAttributesFn = xn(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Hi), this.processTextOrObjNode = $i, this.options.format ? (this.indentate = Pi, this.tagEndChar = `>
1911
1925
  `, this.newLine = `
1912
1926
  `) : (this.indentate = function() {
1913
1927
  return "";
1914
1928
  }, this.tagEndChar = ">", this.newLine = "");
1915
1929
  }
1916
1930
  ot.prototype.build = function(s) {
1917
- return this.options.preserveOrder ? Oi(s, this.options) : (Array.isArray(s) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (s = {
1931
+ return this.options.preserveOrder ? Ci(s, this.options) : (Array.isArray(s) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (s = {
1918
1932
  [this.options.arrayNodeName]: s
1919
1933
  }), this.j2x(s, 0, []).val);
1920
1934
  };
@@ -1970,7 +1984,7 @@ ot.prototype.j2x = function(s, t, e) {
1970
1984
  ot.prototype.buildAttrPairStr = function(s, t) {
1971
1985
  return t = this.options.attributeValueProcessor(s, "" + t), t = this.replaceEntitiesValue(t), this.options.suppressBooleanAttributes && t === "true" ? " " + s : " " + s + '="' + t + '"';
1972
1986
  };
1973
- function Mi(s, t, e, n) {
1987
+ function $i(s, t, e, n) {
1974
1988
  const i = this.j2x(s, e + 1, n.concat(t));
1975
1989
  return s[this.options.textNodeName] !== void 0 && Object.keys(s).length === 1 ? this.buildTextValNode(s[this.options.textNodeName], t, i.attrStr, e) : this.buildObjectNode(i.val, t, i.attrStr, e);
1976
1990
  }
@@ -2006,13 +2020,13 @@ ot.prototype.replaceEntitiesValue = function(s) {
2006
2020
  }
2007
2021
  return s;
2008
2022
  };
2009
- function xi(s) {
2023
+ function Pi(s) {
2010
2024
  return this.options.indentBy.repeat(s);
2011
2025
  }
2012
- function $i(s) {
2026
+ function Hi(s) {
2013
2027
  return s.startsWith(this.options.attributeNamePrefix) && s !== this.options.textNodeName ? s.substr(this.attrPrefixLen) : !1;
2014
2028
  }
2015
- class bt {
2029
+ class _t {
2016
2030
  type;
2017
2031
  attrs = {};
2018
2032
  styles = {};
@@ -2041,8 +2055,8 @@ class bt {
2041
2055
  left(...t) {
2042
2056
  return `<${[
2043
2057
  this.type,
2044
- Dn(this.attrs),
2045
- Li(this.styles),
2058
+ Ln(this.attrs),
2059
+ Ui(this.styles),
2046
2060
  ...t
2047
2061
  ].filter((e) => e != "").join(" ")}>`;
2048
2062
  }
@@ -2069,7 +2083,7 @@ class bt {
2069
2083
  return this.toString();
2070
2084
  }
2071
2085
  }
2072
- class Pn extends bt {
2086
+ class Bn extends _t {
2073
2087
  attrs = {};
2074
2088
  constructor(t) {
2075
2089
  super("image"), this.attrs = { ...this.attrs, href: t };
@@ -2078,7 +2092,7 @@ class Pn extends bt {
2078
2092
  return this.attrs.href = t, this;
2079
2093
  }
2080
2094
  }
2081
- class Ue extends bt {
2095
+ class Ue extends _t {
2082
2096
  attrs = {};
2083
2097
  constructor(t) {
2084
2098
  super("use"), this.attrs = { ...this.attrs, href: this.make(t) };
@@ -2090,7 +2104,7 @@ class Ue extends bt {
2090
2104
  return t == null ? t : `#${t}`;
2091
2105
  }
2092
2106
  }
2093
- class Bn extends bt {
2107
+ class Wn extends _t {
2094
2108
  attrs = {};
2095
2109
  constructor() {
2096
2110
  super("rect");
@@ -2102,7 +2116,7 @@ class Bn extends bt {
2102
2116
  return this.attrs.stroke = t, this;
2103
2117
  }
2104
2118
  }
2105
- class St extends bt {
2119
+ class St extends _t {
2106
2120
  attrs;
2107
2121
  _text = "";
2108
2122
  constructor(t = "") {
@@ -2118,7 +2132,7 @@ class St extends bt {
2118
2132
  return this._text;
2119
2133
  }
2120
2134
  }
2121
- let Wn = class extends bt {
2135
+ let Dn = class extends _t {
2122
2136
  raw;
2123
2137
  constructor(t) {
2124
2138
  super("symbol"), this.raw = t;
@@ -2130,7 +2144,7 @@ let Wn = class extends bt {
2130
2144
  return this.raw;
2131
2145
  }
2132
2146
  };
2133
- class N extends bt {
2147
+ class N extends _t {
2134
2148
  children = [];
2135
2149
  rotateMatrix;
2136
2150
  translateMatrix;
@@ -2141,7 +2155,7 @@ class N extends bt {
2141
2155
  return this.children.push(t), this;
2142
2156
  }
2143
2157
  rotate(t, e, n) {
2144
- return this.rotateMatrix = Hs(t, e, n), this;
2158
+ return this.rotateMatrix = Bs(t, e, n), this;
2145
2159
  }
2146
2160
  translate(t, e) {
2147
2161
  return this.translateMatrix = Ne(t, e), this;
@@ -2153,7 +2167,7 @@ class N extends bt {
2153
2167
  const e = [this.translateMatrix, this.rotateMatrix].filter(
2154
2168
  (n) => n != null
2155
2169
  );
2156
- return e.length == 0 ? super.left() : super.left(Ki(Cs(e)));
2170
+ return e.length == 0 ? super.left() : super.left(zi(Ms(e)));
2157
2171
  }
2158
2172
  each(t, e) {
2159
2173
  for (let n = 0; n < this.children.length; n++) {
@@ -2162,12 +2176,12 @@ class N extends bt {
2162
2176
  }
2163
2177
  }
2164
2178
  }
2165
- const Hi = [
2179
+ const Bi = [
2166
2180
  'xmlns="http://www.w3.org/2000/svg"',
2167
2181
  'version="1.1"',
2168
2182
  'xmlns:xlink="http://www.w3.org/1999/xlink"'
2169
2183
  ];
2170
- class Pi extends bt {
2184
+ class Wi extends _t {
2171
2185
  children = [];
2172
2186
  constructor() {
2173
2187
  super("svg");
@@ -2182,16 +2196,16 @@ class Pi extends bt {
2182
2196
  left(...t) {
2183
2197
  return `<${[
2184
2198
  this.type,
2185
- ...Hi,
2186
- Dn(this.attrs),
2187
- Di(this.viewBox)
2199
+ ...Bi,
2200
+ Ln(this.attrs),
2201
+ Ki(this.viewBox)
2188
2202
  ].filter((e) => e != "").join(" ")}>`;
2189
2203
  }
2190
2204
  viewbox(t, e, n, i) {
2191
2205
  return this.viewBox = { x: t, y: e, width: n, height: i }, this;
2192
2206
  }
2193
2207
  importSymbol(t) {
2194
- for (const e of zi(t))
2208
+ for (const e of ji(t))
2195
2209
  this.add(e);
2196
2210
  return this;
2197
2211
  }
@@ -2214,32 +2228,32 @@ class Pi extends bt {
2214
2228
  }
2215
2229
  }
2216
2230
  }
2217
- function Bi() {
2218
- return new Pi();
2231
+ function Di() {
2232
+ return new Wi();
2219
2233
  }
2220
- const jo = Bi, Fo = N, Go = Pn, Zo = Ue, Yo = Bn, Vo = St;
2221
- function Wi(s) {
2234
+ const Vo = Di, Jo = N, Xo = Bn, qo = Ue, Qo = Wn, ta = St;
2235
+ function Li(s) {
2222
2236
  return s.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
2223
2237
  }
2224
- function Di(s) {
2238
+ function Ki(s) {
2225
2239
  return s == null ? "" : `viewBox="${s.x} ${s.y} ${s.width} ${s.height}"`;
2226
2240
  }
2227
- function Ki(s) {
2228
- return s == null ? "" : `transform="${Ps(s)}"`;
2241
+ function zi(s) {
2242
+ return s == null ? "" : `transform="${Ws(s)}"`;
2229
2243
  }
2230
- function Dn(s) {
2231
- return Object.entries(s).filter(([t, e]) => e !== void 0).map(([t, e]) => `${Wi(t)}="${e}"`).join(" ");
2244
+ function Ln(s) {
2245
+ return Object.entries(s).filter(([t, e]) => e !== void 0).map(([t, e]) => `${Li(t)}="${e}"`).join(" ");
2232
2246
  }
2233
- function Li(s) {
2247
+ function Ui(s) {
2234
2248
  const t = Object.entries(s).map(([e, n]) => `${e}: ${n};`).join(" ");
2235
2249
  return t != "" ? `style="${t}"` : "";
2236
2250
  }
2237
- function* zi(s) {
2238
- const t = new vi({ ignoreAttributes: !1 }), e = new ot({
2251
+ function* ji(s) {
2252
+ const t = new Oi({ ignoreAttributes: !1 }), e = new ot({
2239
2253
  ignoreAttributes: !1
2240
2254
  }), n = t.parse(s);
2241
2255
  for (const i of n.svg.symbol) {
2242
- const r = e.build(i), o = new Wn(r);
2256
+ const r = e.build(i), o = new Dn(r);
2243
2257
  for (const [a, c] of Object.entries(i))
2244
2258
  a.startsWith("@_") && (o.attrs[a.substring(2)] = c);
2245
2259
  yield o;
@@ -2255,8 +2269,8 @@ const Ee = (s, t) => {
2255
2269
  }, 0);
2256
2270
  return { width: s.tiles.reduce((a, c) => a + J(c, t).width, 0), height: r };
2257
2271
  }, J = (s, t) => {
2258
- const e = parseFloat((wt.HEIGHT * t).toPrecision(5)), n = parseFloat((wt.WIDTH * t).toPrecision(5)), i = s.has(g.HORIZONTAL) ? { width: e, height: n, baseWidth: n, baseHeight: e } : { width: n, height: e, w: n, baseWidth: n, baseHeight: e };
2259
- return (s.has(g.TSUMO) || s.has(g.IMAGE_DORA)) && (i.width += n * wt.TEXT_SCALE), i;
2272
+ const e = parseFloat((wt.HEIGHT * t).toPrecision(5)), n = parseFloat((wt.WIDTH * t).toPrecision(5)), i = s.has(m.HORIZONTAL) ? { width: e, height: n, baseWidth: n, baseHeight: e } : { width: n, height: e, w: n, baseWidth: n, baseHeight: e };
2273
+ return (s.has(m.TSUMO) || s.has(m.IMAGE_DORA)) && (i.width += n * wt.TEXT_SCALE), i;
2260
2274
  };
2261
2275
  class kt {
2262
2276
  tileWidth;
@@ -2275,8 +2289,8 @@ class kt {
2275
2289
  }
2276
2290
  // image wrapper
2277
2291
  image(t) {
2278
- let e = this.svgSprite ? new Ue().use(kt.buildID(t)) : new Pn().load(this.buildURL(t));
2279
- return t instanceof y && t.has(g.COLOR_GRAYSCALE) && e.css({ filter: "contrast(65%)" }), e;
2292
+ let e = this.svgSprite ? new Ue().use(kt.buildID(t)) : new Bn().load(this.buildURL(t));
2293
+ return t instanceof y && t.has(m.COLOR_GRAYSCALE) && e.css({ filter: "contrast(65%)" }), e;
2280
2294
  }
2281
2295
  createImage(t, e, n) {
2282
2296
  const i = J(t, this.scale);
@@ -2285,7 +2299,7 @@ class kt {
2285
2299
  createTextImage(t, e, n, i) {
2286
2300
  const r = this.createImage(t, e, n), o = J(t, this.scale), a = o.baseHeight * 0.2, c = o.baseWidth, l = o.baseHeight, d = new St().plain(i);
2287
2301
  d.size(o.baseWidth, o.baseHeight).font({
2288
- family: vn,
2302
+ family: Sn,
2289
2303
  size: a
2290
2304
  }).dx(c).dy(l);
2291
2305
  const h = new N();
@@ -2301,7 +2315,7 @@ class kt {
2301
2315
  static buildID(t) {
2302
2316
  if (t === 100) return "stick100";
2303
2317
  if (t === 1e3) return "stick1000";
2304
- const e = t.t == p.BACK || t.has(g.RED) ? 0 : t.n;
2318
+ const e = t.t == p.BACK || t.has(m.RED) ? 0 : t.n;
2305
2319
  return `${t.t}${e}`;
2306
2320
  }
2307
2321
  buildURL(t) {
@@ -2343,15 +2357,15 @@ class Kn extends kt {
2343
2357
  const e = this.findHorizontalIndex(t);
2344
2358
  let n = 0;
2345
2359
  const i = new N(), r = t.tiles.reduce(
2346
- (o, a, c) => a.has(g.HORIZONTAL) ? c : o,
2360
+ (o, a, c) => a.has(m.HORIZONTAL) ? c : o,
2347
2361
  e
2348
2362
  );
2349
2363
  for (let o = 0; o < t.tiles.length; o++) {
2350
2364
  const a = J(t.tiles[o], this.scale);
2351
2365
  if (o == r) continue;
2352
2366
  if (o == e) {
2353
- const d = t.tiles[e], h = t.tiles[r], u = J(d, this.scale), m = this.createRotate90Image(d, 0, 0, !0), f = this.createRotate90Image(h, 0, u.height, !0);
2354
- i.add(new N().translate(n, 0).add(m).add(f)), n += u.width;
2367
+ const d = t.tiles[e], h = t.tiles[r], u = J(d, this.scale), g = this.createRotate90Image(d, 0, 0, !0), f = this.createRotate90Image(h, 0, u.height, !0);
2368
+ i.add(new N().translate(n, 0).add(g).add(f)), n += u.width;
2355
2369
  continue;
2356
2370
  }
2357
2371
  const c = a.width * 2 - a.height, l = this.createImage(t.tiles[o], n, c);
@@ -2399,7 +2413,7 @@ class Kn extends kt {
2399
2413
  for (const i of t) {
2400
2414
  const r = J(i, this.scale);
2401
2415
  let o;
2402
- if (i.has(g.HORIZONTAL)) {
2416
+ if (i.has(m.HORIZONTAL)) {
2403
2417
  const a = this.getHorizontalTileYOffset(i);
2404
2418
  o = this.createRotate90Image(i, e, a);
2405
2419
  } else o = this.createImage(i, e, 0);
@@ -2408,38 +2422,38 @@ class Kn extends kt {
2408
2422
  return n;
2409
2423
  }
2410
2424
  findHorizontalIndex(t) {
2411
- const e = t.tiles.findIndex((n) => n.has(g.HORIZONTAL));
2425
+ const e = t.tiles.findIndex((n) => n.has(m.HORIZONTAL));
2412
2426
  if (e < 0)
2413
2427
  throw new Error(`unable to find horizontal operator in block: ${t}`);
2414
2428
  return e;
2415
2429
  }
2416
2430
  }
2417
- function Ui(s, t, e) {
2431
+ function Fi(s, t, e) {
2418
2432
  const { enableDoraText: n, enableTsumoText: i } = e;
2419
2433
  let r = Ee(s, t.scale), o;
2420
2434
  if (s instanceof U) o = t.createBlockPon(s);
2421
2435
  else if (s instanceof V) o = t.createBlockChi(s);
2422
2436
  else if (s instanceof R) o = t.createBlockAnKan(s);
2423
- else if (s instanceof H) o = t.createBlockShoKan(s);
2437
+ else if (s instanceof P) o = t.createBlockShoKan(s);
2424
2438
  else if (s instanceof z) o = t.createBlockDaiKan(s);
2425
2439
  else if (s instanceof Tt) o = t.createBlockHand(s);
2426
- else if (s instanceof Ke)
2440
+ else if (s instanceof Le)
2427
2441
  switch (s.type) {
2428
2442
  case E.IMAGE_DISCARD:
2429
2443
  o = t.createBlockDiscard(s);
2430
2444
  break;
2431
2445
  case E.IMAGE_DORA: {
2432
- const a = n == !1 ? new Tt([s.tiles[0].clone({ remove: g.IMAGE_DORA })]) : s;
2446
+ const a = n == !1 ? new Tt([s.tiles[0].clone({ remove: m.IMAGE_DORA })]) : s;
2433
2447
  r = Ee(a, t.scale), o = t.createBlockDora(a, n);
2434
2448
  break;
2435
2449
  }
2436
2450
  case E.TSUMO: {
2437
- const a = i == !1 ? new Tt([s.tiles[0].clone({ remove: g.TSUMO })]) : s;
2451
+ const a = i == !1 ? new Tt([s.tiles[0].clone({ remove: m.TSUMO })]) : s;
2438
2452
  r = Ee(a, t.scale), o = t.createBlockTsumo(a, i);
2439
2453
  break;
2440
2454
  }
2441
2455
  default:
2442
- if (s.tiles.some((a) => a.has(g.TSUMO) || a.has(g.IMAGE_DORA)))
2456
+ if (s.tiles.some((a) => a.has(m.TSUMO) || a.has(m.IMAGE_DORA)))
2443
2457
  throw new Error(
2444
2458
  `found an unknown block with operator tiles. block: ${s}, type: ${s.type}`
2445
2459
  );
@@ -2451,25 +2465,25 @@ function Ui(s, t, e) {
2451
2465
  );
2452
2466
  return { ...r, e: o };
2453
2467
  }
2454
- const Lt = (s, t, e = Ln) => {
2455
- const n = t.map((d) => Ui(d, s, e)), i = n.reduce((d, h) => d + h.width, 0), o = n.reduce((d, h) => Math.max(d, h.height), 0), a = i + (t.length - 1) * s.blockMargin, c = new N();
2468
+ const Kt = (s, t, e = zn) => {
2469
+ const n = t.map((d) => Fi(d, s, e)), i = n.reduce((d, h) => d + h.width, 0), o = n.reduce((d, h) => Math.max(d, h.height), 0), a = i + (t.length - 1) * s.blockMargin, c = new N();
2456
2470
  let l = 0;
2457
2471
  for (const d of n) {
2458
2472
  const h = o - d.height, u = new N().translate(l, h);
2459
2473
  u.add(d.e), c.add(u), l += d.width + s.blockMargin;
2460
2474
  }
2461
2475
  return { e: c, width: a, height: o };
2462
- }, Ln = {
2476
+ }, zn = {
2463
2477
  enableDoraText: !0,
2464
2478
  enableTsumoText: !0
2465
- }, Jo = (s, t, e = {}, n = Ln) => {
2466
- const i = new Kn(e), r = Lt(i, t, n);
2479
+ }, ea = (s, t, e = {}, n = zn) => {
2480
+ const i = new Kn(e), r = Kt(i, t, n);
2467
2481
  n.responsive || s.size(r.width, r.height), s.viewbox(0, 0, r.width, r.height), s.add(r.e);
2468
- }, zn = () => {
2482
+ }, Un = () => {
2469
2483
  const s = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
2470
2484
  return Object.values(p).flatMap((t) => t === p.BACK ? [kt.buildID(new y(t, 0))] : s.map((e) => kt.buildID(new y(t, e))));
2471
- }, ji = (s) => {
2472
- const t = zn(), e = [];
2485
+ }, Gi = (s) => {
2486
+ const t = Un(), e = [];
2473
2487
  return s.each((n, i) => {
2474
2488
  const r = i[n];
2475
2489
  if (r instanceof Ue) {
@@ -2477,13 +2491,13 @@ const Lt = (s, t, e = Ln) => {
2477
2491
  t.includes(a) && e.push(a);
2478
2492
  }
2479
2493
  }, !0), e;
2480
- }, Xo = (s) => {
2481
- const t = zn(), e = ji(s);
2494
+ }, na = (s) => {
2495
+ const t = Un(), e = Gi(s);
2482
2496
  s.each((n, i) => {
2483
2497
  const r = i[n];
2484
- r instanceof Wn && (t.includes(r.id()) && e.includes(r.id()) || r.remove());
2498
+ r instanceof Dn && (t.includes(r.id()) && e.includes(r.id()) || r.remove());
2485
2499
  }, !0);
2486
- }, Fi = (s, t = 6) => Array.from(
2500
+ }, Zi = (s, t = 6) => Array.from(
2487
2501
  { length: Math.ceil(s.length / t) },
2488
2502
  (e, n) => s.slice(n * t, (n + 1) * t)
2489
2503
  ), j = (s, t, e, n, i = 0, r = 0) => {
@@ -2502,9 +2516,9 @@ const Lt = (s, t, e = Ln) => {
2502
2516
  }
2503
2517
  return new N().add(o);
2504
2518
  }, Zt = (s, t) => {
2505
- const e = new N(), n = Fi(s);
2519
+ const e = new N(), n = Zi(s);
2506
2520
  for (let i = 0; i < n.length; i++) {
2507
- const r = n[i], o = i * t.tileHeight, a = t.createBlockDiscard(new Ke(r, E.IMAGE_DISCARD)).translate(0, o);
2521
+ const r = n[i], o = i * t.tileHeight, a = t.createBlockDiscard(new Le(r, E.IMAGE_DISCARD)).translate(0, o);
2508
2522
  e.add(a);
2509
2523
  }
2510
2524
  return {
@@ -2512,19 +2526,19 @@ const Lt = (s, t, e = Ln) => {
2512
2526
  width: t.tileWidth * 5 + t.tileHeight * 1,
2513
2527
  height: t.tileHeight * n.length
2514
2528
  };
2515
- }, Gi = (s, t, e) => {
2516
- const n = t.font, i = t.textWidth, r = t.textHeight, o = e.sticks.dead, a = e.sticks.reach, c = en.WIDTH * s.scale, l = en.HEIGHT * s.scale, d = i * 3, h = r + 25 * s.scale, u = (c + s.tileWidth + i - d) / 2, m = new St().plain(e.round).font(n).x(u).y(0), f = s.tileHeight, w = new N().size(c, f).translate(0, h), b = { family: n.family, size: n.size * 0.7 }, A = s.createStick(1e3).size(c, l).x(0).y(0), S = new St().plain(a.toString()).font(b).dx(c).dy(l), x = s.createStick(100).size(c, l).x(0).y(l + l), at = new St().plain(o.toString()).font(b).dx(c).dy(l * 3);
2529
+ }, Yi = (s, t, e) => {
2530
+ const n = t.font, i = t.textWidth, r = t.textHeight, o = e.sticks.dead, a = e.sticks.reach, c = en.WIDTH * s.scale, l = en.HEIGHT * s.scale, d = i * 3, h = r + 25 * s.scale, u = (c + s.tileWidth + i - d) / 2, g = new St().plain(e.round).font(n).x(u).y(0), f = s.tileHeight, w = new N().size(c, f).translate(0, h), b = { family: n.family, size: n.size * 0.7 }, A = s.createStick(1e3).size(c, l).x(0).y(0), S = new St().plain(a.toString()).font(b).dx(c).dy(l), x = s.createStick(100).size(c, l).x(0).y(l + l), at = new St().plain(o.toString()).font(b).dx(c).dy(l * 3);
2517
2531
  w.add(A), w.add(S), w.add(x), w.add(at);
2518
- const Q = s.createImage(e.doras[0], 0, 0).x(c + i).y(0);
2532
+ const Q = s.createImage(e.doraIndicators[0], 0, 0).x(c + i).y(0);
2519
2533
  w.add(Q);
2520
2534
  const tt = new N();
2521
- return tt.add(m), tt.add(w), {
2535
+ return tt.add(g), tt.add(w), {
2522
2536
  e: tt,
2523
2537
  width: c + s.tileWidth + i,
2524
2538
  height: h + s.tileHeight
2525
2539
  };
2526
- }, Zi = (s, t, e = 0) => {
2527
- const n = Lt(s, t.front), i = Lt(s, t.right), r = Lt(s, t.opposite), o = Lt(s, t.left), a = [n.width, i.width, r.width, o.width].reduce(
2540
+ }, Vi = (s, t, e = 0) => {
2541
+ const n = Kt(s, t.front), i = Kt(s, t.right), r = Kt(s, t.opposite), o = Kt(s, t.left), a = [n.width, i.width, r.width, o.width].reduce(
2528
2542
  (w, b) => Math.max(w, b)
2529
2543
  ), c = Math.max(
2530
2544
  e + s.tileHeight * 2 + s.blockMargin * 2,
@@ -2538,28 +2552,28 @@ const Lt = (s, t, e = Ln) => {
2538
2552
  ), u = j(r.e, r.width, r.height, 180).translate(
2539
2553
  (c - r.width) / 2,
2540
2554
  0
2541
- ), m = j(o.e, o.width, o.height, 90).translate(
2555
+ ), g = j(o.e, o.width, o.height, 90).translate(
2542
2556
  0,
2543
2557
  (c - o.width) / 2
2544
2558
  ), f = new N().size(c, l);
2545
- return f.add(d), f.add(h), f.add(u), f.add(m), { e: new N().add(f), width: c, height: l };
2546
- }, Yi = (s) => {
2559
+ return f.add(d), f.add(h), f.add(u), f.add(g), { e: new N().add(f), width: c, height: l };
2560
+ }, Ji = (s) => {
2547
2561
  const t = Object.values(We), e = t.indexOf(s);
2548
2562
  return [...t.slice(e), ...t.slice(0, e)];
2549
- }, Vi = (s, t, e) => {
2550
- const n = s.tileWidth * 5 + s.tileHeight * 1, i = t.font, r = t.textWidth, o = t.textHeight, a = t.numWidth, c = Gi(s, t, e);
2563
+ }, Xi = (s, t, e) => {
2564
+ const n = s.tileWidth * 5 + s.tileHeight * 1, i = t.font, r = t.textWidth, o = t.textHeight, a = t.numWidth, c = Yi(s, t, e);
2551
2565
  c.e.translate(
2552
2566
  n / 2 - c.width / 2,
2553
2567
  n / 2 - c.height / 2
2554
2568
  );
2555
- const l = (ys, tn, ws) => {
2556
- const Es = `${ys} ${tn}`, _s = new St().plain(Es).font(i).attr(ws);
2569
+ const l = (Es, tn, bs) => {
2570
+ const _s = `${Es} ${tn}`, As = new St().plain(_s).font(i).attr(bs);
2557
2571
  return {
2558
- e: new N().add(_s),
2572
+ e: new N().add(As),
2559
2573
  width: r + a * tn.toString().length,
2560
2574
  height: o
2561
2575
  };
2562
- }, [d, h, u, m] = Yi(
2576
+ }, [d, h, u, g] = Ji(
2563
2577
  e.frontPlace
2564
2578
  ), f = e.scores, b = l(d, f.front, {
2565
2579
  x: n / 2,
@@ -2580,23 +2594,23 @@ const Lt = (s, t, e = Ln) => {
2580
2594
  const at = j(x.e, x.width, x.height, 180).translate(
2581
2595
  n / 2 - x.width,
2582
2596
  -x.height
2583
- ), Q = l(m, f.left, {
2597
+ ), Q = l(g, f.left, {
2584
2598
  "dominant-baseline": "ideographic",
2585
2599
  "text-anchor": "middle"
2586
2600
  }), tt = j(Q.e, Q.width, Q.height, 90).translate(
2587
2601
  -Q.height,
2588
2602
  n / 2
2589
- ), ct = new N(), ms = new Bn().size(n, n).x(0).y(0).fill("none").stroke("#000000");
2590
- return ct.add(ms), ct.add(c.e), ct.add(b), ct.add(S), ct.add(at), ct.add(tt), { e: ct, width: n, height: n };
2591
- }, Ji = (s, t) => {
2603
+ ), ct = new N(), ws = new Wn().size(n, n).x(0).y(0).fill("none").stroke("#000000");
2604
+ return ct.add(ws), ct.add(c.e), ct.add(b), ct.add(S), ct.add(at), ct.add(tt), { e: ct, width: n, height: n };
2605
+ }, qi = (s, t) => {
2592
2606
  const e = Zt(t.front, s), n = Zt(t.right, s), i = Zt(t.opposite, s), r = Zt(t.left, s), o = [e.height, n.height, i.height, r.height].reduce(
2593
2607
  (S, x) => Math.max(S, x)
2594
- ), a = s.tileWidth * 5 + s.tileHeight * 1, c = o, l = a + o * 2 + s.blockMargin, d = l, h = new N().size(l, d), u = l / 2 - a / 2, m = d / 2 - a / 2, f = j(e.e, a, c, 0).translate(
2608
+ ), a = s.tileWidth * 5 + s.tileHeight * 1, c = o, l = a + o * 2 + s.blockMargin, d = l, h = new N().size(l, d), u = l / 2 - a / 2, g = d / 2 - a / 2, f = j(e.e, a, c, 0).translate(
2595
2609
  u,
2596
2610
  d - c
2597
2611
  ), w = j(n.e, a, c, 270).translate(
2598
2612
  l - c,
2599
- m
2613
+ g
2600
2614
  ), b = j(
2601
2615
  i.e,
2602
2616
  a,
@@ -2604,11 +2618,11 @@ const Lt = (s, t, e = Ln) => {
2604
2618
  180
2605
2619
  ).translate(u, 0), A = j(r.e, a, c, 90).translate(
2606
2620
  0,
2607
- m
2621
+ g
2608
2622
  );
2609
2623
  return h.add(f), h.add(w), h.add(b), h.add(A), { e: new N().add(h), width: l, height: d };
2610
- }, Xi = (s, t, e, n, i) => {
2611
- const r = new N(), o = Ji(s, n), a = Zi(s, e, o.height), c = Vi(s, t, i);
2624
+ }, Qi = (s, t, e, n, i) => {
2625
+ const r = new N(), o = qi(s, n), a = Vi(s, e, o.height), c = Xi(s, t, i);
2612
2626
  return o.e.translate(
2613
2627
  (a.width - o.width) / 2,
2614
2628
  (a.height - o.height) / 2
@@ -2616,34 +2630,34 @@ const Lt = (s, t, e = Ln) => {
2616
2630
  (a.width - c.width) / 2,
2617
2631
  (a.height - c.height) / 2
2618
2632
  ), r.add(a.e), r.add(o.e), r.add(c.e), { e: r, width: a.width, height: a.height };
2619
- }, qo = (s, t, e = {}, n, i = { responsive: !1 }) => {
2620
- const r = new Kn(e), o = n, { discards: a, hands: c, scoreBoard: l } = hr(t), d = Xi(r, o, c, a, l);
2633
+ }, sa = (s, t, e = {}, n, i = { responsive: !1 }) => {
2634
+ const r = new Kn(e), o = n, { discards: a, hands: c, scoreBoard: l } = ur(t), d = Qi(r, o, c, a, l);
2621
2635
  i.responsive || s.size(d.width, d.height), s.viewbox(0, 0, d.width, d.height), s.add(d.e);
2622
2636
  };
2623
- var _e;
2637
+ let be;
2624
2638
  // @__NO_SIDE_EFFECTS__
2625
- function Un(s) {
2639
+ function jn(s) {
2626
2640
  return {
2627
- lang: s?.lang ?? _e?.lang,
2641
+ lang: s?.lang ?? be?.lang,
2628
2642
  message: s?.message,
2629
- abortEarly: s?.abortEarly ?? _e?.abortEarly,
2630
- abortPipeEarly: s?.abortPipeEarly ?? _e?.abortPipeEarly
2643
+ abortEarly: s?.abortEarly ?? be?.abortEarly,
2644
+ abortPipeEarly: s?.abortPipeEarly ?? be?.abortPipeEarly
2631
2645
  };
2632
2646
  }
2633
- var qi;
2634
- // @__NO_SIDE_EFFECTS__
2635
- function Qi(s) {
2636
- return qi?.get(s);
2637
- }
2638
- var tr;
2647
+ let tr;
2639
2648
  // @__NO_SIDE_EFFECTS__
2640
2649
  function er(s) {
2641
2650
  return tr?.get(s);
2642
2651
  }
2643
- var nr;
2652
+ let nr;
2653
+ // @__NO_SIDE_EFFECTS__
2654
+ function sr(s) {
2655
+ return nr?.get(s);
2656
+ }
2657
+ let ir;
2644
2658
  // @__NO_SIDE_EFFECTS__
2645
- function sr(s, t) {
2646
- return nr?.get(s)?.get(t);
2659
+ function rr(s, t) {
2660
+ return ir?.get(s)?.get(t);
2647
2661
  }
2648
2662
  // @__NO_SIDE_EFFECTS__
2649
2663
  function Ct(s) {
@@ -2664,11 +2678,8 @@ function it(s, t, e, n, i) {
2664
2678
  lang: n.lang,
2665
2679
  abortEarly: n.abortEarly,
2666
2680
  abortPipeEarly: n.abortPipeEarly
2667
- }, l = s.kind === "schema", d = i?.message ?? s.message ?? /* @__PURE__ */ sr(s.reference, c.lang) ?? (l ? /* @__PURE__ */ er(c.lang) : null) ?? n.message ?? /* @__PURE__ */ Qi(c.lang);
2668
- d !== void 0 && (c.message = typeof d == "function" ? (
2669
- // @ts-expect-error
2670
- d(c)
2671
- ) : d), l && (e.typed = !1), e.issues ? e.issues.push(c) : e.issues = [c];
2681
+ }, l = s.kind === "schema", d = i?.message ?? s.message ?? /* @__PURE__ */ rr(s.reference, c.lang) ?? (l ? /* @__PURE__ */ sr(c.lang) : null) ?? n.message ?? /* @__PURE__ */ er(c.lang);
2682
+ d !== void 0 && (c.message = typeof d == "function" ? d(c) : d), l && (e.typed = !1), e.issues ? e.issues.push(c) : e.issues = [c];
2672
2683
  }
2673
2684
  // @__NO_SIDE_EFFECTS__
2674
2685
  function Bt(s) {
@@ -2676,12 +2687,12 @@ function Bt(s) {
2676
2687
  version: 1,
2677
2688
  vendor: "valibot",
2678
2689
  validate(t) {
2679
- return s["~run"]({ value: t }, /* @__PURE__ */ Un());
2690
+ return s["~run"]({ value: t }, /* @__PURE__ */ jn());
2680
2691
  }
2681
2692
  };
2682
2693
  }
2683
2694
  // @__NO_SIDE_EFFECTS__
2684
- function ir(s, t) {
2695
+ function or(s, t) {
2685
2696
  const e = [...new Set(s)];
2686
2697
  return e.length > 1 ? `(${e.join(` ${t} `)})` : e[0] ?? "never";
2687
2698
  }
@@ -2696,9 +2707,7 @@ function Se(s, t) {
2696
2707
  requirement: s,
2697
2708
  message: t,
2698
2709
  "~run"(e, n) {
2699
- return e.typed && !(e.value <= this.requirement) && it(this, "value", e, n, {
2700
- received: e.value instanceof Date ? e.value.toJSON() : /* @__PURE__ */ Ct(e.value)
2701
- }), e;
2710
+ return e.typed && !(e.value <= this.requirement) && it(this, "value", e, n, { received: e.value instanceof Date ? e.value.toJSON() : /* @__PURE__ */ Ct(e.value) }), e;
2702
2711
  }
2703
2712
  };
2704
2713
  }
@@ -2713,31 +2722,17 @@ function Oe(s, t) {
2713
2722
  requirement: s,
2714
2723
  message: t,
2715
2724
  "~run"(e, n) {
2716
- return e.typed && !(e.value >= this.requirement) && it(this, "value", e, n, {
2717
- received: e.value instanceof Date ? e.value.toJSON() : /* @__PURE__ */ Ct(e.value)
2718
- }), e;
2725
+ return e.typed && !(e.value >= this.requirement) && it(this, "value", e, n, { received: e.value instanceof Date ? e.value.toJSON() : /* @__PURE__ */ Ct(e.value) }), e;
2719
2726
  }
2720
2727
  };
2721
2728
  }
2722
2729
  // @__NO_SIDE_EFFECTS__
2723
- function rr(s, t, e) {
2724
- return typeof s.fallback == "function" ? (
2725
- // @ts-expect-error
2726
- s.fallback(t, e)
2727
- ) : (
2728
- // @ts-expect-error
2729
- s.fallback
2730
- );
2730
+ function ar(s, t, e) {
2731
+ return typeof s.fallback == "function" ? s.fallback(t, e) : s.fallback;
2731
2732
  }
2732
2733
  // @__NO_SIDE_EFFECTS__
2733
- function jn(s, t, e) {
2734
- return typeof s.default == "function" ? (
2735
- // @ts-expect-error
2736
- s.default(t, e)
2737
- ) : (
2738
- // @ts-expect-error
2739
- s.default
2740
- );
2734
+ function Fn(s, t, e) {
2735
+ return typeof s.default == "function" ? s.default(t, e) : s.default;
2741
2736
  }
2742
2737
  // @__NO_SIDE_EFFECTS__
2743
2738
  function ie(s) {
@@ -2757,11 +2752,11 @@ function ie(s) {
2757
2752
  };
2758
2753
  }
2759
2754
  // @__NO_SIDE_EFFECTS__
2760
- function L(s, t) {
2755
+ function K(s, t) {
2761
2756
  return {
2762
2757
  kind: "schema",
2763
2758
  type: "optional",
2764
- reference: L,
2759
+ reference: K,
2765
2760
  expects: `(${s.expects} | undefined)`,
2766
2761
  async: !1,
2767
2762
  wrapped: s,
@@ -2770,7 +2765,7 @@ function L(s, t) {
2770
2765
  return /* @__PURE__ */ Bt(this);
2771
2766
  },
2772
2767
  "~run"(e, n) {
2773
- return e.value === void 0 && (this.default !== void 0 && (e.value = /* @__PURE__ */ jn(this, e, n)), e.value === void 0) ? (e.typed = !0, e) : this.wrapped["~run"](e, n);
2768
+ return e.value === void 0 && (this.default !== void 0 && (e.value = /* @__PURE__ */ Fn(this, e, n)), e.value === void 0) ? (e.typed = !0, e) : this.wrapped["~run"](e, n);
2774
2769
  }
2775
2770
  };
2776
2771
  }
@@ -2780,7 +2775,7 @@ function ke(s, t) {
2780
2775
  kind: "schema",
2781
2776
  type: "picklist",
2782
2777
  reference: ke,
2783
- expects: /* @__PURE__ */ ir(s.map(Ct), "|"),
2778
+ expects: /* @__PURE__ */ or(s.map(Ct), "|"),
2784
2779
  async: !1,
2785
2780
  options: s,
2786
2781
  message: t,
@@ -2811,12 +2806,8 @@ function Rt(s, t) {
2811
2806
  e.typed = !0, e.value = {};
2812
2807
  for (const r in this.entries) {
2813
2808
  const o = this.entries[r];
2814
- if (r in i || (o.type === "exact_optional" || o.type === "optional" || o.type === "nullish") && // @ts-expect-error
2815
- o.default !== void 0) {
2816
- const a = r in i ? (
2817
- // @ts-expect-error
2818
- i[r]
2819
- ) : /* @__PURE__ */ jn(o), c = o["~run"]({ value: a }, n);
2809
+ if (r in i || (o.type === "exact_optional" || o.type === "optional" || o.type === "nullish") && o.default !== void 0) {
2810
+ const a = r in i ? i[r] : /* @__PURE__ */ Fn(o), c = o["~run"]({ value: a }, n);
2820
2811
  if (c.issues) {
2821
2812
  const l = {
2822
2813
  type: "object",
@@ -2833,46 +2824,37 @@ function Rt(s, t) {
2833
2824
  }
2834
2825
  }
2835
2826
  c.typed || (e.typed = !1), e.value[r] = c.value;
2836
- } else if (o.fallback !== void 0)
2837
- e.value[r] = /* @__PURE__ */ rr(o);
2827
+ } else if (o.fallback !== void 0) e.value[r] = /* @__PURE__ */ ar(o);
2838
2828
  else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (it(this, "key", e, n, {
2839
2829
  input: void 0,
2840
2830
  expected: `"${r}"`,
2841
- path: [
2842
- {
2831
+ path: [{
2832
+ type: "object",
2833
+ origin: "key",
2834
+ input: i,
2835
+ key: r,
2836
+ value: i[r]
2837
+ }]
2838
+ }), n.abortEarly))
2839
+ break;
2840
+ }
2841
+ if (!e.issues || !n.abortEarly) {
2842
+ for (const r in i) if (!(r in this.entries)) {
2843
+ it(this, "key", e, n, {
2844
+ input: r,
2845
+ expected: "never",
2846
+ path: [{
2843
2847
  type: "object",
2844
2848
  origin: "key",
2845
2849
  input: i,
2846
2850
  key: r,
2847
- // @ts-expect-error
2848
2851
  value: i[r]
2849
- }
2850
- ]
2851
- }), n.abortEarly))
2852
+ }]
2853
+ });
2852
2854
  break;
2855
+ }
2853
2856
  }
2854
- if (!e.issues || !n.abortEarly) {
2855
- for (const r in i)
2856
- if (!(r in this.entries)) {
2857
- it(this, "key", e, n, {
2858
- input: r,
2859
- expected: "never",
2860
- path: [
2861
- {
2862
- type: "object",
2863
- origin: "key",
2864
- input: i,
2865
- key: r,
2866
- // @ts-expect-error
2867
- value: i[r]
2868
- }
2869
- ]
2870
- });
2871
- break;
2872
- }
2873
- }
2874
- } else
2875
- it(this, "type", e, n);
2857
+ } else it(this, "type", e, n);
2876
2858
  return e;
2877
2859
  }
2878
2860
  };
@@ -2895,7 +2877,7 @@ function re(s) {
2895
2877
  };
2896
2878
  }
2897
2879
  // @__NO_SIDE_EFFECTS__
2898
- function un(...s) {
2880
+ function fn(...s) {
2899
2881
  return {
2900
2882
  ...s[0],
2901
2883
  pipe: s,
@@ -2903,21 +2885,20 @@ function un(...s) {
2903
2885
  return /* @__PURE__ */ Bt(this);
2904
2886
  },
2905
2887
  "~run"(t, e) {
2906
- for (const n of s)
2907
- if (n.kind !== "metadata") {
2908
- if (t.issues && (n.kind === "schema" || n.kind === "transformation")) {
2909
- t.typed = !1;
2910
- break;
2911
- }
2912
- (!t.issues || !e.abortEarly && !e.abortPipeEarly) && (t = n["~run"](t, e));
2888
+ for (const n of s) if (n.kind !== "metadata") {
2889
+ if (t.issues && (n.kind === "schema" || n.kind === "transformation")) {
2890
+ t.typed = !1;
2891
+ break;
2913
2892
  }
2893
+ (!t.issues || !e.abortEarly && !e.abortPipeEarly) && (t = n["~run"](t, e));
2894
+ }
2914
2895
  return t;
2915
2896
  }
2916
2897
  };
2917
2898
  }
2918
2899
  // @__NO_SIDE_EFFECTS__
2919
- function or(s, t, e) {
2920
- const n = s["~run"]({ value: t }, /* @__PURE__ */ Un(e));
2900
+ function cr(s, t, e) {
2901
+ const n = s["~run"]({ value: t }, /* @__PURE__ */ jn(e));
2921
2902
  return {
2922
2903
  typed: n.typed,
2923
2904
  success: !n.issues,
@@ -2925,14 +2906,14 @@ function or(s, t, e) {
2925
2906
  issues: n.issues
2926
2907
  };
2927
2908
  }
2928
- const Yt = /* @__PURE__ */ L(
2909
+ const Yt = /* @__PURE__ */ K(
2929
2910
  /* @__PURE__ */ Rt({
2930
- discard: /* @__PURE__ */ L(/* @__PURE__ */ re(), ""),
2931
- hand: /* @__PURE__ */ L(/* @__PURE__ */ re(), ""),
2932
- score: /* @__PURE__ */ L(/* @__PURE__ */ ie(), 25e3)
2911
+ discard: /* @__PURE__ */ K(/* @__PURE__ */ re(), ""),
2912
+ hand: /* @__PURE__ */ K(/* @__PURE__ */ re(), ""),
2913
+ score: /* @__PURE__ */ K(/* @__PURE__ */ ie(), 25e3)
2933
2914
  }),
2934
2915
  { discard: "", hand: "", score: 25e3 }
2935
- ), ar = /* @__PURE__ */ Rt({
2916
+ ), lr = /* @__PURE__ */ Rt({
2936
2917
  [_.E]: Yt,
2937
2918
  [_.S]: Yt,
2938
2919
  [_.W]: Yt,
@@ -2940,46 +2921,51 @@ const Yt = /* @__PURE__ */ L(
2940
2921
  }), ht = {
2941
2922
  round: k.E1,
2942
2923
  sticks: { reach: 0, dead: 0 },
2943
- doras: _.S,
2924
+ doraIndicators: _.S,
2944
2925
  front: _.E
2945
- }, cr = /* @__PURE__ */ L(
2926
+ }, hr = /* @__PURE__ */ K(
2946
2927
  /* @__PURE__ */ Rt({
2947
- round: /* @__PURE__ */ L(
2948
- /* @__PURE__ */ ke(Object.keys(Sn)),
2928
+ round: /* @__PURE__ */ K(
2929
+ /* @__PURE__ */ ke(Object.keys(On)),
2949
2930
  ht.round
2950
2931
  ),
2951
- sticks: /* @__PURE__ */ L(
2932
+ sticks: /* @__PURE__ */ K(
2952
2933
  /* @__PURE__ */ Rt({
2953
- reach: /* @__PURE__ */ L(
2954
- /* @__PURE__ */ un(/* @__PURE__ */ ie(), /* @__PURE__ */ Oe(0, ""), /* @__PURE__ */ Se(9, "")),
2934
+ reach: /* @__PURE__ */ K(
2935
+ /* @__PURE__ */ fn(/* @__PURE__ */ ie(), /* @__PURE__ */ Oe(0, ""), /* @__PURE__ */ Se(9, "")),
2955
2936
  ht.sticks.reach
2956
2937
  ),
2957
- dead: /* @__PURE__ */ L(
2958
- /* @__PURE__ */ un(/* @__PURE__ */ ie(), /* @__PURE__ */ Oe(0, ""), /* @__PURE__ */ Se(9, "")),
2938
+ dead: /* @__PURE__ */ K(
2939
+ /* @__PURE__ */ fn(/* @__PURE__ */ ie(), /* @__PURE__ */ Oe(0, ""), /* @__PURE__ */ Se(9, "")),
2959
2940
  ht.sticks.dead
2960
2941
  )
2961
2942
  }),
2962
2943
  ht.sticks
2963
2944
  ),
2964
- doras: /* @__PURE__ */ L(/* @__PURE__ */ re(), ht.doras),
2965
- front: /* @__PURE__ */ L(
2945
+ doraIndicators: /* @__PURE__ */ K(/* @__PURE__ */ re(), ht.doraIndicators),
2946
+ front: /* @__PURE__ */ K(
2966
2947
  /* @__PURE__ */ ke(Object.keys(We)),
2967
2948
  ht.front
2968
2949
  )
2969
2950
  }),
2970
2951
  ht
2971
- ), lr = /* @__PURE__ */ Rt({
2972
- ...ar.entries,
2973
- board: cr
2974
- }), hr = (s) => {
2975
- const t = dr(s);
2976
- return gr(t);
2977
- }, dr = (s) => {
2978
- const t = ur(s), e = /* @__PURE__ */ or(lr, t);
2979
- if (!e.success)
2980
- throw e.issues;
2981
- return e.output;
2982
- }, ur = (s) => {
2952
+ ), dr = /* @__PURE__ */ Rt({
2953
+ ...lr.entries,
2954
+ board: hr
2955
+ }), ur = (s) => {
2956
+ const t = fr(s);
2957
+ return wr(t);
2958
+ }, fr = (s) => {
2959
+ const t = gr(s);
2960
+ return pr(t);
2961
+ };
2962
+ function pr(s) {
2963
+ const t = /* @__PURE__ */ cr(dr, s);
2964
+ if (!t.success)
2965
+ throw t.issues;
2966
+ return t.output;
2967
+ }
2968
+ const gr = (s) => {
2983
2969
  const t = "table", e = "board", n = s.split(`
2984
2970
  `).map((a) => a.trim()).filter((a) => a != "");
2985
2971
  if (n.length == 0) throw new Error("empty input");
@@ -2994,15 +2980,15 @@ const Yt = /* @__PURE__ */ L(
2994
2980
  const c = o.find((l) => a.startsWith(l));
2995
2981
  if (c == null) throw new Error(`encountered unexpected line ${a}`);
2996
2982
  if (o = o.filter((l) => !a.startsWith(l)), c == e) {
2997
- const [l, d] = pr([...n]);
2983
+ const [l, d] = yr([...n]);
2998
2984
  r.board = l, n.splice(0, d);
2999
2985
  } else {
3000
- const [l, d] = fr([...n]);
2986
+ const [l, d] = mr([...n]);
3001
2987
  r[c] = l, n.splice(0, d);
3002
2988
  }
3003
2989
  }
3004
2990
  return r;
3005
- }, Z = (s, t) => s.replace(t, "").replace(":", "").trim(), fr = (s) => {
2991
+ }, Z = (s, t) => s.replace(t, "").replace(":", "").trim(), mr = (s) => {
3006
2992
  const t = "hand", e = "discard", n = "score", i = {};
3007
2993
  let r = 0;
3008
2994
  for (; r < s.length; r++) {
@@ -3015,13 +3001,13 @@ const Yt = /* @__PURE__ */ L(
3015
3001
  else break;
3016
3002
  }
3017
3003
  return [i, r];
3018
- }, pr = (s) => {
3019
- const t = "doras", e = "round", n = "front", i = "sticks", r = "reach", o = "dead", a = {};
3004
+ }, yr = (s) => {
3005
+ const t = "dora_indicators", e = "round", n = "front", i = "sticks", r = "reach", o = "dead", a = {};
3020
3006
  let c = 0;
3021
3007
  for (; c < s.length; c++) {
3022
3008
  const l = s[c];
3023
3009
  if (l.startsWith(t))
3024
- a.doras = Z(l, t);
3010
+ a.doraIndicators = Z(l, t);
3025
3011
  else if (l.startsWith(e))
3026
3012
  a.round = Z(l, e);
3027
3013
  else if (l.startsWith(n))
@@ -3033,8 +3019,8 @@ const Yt = /* @__PURE__ */ L(
3033
3019
  } else break;
3034
3020
  }
3035
3021
  return [a, c];
3036
- }, gr = (s) => {
3037
- const t = s.board.front, e = mr(t), n = (a) => s[a].discard.replace(/\r?\n/g, ""), i = {
3022
+ }, wr = (s) => {
3023
+ const t = s.board.front, e = Er(t), n = (a) => s[a].discard.replace(/\r?\n/g, ""), i = {
3038
3024
  front: new D(n(e.front)).tiles(),
3039
3025
  right: new D(n(e.right)).tiles(),
3040
3026
  opposite: new D(n(e.opposite)).tiles(),
@@ -3045,10 +3031,10 @@ const Yt = /* @__PURE__ */ L(
3045
3031
  opposite: new D(s[e.opposite].hand).parse(),
3046
3032
  left: new D(s[e.left].hand).parse()
3047
3033
  }, o = {
3048
- round: Sn[s.board.round],
3034
+ round: On[s.board.round],
3049
3035
  frontPlace: We[t],
3050
3036
  sticks: s.board.sticks,
3051
- doras: new D(s.board.doras).tiles(),
3037
+ doraIndicators: new D(s.board.doraIndicators).tiles(),
3052
3038
  scores: {
3053
3039
  front: s[e.front].score,
3054
3040
  right: s[e.right].score,
@@ -3057,11 +3043,11 @@ const Yt = /* @__PURE__ */ L(
3057
3043
  }
3058
3044
  };
3059
3045
  return { discards: i, hands: r, scoreBoard: o };
3060
- }, mr = (s) => ({
3046
+ }, Er = (s) => ({
3061
3047
  front: s,
3062
3048
  right: vt(s),
3063
3049
  opposite: vt(vt(s)),
3064
- left: Le(s)
3050
+ left: Ke(s)
3065
3051
  });
3066
3052
  function* F(s) {
3067
3053
  const t = s?.filterBy && s.filterBy.length > 0 ? s?.filterBy : Object.values(p);
@@ -3116,18 +3102,18 @@ class je {
3116
3102
  const t = [];
3117
3103
  for (const [e, n] of F()) {
3118
3104
  let i = this.get(e, n);
3119
- e != p.Z && n == 5 && this.get(e, 0) > 0 && (i -= this.get(e, 0), t.push(new y(e, n, [g.RED])));
3105
+ e != p.Z && n == 5 && this.get(e, 0) > 0 && (i -= this.get(e, 0), t.push(new y(e, n, [m.RED])));
3120
3106
  for (let r = 0; r < i; r++)
3121
3107
  t.push(new y(e, n));
3122
3108
  }
3123
3109
  if (this.drawn != null) {
3124
3110
  const e = this.drawn, n = t.findIndex(
3125
- (i) => i.equals(e) && e.has(g.RED) == i.has(g.RED)
3111
+ (i) => i.equals(e) && e.has(m.RED) == i.has(m.RED)
3126
3112
  );
3127
3113
  I(
3128
3114
  n >= 0,
3129
3115
  `drawn tile ${this.drawn} not found in hand: ${t.join("")}`
3130
- ), t[n] = t[n].clone({ add: g.TSUMO });
3116
+ ), t[n] = t[n].clone({ add: m.TSUMO });
3131
3117
  }
3132
3118
  return t;
3133
3119
  }
@@ -3135,7 +3121,7 @@ class je {
3135
3121
  * 晒された牌を含む手牌を整形した文字列で返す。
3136
3122
  */
3137
3123
  toString() {
3138
- const t = this.called.length > 0 ? `${X}${this.called.join(X)}` : "", e = this.drawn ? `${X}${this.drawn.toString()}` : "", n = this.hands.filter((r) => !r.has(g.TSUMO));
3124
+ const t = this.called.length > 0 ? `${X}${this.called.join(X)}` : "", e = this.drawn ? `${X}${this.drawn.toString()}` : "", n = this.hands.filter((r) => !r.has(m.TSUMO));
3139
3125
  return `${new Tt(n).toString()}${e}${t}`;
3140
3126
  }
3141
3127
  /**
@@ -3185,13 +3171,13 @@ class je {
3185
3171
  inc(t) {
3186
3172
  const e = [];
3187
3173
  for (const n of t) {
3188
- const i = n.t != p.BACK && this.get(n.t, n.n) >= 4, r = n.has(g.RED) && this.get(n.t, 0) > 0;
3174
+ const i = n.t != p.BACK && this.get(n.t, n.n) >= 4, r = n.has(m.RED) && this.get(n.t, 0) > 0;
3189
3175
  if (i || r) {
3190
3176
  this.dec(e);
3191
3177
  const o = i ? `tile ${n} exists more than 4 times` : `red tile ${n} appears more than once`;
3192
3178
  throw new Error(`invalid hand: ${o} in hand: ${this.toString()}`);
3193
3179
  }
3194
- e.push(n), n.t == p.BACK ? this.data[n.t][1] += 1 : (this.data[n.t][n.n] += 1, n.has(g.RED) && (this.data[n.t][0] += 1));
3180
+ e.push(n), n.t == p.BACK ? this.data[n.t][1] += 1 : (this.data[n.t][n.n] += 1, n.has(m.RED) && (this.data[n.t][0] += 1));
3195
3181
  }
3196
3182
  return e;
3197
3183
  }
@@ -3201,15 +3187,15 @@ class je {
3201
3187
  dec(t) {
3202
3188
  const e = [];
3203
3189
  for (const n of t) {
3204
- const i = this.get(n.t, n.n) < 1, r = n.has(g.RED) && this.get(n.t, 0) <= 0;
3190
+ const i = this.get(n.t, n.n) < 1, r = n.has(m.RED) && this.get(n.t, 0) <= 0;
3205
3191
  if (i || r) {
3206
3192
  this.inc(e);
3207
3193
  const o = i ? `tile ${n} does not exist` : `red tile ${n} does not exist`;
3208
3194
  throw new Error(`invalid hand: ${o} in hand: ${this.toString()}`);
3209
3195
  }
3210
- if (e.push(n), n.t == p.BACK ? this.data[n.t][1] -= 1 : (this.data[n.t][n.n] -= 1, n.has(g.RED) && (this.data[n.t][0] -= 1)), O(n) && this.get(n.t, 5) == 0 && this.get(n.t, 0) > 0) {
3196
+ if (e.push(n), n.t == p.BACK ? this.data[n.t][1] -= 1 : (this.data[n.t][n.n] -= 1, n.has(m.RED) && (this.data[n.t][0] -= 1)), O(n) && this.get(n.t, 5) == 0 && this.get(n.t, 0) > 0) {
3211
3197
  this.data[n.t][0] = 0;
3212
- const o = e.pop().clone({ add: g.RED });
3198
+ const o = e.pop().clone({ add: m.RED });
3213
3199
  e.push(o);
3214
3200
  }
3215
3201
  }
@@ -3219,7 +3205,7 @@ class je {
3219
3205
  * ツモ牌として手牌に加える。
3220
3206
  */
3221
3207
  draw(t) {
3222
- const e = t.clone({ add: g.TSUMO });
3208
+ const e = t.clone({ add: m.TSUMO });
3223
3209
  this.inc([e]), this.data.tsumo = e;
3224
3210
  }
3225
3211
  /**
@@ -3240,7 +3226,7 @@ class je {
3240
3226
  * 他家の打牌を指定したブロックで鳴く。鳴く牌はブロック内で表現する。
3241
3227
  */
3242
3228
  call(t) {
3243
- const e = t.tiles.filter((n) => !n.has(g.HORIZONTAL));
3229
+ const e = t.tiles.filter((n) => !n.has(m.HORIZONTAL));
3244
3230
  if (e.length != t.tiles.length - 1)
3245
3231
  throw new Error(`invalid block: removal tiles: ${e}, block: ${t}`);
3246
3232
  this.dec(e), this.data.called = [...this.called, t], this.data.tsumo = null;
@@ -3253,7 +3239,7 @@ class je {
3253
3239
  this.dec(t.tiles), this.data.called = [...this.called, t], this.data.tsumo = null;
3254
3240
  return;
3255
3241
  }
3256
- if (t instanceof H) {
3242
+ if (t instanceof P) {
3257
3243
  const e = this.data.called.findIndex(
3258
3244
  (i) => i.is(E.PON) && i.tiles[0].equals(t.tiles[0])
3259
3245
  );
@@ -3262,7 +3248,7 @@ class je {
3262
3248
  `cannot find pon block ${t.tiles[0]} to call shokan: ${t}`
3263
3249
  );
3264
3250
  let n = t.tiles[0];
3265
- n = O(n) ? n.clone({ remove: g.RED }) : n, this.dec([n]), this.data.called = [
3251
+ n = O(n) ? n.clone({ remove: m.RED }) : n, this.dec([n]), this.data.called = [
3266
3252
  ...this.called.slice(0, e),
3267
3253
  ...this.called.slice(e + 1),
3268
3254
  t
@@ -3321,18 +3307,18 @@ class ge {
3321
3307
  standardType() {
3322
3308
  const t = (n) => {
3323
3309
  const i = [0, 0, 0];
3324
- for (const [u, m] of F({ filterBy: [p.Z] }))
3325
- this.hand.get(u, m) >= 3 ? i[0]++ : this.hand.get(u, m) == 2 ? i[1]++ : this.hand.get(u, m) == 1 && i[2]++;
3310
+ for (const [u, g] of F({ filterBy: [p.Z] }))
3311
+ this.hand.get(u, g) >= 3 ? i[0]++ : this.hand.get(u, g) == 2 ? i[1]++ : this.hand.get(u, g) == 1 && i[2]++;
3326
3312
  const r = [0, 0, 0], o = this.hand.get(p.BACK, 0), a = o % 3;
3327
3313
  r[0] = Math.floor(o / 3), a == 2 ? r[1] = 1 : a == 1 && (r[2] = 1);
3328
3314
  let c = 13;
3329
3315
  const l = this.calcNumberTilePatterns(p.M), d = this.calcNumberTilePatterns(p.P), h = this.calcNumberTilePatterns(p.S);
3330
3316
  for (const u of [l.patternA, l.patternB])
3331
- for (const m of [d.patternA, d.patternB])
3317
+ for (const g of [d.patternA, d.patternB])
3332
3318
  for (const f of [h.patternA, h.patternB]) {
3333
3319
  const w = [this.hand.called.length, 0, 0];
3334
3320
  for (let A = 0; A < 3; A++)
3335
- w[A] += u[A] + m[A] + f[A] + i[A] + r[A];
3321
+ w[A] += u[A] + g[A] + f[A] + i[A] + r[A];
3336
3322
  const b = this.getStandardTypeShanten(w[0], w[1], w[2], n);
3337
3323
  b < c && (c = b);
3338
3324
  }
@@ -3377,7 +3363,7 @@ class ge {
3377
3363
  return t > 4 && (e += t - 4, t = 4), t + e > 4 && (n += t + e - 4, e = 4 - t), t + e + n > r && (n = r - t - e), i && e++, 13 - t * 3 - e * 2 - n;
3378
3364
  }
3379
3365
  }
3380
- class yr {
3366
+ class br {
3381
3367
  hand;
3382
3368
  constructor(t) {
3383
3369
  this.hand = t;
@@ -3408,12 +3394,12 @@ class yr {
3408
3394
  */
3409
3395
  markedHand(t, e) {
3410
3396
  if (t.length == 0) return [];
3411
- const n = this.hand.drawn != null || e.has(g.TSUMO) ? g.TSUMO : g.RON, i = [], r = {};
3397
+ const n = this.hand.drawn != null || e.has(m.TSUMO) ? m.TSUMO : m.RON, i = [], r = {};
3412
3398
  for (let a = 0; a < t.length; a++) {
3413
3399
  const c = t[a];
3414
3400
  if (c.isCalled()) continue;
3415
3401
  const l = c.tiles.findIndex(
3416
- (h) => h.equals(e) && e.has(g.RED) == h.has(g.RED)
3402
+ (h) => h.equals(e) && e.has(m.RED) == h.has(m.RED)
3417
3403
  );
3418
3404
  if (l < 0) continue;
3419
3405
  const d = zt(c);
@@ -3461,7 +3447,7 @@ class yr {
3461
3447
  const i = n == p.Z ? jt : q;
3462
3448
  for (let r of i)
3463
3449
  if (this.hand.get(n, r) == 1)
3464
- t.push(new On(new y(n, r)));
3450
+ t.push(new kn(new y(n, r)));
3465
3451
  else if (this.hand.get(n, r) == 2 && e == !1)
3466
3452
  t.unshift(new C(new y(n, r), new y(n, r))), e = !0;
3467
3453
  else return [];
@@ -3491,7 +3477,7 @@ class yr {
3491
3477
  for (const [e, n] of F())
3492
3478
  if (this.hand.get(e, n) >= 2) {
3493
3479
  const i = new Array(2).fill(new y(e, n));
3494
- n == 5 && this.hand.get(e, 0) > 0 && this.hand.get(e, n) >= 3 && (i[1] = new y(e, n, [g.RED]));
3480
+ n == 5 && this.hand.get(e, 0) > 0 && this.hand.get(e, n) >= 3 && (i[1] = new y(e, n, [m.RED]));
3495
3481
  const r = this.hand.dec(i), o = this.calcAllBlockCombinations().filter((a) => a.length == 4).map((a) => [new C(r[0], r[1]), ...a]);
3496
3482
  t = [...t, ...o], this.hand.inc(r);
3497
3483
  }
@@ -3514,7 +3500,7 @@ class yr {
3514
3500
  handleBack() {
3515
3501
  const t = p.BACK, e = this.hand.get(t, 0);
3516
3502
  if (e < 3) return [];
3517
- const n = new y(t, 0), i = Array(Math.floor(e / 3)).fill(new K([n, n, n]));
3503
+ const n = new y(t, 0), i = Array(Math.floor(e / 3)).fill(new L([n, n, n]));
3518
3504
  return i.length == 0 ? [] : [i];
3519
3505
  }
3520
3506
  handleZ() {
@@ -3523,7 +3509,7 @@ class yr {
3523
3509
  if (this.hand.get(e, n) == 0) continue;
3524
3510
  if (this.hand.get(e, n) != 3) return [];
3525
3511
  const i = new y(e, n);
3526
- t.push(new K([i, i, i]));
3512
+ t.push(new L([i, i, i]));
3527
3513
  }
3528
3514
  return t.length == 0 ? [] : [t];
3529
3515
  }
@@ -3531,14 +3517,14 @@ class yr {
3531
3517
  * 一つの手牌の構成において、赤牌ごとの手牌(晒したブロックを含まない)の構成を生成する。
3532
3518
  */
3533
3519
  addRedPattern(t, e) {
3534
- const n = new y(t, 5), i = new y(t, 5, [g.RED]), r = [];
3520
+ const n = new y(t, 5), i = new y(t, 5, [m.RED]), r = [];
3535
3521
  let o = null;
3536
3522
  const a = {};
3537
3523
  for (let l = 0; l < e.length; l++) {
3538
- const d = e[l], h = d.tiles.findIndex((f) => O(f) && !f.has(g.RED)), u = d.tiles.findIndex((f) => O(f) && f.has(g.RED));
3524
+ const d = e[l], h = d.tiles.findIndex((f) => O(f) && !f.has(m.RED)), u = d.tiles.findIndex((f) => O(f) && f.has(m.RED));
3539
3525
  if (u > -1 && (o = [l, u]), u > -1 && h > -1 || h < 0) continue;
3540
- const m = zt(d);
3541
- a[m] || (a[m] = !0, r.push([l, h]));
3526
+ const g = zt(d);
3527
+ a[g] || (a[g] = !0, r.push([l, h]));
3542
3528
  }
3543
3529
  if (o == null) return [e];
3544
3530
  const c = [e];
@@ -3547,10 +3533,10 @@ class yr {
3547
3533
  h[l] = u.clone({
3548
3534
  replace: { idx: d, tile: i }
3549
3535
  });
3550
- const m = h[o[0]];
3551
- h[o[0]] = m.clone({
3536
+ const g = h[o[0]];
3537
+ h[o[0]] = g.clone({
3552
3538
  replace: { idx: o[1], tile: n }
3553
- }), zt(u) != zt(m) && c.push(h);
3539
+ }), zt(u) != zt(g) && c.push(h);
3554
3540
  }
3555
3541
  return c;
3556
3542
  }
@@ -3582,7 +3568,7 @@ class yr {
3582
3568
  let r = this.handleNumType(t, e);
3583
3569
  this.hand.inc(i), r.length == 0 && (r = [[]]);
3584
3570
  for (const o of r)
3585
- n.push([new K([i[0], i[1], i[2]]), ...o]);
3571
+ n.push([new L([i[0], i[1], i[2]]), ...o]);
3586
3572
  }
3587
3573
  return n;
3588
3574
  }
@@ -3607,14 +3593,14 @@ const jt = [1, 2, 3, 4, 5, 6, 7], q = [1, 9], Vt = (s) => {
3607
3593
  DOUBLE_YAKUMAN: 16e3,
3608
3594
  DEAD_STICK: 300,
3609
3595
  REACH_STICK: 1e3
3610
- }, wr = [
3596
+ }, _r = [
3611
3597
  { minHan: 26, points: M.DOUBLE_YAKUMAN },
3612
3598
  { minHan: 13, points: M.YAKUMAN },
3613
3599
  { minHan: 11, points: M.TRIPLE },
3614
3600
  { minHan: 8, points: M.DOUBLE },
3615
3601
  { minHan: 6, points: M.HANEMAN },
3616
3602
  { minHan: 5, points: M.MANGAN }
3617
- ], Er = {
3603
+ ], Ar = {
3618
3604
  [M.MANGAN]: "満貫",
3619
3605
  [M.HANEMAN]: "跳満",
3620
3606
  [M.DOUBLE]: "倍満",
@@ -3626,17 +3612,17 @@ const jt = [1, 2, 3, 4, 5, 6, 7], q = [1, 9], Vt = (s) => {
3626
3612
  CHILD_TUMO_FROM_PARENT: 2,
3627
3613
  CHILD_TUMO_FROM_CHILD: 1
3628
3614
  };
3629
- function _r(s) {
3615
+ function Ir(s) {
3630
3616
  if (s.isYakuman) return "役満";
3631
3617
  if (s.isCountableYakuman) return "数え役満";
3632
- const t = br(
3618
+ const t = Nr(
3633
3619
  s.base,
3634
3620
  s.isTsumo,
3635
3621
  s.isParent
3636
- ), e = Er[s.base];
3622
+ ), e = Ar[s.base];
3637
3623
  return e ? `${s.fu}符${s.han}飜 ${e}${t}` : `${s.fu}符${s.han}飜 ${t}`;
3638
3624
  }
3639
- function br(s, t, e) {
3625
+ function Nr(s, t, e) {
3640
3626
  if (t)
3641
3627
  return e ? `${nt(s * Y.PARENT_TSUMO)}` : `${nt(s * Y.CHILD_TUMO_FROM_CHILD)}-${nt(
3642
3628
  s * Y.CHILD_TUMO_FROM_PARENT
@@ -3647,15 +3633,15 @@ function br(s, t, e) {
3647
3633
  }
3648
3634
  }
3649
3635
  const nt = (s, t = 100) => Math.ceil(s / t) * t;
3650
- class Fn {
3636
+ class Gn {
3651
3637
  hand;
3652
3638
  cfg;
3653
3639
  constructor(t, e) {
3654
3640
  this.hand = t, this.cfg = {
3655
- doras: e.doraIndicators.map((n) => pn(n)),
3641
+ doras: e.doraIndicators.map((n) => gn(n)),
3656
3642
  // convert to dora
3657
- hiddenDoras: e.hiddenDoraIndicators == null ? [] : e.hiddenDoraIndicators.map((n) => pn(n)),
3658
- roundWind: y.from(ks(e.round)),
3643
+ hiddenDoras: e.hiddenDoraIndicators == null ? [] : e.hiddenDoraIndicators.map((n) => gn(n)),
3644
+ roundWind: y.from(Rs(e.round)),
3659
3645
  myWind: y.from(e.myWind),
3660
3646
  reached: e.doubleReached ? 2 : t.reached ? 1 : 0,
3661
3647
  sticks: e.sticks ?? { dead: 0, reach: 0 },
@@ -3684,7 +3670,7 @@ class Fn {
3684
3670
  this.cfg.orig.ronWind
3685
3671
  ), o = r[i.myWind];
3686
3672
  this.addStickPoints(r, i.myWind, this.cfg.orig.ronWind);
3687
- const a = _r({
3673
+ const a = Ir({
3688
3674
  base: i.base,
3689
3675
  fu: i.fu,
3690
3676
  han: i.han,
@@ -3799,13 +3785,13 @@ class Fn {
3799
3785
  return t === 30 && e === 4 || t === 60 && e === 3;
3800
3786
  }
3801
3787
  isTsumoWin(t) {
3802
- return t.some((e) => e.tiles.some((n) => n.has(g.TSUMO)));
3788
+ return t.some((e) => e.tiles.some((n) => n.has(m.TSUMO)));
3803
3789
  }
3804
3790
  /**
3805
3791
  * Wind をキーとした点数移動の構成を返す
3806
3792
  */
3807
3793
  calculateDeltas(t, e, n, i, r) {
3808
- const o = W(0);
3794
+ const o = W(() => 0);
3809
3795
  return e ? this.calculateTsumoDeltas(o, t, n, i) : (I(r != null, "tumo is false but ron wind is null"), this.calculateRonDeltas(o, t, n, i, r)), o;
3810
3796
  }
3811
3797
  calculateRonDeltas(t, e, n, i, r) {
@@ -3835,7 +3821,7 @@ class Fn {
3835
3821
  r == e ? t[r] += i : t[r] -= i / 3;
3836
3822
  }
3837
3823
  getBasePoints(t, e) {
3838
- for (const { minHan: n, points: i } of wr)
3824
+ for (const { minHan: n, points: i } of _r)
3839
3825
  if (t >= n) return i;
3840
3826
  return Math.min(e * 2 ** (t + 2), M.MANGAN);
3841
3827
  }
@@ -3846,12 +3832,12 @@ class Fn {
3846
3832
  return this.cfg.reached == 1 ? [{ name: "立直", han: 1 }] : this.cfg.reached == 2 ? [{ name: "ダブル立直", han: 2 }] : [];
3847
3833
  }
3848
3834
  dB1(t) {
3849
- return this.hand.drawn == null, this.getCalledPenalty() != 0 ? [] : t.some((n) => n.tiles.some((i) => i.has(g.TSUMO))) ? [{ name: "門前清自摸和", han: 1 }] : [];
3835
+ return this.hand.drawn == null, this.getCalledPenalty() != 0 ? [] : t.some((n) => n.tiles.some((i) => i.has(m.TSUMO))) ? [{ name: "門前清自摸和", han: 1 }] : [];
3850
3836
  }
3851
3837
  dC1(t) {
3852
3838
  if (this.getCalledPenalty() != 0) return [];
3853
3839
  const e = "平和", n = this.calcFu(t);
3854
- return n == 20 ? [{ name: e, han: 1 }] : !t.some((i) => i.tiles.some((r) => r.has(g.TSUMO))) && n == 30 ? [{ name: e, han: 1 }] : [];
3840
+ return n == 20 ? [{ name: e, han: 1 }] : !t.some((i) => i.tiles.some((r) => r.has(m.TSUMO))) && n == 30 ? [{ name: e, han: 1 }] : [];
3855
3841
  }
3856
3842
  dD1(t) {
3857
3843
  return t.some(
@@ -3859,7 +3845,7 @@ class Fn {
3859
3845
  ) ? [] : [{ name: "断么九", han: 1 }];
3860
3846
  }
3861
3847
  dE1(t) {
3862
- return this.getCalledPenalty() != 0 ? [] : fn(t) == 1 ? [{ name: "一盃口", han: 1 }] : [];
3848
+ return this.getCalledPenalty() != 0 ? [] : pn(t) == 1 ? [{ name: "一盃口", han: 1 }] : [];
3863
3849
  }
3864
3850
  dF1(t) {
3865
3851
  const e = [];
@@ -3891,7 +3877,7 @@ class Fn {
3891
3877
  ), i = e.reduce(
3892
3878
  (a, c) => a + this.cfg.hiddenDoras.filter((l) => c.equals(l)).length,
3893
3879
  0
3894
- ), r = e.filter((a) => a.has(g.RED)).length, o = [];
3880
+ ), r = e.filter((a) => a.has(m.RED)).length, o = [];
3895
3881
  return n > 0 && o.push({ name: "ドラ", han: n }), r > 0 && o.push({ name: "赤ドラ", han: r }), this.hand.reached && i > 0 && o.push({ name: "裏ドラ", han: i }), o;
3896
3882
  }
3897
3883
  dA2(t) {
@@ -3915,19 +3901,19 @@ class Fn {
3915
3901
  }
3916
3902
  dC2(t) {
3917
3903
  return t.length == 7 ? [] : t.every(
3918
- (n) => n instanceof R || n instanceof H || n instanceof z || n instanceof K || n instanceof U || n instanceof C
3904
+ (n) => n instanceof R || n instanceof P || n instanceof z || n instanceof L || n instanceof U || n instanceof C
3919
3905
  ) ? [{ name: "対々和", han: 2 }] : [];
3920
3906
  }
3921
3907
  dD2(t) {
3922
- return t.filter((n) => (n instanceof R || n instanceof K) && !n.tiles.some((i) => i.has(g.RON))).length >= 3 ? [{ name: "三暗刻", han: 2 }] : [];
3908
+ return t.filter((n) => (n instanceof R || n instanceof L) && !n.tiles.some((i) => i.has(m.RON))).length >= 3 ? [{ name: "三暗刻", han: 2 }] : [];
3923
3909
  }
3924
3910
  dE2(t) {
3925
3911
  return t.filter(
3926
- (n) => n instanceof R || n instanceof H || n instanceof z
3912
+ (n) => n instanceof R || n instanceof P || n instanceof z
3927
3913
  ).length >= 3 ? [{ name: "三槓子", han: 2 }] : [];
3928
3914
  }
3929
3915
  dF2(t) {
3930
- const e = (n) => n instanceof R || n instanceof H || n instanceof z || n instanceof K || n instanceof U;
3916
+ const e = (n) => n instanceof R || n instanceof P || n instanceof z || n instanceof L || n instanceof U;
3931
3917
  for (const n of t) {
3932
3918
  if (!e(n)) continue;
3933
3919
  const i = dt(n);
@@ -3952,7 +3938,7 @@ class Fn {
3952
3938
  dH2(t) {
3953
3939
  return t.every((n) => {
3954
3940
  const i = n.tiles[0], r = i.t == p.Z ? jt : q;
3955
- return (n instanceof R || n instanceof H || n instanceof z || n instanceof K || n instanceof U || n instanceof C) && r.includes(i.n);
3941
+ return (n instanceof R || n instanceof P || n instanceof z || n instanceof L || n instanceof U || n instanceof C) && r.includes(i.n);
3956
3942
  }) ? [{ name: "混老頭", han: 2 }] : [];
3957
3943
  }
3958
3944
  dI2(t) {
@@ -3987,7 +3973,7 @@ class Fn {
3987
3973
  return t.length == 7 ? [] : t.some((n) => n instanceof gt || n instanceof V) ? t.some((n) => n.tiles[0].t == p.Z) ? [] : t.every((n) => n.tiles.some((i) => q.includes(i.n))) ? [{ name: "純全帯么九色", han: 3 - this.getCalledPenalty() }] : [] : [];
3988
3974
  }
3989
3975
  dC3(t) {
3990
- return this.getCalledPenalty() != 0 ? [] : fn(t) == 2 ? [{ name: "ニ盃口", han: 3 }] : [];
3976
+ return this.getCalledPenalty() != 0 ? [] : pn(t) == 2 ? [{ name: "ニ盃口", han: 3 }] : [];
3991
3977
  }
3992
3978
  dA6(t) {
3993
3979
  if (t.some((e) => e.tiles[0].t == p.Z)) return [];
@@ -3999,7 +3985,7 @@ class Fn {
3999
3985
  }
4000
3986
  dA13(t) {
4001
3987
  return t.length != 13 ? [] : t.some(
4002
- (n) => n instanceof C && n.tiles.some((i) => i.has(g.TSUMO) || i.has(g.RON))
3988
+ (n) => n instanceof C && n.tiles.some((i) => i.has(m.TSUMO) || i.has(m.RON))
4003
3989
  ) ? [{ name: "国士無双13面待ち", han: 26, isYakuman: !0 }] : [{ name: "国士無双", han: 13, isYakuman: !0 }];
4004
3990
  }
4005
3991
  dB13(t) {
@@ -4007,9 +3993,9 @@ class Fn {
4007
3993
  }
4008
3994
  dC13(t) {
4009
3995
  return t.length == 7 ? [] : t.every(
4010
- (i) => i instanceof R || i instanceof K && i.tiles.every((r) => !r.has(g.RON)) || i instanceof C
3996
+ (i) => i instanceof R || i instanceof L && i.tiles.every((r) => !r.has(m.RON)) || i instanceof C
4011
3997
  ) ? t.some(
4012
- (i) => i instanceof C && i.tiles.some((r) => r.has(g.TSUMO) || r.has(g.RON))
3998
+ (i) => i instanceof C && i.tiles.some((r) => r.has(m.TSUMO) || r.has(m.RON))
4013
3999
  ) ? [{ name: "四暗刻単騎待ち", han: 26, isYakuman: !0 }] : [{ name: "四暗刻", han: 13, isYakuman: !0 }] : [];
4014
4000
  }
4015
4001
  dD13(t) {
@@ -4024,12 +4010,12 @@ class Fn {
4024
4010
  }
4025
4011
  dF13(t) {
4026
4012
  return t.every(
4027
- (n) => (n instanceof R || n instanceof H || n instanceof z || n instanceof K || n instanceof U || n instanceof C) && q.includes(n.tiles[0].n)
4013
+ (n) => (n instanceof R || n instanceof P || n instanceof z || n instanceof L || n instanceof U || n instanceof C) && q.includes(n.tiles[0].n)
4028
4014
  ) ? [{ name: "清老頭", han: 13, isYakuman: !0 }] : [];
4029
4015
  }
4030
4016
  dG13(t) {
4031
4017
  return t.length == 7 ? [] : t.every(
4032
- (n) => n instanceof R || n instanceof H || n instanceof z || n instanceof C
4018
+ (n) => n instanceof R || n instanceof P || n instanceof z || n instanceof C
4033
4019
  ) ? [{ name: "四槓子", han: 13, isYakuman: !0 }] : [];
4034
4020
  }
4035
4021
  dH13(t) {
@@ -4060,21 +4046,21 @@ class Fn {
4060
4046
  const e = 20;
4061
4047
  let n = e;
4062
4048
  const i = this.cfg.myWind.n, r = this.cfg.roundWind.n, o = t.find(
4063
- (f) => f.tiles.some((w) => w.has(g.TSUMO) || w.has(g.RON))
4064
- ), a = this.getCalledPenalty() == 1, c = o.tiles.some((f) => f.has(g.TSUMO)), l = (f, w) => {
4049
+ (f) => f.tiles.some((w) => w.has(m.TSUMO) || w.has(m.RON))
4050
+ ), a = this.getCalledPenalty() == 1, c = o.tiles.some((f) => f.has(m.TSUMO)), l = (f, w) => {
4065
4051
  const b = f.tiles[0];
4066
4052
  return b.t == p.Z || q.includes(b.n) ? w * 2 : w;
4067
4053
  };
4068
4054
  for (const f of t)
4069
4055
  switch (!0) {
4070
- case f instanceof K:
4071
- const w = f.tiles.some((b) => b.has(g.RON)) ? 2 : 4;
4056
+ case f instanceof L:
4057
+ const w = f.tiles.some((b) => b.has(m.RON)) ? 2 : 4;
4072
4058
  n += l(f, w);
4073
4059
  break;
4074
4060
  case f instanceof U:
4075
4061
  n += l(f, 2);
4076
4062
  break;
4077
- case (f instanceof z || f instanceof H):
4063
+ case (f instanceof z || f instanceof P):
4078
4064
  n += l(f, 8);
4079
4065
  break;
4080
4066
  case f instanceof R:
@@ -4082,24 +4068,24 @@ class Fn {
4082
4068
  break;
4083
4069
  }
4084
4070
  n += ((f) => {
4085
- if (f instanceof K) return 0;
4071
+ if (f instanceof L) return 0;
4086
4072
  if (f instanceof C) return 2;
4087
- const w = f.tiles, b = w.findIndex((A) => A.has(g.TSUMO) || A.has(g.RON));
4073
+ const w = f.tiles, b = w.findIndex((A) => A.has(m.TSUMO) || A.has(m.RON));
4088
4074
  return b == 1 || b == 0 && w[2].n == 9 || b == 2 && w[0].n == 1 ? 2 : 0;
4089
4075
  })(o);
4090
4076
  const u = t.find((f) => f instanceof C).tiles[0];
4091
4077
  u.t == p.Z && ([5, 6, 7].includes(u.n) && (n += 2), (u.n == r || u.n == i) && (n += 2));
4092
- let m = !1;
4093
- return !a && n == e && (m = !0), c && !m && (n += 2), !c && !a && (n += 10), !c && !a && n == 30 && (m = !0), a && n == e && (n = 30), n;
4078
+ let g = !1;
4079
+ return !a && n == e && (g = !0), c && !g && (n += 2), !c && !a && (n += 10), !c && !a && n == 30 && (g = !0), a && n == e && (n = 30), n;
4094
4080
  }
4095
4081
  }
4096
- const zt = (s) => s.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""), fn = (s) => {
4082
+ const zt = (s) => s.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""), pn = (s) => {
4097
4083
  const t = s.filter((e) => e instanceof gt).reduce((e, n) => {
4098
4084
  const i = zt(n);
4099
4085
  return e[i] = (e[i] || 0) + 1, e;
4100
4086
  }, {});
4101
4087
  return Object.values(t).filter((e) => e >= 2).length;
4102
- }, dt = (s) => [...s.tiles].sort(fe)[0], pn = (s) => {
4088
+ }, dt = (s) => [...s.tiles].sort(fe)[0], gn = (s) => {
4103
4089
  const t = s.n, e = s.t;
4104
4090
  if (e == p.Z) {
4105
4091
  if (t == 4) return new y(e, 1);
@@ -4119,7 +4105,7 @@ class Ft {
4119
4105
  for (const o of e) {
4120
4106
  const a = t.dec([o]), c = Ft.getEffectiveTiles(t, n);
4121
4107
  t.inc(a);
4122
- const l = n?.arrangeRed && o.has(g.RED) ? o.clone({ removeAll: !0 }) : o.has(g.RED) ? o.clone({ removeAll: !0, add: g.RED }) : o.clone({ removeAll: !0 });
4108
+ const l = n?.arrangeRed && o.has(m.RED) ? o.clone({ removeAll: !0 }) : o.has(m.RED) ? o.clone({ removeAll: !0, add: m.RED }) : o.clone({ removeAll: !0 });
4123
4109
  c.shanten < r ? (i.clear(), i.set(l.toString(), {
4124
4110
  shanten: c.shanten,
4125
4111
  effectiveTiles: c.effectiveTiles,
@@ -4170,14 +4156,14 @@ const Re = () => {
4170
4156
  }
4171
4157
  };
4172
4158
  };
4173
- function Ar(s) {
4174
- const t = ["RON", "DAI_KAN", "PON", "CHI"], e = s.map((r) => r.choices), i = Gn(e, t).map((r) => s[r]);
4159
+ function Tr(s) {
4160
+ const t = ["RON", "DAI_KAN", "PON", "CHI"], e = s.map((r) => r.choices), i = Zn(e, t).map((r) => s[r]);
4175
4161
  return {
4176
4162
  events: i,
4177
- type: Zn(t, i[0]?.choices)
4163
+ type: Yn(t, i[0]?.choices)
4178
4164
  };
4179
4165
  }
4180
- function Ir(s) {
4166
+ function vr(s) {
4181
4167
  const t = [
4182
4168
  "TSUMO",
4183
4169
  "REACH",
@@ -4185,34 +4171,34 @@ function Ir(s) {
4185
4171
  "SHO_KAN",
4186
4172
  "DRAWN_GAME_BY_NINE_TERMINALS",
4187
4173
  "DISCARD"
4188
- ], e = s.map((r) => r.choices), i = Gn(e, t).map((r) => s[r]);
4174
+ ], e = s.map((r) => r.choices), i = Zn(e, t).map((r) => s[r]);
4189
4175
  return {
4190
4176
  events: i,
4191
- type: Zn(t, i[0]?.choices)
4177
+ type: Yn(t, i[0]?.choices)
4192
4178
  };
4193
4179
  }
4194
- function Gn(s, t) {
4180
+ function Zn(s, t) {
4195
4181
  let e = [], n = Number.POSITIVE_INFINITY;
4196
4182
  for (let i = 0; i < s.length; i++) {
4197
4183
  const r = s[i];
4198
- if (Nr(r, t)) {
4199
- const o = Tr(t, r);
4184
+ if (Sr(r, t)) {
4185
+ const o = Or(t, r);
4200
4186
  o < n ? (n = o, e = [i]) : o === n && e.push(i);
4201
4187
  }
4202
4188
  }
4203
4189
  return e;
4204
4190
  }
4205
- function Nr(s, t) {
4191
+ function Sr(s, t) {
4206
4192
  return t.some((e) => !!s[e]);
4207
4193
  }
4208
- function Tr(s, t) {
4194
+ function Or(s, t) {
4209
4195
  for (let e = 0; e < s.length; e++) {
4210
4196
  const n = s[e];
4211
4197
  if (t[n]) return e;
4212
4198
  }
4213
4199
  return Number.POSITIVE_INFINITY;
4214
4200
  }
4215
- function Zn(s, t) {
4201
+ function Yn(s, t) {
4216
4202
  if (t == null) return !1;
4217
4203
  for (const e of s)
4218
4204
  if (t[e]) return e;
@@ -4227,7 +4213,7 @@ const Jt = () => {
4227
4213
  on: (i) => s.on(i)
4228
4214
  };
4229
4215
  return [e, n];
4230
- }, vr = () => {
4216
+ }, kr = () => {
4231
4217
  const s = Re();
4232
4218
  return {
4233
4219
  emit: (n) => {
@@ -4259,7 +4245,7 @@ class oe {
4259
4245
  }
4260
4246
  class ae {
4261
4247
  playerToWind = {};
4262
- windToPlayer = W("");
4248
+ windToPlayer = W(() => "");
4263
4249
  _round;
4264
4250
  _sticks;
4265
4251
  constructor(t, e) {
@@ -4275,7 +4261,7 @@ class ae {
4275
4261
  }
4276
4262
  update() {
4277
4263
  for (let t in this.playerToWind) {
4278
- const e = Le(this.playerToWind[t]);
4264
+ const e = Ke(this.playerToWind[t]);
4279
4265
  this.playerToWind[t] = e, this.windToPlayer[e] = t;
4280
4266
  }
4281
4267
  }
@@ -4308,19 +4294,21 @@ class ae {
4308
4294
  return this.playerToWind;
4309
4295
  }
4310
4296
  }
4311
- function Yn(s) {
4297
+ function Vn(s) {
4312
4298
  for (let t = s.length - 1; t > 0; t--) {
4313
4299
  const e = Math.floor(Math.random() * (t + 1));
4314
4300
  [s[t], s[e]] = [s[e], s[t]];
4315
4301
  }
4316
4302
  return s;
4317
4303
  }
4318
- class Sr {
4304
+ class Cr {
4319
4305
  constructor(t = !1) {
4320
4306
  this.disabled = t, this.c = this.initial();
4321
4307
  }
4322
4308
  c;
4323
- safeTileMap = W({}, !0);
4309
+ safeTileMap = W(
4310
+ () => ({})
4311
+ );
4324
4312
  get(t) {
4325
4313
  return t.t == p.BACK ? 0 : this.c[t.t][t.n];
4326
4314
  }
@@ -4330,7 +4318,7 @@ class Sr {
4330
4318
  if (e.t != p.BACK) {
4331
4319
  if (this.get(e) <= 0)
4332
4320
  throw new Error(`[counter] tile ${e} appears more than 4 times`);
4333
- if (this.c[e.t][e.n] -= 1, e.has(g.RED)) {
4321
+ if (this.c[e.t][e.n] -= 1, e.has(m.RED)) {
4334
4322
  if (this.c[e.t][0] <= 0)
4335
4323
  throw new Error(`[counter] red tile ${e} appears more than once`);
4336
4324
  this.c[e.t][0] -= 1;
@@ -4338,9 +4326,15 @@ class Sr {
4338
4326
  }
4339
4327
  }
4340
4328
  }
4329
+ /**
4330
+ * @deprecated 非推奨にします。
4331
+ */
4341
4332
  addTileToSafeMap(t, e) {
4342
4333
  this.disabled || (this.safeTileMap[e][this.key(t.t, t.n)] = !0);
4343
4334
  }
4335
+ /**
4336
+ * @deprecated 非推奨にします。
4337
+ */
4344
4338
  isSafeTile(t, e, n) {
4345
4339
  return this.safeTileMap[n][this.key(t, e)];
4346
4340
  }
@@ -4359,36 +4353,38 @@ class Sr {
4359
4353
  };
4360
4354
  }
4361
4355
  }
4362
- class Vn {
4363
- m = [];
4364
- constructor() {
4365
- }
4356
+ class Jn {
4357
+ all = [];
4358
+ byWind = /* @__PURE__ */ new Map();
4366
4359
  discard(t, e) {
4367
- this.m.push({ w: e, t });
4360
+ const n = { w: e, t };
4361
+ this.all.push(n);
4362
+ const i = this.byWind.get(e);
4363
+ i ? i.push(n) : this.byWind.set(e, [n]);
4368
4364
  }
4369
4365
  discards(t) {
4370
- return t == null ? [...this.m] : this.m.filter((e) => e.w == t);
4366
+ return t == null ? this.all : this.byWind.get(t) ?? [];
4371
4367
  }
4372
4368
  get lastTile() {
4373
- const t = this.m.at(-1);
4369
+ const t = this.all.at(-1);
4374
4370
  return I(
4375
4371
  t != null,
4376
- `lastTile is null(${t}). river: ${JSON.stringify(this.m, null, 2)}`
4372
+ `lastTile is null. river: ${JSON.stringify(this.all, null, 2)}`
4377
4373
  ), t;
4378
4374
  }
4379
4375
  markCalled() {
4380
4376
  this.lastTile.callMarker = !0;
4381
4377
  }
4382
4378
  isFourWindsAbort() {
4383
- const t = this.discards();
4384
- if (t.length != 4) return !1;
4385
- let e = t[0].t;
4386
- if (e.isNum()) return !1;
4387
- for (let n = 0; n < 4; n++) if (!e.equals(t[n].t)) return !1;
4388
- return !0;
4379
+ if (this.all.length != 4) return !1;
4380
+ const t = this.all[0].t;
4381
+ return t.isNum() ? !1 : this.all.every((e) => t.equals(e.t));
4382
+ }
4383
+ reset() {
4384
+ this.all = [], this.byWind.clear();
4389
4385
  }
4390
4386
  }
4391
- function Or() {
4387
+ function Rr() {
4392
4388
  if (typeof globalThis < "u")
4393
4389
  return globalThis;
4394
4390
  if (typeof self < "u")
@@ -4398,18 +4394,18 @@ function Or() {
4398
4394
  if (typeof global < "u")
4399
4395
  return global;
4400
4396
  }
4401
- function kr() {
4402
- const s = Or();
4397
+ function Mr() {
4398
+ const s = Rr();
4403
4399
  if (s.__xstate__)
4404
4400
  return s.__xstate__;
4405
4401
  }
4406
- const Cr = (s) => {
4402
+ const xr = (s) => {
4407
4403
  if (typeof window > "u")
4408
4404
  return;
4409
- const t = kr();
4405
+ const t = Mr();
4410
4406
  t && t.register(s);
4411
4407
  };
4412
- class gn {
4408
+ class mn {
4413
4409
  constructor(t) {
4414
4410
  this._process = t, this._active = !1, this._current = null, this._last = null;
4415
4411
  }
@@ -4438,8 +4434,8 @@ class gn {
4438
4434
  this._last = null;
4439
4435
  }
4440
4436
  }
4441
- const Jn = ".", Rr = "", Xn = "", Mr = "#", xr = "*", qn = "xstate.init", Me = "xstate.stop";
4442
- function $r(s, t) {
4437
+ const Xn = ".", $r = "", qn = "", Pr = "#", Hr = "*", Qn = "xstate.init", Me = "xstate.stop";
4438
+ function Br(s, t) {
4443
4439
  return {
4444
4440
  type: `xstate.after.${s}.${t}`
4445
4441
  };
@@ -4450,23 +4446,23 @@ function xe(s, t) {
4450
4446
  output: t
4451
4447
  };
4452
4448
  }
4453
- function Hr(s, t) {
4449
+ function Wr(s, t) {
4454
4450
  return {
4455
4451
  type: `xstate.done.actor.${s}`,
4456
4452
  output: t,
4457
4453
  actorId: s
4458
4454
  };
4459
4455
  }
4460
- function Pr(s, t) {
4456
+ function Dr(s, t) {
4461
4457
  return {
4462
4458
  type: `xstate.error.actor.${s}`,
4463
4459
  error: t,
4464
4460
  actorId: s
4465
4461
  };
4466
4462
  }
4467
- function Qn(s) {
4463
+ function ts(s) {
4468
4464
  return {
4469
- type: qn,
4465
+ type: Qn,
4470
4466
  input: s
4471
4467
  };
4472
4468
  }
@@ -4475,13 +4471,13 @@ function G(s) {
4475
4471
  throw s;
4476
4472
  });
4477
4473
  }
4478
- const Br = typeof Symbol == "function" && Symbol.observable || "@@observable";
4479
- function ts(s, t) {
4480
- const e = mn(s), n = mn(t);
4481
- return typeof n == "string" ? typeof e == "string" ? n === e : !1 : typeof e == "string" ? e in n : Object.keys(e).every((i) => i in n ? ts(e[i], n[i]) : !1);
4474
+ const Lr = typeof Symbol == "function" && Symbol.observable || "@@observable";
4475
+ function es(s, t) {
4476
+ const e = yn(s), n = yn(t);
4477
+ return typeof n == "string" ? typeof e == "string" ? n === e : !1 : typeof e == "string" ? e in n : Object.keys(e).every((i) => i in n ? es(e[i], n[i]) : !1);
4482
4478
  }
4483
4479
  function Fe(s) {
4484
- if (ns(s))
4480
+ if (ss(s))
4485
4481
  return s;
4486
4482
  const t = [];
4487
4483
  let e = "";
@@ -4500,15 +4496,15 @@ function Fe(s) {
4500
4496
  }
4501
4497
  return t.push(e), t;
4502
4498
  }
4503
- function mn(s) {
4504
- if (wo(s))
4499
+ function yn(s) {
4500
+ if (Io(s))
4505
4501
  return s.value;
4506
4502
  if (typeof s != "string")
4507
4503
  return s;
4508
4504
  const t = Fe(s);
4509
- return Wr(t);
4505
+ return Kr(t);
4510
4506
  }
4511
- function Wr(s) {
4507
+ function Kr(s) {
4512
4508
  if (s.length === 1)
4513
4509
  return s[0];
4514
4510
  const t = {};
@@ -4522,7 +4518,7 @@ function Wr(s) {
4522
4518
  }
4523
4519
  return t;
4524
4520
  }
4525
- function yn(s, t) {
4521
+ function wn(s, t) {
4526
4522
  const e = {}, n = Object.keys(s);
4527
4523
  for (let i = 0; i < n.length; i++) {
4528
4524
  const r = n[i];
@@ -4530,11 +4526,11 @@ function yn(s, t) {
4530
4526
  }
4531
4527
  return e;
4532
4528
  }
4533
- function es(s) {
4534
- return ns(s) ? s : [s];
4529
+ function ns(s) {
4530
+ return ss(s) ? s : [s];
4535
4531
  }
4536
4532
  function st(s) {
4537
- return s === void 0 ? [] : es(s);
4533
+ return s === void 0 ? [] : ns(s);
4538
4534
  }
4539
4535
  function $e(s, t, e, n) {
4540
4536
  return typeof s == "function" ? s({
@@ -4543,22 +4539,22 @@ function $e(s, t, e, n) {
4543
4539
  self: n
4544
4540
  }) : s;
4545
4541
  }
4546
- function ns(s) {
4542
+ function ss(s) {
4547
4543
  return Array.isArray(s);
4548
4544
  }
4549
- function Dr(s) {
4545
+ function zr(s) {
4550
4546
  return s.type.startsWith("xstate.error.actor");
4551
4547
  }
4552
4548
  function It(s) {
4553
- return es(s).map((t) => typeof t > "u" || typeof t == "string" ? {
4549
+ return ns(s).map((t) => typeof t > "u" || typeof t == "string" ? {
4554
4550
  target: t
4555
4551
  } : t);
4556
4552
  }
4557
- function ss(s) {
4558
- if (!(s === void 0 || s === Rr))
4553
+ function is(s) {
4554
+ if (!(s === void 0 || s === $r))
4559
4555
  return st(s);
4560
4556
  }
4561
- function He(s, t, e) {
4557
+ function Pe(s, t, e) {
4562
4558
  const n = typeof s == "object", i = n ? s : void 0;
4563
4559
  return {
4564
4560
  next: (n ? s.next : s)?.bind(i),
@@ -4566,7 +4562,7 @@ function He(s, t, e) {
4566
4562
  complete: (n ? s.complete : e)?.bind(i)
4567
4563
  };
4568
4564
  }
4569
- function wn(s, t) {
4565
+ function En(s, t) {
4570
4566
  return `${t}.${s}`;
4571
4567
  }
4572
4568
  function Ge(s, t) {
@@ -4576,83 +4572,98 @@ function Ge(s, t) {
4576
4572
  const [, n, i] = e, o = s.getStateNodeById(i).config.invoke;
4577
4573
  return (Array.isArray(o) ? o[n] : o).src;
4578
4574
  }
4579
- function En(s, t) {
4575
+ function Ur(s, t) {
4576
+ if (t === s || t === Hr)
4577
+ return !0;
4578
+ if (!t.endsWith(".*"))
4579
+ return !1;
4580
+ const e = t.split("."), n = s.split(".");
4581
+ for (let i = 0; i < e.length; i++) {
4582
+ const r = e[i], o = n[i];
4583
+ if (r === "*")
4584
+ return i === e.length - 1;
4585
+ if (r !== o)
4586
+ return !1;
4587
+ }
4588
+ return !0;
4589
+ }
4590
+ function bn(s, t) {
4580
4591
  return `${s.sessionId}.${t}`;
4581
4592
  }
4582
- let Kr = 0;
4583
- function Lr(s, t) {
4593
+ let jr = 0;
4594
+ function Fr(s, t) {
4584
4595
  const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Set(), o = {}, {
4585
4596
  clock: a,
4586
4597
  logger: c
4587
4598
  } = t, l = {
4588
- schedule: (u, m, f, w, b = Math.random().toString(36).slice(2)) => {
4599
+ schedule: (u, g, f, w, b = Math.random().toString(36).slice(2)) => {
4589
4600
  const A = {
4590
4601
  source: u,
4591
- target: m,
4602
+ target: g,
4592
4603
  event: f,
4593
4604
  delay: w,
4594
4605
  id: b,
4595
4606
  startedAt: Date.now()
4596
- }, S = En(u, b);
4607
+ }, S = bn(u, b);
4597
4608
  h._snapshot._scheduledEvents[S] = A;
4598
4609
  const x = a.setTimeout(() => {
4599
- delete o[S], delete h._snapshot._scheduledEvents[S], h._relay(u, m, f);
4610
+ delete o[S], delete h._snapshot._scheduledEvents[S], h._relay(u, g, f);
4600
4611
  }, w);
4601
4612
  o[S] = x;
4602
4613
  },
4603
- cancel: (u, m) => {
4604
- const f = En(u, m), w = o[f];
4614
+ cancel: (u, g) => {
4615
+ const f = bn(u, g), w = o[f];
4605
4616
  delete o[f], delete h._snapshot._scheduledEvents[f], w !== void 0 && a.clearTimeout(w);
4606
4617
  },
4607
4618
  cancelAll: (u) => {
4608
- for (const m in h._snapshot._scheduledEvents) {
4609
- const f = h._snapshot._scheduledEvents[m];
4619
+ for (const g in h._snapshot._scheduledEvents) {
4620
+ const f = h._snapshot._scheduledEvents[g];
4610
4621
  f.source === u && l.cancel(u, f.id);
4611
4622
  }
4612
4623
  }
4613
4624
  }, d = (u) => {
4614
4625
  if (!r.size)
4615
4626
  return;
4616
- const m = {
4627
+ const g = {
4617
4628
  ...u,
4618
4629
  rootId: s.sessionId
4619
4630
  };
4620
- r.forEach((f) => f.next?.(m));
4631
+ r.forEach((f) => f.next?.(g));
4621
4632
  }, h = {
4622
4633
  _snapshot: {
4623
4634
  _scheduledEvents: (t?.snapshot && t.snapshot.scheduler) ?? {}
4624
4635
  },
4625
- _bookId: () => `x:${Kr++}`,
4626
- _register: (u, m) => (e.set(u, m), u),
4636
+ _bookId: () => `x:${jr++}`,
4637
+ _register: (u, g) => (e.set(u, g), u),
4627
4638
  _unregister: (u) => {
4628
4639
  e.delete(u.sessionId);
4629
- const m = i.get(u);
4630
- m !== void 0 && (n.delete(m), i.delete(u));
4640
+ const g = i.get(u);
4641
+ g !== void 0 && (n.delete(g), i.delete(u));
4631
4642
  },
4632
4643
  get: (u) => n.get(u),
4633
4644
  getAll: () => Object.fromEntries(n.entries()),
4634
- _set: (u, m) => {
4645
+ _set: (u, g) => {
4635
4646
  const f = n.get(u);
4636
- if (f && f !== m)
4647
+ if (f && f !== g)
4637
4648
  throw new Error(`Actor with system ID '${u}' already exists.`);
4638
- n.set(u, m), i.set(m, u);
4649
+ n.set(u, g), i.set(g, u);
4639
4650
  },
4640
4651
  inspect: (u) => {
4641
- const m = He(u);
4642
- return r.add(m), {
4652
+ const g = Pe(u);
4653
+ return r.add(g), {
4643
4654
  unsubscribe() {
4644
- r.delete(m);
4655
+ r.delete(g);
4645
4656
  }
4646
4657
  };
4647
4658
  },
4648
4659
  _sendInspectionEvent: d,
4649
- _relay: (u, m, f) => {
4660
+ _relay: (u, g, f) => {
4650
4661
  h._sendInspectionEvent({
4651
4662
  type: "@xstate.event",
4652
4663
  sourceRef: u,
4653
- actorRef: m,
4664
+ actorRef: g,
4654
4665
  event: f
4655
- }), m._send(f);
4666
+ }), g._send(f);
4656
4667
  },
4657
4668
  scheduler: l,
4658
4669
  getSnapshot: () => ({
@@ -4663,14 +4674,14 @@ function Lr(s, t) {
4663
4674
  start: () => {
4664
4675
  const u = h._snapshot._scheduledEvents;
4665
4676
  h._snapshot._scheduledEvents = {};
4666
- for (const m in u) {
4677
+ for (const g in u) {
4667
4678
  const {
4668
4679
  source: f,
4669
4680
  target: w,
4670
4681
  event: b,
4671
4682
  delay: A,
4672
4683
  id: S
4673
- } = u[m];
4684
+ } = u[g];
4674
4685
  l.schedule(f, w, b, A, S);
4675
4686
  }
4676
4687
  },
@@ -4679,12 +4690,12 @@ function Lr(s, t) {
4679
4690
  };
4680
4691
  return h;
4681
4692
  }
4682
- let be = !1;
4693
+ let _e = !1;
4683
4694
  const Ze = 1;
4684
4695
  let B = /* @__PURE__ */ (function(s) {
4685
4696
  return s[s.NotStarted = 0] = "NotStarted", s[s.Running = 1] = "Running", s[s.Stopped = 2] = "Stopped", s;
4686
4697
  })({});
4687
- const zr = {
4698
+ const Gr = {
4688
4699
  clock: {
4689
4700
  setTimeout: (s, t) => setTimeout(s, t),
4690
4701
  clearTimeout: (s) => clearTimeout(s)
@@ -4692,7 +4703,7 @@ const zr = {
4692
4703
  logger: console.log.bind(console),
4693
4704
  devTools: !1
4694
4705
  };
4695
- class Ur {
4706
+ class Zr {
4696
4707
  /**
4697
4708
  * Creates a new actor instance for the given logic with the provided options,
4698
4709
  * if any.
@@ -4701,9 +4712,9 @@ class Ur {
4701
4712
  * @param options Actor options
4702
4713
  */
4703
4714
  constructor(t, e) {
4704
- this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new gn(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = B.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this.systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
4715
+ this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new mn(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = B.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this.systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
4705
4716
  const n = {
4706
- ...zr,
4717
+ ...Gr,
4707
4718
  ...e
4708
4719
  }, {
4709
4720
  clock: i,
@@ -4714,10 +4725,10 @@ class Ur {
4714
4725
  systemId: l,
4715
4726
  inspect: d
4716
4727
  } = n;
4717
- this.system = o ? o.system : Lr(this, {
4728
+ this.system = o ? o.system : Fr(this, {
4718
4729
  clock: i,
4719
4730
  logger: r
4720
- }), d && !o && this.system.inspect(He(d)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = e?.logger ?? this.system._logger, this.clock = e?.clock ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = n, this.src = n.src ?? t, this.ref = this, this._actorScope = {
4731
+ }), d && !o && this.system.inspect(Pe(d)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = e?.logger ?? this.system._logger, this.clock = e?.clock ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = n, this.src = n.src ?? t, this.ref = this, this._actorScope = {
4721
4732
  self: this,
4722
4733
  id: this.id,
4723
4734
  sessionId: this.sessionId,
@@ -4732,10 +4743,10 @@ class Ur {
4732
4743
  h._stop();
4733
4744
  },
4734
4745
  emit: (h) => {
4735
- const u = this.eventListeners.get(h.type), m = this.eventListeners.get("*");
4736
- if (!u && !m)
4746
+ const u = this.eventListeners.get(h.type), g = this.eventListeners.get("*");
4747
+ if (!u && !g)
4737
4748
  return;
4738
- const f = [...u ? u.values() : [], ...m ? m.values() : []];
4749
+ const f = [...u ? u.values() : [], ...g ? g.values() : []];
4739
4750
  for (const w of f)
4740
4751
  try {
4741
4752
  w(h);
@@ -4754,11 +4765,11 @@ class Ur {
4754
4765
  }
4755
4766
  }), !h.exec)
4756
4767
  return;
4757
- const m = be;
4768
+ const g = _e;
4758
4769
  try {
4759
- be = !0, h.exec(h.info, h.params);
4770
+ _e = !0, h.exec(h.info, h.params);
4760
4771
  } finally {
4761
- be = m;
4772
+ _e = g;
4762
4773
  }
4763
4774
  };
4764
4775
  this._processingStatus === B.Running ? u() : this._deferred.push(u);
@@ -4808,7 +4819,7 @@ class Ur {
4808
4819
  } catch (r) {
4809
4820
  G(r);
4810
4821
  }
4811
- this._stopProcedure(), this._complete(), this._doneEvent = Hr(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
4822
+ this._stopProcedure(), this._complete(), this._doneEvent = Wr(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
4812
4823
  break;
4813
4824
  case "error":
4814
4825
  this._error(this._snapshot.error);
@@ -4881,7 +4892,7 @@ class Ur {
4881
4892
  * the latest snapshot
4882
4893
  */
4883
4894
  subscribe(t, e, n) {
4884
- const i = He(t, e, n);
4895
+ const i = Pe(t, e, n);
4885
4896
  if (this._processingStatus !== B.Stopped)
4886
4897
  this.observers.add(i);
4887
4898
  else
@@ -4936,7 +4947,7 @@ class Ur {
4936
4947
  error: () => {
4937
4948
  }
4938
4949
  }), this.system._register(this.sessionId, this), this.systemId && this.system._set(this.systemId, this), this._processingStatus = B.Running;
4939
- const t = Qn(this.options.input);
4950
+ const t = ts(this.options.input);
4940
4951
  switch (this.system._sendInspectionEvent({
4941
4952
  type: "@xstate.event",
4942
4953
  sourceRef: this._parent,
@@ -5000,11 +5011,11 @@ class Ur {
5000
5011
  } catch (e) {
5001
5012
  G(e);
5002
5013
  }
5003
- this.observers.clear();
5014
+ this.observers.clear(), this.eventListeners.clear();
5004
5015
  }
5005
5016
  _reportError(t) {
5006
5017
  if (!this.observers.size) {
5007
- this._parent || G(t);
5018
+ this._parent || G(t), this.eventListeners.clear();
5008
5019
  return;
5009
5020
  }
5010
5021
  let e = !1;
@@ -5017,10 +5028,10 @@ class Ur {
5017
5028
  G(r);
5018
5029
  }
5019
5030
  }
5020
- this.observers.clear(), e && G(t);
5031
+ this.observers.clear(), this.eventListeners.clear(), e && G(t);
5021
5032
  }
5022
5033
  _error(t) {
5023
- this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, Pr(this.id, t));
5034
+ this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, Dr(this.id, t));
5024
5035
  }
5025
5036
  // TODO: atm children don't belong entirely to the actor so
5026
5037
  // in a way - it's not even super aware of them
@@ -5028,7 +5039,7 @@ class Ur {
5028
5039
  // right now, they are being stopped within the machine's transition
5029
5040
  // but that could throw and leave us with "orphaned" active actors
5030
5041
  _stopProcedure() {
5031
- return this._processingStatus !== B.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new gn(this._process.bind(this)), this._processingStatus = B.Stopped, this.system._unregister(this), this);
5042
+ return this._processingStatus !== B.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new mn(this._process.bind(this)), this._processingStatus = B.Stopped, this.system._unregister(this), this);
5032
5043
  }
5033
5044
  /** @internal */
5034
5045
  _send(t) {
@@ -5046,7 +5057,7 @@ class Ur {
5046
5057
  const {
5047
5058
  devTools: t
5048
5059
  } = this.options;
5049
- t && (typeof t == "function" ? t : Cr)(this);
5060
+ t && (typeof t == "function" ? t : xr)(this);
5050
5061
  }
5051
5062
  toJSON() {
5052
5063
  return {
@@ -5070,7 +5081,7 @@ class Ur {
5070
5081
  getPersistedSnapshot(t) {
5071
5082
  return this.logic.getPersistedSnapshot(this._snapshot, t);
5072
5083
  }
5073
- [Br]() {
5084
+ [Lr]() {
5074
5085
  return this;
5075
5086
  }
5076
5087
  /**
@@ -5092,9 +5103,9 @@ class Ur {
5092
5103
  }
5093
5104
  }
5094
5105
  function Mt(s, ...[t]) {
5095
- return new Ur(s, t);
5106
+ return new Zr(s, t);
5096
5107
  }
5097
- function jr(s, t, e, n, {
5108
+ function Yr(s, t, e, n, {
5098
5109
  sendId: i
5099
5110
  }) {
5100
5111
  const r = typeof i == "function" ? i(e, n) : i;
@@ -5102,17 +5113,17 @@ function jr(s, t, e, n, {
5102
5113
  sendId: r
5103
5114
  }, void 0];
5104
5115
  }
5105
- function Fr(s, t) {
5116
+ function Vr(s, t) {
5106
5117
  s.defer(() => {
5107
5118
  s.system.scheduler.cancel(s.self, t.sendId);
5108
5119
  });
5109
5120
  }
5110
- function Gr(s) {
5121
+ function Jr(s) {
5111
5122
  function t(e, n) {
5112
5123
  }
5113
- return t.type = "xstate.cancel", t.sendId = s, t.resolve = jr, t.execute = Fr, t;
5124
+ return t.type = "xstate.cancel", t.sendId = s, t.resolve = Yr, t.execute = Vr, t;
5114
5125
  }
5115
- function Zr(s, t, e, n, {
5126
+ function Xr(s, t, e, n, {
5116
5127
  id: i,
5117
5128
  systemId: r,
5118
5129
  src: o,
@@ -5145,14 +5156,14 @@ function Zr(s, t, e, n, {
5145
5156
  input: u
5146
5157
  }, void 0];
5147
5158
  }
5148
- function Yr(s, {
5159
+ function qr(s, {
5149
5160
  actorRef: t
5150
5161
  }) {
5151
5162
  t && s.defer(() => {
5152
5163
  t._processingStatus !== B.Stopped && t.start();
5153
5164
  });
5154
5165
  }
5155
- function Vr(...[s, {
5166
+ function Qr(...[s, {
5156
5167
  id: t,
5157
5168
  systemId: e,
5158
5169
  input: n,
@@ -5160,9 +5171,9 @@ function Vr(...[s, {
5160
5171
  } = {}]) {
5161
5172
  function r(o, a) {
5162
5173
  }
5163
- return r.type = "xstate.spawnChild", r.id = t, r.systemId = e, r.src = s, r.input = n, r.syncSnapshot = i, r.resolve = Zr, r.execute = Yr, r;
5174
+ return r.type = "xstate.spawnChild", r.id = t, r.systemId = e, r.src = s, r.input = n, r.syncSnapshot = i, r.resolve = Xr, r.execute = qr, r;
5164
5175
  }
5165
- function Jr(s, t, e, n, {
5176
+ function to(s, t, e, n, {
5166
5177
  actorRef: i
5167
5178
  }) {
5168
5179
  const r = typeof i == "function" ? i(e, n) : i, o = typeof r == "string" ? t.children[r] : r;
@@ -5173,9 +5184,16 @@ function Jr(s, t, e, n, {
5173
5184
  children: a
5174
5185
  }), o, void 0];
5175
5186
  }
5176
- function Xr(s, t) {
5187
+ function rs(s, t) {
5188
+ const e = t.getSnapshot();
5189
+ if (e && "children" in e)
5190
+ for (const n of Object.values(e.children))
5191
+ rs(s, n);
5192
+ s.system._unregister(t);
5193
+ }
5194
+ function eo(s, t) {
5177
5195
  if (t) {
5178
- if (s.system._unregister(t), t._processingStatus !== B.Running) {
5196
+ if (rs(s, t), t._processingStatus !== B.Running) {
5179
5197
  s.stopChild(t);
5180
5198
  return;
5181
5199
  }
@@ -5184,10 +5202,10 @@ function Xr(s, t) {
5184
5202
  });
5185
5203
  }
5186
5204
  }
5187
- function is(s) {
5205
+ function os(s) {
5188
5206
  function t(e, n) {
5189
5207
  }
5190
- return t.type = "xstate.stopChild", t.actorRef = s, t.resolve = Jr, t.execute = Xr, t;
5208
+ return t.type = "xstate.stopChild", t.actorRef = s, t.resolve = to, t.execute = eo, t;
5191
5209
  }
5192
5210
  function Ye(s, t, e, n) {
5193
5211
  const {
@@ -5211,7 +5229,9 @@ function Ye(s, t, e, n) {
5211
5229
  // this holds all params
5212
5230
  ) : o(a, c);
5213
5231
  }
5214
- const Ve = (s) => s.type === "atomic" || s.type === "final";
5232
+ function Ve(s) {
5233
+ return s.type === "atomic" || s.type === "final";
5234
+ }
5215
5235
  function xt(s) {
5216
5236
  return Object.values(s.states).filter((t) => t.type !== "history");
5217
5237
  }
@@ -5225,7 +5245,7 @@ function Gt(s, t) {
5225
5245
  return e;
5226
5246
  }
5227
5247
  function ce(s) {
5228
- const t = new Set(s), e = os(t);
5248
+ const t = new Set(s), e = cs(t);
5229
5249
  for (const n of t)
5230
5250
  if (n.type === "compound" && (!e.get(n) || !e.get(n).length))
5231
5251
  _n(n).forEach((i) => t.add(i));
@@ -5244,7 +5264,7 @@ function ce(s) {
5244
5264
  }
5245
5265
  return t;
5246
5266
  }
5247
- function rs(s, t) {
5267
+ function as(s, t) {
5248
5268
  const e = t.get(s);
5249
5269
  if (!e)
5250
5270
  return {};
@@ -5258,50 +5278,36 @@ function rs(s, t) {
5258
5278
  }
5259
5279
  const n = {};
5260
5280
  for (const i of e)
5261
- n[i.key] = rs(i, t);
5281
+ n[i.key] = as(i, t);
5262
5282
  return n;
5263
5283
  }
5264
- function os(s) {
5284
+ function cs(s) {
5265
5285
  const t = /* @__PURE__ */ new Map();
5266
5286
  for (const e of s)
5267
5287
  t.has(e) || t.set(e, []), e.parent && (t.has(e.parent) || t.set(e.parent, []), t.get(e.parent).push(e));
5268
5288
  return t;
5269
5289
  }
5270
- function as(s, t) {
5290
+ function ls(s, t) {
5271
5291
  const e = ce(t);
5272
- return rs(s, os(e));
5292
+ return as(s, cs(e));
5273
5293
  }
5274
5294
  function Je(s, t) {
5275
5295
  return t.type === "compound" ? xt(t).some((e) => e.type === "final" && s.has(e)) : t.type === "parallel" ? xt(t).every((e) => Je(s, e)) : t.type === "final";
5276
5296
  }
5277
- const me = (s) => s[0] === Mr;
5278
- function qr(s, t) {
5279
- return s.transitions.get(t) || [...s.transitions.keys()].filter((n) => {
5280
- if (n === xr)
5281
- return !0;
5282
- if (!n.endsWith(".*"))
5283
- return !1;
5284
- const i = n.split("."), r = t.split(".");
5285
- for (let o = 0; o < i.length; o++) {
5286
- const a = i[o], c = r[o];
5287
- if (a === "*")
5288
- return o === i.length - 1;
5289
- if (a !== c)
5290
- return !1;
5291
- }
5292
- return !0;
5293
- }).sort((n, i) => i.length - n.length).flatMap((n) => s.transitions.get(n));
5297
+ const me = (s) => s[0] === Pr;
5298
+ function no(s, t) {
5299
+ return s.transitions.get(t) || [...s.transitions.keys()].filter((n) => Ur(t, n)).sort((n, i) => i.length - n.length).flatMap((n) => s.transitions.get(n));
5294
5300
  }
5295
- function Qr(s) {
5301
+ function so(s) {
5296
5302
  const t = s.config.after;
5297
5303
  if (!t)
5298
5304
  return [];
5299
5305
  const e = (i) => {
5300
- const r = $r(i, s.id), o = r.type;
5301
- return s.entry.push(Oo(r, {
5306
+ const r = Br(i, s.id), o = r.type;
5307
+ return s.entry.push(xo(r, {
5302
5308
  id: o,
5303
5309
  delay: i
5304
- })), s.exit.push(Gr(o)), o;
5310
+ })), s.exit.push(Jr(o)), o;
5305
5311
  };
5306
5312
  return Object.keys(t).flatMap((i) => {
5307
5313
  const r = t[i], o = typeof r == "string" ? {
@@ -5323,7 +5329,7 @@ function Qr(s) {
5323
5329
  });
5324
5330
  }
5325
5331
  function pt(s, t, e) {
5326
- const n = ss(e.target), i = e.reenter ?? !1, r = no(s, n), o = {
5332
+ const n = is(e.target), i = e.reenter ?? !1, r = oo(s, n), o = {
5327
5333
  ...e,
5328
5334
  actions: st(e.actions),
5329
5335
  guard: e.guard,
@@ -5339,11 +5345,11 @@ function pt(s, t, e) {
5339
5345
  };
5340
5346
  return o;
5341
5347
  }
5342
- function to(s) {
5348
+ function io(s) {
5343
5349
  const t = /* @__PURE__ */ new Map();
5344
5350
  if (s.config.on)
5345
5351
  for (const e of Object.keys(s.config.on)) {
5346
- if (e === Xn)
5352
+ if (e === qn)
5347
5353
  throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
5348
5354
  const n = s.config.on[e];
5349
5355
  t.set(e, It(n).map((i) => pt(s, e, i)));
@@ -5372,7 +5378,7 @@ function to(s) {
5372
5378
  }
5373
5379
  return t;
5374
5380
  }
5375
- function eo(s, t) {
5381
+ function ro(s, t) {
5376
5382
  const e = typeof t == "string" ? s.states[t] : t ? s.states[t.target] : void 0;
5377
5383
  if (!e && t)
5378
5384
  throw new Error(
@@ -5393,14 +5399,14 @@ function eo(s, t) {
5393
5399
  };
5394
5400
  return n;
5395
5401
  }
5396
- function no(s, t) {
5402
+ function oo(s, t) {
5397
5403
  if (t !== void 0)
5398
5404
  return t.map((e) => {
5399
5405
  if (typeof e != "string")
5400
5406
  return e;
5401
5407
  if (me(e))
5402
5408
  return s.machine.getStateNodeById(e);
5403
- const n = e[0] === Jn;
5409
+ const n = e[0] === Xn;
5404
5410
  if (n && !s.parent)
5405
5411
  return le(s, e.slice(1));
5406
5412
  const i = n ? s.key + e : e;
@@ -5415,8 +5421,8 @@ ${r.message}`);
5415
5421
  throw new Error(`Invalid target: "${e}" is not a valid target from the root node. Did you mean ".${e}"?`);
5416
5422
  });
5417
5423
  }
5418
- function cs(s) {
5419
- const t = ss(s.config.target);
5424
+ function hs(s) {
5425
+ const t = is(s.config.target);
5420
5426
  return t ? {
5421
5427
  target: t.map((e) => typeof e == "string" ? le(s.parent, e) : e)
5422
5428
  } : s.parent.initial;
@@ -5425,13 +5431,13 @@ function yt(s) {
5425
5431
  return s.type === "history";
5426
5432
  }
5427
5433
  function _n(s) {
5428
- const t = ls(s);
5434
+ const t = ds(s);
5429
5435
  for (const e of t)
5430
5436
  for (const n of Gt(e, s))
5431
5437
  t.add(n);
5432
5438
  return t;
5433
5439
  }
5434
- function ls(s) {
5440
+ function ds(s) {
5435
5441
  const t = /* @__PURE__ */ new Set();
5436
5442
  function e(n) {
5437
5443
  if (!t.has(n)) {
@@ -5486,15 +5492,15 @@ function he(s, t) {
5486
5492
  return i.concat(a);
5487
5493
  }, []));
5488
5494
  }
5489
- function so(s, t, e, n) {
5495
+ function ao(s, t, e, n) {
5490
5496
  const r = $t(s, t).next(e, n);
5491
5497
  return !r || !r.length ? s.next(e, n) : r;
5492
5498
  }
5493
- function io(s, t, e, n) {
5499
+ function co(s, t, e, n) {
5494
5500
  const i = Object.keys(t), r = $t(s, i[0]), o = Xe(r, t[i[0]], e, n);
5495
5501
  return !o || !o.length ? s.next(e, n) : o;
5496
5502
  }
5497
- function ro(s, t, e, n) {
5503
+ function lo(s, t, e, n) {
5498
5504
  const i = [];
5499
5505
  for (const r of Object.keys(t)) {
5500
5506
  const o = t[r];
@@ -5506,9 +5512,9 @@ function ro(s, t, e, n) {
5506
5512
  return i.length ? i : s.next(e, n);
5507
5513
  }
5508
5514
  function Xe(s, t, e, n) {
5509
- return typeof t == "string" ? so(s, t, e, n) : Object.keys(t).length === 1 ? io(s, t, e, n) : ro(s, t, e, n);
5515
+ return typeof t == "string" ? ao(s, t, e, n) : Object.keys(t).length === 1 ? co(s, t, e, n) : lo(s, t, e, n);
5510
5516
  }
5511
- function oo(s) {
5517
+ function ho(s) {
5512
5518
  return Object.keys(s.states).map((t) => s.states[t]).filter((t) => t.type === "history");
5513
5519
  }
5514
5520
  function rt(s, t) {
@@ -5517,7 +5523,7 @@ function rt(s, t) {
5517
5523
  e = e.parent;
5518
5524
  return e.parent === t;
5519
5525
  }
5520
- function ao(s, t) {
5526
+ function uo(s, t) {
5521
5527
  const e = new Set(s), n = new Set(t);
5522
5528
  for (const i of e)
5523
5529
  if (n.has(i))
@@ -5527,13 +5533,13 @@ function ao(s, t) {
5527
5533
  return !0;
5528
5534
  return !1;
5529
5535
  }
5530
- function hs(s, t, e) {
5536
+ function us(s, t, e) {
5531
5537
  const n = /* @__PURE__ */ new Set();
5532
5538
  for (const i of s) {
5533
5539
  let r = !1;
5534
5540
  const o = /* @__PURE__ */ new Set();
5535
5541
  for (const a of n)
5536
- if (ao(Pe([i], t, e), Pe([a], t, e)))
5542
+ if (uo(He([i], t, e), He([a], t, e)))
5537
5543
  if (rt(i.source, a.source))
5538
5544
  o.add(a);
5539
5545
  else {
@@ -5548,7 +5554,7 @@ function hs(s, t, e) {
5548
5554
  }
5549
5555
  return Array.from(n);
5550
5556
  }
5551
- function co(s) {
5557
+ function fo(s) {
5552
5558
  const [t, ...e] = s;
5553
5559
  for (const n of Gt(t, void 0))
5554
5560
  if (e.every((i) => rt(i, n)))
@@ -5564,36 +5570,36 @@ function qe(s, t) {
5564
5570
  for (const i of t[n.id])
5565
5571
  e.add(i);
5566
5572
  else
5567
- for (const i of qe(cs(n), t))
5573
+ for (const i of qe(hs(n), t))
5568
5574
  e.add(i);
5569
5575
  else
5570
5576
  e.add(n);
5571
5577
  return [...e];
5572
5578
  }
5573
- function ds(s, t) {
5579
+ function fs(s, t) {
5574
5580
  const e = qe(s, t);
5575
5581
  if (!e)
5576
5582
  return;
5577
5583
  if (!s.reenter && e.every((i) => i === s.source || rt(i, s.source)))
5578
5584
  return s.source;
5579
- const n = co(e.concat(s.source));
5585
+ const n = fo(e.concat(s.source));
5580
5586
  if (n)
5581
5587
  return n;
5582
5588
  if (!s.reenter)
5583
5589
  return s.source.machine.root;
5584
5590
  }
5585
- function Pe(s, t, e) {
5591
+ function He(s, t, e) {
5586
5592
  const n = /* @__PURE__ */ new Set();
5587
5593
  for (const i of s)
5588
5594
  if (i.target?.length) {
5589
- const r = ds(i, e);
5595
+ const r = fs(i, e);
5590
5596
  i.reenter && i.source === r && n.add(r);
5591
5597
  for (const o of t)
5592
5598
  rt(o, r) && n.add(o);
5593
5599
  }
5594
5600
  return [...n];
5595
5601
  }
5596
- function lo(s, t) {
5602
+ function po(s, t) {
5597
5603
  if (s.length !== t.size)
5598
5604
  return !1;
5599
5605
  for (const e of s)
@@ -5601,50 +5607,69 @@ function lo(s, t) {
5601
5607
  return !1;
5602
5608
  return !0;
5603
5609
  }
5610
+ function go(s, t, e, n, i) {
5611
+ return Be([{
5612
+ target: [...ds(s)],
5613
+ source: s,
5614
+ reenter: !0,
5615
+ actions: [],
5616
+ eventType: null,
5617
+ toJSON: null
5618
+ }], t, e, n, !0, i);
5619
+ }
5604
5620
  function Be(s, t, e, n, i, r) {
5621
+ const o = [];
5605
5622
  if (!s.length)
5606
- return t;
5607
- const o = new Set(t._nodes);
5608
- let a = t.historyValue;
5609
- const c = hs(s, o, a);
5610
- let l = t;
5611
- i || ([l, a] = po(l, n, e, c, o, a, r, e.actionExecutor)), l = Ht(l, n, e, c.flatMap((h) => h.actions), r, void 0), l = uo(l, n, e, c, o, r, a, i);
5612
- const d = [...o];
5613
- l.status === "done" && (l = Ht(l, n, e, d.sort((h, u) => u.order - h.order).flatMap((h) => h.exit), r, void 0));
5623
+ return [t, o];
5624
+ const a = e.actionExecutor;
5625
+ e.actionExecutor = (c) => {
5626
+ o.push(c), a(c);
5627
+ };
5614
5628
  try {
5615
- return a === t.historyValue && lo(t._nodes, o) ? l : Et(l, {
5616
- _nodes: d,
5617
- historyValue: a
5618
- });
5619
- } catch (h) {
5620
- throw h;
5629
+ const c = new Set(t._nodes);
5630
+ let l = t.historyValue;
5631
+ const d = us(s, c, l);
5632
+ let h = t;
5633
+ i || ([h, l] = Eo(h, n, e, d, c, l, r, e.actionExecutor)), h = Pt(h, n, e, d.flatMap((g) => g.actions), r, void 0), h = yo(h, n, e, d, c, r, l, i);
5634
+ const u = [...c];
5635
+ h.status === "done" && (h = Pt(h, n, e, u.sort((g, f) => f.order - g.order).flatMap((g) => g.exit), r, void 0));
5636
+ try {
5637
+ return l === t.historyValue && po(t._nodes, c) ? [h, o] : [Et(h, {
5638
+ _nodes: u,
5639
+ historyValue: l
5640
+ }), o];
5641
+ } catch (g) {
5642
+ throw g;
5643
+ }
5644
+ } finally {
5645
+ e.actionExecutor = a;
5621
5646
  }
5622
5647
  }
5623
- function ho(s, t, e, n, i) {
5648
+ function mo(s, t, e, n, i) {
5624
5649
  if (n.output === void 0)
5625
5650
  return;
5626
5651
  const r = xe(i.id, i.output !== void 0 && i.parent ? $e(i.output, s.context, t, e.self) : void 0);
5627
5652
  return $e(n.output, s.context, r, e.self);
5628
5653
  }
5629
- function uo(s, t, e, n, i, r, o, a) {
5654
+ function yo(s, t, e, n, i, r, o, a) {
5630
5655
  let c = s;
5631
5656
  const l = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
5632
- fo(n, o, d, l), a && d.add(s.machine.root);
5657
+ wo(n, o, d, l), a && d.add(s.machine.root);
5633
5658
  const h = /* @__PURE__ */ new Set();
5634
- for (const u of [...l].sort((m, f) => m.order - f.order)) {
5659
+ for (const u of [...l].sort((g, f) => g.order - f.order)) {
5635
5660
  i.add(u);
5636
- const m = [];
5637
- m.push(...u.entry);
5661
+ const g = [];
5662
+ g.push(...u.entry);
5638
5663
  for (const f of u.invoke)
5639
- m.push(Vr(f.src, {
5664
+ g.push(Qr(f.src, {
5640
5665
  ...f,
5641
5666
  syncSnapshot: !!f.onSnapshot
5642
5667
  }));
5643
5668
  if (d.has(u)) {
5644
5669
  const f = u.initial.actions;
5645
- m.push(...f);
5670
+ g.push(...f);
5646
5671
  }
5647
- if (c = Ht(c, t, e, m, r, u.invoke.map((f) => f.id)), u.type === "final") {
5672
+ if (c = Pt(c, t, e, g, r, u.invoke.map((f) => f.id)), u.type === "final") {
5648
5673
  const f = u.parent;
5649
5674
  let w = f?.type === "parallel" ? f : f?.parent, b = w || u;
5650
5675
  for (f?.type === "compound" && r.push(xe(f.id, u.output !== void 0 ? $e(u.output, c.context, t, e.self) : void 0)); w?.type === "parallel" && !h.has(w) && Je(i, w); )
@@ -5653,15 +5678,15 @@ function uo(s, t, e, n, i, r, o, a) {
5653
5678
  continue;
5654
5679
  c = Et(c, {
5655
5680
  status: "done",
5656
- output: ho(c, t, e, c.machine.root, b)
5681
+ output: mo(c, t, e, c.machine.root, b)
5657
5682
  });
5658
5683
  }
5659
5684
  }
5660
5685
  return c;
5661
5686
  }
5662
- function fo(s, t, e, n) {
5687
+ function wo(s, t, e, n) {
5663
5688
  for (const i of s) {
5664
- const r = ds(i, t);
5689
+ const r = fs(i, t);
5665
5690
  for (const a of i.target || [])
5666
5691
  !yt(a) && // if the target is different than the source then it will *definitely* be entered
5667
5692
  (i.source !== a || // we know that the domain can't lie within the source
@@ -5671,7 +5696,7 @@ function fo(s, t, e, n) {
5671
5696
  const o = qe(i, t);
5672
5697
  for (const a of o) {
5673
5698
  const c = Gt(a, r);
5674
- r?.type === "parallel" && c.push(r), us(n, t, e, c, !i.source.parent && i.reenter ? void 0 : r);
5699
+ r?.type === "parallel" && c.push(r), ps(n, t, e, c, !i.source.parent && i.reenter ? void 0 : r);
5675
5700
  }
5676
5701
  }
5677
5702
  }
@@ -5684,7 +5709,7 @@ function Nt(s, t, e, n) {
5684
5709
  for (const r of i)
5685
5710
  Ae(r, s.parent, n, t, e);
5686
5711
  } else {
5687
- const i = cs(s);
5712
+ const i = hs(s);
5688
5713
  for (const r of i.target)
5689
5714
  n.add(r), i === s.parent?.initial && e.add(s.parent), Nt(r, t, e, n);
5690
5715
  for (const r of i.target)
@@ -5697,35 +5722,35 @@ function Nt(s, t, e, n) {
5697
5722
  for (const i of xt(s).filter((r) => !yt(r)))
5698
5723
  [...n].some((r) => rt(r, i)) || (yt(i) || (n.add(i), e.add(i)), Nt(i, t, e, n));
5699
5724
  }
5700
- function us(s, t, e, n, i) {
5725
+ function ps(s, t, e, n, i) {
5701
5726
  for (const r of n)
5702
5727
  if ((!i || rt(r, i)) && s.add(r), r.type === "parallel")
5703
5728
  for (const o of xt(r).filter((a) => !yt(a)))
5704
5729
  [...s].some((a) => rt(a, o)) || (s.add(o), Nt(o, t, e, s));
5705
5730
  }
5706
5731
  function Ae(s, t, e, n, i) {
5707
- us(e, n, i, Gt(s, t));
5732
+ ps(e, n, i, Gt(s, t));
5708
5733
  }
5709
- function po(s, t, e, n, i, r, o, a) {
5734
+ function Eo(s, t, e, n, i, r, o, a) {
5710
5735
  let c = s;
5711
- const l = Pe(n, i, r);
5736
+ const l = He(n, i, r);
5712
5737
  l.sort((h, u) => u.order - h.order);
5713
5738
  let d;
5714
5739
  for (const h of l)
5715
- for (const u of oo(h)) {
5716
- let m;
5717
- u.history === "deep" ? m = (f) => Ve(f) && rt(f, h) : m = (f) => f.parent === h, d ??= {
5740
+ for (const u of ho(h)) {
5741
+ let g;
5742
+ u.history === "deep" ? g = (f) => Ve(f) && rt(f, h) : g = (f) => f.parent === h, d ??= {
5718
5743
  ...r
5719
- }, d[u.id] = Array.from(i).filter(m);
5744
+ }, d[u.id] = Array.from(i).filter(g);
5720
5745
  }
5721
5746
  for (const h of l)
5722
- c = Ht(c, t, e, [...h.exit, ...h.invoke.map((u) => is(u.id))], o, void 0), i.delete(h);
5747
+ c = Pt(c, t, e, [...h.exit, ...h.invoke.map((u) => os(u.id))], o, void 0), i.delete(h);
5723
5748
  return [c, d || r];
5724
5749
  }
5725
- function go(s, t) {
5750
+ function bo(s, t) {
5726
5751
  return s.implementations.actions[t];
5727
5752
  }
5728
- function fs(s, t, e, n, i, r) {
5753
+ function gs(s, t, e, n, i, r) {
5729
5754
  const {
5730
5755
  machine: o
5731
5756
  } = s;
@@ -5735,7 +5760,7 @@ function fs(s, t, e, n, i, r) {
5735
5760
  // the existing type of `.actions` assumes non-nullable `TExpressionAction`
5736
5761
  // it's fine to cast this here to get a common type and lack of errors in the rest of the code
5737
5762
  // our logic below makes sure that we call those 2 "variants" correctly
5738
- go(o, typeof c == "string" ? c : c.type)
5763
+ bo(o, typeof c == "string" ? c : c.type)
5739
5764
  ), h = {
5740
5765
  context: a.context,
5741
5766
  event: t,
@@ -5754,7 +5779,7 @@ function fs(s, t, e, n, i, r) {
5754
5779
  });
5755
5780
  continue;
5756
5781
  }
5757
- const m = d, [f, w, b] = m.resolve(
5782
+ const g = d, [f, w, b] = g.resolve(
5758
5783
  e,
5759
5784
  a,
5760
5785
  h,
@@ -5763,17 +5788,17 @@ function fs(s, t, e, n, i, r) {
5763
5788
  // this holds all params
5764
5789
  i
5765
5790
  );
5766
- a = f, "retryResolve" in m && r?.push([m, w]), "execute" in m && e.actionExecutor({
5767
- type: m.type,
5791
+ a = f, "retryResolve" in g && r?.push([g, w]), "execute" in g && e.actionExecutor({
5792
+ type: g.type,
5768
5793
  info: h,
5769
5794
  params: w,
5770
- exec: m.execute.bind(null, e, w)
5771
- }), b && (a = fs(a, t, e, b, i, r));
5795
+ exec: g.execute.bind(null, e, w)
5796
+ }), b && (a = gs(a, t, e, b, i, r));
5772
5797
  }
5773
5798
  return a;
5774
5799
  }
5775
- function Ht(s, t, e, n, i, r) {
5776
- const o = r ? [] : void 0, a = fs(s, t, e, n, {
5800
+ function Pt(s, t, e, n, i, r) {
5801
+ const o = r ? [] : void 0, a = gs(s, t, e, n, {
5777
5802
  internalQueue: i,
5778
5803
  deferredActorIds: r
5779
5804
  }, o);
@@ -5789,29 +5814,29 @@ function Ie(s, t, e, n) {
5789
5814
  type: "@xstate.microstep",
5790
5815
  actorRef: e.self,
5791
5816
  event: d,
5792
- snapshot: l,
5817
+ snapshot: l[0],
5793
5818
  _transitions: h
5794
5819
  }), r.push(l);
5795
5820
  }
5796
5821
  if (t.type === Me)
5797
- return i = Et(bn(i, t, e), {
5822
+ return i = Et(An(i, t, e), {
5798
5823
  status: "stopped"
5799
- }), o(i, t, []), {
5824
+ }), o([i, []], t, []), {
5800
5825
  snapshot: i,
5801
- microstates: r
5826
+ microsteps: r
5802
5827
  };
5803
5828
  let a = t;
5804
- if (a.type !== qn) {
5805
- const l = a, d = Dr(l), h = An(l, i);
5829
+ if (a.type !== Qn) {
5830
+ const l = a, d = zr(l), h = In(l, i);
5806
5831
  if (d && !h.length)
5807
5832
  return i = Et(s, {
5808
5833
  status: "error",
5809
5834
  error: l.error
5810
- }), o(i, l, []), {
5835
+ }), o([i, []], l, []), {
5811
5836
  snapshot: i,
5812
- microstates: r
5837
+ microsteps: r
5813
5838
  };
5814
- i = Be(
5839
+ const u = Be(
5815
5840
  h,
5816
5841
  s,
5817
5842
  e,
@@ -5819,31 +5844,33 @@ function Ie(s, t, e, n) {
5819
5844
  !1,
5820
5845
  // isInitial
5821
5846
  n
5822
- ), o(i, l, h);
5847
+ );
5848
+ i = u[0], o(u, l, h);
5823
5849
  }
5824
5850
  let c = !0;
5825
5851
  for (; i.status === "active"; ) {
5826
- let l = c ? mo(i, a) : [];
5852
+ let l = c ? _o(i, a) : [];
5827
5853
  const d = l.length ? i : void 0;
5828
5854
  if (!l.length) {
5829
5855
  if (!n.length)
5830
5856
  break;
5831
- a = n.shift(), l = An(a, i);
5857
+ a = n.shift(), l = In(a, i);
5832
5858
  }
5833
- i = Be(l, i, e, a, !1, n), c = i !== d, o(i, a, l);
5859
+ const h = Be(l, i, e, a, !1, n);
5860
+ i = h[0], c = i !== d, o(h, a, l);
5834
5861
  }
5835
- return i.status !== "active" && bn(i, a, e), {
5862
+ return i.status !== "active" && An(i, a, e), {
5836
5863
  snapshot: i,
5837
- microstates: r
5864
+ microsteps: r
5838
5865
  };
5839
5866
  }
5840
- function bn(s, t, e) {
5841
- return Ht(s, t, e, Object.values(s.children).map((n) => is(n)), [], void 0);
5867
+ function An(s, t, e) {
5868
+ return Pt(s, t, e, Object.values(s.children).map((n) => os(n)), [], void 0);
5842
5869
  }
5843
- function An(s, t) {
5870
+ function In(s, t) {
5844
5871
  return t.machine.getTransitionData(t, s);
5845
5872
  }
5846
- function mo(s, t) {
5873
+ function _o(s, t) {
5847
5874
  const e = /* @__PURE__ */ new Set(), n = s._nodes.filter(Ve);
5848
5875
  for (const i of n)
5849
5876
  t: for (const r of [i].concat(Gt(i, void 0)))
@@ -5854,24 +5881,24 @@ function mo(s, t) {
5854
5881
  break t;
5855
5882
  }
5856
5883
  }
5857
- return hs(Array.from(e), new Set(s._nodes), s.historyValue);
5884
+ return us(Array.from(e), new Set(s._nodes), s.historyValue);
5858
5885
  }
5859
- function yo(s, t) {
5886
+ function Ao(s, t) {
5860
5887
  const e = ce(he(s, t));
5861
- return as(s, [...e]);
5888
+ return ls(s, [...e]);
5862
5889
  }
5863
- function wo(s) {
5890
+ function Io(s) {
5864
5891
  return !!s && typeof s == "object" && "machine" in s && "value" in s;
5865
5892
  }
5866
- const Eo = function(t) {
5867
- return ts(t, this.value);
5868
- }, _o = function(t) {
5893
+ const No = function(t) {
5894
+ return es(t, this.value);
5895
+ }, To = function(t) {
5869
5896
  return this.tags.has(t);
5870
- }, bo = function(t) {
5897
+ }, vo = function(t) {
5871
5898
  const e = this.machine.getTransitionData(this, t);
5872
5899
  return !!e?.length && // Check that at least one transition is not forbidden
5873
5900
  e.some((n) => n.target !== void 0 || n.actions.length);
5874
- }, Ao = function() {
5901
+ }, So = function() {
5875
5902
  const {
5876
5903
  _nodes: t,
5877
5904
  tags: e,
@@ -5887,7 +5914,7 @@ const Eo = function(t) {
5887
5914
  ...l,
5888
5915
  tags: Array.from(e)
5889
5916
  };
5890
- }, Io = function() {
5917
+ }, Oo = function() {
5891
5918
  return this._nodes.reduce((t, e) => (e.meta !== void 0 && (t[e.id] = e.meta), t), {});
5892
5919
  };
5893
5920
  function ee(s, t) {
@@ -5898,15 +5925,15 @@ function ee(s, t) {
5898
5925
  machine: t,
5899
5926
  context: s.context,
5900
5927
  _nodes: s._nodes,
5901
- value: as(t.root, s._nodes),
5928
+ value: ls(t.root, s._nodes),
5902
5929
  tags: new Set(s._nodes.flatMap((e) => e.tags)),
5903
5930
  children: s.children,
5904
5931
  historyValue: s.historyValue || {},
5905
- matches: Eo,
5906
- hasTag: _o,
5907
- can: bo,
5908
- getMeta: Io,
5909
- toJSON: Ao
5932
+ matches: No,
5933
+ hasTag: To,
5934
+ can: vo,
5935
+ getMeta: Oo,
5936
+ toJSON: So
5910
5937
  };
5911
5938
  }
5912
5939
  function Et(s, t = {}) {
@@ -5915,7 +5942,7 @@ function Et(s, t = {}) {
5915
5942
  ...t
5916
5943
  }, s.machine);
5917
5944
  }
5918
- function No(s) {
5945
+ function ko(s) {
5919
5946
  if (typeof s != "object" || s === null)
5920
5947
  return {};
5921
5948
  const t = {};
@@ -5927,7 +5954,7 @@ function No(s) {
5927
5954
  }
5928
5955
  return t;
5929
5956
  }
5930
- function To(s, t) {
5957
+ function Co(s, t) {
5931
5958
  const {
5932
5959
  _nodes: e,
5933
5960
  tags: n,
@@ -5940,10 +5967,10 @@ function To(s, t) {
5940
5967
  getMeta: d,
5941
5968
  toJSON: h,
5942
5969
  ...u
5943
- } = s, m = {};
5970
+ } = s, g = {};
5944
5971
  for (const w in r) {
5945
5972
  const b = r[w];
5946
- m[w] = {
5973
+ g[w] = {
5947
5974
  snapshot: b.getPersistedSnapshot(t),
5948
5975
  src: b.src,
5949
5976
  systemId: b.systemId,
@@ -5952,12 +5979,12 @@ function To(s, t) {
5952
5979
  }
5953
5980
  return {
5954
5981
  ...u,
5955
- context: ps(o),
5956
- children: m,
5957
- historyValue: No(u.historyValue)
5982
+ context: ms(o),
5983
+ children: g,
5984
+ historyValue: ko(u.historyValue)
5958
5985
  };
5959
5986
  }
5960
- function ps(s) {
5987
+ function ms(s) {
5961
5988
  let t;
5962
5989
  for (const e in s) {
5963
5990
  const n = s[e];
@@ -5970,7 +5997,7 @@ function ps(s) {
5970
5997
  id: n.id
5971
5998
  };
5972
5999
  else {
5973
- const i = ps(n);
6000
+ const i = ms(n);
5974
6001
  i !== n && (t ??= Array.isArray(s) ? s.slice() : {
5975
6002
  ...s
5976
6003
  }, t[e] = i);
@@ -5978,7 +6005,7 @@ function ps(s) {
5978
6005
  }
5979
6006
  return t ?? s;
5980
6007
  }
5981
- function vo(s, t, e, n, {
6008
+ function Ro(s, t, e, n, {
5982
6009
  event: i,
5983
6010
  id: r,
5984
6011
  delay: o
@@ -6004,7 +6031,7 @@ function vo(s, t, e, n, {
6004
6031
  delay: d
6005
6032
  }, void 0];
6006
6033
  }
6007
- function So(s, t) {
6034
+ function Mo(s, t) {
6008
6035
  const {
6009
6036
  event: e,
6010
6037
  delay: n,
@@ -6018,12 +6045,12 @@ function So(s, t) {
6018
6045
  return;
6019
6046
  }
6020
6047
  }
6021
- function Oo(s, t) {
6048
+ function xo(s, t) {
6022
6049
  function e(n, i) {
6023
6050
  }
6024
- return e.type = "xstate.raise", e.event = s, e.id = t?.id, e.delay = t?.delay, e.resolve = vo, e.execute = So, e;
6051
+ return e.type = "xstate.raise", e.event = s, e.id = t?.id, e.delay = t?.delay, e.resolve = Ro, e.execute = Mo, e;
6025
6052
  }
6026
- function ko(s, {
6053
+ function $o(s, {
6027
6054
  machine: t,
6028
6055
  context: e
6029
6056
  }, n, i) {
@@ -6062,7 +6089,7 @@ function ko(s, {
6062
6089
  }), c;
6063
6090
  };
6064
6091
  }
6065
- function Co(s, t, e, n, {
6092
+ function Po(s, t, e, n, {
6066
6093
  assignment: i
6067
6094
  }) {
6068
6095
  if (!t.context)
@@ -6070,7 +6097,7 @@ function Co(s, t, e, n, {
6070
6097
  const r = {}, o = {
6071
6098
  context: t.context,
6072
6099
  event: e.event,
6073
- spawn: ko(s, t, e.event, r),
6100
+ spawn: $o(s, t, e.event, r),
6074
6101
  self: s.self,
6075
6102
  system: s.system
6076
6103
  };
@@ -6091,19 +6118,19 @@ function Co(s, t, e, n, {
6091
6118
  } : t.children
6092
6119
  }), void 0, void 0];
6093
6120
  }
6094
- function Ro(s) {
6121
+ function Ho(s) {
6095
6122
  function t(e, n) {
6096
6123
  }
6097
- return t.type = "xstate.assign", t.assignment = s, t.resolve = Co, t;
6124
+ return t.type = "xstate.assign", t.assignment = s, t.resolve = Po, t;
6098
6125
  }
6099
- const In = /* @__PURE__ */ new WeakMap();
6126
+ const Nn = /* @__PURE__ */ new WeakMap();
6100
6127
  function At(s, t, e) {
6101
- let n = In.get(s);
6128
+ let n = Nn.get(s);
6102
6129
  return n ? t in n || (n[t] = e()) : (n = {
6103
6130
  [t]: e()
6104
- }, In.set(s, n)), n[t];
6131
+ }, Nn.set(s, n)), n[t];
6105
6132
  }
6106
- const Mo = {}, Kt = (s) => typeof s == "string" ? {
6133
+ const Bo = {}, Lt = (s) => typeof s == "string" ? {
6107
6134
  type: s
6108
6135
  } : typeof s == "function" ? "resolve" in s ? {
6109
6136
  type: s.type
@@ -6112,17 +6139,17 @@ const Mo = {}, Kt = (s) => typeof s == "string" ? {
6112
6139
  } : s;
6113
6140
  class de {
6114
6141
  constructor(t, e) {
6115
- if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = e._parent, this.key = e._key, this.machine = e._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Jn), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? yn(this.config.states, (n, i) => new de(n, {
6142
+ if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = e._parent, this.key = e._key, this.machine = e._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Xn), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? wn(this.config.states, (n, i) => new de(n, {
6116
6143
  _parent: this,
6117
6144
  _key: i,
6118
6145
  _machine: this.machine
6119
- })) : Mo, this.type === "compound" && !this.config.initial)
6146
+ })) : Bo, this.type === "compound" && !this.config.initial)
6120
6147
  throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
6121
6148
  this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = st(this.config.entry).slice(), this.exit = st(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = st(t.tags).slice();
6122
6149
  }
6123
6150
  /** @internal */
6124
6151
  _initialize() {
6125
- this.transitions = to(this), this.config.always && (this.always = It(this.config.always).map((t) => pt(this, Xn, t))), Object.keys(this.states).forEach((t) => {
6152
+ this.transitions = io(this), this.config.always && (this.always = It(this.config.always).map((t) => pt(this, qn, t))), Object.keys(this.states).forEach((t) => {
6126
6153
  this.states[t]._initialize();
6127
6154
  });
6128
6155
  }
@@ -6136,25 +6163,25 @@ class de {
6136
6163
  initial: this.initial ? {
6137
6164
  target: this.initial.target,
6138
6165
  source: this,
6139
- actions: this.initial.actions.map(Kt),
6166
+ actions: this.initial.actions.map(Lt),
6140
6167
  eventType: null,
6141
6168
  reenter: !1,
6142
6169
  toJSON: () => ({
6143
6170
  target: this.initial.target.map((t) => `#${t.id}`),
6144
6171
  source: `#${this.id}`,
6145
- actions: this.initial.actions.map(Kt),
6172
+ actions: this.initial.actions.map(Lt),
6146
6173
  eventType: null
6147
6174
  })
6148
6175
  } : void 0,
6149
6176
  history: this.history,
6150
- states: yn(this.states, (t) => t.definition),
6177
+ states: wn(this.states, (t) => t.definition),
6151
6178
  on: this.on,
6152
6179
  transitions: [...this.transitions.values()].flat().map((t) => ({
6153
6180
  ...t,
6154
- actions: t.actions.map(Kt)
6181
+ actions: t.actions.map(Lt)
6155
6182
  })),
6156
- entry: this.entry.map(Kt),
6157
- exit: this.exit.map(Kt),
6183
+ entry: this.entry.map(Lt),
6184
+ exit: this.exit.map(Lt),
6158
6185
  meta: this.meta,
6159
6186
  order: this.order || -1,
6160
6187
  output: this.output,
@@ -6173,7 +6200,7 @@ class de {
6173
6200
  const {
6174
6201
  src: n,
6175
6202
  systemId: i
6176
- } = t, r = t.id ?? wn(this.id, e), o = typeof n == "string" ? n : `xstate.invoke.${wn(this.id, e)}`;
6203
+ } = t, r = t.id ?? En(this.id, e), o = typeof n == "string" ? n : `xstate.invoke.${En(this.id, e)}`;
6177
6204
  return {
6178
6205
  ...t,
6179
6206
  src: o,
@@ -6200,16 +6227,16 @@ class de {
6200
6227
  return At(this, "on", () => [...this.transitions].flatMap(([e, n]) => n.map((i) => [e, i])).reduce((e, [n, i]) => (e[n] = e[n] || [], e[n].push(i), e), {}));
6201
6228
  }
6202
6229
  get after() {
6203
- return At(this, "delayedTransitions", () => Qr(this));
6230
+ return At(this, "delayedTransitions", () => so(this));
6204
6231
  }
6205
6232
  get initial() {
6206
- return At(this, "initial", () => eo(this, this.config.initial));
6233
+ return At(this, "initial", () => ro(this, this.config.initial));
6207
6234
  }
6208
6235
  /** @internal */
6209
6236
  next(t, e) {
6210
6237
  const n = e.type, i = [];
6211
6238
  let r;
6212
- const o = At(this, `candidates-${n}`, () => qr(this, n));
6239
+ const o = At(this, `candidates-${n}`, () => no(this, n));
6213
6240
  for (const a of o) {
6214
6241
  const {
6215
6242
  guard: c
@@ -6251,11 +6278,11 @@ ${h.message}`);
6251
6278
  * Excludes any inert events.
6252
6279
  */
6253
6280
  get ownEvents() {
6254
- const t = new Set([...this.transitions.keys()].filter((e) => this.transitions.get(e).some((n) => !(!n.target && !n.actions.length && !n.reenter))));
6255
- return Array.from(t);
6281
+ const t = Object.keys(Object.fromEntries(this.transitions)), e = new Set(t.filter((n) => this.transitions.get(n).some((i) => !(!i.target && !i.actions.length && !i.reenter))));
6282
+ return Array.from(e);
6256
6283
  }
6257
6284
  }
6258
- const xo = "#";
6285
+ const Wo = "#";
6259
6286
  class Qe {
6260
6287
  constructor(t, e) {
6261
6288
  this.config = t, this.version = void 0, this.schemas = void 0, this.implementations = void 0, this.__xstatenode = !0, this.idMap = /* @__PURE__ */ new Map(), this.root = void 0, this.id = void 0, this.states = void 0, this.events = void 0, this.id = t.id || "(machine)", this.implementations = {
@@ -6302,7 +6329,7 @@ class Qe {
6302
6329
  });
6303
6330
  }
6304
6331
  resolveState(t) {
6305
- const e = yo(this.root, t.value), n = ce(he(this.root, e));
6332
+ const e = Ao(this.root, t.value), n = ce(he(this.root, e));
6306
6333
  return ee({
6307
6334
  _nodes: [...n],
6308
6335
  context: t.context || {},
@@ -6331,7 +6358,7 @@ class Qe {
6331
6358
  * @param event The received event
6332
6359
  */
6333
6360
  microstep(t, e, n) {
6334
- return Ie(t, e, n, []).microstates;
6361
+ return Ie(t, e, n, []).microsteps.map(([i]) => i);
6335
6362
  }
6336
6363
  getTransitionData(t, e) {
6337
6364
  return Xe(this.root, t.value, t, e) || [];
@@ -6339,8 +6366,10 @@ class Qe {
6339
6366
  /**
6340
6367
  * The initial state _before_ evaluating any microsteps. This "pre-initial"
6341
6368
  * state is provided to initial actions executed in the initial state.
6369
+ *
6370
+ * @internal
6342
6371
  */
6343
- getPreInitialState(t, e, n) {
6372
+ _getPreInitialState(t, e, n) {
6344
6373
  const {
6345
6374
  context: i
6346
6375
  } = this.config, r = ee({
@@ -6349,7 +6378,7 @@ class Qe {
6349
6378
  children: {},
6350
6379
  status: "active"
6351
6380
  }, this);
6352
- return typeof i == "function" ? Ht(r, e, t, [Ro(({
6381
+ return typeof i == "function" ? Pt(r, e, t, [Ho(({
6353
6382
  spawn: a,
6354
6383
  event: c,
6355
6384
  self: l
@@ -6364,15 +6393,7 @@ class Qe {
6364
6393
  * `ActorRef`.
6365
6394
  */
6366
6395
  getInitialSnapshot(t, e) {
6367
- const n = Qn(e), i = [], r = this.getPreInitialState(t, n, i), o = Be([{
6368
- target: [...ls(this.root)],
6369
- source: this.root,
6370
- reenter: !0,
6371
- actions: [],
6372
- eventType: null,
6373
- toJSON: null
6374
- // TODO: fix
6375
- }], r, t, n, !0, i), {
6396
+ const n = ts(e), i = [], r = this._getPreInitialState(t, n, i), [o] = go(this.root, r, t, n, i), {
6376
6397
  snapshot: a
6377
6398
  } = Ie(o, n, t, i);
6378
6399
  return a;
@@ -6383,7 +6404,7 @@ class Qe {
6383
6404
  });
6384
6405
  }
6385
6406
  getStateNodeById(t) {
6386
- const e = Fe(t), n = e.slice(1), i = me(e[0]) ? e[0].slice(xo.length) : e[0], r = this.idMap.get(i);
6407
+ const e = Fe(t), n = e.slice(1), i = me(e[0]) ? e[0].slice(Wo.length) : e[0], r = this.idMap.get(i);
6387
6408
  if (!r)
6388
6409
  throw new Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);
6389
6410
  return le(r, n);
@@ -6395,19 +6416,19 @@ class Qe {
6395
6416
  return this.definition;
6396
6417
  }
6397
6418
  getPersistedSnapshot(t, e) {
6398
- return To(t, e);
6419
+ return Co(t, e);
6399
6420
  }
6400
6421
  restoreSnapshot(t, e) {
6401
6422
  const n = {}, i = t.children;
6402
6423
  Object.keys(i).forEach((h) => {
6403
- const u = i[h], m = u.snapshot, f = u.src, w = typeof f == "string" ? Ge(this, f) : f;
6424
+ const u = i[h], g = u.snapshot, f = u.src, w = typeof f == "string" ? Ge(this, f) : f;
6404
6425
  if (!w)
6405
6426
  return;
6406
6427
  const b = Mt(w, {
6407
6428
  id: h,
6408
6429
  parent: e.self,
6409
6430
  syncSnapshot: u.syncSnapshot,
6410
- snapshot: m,
6431
+ snapshot: g,
6411
6432
  src: f,
6412
6433
  systemId: u.systemId
6413
6434
  });
@@ -6424,15 +6445,15 @@ class Qe {
6424
6445
  function o(h, u) {
6425
6446
  if (!u || typeof u != "object")
6426
6447
  return {};
6427
- const m = {};
6448
+ const g = {};
6428
6449
  for (const f in u) {
6429
6450
  const w = u[f];
6430
6451
  for (const b of w) {
6431
6452
  const A = r(h, b);
6432
- A && (m[f] ??= [], m[f].push(A));
6453
+ A && (g[f] ??= [], g[f].push(A));
6433
6454
  }
6434
6455
  }
6435
- return m;
6456
+ return g;
6436
6457
  }
6437
6458
  const a = o(this.root, t.historyValue), c = ee({
6438
6459
  ...t,
@@ -6443,11 +6464,11 @@ class Qe {
6443
6464
  function d(h, u) {
6444
6465
  if (!l.has(h)) {
6445
6466
  l.add(h);
6446
- for (const m in h) {
6447
- const f = h[m];
6467
+ for (const g in h) {
6468
+ const f = h[g];
6448
6469
  if (f && typeof f == "object") {
6449
6470
  if ("xstate$$type" in f && f.xstate$$type === Ze) {
6450
- h[m] = u[f.id];
6471
+ h[g] = u[f.id];
6451
6472
  continue;
6452
6473
  }
6453
6474
  d(f, u);
@@ -6458,23 +6479,23 @@ class Qe {
6458
6479
  return d(c.context, n), c;
6459
6480
  }
6460
6481
  }
6461
- function $o(s, t) {
6482
+ function Do(s, t) {
6462
6483
  return new Qe(s, t);
6463
6484
  }
6464
- const Xt = (s) => s === !1 ? !1 : s.map((t) => t.serialize()), Ho = (s) => s === !1 ? !1 : s.serialize(), Po = (s) => s === !1 ? !1 : s.map((t) => ({
6485
+ const Xt = (s) => s === !1 ? !1 : s.map((t) => t.serialize()), Lo = (s) => s === !1 ? !1 : s.serialize(), Ko = (s) => s === !1 ? !1 : s.map((t) => ({
6465
6486
  tile: t.tile.toString(),
6466
6487
  effectiveTiles: t.effectiveTiles.map((e) => e.toString()),
6467
6488
  shanten: t.shanten
6468
- })), qt = (s) => s === !1 ? !1 : Ce(s), Nn = (s) => $o(
6489
+ })), qt = (s) => s === !1 ? !1 : Ce(s), Tn = (s) => Do(
6469
6490
  {
6470
6491
  id: "Untitled",
6471
6492
  initial: "distribute",
6472
6493
  context: {
6473
6494
  currentWind: _.E,
6474
- oneShotMap: W(!1),
6475
- missingMap: W(!1),
6495
+ oneShotMap: W(() => !1),
6496
+ missingMap: W(() => !1),
6476
6497
  controller: s,
6477
- genEventID: Bo()
6498
+ genEventID: zo()
6478
6499
  },
6479
6500
  states: {
6480
6501
  distribute: {
@@ -6791,7 +6812,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6791
6812
  notify_distribution: ({ context: t, event: e }) => {
6792
6813
  const n = t.genEventID(), i = t.controller.initialHands();
6793
6814
  for (const r of Object.values(_)) {
6794
- const o = W("_____________");
6815
+ const o = W(() => "_____________");
6795
6816
  o[r] = i[r].toString();
6796
6817
  const a = {
6797
6818
  id: n,
@@ -6822,7 +6843,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6822
6843
  replacementWin: n?.replacementWin
6823
6844
  })
6824
6845
  ),
6825
- REACH: Po(t.controller.doReach(i)),
6846
+ REACH: Ko(t.controller.doReach(i)),
6826
6847
  AN_KAN: Xt(t.controller.doAnKan(i)),
6827
6848
  SHO_KAN: Xt(t.controller.doShoKan(i)),
6828
6849
  DISCARD: t.controller.doDiscard(i).map((c) => c.toString()),
@@ -6832,7 +6853,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6832
6853
  t.controller.emit(a), t.controller.pollReplies(o, [i]);
6833
6854
  },
6834
6855
  notify_choice_after_discarded: ({ context: t, event: e }) => {
6835
- const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add: g.HORIZONTAL });
6856
+ const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add: m.HORIZONTAL });
6836
6857
  for (const o of Object.values(_)) {
6837
6858
  const a = {
6838
6859
  id: n,
@@ -6856,7 +6877,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6856
6877
  CHI: Xt(
6857
6878
  t.controller.doChi(o, i.w, r)
6858
6879
  ),
6859
- DAI_KAN: Ho(
6880
+ DAI_KAN: Lo(
6860
6881
  t.controller.doDaiKan(o, i.w, r)
6861
6882
  )
6862
6883
  }
@@ -6881,7 +6902,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6881
6902
  t.controller.emit(c), t.controller.pollReplies(i, [r]);
6882
6903
  },
6883
6904
  notify_choice_for_reach_acceptance: ({ context: t, event: e }) => {
6884
- const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add: g.HORIZONTAL });
6905
+ const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add: m.HORIZONTAL });
6885
6906
  for (const o of Object.values(_)) {
6886
6907
  const a = {
6887
6908
  id: n,
@@ -6907,11 +6928,11 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6907
6928
  e.type == "SHO_KAN" || e.type == "AN_KAN",
6908
6929
  `unexpected event ${e.type}`
6909
6930
  );
6910
- const n = t.genEventID(), i = e.block.tiles[0].clone({ remove: g.HORIZONTAL });
6931
+ const n = t.genEventID(), i = e.block.tiles[0].clone({ remove: m.HORIZONTAL });
6911
6932
  for (const r of Object.values(_)) {
6912
6933
  const o = t.controller.doWin(
6913
6934
  r,
6914
- e.block.tiles[0].clone({ remove: g.HORIZONTAL }),
6935
+ e.block.tiles[0].clone({ remove: m.HORIZONTAL }),
6915
6936
  {
6916
6937
  discardedBy: e.iam,
6917
6938
  quadWin: !0,
@@ -6969,7 +6990,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6969
6990
  const i = t.genEventID(), r = n?.action, o = r == "kan" ? t.controller.wall.kan() : t.controller.wall.draw(), a = t.currentWind;
6970
6991
  t.controller.hand(a).reached || (t.missingMap[a] = !1);
6971
6992
  for (const c of Object.values(_)) {
6972
- const l = c == a ? o : new y(p.BACK, 0, [g.TSUMO]), d = {
6993
+ const l = c == a ? o : new y(p.BACK, 0, [m.TSUMO]), d = {
6973
6994
  id: i,
6974
6995
  type: "DRAW",
6975
6996
  subType: r,
@@ -7016,7 +7037,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
7016
7037
  },
7017
7038
  notify_reach: ({ context: t, event: e }) => {
7018
7039
  I(e.type == "REACH", `unexpected event ${e.type}`);
7019
- const n = t.genEventID(), i = e.iam, r = e.tile.clone({ add: g.HORIZONTAL });
7040
+ const n = t.genEventID(), i = e.iam, r = e.tile.clone({ add: m.HORIZONTAL });
7020
7041
  t.oneShotMap[i] = !0;
7021
7042
  for (const o of Object.values(_)) {
7022
7043
  const a = {
@@ -7069,7 +7090,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
7069
7090
  t.oneShotMap[t.currentWind] = !1;
7070
7091
  },
7071
7092
  notify_end: ({ context: t, event: e }) => {
7072
- const n = t.genEventID(), i = W("");
7093
+ const n = t.genEventID(), i = W(() => "");
7073
7094
  if (e.type == "DRAWN_GAME_BY_NINE_TERMINALS") {
7074
7095
  i[e.iam] = t.controller.hand(e.iam).toString();
7075
7096
  for (const r of Object.values(_)) {
@@ -7081,7 +7102,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
7081
7102
  shouldContinue: !0,
7082
7103
  sticks: t.controller.placeManager.sticks,
7083
7104
  scores: t.controller.scoreManager.summary,
7084
- deltas: W(0),
7105
+ deltas: W(() => 0),
7085
7106
  hands: i
7086
7107
  };
7087
7108
  t.controller.emit(o);
@@ -7117,8 +7138,8 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
7117
7138
  shouldContinue: !0,
7118
7139
  sticks: t.controller.placeManager.sticks,
7119
7140
  scores: t.controller.scoreManager.summary,
7120
- deltas: W(0),
7121
- hands: W("")
7141
+ deltas: W(() => 0),
7142
+ hands: W(() => "")
7122
7143
  };
7123
7144
  t.controller.emit(a);
7124
7145
  }
@@ -7131,7 +7152,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
7131
7152
  const d = t.controller.hand(l);
7132
7153
  new ge(d).calc() == 0 && (r.push(l), i[l] = d.toString());
7133
7154
  }
7134
- const o = r.length == 0 || r.length == 4, a = W(0);
7155
+ const o = r.length == 0 || r.length == 4, a = W(() => 0);
7135
7156
  for (const l of Object.values(_))
7136
7157
  r.includes(l) ? a[l] += o ? 0 : 3e3 / r.length : a[l] -= o ? 0 : 3e3 / (4 - r.length);
7137
7158
  const c = r.length == 4 || a[_.E] > 0;
@@ -7172,7 +7193,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
7172
7193
  delays: {}
7173
7194
  }
7174
7195
  );
7175
- function Bo(s = 0) {
7196
+ function zo(s = 0) {
7176
7197
  let t = s;
7177
7198
  return () => (t++).toString();
7178
7199
  }
@@ -7217,7 +7238,7 @@ class Ot {
7217
7238
  return this.walls.drawable.length > 0;
7218
7239
  }
7219
7240
  initialHands() {
7220
- const t = W("");
7241
+ const t = W(() => "");
7221
7242
  for (let e = 0; e < 3; e++)
7222
7243
  for (const n of Object.values(_))
7223
7244
  for (let i = 0; i < 4; i++)
@@ -7236,10 +7257,10 @@ class Ot {
7236
7257
  for (let i = 0; i < 4; i++)
7237
7258
  for (let r of n) {
7238
7259
  let o = new y(e, r);
7239
- e != p.Z && i == 3 && r == 5 && (o = o.clone({ add: g.RED })), this.walls.drawable.push(o.toString());
7260
+ e != p.Z && i == 3 && r == 5 && (o = o.clone({ add: m.RED })), this.walls.drawable.push(o.toString());
7240
7261
  }
7241
7262
  }
7242
- Yn(this.walls.drawable);
7263
+ Vn(this.walls.drawable);
7243
7264
  }
7244
7265
  for (let e = 0; e < 14; e++)
7245
7266
  this.walls.dead.push(this.walls.drawable.pop());
@@ -7266,7 +7287,7 @@ class Ot {
7266
7287
  class ye {
7267
7288
  wall = new Ot();
7268
7289
  playerIDs;
7269
- actor = Mt(Nn(this), {});
7290
+ actor = Mt(Tn(this), {});
7270
7291
  observer;
7271
7292
  handlers = {};
7272
7293
  // TODO 同じイベント ID は同じ特定イベントの配列になるので特定イベント ID の配列の union が良さそう
@@ -7278,14 +7299,14 @@ class ye {
7278
7299
  (o) => o.handler.on((a) => this.enqueue(a))
7279
7300
  // bind
7280
7301
  );
7281
- const n = vr();
7282
- this.observer = new Do(n), this.observer.eventHandler.on(
7302
+ const n = kr();
7303
+ this.observer = new jo(n), this.observer.eventHandler.on(
7283
7304
  (o) => this.observer.handleEvent(o)
7284
7305
  // bind
7285
7306
  );
7286
7307
  const i = Object.fromEntries(this.playerIDs.map((o) => [o, 25e3]));
7287
7308
  this.observer.scoreManager = new oe(i);
7288
- const r = e?.shuffle == !1 ? this.playerIDs : Yn([...this.playerIDs]);
7309
+ const r = e?.shuffle == !1 ? this.playerIDs : Vn([...this.playerIDs]);
7289
7310
  this.observer.placeManager = new ae({
7290
7311
  [r[0]]: _.E,
7291
7312
  [r[1]]: _.S,
@@ -7342,7 +7363,7 @@ class ye {
7342
7363
  }
7343
7364
  const i = n[0];
7344
7365
  if (i.type == "CHOICE_AFTER_DISCARDED") {
7345
- const r = Ar(
7366
+ const r = Tr(
7346
7367
  n
7347
7368
  );
7348
7369
  if (r.events.length == 0) {
@@ -7385,7 +7406,7 @@ class ye {
7385
7406
  break;
7386
7407
  }
7387
7408
  } else if (i.type == "CHOICE_AFTER_DRAWN") {
7388
- const r = Ir(n);
7409
+ const r = vr(n);
7389
7410
  I(
7390
7411
  r.events.length == 1,
7391
7412
  `found more than one selected: ${JSON.stringify(r, null, 2)}`
@@ -7412,7 +7433,7 @@ class ye {
7412
7433
  const l = o.choices[r.type];
7413
7434
  I(l, `${r.type} choice is not available`), this.actor.send({
7414
7435
  type: r.type,
7415
- tile: y.from(l[0]).clone({ remove: g.TSUMO }),
7436
+ tile: y.from(l[0]).clone({ remove: m.TSUMO }),
7416
7437
  iam: a
7417
7438
  });
7418
7439
  break;
@@ -7429,7 +7450,7 @@ class ye {
7429
7450
  const d = o.choices[r.type];
7430
7451
  I(d, `${r.type} choice is not available`), this.actor.send({
7431
7452
  type: r.type,
7432
- block: H.from(d[0].tiles),
7453
+ block: P.from(d[0].tiles),
7433
7454
  iam: a
7434
7455
  });
7435
7456
  break;
@@ -7528,11 +7549,11 @@ class ye {
7528
7549
  );
7529
7550
  }
7530
7551
  startGame() {
7531
- for (; console.debug(`start========${this.placeManager.round}=============`), this.start(), this.wall = new Ot(), this.observer.applied = {}, this.mailBox = {}, this.actor = Mt(Nn(this)), !this.placeManager.is(k.W1); )
7552
+ for (; console.debug(`start========${this.placeManager.round}=============`), this.start(), this.wall = new Ot(), this.observer.applied = {}, this.mailBox = {}, this.actor = Mt(Tn(this)), !this.placeManager.is(k.W1); )
7532
7553
  ;
7533
7554
  }
7534
7555
  finalResult(t, e) {
7535
- const n = this.hand(e), i = n.reached ? this.wall.hiddenDoraIndicators : void 0, r = new Fn(n, {
7556
+ const n = this.hand(e), i = n.reached ? this.wall.hiddenDoraIndicators : void 0, r = new Gn(n, {
7536
7557
  ...t.boardContext,
7537
7558
  sticks: this.placeManager.sticks,
7538
7559
  hiddenDoraIndicators: i
@@ -7550,7 +7571,7 @@ class ye {
7550
7571
  o = o.clone(), c.ronWind = n.discardedBy, c.finalDiscardWin = !this.wall.canDraw, c.quadWin = n.quadWin, o.inc([e]);
7551
7572
  } else
7552
7573
  c.finalWallWin = !this.wall.canDraw, c.replacementWin = n?.replacementWin;
7553
- return c.oneShotWin = n?.oneShot, c.doubleReached = r.length == 0 || r.length == 1 && r[0].t.has(g.HORIZONTAL), et.doWin(i, c, e, r);
7574
+ return c.oneShotWin = n?.oneShot, c.doubleReached = r.length == 0 || r.length == 1 && r[0].t.has(m.HORIZONTAL), et.doWin(i, c, e, r);
7554
7575
  }
7555
7576
  doPon(t, e, n) {
7556
7577
  if (n == null) return !1;
@@ -7602,11 +7623,11 @@ class et {
7602
7623
  static doWin(t, e, n, i) {
7603
7624
  const r = e.ronWind != null, o = r ? t.clone() : t;
7604
7625
  r && o.inc([n]);
7605
- const a = new yr(o), c = new Fn(o, e), l = a.calc(n), d = c.calc(...l);
7626
+ const a = new br(o), c = new Gn(o, e), l = a.calc(n), d = c.calc(...l);
7606
7627
  if (!d) return !1;
7607
7628
  if (r) {
7608
7629
  const h = Ft.getEffectiveTiles(t).effectiveTiles;
7609
- if (i.some((u) => h.some((m) => m.equals(u.t))))
7630
+ if (i.some((u) => h.some((g) => g.equals(u.t))))
7610
7631
  return !1;
7611
7632
  }
7612
7633
  return d;
@@ -7614,8 +7635,8 @@ class et {
7614
7635
  static doChi(t, e, n, i) {
7615
7636
  if (!i.isNum() || vt(n) != e || t.reached || t.hands.length < 3) return !1;
7616
7637
  const r = i.clone({
7617
- remove: g.TSUMO,
7618
- add: [g.HORIZONTAL]
7638
+ remove: m.TSUMO,
7639
+ add: [m.HORIZONTAL]
7619
7640
  }), o = [];
7620
7641
  r.n - 2 >= 1 && t.get(i.t, r.n - 2) > 0 && t.get(i.t, r.n - 1) > 0 && o.push(
7621
7642
  new V([
@@ -7637,10 +7658,10 @@ class et {
7637
7658
  ])
7638
7659
  );
7639
7660
  for (let f = 0; f < o.length; f++) {
7640
- const w = o[f], b = Tn(w), A = [];
7661
+ const w = o[f], b = vn(w), A = [];
7641
7662
  for (const at of b) {
7642
7663
  const Q = t.get(at.t, at.n);
7643
- for (let tt = 0; tt < Q; tt++) A.push(at.clone({ remove: g.RED }));
7664
+ for (let tt = 0; tt < Q; tt++) A.push(at.clone({ remove: m.RED }));
7644
7665
  }
7645
7666
  const S = t.dec([...A, w.tiles[1], w.tiles[2]]), x = t.hands.length == 0;
7646
7667
  t.inc(S), x && o.splice(f, 1);
@@ -7654,27 +7675,27 @@ class et {
7654
7675
  (f) => !O(f.tiles[1]) && !O(f.tiles[2])
7655
7676
  ), u = t.get(i.t, 0) > 0;
7656
7677
  if (!u) return o;
7657
- const m = u ? Wo(d) : [];
7658
- return m.length > 0 && u && t.get(i.t, 5) == 1 ? [...h, ...m] : [...o, ...m];
7678
+ const g = u ? Uo(d) : [];
7679
+ return g.length > 0 && u && t.get(i.t, 5) == 1 ? [...h, ...g] : [...o, ...g];
7659
7680
  }
7660
7681
  static doPon(t, e, n, i) {
7661
7682
  if (e == n || t.reached || t.hands.length < 3 || t.get(i.t, i.n) < 2) return !1;
7662
7683
  const r = i.clone({ removeAll: !0 }), o = rn(e, n, E.PON), a = new U([r, r, r]).clone({
7663
- replace: { idx: o, tile: i.clone({ add: g.HORIZONTAL }) }
7684
+ replace: { idx: o, tile: i.clone({ add: m.HORIZONTAL }) }
7664
7685
  });
7665
- if (O(i) && i.has(g.RED))
7686
+ if (O(i) && i.has(m.RED))
7666
7687
  return [a.clone({
7667
7688
  replace: {
7668
7689
  idx: o,
7669
7690
  tile: r.clone({
7670
- add: [g.RED, g.HORIZONTAL]
7691
+ add: [m.RED, m.HORIZONTAL]
7671
7692
  })
7672
7693
  }
7673
7694
  })];
7674
7695
  const c = o % 2 + 1;
7675
7696
  if (O(i) && t.get(i.t, 0) > 0) {
7676
7697
  const l = a.clone({
7677
- replace: { idx: c, tile: r.clone({ add: g.RED }) }
7698
+ replace: { idx: c, tile: r.clone({ add: m.RED }) }
7678
7699
  });
7679
7700
  if (t.get(r.t, 5) == 3) {
7680
7701
  const d = a.clone({
@@ -7694,7 +7715,7 @@ class et {
7694
7715
  if (e == null) return n;
7695
7716
  if (e instanceof U)
7696
7717
  return n.filter((o) => !o.equals(e.tiles[0]));
7697
- const i = Tn(e), r = n.filter((o) => !i.some((a) => o.equals(a)));
7718
+ const i = vn(e), r = n.filter((o) => !i.some((a) => o.equals(a)));
7698
7719
  return I(
7699
7720
  r.length > 0,
7700
7721
  `[bug] no tiles to discard. hand: ${t}, forbidden tiles: ${i}, block-chi: ${e}`
@@ -7705,28 +7726,28 @@ class et {
7705
7726
  const r = i.clone({ removeAll: !0 });
7706
7727
  if (t.get(r.t, r.n) != 3) return !1;
7707
7728
  const o = rn(e, n, E.DAI_KAN), a = new z([r, r, r, r]).clone({
7708
- replace: { idx: o, tile: r.clone({ add: g.HORIZONTAL }) }
7729
+ replace: { idx: o, tile: r.clone({ add: m.HORIZONTAL }) }
7709
7730
  });
7710
7731
  let c = a;
7711
- if (O(i) && i.has(g.RED))
7732
+ if (O(i) && i.has(m.RED))
7712
7733
  c = a.clone({
7713
7734
  replace: {
7714
7735
  idx: o,
7715
- tile: r.clone({ add: [g.HORIZONTAL, g.RED] })
7736
+ tile: r.clone({ add: [m.HORIZONTAL, m.RED] })
7716
7737
  }
7717
7738
  });
7718
- else if (O(i) && !i.has(g.RED)) {
7739
+ else if (O(i) && !i.has(m.RED)) {
7719
7740
  I(
7720
7741
  t.get(i.t, 0) > 0,
7721
7742
  `[bug] hand does not have red tile to daikan: ${t.toString()}`
7722
7743
  );
7723
7744
  const l = o % 3 + 1;
7724
7745
  c = a.clone({
7725
- replace: { idx: l, tile: r.clone({ add: g.RED }) }
7746
+ replace: { idx: l, tile: r.clone({ add: m.RED }) }
7726
7747
  });
7727
7748
  }
7728
7749
  return I(
7729
- c.tiles.filter((l) => l.has(g.HORIZONTAL)).length == 1,
7750
+ c.tiles.filter((l) => l.has(m.HORIZONTAL)).length == 1,
7730
7751
  `[bug] daikan has unexpected horizontal operators: ${c.toString()}`
7731
7752
  ), c;
7732
7753
  }
@@ -7736,12 +7757,12 @@ class et {
7736
7757
  for (const [n, i] of F())
7737
7758
  if (t.get(n, i) == 4) {
7738
7759
  const r = new y(n, i), o = [r, r, r, r];
7739
- O(r) && (o[1] = r.clone({ add: g.RED })), e.push(new R(o));
7760
+ O(r) && (o[1] = r.clone({ add: m.RED })), e.push(new R(o));
7740
7761
  }
7741
7762
  if (e.length == 0) return !1;
7742
7763
  for (const n of e)
7743
7764
  I(
7744
- n.tiles.filter((i) => i.has(g.HORIZONTAL)).length == 0,
7765
+ n.tiles.filter((i) => i.has(m.HORIZONTAL)).length == 0,
7745
7766
  `[bug] ankan has horizontal op: ${n.toString()}`
7746
7767
  );
7747
7768
  return e;
@@ -7754,38 +7775,38 @@ class et {
7754
7775
  for (const i of e) {
7755
7776
  const r = i.tiles[0].clone({
7756
7777
  removeAll: !0,
7757
- add: g.HORIZONTAL
7778
+ add: m.HORIZONTAL
7758
7779
  });
7759
7780
  if (t.get(r.t, r.n) == 1) {
7760
- const o = O(r) && t.get(r.t, 0) > 0 ? r.clone({ add: g.RED }) : r;
7761
- n.push(H.fromPon(i, o));
7781
+ const o = O(r) && t.get(r.t, 0) > 0 ? r.clone({ add: m.RED }) : r;
7782
+ n.push(P.fromPon(i, o));
7762
7783
  }
7763
7784
  }
7764
7785
  if (n.length == 0) return !1;
7765
7786
  for (const i of n)
7766
7787
  I(
7767
- i.tiles.filter((r) => r.has(g.HORIZONTAL)).length == 2,
7788
+ i.tiles.filter((r) => r.has(m.HORIZONTAL)).length == 2,
7768
7789
  `[bug] shokan has unexpected horizontal operators: ${i.toString()}`
7769
7790
  );
7770
7791
  return n;
7771
7792
  }
7772
7793
  }
7773
- function Wo(s) {
7794
+ function Uo(s) {
7774
7795
  return s.length == 0 ? [] : s.map((t) => {
7775
7796
  if (O(t.tiles[1])) {
7776
- const e = t.tiles[1].clone({ add: g.RED });
7797
+ const e = t.tiles[1].clone({ add: m.RED });
7777
7798
  return t.clone({ replace: { idx: 1, tile: e } });
7778
7799
  } else if (O(t.tiles[2])) {
7779
- const e = t.tiles[2].clone({ add: g.RED });
7800
+ const e = t.tiles[2].clone({ add: m.RED });
7780
7801
  return t.clone({ replace: { idx: 2, tile: e } });
7781
7802
  }
7782
7803
  }).filter((t) => t != null);
7783
7804
  }
7784
- function Tn(s) {
7805
+ function vn(s) {
7785
7806
  const t = s.tiles[0], e = s.tiles[1].n;
7786
7807
  return e != 1 && t.n - 2 == e ? [new y(t.t, t.n - 3), t] : e != 8 && t.n + 1 == e ? [new y(t.t, t.n + 3), t] : [t];
7787
7808
  }
7788
- class Pt extends je {
7809
+ class Ht extends je {
7789
7810
  isBackHand() {
7790
7811
  for (const t of Object.values(p))
7791
7812
  if (t != p.BACK && this.sum(t) > 0)
@@ -7793,23 +7814,23 @@ class Pt extends je {
7793
7814
  return this.sum(p.BACK) > 0;
7794
7815
  }
7795
7816
  clone() {
7796
- const t = new Pt(this.toString());
7817
+ const t = new Ht(this.toString());
7797
7818
  return t.data.reached = this.data.reached, t;
7798
7819
  }
7799
7820
  dec(t) {
7800
7821
  return this.isBackHand() ? (super.dec(t.map(() => new y(p.BACK, 0))), [...t]) : super.dec(t);
7801
7822
  }
7802
7823
  }
7803
- class gs {
7824
+ class ys {
7804
7825
  id;
7805
- river = new Vn();
7826
+ river = new Jn();
7806
7827
  placeManager = new ae({});
7807
7828
  // empty for init
7808
7829
  scoreManager = new oe({});
7809
7830
  // empty for init
7810
- hands = W(new Pt(""));
7831
+ hands = W(() => new Ht(""));
7811
7832
  // empty for init
7812
- counter = new Sr();
7833
+ counter = new Cr();
7813
7834
  _doraIndicators = [];
7814
7835
  // empty for init
7815
7836
  eventHandler;
@@ -7859,17 +7880,17 @@ class gs {
7859
7880
  case "CHI":
7860
7881
  case "DAI_KAN": {
7861
7882
  const i = T.deserialize(t.block);
7862
- this.hands[t.iam].call(i), this.river.markCalled(), t.iam != t.wind && this.counter.dec(...i.tiles.filter((r) => !r.has(g.HORIZONTAL)));
7883
+ this.hands[t.iam].call(i), this.river.markCalled(), t.iam != t.wind && this.counter.dec(...i.tiles.filter((r) => !r.has(m.HORIZONTAL)));
7863
7884
  break;
7864
7885
  }
7865
7886
  case "SHO_KAN": {
7866
- const i = H.from(t.block.tiles);
7867
- this.hands[t.iam].kan(i), t.iam != t.wind && this.counter.dec(i.tiles.filter((r) => r.has(g.HORIZONTAL))[0]);
7887
+ const i = P.from(t.block.tiles);
7888
+ this.hands[t.iam].kan(i), t.iam != t.wind && this.counter.dec(i.tiles.filter((r) => r.has(m.HORIZONTAL))[0]);
7868
7889
  break;
7869
7890
  }
7870
7891
  case "AN_KAN": {
7871
7892
  const i = R.from(t.block.tiles);
7872
- this.hands[t.iam].kan(i), t.iam != t.wind && this.counter.dec(...i.tiles.filter((r) => !r.has(g.HORIZONTAL)));
7893
+ this.hands[t.iam].kan(i), t.iam != t.wind && this.counter.dec(...i.tiles.filter((r) => !r.has(m.HORIZONTAL)));
7873
7894
  break;
7874
7895
  }
7875
7896
  case "REACH": {
@@ -7919,13 +7940,13 @@ class gs {
7919
7940
  }
7920
7941
  }
7921
7942
  }
7922
- class Do extends gs {
7943
+ class jo extends ys {
7923
7944
  applied = {};
7924
7945
  constructor(t) {
7925
- super("observer", t), this.counter.disabled = !0, this.hands = W(new Pt("_____________"));
7946
+ super("observer", t), this.counter.disabled = !0, this.hands = W(() => new Ht("_____________"));
7926
7947
  }
7927
7948
  setHands(t) {
7928
- this.hands[t.wind] = new Pt(t.hands[t.wind]);
7949
+ this.hands[t.wind] = new Ht(t.hands[t.wind]);
7929
7950
  }
7930
7951
  handleEvent(t) {
7931
7952
  switch (super.handleEvent(t), t.type) {
@@ -7990,7 +8011,7 @@ class Do extends gs {
7990
8011
  case "END_GAME":
7991
8012
  for (const n of Object.values(_))
7992
8013
  console.debug(
7993
- `${this.placeManager.playerID(n)}(${Le(n)})`,
8014
+ `${this.placeManager.playerID(n)}(${Ke(n)})`,
7994
8015
  `end hand: ${this.hand(n).toString()}`
7995
8016
  );
7996
8017
  console.debug(
@@ -8003,8 +8024,8 @@ class Do extends gs {
8003
8024
  }
8004
8025
  }
8005
8026
  }
8006
- class Qt extends gs {
8007
- river = new Vn();
8027
+ class Qt extends ys {
8028
+ river = new Jn();
8008
8029
  doras = [];
8009
8030
  constructor(t, e) {
8010
8031
  super(t, e), this.eventHandler.on((n) => this.handleEvent(n));
@@ -8014,7 +8035,7 @@ class Qt extends gs {
8014
8035
  }
8015
8036
  setHands(t) {
8016
8037
  for (const e of Object.values(_))
8017
- this.hands[e] = new Pt(t.hands[e]);
8038
+ this.hands[e] = new Ht(t.hands[e]);
8018
8039
  }
8019
8040
  handleDiscard(t) {
8020
8041
  const e = Object.values(_).filter((l) => l == this.myWind ? !1 : this.hand(l).reached), n = new ge(this.hand(this.myWind)).calc();
@@ -8054,7 +8075,7 @@ class Qt extends gs {
8054
8075
  }
8055
8076
  }
8056
8077
  }
8057
- class Qo {
8078
+ class ia {
8058
8079
  index = 0;
8059
8080
  histories = [];
8060
8081
  constructor(t) {
@@ -8074,8 +8095,8 @@ class Qo {
8074
8095
  this.start();
8075
8096
  }
8076
8097
  }
8077
- const ta = (s) => {
8078
- const [t, e] = Jt(), [n, i] = Jt(), [r, o] = Jt(), [a, c] = Jt(), l = ["player-1", "player-2", "player-3", "player-4"], d = s?.playerInjection, h = d?.p1 ?? Qt, u = d?.p2 ?? Qt, m = d?.p3 ?? Qt, f = d?.p4 ?? Qt, w = new h(l[0], e), b = new u(l[1], i), A = new m(l[2], o), S = new f(l[3], c), x = [
8098
+ const ra = (s) => {
8099
+ const [t, e] = Jt(), [n, i] = Jt(), [r, o] = Jt(), [a, c] = Jt(), l = ["player-1", "player-2", "player-3", "player-4"], d = s?.playerInjection, h = d?.p1 ?? Qt, u = d?.p2 ?? Qt, g = d?.p3 ?? Qt, f = d?.p4 ?? Qt, w = new h(l[0], e), b = new u(l[1], i), A = new g(l[2], o), S = new f(l[3], c), x = [
8079
8100
  { handler: t, id: l[0] },
8080
8101
  { handler: n, id: l[1] },
8081
8102
  { handler: r, id: l[2] },
@@ -8135,7 +8156,7 @@ class ue {
8135
8156
  {
8136
8157
  const o = t.get(i);
8137
8158
  r += o * ut(i, n);
8138
- const a = t.get(new y(i.t, i.n + 1)), c = t.get(new y(i.t, i.n + 2)), l = t.get(new y(i.t, i.n - 1)), d = t.get(new y(i.t, i.n - 2)), h = i.n - 2 > 0 ? Math.min(l, d) : 0, u = i.n + 2 <= 9 ? Math.min(a, c) : 0, m = i.n - 1 >= 1 && i.n + 1 <= 9 ? Math.min(a, l) : 0, f = Math.max(h, m), w = Math.max(m, u);
8159
+ const a = t.get(new y(i.t, i.n + 1)), c = t.get(new y(i.t, i.n + 2)), l = t.get(new y(i.t, i.n - 1)), d = t.get(new y(i.t, i.n - 2)), h = i.n - 2 > 0 ? Math.min(l, d) : 0, u = i.n + 2 <= 9 ? Math.min(a, c) : 0, g = i.n - 1 >= 1 && i.n + 1 <= 9 ? Math.min(a, l) : 0, f = Math.max(h, g), w = Math.max(g, u);
8139
8160
  return r += o * ut(i, n), r += h * ut(new y(i.t, i.n - 2), n), r += u * ut(new y(i.t, i.n + 2), n), r += f * ut(new y(i.t, i.n - 1), n), r += w * ut(new y(i.t, i.n + 1), n), i.n == 0, r;
8140
8161
  }
8141
8162
  }
@@ -8180,61 +8201,61 @@ class Ut {
8180
8201
  }
8181
8202
  export {
8182
8203
  et as ActionLogic,
8183
- Pt as ActorHand,
8204
+ Ht as ActorHand,
8184
8205
  E as BLOCK,
8185
- gs as BaseActor,
8206
+ ys as BaseActor,
8186
8207
  T as Block,
8187
8208
  R as BlockAnKan,
8188
- yr as BlockCalculator,
8209
+ br as BlockCalculator,
8189
8210
  V as BlockChi,
8190
8211
  z as BlockDaiKan,
8191
8212
  Tt as BlockHand,
8192
- On as BlockIsolated,
8193
- Ke as BlockOther,
8213
+ kn as BlockIsolated,
8214
+ Le as BlockOther,
8194
8215
  C as BlockPair,
8195
8216
  U as BlockPon,
8196
8217
  gt as BlockRun,
8197
- H as BlockShoKan,
8198
- K as BlockThree,
8218
+ P as BlockShoKan,
8219
+ L as BlockThree,
8199
8220
  ye as Controller,
8200
- Sr as Counter,
8221
+ Cr as Counter,
8201
8222
  Ft as Efficiency,
8202
- vn as FONT_FAMILY,
8223
+ Sn as FONT_FAMILY,
8203
8224
  N as G,
8204
8225
  je as Hand,
8205
8226
  X as INPUT_SEPARATOR,
8206
- Pn as Image,
8227
+ Bn as Image,
8207
8228
  Kn as ImageHelper,
8208
- bt as Mark,
8209
- Lo as MeasureText,
8210
- Fo as MyG,
8211
- Go as MyImage,
8212
- Yo as MyRect,
8213
- jo as MySVG,
8214
- Vo as MyText,
8215
- Zo as MyUse,
8229
+ _t as Mark,
8230
+ Go as MeasureText,
8231
+ Jo as MyG,
8232
+ Xo as MyImage,
8233
+ Qo as MyRect,
8234
+ Vo as MySVG,
8235
+ ta as MyText,
8236
+ qo as MyUse,
8216
8237
  q as N19,
8217
8238
  jt as NZ,
8218
- g as OP,
8219
- Do as Observer,
8239
+ m as OP,
8240
+ jo as Observer,
8220
8241
  D as Parser,
8221
8242
  ae as PlaceManager,
8222
8243
  Qt as Player,
8223
8244
  ue as PlayerEfficiency,
8224
- Fn as PointCalculator,
8245
+ Gn as PointCalculator,
8225
8246
  k as ROUND,
8226
- Sn as ROUND_MAP,
8227
- Bn as Rect,
8228
- Qo as Replayer,
8247
+ On as ROUND_MAP,
8248
+ Wn as Rect,
8249
+ ia as Replayer,
8229
8250
  Ut as RiskRank,
8230
- Vn as River,
8251
+ Jn as River,
8231
8252
  en as STICK_CONTEXT,
8232
- Bi as SVG,
8253
+ Di as SVG,
8233
8254
  oe as ScoreManager,
8234
8255
  ge as ShantenCalculator,
8235
- Pi as Svg,
8236
- Wn as Symbol,
8237
- bs as TABLE_CONTEXT,
8256
+ Wi as Svg,
8257
+ Dn as Symbol,
8258
+ Is as TABLE_CONTEXT,
8238
8259
  wt as TILE_CONTEXT,
8239
8260
  p as TYPE,
8240
8261
  St as Text,
@@ -8243,35 +8264,36 @@ export {
8243
8264
  _ as WIND,
8244
8265
  We as WIND_MAP,
8245
8266
  Ot as Wall,
8267
+ vs as compareCalledTiles,
8246
8268
  fe as compareTiles,
8247
- gr as convertInput,
8248
- Lt as createBlockHand,
8249
- Nn as createControllerMachine,
8250
- vr as createEventEmitter,
8269
+ wr as convertTableInput,
8270
+ Kt as createBlockHand,
8271
+ Tn as createControllerMachine,
8272
+ kr as createEventEmitter,
8251
8273
  Jt as createEventPipe,
8252
- ta as createLocalGame,
8253
- Xi as createTable,
8274
+ ra as createLocalGame,
8275
+ Qi as createTable,
8254
8276
  W as createWindMap,
8255
8277
  Vt as deserializeWinResult,
8256
- Jo as drawBlocks,
8257
- qo as drawTable,
8278
+ ea as drawBlocks,
8279
+ sa as drawTable,
8258
8280
  F as forHand,
8259
8281
  rn as getCallBlockIndex,
8260
- _r as getPointDescription,
8261
- Bo as incrementalIDGenerator,
8282
+ Ir as getPointDescription,
8283
+ zo as incrementalIDGenerator,
8262
8284
  O as is5Tile,
8263
8285
  te as nextRound,
8264
8286
  vt as nextWind,
8265
- Xo as optimizeSVG,
8266
- hr as parse,
8267
- dr as parseTableInput,
8268
- zo as prevRound,
8269
- Le as prevWind,
8270
- Ar as prioritizeDiscardedEvents,
8271
- Ir as prioritizeDrawnEvents,
8272
- ks as roundWind,
8287
+ na as optimizeSVG,
8288
+ ur as parse,
8289
+ pr as parseRawTableInput,
8290
+ fr as parseYamlStringInput,
8291
+ Zo as prevRound,
8292
+ Ke as prevWind,
8293
+ Tr as prioritizeDiscardedEvents,
8294
+ vr as prioritizeDrawnEvents,
8295
+ Rs as roundWind,
8273
8296
  Ce as serializeWinResult,
8274
- Yn as shuffle,
8275
- Ns as sortCalledTiles,
8276
- pn as toDora
8297
+ Vn as shuffle,
8298
+ gn as toDora
8277
8299
  };