@magiclabs.ai/magicbook-client 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/magicbook-client.js +475 -475
- package/magicbook-client.umd.cjs +1 -1
- package/models/design-request/index.d.ts +2 -2
- package/models/galleon.d.ts +15 -15
- package/package.json +1 -1
- package/utils/engine-api/books.d.ts +1 -1
package/magicbook-client.js
CHANGED
|
@@ -3,7 +3,7 @@ var bs = (t, e, s) => e in t ? _s(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var b = (t, e, s) => (bs(t, typeof e != "symbol" ? e + "" : e, s), s);
|
|
4
4
|
function ws(t, e, s) {
|
|
5
5
|
const n = e.pop() || "", r = e.reduce(
|
|
6
|
-
(
|
|
6
|
+
(i, a) => i[a] = i[a] || {},
|
|
7
7
|
t
|
|
8
8
|
);
|
|
9
9
|
r[n] = s;
|
|
@@ -66,10 +66,10 @@ function xe(t, e, { allOwnKeys: s = !1 } = {}) {
|
|
|
66
66
|
for (n = 0, r = t.length; n < r; n++)
|
|
67
67
|
e.call(null, t[n], n, t);
|
|
68
68
|
else {
|
|
69
|
-
const
|
|
69
|
+
const i = s ? Object.getOwnPropertyNames(t) : Object.keys(t), a = i.length;
|
|
70
70
|
let o;
|
|
71
|
-
for (n = 0; n <
|
|
72
|
-
o =
|
|
71
|
+
for (n = 0; n < a; n++)
|
|
72
|
+
o = i[n], e.call(null, t[o], o, t);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
function Dt(t, e) {
|
|
@@ -84,27 +84,27 @@ function Dt(t, e) {
|
|
|
84
84
|
const Pt = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), Bt = (t) => !ue(t) && t !== Pt;
|
|
85
85
|
function et() {
|
|
86
86
|
const { caseless: t } = Bt(this) && this || {}, e = {}, s = (n, r) => {
|
|
87
|
-
const
|
|
88
|
-
Oe(e[
|
|
87
|
+
const i = t && Dt(e, r) || r;
|
|
88
|
+
Oe(e[i]) && Oe(n) ? e[i] = et(e[i], n) : Oe(n) ? e[i] = et({}, n) : le(n) ? e[i] = n.slice() : e[i] = n;
|
|
89
89
|
};
|
|
90
90
|
for (let n = 0, r = arguments.length; n < r; n++)
|
|
91
91
|
arguments[n] && xe(arguments[n], s);
|
|
92
92
|
return e;
|
|
93
93
|
}
|
|
94
|
-
const Ps = (t, e, s, { allOwnKeys: n } = {}) => (xe(e, (r,
|
|
95
|
-
s && j(r) ? t[
|
|
94
|
+
const Ps = (t, e, s, { allOwnKeys: n } = {}) => (xe(e, (r, i) => {
|
|
95
|
+
s && j(r) ? t[i] = jt(r, s) : t[i] = r;
|
|
96
96
|
}, { allOwnKeys: n }), t), Bs = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), Ms = (t, e, s, n) => {
|
|
97
97
|
t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", {
|
|
98
98
|
value: e.prototype
|
|
99
99
|
}), s && Object.assign(t.prototype, s);
|
|
100
100
|
}, Us = (t, e, s, n) => {
|
|
101
|
-
let r,
|
|
101
|
+
let r, i, a;
|
|
102
102
|
const o = {};
|
|
103
103
|
if (e = e || {}, t == null)
|
|
104
104
|
return e;
|
|
105
105
|
do {
|
|
106
|
-
for (r = Object.getOwnPropertyNames(t),
|
|
107
|
-
|
|
106
|
+
for (r = Object.getOwnPropertyNames(t), i = r.length; i-- > 0; )
|
|
107
|
+
a = r[i], (!n || n(a, t, e)) && !o[a] && (e[a] = t[a], o[a] = !0);
|
|
108
108
|
t = s !== !1 && lt(t);
|
|
109
109
|
} while (t && (!s || s(t, e)) && t !== Object.prototype);
|
|
110
110
|
return e;
|
|
@@ -128,8 +128,8 @@ const Ps = (t, e, s, { allOwnKeys: n } = {}) => (xe(e, (r, a) => {
|
|
|
128
128
|
const n = (t && t[Symbol.iterator]).call(t);
|
|
129
129
|
let r;
|
|
130
130
|
for (; (r = n.next()) && !r.done; ) {
|
|
131
|
-
const
|
|
132
|
-
e.call(t,
|
|
131
|
+
const i = r.value;
|
|
132
|
+
e.call(t, i[0], i[1]);
|
|
133
133
|
}
|
|
134
134
|
}, Hs = (t, e) => {
|
|
135
135
|
let s;
|
|
@@ -144,8 +144,8 @@ const Ps = (t, e, s, { allOwnKeys: n } = {}) => (xe(e, (r, a) => {
|
|
|
144
144
|
}
|
|
145
145
|
), yt = (({ hasOwnProperty: t }) => (e, s) => t.call(e, s))(Object.prototype), Ks = $("RegExp"), Mt = (t, e) => {
|
|
146
146
|
const s = Object.getOwnPropertyDescriptors(t), n = {};
|
|
147
|
-
xe(s, (r,
|
|
148
|
-
e(r,
|
|
147
|
+
xe(s, (r, i) => {
|
|
148
|
+
e(r, i, t) !== !1 && (n[i] = r);
|
|
149
149
|
}), Object.defineProperties(t, n);
|
|
150
150
|
}, qs = (t) => {
|
|
151
151
|
Mt(t, (e, s) => {
|
|
@@ -164,8 +164,8 @@ const Ps = (t, e, s, { allOwnKeys: n } = {}) => (xe(e, (r, a) => {
|
|
|
164
164
|
});
|
|
165
165
|
}, Gs = (t, e) => {
|
|
166
166
|
const s = {}, n = (r) => {
|
|
167
|
-
r.forEach((
|
|
168
|
-
s[
|
|
167
|
+
r.forEach((i) => {
|
|
168
|
+
s[i] = !0;
|
|
169
169
|
});
|
|
170
170
|
};
|
|
171
171
|
return le(t) ? n(t) : n(String(t).split(e)), s;
|
|
@@ -191,11 +191,11 @@ const tn = (t) => {
|
|
|
191
191
|
return;
|
|
192
192
|
if (!("toJSON" in n)) {
|
|
193
193
|
e[r] = n;
|
|
194
|
-
const
|
|
195
|
-
return xe(n, (
|
|
196
|
-
const u = s(
|
|
197
|
-
!ue(u) && (
|
|
198
|
-
}), e[r] = void 0,
|
|
194
|
+
const i = le(n) ? [] : {};
|
|
195
|
+
return xe(n, (a, o) => {
|
|
196
|
+
const u = s(a, r + 1);
|
|
197
|
+
!ue(u) && (i[o] = u);
|
|
198
|
+
}), e[r] = void 0, i;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
return n;
|
|
@@ -299,11 +299,11 @@ const zt = T.prototype, $t = {};
|
|
|
299
299
|
});
|
|
300
300
|
Object.defineProperties(T, $t);
|
|
301
301
|
Object.defineProperty(zt, "isAxiosError", { value: !0 });
|
|
302
|
-
T.from = (t, e, s, n, r,
|
|
303
|
-
const
|
|
304
|
-
return c.toFlatObject(t,
|
|
302
|
+
T.from = (t, e, s, n, r, i) => {
|
|
303
|
+
const a = Object.create(zt);
|
|
304
|
+
return c.toFlatObject(t, a, function(u) {
|
|
305
305
|
return u !== Error.prototype;
|
|
306
|
-
}, (o) => o !== "isAxiosError"), T.call(
|
|
306
|
+
}, (o) => o !== "isAxiosError"), T.call(a, t.message, e, s, n, r), a.cause = t, a.name = t.name, i && Object.assign(a, i), a;
|
|
307
307
|
};
|
|
308
308
|
const rn = null;
|
|
309
309
|
function tt(t) {
|
|
@@ -313,8 +313,8 @@ function Vt(t) {
|
|
|
313
313
|
return c.endsWith(t, "[]") ? t.slice(0, -2) : t;
|
|
314
314
|
}
|
|
315
315
|
function vt(t, e, s) {
|
|
316
|
-
return t ? t.concat(e).map(function(r,
|
|
317
|
-
return r = Vt(r), !s &&
|
|
316
|
+
return t ? t.concat(e).map(function(r, i) {
|
|
317
|
+
return r = Vt(r), !s && i ? "[" + r + "]" : r;
|
|
318
318
|
}).join(s ? "." : "") : e;
|
|
319
319
|
}
|
|
320
320
|
function an(t) {
|
|
@@ -333,7 +333,7 @@ function He(t, e, s) {
|
|
|
333
333
|
}, !1, function(S, V) {
|
|
334
334
|
return !c.isUndefined(V[S]);
|
|
335
335
|
});
|
|
336
|
-
const n = s.metaTokens, r = s.visitor || f,
|
|
336
|
+
const n = s.metaTokens, r = s.visitor || f, i = s.dots, a = s.indexes, u = (s.Blob || typeof Blob < "u" && Blob) && c.isSpecCompliantForm(e);
|
|
337
337
|
if (!c.isFunction(r))
|
|
338
338
|
throw new TypeError("visitor must be a function");
|
|
339
339
|
function l(g) {
|
|
@@ -354,12 +354,12 @@ function He(t, e, s) {
|
|
|
354
354
|
return S = Vt(S), Z.forEach(function(Ee, vs) {
|
|
355
355
|
!(c.isUndefined(Ee) || Ee === null) && e.append(
|
|
356
356
|
// eslint-disable-next-line no-nested-ternary
|
|
357
|
-
|
|
357
|
+
a === !0 ? vt([S], vs, i) : a === null ? S : S + "[]",
|
|
358
358
|
l(Ee)
|
|
359
359
|
);
|
|
360
360
|
}), !1;
|
|
361
361
|
}
|
|
362
|
-
return tt(g) ? !0 : (e.append(vt(V, S,
|
|
362
|
+
return tt(g) ? !0 : (e.append(vt(V, S, i), l(g)), !1);
|
|
363
363
|
}
|
|
364
364
|
const _ = [], C = Object.assign(on, {
|
|
365
365
|
defaultVisitor: f,
|
|
@@ -421,10 +421,10 @@ function Ht(t, e, s) {
|
|
|
421
421
|
if (!e)
|
|
422
422
|
return t;
|
|
423
423
|
const n = s && s.encode || ln, r = s && s.serialize;
|
|
424
|
-
let
|
|
425
|
-
if (r ?
|
|
426
|
-
const
|
|
427
|
-
|
|
424
|
+
let i;
|
|
425
|
+
if (r ? i = r(e, s) : i = c.isURLSearchParams(e) ? e.toString() : new ct(e, s).toString(n), i) {
|
|
426
|
+
const a = t.indexOf("#");
|
|
427
|
+
a !== -1 && (t = t.slice(0, a)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
|
|
428
428
|
}
|
|
429
429
|
return t;
|
|
430
430
|
}
|
|
@@ -503,8 +503,8 @@ self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(),
|
|
|
503
503
|
};
|
|
504
504
|
function mn(t, e) {
|
|
505
505
|
return He(t, new M.classes.URLSearchParams(), Object.assign({
|
|
506
|
-
visitor: function(s, n, r,
|
|
507
|
-
return M.isNode && c.isBuffer(s) ? (this.append(n, s.toString("base64")), !1) :
|
|
506
|
+
visitor: function(s, n, r, i) {
|
|
507
|
+
return M.isNode && c.isBuffer(s) ? (this.append(n, s.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
|
|
508
508
|
}
|
|
509
509
|
}, e));
|
|
510
510
|
}
|
|
@@ -515,16 +515,16 @@ function gn(t) {
|
|
|
515
515
|
const e = {}, s = Object.keys(t);
|
|
516
516
|
let n;
|
|
517
517
|
const r = s.length;
|
|
518
|
-
let
|
|
518
|
+
let i;
|
|
519
519
|
for (n = 0; n < r; n++)
|
|
520
|
-
|
|
520
|
+
i = s[n], e[i] = t[i];
|
|
521
521
|
return e;
|
|
522
522
|
}
|
|
523
523
|
function Wt(t) {
|
|
524
|
-
function e(s, n, r,
|
|
525
|
-
let
|
|
526
|
-
const o = Number.isFinite(+
|
|
527
|
-
return
|
|
524
|
+
function e(s, n, r, i) {
|
|
525
|
+
let a = s[i++];
|
|
526
|
+
const o = Number.isFinite(+a), u = i >= s.length;
|
|
527
|
+
return a = !a && c.isArray(r) ? r.length : a, u ? (c.hasOwnProp(r, a) ? r[a] = [r[a], n] : r[a] = n, !o) : ((!r[a] || !c.isObject(r[a])) && (r[a] = []), e(s, n, r[a], i) && c.isArray(r[a]) && (r[a] = gn(r[a])), !o);
|
|
528
528
|
}
|
|
529
529
|
if (c.isFormData(t) && c.isFunction(t.entries)) {
|
|
530
530
|
const s = {};
|
|
@@ -551,8 +551,8 @@ const Je = {
|
|
|
551
551
|
transitional: Jt,
|
|
552
552
|
adapter: ["xhr", "http"],
|
|
553
553
|
transformRequest: [function(e, s) {
|
|
554
|
-
const n = s.getContentType() || "", r = n.indexOf("application/json") > -1,
|
|
555
|
-
if (
|
|
554
|
+
const n = s.getContentType() || "", r = n.indexOf("application/json") > -1, i = c.isObject(e);
|
|
555
|
+
if (i && c.isHTMLForm(e) && (e = new FormData(e)), c.isFormData(e))
|
|
556
556
|
return r && r ? JSON.stringify(Wt(e)) : e;
|
|
557
557
|
if (c.isArrayBuffer(e) || c.isBuffer(e) || c.isStream(e) || c.isFile(e) || c.isBlob(e))
|
|
558
558
|
return e;
|
|
@@ -561,7 +561,7 @@ const Je = {
|
|
|
561
561
|
if (c.isURLSearchParams(e))
|
|
562
562
|
return s.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
|
|
563
563
|
let o;
|
|
564
|
-
if (
|
|
564
|
+
if (i) {
|
|
565
565
|
if (n.indexOf("application/x-www-form-urlencoded") > -1)
|
|
566
566
|
return mn(e, this.formSerializer).toString();
|
|
567
567
|
if ((o = c.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
|
|
@@ -573,16 +573,16 @@ const Je = {
|
|
|
573
573
|
);
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
return
|
|
576
|
+
return i || r ? (s.setContentType("application/json", !1), _n(e)) : e;
|
|
577
577
|
}],
|
|
578
578
|
transformResponse: [function(e) {
|
|
579
579
|
const s = this.transitional || Je.transitional, n = s && s.forcedJSONParsing, r = this.responseType === "json";
|
|
580
580
|
if (e && c.isString(e) && (n && !this.responseType || r)) {
|
|
581
|
-
const
|
|
581
|
+
const a = !(s && s.silentJSONParsing) && r;
|
|
582
582
|
try {
|
|
583
583
|
return JSON.parse(e);
|
|
584
584
|
} catch (o) {
|
|
585
|
-
if (
|
|
585
|
+
if (a)
|
|
586
586
|
throw o.name === "SyntaxError" ? T.from(o, T.ERR_BAD_RESPONSE, this, null, this.response) : o;
|
|
587
587
|
}
|
|
588
588
|
}
|
|
@@ -638,8 +638,8 @@ const ut = Je, bn = c.toObjectSet([
|
|
|
638
638
|
const e = {};
|
|
639
639
|
let s, n, r;
|
|
640
640
|
return t && t.split(`
|
|
641
|
-
`).forEach(function(
|
|
642
|
-
r =
|
|
641
|
+
`).forEach(function(a) {
|
|
642
|
+
r = a.indexOf(":"), s = a.substring(0, r).trim().toLowerCase(), n = a.substring(r + 1).trim(), !(!s || e[s] && bn[s]) && (s === "set-cookie" ? e[s] ? e[s].push(n) : e[s] = [n] : e[s] = e[s] ? e[s] + ", " + n : n);
|
|
643
643
|
}), e;
|
|
644
644
|
}, wt = Symbol("internals");
|
|
645
645
|
function ce(t) {
|
|
@@ -673,8 +673,8 @@ function Tn(t, e) {
|
|
|
673
673
|
const s = c.toCamelCase(" " + e);
|
|
674
674
|
["get", "set", "has"].forEach((n) => {
|
|
675
675
|
Object.defineProperty(t, n + s, {
|
|
676
|
-
value: function(r,
|
|
677
|
-
return this[n].call(this, e, r,
|
|
676
|
+
value: function(r, i, a) {
|
|
677
|
+
return this[n].call(this, e, r, i, a);
|
|
678
678
|
},
|
|
679
679
|
configurable: !0
|
|
680
680
|
});
|
|
@@ -686,15 +686,15 @@ class We {
|
|
|
686
686
|
}
|
|
687
687
|
set(e, s, n) {
|
|
688
688
|
const r = this;
|
|
689
|
-
function
|
|
689
|
+
function i(o, u, l) {
|
|
690
690
|
const f = ce(u);
|
|
691
691
|
if (!f)
|
|
692
692
|
throw new Error("header name must be a non-empty string");
|
|
693
693
|
const _ = c.findKey(r, f);
|
|
694
694
|
(!_ || r[_] === void 0 || l === !0 || l === void 0 && r[_] !== !1) && (r[_ || u] = Ne(o));
|
|
695
695
|
}
|
|
696
|
-
const
|
|
697
|
-
return c.isPlainObject(e) || e instanceof this.constructor ?
|
|
696
|
+
const a = (o, u) => c.forEach(o, (l, f) => i(l, f, u));
|
|
697
|
+
return c.isPlainObject(e) || e instanceof this.constructor ? a(e, s) : c.isString(e) && (e = e.trim()) && !kn(e) ? a(wn(e), s) : e != null && i(s, e, n), this;
|
|
698
698
|
}
|
|
699
699
|
get(e, s) {
|
|
700
700
|
if (e = ce(e), e) {
|
|
@@ -723,33 +723,33 @@ class We {
|
|
|
723
723
|
delete(e, s) {
|
|
724
724
|
const n = this;
|
|
725
725
|
let r = !1;
|
|
726
|
-
function a
|
|
727
|
-
if (
|
|
728
|
-
const o = c.findKey(n,
|
|
726
|
+
function i(a) {
|
|
727
|
+
if (a = ce(a), a) {
|
|
728
|
+
const o = c.findKey(n, a);
|
|
729
729
|
o && (!s || Ge(n, n[o], o, s)) && (delete n[o], r = !0);
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
return c.isArray(e) ? e.forEach(
|
|
732
|
+
return c.isArray(e) ? e.forEach(i) : i(e), r;
|
|
733
733
|
}
|
|
734
734
|
clear(e) {
|
|
735
735
|
const s = Object.keys(this);
|
|
736
736
|
let n = s.length, r = !1;
|
|
737
737
|
for (; n--; ) {
|
|
738
|
-
const
|
|
739
|
-
(!e || Ge(this, this[
|
|
738
|
+
const i = s[n];
|
|
739
|
+
(!e || Ge(this, this[i], i, e, !0)) && (delete this[i], r = !0);
|
|
740
740
|
}
|
|
741
741
|
return r;
|
|
742
742
|
}
|
|
743
743
|
normalize(e) {
|
|
744
744
|
const s = this, n = {};
|
|
745
|
-
return c.forEach(this, (r,
|
|
746
|
-
const
|
|
747
|
-
if (
|
|
748
|
-
s[
|
|
745
|
+
return c.forEach(this, (r, i) => {
|
|
746
|
+
const a = c.findKey(n, i);
|
|
747
|
+
if (a) {
|
|
748
|
+
s[a] = Ne(r), delete s[i];
|
|
749
749
|
return;
|
|
750
750
|
}
|
|
751
|
-
const o = e ? Sn(
|
|
752
|
-
o !==
|
|
751
|
+
const o = e ? Sn(i) : String(i).trim();
|
|
752
|
+
o !== i && delete s[i], s[o] = Ne(r), n[o] = !0;
|
|
753
753
|
}), this;
|
|
754
754
|
}
|
|
755
755
|
concat(...e) {
|
|
@@ -782,11 +782,11 @@ class We {
|
|
|
782
782
|
const n = (this[wt] = this[wt] = {
|
|
783
783
|
accessors: {}
|
|
784
784
|
}).accessors, r = this.prototype;
|
|
785
|
-
function a
|
|
786
|
-
const o = ce(
|
|
787
|
-
n[o] || (Tn(r,
|
|
785
|
+
function i(a) {
|
|
786
|
+
const o = ce(a);
|
|
787
|
+
n[o] || (Tn(r, a), n[o] = !0);
|
|
788
788
|
}
|
|
789
|
-
return c.isArray(e) ? e.forEach(
|
|
789
|
+
return c.isArray(e) ? e.forEach(i) : i(e), this;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
We.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
@@ -795,10 +795,10 @@ c.freezeMethods(We);
|
|
|
795
795
|
const F = We;
|
|
796
796
|
function Xe(t, e) {
|
|
797
797
|
const s = this || ut, n = e || s, r = F.from(n.headers);
|
|
798
|
-
let
|
|
798
|
+
let i = n.data;
|
|
799
799
|
return c.forEach(t, function(o) {
|
|
800
|
-
|
|
801
|
-
}), r.normalize(),
|
|
800
|
+
i = o.call(s, i, r.normalize(), e ? e.status : void 0);
|
|
801
|
+
}), r.normalize(), i;
|
|
802
802
|
}
|
|
803
803
|
function Kt(t) {
|
|
804
804
|
return !!(t && t.__CANCEL__);
|
|
@@ -823,9 +823,9 @@ const On = M.isStandardBrowserEnv ? (
|
|
|
823
823
|
// Standard browser envs support document.cookie
|
|
824
824
|
function() {
|
|
825
825
|
return {
|
|
826
|
-
write: function(s, n, r,
|
|
826
|
+
write: function(s, n, r, i, a, o) {
|
|
827
827
|
const u = [];
|
|
828
|
-
u.push(s + "=" + encodeURIComponent(n)), c.isNumber(r) && u.push("expires=" + new Date(r).toGMTString()), c.isString(
|
|
828
|
+
u.push(s + "=" + encodeURIComponent(n)), c.isNumber(r) && u.push("expires=" + new Date(r).toGMTString()), c.isString(i) && u.push("path=" + i), c.isString(a) && u.push("domain=" + a), o === !0 && u.push("secure"), document.cookie = u.join("; ");
|
|
829
829
|
},
|
|
830
830
|
read: function(s) {
|
|
831
831
|
const n = document.cookie.match(new RegExp("(^|;\\s*)(" + s + ")=([^;]*)"));
|
|
@@ -865,9 +865,9 @@ const An = M.isStandardBrowserEnv ? (
|
|
|
865
865
|
function() {
|
|
866
866
|
const e = /(msie|trident)/i.test(navigator.userAgent), s = document.createElement("a");
|
|
867
867
|
let n;
|
|
868
|
-
function r(
|
|
869
|
-
let
|
|
870
|
-
return e && (s.setAttribute("href",
|
|
868
|
+
function r(i) {
|
|
869
|
+
let a = i;
|
|
870
|
+
return e && (s.setAttribute("href", a), a = s.href), s.setAttribute("href", a), {
|
|
871
871
|
href: s.href,
|
|
872
872
|
protocol: s.protocol ? s.protocol.replace(/:$/, "") : "",
|
|
873
873
|
host: s.host,
|
|
@@ -878,8 +878,8 @@ const An = M.isStandardBrowserEnv ? (
|
|
|
878
878
|
pathname: s.pathname.charAt(0) === "/" ? s.pathname : "/" + s.pathname
|
|
879
879
|
};
|
|
880
880
|
}
|
|
881
|
-
return n = r(window.location.href), function(
|
|
882
|
-
const o = c.isString(
|
|
881
|
+
return n = r(window.location.href), function(a) {
|
|
882
|
+
const o = c.isString(a) ? r(a) : a;
|
|
883
883
|
return o.protocol === n.protocol && o.host === n.host;
|
|
884
884
|
};
|
|
885
885
|
}()
|
|
@@ -898,14 +898,14 @@ function Rn(t) {
|
|
|
898
898
|
function In(t, e) {
|
|
899
899
|
t = t || 10;
|
|
900
900
|
const s = new Array(t), n = new Array(t);
|
|
901
|
-
let r = 0,
|
|
901
|
+
let r = 0, i = 0, a;
|
|
902
902
|
return e = e !== void 0 ? e : 1e3, function(u) {
|
|
903
|
-
const l = Date.now(), f = n[
|
|
904
|
-
|
|
905
|
-
let _ =
|
|
903
|
+
const l = Date.now(), f = n[i];
|
|
904
|
+
a || (a = l), s[r] = u, n[r] = l;
|
|
905
|
+
let _ = i, C = 0;
|
|
906
906
|
for (; _ !== r; )
|
|
907
907
|
C += s[_++], _ = _ % t;
|
|
908
|
-
if (r = (r + 1) % t, r ===
|
|
908
|
+
if (r = (r + 1) % t, r === i && (i = (i + 1) % t), l - a < e)
|
|
909
909
|
return;
|
|
910
910
|
const O = f && l - f;
|
|
911
911
|
return O ? Math.round(C * 1e3 / O) : void 0;
|
|
@@ -915,15 +915,15 @@ function xt(t, e) {
|
|
|
915
915
|
let s = 0;
|
|
916
916
|
const n = In(50, 250);
|
|
917
917
|
return (r) => {
|
|
918
|
-
const
|
|
919
|
-
s =
|
|
918
|
+
const i = r.loaded, a = r.lengthComputable ? r.total : void 0, o = i - s, u = n(o), l = i <= a;
|
|
919
|
+
s = i;
|
|
920
920
|
const f = {
|
|
921
|
-
loaded:
|
|
922
|
-
total:
|
|
923
|
-
progress:
|
|
921
|
+
loaded: i,
|
|
922
|
+
total: a,
|
|
923
|
+
progress: a ? i / a : void 0,
|
|
924
924
|
bytes: o,
|
|
925
925
|
rate: u || void 0,
|
|
926
|
-
estimated: u &&
|
|
926
|
+
estimated: u && a && l ? (a - i) / u : void 0,
|
|
927
927
|
event: r
|
|
928
928
|
};
|
|
929
929
|
f[e ? "download" : "upload"] = !0, t(f);
|
|
@@ -932,16 +932,16 @@ function xt(t, e) {
|
|
|
932
932
|
const jn = typeof XMLHttpRequest < "u", Zn = jn && function(t) {
|
|
933
933
|
return new Promise(function(s, n) {
|
|
934
934
|
let r = t.data;
|
|
935
|
-
const
|
|
935
|
+
const i = F.from(t.headers).normalize(), a = t.responseType;
|
|
936
936
|
let o;
|
|
937
937
|
function u() {
|
|
938
938
|
t.cancelToken && t.cancelToken.unsubscribe(o), t.signal && t.signal.removeEventListener("abort", o);
|
|
939
939
|
}
|
|
940
|
-
c.isFormData(r) && (M.isStandardBrowserEnv || M.isStandardBrowserWebWorkerEnv ?
|
|
940
|
+
c.isFormData(r) && (M.isStandardBrowserEnv || M.isStandardBrowserWebWorkerEnv ? i.setContentType(!1) : i.setContentType("multipart/form-data;", !1));
|
|
941
941
|
let l = new XMLHttpRequest();
|
|
942
942
|
if (t.auth) {
|
|
943
943
|
const O = t.auth.username || "", g = t.auth.password ? unescape(encodeURIComponent(t.auth.password)) : "";
|
|
944
|
-
|
|
944
|
+
i.set("Authorization", "Basic " + btoa(O + ":" + g));
|
|
945
945
|
}
|
|
946
946
|
const f = qt(t.baseURL, t.url);
|
|
947
947
|
l.open(t.method.toUpperCase(), Ht(f, t.params, t.paramsSerializer), !0), l.timeout = t.timeout;
|
|
@@ -951,7 +951,7 @@ const jn = typeof XMLHttpRequest < "u", Zn = jn && function(t) {
|
|
|
951
951
|
const O = F.from(
|
|
952
952
|
"getAllResponseHeaders" in l && l.getAllResponseHeaders()
|
|
953
953
|
), S = {
|
|
954
|
-
data: !
|
|
954
|
+
data: !a || a === "text" || a === "json" ? l.responseText : l.response,
|
|
955
955
|
status: l.status,
|
|
956
956
|
statusText: l.statusText,
|
|
957
957
|
headers: O,
|
|
@@ -981,11 +981,11 @@ const jn = typeof XMLHttpRequest < "u", Zn = jn && function(t) {
|
|
|
981
981
|
)), l = null;
|
|
982
982
|
}, M.isStandardBrowserEnv) {
|
|
983
983
|
const O = (t.withCredentials || An(f)) && t.xsrfCookieName && On.read(t.xsrfCookieName);
|
|
984
|
-
O &&
|
|
984
|
+
O && i.set(t.xsrfHeaderName, O);
|
|
985
985
|
}
|
|
986
|
-
r === void 0 &&
|
|
986
|
+
r === void 0 && i.setContentType(null), "setRequestHeader" in l && c.forEach(i.toJSON(), function(g, S) {
|
|
987
987
|
l.setRequestHeader(S, g);
|
|
988
|
-
}), c.isUndefined(t.withCredentials) || (l.withCredentials = !!t.withCredentials),
|
|
988
|
+
}), c.isUndefined(t.withCredentials) || (l.withCredentials = !!t.withCredentials), a && a !== "json" && (l.responseType = t.responseType), typeof t.onDownloadProgress == "function" && l.addEventListener("progress", xt(t.onDownloadProgress, !0)), typeof t.onUploadProgress == "function" && l.upload && l.upload.addEventListener("progress", xt(t.onUploadProgress)), (t.cancelToken || t.signal) && (o = (O) => {
|
|
989
989
|
l && (n(!O || O.type ? new ke(null, t, l) : O), l.abort(), l = null);
|
|
990
990
|
}, t.cancelToken && t.cancelToken.subscribe(o), t.signal && (t.signal.aborted ? o() : t.signal.addEventListener("abort", o)));
|
|
991
991
|
const C = Rn(f);
|
|
@@ -1051,7 +1051,7 @@ function kt(t) {
|
|
|
1051
1051
|
});
|
|
1052
1052
|
}
|
|
1053
1053
|
const St = (t) => t instanceof F ? t.toJSON() : t;
|
|
1054
|
-
function
|
|
1054
|
+
function ie(t, e) {
|
|
1055
1055
|
e = e || {};
|
|
1056
1056
|
const s = {};
|
|
1057
1057
|
function n(l, f, _) {
|
|
@@ -1064,11 +1064,11 @@ function ae(t, e) {
|
|
|
1064
1064
|
} else
|
|
1065
1065
|
return n(l, f, _);
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1067
|
+
function i(l, f) {
|
|
1068
1068
|
if (!c.isUndefined(f))
|
|
1069
1069
|
return n(void 0, f);
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function a(l, f) {
|
|
1072
1072
|
if (c.isUndefined(f)) {
|
|
1073
1073
|
if (!c.isUndefined(l))
|
|
1074
1074
|
return n(void 0, l);
|
|
@@ -1082,32 +1082,32 @@ function ae(t, e) {
|
|
|
1082
1082
|
return n(void 0, l);
|
|
1083
1083
|
}
|
|
1084
1084
|
const u = {
|
|
1085
|
-
url:
|
|
1086
|
-
method:
|
|
1087
|
-
data:
|
|
1088
|
-
baseURL:
|
|
1089
|
-
transformRequest:
|
|
1090
|
-
transformResponse:
|
|
1091
|
-
paramsSerializer:
|
|
1092
|
-
timeout:
|
|
1093
|
-
timeoutMessage:
|
|
1094
|
-
withCredentials:
|
|
1095
|
-
adapter:
|
|
1096
|
-
responseType:
|
|
1097
|
-
xsrfCookieName:
|
|
1098
|
-
xsrfHeaderName:
|
|
1099
|
-
onUploadProgress:
|
|
1100
|
-
onDownloadProgress:
|
|
1101
|
-
decompress:
|
|
1102
|
-
maxContentLength:
|
|
1103
|
-
maxBodyLength:
|
|
1104
|
-
beforeRedirect:
|
|
1105
|
-
transport:
|
|
1106
|
-
httpAgent:
|
|
1107
|
-
httpsAgent:
|
|
1108
|
-
cancelToken:
|
|
1109
|
-
socketPath:
|
|
1110
|
-
responseEncoding:
|
|
1085
|
+
url: i,
|
|
1086
|
+
method: i,
|
|
1087
|
+
data: i,
|
|
1088
|
+
baseURL: a,
|
|
1089
|
+
transformRequest: a,
|
|
1090
|
+
transformResponse: a,
|
|
1091
|
+
paramsSerializer: a,
|
|
1092
|
+
timeout: a,
|
|
1093
|
+
timeoutMessage: a,
|
|
1094
|
+
withCredentials: a,
|
|
1095
|
+
adapter: a,
|
|
1096
|
+
responseType: a,
|
|
1097
|
+
xsrfCookieName: a,
|
|
1098
|
+
xsrfHeaderName: a,
|
|
1099
|
+
onUploadProgress: a,
|
|
1100
|
+
onDownloadProgress: a,
|
|
1101
|
+
decompress: a,
|
|
1102
|
+
maxContentLength: a,
|
|
1103
|
+
maxBodyLength: a,
|
|
1104
|
+
beforeRedirect: a,
|
|
1105
|
+
transport: a,
|
|
1106
|
+
httpAgent: a,
|
|
1107
|
+
httpsAgent: a,
|
|
1108
|
+
cancelToken: a,
|
|
1109
|
+
socketPath: a,
|
|
1110
|
+
responseEncoding: a,
|
|
1111
1111
|
validateStatus: o,
|
|
1112
1112
|
headers: (l, f) => r(St(l), St(f), !0)
|
|
1113
1113
|
};
|
|
@@ -1124,21 +1124,21 @@ const Gt = "1.4.0", dt = {};
|
|
|
1124
1124
|
});
|
|
1125
1125
|
const Tt = {};
|
|
1126
1126
|
dt.transitional = function(e, s, n) {
|
|
1127
|
-
function r(
|
|
1128
|
-
return "[Axios v" + Gt + "] Transitional option '" +
|
|
1127
|
+
function r(i, a) {
|
|
1128
|
+
return "[Axios v" + Gt + "] Transitional option '" + i + "'" + a + (n ? ". " + n : "");
|
|
1129
1129
|
}
|
|
1130
|
-
return (
|
|
1130
|
+
return (i, a, o) => {
|
|
1131
1131
|
if (e === !1)
|
|
1132
1132
|
throw new T(
|
|
1133
|
-
r(
|
|
1133
|
+
r(a, " has been removed" + (s ? " in " + s : "")),
|
|
1134
1134
|
T.ERR_DEPRECATED
|
|
1135
1135
|
);
|
|
1136
|
-
return s && !Tt[
|
|
1136
|
+
return s && !Tt[a] && (Tt[a] = !0, console.warn(
|
|
1137
1137
|
r(
|
|
1138
|
-
|
|
1138
|
+
a,
|
|
1139
1139
|
" has been deprecated since v" + s + " and will be removed in the near future"
|
|
1140
1140
|
)
|
|
1141
|
-
)), e ? e(
|
|
1141
|
+
)), e ? e(i, a, o) : !0;
|
|
1142
1142
|
};
|
|
1143
1143
|
};
|
|
1144
1144
|
function Dn(t, e, s) {
|
|
@@ -1147,15 +1147,15 @@ function Dn(t, e, s) {
|
|
|
1147
1147
|
const n = Object.keys(t);
|
|
1148
1148
|
let r = n.length;
|
|
1149
1149
|
for (; r-- > 0; ) {
|
|
1150
|
-
const
|
|
1151
|
-
if (
|
|
1152
|
-
const o = t[
|
|
1150
|
+
const i = n[r], a = e[i];
|
|
1151
|
+
if (a) {
|
|
1152
|
+
const o = t[i], u = o === void 0 || a(o, i, t);
|
|
1153
1153
|
if (u !== !0)
|
|
1154
|
-
throw new T("option " +
|
|
1154
|
+
throw new T("option " + i + " must be " + u, T.ERR_BAD_OPTION_VALUE);
|
|
1155
1155
|
continue;
|
|
1156
1156
|
}
|
|
1157
1157
|
if (s !== !0)
|
|
1158
|
-
throw new T("Unknown option " +
|
|
1158
|
+
throw new T("Unknown option " + i, T.ERR_BAD_OPTION);
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
1161
1161
|
const st = {
|
|
@@ -1178,8 +1178,8 @@ class Ie {
|
|
|
1178
1178
|
* @returns {Promise} The Promise to be fulfilled
|
|
1179
1179
|
*/
|
|
1180
1180
|
request(e, s) {
|
|
1181
|
-
typeof e == "string" ? (s = s || {}, s.url = e) : s = e || {}, s =
|
|
1182
|
-
const { transitional: n, paramsSerializer: r, headers:
|
|
1181
|
+
typeof e == "string" ? (s = s || {}, s.url = e) : s = e || {}, s = ie(this.defaults, s);
|
|
1182
|
+
const { transitional: n, paramsSerializer: r, headers: i } = s;
|
|
1183
1183
|
n !== void 0 && st.assertOptions(n, {
|
|
1184
1184
|
silentJSONParsing: W.transitional(W.boolean),
|
|
1185
1185
|
forcedJSONParsing: W.transitional(W.boolean),
|
|
@@ -1190,16 +1190,16 @@ class Ie {
|
|
|
1190
1190
|
encode: W.function,
|
|
1191
1191
|
serialize: W.function
|
|
1192
1192
|
}, !0)), s.method = (s.method || this.defaults.method || "get").toLowerCase();
|
|
1193
|
-
let
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
),
|
|
1193
|
+
let a;
|
|
1194
|
+
a = i && c.merge(
|
|
1195
|
+
i.common,
|
|
1196
|
+
i[s.method]
|
|
1197
|
+
), a && c.forEach(
|
|
1198
1198
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1199
1199
|
(g) => {
|
|
1200
|
-
delete
|
|
1200
|
+
delete i[g];
|
|
1201
1201
|
}
|
|
1202
|
-
), s.headers = F.concat(
|
|
1202
|
+
), s.headers = F.concat(a, i);
|
|
1203
1203
|
const o = [];
|
|
1204
1204
|
let u = !0;
|
|
1205
1205
|
this.interceptors.request.forEach(function(S) {
|
|
@@ -1237,14 +1237,14 @@ class Ie {
|
|
|
1237
1237
|
return f;
|
|
1238
1238
|
}
|
|
1239
1239
|
getUri(e) {
|
|
1240
|
-
e =
|
|
1240
|
+
e = ie(this.defaults, e);
|
|
1241
1241
|
const s = qt(e.baseURL, e.url);
|
|
1242
1242
|
return Ht(s, e.params, e.paramsSerializer);
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
c.forEach(["delete", "get", "head", "options"], function(e) {
|
|
1246
1246
|
Ie.prototype[e] = function(s, n) {
|
|
1247
|
-
return this.request(
|
|
1247
|
+
return this.request(ie(n || {}, {
|
|
1248
1248
|
method: e,
|
|
1249
1249
|
url: s,
|
|
1250
1250
|
data: (n || {}).data
|
|
@@ -1253,14 +1253,14 @@ c.forEach(["delete", "get", "head", "options"], function(e) {
|
|
|
1253
1253
|
});
|
|
1254
1254
|
c.forEach(["post", "put", "patch"], function(e) {
|
|
1255
1255
|
function s(n) {
|
|
1256
|
-
return function(
|
|
1257
|
-
return this.request(
|
|
1256
|
+
return function(i, a, o) {
|
|
1257
|
+
return this.request(ie(o || {}, {
|
|
1258
1258
|
method: e,
|
|
1259
1259
|
headers: n ? {
|
|
1260
1260
|
"Content-Type": "multipart/form-data"
|
|
1261
1261
|
} : {},
|
|
1262
|
-
url:
|
|
1263
|
-
data:
|
|
1262
|
+
url: i,
|
|
1263
|
+
data: a
|
|
1264
1264
|
}));
|
|
1265
1265
|
};
|
|
1266
1266
|
}
|
|
@@ -1272,27 +1272,27 @@ class ft {
|
|
|
1272
1272
|
if (typeof e != "function")
|
|
1273
1273
|
throw new TypeError("executor must be a function.");
|
|
1274
1274
|
let s;
|
|
1275
|
-
this.promise = new Promise(function(
|
|
1276
|
-
s =
|
|
1275
|
+
this.promise = new Promise(function(i) {
|
|
1276
|
+
s = i;
|
|
1277
1277
|
});
|
|
1278
1278
|
const n = this;
|
|
1279
1279
|
this.promise.then((r) => {
|
|
1280
1280
|
if (!n._listeners)
|
|
1281
1281
|
return;
|
|
1282
|
-
let
|
|
1283
|
-
for (;
|
|
1284
|
-
n._listeners[
|
|
1282
|
+
let i = n._listeners.length;
|
|
1283
|
+
for (; i-- > 0; )
|
|
1284
|
+
n._listeners[i](r);
|
|
1285
1285
|
n._listeners = null;
|
|
1286
1286
|
}), this.promise.then = (r) => {
|
|
1287
|
-
let
|
|
1288
|
-
const
|
|
1289
|
-
n.subscribe(o),
|
|
1287
|
+
let i;
|
|
1288
|
+
const a = new Promise((o) => {
|
|
1289
|
+
n.subscribe(o), i = o;
|
|
1290
1290
|
}).then(r);
|
|
1291
|
-
return
|
|
1292
|
-
n.unsubscribe(
|
|
1293
|
-
},
|
|
1294
|
-
}, e(function(
|
|
1295
|
-
n.reason || (n.reason = new ke(
|
|
1291
|
+
return a.cancel = function() {
|
|
1292
|
+
n.unsubscribe(i);
|
|
1293
|
+
}, a;
|
|
1294
|
+
}, e(function(i, a, o) {
|
|
1295
|
+
n.reason || (n.reason = new ke(i, a, o), s(n.reason));
|
|
1296
1296
|
});
|
|
1297
1297
|
}
|
|
1298
1298
|
/**
|
|
@@ -1416,7 +1416,7 @@ const Un = nt;
|
|
|
1416
1416
|
function Xt(t) {
|
|
1417
1417
|
const e = new Ae(t), s = jt(Ae.prototype.request, e);
|
|
1418
1418
|
return c.extend(s, Ae.prototype, e, { allOwnKeys: !0 }), c.extend(s, e, null, { allOwnKeys: !0 }), s.create = function(r) {
|
|
1419
|
-
return Xt(
|
|
1419
|
+
return Xt(ie(t, r));
|
|
1420
1420
|
}, s;
|
|
1421
1421
|
}
|
|
1422
1422
|
const A = Xt(ut);
|
|
@@ -1433,7 +1433,7 @@ A.all = function(e) {
|
|
|
1433
1433
|
};
|
|
1434
1434
|
A.spread = Bn;
|
|
1435
1435
|
A.isAxiosError = Mn;
|
|
1436
|
-
A.mergeConfig =
|
|
1436
|
+
A.mergeConfig = ie;
|
|
1437
1437
|
A.AxiosHeaders = F;
|
|
1438
1438
|
A.formToJSON = (t) => Wt(c.isHTMLForm(t) ? new FormData(t) : t);
|
|
1439
1439
|
A.HttpStatusCode = Un;
|
|
@@ -1461,7 +1461,7 @@ async function Se(t) {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
async function $n({ apiKey: t, apiHost: e }, s, n) {
|
|
1463
1463
|
return Se(async () => {
|
|
1464
|
-
const r = (await Qt({ url: `${e}/
|
|
1464
|
+
const r = (await Qt({ url: `${e}/v1/images/book/${s}`, apiKey: t, payload: n })).data;
|
|
1465
1465
|
return $r.parse(r);
|
|
1466
1466
|
});
|
|
1467
1467
|
}
|
|
@@ -1475,31 +1475,31 @@ var E;
|
|
|
1475
1475
|
throw new Error();
|
|
1476
1476
|
}
|
|
1477
1477
|
t.assertNever = s, t.arrayToEnum = (r) => {
|
|
1478
|
-
const
|
|
1479
|
-
for (const
|
|
1480
|
-
a
|
|
1481
|
-
return
|
|
1478
|
+
const i = {};
|
|
1479
|
+
for (const a of r)
|
|
1480
|
+
i[a] = a;
|
|
1481
|
+
return i;
|
|
1482
1482
|
}, t.getValidEnumValues = (r) => {
|
|
1483
|
-
const
|
|
1484
|
-
for (const o of
|
|
1485
|
-
|
|
1486
|
-
return t.objectValues(
|
|
1487
|
-
}, t.objectValues = (r) => t.objectKeys(r).map(function(
|
|
1488
|
-
return r[
|
|
1483
|
+
const i = t.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), a = {};
|
|
1484
|
+
for (const o of i)
|
|
1485
|
+
a[o] = r[o];
|
|
1486
|
+
return t.objectValues(a);
|
|
1487
|
+
}, t.objectValues = (r) => t.objectKeys(r).map(function(i) {
|
|
1488
|
+
return r[i];
|
|
1489
1489
|
}), t.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
|
|
1490
|
-
const
|
|
1491
|
-
for (const
|
|
1492
|
-
Object.prototype.hasOwnProperty.call(r,
|
|
1493
|
-
return
|
|
1494
|
-
}, t.find = (r,
|
|
1495
|
-
for (const
|
|
1496
|
-
if (a
|
|
1497
|
-
return
|
|
1490
|
+
const i = [];
|
|
1491
|
+
for (const a in r)
|
|
1492
|
+
Object.prototype.hasOwnProperty.call(r, a) && i.push(a);
|
|
1493
|
+
return i;
|
|
1494
|
+
}, t.find = (r, i) => {
|
|
1495
|
+
for (const a of r)
|
|
1496
|
+
if (i(a))
|
|
1497
|
+
return a;
|
|
1498
1498
|
}, t.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && isFinite(r) && Math.floor(r) === r;
|
|
1499
|
-
function n(r,
|
|
1500
|
-
return r.map((
|
|
1499
|
+
function n(r, i = " | ") {
|
|
1500
|
+
return r.map((a) => typeof a == "string" ? `'${a}'` : a).join(i);
|
|
1501
1501
|
}
|
|
1502
|
-
t.joinValues = n, t.jsonStringifyReplacer = (r,
|
|
1502
|
+
t.joinValues = n, t.jsonStringifyReplacer = (r, i) => typeof i == "bigint" ? i.toString() : i;
|
|
1503
1503
|
})(E || (E = {}));
|
|
1504
1504
|
var rt;
|
|
1505
1505
|
(function(t) {
|
|
@@ -1583,23 +1583,23 @@ class D extends Error {
|
|
|
1583
1583
|
return this.issues;
|
|
1584
1584
|
}
|
|
1585
1585
|
format(e) {
|
|
1586
|
-
const s = e || function(
|
|
1587
|
-
return
|
|
1588
|
-
}, n = { _errors: [] }, r = (
|
|
1589
|
-
for (const
|
|
1590
|
-
if (
|
|
1591
|
-
|
|
1592
|
-
else if (
|
|
1593
|
-
r(
|
|
1594
|
-
else if (
|
|
1595
|
-
r(
|
|
1596
|
-
else if (
|
|
1597
|
-
n._errors.push(s(
|
|
1586
|
+
const s = e || function(i) {
|
|
1587
|
+
return i.message;
|
|
1588
|
+
}, n = { _errors: [] }, r = (i) => {
|
|
1589
|
+
for (const a of i.issues)
|
|
1590
|
+
if (a.code === "invalid_union")
|
|
1591
|
+
a.unionErrors.map(r);
|
|
1592
|
+
else if (a.code === "invalid_return_type")
|
|
1593
|
+
r(a.returnTypeError);
|
|
1594
|
+
else if (a.code === "invalid_arguments")
|
|
1595
|
+
r(a.argumentsError);
|
|
1596
|
+
else if (a.path.length === 0)
|
|
1597
|
+
n._errors.push(s(a));
|
|
1598
1598
|
else {
|
|
1599
1599
|
let o = n, u = 0;
|
|
1600
|
-
for (; u <
|
|
1601
|
-
const l =
|
|
1602
|
-
u ===
|
|
1600
|
+
for (; u < a.path.length; ) {
|
|
1601
|
+
const l = a.path[u];
|
|
1602
|
+
u === a.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(s(a))) : o[l] = o[l] || { _errors: [] }, o = o[l], u++;
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
1605
|
};
|
|
@@ -1689,17 +1689,17 @@ function je() {
|
|
|
1689
1689
|
return es;
|
|
1690
1690
|
}
|
|
1691
1691
|
const Ze = (t) => {
|
|
1692
|
-
const { data: e, path: s, errorMaps: n, issueData: r } = t,
|
|
1692
|
+
const { data: e, path: s, errorMaps: n, issueData: r } = t, i = [...s, ...r.path || []], a = {
|
|
1693
1693
|
...r,
|
|
1694
|
-
path:
|
|
1694
|
+
path: i
|
|
1695
1695
|
};
|
|
1696
1696
|
let o = "";
|
|
1697
1697
|
const u = n.filter((l) => !!l).slice().reverse();
|
|
1698
1698
|
for (const l of u)
|
|
1699
|
-
o = l(
|
|
1699
|
+
o = l(a, { data: e, defaultError: o }).message;
|
|
1700
1700
|
return {
|
|
1701
1701
|
...r,
|
|
1702
|
-
path:
|
|
1702
|
+
path: i,
|
|
1703
1703
|
message: r.message || o
|
|
1704
1704
|
};
|
|
1705
1705
|
}, Hn = [];
|
|
@@ -1749,17 +1749,17 @@ class R {
|
|
|
1749
1749
|
static mergeObjectSync(e, s) {
|
|
1750
1750
|
const n = {};
|
|
1751
1751
|
for (const r of s) {
|
|
1752
|
-
const { key:
|
|
1753
|
-
if (
|
|
1752
|
+
const { key: i, value: a } = r;
|
|
1753
|
+
if (i.status === "aborted" || a.status === "aborted")
|
|
1754
1754
|
return w;
|
|
1755
|
-
|
|
1755
|
+
i.status === "dirty" && e.dirty(), a.status === "dirty" && e.dirty(), (typeof a.value < "u" || r.alwaysSet) && (n[i.value] = a.value);
|
|
1756
1756
|
}
|
|
1757
1757
|
return { status: e.value, value: n };
|
|
1758
1758
|
}
|
|
1759
1759
|
}
|
|
1760
1760
|
const w = Object.freeze({
|
|
1761
1761
|
status: "aborted"
|
|
1762
|
-
}), ts = (t) => ({ status: "dirty", value: t }), I = (t) => ({ status: "valid", value: t }),
|
|
1762
|
+
}), ts = (t) => ({ status: "dirty", value: t }), I = (t) => ({ status: "valid", value: t }), it = (t) => t.status === "aborted", at = (t) => t.status === "dirty", Le = (t) => t.status === "valid", De = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
1763
1763
|
var y;
|
|
1764
1764
|
(function(t) {
|
|
1765
1765
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
@@ -1793,7 +1793,7 @@ function x(t) {
|
|
|
1793
1793
|
const { errorMap: e, invalid_type_error: s, required_error: n, description: r } = t;
|
|
1794
1794
|
if (e && (s || n))
|
|
1795
1795
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1796
|
-
return e ? { errorMap: e, description: r } : { errorMap: (
|
|
1796
|
+
return e ? { errorMap: e, description: r } : { errorMap: (a, o) => a.code !== "invalid_type" ? { message: o.defaultError } : typeof o.data > "u" ? { message: n ?? o.defaultError } : { message: s ?? o.defaultError }, description: r };
|
|
1797
1797
|
}
|
|
1798
1798
|
class k {
|
|
1799
1799
|
constructor(e) {
|
|
@@ -1857,8 +1857,8 @@ class k {
|
|
|
1857
1857
|
parent: null,
|
|
1858
1858
|
data: e,
|
|
1859
1859
|
parsedType: K(e)
|
|
1860
|
-
},
|
|
1861
|
-
return Et(r,
|
|
1860
|
+
}, i = this._parseSync({ data: e, path: r.path, parent: r });
|
|
1861
|
+
return Et(r, i);
|
|
1862
1862
|
}
|
|
1863
1863
|
async parseAsync(e, s) {
|
|
1864
1864
|
const n = await this.safeParseAsync(e, s);
|
|
@@ -1878,17 +1878,17 @@ class k {
|
|
|
1878
1878
|
parent: null,
|
|
1879
1879
|
data: e,
|
|
1880
1880
|
parsedType: K(e)
|
|
1881
|
-
}, r = this._parse({ data: e, path: n.path, parent: n }),
|
|
1882
|
-
return Et(n,
|
|
1881
|
+
}, r = this._parse({ data: e, path: n.path, parent: n }), i = await (De(r) ? r : Promise.resolve(r));
|
|
1882
|
+
return Et(n, i);
|
|
1883
1883
|
}
|
|
1884
1884
|
refine(e, s) {
|
|
1885
1885
|
const n = (r) => typeof s == "string" || typeof s > "u" ? { message: s } : typeof s == "function" ? s(r) : s;
|
|
1886
|
-
return this._refinement((r,
|
|
1887
|
-
const
|
|
1886
|
+
return this._refinement((r, i) => {
|
|
1887
|
+
const a = e(r), o = () => i.addIssue({
|
|
1888
1888
|
code: h.custom,
|
|
1889
1889
|
...n(r)
|
|
1890
1890
|
});
|
|
1891
|
-
return typeof Promise < "u" &&
|
|
1891
|
+
return typeof Promise < "u" && a instanceof Promise ? a.then((u) => u ? !0 : (o(), !1)) : a ? !0 : (o(), !1);
|
|
1892
1892
|
});
|
|
1893
1893
|
}
|
|
1894
1894
|
refinement(e, s) {
|
|
@@ -1998,127 +1998,127 @@ class L extends k {
|
|
|
1998
1998
|
}
|
|
1999
1999
|
_parse(e) {
|
|
2000
2000
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
2001
|
-
const
|
|
2001
|
+
const i = this._getOrReturnCtx(e);
|
|
2002
2002
|
return m(
|
|
2003
|
-
|
|
2003
|
+
i,
|
|
2004
2004
|
{
|
|
2005
2005
|
code: h.invalid_type,
|
|
2006
2006
|
expected: p.string,
|
|
2007
|
-
received:
|
|
2007
|
+
received: i.parsedType
|
|
2008
2008
|
}
|
|
2009
2009
|
//
|
|
2010
2010
|
), w;
|
|
2011
2011
|
}
|
|
2012
2012
|
const n = new R();
|
|
2013
2013
|
let r;
|
|
2014
|
-
for (const
|
|
2015
|
-
if (
|
|
2016
|
-
e.data.length <
|
|
2014
|
+
for (const i of this._def.checks)
|
|
2015
|
+
if (i.kind === "min")
|
|
2016
|
+
e.data.length < i.value && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2017
2017
|
code: h.too_small,
|
|
2018
|
-
minimum:
|
|
2018
|
+
minimum: i.value,
|
|
2019
2019
|
type: "string",
|
|
2020
2020
|
inclusive: !0,
|
|
2021
2021
|
exact: !1,
|
|
2022
|
-
message:
|
|
2022
|
+
message: i.message
|
|
2023
2023
|
}), n.dirty());
|
|
2024
|
-
else if (
|
|
2025
|
-
e.data.length >
|
|
2024
|
+
else if (i.kind === "max")
|
|
2025
|
+
e.data.length > i.value && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2026
2026
|
code: h.too_big,
|
|
2027
|
-
maximum:
|
|
2027
|
+
maximum: i.value,
|
|
2028
2028
|
type: "string",
|
|
2029
2029
|
inclusive: !0,
|
|
2030
2030
|
exact: !1,
|
|
2031
|
-
message:
|
|
2031
|
+
message: i.message
|
|
2032
2032
|
}), n.dirty());
|
|
2033
|
-
else if (
|
|
2034
|
-
const
|
|
2035
|
-
(
|
|
2033
|
+
else if (i.kind === "length") {
|
|
2034
|
+
const a = e.data.length > i.value, o = e.data.length < i.value;
|
|
2035
|
+
(a || o) && (r = this._getOrReturnCtx(e, r), a ? m(r, {
|
|
2036
2036
|
code: h.too_big,
|
|
2037
|
-
maximum:
|
|
2037
|
+
maximum: i.value,
|
|
2038
2038
|
type: "string",
|
|
2039
2039
|
inclusive: !0,
|
|
2040
2040
|
exact: !0,
|
|
2041
|
-
message:
|
|
2041
|
+
message: i.message
|
|
2042
2042
|
}) : o && m(r, {
|
|
2043
2043
|
code: h.too_small,
|
|
2044
|
-
minimum:
|
|
2044
|
+
minimum: i.value,
|
|
2045
2045
|
type: "string",
|
|
2046
2046
|
inclusive: !0,
|
|
2047
2047
|
exact: !0,
|
|
2048
|
-
message:
|
|
2048
|
+
message: i.message
|
|
2049
2049
|
}), n.dirty());
|
|
2050
|
-
} else if (
|
|
2050
|
+
} else if (i.kind === "email")
|
|
2051
2051
|
Gn.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2052
2052
|
validation: "email",
|
|
2053
2053
|
code: h.invalid_string,
|
|
2054
|
-
message:
|
|
2054
|
+
message: i.message
|
|
2055
2055
|
}), n.dirty());
|
|
2056
|
-
else if (
|
|
2056
|
+
else if (i.kind === "emoji")
|
|
2057
2057
|
Xn.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2058
2058
|
validation: "emoji",
|
|
2059
2059
|
code: h.invalid_string,
|
|
2060
|
-
message:
|
|
2060
|
+
message: i.message
|
|
2061
2061
|
}), n.dirty());
|
|
2062
|
-
else if (
|
|
2062
|
+
else if (i.kind === "uuid")
|
|
2063
2063
|
qn.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2064
2064
|
validation: "uuid",
|
|
2065
2065
|
code: h.invalid_string,
|
|
2066
|
-
message:
|
|
2066
|
+
message: i.message
|
|
2067
2067
|
}), n.dirty());
|
|
2068
|
-
else if (
|
|
2068
|
+
else if (i.kind === "cuid")
|
|
2069
2069
|
Jn.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2070
2070
|
validation: "cuid",
|
|
2071
2071
|
code: h.invalid_string,
|
|
2072
|
-
message:
|
|
2072
|
+
message: i.message
|
|
2073
2073
|
}), n.dirty());
|
|
2074
|
-
else if (
|
|
2074
|
+
else if (i.kind === "cuid2")
|
|
2075
2075
|
Wn.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2076
2076
|
validation: "cuid2",
|
|
2077
2077
|
code: h.invalid_string,
|
|
2078
|
-
message:
|
|
2078
|
+
message: i.message
|
|
2079
2079
|
}), n.dirty());
|
|
2080
|
-
else if (
|
|
2080
|
+
else if (i.kind === "ulid")
|
|
2081
2081
|
Kn.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2082
2082
|
validation: "ulid",
|
|
2083
2083
|
code: h.invalid_string,
|
|
2084
|
-
message:
|
|
2084
|
+
message: i.message
|
|
2085
2085
|
}), n.dirty());
|
|
2086
|
-
else if (
|
|
2086
|
+
else if (i.kind === "url")
|
|
2087
2087
|
try {
|
|
2088
2088
|
new URL(e.data);
|
|
2089
2089
|
} catch {
|
|
2090
2090
|
r = this._getOrReturnCtx(e, r), m(r, {
|
|
2091
2091
|
validation: "url",
|
|
2092
2092
|
code: h.invalid_string,
|
|
2093
|
-
message:
|
|
2093
|
+
message: i.message
|
|
2094
2094
|
}), n.dirty();
|
|
2095
2095
|
}
|
|
2096
2096
|
else
|
|
2097
|
-
|
|
2097
|
+
i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2098
2098
|
validation: "regex",
|
|
2099
2099
|
code: h.invalid_string,
|
|
2100
|
-
message:
|
|
2101
|
-
}), n.dirty())) :
|
|
2100
|
+
message: i.message
|
|
2101
|
+
}), n.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2102
2102
|
code: h.invalid_string,
|
|
2103
|
-
validation: { includes:
|
|
2104
|
-
message:
|
|
2105
|
-
}), n.dirty()) :
|
|
2103
|
+
validation: { includes: i.value, position: i.position },
|
|
2104
|
+
message: i.message
|
|
2105
|
+
}), n.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2106
2106
|
code: h.invalid_string,
|
|
2107
|
-
validation: { startsWith:
|
|
2108
|
-
message:
|
|
2109
|
-
}), n.dirty()) :
|
|
2107
|
+
validation: { startsWith: i.value },
|
|
2108
|
+
message: i.message
|
|
2109
|
+
}), n.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2110
2110
|
code: h.invalid_string,
|
|
2111
|
-
validation: { endsWith:
|
|
2112
|
-
message:
|
|
2113
|
-
}), n.dirty()) :
|
|
2111
|
+
validation: { endsWith: i.value },
|
|
2112
|
+
message: i.message
|
|
2113
|
+
}), n.dirty()) : i.kind === "datetime" ? er(i).test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2114
2114
|
code: h.invalid_string,
|
|
2115
2115
|
validation: "datetime",
|
|
2116
|
-
message:
|
|
2117
|
-
}), n.dirty()) :
|
|
2116
|
+
message: i.message
|
|
2117
|
+
}), n.dirty()) : i.kind === "ip" ? tr(e.data, i.version) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2118
2118
|
validation: "ip",
|
|
2119
2119
|
code: h.invalid_string,
|
|
2120
|
-
message:
|
|
2121
|
-
}), n.dirty()) : E.assertNever(
|
|
2120
|
+
message: i.message
|
|
2121
|
+
}), n.dirty()) : E.assertNever(i);
|
|
2122
2122
|
return { status: n.value, value: e.data };
|
|
2123
2123
|
}
|
|
2124
2124
|
_addCheck(e) {
|
|
@@ -2265,8 +2265,8 @@ L.create = (t) => {
|
|
|
2265
2265
|
});
|
|
2266
2266
|
};
|
|
2267
2267
|
function sr(t, e) {
|
|
2268
|
-
const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = s > n ? s : n,
|
|
2269
|
-
return
|
|
2268
|
+
const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = s > n ? s : n, i = parseInt(t.toFixed(r).replace(".", "")), a = parseInt(e.toFixed(r).replace(".", ""));
|
|
2269
|
+
return i % a / Math.pow(10, r);
|
|
2270
2270
|
}
|
|
2271
2271
|
class q extends k {
|
|
2272
2272
|
constructor() {
|
|
@@ -2274,43 +2274,43 @@ class q extends k {
|
|
|
2274
2274
|
}
|
|
2275
2275
|
_parse(e) {
|
|
2276
2276
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
|
|
2277
|
-
const
|
|
2278
|
-
return m(
|
|
2277
|
+
const i = this._getOrReturnCtx(e);
|
|
2278
|
+
return m(i, {
|
|
2279
2279
|
code: h.invalid_type,
|
|
2280
2280
|
expected: p.number,
|
|
2281
|
-
received:
|
|
2281
|
+
received: i.parsedType
|
|
2282
2282
|
}), w;
|
|
2283
2283
|
}
|
|
2284
2284
|
let n;
|
|
2285
2285
|
const r = new R();
|
|
2286
|
-
for (const
|
|
2287
|
-
|
|
2286
|
+
for (const i of this._def.checks)
|
|
2287
|
+
i.kind === "int" ? E.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2288
2288
|
code: h.invalid_type,
|
|
2289
2289
|
expected: "integer",
|
|
2290
2290
|
received: "float",
|
|
2291
|
-
message:
|
|
2292
|
-
}), r.dirty()) :
|
|
2291
|
+
message: i.message
|
|
2292
|
+
}), r.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2293
2293
|
code: h.too_small,
|
|
2294
|
-
minimum:
|
|
2294
|
+
minimum: i.value,
|
|
2295
2295
|
type: "number",
|
|
2296
|
-
inclusive:
|
|
2296
|
+
inclusive: i.inclusive,
|
|
2297
2297
|
exact: !1,
|
|
2298
|
-
message:
|
|
2299
|
-
}), r.dirty()) :
|
|
2298
|
+
message: i.message
|
|
2299
|
+
}), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2300
2300
|
code: h.too_big,
|
|
2301
|
-
maximum:
|
|
2301
|
+
maximum: i.value,
|
|
2302
2302
|
type: "number",
|
|
2303
|
-
inclusive:
|
|
2303
|
+
inclusive: i.inclusive,
|
|
2304
2304
|
exact: !1,
|
|
2305
|
-
message:
|
|
2306
|
-
}), r.dirty()) :
|
|
2305
|
+
message: i.message
|
|
2306
|
+
}), r.dirty()) : i.kind === "multipleOf" ? sr(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2307
2307
|
code: h.not_multiple_of,
|
|
2308
|
-
multipleOf:
|
|
2309
|
-
message:
|
|
2310
|
-
}), r.dirty()) :
|
|
2308
|
+
multipleOf: i.value,
|
|
2309
|
+
message: i.message
|
|
2310
|
+
}), r.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2311
2311
|
code: h.not_finite,
|
|
2312
|
-
message:
|
|
2313
|
-
}), r.dirty()) : E.assertNever(
|
|
2312
|
+
message: i.message
|
|
2313
|
+
}), r.dirty()) : E.assertNever(i);
|
|
2314
2314
|
return { status: r.value, value: e.data };
|
|
2315
2315
|
}
|
|
2316
2316
|
gte(e, s) {
|
|
@@ -2446,33 +2446,33 @@ class G extends k {
|
|
|
2446
2446
|
}
|
|
2447
2447
|
_parse(e) {
|
|
2448
2448
|
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== p.bigint) {
|
|
2449
|
-
const
|
|
2450
|
-
return m(
|
|
2449
|
+
const i = this._getOrReturnCtx(e);
|
|
2450
|
+
return m(i, {
|
|
2451
2451
|
code: h.invalid_type,
|
|
2452
2452
|
expected: p.bigint,
|
|
2453
|
-
received:
|
|
2453
|
+
received: i.parsedType
|
|
2454
2454
|
}), w;
|
|
2455
2455
|
}
|
|
2456
2456
|
let n;
|
|
2457
2457
|
const r = new R();
|
|
2458
|
-
for (const
|
|
2459
|
-
|
|
2458
|
+
for (const i of this._def.checks)
|
|
2459
|
+
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2460
2460
|
code: h.too_small,
|
|
2461
2461
|
type: "bigint",
|
|
2462
|
-
minimum:
|
|
2463
|
-
inclusive:
|
|
2464
|
-
message:
|
|
2465
|
-
}), r.dirty()) :
|
|
2462
|
+
minimum: i.value,
|
|
2463
|
+
inclusive: i.inclusive,
|
|
2464
|
+
message: i.message
|
|
2465
|
+
}), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2466
2466
|
code: h.too_big,
|
|
2467
2467
|
type: "bigint",
|
|
2468
|
-
maximum:
|
|
2469
|
-
inclusive:
|
|
2470
|
-
message:
|
|
2471
|
-
}), r.dirty()) :
|
|
2468
|
+
maximum: i.value,
|
|
2469
|
+
inclusive: i.inclusive,
|
|
2470
|
+
message: i.message
|
|
2471
|
+
}), r.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
2472
2472
|
code: h.not_multiple_of,
|
|
2473
|
-
multipleOf:
|
|
2474
|
-
message:
|
|
2475
|
-
}), r.dirty()) : E.assertNever(
|
|
2473
|
+
multipleOf: i.value,
|
|
2474
|
+
message: i.message
|
|
2475
|
+
}), r.dirty()) : E.assertNever(i);
|
|
2476
2476
|
return { status: r.value, value: e.data };
|
|
2477
2477
|
}
|
|
2478
2478
|
gte(e, s) {
|
|
@@ -2589,37 +2589,37 @@ fe.create = (t) => new fe({
|
|
|
2589
2589
|
class Q extends k {
|
|
2590
2590
|
_parse(e) {
|
|
2591
2591
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
2592
|
-
const
|
|
2593
|
-
return m(
|
|
2592
|
+
const i = this._getOrReturnCtx(e);
|
|
2593
|
+
return m(i, {
|
|
2594
2594
|
code: h.invalid_type,
|
|
2595
2595
|
expected: p.date,
|
|
2596
|
-
received:
|
|
2596
|
+
received: i.parsedType
|
|
2597
2597
|
}), w;
|
|
2598
2598
|
}
|
|
2599
2599
|
if (isNaN(e.data.getTime())) {
|
|
2600
|
-
const
|
|
2601
|
-
return m(
|
|
2600
|
+
const i = this._getOrReturnCtx(e);
|
|
2601
|
+
return m(i, {
|
|
2602
2602
|
code: h.invalid_date
|
|
2603
2603
|
}), w;
|
|
2604
2604
|
}
|
|
2605
2605
|
const n = new R();
|
|
2606
2606
|
let r;
|
|
2607
|
-
for (const
|
|
2608
|
-
|
|
2607
|
+
for (const i of this._def.checks)
|
|
2608
|
+
i.kind === "min" ? e.data.getTime() < i.value && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2609
2609
|
code: h.too_small,
|
|
2610
|
-
message:
|
|
2610
|
+
message: i.message,
|
|
2611
2611
|
inclusive: !0,
|
|
2612
2612
|
exact: !1,
|
|
2613
|
-
minimum:
|
|
2613
|
+
minimum: i.value,
|
|
2614
2614
|
type: "date"
|
|
2615
|
-
}), n.dirty()) :
|
|
2615
|
+
}), n.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
2616
2616
|
code: h.too_big,
|
|
2617
|
-
message:
|
|
2617
|
+
message: i.message,
|
|
2618
2618
|
inclusive: !0,
|
|
2619
2619
|
exact: !1,
|
|
2620
|
-
maximum:
|
|
2620
|
+
maximum: i.value,
|
|
2621
2621
|
type: "date"
|
|
2622
|
-
}), n.dirty()) : E.assertNever(
|
|
2622
|
+
}), n.dirty()) : E.assertNever(i);
|
|
2623
2623
|
return {
|
|
2624
2624
|
status: n.value,
|
|
2625
2625
|
value: new Date(e.data.getTime())
|
|
@@ -2715,7 +2715,7 @@ pe.create = (t) => new pe({
|
|
|
2715
2715
|
typeName: v.ZodNull,
|
|
2716
2716
|
...x(t)
|
|
2717
2717
|
});
|
|
2718
|
-
class
|
|
2718
|
+
class ae extends k {
|
|
2719
2719
|
constructor() {
|
|
2720
2720
|
super(...arguments), this._any = !0;
|
|
2721
2721
|
}
|
|
@@ -2723,7 +2723,7 @@ class ie extends k {
|
|
|
2723
2723
|
return I(e.data);
|
|
2724
2724
|
}
|
|
2725
2725
|
}
|
|
2726
|
-
|
|
2726
|
+
ae.create = (t) => new ae({
|
|
2727
2727
|
typeName: v.ZodAny,
|
|
2728
2728
|
...x(t)
|
|
2729
2729
|
});
|
|
@@ -2780,11 +2780,11 @@ class P extends k {
|
|
|
2780
2780
|
received: s.parsedType
|
|
2781
2781
|
}), w;
|
|
2782
2782
|
if (r.exactLength !== null) {
|
|
2783
|
-
const
|
|
2784
|
-
(
|
|
2785
|
-
code:
|
|
2783
|
+
const a = s.data.length > r.exactLength.value, o = s.data.length < r.exactLength.value;
|
|
2784
|
+
(a || o) && (m(s, {
|
|
2785
|
+
code: a ? h.too_big : h.too_small,
|
|
2786
2786
|
minimum: o ? r.exactLength.value : void 0,
|
|
2787
|
-
maximum:
|
|
2787
|
+
maximum: a ? r.exactLength.value : void 0,
|
|
2788
2788
|
type: "array",
|
|
2789
2789
|
inclusive: !0,
|
|
2790
2790
|
exact: !0,
|
|
@@ -2806,9 +2806,9 @@ class P extends k {
|
|
|
2806
2806
|
exact: !1,
|
|
2807
2807
|
message: r.maxLength.message
|
|
2808
2808
|
}), n.dirty()), s.common.async)
|
|
2809
|
-
return Promise.all([...s.data].map((
|
|
2810
|
-
const
|
|
2811
|
-
return R.mergeArray(n,
|
|
2809
|
+
return Promise.all([...s.data].map((a, o) => r.type._parseAsync(new U(s, a, s.path, o)))).then((a) => R.mergeArray(n, a));
|
|
2810
|
+
const i = [...s.data].map((a, o) => r.type._parseSync(new U(s, a, s.path, o)));
|
|
2811
|
+
return R.mergeArray(n, i);
|
|
2812
2812
|
}
|
|
2813
2813
|
get element() {
|
|
2814
2814
|
return this._def.type;
|
|
@@ -2879,13 +2879,13 @@ class N extends k {
|
|
|
2879
2879
|
received: l.parsedType
|
|
2880
2880
|
}), w;
|
|
2881
2881
|
}
|
|
2882
|
-
const { status: n, ctx: r } = this._processInputParams(e), { shape:
|
|
2882
|
+
const { status: n, ctx: r } = this._processInputParams(e), { shape: i, keys: a } = this._getCached(), o = [];
|
|
2883
2883
|
if (!(this._def.catchall instanceof J && this._def.unknownKeys === "strip"))
|
|
2884
2884
|
for (const l in r.data)
|
|
2885
|
-
|
|
2885
|
+
a.includes(l) || o.push(l);
|
|
2886
2886
|
const u = [];
|
|
2887
|
-
for (const l of
|
|
2888
|
-
const f =
|
|
2887
|
+
for (const l of a) {
|
|
2888
|
+
const f = i[l], _ = r.data[l];
|
|
2889
2889
|
u.push({
|
|
2890
2890
|
key: { status: "valid", value: l },
|
|
2891
2891
|
value: f._parse(new U(r, _, r.path, l)),
|
|
@@ -2943,8 +2943,8 @@ class N extends k {
|
|
|
2943
2943
|
unknownKeys: "strict",
|
|
2944
2944
|
...e !== void 0 ? {
|
|
2945
2945
|
errorMap: (s, n) => {
|
|
2946
|
-
var r,
|
|
2947
|
-
const u = (
|
|
2946
|
+
var r, i, a, o;
|
|
2947
|
+
const u = (a = (i = (r = this._def).errorMap) === null || i === void 0 ? void 0 : i.call(r, s, n).message) !== null && a !== void 0 ? a : n.defaultError;
|
|
2948
2948
|
return s.code === "unrecognized_keys" ? {
|
|
2949
2949
|
message: (o = y.errToObj(e).message) !== null && o !== void 0 ? o : u
|
|
2950
2950
|
} : {
|
|
@@ -3113,10 +3113,10 @@ class N extends k {
|
|
|
3113
3113
|
if (e && !e[n])
|
|
3114
3114
|
s[n] = this.shape[n];
|
|
3115
3115
|
else {
|
|
3116
|
-
let
|
|
3117
|
-
for (;
|
|
3118
|
-
|
|
3119
|
-
s[n] =
|
|
3116
|
+
let i = this.shape[n];
|
|
3117
|
+
for (; i instanceof H; )
|
|
3118
|
+
i = i._def.innerType;
|
|
3119
|
+
s[n] = i;
|
|
3120
3120
|
}
|
|
3121
3121
|
}), new N({
|
|
3122
3122
|
...this._def,
|
|
@@ -3151,22 +3151,22 @@ N.lazycreate = (t, e) => new N({
|
|
|
3151
3151
|
class me extends k {
|
|
3152
3152
|
_parse(e) {
|
|
3153
3153
|
const { ctx: s } = this._processInputParams(e), n = this._def.options;
|
|
3154
|
-
function r(
|
|
3155
|
-
for (const o of
|
|
3154
|
+
function r(i) {
|
|
3155
|
+
for (const o of i)
|
|
3156
3156
|
if (o.result.status === "valid")
|
|
3157
3157
|
return o.result;
|
|
3158
|
-
for (const o of
|
|
3158
|
+
for (const o of i)
|
|
3159
3159
|
if (o.result.status === "dirty")
|
|
3160
3160
|
return s.common.issues.push(...o.ctx.common.issues), o.result;
|
|
3161
|
-
const
|
|
3161
|
+
const a = i.map((o) => new D(o.ctx.common.issues));
|
|
3162
3162
|
return m(s, {
|
|
3163
3163
|
code: h.invalid_union,
|
|
3164
|
-
unionErrors:
|
|
3164
|
+
unionErrors: a
|
|
3165
3165
|
}), w;
|
|
3166
3166
|
}
|
|
3167
3167
|
if (s.common.async)
|
|
3168
|
-
return Promise.all(n.map(async (
|
|
3169
|
-
const
|
|
3168
|
+
return Promise.all(n.map(async (i) => {
|
|
3169
|
+
const a = {
|
|
3170
3170
|
...s,
|
|
3171
3171
|
common: {
|
|
3172
3172
|
...s.common,
|
|
@@ -3175,17 +3175,17 @@ class me extends k {
|
|
|
3175
3175
|
parent: null
|
|
3176
3176
|
};
|
|
3177
3177
|
return {
|
|
3178
|
-
result: await
|
|
3178
|
+
result: await i._parseAsync({
|
|
3179
3179
|
data: s.data,
|
|
3180
3180
|
path: s.path,
|
|
3181
|
-
parent:
|
|
3181
|
+
parent: a
|
|
3182
3182
|
}),
|
|
3183
|
-
ctx:
|
|
3183
|
+
ctx: a
|
|
3184
3184
|
};
|
|
3185
3185
|
})).then(r);
|
|
3186
3186
|
{
|
|
3187
|
-
let
|
|
3188
|
-
const
|
|
3187
|
+
let i;
|
|
3188
|
+
const a = [];
|
|
3189
3189
|
for (const u of n) {
|
|
3190
3190
|
const l = {
|
|
3191
3191
|
...s,
|
|
@@ -3201,11 +3201,11 @@ class me extends k {
|
|
|
3201
3201
|
});
|
|
3202
3202
|
if (f.status === "valid")
|
|
3203
3203
|
return f;
|
|
3204
|
-
f.status === "dirty" && !
|
|
3204
|
+
f.status === "dirty" && !i && (i = { result: f, ctx: l }), l.common.issues.length && a.push(l.common.issues);
|
|
3205
3205
|
}
|
|
3206
|
-
if (
|
|
3207
|
-
return s.common.issues.push(...
|
|
3208
|
-
const o =
|
|
3206
|
+
if (i)
|
|
3207
|
+
return s.common.issues.push(...i.ctx.common.issues), i.result;
|
|
3208
|
+
const o = a.map((u) => new D(u));
|
|
3209
3209
|
return m(s, {
|
|
3210
3210
|
code: h.invalid_union,
|
|
3211
3211
|
unionErrors: o
|
|
@@ -3231,12 +3231,12 @@ class Ke extends k {
|
|
|
3231
3231
|
expected: p.object,
|
|
3232
3232
|
received: s.parsedType
|
|
3233
3233
|
}), w;
|
|
3234
|
-
const n = this.discriminator, r = s.data[n],
|
|
3235
|
-
return
|
|
3234
|
+
const n = this.discriminator, r = s.data[n], i = this.optionsMap.get(r);
|
|
3235
|
+
return i ? s.common.async ? i._parseAsync({
|
|
3236
3236
|
data: s.data,
|
|
3237
3237
|
path: s.path,
|
|
3238
3238
|
parent: s
|
|
3239
|
-
}) :
|
|
3239
|
+
}) : i._parseSync({
|
|
3240
3240
|
data: s.data,
|
|
3241
3241
|
path: s.path,
|
|
3242
3242
|
parent: s
|
|
@@ -3265,14 +3265,14 @@ class Ke extends k {
|
|
|
3265
3265
|
*/
|
|
3266
3266
|
static create(e, s, n) {
|
|
3267
3267
|
const r = /* @__PURE__ */ new Map();
|
|
3268
|
-
for (const
|
|
3269
|
-
const
|
|
3270
|
-
if (!
|
|
3268
|
+
for (const i of s) {
|
|
3269
|
+
const a = Re(i.shape[e]);
|
|
3270
|
+
if (!a)
|
|
3271
3271
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
3272
|
-
for (const o of
|
|
3272
|
+
for (const o of a) {
|
|
3273
3273
|
if (r.has(o))
|
|
3274
3274
|
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
3275
|
-
r.set(o,
|
|
3275
|
+
r.set(o, i);
|
|
3276
3276
|
}
|
|
3277
3277
|
}
|
|
3278
3278
|
return new Ke({
|
|
@@ -3289,20 +3289,20 @@ function ot(t, e) {
|
|
|
3289
3289
|
if (t === e)
|
|
3290
3290
|
return { valid: !0, data: t };
|
|
3291
3291
|
if (s === p.object && n === p.object) {
|
|
3292
|
-
const r = E.objectKeys(e),
|
|
3293
|
-
for (const o of
|
|
3292
|
+
const r = E.objectKeys(e), i = E.objectKeys(t).filter((o) => r.indexOf(o) !== -1), a = { ...t, ...e };
|
|
3293
|
+
for (const o of i) {
|
|
3294
3294
|
const u = ot(t[o], e[o]);
|
|
3295
3295
|
if (!u.valid)
|
|
3296
3296
|
return { valid: !1 };
|
|
3297
|
-
|
|
3297
|
+
a[o] = u.data;
|
|
3298
3298
|
}
|
|
3299
|
-
return { valid: !0, data:
|
|
3299
|
+
return { valid: !0, data: a };
|
|
3300
3300
|
} else if (s === p.array && n === p.array) {
|
|
3301
3301
|
if (t.length !== e.length)
|
|
3302
3302
|
return { valid: !1 };
|
|
3303
3303
|
const r = [];
|
|
3304
|
-
for (let
|
|
3305
|
-
const
|
|
3304
|
+
for (let i = 0; i < t.length; i++) {
|
|
3305
|
+
const a = t[i], o = e[i], u = ot(a, o);
|
|
3306
3306
|
if (!u.valid)
|
|
3307
3307
|
return { valid: !1 };
|
|
3308
3308
|
r.push(u.data);
|
|
@@ -3313,11 +3313,11 @@ function ot(t, e) {
|
|
|
3313
3313
|
}
|
|
3314
3314
|
class ye extends k {
|
|
3315
3315
|
_parse(e) {
|
|
3316
|
-
const { status: s, ctx: n } = this._processInputParams(e), r = (
|
|
3317
|
-
if (
|
|
3316
|
+
const { status: s, ctx: n } = this._processInputParams(e), r = (i, a) => {
|
|
3317
|
+
if (it(i) || it(a))
|
|
3318
3318
|
return w;
|
|
3319
|
-
const o = ot(
|
|
3320
|
-
return o.valid ? ((
|
|
3319
|
+
const o = ot(i.value, a.value);
|
|
3320
|
+
return o.valid ? ((at(i) || at(a)) && s.dirty(), { status: s.value, value: o.data }) : (m(n, {
|
|
3321
3321
|
code: h.invalid_intersection_types
|
|
3322
3322
|
}), w);
|
|
3323
3323
|
};
|
|
@@ -3332,7 +3332,7 @@ class ye extends k {
|
|
|
3332
3332
|
path: n.path,
|
|
3333
3333
|
parent: n
|
|
3334
3334
|
})
|
|
3335
|
-
]).then(([
|
|
3335
|
+
]).then(([i, a]) => r(i, a)) : r(this._def.left._parseSync({
|
|
3336
3336
|
data: n.data,
|
|
3337
3337
|
path: n.path,
|
|
3338
3338
|
parent: n
|
|
@@ -3373,11 +3373,11 @@ class z extends k {
|
|
|
3373
3373
|
exact: !1,
|
|
3374
3374
|
type: "array"
|
|
3375
3375
|
}), s.dirty());
|
|
3376
|
-
const
|
|
3376
|
+
const i = [...n.data].map((a, o) => {
|
|
3377
3377
|
const u = this._def.items[o] || this._def.rest;
|
|
3378
|
-
return u ? u._parse(new U(n,
|
|
3379
|
-
}).filter((
|
|
3380
|
-
return n.common.async ? Promise.all(
|
|
3378
|
+
return u ? u._parse(new U(n, a, n.path, o)) : null;
|
|
3379
|
+
}).filter((a) => !!a);
|
|
3380
|
+
return n.common.async ? Promise.all(i).then((a) => R.mergeArray(s, a)) : R.mergeArray(s, i);
|
|
3381
3381
|
}
|
|
3382
3382
|
get items() {
|
|
3383
3383
|
return this._def.items;
|
|
@@ -3414,11 +3414,11 @@ class ge extends k {
|
|
|
3414
3414
|
expected: p.object,
|
|
3415
3415
|
received: n.parsedType
|
|
3416
3416
|
}), w;
|
|
3417
|
-
const r = [],
|
|
3417
|
+
const r = [], i = this._def.keyType, a = this._def.valueType;
|
|
3418
3418
|
for (const o in n.data)
|
|
3419
3419
|
r.push({
|
|
3420
|
-
key:
|
|
3421
|
-
value:
|
|
3420
|
+
key: i._parse(new U(n, o, n.path, o)),
|
|
3421
|
+
value: a._parse(new U(n, n.data[o], n.path, o))
|
|
3422
3422
|
});
|
|
3423
3423
|
return n.common.async ? R.mergeObjectAsync(s, r) : R.mergeObjectSync(s, r);
|
|
3424
3424
|
}
|
|
@@ -3448,14 +3448,14 @@ class Me extends k {
|
|
|
3448
3448
|
expected: p.map,
|
|
3449
3449
|
received: n.parsedType
|
|
3450
3450
|
}), w;
|
|
3451
|
-
const r = this._def.keyType,
|
|
3451
|
+
const r = this._def.keyType, i = this._def.valueType, a = [...n.data.entries()].map(([o, u], l) => ({
|
|
3452
3452
|
key: r._parse(new U(n, o, n.path, [l, "key"])),
|
|
3453
|
-
value:
|
|
3453
|
+
value: i._parse(new U(n, u, n.path, [l, "value"]))
|
|
3454
3454
|
}));
|
|
3455
3455
|
if (n.common.async) {
|
|
3456
3456
|
const o = /* @__PURE__ */ new Map();
|
|
3457
3457
|
return Promise.resolve().then(async () => {
|
|
3458
|
-
for (const u of
|
|
3458
|
+
for (const u of a) {
|
|
3459
3459
|
const l = await u.key, f = await u.value;
|
|
3460
3460
|
if (l.status === "aborted" || f.status === "aborted")
|
|
3461
3461
|
return w;
|
|
@@ -3465,7 +3465,7 @@ class Me extends k {
|
|
|
3465
3465
|
});
|
|
3466
3466
|
} else {
|
|
3467
3467
|
const o = /* @__PURE__ */ new Map();
|
|
3468
|
-
for (const u of
|
|
3468
|
+
for (const u of a) {
|
|
3469
3469
|
const l = u.key, f = u.value;
|
|
3470
3470
|
if (l.status === "aborted" || f.status === "aborted")
|
|
3471
3471
|
return w;
|
|
@@ -3506,8 +3506,8 @@ class ee extends k {
|
|
|
3506
3506
|
exact: !1,
|
|
3507
3507
|
message: r.maxSize.message
|
|
3508
3508
|
}), s.dirty());
|
|
3509
|
-
const
|
|
3510
|
-
function
|
|
3509
|
+
const i = this._def.valueType;
|
|
3510
|
+
function a(u) {
|
|
3511
3511
|
const l = /* @__PURE__ */ new Set();
|
|
3512
3512
|
for (const f of u) {
|
|
3513
3513
|
if (f.status === "aborted")
|
|
@@ -3516,8 +3516,8 @@ class ee extends k {
|
|
|
3516
3516
|
}
|
|
3517
3517
|
return { status: s.value, value: l };
|
|
3518
3518
|
}
|
|
3519
|
-
const o = [...n.data.values()].map((u, l) =>
|
|
3520
|
-
return n.common.async ? Promise.all(o).then((u) =>
|
|
3519
|
+
const o = [...n.data.values()].map((u, l) => i._parse(new U(n, u, n.path, l)));
|
|
3520
|
+
return n.common.async ? Promise.all(o).then((u) => a(u)) : a(o);
|
|
3521
3521
|
}
|
|
3522
3522
|
min(e, s) {
|
|
3523
3523
|
return new ee({
|
|
@@ -3589,19 +3589,19 @@ class re extends k {
|
|
|
3589
3589
|
}
|
|
3590
3590
|
});
|
|
3591
3591
|
}
|
|
3592
|
-
const
|
|
3592
|
+
const i = { errorMap: s.common.contextualErrorMap }, a = s.data;
|
|
3593
3593
|
return this._def.returns instanceof oe ? I(async (...o) => {
|
|
3594
|
-
const u = new D([]), l = await this._def.args.parseAsync(o,
|
|
3594
|
+
const u = new D([]), l = await this._def.args.parseAsync(o, i).catch((C) => {
|
|
3595
3595
|
throw u.addIssue(n(o, C)), u;
|
|
3596
|
-
}), f = await
|
|
3597
|
-
return await this._def.returns._def.type.parseAsync(f,
|
|
3596
|
+
}), f = await a(...l);
|
|
3597
|
+
return await this._def.returns._def.type.parseAsync(f, i).catch((C) => {
|
|
3598
3598
|
throw u.addIssue(r(f, C)), u;
|
|
3599
3599
|
});
|
|
3600
3600
|
}) : I((...o) => {
|
|
3601
|
-
const u = this._def.args.safeParse(o,
|
|
3601
|
+
const u = this._def.args.safeParse(o, i);
|
|
3602
3602
|
if (!u.success)
|
|
3603
3603
|
throw new D([n(o, u.error)]);
|
|
3604
|
-
const l =
|
|
3604
|
+
const l = a(...u.data), f = this._def.returns.safeParse(l, i);
|
|
3605
3605
|
if (!f.success)
|
|
3606
3606
|
throw new D([r(l, f.error)]);
|
|
3607
3607
|
return f.data;
|
|
@@ -3795,28 +3795,28 @@ class B extends k {
|
|
|
3795
3795
|
_parse(e) {
|
|
3796
3796
|
const { status: s, ctx: n } = this._processInputParams(e), r = this._def.effect || null;
|
|
3797
3797
|
if (r.type === "preprocess") {
|
|
3798
|
-
const
|
|
3799
|
-
return n.common.async ? Promise.resolve(
|
|
3798
|
+
const a = r.transform(n.data);
|
|
3799
|
+
return n.common.async ? Promise.resolve(a).then((o) => this._def.schema._parseAsync({
|
|
3800
3800
|
data: o,
|
|
3801
3801
|
path: n.path,
|
|
3802
3802
|
parent: n
|
|
3803
3803
|
})) : this._def.schema._parseSync({
|
|
3804
|
-
data:
|
|
3804
|
+
data: a,
|
|
3805
3805
|
path: n.path,
|
|
3806
3806
|
parent: n
|
|
3807
3807
|
});
|
|
3808
3808
|
}
|
|
3809
|
-
const
|
|
3810
|
-
addIssue: (
|
|
3811
|
-
m(n,
|
|
3809
|
+
const i = {
|
|
3810
|
+
addIssue: (a) => {
|
|
3811
|
+
m(n, a), a.fatal ? s.abort() : s.dirty();
|
|
3812
3812
|
},
|
|
3813
3813
|
get path() {
|
|
3814
3814
|
return n.path;
|
|
3815
3815
|
}
|
|
3816
3816
|
};
|
|
3817
|
-
if (
|
|
3818
|
-
const
|
|
3819
|
-
const u = r.refinement(o,
|
|
3817
|
+
if (i.addIssue = i.addIssue.bind(i), r.type === "refinement") {
|
|
3818
|
+
const a = (o) => {
|
|
3819
|
+
const u = r.refinement(o, i);
|
|
3820
3820
|
if (n.common.async)
|
|
3821
3821
|
return Promise.resolve(u);
|
|
3822
3822
|
if (u instanceof Promise)
|
|
@@ -3829,25 +3829,25 @@ class B extends k {
|
|
|
3829
3829
|
path: n.path,
|
|
3830
3830
|
parent: n
|
|
3831
3831
|
});
|
|
3832
|
-
return o.status === "aborted" ? w : (o.status === "dirty" && s.dirty(),
|
|
3832
|
+
return o.status === "aborted" ? w : (o.status === "dirty" && s.dirty(), a(o.value), { status: s.value, value: o.value });
|
|
3833
3833
|
} else
|
|
3834
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? w : (o.status === "dirty" && s.dirty(),
|
|
3834
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? w : (o.status === "dirty" && s.dirty(), a(o.value).then(() => ({ status: s.value, value: o.value }))));
|
|
3835
3835
|
}
|
|
3836
3836
|
if (r.type === "transform")
|
|
3837
3837
|
if (n.common.async === !1) {
|
|
3838
|
-
const
|
|
3838
|
+
const a = this._def.schema._parseSync({
|
|
3839
3839
|
data: n.data,
|
|
3840
3840
|
path: n.path,
|
|
3841
3841
|
parent: n
|
|
3842
3842
|
});
|
|
3843
|
-
if (!Le(
|
|
3844
|
-
return
|
|
3845
|
-
const o = r.transform(
|
|
3843
|
+
if (!Le(a))
|
|
3844
|
+
return a;
|
|
3845
|
+
const o = r.transform(a.value, i);
|
|
3846
3846
|
if (o instanceof Promise)
|
|
3847
3847
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3848
3848
|
return { status: s.value, value: o };
|
|
3849
3849
|
} else
|
|
3850
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
3850
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => Le(a) ? Promise.resolve(r.transform(a.value, i)).then((o) => ({ status: s.value, value: o })) : a);
|
|
3851
3851
|
E.assertNever(r);
|
|
3852
3852
|
}
|
|
3853
3853
|
}
|
|
@@ -3924,9 +3924,9 @@ class Ue extends k {
|
|
|
3924
3924
|
...n
|
|
3925
3925
|
}
|
|
3926
3926
|
});
|
|
3927
|
-
return De(r) ? r.then((
|
|
3927
|
+
return De(r) ? r.then((i) => ({
|
|
3928
3928
|
status: "valid",
|
|
3929
|
-
value:
|
|
3929
|
+
value: i.status === "valid" ? i.value : this._def.catchValue({
|
|
3930
3930
|
get error() {
|
|
3931
3931
|
return new D(n.common.issues);
|
|
3932
3932
|
},
|
|
@@ -3988,13 +3988,13 @@ class Te extends k {
|
|
|
3988
3988
|
const { status: s, ctx: n } = this._processInputParams(e);
|
|
3989
3989
|
if (n.common.async)
|
|
3990
3990
|
return (async () => {
|
|
3991
|
-
const
|
|
3991
|
+
const i = await this._def.in._parseAsync({
|
|
3992
3992
|
data: n.data,
|
|
3993
3993
|
path: n.path,
|
|
3994
3994
|
parent: n
|
|
3995
3995
|
});
|
|
3996
|
-
return
|
|
3997
|
-
data:
|
|
3996
|
+
return i.status === "aborted" ? w : i.status === "dirty" ? (s.dirty(), ts(i.value)) : this._def.out._parseAsync({
|
|
3997
|
+
data: i.value,
|
|
3998
3998
|
path: n.path,
|
|
3999
3999
|
parent: n
|
|
4000
4000
|
});
|
|
@@ -4023,22 +4023,22 @@ class Te extends k {
|
|
|
4023
4023
|
});
|
|
4024
4024
|
}
|
|
4025
4025
|
}
|
|
4026
|
-
const rs = (t, e = {}, s) => t ?
|
|
4027
|
-
var
|
|
4026
|
+
const rs = (t, e = {}, s) => t ? ae.create().superRefine((n, r) => {
|
|
4027
|
+
var i, a;
|
|
4028
4028
|
if (!t(n)) {
|
|
4029
|
-
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (
|
|
4029
|
+
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (a = (i = o.fatal) !== null && i !== void 0 ? i : s) !== null && a !== void 0 ? a : !0, l = typeof o == "string" ? { message: o } : o;
|
|
4030
4030
|
r.addIssue({ code: "custom", ...l, fatal: u });
|
|
4031
4031
|
}
|
|
4032
|
-
}) :
|
|
4032
|
+
}) : ae.create(), rr = {
|
|
4033
4033
|
object: N.lazycreate
|
|
4034
4034
|
};
|
|
4035
4035
|
var v;
|
|
4036
4036
|
(function(t) {
|
|
4037
4037
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline";
|
|
4038
4038
|
})(v || (v = {}));
|
|
4039
|
-
const
|
|
4039
|
+
const ir = (t, e = {
|
|
4040
4040
|
message: `Input not instance of ${t.name}`
|
|
4041
|
-
}) => rs((s) => s instanceof t, e),
|
|
4041
|
+
}) => rs((s) => s instanceof t, e), is = L.create, as = q.create, ar = ze.create, or = G.create, os = fe.create, lr = Q.create, cr = Pe.create, ur = he.create, dr = pe.create, fr = ae.create, hr = Y.create, pr = J.create, mr = Be.create, yr = P.create, gr = N.create, vr = N.strictCreate, _r = me.create, br = Ke.create, wr = ye.create, xr = z.create, kr = ge.create, Sr = Me.create, Tr = ee.create, Er = re.create, Or = ve.create, Nr = _e.create, Cr = X.create, Ar = be.create, Rr = oe.create, Ot = B.create, Ir = H.create, jr = te.create, Zr = B.createWithPreprocess, Lr = Te.create, Dr = () => is().optional(), Pr = () => as().optional(), Br = () => os().optional(), Mr = {
|
|
4042
4042
|
string: (t) => L.create({ ...t, coerce: !0 }),
|
|
4043
4043
|
number: (t) => q.create({ ...t, coerce: !0 }),
|
|
4044
4044
|
boolean: (t) => fe.create({
|
|
@@ -4060,8 +4060,8 @@ var d = /* @__PURE__ */ Object.freeze({
|
|
|
4060
4060
|
INVALID: w,
|
|
4061
4061
|
DIRTY: ts,
|
|
4062
4062
|
OK: I,
|
|
4063
|
-
isAborted:
|
|
4064
|
-
isDirty:
|
|
4063
|
+
isAborted: it,
|
|
4064
|
+
isDirty: at,
|
|
4065
4065
|
isValid: Le,
|
|
4066
4066
|
isAsync: De,
|
|
4067
4067
|
get util() {
|
|
@@ -4081,7 +4081,7 @@ var d = /* @__PURE__ */ Object.freeze({
|
|
|
4081
4081
|
ZodSymbol: Pe,
|
|
4082
4082
|
ZodUndefined: he,
|
|
4083
4083
|
ZodNull: pe,
|
|
4084
|
-
ZodAny:
|
|
4084
|
+
ZodAny: ae,
|
|
4085
4085
|
ZodUnknown: Y,
|
|
4086
4086
|
ZodNever: J,
|
|
4087
4087
|
ZodVoid: Be,
|
|
@@ -4127,17 +4127,17 @@ var d = /* @__PURE__ */ Object.freeze({
|
|
|
4127
4127
|
effect: Ot,
|
|
4128
4128
|
enum: Cr,
|
|
4129
4129
|
function: Er,
|
|
4130
|
-
instanceof:
|
|
4130
|
+
instanceof: ir,
|
|
4131
4131
|
intersection: wr,
|
|
4132
4132
|
lazy: Or,
|
|
4133
4133
|
literal: Nr,
|
|
4134
4134
|
map: Sr,
|
|
4135
|
-
nan:
|
|
4135
|
+
nan: ar,
|
|
4136
4136
|
nativeEnum: Ar,
|
|
4137
4137
|
never: pr,
|
|
4138
4138
|
null: dr,
|
|
4139
4139
|
nullable: jr,
|
|
4140
|
-
number:
|
|
4140
|
+
number: as,
|
|
4141
4141
|
object: gr,
|
|
4142
4142
|
oboolean: Br,
|
|
4143
4143
|
onumber: Pr,
|
|
@@ -4149,7 +4149,7 @@ var d = /* @__PURE__ */ Object.freeze({
|
|
|
4149
4149
|
record: kr,
|
|
4150
4150
|
set: Tr,
|
|
4151
4151
|
strictObject: vr,
|
|
4152
|
-
string:
|
|
4152
|
+
string: is,
|
|
4153
4153
|
symbol: cr,
|
|
4154
4154
|
transformer: Ot,
|
|
4155
4155
|
tuple: xr,
|
|
@@ -4391,7 +4391,7 @@ const Fr = [
|
|
|
4391
4391
|
6097: { slug: "boho-wedding-sfly" },
|
|
4392
4392
|
6098: { slug: "black-and-white-rustic-sfly" },
|
|
4393
4393
|
6099: { slug: "bright-color-pop-sfly" }
|
|
4394
|
-
}, us = ["8x8", "10x10", "12x12", "8x11", "11x8", "11x14"], ds = ["sc", "hc", "pl"], fs = ["sp", "sl", "dl"], hs = ["low", "medium", "high"], ps = ["best", "most", "all"], ms = ["none", "few", "lots"], ys = ["none", "few", "lots"], Hr = "https://
|
|
4394
|
+
}, us = ["8x8", "10x10", "12x12", "8x11", "11x8", "11x14"], ds = ["sc", "hc", "pl"], fs = ["sp", "sl", "dl"], hs = ["low", "medium", "high"], ps = ["best", "most", "all"], ms = ["none", "few", "lots"], ys = ["none", "few", "lots"], Hr = "https://api.sfly-sls.magicbook.io", Jr = "wss://socket.sfly-sls.magicbook.io", Wr = parseInt("300000") || 3e5;
|
|
4395
4395
|
class Kr {
|
|
4396
4396
|
constructor(e) {
|
|
4397
4397
|
b(this, "occasion");
|
|
@@ -4458,21 +4458,21 @@ const Qe = d.object({
|
|
|
4458
4458
|
async function Yr({ apiKey: t, apiHost: e }, s, n) {
|
|
4459
4459
|
return Se(async () => {
|
|
4460
4460
|
const r = await Yt(
|
|
4461
|
-
{ url: `${e}/
|
|
4462
|
-
),
|
|
4463
|
-
return Xr.parse(
|
|
4461
|
+
{ url: `${e}/v1/designoptions/booksize/${s}/imagecount/${n}`, apiKey: t }
|
|
4462
|
+
), i = It(r.data);
|
|
4463
|
+
return Xr.parse(i);
|
|
4464
4464
|
});
|
|
4465
4465
|
}
|
|
4466
4466
|
const Qr = d.object({
|
|
4467
4467
|
photoRefId: d.string(),
|
|
4468
4468
|
finalCrop: d.array(d.number())
|
|
4469
|
-
}),
|
|
4469
|
+
}), ei = d.object({
|
|
4470
4470
|
x: d.number(),
|
|
4471
4471
|
y: d.number(),
|
|
4472
4472
|
width: d.number().optional(),
|
|
4473
4473
|
height: d.number().optional(),
|
|
4474
4474
|
rotation: d.number()
|
|
4475
|
-
}),
|
|
4475
|
+
}), ti = d.object({
|
|
4476
4476
|
id: d.string(),
|
|
4477
4477
|
llx: d.number(),
|
|
4478
4478
|
lly: d.number(),
|
|
@@ -4486,13 +4486,13 @@ const Qr = d.object({
|
|
|
4486
4486
|
source: d.string(),
|
|
4487
4487
|
rotation: d.number(),
|
|
4488
4488
|
uploadTime: d.string()
|
|
4489
|
-
}),
|
|
4489
|
+
}), si = d.object({
|
|
4490
4490
|
key: d.string(),
|
|
4491
|
-
value: d.
|
|
4492
|
-
}),
|
|
4491
|
+
value: d.any()
|
|
4492
|
+
}), ni = d.object({
|
|
4493
4493
|
type: d.string(),
|
|
4494
4494
|
imageAssignment: Qr.optional(),
|
|
4495
|
-
position:
|
|
4495
|
+
position: ei,
|
|
4496
4496
|
seqNum: d.number(),
|
|
4497
4497
|
z: d.number(),
|
|
4498
4498
|
id: d.string().optional(),
|
|
@@ -4503,52 +4503,52 @@ const Qr = d.object({
|
|
|
4503
4503
|
fontSize: d.number().optional(),
|
|
4504
4504
|
fontColor: d.string().optional(),
|
|
4505
4505
|
frame: d.string().optional()
|
|
4506
|
-
}),
|
|
4506
|
+
}), ri = d.object({
|
|
4507
4507
|
url: d.string(),
|
|
4508
4508
|
encryptId: d.string(),
|
|
4509
4509
|
photoRefId: d.string(),
|
|
4510
4510
|
photoId: d.string(),
|
|
4511
|
-
photoMetadata:
|
|
4512
|
-
}),
|
|
4513
|
-
properties: d.array(
|
|
4514
|
-
}),
|
|
4511
|
+
photoMetadata: ti
|
|
4512
|
+
}), ii = d.object({
|
|
4513
|
+
properties: d.array(si)
|
|
4514
|
+
}), ai = d.object({
|
|
4515
4515
|
backgroundId: d.string().nullable(),
|
|
4516
|
-
assets: d.array(
|
|
4517
|
-
}),
|
|
4516
|
+
assets: d.array(ni).optional()
|
|
4517
|
+
}), oi = d.object({
|
|
4518
4518
|
pageNum: d.number(),
|
|
4519
4519
|
type: d.string(),
|
|
4520
|
-
canvas:
|
|
4521
|
-
}),
|
|
4522
|
-
pages: d.array(
|
|
4523
|
-
photoStrip: d.array(
|
|
4524
|
-
}),
|
|
4520
|
+
canvas: ai
|
|
4521
|
+
}), li = d.object({
|
|
4522
|
+
pages: d.array(oi),
|
|
4523
|
+
photoStrip: d.array(ri)
|
|
4524
|
+
}), ci = d.object({
|
|
4525
4525
|
title: d.string(),
|
|
4526
4526
|
binding: d.string(),
|
|
4527
4527
|
coverSpecId: d.string(),
|
|
4528
4528
|
styleId: d.number(),
|
|
4529
4529
|
userId: d.string(),
|
|
4530
|
-
magicShopBook:
|
|
4531
|
-
reportingData:
|
|
4530
|
+
magicShopBook: li,
|
|
4531
|
+
reportingData: ii
|
|
4532
4532
|
});
|
|
4533
|
-
async function
|
|
4533
|
+
async function ui({ apiHost: t, apiKey: e }, s) {
|
|
4534
4534
|
return Se(async () => {
|
|
4535
|
-
const n = (await Qt({ url: `${t}/
|
|
4535
|
+
const n = (await Qt({ url: `${t}/v1/books`, apiKey: e, payload: s })).data;
|
|
4536
4536
|
return gs.safeParse(n), new mt(n);
|
|
4537
4537
|
});
|
|
4538
4538
|
}
|
|
4539
4539
|
async function Ct({ apiHost: t, apiKey: e }, s) {
|
|
4540
4540
|
return Se(async () => {
|
|
4541
|
-
const n = (await zn({ url: `${t}/
|
|
4541
|
+
const n = (await zn({ url: `${t}/v1/books/${s.id}`, apiKey: e, payload: s })).data;
|
|
4542
4542
|
return gs.safeParse(n), new mt(n);
|
|
4543
4543
|
});
|
|
4544
4544
|
}
|
|
4545
|
-
async function
|
|
4545
|
+
async function di({ apiHost: t, apiKey: e }, s) {
|
|
4546
4546
|
return Se(async () => {
|
|
4547
|
-
const n = (await Yt({ url: `${t}/
|
|
4548
|
-
return
|
|
4547
|
+
const n = (await Yt({ url: `${t}/v1/books/${s}/format/galleon`, apiKey: e })).data;
|
|
4548
|
+
return ci.parse(n);
|
|
4549
4549
|
});
|
|
4550
4550
|
}
|
|
4551
|
-
class
|
|
4551
|
+
class fi {
|
|
4552
4552
|
constructor(e, s, n) {
|
|
4553
4553
|
b(this, "client");
|
|
4554
4554
|
b(this, "parentId");
|
|
@@ -4576,7 +4576,7 @@ class fa {
|
|
|
4576
4576
|
return this.guid = e, await Ct(this.client, Nt(this)), this.guid;
|
|
4577
4577
|
}
|
|
4578
4578
|
async getJSON() {
|
|
4579
|
-
return await
|
|
4579
|
+
return await di(this.client, this.parentId);
|
|
4580
4580
|
}
|
|
4581
4581
|
async getProgress() {
|
|
4582
4582
|
let e = "new";
|
|
@@ -4584,16 +4584,16 @@ class fa {
|
|
|
4584
4584
|
throw s.close(), new Error("Something went wrong. Please try again.");
|
|
4585
4585
|
}, Wr);
|
|
4586
4586
|
s.onmessage = (r) => {
|
|
4587
|
-
const
|
|
4588
|
-
if (e !==
|
|
4589
|
-
e =
|
|
4590
|
-
const
|
|
4591
|
-
["error", "ready"].includes(
|
|
4587
|
+
const i = JSON.parse(r.data);
|
|
4588
|
+
if (e !== i.state) {
|
|
4589
|
+
e = i.state;
|
|
4590
|
+
const a = new CustomEvent("MagicBook.designRequestUpdated", { detail: i });
|
|
4591
|
+
["error", "ready"].includes(i.state) && (s.close(), clearTimeout(n)), window.dispatchEvent(a);
|
|
4592
4592
|
}
|
|
4593
4593
|
};
|
|
4594
4594
|
}
|
|
4595
4595
|
}
|
|
4596
|
-
class
|
|
4596
|
+
class pi {
|
|
4597
4597
|
constructor(e, s = Hr, n = Jr) {
|
|
4598
4598
|
b(this, "apiKey");
|
|
4599
4599
|
b(this, "apiHost");
|
|
@@ -4601,15 +4601,15 @@ class pa {
|
|
|
4601
4601
|
this.apiKey = e, this.apiHost = s, this.webSocketHost = n;
|
|
4602
4602
|
}
|
|
4603
4603
|
async createDesignRequest(e) {
|
|
4604
|
-
const s = await
|
|
4605
|
-
return new
|
|
4604
|
+
const s = await ui(this);
|
|
4605
|
+
return new fi(s.id, this, e);
|
|
4606
4606
|
}
|
|
4607
4607
|
}
|
|
4608
4608
|
export {
|
|
4609
|
-
|
|
4609
|
+
fi as DesignRequest,
|
|
4610
4610
|
Vr as ImageServer,
|
|
4611
4611
|
zr as Images,
|
|
4612
|
-
|
|
4612
|
+
pi as MagicBookClient,
|
|
4613
4613
|
us as bookSizes,
|
|
4614
4614
|
ds as coverTypes,
|
|
4615
4615
|
Xr as designOptionsSchema,
|