@animaapp/anima-sdk 0.2.0 → 0.2.2
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/.turbo/turbo-build.log +6 -14
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +40 -10
- package/dist/index.js +625 -566
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anima.ts +5 -11
- package/src/dataStream.ts +7 -2
- package/src/figma/figmaError.ts +7 -2
- package/src/figma/utils.ts +4 -4
- package/src/index.ts +0 -1
- package/src/settings.ts +4 -2
- package/src/types.ts +43 -36
- package/src/{utils.ts → utils/figma.ts} +1 -1
- package/src/utils/files.ts +95 -0
- package/src/utils/index.ts +2 -0
- package/src/codegenToAnimaFiles.ts +0 -13
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var fn = Object.defineProperty, hn = Object.defineProperties;
|
|
2
2
|
var pn = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var jt = Object.getOwnPropertySymbols;
|
|
4
4
|
var mn = Object.prototype.hasOwnProperty, yn = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Zt = (n) => {
|
|
6
6
|
throw TypeError(n);
|
|
@@ -8,14 +8,14 @@ var Zt = (n) => {
|
|
|
8
8
|
var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, d = (n, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
10
|
mn.call(e, t) && Rt(n, t, e[t]);
|
|
11
|
-
if (
|
|
12
|
-
for (var t of
|
|
11
|
+
if (jt)
|
|
12
|
+
for (var t of jt(e))
|
|
13
13
|
yn.call(e, t) && Rt(n, t, e[t]);
|
|
14
14
|
return n;
|
|
15
15
|
}, y = (n, e) => hn(n, pn(e));
|
|
16
16
|
var Mt = (n, e, t) => e.has(n) || Zt("Cannot " + t);
|
|
17
|
-
var X = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)),
|
|
18
|
-
var
|
|
17
|
+
var X = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), it = (n, e, t) => e.has(n) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ot = (n, e, t, s) => (Mt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
|
|
18
|
+
var $ = (n, e, t) => new Promise((s, r) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
@@ -31,11 +31,7 @@ var P = (n, e, t) => new Promise((s, r) => {
|
|
|
31
31
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
32
|
o((t = t.apply(n, e)).next());
|
|
33
33
|
});
|
|
34
|
-
|
|
35
|
-
(e, [t, s]) => (e[t] = { content: s.code, isBinary: !1 }, e),
|
|
36
|
-
{}
|
|
37
|
-
);
|
|
38
|
-
class Ee extends Error {
|
|
34
|
+
class Ae extends Error {
|
|
39
35
|
constructor({ name: e, reason: t, status: s }) {
|
|
40
36
|
super(), this.name = `[Codegen Error] ${e}`, this.message = t, this.status = s;
|
|
41
37
|
}
|
|
@@ -76,10 +72,10 @@ var x;
|
|
|
76
72
|
}
|
|
77
73
|
n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
78
74
|
})(x || (x = {}));
|
|
79
|
-
var
|
|
75
|
+
var ft;
|
|
80
76
|
(function(n) {
|
|
81
77
|
n.mergeShapes = (e, t) => d(d({}, e), t);
|
|
82
|
-
})(
|
|
78
|
+
})(ft || (ft = {}));
|
|
83
79
|
const p = x.arrayToEnum([
|
|
84
80
|
"string",
|
|
85
81
|
"nan",
|
|
@@ -139,7 +135,7 @@ const p = x.arrayToEnum([
|
|
|
139
135
|
"invalid_intersection_types",
|
|
140
136
|
"not_multiple_of",
|
|
141
137
|
"not_finite"
|
|
142
|
-
]),
|
|
138
|
+
]), gn = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
143
139
|
class U extends Error {
|
|
144
140
|
get errors() {
|
|
145
141
|
return this.issues;
|
|
@@ -257,13 +253,13 @@ const ke = (n, e) => {
|
|
|
257
253
|
return { message: t };
|
|
258
254
|
};
|
|
259
255
|
let qt = ke;
|
|
260
|
-
function
|
|
256
|
+
function vn(n) {
|
|
261
257
|
qt = n;
|
|
262
258
|
}
|
|
263
|
-
function
|
|
259
|
+
function Ye() {
|
|
264
260
|
return qt;
|
|
265
261
|
}
|
|
266
|
-
const
|
|
262
|
+
const Qe = (n) => {
|
|
267
263
|
const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = y(d({}, r), {
|
|
268
264
|
path: a
|
|
269
265
|
});
|
|
@@ -280,9 +276,9 @@ const et = (n) => {
|
|
|
280
276
|
path: a,
|
|
281
277
|
message: o
|
|
282
278
|
});
|
|
283
|
-
},
|
|
284
|
-
function
|
|
285
|
-
const t =
|
|
279
|
+
}, _n = [];
|
|
280
|
+
function h(n, e) {
|
|
281
|
+
const t = Ye(), s = Qe({
|
|
286
282
|
issueData: e,
|
|
287
283
|
data: n.data,
|
|
288
284
|
path: n.path,
|
|
@@ -299,7 +295,7 @@ function f(n, e) {
|
|
|
299
295
|
});
|
|
300
296
|
n.common.issues.push(s);
|
|
301
297
|
}
|
|
302
|
-
class
|
|
298
|
+
class j {
|
|
303
299
|
constructor() {
|
|
304
300
|
this.value = "valid";
|
|
305
301
|
}
|
|
@@ -319,7 +315,7 @@ class I {
|
|
|
319
315
|
return { status: e.value, value: s };
|
|
320
316
|
}
|
|
321
317
|
static mergeObjectAsync(e, t) {
|
|
322
|
-
return
|
|
318
|
+
return $(this, null, function* () {
|
|
323
319
|
const s = [];
|
|
324
320
|
for (const r of t) {
|
|
325
321
|
const a = yield r.key, i = yield r.value;
|
|
@@ -328,7 +324,7 @@ class I {
|
|
|
328
324
|
value: i
|
|
329
325
|
});
|
|
330
326
|
}
|
|
331
|
-
return
|
|
327
|
+
return j.mergeObjectSync(e, s);
|
|
332
328
|
});
|
|
333
329
|
}
|
|
334
330
|
static mergeObjectSync(e, t) {
|
|
@@ -344,8 +340,8 @@ class I {
|
|
|
344
340
|
}
|
|
345
341
|
const v = Object.freeze({
|
|
346
342
|
status: "aborted"
|
|
347
|
-
}), we = (n) => ({ status: "dirty", value: n }), M = (n) => ({ status: "valid", value: n }),
|
|
348
|
-
function
|
|
343
|
+
}), we = (n) => ({ status: "dirty", value: n }), M = (n) => ({ status: "valid", value: n }), ht = (n) => n.status === "aborted", pt = (n) => n.status === "dirty", ge = (n) => n.status === "valid", Ze = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
344
|
+
function et(n, e, t, s) {
|
|
349
345
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
350
346
|
return e.get(n);
|
|
351
347
|
}
|
|
@@ -357,7 +353,7 @@ var m;
|
|
|
357
353
|
(function(n) {
|
|
358
354
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
359
355
|
})(m || (m = {}));
|
|
360
|
-
var Ce,
|
|
356
|
+
var Ce, Ie;
|
|
361
357
|
class ne {
|
|
362
358
|
constructor(e, t, s, r) {
|
|
363
359
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
|
|
@@ -366,7 +362,7 @@ class ne {
|
|
|
366
362
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
367
363
|
}
|
|
368
364
|
}
|
|
369
|
-
const
|
|
365
|
+
const $t = (n, e) => {
|
|
370
366
|
if (ge(e))
|
|
371
367
|
return { success: !0, data: e.value };
|
|
372
368
|
if (!n.common.issues.length)
|
|
@@ -389,8 +385,8 @@ function b(n) {
|
|
|
389
385
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
390
386
|
return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
|
|
391
387
|
var c, u;
|
|
392
|
-
const { message:
|
|
393
|
-
return i.code === "invalid_enum_value" ? { message:
|
|
388
|
+
const { message: f } = n;
|
|
389
|
+
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 };
|
|
394
390
|
}, description: r };
|
|
395
391
|
}
|
|
396
392
|
class w {
|
|
@@ -412,7 +408,7 @@ class w {
|
|
|
412
408
|
}
|
|
413
409
|
_processInputParams(e) {
|
|
414
410
|
return {
|
|
415
|
-
status: new
|
|
411
|
+
status: new j(),
|
|
416
412
|
ctx: {
|
|
417
413
|
common: e.parent.common,
|
|
418
414
|
data: e.data,
|
|
@@ -453,7 +449,7 @@ class w {
|
|
|
453
449
|
data: e,
|
|
454
450
|
parsedType: oe(e)
|
|
455
451
|
}, a = this._parseSync({ data: e, path: r.path, parent: r });
|
|
456
|
-
return
|
|
452
|
+
return $t(r, a);
|
|
457
453
|
}
|
|
458
454
|
"~validate"(e) {
|
|
459
455
|
var t, s;
|
|
@@ -489,7 +485,7 @@ class w {
|
|
|
489
485
|
});
|
|
490
486
|
}
|
|
491
487
|
parseAsync(e, t) {
|
|
492
|
-
return
|
|
488
|
+
return $(this, null, function* () {
|
|
493
489
|
const s = yield this.safeParseAsync(e, t);
|
|
494
490
|
if (s.success)
|
|
495
491
|
return s.data;
|
|
@@ -497,7 +493,7 @@ class w {
|
|
|
497
493
|
});
|
|
498
494
|
}
|
|
499
495
|
safeParseAsync(e, t) {
|
|
500
|
-
return
|
|
496
|
+
return $(this, null, function* () {
|
|
501
497
|
const s = {
|
|
502
498
|
common: {
|
|
503
499
|
issues: [],
|
|
@@ -510,7 +506,7 @@ class w {
|
|
|
510
506
|
data: e,
|
|
511
507
|
parsedType: oe(e)
|
|
512
508
|
}, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Ze(r) ? r : Promise.resolve(r);
|
|
513
|
-
return
|
|
509
|
+
return $t(s, a);
|
|
514
510
|
});
|
|
515
511
|
}
|
|
516
512
|
refine(e, t) {
|
|
@@ -558,10 +554,10 @@ class w {
|
|
|
558
554
|
return Se.create(this, this._def);
|
|
559
555
|
}
|
|
560
556
|
or(e) {
|
|
561
|
-
return
|
|
557
|
+
return Fe.create([this, e], this._def);
|
|
562
558
|
}
|
|
563
559
|
and(e) {
|
|
564
|
-
return
|
|
560
|
+
return Le.create(this, e, this._def);
|
|
565
561
|
}
|
|
566
562
|
transform(e) {
|
|
567
563
|
return new G(y(d({}, b(this._def)), {
|
|
@@ -572,21 +568,21 @@ class w {
|
|
|
572
568
|
}
|
|
573
569
|
default(e) {
|
|
574
570
|
const t = typeof e == "function" ? e : () => e;
|
|
575
|
-
return new
|
|
571
|
+
return new We(y(d({}, b(this._def)), {
|
|
576
572
|
innerType: this,
|
|
577
573
|
defaultValue: t,
|
|
578
574
|
typeName: g.ZodDefault
|
|
579
575
|
}));
|
|
580
576
|
}
|
|
581
577
|
brand() {
|
|
582
|
-
return new
|
|
578
|
+
return new St(d({
|
|
583
579
|
typeName: g.ZodBranded,
|
|
584
580
|
type: this
|
|
585
581
|
}, b(this._def)));
|
|
586
582
|
}
|
|
587
583
|
catch(e) {
|
|
588
584
|
const t = typeof e == "function" ? e : () => e;
|
|
589
|
-
return new
|
|
585
|
+
return new Be(y(d({}, b(this._def)), {
|
|
590
586
|
innerType: this,
|
|
591
587
|
catchValue: t,
|
|
592
588
|
typeName: g.ZodCatch
|
|
@@ -611,9 +607,9 @@ class w {
|
|
|
611
607
|
return this.safeParse(null).success;
|
|
612
608
|
}
|
|
613
609
|
}
|
|
614
|
-
const
|
|
615
|
-
let
|
|
616
|
-
const
|
|
610
|
+
const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[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, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, En = /^[-+]?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)?)??$/, An = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
611
|
+
let ct;
|
|
612
|
+
const Cn = /^(?:(?: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])$/, In = /^(?:(?: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])$/, Nn = /^(([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]))$/, jn = /^(([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])$/, Rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\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])))", Mn = new RegExp(`^${Jt}$`);
|
|
617
613
|
function Gt(n) {
|
|
618
614
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
619
615
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
@@ -626,11 +622,11 @@ function Kt(n) {
|
|
|
626
622
|
const t = [];
|
|
627
623
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
628
624
|
}
|
|
629
|
-
function
|
|
630
|
-
return !!((e === "v4" || !e) &&
|
|
625
|
+
function Pn(n, e) {
|
|
626
|
+
return !!((e === "v4" || !e) && Cn.test(n) || (e === "v6" || !e) && Nn.test(n));
|
|
631
627
|
}
|
|
632
628
|
function Fn(n, e) {
|
|
633
|
-
if (!
|
|
629
|
+
if (!Sn.test(n))
|
|
634
630
|
return !1;
|
|
635
631
|
try {
|
|
636
632
|
const [t] = n.split("."), s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(s));
|
|
@@ -639,24 +635,24 @@ function Fn(n, e) {
|
|
|
639
635
|
return !1;
|
|
640
636
|
}
|
|
641
637
|
}
|
|
642
|
-
function
|
|
643
|
-
return !!((e === "v4" || !e) &&
|
|
638
|
+
function Ln(n, e) {
|
|
639
|
+
return !!((e === "v4" || !e) && In.test(n) || (e === "v6" || !e) && jn.test(n));
|
|
644
640
|
}
|
|
645
641
|
class H extends w {
|
|
646
642
|
_parse(e) {
|
|
647
643
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
648
644
|
const a = this._getOrReturnCtx(e);
|
|
649
|
-
return
|
|
645
|
+
return h(a, {
|
|
650
646
|
code: l.invalid_type,
|
|
651
647
|
expected: p.string,
|
|
652
648
|
received: a.parsedType
|
|
653
649
|
}), v;
|
|
654
650
|
}
|
|
655
|
-
const s = new
|
|
651
|
+
const s = new j();
|
|
656
652
|
let r;
|
|
657
653
|
for (const a of this._def.checks)
|
|
658
654
|
if (a.kind === "min")
|
|
659
|
-
e.data.length < a.value && (r = this._getOrReturnCtx(e, r),
|
|
655
|
+
e.data.length < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
660
656
|
code: l.too_small,
|
|
661
657
|
minimum: a.value,
|
|
662
658
|
type: "string",
|
|
@@ -665,7 +661,7 @@ class H extends w {
|
|
|
665
661
|
message: a.message
|
|
666
662
|
}), s.dirty());
|
|
667
663
|
else if (a.kind === "max")
|
|
668
|
-
e.data.length > a.value && (r = this._getOrReturnCtx(e, r),
|
|
664
|
+
e.data.length > a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
669
665
|
code: l.too_big,
|
|
670
666
|
maximum: a.value,
|
|
671
667
|
type: "string",
|
|
@@ -675,14 +671,14 @@ class H extends w {
|
|
|
675
671
|
}), s.dirty());
|
|
676
672
|
else if (a.kind === "length") {
|
|
677
673
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
678
|
-
(i || o) && (r = this._getOrReturnCtx(e, r), i ?
|
|
674
|
+
(i || o) && (r = this._getOrReturnCtx(e, r), i ? h(r, {
|
|
679
675
|
code: l.too_big,
|
|
680
676
|
maximum: a.value,
|
|
681
677
|
type: "string",
|
|
682
678
|
inclusive: !0,
|
|
683
679
|
exact: !0,
|
|
684
680
|
message: a.message
|
|
685
|
-
}) : o &&
|
|
681
|
+
}) : o && h(r, {
|
|
686
682
|
code: l.too_small,
|
|
687
683
|
minimum: a.value,
|
|
688
684
|
type: "string",
|
|
@@ -691,43 +687,43 @@ class H extends w {
|
|
|
691
687
|
message: a.message
|
|
692
688
|
}), s.dirty());
|
|
693
689
|
} else if (a.kind === "email")
|
|
694
|
-
|
|
690
|
+
An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
695
691
|
validation: "email",
|
|
696
692
|
code: l.invalid_string,
|
|
697
693
|
message: a.message
|
|
698
694
|
}), s.dirty());
|
|
699
695
|
else if (a.kind === "emoji")
|
|
700
|
-
|
|
696
|
+
ct || (ct = new RegExp(On, "u")), ct.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
701
697
|
validation: "emoji",
|
|
702
698
|
code: l.invalid_string,
|
|
703
699
|
message: a.message
|
|
704
700
|
}), s.dirty());
|
|
705
701
|
else if (a.kind === "uuid")
|
|
706
|
-
|
|
702
|
+
kn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
707
703
|
validation: "uuid",
|
|
708
704
|
code: l.invalid_string,
|
|
709
705
|
message: a.message
|
|
710
706
|
}), s.dirty());
|
|
711
707
|
else if (a.kind === "nanoid")
|
|
712
|
-
|
|
708
|
+
Tn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
713
709
|
validation: "nanoid",
|
|
714
710
|
code: l.invalid_string,
|
|
715
711
|
message: a.message
|
|
716
712
|
}), s.dirty());
|
|
717
713
|
else if (a.kind === "cuid")
|
|
718
|
-
|
|
714
|
+
bn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
719
715
|
validation: "cuid",
|
|
720
716
|
code: l.invalid_string,
|
|
721
717
|
message: a.message
|
|
722
718
|
}), s.dirty());
|
|
723
719
|
else if (a.kind === "cuid2")
|
|
724
|
-
|
|
720
|
+
wn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
725
721
|
validation: "cuid2",
|
|
726
722
|
code: l.invalid_string,
|
|
727
723
|
message: a.message
|
|
728
724
|
}), s.dirty());
|
|
729
725
|
else if (a.kind === "ulid")
|
|
730
|
-
|
|
726
|
+
xn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
731
727
|
validation: "ulid",
|
|
732
728
|
code: l.invalid_string,
|
|
733
729
|
message: a.message
|
|
@@ -736,61 +732,61 @@ class H extends w {
|
|
|
736
732
|
try {
|
|
737
733
|
new URL(e.data);
|
|
738
734
|
} catch (i) {
|
|
739
|
-
r = this._getOrReturnCtx(e, r),
|
|
735
|
+
r = this._getOrReturnCtx(e, r), h(r, {
|
|
740
736
|
validation: "url",
|
|
741
737
|
code: l.invalid_string,
|
|
742
738
|
message: a.message
|
|
743
739
|
}), s.dirty();
|
|
744
740
|
}
|
|
745
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
741
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
746
742
|
validation: "regex",
|
|
747
743
|
code: l.invalid_string,
|
|
748
744
|
message: a.message
|
|
749
|
-
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r),
|
|
745
|
+
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
750
746
|
code: l.invalid_string,
|
|
751
747
|
validation: { includes: a.value, position: a.position },
|
|
752
748
|
message: a.message
|
|
753
|
-
}), 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) || (r = this._getOrReturnCtx(e, r),
|
|
749
|
+
}), 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) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
754
750
|
code: l.invalid_string,
|
|
755
751
|
validation: { startsWith: a.value },
|
|
756
752
|
message: a.message
|
|
757
|
-
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r),
|
|
753
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
758
754
|
code: l.invalid_string,
|
|
759
755
|
validation: { endsWith: a.value },
|
|
760
756
|
message: a.message
|
|
761
|
-
}), s.dirty()) : a.kind === "datetime" ? Kt(a).test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
757
|
+
}), s.dirty()) : a.kind === "datetime" ? Kt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
762
758
|
code: l.invalid_string,
|
|
763
759
|
validation: "datetime",
|
|
764
760
|
message: a.message
|
|
765
|
-
}), s.dirty()) : a.kind === "date" ?
|
|
761
|
+
}), s.dirty()) : a.kind === "date" ? Mn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
766
762
|
code: l.invalid_string,
|
|
767
763
|
validation: "date",
|
|
768
764
|
message: a.message
|
|
769
|
-
}), s.dirty()) : a.kind === "time" ? $n(a).test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
765
|
+
}), s.dirty()) : a.kind === "time" ? $n(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
770
766
|
code: l.invalid_string,
|
|
771
767
|
validation: "time",
|
|
772
768
|
message: a.message
|
|
773
|
-
}), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
769
|
+
}), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
774
770
|
validation: "duration",
|
|
775
771
|
code: l.invalid_string,
|
|
776
772
|
message: a.message
|
|
777
|
-
}), s.dirty()) : a.kind === "ip" ?
|
|
773
|
+
}), s.dirty()) : a.kind === "ip" ? Pn(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
778
774
|
validation: "ip",
|
|
779
775
|
code: l.invalid_string,
|
|
780
776
|
message: a.message
|
|
781
|
-
}), s.dirty()) : a.kind === "jwt" ? Fn(e.data, a.alg) || (r = this._getOrReturnCtx(e, r),
|
|
777
|
+
}), s.dirty()) : a.kind === "jwt" ? Fn(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
782
778
|
validation: "jwt",
|
|
783
779
|
code: l.invalid_string,
|
|
784
780
|
message: a.message
|
|
785
|
-
}), s.dirty()) : a.kind === "cidr" ?
|
|
781
|
+
}), s.dirty()) : a.kind === "cidr" ? Ln(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
786
782
|
validation: "cidr",
|
|
787
783
|
code: l.invalid_string,
|
|
788
784
|
message: a.message
|
|
789
|
-
}), s.dirty()) : a.kind === "base64" ?
|
|
785
|
+
}), s.dirty()) : a.kind === "base64" ? Rn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
790
786
|
validation: "base64",
|
|
791
787
|
code: l.invalid_string,
|
|
792
788
|
message: a.message
|
|
793
|
-
}), s.dirty()) : a.kind === "base64url" ?
|
|
789
|
+
}), s.dirty()) : a.kind === "base64url" ? Zn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
794
790
|
validation: "base64url",
|
|
795
791
|
code: l.invalid_string,
|
|
796
792
|
message: a.message
|
|
@@ -1013,7 +1009,7 @@ H.create = (n) => {
|
|
|
1013
1009
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
|
|
1014
1010
|
}, b(n)));
|
|
1015
1011
|
};
|
|
1016
|
-
function
|
|
1012
|
+
function Dn(n, e) {
|
|
1017
1013
|
const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = parseInt(n.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
|
|
1018
1014
|
return a % i / Math.pow(10, r);
|
|
1019
1015
|
}
|
|
@@ -1024,39 +1020,39 @@ class ue extends w {
|
|
|
1024
1020
|
_parse(e) {
|
|
1025
1021
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
|
|
1026
1022
|
const a = this._getOrReturnCtx(e);
|
|
1027
|
-
return
|
|
1023
|
+
return h(a, {
|
|
1028
1024
|
code: l.invalid_type,
|
|
1029
1025
|
expected: p.number,
|
|
1030
1026
|
received: a.parsedType
|
|
1031
1027
|
}), v;
|
|
1032
1028
|
}
|
|
1033
1029
|
let s;
|
|
1034
|
-
const r = new
|
|
1030
|
+
const r = new j();
|
|
1035
1031
|
for (const a of this._def.checks)
|
|
1036
|
-
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1032
|
+
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1037
1033
|
code: l.invalid_type,
|
|
1038
1034
|
expected: "integer",
|
|
1039
1035
|
received: "float",
|
|
1040
1036
|
message: a.message
|
|
1041
|
-
}), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1037
|
+
}), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1042
1038
|
code: l.too_small,
|
|
1043
1039
|
minimum: a.value,
|
|
1044
1040
|
type: "number",
|
|
1045
1041
|
inclusive: a.inclusive,
|
|
1046
1042
|
exact: !1,
|
|
1047
1043
|
message: a.message
|
|
1048
|
-
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1044
|
+
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1049
1045
|
code: l.too_big,
|
|
1050
1046
|
maximum: a.value,
|
|
1051
1047
|
type: "number",
|
|
1052
1048
|
inclusive: a.inclusive,
|
|
1053
1049
|
exact: !1,
|
|
1054
1050
|
message: a.message
|
|
1055
|
-
}), r.dirty()) : a.kind === "multipleOf" ?
|
|
1051
|
+
}), r.dirty()) : a.kind === "multipleOf" ? Dn(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1056
1052
|
code: l.not_multiple_of,
|
|
1057
1053
|
multipleOf: a.value,
|
|
1058
1054
|
message: a.message
|
|
1059
|
-
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1055
|
+
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1060
1056
|
code: l.not_finite,
|
|
1061
1057
|
message: a.message
|
|
1062
1058
|
}), r.dirty()) : x.assertNever(a);
|
|
@@ -1200,21 +1196,21 @@ class le extends w {
|
|
|
1200
1196
|
if (this._getType(e) !== p.bigint)
|
|
1201
1197
|
return this._getInvalidInput(e);
|
|
1202
1198
|
let s;
|
|
1203
|
-
const r = new
|
|
1199
|
+
const r = new j();
|
|
1204
1200
|
for (const a of this._def.checks)
|
|
1205
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1201
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1206
1202
|
code: l.too_small,
|
|
1207
1203
|
type: "bigint",
|
|
1208
1204
|
minimum: a.value,
|
|
1209
1205
|
inclusive: a.inclusive,
|
|
1210
1206
|
message: a.message
|
|
1211
|
-
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1207
|
+
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1212
1208
|
code: l.too_big,
|
|
1213
1209
|
type: "bigint",
|
|
1214
1210
|
maximum: a.value,
|
|
1215
1211
|
inclusive: a.inclusive,
|
|
1216
1212
|
message: a.message
|
|
1217
|
-
}), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s),
|
|
1213
|
+
}), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1218
1214
|
code: l.not_multiple_of,
|
|
1219
1215
|
multipleOf: a.value,
|
|
1220
1216
|
message: a.message
|
|
@@ -1223,7 +1219,7 @@ class le extends w {
|
|
|
1223
1219
|
}
|
|
1224
1220
|
_getInvalidInput(e) {
|
|
1225
1221
|
const t = this._getOrReturnCtx(e);
|
|
1226
|
-
return
|
|
1222
|
+
return h(t, {
|
|
1227
1223
|
code: l.invalid_type,
|
|
1228
1224
|
expected: p.bigint,
|
|
1229
1225
|
received: t.parsedType
|
|
@@ -1323,7 +1319,7 @@ class Me extends w {
|
|
|
1323
1319
|
_parse(e) {
|
|
1324
1320
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1325
1321
|
const s = this._getOrReturnCtx(e);
|
|
1326
|
-
return
|
|
1322
|
+
return h(s, {
|
|
1327
1323
|
code: l.invalid_type,
|
|
1328
1324
|
expected: p.boolean,
|
|
1329
1325
|
received: s.parsedType
|
|
@@ -1340,7 +1336,7 @@ class ve extends w {
|
|
|
1340
1336
|
_parse(e) {
|
|
1341
1337
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1342
1338
|
const a = this._getOrReturnCtx(e);
|
|
1343
|
-
return
|
|
1339
|
+
return h(a, {
|
|
1344
1340
|
code: l.invalid_type,
|
|
1345
1341
|
expected: p.date,
|
|
1346
1342
|
received: a.parsedType
|
|
@@ -1348,21 +1344,21 @@ class ve extends w {
|
|
|
1348
1344
|
}
|
|
1349
1345
|
if (isNaN(e.data.getTime())) {
|
|
1350
1346
|
const a = this._getOrReturnCtx(e);
|
|
1351
|
-
return
|
|
1347
|
+
return h(a, {
|
|
1352
1348
|
code: l.invalid_date
|
|
1353
1349
|
}), v;
|
|
1354
1350
|
}
|
|
1355
|
-
const s = new
|
|
1351
|
+
const s = new j();
|
|
1356
1352
|
let r;
|
|
1357
1353
|
for (const a of this._def.checks)
|
|
1358
|
-
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r),
|
|
1354
|
+
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1359
1355
|
code: l.too_small,
|
|
1360
1356
|
message: a.message,
|
|
1361
1357
|
inclusive: !0,
|
|
1362
1358
|
exact: !1,
|
|
1363
1359
|
minimum: a.value,
|
|
1364
1360
|
type: "date"
|
|
1365
|
-
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r),
|
|
1361
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1366
1362
|
code: l.too_big,
|
|
1367
1363
|
message: a.message,
|
|
1368
1364
|
inclusive: !0,
|
|
@@ -1412,11 +1408,11 @@ ve.create = (n) => new ve(d({
|
|
|
1412
1408
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1413
1409
|
typeName: g.ZodDate
|
|
1414
1410
|
}, b(n)));
|
|
1415
|
-
class
|
|
1411
|
+
class tt extends w {
|
|
1416
1412
|
_parse(e) {
|
|
1417
1413
|
if (this._getType(e) !== p.symbol) {
|
|
1418
1414
|
const s = this._getOrReturnCtx(e);
|
|
1419
|
-
return
|
|
1415
|
+
return h(s, {
|
|
1420
1416
|
code: l.invalid_type,
|
|
1421
1417
|
expected: p.symbol,
|
|
1422
1418
|
received: s.parsedType
|
|
@@ -1425,14 +1421,14 @@ class nt extends w {
|
|
|
1425
1421
|
return M(e.data);
|
|
1426
1422
|
}
|
|
1427
1423
|
}
|
|
1428
|
-
|
|
1424
|
+
tt.create = (n) => new tt(d({
|
|
1429
1425
|
typeName: g.ZodSymbol
|
|
1430
1426
|
}, b(n)));
|
|
1431
|
-
class
|
|
1427
|
+
class $e extends w {
|
|
1432
1428
|
_parse(e) {
|
|
1433
1429
|
if (this._getType(e) !== p.undefined) {
|
|
1434
1430
|
const s = this._getOrReturnCtx(e);
|
|
1435
|
-
return
|
|
1431
|
+
return h(s, {
|
|
1436
1432
|
code: l.invalid_type,
|
|
1437
1433
|
expected: p.undefined,
|
|
1438
1434
|
received: s.parsedType
|
|
@@ -1441,14 +1437,14 @@ class Pe extends w {
|
|
|
1441
1437
|
return M(e.data);
|
|
1442
1438
|
}
|
|
1443
1439
|
}
|
|
1444
|
-
|
|
1440
|
+
$e.create = (n) => new $e(d({
|
|
1445
1441
|
typeName: g.ZodUndefined
|
|
1446
1442
|
}, b(n)));
|
|
1447
|
-
class
|
|
1443
|
+
class Pe extends w {
|
|
1448
1444
|
_parse(e) {
|
|
1449
1445
|
if (this._getType(e) !== p.null) {
|
|
1450
1446
|
const s = this._getOrReturnCtx(e);
|
|
1451
|
-
return
|
|
1447
|
+
return h(s, {
|
|
1452
1448
|
code: l.invalid_type,
|
|
1453
1449
|
expected: p.null,
|
|
1454
1450
|
received: s.parsedType
|
|
@@ -1457,7 +1453,7 @@ class $e extends w {
|
|
|
1457
1453
|
return M(e.data);
|
|
1458
1454
|
}
|
|
1459
1455
|
}
|
|
1460
|
-
|
|
1456
|
+
Pe.create = (n) => new Pe(d({
|
|
1461
1457
|
typeName: g.ZodNull
|
|
1462
1458
|
}, b(n)));
|
|
1463
1459
|
class Te extends w {
|
|
@@ -1485,7 +1481,7 @@ ye.create = (n) => new ye(d({
|
|
|
1485
1481
|
class ce extends w {
|
|
1486
1482
|
_parse(e) {
|
|
1487
1483
|
const t = this._getOrReturnCtx(e);
|
|
1488
|
-
return
|
|
1484
|
+
return h(t, {
|
|
1489
1485
|
code: l.invalid_type,
|
|
1490
1486
|
expected: p.never,
|
|
1491
1487
|
received: t.parsedType
|
|
@@ -1495,11 +1491,11 @@ class ce extends w {
|
|
|
1495
1491
|
ce.create = (n) => new ce(d({
|
|
1496
1492
|
typeName: g.ZodNever
|
|
1497
1493
|
}, b(n)));
|
|
1498
|
-
class
|
|
1494
|
+
class nt extends w {
|
|
1499
1495
|
_parse(e) {
|
|
1500
1496
|
if (this._getType(e) !== p.undefined) {
|
|
1501
1497
|
const s = this._getOrReturnCtx(e);
|
|
1502
|
-
return
|
|
1498
|
+
return h(s, {
|
|
1503
1499
|
code: l.invalid_type,
|
|
1504
1500
|
expected: p.void,
|
|
1505
1501
|
received: s.parsedType
|
|
@@ -1508,21 +1504,21 @@ class st extends w {
|
|
|
1508
1504
|
return M(e.data);
|
|
1509
1505
|
}
|
|
1510
1506
|
}
|
|
1511
|
-
|
|
1507
|
+
nt.create = (n) => new nt(d({
|
|
1512
1508
|
typeName: g.ZodVoid
|
|
1513
1509
|
}, b(n)));
|
|
1514
1510
|
class J extends w {
|
|
1515
1511
|
_parse(e) {
|
|
1516
1512
|
const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
|
|
1517
1513
|
if (t.parsedType !== p.array)
|
|
1518
|
-
return
|
|
1514
|
+
return h(t, {
|
|
1519
1515
|
code: l.invalid_type,
|
|
1520
1516
|
expected: p.array,
|
|
1521
1517
|
received: t.parsedType
|
|
1522
1518
|
}), v;
|
|
1523
1519
|
if (r.exactLength !== null) {
|
|
1524
1520
|
const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
|
|
1525
|
-
(i || o) && (
|
|
1521
|
+
(i || o) && (h(t, {
|
|
1526
1522
|
code: i ? l.too_big : l.too_small,
|
|
1527
1523
|
minimum: o ? r.exactLength.value : void 0,
|
|
1528
1524
|
maximum: i ? r.exactLength.value : void 0,
|
|
@@ -1532,14 +1528,14 @@ class J extends w {
|
|
|
1532
1528
|
message: r.exactLength.message
|
|
1533
1529
|
}), s.dirty());
|
|
1534
1530
|
}
|
|
1535
|
-
if (r.minLength !== null && t.data.length < r.minLength.value && (
|
|
1531
|
+
if (r.minLength !== null && t.data.length < r.minLength.value && (h(t, {
|
|
1536
1532
|
code: l.too_small,
|
|
1537
1533
|
minimum: r.minLength.value,
|
|
1538
1534
|
type: "array",
|
|
1539
1535
|
inclusive: !0,
|
|
1540
1536
|
exact: !1,
|
|
1541
1537
|
message: r.minLength.message
|
|
1542
|
-
}), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (
|
|
1538
|
+
}), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (h(t, {
|
|
1543
1539
|
code: l.too_big,
|
|
1544
1540
|
maximum: r.maxLength.value,
|
|
1545
1541
|
type: "array",
|
|
@@ -1547,9 +1543,9 @@ class J extends w {
|
|
|
1547
1543
|
exact: !1,
|
|
1548
1544
|
message: r.maxLength.message
|
|
1549
1545
|
}), s.dirty()), t.common.async)
|
|
1550
|
-
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new ne(t, i, t.path, o)))).then((i) =>
|
|
1546
|
+
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new ne(t, i, t.path, o)))).then((i) => j.mergeArray(s, i));
|
|
1551
1547
|
const a = [...t.data].map((i, o) => r.type._parseSync(new ne(t, i, t.path, o)));
|
|
1552
|
-
return
|
|
1548
|
+
return j.mergeArray(s, a);
|
|
1553
1549
|
}
|
|
1554
1550
|
get element() {
|
|
1555
1551
|
return this._def.type;
|
|
@@ -1607,7 +1603,7 @@ class S extends w {
|
|
|
1607
1603
|
_parse(e) {
|
|
1608
1604
|
if (this._getType(e) !== p.object) {
|
|
1609
1605
|
const u = this._getOrReturnCtx(e);
|
|
1610
|
-
return
|
|
1606
|
+
return h(u, {
|
|
1611
1607
|
code: l.invalid_type,
|
|
1612
1608
|
expected: p.object,
|
|
1613
1609
|
received: u.parsedType
|
|
@@ -1619,53 +1615,53 @@ class S extends w {
|
|
|
1619
1615
|
i.includes(u) || o.push(u);
|
|
1620
1616
|
const c = [];
|
|
1621
1617
|
for (const u of i) {
|
|
1622
|
-
const
|
|
1618
|
+
const f = a[u], _ = r.data[u];
|
|
1623
1619
|
c.push({
|
|
1624
1620
|
key: { status: "valid", value: u },
|
|
1625
|
-
value:
|
|
1621
|
+
value: f._parse(new ne(r, _, r.path, u)),
|
|
1626
1622
|
alwaysSet: u in r.data
|
|
1627
1623
|
});
|
|
1628
1624
|
}
|
|
1629
1625
|
if (this._def.catchall instanceof ce) {
|
|
1630
1626
|
const u = this._def.unknownKeys;
|
|
1631
1627
|
if (u === "passthrough")
|
|
1632
|
-
for (const
|
|
1628
|
+
for (const f of o)
|
|
1633
1629
|
c.push({
|
|
1634
|
-
key: { status: "valid", value:
|
|
1635
|
-
value: { status: "valid", value: r.data[
|
|
1630
|
+
key: { status: "valid", value: f },
|
|
1631
|
+
value: { status: "valid", value: r.data[f] }
|
|
1636
1632
|
});
|
|
1637
1633
|
else if (u === "strict")
|
|
1638
|
-
o.length > 0 && (
|
|
1634
|
+
o.length > 0 && (h(r, {
|
|
1639
1635
|
code: l.unrecognized_keys,
|
|
1640
1636
|
keys: o
|
|
1641
1637
|
}), s.dirty());
|
|
1642
1638
|
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1643
1639
|
} else {
|
|
1644
1640
|
const u = this._def.catchall;
|
|
1645
|
-
for (const
|
|
1646
|
-
const _ = r.data[
|
|
1641
|
+
for (const f of o) {
|
|
1642
|
+
const _ = r.data[f];
|
|
1647
1643
|
c.push({
|
|
1648
|
-
key: { status: "valid", value:
|
|
1644
|
+
key: { status: "valid", value: f },
|
|
1649
1645
|
value: u._parse(
|
|
1650
|
-
new ne(r, _, r.path,
|
|
1646
|
+
new ne(r, _, r.path, f)
|
|
1651
1647
|
//, ctx.child(key), value, getParsedType(value)
|
|
1652
1648
|
),
|
|
1653
|
-
alwaysSet:
|
|
1649
|
+
alwaysSet: f in r.data
|
|
1654
1650
|
});
|
|
1655
1651
|
}
|
|
1656
1652
|
}
|
|
1657
|
-
return r.common.async ? Promise.resolve().then(() =>
|
|
1653
|
+
return r.common.async ? Promise.resolve().then(() => $(this, null, function* () {
|
|
1658
1654
|
const u = [];
|
|
1659
|
-
for (const
|
|
1660
|
-
const _ = yield
|
|
1655
|
+
for (const f of c) {
|
|
1656
|
+
const _ = yield f.key, C = yield f.value;
|
|
1661
1657
|
u.push({
|
|
1662
1658
|
key: _,
|
|
1663
|
-
value:
|
|
1664
|
-
alwaysSet:
|
|
1659
|
+
value: C,
|
|
1660
|
+
alwaysSet: f.alwaysSet
|
|
1665
1661
|
});
|
|
1666
1662
|
}
|
|
1667
1663
|
return u;
|
|
1668
|
-
})).then((u) =>
|
|
1664
|
+
})).then((u) => j.mergeObjectSync(s, u)) : j.mergeObjectSync(s, c);
|
|
1669
1665
|
}
|
|
1670
1666
|
get shape() {
|
|
1671
1667
|
return this._def.shape();
|
|
@@ -1862,7 +1858,7 @@ S.lazycreate = (n, e) => new S(d({
|
|
|
1862
1858
|
catchall: ce.create(),
|
|
1863
1859
|
typeName: g.ZodObject
|
|
1864
1860
|
}, b(e)));
|
|
1865
|
-
class
|
|
1861
|
+
class Fe extends w {
|
|
1866
1862
|
_parse(e) {
|
|
1867
1863
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1868
1864
|
function r(a) {
|
|
@@ -1873,13 +1869,13 @@ class Le extends w {
|
|
|
1873
1869
|
if (o.result.status === "dirty")
|
|
1874
1870
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1875
1871
|
const i = a.map((o) => new U(o.ctx.common.issues));
|
|
1876
|
-
return
|
|
1872
|
+
return h(t, {
|
|
1877
1873
|
code: l.invalid_union,
|
|
1878
1874
|
unionErrors: i
|
|
1879
1875
|
}), v;
|
|
1880
1876
|
}
|
|
1881
1877
|
if (t.common.async)
|
|
1882
|
-
return Promise.all(s.map((a) =>
|
|
1878
|
+
return Promise.all(s.map((a) => $(this, null, function* () {
|
|
1883
1879
|
const i = y(d({}, t), {
|
|
1884
1880
|
common: y(d({}, t.common), {
|
|
1885
1881
|
issues: []
|
|
@@ -1904,19 +1900,19 @@ class Le extends w {
|
|
|
1904
1900
|
issues: []
|
|
1905
1901
|
}),
|
|
1906
1902
|
parent: null
|
|
1907
|
-
}),
|
|
1903
|
+
}), f = c._parseSync({
|
|
1908
1904
|
data: t.data,
|
|
1909
1905
|
path: t.path,
|
|
1910
1906
|
parent: u
|
|
1911
1907
|
});
|
|
1912
|
-
if (
|
|
1913
|
-
return
|
|
1914
|
-
|
|
1908
|
+
if (f.status === "valid")
|
|
1909
|
+
return f;
|
|
1910
|
+
f.status === "dirty" && !a && (a = { result: f, ctx: u }), u.common.issues.length && i.push(u.common.issues);
|
|
1915
1911
|
}
|
|
1916
1912
|
if (a)
|
|
1917
1913
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1918
1914
|
const o = i.map((c) => new U(c));
|
|
1919
|
-
return
|
|
1915
|
+
return h(t, {
|
|
1920
1916
|
code: l.invalid_union,
|
|
1921
1917
|
unionErrors: o
|
|
1922
1918
|
}), v;
|
|
@@ -1926,16 +1922,16 @@ class Le extends w {
|
|
|
1926
1922
|
return this._def.options;
|
|
1927
1923
|
}
|
|
1928
1924
|
}
|
|
1929
|
-
|
|
1925
|
+
Fe.create = (n, e) => new Fe(d({
|
|
1930
1926
|
options: n,
|
|
1931
1927
|
typeName: g.ZodUnion
|
|
1932
1928
|
}, b(e)));
|
|
1933
|
-
const ie = (n) => n instanceof Ve ? ie(n.schema) : n instanceof G ? ie(n.innerType()) : n instanceof Ue ? [n.value] : n instanceof fe ? n.options : n instanceof ze ? x.objectValues(n.enum) : n instanceof
|
|
1934
|
-
class
|
|
1929
|
+
const ie = (n) => n instanceof Ve ? ie(n.schema) : n instanceof G ? ie(n.innerType()) : n instanceof Ue ? [n.value] : n instanceof fe ? n.options : n instanceof ze ? x.objectValues(n.enum) : n instanceof We ? ie(n._def.innerType) : n instanceof $e ? [void 0] : n instanceof Pe ? [null] : n instanceof te ? [void 0, ...ie(n.unwrap())] : n instanceof he ? [null, ...ie(n.unwrap())] : n instanceof St || n instanceof qe ? ie(n.unwrap()) : n instanceof Be ? ie(n._def.innerType) : [];
|
|
1930
|
+
class at extends w {
|
|
1935
1931
|
_parse(e) {
|
|
1936
1932
|
const { ctx: t } = this._processInputParams(e);
|
|
1937
1933
|
if (t.parsedType !== p.object)
|
|
1938
|
-
return
|
|
1934
|
+
return h(t, {
|
|
1939
1935
|
code: l.invalid_type,
|
|
1940
1936
|
expected: p.object,
|
|
1941
1937
|
received: t.parsedType
|
|
@@ -1949,7 +1945,7 @@ class it extends w {
|
|
|
1949
1945
|
data: t.data,
|
|
1950
1946
|
path: t.path,
|
|
1951
1947
|
parent: t
|
|
1952
|
-
}) : (
|
|
1948
|
+
}) : (h(t, {
|
|
1953
1949
|
code: l.invalid_union_discriminator,
|
|
1954
1950
|
options: Array.from(this.optionsMap.keys()),
|
|
1955
1951
|
path: [s]
|
|
@@ -1984,7 +1980,7 @@ class it extends w {
|
|
|
1984
1980
|
r.set(o, a);
|
|
1985
1981
|
}
|
|
1986
1982
|
}
|
|
1987
|
-
return new
|
|
1983
|
+
return new at(d({
|
|
1988
1984
|
typeName: g.ZodDiscriminatedUnion,
|
|
1989
1985
|
discriminator: e,
|
|
1990
1986
|
options: t,
|
|
@@ -1992,14 +1988,14 @@ class it extends w {
|
|
|
1992
1988
|
}, b(s)));
|
|
1993
1989
|
}
|
|
1994
1990
|
}
|
|
1995
|
-
function
|
|
1991
|
+
function mt(n, e) {
|
|
1996
1992
|
const t = oe(n), s = oe(e);
|
|
1997
1993
|
if (n === e)
|
|
1998
1994
|
return { valid: !0, data: n };
|
|
1999
1995
|
if (t === p.object && s === p.object) {
|
|
2000
1996
|
const r = x.objectKeys(e), a = x.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = d(d({}, n), e);
|
|
2001
1997
|
for (const o of a) {
|
|
2002
|
-
const c =
|
|
1998
|
+
const c = mt(n[o], e[o]);
|
|
2003
1999
|
if (!c.valid)
|
|
2004
2000
|
return { valid: !1 };
|
|
2005
2001
|
i[o] = c.data;
|
|
@@ -2010,7 +2006,7 @@ function yt(n, e) {
|
|
|
2010
2006
|
return { valid: !1 };
|
|
2011
2007
|
const r = [];
|
|
2012
2008
|
for (let a = 0; a < n.length; a++) {
|
|
2013
|
-
const i = n[a], o = e[a], c =
|
|
2009
|
+
const i = n[a], o = e[a], c = mt(i, o);
|
|
2014
2010
|
if (!c.valid)
|
|
2015
2011
|
return { valid: !1 };
|
|
2016
2012
|
r.push(c.data);
|
|
@@ -2018,13 +2014,13 @@ function yt(n, e) {
|
|
|
2018
2014
|
return { valid: !0, data: r };
|
|
2019
2015
|
} else return t === p.date && s === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2020
2016
|
}
|
|
2021
|
-
class
|
|
2017
|
+
class Le extends w {
|
|
2022
2018
|
_parse(e) {
|
|
2023
2019
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2024
|
-
if (
|
|
2020
|
+
if (ht(a) || ht(i))
|
|
2025
2021
|
return v;
|
|
2026
|
-
const o =
|
|
2027
|
-
return o.valid ? ((
|
|
2022
|
+
const o = mt(a.value, i.value);
|
|
2023
|
+
return o.valid ? ((pt(a) || pt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2028
2024
|
code: l.invalid_intersection_types
|
|
2029
2025
|
}), v);
|
|
2030
2026
|
};
|
|
@@ -2050,7 +2046,7 @@ class Fe extends w {
|
|
|
2050
2046
|
}));
|
|
2051
2047
|
}
|
|
2052
2048
|
}
|
|
2053
|
-
|
|
2049
|
+
Le.create = (n, e, t) => new Le(d({
|
|
2054
2050
|
left: n,
|
|
2055
2051
|
right: e,
|
|
2056
2052
|
typeName: g.ZodIntersection
|
|
@@ -2059,20 +2055,20 @@ class se extends w {
|
|
|
2059
2055
|
_parse(e) {
|
|
2060
2056
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2061
2057
|
if (s.parsedType !== p.array)
|
|
2062
|
-
return
|
|
2058
|
+
return h(s, {
|
|
2063
2059
|
code: l.invalid_type,
|
|
2064
2060
|
expected: p.array,
|
|
2065
2061
|
received: s.parsedType
|
|
2066
2062
|
}), v;
|
|
2067
2063
|
if (s.data.length < this._def.items.length)
|
|
2068
|
-
return
|
|
2064
|
+
return h(s, {
|
|
2069
2065
|
code: l.too_small,
|
|
2070
2066
|
minimum: this._def.items.length,
|
|
2071
2067
|
inclusive: !0,
|
|
2072
2068
|
exact: !1,
|
|
2073
2069
|
type: "array"
|
|
2074
2070
|
}), v;
|
|
2075
|
-
!this._def.rest && s.data.length > this._def.items.length && (
|
|
2071
|
+
!this._def.rest && s.data.length > this._def.items.length && (h(s, {
|
|
2076
2072
|
code: l.too_big,
|
|
2077
2073
|
maximum: this._def.items.length,
|
|
2078
2074
|
inclusive: !0,
|
|
@@ -2083,7 +2079,7 @@ class se extends w {
|
|
|
2083
2079
|
const c = this._def.items[o] || this._def.rest;
|
|
2084
2080
|
return c ? c._parse(new ne(s, i, s.path, o)) : null;
|
|
2085
2081
|
}).filter((i) => !!i);
|
|
2086
|
-
return s.common.async ? Promise.all(a).then((i) =>
|
|
2082
|
+
return s.common.async ? Promise.all(a).then((i) => j.mergeArray(t, i)) : j.mergeArray(t, a);
|
|
2087
2083
|
}
|
|
2088
2084
|
get items() {
|
|
2089
2085
|
return this._def.items;
|
|
@@ -2113,7 +2109,7 @@ class De extends w {
|
|
|
2113
2109
|
_parse(e) {
|
|
2114
2110
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2115
2111
|
if (s.parsedType !== p.object)
|
|
2116
|
-
return
|
|
2112
|
+
return h(s, {
|
|
2117
2113
|
code: l.invalid_type,
|
|
2118
2114
|
expected: p.object,
|
|
2119
2115
|
received: s.parsedType
|
|
@@ -2125,7 +2121,7 @@ class De extends w {
|
|
|
2125
2121
|
value: i._parse(new ne(s, s.data[o], s.path, o)),
|
|
2126
2122
|
alwaysSet: o in s.data
|
|
2127
2123
|
});
|
|
2128
|
-
return s.common.async ?
|
|
2124
|
+
return s.common.async ? j.mergeObjectAsync(t, r) : j.mergeObjectSync(t, r);
|
|
2129
2125
|
}
|
|
2130
2126
|
get element() {
|
|
2131
2127
|
return this._def.valueType;
|
|
@@ -2142,7 +2138,7 @@ class De extends w {
|
|
|
2142
2138
|
}, b(t)));
|
|
2143
2139
|
}
|
|
2144
2140
|
}
|
|
2145
|
-
class
|
|
2141
|
+
class st extends w {
|
|
2146
2142
|
get keySchema() {
|
|
2147
2143
|
return this._def.keyType;
|
|
2148
2144
|
}
|
|
@@ -2152,7 +2148,7 @@ class rt extends w {
|
|
|
2152
2148
|
_parse(e) {
|
|
2153
2149
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2154
2150
|
if (s.parsedType !== p.map)
|
|
2155
|
-
return
|
|
2151
|
+
return h(s, {
|
|
2156
2152
|
code: l.invalid_type,
|
|
2157
2153
|
expected: p.map,
|
|
2158
2154
|
received: s.parsedType
|
|
@@ -2163,28 +2159,28 @@ class rt extends w {
|
|
|
2163
2159
|
}));
|
|
2164
2160
|
if (s.common.async) {
|
|
2165
2161
|
const o = /* @__PURE__ */ new Map();
|
|
2166
|
-
return Promise.resolve().then(() =>
|
|
2162
|
+
return Promise.resolve().then(() => $(this, null, function* () {
|
|
2167
2163
|
for (const c of i) {
|
|
2168
|
-
const u = yield c.key,
|
|
2169
|
-
if (u.status === "aborted" ||
|
|
2164
|
+
const u = yield c.key, f = yield c.value;
|
|
2165
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2170
2166
|
return v;
|
|
2171
|
-
(u.status === "dirty" ||
|
|
2167
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2172
2168
|
}
|
|
2173
2169
|
return { status: t.value, value: o };
|
|
2174
2170
|
}));
|
|
2175
2171
|
} else {
|
|
2176
2172
|
const o = /* @__PURE__ */ new Map();
|
|
2177
2173
|
for (const c of i) {
|
|
2178
|
-
const u = c.key,
|
|
2179
|
-
if (u.status === "aborted" ||
|
|
2174
|
+
const u = c.key, f = c.value;
|
|
2175
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2180
2176
|
return v;
|
|
2181
|
-
(u.status === "dirty" ||
|
|
2177
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2182
2178
|
}
|
|
2183
2179
|
return { status: t.value, value: o };
|
|
2184
2180
|
}
|
|
2185
2181
|
}
|
|
2186
2182
|
}
|
|
2187
|
-
|
|
2183
|
+
st.create = (n, e, t) => new st(d({
|
|
2188
2184
|
valueType: e,
|
|
2189
2185
|
keyType: n,
|
|
2190
2186
|
typeName: g.ZodMap
|
|
@@ -2193,20 +2189,20 @@ class _e extends w {
|
|
|
2193
2189
|
_parse(e) {
|
|
2194
2190
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2195
2191
|
if (s.parsedType !== p.set)
|
|
2196
|
-
return
|
|
2192
|
+
return h(s, {
|
|
2197
2193
|
code: l.invalid_type,
|
|
2198
2194
|
expected: p.set,
|
|
2199
2195
|
received: s.parsedType
|
|
2200
2196
|
}), v;
|
|
2201
2197
|
const r = this._def;
|
|
2202
|
-
r.minSize !== null && s.data.size < r.minSize.value && (
|
|
2198
|
+
r.minSize !== null && s.data.size < r.minSize.value && (h(s, {
|
|
2203
2199
|
code: l.too_small,
|
|
2204
2200
|
minimum: r.minSize.value,
|
|
2205
2201
|
type: "set",
|
|
2206
2202
|
inclusive: !0,
|
|
2207
2203
|
exact: !1,
|
|
2208
2204
|
message: r.minSize.message
|
|
2209
|
-
}), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (
|
|
2205
|
+
}), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (h(s, {
|
|
2210
2206
|
code: l.too_big,
|
|
2211
2207
|
maximum: r.maxSize.value,
|
|
2212
2208
|
type: "set",
|
|
@@ -2217,10 +2213,10 @@ class _e extends w {
|
|
|
2217
2213
|
const a = this._def.valueType;
|
|
2218
2214
|
function i(c) {
|
|
2219
2215
|
const u = /* @__PURE__ */ new Set();
|
|
2220
|
-
for (const
|
|
2221
|
-
if (
|
|
2216
|
+
for (const f of c) {
|
|
2217
|
+
if (f.status === "aborted")
|
|
2222
2218
|
return v;
|
|
2223
|
-
|
|
2219
|
+
f.status === "dirty" && t.dirty(), u.add(f.value);
|
|
2224
2220
|
}
|
|
2225
2221
|
return { status: t.value, value: u };
|
|
2226
2222
|
}
|
|
@@ -2257,19 +2253,19 @@ class xe extends w {
|
|
|
2257
2253
|
_parse(e) {
|
|
2258
2254
|
const { ctx: t } = this._processInputParams(e);
|
|
2259
2255
|
if (t.parsedType !== p.function)
|
|
2260
|
-
return
|
|
2256
|
+
return h(t, {
|
|
2261
2257
|
code: l.invalid_type,
|
|
2262
2258
|
expected: p.function,
|
|
2263
2259
|
received: t.parsedType
|
|
2264
2260
|
}), v;
|
|
2265
2261
|
function s(o, c) {
|
|
2266
|
-
return
|
|
2262
|
+
return Qe({
|
|
2267
2263
|
data: o,
|
|
2268
2264
|
path: t.path,
|
|
2269
2265
|
errorMaps: [
|
|
2270
2266
|
t.common.contextualErrorMap,
|
|
2271
2267
|
t.schemaErrorMap,
|
|
2272
|
-
|
|
2268
|
+
Ye(),
|
|
2273
2269
|
ke
|
|
2274
2270
|
].filter((u) => !!u),
|
|
2275
2271
|
issueData: {
|
|
@@ -2279,13 +2275,13 @@ class xe extends w {
|
|
|
2279
2275
|
});
|
|
2280
2276
|
}
|
|
2281
2277
|
function r(o, c) {
|
|
2282
|
-
return
|
|
2278
|
+
return Qe({
|
|
2283
2279
|
data: o,
|
|
2284
2280
|
path: t.path,
|
|
2285
2281
|
errorMaps: [
|
|
2286
2282
|
t.common.contextualErrorMap,
|
|
2287
2283
|
t.schemaErrorMap,
|
|
2288
|
-
|
|
2284
|
+
Ye(),
|
|
2289
2285
|
ke
|
|
2290
2286
|
].filter((u) => !!u),
|
|
2291
2287
|
issueData: {
|
|
@@ -2298,12 +2294,12 @@ class xe extends w {
|
|
|
2298
2294
|
if (this._def.returns instanceof Se) {
|
|
2299
2295
|
const o = this;
|
|
2300
2296
|
return M(function(...c) {
|
|
2301
|
-
return
|
|
2302
|
-
const u = new U([]),
|
|
2303
|
-
throw u.addIssue(s(c,
|
|
2304
|
-
}), _ = yield Reflect.apply(i, this,
|
|
2305
|
-
return yield o._def.returns._def.type.parseAsync(_, a).catch((
|
|
2306
|
-
throw u.addIssue(r(_,
|
|
2297
|
+
return $(this, null, function* () {
|
|
2298
|
+
const u = new U([]), f = yield o._def.args.parseAsync(c, a).catch((A) => {
|
|
2299
|
+
throw u.addIssue(s(c, A)), u;
|
|
2300
|
+
}), _ = yield Reflect.apply(i, this, f);
|
|
2301
|
+
return yield o._def.returns._def.type.parseAsync(_, a).catch((A) => {
|
|
2302
|
+
throw u.addIssue(r(_, A)), u;
|
|
2307
2303
|
});
|
|
2308
2304
|
});
|
|
2309
2305
|
});
|
|
@@ -2313,9 +2309,9 @@ class xe extends w {
|
|
|
2313
2309
|
const u = o._def.args.safeParse(c, a);
|
|
2314
2310
|
if (!u.success)
|
|
2315
2311
|
throw new U([s(c, u.error)]);
|
|
2316
|
-
const
|
|
2312
|
+
const f = Reflect.apply(i, this, u.data), _ = o._def.returns.safeParse(f, a);
|
|
2317
2313
|
if (!_.success)
|
|
2318
|
-
throw new U([r(
|
|
2314
|
+
throw new U([r(f, _.error)]);
|
|
2319
2315
|
return _.data;
|
|
2320
2316
|
});
|
|
2321
2317
|
}
|
|
@@ -2367,7 +2363,7 @@ class Ue extends w {
|
|
|
2367
2363
|
_parse(e) {
|
|
2368
2364
|
if (e.data !== this._def.value) {
|
|
2369
2365
|
const t = this._getOrReturnCtx(e);
|
|
2370
|
-
return
|
|
2366
|
+
return h(t, {
|
|
2371
2367
|
received: t.data,
|
|
2372
2368
|
code: l.invalid_literal,
|
|
2373
2369
|
expected: this._def.value
|
|
@@ -2396,15 +2392,15 @@ class fe extends w {
|
|
|
2396
2392
|
_parse(e) {
|
|
2397
2393
|
if (typeof e.data != "string") {
|
|
2398
2394
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2399
|
-
return
|
|
2395
|
+
return h(t, {
|
|
2400
2396
|
expected: x.joinValues(s),
|
|
2401
2397
|
received: t.parsedType,
|
|
2402
2398
|
code: l.invalid_type
|
|
2403
2399
|
}), v;
|
|
2404
2400
|
}
|
|
2405
|
-
if (
|
|
2401
|
+
if (et(this, Ce) || Ht(this, Ce, new Set(this._def.values)), !et(this, Ce).has(e.data)) {
|
|
2406
2402
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2407
|
-
return
|
|
2403
|
+
return h(t, {
|
|
2408
2404
|
received: t.data,
|
|
2409
2405
|
code: l.invalid_enum_value,
|
|
2410
2406
|
options: s
|
|
@@ -2444,21 +2440,21 @@ Ce = /* @__PURE__ */ new WeakMap();
|
|
|
2444
2440
|
fe.create = Xt;
|
|
2445
2441
|
class ze extends w {
|
|
2446
2442
|
constructor() {
|
|
2447
|
-
super(...arguments),
|
|
2443
|
+
super(...arguments), Ie.set(this, void 0);
|
|
2448
2444
|
}
|
|
2449
2445
|
_parse(e) {
|
|
2450
2446
|
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2451
2447
|
if (s.parsedType !== p.string && s.parsedType !== p.number) {
|
|
2452
2448
|
const r = x.objectValues(t);
|
|
2453
|
-
return
|
|
2449
|
+
return h(s, {
|
|
2454
2450
|
expected: x.joinValues(r),
|
|
2455
2451
|
received: s.parsedType,
|
|
2456
2452
|
code: l.invalid_type
|
|
2457
2453
|
}), v;
|
|
2458
2454
|
}
|
|
2459
|
-
if (
|
|
2455
|
+
if (et(this, Ie) || Ht(this, Ie, new Set(x.getValidEnumValues(this._def.values))), !et(this, Ie).has(e.data)) {
|
|
2460
2456
|
const r = x.objectValues(t);
|
|
2461
|
-
return
|
|
2457
|
+
return h(s, {
|
|
2462
2458
|
received: s.data,
|
|
2463
2459
|
code: l.invalid_enum_value,
|
|
2464
2460
|
options: r
|
|
@@ -2470,7 +2466,7 @@ class ze extends w {
|
|
|
2470
2466
|
return this._def.values;
|
|
2471
2467
|
}
|
|
2472
2468
|
}
|
|
2473
|
-
|
|
2469
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
2474
2470
|
ze.create = (n, e) => new ze(d({
|
|
2475
2471
|
values: n,
|
|
2476
2472
|
typeName: g.ZodNativeEnum
|
|
@@ -2482,7 +2478,7 @@ class Se extends w {
|
|
|
2482
2478
|
_parse(e) {
|
|
2483
2479
|
const { ctx: t } = this._processInputParams(e);
|
|
2484
2480
|
if (t.parsedType !== p.promise && t.common.async === !1)
|
|
2485
|
-
return
|
|
2481
|
+
return h(t, {
|
|
2486
2482
|
code: l.invalid_type,
|
|
2487
2483
|
expected: p.promise,
|
|
2488
2484
|
received: t.parsedType
|
|
@@ -2508,7 +2504,7 @@ class G extends w {
|
|
|
2508
2504
|
_parse(e) {
|
|
2509
2505
|
const { status: t, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
|
|
2510
2506
|
addIssue: (i) => {
|
|
2511
|
-
|
|
2507
|
+
h(s, i), i.fatal ? t.abort() : t.dirty();
|
|
2512
2508
|
},
|
|
2513
2509
|
get path() {
|
|
2514
2510
|
return s.path;
|
|
@@ -2517,7 +2513,7 @@ class G extends w {
|
|
|
2517
2513
|
if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
|
|
2518
2514
|
const i = r.transform(s.data, a);
|
|
2519
2515
|
if (s.common.async)
|
|
2520
|
-
return Promise.resolve(i).then((o) =>
|
|
2516
|
+
return Promise.resolve(i).then((o) => $(this, null, function* () {
|
|
2521
2517
|
if (t.value === "aborted")
|
|
2522
2518
|
return v;
|
|
2523
2519
|
const c = yield this._def.schema._parseAsync({
|
|
@@ -2609,7 +2605,7 @@ he.create = (n, e) => new he(d({
|
|
|
2609
2605
|
innerType: n,
|
|
2610
2606
|
typeName: g.ZodNullable
|
|
2611
2607
|
}, b(e)));
|
|
2612
|
-
class
|
|
2608
|
+
class We extends w {
|
|
2613
2609
|
_parse(e) {
|
|
2614
2610
|
const { ctx: t } = this._processInputParams(e);
|
|
2615
2611
|
let s = t.data;
|
|
@@ -2623,12 +2619,12 @@ class Be extends w {
|
|
|
2623
2619
|
return this._def.innerType;
|
|
2624
2620
|
}
|
|
2625
2621
|
}
|
|
2626
|
-
|
|
2622
|
+
We.create = (n, e) => new We(d({
|
|
2627
2623
|
innerType: n,
|
|
2628
2624
|
typeName: g.ZodDefault,
|
|
2629
2625
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
2630
2626
|
}, b(e)));
|
|
2631
|
-
class
|
|
2627
|
+
class Be extends w {
|
|
2632
2628
|
_parse(e) {
|
|
2633
2629
|
const { ctx: t } = this._processInputParams(e), s = y(d({}, t), {
|
|
2634
2630
|
common: y(d({}, t.common), {
|
|
@@ -2661,16 +2657,16 @@ class We extends w {
|
|
|
2661
2657
|
return this._def.innerType;
|
|
2662
2658
|
}
|
|
2663
2659
|
}
|
|
2664
|
-
|
|
2660
|
+
Be.create = (n, e) => new Be(d({
|
|
2665
2661
|
innerType: n,
|
|
2666
2662
|
typeName: g.ZodCatch,
|
|
2667
2663
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
2668
2664
|
}, b(e)));
|
|
2669
|
-
class
|
|
2665
|
+
class rt extends w {
|
|
2670
2666
|
_parse(e) {
|
|
2671
2667
|
if (this._getType(e) !== p.nan) {
|
|
2672
2668
|
const s = this._getOrReturnCtx(e);
|
|
2673
|
-
return
|
|
2669
|
+
return h(s, {
|
|
2674
2670
|
code: l.invalid_type,
|
|
2675
2671
|
expected: p.nan,
|
|
2676
2672
|
received: s.parsedType
|
|
@@ -2679,11 +2675,11 @@ class at extends w {
|
|
|
2679
2675
|
return { status: "valid", value: e.data };
|
|
2680
2676
|
}
|
|
2681
2677
|
}
|
|
2682
|
-
|
|
2678
|
+
rt.create = (n) => new rt(d({
|
|
2683
2679
|
typeName: g.ZodNaN
|
|
2684
2680
|
}, b(n)));
|
|
2685
|
-
const
|
|
2686
|
-
class
|
|
2681
|
+
const Vn = Symbol("zod_brand");
|
|
2682
|
+
class St extends w {
|
|
2687
2683
|
_parse(e) {
|
|
2688
2684
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2689
2685
|
return this._def.type._parse({
|
|
@@ -2700,7 +2696,7 @@ class Je extends w {
|
|
|
2700
2696
|
_parse(e) {
|
|
2701
2697
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2702
2698
|
if (s.common.async)
|
|
2703
|
-
return
|
|
2699
|
+
return $(this, null, function* () {
|
|
2704
2700
|
const a = yield this._def.in._parseAsync({
|
|
2705
2701
|
data: s.data,
|
|
2706
2702
|
path: s.path,
|
|
@@ -2758,16 +2754,16 @@ function Yt(n, e = {}, t) {
|
|
|
2758
2754
|
}
|
|
2759
2755
|
}) : Te.create();
|
|
2760
2756
|
}
|
|
2761
|
-
const
|
|
2757
|
+
const Un = {
|
|
2762
2758
|
object: S.lazycreate
|
|
2763
2759
|
};
|
|
2764
2760
|
var g;
|
|
2765
2761
|
(function(n) {
|
|
2766
2762
|
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2767
2763
|
})(g || (g = {}));
|
|
2768
|
-
const
|
|
2764
|
+
const zn = (n, e = {
|
|
2769
2765
|
message: `Input not instance of ${n.name}`
|
|
2770
|
-
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = ue.create, Wn =
|
|
2766
|
+
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = ue.create, Wn = rt.create, Bn = le.create, tn = Me.create, qn = ve.create, Hn = tt.create, Jn = $e.create, Gn = Pe.create, Kn = Te.create, Xn = ye.create, Yn = ce.create, Qn = nt.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Fe.create, rs = at.create, as = Le.create, is = se.create, os = De.create, cs = st.create, ds = _e.create, us = xe.create, ls = Ve.create, fs = Ue.create, hs = fe.create, ps = ze.create, ms = Se.create, Pt = G.create, ys = te.create, gs = he.create, vs = G.createWithPreprocess, _s = Je.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
|
|
2771
2767
|
string: (n) => H.create(y(d({}, n), { coerce: !0 })),
|
|
2772
2768
|
number: (n) => ue.create(y(d({}, n), { coerce: !0 })),
|
|
2773
2769
|
boolean: (n) => Me.create(y(d({}, n), {
|
|
@@ -2775,28 +2771,28 @@ const Bn = (n, e = {
|
|
|
2775
2771
|
})),
|
|
2776
2772
|
bigint: (n) => le.create(y(d({}, n), { coerce: !0 })),
|
|
2777
2773
|
date: (n) => ve.create(y(d({}, n), { coerce: !0 }))
|
|
2778
|
-
},
|
|
2779
|
-
var
|
|
2774
|
+
}, Ts = v;
|
|
2775
|
+
var P = /* @__PURE__ */ Object.freeze({
|
|
2780
2776
|
__proto__: null,
|
|
2781
2777
|
defaultErrorMap: ke,
|
|
2782
|
-
setErrorMap:
|
|
2783
|
-
getErrorMap:
|
|
2784
|
-
makeIssue:
|
|
2785
|
-
EMPTY_PATH:
|
|
2786
|
-
addIssueToContext:
|
|
2787
|
-
ParseStatus:
|
|
2778
|
+
setErrorMap: vn,
|
|
2779
|
+
getErrorMap: Ye,
|
|
2780
|
+
makeIssue: Qe,
|
|
2781
|
+
EMPTY_PATH: _n,
|
|
2782
|
+
addIssueToContext: h,
|
|
2783
|
+
ParseStatus: j,
|
|
2788
2784
|
INVALID: v,
|
|
2789
2785
|
DIRTY: we,
|
|
2790
2786
|
OK: M,
|
|
2791
|
-
isAborted:
|
|
2792
|
-
isDirty:
|
|
2787
|
+
isAborted: ht,
|
|
2788
|
+
isDirty: pt,
|
|
2793
2789
|
isValid: ge,
|
|
2794
2790
|
isAsync: Ze,
|
|
2795
2791
|
get util() {
|
|
2796
2792
|
return x;
|
|
2797
2793
|
},
|
|
2798
2794
|
get objectUtil() {
|
|
2799
|
-
return
|
|
2795
|
+
return ft;
|
|
2800
2796
|
},
|
|
2801
2797
|
ZodParsedType: p,
|
|
2802
2798
|
getParsedType: oe,
|
|
@@ -2807,21 +2803,21 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
2807
2803
|
ZodBigInt: le,
|
|
2808
2804
|
ZodBoolean: Me,
|
|
2809
2805
|
ZodDate: ve,
|
|
2810
|
-
ZodSymbol:
|
|
2811
|
-
ZodUndefined:
|
|
2812
|
-
ZodNull:
|
|
2806
|
+
ZodSymbol: tt,
|
|
2807
|
+
ZodUndefined: $e,
|
|
2808
|
+
ZodNull: Pe,
|
|
2813
2809
|
ZodAny: Te,
|
|
2814
2810
|
ZodUnknown: ye,
|
|
2815
2811
|
ZodNever: ce,
|
|
2816
|
-
ZodVoid:
|
|
2812
|
+
ZodVoid: nt,
|
|
2817
2813
|
ZodArray: J,
|
|
2818
2814
|
ZodObject: S,
|
|
2819
|
-
ZodUnion:
|
|
2820
|
-
ZodDiscriminatedUnion:
|
|
2821
|
-
ZodIntersection:
|
|
2815
|
+
ZodUnion: Fe,
|
|
2816
|
+
ZodDiscriminatedUnion: at,
|
|
2817
|
+
ZodIntersection: Le,
|
|
2822
2818
|
ZodTuple: se,
|
|
2823
2819
|
ZodRecord: De,
|
|
2824
|
-
ZodMap:
|
|
2820
|
+
ZodMap: st,
|
|
2825
2821
|
ZodSet: _e,
|
|
2826
2822
|
ZodFunction: xe,
|
|
2827
2823
|
ZodLazy: Ve,
|
|
@@ -2833,73 +2829,73 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
2833
2829
|
ZodTransformer: G,
|
|
2834
2830
|
ZodOptional: te,
|
|
2835
2831
|
ZodNullable: he,
|
|
2836
|
-
ZodDefault:
|
|
2837
|
-
ZodCatch:
|
|
2838
|
-
ZodNaN:
|
|
2839
|
-
BRAND:
|
|
2840
|
-
ZodBranded:
|
|
2832
|
+
ZodDefault: We,
|
|
2833
|
+
ZodCatch: Be,
|
|
2834
|
+
ZodNaN: rt,
|
|
2835
|
+
BRAND: Vn,
|
|
2836
|
+
ZodBranded: St,
|
|
2841
2837
|
ZodPipeline: Je,
|
|
2842
2838
|
ZodReadonly: qe,
|
|
2843
2839
|
custom: Yt,
|
|
2844
2840
|
Schema: w,
|
|
2845
2841
|
ZodSchema: w,
|
|
2846
|
-
late:
|
|
2842
|
+
late: Un,
|
|
2847
2843
|
get ZodFirstPartyTypeKind() {
|
|
2848
2844
|
return g;
|
|
2849
2845
|
},
|
|
2850
|
-
coerce:
|
|
2851
|
-
any:
|
|
2852
|
-
array:
|
|
2853
|
-
bigint:
|
|
2846
|
+
coerce: ks,
|
|
2847
|
+
any: Kn,
|
|
2848
|
+
array: es,
|
|
2849
|
+
bigint: Bn,
|
|
2854
2850
|
boolean: tn,
|
|
2855
|
-
date:
|
|
2856
|
-
discriminatedUnion:
|
|
2857
|
-
effect:
|
|
2858
|
-
enum:
|
|
2859
|
-
function:
|
|
2860
|
-
instanceof:
|
|
2861
|
-
intersection:
|
|
2862
|
-
lazy:
|
|
2863
|
-
literal:
|
|
2864
|
-
map:
|
|
2851
|
+
date: qn,
|
|
2852
|
+
discriminatedUnion: rs,
|
|
2853
|
+
effect: Pt,
|
|
2854
|
+
enum: hs,
|
|
2855
|
+
function: us,
|
|
2856
|
+
instanceof: zn,
|
|
2857
|
+
intersection: as,
|
|
2858
|
+
lazy: ls,
|
|
2859
|
+
literal: fs,
|
|
2860
|
+
map: cs,
|
|
2865
2861
|
nan: Wn,
|
|
2866
|
-
nativeEnum:
|
|
2867
|
-
never:
|
|
2868
|
-
null:
|
|
2869
|
-
nullable:
|
|
2862
|
+
nativeEnum: ps,
|
|
2863
|
+
never: Yn,
|
|
2864
|
+
null: Gn,
|
|
2865
|
+
nullable: gs,
|
|
2870
2866
|
number: en,
|
|
2871
|
-
object:
|
|
2872
|
-
oboolean:
|
|
2873
|
-
onumber:
|
|
2874
|
-
optional:
|
|
2875
|
-
ostring:
|
|
2876
|
-
pipeline:
|
|
2877
|
-
preprocess:
|
|
2878
|
-
promise:
|
|
2879
|
-
record:
|
|
2880
|
-
set:
|
|
2881
|
-
strictObject:
|
|
2867
|
+
object: ts,
|
|
2868
|
+
oboolean: xs,
|
|
2869
|
+
onumber: ws,
|
|
2870
|
+
optional: ys,
|
|
2871
|
+
ostring: bs,
|
|
2872
|
+
pipeline: _s,
|
|
2873
|
+
preprocess: vs,
|
|
2874
|
+
promise: ms,
|
|
2875
|
+
record: os,
|
|
2876
|
+
set: ds,
|
|
2877
|
+
strictObject: ns,
|
|
2882
2878
|
string: Qt,
|
|
2883
|
-
symbol:
|
|
2884
|
-
transformer:
|
|
2885
|
-
tuple:
|
|
2886
|
-
undefined:
|
|
2887
|
-
union:
|
|
2888
|
-
unknown:
|
|
2889
|
-
void:
|
|
2890
|
-
NEVER:
|
|
2879
|
+
symbol: Hn,
|
|
2880
|
+
transformer: Pt,
|
|
2881
|
+
tuple: is,
|
|
2882
|
+
undefined: Jn,
|
|
2883
|
+
union: ss,
|
|
2884
|
+
unknown: Xn,
|
|
2885
|
+
void: Qn,
|
|
2886
|
+
NEVER: Ts,
|
|
2891
2887
|
ZodIssueCode: l,
|
|
2892
|
-
quotelessJson:
|
|
2888
|
+
quotelessJson: gn,
|
|
2893
2889
|
ZodError: U
|
|
2894
2890
|
});
|
|
2895
|
-
const
|
|
2896
|
-
language:
|
|
2891
|
+
const Ss = P.object({
|
|
2892
|
+
language: P.enum(["typescript", "javascript"]).optional()
|
|
2897
2893
|
}).and(
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
framework:
|
|
2901
|
-
model:
|
|
2902
|
-
styling:
|
|
2894
|
+
P.union([
|
|
2895
|
+
P.object({
|
|
2896
|
+
framework: P.literal("react"),
|
|
2897
|
+
model: P.string().optional(),
|
|
2898
|
+
styling: P.enum([
|
|
2903
2899
|
"plain_css",
|
|
2904
2900
|
"css_modules",
|
|
2905
2901
|
"styled_components",
|
|
@@ -2908,48 +2904,49 @@ const As = D.object({
|
|
|
2908
2904
|
"scss",
|
|
2909
2905
|
"inline_styles"
|
|
2910
2906
|
]),
|
|
2911
|
-
uiLibrary:
|
|
2912
|
-
enableUILibraryTheming:
|
|
2907
|
+
uiLibrary: P.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
2908
|
+
enableUILibraryTheming: P.boolean().optional(),
|
|
2909
|
+
enableCompactStructure: P.boolean().optional()
|
|
2913
2910
|
}),
|
|
2914
|
-
|
|
2915
|
-
framework:
|
|
2916
|
-
styling:
|
|
2917
|
-
enableTranslation:
|
|
2911
|
+
P.object({
|
|
2912
|
+
framework: P.literal("html"),
|
|
2913
|
+
styling: P.enum(["plain_css", "inline_styles"]),
|
|
2914
|
+
enableTranslation: P.boolean().optional()
|
|
2918
2915
|
})
|
|
2919
2916
|
])
|
|
2920
2917
|
), Es = (n) => {
|
|
2921
|
-
const e =
|
|
2918
|
+
const e = Ss.safeParse(n);
|
|
2922
2919
|
if (e.success === !1) {
|
|
2923
2920
|
const t = new Error("Invalid codegen settings");
|
|
2924
2921
|
throw t.cause = e.error, t;
|
|
2925
2922
|
}
|
|
2926
2923
|
return e.data;
|
|
2927
2924
|
};
|
|
2928
|
-
var
|
|
2929
|
-
class
|
|
2925
|
+
var W, He;
|
|
2926
|
+
class Zr {
|
|
2930
2927
|
constructor({
|
|
2931
2928
|
auth: e,
|
|
2932
2929
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
2933
2930
|
} = {}) {
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2931
|
+
it(this, W);
|
|
2932
|
+
it(this, He);
|
|
2933
|
+
ot(this, He, t), e && (this.auth = e);
|
|
2937
2934
|
}
|
|
2938
2935
|
hasAuth() {
|
|
2939
|
-
return !!X(this,
|
|
2936
|
+
return !!X(this, W);
|
|
2940
2937
|
}
|
|
2941
2938
|
set auth(e) {
|
|
2942
|
-
|
|
2939
|
+
ot(this, W, e);
|
|
2943
2940
|
}
|
|
2944
2941
|
get headers() {
|
|
2945
2942
|
const e = {
|
|
2946
2943
|
"Content-Type": "application/json"
|
|
2947
2944
|
};
|
|
2948
|
-
return X(this,
|
|
2945
|
+
return X(this, W) && (e.Authorization = `Bearer ${X(this, W).token}`, "teamId" in X(this, W) && (e["X-Team-Id"] = X(this, W).teamId), "userId" in X(this, W) && X(this, W).userId && (e["X-User-Id"] = X(this, W).userId)), e;
|
|
2949
2946
|
}
|
|
2950
2947
|
generateCode(s) {
|
|
2951
|
-
return
|
|
2952
|
-
var
|
|
2948
|
+
return $(this, arguments, function* (e, t = {}) {
|
|
2949
|
+
var f, _, C, A, O, R, q;
|
|
2953
2950
|
if (this.hasAuth() === !1)
|
|
2954
2951
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
2955
2952
|
const r = {}, a = Es(e.settings), i = yield fetch(`${X(this, He)}/v1/codegen`, {
|
|
@@ -2968,7 +2965,8 @@ class Ir {
|
|
|
2968
2965
|
styling: a.styling,
|
|
2969
2966
|
uiLibrary: a.uiLibrary,
|
|
2970
2967
|
enableTranslation: a.enableTranslation,
|
|
2971
|
-
enableUILibraryTheming: a.enableUILibraryTheming
|
|
2968
|
+
enableUILibraryTheming: a.enableUILibraryTheming,
|
|
2969
|
+
enableCompactStructure: a.enableCompactStructure
|
|
2972
2970
|
})
|
|
2973
2971
|
});
|
|
2974
2972
|
if (!i.ok) {
|
|
@@ -2978,14 +2976,14 @@ class Ir {
|
|
|
2978
2976
|
} catch (re) {
|
|
2979
2977
|
z = `HTTP error! status: ${i.status}`;
|
|
2980
2978
|
}
|
|
2981
|
-
throw new
|
|
2979
|
+
throw new Ae({
|
|
2982
2980
|
name: "HTTP Error",
|
|
2983
2981
|
reason: z,
|
|
2984
2982
|
status: i.status
|
|
2985
2983
|
});
|
|
2986
2984
|
}
|
|
2987
2985
|
if (!i.body)
|
|
2988
|
-
throw new
|
|
2986
|
+
throw new Ae({
|
|
2989
2987
|
name: "Stream Error",
|
|
2990
2988
|
reason: "Response body is null",
|
|
2991
2989
|
status: i.status
|
|
@@ -3006,12 +3004,12 @@ class Ir {
|
|
|
3006
3004
|
let T;
|
|
3007
3005
|
try {
|
|
3008
3006
|
T = JSON.parse(K.slice(6));
|
|
3009
|
-
} catch (
|
|
3007
|
+
} catch (Ct) {
|
|
3010
3008
|
continue;
|
|
3011
3009
|
}
|
|
3012
3010
|
switch (T.type) {
|
|
3013
3011
|
case "start": {
|
|
3014
|
-
r.sessionId = T.sessionId, typeof t == "function" ? t(T) : (
|
|
3012
|
+
r.sessionId = T.sessionId, typeof t == "function" ? t(T) : (f = t.onStart) == null || f.call(t, { sessionId: T.sessionId });
|
|
3015
3013
|
break;
|
|
3016
3014
|
}
|
|
3017
3015
|
case "pre_codegen": {
|
|
@@ -3019,26 +3017,25 @@ class Ir {
|
|
|
3019
3017
|
break;
|
|
3020
3018
|
}
|
|
3021
3019
|
case "assets_uploaded": {
|
|
3022
|
-
typeof t == "function" ? t(T) : (
|
|
3020
|
+
typeof t == "function" ? t(T) : (C = t.onAssetsUploaded) == null || C.call(t);
|
|
3023
3021
|
break;
|
|
3024
3022
|
}
|
|
3025
3023
|
case "assets_list": {
|
|
3026
|
-
r.assets = T.payload.assets, typeof t == "function" ? t(T) : (
|
|
3024
|
+
r.assets = T.payload.assets, typeof t == "function" ? t(T) : (A = t.onAssetsList) == null || A.call(t, T.payload);
|
|
3027
3025
|
break;
|
|
3028
3026
|
}
|
|
3029
3027
|
case "figma_metadata": {
|
|
3030
|
-
r.figmaFileName = T.figmaFileName, r.figmaSelectedFrameName = T.figmaSelectedFrameName, typeof t == "function" ? t(T) : (
|
|
3028
|
+
r.figmaFileName = T.figmaFileName, r.figmaSelectedFrameName = T.figmaSelectedFrameName, typeof t == "function" ? t(T) : (O = t.onFigmaMetadata) == null || O.call(t, {
|
|
3031
3029
|
figmaFileName: T.figmaFileName,
|
|
3032
3030
|
figmaSelectedFrameName: T.figmaSelectedFrameName
|
|
3033
3031
|
});
|
|
3034
3032
|
break;
|
|
3035
3033
|
}
|
|
3036
3034
|
case "generating_code": {
|
|
3037
|
-
|
|
3038
|
-
T.payload.status === "success" && (r.files = E), typeof t == "function" ? t(T) : (R = t.onGeneratingCode) == null || R.call(t, {
|
|
3035
|
+
T.payload.status === "success" && (r.files = T.payload.files), typeof t == "function" ? t(T) : (R = t.onGeneratingCode) == null || R.call(t, {
|
|
3039
3036
|
status: T.payload.status,
|
|
3040
3037
|
progress: T.payload.progress,
|
|
3041
|
-
files:
|
|
3038
|
+
files: T.payload.files
|
|
3042
3039
|
});
|
|
3043
3040
|
break;
|
|
3044
3041
|
}
|
|
@@ -3047,17 +3044,17 @@ class Ir {
|
|
|
3047
3044
|
break;
|
|
3048
3045
|
}
|
|
3049
3046
|
case "error":
|
|
3050
|
-
throw new
|
|
3047
|
+
throw new Ae({
|
|
3051
3048
|
name: T.payload.errorName,
|
|
3052
3049
|
reason: T.payload.reason
|
|
3053
3050
|
});
|
|
3054
3051
|
case "done": {
|
|
3055
3052
|
if (!r.files)
|
|
3056
|
-
throw new
|
|
3053
|
+
throw new Ae({
|
|
3057
3054
|
name: "Invalid response",
|
|
3058
3055
|
reason: "No files found"
|
|
3059
3056
|
});
|
|
3060
|
-
return r;
|
|
3057
|
+
return r.tokenUsage = T.payload.tokenUsage, r;
|
|
3061
3058
|
}
|
|
3062
3059
|
}
|
|
3063
3060
|
}
|
|
@@ -3065,7 +3062,7 @@ class Ir {
|
|
|
3065
3062
|
} finally {
|
|
3066
3063
|
o.cancel();
|
|
3067
3064
|
}
|
|
3068
|
-
throw new
|
|
3065
|
+
throw new Ae({
|
|
3069
3066
|
name: "Connection",
|
|
3070
3067
|
reason: "Connection closed before the 'done' message",
|
|
3071
3068
|
status: 500
|
|
@@ -3073,8 +3070,8 @@ class Ir {
|
|
|
3073
3070
|
});
|
|
3074
3071
|
}
|
|
3075
3072
|
}
|
|
3076
|
-
|
|
3077
|
-
const
|
|
3073
|
+
W = new WeakMap(), He = new WeakMap();
|
|
3074
|
+
const Mr = (n) => {
|
|
3078
3075
|
var e;
|
|
3079
3076
|
if (!n)
|
|
3080
3077
|
return [!1, "", ""];
|
|
@@ -3087,59 +3084,114 @@ const Rr = (n) => {
|
|
|
3087
3084
|
} catch (t) {
|
|
3088
3085
|
return [!1, "", ""];
|
|
3089
3086
|
}
|
|
3090
|
-
},
|
|
3087
|
+
}, $r = ({
|
|
3091
3088
|
fileKey: n,
|
|
3092
3089
|
nodeId: e
|
|
3093
3090
|
}) => {
|
|
3094
3091
|
const t = new URL("https://www.figma.com");
|
|
3095
3092
|
return t.pathname = `design/${n}`, e && t.searchParams.set("node-id", e.replace(":", "-")), t;
|
|
3096
|
-
}
|
|
3097
|
-
class
|
|
3093
|
+
};
|
|
3094
|
+
class Pr extends Error {
|
|
3095
|
+
constructor(e, t) {
|
|
3096
|
+
super(e), this.response = t;
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
const Fr = ({
|
|
3100
|
+
files: n,
|
|
3101
|
+
screenPath: e = "src/screens"
|
|
3102
|
+
}) => {
|
|
3103
|
+
const t = {}, s = /* @__PURE__ */ new Set();
|
|
3104
|
+
function r(a) {
|
|
3105
|
+
if (s.has(a) || !n[a])
|
|
3106
|
+
return;
|
|
3107
|
+
s.add(a), t[a] = n[a], As(n[a].content).forEach((o) => {
|
|
3108
|
+
try {
|
|
3109
|
+
const c = Os(a, o);
|
|
3110
|
+
if (c.startsWith("src/")) {
|
|
3111
|
+
const u = c.split("/").slice(0, -1).join("/");
|
|
3112
|
+
Cs(n, u).forEach((_) => {
|
|
3113
|
+
s.has(_) || r(_);
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
} catch (c) {
|
|
3117
|
+
console.warn(
|
|
3118
|
+
`Failed to resolve import ${o} in ${a}:`,
|
|
3119
|
+
c
|
|
3120
|
+
);
|
|
3121
|
+
}
|
|
3122
|
+
});
|
|
3123
|
+
}
|
|
3124
|
+
return Object.entries(n).forEach(([a, i]) => {
|
|
3125
|
+
a.startsWith(e) ? r(a) : a.startsWith("src/") || (t[a] = i);
|
|
3126
|
+
}), t;
|
|
3127
|
+
};
|
|
3128
|
+
function As(n) {
|
|
3129
|
+
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
|
|
3130
|
+
let r;
|
|
3131
|
+
for (; (r = e.exec(n)) !== null; )
|
|
3132
|
+
s.push(r[1]);
|
|
3133
|
+
for (; (r = t.exec(n)) !== null; )
|
|
3134
|
+
s.push(r[1]);
|
|
3135
|
+
return [...new Set(s)];
|
|
3136
|
+
}
|
|
3137
|
+
function Os(n, e) {
|
|
3138
|
+
if (!e.startsWith("."))
|
|
3139
|
+
return e;
|
|
3140
|
+
const t = n.split("/").slice(0, -1), s = e.split("/"), r = [...t];
|
|
3141
|
+
for (const a of s)
|
|
3142
|
+
a === ".." ? r.pop() : a !== "." && r.push(a);
|
|
3143
|
+
return r.join("/");
|
|
3144
|
+
}
|
|
3145
|
+
function Cs(n, e) {
|
|
3146
|
+
return Object.keys(n).filter((t) => t.startsWith(e));
|
|
3147
|
+
}
|
|
3148
|
+
const nn = "Figma Token Issue";
|
|
3149
|
+
class Is extends Error {
|
|
3098
3150
|
constructor({ fileKey: e, reason: t }) {
|
|
3099
3151
|
super(nn), this.fileKey = e, this.reason = t;
|
|
3100
3152
|
}
|
|
3101
3153
|
}
|
|
3102
3154
|
const sn = "Rate Limit Exceeded";
|
|
3103
|
-
class
|
|
3155
|
+
class Ns extends Error {
|
|
3104
3156
|
constructor({ fileKey: e }) {
|
|
3105
3157
|
super(sn), this.fileKey = e;
|
|
3106
3158
|
}
|
|
3107
3159
|
}
|
|
3108
3160
|
const rn = "Not Found";
|
|
3109
|
-
class
|
|
3161
|
+
class js extends Error {
|
|
3110
3162
|
constructor({ fileKey: e }) {
|
|
3111
3163
|
super(rn), this.fileKey = e;
|
|
3112
3164
|
}
|
|
3113
3165
|
}
|
|
3114
|
-
const
|
|
3115
|
-
class
|
|
3166
|
+
const Rs = (n) => n.message === rn, an = "Unknown Figma API Exception";
|
|
3167
|
+
class Zs extends Error {
|
|
3116
3168
|
constructor({ fileKey: e, cause: t }) {
|
|
3117
3169
|
super(an), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
3118
3170
|
}
|
|
3119
3171
|
}
|
|
3120
|
-
const
|
|
3172
|
+
const Lr = (n) => n.message === an, Ms = (n) => n.message === sn, $s = (n) => [nn, ...[
|
|
3121
3173
|
"Invalid Figma token",
|
|
3122
3174
|
"Figma token expired"
|
|
3123
3175
|
]].includes(
|
|
3124
3176
|
n.message
|
|
3125
|
-
),
|
|
3126
|
-
var s, r;
|
|
3177
|
+
), Ps = (n, e) => {
|
|
3178
|
+
var s, r, a, i;
|
|
3127
3179
|
const t = ((s = n == null ? void 0 : n.cause) == null ? void 0 : s.body) || n.body;
|
|
3128
|
-
throw (t == null ? void 0 : t.status) === 403 ? new
|
|
3180
|
+
throw (t == null ? void 0 : t.status) === 403 ? new Is({
|
|
3129
3181
|
fileKey: e,
|
|
3130
|
-
reason: ((r = n == null ? void 0 : n.cause) == null ? void 0 : r.body) || n.body
|
|
3131
|
-
}) : (t == null ? void 0 : t.status) === 429 ? new
|
|
3132
|
-
},
|
|
3133
|
-
var
|
|
3182
|
+
reason: (((a = (r = n == null ? void 0 : n.cause) == null ? void 0 : r.body) == null ? void 0 : a.reason) || ((i = n.body) == null ? void 0 : i.reason) || "Access denied").toString()
|
|
3183
|
+
}) : (t == null ? void 0 : t.status) === 429 ? new Ns({ fileKey: e }) : (t == null ? void 0 : t.status) === 404 ? new js({ fileKey: e }) : new Zs({ fileKey: e, cause: n });
|
|
3184
|
+
}, Dr = (n) => Rs(n) ? "NotFound" : Ms(n) ? "RateLimitExceeded" : $s(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
|
|
3185
|
+
var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, Vs = Object.prototype.hasOwnProperty, Us = Object.prototype.propertyIsEnumerable, Lt = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), on = (n) => {
|
|
3134
3186
|
throw TypeError(n);
|
|
3135
|
-
}, Dt = (n, e, t) => e in n ?
|
|
3187
|
+
}, Dt = (n, e, t) => e in n ? Fs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, V = (n, e) => {
|
|
3136
3188
|
for (var t in e || (e = {}))
|
|
3137
|
-
|
|
3138
|
-
if (
|
|
3139
|
-
for (var t of
|
|
3140
|
-
|
|
3189
|
+
Vs.call(e, t) && Dt(n, t, e[t]);
|
|
3190
|
+
if (Ft)
|
|
3191
|
+
for (var t of Ft(e))
|
|
3192
|
+
Us.call(e, t) && Dt(n, t, e[t]);
|
|
3141
3193
|
return n;
|
|
3142
|
-
}, Et = (n, e) =>
|
|
3194
|
+
}, Et = (n, e) => Ls(n, Ds(e)), At = (n, e, t) => e.has(n) || on("Cannot " + t), k = (n, e, t) => (At(n, e, "read from private field"), t ? t.call(n) : e.get(n)), B = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), N = (n, e, t, s) => (At(n, e, "write to private field"), e.set(n, t), t), ee = (n, e, t) => (At(n, e, "access private method"), t), E = (n, e, t) => new Promise((s, r) => {
|
|
3143
3195
|
var a = (c) => {
|
|
3144
3196
|
try {
|
|
3145
3197
|
o(t.next(c));
|
|
@@ -3154,59 +3206,59 @@ var Ps = Object.defineProperty, $s = Object.defineProperties, Ls = Object.getOwn
|
|
|
3154
3206
|
}
|
|
3155
3207
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
3156
3208
|
o((t = t.apply(n, e)).next());
|
|
3157
|
-
}),
|
|
3158
|
-
function
|
|
3209
|
+
}), zs = (n, e, t) => (e = n[Lt("asyncIterator")]) ? e.call(n) : (n = n[Lt("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), Ws = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
3210
|
+
function Bs(n) {
|
|
3159
3211
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
3160
3212
|
}
|
|
3161
|
-
var
|
|
3162
|
-
function
|
|
3213
|
+
var yt = { exports: {} }, qs = yt.exports, Vt;
|
|
3214
|
+
function Hs() {
|
|
3163
3215
|
return Vt || (Vt = 1, function(n, e) {
|
|
3164
3216
|
(function(t, s) {
|
|
3165
3217
|
n.exports = s();
|
|
3166
|
-
})(
|
|
3167
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self :
|
|
3168
|
-
function
|
|
3169
|
-
var
|
|
3170
|
-
if (
|
|
3171
|
-
return
|
|
3172
|
-
if (
|
|
3218
|
+
})(qs, function() {
|
|
3219
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", C = i && typeof Set.prototype.entries == "function", A = a && typeof Map.prototype.entries == "function", O = C && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), R = A && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), q = f && typeof Array.prototype[Symbol.iterator] == "function", z = q && Object.getPrototypeOf([][Symbol.iterator]()), re = f && typeof String.prototype[Symbol.iterator] == "function", L = re && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, T = -1;
|
|
3220
|
+
function Ct(I) {
|
|
3221
|
+
var It = typeof I;
|
|
3222
|
+
if (It !== "object")
|
|
3223
|
+
return It;
|
|
3224
|
+
if (I === null)
|
|
3173
3225
|
return "null";
|
|
3174
|
-
if (
|
|
3226
|
+
if (I === s)
|
|
3175
3227
|
return "global";
|
|
3176
|
-
if (Array.isArray(
|
|
3228
|
+
if (Array.isArray(I) && (_ === !1 || !(Symbol.toStringTag in I)))
|
|
3177
3229
|
return "Array";
|
|
3178
3230
|
if (typeof window == "object" && window !== null) {
|
|
3179
|
-
if (typeof window.location == "object" &&
|
|
3231
|
+
if (typeof window.location == "object" && I === window.location)
|
|
3180
3232
|
return "Location";
|
|
3181
|
-
if (typeof window.document == "object" &&
|
|
3233
|
+
if (typeof window.document == "object" && I === window.document)
|
|
3182
3234
|
return "Document";
|
|
3183
3235
|
if (typeof window.navigator == "object") {
|
|
3184
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
3236
|
+
if (typeof window.navigator.mimeTypes == "object" && I === window.navigator.mimeTypes)
|
|
3185
3237
|
return "MimeTypeArray";
|
|
3186
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
3238
|
+
if (typeof window.navigator.plugins == "object" && I === window.navigator.plugins)
|
|
3187
3239
|
return "PluginArray";
|
|
3188
3240
|
}
|
|
3189
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
3190
|
-
if (
|
|
3241
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && I instanceof window.HTMLElement) {
|
|
3242
|
+
if (I.tagName === "BLOCKQUOTE")
|
|
3191
3243
|
return "HTMLQuoteElement";
|
|
3192
|
-
if (
|
|
3244
|
+
if (I.tagName === "TD")
|
|
3193
3245
|
return "HTMLTableDataCellElement";
|
|
3194
|
-
if (
|
|
3246
|
+
if (I.tagName === "TH")
|
|
3195
3247
|
return "HTMLTableHeaderCellElement";
|
|
3196
3248
|
}
|
|
3197
3249
|
}
|
|
3198
|
-
var
|
|
3199
|
-
if (typeof
|
|
3200
|
-
return
|
|
3201
|
-
var
|
|
3202
|
-
return
|
|
3250
|
+
var Nt = _ && I[Symbol.toStringTag];
|
|
3251
|
+
if (typeof Nt == "string")
|
|
3252
|
+
return Nt;
|
|
3253
|
+
var D = Object.getPrototypeOf(I);
|
|
3254
|
+
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 === O ? "Set Iterator" : q && D === z ? "Array Iterator" : re && D === L ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(I).slice(K, T);
|
|
3203
3255
|
}
|
|
3204
|
-
return
|
|
3256
|
+
return Ct;
|
|
3205
3257
|
});
|
|
3206
|
-
}(
|
|
3258
|
+
}(yt)), yt.exports;
|
|
3207
3259
|
}
|
|
3208
|
-
var
|
|
3209
|
-
const
|
|
3260
|
+
var Js = Hs();
|
|
3261
|
+
const Gs = /* @__PURE__ */ Bs(Js), Ot = typeof Buffer != "undefined", Ks = Ot && typeof Buffer.from != "undefined", Xs = Ot ? (
|
|
3210
3262
|
/**
|
|
3211
3263
|
* is value is Buffer?
|
|
3212
3264
|
*
|
|
@@ -3227,7 +3279,7 @@ const Hs = /* @__PURE__ */ zs(qs), Ct = typeof Buffer != "undefined", Js = Ct &&
|
|
|
3227
3279
|
function() {
|
|
3228
3280
|
return !1;
|
|
3229
3281
|
}
|
|
3230
|
-
),
|
|
3282
|
+
), Ys = Ks ? (
|
|
3231
3283
|
/**
|
|
3232
3284
|
* copy Buffer
|
|
3233
3285
|
*
|
|
@@ -3237,7 +3289,7 @@ const Hs = /* @__PURE__ */ zs(qs), Ct = typeof Buffer != "undefined", Js = Ct &&
|
|
|
3237
3289
|
function(n) {
|
|
3238
3290
|
return Buffer.from(n);
|
|
3239
3291
|
}
|
|
3240
|
-
) :
|
|
3292
|
+
) : Ot ? (
|
|
3241
3293
|
/**
|
|
3242
3294
|
* copy Buffer
|
|
3243
3295
|
*
|
|
@@ -3262,18 +3314,18 @@ const Hs = /* @__PURE__ */ zs(qs), Ct = typeof Buffer != "undefined", Js = Ct &&
|
|
|
3262
3314
|
return n;
|
|
3263
3315
|
}
|
|
3264
3316
|
);
|
|
3265
|
-
function
|
|
3266
|
-
return
|
|
3317
|
+
function Ee(n) {
|
|
3318
|
+
return Xs(n) ? "Buffer" : Gs(n);
|
|
3267
3319
|
}
|
|
3268
|
-
const
|
|
3320
|
+
const Qs = /* @__PURE__ */ new Set([
|
|
3269
3321
|
"Arguments",
|
|
3270
3322
|
"Array",
|
|
3271
3323
|
"Map",
|
|
3272
3324
|
"Object",
|
|
3273
3325
|
"Set"
|
|
3274
3326
|
]);
|
|
3275
|
-
function
|
|
3276
|
-
switch (t ||
|
|
3327
|
+
function er(n, e, t = null) {
|
|
3328
|
+
switch (t || Ee(n)) {
|
|
3277
3329
|
case "Arguments":
|
|
3278
3330
|
case "Array":
|
|
3279
3331
|
case "Object":
|
|
@@ -3284,11 +3336,11 @@ function Ys(n, e, t = null) {
|
|
|
3284
3336
|
return e;
|
|
3285
3337
|
}
|
|
3286
3338
|
}
|
|
3287
|
-
function
|
|
3288
|
-
return
|
|
3339
|
+
function gt(n) {
|
|
3340
|
+
return Qs.has(n);
|
|
3289
3341
|
}
|
|
3290
3342
|
function Ut(n, e, t, s = null) {
|
|
3291
|
-
switch (s ||
|
|
3343
|
+
switch (s || Ee(n)) {
|
|
3292
3344
|
case "Arguments":
|
|
3293
3345
|
case "Array":
|
|
3294
3346
|
case "Object":
|
|
@@ -3303,33 +3355,33 @@ function Ut(n, e, t, s = null) {
|
|
|
3303
3355
|
}
|
|
3304
3356
|
return n;
|
|
3305
3357
|
}
|
|
3306
|
-
const
|
|
3307
|
-
function
|
|
3358
|
+
const tr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, nr = typeof global != "undefined" && global !== null && global.Object === Object && global, sr = typeof self != "undefined" && self !== null && self.Object === Object && self, dt = tr || nr || sr || Function("return this")();
|
|
3359
|
+
function rr(n) {
|
|
3308
3360
|
return n.slice(0);
|
|
3309
3361
|
}
|
|
3310
|
-
function
|
|
3362
|
+
function ar(n) {
|
|
3311
3363
|
return new Boolean(n.valueOf());
|
|
3312
3364
|
}
|
|
3313
|
-
function
|
|
3365
|
+
function ir(n) {
|
|
3314
3366
|
return new DataView(n.buffer);
|
|
3315
3367
|
}
|
|
3316
|
-
function
|
|
3317
|
-
return
|
|
3368
|
+
function or(n) {
|
|
3369
|
+
return Ys(n);
|
|
3318
3370
|
}
|
|
3319
|
-
function
|
|
3371
|
+
function cr(n) {
|
|
3320
3372
|
return new Date(n.getTime());
|
|
3321
3373
|
}
|
|
3322
|
-
function
|
|
3374
|
+
function dr(n) {
|
|
3323
3375
|
return new Number(n);
|
|
3324
3376
|
}
|
|
3325
|
-
function
|
|
3377
|
+
function ur(n) {
|
|
3326
3378
|
return new RegExp(n.source, n.flags);
|
|
3327
3379
|
}
|
|
3328
|
-
function
|
|
3380
|
+
function lr(n) {
|
|
3329
3381
|
return new String(n);
|
|
3330
3382
|
}
|
|
3331
3383
|
function ae(n, e) {
|
|
3332
|
-
return
|
|
3384
|
+
return dt[e].from ? dt[e].from(n) : new dt[e](n);
|
|
3333
3385
|
}
|
|
3334
3386
|
function Z(n) {
|
|
3335
3387
|
return n;
|
|
@@ -3337,25 +3389,25 @@ function Z(n) {
|
|
|
3337
3389
|
function zt() {
|
|
3338
3390
|
return [];
|
|
3339
3391
|
}
|
|
3340
|
-
function
|
|
3392
|
+
function fr() {
|
|
3341
3393
|
return /* @__PURE__ */ new Map();
|
|
3342
3394
|
}
|
|
3343
|
-
function
|
|
3395
|
+
function hr() {
|
|
3344
3396
|
return {};
|
|
3345
3397
|
}
|
|
3346
|
-
function
|
|
3398
|
+
function pr() {
|
|
3347
3399
|
return /* @__PURE__ */ new Set();
|
|
3348
3400
|
}
|
|
3349
|
-
const
|
|
3401
|
+
const mr = /* @__PURE__ */ new Map([
|
|
3350
3402
|
// deep copy
|
|
3351
|
-
["ArrayBuffer",
|
|
3352
|
-
["Boolean",
|
|
3353
|
-
["Buffer",
|
|
3354
|
-
["DataView",
|
|
3355
|
-
["Date",
|
|
3356
|
-
["Number",
|
|
3357
|
-
["RegExp",
|
|
3358
|
-
["String",
|
|
3403
|
+
["ArrayBuffer", rr],
|
|
3404
|
+
["Boolean", ar],
|
|
3405
|
+
["Buffer", or],
|
|
3406
|
+
["DataView", ir],
|
|
3407
|
+
["Date", cr],
|
|
3408
|
+
["Number", dr],
|
|
3409
|
+
["RegExp", ur],
|
|
3410
|
+
["String", lr],
|
|
3359
3411
|
// typed arrays
|
|
3360
3412
|
// TODO: pass bound function
|
|
3361
3413
|
["Float32Array", ae],
|
|
@@ -3389,9 +3441,9 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
3389
3441
|
// NOTE: return empty value, because recursively copy later.
|
|
3390
3442
|
["Arguments", zt],
|
|
3391
3443
|
["Array", zt],
|
|
3392
|
-
["Map",
|
|
3393
|
-
["Object",
|
|
3394
|
-
["Set",
|
|
3444
|
+
["Map", fr],
|
|
3445
|
+
["Object", hr],
|
|
3446
|
+
["Set", pr]
|
|
3395
3447
|
// NOTE: type-detect returns following types
|
|
3396
3448
|
// 'Location'
|
|
3397
3449
|
// 'Document'
|
|
@@ -3403,11 +3455,11 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
3403
3455
|
// TODO: is type-detect never return 'object'?
|
|
3404
3456
|
// 'object'
|
|
3405
3457
|
]);
|
|
3406
|
-
function
|
|
3458
|
+
function yr() {
|
|
3407
3459
|
}
|
|
3408
|
-
function
|
|
3460
|
+
function vt(n, e = null, t = yr) {
|
|
3409
3461
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
3410
|
-
const s = e ||
|
|
3462
|
+
const s = e || Ee(n), r = mr.get(s);
|
|
3411
3463
|
if (s === "Object") {
|
|
3412
3464
|
const a = t(n, s);
|
|
3413
3465
|
if (a !== void 0)
|
|
@@ -3424,15 +3476,15 @@ function Oe(n, e = {}) {
|
|
|
3424
3476
|
customizer: t
|
|
3425
3477
|
// TODO: max depth
|
|
3426
3478
|
// depth = Infinity,
|
|
3427
|
-
} = e, s =
|
|
3428
|
-
if (!
|
|
3429
|
-
return
|
|
3430
|
-
const r =
|
|
3431
|
-
return
|
|
3432
|
-
}
|
|
3433
|
-
function
|
|
3434
|
-
const a =
|
|
3435
|
-
if (!
|
|
3479
|
+
} = e, s = Ee(n);
|
|
3480
|
+
if (!gt(s))
|
|
3481
|
+
return _t(n, null, null, null);
|
|
3482
|
+
const r = vt(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
|
|
3483
|
+
return _t(n, r, a, i);
|
|
3484
|
+
}
|
|
3485
|
+
function _t(n, e, t, s, r) {
|
|
3486
|
+
const a = Ee(n), i = vt(n, a);
|
|
3487
|
+
if (!gt(a))
|
|
3436
3488
|
return i;
|
|
3437
3489
|
let o;
|
|
3438
3490
|
switch (a) {
|
|
@@ -3449,15 +3501,15 @@ function bt(n, e, t, s, r) {
|
|
|
3449
3501
|
break;
|
|
3450
3502
|
}
|
|
3451
3503
|
for (let c of o) {
|
|
3452
|
-
const u =
|
|
3504
|
+
const u = er(n, c, a);
|
|
3453
3505
|
if (s.has(u))
|
|
3454
3506
|
Ut(e, c, t.get(u), a);
|
|
3455
3507
|
else {
|
|
3456
|
-
const
|
|
3457
|
-
|
|
3508
|
+
const f = Ee(u), _ = vt(u, f);
|
|
3509
|
+
gt(f) && (t.set(u, _), s.add(u)), Ut(
|
|
3458
3510
|
e,
|
|
3459
3511
|
c,
|
|
3460
|
-
|
|
3512
|
+
_t(
|
|
3461
3513
|
u,
|
|
3462
3514
|
_,
|
|
3463
3515
|
t,
|
|
@@ -3469,36 +3521,36 @@ function bt(n, e, t, s, r) {
|
|
|
3469
3521
|
}
|
|
3470
3522
|
return e;
|
|
3471
3523
|
}
|
|
3472
|
-
const
|
|
3473
|
-
var
|
|
3474
|
-
class
|
|
3524
|
+
const gr = (n) => new Promise((e) => setTimeout(e, n));
|
|
3525
|
+
var Ge, pe, Ke, bt, cn;
|
|
3526
|
+
class vr {
|
|
3475
3527
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
3476
|
-
|
|
3528
|
+
B(this, bt), B(this, Ge), B(this, pe), B(this, Ke), N(this, Ge, e), N(this, Ke, t), N(this, pe, 0);
|
|
3477
3529
|
}
|
|
3478
3530
|
run() {
|
|
3479
|
-
return
|
|
3531
|
+
return E(this, null, function* () {
|
|
3480
3532
|
try {
|
|
3481
|
-
return yield k(this,
|
|
3533
|
+
return yield k(this, Ke).call(this);
|
|
3482
3534
|
} catch (e) {
|
|
3483
|
-
if (
|
|
3535
|
+
if (N(this, pe, k(this, pe) + 1), k(this, pe) > k(this, Ge))
|
|
3484
3536
|
throw console.error("Max attempts reached"), e;
|
|
3485
|
-
const t = ee(this,
|
|
3486
|
-
return yield
|
|
3537
|
+
const t = ee(this, bt, cn).call(this);
|
|
3538
|
+
return yield gr(t), yield this.run();
|
|
3487
3539
|
}
|
|
3488
3540
|
});
|
|
3489
3541
|
}
|
|
3490
3542
|
}
|
|
3491
|
-
|
|
3543
|
+
Ge = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakSet(), cn = function() {
|
|
3492
3544
|
return k(this, pe) * 1e3 * 1.5;
|
|
3493
3545
|
};
|
|
3494
|
-
function
|
|
3546
|
+
function _r() {
|
|
3495
3547
|
return typeof CompressionStream != "undefined";
|
|
3496
3548
|
}
|
|
3497
|
-
function
|
|
3498
|
-
return
|
|
3549
|
+
function br(n) {
|
|
3550
|
+
return E(this, null, function* () {
|
|
3499
3551
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
3500
3552
|
try {
|
|
3501
|
-
for (var s =
|
|
3553
|
+
for (var s = zs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
3502
3554
|
const o = a.value;
|
|
3503
3555
|
t.push(o);
|
|
3504
3556
|
}
|
|
@@ -3512,23 +3564,23 @@ function vr(n) {
|
|
|
3512
3564
|
throw i[0];
|
|
3513
3565
|
}
|
|
3514
3566
|
}
|
|
3515
|
-
return yield
|
|
3567
|
+
return yield wr(t);
|
|
3516
3568
|
});
|
|
3517
3569
|
}
|
|
3518
|
-
function
|
|
3519
|
-
return
|
|
3570
|
+
function wr(n) {
|
|
3571
|
+
return E(this, null, function* () {
|
|
3520
3572
|
const e = yield new Blob(n).arrayBuffer();
|
|
3521
3573
|
return new Uint8Array(e);
|
|
3522
3574
|
});
|
|
3523
3575
|
}
|
|
3524
|
-
class
|
|
3576
|
+
class xr extends Error {
|
|
3525
3577
|
constructor({ resource: e, api: t, args: s, cause: r }) {
|
|
3526
3578
|
if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause = r, this.args = s, r instanceof Error)
|
|
3527
3579
|
for (const [i, o] of Object.entries(r))
|
|
3528
3580
|
if (typeof Headers != "undefined" && o instanceof Headers) {
|
|
3529
3581
|
const c = {};
|
|
3530
|
-
o.forEach((u,
|
|
3531
|
-
c[
|
|
3582
|
+
o.forEach((u, f) => {
|
|
3583
|
+
c[f] = u;
|
|
3532
3584
|
}), this.causeProperties[i] = c;
|
|
3533
3585
|
} else
|
|
3534
3586
|
this.causeProperties[i] = o;
|
|
@@ -3536,7 +3588,7 @@ class br extends Error {
|
|
|
3536
3588
|
a && typeof a == "object" && "code" in a && (this.code = a.code);
|
|
3537
3589
|
}
|
|
3538
3590
|
}
|
|
3539
|
-
class
|
|
3591
|
+
class Wt extends Error {
|
|
3540
3592
|
constructor({
|
|
3541
3593
|
url: e,
|
|
3542
3594
|
method: t,
|
|
@@ -3554,18 +3606,18 @@ class Bt extends Error {
|
|
|
3554
3606
|
}
|
|
3555
3607
|
}
|
|
3556
3608
|
}
|
|
3557
|
-
class
|
|
3609
|
+
class Ne extends Error {
|
|
3558
3610
|
constructor(e = {}) {
|
|
3559
3611
|
const { canceled: t = !1 } = e;
|
|
3560
3612
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
3561
3613
|
}
|
|
3562
3614
|
}
|
|
3563
|
-
class
|
|
3615
|
+
class kr extends Error {
|
|
3564
3616
|
constructor(e) {
|
|
3565
3617
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
3566
3618
|
}
|
|
3567
3619
|
}
|
|
3568
|
-
class
|
|
3620
|
+
class ut extends Error {
|
|
3569
3621
|
constructor(e) {
|
|
3570
3622
|
super(e), this.name = "Request Validation Error";
|
|
3571
3623
|
}
|
|
@@ -3576,14 +3628,14 @@ function dn() {
|
|
|
3576
3628
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
3577
3629
|
).join("");
|
|
3578
3630
|
}
|
|
3579
|
-
function
|
|
3631
|
+
function wt() {
|
|
3580
3632
|
return Math.floor(Date.now() / 1e3).toString();
|
|
3581
3633
|
}
|
|
3582
|
-
const
|
|
3583
|
-
var me,
|
|
3584
|
-
class
|
|
3634
|
+
const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
|
|
3635
|
+
var me, F, Y, xt, kt, je;
|
|
3636
|
+
class Er {
|
|
3585
3637
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
3586
|
-
|
|
3638
|
+
B(this, Y), B(this, me), B(this, F), this.baseAddress = t, N(this, me, e), N(this, F, {}), this.plugins = [];
|
|
3587
3639
|
}
|
|
3588
3640
|
get headers() {
|
|
3589
3641
|
throw new Error("Missing implementation");
|
|
@@ -3595,58 +3647,58 @@ class Tr {
|
|
|
3595
3647
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
3596
3648
|
}
|
|
3597
3649
|
withOptions(e = {}) {
|
|
3598
|
-
return
|
|
3650
|
+
return N(this, F, e), this;
|
|
3599
3651
|
}
|
|
3600
3652
|
get(e) {
|
|
3601
|
-
return
|
|
3653
|
+
return E(this, arguments, function* (t, s = {}) {
|
|
3602
3654
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
3603
3655
|
let o = a != null ? a : this.headers;
|
|
3604
|
-
const c = Oe(k(this,
|
|
3605
|
-
return
|
|
3656
|
+
const c = Oe(k(this, F));
|
|
3657
|
+
return N(this, F, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Et(V({}, o), { "X-Request-Nonce": dn(), "X-Request-Timestamp": wt() })), c.async ? yield ee(this, Y, kt).call(this, `${i}${t}`, c.async, { headers: o }) : yield ee(this, Y, xt).call(this, `${i}${t}`, c, { headers: o });
|
|
3606
3658
|
});
|
|
3607
3659
|
}
|
|
3608
3660
|
post(e, t) {
|
|
3609
|
-
return
|
|
3610
|
-
const i = Oe(k(this,
|
|
3611
|
-
return
|
|
3661
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3662
|
+
const i = Oe(k(this, F));
|
|
3663
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "POST", r, a, i);
|
|
3612
3664
|
});
|
|
3613
3665
|
}
|
|
3614
3666
|
put(e, t) {
|
|
3615
|
-
return
|
|
3616
|
-
const i = Oe(k(this,
|
|
3617
|
-
return
|
|
3667
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3668
|
+
const i = Oe(k(this, F));
|
|
3669
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "PUT", r, a, i);
|
|
3618
3670
|
});
|
|
3619
3671
|
}
|
|
3620
3672
|
delete(e, t) {
|
|
3621
|
-
return
|
|
3622
|
-
const i = Oe(k(this,
|
|
3623
|
-
return
|
|
3673
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3674
|
+
const i = Oe(k(this, F));
|
|
3675
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "DELETE", r, a, i);
|
|
3624
3676
|
});
|
|
3625
3677
|
}
|
|
3626
3678
|
patch(e, t) {
|
|
3627
|
-
return
|
|
3628
|
-
const i = Oe(k(this,
|
|
3629
|
-
return
|
|
3679
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3680
|
+
const i = Oe(k(this, F));
|
|
3681
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "PATCH", r, a, i);
|
|
3630
3682
|
});
|
|
3631
3683
|
}
|
|
3632
3684
|
}
|
|
3633
|
-
me = /* @__PURE__ */ new WeakMap(),
|
|
3634
|
-
return
|
|
3635
|
-
const s = () =>
|
|
3685
|
+
me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), xt = function(n, e, t) {
|
|
3686
|
+
return E(this, null, function* () {
|
|
3687
|
+
const s = () => E(this, null, function* () {
|
|
3636
3688
|
var c, u;
|
|
3637
3689
|
try {
|
|
3638
3690
|
return yield k(this, me).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
3639
|
-
} catch (
|
|
3640
|
-
throw
|
|
3691
|
+
} catch (f) {
|
|
3692
|
+
throw f instanceof Error && f.name === "AbortError" ? new Ne({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : f;
|
|
3641
3693
|
}
|
|
3642
3694
|
}), { headers: r } = t != null ? t : {}, a = (c, u) => {
|
|
3643
|
-
var
|
|
3644
|
-
return ((
|
|
3645
|
-
}, i = (c) =>
|
|
3695
|
+
var f, _;
|
|
3696
|
+
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(u)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[u]) || "";
|
|
3697
|
+
}, i = (c) => E(this, null, function* () {
|
|
3646
3698
|
var u;
|
|
3647
3699
|
if (!c.ok) {
|
|
3648
3700
|
const _ = yield c.text().catch();
|
|
3649
|
-
throw new
|
|
3701
|
+
throw new Wt({
|
|
3650
3702
|
url: n,
|
|
3651
3703
|
method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
|
|
3652
3704
|
statusCode: c.status,
|
|
@@ -3657,25 +3709,25 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3657
3709
|
}
|
|
3658
3710
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
3659
3711
|
try {
|
|
3660
|
-
const _ = a(c, "x-response-nonce"),
|
|
3661
|
-
if (!_ || _ !==
|
|
3662
|
-
throw new
|
|
3663
|
-
const
|
|
3664
|
-
if (isNaN(
|
|
3665
|
-
throw new
|
|
3712
|
+
const _ = a(c, "x-response-nonce"), C = r == null ? void 0 : r["X-Request-Nonce"];
|
|
3713
|
+
if (!_ || _ !== C)
|
|
3714
|
+
throw new ut("Response nonce mismatch");
|
|
3715
|
+
const A = Number(a(c, "x-response-timestamp")), O = Number(wt()), R = 60 * 60 * 24;
|
|
3716
|
+
if (isNaN(A) || Math.abs(O - A) > R)
|
|
3717
|
+
throw new ut("Invalid response timestamp");
|
|
3666
3718
|
} catch (_) {
|
|
3667
|
-
const
|
|
3668
|
-
throw new
|
|
3719
|
+
const C = _ instanceof Error ? _.message : "Request validation failed";
|
|
3720
|
+
throw new ut(C);
|
|
3669
3721
|
}
|
|
3670
|
-
let
|
|
3722
|
+
let f = yield c.text();
|
|
3671
3723
|
try {
|
|
3672
|
-
|
|
3724
|
+
f = JSON.parse(f);
|
|
3673
3725
|
} catch (_) {
|
|
3674
3726
|
}
|
|
3675
|
-
return
|
|
3727
|
+
return f;
|
|
3676
3728
|
});
|
|
3677
3729
|
if (e.retry) {
|
|
3678
|
-
const c = yield new
|
|
3730
|
+
const c = yield new vr({
|
|
3679
3731
|
maxAttempts: e.retry,
|
|
3680
3732
|
func: s
|
|
3681
3733
|
}).run();
|
|
@@ -3684,55 +3736,55 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3684
3736
|
const o = yield s();
|
|
3685
3737
|
return yield i(o);
|
|
3686
3738
|
});
|
|
3687
|
-
},
|
|
3688
|
-
return
|
|
3739
|
+
}, kt = function(n, e, t) {
|
|
3740
|
+
return E(this, null, function* () {
|
|
3689
3741
|
var s, r;
|
|
3690
3742
|
const {
|
|
3691
3743
|
onProgress: a,
|
|
3692
3744
|
abortSignal: i,
|
|
3693
|
-
pollingInterval: o = () =>
|
|
3694
|
-
maxTimeout: c =
|
|
3695
|
-
} = e, u = `${n}/async`,
|
|
3745
|
+
pollingInterval: o = () => Sr,
|
|
3746
|
+
maxTimeout: c = Tr
|
|
3747
|
+
} = e, u = `${n}/async`, f = `${n}/async/job`;
|
|
3696
3748
|
let _;
|
|
3697
3749
|
try {
|
|
3698
3750
|
_ = yield k(this, me).call(this, u, V(V({}, t), i && { signal: i }));
|
|
3699
|
-
} catch (
|
|
3700
|
-
throw
|
|
3751
|
+
} catch (O) {
|
|
3752
|
+
throw O instanceof Error && O.name === "AbortError" ? new Ne({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : O;
|
|
3701
3753
|
}
|
|
3702
3754
|
if (!_.ok) {
|
|
3703
|
-
const
|
|
3704
|
-
throw new
|
|
3755
|
+
const O = yield _.text().catch();
|
|
3756
|
+
throw new Wt({
|
|
3705
3757
|
url: n,
|
|
3706
3758
|
method: (r = t == null ? void 0 : t.method) != null ? r : "GET",
|
|
3707
3759
|
statusCode: _.status,
|
|
3708
3760
|
requestHeaders: this.headers,
|
|
3709
3761
|
responseHeaders: _.headers,
|
|
3710
|
-
body:
|
|
3762
|
+
body: O
|
|
3711
3763
|
});
|
|
3712
3764
|
}
|
|
3713
|
-
const
|
|
3714
|
-
if (!
|
|
3765
|
+
const C = yield _.json(), { job_id: A } = C;
|
|
3766
|
+
if (!A)
|
|
3715
3767
|
throw new Error("Job ID not found in response");
|
|
3716
|
-
return new Promise((
|
|
3768
|
+
return new Promise((O, R) => E(this, null, function* () {
|
|
3717
3769
|
const q = setTimeout(() => {
|
|
3718
3770
|
R(new Error("Job timed out"));
|
|
3719
|
-
}, c), z = (re = 0) =>
|
|
3771
|
+
}, c), z = (re = 0) => E(this, null, function* () {
|
|
3720
3772
|
if (i != null && i.aborted) {
|
|
3721
|
-
clearTimeout(q), k(this, me).call(this, `${
|
|
3722
|
-
R(new
|
|
3773
|
+
clearTimeout(q), k(this, me).call(this, `${f}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
3774
|
+
R(new Ne({ canceled: !0 }));
|
|
3723
3775
|
}).catch((L) => {
|
|
3724
|
-
R(new
|
|
3776
|
+
R(new Ne({ canceled: !1 }));
|
|
3725
3777
|
});
|
|
3726
3778
|
return;
|
|
3727
3779
|
}
|
|
3728
3780
|
try {
|
|
3729
|
-
const L = yield (yield k(this, me).call(this, `${
|
|
3781
|
+
const L = yield (yield k(this, me).call(this, `${f}/${A}`, { headers: this.headers })).json();
|
|
3730
3782
|
if (L.status === "success") {
|
|
3731
3783
|
clearTimeout(q);
|
|
3732
3784
|
const K = L.response_json;
|
|
3733
|
-
|
|
3785
|
+
O(K);
|
|
3734
3786
|
} else if (L.status === "failed")
|
|
3735
|
-
clearTimeout(q), R(new
|
|
3787
|
+
clearTimeout(q), R(new kr(L.response_json));
|
|
3736
3788
|
else {
|
|
3737
3789
|
a && a(L.response_json);
|
|
3738
3790
|
const K = o(re);
|
|
@@ -3745,20 +3797,20 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3745
3797
|
z();
|
|
3746
3798
|
}));
|
|
3747
3799
|
});
|
|
3748
|
-
},
|
|
3749
|
-
return
|
|
3800
|
+
}, je = function(n, e, t, s, r) {
|
|
3801
|
+
return E(this, null, function* () {
|
|
3750
3802
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
3751
3803
|
let c = i != null ? i : this.headers;
|
|
3752
|
-
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce": dn(), "X-Request-Timestamp":
|
|
3804
|
+
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce": dn(), "X-Request-Timestamp": wt() }));
|
|
3753
3805
|
let u = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
3754
|
-
return r.compress &&
|
|
3806
|
+
return r.compress && _r() && (c["Content-Encoding"] = "gzip", u = yield br(u)), r.async ? yield ee(this, Y, kt).call(this, `${o}${n}`, r.async, {
|
|
3755
3807
|
method: e,
|
|
3756
3808
|
headers: c,
|
|
3757
3809
|
body: u
|
|
3758
|
-
}) : yield ee(this, Y,
|
|
3810
|
+
}) : yield ee(this, Y, xt).call(this, `${o}${n}`, r, { method: e, headers: c, body: u });
|
|
3759
3811
|
});
|
|
3760
3812
|
};
|
|
3761
|
-
const
|
|
3813
|
+
const Bt = (n, e, t, s) => n instanceof Ne ? n : new xr({ resource: e, api: String(t), args: s, cause: n }), lt = (n, e) => new Proxy(e, {
|
|
3762
3814
|
get(t, s) {
|
|
3763
3815
|
return (...r) => {
|
|
3764
3816
|
var a;
|
|
@@ -3771,21 +3823,21 @@ const Wt = (n, e, t, s) => n instanceof je ? n : new br({ resource: e, api: Stri
|
|
|
3771
3823
|
try {
|
|
3772
3824
|
i = t[s](...r);
|
|
3773
3825
|
} catch (o) {
|
|
3774
|
-
throw
|
|
3826
|
+
throw Bt(o, t.resourceName, s, r);
|
|
3775
3827
|
}
|
|
3776
3828
|
return i instanceof Promise ? i.catch((o) => {
|
|
3777
|
-
throw
|
|
3829
|
+
throw Bt(o, t.resourceName, s, r);
|
|
3778
3830
|
}) : i;
|
|
3779
3831
|
};
|
|
3780
3832
|
}
|
|
3781
3833
|
});
|
|
3782
3834
|
var Re;
|
|
3783
|
-
class
|
|
3835
|
+
class Ar {
|
|
3784
3836
|
constructor(e) {
|
|
3785
|
-
|
|
3837
|
+
B(this, Re), this.resourceName = "Files", N(this, Re, e);
|
|
3786
3838
|
}
|
|
3787
3839
|
get(e) {
|
|
3788
|
-
return
|
|
3840
|
+
return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
3789
3841
|
const r = new URLSearchParams(V({
|
|
3790
3842
|
plugin_data: "857346721138427857"
|
|
3791
3843
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
@@ -3793,7 +3845,7 @@ class Sr {
|
|
|
3793
3845
|
});
|
|
3794
3846
|
}
|
|
3795
3847
|
getImageFills(e) {
|
|
3796
|
-
return
|
|
3848
|
+
return E(this, arguments, function* ({ fileKey: t }) {
|
|
3797
3849
|
var s, r;
|
|
3798
3850
|
const a = `v1/files/${t}/images`;
|
|
3799
3851
|
return (r = (s = (yield k(this, Re).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
@@ -3801,29 +3853,29 @@ class Sr {
|
|
|
3801
3853
|
}
|
|
3802
3854
|
}
|
|
3803
3855
|
Re = /* @__PURE__ */ new WeakMap();
|
|
3804
|
-
const
|
|
3856
|
+
const Or = (n, e, t) => {
|
|
3805
3857
|
const s = e.sort();
|
|
3806
3858
|
return `${n}-${s.join("-")}-${t}`;
|
|
3807
|
-
},
|
|
3808
|
-
var Q,
|
|
3809
|
-
class
|
|
3859
|
+
}, Cr = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
3860
|
+
var Q, Tt, un;
|
|
3861
|
+
class Ir {
|
|
3810
3862
|
constructor(e) {
|
|
3811
|
-
|
|
3863
|
+
B(this, Tt), B(this, Q), this.resourceName = "Images", N(this, Q, e);
|
|
3812
3864
|
}
|
|
3813
3865
|
/**
|
|
3814
3866
|
* Return the URL for the _layer_ images for the given nodes.
|
|
3815
3867
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
3816
3868
|
*/
|
|
3817
3869
|
get(e) {
|
|
3818
|
-
return
|
|
3819
|
-
const i =
|
|
3820
|
-
if (
|
|
3870
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
3871
|
+
const i = Or(t, s, r), o = k(this, Q).cache.images.entries.get(i);
|
|
3872
|
+
if (Cr(o))
|
|
3821
3873
|
return o.result;
|
|
3822
3874
|
o && k(this, Q).cache.images.entries.delete(i);
|
|
3823
3875
|
const c = k(this, Q).cache.images.pendingRequests.get(i);
|
|
3824
3876
|
if (c)
|
|
3825
3877
|
return c;
|
|
3826
|
-
const u = ee(this,
|
|
3878
|
+
const u = ee(this, Tt, un).call(this, i, t, s, r, a);
|
|
3827
3879
|
k(this, Q).cache.images.pendingRequests.set(i, u);
|
|
3828
3880
|
try {
|
|
3829
3881
|
return yield u;
|
|
@@ -3833,8 +3885,8 @@ class Or {
|
|
|
3833
3885
|
});
|
|
3834
3886
|
}
|
|
3835
3887
|
}
|
|
3836
|
-
Q = /* @__PURE__ */ new WeakMap(),
|
|
3837
|
-
return
|
|
3888
|
+
Q = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakSet(), un = function(n, e, t, s, r) {
|
|
3889
|
+
return E(this, null, function* () {
|
|
3838
3890
|
const a = yield k(this, Q).get(
|
|
3839
3891
|
`v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
3840
3892
|
);
|
|
@@ -3844,40 +3896,40 @@ Q = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), un = func
|
|
|
3844
3896
|
}), a;
|
|
3845
3897
|
});
|
|
3846
3898
|
};
|
|
3847
|
-
var
|
|
3848
|
-
class
|
|
3899
|
+
var Xe;
|
|
3900
|
+
class Nr {
|
|
3849
3901
|
constructor(e) {
|
|
3850
|
-
|
|
3902
|
+
B(this, Xe), this.resourceName = "Nodes", N(this, Xe, e);
|
|
3851
3903
|
}
|
|
3852
3904
|
get(e) {
|
|
3853
|
-
return
|
|
3905
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
3854
3906
|
const a = Et(V({}, r), {
|
|
3855
3907
|
ids: s.join(",")
|
|
3856
3908
|
}), i = new URLSearchParams(V({
|
|
3857
3909
|
plugin_data: "857346721138427857"
|
|
3858
3910
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
3859
|
-
return yield k(this,
|
|
3911
|
+
return yield k(this, Xe).get(o);
|
|
3860
3912
|
});
|
|
3861
3913
|
}
|
|
3862
3914
|
}
|
|
3863
|
-
|
|
3915
|
+
Xe = /* @__PURE__ */ new WeakMap();
|
|
3864
3916
|
var de;
|
|
3865
|
-
class ln extends
|
|
3917
|
+
class ln extends Er {
|
|
3866
3918
|
constructor({
|
|
3867
3919
|
baseAddress: e = "https://api.figma.com/",
|
|
3868
3920
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
3869
3921
|
} = {}) {
|
|
3870
|
-
super({ fetch: t, baseAddress: e }),
|
|
3922
|
+
super({ fetch: t, baseAddress: e }), B(this, de, ""), this.cache = {
|
|
3871
3923
|
images: {
|
|
3872
3924
|
entries: /* @__PURE__ */ new Map(),
|
|
3873
3925
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
3874
3926
|
}
|
|
3875
|
-
}, this.files =
|
|
3927
|
+
}, this.files = lt(this, new Ar(this)), this.nodes = lt(this, new Nr(this)), this.images = lt(this, new Ir(this));
|
|
3876
3928
|
}
|
|
3877
3929
|
set token(e) {
|
|
3878
3930
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
3879
3931
|
throw new Error("Invalid Figma access token");
|
|
3880
|
-
|
|
3932
|
+
N(this, de, e);
|
|
3881
3933
|
}
|
|
3882
3934
|
get token() {
|
|
3883
3935
|
return k(this, de);
|
|
@@ -3890,7 +3942,7 @@ class ln extends Tr {
|
|
|
3890
3942
|
}
|
|
3891
3943
|
}
|
|
3892
3944
|
de = /* @__PURE__ */ new WeakMap();
|
|
3893
|
-
const
|
|
3945
|
+
const Vr = (r) => $(void 0, [r], function* ({
|
|
3894
3946
|
fileKey: n,
|
|
3895
3947
|
authToken: e,
|
|
3896
3948
|
figmaRestApi: t = new ln(),
|
|
@@ -3905,7 +3957,7 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3905
3957
|
} catch (a) {
|
|
3906
3958
|
throw console.error(a), a;
|
|
3907
3959
|
}
|
|
3908
|
-
}),
|
|
3960
|
+
}), Ur = (a) => $(void 0, [a], function* ({
|
|
3909
3961
|
fileKey: n,
|
|
3910
3962
|
authToken: e,
|
|
3911
3963
|
nodeIds: t,
|
|
@@ -3920,9 +3972,9 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3920
3972
|
params: d({}, r)
|
|
3921
3973
|
})).nodes;
|
|
3922
3974
|
} catch (i) {
|
|
3923
|
-
return
|
|
3975
|
+
return Ps(i, n);
|
|
3924
3976
|
}
|
|
3925
|
-
}),
|
|
3977
|
+
}), jr = (n, e) => new ReadableStream({
|
|
3926
3978
|
start(t) {
|
|
3927
3979
|
n.generateCode(e, (s) => {
|
|
3928
3980
|
s.type === "error" ? (console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"), t.enqueue({
|
|
@@ -3930,7 +3982,13 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3930
3982
|
payload: { message: s.payload.reason }
|
|
3931
3983
|
})) : t.enqueue(s), (s.type === "aborted" || s.type === "error") && t.close();
|
|
3932
3984
|
}).then((s) => {
|
|
3933
|
-
t.enqueue({
|
|
3985
|
+
t.enqueue({
|
|
3986
|
+
type: "done",
|
|
3987
|
+
payload: {
|
|
3988
|
+
tokenUsage: s.tokenUsage,
|
|
3989
|
+
sessionId: s.sessionId
|
|
3990
|
+
}
|
|
3991
|
+
}), t.close();
|
|
3934
3992
|
}).catch((s) => {
|
|
3935
3993
|
t.enqueue({
|
|
3936
3994
|
type: "error",
|
|
@@ -3941,12 +3999,12 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3941
3999
|
}), t.close();
|
|
3942
4000
|
});
|
|
3943
4001
|
}
|
|
3944
|
-
}),
|
|
3945
|
-
var c, u,
|
|
3946
|
-
const t =
|
|
3947
|
-
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((
|
|
4002
|
+
}), zr = (n, e) => $(void 0, null, function* () {
|
|
4003
|
+
var c, u, f, _, C, A, O;
|
|
4004
|
+
const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
4005
|
+
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))
|
|
3948
4006
|
return new Response(JSON.stringify(a.value), {
|
|
3949
|
-
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (
|
|
4007
|
+
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (C = a.value) == null ? void 0 : C.payload) == null ? void 0 : A.status) != null ? O : 500,
|
|
3950
4008
|
headers: {
|
|
3951
4009
|
"Content-Type": "application/json"
|
|
3952
4010
|
}
|
|
@@ -3974,25 +4032,26 @@ data: ${JSON.stringify(
|
|
|
3974
4032
|
});
|
|
3975
4033
|
});
|
|
3976
4034
|
export {
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
Rs as
|
|
3994
|
-
|
|
3995
|
-
|
|
4035
|
+
Zr as Anima,
|
|
4036
|
+
Ae as CodegenError,
|
|
4037
|
+
Is as FigmaTokenIssue,
|
|
4038
|
+
js as NotFound,
|
|
4039
|
+
Ns as RateLimitExceeded,
|
|
4040
|
+
Pr as ResponseError,
|
|
4041
|
+
Zs as UnknownFigmaApiException,
|
|
4042
|
+
zr as createCodegenResponseEventStream,
|
|
4043
|
+
jr as createCodegenStream,
|
|
4044
|
+
$r as formatToFigmaLink,
|
|
4045
|
+
Dr as getFigmaApiErrorType,
|
|
4046
|
+
Vr as getFigmaFile,
|
|
4047
|
+
Ur as getFileNodes,
|
|
4048
|
+
Fr as getRelatedScreenFiles,
|
|
4049
|
+
Ps as handleFigmaApiError,
|
|
4050
|
+
$s as isFigmaTokenIssue,
|
|
4051
|
+
Rs as isNotFound,
|
|
4052
|
+
Ms as isRateLimitExceeded,
|
|
4053
|
+
Lr as isUnknownFigmaApiException,
|
|
4054
|
+
Mr as isValidFigmaUrl,
|
|
3996
4055
|
Es as validateSettings
|
|
3997
4056
|
};
|
|
3998
4057
|
//# sourceMappingURL=index.js.map
|