@animaapp/anima-sdk 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -14
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +29 -10
- package/dist/index.js +451 -450
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/anima.ts +2 -10
- package/src/dataStream.ts +1 -1
- package/src/figma/figmaError.ts +7 -2
- package/src/figma/utils.ts +4 -4
- package/src/index.ts +0 -1
- package/src/types.ts +8 -2
- package/src/utils.ts +1 -1
- package/src/codegenToAnimaFiles.ts +0 -13
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writ
|
|
|
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)),
|
|
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
18
|
var P = (n, e, t) => new Promise((s, r) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
@@ -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;
|
|
@@ -260,10 +256,10 @@ let qt = ke;
|
|
|
260
256
|
function _n(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
|
-
},
|
|
279
|
+
}, vn = [];
|
|
284
280
|
function f(n, e) {
|
|
285
|
-
const t =
|
|
281
|
+
const t = Ye(), s = Qe({
|
|
286
282
|
issueData: e,
|
|
287
283
|
data: n.data,
|
|
288
284
|
path: n.path,
|
|
@@ -313,7 +309,7 @@ class I {
|
|
|
313
309
|
const s = [];
|
|
314
310
|
for (const r of t) {
|
|
315
311
|
if (r.status === "aborted")
|
|
316
|
-
return
|
|
312
|
+
return _;
|
|
317
313
|
r.status === "dirty" && e.dirty(), s.push(r.value);
|
|
318
314
|
}
|
|
319
315
|
return { status: e.value, value: s };
|
|
@@ -336,16 +332,16 @@ class I {
|
|
|
336
332
|
for (const r of t) {
|
|
337
333
|
const { key: a, value: i } = r;
|
|
338
334
|
if (a.status === "aborted" || i.status === "aborted")
|
|
339
|
-
return
|
|
335
|
+
return _;
|
|
340
336
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || r.alwaysSet) && (s[a.value] = i.value);
|
|
341
337
|
}
|
|
342
338
|
return { status: e.value, value: s };
|
|
343
339
|
}
|
|
344
340
|
}
|
|
345
|
-
const
|
|
341
|
+
const _ = 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
|
}
|
|
@@ -561,7 +557,7 @@ class w {
|
|
|
561
557
|
return Le.create([this, e], this._def);
|
|
562
558
|
}
|
|
563
559
|
and(e) {
|
|
564
|
-
return
|
|
560
|
+
return De.create(this, e, this._def);
|
|
565
561
|
}
|
|
566
562
|
transform(e) {
|
|
567
563
|
return new G(y(d({}, b(this._def)), {
|
|
@@ -579,7 +575,7 @@ class w {
|
|
|
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)));
|
|
@@ -611,14 +607,14 @@ 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])$/, Nn = /^(?:(?: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])$/, 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]))$/, In = /^(([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;
|
|
620
616
|
}
|
|
621
|
-
function
|
|
617
|
+
function Pn(n) {
|
|
622
618
|
return new RegExp(`^${Gt(n)}$`);
|
|
623
619
|
}
|
|
624
620
|
function Kt(n) {
|
|
@@ -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 $n(n, e) {
|
|
626
|
+
return !!((e === "v4" || !e) && Cn.test(n) || (e === "v6" || !e) && jn.test(n));
|
|
631
627
|
}
|
|
632
|
-
function
|
|
633
|
-
if (!
|
|
628
|
+
function Ln(n, e) {
|
|
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));
|
|
@@ -640,7 +636,7 @@ function Fn(n, e) {
|
|
|
640
636
|
}
|
|
641
637
|
}
|
|
642
638
|
function Dn(n, e) {
|
|
643
|
-
return !!((e === "v4" || !e) &&
|
|
639
|
+
return !!((e === "v4" || !e) && Nn.test(n) || (e === "v6" || !e) && In.test(n));
|
|
644
640
|
}
|
|
645
641
|
class H extends w {
|
|
646
642
|
_parse(e) {
|
|
@@ -650,7 +646,7 @@ class H extends w {
|
|
|
650
646
|
code: l.invalid_type,
|
|
651
647
|
expected: p.string,
|
|
652
648
|
received: a.parsedType
|
|
653
|
-
}),
|
|
649
|
+
}), _;
|
|
654
650
|
}
|
|
655
651
|
const s = new I();
|
|
656
652
|
let r;
|
|
@@ -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), f(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), f(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), f(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), f(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), f(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), f(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), f(r, {
|
|
731
727
|
validation: "ulid",
|
|
732
728
|
code: l.invalid_string,
|
|
733
729
|
message: a.message
|
|
@@ -762,11 +758,11 @@ class H extends w {
|
|
|
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), f(r, {
|
|
766
762
|
code: l.invalid_string,
|
|
767
763
|
validation: "date",
|
|
768
764
|
message: a.message
|
|
769
|
-
}), s.dirty()) : a.kind === "time" ?
|
|
765
|
+
}), s.dirty()) : a.kind === "time" ? Pn(a).test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
770
766
|
code: l.invalid_string,
|
|
771
767
|
validation: "time",
|
|
772
768
|
message: a.message
|
|
@@ -774,11 +770,11 @@ class H extends w {
|
|
|
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" ? $n(e.data, a.version) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
778
774
|
validation: "ip",
|
|
779
775
|
code: l.invalid_string,
|
|
780
776
|
message: a.message
|
|
781
|
-
}), s.dirty()) : a.kind === "jwt" ?
|
|
777
|
+
}), s.dirty()) : a.kind === "jwt" ? Ln(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
782
778
|
validation: "jwt",
|
|
783
779
|
code: l.invalid_string,
|
|
784
780
|
message: a.message
|
|
@@ -786,11 +782,11 @@ class H extends w {
|
|
|
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), f(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), f(r, {
|
|
794
790
|
validation: "base64url",
|
|
795
791
|
code: l.invalid_string,
|
|
796
792
|
message: a.message
|
|
@@ -1028,7 +1024,7 @@ class ue extends w {
|
|
|
1028
1024
|
code: l.invalid_type,
|
|
1029
1025
|
expected: p.number,
|
|
1030
1026
|
received: a.parsedType
|
|
1031
|
-
}),
|
|
1027
|
+
}), _;
|
|
1032
1028
|
}
|
|
1033
1029
|
let s;
|
|
1034
1030
|
const r = new I();
|
|
@@ -1227,7 +1223,7 @@ class le extends w {
|
|
|
1227
1223
|
code: l.invalid_type,
|
|
1228
1224
|
expected: p.bigint,
|
|
1229
1225
|
received: t.parsedType
|
|
1230
|
-
}),
|
|
1226
|
+
}), _;
|
|
1231
1227
|
}
|
|
1232
1228
|
gte(e, t) {
|
|
1233
1229
|
return this.setLimit("min", e, !0, m.toString(t));
|
|
@@ -1327,7 +1323,7 @@ class Me extends w {
|
|
|
1327
1323
|
code: l.invalid_type,
|
|
1328
1324
|
expected: p.boolean,
|
|
1329
1325
|
received: s.parsedType
|
|
1330
|
-
}),
|
|
1326
|
+
}), _;
|
|
1331
1327
|
}
|
|
1332
1328
|
return M(e.data);
|
|
1333
1329
|
}
|
|
@@ -1336,7 +1332,7 @@ Me.create = (n) => new Me(d({
|
|
|
1336
1332
|
typeName: g.ZodBoolean,
|
|
1337
1333
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
1338
1334
|
}, b(n)));
|
|
1339
|
-
class
|
|
1335
|
+
class _e 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);
|
|
@@ -1344,13 +1340,13 @@ class ve extends w {
|
|
|
1344
1340
|
code: l.invalid_type,
|
|
1345
1341
|
expected: p.date,
|
|
1346
1342
|
received: a.parsedType
|
|
1347
|
-
}),
|
|
1343
|
+
}), _;
|
|
1348
1344
|
}
|
|
1349
1345
|
if (isNaN(e.data.getTime())) {
|
|
1350
1346
|
const a = this._getOrReturnCtx(e);
|
|
1351
1347
|
return f(a, {
|
|
1352
1348
|
code: l.invalid_date
|
|
1353
|
-
}),
|
|
1349
|
+
}), _;
|
|
1354
1350
|
}
|
|
1355
1351
|
const s = new I();
|
|
1356
1352
|
let r;
|
|
@@ -1376,7 +1372,7 @@ class ve extends w {
|
|
|
1376
1372
|
};
|
|
1377
1373
|
}
|
|
1378
1374
|
_addCheck(e) {
|
|
1379
|
-
return new
|
|
1375
|
+
return new _e(y(d({}, this._def), {
|
|
1380
1376
|
checks: [...this._def.checks, e]
|
|
1381
1377
|
}));
|
|
1382
1378
|
}
|
|
@@ -1407,12 +1403,12 @@ class ve extends w {
|
|
|
1407
1403
|
return e != null ? new Date(e) : null;
|
|
1408
1404
|
}
|
|
1409
1405
|
}
|
|
1410
|
-
|
|
1406
|
+
_e.create = (n) => new _e(d({
|
|
1411
1407
|
checks: [],
|
|
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);
|
|
@@ -1420,12 +1416,12 @@ class nt extends w {
|
|
|
1420
1416
|
code: l.invalid_type,
|
|
1421
1417
|
expected: p.symbol,
|
|
1422
1418
|
received: s.parsedType
|
|
1423
|
-
}),
|
|
1419
|
+
}), _;
|
|
1424
1420
|
}
|
|
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
1427
|
class Pe extends w {
|
|
@@ -1436,7 +1432,7 @@ class Pe extends w {
|
|
|
1436
1432
|
code: l.invalid_type,
|
|
1437
1433
|
expected: p.undefined,
|
|
1438
1434
|
received: s.parsedType
|
|
1439
|
-
}),
|
|
1435
|
+
}), _;
|
|
1440
1436
|
}
|
|
1441
1437
|
return M(e.data);
|
|
1442
1438
|
}
|
|
@@ -1452,7 +1448,7 @@ class $e extends w {
|
|
|
1452
1448
|
code: l.invalid_type,
|
|
1453
1449
|
expected: p.null,
|
|
1454
1450
|
received: s.parsedType
|
|
1455
|
-
}),
|
|
1451
|
+
}), _;
|
|
1456
1452
|
}
|
|
1457
1453
|
return M(e.data);
|
|
1458
1454
|
}
|
|
@@ -1489,13 +1485,13 @@ class ce extends w {
|
|
|
1489
1485
|
code: l.invalid_type,
|
|
1490
1486
|
expected: p.never,
|
|
1491
1487
|
received: t.parsedType
|
|
1492
|
-
}),
|
|
1488
|
+
}), _;
|
|
1493
1489
|
}
|
|
1494
1490
|
}
|
|
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);
|
|
@@ -1503,12 +1499,12 @@ class st extends w {
|
|
|
1503
1499
|
code: l.invalid_type,
|
|
1504
1500
|
expected: p.void,
|
|
1505
1501
|
received: s.parsedType
|
|
1506
|
-
}),
|
|
1502
|
+
}), _;
|
|
1507
1503
|
}
|
|
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 {
|
|
@@ -1519,7 +1515,7 @@ class J extends w {
|
|
|
1519
1515
|
code: l.invalid_type,
|
|
1520
1516
|
expected: p.array,
|
|
1521
1517
|
received: t.parsedType
|
|
1522
|
-
}),
|
|
1518
|
+
}), _;
|
|
1523
1519
|
if (r.exactLength !== null) {
|
|
1524
1520
|
const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
|
|
1525
1521
|
(i || o) && (f(t, {
|
|
@@ -1611,7 +1607,7 @@ class S extends w {
|
|
|
1611
1607
|
code: l.invalid_type,
|
|
1612
1608
|
expected: p.object,
|
|
1613
1609
|
received: u.parsedType
|
|
1614
|
-
}),
|
|
1610
|
+
}), _;
|
|
1615
1611
|
}
|
|
1616
1612
|
const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1617
1613
|
if (!(this._def.catchall instanceof ce && this._def.unknownKeys === "strip"))
|
|
@@ -1619,10 +1615,10 @@ 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 h = a[u],
|
|
1618
|
+
const h = a[u], v = r.data[u];
|
|
1623
1619
|
c.push({
|
|
1624
1620
|
key: { status: "valid", value: u },
|
|
1625
|
-
value: h._parse(new ne(r,
|
|
1621
|
+
value: h._parse(new ne(r, v, r.path, u)),
|
|
1626
1622
|
alwaysSet: u in r.data
|
|
1627
1623
|
});
|
|
1628
1624
|
}
|
|
@@ -1643,11 +1639,11 @@ class S extends w {
|
|
|
1643
1639
|
} else {
|
|
1644
1640
|
const u = this._def.catchall;
|
|
1645
1641
|
for (const h of o) {
|
|
1646
|
-
const
|
|
1642
|
+
const v = r.data[h];
|
|
1647
1643
|
c.push({
|
|
1648
1644
|
key: { status: "valid", value: h },
|
|
1649
1645
|
value: u._parse(
|
|
1650
|
-
new ne(r,
|
|
1646
|
+
new ne(r, v, r.path, h)
|
|
1651
1647
|
//, ctx.child(key), value, getParsedType(value)
|
|
1652
1648
|
),
|
|
1653
1649
|
alwaysSet: h in r.data
|
|
@@ -1657,10 +1653,10 @@ class S extends w {
|
|
|
1657
1653
|
return r.common.async ? Promise.resolve().then(() => P(this, null, function* () {
|
|
1658
1654
|
const u = [];
|
|
1659
1655
|
for (const h of c) {
|
|
1660
|
-
const
|
|
1656
|
+
const v = yield h.key, C = yield h.value;
|
|
1661
1657
|
u.push({
|
|
1662
|
-
key:
|
|
1663
|
-
value:
|
|
1658
|
+
key: v,
|
|
1659
|
+
value: C,
|
|
1664
1660
|
alwaysSet: h.alwaysSet
|
|
1665
1661
|
});
|
|
1666
1662
|
}
|
|
@@ -1876,7 +1872,7 @@ class Le extends w {
|
|
|
1876
1872
|
return f(t, {
|
|
1877
1873
|
code: l.invalid_union,
|
|
1878
1874
|
unionErrors: i
|
|
1879
|
-
}),
|
|
1875
|
+
}), _;
|
|
1880
1876
|
}
|
|
1881
1877
|
if (t.common.async)
|
|
1882
1878
|
return Promise.all(s.map((a) => P(this, null, function* () {
|
|
@@ -1919,7 +1915,7 @@ class Le extends w {
|
|
|
1919
1915
|
return f(t, {
|
|
1920
1916
|
code: l.invalid_union,
|
|
1921
1917
|
unionErrors: o
|
|
1922
|
-
}),
|
|
1918
|
+
}), _;
|
|
1923
1919
|
}
|
|
1924
1920
|
}
|
|
1925
1921
|
get options() {
|
|
@@ -1930,8 +1926,8 @@ Le.create = (n, e) => new Le(d({
|
|
|
1930
1926
|
options: n,
|
|
1931
1927
|
typeName: g.ZodUnion
|
|
1932
1928
|
}, b(e)));
|
|
1933
|
-
const ie = (n) => n instanceof
|
|
1934
|
-
class
|
|
1929
|
+
const ie = (n) => n instanceof Fe ? 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 Be ? ie(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof $e ? [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 We ? 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)
|
|
@@ -1939,7 +1935,7 @@ class it extends w {
|
|
|
1939
1935
|
code: l.invalid_type,
|
|
1940
1936
|
expected: p.object,
|
|
1941
1937
|
received: t.parsedType
|
|
1942
|
-
}),
|
|
1938
|
+
}), _;
|
|
1943
1939
|
const s = this.discriminator, r = t.data[s], a = this.optionsMap.get(r);
|
|
1944
1940
|
return a ? t.common.async ? a._parseAsync({
|
|
1945
1941
|
data: t.data,
|
|
@@ -1953,7 +1949,7 @@ class it extends w {
|
|
|
1953
1949
|
code: l.invalid_union_discriminator,
|
|
1954
1950
|
options: Array.from(this.optionsMap.keys()),
|
|
1955
1951
|
path: [s]
|
|
1956
|
-
}),
|
|
1952
|
+
}), _);
|
|
1957
1953
|
}
|
|
1958
1954
|
get discriminator() {
|
|
1959
1955
|
return this._def.discriminator;
|
|
@@ -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,15 +2014,15 @@ 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 De extends w {
|
|
2022
2018
|
_parse(e) {
|
|
2023
2019
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2024
|
-
if (
|
|
2025
|
-
return
|
|
2026
|
-
const o =
|
|
2027
|
-
return o.valid ? ((
|
|
2020
|
+
if (ht(a) || ht(i))
|
|
2021
|
+
return _;
|
|
2022
|
+
const o = mt(a.value, i.value);
|
|
2023
|
+
return o.valid ? ((pt(a) || pt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(s, {
|
|
2028
2024
|
code: l.invalid_intersection_types
|
|
2029
|
-
}),
|
|
2025
|
+
}), _);
|
|
2030
2026
|
};
|
|
2031
2027
|
return s.common.async ? Promise.all([
|
|
2032
2028
|
this._def.left._parseAsync({
|
|
@@ -2050,7 +2046,7 @@ class Fe extends w {
|
|
|
2050
2046
|
}));
|
|
2051
2047
|
}
|
|
2052
2048
|
}
|
|
2053
|
-
|
|
2049
|
+
De.create = (n, e, t) => new De(d({
|
|
2054
2050
|
left: n,
|
|
2055
2051
|
right: e,
|
|
2056
2052
|
typeName: g.ZodIntersection
|
|
@@ -2063,7 +2059,7 @@ class se extends w {
|
|
|
2063
2059
|
code: l.invalid_type,
|
|
2064
2060
|
expected: p.array,
|
|
2065
2061
|
received: s.parsedType
|
|
2066
|
-
}),
|
|
2062
|
+
}), _;
|
|
2067
2063
|
if (s.data.length < this._def.items.length)
|
|
2068
2064
|
return f(s, {
|
|
2069
2065
|
code: l.too_small,
|
|
@@ -2071,7 +2067,7 @@ class se extends w {
|
|
|
2071
2067
|
inclusive: !0,
|
|
2072
2068
|
exact: !1,
|
|
2073
2069
|
type: "array"
|
|
2074
|
-
}),
|
|
2070
|
+
}), _;
|
|
2075
2071
|
!this._def.rest && s.data.length > this._def.items.length && (f(s, {
|
|
2076
2072
|
code: l.too_big,
|
|
2077
2073
|
maximum: this._def.items.length,
|
|
@@ -2103,7 +2099,7 @@ se.create = (n, e) => {
|
|
|
2103
2099
|
rest: null
|
|
2104
2100
|
}, b(e)));
|
|
2105
2101
|
};
|
|
2106
|
-
class
|
|
2102
|
+
class Ve extends w {
|
|
2107
2103
|
get keySchema() {
|
|
2108
2104
|
return this._def.keyType;
|
|
2109
2105
|
}
|
|
@@ -2117,7 +2113,7 @@ class De extends w {
|
|
|
2117
2113
|
code: l.invalid_type,
|
|
2118
2114
|
expected: p.object,
|
|
2119
2115
|
received: s.parsedType
|
|
2120
|
-
}),
|
|
2116
|
+
}), _;
|
|
2121
2117
|
const r = [], a = this._def.keyType, i = this._def.valueType;
|
|
2122
2118
|
for (const o in s.data)
|
|
2123
2119
|
r.push({
|
|
@@ -2131,18 +2127,18 @@ class De extends w {
|
|
|
2131
2127
|
return this._def.valueType;
|
|
2132
2128
|
}
|
|
2133
2129
|
static create(e, t, s) {
|
|
2134
|
-
return t instanceof w ? new
|
|
2130
|
+
return t instanceof w ? new Ve(d({
|
|
2135
2131
|
keyType: e,
|
|
2136
2132
|
valueType: t,
|
|
2137
2133
|
typeName: g.ZodRecord
|
|
2138
|
-
}, b(s))) : new
|
|
2134
|
+
}, b(s))) : new Ve(d({
|
|
2139
2135
|
keyType: H.create(),
|
|
2140
2136
|
valueType: e,
|
|
2141
2137
|
typeName: g.ZodRecord
|
|
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
|
}
|
|
@@ -2156,7 +2152,7 @@ class rt extends w {
|
|
|
2156
2152
|
code: l.invalid_type,
|
|
2157
2153
|
expected: p.map,
|
|
2158
2154
|
received: s.parsedType
|
|
2159
|
-
}),
|
|
2155
|
+
}), _;
|
|
2160
2156
|
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
|
|
2161
2157
|
key: r._parse(new ne(s, o, s.path, [u, "key"])),
|
|
2162
2158
|
value: a._parse(new ne(s, c, s.path, [u, "value"]))
|
|
@@ -2167,7 +2163,7 @@ class rt extends w {
|
|
|
2167
2163
|
for (const c of i) {
|
|
2168
2164
|
const u = yield c.key, h = yield c.value;
|
|
2169
2165
|
if (u.status === "aborted" || h.status === "aborted")
|
|
2170
|
-
return
|
|
2166
|
+
return _;
|
|
2171
2167
|
(u.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(u.value, h.value);
|
|
2172
2168
|
}
|
|
2173
2169
|
return { status: t.value, value: o };
|
|
@@ -2177,19 +2173,19 @@ class rt extends w {
|
|
|
2177
2173
|
for (const c of i) {
|
|
2178
2174
|
const u = c.key, h = c.value;
|
|
2179
2175
|
if (u.status === "aborted" || h.status === "aborted")
|
|
2180
|
-
return
|
|
2176
|
+
return _;
|
|
2181
2177
|
(u.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(u.value, h.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
|
|
2191
2187
|
}, b(t)));
|
|
2192
|
-
class
|
|
2188
|
+
class ve extends w {
|
|
2193
2189
|
_parse(e) {
|
|
2194
2190
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2195
2191
|
if (s.parsedType !== p.set)
|
|
@@ -2197,7 +2193,7 @@ class _e extends w {
|
|
|
2197
2193
|
code: l.invalid_type,
|
|
2198
2194
|
expected: p.set,
|
|
2199
2195
|
received: s.parsedType
|
|
2200
|
-
}),
|
|
2196
|
+
}), _;
|
|
2201
2197
|
const r = this._def;
|
|
2202
2198
|
r.minSize !== null && s.data.size < r.minSize.value && (f(s, {
|
|
2203
2199
|
code: l.too_small,
|
|
@@ -2219,7 +2215,7 @@ class _e extends w {
|
|
|
2219
2215
|
const u = /* @__PURE__ */ new Set();
|
|
2220
2216
|
for (const h of c) {
|
|
2221
2217
|
if (h.status === "aborted")
|
|
2222
|
-
return
|
|
2218
|
+
return _;
|
|
2223
2219
|
h.status === "dirty" && t.dirty(), u.add(h.value);
|
|
2224
2220
|
}
|
|
2225
2221
|
return { status: t.value, value: u };
|
|
@@ -2228,12 +2224,12 @@ class _e extends w {
|
|
|
2228
2224
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
2229
2225
|
}
|
|
2230
2226
|
min(e, t) {
|
|
2231
|
-
return new
|
|
2227
|
+
return new ve(y(d({}, this._def), {
|
|
2232
2228
|
minSize: { value: e, message: m.toString(t) }
|
|
2233
2229
|
}));
|
|
2234
2230
|
}
|
|
2235
2231
|
max(e, t) {
|
|
2236
|
-
return new
|
|
2232
|
+
return new ve(y(d({}, this._def), {
|
|
2237
2233
|
maxSize: { value: e, message: m.toString(t) }
|
|
2238
2234
|
}));
|
|
2239
2235
|
}
|
|
@@ -2244,7 +2240,7 @@ class _e extends w {
|
|
|
2244
2240
|
return this.min(1, e);
|
|
2245
2241
|
}
|
|
2246
2242
|
}
|
|
2247
|
-
|
|
2243
|
+
ve.create = (n, e) => new ve(d({
|
|
2248
2244
|
valueType: n,
|
|
2249
2245
|
minSize: null,
|
|
2250
2246
|
maxSize: null,
|
|
@@ -2261,15 +2257,15 @@ class xe extends w {
|
|
|
2261
2257
|
code: l.invalid_type,
|
|
2262
2258
|
expected: p.function,
|
|
2263
2259
|
received: t.parsedType
|
|
2264
|
-
}),
|
|
2260
|
+
}), _;
|
|
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: {
|
|
@@ -2299,11 +2295,11 @@ class xe extends w {
|
|
|
2299
2295
|
const o = this;
|
|
2300
2296
|
return M(function(...c) {
|
|
2301
2297
|
return P(this, null, function* () {
|
|
2302
|
-
const u = new U([]), h = yield o._def.args.parseAsync(c, a).catch((
|
|
2303
|
-
throw u.addIssue(s(c,
|
|
2304
|
-
}),
|
|
2305
|
-
return yield o._def.returns._def.type.parseAsync(
|
|
2306
|
-
throw u.addIssue(r(
|
|
2298
|
+
const u = new U([]), h = yield o._def.args.parseAsync(c, a).catch((A) => {
|
|
2299
|
+
throw u.addIssue(s(c, A)), u;
|
|
2300
|
+
}), v = yield Reflect.apply(i, this, h);
|
|
2301
|
+
return yield o._def.returns._def.type.parseAsync(v, a).catch((A) => {
|
|
2302
|
+
throw u.addIssue(r(v, A)), u;
|
|
2307
2303
|
});
|
|
2308
2304
|
});
|
|
2309
2305
|
});
|
|
@@ -2313,10 +2309,10 @@ 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 h = Reflect.apply(i, this, u.data),
|
|
2317
|
-
if (!
|
|
2318
|
-
throw new U([r(h,
|
|
2319
|
-
return
|
|
2312
|
+
const h = Reflect.apply(i, this, u.data), v = o._def.returns.safeParse(h, a);
|
|
2313
|
+
if (!v.success)
|
|
2314
|
+
throw new U([r(h, v.error)]);
|
|
2315
|
+
return v.data;
|
|
2320
2316
|
});
|
|
2321
2317
|
}
|
|
2322
2318
|
}
|
|
@@ -2350,7 +2346,7 @@ class xe extends w {
|
|
|
2350
2346
|
}, b(s)));
|
|
2351
2347
|
}
|
|
2352
2348
|
}
|
|
2353
|
-
class
|
|
2349
|
+
class Fe extends w {
|
|
2354
2350
|
get schema() {
|
|
2355
2351
|
return this._def.getter();
|
|
2356
2352
|
}
|
|
@@ -2359,7 +2355,7 @@ class Ve extends w {
|
|
|
2359
2355
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2360
2356
|
}
|
|
2361
2357
|
}
|
|
2362
|
-
|
|
2358
|
+
Fe.create = (n, e) => new Fe(d({
|
|
2363
2359
|
getter: n,
|
|
2364
2360
|
typeName: g.ZodLazy
|
|
2365
2361
|
}, b(e)));
|
|
@@ -2371,7 +2367,7 @@ class Ue extends w {
|
|
|
2371
2367
|
received: t.data,
|
|
2372
2368
|
code: l.invalid_literal,
|
|
2373
2369
|
expected: this._def.value
|
|
2374
|
-
}),
|
|
2370
|
+
}), _;
|
|
2375
2371
|
}
|
|
2376
2372
|
return { status: "valid", value: e.data };
|
|
2377
2373
|
}
|
|
@@ -2400,15 +2396,15 @@ class fe extends w {
|
|
|
2400
2396
|
expected: x.joinValues(s),
|
|
2401
2397
|
received: t.parsedType,
|
|
2402
2398
|
code: l.invalid_type
|
|
2403
|
-
}),
|
|
2399
|
+
}), _;
|
|
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
2403
|
return f(t, {
|
|
2408
2404
|
received: t.data,
|
|
2409
2405
|
code: l.invalid_enum_value,
|
|
2410
2406
|
options: s
|
|
2411
|
-
}),
|
|
2407
|
+
}), _;
|
|
2412
2408
|
}
|
|
2413
2409
|
return M(e.data);
|
|
2414
2410
|
}
|
|
@@ -2454,15 +2450,15 @@ class ze extends w {
|
|
|
2454
2450
|
expected: x.joinValues(r),
|
|
2455
2451
|
received: s.parsedType,
|
|
2456
2452
|
code: l.invalid_type
|
|
2457
|
-
}),
|
|
2453
|
+
}), _;
|
|
2458
2454
|
}
|
|
2459
|
-
if (
|
|
2455
|
+
if (et(this, Ne) || Ht(this, Ne, new Set(x.getValidEnumValues(this._def.values))), !et(this, Ne).has(e.data)) {
|
|
2460
2456
|
const r = x.objectValues(t);
|
|
2461
2457
|
return f(s, {
|
|
2462
2458
|
received: s.data,
|
|
2463
2459
|
code: l.invalid_enum_value,
|
|
2464
2460
|
options: r
|
|
2465
|
-
}),
|
|
2461
|
+
}), _;
|
|
2466
2462
|
}
|
|
2467
2463
|
return M(e.data);
|
|
2468
2464
|
}
|
|
@@ -2486,7 +2482,7 @@ class Se extends w {
|
|
|
2486
2482
|
code: l.invalid_type,
|
|
2487
2483
|
expected: p.promise,
|
|
2488
2484
|
received: t.parsedType
|
|
2489
|
-
}),
|
|
2485
|
+
}), _;
|
|
2490
2486
|
const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
2491
2487
|
return M(s.then((r) => this._def.type.parseAsync(r, {
|
|
2492
2488
|
path: t.path,
|
|
@@ -2519,23 +2515,23 @@ class G extends w {
|
|
|
2519
2515
|
if (s.common.async)
|
|
2520
2516
|
return Promise.resolve(i).then((o) => P(this, null, function* () {
|
|
2521
2517
|
if (t.value === "aborted")
|
|
2522
|
-
return
|
|
2518
|
+
return _;
|
|
2523
2519
|
const c = yield this._def.schema._parseAsync({
|
|
2524
2520
|
data: o,
|
|
2525
2521
|
path: s.path,
|
|
2526
2522
|
parent: s
|
|
2527
2523
|
});
|
|
2528
|
-
return c.status === "aborted" ?
|
|
2524
|
+
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? we(c.value) : c;
|
|
2529
2525
|
}));
|
|
2530
2526
|
{
|
|
2531
2527
|
if (t.value === "aborted")
|
|
2532
|
-
return
|
|
2528
|
+
return _;
|
|
2533
2529
|
const o = this._def.schema._parseSync({
|
|
2534
2530
|
data: i,
|
|
2535
2531
|
path: s.path,
|
|
2536
2532
|
parent: s
|
|
2537
2533
|
});
|
|
2538
|
-
return o.status === "aborted" ?
|
|
2534
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? we(o.value) : o;
|
|
2539
2535
|
}
|
|
2540
2536
|
}
|
|
2541
2537
|
if (r.type === "refinement") {
|
|
@@ -2553,9 +2549,9 @@ class G extends w {
|
|
|
2553
2549
|
path: s.path,
|
|
2554
2550
|
parent: s
|
|
2555
2551
|
});
|
|
2556
|
-
return o.status === "aborted" ?
|
|
2552
|
+
return o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2557
2553
|
} else
|
|
2558
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ?
|
|
2554
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2559
2555
|
}
|
|
2560
2556
|
if (r.type === "transform")
|
|
2561
2557
|
if (s.common.async === !1) {
|
|
@@ -2666,7 +2662,7 @@ We.create = (n, e) => new We(d({
|
|
|
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);
|
|
@@ -2674,16 +2670,16 @@ class at extends w {
|
|
|
2674
2670
|
code: l.invalid_type,
|
|
2675
2671
|
expected: p.nan,
|
|
2676
2672
|
received: s.parsedType
|
|
2677
|
-
}),
|
|
2673
|
+
}), _;
|
|
2678
2674
|
}
|
|
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 Fn = 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({
|
|
@@ -2706,7 +2702,7 @@ class Je extends w {
|
|
|
2706
2702
|
path: s.path,
|
|
2707
2703
|
parent: s
|
|
2708
2704
|
});
|
|
2709
|
-
return a.status === "aborted" ?
|
|
2705
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), we(a.value)) : this._def.out._parseAsync({
|
|
2710
2706
|
data: a.value,
|
|
2711
2707
|
path: s.path,
|
|
2712
2708
|
parent: s
|
|
@@ -2718,7 +2714,7 @@ class Je extends w {
|
|
|
2718
2714
|
path: s.path,
|
|
2719
2715
|
parent: s
|
|
2720
2716
|
});
|
|
2721
|
-
return r.status === "aborted" ?
|
|
2717
|
+
return r.status === "aborted" ? _ : r.status === "dirty" ? (t.dirty(), {
|
|
2722
2718
|
status: "dirty",
|
|
2723
2719
|
value: r.value
|
|
2724
2720
|
}) : this._def.out._parseSync({
|
|
@@ -2758,45 +2754,45 @@ 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,
|
|
2766
|
+
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = ue.create, Bn = rt.create, Wn = le.create, tn = Me.create, qn = _e.create, Hn = tt.create, Jn = Pe.create, Gn = $e.create, Kn = Te.create, Xn = ye.create, Yn = ce.create, Qn = nt.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = at.create, as = De.create, is = se.create, os = Ve.create, cs = st.create, ds = ve.create, us = xe.create, ls = Fe.create, fs = Ue.create, hs = fe.create, ps = ze.create, ms = Se.create, $t = G.create, ys = te.create, gs = he.create, _s = G.createWithPreprocess, vs = 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), {
|
|
2774
2770
|
coerce: !0
|
|
2775
2771
|
})),
|
|
2776
2772
|
bigint: (n) => le.create(y(d({}, n), { coerce: !0 })),
|
|
2777
|
-
date: (n) =>
|
|
2778
|
-
},
|
|
2779
|
-
var
|
|
2773
|
+
date: (n) => _e.create(y(d({}, n), { coerce: !0 }))
|
|
2774
|
+
}, Ts = _;
|
|
2775
|
+
var V = /* @__PURE__ */ Object.freeze({
|
|
2780
2776
|
__proto__: null,
|
|
2781
2777
|
defaultErrorMap: ke,
|
|
2782
2778
|
setErrorMap: _n,
|
|
2783
|
-
getErrorMap:
|
|
2784
|
-
makeIssue:
|
|
2785
|
-
EMPTY_PATH:
|
|
2779
|
+
getErrorMap: Ye,
|
|
2780
|
+
makeIssue: Qe,
|
|
2781
|
+
EMPTY_PATH: vn,
|
|
2786
2782
|
addIssueToContext: f,
|
|
2787
2783
|
ParseStatus: I,
|
|
2788
|
-
INVALID:
|
|
2784
|
+
INVALID: _,
|
|
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,
|
|
@@ -2806,25 +2802,25 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
2806
2802
|
ZodNumber: ue,
|
|
2807
2803
|
ZodBigInt: le,
|
|
2808
2804
|
ZodBoolean: Me,
|
|
2809
|
-
ZodDate:
|
|
2810
|
-
ZodSymbol:
|
|
2805
|
+
ZodDate: _e,
|
|
2806
|
+
ZodSymbol: tt,
|
|
2811
2807
|
ZodUndefined: Pe,
|
|
2812
2808
|
ZodNull: $e,
|
|
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
2815
|
ZodUnion: Le,
|
|
2820
|
-
ZodDiscriminatedUnion:
|
|
2821
|
-
ZodIntersection:
|
|
2816
|
+
ZodDiscriminatedUnion: at,
|
|
2817
|
+
ZodIntersection: De,
|
|
2822
2818
|
ZodTuple: se,
|
|
2823
|
-
ZodRecord:
|
|
2824
|
-
ZodMap:
|
|
2825
|
-
ZodSet:
|
|
2819
|
+
ZodRecord: Ve,
|
|
2820
|
+
ZodMap: st,
|
|
2821
|
+
ZodSet: ve,
|
|
2826
2822
|
ZodFunction: xe,
|
|
2827
|
-
ZodLazy:
|
|
2823
|
+
ZodLazy: Fe,
|
|
2828
2824
|
ZodLiteral: Ue,
|
|
2829
2825
|
ZodEnum: fe,
|
|
2830
2826
|
ZodNativeEnum: ze,
|
|
@@ -2835,71 +2831,71 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
2835
2831
|
ZodNullable: he,
|
|
2836
2832
|
ZodDefault: Be,
|
|
2837
2833
|
ZodCatch: We,
|
|
2838
|
-
ZodNaN:
|
|
2839
|
-
BRAND:
|
|
2840
|
-
ZodBranded:
|
|
2834
|
+
ZodNaN: rt,
|
|
2835
|
+
BRAND: Fn,
|
|
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: Wn,
|
|
2854
2850
|
boolean: tn,
|
|
2855
|
-
date:
|
|
2856
|
-
discriminatedUnion:
|
|
2851
|
+
date: qn,
|
|
2852
|
+
discriminatedUnion: rs,
|
|
2857
2853
|
effect: $t,
|
|
2858
|
-
enum:
|
|
2859
|
-
function:
|
|
2860
|
-
instanceof:
|
|
2861
|
-
intersection:
|
|
2862
|
-
lazy:
|
|
2863
|
-
literal:
|
|
2864
|
-
map:
|
|
2865
|
-
nan:
|
|
2866
|
-
nativeEnum:
|
|
2867
|
-
never:
|
|
2868
|
-
null:
|
|
2869
|
-
nullable:
|
|
2854
|
+
enum: hs,
|
|
2855
|
+
function: us,
|
|
2856
|
+
instanceof: zn,
|
|
2857
|
+
intersection: as,
|
|
2858
|
+
lazy: ls,
|
|
2859
|
+
literal: fs,
|
|
2860
|
+
map: cs,
|
|
2861
|
+
nan: Bn,
|
|
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:
|
|
2867
|
+
object: ts,
|
|
2868
|
+
oboolean: xs,
|
|
2869
|
+
onumber: ws,
|
|
2870
|
+
optional: ys,
|
|
2871
|
+
ostring: bs,
|
|
2872
|
+
pipeline: vs,
|
|
2877
2873
|
preprocess: _s,
|
|
2878
|
-
promise:
|
|
2879
|
-
record:
|
|
2880
|
-
set:
|
|
2881
|
-
strictObject:
|
|
2874
|
+
promise: ms,
|
|
2875
|
+
record: os,
|
|
2876
|
+
set: ds,
|
|
2877
|
+
strictObject: ns,
|
|
2882
2878
|
string: Qt,
|
|
2883
|
-
symbol:
|
|
2879
|
+
symbol: Hn,
|
|
2884
2880
|
transformer: $t,
|
|
2885
|
-
tuple:
|
|
2886
|
-
undefined:
|
|
2887
|
-
union:
|
|
2888
|
-
unknown:
|
|
2889
|
-
void:
|
|
2890
|
-
NEVER:
|
|
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 = V.object({
|
|
2892
|
+
language: V.enum(["typescript", "javascript"]).optional()
|
|
2897
2893
|
}).and(
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
framework:
|
|
2901
|
-
model:
|
|
2902
|
-
styling:
|
|
2894
|
+
V.union([
|
|
2895
|
+
V.object({
|
|
2896
|
+
framework: V.literal("react"),
|
|
2897
|
+
model: V.string().optional(),
|
|
2898
|
+
styling: V.enum([
|
|
2903
2899
|
"plain_css",
|
|
2904
2900
|
"css_modules",
|
|
2905
2901
|
"styled_components",
|
|
@@ -2908,17 +2904,17 @@ const As = D.object({
|
|
|
2908
2904
|
"scss",
|
|
2909
2905
|
"inline_styles"
|
|
2910
2906
|
]),
|
|
2911
|
-
uiLibrary:
|
|
2912
|
-
enableUILibraryTheming:
|
|
2907
|
+
uiLibrary: V.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
2908
|
+
enableUILibraryTheming: V.boolean().optional()
|
|
2913
2909
|
}),
|
|
2914
|
-
|
|
2915
|
-
framework:
|
|
2916
|
-
styling:
|
|
2917
|
-
enableTranslation:
|
|
2910
|
+
V.object({
|
|
2911
|
+
framework: V.literal("html"),
|
|
2912
|
+
styling: V.enum(["plain_css", "inline_styles"]),
|
|
2913
|
+
enableTranslation: V.boolean().optional()
|
|
2918
2914
|
})
|
|
2919
2915
|
])
|
|
2920
2916
|
), Es = (n) => {
|
|
2921
|
-
const e =
|
|
2917
|
+
const e = Ss.safeParse(n);
|
|
2922
2918
|
if (e.success === !1) {
|
|
2923
2919
|
const t = new Error("Invalid codegen settings");
|
|
2924
2920
|
throw t.cause = e.error, t;
|
|
@@ -2926,20 +2922,20 @@ const As = D.object({
|
|
|
2926
2922
|
return e.data;
|
|
2927
2923
|
};
|
|
2928
2924
|
var B, He;
|
|
2929
|
-
class
|
|
2925
|
+
class jr {
|
|
2930
2926
|
constructor({
|
|
2931
2927
|
auth: e,
|
|
2932
2928
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
2933
2929
|
} = {}) {
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2930
|
+
it(this, B);
|
|
2931
|
+
it(this, He);
|
|
2932
|
+
ot(this, He, t), e && (this.auth = e);
|
|
2937
2933
|
}
|
|
2938
2934
|
hasAuth() {
|
|
2939
2935
|
return !!X(this, B);
|
|
2940
2936
|
}
|
|
2941
2937
|
set auth(e) {
|
|
2942
|
-
|
|
2938
|
+
ot(this, B, e);
|
|
2943
2939
|
}
|
|
2944
2940
|
get headers() {
|
|
2945
2941
|
const e = {
|
|
@@ -2949,7 +2945,7 @@ class Ir {
|
|
|
2949
2945
|
}
|
|
2950
2946
|
generateCode(s) {
|
|
2951
2947
|
return P(this, arguments, function* (e, t = {}) {
|
|
2952
|
-
var h,
|
|
2948
|
+
var h, v, C, A, O, R, q;
|
|
2953
2949
|
if (this.hasAuth() === !1)
|
|
2954
2950
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
2955
2951
|
const r = {}, a = Es(e.settings), i = yield fetch(`${X(this, He)}/v1/codegen`, {
|
|
@@ -2978,14 +2974,14 @@ class Ir {
|
|
|
2978
2974
|
} catch (re) {
|
|
2979
2975
|
z = `HTTP error! status: ${i.status}`;
|
|
2980
2976
|
}
|
|
2981
|
-
throw new
|
|
2977
|
+
throw new Ae({
|
|
2982
2978
|
name: "HTTP Error",
|
|
2983
2979
|
reason: z,
|
|
2984
2980
|
status: i.status
|
|
2985
2981
|
});
|
|
2986
2982
|
}
|
|
2987
2983
|
if (!i.body)
|
|
2988
|
-
throw new
|
|
2984
|
+
throw new Ae({
|
|
2989
2985
|
name: "Stream Error",
|
|
2990
2986
|
reason: "Response body is null",
|
|
2991
2987
|
status: i.status
|
|
@@ -3006,7 +3002,7 @@ class Ir {
|
|
|
3006
3002
|
let T;
|
|
3007
3003
|
try {
|
|
3008
3004
|
T = JSON.parse(K.slice(6));
|
|
3009
|
-
} catch (
|
|
3005
|
+
} catch (Ct) {
|
|
3010
3006
|
continue;
|
|
3011
3007
|
}
|
|
3012
3008
|
switch (T.type) {
|
|
@@ -3015,30 +3011,29 @@ class Ir {
|
|
|
3015
3011
|
break;
|
|
3016
3012
|
}
|
|
3017
3013
|
case "pre_codegen": {
|
|
3018
|
-
typeof t == "function" ? t(T) : (
|
|
3014
|
+
typeof t == "function" ? t(T) : (v = t.onPreCodegen) == null || v.call(t, { message: T.message });
|
|
3019
3015
|
break;
|
|
3020
3016
|
}
|
|
3021
3017
|
case "assets_uploaded": {
|
|
3022
|
-
typeof t == "function" ? t(T) : (
|
|
3018
|
+
typeof t == "function" ? t(T) : (C = t.onAssetsUploaded) == null || C.call(t);
|
|
3023
3019
|
break;
|
|
3024
3020
|
}
|
|
3025
3021
|
case "assets_list": {
|
|
3026
|
-
r.assets = T.payload.assets, typeof t == "function" ? t(T) : (
|
|
3022
|
+
r.assets = T.payload.assets, typeof t == "function" ? t(T) : (A = t.onAssetsList) == null || A.call(t, T.payload);
|
|
3027
3023
|
break;
|
|
3028
3024
|
}
|
|
3029
3025
|
case "figma_metadata": {
|
|
3030
|
-
r.figmaFileName = T.figmaFileName, r.figmaSelectedFrameName = T.figmaSelectedFrameName, typeof t == "function" ? t(T) : (
|
|
3026
|
+
r.figmaFileName = T.figmaFileName, r.figmaSelectedFrameName = T.figmaSelectedFrameName, typeof t == "function" ? t(T) : (O = t.onFigmaMetadata) == null || O.call(t, {
|
|
3031
3027
|
figmaFileName: T.figmaFileName,
|
|
3032
3028
|
figmaSelectedFrameName: T.figmaSelectedFrameName
|
|
3033
3029
|
});
|
|
3034
3030
|
break;
|
|
3035
3031
|
}
|
|
3036
3032
|
case "generating_code": {
|
|
3037
|
-
|
|
3038
|
-
T.payload.status === "success" && (r.files = E), typeof t == "function" ? t(T) : (R = t.onGeneratingCode) == null || R.call(t, {
|
|
3033
|
+
T.payload.status === "success" && (r.files = T.payload.files), typeof t == "function" ? t(T) : (R = t.onGeneratingCode) == null || R.call(t, {
|
|
3039
3034
|
status: T.payload.status,
|
|
3040
3035
|
progress: T.payload.progress,
|
|
3041
|
-
files:
|
|
3036
|
+
files: T.payload.files
|
|
3042
3037
|
});
|
|
3043
3038
|
break;
|
|
3044
3039
|
}
|
|
@@ -3047,13 +3042,13 @@ class Ir {
|
|
|
3047
3042
|
break;
|
|
3048
3043
|
}
|
|
3049
3044
|
case "error":
|
|
3050
|
-
throw new
|
|
3045
|
+
throw new Ae({
|
|
3051
3046
|
name: T.payload.errorName,
|
|
3052
3047
|
reason: T.payload.reason
|
|
3053
3048
|
});
|
|
3054
3049
|
case "done": {
|
|
3055
3050
|
if (!r.files)
|
|
3056
|
-
throw new
|
|
3051
|
+
throw new Ae({
|
|
3057
3052
|
name: "Invalid response",
|
|
3058
3053
|
reason: "No files found"
|
|
3059
3054
|
});
|
|
@@ -3065,7 +3060,7 @@ class Ir {
|
|
|
3065
3060
|
} finally {
|
|
3066
3061
|
o.cancel();
|
|
3067
3062
|
}
|
|
3068
|
-
throw new
|
|
3063
|
+
throw new Ae({
|
|
3069
3064
|
name: "Connection",
|
|
3070
3065
|
reason: "Connection closed before the 'done' message",
|
|
3071
3066
|
status: 500
|
|
@@ -3074,7 +3069,7 @@ class Ir {
|
|
|
3074
3069
|
}
|
|
3075
3070
|
}
|
|
3076
3071
|
B = new WeakMap(), He = new WeakMap();
|
|
3077
|
-
const
|
|
3072
|
+
const Ir = (n) => {
|
|
3078
3073
|
var e;
|
|
3079
3074
|
if (!n)
|
|
3080
3075
|
return [!1, "", ""];
|
|
@@ -3087,59 +3082,65 @@ const Rr = (n) => {
|
|
|
3087
3082
|
} catch (t) {
|
|
3088
3083
|
return [!1, "", ""];
|
|
3089
3084
|
}
|
|
3090
|
-
},
|
|
3085
|
+
}, Rr = ({
|
|
3091
3086
|
fileKey: n,
|
|
3092
3087
|
nodeId: e
|
|
3093
3088
|
}) => {
|
|
3094
3089
|
const t = new URL("https://www.figma.com");
|
|
3095
3090
|
return t.pathname = `design/${n}`, e && t.searchParams.set("node-id", e.replace(":", "-")), t;
|
|
3096
|
-
}
|
|
3097
|
-
class
|
|
3091
|
+
};
|
|
3092
|
+
class Zr extends Error {
|
|
3093
|
+
constructor(e, t) {
|
|
3094
|
+
super(e), this.response = t;
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
const nn = "Figma Token Issue";
|
|
3098
|
+
class As extends Error {
|
|
3098
3099
|
constructor({ fileKey: e, reason: t }) {
|
|
3099
3100
|
super(nn), this.fileKey = e, this.reason = t;
|
|
3100
3101
|
}
|
|
3101
3102
|
}
|
|
3102
3103
|
const sn = "Rate Limit Exceeded";
|
|
3103
|
-
class
|
|
3104
|
+
class Os extends Error {
|
|
3104
3105
|
constructor({ fileKey: e }) {
|
|
3105
3106
|
super(sn), this.fileKey = e;
|
|
3106
3107
|
}
|
|
3107
3108
|
}
|
|
3108
3109
|
const rn = "Not Found";
|
|
3109
|
-
class
|
|
3110
|
+
class Cs extends Error {
|
|
3110
3111
|
constructor({ fileKey: e }) {
|
|
3111
3112
|
super(rn), this.fileKey = e;
|
|
3112
3113
|
}
|
|
3113
3114
|
}
|
|
3114
|
-
const
|
|
3115
|
-
class
|
|
3115
|
+
const Ns = (n) => n.message === rn, an = "Unknown Figma API Exception";
|
|
3116
|
+
class js extends Error {
|
|
3116
3117
|
constructor({ fileKey: e, cause: t }) {
|
|
3117
3118
|
super(an), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
3118
3119
|
}
|
|
3119
3120
|
}
|
|
3120
|
-
const Mr = (n) => n.message === an,
|
|
3121
|
+
const Mr = (n) => n.message === an, Is = (n) => n.message === sn, Rs = (n) => [nn, ...[
|
|
3121
3122
|
"Invalid Figma token",
|
|
3122
3123
|
"Figma token expired"
|
|
3123
3124
|
]].includes(
|
|
3124
3125
|
n.message
|
|
3125
|
-
),
|
|
3126
|
-
var s, r;
|
|
3126
|
+
), Zs = (n, e) => {
|
|
3127
|
+
var s, r, a, i;
|
|
3127
3128
|
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
|
|
3129
|
+
throw (t == null ? void 0 : t.status) === 403 ? new As({
|
|
3129
3130
|
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
|
-
}, Pr = (n) =>
|
|
3133
|
-
var
|
|
3131
|
+
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()
|
|
3132
|
+
}) : (t == null ? void 0 : t.status) === 429 ? new Os({ fileKey: e }) : (t == null ? void 0 : t.status) === 404 ? new Cs({ fileKey: e }) : new js({ fileKey: e, cause: n });
|
|
3133
|
+
}, Pr = (n) => Ns(n) ? "NotFound" : Is(n) ? "RateLimitExceeded" : Rs(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
|
|
3134
|
+
var Ms = Object.defineProperty, Ps = Object.defineProperties, $s = Object.getOwnPropertyDescriptors, Lt = Object.getOwnPropertySymbols, Ls = Object.prototype.hasOwnProperty, Ds = Object.prototype.propertyIsEnumerable, Dt = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), on = (n) => {
|
|
3134
3135
|
throw TypeError(n);
|
|
3135
|
-
},
|
|
3136
|
+
}, Vt = (n, e, t) => e in n ? Ms(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, F = (n, e) => {
|
|
3136
3137
|
for (var t in e || (e = {}))
|
|
3137
|
-
|
|
3138
|
+
Ls.call(e, t) && Vt(n, t, e[t]);
|
|
3138
3139
|
if (Lt)
|
|
3139
3140
|
for (var t of Lt(e))
|
|
3140
|
-
Ds.call(e, t) &&
|
|
3141
|
+
Ds.call(e, t) && Vt(n, t, e[t]);
|
|
3141
3142
|
return n;
|
|
3142
|
-
}, Et = (n, e) =>
|
|
3143
|
+
}, Et = (n, e) => Ps(n, $s(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)), W = (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), j = (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
3144
|
var a = (c) => {
|
|
3144
3145
|
try {
|
|
3145
3146
|
o(t.next(c));
|
|
@@ -3154,59 +3155,59 @@ var Ps = Object.defineProperty, $s = Object.defineProperties, Ls = Object.getOwn
|
|
|
3154
3155
|
}
|
|
3155
3156
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
3156
3157
|
o((t = t.apply(n, e)).next());
|
|
3157
|
-
}), Vs = (n, e, t) => (e = n[
|
|
3158
|
-
function
|
|
3158
|
+
}), Vs = (n, e, t) => (e = n[Dt("asyncIterator")]) ? e.call(n) : (n = n[Dt("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), Fs = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
3159
|
+
function Us(n) {
|
|
3159
3160
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
3160
3161
|
}
|
|
3161
|
-
var
|
|
3162
|
-
function
|
|
3163
|
-
return
|
|
3162
|
+
var yt = { exports: {} }, zs = yt.exports, Ft;
|
|
3163
|
+
function Bs() {
|
|
3164
|
+
return Ft || (Ft = 1, function(n, e) {
|
|
3164
3165
|
(function(t, s) {
|
|
3165
3166
|
n.exports = s();
|
|
3166
|
-
})(
|
|
3167
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self :
|
|
3168
|
-
function
|
|
3169
|
-
var Nt = typeof
|
|
3167
|
+
})(zs, function() {
|
|
3168
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Fs, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", v = 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 = h && typeof Array.prototype[Symbol.iterator] == "function", z = q && Object.getPrototypeOf([][Symbol.iterator]()), re = h && typeof String.prototype[Symbol.iterator] == "function", L = re && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, T = -1;
|
|
3169
|
+
function Ct(N) {
|
|
3170
|
+
var Nt = typeof N;
|
|
3170
3171
|
if (Nt !== "object")
|
|
3171
3172
|
return Nt;
|
|
3172
|
-
if (
|
|
3173
|
+
if (N === null)
|
|
3173
3174
|
return "null";
|
|
3174
|
-
if (
|
|
3175
|
+
if (N === s)
|
|
3175
3176
|
return "global";
|
|
3176
|
-
if (Array.isArray(
|
|
3177
|
+
if (Array.isArray(N) && (v === !1 || !(Symbol.toStringTag in N)))
|
|
3177
3178
|
return "Array";
|
|
3178
3179
|
if (typeof window == "object" && window !== null) {
|
|
3179
|
-
if (typeof window.location == "object" &&
|
|
3180
|
+
if (typeof window.location == "object" && N === window.location)
|
|
3180
3181
|
return "Location";
|
|
3181
|
-
if (typeof window.document == "object" &&
|
|
3182
|
+
if (typeof window.document == "object" && N === window.document)
|
|
3182
3183
|
return "Document";
|
|
3183
3184
|
if (typeof window.navigator == "object") {
|
|
3184
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
3185
|
+
if (typeof window.navigator.mimeTypes == "object" && N === window.navigator.mimeTypes)
|
|
3185
3186
|
return "MimeTypeArray";
|
|
3186
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
3187
|
+
if (typeof window.navigator.plugins == "object" && N === window.navigator.plugins)
|
|
3187
3188
|
return "PluginArray";
|
|
3188
3189
|
}
|
|
3189
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
3190
|
-
if (
|
|
3190
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && N instanceof window.HTMLElement) {
|
|
3191
|
+
if (N.tagName === "BLOCKQUOTE")
|
|
3191
3192
|
return "HTMLQuoteElement";
|
|
3192
|
-
if (
|
|
3193
|
+
if (N.tagName === "TD")
|
|
3193
3194
|
return "HTMLTableDataCellElement";
|
|
3194
|
-
if (
|
|
3195
|
+
if (N.tagName === "TH")
|
|
3195
3196
|
return "HTMLTableHeaderCellElement";
|
|
3196
3197
|
}
|
|
3197
3198
|
}
|
|
3198
|
-
var jt =
|
|
3199
|
+
var jt = v && N[Symbol.toStringTag];
|
|
3199
3200
|
if (typeof jt == "string")
|
|
3200
3201
|
return jt;
|
|
3201
|
-
var
|
|
3202
|
-
return
|
|
3202
|
+
var D = Object.getPrototypeOf(N);
|
|
3203
|
+
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(N).slice(K, T);
|
|
3203
3204
|
}
|
|
3204
|
-
return
|
|
3205
|
+
return Ct;
|
|
3205
3206
|
});
|
|
3206
|
-
}(
|
|
3207
|
+
}(yt)), yt.exports;
|
|
3207
3208
|
}
|
|
3208
|
-
var
|
|
3209
|
-
const
|
|
3209
|
+
var Ws = Bs();
|
|
3210
|
+
const qs = /* @__PURE__ */ Us(Ws), Ot = typeof Buffer != "undefined", Hs = Ot && typeof Buffer.from != "undefined", Js = Ot ? (
|
|
3210
3211
|
/**
|
|
3211
3212
|
* is value is Buffer?
|
|
3212
3213
|
*
|
|
@@ -3227,7 +3228,7 @@ const Hs = /* @__PURE__ */ zs(qs), Ct = typeof Buffer != "undefined", Js = Ct &&
|
|
|
3227
3228
|
function() {
|
|
3228
3229
|
return !1;
|
|
3229
3230
|
}
|
|
3230
|
-
),
|
|
3231
|
+
), Gs = Hs ? (
|
|
3231
3232
|
/**
|
|
3232
3233
|
* copy Buffer
|
|
3233
3234
|
*
|
|
@@ -3237,7 +3238,7 @@ const Hs = /* @__PURE__ */ zs(qs), Ct = typeof Buffer != "undefined", Js = Ct &&
|
|
|
3237
3238
|
function(n) {
|
|
3238
3239
|
return Buffer.from(n);
|
|
3239
3240
|
}
|
|
3240
|
-
) :
|
|
3241
|
+
) : Ot ? (
|
|
3241
3242
|
/**
|
|
3242
3243
|
* copy Buffer
|
|
3243
3244
|
*
|
|
@@ -3262,18 +3263,18 @@ const Hs = /* @__PURE__ */ zs(qs), Ct = typeof Buffer != "undefined", Js = Ct &&
|
|
|
3262
3263
|
return n;
|
|
3263
3264
|
}
|
|
3264
3265
|
);
|
|
3265
|
-
function
|
|
3266
|
-
return
|
|
3266
|
+
function Ee(n) {
|
|
3267
|
+
return Js(n) ? "Buffer" : qs(n);
|
|
3267
3268
|
}
|
|
3268
|
-
const
|
|
3269
|
+
const Ks = /* @__PURE__ */ new Set([
|
|
3269
3270
|
"Arguments",
|
|
3270
3271
|
"Array",
|
|
3271
3272
|
"Map",
|
|
3272
3273
|
"Object",
|
|
3273
3274
|
"Set"
|
|
3274
3275
|
]);
|
|
3275
|
-
function
|
|
3276
|
-
switch (t ||
|
|
3276
|
+
function Xs(n, e, t = null) {
|
|
3277
|
+
switch (t || Ee(n)) {
|
|
3277
3278
|
case "Arguments":
|
|
3278
3279
|
case "Array":
|
|
3279
3280
|
case "Object":
|
|
@@ -3284,11 +3285,11 @@ function Ys(n, e, t = null) {
|
|
|
3284
3285
|
return e;
|
|
3285
3286
|
}
|
|
3286
3287
|
}
|
|
3287
|
-
function
|
|
3288
|
-
return
|
|
3288
|
+
function gt(n) {
|
|
3289
|
+
return Ks.has(n);
|
|
3289
3290
|
}
|
|
3290
3291
|
function Ut(n, e, t, s = null) {
|
|
3291
|
-
switch (s ||
|
|
3292
|
+
switch (s || Ee(n)) {
|
|
3292
3293
|
case "Arguments":
|
|
3293
3294
|
case "Array":
|
|
3294
3295
|
case "Object":
|
|
@@ -3303,33 +3304,33 @@ function Ut(n, e, t, s = null) {
|
|
|
3303
3304
|
}
|
|
3304
3305
|
return n;
|
|
3305
3306
|
}
|
|
3306
|
-
const
|
|
3307
|
-
function
|
|
3307
|
+
const Ys = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, Qs = typeof global != "undefined" && global !== null && global.Object === Object && global, er = typeof self != "undefined" && self !== null && self.Object === Object && self, dt = Ys || Qs || er || Function("return this")();
|
|
3308
|
+
function tr(n) {
|
|
3308
3309
|
return n.slice(0);
|
|
3309
3310
|
}
|
|
3310
|
-
function
|
|
3311
|
+
function nr(n) {
|
|
3311
3312
|
return new Boolean(n.valueOf());
|
|
3312
3313
|
}
|
|
3313
|
-
function
|
|
3314
|
+
function sr(n) {
|
|
3314
3315
|
return new DataView(n.buffer);
|
|
3315
3316
|
}
|
|
3316
|
-
function
|
|
3317
|
-
return
|
|
3317
|
+
function rr(n) {
|
|
3318
|
+
return Gs(n);
|
|
3318
3319
|
}
|
|
3319
|
-
function
|
|
3320
|
+
function ar(n) {
|
|
3320
3321
|
return new Date(n.getTime());
|
|
3321
3322
|
}
|
|
3322
|
-
function
|
|
3323
|
+
function ir(n) {
|
|
3323
3324
|
return new Number(n);
|
|
3324
3325
|
}
|
|
3325
|
-
function
|
|
3326
|
+
function or(n) {
|
|
3326
3327
|
return new RegExp(n.source, n.flags);
|
|
3327
3328
|
}
|
|
3328
|
-
function
|
|
3329
|
+
function cr(n) {
|
|
3329
3330
|
return new String(n);
|
|
3330
3331
|
}
|
|
3331
3332
|
function ae(n, e) {
|
|
3332
|
-
return
|
|
3333
|
+
return dt[e].from ? dt[e].from(n) : new dt[e](n);
|
|
3333
3334
|
}
|
|
3334
3335
|
function Z(n) {
|
|
3335
3336
|
return n;
|
|
@@ -3337,25 +3338,25 @@ function Z(n) {
|
|
|
3337
3338
|
function zt() {
|
|
3338
3339
|
return [];
|
|
3339
3340
|
}
|
|
3340
|
-
function
|
|
3341
|
+
function dr() {
|
|
3341
3342
|
return /* @__PURE__ */ new Map();
|
|
3342
3343
|
}
|
|
3343
|
-
function
|
|
3344
|
+
function ur() {
|
|
3344
3345
|
return {};
|
|
3345
3346
|
}
|
|
3346
|
-
function
|
|
3347
|
+
function lr() {
|
|
3347
3348
|
return /* @__PURE__ */ new Set();
|
|
3348
3349
|
}
|
|
3349
|
-
const
|
|
3350
|
+
const fr = /* @__PURE__ */ new Map([
|
|
3350
3351
|
// deep copy
|
|
3351
|
-
["ArrayBuffer",
|
|
3352
|
-
["Boolean",
|
|
3353
|
-
["Buffer",
|
|
3354
|
-
["DataView",
|
|
3355
|
-
["Date",
|
|
3356
|
-
["Number",
|
|
3357
|
-
["RegExp",
|
|
3358
|
-
["String",
|
|
3352
|
+
["ArrayBuffer", tr],
|
|
3353
|
+
["Boolean", nr],
|
|
3354
|
+
["Buffer", rr],
|
|
3355
|
+
["DataView", sr],
|
|
3356
|
+
["Date", ar],
|
|
3357
|
+
["Number", ir],
|
|
3358
|
+
["RegExp", or],
|
|
3359
|
+
["String", cr],
|
|
3359
3360
|
// typed arrays
|
|
3360
3361
|
// TODO: pass bound function
|
|
3361
3362
|
["Float32Array", ae],
|
|
@@ -3389,9 +3390,9 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
3389
3390
|
// NOTE: return empty value, because recursively copy later.
|
|
3390
3391
|
["Arguments", zt],
|
|
3391
3392
|
["Array", zt],
|
|
3392
|
-
["Map",
|
|
3393
|
-
["Object",
|
|
3394
|
-
["Set",
|
|
3393
|
+
["Map", dr],
|
|
3394
|
+
["Object", ur],
|
|
3395
|
+
["Set", lr]
|
|
3395
3396
|
// NOTE: type-detect returns following types
|
|
3396
3397
|
// 'Location'
|
|
3397
3398
|
// 'Document'
|
|
@@ -3403,11 +3404,11 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
3403
3404
|
// TODO: is type-detect never return 'object'?
|
|
3404
3405
|
// 'object'
|
|
3405
3406
|
]);
|
|
3406
|
-
function
|
|
3407
|
+
function hr() {
|
|
3407
3408
|
}
|
|
3408
|
-
function _t(n, e = null, t =
|
|
3409
|
+
function _t(n, e = null, t = hr) {
|
|
3409
3410
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
3410
|
-
const s = e ||
|
|
3411
|
+
const s = e || Ee(n), r = fr.get(s);
|
|
3411
3412
|
if (s === "Object") {
|
|
3412
3413
|
const a = t(n, s);
|
|
3413
3414
|
if (a !== void 0)
|
|
@@ -3424,15 +3425,15 @@ function Oe(n, e = {}) {
|
|
|
3424
3425
|
customizer: t
|
|
3425
3426
|
// TODO: max depth
|
|
3426
3427
|
// depth = Infinity,
|
|
3427
|
-
} = e, s =
|
|
3428
|
-
if (!
|
|
3429
|
-
return
|
|
3428
|
+
} = e, s = Ee(n);
|
|
3429
|
+
if (!gt(s))
|
|
3430
|
+
return vt(n, null, null, null);
|
|
3430
3431
|
const r = _t(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
|
|
3431
|
-
return
|
|
3432
|
+
return vt(n, r, a, i);
|
|
3432
3433
|
}
|
|
3433
|
-
function
|
|
3434
|
-
const a =
|
|
3435
|
-
if (!
|
|
3434
|
+
function vt(n, e, t, s, r) {
|
|
3435
|
+
const a = Ee(n), i = _t(n, a);
|
|
3436
|
+
if (!gt(a))
|
|
3436
3437
|
return i;
|
|
3437
3438
|
let o;
|
|
3438
3439
|
switch (a) {
|
|
@@ -3449,17 +3450,17 @@ function bt(n, e, t, s, r) {
|
|
|
3449
3450
|
break;
|
|
3450
3451
|
}
|
|
3451
3452
|
for (let c of o) {
|
|
3452
|
-
const u =
|
|
3453
|
+
const u = Xs(n, c, a);
|
|
3453
3454
|
if (s.has(u))
|
|
3454
3455
|
Ut(e, c, t.get(u), a);
|
|
3455
3456
|
else {
|
|
3456
|
-
const h =
|
|
3457
|
-
|
|
3457
|
+
const h = Ee(u), v = _t(u, h);
|
|
3458
|
+
gt(h) && (t.set(u, v), s.add(u)), Ut(
|
|
3458
3459
|
e,
|
|
3459
3460
|
c,
|
|
3460
|
-
|
|
3461
|
+
vt(
|
|
3461
3462
|
u,
|
|
3462
|
-
|
|
3463
|
+
v,
|
|
3463
3464
|
t,
|
|
3464
3465
|
s
|
|
3465
3466
|
),
|
|
@@ -3469,33 +3470,33 @@ function bt(n, e, t, s, r) {
|
|
|
3469
3470
|
}
|
|
3470
3471
|
return e;
|
|
3471
3472
|
}
|
|
3472
|
-
const
|
|
3473
|
-
var
|
|
3474
|
-
class
|
|
3473
|
+
const pr = (n) => new Promise((e) => setTimeout(e, n));
|
|
3474
|
+
var Ge, pe, Ke, bt, cn;
|
|
3475
|
+
class mr {
|
|
3475
3476
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
3476
|
-
W(this,
|
|
3477
|
+
W(this, bt), W(this, Ge), W(this, pe), W(this, Ke), j(this, Ge, e), j(this, Ke, t), j(this, pe, 0);
|
|
3477
3478
|
}
|
|
3478
3479
|
run() {
|
|
3479
|
-
return
|
|
3480
|
+
return E(this, null, function* () {
|
|
3480
3481
|
try {
|
|
3481
|
-
return yield k(this,
|
|
3482
|
+
return yield k(this, Ke).call(this);
|
|
3482
3483
|
} catch (e) {
|
|
3483
|
-
if (j(this, pe, k(this, pe) + 1), k(this, pe) > k(this,
|
|
3484
|
+
if (j(this, pe, k(this, pe) + 1), k(this, pe) > k(this, Ge))
|
|
3484
3485
|
throw console.error("Max attempts reached"), e;
|
|
3485
|
-
const t = ee(this,
|
|
3486
|
-
return yield
|
|
3486
|
+
const t = ee(this, bt, cn).call(this);
|
|
3487
|
+
return yield pr(t), yield this.run();
|
|
3487
3488
|
}
|
|
3488
3489
|
});
|
|
3489
3490
|
}
|
|
3490
3491
|
}
|
|
3491
|
-
|
|
3492
|
+
Ge = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakSet(), cn = function() {
|
|
3492
3493
|
return k(this, pe) * 1e3 * 1.5;
|
|
3493
3494
|
};
|
|
3494
|
-
function
|
|
3495
|
+
function yr() {
|
|
3495
3496
|
return typeof CompressionStream != "undefined";
|
|
3496
3497
|
}
|
|
3497
|
-
function
|
|
3498
|
-
return
|
|
3498
|
+
function gr(n) {
|
|
3499
|
+
return E(this, null, function* () {
|
|
3499
3500
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
3500
3501
|
try {
|
|
3501
3502
|
for (var s = Vs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
@@ -3516,12 +3517,12 @@ function vr(n) {
|
|
|
3516
3517
|
});
|
|
3517
3518
|
}
|
|
3518
3519
|
function _r(n) {
|
|
3519
|
-
return
|
|
3520
|
+
return E(this, null, function* () {
|
|
3520
3521
|
const e = yield new Blob(n).arrayBuffer();
|
|
3521
3522
|
return new Uint8Array(e);
|
|
3522
3523
|
});
|
|
3523
3524
|
}
|
|
3524
|
-
class
|
|
3525
|
+
class vr extends Error {
|
|
3525
3526
|
constructor({ resource: e, api: t, args: s, cause: r }) {
|
|
3526
3527
|
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
3528
|
for (const [i, o] of Object.entries(r))
|
|
@@ -3560,12 +3561,12 @@ class je extends Error {
|
|
|
3560
3561
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
3561
3562
|
}
|
|
3562
3563
|
}
|
|
3563
|
-
class
|
|
3564
|
+
class br extends Error {
|
|
3564
3565
|
constructor(e) {
|
|
3565
3566
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
3566
3567
|
}
|
|
3567
3568
|
}
|
|
3568
|
-
class
|
|
3569
|
+
class ut extends Error {
|
|
3569
3570
|
constructor(e) {
|
|
3570
3571
|
super(e), this.name = "Request Validation Error";
|
|
3571
3572
|
}
|
|
@@ -3576,12 +3577,12 @@ function dn() {
|
|
|
3576
3577
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
3577
3578
|
).join("");
|
|
3578
3579
|
}
|
|
3579
|
-
function
|
|
3580
|
+
function wt() {
|
|
3580
3581
|
return Math.floor(Date.now() / 1e3).toString();
|
|
3581
3582
|
}
|
|
3582
|
-
const
|
|
3583
|
-
var me, $, Y,
|
|
3584
|
-
class
|
|
3583
|
+
const wr = 5 * 60 * 1e3, xr = 1 * 1e3;
|
|
3584
|
+
var me, $, Y, xt, kt, Ie;
|
|
3585
|
+
class kr {
|
|
3585
3586
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
3586
3587
|
W(this, Y), W(this, me), W(this, $), this.baseAddress = t, j(this, me, e), j(this, $, {}), this.plugins = [];
|
|
3587
3588
|
}
|
|
@@ -3598,84 +3599,84 @@ class Tr {
|
|
|
3598
3599
|
return j(this, $, e), this;
|
|
3599
3600
|
}
|
|
3600
3601
|
get(e) {
|
|
3601
|
-
return
|
|
3602
|
+
return E(this, arguments, function* (t, s = {}) {
|
|
3602
3603
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
3603
3604
|
let o = a != null ? a : this.headers;
|
|
3604
3605
|
const c = Oe(k(this, $));
|
|
3605
|
-
return j(this, $, {}), c.extraHeaders && (o =
|
|
3606
|
+
return j(this, $, {}), c.extraHeaders && (o = F(F({}, o), c.extraHeaders)), c.requestValidation && (o = Et(F({}, 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
3607
|
});
|
|
3607
3608
|
}
|
|
3608
3609
|
post(e, t) {
|
|
3609
|
-
return
|
|
3610
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3610
3611
|
const i = Oe(k(this, $));
|
|
3611
3612
|
return j(this, $, {}), ee(this, Y, Ie).call(this, s, "POST", r, a, i);
|
|
3612
3613
|
});
|
|
3613
3614
|
}
|
|
3614
3615
|
put(e, t) {
|
|
3615
|
-
return
|
|
3616
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3616
3617
|
const i = Oe(k(this, $));
|
|
3617
3618
|
return j(this, $, {}), ee(this, Y, Ie).call(this, s, "PUT", r, a, i);
|
|
3618
3619
|
});
|
|
3619
3620
|
}
|
|
3620
3621
|
delete(e, t) {
|
|
3621
|
-
return
|
|
3622
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3622
3623
|
const i = Oe(k(this, $));
|
|
3623
3624
|
return j(this, $, {}), ee(this, Y, Ie).call(this, s, "DELETE", r, a, i);
|
|
3624
3625
|
});
|
|
3625
3626
|
}
|
|
3626
3627
|
patch(e, t) {
|
|
3627
|
-
return
|
|
3628
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3628
3629
|
const i = Oe(k(this, $));
|
|
3629
3630
|
return j(this, $, {}), ee(this, Y, Ie).call(this, s, "PATCH", r, a, i);
|
|
3630
3631
|
});
|
|
3631
3632
|
}
|
|
3632
3633
|
}
|
|
3633
|
-
me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(),
|
|
3634
|
-
return
|
|
3635
|
-
const s = () =>
|
|
3634
|
+
me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), xt = function(n, e, t) {
|
|
3635
|
+
return E(this, null, function* () {
|
|
3636
|
+
const s = () => E(this, null, function* () {
|
|
3636
3637
|
var c, u;
|
|
3637
3638
|
try {
|
|
3638
|
-
return yield k(this, me).call(this, n,
|
|
3639
|
+
return yield k(this, me).call(this, n, F(F({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
3639
3640
|
} catch (h) {
|
|
3640
3641
|
throw h instanceof Error && h.name === "AbortError" ? new je({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : h;
|
|
3641
3642
|
}
|
|
3642
3643
|
}), { headers: r } = t != null ? t : {}, a = (c, u) => {
|
|
3643
|
-
var h,
|
|
3644
|
-
return ((h = c == null ? void 0 : c.headers) == null ? void 0 : h.get(u)) || ((
|
|
3645
|
-
}, i = (c) =>
|
|
3644
|
+
var h, v;
|
|
3645
|
+
return ((h = c == null ? void 0 : c.headers) == null ? void 0 : h.get(u)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[u]) || "";
|
|
3646
|
+
}, i = (c) => E(this, null, function* () {
|
|
3646
3647
|
var u;
|
|
3647
3648
|
if (!c.ok) {
|
|
3648
|
-
const
|
|
3649
|
+
const v = yield c.text().catch();
|
|
3649
3650
|
throw new Bt({
|
|
3650
3651
|
url: n,
|
|
3651
3652
|
method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
|
|
3652
3653
|
statusCode: c.status,
|
|
3653
3654
|
requestHeaders: r,
|
|
3654
3655
|
responseHeaders: c.headers,
|
|
3655
|
-
body:
|
|
3656
|
+
body: v
|
|
3656
3657
|
});
|
|
3657
3658
|
}
|
|
3658
3659
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
3659
3660
|
try {
|
|
3660
|
-
const
|
|
3661
|
-
if (!
|
|
3662
|
-
throw new
|
|
3663
|
-
const
|
|
3664
|
-
if (isNaN(
|
|
3665
|
-
throw new
|
|
3666
|
-
} catch (
|
|
3667
|
-
const
|
|
3668
|
-
throw new
|
|
3661
|
+
const v = a(c, "x-response-nonce"), C = r == null ? void 0 : r["X-Request-Nonce"];
|
|
3662
|
+
if (!v || v !== C)
|
|
3663
|
+
throw new ut("Response nonce mismatch");
|
|
3664
|
+
const A = Number(a(c, "x-response-timestamp")), O = Number(wt()), R = 60 * 60 * 24;
|
|
3665
|
+
if (isNaN(A) || Math.abs(O - A) > R)
|
|
3666
|
+
throw new ut("Invalid response timestamp");
|
|
3667
|
+
} catch (v) {
|
|
3668
|
+
const C = v instanceof Error ? v.message : "Request validation failed";
|
|
3669
|
+
throw new ut(C);
|
|
3669
3670
|
}
|
|
3670
3671
|
let h = yield c.text();
|
|
3671
3672
|
try {
|
|
3672
3673
|
h = JSON.parse(h);
|
|
3673
|
-
} catch (
|
|
3674
|
+
} catch (v) {
|
|
3674
3675
|
}
|
|
3675
3676
|
return h;
|
|
3676
3677
|
});
|
|
3677
3678
|
if (e.retry) {
|
|
3678
|
-
const c = yield new
|
|
3679
|
+
const c = yield new mr({
|
|
3679
3680
|
maxAttempts: e.retry,
|
|
3680
3681
|
func: s
|
|
3681
3682
|
}).run();
|
|
@@ -3684,41 +3685,41 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3684
3685
|
const o = yield s();
|
|
3685
3686
|
return yield i(o);
|
|
3686
3687
|
});
|
|
3687
|
-
},
|
|
3688
|
-
return
|
|
3688
|
+
}, kt = function(n, e, t) {
|
|
3689
|
+
return E(this, null, function* () {
|
|
3689
3690
|
var s, r;
|
|
3690
3691
|
const {
|
|
3691
3692
|
onProgress: a,
|
|
3692
3693
|
abortSignal: i,
|
|
3693
|
-
pollingInterval: o = () =>
|
|
3694
|
-
maxTimeout: c =
|
|
3694
|
+
pollingInterval: o = () => xr,
|
|
3695
|
+
maxTimeout: c = wr
|
|
3695
3696
|
} = e, u = `${n}/async`, h = `${n}/async/job`;
|
|
3696
|
-
let
|
|
3697
|
+
let v;
|
|
3697
3698
|
try {
|
|
3698
|
-
|
|
3699
|
-
} catch (
|
|
3700
|
-
throw
|
|
3699
|
+
v = yield k(this, me).call(this, u, F(F({}, t), i && { signal: i }));
|
|
3700
|
+
} catch (O) {
|
|
3701
|
+
throw O instanceof Error && O.name === "AbortError" ? new je({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : O;
|
|
3701
3702
|
}
|
|
3702
|
-
if (!
|
|
3703
|
-
const
|
|
3703
|
+
if (!v.ok) {
|
|
3704
|
+
const O = yield v.text().catch();
|
|
3704
3705
|
throw new Bt({
|
|
3705
3706
|
url: n,
|
|
3706
3707
|
method: (r = t == null ? void 0 : t.method) != null ? r : "GET",
|
|
3707
|
-
statusCode:
|
|
3708
|
+
statusCode: v.status,
|
|
3708
3709
|
requestHeaders: this.headers,
|
|
3709
|
-
responseHeaders:
|
|
3710
|
-
body:
|
|
3710
|
+
responseHeaders: v.headers,
|
|
3711
|
+
body: O
|
|
3711
3712
|
});
|
|
3712
3713
|
}
|
|
3713
|
-
const
|
|
3714
|
-
if (!
|
|
3714
|
+
const C = yield v.json(), { job_id: A } = C;
|
|
3715
|
+
if (!A)
|
|
3715
3716
|
throw new Error("Job ID not found in response");
|
|
3716
|
-
return new Promise((
|
|
3717
|
+
return new Promise((O, R) => E(this, null, function* () {
|
|
3717
3718
|
const q = setTimeout(() => {
|
|
3718
3719
|
R(new Error("Job timed out"));
|
|
3719
|
-
}, c), z = (re = 0) =>
|
|
3720
|
+
}, c), z = (re = 0) => E(this, null, function* () {
|
|
3720
3721
|
if (i != null && i.aborted) {
|
|
3721
|
-
clearTimeout(q), k(this, me).call(this, `${h}/${
|
|
3722
|
+
clearTimeout(q), k(this, me).call(this, `${h}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
3722
3723
|
R(new je({ canceled: !0 }));
|
|
3723
3724
|
}).catch((L) => {
|
|
3724
3725
|
R(new je({ canceled: !1 }));
|
|
@@ -3726,13 +3727,13 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3726
3727
|
return;
|
|
3727
3728
|
}
|
|
3728
3729
|
try {
|
|
3729
|
-
const L = yield (yield k(this, me).call(this, `${h}/${
|
|
3730
|
+
const L = yield (yield k(this, me).call(this, `${h}/${A}`, { headers: this.headers })).json();
|
|
3730
3731
|
if (L.status === "success") {
|
|
3731
3732
|
clearTimeout(q);
|
|
3732
3733
|
const K = L.response_json;
|
|
3733
|
-
|
|
3734
|
+
O(K);
|
|
3734
3735
|
} else if (L.status === "failed")
|
|
3735
|
-
clearTimeout(q), R(new
|
|
3736
|
+
clearTimeout(q), R(new br(L.response_json));
|
|
3736
3737
|
else {
|
|
3737
3738
|
a && a(L.response_json);
|
|
3738
3739
|
const K = o(re);
|
|
@@ -3746,19 +3747,19 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3746
3747
|
}));
|
|
3747
3748
|
});
|
|
3748
3749
|
}, Ie = function(n, e, t, s, r) {
|
|
3749
|
-
return
|
|
3750
|
+
return E(this, null, function* () {
|
|
3750
3751
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
3751
3752
|
let c = i != null ? i : this.headers;
|
|
3752
|
-
r.extraHeaders && (c =
|
|
3753
|
+
r.extraHeaders && (c = F(F({}, c), r.extraHeaders)), r.requestValidation && (c = Et(F({}, c), { "X-Request-Nonce": dn(), "X-Request-Timestamp": wt() }));
|
|
3753
3754
|
let u = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
3754
|
-
return r.compress &&
|
|
3755
|
+
return r.compress && yr() && (c["Content-Encoding"] = "gzip", u = yield gr(u)), r.async ? yield ee(this, Y, kt).call(this, `${o}${n}`, r.async, {
|
|
3755
3756
|
method: e,
|
|
3756
3757
|
headers: c,
|
|
3757
3758
|
body: u
|
|
3758
|
-
}) : yield ee(this, Y,
|
|
3759
|
+
}) : yield ee(this, Y, xt).call(this, `${o}${n}`, r, { method: e, headers: c, body: u });
|
|
3759
3760
|
});
|
|
3760
3761
|
};
|
|
3761
|
-
const Wt = (n, e, t, s) => n instanceof je ? n : new
|
|
3762
|
+
const Wt = (n, e, t, s) => n instanceof je ? n : new vr({ resource: e, api: String(t), args: s, cause: n }), lt = (n, e) => new Proxy(e, {
|
|
3762
3763
|
get(t, s) {
|
|
3763
3764
|
return (...r) => {
|
|
3764
3765
|
var a;
|
|
@@ -3780,20 +3781,20 @@ const Wt = (n, e, t, s) => n instanceof je ? n : new br({ resource: e, api: Stri
|
|
|
3780
3781
|
}
|
|
3781
3782
|
});
|
|
3782
3783
|
var Re;
|
|
3783
|
-
class
|
|
3784
|
+
class Tr {
|
|
3784
3785
|
constructor(e) {
|
|
3785
3786
|
W(this, Re), this.resourceName = "Files", j(this, Re, e);
|
|
3786
3787
|
}
|
|
3787
3788
|
get(e) {
|
|
3788
|
-
return
|
|
3789
|
-
const r = new URLSearchParams(
|
|
3789
|
+
return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
3790
|
+
const r = new URLSearchParams(F({
|
|
3790
3791
|
plugin_data: "857346721138427857"
|
|
3791
3792
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
3792
3793
|
return yield k(this, Re).get(a);
|
|
3793
3794
|
});
|
|
3794
3795
|
}
|
|
3795
3796
|
getImageFills(e) {
|
|
3796
|
-
return
|
|
3797
|
+
return E(this, arguments, function* ({ fileKey: t }) {
|
|
3797
3798
|
var s, r;
|
|
3798
3799
|
const a = `v1/files/${t}/images`;
|
|
3799
3800
|
return (r = (s = (yield k(this, Re).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
@@ -3801,29 +3802,29 @@ class Sr {
|
|
|
3801
3802
|
}
|
|
3802
3803
|
}
|
|
3803
3804
|
Re = /* @__PURE__ */ new WeakMap();
|
|
3804
|
-
const
|
|
3805
|
+
const Sr = (n, e, t) => {
|
|
3805
3806
|
const s = e.sort();
|
|
3806
3807
|
return `${n}-${s.join("-")}-${t}`;
|
|
3807
3808
|
}, Er = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
3808
|
-
var Q,
|
|
3809
|
-
class
|
|
3809
|
+
var Q, Tt, un;
|
|
3810
|
+
class Ar {
|
|
3810
3811
|
constructor(e) {
|
|
3811
|
-
W(this,
|
|
3812
|
+
W(this, Tt), W(this, Q), this.resourceName = "Images", j(this, Q, e);
|
|
3812
3813
|
}
|
|
3813
3814
|
/**
|
|
3814
3815
|
* Return the URL for the _layer_ images for the given nodes.
|
|
3815
3816
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
3816
3817
|
*/
|
|
3817
3818
|
get(e) {
|
|
3818
|
-
return
|
|
3819
|
-
const i =
|
|
3819
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
3820
|
+
const i = Sr(t, s, r), o = k(this, Q).cache.images.entries.get(i);
|
|
3820
3821
|
if (Er(o))
|
|
3821
3822
|
return o.result;
|
|
3822
3823
|
o && k(this, Q).cache.images.entries.delete(i);
|
|
3823
3824
|
const c = k(this, Q).cache.images.pendingRequests.get(i);
|
|
3824
3825
|
if (c)
|
|
3825
3826
|
return c;
|
|
3826
|
-
const u = ee(this,
|
|
3827
|
+
const u = ee(this, Tt, un).call(this, i, t, s, r, a);
|
|
3827
3828
|
k(this, Q).cache.images.pendingRequests.set(i, u);
|
|
3828
3829
|
try {
|
|
3829
3830
|
return yield u;
|
|
@@ -3833,8 +3834,8 @@ class Or {
|
|
|
3833
3834
|
});
|
|
3834
3835
|
}
|
|
3835
3836
|
}
|
|
3836
|
-
Q = /* @__PURE__ */ new WeakMap(),
|
|
3837
|
-
return
|
|
3837
|
+
Q = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakSet(), un = function(n, e, t, s, r) {
|
|
3838
|
+
return E(this, null, function* () {
|
|
3838
3839
|
const a = yield k(this, Q).get(
|
|
3839
3840
|
`v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
3840
3841
|
);
|
|
@@ -3844,25 +3845,25 @@ Q = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), un = func
|
|
|
3844
3845
|
}), a;
|
|
3845
3846
|
});
|
|
3846
3847
|
};
|
|
3847
|
-
var
|
|
3848
|
-
class
|
|
3848
|
+
var Xe;
|
|
3849
|
+
class Or {
|
|
3849
3850
|
constructor(e) {
|
|
3850
|
-
W(this,
|
|
3851
|
+
W(this, Xe), this.resourceName = "Nodes", j(this, Xe, e);
|
|
3851
3852
|
}
|
|
3852
3853
|
get(e) {
|
|
3853
|
-
return
|
|
3854
|
-
const a = Et(
|
|
3854
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
3855
|
+
const a = Et(F({}, r), {
|
|
3855
3856
|
ids: s.join(",")
|
|
3856
|
-
}), i = new URLSearchParams(
|
|
3857
|
+
}), i = new URLSearchParams(F({
|
|
3857
3858
|
plugin_data: "857346721138427857"
|
|
3858
3859
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
3859
|
-
return yield k(this,
|
|
3860
|
+
return yield k(this, Xe).get(o);
|
|
3860
3861
|
});
|
|
3861
3862
|
}
|
|
3862
3863
|
}
|
|
3863
|
-
|
|
3864
|
+
Xe = /* @__PURE__ */ new WeakMap();
|
|
3864
3865
|
var de;
|
|
3865
|
-
class ln extends
|
|
3866
|
+
class ln extends kr {
|
|
3866
3867
|
constructor({
|
|
3867
3868
|
baseAddress: e = "https://api.figma.com/",
|
|
3868
3869
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
@@ -3872,7 +3873,7 @@ class ln extends Tr {
|
|
|
3872
3873
|
entries: /* @__PURE__ */ new Map(),
|
|
3873
3874
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
3874
3875
|
}
|
|
3875
|
-
}, this.files =
|
|
3876
|
+
}, this.files = lt(this, new Tr(this)), this.nodes = lt(this, new Or(this)), this.images = lt(this, new Ar(this));
|
|
3876
3877
|
}
|
|
3877
3878
|
set token(e) {
|
|
3878
3879
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
@@ -3920,9 +3921,9 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3920
3921
|
params: d({}, r)
|
|
3921
3922
|
})).nodes;
|
|
3922
3923
|
} catch (i) {
|
|
3923
|
-
return
|
|
3924
|
+
return Zs(i, n);
|
|
3924
3925
|
}
|
|
3925
|
-
}),
|
|
3926
|
+
}), Cr = (n, e) => new ReadableStream({
|
|
3926
3927
|
start(t) {
|
|
3927
3928
|
n.generateCode(e, (s) => {
|
|
3928
3929
|
s.type === "error" ? (console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"), t.enqueue({
|
|
@@ -3941,12 +3942,12 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3941
3942
|
}), t.close();
|
|
3942
3943
|
});
|
|
3943
3944
|
}
|
|
3944
|
-
}),
|
|
3945
|
-
var c, u, h,
|
|
3946
|
-
const t =
|
|
3945
|
+
}), Dr = (n, e) => P(void 0, null, function* () {
|
|
3946
|
+
var c, u, h, v, C, A, O;
|
|
3947
|
+
const t = Cr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
3947
3948
|
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((h = (u = a.value) == null ? void 0 : u.payload) != null && h.status))
|
|
3948
3949
|
return new Response(JSON.stringify(a.value), {
|
|
3949
|
-
status: ((
|
|
3950
|
+
status: ((v = a.value) == null ? void 0 : v.type) === "error" && (O = (A = (C = a.value) == null ? void 0 : C.payload) == null ? void 0 : A.status) != null ? O : 500,
|
|
3950
3951
|
headers: {
|
|
3951
3952
|
"Content-Type": "application/json"
|
|
3952
3953
|
}
|
|
@@ -3974,25 +3975,25 @@ data: ${JSON.stringify(
|
|
|
3974
3975
|
});
|
|
3975
3976
|
});
|
|
3976
3977
|
export {
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3978
|
+
jr as Anima,
|
|
3979
|
+
Ae as CodegenError,
|
|
3980
|
+
As as FigmaTokenIssue,
|
|
3981
|
+
Cs as NotFound,
|
|
3982
|
+
Os as RateLimitExceeded,
|
|
3983
|
+
Zr as ResponseError,
|
|
3984
|
+
js as UnknownFigmaApiException,
|
|
3985
|
+
Dr as createCodegenResponseEventStream,
|
|
3986
|
+
Cr as createCodegenStream,
|
|
3987
|
+
Rr as formatToFigmaLink,
|
|
3987
3988
|
Pr as getFigmaApiErrorType,
|
|
3988
3989
|
$r as getFigmaFile,
|
|
3989
3990
|
Lr as getFileNodes,
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3991
|
+
Zs as handleFigmaApiError,
|
|
3992
|
+
Rs as isFigmaTokenIssue,
|
|
3993
|
+
Ns as isNotFound,
|
|
3994
|
+
Is as isRateLimitExceeded,
|
|
3994
3995
|
Mr as isUnknownFigmaApiException,
|
|
3995
|
-
|
|
3996
|
+
Ir as isValidFigmaUrl,
|
|
3996
3997
|
Es as validateSettings
|
|
3997
3998
|
};
|
|
3998
3999
|
//# sourceMappingURL=index.js.map
|