@makefully/fancifully 0.4.0 → 0.4.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 +7 -0
- package/README.md +1 -1
- package/dist/Storybook.d.ts.map +1 -1
- package/dist/fancifully.css +1 -1
- package/dist/fancifully.iife.js +2 -2
- package/dist/fancifully.js +357 -359
- package/package.json +1 -1
package/dist/fancifully.js
CHANGED
|
@@ -215,7 +215,7 @@ function ya(s) {
|
|
|
215
215
|
if (tr(t)) return t;
|
|
216
216
|
return null;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
218
|
+
var $;
|
|
219
219
|
(function(s) {
|
|
220
220
|
s.assertEqual = (i) => {
|
|
221
221
|
};
|
|
@@ -251,7 +251,7 @@ var R;
|
|
|
251
251
|
return i.map((a) => typeof a == "string" ? `'${a}'` : a).join(n);
|
|
252
252
|
}
|
|
253
253
|
s.joinValues = r, s.jsonStringifyReplacer = (i, n) => typeof n == "bigint" ? n.toString() : n;
|
|
254
|
-
})(
|
|
254
|
+
})($ || ($ = {}));
|
|
255
255
|
var _s;
|
|
256
256
|
(function(s) {
|
|
257
257
|
s.mergeShapes = (e, t) => ({
|
|
@@ -260,7 +260,7 @@ var _s;
|
|
|
260
260
|
// second overwrites first
|
|
261
261
|
});
|
|
262
262
|
})(_s || (_s = {}));
|
|
263
|
-
const _ =
|
|
263
|
+
const _ = $.arrayToEnum([
|
|
264
264
|
"string",
|
|
265
265
|
"nan",
|
|
266
266
|
"number",
|
|
@@ -302,7 +302,7 @@ const _ = R.arrayToEnum([
|
|
|
302
302
|
default:
|
|
303
303
|
return _.unknown;
|
|
304
304
|
}
|
|
305
|
-
},
|
|
305
|
+
}, g = $.arrayToEnum([
|
|
306
306
|
"invalid_type",
|
|
307
307
|
"invalid_literal",
|
|
308
308
|
"custom",
|
|
@@ -364,7 +364,7 @@ class we extends Error {
|
|
|
364
364
|
return this.message;
|
|
365
365
|
}
|
|
366
366
|
get message() {
|
|
367
|
-
return JSON.stringify(this.issues,
|
|
367
|
+
return JSON.stringify(this.issues, $.jsonStringifyReplacer, 2);
|
|
368
368
|
}
|
|
369
369
|
get isEmpty() {
|
|
370
370
|
return this.issues.length === 0;
|
|
@@ -387,56 +387,56 @@ we.create = (s) => new we(s);
|
|
|
387
387
|
const Gt = (s, e) => {
|
|
388
388
|
let t;
|
|
389
389
|
switch (s.code) {
|
|
390
|
-
case
|
|
390
|
+
case g.invalid_type:
|
|
391
391
|
s.received === _.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
|
|
392
392
|
break;
|
|
393
|
-
case
|
|
394
|
-
t = `Invalid literal value, expected ${JSON.stringify(s.expected,
|
|
393
|
+
case g.invalid_literal:
|
|
394
|
+
t = `Invalid literal value, expected ${JSON.stringify(s.expected, $.jsonStringifyReplacer)}`;
|
|
395
395
|
break;
|
|
396
|
-
case
|
|
397
|
-
t = `Unrecognized key(s) in object: ${
|
|
396
|
+
case g.unrecognized_keys:
|
|
397
|
+
t = `Unrecognized key(s) in object: ${$.joinValues(s.keys, ", ")}`;
|
|
398
398
|
break;
|
|
399
|
-
case
|
|
399
|
+
case g.invalid_union:
|
|
400
400
|
t = "Invalid input";
|
|
401
401
|
break;
|
|
402
|
-
case
|
|
403
|
-
t = `Invalid discriminator value. Expected ${
|
|
402
|
+
case g.invalid_union_discriminator:
|
|
403
|
+
t = `Invalid discriminator value. Expected ${$.joinValues(s.options)}`;
|
|
404
404
|
break;
|
|
405
|
-
case
|
|
406
|
-
t = `Invalid enum value. Expected ${
|
|
405
|
+
case g.invalid_enum_value:
|
|
406
|
+
t = `Invalid enum value. Expected ${$.joinValues(s.options)}, received '${s.received}'`;
|
|
407
407
|
break;
|
|
408
|
-
case
|
|
408
|
+
case g.invalid_arguments:
|
|
409
409
|
t = "Invalid function arguments";
|
|
410
410
|
break;
|
|
411
|
-
case
|
|
411
|
+
case g.invalid_return_type:
|
|
412
412
|
t = "Invalid function return type";
|
|
413
413
|
break;
|
|
414
|
-
case
|
|
414
|
+
case g.invalid_date:
|
|
415
415
|
t = "Invalid date";
|
|
416
416
|
break;
|
|
417
|
-
case
|
|
418
|
-
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` :
|
|
417
|
+
case g.invalid_string:
|
|
418
|
+
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : $.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
|
|
419
419
|
break;
|
|
420
|
-
case
|
|
420
|
+
case g.too_small:
|
|
421
421
|
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "bigint" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
|
|
422
422
|
break;
|
|
423
|
-
case
|
|
423
|
+
case g.too_big:
|
|
424
424
|
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
|
|
425
425
|
break;
|
|
426
|
-
case
|
|
426
|
+
case g.custom:
|
|
427
427
|
t = "Invalid input";
|
|
428
428
|
break;
|
|
429
|
-
case
|
|
429
|
+
case g.invalid_intersection_types:
|
|
430
430
|
t = "Intersection results could not be merged";
|
|
431
431
|
break;
|
|
432
|
-
case
|
|
432
|
+
case g.not_multiple_of:
|
|
433
433
|
t = `Number must be a multiple of ${s.multipleOf}`;
|
|
434
434
|
break;
|
|
435
|
-
case
|
|
435
|
+
case g.not_finite:
|
|
436
436
|
t = "Number must be finite";
|
|
437
437
|
break;
|
|
438
438
|
default:
|
|
439
|
-
t = e.defaultError,
|
|
439
|
+
t = e.defaultError, $.assertNever(s);
|
|
440
440
|
}
|
|
441
441
|
return { message: t };
|
|
442
442
|
};
|
|
@@ -465,7 +465,7 @@ const Vr = (s) => {
|
|
|
465
465
|
message: o
|
|
466
466
|
};
|
|
467
467
|
};
|
|
468
|
-
function
|
|
468
|
+
function w(s, e) {
|
|
469
469
|
const t = Or(), r = Vr({
|
|
470
470
|
issueData: e,
|
|
471
471
|
data: s.data,
|
|
@@ -684,7 +684,7 @@ class I {
|
|
|
684
684
|
const r = (i) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(i) : t;
|
|
685
685
|
return this._refinement((i, n) => {
|
|
686
686
|
const a = e(i), o = () => n.addIssue({
|
|
687
|
-
code:
|
|
687
|
+
code: g.custom,
|
|
688
688
|
...r(i)
|
|
689
689
|
});
|
|
690
690
|
return typeof Promise < "u" && a instanceof Promise ? a.then((l) => l ? !0 : (o(), !1)) : a ? !0 : (o(), !1);
|
|
@@ -824,8 +824,8 @@ class be extends I {
|
|
|
824
824
|
_parse(e) {
|
|
825
825
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== _.string) {
|
|
826
826
|
const n = this._getOrReturnCtx(e);
|
|
827
|
-
return
|
|
828
|
-
code:
|
|
827
|
+
return w(n, {
|
|
828
|
+
code: g.invalid_type,
|
|
829
829
|
expected: _.string,
|
|
830
830
|
received: n.parsedType
|
|
831
831
|
}), T;
|
|
@@ -834,8 +834,8 @@ class be extends I {
|
|
|
834
834
|
let i;
|
|
835
835
|
for (const n of this._def.checks)
|
|
836
836
|
if (n.kind === "min")
|
|
837
|
-
e.data.length < n.value && (i = this._getOrReturnCtx(e, i),
|
|
838
|
-
code:
|
|
837
|
+
e.data.length < n.value && (i = this._getOrReturnCtx(e, i), w(i, {
|
|
838
|
+
code: g.too_small,
|
|
839
839
|
minimum: n.value,
|
|
840
840
|
type: "string",
|
|
841
841
|
inclusive: !0,
|
|
@@ -843,8 +843,8 @@ class be extends I {
|
|
|
843
843
|
message: n.message
|
|
844
844
|
}), r.dirty());
|
|
845
845
|
else if (n.kind === "max")
|
|
846
|
-
e.data.length > n.value && (i = this._getOrReturnCtx(e, i),
|
|
847
|
-
code:
|
|
846
|
+
e.data.length > n.value && (i = this._getOrReturnCtx(e, i), w(i, {
|
|
847
|
+
code: g.too_big,
|
|
848
848
|
maximum: n.value,
|
|
849
849
|
type: "string",
|
|
850
850
|
inclusive: !0,
|
|
@@ -853,15 +853,15 @@ class be extends I {
|
|
|
853
853
|
}), r.dirty());
|
|
854
854
|
else if (n.kind === "length") {
|
|
855
855
|
const a = e.data.length > n.value, o = e.data.length < n.value;
|
|
856
|
-
(a || o) && (i = this._getOrReturnCtx(e, i), a ?
|
|
857
|
-
code:
|
|
856
|
+
(a || o) && (i = this._getOrReturnCtx(e, i), a ? w(i, {
|
|
857
|
+
code: g.too_big,
|
|
858
858
|
maximum: n.value,
|
|
859
859
|
type: "string",
|
|
860
860
|
inclusive: !0,
|
|
861
861
|
exact: !0,
|
|
862
862
|
message: n.message
|
|
863
|
-
}) : o &&
|
|
864
|
-
code:
|
|
863
|
+
}) : o && w(i, {
|
|
864
|
+
code: g.too_small,
|
|
865
865
|
minimum: n.value,
|
|
866
866
|
type: "string",
|
|
867
867
|
inclusive: !0,
|
|
@@ -869,116 +869,116 @@ class be extends I {
|
|
|
869
869
|
message: n.message
|
|
870
870
|
}), r.dirty());
|
|
871
871
|
} else if (n.kind === "email")
|
|
872
|
-
Dr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
872
|
+
Dr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
873
873
|
validation: "email",
|
|
874
|
-
code:
|
|
874
|
+
code: g.invalid_string,
|
|
875
875
|
message: n.message
|
|
876
876
|
}), r.dirty());
|
|
877
877
|
else if (n.kind === "emoji")
|
|
878
|
-
zt || (zt = new RegExp(Wr, "u")), zt.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
878
|
+
zt || (zt = new RegExp(Wr, "u")), zt.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
879
879
|
validation: "emoji",
|
|
880
|
-
code:
|
|
880
|
+
code: g.invalid_string,
|
|
881
881
|
message: n.message
|
|
882
882
|
}), r.dirty());
|
|
883
883
|
else if (n.kind === "uuid")
|
|
884
|
-
jr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
884
|
+
jr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
885
885
|
validation: "uuid",
|
|
886
|
-
code:
|
|
886
|
+
code: g.invalid_string,
|
|
887
887
|
message: n.message
|
|
888
888
|
}), r.dirty());
|
|
889
889
|
else if (n.kind === "nanoid")
|
|
890
|
-
Zr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
890
|
+
Zr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
891
891
|
validation: "nanoid",
|
|
892
|
-
code:
|
|
892
|
+
code: g.invalid_string,
|
|
893
893
|
message: n.message
|
|
894
894
|
}), r.dirty());
|
|
895
895
|
else if (n.kind === "cuid")
|
|
896
|
-
Br.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
896
|
+
Br.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
897
897
|
validation: "cuid",
|
|
898
|
-
code:
|
|
898
|
+
code: g.invalid_string,
|
|
899
899
|
message: n.message
|
|
900
900
|
}), r.dirty());
|
|
901
901
|
else if (n.kind === "cuid2")
|
|
902
|
-
Fr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
902
|
+
Fr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
903
903
|
validation: "cuid2",
|
|
904
|
-
code:
|
|
904
|
+
code: g.invalid_string,
|
|
905
905
|
message: n.message
|
|
906
906
|
}), r.dirty());
|
|
907
907
|
else if (n.kind === "ulid")
|
|
908
|
-
zr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
908
|
+
zr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
909
909
|
validation: "ulid",
|
|
910
|
-
code:
|
|
910
|
+
code: g.invalid_string,
|
|
911
911
|
message: n.message
|
|
912
912
|
}), r.dirty());
|
|
913
913
|
else if (n.kind === "url")
|
|
914
914
|
try {
|
|
915
915
|
new URL(e.data);
|
|
916
916
|
} catch {
|
|
917
|
-
i = this._getOrReturnCtx(e, i),
|
|
917
|
+
i = this._getOrReturnCtx(e, i), w(i, {
|
|
918
918
|
validation: "url",
|
|
919
|
-
code:
|
|
919
|
+
code: g.invalid_string,
|
|
920
920
|
message: n.message
|
|
921
921
|
}), r.dirty();
|
|
922
922
|
}
|
|
923
|
-
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
923
|
+
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
924
924
|
validation: "regex",
|
|
925
|
-
code:
|
|
925
|
+
code: g.invalid_string,
|
|
926
926
|
message: n.message
|
|
927
|
-
}), r.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (i = this._getOrReturnCtx(e, i),
|
|
928
|
-
code:
|
|
927
|
+
}), r.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
928
|
+
code: g.invalid_string,
|
|
929
929
|
validation: { includes: n.value, position: n.position },
|
|
930
930
|
message: n.message
|
|
931
|
-
}), r.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (i = this._getOrReturnCtx(e, i),
|
|
932
|
-
code:
|
|
931
|
+
}), r.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
932
|
+
code: g.invalid_string,
|
|
933
933
|
validation: { startsWith: n.value },
|
|
934
934
|
message: n.message
|
|
935
|
-
}), r.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (i = this._getOrReturnCtx(e, i),
|
|
936
|
-
code:
|
|
935
|
+
}), r.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
936
|
+
code: g.invalid_string,
|
|
937
937
|
validation: { endsWith: n.value },
|
|
938
938
|
message: n.message
|
|
939
|
-
}), r.dirty()) : n.kind === "datetime" ? ti(n).test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
940
|
-
code:
|
|
939
|
+
}), r.dirty()) : n.kind === "datetime" ? ti(n).test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
940
|
+
code: g.invalid_string,
|
|
941
941
|
validation: "datetime",
|
|
942
942
|
message: n.message
|
|
943
|
-
}), r.dirty()) : n.kind === "date" ? Qr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
944
|
-
code:
|
|
943
|
+
}), r.dirty()) : n.kind === "date" ? Qr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
944
|
+
code: g.invalid_string,
|
|
945
945
|
validation: "date",
|
|
946
946
|
message: n.message
|
|
947
|
-
}), r.dirty()) : n.kind === "time" ? ei(n).test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
948
|
-
code:
|
|
947
|
+
}), r.dirty()) : n.kind === "time" ? ei(n).test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
948
|
+
code: g.invalid_string,
|
|
949
949
|
validation: "time",
|
|
950
950
|
message: n.message
|
|
951
|
-
}), r.dirty()) : n.kind === "duration" ? Hr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
951
|
+
}), r.dirty()) : n.kind === "duration" ? Hr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
952
952
|
validation: "duration",
|
|
953
|
-
code:
|
|
953
|
+
code: g.invalid_string,
|
|
954
954
|
message: n.message
|
|
955
|
-
}), r.dirty()) : n.kind === "ip" ? si(e.data, n.version) || (i = this._getOrReturnCtx(e, i),
|
|
955
|
+
}), r.dirty()) : n.kind === "ip" ? si(e.data, n.version) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
956
956
|
validation: "ip",
|
|
957
|
-
code:
|
|
957
|
+
code: g.invalid_string,
|
|
958
958
|
message: n.message
|
|
959
|
-
}), r.dirty()) : n.kind === "jwt" ? ri(e.data, n.alg) || (i = this._getOrReturnCtx(e, i),
|
|
959
|
+
}), r.dirty()) : n.kind === "jwt" ? ri(e.data, n.alg) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
960
960
|
validation: "jwt",
|
|
961
|
-
code:
|
|
961
|
+
code: g.invalid_string,
|
|
962
962
|
message: n.message
|
|
963
|
-
}), r.dirty()) : n.kind === "cidr" ? ii(e.data, n.version) || (i = this._getOrReturnCtx(e, i),
|
|
963
|
+
}), r.dirty()) : n.kind === "cidr" ? ii(e.data, n.version) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
964
964
|
validation: "cidr",
|
|
965
|
-
code:
|
|
965
|
+
code: g.invalid_string,
|
|
966
966
|
message: n.message
|
|
967
|
-
}), r.dirty()) : n.kind === "base64" ? Xr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
967
|
+
}), r.dirty()) : n.kind === "base64" ? Xr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
968
968
|
validation: "base64",
|
|
969
|
-
code:
|
|
969
|
+
code: g.invalid_string,
|
|
970
970
|
message: n.message
|
|
971
|
-
}), r.dirty()) : n.kind === "base64url" ? Kr.test(e.data) || (i = this._getOrReturnCtx(e, i),
|
|
971
|
+
}), r.dirty()) : n.kind === "base64url" ? Kr.test(e.data) || (i = this._getOrReturnCtx(e, i), w(i, {
|
|
972
972
|
validation: "base64url",
|
|
973
|
-
code:
|
|
973
|
+
code: g.invalid_string,
|
|
974
974
|
message: n.message
|
|
975
|
-
}), r.dirty()) :
|
|
975
|
+
}), r.dirty()) : $.assertNever(n);
|
|
976
976
|
return { status: r.value, value: e.data };
|
|
977
977
|
}
|
|
978
978
|
_regex(e, t, r) {
|
|
979
979
|
return this.refinement((i) => e.test(i), {
|
|
980
980
|
validation: t,
|
|
981
|
-
code:
|
|
981
|
+
code: g.invalid_string,
|
|
982
982
|
...S.errToObj(r)
|
|
983
983
|
});
|
|
984
984
|
}
|
|
@@ -1214,8 +1214,8 @@ class je extends I {
|
|
|
1214
1214
|
_parse(e) {
|
|
1215
1215
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== _.number) {
|
|
1216
1216
|
const n = this._getOrReturnCtx(e);
|
|
1217
|
-
return
|
|
1218
|
-
code:
|
|
1217
|
+
return w(n, {
|
|
1218
|
+
code: g.invalid_type,
|
|
1219
1219
|
expected: _.number,
|
|
1220
1220
|
received: n.parsedType
|
|
1221
1221
|
}), T;
|
|
@@ -1223,33 +1223,33 @@ class je extends I {
|
|
|
1223
1223
|
let r;
|
|
1224
1224
|
const i = new ee();
|
|
1225
1225
|
for (const n of this._def.checks)
|
|
1226
|
-
n.kind === "int" ?
|
|
1227
|
-
code:
|
|
1226
|
+
n.kind === "int" ? $.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1227
|
+
code: g.invalid_type,
|
|
1228
1228
|
expected: "integer",
|
|
1229
1229
|
received: "float",
|
|
1230
1230
|
message: n.message
|
|
1231
|
-
}), i.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r),
|
|
1232
|
-
code:
|
|
1231
|
+
}), i.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1232
|
+
code: g.too_small,
|
|
1233
1233
|
minimum: n.value,
|
|
1234
1234
|
type: "number",
|
|
1235
1235
|
inclusive: n.inclusive,
|
|
1236
1236
|
exact: !1,
|
|
1237
1237
|
message: n.message
|
|
1238
|
-
}), i.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r),
|
|
1239
|
-
code:
|
|
1238
|
+
}), i.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1239
|
+
code: g.too_big,
|
|
1240
1240
|
maximum: n.value,
|
|
1241
1241
|
type: "number",
|
|
1242
1242
|
inclusive: n.inclusive,
|
|
1243
1243
|
exact: !1,
|
|
1244
1244
|
message: n.message
|
|
1245
|
-
}), i.dirty()) : n.kind === "multipleOf" ? ni(e.data, n.value) !== 0 && (r = this._getOrReturnCtx(e, r),
|
|
1246
|
-
code:
|
|
1245
|
+
}), i.dirty()) : n.kind === "multipleOf" ? ni(e.data, n.value) !== 0 && (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1246
|
+
code: g.not_multiple_of,
|
|
1247
1247
|
multipleOf: n.value,
|
|
1248
1248
|
message: n.message
|
|
1249
|
-
}), i.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1250
|
-
code:
|
|
1249
|
+
}), i.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1250
|
+
code: g.not_finite,
|
|
1251
1251
|
message: n.message
|
|
1252
|
-
}), i.dirty()) :
|
|
1252
|
+
}), i.dirty()) : $.assertNever(n);
|
|
1253
1253
|
return { status: i.value, value: e.data };
|
|
1254
1254
|
}
|
|
1255
1255
|
gte(e, t) {
|
|
@@ -1361,7 +1361,7 @@ class je extends I {
|
|
|
1361
1361
|
return e;
|
|
1362
1362
|
}
|
|
1363
1363
|
get isInt() {
|
|
1364
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1364
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && $.isInteger(e.value));
|
|
1365
1365
|
}
|
|
1366
1366
|
get isFinite() {
|
|
1367
1367
|
let e = null, t = null;
|
|
@@ -1395,29 +1395,29 @@ class st extends I {
|
|
|
1395
1395
|
let r;
|
|
1396
1396
|
const i = new ee();
|
|
1397
1397
|
for (const n of this._def.checks)
|
|
1398
|
-
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r),
|
|
1399
|
-
code:
|
|
1398
|
+
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1399
|
+
code: g.too_small,
|
|
1400
1400
|
type: "bigint",
|
|
1401
1401
|
minimum: n.value,
|
|
1402
1402
|
inclusive: n.inclusive,
|
|
1403
1403
|
message: n.message
|
|
1404
|
-
}), i.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r),
|
|
1405
|
-
code:
|
|
1404
|
+
}), i.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1405
|
+
code: g.too_big,
|
|
1406
1406
|
type: "bigint",
|
|
1407
1407
|
maximum: n.value,
|
|
1408
1408
|
inclusive: n.inclusive,
|
|
1409
1409
|
message: n.message
|
|
1410
|
-
}), i.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r),
|
|
1411
|
-
code:
|
|
1410
|
+
}), i.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), w(r, {
|
|
1411
|
+
code: g.not_multiple_of,
|
|
1412
1412
|
multipleOf: n.value,
|
|
1413
1413
|
message: n.message
|
|
1414
|
-
}), i.dirty()) :
|
|
1414
|
+
}), i.dirty()) : $.assertNever(n);
|
|
1415
1415
|
return { status: i.value, value: e.data };
|
|
1416
1416
|
}
|
|
1417
1417
|
_getInvalidInput(e) {
|
|
1418
1418
|
const t = this._getOrReturnCtx(e);
|
|
1419
|
-
return
|
|
1420
|
-
code:
|
|
1419
|
+
return w(t, {
|
|
1420
|
+
code: g.invalid_type,
|
|
1421
1421
|
expected: _.bigint,
|
|
1422
1422
|
received: t.parsedType
|
|
1423
1423
|
}), T;
|
|
@@ -1516,8 +1516,8 @@ class Yt extends I {
|
|
|
1516
1516
|
_parse(e) {
|
|
1517
1517
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== _.boolean) {
|
|
1518
1518
|
const r = this._getOrReturnCtx(e);
|
|
1519
|
-
return
|
|
1520
|
-
code:
|
|
1519
|
+
return w(r, {
|
|
1520
|
+
code: g.invalid_type,
|
|
1521
1521
|
expected: _.boolean,
|
|
1522
1522
|
received: r.parsedType
|
|
1523
1523
|
}), T;
|
|
@@ -1534,36 +1534,36 @@ class xt extends I {
|
|
|
1534
1534
|
_parse(e) {
|
|
1535
1535
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== _.date) {
|
|
1536
1536
|
const n = this._getOrReturnCtx(e);
|
|
1537
|
-
return
|
|
1538
|
-
code:
|
|
1537
|
+
return w(n, {
|
|
1538
|
+
code: g.invalid_type,
|
|
1539
1539
|
expected: _.date,
|
|
1540
1540
|
received: n.parsedType
|
|
1541
1541
|
}), T;
|
|
1542
1542
|
}
|
|
1543
1543
|
if (Number.isNaN(e.data.getTime())) {
|
|
1544
1544
|
const n = this._getOrReturnCtx(e);
|
|
1545
|
-
return
|
|
1546
|
-
code:
|
|
1545
|
+
return w(n, {
|
|
1546
|
+
code: g.invalid_date
|
|
1547
1547
|
}), T;
|
|
1548
1548
|
}
|
|
1549
1549
|
const r = new ee();
|
|
1550
1550
|
let i;
|
|
1551
1551
|
for (const n of this._def.checks)
|
|
1552
|
-
n.kind === "min" ? e.data.getTime() < n.value && (i = this._getOrReturnCtx(e, i),
|
|
1553
|
-
code:
|
|
1552
|
+
n.kind === "min" ? e.data.getTime() < n.value && (i = this._getOrReturnCtx(e, i), w(i, {
|
|
1553
|
+
code: g.too_small,
|
|
1554
1554
|
message: n.message,
|
|
1555
1555
|
inclusive: !0,
|
|
1556
1556
|
exact: !1,
|
|
1557
1557
|
minimum: n.value,
|
|
1558
1558
|
type: "date"
|
|
1559
|
-
}), r.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (i = this._getOrReturnCtx(e, i),
|
|
1560
|
-
code:
|
|
1559
|
+
}), r.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (i = this._getOrReturnCtx(e, i), w(i, {
|
|
1560
|
+
code: g.too_big,
|
|
1561
1561
|
message: n.message,
|
|
1562
1562
|
inclusive: !0,
|
|
1563
1563
|
exact: !1,
|
|
1564
1564
|
maximum: n.value,
|
|
1565
1565
|
type: "date"
|
|
1566
|
-
}), r.dirty()) :
|
|
1566
|
+
}), r.dirty()) : $.assertNever(n);
|
|
1567
1567
|
return {
|
|
1568
1568
|
status: r.value,
|
|
1569
1569
|
value: new Date(e.data.getTime())
|
|
@@ -1612,8 +1612,8 @@ class Ts extends I {
|
|
|
1612
1612
|
_parse(e) {
|
|
1613
1613
|
if (this._getType(e) !== _.symbol) {
|
|
1614
1614
|
const r = this._getOrReturnCtx(e);
|
|
1615
|
-
return
|
|
1616
|
-
code:
|
|
1615
|
+
return w(r, {
|
|
1616
|
+
code: g.invalid_type,
|
|
1617
1617
|
expected: _.symbol,
|
|
1618
1618
|
received: r.parsedType
|
|
1619
1619
|
}), T;
|
|
@@ -1629,8 +1629,8 @@ class Jt extends I {
|
|
|
1629
1629
|
_parse(e) {
|
|
1630
1630
|
if (this._getType(e) !== _.undefined) {
|
|
1631
1631
|
const r = this._getOrReturnCtx(e);
|
|
1632
|
-
return
|
|
1633
|
-
code:
|
|
1632
|
+
return w(r, {
|
|
1633
|
+
code: g.invalid_type,
|
|
1634
1634
|
expected: _.undefined,
|
|
1635
1635
|
received: r.parsedType
|
|
1636
1636
|
}), T;
|
|
@@ -1646,8 +1646,8 @@ class Xt extends I {
|
|
|
1646
1646
|
_parse(e) {
|
|
1647
1647
|
if (this._getType(e) !== _.null) {
|
|
1648
1648
|
const r = this._getOrReturnCtx(e);
|
|
1649
|
-
return
|
|
1650
|
-
code:
|
|
1649
|
+
return w(r, {
|
|
1650
|
+
code: g.invalid_type,
|
|
1651
1651
|
expected: _.null,
|
|
1652
1652
|
received: r.parsedType
|
|
1653
1653
|
}), T;
|
|
@@ -1686,8 +1686,8 @@ Kt.create = (s) => new Kt({
|
|
|
1686
1686
|
class Ae extends I {
|
|
1687
1687
|
_parse(e) {
|
|
1688
1688
|
const t = this._getOrReturnCtx(e);
|
|
1689
|
-
return
|
|
1690
|
-
code:
|
|
1689
|
+
return w(t, {
|
|
1690
|
+
code: g.invalid_type,
|
|
1691
1691
|
expected: _.never,
|
|
1692
1692
|
received: t.parsedType
|
|
1693
1693
|
}), T;
|
|
@@ -1701,8 +1701,8 @@ class Es extends I {
|
|
|
1701
1701
|
_parse(e) {
|
|
1702
1702
|
if (this._getType(e) !== _.undefined) {
|
|
1703
1703
|
const r = this._getOrReturnCtx(e);
|
|
1704
|
-
return
|
|
1705
|
-
code:
|
|
1704
|
+
return w(r, {
|
|
1705
|
+
code: g.invalid_type,
|
|
1706
1706
|
expected: _.void,
|
|
1707
1707
|
received: r.parsedType
|
|
1708
1708
|
}), T;
|
|
@@ -1718,15 +1718,15 @@ class fe extends I {
|
|
|
1718
1718
|
_parse(e) {
|
|
1719
1719
|
const { ctx: t, status: r } = this._processInputParams(e), i = this._def;
|
|
1720
1720
|
if (t.parsedType !== _.array)
|
|
1721
|
-
return
|
|
1722
|
-
code:
|
|
1721
|
+
return w(t, {
|
|
1722
|
+
code: g.invalid_type,
|
|
1723
1723
|
expected: _.array,
|
|
1724
1724
|
received: t.parsedType
|
|
1725
1725
|
}), T;
|
|
1726
1726
|
if (i.exactLength !== null) {
|
|
1727
1727
|
const a = t.data.length > i.exactLength.value, o = t.data.length < i.exactLength.value;
|
|
1728
|
-
(a || o) && (
|
|
1729
|
-
code: a ?
|
|
1728
|
+
(a || o) && (w(t, {
|
|
1729
|
+
code: a ? g.too_big : g.too_small,
|
|
1730
1730
|
minimum: o ? i.exactLength.value : void 0,
|
|
1731
1731
|
maximum: a ? i.exactLength.value : void 0,
|
|
1732
1732
|
type: "array",
|
|
@@ -1735,15 +1735,15 @@ class fe extends I {
|
|
|
1735
1735
|
message: i.exactLength.message
|
|
1736
1736
|
}), r.dirty());
|
|
1737
1737
|
}
|
|
1738
|
-
if (i.minLength !== null && t.data.length < i.minLength.value && (
|
|
1739
|
-
code:
|
|
1738
|
+
if (i.minLength !== null && t.data.length < i.minLength.value && (w(t, {
|
|
1739
|
+
code: g.too_small,
|
|
1740
1740
|
minimum: i.minLength.value,
|
|
1741
1741
|
type: "array",
|
|
1742
1742
|
inclusive: !0,
|
|
1743
1743
|
exact: !1,
|
|
1744
1744
|
message: i.minLength.message
|
|
1745
|
-
}), r.dirty()), i.maxLength !== null && t.data.length > i.maxLength.value && (
|
|
1746
|
-
code:
|
|
1745
|
+
}), r.dirty()), i.maxLength !== null && t.data.length > i.maxLength.value && (w(t, {
|
|
1746
|
+
code: g.too_big,
|
|
1747
1747
|
maximum: i.maxLength.value,
|
|
1748
1748
|
type: "array",
|
|
1749
1749
|
inclusive: !0,
|
|
@@ -1810,14 +1810,14 @@ class G extends I {
|
|
|
1810
1810
|
_getCached() {
|
|
1811
1811
|
if (this._cached !== null)
|
|
1812
1812
|
return this._cached;
|
|
1813
|
-
const e = this._def.shape(), t =
|
|
1813
|
+
const e = this._def.shape(), t = $.objectKeys(e);
|
|
1814
1814
|
return this._cached = { shape: e, keys: t }, this._cached;
|
|
1815
1815
|
}
|
|
1816
1816
|
_parse(e) {
|
|
1817
1817
|
if (this._getType(e) !== _.object) {
|
|
1818
1818
|
const d = this._getOrReturnCtx(e);
|
|
1819
|
-
return
|
|
1820
|
-
code:
|
|
1819
|
+
return w(d, {
|
|
1820
|
+
code: g.invalid_type,
|
|
1821
1821
|
expected: _.object,
|
|
1822
1822
|
received: d.parsedType
|
|
1823
1823
|
}), T;
|
|
@@ -1844,8 +1844,8 @@ class G extends I {
|
|
|
1844
1844
|
value: { status: "valid", value: i.data[h] }
|
|
1845
1845
|
});
|
|
1846
1846
|
else if (d === "strict")
|
|
1847
|
-
o.length > 0 && (
|
|
1848
|
-
code:
|
|
1847
|
+
o.length > 0 && (w(i, {
|
|
1848
|
+
code: g.unrecognized_keys,
|
|
1849
1849
|
keys: o
|
|
1850
1850
|
}), r.dirty());
|
|
1851
1851
|
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
@@ -2017,7 +2017,7 @@ class G extends I {
|
|
|
2017
2017
|
}
|
|
2018
2018
|
pick(e) {
|
|
2019
2019
|
const t = {};
|
|
2020
|
-
for (const r of
|
|
2020
|
+
for (const r of $.objectKeys(e))
|
|
2021
2021
|
e[r] && this.shape[r] && (t[r] = this.shape[r]);
|
|
2022
2022
|
return new G({
|
|
2023
2023
|
...this._def,
|
|
@@ -2026,7 +2026,7 @@ class G extends I {
|
|
|
2026
2026
|
}
|
|
2027
2027
|
omit(e) {
|
|
2028
2028
|
const t = {};
|
|
2029
|
-
for (const r of
|
|
2029
|
+
for (const r of $.objectKeys(this.shape))
|
|
2030
2030
|
e[r] || (t[r] = this.shape[r]);
|
|
2031
2031
|
return new G({
|
|
2032
2032
|
...this._def,
|
|
@@ -2041,7 +2041,7 @@ class G extends I {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
partial(e) {
|
|
2043
2043
|
const t = {};
|
|
2044
|
-
for (const r of
|
|
2044
|
+
for (const r of $.objectKeys(this.shape)) {
|
|
2045
2045
|
const i = this.shape[r];
|
|
2046
2046
|
e && !e[r] ? t[r] = i : t[r] = i.optional();
|
|
2047
2047
|
}
|
|
@@ -2052,7 +2052,7 @@ class G extends I {
|
|
|
2052
2052
|
}
|
|
2053
2053
|
required(e) {
|
|
2054
2054
|
const t = {};
|
|
2055
|
-
for (const r of
|
|
2055
|
+
for (const r of $.objectKeys(this.shape))
|
|
2056
2056
|
if (e && !e[r])
|
|
2057
2057
|
t[r] = this.shape[r];
|
|
2058
2058
|
else {
|
|
@@ -2067,7 +2067,7 @@ class G extends I {
|
|
|
2067
2067
|
});
|
|
2068
2068
|
}
|
|
2069
2069
|
keyof() {
|
|
2070
|
-
return ir(
|
|
2070
|
+
return ir($.objectKeys(this.shape));
|
|
2071
2071
|
}
|
|
2072
2072
|
}
|
|
2073
2073
|
G.create = (s, e) => new G({
|
|
@@ -2102,8 +2102,8 @@ class _t extends I {
|
|
|
2102
2102
|
if (o.result.status === "dirty")
|
|
2103
2103
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2104
2104
|
const a = n.map((o) => new we(o.ctx.common.issues));
|
|
2105
|
-
return
|
|
2106
|
-
code:
|
|
2105
|
+
return w(t, {
|
|
2106
|
+
code: g.invalid_union,
|
|
2107
2107
|
unionErrors: a
|
|
2108
2108
|
}), T;
|
|
2109
2109
|
}
|
|
@@ -2149,8 +2149,8 @@ class _t extends I {
|
|
|
2149
2149
|
if (n)
|
|
2150
2150
|
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
2151
2151
|
const o = a.map((l) => new we(l));
|
|
2152
|
-
return
|
|
2153
|
-
code:
|
|
2152
|
+
return w(t, {
|
|
2153
|
+
code: g.invalid_union,
|
|
2154
2154
|
unionErrors: o
|
|
2155
2155
|
}), T;
|
|
2156
2156
|
}
|
|
@@ -2164,13 +2164,13 @@ _t.create = (s, e) => new _t({
|
|
|
2164
2164
|
typeName: L.ZodUnion,
|
|
2165
2165
|
...M(e)
|
|
2166
2166
|
});
|
|
2167
|
-
const ve = (s) => s instanceof es ? ve(s.schema) : s instanceof Pe ? ve(s.innerType()) : s instanceof At ? [s.value] : s instanceof Me ? s.options : s instanceof ts ?
|
|
2167
|
+
const ve = (s) => s instanceof es ? ve(s.schema) : s instanceof Pe ? ve(s.innerType()) : s instanceof At ? [s.value] : s instanceof Me ? s.options : s instanceof ts ? $.objectValues(s.enum) : s instanceof Lt ? ve(s._def.innerType) : s instanceof Jt ? [void 0] : s instanceof Xt ? [null] : s instanceof ke ? [void 0, ...ve(s.unwrap())] : s instanceof Ne ? [null, ...ve(s.unwrap())] : s instanceof nr || s instanceof Mt ? ve(s.unwrap()) : s instanceof Et ? ve(s._def.innerType) : [];
|
|
2168
2168
|
class fs extends I {
|
|
2169
2169
|
_parse(e) {
|
|
2170
2170
|
const { ctx: t } = this._processInputParams(e);
|
|
2171
2171
|
if (t.parsedType !== _.object)
|
|
2172
|
-
return
|
|
2173
|
-
code:
|
|
2172
|
+
return w(t, {
|
|
2173
|
+
code: g.invalid_type,
|
|
2174
2174
|
expected: _.object,
|
|
2175
2175
|
received: t.parsedType
|
|
2176
2176
|
}), T;
|
|
@@ -2183,8 +2183,8 @@ class fs extends I {
|
|
|
2183
2183
|
data: t.data,
|
|
2184
2184
|
path: t.path,
|
|
2185
2185
|
parent: t
|
|
2186
|
-
}) : (
|
|
2187
|
-
code:
|
|
2186
|
+
}) : (w(t, {
|
|
2187
|
+
code: g.invalid_union_discriminator,
|
|
2188
2188
|
options: Array.from(this.optionsMap.keys()),
|
|
2189
2189
|
path: [r]
|
|
2190
2190
|
}), T);
|
|
@@ -2232,7 +2232,7 @@ function Qt(s, e) {
|
|
|
2232
2232
|
if (s === e)
|
|
2233
2233
|
return { valid: !0, data: s };
|
|
2234
2234
|
if (t === _.object && r === _.object) {
|
|
2235
|
-
const i =
|
|
2235
|
+
const i = $.objectKeys(e), n = $.objectKeys(s).filter((o) => i.indexOf(o) !== -1), a = { ...s, ...e };
|
|
2236
2236
|
for (const o of n) {
|
|
2237
2237
|
const l = Qt(s[o], e[o]);
|
|
2238
2238
|
if (!l.valid)
|
|
@@ -2259,8 +2259,8 @@ class St extends I {
|
|
|
2259
2259
|
if (Ss(n) || Ss(a))
|
|
2260
2260
|
return T;
|
|
2261
2261
|
const o = Qt(n.value, a.value);
|
|
2262
|
-
return o.valid ? ((Cs(n) || Cs(a)) && t.dirty(), { status: t.value, value: o.data }) : (
|
|
2263
|
-
code:
|
|
2262
|
+
return o.valid ? ((Cs(n) || Cs(a)) && t.dirty(), { status: t.value, value: o.data }) : (w(r, {
|
|
2263
|
+
code: g.invalid_intersection_types
|
|
2264
2264
|
}), T);
|
|
2265
2265
|
};
|
|
2266
2266
|
return r.common.async ? Promise.all([
|
|
@@ -2295,21 +2295,21 @@ class Ee extends I {
|
|
|
2295
2295
|
_parse(e) {
|
|
2296
2296
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2297
2297
|
if (r.parsedType !== _.array)
|
|
2298
|
-
return
|
|
2299
|
-
code:
|
|
2298
|
+
return w(r, {
|
|
2299
|
+
code: g.invalid_type,
|
|
2300
2300
|
expected: _.array,
|
|
2301
2301
|
received: r.parsedType
|
|
2302
2302
|
}), T;
|
|
2303
2303
|
if (r.data.length < this._def.items.length)
|
|
2304
|
-
return
|
|
2305
|
-
code:
|
|
2304
|
+
return w(r, {
|
|
2305
|
+
code: g.too_small,
|
|
2306
2306
|
minimum: this._def.items.length,
|
|
2307
2307
|
inclusive: !0,
|
|
2308
2308
|
exact: !1,
|
|
2309
2309
|
type: "array"
|
|
2310
2310
|
}), T;
|
|
2311
|
-
!this._def.rest && r.data.length > this._def.items.length && (
|
|
2312
|
-
code:
|
|
2311
|
+
!this._def.rest && r.data.length > this._def.items.length && (w(r, {
|
|
2312
|
+
code: g.too_big,
|
|
2313
2313
|
maximum: this._def.items.length,
|
|
2314
2314
|
inclusive: !0,
|
|
2315
2315
|
exact: !1,
|
|
@@ -2351,8 +2351,8 @@ class Ct extends I {
|
|
|
2351
2351
|
_parse(e) {
|
|
2352
2352
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2353
2353
|
if (r.parsedType !== _.object)
|
|
2354
|
-
return
|
|
2355
|
-
code:
|
|
2354
|
+
return w(r, {
|
|
2355
|
+
code: g.invalid_type,
|
|
2356
2356
|
expected: _.object,
|
|
2357
2357
|
received: r.parsedType
|
|
2358
2358
|
}), T;
|
|
@@ -2392,8 +2392,8 @@ class Ms extends I {
|
|
|
2392
2392
|
_parse(e) {
|
|
2393
2393
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2394
2394
|
if (r.parsedType !== _.map)
|
|
2395
|
-
return
|
|
2396
|
-
code:
|
|
2395
|
+
return w(r, {
|
|
2396
|
+
code: g.invalid_type,
|
|
2397
2397
|
expected: _.map,
|
|
2398
2398
|
received: r.parsedType
|
|
2399
2399
|
}), T;
|
|
@@ -2434,21 +2434,21 @@ class rt extends I {
|
|
|
2434
2434
|
_parse(e) {
|
|
2435
2435
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2436
2436
|
if (r.parsedType !== _.set)
|
|
2437
|
-
return
|
|
2438
|
-
code:
|
|
2437
|
+
return w(r, {
|
|
2438
|
+
code: g.invalid_type,
|
|
2439
2439
|
expected: _.set,
|
|
2440
2440
|
received: r.parsedType
|
|
2441
2441
|
}), T;
|
|
2442
2442
|
const i = this._def;
|
|
2443
|
-
i.minSize !== null && r.data.size < i.minSize.value && (
|
|
2444
|
-
code:
|
|
2443
|
+
i.minSize !== null && r.data.size < i.minSize.value && (w(r, {
|
|
2444
|
+
code: g.too_small,
|
|
2445
2445
|
minimum: i.minSize.value,
|
|
2446
2446
|
type: "set",
|
|
2447
2447
|
inclusive: !0,
|
|
2448
2448
|
exact: !1,
|
|
2449
2449
|
message: i.minSize.message
|
|
2450
|
-
}), t.dirty()), i.maxSize !== null && r.data.size > i.maxSize.value && (
|
|
2451
|
-
code:
|
|
2450
|
+
}), t.dirty()), i.maxSize !== null && r.data.size > i.maxSize.value && (w(r, {
|
|
2451
|
+
code: g.too_big,
|
|
2452
2452
|
maximum: i.maxSize.value,
|
|
2453
2453
|
type: "set",
|
|
2454
2454
|
inclusive: !0,
|
|
@@ -2512,9 +2512,9 @@ class At extends I {
|
|
|
2512
2512
|
_parse(e) {
|
|
2513
2513
|
if (e.data !== this._def.value) {
|
|
2514
2514
|
const t = this._getOrReturnCtx(e);
|
|
2515
|
-
return
|
|
2515
|
+
return w(t, {
|
|
2516
2516
|
received: t.data,
|
|
2517
|
-
code:
|
|
2517
|
+
code: g.invalid_literal,
|
|
2518
2518
|
expected: this._def.value
|
|
2519
2519
|
}), T;
|
|
2520
2520
|
}
|
|
@@ -2540,17 +2540,17 @@ class Me extends I {
|
|
|
2540
2540
|
_parse(e) {
|
|
2541
2541
|
if (typeof e.data != "string") {
|
|
2542
2542
|
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2543
|
-
return
|
|
2544
|
-
expected:
|
|
2543
|
+
return w(t, {
|
|
2544
|
+
expected: $.joinValues(r),
|
|
2545
2545
|
received: t.parsedType,
|
|
2546
|
-
code:
|
|
2546
|
+
code: g.invalid_type
|
|
2547
2547
|
}), T;
|
|
2548
2548
|
}
|
|
2549
2549
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2550
2550
|
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2551
|
-
return
|
|
2551
|
+
return w(t, {
|
|
2552
2552
|
received: t.data,
|
|
2553
|
-
code:
|
|
2553
|
+
code: g.invalid_enum_value,
|
|
2554
2554
|
options: r
|
|
2555
2555
|
}), T;
|
|
2556
2556
|
}
|
|
@@ -2593,20 +2593,20 @@ class Me extends I {
|
|
|
2593
2593
|
Me.create = ir;
|
|
2594
2594
|
class ts extends I {
|
|
2595
2595
|
_parse(e) {
|
|
2596
|
-
const t =
|
|
2596
|
+
const t = $.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
2597
2597
|
if (r.parsedType !== _.string && r.parsedType !== _.number) {
|
|
2598
|
-
const i =
|
|
2599
|
-
return
|
|
2600
|
-
expected:
|
|
2598
|
+
const i = $.objectValues(t);
|
|
2599
|
+
return w(r, {
|
|
2600
|
+
expected: $.joinValues(i),
|
|
2601
2601
|
received: r.parsedType,
|
|
2602
|
-
code:
|
|
2602
|
+
code: g.invalid_type
|
|
2603
2603
|
}), T;
|
|
2604
2604
|
}
|
|
2605
|
-
if (this._cache || (this._cache = new Set(
|
|
2606
|
-
const i =
|
|
2607
|
-
return
|
|
2605
|
+
if (this._cache || (this._cache = new Set($.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2606
|
+
const i = $.objectValues(t);
|
|
2607
|
+
return w(r, {
|
|
2608
2608
|
received: r.data,
|
|
2609
|
-
code:
|
|
2609
|
+
code: g.invalid_enum_value,
|
|
2610
2610
|
options: i
|
|
2611
2611
|
}), T;
|
|
2612
2612
|
}
|
|
@@ -2628,8 +2628,8 @@ class Tt extends I {
|
|
|
2628
2628
|
_parse(e) {
|
|
2629
2629
|
const { ctx: t } = this._processInputParams(e);
|
|
2630
2630
|
if (t.parsedType !== _.promise && t.common.async === !1)
|
|
2631
|
-
return
|
|
2632
|
-
code:
|
|
2631
|
+
return w(t, {
|
|
2632
|
+
code: g.invalid_type,
|
|
2633
2633
|
expected: _.promise,
|
|
2634
2634
|
received: t.parsedType
|
|
2635
2635
|
}), T;
|
|
@@ -2655,7 +2655,7 @@ class Pe extends I {
|
|
|
2655
2655
|
_parse(e) {
|
|
2656
2656
|
const { status: t, ctx: r } = this._processInputParams(e), i = this._def.effect || null, n = {
|
|
2657
2657
|
addIssue: (a) => {
|
|
2658
|
-
|
|
2658
|
+
w(r, a), a.fatal ? t.abort() : t.dirty();
|
|
2659
2659
|
},
|
|
2660
2660
|
get path() {
|
|
2661
2661
|
return r.path;
|
|
@@ -2722,7 +2722,7 @@ class Pe extends I {
|
|
|
2722
2722
|
status: t.value,
|
|
2723
2723
|
value: o
|
|
2724
2724
|
})) : T);
|
|
2725
|
-
|
|
2725
|
+
$.assertNever(i);
|
|
2726
2726
|
}
|
|
2727
2727
|
}
|
|
2728
2728
|
Pe.create = (s, e, t) => new Pe({
|
|
@@ -2830,8 +2830,8 @@ class Ps extends I {
|
|
|
2830
2830
|
_parse(e) {
|
|
2831
2831
|
if (this._getType(e) !== _.nan) {
|
|
2832
2832
|
const r = this._getOrReturnCtx(e);
|
|
2833
|
-
return
|
|
2834
|
-
code:
|
|
2833
|
+
return w(r, {
|
|
2834
|
+
code: g.invalid_type,
|
|
2835
2835
|
expected: _.nan,
|
|
2836
2836
|
received: r.parsedType
|
|
2837
2837
|
}), T;
|
|
@@ -3103,12 +3103,12 @@ function Is(s) {
|
|
|
3103
3103
|
if (l === -1) continue;
|
|
3104
3104
|
const d = l > 0 ? o[0] : void 0, h = o[l], c = o.slice(l + 1), u = h.split("-->").map((m) => m.trim().split(/\s+/)[0]);
|
|
3105
3105
|
if (u.length < 2) continue;
|
|
3106
|
-
const v = $s(u[0]),
|
|
3106
|
+
const v = $s(u[0]), k = $s(u[1]), b = c.join(" ").trim(), f = d || b || `cue-${n++}`;
|
|
3107
3107
|
i.push({
|
|
3108
3108
|
id: f,
|
|
3109
3109
|
start: v,
|
|
3110
|
-
end:
|
|
3111
|
-
text:
|
|
3110
|
+
end: k,
|
|
3111
|
+
text: b || void 0
|
|
3112
3112
|
});
|
|
3113
3113
|
}
|
|
3114
3114
|
return i;
|
|
@@ -3319,14 +3319,14 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3319
3319
|
var Re = new W(Math.max(De * 2, He));
|
|
3320
3320
|
Re.set(t), t = Re;
|
|
3321
3321
|
}
|
|
3322
|
-
}, h = e.f || 0, c = e.p || 0, u = e.b || 0, v = e.l,
|
|
3322
|
+
}, h = e.f || 0, c = e.p || 0, u = e.b || 0, v = e.l, k = e.d, b = e.m, f = e.n, m = i * 8;
|
|
3323
3323
|
do {
|
|
3324
3324
|
if (!v) {
|
|
3325
3325
|
h = le(s, c, 1);
|
|
3326
3326
|
var C = le(s, c + 1, 3);
|
|
3327
3327
|
if (c += 3, C)
|
|
3328
3328
|
if (C == 1)
|
|
3329
|
-
v = bi,
|
|
3329
|
+
v = bi, k = wi, b = 9, f = 5;
|
|
3330
3330
|
else if (C == 2) {
|
|
3331
3331
|
var O = le(s, c, 31) + 257, A = le(s, c + 10, 15) + 4, P = O + le(s, c + 5, 31) + 1;
|
|
3332
3332
|
c += 14;
|
|
@@ -3336,26 +3336,26 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3336
3336
|
for (var q = jt(H), ie = (1 << q) - 1, V = pe(H, q, 1), Z = 0; Z < P; ) {
|
|
3337
3337
|
var j = V[le(s, c, ie)];
|
|
3338
3338
|
c += j & 15;
|
|
3339
|
-
var
|
|
3340
|
-
if (
|
|
3341
|
-
E[Z++] =
|
|
3339
|
+
var p = j >> 4;
|
|
3340
|
+
if (p < 16)
|
|
3341
|
+
E[Z++] = p;
|
|
3342
3342
|
else {
|
|
3343
3343
|
var D = 0, z = 0;
|
|
3344
|
-
for (
|
|
3344
|
+
for (p == 16 ? (z = 3 + le(s, c, 3), c += 2, D = E[Z - 1]) : p == 17 ? (z = 3 + le(s, c, 7), c += 3) : p == 18 && (z = 11 + le(s, c, 127), c += 7); z--; )
|
|
3345
3345
|
E[Z++] = D;
|
|
3346
3346
|
}
|
|
3347
3347
|
}
|
|
3348
3348
|
var Y = E.subarray(0, O), J = E.subarray(O);
|
|
3349
|
-
|
|
3349
|
+
b = jt(Y), f = jt(J), v = pe(Y, b, 1), k = pe(J, f, 1);
|
|
3350
3350
|
} else
|
|
3351
3351
|
K(1);
|
|
3352
3352
|
else {
|
|
3353
|
-
var
|
|
3354
|
-
if (
|
|
3353
|
+
var p = ms(c) + 4, x = s[p - 4] | s[p - 3] << 8, R = p + x;
|
|
3354
|
+
if (R > i) {
|
|
3355
3355
|
l && K(0);
|
|
3356
3356
|
break;
|
|
3357
3357
|
}
|
|
3358
|
-
o && d(u +
|
|
3358
|
+
o && d(u + x), t.set(s.subarray(p, R), u), e.b = u += x, e.p = c = R * 8, e.f = h;
|
|
3359
3359
|
continue;
|
|
3360
3360
|
}
|
|
3361
3361
|
if (c > m) {
|
|
@@ -3364,7 +3364,7 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3364
3364
|
}
|
|
3365
3365
|
}
|
|
3366
3366
|
o && d(u + 131072);
|
|
3367
|
-
for (var Ue = (1 <<
|
|
3367
|
+
for (var Ue = (1 << b) - 1, ne = (1 << f) - 1, me = c; ; me = c) {
|
|
3368
3368
|
var D = v[Zt(s, c) & Ue], te = D >> 4;
|
|
3369
3369
|
if (c += D & 15, c > m) {
|
|
3370
3370
|
l && K(0);
|
|
@@ -3381,7 +3381,7 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3381
3381
|
var Z = te - 257, U = It[Z];
|
|
3382
3382
|
se = le(s, c, (1 << U) - 1) + dr[Z], c += U;
|
|
3383
3383
|
}
|
|
3384
|
-
var ce =
|
|
3384
|
+
var ce = k[Zt(s, c) & ne], Ie = ce >> 4;
|
|
3385
3385
|
ce || K(3), c += ce & 15;
|
|
3386
3386
|
var J = yi[Ie];
|
|
3387
3387
|
if (Ie > 3) {
|
|
@@ -3403,7 +3403,7 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3403
3403
|
t[u] = t[u - J];
|
|
3404
3404
|
}
|
|
3405
3405
|
}
|
|
3406
|
-
e.l = v, e.p = me, e.b = u, e.f = h, v && (h = 1, e.m =
|
|
3406
|
+
e.l = v, e.p = me, e.b = u, e.f = h, v && (h = 1, e.m = b, e.d = k, e.n = f);
|
|
3407
3407
|
} while (!h);
|
|
3408
3408
|
return u != t.length && a ? ct(t, 0, u) : t.subarray(0, u);
|
|
3409
3409
|
}, ye = function(s, e, t) {
|
|
@@ -3424,37 +3424,37 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3424
3424
|
var a = new W(t[0].s + 1);
|
|
3425
3425
|
return a[t[0].s] = 1, { t: a, l: 1 };
|
|
3426
3426
|
}
|
|
3427
|
-
t.sort(function(
|
|
3428
|
-
return
|
|
3427
|
+
t.sort(function(R, O) {
|
|
3428
|
+
return R.f - O.f;
|
|
3429
3429
|
}), t.push({ s: -1, f: 25001 });
|
|
3430
3430
|
var o = t[0], l = t[1], d = 0, h = 1, c = 2;
|
|
3431
3431
|
for (t[0] = { s: -1, f: o.f + l.f, l: o, r: l }; h != i - 1; )
|
|
3432
3432
|
o = t[t[d].f < t[c].f ? d++ : c++], l = t[d != h && t[d].f < t[c].f ? d++ : c++], t[h++] = { s: -1, f: o.f + l.f, l: o, r: l };
|
|
3433
3433
|
for (var u = n[0].s, r = 1; r < i; ++r)
|
|
3434
3434
|
n[r].s > u && (u = n[r].s);
|
|
3435
|
-
var v = new re(u + 1),
|
|
3436
|
-
if (
|
|
3437
|
-
var r = 0,
|
|
3435
|
+
var v = new re(u + 1), k = as(t[h - 1], v, 0);
|
|
3436
|
+
if (k > e) {
|
|
3437
|
+
var r = 0, b = 0, f = k - e, m = 1 << f;
|
|
3438
3438
|
for (n.sort(function(O, A) {
|
|
3439
3439
|
return v[A.s] - v[O.s] || O.f - A.f;
|
|
3440
3440
|
}); r < i; ++r) {
|
|
3441
3441
|
var C = n[r].s;
|
|
3442
3442
|
if (v[C] > e)
|
|
3443
|
-
|
|
3443
|
+
b += m - (1 << k - v[C]), v[C] = e;
|
|
3444
3444
|
else
|
|
3445
3445
|
break;
|
|
3446
3446
|
}
|
|
3447
|
-
for (
|
|
3448
|
-
var
|
|
3449
|
-
v[
|
|
3447
|
+
for (b >>= f; b > 0; ) {
|
|
3448
|
+
var p = n[r].s;
|
|
3449
|
+
v[p] < e ? b -= 1 << e - v[p]++ - 1 : ++r;
|
|
3450
3450
|
}
|
|
3451
|
-
for (; r >= 0 &&
|
|
3452
|
-
var
|
|
3453
|
-
v[
|
|
3451
|
+
for (; r >= 0 && b; --r) {
|
|
3452
|
+
var x = n[r].s;
|
|
3453
|
+
v[x] == e && (--v[x], ++b);
|
|
3454
3454
|
}
|
|
3455
|
-
|
|
3455
|
+
k = e;
|
|
3456
3456
|
}
|
|
3457
|
-
return { t: new W(v), l:
|
|
3457
|
+
return { t: new W(v), l: k };
|
|
3458
3458
|
}, as = function(s, e, t) {
|
|
3459
3459
|
return s.s == -1 ? Math.max(as(s.l, e, t + 1), as(s.r, e, t + 1)) : e[s.s] = t;
|
|
3460
3460
|
}, Os = function(s) {
|
|
@@ -3492,24 +3492,24 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3492
3492
|
return (i + 4 + r) * 8;
|
|
3493
3493
|
}, Vs = function(s, e, t, r, i, n, a, o, l, d, h) {
|
|
3494
3494
|
ye(e, h++, t), ++i[256];
|
|
3495
|
-
for (var c = Ut(i, 15), u = c.t, v = c.l,
|
|
3495
|
+
for (var c = Ut(i, 15), u = c.t, v = c.l, k = Ut(n, 15), b = k.t, f = k.l, m = Os(u), C = m.c, p = m.n, x = Os(b), R = x.c, O = x.n, A = new re(19), P = 0; P < C.length; ++P)
|
|
3496
3496
|
++A[C[P] & 31];
|
|
3497
|
-
for (var P = 0; P <
|
|
3498
|
-
++A[
|
|
3497
|
+
for (var P = 0; P < R.length; ++P)
|
|
3498
|
+
++A[R[P] & 31];
|
|
3499
3499
|
for (var E = Ut(A, 7), H = E.t, Z = E.l, q = 19; q > 4 && !H[rs[q - 1]]; --q)
|
|
3500
3500
|
;
|
|
3501
|
-
var ie = d + 5 << 3, V = qe(i, Te) + qe(n, it) + a, j = qe(i, u) + qe(n,
|
|
3501
|
+
var ie = d + 5 << 3, V = qe(i, Te) + qe(n, it) + a, j = qe(i, u) + qe(n, b) + a + 14 + 3 * q + qe(A, H) + 2 * A[16] + 3 * A[17] + 7 * A[18];
|
|
3502
3502
|
if (l >= 0 && ie <= V && ie <= j)
|
|
3503
3503
|
return ur(e, h, s.subarray(l, l + d));
|
|
3504
3504
|
var D, z, Y, J;
|
|
3505
3505
|
if (ye(e, h, 1 + (j < V)), h += 2, j < V) {
|
|
3506
|
-
D = pe(u, v, 0), z = u, Y = pe(
|
|
3506
|
+
D = pe(u, v, 0), z = u, Y = pe(b, f, 0), J = b;
|
|
3507
3507
|
var Ue = pe(H, Z, 0);
|
|
3508
|
-
ye(e, h,
|
|
3508
|
+
ye(e, h, p - 257), ye(e, h + 5, O - 1), ye(e, h + 10, q - 4), h += 14;
|
|
3509
3509
|
for (var P = 0; P < q; ++P)
|
|
3510
3510
|
ye(e, h + 3 * P, H[rs[P]]);
|
|
3511
3511
|
h += 3 * q;
|
|
3512
|
-
for (var ne = [C,
|
|
3512
|
+
for (var ne = [C, R], me = 0; me < 2; ++me)
|
|
3513
3513
|
for (var te = ne[me], P = 0; P < te.length; ++P) {
|
|
3514
3514
|
var se = te[P] & 31;
|
|
3515
3515
|
ye(e, h, Ue[se]), h += H[se], se > 15 && (ye(e, h, te[P] >> 5 & 127), h += te[P] >> 12);
|
|
@@ -3531,21 +3531,21 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3531
3531
|
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), d = n.l, h = (n.r || 0) & 7;
|
|
3532
3532
|
if (e) {
|
|
3533
3533
|
h && (l[0] = n.r >> 3);
|
|
3534
|
-
for (var c = Si[e - 1], u = c >> 13, v = c & 8191,
|
|
3535
|
-
return (s[Bt] ^ s[Bt + 1] << m ^ s[Bt + 2] << C) &
|
|
3536
|
-
},
|
|
3537
|
-
var ie =
|
|
3538
|
-
if (
|
|
3534
|
+
for (var c = Si[e - 1], u = c >> 13, v = c & 8191, k = (1 << t) - 1, b = n.p || new re(32768), f = n.h || new re(k + 1), m = Math.ceil(t / 3), C = 2 * m, p = function(Bt) {
|
|
3535
|
+
return (s[Bt] ^ s[Bt + 1] << m ^ s[Bt + 2] << C) & k;
|
|
3536
|
+
}, x = new gs(25e3), R = new re(288), O = new re(32), A = 0, P = 0, E = n.i || 0, H = 0, Z = n.w || 0, q = 0; E + 2 < a; ++E) {
|
|
3537
|
+
var ie = p(E), V = E & 32767, j = f[ie];
|
|
3538
|
+
if (b[V] = j, f[ie] = V, Z <= E) {
|
|
3539
3539
|
var D = a - E;
|
|
3540
3540
|
if ((A > 7e3 || H > 24576) && (D > 423 || !d)) {
|
|
3541
|
-
h = Vs(s, l, 0,
|
|
3541
|
+
h = Vs(s, l, 0, x, R, O, P, H, q, E - q, h), H = A = P = 0, q = E;
|
|
3542
3542
|
for (var z = 0; z < 286; ++z)
|
|
3543
|
-
|
|
3543
|
+
R[z] = 0;
|
|
3544
3544
|
for (var z = 0; z < 30; ++z)
|
|
3545
3545
|
O[z] = 0;
|
|
3546
3546
|
}
|
|
3547
3547
|
var Y = 2, J = 0, Ue = v, ne = V - j & 32767;
|
|
3548
|
-
if (D > 2 && ie ==
|
|
3548
|
+
if (D > 2 && ie == p(E - ne))
|
|
3549
3549
|
for (var me = Math.min(u, D) - 1, te = Math.min(32767, E), se = Math.min(258, D); ne <= te && --Ue && V != j; ) {
|
|
3550
3550
|
if (s[E + Y] == s[E + Y - ne]) {
|
|
3551
3551
|
for (var U = 0; U < se && s[E + U] == s[E + U - ne]; ++U)
|
|
@@ -3554,24 +3554,24 @@ var vi = /* @__PURE__ */ pe(Te, 9, 0), bi = /* @__PURE__ */ pe(Te, 9, 1), ki = /
|
|
|
3554
3554
|
if (Y = U, J = ne, U > me)
|
|
3555
3555
|
break;
|
|
3556
3556
|
for (var ce = Math.min(ne, U - 2), Ie = 0, z = 0; z < ce; ++z) {
|
|
3557
|
-
var $e = E - ne + z & 32767, dt =
|
|
3557
|
+
var $e = E - ne + z & 32767, dt = b[$e], ht = $e - dt & 32767;
|
|
3558
3558
|
ht > Ie && (Ie = ht, j = $e);
|
|
3559
3559
|
}
|
|
3560
3560
|
}
|
|
3561
3561
|
}
|
|
3562
|
-
V = j, j =
|
|
3562
|
+
V = j, j = b[V], ne += V - j & 32767;
|
|
3563
3563
|
}
|
|
3564
3564
|
if (J) {
|
|
3565
|
-
|
|
3565
|
+
x[H++] = 268435456 | is[Y] << 18 | Rs[J];
|
|
3566
3566
|
var He = is[Y] & 31, De = Rs[J] & 31;
|
|
3567
|
-
P += It[He] + $t[De],
|
|
3567
|
+
P += It[He] + $t[De], ++R[257 + He], ++O[De], Z = E + Y, ++A;
|
|
3568
3568
|
} else
|
|
3569
|
-
|
|
3569
|
+
x[H++] = s[E], ++R[s[E]];
|
|
3570
3570
|
}
|
|
3571
3571
|
}
|
|
3572
3572
|
for (E = Math.max(E, Z); E < a; ++E)
|
|
3573
|
-
|
|
3574
|
-
h = Vs(s, l, d,
|
|
3573
|
+
x[H++] = s[E], ++R[s[E]];
|
|
3574
|
+
h = Vs(s, l, d, x, R, O, P, H, q, E - q, h), d || (n.r = h & 7 | l[h / 8 | 0] << 3, h -= 7, n.h = f, n.p = b, n.i = E, n.w = Z);
|
|
3575
3575
|
} else {
|
|
3576
3576
|
for (var E = n.w || 0; E < a + d; E += 65535) {
|
|
3577
3577
|
var Re = E + 65535;
|
|
@@ -3706,9 +3706,9 @@ var Ii = function(s, e) {
|
|
|
3706
3706
|
X(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;
|
|
3707
3707
|
var u = new Date(t.mtime == null ? Date.now() : t.mtime), v = u.getFullYear() - 1980;
|
|
3708
3708
|
if ((v < 0 || v > 119) && K(10), X(s, e, v << 25 | u.getMonth() + 1 << 21 | u.getDate() << 16 | u.getHours() << 11 | u.getMinutes() << 5 | u.getSeconds() >> 1), e += 4, n != -1 && (X(s, e, t.crc), X(s, e + 4, n < 0 ? -n - 2 : n), X(s, e + 8, t.size)), X(s, e + 12, l), X(s, e + 14, c), e += 16, a != null && (X(s, e, h), X(s, e + 6, t.attrs), X(s, e + 10, a), e += 14), s.set(r, e), e += l, c)
|
|
3709
|
-
for (var
|
|
3710
|
-
var
|
|
3711
|
-
X(s, e, +
|
|
3709
|
+
for (var k in d) {
|
|
3710
|
+
var b = d[k], f = b.length;
|
|
3711
|
+
X(s, e, +k), X(s, e + 2, f), s.set(b, e + 4), e += 4 + f;
|
|
3712
3712
|
}
|
|
3713
3713
|
return h && (s.set(o, e), e += h), e;
|
|
3714
3714
|
}, Oi = function(s, e, t, r, i) {
|
|
@@ -3720,27 +3720,27 @@ function Vi(s, e) {
|
|
|
3720
3720
|
gr(s, "", t, e);
|
|
3721
3721
|
var i = 0, n = 0;
|
|
3722
3722
|
for (var a in t) {
|
|
3723
|
-
var o = t[a], l = o[0], d = o[1], h = d.level == 0 ? 0 : 8, c = ls(a), u = c.length, v = d.comment,
|
|
3723
|
+
var o = t[a], l = o[0], d = o[1], h = d.level == 0 ? 0 : 8, c = ls(a), u = c.length, v = d.comment, k = v && ls(v), b = k && k.length, f = cs(d.extra);
|
|
3724
3724
|
u > 65535 && K(11);
|
|
3725
|
-
var m = h ? Ei(l, d) : l, C = m.length,
|
|
3726
|
-
|
|
3725
|
+
var m = h ? Ei(l, d) : l, C = m.length, p = Ti();
|
|
3726
|
+
p.p(l), r.push(pr(d, {
|
|
3727
3727
|
size: l.length,
|
|
3728
|
-
crc:
|
|
3728
|
+
crc: p.d(),
|
|
3729
3729
|
c: m,
|
|
3730
3730
|
f: c,
|
|
3731
|
-
m:
|
|
3732
|
-
u: u != a.length ||
|
|
3731
|
+
m: k,
|
|
3732
|
+
u: u != a.length || k && v.length != b,
|
|
3733
3733
|
o: i,
|
|
3734
3734
|
compression: h
|
|
3735
|
-
})), i += 30 + u + f + C, n += 76 + 2 * (u + f) + (
|
|
3735
|
+
})), i += 30 + u + f + C, n += 76 + 2 * (u + f) + (b || 0) + C;
|
|
3736
3736
|
}
|
|
3737
|
-
for (var
|
|
3737
|
+
for (var x = new W(n + 22), R = i, O = n - i, A = 0; A < r.length; ++A) {
|
|
3738
3738
|
var c = r[A];
|
|
3739
|
-
Fs(
|
|
3739
|
+
Fs(x, c.o, c, c.f, c.u, c.c.length);
|
|
3740
3740
|
var P = 30 + c.f.length + cs(c.extra);
|
|
3741
|
-
|
|
3741
|
+
x.set(c.c, c.o + P), Fs(x, i, c, c.f, c.u, c.c.length, c.o, c.m), i += 16 + P + (c.m ? c.m.length : 0);
|
|
3742
3742
|
}
|
|
3743
|
-
return Oi(
|
|
3743
|
+
return Oi(x, i, r.length, O, R), x;
|
|
3744
3744
|
}
|
|
3745
3745
|
function Bi(s, e) {
|
|
3746
3746
|
for (var t = {}, r = s.length - 22; ae(s, r) != 101010256; --r)
|
|
@@ -3754,8 +3754,8 @@ function Bi(s, e) {
|
|
|
3754
3754
|
a = ae(s, o) == 101075792, a && (i = ae(s, o + 32), n = ae(s, o + 48));
|
|
3755
3755
|
}
|
|
3756
3756
|
for (var l = 0; l < i; ++l) {
|
|
3757
|
-
var d = $i(s, n, a), h = d[0], c = d[1], u = d[2], v = d[3],
|
|
3758
|
-
n =
|
|
3757
|
+
var d = $i(s, n, a), h = d[0], c = d[1], u = d[2], v = d[3], k = d[4], b = d[5], f = Ii(s, b);
|
|
3758
|
+
n = k, h ? h == 8 ? t[v] = Mi(s.subarray(f, f + c), { out: new W(u) }) : K(14, "unknown compression type " + h) : t[v] = ct(s, f, f + c);
|
|
3759
3759
|
}
|
|
3760
3760
|
return t;
|
|
3761
3761
|
}
|
|
@@ -3862,14 +3862,14 @@ function vr(s) {
|
|
|
3862
3862
|
const C = Rt(s, m);
|
|
3863
3863
|
if (!C)
|
|
3864
3864
|
throw new Error(`EPUB missing file: ${m}`);
|
|
3865
|
-
const
|
|
3866
|
-
return h.push(
|
|
3867
|
-
}, v = {},
|
|
3865
|
+
const p = yr(C, m);
|
|
3866
|
+
return h.push(p), c.set(m, p), p;
|
|
3867
|
+
}, v = {}, k = [];
|
|
3868
3868
|
if (d.forEach((f, m) => {
|
|
3869
3869
|
const C = l.get(f);
|
|
3870
3870
|
if (!C || !/html|xml/i.test(C.mediaType) && !C.href.match(/\.x?html?$/i)) return;
|
|
3871
|
-
const
|
|
3872
|
-
const j = ue(V.includes(":") ? V : `${
|
|
3871
|
+
const p = C.href, x = Xe(s, p), R = p.includes("/") ? p.replace(/\/[^/]+$/, "/") : "", O = `page-${m + 1}`, A = qi(x), { html: P, imageHrefs: E } = Gi(A, R, (V) => {
|
|
3872
|
+
const j = ue(V.includes(":") ? V : `${R}${V}`);
|
|
3873
3873
|
try {
|
|
3874
3874
|
return u(j);
|
|
3875
3875
|
} catch {
|
|
@@ -3904,13 +3904,13 @@ function vr(s) {
|
|
|
3904
3904
|
}
|
|
3905
3905
|
}
|
|
3906
3906
|
}
|
|
3907
|
-
|
|
3907
|
+
k.push({
|
|
3908
3908
|
id: O,
|
|
3909
3909
|
background: q,
|
|
3910
3910
|
readAloud: ie,
|
|
3911
3911
|
blocks: H
|
|
3912
3912
|
});
|
|
3913
|
-
}),
|
|
3913
|
+
}), k.length === 0)
|
|
3914
3914
|
throw new Error("Invalid EPUB: no spine HTML documents found");
|
|
3915
3915
|
return { story: lt({
|
|
3916
3916
|
id: `epub-${Yi(a)}`,
|
|
@@ -3918,7 +3918,7 @@ function vr(s) {
|
|
|
3918
3918
|
pageSize: o,
|
|
3919
3919
|
fonts: [],
|
|
3920
3920
|
assets: v,
|
|
3921
|
-
pages:
|
|
3921
|
+
pages: k
|
|
3922
3922
|
}), blobUrls: h };
|
|
3923
3923
|
}
|
|
3924
3924
|
function Zi(s) {
|
|
@@ -4162,15 +4162,15 @@ function Us(s) {
|
|
|
4162
4162
|
return s instanceof ArrayBuffer || s instanceof Uint8Array || s instanceof Blob || typeof File < "u" && s instanceof File;
|
|
4163
4163
|
}
|
|
4164
4164
|
async function tt(s, e, t, r, i) {
|
|
4165
|
-
var
|
|
4165
|
+
var k;
|
|
4166
4166
|
const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), d = Object.entries(s.assets), h = [];
|
|
4167
|
-
for (const
|
|
4168
|
-
for (const f of
|
|
4167
|
+
for (const b of s.pages)
|
|
4168
|
+
for (const f of b.blocks)
|
|
4169
4169
|
if (f.type === "text" && f.htmlSrc && !f.html && h.push(async () => {
|
|
4170
4170
|
const m = Fe(e, f.htmlSrc);
|
|
4171
4171
|
l.set(`htmlSrc:${f.id}`, await pt(m));
|
|
4172
|
-
}), (
|
|
4173
|
-
const m =
|
|
4172
|
+
}), (k = b.readAloud) != null && k.cues && typeof b.readAloud.cues == "string") {
|
|
4173
|
+
const m = b.readAloud.cues;
|
|
4174
4174
|
s.assets[m] || h.push(async () => {
|
|
4175
4175
|
const C = Fe(e, m);
|
|
4176
4176
|
try {
|
|
@@ -4181,7 +4181,7 @@ async function tt(s, e, t, r, i) {
|
|
|
4181
4181
|
}
|
|
4182
4182
|
const c = d.length + h.length || 1;
|
|
4183
4183
|
let u = 0;
|
|
4184
|
-
const v = (
|
|
4184
|
+
const v = (b) => {
|
|
4185
4185
|
u += 1;
|
|
4186
4186
|
const f = u / c, m = r + (i - r) * Math.min(1, f);
|
|
4187
4187
|
t({
|
|
@@ -4189,17 +4189,17 @@ async function tt(s, e, t, r, i) {
|
|
|
4189
4189
|
progress: m,
|
|
4190
4190
|
count: u,
|
|
4191
4191
|
total: c,
|
|
4192
|
-
detail:
|
|
4192
|
+
detail: b
|
|
4193
4193
|
});
|
|
4194
4194
|
};
|
|
4195
4195
|
return await Promise.all(
|
|
4196
|
-
d.map(async ([
|
|
4196
|
+
d.map(async ([b, f]) => {
|
|
4197
4197
|
const m = Fe(e, f.src);
|
|
4198
|
-
f.type === "image" ? n.set(
|
|
4198
|
+
f.type === "image" ? n.set(b, await rn(m)) : f.type === "audio" ? a.set(b, { url: m, channel: f.channel ?? "vo" }) : f.type === "vtt" ? o.set(b, Is(await pt(m))) : f.type === "html" && l.set(b, await pt(m)), v(b);
|
|
4199
4199
|
})
|
|
4200
4200
|
), await Promise.all(
|
|
4201
|
-
h.map(async (
|
|
4202
|
-
await
|
|
4201
|
+
h.map(async (b) => {
|
|
4202
|
+
await b(), v("fragment");
|
|
4203
4203
|
})
|
|
4204
4204
|
), d.length === 0 && h.length === 0 && t({ stage: "assets", progress: i, count: 0, total: 0, detail: "none" }), { images: n, audioUrls: a, cues: o, html: l };
|
|
4205
4205
|
}
|
|
@@ -4795,44 +4795,44 @@ class Ln {
|
|
|
4795
4795
|
if (e <= 0 || t <= 0) return;
|
|
4796
4796
|
const { width: i, height: n } = this.story.pageSize, a = this.layoutMode, o = this.bookState, l = Gs(this.story), d = l ? wn(this.story.pageSize, this.story.coverSize) : { x: 0, y: 0 }, h = a === "two-page" && (o === "closed-front" || o === "closed-back"), c = l && o === "open", u = this.isSoloCover();
|
|
4797
4797
|
this.element.classList.toggle("fc-hardback-active", l), this.element.classList.toggle("fc-hardback-open", c), this.element.classList.toggle("fc-hardback-closed", l && h);
|
|
4798
|
-
let v,
|
|
4798
|
+
let v, k, b, f = 0, m = 0, C = 0;
|
|
4799
4799
|
if (l && h)
|
|
4800
|
-
|
|
4801
|
-
Math.min(e /
|
|
4800
|
+
k = i + 2 * d.x, b = n + 2 * d.y, v = this.sizedScale(
|
|
4801
|
+
Math.min(e / k, t / b),
|
|
4802
4802
|
i,
|
|
4803
4803
|
n,
|
|
4804
4804
|
e,
|
|
4805
4805
|
t
|
|
4806
|
-
), this.bookEl.style.setProperty("--fc-page-width", `${
|
|
4806
|
+
), this.bookEl.style.setProperty("--fc-page-width", `${k}px`), this.bookEl.style.setProperty("--fc-page-height", `${b}px`), this.bookEl.style.width = `${u ? k : k * 2}px`, this.bookEl.style.height = `${b}px`, f = u ? 0 : -k * v, m = 0, C = 0, this.hardbackEl.hidden = !0;
|
|
4807
4807
|
else if (c) {
|
|
4808
|
-
|
|
4809
|
-
Math.min(e /
|
|
4808
|
+
k = (a === "single" ? i : i * 2) + 2 * d.x, b = n + 2 * d.y, v = this.sizedScale(
|
|
4809
|
+
Math.min(e / k, t / b),
|
|
4810
4810
|
i,
|
|
4811
4811
|
n,
|
|
4812
4812
|
e,
|
|
4813
4813
|
t
|
|
4814
|
-
), 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 = `${
|
|
4814
|
+
), 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 = `${k}px`, this.hardbackEl.style.height = `${b}px`;
|
|
4815
4815
|
const H = a === "single" ? (r == null ? void 0 : r.left.kind) === "blank" ? "right" : "left" : "both";
|
|
4816
4816
|
this.sizeHardbackBoards(H, i, n, d.x, d.y), m = d.x, C = d.y, a === "single" && (r == null ? void 0 : r.left.kind) === "blank" ? f = -i * v : f = 0;
|
|
4817
4817
|
} else
|
|
4818
|
-
|
|
4818
|
+
k = i * 2, b = n, a === "single" || h ? v = this.sizedScale(
|
|
4819
4819
|
Math.min(e / i, t / n),
|
|
4820
4820
|
i,
|
|
4821
4821
|
n,
|
|
4822
4822
|
e,
|
|
4823
4823
|
t
|
|
4824
4824
|
) : v = this.sizedScale(
|
|
4825
|
-
Math.min(e /
|
|
4825
|
+
Math.min(e / k, t / b),
|
|
4826
4826
|
i,
|
|
4827
4827
|
n,
|
|
4828
4828
|
e,
|
|
4829
4829
|
t
|
|
4830
|
-
), this.bookEl.style.setProperty("--fc-page-width", `${i}px`), this.bookEl.style.setProperty("--fc-page-height", `${n}px`), this.bookEl.style.width = `${u ? i :
|
|
4830
|
+
), this.bookEl.style.setProperty("--fc-page-width", `${i}px`), this.bookEl.style.setProperty("--fc-page-height", `${n}px`), this.bookEl.style.width = `${u ? i : k}px`, this.bookEl.style.height = `${b}px`, this.hardbackEl.hidden = !0, u ? f = 0 : (h || a === "single" && r && r.left.kind === "blank") && (f = -i * v);
|
|
4831
4831
|
this.element.style.setProperty("--fc-hardback-overhang-x", `${d.x}px`), this.element.style.setProperty("--fc-hardback-overhang-y", `${d.y}px`), this.hardbackEl.style.transform = `scale(${v})`, this.hardbackEl.style.transformOrigin = "left top", this.bookEl.style.transform = `translateX(${f}px) scale(${v})`, this.bookEl.style.transformOrigin = "left top";
|
|
4832
|
-
let
|
|
4833
|
-
this.stageZoom.mode === "fit-page" && (
|
|
4834
|
-
const A = (c ? m * v : 0) -
|
|
4835
|
-
this.hardbackEl.style.left = `${
|
|
4832
|
+
let p = l && h ? (i + 2 * d.x) * v : c ? (a === "single" ? i + 2 * d.x : i * 2 + 2 * d.x) * v : a === "single" || h ? i * v : i * 2 * v, x = l && (h || c) ? (n + 2 * d.y) * v : n * v, R = 0, O = 0;
|
|
4833
|
+
this.stageZoom.mode === "fit-page" && (x > t && (O = (x - t) / 2, x = t), (a === "single" || h || u ? i : i * 2) * v <= e && p > e && (R = (p - e) / 2, p = e));
|
|
4834
|
+
const A = (c ? m * v : 0) - R, P = (c ? C * v : 0) - O;
|
|
4835
|
+
this.hardbackEl.style.left = `${-R}px`, this.hardbackEl.style.top = `${-O}px`, this.bookEl.style.left = `${A}px`, this.bookEl.style.top = `${P}px`, this.element.style.width = `${p}px`, this.element.style.height = `${x}px`, this.leftSlot.classList.toggle("fc-leaf-dimmed", h && !u), this.rightSlot.classList.remove("fc-leaf-dimmed"), this.applySoloCover(u);
|
|
4836
4836
|
}
|
|
4837
4837
|
/** Fit-spread keeps the fitted scale. Fit-page fits one page. Percent is CSS pixels. */
|
|
4838
4838
|
sizedScale(e, t, r, i, n) {
|
|
@@ -5105,39 +5105,39 @@ function Gn(s, e) {
|
|
|
5105
5105
|
height: t.height
|
|
5106
5106
|
};
|
|
5107
5107
|
let n = t.body;
|
|
5108
|
-
[t, r].forEach((
|
|
5109
|
-
const f = [], m =
|
|
5110
|
-
let
|
|
5111
|
-
m ? C ?
|
|
5112
|
-
let
|
|
5113
|
-
switch (
|
|
5108
|
+
[t, r].forEach((b) => {
|
|
5109
|
+
const f = [], m = b.hFlip, C = b.vFlip;
|
|
5110
|
+
let p = b.rotate;
|
|
5111
|
+
m ? C ? p += 2 : (f.push("translate(" + (i.width + i.left).toString() + " " + (0 - i.top).toString() + ")"), f.push("scale(-1 1)"), i.top = i.left = 0) : C && (f.push("translate(" + (0 - i.left).toString() + " " + (i.height + i.top).toString() + ")"), f.push("scale(1 -1)"), i.top = i.left = 0);
|
|
5112
|
+
let x;
|
|
5113
|
+
switch (p < 0 && (p -= Math.floor(p / 4) * 4), p = p % 4, p) {
|
|
5114
5114
|
case 1:
|
|
5115
|
-
|
|
5115
|
+
x = i.height / 2 + i.top, f.unshift("rotate(90 " + x.toString() + " " + x.toString() + ")");
|
|
5116
5116
|
break;
|
|
5117
5117
|
case 2:
|
|
5118
5118
|
f.unshift("rotate(180 " + (i.width / 2 + i.left).toString() + " " + (i.height / 2 + i.top).toString() + ")");
|
|
5119
5119
|
break;
|
|
5120
5120
|
case 3:
|
|
5121
|
-
|
|
5121
|
+
x = i.width / 2 + i.left, f.unshift("rotate(-90 " + x.toString() + " " + x.toString() + ")");
|
|
5122
5122
|
}
|
|
5123
|
-
|
|
5123
|
+
p % 2 === 1 && (i.left !== i.top && (x = i.left, i.left = i.top, i.top = x), i.width !== i.height && (x = i.width, i.width = i.height, i.height = x)), f.length && (n = Wn(n, '<g transform="' + f.join(" ") + '">', "</g>"));
|
|
5124
5124
|
});
|
|
5125
5125
|
const a = r.width, o = r.height, l = i.width, d = i.height;
|
|
5126
5126
|
let h, c;
|
|
5127
5127
|
a === null ? (c = o === null ? "1em" : o === "auto" ? d : o, h = Xs(c, l / d)) : (h = a === "auto" ? l : a, c = o === null ? Xs(h, d / l) : o === "auto" ? d : o);
|
|
5128
|
-
const u = {}, v = (
|
|
5129
|
-
qn(f) || (u[
|
|
5128
|
+
const u = {}, v = (b, f) => {
|
|
5129
|
+
qn(f) || (u[b] = f.toString());
|
|
5130
5130
|
};
|
|
5131
5131
|
v("width", h), v("height", c);
|
|
5132
|
-
const
|
|
5132
|
+
const k = [
|
|
5133
5133
|
i.left,
|
|
5134
5134
|
i.top,
|
|
5135
5135
|
l,
|
|
5136
5136
|
d
|
|
5137
5137
|
];
|
|
5138
|
-
return u.viewBox =
|
|
5138
|
+
return u.viewBox = k.join(" "), {
|
|
5139
5139
|
attributes: u,
|
|
5140
|
-
viewBox:
|
|
5140
|
+
viewBox: k,
|
|
5141
5141
|
body: n
|
|
5142
5142
|
};
|
|
5143
5143
|
}
|
|
@@ -5206,19 +5206,19 @@ class _r {
|
|
|
5206
5206
|
/** Instance page-game factories (override the global registry). */
|
|
5207
5207
|
y(this, "pageGames", /* @__PURE__ */ new Map());
|
|
5208
5208
|
y(this, "areaSessions", []);
|
|
5209
|
-
var
|
|
5209
|
+
var v, k, b, f, m, C;
|
|
5210
5210
|
if (this.root = e, this.loaded = t, this.springroll = r, this.chromeHiddenByOptions = !!n.hidden, h)
|
|
5211
|
-
for (const [
|
|
5212
|
-
this.pageGames.set(
|
|
5211
|
+
for (const [p, x] of Object.entries(h))
|
|
5212
|
+
this.pageGames.set(p, x);
|
|
5213
5213
|
this.element = document.createElement("div"), this.element.className = "fc-root", this.element.tabIndex = 0, this.stage = document.createElement("div"), this.stage.className = "fc-stage", this.captionsEl = document.createElement("div"), this.captionsEl.className = "fc-captions", this.captionsEl.setAttribute("aria-live", "polite");
|
|
5214
5214
|
const c = {
|
|
5215
|
-
prev: ((
|
|
5215
|
+
prev: ((v = n.labels) == null ? void 0 : v.prev) ?? "Prev",
|
|
5216
5216
|
read: ((k = n.labels) == null ? void 0 : k.read) ?? "Read",
|
|
5217
|
-
next: ((
|
|
5217
|
+
next: ((b = n.labels) == null ? void 0 : b.next) ?? "Next"
|
|
5218
5218
|
}, u = {
|
|
5219
|
-
prev: ((
|
|
5220
|
-
read: ((
|
|
5221
|
-
next: ((
|
|
5219
|
+
prev: ((f = n.ariaLabels) == null ? void 0 : f.prev) ?? "Previous page",
|
|
5220
|
+
read: ((m = n.ariaLabels) == null ? void 0 : m.read) ?? "Read aloud",
|
|
5221
|
+
next: ((C = n.ariaLabels) == null ? void 0 : C.next) ?? "Next page"
|
|
5222
5222
|
};
|
|
5223
5223
|
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", u.prev), qt(this.btnPrev, {
|
|
5224
5224
|
icon: "chevron-left",
|
|
@@ -5232,12 +5232,10 @@ class _r {
|
|
|
5232
5232
|
icon: "chevron-right",
|
|
5233
5233
|
label: c.next,
|
|
5234
5234
|
iconOnly: !0
|
|
5235
|
-
})
|
|
5236
|
-
const v = document.createElement("div");
|
|
5237
|
-
v.className = "fc-nav-peapod", v.append(this.btnPrev, this.btnRead, this.btnNext), this.chrome.append(v), this.spreadView = new Ln(
|
|
5235
|
+
}), this.chrome.append(this.btnPrev, this.btnRead, this.btnNext), this.spreadView = new Ln(
|
|
5238
5236
|
t.story,
|
|
5239
5237
|
t.assets,
|
|
5240
|
-
(
|
|
5238
|
+
(p, x) => this.handleTapActions(p, x),
|
|
5241
5239
|
{
|
|
5242
5240
|
flipStyle: a ?? "default",
|
|
5243
5241
|
flipSpeed: o
|
|
@@ -5252,10 +5250,10 @@ class _r {
|
|
|
5252
5250
|
onSwipeRight: () => {
|
|
5253
5251
|
this.isReaderNavBlocked() || this.prev();
|
|
5254
5252
|
}
|
|
5255
|
-
}), this.element.addEventListener("keydown", (
|
|
5256
|
-
this.isReaderNavBlocked() || (
|
|
5257
|
-
}), this.readAloud.onCaption((
|
|
5258
|
-
this.captionsEl.textContent =
|
|
5253
|
+
}), this.element.addEventListener("keydown", (p) => {
|
|
5254
|
+
this.isReaderNavBlocked() || (p.key === "ArrowRight" ? (p.preventDefault(), this.next()) : p.key === "ArrowLeft" ? (p.preventDefault(), this.prev()) : p.key === " " && (p.preventDefault(), this.playReadAloud()));
|
|
5255
|
+
}), this.readAloud.onCaption((p) => {
|
|
5256
|
+
this.captionsEl.textContent = p ?? "", this.captionsEl.hidden = !p;
|
|
5259
5257
|
});
|
|
5260
5258
|
}
|
|
5261
5259
|
static async create(e, t) {
|
|
@@ -5815,9 +5813,9 @@ function Ks(s, e, t, r, i) {
|
|
|
5815
5813
|
for (const c of s) {
|
|
5816
5814
|
const u = c.blockId, v = c.blockType;
|
|
5817
5815
|
if (!u || !v) continue;
|
|
5818
|
-
const
|
|
5816
|
+
const k = o.get(u), b = Math.round(c.left ?? 0), f = Math.round(c.top ?? 0);
|
|
5819
5817
|
if (v === "text") {
|
|
5820
|
-
const m = Math.round(c.width ?? 0), C = Math.round(c.height ?? 0),
|
|
5818
|
+
const m = Math.round(c.width ?? 0), C = Math.round(c.height ?? 0), p = c.text ?? "", x = k && k.type === "text" ? k : void 0, R = x ? Sr(x.html ?? "") : "", O = x && R === p && x.html ? x.html : la(p), A = x == null ? void 0 : x.style, P = {
|
|
5821
5819
|
fontFamily: c.fontFamily || (A == null ? void 0 : A.fontFamily),
|
|
5822
5820
|
fontSize: c.fontSize != null ? `${Math.round(c.fontSize)}px` : A == null ? void 0 : A.fontSize,
|
|
5823
5821
|
color: typeof c.fill == "string" ? c.fill : A == null ? void 0 : A.color,
|
|
@@ -5829,46 +5827,46 @@ function Ks(s, e, t, r, i) {
|
|
|
5829
5827
|
l.push({
|
|
5830
5828
|
id: u,
|
|
5831
5829
|
type: "text",
|
|
5832
|
-
layout: bt(
|
|
5830
|
+
layout: bt(b, f, m, C, x == null ? void 0 : x.layout, t, {
|
|
5833
5831
|
preserveHeight: !0
|
|
5834
5832
|
}),
|
|
5835
5833
|
html: O,
|
|
5836
5834
|
style: P,
|
|
5837
|
-
htmlSrc:
|
|
5835
|
+
htmlSrc: x == null ? void 0 : x.htmlSrc
|
|
5838
5836
|
});
|
|
5839
5837
|
} else if (v === "image") {
|
|
5840
|
-
const m = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), C = Math.round((c.height ?? 0) * (c.scaleY ?? 1)),
|
|
5841
|
-
if (!
|
|
5842
|
-
const
|
|
5843
|
-
O && (
|
|
5838
|
+
const m = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), C = Math.round((c.height ?? 0) * (c.scaleY ?? 1)), p = c.assetId ?? (k && k.type === "image" ? k.asset : void 0);
|
|
5839
|
+
if (!p) continue;
|
|
5840
|
+
const x = k && k.type === "image" ? k : void 0, R = bt(b, f, m, C, x == null ? void 0 : x.layout, t), O = c.fit ?? ((h = x == null ? void 0 : x.layout) == null ? void 0 : h.fit);
|
|
5841
|
+
O && (R.fit = O), l.push({
|
|
5844
5842
|
id: u,
|
|
5845
5843
|
type: "image",
|
|
5846
|
-
asset:
|
|
5847
|
-
layout:
|
|
5848
|
-
className:
|
|
5844
|
+
asset: p,
|
|
5845
|
+
layout: R,
|
|
5846
|
+
className: x == null ? void 0 : x.className
|
|
5849
5847
|
});
|
|
5850
5848
|
} else if (v === "hotspot") {
|
|
5851
|
-
const m = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), C = Math.round((c.height ?? 0) * (c.scaleY ?? 1)),
|
|
5849
|
+
const m = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), C = Math.round((c.height ?? 0) * (c.scaleY ?? 1)), p = k && k.type === "hotspot" ? k : void 0;
|
|
5852
5850
|
l.push({
|
|
5853
5851
|
id: u,
|
|
5854
5852
|
type: "hotspot",
|
|
5855
|
-
layout: bt(
|
|
5856
|
-
onTap: c.onTap ?? (
|
|
5857
|
-
onComplete: c.onComplete ?? (
|
|
5858
|
-
requiredTaps: c.requiredTaps ?? (
|
|
5859
|
-
ariaLabel: c.ariaLabel ?? (
|
|
5853
|
+
layout: bt(b, f, m, C, p == null ? void 0 : p.layout, t),
|
|
5854
|
+
onTap: c.onTap ?? (p == null ? void 0 : p.onTap) ?? [],
|
|
5855
|
+
onComplete: c.onComplete ?? (p == null ? void 0 : p.onComplete) ?? [],
|
|
5856
|
+
requiredTaps: c.requiredTaps ?? (p == null ? void 0 : p.requiredTaps),
|
|
5857
|
+
ariaLabel: c.ariaLabel ?? (p == null ? void 0 : p.ariaLabel)
|
|
5860
5858
|
});
|
|
5861
5859
|
} else if (v === "area") {
|
|
5862
|
-
const m = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), C = Math.round((c.height ?? 0) * (c.scaleY ?? 1)),
|
|
5863
|
-
if (!
|
|
5860
|
+
const m = Math.round((c.width ?? 0) * (c.scaleX ?? 1)), C = Math.round((c.height ?? 0) * (c.scaleY ?? 1)), p = k && k.type === "area" ? k : void 0, x = c.game ?? (p == null ? void 0 : p.game);
|
|
5861
|
+
if (!x) continue;
|
|
5864
5862
|
l.push({
|
|
5865
5863
|
id: u,
|
|
5866
5864
|
type: "area",
|
|
5867
|
-
layout: bt(
|
|
5868
|
-
game:
|
|
5869
|
-
params: c.params ?? (
|
|
5870
|
-
ariaLabel: c.ariaLabel ?? (
|
|
5871
|
-
requireComplete: c.requireComplete ?? (
|
|
5865
|
+
layout: bt(b, f, m, C, p == null ? void 0 : p.layout, t),
|
|
5866
|
+
game: x,
|
|
5867
|
+
params: c.params ?? (p == null ? void 0 : p.params),
|
|
5868
|
+
ariaLabel: c.ariaLabel ?? (p == null ? void 0 : p.ariaLabel),
|
|
5869
|
+
requireComplete: c.requireComplete ?? (p == null ? void 0 : p.requireComplete) ?? !1
|
|
5872
5870
|
});
|
|
5873
5871
|
}
|
|
5874
5872
|
}
|
|
@@ -5882,7 +5880,7 @@ function Ks(s, e, t, r, i) {
|
|
|
5882
5880
|
};
|
|
5883
5881
|
}
|
|
5884
5882
|
function Qs(s, e, t) {
|
|
5885
|
-
var n, a, o, l, d, h, c, u, v,
|
|
5883
|
+
var n, a, o, l, d, h, c, u, v, k, b;
|
|
5886
5884
|
const r = {
|
|
5887
5885
|
color: ((n = s.background) == null ? void 0 : n.color) ?? "#faf6ef"
|
|
5888
5886
|
};
|
|
@@ -5891,7 +5889,7 @@ function Qs(s, e, t) {
|
|
|
5891
5889
|
for (const f of s.blocks)
|
|
5892
5890
|
if (Cr(f)) {
|
|
5893
5891
|
if (f.type === "text") {
|
|
5894
|
-
const m = f.html ?? e.html.get(`htmlSrc:${f.id}`) ?? (f.htmlSrc ? e.html.get(f.htmlSrc) : void 0) ?? "", C = Be(f.layout, t),
|
|
5892
|
+
const m = f.html ?? e.html.get(`htmlSrc:${f.id}`) ?? (f.htmlSrc ? e.html.get(f.htmlSrc) : void 0) ?? "", C = Be(f.layout, t), p = Ke((l = f.style) == null ? void 0 : l.fontSize, 18) || 18;
|
|
5895
5893
|
i.push({
|
|
5896
5894
|
kind: "text",
|
|
5897
5895
|
blockId: f.id,
|
|
@@ -5900,12 +5898,12 @@ function Qs(s, e, t) {
|
|
|
5900
5898
|
top: C.y,
|
|
5901
5899
|
width: Math.max(20, C.width),
|
|
5902
5900
|
fontFamily: ((d = f.style) == null ? void 0 : d.fontFamily) ?? "Georgia, serif",
|
|
5903
|
-
fontSize:
|
|
5901
|
+
fontSize: p,
|
|
5904
5902
|
fill: ((h = f.style) == null ? void 0 : h.color) ?? "#1f1a14",
|
|
5905
5903
|
textAlign: ((c = f.style) == null ? void 0 : c.textAlign) ?? "left",
|
|
5906
|
-
lineHeight: oa((u = f.style) == null ? void 0 : u.lineHeight,
|
|
5904
|
+
lineHeight: oa((u = f.style) == null ? void 0 : u.lineHeight, p, 1.35),
|
|
5907
5905
|
fontWeight: (v = f.style) == null ? void 0 : v.fontWeight,
|
|
5908
|
-
fontStyle: (
|
|
5906
|
+
fontStyle: (k = f.style) == null ? void 0 : k.fontStyle
|
|
5909
5907
|
});
|
|
5910
5908
|
} else if (f.type === "image") {
|
|
5911
5909
|
const m = e.images.get(f.asset);
|
|
@@ -5920,7 +5918,7 @@ function Qs(s, e, t) {
|
|
|
5920
5918
|
width: C.width,
|
|
5921
5919
|
height: C.height,
|
|
5922
5920
|
src: m.src,
|
|
5923
|
-
fit: (
|
|
5921
|
+
fit: (b = f.layout) == null ? void 0 : b.fit
|
|
5924
5922
|
});
|
|
5925
5923
|
} else if (f.type === "hotspot") {
|
|
5926
5924
|
const m = Be(f.layout, t);
|
|
@@ -5991,8 +5989,8 @@ function Ca(s, e, t, r, i, n) {
|
|
|
5991
5989
|
const a = r.width, o = [], l = [];
|
|
5992
5990
|
for (const c of s) {
|
|
5993
5991
|
if (!c.blockId || !c.blockType) continue;
|
|
5994
|
-
const u = c.left ?? 0, v = ca(c),
|
|
5995
|
-
if (
|
|
5992
|
+
const u = c.left ?? 0, v = ca(c), k = u + v, b = k <= a + 0.5, f = u >= a - 0.5;
|
|
5993
|
+
if (b) {
|
|
5996
5994
|
o.push({ ...c });
|
|
5997
5995
|
continue;
|
|
5998
5996
|
}
|
|
@@ -6003,7 +6001,7 @@ function Ca(s, e, t, r, i, n) {
|
|
|
6003
6001
|
});
|
|
6004
6002
|
continue;
|
|
6005
6003
|
}
|
|
6006
|
-
const m = Math.max(1, Math.round(a - u)), C = Math.max(1, Math.round(
|
|
6004
|
+
const m = Math.max(1, Math.round(a - u)), C = Math.max(1, Math.round(k - a));
|
|
6007
6005
|
o.push({
|
|
6008
6006
|
...c,
|
|
6009
6007
|
width: m,
|