@kubohiroya/turbowarp-bubble 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/composition.js +297 -245
- package/dist/extension-manifest.json +35 -0
- package/dist/turbowarp-adapter.js +497 -399
- package/dist/turbowarp-bubble.js +233 -22
- package/dist/types/composition.d.ts +10 -0
- package/dist/types/portrait-layout.d.ts +14 -0
- package/docs/block-manual.ja.md +36 -31
- package/docs/block-manual.md +36 -31
- package/docs/index.html +11 -3
- package/docs/ja/index.html +11 -3
- package/package.json +1 -1
|
@@ -360,13 +360,13 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
360
360
|
}
|
|
361
361
|
t.s = r < 0 ? -1 : 0, r < -1 ? t[n++] = this.DV + r : r > 0 && (t[n++] = r), t.t = n, t.clamp();
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function F(e, t) {
|
|
364
364
|
var n = this.abs(), r = e.abs(), i = n.t;
|
|
365
365
|
for (t.t = i + r.t; --i >= 0;) t[i] = 0;
|
|
366
366
|
for (i = 0; i < r.t; ++i) t[i + n.t] = n.am(0, r[i], t, i, 0, n.t);
|
|
367
367
|
t.s = 0, t.clamp(), this.s != e.s && c.ZERO.subTo(t, t);
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function I(e) {
|
|
370
370
|
for (var t = this.abs(), n = e.t = 2 * t.t; --n >= 0;) e[n] = 0;
|
|
371
371
|
for (n = 0; n < t.t - 1; ++n) {
|
|
372
372
|
var r = t.am(n, t[n], e, 2 * n, 0, 1);
|
|
@@ -374,7 +374,7 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
374
374
|
}
|
|
375
375
|
e.t > 0 && (e[e.t - 1] += t.am(n, t[n], e, 2 * n, 0, 1)), e.s = 0, e.clamp();
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function te(e, t, n) {
|
|
378
378
|
var r = e.abs();
|
|
379
379
|
if (!(r.t <= 0)) {
|
|
380
380
|
var i = this.abs();
|
|
@@ -397,48 +397,48 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function ne(e) {
|
|
401
401
|
var t = l();
|
|
402
402
|
return this.abs().divRemTo(e, null, t), this.s < 0 && t.compareTo(c.ZERO) > 0 && e.subTo(t, t), t;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function L(e) {
|
|
405
405
|
this.m = e;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function re(e) {
|
|
408
408
|
return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function ie(e) {
|
|
411
411
|
return e;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function ae(e) {
|
|
414
414
|
e.divRemTo(this.m, null, e);
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function oe(e, t, n) {
|
|
417
417
|
e.multiplyTo(t, n), this.reduce(n);
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function se(e, t) {
|
|
420
420
|
e.squareTo(t), this.reduce(t);
|
|
421
421
|
}
|
|
422
|
-
|
|
423
|
-
function
|
|
422
|
+
L.prototype.convert = re, L.prototype.revert = ie, L.prototype.reduce = ae, L.prototype.mulTo = oe, L.prototype.sqrTo = se;
|
|
423
|
+
function ce() {
|
|
424
424
|
if (this.t < 1) return 0;
|
|
425
425
|
var e = this[0];
|
|
426
426
|
if (!(e & 1)) return 0;
|
|
427
427
|
var t = e & 3;
|
|
428
428
|
return t = t * (2 - (e & 15) * t) & 15, t = t * (2 - (e & 255) * t) & 255, t = t * (2 - ((e & 65535) * t & 65535)) & 65535, t = t * (2 - e * t % this.DV) % this.DV, t > 0 ? this.DV - t : -t;
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function R(e) {
|
|
431
431
|
this.m = e, this.mp = e.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function z(e) {
|
|
434
434
|
var t = l();
|
|
435
435
|
return e.abs().dlShiftTo(this.m.t, t), t.divRemTo(this.m, null, t), e.s < 0 && t.compareTo(c.ZERO) > 0 && this.m.subTo(t, t), t;
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function le(e) {
|
|
438
438
|
var t = l();
|
|
439
439
|
return e.copyTo(t), this.reduce(t), t;
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function ue(e) {
|
|
442
442
|
for (; e.t <= this.mt2;) e[e.t++] = 0;
|
|
443
443
|
for (var t = 0; t < this.m.t; ++t) {
|
|
444
444
|
var n = e[t] & 32767, r = n * this.mpl + ((n * this.mph + (e[t] >> 15) * this.mpl & this.um) << 15) & e.DM;
|
|
@@ -446,17 +446,17 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
446
446
|
}
|
|
447
447
|
e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function de(e, t) {
|
|
450
450
|
e.squareTo(t), this.reduce(t);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function fe(e, t, n) {
|
|
453
453
|
e.multiplyTo(t, n), this.reduce(n);
|
|
454
454
|
}
|
|
455
|
-
|
|
456
|
-
function
|
|
455
|
+
R.prototype.convert = z, R.prototype.revert = le, R.prototype.reduce = ue, R.prototype.mulTo = fe, R.prototype.sqrTo = de;
|
|
456
|
+
function pe() {
|
|
457
457
|
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function me(e, t) {
|
|
460
460
|
if (e > 4294967295 || e < 1) return c.ONE;
|
|
461
461
|
var n = l(), r = l(), i = t.convert(this), a = k(e) - 1;
|
|
462
462
|
for (i.copyTo(n); --a >= 0;) if (t.sqrTo(n, r), (e & 1 << a) > 0) t.mulTo(r, i, n);
|
|
@@ -466,16 +466,16 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
466
466
|
}
|
|
467
467
|
return t.revert(n);
|
|
468
468
|
}
|
|
469
|
-
function
|
|
470
|
-
var n = e < 256 || t.isEven() ? new
|
|
469
|
+
function he(e, t) {
|
|
470
|
+
var n = e < 256 || t.isEven() ? new L(t) : new R(t);
|
|
471
471
|
return this.exp(e, n);
|
|
472
472
|
}
|
|
473
|
-
c.prototype.copyTo = b, c.prototype.fromInt = x, c.prototype.fromString = C, c.prototype.clamp = w, c.prototype.dlShiftTo = j, c.prototype.drShiftTo = M, c.prototype.lShiftTo = N, c.prototype.rShiftTo = ee, c.prototype.subTo = P, c.prototype.multiplyTo =
|
|
474
|
-
function
|
|
473
|
+
c.prototype.copyTo = b, c.prototype.fromInt = x, c.prototype.fromString = C, c.prototype.clamp = w, c.prototype.dlShiftTo = j, c.prototype.drShiftTo = M, c.prototype.lShiftTo = N, c.prototype.rShiftTo = ee, c.prototype.subTo = P, c.prototype.multiplyTo = F, c.prototype.squareTo = I, c.prototype.divRemTo = te, c.prototype.invDigit = ce, c.prototype.isEven = pe, c.prototype.exp = me, c.prototype.toString = T, c.prototype.negate = E, c.prototype.abs = D, c.prototype.compareTo = O, c.prototype.bitLength = A, c.prototype.mod = ne, c.prototype.modPowInt = he, c.ZERO = S(0), c.ONE = S(1);
|
|
474
|
+
function ge() {
|
|
475
475
|
var e = l();
|
|
476
476
|
return this.copyTo(e), e;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function _e() {
|
|
479
479
|
if (this.s < 0) {
|
|
480
480
|
if (this.t == 1) return this[0] - this.DV;
|
|
481
481
|
if (this.t == 0) return -1;
|
|
@@ -483,25 +483,25 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
483
483
|
else if (this.t == 0) return 0;
|
|
484
484
|
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function B() {
|
|
487
487
|
return this.t == 0 ? this.s : this[0] << 24 >> 24;
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function ve() {
|
|
490
490
|
return this.t == 0 ? this.s : this[0] << 16 >> 16;
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function ye(e) {
|
|
493
493
|
return Math.floor(Math.LN2 * this.DB / Math.log(e));
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function be() {
|
|
496
496
|
return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function xe(e) {
|
|
499
499
|
if (e ??= 10, this.signum() == 0 || e < 2 || e > 36) return "0";
|
|
500
500
|
var t = this.chunkSize(e), n = e ** +t, r = S(n), i = l(), a = l(), o = "";
|
|
501
501
|
for (this.divRemTo(r, i, a); i.signum() > 0;) o = (n + a.intValue()).toString(e).substr(1) + o, i.divRemTo(r, i, a);
|
|
502
502
|
return a.intValue().toString(e) + o;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function Se(e, t) {
|
|
505
505
|
this.fromInt(0), t ??= 10;
|
|
506
506
|
for (var n = this.chunkSize(t), r = t ** +n, i = !1, a = 0, o = 0, s = 0; s < e.length; ++s) {
|
|
507
507
|
var l = y(e, s);
|
|
@@ -513,32 +513,32 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
513
513
|
}
|
|
514
514
|
a > 0 && (this.dMultiply(t ** +a), this.dAddOffset(o, 0)), i && c.ZERO.subTo(this, this);
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Ce(e, t, n) {
|
|
517
517
|
if (typeof t == "number") {
|
|
518
518
|
if (e < 2) this.fromInt(1);
|
|
519
|
-
else for (this.fromNumber(e, n), this.testBit(e - 1) || this.bitwiseTo(c.ONE.shiftLeft(e - 1),
|
|
519
|
+
else for (this.fromNumber(e, n), this.testBit(e - 1) || this.bitwiseTo(c.ONE.shiftLeft(e - 1), Ae, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(t);) this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(c.ONE.shiftLeft(e - 1), this);
|
|
520
520
|
} else {
|
|
521
521
|
var r = [], i = e & 7;
|
|
522
522
|
r.length = (e >> 3) + 1, t.nextBytes(r), i > 0 ? r[0] &= (1 << i) - 1 : r[0] = 0, this.fromString(r, 256);
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function we() {
|
|
526
526
|
var e = this.t, t = [];
|
|
527
527
|
t[0] = this.s;
|
|
528
528
|
var n = this.DB - e * this.DB % 8, r, i = 0;
|
|
529
529
|
if (e-- > 0) for (n < this.DB && (r = this[e] >> n) != (this.s & this.DM) >> n && (t[i++] = r | this.s << this.DB - n); e >= 0;) n < 8 ? (r = (this[e] & (1 << n) - 1) << 8 - n, r |= this[--e] >> (n += this.DB - 8)) : (r = this[e] >> (n -= 8) & 255, n <= 0 && (n += this.DB, --e)), r & 128 && (r |= -256), i == 0 && (this.s & 128) != (r & 128) && ++i, (i > 0 || r != this.s) && (t[i++] = r);
|
|
530
530
|
return t;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function Te(e) {
|
|
533
533
|
return this.compareTo(e) == 0;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function Ee(e) {
|
|
536
536
|
return this.compareTo(e) < 0 ? this : e;
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function De(e) {
|
|
539
539
|
return this.compareTo(e) > 0 ? this : e;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function Oe(e, t, n) {
|
|
542
542
|
var r, i, a = Math.min(e.t, this.t);
|
|
543
543
|
for (r = 0; r < a; ++r) n[r] = t(this[r], e[r]);
|
|
544
544
|
if (e.t < this.t) {
|
|
@@ -550,19 +550,19 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
550
550
|
}
|
|
551
551
|
n.s = t(this.s, e.s), n.clamp();
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function ke(e, t) {
|
|
554
554
|
return e & t;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function V(e) {
|
|
557
557
|
var t = l();
|
|
558
|
-
return this.bitwiseTo(e,
|
|
558
|
+
return this.bitwiseTo(e, ke, t), t;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Ae(e, t) {
|
|
561
561
|
return e | t;
|
|
562
562
|
}
|
|
563
563
|
function je(e) {
|
|
564
564
|
var t = l();
|
|
565
|
-
return this.bitwiseTo(e,
|
|
565
|
+
return this.bitwiseTo(e, Ae, t), t;
|
|
566
566
|
}
|
|
567
567
|
function Me(e, t) {
|
|
568
568
|
return e ^ t;
|
|
@@ -616,7 +616,7 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
616
616
|
return this.bitwiseTo(n, t, n), n;
|
|
617
617
|
}
|
|
618
618
|
function Ue(e) {
|
|
619
|
-
return this.changeBit(e,
|
|
619
|
+
return this.changeBit(e, Ae);
|
|
620
620
|
}
|
|
621
621
|
function We(e) {
|
|
622
622
|
return this.changeBit(e, Pe);
|
|
@@ -727,7 +727,7 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
727
727
|
function ht(e, t) {
|
|
728
728
|
var n = e.bitLength(), r, i = S(1), a;
|
|
729
729
|
if (n <= 0) return i;
|
|
730
|
-
r = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, a = n < 8 ? new
|
|
730
|
+
r = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, a = n < 8 ? new L(t) : t.isEven() ? new lt(t) : new R(t);
|
|
731
731
|
var o = [], s = 3, c = r - 1, u = (1 << r) - 1;
|
|
732
732
|
if (o[1] = a.convert(this), r > 1) {
|
|
733
733
|
var d = l();
|
|
@@ -977,7 +977,7 @@ var T = /* @__PURE__ */ o(((e, t) => {
|
|
|
977
977
|
}
|
|
978
978
|
return !0;
|
|
979
979
|
}
|
|
980
|
-
c.prototype.chunkSize =
|
|
980
|
+
c.prototype.chunkSize = ye, c.prototype.toRadix = xe, c.prototype.fromRadix = Se, c.prototype.fromNumber = Ce, c.prototype.bitwiseTo = Oe, c.prototype.changeBit = He, c.prototype.addTo = Ke, c.prototype.dMultiply = et, c.prototype.dAddOffset = tt, c.prototype.multiplyLowerTo = st, c.prototype.multiplyUpperTo = ct, c.prototype.modInt = _t, c.prototype.millerRabin = xt, c.prototype.clone = ge, c.prototype.intValue = _e, c.prototype.byteValue = B, c.prototype.shortValue = ve, c.prototype.signum = be, c.prototype.toByteArray = we, c.prototype.equals = Te, c.prototype.min = Ee, c.prototype.max = De, c.prototype.and = V, c.prototype.or = je, c.prototype.xor = Ne, c.prototype.andNot = Fe, c.prototype.not = Ie, c.prototype.shiftLeft = H, c.prototype.shiftRight = Le, c.prototype.getLowestSetBit = ze, c.prototype.bitCount = U, c.prototype.testBit = Ve, c.prototype.setBit = Ue, c.prototype.clearBit = We, c.prototype.flipBit = Ge, c.prototype.add = qe, c.prototype.subtract = Je, c.prototype.multiply = Ye, c.prototype.divide = Ze, c.prototype.remainder = Qe, c.prototype.divideAndRemainder = $e, c.prototype.modPow = ht, c.prototype.modInverse = vt, c.prototype.pow = ot, c.prototype.gcd = gt, c.prototype.isProbablePrime = bt, c.prototype.square = Xe;
|
|
981
981
|
var G = c;
|
|
982
982
|
if (G.prototype.IsNegative = function() {
|
|
983
983
|
return this.compareTo(G.ZERO) == -1;
|
|
@@ -2777,24 +2777,24 @@ function P(e, t, n = 18) {
|
|
|
2777
2777
|
};
|
|
2778
2778
|
}));
|
|
2779
2779
|
}
|
|
2780
|
-
function
|
|
2780
|
+
function F(e, t) {
|
|
2781
2781
|
return e.x * t.y - e.y * t.x;
|
|
2782
2782
|
}
|
|
2783
|
-
function
|
|
2783
|
+
function I(e, t) {
|
|
2784
2784
|
return {
|
|
2785
2785
|
x: e.x - t.x,
|
|
2786
2786
|
y: e.y - t.y
|
|
2787
2787
|
};
|
|
2788
2788
|
}
|
|
2789
|
-
function
|
|
2789
|
+
function te(e, t) {
|
|
2790
2790
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
2791
2791
|
}
|
|
2792
|
-
function
|
|
2792
|
+
function ne(e, t, n, r) {
|
|
2793
2793
|
let i = t, a = r;
|
|
2794
2794
|
for (; a > 0;) {
|
|
2795
2795
|
let t = (i + n + e.length) % e.length, r = e[i], o = e[t];
|
|
2796
2796
|
if (!r || !o) throw Error("Bubble border path is invalid.");
|
|
2797
|
-
let s =
|
|
2797
|
+
let s = te(r, o);
|
|
2798
2798
|
if (a <= s) {
|
|
2799
2799
|
let e = a / s;
|
|
2800
2800
|
return {
|
|
@@ -2808,14 +2808,14 @@ function ie(e, t, n, r) {
|
|
|
2808
2808
|
if (!o) throw Error("Bubble border path is empty.");
|
|
2809
2809
|
return o;
|
|
2810
2810
|
}
|
|
2811
|
-
function
|
|
2811
|
+
function L(e, t, n, r, i) {
|
|
2812
2812
|
let a;
|
|
2813
2813
|
for (let r = 0; r < e.length; r += 1) {
|
|
2814
2814
|
let i = e[r], o = e[(r + 1) % e.length];
|
|
2815
2815
|
if (!i || !o) continue;
|
|
2816
|
-
let s =
|
|
2816
|
+
let s = I(o, i), c = F(n, s);
|
|
2817
2817
|
if (Math.abs(c) < 1e-9) continue;
|
|
2818
|
-
let l =
|
|
2818
|
+
let l = I(i, t), u = F(l, s) / c, d = F(l, n) / c;
|
|
2819
2819
|
u < 0 || d < -1e-9 || d > 1 + 1e-9 || a && u >= a.rayScale || (a = {
|
|
2820
2820
|
edgeIndex: r,
|
|
2821
2821
|
point: {
|
|
@@ -2833,58 +2833,58 @@ function F(e, t, n, r, i) {
|
|
|
2833
2833
|
], s = a.edgeIndex + 1;
|
|
2834
2834
|
return {
|
|
2835
2835
|
borderPoint: a.point,
|
|
2836
|
-
base: [
|
|
2836
|
+
base: [ne(o, s, -1, 9), ne(o, s, 1, 9)],
|
|
2837
2837
|
tip: {
|
|
2838
2838
|
x: i?.x ?? t.x + n.x * (a.rayScale + r),
|
|
2839
2839
|
y: i?.y ?? t.y + n.y * (a.rayScale + r)
|
|
2840
2840
|
}
|
|
2841
2841
|
};
|
|
2842
2842
|
}
|
|
2843
|
-
function
|
|
2843
|
+
function re(e) {
|
|
2844
2844
|
let t = e * Math.PI / 180;
|
|
2845
2845
|
return {
|
|
2846
2846
|
x: Math.sin(t),
|
|
2847
2847
|
y: -Math.cos(t)
|
|
2848
2848
|
};
|
|
2849
2849
|
}
|
|
2850
|
-
function
|
|
2850
|
+
function ie(e, t, n, r) {
|
|
2851
2851
|
return {
|
|
2852
2852
|
x: n.x + (e.x - t.x) * r,
|
|
2853
2853
|
y: n.y + (e.y - t.y) * r
|
|
2854
2854
|
};
|
|
2855
2855
|
}
|
|
2856
|
-
function
|
|
2856
|
+
function ae(e, t, n, r, i, a) {
|
|
2857
2857
|
let o = {
|
|
2858
2858
|
x: t / 2,
|
|
2859
2859
|
y: n / 2
|
|
2860
|
-
}, s =
|
|
2860
|
+
}, s = re(r), c = L(e, o, s, i), l = te(o, c.borderPoint), u = a.scalePercent / 100, d = {
|
|
2861
2861
|
x: o.x - s.x * l * (u - 1) + a.x,
|
|
2862
2862
|
y: o.y - s.y * l * (u - 1) - a.y
|
|
2863
2863
|
};
|
|
2864
2864
|
return {
|
|
2865
|
-
body: e.map((e) =>
|
|
2865
|
+
body: e.map((e) => ie(e, o, d, u)),
|
|
2866
2866
|
bodyCenter: d,
|
|
2867
2867
|
tip: c.tip
|
|
2868
2868
|
};
|
|
2869
2869
|
}
|
|
2870
|
-
function
|
|
2870
|
+
function oe(e) {
|
|
2871
2871
|
let t = e[0];
|
|
2872
2872
|
if (!t) throw Error("Bubble polygon is empty.");
|
|
2873
2873
|
return `M ${t.x.toFixed(4)} ${t.y.toFixed(4)} ${e.slice(1).map(({ x: e, y: t }) => `L ${e.toFixed(4)} ${t.toFixed(4)}`).join(" ")} Z`;
|
|
2874
2874
|
}
|
|
2875
|
-
function
|
|
2875
|
+
function se(e) {
|
|
2876
2876
|
return Math.abs(e.reduce((t, n, r) => {
|
|
2877
2877
|
let i = e[(r + 1) % e.length];
|
|
2878
2878
|
return i ? t + n.x * i.y - i.x * n.y : t;
|
|
2879
2879
|
}, 0) / 2);
|
|
2880
2880
|
}
|
|
2881
|
-
function
|
|
2882
|
-
return `<path d="${
|
|
2881
|
+
function ce(e, t, n, r = "") {
|
|
2882
|
+
return `<path d="${oe(e)}" fill="${t}" stroke="${n}" stroke-width="3" stroke-linejoin="round" ${r}/>`;
|
|
2883
2883
|
}
|
|
2884
|
-
function
|
|
2885
|
-
let o =
|
|
2884
|
+
function R(e, t, n, r, i, a = "") {
|
|
2885
|
+
let o = I(n, t), s = Math.hypot(o.x, o.y);
|
|
2886
2886
|
if (!(s > 0)) throw TypeError("Bubble body center and tail tip must differ.");
|
|
2887
|
-
let c =
|
|
2887
|
+
let c = L(e, t, {
|
|
2888
2888
|
x: o.x / s,
|
|
2889
2889
|
y: o.y / s
|
|
2890
2890
|
}, 0, n), l = (e) => e.map(({ x: e, y: t }) => [e, t]), u = E.default.union([l(e)], [[l([
|
|
@@ -2896,11 +2896,11 @@ function ce(e, t, n, r, i, a = "") {
|
|
|
2896
2896
|
let d = u.map((e) => e.map(([e, t]) => ({
|
|
2897
2897
|
x: e,
|
|
2898
2898
|
y: t
|
|
2899
|
-
}))).sort((e, t) =>
|
|
2899
|
+
}))).sort((e, t) => se(t) - se(e))[0];
|
|
2900
2900
|
if (!d) throw Error("JSClipper returned an empty Bubble outline.");
|
|
2901
|
-
return `<path d="${
|
|
2901
|
+
return `<path d="${oe(d)}" fill="${r}" stroke="${i}" stroke-width="3" stroke-linejoin="round" data-boolean-operation="union" data-tail-base-on-border="true" ${a}/>`;
|
|
2902
2902
|
}
|
|
2903
|
-
function
|
|
2903
|
+
function z(e, t, n, r) {
|
|
2904
2904
|
let i = e - 24, a = t - 24, o = e / 2, s = t / 2;
|
|
2905
2905
|
return `<path d="M 42 ${s}
|
|
2906
2906
|
C 22 ${s - 20}, 32 42, 60 44
|
|
@@ -2913,8 +2913,8 @@ function le(e, t, n, r) {
|
|
|
2913
2913
|
C 31 ${a + 2}, 17 ${s + 20}, 42 ${s} Z"
|
|
2914
2914
|
fill="${n}" stroke="${r}" stroke-width="3" stroke-linejoin="round"/>`;
|
|
2915
2915
|
}
|
|
2916
|
-
function
|
|
2917
|
-
let o =
|
|
2916
|
+
function le(e, t, n, r, i, a) {
|
|
2917
|
+
let o = I(n, t), s = Math.hypot(o.x, o.y), c = L(e, t, {
|
|
2918
2918
|
x: o.x / s,
|
|
2919
2919
|
y: o.y / s
|
|
2920
2920
|
}, 0, n), l = {
|
|
@@ -2942,7 +2942,7 @@ function ue(e, t, n, r, i, a) {
|
|
|
2942
2942
|
radius: 3.5
|
|
2943
2943
|
}]).map(({ ratio: e, radius: t }) => `<circle cx="${l.x + (c.tip.x - l.x) * e}" cy="${l.y + (c.tip.y - l.y) * e}" r="${t}" fill="${r}" stroke="${i}" stroke-width="2"/>`).join("");
|
|
2944
2944
|
}
|
|
2945
|
-
function
|
|
2945
|
+
function ue(e, t) {
|
|
2946
2946
|
let n = e / 2, r = t / 2;
|
|
2947
2947
|
return Array.from({ length: 28 }, (i, a) => {
|
|
2948
2948
|
let o = a * Math.PI * 2 / 28 - Math.PI / 2, s = a % 2 == 0, c = s ? e / 2 - 6 : e / 2 - 22, l = s ? t / 2 - 6 : t / 2 - 22;
|
|
@@ -2952,7 +2952,7 @@ function de(e, t) {
|
|
|
2952
2952
|
};
|
|
2953
2953
|
});
|
|
2954
2954
|
}
|
|
2955
|
-
function
|
|
2955
|
+
function de(e, t) {
|
|
2956
2956
|
let n = e - 24, r = t - 24, i = Array.from({ length: 21 }, (e, t) => {
|
|
2957
2957
|
let n = t / 20;
|
|
2958
2958
|
return {
|
|
@@ -2985,48 +2985,48 @@ function fe(e, t) {
|
|
|
2985
2985
|
}))
|
|
2986
2986
|
];
|
|
2987
2987
|
}
|
|
2988
|
-
function
|
|
2989
|
-
return e === "YELLING" ?
|
|
2988
|
+
function fe(e, t, n) {
|
|
2989
|
+
return e === "YELLING" ? ue(t, n) : e === "WAVY" ? de(t, n) : P(t, n);
|
|
2990
2990
|
}
|
|
2991
|
-
function
|
|
2991
|
+
function pe(e) {
|
|
2992
2992
|
let t = N(e.width, 220), n = N(e.height, 112), r = ee(e.tailDirection);
|
|
2993
2993
|
if (r === null) throw TypeError("Bubble body center offset requires a tail direction.");
|
|
2994
2994
|
let i = k(e.tailLength ?? D), a = A(e.offset), o = {
|
|
2995
2995
|
x: t / 2,
|
|
2996
2996
|
y: n / 2
|
|
2997
|
-
}, s =
|
|
2997
|
+
}, s = ae(fe(e.style, t, n), t, n, r, i, a);
|
|
2998
2998
|
return Object.freeze({
|
|
2999
2999
|
x: s.bodyCenter.x - o.x,
|
|
3000
3000
|
y: s.bodyCenter.y - o.y
|
|
3001
3001
|
});
|
|
3002
3002
|
}
|
|
3003
|
-
function
|
|
3004
|
-
let c = P(t, n), l = (e) => r === null ? e :
|
|
3005
|
-
if (r === null) return
|
|
3006
|
-
let l =
|
|
3007
|
-
return
|
|
3003
|
+
function me(e, t, n, r, i, a, o, s) {
|
|
3004
|
+
let c = P(t, n), l = (e) => r === null ? e : ae(e, t, n, r, o, s).body, u = (e, c = "") => {
|
|
3005
|
+
if (r === null) return ce(e, i, a, c);
|
|
3006
|
+
let l = ae(e, t, n, r, o, s);
|
|
3007
|
+
return R(l.body, l.bodyCenter, l.tip, i, a, c);
|
|
3008
3008
|
};
|
|
3009
3009
|
switch (e) {
|
|
3010
3010
|
case "NO_BUBBLE": return "";
|
|
3011
3011
|
case "THINKING":
|
|
3012
3012
|
case "DREAMING": {
|
|
3013
|
-
if (r === null) return
|
|
3014
|
-
let l =
|
|
3013
|
+
if (r === null) return z(t, n, i, a);
|
|
3014
|
+
let l = ae(c, t, n, r, o, s), u = s.scalePercent / 100, d = {
|
|
3015
3015
|
x: t / 2,
|
|
3016
3016
|
y: n / 2
|
|
3017
3017
|
}, f = l.bodyCenter.x - d.x * u, p = l.bodyCenter.y - d.y * u;
|
|
3018
|
-
return `${
|
|
3018
|
+
return `${le(l.body, l.bodyCenter, l.tip, i, a, e === "DREAMING")}<g transform="translate(${f} ${p}) scale(${u})">${z(t, n, i, a)}</g>`;
|
|
3019
3019
|
}
|
|
3020
|
-
case "YELLING": return u(
|
|
3021
|
-
case "WAVY": return u(
|
|
3020
|
+
case "YELLING": return u(ue(t, n));
|
|
3021
|
+
case "WAVY": return u(de(t, n));
|
|
3022
3022
|
case "WHISPERING": return u(c, "stroke-dasharray=\"5 5\"");
|
|
3023
3023
|
case "ANNOUNCEMENT": return `${u(c)}<rect x="30" y="30" width="${t - 60}" height="${n - 60}" rx="13" fill="none" stroke="${a}" stroke-width="1.5"/>`;
|
|
3024
|
-
case "NARRATION": return
|
|
3024
|
+
case "NARRATION": return ce(l(c), i, a);
|
|
3025
3025
|
case "OFF_PANEL": return u(c);
|
|
3026
3026
|
case "NORMAL": return u(c);
|
|
3027
3027
|
}
|
|
3028
3028
|
}
|
|
3029
|
-
function
|
|
3029
|
+
function he(e) {
|
|
3030
3030
|
if (!j.includes(e.style)) throw TypeError(`Unsupported Bubble visual style: ${String(e.style)}`);
|
|
3031
3031
|
if (!Array.isArray(e.lines) || e.lines.some((e) => typeof e != "string")) throw TypeError("lines must be an array of strings.");
|
|
3032
3032
|
let t = N(e.width, 220), n = N(e.height, 112), r = N(e.fontSize, 15), i = ee(e.tailDirection), a = k(e.tailLength ?? D), o = e.offset === void 0 ? O : A(e.offset), s = e.shapeTransition;
|
|
@@ -3034,12 +3034,12 @@ function ge(e) {
|
|
|
3034
3034
|
let c = e.fillColor ?? "#fff4cc", l = e.borderColor ?? "#6f5b45", u = e.textColor ?? "#25283a", d = e.fontFamily ?? "Noto Sans JP, sans-serif", f = r * 1.35, p = n / 2 - (e.lines.length - 1) * f / 2 + r * .35, m = i === null ? 1 : o.scalePercent / 100, h = i === null ? {
|
|
3035
3035
|
x: t / 2,
|
|
3036
3036
|
y: n / 2
|
|
3037
|
-
} :
|
|
3037
|
+
} : ae(P(t, n), t, n, i, a, o).bodyCenter, g = e.lines.map((e, t) => `<text x="${h.x}" y="${h.y + (p + t * f - n / 2) * m}" text-anchor="middle" fill="${M(u)}" font-family="${M(d)}" font-size="${r * m}">${M(e)}</text>`).join(""), _ = s === void 0 ? me(e.style, t, n, i, c, l, a, o) : `<g opacity="${(1 - s.progress).toFixed(4)}">${me(s.from, t, n, i, c, l, a, o)}</g><g opacity="${s.progress.toFixed(4)}">${me(s.to, t, n, i, c, l, a, o)}</g>`, v = M(e.title ?? `${e.style} bubble`), y = s === void 0 ? "" : ` data-bubble-shape-transition-from="${s.from}" data-bubble-shape-transition-to="${s.to}" data-bubble-shape-transition-progress="${s.progress.toFixed(4)}"`;
|
|
3038
3038
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}" viewBox="0 0 ${t} ${n}" role="img" data-bubble-renderer="canonical" data-bubble-style="${e.style}"${y}><title>${v}</title>${_}${g}</svg>`;
|
|
3039
3039
|
}
|
|
3040
3040
|
//#endregion
|
|
3041
3041
|
//#region node_modules/.pnpm/@cto.af+unicode-trie-runtime@3.2.9/node_modules/@cto.af/unicode-trie-runtime/constants.js
|
|
3042
|
-
var
|
|
3042
|
+
var ge = 2048, _e = 2112, B = Uint8Array, ve = Uint16Array, ye = Int32Array, be = new B([
|
|
3043
3043
|
0,
|
|
3044
3044
|
0,
|
|
3045
3045
|
0,
|
|
@@ -3072,7 +3072,7 @@ var _e = 2048, ve = 2112, z = Uint8Array, ye = Uint16Array, be = Int32Array, xe
|
|
|
3072
3072
|
0,
|
|
3073
3073
|
0,
|
|
3074
3074
|
0
|
|
3075
|
-
]),
|
|
3075
|
+
]), xe = new B([
|
|
3076
3076
|
0,
|
|
3077
3077
|
0,
|
|
3078
3078
|
0,
|
|
@@ -3105,7 +3105,7 @@ var _e = 2048, ve = 2112, z = Uint8Array, ye = Uint16Array, be = Int32Array, xe
|
|
|
3105
3105
|
13,
|
|
3106
3106
|
0,
|
|
3107
3107
|
0
|
|
3108
|
-
]),
|
|
3108
|
+
]), Se = new B([
|
|
3109
3109
|
16,
|
|
3110
3110
|
17,
|
|
3111
3111
|
18,
|
|
@@ -3125,37 +3125,37 @@ var _e = 2048, ve = 2112, z = Uint8Array, ye = Uint16Array, be = Int32Array, xe
|
|
|
3125
3125
|
14,
|
|
3126
3126
|
1,
|
|
3127
3127
|
15
|
|
3128
|
-
]),
|
|
3129
|
-
for (var n = new
|
|
3130
|
-
for (var i = new
|
|
3128
|
+
]), Ce = function(e, t) {
|
|
3129
|
+
for (var n = new ve(31), r = 0; r < 31; ++r) n[r] = t += 1 << e[r - 1];
|
|
3130
|
+
for (var i = new ye(n[30]), r = 1; r < 30; ++r) for (var a = n[r]; a < n[r + 1]; ++a) i[a] = a - n[r] << 5 | r;
|
|
3131
3131
|
return {
|
|
3132
3132
|
b: n,
|
|
3133
3133
|
r: i
|
|
3134
3134
|
};
|
|
3135
|
-
},
|
|
3136
|
-
|
|
3137
|
-
var
|
|
3138
|
-
|
|
3139
|
-
for (var
|
|
3140
|
-
var
|
|
3141
|
-
|
|
3135
|
+
}, we = Ce(be, 2), Te = we.b, Ee = we.r;
|
|
3136
|
+
Te[28] = 258, Ee[258] = 28;
|
|
3137
|
+
var De = Ce(xe, 0), Oe = De.b;
|
|
3138
|
+
De.r;
|
|
3139
|
+
for (var ke = new ve(32768), V = 0; V < 32768; ++V) {
|
|
3140
|
+
var Ae = (V & 43690) >> 1 | (V & 21845) << 1;
|
|
3141
|
+
Ae = (Ae & 52428) >> 2 | (Ae & 13107) << 2, Ae = (Ae & 61680) >> 4 | (Ae & 3855) << 4, ke[V] = ((Ae & 65280) >> 8 | (Ae & 255) << 8) >> 1;
|
|
3142
3142
|
}
|
|
3143
3143
|
for (var je = (function(e, t, n) {
|
|
3144
|
-
for (var r = e.length, i = 0, a = new
|
|
3145
|
-
var o = new
|
|
3144
|
+
for (var r = e.length, i = 0, a = new ve(t); i < r; ++i) e[i] && ++a[e[i] - 1];
|
|
3145
|
+
var o = new ve(t);
|
|
3146
3146
|
for (i = 1; i < t; ++i) o[i] = o[i - 1] + a[i - 1] << 1;
|
|
3147
3147
|
var s;
|
|
3148
3148
|
if (n) {
|
|
3149
|
-
s = new
|
|
3149
|
+
s = new ve(1 << t);
|
|
3150
3150
|
var c = 15 - t;
|
|
3151
|
-
for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], u = t - e[i], d = o[e[i] - 1]++ << u, f = d | (1 << u) - 1; d <= f; ++d) s[
|
|
3152
|
-
} else for (s = new
|
|
3151
|
+
for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], u = t - e[i], d = o[e[i] - 1]++ << u, f = d | (1 << u) - 1; d <= f; ++d) s[ke[d] >> c] = l;
|
|
3152
|
+
} else for (s = new ve(r), i = 0; i < r; ++i) e[i] && (s[i] = ke[o[e[i] - 1]++] >> 15 - e[i]);
|
|
3153
3153
|
return s;
|
|
3154
|
-
}), Me = new
|
|
3155
|
-
for (var
|
|
3156
|
-
for (var
|
|
3157
|
-
for (var
|
|
3158
|
-
for (var Ne = new
|
|
3154
|
+
}), Me = new B(288), V = 0; V < 144; ++V) Me[V] = 8;
|
|
3155
|
+
for (var V = 144; V < 256; ++V) Me[V] = 9;
|
|
3156
|
+
for (var V = 256; V < 280; ++V) Me[V] = 7;
|
|
3157
|
+
for (var V = 280; V < 288; ++V) Me[V] = 8;
|
|
3158
|
+
for (var Ne = new B(32), V = 0; V < 32; ++V) Ne[V] = 5;
|
|
3159
3159
|
var Pe = /*#__PURE__*/ je(Me, 9, 1), Fe = /*#__PURE__*/ je(Ne, 5, 1), Ie = function(e) {
|
|
3160
3160
|
for (var t = e[0], n = 1; n < e.length; ++n) e[n] > t && (t = e[n]);
|
|
3161
3161
|
return t;
|
|
@@ -3168,7 +3168,7 @@ var Pe = /*#__PURE__*/ je(Me, 9, 1), Fe = /*#__PURE__*/ je(Ne, 5, 1), Ie = funct
|
|
|
3168
3168
|
}, Re = function(e) {
|
|
3169
3169
|
return (e + 7) / 8 | 0;
|
|
3170
3170
|
}, ze = function(e, t, n) {
|
|
3171
|
-
return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new
|
|
3171
|
+
return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new B(e.subarray(t, n));
|
|
3172
3172
|
}, Be = [
|
|
3173
3173
|
"unexpected EOF",
|
|
3174
3174
|
"invalid block type",
|
|
@@ -3190,13 +3190,13 @@ var Pe = /*#__PURE__*/ je(Me, 9, 1), Fe = /*#__PURE__*/ je(Ne, 5, 1), Ie = funct
|
|
|
3190
3190
|
return r;
|
|
3191
3191
|
}, Ve = function(e, t, n, r) {
|
|
3192
3192
|
var i = e.length, a = r ? r.length : 0;
|
|
3193
|
-
if (!i || t.f && !t.l) return n || new
|
|
3193
|
+
if (!i || t.f && !t.l) return n || new B(0);
|
|
3194
3194
|
var o = !n, s = o || t.i != 2, c = t.i;
|
|
3195
|
-
o && (n = new
|
|
3195
|
+
o && (n = new B(i * 3));
|
|
3196
3196
|
var l = function(e) {
|
|
3197
3197
|
var t = n.length;
|
|
3198
3198
|
if (e > t) {
|
|
3199
|
-
var r = new
|
|
3199
|
+
var r = new B(Math.max(t * 2, e));
|
|
3200
3200
|
r.set(n), n = r;
|
|
3201
3201
|
}
|
|
3202
3202
|
}, u = t.f || 0, d = t.p || 0, f = t.b || 0, p = t.l, m = t.d, h = t.m, g = t.n, _ = i * 8;
|
|
@@ -3217,7 +3217,7 @@ var Pe = /*#__PURE__*/ je(Me, 9, 1), Fe = /*#__PURE__*/ je(Ne, 5, 1), Ie = funct
|
|
|
3217
3217
|
else if (v == 2) {
|
|
3218
3218
|
var S = H(e, d, 31) + 257, C = H(e, d + 10, 15) + 4, w = S + H(e, d + 5, 31) + 1;
|
|
3219
3219
|
d += 14;
|
|
3220
|
-
for (var T = new
|
|
3220
|
+
for (var T = new B(w), E = new B(19), D = 0; D < C; ++D) E[Se[D]] = H(e, d + D * 3, 7);
|
|
3221
3221
|
d += C * 3;
|
|
3222
3222
|
for (var O = Ie(E), k = (1 << O) - 1, A = je(E, O, 1), D = 0; D < w;) {
|
|
3223
3223
|
var j = A[H(e, d, k)];
|
|
@@ -3238,46 +3238,46 @@ var Pe = /*#__PURE__*/ je(Me, 9, 1), Fe = /*#__PURE__*/ je(Ne, 5, 1), Ie = funct
|
|
|
3238
3238
|
}
|
|
3239
3239
|
}
|
|
3240
3240
|
s && l(f + 131072);
|
|
3241
|
-
for (var
|
|
3242
|
-
var M = p[Le(e, d) &
|
|
3241
|
+
for (var F = (1 << h) - 1, I = (1 << g) - 1, te = d;; te = d) {
|
|
3242
|
+
var M = p[Le(e, d) & F], ne = M >> 4;
|
|
3243
3243
|
if (d += M & 15, d > _) {
|
|
3244
3244
|
c && U(0);
|
|
3245
3245
|
break;
|
|
3246
3246
|
}
|
|
3247
|
-
if (M || U(2),
|
|
3248
|
-
else if (
|
|
3249
|
-
|
|
3247
|
+
if (M || U(2), ne < 256) n[f++] = ne;
|
|
3248
|
+
else if (ne == 256) {
|
|
3249
|
+
te = d, p = null;
|
|
3250
3250
|
break;
|
|
3251
3251
|
} else {
|
|
3252
|
-
var
|
|
3253
|
-
if (
|
|
3254
|
-
var D =
|
|
3255
|
-
|
|
3252
|
+
var L = ne - 254;
|
|
3253
|
+
if (ne > 264) {
|
|
3254
|
+
var D = ne - 257, re = be[D];
|
|
3255
|
+
L = H(e, d, (1 << re) - 1) + Te[D], d += re;
|
|
3256
3256
|
}
|
|
3257
|
-
var
|
|
3258
|
-
|
|
3259
|
-
var P =
|
|
3260
|
-
if (
|
|
3261
|
-
var
|
|
3262
|
-
P += Le(e, d) & (1 <<
|
|
3257
|
+
var ie = m[Le(e, d) & I], ae = ie >> 4;
|
|
3258
|
+
ie || U(3), d += ie & 15;
|
|
3259
|
+
var P = Oe[ae];
|
|
3260
|
+
if (ae > 3) {
|
|
3261
|
+
var re = xe[ae];
|
|
3262
|
+
P += Le(e, d) & (1 << re) - 1, d += re;
|
|
3263
3263
|
}
|
|
3264
3264
|
if (d > _) {
|
|
3265
3265
|
c && U(0);
|
|
3266
3266
|
break;
|
|
3267
3267
|
}
|
|
3268
3268
|
s && l(f + 131072);
|
|
3269
|
-
var
|
|
3269
|
+
var oe = f + L;
|
|
3270
3270
|
if (f < P) {
|
|
3271
|
-
var
|
|
3272
|
-
for (
|
|
3271
|
+
var se = a - P, ce = Math.min(P, oe);
|
|
3272
|
+
for (se + f < 0 && U(3); f < ce; ++f) n[f] = r[se + f];
|
|
3273
3273
|
}
|
|
3274
|
-
for (; f <
|
|
3274
|
+
for (; f < oe; ++f) n[f] = n[f - P];
|
|
3275
3275
|
}
|
|
3276
3276
|
}
|
|
3277
|
-
t.l = p, t.p =
|
|
3277
|
+
t.l = p, t.p = te, t.b = f, t.f = u, p && (u = 1, t.m = h, t.d = m, t.n = g);
|
|
3278
3278
|
} while (!u);
|
|
3279
3279
|
return f != n.length && o ? ze(n, 0, f) : n.subarray(0, f);
|
|
3280
|
-
}, He = /*#__PURE__*/ new
|
|
3280
|
+
}, He = /*#__PURE__*/ new B(0), Ue = function(e) {
|
|
3281
3281
|
(e[0] != 31 || e[1] != 139 || e[2] != 8) && U(6, "invalid gzip data");
|
|
3282
3282
|
var t = e[3], n = 10;
|
|
3283
3283
|
t & 4 && (n += (e[10] | e[11] << 8) + 2);
|
|
@@ -3289,7 +3289,7 @@ var Pe = /*#__PURE__*/ je(Me, 9, 1), Fe = /*#__PURE__*/ je(Ne, 5, 1), Ie = funct
|
|
|
3289
3289
|
};
|
|
3290
3290
|
function Ge(e, t) {
|
|
3291
3291
|
var n = Ue(e);
|
|
3292
|
-
return n + 8 > e.length && U(6, "invalid gzip data"), Ve(e.subarray(n, -8), { i: 2 }, t && t.out || new
|
|
3292
|
+
return n + 8 > e.length && U(6, "invalid gzip data"), Ve(e.subarray(n, -8), { i: 2 }, t && t.out || new B(We(e)), t && t.dictionary);
|
|
3293
3293
|
}
|
|
3294
3294
|
var Ke = typeof TextDecoder < "u" && /*#__PURE__*/ new TextDecoder();
|
|
3295
3295
|
try {
|
|
@@ -3328,10 +3328,10 @@ var Xe = qe ? Je : Ye, Ze = new TextDecoder(), Qe = class e {
|
|
|
3328
3328
|
let n = (this.data[e >> 5] << 2) + (e & 31);
|
|
3329
3329
|
t = this.data[n];
|
|
3330
3330
|
} else if (e <= 65535) {
|
|
3331
|
-
let n = (this.data[
|
|
3331
|
+
let n = (this.data[ge + (e - 55296 >> 5)] << 2) + (e & 31);
|
|
3332
3332
|
t = this.data[n];
|
|
3333
3333
|
} else if (e < this.highStart) {
|
|
3334
|
-
let n = this.data[
|
|
3334
|
+
let n = this.data[_e - 32 + (e >> 11)];
|
|
3335
3335
|
n = this.data[n + (e >> 5 & 63)], n = (n << 2) + (e & 31), t = this.data[n];
|
|
3336
3336
|
} else t = this.data[this.data.length - 4];
|
|
3337
3337
|
return t;
|
|
@@ -4005,17 +4005,55 @@ function Tr(e, t) {
|
|
|
4005
4005
|
return e.slice(0, Math.max(0, Math.min(t, e.length))).join("");
|
|
4006
4006
|
}
|
|
4007
4007
|
//#endregion
|
|
4008
|
+
//#region src/portrait-layout.ts
|
|
4009
|
+
var Er = Object.freeze([
|
|
4010
|
+
"left",
|
|
4011
|
+
"right",
|
|
4012
|
+
"top-left",
|
|
4013
|
+
"top-right",
|
|
4014
|
+
"bottom-left",
|
|
4015
|
+
"bottom-right"
|
|
4016
|
+
]), Dr = Object.freeze({
|
|
4017
|
+
x: 0,
|
|
4018
|
+
y: 0,
|
|
4019
|
+
zoomPercent: 100
|
|
4020
|
+
});
|
|
4021
|
+
function Or(e) {
|
|
4022
|
+
if (typeof e != "string") throw TypeError("Bubble portrait placement must be a string.");
|
|
4023
|
+
let t = e.trim().toLowerCase().replaceAll("_", "-");
|
|
4024
|
+
if (!Er.includes(t)) throw TypeError(`Unsupported Bubble portrait placement: ${e}`);
|
|
4025
|
+
return t;
|
|
4026
|
+
}
|
|
4027
|
+
function kr(e) {
|
|
4028
|
+
if (!Array.isArray(e) || e.length !== 2 && e.length !== 3) throw TypeError("Bubble portrait offset must be [x, y] or [x, y, zoom].");
|
|
4029
|
+
let [t, n, r = 100] = e;
|
|
4030
|
+
if (![
|
|
4031
|
+
t,
|
|
4032
|
+
n,
|
|
4033
|
+
r
|
|
4034
|
+
].every(Number.isFinite) || r <= 0) throw TypeError("Bubble portrait offset values must be finite and zoom positive.");
|
|
4035
|
+
return Object.freeze({
|
|
4036
|
+
x: t,
|
|
4037
|
+
y: n,
|
|
4038
|
+
zoomPercent: r
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4041
|
+
function Ar(e) {
|
|
4042
|
+
if (typeof e != "number" || !Number.isFinite(e) || e < 0) throw TypeError("Bubble portrait corner radius must be zero or greater.");
|
|
4043
|
+
return e;
|
|
4044
|
+
}
|
|
4045
|
+
//#endregion
|
|
4008
4046
|
//#region src/composition.ts
|
|
4009
4047
|
var Z = class extends Error {
|
|
4010
4048
|
code;
|
|
4011
4049
|
constructor(e, t) {
|
|
4012
4050
|
super(t), this.name = "BubbleCompositionError", this.code = e;
|
|
4013
4051
|
}
|
|
4014
|
-
},
|
|
4052
|
+
}, jr = /* @__PURE__ */ new Set(["say", "think"]), Mr = /* @__PURE__ */ new Set([
|
|
4015
4053
|
"idle",
|
|
4016
4054
|
"talking",
|
|
4017
4055
|
"awaiting-continue"
|
|
4018
|
-
]),
|
|
4056
|
+
]), Nr = /* @__PURE__ */ new Set([
|
|
4019
4057
|
"fadeIn",
|
|
4020
4058
|
"fadeOut",
|
|
4021
4059
|
"floatIn",
|
|
@@ -4027,7 +4065,7 @@ var Z = class extends Error {
|
|
|
4027
4065
|
"shake",
|
|
4028
4066
|
"explode",
|
|
4029
4067
|
"animateBubbleShape"
|
|
4030
|
-
]),
|
|
4068
|
+
]), Pr = /* @__PURE__ */ new Set([
|
|
4031
4069
|
"linear",
|
|
4032
4070
|
"easeIn",
|
|
4033
4071
|
"easeOut",
|
|
@@ -4036,41 +4074,55 @@ var Z = class extends Error {
|
|
|
4036
4074
|
function Q(e) {
|
|
4037
4075
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4038
4076
|
}
|
|
4039
|
-
function
|
|
4077
|
+
function Fr(e, t, n, r) {
|
|
4040
4078
|
let i = /* @__PURE__ */ new Set([...t, ...n]), a = t.filter((t) => !Object.prototype.hasOwnProperty.call(e, t)), o = Object.keys(e).filter((e) => !i.has(e));
|
|
4041
4079
|
if (a.length > 0 || o.length > 0) throw new Z("BUBBLE-COMPOSITION-001", `${r} has missing or unknown properties.`);
|
|
4042
4080
|
}
|
|
4043
|
-
function
|
|
4081
|
+
function Ir(e, t) {
|
|
4044
4082
|
if (typeof e != "string" || e.trim().length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4045
4083
|
return e.trim();
|
|
4046
4084
|
}
|
|
4047
|
-
function
|
|
4085
|
+
function Lr(e, t) {
|
|
4048
4086
|
if (typeof e != "string" || e.length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4049
4087
|
return e;
|
|
4050
4088
|
}
|
|
4051
|
-
function
|
|
4089
|
+
function Rr(e, t, n) {
|
|
4052
4090
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4053
|
-
if (
|
|
4054
|
-
let r = Object.freeze(e.frames.map((e, n) =>
|
|
4091
|
+
if (Fr(e, ["frames", "frameIntervalSeconds"], [], t), !Array.isArray(e.frames) || e.frames.length < n) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frames must contain at least ${n} image asset name${n === 1 ? "" : "s"}.`);
|
|
4092
|
+
let r = Object.freeze(e.frames.map((e, n) => Lr(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
|
|
4055
4093
|
if (typeof i != "number" || !Number.isFinite(i) || i <= 0) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frameIntervalSeconds must be a positive finite number.`);
|
|
4056
4094
|
return Object.freeze({
|
|
4057
4095
|
frames: r,
|
|
4058
4096
|
frameIntervalSeconds: i
|
|
4059
4097
|
});
|
|
4060
4098
|
}
|
|
4061
|
-
function
|
|
4099
|
+
function zr(e) {
|
|
4062
4100
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
|
|
4063
|
-
|
|
4064
|
-
|
|
4101
|
+
Fr(e, ["base"], [
|
|
4102
|
+
"blink",
|
|
4103
|
+
"lipSync",
|
|
4104
|
+
"placement",
|
|
4105
|
+
"offset",
|
|
4106
|
+
"cornerRadius"
|
|
4107
|
+
], "Bubble portrait");
|
|
4108
|
+
let t = e.blink === void 0 ? void 0 : Rr(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : Rr(e.lipSync, "Bubble portrait lip-sync", 1), r, i, a;
|
|
4109
|
+
try {
|
|
4110
|
+
r = Or(e.placement ?? "left"), i = e.offset === void 0 ? Dr : kr(e.offset), a = Ar(e.cornerRadius ?? 0);
|
|
4111
|
+
} catch (e) {
|
|
4112
|
+
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble portrait layout is invalid.");
|
|
4113
|
+
}
|
|
4065
4114
|
return Object.freeze({
|
|
4066
|
-
base:
|
|
4115
|
+
base: Lr(e.base, "Bubble portrait base"),
|
|
4067
4116
|
...t === void 0 ? {} : { blink: t },
|
|
4068
|
-
...n === void 0 ? {} : { lipSync: n }
|
|
4117
|
+
...n === void 0 ? {} : { lipSync: n },
|
|
4118
|
+
placement: r,
|
|
4119
|
+
offset: i,
|
|
4120
|
+
cornerRadius: a
|
|
4069
4121
|
});
|
|
4070
4122
|
}
|
|
4071
|
-
function
|
|
4123
|
+
function Br(e, t) {
|
|
4072
4124
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4073
|
-
if (
|
|
4125
|
+
if (Fr(e, ["name"], [
|
|
4074
4126
|
"durationSeconds",
|
|
4075
4127
|
"ease",
|
|
4076
4128
|
"direction",
|
|
@@ -4078,7 +4130,7 @@ function Fr(e, t) {
|
|
|
4078
4130
|
"relativeScale",
|
|
4079
4131
|
"speed",
|
|
4080
4132
|
"visualStyle"
|
|
4081
|
-
], t), !
|
|
4133
|
+
], t), !Nr.has(e.name)) throw new Z("BUBBLE-COMPOSITION-001", `${t}.name is not a supported Bubble motion.`);
|
|
4082
4134
|
let n = (n, r, i = !1) => {
|
|
4083
4135
|
let a = e[n];
|
|
4084
4136
|
if (a !== void 0) {
|
|
@@ -4088,7 +4140,7 @@ function Fr(e, t) {
|
|
|
4088
4140
|
}, r = n("durationSeconds", 0), i = n("count", 1, !0), a = n("relativeScale", 0), o = n("speed", 0), s = e.direction;
|
|
4089
4141
|
if (s !== void 0 && typeof s != "number" && typeof s != "string") throw new Z("BUBBLE-COMPOSITION-001", `${t}.direction is invalid.`);
|
|
4090
4142
|
let c = e.ease ?? "easeInOut";
|
|
4091
|
-
if (typeof c != "string" || !
|
|
4143
|
+
if (typeof c != "string" || !Pr.has(c)) throw new Z("BUBBLE-COMPOSITION-001", `${t}.ease is invalid.`);
|
|
4092
4144
|
let l = e.visualStyle;
|
|
4093
4145
|
if (l !== void 0 && (typeof l != "string" || !j.includes(l))) throw new Z("BUBBLE-COMPOSITION-001", `${t}.visualStyle is invalid.`);
|
|
4094
4146
|
return Object.freeze({
|
|
@@ -4102,10 +4154,10 @@ function Fr(e, t) {
|
|
|
4102
4154
|
...l === void 0 ? {} : { visualStyle: l }
|
|
4103
4155
|
});
|
|
4104
4156
|
}
|
|
4105
|
-
function
|
|
4157
|
+
function Vr(e) {
|
|
4106
4158
|
if (e === void 0) return;
|
|
4107
4159
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
|
|
4108
|
-
|
|
4160
|
+
Fr(e, [], [
|
|
4109
4161
|
"voice",
|
|
4110
4162
|
"reveal",
|
|
4111
4163
|
"finish"
|
|
@@ -4117,13 +4169,13 @@ function Ir(e) {
|
|
|
4117
4169
|
"finish"
|
|
4118
4170
|
]) {
|
|
4119
4171
|
let r = e[n];
|
|
4120
|
-
r !== void 0 && (t[n] =
|
|
4172
|
+
r !== void 0 && (t[n] = Lr(r, `Bubble audio ${n}`));
|
|
4121
4173
|
}
|
|
4122
4174
|
return Object.freeze(t);
|
|
4123
4175
|
}
|
|
4124
|
-
function
|
|
4176
|
+
function Hr(e) {
|
|
4125
4177
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
|
|
4126
|
-
|
|
4178
|
+
Fr(e, ["name", "textStyle"], [
|
|
4127
4179
|
"placement",
|
|
4128
4180
|
"maxWidth",
|
|
4129
4181
|
"textLocale",
|
|
@@ -4138,13 +4190,13 @@ function Lr(e) {
|
|
|
4138
4190
|
"showAnimation",
|
|
4139
4191
|
"hideAnimation"
|
|
4140
4192
|
], "Bubble style");
|
|
4141
|
-
let t = e.portrait === void 0 ? void 0 :
|
|
4193
|
+
let t = e.portrait === void 0 ? void 0 : zr(e.portrait), n = e.continueIndicator === void 0 ? void 0 : Rr(e.continueIndicator, "Bubble continue indicator", 2), r;
|
|
4142
4194
|
if (e.reveal !== void 0) try {
|
|
4143
4195
|
r = Sr(e.reveal);
|
|
4144
4196
|
} catch (e) {
|
|
4145
4197
|
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
|
|
4146
4198
|
}
|
|
4147
|
-
let i =
|
|
4199
|
+
let i = Vr(e.audio), a = e.showAnimation === void 0 ? void 0 : Br(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : Br(e.hideAnimation, "Bubble hideAnimation"), s;
|
|
4148
4200
|
try {
|
|
4149
4201
|
s = _(e.placement ?? "up-right");
|
|
4150
4202
|
} catch (e) {
|
|
@@ -4163,10 +4215,10 @@ function Lr(e) {
|
|
|
4163
4215
|
if (typeof e.maxWidth != "number" || !Number.isFinite(e.maxWidth) || e.maxWidth <= 0) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style maxWidth must be a positive finite number.");
|
|
4164
4216
|
f = e.maxWidth;
|
|
4165
4217
|
}
|
|
4166
|
-
let p = e.textLocale === void 0 ? void 0 :
|
|
4218
|
+
let p = e.textLocale === void 0 ? void 0 : Ir(e.textLocale, "Bubble style text locale");
|
|
4167
4219
|
return Object.freeze({
|
|
4168
|
-
name:
|
|
4169
|
-
textStyle:
|
|
4220
|
+
name: Ir(e.name, "Bubble style name"),
|
|
4221
|
+
textStyle: Ir(e.textStyle, "Bubble text style name"),
|
|
4170
4222
|
...f === void 0 ? {} : { maxWidth: f },
|
|
4171
4223
|
...p === void 0 ? {} : { textLocale: p },
|
|
4172
4224
|
placement: s,
|
|
@@ -4182,13 +4234,13 @@ function Lr(e) {
|
|
|
4182
4234
|
...o === void 0 ? {} : { hideAnimation: o }
|
|
4183
4235
|
});
|
|
4184
4236
|
}
|
|
4185
|
-
function
|
|
4237
|
+
function Ur(e) {
|
|
4186
4238
|
if (e !== void 0) {
|
|
4187
4239
|
if (!Q(e) || typeof e.applyToTarget != "function" || typeof e.getMimeType != "function" || typeof e.isRegistered != "function") throw TypeError("Bubble image capability must provide applyToTarget, getMimeType, and isRegistered.");
|
|
4188
4240
|
return e;
|
|
4189
4241
|
}
|
|
4190
4242
|
}
|
|
4191
|
-
function
|
|
4243
|
+
function Wr(e) {
|
|
4192
4244
|
if (e !== void 0) {
|
|
4193
4245
|
if (!Q(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
|
|
4194
4246
|
if (e.isRegistered !== void 0 && typeof e.isRegistered != "function") throw TypeError("Bubble audio capability isRegistered must be a function.");
|
|
@@ -4196,64 +4248,64 @@ function zr(e) {
|
|
|
4196
4248
|
return e;
|
|
4197
4249
|
}
|
|
4198
4250
|
}
|
|
4199
|
-
function
|
|
4251
|
+
function Gr(e) {
|
|
4200
4252
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", "Bubble image assets require an image capability. Provide options.imageResolver.");
|
|
4201
4253
|
return e;
|
|
4202
4254
|
}
|
|
4203
|
-
function
|
|
4255
|
+
function Kr(e) {
|
|
4204
4256
|
if (!Q(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble text capability must provide setText and releaseTarget.");
|
|
4205
4257
|
return e;
|
|
4206
4258
|
}
|
|
4207
|
-
function
|
|
4259
|
+
function qr() {
|
|
4208
4260
|
return Object.freeze({
|
|
4209
4261
|
setTimeout: (e, t) => globalThis.setTimeout(e, t),
|
|
4210
4262
|
clearTimeout: (e) => globalThis.clearTimeout(e)
|
|
4211
4263
|
});
|
|
4212
4264
|
}
|
|
4213
|
-
function
|
|
4265
|
+
function Jr(e) {
|
|
4214
4266
|
if (!Q(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
|
|
4215
4267
|
return e;
|
|
4216
4268
|
}
|
|
4217
|
-
function
|
|
4269
|
+
function Yr(e, t) {
|
|
4218
4270
|
if (!Q(e) || typeof e.id != "string" || e.id.length === 0 || typeof e.isStage != "boolean") throw new Z("BUBBLE-COMPOSITION-004", `${t} must provide id and isStage.`);
|
|
4219
4271
|
return e;
|
|
4220
4272
|
}
|
|
4221
|
-
function
|
|
4273
|
+
function Xr(e) {
|
|
4222
4274
|
if (typeof e != "object" || !e) throw new Z("BUBBLE-COMPOSITION-004", "Bubble text target must be a non-null object.");
|
|
4223
4275
|
return e;
|
|
4224
4276
|
}
|
|
4225
|
-
function
|
|
4277
|
+
function Zr(e, t) {
|
|
4226
4278
|
if (!Q(e) || !Q(e.targets) || typeof e.setLayerVisible != "function" || typeof e.updateStyle != "function" || typeof e.show != "function" || typeof e.hide != "function" || typeof e.dispose != "function") throw new Z("BUBBLE-COMPOSITION-004", "Bubble surface is invalid.");
|
|
4227
4279
|
let n = e.targets;
|
|
4228
|
-
|
|
4280
|
+
Xr(n.text);
|
|
4229
4281
|
let r = /* @__PURE__ */ new Set(), i = (e, t) => {
|
|
4230
4282
|
let i = n[e];
|
|
4231
4283
|
if (!t && i === void 0) return;
|
|
4232
|
-
let a =
|
|
4284
|
+
let a = Yr(i, `Bubble surface ${e}`);
|
|
4233
4285
|
if (r.has(a.id)) throw new Z("BUBBLE-COMPOSITION-004", "Bubble image layers must use distinct target IDs.");
|
|
4234
4286
|
r.add(a.id);
|
|
4235
4287
|
};
|
|
4236
4288
|
return i("portraitBase", t.portrait !== void 0), i("portraitBlink", t.portrait?.blink !== void 0), i("portraitLipSync", t.portrait?.lipSync !== void 0), i("continueIndicator", t.continueIndicator !== void 0), e;
|
|
4237
4289
|
}
|
|
4238
|
-
function
|
|
4290
|
+
function Qr(e, t) {
|
|
4239
4291
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble image capability is required for: ${t}. Provide options.imageResolver.`);
|
|
4240
4292
|
if (!e.isRegistered(t)) throw new Z("BUBBLE-COMPOSITION-003", `Bubble image asset is not registered: ${t}`);
|
|
4241
4293
|
if (!e.getMimeType(t).startsWith("image/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not an image: ${t}`);
|
|
4242
4294
|
}
|
|
4243
|
-
function
|
|
4295
|
+
function $r(e, t) {
|
|
4244
4296
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble audio assets require an audio capability: ${t}. Provide options.audio.`);
|
|
4245
4297
|
if (e.isRegistered?.(t) === !1) throw new Z("BUBBLE-COMPOSITION-003", `Bubble audio asset is not registered: ${t}`);
|
|
4246
4298
|
let n = e.getMimeType?.(t);
|
|
4247
4299
|
if (n !== void 0 && !n.startsWith("audio/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not audio: ${t}`);
|
|
4248
4300
|
}
|
|
4249
|
-
function
|
|
4301
|
+
function ei(e) {
|
|
4250
4302
|
return [...e.portrait === void 0 ? [] : [
|
|
4251
4303
|
e.portrait.base,
|
|
4252
4304
|
...e.portrait.blink?.frames ?? [],
|
|
4253
4305
|
...e.portrait.lipSync?.frames ?? []
|
|
4254
4306
|
], ...e.continueIndicator?.frames ?? []];
|
|
4255
4307
|
}
|
|
4256
|
-
function
|
|
4308
|
+
function ti(e, t, n) {
|
|
4257
4309
|
if (t.maxWidth === void 0) return e;
|
|
4258
4310
|
if (typeof n.measureText != "function") throw new Z("BUBBLE-COMPOSITION-007", "Bubble style maxWidth requires the text capability measureText method.");
|
|
4259
4311
|
return vr({
|
|
@@ -4266,11 +4318,11 @@ function Xr(e, t, n) {
|
|
|
4266
4318
|
}) ?? 0
|
|
4267
4319
|
}).lines.map(({ text: e }) => e).join("\n");
|
|
4268
4320
|
}
|
|
4269
|
-
function
|
|
4321
|
+
function ni(e, t) {
|
|
4270
4322
|
if (e.length === 1) throw e[0];
|
|
4271
4323
|
if (e.length > 1) throw AggregateError(e, t);
|
|
4272
4324
|
}
|
|
4273
|
-
function
|
|
4325
|
+
function ri(e) {
|
|
4274
4326
|
let t = !1, n = 0, r = 0, i, a = Promise.resolve(), o = async (t) => {
|
|
4275
4327
|
let n = e.animation.frames[t];
|
|
4276
4328
|
n !== void 0 && await e.imageResolver.applyToTarget(n, e.target);
|
|
@@ -4305,18 +4357,18 @@ function Qr(e) {
|
|
|
4305
4357
|
}
|
|
4306
4358
|
});
|
|
4307
4359
|
}
|
|
4308
|
-
function
|
|
4360
|
+
function ii(e) {
|
|
4309
4361
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
|
|
4310
|
-
if (
|
|
4362
|
+
if (Fr(e, [
|
|
4311
4363
|
"actor",
|
|
4312
4364
|
"actorKey",
|
|
4313
4365
|
"kind",
|
|
4314
4366
|
"text",
|
|
4315
4367
|
"styleName"
|
|
4316
|
-
], ["animationMode", "reveal"], "Show bubble input"), !
|
|
4368
|
+
], ["animationMode", "reveal"], "Show bubble input"), !jr.has(e.kind)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble kind must be say or think.");
|
|
4317
4369
|
if (typeof e.text != "string") throw new Z("BUBBLE-COMPOSITION-001", "Bubble text must be a string.");
|
|
4318
4370
|
let t = e.animationMode ?? "talking";
|
|
4319
|
-
if (!
|
|
4371
|
+
if (!Mr.has(t)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid.");
|
|
4320
4372
|
let n;
|
|
4321
4373
|
if (e.reveal !== void 0) try {
|
|
4322
4374
|
n = Sr(e.reveal);
|
|
@@ -4325,20 +4377,20 @@ function $r(e) {
|
|
|
4325
4377
|
}
|
|
4326
4378
|
return {
|
|
4327
4379
|
actor: e.actor,
|
|
4328
|
-
actorKey:
|
|
4380
|
+
actorKey: Ir(e.actorKey, "Bubble actor key"),
|
|
4329
4381
|
kind: e.kind,
|
|
4330
4382
|
text: e.text,
|
|
4331
|
-
styleName:
|
|
4383
|
+
styleName: Ir(e.styleName, "Bubble style name"),
|
|
4332
4384
|
animationMode: t,
|
|
4333
4385
|
...n === void 0 ? {} : { reveal: n }
|
|
4334
4386
|
};
|
|
4335
4387
|
}
|
|
4336
|
-
function
|
|
4388
|
+
function ai(e) {
|
|
4337
4389
|
if (!Q(e)) throw TypeError("Bubble composition options must be an object.");
|
|
4338
|
-
let t =
|
|
4390
|
+
let t = Ur(e.imageResolver), n = Wr(e.audio), r = Kr(e.textCapability);
|
|
4339
4391
|
if (typeof e.createSurface != "function") throw TypeError("Bubble composition createSurface must be a function.");
|
|
4340
4392
|
if (e.onAnimationError !== void 0 && typeof e.onAnimationError != "function") throw TypeError("Bubble composition onAnimationError must be a function.");
|
|
4341
|
-
let i =
|
|
4393
|
+
let i = Jr(e.scheduler ?? qr()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
|
|
4342
4394
|
if (c) throw new Z("BUBBLE-COMPOSITION-005", "Bubble composition has been disposed.");
|
|
4343
4395
|
}, u = async (e, t) => {
|
|
4344
4396
|
let n = (s.get(e) ?? Promise.resolve()).catch(() => void 0).then(t);
|
|
@@ -4358,8 +4410,8 @@ function ei(e) {
|
|
|
4358
4410
|
reveal: s.reveal
|
|
4359
4411
|
}));
|
|
4360
4412
|
let d = s.text, f = (e) => {
|
|
4361
|
-
let n = new Set(
|
|
4362
|
-
for (let e of n)
|
|
4413
|
+
let n = new Set(ei(e)), r = n.size === 0 ? void 0 : Gr(t);
|
|
4414
|
+
for (let e of n) Qr(r, e);
|
|
4363
4415
|
return r;
|
|
4364
4416
|
}, p = f(u);
|
|
4365
4417
|
for (let e of [
|
|
@@ -4367,13 +4419,13 @@ function ei(e) {
|
|
|
4367
4419
|
u.audio?.reveal,
|
|
4368
4420
|
u.audio?.finish,
|
|
4369
4421
|
u.reveal?.sound
|
|
4370
|
-
]) e !== void 0 &&
|
|
4422
|
+
]) e !== void 0 && $r(n, e);
|
|
4371
4423
|
let m = async (e, t = !1) => {
|
|
4372
4424
|
e !== void 0 && n !== void 0 && await n.playSound(e, { untilDone: t });
|
|
4373
4425
|
}, h = async (e, t, n) => {
|
|
4374
|
-
let r =
|
|
4426
|
+
let r = ei(e).length === 0 ? void 0 : Gr(t), i = [];
|
|
4375
4427
|
if (e.portrait) {
|
|
4376
|
-
let t =
|
|
4428
|
+
let t = Gr(r);
|
|
4377
4429
|
i.push(Promise.resolve(t.applyToTarget(e.portrait.base, n.targets.portraitBase)));
|
|
4378
4430
|
let a = e.portrait.blink?.frames[0];
|
|
4379
4431
|
a !== void 0 && i.push(Promise.resolve(t.applyToTarget(a, n.targets.portraitBlink)));
|
|
@@ -4382,33 +4434,33 @@ function ei(e) {
|
|
|
4382
4434
|
}
|
|
4383
4435
|
let a = e.continueIndicator?.frames[0];
|
|
4384
4436
|
if (a !== void 0) {
|
|
4385
|
-
let e =
|
|
4437
|
+
let e = Gr(r);
|
|
4386
4438
|
i.push(Promise.resolve(e.applyToTarget(a, n.targets.continueIndicator)));
|
|
4387
4439
|
}
|
|
4388
4440
|
await Promise.all(i);
|
|
4389
4441
|
}, g = (t, n, r) => {
|
|
4390
|
-
x = t.portrait?.blink === void 0 ? void 0 :
|
|
4442
|
+
x = t.portrait?.blink === void 0 ? void 0 : ri({
|
|
4391
4443
|
actorKey: s.actorKey,
|
|
4392
4444
|
layer: "portraitBlink",
|
|
4393
4445
|
animation: t.portrait.blink,
|
|
4394
4446
|
target: r.targets.portraitBlink,
|
|
4395
|
-
imageResolver:
|
|
4447
|
+
imageResolver: Gr(n),
|
|
4396
4448
|
scheduler: i,
|
|
4397
4449
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4398
|
-
}), S = t.portrait?.lipSync === void 0 ? void 0 :
|
|
4450
|
+
}), S = t.portrait?.lipSync === void 0 ? void 0 : ri({
|
|
4399
4451
|
actorKey: s.actorKey,
|
|
4400
4452
|
layer: "portraitLipSync",
|
|
4401
4453
|
animation: t.portrait.lipSync,
|
|
4402
4454
|
target: r.targets.portraitLipSync,
|
|
4403
|
-
imageResolver:
|
|
4455
|
+
imageResolver: Gr(n),
|
|
4404
4456
|
scheduler: i,
|
|
4405
4457
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4406
|
-
}), C = t.continueIndicator === void 0 ? void 0 :
|
|
4458
|
+
}), C = t.continueIndicator === void 0 ? void 0 : ri({
|
|
4407
4459
|
actorKey: s.actorKey,
|
|
4408
4460
|
layer: "continueIndicator",
|
|
4409
4461
|
animation: t.continueIndicator,
|
|
4410
4462
|
target: r.targets.continueIndicator,
|
|
4411
|
-
imageResolver:
|
|
4463
|
+
imageResolver: Gr(n),
|
|
4412
4464
|
scheduler: i,
|
|
4413
4465
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4414
4466
|
});
|
|
@@ -4416,13 +4468,13 @@ function ei(e) {
|
|
|
4416
4468
|
_ && await _.close();
|
|
4417
4469
|
let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? wr(s.text, w) : Object.freeze([s.text]), E = w ? Math.min(1, T.length) : 1, D, O = 0;
|
|
4418
4470
|
try {
|
|
4419
|
-
v =
|
|
4471
|
+
v = Zr(await e.createSurface(Object.freeze({
|
|
4420
4472
|
actor: s.actor,
|
|
4421
4473
|
actorKey: s.actorKey,
|
|
4422
4474
|
kind: s.kind,
|
|
4423
4475
|
style: u
|
|
4424
4476
|
})), u);
|
|
4425
|
-
let t =
|
|
4477
|
+
let t = ti(s.text, u, r);
|
|
4426
4478
|
w?.layout === "RESERVED" && (r.setText({
|
|
4427
4479
|
styleName: u.textStyle,
|
|
4428
4480
|
target: v.targets.text,
|
|
@@ -4430,7 +4482,7 @@ function ei(e) {
|
|
|
4430
4482
|
}), v.captureTextLayout?.()), r.setText({
|
|
4431
4483
|
styleName: u.textStyle,
|
|
4432
4484
|
target: v.targets.text,
|
|
4433
|
-
text:
|
|
4485
|
+
text: ti(w ? Tr(T, E) : s.text, u, r)
|
|
4434
4486
|
}), y = !0, await h(u, p, v), g(u, p, v);
|
|
4435
4487
|
let a = "idle", c = !1, l = Promise.resolve(), _ = async () => {
|
|
4436
4488
|
if (!v) return;
|
|
@@ -4438,7 +4490,7 @@ function ei(e) {
|
|
|
4438
4490
|
r.setText({
|
|
4439
4491
|
styleName: u.textStyle,
|
|
4440
4492
|
target: v.targets.text,
|
|
4441
|
-
text:
|
|
4493
|
+
text: ti(e, u, r)
|
|
4442
4494
|
}), await v.show();
|
|
4443
4495
|
}, k = () => {
|
|
4444
4496
|
O += 1, D !== void 0 && i.clearTimeout(D), D = void 0;
|
|
@@ -4468,7 +4520,7 @@ function ei(e) {
|
|
|
4468
4520
|
v && (k(), d = e, w ? (T = wr(e, w), E = Math.min(1, T.length), w.layout === "RESERVED" && (r.setText({
|
|
4469
4521
|
styleName: u.textStyle,
|
|
4470
4522
|
target: v.targets.text,
|
|
4471
|
-
text:
|
|
4523
|
+
text: ti(e, u, r)
|
|
4472
4524
|
}), v.captureTextLayout?.()), await _(), j()) : await _());
|
|
4473
4525
|
}), l) : Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble text must be a string."));
|
|
4474
4526
|
},
|
|
@@ -4476,20 +4528,20 @@ function ei(e) {
|
|
|
4476
4528
|
if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
4477
4529
|
let t;
|
|
4478
4530
|
try {
|
|
4479
|
-
t =
|
|
4531
|
+
t = Hr(e);
|
|
4480
4532
|
} catch (e) {
|
|
4481
4533
|
return Promise.reject(e);
|
|
4482
4534
|
}
|
|
4483
4535
|
return l = l.then(async () => {
|
|
4484
4536
|
if (!v) return;
|
|
4485
|
-
|
|
4537
|
+
Zr(v, t);
|
|
4486
4538
|
let e = f(t);
|
|
4487
4539
|
for (let e of [
|
|
4488
4540
|
t.audio?.voice,
|
|
4489
4541
|
t.audio?.reveal,
|
|
4490
4542
|
t.audio?.finish,
|
|
4491
4543
|
t.reveal?.sound
|
|
4492
|
-
]) e !== void 0 &&
|
|
4544
|
+
]) e !== void 0 && $r(n, e);
|
|
4493
4545
|
await Promise.all([
|
|
4494
4546
|
x?.stop(),
|
|
4495
4547
|
S?.stop(),
|
|
@@ -4497,11 +4549,11 @@ function ei(e) {
|
|
|
4497
4549
|
]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? wr(d, w) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, k(), w?.layout === "RESERVED" && (r.setText({
|
|
4498
4550
|
styleName: t.textStyle,
|
|
4499
4551
|
target: v.targets.text,
|
|
4500
|
-
text:
|
|
4552
|
+
text: ti(d, t, r)
|
|
4501
4553
|
}), v.captureTextLayout?.()), r.setText({
|
|
4502
4554
|
styleName: t.textStyle,
|
|
4503
4555
|
target: v.targets.text,
|
|
4504
|
-
text:
|
|
4556
|
+
text: ti(d, t, r)
|
|
4505
4557
|
}), g(t, e, v), await Promise.all([
|
|
4506
4558
|
v.setLayerVisible("portraitBase", t.portrait !== void 0),
|
|
4507
4559
|
v.setLayerVisible("portraitBlink", t.portrait?.blink !== void 0),
|
|
@@ -4513,7 +4565,7 @@ function ei(e) {
|
|
|
4513
4565
|
}), l;
|
|
4514
4566
|
},
|
|
4515
4567
|
setAnimationMode(e) {
|
|
4516
|
-
return c ? Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) :
|
|
4568
|
+
return c ? Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : Mr.has(e) ? (l = l.then(() => M(e)), l) : Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid."));
|
|
4517
4569
|
},
|
|
4518
4570
|
revealNext() {
|
|
4519
4571
|
if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
@@ -4537,7 +4589,7 @@ function ei(e) {
|
|
|
4537
4589
|
}), T = wr(d, w), E = Math.min(1, T.length), w.layout === "RESERVED" && v && (r.setText({
|
|
4538
4590
|
styleName: u.textStyle,
|
|
4539
4591
|
target: v.targets.text,
|
|
4540
|
-
text:
|
|
4592
|
+
text: ti(d, u, r)
|
|
4541
4593
|
}), v.captureTextLayout?.())), w) for (; await A(););
|
|
4542
4594
|
let n = e.condition;
|
|
4543
4595
|
if (n === void 0 && t === 0) {
|
|
@@ -4571,7 +4623,7 @@ function ei(e) {
|
|
|
4571
4623
|
if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
4572
4624
|
let t;
|
|
4573
4625
|
try {
|
|
4574
|
-
t =
|
|
4626
|
+
t = Br(e, "Bubble motion");
|
|
4575
4627
|
} catch (e) {
|
|
4576
4628
|
return Promise.reject(e);
|
|
4577
4629
|
}
|
|
@@ -4614,7 +4666,7 @@ function ei(e) {
|
|
|
4614
4666
|
} catch (t) {
|
|
4615
4667
|
e.push(t);
|
|
4616
4668
|
}
|
|
4617
|
-
o.get(s.actorKey) === N && o.delete(s.actorKey),
|
|
4669
|
+
o.get(s.actorKey) === N && o.delete(s.actorKey), ni(e, `Failed to close bubble: ${s.actorKey}`);
|
|
4618
4670
|
}
|
|
4619
4671
|
});
|
|
4620
4672
|
return o.set(s.actorKey, N), j(), u.showAnimation !== void 0 && await N.animate(u.showAnimation), N;
|
|
@@ -4646,50 +4698,50 @@ function ei(e) {
|
|
|
4646
4698
|
return Object.freeze({
|
|
4647
4699
|
defineStyle(e) {
|
|
4648
4700
|
l();
|
|
4649
|
-
let t =
|
|
4701
|
+
let t = Hr(e);
|
|
4650
4702
|
a.set(t.name, t);
|
|
4651
4703
|
},
|
|
4652
4704
|
hasActiveBubble(e) {
|
|
4653
|
-
return o.has(
|
|
4705
|
+
return o.has(Ir(e, "Bubble actor key"));
|
|
4654
4706
|
},
|
|
4655
4707
|
async show(e) {
|
|
4656
4708
|
l();
|
|
4657
|
-
let t =
|
|
4709
|
+
let t = ii(e);
|
|
4658
4710
|
return u(t.actorKey, () => d(t));
|
|
4659
4711
|
},
|
|
4660
4712
|
releaseTarget(e) {
|
|
4661
4713
|
l();
|
|
4662
|
-
let t =
|
|
4714
|
+
let t = Ir(e, "Bubble actor key");
|
|
4663
4715
|
return u(t, async () => {
|
|
4664
4716
|
await o.get(t)?.close();
|
|
4665
4717
|
});
|
|
4666
4718
|
},
|
|
4667
4719
|
async releaseAll() {
|
|
4668
|
-
l(), await Promise.allSettled([...s.values()]),
|
|
4720
|
+
l(), await Promise.allSettled([...s.values()]), ni((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
|
|
4669
4721
|
},
|
|
4670
4722
|
async dispose() {
|
|
4671
4723
|
if (c) return;
|
|
4672
4724
|
c = !0, await Promise.allSettled([...s.values()]);
|
|
4673
4725
|
let e = await Promise.allSettled([...o.values()].map((e) => e.close()));
|
|
4674
|
-
a.clear(),
|
|
4726
|
+
a.clear(), ni(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
|
|
4675
4727
|
}
|
|
4676
4728
|
});
|
|
4677
4729
|
}
|
|
4678
4730
|
//#endregion
|
|
4679
4731
|
//#region src/turbowarp-svg-text-adapter.ts
|
|
4680
|
-
function
|
|
4732
|
+
function oi(e) {
|
|
4681
4733
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4682
4734
|
}
|
|
4683
|
-
function
|
|
4684
|
-
if (!
|
|
4735
|
+
function si(e) {
|
|
4736
|
+
if (!oi(e) || typeof e.setText != "function" || typeof e.releaseTextActor != "function") throw TypeError("TurboWarp SVG Text adapter requires setText and releaseTextActor.");
|
|
4685
4737
|
return e;
|
|
4686
4738
|
}
|
|
4687
|
-
function
|
|
4688
|
-
if (!
|
|
4739
|
+
function ci(e) {
|
|
4740
|
+
if (!oi(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("SVG Text composition adapter requires setText and releaseTarget.");
|
|
4689
4741
|
return e;
|
|
4690
4742
|
}
|
|
4691
|
-
function
|
|
4692
|
-
let t =
|
|
4743
|
+
function li(e) {
|
|
4744
|
+
let t = si(e);
|
|
4693
4745
|
return Object.freeze({
|
|
4694
4746
|
setText({ styleName: e, target: n, text: r }) {
|
|
4695
4747
|
t.setText({
|
|
@@ -4706,8 +4758,8 @@ function ii(e) {
|
|
|
4706
4758
|
}
|
|
4707
4759
|
});
|
|
4708
4760
|
}
|
|
4709
|
-
function
|
|
4710
|
-
let t =
|
|
4761
|
+
function ui(e) {
|
|
4762
|
+
let t = ci(e), n = {
|
|
4711
4763
|
setText({ styleName: e, target: n, text: r }) {
|
|
4712
4764
|
t.setText({
|
|
4713
4765
|
styleName: e,
|
|
@@ -4726,17 +4778,17 @@ function ai(e) {
|
|
|
4726
4778
|
}
|
|
4727
4779
|
//#endregion
|
|
4728
4780
|
//#region src/turbowarp-adapter.ts
|
|
4729
|
-
var
|
|
4781
|
+
var di = "sprite", fi = 96, pi = 18, mi = 8, hi = 16, gi = 0, $ = class extends Error {
|
|
4730
4782
|
code;
|
|
4731
4783
|
constructor(e, t) {
|
|
4732
4784
|
super(t), this.name = "BubbleRuntimeAdapterError", this.code = e;
|
|
4733
4785
|
}
|
|
4734
4786
|
};
|
|
4735
|
-
function
|
|
4787
|
+
function _i(e) {
|
|
4736
4788
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4737
4789
|
}
|
|
4738
|
-
function
|
|
4739
|
-
if (!
|
|
4790
|
+
function vi(e) {
|
|
4791
|
+
if (!_i(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp renderer.");
|
|
4740
4792
|
let t = [
|
|
4741
4793
|
"createSVGSkin",
|
|
4742
4794
|
"createDrawable",
|
|
@@ -4752,11 +4804,11 @@ function pi(e) {
|
|
|
4752
4804
|
if (t.some((t) => typeof e[t] != "function")) throw new $("BUBBLE-RUNTIME-001", `Bubble renderer must provide ${t.join(", ")}.`);
|
|
4753
4805
|
return e;
|
|
4754
4806
|
}
|
|
4755
|
-
function
|
|
4756
|
-
if (!
|
|
4807
|
+
function yi(e) {
|
|
4808
|
+
if (!_i(e) || typeof e.isLoaded != "function" || typeof e.getAssetMimeType != "function" || typeof e.resolveSkin != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-manager or provide options.imageResolver before using image features.");
|
|
4757
4809
|
return e;
|
|
4758
4810
|
}
|
|
4759
|
-
function
|
|
4811
|
+
function bi(e) {
|
|
4760
4812
|
try {
|
|
4761
4813
|
let t = e.getBoundsForBubble?.();
|
|
4762
4814
|
if (t && [
|
|
@@ -4774,7 +4826,7 @@ function hi(e) {
|
|
|
4774
4826
|
top: n
|
|
4775
4827
|
};
|
|
4776
4828
|
}
|
|
4777
|
-
function
|
|
4829
|
+
function xi(e, t, n) {
|
|
4778
4830
|
let r = e.getCurrentSkinSize(t.drawableID);
|
|
4779
4831
|
if (!Array.isArray(r) || r.length < 2) return n;
|
|
4780
4832
|
let i = Number(r[0]), a = Number(r[1]);
|
|
@@ -4783,11 +4835,11 @@ function gi(e, t, n) {
|
|
|
4783
4835
|
height: a
|
|
4784
4836
|
};
|
|
4785
4837
|
}
|
|
4786
|
-
function
|
|
4838
|
+
function Si(e) {
|
|
4787
4839
|
return Math.max(0, Math.min(1, e));
|
|
4788
4840
|
}
|
|
4789
|
-
function
|
|
4790
|
-
let n =
|
|
4841
|
+
function Ci(e, t) {
|
|
4842
|
+
let n = Si(e);
|
|
4791
4843
|
switch (t) {
|
|
4792
4844
|
case "linear": return n;
|
|
4793
4845
|
case "easeIn": return n * n;
|
|
@@ -4796,14 +4848,14 @@ function vi(e, t) {
|
|
|
4796
4848
|
default: return n;
|
|
4797
4849
|
}
|
|
4798
4850
|
}
|
|
4799
|
-
function
|
|
4851
|
+
function wi(e, t, n) {
|
|
4800
4852
|
let r = Math.max(0, t * 1e3);
|
|
4801
4853
|
return r === 0 ? (n(1), Promise.resolve()) : new Promise((t, i) => {
|
|
4802
4854
|
let a = 0, o, s = () => {
|
|
4803
4855
|
let c = Math.min(16, r - a);
|
|
4804
4856
|
a += c;
|
|
4805
4857
|
try {
|
|
4806
|
-
n(
|
|
4858
|
+
n(Si(a / r));
|
|
4807
4859
|
} catch (t) {
|
|
4808
4860
|
o !== void 0 && e.clearTimeout(o), i(t);
|
|
4809
4861
|
return;
|
|
@@ -4817,135 +4869,148 @@ function yi(e, t, n) {
|
|
|
4817
4869
|
o = e.setTimeout(s, Math.min(16, r));
|
|
4818
4870
|
});
|
|
4819
4871
|
}
|
|
4820
|
-
function
|
|
4821
|
-
let i =
|
|
4872
|
+
function Ti(e, t, n, r = 1) {
|
|
4873
|
+
let i = xi(e, t, {
|
|
4822
4874
|
width: n,
|
|
4823
4875
|
height: n
|
|
4824
4876
|
}), a = Math.min(n / i.width, n / i.height) * r;
|
|
4825
4877
|
return e.updateDrawableScale(t.drawableID, [a * 100, a * 100]), {
|
|
4826
4878
|
width: i.width * a,
|
|
4827
|
-
height: i.height * a
|
|
4879
|
+
height: i.height * a,
|
|
4880
|
+
scalePercent: a * 100
|
|
4828
4881
|
};
|
|
4829
4882
|
}
|
|
4830
|
-
function
|
|
4883
|
+
function Ei(e, t, n) {
|
|
4884
|
+
let r = Math.min(n, e / 2, t / 2), i = e - r, a = t - r;
|
|
4885
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}" viewBox="0 0 ${e} ${t}">
|
|
4886
|
+
<path d="M0 0H${e}V${t}H0Z M${r} 0H${i}A${r} ${r} 0 0 1 ${e} ${r}V${a}A${r} ${r} 0 0 1 ${i} ${t}H${r}A${r} ${r} 0 0 1 0 ${a}V${r}A${r} ${r} 0 0 1 ${r} 0Z" fill="#fff4cc" fill-rule="evenodd" data-bubble-portrait-corner-radius="${r}"/>
|
|
4887
|
+
</svg>`;
|
|
4888
|
+
}
|
|
4889
|
+
function Di(e, t, n) {
|
|
4831
4890
|
return n < t ? (t + n) / 2 : Math.min(n, Math.max(t, e));
|
|
4832
4891
|
}
|
|
4833
|
-
function
|
|
4892
|
+
function Oi(e, t, n, r, i) {
|
|
4834
4893
|
let a = t + r * 2, o = n + i * 2;
|
|
4835
4894
|
return e.replace(/<svg\b[^>]*>/u, (e) => e.replace(/\bwidth="[^"]*"/u, `width="${a}"`).replace(/\bheight="[^"]*"/u, `height="${o}"`).replace(/\bviewBox="[^"]*"/u, `viewBox="${-r} ${-i} ${a} ${o}"`));
|
|
4836
4895
|
}
|
|
4837
|
-
function
|
|
4896
|
+
function ki(e) {
|
|
4838
4897
|
let t = v(e);
|
|
4839
4898
|
return (Math.atan2(-t.x, -t.y) * 180 / Math.PI % 360 + 360) % 360;
|
|
4840
4899
|
}
|
|
4841
|
-
function
|
|
4842
|
-
let a = e.renderer, o =
|
|
4843
|
-
|
|
4844
|
-
let s = [], c, l = (e) => {
|
|
4845
|
-
let t = a.createDrawable(
|
|
4900
|
+
function Ai(e, t, n, r, i) {
|
|
4901
|
+
let a = e.renderer, o = gi;
|
|
4902
|
+
gi += 1;
|
|
4903
|
+
let s = [], c, l, u = (e) => {
|
|
4904
|
+
let t = a.createDrawable(di);
|
|
4846
4905
|
if (!Number.isInteger(t) || t < 0) throw new $("BUBBLE-RUNTIME-001", `TurboWarp did not create the Bubble ${e} drawable.`);
|
|
4847
4906
|
let r = Object.freeze({
|
|
4848
4907
|
id: `bubble:${n}:${o}:${e}`,
|
|
4849
4908
|
isStage: !1,
|
|
4850
4909
|
drawableID: t
|
|
4851
4910
|
});
|
|
4852
|
-
return s.push(r), a.updateDrawableVisible(t, !1), a.setDrawableOrder?.(t, Infinity,
|
|
4911
|
+
return s.push(r), a.updateDrawableVisible(t, !1), a.setDrawableOrder?.(t, Infinity, di), r;
|
|
4853
4912
|
};
|
|
4854
4913
|
try {
|
|
4855
|
-
let n =
|
|
4856
|
-
text:
|
|
4914
|
+
let n = u("body"), o = r.portrait ? u("portrait-base") : void 0, d = r.portrait?.blink ? u("portrait-blink") : void 0, f = r.portrait?.lipSync ? u("portrait-lip-sync") : void 0, p = r.portrait ? u("portrait-corner-mask") : void 0, m = u("text"), h = r.continueIndicator ? u("continue-indicator") : void 0, g = Object.freeze({
|
|
4915
|
+
text: m,
|
|
4857
4916
|
...o ? { portraitBase: o } : {},
|
|
4858
|
-
...
|
|
4859
|
-
...
|
|
4860
|
-
...
|
|
4861
|
-
}),
|
|
4862
|
-
o &&
|
|
4863
|
-
let
|
|
4917
|
+
...d ? { portraitBlink: d } : {},
|
|
4918
|
+
...f ? { portraitLipSync: f } : {},
|
|
4919
|
+
...h ? { continueIndicator: h } : {}
|
|
4920
|
+
}), _ = /* @__PURE__ */ new Map();
|
|
4921
|
+
o && _.set("portraitBase", o), d && _.set("portraitBlink", d), f && _.set("portraitLipSync", f), h && _.set("continueIndicator", h);
|
|
4922
|
+
let y = /* @__PURE__ */ new Map(), b = !1, x = !1, S = "", C = "", T = r, E, D = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), k = [0, 0], A = 1, j = 1, M, N = () => {
|
|
4864
4923
|
for (let e of s) {
|
|
4865
|
-
let t =
|
|
4866
|
-
t && a.updateDrawablePosition(e.drawableID, [t[0] +
|
|
4867
|
-
let n =
|
|
4868
|
-
n && a.updateDrawableScale(e.drawableID, [n[0] *
|
|
4924
|
+
let t = D.get(e.drawableID);
|
|
4925
|
+
t && a.updateDrawablePosition(e.drawableID, [t[0] + k[0], t[1] + k[1]]);
|
|
4926
|
+
let n = O.get(e.drawableID);
|
|
4927
|
+
n && a.updateDrawableScale(e.drawableID, [n[0] * A, n[1] * A]), a.updateDrawableEffect?.(e.drawableID, "ghost", (1 - j) * 100);
|
|
4869
4928
|
}
|
|
4870
|
-
},
|
|
4871
|
-
let r =
|
|
4872
|
-
a.updateDrawableVisible(n.drawableID,
|
|
4873
|
-
for (let [e, t] of
|
|
4874
|
-
|
|
4875
|
-
},
|
|
4876
|
-
if (
|
|
4877
|
-
let e =
|
|
4929
|
+
}, ee = () => {
|
|
4930
|
+
let r = T.placement.basis === "background" || t.visible !== !1;
|
|
4931
|
+
a.updateDrawableVisible(n.drawableID, b && r && T.visualStyle !== "NO_BUBBLE" && (a.updateDrawableEffect !== void 0 || j > 0)), a.updateDrawableVisible(m.drawableID, b && r && (a.updateDrawableEffect !== void 0 || j > 0));
|
|
4932
|
+
for (let [e, t] of _) a.updateDrawableVisible(t.drawableID, b && r && (y.get(e) ?? !1) && (a.updateDrawableEffect !== void 0 || j > 0));
|
|
4933
|
+
p && a.updateDrawableVisible(p.drawableID, b && r && T.portrait !== void 0 && T.portrait.cornerRadius > 0 && T.visualStyle !== "NO_BUBBLE" && (y.get("portraitBase") ?? !1) && (a.updateDrawableEffect !== void 0 || j > 0)), N(), e.requestRedraw?.();
|
|
4934
|
+
}, P = () => {
|
|
4935
|
+
if (x) return;
|
|
4936
|
+
let e = T.placement.basis === "actor" ? T.offset.scalePercent / 100 : 1, r = E ?? xi(a, m, {
|
|
4878
4937
|
width: 180,
|
|
4879
4938
|
height: 48
|
|
4880
4939
|
});
|
|
4881
|
-
a.updateDrawableScale(
|
|
4940
|
+
a.updateDrawableScale(m.drawableID, [e * 100, e * 100]);
|
|
4882
4941
|
let i = {
|
|
4883
4942
|
width: r.width * e,
|
|
4884
4943
|
height: r.height * e
|
|
4885
|
-
}, s = o ?
|
|
4944
|
+
}, s = fi * ((T.portrait?.offset.zoomPercent ?? 100) / 100), u = o !== void 0 && T.portrait !== void 0, g = u ? Ti(a, o, s, e) : {
|
|
4886
4945
|
width: 0,
|
|
4887
|
-
height: 0
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4946
|
+
height: 0,
|
|
4947
|
+
scalePercent: 0
|
|
4948
|
+
}, _ = /* @__PURE__ */ new Map();
|
|
4949
|
+
u && _.set(o.drawableID, g.scalePercent);
|
|
4950
|
+
for (let t of [d, f]) if (t && u) {
|
|
4951
|
+
let n = Ti(a, t, s, e);
|
|
4952
|
+
_.set(t.drawableID, n.scalePercent);
|
|
4953
|
+
}
|
|
4954
|
+
let v = h ? Ti(a, h, pi, e) : {
|
|
4891
4955
|
width: 0,
|
|
4892
|
-
height: 0
|
|
4893
|
-
|
|
4894
|
-
|
|
4956
|
+
height: 0,
|
|
4957
|
+
scalePercent: 0
|
|
4958
|
+
}, y = g.width + (u ? mi * e : 0) + i.width, b = Math.max(g.height, i.height), k = y / e + 48, A = b / e + 48, j = y, P = b, F = a.getNativeSize(), I = Array.isArray(F) && Number(F[0]) > 0 ? Number(F[0]) : 480, te = Array.isArray(F) && Number(F[1]) > 0 ? Number(F[1]) : 360, ne = -I / 2, L = I / 2, re = te / 2, ie = -te / 2, ae = ne + j / 2, oe = L - j / 2, se = ie + P / 2, ce = re - P / 2, R, z;
|
|
4959
|
+
if (T.placement.basis === "background") R = 0, z = T.placement.region === "HEADER_LIKE" ? re - hi - P / 2 : T.placement.region === "FOOTER_LIKE" ? ie + hi + P / 2 : 0;
|
|
4895
4960
|
else {
|
|
4896
4961
|
let e = w({
|
|
4897
|
-
bounds:
|
|
4898
|
-
bubbleWidth:
|
|
4899
|
-
bubbleHeight:
|
|
4900
|
-
direction:
|
|
4901
|
-
distance:
|
|
4902
|
-
tailLength:
|
|
4903
|
-
offset:
|
|
4962
|
+
bounds: bi(t),
|
|
4963
|
+
bubbleWidth: j,
|
|
4964
|
+
bubbleHeight: P,
|
|
4965
|
+
direction: T.placement.direction,
|
|
4966
|
+
distance: T.distance,
|
|
4967
|
+
tailLength: T.tailLength,
|
|
4968
|
+
offset: T.offset
|
|
4904
4969
|
});
|
|
4905
|
-
|
|
4970
|
+
R = e.x, z = e.y;
|
|
4906
4971
|
}
|
|
4907
|
-
|
|
4908
|
-
let
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4972
|
+
R = Di(R, ae, oe), z = Di(z, se, ce);
|
|
4973
|
+
let le = T.placement.basis === "actor" ? ki(T.placement.direction) : null, ue = T.placement.basis === "actor" ? [
|
|
4974
|
+
T.offset.x,
|
|
4975
|
+
T.offset.y,
|
|
4976
|
+
T.offset.scalePercent
|
|
4912
4977
|
] : [
|
|
4913
4978
|
0,
|
|
4914
4979
|
0,
|
|
4915
4980
|
100
|
|
4916
|
-
],
|
|
4981
|
+
], de = le === null ? {
|
|
4917
4982
|
x: 0,
|
|
4918
4983
|
y: 0
|
|
4919
|
-
} :
|
|
4920
|
-
style:
|
|
4921
|
-
width:
|
|
4922
|
-
height:
|
|
4923
|
-
tailDirection:
|
|
4924
|
-
tailLength:
|
|
4925
|
-
offset:
|
|
4926
|
-
}),
|
|
4927
|
-
baseBubbleHeight:
|
|
4928
|
-
baseBubbleWidth:
|
|
4929
|
-
bodyOffset:
|
|
4930
|
-
tailDirection:
|
|
4931
|
-
tailLength:
|
|
4932
|
-
viewportExtraX:
|
|
4933
|
-
viewportExtraY:
|
|
4934
|
-
visualStyle:
|
|
4935
|
-
shapeTransition:
|
|
4984
|
+
} : pe({
|
|
4985
|
+
style: T.visualStyle,
|
|
4986
|
+
width: k,
|
|
4987
|
+
height: A,
|
|
4988
|
+
tailDirection: le,
|
|
4989
|
+
tailLength: T.tailLength,
|
|
4990
|
+
offset: ue
|
|
4991
|
+
}), fe = Math.abs(ue[0]) + k * Math.abs(e - 1) + Math.max(0, T.tailLength - 18) + 8, me = Math.abs(ue[1]) + A * Math.abs(e - 1) + Math.max(0, T.tailLength - 18) + 8, ge = JSON.stringify({
|
|
4992
|
+
baseBubbleHeight: A,
|
|
4993
|
+
baseBubbleWidth: k,
|
|
4994
|
+
bodyOffset: ue,
|
|
4995
|
+
tailDirection: le,
|
|
4996
|
+
tailLength: T.tailLength,
|
|
4997
|
+
viewportExtraX: fe,
|
|
4998
|
+
viewportExtraY: me,
|
|
4999
|
+
visualStyle: T.visualStyle,
|
|
5000
|
+
shapeTransition: M
|
|
4936
5001
|
});
|
|
4937
|
-
if (
|
|
4938
|
-
let e =
|
|
4939
|
-
style:
|
|
5002
|
+
if (ge !== S) {
|
|
5003
|
+
let e = Oi(he({
|
|
5004
|
+
style: T.visualStyle,
|
|
4940
5005
|
lines: [],
|
|
4941
|
-
width:
|
|
4942
|
-
height:
|
|
4943
|
-
tailDirection:
|
|
4944
|
-
tailLength:
|
|
4945
|
-
offset:
|
|
4946
|
-
title: `${
|
|
4947
|
-
...
|
|
4948
|
-
}),
|
|
5006
|
+
width: k,
|
|
5007
|
+
height: A,
|
|
5008
|
+
tailDirection: le,
|
|
5009
|
+
tailLength: T.tailLength,
|
|
5010
|
+
offset: ue,
|
|
5011
|
+
title: `${T.name} Bubble body`,
|
|
5012
|
+
...M === void 0 ? {} : { shapeTransition: M }
|
|
5013
|
+
}), k, A, fe, me), t = a.createSVGSkin(e);
|
|
4949
5014
|
if (!Number.isInteger(t) || t < 0) throw new $("BUBBLE-RUNTIME-001", "TurboWarp did not create the Bubble body SVG skin.");
|
|
4950
5015
|
try {
|
|
4951
5016
|
a.updateDrawableSkinId(n.drawableID, t);
|
|
@@ -4953,128 +5018,161 @@ function wi(e, t, n, r, i) {
|
|
|
4953
5018
|
throw a.destroySkin(t), e;
|
|
4954
5019
|
}
|
|
4955
5020
|
let r = c;
|
|
4956
|
-
c = t,
|
|
5021
|
+
c = t, S = ge, r !== void 0 && a.destroySkin(r);
|
|
4957
5022
|
}
|
|
4958
|
-
a.updateDrawableScale(n.drawableID, [100, 100]), a.updateDrawablePosition(n.drawableID, [
|
|
4959
|
-
let
|
|
5023
|
+
a.updateDrawableScale(n.drawableID, [100, 100]), a.updateDrawablePosition(n.drawableID, [R - de.x, z + de.y]);
|
|
5024
|
+
let _e = R - y / 2, B = T.portrait?.placement ?? "left", ve = B.endsWith("right"), ye = (T.portrait?.offset.x ?? 0) * e, be = (T.portrait?.offset.y ?? 0) * e, xe = (ve ? _e + i.width + mi * e : _e) + g.width / 2 + ye, Se = z;
|
|
5025
|
+
B.startsWith("top-") ? Se = z + b / 2 - g.height / 2 : B.startsWith("bottom-") && (Se = z - b / 2 + g.height / 2), Se += be;
|
|
5026
|
+
let Ce = (ve || !u ? _e : _e + g.width + mi * e) + i.width / 2;
|
|
4960
5027
|
for (let e of [
|
|
4961
5028
|
o,
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
]) e && a.updateDrawablePosition(e.drawableID, [
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
5029
|
+
d,
|
|
5030
|
+
f
|
|
5031
|
+
]) e && a.updateDrawablePosition(e.drawableID, [xe, Se]);
|
|
5032
|
+
if (p) {
|
|
5033
|
+
let t = g.width / e, n = g.height / e, r = Math.min(T.portrait?.cornerRadius ?? 0, t / 2, n / 2), i = r > 0 ? JSON.stringify({
|
|
5034
|
+
maskHeight: n,
|
|
5035
|
+
maskWidth: t,
|
|
5036
|
+
radius: r
|
|
5037
|
+
}) : "";
|
|
5038
|
+
if (i !== C) {
|
|
5039
|
+
let e = l;
|
|
5040
|
+
if (l = void 0, C = i, r > 0) {
|
|
5041
|
+
let e = a.createSVGSkin(Ei(t, n, r));
|
|
5042
|
+
if (!Number.isInteger(e) || e < 0) throw new $("BUBBLE-RUNTIME-001", "TurboWarp did not create the Bubble portrait corner mask SVG skin.");
|
|
5043
|
+
try {
|
|
5044
|
+
a.updateDrawableSkinId(p.drawableID, e), l = e;
|
|
5045
|
+
} catch (t) {
|
|
5046
|
+
throw a.destroySkin(e), t;
|
|
5047
|
+
}
|
|
5048
|
+
}
|
|
5049
|
+
e !== void 0 && a.destroySkin(e);
|
|
5050
|
+
}
|
|
5051
|
+
a.updateDrawablePosition(p.drawableID, [xe, Se]);
|
|
5052
|
+
}
|
|
5053
|
+
a.updateDrawablePosition(m.drawableID, [Ce, z]), h && a.updateDrawablePosition(h.drawableID, [Ce + i.width / 2 - v.width / 2 - mi * e, z - i.height / 2 + v.height / 2 + mi * e]);
|
|
5054
|
+
let we = (e, t) => {
|
|
5055
|
+
e && D.set(e.drawableID, t);
|
|
4968
5056
|
};
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
5057
|
+
we(n, [R - de.x, z + de.y]), we(m, [Ce, z]), we(o, [xe, Se]), we(d, [xe, Se]), we(f, [xe, Se]), we(p, [xe, Se]), O.set(n.drawableID, [100, 100]), O.set(m.drawableID, [e * 100, e * 100]);
|
|
5058
|
+
for (let e of [
|
|
5059
|
+
o,
|
|
5060
|
+
d,
|
|
5061
|
+
f
|
|
5062
|
+
]) {
|
|
5063
|
+
if (!e) continue;
|
|
5064
|
+
let t = _.get(e.drawableID) ?? 0;
|
|
5065
|
+
O.set(e.drawableID, [t, t]);
|
|
5066
|
+
}
|
|
5067
|
+
p && O.set(p.drawableID, [e * 100, e * 100]), h && O.set(h.drawableID, [v.scalePercent, v.scalePercent]), h && we(h, [Ce + i.width / 2 - v.width / 2 - mi * e, z - i.height / 2 + v.height / 2 + mi * e]), N(), ee();
|
|
5068
|
+
}, F = t.onTargetVisualChange, I = (e) => {
|
|
5069
|
+
F?.(e), P();
|
|
4972
5070
|
};
|
|
4973
|
-
return
|
|
4974
|
-
targets:
|
|
5071
|
+
return T.placement.basis === "actor" && (t.onTargetVisualChange = I), Object.freeze({
|
|
5072
|
+
targets: g,
|
|
4975
5073
|
setLayerVisible(e, t) {
|
|
4976
|
-
|
|
5074
|
+
x || (y.set(e, t), ee());
|
|
4977
5075
|
},
|
|
4978
5076
|
updateStyle(e) {
|
|
4979
|
-
if (
|
|
4980
|
-
let n =
|
|
4981
|
-
|
|
4982
|
-
let r =
|
|
4983
|
-
n && !r ? t.onTargetVisualChange ===
|
|
5077
|
+
if (x) return;
|
|
5078
|
+
let n = T.placement.basis === "actor";
|
|
5079
|
+
T = e, k = [0, 0], A = 1, j = 1, M = void 0, e.reveal?.layout !== "RESERVED" && (E = void 0);
|
|
5080
|
+
let r = T.placement.basis === "actor";
|
|
5081
|
+
n && !r ? t.onTargetVisualChange === I && (t.onTargetVisualChange = F ?? null) : !n && r && (t.onTargetVisualChange = I), P();
|
|
4984
5082
|
},
|
|
4985
5083
|
captureTextLayout() {
|
|
4986
|
-
|
|
5084
|
+
x || (E = xi(a, m, {
|
|
4987
5085
|
width: 180,
|
|
4988
5086
|
height: 48
|
|
4989
|
-
}),
|
|
5087
|
+
}), P());
|
|
4990
5088
|
},
|
|
4991
5089
|
clearTextLayout() {
|
|
4992
|
-
|
|
5090
|
+
E = void 0, P();
|
|
4993
5091
|
},
|
|
4994
5092
|
async animate(e) {
|
|
4995
|
-
if (
|
|
5093
|
+
if (x) return;
|
|
4996
5094
|
let t = Math.max(0, e.durationSeconds ?? 0), n = () => {
|
|
4997
|
-
|
|
4998
|
-
}, r = (t) =>
|
|
5095
|
+
x || (N(), ee());
|
|
5096
|
+
}, r = (t) => Ci(t, e.ease ?? "easeInOut");
|
|
4999
5097
|
if (e.name === "fadeIn" || e.name === "floatIn" || e.name === "zoomIn" || e.name === "riseUp") {
|
|
5000
|
-
|
|
5098
|
+
b = !0;
|
|
5001
5099
|
let a = e.name === "floatIn" || e.name === "riseUp" ? [0, 16] : [0, 0], o = e.name === "zoomIn" ? .01 : 1;
|
|
5002
|
-
|
|
5100
|
+
k = a, A = o, j = e.name === "fadeIn" ? 0 : 1, n(), await wi(i, t, (t) => {
|
|
5003
5101
|
let i = r(t);
|
|
5004
|
-
|
|
5005
|
-
}),
|
|
5102
|
+
k = [a[0] * (1 - i), a[1] * (1 - i)], A = o + (1 - o) * i, j = e.name === "fadeIn" ? i : 1, n();
|
|
5103
|
+
}), k = [0, 0], A = 1, j = 1, P();
|
|
5006
5104
|
return;
|
|
5007
5105
|
}
|
|
5008
5106
|
if (e.name === "fadeOut" || e.name === "floatOut" || e.name === "zoomOut" || e.name === "sink") {
|
|
5009
5107
|
let a = e.name === "floatOut" || e.name === "sink" ? [0, -16] : [0, 0], o = e.name === "zoomOut" ? .01 : 1;
|
|
5010
|
-
|
|
5108
|
+
k = [0, 0], A = 1, j = 1, n(), await wi(i, t, (t) => {
|
|
5011
5109
|
let i = r(t);
|
|
5012
|
-
|
|
5013
|
-
}),
|
|
5110
|
+
k = [a[0] * i, a[1] * i], A = 1 + (o - 1) * i, j = e.name === "fadeOut" ? 1 - i : 1, n();
|
|
5111
|
+
}), k = a, A = o, j = e.name === "fadeOut" ? 0 : 1, n(), b = !1, ee(), k = [0, 0], A = 1, j = 1;
|
|
5014
5112
|
return;
|
|
5015
5113
|
}
|
|
5016
5114
|
if (e.name === "shake") {
|
|
5017
5115
|
let a = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : a * .08, s = v(typeof e.direction == "number" ? e.direction : e.direction ?? "right") ?? v("right");
|
|
5018
|
-
|
|
5116
|
+
k = [0, 0], await wi(i, o, (e) => {
|
|
5019
5117
|
let t = r(e) * a * Math.PI * 2, i = Math.sin(t) * 5;
|
|
5020
|
-
|
|
5021
|
-
}),
|
|
5118
|
+
k = [s.x * i, s.y * i], n();
|
|
5119
|
+
}), k = [0, 0], P();
|
|
5022
5120
|
return;
|
|
5023
5121
|
}
|
|
5024
5122
|
if (e.name === "explode") {
|
|
5025
5123
|
let a = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : a * .12, s = e.relativeScale ?? 1.15;
|
|
5026
|
-
await
|
|
5124
|
+
await wi(i, o, (e) => {
|
|
5027
5125
|
let t = r(e), i = Math.abs(Math.sin(t * a * Math.PI));
|
|
5028
|
-
|
|
5029
|
-
}),
|
|
5126
|
+
A = 1 + (s - 1) * i, n();
|
|
5127
|
+
}), A = 1, P();
|
|
5030
5128
|
return;
|
|
5031
5129
|
}
|
|
5032
5130
|
if (e.name === "animateBubbleShape") {
|
|
5033
|
-
let n = e.visualStyle ??
|
|
5034
|
-
|
|
5131
|
+
let n = e.visualStyle ?? T.visualStyle, r = T.visualStyle, a = e.speed === void 0 ? 1 : Math.max(0, e.speed);
|
|
5132
|
+
M = {
|
|
5035
5133
|
from: r,
|
|
5036
5134
|
to: n,
|
|
5037
5135
|
progress: 0
|
|
5038
|
-
},
|
|
5039
|
-
let o = t === 0 ? 1 :
|
|
5040
|
-
|
|
5136
|
+
}, P(), await wi(i, t, (i) => {
|
|
5137
|
+
let o = t === 0 ? 1 : Si(i * Math.max(a, 1) / 1);
|
|
5138
|
+
M = {
|
|
5041
5139
|
from: r,
|
|
5042
5140
|
to: n,
|
|
5043
|
-
progress:
|
|
5044
|
-
},
|
|
5045
|
-
}),
|
|
5141
|
+
progress: Ci(o, e.ease ?? "easeInOut")
|
|
5142
|
+
}, P();
|
|
5143
|
+
}), M = void 0, P();
|
|
5046
5144
|
return;
|
|
5047
5145
|
}
|
|
5048
5146
|
},
|
|
5049
5147
|
show() {
|
|
5050
|
-
|
|
5148
|
+
x || (b = !0, P());
|
|
5051
5149
|
},
|
|
5052
5150
|
hide() {
|
|
5053
|
-
|
|
5151
|
+
x || (b = !1, ee());
|
|
5054
5152
|
},
|
|
5055
5153
|
dispose() {
|
|
5056
|
-
if (!
|
|
5057
|
-
|
|
5058
|
-
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID,
|
|
5059
|
-
c !== void 0 && (a.destroySkin(c), c = void 0), e.requestRedraw?.();
|
|
5154
|
+
if (!x) {
|
|
5155
|
+
x = !0, T.placement.basis === "actor" && t.onTargetVisualChange === I && (t.onTargetVisualChange = F ?? null);
|
|
5156
|
+
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID, di);
|
|
5157
|
+
c !== void 0 && (a.destroySkin(c), c = void 0), l !== void 0 && (a.destroySkin(l), l = void 0), e.requestRedraw?.();
|
|
5060
5158
|
}
|
|
5061
5159
|
}
|
|
5062
5160
|
});
|
|
5063
5161
|
} catch (e) {
|
|
5064
|
-
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID,
|
|
5065
|
-
throw c !== void 0 && a.destroySkin(c), e;
|
|
5162
|
+
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID, di);
|
|
5163
|
+
throw c !== void 0 && a.destroySkin(c), l !== void 0 && a.destroySkin(l), e;
|
|
5066
5164
|
}
|
|
5067
5165
|
}
|
|
5068
|
-
function
|
|
5069
|
-
if (!
|
|
5070
|
-
let n = e, r =
|
|
5166
|
+
function ji(e, t = {}) {
|
|
5167
|
+
if (!_i(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp runtime.");
|
|
5168
|
+
let n = e, r = vi(n.renderer), i = () => yi(n.ext_kubohiroyaassetmanager), a;
|
|
5071
5169
|
if (t.textCapability !== void 0) a = t.textCapability;
|
|
5072
5170
|
else try {
|
|
5073
|
-
a =
|
|
5171
|
+
a = li(n.ext_kubohiroyasvgtext);
|
|
5074
5172
|
} catch {
|
|
5075
5173
|
throw new $("BUBBLE-RUNTIME-003", "Bubble requires a text capability. Load @kubohiroya/turbowarp-svg-text or provide options.textCapability before using Bubble blocks.");
|
|
5076
5174
|
}
|
|
5077
|
-
return
|
|
5175
|
+
return ai({
|
|
5078
5176
|
imageResolver: t.imageResolver ?? {
|
|
5079
5177
|
isRegistered(e) {
|
|
5080
5178
|
return i().isLoaded({ NAME: e });
|
|
@@ -5086,7 +5184,7 @@ function Ti(e, t = {}) {
|
|
|
5086
5184
|
let a = t.drawableID;
|
|
5087
5185
|
if (!Number.isInteger(a) || a < 0) throw new $("BUBBLE-RUNTIME-001", "Bubble image target drawable is invalid.");
|
|
5088
5186
|
let o = await i().resolveSkin(e);
|
|
5089
|
-
if (!
|
|
5187
|
+
if (!_i(o) || !Number.isInteger(o.skinId) || o.skinId < 0) throw new $("BUBBLE-RUNTIME-002", `Asset Manager did not resolve an image skin: ${String(e)}`);
|
|
5090
5188
|
r.updateDrawableSkinId(a, o.skinId), n.requestRedraw?.();
|
|
5091
5189
|
}
|
|
5092
5190
|
},
|
|
@@ -5105,8 +5203,8 @@ function Ti(e, t = {}) {
|
|
|
5105
5203
|
},
|
|
5106
5204
|
textCapability: a,
|
|
5107
5205
|
createSurface({ actor: e, actorKey: r, style: i }) {
|
|
5108
|
-
if (!
|
|
5109
|
-
return
|
|
5206
|
+
if (!_i(e) || typeof e.id != "string") throw new $("BUBBLE-RUNTIME-001", "Bubble actor target is invalid.");
|
|
5207
|
+
return Ai(n, e, r, i, t.scheduler ?? {
|
|
5110
5208
|
setTimeout: (e, t) => globalThis.setTimeout(e, t),
|
|
5111
5209
|
clearTimeout: (e) => globalThis.clearTimeout(e)
|
|
5112
5210
|
});
|
|
@@ -5116,4 +5214,4 @@ function Ti(e, t = {}) {
|
|
|
5116
5214
|
});
|
|
5117
5215
|
}
|
|
5118
5216
|
//#endregion
|
|
5119
|
-
export { $ as BubbleRuntimeAdapterError,
|
|
5217
|
+
export { $ as BubbleRuntimeAdapterError, ui as createSvgTextCompositionCapability, ji as createTurboWarpBubbleComposition, li as createTurboWarpSvgTextCapability };
|