@makefully/fancifully 0.3.0 → 0.3.1
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/CHANGELOG.md +10 -0
- package/dist/fancifully.iife.js +2 -2
- package/dist/fancifully.js +491 -491
- package/dist/schema/story.d.ts +4 -16
- package/dist/schema/story.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/fancifully.js
CHANGED
|
@@ -13,10 +13,10 @@ class Sr {
|
|
|
13
13
|
y(this, "paused", !1);
|
|
14
14
|
}
|
|
15
15
|
setVolume(e, t) {
|
|
16
|
-
this.volumes[e] =
|
|
16
|
+
this.volumes[e] = It(t), this.applyAll();
|
|
17
17
|
}
|
|
18
18
|
getVolume(e) {
|
|
19
|
-
return
|
|
19
|
+
return It(this.volumes.sound) * It(this.volumes[e]);
|
|
20
20
|
}
|
|
21
21
|
setPaused(e) {
|
|
22
22
|
this.paused = e;
|
|
@@ -42,7 +42,7 @@ class Sr {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function It(s) {
|
|
46
46
|
return Number.isNaN(s) ? 0 : Math.min(1, Math.max(0, s));
|
|
47
47
|
}
|
|
48
48
|
class Cr {
|
|
@@ -168,11 +168,11 @@ function Er(s, e) {
|
|
|
168
168
|
const n = (l) => {
|
|
169
169
|
l.button != null && l.button !== 0 || (i = !0, t = l.clientX, r = l.clientY);
|
|
170
170
|
}, a = (l) => {
|
|
171
|
-
var
|
|
171
|
+
var d, u;
|
|
172
172
|
if (!i) return;
|
|
173
173
|
i = !1;
|
|
174
|
-
const
|
|
175
|
-
Math.abs(
|
|
174
|
+
const h = l.clientX - t, c = l.clientY - r;
|
|
175
|
+
Math.abs(h) < 50 || Math.abs(h) < Math.abs(c) || (h < 0 ? (d = e.onSwipeLeft) == null || d.call(e) : (u = e.onSwipeRight) == null || u.call(e));
|
|
176
176
|
}, o = () => {
|
|
177
177
|
i = !1;
|
|
178
178
|
};
|
|
@@ -330,8 +330,8 @@ class we extends Error {
|
|
|
330
330
|
else {
|
|
331
331
|
let o = r, l = 0;
|
|
332
332
|
for (; l < a.path.length; ) {
|
|
333
|
-
const
|
|
334
|
-
l === a.path.length - 1 ? (o[
|
|
333
|
+
const h = a.path[l];
|
|
334
|
+
l === a.path.length - 1 ? (o[h] = o[h] || { _errors: [] }, o[h]._errors.push(t(a))) : o[h] = o[h] || { _errors: [] }, o = o[h], l++;
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
};
|
|
@@ -437,9 +437,9 @@ const Pr = (s) => {
|
|
|
437
437
|
message: i.message
|
|
438
438
|
};
|
|
439
439
|
let o = "";
|
|
440
|
-
const l = r.filter((
|
|
441
|
-
for (const
|
|
442
|
-
o =
|
|
440
|
+
const l = r.filter((h) => !!h).slice().reverse();
|
|
441
|
+
for (const h of l)
|
|
442
|
+
o = h(a, { data: e, defaultError: o }).message;
|
|
443
443
|
return {
|
|
444
444
|
...i,
|
|
445
445
|
path: n,
|
|
@@ -507,7 +507,7 @@ class Q {
|
|
|
507
507
|
}
|
|
508
508
|
const C = Object.freeze({
|
|
509
509
|
status: "aborted"
|
|
510
|
-
}),
|
|
510
|
+
}), Ye = (s) => ({ status: "dirty", value: s }), oe = (s) => ({ status: "valid", value: s }), ws = (s) => s.status === "aborted", xs = (s) => s.status === "dirty", Be = (s) => s.status === "valid", yt = (s) => typeof Promise < "u" && s instanceof Promise;
|
|
511
511
|
var S;
|
|
512
512
|
(function(s) {
|
|
513
513
|
s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
@@ -521,7 +521,7 @@ class ge {
|
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
const _s = (s, e) => {
|
|
524
|
-
if (
|
|
524
|
+
if (Be(e))
|
|
525
525
|
return { success: !0, data: e.value };
|
|
526
526
|
if (!s.common.issues.length)
|
|
527
527
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -578,7 +578,7 @@ class I {
|
|
|
578
578
|
}
|
|
579
579
|
_parseSync(e) {
|
|
580
580
|
const t = this._parse(e);
|
|
581
|
-
if (
|
|
581
|
+
if (yt(t))
|
|
582
582
|
throw new Error("Synchronous parse encountered promise.");
|
|
583
583
|
return t;
|
|
584
584
|
}
|
|
@@ -623,7 +623,7 @@ class I {
|
|
|
623
623
|
if (!this["~standard"].async)
|
|
624
624
|
try {
|
|
625
625
|
const n = this._parseSync({ data: e, path: [], parent: t });
|
|
626
|
-
return
|
|
626
|
+
return Be(n) ? {
|
|
627
627
|
value: n.value
|
|
628
628
|
} : {
|
|
629
629
|
issues: t.common.issues
|
|
@@ -634,7 +634,7 @@ class I {
|
|
|
634
634
|
async: !0
|
|
635
635
|
};
|
|
636
636
|
}
|
|
637
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((n) =>
|
|
637
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((n) => Be(n) ? {
|
|
638
638
|
value: n.value
|
|
639
639
|
} : {
|
|
640
640
|
issues: t.common.issues
|
|
@@ -658,7 +658,7 @@ class I {
|
|
|
658
658
|
parent: null,
|
|
659
659
|
data: e,
|
|
660
660
|
parsedType: _e(e)
|
|
661
|
-
}, i = this._parse({ data: e, path: r.path, parent: r }), n = await (
|
|
661
|
+
}, i = this._parse({ data: e, path: r.path, parent: r }), n = await (yt(i) ? i : Promise.resolve(i));
|
|
662
662
|
return _s(r, n);
|
|
663
663
|
}
|
|
664
664
|
refine(e, t) {
|
|
@@ -704,13 +704,13 @@ class I {
|
|
|
704
704
|
return fe.create(this);
|
|
705
705
|
}
|
|
706
706
|
promise() {
|
|
707
|
-
return
|
|
707
|
+
return _t.create(this, this._def);
|
|
708
708
|
}
|
|
709
709
|
or(e) {
|
|
710
|
-
return
|
|
710
|
+
return bt.create([this, e], this._def);
|
|
711
711
|
}
|
|
712
712
|
and(e) {
|
|
713
|
-
return
|
|
713
|
+
return kt.create(this, e, this._def);
|
|
714
714
|
}
|
|
715
715
|
transform(e) {
|
|
716
716
|
return new Pe({
|
|
@@ -722,7 +722,7 @@ class I {
|
|
|
722
722
|
}
|
|
723
723
|
default(e) {
|
|
724
724
|
const t = typeof e == "function" ? e : () => e;
|
|
725
|
-
return new
|
|
725
|
+
return new St({
|
|
726
726
|
...M(this._def),
|
|
727
727
|
innerType: this,
|
|
728
728
|
defaultValue: t,
|
|
@@ -738,7 +738,7 @@ class I {
|
|
|
738
738
|
}
|
|
739
739
|
catch(e) {
|
|
740
740
|
const t = typeof e == "function" ? e : () => e;
|
|
741
|
-
return new
|
|
741
|
+
return new Ct({
|
|
742
742
|
...M(this._def),
|
|
743
743
|
innerType: this,
|
|
744
744
|
catchValue: t,
|
|
@@ -756,7 +756,7 @@ class I {
|
|
|
756
756
|
return cs.create(this, e);
|
|
757
757
|
}
|
|
758
758
|
readonly() {
|
|
759
|
-
return
|
|
759
|
+
return At.create(this);
|
|
760
760
|
}
|
|
761
761
|
isOptional() {
|
|
762
762
|
return this.safeParse(void 0).success;
|
|
@@ -766,7 +766,7 @@ class I {
|
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
const Nr = /^c[^\s-]{8,}$/i, Ir = /^[0-9a-z]+$/, $r = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Rr = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Or = /^[a-z0-9_-]{21}$/i, Vr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fr = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Br = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, zr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
769
|
-
let
|
|
769
|
+
let $t;
|
|
770
770
|
const jr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Zr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ur = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Hr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Dr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Wr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Qs = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", qr = new RegExp(`^${Qs}$`);
|
|
771
771
|
function er(s) {
|
|
772
772
|
let e = "[0-5]\\d";
|
|
@@ -777,15 +777,15 @@ function er(s) {
|
|
|
777
777
|
function Yr(s) {
|
|
778
778
|
return new RegExp(`^${er(s)}$`);
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function Jr(s) {
|
|
781
781
|
let e = `${Qs}T${er(s)}`;
|
|
782
782
|
const t = [];
|
|
783
783
|
return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
784
784
|
}
|
|
785
|
-
function
|
|
785
|
+
function Xr(s, e) {
|
|
786
786
|
return !!((e === "v4" || !e) && jr.test(s) || (e === "v6" || !e) && Ur.test(s));
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function Gr(s, e) {
|
|
789
789
|
if (!Vr.test(s))
|
|
790
790
|
return !1;
|
|
791
791
|
try {
|
|
@@ -856,7 +856,7 @@ class be extends I {
|
|
|
856
856
|
message: n.message
|
|
857
857
|
}), r.dirty());
|
|
858
858
|
else if (n.kind === "emoji")
|
|
859
|
-
|
|
859
|
+
$t || ($t = new RegExp(zr, "u")), $t.test(e.data) || (i = this._getOrReturnCtx(e, i), k(i, {
|
|
860
860
|
validation: "emoji",
|
|
861
861
|
code: p.invalid_string,
|
|
862
862
|
message: n.message
|
|
@@ -917,7 +917,7 @@ class be extends I {
|
|
|
917
917
|
code: p.invalid_string,
|
|
918
918
|
validation: { endsWith: n.value },
|
|
919
919
|
message: n.message
|
|
920
|
-
}), r.dirty()) : n.kind === "datetime" ?
|
|
920
|
+
}), r.dirty()) : n.kind === "datetime" ? Jr(n).test(e.data) || (i = this._getOrReturnCtx(e, i), k(i, {
|
|
921
921
|
code: p.invalid_string,
|
|
922
922
|
validation: "datetime",
|
|
923
923
|
message: n.message
|
|
@@ -933,11 +933,11 @@ class be extends I {
|
|
|
933
933
|
validation: "duration",
|
|
934
934
|
code: p.invalid_string,
|
|
935
935
|
message: n.message
|
|
936
|
-
}), r.dirty()) : n.kind === "ip" ?
|
|
936
|
+
}), r.dirty()) : n.kind === "ip" ? Xr(e.data, n.version) || (i = this._getOrReturnCtx(e, i), k(i, {
|
|
937
937
|
validation: "ip",
|
|
938
938
|
code: p.invalid_string,
|
|
939
939
|
message: n.message
|
|
940
|
-
}), r.dirty()) : n.kind === "jwt" ?
|
|
940
|
+
}), r.dirty()) : n.kind === "jwt" ? Gr(e.data, n.alg) || (i = this._getOrReturnCtx(e, i), k(i, {
|
|
941
941
|
validation: "jwt",
|
|
942
942
|
code: p.invalid_string,
|
|
943
943
|
message: n.message
|
|
@@ -1188,7 +1188,7 @@ function Qr(s, e) {
|
|
|
1188
1188
|
const t = (s.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, i = t > r ? t : r, n = Number.parseInt(s.toFixed(i).replace(".", "")), a = Number.parseInt(e.toFixed(i).replace(".", ""));
|
|
1189
1189
|
return n % a / 10 ** i;
|
|
1190
1190
|
}
|
|
1191
|
-
class
|
|
1191
|
+
class ze extends I {
|
|
1192
1192
|
constructor() {
|
|
1193
1193
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1194
1194
|
}
|
|
@@ -1246,7 +1246,7 @@ class je extends I {
|
|
|
1246
1246
|
return this.setLimit("max", e, !1, S.toString(t));
|
|
1247
1247
|
}
|
|
1248
1248
|
setLimit(e, t, r, i) {
|
|
1249
|
-
return new
|
|
1249
|
+
return new ze({
|
|
1250
1250
|
...this._def,
|
|
1251
1251
|
checks: [
|
|
1252
1252
|
...this._def.checks,
|
|
@@ -1260,7 +1260,7 @@ class je extends I {
|
|
|
1260
1260
|
});
|
|
1261
1261
|
}
|
|
1262
1262
|
_addCheck(e) {
|
|
1263
|
-
return new
|
|
1263
|
+
return new ze({
|
|
1264
1264
|
...this._def,
|
|
1265
1265
|
checks: [...this._def.checks, e]
|
|
1266
1266
|
});
|
|
@@ -1354,13 +1354,13 @@ class je extends I {
|
|
|
1354
1354
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
|
-
|
|
1357
|
+
ze.create = (s) => new ze({
|
|
1358
1358
|
checks: [],
|
|
1359
1359
|
typeName: A.ZodNumber,
|
|
1360
1360
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1361
1361
|
...M(s)
|
|
1362
1362
|
});
|
|
1363
|
-
class
|
|
1363
|
+
class tt extends I {
|
|
1364
1364
|
constructor() {
|
|
1365
1365
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1366
1366
|
}
|
|
@@ -1416,7 +1416,7 @@ class st extends I {
|
|
|
1416
1416
|
return this.setLimit("max", e, !1, S.toString(t));
|
|
1417
1417
|
}
|
|
1418
1418
|
setLimit(e, t, r, i) {
|
|
1419
|
-
return new
|
|
1419
|
+
return new tt({
|
|
1420
1420
|
...this._def,
|
|
1421
1421
|
checks: [
|
|
1422
1422
|
...this._def.checks,
|
|
@@ -1430,7 +1430,7 @@ class st extends I {
|
|
|
1430
1430
|
});
|
|
1431
1431
|
}
|
|
1432
1432
|
_addCheck(e) {
|
|
1433
|
-
return new
|
|
1433
|
+
return new tt({
|
|
1434
1434
|
...this._def,
|
|
1435
1435
|
checks: [...this._def.checks, e]
|
|
1436
1436
|
});
|
|
@@ -1487,7 +1487,7 @@ class st extends I {
|
|
|
1487
1487
|
return e;
|
|
1488
1488
|
}
|
|
1489
1489
|
}
|
|
1490
|
-
|
|
1490
|
+
tt.create = (s) => new tt({
|
|
1491
1491
|
checks: [],
|
|
1492
1492
|
typeName: A.ZodBigInt,
|
|
1493
1493
|
coerce: (s == null ? void 0 : s.coerce) ?? !1,
|
|
@@ -1511,7 +1511,7 @@ Dt.create = (s) => new Dt({
|
|
|
1511
1511
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1512
1512
|
...M(s)
|
|
1513
1513
|
});
|
|
1514
|
-
class
|
|
1514
|
+
class vt extends I {
|
|
1515
1515
|
_parse(e) {
|
|
1516
1516
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== w.date) {
|
|
1517
1517
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1551,7 +1551,7 @@ class bt extends I {
|
|
|
1551
1551
|
};
|
|
1552
1552
|
}
|
|
1553
1553
|
_addCheck(e) {
|
|
1554
|
-
return new
|
|
1554
|
+
return new vt({
|
|
1555
1555
|
...this._def,
|
|
1556
1556
|
checks: [...this._def.checks, e]
|
|
1557
1557
|
});
|
|
@@ -1583,7 +1583,7 @@ class bt extends I {
|
|
|
1583
1583
|
return e != null ? new Date(e) : null;
|
|
1584
1584
|
}
|
|
1585
1585
|
}
|
|
1586
|
-
|
|
1586
|
+
vt.create = (s) => new vt({
|
|
1587
1587
|
checks: [],
|
|
1588
1588
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1589
1589
|
typeName: A.ZodDate,
|
|
@@ -1768,12 +1768,12 @@ fe.create = (s, e) => new fe({
|
|
|
1768
1768
|
typeName: A.ZodArray,
|
|
1769
1769
|
...M(e)
|
|
1770
1770
|
});
|
|
1771
|
-
function
|
|
1771
|
+
function Oe(s) {
|
|
1772
1772
|
if (s instanceof Y) {
|
|
1773
1773
|
const e = {};
|
|
1774
1774
|
for (const t in s.shape) {
|
|
1775
1775
|
const r = s.shape[t];
|
|
1776
|
-
e[t] = ke.create(
|
|
1776
|
+
e[t] = ke.create(Oe(r));
|
|
1777
1777
|
}
|
|
1778
1778
|
return new Y({
|
|
1779
1779
|
...s._def,
|
|
@@ -1781,8 +1781,8 @@ function Ve(s) {
|
|
|
1781
1781
|
});
|
|
1782
1782
|
} else return s instanceof fe ? new fe({
|
|
1783
1783
|
...s._def,
|
|
1784
|
-
type:
|
|
1785
|
-
}) : s instanceof ke ? ke.create(
|
|
1784
|
+
type: Oe(s.element)
|
|
1785
|
+
}) : s instanceof ke ? ke.create(Oe(s.unwrap())) : s instanceof Ne ? Ne.create(Oe(s.unwrap())) : s instanceof Le ? Le.create(s.items.map((e) => Oe(e))) : s;
|
|
1786
1786
|
}
|
|
1787
1787
|
class Y extends I {
|
|
1788
1788
|
constructor() {
|
|
@@ -1796,48 +1796,48 @@ class Y extends I {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
_parse(e) {
|
|
1798
1798
|
if (this._getType(e) !== w.object) {
|
|
1799
|
-
const
|
|
1800
|
-
return k(
|
|
1799
|
+
const h = this._getOrReturnCtx(e);
|
|
1800
|
+
return k(h, {
|
|
1801
1801
|
code: p.invalid_type,
|
|
1802
1802
|
expected: w.object,
|
|
1803
|
-
received:
|
|
1803
|
+
received: h.parsedType
|
|
1804
1804
|
}), C;
|
|
1805
1805
|
}
|
|
1806
1806
|
const { status: r, ctx: i } = this._processInputParams(e), { shape: n, keys: a } = this._getCached(), o = [];
|
|
1807
1807
|
if (!(this._def.catchall instanceof Ce && this._def.unknownKeys === "strip"))
|
|
1808
|
-
for (const
|
|
1809
|
-
a.includes(
|
|
1808
|
+
for (const h in i.data)
|
|
1809
|
+
a.includes(h) || o.push(h);
|
|
1810
1810
|
const l = [];
|
|
1811
|
-
for (const
|
|
1812
|
-
const c = n[
|
|
1811
|
+
for (const h of a) {
|
|
1812
|
+
const c = n[h], d = i.data[h];
|
|
1813
1813
|
l.push({
|
|
1814
|
-
key: { status: "valid", value:
|
|
1815
|
-
value: c._parse(new ge(i,
|
|
1816
|
-
alwaysSet:
|
|
1814
|
+
key: { status: "valid", value: h },
|
|
1815
|
+
value: c._parse(new ge(i, d, i.path, h)),
|
|
1816
|
+
alwaysSet: h in i.data
|
|
1817
1817
|
});
|
|
1818
1818
|
}
|
|
1819
1819
|
if (this._def.catchall instanceof Ce) {
|
|
1820
|
-
const
|
|
1821
|
-
if (
|
|
1820
|
+
const h = this._def.unknownKeys;
|
|
1821
|
+
if (h === "passthrough")
|
|
1822
1822
|
for (const c of o)
|
|
1823
1823
|
l.push({
|
|
1824
1824
|
key: { status: "valid", value: c },
|
|
1825
1825
|
value: { status: "valid", value: i.data[c] }
|
|
1826
1826
|
});
|
|
1827
|
-
else if (
|
|
1827
|
+
else if (h === "strict")
|
|
1828
1828
|
o.length > 0 && (k(i, {
|
|
1829
1829
|
code: p.unrecognized_keys,
|
|
1830
1830
|
keys: o
|
|
1831
1831
|
}), r.dirty());
|
|
1832
|
-
else if (
|
|
1832
|
+
else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1833
1833
|
} else {
|
|
1834
|
-
const
|
|
1834
|
+
const h = this._def.catchall;
|
|
1835
1835
|
for (const c of o) {
|
|
1836
|
-
const
|
|
1836
|
+
const d = i.data[c];
|
|
1837
1837
|
l.push({
|
|
1838
1838
|
key: { status: "valid", value: c },
|
|
1839
|
-
value:
|
|
1840
|
-
new ge(i,
|
|
1839
|
+
value: h._parse(
|
|
1840
|
+
new ge(i, d, i.path, c)
|
|
1841
1841
|
//, ctx.child(key), value, getParsedType(value)
|
|
1842
1842
|
),
|
|
1843
1843
|
alwaysSet: c in i.data
|
|
@@ -1845,17 +1845,17 @@ class Y extends I {
|
|
|
1845
1845
|
}
|
|
1846
1846
|
}
|
|
1847
1847
|
return i.common.async ? Promise.resolve().then(async () => {
|
|
1848
|
-
const
|
|
1848
|
+
const h = [];
|
|
1849
1849
|
for (const c of l) {
|
|
1850
|
-
const
|
|
1851
|
-
|
|
1852
|
-
key:
|
|
1850
|
+
const d = await c.key, u = await c.value;
|
|
1851
|
+
h.push({
|
|
1852
|
+
key: d,
|
|
1853
1853
|
value: u,
|
|
1854
1854
|
alwaysSet: c.alwaysSet
|
|
1855
1855
|
});
|
|
1856
1856
|
}
|
|
1857
|
-
return
|
|
1858
|
-
}).then((
|
|
1857
|
+
return h;
|
|
1858
|
+
}).then((h) => Q.mergeObjectSync(r, h)) : Q.mergeObjectSync(r, l);
|
|
1859
1859
|
}
|
|
1860
1860
|
get shape() {
|
|
1861
1861
|
return this._def.shape();
|
|
@@ -2018,7 +2018,7 @@ class Y extends I {
|
|
|
2018
2018
|
* @deprecated
|
|
2019
2019
|
*/
|
|
2020
2020
|
deepPartial() {
|
|
2021
|
-
return
|
|
2021
|
+
return Oe(this);
|
|
2022
2022
|
}
|
|
2023
2023
|
partial(e) {
|
|
2024
2024
|
const t = {};
|
|
@@ -2072,7 +2072,7 @@ Y.lazycreate = (s, e) => new Y({
|
|
|
2072
2072
|
typeName: A.ZodObject,
|
|
2073
2073
|
...M(e)
|
|
2074
2074
|
});
|
|
2075
|
-
class
|
|
2075
|
+
class bt extends I {
|
|
2076
2076
|
_parse(e) {
|
|
2077
2077
|
const { ctx: t } = this._processInputParams(e), r = this._def.options;
|
|
2078
2078
|
function i(n) {
|
|
@@ -2111,7 +2111,7 @@ class kt extends I {
|
|
|
2111
2111
|
let n;
|
|
2112
2112
|
const a = [];
|
|
2113
2113
|
for (const l of r) {
|
|
2114
|
-
const
|
|
2114
|
+
const h = {
|
|
2115
2115
|
...t,
|
|
2116
2116
|
common: {
|
|
2117
2117
|
...t.common,
|
|
@@ -2121,11 +2121,11 @@ class kt extends I {
|
|
|
2121
2121
|
}, c = l._parseSync({
|
|
2122
2122
|
data: t.data,
|
|
2123
2123
|
path: t.path,
|
|
2124
|
-
parent:
|
|
2124
|
+
parent: h
|
|
2125
2125
|
});
|
|
2126
2126
|
if (c.status === "valid")
|
|
2127
2127
|
return c;
|
|
2128
|
-
c.status === "dirty" && !n && (n = { result: c, ctx:
|
|
2128
|
+
c.status === "dirty" && !n && (n = { result: c, ctx: h }), h.common.issues.length && a.push(h.common.issues);
|
|
2129
2129
|
}
|
|
2130
2130
|
if (n)
|
|
2131
2131
|
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
@@ -2140,12 +2140,12 @@ class kt extends I {
|
|
|
2140
2140
|
return this._def.options;
|
|
2141
2141
|
}
|
|
2142
2142
|
}
|
|
2143
|
-
|
|
2143
|
+
bt.create = (s, e) => new bt({
|
|
2144
2144
|
options: s,
|
|
2145
2145
|
typeName: A.ZodUnion,
|
|
2146
2146
|
...M(e)
|
|
2147
2147
|
});
|
|
2148
|
-
const ve = (s) => s instanceof
|
|
2148
|
+
const ve = (s) => s instanceof Jt ? ve(s.schema) : s instanceof Pe ? ve(s.innerType()) : s instanceof xt ? [s.value] : s instanceof Me ? s.options : s instanceof Xt ? $.objectValues(s.enum) : s instanceof St ? ve(s._def.innerType) : s instanceof Wt ? [void 0] : s instanceof qt ? [null] : s instanceof ke ? [void 0, ...ve(s.unwrap())] : s instanceof Ne ? [null, ...ve(s.unwrap())] : s instanceof sr || s instanceof At ? ve(s.unwrap()) : s instanceof Ct ? ve(s._def.innerType) : [];
|
|
2149
2149
|
class ls extends I {
|
|
2150
2150
|
_parse(e) {
|
|
2151
2151
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2234,7 +2234,7 @@ function Yt(s, e) {
|
|
|
2234
2234
|
return { valid: !0, data: i };
|
|
2235
2235
|
} else return t === w.date && r === w.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
|
|
2236
2236
|
}
|
|
2237
|
-
class
|
|
2237
|
+
class kt extends I {
|
|
2238
2238
|
_parse(e) {
|
|
2239
2239
|
const { status: t, ctx: r } = this._processInputParams(e), i = (n, a) => {
|
|
2240
2240
|
if (ws(n) || ws(a))
|
|
@@ -2266,7 +2266,7 @@ class wt extends I {
|
|
|
2266
2266
|
}));
|
|
2267
2267
|
}
|
|
2268
2268
|
}
|
|
2269
|
-
|
|
2269
|
+
kt.create = (s, e, t) => new kt({
|
|
2270
2270
|
left: s,
|
|
2271
2271
|
right: e,
|
|
2272
2272
|
typeName: A.ZodIntersection,
|
|
@@ -2322,7 +2322,7 @@ Le.create = (s, e) => {
|
|
|
2322
2322
|
...M(e)
|
|
2323
2323
|
});
|
|
2324
2324
|
};
|
|
2325
|
-
class
|
|
2325
|
+
class wt extends I {
|
|
2326
2326
|
get keySchema() {
|
|
2327
2327
|
return this._def.keyType;
|
|
2328
2328
|
}
|
|
@@ -2350,12 +2350,12 @@ class xt extends I {
|
|
|
2350
2350
|
return this._def.valueType;
|
|
2351
2351
|
}
|
|
2352
2352
|
static create(e, t, r) {
|
|
2353
|
-
return t instanceof I ? new
|
|
2353
|
+
return t instanceof I ? new wt({
|
|
2354
2354
|
keyType: e,
|
|
2355
2355
|
valueType: t,
|
|
2356
2356
|
typeName: A.ZodRecord,
|
|
2357
2357
|
...M(r)
|
|
2358
|
-
}) : new
|
|
2358
|
+
}) : new wt({
|
|
2359
2359
|
keyType: be.create(),
|
|
2360
2360
|
valueType: e,
|
|
2361
2361
|
typeName: A.ZodRecord,
|
|
@@ -2378,28 +2378,28 @@ class Ts extends I {
|
|
|
2378
2378
|
expected: w.map,
|
|
2379
2379
|
received: r.parsedType
|
|
2380
2380
|
}), C;
|
|
2381
|
-
const i = this._def.keyType, n = this._def.valueType, a = [...r.data.entries()].map(([o, l],
|
|
2382
|
-
key: i._parse(new ge(r, o, r.path, [
|
|
2383
|
-
value: n._parse(new ge(r, l, r.path, [
|
|
2381
|
+
const i = this._def.keyType, n = this._def.valueType, a = [...r.data.entries()].map(([o, l], h) => ({
|
|
2382
|
+
key: i._parse(new ge(r, o, r.path, [h, "key"])),
|
|
2383
|
+
value: n._parse(new ge(r, l, r.path, [h, "value"]))
|
|
2384
2384
|
}));
|
|
2385
2385
|
if (r.common.async) {
|
|
2386
2386
|
const o = /* @__PURE__ */ new Map();
|
|
2387
2387
|
return Promise.resolve().then(async () => {
|
|
2388
2388
|
for (const l of a) {
|
|
2389
|
-
const
|
|
2390
|
-
if (
|
|
2389
|
+
const h = await l.key, c = await l.value;
|
|
2390
|
+
if (h.status === "aborted" || c.status === "aborted")
|
|
2391
2391
|
return C;
|
|
2392
|
-
(
|
|
2392
|
+
(h.status === "dirty" || c.status === "dirty") && t.dirty(), o.set(h.value, c.value);
|
|
2393
2393
|
}
|
|
2394
2394
|
return { status: t.value, value: o };
|
|
2395
2395
|
});
|
|
2396
2396
|
} else {
|
|
2397
2397
|
const o = /* @__PURE__ */ new Map();
|
|
2398
2398
|
for (const l of a) {
|
|
2399
|
-
const
|
|
2400
|
-
if (
|
|
2399
|
+
const h = l.key, c = l.value;
|
|
2400
|
+
if (h.status === "aborted" || c.status === "aborted")
|
|
2401
2401
|
return C;
|
|
2402
|
-
(
|
|
2402
|
+
(h.status === "dirty" || c.status === "dirty") && t.dirty(), o.set(h.value, c.value);
|
|
2403
2403
|
}
|
|
2404
2404
|
return { status: t.value, value: o };
|
|
2405
2405
|
}
|
|
@@ -2411,7 +2411,7 @@ Ts.create = (s, e, t) => new Ts({
|
|
|
2411
2411
|
typeName: A.ZodMap,
|
|
2412
2412
|
...M(t)
|
|
2413
2413
|
});
|
|
2414
|
-
class
|
|
2414
|
+
class st extends I {
|
|
2415
2415
|
_parse(e) {
|
|
2416
2416
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2417
2417
|
if (r.parsedType !== w.set)
|
|
@@ -2438,25 +2438,25 @@ class rt extends I {
|
|
|
2438
2438
|
}), t.dirty());
|
|
2439
2439
|
const n = this._def.valueType;
|
|
2440
2440
|
function a(l) {
|
|
2441
|
-
const
|
|
2441
|
+
const h = /* @__PURE__ */ new Set();
|
|
2442
2442
|
for (const c of l) {
|
|
2443
2443
|
if (c.status === "aborted")
|
|
2444
2444
|
return C;
|
|
2445
|
-
c.status === "dirty" && t.dirty(),
|
|
2445
|
+
c.status === "dirty" && t.dirty(), h.add(c.value);
|
|
2446
2446
|
}
|
|
2447
|
-
return { status: t.value, value:
|
|
2447
|
+
return { status: t.value, value: h };
|
|
2448
2448
|
}
|
|
2449
|
-
const o = [...r.data.values()].map((l,
|
|
2449
|
+
const o = [...r.data.values()].map((l, h) => n._parse(new ge(r, l, r.path, h)));
|
|
2450
2450
|
return r.common.async ? Promise.all(o).then((l) => a(l)) : a(o);
|
|
2451
2451
|
}
|
|
2452
2452
|
min(e, t) {
|
|
2453
|
-
return new
|
|
2453
|
+
return new st({
|
|
2454
2454
|
...this._def,
|
|
2455
2455
|
minSize: { value: e, message: S.toString(t) }
|
|
2456
2456
|
});
|
|
2457
2457
|
}
|
|
2458
2458
|
max(e, t) {
|
|
2459
|
-
return new
|
|
2459
|
+
return new st({
|
|
2460
2460
|
...this._def,
|
|
2461
2461
|
maxSize: { value: e, message: S.toString(t) }
|
|
2462
2462
|
});
|
|
@@ -2468,14 +2468,14 @@ class rt extends I {
|
|
|
2468
2468
|
return this.min(1, e);
|
|
2469
2469
|
}
|
|
2470
2470
|
}
|
|
2471
|
-
|
|
2471
|
+
st.create = (s, e) => new st({
|
|
2472
2472
|
valueType: s,
|
|
2473
2473
|
minSize: null,
|
|
2474
2474
|
maxSize: null,
|
|
2475
2475
|
typeName: A.ZodSet,
|
|
2476
2476
|
...M(e)
|
|
2477
2477
|
});
|
|
2478
|
-
class
|
|
2478
|
+
class Jt extends I {
|
|
2479
2479
|
get schema() {
|
|
2480
2480
|
return this._def.getter();
|
|
2481
2481
|
}
|
|
@@ -2484,12 +2484,12 @@ class Gt extends I {
|
|
|
2484
2484
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2485
2485
|
}
|
|
2486
2486
|
}
|
|
2487
|
-
|
|
2487
|
+
Jt.create = (s, e) => new Jt({
|
|
2488
2488
|
getter: s,
|
|
2489
2489
|
typeName: A.ZodLazy,
|
|
2490
2490
|
...M(e)
|
|
2491
2491
|
});
|
|
2492
|
-
class
|
|
2492
|
+
class xt extends I {
|
|
2493
2493
|
_parse(e) {
|
|
2494
2494
|
if (e.data !== this._def.value) {
|
|
2495
2495
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2505,7 +2505,7 @@ class _t extends I {
|
|
|
2505
2505
|
return this._def.value;
|
|
2506
2506
|
}
|
|
2507
2507
|
}
|
|
2508
|
-
|
|
2508
|
+
xt.create = (s, e) => new xt({
|
|
2509
2509
|
value: s,
|
|
2510
2510
|
typeName: A.ZodLiteral,
|
|
2511
2511
|
...M(e)
|
|
@@ -2572,7 +2572,7 @@ class Me extends I {
|
|
|
2572
2572
|
}
|
|
2573
2573
|
}
|
|
2574
2574
|
Me.create = tr;
|
|
2575
|
-
class
|
|
2575
|
+
class Xt extends I {
|
|
2576
2576
|
_parse(e) {
|
|
2577
2577
|
const t = $.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
2578
2578
|
if (r.parsedType !== w.string && r.parsedType !== w.number) {
|
|
@@ -2597,12 +2597,12 @@ class Jt extends I {
|
|
|
2597
2597
|
return this._def.values;
|
|
2598
2598
|
}
|
|
2599
2599
|
}
|
|
2600
|
-
|
|
2600
|
+
Xt.create = (s, e) => new Xt({
|
|
2601
2601
|
values: s,
|
|
2602
2602
|
typeName: A.ZodNativeEnum,
|
|
2603
2603
|
...M(e)
|
|
2604
2604
|
});
|
|
2605
|
-
class
|
|
2605
|
+
class _t extends I {
|
|
2606
2606
|
unwrap() {
|
|
2607
2607
|
return this._def.type;
|
|
2608
2608
|
}
|
|
@@ -2621,7 +2621,7 @@ class St extends I {
|
|
|
2621
2621
|
})));
|
|
2622
2622
|
}
|
|
2623
2623
|
}
|
|
2624
|
-
|
|
2624
|
+
_t.create = (s, e) => new _t({
|
|
2625
2625
|
type: s,
|
|
2626
2626
|
typeName: A.ZodPromise,
|
|
2627
2627
|
...M(e)
|
|
@@ -2653,7 +2653,7 @@ class Pe extends I {
|
|
|
2653
2653
|
path: r.path,
|
|
2654
2654
|
parent: r
|
|
2655
2655
|
});
|
|
2656
|
-
return l.status === "aborted" ? C : l.status === "dirty" || t.value === "dirty" ?
|
|
2656
|
+
return l.status === "aborted" ? C : l.status === "dirty" || t.value === "dirty" ? Ye(l.value) : l;
|
|
2657
2657
|
});
|
|
2658
2658
|
{
|
|
2659
2659
|
if (t.value === "aborted")
|
|
@@ -2663,7 +2663,7 @@ class Pe extends I {
|
|
|
2663
2663
|
path: r.path,
|
|
2664
2664
|
parent: r
|
|
2665
2665
|
});
|
|
2666
|
-
return o.status === "aborted" ? C : o.status === "dirty" || t.value === "dirty" ?
|
|
2666
|
+
return o.status === "aborted" ? C : o.status === "dirty" || t.value === "dirty" ? Ye(o.value) : o;
|
|
2667
2667
|
}
|
|
2668
2668
|
}
|
|
2669
2669
|
if (i.type === "refinement") {
|
|
@@ -2692,14 +2692,14 @@ class Pe extends I {
|
|
|
2692
2692
|
path: r.path,
|
|
2693
2693
|
parent: r
|
|
2694
2694
|
});
|
|
2695
|
-
if (!
|
|
2695
|
+
if (!Be(a))
|
|
2696
2696
|
return C;
|
|
2697
2697
|
const o = i.transform(a.value, n);
|
|
2698
2698
|
if (o instanceof Promise)
|
|
2699
2699
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2700
2700
|
return { status: t.value, value: o };
|
|
2701
2701
|
} else
|
|
2702
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((a) =>
|
|
2702
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((a) => Be(a) ? Promise.resolve(i.transform(a.value, n)).then((o) => ({
|
|
2703
2703
|
status: t.value,
|
|
2704
2704
|
value: o
|
|
2705
2705
|
})) : C);
|
|
@@ -2744,7 +2744,7 @@ Ne.create = (s, e) => new Ne({
|
|
|
2744
2744
|
typeName: A.ZodNullable,
|
|
2745
2745
|
...M(e)
|
|
2746
2746
|
});
|
|
2747
|
-
class
|
|
2747
|
+
class St extends I {
|
|
2748
2748
|
_parse(e) {
|
|
2749
2749
|
const { ctx: t } = this._processInputParams(e);
|
|
2750
2750
|
let r = t.data;
|
|
@@ -2758,13 +2758,13 @@ class Ct extends I {
|
|
|
2758
2758
|
return this._def.innerType;
|
|
2759
2759
|
}
|
|
2760
2760
|
}
|
|
2761
|
-
|
|
2761
|
+
St.create = (s, e) => new St({
|
|
2762
2762
|
innerType: s,
|
|
2763
2763
|
typeName: A.ZodDefault,
|
|
2764
2764
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2765
2765
|
...M(e)
|
|
2766
2766
|
});
|
|
2767
|
-
class
|
|
2767
|
+
class Ct extends I {
|
|
2768
2768
|
_parse(e) {
|
|
2769
2769
|
const { ctx: t } = this._processInputParams(e), r = {
|
|
2770
2770
|
...t,
|
|
@@ -2779,7 +2779,7 @@ class At extends I {
|
|
|
2779
2779
|
...r
|
|
2780
2780
|
}
|
|
2781
2781
|
});
|
|
2782
|
-
return
|
|
2782
|
+
return yt(i) ? i.then((n) => ({
|
|
2783
2783
|
status: "valid",
|
|
2784
2784
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2785
2785
|
get error() {
|
|
@@ -2801,7 +2801,7 @@ class At extends I {
|
|
|
2801
2801
|
return this._def.innerType;
|
|
2802
2802
|
}
|
|
2803
2803
|
}
|
|
2804
|
-
|
|
2804
|
+
Ct.create = (s, e) => new Ct({
|
|
2805
2805
|
innerType: s,
|
|
2806
2806
|
typeName: A.ZodCatch,
|
|
2807
2807
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
@@ -2847,7 +2847,7 @@ class cs extends I {
|
|
|
2847
2847
|
path: r.path,
|
|
2848
2848
|
parent: r
|
|
2849
2849
|
});
|
|
2850
|
-
return n.status === "aborted" ? C : n.status === "dirty" ? (t.dirty(),
|
|
2850
|
+
return n.status === "aborted" ? C : n.status === "dirty" ? (t.dirty(), Ye(n.value)) : this._def.out._parseAsync({
|
|
2851
2851
|
data: n.value,
|
|
2852
2852
|
path: r.path,
|
|
2853
2853
|
parent: r
|
|
@@ -2877,16 +2877,16 @@ class cs extends I {
|
|
|
2877
2877
|
});
|
|
2878
2878
|
}
|
|
2879
2879
|
}
|
|
2880
|
-
class
|
|
2880
|
+
class At extends I {
|
|
2881
2881
|
_parse(e) {
|
|
2882
|
-
const t = this._def.innerType._parse(e), r = (i) => (
|
|
2883
|
-
return
|
|
2882
|
+
const t = this._def.innerType._parse(e), r = (i) => (Be(i) && (i.value = Object.freeze(i.value)), i);
|
|
2883
|
+
return yt(t) ? t.then((i) => r(i)) : r(t);
|
|
2884
2884
|
}
|
|
2885
2885
|
unwrap() {
|
|
2886
2886
|
return this._def.innerType;
|
|
2887
2887
|
}
|
|
2888
2888
|
}
|
|
2889
|
-
|
|
2889
|
+
At.create = (s, e) => new At({
|
|
2890
2890
|
innerType: s,
|
|
2891
2891
|
typeName: A.ZodReadonly,
|
|
2892
2892
|
...M(e)
|
|
@@ -2895,23 +2895,23 @@ var A;
|
|
|
2895
2895
|
(function(s) {
|
|
2896
2896
|
s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
|
|
2897
2897
|
})(A || (A = {}));
|
|
2898
|
-
const N = be.create, ee =
|
|
2898
|
+
const N = be.create, ee = ze.create, Rt = Dt.create;
|
|
2899
2899
|
Ce.create;
|
|
2900
|
-
const
|
|
2901
|
-
|
|
2900
|
+
const rt = fe.create, D = Y.create, at = bt.create, rr = ls.create;
|
|
2901
|
+
kt.create;
|
|
2902
2902
|
Le.create;
|
|
2903
|
-
const ei =
|
|
2904
|
-
|
|
2903
|
+
const ei = wt.create, Ee = xt.create, Ge = Me.create;
|
|
2904
|
+
_t.create;
|
|
2905
2905
|
ke.create;
|
|
2906
2906
|
Ne.create;
|
|
2907
|
-
const
|
|
2908
|
-
x:
|
|
2909
|
-
y:
|
|
2910
|
-
width:
|
|
2911
|
-
height:
|
|
2912
|
-
fit:
|
|
2913
|
-
horizontalAlign:
|
|
2914
|
-
verticalAlign:
|
|
2907
|
+
const dt = at([ee(), N()]), hs = D({
|
|
2908
|
+
x: dt.optional().default(0),
|
|
2909
|
+
y: dt.optional().default(0),
|
|
2910
|
+
width: dt.optional(),
|
|
2911
|
+
height: dt.optional(),
|
|
2912
|
+
fit: Ge(["contain", "cover", "fill", "none"]).optional(),
|
|
2913
|
+
horizontalAlign: Ge(["left", "center", "right"]).optional(),
|
|
2914
|
+
verticalAlign: Ge(["top", "center", "bottom"]).optional()
|
|
2915
2915
|
}), ti = D({
|
|
2916
2916
|
id: N(),
|
|
2917
2917
|
start: ee(),
|
|
@@ -2925,7 +2925,7 @@ const ut = ot([ee(), N()]), ds = D({
|
|
|
2925
2925
|
D({
|
|
2926
2926
|
type: Ee("audio"),
|
|
2927
2927
|
src: N(),
|
|
2928
|
-
channel:
|
|
2928
|
+
channel: Ge(["vo", "sfx", "music"]).optional().default("vo")
|
|
2929
2929
|
}),
|
|
2930
2930
|
D({
|
|
2931
2931
|
type: Ee("vtt"),
|
|
@@ -2935,7 +2935,7 @@ const ut = ot([ee(), N()]), ds = D({
|
|
|
2935
2935
|
type: Ee("html"),
|
|
2936
2936
|
src: N()
|
|
2937
2937
|
})
|
|
2938
|
-
]), ri =
|
|
2938
|
+
]), ri = at([
|
|
2939
2939
|
D({ play: N() }),
|
|
2940
2940
|
D({
|
|
2941
2941
|
toggleClass: D({
|
|
@@ -2946,15 +2946,15 @@ const ut = ot([ee(), N()]), ds = D({
|
|
|
2946
2946
|
]), ii = D({
|
|
2947
2947
|
id: N(),
|
|
2948
2948
|
type: Ee("text"),
|
|
2949
|
-
layout:
|
|
2949
|
+
layout: hs.optional().default({}),
|
|
2950
2950
|
html: N().optional(),
|
|
2951
2951
|
htmlSrc: N().optional(),
|
|
2952
2952
|
style: D({
|
|
2953
2953
|
fontFamily: N().optional(),
|
|
2954
2954
|
fontSize: N().optional(),
|
|
2955
2955
|
color: N().optional(),
|
|
2956
|
-
textAlign:
|
|
2957
|
-
lineHeight:
|
|
2956
|
+
textAlign: Ge(["left", "center", "right"]).optional(),
|
|
2957
|
+
lineHeight: at([N(), ee()]).optional(),
|
|
2958
2958
|
/** Set only when a real bold face of this family is embedded. */
|
|
2959
2959
|
fontWeight: N().optional(),
|
|
2960
2960
|
/** Set only when a real italic face of this family is embedded. */
|
|
@@ -2964,13 +2964,13 @@ const ut = ot([ee(), N()]), ds = D({
|
|
|
2964
2964
|
id: N(),
|
|
2965
2965
|
type: Ee("image"),
|
|
2966
2966
|
asset: N(),
|
|
2967
|
-
layout:
|
|
2967
|
+
layout: hs.optional().default({}),
|
|
2968
2968
|
className: N().optional()
|
|
2969
2969
|
}), ai = D({
|
|
2970
2970
|
id: N(),
|
|
2971
2971
|
type: Ee("hotspot"),
|
|
2972
|
-
layout:
|
|
2973
|
-
onTap:
|
|
2972
|
+
layout: hs.optional().default({}),
|
|
2973
|
+
onTap: rt(ri).optional().default([]),
|
|
2974
2974
|
ariaLabel: N().optional()
|
|
2975
2975
|
}), oi = rr("type", [
|
|
2976
2976
|
ii,
|
|
@@ -2989,9 +2989,9 @@ const ut = ot([ee(), N()]), ds = D({
|
|
|
2989
2989
|
}).optional(),
|
|
2990
2990
|
readAloud: D({
|
|
2991
2991
|
audio: N(),
|
|
2992
|
-
cues:
|
|
2992
|
+
cues: at([N(), rt(ti)]).optional()
|
|
2993
2993
|
}).optional(),
|
|
2994
|
-
blocks:
|
|
2994
|
+
blocks: rt(oi).optional().default([])
|
|
2995
2995
|
}), ci = D({
|
|
2996
2996
|
id: N(),
|
|
2997
2997
|
title: N().optional(),
|
|
@@ -3003,18 +3003,18 @@ const ut = ot([ee(), N()]), ds = D({
|
|
|
3003
3003
|
* First page is a front cover: starts closed (centered); page-flips open to
|
|
3004
3004
|
* interior content (cover omitted from open spreads).
|
|
3005
3005
|
*/
|
|
3006
|
-
frontCover:
|
|
3006
|
+
frontCover: Rt().optional().default(!1),
|
|
3007
3007
|
/**
|
|
3008
3008
|
* Last page is a back cover: omitted from open spreads; page-flips closed
|
|
3009
3009
|
* to a centered back cover after the final interior spread.
|
|
3010
3010
|
*/
|
|
3011
|
-
backCover:
|
|
3011
|
+
backCover: Rt().optional().default(!1),
|
|
3012
3012
|
/**
|
|
3013
3013
|
* Front/back cover boards are larger than interior pages. When open, the
|
|
3014
3014
|
* cover stays behind the spread so a rim of cover remains visible.
|
|
3015
3015
|
* Only applies when `frontCover` and/or `backCover` is set.
|
|
3016
3016
|
*/
|
|
3017
|
-
hardback:
|
|
3017
|
+
hardback: Rt().optional().default(!1),
|
|
3018
3018
|
/**
|
|
3019
3019
|
* Closed cover board size. When hardback is on, the rim is
|
|
3020
3020
|
* `(coverSize - pageSize) / 2` on each edge. Omitted boards use the default overhang.
|
|
@@ -3023,30 +3023,30 @@ const ut = ot([ee(), N()]), ds = D({
|
|
|
3023
3023
|
width: ee().positive(),
|
|
3024
3024
|
height: ee().positive()
|
|
3025
3025
|
}).optional(),
|
|
3026
|
-
/**
|
|
3026
|
+
/**
|
|
3027
|
+
* Editor alignment rails (margins / gutter). The player ignores these.
|
|
3028
|
+
* Show/snap toggles are editor prefs, not story fields.
|
|
3029
|
+
*/
|
|
3027
3030
|
guides: D({
|
|
3028
3031
|
marginTop: ee().nonnegative().default(48),
|
|
3029
3032
|
marginRight: ee().nonnegative().default(48),
|
|
3030
3033
|
marginBottom: ee().nonnegative().default(48),
|
|
3031
3034
|
marginLeft: ee().nonnegative().default(48),
|
|
3032
3035
|
/** Snap band around the gutter, in pixels. The split stays at page width. */
|
|
3033
|
-
gutterBand: ee().nonnegative().default(8)
|
|
3034
|
-
showGuides: Oe().default(!0),
|
|
3035
|
-
snapGuides: Oe().default(!0),
|
|
3036
|
-
snapObjects: Oe().default(!0)
|
|
3036
|
+
gutterBand: ee().nonnegative().default(8)
|
|
3037
3037
|
}).optional(),
|
|
3038
|
-
fonts:
|
|
3038
|
+
fonts: rt(
|
|
3039
3039
|
D({
|
|
3040
3040
|
family: N(),
|
|
3041
3041
|
src: N(),
|
|
3042
|
-
weight:
|
|
3042
|
+
weight: at([N(), ee()]).optional(),
|
|
3043
3043
|
style: N().optional()
|
|
3044
3044
|
})
|
|
3045
3045
|
).optional().default([]),
|
|
3046
3046
|
assets: ei(si).optional().default({}),
|
|
3047
|
-
pages:
|
|
3047
|
+
pages: rt(li).min(1)
|
|
3048
3048
|
});
|
|
3049
|
-
function
|
|
3049
|
+
function ot(s) {
|
|
3050
3050
|
return ci.parse(s);
|
|
3051
3051
|
}
|
|
3052
3052
|
function Ms(s) {
|
|
@@ -3063,9 +3063,9 @@ function Ms(s) {
|
|
|
3063
3063
|
if (o.length === 0) continue;
|
|
3064
3064
|
const l = o.findIndex((b) => b.includes("-->"));
|
|
3065
3065
|
if (l === -1) continue;
|
|
3066
|
-
const
|
|
3066
|
+
const h = l > 0 ? o[0] : void 0, c = o[l], d = o.slice(l + 1), u = c.split("-->").map((b) => b.trim().split(/\s+/)[0]);
|
|
3067
3067
|
if (u.length < 2) continue;
|
|
3068
|
-
const g = Ps(u[0]), _ = Ps(u[1]), v =
|
|
3068
|
+
const g = Ps(u[0]), _ = Ps(u[1]), v = d.join(" ").trim(), f = h || v || `cue-${n++}`;
|
|
3069
3069
|
i.push({
|
|
3070
3070
|
id: f,
|
|
3071
3071
|
start: g,
|
|
@@ -3087,32 +3087,32 @@ function Ps(s) {
|
|
|
3087
3087
|
}
|
|
3088
3088
|
return Number(s);
|
|
3089
3089
|
}
|
|
3090
|
-
function
|
|
3090
|
+
function Fe(s, e) {
|
|
3091
3091
|
if (/^(?:[a-z]+:)?\/\//i.test(e) || e.startsWith("data:") || e.startsWith("blob:") || !s)
|
|
3092
3092
|
return e;
|
|
3093
3093
|
try {
|
|
3094
|
-
return new URL(e,
|
|
3094
|
+
return new URL(e, Gt(s)).href;
|
|
3095
3095
|
} catch {
|
|
3096
|
-
return `${
|
|
3096
|
+
return `${Gt(s)}${e.replace(/^\//, "")}`;
|
|
3097
3097
|
}
|
|
3098
3098
|
}
|
|
3099
|
-
function
|
|
3099
|
+
function Gt(s) {
|
|
3100
3100
|
return s.endsWith("/") || s.includes("?") ? s.endsWith("/") ? s : `${s}/` : /\.[a-z0-9]+$/i.test(s.split("/").pop() ?? "") ? s.replace(/[^/]+$/, "") : `${s}/`;
|
|
3101
3101
|
}
|
|
3102
|
-
function
|
|
3102
|
+
function hi(s) {
|
|
3103
3103
|
try {
|
|
3104
3104
|
const e = new URL(s, typeof location < "u" ? location.href : "http://local/");
|
|
3105
3105
|
e.hash = "";
|
|
3106
3106
|
const t = e.pathname;
|
|
3107
3107
|
return e.pathname = t.replace(/[^/]+$/, ""), e.href;
|
|
3108
3108
|
} catch {
|
|
3109
|
-
return
|
|
3109
|
+
return Gt(s.replace(/[^/]+$/, ""));
|
|
3110
3110
|
}
|
|
3111
3111
|
}
|
|
3112
|
-
async function
|
|
3112
|
+
async function Ke(s, e) {
|
|
3113
3113
|
typeof document > "u" || !("fonts" in document) || await Promise.all(
|
|
3114
3114
|
s.fonts.map(async (t) => {
|
|
3115
|
-
const r =
|
|
3115
|
+
const r = Fe(e, t.src), n = await new FontFace(t.family, `url(${JSON.stringify(r)})`, {
|
|
3116
3116
|
weight: t.weight != null ? String(t.weight) : "normal",
|
|
3117
3117
|
style: t.style ?? "normal"
|
|
3118
3118
|
}).load();
|
|
@@ -3120,7 +3120,7 @@ async function Qe(s, e) {
|
|
|
3120
3120
|
})
|
|
3121
3121
|
);
|
|
3122
3122
|
}
|
|
3123
|
-
var W = Uint8Array, re = Uint16Array,
|
|
3123
|
+
var W = Uint8Array, re = Uint16Array, ds = Int32Array, Tt = new W([
|
|
3124
3124
|
0,
|
|
3125
3125
|
0,
|
|
3126
3126
|
0,
|
|
@@ -3155,7 +3155,7 @@ var W = Uint8Array, re = Uint16Array, hs = Int32Array, Lt = new W([
|
|
|
3155
3155
|
0,
|
|
3156
3156
|
/* impossible */
|
|
3157
3157
|
0
|
|
3158
|
-
]),
|
|
3158
|
+
]), Lt = new W([
|
|
3159
3159
|
0,
|
|
3160
3160
|
0,
|
|
3161
3161
|
0,
|
|
@@ -3192,13 +3192,13 @@ var W = Uint8Array, re = Uint16Array, hs = Int32Array, Lt = new W([
|
|
|
3192
3192
|
]), Kt = new W([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), ir = function(s, e) {
|
|
3193
3193
|
for (var t = new re(31), r = 0; r < 31; ++r)
|
|
3194
3194
|
t[r] = e += 1 << s[r - 1];
|
|
3195
|
-
for (var i = new
|
|
3195
|
+
for (var i = new ds(t[30]), r = 1; r < 30; ++r)
|
|
3196
3196
|
for (var n = t[r]; n < t[r + 1]; ++n)
|
|
3197
3197
|
i[n] = n - t[r] << 5 | r;
|
|
3198
3198
|
return { b: t, r: i };
|
|
3199
|
-
}, nr = ir(
|
|
3199
|
+
}, nr = ir(Tt, 2), ar = nr.b, Qt = nr.r;
|
|
3200
3200
|
ar[28] = 258, Qt[258] = 28;
|
|
3201
|
-
var or = ir(
|
|
3201
|
+
var or = ir(Lt, 0), di = or.b, Ns = or.r, es = new re(32768);
|
|
3202
3202
|
for (var F = 0; F < 32768; ++F) {
|
|
3203
3203
|
var xe = (F & 43690) >> 1 | (F & 21845) << 1;
|
|
3204
3204
|
xe = (xe & 52428) >> 2 | (xe & 13107) << 2, xe = (xe & 61680) >> 4 | (xe & 3855) << 4, es[F] = ((xe & 65280) >> 8 | (xe & 255) << 8) >> 1;
|
|
@@ -3215,8 +3215,8 @@ var pe = (function(s, e, t) {
|
|
|
3215
3215
|
var l = 15 - e;
|
|
3216
3216
|
for (i = 0; i < r; ++i)
|
|
3217
3217
|
if (s[i])
|
|
3218
|
-
for (var
|
|
3219
|
-
o[es[
|
|
3218
|
+
for (var h = i << 4 | s[i], c = e - s[i], d = a[s[i] - 1]++ << c, u = d | (1 << c) - 1; d <= u; ++d)
|
|
3219
|
+
o[es[d] >> l] = h;
|
|
3220
3220
|
} else
|
|
3221
3221
|
for (o = new re(r), i = 0; i < r; ++i)
|
|
3222
3222
|
s[i] && (o[i] = es[a[s[i] - 1]++] >> 15 - s[i]);
|
|
@@ -3230,10 +3230,10 @@ for (var F = 256; F < 280; ++F)
|
|
|
3230
3230
|
Ae[F] = 7;
|
|
3231
3231
|
for (var F = 280; F < 288; ++F)
|
|
3232
3232
|
Ae[F] = 8;
|
|
3233
|
-
var
|
|
3233
|
+
var it = new W(32);
|
|
3234
3234
|
for (var F = 0; F < 32; ++F)
|
|
3235
|
-
|
|
3236
|
-
var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /* @__PURE__ */ pe(
|
|
3235
|
+
it[F] = 5;
|
|
3236
|
+
var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /* @__PURE__ */ pe(it, 5, 0), gi = /* @__PURE__ */ pe(it, 5, 1), Ot = function(s) {
|
|
3237
3237
|
for (var e = s[0], t = 1; t < s.length; ++t)
|
|
3238
3238
|
s[t] > e && (e = s[t]);
|
|
3239
3239
|
return e;
|
|
@@ -3245,7 +3245,7 @@ var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /
|
|
|
3245
3245
|
return (s[t] | s[t + 1] << 8 | s[t + 2] << 16) >> (e & 7);
|
|
3246
3246
|
}, us = function(s) {
|
|
3247
3247
|
return (s + 7) / 8 | 0;
|
|
3248
|
-
},
|
|
3248
|
+
}, lt = function(s, e, t) {
|
|
3249
3249
|
return (e == null || e < 0) && (e = 0), (t == null || t > s.length) && (t = s.length), new W(s.subarray(e, t));
|
|
3250
3250
|
}, mi = [
|
|
3251
3251
|
"unexpected EOF",
|
|
@@ -3275,104 +3275,104 @@ var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /
|
|
|
3275
3275
|
return t || new W(0);
|
|
3276
3276
|
var a = !t, o = a || e.i != 2, l = e.i;
|
|
3277
3277
|
a && (t = new W(i * 3));
|
|
3278
|
-
var
|
|
3279
|
-
var
|
|
3280
|
-
if (
|
|
3281
|
-
var Re = new W(Math.max(
|
|
3278
|
+
var h = function(Ze) {
|
|
3279
|
+
var Ue = t.length;
|
|
3280
|
+
if (Ze > Ue) {
|
|
3281
|
+
var Re = new W(Math.max(Ue * 2, Ze));
|
|
3282
3282
|
Re.set(t), t = Re;
|
|
3283
3283
|
}
|
|
3284
|
-
}, c = e.f || 0,
|
|
3284
|
+
}, c = e.f || 0, d = e.p || 0, u = e.b || 0, g = e.l, _ = e.d, v = e.m, f = e.n, b = i * 8;
|
|
3285
3285
|
do {
|
|
3286
3286
|
if (!g) {
|
|
3287
|
-
c = le(s,
|
|
3288
|
-
var x = le(s,
|
|
3289
|
-
if (
|
|
3287
|
+
c = le(s, d, 1);
|
|
3288
|
+
var x = le(s, d + 1, 3);
|
|
3289
|
+
if (d += 3, x)
|
|
3290
3290
|
if (x == 1)
|
|
3291
3291
|
g = fi, _ = gi, v = 9, f = 5;
|
|
3292
3292
|
else if (x == 2) {
|
|
3293
|
-
var T = le(s,
|
|
3294
|
-
|
|
3293
|
+
var T = le(s, d, 31) + 257, O = le(s, d + 10, 15) + 4, P = T + le(s, d + 5, 31) + 1;
|
|
3294
|
+
d += 14;
|
|
3295
3295
|
for (var L = new W(P), U = new W(19), j = 0; j < O; ++j)
|
|
3296
|
-
U[Kt[j]] = le(s,
|
|
3297
|
-
|
|
3296
|
+
U[Kt[j]] = le(s, d + j * 3, 7);
|
|
3297
|
+
d += O * 3;
|
|
3298
3298
|
for (var q = Ot(U), ie = (1 << q) - 1, V = pe(U, q, 1), j = 0; j < P; ) {
|
|
3299
|
-
var z = V[le(s,
|
|
3300
|
-
|
|
3299
|
+
var z = V[le(s, d, ie)];
|
|
3300
|
+
d += z & 15;
|
|
3301
3301
|
var m = z >> 4;
|
|
3302
3302
|
if (m < 16)
|
|
3303
3303
|
L[j++] = m;
|
|
3304
3304
|
else {
|
|
3305
3305
|
var H = 0, B = 0;
|
|
3306
|
-
for (m == 16 ? (B = 3 + le(s,
|
|
3306
|
+
for (m == 16 ? (B = 3 + le(s, d, 3), d += 2, H = L[j - 1]) : m == 17 ? (B = 3 + le(s, d, 7), d += 3) : m == 18 && (B = 11 + le(s, d, 127), d += 7); B--; )
|
|
3307
3307
|
L[j++] = H;
|
|
3308
3308
|
}
|
|
3309
3309
|
}
|
|
3310
|
-
var
|
|
3311
|
-
v = Ot(
|
|
3310
|
+
var J = L.subarray(0, T), X = L.subarray(T);
|
|
3311
|
+
v = Ot(J), f = Ot(X), g = pe(J, v, 1), _ = pe(X, f, 1);
|
|
3312
3312
|
} else
|
|
3313
3313
|
K(1);
|
|
3314
3314
|
else {
|
|
3315
|
-
var m = us(
|
|
3315
|
+
var m = us(d) + 4, E = s[m - 4] | s[m - 3] << 8, R = m + E;
|
|
3316
3316
|
if (R > i) {
|
|
3317
3317
|
l && K(0);
|
|
3318
3318
|
break;
|
|
3319
3319
|
}
|
|
3320
|
-
o &&
|
|
3320
|
+
o && h(u + E), t.set(s.subarray(m, R), u), e.b = u += E, e.p = d = R * 8, e.f = c;
|
|
3321
3321
|
continue;
|
|
3322
3322
|
}
|
|
3323
|
-
if (
|
|
3323
|
+
if (d > b) {
|
|
3324
3324
|
l && K(0);
|
|
3325
3325
|
break;
|
|
3326
3326
|
}
|
|
3327
3327
|
}
|
|
3328
|
-
o &&
|
|
3329
|
-
for (var
|
|
3330
|
-
var H = g[Vt(s,
|
|
3331
|
-
if (
|
|
3328
|
+
o && h(u + 131072);
|
|
3329
|
+
for (var je = (1 << v) - 1, ne = (1 << f) - 1, me = d; ; me = d) {
|
|
3330
|
+
var H = g[Vt(s, d) & je], te = H >> 4;
|
|
3331
|
+
if (d += H & 15, d > b) {
|
|
3332
3332
|
l && K(0);
|
|
3333
3333
|
break;
|
|
3334
3334
|
}
|
|
3335
3335
|
if (H || K(2), te < 256)
|
|
3336
3336
|
t[u++] = te;
|
|
3337
3337
|
else if (te == 256) {
|
|
3338
|
-
me =
|
|
3338
|
+
me = d, g = null;
|
|
3339
3339
|
break;
|
|
3340
3340
|
} else {
|
|
3341
3341
|
var se = te - 254;
|
|
3342
3342
|
if (te > 264) {
|
|
3343
|
-
var j = te - 257, Z =
|
|
3344
|
-
se = le(s,
|
|
3343
|
+
var j = te - 257, Z = Tt[j];
|
|
3344
|
+
se = le(s, d, (1 << Z) - 1) + ar[j], d += Z;
|
|
3345
3345
|
}
|
|
3346
|
-
var ce = _[Vt(s,
|
|
3347
|
-
ce || K(3),
|
|
3348
|
-
var
|
|
3346
|
+
var ce = _[Vt(s, d) & ne], Ie = ce >> 4;
|
|
3347
|
+
ce || K(3), d += ce & 15;
|
|
3348
|
+
var X = di[Ie];
|
|
3349
3349
|
if (Ie > 3) {
|
|
3350
|
-
var Z =
|
|
3351
|
-
|
|
3350
|
+
var Z = Lt[Ie];
|
|
3351
|
+
X += Vt(s, d) & (1 << Z) - 1, d += Z;
|
|
3352
3352
|
}
|
|
3353
|
-
if (
|
|
3353
|
+
if (d > b) {
|
|
3354
3354
|
l && K(0);
|
|
3355
3355
|
break;
|
|
3356
3356
|
}
|
|
3357
|
-
o &&
|
|
3357
|
+
o && h(u + 131072);
|
|
3358
3358
|
var $e = u + se;
|
|
3359
|
-
if (u <
|
|
3360
|
-
var
|
|
3361
|
-
for (
|
|
3362
|
-
t[u] = r[
|
|
3359
|
+
if (u < X) {
|
|
3360
|
+
var ct = n - X, ht = Math.min(X, $e);
|
|
3361
|
+
for (ct + u < 0 && K(3); u < ht; ++u)
|
|
3362
|
+
t[u] = r[ct + u];
|
|
3363
3363
|
}
|
|
3364
3364
|
for (; u < $e; ++u)
|
|
3365
|
-
t[u] = t[u -
|
|
3365
|
+
t[u] = t[u - X];
|
|
3366
3366
|
}
|
|
3367
3367
|
}
|
|
3368
3368
|
e.l = g, e.p = me, e.b = u, e.f = c, g && (c = 1, e.m = v, e.d = _, e.n = f);
|
|
3369
3369
|
} while (!c);
|
|
3370
|
-
return u != t.length && a ?
|
|
3370
|
+
return u != t.length && a ? lt(t, 0, u) : t.subarray(0, u);
|
|
3371
3371
|
}, ye = function(s, e, t) {
|
|
3372
3372
|
t <<= e & 7;
|
|
3373
3373
|
var r = e / 8 | 0;
|
|
3374
3374
|
s[r] |= t, s[r + 1] |= t >> 8;
|
|
3375
|
-
},
|
|
3375
|
+
}, He = function(s, e, t) {
|
|
3376
3376
|
t <<= e & 7;
|
|
3377
3377
|
var r = e / 8 | 0;
|
|
3378
3378
|
s[r] |= t, s[r + 1] |= t >> 8, s[r + 2] |= t >> 16;
|
|
@@ -3389,9 +3389,9 @@ var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /
|
|
|
3389
3389
|
t.sort(function(R, T) {
|
|
3390
3390
|
return R.f - T.f;
|
|
3391
3391
|
}), t.push({ s: -1, f: 25001 });
|
|
3392
|
-
var o = t[0], l = t[1],
|
|
3392
|
+
var o = t[0], l = t[1], h = 0, c = 1, d = 2;
|
|
3393
3393
|
for (t[0] = { s: -1, f: o.f + l.f, l: o, r: l }; c != i - 1; )
|
|
3394
|
-
o = t[t[
|
|
3394
|
+
o = t[t[h].f < t[d].f ? h++ : d++], l = t[h != c && t[h].f < t[d].f ? h++ : d++], t[c++] = { s: -1, f: o.f + l.f, l: o, r: l };
|
|
3395
3395
|
for (var u = n[0].s, r = 1; r < i; ++r)
|
|
3396
3396
|
n[r].s > u && (u = n[r].s);
|
|
3397
3397
|
var g = new re(u + 1), _ = ts(t[c - 1], g, 0);
|
|
@@ -3442,7 +3442,7 @@ var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /
|
|
|
3442
3442
|
n = 1, i = s[o];
|
|
3443
3443
|
}
|
|
3444
3444
|
return { c: t.subarray(0, r), n: e };
|
|
3445
|
-
},
|
|
3445
|
+
}, De = function(s, e) {
|
|
3446
3446
|
for (var t = 0, r = 0; r < e.length; ++r)
|
|
3447
3447
|
t += s[r] * e[r];
|
|
3448
3448
|
return t;
|
|
@@ -3452,21 +3452,21 @@ var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /
|
|
|
3452
3452
|
for (var n = 0; n < r; ++n)
|
|
3453
3453
|
s[i + n + 4] = t[n];
|
|
3454
3454
|
return (i + 4 + r) * 8;
|
|
3455
|
-
}, $s = function(s, e, t, r, i, n, a, o, l,
|
|
3455
|
+
}, $s = function(s, e, t, r, i, n, a, o, l, h, c) {
|
|
3456
3456
|
ye(e, c++, t), ++i[256];
|
|
3457
|
-
for (var
|
|
3457
|
+
for (var d = Ft(i, 15), u = d.t, g = d.l, _ = Ft(n, 15), v = _.t, f = _.l, b = Is(u), x = b.c, m = b.n, E = Is(v), R = E.c, T = E.n, O = new re(19), P = 0; P < x.length; ++P)
|
|
3458
3458
|
++O[x[P] & 31];
|
|
3459
3459
|
for (var P = 0; P < R.length; ++P)
|
|
3460
3460
|
++O[R[P] & 31];
|
|
3461
3461
|
for (var L = Ft(O, 7), U = L.t, j = L.l, q = 19; q > 4 && !U[Kt[q - 1]]; --q)
|
|
3462
3462
|
;
|
|
3463
|
-
var ie =
|
|
3463
|
+
var ie = h + 5 << 3, V = De(i, Ae) + De(n, it) + a, z = De(i, u) + De(n, v) + a + 14 + 3 * q + De(O, U) + 2 * O[16] + 3 * O[17] + 7 * O[18];
|
|
3464
3464
|
if (l >= 0 && ie <= V && ie <= z)
|
|
3465
|
-
return lr(e, c, s.subarray(l, l +
|
|
3466
|
-
var H, B,
|
|
3465
|
+
return lr(e, c, s.subarray(l, l + h));
|
|
3466
|
+
var H, B, J, X;
|
|
3467
3467
|
if (ye(e, c, 1 + (z < V)), c += 2, z < V) {
|
|
3468
|
-
H = pe(u, g, 0), B = u,
|
|
3469
|
-
var
|
|
3468
|
+
H = pe(u, g, 0), B = u, J = pe(v, f, 0), X = v;
|
|
3469
|
+
var je = pe(U, j, 0);
|
|
3470
3470
|
ye(e, c, m - 257), ye(e, c + 5, T - 1), ye(e, c + 10, q - 4), c += 14;
|
|
3471
3471
|
for (var P = 0; P < q; ++P)
|
|
3472
3472
|
ye(e, c + 3 * P, U[Kt[P]]);
|
|
@@ -3474,74 +3474,74 @@ var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /
|
|
|
3474
3474
|
for (var ne = [x, R], me = 0; me < 2; ++me)
|
|
3475
3475
|
for (var te = ne[me], P = 0; P < te.length; ++P) {
|
|
3476
3476
|
var se = te[P] & 31;
|
|
3477
|
-
ye(e, c,
|
|
3477
|
+
ye(e, c, je[se]), c += U[se], se > 15 && (ye(e, c, te[P] >> 5 & 127), c += te[P] >> 12);
|
|
3478
3478
|
}
|
|
3479
3479
|
} else
|
|
3480
|
-
H = ui, B = Ae,
|
|
3480
|
+
H = ui, B = Ae, J = pi, X = it;
|
|
3481
3481
|
for (var P = 0; P < o; ++P) {
|
|
3482
3482
|
var Z = r[P];
|
|
3483
3483
|
if (Z > 255) {
|
|
3484
3484
|
var se = Z >> 18 & 31;
|
|
3485
|
-
|
|
3485
|
+
He(e, c, H[se + 257]), c += B[se + 257], se > 7 && (ye(e, c, Z >> 23 & 31), c += Tt[se]);
|
|
3486
3486
|
var ce = Z & 31;
|
|
3487
|
-
|
|
3487
|
+
He(e, c, J[ce]), c += X[ce], ce > 3 && (He(e, c, Z >> 5 & 8191), c += Lt[ce]);
|
|
3488
3488
|
} else
|
|
3489
|
-
|
|
3489
|
+
He(e, c, H[Z]), c += B[Z];
|
|
3490
3490
|
}
|
|
3491
|
-
return
|
|
3492
|
-
}, vi = /* @__PURE__ */ new
|
|
3493
|
-
var a = n.z || s.length, o = new W(r + a + 5 * (1 + Math.ceil(a / 7e3)) + i), l = o.subarray(r, o.length - i),
|
|
3491
|
+
return He(e, c, H[256]), c + B[256];
|
|
3492
|
+
}, vi = /* @__PURE__ */ new ds([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]), cr = /* @__PURE__ */ new W(0), bi = function(s, e, t, r, i, n) {
|
|
3493
|
+
var a = n.z || s.length, o = new W(r + a + 5 * (1 + Math.ceil(a / 7e3)) + i), l = o.subarray(r, o.length - i), h = n.l, c = (n.r || 0) & 7;
|
|
3494
3494
|
if (e) {
|
|
3495
3495
|
c && (l[0] = n.r >> 3);
|
|
3496
|
-
for (var
|
|
3497
|
-
return (s[
|
|
3498
|
-
}, E = new
|
|
3496
|
+
for (var d = vi[e - 1], u = d >> 13, g = d & 8191, _ = (1 << t) - 1, v = n.p || new re(32768), f = n.h || new re(_ + 1), b = Math.ceil(t / 3), x = 2 * b, m = function(Nt) {
|
|
3497
|
+
return (s[Nt] ^ s[Nt + 1] << b ^ s[Nt + 2] << x) & _;
|
|
3498
|
+
}, E = new ds(25e3), R = new re(288), T = new re(32), O = 0, P = 0, L = n.i || 0, U = 0, j = n.w || 0, q = 0; L + 2 < a; ++L) {
|
|
3499
3499
|
var ie = m(L), V = L & 32767, z = f[ie];
|
|
3500
3500
|
if (v[V] = z, f[ie] = V, j <= L) {
|
|
3501
3501
|
var H = a - L;
|
|
3502
|
-
if ((O > 7e3 || U > 24576) && (H > 423 || !
|
|
3502
|
+
if ((O > 7e3 || U > 24576) && (H > 423 || !h)) {
|
|
3503
3503
|
c = $s(s, l, 0, E, R, T, P, U, q, L - q, c), U = O = P = 0, q = L;
|
|
3504
3504
|
for (var B = 0; B < 286; ++B)
|
|
3505
3505
|
R[B] = 0;
|
|
3506
3506
|
for (var B = 0; B < 30; ++B)
|
|
3507
3507
|
T[B] = 0;
|
|
3508
3508
|
}
|
|
3509
|
-
var
|
|
3509
|
+
var J = 2, X = 0, je = g, ne = V - z & 32767;
|
|
3510
3510
|
if (H > 2 && ie == m(L - ne))
|
|
3511
|
-
for (var me = Math.min(u, H) - 1, te = Math.min(32767, L), se = Math.min(258, H); ne <= te && --
|
|
3512
|
-
if (s[L +
|
|
3511
|
+
for (var me = Math.min(u, H) - 1, te = Math.min(32767, L), se = Math.min(258, H); ne <= te && --je && V != z; ) {
|
|
3512
|
+
if (s[L + J] == s[L + J - ne]) {
|
|
3513
3513
|
for (var Z = 0; Z < se && s[L + Z] == s[L + Z - ne]; ++Z)
|
|
3514
3514
|
;
|
|
3515
|
-
if (Z >
|
|
3516
|
-
if (
|
|
3515
|
+
if (Z > J) {
|
|
3516
|
+
if (J = Z, X = ne, Z > me)
|
|
3517
3517
|
break;
|
|
3518
3518
|
for (var ce = Math.min(ne, Z - 2), Ie = 0, B = 0; B < ce; ++B) {
|
|
3519
|
-
var $e = L - ne + B & 32767,
|
|
3519
|
+
var $e = L - ne + B & 32767, ct = v[$e], ht = $e - ct & 32767;
|
|
3520
3520
|
ht > Ie && (Ie = ht, z = $e);
|
|
3521
3521
|
}
|
|
3522
3522
|
}
|
|
3523
3523
|
}
|
|
3524
3524
|
V = z, z = v[V], ne += V - z & 32767;
|
|
3525
3525
|
}
|
|
3526
|
-
if (
|
|
3527
|
-
E[U++] = 268435456 | Qt[
|
|
3528
|
-
var
|
|
3529
|
-
P +=
|
|
3526
|
+
if (X) {
|
|
3527
|
+
E[U++] = 268435456 | Qt[J] << 18 | Ns[X];
|
|
3528
|
+
var Ze = Qt[J] & 31, Ue = Ns[X] & 31;
|
|
3529
|
+
P += Tt[Ze] + Lt[Ue], ++R[257 + Ze], ++T[Ue], j = L + J, ++O;
|
|
3530
3530
|
} else
|
|
3531
3531
|
E[U++] = s[L], ++R[s[L]];
|
|
3532
3532
|
}
|
|
3533
3533
|
}
|
|
3534
3534
|
for (L = Math.max(L, j); L < a; ++L)
|
|
3535
3535
|
E[U++] = s[L], ++R[s[L]];
|
|
3536
|
-
c = $s(s, l,
|
|
3536
|
+
c = $s(s, l, h, E, R, T, P, U, q, L - q, c), h || (n.r = c & 7 | l[c / 8 | 0] << 3, c -= 7, n.h = f, n.p = v, n.i = L, n.w = j);
|
|
3537
3537
|
} else {
|
|
3538
|
-
for (var L = n.w || 0; L < a +
|
|
3538
|
+
for (var L = n.w || 0; L < a + h; L += 65535) {
|
|
3539
3539
|
var Re = L + 65535;
|
|
3540
|
-
Re >= a && (l[c / 8 | 0] =
|
|
3540
|
+
Re >= a && (l[c / 8 | 0] = h, Re = a), c = lr(l, c + 1, s.subarray(L, Re));
|
|
3541
3541
|
}
|
|
3542
3542
|
n.i = a;
|
|
3543
3543
|
}
|
|
3544
|
-
return
|
|
3544
|
+
return lt(o, 0, r + us(c) + i);
|
|
3545
3545
|
}, ki = /* @__PURE__ */ (function() {
|
|
3546
3546
|
for (var s = new Int32Array(256), e = 0; e < 256; ++e) {
|
|
3547
3547
|
for (var t = e, r = 9; --r; )
|
|
@@ -3567,20 +3567,20 @@ var ui = /* @__PURE__ */ pe(Ae, 9, 0), fi = /* @__PURE__ */ pe(Ae, 9, 1), pi = /
|
|
|
3567
3567
|
a.set(n), a.set(s, n.length), s = a, i.w = n.length;
|
|
3568
3568
|
}
|
|
3569
3569
|
return bi(s, e.level == null ? 6 : e.level, e.mem == null ? i.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(s.length))) * 1.5) : 20 : 12 + e.mem, t, r, i);
|
|
3570
|
-
},
|
|
3570
|
+
}, hr = function(s, e) {
|
|
3571
3571
|
var t = {};
|
|
3572
3572
|
for (var r in s)
|
|
3573
3573
|
t[r] = s[r];
|
|
3574
3574
|
for (var r in e)
|
|
3575
3575
|
t[r] = e[r];
|
|
3576
3576
|
return t;
|
|
3577
|
-
},
|
|
3577
|
+
}, he = function(s, e) {
|
|
3578
3578
|
return s[e] | s[e + 1] << 8;
|
|
3579
3579
|
}, ae = function(s, e) {
|
|
3580
3580
|
return (s[e] | s[e + 1] << 8 | s[e + 2] << 16 | s[e + 3] << 24) >>> 0;
|
|
3581
3581
|
}, Bt = function(s, e) {
|
|
3582
3582
|
return ae(s, e) + ae(s, e + 4) * 4294967296;
|
|
3583
|
-
},
|
|
3583
|
+
}, G = function(s, e, t) {
|
|
3584
3584
|
for (; t; ++e)
|
|
3585
3585
|
s[e] = t, t >>>= 8;
|
|
3586
3586
|
};
|
|
@@ -3590,10 +3590,10 @@ function _i(s, e) {
|
|
|
3590
3590
|
function Si(s, e) {
|
|
3591
3591
|
return yi(s, { i: 2 }, e && e.out, e && e.dictionary);
|
|
3592
3592
|
}
|
|
3593
|
-
var
|
|
3593
|
+
var dr = function(s, e, t, r) {
|
|
3594
3594
|
for (var i in s) {
|
|
3595
3595
|
var n = s[i], a = e + i, o = r;
|
|
3596
|
-
Array.isArray(n) && (o =
|
|
3596
|
+
Array.isArray(n) && (o = hr(r, n[1]), n = n[0]), ArrayBuffer.isView(n) ? t[a] = [n, o] : (t[a += "/"] = [new W(0), o], dr(n, a, t, r));
|
|
3597
3597
|
}
|
|
3598
3598
|
}, Rs = typeof TextEncoder < "u" && /* @__PURE__ */ new TextEncoder(), ss = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Ci = 0;
|
|
3599
3599
|
try {
|
|
@@ -3604,7 +3604,7 @@ var Ai = function(s) {
|
|
|
3604
3604
|
for (var e = "", t = 0; ; ) {
|
|
3605
3605
|
var r = s[t++], i = (r > 127) + (r > 223) + (r > 239);
|
|
3606
3606
|
if (t + i > s.length)
|
|
3607
|
-
return { s: e, r:
|
|
3607
|
+
return { s: e, r: lt(s, t - 1) };
|
|
3608
3608
|
i ? i == 3 ? (r = ((r & 15) << 18 | (s[t++] & 63) << 12 | (s[t++] & 63) << 6 | s[t++] & 63) - 65536, e += String.fromCharCode(55296 | r >> 10, 56320 | r & 1023)) : i & 1 ? e += String.fromCharCode((r & 31) << 6 | s[t++] & 63) : e += String.fromCharCode((r & 15) << 12 | (s[t++] & 63) << 6 | s[t++] & 63) : e += String.fromCharCode(r);
|
|
3609
3609
|
}
|
|
3610
3610
|
};
|
|
@@ -3612,8 +3612,8 @@ function rs(s, e) {
|
|
|
3612
3612
|
var t;
|
|
3613
3613
|
if (Rs)
|
|
3614
3614
|
return Rs.encode(s);
|
|
3615
|
-
for (var r = s.length, i = new W(s.length + (s.length >> 1)), n = 0, a = function(
|
|
3616
|
-
i[n++] =
|
|
3615
|
+
for (var r = s.length, i = new W(s.length + (s.length >> 1)), n = 0, a = function(h) {
|
|
3616
|
+
i[n++] = h;
|
|
3617
3617
|
}, t = 0; t < r; ++t) {
|
|
3618
3618
|
if (n + 5 > i.length) {
|
|
3619
3619
|
var o = new W(n + 8 + (r - t << 1));
|
|
@@ -3622,7 +3622,7 @@ function rs(s, e) {
|
|
|
3622
3622
|
var l = s.charCodeAt(t);
|
|
3623
3623
|
l < 128 || e ? a(l) : l < 2048 ? (a(192 | l >> 6), a(128 | l & 63)) : l > 55295 && l < 57344 ? (l = 65536 + (l & 1047552) | s.charCodeAt(++t) & 1023, a(240 | l >> 18), a(128 | l >> 12 & 63), a(128 | l >> 6 & 63), a(128 | l & 63)) : (a(224 | l >> 12), a(128 | l >> 6 & 63), a(128 | l & 63));
|
|
3624
3624
|
}
|
|
3625
|
-
return
|
|
3625
|
+
return lt(i, 0, n);
|
|
3626
3626
|
}
|
|
3627
3627
|
function ur(s, e) {
|
|
3628
3628
|
if (e) {
|
|
@@ -3637,19 +3637,19 @@ function ur(s, e) {
|
|
|
3637
3637
|
}
|
|
3638
3638
|
}
|
|
3639
3639
|
var Ei = function(s, e) {
|
|
3640
|
-
return e + 30 +
|
|
3640
|
+
return e + 30 + he(s, e + 26) + he(s, e + 28);
|
|
3641
3641
|
}, Ti = function(s, e, t) {
|
|
3642
|
-
var r =
|
|
3643
|
-
return [
|
|
3642
|
+
var r = he(s, e + 28), i = he(s, e + 30), n = ur(s.subarray(e + 46, e + 46 + r), !(he(s, e + 8) & 2048)), a = e + 46 + r, o = Li(s, a, i, t, ae(s, e + 20), ae(s, e + 24), ae(s, e + 42)), l = o[0], h = o[1], c = o[2];
|
|
3643
|
+
return [he(s, e + 10), l, h, n, a + i + he(s, e + 32), c];
|
|
3644
3644
|
}, Li = function(s, e, t, r, i, n, a) {
|
|
3645
|
-
var o = i == 4294967295, l = n == 4294967295,
|
|
3646
|
-
if (r &&
|
|
3647
|
-
for (; e + 4 < c; e += 4 +
|
|
3648
|
-
if (
|
|
3645
|
+
var o = i == 4294967295, l = n == 4294967295, h = a == 4294967295, c = e + t, d = o + l + h;
|
|
3646
|
+
if (r && d) {
|
|
3647
|
+
for (; e + 4 < c; e += 4 + he(s, e + 2))
|
|
3648
|
+
if (he(s, e) == 1)
|
|
3649
3649
|
return [
|
|
3650
3650
|
o ? Bt(s, e + 4 + 8 * l) : i,
|
|
3651
3651
|
l ? Bt(s, e + 4) : n,
|
|
3652
|
-
|
|
3652
|
+
h ? Bt(s, e + 4 + 8 * (l + o)) : a,
|
|
3653
3653
|
1
|
|
3654
3654
|
];
|
|
3655
3655
|
r < 2 && K(13);
|
|
@@ -3664,32 +3664,32 @@ var Ei = function(s, e) {
|
|
|
3664
3664
|
}
|
|
3665
3665
|
return e;
|
|
3666
3666
|
}, Os = function(s, e, t, r, i, n, a, o) {
|
|
3667
|
-
var l = r.length,
|
|
3668
|
-
|
|
3667
|
+
var l = r.length, h = t.extra, c = o && o.length, d = is(h);
|
|
3668
|
+
G(s, e, a != null ? 33639248 : 67324752), e += 4, a != null && (s[e++] = 20, s[e++] = t.os), s[e] = 20, e += 2, s[e++] = t.flag << 1 | (n < 0 && 8), s[e++] = i && 8, s[e++] = t.compression & 255, s[e++] = t.compression >> 8;
|
|
3669
3669
|
var u = new Date(t.mtime == null ? Date.now() : t.mtime), g = u.getFullYear() - 1980;
|
|
3670
|
-
if ((g < 0 || g > 119) && K(10),
|
|
3671
|
-
for (var _ in
|
|
3672
|
-
var v =
|
|
3673
|
-
|
|
3670
|
+
if ((g < 0 || g > 119) && K(10), G(s, e, g << 25 | u.getMonth() + 1 << 21 | u.getDate() << 16 | u.getHours() << 11 | u.getMinutes() << 5 | u.getSeconds() >> 1), e += 4, n != -1 && (G(s, e, t.crc), G(s, e + 4, n < 0 ? -n - 2 : n), G(s, e + 8, t.size)), G(s, e + 12, l), G(s, e + 14, d), e += 16, a != null && (G(s, e, c), G(s, e + 6, t.attrs), G(s, e + 10, a), e += 14), s.set(r, e), e += l, d)
|
|
3671
|
+
for (var _ in h) {
|
|
3672
|
+
var v = h[_], f = v.length;
|
|
3673
|
+
G(s, e, +_), G(s, e + 2, f), s.set(v, e + 4), e += 4 + f;
|
|
3674
3674
|
}
|
|
3675
3675
|
return c && (s.set(o, e), e += c), e;
|
|
3676
3676
|
}, Mi = function(s, e, t, r, i) {
|
|
3677
|
-
|
|
3677
|
+
G(s, e, 101010256), G(s, e + 8, t), G(s, e + 10, t), G(s, e + 12, r), G(s, e + 16, i);
|
|
3678
3678
|
};
|
|
3679
3679
|
function Pi(s, e) {
|
|
3680
3680
|
e || (e = {});
|
|
3681
3681
|
var t = {}, r = [];
|
|
3682
|
-
|
|
3682
|
+
dr(s, "", t, e);
|
|
3683
3683
|
var i = 0, n = 0;
|
|
3684
3684
|
for (var a in t) {
|
|
3685
|
-
var o = t[a], l = o[0],
|
|
3685
|
+
var o = t[a], l = o[0], h = o[1], c = h.level == 0 ? 0 : 8, d = rs(a), u = d.length, g = h.comment, _ = g && rs(g), v = _ && _.length, f = is(h.extra);
|
|
3686
3686
|
u > 65535 && K(11);
|
|
3687
|
-
var b = c ? _i(l,
|
|
3688
|
-
m.p(l), r.push(
|
|
3687
|
+
var b = c ? _i(l, h) : l, x = b.length, m = wi();
|
|
3688
|
+
m.p(l), r.push(hr(h, {
|
|
3689
3689
|
size: l.length,
|
|
3690
3690
|
crc: m.d(),
|
|
3691
3691
|
c: b,
|
|
3692
|
-
f:
|
|
3692
|
+
f: d,
|
|
3693
3693
|
m: _,
|
|
3694
3694
|
u: u != a.length || _ && g.length != v,
|
|
3695
3695
|
o: i,
|
|
@@ -3697,17 +3697,17 @@ function Pi(s, e) {
|
|
|
3697
3697
|
})), i += 30 + u + f + x, n += 76 + 2 * (u + f) + (v || 0) + x;
|
|
3698
3698
|
}
|
|
3699
3699
|
for (var E = new W(n + 22), R = i, T = n - i, O = 0; O < r.length; ++O) {
|
|
3700
|
-
var
|
|
3701
|
-
Os(E,
|
|
3702
|
-
var P = 30 +
|
|
3703
|
-
E.set(
|
|
3700
|
+
var d = r[O];
|
|
3701
|
+
Os(E, d.o, d, d.f, d.u, d.c.length);
|
|
3702
|
+
var P = 30 + d.f.length + is(d.extra);
|
|
3703
|
+
E.set(d.c, d.o + P), Os(E, i, d, d.f, d.u, d.c.length, d.o, d.m), i += 16 + P + (d.m ? d.m.length : 0);
|
|
3704
3704
|
}
|
|
3705
3705
|
return Mi(E, i, r.length, T, R), E;
|
|
3706
3706
|
}
|
|
3707
3707
|
function Ni(s, e) {
|
|
3708
3708
|
for (var t = {}, r = s.length - 22; ae(s, r) != 101010256; --r)
|
|
3709
3709
|
(!r || s.length - r > 65558) && K(13);
|
|
3710
|
-
var i =
|
|
3710
|
+
var i = he(s, r + 8);
|
|
3711
3711
|
if (!i)
|
|
3712
3712
|
return {};
|
|
3713
3713
|
var n = ae(s, r + 16), a = ae(s, r - 20) == 117853008;
|
|
@@ -3716,8 +3716,8 @@ function Ni(s, e) {
|
|
|
3716
3716
|
a = ae(s, o) == 101075792, a && (i = ae(s, o + 32), n = ae(s, o + 48));
|
|
3717
3717
|
}
|
|
3718
3718
|
for (var l = 0; l < i; ++l) {
|
|
3719
|
-
var
|
|
3720
|
-
n = _, c ? c == 8 ? t[g] = Si(s.subarray(f, f +
|
|
3719
|
+
var h = Ti(s, n, a), c = h[0], d = h[1], u = h[2], g = h[3], _ = h[4], v = h[5], f = Ei(s, v);
|
|
3720
|
+
n = _, c ? c == 8 ? t[g] = Si(s.subarray(f, f + d), { out: new W(u) }) : K(14, "unknown compression type " + c) : t[g] = lt(s, f, f + d);
|
|
3721
3721
|
}
|
|
3722
3722
|
return t;
|
|
3723
3723
|
}
|
|
@@ -3738,12 +3738,12 @@ function ue(s) {
|
|
|
3738
3738
|
return s.replace(/\\/g, "/").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
3739
3739
|
}
|
|
3740
3740
|
function Je(s, e) {
|
|
3741
|
-
const t =
|
|
3741
|
+
const t = Mt(s, e);
|
|
3742
3742
|
if (!t)
|
|
3743
3743
|
throw new Error(`Missing zip entry: ${e}`);
|
|
3744
3744
|
return ur(t);
|
|
3745
3745
|
}
|
|
3746
|
-
function
|
|
3746
|
+
function Mt(s, e) {
|
|
3747
3747
|
const t = ue(e);
|
|
3748
3748
|
if (s.has(t)) return s.get(t);
|
|
3749
3749
|
const r = t.toLowerCase();
|
|
@@ -3815,19 +3815,19 @@ function aa(s) {
|
|
|
3815
3815
|
return pr(ps(s));
|
|
3816
3816
|
}
|
|
3817
3817
|
function pr(s) {
|
|
3818
|
-
const e = Je(s, "META-INF/container.xml"), t =
|
|
3818
|
+
const e = Je(s, "META-INF/container.xml"), t = de(e, /full-path\s*=\s*"([^"]+)"/i);
|
|
3819
3819
|
if (!t)
|
|
3820
3820
|
throw new Error("Invalid EPUB: missing rootfile in container.xml");
|
|
3821
|
-
const r = ue(t), i = r.includes("/") ? r.replace(/\/[^/]+$/, "/") : "", n = Je(s, r), a = Bs(n, "dc:title") || Bs(n, "title") || "EPUB Story", o = Bi(n) ?? { width: 768, height: 1024 }, l = Vi(n, i),
|
|
3821
|
+
const r = ue(t), i = r.includes("/") ? r.replace(/\/[^/]+$/, "/") : "", n = Je(s, r), a = Bs(n, "dc:title") || Bs(n, "title") || "EPUB Story", o = Bi(n) ?? { width: 768, height: 1024 }, l = Vi(n, i), h = Fi(n), c = [], d = /* @__PURE__ */ new Map(), u = (f) => {
|
|
3822
3822
|
const b = ue(f);
|
|
3823
|
-
if (
|
|
3824
|
-
const x =
|
|
3823
|
+
if (d.has(b)) return d.get(b);
|
|
3824
|
+
const x = Mt(s, b);
|
|
3825
3825
|
if (!x)
|
|
3826
3826
|
throw new Error(`EPUB missing file: ${b}`);
|
|
3827
3827
|
const m = fr(x, b);
|
|
3828
|
-
return c.push(m),
|
|
3828
|
+
return c.push(m), d.set(b, m), m;
|
|
3829
3829
|
}, g = {}, _ = [];
|
|
3830
|
-
if (
|
|
3830
|
+
if (h.forEach((f, b) => {
|
|
3831
3831
|
const x = l.get(f);
|
|
3832
3832
|
if (!x || !/html|xml/i.test(x.mediaType) && !x.href.match(/\.x?html?$/i)) return;
|
|
3833
3833
|
const m = x.href, E = Je(s, m), R = m.includes("/") ? m.replace(/\/[^/]+$/, "/") : "", T = `page-${b + 1}`, O = ji(E), { html: P, imageHrefs: L } = Zi(O, R, (V) => {
|
|
@@ -3861,8 +3861,8 @@ function pr(s) {
|
|
|
3861
3861
|
z.audioHref.includes("/") || z.audioHref.startsWith(".") ? gr(V.href, z.audioHref) : `${i}${z.audioHref}`
|
|
3862
3862
|
);
|
|
3863
3863
|
g[H] = { type: "audio", src: u(B), channel: "vo" };
|
|
3864
|
-
const
|
|
3865
|
-
|
|
3864
|
+
const J = z.cues;
|
|
3865
|
+
J.length ? ie = { audio: H, cues: J } : ie = { audio: H };
|
|
3866
3866
|
}
|
|
3867
3867
|
}
|
|
3868
3868
|
}
|
|
@@ -3874,7 +3874,7 @@ function pr(s) {
|
|
|
3874
3874
|
});
|
|
3875
3875
|
}), _.length === 0)
|
|
3876
3876
|
throw new Error("Invalid EPUB: no spine HTML documents found");
|
|
3877
|
-
return { story:
|
|
3877
|
+
return { story: ot({
|
|
3878
3878
|
id: `epub-${Ui(a)}`,
|
|
3879
3879
|
title: a,
|
|
3880
3880
|
pageSize: o,
|
|
@@ -3884,18 +3884,18 @@ function pr(s) {
|
|
|
3884
3884
|
}), blobUrls: c };
|
|
3885
3885
|
}
|
|
3886
3886
|
function Oi(s) {
|
|
3887
|
-
return !!
|
|
3887
|
+
return !!Mt(s, "META-INF/container.xml");
|
|
3888
3888
|
}
|
|
3889
3889
|
function Vi(s, e) {
|
|
3890
3890
|
const t = /* @__PURE__ */ new Map(), r = /<item\b[^>]*>/gi;
|
|
3891
3891
|
let i;
|
|
3892
3892
|
for (; i = r.exec(s); ) {
|
|
3893
|
-
const n = i[0], a =
|
|
3893
|
+
const n = i[0], a = de(n, /\bid\s*=\s*"([^"]+)"/i), o = de(n, /\bhref\s*=\s*"([^"]+)"/i), l = de(n, /\bmedia-type\s*=\s*"([^"]+)"/i) ?? "", h = de(n, /\bmedia-overlay\s*=\s*"([^"]+)"/i) ?? void 0, c = de(n, /\bproperties\s*=\s*"([^"]+)"/i) ?? void 0;
|
|
3894
3894
|
!a || !o || t.set(a, {
|
|
3895
3895
|
id: a,
|
|
3896
3896
|
href: ue(`${e}${o}`),
|
|
3897
3897
|
mediaType: l,
|
|
3898
|
-
mediaOverlay:
|
|
3898
|
+
mediaOverlay: h,
|
|
3899
3899
|
properties: c
|
|
3900
3900
|
});
|
|
3901
3901
|
}
|
|
@@ -3921,16 +3921,16 @@ function Bi(s) {
|
|
|
3921
3921
|
function zi(s, e) {
|
|
3922
3922
|
const t = [];
|
|
3923
3923
|
let r;
|
|
3924
|
-
const i =
|
|
3924
|
+
const i = de(s, /<audio\b[^>]*\bsrc\s*=\s*"([^"]+)"/i);
|
|
3925
3925
|
i && (r = gr(e, i));
|
|
3926
3926
|
const n = /<par\b[^>]*>([\s\S]*?)<\/par>/gi;
|
|
3927
3927
|
let a, o = 0;
|
|
3928
3928
|
for (; a = n.exec(s); ) {
|
|
3929
|
-
const l = a[1],
|
|
3930
|
-
c == null ||
|
|
3929
|
+
const l = a[1], h = de(l, /<text\b[^>]*\bsrc\s*=\s*"([^"]+)"/i), c = de(l, /\bclipBegin\s*=\s*"([^"]+)"/i), d = de(l, /\bclipEnd\s*=\s*"([^"]+)"/i), u = h != null && h.includes("#") ? h.split("#")[1] : `cue-${o}`;
|
|
3930
|
+
c == null || d == null || (t.push({
|
|
3931
3931
|
id: u || `cue-${o}`,
|
|
3932
3932
|
start: Fs(c),
|
|
3933
|
-
end: Fs(
|
|
3933
|
+
end: Fs(d)
|
|
3934
3934
|
}), o += 1);
|
|
3935
3935
|
}
|
|
3936
3936
|
return { audioHref: r, cues: t };
|
|
@@ -3953,8 +3953,8 @@ function Zi(s, e, t) {
|
|
|
3953
3953
|
if (/^(?:[a-z]+:|#|data:)/i.test(o)) return n;
|
|
3954
3954
|
const l = ue(`${e}${o}`);
|
|
3955
3955
|
/\.(png|jpe?g|gif|webp|svg)$/i.test(o) && r.push(l);
|
|
3956
|
-
const
|
|
3957
|
-
return `${a}="${
|
|
3956
|
+
const h = t(o);
|
|
3957
|
+
return `${a}="${h}"`;
|
|
3958
3958
|
}
|
|
3959
3959
|
), imageHrefs: r };
|
|
3960
3960
|
}
|
|
@@ -3965,7 +3965,7 @@ function gr(s, e) {
|
|
|
3965
3965
|
!n || n === "." || (n === ".." ? i.pop() : i.push(n));
|
|
3966
3966
|
return i.join("/");
|
|
3967
3967
|
}
|
|
3968
|
-
function
|
|
3968
|
+
function de(s, e) {
|
|
3969
3969
|
const t = s.match(e);
|
|
3970
3970
|
return t ? t[1] : null;
|
|
3971
3971
|
}
|
|
@@ -3984,7 +3984,7 @@ function mr(s) {
|
|
|
3984
3984
|
throw new Error("Invalid .fanci package: missing story.json");
|
|
3985
3985
|
}
|
|
3986
3986
|
function yr(s) {
|
|
3987
|
-
const e = mr(s), t = e.includes("/") ? e.replace(/\/[^/]+$/, "/") : "", r =
|
|
3987
|
+
const e = mr(s), t = e.includes("/") ? e.replace(/\/[^/]+$/, "/") : "", r = ot(JSON.parse(Je(s, e))), i = /* @__PURE__ */ new Map(), n = [];
|
|
3988
3988
|
for (const [a, o] of s) {
|
|
3989
3989
|
if (a === e) continue;
|
|
3990
3990
|
const l = fr(o, a);
|
|
@@ -4022,7 +4022,7 @@ function Di(s, e) {
|
|
|
4022
4022
|
}
|
|
4023
4023
|
}
|
|
4024
4024
|
function Wi(s) {
|
|
4025
|
-
if (
|
|
4025
|
+
if (Mt(s, "META-INF/container.xml")) return !1;
|
|
4026
4026
|
try {
|
|
4027
4027
|
return mr(s), !0;
|
|
4028
4028
|
} catch {
|
|
@@ -4046,11 +4046,11 @@ async function Yi(s) {
|
|
|
4046
4046
|
async function ns(s, e) {
|
|
4047
4047
|
const t = typeof e == "string" ? { baseUrl: e } : e ?? {}, r = t.onProgress ?? (() => {
|
|
4048
4048
|
});
|
|
4049
|
-
if (
|
|
4049
|
+
if (Xi(s)) {
|
|
4050
4050
|
r({ stage: "parse", progress: 0.1, detail: "story object" });
|
|
4051
|
-
const i =
|
|
4052
|
-
r({ stage: "assets", progress: 0.2, detail: "fonts" }), await
|
|
4053
|
-
const a = await
|
|
4051
|
+
const i = ot(s), n = t.baseUrl ?? (typeof location < "u" ? location.href : "");
|
|
4052
|
+
r({ stage: "assets", progress: 0.2, detail: "fonts" }), await Ke(i, n);
|
|
4053
|
+
const a = await Qe(i, n, r, 0.25, 1);
|
|
4054
4054
|
return r({ stage: "complete", progress: 1 }), { story: i, baseUrl: n, assets: a, blobUrls: [], kind: "object" };
|
|
4055
4055
|
}
|
|
4056
4056
|
if (typeof s == "object" && s !== null && "story" in s && !zs(s)) {
|
|
@@ -4062,7 +4062,7 @@ async function ns(s, e) {
|
|
|
4062
4062
|
});
|
|
4063
4063
|
}
|
|
4064
4064
|
if (typeof s == "string")
|
|
4065
|
-
return
|
|
4065
|
+
return Ji(s, t, r);
|
|
4066
4066
|
if (zs(s)) {
|
|
4067
4067
|
r({ stage: "fetch", progress: 0.05, detail: "bytes" });
|
|
4068
4068
|
const i = await Yi(s), n = t.name ?? (s instanceof File ? s.name : void 0) ?? "";
|
|
@@ -4070,7 +4070,7 @@ async function ns(s, e) {
|
|
|
4070
4070
|
}
|
|
4071
4071
|
throw new Error("Unsupported story source");
|
|
4072
4072
|
}
|
|
4073
|
-
async function
|
|
4073
|
+
async function Ji(s, e, t) {
|
|
4074
4074
|
const r = ms(s), i = qi(s, e.name ?? s);
|
|
4075
4075
|
if (t({ stage: "fetch", progress: 0.02, detail: s }), r === gs || r === ".epub" || i === "fanci" || i === "epub") {
|
|
4076
4076
|
const u = await Ri(s);
|
|
@@ -4083,95 +4083,95 @@ async function Gi(s, e, t) {
|
|
|
4083
4083
|
if (fs(o))
|
|
4084
4084
|
return t({ stage: "fetch", progress: 0.15, detail: "zip downloaded" }), as(a, e.name ?? s, e.baseUrl, t);
|
|
4085
4085
|
t({ stage: "parse", progress: 0.2, detail: "json" });
|
|
4086
|
-
const l = new TextDecoder().decode(o),
|
|
4087
|
-
await
|
|
4088
|
-
const
|
|
4089
|
-
return t({ stage: "complete", progress: 1 }), { story:
|
|
4086
|
+
const l = new TextDecoder().decode(o), h = ot(JSON.parse(l)), c = e.baseUrl ?? hi(new URL(s, location.href).href);
|
|
4087
|
+
await Ke(h, c);
|
|
4088
|
+
const d = await Qe(h, c, t, 0.3, 1);
|
|
4089
|
+
return t({ stage: "complete", progress: 1 }), { story: h, baseUrl: c, assets: d, blobUrls: [], kind: "json" };
|
|
4090
4090
|
}
|
|
4091
4091
|
async function as(s, e, t, r) {
|
|
4092
4092
|
const i = new Uint8Array(s), n = ms(e);
|
|
4093
4093
|
if (fs(i)) {
|
|
4094
4094
|
r({ stage: "unpack", progress: 0.2, detail: "unzip" });
|
|
4095
|
-
const
|
|
4096
|
-
if (r({ stage: "unpack", progress: 0.35, detail: `${
|
|
4095
|
+
const h = ps(i);
|
|
4096
|
+
if (r({ stage: "unpack", progress: 0.35, detail: `${h.size} entries` }), n === ".epub" || Oi(h)) {
|
|
4097
4097
|
r({ stage: "parse", progress: 0.4, detail: "epub" });
|
|
4098
|
-
const { story: c, blobUrls:
|
|
4099
|
-
await
|
|
4100
|
-
const u = await
|
|
4101
|
-
return r({ stage: "complete", progress: 1 }), { story: c, baseUrl: t ?? "", assets: u, blobUrls:
|
|
4098
|
+
const { story: c, blobUrls: d } = pr(h);
|
|
4099
|
+
await Ke(c, t ?? "");
|
|
4100
|
+
const u = await Qe(c, t ?? "", r, 0.5, 1);
|
|
4101
|
+
return r({ stage: "complete", progress: 1 }), { story: c, baseUrl: t ?? "", assets: u, blobUrls: d, kind: "epub" };
|
|
4102
4102
|
}
|
|
4103
|
-
if (n === gs || Wi(
|
|
4103
|
+
if (n === gs || Wi(h)) {
|
|
4104
4104
|
r({ stage: "parse", progress: 0.4, detail: "fanci" });
|
|
4105
|
-
const { story: c, blobUrls:
|
|
4106
|
-
await
|
|
4107
|
-
const u = await
|
|
4108
|
-
return r({ stage: "complete", progress: 1 }), { story: c, baseUrl: t ?? "", assets: u, blobUrls:
|
|
4105
|
+
const { story: c, blobUrls: d } = yr(h);
|
|
4106
|
+
await Ke(c, t ?? "");
|
|
4107
|
+
const u = await Qe(c, t ?? "", r, 0.5, 1);
|
|
4108
|
+
return r({ stage: "complete", progress: 1 }), { story: c, baseUrl: t ?? "", assets: u, blobUrls: d, kind: "fanci" };
|
|
4109
4109
|
}
|
|
4110
4110
|
throw new Error(
|
|
4111
4111
|
"ZIP archive is neither a .fanci package (story.json) nor an EPUB (META-INF/container.xml)"
|
|
4112
4112
|
);
|
|
4113
4113
|
}
|
|
4114
4114
|
r({ stage: "parse", progress: 0.25, detail: "json bytes" });
|
|
4115
|
-
const a =
|
|
4116
|
-
await
|
|
4117
|
-
const l = await
|
|
4115
|
+
const a = ot(JSON.parse(new TextDecoder().decode(i))), o = t ?? (typeof location < "u" ? location.href : "");
|
|
4116
|
+
await Ke(a, o);
|
|
4117
|
+
const l = await Qe(a, o, r, 0.35, 1);
|
|
4118
4118
|
return r({ stage: "complete", progress: 1 }), { story: a, baseUrl: o, assets: l, blobUrls: [], kind: "json" };
|
|
4119
4119
|
}
|
|
4120
|
-
function
|
|
4120
|
+
function Xi(s) {
|
|
4121
4121
|
return typeof s == "object" && s !== null && !Array.isArray(s) && !(s instanceof Blob) && !(s instanceof ArrayBuffer) && !(s instanceof Uint8Array) && "id" in s && "pages" in s && "pageSize" in s;
|
|
4122
4122
|
}
|
|
4123
4123
|
function zs(s) {
|
|
4124
4124
|
return s instanceof ArrayBuffer || s instanceof Uint8Array || s instanceof Blob || typeof File < "u" && s instanceof File;
|
|
4125
4125
|
}
|
|
4126
|
-
async function
|
|
4126
|
+
async function Qe(s, e, t, r, i) {
|
|
4127
4127
|
var _;
|
|
4128
|
-
const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(),
|
|
4128
|
+
const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), h = Object.entries(s.assets), c = [];
|
|
4129
4129
|
for (const v of s.pages)
|
|
4130
4130
|
for (const f of v.blocks)
|
|
4131
4131
|
if (f.type === "text" && f.htmlSrc && !f.html && c.push(async () => {
|
|
4132
|
-
const b =
|
|
4133
|
-
l.set(`htmlSrc:${f.id}`, await
|
|
4132
|
+
const b = Fe(e, f.htmlSrc);
|
|
4133
|
+
l.set(`htmlSrc:${f.id}`, await ut(b));
|
|
4134
4134
|
}), (_ = v.readAloud) != null && _.cues && typeof v.readAloud.cues == "string") {
|
|
4135
4135
|
const b = v.readAloud.cues;
|
|
4136
4136
|
s.assets[b] || c.push(async () => {
|
|
4137
|
-
const x =
|
|
4137
|
+
const x = Fe(e, b);
|
|
4138
4138
|
try {
|
|
4139
|
-
o.set(b, Ms(await
|
|
4139
|
+
o.set(b, Ms(await ut(x)));
|
|
4140
4140
|
} catch {
|
|
4141
4141
|
}
|
|
4142
4142
|
});
|
|
4143
4143
|
}
|
|
4144
|
-
const
|
|
4144
|
+
const d = h.length + c.length || 1;
|
|
4145
4145
|
let u = 0;
|
|
4146
4146
|
const g = (v) => {
|
|
4147
4147
|
u += 1;
|
|
4148
|
-
const f = u /
|
|
4148
|
+
const f = u / d, b = r + (i - r) * Math.min(1, f);
|
|
4149
4149
|
t({
|
|
4150
4150
|
stage: "assets",
|
|
4151
4151
|
progress: b,
|
|
4152
4152
|
count: u,
|
|
4153
|
-
total:
|
|
4153
|
+
total: d,
|
|
4154
4154
|
detail: v
|
|
4155
4155
|
});
|
|
4156
4156
|
};
|
|
4157
4157
|
return await Promise.all(
|
|
4158
|
-
|
|
4159
|
-
const b =
|
|
4160
|
-
f.type === "image" ? n.set(v, await
|
|
4158
|
+
h.map(async ([v, f]) => {
|
|
4159
|
+
const b = Fe(e, f.src);
|
|
4160
|
+
f.type === "image" ? n.set(v, await Gi(b)) : f.type === "audio" ? a.set(v, { url: b, channel: f.channel ?? "vo" }) : f.type === "vtt" ? o.set(v, Ms(await ut(b))) : f.type === "html" && l.set(v, await ut(b)), g(v);
|
|
4161
4161
|
})
|
|
4162
4162
|
), await Promise.all(
|
|
4163
4163
|
c.map(async (v) => {
|
|
4164
4164
|
await v(), g("fragment");
|
|
4165
4165
|
})
|
|
4166
|
-
),
|
|
4166
|
+
), h.length === 0 && c.length === 0 && t({ stage: "assets", progress: i, count: 0, total: 0, detail: "none" }), { images: n, audioUrls: a, cues: o, html: l };
|
|
4167
4167
|
}
|
|
4168
|
-
function
|
|
4168
|
+
function Gi(s) {
|
|
4169
4169
|
return new Promise((e, t) => {
|
|
4170
4170
|
const r = new Image();
|
|
4171
4171
|
r.decoding = "async", r.onload = () => e(r), r.onerror = () => t(new Error(`Failed to load image: ${s}`)), r.src = s;
|
|
4172
4172
|
});
|
|
4173
4173
|
}
|
|
4174
|
-
async function
|
|
4174
|
+
async function ut(s) {
|
|
4175
4175
|
const e = await fetch(s);
|
|
4176
4176
|
if (!e.ok)
|
|
4177
4177
|
throw new Error(`Failed to load ${s}: ${e.status}`);
|
|
@@ -4252,7 +4252,7 @@ function an(s) {
|
|
|
4252
4252
|
function on(s) {
|
|
4253
4253
|
return s ? s.left.kind === "page" ? s.left.pageId : s.right.kind === "page" ? s.right.pageId : null : null;
|
|
4254
4254
|
}
|
|
4255
|
-
function
|
|
4255
|
+
function We(s, e) {
|
|
4256
4256
|
const t = s.findIndex(
|
|
4257
4257
|
(r) => r.left.kind === "page" && r.left.pageId === e || r.right.kind === "page" && r.right.pageId === e
|
|
4258
4258
|
);
|
|
@@ -4320,7 +4320,7 @@ class ln {
|
|
|
4320
4320
|
this.preferredMode = e, this.updateLayout(t, r, !1);
|
|
4321
4321
|
}
|
|
4322
4322
|
updateLayout(e, t, r = !0) {
|
|
4323
|
-
var l,
|
|
4323
|
+
var l, h, c, d, u;
|
|
4324
4324
|
const i = en(
|
|
4325
4325
|
this.preferredMode,
|
|
4326
4326
|
e,
|
|
@@ -4333,8 +4333,8 @@ class ln {
|
|
|
4333
4333
|
}
|
|
4334
4334
|
const a = this.currentPageIds[0] ?? on(this.spreads[this.spreadIndex]) ?? ((l = this.story.pages[0]) == null ? void 0 : l.id) ?? null;
|
|
4335
4335
|
this.resolvedMode = i, this.hasResolvedLayout = !0, this.rebuildCoverSpreads(), this.spreads = zt(this.story.pages, i, this.covers);
|
|
4336
|
-
const o = this.covers.frontCover && a === ((
|
|
4337
|
-
i === "single" ? (this.bookState = "open", this.spreadIndex = a ?
|
|
4336
|
+
const o = this.covers.frontCover && a === ((h = this.story.pages[0]) == null ? void 0 : h.id) || this.covers.backCover && a === ((c = this.story.pages[this.story.pages.length - 1]) == null ? void 0 : c.id);
|
|
4337
|
+
i === "single" ? (this.bookState = "open", this.spreadIndex = a ? We(this.spreads, a) : 0) : this.covers.frontCover && (this.bookState === "closed-front" || o && a === ((d = this.story.pages[0]) == null ? void 0 : d.id)) ? (this.bookState = "closed-front", this.spreadIndex = 0) : this.covers.backCover && (this.bookState === "closed-back" || o && a === ((u = this.story.pages[this.story.pages.length - 1]) == null ? void 0 : u.id)) ? (this.bookState = "closed-back", this.spreadIndex = Math.max(0, this.spreads.length - 1)) : (this.bookState = "open", this.spreadIndex = a ? We(this.spreads, a) : 0), this.spreadIndex >= this.spreads.length && (this.spreadIndex = Math.max(0, this.spreads.length - 1)), this.busy = !1, this.spreadView.setLayoutMode(i), this.spreadView.setBookState(this.bookState), this.spreadView.showSpread(this.currentSpread, "none"), r && (this.emit("layoutchange", { layoutMode: i }), this.emitPageChange());
|
|
4338
4338
|
}
|
|
4339
4339
|
async showInitial() {
|
|
4340
4340
|
this.covers.frontCover && this.resolvedMode === "two-page" ? (this.bookState = "closed-front", this.spreadIndex = 0) : this.bookState = "open", await this.spreadView.showSpread(this.currentSpread, "none"), this.spreadView.setBookState(this.bookState), this.emitPageChange();
|
|
@@ -4380,7 +4380,7 @@ class ln {
|
|
|
4380
4380
|
backCover: !!this.story.backCover
|
|
4381
4381
|
}, this.rebuildCoverSpreads(), this.spreads = zt(this.story.pages, this.resolvedMode, this.covers);
|
|
4382
4382
|
const t = e ?? this.currentPageIds[0] ?? ((r = this.story.pages[0]) == null ? void 0 : r.id) ?? null;
|
|
4383
|
-
this.resolvedMode === "single" ? (this.bookState = "open", this.spreadIndex = t ?
|
|
4383
|
+
this.resolvedMode === "single" ? (this.bookState = "open", this.spreadIndex = t ? We(this.spreads, t) : 0) : this.covers.frontCover && t === ((i = this.story.pages[0]) == null ? void 0 : i.id) && this.bookState === "closed-front" ? (this.bookState = "closed-front", this.spreadIndex = 0) : this.covers.backCover && t === ((n = this.story.pages[this.story.pages.length - 1]) == null ? void 0 : n.id) && this.bookState === "closed-back" ? (this.bookState = "closed-back", this.spreadIndex = Math.max(0, this.spreads.length - 1)) : (this.bookState = "open", this.spreadIndex = t ? We(this.spreads, t) : 0, this.spreadIndex < 0 && (this.spreadIndex = 0)), this.spreads.length === 0 ? (this.spreadIndex = 0, this.covers.frontCover ? this.bookState = "closed-front" : this.covers.backCover && (this.bookState = "closed-back")) : this.spreadIndex >= this.spreads.length && (this.spreadIndex = Math.max(0, this.spreads.length - 1)), this.busy = !1, this.spreadView.setLayoutMode(this.resolvedMode), this.spreadView.setBookState(this.bookState), this.spreadView.showSpread(this.currentSpread, "none"), this.emitPageChange();
|
|
4384
4384
|
}
|
|
4385
4385
|
async goTo(e) {
|
|
4386
4386
|
var a, o;
|
|
@@ -4393,7 +4393,7 @@ class ln {
|
|
|
4393
4393
|
this.bookState = "closed-back", this.spreadIndex = Math.max(0, this.spreads.length - 1), await this.spreadView.showSpread(this.backCoverSpread, "none"), this.spreadView.setBookState("closed-back"), this.emitPageChange(), this.busy = !1;
|
|
4394
4394
|
return;
|
|
4395
4395
|
}
|
|
4396
|
-
const i =
|
|
4396
|
+
const i = We(this.spreads, e);
|
|
4397
4397
|
if (i === this.spreadIndex && this.bookState === "open") {
|
|
4398
4398
|
this.busy = !1;
|
|
4399
4399
|
return;
|
|
@@ -4419,10 +4419,10 @@ class ln {
|
|
|
4419
4419
|
i(t);
|
|
4420
4420
|
}
|
|
4421
4421
|
}
|
|
4422
|
-
function
|
|
4422
|
+
function ft(s) {
|
|
4423
4423
|
return s.replace(/\\/g, "/").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
4424
4424
|
}
|
|
4425
|
-
function
|
|
4425
|
+
function pt(s, e) {
|
|
4426
4426
|
var t;
|
|
4427
4427
|
try {
|
|
4428
4428
|
const i = (t = new URL(s, "http://local/").pathname.split(".").pop()) == null ? void 0 : t.toLowerCase();
|
|
@@ -4431,7 +4431,7 @@ function gt(s, e) {
|
|
|
4431
4431
|
}
|
|
4432
4432
|
return e;
|
|
4433
4433
|
}
|
|
4434
|
-
async function
|
|
4434
|
+
async function gt(s) {
|
|
4435
4435
|
const e = await fetch(s);
|
|
4436
4436
|
if (!e.ok)
|
|
4437
4437
|
throw new Error(`Failed to fetch asset ${s}: ${e.status}`);
|
|
@@ -4442,71 +4442,71 @@ async function cn(s, e = {}) {
|
|
|
4442
4442
|
for (const [a, o] of Object.entries(r.assets)) {
|
|
4443
4443
|
const l = o.src;
|
|
4444
4444
|
if (/^(?:[a-z]+:)?\/\//i.test(l) || l.startsWith("blob:") || l.startsWith("data:")) {
|
|
4445
|
-
const
|
|
4446
|
-
t[u] || (t[u] = await
|
|
4445
|
+
const d = o.type === "image" ? pt(l, "png") : o.type === "audio" ? pt(l, "mp3") : o.type === "vtt" ? "vtt" : pt(l, "bin"), u = ft(`assets/${a}.${d}`);
|
|
4446
|
+
t[u] || (t[u] = await gt(l)), o.src = u;
|
|
4447
4447
|
continue;
|
|
4448
4448
|
}
|
|
4449
|
-
const c =
|
|
4449
|
+
const c = ft(l);
|
|
4450
4450
|
if (!t[c]) {
|
|
4451
|
-
const
|
|
4452
|
-
t[c] = await
|
|
4451
|
+
const d = Fe(i, l);
|
|
4452
|
+
t[c] = await gt(d);
|
|
4453
4453
|
}
|
|
4454
4454
|
o.src = c;
|
|
4455
4455
|
}
|
|
4456
4456
|
for (const a of r.fonts) {
|
|
4457
4457
|
const o = a.src;
|
|
4458
4458
|
if (/^(?:[a-z]+:)?\/\//i.test(o) || o.startsWith("blob:") || o.startsWith("data:")) {
|
|
4459
|
-
const
|
|
4460
|
-
t[
|
|
4459
|
+
const h = ft(`fonts/${a.family.replace(/\s+/g, "-")}.${pt(o, "woff2")}`);
|
|
4460
|
+
t[h] || (t[h] = await gt(o)), a.src = h;
|
|
4461
4461
|
} else {
|
|
4462
|
-
const
|
|
4463
|
-
t[
|
|
4462
|
+
const h = ft(o);
|
|
4463
|
+
t[h] || (t[h] = await gt(Fe(i, o))), a.src = h;
|
|
4464
4464
|
}
|
|
4465
4465
|
}
|
|
4466
4466
|
t["story.json"] = rs(JSON.stringify(r, null, 2));
|
|
4467
4467
|
const n = Pi(t, { level: 6 });
|
|
4468
4468
|
return new Blob([n], { type: "application/zip" });
|
|
4469
4469
|
}
|
|
4470
|
-
function
|
|
4470
|
+
function hn(s, e) {
|
|
4471
4471
|
const t = URL.createObjectURL(s), r = document.createElement("a");
|
|
4472
4472
|
r.href = t, r.download = e, r.rel = "noopener", document.body.appendChild(r), r.click(), r.remove(), URL.revokeObjectURL(t);
|
|
4473
4473
|
}
|
|
4474
|
-
class
|
|
4474
|
+
class Pt {
|
|
4475
4475
|
/** Clear classes/styles if a flip is interrupted. */
|
|
4476
4476
|
cancel(e) {
|
|
4477
4477
|
}
|
|
4478
4478
|
}
|
|
4479
4479
|
/** Registry id when registered via {@link registerFlipStyle}. */
|
|
4480
|
-
y(
|
|
4481
|
-
const
|
|
4482
|
-
function
|
|
4483
|
-
|
|
4480
|
+
y(Pt, "id", "base");
|
|
4481
|
+
const nt = /* @__PURE__ */ new Map();
|
|
4482
|
+
function dn(s, e) {
|
|
4483
|
+
nt.set(s, e);
|
|
4484
4484
|
}
|
|
4485
4485
|
function la(s) {
|
|
4486
|
-
return
|
|
4486
|
+
return nt.get(s);
|
|
4487
4487
|
}
|
|
4488
4488
|
function un() {
|
|
4489
|
-
return [...
|
|
4489
|
+
return [...nt.keys()];
|
|
4490
4490
|
}
|
|
4491
4491
|
function fn(s) {
|
|
4492
|
-
return typeof s == "function" && s.prototype instanceof
|
|
4492
|
+
return typeof s == "function" && s.prototype instanceof Pt;
|
|
4493
4493
|
}
|
|
4494
4494
|
function Zs(s) {
|
|
4495
4495
|
if (s == null || s === "") {
|
|
4496
|
-
const e =
|
|
4496
|
+
const e = nt.get("default");
|
|
4497
4497
|
if (!e)
|
|
4498
4498
|
throw new Error('FlipStyle "default" is not registered');
|
|
4499
4499
|
return new e();
|
|
4500
4500
|
}
|
|
4501
4501
|
if (typeof s == "string") {
|
|
4502
|
-
const e =
|
|
4502
|
+
const e = nt.get(s);
|
|
4503
4503
|
if (!e) {
|
|
4504
4504
|
const t = un().join(", ") || "(none)";
|
|
4505
4505
|
throw new Error(`Unknown flipStyle "${s}". Registered: ${t}`);
|
|
4506
4506
|
}
|
|
4507
4507
|
return new e();
|
|
4508
4508
|
}
|
|
4509
|
-
if (s instanceof
|
|
4509
|
+
if (s instanceof Pt)
|
|
4510
4510
|
return s;
|
|
4511
4511
|
if (fn(s))
|
|
4512
4512
|
return new s();
|
|
@@ -4516,14 +4516,14 @@ const pn = 400;
|
|
|
4516
4516
|
function Us(s) {
|
|
4517
4517
|
return s == null || !Number.isFinite(s) || s <= 0 ? pn : s;
|
|
4518
4518
|
}
|
|
4519
|
-
class os extends
|
|
4519
|
+
class os extends Pt {
|
|
4520
4520
|
play(e) {
|
|
4521
4521
|
const { bookEl: t, direction: r, durationMs: i } = e, n = r === "next" ? "fc-turn-next" : "fc-turn-prev";
|
|
4522
4522
|
return t.style.setProperty("--fc-flip-duration", `${i}ms`), t.classList.remove("fc-turn-next", "fc-turn-prev"), t.offsetWidth, t.classList.add(n), new Promise((a) => {
|
|
4523
4523
|
const o = () => {
|
|
4524
4524
|
t.removeEventListener("animationend", l), t.classList.remove("fc-turn-next", "fc-turn-prev"), a();
|
|
4525
|
-
}, l = (
|
|
4526
|
-
|
|
4525
|
+
}, l = (h) => {
|
|
4526
|
+
h.target !== e.rightLeaf && h.target !== e.leftLeaf || o();
|
|
4527
4527
|
};
|
|
4528
4528
|
t.addEventListener("animationend", l), window.setTimeout(o, i + 50);
|
|
4529
4529
|
});
|
|
@@ -4533,7 +4533,7 @@ class os extends Nt {
|
|
|
4533
4533
|
}
|
|
4534
4534
|
}
|
|
4535
4535
|
y(os, "id", "default");
|
|
4536
|
-
|
|
4536
|
+
dn(os.id, os);
|
|
4537
4537
|
const Hs = 0.035;
|
|
4538
4538
|
function gn(s, e) {
|
|
4539
4539
|
return e && e.width > 0 && e.height > 0 ? {
|
|
@@ -4549,16 +4549,16 @@ function Ds(s) {
|
|
|
4549
4549
|
}
|
|
4550
4550
|
function mn(s) {
|
|
4551
4551
|
const e = s ?? {}, t = {
|
|
4552
|
-
left:
|
|
4553
|
-
top:
|
|
4552
|
+
left: Ve(e.x ?? 0),
|
|
4553
|
+
top: Ve(e.y ?? 0)
|
|
4554
4554
|
};
|
|
4555
|
-
return e.width != null && (t.width =
|
|
4555
|
+
return e.width != null && (t.width = Ve(e.width)), e.height != null && (t.height = Ve(e.height)), t;
|
|
4556
4556
|
}
|
|
4557
4557
|
function ys(s, e) {
|
|
4558
4558
|
const t = mn(e);
|
|
4559
|
-
s.style.left = t.left, s.style.top = t.top, t.width && (s.style.width = t.width), t.height && (s.style.height = t.height), (e == null ? void 0 : e.horizontalAlign) === "right" ? (s.style.left = "auto", s.style.right =
|
|
4559
|
+
s.style.left = t.left, s.style.top = t.top, t.width && (s.style.width = t.width), t.height && (s.style.height = t.height), (e == null ? void 0 : e.horizontalAlign) === "right" ? (s.style.left = "auto", s.style.right = Ve(e.x ?? 0)) : (e == null ? void 0 : e.horizontalAlign) === "center" && (s.style.left = "50%", s.style.transform = `${s.style.transform || ""} translateX(-50%)`.trim()), (e == null ? void 0 : e.verticalAlign) === "bottom" ? (s.style.top = "auto", s.style.bottom = Ve(e.y ?? 0)) : (e == null ? void 0 : e.verticalAlign) === "center" && (s.style.top = "50%", s.style.transform = `${s.style.transform || ""} translateY(-50%)`.trim());
|
|
4560
4560
|
}
|
|
4561
|
-
function
|
|
4561
|
+
function Ve(s) {
|
|
4562
4562
|
return typeof s == "number" ? `${s}px` : /^-?\d+(\.\d+)?$/.test(s) ? `${s}px` : s;
|
|
4563
4563
|
}
|
|
4564
4564
|
function yn(s, e) {
|
|
@@ -4743,19 +4743,19 @@ class kn {
|
|
|
4743
4743
|
}
|
|
4744
4744
|
applyStageTransform(e, t, r) {
|
|
4745
4745
|
if (e <= 0 || t <= 0) return;
|
|
4746
|
-
const { width: i, height: n } = this.story.pageSize, a = this.layoutMode, o = this.bookState, l = Ds(this.story),
|
|
4747
|
-
this.element.classList.toggle("fc-hardback-active", l), this.element.classList.toggle("fc-hardback-open",
|
|
4746
|
+
const { width: i, height: n } = this.story.pageSize, a = this.layoutMode, o = this.bookState, l = Ds(this.story), h = l ? gn(this.story.pageSize, this.story.coverSize) : { x: 0, y: 0 }, c = a === "two-page" && (o === "closed-front" || o === "closed-back"), d = l && o === "open", u = this.isSoloCover();
|
|
4747
|
+
this.element.classList.toggle("fc-hardback-active", l), this.element.classList.toggle("fc-hardback-open", d), this.element.classList.toggle("fc-hardback-closed", l && c);
|
|
4748
4748
|
let g, _, v, f = 0, b = 0, x = 0;
|
|
4749
4749
|
if (l && c)
|
|
4750
|
-
_ = i + 2 *
|
|
4750
|
+
_ = i + 2 * h.x, v = n + 2 * h.y, g = this.sizedScale(
|
|
4751
4751
|
Math.min(e / _, t / v),
|
|
4752
4752
|
i,
|
|
4753
4753
|
n,
|
|
4754
4754
|
e,
|
|
4755
4755
|
t
|
|
4756
4756
|
), this.bookEl.style.setProperty("--fc-page-width", `${_}px`), this.bookEl.style.setProperty("--fc-page-height", `${v}px`), this.bookEl.style.width = `${u ? _ : _ * 2}px`, this.bookEl.style.height = `${v}px`, f = u ? 0 : -_ * g, b = 0, x = 0, this.hardbackEl.hidden = !0;
|
|
4757
|
-
else if (
|
|
4758
|
-
_ = (a === "single" ? i : i * 2) + 2 *
|
|
4757
|
+
else if (d) {
|
|
4758
|
+
_ = (a === "single" ? i : i * 2) + 2 * h.x, v = n + 2 * h.y, g = this.sizedScale(
|
|
4759
4759
|
Math.min(e / _, t / v),
|
|
4760
4760
|
i,
|
|
4761
4761
|
n,
|
|
@@ -4763,7 +4763,7 @@ class kn {
|
|
|
4763
4763
|
t
|
|
4764
4764
|
), this.bookEl.style.setProperty("--fc-page-width", `${i}px`), this.bookEl.style.setProperty("--fc-page-height", `${n}px`), this.bookEl.style.width = `${i * 2}px`, this.bookEl.style.height = `${n}px`, this.hardbackEl.hidden = !1, this.hardbackEl.style.width = `${_}px`, this.hardbackEl.style.height = `${v}px`;
|
|
4765
4765
|
const U = a === "single" ? (r == null ? void 0 : r.left.kind) === "blank" ? "right" : "left" : "both";
|
|
4766
|
-
this.sizeHardbackBoards(U, i, n,
|
|
4766
|
+
this.sizeHardbackBoards(U, i, n, h.x, h.y), b = h.x, x = h.y, a === "single" && (r == null ? void 0 : r.left.kind) === "blank" ? f = -i * g : f = 0;
|
|
4767
4767
|
} else
|
|
4768
4768
|
_ = i * 2, v = n, a === "single" || c ? g = this.sizedScale(
|
|
4769
4769
|
Math.min(e / i, t / n),
|
|
@@ -4778,10 +4778,10 @@ class kn {
|
|
|
4778
4778
|
e,
|
|
4779
4779
|
t
|
|
4780
4780
|
), this.bookEl.style.setProperty("--fc-page-width", `${i}px`), this.bookEl.style.setProperty("--fc-page-height", `${n}px`), this.bookEl.style.width = `${u ? i : _}px`, this.bookEl.style.height = `${v}px`, this.hardbackEl.hidden = !0, u ? f = 0 : (c || a === "single" && r && r.left.kind === "blank") && (f = -i * g);
|
|
4781
|
-
this.element.style.setProperty("--fc-hardback-overhang-x", `${
|
|
4782
|
-
let m = l && c ? (i + 2 *
|
|
4781
|
+
this.element.style.setProperty("--fc-hardback-overhang-x", `${h.x}px`), this.element.style.setProperty("--fc-hardback-overhang-y", `${h.y}px`), this.hardbackEl.style.transform = `scale(${g})`, this.hardbackEl.style.transformOrigin = "left top", this.bookEl.style.transform = `translateX(${f}px) scale(${g})`, this.bookEl.style.transformOrigin = "left top";
|
|
4782
|
+
let m = l && c ? (i + 2 * h.x) * g : d ? (a === "single" ? i + 2 * h.x : i * 2 + 2 * h.x) * g : a === "single" || c ? i * g : i * 2 * g, E = l && (c || d) ? (n + 2 * h.y) * g : n * g, R = 0, T = 0;
|
|
4783
4783
|
this.stageZoom.mode === "fit-page" && (E > t && (T = (E - t) / 2, E = t), (a === "single" || c || u ? i : i * 2) * g <= e && m > e && (R = (m - e) / 2, m = e));
|
|
4784
|
-
const O = (
|
|
4784
|
+
const O = (d ? b * g : 0) - R, P = (d ? x * g : 0) - T;
|
|
4785
4785
|
this.hardbackEl.style.left = `${-R}px`, this.hardbackEl.style.top = `${-T}px`, this.bookEl.style.left = `${O}px`, this.bookEl.style.top = `${P}px`, this.element.style.width = `${m}px`, this.element.style.height = `${E}px`, this.leftSlot.classList.toggle("fc-leaf-dimmed", c && !u), this.rightSlot.classList.remove("fc-leaf-dimmed"), this.applySoloCover(u);
|
|
4786
4786
|
}
|
|
4787
4787
|
/** Fit-spread keeps the fitted scale. Fit-page fits one page. Percent is CSS pixels. */
|
|
@@ -4790,7 +4790,7 @@ class kn {
|
|
|
4790
4790
|
}
|
|
4791
4791
|
/** A front or back cover shown by itself, not as one half of an open spread. */
|
|
4792
4792
|
isSoloCover() {
|
|
4793
|
-
var l,
|
|
4793
|
+
var l, h;
|
|
4794
4794
|
if (this.bookState === "closed-front" || this.bookState === "closed-back") return !0;
|
|
4795
4795
|
const e = this.currentSpread;
|
|
4796
4796
|
if (!e) return !1;
|
|
@@ -4798,7 +4798,7 @@ class kn {
|
|
|
4798
4798
|
if (t === r) return !1;
|
|
4799
4799
|
const i = t && e.left.kind === "page" ? e.left.pageId : e.right.kind === "page" ? e.right.pageId : null;
|
|
4800
4800
|
if (!i) return !1;
|
|
4801
|
-
const n = this.story.pages, a = !!this.story.frontCover && ((l = n[0]) == null ? void 0 : l.id) === i, o = !!this.story.backCover && ((
|
|
4801
|
+
const n = this.story.pages, a = !!this.story.frontCover && ((l = n[0]) == null ? void 0 : l.id) === i, o = !!this.story.backCover && ((h = n[n.length - 1]) == null ? void 0 : h.id) === i;
|
|
4802
4802
|
return a || o;
|
|
4803
4803
|
}
|
|
4804
4804
|
applySoloCover(e) {
|
|
@@ -4896,8 +4896,8 @@ function Sn(s, e, t = {}) {
|
|
|
4896
4896
|
if (!(a != null && a.subscribe)) return;
|
|
4897
4897
|
const l = a.subscribe(o);
|
|
4898
4898
|
typeof l == "function" ? r.push(l) : l && typeof l.unsubscribe == "function" && r.push(() => {
|
|
4899
|
-
var
|
|
4900
|
-
return (
|
|
4899
|
+
var h;
|
|
4900
|
+
return (h = l.unsubscribe) == null ? void 0 : h.call(l);
|
|
4901
4901
|
});
|
|
4902
4902
|
};
|
|
4903
4903
|
return s != null && s.state && (n(s.state.pause, (a) => {
|
|
@@ -4923,8 +4923,8 @@ async function Cn(s) {
|
|
|
4923
4923
|
if (!i) return null;
|
|
4924
4924
|
const a = xn(), o = `fancifully-story-load-${Math.random().toString(36).slice(2, 9)}`;
|
|
4925
4925
|
if (n && typeof i.uses == "function") {
|
|
4926
|
-
const
|
|
4927
|
-
|
|
4926
|
+
const h = new n({ name: o });
|
|
4927
|
+
h.preload = () => a.promise, i.uses(h);
|
|
4928
4928
|
} else
|
|
4929
4929
|
a.resolve();
|
|
4930
4930
|
return { app: new i({ features: s }), loadGate: a, owned: !0 };
|
|
@@ -4945,13 +4945,13 @@ const En = Object.freeze({
|
|
|
4945
4945
|
top: 0,
|
|
4946
4946
|
width: 16,
|
|
4947
4947
|
height: 16
|
|
4948
|
-
}),
|
|
4948
|
+
}), Et = Object.freeze({
|
|
4949
4949
|
rotate: 0,
|
|
4950
4950
|
vFlip: !1,
|
|
4951
4951
|
hFlip: !1
|
|
4952
4952
|
}), vr = Object.freeze({
|
|
4953
4953
|
...En,
|
|
4954
|
-
...
|
|
4954
|
+
...Et
|
|
4955
4955
|
}), Tn = Object.freeze({
|
|
4956
4956
|
...vr,
|
|
4957
4957
|
body: "",
|
|
@@ -4961,7 +4961,7 @@ const En = Object.freeze({
|
|
|
4961
4961
|
height: null
|
|
4962
4962
|
}), Mn = Object.freeze({
|
|
4963
4963
|
...Ln,
|
|
4964
|
-
...
|
|
4964
|
+
...Et
|
|
4965
4965
|
});
|
|
4966
4966
|
function Pn(s, e) {
|
|
4967
4967
|
const t = {};
|
|
@@ -4971,7 +4971,7 @@ function Pn(s, e) {
|
|
|
4971
4971
|
}
|
|
4972
4972
|
function Ws(s, e) {
|
|
4973
4973
|
const t = Pn(s, e);
|
|
4974
|
-
for (const r in Tn) r in
|
|
4974
|
+
for (const r in Tn) r in Et ? r in s && !(r in t) && (t[r] = Et[r]) : r in e ? t[r] = e[r] : r in s && (t[r] = s[r]);
|
|
4975
4975
|
return t;
|
|
4976
4976
|
}
|
|
4977
4977
|
function Nn(s, e) {
|
|
@@ -5072,18 +5072,18 @@ function zn(s, e) {
|
|
|
5072
5072
|
}
|
|
5073
5073
|
m % 2 === 1 && (i.left !== i.top && (E = i.left, i.left = i.top, i.top = E), i.width !== i.height && (E = i.width, i.width = i.height, i.height = E)), f.length && (n = Fn(n, '<g transform="' + f.join(" ") + '">', "</g>"));
|
|
5074
5074
|
});
|
|
5075
|
-
const a = r.width, o = r.height, l = i.width,
|
|
5076
|
-
let c,
|
|
5077
|
-
a === null ? (
|
|
5075
|
+
const a = r.width, o = r.height, l = i.width, h = i.height;
|
|
5076
|
+
let c, d;
|
|
5077
|
+
a === null ? (d = o === null ? "1em" : o === "auto" ? h : o, c = Ys(d, l / h)) : (c = a === "auto" ? l : a, d = o === null ? Ys(c, h / l) : o === "auto" ? h : o);
|
|
5078
5078
|
const u = {}, g = (v, f) => {
|
|
5079
5079
|
Bn(f) || (u[v] = f.toString());
|
|
5080
5080
|
};
|
|
5081
|
-
g("width", c), g("height",
|
|
5081
|
+
g("width", c), g("height", d);
|
|
5082
5082
|
const _ = [
|
|
5083
5083
|
i.left,
|
|
5084
5084
|
i.top,
|
|
5085
5085
|
l,
|
|
5086
|
-
|
|
5086
|
+
h
|
|
5087
5087
|
];
|
|
5088
5088
|
return u.viewBox = _.join(" "), {
|
|
5089
5089
|
attributes: u,
|
|
@@ -5103,7 +5103,7 @@ const Zn = "mdi", Un = { "chevron-left": { body: '<path fill="currentColor" d="M
|
|
|
5103
5103
|
width: Dn,
|
|
5104
5104
|
height: Wn
|
|
5105
5105
|
}, Yn = qn;
|
|
5106
|
-
function
|
|
5106
|
+
function Jn(s, e = {}) {
|
|
5107
5107
|
const t = In(Yn, s);
|
|
5108
5108
|
if (!t)
|
|
5109
5109
|
throw new Error(`Unknown MDI icon in subset: ${s}`);
|
|
@@ -5111,10 +5111,10 @@ function Gn(s, e = {}) {
|
|
|
5111
5111
|
return n.className = e.className ?? "fc-icon", n.setAttribute("aria-hidden", "true"), n.innerHTML = jn(i.body, i.attributes), n;
|
|
5112
5112
|
}
|
|
5113
5113
|
function Zt(s, e) {
|
|
5114
|
-
const t =
|
|
5114
|
+
const t = Jn(e.icon), r = document.createElement("span");
|
|
5115
5115
|
r.className = e.iconOnly ? "fc-btn-label fc-btn-label--sr" : "fc-btn-label", r.textContent = e.label, s.title = e.label, s.setAttribute("aria-label", e.label), s.replaceChildren(t, r);
|
|
5116
5116
|
}
|
|
5117
|
-
const
|
|
5117
|
+
const Xn = {
|
|
5118
5118
|
sound: !0,
|
|
5119
5119
|
soundVolume: !0,
|
|
5120
5120
|
vo: !0,
|
|
@@ -5126,7 +5126,7 @@ const Jn = {
|
|
|
5126
5126
|
captions: !0
|
|
5127
5127
|
};
|
|
5128
5128
|
class br {
|
|
5129
|
-
constructor(e, t, r, i, n = {}, a, o, l,
|
|
5129
|
+
constructor(e, t, r, i, n = {}, a, o, l, h) {
|
|
5130
5130
|
y(this, "element");
|
|
5131
5131
|
y(this, "root");
|
|
5132
5132
|
y(this, "stage");
|
|
@@ -5159,20 +5159,20 @@ class br {
|
|
|
5159
5159
|
prev: ((g = n.labels) == null ? void 0 : g.prev) ?? "Prev",
|
|
5160
5160
|
read: ((_ = n.labels) == null ? void 0 : _.read) ?? "Read",
|
|
5161
5161
|
next: ((v = n.labels) == null ? void 0 : v.next) ?? "Next"
|
|
5162
|
-
},
|
|
5162
|
+
}, d = {
|
|
5163
5163
|
prev: ((f = n.ariaLabels) == null ? void 0 : f.prev) ?? "Previous page",
|
|
5164
5164
|
read: ((b = n.ariaLabels) == null ? void 0 : b.read) ?? "Read aloud",
|
|
5165
5165
|
next: ((x = n.ariaLabels) == null ? void 0 : x.next) ?? "Next page"
|
|
5166
5166
|
};
|
|
5167
|
-
this.chrome = document.createElement("div"), this.chrome.className = ["fc-chrome", n.className].filter(Boolean).join(" "), this.chrome.hidden = !!n.hidden, this.btnPrev = document.createElement("button"), this.btnPrev.type = "button", this.btnPrev.className = "fc-btn fc-btn-prev", this.btnPrev.setAttribute("aria-label",
|
|
5167
|
+
this.chrome = document.createElement("div"), this.chrome.className = ["fc-chrome", n.className].filter(Boolean).join(" "), this.chrome.hidden = !!n.hidden, this.btnPrev = document.createElement("button"), this.btnPrev.type = "button", this.btnPrev.className = "fc-btn fc-btn-prev", this.btnPrev.setAttribute("aria-label", d.prev), Zt(this.btnPrev, {
|
|
5168
5168
|
icon: "chevron-left",
|
|
5169
5169
|
label: c.prev,
|
|
5170
5170
|
iconOnly: !0
|
|
5171
|
-
}), this.btnRead = document.createElement("button"), this.btnRead.type = "button", this.btnRead.className = "fc-btn fc-btn-read", this.btnRead.setAttribute("aria-label",
|
|
5171
|
+
}), this.btnRead = document.createElement("button"), this.btnRead.type = "button", this.btnRead.className = "fc-btn fc-btn-read", this.btnRead.setAttribute("aria-label", d.read), Zt(this.btnRead, {
|
|
5172
5172
|
icon: "book-open-page-variant",
|
|
5173
5173
|
label: c.read,
|
|
5174
5174
|
iconOnly: !0
|
|
5175
|
-
}), this.btnNext = document.createElement("button"), this.btnNext.type = "button", this.btnNext.className = "fc-btn fc-btn-next", this.btnNext.setAttribute("aria-label",
|
|
5175
|
+
}), this.btnNext = document.createElement("button"), this.btnNext.type = "button", this.btnNext.className = "fc-btn fc-btn-next", this.btnNext.setAttribute("aria-label", d.next), Zt(this.btnNext, {
|
|
5176
5176
|
icon: "chevron-right",
|
|
5177
5177
|
label: c.next,
|
|
5178
5178
|
iconOnly: !0
|
|
@@ -5188,7 +5188,7 @@ class br {
|
|
|
5188
5188
|
}
|
|
5189
5189
|
), this.pager = new ln(t.story, this.spreadView, {
|
|
5190
5190
|
mode: l,
|
|
5191
|
-
singleBreakpoint:
|
|
5191
|
+
singleBreakpoint: h
|
|
5192
5192
|
}), this.readAloud = new Ar(this.bus), this.sfxAudio = new Audio(), this.bus.register(this.sfxAudio, "sfx"), this.stage.appendChild(this.spreadView.element), this.element.append(this.stage, this.captionsEl, this.chrome), this.root.appendChild(this.element), this.wireChrome(), this.wirePager(i), this.wireSpringroll(), this.wireResize(), this.unbindSwipe = Er(this.stage, {
|
|
5193
5193
|
onSwipeLeft: () => {
|
|
5194
5194
|
this.navLocked || this.next();
|
|
@@ -5203,7 +5203,7 @@ class br {
|
|
|
5203
5203
|
});
|
|
5204
5204
|
}
|
|
5205
5205
|
static async create(e, t) {
|
|
5206
|
-
const r = { ...
|
|
5206
|
+
const r = { ...Xn, ...t.features };
|
|
5207
5207
|
let i = t.springroll ?? null, n = null;
|
|
5208
5208
|
if (!i) {
|
|
5209
5209
|
const c = await Cn(r);
|
|
@@ -5213,7 +5213,7 @@ class br {
|
|
|
5213
5213
|
t.onProgress && a.push(t.onProgress);
|
|
5214
5214
|
const o = (c) => {
|
|
5215
5215
|
wn(i, c);
|
|
5216
|
-
for (const
|
|
5216
|
+
for (const d of a) d(c);
|
|
5217
5217
|
};
|
|
5218
5218
|
o({ stage: "fetch", progress: 0, detail: "start" });
|
|
5219
5219
|
const l = await ns(t.story, {
|
|
@@ -5222,7 +5222,7 @@ class br {
|
|
|
5222
5222
|
onProgress: o
|
|
5223
5223
|
});
|
|
5224
5224
|
n == null || n.resolve(), await An(i);
|
|
5225
|
-
const
|
|
5225
|
+
const h = new br(
|
|
5226
5226
|
e,
|
|
5227
5227
|
l,
|
|
5228
5228
|
i,
|
|
@@ -5233,11 +5233,11 @@ class br {
|
|
|
5233
5233
|
t.layoutMode,
|
|
5234
5234
|
t.singleBreakpoint
|
|
5235
5235
|
);
|
|
5236
|
-
return
|
|
5236
|
+
return h.pager.updateLayout(
|
|
5237
5237
|
e.clientWidth || window.innerWidth,
|
|
5238
5238
|
e.clientHeight || window.innerHeight,
|
|
5239
5239
|
!1
|
|
5240
|
-
),
|
|
5240
|
+
), h.layoutStage(), await h.pager.showInitial(), h.syncChromeNavState(), h.emit("ready", { story: l.story }), h;
|
|
5241
5241
|
}
|
|
5242
5242
|
get story() {
|
|
5243
5243
|
return this.loaded.story;
|
|
@@ -5388,7 +5388,7 @@ class br {
|
|
|
5388
5388
|
this.loaded.story.pages = e, this.spreadView.setStory(this.loaded.story), this.pager.rebuildFromStory(t ?? this.pager.currentPageIds[0] ?? null), this.layoutStage(), this.syncChromeNavState();
|
|
5389
5389
|
}
|
|
5390
5390
|
async addPage() {
|
|
5391
|
-
const e =
|
|
5391
|
+
const e = Gn(this.loaded.story);
|
|
5392
5392
|
return this.loaded.story.pages.push(e), this.spreadView.setStory(this.loaded.story), this.pager.rebuildFromStory(e.id), this.layoutStage(), this.syncChromeNavState(), e;
|
|
5393
5393
|
}
|
|
5394
5394
|
async removePage(e) {
|
|
@@ -5431,7 +5431,7 @@ class br {
|
|
|
5431
5431
|
}
|
|
5432
5432
|
async downloadFanci(e) {
|
|
5433
5433
|
const t = e ?? `${this.loaded.story.id || "story"}.fanci`, r = await this.packToBlob();
|
|
5434
|
-
|
|
5434
|
+
hn(r, t.endsWith(".fanci") ? t : `${t}.fanci`);
|
|
5435
5435
|
}
|
|
5436
5436
|
destroy() {
|
|
5437
5437
|
var e, t, r;
|
|
@@ -5500,11 +5500,11 @@ class br {
|
|
|
5500
5500
|
if (!o.readAloud) continue;
|
|
5501
5501
|
const l = this.loaded.assets.audioUrls.get(o.readAloud.audio);
|
|
5502
5502
|
if (!l) continue;
|
|
5503
|
-
const
|
|
5503
|
+
const h = this.resolveCues(o.readAloud.cues), c = this.spreadView.getPageElement(o.id);
|
|
5504
5504
|
n.push({
|
|
5505
5505
|
url: l.url,
|
|
5506
5506
|
channel: l.channel,
|
|
5507
|
-
cues:
|
|
5507
|
+
cues: h,
|
|
5508
5508
|
root: c
|
|
5509
5509
|
});
|
|
5510
5510
|
}
|
|
@@ -5533,7 +5533,7 @@ class br {
|
|
|
5533
5533
|
for (const i of r) i(t);
|
|
5534
5534
|
}
|
|
5535
5535
|
}
|
|
5536
|
-
function
|
|
5536
|
+
function Gn(s) {
|
|
5537
5537
|
let e = s.pages.length + 1, t = `page-${e}`;
|
|
5538
5538
|
const r = new Set(s.pages.map((i) => i.id));
|
|
5539
5539
|
for (; r.has(t); )
|
|
@@ -5575,7 +5575,7 @@ function Xe(s, e = 0, t = 0) {
|
|
|
5575
5575
|
}
|
|
5576
5576
|
return e;
|
|
5577
5577
|
}
|
|
5578
|
-
function
|
|
5578
|
+
function et(s, e) {
|
|
5579
5579
|
const { width: t, height: r } = e;
|
|
5580
5580
|
return {
|
|
5581
5581
|
x: Math.round(Xe(s == null ? void 0 : s.x, 0, t)),
|
|
@@ -5584,31 +5584,31 @@ function tt(s, e) {
|
|
|
5584
5584
|
height: Math.round(Xe(s == null ? void 0 : s.height, r * 0.25, r))
|
|
5585
5585
|
};
|
|
5586
5586
|
}
|
|
5587
|
-
function
|
|
5587
|
+
function mt(s) {
|
|
5588
5588
|
return typeof s == "string" && /%$/.test(s.trim());
|
|
5589
5589
|
}
|
|
5590
|
-
function
|
|
5590
|
+
function qe(s, e) {
|
|
5591
5591
|
if (!(e > 0)) return "0%";
|
|
5592
5592
|
const t = s / e * 100, r = Math.round(t * 10) / 10;
|
|
5593
5593
|
return Number.isInteger(r) ? `${r}%` : `${r}%`;
|
|
5594
5594
|
}
|
|
5595
5595
|
function Ut(s, e, t, r, i, n, a = {}) {
|
|
5596
|
-
const o =
|
|
5597
|
-
if (l && (a.preserveHeight ||
|
|
5596
|
+
const o = et(i, n), l = Math.abs(o.x - s) <= 1 && Math.abs(o.y - e) <= 1 && Math.abs(o.width - t) <= 1, h = Math.abs(o.height - r) <= 1;
|
|
5597
|
+
if (l && (a.preserveHeight || h) && i)
|
|
5598
5598
|
return { ...i };
|
|
5599
|
-
const c =
|
|
5599
|
+
const c = mt(i == null ? void 0 : i.x) || mt(i == null ? void 0 : i.y) || mt(i == null ? void 0 : i.width) || mt(i == null ? void 0 : i.height), d = a.preserveHeight && (i == null ? void 0 : i.height) != null ? i.height : r;
|
|
5600
5600
|
return c ? {
|
|
5601
5601
|
...i,
|
|
5602
|
-
x:
|
|
5603
|
-
y:
|
|
5604
|
-
width:
|
|
5605
|
-
height: typeof
|
|
5602
|
+
x: qe(s, n.width),
|
|
5603
|
+
y: qe(e, n.height),
|
|
5604
|
+
width: qe(t, n.width),
|
|
5605
|
+
height: typeof d == "string" || typeof d == "number" ? typeof d == "number" ? qe(d, n.height) : d : qe(r, n.height)
|
|
5606
5606
|
} : {
|
|
5607
5607
|
...i,
|
|
5608
5608
|
x: s,
|
|
5609
5609
|
y: e,
|
|
5610
5610
|
width: t,
|
|
5611
|
-
height: typeof
|
|
5611
|
+
height: typeof d == "number" ? Math.round(d) : d
|
|
5612
5612
|
};
|
|
5613
5613
|
}
|
|
5614
5614
|
function Qn(s, e, t = 1.35) {
|
|
@@ -5631,12 +5631,12 @@ function Qn(s, e, t = 1.35) {
|
|
|
5631
5631
|
}
|
|
5632
5632
|
return t;
|
|
5633
5633
|
}
|
|
5634
|
-
const
|
|
5635
|
-
function
|
|
5634
|
+
const ha = 1;
|
|
5635
|
+
function da(s, e, t) {
|
|
5636
5636
|
if (e.width === t.width && e.height === t.height) return;
|
|
5637
5637
|
const r = t.width / e.width, i = t.height / e.height;
|
|
5638
5638
|
for (const n of s) {
|
|
5639
|
-
const a =
|
|
5639
|
+
const a = et(n.layout, e);
|
|
5640
5640
|
n.layout = {
|
|
5641
5641
|
...n.layout,
|
|
5642
5642
|
x: Math.round(a.x * r),
|
|
@@ -5655,16 +5655,16 @@ function ea(s) {
|
|
|
5655
5655
|
function wr(s) {
|
|
5656
5656
|
return s.type === "text" || s.type === "image" || s.type === "hotspot";
|
|
5657
5657
|
}
|
|
5658
|
-
function
|
|
5659
|
-
var
|
|
5658
|
+
function Js(s, e, t, r, i) {
|
|
5659
|
+
var h;
|
|
5660
5660
|
const n = (i == null ? void 0 : i.syncHotspots) === !0, a = /* @__PURE__ */ new Map();
|
|
5661
5661
|
for (const c of e.blocks)
|
|
5662
5662
|
c.type !== "hotspot" && a.set(c.id, { ...c });
|
|
5663
5663
|
const o = [];
|
|
5664
5664
|
for (const c of s) {
|
|
5665
|
-
const
|
|
5666
|
-
if (!
|
|
5667
|
-
const g = a.get(
|
|
5665
|
+
const d = c.blockId, u = c.blockType;
|
|
5666
|
+
if (!d || !u) continue;
|
|
5667
|
+
const g = a.get(d), _ = Math.round(c.left ?? 0), v = Math.round(c.top ?? 0);
|
|
5668
5668
|
if (u === "text") {
|
|
5669
5669
|
const f = Math.round(c.width ?? 0), b = Math.round(c.height ?? 0), x = c.text ?? "", m = g && g.type === "text" ? g : void 0, E = m ? kr(m.html ?? "") : "", R = m && E === x && m.html ? m.html : ea(x), T = m == null ? void 0 : m.style, O = {
|
|
5670
5670
|
fontFamily: c.fontFamily || (T == null ? void 0 : T.fontFamily),
|
|
@@ -5676,7 +5676,7 @@ function Gs(s, e, t, r, i) {
|
|
|
5676
5676
|
fontStyle: c.fontStyle || (T == null ? void 0 : T.fontStyle)
|
|
5677
5677
|
};
|
|
5678
5678
|
o.push({
|
|
5679
|
-
id:
|
|
5679
|
+
id: d,
|
|
5680
5680
|
type: "text",
|
|
5681
5681
|
layout: Ut(_, v, f, b, m == null ? void 0 : m.layout, t, {
|
|
5682
5682
|
preserveHeight: !0
|
|
@@ -5688,9 +5688,9 @@ function Gs(s, e, t, r, i) {
|
|
|
5688
5688
|
} else if (u === "image") {
|
|
5689
5689
|
const f = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), b = Math.round((c.height ?? 0) * (c.scaleY ?? 1)), x = c.assetId ?? (g && g.type === "image" ? g.asset : void 0);
|
|
5690
5690
|
if (!x) continue;
|
|
5691
|
-
const m = g && g.type === "image" ? g : void 0, E = Ut(_, v, f, b, m == null ? void 0 : m.layout, t), R = c.fit ?? ((
|
|
5691
|
+
const m = g && g.type === "image" ? g : void 0, E = Ut(_, v, f, b, m == null ? void 0 : m.layout, t), R = c.fit ?? ((h = m == null ? void 0 : m.layout) == null ? void 0 : h.fit);
|
|
5692
5692
|
R && (E.fit = R), o.push({
|
|
5693
|
-
id:
|
|
5693
|
+
id: d,
|
|
5694
5694
|
type: "image",
|
|
5695
5695
|
asset: x,
|
|
5696
5696
|
layout: E,
|
|
@@ -5699,7 +5699,7 @@ function Gs(s, e, t, r, i) {
|
|
|
5699
5699
|
} else if (u === "hotspot") {
|
|
5700
5700
|
const f = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), b = Math.round((c.height ?? 0) * (c.scaleY ?? 1)), x = g && g.type === "hotspot" ? g : void 0;
|
|
5701
5701
|
o.push({
|
|
5702
|
-
id:
|
|
5702
|
+
id: d,
|
|
5703
5703
|
type: "hotspot",
|
|
5704
5704
|
layout: Ut(_, v, f, b, x == null ? void 0 : x.layout, t),
|
|
5705
5705
|
onTap: c.onTap ?? (x == null ? void 0 : x.onTap) ?? [],
|
|
@@ -5708,7 +5708,7 @@ function Gs(s, e, t, r, i) {
|
|
|
5708
5708
|
}
|
|
5709
5709
|
}
|
|
5710
5710
|
for (const c of e.blocks)
|
|
5711
|
-
wr(c) && (c.type === "hotspot" && n || o.some((
|
|
5711
|
+
wr(c) && (c.type === "hotspot" && n || o.some((d) => d.id === c.id) || o.push(c));
|
|
5712
5712
|
let l = e.background ? { ...e.background } : void 0;
|
|
5713
5713
|
return typeof r == "string" && r && (l = { ...l, color: r }), {
|
|
5714
5714
|
...e,
|
|
@@ -5716,8 +5716,8 @@ function Gs(s, e, t, r, i) {
|
|
|
5716
5716
|
blocks: o
|
|
5717
5717
|
};
|
|
5718
5718
|
}
|
|
5719
|
-
function
|
|
5720
|
-
var n, a, o, l,
|
|
5719
|
+
function Xs(s, e, t) {
|
|
5720
|
+
var n, a, o, l, h, c, d, u, g, _, v;
|
|
5721
5721
|
const r = {
|
|
5722
5722
|
color: ((n = s.background) == null ? void 0 : n.color) ?? "#faf6ef"
|
|
5723
5723
|
};
|
|
@@ -5726,7 +5726,7 @@ function Js(s, e, t) {
|
|
|
5726
5726
|
for (const f of s.blocks)
|
|
5727
5727
|
if (wr(f)) {
|
|
5728
5728
|
if (f.type === "text") {
|
|
5729
|
-
const b = f.html ?? e.html.get(`htmlSrc:${f.id}`) ?? (f.htmlSrc ? e.html.get(f.htmlSrc) : void 0) ?? "", x =
|
|
5729
|
+
const b = f.html ?? e.html.get(`htmlSrc:${f.id}`) ?? (f.htmlSrc ? e.html.get(f.htmlSrc) : void 0) ?? "", x = et(f.layout, t), m = Xe((l = f.style) == null ? void 0 : l.fontSize, 18) || 18;
|
|
5730
5730
|
i.push({
|
|
5731
5731
|
kind: "text",
|
|
5732
5732
|
blockId: f.id,
|
|
@@ -5734,10 +5734,10 @@ function Js(s, e, t) {
|
|
|
5734
5734
|
left: x.x,
|
|
5735
5735
|
top: x.y,
|
|
5736
5736
|
width: Math.max(20, x.width),
|
|
5737
|
-
fontFamily: ((
|
|
5737
|
+
fontFamily: ((h = f.style) == null ? void 0 : h.fontFamily) ?? "Georgia, serif",
|
|
5738
5738
|
fontSize: m,
|
|
5739
5739
|
fill: ((c = f.style) == null ? void 0 : c.color) ?? "#1f1a14",
|
|
5740
|
-
textAlign: ((
|
|
5740
|
+
textAlign: ((d = f.style) == null ? void 0 : d.textAlign) ?? "left",
|
|
5741
5741
|
lineHeight: Qn((u = f.style) == null ? void 0 : u.lineHeight, m, 1.35),
|
|
5742
5742
|
fontWeight: (g = f.style) == null ? void 0 : g.fontWeight,
|
|
5743
5743
|
fontStyle: (_ = f.style) == null ? void 0 : _.fontStyle
|
|
@@ -5745,7 +5745,7 @@ function Js(s, e, t) {
|
|
|
5745
5745
|
} else if (f.type === "image") {
|
|
5746
5746
|
const b = e.images.get(f.asset);
|
|
5747
5747
|
if (!(b != null && b.src)) continue;
|
|
5748
|
-
const x =
|
|
5748
|
+
const x = et(f.layout, t);
|
|
5749
5749
|
i.push({
|
|
5750
5750
|
kind: "image",
|
|
5751
5751
|
blockId: f.id,
|
|
@@ -5758,7 +5758,7 @@ function Js(s, e, t) {
|
|
|
5758
5758
|
fit: (v = f.layout) == null ? void 0 : v.fit
|
|
5759
5759
|
});
|
|
5760
5760
|
} else if (f.type === "hotspot") {
|
|
5761
|
-
const b =
|
|
5761
|
+
const b = et(f.layout, t);
|
|
5762
5762
|
i.push({
|
|
5763
5763
|
kind: "hotspot",
|
|
5764
5764
|
blockId: f.id,
|
|
@@ -5776,7 +5776,7 @@ function Js(s, e, t) {
|
|
|
5776
5776
|
function ta(s) {
|
|
5777
5777
|
return s.blockType === "image" || s.blockType === "hotspot" ? Math.round((s.width ?? 0) * (s.scaleX ?? 1)) : Math.round(s.width ?? 0);
|
|
5778
5778
|
}
|
|
5779
|
-
function
|
|
5779
|
+
function Gs(s) {
|
|
5780
5780
|
return s.blockType === "image" || s.blockType === "hotspot" ? Math.round((s.height ?? 0) * (s.scaleY ?? 1)) : Math.round(s.height ?? 0);
|
|
5781
5781
|
}
|
|
5782
5782
|
function sa(s) {
|
|
@@ -5789,11 +5789,11 @@ function ua(s, e, t, r) {
|
|
|
5789
5789
|
const i = [];
|
|
5790
5790
|
let n = null, a = null;
|
|
5791
5791
|
if (s) {
|
|
5792
|
-
const o =
|
|
5792
|
+
const o = Xs(s, t, r);
|
|
5793
5793
|
n = o.background, i.push(...o.objects);
|
|
5794
5794
|
}
|
|
5795
5795
|
if (e) {
|
|
5796
|
-
const o =
|
|
5796
|
+
const o = Xs(e, t, r);
|
|
5797
5797
|
a = o.background;
|
|
5798
5798
|
for (const l of o.objects)
|
|
5799
5799
|
i.push(ra(l, r.width));
|
|
@@ -5808,39 +5808,39 @@ function ua(s, e, t, r) {
|
|
|
5808
5808
|
}
|
|
5809
5809
|
function fa(s, e, t, r, i, n) {
|
|
5810
5810
|
const a = r.width, o = [], l = [];
|
|
5811
|
-
for (const
|
|
5812
|
-
if (!
|
|
5813
|
-
const u =
|
|
5811
|
+
for (const d of s) {
|
|
5812
|
+
if (!d.blockId || !d.blockType) continue;
|
|
5813
|
+
const u = d.left ?? 0, g = ta(d), _ = u + g, v = _ <= a + 0.5, f = u >= a - 0.5;
|
|
5814
5814
|
if (v) {
|
|
5815
|
-
o.push({ ...
|
|
5815
|
+
o.push({ ...d });
|
|
5816
5816
|
continue;
|
|
5817
5817
|
}
|
|
5818
5818
|
if (f) {
|
|
5819
5819
|
l.push({
|
|
5820
|
-
...
|
|
5820
|
+
...d,
|
|
5821
5821
|
left: u - a
|
|
5822
5822
|
});
|
|
5823
5823
|
continue;
|
|
5824
5824
|
}
|
|
5825
5825
|
const b = Math.max(1, Math.round(a - u)), x = Math.max(1, Math.round(_ - a));
|
|
5826
5826
|
o.push({
|
|
5827
|
-
...
|
|
5827
|
+
...d,
|
|
5828
5828
|
width: b,
|
|
5829
5829
|
scaleX: 1,
|
|
5830
5830
|
scaleY: 1,
|
|
5831
|
-
height:
|
|
5831
|
+
height: Gs(d)
|
|
5832
5832
|
}), l.push({
|
|
5833
|
-
...
|
|
5834
|
-
blockId: sa(
|
|
5833
|
+
...d,
|
|
5834
|
+
blockId: sa(d.blockId),
|
|
5835
5835
|
left: 0,
|
|
5836
5836
|
width: x,
|
|
5837
5837
|
scaleX: 1,
|
|
5838
5838
|
scaleY: 1,
|
|
5839
|
-
height:
|
|
5839
|
+
height: Gs(d)
|
|
5840
5840
|
});
|
|
5841
5841
|
}
|
|
5842
|
-
const
|
|
5843
|
-
return { left:
|
|
5842
|
+
const h = e != null ? Js(o, e, r, i == null ? void 0 : i.left, n) : null, c = t != null ? Js(l, t, r, i == null ? void 0 : i.right, n) : null;
|
|
5843
|
+
return { left: h, right: c };
|
|
5844
5844
|
}
|
|
5845
5845
|
export {
|
|
5846
5846
|
Cr as CueTimeline,
|
|
@@ -5848,13 +5848,13 @@ export {
|
|
|
5848
5848
|
Ki as DEFAULT_LAYOUT_MODE,
|
|
5849
5849
|
Qi as DEFAULT_SINGLE_BREAKPOINT,
|
|
5850
5850
|
os as DefaultFlipStyle,
|
|
5851
|
-
|
|
5851
|
+
ha as FABRIC_CSS_FONT_SIZE_MULT,
|
|
5852
5852
|
gs as FANCI_EXTENSION,
|
|
5853
|
-
|
|
5853
|
+
Pt as FlipStyle,
|
|
5854
5854
|
Hs as HARDBACK_EDGE_RATIO,
|
|
5855
5855
|
br as Storybook,
|
|
5856
5856
|
Sn as bindApplication,
|
|
5857
|
-
|
|
5857
|
+
et as boxToPixels,
|
|
5858
5858
|
sn as buildBackCoverSpread,
|
|
5859
5859
|
tn as buildFrontCoverSpread,
|
|
5860
5860
|
nn as buildSingleSpreads,
|
|
@@ -5863,11 +5863,11 @@ export {
|
|
|
5863
5863
|
an as contentPageIds,
|
|
5864
5864
|
Zs as createFlipStyle,
|
|
5865
5865
|
Cn as createSpringrollApplication,
|
|
5866
|
-
|
|
5866
|
+
hn as downloadBlob,
|
|
5867
5867
|
Tr as extensionOf,
|
|
5868
|
-
|
|
5868
|
+
Js as fabricLikeToPage,
|
|
5869
5869
|
na as findFanciFile,
|
|
5870
|
-
|
|
5870
|
+
We as findSpreadIndexForPage,
|
|
5871
5871
|
mr as findStoryJsonPath,
|
|
5872
5872
|
la as getRegisteredFlipStyle,
|
|
5873
5873
|
Ds as hardbackEnabled,
|
|
@@ -5881,20 +5881,20 @@ export {
|
|
|
5881
5881
|
yr as loadFanciFromZip,
|
|
5882
5882
|
ns as loadStory,
|
|
5883
5883
|
cn as packFanci,
|
|
5884
|
-
|
|
5884
|
+
Xs as pageToFabricLike,
|
|
5885
5885
|
ua as pagesToSpreadFabricLike,
|
|
5886
|
-
|
|
5886
|
+
ot as parseStory,
|
|
5887
5887
|
Ms as parseVtt,
|
|
5888
5888
|
ea as plainTextToHtml,
|
|
5889
5889
|
on as primaryPageId,
|
|
5890
|
-
|
|
5890
|
+
dn as registerFlipStyle,
|
|
5891
5891
|
ca as reportSpringrollLoaded,
|
|
5892
5892
|
wn as reportSpringrollProgress,
|
|
5893
5893
|
Qn as resolveCssLineHeight,
|
|
5894
5894
|
Us as resolveFlipSpeedMs,
|
|
5895
5895
|
en as resolveLayoutMode,
|
|
5896
5896
|
js as revokeLoadedStory,
|
|
5897
|
-
|
|
5897
|
+
da as scaleBlocksToPageSize,
|
|
5898
5898
|
Ut as serializeLayoutBox,
|
|
5899
5899
|
fa as spreadFabricLikeToPages,
|
|
5900
5900
|
ci as storySchema,
|