@konoui/mjimage 0.0.42 → 0.0.43
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.cjs +9 -9
- package/dist/index.d.cts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +769 -758
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const zs = "MS Gothic, sans-serif", Rt = {
|
|
|
12
12
|
S: "s",
|
|
13
13
|
Z: "z",
|
|
14
14
|
BACK: "_"
|
|
15
|
-
},
|
|
15
|
+
}, g = {
|
|
16
16
|
TSUMO: "t",
|
|
17
17
|
RON: "v",
|
|
18
18
|
DORA: "d",
|
|
@@ -57,7 +57,7 @@ const zs = "MS Gothic, sans-serif", Rt = {
|
|
|
57
57
|
N2: "4w2",
|
|
58
58
|
N3: "4w3",
|
|
59
59
|
N4: "4w4"
|
|
60
|
-
},
|
|
60
|
+
}, Kn = {
|
|
61
61
|
[v.E]: "東",
|
|
62
62
|
[v.S]: "南",
|
|
63
63
|
[v.W]: "西",
|
|
@@ -80,7 +80,7 @@ const zs = "MS Gothic, sans-serif", Rt = {
|
|
|
80
80
|
[j.N3]: "北3局",
|
|
81
81
|
[j.N4]: "北4局"
|
|
82
82
|
};
|
|
83
|
-
function
|
|
83
|
+
function k(s, t) {
|
|
84
84
|
if (!s)
|
|
85
85
|
throw new Error(t);
|
|
86
86
|
}
|
|
@@ -90,7 +90,7 @@ class lh {
|
|
|
90
90
|
A(this, "strText");
|
|
91
91
|
A(this, "numText");
|
|
92
92
|
A(this, "measure", (t, e) => {
|
|
93
|
-
this.ctx == null && (this.ctx = document.createElement("canvas").getContext("2d"),
|
|
93
|
+
this.ctx == null && (this.ctx = document.createElement("canvas").getContext("2d"), k(this.ctx, "context is null"));
|
|
94
94
|
const n = this.ctx;
|
|
95
95
|
n.font = e;
|
|
96
96
|
const i = n.measureText(t);
|
|
@@ -148,11 +148,11 @@ class er {
|
|
|
148
148
|
return /\s/.test(t);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
const
|
|
151
|
+
const Ve = (s, t) => {
|
|
152
152
|
if (s.t == t.t) {
|
|
153
153
|
if (z(s) && z(t)) {
|
|
154
|
-
if (s.has(
|
|
155
|
-
if (t.has(
|
|
154
|
+
if (s.has(g.RED)) return -1;
|
|
155
|
+
if (t.has(g.RED)) return 1;
|
|
156
156
|
}
|
|
157
157
|
return s.n - t.n;
|
|
158
158
|
}
|
|
@@ -166,20 +166,20 @@ const Je = (s, t) => {
|
|
|
166
166
|
return e[s.t] - e[t.t];
|
|
167
167
|
}, nr = (s, t) => {
|
|
168
168
|
const e = {
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
169
|
+
[g.HORIZONTAL]: 1,
|
|
170
|
+
[g.TSUMO]: 2,
|
|
171
|
+
[g.RON]: 3,
|
|
172
|
+
[g.DORA]: 4,
|
|
173
|
+
[g.COLOR_GRAYSCALE]: 5,
|
|
174
|
+
[g.RED]: 6
|
|
175
175
|
};
|
|
176
176
|
return e[s] - e[t];
|
|
177
177
|
}, sr = (s) => {
|
|
178
178
|
const t = [];
|
|
179
179
|
s.forEach((n, i) => {
|
|
180
|
-
n.has(
|
|
180
|
+
n.has(g.HORIZONTAL) && t.push(i);
|
|
181
181
|
});
|
|
182
|
-
const e = s.filter((n) => !n.has(
|
|
182
|
+
const e = s.filter((n) => !n.has(g.HORIZONTAL)).sort(Ve);
|
|
183
183
|
return t.forEach((n) => {
|
|
184
184
|
e.splice(n, 0, s[n]);
|
|
185
185
|
}), e;
|
|
@@ -231,7 +231,7 @@ class P {
|
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
if (this._type != b.IMAGE_DISCARD) {
|
|
234
|
-
this._tiles = [...this._tiles].sort(
|
|
234
|
+
this._tiles = [...this._tiles].sort(Ve);
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
@@ -244,7 +244,7 @@ class P {
|
|
|
244
244
|
throw new Error(
|
|
245
245
|
`input type is ${t.type} but got is ${n}: ${t.tiles}`
|
|
246
246
|
);
|
|
247
|
-
return
|
|
247
|
+
return Pe(e[0].tiles, t.type);
|
|
248
248
|
}
|
|
249
249
|
serialize() {
|
|
250
250
|
return {
|
|
@@ -277,7 +277,7 @@ class P {
|
|
|
277
277
|
clone(t) {
|
|
278
278
|
const e = t == null ? void 0 : t.replace;
|
|
279
279
|
let n = [...this.tiles];
|
|
280
|
-
return e && (n[e.idx] = e.tile),
|
|
280
|
+
return e && (n[e.idx] = e.tile), Pe(n, this._type);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
const zt = (s) => {
|
|
@@ -287,7 +287,7 @@ const zt = (s) => {
|
|
|
287
287
|
t += e.toString().slice(0, -1);
|
|
288
288
|
}
|
|
289
289
|
return `${t}${s[0].t}`;
|
|
290
|
-
},
|
|
290
|
+
}, Un = (s) => {
|
|
291
291
|
let t = s[0].t, e = "";
|
|
292
292
|
for (let i = 0; i < s.length; i++) {
|
|
293
293
|
const r = s[i], o = r.t, a = o == p.BACK ? r.toString() : r.toString().slice(0, -1);
|
|
@@ -324,7 +324,7 @@ class Z extends P {
|
|
|
324
324
|
if (e.length < t.length) {
|
|
325
325
|
if (z(n)) {
|
|
326
326
|
const i = new w(n.t, 5);
|
|
327
|
-
super([i.clone({ add:
|
|
327
|
+
super([i.clone({ add: g.RED }), i, i, i], b.AN_KAN);
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
super([n, n, n, n], b.AN_KAN);
|
|
@@ -333,14 +333,14 @@ class Z extends P {
|
|
|
333
333
|
super(t, b.AN_KAN);
|
|
334
334
|
}
|
|
335
335
|
get tilesWithBack() {
|
|
336
|
-
const t = this.tiles[0].clone({ remove:
|
|
336
|
+
const t = this.tiles[0].clone({ remove: g.RED }), e = z(t) ? t.clone({ add: g.RED }) : t;
|
|
337
337
|
return [new w(p.BACK, 0), e, t, new w(p.BACK, 0)];
|
|
338
338
|
}
|
|
339
339
|
static from(t) {
|
|
340
340
|
return P.deserialize({ tiles: t, type: b.AN_KAN });
|
|
341
341
|
}
|
|
342
342
|
toString() {
|
|
343
|
-
return
|
|
343
|
+
return Un(this.tilesWithBack);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
class yt extends P {
|
|
@@ -403,23 +403,23 @@ class Ks extends P {
|
|
|
403
403
|
return this.tiles[0].toString();
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
class
|
|
406
|
+
class me extends P {
|
|
407
407
|
constructor(t) {
|
|
408
408
|
super(t, b.HAND);
|
|
409
409
|
}
|
|
410
410
|
toString() {
|
|
411
|
-
return
|
|
411
|
+
return Un(this.tiles);
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
class
|
|
414
|
+
class Us extends P {
|
|
415
415
|
constructor(t, e) {
|
|
416
416
|
super(t, e);
|
|
417
417
|
}
|
|
418
418
|
toString() {
|
|
419
|
-
return this.is(b.IMAGE_DISCARD) ? this.tiles.join("") :
|
|
419
|
+
return this.is(b.IMAGE_DISCARD) ? this.tiles.join("") : Un(this.tiles);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
const
|
|
422
|
+
const Pe = (s, t) => {
|
|
423
423
|
switch (t) {
|
|
424
424
|
case b.CHI:
|
|
425
425
|
return new ut([s[0], s[1], s[2]]);
|
|
@@ -440,9 +440,9 @@ const Be = (s, t) => {
|
|
|
440
440
|
case b.ISOLATED:
|
|
441
441
|
return new Ks(s[0]);
|
|
442
442
|
case b.HAND:
|
|
443
|
-
return new
|
|
443
|
+
return new me(s);
|
|
444
444
|
default:
|
|
445
|
-
return new
|
|
445
|
+
return new Us(s, t);
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
448
|
class nt {
|
|
@@ -482,7 +482,7 @@ class nt {
|
|
|
482
482
|
n.push(a), t.readChar();
|
|
483
483
|
continue;
|
|
484
484
|
}
|
|
485
|
-
const [h, l] =
|
|
485
|
+
const [h, l] = Fs(i);
|
|
486
486
|
if (!l)
|
|
487
487
|
throw new Error(
|
|
488
488
|
`encounter unexpected number. n: ${h}, current: ${i}, input: ${t.input}`
|
|
@@ -501,13 +501,13 @@ class nt {
|
|
|
501
501
|
if (t.length == 0) return n;
|
|
502
502
|
for (const o of t) {
|
|
503
503
|
if (o == Dt) {
|
|
504
|
-
const a = ys(e), c =
|
|
504
|
+
const a = ys(e), c = Pe(e, a);
|
|
505
505
|
n.push(c), e = [];
|
|
506
506
|
continue;
|
|
507
507
|
}
|
|
508
508
|
e.push(o);
|
|
509
509
|
}
|
|
510
|
-
const i = ys(e), r =
|
|
510
|
+
const i = ys(e), r = Pe(e, i);
|
|
511
511
|
return n.push(r), e = [], n;
|
|
512
512
|
}
|
|
513
513
|
validate(t) {
|
|
@@ -522,11 +522,11 @@ class nt {
|
|
|
522
522
|
function ys(s) {
|
|
523
523
|
if (s.length === 0) return b.UNKNOWN;
|
|
524
524
|
if (s.length === 1)
|
|
525
|
-
return s[0].has(
|
|
525
|
+
return s[0].has(g.DORA) ? b.IMAGE_DORA : s[0].has(g.TSUMO) ? b.TSUMO : b.HAND;
|
|
526
526
|
const t = s.every((r) => r.equals(s[0])), e = s.filter(
|
|
527
|
-
(r) => r.has(
|
|
527
|
+
(r) => r.has(g.HORIZONTAL)
|
|
528
528
|
).length, n = s.filter(
|
|
529
|
-
(r) => r.has(
|
|
529
|
+
(r) => r.has(g.TSUMO) || r.has(g.DORA)
|
|
530
530
|
).length, i = s.filter((r) => r.t == p.BACK).length;
|
|
531
531
|
if (n > 0) return b.UNKNOWN;
|
|
532
532
|
if (e == 0 && i == 0) return b.HAND;
|
|
@@ -540,7 +540,7 @@ function ys(s) {
|
|
|
540
540
|
return e == 1 || n == 0 ? b.IMAGE_DISCARD : b.UNKNOWN;
|
|
541
541
|
}
|
|
542
542
|
function rr(s) {
|
|
543
|
-
const t = [...s].sort(
|
|
543
|
+
const t = [...s].sort(Ve);
|
|
544
544
|
if (!t.every((n) => t[0].t == n.t)) return !1;
|
|
545
545
|
const e = t.map((n) => n.n);
|
|
546
546
|
for (let n = 0; n < e.length - 1; n++)
|
|
@@ -550,7 +550,7 @@ function rr(s) {
|
|
|
550
550
|
function or(s, t) {
|
|
551
551
|
return s.map((e) => {
|
|
552
552
|
const n = new w(t, e.n, e.ops);
|
|
553
|
-
return n.isNum() && n.n == 0 ? n.clone({ n: 5, add:
|
|
553
|
+
return n.isNum() && n.n == 0 ? n.clone({ n: 5, add: g.RED }) : n;
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
556
|
function ws(s, t) {
|
|
@@ -565,24 +565,29 @@ function ws(s, t) {
|
|
|
565
565
|
}
|
|
566
566
|
return [p.BACK, !1];
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function Fs(s) {
|
|
569
569
|
const t = Number(s), e = 0 <= t && t <= 9;
|
|
570
570
|
return [t, e];
|
|
571
571
|
}
|
|
572
572
|
function ar(s) {
|
|
573
|
-
const t = Object.values(
|
|
573
|
+
const t = Object.values(g);
|
|
574
574
|
if (!t.includes(s.char)) return [new w(p.BACK, 0), !1];
|
|
575
575
|
const e = [];
|
|
576
576
|
for (let n = 0; n < 4; n++) {
|
|
577
577
|
const i = s.peekCharN(n);
|
|
578
578
|
if (t.includes(i)) e.push(i);
|
|
579
579
|
else {
|
|
580
|
-
const [r, o] =
|
|
580
|
+
const [r, o] = Fs(i);
|
|
581
581
|
if (!o) break;
|
|
582
582
|
for (let c = 0; c < e.length; c++) s.readChar();
|
|
583
|
-
if (e.some((c) => c ==
|
|
584
|
-
throw new Error(`found ${
|
|
585
|
-
|
|
583
|
+
if (e.some((c) => c == g.RED) && r != 5)
|
|
584
|
+
throw new Error(`found ${g.RED} but number is not 5: ${r}`);
|
|
585
|
+
const a = new w(p.BACK, r, e);
|
|
586
|
+
if (a.has(g.DORA) && a.has(g.TSUMO))
|
|
587
|
+
throw new Error(
|
|
588
|
+
`unable to specify both ${g.DORA} and ${g.TSUMO}`
|
|
589
|
+
);
|
|
590
|
+
return [a, !0];
|
|
586
591
|
}
|
|
587
592
|
}
|
|
588
593
|
return [new w(p.BACK, 0), !1];
|
|
@@ -598,10 +603,10 @@ function G(s, t = !1) {
|
|
|
598
603
|
for (let n of Object.values(v)) e[n] = structuredClone(s);
|
|
599
604
|
return e;
|
|
600
605
|
}
|
|
601
|
-
const
|
|
606
|
+
const We = (s) => {
|
|
602
607
|
let t = s.substring(0, 2), e = Number(s.substring(2, 3));
|
|
603
608
|
return e == 4 ? (e = 1, t = Ht(t)) : e++, `${t}${e}`;
|
|
604
|
-
}, uh = (s) =>
|
|
609
|
+
}, uh = (s) => We(We(We(s))), Ht = (s) => {
|
|
605
610
|
let t = Number(s.toString()[0]);
|
|
606
611
|
return t = t % 4 + 1, `${t}w`;
|
|
607
612
|
}, cr = (s) => {
|
|
@@ -609,23 +614,23 @@ const $e = (s) => {
|
|
|
609
614
|
return t = t % 2 + 1, `${t}w`;
|
|
610
615
|
}, _s = (s, t, e) => {
|
|
611
616
|
const n = Math.abs(Number(s[0]) - Number(t[0]));
|
|
612
|
-
return
|
|
613
|
-
},
|
|
614
|
-
function
|
|
617
|
+
return k(n == 1 || n == 2 || n == 3), e == b.PON ? n == 3 ? 0 : n == 2 ? 1 : 2 : n == 3 ? 0 : n == 1 ? 3 : 2;
|
|
618
|
+
}, bn = {}, qs = [];
|
|
619
|
+
function O(s, t) {
|
|
615
620
|
if (Array.isArray(s)) {
|
|
616
621
|
for (const e of s)
|
|
617
|
-
|
|
622
|
+
O(e, t);
|
|
618
623
|
return;
|
|
619
624
|
}
|
|
620
625
|
if (typeof s == "object") {
|
|
621
626
|
for (const e in s)
|
|
622
|
-
|
|
627
|
+
O(e, s[e]);
|
|
623
628
|
return;
|
|
624
629
|
}
|
|
625
|
-
Zs(Object.getOwnPropertyNames(t)),
|
|
630
|
+
Zs(Object.getOwnPropertyNames(t)), bn[s] = Object.assign(bn[s] || {}, t);
|
|
626
631
|
}
|
|
627
632
|
function X(s) {
|
|
628
|
-
return
|
|
633
|
+
return bn[s] || {};
|
|
629
634
|
}
|
|
630
635
|
function hr() {
|
|
631
636
|
return [...new Set(qs)];
|
|
@@ -633,7 +638,7 @@ function hr() {
|
|
|
633
638
|
function Zs(s) {
|
|
634
639
|
qs.push(...s);
|
|
635
640
|
}
|
|
636
|
-
function
|
|
641
|
+
function Fn(s, t) {
|
|
637
642
|
let e;
|
|
638
643
|
const n = s.length, i = [];
|
|
639
644
|
for (e = 0; e < n; e++)
|
|
@@ -647,7 +652,7 @@ function lr(s, t) {
|
|
|
647
652
|
t(s[e]) && i.push(s[e]);
|
|
648
653
|
return i;
|
|
649
654
|
}
|
|
650
|
-
function
|
|
655
|
+
function hn(s) {
|
|
651
656
|
return s % 360 * Math.PI / 180;
|
|
652
657
|
}
|
|
653
658
|
function ur(s) {
|
|
@@ -664,7 +669,7 @@ function ae(s, t, e, n) {
|
|
|
664
669
|
height: e
|
|
665
670
|
};
|
|
666
671
|
}
|
|
667
|
-
function
|
|
672
|
+
function vn(s, t) {
|
|
668
673
|
const e = s.origin;
|
|
669
674
|
let n = s.ox != null ? s.ox : s.originX != null ? s.originX : "center", i = s.oy != null ? s.oy : s.originY != null ? s.originY : "center";
|
|
670
675
|
e != null && ([n, i] = Array.isArray(e) ? e : typeof e == "object" ? [e.x, e.y] : [e, e]);
|
|
@@ -675,12 +680,12 @@ function bn(s, t) {
|
|
|
675
680
|
}
|
|
676
681
|
return [n, i];
|
|
677
682
|
}
|
|
678
|
-
const fr = /* @__PURE__ */ new Set(["desc", "metadata", "title"]),
|
|
683
|
+
const fr = /* @__PURE__ */ new Set(["desc", "metadata", "title"]), An = (s) => fr.has(s.nodeName), Ys = (s, t, e = {}) => {
|
|
679
684
|
const n = { ...t };
|
|
680
685
|
for (const i in n)
|
|
681
686
|
n[i].valueOf() === e[i] && delete n[i];
|
|
682
687
|
Object.keys(n).length ? s.node.setAttribute("data-svgjs", JSON.stringify(n)) : (s.node.removeAttribute("data-svgjs"), s.node.removeAttribute("svgjs:data"));
|
|
683
|
-
}, qn = "http://www.w3.org/2000/svg", dr = "http://www.w3.org/1999/xhtml",
|
|
688
|
+
}, qn = "http://www.w3.org/2000/svg", dr = "http://www.w3.org/1999/xhtml", ln = "http://www.w3.org/2000/xmlns/", ve = "http://www.w3.org/1999/xlink", N = {
|
|
684
689
|
window: typeof window > "u" ? null : window,
|
|
685
690
|
document: typeof document > "u" ? null : document
|
|
686
691
|
};
|
|
@@ -698,22 +703,22 @@ class Zn {
|
|
|
698
703
|
// }
|
|
699
704
|
}
|
|
700
705
|
const $t = {}, Gn = "___SYMBOL___ROOT___";
|
|
701
|
-
function
|
|
706
|
+
function ge(s, t = qn) {
|
|
702
707
|
return N.document.createElementNS(t, s);
|
|
703
708
|
}
|
|
704
709
|
function Y(s, t = !1) {
|
|
705
710
|
if (s instanceof Zn) return s;
|
|
706
711
|
if (typeof s == "object")
|
|
707
|
-
return
|
|
712
|
+
return un(s);
|
|
708
713
|
if (s == null)
|
|
709
714
|
return new $t[Gn]();
|
|
710
715
|
if (typeof s == "string" && s.charAt(0) !== "<")
|
|
711
|
-
return
|
|
712
|
-
const e = t ? N.document.createElement("div") :
|
|
713
|
-
return e.innerHTML = s, s =
|
|
716
|
+
return un(N.document.querySelector(s));
|
|
717
|
+
const e = t ? N.document.createElement("div") : ge("svg");
|
|
718
|
+
return e.innerHTML = s, s = un(e.firstChild), e.removeChild(e.firstChild), s;
|
|
714
719
|
}
|
|
715
720
|
function $(s, t) {
|
|
716
|
-
return t && (t instanceof N.window.Node || t.ownerDocument && t instanceof t.ownerDocument.defaultView.Node) ? t :
|
|
721
|
+
return t && (t instanceof N.window.Node || t.ownerDocument && t instanceof t.ownerDocument.defaultView.Node) ? t : ge(s);
|
|
717
722
|
}
|
|
718
723
|
function st(s) {
|
|
719
724
|
if (!s) return null;
|
|
@@ -723,7 +728,7 @@ function st(s) {
|
|
|
723
728
|
let t = Gs(s.nodeName || "Dom");
|
|
724
729
|
return t === "LinearGradient" || t === "RadialGradient" ? t = "Gradient" : $t[t] || (t = "Dom"), new $t[t](s);
|
|
725
730
|
}
|
|
726
|
-
let
|
|
731
|
+
let un = st;
|
|
727
732
|
function D(s, t = s.name, e = !1) {
|
|
728
733
|
return $t[t] = s, e && ($t[Gn] = s), Zs(Object.getOwnPropertyNames(s.prototype)), s;
|
|
729
734
|
}
|
|
@@ -782,18 +787,18 @@ function Er(s) {
|
|
|
782
787
|
const t = this.position();
|
|
783
788
|
return this.parent().add(s, t), this;
|
|
784
789
|
}
|
|
785
|
-
function
|
|
790
|
+
function Tr(s) {
|
|
786
791
|
s = Y(s), s.remove();
|
|
787
792
|
const t = this.position();
|
|
788
793
|
return this.parent().add(s, t + 1), this;
|
|
789
794
|
}
|
|
790
|
-
function
|
|
795
|
+
function Or(s) {
|
|
791
796
|
return s = Y(s), s.before(this), this;
|
|
792
797
|
}
|
|
793
|
-
function
|
|
798
|
+
function kr(s) {
|
|
794
799
|
return s = Y(s), s.after(this), this;
|
|
795
800
|
}
|
|
796
|
-
|
|
801
|
+
O("Dom", {
|
|
797
802
|
siblings: yr,
|
|
798
803
|
position: wr,
|
|
799
804
|
next: _r,
|
|
@@ -803,9 +808,9 @@ T("Dom", {
|
|
|
803
808
|
front: Sr,
|
|
804
809
|
back: xr,
|
|
805
810
|
before: Er,
|
|
806
|
-
after:
|
|
807
|
-
insertBefore:
|
|
808
|
-
insertAfter:
|
|
811
|
+
after: Tr,
|
|
812
|
+
insertBefore: Or,
|
|
813
|
+
insertAfter: kr
|
|
809
814
|
});
|
|
810
815
|
const Vs = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i, Ir = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, Nr = /rgb\((\d+),(\d+),(\d+)\)/, Dr = /(#[a-z_][a-z0-9\-_]*)/i, Cr = /\)\s*,?\s*/, Mr = /\s/g, bs = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i, vs = /^rgb\(/, As = /^(\s+)?$/, Ss = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, Rr = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i, _t = /[\s,]+/, Yn = /[MLHVCSQTAZ]/i;
|
|
811
816
|
function Hr() {
|
|
@@ -833,7 +838,7 @@ function Br(s) {
|
|
|
833
838
|
function Pr(s) {
|
|
834
839
|
return this.hasClass(s) ? this.removeClass(s) : this.addClass(s);
|
|
835
840
|
}
|
|
836
|
-
|
|
841
|
+
O("Dom", {
|
|
837
842
|
classes: Hr,
|
|
838
843
|
hasClass: $r,
|
|
839
844
|
addClass: Wr,
|
|
@@ -880,16 +885,16 @@ function Lr() {
|
|
|
880
885
|
function Kr() {
|
|
881
886
|
return this.css("display") !== "none";
|
|
882
887
|
}
|
|
883
|
-
|
|
888
|
+
O("Dom", {
|
|
884
889
|
css: jr,
|
|
885
890
|
show: zr,
|
|
886
891
|
hide: Lr,
|
|
887
892
|
visible: Kr
|
|
888
893
|
});
|
|
889
|
-
function
|
|
894
|
+
function Ur(s, t, e) {
|
|
890
895
|
if (s == null)
|
|
891
896
|
return this.data(
|
|
892
|
-
|
|
897
|
+
Fn(
|
|
893
898
|
lr(
|
|
894
899
|
this.node.attributes,
|
|
895
900
|
(n) => n.nodeName.indexOf("data-") === 0
|
|
@@ -918,8 +923,8 @@ function Fr(s, t, e) {
|
|
|
918
923
|
);
|
|
919
924
|
return this;
|
|
920
925
|
}
|
|
921
|
-
|
|
922
|
-
function
|
|
926
|
+
O("Dom", { data: Ur });
|
|
927
|
+
function Fr(s, t) {
|
|
923
928
|
if (typeof arguments[0] == "object")
|
|
924
929
|
for (const e in s)
|
|
925
930
|
this.remember(e, s[e]);
|
|
@@ -941,7 +946,7 @@ function qr() {
|
|
|
941
946
|
function Zr() {
|
|
942
947
|
return this._memory = this._memory || {};
|
|
943
948
|
}
|
|
944
|
-
|
|
949
|
+
O("Dom", { remember: Fr, forget: qr, memory: Zr });
|
|
945
950
|
function Gr(s) {
|
|
946
951
|
return s.length === 4 ? [
|
|
947
952
|
"#",
|
|
@@ -970,7 +975,7 @@ function Xr(s, t) {
|
|
|
970
975
|
function Jr(s) {
|
|
971
976
|
return s === "lab" || s === "xyz" || s === "lch";
|
|
972
977
|
}
|
|
973
|
-
function
|
|
978
|
+
function fn(s, t, e) {
|
|
974
979
|
return e < 0 && (e += 1), e > 1 && (e -= 1), e < 1 / 6 ? s + (t - s) * 6 * e : e < 1 / 2 ? t : e < 2 / 3 ? s + (t - s) * (2 / 3 - e) * 6 : s;
|
|
975
980
|
}
|
|
976
981
|
class M {
|
|
@@ -1027,7 +1032,7 @@ class M {
|
|
|
1027
1032
|
return new M(c, h, l, a, "cmyk");
|
|
1028
1033
|
}
|
|
1029
1034
|
hsl() {
|
|
1030
|
-
const { _a: t, _b: e, _c: n } = this.rgb(), [i, r, o] = [t, e, n].map((
|
|
1035
|
+
const { _a: t, _b: e, _c: n } = this.rgb(), [i, r, o] = [t, e, n].map((y) => y / 255), a = Math.max(i, r, o), c = Math.min(i, r, o), h = (a + c) / 2, l = a === c, u = a - c, f = l ? 0 : h > 0.5 ? u / (2 - a - c) : u / (a + c), m = l ? 0 : a === i ? ((r - o) / u + (r < o ? 6 : 0)) / 6 : a === r ? ((o - i) / u + 2) / 6 : a === o ? ((i - r) / u + 4) / 6 : 0;
|
|
1031
1036
|
return new M(360 * m, 100 * f, 100 * h, "hsl");
|
|
1032
1037
|
}
|
|
1033
1038
|
init(t = 0, e = 0, n = 0, i = 0, r = "rgb") {
|
|
@@ -1043,10 +1048,10 @@ class M {
|
|
|
1043
1048
|
Object.assign(this, u);
|
|
1044
1049
|
} else if (typeof t == "string")
|
|
1045
1050
|
if (vs.test(t)) {
|
|
1046
|
-
const u = t.replace(Mr, ""), [f, m, d] = Nr.exec(u).slice(1, 4).map((
|
|
1051
|
+
const u = t.replace(Mr, ""), [f, m, d] = Nr.exec(u).slice(1, 4).map((y) => parseInt(y));
|
|
1047
1052
|
Object.assign(this, { _a: f, _b: m, _c: d, _d: 0, space: "rgb" });
|
|
1048
1053
|
} else if (bs.test(t)) {
|
|
1049
|
-
const u = (
|
|
1054
|
+
const u = (y) => parseInt(y, 16), [, f, m, d] = Ir.exec(Gr(t)).map(u);
|
|
1050
1055
|
Object.assign(this, { _a: f, _b: m, _c: d, _d: 0, space: "rgb" });
|
|
1051
1056
|
} else throw Error("Unsupported string format, can't construct Color");
|
|
1052
1057
|
const { _a: o, _b: a, _c: c, _d: h } = this, l = this.space === "rgb" ? { r: o, g: a, b: c } : this.space === "xyz" ? { x: o, y: a, z: c } : this.space === "hsl" ? { h: o, s: a, l: c } : this.space === "lab" ? { l: o, a, b: c } : this.space === "lch" ? { l: o, c: a, h: c } : this.space === "cmyk" ? { c: o, m: a, y: c, k: h } : {};
|
|
@@ -1070,13 +1075,13 @@ class M {
|
|
|
1070
1075
|
if (Jr(this.space)) {
|
|
1071
1076
|
let { x: t, y: e, z: n } = this;
|
|
1072
1077
|
if (this.space === "lab" || this.space === "lch") {
|
|
1073
|
-
let { l: m, a: d, b:
|
|
1078
|
+
let { l: m, a: d, b: y } = this;
|
|
1074
1079
|
if (this.space === "lch") {
|
|
1075
1080
|
const { c: rt, h: dt } = this, Lt = Math.PI / 180;
|
|
1076
|
-
d = rt * Math.cos(Lt * dt),
|
|
1081
|
+
d = rt * Math.cos(Lt * dt), y = rt * Math.sin(Lt * dt);
|
|
1077
1082
|
}
|
|
1078
|
-
const _ = (m + 16) / 116, x = d / 500 + _,
|
|
1079
|
-
t = 0.95047 * (x ** 3 >
|
|
1083
|
+
const _ = (m + 16) / 116, x = d / 500 + _, T = _ - y / 200, R = 16 / 116, F = 8856e-6, K = 7.787;
|
|
1084
|
+
t = 0.95047 * (x ** 3 > F ? x ** 3 : (x - R) / K), e = 1 * (_ ** 3 > F ? _ ** 3 : (_ - R) / K), n = 1.08883 * (T ** 3 > F ? T ** 3 : (T - R) / K);
|
|
1080
1085
|
}
|
|
1081
1086
|
const i = t * 3.2406 + e * -1.5372 + n * -0.4986, r = t * -0.9689 + e * 1.8758 + n * 0.0415, o = t * 0.0557 + e * -0.204 + n * 1.057, a = Math.pow, c = 31308e-7, h = i > c ? 1.055 * a(i, 1 / 2.4) - 0.055 : 12.92 * i, l = r > c ? 1.055 * a(r, 1 / 2.4) - 0.055 : 12.92 * r, u = o > c ? 1.055 * a(o, 1 / 2.4) - 0.055 : 12.92 * o;
|
|
1082
1087
|
return new M(255 * h, 255 * l, 255 * u);
|
|
@@ -1084,7 +1089,7 @@ class M {
|
|
|
1084
1089
|
let { h: t, s: e, l: n } = this;
|
|
1085
1090
|
if (t /= 360, e /= 100, n /= 100, e === 0)
|
|
1086
1091
|
return n *= 255, new M(n, n, n);
|
|
1087
|
-
const i = n < 0.5 ? n * (1 + e) : n + e - n * e, r = 2 * n - i, o = 255 *
|
|
1092
|
+
const i = n < 0.5 ? n * (1 + e) : n + e - n * e, r = 2 * n - i, o = 255 * fn(r, i, t + 1 / 3), a = 255 * fn(r, i, t), c = 255 * fn(r, i, t - 1 / 3);
|
|
1088
1093
|
return new M(o, a, c);
|
|
1089
1094
|
} else if (this.space === "cmyk") {
|
|
1090
1095
|
const { c: t, m: e, y: n, k: i } = this, r = 255 * (1 - Math.min(1, t * (1 - i) + i)), o = 255 * (1 - Math.min(1, e * (1 - i) + i)), a = 255 * (1 - Math.min(1, n * (1 - i) + i));
|
|
@@ -1108,8 +1113,8 @@ class M {
|
|
|
1108
1113
|
return this.toHex();
|
|
1109
1114
|
}
|
|
1110
1115
|
xyz() {
|
|
1111
|
-
const { _a: t, _b: e, _c: n } = this.rgb(), [i, r, o] = [t, e, n].map((x) => x / 255), a = i > 0.04045 ? Math.pow((i + 0.055) / 1.055, 2.4) : i / 12.92, c = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92, h = o > 0.04045 ? Math.pow((o + 0.055) / 1.055, 2.4) : o / 12.92, l = (a * 0.4124 + c * 0.3576 + h * 0.1805) / 0.95047, u = (a * 0.2126 + c * 0.7152 + h * 0.0722) / 1, f = (a * 0.0193 + c * 0.1192 + h * 0.9505) / 1.08883, m = l > 8856e-6 ? Math.pow(l, 1 / 3) : 7.787 * l + 16 / 116, d = u > 8856e-6 ? Math.pow(u, 1 / 3) : 7.787 * u + 16 / 116,
|
|
1112
|
-
return new M(m, d,
|
|
1116
|
+
const { _a: t, _b: e, _c: n } = this.rgb(), [i, r, o] = [t, e, n].map((x) => x / 255), a = i > 0.04045 ? Math.pow((i + 0.055) / 1.055, 2.4) : i / 12.92, c = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92, h = o > 0.04045 ? Math.pow((o + 0.055) / 1.055, 2.4) : o / 12.92, l = (a * 0.4124 + c * 0.3576 + h * 0.1805) / 0.95047, u = (a * 0.2126 + c * 0.7152 + h * 0.0722) / 1, f = (a * 0.0193 + c * 0.1192 + h * 0.9505) / 1.08883, m = l > 8856e-6 ? Math.pow(l, 1 / 3) : 7.787 * l + 16 / 116, d = u > 8856e-6 ? Math.pow(u, 1 / 3) : 7.787 * u + 16 / 116, y = f > 8856e-6 ? Math.pow(f, 1 / 3) : 7.787 * f + 16 / 116;
|
|
1117
|
+
return new M(m, d, y, "xyz");
|
|
1113
1118
|
}
|
|
1114
1119
|
/*
|
|
1115
1120
|
Input and Output methods
|
|
@@ -1151,7 +1156,7 @@ class W {
|
|
|
1151
1156
|
function Vr(s, t) {
|
|
1152
1157
|
return new W(s, t).transformO(this.screenCTM().inverseO());
|
|
1153
1158
|
}
|
|
1154
|
-
function
|
|
1159
|
+
function Ut(s, t, e) {
|
|
1155
1160
|
return Math.abs(t - s) < 1e-6;
|
|
1156
1161
|
}
|
|
1157
1162
|
class S {
|
|
@@ -1165,13 +1170,13 @@ class S {
|
|
|
1165
1170
|
), f = u.x, m = u.y, d = new W(
|
|
1166
1171
|
t.position || t.px || t.positionX || NaN,
|
|
1167
1172
|
t.py || t.positionY || NaN
|
|
1168
|
-
),
|
|
1173
|
+
), y = d.x, _ = d.y, x = new W(
|
|
1169
1174
|
t.translate || t.tx || t.translateX,
|
|
1170
1175
|
t.ty || t.translateY
|
|
1171
|
-
),
|
|
1176
|
+
), T = x.x, R = x.y, F = new W(
|
|
1172
1177
|
t.relative || t.rx || t.relativeX,
|
|
1173
1178
|
t.ry || t.relativeY
|
|
1174
|
-
), K =
|
|
1179
|
+
), K = F.x, rt = F.y;
|
|
1175
1180
|
return {
|
|
1176
1181
|
scaleX: a,
|
|
1177
1182
|
scaleY: c,
|
|
@@ -1181,11 +1186,11 @@ class S {
|
|
|
1181
1186
|
theta: l,
|
|
1182
1187
|
rx: K,
|
|
1183
1188
|
ry: rt,
|
|
1184
|
-
tx:
|
|
1189
|
+
tx: T,
|
|
1185
1190
|
ty: R,
|
|
1186
1191
|
ox: f,
|
|
1187
1192
|
oy: m,
|
|
1188
|
-
px:
|
|
1193
|
+
px: y,
|
|
1189
1194
|
py: _
|
|
1190
1195
|
};
|
|
1191
1196
|
}
|
|
@@ -1214,14 +1219,14 @@ class S {
|
|
|
1214
1219
|
}
|
|
1215
1220
|
// Decomposes this matrix into its affine parameters
|
|
1216
1221
|
decompose(t = 0, e = 0) {
|
|
1217
|
-
const n = this.a, i = this.b, r = this.c, o = this.d, a = this.e, c = this.f, h = n * o - i * r, l = h > 0 ? 1 : -1, u = l * Math.sqrt(n * n + i * i), f = Math.atan2(l * i, l * n), m = 180 / Math.PI * f, d = Math.cos(f),
|
|
1222
|
+
const n = this.a, i = this.b, r = this.c, o = this.d, a = this.e, c = this.f, h = n * o - i * r, l = h > 0 ? 1 : -1, u = l * Math.sqrt(n * n + i * i), f = Math.atan2(l * i, l * n), m = 180 / Math.PI * f, d = Math.cos(f), y = Math.sin(f), _ = (n * r + i * o) / h, x = r * u / (_ * n - i) || o * u / (_ * i + n), T = a - t + t * d * u + e * (_ * d * u - y * x), R = c - e + t * y * u + e * (_ * y * u + d * x);
|
|
1218
1223
|
return {
|
|
1219
1224
|
// Return the affine parameters
|
|
1220
1225
|
scaleX: u,
|
|
1221
1226
|
scaleY: x,
|
|
1222
1227
|
shear: _,
|
|
1223
1228
|
rotate: m,
|
|
1224
|
-
translateX:
|
|
1229
|
+
translateX: T,
|
|
1225
1230
|
translateY: R,
|
|
1226
1231
|
originX: t,
|
|
1227
1232
|
originY: e,
|
|
@@ -1238,7 +1243,7 @@ class S {
|
|
|
1238
1243
|
equals(t) {
|
|
1239
1244
|
if (t === this) return !0;
|
|
1240
1245
|
const e = new S(t);
|
|
1241
|
-
return
|
|
1246
|
+
return Ut(this.a, e.a) && Ut(this.b, e.b) && Ut(this.c, e.c) && Ut(this.d, e.d) && Ut(this.e, e.e) && Ut(this.f, e.f);
|
|
1242
1247
|
}
|
|
1243
1248
|
// Flip matrix on x or y, at a given offset
|
|
1244
1249
|
flip(t, e) {
|
|
@@ -1282,7 +1287,7 @@ class S {
|
|
|
1282
1287
|
return this.clone().rotateO(t, e, n);
|
|
1283
1288
|
}
|
|
1284
1289
|
rotateO(t, e = 0, n = 0) {
|
|
1285
|
-
t =
|
|
1290
|
+
t = hn(t);
|
|
1286
1291
|
const i = Math.cos(t), r = Math.sin(t), { a: o, b: a, c, d: h, e: l, f: u } = this;
|
|
1287
1292
|
return this.a = o * i - a * r, this.b = a * i + o * r, this.c = c * i - h * r, this.d = h * i + c * r, this.e = l * i - u * r + n * r - e * i + e, this.f = u * i + l * r - e * r - n * i + n, this;
|
|
1288
1293
|
}
|
|
@@ -1309,7 +1314,7 @@ class S {
|
|
|
1309
1314
|
return this.clone().skewO(...arguments);
|
|
1310
1315
|
}
|
|
1311
1316
|
skewO(t, e = t, n = 0, i = 0) {
|
|
1312
|
-
arguments.length === 3 && (i = n, n = e, e = t), t =
|
|
1317
|
+
arguments.length === 3 && (i = n, n = e, e = t), t = hn(t), e = hn(e);
|
|
1313
1318
|
const r = Math.tan(t), o = Math.tan(e), { a, b: c, c: h, d: l, e: u, f } = this;
|
|
1314
1319
|
return this.a = a + c * r, this.b = c + a * o, this.c = h + l * r, this.d = l + h * o, this.e = u + f * r - i * r, this.f = f + u * o - n * o, this;
|
|
1315
1320
|
}
|
|
@@ -1481,7 +1486,7 @@ function io(s, t) {
|
|
|
1481
1486
|
const e = this.bbox();
|
|
1482
1487
|
return s > e.x && t > e.y && s < e.x + e.width && t < e.y + e.height;
|
|
1483
1488
|
}
|
|
1484
|
-
|
|
1489
|
+
O({
|
|
1485
1490
|
viewbox: {
|
|
1486
1491
|
viewbox(s, t, e, n) {
|
|
1487
1492
|
return s == null ? new L(this.attr("viewBox")) : this.attr("viewBox", new L(s, t, e, n));
|
|
@@ -1527,7 +1532,7 @@ Wt.extend = function(s) {
|
|
|
1527
1532
|
};
|
|
1528
1533
|
function ce(s, t) {
|
|
1529
1534
|
return new Wt(
|
|
1530
|
-
|
|
1535
|
+
Fn((t || N.document).querySelectorAll(s), function(e) {
|
|
1531
1536
|
return st(e);
|
|
1532
1537
|
})
|
|
1533
1538
|
);
|
|
@@ -1551,7 +1556,7 @@ function ho(s) {
|
|
|
1551
1556
|
let t = s.getEventHolder();
|
|
1552
1557
|
t === N.window && (t = ei), t.events && (t.events = {});
|
|
1553
1558
|
}
|
|
1554
|
-
function
|
|
1559
|
+
function Sn(s, t, e, n, i) {
|
|
1555
1560
|
const r = e.bind(n || s), o = Y(s), a = ni(o), c = Xn(o);
|
|
1556
1561
|
t = Array.isArray(t) ? t : t.split(_t), e._svgjsListenerId || (e._svgjsListenerId = ++co), t.forEach(function(h) {
|
|
1557
1562
|
const l = h.split(".")[0], u = h.split(".")[1] || "*";
|
|
@@ -1600,7 +1605,7 @@ function lo(s, t, e, n) {
|
|
|
1600
1605
|
...n
|
|
1601
1606
|
})), i.dispatchEvent(t), t;
|
|
1602
1607
|
}
|
|
1603
|
-
class
|
|
1608
|
+
class Ae extends Zn {
|
|
1604
1609
|
addEventListener() {
|
|
1605
1610
|
}
|
|
1606
1611
|
dispatch(t, e, n) {
|
|
@@ -1631,12 +1636,12 @@ class ve extends Zn {
|
|
|
1631
1636
|
}
|
|
1632
1637
|
// Bind given event to listener
|
|
1633
1638
|
on(t, e, n, i) {
|
|
1634
|
-
return
|
|
1639
|
+
return Sn(this, t, e, n, i), this;
|
|
1635
1640
|
}
|
|
1636
1641
|
removeEventListener() {
|
|
1637
1642
|
}
|
|
1638
1643
|
}
|
|
1639
|
-
D(
|
|
1644
|
+
D(Ae, "EventTarget");
|
|
1640
1645
|
function xs() {
|
|
1641
1646
|
}
|
|
1642
1647
|
const fe = {
|
|
@@ -1774,7 +1779,7 @@ function mo(s, t, e) {
|
|
|
1774
1779
|
}
|
|
1775
1780
|
return this;
|
|
1776
1781
|
}
|
|
1777
|
-
class At extends
|
|
1782
|
+
class At extends Ae {
|
|
1778
1783
|
constructor(t, e) {
|
|
1779
1784
|
super(), this.node = t, this.type = t.nodeName, e && t !== e && this.attr(e);
|
|
1780
1785
|
}
|
|
@@ -1789,7 +1794,7 @@ class At extends ve {
|
|
|
1789
1794
|
// Returns all child elements
|
|
1790
1795
|
children() {
|
|
1791
1796
|
return new Wt(
|
|
1792
|
-
|
|
1797
|
+
Fn(this.node.children, function(t) {
|
|
1793
1798
|
return st(t);
|
|
1794
1799
|
})
|
|
1795
1800
|
);
|
|
@@ -1815,7 +1820,7 @@ class At extends ve {
|
|
|
1815
1820
|
return this;
|
|
1816
1821
|
}
|
|
1817
1822
|
element(t, e) {
|
|
1818
|
-
return this.put(new At(
|
|
1823
|
+
return this.put(new At(ge(t), e));
|
|
1819
1824
|
}
|
|
1820
1825
|
// Get first child
|
|
1821
1826
|
first() {
|
|
@@ -1934,7 +1939,7 @@ class At extends ve {
|
|
|
1934
1939
|
return e ? a.node.outerHTML : a.node.innerHTML;
|
|
1935
1940
|
}
|
|
1936
1941
|
e = e ?? !1;
|
|
1937
|
-
const i =
|
|
1942
|
+
const i = ge("wrapper", n), r = N.document.createDocumentFragment();
|
|
1938
1943
|
i.innerHTML = t;
|
|
1939
1944
|
for (let a = i.children.length; a--; )
|
|
1940
1945
|
r.appendChild(i.firstElementChild);
|
|
@@ -2075,9 +2080,9 @@ const le = {
|
|
|
2075
2080
|
for (e = le[s].length - 1; e >= 0; e--)
|
|
2076
2081
|
n[le[s][e]] != null && this.attr(le.prefix(s, le[s][e]), n[le[s][e]]);
|
|
2077
2082
|
return this;
|
|
2078
|
-
},
|
|
2083
|
+
}, O(["Element", "Runner"], t);
|
|
2079
2084
|
});
|
|
2080
|
-
|
|
2085
|
+
O(["Element", "Runner"], {
|
|
2081
2086
|
// Let the user set the matrix directly
|
|
2082
2087
|
matrix: function(s, t, e, n, i, r) {
|
|
2083
2088
|
return s == null ? new S(this) : this.attr("transform", new S(s, t, e, n, i, r));
|
|
@@ -2114,13 +2119,13 @@ T(["Element", "Runner"], {
|
|
|
2114
2119
|
return this.attr("opacity", s);
|
|
2115
2120
|
}
|
|
2116
2121
|
});
|
|
2117
|
-
|
|
2122
|
+
O("radius", {
|
|
2118
2123
|
// Add x and y radius
|
|
2119
2124
|
radius: function(s, t = s) {
|
|
2120
2125
|
return (this._element || this).type === "radialGradient" ? this.attr("r", new E(s)) : this.rx(s).ry(t);
|
|
2121
2126
|
}
|
|
2122
2127
|
});
|
|
2123
|
-
|
|
2128
|
+
O("Path", {
|
|
2124
2129
|
// Get path length
|
|
2125
2130
|
length: function() {
|
|
2126
2131
|
return this.node.getTotalLength();
|
|
@@ -2130,7 +2135,7 @@ T("Path", {
|
|
|
2130
2135
|
return new W(this.node.getPointAtLength(s));
|
|
2131
2136
|
}
|
|
2132
2137
|
});
|
|
2133
|
-
|
|
2138
|
+
O(["Element", "Runner"], {
|
|
2134
2139
|
// Set font
|
|
2135
2140
|
font: function(s, t) {
|
|
2136
2141
|
if (typeof s == "object") {
|
|
@@ -2168,7 +2173,7 @@ const go = [
|
|
|
2168
2173
|
};
|
|
2169
2174
|
return s[t] = e, s;
|
|
2170
2175
|
}, {});
|
|
2171
|
-
|
|
2176
|
+
O("Element", go);
|
|
2172
2177
|
function yo() {
|
|
2173
2178
|
return this.attr("transform", null);
|
|
2174
2179
|
}
|
|
@@ -2187,7 +2192,7 @@ function wo() {
|
|
|
2187
2192
|
}
|
|
2188
2193
|
function _o(s, t) {
|
|
2189
2194
|
if (this === s) return this;
|
|
2190
|
-
if (
|
|
2195
|
+
if (An(this.node)) return this.addTo(s, t);
|
|
2191
2196
|
const e = this.screenCTM(), n = s.screenCTM().inverse();
|
|
2192
2197
|
return this.addTo(s, t).untransform().transform(n.multiply(e)), this;
|
|
2193
2198
|
}
|
|
@@ -2199,11 +2204,11 @@ function vo(s, t) {
|
|
|
2199
2204
|
const i = new S(this).decompose();
|
|
2200
2205
|
return s == null ? i : i[s];
|
|
2201
2206
|
}
|
|
2202
|
-
S.isMatrixLike(s) || (s = { ...s, origin:
|
|
2207
|
+
S.isMatrixLike(s) || (s = { ...s, origin: vn(s, this) });
|
|
2203
2208
|
const e = t === !0 ? this : t || !1, n = new S(e).transform(s);
|
|
2204
2209
|
return this.attr("transform", n);
|
|
2205
2210
|
}
|
|
2206
|
-
|
|
2211
|
+
O("Element", {
|
|
2207
2212
|
untransform: yo,
|
|
2208
2213
|
matrixify: wo,
|
|
2209
2214
|
toParent: _o,
|
|
@@ -2274,7 +2279,7 @@ const Ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2274
2279
|
x: ii,
|
|
2275
2280
|
y: ri
|
|
2276
2281
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2277
|
-
class
|
|
2282
|
+
class Qe extends et {
|
|
2278
2283
|
constructor(t, e = t) {
|
|
2279
2284
|
super($("ellipse", t), e);
|
|
2280
2285
|
}
|
|
@@ -2285,14 +2290,14 @@ class Ve extends et {
|
|
|
2285
2290
|
);
|
|
2286
2291
|
}
|
|
2287
2292
|
}
|
|
2288
|
-
I(
|
|
2289
|
-
|
|
2293
|
+
I(Qe, Ao);
|
|
2294
|
+
O("Container", {
|
|
2290
2295
|
// Create an ellipse
|
|
2291
2296
|
ellipse: H(function(s = 0, t = s) {
|
|
2292
|
-
return this.put(new
|
|
2297
|
+
return this.put(new Qe()).size(s, t).move(0, 0);
|
|
2293
2298
|
})
|
|
2294
2299
|
});
|
|
2295
|
-
D(
|
|
2300
|
+
D(Qe, "Ellipse");
|
|
2296
2301
|
class li extends At {
|
|
2297
2302
|
constructor(t = N.document.createDocumentFragment()) {
|
|
2298
2303
|
super(t);
|
|
@@ -2300,7 +2305,7 @@ class li extends At {
|
|
|
2300
2305
|
// Import / Export raw xml
|
|
2301
2306
|
xml(t, e, n) {
|
|
2302
2307
|
if (typeof t == "boolean" && (n = e, e = t, t = null), t == null || typeof t == "function") {
|
|
2303
|
-
const i = new At(
|
|
2308
|
+
const i = new At(ge("wrapper", n));
|
|
2304
2309
|
return i.add(this.node.cloneNode(!0)), i.xml(!1, n);
|
|
2305
2310
|
}
|
|
2306
2311
|
return super.xml(t, !1, n);
|
|
@@ -2318,7 +2323,7 @@ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2318
2323
|
from: ui,
|
|
2319
2324
|
to: fi
|
|
2320
2325
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2321
|
-
class
|
|
2326
|
+
class Se extends J {
|
|
2322
2327
|
constructor(t, e) {
|
|
2323
2328
|
super(
|
|
2324
2329
|
$(t + "Gradient", typeof t == "string" ? null : t),
|
|
@@ -2348,8 +2353,8 @@ class Ae extends J {
|
|
|
2348
2353
|
return "url(#" + this.id() + ")";
|
|
2349
2354
|
}
|
|
2350
2355
|
}
|
|
2351
|
-
I(
|
|
2352
|
-
|
|
2356
|
+
I(Se, So);
|
|
2357
|
+
O({
|
|
2353
2358
|
Container: {
|
|
2354
2359
|
// Create gradient element in defs
|
|
2355
2360
|
gradient(...s) {
|
|
@@ -2359,12 +2364,12 @@ T({
|
|
|
2359
2364
|
// define gradient
|
|
2360
2365
|
Defs: {
|
|
2361
2366
|
gradient: H(function(s, t) {
|
|
2362
|
-
return this.put(new
|
|
2367
|
+
return this.put(new Se(s)).update(t);
|
|
2363
2368
|
})
|
|
2364
2369
|
}
|
|
2365
2370
|
});
|
|
2366
|
-
D(
|
|
2367
|
-
class
|
|
2371
|
+
D(Se, "Gradient");
|
|
2372
|
+
class ye extends J {
|
|
2368
2373
|
// Initialize node
|
|
2369
2374
|
constructor(t, e = t) {
|
|
2370
2375
|
super($("pattern", t), e);
|
|
@@ -2392,7 +2397,7 @@ class ge extends J {
|
|
|
2392
2397
|
return "url(#" + this.id() + ")";
|
|
2393
2398
|
}
|
|
2394
2399
|
}
|
|
2395
|
-
|
|
2400
|
+
O({
|
|
2396
2401
|
Container: {
|
|
2397
2402
|
// Create pattern element in defs
|
|
2398
2403
|
pattern(...s) {
|
|
@@ -2401,7 +2406,7 @@ T({
|
|
|
2401
2406
|
},
|
|
2402
2407
|
Defs: {
|
|
2403
2408
|
pattern: H(function(s, t, e) {
|
|
2404
|
-
return this.put(new
|
|
2409
|
+
return this.put(new ye()).update(e).attr({
|
|
2405
2410
|
x: 0,
|
|
2406
2411
|
y: 0,
|
|
2407
2412
|
width: s,
|
|
@@ -2411,8 +2416,8 @@ T({
|
|
|
2411
2416
|
})
|
|
2412
2417
|
}
|
|
2413
2418
|
});
|
|
2414
|
-
D(
|
|
2415
|
-
class
|
|
2419
|
+
D(ye, "Pattern");
|
|
2420
|
+
class xe extends et {
|
|
2416
2421
|
constructor(t, e = t) {
|
|
2417
2422
|
super($("image", t), e);
|
|
2418
2423
|
}
|
|
@@ -2420,33 +2425,33 @@ class Se extends et {
|
|
|
2420
2425
|
load(t, e) {
|
|
2421
2426
|
if (!t) return this;
|
|
2422
2427
|
const n = new N.window.Image();
|
|
2423
|
-
return
|
|
2428
|
+
return Sn(
|
|
2424
2429
|
n,
|
|
2425
2430
|
"load",
|
|
2426
2431
|
function(i) {
|
|
2427
|
-
const r = this.parent(
|
|
2428
|
-
this.width() === 0 && this.height() === 0 && this.size(n.width, n.height), r instanceof
|
|
2432
|
+
const r = this.parent(ye);
|
|
2433
|
+
this.width() === 0 && this.height() === 0 && this.size(n.width, n.height), r instanceof ye && r.width() === 0 && r.height() === 0 && r.size(this.width(), this.height()), typeof e == "function" && e.call(this, i);
|
|
2429
2434
|
},
|
|
2430
2435
|
this
|
|
2431
|
-
),
|
|
2436
|
+
), Sn(n, "load error", function() {
|
|
2432
2437
|
Zt(n);
|
|
2433
|
-
}), this.attr("href", n.src = t,
|
|
2438
|
+
}), this.attr("href", n.src = t, ve);
|
|
2434
2439
|
}
|
|
2435
2440
|
}
|
|
2436
2441
|
po(function(s, t, e) {
|
|
2437
|
-
return (s === "fill" || s === "stroke") && Rr.test(t) && (t = e.root().defs().image(t)), t instanceof
|
|
2442
|
+
return (s === "fill" || s === "stroke") && Rr.test(t) && (t = e.root().defs().image(t)), t instanceof xe && (t = e.root().defs().pattern(0, 0, (n) => {
|
|
2438
2443
|
n.add(t);
|
|
2439
2444
|
})), t;
|
|
2440
2445
|
});
|
|
2441
|
-
|
|
2446
|
+
O({
|
|
2442
2447
|
Container: {
|
|
2443
2448
|
// create image element, load image and set its size
|
|
2444
2449
|
image: H(function(s, t) {
|
|
2445
|
-
return this.put(new
|
|
2450
|
+
return this.put(new xe()).size(0, 0).load(s, t);
|
|
2446
2451
|
})
|
|
2447
2452
|
}
|
|
2448
2453
|
});
|
|
2449
|
-
D(
|
|
2454
|
+
D(xe, "Image");
|
|
2450
2455
|
class St extends Jt {
|
|
2451
2456
|
// Get bounding box of points
|
|
2452
2457
|
bbox() {
|
|
@@ -2512,26 +2517,26 @@ const xo = St;
|
|
|
2512
2517
|
function Eo(s) {
|
|
2513
2518
|
return s == null ? this.bbox().x : this.move(s, this.bbox().y);
|
|
2514
2519
|
}
|
|
2515
|
-
function
|
|
2520
|
+
function To(s) {
|
|
2516
2521
|
return s == null ? this.bbox().y : this.move(this.bbox().x, s);
|
|
2517
2522
|
}
|
|
2518
|
-
function
|
|
2523
|
+
function Oo(s) {
|
|
2519
2524
|
const t = this.bbox();
|
|
2520
2525
|
return s == null ? t.width : this.size(s, t.height);
|
|
2521
2526
|
}
|
|
2522
|
-
function
|
|
2527
|
+
function ko(s) {
|
|
2523
2528
|
const t = this.bbox();
|
|
2524
2529
|
return s == null ? t.height : this.size(t.width, s);
|
|
2525
2530
|
}
|
|
2526
2531
|
const ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2527
2532
|
__proto__: null,
|
|
2528
2533
|
MorphArray: xo,
|
|
2529
|
-
height:
|
|
2530
|
-
width:
|
|
2534
|
+
height: ko,
|
|
2535
|
+
width: Oo,
|
|
2531
2536
|
x: Eo,
|
|
2532
|
-
y:
|
|
2537
|
+
y: To
|
|
2533
2538
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2534
|
-
class
|
|
2539
|
+
class we extends et {
|
|
2535
2540
|
// Initialize node
|
|
2536
2541
|
constructor(t, e = t) {
|
|
2537
2542
|
super($("line", t), e);
|
|
@@ -2557,20 +2562,20 @@ class ye extends et {
|
|
|
2557
2562
|
return this.attr(this.array().size(n.width, n.height).toLine());
|
|
2558
2563
|
}
|
|
2559
2564
|
}
|
|
2560
|
-
I(
|
|
2561
|
-
|
|
2565
|
+
I(we, ts);
|
|
2566
|
+
O({
|
|
2562
2567
|
Container: {
|
|
2563
2568
|
// Create a line element
|
|
2564
2569
|
line: H(function(...s) {
|
|
2565
|
-
return
|
|
2566
|
-
this.put(new
|
|
2570
|
+
return we.prototype.plot.apply(
|
|
2571
|
+
this.put(new we()),
|
|
2567
2572
|
s[0] != null ? s : [0, 0, 0, 0]
|
|
2568
2573
|
);
|
|
2569
2574
|
})
|
|
2570
2575
|
}
|
|
2571
2576
|
});
|
|
2572
|
-
D(
|
|
2573
|
-
class
|
|
2577
|
+
D(we, "Line");
|
|
2578
|
+
class je extends J {
|
|
2574
2579
|
// Initialize node
|
|
2575
2580
|
constructor(t, e = t) {
|
|
2576
2581
|
super($("marker", t), e);
|
|
@@ -2599,7 +2604,7 @@ class Pe extends J {
|
|
|
2599
2604
|
return this.attr("markerWidth", t);
|
|
2600
2605
|
}
|
|
2601
2606
|
}
|
|
2602
|
-
|
|
2607
|
+
O({
|
|
2603
2608
|
Container: {
|
|
2604
2609
|
marker(...s) {
|
|
2605
2610
|
return this.defs().marker(...s);
|
|
@@ -2608,18 +2613,18 @@ T({
|
|
|
2608
2613
|
Defs: {
|
|
2609
2614
|
// Create marker
|
|
2610
2615
|
marker: H(function(s, t, e) {
|
|
2611
|
-
return this.put(new
|
|
2616
|
+
return this.put(new je()).size(s, t).ref(s / 2, t / 2).viewbox(0, 0, s, t).attr("orient", "auto").update(e);
|
|
2612
2617
|
})
|
|
2613
2618
|
},
|
|
2614
2619
|
marker: {
|
|
2615
2620
|
// Create and attach markers
|
|
2616
2621
|
marker(s, t, e, n) {
|
|
2617
2622
|
let i = ["marker"];
|
|
2618
|
-
return s !== "all" && i.push(s), i = i.join("-"), s = arguments[1] instanceof
|
|
2623
|
+
return s !== "all" && i.push(s), i = i.join("-"), s = arguments[1] instanceof je ? arguments[1] : this.defs().marker(t, e, n), this.attr(i, s);
|
|
2619
2624
|
}
|
|
2620
2625
|
}
|
|
2621
2626
|
});
|
|
2622
|
-
D(
|
|
2627
|
+
D(je, "Marker");
|
|
2623
2628
|
function Gt(s, t) {
|
|
2624
2629
|
return function(e) {
|
|
2625
2630
|
return e == null ? this[s] : (this[s] = e, t && t.call(this), this);
|
|
@@ -2659,7 +2664,7 @@ class es {
|
|
|
2659
2664
|
return !1;
|
|
2660
2665
|
}
|
|
2661
2666
|
}
|
|
2662
|
-
class
|
|
2667
|
+
class xn extends es {
|
|
2663
2668
|
constructor(t = fe.ease) {
|
|
2664
2669
|
super(), this.ease = Io[t] || t;
|
|
2665
2670
|
}
|
|
@@ -2667,7 +2672,7 @@ class Sn extends es {
|
|
|
2667
2672
|
return typeof t != "number" ? n < 1 ? t : e : t + (e - t) * this.ease(n);
|
|
2668
2673
|
}
|
|
2669
2674
|
}
|
|
2670
|
-
let
|
|
2675
|
+
let ze = class extends es {
|
|
2671
2676
|
constructor(t) {
|
|
2672
2677
|
super(), this.stepper = t;
|
|
2673
2678
|
}
|
|
@@ -2682,7 +2687,7 @@ function Es() {
|
|
|
2682
2687
|
const s = (this._duration || 500) / 1e3, t = this._overshoot || 0, e = 1e-10, n = Math.PI, i = Math.log(t / 100 + e), r = -i / Math.sqrt(n * n + i * i), o = 3.9 / (r * s);
|
|
2683
2688
|
this.d = 2 * r * o, this.k = o * o;
|
|
2684
2689
|
}
|
|
2685
|
-
class No extends
|
|
2690
|
+
class No extends ze {
|
|
2686
2691
|
constructor(t = 500, e = 0) {
|
|
2687
2692
|
super(), this.duration(t).overshoot(e);
|
|
2688
2693
|
}
|
|
@@ -2699,7 +2704,7 @@ I(No, {
|
|
|
2699
2704
|
duration: Gt("_duration", Es),
|
|
2700
2705
|
overshoot: Gt("_overshoot", Es)
|
|
2701
2706
|
});
|
|
2702
|
-
class Do extends
|
|
2707
|
+
class Do extends ze {
|
|
2703
2708
|
constructor(t = 0.1, e = 0.01, n = 0, i = 1e3) {
|
|
2704
2709
|
super(), this.p(t).i(e).d(n).windup(i);
|
|
2705
2710
|
}
|
|
@@ -2730,7 +2735,7 @@ const Co = {
|
|
|
2730
2735
|
T: 2,
|
|
2731
2736
|
A: 7,
|
|
2732
2737
|
Z: 0
|
|
2733
|
-
},
|
|
2738
|
+
}, En = {
|
|
2734
2739
|
M: function(s, t, e) {
|
|
2735
2740
|
return t.x = e.x = s[0], t.y = e.y = s[1], ["M", t.x, t.y];
|
|
2736
2741
|
},
|
|
@@ -2761,9 +2766,9 @@ const Co = {
|
|
|
2761
2766
|
A: function(s, t) {
|
|
2762
2767
|
return t.x = s[5], t.y = s[6], ["A", s[0], s[1], s[2], s[3], s[4], s[5], s[6]];
|
|
2763
2768
|
}
|
|
2764
|
-
},
|
|
2765
|
-
for (let s = 0, t =
|
|
2766
|
-
|
|
2769
|
+
}, dn = "mlhvqtcsaz".split("");
|
|
2770
|
+
for (let s = 0, t = dn.length; s < t; ++s)
|
|
2771
|
+
En[dn[s]] = /* @__PURE__ */ function(e) {
|
|
2767
2772
|
return function(n, i, r) {
|
|
2768
2773
|
if (e === "H") n[0] = n[0] + i.x;
|
|
2769
2774
|
else if (e === "V") n[0] = n[0] + i.y;
|
|
@@ -2772,18 +2777,18 @@ for (let s = 0, t = fn.length; s < t; ++s)
|
|
|
2772
2777
|
else
|
|
2773
2778
|
for (let o = 0, a = n.length; o < a; ++o)
|
|
2774
2779
|
n[o] = n[o] + (o % 2 ? i.y : i.x);
|
|
2775
|
-
return
|
|
2780
|
+
return En[e](n, i, r);
|
|
2776
2781
|
};
|
|
2777
|
-
}(
|
|
2782
|
+
}(dn[s].toUpperCase());
|
|
2778
2783
|
function Mo(s) {
|
|
2779
2784
|
const t = s.segment[0];
|
|
2780
|
-
return
|
|
2785
|
+
return En[t](s.segment.slice(1), s.p, s.p0);
|
|
2781
2786
|
}
|
|
2782
|
-
function
|
|
2787
|
+
function Tn(s) {
|
|
2783
2788
|
return s.segment.length && s.segment.length - 1 === Co[s.segment[0].toUpperCase()];
|
|
2784
2789
|
}
|
|
2785
2790
|
function Ro(s, t) {
|
|
2786
|
-
s.inNumber &&
|
|
2791
|
+
s.inNumber && kt(s, !1);
|
|
2787
2792
|
const e = Yn.test(t);
|
|
2788
2793
|
if (e)
|
|
2789
2794
|
s.segment = [t];
|
|
@@ -2793,11 +2798,11 @@ function Ro(s, t) {
|
|
|
2793
2798
|
}
|
|
2794
2799
|
return s.inSegment = !0, s.lastCommand = s.segment[0], e;
|
|
2795
2800
|
}
|
|
2796
|
-
function
|
|
2801
|
+
function kt(s, t) {
|
|
2797
2802
|
if (!s.inNumber) throw new Error("Parser Error");
|
|
2798
|
-
s.number && s.segment.push(parseFloat(s.number)), s.inNumber = t, s.number = "", s.pointSeen = !1, s.hasExponent = !1,
|
|
2803
|
+
s.number && s.segment.push(parseFloat(s.number)), s.inNumber = t, s.number = "", s.pointSeen = !1, s.hasExponent = !1, Tn(s) && On(s);
|
|
2799
2804
|
}
|
|
2800
|
-
function
|
|
2805
|
+
function On(s) {
|
|
2801
2806
|
s.inSegment = !1, s.absolute && (s.segment = Mo(s)), s.segments.push(s.segment);
|
|
2802
2807
|
}
|
|
2803
2808
|
function Ho(s) {
|
|
@@ -2829,7 +2834,7 @@ function Bo(s, t = !0) {
|
|
|
2829
2834
|
if (!(!i.inSegment && Ro(i, n))) {
|
|
2830
2835
|
if (n === ".") {
|
|
2831
2836
|
if (i.pointSeen || i.hasExponent) {
|
|
2832
|
-
|
|
2837
|
+
kt(i, !1), --e;
|
|
2833
2838
|
continue;
|
|
2834
2839
|
}
|
|
2835
2840
|
i.inNumber = !0, i.pointSeen = !0, i.number += n;
|
|
@@ -2837,19 +2842,19 @@ function Bo(s, t = !0) {
|
|
|
2837
2842
|
}
|
|
2838
2843
|
if (!isNaN(parseInt(n))) {
|
|
2839
2844
|
if (i.number === "0" || Ho(i)) {
|
|
2840
|
-
i.inNumber = !0, i.number = n,
|
|
2845
|
+
i.inNumber = !0, i.number = n, kt(i, !0);
|
|
2841
2846
|
continue;
|
|
2842
2847
|
}
|
|
2843
2848
|
i.inNumber = !0, i.number += n;
|
|
2844
2849
|
continue;
|
|
2845
2850
|
}
|
|
2846
2851
|
if (Wo.has(n)) {
|
|
2847
|
-
i.inNumber &&
|
|
2852
|
+
i.inNumber && kt(i, !1);
|
|
2848
2853
|
continue;
|
|
2849
2854
|
}
|
|
2850
2855
|
if (n === "-" || n === "+") {
|
|
2851
2856
|
if (i.inNumber && !$o(i)) {
|
|
2852
|
-
|
|
2857
|
+
kt(i, !1), --e;
|
|
2853
2858
|
continue;
|
|
2854
2859
|
}
|
|
2855
2860
|
i.number += n, i.inNumber = !0;
|
|
@@ -2861,15 +2866,15 @@ function Bo(s, t = !0) {
|
|
|
2861
2866
|
}
|
|
2862
2867
|
if (Yn.test(n)) {
|
|
2863
2868
|
if (i.inNumber)
|
|
2864
|
-
|
|
2865
|
-
else if (
|
|
2866
|
-
|
|
2869
|
+
kt(i, !1);
|
|
2870
|
+
else if (Tn(i))
|
|
2871
|
+
On(i);
|
|
2867
2872
|
else
|
|
2868
2873
|
throw new Error("parser Error");
|
|
2869
2874
|
--e;
|
|
2870
2875
|
}
|
|
2871
2876
|
}
|
|
2872
|
-
return i.inNumber &&
|
|
2877
|
+
return i.inNumber && kt(i, !1), i.inSegment && Tn(i) && On(i), i.segments;
|
|
2873
2878
|
}
|
|
2874
2879
|
function Po(s) {
|
|
2875
2880
|
let t = "";
|
|
@@ -2909,11 +2914,11 @@ class Bt extends Jt {
|
|
|
2909
2914
|
}
|
|
2910
2915
|
const di = (s) => {
|
|
2911
2916
|
const t = typeof s;
|
|
2912
|
-
return t === "number" ? E : t === "string" ? M.isColor(s) ? M : _t.test(s) ? Yn.test(s) ? Bt : Jt : Vs.test(s) ? E :
|
|
2917
|
+
return t === "number" ? E : t === "string" ? M.isColor(s) ? M : _t.test(s) ? Yn.test(s) ? Bt : Jt : Vs.test(s) ? E : kn : ns.indexOf(s.constructor) > -1 ? s.constructor : Array.isArray(s) ? Jt : t === "object" ? _e : kn;
|
|
2913
2918
|
};
|
|
2914
2919
|
class It {
|
|
2915
2920
|
constructor(t) {
|
|
2916
|
-
this._stepper = t || new
|
|
2921
|
+
this._stepper = t || new xn("-"), this._from = null, this._to = null, this._type = null, this._context = null, this._morphObj = null;
|
|
2917
2922
|
}
|
|
2918
2923
|
at(t) {
|
|
2919
2924
|
return this._morphObj.morph(
|
|
@@ -2944,12 +2949,12 @@ class It {
|
|
|
2944
2949
|
_set(t) {
|
|
2945
2950
|
this._type || this.type(di(t));
|
|
2946
2951
|
let e = new this._type(t);
|
|
2947
|
-
return this._type === M && (e = this._to ? e[this._to[4]]() : this._from ? e[this._from[4]]() : e), this._type ===
|
|
2952
|
+
return this._type === M && (e = this._to ? e[this._to[4]]() : this._from ? e[this._from[4]]() : e), this._type === _e && (e = this._to ? e.align(this._to) : this._from ? e.align(this._from) : e), e = e.toConsumable(), this._morphObj = this._morphObj || new this._type(), this._context = this._context || Array.apply(null, Array(e.length)).map(Object).map(function(n) {
|
|
2948
2953
|
return n.done = !0, n;
|
|
2949
2954
|
}), e;
|
|
2950
2955
|
}
|
|
2951
2956
|
}
|
|
2952
|
-
class
|
|
2957
|
+
class kn {
|
|
2953
2958
|
constructor(...t) {
|
|
2954
2959
|
this.init(...t);
|
|
2955
2960
|
}
|
|
@@ -2963,7 +2968,7 @@ class Tn {
|
|
|
2963
2968
|
return this.value;
|
|
2964
2969
|
}
|
|
2965
2970
|
}
|
|
2966
|
-
class
|
|
2971
|
+
class Ee {
|
|
2967
2972
|
constructor(...t) {
|
|
2968
2973
|
this.init(...t);
|
|
2969
2974
|
}
|
|
@@ -2977,7 +2982,7 @@ class xe {
|
|
|
2977
2982
|
translateY: t[5],
|
|
2978
2983
|
originX: t[6],
|
|
2979
2984
|
originY: t[7]
|
|
2980
|
-
}), Object.assign(this,
|
|
2985
|
+
}), Object.assign(this, Ee.defaults, t), this;
|
|
2981
2986
|
}
|
|
2982
2987
|
toArray() {
|
|
2983
2988
|
const t = this;
|
|
@@ -2993,7 +2998,7 @@ class xe {
|
|
|
2993
2998
|
];
|
|
2994
2999
|
}
|
|
2995
3000
|
}
|
|
2996
|
-
|
|
3001
|
+
Ee.defaults = {
|
|
2997
3002
|
scaleX: 1,
|
|
2998
3003
|
scaleY: 1,
|
|
2999
3004
|
shear: 0,
|
|
@@ -3004,7 +3009,7 @@ xe.defaults = {
|
|
|
3004
3009
|
originY: 0
|
|
3005
3010
|
};
|
|
3006
3011
|
const jo = (s, t) => s[0] < t[0] ? -1 : s[0] > t[0] ? 1 : 0;
|
|
3007
|
-
class
|
|
3012
|
+
class _e {
|
|
3008
3013
|
constructor(...t) {
|
|
3009
3014
|
this.init(...t);
|
|
3010
3015
|
}
|
|
@@ -3058,7 +3063,7 @@ class we {
|
|
|
3058
3063
|
return t;
|
|
3059
3064
|
}
|
|
3060
3065
|
}
|
|
3061
|
-
const ns = [
|
|
3066
|
+
const ns = [kn, Ee, _e];
|
|
3062
3067
|
function zo(s = []) {
|
|
3063
3068
|
ns.push(...[].concat(s));
|
|
3064
3069
|
}
|
|
@@ -3128,7 +3133,7 @@ class he extends et {
|
|
|
3128
3133
|
}
|
|
3129
3134
|
}
|
|
3130
3135
|
he.prototype.MorphArray = Bt;
|
|
3131
|
-
|
|
3136
|
+
O({
|
|
3132
3137
|
Container: {
|
|
3133
3138
|
// Create a wrapped path element
|
|
3134
3139
|
path: H(function(s) {
|
|
@@ -3140,10 +3145,10 @@ D(he, "Path");
|
|
|
3140
3145
|
function Ko() {
|
|
3141
3146
|
return this._array || (this._array = new St(this.attr("points")));
|
|
3142
3147
|
}
|
|
3143
|
-
function
|
|
3148
|
+
function Uo() {
|
|
3144
3149
|
return delete this._array, this;
|
|
3145
3150
|
}
|
|
3146
|
-
function
|
|
3151
|
+
function Fo(s, t) {
|
|
3147
3152
|
return this.attr("points", this.array().move(s, t));
|
|
3148
3153
|
}
|
|
3149
3154
|
function qo(s) {
|
|
@@ -3159,62 +3164,62 @@ function Zo(s, t) {
|
|
|
3159
3164
|
const pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3160
3165
|
__proto__: null,
|
|
3161
3166
|
array: Ko,
|
|
3162
|
-
clear:
|
|
3163
|
-
move:
|
|
3167
|
+
clear: Uo,
|
|
3168
|
+
move: Fo,
|
|
3164
3169
|
plot: qo,
|
|
3165
3170
|
size: Zo
|
|
3166
3171
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3167
|
-
class
|
|
3172
|
+
class Te extends et {
|
|
3168
3173
|
// Initialize node
|
|
3169
3174
|
constructor(t, e = t) {
|
|
3170
3175
|
super($("polygon", t), e);
|
|
3171
3176
|
}
|
|
3172
3177
|
}
|
|
3173
|
-
|
|
3178
|
+
O({
|
|
3174
3179
|
Container: {
|
|
3175
3180
|
// Create a wrapped polygon element
|
|
3176
3181
|
polygon: H(function(s) {
|
|
3177
|
-
return this.put(new
|
|
3182
|
+
return this.put(new Te()).plot(s || new St());
|
|
3178
3183
|
})
|
|
3179
3184
|
}
|
|
3180
3185
|
});
|
|
3181
|
-
I(
|
|
3182
|
-
I(
|
|
3183
|
-
D(
|
|
3184
|
-
class
|
|
3186
|
+
I(Te, ts);
|
|
3187
|
+
I(Te, pi);
|
|
3188
|
+
D(Te, "Polygon");
|
|
3189
|
+
class Oe extends et {
|
|
3185
3190
|
// Initialize node
|
|
3186
3191
|
constructor(t, e = t) {
|
|
3187
3192
|
super($("polyline", t), e);
|
|
3188
3193
|
}
|
|
3189
3194
|
}
|
|
3190
|
-
|
|
3195
|
+
O({
|
|
3191
3196
|
Container: {
|
|
3192
3197
|
// Create a wrapped polygon element
|
|
3193
3198
|
polyline: H(function(s) {
|
|
3194
|
-
return this.put(new
|
|
3199
|
+
return this.put(new Oe()).plot(s || new St());
|
|
3195
3200
|
})
|
|
3196
3201
|
}
|
|
3197
3202
|
});
|
|
3198
|
-
I(
|
|
3199
|
-
I(
|
|
3200
|
-
D(
|
|
3201
|
-
class
|
|
3203
|
+
I(Oe, ts);
|
|
3204
|
+
I(Oe, pi);
|
|
3205
|
+
D(Oe, "Polyline");
|
|
3206
|
+
class ke extends et {
|
|
3202
3207
|
// Initialize node
|
|
3203
3208
|
constructor(t, e = t) {
|
|
3204
3209
|
super($("rect", t), e);
|
|
3205
3210
|
}
|
|
3206
3211
|
}
|
|
3207
|
-
I(
|
|
3208
|
-
|
|
3212
|
+
I(ke, { rx: Vn, ry: Qn });
|
|
3213
|
+
O({
|
|
3209
3214
|
Container: {
|
|
3210
3215
|
// Create a rect element
|
|
3211
3216
|
rect: H(function(s, t) {
|
|
3212
|
-
return this.put(new
|
|
3217
|
+
return this.put(new ke()).size(s, t);
|
|
3213
3218
|
})
|
|
3214
3219
|
}
|
|
3215
3220
|
});
|
|
3216
|
-
D(
|
|
3217
|
-
class
|
|
3221
|
+
D(ke, "Rect");
|
|
3222
|
+
class pn {
|
|
3218
3223
|
constructor() {
|
|
3219
3224
|
this._first = null, this._last = null;
|
|
3220
3225
|
}
|
|
@@ -3241,9 +3246,9 @@ class dn {
|
|
|
3241
3246
|
}
|
|
3242
3247
|
const C = {
|
|
3243
3248
|
nextDraw: null,
|
|
3244
|
-
frames: new
|
|
3245
|
-
timeouts: new
|
|
3246
|
-
immediates: new
|
|
3249
|
+
frames: new pn(),
|
|
3250
|
+
timeouts: new pn(),
|
|
3251
|
+
immediates: new pn(),
|
|
3247
3252
|
timer: () => N.window.performance || N.window.Date,
|
|
3248
3253
|
transforms: [],
|
|
3249
3254
|
frame(s) {
|
|
@@ -3294,7 +3299,7 @@ const C = {
|
|
|
3294
3299
|
const s = N.window;
|
|
3295
3300
|
return (s.performance || s.Date).now();
|
|
3296
3301
|
};
|
|
3297
|
-
class mi extends
|
|
3302
|
+
class mi extends Ae {
|
|
3298
3303
|
// Construct a new timeline on the given element
|
|
3299
3304
|
constructor(t = Yo) {
|
|
3300
3305
|
super(), this._timeSource = t, this.terminate();
|
|
@@ -3419,16 +3424,16 @@ class mi extends ve {
|
|
|
3419
3424
|
this._startTime = 0, this._speed = 1, this._persist = 0, this._nextFrame = null, this._paused = !0, this._runners = [], this._runnerIds = [], this._lastRunnerId = -1, this._time = 0, this._lastSourceTime = 0, this._lastStepTime = 0, this._step = this._stepFn.bind(this, !1), this._stepImmediate = this._stepFn.bind(this, !0);
|
|
3420
3425
|
}
|
|
3421
3426
|
}
|
|
3422
|
-
|
|
3427
|
+
O({
|
|
3423
3428
|
Element: {
|
|
3424
3429
|
timeline: function(s) {
|
|
3425
3430
|
return s == null ? (this._timeline = this._timeline || new mi(), this._timeline) : (this._timeline = s, this);
|
|
3426
3431
|
}
|
|
3427
3432
|
}
|
|
3428
3433
|
});
|
|
3429
|
-
class tt extends
|
|
3434
|
+
class tt extends Ae {
|
|
3430
3435
|
constructor(t) {
|
|
3431
|
-
super(), this.id = tt.id++, t = t ?? fe.duration, t = typeof t == "function" ? new
|
|
3436
|
+
super(), this.id = tt.id++, t = t ?? fe.duration, t = typeof t == "function" ? new ze(t) : t, this._element = null, this._timeline = null, this.done = !1, this._queue = [], this._duration = typeof t == "number" && t, this._isDeclarative = t instanceof ze, this._stepper = this._isDeclarative ? t : new xn(), this._history = {}, this.enabled = !0, this._time = 0, this._lastTime = 0, this._reseted = !0, this.transforms = new S(), this.transformId = 1, this._haveReversed = !1, this._reverse = !1, this._loopsDone = 0, this._swing = !1, this._wait = 0, this._times = 1, this._frameId = null, this._persist = this._isDeclarative ? !0 : null;
|
|
3432
3437
|
}
|
|
3433
3438
|
static sanitise(t, e, n) {
|
|
3434
3439
|
let i = 1, r = !1, o = 0;
|
|
@@ -3476,7 +3481,7 @@ class tt extends ve {
|
|
|
3476
3481
|
return this.queue(null, t);
|
|
3477
3482
|
}
|
|
3478
3483
|
ease(t) {
|
|
3479
|
-
return this._stepper = new
|
|
3484
|
+
return this._stepper = new xn(t), this;
|
|
3480
3485
|
}
|
|
3481
3486
|
/*
|
|
3482
3487
|
Runner Definitions
|
|
@@ -3510,7 +3515,7 @@ class tt extends ve {
|
|
|
3510
3515
|
let c;
|
|
3511
3516
|
if (t == null) {
|
|
3512
3517
|
const f = function(d) {
|
|
3513
|
-
const
|
|
3518
|
+
const y = o * Math.floor(d % (2 * (i + n)) / (i + n)), _ = y && !a || !y && a, x = Math.pow(-1, _) * (d % (i + n)) / n + _;
|
|
3514
3519
|
return Math.max(Math.min(x, 1), 0);
|
|
3515
3520
|
}, m = r * (i + n) - i;
|
|
3516
3521
|
return c = e <= 0 ? Math.round(f(1e-5)) : e < m ? f(e) : Math.round(f(m - 1e-5)), c;
|
|
@@ -3620,16 +3625,16 @@ class tt extends ve {
|
|
|
3620
3625
|
}
|
|
3621
3626
|
}
|
|
3622
3627
|
tt.id = 0;
|
|
3623
|
-
class
|
|
3628
|
+
class Le {
|
|
3624
3629
|
constructor(t = new S(), e = -1, n = !0) {
|
|
3625
3630
|
this.transforms = t, this.id = e, this.done = n;
|
|
3626
3631
|
}
|
|
3627
3632
|
clearTransformsFromQueue() {
|
|
3628
3633
|
}
|
|
3629
3634
|
}
|
|
3630
|
-
I([tt,
|
|
3635
|
+
I([tt, Le], {
|
|
3631
3636
|
mergeWith(s) {
|
|
3632
|
-
return new
|
|
3637
|
+
return new Le(
|
|
3633
3638
|
s.transforms.lmultiply(this.transforms),
|
|
3634
3639
|
s.id
|
|
3635
3640
|
);
|
|
@@ -3651,7 +3656,7 @@ class Jo {
|
|
|
3651
3656
|
}
|
|
3652
3657
|
clearBefore(t) {
|
|
3653
3658
|
const e = this.ids.indexOf(t + 1) || 1;
|
|
3654
|
-
return this.ids.splice(0, e, 0), this.runners.splice(0, e, new
|
|
3659
|
+
return this.ids.splice(0, e, 0), this.runners.splice(0, e, new Le()).forEach((n) => n.clearTransformsFromQueue()), this;
|
|
3655
3660
|
}
|
|
3656
3661
|
edit(t, e) {
|
|
3657
3662
|
const n = this.ids.indexOf(t + 1);
|
|
@@ -3682,7 +3687,7 @@ class Jo {
|
|
|
3682
3687
|
return this.ids.splice(e, 1), this.runners.splice(e, 1), this;
|
|
3683
3688
|
}
|
|
3684
3689
|
}
|
|
3685
|
-
|
|
3690
|
+
O({
|
|
3686
3691
|
Element: {
|
|
3687
3692
|
animate(s, t, e) {
|
|
3688
3693
|
const n = tt.sanitise(s, t, e), i = this.timeline();
|
|
@@ -3706,7 +3711,7 @@ T({
|
|
|
3706
3711
|
},
|
|
3707
3712
|
_prepareRunner() {
|
|
3708
3713
|
this._frameId == null && (this._transformationRunners = new Jo().add(
|
|
3709
|
-
new
|
|
3714
|
+
new Le(new S(this))
|
|
3710
3715
|
));
|
|
3711
3716
|
}
|
|
3712
3717
|
}
|
|
@@ -3736,10 +3741,10 @@ I(tt, {
|
|
|
3736
3741
|
function(o) {
|
|
3737
3742
|
const a = Object.keys(o), c = Vo(a, r);
|
|
3738
3743
|
if (c.length) {
|
|
3739
|
-
const l = this.element()[s](c), u = new
|
|
3744
|
+
const l = this.element()[s](c), u = new _e(i.from()).valueOf();
|
|
3740
3745
|
Object.assign(u, l), i.from(u);
|
|
3741
3746
|
}
|
|
3742
|
-
const h = new
|
|
3747
|
+
const h = new _e(i.to()).valueOf();
|
|
3743
3748
|
Object.assign(h, o), i.to(h), r = a, n = o;
|
|
3744
3749
|
}
|
|
3745
3750
|
), this._rememberMorpher(s, i), this;
|
|
@@ -3780,29 +3785,29 @@ I(tt, {
|
|
|
3780
3785
|
const n = S.isMatrixLike(s);
|
|
3781
3786
|
e = s.affine != null ? s.affine : e ?? !n;
|
|
3782
3787
|
const i = new It(this._stepper).type(
|
|
3783
|
-
e ?
|
|
3788
|
+
e ? Ee : S
|
|
3784
3789
|
);
|
|
3785
3790
|
let r, o, a, c, h;
|
|
3786
3791
|
function l() {
|
|
3787
|
-
o = o || this.element(), r = r ||
|
|
3792
|
+
o = o || this.element(), r = r || vn(s, o), h = new S(t ? void 0 : o), o._addRunner(this), t || o._clearTransformRunnersBefore(this);
|
|
3788
3793
|
}
|
|
3789
3794
|
function u(m) {
|
|
3790
3795
|
t || this.clearTransform();
|
|
3791
|
-
const { x: d, y
|
|
3796
|
+
const { x: d, y } = new W(r).transform(
|
|
3792
3797
|
o._currentTransform(this)
|
|
3793
3798
|
);
|
|
3794
|
-
let _ = new S({ ...s, origin: [d,
|
|
3799
|
+
let _ = new S({ ...s, origin: [d, y] }), x = this._isDeclarative && a ? a : h;
|
|
3795
3800
|
if (e) {
|
|
3796
|
-
_ = _.decompose(d,
|
|
3797
|
-
const R = _.rotate,
|
|
3801
|
+
_ = _.decompose(d, y), x = x.decompose(d, y);
|
|
3802
|
+
const R = _.rotate, F = x.rotate, K = [R - 360, R, R + 360], rt = K.map((cn) => Math.abs(cn - F)), dt = Math.min(...rt), Lt = rt.indexOf(dt);
|
|
3798
3803
|
_.rotate = K[Lt];
|
|
3799
3804
|
}
|
|
3800
3805
|
t && (n || (_.rotate = s.rotate || 0), this._isDeclarative && c && (x.rotate = c)), i.from(x), i.to(_);
|
|
3801
|
-
const
|
|
3802
|
-
return c =
|
|
3806
|
+
const T = i.at(m);
|
|
3807
|
+
return c = T.rotate, a = new S(T), this.addTransform(a), o._addRunner(this), i.done();
|
|
3803
3808
|
}
|
|
3804
3809
|
function f(m) {
|
|
3805
|
-
(m.origin || "center").toString() !== (s.origin || "center").toString() && (r =
|
|
3810
|
+
(m.origin || "center").toString() !== (s.origin || "center").toString() && (r = vn(m, o)), s = { ...m, origin: r };
|
|
3806
3811
|
}
|
|
3807
3812
|
return this.queue(l, u, f, !0), this._isDeclarative && this._rememberMorpher("transform", i), this;
|
|
3808
3813
|
},
|
|
@@ -3940,12 +3945,12 @@ class ss extends J {
|
|
|
3940
3945
|
namespace() {
|
|
3941
3946
|
return this.isRoot() ? this.attr({ xmlns: qn, version: "1.1" }).attr(
|
|
3942
3947
|
"xmlns:xlink",
|
|
3943
|
-
|
|
3944
|
-
|
|
3948
|
+
ve,
|
|
3949
|
+
ln
|
|
3945
3950
|
) : this.root().namespace();
|
|
3946
3951
|
}
|
|
3947
3952
|
removeNamespace() {
|
|
3948
|
-
return this.attr({ xmlns: null, version: null }).attr("xmlns:xlink", null,
|
|
3953
|
+
return this.attr({ xmlns: null, version: null }).attr("xmlns:xlink", null, ln).attr("xmlns:svgjs", null, ln);
|
|
3949
3954
|
}
|
|
3950
3955
|
// Check if this is a root svg
|
|
3951
3956
|
// If not, call root() from this element
|
|
@@ -3953,7 +3958,7 @@ class ss extends J {
|
|
|
3953
3958
|
return this.isRoot() ? this : super.root();
|
|
3954
3959
|
}
|
|
3955
3960
|
}
|
|
3956
|
-
|
|
3961
|
+
O({
|
|
3957
3962
|
Container: {
|
|
3958
3963
|
// Create nested svg document
|
|
3959
3964
|
nested: H(function() {
|
|
@@ -3962,20 +3967,20 @@ T({
|
|
|
3962
3967
|
}
|
|
3963
3968
|
});
|
|
3964
3969
|
D(ss, "Svg", !0);
|
|
3965
|
-
let
|
|
3970
|
+
let tn = class extends J {
|
|
3966
3971
|
// Initialize node
|
|
3967
3972
|
constructor(t, e = t) {
|
|
3968
3973
|
super($("symbol", t), e);
|
|
3969
3974
|
}
|
|
3970
3975
|
};
|
|
3971
|
-
|
|
3976
|
+
O({
|
|
3972
3977
|
Container: {
|
|
3973
3978
|
symbol: H(function() {
|
|
3974
|
-
return this.put(new
|
|
3979
|
+
return this.put(new tn());
|
|
3975
3980
|
})
|
|
3976
3981
|
}
|
|
3977
3982
|
});
|
|
3978
|
-
D(
|
|
3983
|
+
D(tn, "Symbol");
|
|
3979
3984
|
function Qo(s) {
|
|
3980
3985
|
return this._build === !1 && this.clear(), this.node.appendChild(N.document.createTextNode(s)), this;
|
|
3981
3986
|
}
|
|
@@ -4027,7 +4032,7 @@ const wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4027
4032
|
x: ea,
|
|
4028
4033
|
y: na
|
|
4029
4034
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4030
|
-
class
|
|
4035
|
+
class U extends et {
|
|
4031
4036
|
// Initialize node
|
|
4032
4037
|
constructor(t, e = t) {
|
|
4033
4038
|
super($("text", t), e), this.dom.leading = this.dom.leading ?? new E(1.3), this._rebuild = !0, this._build = !1;
|
|
@@ -4043,7 +4048,7 @@ class F extends et {
|
|
|
4043
4048
|
let n = 0;
|
|
4044
4049
|
const i = this.dom.leading;
|
|
4045
4050
|
this.each(function(r) {
|
|
4046
|
-
if (
|
|
4051
|
+
if (An(this.node)) return;
|
|
4047
4052
|
const o = N.window.getComputedStyle(this.node).getPropertyValue("font-size"), a = i * new E(o);
|
|
4048
4053
|
this.dom.newLined && (this.attr("x", e.attr("x")), this.text() === `
|
|
4049
4054
|
` ? n += a : (this.attr("dy", r ? a + n : 0), n = 0));
|
|
@@ -4065,7 +4070,7 @@ class F extends et {
|
|
|
4065
4070
|
let n = 0;
|
|
4066
4071
|
t = "";
|
|
4067
4072
|
for (let i = 0, r = e.length; i < r; ++i) {
|
|
4068
|
-
if (e[i].nodeName === "textPath" ||
|
|
4073
|
+
if (e[i].nodeName === "textPath" || An(e[i])) {
|
|
4069
4074
|
i === 0 && (n = i + 1);
|
|
4070
4075
|
continue;
|
|
4071
4076
|
}
|
|
@@ -4085,21 +4090,21 @@ class F extends et {
|
|
|
4085
4090
|
return this.build(!1).rebuild();
|
|
4086
4091
|
}
|
|
4087
4092
|
}
|
|
4088
|
-
I(
|
|
4089
|
-
|
|
4093
|
+
I(U, wi);
|
|
4094
|
+
O({
|
|
4090
4095
|
Container: {
|
|
4091
4096
|
// Create text element
|
|
4092
4097
|
text: H(function(s = "") {
|
|
4093
|
-
return this.put(new
|
|
4098
|
+
return this.put(new U()).text(s);
|
|
4094
4099
|
}),
|
|
4095
4100
|
// Create plain text element
|
|
4096
4101
|
plain: H(function(s = "") {
|
|
4097
|
-
return this.put(new
|
|
4102
|
+
return this.put(new U()).plain(s);
|
|
4098
4103
|
})
|
|
4099
4104
|
}
|
|
4100
4105
|
});
|
|
4101
|
-
D(
|
|
4102
|
-
class
|
|
4106
|
+
D(U, "Text");
|
|
4107
|
+
class en extends et {
|
|
4103
4108
|
// Initialize node
|
|
4104
4109
|
constructor(t, e = t) {
|
|
4105
4110
|
super($("tspan", t), e), this._build = !1;
|
|
@@ -4116,7 +4121,7 @@ class tn extends et {
|
|
|
4116
4121
|
newLine() {
|
|
4117
4122
|
this.dom.newLined = !0;
|
|
4118
4123
|
const t = this.parent();
|
|
4119
|
-
if (!(t instanceof
|
|
4124
|
+
if (!(t instanceof U))
|
|
4120
4125
|
return this;
|
|
4121
4126
|
const e = t.index(this), n = N.window.getComputedStyle(this.node).getPropertyValue("font-size"), i = t.dom.leading * new E(n);
|
|
4122
4127
|
return this.dy(e ? i : 0).attr("x", t.x());
|
|
@@ -4127,11 +4132,11 @@ class tn extends et {
|
|
|
4127
4132
|
` : "") : (typeof t == "function" ? (this.clear().build(!0), t.call(this, this), this.build(!1)) : this.plain(t), this);
|
|
4128
4133
|
}
|
|
4129
4134
|
}
|
|
4130
|
-
I(
|
|
4131
|
-
|
|
4135
|
+
I(en, wi);
|
|
4136
|
+
O({
|
|
4132
4137
|
Tspan: {
|
|
4133
4138
|
tspan: H(function(s = "") {
|
|
4134
|
-
const t = new
|
|
4139
|
+
const t = new en();
|
|
4135
4140
|
return this._build || this.clear(), this.put(t).text(s);
|
|
4136
4141
|
})
|
|
4137
4142
|
},
|
|
@@ -4141,7 +4146,7 @@ T({
|
|
|
4141
4146
|
}
|
|
4142
4147
|
}
|
|
4143
4148
|
});
|
|
4144
|
-
D(
|
|
4149
|
+
D(en, "Tspan");
|
|
4145
4150
|
class is extends et {
|
|
4146
4151
|
constructor(t, e = t) {
|
|
4147
4152
|
super($("circle", t), e);
|
|
@@ -4162,7 +4167,7 @@ class is extends et {
|
|
|
4162
4167
|
}
|
|
4163
4168
|
}
|
|
4164
4169
|
I(is, { x: ii, y: ri, cx: oi, cy: ai, width: ci, height: hi });
|
|
4165
|
-
|
|
4170
|
+
O({
|
|
4166
4171
|
Container: {
|
|
4167
4172
|
// Create circle element
|
|
4168
4173
|
circle: H(function(s = 0) {
|
|
@@ -4171,7 +4176,7 @@ T({
|
|
|
4171
4176
|
}
|
|
4172
4177
|
});
|
|
4173
4178
|
D(is, "Circle");
|
|
4174
|
-
class
|
|
4179
|
+
class In extends J {
|
|
4175
4180
|
constructor(t, e = t) {
|
|
4176
4181
|
super($("clipPath", t), e);
|
|
4177
4182
|
}
|
|
@@ -4185,11 +4190,11 @@ class On extends J {
|
|
|
4185
4190
|
return ce("svg [clip-path*=" + this.id() + "]");
|
|
4186
4191
|
}
|
|
4187
4192
|
}
|
|
4188
|
-
|
|
4193
|
+
O({
|
|
4189
4194
|
Container: {
|
|
4190
4195
|
// Create clipping element
|
|
4191
4196
|
clip: H(function() {
|
|
4192
|
-
return this.defs().put(new
|
|
4197
|
+
return this.defs().put(new In());
|
|
4193
4198
|
})
|
|
4194
4199
|
},
|
|
4195
4200
|
Element: {
|
|
@@ -4198,7 +4203,7 @@ T({
|
|
|
4198
4203
|
return this.reference("clip-path");
|
|
4199
4204
|
},
|
|
4200
4205
|
clipWith(s) {
|
|
4201
|
-
const t = s instanceof
|
|
4206
|
+
const t = s instanceof In ? s : this.parent().clip().add(s);
|
|
4202
4207
|
return this.attr("clip-path", "url(#" + t.id() + ")");
|
|
4203
4208
|
},
|
|
4204
4209
|
// Unclip element
|
|
@@ -4207,13 +4212,13 @@ T({
|
|
|
4207
4212
|
}
|
|
4208
4213
|
}
|
|
4209
4214
|
});
|
|
4210
|
-
D(
|
|
4215
|
+
D(In, "ClipPath");
|
|
4211
4216
|
class _i extends ft {
|
|
4212
4217
|
constructor(t, e = t) {
|
|
4213
4218
|
super($("foreignObject", t), e);
|
|
4214
4219
|
}
|
|
4215
4220
|
}
|
|
4216
|
-
|
|
4221
|
+
O({
|
|
4217
4222
|
Container: {
|
|
4218
4223
|
foreignObject: H(function(s, t) {
|
|
4219
4224
|
return this.put(new _i()).size(s, t);
|
|
@@ -4280,7 +4285,7 @@ class B extends J {
|
|
|
4280
4285
|
}
|
|
4281
4286
|
}
|
|
4282
4287
|
I(B, bi);
|
|
4283
|
-
|
|
4288
|
+
O({
|
|
4284
4289
|
Container: {
|
|
4285
4290
|
// Create a group element
|
|
4286
4291
|
group: H(function() {
|
|
@@ -4289,7 +4294,7 @@ T({
|
|
|
4289
4294
|
}
|
|
4290
4295
|
});
|
|
4291
4296
|
D(B, "G");
|
|
4292
|
-
class
|
|
4297
|
+
class Ke extends J {
|
|
4293
4298
|
constructor(t, e = t) {
|
|
4294
4299
|
super($("a", t), e);
|
|
4295
4300
|
}
|
|
@@ -4299,15 +4304,15 @@ class Le extends J {
|
|
|
4299
4304
|
}
|
|
4300
4305
|
// Link url
|
|
4301
4306
|
to(t) {
|
|
4302
|
-
return this.attr("href", t,
|
|
4307
|
+
return this.attr("href", t, ve);
|
|
4303
4308
|
}
|
|
4304
4309
|
}
|
|
4305
|
-
I(
|
|
4306
|
-
|
|
4310
|
+
I(Ke, bi);
|
|
4311
|
+
O({
|
|
4307
4312
|
Container: {
|
|
4308
4313
|
// Create a hyperlink element
|
|
4309
4314
|
link: H(function(s) {
|
|
4310
|
-
return this.put(new
|
|
4315
|
+
return this.put(new Ke()).to(s);
|
|
4311
4316
|
})
|
|
4312
4317
|
},
|
|
4313
4318
|
Element: {
|
|
@@ -4322,7 +4327,7 @@ T({
|
|
|
4322
4327
|
},
|
|
4323
4328
|
linkTo(s) {
|
|
4324
4329
|
let t = this.linker();
|
|
4325
|
-
return t || (t = new
|
|
4330
|
+
return t || (t = new Ke(), this.wrap(t)), typeof s == "function" ? s.call(t, t) : t.to(s), this;
|
|
4326
4331
|
},
|
|
4327
4332
|
linker() {
|
|
4328
4333
|
const s = this.parent();
|
|
@@ -4330,8 +4335,8 @@ T({
|
|
|
4330
4335
|
}
|
|
4331
4336
|
}
|
|
4332
4337
|
});
|
|
4333
|
-
D(
|
|
4334
|
-
class
|
|
4338
|
+
D(Ke, "A");
|
|
4339
|
+
class Nn extends J {
|
|
4335
4340
|
// Initialize node
|
|
4336
4341
|
constructor(t, e = t) {
|
|
4337
4342
|
super($("mask", t), e);
|
|
@@ -4346,10 +4351,10 @@ class In extends J {
|
|
|
4346
4351
|
return ce("svg [mask*=" + this.id() + "]");
|
|
4347
4352
|
}
|
|
4348
4353
|
}
|
|
4349
|
-
|
|
4354
|
+
O({
|
|
4350
4355
|
Container: {
|
|
4351
4356
|
mask: H(function() {
|
|
4352
|
-
return this.defs().put(new
|
|
4357
|
+
return this.defs().put(new Nn());
|
|
4353
4358
|
})
|
|
4354
4359
|
},
|
|
4355
4360
|
Element: {
|
|
@@ -4358,7 +4363,7 @@ T({
|
|
|
4358
4363
|
return this.reference("mask");
|
|
4359
4364
|
},
|
|
4360
4365
|
maskWith(s) {
|
|
4361
|
-
const t = s instanceof
|
|
4366
|
+
const t = s instanceof Nn ? s : this.parent().mask().add(s);
|
|
4362
4367
|
return this.attr("mask", "url(#" + t.id() + ")");
|
|
4363
4368
|
},
|
|
4364
4369
|
// Unmask element
|
|
@@ -4367,7 +4372,7 @@ T({
|
|
|
4367
4372
|
}
|
|
4368
4373
|
}
|
|
4369
4374
|
});
|
|
4370
|
-
D(
|
|
4375
|
+
D(Nn, "Mask");
|
|
4371
4376
|
class vi extends ft {
|
|
4372
4377
|
constructor(t, e = t) {
|
|
4373
4378
|
super($("stop", t), e);
|
|
@@ -4381,7 +4386,7 @@ class vi extends ft {
|
|
|
4381
4386
|
}), t.opacity != null && this.attr("stop-opacity", t.opacity), t.color != null && this.attr("stop-color", t.color), t.offset != null && this.attr("offset", new E(t.offset)), this;
|
|
4382
4387
|
}
|
|
4383
4388
|
}
|
|
4384
|
-
|
|
4389
|
+
O({
|
|
4385
4390
|
Gradient: {
|
|
4386
4391
|
// Add a color stop
|
|
4387
4392
|
stop: function(s, t, e) {
|
|
@@ -4398,7 +4403,7 @@ function ba(s, t) {
|
|
|
4398
4403
|
e += ur(n) + ":" + t[n] + ";";
|
|
4399
4404
|
return e += "}", e;
|
|
4400
4405
|
}
|
|
4401
|
-
class
|
|
4406
|
+
class Dn extends ft {
|
|
4402
4407
|
constructor(t, e = t) {
|
|
4403
4408
|
super($("style", t), e);
|
|
4404
4409
|
}
|
|
@@ -4416,16 +4421,16 @@ class Nn extends ft {
|
|
|
4416
4421
|
return this.addText(ba(t, e));
|
|
4417
4422
|
}
|
|
4418
4423
|
}
|
|
4419
|
-
|
|
4424
|
+
O("Dom", {
|
|
4420
4425
|
style(s, t) {
|
|
4421
|
-
return this.put(new
|
|
4426
|
+
return this.put(new Dn()).rule(s, t);
|
|
4422
4427
|
},
|
|
4423
4428
|
fontface(s, t, e) {
|
|
4424
|
-
return this.put(new
|
|
4429
|
+
return this.put(new Dn()).font(s, t, e);
|
|
4425
4430
|
}
|
|
4426
4431
|
});
|
|
4427
|
-
D(
|
|
4428
|
-
class rs extends
|
|
4432
|
+
D(Dn, "Style");
|
|
4433
|
+
class rs extends U {
|
|
4429
4434
|
// Initialize node
|
|
4430
4435
|
constructor(t, e = t) {
|
|
4431
4436
|
super($("textPath", t), e);
|
|
@@ -4446,17 +4451,17 @@ class rs extends F {
|
|
|
4446
4451
|
return this.reference("href");
|
|
4447
4452
|
}
|
|
4448
4453
|
}
|
|
4449
|
-
|
|
4454
|
+
O({
|
|
4450
4455
|
Container: {
|
|
4451
4456
|
textPath: H(function(s, t) {
|
|
4452
|
-
return s instanceof
|
|
4457
|
+
return s instanceof U || (s = this.text(s)), s.path(t);
|
|
4453
4458
|
})
|
|
4454
4459
|
},
|
|
4455
4460
|
Text: {
|
|
4456
4461
|
// Create path for text to run on
|
|
4457
4462
|
path: H(function(s, t = !0) {
|
|
4458
4463
|
const e = new rs();
|
|
4459
|
-
s instanceof he || (s = this.defs().path(s)), e.attr("href", "#" + s,
|
|
4464
|
+
s instanceof he || (s = this.defs().path(s)), e.attr("href", "#" + s, ve);
|
|
4460
4465
|
let n;
|
|
4461
4466
|
if (t)
|
|
4462
4467
|
for (; n = this.node.firstChild; )
|
|
@@ -4471,7 +4476,7 @@ T({
|
|
|
4471
4476
|
Path: {
|
|
4472
4477
|
// creates a textPath from this path
|
|
4473
4478
|
text: H(function(s) {
|
|
4474
|
-
return s instanceof
|
|
4479
|
+
return s instanceof U || (s = new U().addTo(this.parent()).text(s)), s.path(this);
|
|
4475
4480
|
}),
|
|
4476
4481
|
targets() {
|
|
4477
4482
|
return ce("svg textPath").filter((s) => (s.attr("href") || "").includes(this.id()));
|
|
@@ -4480,37 +4485,37 @@ T({
|
|
|
4480
4485
|
});
|
|
4481
4486
|
rs.prototype.MorphArray = Bt;
|
|
4482
4487
|
D(rs, "TextPath");
|
|
4483
|
-
class
|
|
4488
|
+
class nn extends et {
|
|
4484
4489
|
constructor(t, e = t) {
|
|
4485
4490
|
super($("use", t), e);
|
|
4486
4491
|
}
|
|
4487
4492
|
// Use element as a reference
|
|
4488
4493
|
use(t, e) {
|
|
4489
|
-
return this.attr("href", (e || "") + "#" + t,
|
|
4494
|
+
return this.attr("href", (e || "") + "#" + t, ve);
|
|
4490
4495
|
}
|
|
4491
4496
|
}
|
|
4492
|
-
|
|
4497
|
+
O({
|
|
4493
4498
|
Container: {
|
|
4494
4499
|
// Create a use element
|
|
4495
4500
|
use: H(function(s, t) {
|
|
4496
|
-
return this.put(new
|
|
4501
|
+
return this.put(new nn()).use(s, t);
|
|
4497
4502
|
})
|
|
4498
4503
|
}
|
|
4499
4504
|
});
|
|
4500
|
-
D(
|
|
4501
|
-
I([ss,
|
|
4502
|
-
I([
|
|
4503
|
-
I(
|
|
4505
|
+
D(nn, "Use");
|
|
4506
|
+
I([ss, tn, xe, ye, je], X("viewbox"));
|
|
4507
|
+
I([we, Oe, Te, he], X("marker"));
|
|
4508
|
+
I(U, X("Text"));
|
|
4504
4509
|
I(he, X("Path"));
|
|
4505
4510
|
I(Jn, X("Defs"));
|
|
4506
|
-
I([
|
|
4507
|
-
I([
|
|
4508
|
-
I(
|
|
4511
|
+
I([U, en], X("Tspan"));
|
|
4512
|
+
I([ke, Qe, Se, tt], X("radius"));
|
|
4513
|
+
I(Ae, X("EventTarget"));
|
|
4509
4514
|
I(At, X("Dom"));
|
|
4510
4515
|
I(ft, X("Element"));
|
|
4511
4516
|
I(et, X("Shape"));
|
|
4512
4517
|
I([J, li], X("Container"));
|
|
4513
|
-
I(
|
|
4518
|
+
I(Se, X("Gradient"));
|
|
4514
4519
|
I(tt, X("Runner"));
|
|
4515
4520
|
Wt.extend(hr());
|
|
4516
4521
|
zo([
|
|
@@ -4534,8 +4539,8 @@ const ot = (s, t) => {
|
|
|
4534
4539
|
}, 0);
|
|
4535
4540
|
return { width: s.tiles.reduce((a, c) => a + Q(c, t).width, 0), height: r };
|
|
4536
4541
|
}, Q = (s, t) => {
|
|
4537
|
-
const e = parseFloat((Rt.HEIGHT * t).toPrecision(5)), n = parseFloat((Rt.WIDTH * t).toPrecision(5)), i = s.has(
|
|
4538
|
-
return (s.has(
|
|
4542
|
+
const e = parseFloat((Rt.HEIGHT * t).toPrecision(5)), n = parseFloat((Rt.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 };
|
|
4543
|
+
return (s.has(g.TSUMO) || s.has(g.DORA)) && (i.width += n * Rt.TEXT_SCALE), i;
|
|
4539
4544
|
};
|
|
4540
4545
|
class Vt {
|
|
4541
4546
|
constructor(t = {}) {
|
|
@@ -4554,15 +4559,15 @@ class Vt {
|
|
|
4554
4559
|
}
|
|
4555
4560
|
// image wrapper
|
|
4556
4561
|
image(t) {
|
|
4557
|
-
let e = new
|
|
4558
|
-
return this.svgSprite && (e = new
|
|
4562
|
+
let e = new xe().load(this.buildURL(t));
|
|
4563
|
+
return this.svgSprite && (e = new nn().use(Vt.buildID(t))), t instanceof w && t.has(g.COLOR_GRAYSCALE) && e.css({ filter: "contrast(65%)" }), e;
|
|
4559
4564
|
}
|
|
4560
4565
|
createImage(t, e, n) {
|
|
4561
4566
|
const i = Q(t, this.scale);
|
|
4562
4567
|
return this.image(t).dx(e).dy(n).size(i.baseWidth, i.baseHeight);
|
|
4563
4568
|
}
|
|
4564
4569
|
createTextImage(t, e, n, i) {
|
|
4565
|
-
const r = this.createImage(t, e, n), o = Q(t, this.scale), a = o.baseHeight * 0.2, c = o.baseWidth, h = o.baseHeight, l = new
|
|
4570
|
+
const r = this.createImage(t, e, n), o = Q(t, this.scale), a = o.baseHeight * 0.2, c = o.baseWidth, h = o.baseHeight, l = new U().text(i);
|
|
4566
4571
|
l.size(o.baseWidth, o.baseHeight).font({
|
|
4567
4572
|
family: zs,
|
|
4568
4573
|
size: a
|
|
@@ -4580,7 +4585,7 @@ class Vt {
|
|
|
4580
4585
|
static buildID(t) {
|
|
4581
4586
|
if (t == 100 || t == 1e3)
|
|
4582
4587
|
return t == 100 ? "stick100" : "stick1000";
|
|
4583
|
-
const e = t.t == p.BACK || t.has(
|
|
4588
|
+
const e = t.t == p.BACK || t.has(g.RED) ? 0 : t.n;
|
|
4584
4589
|
return `${t.t}${e}`;
|
|
4585
4590
|
}
|
|
4586
4591
|
buildURL(t) {
|
|
@@ -4597,30 +4602,30 @@ class Ai extends Vt {
|
|
|
4597
4602
|
const n = e instanceof Z ? e.tilesWithBack : e.tiles, i = new B();
|
|
4598
4603
|
let r = 0;
|
|
4599
4604
|
for (let o of n) {
|
|
4600
|
-
const a = Q(o, this.scale), c = o.has(
|
|
4605
|
+
const a = Q(o, this.scale), c = o.has(g.HORIZONTAL) ? this.createRotate90Image.bind(this) : this.createImage.bind(this), h = o.has(g.HORIZONTAL) ? this.getDiffTileHeightWidth(o) : 0, l = c(o, r, h);
|
|
4601
4606
|
i.add(l), r += a.width;
|
|
4602
4607
|
}
|
|
4603
4608
|
return i;
|
|
4604
4609
|
}
|
|
4605
4610
|
createBlockPonChiKan(e) {
|
|
4606
|
-
const n = e.tiles.findIndex((o) => o.has(
|
|
4611
|
+
const n = e.tiles.findIndex((o) => o.has(g.HORIZONTAL));
|
|
4607
4612
|
let i = 0;
|
|
4608
4613
|
const r = new B();
|
|
4609
4614
|
if (e.type == b.SHO_KAN) {
|
|
4610
4615
|
let o = n;
|
|
4611
4616
|
for (let a = 0; a < e.tiles.length; a++)
|
|
4612
|
-
e.tiles[a].has(
|
|
4617
|
+
e.tiles[a].has(g.HORIZONTAL) && (o = a);
|
|
4613
4618
|
for (let a = 0; a < e.tiles.length; a++) {
|
|
4614
4619
|
const c = Q(e.tiles[a], this.scale);
|
|
4615
4620
|
if (a == o) continue;
|
|
4616
4621
|
if (a == n) {
|
|
4617
|
-
const u = e.tiles[n], f = e.tiles[o], m = Q(u, this.scale), d = this.createRotate90Image(u, 0, 0, !0),
|
|
4622
|
+
const u = e.tiles[n], f = e.tiles[o], m = Q(u, this.scale), d = this.createRotate90Image(u, 0, 0, !0), y = this.createRotate90Image(
|
|
4618
4623
|
f,
|
|
4619
4624
|
0,
|
|
4620
4625
|
m.height,
|
|
4621
4626
|
!0
|
|
4622
4627
|
);
|
|
4623
|
-
r.add(new B().translate(i, 0).add(d).add(
|
|
4628
|
+
r.add(new B().translate(i, 0).add(d).add(y)), i += m.width;
|
|
4624
4629
|
continue;
|
|
4625
4630
|
}
|
|
4626
4631
|
const h = c.width * 2 - c.height, l = this.createImage(e.tiles[a], i, h);
|
|
@@ -4649,89 +4654,95 @@ class Ai extends Vt {
|
|
|
4649
4654
|
return r;
|
|
4650
4655
|
}
|
|
4651
4656
|
}
|
|
4652
|
-
const va = (s) => {
|
|
4653
|
-
const
|
|
4657
|
+
const va = (s, t) => {
|
|
4658
|
+
const e = s.scale;
|
|
4654
4659
|
return {
|
|
4655
|
-
[b.CHI]: function(
|
|
4656
|
-
const
|
|
4657
|
-
return { ...
|
|
4660
|
+
[b.CHI]: function(i) {
|
|
4661
|
+
const r = ot(i, e), o = s.createBlockPonChiKan(i);
|
|
4662
|
+
return { ...r, e: o };
|
|
4658
4663
|
},
|
|
4659
|
-
[b.PON]: function(
|
|
4660
|
-
const
|
|
4661
|
-
return { ...
|
|
4664
|
+
[b.PON]: function(i) {
|
|
4665
|
+
const r = ot(i, e), o = s.createBlockPonChiKan(i);
|
|
4666
|
+
return { ...r, e: o };
|
|
4662
4667
|
},
|
|
4663
|
-
[b.DAI_KAN]: function(
|
|
4664
|
-
const
|
|
4665
|
-
return { ...
|
|
4668
|
+
[b.DAI_KAN]: function(i) {
|
|
4669
|
+
const r = ot(i, e), o = s.createBlockPonChiKan(i);
|
|
4670
|
+
return { ...r, e: o };
|
|
4666
4671
|
},
|
|
4667
|
-
[b.SHO_KAN]: function(
|
|
4668
|
-
const
|
|
4669
|
-
return { ...
|
|
4672
|
+
[b.SHO_KAN]: function(i) {
|
|
4673
|
+
const r = ot(i, e), o = s.createBlockPonChiKan(i);
|
|
4674
|
+
return { ...r, e: o };
|
|
4670
4675
|
},
|
|
4671
|
-
[b.AN_KAN]: function(
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
`block type is not ankan: ${
|
|
4676
|
+
[b.AN_KAN]: function(i) {
|
|
4677
|
+
k(
|
|
4678
|
+
i instanceof Z,
|
|
4679
|
+
`block type is not ankan: ${i.type}`
|
|
4675
4680
|
);
|
|
4676
|
-
const
|
|
4677
|
-
return { ...
|
|
4681
|
+
const r = ot(i, e), o = s.createBlockHandDiscard(i);
|
|
4682
|
+
return { ...r, e: o };
|
|
4678
4683
|
},
|
|
4679
|
-
[b.IMAGE_DORA]: function(
|
|
4680
|
-
|
|
4681
|
-
|
|
4684
|
+
[b.IMAGE_DORA]: function(i) {
|
|
4685
|
+
i = (t == null ? void 0 : t.doraText) == !1 ? new me([i.tiles[0].clone({ remove: g.DORA })]) : i;
|
|
4686
|
+
const r = ot(i, e), o = new B(), a = (t == null ? void 0 : t.doraText) === !1 ? s.createBlockHandDiscard(i) : s.createTextImage(i.tiles[0], 0, 0, "(ドラ)");
|
|
4687
|
+
return o.add(a), { ...r, e: o };
|
|
4682
4688
|
},
|
|
4683
|
-
[b.TSUMO]: function(
|
|
4684
|
-
|
|
4685
|
-
|
|
4689
|
+
[b.TSUMO]: function(i) {
|
|
4690
|
+
i = (t == null ? void 0 : t.tsumoText) == !1 ? new me([i.tiles[0].clone({ remove: g.TSUMO })]) : i;
|
|
4691
|
+
const r = ot(i, e), o = new B(), a = (t == null ? void 0 : t.tsumoText) === !1 ? s.createBlockHandDiscard(i) : s.createTextImage(i.tiles[0], 0, 0, "(ツモ)");
|
|
4692
|
+
return o.add(a), { ...r, e: o };
|
|
4686
4693
|
},
|
|
4687
|
-
[b.HAND]: function(
|
|
4688
|
-
const
|
|
4689
|
-
return { ...
|
|
4694
|
+
[b.HAND]: function(i) {
|
|
4695
|
+
const r = ot(i, e), o = s.createBlockHandDiscard(i);
|
|
4696
|
+
return { ...r, e: o };
|
|
4690
4697
|
},
|
|
4691
|
-
[b.IMAGE_DISCARD]: function(
|
|
4692
|
-
const
|
|
4693
|
-
return { ...
|
|
4698
|
+
[b.IMAGE_DISCARD]: function(i) {
|
|
4699
|
+
const r = ot(i, e), o = s.createBlockHandDiscard(i);
|
|
4700
|
+
return { ...r, e: o };
|
|
4694
4701
|
},
|
|
4695
|
-
[b.THREE]: function(
|
|
4702
|
+
[b.THREE]: function(i) {
|
|
4696
4703
|
throw new Error("three is unsupported");
|
|
4697
4704
|
},
|
|
4698
|
-
[b.RUN]: function(
|
|
4705
|
+
[b.RUN]: function(i) {
|
|
4699
4706
|
throw new Error("run is unsupported");
|
|
4700
4707
|
},
|
|
4701
|
-
[b.PAIR]: function(
|
|
4708
|
+
[b.PAIR]: function(i) {
|
|
4702
4709
|
throw new Error("pair is unsupported");
|
|
4703
4710
|
},
|
|
4704
|
-
[b.ISOLATED]: function(
|
|
4711
|
+
[b.ISOLATED]: function(i) {
|
|
4705
4712
|
throw new Error("isolated is unsupported");
|
|
4706
4713
|
},
|
|
4707
|
-
[b.UNKNOWN]: function(
|
|
4708
|
-
if (
|
|
4714
|
+
[b.UNKNOWN]: function(i) {
|
|
4715
|
+
if (i.tiles.some((a) => a.has(g.TSUMO) || a.has(g.DORA)))
|
|
4709
4716
|
throw new Error("found an unknown block with operator tiles");
|
|
4710
|
-
const
|
|
4711
|
-
return { ...
|
|
4717
|
+
const r = ot(i, e), o = s.createBlockHandDiscard(i);
|
|
4718
|
+
return { ...r, e: o };
|
|
4712
4719
|
}
|
|
4713
4720
|
};
|
|
4714
|
-
}, de = (s, t) => {
|
|
4715
|
-
const { maxHeight:
|
|
4716
|
-
(
|
|
4717
|
-
const
|
|
4718
|
-
return { maxHeight:
|
|
4721
|
+
}, de = (s, t, e) => {
|
|
4722
|
+
const { maxHeight: n, sumWidth: i } = t.reduce(
|
|
4723
|
+
(u, f) => {
|
|
4724
|
+
const m = ot(f, s.scale);
|
|
4725
|
+
return { maxHeight: m.height > u.maxHeight ? m.height : u.maxHeight, sumWidth: u.sumWidth + m.width };
|
|
4719
4726
|
},
|
|
4720
4727
|
{ maxHeight: 0, sumWidth: 0 }
|
|
4721
|
-
),
|
|
4722
|
-
for (let
|
|
4723
|
-
const
|
|
4724
|
-
|
|
4725
|
-
}
|
|
4726
|
-
const
|
|
4727
|
-
let
|
|
4728
|
-
for (let
|
|
4729
|
-
const
|
|
4730
|
-
|
|
4731
|
-
}
|
|
4732
|
-
return { e:
|
|
4733
|
-
}, ph = (s, t, e = {}, n = {
|
|
4734
|
-
|
|
4728
|
+
), r = n, o = i + (t.length - 1) * s.blockMargin, a = va(s, e), c = [];
|
|
4729
|
+
for (let u of t) {
|
|
4730
|
+
const f = a[u.type], m = f(u);
|
|
4731
|
+
c.push(m);
|
|
4732
|
+
}
|
|
4733
|
+
const h = new B();
|
|
4734
|
+
let l = 0;
|
|
4735
|
+
for (let u of c) {
|
|
4736
|
+
const f = r - u.height, m = new B().translate(l, f);
|
|
4737
|
+
m.add(u.e), h.add(m), l += u.width + s.blockMargin;
|
|
4738
|
+
}
|
|
4739
|
+
return { e: h, width: o, height: r };
|
|
4740
|
+
}, ph = (s, t, e = {}, n = {
|
|
4741
|
+
responsive: !1,
|
|
4742
|
+
doraText: !0,
|
|
4743
|
+
tsumoText: !0
|
|
4744
|
+
}) => {
|
|
4745
|
+
const i = new Ai(e), r = de(i, t, n);
|
|
4735
4746
|
n.responsive || s.size(r.width, r.height), s.viewbox(0, 0, r.width, r.height), s.add(r.e);
|
|
4736
4747
|
}, Si = () => {
|
|
4737
4748
|
const s = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], t = [];
|
|
@@ -4749,7 +4760,7 @@ const va = (s) => {
|
|
|
4749
4760
|
const t = Si(), e = [];
|
|
4750
4761
|
return s.each((n, i) => {
|
|
4751
4762
|
const r = i[n];
|
|
4752
|
-
if (r instanceof
|
|
4763
|
+
if (r instanceof nn) {
|
|
4753
4764
|
const a = r.attr("href").substring(1);
|
|
4754
4765
|
t.includes(a) && e.push(a);
|
|
4755
4766
|
}
|
|
@@ -4758,7 +4769,7 @@ const va = (s) => {
|
|
|
4758
4769
|
const t = Si(), e = Aa(s);
|
|
4759
4770
|
s.each((n, i) => {
|
|
4760
4771
|
const r = i[n];
|
|
4761
|
-
r instanceof
|
|
4772
|
+
r instanceof tn && (t.includes(r.id()) && e.includes(r.id()) || r.remove());
|
|
4762
4773
|
}, !0);
|
|
4763
4774
|
}, Sa = (s) => {
|
|
4764
4775
|
const e = [];
|
|
@@ -4782,11 +4793,11 @@ const va = (s) => {
|
|
|
4782
4793
|
return o.rotate(n, 0, e).translate(a, c), o;
|
|
4783
4794
|
}
|
|
4784
4795
|
return o;
|
|
4785
|
-
},
|
|
4796
|
+
}, Ne = (s, t) => {
|
|
4786
4797
|
const e = new B(), n = Sa(s);
|
|
4787
4798
|
for (let i = 0; i < n.length; i++) {
|
|
4788
4799
|
let r = n[i], o = i * t.tileHeight;
|
|
4789
|
-
const a = t.createBlockHandDiscard(new
|
|
4800
|
+
const a = t.createBlockHandDiscard(new Us(r, b.IMAGE_DISCARD)).translate(0, o);
|
|
4790
4801
|
e.add(a);
|
|
4791
4802
|
}
|
|
4792
4803
|
return {
|
|
@@ -4797,12 +4808,12 @@ const va = (s) => {
|
|
|
4797
4808
|
}, xa = (s, t, e) => {
|
|
4798
4809
|
const n = t.font, i = t.textWidth, r = t.textHeight, o = new B(), a = e.sticks.dead, c = e.sticks.reach, h = 125 * s.scale, l = 27.5 * s.scale;
|
|
4799
4810
|
let u = i * 3, f = r;
|
|
4800
|
-
const m = (h + s.tileWidth + i - u) / 2, d = new
|
|
4811
|
+
const m = (h + s.tileWidth + i - u) / 2, d = new U().plain(e.round).font(n).move(m, 0);
|
|
4801
4812
|
o.add(d), f += 25 * s.scale;
|
|
4802
|
-
const
|
|
4803
|
-
_.add(
|
|
4804
|
-
const
|
|
4805
|
-
_.add(
|
|
4813
|
+
const y = s.tileHeight, _ = new B().size(h, y).translate(0, f), x = { family: n.family, size: n.size * 0.7 }, T = s.createStick(1e3).size(h, l).move(0, 0), R = new U().plain(c.toString()).font(x).attr({ x: h, y: l });
|
|
4814
|
+
_.add(T), _.add(R);
|
|
4815
|
+
const F = s.createStick(100).size(h, l).move(0, l + l), K = new U().plain(a.toString()).font(x).attr({ x: h, y: l * 3 });
|
|
4816
|
+
_.add(F), _.add(K);
|
|
4806
4817
|
const rt = s.createImage(e.doras[0], 0, 0).move(h + i, 0);
|
|
4807
4818
|
return _.add(rt), o.add(d), o.add(_), {
|
|
4808
4819
|
e: o,
|
|
@@ -4811,7 +4822,7 @@ const va = (s) => {
|
|
|
4811
4822
|
};
|
|
4812
4823
|
}, Ea = (s, t, e = 0) => {
|
|
4813
4824
|
const n = de(s, t.front), i = de(s, t.right), r = de(s, t.opposite), o = de(s, t.left), a = [n.width, i.width, r.width, o.width].reduce(
|
|
4814
|
-
(
|
|
4825
|
+
(y, _) => Math.max(y, _)
|
|
4815
4826
|
), c = Math.max(
|
|
4816
4827
|
e + s.tileHeight * 2 + s.blockMargin * 2,
|
|
4817
4828
|
a + s.tileWidth * 2 + s.blockMargin
|
|
@@ -4829,27 +4840,27 @@ const va = (s) => {
|
|
|
4829
4840
|
(c - o.width) / 2
|
|
4830
4841
|
);
|
|
4831
4842
|
return l.add(u), l.add(f), l.add(m), l.add(d), { e: l, width: c, height: h };
|
|
4832
|
-
},
|
|
4833
|
-
const t = Object.values(
|
|
4843
|
+
}, Ta = (s) => {
|
|
4844
|
+
const t = Object.values(Kn), e = t.indexOf(s);
|
|
4834
4845
|
return [...t.slice(e), ...t.slice(0, e)];
|
|
4835
|
-
},
|
|
4836
|
-
const n = s.tileWidth * 5 + s.tileHeight * 1, i = new B(), r = new
|
|
4846
|
+
}, Oa = (s, t, e) => {
|
|
4847
|
+
const n = s.tileWidth * 5 + s.tileHeight * 1, i = new B(), r = new ke().size(n, n).move(0, 0).fill("none").stroke("#000000");
|
|
4837
4848
|
i.add(r);
|
|
4838
4849
|
const o = t.font, a = t.textWidth, c = t.textHeight, h = t.numWidth, l = xa(s, t, e);
|
|
4839
4850
|
l.e.translate(
|
|
4840
4851
|
n / 2 - l.width / 2,
|
|
4841
4852
|
n / 2 - l.height / 2
|
|
4842
4853
|
);
|
|
4843
|
-
const u = (
|
|
4844
|
-
const Xi = `${
|
|
4854
|
+
const u = (cn, gs, Yi) => {
|
|
4855
|
+
const Xi = `${cn} ${gs}`, Ji = new U().plain(Xi).font(o).attr(Yi);
|
|
4845
4856
|
return {
|
|
4846
4857
|
e: new B().add(Ji),
|
|
4847
4858
|
width: a + h * gs.toString().length,
|
|
4848
4859
|
height: c
|
|
4849
4860
|
};
|
|
4850
|
-
}, [f, m, d,
|
|
4861
|
+
}, [f, m, d, y] = Ta(
|
|
4851
4862
|
e.frontPlace
|
|
4852
|
-
), _ = e.scores,
|
|
4863
|
+
), _ = e.scores, T = u(f, _.front, {
|
|
4853
4864
|
x: n / 2,
|
|
4854
4865
|
y: n,
|
|
4855
4866
|
"dominant-baseline": "text-after-edge",
|
|
@@ -4859,7 +4870,7 @@ const va = (s) => {
|
|
|
4859
4870
|
"dominant-baseline": "text-after-edge",
|
|
4860
4871
|
"text-anchor": "middle"
|
|
4861
4872
|
});
|
|
4862
|
-
const
|
|
4873
|
+
const F = at(R.e, R.width, R.height, 270).translate(
|
|
4863
4874
|
n,
|
|
4864
4875
|
n / 2 - R.width
|
|
4865
4876
|
);
|
|
@@ -4871,7 +4882,7 @@ const va = (s) => {
|
|
|
4871
4882
|
n / 2 - K.width,
|
|
4872
4883
|
-K.height
|
|
4873
4884
|
);
|
|
4874
|
-
let dt = u(
|
|
4885
|
+
let dt = u(y, _.left, {
|
|
4875
4886
|
"dominant-baseline": "ideographic",
|
|
4876
4887
|
"text-anchor": "middle"
|
|
4877
4888
|
});
|
|
@@ -4879,14 +4890,14 @@ const va = (s) => {
|
|
|
4879
4890
|
-dt.height,
|
|
4880
4891
|
n / 2
|
|
4881
4892
|
);
|
|
4882
|
-
return i.add(l.e), i.add(
|
|
4883
|
-
},
|
|
4884
|
-
const e =
|
|
4885
|
-
(
|
|
4893
|
+
return i.add(l.e), i.add(T), i.add(F), i.add(rt), i.add(Lt), { e: i, width: n, height: n };
|
|
4894
|
+
}, ka = (s, t) => {
|
|
4895
|
+
const e = Ne(t.front, s), n = Ne(t.right, s), i = Ne(t.opposite, s), r = Ne(t.left, s), o = [e.height, n.height, i.height, r.height].reduce(
|
|
4896
|
+
(T, R) => Math.max(T, R)
|
|
4886
4897
|
), a = s.tileWidth * 5 + s.tileHeight * 1, c = o, h = a + o * 2 + s.blockMargin, l = h, u = new B().size(h, l), f = h / 2 - a / 2, m = l / 2 - a / 2, d = at(e.e, a, c, 0).translate(
|
|
4887
4898
|
f,
|
|
4888
4899
|
l - c
|
|
4889
|
-
),
|
|
4900
|
+
), y = at(n.e, a, c, 270).translate(
|
|
4890
4901
|
h - c,
|
|
4891
4902
|
m
|
|
4892
4903
|
), _ = at(
|
|
@@ -4898,9 +4909,9 @@ const va = (s) => {
|
|
|
4898
4909
|
0,
|
|
4899
4910
|
m
|
|
4900
4911
|
);
|
|
4901
|
-
return u.add(d), u.add(
|
|
4912
|
+
return u.add(d), u.add(y), u.add(_), u.add(x), { e: u, width: h, height: l };
|
|
4902
4913
|
}, Ia = (s, t, e, n, i) => {
|
|
4903
|
-
const r = new B(), o =
|
|
4914
|
+
const r = new B(), o = ka(s, n), a = Ea(s, e, o.height), c = Oa(s, t, i);
|
|
4904
4915
|
return o.e.translate(
|
|
4905
4916
|
(a.width - o.width) / 2,
|
|
4906
4917
|
(a.height - o.height) / 2
|
|
@@ -4921,18 +4932,18 @@ function Na(s) {
|
|
|
4921
4932
|
abortPipeEarly: (s == null ? void 0 : s.abortPipeEarly) ?? (pt == null ? void 0 : pt.abortPipeEarly)
|
|
4922
4933
|
};
|
|
4923
4934
|
}
|
|
4924
|
-
var pn;
|
|
4925
|
-
function Da(s) {
|
|
4926
|
-
return pn == null ? void 0 : pn.get(s);
|
|
4927
|
-
}
|
|
4928
4935
|
var mn;
|
|
4929
|
-
function
|
|
4936
|
+
function Da(s) {
|
|
4930
4937
|
return mn == null ? void 0 : mn.get(s);
|
|
4931
4938
|
}
|
|
4932
4939
|
var gn;
|
|
4940
|
+
function Ca(s) {
|
|
4941
|
+
return gn == null ? void 0 : gn.get(s);
|
|
4942
|
+
}
|
|
4943
|
+
var yn;
|
|
4933
4944
|
function Ma(s, t) {
|
|
4934
4945
|
var e;
|
|
4935
|
-
return (e =
|
|
4946
|
+
return (e = yn == null ? void 0 : yn.get(s)) == null ? void 0 : e.get(t);
|
|
4936
4947
|
}
|
|
4937
4948
|
function Qt(s) {
|
|
4938
4949
|
var e, n;
|
|
@@ -4963,11 +4974,11 @@ function Ra(s, t) {
|
|
|
4963
4974
|
const e = [...new Set(s)];
|
|
4964
4975
|
return e.length > 1 ? `(${e.join(` ${t} `)})` : e[0] ?? "never";
|
|
4965
4976
|
}
|
|
4966
|
-
function
|
|
4977
|
+
function Cn(s, t) {
|
|
4967
4978
|
return {
|
|
4968
4979
|
kind: "validation",
|
|
4969
4980
|
type: "max_value",
|
|
4970
|
-
reference:
|
|
4981
|
+
reference: Cn,
|
|
4971
4982
|
async: !1,
|
|
4972
4983
|
expects: `<=${s instanceof Date ? s.toJSON() : Qt(s)}`,
|
|
4973
4984
|
requirement: s,
|
|
@@ -4979,11 +4990,11 @@ function Dn(s, t) {
|
|
|
4979
4990
|
}
|
|
4980
4991
|
};
|
|
4981
4992
|
}
|
|
4982
|
-
function
|
|
4993
|
+
function Mn(s, t) {
|
|
4983
4994
|
return {
|
|
4984
4995
|
kind: "validation",
|
|
4985
4996
|
type: "min_value",
|
|
4986
|
-
reference:
|
|
4997
|
+
reference: Mn,
|
|
4987
4998
|
async: !1,
|
|
4988
4999
|
expects: `>=${s instanceof Date ? s.toJSON() : Qt(s)}`,
|
|
4989
5000
|
requirement: s,
|
|
@@ -5004,11 +5015,11 @@ function Ha(s, t, e) {
|
|
|
5004
5015
|
s.default
|
|
5005
5016
|
);
|
|
5006
5017
|
}
|
|
5007
|
-
function
|
|
5018
|
+
function Ue(s) {
|
|
5008
5019
|
return {
|
|
5009
5020
|
kind: "schema",
|
|
5010
5021
|
type: "number",
|
|
5011
|
-
reference:
|
|
5022
|
+
reference: Ue,
|
|
5012
5023
|
expects: "number",
|
|
5013
5024
|
async: !1,
|
|
5014
5025
|
message: s,
|
|
@@ -5035,11 +5046,11 @@ function it(s, ...t) {
|
|
|
5035
5046
|
};
|
|
5036
5047
|
return 0 in t && (e.default = t[0]), e;
|
|
5037
5048
|
}
|
|
5038
|
-
function
|
|
5049
|
+
function Rn(s, t) {
|
|
5039
5050
|
return {
|
|
5040
5051
|
kind: "schema",
|
|
5041
5052
|
type: "picklist",
|
|
5042
|
-
reference:
|
|
5053
|
+
reference: Rn,
|
|
5043
5054
|
expects: Ra(s.map(Qt), "|"),
|
|
5044
5055
|
async: !1,
|
|
5045
5056
|
options: s,
|
|
@@ -5124,7 +5135,7 @@ function Fe(s) {
|
|
|
5124
5135
|
}
|
|
5125
5136
|
};
|
|
5126
5137
|
}
|
|
5127
|
-
function
|
|
5138
|
+
function Ts(...s) {
|
|
5128
5139
|
return {
|
|
5129
5140
|
...s[0],
|
|
5130
5141
|
pipe: s,
|
|
@@ -5153,18 +5164,18 @@ function $a(s, t, e) {
|
|
|
5153
5164
|
issues: n.issues
|
|
5154
5165
|
};
|
|
5155
5166
|
}
|
|
5156
|
-
const
|
|
5167
|
+
const De = it(
|
|
5157
5168
|
te({
|
|
5158
5169
|
discard: it(Fe(), ""),
|
|
5159
5170
|
hand: it(Fe(), ""),
|
|
5160
|
-
score: it(
|
|
5171
|
+
score: it(Ue(), 25e3)
|
|
5161
5172
|
}),
|
|
5162
5173
|
{ discard: "", hand: "", score: 25e3 }
|
|
5163
5174
|
), Wa = te({
|
|
5164
|
-
[v.E]:
|
|
5165
|
-
[v.S]:
|
|
5166
|
-
[v.W]:
|
|
5167
|
-
[v.N]:
|
|
5175
|
+
[v.E]: De,
|
|
5176
|
+
[v.S]: De,
|
|
5177
|
+
[v.W]: De,
|
|
5178
|
+
[v.N]: De
|
|
5168
5179
|
}), Et = {
|
|
5169
5180
|
round: j.E1,
|
|
5170
5181
|
sticks: { reach: 0, dead: 0 },
|
|
@@ -5173,17 +5184,17 @@ const Ne = it(
|
|
|
5173
5184
|
}, Ba = it(
|
|
5174
5185
|
te({
|
|
5175
5186
|
round: it(
|
|
5176
|
-
|
|
5187
|
+
Rn(Object.keys(Ls)),
|
|
5177
5188
|
Et.round
|
|
5178
5189
|
),
|
|
5179
5190
|
sticks: it(
|
|
5180
5191
|
te({
|
|
5181
5192
|
reach: it(
|
|
5182
|
-
|
|
5193
|
+
Ts(Ue(), Mn(0, ""), Cn(9, "")),
|
|
5183
5194
|
Et.sticks.reach
|
|
5184
5195
|
),
|
|
5185
5196
|
dead: it(
|
|
5186
|
-
|
|
5197
|
+
Ts(Ue(), Mn(0, ""), Cn(9, "")),
|
|
5187
5198
|
Et.sticks.dead
|
|
5188
5199
|
)
|
|
5189
5200
|
}),
|
|
@@ -5191,7 +5202,7 @@ const Ne = it(
|
|
|
5191
5202
|
),
|
|
5192
5203
|
doras: it(Fe(), Et.doras),
|
|
5193
5204
|
front: it(
|
|
5194
|
-
|
|
5205
|
+
Rn(Object.keys(Kn)),
|
|
5195
5206
|
Et.front
|
|
5196
5207
|
)
|
|
5197
5208
|
}),
|
|
@@ -5201,7 +5212,7 @@ const Ne = it(
|
|
|
5201
5212
|
board: Ba
|
|
5202
5213
|
}), ja = (s) => {
|
|
5203
5214
|
const t = za(s);
|
|
5204
|
-
return
|
|
5215
|
+
return Fa(t);
|
|
5205
5216
|
}, za = (s) => {
|
|
5206
5217
|
const t = La(s), e = $a(Pa, t);
|
|
5207
5218
|
if (!e.success)
|
|
@@ -5222,7 +5233,7 @@ const Ne = it(
|
|
|
5222
5233
|
const c = o.find((h) => a.startsWith(h));
|
|
5223
5234
|
if (c == null) throw new Error(`encountered unexpected line ${a}`);
|
|
5224
5235
|
if (o = o.filter((h) => !a.startsWith(h)), c == e) {
|
|
5225
|
-
const [h, l] =
|
|
5236
|
+
const [h, l] = Ua([...n]);
|
|
5226
5237
|
r.board = h;
|
|
5227
5238
|
for (let u = 0; u < l; u++) n.shift();
|
|
5228
5239
|
} else {
|
|
@@ -5243,7 +5254,7 @@ const Ne = it(
|
|
|
5243
5254
|
else break;
|
|
5244
5255
|
}
|
|
5245
5256
|
return [i, r];
|
|
5246
|
-
},
|
|
5257
|
+
}, Ua = (s) => {
|
|
5247
5258
|
const t = "doras", e = "round", n = "front", i = "sticks", r = "reach", o = "dead";
|
|
5248
5259
|
let a = {}, c = 0;
|
|
5249
5260
|
for (; c < s.length; c++) {
|
|
@@ -5261,7 +5272,7 @@ const Ne = it(
|
|
|
5261
5272
|
} else break;
|
|
5262
5273
|
}
|
|
5263
5274
|
return [a, c];
|
|
5264
|
-
},
|
|
5275
|
+
}, Fa = (s) => {
|
|
5265
5276
|
const t = s.board.front, e = qa(t), n = (a) => s[a].discard.replace(/\r?\n/g, ""), i = {
|
|
5266
5277
|
front: new nt(n(e.front)).tiles(),
|
|
5267
5278
|
right: new nt(n(e.right)).tiles(),
|
|
@@ -5274,7 +5285,7 @@ const Ne = it(
|
|
|
5274
5285
|
left: new nt(s[e.left].hand).parse()
|
|
5275
5286
|
}, o = {
|
|
5276
5287
|
round: Ls[s.board.round],
|
|
5277
|
-
frontPlace:
|
|
5288
|
+
frontPlace: Kn[t],
|
|
5278
5289
|
sticks: s.board.sticks,
|
|
5279
5290
|
doras: new nt(s.board.doras).tiles(),
|
|
5280
5291
|
scores: {
|
|
@@ -5291,7 +5302,7 @@ const Ne = it(
|
|
|
5291
5302
|
opposite: Ht(Ht(s)),
|
|
5292
5303
|
left: cr(s)
|
|
5293
5304
|
});
|
|
5294
|
-
class
|
|
5305
|
+
class sn {
|
|
5295
5306
|
constructor(t, e = !1) {
|
|
5296
5307
|
A(this, "data");
|
|
5297
5308
|
this.data = {
|
|
@@ -5333,22 +5344,22 @@ class nn {
|
|
|
5333
5344
|
for (let e of Object.values(p))
|
|
5334
5345
|
for (let n = 1; n < this.getArrayLen(e); n++) {
|
|
5335
5346
|
let i = this.get(e, n);
|
|
5336
|
-
e != p.Z && n == 5 && this.get(e, 0) > 0 && (i -= this.get(e, 0), t.push(new w(e, 5, [
|
|
5347
|
+
e != p.Z && n == 5 && this.get(e, 0) > 0 && (i -= this.get(e, 0), t.push(new w(e, 5, [g.RED])));
|
|
5337
5348
|
for (let r = 0; r < i; r++)
|
|
5338
5349
|
t.push(new w(e, n));
|
|
5339
5350
|
}
|
|
5340
5351
|
if (this.drawn != null) {
|
|
5341
5352
|
const e = this.drawn, n = t.findIndex((i) => i.equals(e));
|
|
5342
|
-
|
|
5353
|
+
k(
|
|
5343
5354
|
n >= 0,
|
|
5344
5355
|
`hand has drawn: ${this.drawn} but no tile in hands: ${t.join("")}`
|
|
5345
|
-
), t[n] = t[n].clone({ add:
|
|
5356
|
+
), t[n] = t[n].clone({ add: g.TSUMO });
|
|
5346
5357
|
}
|
|
5347
5358
|
return t;
|
|
5348
5359
|
}
|
|
5349
5360
|
toString() {
|
|
5350
|
-
const t = this.called.length > 0 ? `${Dt}${this.called.join(Dt)}` : "", e = this.drawn ? `${Dt}${this.drawn.toString()}` : "", n = this.hands.filter((r) => !r.has(
|
|
5351
|
-
return `${new
|
|
5361
|
+
const t = this.called.length > 0 ? `${Dt}${this.called.join(Dt)}` : "", e = this.drawn ? `${Dt}${this.drawn.toString()}` : "", n = this.hands.filter((r) => !r.has(g.TSUMO));
|
|
5362
|
+
return `${new me(n).toString()}${e}${t}`;
|
|
5352
5363
|
}
|
|
5353
5364
|
get called() {
|
|
5354
5365
|
return this.data.called;
|
|
@@ -5376,29 +5387,29 @@ class nn {
|
|
|
5376
5387
|
inc(t) {
|
|
5377
5388
|
const e = [];
|
|
5378
5389
|
for (let n of t) {
|
|
5379
|
-
if (
|
|
5390
|
+
if (k(!(n.isNum() && n.n == 0), `found 0s/0p/0m ${n.toString()}`), n.t != p.BACK && this.get(n.t, n.n) >= 4 || n.has(g.RED) && this.get(n.t, 0) > 0)
|
|
5380
5391
|
throw this.dec(e), new Error(`unable to increase ${n} in ${this.toString()}`);
|
|
5381
|
-
e.push(n), n.t == p.BACK ? this.data[n.t][1] += 1 : (this.data[n.t][n.n] += 1, n.has(
|
|
5392
|
+
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));
|
|
5382
5393
|
}
|
|
5383
5394
|
return e;
|
|
5384
5395
|
}
|
|
5385
5396
|
dec(t) {
|
|
5386
5397
|
const e = [];
|
|
5387
5398
|
for (let n of t) {
|
|
5388
|
-
if (
|
|
5399
|
+
if (k(!(n.isNum() && n.n == 0), `found 0s/0p/0m ${n.toString()}`), this.get(n.t, n.n) < 1 || n.has(g.RED) && this.get(n.t, 0) <= 0)
|
|
5389
5400
|
throw this.inc(e), new Error(
|
|
5390
5401
|
`unable to decrease ${n.toString()} in ${this.toString()}`
|
|
5391
5402
|
);
|
|
5392
|
-
if (e.push(n), n.t == p.BACK ? this.data[n.t][1] -= 1 : (this.data[n.t][n.n] -= 1, n.has(
|
|
5403
|
+
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)), z(n) && this.get(n.t, 5) == 0 && this.get(n.t, 0) > 0) {
|
|
5393
5404
|
this.data[n.t][0] = 0;
|
|
5394
|
-
const i = e.pop().clone({ add:
|
|
5405
|
+
const i = e.pop().clone({ add: g.RED });
|
|
5395
5406
|
e.push(i);
|
|
5396
5407
|
}
|
|
5397
5408
|
}
|
|
5398
5409
|
return e;
|
|
5399
5410
|
}
|
|
5400
5411
|
draw(t) {
|
|
5401
|
-
const e = t.clone({ add:
|
|
5412
|
+
const e = t.clone({ add: g.TSUMO });
|
|
5402
5413
|
this.inc([e]), this.data.tsumo = e;
|
|
5403
5414
|
}
|
|
5404
5415
|
discard(t) {
|
|
@@ -5412,7 +5423,7 @@ class nn {
|
|
|
5412
5423
|
call(t) {
|
|
5413
5424
|
if (!(t instanceof wt || t instanceof ut || t instanceof yt))
|
|
5414
5425
|
throw new Error(`unexpected input ${t} ${t.type}`);
|
|
5415
|
-
const e = t.tiles.filter((n) => !n.has(
|
|
5426
|
+
const e = t.tiles.filter((n) => !n.has(g.HORIZONTAL));
|
|
5416
5427
|
if (e.length != t.tiles.length - 1)
|
|
5417
5428
|
throw new Error(`removal: ${e} block: ${t}`);
|
|
5418
5429
|
this.dec(e), this.data.called = [...this.called, t], this.data.tsumo = null;
|
|
@@ -5429,7 +5440,7 @@ class nn {
|
|
|
5429
5440
|
);
|
|
5430
5441
|
if (e == -1) throw new Error(`unable to find ${t.tiles[0]}`);
|
|
5431
5442
|
let n = t.tiles[0];
|
|
5432
|
-
n = z(n) && this.get(n.t, 0) > 0 ? n.clone({ add:
|
|
5443
|
+
n = z(n) && this.get(n.t, 0) > 0 ? n.clone({ add: g.RED }) : n.clone({ remove: g.RED }), this.dec([n]), this.data.called = [
|
|
5433
5444
|
...this.called.slice(0, e),
|
|
5434
5445
|
...this.called.slice(e + 1),
|
|
5435
5446
|
t
|
|
@@ -5439,11 +5450,11 @@ class nn {
|
|
|
5439
5450
|
throw new Error(`unexpected input ${t}`);
|
|
5440
5451
|
}
|
|
5441
5452
|
clone() {
|
|
5442
|
-
const t = new
|
|
5453
|
+
const t = new sn(this.toString());
|
|
5443
5454
|
return t.data.reached = this.data.reached, t;
|
|
5444
5455
|
}
|
|
5445
5456
|
}
|
|
5446
|
-
class
|
|
5457
|
+
class rn {
|
|
5447
5458
|
constructor(t) {
|
|
5448
5459
|
A(this, "hand");
|
|
5449
5460
|
this.hand = t;
|
|
@@ -5469,7 +5480,7 @@ class sn {
|
|
|
5469
5480
|
let t = 0, e = 0;
|
|
5470
5481
|
for (let n of Object.values(p)) {
|
|
5471
5482
|
if (n == p.BACK) continue;
|
|
5472
|
-
const i = n == p.Z ?
|
|
5483
|
+
const i = n == p.Z ? be : gt;
|
|
5473
5484
|
for (let r of i)
|
|
5474
5485
|
this.hand.get(n, r) >= 1 && t++, this.hand.get(n, r) >= 2 && e++;
|
|
5475
5486
|
}
|
|
@@ -5486,10 +5497,10 @@ class sn {
|
|
|
5486
5497
|
const l = this.commonByType(p.M), u = this.commonByType(p.P), f = this.commonByType(p.S);
|
|
5487
5498
|
for (let m of [l.patternA, l.patternB])
|
|
5488
5499
|
for (let d of [u.patternA, u.patternB])
|
|
5489
|
-
for (let
|
|
5500
|
+
for (let y of [f.patternA, f.patternB]) {
|
|
5490
5501
|
const _ = [this.hand.called.length, 0, 0];
|
|
5491
|
-
for (let
|
|
5492
|
-
_[
|
|
5502
|
+
for (let T = 0; T < 3; T++)
|
|
5503
|
+
_[T] += m[T] + d[T] + y[T] + i[T] + o[T];
|
|
5493
5504
|
let x = this.calcCommon(_[0], _[1], _[2], n);
|
|
5494
5505
|
x < h && (h = x);
|
|
5495
5506
|
}
|
|
@@ -5559,7 +5570,7 @@ class Za {
|
|
|
5559
5570
|
}
|
|
5560
5571
|
markDrawn(t, e) {
|
|
5561
5572
|
if (t.length == 0) return [];
|
|
5562
|
-
const n = this.hand.drawn != null || e.has(
|
|
5573
|
+
const n = this.hand.drawn != null || e.has(g.TSUMO) ? g.TSUMO : g.RON, i = [];
|
|
5563
5574
|
for (let o = 0; o < t.length; o++) {
|
|
5564
5575
|
const a = t[o], c = {};
|
|
5565
5576
|
for (let h = 0; h < a.length; h++) {
|
|
@@ -5604,7 +5615,7 @@ class Za {
|
|
|
5604
5615
|
let e = !1;
|
|
5605
5616
|
for (let n of Object.values(p)) {
|
|
5606
5617
|
if (n == p.BACK) continue;
|
|
5607
|
-
const i = n == p.Z ?
|
|
5618
|
+
const i = n == p.Z ? be : gt;
|
|
5608
5619
|
for (let r of i)
|
|
5609
5620
|
if (this.hand.get(n, r) == 1)
|
|
5610
5621
|
t.push(new Ks(new w(n, r)));
|
|
@@ -5620,7 +5631,7 @@ class Za {
|
|
|
5620
5631
|
if (e == p.BACK || e == p.Z) continue;
|
|
5621
5632
|
const n = t(e, 1, [3, 4]) && t(e, 9, [3, 4]) && t(e, 2, [1, 2]) && t(e, 3, [1, 2]) && t(e, 4, [1, 2]) && t(e, 5, [1, 2]) && t(e, 6, [1, 2]) && t(e, 7, [1, 2]) && t(e, 8, [1, 2]), i = this.hand.sum(e) == 14;
|
|
5622
5633
|
if (n && i)
|
|
5623
|
-
return [[new
|
|
5634
|
+
return [[new me(this.hand.hands)]];
|
|
5624
5635
|
}
|
|
5625
5636
|
return [];
|
|
5626
5637
|
}
|
|
@@ -5695,7 +5706,7 @@ class Za {
|
|
|
5695
5706
|
return n;
|
|
5696
5707
|
}
|
|
5697
5708
|
}
|
|
5698
|
-
const
|
|
5709
|
+
const be = [1, 2, 3, 4, 5, 6, 7], gt = [1, 9], Ce = (s) => {
|
|
5699
5710
|
var e;
|
|
5700
5711
|
const t = s.boardContext;
|
|
5701
5712
|
return {
|
|
@@ -5708,7 +5719,7 @@ const _e = [1, 2, 3, 4, 5, 6, 7], gt = [1, 9], De = (s) => {
|
|
|
5708
5719
|
}
|
|
5709
5720
|
};
|
|
5710
5721
|
};
|
|
5711
|
-
class
|
|
5722
|
+
class Os {
|
|
5712
5723
|
constructor(t, e) {
|
|
5713
5724
|
A(this, "hand");
|
|
5714
5725
|
A(this, "cfg");
|
|
@@ -5733,13 +5744,13 @@ class Ts {
|
|
|
5733
5744
|
if (e.length == 0) return !1;
|
|
5734
5745
|
let n = [0, 0], i = 0;
|
|
5735
5746
|
for (let d = 0; d < e.length; d++) {
|
|
5736
|
-
const
|
|
5737
|
-
(x,
|
|
5747
|
+
const y = e[d], _ = y.points.reduce(
|
|
5748
|
+
(x, T) => x + T.double,
|
|
5738
5749
|
0
|
|
5739
5750
|
);
|
|
5740
|
-
(_ > n[0] || _ == n[0] &&
|
|
5751
|
+
(_ > n[0] || _ == n[0] && y.fu > n[1]) && (i = d, n[0] = _, n[1] = y.fu);
|
|
5741
5752
|
}
|
|
5742
|
-
const r = (d,
|
|
5753
|
+
const r = (d, y = 100) => Math.ceil(d / y) * y, o = n[1] != 25 ? r(n[1], 10) : 25, a = n[0];
|
|
5743
5754
|
let c = Math.min(o * 2 ** (a + 2), 2e3);
|
|
5744
5755
|
switch (a) {
|
|
5745
5756
|
case 26:
|
|
@@ -5767,18 +5778,18 @@ class Ts {
|
|
|
5767
5778
|
}
|
|
5768
5779
|
a > 13 && a < 26 && (c = 8e3);
|
|
5769
5780
|
const h = e[i].hand.some(
|
|
5770
|
-
(d) => d.tiles.some((
|
|
5781
|
+
(d) => d.tiles.some((y) => y.has(g.TSUMO))
|
|
5771
5782
|
), l = this.cfg.orig.myWind, u = l == v.E, f = G(0);
|
|
5772
5783
|
if (h) {
|
|
5773
5784
|
const d = this.cfg.sticks.dead * 100;
|
|
5774
5785
|
if (u) {
|
|
5775
|
-
const
|
|
5776
|
-
f[v.E] +=
|
|
5786
|
+
const y = r(c * 2);
|
|
5787
|
+
f[v.E] += y * 3 + d * 3, f[v.S] -= y + d, f[v.W] -= y + d, f[v.N] -= y + d;
|
|
5777
5788
|
} else
|
|
5778
|
-
for (let
|
|
5779
|
-
if (
|
|
5780
|
-
const _ =
|
|
5781
|
-
f[
|
|
5789
|
+
for (let y of Object.values(v)) {
|
|
5790
|
+
if (y == l) continue;
|
|
5791
|
+
const _ = y == v.E ? 2 : 1, x = r(c * _) + d;
|
|
5792
|
+
f[y] -= x, f[l] += x;
|
|
5782
5793
|
}
|
|
5783
5794
|
} else {
|
|
5784
5795
|
const d = this.cfg.sticks.dead * 300;
|
|
@@ -5864,12 +5875,12 @@ class Ts {
|
|
|
5864
5875
|
return this.cfg.reached == 1 ? [{ name: "立直", double: 1 }] : this.cfg.reached == 2 ? [{ name: "ダブル立直", double: 2 }] : [];
|
|
5865
5876
|
}
|
|
5866
5877
|
dB1(t) {
|
|
5867
|
-
return this.minus() != 0 ? [] : (this.hand.drawn == null, t.some((n) => n.tiles.some((i) => i.has(
|
|
5878
|
+
return this.minus() != 0 ? [] : (this.hand.drawn == null, t.some((n) => n.tiles.some((i) => i.has(g.TSUMO))) ? [{ name: "門前清自摸和", double: 1 }] : []);
|
|
5868
5879
|
}
|
|
5869
5880
|
dC1(t) {
|
|
5870
5881
|
if (this.minus() != 0) return [];
|
|
5871
5882
|
const e = "平和", n = this.calcFu(t);
|
|
5872
|
-
return n == 20 ? [{ name: e, double: 1 }] : !t.some((i) => i.tiles.some((r) => r.has(
|
|
5883
|
+
return n == 20 ? [{ name: e, double: 1 }] : !t.some((i) => i.tiles.some((r) => r.has(g.TSUMO))) && n == 30 ? [{ name: e, double: 1 }] : [];
|
|
5873
5884
|
}
|
|
5874
5885
|
dD1(t) {
|
|
5875
5886
|
return t.some(
|
|
@@ -5877,7 +5888,7 @@ class Ts {
|
|
|
5877
5888
|
) ? [] : [{ name: "断么九", double: 1 }];
|
|
5878
5889
|
}
|
|
5879
5890
|
dE1(t) {
|
|
5880
|
-
return this.minus() != 0 ? [] :
|
|
5891
|
+
return this.minus() != 0 ? [] : ks(t) == 1 ? [{ name: "一盃口", double: 1 }] : [];
|
|
5881
5892
|
}
|
|
5882
5893
|
dF1(t) {
|
|
5883
5894
|
const e = [];
|
|
@@ -5908,7 +5919,7 @@ class Ts {
|
|
|
5908
5919
|
for (let a of o.tiles) {
|
|
5909
5920
|
for (let c of this.cfg.doras) a.equals(c) && e++;
|
|
5910
5921
|
for (let c of this.cfg.blindDoras) a.equals(c) && i++;
|
|
5911
|
-
a.has(
|
|
5922
|
+
a.has(g.RED) && n++;
|
|
5912
5923
|
}
|
|
5913
5924
|
const r = [];
|
|
5914
5925
|
return e > 0 && r.push({ name: "ドラ", double: e }), n > 0 && r.push({ name: "赤ドラ", double: n }), this.hand.reached && i > 0 && r.push({ name: "裏ドラ", double: i }), r;
|
|
@@ -5920,14 +5931,14 @@ class Ts {
|
|
|
5920
5931
|
const e = (n) => n instanceof Ct || n instanceof ut;
|
|
5921
5932
|
for (let n of t) {
|
|
5922
5933
|
if (!e(n)) continue;
|
|
5923
|
-
const i =
|
|
5934
|
+
const i = Tt(n);
|
|
5924
5935
|
if (i.t == p.Z) continue;
|
|
5925
5936
|
const r = [p.M, p.P, p.S].filter((c) => c != i.t), o = t.some((c) => {
|
|
5926
5937
|
const h = new w(r[0], i.n);
|
|
5927
|
-
return e(c) && h.equals(
|
|
5938
|
+
return e(c) && h.equals(Tt(c));
|
|
5928
5939
|
}), a = t.some((c) => {
|
|
5929
5940
|
const h = new w(r[1], i.n);
|
|
5930
|
-
return e(c) && h.equals(
|
|
5941
|
+
return e(c) && h.equals(Tt(c));
|
|
5931
5942
|
});
|
|
5932
5943
|
if (o && a)
|
|
5933
5944
|
return [{ name: "三色同順", double: 2 - this.minus() }];
|
|
@@ -5940,7 +5951,7 @@ class Ts {
|
|
|
5940
5951
|
) ? [{ name: "対々和", double: 2 }] : [];
|
|
5941
5952
|
}
|
|
5942
5953
|
dD2(t) {
|
|
5943
|
-
return this.minus() != 0 ? [] : t.filter((n) => (n instanceof Z || n instanceof ht) && !n.tiles.some((i) => i.has(
|
|
5954
|
+
return this.minus() != 0 ? [] : t.filter((n) => (n instanceof Z || n instanceof ht) && !n.tiles.some((i) => i.has(g.RON))).length >= 3 ? [{ name: "三暗刻", double: 2 }] : [];
|
|
5944
5955
|
}
|
|
5945
5956
|
dE2(t) {
|
|
5946
5957
|
return t.filter(
|
|
@@ -5951,14 +5962,14 @@ class Ts {
|
|
|
5951
5962
|
const e = (n) => n instanceof Z || n instanceof lt || n instanceof yt || n instanceof ht || n instanceof wt;
|
|
5952
5963
|
for (let n of t) {
|
|
5953
5964
|
if (!e(n)) continue;
|
|
5954
|
-
const i =
|
|
5965
|
+
const i = Tt(n);
|
|
5955
5966
|
if (i.t == p.Z) continue;
|
|
5956
5967
|
const r = [p.M, p.P, p.S].filter((c) => c != i.t), o = t.some((c) => {
|
|
5957
5968
|
const h = new w(r[0], i.n);
|
|
5958
|
-
return e(c) && h.equals(
|
|
5969
|
+
return e(c) && h.equals(Tt(c));
|
|
5959
5970
|
}), a = t.some((c) => {
|
|
5960
5971
|
const h = new w(r[1], i.n);
|
|
5961
|
-
return e(c) && h.equals(
|
|
5972
|
+
return e(c) && h.equals(Tt(c));
|
|
5962
5973
|
});
|
|
5963
5974
|
if (o && a) return [{ name: "三色同刻", double: 2 }];
|
|
5964
5975
|
}
|
|
@@ -5972,13 +5983,13 @@ class Ts {
|
|
|
5972
5983
|
}
|
|
5973
5984
|
dH2(t) {
|
|
5974
5985
|
return t.every((n) => {
|
|
5975
|
-
const i = n.tiles[0].t == p.Z ?
|
|
5986
|
+
const i = n.tiles[0].t == p.Z ? be : gt;
|
|
5976
5987
|
return n.tiles.every((r) => i.includes(r.n));
|
|
5977
5988
|
}) ? [{ name: "混老頭", double: 2 }] : [];
|
|
5978
5989
|
}
|
|
5979
5990
|
dI2(t) {
|
|
5980
5991
|
return t.length == 7 ? [] : t.some((n) => n instanceof Ct || n instanceof ut) ? t.some((n) => n.tiles[0].t == p.Z) ? t.every((n) => {
|
|
5981
|
-
const i = n.tiles[0].t == p.Z ?
|
|
5992
|
+
const i = n.tiles[0].t == p.Z ? be : gt;
|
|
5982
5993
|
return n.tiles.some((r) => i.includes(r.n));
|
|
5983
5994
|
}) ? [{ name: "混全帯么九", double: 2 - this.minus() }] : [] : [] : [];
|
|
5984
5995
|
}
|
|
@@ -5991,7 +6002,7 @@ class Ts {
|
|
|
5991
6002
|
[p.P]: [0, 0, 0]
|
|
5992
6003
|
};
|
|
5993
6004
|
for (let n of t) {
|
|
5994
|
-
const i =
|
|
6005
|
+
const i = Tt(n);
|
|
5995
6006
|
i.t != p.BACK && i.t != p.Z && (n instanceof Ct || n instanceof ut) && (i.n == 1 && e[i.t][0]++, i.n == 4 && e[i.t][1]++, i.n == 7 && e[i.t][2]++);
|
|
5996
6007
|
}
|
|
5997
6008
|
for (let n of Object.values(e))
|
|
@@ -6009,7 +6020,7 @@ class Ts {
|
|
|
6009
6020
|
return t.length == 7 ? [] : t.some((n) => n instanceof Ct || n instanceof ut) ? t.some((n) => n.tiles[0].t == p.Z) ? [] : t.every((n) => n.tiles.some((i) => gt.includes(i.n))) ? [{ name: "純全帯么九色", double: 3 - this.minus() }] : [] : [];
|
|
6010
6021
|
}
|
|
6011
6022
|
dC3(t) {
|
|
6012
|
-
return this.minus() != 0 ? [] :
|
|
6023
|
+
return this.minus() != 0 ? [] : ks(t) == 2 ? [{ name: "ニ盃口", double: 3 }] : [];
|
|
6013
6024
|
}
|
|
6014
6025
|
dA6(t) {
|
|
6015
6026
|
if (t.some((e) => e.tiles[0].t == p.Z)) return [];
|
|
@@ -6021,7 +6032,7 @@ class Ts {
|
|
|
6021
6032
|
}
|
|
6022
6033
|
dA13(t) {
|
|
6023
6034
|
return t.length != 13 ? [] : t.some(
|
|
6024
|
-
(n) => n instanceof V && n.tiles.some((i) => i.has(
|
|
6035
|
+
(n) => n instanceof V && n.tiles.some((i) => i.has(g.TSUMO) || i.has(g.RON))
|
|
6025
6036
|
) ? [{ name: "国士無双13面待ち", double: 26 }] : [{ name: "国士無双", double: 13 }];
|
|
6026
6037
|
}
|
|
6027
6038
|
dB13(t) {
|
|
@@ -6029,9 +6040,9 @@ class Ts {
|
|
|
6029
6040
|
}
|
|
6030
6041
|
dC13(t) {
|
|
6031
6042
|
return t.length == 7 ? [] : t.every(
|
|
6032
|
-
(i) => i instanceof Z || i instanceof ht && !i.tiles.some((r) => r.has(
|
|
6043
|
+
(i) => i instanceof Z || i instanceof ht && !i.tiles.some((r) => r.has(g.RON)) || i instanceof V
|
|
6033
6044
|
) ? t.some(
|
|
6034
|
-
(i) => i instanceof V && i.tiles.every((r) => r.has(
|
|
6045
|
+
(i) => i instanceof V && i.tiles.every((r) => r.has(g.TSUMO) || r.has(g.RON))
|
|
6035
6046
|
) ? [{ name: "四暗刻単騎待ち", double: 26 }] : [{ name: "四暗刻", double: 13 }] : [];
|
|
6036
6047
|
}
|
|
6037
6048
|
dD13(t) {
|
|
@@ -6076,16 +6087,16 @@ class Ts {
|
|
|
6076
6087
|
const i = this.cfg.myWind.n, r = this.cfg.roundWind.n;
|
|
6077
6088
|
if (t.length == 7) return 25;
|
|
6078
6089
|
const o = t.find(
|
|
6079
|
-
(d) => d.tiles.some((
|
|
6080
|
-
), a = this.minus() == 1, c = o.tiles.some((d) => d.has(
|
|
6090
|
+
(d) => d.tiles.some((y) => y.has(g.TSUMO) || y.has(g.RON))
|
|
6091
|
+
), a = this.minus() == 1, c = o.tiles.some((d) => d.has(g.TSUMO)), h = (d, y) => {
|
|
6081
6092
|
const _ = d.tiles[0];
|
|
6082
|
-
return _.t == p.Z && [5, 6, 7].includes(_.n) || _.t == p.Z && [i, r].includes(_.n) || gt.includes(_.n) ?
|
|
6093
|
+
return _.t == p.Z && [5, 6, 7].includes(_.n) || _.t == p.Z && [i, r].includes(_.n) || gt.includes(_.n) ? y * 2 : y;
|
|
6083
6094
|
};
|
|
6084
6095
|
for (let d of t)
|
|
6085
6096
|
switch (!0) {
|
|
6086
6097
|
case d instanceof ht:
|
|
6087
|
-
let
|
|
6088
|
-
n += h(d,
|
|
6098
|
+
let y = d.tiles.some((_) => _.has(g.RON)) ? 2 : 4;
|
|
6099
|
+
n += h(d, y);
|
|
6089
6100
|
break;
|
|
6090
6101
|
case d instanceof wt:
|
|
6091
6102
|
n += h(d, 2);
|
|
@@ -6100,10 +6111,10 @@ class Ts {
|
|
|
6100
6111
|
n += ((d) => {
|
|
6101
6112
|
if (d instanceof ht) return 0;
|
|
6102
6113
|
if (d instanceof V) return 2;
|
|
6103
|
-
const
|
|
6104
|
-
(x) => x.has(
|
|
6114
|
+
const y = d.tiles, _ = y.findIndex(
|
|
6115
|
+
(x) => x.has(g.TSUMO) || x.has(g.RON)
|
|
6105
6116
|
);
|
|
6106
|
-
return _ == 1 || _ == 0 &&
|
|
6117
|
+
return _ == 1 || _ == 0 && y[2].n == 9 || _ == 2 && y[0].n == 1 ? 2 : 0;
|
|
6107
6118
|
})(o);
|
|
6108
6119
|
let f = t.find((d) => d instanceof V).tiles[0];
|
|
6109
6120
|
f.t == p.Z && ([5, 6, 7].includes(f.n) && (n += 2), f.n == r && (n += 2), f.n == i && (n += 2));
|
|
@@ -6111,7 +6122,7 @@ class Ts {
|
|
|
6111
6122
|
return !a && n == 20 && (m = !0), c && !m && (n += 2), !c && !a && (n += 10), !c && !a && n == 30 && (m = !0), a && n == 20 && (n = 30), n;
|
|
6112
6123
|
}
|
|
6113
6124
|
}
|
|
6114
|
-
const xi = (s) => s.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""),
|
|
6125
|
+
const xi = (s) => s.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""), ks = (s) => {
|
|
6115
6126
|
let t = {};
|
|
6116
6127
|
for (let n of s) {
|
|
6117
6128
|
if (!(n instanceof Ct)) continue;
|
|
@@ -6122,7 +6133,7 @@ const xi = (s) => s.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""), Os = (s) =>
|
|
|
6122
6133
|
for (let n in t)
|
|
6123
6134
|
t[n] >= 2 && e++;
|
|
6124
6135
|
return e;
|
|
6125
|
-
},
|
|
6136
|
+
}, Tt = (s) => [...s.tiles].sort(Ve)[0], Is = (s) => {
|
|
6126
6137
|
let t = s.n, e = s.t;
|
|
6127
6138
|
return new w(e, t % 9 + 1);
|
|
6128
6139
|
};
|
|
@@ -6130,13 +6141,13 @@ class ee {
|
|
|
6130
6141
|
// ツモった後の14枚の手配から、牌効率に従って捨てるべき牌を返す。
|
|
6131
6142
|
// choices は、通常なら hand.hand を指定する。ただし、リーチしている場合は捨てる牌が限られているので choices で制限する。
|
|
6132
6143
|
static calcCandidates(t, e, n) {
|
|
6133
|
-
|
|
6144
|
+
k(e.length > 0, "choices to discard is zero");
|
|
6134
6145
|
const i = /* @__PURE__ */ new Map();
|
|
6135
6146
|
let r = Number.POSITIVE_INFINITY;
|
|
6136
6147
|
for (let o of e) {
|
|
6137
6148
|
const a = t.dec([o]), c = ee.candidateTiles(t, n);
|
|
6138
6149
|
t.inc(a);
|
|
6139
|
-
const h = n != null && n.arrangeRed && o.has(
|
|
6150
|
+
const h = n != null && 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 });
|
|
6140
6151
|
c.shanten < r ? (i.clear(), i.set(h.toString(), {
|
|
6141
6152
|
shanten: c.shanten,
|
|
6142
6153
|
candidates: c.candidates,
|
|
@@ -6152,7 +6163,7 @@ class ee {
|
|
|
6152
6163
|
// 積もる前の13枚の手配から、有効牌の一覧を返す
|
|
6153
6164
|
static candidateTiles(t, e) {
|
|
6154
6165
|
let n = Number.POSITIVE_INFINITY, i = [];
|
|
6155
|
-
const r = new
|
|
6166
|
+
const r = new rn(t);
|
|
6156
6167
|
for (let o of Object.values(p))
|
|
6157
6168
|
if (o != p.BACK)
|
|
6158
6169
|
for (let a = 1; a < t.getArrayLen(o); a++) {
|
|
@@ -6167,11 +6178,11 @@ class ee {
|
|
|
6167
6178
|
}
|
|
6168
6179
|
// allow a partial input such as 23456s11z => 1,4,7s
|
|
6169
6180
|
static partialCandidateTiles(t, e) {
|
|
6170
|
-
const n = new
|
|
6181
|
+
const n = new sn(t, !0);
|
|
6171
6182
|
return Array(13 - (n.hands.length + n.called.length * 3)).fill(void 0).map(() => n.inc([new w(p.BACK, 0)])), ee.candidateTiles(n, e);
|
|
6172
6183
|
}
|
|
6173
6184
|
}
|
|
6174
|
-
const
|
|
6185
|
+
const Hn = () => {
|
|
6175
6186
|
const s = /* @__PURE__ */ new Set();
|
|
6176
6187
|
return {
|
|
6177
6188
|
on(t) {
|
|
@@ -6193,7 +6204,7 @@ function Ga(s) {
|
|
|
6193
6204
|
const t = ["RON", "DAI_KAN", "PON", "CHI"], e = s.map((o) => o.choices), i = Ei(e, t).map((o) => s[o]);
|
|
6194
6205
|
return {
|
|
6195
6206
|
events: i,
|
|
6196
|
-
type:
|
|
6207
|
+
type: Ti(t, (r = i[0]) == null ? void 0 : r.choices)
|
|
6197
6208
|
};
|
|
6198
6209
|
}
|
|
6199
6210
|
function Ya(s) {
|
|
@@ -6208,7 +6219,7 @@ function Ya(s) {
|
|
|
6208
6219
|
], e = s.map((o) => o.choices), i = Ei(e, t).map((o) => s[o]);
|
|
6209
6220
|
return {
|
|
6210
6221
|
events: i,
|
|
6211
|
-
type:
|
|
6222
|
+
type: Ti(t, (r = i[0]) == null ? void 0 : r.choices)
|
|
6212
6223
|
};
|
|
6213
6224
|
}
|
|
6214
6225
|
function Ei(s, t) {
|
|
@@ -6232,14 +6243,14 @@ function Ja(s, t) {
|
|
|
6232
6243
|
}
|
|
6233
6244
|
return Number.POSITIVE_INFINITY;
|
|
6234
6245
|
}
|
|
6235
|
-
function
|
|
6246
|
+
function Ti(s, t) {
|
|
6236
6247
|
if (t == null) return !1;
|
|
6237
6248
|
for (const e of s)
|
|
6238
6249
|
if (t[e]) return e;
|
|
6239
6250
|
return !1;
|
|
6240
6251
|
}
|
|
6241
|
-
const
|
|
6242
|
-
const s =
|
|
6252
|
+
const Me = () => {
|
|
6253
|
+
const s = Hn(), t = Hn(), e = {
|
|
6243
6254
|
emit: s.emit,
|
|
6244
6255
|
on: (i) => t.on(i)
|
|
6245
6256
|
}, n = {
|
|
@@ -6248,7 +6259,7 @@ const Ce = () => {
|
|
|
6248
6259
|
};
|
|
6249
6260
|
return [e, n];
|
|
6250
6261
|
}, Va = () => {
|
|
6251
|
-
const s =
|
|
6262
|
+
const s = Hn();
|
|
6252
6263
|
return {
|
|
6253
6264
|
emit: (n) => {
|
|
6254
6265
|
s.emit(n);
|
|
@@ -6258,7 +6269,7 @@ const Ce = () => {
|
|
|
6258
6269
|
}
|
|
6259
6270
|
};
|
|
6260
6271
|
};
|
|
6261
|
-
class
|
|
6272
|
+
class qe {
|
|
6262
6273
|
constructor(t) {
|
|
6263
6274
|
A(this, "reachValue", 1e3);
|
|
6264
6275
|
A(this, "m");
|
|
@@ -6283,7 +6294,7 @@ class Ue {
|
|
|
6283
6294
|
}
|
|
6284
6295
|
}
|
|
6285
6296
|
}
|
|
6286
|
-
class
|
|
6297
|
+
class Ze {
|
|
6287
6298
|
constructor(t, e) {
|
|
6288
6299
|
A(this, "pToW", {});
|
|
6289
6300
|
A(this, "wToP", G(""));
|
|
@@ -6305,11 +6316,11 @@ class qe {
|
|
|
6305
6316
|
this.sticks.reach++;
|
|
6306
6317
|
}
|
|
6307
6318
|
nextRound() {
|
|
6308
|
-
const t =
|
|
6319
|
+
const t = We(this.round);
|
|
6309
6320
|
this.round = t, this.update();
|
|
6310
6321
|
}
|
|
6311
6322
|
decrementReachStick() {
|
|
6312
|
-
this.sticks.reach--,
|
|
6323
|
+
this.sticks.reach--, k(this.sticks.reach >= 0);
|
|
6313
6324
|
}
|
|
6314
6325
|
resetDeadStick() {
|
|
6315
6326
|
this.sticks.dead = 0;
|
|
@@ -6330,7 +6341,7 @@ class qe {
|
|
|
6330
6341
|
return structuredClone(this.pToW);
|
|
6331
6342
|
}
|
|
6332
6343
|
}
|
|
6333
|
-
function
|
|
6344
|
+
function Oi(s) {
|
|
6334
6345
|
for (let t = s.length - 1; t > 0; t--) {
|
|
6335
6346
|
const e = Math.floor(Math.random() * (t + 1));
|
|
6336
6347
|
[s[t], s[e]] = [s[e], s[t]];
|
|
@@ -6360,7 +6371,7 @@ class Qa {
|
|
|
6360
6371
|
throw new Error(
|
|
6361
6372
|
`[counter] cannot decrease ${e.toString()} due to zero`
|
|
6362
6373
|
);
|
|
6363
|
-
this.c[e.t][e.n] -= 1, e.has(
|
|
6374
|
+
this.c[e.t][e.n] -= 1, e.has(g.RED) && (this.c[e.t][0] -= 1);
|
|
6364
6375
|
}
|
|
6365
6376
|
}
|
|
6366
6377
|
}
|
|
@@ -6382,7 +6393,7 @@ class Qa {
|
|
|
6382
6393
|
};
|
|
6383
6394
|
}
|
|
6384
6395
|
}
|
|
6385
|
-
class
|
|
6396
|
+
class ki {
|
|
6386
6397
|
constructor() {
|
|
6387
6398
|
A(this, "m", []);
|
|
6388
6399
|
}
|
|
@@ -6394,7 +6405,7 @@ class Oi {
|
|
|
6394
6405
|
}
|
|
6395
6406
|
get lastTile() {
|
|
6396
6407
|
const t = this.m.at(-1);
|
|
6397
|
-
return
|
|
6408
|
+
return k(
|
|
6398
6409
|
t != null,
|
|
6399
6410
|
`lastTile is null(${t}). river: ${JSON.stringify(this.m, null, 2)}`
|
|
6400
6411
|
), t;
|
|
@@ -6461,13 +6472,13 @@ class Ns {
|
|
|
6461
6472
|
this._last = null;
|
|
6462
6473
|
}
|
|
6463
6474
|
}
|
|
6464
|
-
const Ii = ".", sc = "", Ni = "", ic = "#", rc = "*", Di = "xstate.init",
|
|
6475
|
+
const Ii = ".", sc = "", Ni = "", ic = "#", rc = "*", Di = "xstate.init", $n = "xstate.stop";
|
|
6465
6476
|
function oc(s, t) {
|
|
6466
6477
|
return {
|
|
6467
6478
|
type: `xstate.after.${s}.${t}`
|
|
6468
6479
|
};
|
|
6469
6480
|
}
|
|
6470
|
-
function
|
|
6481
|
+
function Wn(s, t) {
|
|
6471
6482
|
return {
|
|
6472
6483
|
type: `xstate.done.state.${s}`,
|
|
6473
6484
|
output: t
|
|
@@ -6556,7 +6567,7 @@ function Ri(s) {
|
|
|
6556
6567
|
function vt(s) {
|
|
6557
6568
|
return s === void 0 ? [] : Ri(s);
|
|
6558
6569
|
}
|
|
6559
|
-
function
|
|
6570
|
+
function Bn(s, t, e, n) {
|
|
6560
6571
|
return typeof s == "function" ? s({
|
|
6561
6572
|
context: t,
|
|
6562
6573
|
event: e,
|
|
@@ -6578,7 +6589,7 @@ function $i(s) {
|
|
|
6578
6589
|
if (!(s === void 0 || s === sc))
|
|
6579
6590
|
return vt(s);
|
|
6580
6591
|
}
|
|
6581
|
-
function
|
|
6592
|
+
function Pn(s, t, e) {
|
|
6582
6593
|
var r, o, a;
|
|
6583
6594
|
const n = typeof s == "object", i = n ? s : void 0;
|
|
6584
6595
|
return {
|
|
@@ -6606,24 +6617,24 @@ function dc(s, t) {
|
|
|
6606
6617
|
clock: a,
|
|
6607
6618
|
logger: c
|
|
6608
6619
|
} = t, h = {
|
|
6609
|
-
schedule: (f, m, d,
|
|
6620
|
+
schedule: (f, m, d, y, _ = Math.random().toString(36).slice(2)) => {
|
|
6610
6621
|
const x = {
|
|
6611
6622
|
source: f,
|
|
6612
6623
|
target: m,
|
|
6613
6624
|
event: d,
|
|
6614
|
-
delay:
|
|
6625
|
+
delay: y,
|
|
6615
6626
|
id: _,
|
|
6616
6627
|
startedAt: Date.now()
|
|
6617
|
-
},
|
|
6618
|
-
u._snapshot._scheduledEvents[
|
|
6628
|
+
}, T = Rs(f, _);
|
|
6629
|
+
u._snapshot._scheduledEvents[T] = x;
|
|
6619
6630
|
const R = a.setTimeout(() => {
|
|
6620
|
-
delete o[
|
|
6621
|
-
},
|
|
6622
|
-
o[
|
|
6631
|
+
delete o[T], delete u._snapshot._scheduledEvents[T], u._relay(f, m, d);
|
|
6632
|
+
}, y);
|
|
6633
|
+
o[T] = R;
|
|
6623
6634
|
},
|
|
6624
6635
|
cancel: (f, m) => {
|
|
6625
|
-
const d = Rs(f, m),
|
|
6626
|
-
delete o[d], delete u._snapshot._scheduledEvents[d],
|
|
6636
|
+
const d = Rs(f, m), y = o[d];
|
|
6637
|
+
delete o[d], delete u._snapshot._scheduledEvents[d], y !== void 0 && a.clearTimeout(y);
|
|
6627
6638
|
},
|
|
6628
6639
|
cancelAll: (f) => {
|
|
6629
6640
|
for (const m in u._snapshot._scheduledEvents) {
|
|
@@ -6639,8 +6650,8 @@ function dc(s, t) {
|
|
|
6639
6650
|
rootId: s.sessionId
|
|
6640
6651
|
};
|
|
6641
6652
|
r.forEach((d) => {
|
|
6642
|
-
var
|
|
6643
|
-
return (
|
|
6653
|
+
var y;
|
|
6654
|
+
return (y = d.next) == null ? void 0 : y.call(d, m);
|
|
6644
6655
|
});
|
|
6645
6656
|
}, u = {
|
|
6646
6657
|
_snapshot: {
|
|
@@ -6661,7 +6672,7 @@ function dc(s, t) {
|
|
|
6661
6672
|
n.set(f, m), i.set(m, f);
|
|
6662
6673
|
},
|
|
6663
6674
|
inspect: (f) => {
|
|
6664
|
-
const m =
|
|
6675
|
+
const m = Pn(f);
|
|
6665
6676
|
return r.add(m), {
|
|
6666
6677
|
unsubscribe() {
|
|
6667
6678
|
r.delete(m);
|
|
@@ -6689,12 +6700,12 @@ function dc(s, t) {
|
|
|
6689
6700
|
for (const m in f) {
|
|
6690
6701
|
const {
|
|
6691
6702
|
source: d,
|
|
6692
|
-
target:
|
|
6703
|
+
target: y,
|
|
6693
6704
|
event: _,
|
|
6694
6705
|
delay: x,
|
|
6695
|
-
id:
|
|
6706
|
+
id: T
|
|
6696
6707
|
} = f[m];
|
|
6697
|
-
h.schedule(d,
|
|
6708
|
+
h.schedule(d, y, _, x, T);
|
|
6698
6709
|
}
|
|
6699
6710
|
},
|
|
6700
6711
|
_clock: a,
|
|
@@ -6739,7 +6750,7 @@ class mc {
|
|
|
6739
6750
|
this.system = o ? o.system : dc(this, {
|
|
6740
6751
|
clock: i,
|
|
6741
6752
|
logger: r
|
|
6742
|
-
}), l && !o && this.system.inspect(
|
|
6753
|
+
}), l && !o && this.system.inspect(Pn(l)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (e == null ? void 0 : e.logger) ?? this.system._logger, this.clock = (e == null ? void 0 : e.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = n, this.src = n.src ?? t, this.ref = this, this._actorScope = {
|
|
6743
6754
|
self: this,
|
|
6744
6755
|
id: this.id,
|
|
6745
6756
|
sessionId: this.sessionId,
|
|
@@ -6758,8 +6769,8 @@ class mc {
|
|
|
6758
6769
|
if (!f && !m)
|
|
6759
6770
|
return;
|
|
6760
6771
|
const d = /* @__PURE__ */ new Set([...f ? f.values() : [], ...m ? m.values() : []]);
|
|
6761
|
-
for (const
|
|
6762
|
-
|
|
6772
|
+
for (const y of Array.from(d))
|
|
6773
|
+
y(u);
|
|
6763
6774
|
}
|
|
6764
6775
|
}, this.send = this.send.bind(this), this.system._sendInspectionEvent({
|
|
6765
6776
|
type: "@xstate.actor",
|
|
@@ -6882,7 +6893,7 @@ class mc {
|
|
|
6882
6893
|
*/
|
|
6883
6894
|
subscribe(t, e, n) {
|
|
6884
6895
|
var r;
|
|
6885
|
-
const i =
|
|
6896
|
+
const i = Pn(t, e, n);
|
|
6886
6897
|
if (this._processingStatus !== q.Stopped)
|
|
6887
6898
|
this.observers.add(i);
|
|
6888
6899
|
else
|
|
@@ -6981,11 +6992,11 @@ class mc {
|
|
|
6981
6992
|
}, this._error(i);
|
|
6982
6993
|
return;
|
|
6983
6994
|
}
|
|
6984
|
-
this.update(e, t), t.type ===
|
|
6995
|
+
this.update(e, t), t.type === $n && (this._stopProcedure(), this._complete());
|
|
6985
6996
|
}
|
|
6986
6997
|
_stop() {
|
|
6987
6998
|
return this._processingStatus === q.Stopped ? this : (this.mailbox.clear(), this._processingStatus === q.NotStarted ? (this._processingStatus = q.Stopped, this) : (this.mailbox.enqueue({
|
|
6988
|
-
type:
|
|
6999
|
+
type: $n
|
|
6989
7000
|
}), this));
|
|
6990
7001
|
}
|
|
6991
7002
|
/** Stops the Actor and unsubscribe all listeners. */
|
|
@@ -7213,7 +7224,7 @@ const ls = (s) => s.type === "atomic" || s.type === "final";
|
|
|
7213
7224
|
function se(s) {
|
|
7214
7225
|
return Object.values(s.states).filter((t) => t.type !== "history");
|
|
7215
7226
|
}
|
|
7216
|
-
function
|
|
7227
|
+
function Ie(s, t) {
|
|
7217
7228
|
const e = [];
|
|
7218
7229
|
if (t === s)
|
|
7219
7230
|
return e;
|
|
@@ -7222,7 +7233,7 @@ function Oe(s, t) {
|
|
|
7222
7233
|
e.push(n), n = n.parent;
|
|
7223
7234
|
return e;
|
|
7224
7235
|
}
|
|
7225
|
-
function
|
|
7236
|
+
function Ge(s) {
|
|
7226
7237
|
const t = new Set(s), e = Pi(t);
|
|
7227
7238
|
for (const n of t)
|
|
7228
7239
|
if (n.type === "compound" && (!e.get(n) || !e.get(n).length))
|
|
@@ -7266,13 +7277,13 @@ function Pi(s) {
|
|
|
7266
7277
|
return t;
|
|
7267
7278
|
}
|
|
7268
7279
|
function ji(s, t) {
|
|
7269
|
-
const e =
|
|
7280
|
+
const e = Ge(t);
|
|
7270
7281
|
return Bi(s, Pi(e));
|
|
7271
7282
|
}
|
|
7272
7283
|
function us(s, t) {
|
|
7273
7284
|
return t.type === "compound" ? se(t).some((e) => e.type === "final" && s.has(e)) : t.type === "parallel" ? se(t).every((e) => us(s, e)) : t.type === "final";
|
|
7274
7285
|
}
|
|
7275
|
-
const
|
|
7286
|
+
const on = (s) => s[0] === ic;
|
|
7276
7287
|
function xc(s, t) {
|
|
7277
7288
|
return s.transitions.get(t) || [...s.transitions.keys()].filter((n) => {
|
|
7278
7289
|
if (n === rc)
|
|
@@ -7321,7 +7332,7 @@ function Ec(s) {
|
|
|
7321
7332
|
});
|
|
7322
7333
|
}
|
|
7323
7334
|
function Nt(s, t, e) {
|
|
7324
|
-
const n = $i(e.target), i = e.reenter ?? !1, r =
|
|
7335
|
+
const n = $i(e.target), i = e.reenter ?? !1, r = kc(s, n), o = {
|
|
7325
7336
|
...e,
|
|
7326
7337
|
actions: vt(e.actions),
|
|
7327
7338
|
guard: e.guard,
|
|
@@ -7337,7 +7348,7 @@ function Nt(s, t, e) {
|
|
|
7337
7348
|
};
|
|
7338
7349
|
return o;
|
|
7339
7350
|
}
|
|
7340
|
-
function
|
|
7351
|
+
function Tc(s) {
|
|
7341
7352
|
const t = /* @__PURE__ */ new Map();
|
|
7342
7353
|
if (s.config.on)
|
|
7343
7354
|
for (const e of Object.keys(s.config.on)) {
|
|
@@ -7370,7 +7381,7 @@ function kc(s) {
|
|
|
7370
7381
|
}
|
|
7371
7382
|
return t;
|
|
7372
7383
|
}
|
|
7373
|
-
function
|
|
7384
|
+
function Oc(s, t) {
|
|
7374
7385
|
const e = typeof t == "string" ? s.states[t] : t ? s.states[t.target] : void 0;
|
|
7375
7386
|
if (!e && t)
|
|
7376
7387
|
throw new Error(`Initial state node "${t}" not found on parent state node #${s.id}`);
|
|
@@ -7388,20 +7399,20 @@ function Tc(s, t) {
|
|
|
7388
7399
|
};
|
|
7389
7400
|
return n;
|
|
7390
7401
|
}
|
|
7391
|
-
function
|
|
7402
|
+
function kc(s, t) {
|
|
7392
7403
|
if (t !== void 0)
|
|
7393
7404
|
return t.map((e) => {
|
|
7394
7405
|
if (typeof e != "string")
|
|
7395
7406
|
return e;
|
|
7396
|
-
if (
|
|
7407
|
+
if (on(e))
|
|
7397
7408
|
return s.machine.getStateNodeById(e);
|
|
7398
7409
|
const n = e[0] === Ii;
|
|
7399
7410
|
if (n && !s.parent)
|
|
7400
|
-
return
|
|
7411
|
+
return Ye(s, e.slice(1));
|
|
7401
7412
|
const i = n ? s.key + e : e;
|
|
7402
7413
|
if (s.parent)
|
|
7403
7414
|
try {
|
|
7404
|
-
return
|
|
7415
|
+
return Ye(s.parent, i);
|
|
7405
7416
|
} catch (r) {
|
|
7406
7417
|
throw new Error(`Invalid transition definition for state node '${s.id}':
|
|
7407
7418
|
${r.message}`);
|
|
@@ -7413,7 +7424,7 @@ ${r.message}`);
|
|
|
7413
7424
|
function zi(s) {
|
|
7414
7425
|
const t = $i(s.config.target);
|
|
7415
7426
|
return t ? {
|
|
7416
|
-
target: t.map((e) => typeof e == "string" ?
|
|
7427
|
+
target: t.map((e) => typeof e == "string" ? Ye(s.parent, e) : e)
|
|
7417
7428
|
} : s.parent.initial;
|
|
7418
7429
|
}
|
|
7419
7430
|
function Mt(s) {
|
|
@@ -7422,7 +7433,7 @@ function Mt(s) {
|
|
|
7422
7433
|
function Hs(s) {
|
|
7423
7434
|
const t = Li(s);
|
|
7424
7435
|
for (const e of t)
|
|
7425
|
-
for (const n of
|
|
7436
|
+
for (const n of Ie(e, s))
|
|
7426
7437
|
t.add(n);
|
|
7427
7438
|
return t;
|
|
7428
7439
|
}
|
|
@@ -7440,7 +7451,7 @@ function Li(s) {
|
|
|
7440
7451
|
return e(s), t;
|
|
7441
7452
|
}
|
|
7442
7453
|
function ie(s, t) {
|
|
7443
|
-
if (
|
|
7454
|
+
if (on(t))
|
|
7444
7455
|
return s.machine.getStateNodeById(t);
|
|
7445
7456
|
if (!s.states)
|
|
7446
7457
|
throw new Error(`Unable to retrieve child state '${t}' from '${s.id}'; no child states exist.`);
|
|
@@ -7449,8 +7460,8 @@ function ie(s, t) {
|
|
|
7449
7460
|
throw new Error(`Child state '${t}' does not exist on '${s.id}'`);
|
|
7450
7461
|
return e;
|
|
7451
7462
|
}
|
|
7452
|
-
function
|
|
7453
|
-
if (typeof t == "string" &&
|
|
7463
|
+
function Ye(s, t) {
|
|
7464
|
+
if (typeof t == "string" && on(t))
|
|
7454
7465
|
try {
|
|
7455
7466
|
return s.machine.getStateNodeById(t);
|
|
7456
7467
|
} catch {
|
|
@@ -7465,7 +7476,7 @@ function Ge(s, t) {
|
|
|
7465
7476
|
}
|
|
7466
7477
|
return n;
|
|
7467
7478
|
}
|
|
7468
|
-
function
|
|
7479
|
+
function Xe(s, t) {
|
|
7469
7480
|
if (typeof t == "string") {
|
|
7470
7481
|
const i = s.states[t];
|
|
7471
7482
|
if (!i)
|
|
@@ -7477,7 +7488,7 @@ function Ye(s, t) {
|
|
|
7477
7488
|
const o = ie(s, r);
|
|
7478
7489
|
if (!o)
|
|
7479
7490
|
return i;
|
|
7480
|
-
const a =
|
|
7491
|
+
const a = Xe(o, t[r]);
|
|
7481
7492
|
return i.concat(a);
|
|
7482
7493
|
}, []));
|
|
7483
7494
|
}
|
|
@@ -7528,7 +7539,7 @@ function Ki(s, t, e) {
|
|
|
7528
7539
|
let r = !1;
|
|
7529
7540
|
const o = /* @__PURE__ */ new Set();
|
|
7530
7541
|
for (const a of n)
|
|
7531
|
-
if (Mc(
|
|
7542
|
+
if (Mc(jn([i], t, e), jn([a], t, e)))
|
|
7532
7543
|
if (xt(i.source, a.source))
|
|
7533
7544
|
o.add(a);
|
|
7534
7545
|
else {
|
|
@@ -7545,7 +7556,7 @@ function Ki(s, t, e) {
|
|
|
7545
7556
|
}
|
|
7546
7557
|
function Rc(s) {
|
|
7547
7558
|
const [t, ...e] = s;
|
|
7548
|
-
for (const n of
|
|
7559
|
+
for (const n of Ie(t, void 0))
|
|
7549
7560
|
if (e.every((i) => xt(i, n)))
|
|
7550
7561
|
return n;
|
|
7551
7562
|
}
|
|
@@ -7565,7 +7576,7 @@ function ds(s, t) {
|
|
|
7565
7576
|
e.add(n);
|
|
7566
7577
|
return [...e];
|
|
7567
7578
|
}
|
|
7568
|
-
function
|
|
7579
|
+
function Ui(s, t) {
|
|
7569
7580
|
const e = ds(s, t);
|
|
7570
7581
|
if (!e)
|
|
7571
7582
|
return;
|
|
@@ -7577,12 +7588,12 @@ function Fi(s, t) {
|
|
|
7577
7588
|
if (!s.reenter)
|
|
7578
7589
|
return s.source.machine.root;
|
|
7579
7590
|
}
|
|
7580
|
-
function
|
|
7591
|
+
function jn(s, t, e) {
|
|
7581
7592
|
var i;
|
|
7582
7593
|
const n = /* @__PURE__ */ new Set();
|
|
7583
7594
|
for (const r of s)
|
|
7584
7595
|
if ((i = r.target) != null && i.length) {
|
|
7585
|
-
const o =
|
|
7596
|
+
const o = Ui(r, e);
|
|
7586
7597
|
r.reenter && r.source === o && n.add(o);
|
|
7587
7598
|
for (const a of t)
|
|
7588
7599
|
xt(a, o) && n.add(a);
|
|
@@ -7597,7 +7608,7 @@ function Hc(s, t) {
|
|
|
7597
7608
|
return !1;
|
|
7598
7609
|
return !0;
|
|
7599
7610
|
}
|
|
7600
|
-
function
|
|
7611
|
+
function zn(s, t, e, n, i, r) {
|
|
7601
7612
|
if (!s.length)
|
|
7602
7613
|
return t;
|
|
7603
7614
|
const o = new Set(t._nodes);
|
|
@@ -7619,8 +7630,8 @@ function jn(s, t, e, n, i, r) {
|
|
|
7619
7630
|
function $c(s, t, e, n, i) {
|
|
7620
7631
|
if (n.output === void 0)
|
|
7621
7632
|
return;
|
|
7622
|
-
const r =
|
|
7623
|
-
return
|
|
7633
|
+
const r = Wn(i.id, i.output !== void 0 && i.parent ? Bn(i.output, s.context, t, e.self) : void 0);
|
|
7634
|
+
return Bn(n.output, s.context, r, e.self);
|
|
7624
7635
|
}
|
|
7625
7636
|
function Wc(s, t, e, n, i, r, o, a) {
|
|
7626
7637
|
let c = s;
|
|
@@ -7642,10 +7653,10 @@ function Wc(s, t, e, n, i, r, o, a) {
|
|
|
7642
7653
|
}
|
|
7643
7654
|
if (c = re(c, t, e, m, r, f.invoke.map((d) => d.id)), f.type === "final") {
|
|
7644
7655
|
const d = f.parent;
|
|
7645
|
-
let
|
|
7646
|
-
for ((d == null ? void 0 : d.type) === "compound" && r.push(
|
|
7647
|
-
u.add(
|
|
7648
|
-
if (
|
|
7656
|
+
let y = (d == null ? void 0 : d.type) === "parallel" ? d : d == null ? void 0 : d.parent, _ = y || f;
|
|
7657
|
+
for ((d == null ? void 0 : d.type) === "compound" && r.push(Wn(d.id, f.output !== void 0 ? Bn(f.output, c.context, t, e.self) : void 0)); (y == null ? void 0 : y.type) === "parallel" && !u.has(y) && us(i, y); )
|
|
7658
|
+
u.add(y), r.push(Wn(y.id)), _ = y, y = y.parent;
|
|
7659
|
+
if (y)
|
|
7649
7660
|
continue;
|
|
7650
7661
|
c = jt(c, {
|
|
7651
7662
|
status: "done",
|
|
@@ -7657,7 +7668,7 @@ function Wc(s, t, e, n, i, r, o, a) {
|
|
|
7657
7668
|
}
|
|
7658
7669
|
function Bc(s, t, e, n) {
|
|
7659
7670
|
for (const i of s) {
|
|
7660
|
-
const r =
|
|
7671
|
+
const r = Ui(i, t);
|
|
7661
7672
|
for (const a of i.target || [])
|
|
7662
7673
|
!Mt(a) && // if the target is different than the source then it will *definitely* be entered
|
|
7663
7674
|
(i.source !== a || // we know that the domain can't lie within the source
|
|
@@ -7666,8 +7677,8 @@ function Bc(s, t, e, n) {
|
|
|
7666
7677
|
i.reenter) && (n.add(a), e.add(a)), Yt(a, t, e, n);
|
|
7667
7678
|
const o = ds(i, t);
|
|
7668
7679
|
for (const a of o) {
|
|
7669
|
-
const c =
|
|
7670
|
-
(r == null ? void 0 : r.type) === "parallel" && c.push(r),
|
|
7680
|
+
const c = Ie(a, r);
|
|
7681
|
+
(r == null ? void 0 : r.type) === "parallel" && c.push(r), Fi(n, t, e, c, !i.source.parent && i.reenter ? void 0 : r);
|
|
7671
7682
|
}
|
|
7672
7683
|
}
|
|
7673
7684
|
}
|
|
@@ -7679,33 +7690,33 @@ function Yt(s, t, e, n) {
|
|
|
7679
7690
|
for (const o of r)
|
|
7680
7691
|
n.add(o), Yt(o, t, e, n);
|
|
7681
7692
|
for (const o of r)
|
|
7682
|
-
|
|
7693
|
+
wn(o, s.parent, n, t, e);
|
|
7683
7694
|
} else {
|
|
7684
7695
|
const r = zi(s);
|
|
7685
7696
|
for (const o of r.target)
|
|
7686
7697
|
n.add(o), r === ((i = s.parent) == null ? void 0 : i.initial) && e.add(s.parent), Yt(o, t, e, n);
|
|
7687
7698
|
for (const o of r.target)
|
|
7688
|
-
|
|
7699
|
+
wn(o, s.parent, n, t, e);
|
|
7689
7700
|
}
|
|
7690
7701
|
else if (s.type === "compound") {
|
|
7691
7702
|
const [r] = s.initial.target;
|
|
7692
|
-
Mt(r) || (n.add(r), e.add(r)), Yt(r, t, e, n),
|
|
7703
|
+
Mt(r) || (n.add(r), e.add(r)), Yt(r, t, e, n), wn(r, s, n, t, e);
|
|
7693
7704
|
} else if (s.type === "parallel")
|
|
7694
7705
|
for (const r of se(s).filter((o) => !Mt(o)))
|
|
7695
7706
|
[...n].some((o) => xt(o, r)) || (Mt(r) || (n.add(r), e.add(r)), Yt(r, t, e, n));
|
|
7696
7707
|
}
|
|
7697
|
-
function
|
|
7708
|
+
function Fi(s, t, e, n, i) {
|
|
7698
7709
|
for (const r of n)
|
|
7699
7710
|
if ((!i || xt(r, i)) && s.add(r), r.type === "parallel")
|
|
7700
7711
|
for (const o of se(r).filter((a) => !Mt(a)))
|
|
7701
7712
|
[...s].some((a) => xt(a, o)) || (s.add(o), Yt(o, t, e, s));
|
|
7702
7713
|
}
|
|
7703
|
-
function
|
|
7704
|
-
|
|
7714
|
+
function wn(s, t, e, n, i) {
|
|
7715
|
+
Fi(e, n, i, Ie(s, t));
|
|
7705
7716
|
}
|
|
7706
7717
|
function Pc(s, t, e, n, i, r, o) {
|
|
7707
7718
|
let a = s;
|
|
7708
|
-
const c =
|
|
7719
|
+
const c = jn(n, i, r);
|
|
7709
7720
|
c.sort((l, u) => u.order - l.order);
|
|
7710
7721
|
let h;
|
|
7711
7722
|
for (const l of c)
|
|
@@ -7764,7 +7775,7 @@ function qi(s, t, e, n, i, r) {
|
|
|
7764
7775
|
});
|
|
7765
7776
|
continue;
|
|
7766
7777
|
}
|
|
7767
|
-
const d = l, [
|
|
7778
|
+
const d = l, [y, _, x] = d.resolve(
|
|
7768
7779
|
e,
|
|
7769
7780
|
a,
|
|
7770
7781
|
u,
|
|
@@ -7773,7 +7784,7 @@ function qi(s, t, e, n, i, r) {
|
|
|
7773
7784
|
// this holds all params
|
|
7774
7785
|
i
|
|
7775
7786
|
);
|
|
7776
|
-
a =
|
|
7787
|
+
a = y, "retryResolve" in d && (r == null || r.push([d, _])), "execute" in d && (e.self._processingStatus === q.Running ? d.execute(e, _) : e.defer(d.execute.bind(null, e, _))), x && (a = qi(a, t, e, x, i, r));
|
|
7777
7788
|
}
|
|
7778
7789
|
return a;
|
|
7779
7790
|
}
|
|
@@ -7786,7 +7797,7 @@ function re(s, t, e, n, i, r) {
|
|
|
7786
7797
|
c.retryResolve(e, a, h);
|
|
7787
7798
|
}), a;
|
|
7788
7799
|
}
|
|
7789
|
-
function
|
|
7800
|
+
function _n(s, t, e, n = []) {
|
|
7790
7801
|
let i = s;
|
|
7791
7802
|
const r = [];
|
|
7792
7803
|
function o(h, l, u) {
|
|
@@ -7798,7 +7809,7 @@ function wn(s, t, e, n = []) {
|
|
|
7798
7809
|
_transitions: u
|
|
7799
7810
|
}), r.push(h);
|
|
7800
7811
|
}
|
|
7801
|
-
if (t.type ===
|
|
7812
|
+
if (t.type === $n)
|
|
7802
7813
|
return i = jt(Ws(i, t, e), {
|
|
7803
7814
|
status: "stopped"
|
|
7804
7815
|
}), o(i, t, []), {
|
|
@@ -7816,7 +7827,7 @@ function wn(s, t, e, n = []) {
|
|
|
7816
7827
|
snapshot: i,
|
|
7817
7828
|
microstates: r
|
|
7818
7829
|
};
|
|
7819
|
-
i =
|
|
7830
|
+
i = zn(
|
|
7820
7831
|
u,
|
|
7821
7832
|
s,
|
|
7822
7833
|
e,
|
|
@@ -7835,7 +7846,7 @@ function wn(s, t, e, n = []) {
|
|
|
7835
7846
|
break;
|
|
7836
7847
|
a = n.shift(), h = Bs(a, i);
|
|
7837
7848
|
}
|
|
7838
|
-
i =
|
|
7849
|
+
i = zn(h, i, e, a, !1, n), c = i !== l, o(i, a, h);
|
|
7839
7850
|
}
|
|
7840
7851
|
return i.status !== "active" && Ws(i, a, e), {
|
|
7841
7852
|
snapshot: i,
|
|
@@ -7851,7 +7862,7 @@ function Bs(s, t) {
|
|
|
7851
7862
|
function jc(s, t) {
|
|
7852
7863
|
const e = /* @__PURE__ */ new Set(), n = s._nodes.filter(ls);
|
|
7853
7864
|
for (const i of n)
|
|
7854
|
-
t: for (const r of [i].concat(
|
|
7865
|
+
t: for (const r of [i].concat(Ie(i, void 0)))
|
|
7855
7866
|
if (r.always) {
|
|
7856
7867
|
for (const o of r.always)
|
|
7857
7868
|
if (o.guard === void 0 || hs(o.guard, s.context, t, s)) {
|
|
@@ -7862,7 +7873,7 @@ function jc(s, t) {
|
|
|
7862
7873
|
return Ki(Array.from(e), new Set(s._nodes), s.historyValue);
|
|
7863
7874
|
}
|
|
7864
7875
|
function zc(s, t) {
|
|
7865
|
-
const e =
|
|
7876
|
+
const e = Ge(Xe(s, t));
|
|
7866
7877
|
return ji(s, [...e]);
|
|
7867
7878
|
}
|
|
7868
7879
|
function Lc(s) {
|
|
@@ -7870,9 +7881,9 @@ function Lc(s) {
|
|
|
7870
7881
|
}
|
|
7871
7882
|
const Kc = function(t) {
|
|
7872
7883
|
return Mi(t, this.value);
|
|
7873
|
-
}, Fc = function(t) {
|
|
7874
|
-
return this.tags.has(t);
|
|
7875
7884
|
}, Uc = function(t) {
|
|
7885
|
+
return this.tags.has(t);
|
|
7886
|
+
}, Fc = function(t) {
|
|
7876
7887
|
const e = this.machine.getTransitionData(this, t);
|
|
7877
7888
|
return !!(e != null && e.length) && // Check that at least one transition is not forbidden
|
|
7878
7889
|
e.some((n) => n.target !== void 0 || n.actions.length);
|
|
@@ -7895,7 +7906,7 @@ const Kc = function(t) {
|
|
|
7895
7906
|
}, Zc = function() {
|
|
7896
7907
|
return this._nodes.reduce((t, e) => (e.meta !== void 0 && (t[e.id] = e.meta), t), {});
|
|
7897
7908
|
};
|
|
7898
|
-
function
|
|
7909
|
+
function Be(s, t) {
|
|
7899
7910
|
return {
|
|
7900
7911
|
status: s.status,
|
|
7901
7912
|
output: s.output,
|
|
@@ -7908,14 +7919,14 @@ function We(s, t) {
|
|
|
7908
7919
|
children: s.children,
|
|
7909
7920
|
historyValue: s.historyValue || {},
|
|
7910
7921
|
matches: Kc,
|
|
7911
|
-
hasTag:
|
|
7912
|
-
can:
|
|
7922
|
+
hasTag: Uc,
|
|
7923
|
+
can: Fc,
|
|
7913
7924
|
getMeta: Zc,
|
|
7914
7925
|
toJSON: qc
|
|
7915
7926
|
};
|
|
7916
7927
|
}
|
|
7917
7928
|
function jt(s, t = {}) {
|
|
7918
|
-
return
|
|
7929
|
+
return Be({
|
|
7919
7930
|
...s,
|
|
7920
7931
|
...t
|
|
7921
7932
|
}, s.machine);
|
|
@@ -7934,9 +7945,9 @@ function Gc(s, t) {
|
|
|
7934
7945
|
toJSON: u,
|
|
7935
7946
|
...f
|
|
7936
7947
|
} = s, m = {};
|
|
7937
|
-
for (const
|
|
7938
|
-
const _ = r[
|
|
7939
|
-
m[
|
|
7948
|
+
for (const y in r) {
|
|
7949
|
+
const _ = r[y];
|
|
7950
|
+
m[y] = {
|
|
7940
7951
|
snapshot: _.getPersistedSnapshot(t),
|
|
7941
7952
|
src: _.src,
|
|
7942
7953
|
systemId: _._systemId,
|
|
@@ -8090,7 +8101,7 @@ function th(s) {
|
|
|
8090
8101
|
return t.type = "xstate.assign", t.assignment = s, t.resolve = Qc, t;
|
|
8091
8102
|
}
|
|
8092
8103
|
const Ps = /* @__PURE__ */ new WeakMap();
|
|
8093
|
-
function
|
|
8104
|
+
function Ft(s, t, e) {
|
|
8094
8105
|
let n = Ps.get(s);
|
|
8095
8106
|
return n ? t in n || (n[t] = e()) : (n = {
|
|
8096
8107
|
[t]: e()
|
|
@@ -8115,7 +8126,7 @@ class ps {
|
|
|
8115
8126
|
}
|
|
8116
8127
|
/** @internal */
|
|
8117
8128
|
_initialize() {
|
|
8118
|
-
this.transitions =
|
|
8129
|
+
this.transitions = Tc(this), this.config.always && (this.always = qt(this.config.always).map((t) => Nt(this, Ni, t))), Object.keys(this.states).forEach((t) => {
|
|
8119
8130
|
this.states[t]._initialize();
|
|
8120
8131
|
});
|
|
8121
8132
|
}
|
|
@@ -8162,7 +8173,7 @@ class ps {
|
|
|
8162
8173
|
}
|
|
8163
8174
|
/** The logic invoked as actors by this state node. */
|
|
8164
8175
|
get invoke() {
|
|
8165
|
-
return
|
|
8176
|
+
return Ft(this, "invoke", () => vt(this.config.invoke).map((t, e) => {
|
|
8166
8177
|
const {
|
|
8167
8178
|
src: n,
|
|
8168
8179
|
systemId: i
|
|
@@ -8190,19 +8201,19 @@ class ps {
|
|
|
8190
8201
|
}
|
|
8191
8202
|
/** The mapping of events to transitions. */
|
|
8192
8203
|
get on() {
|
|
8193
|
-
return
|
|
8204
|
+
return Ft(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), {}));
|
|
8194
8205
|
}
|
|
8195
8206
|
get after() {
|
|
8196
|
-
return
|
|
8207
|
+
return Ft(this, "delayedTransitions", () => Ec(this));
|
|
8197
8208
|
}
|
|
8198
8209
|
get initial() {
|
|
8199
|
-
return
|
|
8210
|
+
return Ft(this, "initial", () => Oc(this, this.config.initial));
|
|
8200
8211
|
}
|
|
8201
8212
|
/** @internal */
|
|
8202
8213
|
next(t, e) {
|
|
8203
8214
|
const n = e.type, i = [];
|
|
8204
8215
|
let r;
|
|
8205
|
-
const o =
|
|
8216
|
+
const o = Ft(this, `candidates-${n}`, () => xc(this, n));
|
|
8206
8217
|
for (const a of o) {
|
|
8207
8218
|
const {
|
|
8208
8219
|
guard: c
|
|
@@ -8224,7 +8235,7 @@ ${u.message}`);
|
|
|
8224
8235
|
}
|
|
8225
8236
|
/** All the event types accepted by this state node and its descendants. */
|
|
8226
8237
|
get events() {
|
|
8227
|
-
return
|
|
8238
|
+
return Ft(this, "events", () => {
|
|
8228
8239
|
const {
|
|
8229
8240
|
states: t
|
|
8230
8241
|
} = this, e = new Set(this.ownEvents);
|
|
@@ -8296,8 +8307,8 @@ class ms {
|
|
|
8296
8307
|
});
|
|
8297
8308
|
}
|
|
8298
8309
|
resolveState(t) {
|
|
8299
|
-
const e = zc(this.root, t.value), n =
|
|
8300
|
-
return
|
|
8310
|
+
const e = zc(this.root, t.value), n = Ge(Xe(this.root, e));
|
|
8311
|
+
return Be({
|
|
8301
8312
|
_nodes: [...n],
|
|
8302
8313
|
context: t.context || {},
|
|
8303
8314
|
children: {},
|
|
@@ -8315,7 +8326,7 @@ class ms {
|
|
|
8315
8326
|
* @param event The received event
|
|
8316
8327
|
*/
|
|
8317
8328
|
transition(t, e, n) {
|
|
8318
|
-
return
|
|
8329
|
+
return _n(t, e, n).snapshot;
|
|
8319
8330
|
}
|
|
8320
8331
|
/**
|
|
8321
8332
|
* Determines the next state given the current `state` and `event`. Calculates
|
|
@@ -8325,7 +8336,7 @@ class ms {
|
|
|
8325
8336
|
* @param event The received event
|
|
8326
8337
|
*/
|
|
8327
8338
|
microstep(t, e, n) {
|
|
8328
|
-
return
|
|
8339
|
+
return _n(t, e, n).microstates;
|
|
8329
8340
|
}
|
|
8330
8341
|
getTransitionData(t, e) {
|
|
8331
8342
|
return fs(this.root, t.value, t, e) || [];
|
|
@@ -8337,7 +8348,7 @@ class ms {
|
|
|
8337
8348
|
getPreInitialState(t, e, n) {
|
|
8338
8349
|
const {
|
|
8339
8350
|
context: i
|
|
8340
|
-
} = this.config, r =
|
|
8351
|
+
} = this.config, r = Be({
|
|
8341
8352
|
context: typeof i != "function" && i ? i : {},
|
|
8342
8353
|
_nodes: [this.root],
|
|
8343
8354
|
children: {},
|
|
@@ -8358,7 +8369,7 @@ class ms {
|
|
|
8358
8369
|
* `ActorRef`.
|
|
8359
8370
|
*/
|
|
8360
8371
|
getInitialSnapshot(t, e) {
|
|
8361
|
-
const n = Ci(e), i = [], r = this.getPreInitialState(t, n, i), o =
|
|
8372
|
+
const n = Ci(e), i = [], r = this.getPreInitialState(t, n, i), o = zn([{
|
|
8362
8373
|
target: [...Li(this.root)],
|
|
8363
8374
|
source: this.root,
|
|
8364
8375
|
reenter: !0,
|
|
@@ -8368,7 +8379,7 @@ class ms {
|
|
|
8368
8379
|
// TODO: fix
|
|
8369
8380
|
}], r, t, n, !0, i), {
|
|
8370
8381
|
snapshot: a
|
|
8371
|
-
} =
|
|
8382
|
+
} = _n(o, n, t, i);
|
|
8372
8383
|
return a;
|
|
8373
8384
|
}
|
|
8374
8385
|
start(t) {
|
|
@@ -8377,10 +8388,10 @@ class ms {
|
|
|
8377
8388
|
});
|
|
8378
8389
|
}
|
|
8379
8390
|
getStateNodeById(t) {
|
|
8380
|
-
const e = os(t), n = e.slice(1), i =
|
|
8391
|
+
const e = os(t), n = e.slice(1), i = on(e[0]) ? e[0].slice(nh.length) : e[0], r = this.idMap.get(i);
|
|
8381
8392
|
if (!r)
|
|
8382
8393
|
throw new Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);
|
|
8383
|
-
return
|
|
8394
|
+
return Ye(r, n);
|
|
8384
8395
|
}
|
|
8385
8396
|
get definition() {
|
|
8386
8397
|
return this.root.definition;
|
|
@@ -8407,10 +8418,10 @@ class ms {
|
|
|
8407
8418
|
});
|
|
8408
8419
|
n[c] = m;
|
|
8409
8420
|
});
|
|
8410
|
-
const r =
|
|
8421
|
+
const r = Be({
|
|
8411
8422
|
...t,
|
|
8412
8423
|
children: n,
|
|
8413
|
-
_nodes: Array.from(
|
|
8424
|
+
_nodes: Array.from(Ge(Xe(this.root, t.value)))
|
|
8414
8425
|
}, this);
|
|
8415
8426
|
let o = /* @__PURE__ */ new Set();
|
|
8416
8427
|
function a(c, h) {
|
|
@@ -8434,11 +8445,11 @@ class ms {
|
|
|
8434
8445
|
function sh(s, t) {
|
|
8435
8446
|
return new ms(s, t);
|
|
8436
8447
|
}
|
|
8437
|
-
const
|
|
8448
|
+
const Re = (s) => s === !1 ? !1 : s.map((t) => t.serialize()), ih = (s) => s === !1 ? !1 : s.serialize(), rh = (s) => s === !1 ? !1 : s.map((t) => ({
|
|
8438
8449
|
tile: t.tile.toString(),
|
|
8439
8450
|
candidates: t.candidates.map((e) => e.toString()),
|
|
8440
8451
|
shanten: t.shanten
|
|
8441
|
-
})),
|
|
8452
|
+
})), Ln = (s) => JSON.parse(JSON.stringify(s)), He = (s) => s === !1 ? !1 : Ln(s), js = (s) => sh(
|
|
8442
8453
|
{
|
|
8443
8454
|
id: "Untitled",
|
|
8444
8455
|
initial: "distribute",
|
|
@@ -8789,15 +8800,15 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8789
8800
|
wind: i,
|
|
8790
8801
|
drawerInfo: { wind: i, tile: r.toString() },
|
|
8791
8802
|
choices: {
|
|
8792
|
-
TSUMO:
|
|
8803
|
+
TSUMO: He(
|
|
8793
8804
|
t.controller.doWin(i, r, {
|
|
8794
8805
|
oneShot: t.oneShotMap[i],
|
|
8795
8806
|
replacementWin: n == null ? void 0 : n.replacementWin
|
|
8796
8807
|
})
|
|
8797
8808
|
),
|
|
8798
8809
|
REACH: rh(t.controller.doReach(i)),
|
|
8799
|
-
AN_KAN:
|
|
8800
|
-
SHO_KAN:
|
|
8810
|
+
AN_KAN: Re(t.controller.doAnKan(i)),
|
|
8811
|
+
SHO_KAN: Re(t.controller.doShoKan(i)),
|
|
8801
8812
|
DISCARD: t.controller.doDiscard(i).map((c) => c.toString()),
|
|
8802
8813
|
DRAWN_GAME_BY_NINE_ORPHANS: t.controller.canDrawnGame(i)
|
|
8803
8814
|
}
|
|
@@ -8805,7 +8816,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8805
8816
|
t.controller.emit(a), t.controller.pollReplies(o, [i]);
|
|
8806
8817
|
},
|
|
8807
8818
|
notify_choice_after_discarded: ({ context: t, event: e }) => {
|
|
8808
|
-
const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add:
|
|
8819
|
+
const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add: g.HORIZONTAL });
|
|
8809
8820
|
for (let o of Object.values(v)) {
|
|
8810
8821
|
const a = {
|
|
8811
8822
|
id: n,
|
|
@@ -8816,17 +8827,17 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8816
8827
|
tile: i.t.toString()
|
|
8817
8828
|
},
|
|
8818
8829
|
choices: {
|
|
8819
|
-
RON:
|
|
8830
|
+
RON: He(
|
|
8820
8831
|
t.controller.doWin(o, r, {
|
|
8821
8832
|
discardedBy: i.w,
|
|
8822
8833
|
oneShot: t.oneShotMap[o],
|
|
8823
8834
|
missingRon: t.missingMap[o]
|
|
8824
8835
|
})
|
|
8825
8836
|
),
|
|
8826
|
-
PON:
|
|
8837
|
+
PON: Re(
|
|
8827
8838
|
t.controller.doPon(o, i.w, r)
|
|
8828
8839
|
),
|
|
8829
|
-
CHI:
|
|
8840
|
+
CHI: Re(
|
|
8830
8841
|
t.controller.doChi(o, i.w, r)
|
|
8831
8842
|
),
|
|
8832
8843
|
DAI_KAN: ih(
|
|
@@ -8854,7 +8865,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8854
8865
|
t.controller.emit(c), t.controller.pollReplies(i, [r]);
|
|
8855
8866
|
},
|
|
8856
8867
|
notify_choice_for_reach_acceptance: ({ context: t, event: e }) => {
|
|
8857
|
-
const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add:
|
|
8868
|
+
const n = t.genEventID(), i = t.controller.river.lastTile, r = i.t.clone({ add: g.HORIZONTAL });
|
|
8858
8869
|
for (let o of Object.values(v)) {
|
|
8859
8870
|
const a = {
|
|
8860
8871
|
id: n,
|
|
@@ -8862,7 +8873,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8862
8873
|
wind: o,
|
|
8863
8874
|
reacherInfo: { wind: i.w, tile: r.toString() },
|
|
8864
8875
|
choices: {
|
|
8865
|
-
RON:
|
|
8876
|
+
RON: He(
|
|
8866
8877
|
t.controller.doWin(o, r, {
|
|
8867
8878
|
discardedBy: i.w,
|
|
8868
8879
|
oneShot: t.oneShotMap[o],
|
|
@@ -8876,15 +8887,15 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8876
8887
|
t.controller.pollReplies(n, Object.values(v));
|
|
8877
8888
|
},
|
|
8878
8889
|
notify_choice_for_chankan: ({ context: t, event: e }) => {
|
|
8879
|
-
|
|
8890
|
+
k(
|
|
8880
8891
|
e.type == "SHO_KAN" || e.type == "AN_KAN",
|
|
8881
8892
|
`unexpected event ${e.type}`
|
|
8882
8893
|
);
|
|
8883
|
-
const n = t.genEventID(), i = e.block.tiles[0].clone({ remove:
|
|
8894
|
+
const n = t.genEventID(), i = e.block.tiles[0].clone({ remove: g.HORIZONTAL });
|
|
8884
8895
|
for (let r of Object.values(v)) {
|
|
8885
8896
|
const o = t.controller.doWin(
|
|
8886
8897
|
r,
|
|
8887
|
-
e.block.tiles[0].clone({ remove:
|
|
8898
|
+
e.block.tiles[0].clone({ remove: g.HORIZONTAL }),
|
|
8888
8899
|
{
|
|
8889
8900
|
discardedBy: e.iam,
|
|
8890
8901
|
quadWin: !0,
|
|
@@ -8897,7 +8908,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8897
8908
|
wind: r,
|
|
8898
8909
|
callerInfo: { wind: e.iam, tile: i.toString() },
|
|
8899
8910
|
choices: {
|
|
8900
|
-
RON: e.type == "SHO_KAN" ?
|
|
8911
|
+
RON: e.type == "SHO_KAN" ? He(o) : !1
|
|
8901
8912
|
}
|
|
8902
8913
|
};
|
|
8903
8914
|
a.choices.RON && (t.missingMap[r] = !0), t.controller.emit(a);
|
|
@@ -8905,7 +8916,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8905
8916
|
t.controller.pollReplies(n, Object.values(v));
|
|
8906
8917
|
},
|
|
8907
8918
|
notify_call: ({ context: t, event: e }) => {
|
|
8908
|
-
|
|
8919
|
+
k(
|
|
8909
8920
|
e.type == "CHI" || e.type == "PON" || e.type == "DAI_KAN" || e.type == "AN_KAN" || e.type == "SHO_KAN",
|
|
8910
8921
|
`unexpected event ${e.type}`
|
|
8911
8922
|
);
|
|
@@ -8924,7 +8935,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8924
8935
|
t.controller.next();
|
|
8925
8936
|
},
|
|
8926
8937
|
notify_discard: ({ context: t, event: e }) => {
|
|
8927
|
-
|
|
8938
|
+
k(e.type == "DISCARD", `unexpected event ${e.type}`);
|
|
8928
8939
|
const n = t.genEventID(), i = t.currentWind, r = e.tile;
|
|
8929
8940
|
for (let o of Object.values(v)) {
|
|
8930
8941
|
const a = {
|
|
@@ -8945,7 +8956,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8945
8956
|
const a = t.currentWind;
|
|
8946
8957
|
t.controller.hand(a).reached || (t.missingMap[a] = !1);
|
|
8947
8958
|
for (let c of Object.values(v)) {
|
|
8948
|
-
let h = new w(p.BACK, 0, [
|
|
8959
|
+
let h = new w(p.BACK, 0, [g.TSUMO]);
|
|
8949
8960
|
c == a && (h = o);
|
|
8950
8961
|
const l = {
|
|
8951
8962
|
id: i,
|
|
@@ -8960,7 +8971,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8960
8971
|
t.controller.next();
|
|
8961
8972
|
},
|
|
8962
8973
|
notify_ron: ({ context: t, event: e }) => {
|
|
8963
|
-
|
|
8974
|
+
k(e.type == "RON");
|
|
8964
8975
|
const n = t.genEventID(), i = e.iam;
|
|
8965
8976
|
for (let r of Object.values(v)) {
|
|
8966
8977
|
const o = {
|
|
@@ -8972,13 +8983,13 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8972
8983
|
wind: e.targetInfo.wind,
|
|
8973
8984
|
tile: e.targetInfo.tile.toString()
|
|
8974
8985
|
},
|
|
8975
|
-
ret:
|
|
8986
|
+
ret: Ln(e.ret)
|
|
8976
8987
|
};
|
|
8977
8988
|
t.controller.emit(o);
|
|
8978
8989
|
}
|
|
8979
8990
|
},
|
|
8980
8991
|
notify_tsumo: ({ context: t, event: e }) => {
|
|
8981
|
-
|
|
8992
|
+
k(e.type == "TSUMO", `unexpected event ${e.type}`);
|
|
8982
8993
|
const n = t.genEventID(), i = t.currentWind;
|
|
8983
8994
|
for (let r of Object.values(v)) {
|
|
8984
8995
|
const o = {
|
|
@@ -8987,14 +8998,14 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
8987
8998
|
iam: i,
|
|
8988
8999
|
wind: r,
|
|
8989
9000
|
lastTile: t.controller.hand(i).drawn.toString(),
|
|
8990
|
-
ret:
|
|
9001
|
+
ret: Ln(e.ret)
|
|
8991
9002
|
};
|
|
8992
9003
|
t.controller.emit(o);
|
|
8993
9004
|
}
|
|
8994
9005
|
},
|
|
8995
9006
|
notify_reach: ({ context: t, event: e }) => {
|
|
8996
|
-
|
|
8997
|
-
const n = t.genEventID(), i = e.iam, r = e.tile.clone({ add:
|
|
9007
|
+
k(e.type == "REACH", `unexpected event ${e.type}`);
|
|
9008
|
+
const n = t.genEventID(), i = e.iam, r = e.tile.clone({ add: g.HORIZONTAL });
|
|
8998
9009
|
t.oneShotMap[i] = !0;
|
|
8999
9010
|
for (let o of Object.values(v)) {
|
|
9000
9011
|
const a = {
|
|
@@ -9008,7 +9019,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
9008
9019
|
}
|
|
9009
9020
|
},
|
|
9010
9021
|
notify_reach_accepted: ({ context: t, event: e }) => {
|
|
9011
|
-
|
|
9022
|
+
k(e.type == "REACH_ACCEPT");
|
|
9012
9023
|
const n = t.genEventID();
|
|
9013
9024
|
for (let i of Object.values(v)) {
|
|
9014
9025
|
const r = {
|
|
@@ -9107,7 +9118,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
9107
9118
|
const r = [];
|
|
9108
9119
|
for (let h of Object.values(v)) {
|
|
9109
9120
|
const l = t.controller.hand(h);
|
|
9110
|
-
new
|
|
9121
|
+
new rn(l).calc() == 0 && (r.push(h), i[h] = l.toString());
|
|
9111
9122
|
}
|
|
9112
9123
|
const o = r.length == 0 || r.length == 4, a = G(0);
|
|
9113
9124
|
for (let h of Object.values(v))
|
|
@@ -9214,10 +9225,10 @@ class Xt {
|
|
|
9214
9225
|
for (let i = 0; i < 4; i++)
|
|
9215
9226
|
for (let r of n) {
|
|
9216
9227
|
let o = new w(e, r);
|
|
9217
|
-
e != p.Z && i == 3 && r == 5 && (o = o.clone({ add:
|
|
9228
|
+
e != p.Z && i == 3 && r == 5 && (o = o.clone({ add: g.RED })), this.walls.drawable.push(o.toString());
|
|
9218
9229
|
}
|
|
9219
9230
|
}
|
|
9220
|
-
|
|
9231
|
+
Oi(this.walls.drawable);
|
|
9221
9232
|
}
|
|
9222
9233
|
for (let e = 0; e < 14; e++)
|
|
9223
9234
|
this.walls.dead.push(this.walls.drawable.pop());
|
|
@@ -9241,7 +9252,7 @@ class Xt {
|
|
|
9241
9252
|
};
|
|
9242
9253
|
}
|
|
9243
9254
|
}
|
|
9244
|
-
class
|
|
9255
|
+
class an {
|
|
9245
9256
|
constructor(t, e) {
|
|
9246
9257
|
A(this, "wall", new Xt());
|
|
9247
9258
|
A(this, "playerIDs");
|
|
@@ -9261,9 +9272,9 @@ class on {
|
|
|
9261
9272
|
// bind
|
|
9262
9273
|
);
|
|
9263
9274
|
const i = Object.fromEntries(this.playerIDs.map((o) => [o, 25e3]));
|
|
9264
|
-
this.observer.scoreManager = new
|
|
9265
|
-
const r = (e == null ? void 0 : e.shuffle) == !1 ? this.playerIDs :
|
|
9266
|
-
this.observer.placeManager = new
|
|
9275
|
+
this.observer.scoreManager = new qe(i);
|
|
9276
|
+
const r = (e == null ? void 0 : e.shuffle) == !1 ? this.playerIDs : Oi([...this.playerIDs]);
|
|
9277
|
+
this.observer.placeManager = new Ze({
|
|
9267
9278
|
[r[0]]: v.E,
|
|
9268
9279
|
[r[1]]: v.S,
|
|
9269
9280
|
[r[2]]: v.W,
|
|
@@ -9274,7 +9285,7 @@ class on {
|
|
|
9274
9285
|
let n = this.hand(t).reached ? 1 : void 0;
|
|
9275
9286
|
if (n) {
|
|
9276
9287
|
const i = this.river.discards(t);
|
|
9277
|
-
n = i.length == 0 || i.length == 1 && i[0].t.has(
|
|
9288
|
+
n = i.length == 0 || i.length == 1 && i[0].t.has(g.HORIZONTAL) ? 2 : 1;
|
|
9278
9289
|
}
|
|
9279
9290
|
return {
|
|
9280
9291
|
doraMarkers: this.observer.doraMarkers,
|
|
@@ -9335,10 +9346,10 @@ class on {
|
|
|
9335
9346
|
const o = r.events[0];
|
|
9336
9347
|
switch (r.type) {
|
|
9337
9348
|
case "RON":
|
|
9338
|
-
|
|
9349
|
+
k(o.choices.RON, "ron choice is none"), this.actor.send({
|
|
9339
9350
|
type: r.type,
|
|
9340
9351
|
iam: o.wind,
|
|
9341
|
-
ret:
|
|
9352
|
+
ret: Ce(o.choices.RON),
|
|
9342
9353
|
targetInfo: {
|
|
9343
9354
|
wind: o.discarterInfo.wind,
|
|
9344
9355
|
tile: w.from(o.discarterInfo.tile)
|
|
@@ -9346,7 +9357,7 @@ class on {
|
|
|
9346
9357
|
});
|
|
9347
9358
|
break;
|
|
9348
9359
|
case "DAI_KAN":
|
|
9349
|
-
|
|
9360
|
+
k(o.choices.DAI_KAN, "daikan choice is none"), this.actor.send({
|
|
9350
9361
|
type: r.type,
|
|
9351
9362
|
iam: o.wind,
|
|
9352
9363
|
block: yt.from(o.choices.DAI_KAN.tiles)
|
|
@@ -9355,7 +9366,7 @@ class on {
|
|
|
9355
9366
|
case "CHI":
|
|
9356
9367
|
case "PON":
|
|
9357
9368
|
const a = o.choices[r.type];
|
|
9358
|
-
|
|
9369
|
+
k(a, `${r.type} choice is none`), k(
|
|
9359
9370
|
r.events.length == 1,
|
|
9360
9371
|
`found more than one selected: ${JSON.stringify(r, null, 2)}`
|
|
9361
9372
|
);
|
|
@@ -9368,23 +9379,23 @@ class on {
|
|
|
9368
9379
|
}
|
|
9369
9380
|
} else if (i.type == "CHOICE_AFTER_DRAWN") {
|
|
9370
9381
|
const r = Ya(n);
|
|
9371
|
-
|
|
9382
|
+
k(
|
|
9372
9383
|
r.events.length == 1,
|
|
9373
9384
|
`found more than one selected: ${JSON.stringify(r, null, 2)}`
|
|
9374
9385
|
);
|
|
9375
9386
|
const o = r.events[0], a = o.wind;
|
|
9376
9387
|
switch (r.type) {
|
|
9377
9388
|
case "TSUMO":
|
|
9378
|
-
|
|
9389
|
+
k(o.choices.TSUMO, "tsumo choice is none"), this.actor.send({
|
|
9379
9390
|
type: r.type,
|
|
9380
|
-
ret:
|
|
9391
|
+
ret: Ce(o.choices.TSUMO),
|
|
9381
9392
|
lastTile: w.from(o.drawerInfo.tile),
|
|
9382
9393
|
iam: a
|
|
9383
9394
|
});
|
|
9384
9395
|
break;
|
|
9385
9396
|
case "REACH":
|
|
9386
9397
|
const c = o.choices[r.type];
|
|
9387
|
-
|
|
9398
|
+
k(c, `${r.type} candidates is none`), this.actor.send({
|
|
9388
9399
|
type: "REACH",
|
|
9389
9400
|
tile: w.from(c[0].tile),
|
|
9390
9401
|
iam: a
|
|
@@ -9392,15 +9403,15 @@ class on {
|
|
|
9392
9403
|
break;
|
|
9393
9404
|
case "DISCARD":
|
|
9394
9405
|
const h = o.choices[r.type];
|
|
9395
|
-
|
|
9406
|
+
k(h, `${r.type} choice is none`), this.actor.send({
|
|
9396
9407
|
type: r.type,
|
|
9397
|
-
tile: w.from(h[0]).clone({ remove:
|
|
9408
|
+
tile: w.from(h[0]).clone({ remove: g.TSUMO }),
|
|
9398
9409
|
iam: a
|
|
9399
9410
|
});
|
|
9400
9411
|
break;
|
|
9401
9412
|
case "AN_KAN": {
|
|
9402
9413
|
const l = o.choices[r.type];
|
|
9403
|
-
|
|
9414
|
+
k(l, `${r.type} choice is none`), this.actor.send({
|
|
9404
9415
|
type: r.type,
|
|
9405
9416
|
block: Z.from(l[0].tiles),
|
|
9406
9417
|
iam: a
|
|
@@ -9409,7 +9420,7 @@ class on {
|
|
|
9409
9420
|
}
|
|
9410
9421
|
case "SHO_KAN": {
|
|
9411
9422
|
const l = o.choices[r.type];
|
|
9412
|
-
|
|
9423
|
+
k(l, `${r.type} choice is none`), this.actor.send({
|
|
9413
9424
|
type: r.type,
|
|
9414
9425
|
block: lt.from(l[0].tiles),
|
|
9415
9426
|
iam: a
|
|
@@ -9421,7 +9432,7 @@ class on {
|
|
|
9421
9432
|
break;
|
|
9422
9433
|
}
|
|
9423
9434
|
} else if (i.type == "CHOICE_AFTER_CALLED") {
|
|
9424
|
-
|
|
9435
|
+
k(
|
|
9425
9436
|
i.choices.DISCARD,
|
|
9426
9437
|
`discard candidate tile is none: ${JSON.stringify(
|
|
9427
9438
|
i,
|
|
@@ -9432,7 +9443,7 @@ class on {
|
|
|
9432
9443
|
const r = i.wind, o = w.from(i.choices.DISCARD[0]);
|
|
9433
9444
|
this.actor.send({ type: "DISCARD", tile: o, iam: r });
|
|
9434
9445
|
} else if (i.type == "CHOICE_FOR_REACH_ACCEPTANCE") {
|
|
9435
|
-
const r = n.filter((a) => (
|
|
9446
|
+
const r = n.filter((a) => (k(a.type == "CHOICE_FOR_REACH_ACCEPTANCE"), a.choices.RON !== !1));
|
|
9436
9447
|
if (r.length == 0) {
|
|
9437
9448
|
this.actor.send({
|
|
9438
9449
|
type: "REACH_ACCEPT",
|
|
@@ -9447,7 +9458,7 @@ class on {
|
|
|
9447
9458
|
this.actor.send({
|
|
9448
9459
|
type: "RON",
|
|
9449
9460
|
iam: o.wind,
|
|
9450
|
-
ret:
|
|
9461
|
+
ret: Ce(o.choices.RON),
|
|
9451
9462
|
targetInfo: {
|
|
9452
9463
|
wind: o.reacherInfo.wind,
|
|
9453
9464
|
tile: w.from(o.reacherInfo.tile)
|
|
@@ -9461,10 +9472,10 @@ class on {
|
|
|
9461
9472
|
return;
|
|
9462
9473
|
}
|
|
9463
9474
|
const o = r[0];
|
|
9464
|
-
|
|
9475
|
+
k(o.choices.RON, "ron choice is none"), this.actor.send({
|
|
9465
9476
|
type: "RON",
|
|
9466
9477
|
iam: o.wind,
|
|
9467
|
-
ret:
|
|
9478
|
+
ret: Ce(o.choices.RON),
|
|
9468
9479
|
quadWin: !0,
|
|
9469
9480
|
targetInfo: {
|
|
9470
9481
|
wind: o.callerInfo.wind,
|
|
@@ -9484,11 +9495,11 @@ class on {
|
|
|
9484
9495
|
},
|
|
9485
9496
|
on: (a) => {
|
|
9486
9497
|
}
|
|
9487
|
-
}, r = n.map((a) => ({ id: a, handler: i })), o = new
|
|
9488
|
-
return o.playerIDs = n, o.mailBox = e, o.observer.placeManager = new
|
|
9498
|
+
}, r = n.map((a) => ({ id: a, handler: i })), o = new an(r);
|
|
9499
|
+
return o.playerIDs = n, o.mailBox = e, o.observer.placeManager = new Ze(t.players, {
|
|
9489
9500
|
round: structuredClone(t.round),
|
|
9490
9501
|
sticks: structuredClone(t.sticks)
|
|
9491
|
-
}), o.observer.scoreManager = new
|
|
9502
|
+
}), o.observer.scoreManager = new qe(t.scores), o.wall = new Xt(t.wall), o;
|
|
9492
9503
|
}
|
|
9493
9504
|
start() {
|
|
9494
9505
|
this.actor.subscribe((e) => {
|
|
@@ -9509,12 +9520,12 @@ class on {
|
|
|
9509
9520
|
;
|
|
9510
9521
|
}
|
|
9511
9522
|
finalResult(t, e) {
|
|
9512
|
-
const n = this.hand(e), i = n.reached ? this.wall.blindDoraMarkers : void 0, r = new
|
|
9523
|
+
const n = this.hand(e), i = n.reached ? this.wall.blindDoraMarkers : void 0, r = new Os(n, {
|
|
9513
9524
|
...t.boardContext,
|
|
9514
9525
|
sticks: this.placeManager.sticks,
|
|
9515
9526
|
blindDoraMarkers: i
|
|
9516
9527
|
}).calc([t.hand]);
|
|
9517
|
-
return
|
|
9528
|
+
return k(r), r;
|
|
9518
9529
|
}
|
|
9519
9530
|
doWin(t, e, n) {
|
|
9520
9531
|
if (e == null) return !1;
|
|
@@ -9527,7 +9538,7 @@ class on {
|
|
|
9527
9538
|
} else
|
|
9528
9539
|
r.finalWallWin = !this.wall.canDraw, r.replacementWin = n == null ? void 0 : n.replacementWin;
|
|
9529
9540
|
r.oneShotWin = n == null ? void 0 : n.oneShot;
|
|
9530
|
-
const o = new Za(i), a = new
|
|
9541
|
+
const o = new Za(i), a = new Os(i, r), c = o.calc(e), h = a.calc(c);
|
|
9531
9542
|
if (!h || h.points.length == 0) return !1;
|
|
9532
9543
|
if (i.draw == null) {
|
|
9533
9544
|
const l = ee.candidateTiles(this.hand(t)).candidates;
|
|
@@ -9542,21 +9553,21 @@ class on {
|
|
|
9542
9553
|
let r = n.clone({ removeAll: !0 });
|
|
9543
9554
|
if (i.get(n.t, r.n) < 2) return !1;
|
|
9544
9555
|
const o = _s(t, e, b.PON), a = [], c = new wt([r, r, r]).clone({
|
|
9545
|
-
replace: { idx: o, tile: n.clone({ add:
|
|
9556
|
+
replace: { idx: o, tile: n.clone({ add: g.HORIZONTAL }) }
|
|
9546
9557
|
});
|
|
9547
9558
|
let h = c;
|
|
9548
|
-
z(n) && n.has(
|
|
9559
|
+
z(n) && n.has(g.RED) && (h = c.clone({
|
|
9549
9560
|
replace: {
|
|
9550
9561
|
idx: o,
|
|
9551
9562
|
tile: new w(r.t, r.n, [
|
|
9552
|
-
|
|
9553
|
-
|
|
9563
|
+
g.RED,
|
|
9564
|
+
g.HORIZONTAL
|
|
9554
9565
|
])
|
|
9555
9566
|
}
|
|
9556
9567
|
}));
|
|
9557
9568
|
const l = o % 2 + 1;
|
|
9558
9569
|
if (z(n) && i.get(n.t, 0) > 0 && (h = c.clone({
|
|
9559
|
-
replace: { idx: l, tile: r.clone({ add:
|
|
9570
|
+
replace: { idx: l, tile: r.clone({ add: g.RED }) }
|
|
9560
9571
|
})), a.push(h), z(r) && i.get(r.t, 5) == 3) {
|
|
9561
9572
|
const u = c.clone({
|
|
9562
9573
|
replace: { idx: l, tile: r }
|
|
@@ -9569,7 +9580,7 @@ class on {
|
|
|
9569
9580
|
if (n == null || !n.isNum() || Ht(e) != t) return !1;
|
|
9570
9581
|
const i = this.hand(t);
|
|
9571
9582
|
if (i.reached || i.hands.length < 3) return !1;
|
|
9572
|
-
let r = n.has(
|
|
9583
|
+
let r = n.has(g.RED) ? new w(n.t, n.n, [g.HORIZONTAL, g.RED]) : n.clone({ removeAll: !0, add: g.HORIZONTAL });
|
|
9573
9584
|
const o = [];
|
|
9574
9585
|
r.n - 2 >= 1 && i.get(n.t, r.n - 2) > 0 && i.get(n.t, r.n - 1) > 0 && o.push(
|
|
9575
9586
|
new ut([
|
|
@@ -9591,13 +9602,13 @@ class on {
|
|
|
9591
9602
|
])
|
|
9592
9603
|
);
|
|
9593
9604
|
for (let f = 0; f < o.length; f++) {
|
|
9594
|
-
const m = o[f], d = this.cannotDiscardTile(m),
|
|
9595
|
-
for (let
|
|
9596
|
-
const R = i.get(
|
|
9597
|
-
for (let
|
|
9598
|
-
|
|
9605
|
+
const m = o[f], d = this.cannotDiscardTile(m), y = [];
|
|
9606
|
+
for (let T of d) {
|
|
9607
|
+
const R = i.get(T.t, T.n);
|
|
9608
|
+
for (let F = 0; F < R; F++)
|
|
9609
|
+
y.push(T.clone({ remove: g.RED }));
|
|
9599
9610
|
}
|
|
9600
|
-
const _ = i.dec([...
|
|
9611
|
+
const _ = i.dec([...y, m.tiles[1], m.tiles[2]]), x = i.hands.length == 0;
|
|
9601
9612
|
i.inc(_), x && o.splice(f, 1);
|
|
9602
9613
|
}
|
|
9603
9614
|
if (o.length == 0) return !1;
|
|
@@ -9609,17 +9620,17 @@ class on {
|
|
|
9609
9620
|
(n) => z(n.tiles[1]) || z(n.tiles[2])
|
|
9610
9621
|
).map((n) => {
|
|
9611
9622
|
if (z(n.tiles[1])) {
|
|
9612
|
-
const i = n.tiles[1].clone({ add:
|
|
9623
|
+
const i = n.tiles[1].clone({ add: g.RED });
|
|
9613
9624
|
return n.clone({ replace: { idx: 1, tile: i } });
|
|
9614
9625
|
} else if (z(n.tiles[2])) {
|
|
9615
|
-
const i = n.tiles[2].clone({ add:
|
|
9626
|
+
const i = n.tiles[2].clone({ add: g.RED });
|
|
9616
9627
|
return n.clone({ replace: { idx: 2, tile: i } });
|
|
9617
9628
|
}
|
|
9618
9629
|
}).filter((n) => n != null);
|
|
9619
9630
|
}
|
|
9620
9631
|
doReach(t) {
|
|
9621
9632
|
const e = this.hand(t);
|
|
9622
|
-
return e.reached || !e.menzen || new
|
|
9633
|
+
return e.reached || !e.menzen || new rn(e).calc() > 0 ? !1 : ee.calcCandidates(e, e.hands);
|
|
9623
9634
|
}
|
|
9624
9635
|
doDiscard(t, e) {
|
|
9625
9636
|
if (this.hand(t).reached) return [this.hand(t).drawn];
|
|
@@ -9628,7 +9639,7 @@ class on {
|
|
|
9628
9639
|
if (e instanceof wt)
|
|
9629
9640
|
return n.filter((o) => !o.equals(e.tiles[0]));
|
|
9630
9641
|
const i = this.cannotDiscardTile(e), r = n.filter((o) => !i.some((a) => o.equals(a)));
|
|
9631
|
-
return
|
|
9642
|
+
return k(
|
|
9632
9643
|
r.length > 0,
|
|
9633
9644
|
`no tiles to discard. hand: ${this.hand(
|
|
9634
9645
|
t
|
|
@@ -9647,12 +9658,12 @@ class on {
|
|
|
9647
9658
|
for (let r = 1; r < e.getArrayLen(i); r++)
|
|
9648
9659
|
if (e.get(i, r) == 4) {
|
|
9649
9660
|
const o = new w(i, r), a = [o, o, o, o];
|
|
9650
|
-
z(o) && (a[1] = o.clone({ add:
|
|
9661
|
+
z(o) && (a[1] = o.clone({ add: g.RED })), n.push(new Z(a));
|
|
9651
9662
|
}
|
|
9652
9663
|
if (n.length == 0) return !1;
|
|
9653
9664
|
for (let i of n)
|
|
9654
|
-
|
|
9655
|
-
i.tiles.filter((r) => r.has(
|
|
9665
|
+
k(
|
|
9666
|
+
i.tiles.filter((r) => r.has(g.HORIZONTAL)).length == 0,
|
|
9656
9667
|
`h op ${i.toString()}`
|
|
9657
9668
|
);
|
|
9658
9669
|
return n;
|
|
@@ -9666,17 +9677,17 @@ class on {
|
|
|
9666
9677
|
for (let r of n) {
|
|
9667
9678
|
const o = r.tiles[0].clone({
|
|
9668
9679
|
removeAll: !0,
|
|
9669
|
-
add:
|
|
9680
|
+
add: g.HORIZONTAL
|
|
9670
9681
|
});
|
|
9671
9682
|
if (e.get(o.t, o.n) == 1) {
|
|
9672
|
-
const a = z(o) && e.get(o.t, 0) > 0 ? o.clone({ add:
|
|
9683
|
+
const a = z(o) && e.get(o.t, 0) > 0 ? o.clone({ add: g.RED }) : o;
|
|
9673
9684
|
i.push(new lt([...r.tiles, a]));
|
|
9674
9685
|
}
|
|
9675
9686
|
}
|
|
9676
9687
|
if (i.length == 0) return !1;
|
|
9677
9688
|
for (let r of i)
|
|
9678
|
-
|
|
9679
|
-
r.tiles.filter((o) => o.has(
|
|
9689
|
+
k(
|
|
9690
|
+
r.tiles.filter((o) => o.has(g.HORIZONTAL)).length == 2,
|
|
9680
9691
|
`h op ${r.toString()}`
|
|
9681
9692
|
);
|
|
9682
9693
|
return i;
|
|
@@ -9688,30 +9699,30 @@ class on {
|
|
|
9688
9699
|
if (i.get(r.t, r.n) != 3) return !1;
|
|
9689
9700
|
const o = _s(t, e, b.DAI_KAN);
|
|
9690
9701
|
let a = new yt([r, r, r, r]).clone({
|
|
9691
|
-
replace: { idx: o, tile: r.clone({ add:
|
|
9702
|
+
replace: { idx: o, tile: r.clone({ add: g.HORIZONTAL }) }
|
|
9692
9703
|
});
|
|
9693
|
-
if (z(n) && n.has(
|
|
9704
|
+
if (z(n) && n.has(g.RED))
|
|
9694
9705
|
a = a.clone({
|
|
9695
9706
|
replace: {
|
|
9696
9707
|
idx: o,
|
|
9697
9708
|
tile: new w(r.t, r.n, [
|
|
9698
|
-
|
|
9699
|
-
|
|
9709
|
+
g.HORIZONTAL,
|
|
9710
|
+
g.RED
|
|
9700
9711
|
])
|
|
9701
9712
|
}
|
|
9702
9713
|
});
|
|
9703
|
-
else if (z(n) && !n.has(
|
|
9704
|
-
|
|
9714
|
+
else if (z(n) && !n.has(g.RED)) {
|
|
9715
|
+
k(
|
|
9705
9716
|
i.get(n.t, 0) > 0,
|
|
9706
9717
|
`hand does not have red tile: ${i.toString()}`
|
|
9707
9718
|
);
|
|
9708
9719
|
const c = o % 3 + 1;
|
|
9709
9720
|
a = a.clone({
|
|
9710
|
-
replace: { idx: c, tile: r.clone({ add:
|
|
9721
|
+
replace: { idx: c, tile: r.clone({ add: g.RED }) }
|
|
9711
9722
|
});
|
|
9712
9723
|
}
|
|
9713
|
-
return
|
|
9714
|
-
a.tiles.filter((c) => c.has(
|
|
9724
|
+
return k(
|
|
9725
|
+
a.tiles.filter((c) => c.has(g.HORIZONTAL)).length == 1,
|
|
9715
9726
|
`h op ${a.toString()}`
|
|
9716
9727
|
), a;
|
|
9717
9728
|
}
|
|
@@ -9721,7 +9732,7 @@ class on {
|
|
|
9721
9732
|
let n = 0;
|
|
9722
9733
|
for (let i of Object.values(p)) {
|
|
9723
9734
|
if (i == p.BACK) continue;
|
|
9724
|
-
const r = i == p.Z ?
|
|
9735
|
+
const r = i == p.Z ? be : gt;
|
|
9725
9736
|
for (let o of r)
|
|
9726
9737
|
e.get(i, o) > 0 && n++;
|
|
9727
9738
|
}
|
|
@@ -9731,7 +9742,7 @@ class on {
|
|
|
9731
9742
|
return this.wall.initialHands();
|
|
9732
9743
|
}
|
|
9733
9744
|
}
|
|
9734
|
-
class oe extends
|
|
9745
|
+
class oe extends sn {
|
|
9735
9746
|
isBackHand() {
|
|
9736
9747
|
for (let t of Object.values(p))
|
|
9737
9748
|
if (t != p.BACK && this.sum(t) > 0)
|
|
@@ -9749,10 +9760,10 @@ class oe extends nn {
|
|
|
9749
9760
|
class Gi {
|
|
9750
9761
|
constructor(t, e) {
|
|
9751
9762
|
A(this, "id");
|
|
9752
|
-
A(this, "river", new
|
|
9753
|
-
A(this, "placeManager", new
|
|
9763
|
+
A(this, "river", new ki());
|
|
9764
|
+
A(this, "placeManager", new Ze({}));
|
|
9754
9765
|
// empty for init
|
|
9755
|
-
A(this, "scoreManager", new
|
|
9766
|
+
A(this, "scoreManager", new qe({}));
|
|
9756
9767
|
// empty for init
|
|
9757
9768
|
A(this, "hands", G(new oe("")));
|
|
9758
9769
|
// empty for init
|
|
@@ -9777,10 +9788,10 @@ class Gi {
|
|
|
9777
9788
|
case "DISTRIBUTE":
|
|
9778
9789
|
this.counter.reset();
|
|
9779
9790
|
const e = w.from(t.doraMarker);
|
|
9780
|
-
this.setHands(t), this.placeManager = new
|
|
9791
|
+
this.setHands(t), this.placeManager = new Ze(structuredClone(t.places), {
|
|
9781
9792
|
round: structuredClone(t.round),
|
|
9782
9793
|
sticks: structuredClone(t.sticks)
|
|
9783
|
-
}), this.scoreManager = new
|
|
9794
|
+
}), this.scoreManager = new qe(structuredClone(t.scores)), this.doraMarkers = [e], this.counter.dec(e);
|
|
9784
9795
|
for (let i of Object.values(v))
|
|
9785
9796
|
i == t.wind && this.counter.dec(...this.hand(i).hands);
|
|
9786
9797
|
break;
|
|
@@ -9803,21 +9814,21 @@ class Gi {
|
|
|
9803
9814
|
case "DAI_KAN": {
|
|
9804
9815
|
const i = P.deserialize(t.block);
|
|
9805
9816
|
this.hands[t.iam].call(i), this.river.markCalled(), t.iam != t.wind && this.counter.dec(
|
|
9806
|
-
...i.tiles.filter((r) => !r.has(
|
|
9817
|
+
...i.tiles.filter((r) => !r.has(g.HORIZONTAL))
|
|
9807
9818
|
);
|
|
9808
9819
|
break;
|
|
9809
9820
|
}
|
|
9810
9821
|
case "SHO_KAN": {
|
|
9811
9822
|
const i = lt.from(t.block.tiles);
|
|
9812
9823
|
this.hands[t.iam].kan(i), t.iam != t.wind && this.counter.dec(
|
|
9813
|
-
i.tiles.filter((r) => r.has(
|
|
9824
|
+
i.tiles.filter((r) => r.has(g.HORIZONTAL))[0]
|
|
9814
9825
|
);
|
|
9815
9826
|
break;
|
|
9816
9827
|
}
|
|
9817
9828
|
case "AN_KAN": {
|
|
9818
9829
|
const i = Z.from(t.block.tiles);
|
|
9819
9830
|
this.hands[t.iam].kan(i), t.iam != t.wind && this.counter.dec(
|
|
9820
|
-
...i.tiles.filter((r) => !r.has(
|
|
9831
|
+
...i.tiles.filter((r) => !r.has(g.HORIZONTAL))
|
|
9821
9832
|
);
|
|
9822
9833
|
break;
|
|
9823
9834
|
}
|
|
@@ -9953,10 +9964,10 @@ class ah extends Gi {
|
|
|
9953
9964
|
}
|
|
9954
9965
|
}
|
|
9955
9966
|
}
|
|
9956
|
-
class
|
|
9967
|
+
class $e extends Gi {
|
|
9957
9968
|
constructor(e, n) {
|
|
9958
9969
|
super(e, n);
|
|
9959
|
-
A(this, "river", new
|
|
9970
|
+
A(this, "river", new ki());
|
|
9960
9971
|
A(this, "doras", []);
|
|
9961
9972
|
this.eventHandler.on((i) => this.handleEvent(i));
|
|
9962
9973
|
}
|
|
@@ -9968,11 +9979,11 @@ class He extends Gi {
|
|
|
9968
9979
|
this.hands[n] = new oe(e.hands[n]);
|
|
9969
9980
|
}
|
|
9970
9981
|
handleDiscard(e) {
|
|
9971
|
-
const n = Object.values(v).filter((l) => l == this.myWind ? !1 : this.hand(l).reached), i = new
|
|
9982
|
+
const n = Object.values(v).filter((l) => l == this.myWind ? !1 : this.hand(l).reached), i = new rn(this.hand(this.myWind)).calc();
|
|
9972
9983
|
if (n.length > 0 && i >= 2)
|
|
9973
9984
|
return pe.selectTile(this.counter, n, e);
|
|
9974
|
-
const r = ee.calcCandidates(this.hand(this.myWind), e), a =
|
|
9975
|
-
return
|
|
9985
|
+
const r = ee.calcCandidates(this.hand(this.myWind), e), a = Je.calcPlayerCandidates(this.counter, r).sort((l, u) => u.sum - l.sum), c = a.filter((l) => l.sum == a[0].sum);
|
|
9986
|
+
return Je.selectMinPriority(
|
|
9976
9987
|
this.counter,
|
|
9977
9988
|
c,
|
|
9978
9989
|
this.doras
|
|
@@ -10009,13 +10020,13 @@ class yh {
|
|
|
10009
10020
|
this.histories = JSON.parse(t);
|
|
10010
10021
|
}
|
|
10011
10022
|
next() {
|
|
10012
|
-
|
|
10023
|
+
k(this.index < this.histories.length), this.index++;
|
|
10013
10024
|
}
|
|
10014
10025
|
prev() {
|
|
10015
|
-
this.index--,
|
|
10026
|
+
this.index--, k(this.index < 0);
|
|
10016
10027
|
}
|
|
10017
10028
|
start() {
|
|
10018
|
-
|
|
10029
|
+
an.load(this.histories[this.index]).start();
|
|
10019
10030
|
}
|
|
10020
10031
|
auto() {
|
|
10021
10032
|
for (; this.index < this.histories.length; this.next())
|
|
@@ -10023,28 +10034,28 @@ class yh {
|
|
|
10023
10034
|
}
|
|
10024
10035
|
}
|
|
10025
10036
|
const wh = (s) => {
|
|
10026
|
-
const [t, e] =
|
|
10037
|
+
const [t, e] = Me(), [n, i] = Me(), [r, o] = Me(), [a, c] = Me(), h = ["player-1", "player-2", "player-3", "player-4"], l = s == null ? void 0 : s.playerInjection, u = (l == null ? void 0 : l.p1) ?? $e, f = (l == null ? void 0 : l.p2) ?? $e, m = (l == null ? void 0 : l.p3) ?? $e, d = (l == null ? void 0 : l.p4) ?? $e, y = new u(h[0], e), _ = new f(h[1], i), x = new m(h[2], o), T = new d(h[3], c), R = [
|
|
10027
10038
|
{ handler: t, id: h[0] },
|
|
10028
10039
|
{ handler: n, id: h[1] },
|
|
10029
10040
|
{ handler: r, id: h[2] },
|
|
10030
10041
|
{ handler: a, id: h[3] }
|
|
10031
10042
|
];
|
|
10032
10043
|
return {
|
|
10033
|
-
c: new
|
|
10044
|
+
c: new an(R, {
|
|
10034
10045
|
debug: s == null ? void 0 : s.debug,
|
|
10035
10046
|
shuffle: s == null ? void 0 : s.shuffle
|
|
10036
10047
|
}),
|
|
10037
|
-
p1:
|
|
10048
|
+
p1: y,
|
|
10038
10049
|
p2: _,
|
|
10039
10050
|
p3: x,
|
|
10040
|
-
p4:
|
|
10051
|
+
p4: T
|
|
10041
10052
|
};
|
|
10042
|
-
},
|
|
10053
|
+
}, Ot = (s, t) => {
|
|
10043
10054
|
let n = 1;
|
|
10044
10055
|
for (let i of t) i.equals(s) && (n *= 2);
|
|
10045
10056
|
return n;
|
|
10046
10057
|
};
|
|
10047
|
-
class
|
|
10058
|
+
class Je {
|
|
10048
10059
|
static calcPlayerCandidates(t, e) {
|
|
10049
10060
|
let n = [];
|
|
10050
10061
|
for (let i of e) {
|
|
@@ -10064,10 +10075,10 @@ class Xe {
|
|
|
10064
10075
|
return n;
|
|
10065
10076
|
}
|
|
10066
10077
|
static selectMinPriority(t, e, n) {
|
|
10067
|
-
|
|
10078
|
+
k(e.length > 0);
|
|
10068
10079
|
let i = 0, r = 0;
|
|
10069
10080
|
for (let o = 0; o < e.length; o++) {
|
|
10070
|
-
const a =
|
|
10081
|
+
const a = Je.calcPriority(t, e[o], n);
|
|
10071
10082
|
a < i && (i = a, r = o);
|
|
10072
10083
|
}
|
|
10073
10084
|
return e[r];
|
|
@@ -10076,18 +10087,18 @@ class Xe {
|
|
|
10076
10087
|
const i = e.tile;
|
|
10077
10088
|
let r = 0;
|
|
10078
10089
|
if (i.t == p.Z)
|
|
10079
|
-
return r = t.get(i), (i.n == 5 || i.n == 6 || i.n == 7) && (r *= 2), r *
|
|
10090
|
+
return r = t.get(i), (i.n == 5 || i.n == 6 || i.n == 7) && (r *= 2), r * Ot(i, n);
|
|
10080
10091
|
{
|
|
10081
10092
|
const o = t.get(i);
|
|
10082
|
-
r += o *
|
|
10083
|
-
const a = t.get(new w(i.t, i.n + 1)), c = t.get(new w(i.t, i.n + 2)), h = t.get(new w(i.t, i.n - 1)), l = t.get(new w(i.t, i.n - 2)), u = i.n - 2 > 0 ? Math.min(h, l) : 0, f = i.n + 2 <= 9 ? Math.min(a, c) : 0, m = i.n - 1 >= 1 && i.n + 1 <= 9 ? Math.min(a, h) : 0, d = Math.max(u, m),
|
|
10084
|
-
return r += o *
|
|
10093
|
+
r += o * Ot(i, n);
|
|
10094
|
+
const a = t.get(new w(i.t, i.n + 1)), c = t.get(new w(i.t, i.n + 2)), h = t.get(new w(i.t, i.n - 1)), l = t.get(new w(i.t, i.n - 2)), u = i.n - 2 > 0 ? Math.min(h, l) : 0, f = i.n + 2 <= 9 ? Math.min(a, c) : 0, m = i.n - 1 >= 1 && i.n + 1 <= 9 ? Math.min(a, h) : 0, d = Math.max(u, m), y = Math.max(m, f);
|
|
10095
|
+
return r += o * Ot(i, n), r += u * Ot(new w(i.t, i.n - 2), n), r += f * Ot(new w(i.t, i.n + 2), n), r += d * Ot(new w(i.t, i.n - 1), n), r += y * Ot(new w(i.t, i.n + 1), n), i.n == 0, r;
|
|
10085
10096
|
}
|
|
10086
10097
|
}
|
|
10087
10098
|
}
|
|
10088
10099
|
class pe {
|
|
10089
10100
|
static selectTile(t, e, n) {
|
|
10090
|
-
|
|
10101
|
+
k(e.length > 0 && n.length > 0);
|
|
10091
10102
|
let i = n[0], r = Number.POSITIVE_INFINITY;
|
|
10092
10103
|
for (let o of n) {
|
|
10093
10104
|
const a = pe.rank(t, e, o);
|
|
@@ -10132,60 +10143,60 @@ export {
|
|
|
10132
10143
|
Za as BlockCalculator,
|
|
10133
10144
|
ut as BlockChi,
|
|
10134
10145
|
yt as BlockDaiKan,
|
|
10135
|
-
|
|
10146
|
+
me as BlockHand,
|
|
10136
10147
|
Ks as BlockIsolated,
|
|
10137
|
-
|
|
10148
|
+
Us as BlockOther,
|
|
10138
10149
|
V as BlockPair,
|
|
10139
10150
|
wt as BlockPon,
|
|
10140
10151
|
Ct as BlockRun,
|
|
10141
10152
|
lt as BlockShoKan,
|
|
10142
10153
|
ht as BlockThree,
|
|
10143
|
-
|
|
10154
|
+
an as Controller,
|
|
10144
10155
|
Qa as Counter,
|
|
10145
|
-
|
|
10156
|
+
Os as DoubleCalculator,
|
|
10146
10157
|
ee as Efficiency,
|
|
10147
10158
|
zs as FONT_FAMILY,
|
|
10148
|
-
|
|
10159
|
+
sn as Hand,
|
|
10149
10160
|
Dt as INPUT_SEPARATOR,
|
|
10150
10161
|
Ai as ImageHelper,
|
|
10151
10162
|
lh as MeasureText,
|
|
10152
10163
|
gt as N19,
|
|
10153
|
-
|
|
10154
|
-
|
|
10164
|
+
be as NZ,
|
|
10165
|
+
g as OPERATOR,
|
|
10155
10166
|
ah as Observer,
|
|
10156
10167
|
nt as Parser,
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10168
|
+
Ze as PlaceManager,
|
|
10169
|
+
$e as Player,
|
|
10170
|
+
Je as PlayerEfficiency,
|
|
10160
10171
|
j as ROUND,
|
|
10161
10172
|
Ls as ROUND_MAP,
|
|
10162
10173
|
yh as Replayer,
|
|
10163
10174
|
pe as RiskRank,
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10175
|
+
ki as River,
|
|
10176
|
+
qe as ScoreManager,
|
|
10177
|
+
rn as ShantenCalculator,
|
|
10167
10178
|
tr as TABLE_CONTEXT,
|
|
10168
10179
|
Rt as TILE_CONTEXT,
|
|
10169
10180
|
p as TYPE,
|
|
10170
10181
|
w as Tile,
|
|
10171
10182
|
v as WIND,
|
|
10172
|
-
|
|
10183
|
+
Kn as WIND_MAP,
|
|
10173
10184
|
Xt as Wall,
|
|
10174
10185
|
_s as callBlockIndex,
|
|
10175
|
-
|
|
10186
|
+
Fa as convertInput,
|
|
10176
10187
|
js as createControllerMachine,
|
|
10177
10188
|
Va as createEventEmitter,
|
|
10178
|
-
|
|
10189
|
+
Me as createEventPipe,
|
|
10179
10190
|
de as createHand,
|
|
10180
10191
|
wh as createLocalGame,
|
|
10181
10192
|
Ia as createTable,
|
|
10182
10193
|
G as createWindMap,
|
|
10183
|
-
|
|
10194
|
+
Ce as deserializeWinResult,
|
|
10184
10195
|
ph as drawBlocks,
|
|
10185
10196
|
gh as drawTable,
|
|
10186
10197
|
oh as incrementalIDGenerator,
|
|
10187
10198
|
z as isNum5,
|
|
10188
|
-
|
|
10199
|
+
We as nextRound,
|
|
10189
10200
|
Ht as nextWind,
|
|
10190
10201
|
mh as optimizeSVG,
|
|
10191
10202
|
ja as parse,
|
|
@@ -10194,7 +10205,7 @@ export {
|
|
|
10194
10205
|
cr as prevWind,
|
|
10195
10206
|
Ga as prioritizeDiscardedEvents,
|
|
10196
10207
|
Ya as prioritizeDrawnEvents,
|
|
10197
|
-
|
|
10208
|
+
Oi as shuffle,
|
|
10198
10209
|
sr as sortCalledTiles,
|
|
10199
|
-
|
|
10210
|
+
Ve as tileSortFunc
|
|
10200
10211
|
};
|