@animaapp/anima-sdk 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +893 -877
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var vr = Object.defineProperty, _r = Object.defineProperties;
|
|
2
|
+
var br = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Rt = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Pt = (
|
|
6
|
-
throw TypeError(
|
|
4
|
+
var wr = Object.prototype.hasOwnProperty, xr = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Pt = (r) => {
|
|
6
|
+
throw TypeError(r);
|
|
7
7
|
};
|
|
8
|
-
var Mt = (
|
|
8
|
+
var Mt = (r, e, t) => e in r ? vr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, d = (r, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
|
-
|
|
10
|
+
wr.call(e, t) && Mt(r, t, e[t]);
|
|
11
11
|
if (Rt)
|
|
12
12
|
for (var t of Rt(e))
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
}, y = (
|
|
16
|
-
var lt = (
|
|
17
|
-
var H = (
|
|
18
|
-
var M = (
|
|
13
|
+
xr.call(e, t) && Mt(r, t, e[t]);
|
|
14
|
+
return r;
|
|
15
|
+
}, y = (r, e) => _r(r, br(e));
|
|
16
|
+
var lt = (r, e, t) => e.has(r) || Pt("Cannot " + t);
|
|
17
|
+
var H = (r, e, t) => (lt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), Xe = (r, e, t) => e.has(r) ? Pt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), ft = (r, e, t, s) => (lt(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), $t = (r, e, t) => (lt(r, e, "access private method"), t);
|
|
18
|
+
var M = (r, e, t) => new Promise((s, n) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
22
22
|
} catch (u) {
|
|
23
|
-
|
|
23
|
+
n(u);
|
|
24
24
|
}
|
|
25
25
|
}, i = (c) => {
|
|
26
26
|
try {
|
|
27
27
|
o(t.throw(c));
|
|
28
28
|
} catch (u) {
|
|
29
|
-
|
|
29
|
+
n(u);
|
|
30
30
|
}
|
|
31
31
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
|
-
o((t = t.apply(
|
|
32
|
+
o((t = t.apply(r, e)).next());
|
|
33
33
|
});
|
|
34
34
|
class ue extends Error {
|
|
35
35
|
constructor({
|
|
36
36
|
name: e,
|
|
37
37
|
reason: t,
|
|
38
38
|
status: s,
|
|
39
|
-
detail:
|
|
39
|
+
detail: n
|
|
40
40
|
}) {
|
|
41
|
-
super(), this.name = e, this.message = t, this.detail =
|
|
41
|
+
super(), this.name = e, this.message = t, this.detail = n, this.status = s;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
class
|
|
44
|
+
const Kt = "Figma Token Issue";
|
|
45
|
+
class kr extends Error {
|
|
46
46
|
constructor({
|
|
47
47
|
fileKey: e,
|
|
48
48
|
reason: t,
|
|
49
49
|
cause: s
|
|
50
50
|
}) {
|
|
51
|
-
super(
|
|
51
|
+
super(Kt), this.fileKey = e, this.reason = t, this.cause = s;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
class
|
|
54
|
+
const Xt = "Rate Limit Exceeded";
|
|
55
|
+
class Tr extends Error {
|
|
56
56
|
constructor({ fileKey: e, cause: t }) {
|
|
57
|
-
super(
|
|
57
|
+
super(Xt), this.fileKey = e, this.cause = t;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
class
|
|
60
|
+
const Yt = "Not Found";
|
|
61
|
+
class Sr extends Error {
|
|
62
62
|
constructor({ fileKey: e, cause: t }) {
|
|
63
|
-
super(
|
|
63
|
+
super(Yt), this.fileKey = e, this.cause = t;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
class
|
|
66
|
+
const Er = (r) => r.message === Yt, Qt = "Unknown Figma API Exception";
|
|
67
|
+
class Ar extends Error {
|
|
68
68
|
constructor({ fileKey: e, cause: t }) {
|
|
69
|
-
super(
|
|
69
|
+
super(Qt), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const Un = (r) => r.message === Qt, Or = (r) => r.message === Xt, Cr = (r) => [Kt, ...[
|
|
73
73
|
"Invalid Figma token",
|
|
74
74
|
"Figma token expired"
|
|
75
75
|
]].includes(
|
|
76
|
-
|
|
77
|
-
),
|
|
76
|
+
r.message
|
|
77
|
+
), er = (r, e) => {
|
|
78
78
|
var s;
|
|
79
|
-
if (((s =
|
|
80
|
-
const { err:
|
|
79
|
+
if (((s = r == null ? void 0 : r.cause) == null ? void 0 : s.message) === "Fetch Error") {
|
|
80
|
+
const { err: n, status: a } = r.cause.body;
|
|
81
81
|
if (a === 403)
|
|
82
|
-
return new
|
|
82
|
+
return new kr({
|
|
83
83
|
fileKey: e,
|
|
84
|
-
reason:
|
|
85
|
-
cause:
|
|
84
|
+
reason: n,
|
|
85
|
+
cause: r
|
|
86
86
|
});
|
|
87
87
|
if (a === 429)
|
|
88
|
-
return new
|
|
88
|
+
return new Tr({ fileKey: e, cause: r });
|
|
89
89
|
if (a === 404)
|
|
90
|
-
return new
|
|
90
|
+
return new Sr({ fileKey: e, cause: r });
|
|
91
91
|
}
|
|
92
|
-
return new
|
|
93
|
-
},
|
|
94
|
-
var
|
|
95
|
-
throw TypeError(
|
|
96
|
-
}, Dt = (
|
|
92
|
+
return new Ar({ fileKey: e, cause: r });
|
|
93
|
+
}, zn = (r) => Er(r) ? "NotFound" : Or(r) ? "RateLimitExceeded" : Cr(r) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
|
|
94
|
+
var Nr = Object.defineProperty, Ir = Object.defineProperties, jr = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, Zr = Object.prototype.hasOwnProperty, Rr = Object.prototype.propertyIsEnumerable, Vt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), tr = (r) => {
|
|
95
|
+
throw TypeError(r);
|
|
96
|
+
}, Dt = (r, e, t) => e in r ? Nr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, U = (r, e) => {
|
|
97
97
|
for (var t in e || (e = {}))
|
|
98
|
-
|
|
98
|
+
Zr.call(e, t) && Dt(r, t, e[t]);
|
|
99
99
|
if (Ft)
|
|
100
100
|
for (var t of Ft(e))
|
|
101
|
-
|
|
102
|
-
return
|
|
103
|
-
}, Nt = (
|
|
101
|
+
Rr.call(e, t) && Dt(r, t, e[t]);
|
|
102
|
+
return r;
|
|
103
|
+
}, Nt = (r, e) => Ir(r, jr(e)), It = (r, e, t) => e.has(r) || tr("Cannot " + t), T = (r, e, t) => (It(r, e, "read from private field"), t ? t.call(r) : e.get(r)), W = (r, e, t) => e.has(r) ? tr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), j = (r, e, t, s) => (It(r, e, "write to private field"), e.set(r, t), t), ee = (r, e, t) => (It(r, e, "access private method"), t), A = (r, e, t) => new Promise((s, n) => {
|
|
104
104
|
var a = (c) => {
|
|
105
105
|
try {
|
|
106
106
|
o(t.next(c));
|
|
107
107
|
} catch (u) {
|
|
108
|
-
|
|
108
|
+
n(u);
|
|
109
109
|
}
|
|
110
110
|
}, i = (c) => {
|
|
111
111
|
try {
|
|
112
112
|
o(t.throw(c));
|
|
113
113
|
} catch (u) {
|
|
114
|
-
|
|
114
|
+
n(u);
|
|
115
115
|
}
|
|
116
116
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
117
|
-
o((t = t.apply(
|
|
118
|
-
}),
|
|
119
|
-
function $
|
|
120
|
-
return
|
|
117
|
+
o((t = t.apply(r, e)).next());
|
|
118
|
+
}), Mr = (r, e, t) => (e = r[Vt("asyncIterator")]) ? e.call(r) : (r = r[Vt("iterator")](), e = {}, t = (s, n) => (n = r[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = n.call(r, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), Pr = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
119
|
+
function $r(r) {
|
|
120
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
121
121
|
}
|
|
122
|
-
var gt = { exports: {} },
|
|
123
|
-
function
|
|
124
|
-
return Lt || (Lt = 1, function(
|
|
122
|
+
var gt = { exports: {} }, Fr = gt.exports, Lt;
|
|
123
|
+
function Vr() {
|
|
124
|
+
return Lt || (Lt = 1, function(r, e) {
|
|
125
125
|
(function(t, s) {
|
|
126
|
-
|
|
127
|
-
})(
|
|
128
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self :
|
|
126
|
+
r.exports = s();
|
|
127
|
+
})(Fr, function() {
|
|
128
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Pr, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", g = n && typeof Symbol.toStringTag != "undefined", O = i && typeof Set.prototype.entries == "function", C = a && typeof Map.prototype.entries == "function", N = O && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), R = C && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", ne = B && Object.getPrototypeOf([][Symbol.iterator]()), de = f && typeof String.prototype[Symbol.iterator] == "function", V = de && Object.getPrototypeOf(""[Symbol.iterator]()), X = 8, q = -1;
|
|
129
129
|
function Ce(E) {
|
|
130
130
|
var k = typeof E;
|
|
131
131
|
if (k !== "object")
|
|
@@ -134,7 +134,7 @@ function Vn() {
|
|
|
134
134
|
return "null";
|
|
135
135
|
if (E === s)
|
|
136
136
|
return "global";
|
|
137
|
-
if (Array.isArray(E) && (
|
|
137
|
+
if (Array.isArray(E) && (g === !1 || !(Symbol.toStringTag in E)))
|
|
138
138
|
return "Array";
|
|
139
139
|
if (typeof window == "object" && window !== null) {
|
|
140
140
|
if (typeof window.location == "object" && E === window.location)
|
|
@@ -156,26 +156,26 @@ function Vn() {
|
|
|
156
156
|
return "HTMLTableHeaderCellElement";
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
var ut =
|
|
159
|
+
var ut = g && E[Symbol.toStringTag];
|
|
160
160
|
if (typeof ut == "string")
|
|
161
161
|
return ut;
|
|
162
162
|
var D = Object.getPrototypeOf(E);
|
|
163
|
-
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : u && D === DataView.prototype ? "DataView" : a && D === R ? "Map Iterator" : i && D ===
|
|
163
|
+
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : u && D === DataView.prototype ? "DataView" : a && D === R ? "Map Iterator" : i && D === N ? "Set Iterator" : B && D === ne ? "Array Iterator" : de && D === V ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(E).slice(X, q);
|
|
164
164
|
}
|
|
165
165
|
return Ce;
|
|
166
166
|
});
|
|
167
167
|
}(gt)), gt.exports;
|
|
168
168
|
}
|
|
169
|
-
var
|
|
170
|
-
const
|
|
169
|
+
var Dr = Vr();
|
|
170
|
+
const Lr = /* @__PURE__ */ $r(Dr), jt = typeof Buffer != "undefined", Ur = jt && typeof Buffer.from != "undefined", zr = jt ? (
|
|
171
171
|
/**
|
|
172
172
|
* is value is Buffer?
|
|
173
173
|
*
|
|
174
174
|
* @param {*} value
|
|
175
175
|
* @return {boolean}
|
|
176
176
|
*/
|
|
177
|
-
function(
|
|
178
|
-
return Buffer.isBuffer(
|
|
177
|
+
function(r) {
|
|
178
|
+
return Buffer.isBuffer(r);
|
|
179
179
|
}
|
|
180
180
|
) : (
|
|
181
181
|
/**
|
|
@@ -188,15 +188,15 @@ const Ln = /* @__PURE__ */ $n(Dn), jt = typeof Buffer != "undefined", Un = jt &&
|
|
|
188
188
|
function() {
|
|
189
189
|
return !1;
|
|
190
190
|
}
|
|
191
|
-
),
|
|
191
|
+
), Wr = Ur ? (
|
|
192
192
|
/**
|
|
193
193
|
* copy Buffer
|
|
194
194
|
*
|
|
195
195
|
* @param {Buffer} value
|
|
196
196
|
* @return {Buffer}
|
|
197
197
|
*/
|
|
198
|
-
function(
|
|
199
|
-
return Buffer.from(
|
|
198
|
+
function(r) {
|
|
199
|
+
return Buffer.from(r);
|
|
200
200
|
}
|
|
201
201
|
) : jt ? (
|
|
202
202
|
/**
|
|
@@ -207,8 +207,8 @@ const Ln = /* @__PURE__ */ $n(Dn), jt = typeof Buffer != "undefined", Un = jt &&
|
|
|
207
207
|
* @param {Buffer} value
|
|
208
208
|
* @return {Buffer}
|
|
209
209
|
*/
|
|
210
|
-
function(
|
|
211
|
-
return new Buffer(
|
|
210
|
+
function(r) {
|
|
211
|
+
return new Buffer(r);
|
|
212
212
|
}
|
|
213
213
|
) : (
|
|
214
214
|
/**
|
|
@@ -219,86 +219,86 @@ const Ln = /* @__PURE__ */ $n(Dn), jt = typeof Buffer != "undefined", Un = jt &&
|
|
|
219
219
|
* @param {*}
|
|
220
220
|
* @return {*}
|
|
221
221
|
*/
|
|
222
|
-
function(
|
|
223
|
-
return
|
|
222
|
+
function(r) {
|
|
223
|
+
return r;
|
|
224
224
|
}
|
|
225
225
|
);
|
|
226
|
-
function Se(
|
|
227
|
-
return
|
|
226
|
+
function Se(r) {
|
|
227
|
+
return zr(r) ? "Buffer" : Lr(r);
|
|
228
228
|
}
|
|
229
|
-
const
|
|
229
|
+
const Br = /* @__PURE__ */ new Set([
|
|
230
230
|
"Arguments",
|
|
231
231
|
"Array",
|
|
232
232
|
"Map",
|
|
233
233
|
"Object",
|
|
234
234
|
"Set"
|
|
235
235
|
]);
|
|
236
|
-
function
|
|
237
|
-
switch (t || Se(
|
|
236
|
+
function qr(r, e, t = null) {
|
|
237
|
+
switch (t || Se(r)) {
|
|
238
238
|
case "Arguments":
|
|
239
239
|
case "Array":
|
|
240
240
|
case "Object":
|
|
241
|
-
return
|
|
241
|
+
return r[e];
|
|
242
242
|
case "Map":
|
|
243
|
-
return
|
|
243
|
+
return r.get(e);
|
|
244
244
|
case "Set":
|
|
245
245
|
return e;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
function vt(
|
|
249
|
-
return
|
|
248
|
+
function vt(r) {
|
|
249
|
+
return Br.has(r);
|
|
250
250
|
}
|
|
251
|
-
function Ut(
|
|
252
|
-
switch (s || Se(
|
|
251
|
+
function Ut(r, e, t, s = null) {
|
|
252
|
+
switch (s || Se(r)) {
|
|
253
253
|
case "Arguments":
|
|
254
254
|
case "Array":
|
|
255
255
|
case "Object":
|
|
256
|
-
|
|
256
|
+
r[e] = t;
|
|
257
257
|
break;
|
|
258
258
|
case "Map":
|
|
259
|
-
|
|
259
|
+
r.set(e, t);
|
|
260
260
|
break;
|
|
261
261
|
case "Set":
|
|
262
|
-
|
|
262
|
+
r.add(t);
|
|
263
263
|
break;
|
|
264
264
|
}
|
|
265
|
-
return
|
|
265
|
+
return r;
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
function
|
|
269
|
-
return
|
|
267
|
+
const Hr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, Jr = typeof global != "undefined" && global !== null && global.Object === Object && global, Gr = typeof self != "undefined" && self !== null && self.Object === Object && self, ht = Hr || Jr || Gr || Function("return this")();
|
|
268
|
+
function Kr(r) {
|
|
269
|
+
return r.slice(0);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
return new Boolean(
|
|
271
|
+
function Xr(r) {
|
|
272
|
+
return new Boolean(r.valueOf());
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
return new DataView(
|
|
274
|
+
function Yr(r) {
|
|
275
|
+
return new DataView(r.buffer);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
return
|
|
277
|
+
function Qr(r) {
|
|
278
|
+
return Wr(r);
|
|
279
279
|
}
|
|
280
|
-
function es(
|
|
281
|
-
return new Date(
|
|
280
|
+
function es(r) {
|
|
281
|
+
return new Date(r.getTime());
|
|
282
282
|
}
|
|
283
|
-
function ts(
|
|
284
|
-
return new Number(
|
|
283
|
+
function ts(r) {
|
|
284
|
+
return new Number(r);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
return new RegExp(
|
|
286
|
+
function rs(r) {
|
|
287
|
+
return new RegExp(r.source, r.flags);
|
|
288
288
|
}
|
|
289
|
-
function ss(
|
|
290
|
-
return new String(
|
|
289
|
+
function ss(r) {
|
|
290
|
+
return new String(r);
|
|
291
291
|
}
|
|
292
|
-
function ae(
|
|
293
|
-
return ht[e].from ? ht[e].from(
|
|
292
|
+
function ae(r, e) {
|
|
293
|
+
return ht[e].from ? ht[e].from(r) : new ht[e](r);
|
|
294
294
|
}
|
|
295
|
-
function P(
|
|
296
|
-
return
|
|
295
|
+
function P(r) {
|
|
296
|
+
return r;
|
|
297
297
|
}
|
|
298
298
|
function zt() {
|
|
299
299
|
return [];
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function ns() {
|
|
302
302
|
return /* @__PURE__ */ new Map();
|
|
303
303
|
}
|
|
304
304
|
function as() {
|
|
@@ -309,13 +309,13 @@ function is() {
|
|
|
309
309
|
}
|
|
310
310
|
const os = /* @__PURE__ */ new Map([
|
|
311
311
|
// deep copy
|
|
312
|
-
["ArrayBuffer",
|
|
313
|
-
["Boolean",
|
|
314
|
-
["Buffer",
|
|
315
|
-
["DataView",
|
|
312
|
+
["ArrayBuffer", Kr],
|
|
313
|
+
["Boolean", Xr],
|
|
314
|
+
["Buffer", Qr],
|
|
315
|
+
["DataView", Yr],
|
|
316
316
|
["Date", es],
|
|
317
317
|
["Number", ts],
|
|
318
|
-
["RegExp",
|
|
318
|
+
["RegExp", rs],
|
|
319
319
|
["String", ss],
|
|
320
320
|
// typed arrays
|
|
321
321
|
// TODO: pass bound function
|
|
@@ -350,7 +350,7 @@ const os = /* @__PURE__ */ new Map([
|
|
|
350
350
|
// NOTE: return empty value, because recursively copy later.
|
|
351
351
|
["Arguments", zt],
|
|
352
352
|
["Array", zt],
|
|
353
|
-
["Map",
|
|
353
|
+
["Map", ns],
|
|
354
354
|
["Object", as],
|
|
355
355
|
["Set", is]
|
|
356
356
|
// NOTE: type-detect returns following types
|
|
@@ -366,17 +366,17 @@ const os = /* @__PURE__ */ new Map([
|
|
|
366
366
|
]);
|
|
367
367
|
function cs() {
|
|
368
368
|
}
|
|
369
|
-
function _t(
|
|
369
|
+
function _t(r, e = null, t = cs) {
|
|
370
370
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
371
|
-
const s = e || Se(
|
|
371
|
+
const s = e || Se(r), n = os.get(s);
|
|
372
372
|
if (s === "Object") {
|
|
373
|
-
const a = t(
|
|
373
|
+
const a = t(r, s);
|
|
374
374
|
if (a !== void 0)
|
|
375
375
|
return a;
|
|
376
376
|
}
|
|
377
|
-
return
|
|
377
|
+
return n ? n(r, s) : r;
|
|
378
378
|
}
|
|
379
|
-
function Ne(
|
|
379
|
+
function Ne(r, e = {}) {
|
|
380
380
|
typeof e == "function" && (e = {
|
|
381
381
|
customizer: e
|
|
382
382
|
});
|
|
@@ -385,42 +385,42 @@ function Ne(n, e = {}) {
|
|
|
385
385
|
customizer: t
|
|
386
386
|
// TODO: max depth
|
|
387
387
|
// depth = Infinity,
|
|
388
|
-
} = e, s = Se(
|
|
388
|
+
} = e, s = Se(r);
|
|
389
389
|
if (!vt(s))
|
|
390
|
-
return bt(
|
|
391
|
-
const
|
|
392
|
-
return bt(
|
|
390
|
+
return bt(r, null, null, null);
|
|
391
|
+
const n = _t(r, s, t), a = new WeakMap([[r, n]]), i = new WeakSet([r]);
|
|
392
|
+
return bt(r, n, a, i);
|
|
393
393
|
}
|
|
394
|
-
function bt(
|
|
395
|
-
const a = Se(
|
|
394
|
+
function bt(r, e, t, s, n) {
|
|
395
|
+
const a = Se(r), i = _t(r, a);
|
|
396
396
|
if (!vt(a))
|
|
397
397
|
return i;
|
|
398
398
|
let o;
|
|
399
399
|
switch (a) {
|
|
400
400
|
case "Arguments":
|
|
401
401
|
case "Array":
|
|
402
|
-
o = Object.keys(
|
|
402
|
+
o = Object.keys(r);
|
|
403
403
|
break;
|
|
404
404
|
case "Object":
|
|
405
|
-
o = Object.keys(
|
|
405
|
+
o = Object.keys(r), o.push(...Object.getOwnPropertySymbols(r));
|
|
406
406
|
break;
|
|
407
407
|
case "Map":
|
|
408
408
|
case "Set":
|
|
409
|
-
o =
|
|
409
|
+
o = r.keys();
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
412
|
for (let c of o) {
|
|
413
|
-
const u =
|
|
413
|
+
const u = qr(r, c, a);
|
|
414
414
|
if (s.has(u))
|
|
415
415
|
Ut(e, c, t.get(u), a);
|
|
416
416
|
else {
|
|
417
|
-
const f = Se(u),
|
|
418
|
-
vt(f) && (t.set(u,
|
|
417
|
+
const f = Se(u), g = _t(u, f);
|
|
418
|
+
vt(f) && (t.set(u, g), s.add(u)), Ut(
|
|
419
419
|
e,
|
|
420
420
|
c,
|
|
421
421
|
bt(
|
|
422
422
|
u,
|
|
423
|
-
|
|
423
|
+
g,
|
|
424
424
|
t,
|
|
425
425
|
s
|
|
426
426
|
),
|
|
@@ -430,8 +430,8 @@ function bt(n, e, t, s, r) {
|
|
|
430
430
|
}
|
|
431
431
|
return e;
|
|
432
432
|
}
|
|
433
|
-
const ds = (
|
|
434
|
-
var Ye, ye, Qe, wt,
|
|
433
|
+
const ds = (r) => new Promise((e) => setTimeout(e, r));
|
|
434
|
+
var Ye, ye, Qe, wt, rr;
|
|
435
435
|
class us {
|
|
436
436
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
437
437
|
W(this, wt), W(this, Ye), W(this, ye), W(this, Qe), j(this, Ye, e), j(this, Qe, t), j(this, ye, 0);
|
|
@@ -443,23 +443,23 @@ class us {
|
|
|
443
443
|
} catch (e) {
|
|
444
444
|
if (j(this, ye, T(this, ye) + 1), T(this, ye) > T(this, Ye))
|
|
445
445
|
throw console.error("Max attempts reached"), e;
|
|
446
|
-
const t = ee(this, wt,
|
|
446
|
+
const t = ee(this, wt, rr).call(this);
|
|
447
447
|
return yield ds(t), yield this.run();
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
Ye = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(),
|
|
452
|
+
Ye = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(), rr = function() {
|
|
453
453
|
return T(this, ye) * 1e3 * 1.5;
|
|
454
454
|
};
|
|
455
455
|
function ls() {
|
|
456
456
|
return typeof CompressionStream != "undefined";
|
|
457
457
|
}
|
|
458
|
-
function fs(
|
|
458
|
+
function fs(r) {
|
|
459
459
|
return A(this, null, function* () {
|
|
460
|
-
const e = new Blob([
|
|
460
|
+
const e = new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
461
461
|
try {
|
|
462
|
-
for (var s =
|
|
462
|
+
for (var s = Mr(e), n, a, i; n = !(a = yield s.next()).done; n = !1) {
|
|
463
463
|
const o = a.value;
|
|
464
464
|
t.push(o);
|
|
465
465
|
}
|
|
@@ -467,7 +467,7 @@ function fs(n) {
|
|
|
467
467
|
i = [o];
|
|
468
468
|
} finally {
|
|
469
469
|
try {
|
|
470
|
-
|
|
470
|
+
n && (a = s.return) && (yield a.call(s));
|
|
471
471
|
} finally {
|
|
472
472
|
if (i)
|
|
473
473
|
throw i[0];
|
|
@@ -476,16 +476,16 @@ function fs(n) {
|
|
|
476
476
|
return yield hs(t);
|
|
477
477
|
});
|
|
478
478
|
}
|
|
479
|
-
function hs(
|
|
479
|
+
function hs(r) {
|
|
480
480
|
return A(this, null, function* () {
|
|
481
|
-
const e = yield new Blob(
|
|
481
|
+
const e = yield new Blob(r).arrayBuffer();
|
|
482
482
|
return new Uint8Array(e);
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
485
|
class ps extends Error {
|
|
486
|
-
constructor({ resource: e, api: t, args: s, cause:
|
|
487
|
-
if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause =
|
|
488
|
-
for (const [i, o] of Object.entries(
|
|
486
|
+
constructor({ resource: e, api: t, args: s, cause: n }) {
|
|
487
|
+
if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause = n, this.args = s, n instanceof Error)
|
|
488
|
+
for (const [i, o] of Object.entries(n))
|
|
489
489
|
if (typeof Headers != "undefined" && o instanceof Headers) {
|
|
490
490
|
const c = {};
|
|
491
491
|
o.forEach((u, f) => {
|
|
@@ -502,11 +502,11 @@ class Wt extends Error {
|
|
|
502
502
|
url: e,
|
|
503
503
|
method: t,
|
|
504
504
|
statusCode: s,
|
|
505
|
-
requestHeaders:
|
|
505
|
+
requestHeaders: n,
|
|
506
506
|
responseHeaders: a,
|
|
507
507
|
body: i
|
|
508
508
|
}) {
|
|
509
|
-
if (super("Fetch Error"), this.name = "Fetch Error", this.url = e, this.method = t, this.statusNumber = s, this.requestHeaders =
|
|
509
|
+
if (super("Fetch Error"), this.name = "Fetch Error", this.url = e, this.method = t, this.statusNumber = s, this.requestHeaders = n, this.responseHeaders = a, i)
|
|
510
510
|
try {
|
|
511
511
|
const o = JSON.parse(i);
|
|
512
512
|
this.body = o;
|
|
@@ -531,7 +531,7 @@ class pt extends Error {
|
|
|
531
531
|
super(e), this.name = "Request Validation Error";
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function sr() {
|
|
535
535
|
return Array.from(
|
|
536
536
|
{ length: 32 },
|
|
537
537
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
@@ -560,78 +560,78 @@ class vs {
|
|
|
560
560
|
}
|
|
561
561
|
get(e) {
|
|
562
562
|
return A(this, arguments, function* (t, s = {}) {
|
|
563
|
-
const { overrideBaseAddress:
|
|
563
|
+
const { overrideBaseAddress: n, overrideDefaultHeaders: a } = s, i = n != null ? n : this.baseAddress;
|
|
564
564
|
let o = a != null ? a : this.headers;
|
|
565
565
|
const c = Ne(T(this, F));
|
|
566
|
-
return j(this, F, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Nt(U({}, o), { "X-Request-Nonce":
|
|
566
|
+
return j(this, F, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Nt(U({}, o), { "X-Request-Nonce": sr(), "X-Request-Timestamp": xt() })), c.async ? yield ee(this, Y, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield ee(this, Y, kt).call(this, `${i}${t}`, c, { headers: o });
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
post(e, t) {
|
|
570
|
-
return A(this, arguments, function* (s,
|
|
570
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
571
571
|
const i = Ne(T(this, F));
|
|
572
|
-
return j(this, F, {}), ee(this, Y, je).call(this, s, "POST",
|
|
572
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "POST", n, a, i);
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
575
|
put(e, t) {
|
|
576
|
-
return A(this, arguments, function* (s,
|
|
576
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
577
577
|
const i = Ne(T(this, F));
|
|
578
|
-
return j(this, F, {}), ee(this, Y, je).call(this, s, "PUT",
|
|
578
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "PUT", n, a, i);
|
|
579
579
|
});
|
|
580
580
|
}
|
|
581
581
|
delete(e, t) {
|
|
582
|
-
return A(this, arguments, function* (s,
|
|
582
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
583
583
|
const i = Ne(T(this, F));
|
|
584
|
-
return j(this, F, {}), ee(this, Y, je).call(this, s, "DELETE",
|
|
584
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "DELETE", n, a, i);
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
587
|
patch(e, t) {
|
|
588
|
-
return A(this, arguments, function* (s,
|
|
588
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
589
589
|
const i = Ne(T(this, F));
|
|
590
|
-
return j(this, F, {}), ee(this, Y, je).call(this, s, "PATCH",
|
|
590
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "PATCH", n, a, i);
|
|
591
591
|
});
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
ge = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), kt = function(
|
|
594
|
+
ge = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), kt = function(r, e, t) {
|
|
595
595
|
return A(this, null, function* () {
|
|
596
596
|
const s = () => A(this, null, function* () {
|
|
597
597
|
var c, u;
|
|
598
598
|
try {
|
|
599
|
-
return yield T(this, ge).call(this,
|
|
599
|
+
return yield T(this, ge).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
600
600
|
} catch (f) {
|
|
601
601
|
throw f instanceof Error && f.name === "AbortError" ? new Ie({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : f;
|
|
602
602
|
}
|
|
603
|
-
}), { headers:
|
|
604
|
-
var f,
|
|
605
|
-
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(u)) || ((
|
|
603
|
+
}), { headers: n } = t != null ? t : {}, a = (c, u) => {
|
|
604
|
+
var f, g;
|
|
605
|
+
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(u)) || ((g = c == null ? void 0 : c.headersObject) == null ? void 0 : g[u]) || "";
|
|
606
606
|
}, i = (c) => A(this, null, function* () {
|
|
607
607
|
var u;
|
|
608
608
|
if (!c.ok) {
|
|
609
|
-
const
|
|
609
|
+
const g = yield c.text().catch();
|
|
610
610
|
throw new Wt({
|
|
611
|
-
url:
|
|
611
|
+
url: r,
|
|
612
612
|
method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
|
|
613
613
|
statusCode: c.status,
|
|
614
|
-
requestHeaders:
|
|
614
|
+
requestHeaders: n,
|
|
615
615
|
responseHeaders: c.headers,
|
|
616
|
-
body:
|
|
616
|
+
body: g
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
619
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
620
620
|
try {
|
|
621
|
-
const
|
|
622
|
-
if (!
|
|
621
|
+
const g = a(c, "x-response-nonce"), O = n == null ? void 0 : n["X-Request-Nonce"];
|
|
622
|
+
if (!g || g !== O)
|
|
623
623
|
throw new pt("Response nonce mismatch");
|
|
624
|
-
const
|
|
625
|
-
if (isNaN(
|
|
624
|
+
const C = Number(a(c, "x-response-timestamp")), N = Number(xt()), R = 60 * 60 * 24;
|
|
625
|
+
if (isNaN(C) || Math.abs(N - C) > R)
|
|
626
626
|
throw new pt("Invalid response timestamp");
|
|
627
|
-
} catch (
|
|
628
|
-
const
|
|
629
|
-
throw new pt(
|
|
627
|
+
} catch (g) {
|
|
628
|
+
const O = g instanceof Error ? g.message : "Request validation failed";
|
|
629
|
+
throw new pt(O);
|
|
630
630
|
}
|
|
631
631
|
let f = yield c.text();
|
|
632
632
|
try {
|
|
633
633
|
f = JSON.parse(f);
|
|
634
|
-
} catch (
|
|
634
|
+
} catch (g) {
|
|
635
635
|
}
|
|
636
636
|
return f;
|
|
637
637
|
});
|
|
@@ -645,41 +645,41 @@ ge = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
645
645
|
const o = yield s();
|
|
646
646
|
return yield i(o);
|
|
647
647
|
});
|
|
648
|
-
}, Tt = function(
|
|
648
|
+
}, Tt = function(r, e, t) {
|
|
649
649
|
return A(this, null, function* () {
|
|
650
|
-
var s,
|
|
650
|
+
var s, n;
|
|
651
651
|
const {
|
|
652
652
|
onProgress: a,
|
|
653
653
|
abortSignal: i,
|
|
654
654
|
pollingInterval: o = () => gs,
|
|
655
655
|
maxTimeout: c = ys
|
|
656
|
-
} = e, u = `${
|
|
657
|
-
let
|
|
656
|
+
} = e, u = `${r}/async`, f = `${r}/async/job`;
|
|
657
|
+
let g;
|
|
658
658
|
try {
|
|
659
|
-
|
|
660
|
-
} catch (
|
|
661
|
-
throw
|
|
659
|
+
g = yield T(this, ge).call(this, u, U(U({}, t), i && { signal: i }));
|
|
660
|
+
} catch (N) {
|
|
661
|
+
throw N instanceof Error && N.name === "AbortError" ? new Ie({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : N;
|
|
662
662
|
}
|
|
663
|
-
if (!
|
|
664
|
-
const
|
|
663
|
+
if (!g.ok) {
|
|
664
|
+
const N = yield g.text().catch();
|
|
665
665
|
throw new Wt({
|
|
666
|
-
url:
|
|
667
|
-
method: (
|
|
668
|
-
statusCode:
|
|
666
|
+
url: r,
|
|
667
|
+
method: (n = t == null ? void 0 : t.method) != null ? n : "GET",
|
|
668
|
+
statusCode: g.status,
|
|
669
669
|
requestHeaders: this.headers,
|
|
670
|
-
responseHeaders:
|
|
671
|
-
body:
|
|
670
|
+
responseHeaders: g.headers,
|
|
671
|
+
body: N
|
|
672
672
|
});
|
|
673
673
|
}
|
|
674
|
-
const
|
|
675
|
-
if (!
|
|
674
|
+
const O = yield g.json(), { job_id: C } = O;
|
|
675
|
+
if (!C)
|
|
676
676
|
throw new Error("Job ID not found in response");
|
|
677
|
-
return new Promise((
|
|
677
|
+
return new Promise((N, R) => A(this, null, function* () {
|
|
678
678
|
const B = setTimeout(() => {
|
|
679
679
|
R(new Error("Job timed out"));
|
|
680
|
-
}, c),
|
|
680
|
+
}, c), ne = (de = 0) => A(this, null, function* () {
|
|
681
681
|
if (i != null && i.aborted) {
|
|
682
|
-
clearTimeout(B), T(this, ge).call(this, `${f}/${
|
|
682
|
+
clearTimeout(B), T(this, ge).call(this, `${f}/${C}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
683
683
|
R(new Ie({ canceled: !0 }));
|
|
684
684
|
}).catch((V) => {
|
|
685
685
|
R(new Ie({ canceled: !1 }));
|
|
@@ -687,55 +687,55 @@ ge = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
689
689
|
try {
|
|
690
|
-
const V = yield (yield T(this, ge).call(this, `${f}/${
|
|
690
|
+
const V = yield (yield T(this, ge).call(this, `${f}/${C}`, { headers: this.headers })).json();
|
|
691
691
|
if (V.status === "success") {
|
|
692
692
|
clearTimeout(B);
|
|
693
693
|
const X = V.response_json;
|
|
694
|
-
|
|
694
|
+
N(X);
|
|
695
695
|
} else if (V.status === "failed")
|
|
696
696
|
clearTimeout(B), R(new ms(V.response_json));
|
|
697
697
|
else {
|
|
698
698
|
a && a(V.response_json);
|
|
699
699
|
const X = o(de);
|
|
700
|
-
setTimeout(() =>
|
|
700
|
+
setTimeout(() => ne(de + 1), X);
|
|
701
701
|
}
|
|
702
702
|
} catch (V) {
|
|
703
703
|
R(V);
|
|
704
704
|
}
|
|
705
705
|
});
|
|
706
|
-
|
|
706
|
+
ne();
|
|
707
707
|
}));
|
|
708
708
|
});
|
|
709
|
-
}, je = function(
|
|
709
|
+
}, je = function(r, e, t, s, n) {
|
|
710
710
|
return A(this, null, function* () {
|
|
711
711
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
712
712
|
let c = i != null ? i : this.headers;
|
|
713
|
-
|
|
714
|
-
let u =
|
|
715
|
-
return
|
|
713
|
+
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = Nt(U({}, c), { "X-Request-Nonce": sr(), "X-Request-Timestamp": xt() }));
|
|
714
|
+
let u = t;
|
|
715
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (u = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ls() && (c["Content-Encoding"] = "gzip", u = yield fs(u))), n.async ? yield ee(this, Y, Tt).call(this, `${o}${r}`, n.async, {
|
|
716
716
|
method: e,
|
|
717
717
|
headers: c,
|
|
718
718
|
body: u
|
|
719
|
-
}) : yield ee(this, Y, kt).call(this, `${o}${
|
|
719
|
+
}) : yield ee(this, Y, kt).call(this, `${o}${r}`, n, { method: e, headers: c, body: u });
|
|
720
720
|
});
|
|
721
721
|
};
|
|
722
|
-
const Bt = (
|
|
722
|
+
const Bt = (r, e, t, s) => r instanceof Ie ? r : new ps({ resource: e, api: String(t), args: s, cause: r }), mt = (r, e) => new Proxy(e, {
|
|
723
723
|
get(t, s) {
|
|
724
|
-
return (...
|
|
724
|
+
return (...n) => {
|
|
725
725
|
var a;
|
|
726
|
-
for (const o of
|
|
727
|
-
const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api: s, args:
|
|
726
|
+
for (const o of r.plugins) {
|
|
727
|
+
const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api: s, args: n });
|
|
728
728
|
if (c !== void 0)
|
|
729
729
|
return c;
|
|
730
730
|
}
|
|
731
731
|
let i;
|
|
732
732
|
try {
|
|
733
|
-
i = t[s](...
|
|
733
|
+
i = t[s](...n);
|
|
734
734
|
} catch (o) {
|
|
735
|
-
throw Bt(o, t.resourceName, s,
|
|
735
|
+
throw Bt(o, t.resourceName, s, n);
|
|
736
736
|
}
|
|
737
737
|
return i instanceof Promise ? i.catch((o) => {
|
|
738
|
-
throw Bt(o, t.resourceName, s,
|
|
738
|
+
throw Bt(o, t.resourceName, s, n);
|
|
739
739
|
}) : i;
|
|
740
740
|
};
|
|
741
741
|
}
|
|
@@ -747,26 +747,26 @@ class _s {
|
|
|
747
747
|
}
|
|
748
748
|
get(e) {
|
|
749
749
|
return A(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
750
|
-
const
|
|
750
|
+
const n = new URLSearchParams(U({
|
|
751
751
|
plugin_data: "857346721138427857"
|
|
752
|
-
}, s)).toString(), a = `v1/files/${t}?${
|
|
752
|
+
}, s)).toString(), a = `v1/files/${t}?${n}`;
|
|
753
753
|
return yield T(this, Ze).get(a);
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
756
|
getImageFills(e) {
|
|
757
757
|
return A(this, arguments, function* ({ fileKey: t }) {
|
|
758
|
-
var s,
|
|
758
|
+
var s, n;
|
|
759
759
|
const a = `v1/files/${t}/images`;
|
|
760
|
-
return (
|
|
760
|
+
return (n = (s = (yield T(this, Ze).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
|
|
761
761
|
});
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
Ze = /* @__PURE__ */ new WeakMap();
|
|
765
|
-
const bs = (
|
|
765
|
+
const bs = (r, e, t) => {
|
|
766
766
|
const s = e.sort();
|
|
767
|
-
return `${
|
|
768
|
-
}, ws = (
|
|
769
|
-
var Q, St,
|
|
767
|
+
return `${r}-${s.join("-")}-${t}`;
|
|
768
|
+
}, ws = (r) => r ? r.ts > Date.now() - 1e3 * 30 : !1;
|
|
769
|
+
var Q, St, nr;
|
|
770
770
|
class xs {
|
|
771
771
|
constructor(e) {
|
|
772
772
|
W(this, St), W(this, Q), this.resourceName = "Images", j(this, Q, e);
|
|
@@ -776,15 +776,15 @@ class xs {
|
|
|
776
776
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
777
777
|
*/
|
|
778
778
|
get(e) {
|
|
779
|
-
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format:
|
|
780
|
-
const i = bs(t, s,
|
|
779
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
|
|
780
|
+
const i = bs(t, s, n), o = T(this, Q).cache.images.entries.get(i);
|
|
781
781
|
if (ws(o))
|
|
782
782
|
return o.result;
|
|
783
783
|
o && T(this, Q).cache.images.entries.delete(i);
|
|
784
784
|
const c = T(this, Q).cache.images.pendingRequests.get(i);
|
|
785
785
|
if (c)
|
|
786
786
|
return c;
|
|
787
|
-
const u = ee(this, St,
|
|
787
|
+
const u = ee(this, St, nr).call(this, i, t, s, n, a);
|
|
788
788
|
T(this, Q).cache.images.pendingRequests.set(i, u);
|
|
789
789
|
try {
|
|
790
790
|
return yield u;
|
|
@@ -794,12 +794,12 @@ class xs {
|
|
|
794
794
|
});
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
-
Q = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(),
|
|
797
|
+
Q = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), nr = function(r, e, t, s, n) {
|
|
798
798
|
return A(this, null, function* () {
|
|
799
799
|
const a = yield T(this, Q).get(
|
|
800
|
-
`v1/images/${e}?ids=${t}&format=${s}${
|
|
800
|
+
`v1/images/${e}?ids=${t}&format=${s}${n ? `&scale=${n}` : ""}`
|
|
801
801
|
);
|
|
802
|
-
return T(this, Q).cache.images.entries.set(
|
|
802
|
+
return T(this, Q).cache.images.entries.set(r, {
|
|
803
803
|
result: a,
|
|
804
804
|
ts: Date.now()
|
|
805
805
|
}), a;
|
|
@@ -811,8 +811,8 @@ class ks {
|
|
|
811
811
|
W(this, et), this.resourceName = "Nodes", j(this, et, e);
|
|
812
812
|
}
|
|
813
813
|
get(e) {
|
|
814
|
-
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params:
|
|
815
|
-
const a = Nt(U({},
|
|
814
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
|
|
815
|
+
const a = Nt(U({}, n), {
|
|
816
816
|
ids: s.join(",")
|
|
817
817
|
}), i = new URLSearchParams(U({
|
|
818
818
|
plugin_data: "857346721138427857"
|
|
@@ -823,7 +823,7 @@ class ks {
|
|
|
823
823
|
}
|
|
824
824
|
et = /* @__PURE__ */ new WeakMap();
|
|
825
825
|
var le;
|
|
826
|
-
class
|
|
826
|
+
class ar extends vs {
|
|
827
827
|
constructor({
|
|
828
828
|
baseAddress: e = "https://api.figma.com/",
|
|
829
829
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
@@ -851,88 +851,88 @@ class rn extends vs {
|
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
le = /* @__PURE__ */ new WeakMap();
|
|
854
|
-
const Ts = (
|
|
855
|
-
fileKey:
|
|
854
|
+
const Ts = (n) => M(void 0, [n], function* ({
|
|
855
|
+
fileKey: r,
|
|
856
856
|
authToken: e,
|
|
857
|
-
figmaRestApi: t = new
|
|
857
|
+
figmaRestApi: t = new ar(),
|
|
858
858
|
params: s = {}
|
|
859
859
|
}) {
|
|
860
860
|
e && (t.token = e);
|
|
861
861
|
try {
|
|
862
862
|
return yield t.files.get({
|
|
863
|
-
fileKey:
|
|
863
|
+
fileKey: r,
|
|
864
864
|
params: s
|
|
865
865
|
});
|
|
866
866
|
} catch (a) {
|
|
867
|
-
throw console.error(a),
|
|
867
|
+
throw console.error(a), er(a, r);
|
|
868
868
|
}
|
|
869
|
-
}),
|
|
870
|
-
fileKey:
|
|
869
|
+
}), Wn = (a) => M(void 0, [a], function* ({
|
|
870
|
+
fileKey: r,
|
|
871
871
|
authToken: e,
|
|
872
872
|
nodeIds: t,
|
|
873
|
-
figmaRestApi: s = new
|
|
874
|
-
params:
|
|
873
|
+
figmaRestApi: s = new ar(),
|
|
874
|
+
params: n = {}
|
|
875
875
|
}) {
|
|
876
876
|
e && (s.token = e);
|
|
877
877
|
try {
|
|
878
878
|
return (yield s.nodes.get({
|
|
879
|
-
fileKey:
|
|
879
|
+
fileKey: r,
|
|
880
880
|
nodeIds: t,
|
|
881
|
-
params: d({},
|
|
881
|
+
params: d({}, n)
|
|
882
882
|
})).nodes;
|
|
883
883
|
} catch (i) {
|
|
884
|
-
throw
|
|
885
|
-
}
|
|
886
|
-
}),
|
|
887
|
-
if (
|
|
888
|
-
return
|
|
889
|
-
if ("children" in
|
|
890
|
-
for (const t of
|
|
891
|
-
const s =
|
|
884
|
+
throw er(i, r);
|
|
885
|
+
}
|
|
886
|
+
}), ir = (r, e) => {
|
|
887
|
+
if (r.id === e)
|
|
888
|
+
return r;
|
|
889
|
+
if ("children" in r)
|
|
890
|
+
for (const t of r.children) {
|
|
891
|
+
const s = ir(t, e);
|
|
892
892
|
if (s)
|
|
893
893
|
return s;
|
|
894
894
|
}
|
|
895
895
|
return null;
|
|
896
896
|
};
|
|
897
897
|
var x;
|
|
898
|
-
(function(
|
|
899
|
-
|
|
900
|
-
function e(
|
|
898
|
+
(function(r) {
|
|
899
|
+
r.assertEqual = (n) => n;
|
|
900
|
+
function e(n) {
|
|
901
901
|
}
|
|
902
|
-
|
|
903
|
-
function t(
|
|
902
|
+
r.assertIs = e;
|
|
903
|
+
function t(n) {
|
|
904
904
|
throw new Error();
|
|
905
905
|
}
|
|
906
|
-
|
|
906
|
+
r.assertNever = t, r.arrayToEnum = (n) => {
|
|
907
907
|
const a = {};
|
|
908
|
-
for (const i of
|
|
908
|
+
for (const i of n)
|
|
909
909
|
a[i] = i;
|
|
910
910
|
return a;
|
|
911
|
-
},
|
|
912
|
-
const a =
|
|
911
|
+
}, r.getValidEnumValues = (n) => {
|
|
912
|
+
const a = r.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
|
|
913
913
|
for (const o of a)
|
|
914
|
-
i[o] =
|
|
915
|
-
return
|
|
916
|
-
},
|
|
917
|
-
return
|
|
918
|
-
}),
|
|
914
|
+
i[o] = n[o];
|
|
915
|
+
return r.objectValues(i);
|
|
916
|
+
}, r.objectValues = (n) => r.objectKeys(n).map(function(a) {
|
|
917
|
+
return n[a];
|
|
918
|
+
}), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
919
919
|
const a = [];
|
|
920
|
-
for (const i in
|
|
921
|
-
Object.prototype.hasOwnProperty.call(
|
|
920
|
+
for (const i in n)
|
|
921
|
+
Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
|
|
922
922
|
return a;
|
|
923
|
-
},
|
|
924
|
-
for (const i of
|
|
923
|
+
}, r.find = (n, a) => {
|
|
924
|
+
for (const i of n)
|
|
925
925
|
if (a(i))
|
|
926
926
|
return i;
|
|
927
|
-
},
|
|
928
|
-
function s(
|
|
929
|
-
return
|
|
927
|
+
}, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
928
|
+
function s(n, a = " | ") {
|
|
929
|
+
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
930
930
|
}
|
|
931
|
-
|
|
931
|
+
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
932
932
|
})(x || (x = {}));
|
|
933
933
|
var Et;
|
|
934
|
-
(function(
|
|
935
|
-
|
|
934
|
+
(function(r) {
|
|
935
|
+
r.mergeShapes = (e, t) => d(d({}, e), t);
|
|
936
936
|
})(Et || (Et = {}));
|
|
937
937
|
const p = x.arrayToEnum([
|
|
938
938
|
"string",
|
|
@@ -955,14 +955,14 @@ const p = x.arrayToEnum([
|
|
|
955
955
|
"never",
|
|
956
956
|
"map",
|
|
957
957
|
"set"
|
|
958
|
-
]), oe = (
|
|
959
|
-
switch (typeof
|
|
958
|
+
]), oe = (r) => {
|
|
959
|
+
switch (typeof r) {
|
|
960
960
|
case "undefined":
|
|
961
961
|
return p.undefined;
|
|
962
962
|
case "string":
|
|
963
963
|
return p.string;
|
|
964
964
|
case "number":
|
|
965
|
-
return isNaN(
|
|
965
|
+
return isNaN(r) ? p.nan : p.number;
|
|
966
966
|
case "boolean":
|
|
967
967
|
return p.boolean;
|
|
968
968
|
case "function":
|
|
@@ -972,7 +972,7 @@ const p = x.arrayToEnum([
|
|
|
972
972
|
case "symbol":
|
|
973
973
|
return p.symbol;
|
|
974
974
|
case "object":
|
|
975
|
-
return Array.isArray(
|
|
975
|
+
return Array.isArray(r) ? p.array : r === null ? p.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? p.promise : typeof Map != "undefined" && r instanceof Map ? p.map : typeof Set != "undefined" && r instanceof Set ? p.set : typeof Date != "undefined" && r instanceof Date ? p.date : p.object;
|
|
976
976
|
default:
|
|
977
977
|
return p.unknown;
|
|
978
978
|
}
|
|
@@ -993,7 +993,7 @@ const p = x.arrayToEnum([
|
|
|
993
993
|
"invalid_intersection_types",
|
|
994
994
|
"not_multiple_of",
|
|
995
995
|
"not_finite"
|
|
996
|
-
]), Ss = (
|
|
996
|
+
]), Ss = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
997
997
|
class z extends Error {
|
|
998
998
|
get errors() {
|
|
999
999
|
return this.issues;
|
|
@@ -1010,14 +1010,14 @@ class z extends Error {
|
|
|
1010
1010
|
format(e) {
|
|
1011
1011
|
const t = e || function(a) {
|
|
1012
1012
|
return a.message;
|
|
1013
|
-
}, s = { _errors: [] },
|
|
1013
|
+
}, s = { _errors: [] }, n = (a) => {
|
|
1014
1014
|
for (const i of a.issues)
|
|
1015
1015
|
if (i.code === "invalid_union")
|
|
1016
|
-
i.unionErrors.map(
|
|
1016
|
+
i.unionErrors.map(n);
|
|
1017
1017
|
else if (i.code === "invalid_return_type")
|
|
1018
|
-
|
|
1018
|
+
n(i.returnTypeError);
|
|
1019
1019
|
else if (i.code === "invalid_arguments")
|
|
1020
|
-
|
|
1020
|
+
n(i.argumentsError);
|
|
1021
1021
|
else if (i.path.length === 0)
|
|
1022
1022
|
s._errors.push(t(i));
|
|
1023
1023
|
else {
|
|
@@ -1028,7 +1028,7 @@ class z extends Error {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
};
|
|
1031
|
-
return
|
|
1031
|
+
return n(this), s;
|
|
1032
1032
|
}
|
|
1033
1033
|
static assert(e) {
|
|
1034
1034
|
if (!(e instanceof z))
|
|
@@ -1045,35 +1045,35 @@ class z extends Error {
|
|
|
1045
1045
|
}
|
|
1046
1046
|
flatten(e = (t) => t.message) {
|
|
1047
1047
|
const t = {}, s = [];
|
|
1048
|
-
for (const
|
|
1049
|
-
|
|
1048
|
+
for (const n of this.issues)
|
|
1049
|
+
n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : s.push(e(n));
|
|
1050
1050
|
return { formErrors: s, fieldErrors: t };
|
|
1051
1051
|
}
|
|
1052
1052
|
get formErrors() {
|
|
1053
1053
|
return this.flatten();
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
|
-
z.create = (
|
|
1057
|
-
const Ee = (
|
|
1056
|
+
z.create = (r) => new z(r);
|
|
1057
|
+
const Ee = (r, e) => {
|
|
1058
1058
|
let t;
|
|
1059
|
-
switch (
|
|
1059
|
+
switch (r.code) {
|
|
1060
1060
|
case l.invalid_type:
|
|
1061
|
-
|
|
1061
|
+
r.received === p.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
1062
1062
|
break;
|
|
1063
1063
|
case l.invalid_literal:
|
|
1064
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
1064
|
+
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
1065
1065
|
break;
|
|
1066
1066
|
case l.unrecognized_keys:
|
|
1067
|
-
t = `Unrecognized key(s) in object: ${x.joinValues(
|
|
1067
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
1068
1068
|
break;
|
|
1069
1069
|
case l.invalid_union:
|
|
1070
1070
|
t = "Invalid input";
|
|
1071
1071
|
break;
|
|
1072
1072
|
case l.invalid_union_discriminator:
|
|
1073
|
-
t = `Invalid discriminator value. Expected ${x.joinValues(
|
|
1073
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
1074
1074
|
break;
|
|
1075
1075
|
case l.invalid_enum_value:
|
|
1076
|
-
t = `Invalid enum value. Expected ${x.joinValues(
|
|
1076
|
+
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
1077
1077
|
break;
|
|
1078
1078
|
case l.invalid_arguments:
|
|
1079
1079
|
t = "Invalid function arguments";
|
|
@@ -1085,13 +1085,13 @@ const Ee = (n, e) => {
|
|
|
1085
1085
|
t = "Invalid date";
|
|
1086
1086
|
break;
|
|
1087
1087
|
case l.invalid_string:
|
|
1088
|
-
typeof
|
|
1088
|
+
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
1089
1089
|
break;
|
|
1090
1090
|
case l.too_small:
|
|
1091
|
-
|
|
1091
|
+
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
1092
1092
|
break;
|
|
1093
1093
|
case l.too_big:
|
|
1094
|
-
|
|
1094
|
+
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
1095
1095
|
break;
|
|
1096
1096
|
case l.custom:
|
|
1097
1097
|
t = "Invalid input";
|
|
@@ -1100,58 +1100,58 @@ const Ee = (n, e) => {
|
|
|
1100
1100
|
t = "Intersection results could not be merged";
|
|
1101
1101
|
break;
|
|
1102
1102
|
case l.not_multiple_of:
|
|
1103
|
-
t = `Number must be a multiple of ${
|
|
1103
|
+
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
1104
1104
|
break;
|
|
1105
1105
|
case l.not_finite:
|
|
1106
1106
|
t = "Number must be finite";
|
|
1107
1107
|
break;
|
|
1108
1108
|
default:
|
|
1109
|
-
t = e.defaultError, x.assertNever(
|
|
1109
|
+
t = e.defaultError, x.assertNever(r);
|
|
1110
1110
|
}
|
|
1111
1111
|
return { message: t };
|
|
1112
1112
|
};
|
|
1113
|
-
let
|
|
1114
|
-
function Es(
|
|
1115
|
-
|
|
1113
|
+
let or = Ee;
|
|
1114
|
+
function Es(r) {
|
|
1115
|
+
or = r;
|
|
1116
1116
|
}
|
|
1117
1117
|
function tt() {
|
|
1118
|
-
return
|
|
1118
|
+
return or;
|
|
1119
1119
|
}
|
|
1120
|
-
const
|
|
1121
|
-
const { data: e, path: t, errorMaps: s, issueData:
|
|
1120
|
+
const rt = (r) => {
|
|
1121
|
+
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = y(d({}, n), {
|
|
1122
1122
|
path: a
|
|
1123
1123
|
});
|
|
1124
|
-
if (
|
|
1125
|
-
return y(d({},
|
|
1124
|
+
if (n.message !== void 0)
|
|
1125
|
+
return y(d({}, n), {
|
|
1126
1126
|
path: a,
|
|
1127
|
-
message:
|
|
1127
|
+
message: n.message
|
|
1128
1128
|
});
|
|
1129
1129
|
let o = "";
|
|
1130
1130
|
const c = s.filter((u) => !!u).slice().reverse();
|
|
1131
1131
|
for (const u of c)
|
|
1132
1132
|
o = u(i, { data: e, defaultError: o }).message;
|
|
1133
|
-
return y(d({},
|
|
1133
|
+
return y(d({}, n), {
|
|
1134
1134
|
path: a,
|
|
1135
1135
|
message: o
|
|
1136
1136
|
});
|
|
1137
1137
|
}, As = [];
|
|
1138
|
-
function h(
|
|
1139
|
-
const t = tt(), s =
|
|
1138
|
+
function h(r, e) {
|
|
1139
|
+
const t = tt(), s = rt({
|
|
1140
1140
|
issueData: e,
|
|
1141
|
-
data:
|
|
1142
|
-
path:
|
|
1141
|
+
data: r.data,
|
|
1142
|
+
path: r.path,
|
|
1143
1143
|
errorMaps: [
|
|
1144
|
-
|
|
1144
|
+
r.common.contextualErrorMap,
|
|
1145
1145
|
// contextual error map is first priority
|
|
1146
|
-
|
|
1146
|
+
r.schemaErrorMap,
|
|
1147
1147
|
// then schema-bound map if available
|
|
1148
1148
|
t,
|
|
1149
1149
|
// then global override map
|
|
1150
1150
|
t === Ee ? void 0 : Ee
|
|
1151
1151
|
// then global default map
|
|
1152
|
-
].filter((
|
|
1152
|
+
].filter((n) => !!n)
|
|
1153
1153
|
});
|
|
1154
|
-
|
|
1154
|
+
r.common.issues.push(s);
|
|
1155
1155
|
}
|
|
1156
1156
|
class Z {
|
|
1157
1157
|
constructor() {
|
|
@@ -1165,18 +1165,18 @@ class Z {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
static mergeArray(e, t) {
|
|
1167
1167
|
const s = [];
|
|
1168
|
-
for (const
|
|
1169
|
-
if (
|
|
1170
|
-
return
|
|
1171
|
-
|
|
1168
|
+
for (const n of t) {
|
|
1169
|
+
if (n.status === "aborted")
|
|
1170
|
+
return _;
|
|
1171
|
+
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
1172
1172
|
}
|
|
1173
1173
|
return { status: e.value, value: s };
|
|
1174
1174
|
}
|
|
1175
1175
|
static mergeObjectAsync(e, t) {
|
|
1176
1176
|
return M(this, null, function* () {
|
|
1177
1177
|
const s = [];
|
|
1178
|
-
for (const
|
|
1179
|
-
const a = yield
|
|
1178
|
+
for (const n of t) {
|
|
1179
|
+
const a = yield n.key, i = yield n.value;
|
|
1180
1180
|
s.push({
|
|
1181
1181
|
key: a,
|
|
1182
1182
|
value: i
|
|
@@ -1187,65 +1187,65 @@ class Z {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
static mergeObjectSync(e, t) {
|
|
1189
1189
|
const s = {};
|
|
1190
|
-
for (const
|
|
1191
|
-
const { key: a, value: i } =
|
|
1190
|
+
for (const n of t) {
|
|
1191
|
+
const { key: a, value: i } = n;
|
|
1192
1192
|
if (a.status === "aborted" || i.status === "aborted")
|
|
1193
|
-
return
|
|
1194
|
-
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" ||
|
|
1193
|
+
return _;
|
|
1194
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || n.alwaysSet) && (s[a.value] = i.value);
|
|
1195
1195
|
}
|
|
1196
1196
|
return { status: e.value, value: s };
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
const
|
|
1199
|
+
const _ = Object.freeze({
|
|
1200
1200
|
status: "aborted"
|
|
1201
|
-
}), ke = (
|
|
1202
|
-
function st(
|
|
1203
|
-
if (typeof e == "function" ?
|
|
1204
|
-
return e.get(
|
|
1201
|
+
}), ke = (r) => ({ status: "dirty", value: r }), $ = (r) => ({ status: "valid", value: r }), At = (r) => r.status === "aborted", Ot = (r) => r.status === "dirty", _e = (r) => r.status === "valid", Pe = (r) => typeof Promise != "undefined" && r instanceof Promise;
|
|
1202
|
+
function st(r, e, t, s) {
|
|
1203
|
+
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1204
|
+
return e.get(r);
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1207
|
-
if (typeof e == "function" ?
|
|
1208
|
-
return e.set(
|
|
1206
|
+
function cr(r, e, t, s, n) {
|
|
1207
|
+
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1208
|
+
return e.set(r, t), t;
|
|
1209
1209
|
}
|
|
1210
1210
|
var m;
|
|
1211
|
-
(function(
|
|
1212
|
-
|
|
1211
|
+
(function(r) {
|
|
1212
|
+
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1213
1213
|
})(m || (m = {}));
|
|
1214
1214
|
var Re, Me;
|
|
1215
|
-
class
|
|
1216
|
-
constructor(e, t, s,
|
|
1217
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key =
|
|
1215
|
+
class re {
|
|
1216
|
+
constructor(e, t, s, n) {
|
|
1217
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
1218
1218
|
}
|
|
1219
1219
|
get path() {
|
|
1220
1220
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
|
-
const qt = (
|
|
1223
|
+
const qt = (r, e) => {
|
|
1224
1224
|
if (_e(e))
|
|
1225
1225
|
return { success: !0, data: e.value };
|
|
1226
|
-
if (!
|
|
1226
|
+
if (!r.common.issues.length)
|
|
1227
1227
|
throw new Error("Validation failed but no issues detected.");
|
|
1228
1228
|
return {
|
|
1229
1229
|
success: !1,
|
|
1230
1230
|
get error() {
|
|
1231
1231
|
if (this._error)
|
|
1232
1232
|
return this._error;
|
|
1233
|
-
const t = new z(
|
|
1233
|
+
const t = new z(r.common.issues);
|
|
1234
1234
|
return this._error = t, this._error;
|
|
1235
1235
|
}
|
|
1236
1236
|
};
|
|
1237
1237
|
};
|
|
1238
|
-
function b(
|
|
1239
|
-
if (!
|
|
1238
|
+
function b(r) {
|
|
1239
|
+
if (!r)
|
|
1240
1240
|
return {};
|
|
1241
|
-
const { errorMap: e, invalid_type_error: t, required_error: s, description:
|
|
1241
|
+
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
|
|
1242
1242
|
if (e && (t || s))
|
|
1243
1243
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1244
|
-
return e ? { errorMap: e, description:
|
|
1244
|
+
return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
|
|
1245
1245
|
var c, u;
|
|
1246
|
-
const { message: f } =
|
|
1246
|
+
const { message: f } = r;
|
|
1247
1247
|
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = f != null ? f : t) !== null && u !== void 0 ? u : o.defaultError };
|
|
1248
|
-
}, description:
|
|
1248
|
+
}, description: n };
|
|
1249
1249
|
}
|
|
1250
1250
|
class w {
|
|
1251
1251
|
get description() {
|
|
@@ -1295,7 +1295,7 @@ class w {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
safeParse(e, t) {
|
|
1297
1297
|
var s;
|
|
1298
|
-
const
|
|
1298
|
+
const n = {
|
|
1299
1299
|
common: {
|
|
1300
1300
|
issues: [],
|
|
1301
1301
|
async: (s = t == null ? void 0 : t.async) !== null && s !== void 0 ? s : !1,
|
|
@@ -1306,12 +1306,12 @@ class w {
|
|
|
1306
1306
|
parent: null,
|
|
1307
1307
|
data: e,
|
|
1308
1308
|
parsedType: oe(e)
|
|
1309
|
-
}, a = this._parseSync({ data: e, path:
|
|
1310
|
-
return qt(
|
|
1309
|
+
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1310
|
+
return qt(n, a);
|
|
1311
1311
|
}
|
|
1312
1312
|
"~validate"(e) {
|
|
1313
1313
|
var t, s;
|
|
1314
|
-
const
|
|
1314
|
+
const n = {
|
|
1315
1315
|
common: {
|
|
1316
1316
|
issues: [],
|
|
1317
1317
|
async: !!this["~standard"].async
|
|
@@ -1324,22 +1324,22 @@ class w {
|
|
|
1324
1324
|
};
|
|
1325
1325
|
if (!this["~standard"].async)
|
|
1326
1326
|
try {
|
|
1327
|
-
const a = this._parseSync({ data: e, path: [], parent:
|
|
1327
|
+
const a = this._parseSync({ data: e, path: [], parent: n });
|
|
1328
1328
|
return _e(a) ? {
|
|
1329
1329
|
value: a.value
|
|
1330
1330
|
} : {
|
|
1331
|
-
issues:
|
|
1331
|
+
issues: n.common.issues
|
|
1332
1332
|
};
|
|
1333
1333
|
} catch (a) {
|
|
1334
|
-
!((s = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || s === void 0) && s.includes("encountered") && (this["~standard"].async = !0),
|
|
1334
|
+
!((s = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || s === void 0) && s.includes("encountered") && (this["~standard"].async = !0), n.common = {
|
|
1335
1335
|
issues: [],
|
|
1336
1336
|
async: !0
|
|
1337
1337
|
};
|
|
1338
1338
|
}
|
|
1339
|
-
return this._parseAsync({ data: e, path: [], parent:
|
|
1339
|
+
return this._parseAsync({ data: e, path: [], parent: n }).then((a) => _e(a) ? {
|
|
1340
1340
|
value: a.value
|
|
1341
1341
|
} : {
|
|
1342
|
-
issues:
|
|
1342
|
+
issues: n.common.issues
|
|
1343
1343
|
});
|
|
1344
1344
|
}
|
|
1345
1345
|
parseAsync(e, t) {
|
|
@@ -1363,26 +1363,26 @@ class w {
|
|
|
1363
1363
|
parent: null,
|
|
1364
1364
|
data: e,
|
|
1365
1365
|
parsedType: oe(e)
|
|
1366
|
-
},
|
|
1366
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield Pe(n) ? n : Promise.resolve(n);
|
|
1367
1367
|
return qt(s, a);
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
1370
|
refine(e, t) {
|
|
1371
|
-
const s = (
|
|
1372
|
-
return this._refinement((
|
|
1373
|
-
const i = e(
|
|
1371
|
+
const s = (n) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
1372
|
+
return this._refinement((n, a) => {
|
|
1373
|
+
const i = e(n), o = () => a.addIssue(d({
|
|
1374
1374
|
code: l.custom
|
|
1375
|
-
}, s(
|
|
1375
|
+
}, s(n)));
|
|
1376
1376
|
return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
1377
1377
|
});
|
|
1378
1378
|
}
|
|
1379
1379
|
refinement(e, t) {
|
|
1380
|
-
return this._refinement((s,
|
|
1380
|
+
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
1381
1381
|
}
|
|
1382
1382
|
_refinement(e) {
|
|
1383
1383
|
return new K({
|
|
1384
1384
|
schema: this,
|
|
1385
|
-
typeName:
|
|
1385
|
+
typeName: v.ZodEffects,
|
|
1386
1386
|
effect: { type: "refinement", refinement: e }
|
|
1387
1387
|
});
|
|
1388
1388
|
}
|
|
@@ -1420,7 +1420,7 @@ class w {
|
|
|
1420
1420
|
transform(e) {
|
|
1421
1421
|
return new K(y(d({}, b(this._def)), {
|
|
1422
1422
|
schema: this,
|
|
1423
|
-
typeName:
|
|
1423
|
+
typeName: v.ZodEffects,
|
|
1424
1424
|
effect: { type: "transform", transform: e }
|
|
1425
1425
|
}));
|
|
1426
1426
|
}
|
|
@@ -1429,12 +1429,12 @@ class w {
|
|
|
1429
1429
|
return new qe(y(d({}, b(this._def)), {
|
|
1430
1430
|
innerType: this,
|
|
1431
1431
|
defaultValue: t,
|
|
1432
|
-
typeName:
|
|
1432
|
+
typeName: v.ZodDefault
|
|
1433
1433
|
}));
|
|
1434
1434
|
}
|
|
1435
1435
|
brand() {
|
|
1436
1436
|
return new Zt(d({
|
|
1437
|
-
typeName:
|
|
1437
|
+
typeName: v.ZodBranded,
|
|
1438
1438
|
type: this
|
|
1439
1439
|
}, b(this._def)));
|
|
1440
1440
|
}
|
|
@@ -1443,7 +1443,7 @@ class w {
|
|
|
1443
1443
|
return new He(y(d({}, b(this._def)), {
|
|
1444
1444
|
innerType: this,
|
|
1445
1445
|
catchValue: t,
|
|
1446
|
-
typeName:
|
|
1446
|
+
typeName: v.ZodCatch
|
|
1447
1447
|
}));
|
|
1448
1448
|
}
|
|
1449
1449
|
describe(e) {
|
|
@@ -1467,34 +1467,34 @@ class w {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
const Os = /^c[^\s-]{8,}$/i, Cs = /^[0-9a-z]+$/, Ns = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Is = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, js = /^[a-z0-9_-]{21}$/i, Zs = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Rs = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ms = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ps = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1469
1469
|
let yt;
|
|
1470
|
-
const $s = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Fs = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Vs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ds = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ls = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Us = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
1471
|
-
function
|
|
1470
|
+
const $s = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Fs = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Vs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ds = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ls = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Us = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, dr = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", zs = new RegExp(`^${dr}$`);
|
|
1471
|
+
function ur(r) {
|
|
1472
1472
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1473
|
-
return
|
|
1473
|
+
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1474
1474
|
}
|
|
1475
|
-
function Ws(
|
|
1476
|
-
return new RegExp(`^${
|
|
1475
|
+
function Ws(r) {
|
|
1476
|
+
return new RegExp(`^${ur(r)}$`);
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1479
|
-
let e = `${
|
|
1478
|
+
function lr(r) {
|
|
1479
|
+
let e = `${dr}T${ur(r)}`;
|
|
1480
1480
|
const t = [];
|
|
1481
|
-
return t.push(
|
|
1481
|
+
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1482
1482
|
}
|
|
1483
|
-
function Bs(
|
|
1484
|
-
return !!((e === "v4" || !e) && $s.test(
|
|
1483
|
+
function Bs(r, e) {
|
|
1484
|
+
return !!((e === "v4" || !e) && $s.test(r) || (e === "v6" || !e) && Vs.test(r));
|
|
1485
1485
|
}
|
|
1486
|
-
function qs(
|
|
1487
|
-
if (!Zs.test(
|
|
1486
|
+
function qs(r, e) {
|
|
1487
|
+
if (!Zs.test(r))
|
|
1488
1488
|
return !1;
|
|
1489
1489
|
try {
|
|
1490
|
-
const [t] =
|
|
1491
|
-
return !(typeof
|
|
1490
|
+
const [t] = r.split("."), s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(s));
|
|
1491
|
+
return !(typeof n != "object" || n === null || !n.typ || !n.alg || e && n.alg !== e);
|
|
1492
1492
|
} catch (t) {
|
|
1493
1493
|
return !1;
|
|
1494
1494
|
}
|
|
1495
1495
|
}
|
|
1496
|
-
function Hs(
|
|
1497
|
-
return !!((e === "v4" || !e) && Fs.test(
|
|
1496
|
+
function Hs(r, e) {
|
|
1497
|
+
return !!((e === "v4" || !e) && Fs.test(r) || (e === "v6" || !e) && Ds.test(r));
|
|
1498
1498
|
}
|
|
1499
1499
|
class J extends w {
|
|
1500
1500
|
_parse(e) {
|
|
@@ -1504,13 +1504,13 @@ class J extends w {
|
|
|
1504
1504
|
code: l.invalid_type,
|
|
1505
1505
|
expected: p.string,
|
|
1506
1506
|
received: a.parsedType
|
|
1507
|
-
}),
|
|
1507
|
+
}), _;
|
|
1508
1508
|
}
|
|
1509
1509
|
const s = new Z();
|
|
1510
|
-
let
|
|
1510
|
+
let n;
|
|
1511
1511
|
for (const a of this._def.checks)
|
|
1512
1512
|
if (a.kind === "min")
|
|
1513
|
-
e.data.length < a.value && (
|
|
1513
|
+
e.data.length < a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1514
1514
|
code: l.too_small,
|
|
1515
1515
|
minimum: a.value,
|
|
1516
1516
|
type: "string",
|
|
@@ -1519,7 +1519,7 @@ class J extends w {
|
|
|
1519
1519
|
message: a.message
|
|
1520
1520
|
}), s.dirty());
|
|
1521
1521
|
else if (a.kind === "max")
|
|
1522
|
-
e.data.length > a.value && (
|
|
1522
|
+
e.data.length > a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1523
1523
|
code: l.too_big,
|
|
1524
1524
|
maximum: a.value,
|
|
1525
1525
|
type: "string",
|
|
@@ -1529,14 +1529,14 @@ class J extends w {
|
|
|
1529
1529
|
}), s.dirty());
|
|
1530
1530
|
else if (a.kind === "length") {
|
|
1531
1531
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
1532
|
-
(i || o) && (
|
|
1532
|
+
(i || o) && (n = this._getOrReturnCtx(e, n), i ? h(n, {
|
|
1533
1533
|
code: l.too_big,
|
|
1534
1534
|
maximum: a.value,
|
|
1535
1535
|
type: "string",
|
|
1536
1536
|
inclusive: !0,
|
|
1537
1537
|
exact: !0,
|
|
1538
1538
|
message: a.message
|
|
1539
|
-
}) : o && h(
|
|
1539
|
+
}) : o && h(n, {
|
|
1540
1540
|
code: l.too_small,
|
|
1541
1541
|
minimum: a.value,
|
|
1542
1542
|
type: "string",
|
|
@@ -1545,43 +1545,43 @@ class J extends w {
|
|
|
1545
1545
|
message: a.message
|
|
1546
1546
|
}), s.dirty());
|
|
1547
1547
|
} else if (a.kind === "email")
|
|
1548
|
-
Ms.test(e.data) || (
|
|
1548
|
+
Ms.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1549
1549
|
validation: "email",
|
|
1550
1550
|
code: l.invalid_string,
|
|
1551
1551
|
message: a.message
|
|
1552
1552
|
}), s.dirty());
|
|
1553
1553
|
else if (a.kind === "emoji")
|
|
1554
|
-
yt || (yt = new RegExp(Ps, "u")), yt.test(e.data) || (
|
|
1554
|
+
yt || (yt = new RegExp(Ps, "u")), yt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1555
1555
|
validation: "emoji",
|
|
1556
1556
|
code: l.invalid_string,
|
|
1557
1557
|
message: a.message
|
|
1558
1558
|
}), s.dirty());
|
|
1559
1559
|
else if (a.kind === "uuid")
|
|
1560
|
-
Is.test(e.data) || (
|
|
1560
|
+
Is.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1561
1561
|
validation: "uuid",
|
|
1562
1562
|
code: l.invalid_string,
|
|
1563
1563
|
message: a.message
|
|
1564
1564
|
}), s.dirty());
|
|
1565
1565
|
else if (a.kind === "nanoid")
|
|
1566
|
-
js.test(e.data) || (
|
|
1566
|
+
js.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1567
1567
|
validation: "nanoid",
|
|
1568
1568
|
code: l.invalid_string,
|
|
1569
1569
|
message: a.message
|
|
1570
1570
|
}), s.dirty());
|
|
1571
1571
|
else if (a.kind === "cuid")
|
|
1572
|
-
Os.test(e.data) || (
|
|
1572
|
+
Os.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1573
1573
|
validation: "cuid",
|
|
1574
1574
|
code: l.invalid_string,
|
|
1575
1575
|
message: a.message
|
|
1576
1576
|
}), s.dirty());
|
|
1577
1577
|
else if (a.kind === "cuid2")
|
|
1578
|
-
Cs.test(e.data) || (
|
|
1578
|
+
Cs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1579
1579
|
validation: "cuid2",
|
|
1580
1580
|
code: l.invalid_string,
|
|
1581
1581
|
message: a.message
|
|
1582
1582
|
}), s.dirty());
|
|
1583
1583
|
else if (a.kind === "ulid")
|
|
1584
|
-
Ns.test(e.data) || (
|
|
1584
|
+
Ns.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1585
1585
|
validation: "ulid",
|
|
1586
1586
|
code: l.invalid_string,
|
|
1587
1587
|
message: a.message
|
|
@@ -1590,61 +1590,61 @@ class J extends w {
|
|
|
1590
1590
|
try {
|
|
1591
1591
|
new URL(e.data);
|
|
1592
1592
|
} catch (i) {
|
|
1593
|
-
|
|
1593
|
+
n = this._getOrReturnCtx(e, n), h(n, {
|
|
1594
1594
|
validation: "url",
|
|
1595
1595
|
code: l.invalid_string,
|
|
1596
1596
|
message: a.message
|
|
1597
1597
|
}), s.dirty();
|
|
1598
1598
|
}
|
|
1599
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (
|
|
1599
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1600
1600
|
validation: "regex",
|
|
1601
1601
|
code: l.invalid_string,
|
|
1602
1602
|
message: a.message
|
|
1603
|
-
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (
|
|
1603
|
+
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1604
1604
|
code: l.invalid_string,
|
|
1605
1605
|
validation: { includes: a.value, position: a.position },
|
|
1606
1606
|
message: a.message
|
|
1607
|
-
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (
|
|
1607
|
+
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1608
1608
|
code: l.invalid_string,
|
|
1609
1609
|
validation: { startsWith: a.value },
|
|
1610
1610
|
message: a.message
|
|
1611
|
-
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (
|
|
1611
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1612
1612
|
code: l.invalid_string,
|
|
1613
1613
|
validation: { endsWith: a.value },
|
|
1614
1614
|
message: a.message
|
|
1615
|
-
}), s.dirty()) : a.kind === "datetime" ?
|
|
1615
|
+
}), s.dirty()) : a.kind === "datetime" ? lr(a).test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1616
1616
|
code: l.invalid_string,
|
|
1617
1617
|
validation: "datetime",
|
|
1618
1618
|
message: a.message
|
|
1619
|
-
}), s.dirty()) : a.kind === "date" ? zs.test(e.data) || (
|
|
1619
|
+
}), s.dirty()) : a.kind === "date" ? zs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1620
1620
|
code: l.invalid_string,
|
|
1621
1621
|
validation: "date",
|
|
1622
1622
|
message: a.message
|
|
1623
|
-
}), s.dirty()) : a.kind === "time" ? Ws(a).test(e.data) || (
|
|
1623
|
+
}), s.dirty()) : a.kind === "time" ? Ws(a).test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1624
1624
|
code: l.invalid_string,
|
|
1625
1625
|
validation: "time",
|
|
1626
1626
|
message: a.message
|
|
1627
|
-
}), s.dirty()) : a.kind === "duration" ? Rs.test(e.data) || (
|
|
1627
|
+
}), s.dirty()) : a.kind === "duration" ? Rs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1628
1628
|
validation: "duration",
|
|
1629
1629
|
code: l.invalid_string,
|
|
1630
1630
|
message: a.message
|
|
1631
|
-
}), s.dirty()) : a.kind === "ip" ? Bs(e.data, a.version) || (
|
|
1631
|
+
}), s.dirty()) : a.kind === "ip" ? Bs(e.data, a.version) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1632
1632
|
validation: "ip",
|
|
1633
1633
|
code: l.invalid_string,
|
|
1634
1634
|
message: a.message
|
|
1635
|
-
}), s.dirty()) : a.kind === "jwt" ? qs(e.data, a.alg) || (
|
|
1635
|
+
}), s.dirty()) : a.kind === "jwt" ? qs(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1636
1636
|
validation: "jwt",
|
|
1637
1637
|
code: l.invalid_string,
|
|
1638
1638
|
message: a.message
|
|
1639
|
-
}), s.dirty()) : a.kind === "cidr" ? Hs(e.data, a.version) || (
|
|
1639
|
+
}), s.dirty()) : a.kind === "cidr" ? Hs(e.data, a.version) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1640
1640
|
validation: "cidr",
|
|
1641
1641
|
code: l.invalid_string,
|
|
1642
1642
|
message: a.message
|
|
1643
|
-
}), s.dirty()) : a.kind === "base64" ? Ls.test(e.data) || (
|
|
1643
|
+
}), s.dirty()) : a.kind === "base64" ? Ls.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1644
1644
|
validation: "base64",
|
|
1645
1645
|
code: l.invalid_string,
|
|
1646
1646
|
message: a.message
|
|
1647
|
-
}), s.dirty()) : a.kind === "base64url" ? Us.test(e.data) || (
|
|
1647
|
+
}), s.dirty()) : a.kind === "base64url" ? Us.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1648
1648
|
validation: "base64url",
|
|
1649
1649
|
code: l.invalid_string,
|
|
1650
1650
|
message: a.message
|
|
@@ -1652,7 +1652,7 @@ class J extends w {
|
|
|
1652
1652
|
return { status: s.value, value: e.data };
|
|
1653
1653
|
}
|
|
1654
1654
|
_regex(e, t, s) {
|
|
1655
|
-
return this.refinement((
|
|
1655
|
+
return this.refinement((n) => e.test(n), d({
|
|
1656
1656
|
validation: t,
|
|
1657
1657
|
code: l.invalid_string
|
|
1658
1658
|
}, m.errToObj(s)));
|
|
@@ -1859,17 +1859,17 @@ class J extends w {
|
|
|
1859
1859
|
return e;
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
|
-
J.create = (
|
|
1862
|
+
J.create = (r) => {
|
|
1863
1863
|
var e;
|
|
1864
1864
|
return new J(d({
|
|
1865
1865
|
checks: [],
|
|
1866
|
-
typeName:
|
|
1867
|
-
coerce: (e =
|
|
1868
|
-
}, b(
|
|
1866
|
+
typeName: v.ZodString,
|
|
1867
|
+
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
1868
|
+
}, b(r)));
|
|
1869
1869
|
};
|
|
1870
|
-
function Js(
|
|
1871
|
-
const t = (
|
|
1872
|
-
return a % i / Math.pow(10,
|
|
1870
|
+
function Js(r, e) {
|
|
1871
|
+
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
1872
|
+
return a % i / Math.pow(10, n);
|
|
1873
1873
|
}
|
|
1874
1874
|
class fe extends w {
|
|
1875
1875
|
constructor() {
|
|
@@ -1882,39 +1882,39 @@ class fe extends w {
|
|
|
1882
1882
|
code: l.invalid_type,
|
|
1883
1883
|
expected: p.number,
|
|
1884
1884
|
received: a.parsedType
|
|
1885
|
-
}),
|
|
1885
|
+
}), _;
|
|
1886
1886
|
}
|
|
1887
1887
|
let s;
|
|
1888
|
-
const
|
|
1888
|
+
const n = new Z();
|
|
1889
1889
|
for (const a of this._def.checks)
|
|
1890
1890
|
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1891
1891
|
code: l.invalid_type,
|
|
1892
1892
|
expected: "integer",
|
|
1893
1893
|
received: "float",
|
|
1894
1894
|
message: a.message
|
|
1895
|
-
}),
|
|
1895
|
+
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1896
1896
|
code: l.too_small,
|
|
1897
1897
|
minimum: a.value,
|
|
1898
1898
|
type: "number",
|
|
1899
1899
|
inclusive: a.inclusive,
|
|
1900
1900
|
exact: !1,
|
|
1901
1901
|
message: a.message
|
|
1902
|
-
}),
|
|
1902
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1903
1903
|
code: l.too_big,
|
|
1904
1904
|
maximum: a.value,
|
|
1905
1905
|
type: "number",
|
|
1906
1906
|
inclusive: a.inclusive,
|
|
1907
1907
|
exact: !1,
|
|
1908
1908
|
message: a.message
|
|
1909
|
-
}),
|
|
1909
|
+
}), n.dirty()) : a.kind === "multipleOf" ? Js(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1910
1910
|
code: l.not_multiple_of,
|
|
1911
1911
|
multipleOf: a.value,
|
|
1912
1912
|
message: a.message
|
|
1913
|
-
}),
|
|
1913
|
+
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1914
1914
|
code: l.not_finite,
|
|
1915
1915
|
message: a.message
|
|
1916
|
-
}),
|
|
1917
|
-
return { status:
|
|
1916
|
+
}), n.dirty()) : x.assertNever(a);
|
|
1917
|
+
return { status: n.value, value: e.data };
|
|
1918
1918
|
}
|
|
1919
1919
|
gte(e, t) {
|
|
1920
1920
|
return this.setLimit("min", e, !0, m.toString(t));
|
|
@@ -1928,7 +1928,7 @@ class fe extends w {
|
|
|
1928
1928
|
lt(e, t) {
|
|
1929
1929
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1930
1930
|
}
|
|
1931
|
-
setLimit(e, t, s,
|
|
1931
|
+
setLimit(e, t, s, n) {
|
|
1932
1932
|
return new fe(y(d({}, this._def), {
|
|
1933
1933
|
checks: [
|
|
1934
1934
|
...this._def.checks,
|
|
@@ -1936,7 +1936,7 @@ class fe extends w {
|
|
|
1936
1936
|
kind: e,
|
|
1937
1937
|
value: t,
|
|
1938
1938
|
inclusive: s,
|
|
1939
|
-
message: m.toString(
|
|
1939
|
+
message: m.toString(n)
|
|
1940
1940
|
}
|
|
1941
1941
|
]
|
|
1942
1942
|
}));
|
|
@@ -2035,11 +2035,11 @@ class fe extends w {
|
|
|
2035
2035
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
fe.create = (
|
|
2038
|
+
fe.create = (r) => new fe(d({
|
|
2039
2039
|
checks: [],
|
|
2040
|
-
typeName:
|
|
2041
|
-
coerce: (
|
|
2042
|
-
}, b(
|
|
2040
|
+
typeName: v.ZodNumber,
|
|
2041
|
+
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2042
|
+
}, b(r)));
|
|
2043
2043
|
class he extends w {
|
|
2044
2044
|
constructor() {
|
|
2045
2045
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
@@ -2054,7 +2054,7 @@ class he extends w {
|
|
|
2054
2054
|
if (this._getType(e) !== p.bigint)
|
|
2055
2055
|
return this._getInvalidInput(e);
|
|
2056
2056
|
let s;
|
|
2057
|
-
const
|
|
2057
|
+
const n = new Z();
|
|
2058
2058
|
for (const a of this._def.checks)
|
|
2059
2059
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
2060
2060
|
code: l.too_small,
|
|
@@ -2062,18 +2062,18 @@ class he extends w {
|
|
|
2062
2062
|
minimum: a.value,
|
|
2063
2063
|
inclusive: a.inclusive,
|
|
2064
2064
|
message: a.message
|
|
2065
|
-
}),
|
|
2065
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
2066
2066
|
code: l.too_big,
|
|
2067
2067
|
type: "bigint",
|
|
2068
2068
|
maximum: a.value,
|
|
2069
2069
|
inclusive: a.inclusive,
|
|
2070
2070
|
message: a.message
|
|
2071
|
-
}),
|
|
2071
|
+
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
2072
2072
|
code: l.not_multiple_of,
|
|
2073
2073
|
multipleOf: a.value,
|
|
2074
2074
|
message: a.message
|
|
2075
|
-
}),
|
|
2076
|
-
return { status:
|
|
2075
|
+
}), n.dirty()) : x.assertNever(a);
|
|
2076
|
+
return { status: n.value, value: e.data };
|
|
2077
2077
|
}
|
|
2078
2078
|
_getInvalidInput(e) {
|
|
2079
2079
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2081,7 +2081,7 @@ class he extends w {
|
|
|
2081
2081
|
code: l.invalid_type,
|
|
2082
2082
|
expected: p.bigint,
|
|
2083
2083
|
received: t.parsedType
|
|
2084
|
-
}),
|
|
2084
|
+
}), _;
|
|
2085
2085
|
}
|
|
2086
2086
|
gte(e, t) {
|
|
2087
2087
|
return this.setLimit("min", e, !0, m.toString(t));
|
|
@@ -2095,7 +2095,7 @@ class he extends w {
|
|
|
2095
2095
|
lt(e, t) {
|
|
2096
2096
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2097
2097
|
}
|
|
2098
|
-
setLimit(e, t, s,
|
|
2098
|
+
setLimit(e, t, s, n) {
|
|
2099
2099
|
return new he(y(d({}, this._def), {
|
|
2100
2100
|
checks: [
|
|
2101
2101
|
...this._def.checks,
|
|
@@ -2103,7 +2103,7 @@ class he extends w {
|
|
|
2103
2103
|
kind: e,
|
|
2104
2104
|
value: t,
|
|
2105
2105
|
inclusive: s,
|
|
2106
|
-
message: m.toString(
|
|
2106
|
+
message: m.toString(n)
|
|
2107
2107
|
}
|
|
2108
2108
|
]
|
|
2109
2109
|
}));
|
|
@@ -2165,13 +2165,13 @@ class he extends w {
|
|
|
2165
2165
|
return e;
|
|
2166
2166
|
}
|
|
2167
2167
|
}
|
|
2168
|
-
he.create = (
|
|
2168
|
+
he.create = (r) => {
|
|
2169
2169
|
var e;
|
|
2170
2170
|
return new he(d({
|
|
2171
2171
|
checks: [],
|
|
2172
|
-
typeName:
|
|
2173
|
-
coerce: (e =
|
|
2174
|
-
}, b(
|
|
2172
|
+
typeName: v.ZodBigInt,
|
|
2173
|
+
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
2174
|
+
}, b(r)));
|
|
2175
2175
|
};
|
|
2176
2176
|
class $e extends w {
|
|
2177
2177
|
_parse(e) {
|
|
@@ -2181,15 +2181,15 @@ class $e extends w {
|
|
|
2181
2181
|
code: l.invalid_type,
|
|
2182
2182
|
expected: p.boolean,
|
|
2183
2183
|
received: s.parsedType
|
|
2184
|
-
}),
|
|
2184
|
+
}), _;
|
|
2185
2185
|
}
|
|
2186
2186
|
return $(e.data);
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
|
-
$e.create = (
|
|
2190
|
-
typeName:
|
|
2191
|
-
coerce: (
|
|
2192
|
-
}, b(
|
|
2189
|
+
$e.create = (r) => new $e(d({
|
|
2190
|
+
typeName: v.ZodBoolean,
|
|
2191
|
+
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2192
|
+
}, b(r)));
|
|
2193
2193
|
class be extends w {
|
|
2194
2194
|
_parse(e) {
|
|
2195
2195
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
@@ -2198,25 +2198,25 @@ class be extends w {
|
|
|
2198
2198
|
code: l.invalid_type,
|
|
2199
2199
|
expected: p.date,
|
|
2200
2200
|
received: a.parsedType
|
|
2201
|
-
}),
|
|
2201
|
+
}), _;
|
|
2202
2202
|
}
|
|
2203
2203
|
if (isNaN(e.data.getTime())) {
|
|
2204
2204
|
const a = this._getOrReturnCtx(e);
|
|
2205
2205
|
return h(a, {
|
|
2206
2206
|
code: l.invalid_date
|
|
2207
|
-
}),
|
|
2207
|
+
}), _;
|
|
2208
2208
|
}
|
|
2209
2209
|
const s = new Z();
|
|
2210
|
-
let
|
|
2210
|
+
let n;
|
|
2211
2211
|
for (const a of this._def.checks)
|
|
2212
|
-
a.kind === "min" ? e.data.getTime() < a.value && (
|
|
2212
|
+
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
2213
2213
|
code: l.too_small,
|
|
2214
2214
|
message: a.message,
|
|
2215
2215
|
inclusive: !0,
|
|
2216
2216
|
exact: !1,
|
|
2217
2217
|
minimum: a.value,
|
|
2218
2218
|
type: "date"
|
|
2219
|
-
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (
|
|
2219
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
2220
2220
|
code: l.too_big,
|
|
2221
2221
|
message: a.message,
|
|
2222
2222
|
inclusive: !0,
|
|
@@ -2261,12 +2261,12 @@ class be extends w {
|
|
|
2261
2261
|
return e != null ? new Date(e) : null;
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
|
-
be.create = (
|
|
2264
|
+
be.create = (r) => new be(d({
|
|
2265
2265
|
checks: [],
|
|
2266
|
-
coerce: (
|
|
2267
|
-
typeName:
|
|
2268
|
-
}, b(
|
|
2269
|
-
class
|
|
2266
|
+
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
2267
|
+
typeName: v.ZodDate
|
|
2268
|
+
}, b(r)));
|
|
2269
|
+
class nt extends w {
|
|
2270
2270
|
_parse(e) {
|
|
2271
2271
|
if (this._getType(e) !== p.symbol) {
|
|
2272
2272
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2274,14 +2274,14 @@ class rt extends w {
|
|
|
2274
2274
|
code: l.invalid_type,
|
|
2275
2275
|
expected: p.symbol,
|
|
2276
2276
|
received: s.parsedType
|
|
2277
|
-
}),
|
|
2277
|
+
}), _;
|
|
2278
2278
|
}
|
|
2279
2279
|
return $(e.data);
|
|
2280
2280
|
}
|
|
2281
2281
|
}
|
|
2282
|
-
|
|
2283
|
-
typeName:
|
|
2284
|
-
}, b(
|
|
2282
|
+
nt.create = (r) => new nt(d({
|
|
2283
|
+
typeName: v.ZodSymbol
|
|
2284
|
+
}, b(r)));
|
|
2285
2285
|
class Fe extends w {
|
|
2286
2286
|
_parse(e) {
|
|
2287
2287
|
if (this._getType(e) !== p.undefined) {
|
|
@@ -2290,14 +2290,14 @@ class Fe extends w {
|
|
|
2290
2290
|
code: l.invalid_type,
|
|
2291
2291
|
expected: p.undefined,
|
|
2292
2292
|
received: s.parsedType
|
|
2293
|
-
}),
|
|
2293
|
+
}), _;
|
|
2294
2294
|
}
|
|
2295
2295
|
return $(e.data);
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
|
-
Fe.create = (
|
|
2299
|
-
typeName:
|
|
2300
|
-
}, b(
|
|
2298
|
+
Fe.create = (r) => new Fe(d({
|
|
2299
|
+
typeName: v.ZodUndefined
|
|
2300
|
+
}, b(r)));
|
|
2301
2301
|
class Ve extends w {
|
|
2302
2302
|
_parse(e) {
|
|
2303
2303
|
if (this._getType(e) !== p.null) {
|
|
@@ -2306,14 +2306,14 @@ class Ve extends w {
|
|
|
2306
2306
|
code: l.invalid_type,
|
|
2307
2307
|
expected: p.null,
|
|
2308
2308
|
received: s.parsedType
|
|
2309
|
-
}),
|
|
2309
|
+
}), _;
|
|
2310
2310
|
}
|
|
2311
2311
|
return $(e.data);
|
|
2312
2312
|
}
|
|
2313
2313
|
}
|
|
2314
|
-
Ve.create = (
|
|
2315
|
-
typeName:
|
|
2316
|
-
}, b(
|
|
2314
|
+
Ve.create = (r) => new Ve(d({
|
|
2315
|
+
typeName: v.ZodNull
|
|
2316
|
+
}, b(r)));
|
|
2317
2317
|
class Ae extends w {
|
|
2318
2318
|
constructor() {
|
|
2319
2319
|
super(...arguments), this._any = !0;
|
|
@@ -2322,9 +2322,9 @@ class Ae extends w {
|
|
|
2322
2322
|
return $(e.data);
|
|
2323
2323
|
}
|
|
2324
2324
|
}
|
|
2325
|
-
Ae.create = (
|
|
2326
|
-
typeName:
|
|
2327
|
-
}, b(
|
|
2325
|
+
Ae.create = (r) => new Ae(d({
|
|
2326
|
+
typeName: v.ZodAny
|
|
2327
|
+
}, b(r)));
|
|
2328
2328
|
class ve extends w {
|
|
2329
2329
|
constructor() {
|
|
2330
2330
|
super(...arguments), this._unknown = !0;
|
|
@@ -2333,9 +2333,9 @@ class ve extends w {
|
|
|
2333
2333
|
return $(e.data);
|
|
2334
2334
|
}
|
|
2335
2335
|
}
|
|
2336
|
-
ve.create = (
|
|
2337
|
-
typeName:
|
|
2338
|
-
}, b(
|
|
2336
|
+
ve.create = (r) => new ve(d({
|
|
2337
|
+
typeName: v.ZodUnknown
|
|
2338
|
+
}, b(r)));
|
|
2339
2339
|
class ce extends w {
|
|
2340
2340
|
_parse(e) {
|
|
2341
2341
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2343,12 +2343,12 @@ class ce extends w {
|
|
|
2343
2343
|
code: l.invalid_type,
|
|
2344
2344
|
expected: p.never,
|
|
2345
2345
|
received: t.parsedType
|
|
2346
|
-
}),
|
|
2346
|
+
}), _;
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
ce.create = (
|
|
2350
|
-
typeName:
|
|
2351
|
-
}, b(
|
|
2349
|
+
ce.create = (r) => new ce(d({
|
|
2350
|
+
typeName: v.ZodNever
|
|
2351
|
+
}, b(r)));
|
|
2352
2352
|
class at extends w {
|
|
2353
2353
|
_parse(e) {
|
|
2354
2354
|
if (this._getType(e) !== p.undefined) {
|
|
@@ -2357,52 +2357,52 @@ class at extends w {
|
|
|
2357
2357
|
code: l.invalid_type,
|
|
2358
2358
|
expected: p.void,
|
|
2359
2359
|
received: s.parsedType
|
|
2360
|
-
}),
|
|
2360
|
+
}), _;
|
|
2361
2361
|
}
|
|
2362
2362
|
return $(e.data);
|
|
2363
2363
|
}
|
|
2364
2364
|
}
|
|
2365
|
-
at.create = (
|
|
2366
|
-
typeName:
|
|
2367
|
-
}, b(
|
|
2365
|
+
at.create = (r) => new at(d({
|
|
2366
|
+
typeName: v.ZodVoid
|
|
2367
|
+
}, b(r)));
|
|
2368
2368
|
class G extends w {
|
|
2369
2369
|
_parse(e) {
|
|
2370
|
-
const { ctx: t, status: s } = this._processInputParams(e),
|
|
2370
|
+
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
2371
2371
|
if (t.parsedType !== p.array)
|
|
2372
2372
|
return h(t, {
|
|
2373
2373
|
code: l.invalid_type,
|
|
2374
2374
|
expected: p.array,
|
|
2375
2375
|
received: t.parsedType
|
|
2376
|
-
}),
|
|
2377
|
-
if (
|
|
2378
|
-
const i = t.data.length >
|
|
2376
|
+
}), _;
|
|
2377
|
+
if (n.exactLength !== null) {
|
|
2378
|
+
const i = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
|
|
2379
2379
|
(i || o) && (h(t, {
|
|
2380
2380
|
code: i ? l.too_big : l.too_small,
|
|
2381
|
-
minimum: o ?
|
|
2382
|
-
maximum: i ?
|
|
2381
|
+
minimum: o ? n.exactLength.value : void 0,
|
|
2382
|
+
maximum: i ? n.exactLength.value : void 0,
|
|
2383
2383
|
type: "array",
|
|
2384
2384
|
inclusive: !0,
|
|
2385
2385
|
exact: !0,
|
|
2386
|
-
message:
|
|
2386
|
+
message: n.exactLength.message
|
|
2387
2387
|
}), s.dirty());
|
|
2388
2388
|
}
|
|
2389
|
-
if (
|
|
2389
|
+
if (n.minLength !== null && t.data.length < n.minLength.value && (h(t, {
|
|
2390
2390
|
code: l.too_small,
|
|
2391
|
-
minimum:
|
|
2391
|
+
minimum: n.minLength.value,
|
|
2392
2392
|
type: "array",
|
|
2393
2393
|
inclusive: !0,
|
|
2394
2394
|
exact: !1,
|
|
2395
|
-
message:
|
|
2396
|
-
}), s.dirty()),
|
|
2395
|
+
message: n.minLength.message
|
|
2396
|
+
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (h(t, {
|
|
2397
2397
|
code: l.too_big,
|
|
2398
|
-
maximum:
|
|
2398
|
+
maximum: n.maxLength.value,
|
|
2399
2399
|
type: "array",
|
|
2400
2400
|
inclusive: !0,
|
|
2401
2401
|
exact: !1,
|
|
2402
|
-
message:
|
|
2402
|
+
message: n.maxLength.message
|
|
2403
2403
|
}), s.dirty()), t.common.async)
|
|
2404
|
-
return Promise.all([...t.data].map((i, o) =>
|
|
2405
|
-
const a = [...t.data].map((i, o) =>
|
|
2404
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new re(t, i, t.path, o)))).then((i) => Z.mergeArray(s, i));
|
|
2405
|
+
const a = [...t.data].map((i, o) => n.type._parseSync(new re(t, i, t.path, o)));
|
|
2406
2406
|
return Z.mergeArray(s, a);
|
|
2407
2407
|
}
|
|
2408
2408
|
get element() {
|
|
@@ -2427,26 +2427,26 @@ class G extends w {
|
|
|
2427
2427
|
return this.min(1, e);
|
|
2428
2428
|
}
|
|
2429
2429
|
}
|
|
2430
|
-
G.create = (
|
|
2431
|
-
type:
|
|
2430
|
+
G.create = (r, e) => new G(d({
|
|
2431
|
+
type: r,
|
|
2432
2432
|
minLength: null,
|
|
2433
2433
|
maxLength: null,
|
|
2434
2434
|
exactLength: null,
|
|
2435
|
-
typeName:
|
|
2435
|
+
typeName: v.ZodArray
|
|
2436
2436
|
}, b(e)));
|
|
2437
|
-
function xe(
|
|
2438
|
-
if (
|
|
2437
|
+
function xe(r) {
|
|
2438
|
+
if (r instanceof S) {
|
|
2439
2439
|
const e = {};
|
|
2440
|
-
for (const t in
|
|
2441
|
-
const s =
|
|
2440
|
+
for (const t in r.shape) {
|
|
2441
|
+
const s = r.shape[t];
|
|
2442
2442
|
e[t] = te.create(xe(s));
|
|
2443
2443
|
}
|
|
2444
|
-
return new S(y(d({},
|
|
2444
|
+
return new S(y(d({}, r._def), {
|
|
2445
2445
|
shape: () => e
|
|
2446
2446
|
}));
|
|
2447
|
-
} else return
|
|
2448
|
-
type: xe(
|
|
2449
|
-
})) :
|
|
2447
|
+
} else return r instanceof G ? new G(y(d({}, r._def), {
|
|
2448
|
+
type: xe(r.element)
|
|
2449
|
+
})) : r instanceof te ? te.create(xe(r.unwrap())) : r instanceof me ? me.create(xe(r.unwrap())) : r instanceof se ? se.create(r.items.map((e) => xe(e))) : r;
|
|
2450
2450
|
}
|
|
2451
2451
|
class S extends w {
|
|
2452
2452
|
constructor() {
|
|
@@ -2465,19 +2465,19 @@ class S extends w {
|
|
|
2465
2465
|
code: l.invalid_type,
|
|
2466
2466
|
expected: p.object,
|
|
2467
2467
|
received: u.parsedType
|
|
2468
|
-
}),
|
|
2468
|
+
}), _;
|
|
2469
2469
|
}
|
|
2470
|
-
const { status: s, ctx:
|
|
2470
|
+
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2471
2471
|
if (!(this._def.catchall instanceof ce && this._def.unknownKeys === "strip"))
|
|
2472
|
-
for (const u in
|
|
2472
|
+
for (const u in n.data)
|
|
2473
2473
|
i.includes(u) || o.push(u);
|
|
2474
2474
|
const c = [];
|
|
2475
2475
|
for (const u of i) {
|
|
2476
|
-
const f = a[u],
|
|
2476
|
+
const f = a[u], g = n.data[u];
|
|
2477
2477
|
c.push({
|
|
2478
2478
|
key: { status: "valid", value: u },
|
|
2479
|
-
value: f._parse(new
|
|
2480
|
-
alwaysSet: u in
|
|
2479
|
+
value: f._parse(new re(n, g, n.path, u)),
|
|
2480
|
+
alwaysSet: u in n.data
|
|
2481
2481
|
});
|
|
2482
2482
|
}
|
|
2483
2483
|
if (this._def.catchall instanceof ce) {
|
|
@@ -2486,10 +2486,10 @@ class S extends w {
|
|
|
2486
2486
|
for (const f of o)
|
|
2487
2487
|
c.push({
|
|
2488
2488
|
key: { status: "valid", value: f },
|
|
2489
|
-
value: { status: "valid", value:
|
|
2489
|
+
value: { status: "valid", value: n.data[f] }
|
|
2490
2490
|
});
|
|
2491
2491
|
else if (u === "strict")
|
|
2492
|
-
o.length > 0 && (h(
|
|
2492
|
+
o.length > 0 && (h(n, {
|
|
2493
2493
|
code: l.unrecognized_keys,
|
|
2494
2494
|
keys: o
|
|
2495
2495
|
}), s.dirty());
|
|
@@ -2497,24 +2497,24 @@ class S extends w {
|
|
|
2497
2497
|
} else {
|
|
2498
2498
|
const u = this._def.catchall;
|
|
2499
2499
|
for (const f of o) {
|
|
2500
|
-
const
|
|
2500
|
+
const g = n.data[f];
|
|
2501
2501
|
c.push({
|
|
2502
2502
|
key: { status: "valid", value: f },
|
|
2503
2503
|
value: u._parse(
|
|
2504
|
-
new
|
|
2504
|
+
new re(n, g, n.path, f)
|
|
2505
2505
|
//, ctx.child(key), value, getParsedType(value)
|
|
2506
2506
|
),
|
|
2507
|
-
alwaysSet: f in
|
|
2507
|
+
alwaysSet: f in n.data
|
|
2508
2508
|
});
|
|
2509
2509
|
}
|
|
2510
2510
|
}
|
|
2511
|
-
return
|
|
2511
|
+
return n.common.async ? Promise.resolve().then(() => M(this, null, function* () {
|
|
2512
2512
|
const u = [];
|
|
2513
2513
|
for (const f of c) {
|
|
2514
|
-
const
|
|
2514
|
+
const g = yield f.key, O = yield f.value;
|
|
2515
2515
|
u.push({
|
|
2516
|
-
key:
|
|
2517
|
-
value:
|
|
2516
|
+
key: g,
|
|
2517
|
+
value: O,
|
|
2518
2518
|
alwaysSet: f.alwaysSet
|
|
2519
2519
|
});
|
|
2520
2520
|
}
|
|
@@ -2529,8 +2529,8 @@ class S extends w {
|
|
|
2529
2529
|
unknownKeys: "strict"
|
|
2530
2530
|
}), e !== void 0 ? {
|
|
2531
2531
|
errorMap: (t, s) => {
|
|
2532
|
-
var
|
|
2533
|
-
const c = (i = (a = (
|
|
2532
|
+
var n, a, i, o;
|
|
2533
|
+
const c = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
|
|
2534
2534
|
return t.code === "unrecognized_keys" ? {
|
|
2535
2535
|
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : c
|
|
2536
2536
|
} : {
|
|
@@ -2581,7 +2581,7 @@ class S extends w {
|
|
|
2581
2581
|
unknownKeys: e._def.unknownKeys,
|
|
2582
2582
|
catchall: e._def.catchall,
|
|
2583
2583
|
shape: () => d(d({}, this._def.shape()), e._def.shape()),
|
|
2584
|
-
typeName:
|
|
2584
|
+
typeName: v.ZodObject
|
|
2585
2585
|
});
|
|
2586
2586
|
}
|
|
2587
2587
|
// merge<
|
|
@@ -2673,8 +2673,8 @@ class S extends w {
|
|
|
2673
2673
|
partial(e) {
|
|
2674
2674
|
const t = {};
|
|
2675
2675
|
return x.objectKeys(this.shape).forEach((s) => {
|
|
2676
|
-
const
|
|
2677
|
-
e && !e[s] ? t[s] =
|
|
2676
|
+
const n = this.shape[s];
|
|
2677
|
+
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
2678
2678
|
}), new S(y(d({}, this._def), {
|
|
2679
2679
|
shape: () => t
|
|
2680
2680
|
}));
|
|
@@ -2695,31 +2695,31 @@ class S extends w {
|
|
|
2695
2695
|
}));
|
|
2696
2696
|
}
|
|
2697
2697
|
keyof() {
|
|
2698
|
-
return
|
|
2698
|
+
return fr(x.objectKeys(this.shape));
|
|
2699
2699
|
}
|
|
2700
2700
|
}
|
|
2701
|
-
S.create = (
|
|
2702
|
-
shape: () =>
|
|
2701
|
+
S.create = (r, e) => new S(d({
|
|
2702
|
+
shape: () => r,
|
|
2703
2703
|
unknownKeys: "strip",
|
|
2704
2704
|
catchall: ce.create(),
|
|
2705
|
-
typeName:
|
|
2705
|
+
typeName: v.ZodObject
|
|
2706
2706
|
}, b(e)));
|
|
2707
|
-
S.strictCreate = (
|
|
2708
|
-
shape: () =>
|
|
2707
|
+
S.strictCreate = (r, e) => new S(d({
|
|
2708
|
+
shape: () => r,
|
|
2709
2709
|
unknownKeys: "strict",
|
|
2710
2710
|
catchall: ce.create(),
|
|
2711
|
-
typeName:
|
|
2711
|
+
typeName: v.ZodObject
|
|
2712
2712
|
}, b(e)));
|
|
2713
|
-
S.lazycreate = (
|
|
2714
|
-
shape:
|
|
2713
|
+
S.lazycreate = (r, e) => new S(d({
|
|
2714
|
+
shape: r,
|
|
2715
2715
|
unknownKeys: "strip",
|
|
2716
2716
|
catchall: ce.create(),
|
|
2717
|
-
typeName:
|
|
2717
|
+
typeName: v.ZodObject
|
|
2718
2718
|
}, b(e)));
|
|
2719
2719
|
class De extends w {
|
|
2720
2720
|
_parse(e) {
|
|
2721
2721
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2722
|
-
function
|
|
2722
|
+
function n(a) {
|
|
2723
2723
|
for (const o of a)
|
|
2724
2724
|
if (o.result.status === "valid")
|
|
2725
2725
|
return o.result;
|
|
@@ -2730,7 +2730,7 @@ class De extends w {
|
|
|
2730
2730
|
return h(t, {
|
|
2731
2731
|
code: l.invalid_union,
|
|
2732
2732
|
unionErrors: i
|
|
2733
|
-
}),
|
|
2733
|
+
}), _;
|
|
2734
2734
|
}
|
|
2735
2735
|
if (t.common.async)
|
|
2736
2736
|
return Promise.all(s.map((a) => M(this, null, function* () {
|
|
@@ -2748,7 +2748,7 @@ class De extends w {
|
|
|
2748
2748
|
}),
|
|
2749
2749
|
ctx: i
|
|
2750
2750
|
};
|
|
2751
|
-
}))).then(
|
|
2751
|
+
}))).then(n);
|
|
2752
2752
|
{
|
|
2753
2753
|
let a;
|
|
2754
2754
|
const i = [];
|
|
@@ -2773,18 +2773,18 @@ class De extends w {
|
|
|
2773
2773
|
return h(t, {
|
|
2774
2774
|
code: l.invalid_union,
|
|
2775
2775
|
unionErrors: o
|
|
2776
|
-
}),
|
|
2776
|
+
}), _;
|
|
2777
2777
|
}
|
|
2778
2778
|
}
|
|
2779
2779
|
get options() {
|
|
2780
2780
|
return this._def.options;
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
2783
|
-
De.create = (
|
|
2784
|
-
options:
|
|
2785
|
-
typeName:
|
|
2783
|
+
De.create = (r, e) => new De(d({
|
|
2784
|
+
options: r,
|
|
2785
|
+
typeName: v.ZodUnion
|
|
2786
2786
|
}, b(e)));
|
|
2787
|
-
const ie = (
|
|
2787
|
+
const ie = (r) => r instanceof ze ? ie(r.schema) : r instanceof K ? ie(r.innerType()) : r instanceof We ? [r.value] : r instanceof pe ? r.options : r instanceof Be ? x.objectValues(r.enum) : r instanceof qe ? ie(r._def.innerType) : r instanceof Fe ? [void 0] : r instanceof Ve ? [null] : r instanceof te ? [void 0, ...ie(r.unwrap())] : r instanceof me ? [null, ...ie(r.unwrap())] : r instanceof Zt || r instanceof Je ? ie(r.unwrap()) : r instanceof He ? ie(r._def.innerType) : [];
|
|
2788
2788
|
class dt extends w {
|
|
2789
2789
|
_parse(e) {
|
|
2790
2790
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2793,8 +2793,8 @@ class dt extends w {
|
|
|
2793
2793
|
code: l.invalid_type,
|
|
2794
2794
|
expected: p.object,
|
|
2795
2795
|
received: t.parsedType
|
|
2796
|
-
}),
|
|
2797
|
-
const s = this.discriminator,
|
|
2796
|
+
}), _;
|
|
2797
|
+
const s = this.discriminator, n = t.data[s], a = this.optionsMap.get(n);
|
|
2798
2798
|
return a ? t.common.async ? a._parseAsync({
|
|
2799
2799
|
data: t.data,
|
|
2800
2800
|
path: t.path,
|
|
@@ -2807,7 +2807,7 @@ class dt extends w {
|
|
|
2807
2807
|
code: l.invalid_union_discriminator,
|
|
2808
2808
|
options: Array.from(this.optionsMap.keys()),
|
|
2809
2809
|
path: [s]
|
|
2810
|
-
}),
|
|
2810
|
+
}), _);
|
|
2811
2811
|
}
|
|
2812
2812
|
get discriminator() {
|
|
2813
2813
|
return this._def.discriminator;
|
|
@@ -2827,60 +2827,60 @@ class dt extends w {
|
|
|
2827
2827
|
* @param params
|
|
2828
2828
|
*/
|
|
2829
2829
|
static create(e, t, s) {
|
|
2830
|
-
const
|
|
2830
|
+
const n = /* @__PURE__ */ new Map();
|
|
2831
2831
|
for (const a of t) {
|
|
2832
2832
|
const i = ie(a.shape[e]);
|
|
2833
2833
|
if (!i.length)
|
|
2834
2834
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2835
2835
|
for (const o of i) {
|
|
2836
|
-
if (
|
|
2836
|
+
if (n.has(o))
|
|
2837
2837
|
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
2838
|
-
|
|
2838
|
+
n.set(o, a);
|
|
2839
2839
|
}
|
|
2840
2840
|
}
|
|
2841
2841
|
return new dt(d({
|
|
2842
|
-
typeName:
|
|
2842
|
+
typeName: v.ZodDiscriminatedUnion,
|
|
2843
2843
|
discriminator: e,
|
|
2844
2844
|
options: t,
|
|
2845
|
-
optionsMap:
|
|
2845
|
+
optionsMap: n
|
|
2846
2846
|
}, b(s)));
|
|
2847
2847
|
}
|
|
2848
2848
|
}
|
|
2849
|
-
function Ct(
|
|
2850
|
-
const t = oe(
|
|
2851
|
-
if (
|
|
2852
|
-
return { valid: !0, data:
|
|
2849
|
+
function Ct(r, e) {
|
|
2850
|
+
const t = oe(r), s = oe(e);
|
|
2851
|
+
if (r === e)
|
|
2852
|
+
return { valid: !0, data: r };
|
|
2853
2853
|
if (t === p.object && s === p.object) {
|
|
2854
|
-
const
|
|
2854
|
+
const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = d(d({}, r), e);
|
|
2855
2855
|
for (const o of a) {
|
|
2856
|
-
const c = Ct(
|
|
2856
|
+
const c = Ct(r[o], e[o]);
|
|
2857
2857
|
if (!c.valid)
|
|
2858
2858
|
return { valid: !1 };
|
|
2859
2859
|
i[o] = c.data;
|
|
2860
2860
|
}
|
|
2861
2861
|
return { valid: !0, data: i };
|
|
2862
2862
|
} else if (t === p.array && s === p.array) {
|
|
2863
|
-
if (
|
|
2863
|
+
if (r.length !== e.length)
|
|
2864
2864
|
return { valid: !1 };
|
|
2865
|
-
const
|
|
2866
|
-
for (let a = 0; a <
|
|
2867
|
-
const i =
|
|
2865
|
+
const n = [];
|
|
2866
|
+
for (let a = 0; a < r.length; a++) {
|
|
2867
|
+
const i = r[a], o = e[a], c = Ct(i, o);
|
|
2868
2868
|
if (!c.valid)
|
|
2869
2869
|
return { valid: !1 };
|
|
2870
|
-
|
|
2870
|
+
n.push(c.data);
|
|
2871
2871
|
}
|
|
2872
|
-
return { valid: !0, data:
|
|
2873
|
-
} else return t === p.date && s === p.date && +
|
|
2872
|
+
return { valid: !0, data: n };
|
|
2873
|
+
} else return t === p.date && s === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2874
2874
|
}
|
|
2875
2875
|
class Le extends w {
|
|
2876
2876
|
_parse(e) {
|
|
2877
|
-
const { status: t, ctx: s } = this._processInputParams(e),
|
|
2877
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
2878
2878
|
if (At(a) || At(i))
|
|
2879
|
-
return
|
|
2879
|
+
return _;
|
|
2880
2880
|
const o = Ct(a.value, i.value);
|
|
2881
2881
|
return o.valid ? ((Ot(a) || Ot(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2882
2882
|
code: l.invalid_intersection_types
|
|
2883
|
-
}),
|
|
2883
|
+
}), _);
|
|
2884
2884
|
};
|
|
2885
2885
|
return s.common.async ? Promise.all([
|
|
2886
2886
|
this._def.left._parseAsync({
|
|
@@ -2893,7 +2893,7 @@ class Le extends w {
|
|
|
2893
2893
|
path: s.path,
|
|
2894
2894
|
parent: s
|
|
2895
2895
|
})
|
|
2896
|
-
]).then(([a, i]) =>
|
|
2896
|
+
]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
|
|
2897
2897
|
data: s.data,
|
|
2898
2898
|
path: s.path,
|
|
2899
2899
|
parent: s
|
|
@@ -2904,10 +2904,10 @@ class Le extends w {
|
|
|
2904
2904
|
}));
|
|
2905
2905
|
}
|
|
2906
2906
|
}
|
|
2907
|
-
Le.create = (
|
|
2908
|
-
left:
|
|
2907
|
+
Le.create = (r, e, t) => new Le(d({
|
|
2908
|
+
left: r,
|
|
2909
2909
|
right: e,
|
|
2910
|
-
typeName:
|
|
2910
|
+
typeName: v.ZodIntersection
|
|
2911
2911
|
}, b(t)));
|
|
2912
2912
|
class se extends w {
|
|
2913
2913
|
_parse(e) {
|
|
@@ -2917,7 +2917,7 @@ class se extends w {
|
|
|
2917
2917
|
code: l.invalid_type,
|
|
2918
2918
|
expected: p.array,
|
|
2919
2919
|
received: s.parsedType
|
|
2920
|
-
}),
|
|
2920
|
+
}), _;
|
|
2921
2921
|
if (s.data.length < this._def.items.length)
|
|
2922
2922
|
return h(s, {
|
|
2923
2923
|
code: l.too_small,
|
|
@@ -2925,7 +2925,7 @@ class se extends w {
|
|
|
2925
2925
|
inclusive: !0,
|
|
2926
2926
|
exact: !1,
|
|
2927
2927
|
type: "array"
|
|
2928
|
-
}),
|
|
2928
|
+
}), _;
|
|
2929
2929
|
!this._def.rest && s.data.length > this._def.items.length && (h(s, {
|
|
2930
2930
|
code: l.too_big,
|
|
2931
2931
|
maximum: this._def.items.length,
|
|
@@ -2935,7 +2935,7 @@ class se extends w {
|
|
|
2935
2935
|
}), t.dirty());
|
|
2936
2936
|
const a = [...s.data].map((i, o) => {
|
|
2937
2937
|
const c = this._def.items[o] || this._def.rest;
|
|
2938
|
-
return c ? c._parse(new
|
|
2938
|
+
return c ? c._parse(new re(s, i, s.path, o)) : null;
|
|
2939
2939
|
}).filter((i) => !!i);
|
|
2940
2940
|
return s.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
|
|
2941
2941
|
}
|
|
@@ -2948,12 +2948,12 @@ class se extends w {
|
|
|
2948
2948
|
}));
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
|
-
se.create = (
|
|
2952
|
-
if (!Array.isArray(
|
|
2951
|
+
se.create = (r, e) => {
|
|
2952
|
+
if (!Array.isArray(r))
|
|
2953
2953
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2954
2954
|
return new se(d({
|
|
2955
|
-
items:
|
|
2956
|
-
typeName:
|
|
2955
|
+
items: r,
|
|
2956
|
+
typeName: v.ZodTuple,
|
|
2957
2957
|
rest: null
|
|
2958
2958
|
}, b(e)));
|
|
2959
2959
|
};
|
|
@@ -2971,15 +2971,15 @@ class Ue extends w {
|
|
|
2971
2971
|
code: l.invalid_type,
|
|
2972
2972
|
expected: p.object,
|
|
2973
2973
|
received: s.parsedType
|
|
2974
|
-
}),
|
|
2975
|
-
const
|
|
2974
|
+
}), _;
|
|
2975
|
+
const n = [], a = this._def.keyType, i = this._def.valueType;
|
|
2976
2976
|
for (const o in s.data)
|
|
2977
|
-
|
|
2978
|
-
key: a._parse(new
|
|
2979
|
-
value: i._parse(new
|
|
2977
|
+
n.push({
|
|
2978
|
+
key: a._parse(new re(s, o, s.path, o)),
|
|
2979
|
+
value: i._parse(new re(s, s.data[o], s.path, o)),
|
|
2980
2980
|
alwaysSet: o in s.data
|
|
2981
2981
|
});
|
|
2982
|
-
return s.common.async ? Z.mergeObjectAsync(t,
|
|
2982
|
+
return s.common.async ? Z.mergeObjectAsync(t, n) : Z.mergeObjectSync(t, n);
|
|
2983
2983
|
}
|
|
2984
2984
|
get element() {
|
|
2985
2985
|
return this._def.valueType;
|
|
@@ -2988,11 +2988,11 @@ class Ue extends w {
|
|
|
2988
2988
|
return t instanceof w ? new Ue(d({
|
|
2989
2989
|
keyType: e,
|
|
2990
2990
|
valueType: t,
|
|
2991
|
-
typeName:
|
|
2991
|
+
typeName: v.ZodRecord
|
|
2992
2992
|
}, b(s))) : new Ue(d({
|
|
2993
2993
|
keyType: J.create(),
|
|
2994
2994
|
valueType: e,
|
|
2995
|
-
typeName:
|
|
2995
|
+
typeName: v.ZodRecord
|
|
2996
2996
|
}, b(t)));
|
|
2997
2997
|
}
|
|
2998
2998
|
}
|
|
@@ -3010,10 +3010,10 @@ class it extends w {
|
|
|
3010
3010
|
code: l.invalid_type,
|
|
3011
3011
|
expected: p.map,
|
|
3012
3012
|
received: s.parsedType
|
|
3013
|
-
}),
|
|
3014
|
-
const
|
|
3015
|
-
key:
|
|
3016
|
-
value: a._parse(new
|
|
3013
|
+
}), _;
|
|
3014
|
+
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
|
|
3015
|
+
key: n._parse(new re(s, o, s.path, [u, "key"])),
|
|
3016
|
+
value: a._parse(new re(s, c, s.path, [u, "value"]))
|
|
3017
3017
|
}));
|
|
3018
3018
|
if (s.common.async) {
|
|
3019
3019
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -3021,7 +3021,7 @@ class it extends w {
|
|
|
3021
3021
|
for (const c of i) {
|
|
3022
3022
|
const u = yield c.key, f = yield c.value;
|
|
3023
3023
|
if (u.status === "aborted" || f.status === "aborted")
|
|
3024
|
-
return
|
|
3024
|
+
return _;
|
|
3025
3025
|
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
3026
3026
|
}
|
|
3027
3027
|
return { status: t.value, value: o };
|
|
@@ -3031,17 +3031,17 @@ class it extends w {
|
|
|
3031
3031
|
for (const c of i) {
|
|
3032
3032
|
const u = c.key, f = c.value;
|
|
3033
3033
|
if (u.status === "aborted" || f.status === "aborted")
|
|
3034
|
-
return
|
|
3034
|
+
return _;
|
|
3035
3035
|
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
3036
3036
|
}
|
|
3037
3037
|
return { status: t.value, value: o };
|
|
3038
3038
|
}
|
|
3039
3039
|
}
|
|
3040
3040
|
}
|
|
3041
|
-
it.create = (
|
|
3041
|
+
it.create = (r, e, t) => new it(d({
|
|
3042
3042
|
valueType: e,
|
|
3043
|
-
keyType:
|
|
3044
|
-
typeName:
|
|
3043
|
+
keyType: r,
|
|
3044
|
+
typeName: v.ZodMap
|
|
3045
3045
|
}, b(t)));
|
|
3046
3046
|
class we extends w {
|
|
3047
3047
|
_parse(e) {
|
|
@@ -3051,34 +3051,34 @@ class we extends w {
|
|
|
3051
3051
|
code: l.invalid_type,
|
|
3052
3052
|
expected: p.set,
|
|
3053
3053
|
received: s.parsedType
|
|
3054
|
-
}),
|
|
3055
|
-
const
|
|
3056
|
-
|
|
3054
|
+
}), _;
|
|
3055
|
+
const n = this._def;
|
|
3056
|
+
n.minSize !== null && s.data.size < n.minSize.value && (h(s, {
|
|
3057
3057
|
code: l.too_small,
|
|
3058
|
-
minimum:
|
|
3058
|
+
minimum: n.minSize.value,
|
|
3059
3059
|
type: "set",
|
|
3060
3060
|
inclusive: !0,
|
|
3061
3061
|
exact: !1,
|
|
3062
|
-
message:
|
|
3063
|
-
}), t.dirty()),
|
|
3062
|
+
message: n.minSize.message
|
|
3063
|
+
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (h(s, {
|
|
3064
3064
|
code: l.too_big,
|
|
3065
|
-
maximum:
|
|
3065
|
+
maximum: n.maxSize.value,
|
|
3066
3066
|
type: "set",
|
|
3067
3067
|
inclusive: !0,
|
|
3068
3068
|
exact: !1,
|
|
3069
|
-
message:
|
|
3069
|
+
message: n.maxSize.message
|
|
3070
3070
|
}), t.dirty());
|
|
3071
3071
|
const a = this._def.valueType;
|
|
3072
3072
|
function i(c) {
|
|
3073
3073
|
const u = /* @__PURE__ */ new Set();
|
|
3074
3074
|
for (const f of c) {
|
|
3075
3075
|
if (f.status === "aborted")
|
|
3076
|
-
return
|
|
3076
|
+
return _;
|
|
3077
3077
|
f.status === "dirty" && t.dirty(), u.add(f.value);
|
|
3078
3078
|
}
|
|
3079
3079
|
return { status: t.value, value: u };
|
|
3080
3080
|
}
|
|
3081
|
-
const o = [...s.data.values()].map((c, u) => a._parse(new
|
|
3081
|
+
const o = [...s.data.values()].map((c, u) => a._parse(new re(s, c, s.path, u)));
|
|
3082
3082
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3083
3083
|
}
|
|
3084
3084
|
min(e, t) {
|
|
@@ -3098,11 +3098,11 @@ class we extends w {
|
|
|
3098
3098
|
return this.min(1, e);
|
|
3099
3099
|
}
|
|
3100
3100
|
}
|
|
3101
|
-
we.create = (
|
|
3102
|
-
valueType:
|
|
3101
|
+
we.create = (r, e) => new we(d({
|
|
3102
|
+
valueType: r,
|
|
3103
3103
|
minSize: null,
|
|
3104
3104
|
maxSize: null,
|
|
3105
|
-
typeName:
|
|
3105
|
+
typeName: v.ZodSet
|
|
3106
3106
|
}, b(e)));
|
|
3107
3107
|
class Te extends w {
|
|
3108
3108
|
constructor() {
|
|
@@ -3115,9 +3115,9 @@ class Te extends w {
|
|
|
3115
3115
|
code: l.invalid_type,
|
|
3116
3116
|
expected: p.function,
|
|
3117
3117
|
received: t.parsedType
|
|
3118
|
-
}),
|
|
3118
|
+
}), _;
|
|
3119
3119
|
function s(o, c) {
|
|
3120
|
-
return
|
|
3120
|
+
return rt({
|
|
3121
3121
|
data: o,
|
|
3122
3122
|
path: t.path,
|
|
3123
3123
|
errorMaps: [
|
|
@@ -3132,8 +3132,8 @@ class Te extends w {
|
|
|
3132
3132
|
}
|
|
3133
3133
|
});
|
|
3134
3134
|
}
|
|
3135
|
-
function
|
|
3136
|
-
return
|
|
3135
|
+
function n(o, c) {
|
|
3136
|
+
return rt({
|
|
3137
3137
|
data: o,
|
|
3138
3138
|
path: t.path,
|
|
3139
3139
|
errorMaps: [
|
|
@@ -3153,11 +3153,11 @@ class Te extends w {
|
|
|
3153
3153
|
const o = this;
|
|
3154
3154
|
return $(function(...c) {
|
|
3155
3155
|
return M(this, null, function* () {
|
|
3156
|
-
const u = new z([]), f = yield o._def.args.parseAsync(c, a).catch((
|
|
3157
|
-
throw u.addIssue(s(c,
|
|
3158
|
-
}),
|
|
3159
|
-
return yield o._def.returns._def.type.parseAsync(
|
|
3160
|
-
throw u.addIssue(
|
|
3156
|
+
const u = new z([]), f = yield o._def.args.parseAsync(c, a).catch((C) => {
|
|
3157
|
+
throw u.addIssue(s(c, C)), u;
|
|
3158
|
+
}), g = yield Reflect.apply(i, this, f);
|
|
3159
|
+
return yield o._def.returns._def.type.parseAsync(g, a).catch((C) => {
|
|
3160
|
+
throw u.addIssue(n(g, C)), u;
|
|
3161
3161
|
});
|
|
3162
3162
|
});
|
|
3163
3163
|
});
|
|
@@ -3167,10 +3167,10 @@ class Te extends w {
|
|
|
3167
3167
|
const u = o._def.args.safeParse(c, a);
|
|
3168
3168
|
if (!u.success)
|
|
3169
3169
|
throw new z([s(c, u.error)]);
|
|
3170
|
-
const f = Reflect.apply(i, this, u.data),
|
|
3171
|
-
if (!
|
|
3172
|
-
throw new z([
|
|
3173
|
-
return
|
|
3170
|
+
const f = Reflect.apply(i, this, u.data), g = o._def.returns.safeParse(f, a);
|
|
3171
|
+
if (!g.success)
|
|
3172
|
+
throw new z([n(f, g.error)]);
|
|
3173
|
+
return g.data;
|
|
3174
3174
|
});
|
|
3175
3175
|
}
|
|
3176
3176
|
}
|
|
@@ -3200,7 +3200,7 @@ class Te extends w {
|
|
|
3200
3200
|
return new Te(d({
|
|
3201
3201
|
args: e || se.create([]).rest(ve.create()),
|
|
3202
3202
|
returns: t || ve.create(),
|
|
3203
|
-
typeName:
|
|
3203
|
+
typeName: v.ZodFunction
|
|
3204
3204
|
}, b(s)));
|
|
3205
3205
|
}
|
|
3206
3206
|
}
|
|
@@ -3213,9 +3213,9 @@ class ze extends w {
|
|
|
3213
3213
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3214
3214
|
}
|
|
3215
3215
|
}
|
|
3216
|
-
ze.create = (
|
|
3217
|
-
getter:
|
|
3218
|
-
typeName:
|
|
3216
|
+
ze.create = (r, e) => new ze(d({
|
|
3217
|
+
getter: r,
|
|
3218
|
+
typeName: v.ZodLazy
|
|
3219
3219
|
}, b(e)));
|
|
3220
3220
|
class We extends w {
|
|
3221
3221
|
_parse(e) {
|
|
@@ -3225,7 +3225,7 @@ class We extends w {
|
|
|
3225
3225
|
received: t.data,
|
|
3226
3226
|
code: l.invalid_literal,
|
|
3227
3227
|
expected: this._def.value
|
|
3228
|
-
}),
|
|
3228
|
+
}), _;
|
|
3229
3229
|
}
|
|
3230
3230
|
return { status: "valid", value: e.data };
|
|
3231
3231
|
}
|
|
@@ -3233,14 +3233,14 @@ class We extends w {
|
|
|
3233
3233
|
return this._def.value;
|
|
3234
3234
|
}
|
|
3235
3235
|
}
|
|
3236
|
-
We.create = (
|
|
3237
|
-
value:
|
|
3238
|
-
typeName:
|
|
3236
|
+
We.create = (r, e) => new We(d({
|
|
3237
|
+
value: r,
|
|
3238
|
+
typeName: v.ZodLiteral
|
|
3239
3239
|
}, b(e)));
|
|
3240
|
-
function
|
|
3240
|
+
function fr(r, e) {
|
|
3241
3241
|
return new pe(d({
|
|
3242
|
-
values:
|
|
3243
|
-
typeName:
|
|
3242
|
+
values: r,
|
|
3243
|
+
typeName: v.ZodEnum
|
|
3244
3244
|
}, b(e)));
|
|
3245
3245
|
}
|
|
3246
3246
|
class pe extends w {
|
|
@@ -3254,15 +3254,15 @@ class pe extends w {
|
|
|
3254
3254
|
expected: x.joinValues(s),
|
|
3255
3255
|
received: t.parsedType,
|
|
3256
3256
|
code: l.invalid_type
|
|
3257
|
-
}),
|
|
3257
|
+
}), _;
|
|
3258
3258
|
}
|
|
3259
|
-
if (st(this, Re) ||
|
|
3259
|
+
if (st(this, Re) || cr(this, Re, new Set(this._def.values)), !st(this, Re).has(e.data)) {
|
|
3260
3260
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3261
3261
|
return h(t, {
|
|
3262
3262
|
received: t.data,
|
|
3263
3263
|
code: l.invalid_enum_value,
|
|
3264
3264
|
options: s
|
|
3265
|
-
}),
|
|
3265
|
+
}), _;
|
|
3266
3266
|
}
|
|
3267
3267
|
return $(e.data);
|
|
3268
3268
|
}
|
|
@@ -3295,7 +3295,7 @@ class pe extends w {
|
|
|
3295
3295
|
}
|
|
3296
3296
|
}
|
|
3297
3297
|
Re = /* @__PURE__ */ new WeakMap();
|
|
3298
|
-
pe.create =
|
|
3298
|
+
pe.create = fr;
|
|
3299
3299
|
class Be extends w {
|
|
3300
3300
|
constructor() {
|
|
3301
3301
|
super(...arguments), Me.set(this, void 0);
|
|
@@ -3303,20 +3303,20 @@ class Be extends w {
|
|
|
3303
3303
|
_parse(e) {
|
|
3304
3304
|
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3305
3305
|
if (s.parsedType !== p.string && s.parsedType !== p.number) {
|
|
3306
|
-
const
|
|
3306
|
+
const n = x.objectValues(t);
|
|
3307
3307
|
return h(s, {
|
|
3308
|
-
expected: x.joinValues(
|
|
3308
|
+
expected: x.joinValues(n),
|
|
3309
3309
|
received: s.parsedType,
|
|
3310
3310
|
code: l.invalid_type
|
|
3311
|
-
}),
|
|
3311
|
+
}), _;
|
|
3312
3312
|
}
|
|
3313
|
-
if (st(this, Me) ||
|
|
3314
|
-
const
|
|
3313
|
+
if (st(this, Me) || cr(this, Me, new Set(x.getValidEnumValues(this._def.values))), !st(this, Me).has(e.data)) {
|
|
3314
|
+
const n = x.objectValues(t);
|
|
3315
3315
|
return h(s, {
|
|
3316
3316
|
received: s.data,
|
|
3317
3317
|
code: l.invalid_enum_value,
|
|
3318
|
-
options:
|
|
3319
|
-
}),
|
|
3318
|
+
options: n
|
|
3319
|
+
}), _;
|
|
3320
3320
|
}
|
|
3321
3321
|
return $(e.data);
|
|
3322
3322
|
}
|
|
@@ -3325,9 +3325,9 @@ class Be extends w {
|
|
|
3325
3325
|
}
|
|
3326
3326
|
}
|
|
3327
3327
|
Me = /* @__PURE__ */ new WeakMap();
|
|
3328
|
-
Be.create = (
|
|
3329
|
-
values:
|
|
3330
|
-
typeName:
|
|
3328
|
+
Be.create = (r, e) => new Be(d({
|
|
3329
|
+
values: r,
|
|
3330
|
+
typeName: v.ZodNativeEnum
|
|
3331
3331
|
}, b(e)));
|
|
3332
3332
|
class Oe extends w {
|
|
3333
3333
|
unwrap() {
|
|
@@ -3340,27 +3340,27 @@ class Oe extends w {
|
|
|
3340
3340
|
code: l.invalid_type,
|
|
3341
3341
|
expected: p.promise,
|
|
3342
3342
|
received: t.parsedType
|
|
3343
|
-
}),
|
|
3343
|
+
}), _;
|
|
3344
3344
|
const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
3345
|
-
return $(s.then((
|
|
3345
|
+
return $(s.then((n) => this._def.type.parseAsync(n, {
|
|
3346
3346
|
path: t.path,
|
|
3347
3347
|
errorMap: t.common.contextualErrorMap
|
|
3348
3348
|
})));
|
|
3349
3349
|
}
|
|
3350
3350
|
}
|
|
3351
|
-
Oe.create = (
|
|
3352
|
-
type:
|
|
3353
|
-
typeName:
|
|
3351
|
+
Oe.create = (r, e) => new Oe(d({
|
|
3352
|
+
type: r,
|
|
3353
|
+
typeName: v.ZodPromise
|
|
3354
3354
|
}, b(e)));
|
|
3355
3355
|
class K extends w {
|
|
3356
3356
|
innerType() {
|
|
3357
3357
|
return this._def.schema;
|
|
3358
3358
|
}
|
|
3359
3359
|
sourceType() {
|
|
3360
|
-
return this._def.schema._def.typeName ===
|
|
3360
|
+
return this._def.schema._def.typeName === v.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3361
3361
|
}
|
|
3362
3362
|
_parse(e) {
|
|
3363
|
-
const { status: t, ctx: s } = this._processInputParams(e),
|
|
3363
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
3364
3364
|
addIssue: (i) => {
|
|
3365
3365
|
h(s, i), i.fatal ? t.abort() : t.dirty();
|
|
3366
3366
|
},
|
|
@@ -3368,33 +3368,33 @@ class K extends w {
|
|
|
3368
3368
|
return s.path;
|
|
3369
3369
|
}
|
|
3370
3370
|
};
|
|
3371
|
-
if (a.addIssue = a.addIssue.bind(a),
|
|
3372
|
-
const i =
|
|
3371
|
+
if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
|
|
3372
|
+
const i = n.transform(s.data, a);
|
|
3373
3373
|
if (s.common.async)
|
|
3374
3374
|
return Promise.resolve(i).then((o) => M(this, null, function* () {
|
|
3375
3375
|
if (t.value === "aborted")
|
|
3376
|
-
return
|
|
3376
|
+
return _;
|
|
3377
3377
|
const c = yield this._def.schema._parseAsync({
|
|
3378
3378
|
data: o,
|
|
3379
3379
|
path: s.path,
|
|
3380
3380
|
parent: s
|
|
3381
3381
|
});
|
|
3382
|
-
return c.status === "aborted" ?
|
|
3382
|
+
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? ke(c.value) : c;
|
|
3383
3383
|
}));
|
|
3384
3384
|
{
|
|
3385
3385
|
if (t.value === "aborted")
|
|
3386
|
-
return
|
|
3386
|
+
return _;
|
|
3387
3387
|
const o = this._def.schema._parseSync({
|
|
3388
3388
|
data: i,
|
|
3389
3389
|
path: s.path,
|
|
3390
3390
|
parent: s
|
|
3391
3391
|
});
|
|
3392
|
-
return o.status === "aborted" ?
|
|
3392
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? ke(o.value) : o;
|
|
3393
3393
|
}
|
|
3394
3394
|
}
|
|
3395
|
-
if (
|
|
3395
|
+
if (n.type === "refinement") {
|
|
3396
3396
|
const i = (o) => {
|
|
3397
|
-
const c =
|
|
3397
|
+
const c = n.refinement(o, a);
|
|
3398
3398
|
if (s.common.async)
|
|
3399
3399
|
return Promise.resolve(c);
|
|
3400
3400
|
if (c instanceof Promise)
|
|
@@ -3407,11 +3407,11 @@ class K extends w {
|
|
|
3407
3407
|
path: s.path,
|
|
3408
3408
|
parent: s
|
|
3409
3409
|
});
|
|
3410
|
-
return o.status === "aborted" ?
|
|
3410
|
+
return o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
3411
3411
|
} else
|
|
3412
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ?
|
|
3412
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
3413
3413
|
}
|
|
3414
|
-
if (
|
|
3414
|
+
if (n.type === "transform")
|
|
3415
3415
|
if (s.common.async === !1) {
|
|
3416
3416
|
const i = this._def.schema._parseSync({
|
|
3417
3417
|
data: s.data,
|
|
@@ -3420,24 +3420,24 @@ class K extends w {
|
|
|
3420
3420
|
});
|
|
3421
3421
|
if (!_e(i))
|
|
3422
3422
|
return i;
|
|
3423
|
-
const o =
|
|
3423
|
+
const o = n.transform(i.value, a);
|
|
3424
3424
|
if (o instanceof Promise)
|
|
3425
3425
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3426
3426
|
return { status: t.value, value: o };
|
|
3427
3427
|
} else
|
|
3428
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => _e(i) ? Promise.resolve(
|
|
3429
|
-
x.assertNever(
|
|
3428
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => _e(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
3429
|
+
x.assertNever(n);
|
|
3430
3430
|
}
|
|
3431
3431
|
}
|
|
3432
|
-
K.create = (
|
|
3433
|
-
schema:
|
|
3434
|
-
typeName:
|
|
3432
|
+
K.create = (r, e, t) => new K(d({
|
|
3433
|
+
schema: r,
|
|
3434
|
+
typeName: v.ZodEffects,
|
|
3435
3435
|
effect: e
|
|
3436
3436
|
}, b(t)));
|
|
3437
|
-
K.createWithPreprocess = (
|
|
3437
|
+
K.createWithPreprocess = (r, e, t) => new K(d({
|
|
3438
3438
|
schema: e,
|
|
3439
|
-
effect: { type: "preprocess", transform:
|
|
3440
|
-
typeName:
|
|
3439
|
+
effect: { type: "preprocess", transform: r },
|
|
3440
|
+
typeName: v.ZodEffects
|
|
3441
3441
|
}, b(t)));
|
|
3442
3442
|
class te extends w {
|
|
3443
3443
|
_parse(e) {
|
|
@@ -3447,9 +3447,9 @@ class te extends w {
|
|
|
3447
3447
|
return this._def.innerType;
|
|
3448
3448
|
}
|
|
3449
3449
|
}
|
|
3450
|
-
te.create = (
|
|
3451
|
-
innerType:
|
|
3452
|
-
typeName:
|
|
3450
|
+
te.create = (r, e) => new te(d({
|
|
3451
|
+
innerType: r,
|
|
3452
|
+
typeName: v.ZodOptional
|
|
3453
3453
|
}, b(e)));
|
|
3454
3454
|
class me extends w {
|
|
3455
3455
|
_parse(e) {
|
|
@@ -3459,9 +3459,9 @@ class me extends w {
|
|
|
3459
3459
|
return this._def.innerType;
|
|
3460
3460
|
}
|
|
3461
3461
|
}
|
|
3462
|
-
me.create = (
|
|
3463
|
-
innerType:
|
|
3464
|
-
typeName:
|
|
3462
|
+
me.create = (r, e) => new me(d({
|
|
3463
|
+
innerType: r,
|
|
3464
|
+
typeName: v.ZodNullable
|
|
3465
3465
|
}, b(e)));
|
|
3466
3466
|
class qe extends w {
|
|
3467
3467
|
_parse(e) {
|
|
@@ -3477,9 +3477,9 @@ class qe extends w {
|
|
|
3477
3477
|
return this._def.innerType;
|
|
3478
3478
|
}
|
|
3479
3479
|
}
|
|
3480
|
-
qe.create = (
|
|
3481
|
-
innerType:
|
|
3482
|
-
typeName:
|
|
3480
|
+
qe.create = (r, e) => new qe(d({
|
|
3481
|
+
innerType: r,
|
|
3482
|
+
typeName: v.ZodDefault,
|
|
3483
3483
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3484
3484
|
}, b(e)));
|
|
3485
3485
|
class He extends w {
|
|
@@ -3488,12 +3488,12 @@ class He extends w {
|
|
|
3488
3488
|
common: y(d({}, t.common), {
|
|
3489
3489
|
issues: []
|
|
3490
3490
|
})
|
|
3491
|
-
}),
|
|
3491
|
+
}), n = this._def.innerType._parse({
|
|
3492
3492
|
data: s.data,
|
|
3493
3493
|
path: s.path,
|
|
3494
3494
|
parent: d({}, s)
|
|
3495
3495
|
});
|
|
3496
|
-
return Pe(
|
|
3496
|
+
return Pe(n) ? n.then((a) => ({
|
|
3497
3497
|
status: "valid",
|
|
3498
3498
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3499
3499
|
get error() {
|
|
@@ -3503,7 +3503,7 @@ class He extends w {
|
|
|
3503
3503
|
})
|
|
3504
3504
|
})) : {
|
|
3505
3505
|
status: "valid",
|
|
3506
|
-
value:
|
|
3506
|
+
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
3507
3507
|
get error() {
|
|
3508
3508
|
return new z(s.common.issues);
|
|
3509
3509
|
},
|
|
@@ -3515,9 +3515,9 @@ class He extends w {
|
|
|
3515
3515
|
return this._def.innerType;
|
|
3516
3516
|
}
|
|
3517
3517
|
}
|
|
3518
|
-
He.create = (
|
|
3519
|
-
innerType:
|
|
3520
|
-
typeName:
|
|
3518
|
+
He.create = (r, e) => new He(d({
|
|
3519
|
+
innerType: r,
|
|
3520
|
+
typeName: v.ZodCatch,
|
|
3521
3521
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3522
3522
|
}, b(e)));
|
|
3523
3523
|
class ot extends w {
|
|
@@ -3528,14 +3528,14 @@ class ot extends w {
|
|
|
3528
3528
|
code: l.invalid_type,
|
|
3529
3529
|
expected: p.nan,
|
|
3530
3530
|
received: s.parsedType
|
|
3531
|
-
}),
|
|
3531
|
+
}), _;
|
|
3532
3532
|
}
|
|
3533
3533
|
return { status: "valid", value: e.data };
|
|
3534
3534
|
}
|
|
3535
3535
|
}
|
|
3536
|
-
ot.create = (
|
|
3537
|
-
typeName:
|
|
3538
|
-
}, b(
|
|
3536
|
+
ot.create = (r) => new ot(d({
|
|
3537
|
+
typeName: v.ZodNaN
|
|
3538
|
+
}, b(r)));
|
|
3539
3539
|
const Gs = Symbol("zod_brand");
|
|
3540
3540
|
class Zt extends w {
|
|
3541
3541
|
_parse(e) {
|
|
@@ -3560,23 +3560,23 @@ class Ke extends w {
|
|
|
3560
3560
|
path: s.path,
|
|
3561
3561
|
parent: s
|
|
3562
3562
|
});
|
|
3563
|
-
return a.status === "aborted" ?
|
|
3563
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), ke(a.value)) : this._def.out._parseAsync({
|
|
3564
3564
|
data: a.value,
|
|
3565
3565
|
path: s.path,
|
|
3566
3566
|
parent: s
|
|
3567
3567
|
});
|
|
3568
3568
|
});
|
|
3569
3569
|
{
|
|
3570
|
-
const
|
|
3570
|
+
const n = this._def.in._parseSync({
|
|
3571
3571
|
data: s.data,
|
|
3572
3572
|
path: s.path,
|
|
3573
3573
|
parent: s
|
|
3574
3574
|
});
|
|
3575
|
-
return
|
|
3575
|
+
return n.status === "aborted" ? _ : n.status === "dirty" ? (t.dirty(), {
|
|
3576
3576
|
status: "dirty",
|
|
3577
|
-
value:
|
|
3577
|
+
value: n.value
|
|
3578
3578
|
}) : this._def.out._parseSync({
|
|
3579
|
-
data:
|
|
3579
|
+
data: n.value,
|
|
3580
3580
|
path: s.path,
|
|
3581
3581
|
parent: s
|
|
3582
3582
|
});
|
|
@@ -3586,60 +3586,73 @@ class Ke extends w {
|
|
|
3586
3586
|
return new Ke({
|
|
3587
3587
|
in: e,
|
|
3588
3588
|
out: t,
|
|
3589
|
-
typeName:
|
|
3589
|
+
typeName: v.ZodPipeline
|
|
3590
3590
|
});
|
|
3591
3591
|
}
|
|
3592
3592
|
}
|
|
3593
3593
|
class Je extends w {
|
|
3594
3594
|
_parse(e) {
|
|
3595
|
-
const t = this._def.innerType._parse(e), s = (
|
|
3596
|
-
return Pe(t) ? t.then((
|
|
3595
|
+
const t = this._def.innerType._parse(e), s = (n) => (_e(n) && (n.value = Object.freeze(n.value)), n);
|
|
3596
|
+
return Pe(t) ? t.then((n) => s(n)) : s(t);
|
|
3597
3597
|
}
|
|
3598
3598
|
unwrap() {
|
|
3599
3599
|
return this._def.innerType;
|
|
3600
3600
|
}
|
|
3601
3601
|
}
|
|
3602
|
-
Je.create = (
|
|
3603
|
-
innerType:
|
|
3604
|
-
typeName:
|
|
3602
|
+
Je.create = (r, e) => new Je(d({
|
|
3603
|
+
innerType: r,
|
|
3604
|
+
typeName: v.ZodReadonly
|
|
3605
3605
|
}, b(e)));
|
|
3606
|
-
function
|
|
3607
|
-
|
|
3606
|
+
function Ht(r, e) {
|
|
3607
|
+
const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
|
|
3608
|
+
return typeof t == "string" ? { message: t } : t;
|
|
3609
|
+
}
|
|
3610
|
+
function hr(r, e = {}, t) {
|
|
3611
|
+
return r ? Ae.create().superRefine((s, n) => {
|
|
3608
3612
|
var a, i;
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3613
|
+
const o = r(s);
|
|
3614
|
+
if (o instanceof Promise)
|
|
3615
|
+
return o.then((c) => {
|
|
3616
|
+
var u, f;
|
|
3617
|
+
if (!c) {
|
|
3618
|
+
const g = Ht(e, s), O = (f = (u = g.fatal) !== null && u !== void 0 ? u : t) !== null && f !== void 0 ? f : !0;
|
|
3619
|
+
n.addIssue(y(d({ code: "custom" }, g), { fatal: O }));
|
|
3620
|
+
}
|
|
3621
|
+
});
|
|
3622
|
+
if (!o) {
|
|
3623
|
+
const c = Ht(e, s), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3624
|
+
n.addIssue(y(d({ code: "custom" }, c), { fatal: u }));
|
|
3612
3625
|
}
|
|
3613
3626
|
}) : Ae.create();
|
|
3614
3627
|
}
|
|
3615
3628
|
const Ks = {
|
|
3616
3629
|
object: S.lazycreate
|
|
3617
3630
|
};
|
|
3618
|
-
var
|
|
3619
|
-
(function(
|
|
3620
|
-
|
|
3621
|
-
})(
|
|
3622
|
-
const Xs = (
|
|
3623
|
-
message: `Input not instance of ${
|
|
3624
|
-
}) =>
|
|
3625
|
-
string: (
|
|
3626
|
-
number: (
|
|
3627
|
-
boolean: (
|
|
3631
|
+
var v;
|
|
3632
|
+
(function(r) {
|
|
3633
|
+
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
3634
|
+
})(v || (v = {}));
|
|
3635
|
+
const Xs = (r, e = {
|
|
3636
|
+
message: `Input not instance of ${r.name}`
|
|
3637
|
+
}) => hr((t) => t instanceof r, e), pr = J.create, mr = fe.create, Ys = ot.create, Qs = he.create, yr = $e.create, en = be.create, tn = nt.create, rn = Fe.create, sn = Ve.create, nn = Ae.create, an = ve.create, on = ce.create, cn = at.create, dn = G.create, un = S.create, ln = S.strictCreate, fn = De.create, hn = dt.create, pn = Le.create, mn = se.create, yn = Ue.create, gn = it.create, vn = we.create, _n = Te.create, bn = ze.create, wn = We.create, xn = pe.create, kn = Be.create, Tn = Oe.create, Jt = K.create, Sn = te.create, En = me.create, An = K.createWithPreprocess, On = Ke.create, Cn = () => pr().optional(), Nn = () => mr().optional(), In = () => yr().optional(), jn = {
|
|
3638
|
+
string: (r) => J.create(y(d({}, r), { coerce: !0 })),
|
|
3639
|
+
number: (r) => fe.create(y(d({}, r), { coerce: !0 })),
|
|
3640
|
+
boolean: (r) => $e.create(y(d({}, r), {
|
|
3628
3641
|
coerce: !0
|
|
3629
3642
|
})),
|
|
3630
|
-
bigint: (
|
|
3631
|
-
date: (
|
|
3632
|
-
},
|
|
3633
|
-
var
|
|
3643
|
+
bigint: (r) => he.create(y(d({}, r), { coerce: !0 })),
|
|
3644
|
+
date: (r) => be.create(y(d({}, r), { coerce: !0 }))
|
|
3645
|
+
}, Zn = _;
|
|
3646
|
+
var I = /* @__PURE__ */ Object.freeze({
|
|
3634
3647
|
__proto__: null,
|
|
3635
3648
|
defaultErrorMap: Ee,
|
|
3636
3649
|
setErrorMap: Es,
|
|
3637
3650
|
getErrorMap: tt,
|
|
3638
|
-
makeIssue:
|
|
3651
|
+
makeIssue: rt,
|
|
3639
3652
|
EMPTY_PATH: As,
|
|
3640
3653
|
addIssueToContext: h,
|
|
3641
3654
|
ParseStatus: Z,
|
|
3642
|
-
INVALID:
|
|
3655
|
+
INVALID: _,
|
|
3643
3656
|
DIRTY: ke,
|
|
3644
3657
|
OK: $,
|
|
3645
3658
|
isAborted: At,
|
|
@@ -3655,13 +3668,13 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3655
3668
|
ZodParsedType: p,
|
|
3656
3669
|
getParsedType: oe,
|
|
3657
3670
|
ZodType: w,
|
|
3658
|
-
datetimeRegex:
|
|
3671
|
+
datetimeRegex: lr,
|
|
3659
3672
|
ZodString: J,
|
|
3660
3673
|
ZodNumber: fe,
|
|
3661
3674
|
ZodBigInt: he,
|
|
3662
3675
|
ZodBoolean: $e,
|
|
3663
3676
|
ZodDate: be,
|
|
3664
|
-
ZodSymbol:
|
|
3677
|
+
ZodSymbol: nt,
|
|
3665
3678
|
ZodUndefined: Fe,
|
|
3666
3679
|
ZodNull: Ve,
|
|
3667
3680
|
ZodAny: Ae,
|
|
@@ -3694,67 +3707,67 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3694
3707
|
ZodBranded: Zt,
|
|
3695
3708
|
ZodPipeline: Ke,
|
|
3696
3709
|
ZodReadonly: Je,
|
|
3697
|
-
custom:
|
|
3710
|
+
custom: hr,
|
|
3698
3711
|
Schema: w,
|
|
3699
3712
|
ZodSchema: w,
|
|
3700
3713
|
late: Ks,
|
|
3701
3714
|
get ZodFirstPartyTypeKind() {
|
|
3702
|
-
return
|
|
3715
|
+
return v;
|
|
3703
3716
|
},
|
|
3704
|
-
coerce:
|
|
3705
|
-
any:
|
|
3706
|
-
array:
|
|
3717
|
+
coerce: jn,
|
|
3718
|
+
any: nn,
|
|
3719
|
+
array: dn,
|
|
3707
3720
|
bigint: Qs,
|
|
3708
|
-
boolean:
|
|
3709
|
-
date:
|
|
3710
|
-
discriminatedUnion:
|
|
3711
|
-
effect:
|
|
3712
|
-
enum:
|
|
3713
|
-
function:
|
|
3721
|
+
boolean: yr,
|
|
3722
|
+
date: en,
|
|
3723
|
+
discriminatedUnion: hn,
|
|
3724
|
+
effect: Jt,
|
|
3725
|
+
enum: xn,
|
|
3726
|
+
function: _n,
|
|
3714
3727
|
instanceof: Xs,
|
|
3715
|
-
intersection:
|
|
3716
|
-
lazy:
|
|
3717
|
-
literal:
|
|
3718
|
-
map:
|
|
3728
|
+
intersection: pn,
|
|
3729
|
+
lazy: bn,
|
|
3730
|
+
literal: wn,
|
|
3731
|
+
map: gn,
|
|
3719
3732
|
nan: Ys,
|
|
3720
|
-
nativeEnum:
|
|
3721
|
-
never:
|
|
3722
|
-
null:
|
|
3723
|
-
nullable:
|
|
3724
|
-
number:
|
|
3725
|
-
object:
|
|
3726
|
-
oboolean:
|
|
3727
|
-
onumber:
|
|
3728
|
-
optional:
|
|
3729
|
-
ostring:
|
|
3730
|
-
pipeline:
|
|
3731
|
-
preprocess:
|
|
3732
|
-
promise:
|
|
3733
|
-
record:
|
|
3734
|
-
set:
|
|
3735
|
-
strictObject:
|
|
3736
|
-
string:
|
|
3737
|
-
symbol:
|
|
3738
|
-
transformer:
|
|
3739
|
-
tuple:
|
|
3740
|
-
undefined:
|
|
3741
|
-
union:
|
|
3742
|
-
unknown:
|
|
3743
|
-
void:
|
|
3744
|
-
NEVER:
|
|
3733
|
+
nativeEnum: kn,
|
|
3734
|
+
never: on,
|
|
3735
|
+
null: sn,
|
|
3736
|
+
nullable: En,
|
|
3737
|
+
number: mr,
|
|
3738
|
+
object: un,
|
|
3739
|
+
oboolean: In,
|
|
3740
|
+
onumber: Nn,
|
|
3741
|
+
optional: Sn,
|
|
3742
|
+
ostring: Cn,
|
|
3743
|
+
pipeline: On,
|
|
3744
|
+
preprocess: An,
|
|
3745
|
+
promise: Tn,
|
|
3746
|
+
record: yn,
|
|
3747
|
+
set: vn,
|
|
3748
|
+
strictObject: ln,
|
|
3749
|
+
string: pr,
|
|
3750
|
+
symbol: tn,
|
|
3751
|
+
transformer: Jt,
|
|
3752
|
+
tuple: mn,
|
|
3753
|
+
undefined: rn,
|
|
3754
|
+
union: fn,
|
|
3755
|
+
unknown: an,
|
|
3756
|
+
void: cn,
|
|
3757
|
+
NEVER: Zn,
|
|
3745
3758
|
ZodIssueCode: l,
|
|
3746
3759
|
quotelessJson: Ss,
|
|
3747
3760
|
ZodError: z
|
|
3748
3761
|
});
|
|
3749
|
-
const
|
|
3750
|
-
language:
|
|
3751
|
-
disableMarkedForExport:
|
|
3762
|
+
const Rn = I.object({
|
|
3763
|
+
language: I.enum(["typescript", "javascript"]).optional(),
|
|
3764
|
+
disableMarkedForExport: I.boolean().optional()
|
|
3752
3765
|
}).and(
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
framework:
|
|
3756
|
-
model:
|
|
3757
|
-
styling:
|
|
3766
|
+
I.union([
|
|
3767
|
+
I.object({
|
|
3768
|
+
framework: I.literal("react"),
|
|
3769
|
+
model: I.string().optional(),
|
|
3770
|
+
styling: I.enum([
|
|
3758
3771
|
"plain_css",
|
|
3759
3772
|
"css_modules",
|
|
3760
3773
|
"styled_components",
|
|
@@ -3763,33 +3776,33 @@ const Zr = N.object({
|
|
|
3763
3776
|
"scss",
|
|
3764
3777
|
"inline_styles"
|
|
3765
3778
|
]),
|
|
3766
|
-
uiLibrary:
|
|
3767
|
-
enableUILibraryTheming:
|
|
3768
|
-
enableCompactStructure:
|
|
3769
|
-
enableAutoSplit:
|
|
3770
|
-
autoSplitThreshold:
|
|
3779
|
+
uiLibrary: I.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
3780
|
+
enableUILibraryTheming: I.boolean().optional(),
|
|
3781
|
+
enableCompactStructure: I.boolean().optional(),
|
|
3782
|
+
enableAutoSplit: I.boolean().optional(),
|
|
3783
|
+
autoSplitThreshold: I.number().optional()
|
|
3771
3784
|
}),
|
|
3772
|
-
|
|
3773
|
-
framework:
|
|
3774
|
-
styling:
|
|
3775
|
-
enableTranslation:
|
|
3785
|
+
I.object({
|
|
3786
|
+
framework: I.literal("html"),
|
|
3787
|
+
styling: I.enum(["plain_css", "inline_styles"]),
|
|
3788
|
+
enableTranslation: I.boolean().optional()
|
|
3776
3789
|
})
|
|
3777
3790
|
])
|
|
3778
|
-
),
|
|
3779
|
-
const e =
|
|
3791
|
+
), Mn = (r) => {
|
|
3792
|
+
const e = Rn.safeParse(r);
|
|
3780
3793
|
if (e.success === !1) {
|
|
3781
3794
|
const t = new Error("Invalid codegen settings");
|
|
3782
3795
|
throw t.cause = e.error, t;
|
|
3783
3796
|
}
|
|
3784
3797
|
return e.data;
|
|
3785
|
-
},
|
|
3798
|
+
}, Gt = /* @__PURE__ */ new Set([
|
|
3786
3799
|
"FRAME",
|
|
3787
3800
|
"INSTANCE",
|
|
3788
3801
|
"COMPONENT",
|
|
3789
3802
|
"COMPONENT_SET",
|
|
3790
3803
|
"GROUP"
|
|
3791
|
-
]),
|
|
3792
|
-
const t =
|
|
3804
|
+
]), Pn = (r, e) => {
|
|
3805
|
+
const t = ir(r.document, e);
|
|
3793
3806
|
if (!t)
|
|
3794
3807
|
return {
|
|
3795
3808
|
isValid: !1,
|
|
@@ -3797,7 +3810,7 @@ const Zr = N.object({
|
|
|
3797
3810
|
};
|
|
3798
3811
|
if (t.type === "CANVAS") {
|
|
3799
3812
|
const s = t.children.filter(
|
|
3800
|
-
(
|
|
3813
|
+
(n) => Gt.has(n.type)
|
|
3801
3814
|
);
|
|
3802
3815
|
return s.length === 1 ? {
|
|
3803
3816
|
isValid: !0,
|
|
@@ -3808,13 +3821,13 @@ const Zr = N.object({
|
|
|
3808
3821
|
reason: "Selected node is a page with multiple children"
|
|
3809
3822
|
};
|
|
3810
3823
|
}
|
|
3811
|
-
return
|
|
3824
|
+
return Gt.has(t.type) ? { isValid: !0, node: t } : {
|
|
3812
3825
|
isValid: !1,
|
|
3813
3826
|
reason: "Selected node type is not supported"
|
|
3814
3827
|
};
|
|
3815
3828
|
};
|
|
3816
|
-
var L, Ge, ct,
|
|
3817
|
-
class
|
|
3829
|
+
var L, Ge, ct, gr;
|
|
3830
|
+
class Bn {
|
|
3818
3831
|
constructor({
|
|
3819
3832
|
auth: e,
|
|
3820
3833
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
@@ -3838,11 +3851,11 @@ class Wr {
|
|
|
3838
3851
|
}
|
|
3839
3852
|
generateCode(s) {
|
|
3840
3853
|
return M(this, arguments, function* (e, t = {}) {
|
|
3841
|
-
var
|
|
3854
|
+
var g, O, C, N, R, B, ne, de, V;
|
|
3842
3855
|
if (this.hasAuth() === !1)
|
|
3843
3856
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
3844
|
-
e.figmaToken && (yield $t(this, ct,
|
|
3845
|
-
const
|
|
3857
|
+
e.figmaToken && (yield $t(this, ct, gr).call(this, e.fileKey, e.figmaToken, e.nodesId));
|
|
3858
|
+
const n = {}, a = Mn(e.settings);
|
|
3846
3859
|
let i = e.tracking;
|
|
3847
3860
|
H(this, L) && "userId" in H(this, L) && H(this, L).userId && (i != null && i.externalId || (i = { externalId: H(this, L).userId }));
|
|
3848
3861
|
const o = yield fetch(`${H(this, Ge)}/v1/codegen`, {
|
|
@@ -3876,7 +3889,7 @@ class Wr {
|
|
|
3876
3889
|
q = JSON.parse(X);
|
|
3877
3890
|
} catch (Ce) {
|
|
3878
3891
|
}
|
|
3879
|
-
throw ((
|
|
3892
|
+
throw ((g = q == null ? void 0 : q.error) == null ? void 0 : g.name) === "ZodError" ? new ue({
|
|
3880
3893
|
name: "HTTP error from Anima API",
|
|
3881
3894
|
reason: "Invalid body payload",
|
|
3882
3895
|
detail: q.error.issues,
|
|
@@ -3918,15 +3931,15 @@ class Wr {
|
|
|
3918
3931
|
}
|
|
3919
3932
|
switch (k.type) {
|
|
3920
3933
|
case "queueing": {
|
|
3921
|
-
typeof t == "function" ? t(k) : (
|
|
3934
|
+
typeof t == "function" ? t(k) : (O = t.onQueueing) == null || O.call(t);
|
|
3922
3935
|
break;
|
|
3923
3936
|
}
|
|
3924
3937
|
case "start": {
|
|
3925
|
-
|
|
3938
|
+
n.sessionId = k.sessionId, typeof t == "function" ? t(k) : (C = t.onStart) == null || C.call(t, { sessionId: k.sessionId });
|
|
3926
3939
|
break;
|
|
3927
3940
|
}
|
|
3928
3941
|
case "pre_codegen": {
|
|
3929
|
-
typeof t == "function" ? t(k) : (
|
|
3942
|
+
typeof t == "function" ? t(k) : (N = t.onPreCodegen) == null || N.call(t, { message: k.message });
|
|
3930
3943
|
break;
|
|
3931
3944
|
}
|
|
3932
3945
|
case "assets_uploaded": {
|
|
@@ -3934,18 +3947,18 @@ class Wr {
|
|
|
3934
3947
|
break;
|
|
3935
3948
|
}
|
|
3936
3949
|
case "assets_list": {
|
|
3937
|
-
|
|
3950
|
+
n.assets = k.payload.assets, typeof t == "function" ? t(k) : (B = t.onAssetsList) == null || B.call(t, k.payload);
|
|
3938
3951
|
break;
|
|
3939
3952
|
}
|
|
3940
3953
|
case "figma_metadata": {
|
|
3941
|
-
|
|
3954
|
+
n.figmaFileName = k.figmaFileName, n.figmaSelectedFrameName = k.figmaSelectedFrameName, typeof t == "function" ? t(k) : (ne = t.onFigmaMetadata) == null || ne.call(t, {
|
|
3942
3955
|
figmaFileName: k.figmaFileName,
|
|
3943
3956
|
figmaSelectedFrameName: k.figmaSelectedFrameName
|
|
3944
3957
|
});
|
|
3945
3958
|
break;
|
|
3946
3959
|
}
|
|
3947
3960
|
case "generating_code": {
|
|
3948
|
-
k.payload.status === "success" && (
|
|
3961
|
+
k.payload.status === "success" && (n.files = k.payload.files), typeof t == "function" ? t(k) : (de = t.onGeneratingCode) == null || de.call(t, {
|
|
3949
3962
|
status: k.payload.status,
|
|
3950
3963
|
progress: k.payload.progress,
|
|
3951
3964
|
files: k.payload.files
|
|
@@ -3962,12 +3975,12 @@ class Wr {
|
|
|
3962
3975
|
reason: k.payload.reason
|
|
3963
3976
|
});
|
|
3964
3977
|
case "done": {
|
|
3965
|
-
if (!
|
|
3978
|
+
if (!n.files)
|
|
3966
3979
|
throw new ue({
|
|
3967
3980
|
name: "Invalid response",
|
|
3968
3981
|
reason: "No code generated"
|
|
3969
3982
|
});
|
|
3970
|
-
return
|
|
3983
|
+
return n.tokenUsage = k.payload.tokenUsage, n;
|
|
3971
3984
|
}
|
|
3972
3985
|
}
|
|
3973
3986
|
}
|
|
@@ -3983,11 +3996,11 @@ class Wr {
|
|
|
3983
3996
|
});
|
|
3984
3997
|
}
|
|
3985
3998
|
}
|
|
3986
|
-
L = new WeakMap(), Ge = new WeakMap(), ct = new WeakSet(),
|
|
3999
|
+
L = new WeakMap(), Ge = new WeakMap(), ct = new WeakSet(), gr = function(e, t, s) {
|
|
3987
4000
|
return M(this, null, function* () {
|
|
3988
|
-
let
|
|
4001
|
+
let n;
|
|
3989
4002
|
try {
|
|
3990
|
-
|
|
4003
|
+
n = yield Ts({
|
|
3991
4004
|
fileKey: e,
|
|
3992
4005
|
authToken: t,
|
|
3993
4006
|
params: {
|
|
@@ -3998,7 +4011,7 @@ L = new WeakMap(), Ge = new WeakMap(), ct = new WeakSet(), gn = function(e, t, s
|
|
|
3998
4011
|
return;
|
|
3999
4012
|
}
|
|
4000
4013
|
const i = s.map(
|
|
4001
|
-
(o) =>
|
|
4014
|
+
(o) => Pn(n, o)
|
|
4002
4015
|
).find(
|
|
4003
4016
|
(o) => !o.isValid
|
|
4004
4017
|
);
|
|
@@ -4009,47 +4022,50 @@ L = new WeakMap(), Ge = new WeakMap(), ct = new WeakSet(), gn = function(e, t, s
|
|
|
4009
4022
|
});
|
|
4010
4023
|
});
|
|
4011
4024
|
};
|
|
4012
|
-
const
|
|
4025
|
+
const qn = (r) => {
|
|
4013
4026
|
var e;
|
|
4014
|
-
if (!
|
|
4027
|
+
if (!r)
|
|
4015
4028
|
return [!1, "", ""];
|
|
4016
4029
|
try {
|
|
4017
|
-
const t = new URL(
|
|
4030
|
+
const t = new URL(r), s = t.pathname;
|
|
4018
4031
|
if (t.origin !== "https://www.figma.com")
|
|
4019
4032
|
return [!1, "", ""];
|
|
4020
|
-
const
|
|
4021
|
-
|
|
4033
|
+
const n = t.toString();
|
|
4034
|
+
if (r !== n)
|
|
4035
|
+
return [!1, "", ""];
|
|
4036
|
+
const a = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), i = s.split("/")[2];
|
|
4037
|
+
return [(s.startsWith("/file/") && t.searchParams.get("type") !== "whiteboard" || s.startsWith("/design/")) && i.length === 22, i, a];
|
|
4022
4038
|
} catch (t) {
|
|
4023
4039
|
return [!1, "", ""];
|
|
4024
4040
|
}
|
|
4025
|
-
},
|
|
4026
|
-
fileKey:
|
|
4041
|
+
}, Hn = ({
|
|
4042
|
+
fileKey: r,
|
|
4027
4043
|
nodeId: e,
|
|
4028
4044
|
duplicate: t
|
|
4029
4045
|
}) => {
|
|
4030
4046
|
const s = new URL("https://www.figma.com");
|
|
4031
|
-
return s.pathname = `design/${
|
|
4047
|
+
return s.pathname = `design/${r}`, t && (s.pathname = `${s.pathname}/duplicate`), e && s.searchParams.set("node-id", e.replace(":", "-")), s;
|
|
4032
4048
|
};
|
|
4033
|
-
class
|
|
4049
|
+
class Jn extends Error {
|
|
4034
4050
|
constructor(e, t) {
|
|
4035
4051
|
super(e), this.response = t;
|
|
4036
4052
|
}
|
|
4037
4053
|
}
|
|
4038
|
-
const
|
|
4039
|
-
files:
|
|
4054
|
+
const Gn = ({
|
|
4055
|
+
files: r,
|
|
4040
4056
|
screenPath: e = "src/screens"
|
|
4041
4057
|
}) => {
|
|
4042
4058
|
const t = {}, s = /* @__PURE__ */ new Set();
|
|
4043
|
-
function
|
|
4044
|
-
if (s.has(a) || !
|
|
4059
|
+
function n(a) {
|
|
4060
|
+
if (s.has(a) || !r[a])
|
|
4045
4061
|
return;
|
|
4046
|
-
s.add(a), t[a] =
|
|
4062
|
+
s.add(a), t[a] = r[a], $n(r[a].content).forEach((o) => {
|
|
4047
4063
|
try {
|
|
4048
|
-
const c =
|
|
4064
|
+
const c = Fn(a, o);
|
|
4049
4065
|
if (c.startsWith("src/")) {
|
|
4050
4066
|
const u = c.split("/").slice(0, -1).join("/");
|
|
4051
|
-
|
|
4052
|
-
s.has(
|
|
4067
|
+
Vn(r, u).forEach((g) => {
|
|
4068
|
+
s.has(g) || n(g);
|
|
4053
4069
|
});
|
|
4054
4070
|
}
|
|
4055
4071
|
} catch (c) {
|
|
@@ -4060,33 +4076,33 @@ const Jr = ({
|
|
|
4060
4076
|
}
|
|
4061
4077
|
});
|
|
4062
4078
|
}
|
|
4063
|
-
return Object.entries(
|
|
4064
|
-
a.startsWith(e) ?
|
|
4079
|
+
return Object.entries(r).forEach(([a, i]) => {
|
|
4080
|
+
a.startsWith(e) ? n(a) : a.startsWith("src/") || (t[a] = i);
|
|
4065
4081
|
}), t;
|
|
4066
4082
|
};
|
|
4067
|
-
function
|
|
4083
|
+
function $n(r) {
|
|
4068
4084
|
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
|
|
4069
|
-
let
|
|
4070
|
-
for (; (
|
|
4071
|
-
s.push(
|
|
4072
|
-
for (; (
|
|
4073
|
-
s.push(
|
|
4085
|
+
let n;
|
|
4086
|
+
for (; (n = e.exec(r)) !== null; )
|
|
4087
|
+
s.push(n[1]);
|
|
4088
|
+
for (; (n = t.exec(r)) !== null; )
|
|
4089
|
+
s.push(n[1]);
|
|
4074
4090
|
return [...new Set(s)];
|
|
4075
4091
|
}
|
|
4076
|
-
function
|
|
4092
|
+
function Fn(r, e) {
|
|
4077
4093
|
if (!e.startsWith("."))
|
|
4078
4094
|
return e;
|
|
4079
|
-
const t =
|
|
4095
|
+
const t = r.split("/").slice(0, -1), s = e.split("/"), n = [...t];
|
|
4080
4096
|
for (const a of s)
|
|
4081
|
-
a === ".." ?
|
|
4082
|
-
return
|
|
4097
|
+
a === ".." ? n.pop() : a !== "." && n.push(a);
|
|
4098
|
+
return n.join("/");
|
|
4083
4099
|
}
|
|
4084
|
-
function
|
|
4085
|
-
return Object.keys(
|
|
4100
|
+
function Vn(r, e) {
|
|
4101
|
+
return Object.keys(r).filter((t) => t.startsWith(e));
|
|
4086
4102
|
}
|
|
4087
|
-
const
|
|
4103
|
+
const Dn = (r, e) => new ReadableStream({
|
|
4088
4104
|
start(t) {
|
|
4089
|
-
|
|
4105
|
+
r.generateCode(e, (s) => {
|
|
4090
4106
|
s.type === "error" || t.enqueue(s), (s.type === "aborted" || s.type === "error") && t.close();
|
|
4091
4107
|
}).then((s) => {
|
|
4092
4108
|
t.enqueue({
|
|
@@ -4108,26 +4124,26 @@ const Vr = (n, e) => new ReadableStream({
|
|
|
4108
4124
|
}), t.close();
|
|
4109
4125
|
});
|
|
4110
4126
|
}
|
|
4111
|
-
}),
|
|
4112
|
-
var c, u, f,
|
|
4113
|
-
const t =
|
|
4127
|
+
}), Kn = (r, e) => M(void 0, null, function* () {
|
|
4128
|
+
var c, u, f, g, O, C, N;
|
|
4129
|
+
const t = Dn(r, e), [s, n] = t.tee(), a = yield s.getReader().read();
|
|
4114
4130
|
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (u = a.value) == null ? void 0 : u.payload) != null && f.status))
|
|
4115
4131
|
return new Response(JSON.stringify(a.value), {
|
|
4116
|
-
status: ((
|
|
4132
|
+
status: ((g = a.value) == null ? void 0 : g.type) === "error" && (N = (C = (O = a.value) == null ? void 0 : O.payload) == null ? void 0 : C.status) != null ? N : 500,
|
|
4117
4133
|
headers: {
|
|
4118
4134
|
"Content-Type": "application/json"
|
|
4119
4135
|
}
|
|
4120
4136
|
});
|
|
4121
|
-
const i = new TextEncoder(), o =
|
|
4137
|
+
const i = new TextEncoder(), o = n.pipeThrough(
|
|
4122
4138
|
new TransformStream({
|
|
4123
4139
|
transform(R, B) {
|
|
4124
|
-
const
|
|
4140
|
+
const ne = `event: ${R.type}
|
|
4125
4141
|
data: ${JSON.stringify(
|
|
4126
4142
|
R
|
|
4127
4143
|
)}
|
|
4128
4144
|
|
|
4129
4145
|
`;
|
|
4130
|
-
B.enqueue(i.encode(
|
|
4146
|
+
B.enqueue(i.encode(ne));
|
|
4131
4147
|
}
|
|
4132
4148
|
})
|
|
4133
4149
|
);
|
|
@@ -4141,28 +4157,28 @@ data: ${JSON.stringify(
|
|
|
4141
4157
|
});
|
|
4142
4158
|
});
|
|
4143
4159
|
export {
|
|
4144
|
-
|
|
4160
|
+
Bn as Anima,
|
|
4145
4161
|
ue as CodegenError,
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4162
|
+
kr as FigmaTokenIssue,
|
|
4163
|
+
Sr as NotFound,
|
|
4164
|
+
Tr as RateLimitExceeded,
|
|
4165
|
+
Jn as ResponseError,
|
|
4166
|
+
Ar as UnknownFigmaApiException,
|
|
4167
|
+
Kn as createCodegenResponseEventStream,
|
|
4168
|
+
Dn as createCodegenStream,
|
|
4169
|
+
ir as findChildrenNode,
|
|
4170
|
+
Hn as formatToFigmaLink,
|
|
4171
|
+
zn as getFigmaApiErrorType,
|
|
4156
4172
|
Ts as getFigmaFile,
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4173
|
+
Wn as getFileNodes,
|
|
4174
|
+
Gn as getRelatedScreenFiles,
|
|
4175
|
+
Cr as isFigmaTokenIssue,
|
|
4176
|
+
Pn as isNodeCodegenCompatible,
|
|
4177
|
+
Er as isNotFound,
|
|
4178
|
+
Or as isRateLimitExceeded,
|
|
4179
|
+
Un as isUnknownFigmaApiException,
|
|
4180
|
+
qn as isValidFigmaUrl,
|
|
4181
|
+
Mn as validateSettings,
|
|
4182
|
+
er as wrapFigmaApiError
|
|
4167
4183
|
};
|
|
4168
4184
|
//# sourceMappingURL=index.js.map
|