@animaapp/anima-sdk 0.6.18 → 0.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +186 -48
- package/dist/index.js +547 -496
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,8 +13,8 @@ var Dt = (r, e, t) => e in r ? xr(r, e, { enumerable: !0, configurable: !0, writ
|
|
|
13
13
|
Er.call(e, t) && Dt(r, t, e[t]);
|
|
14
14
|
return r;
|
|
15
15
|
}, g = (r, e) => kr(r, Tr(e));
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var mt = (r, e, t) => e.has(r) || Lt("Cannot " + t);
|
|
17
|
+
var A = (r, e, t) => (mt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), tt = (r, e, t) => e.has(r) ? Lt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), gt = (r, e, t, s) => (mt(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), Se = (r, e, t) => (mt(r, e, "access private method"), t);
|
|
18
18
|
var C = (r, e, t) => new Promise((s, n) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
@@ -31,7 +31,7 @@ var C = (r, e, t) => new Promise((s, n) => {
|
|
|
31
31
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
32
|
o((t = t.apply(r, e)).next());
|
|
33
33
|
});
|
|
34
|
-
class
|
|
34
|
+
class ye extends Error {
|
|
35
35
|
constructor({
|
|
36
36
|
name: e,
|
|
37
37
|
reason: t,
|
|
@@ -58,13 +58,13 @@ class Cr extends Error {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const tr = "Request Too Large";
|
|
61
|
-
class
|
|
61
|
+
class Ir extends Error {
|
|
62
62
|
constructor({ fileKey: e, cause: t }) {
|
|
63
63
|
super(tr), this.fileKey = e, this.cause = t;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
const rr = "Not Found";
|
|
67
|
-
class
|
|
67
|
+
class Or extends Error {
|
|
68
68
|
constructor({ fileKey: e, cause: t }) {
|
|
69
69
|
super(rr), this.fileKey = e, this.cause = t;
|
|
70
70
|
}
|
|
@@ -75,7 +75,7 @@ class jr extends Error {
|
|
|
75
75
|
super(sr), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const
|
|
78
|
+
const Xn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Qt, ...[
|
|
79
79
|
"Invalid Figma token",
|
|
80
80
|
"Figma token expired"
|
|
81
81
|
]].includes(
|
|
@@ -93,12 +93,12 @@ const Kn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Q
|
|
|
93
93
|
if (a === 429)
|
|
94
94
|
return new Cr({ fileKey: e, cause: r });
|
|
95
95
|
if (a === 404)
|
|
96
|
-
return new Ir({ fileKey: e, cause: r });
|
|
97
|
-
if (a === 400 && n.includes("Request too large"))
|
|
98
96
|
return new Or({ fileKey: e, cause: r });
|
|
97
|
+
if (a === 400 && n.includes("Request too large"))
|
|
98
|
+
return new Ir({ fileKey: e, cause: r });
|
|
99
99
|
}
|
|
100
100
|
return new jr({ fileKey: e, cause: r });
|
|
101
|
-
},
|
|
101
|
+
}, Yn = (r) => Nr(r) ? "NotFound" : Rr(r) ? "RateLimitExceeded" : Zr(r) ? "FigmaTokenIssue" : Mr(r) ? "RequestTooLarge" : "UnknownFigmaApiException";
|
|
102
102
|
var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwnPropertyDescriptors, Vt = Object.getOwnPropertySymbols, Dr = Object.prototype.hasOwnProperty, Lr = Object.prototype.propertyIsEnumerable, Ut = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), ar = (r) => {
|
|
103
103
|
throw TypeError(r);
|
|
104
104
|
}, Wt = (r, e, t) => e in r ? Pr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, U = (r, e) => {
|
|
@@ -108,7 +108,7 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
|
|
|
108
108
|
for (var t of Vt(e))
|
|
109
109
|
Lr.call(e, t) && Wt(r, t, e[t]);
|
|
110
110
|
return r;
|
|
111
|
-
},
|
|
111
|
+
}, Zt = (r, e) => $r(r, Fr(e)), Mt = (r, e, t) => e.has(r) || ar("Cannot " + t), S = (r, e, t) => (Mt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), q = (r, e, t) => e.has(r) ? ar("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), R = (r, e, t, s) => (Mt(r, e, "write to private field"), e.set(r, t), t), Y = (r, e, t) => (Mt(r, e, "access private method"), t), N = (r, e, t) => new Promise((s, n) => {
|
|
112
112
|
var a = (c) => {
|
|
113
113
|
try {
|
|
114
114
|
o(t.next(c));
|
|
@@ -127,55 +127,55 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
|
|
|
127
127
|
function Wr(r) {
|
|
128
128
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var wt = { exports: {} }, zr = wt.exports, zt;
|
|
131
131
|
function Br() {
|
|
132
132
|
return zt || (zt = 1, function(r, e) {
|
|
133
133
|
(function(t, s) {
|
|
134
134
|
r.exports = s();
|
|
135
135
|
})(zr, function() {
|
|
136
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", M = a && typeof Map.prototype.entries == "function", F = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), z = M && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()),
|
|
137
|
-
function
|
|
138
|
-
var
|
|
139
|
-
if (
|
|
140
|
-
return
|
|
141
|
-
if (
|
|
136
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", M = a && typeof Map.prototype.entries == "function", F = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), z = M && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), re = f && typeof Array.prototype[Symbol.iterator] == "function", me = re && Object.getPrototypeOf([][Symbol.iterator]()), ce = f && typeof String.prototype[Symbol.iterator] == "function", V = ce && Object.getPrototypeOf(""[Symbol.iterator]()), de = 8, Te = -1;
|
|
137
|
+
function B(O) {
|
|
138
|
+
var ge = typeof O;
|
|
139
|
+
if (ge !== "object")
|
|
140
|
+
return ge;
|
|
141
|
+
if (O === null)
|
|
142
142
|
return "null";
|
|
143
|
-
if (
|
|
143
|
+
if (O === s)
|
|
144
144
|
return "global";
|
|
145
|
-
if (Array.isArray(
|
|
145
|
+
if (Array.isArray(O) && (v === !1 || !(Symbol.toStringTag in O)))
|
|
146
146
|
return "Array";
|
|
147
147
|
if (typeof window == "object" && window !== null) {
|
|
148
|
-
if (typeof window.location == "object" &&
|
|
148
|
+
if (typeof window.location == "object" && O === window.location)
|
|
149
149
|
return "Location";
|
|
150
|
-
if (typeof window.document == "object" &&
|
|
150
|
+
if (typeof window.document == "object" && O === window.document)
|
|
151
151
|
return "Document";
|
|
152
152
|
if (typeof window.navigator == "object") {
|
|
153
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
153
|
+
if (typeof window.navigator.mimeTypes == "object" && O === window.navigator.mimeTypes)
|
|
154
154
|
return "MimeTypeArray";
|
|
155
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
155
|
+
if (typeof window.navigator.plugins == "object" && O === window.navigator.plugins)
|
|
156
156
|
return "PluginArray";
|
|
157
157
|
}
|
|
158
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
159
|
-
if (
|
|
158
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && O instanceof window.HTMLElement) {
|
|
159
|
+
if (O.tagName === "BLOCKQUOTE")
|
|
160
160
|
return "HTMLQuoteElement";
|
|
161
|
-
if (
|
|
161
|
+
if (O.tagName === "TD")
|
|
162
162
|
return "HTMLTableDataCellElement";
|
|
163
|
-
if (
|
|
163
|
+
if (O.tagName === "TH")
|
|
164
164
|
return "HTMLTableHeaderCellElement";
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
var
|
|
168
|
-
if (typeof
|
|
169
|
-
return
|
|
170
|
-
var
|
|
171
|
-
return
|
|
167
|
+
var k = v && O[Symbol.toStringTag];
|
|
168
|
+
if (typeof k == "string")
|
|
169
|
+
return k;
|
|
170
|
+
var D = Object.getPrototypeOf(O);
|
|
171
|
+
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" : d && D === DataView.prototype ? "DataView" : a && D === z ? "Map Iterator" : i && D === F ? "Set Iterator" : re && D === me ? "Array Iterator" : ce && D === V ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(O).slice(de, Te);
|
|
172
172
|
}
|
|
173
|
-
return
|
|
173
|
+
return B;
|
|
174
174
|
});
|
|
175
|
-
}(
|
|
175
|
+
}(wt)), wt.exports;
|
|
176
176
|
}
|
|
177
177
|
var qr = Br();
|
|
178
|
-
const Hr = /* @__PURE__ */ Wr(qr),
|
|
178
|
+
const Hr = /* @__PURE__ */ Wr(qr), Pt = typeof Buffer != "undefined", Jr = Pt && typeof Buffer.from != "undefined", Gr = Pt ? (
|
|
179
179
|
/**
|
|
180
180
|
* is value is Buffer?
|
|
181
181
|
*
|
|
@@ -206,7 +206,7 @@ const Hr = /* @__PURE__ */ Wr(qr), Zt = typeof Buffer != "undefined", Jr = Zt &&
|
|
|
206
206
|
function(r) {
|
|
207
207
|
return Buffer.from(r);
|
|
208
208
|
}
|
|
209
|
-
) :
|
|
209
|
+
) : Pt ? (
|
|
210
210
|
/**
|
|
211
211
|
* copy Buffer
|
|
212
212
|
*
|
|
@@ -231,7 +231,7 @@ const Hr = /* @__PURE__ */ Wr(qr), Zt = typeof Buffer != "undefined", Jr = Zt &&
|
|
|
231
231
|
return r;
|
|
232
232
|
}
|
|
233
233
|
);
|
|
234
|
-
function
|
|
234
|
+
function Ie(r) {
|
|
235
235
|
return Gr(r) ? "Buffer" : Hr(r);
|
|
236
236
|
}
|
|
237
237
|
const Xr = /* @__PURE__ */ new Set([
|
|
@@ -242,7 +242,7 @@ const Xr = /* @__PURE__ */ new Set([
|
|
|
242
242
|
"Set"
|
|
243
243
|
]);
|
|
244
244
|
function Yr(r, e, t = null) {
|
|
245
|
-
switch (t ||
|
|
245
|
+
switch (t || Ie(r)) {
|
|
246
246
|
case "Arguments":
|
|
247
247
|
case "Array":
|
|
248
248
|
case "Object":
|
|
@@ -253,11 +253,11 @@ function Yr(r, e, t = null) {
|
|
|
253
253
|
return e;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function xt(r) {
|
|
257
257
|
return Xr.has(r);
|
|
258
258
|
}
|
|
259
259
|
function Bt(r, e, t, s = null) {
|
|
260
|
-
switch (s ||
|
|
260
|
+
switch (s || Ie(r)) {
|
|
261
261
|
case "Arguments":
|
|
262
262
|
case "Array":
|
|
263
263
|
case "Object":
|
|
@@ -272,7 +272,7 @@ function Bt(r, e, t, s = null) {
|
|
|
272
272
|
}
|
|
273
273
|
return r;
|
|
274
274
|
}
|
|
275
|
-
const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self,
|
|
275
|
+
const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self, yt = Qr || es || ts || Function("return this")();
|
|
276
276
|
function rs(r) {
|
|
277
277
|
return r.slice(0);
|
|
278
278
|
}
|
|
@@ -297,8 +297,8 @@ function cs(r) {
|
|
|
297
297
|
function ds(r) {
|
|
298
298
|
return new String(r);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
return
|
|
300
|
+
function se(r, e) {
|
|
301
|
+
return yt[e].from ? yt[e].from(r) : new yt[e](r);
|
|
302
302
|
}
|
|
303
303
|
function P(r) {
|
|
304
304
|
return r;
|
|
@@ -327,15 +327,15 @@ const hs = /* @__PURE__ */ new Map([
|
|
|
327
327
|
["String", ds],
|
|
328
328
|
// typed arrays
|
|
329
329
|
// TODO: pass bound function
|
|
330
|
-
["Float32Array",
|
|
331
|
-
["Float64Array",
|
|
332
|
-
["Int16Array",
|
|
333
|
-
["Int32Array",
|
|
334
|
-
["Int8Array",
|
|
335
|
-
["Uint16Array",
|
|
336
|
-
["Uint32Array",
|
|
337
|
-
["Uint8Array",
|
|
338
|
-
["Uint8ClampedArray",
|
|
330
|
+
["Float32Array", se],
|
|
331
|
+
["Float64Array", se],
|
|
332
|
+
["Int16Array", se],
|
|
333
|
+
["Int32Array", se],
|
|
334
|
+
["Int8Array", se],
|
|
335
|
+
["Uint16Array", se],
|
|
336
|
+
["Uint32Array", se],
|
|
337
|
+
["Uint8Array", se],
|
|
338
|
+
["Uint8ClampedArray", se],
|
|
339
339
|
// shallow copy
|
|
340
340
|
["Array Iterator", P],
|
|
341
341
|
["Map Iterator", P],
|
|
@@ -374,9 +374,9 @@ const hs = /* @__PURE__ */ new Map([
|
|
|
374
374
|
]);
|
|
375
375
|
function ps() {
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function kt(r, e = null, t = ps) {
|
|
378
378
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
379
|
-
const s = e ||
|
|
379
|
+
const s = e || Ie(r), n = hs.get(s);
|
|
380
380
|
if (s === "Object") {
|
|
381
381
|
const a = t(r, s);
|
|
382
382
|
if (a !== void 0)
|
|
@@ -384,7 +384,7 @@ function wt(r, e = null, t = ps) {
|
|
|
384
384
|
}
|
|
385
385
|
return n ? n(r, s) : r;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function Re(r, e = {}) {
|
|
388
388
|
typeof e == "function" && (e = {
|
|
389
389
|
customizer: e
|
|
390
390
|
});
|
|
@@ -393,15 +393,15 @@ function je(r, e = {}) {
|
|
|
393
393
|
customizer: t
|
|
394
394
|
// TODO: max depth
|
|
395
395
|
// depth = Infinity,
|
|
396
|
-
} = e, s =
|
|
397
|
-
if (!
|
|
398
|
-
return
|
|
399
|
-
const n =
|
|
400
|
-
return
|
|
396
|
+
} = e, s = Ie(r);
|
|
397
|
+
if (!xt(s))
|
|
398
|
+
return Tt(r, null, null, null);
|
|
399
|
+
const n = kt(r, s, t), a = new WeakMap([[r, n]]), i = new WeakSet([r]);
|
|
400
|
+
return Tt(r, n, a, i);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
const a =
|
|
404
|
-
if (!
|
|
402
|
+
function Tt(r, e, t, s, n) {
|
|
403
|
+
const a = Ie(r), i = kt(r, a);
|
|
404
|
+
if (!xt(a))
|
|
405
405
|
return i;
|
|
406
406
|
let o;
|
|
407
407
|
switch (a) {
|
|
@@ -422,11 +422,11 @@ function xt(r, e, t, s, n) {
|
|
|
422
422
|
if (s.has(d))
|
|
423
423
|
Bt(e, c, t.get(d), a);
|
|
424
424
|
else {
|
|
425
|
-
const f =
|
|
426
|
-
|
|
425
|
+
const f = Ie(d), v = kt(d, f);
|
|
426
|
+
xt(f) && (t.set(d, v), s.add(d)), Bt(
|
|
427
427
|
e,
|
|
428
428
|
c,
|
|
429
|
-
|
|
429
|
+
Tt(
|
|
430
430
|
d,
|
|
431
431
|
v,
|
|
432
432
|
t,
|
|
@@ -439,32 +439,32 @@ function xt(r, e, t, s, n) {
|
|
|
439
439
|
return e;
|
|
440
440
|
}
|
|
441
441
|
const ms = (r) => new Promise((e) => setTimeout(e, r));
|
|
442
|
-
var
|
|
442
|
+
var rt, ve, st, St, ir;
|
|
443
443
|
class gs {
|
|
444
444
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
445
|
-
|
|
445
|
+
q(this, St), q(this, rt), q(this, ve), q(this, st), R(this, rt, e), R(this, st, t), R(this, ve, 0);
|
|
446
446
|
}
|
|
447
447
|
run() {
|
|
448
|
-
return
|
|
448
|
+
return N(this, null, function* () {
|
|
449
449
|
try {
|
|
450
|
-
return yield S(this,
|
|
450
|
+
return yield S(this, st).call(this);
|
|
451
451
|
} catch (e) {
|
|
452
|
-
if (R(this,
|
|
452
|
+
if (R(this, ve, S(this, ve) + 1), S(this, ve) > S(this, rt))
|
|
453
453
|
throw console.error("Max attempts reached"), e;
|
|
454
|
-
const t =
|
|
454
|
+
const t = Y(this, St, ir).call(this);
|
|
455
455
|
return yield ms(t), yield this.run();
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
|
|
461
|
-
return S(this,
|
|
460
|
+
rt = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), ir = function() {
|
|
461
|
+
return S(this, ve) * 1e3 * 1.5;
|
|
462
462
|
};
|
|
463
463
|
function ys() {
|
|
464
464
|
return typeof CompressionStream != "undefined";
|
|
465
465
|
}
|
|
466
466
|
function vs(r) {
|
|
467
|
-
return
|
|
467
|
+
return N(this, null, function* () {
|
|
468
468
|
const e = new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
469
469
|
try {
|
|
470
470
|
for (var s = Vr(e), n, a, i; n = !(a = yield s.next()).done; n = !1) {
|
|
@@ -485,7 +485,7 @@ function vs(r) {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
function _s(r) {
|
|
488
|
-
return
|
|
488
|
+
return N(this, null, function* () {
|
|
489
489
|
const e = yield new Blob(r).arrayBuffer();
|
|
490
490
|
return new Uint8Array(e);
|
|
491
491
|
});
|
|
@@ -523,7 +523,7 @@ class Ht extends Error {
|
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
class
|
|
526
|
+
class Ze extends Error {
|
|
527
527
|
constructor(e = {}) {
|
|
528
528
|
const { canceled: t = !1 } = e;
|
|
529
529
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
@@ -534,7 +534,7 @@ class ws extends Error {
|
|
|
534
534
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
class
|
|
537
|
+
class vt extends Error {
|
|
538
538
|
constructor(e) {
|
|
539
539
|
super(e), this.name = "Request Validation Error";
|
|
540
540
|
}
|
|
@@ -545,14 +545,14 @@ function or() {
|
|
|
545
545
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
546
546
|
).join("");
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function Et() {
|
|
549
549
|
return Math.floor(Date.now() / 1e3).toString();
|
|
550
550
|
}
|
|
551
551
|
const xs = 5 * 60 * 1e3, ks = 1 * 1e3;
|
|
552
|
-
var
|
|
552
|
+
var _e, L, K, At, Ct, Me;
|
|
553
553
|
class Ts {
|
|
554
554
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
555
|
-
|
|
555
|
+
q(this, K), q(this, _e), q(this, L), this.baseAddress = t, R(this, _e, e), R(this, L, {}), this.plugins = [];
|
|
556
556
|
}
|
|
557
557
|
get headers() {
|
|
558
558
|
throw new Error("Missing implementation");
|
|
@@ -564,54 +564,54 @@ class Ts {
|
|
|
564
564
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
565
565
|
}
|
|
566
566
|
withOptions(e = {}) {
|
|
567
|
-
return R(this,
|
|
567
|
+
return R(this, L, e), this;
|
|
568
568
|
}
|
|
569
569
|
get(e) {
|
|
570
|
-
return
|
|
570
|
+
return N(this, arguments, function* (t, s = {}) {
|
|
571
571
|
const { overrideBaseAddress: n, overrideDefaultHeaders: a } = s, i = n != null ? n : this.baseAddress;
|
|
572
572
|
let o = a != null ? a : this.headers;
|
|
573
|
-
const c =
|
|
574
|
-
return R(this,
|
|
573
|
+
const c = Re(S(this, L));
|
|
574
|
+
return R(this, L, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Zt(U({}, o), { "X-Request-Nonce": or(), "X-Request-Timestamp": Et() })), c.async ? yield Y(this, K, Ct).call(this, `${i}${t}`, c.async, { headers: o }) : yield Y(this, K, At).call(this, `${i}${t}`, c, { headers: o });
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
post(e, t) {
|
|
578
|
-
return
|
|
579
|
-
const i =
|
|
580
|
-
return R(this,
|
|
578
|
+
return N(this, arguments, function* (s, n, a = {}) {
|
|
579
|
+
const i = Re(S(this, L));
|
|
580
|
+
return R(this, L, {}), Y(this, K, Me).call(this, s, "POST", n, a, i);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
put(e, t) {
|
|
584
|
-
return
|
|
585
|
-
const i =
|
|
586
|
-
return R(this,
|
|
584
|
+
return N(this, arguments, function* (s, n, a = {}) {
|
|
585
|
+
const i = Re(S(this, L));
|
|
586
|
+
return R(this, L, {}), Y(this, K, Me).call(this, s, "PUT", n, a, i);
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
delete(e, t) {
|
|
590
|
-
return
|
|
591
|
-
const i =
|
|
592
|
-
return R(this,
|
|
590
|
+
return N(this, arguments, function* (s, n, a = {}) {
|
|
591
|
+
const i = Re(S(this, L));
|
|
592
|
+
return R(this, L, {}), Y(this, K, Me).call(this, s, "DELETE", n, a, i);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
patch(e, t) {
|
|
596
|
-
return
|
|
597
|
-
const i =
|
|
598
|
-
return R(this,
|
|
596
|
+
return N(this, arguments, function* (s, n, a = {}) {
|
|
597
|
+
const i = Re(S(this, L));
|
|
598
|
+
return R(this, L, {}), Y(this, K, Me).call(this, s, "PATCH", n, a, i);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
|
|
603
|
-
return
|
|
604
|
-
const s = () =>
|
|
602
|
+
_e = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakSet(), At = function(r, e, t) {
|
|
603
|
+
return N(this, null, function* () {
|
|
604
|
+
const s = () => N(this, null, function* () {
|
|
605
605
|
var c, d;
|
|
606
606
|
try {
|
|
607
|
-
return yield S(this,
|
|
607
|
+
return yield S(this, _e).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
608
608
|
} catch (f) {
|
|
609
|
-
throw f instanceof Error && f.name === "AbortError" ? new
|
|
609
|
+
throw f instanceof Error && f.name === "AbortError" ? new Ze({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
|
|
610
610
|
}
|
|
611
611
|
}), { headers: n } = t != null ? t : {}, a = (c, d) => {
|
|
612
612
|
var f, v;
|
|
613
613
|
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[d]) || "";
|
|
614
|
-
}, i = (c) =>
|
|
614
|
+
}, i = (c) => N(this, null, function* () {
|
|
615
615
|
var d;
|
|
616
616
|
if (!c.ok) {
|
|
617
617
|
const v = yield c.text().catch();
|
|
@@ -628,13 +628,13 @@ ve = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
628
628
|
try {
|
|
629
629
|
const v = a(c, "x-response-nonce"), j = n == null ? void 0 : n["X-Request-Nonce"];
|
|
630
630
|
if (!v || v !== j)
|
|
631
|
-
throw new
|
|
632
|
-
const M = Number(a(c, "x-response-timestamp")), F = Number(
|
|
631
|
+
throw new vt("Response nonce mismatch");
|
|
632
|
+
const M = Number(a(c, "x-response-timestamp")), F = Number(Et()), z = 60 * 60 * 24;
|
|
633
633
|
if (isNaN(M) || Math.abs(F - M) > z)
|
|
634
|
-
throw new
|
|
634
|
+
throw new vt("Invalid response timestamp");
|
|
635
635
|
} catch (v) {
|
|
636
636
|
const j = v instanceof Error ? v.message : "Request validation failed";
|
|
637
|
-
throw new
|
|
637
|
+
throw new vt(j);
|
|
638
638
|
}
|
|
639
639
|
let f = yield c.text();
|
|
640
640
|
try {
|
|
@@ -653,8 +653,8 @@ ve = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
653
653
|
const o = yield s();
|
|
654
654
|
return yield i(o);
|
|
655
655
|
});
|
|
656
|
-
},
|
|
657
|
-
return
|
|
656
|
+
}, Ct = function(r, e, t) {
|
|
657
|
+
return N(this, null, function* () {
|
|
658
658
|
var s, n;
|
|
659
659
|
const {
|
|
660
660
|
onProgress: a,
|
|
@@ -664,9 +664,9 @@ ve = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
664
664
|
} = e, d = `${r}/async`, f = `${r}/async/job`;
|
|
665
665
|
let v;
|
|
666
666
|
try {
|
|
667
|
-
v = yield S(this,
|
|
667
|
+
v = yield S(this, _e).call(this, d, U(U({}, t), i && { signal: i }));
|
|
668
668
|
} catch (F) {
|
|
669
|
-
throw F instanceof Error && F.name === "AbortError" ? new
|
|
669
|
+
throw F instanceof Error && F.name === "AbortError" ? new Ze({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : F;
|
|
670
670
|
}
|
|
671
671
|
if (!v.ok) {
|
|
672
672
|
const F = yield v.text().catch();
|
|
@@ -682,52 +682,52 @@ ve = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
682
682
|
const j = yield v.json(), { job_id: M } = j;
|
|
683
683
|
if (!M)
|
|
684
684
|
throw new Error("Job ID not found in response");
|
|
685
|
-
return new Promise((F, z) =>
|
|
686
|
-
const
|
|
685
|
+
return new Promise((F, z) => N(this, null, function* () {
|
|
686
|
+
const re = setTimeout(() => {
|
|
687
687
|
z(new Error("Job timed out"));
|
|
688
|
-
}, c),
|
|
688
|
+
}, c), me = (ce = 0) => N(this, null, function* () {
|
|
689
689
|
if (i != null && i.aborted) {
|
|
690
|
-
clearTimeout(
|
|
691
|
-
z(new
|
|
692
|
-
}).catch((
|
|
693
|
-
z(new
|
|
690
|
+
clearTimeout(re), S(this, _e).call(this, `${f}/${M}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
691
|
+
z(new Ze({ canceled: !0 }));
|
|
692
|
+
}).catch((V) => {
|
|
693
|
+
z(new Ze({ canceled: !1 }));
|
|
694
694
|
});
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
697
|
try {
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
clearTimeout(
|
|
701
|
-
const
|
|
702
|
-
F(
|
|
703
|
-
} else if (
|
|
704
|
-
clearTimeout(
|
|
698
|
+
const V = yield (yield S(this, _e).call(this, `${f}/${M}`, { headers: this.headers })).json();
|
|
699
|
+
if (V.status === "success") {
|
|
700
|
+
clearTimeout(re);
|
|
701
|
+
const de = V.response_json;
|
|
702
|
+
F(de);
|
|
703
|
+
} else if (V.status === "failed")
|
|
704
|
+
clearTimeout(re), z(new ws(V.response_json));
|
|
705
705
|
else {
|
|
706
|
-
a && a(
|
|
707
|
-
const
|
|
708
|
-
setTimeout(() =>
|
|
706
|
+
a && a(V.response_json);
|
|
707
|
+
const de = o(ce);
|
|
708
|
+
setTimeout(() => me(ce + 1), de);
|
|
709
709
|
}
|
|
710
|
-
} catch (
|
|
711
|
-
z(
|
|
710
|
+
} catch (V) {
|
|
711
|
+
z(V);
|
|
712
712
|
}
|
|
713
713
|
});
|
|
714
|
-
|
|
714
|
+
me();
|
|
715
715
|
}));
|
|
716
716
|
});
|
|
717
|
-
},
|
|
718
|
-
return
|
|
717
|
+
}, Me = function(r, e, t, s, n) {
|
|
718
|
+
return N(this, null, function* () {
|
|
719
719
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
720
720
|
let c = i != null ? i : this.headers;
|
|
721
|
-
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c =
|
|
721
|
+
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = Zt(U({}, c), { "X-Request-Nonce": or(), "X-Request-Timestamp": Et() }));
|
|
722
722
|
let d = t;
|
|
723
|
-
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", d = yield vs(d))), n.async ? yield
|
|
723
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", d = yield vs(d))), n.async ? yield Y(this, K, Ct).call(this, `${o}${r}`, n.async, {
|
|
724
724
|
method: e,
|
|
725
725
|
headers: c,
|
|
726
726
|
body: d
|
|
727
|
-
}) : yield
|
|
727
|
+
}) : yield Y(this, K, At).call(this, `${o}${r}`, n, { method: e, headers: c, body: d });
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
|
-
const Jt = (r, e, t, s) => r instanceof
|
|
730
|
+
const Jt = (r, e, t, s) => r instanceof Ze ? r : new bs({ resource: e, api: String(t), args: s, cause: r }), _t = (r, e) => new Proxy(e, {
|
|
731
731
|
get(t, s) {
|
|
732
732
|
return (...n) => {
|
|
733
733
|
var a;
|
|
@@ -748,100 +748,100 @@ const Jt = (r, e, t, s) => r instanceof Re ? r : new bs({ resource: e, api: Stri
|
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
|
-
var
|
|
751
|
+
var Pe;
|
|
752
752
|
class Ss {
|
|
753
753
|
constructor(e) {
|
|
754
|
-
|
|
754
|
+
q(this, Pe), this.resourceName = "Files", R(this, Pe, e);
|
|
755
755
|
}
|
|
756
756
|
get(e) {
|
|
757
|
-
return
|
|
757
|
+
return N(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
758
758
|
const n = new URLSearchParams(U({
|
|
759
759
|
plugin_data: "857346721138427857"
|
|
760
760
|
}, s)).toString(), a = `v1/files/${t}?${n}`;
|
|
761
|
-
return yield S(this,
|
|
761
|
+
return yield S(this, Pe).get(a);
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
getImageFills(e) {
|
|
765
|
-
return
|
|
765
|
+
return N(this, arguments, function* ({ fileKey: t }) {
|
|
766
766
|
var s, n;
|
|
767
767
|
const a = `v1/files/${t}/images`;
|
|
768
|
-
return (n = (s = (yield S(this,
|
|
768
|
+
return (n = (s = (yield S(this, Pe).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
|
|
772
|
+
Pe = /* @__PURE__ */ new WeakMap();
|
|
773
773
|
const Es = (r, e, t) => {
|
|
774
774
|
const s = e.sort();
|
|
775
775
|
return `${r}-${s.join("-")}-${t}`;
|
|
776
776
|
}, As = (r) => r ? r.ts > Date.now() - 1e3 * 30 : !1;
|
|
777
|
-
var
|
|
777
|
+
var X, It, cr;
|
|
778
778
|
class Cs {
|
|
779
779
|
constructor(e) {
|
|
780
|
-
|
|
780
|
+
q(this, It), q(this, X), this.resourceName = "Images", R(this, X, e);
|
|
781
781
|
}
|
|
782
782
|
/**
|
|
783
783
|
* Return the URL for the _layer_ images for the given nodes.
|
|
784
784
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
785
785
|
*/
|
|
786
786
|
get(e) {
|
|
787
|
-
return
|
|
788
|
-
const i = Es(t, s, n), o = S(this,
|
|
787
|
+
return N(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
|
|
788
|
+
const i = Es(t, s, n), o = S(this, X).cache.images.entries.get(i);
|
|
789
789
|
if (As(o))
|
|
790
790
|
return o.result;
|
|
791
|
-
o && S(this,
|
|
792
|
-
const c = S(this,
|
|
791
|
+
o && S(this, X).cache.images.entries.delete(i);
|
|
792
|
+
const c = S(this, X).cache.images.pendingRequests.get(i);
|
|
793
793
|
if (c)
|
|
794
794
|
return c;
|
|
795
|
-
const d =
|
|
796
|
-
S(this,
|
|
795
|
+
const d = Y(this, It, cr).call(this, i, t, s, n, a);
|
|
796
|
+
S(this, X).cache.images.pendingRequests.set(i, d);
|
|
797
797
|
try {
|
|
798
798
|
return yield d;
|
|
799
799
|
} finally {
|
|
800
|
-
S(this,
|
|
800
|
+
S(this, X).cache.images.pendingRequests.delete(i);
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
|
|
806
|
-
return
|
|
807
|
-
const a = yield S(this,
|
|
805
|
+
X = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakSet(), cr = function(r, e, t, s, n) {
|
|
806
|
+
return N(this, null, function* () {
|
|
807
|
+
const a = yield S(this, X).get(
|
|
808
808
|
`v1/images/${e}?ids=${t}&format=${s}${n ? `&scale=${n}` : ""}`
|
|
809
809
|
);
|
|
810
|
-
return S(this,
|
|
810
|
+
return S(this, X).cache.images.entries.set(r, {
|
|
811
811
|
result: a,
|
|
812
812
|
ts: Date.now()
|
|
813
813
|
}), a;
|
|
814
814
|
});
|
|
815
815
|
};
|
|
816
|
-
var
|
|
817
|
-
class
|
|
816
|
+
var nt;
|
|
817
|
+
class Is {
|
|
818
818
|
constructor(e) {
|
|
819
|
-
|
|
819
|
+
q(this, nt), this.resourceName = "Nodes", R(this, nt, e);
|
|
820
820
|
}
|
|
821
821
|
get(e) {
|
|
822
|
-
return
|
|
823
|
-
const a =
|
|
822
|
+
return N(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
|
|
823
|
+
const a = Zt(U({}, n), {
|
|
824
824
|
ids: s.join(",")
|
|
825
825
|
}), i = new URLSearchParams(U({
|
|
826
826
|
plugin_data: "857346721138427857"
|
|
827
827
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
828
|
-
return yield S(this,
|
|
828
|
+
return yield S(this, nt).get(o);
|
|
829
829
|
});
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
|
-
|
|
832
|
+
nt = /* @__PURE__ */ new WeakMap();
|
|
833
833
|
var ue;
|
|
834
834
|
class dr extends Ts {
|
|
835
835
|
constructor({
|
|
836
836
|
baseAddress: e = "https://api.figma.com/",
|
|
837
837
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
838
838
|
} = {}) {
|
|
839
|
-
super({ fetch: t, baseAddress: e }),
|
|
839
|
+
super({ fetch: t, baseAddress: e }), q(this, ue, ""), this.cache = {
|
|
840
840
|
images: {
|
|
841
841
|
entries: /* @__PURE__ */ new Map(),
|
|
842
842
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
843
843
|
}
|
|
844
|
-
}, this.files =
|
|
844
|
+
}, this.files = _t(this, new Ss(this)), this.nodes = _t(this, new Is(this)), this.images = _t(this, new Cs(this));
|
|
845
845
|
}
|
|
846
846
|
set token(e) {
|
|
847
847
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
@@ -859,7 +859,7 @@ class dr extends Ts {
|
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
861
|
ue = /* @__PURE__ */ new WeakMap();
|
|
862
|
-
const
|
|
862
|
+
const Os = (a) => C(void 0, [a], function* ({
|
|
863
863
|
fileKey: r,
|
|
864
864
|
authToken: e,
|
|
865
865
|
figmaRestApi: t = new dr(),
|
|
@@ -877,7 +877,7 @@ const Is = (a) => C(void 0, [a], function* ({
|
|
|
877
877
|
} catch (i) {
|
|
878
878
|
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), nr(i, r));
|
|
879
879
|
}
|
|
880
|
-
}),
|
|
880
|
+
}), Qn = (i) => C(void 0, [i], function* ({
|
|
881
881
|
fileKey: r,
|
|
882
882
|
authToken: e,
|
|
883
883
|
nodeIds: t,
|
|
@@ -944,10 +944,10 @@ var x;
|
|
|
944
944
|
}
|
|
945
945
|
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
946
946
|
})(x || (x = {}));
|
|
947
|
-
var
|
|
947
|
+
var Ot;
|
|
948
948
|
(function(r) {
|
|
949
949
|
r.mergeShapes = (e, t) => u(u({}, e), t);
|
|
950
|
-
})(
|
|
950
|
+
})(Ot || (Ot = {}));
|
|
951
951
|
const p = x.arrayToEnum([
|
|
952
952
|
"string",
|
|
953
953
|
"nan",
|
|
@@ -969,7 +969,7 @@ const p = x.arrayToEnum([
|
|
|
969
969
|
"never",
|
|
970
970
|
"map",
|
|
971
971
|
"set"
|
|
972
|
-
]),
|
|
972
|
+
]), ae = (r) => {
|
|
973
973
|
switch (typeof r) {
|
|
974
974
|
case "undefined":
|
|
975
975
|
return p.undefined;
|
|
@@ -1068,7 +1068,7 @@ class W extends Error {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
1070
|
W.create = (r) => new W(r);
|
|
1071
|
-
const
|
|
1071
|
+
const Oe = (r, e) => {
|
|
1072
1072
|
let t;
|
|
1073
1073
|
switch (r.code) {
|
|
1074
1074
|
case l.invalid_type:
|
|
@@ -1124,14 +1124,14 @@ const Ae = (r, e) => {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
return { message: t };
|
|
1126
1126
|
};
|
|
1127
|
-
let lr =
|
|
1127
|
+
let lr = Oe;
|
|
1128
1128
|
function js(r) {
|
|
1129
1129
|
lr = r;
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function at() {
|
|
1132
1132
|
return lr;
|
|
1133
1133
|
}
|
|
1134
|
-
const
|
|
1134
|
+
const it = (r) => {
|
|
1135
1135
|
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = g(u({}, n), {
|
|
1136
1136
|
path: a
|
|
1137
1137
|
});
|
|
@@ -1150,7 +1150,7 @@ const at = (r) => {
|
|
|
1150
1150
|
});
|
|
1151
1151
|
}, Rs = [];
|
|
1152
1152
|
function h(r, e) {
|
|
1153
|
-
const t =
|
|
1153
|
+
const t = at(), s = it({
|
|
1154
1154
|
issueData: e,
|
|
1155
1155
|
data: r.data,
|
|
1156
1156
|
path: r.path,
|
|
@@ -1161,7 +1161,7 @@ function h(r, e) {
|
|
|
1161
1161
|
// then schema-bound map if available
|
|
1162
1162
|
t,
|
|
1163
1163
|
// then global override map
|
|
1164
|
-
t ===
|
|
1164
|
+
t === Oe ? void 0 : Oe
|
|
1165
1165
|
// then global default map
|
|
1166
1166
|
].filter((n) => !!n)
|
|
1167
1167
|
});
|
|
@@ -1212,8 +1212,8 @@ class Z {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
const _ = Object.freeze({
|
|
1214
1214
|
status: "aborted"
|
|
1215
|
-
}),
|
|
1216
|
-
function
|
|
1215
|
+
}), Ae = (r) => ({ status: "dirty", value: r }), $ = (r) => ({ status: "valid", value: r }), Nt = (r) => r.status === "aborted", jt = (r) => r.status === "dirty", we = (r) => r.status === "valid", Le = (r) => typeof Promise != "undefined" && r instanceof Promise;
|
|
1216
|
+
function ot(r, e, t, s) {
|
|
1217
1217
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1218
1218
|
return e.get(r);
|
|
1219
1219
|
}
|
|
@@ -1225,8 +1225,8 @@ var m;
|
|
|
1225
1225
|
(function(r) {
|
|
1226
1226
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1227
1227
|
})(m || (m = {}));
|
|
1228
|
-
var
|
|
1229
|
-
class
|
|
1228
|
+
var $e, Fe;
|
|
1229
|
+
class ee {
|
|
1230
1230
|
constructor(e, t, s, n) {
|
|
1231
1231
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
1232
1232
|
}
|
|
@@ -1235,7 +1235,7 @@ class te {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
const Gt = (r, e) => {
|
|
1238
|
-
if (
|
|
1238
|
+
if (we(e))
|
|
1239
1239
|
return { success: !0, data: e.value };
|
|
1240
1240
|
if (!r.common.issues.length)
|
|
1241
1241
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1266,13 +1266,13 @@ class w {
|
|
|
1266
1266
|
return this._def.description;
|
|
1267
1267
|
}
|
|
1268
1268
|
_getType(e) {
|
|
1269
|
-
return
|
|
1269
|
+
return ae(e.data);
|
|
1270
1270
|
}
|
|
1271
1271
|
_getOrReturnCtx(e, t) {
|
|
1272
1272
|
return t || {
|
|
1273
1273
|
common: e.parent.common,
|
|
1274
1274
|
data: e.data,
|
|
1275
|
-
parsedType:
|
|
1275
|
+
parsedType: ae(e.data),
|
|
1276
1276
|
schemaErrorMap: this._def.errorMap,
|
|
1277
1277
|
path: e.path,
|
|
1278
1278
|
parent: e.parent
|
|
@@ -1284,7 +1284,7 @@ class w {
|
|
|
1284
1284
|
ctx: {
|
|
1285
1285
|
common: e.parent.common,
|
|
1286
1286
|
data: e.data,
|
|
1287
|
-
parsedType:
|
|
1287
|
+
parsedType: ae(e.data),
|
|
1288
1288
|
schemaErrorMap: this._def.errorMap,
|
|
1289
1289
|
path: e.path,
|
|
1290
1290
|
parent: e.parent
|
|
@@ -1293,7 +1293,7 @@ class w {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
_parseSync(e) {
|
|
1295
1295
|
const t = this._parse(e);
|
|
1296
|
-
if (
|
|
1296
|
+
if (Le(t))
|
|
1297
1297
|
throw new Error("Synchronous parse encountered promise.");
|
|
1298
1298
|
return t;
|
|
1299
1299
|
}
|
|
@@ -1319,7 +1319,7 @@ class w {
|
|
|
1319
1319
|
schemaErrorMap: this._def.errorMap,
|
|
1320
1320
|
parent: null,
|
|
1321
1321
|
data: e,
|
|
1322
|
-
parsedType:
|
|
1322
|
+
parsedType: ae(e)
|
|
1323
1323
|
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1324
1324
|
return Gt(n, a);
|
|
1325
1325
|
}
|
|
@@ -1334,12 +1334,12 @@ class w {
|
|
|
1334
1334
|
schemaErrorMap: this._def.errorMap,
|
|
1335
1335
|
parent: null,
|
|
1336
1336
|
data: e,
|
|
1337
|
-
parsedType:
|
|
1337
|
+
parsedType: ae(e)
|
|
1338
1338
|
};
|
|
1339
1339
|
if (!this["~standard"].async)
|
|
1340
1340
|
try {
|
|
1341
1341
|
const a = this._parseSync({ data: e, path: [], parent: n });
|
|
1342
|
-
return
|
|
1342
|
+
return we(a) ? {
|
|
1343
1343
|
value: a.value
|
|
1344
1344
|
} : {
|
|
1345
1345
|
issues: n.common.issues
|
|
@@ -1350,7 +1350,7 @@ class w {
|
|
|
1350
1350
|
async: !0
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
|
-
return this._parseAsync({ data: e, path: [], parent: n }).then((a) =>
|
|
1353
|
+
return this._parseAsync({ data: e, path: [], parent: n }).then((a) => we(a) ? {
|
|
1354
1354
|
value: a.value
|
|
1355
1355
|
} : {
|
|
1356
1356
|
issues: n.common.issues
|
|
@@ -1376,8 +1376,8 @@ class w {
|
|
|
1376
1376
|
schemaErrorMap: this._def.errorMap,
|
|
1377
1377
|
parent: null,
|
|
1378
1378
|
data: e,
|
|
1379
|
-
parsedType:
|
|
1380
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield
|
|
1379
|
+
parsedType: ae(e)
|
|
1380
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield Le(n) ? n : Promise.resolve(n);
|
|
1381
1381
|
return Gt(s, a);
|
|
1382
1382
|
});
|
|
1383
1383
|
}
|
|
@@ -1411,10 +1411,10 @@ class w {
|
|
|
1411
1411
|
};
|
|
1412
1412
|
}
|
|
1413
1413
|
optional() {
|
|
1414
|
-
return
|
|
1414
|
+
return Q.create(this, this._def);
|
|
1415
1415
|
}
|
|
1416
1416
|
nullable() {
|
|
1417
|
-
return
|
|
1417
|
+
return pe.create(this, this._def);
|
|
1418
1418
|
}
|
|
1419
1419
|
nullish() {
|
|
1420
1420
|
return this.nullable().optional();
|
|
@@ -1423,13 +1423,13 @@ class w {
|
|
|
1423
1423
|
return J.create(this);
|
|
1424
1424
|
}
|
|
1425
1425
|
promise() {
|
|
1426
|
-
return
|
|
1426
|
+
return je.create(this, this._def);
|
|
1427
1427
|
}
|
|
1428
1428
|
or(e) {
|
|
1429
|
-
return
|
|
1429
|
+
return ze.create([this, e], this._def);
|
|
1430
1430
|
}
|
|
1431
1431
|
and(e) {
|
|
1432
|
-
return
|
|
1432
|
+
return Be.create(this, e, this._def);
|
|
1433
1433
|
}
|
|
1434
1434
|
transform(e) {
|
|
1435
1435
|
return new G(g(u({}, b(this._def)), {
|
|
@@ -1440,21 +1440,21 @@ class w {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
default(e) {
|
|
1442
1442
|
const t = typeof e == "function" ? e : () => e;
|
|
1443
|
-
return new
|
|
1443
|
+
return new Ke(g(u({}, b(this._def)), {
|
|
1444
1444
|
innerType: this,
|
|
1445
1445
|
defaultValue: t,
|
|
1446
1446
|
typeName: y.ZodDefault
|
|
1447
1447
|
}));
|
|
1448
1448
|
}
|
|
1449
1449
|
brand() {
|
|
1450
|
-
return new
|
|
1450
|
+
return new $t(u({
|
|
1451
1451
|
typeName: y.ZodBranded,
|
|
1452
1452
|
type: this
|
|
1453
1453
|
}, b(this._def)));
|
|
1454
1454
|
}
|
|
1455
1455
|
catch(e) {
|
|
1456
1456
|
const t = typeof e == "function" ? e : () => e;
|
|
1457
|
-
return new
|
|
1457
|
+
return new Xe(g(u({}, b(this._def)), {
|
|
1458
1458
|
innerType: this,
|
|
1459
1459
|
catchValue: t,
|
|
1460
1460
|
typeName: y.ZodCatch
|
|
@@ -1467,10 +1467,10 @@ class w {
|
|
|
1467
1467
|
}));
|
|
1468
1468
|
}
|
|
1469
1469
|
pipe(e) {
|
|
1470
|
-
return
|
|
1470
|
+
return et.create(this, e);
|
|
1471
1471
|
}
|
|
1472
1472
|
readonly() {
|
|
1473
|
-
return
|
|
1473
|
+
return Ye.create(this);
|
|
1474
1474
|
}
|
|
1475
1475
|
isOptional() {
|
|
1476
1476
|
return this.safeParse(void 0).success;
|
|
@@ -1480,7 +1480,7 @@ class w {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
1482
|
const Zs = /^c[^\s-]{8,}$/i, Ms = /^[0-9a-z]+$/, Ps = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $s = /^[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, Fs = /^[a-z0-9_-]{21}$/i, Ds = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ls = /^[-+]?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)?)??$/, Vs = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Us = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1483
|
-
let
|
|
1483
|
+
let bt;
|
|
1484
1484
|
const Ws = /^(?:(?: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])$/, zs = /^(?:(?: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])$/, Bs = /^(([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]))$/, qs = /^(([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])$/, Hs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Js = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, hr = "((\\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])))", Gs = new RegExp(`^${hr}$`);
|
|
1485
1485
|
function pr(r) {
|
|
1486
1486
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
@@ -1565,7 +1565,7 @@ class H extends w {
|
|
|
1565
1565
|
message: a.message
|
|
1566
1566
|
}), s.dirty());
|
|
1567
1567
|
else if (a.kind === "emoji")
|
|
1568
|
-
|
|
1568
|
+
bt || (bt = new RegExp(Us, "u")), bt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1569
1569
|
validation: "emoji",
|
|
1570
1570
|
code: l.invalid_string,
|
|
1571
1571
|
message: a.message
|
|
@@ -1885,7 +1885,7 @@ function en(r, e) {
|
|
|
1885
1885
|
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
1886
1886
|
return a % i / Math.pow(10, n);
|
|
1887
1887
|
}
|
|
1888
|
-
class
|
|
1888
|
+
class le extends w {
|
|
1889
1889
|
constructor() {
|
|
1890
1890
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1891
1891
|
}
|
|
@@ -1943,7 +1943,7 @@ class fe extends w {
|
|
|
1943
1943
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1944
1944
|
}
|
|
1945
1945
|
setLimit(e, t, s, n) {
|
|
1946
|
-
return new
|
|
1946
|
+
return new le(g(u({}, this._def), {
|
|
1947
1947
|
checks: [
|
|
1948
1948
|
...this._def.checks,
|
|
1949
1949
|
{
|
|
@@ -1956,7 +1956,7 @@ class fe extends w {
|
|
|
1956
1956
|
}));
|
|
1957
1957
|
}
|
|
1958
1958
|
_addCheck(e) {
|
|
1959
|
-
return new
|
|
1959
|
+
return new le(g(u({}, this._def), {
|
|
1960
1960
|
checks: [...this._def.checks, e]
|
|
1961
1961
|
}));
|
|
1962
1962
|
}
|
|
@@ -2049,12 +2049,12 @@ class fe extends w {
|
|
|
2049
2049
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
|
-
|
|
2052
|
+
le.create = (r) => new le(u({
|
|
2053
2053
|
checks: [],
|
|
2054
2054
|
typeName: y.ZodNumber,
|
|
2055
2055
|
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2056
2056
|
}, b(r)));
|
|
2057
|
-
class
|
|
2057
|
+
class fe extends w {
|
|
2058
2058
|
constructor() {
|
|
2059
2059
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2060
2060
|
}
|
|
@@ -2110,7 +2110,7 @@ class he extends w {
|
|
|
2110
2110
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2111
2111
|
}
|
|
2112
2112
|
setLimit(e, t, s, n) {
|
|
2113
|
-
return new
|
|
2113
|
+
return new fe(g(u({}, this._def), {
|
|
2114
2114
|
checks: [
|
|
2115
2115
|
...this._def.checks,
|
|
2116
2116
|
{
|
|
@@ -2123,7 +2123,7 @@ class he extends w {
|
|
|
2123
2123
|
}));
|
|
2124
2124
|
}
|
|
2125
2125
|
_addCheck(e) {
|
|
2126
|
-
return new
|
|
2126
|
+
return new fe(g(u({}, this._def), {
|
|
2127
2127
|
checks: [...this._def.checks, e]
|
|
2128
2128
|
}));
|
|
2129
2129
|
}
|
|
@@ -2179,15 +2179,15 @@ class he extends w {
|
|
|
2179
2179
|
return e;
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
|
-
|
|
2182
|
+
fe.create = (r) => {
|
|
2183
2183
|
var e;
|
|
2184
|
-
return new
|
|
2184
|
+
return new fe(u({
|
|
2185
2185
|
checks: [],
|
|
2186
2186
|
typeName: y.ZodBigInt,
|
|
2187
2187
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
2188
2188
|
}, b(r)));
|
|
2189
2189
|
};
|
|
2190
|
-
class
|
|
2190
|
+
class Ve extends w {
|
|
2191
2191
|
_parse(e) {
|
|
2192
2192
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
2193
2193
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2200,11 +2200,11 @@ class De extends w {
|
|
|
2200
2200
|
return $(e.data);
|
|
2201
2201
|
}
|
|
2202
2202
|
}
|
|
2203
|
-
|
|
2203
|
+
Ve.create = (r) => new Ve(u({
|
|
2204
2204
|
typeName: y.ZodBoolean,
|
|
2205
2205
|
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2206
2206
|
}, b(r)));
|
|
2207
|
-
class
|
|
2207
|
+
class xe extends w {
|
|
2208
2208
|
_parse(e) {
|
|
2209
2209
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
2210
2210
|
const a = this._getOrReturnCtx(e);
|
|
@@ -2244,7 +2244,7 @@ class we extends w {
|
|
|
2244
2244
|
};
|
|
2245
2245
|
}
|
|
2246
2246
|
_addCheck(e) {
|
|
2247
|
-
return new
|
|
2247
|
+
return new xe(g(u({}, this._def), {
|
|
2248
2248
|
checks: [...this._def.checks, e]
|
|
2249
2249
|
}));
|
|
2250
2250
|
}
|
|
@@ -2275,12 +2275,12 @@ class we extends w {
|
|
|
2275
2275
|
return e != null ? new Date(e) : null;
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
|
-
|
|
2278
|
+
xe.create = (r) => new xe(u({
|
|
2279
2279
|
checks: [],
|
|
2280
2280
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
2281
2281
|
typeName: y.ZodDate
|
|
2282
2282
|
}, b(r)));
|
|
2283
|
-
class
|
|
2283
|
+
class ct extends w {
|
|
2284
2284
|
_parse(e) {
|
|
2285
2285
|
if (this._getType(e) !== p.symbol) {
|
|
2286
2286
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2293,10 +2293,10 @@ class ot extends w {
|
|
|
2293
2293
|
return $(e.data);
|
|
2294
2294
|
}
|
|
2295
2295
|
}
|
|
2296
|
-
|
|
2296
|
+
ct.create = (r) => new ct(u({
|
|
2297
2297
|
typeName: y.ZodSymbol
|
|
2298
2298
|
}, b(r)));
|
|
2299
|
-
class
|
|
2299
|
+
class Ue extends w {
|
|
2300
2300
|
_parse(e) {
|
|
2301
2301
|
if (this._getType(e) !== p.undefined) {
|
|
2302
2302
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2309,10 +2309,10 @@ class Le extends w {
|
|
|
2309
2309
|
return $(e.data);
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
|
-
|
|
2312
|
+
Ue.create = (r) => new Ue(u({
|
|
2313
2313
|
typeName: y.ZodUndefined
|
|
2314
2314
|
}, b(r)));
|
|
2315
|
-
class
|
|
2315
|
+
class We extends w {
|
|
2316
2316
|
_parse(e) {
|
|
2317
2317
|
if (this._getType(e) !== p.null) {
|
|
2318
2318
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2325,10 +2325,10 @@ class Ve extends w {
|
|
|
2325
2325
|
return $(e.data);
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
We.create = (r) => new We(u({
|
|
2329
2329
|
typeName: y.ZodNull
|
|
2330
2330
|
}, b(r)));
|
|
2331
|
-
class
|
|
2331
|
+
class Ne extends w {
|
|
2332
2332
|
constructor() {
|
|
2333
2333
|
super(...arguments), this._any = !0;
|
|
2334
2334
|
}
|
|
@@ -2336,10 +2336,10 @@ class Ce extends w {
|
|
|
2336
2336
|
return $(e.data);
|
|
2337
2337
|
}
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2339
|
+
Ne.create = (r) => new Ne(u({
|
|
2340
2340
|
typeName: y.ZodAny
|
|
2341
2341
|
}, b(r)));
|
|
2342
|
-
class
|
|
2342
|
+
class be extends w {
|
|
2343
2343
|
constructor() {
|
|
2344
2344
|
super(...arguments), this._unknown = !0;
|
|
2345
2345
|
}
|
|
@@ -2347,7 +2347,7 @@ class _e extends w {
|
|
|
2347
2347
|
return $(e.data);
|
|
2348
2348
|
}
|
|
2349
2349
|
}
|
|
2350
|
-
|
|
2350
|
+
be.create = (r) => new be(u({
|
|
2351
2351
|
typeName: y.ZodUnknown
|
|
2352
2352
|
}, b(r)));
|
|
2353
2353
|
class oe extends w {
|
|
@@ -2363,7 +2363,7 @@ class oe extends w {
|
|
|
2363
2363
|
oe.create = (r) => new oe(u({
|
|
2364
2364
|
typeName: y.ZodNever
|
|
2365
2365
|
}, b(r)));
|
|
2366
|
-
class
|
|
2366
|
+
class dt extends w {
|
|
2367
2367
|
_parse(e) {
|
|
2368
2368
|
if (this._getType(e) !== p.undefined) {
|
|
2369
2369
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2376,7 +2376,7 @@ class ct extends w {
|
|
|
2376
2376
|
return $(e.data);
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
2379
|
-
|
|
2379
|
+
dt.create = (r) => new dt(u({
|
|
2380
2380
|
typeName: y.ZodVoid
|
|
2381
2381
|
}, b(r)));
|
|
2382
2382
|
class J extends w {
|
|
@@ -2415,8 +2415,8 @@ class J extends w {
|
|
|
2415
2415
|
exact: !1,
|
|
2416
2416
|
message: n.maxLength.message
|
|
2417
2417
|
}), s.dirty()), t.common.async)
|
|
2418
|
-
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new
|
|
2419
|
-
const a = [...t.data].map((i, o) => n.type._parseSync(new
|
|
2418
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new ee(t, i, t.path, o)))).then((i) => Z.mergeArray(s, i));
|
|
2419
|
+
const a = [...t.data].map((i, o) => n.type._parseSync(new ee(t, i, t.path, o)));
|
|
2420
2420
|
return Z.mergeArray(s, a);
|
|
2421
2421
|
}
|
|
2422
2422
|
get element() {
|
|
@@ -2448,21 +2448,21 @@ J.create = (r, e) => new J(u({
|
|
|
2448
2448
|
exactLength: null,
|
|
2449
2449
|
typeName: y.ZodArray
|
|
2450
2450
|
}, b(e)));
|
|
2451
|
-
function
|
|
2452
|
-
if (r instanceof
|
|
2451
|
+
function Ee(r) {
|
|
2452
|
+
if (r instanceof I) {
|
|
2453
2453
|
const e = {};
|
|
2454
2454
|
for (const t in r.shape) {
|
|
2455
2455
|
const s = r.shape[t];
|
|
2456
|
-
e[t] =
|
|
2456
|
+
e[t] = Q.create(Ee(s));
|
|
2457
2457
|
}
|
|
2458
|
-
return new
|
|
2458
|
+
return new I(g(u({}, r._def), {
|
|
2459
2459
|
shape: () => e
|
|
2460
2460
|
}));
|
|
2461
2461
|
} else return r instanceof J ? new J(g(u({}, r._def), {
|
|
2462
|
-
type:
|
|
2463
|
-
})) : r instanceof
|
|
2462
|
+
type: Ee(r.element)
|
|
2463
|
+
})) : r instanceof Q ? Q.create(Ee(r.unwrap())) : r instanceof pe ? pe.create(Ee(r.unwrap())) : r instanceof te ? te.create(r.items.map((e) => Ee(e))) : r;
|
|
2464
2464
|
}
|
|
2465
|
-
class
|
|
2465
|
+
class I extends w {
|
|
2466
2466
|
constructor() {
|
|
2467
2467
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2468
2468
|
}
|
|
@@ -2490,7 +2490,7 @@ class E extends w {
|
|
|
2490
2490
|
const f = a[d], v = n.data[d];
|
|
2491
2491
|
c.push({
|
|
2492
2492
|
key: { status: "valid", value: d },
|
|
2493
|
-
value: f._parse(new
|
|
2493
|
+
value: f._parse(new ee(n, v, n.path, d)),
|
|
2494
2494
|
alwaysSet: d in n.data
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
@@ -2515,7 +2515,7 @@ class E extends w {
|
|
|
2515
2515
|
c.push({
|
|
2516
2516
|
key: { status: "valid", value: f },
|
|
2517
2517
|
value: d._parse(
|
|
2518
|
-
new
|
|
2518
|
+
new ee(n, v, n.path, f)
|
|
2519
2519
|
//, ctx.child(key), value, getParsedType(value)
|
|
2520
2520
|
),
|
|
2521
2521
|
alwaysSet: f in n.data
|
|
@@ -2539,7 +2539,7 @@ class E extends w {
|
|
|
2539
2539
|
return this._def.shape();
|
|
2540
2540
|
}
|
|
2541
2541
|
strict(e) {
|
|
2542
|
-
return m.errToObj, new
|
|
2542
|
+
return m.errToObj, new I(u(g(u({}, this._def), {
|
|
2543
2543
|
unknownKeys: "strict"
|
|
2544
2544
|
}), e !== void 0 ? {
|
|
2545
2545
|
errorMap: (t, s) => {
|
|
@@ -2554,12 +2554,12 @@ class E extends w {
|
|
|
2554
2554
|
} : {}));
|
|
2555
2555
|
}
|
|
2556
2556
|
strip() {
|
|
2557
|
-
return new
|
|
2557
|
+
return new I(g(u({}, this._def), {
|
|
2558
2558
|
unknownKeys: "strip"
|
|
2559
2559
|
}));
|
|
2560
2560
|
}
|
|
2561
2561
|
passthrough() {
|
|
2562
|
-
return new
|
|
2562
|
+
return new I(g(u({}, this._def), {
|
|
2563
2563
|
unknownKeys: "passthrough"
|
|
2564
2564
|
}));
|
|
2565
2565
|
}
|
|
@@ -2581,7 +2581,7 @@ class E extends w {
|
|
|
2581
2581
|
// }) as any;
|
|
2582
2582
|
// };
|
|
2583
2583
|
extend(e) {
|
|
2584
|
-
return new
|
|
2584
|
+
return new I(g(u({}, this._def), {
|
|
2585
2585
|
shape: () => u(u({}, this._def.shape()), e)
|
|
2586
2586
|
}));
|
|
2587
2587
|
}
|
|
@@ -2591,7 +2591,7 @@ class E extends w {
|
|
|
2591
2591
|
* upgrade if you are experiencing issues.
|
|
2592
2592
|
*/
|
|
2593
2593
|
merge(e) {
|
|
2594
|
-
return new
|
|
2594
|
+
return new I({
|
|
2595
2595
|
unknownKeys: e._def.unknownKeys,
|
|
2596
2596
|
catchall: e._def.catchall,
|
|
2597
2597
|
shape: () => u(u({}, this._def.shape()), e._def.shape()),
|
|
@@ -2658,7 +2658,7 @@ class E extends w {
|
|
|
2658
2658
|
// return merged;
|
|
2659
2659
|
// }
|
|
2660
2660
|
catchall(e) {
|
|
2661
|
-
return new
|
|
2661
|
+
return new I(g(u({}, this._def), {
|
|
2662
2662
|
catchall: e
|
|
2663
2663
|
}));
|
|
2664
2664
|
}
|
|
@@ -2666,7 +2666,7 @@ class E extends w {
|
|
|
2666
2666
|
const t = {};
|
|
2667
2667
|
return x.objectKeys(e).forEach((s) => {
|
|
2668
2668
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2669
|
-
}), new
|
|
2669
|
+
}), new I(g(u({}, this._def), {
|
|
2670
2670
|
shape: () => t
|
|
2671
2671
|
}));
|
|
2672
2672
|
}
|
|
@@ -2674,7 +2674,7 @@ class E extends w {
|
|
|
2674
2674
|
const t = {};
|
|
2675
2675
|
return x.objectKeys(this.shape).forEach((s) => {
|
|
2676
2676
|
e[s] || (t[s] = this.shape[s]);
|
|
2677
|
-
}), new
|
|
2677
|
+
}), new I(g(u({}, this._def), {
|
|
2678
2678
|
shape: () => t
|
|
2679
2679
|
}));
|
|
2680
2680
|
}
|
|
@@ -2682,14 +2682,14 @@ class E extends w {
|
|
|
2682
2682
|
* @deprecated
|
|
2683
2683
|
*/
|
|
2684
2684
|
deepPartial() {
|
|
2685
|
-
return
|
|
2685
|
+
return Ee(this);
|
|
2686
2686
|
}
|
|
2687
2687
|
partial(e) {
|
|
2688
2688
|
const t = {};
|
|
2689
2689
|
return x.objectKeys(this.shape).forEach((s) => {
|
|
2690
2690
|
const n = this.shape[s];
|
|
2691
2691
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
2692
|
-
}), new
|
|
2692
|
+
}), new I(g(u({}, this._def), {
|
|
2693
2693
|
shape: () => t
|
|
2694
2694
|
}));
|
|
2695
2695
|
}
|
|
@@ -2700,11 +2700,11 @@ class E extends w {
|
|
|
2700
2700
|
t[s] = this.shape[s];
|
|
2701
2701
|
else {
|
|
2702
2702
|
let a = this.shape[s];
|
|
2703
|
-
for (; a instanceof
|
|
2703
|
+
for (; a instanceof Q; )
|
|
2704
2704
|
a = a._def.innerType;
|
|
2705
2705
|
t[s] = a;
|
|
2706
2706
|
}
|
|
2707
|
-
}), new
|
|
2707
|
+
}), new I(g(u({}, this._def), {
|
|
2708
2708
|
shape: () => t
|
|
2709
2709
|
}));
|
|
2710
2710
|
}
|
|
@@ -2712,25 +2712,25 @@ class E extends w {
|
|
|
2712
2712
|
return gr(x.objectKeys(this.shape));
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
|
-
|
|
2715
|
+
I.create = (r, e) => new I(u({
|
|
2716
2716
|
shape: () => r,
|
|
2717
2717
|
unknownKeys: "strip",
|
|
2718
2718
|
catchall: oe.create(),
|
|
2719
2719
|
typeName: y.ZodObject
|
|
2720
2720
|
}, b(e)));
|
|
2721
|
-
|
|
2721
|
+
I.strictCreate = (r, e) => new I(u({
|
|
2722
2722
|
shape: () => r,
|
|
2723
2723
|
unknownKeys: "strict",
|
|
2724
2724
|
catchall: oe.create(),
|
|
2725
2725
|
typeName: y.ZodObject
|
|
2726
2726
|
}, b(e)));
|
|
2727
|
-
|
|
2727
|
+
I.lazycreate = (r, e) => new I(u({
|
|
2728
2728
|
shape: r,
|
|
2729
2729
|
unknownKeys: "strip",
|
|
2730
2730
|
catchall: oe.create(),
|
|
2731
2731
|
typeName: y.ZodObject
|
|
2732
2732
|
}, b(e)));
|
|
2733
|
-
class
|
|
2733
|
+
class ze extends w {
|
|
2734
2734
|
_parse(e) {
|
|
2735
2735
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2736
2736
|
function n(a) {
|
|
@@ -2794,12 +2794,12 @@ class Ue extends w {
|
|
|
2794
2794
|
return this._def.options;
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
2797
|
-
|
|
2797
|
+
ze.create = (r, e) => new ze(u({
|
|
2798
2798
|
options: r,
|
|
2799
2799
|
typeName: y.ZodUnion
|
|
2800
2800
|
}, b(e)));
|
|
2801
|
-
const
|
|
2802
|
-
class
|
|
2801
|
+
const ne = (r) => r instanceof He ? ne(r.schema) : r instanceof G ? ne(r.innerType()) : r instanceof Je ? [r.value] : r instanceof he ? r.options : r instanceof Ge ? x.objectValues(r.enum) : r instanceof Ke ? ne(r._def.innerType) : r instanceof Ue ? [void 0] : r instanceof We ? [null] : r instanceof Q ? [void 0, ...ne(r.unwrap())] : r instanceof pe ? [null, ...ne(r.unwrap())] : r instanceof $t || r instanceof Ye ? ne(r.unwrap()) : r instanceof Xe ? ne(r._def.innerType) : [];
|
|
2802
|
+
class ft extends w {
|
|
2803
2803
|
_parse(e) {
|
|
2804
2804
|
const { ctx: t } = this._processInputParams(e);
|
|
2805
2805
|
if (t.parsedType !== p.object)
|
|
@@ -2843,7 +2843,7 @@ class lt extends w {
|
|
|
2843
2843
|
static create(e, t, s) {
|
|
2844
2844
|
const n = /* @__PURE__ */ new Map();
|
|
2845
2845
|
for (const a of t) {
|
|
2846
|
-
const i =
|
|
2846
|
+
const i = ne(a.shape[e]);
|
|
2847
2847
|
if (!i.length)
|
|
2848
2848
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2849
2849
|
for (const o of i) {
|
|
@@ -2852,7 +2852,7 @@ class lt extends w {
|
|
|
2852
2852
|
n.set(o, a);
|
|
2853
2853
|
}
|
|
2854
2854
|
}
|
|
2855
|
-
return new
|
|
2855
|
+
return new ft(u({
|
|
2856
2856
|
typeName: y.ZodDiscriminatedUnion,
|
|
2857
2857
|
discriminator: e,
|
|
2858
2858
|
options: t,
|
|
@@ -2860,14 +2860,14 @@ class lt extends w {
|
|
|
2860
2860
|
}, b(s)));
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
function
|
|
2864
|
-
const t =
|
|
2863
|
+
function Rt(r, e) {
|
|
2864
|
+
const t = ae(r), s = ae(e);
|
|
2865
2865
|
if (r === e)
|
|
2866
2866
|
return { valid: !0, data: r };
|
|
2867
2867
|
if (t === p.object && s === p.object) {
|
|
2868
2868
|
const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = u(u({}, r), e);
|
|
2869
2869
|
for (const o of a) {
|
|
2870
|
-
const c =
|
|
2870
|
+
const c = Rt(r[o], e[o]);
|
|
2871
2871
|
if (!c.valid)
|
|
2872
2872
|
return { valid: !1 };
|
|
2873
2873
|
i[o] = c.data;
|
|
@@ -2878,7 +2878,7 @@ function Nt(r, e) {
|
|
|
2878
2878
|
return { valid: !1 };
|
|
2879
2879
|
const n = [];
|
|
2880
2880
|
for (let a = 0; a < r.length; a++) {
|
|
2881
|
-
const i = r[a], o = e[a], c =
|
|
2881
|
+
const i = r[a], o = e[a], c = Rt(i, o);
|
|
2882
2882
|
if (!c.valid)
|
|
2883
2883
|
return { valid: !1 };
|
|
2884
2884
|
n.push(c.data);
|
|
@@ -2886,13 +2886,13 @@ function Nt(r, e) {
|
|
|
2886
2886
|
return { valid: !0, data: n };
|
|
2887
2887
|
} else return t === p.date && s === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2888
2888
|
}
|
|
2889
|
-
class
|
|
2889
|
+
class Be extends w {
|
|
2890
2890
|
_parse(e) {
|
|
2891
2891
|
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
2892
|
-
if (
|
|
2892
|
+
if (Nt(a) || Nt(i))
|
|
2893
2893
|
return _;
|
|
2894
|
-
const o =
|
|
2895
|
-
return o.valid ? ((
|
|
2894
|
+
const o = Rt(a.value, i.value);
|
|
2895
|
+
return o.valid ? ((jt(a) || jt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2896
2896
|
code: l.invalid_intersection_types
|
|
2897
2897
|
}), _);
|
|
2898
2898
|
};
|
|
@@ -2918,12 +2918,12 @@ class We extends w {
|
|
|
2918
2918
|
}));
|
|
2919
2919
|
}
|
|
2920
2920
|
}
|
|
2921
|
-
|
|
2921
|
+
Be.create = (r, e, t) => new Be(u({
|
|
2922
2922
|
left: r,
|
|
2923
2923
|
right: e,
|
|
2924
2924
|
typeName: y.ZodIntersection
|
|
2925
2925
|
}, b(t)));
|
|
2926
|
-
class
|
|
2926
|
+
class te extends w {
|
|
2927
2927
|
_parse(e) {
|
|
2928
2928
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2929
2929
|
if (s.parsedType !== p.array)
|
|
@@ -2949,7 +2949,7 @@ class re extends w {
|
|
|
2949
2949
|
}), t.dirty());
|
|
2950
2950
|
const a = [...s.data].map((i, o) => {
|
|
2951
2951
|
const c = this._def.items[o] || this._def.rest;
|
|
2952
|
-
return c ? c._parse(new
|
|
2952
|
+
return c ? c._parse(new ee(s, i, s.path, o)) : null;
|
|
2953
2953
|
}).filter((i) => !!i);
|
|
2954
2954
|
return s.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
|
|
2955
2955
|
}
|
|
@@ -2957,21 +2957,21 @@ class re extends w {
|
|
|
2957
2957
|
return this._def.items;
|
|
2958
2958
|
}
|
|
2959
2959
|
rest(e) {
|
|
2960
|
-
return new
|
|
2960
|
+
return new te(g(u({}, this._def), {
|
|
2961
2961
|
rest: e
|
|
2962
2962
|
}));
|
|
2963
2963
|
}
|
|
2964
2964
|
}
|
|
2965
|
-
|
|
2965
|
+
te.create = (r, e) => {
|
|
2966
2966
|
if (!Array.isArray(r))
|
|
2967
2967
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2968
|
-
return new
|
|
2968
|
+
return new te(u({
|
|
2969
2969
|
items: r,
|
|
2970
2970
|
typeName: y.ZodTuple,
|
|
2971
2971
|
rest: null
|
|
2972
2972
|
}, b(e)));
|
|
2973
2973
|
};
|
|
2974
|
-
class
|
|
2974
|
+
class qe extends w {
|
|
2975
2975
|
get keySchema() {
|
|
2976
2976
|
return this._def.keyType;
|
|
2977
2977
|
}
|
|
@@ -2989,8 +2989,8 @@ class ze extends w {
|
|
|
2989
2989
|
const n = [], a = this._def.keyType, i = this._def.valueType;
|
|
2990
2990
|
for (const o in s.data)
|
|
2991
2991
|
n.push({
|
|
2992
|
-
key: a._parse(new
|
|
2993
|
-
value: i._parse(new
|
|
2992
|
+
key: a._parse(new ee(s, o, s.path, o)),
|
|
2993
|
+
value: i._parse(new ee(s, s.data[o], s.path, o)),
|
|
2994
2994
|
alwaysSet: o in s.data
|
|
2995
2995
|
});
|
|
2996
2996
|
return s.common.async ? Z.mergeObjectAsync(t, n) : Z.mergeObjectSync(t, n);
|
|
@@ -2999,18 +2999,18 @@ class ze extends w {
|
|
|
2999
2999
|
return this._def.valueType;
|
|
3000
3000
|
}
|
|
3001
3001
|
static create(e, t, s) {
|
|
3002
|
-
return t instanceof w ? new
|
|
3002
|
+
return t instanceof w ? new qe(u({
|
|
3003
3003
|
keyType: e,
|
|
3004
3004
|
valueType: t,
|
|
3005
3005
|
typeName: y.ZodRecord
|
|
3006
|
-
}, b(s))) : new
|
|
3006
|
+
}, b(s))) : new qe(u({
|
|
3007
3007
|
keyType: H.create(),
|
|
3008
3008
|
valueType: e,
|
|
3009
3009
|
typeName: y.ZodRecord
|
|
3010
3010
|
}, b(t)));
|
|
3011
3011
|
}
|
|
3012
3012
|
}
|
|
3013
|
-
class
|
|
3013
|
+
class ut extends w {
|
|
3014
3014
|
get keySchema() {
|
|
3015
3015
|
return this._def.keyType;
|
|
3016
3016
|
}
|
|
@@ -3026,8 +3026,8 @@ class dt extends w {
|
|
|
3026
3026
|
received: s.parsedType
|
|
3027
3027
|
}), _;
|
|
3028
3028
|
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
|
|
3029
|
-
key: n._parse(new
|
|
3030
|
-
value: a._parse(new
|
|
3029
|
+
key: n._parse(new ee(s, o, s.path, [d, "key"])),
|
|
3030
|
+
value: a._parse(new ee(s, c, s.path, [d, "value"]))
|
|
3031
3031
|
}));
|
|
3032
3032
|
if (s.common.async) {
|
|
3033
3033
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -3052,12 +3052,12 @@ class dt extends w {
|
|
|
3052
3052
|
}
|
|
3053
3053
|
}
|
|
3054
3054
|
}
|
|
3055
|
-
|
|
3055
|
+
ut.create = (r, e, t) => new ut(u({
|
|
3056
3056
|
valueType: e,
|
|
3057
3057
|
keyType: r,
|
|
3058
3058
|
typeName: y.ZodMap
|
|
3059
3059
|
}, b(t)));
|
|
3060
|
-
class
|
|
3060
|
+
class ke extends w {
|
|
3061
3061
|
_parse(e) {
|
|
3062
3062
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3063
3063
|
if (s.parsedType !== p.set)
|
|
@@ -3092,16 +3092,16 @@ class xe extends w {
|
|
|
3092
3092
|
}
|
|
3093
3093
|
return { status: t.value, value: d };
|
|
3094
3094
|
}
|
|
3095
|
-
const o = [...s.data.values()].map((c, d) => a._parse(new
|
|
3095
|
+
const o = [...s.data.values()].map((c, d) => a._parse(new ee(s, c, s.path, d)));
|
|
3096
3096
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3097
3097
|
}
|
|
3098
3098
|
min(e, t) {
|
|
3099
|
-
return new
|
|
3099
|
+
return new ke(g(u({}, this._def), {
|
|
3100
3100
|
minSize: { value: e, message: m.toString(t) }
|
|
3101
3101
|
}));
|
|
3102
3102
|
}
|
|
3103
3103
|
max(e, t) {
|
|
3104
|
-
return new
|
|
3104
|
+
return new ke(g(u({}, this._def), {
|
|
3105
3105
|
maxSize: { value: e, message: m.toString(t) }
|
|
3106
3106
|
}));
|
|
3107
3107
|
}
|
|
@@ -3112,13 +3112,13 @@ class xe extends w {
|
|
|
3112
3112
|
return this.min(1, e);
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
|
-
|
|
3115
|
+
ke.create = (r, e) => new ke(u({
|
|
3116
3116
|
valueType: r,
|
|
3117
3117
|
minSize: null,
|
|
3118
3118
|
maxSize: null,
|
|
3119
3119
|
typeName: y.ZodSet
|
|
3120
3120
|
}, b(e)));
|
|
3121
|
-
class
|
|
3121
|
+
class Ce extends w {
|
|
3122
3122
|
constructor() {
|
|
3123
3123
|
super(...arguments), this.validate = this.implement;
|
|
3124
3124
|
}
|
|
@@ -3131,14 +3131,14 @@ class Se extends w {
|
|
|
3131
3131
|
received: t.parsedType
|
|
3132
3132
|
}), _;
|
|
3133
3133
|
function s(o, c) {
|
|
3134
|
-
return
|
|
3134
|
+
return it({
|
|
3135
3135
|
data: o,
|
|
3136
3136
|
path: t.path,
|
|
3137
3137
|
errorMaps: [
|
|
3138
3138
|
t.common.contextualErrorMap,
|
|
3139
3139
|
t.schemaErrorMap,
|
|
3140
|
-
|
|
3141
|
-
|
|
3140
|
+
at(),
|
|
3141
|
+
Oe
|
|
3142
3142
|
].filter((d) => !!d),
|
|
3143
3143
|
issueData: {
|
|
3144
3144
|
code: l.invalid_arguments,
|
|
@@ -3147,14 +3147,14 @@ class Se extends w {
|
|
|
3147
3147
|
});
|
|
3148
3148
|
}
|
|
3149
3149
|
function n(o, c) {
|
|
3150
|
-
return
|
|
3150
|
+
return it({
|
|
3151
3151
|
data: o,
|
|
3152
3152
|
path: t.path,
|
|
3153
3153
|
errorMaps: [
|
|
3154
3154
|
t.common.contextualErrorMap,
|
|
3155
3155
|
t.schemaErrorMap,
|
|
3156
|
-
|
|
3157
|
-
|
|
3156
|
+
at(),
|
|
3157
|
+
Oe
|
|
3158
3158
|
].filter((d) => !!d),
|
|
3159
3159
|
issueData: {
|
|
3160
3160
|
code: l.invalid_return_type,
|
|
@@ -3163,7 +3163,7 @@ class Se extends w {
|
|
|
3163
3163
|
});
|
|
3164
3164
|
}
|
|
3165
3165
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
3166
|
-
if (this._def.returns instanceof
|
|
3166
|
+
if (this._def.returns instanceof je) {
|
|
3167
3167
|
const o = this;
|
|
3168
3168
|
return $(function(...c) {
|
|
3169
3169
|
return C(this, null, function* () {
|
|
@@ -3195,12 +3195,12 @@ class Se extends w {
|
|
|
3195
3195
|
return this._def.returns;
|
|
3196
3196
|
}
|
|
3197
3197
|
args(...e) {
|
|
3198
|
-
return new
|
|
3199
|
-
args:
|
|
3198
|
+
return new Ce(g(u({}, this._def), {
|
|
3199
|
+
args: te.create(e).rest(be.create())
|
|
3200
3200
|
}));
|
|
3201
3201
|
}
|
|
3202
3202
|
returns(e) {
|
|
3203
|
-
return new
|
|
3203
|
+
return new Ce(g(u({}, this._def), {
|
|
3204
3204
|
returns: e
|
|
3205
3205
|
}));
|
|
3206
3206
|
}
|
|
@@ -3211,14 +3211,14 @@ class Se extends w {
|
|
|
3211
3211
|
return this.parse(e);
|
|
3212
3212
|
}
|
|
3213
3213
|
static create(e, t, s) {
|
|
3214
|
-
return new
|
|
3215
|
-
args: e ||
|
|
3216
|
-
returns: t ||
|
|
3214
|
+
return new Ce(u({
|
|
3215
|
+
args: e || te.create([]).rest(be.create()),
|
|
3216
|
+
returns: t || be.create(),
|
|
3217
3217
|
typeName: y.ZodFunction
|
|
3218
3218
|
}, b(s)));
|
|
3219
3219
|
}
|
|
3220
3220
|
}
|
|
3221
|
-
class
|
|
3221
|
+
class He extends w {
|
|
3222
3222
|
get schema() {
|
|
3223
3223
|
return this._def.getter();
|
|
3224
3224
|
}
|
|
@@ -3227,11 +3227,11 @@ class Be extends w {
|
|
|
3227
3227
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
3230
|
-
|
|
3230
|
+
He.create = (r, e) => new He(u({
|
|
3231
3231
|
getter: r,
|
|
3232
3232
|
typeName: y.ZodLazy
|
|
3233
3233
|
}, b(e)));
|
|
3234
|
-
class
|
|
3234
|
+
class Je extends w {
|
|
3235
3235
|
_parse(e) {
|
|
3236
3236
|
if (e.data !== this._def.value) {
|
|
3237
3237
|
const t = this._getOrReturnCtx(e);
|
|
@@ -3247,19 +3247,19 @@ class qe extends w {
|
|
|
3247
3247
|
return this._def.value;
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
|
-
|
|
3250
|
+
Je.create = (r, e) => new Je(u({
|
|
3251
3251
|
value: r,
|
|
3252
3252
|
typeName: y.ZodLiteral
|
|
3253
3253
|
}, b(e)));
|
|
3254
3254
|
function gr(r, e) {
|
|
3255
|
-
return new
|
|
3255
|
+
return new he(u({
|
|
3256
3256
|
values: r,
|
|
3257
3257
|
typeName: y.ZodEnum
|
|
3258
3258
|
}, b(e)));
|
|
3259
3259
|
}
|
|
3260
|
-
class
|
|
3260
|
+
class he extends w {
|
|
3261
3261
|
constructor() {
|
|
3262
|
-
super(...arguments),
|
|
3262
|
+
super(...arguments), $e.set(this, void 0);
|
|
3263
3263
|
}
|
|
3264
3264
|
_parse(e) {
|
|
3265
3265
|
if (typeof e.data != "string") {
|
|
@@ -3270,7 +3270,7 @@ class pe extends w {
|
|
|
3270
3270
|
code: l.invalid_type
|
|
3271
3271
|
}), _;
|
|
3272
3272
|
}
|
|
3273
|
-
if (
|
|
3273
|
+
if (ot(this, $e) || fr(this, $e, new Set(this._def.values)), !ot(this, $e).has(e.data)) {
|
|
3274
3274
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3275
3275
|
return h(t, {
|
|
3276
3276
|
received: t.data,
|
|
@@ -3302,17 +3302,17 @@ class pe extends w {
|
|
|
3302
3302
|
return e;
|
|
3303
3303
|
}
|
|
3304
3304
|
extract(e, t = this._def) {
|
|
3305
|
-
return
|
|
3305
|
+
return he.create(e, u(u({}, this._def), t));
|
|
3306
3306
|
}
|
|
3307
3307
|
exclude(e, t = this._def) {
|
|
3308
|
-
return
|
|
3308
|
+
return he.create(this.options.filter((s) => !e.includes(s)), u(u({}, this._def), t));
|
|
3309
3309
|
}
|
|
3310
3310
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
class
|
|
3311
|
+
$e = /* @__PURE__ */ new WeakMap();
|
|
3312
|
+
he.create = gr;
|
|
3313
|
+
class Ge extends w {
|
|
3314
3314
|
constructor() {
|
|
3315
|
-
super(...arguments),
|
|
3315
|
+
super(...arguments), Fe.set(this, void 0);
|
|
3316
3316
|
}
|
|
3317
3317
|
_parse(e) {
|
|
3318
3318
|
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
@@ -3324,7 +3324,7 @@ class He extends w {
|
|
|
3324
3324
|
code: l.invalid_type
|
|
3325
3325
|
}), _;
|
|
3326
3326
|
}
|
|
3327
|
-
if (
|
|
3327
|
+
if (ot(this, Fe) || fr(this, Fe, new Set(x.getValidEnumValues(this._def.values))), !ot(this, Fe).has(e.data)) {
|
|
3328
3328
|
const n = x.objectValues(t);
|
|
3329
3329
|
return h(s, {
|
|
3330
3330
|
received: s.data,
|
|
@@ -3338,12 +3338,12 @@ class He extends w {
|
|
|
3338
3338
|
return this._def.values;
|
|
3339
3339
|
}
|
|
3340
3340
|
}
|
|
3341
|
-
|
|
3342
|
-
|
|
3341
|
+
Fe = /* @__PURE__ */ new WeakMap();
|
|
3342
|
+
Ge.create = (r, e) => new Ge(u({
|
|
3343
3343
|
values: r,
|
|
3344
3344
|
typeName: y.ZodNativeEnum
|
|
3345
3345
|
}, b(e)));
|
|
3346
|
-
class
|
|
3346
|
+
class je extends w {
|
|
3347
3347
|
unwrap() {
|
|
3348
3348
|
return this._def.type;
|
|
3349
3349
|
}
|
|
@@ -3362,7 +3362,7 @@ class Oe extends w {
|
|
|
3362
3362
|
})));
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
3365
|
-
|
|
3365
|
+
je.create = (r, e) => new je(u({
|
|
3366
3366
|
type: r,
|
|
3367
3367
|
typeName: y.ZodPromise
|
|
3368
3368
|
}, b(e)));
|
|
@@ -3393,7 +3393,7 @@ class G extends w {
|
|
|
3393
3393
|
path: s.path,
|
|
3394
3394
|
parent: s
|
|
3395
3395
|
});
|
|
3396
|
-
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ?
|
|
3396
|
+
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? Ae(c.value) : c;
|
|
3397
3397
|
}));
|
|
3398
3398
|
{
|
|
3399
3399
|
if (t.value === "aborted")
|
|
@@ -3403,7 +3403,7 @@ class G extends w {
|
|
|
3403
3403
|
path: s.path,
|
|
3404
3404
|
parent: s
|
|
3405
3405
|
});
|
|
3406
|
-
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ?
|
|
3406
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? Ae(o.value) : o;
|
|
3407
3407
|
}
|
|
3408
3408
|
}
|
|
3409
3409
|
if (n.type === "refinement") {
|
|
@@ -3432,14 +3432,14 @@ class G extends w {
|
|
|
3432
3432
|
path: s.path,
|
|
3433
3433
|
parent: s
|
|
3434
3434
|
});
|
|
3435
|
-
if (!
|
|
3435
|
+
if (!we(i))
|
|
3436
3436
|
return i;
|
|
3437
3437
|
const o = n.transform(i.value, a);
|
|
3438
3438
|
if (o instanceof Promise)
|
|
3439
3439
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3440
3440
|
return { status: t.value, value: o };
|
|
3441
3441
|
} else
|
|
3442
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) =>
|
|
3442
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => we(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
3443
3443
|
x.assertNever(n);
|
|
3444
3444
|
}
|
|
3445
3445
|
}
|
|
@@ -3453,7 +3453,7 @@ G.createWithPreprocess = (r, e, t) => new G(u({
|
|
|
3453
3453
|
effect: { type: "preprocess", transform: r },
|
|
3454
3454
|
typeName: y.ZodEffects
|
|
3455
3455
|
}, b(t)));
|
|
3456
|
-
class
|
|
3456
|
+
class Q extends w {
|
|
3457
3457
|
_parse(e) {
|
|
3458
3458
|
return this._getType(e) === p.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
3459
3459
|
}
|
|
@@ -3461,11 +3461,11 @@ class ee extends w {
|
|
|
3461
3461
|
return this._def.innerType;
|
|
3462
3462
|
}
|
|
3463
3463
|
}
|
|
3464
|
-
|
|
3464
|
+
Q.create = (r, e) => new Q(u({
|
|
3465
3465
|
innerType: r,
|
|
3466
3466
|
typeName: y.ZodOptional
|
|
3467
3467
|
}, b(e)));
|
|
3468
|
-
class
|
|
3468
|
+
class pe extends w {
|
|
3469
3469
|
_parse(e) {
|
|
3470
3470
|
return this._getType(e) === p.null ? $(null) : this._def.innerType._parse(e);
|
|
3471
3471
|
}
|
|
@@ -3473,11 +3473,11 @@ class me extends w {
|
|
|
3473
3473
|
return this._def.innerType;
|
|
3474
3474
|
}
|
|
3475
3475
|
}
|
|
3476
|
-
|
|
3476
|
+
pe.create = (r, e) => new pe(u({
|
|
3477
3477
|
innerType: r,
|
|
3478
3478
|
typeName: y.ZodNullable
|
|
3479
3479
|
}, b(e)));
|
|
3480
|
-
class
|
|
3480
|
+
class Ke extends w {
|
|
3481
3481
|
_parse(e) {
|
|
3482
3482
|
const { ctx: t } = this._processInputParams(e);
|
|
3483
3483
|
let s = t.data;
|
|
@@ -3491,12 +3491,12 @@ class Je extends w {
|
|
|
3491
3491
|
return this._def.innerType;
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
|
-
|
|
3494
|
+
Ke.create = (r, e) => new Ke(u({
|
|
3495
3495
|
innerType: r,
|
|
3496
3496
|
typeName: y.ZodDefault,
|
|
3497
3497
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3498
3498
|
}, b(e)));
|
|
3499
|
-
class
|
|
3499
|
+
class Xe extends w {
|
|
3500
3500
|
_parse(e) {
|
|
3501
3501
|
const { ctx: t } = this._processInputParams(e), s = g(u({}, t), {
|
|
3502
3502
|
common: g(u({}, t.common), {
|
|
@@ -3507,7 +3507,7 @@ class Ge extends w {
|
|
|
3507
3507
|
path: s.path,
|
|
3508
3508
|
parent: u({}, s)
|
|
3509
3509
|
});
|
|
3510
|
-
return
|
|
3510
|
+
return Le(n) ? n.then((a) => ({
|
|
3511
3511
|
status: "valid",
|
|
3512
3512
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3513
3513
|
get error() {
|
|
@@ -3529,12 +3529,12 @@ class Ge extends w {
|
|
|
3529
3529
|
return this._def.innerType;
|
|
3530
3530
|
}
|
|
3531
3531
|
}
|
|
3532
|
-
|
|
3532
|
+
Xe.create = (r, e) => new Xe(u({
|
|
3533
3533
|
innerType: r,
|
|
3534
3534
|
typeName: y.ZodCatch,
|
|
3535
3535
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3536
3536
|
}, b(e)));
|
|
3537
|
-
class
|
|
3537
|
+
class lt extends w {
|
|
3538
3538
|
_parse(e) {
|
|
3539
3539
|
if (this._getType(e) !== p.nan) {
|
|
3540
3540
|
const s = this._getOrReturnCtx(e);
|
|
@@ -3547,11 +3547,11 @@ class ut extends w {
|
|
|
3547
3547
|
return { status: "valid", value: e.data };
|
|
3548
3548
|
}
|
|
3549
3549
|
}
|
|
3550
|
-
|
|
3550
|
+
lt.create = (r) => new lt(u({
|
|
3551
3551
|
typeName: y.ZodNaN
|
|
3552
3552
|
}, b(r)));
|
|
3553
3553
|
const tn = Symbol("zod_brand");
|
|
3554
|
-
class
|
|
3554
|
+
class $t extends w {
|
|
3555
3555
|
_parse(e) {
|
|
3556
3556
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3557
3557
|
return this._def.type._parse({
|
|
@@ -3564,7 +3564,7 @@ class Mt extends w {
|
|
|
3564
3564
|
return this._def.type;
|
|
3565
3565
|
}
|
|
3566
3566
|
}
|
|
3567
|
-
class
|
|
3567
|
+
class et extends w {
|
|
3568
3568
|
_parse(e) {
|
|
3569
3569
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3570
3570
|
if (s.common.async)
|
|
@@ -3574,7 +3574,7 @@ class Ye extends w {
|
|
|
3574
3574
|
path: s.path,
|
|
3575
3575
|
parent: s
|
|
3576
3576
|
});
|
|
3577
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(),
|
|
3577
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), Ae(a.value)) : this._def.out._parseAsync({
|
|
3578
3578
|
data: a.value,
|
|
3579
3579
|
path: s.path,
|
|
3580
3580
|
parent: s
|
|
@@ -3597,23 +3597,23 @@ class Ye extends w {
|
|
|
3597
3597
|
}
|
|
3598
3598
|
}
|
|
3599
3599
|
static create(e, t) {
|
|
3600
|
-
return new
|
|
3600
|
+
return new et({
|
|
3601
3601
|
in: e,
|
|
3602
3602
|
out: t,
|
|
3603
3603
|
typeName: y.ZodPipeline
|
|
3604
3604
|
});
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
|
-
class
|
|
3607
|
+
class Ye extends w {
|
|
3608
3608
|
_parse(e) {
|
|
3609
|
-
const t = this._def.innerType._parse(e), s = (n) => (
|
|
3610
|
-
return
|
|
3609
|
+
const t = this._def.innerType._parse(e), s = (n) => (we(n) && (n.value = Object.freeze(n.value)), n);
|
|
3610
|
+
return Le(t) ? t.then((n) => s(n)) : s(t);
|
|
3611
3611
|
}
|
|
3612
3612
|
unwrap() {
|
|
3613
3613
|
return this._def.innerType;
|
|
3614
3614
|
}
|
|
3615
3615
|
}
|
|
3616
|
-
|
|
3616
|
+
Ye.create = (r, e) => new Ye(u({
|
|
3617
3617
|
innerType: r,
|
|
3618
3618
|
typeName: y.ZodReadonly
|
|
3619
3619
|
}, b(e)));
|
|
@@ -3622,7 +3622,7 @@ function Kt(r, e) {
|
|
|
3622
3622
|
return typeof t == "string" ? { message: t } : t;
|
|
3623
3623
|
}
|
|
3624
3624
|
function yr(r, e = {}, t) {
|
|
3625
|
-
return r ?
|
|
3625
|
+
return r ? Ne.create().superRefine((s, n) => {
|
|
3626
3626
|
var a, i;
|
|
3627
3627
|
const o = r(s);
|
|
3628
3628
|
if (o instanceof Promise)
|
|
@@ -3637,10 +3637,10 @@ function yr(r, e = {}, t) {
|
|
|
3637
3637
|
const c = Kt(e, s), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3638
3638
|
n.addIssue(g(u({ code: "custom" }, c), { fatal: d }));
|
|
3639
3639
|
}
|
|
3640
|
-
}) :
|
|
3640
|
+
}) : Ne.create();
|
|
3641
3641
|
}
|
|
3642
3642
|
const rn = {
|
|
3643
|
-
object:
|
|
3643
|
+
object: I.lazycreate
|
|
3644
3644
|
};
|
|
3645
3645
|
var y;
|
|
3646
3646
|
(function(r) {
|
|
@@ -3648,79 +3648,79 @@ var y;
|
|
|
3648
3648
|
})(y || (y = {}));
|
|
3649
3649
|
const sn = (r, e = {
|
|
3650
3650
|
message: `Input not instance of ${r.name}`
|
|
3651
|
-
}) => yr((t) => t instanceof r, e), vr = H.create, _r =
|
|
3651
|
+
}) => yr((t) => t instanceof r, e), vr = H.create, _r = le.create, nn = lt.create, an = fe.create, br = Ve.create, on = xe.create, cn = ct.create, dn = Ue.create, un = We.create, ln = Ne.create, fn = be.create, hn = oe.create, pn = dt.create, mn = J.create, gn = I.create, yn = I.strictCreate, vn = ze.create, _n = ft.create, bn = Be.create, wn = te.create, xn = qe.create, kn = ut.create, Tn = ke.create, Sn = Ce.create, En = He.create, An = Je.create, Cn = he.create, In = Ge.create, On = je.create, Xt = G.create, Nn = Q.create, jn = pe.create, Rn = G.createWithPreprocess, Zn = et.create, Mn = () => vr().optional(), Pn = () => _r().optional(), $n = () => br().optional(), Fn = {
|
|
3652
3652
|
string: (r) => H.create(g(u({}, r), { coerce: !0 })),
|
|
3653
|
-
number: (r) =>
|
|
3654
|
-
boolean: (r) =>
|
|
3653
|
+
number: (r) => le.create(g(u({}, r), { coerce: !0 })),
|
|
3654
|
+
boolean: (r) => Ve.create(g(u({}, r), {
|
|
3655
3655
|
coerce: !0
|
|
3656
3656
|
})),
|
|
3657
|
-
bigint: (r) =>
|
|
3658
|
-
date: (r) =>
|
|
3657
|
+
bigint: (r) => fe.create(g(u({}, r), { coerce: !0 })),
|
|
3658
|
+
date: (r) => xe.create(g(u({}, r), { coerce: !0 }))
|
|
3659
3659
|
}, Dn = _;
|
|
3660
3660
|
var T = /* @__PURE__ */ Object.freeze({
|
|
3661
3661
|
__proto__: null,
|
|
3662
|
-
defaultErrorMap:
|
|
3662
|
+
defaultErrorMap: Oe,
|
|
3663
3663
|
setErrorMap: js,
|
|
3664
|
-
getErrorMap:
|
|
3665
|
-
makeIssue:
|
|
3664
|
+
getErrorMap: at,
|
|
3665
|
+
makeIssue: it,
|
|
3666
3666
|
EMPTY_PATH: Rs,
|
|
3667
3667
|
addIssueToContext: h,
|
|
3668
3668
|
ParseStatus: Z,
|
|
3669
3669
|
INVALID: _,
|
|
3670
|
-
DIRTY:
|
|
3670
|
+
DIRTY: Ae,
|
|
3671
3671
|
OK: $,
|
|
3672
|
-
isAborted:
|
|
3673
|
-
isDirty:
|
|
3674
|
-
isValid:
|
|
3675
|
-
isAsync:
|
|
3672
|
+
isAborted: Nt,
|
|
3673
|
+
isDirty: jt,
|
|
3674
|
+
isValid: we,
|
|
3675
|
+
isAsync: Le,
|
|
3676
3676
|
get util() {
|
|
3677
3677
|
return x;
|
|
3678
3678
|
},
|
|
3679
3679
|
get objectUtil() {
|
|
3680
|
-
return
|
|
3680
|
+
return Ot;
|
|
3681
3681
|
},
|
|
3682
3682
|
ZodParsedType: p,
|
|
3683
|
-
getParsedType:
|
|
3683
|
+
getParsedType: ae,
|
|
3684
3684
|
ZodType: w,
|
|
3685
3685
|
datetimeRegex: mr,
|
|
3686
3686
|
ZodString: H,
|
|
3687
|
-
ZodNumber:
|
|
3688
|
-
ZodBigInt:
|
|
3689
|
-
ZodBoolean:
|
|
3690
|
-
ZodDate:
|
|
3691
|
-
ZodSymbol:
|
|
3692
|
-
ZodUndefined:
|
|
3693
|
-
ZodNull:
|
|
3694
|
-
ZodAny:
|
|
3695
|
-
ZodUnknown:
|
|
3687
|
+
ZodNumber: le,
|
|
3688
|
+
ZodBigInt: fe,
|
|
3689
|
+
ZodBoolean: Ve,
|
|
3690
|
+
ZodDate: xe,
|
|
3691
|
+
ZodSymbol: ct,
|
|
3692
|
+
ZodUndefined: Ue,
|
|
3693
|
+
ZodNull: We,
|
|
3694
|
+
ZodAny: Ne,
|
|
3695
|
+
ZodUnknown: be,
|
|
3696
3696
|
ZodNever: oe,
|
|
3697
|
-
ZodVoid:
|
|
3697
|
+
ZodVoid: dt,
|
|
3698
3698
|
ZodArray: J,
|
|
3699
|
-
ZodObject:
|
|
3700
|
-
ZodUnion:
|
|
3701
|
-
ZodDiscriminatedUnion:
|
|
3702
|
-
ZodIntersection:
|
|
3703
|
-
ZodTuple:
|
|
3704
|
-
ZodRecord:
|
|
3705
|
-
ZodMap:
|
|
3706
|
-
ZodSet:
|
|
3707
|
-
ZodFunction:
|
|
3708
|
-
ZodLazy:
|
|
3709
|
-
ZodLiteral:
|
|
3710
|
-
ZodEnum:
|
|
3711
|
-
ZodNativeEnum:
|
|
3712
|
-
ZodPromise:
|
|
3699
|
+
ZodObject: I,
|
|
3700
|
+
ZodUnion: ze,
|
|
3701
|
+
ZodDiscriminatedUnion: ft,
|
|
3702
|
+
ZodIntersection: Be,
|
|
3703
|
+
ZodTuple: te,
|
|
3704
|
+
ZodRecord: qe,
|
|
3705
|
+
ZodMap: ut,
|
|
3706
|
+
ZodSet: ke,
|
|
3707
|
+
ZodFunction: Ce,
|
|
3708
|
+
ZodLazy: He,
|
|
3709
|
+
ZodLiteral: Je,
|
|
3710
|
+
ZodEnum: he,
|
|
3711
|
+
ZodNativeEnum: Ge,
|
|
3712
|
+
ZodPromise: je,
|
|
3713
3713
|
ZodEffects: G,
|
|
3714
3714
|
ZodTransformer: G,
|
|
3715
|
-
ZodOptional:
|
|
3716
|
-
ZodNullable:
|
|
3717
|
-
ZodDefault:
|
|
3718
|
-
ZodCatch:
|
|
3719
|
-
ZodNaN:
|
|
3715
|
+
ZodOptional: Q,
|
|
3716
|
+
ZodNullable: pe,
|
|
3717
|
+
ZodDefault: Ke,
|
|
3718
|
+
ZodCatch: Xe,
|
|
3719
|
+
ZodNaN: lt,
|
|
3720
3720
|
BRAND: tn,
|
|
3721
|
-
ZodBranded:
|
|
3722
|
-
ZodPipeline:
|
|
3723
|
-
ZodReadonly:
|
|
3721
|
+
ZodBranded: $t,
|
|
3722
|
+
ZodPipeline: et,
|
|
3723
|
+
ZodReadonly: Ye,
|
|
3724
3724
|
custom: yr,
|
|
3725
3725
|
Schema: w,
|
|
3726
3726
|
ZodSchema: w,
|
|
@@ -3744,7 +3744,7 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3744
3744
|
literal: An,
|
|
3745
3745
|
map: kn,
|
|
3746
3746
|
nan: nn,
|
|
3747
|
-
nativeEnum:
|
|
3747
|
+
nativeEnum: In,
|
|
3748
3748
|
never: hn,
|
|
3749
3749
|
null: un,
|
|
3750
3750
|
nullable: jn,
|
|
@@ -3756,7 +3756,7 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3756
3756
|
ostring: Mn,
|
|
3757
3757
|
pipeline: Zn,
|
|
3758
3758
|
preprocess: Rn,
|
|
3759
|
-
promise:
|
|
3759
|
+
promise: On,
|
|
3760
3760
|
record: xn,
|
|
3761
3761
|
set: Tn,
|
|
3762
3762
|
strictObject: yn,
|
|
@@ -3776,7 +3776,9 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3776
3776
|
const Ln = T.object({
|
|
3777
3777
|
language: T.enum(["typescript", "javascript"]).optional(),
|
|
3778
3778
|
disableMarkedForExport: T.boolean().optional(),
|
|
3779
|
-
allowAutoSelectFirstNode: T.boolean().optional().default(!0)
|
|
3779
|
+
allowAutoSelectFirstNode: T.boolean().optional().default(!0),
|
|
3780
|
+
enableDisplayDataId: T.boolean().optional(),
|
|
3781
|
+
enableDisplayDataName: T.boolean().optional()
|
|
3780
3782
|
}).and(
|
|
3781
3783
|
T.union([
|
|
3782
3784
|
T.object({
|
|
@@ -3803,8 +3805,6 @@ const Ln = T.object({
|
|
|
3803
3805
|
enableDisplayScreenModelId: T.boolean().optional(),
|
|
3804
3806
|
enableGeneratePackageLock: T.boolean().optional(),
|
|
3805
3807
|
enableAnimationsPreset: T.boolean().optional(),
|
|
3806
|
-
enableDisplayDataId: T.boolean().optional(),
|
|
3807
|
-
enableDisplayDataName: T.boolean().optional(),
|
|
3808
3808
|
enableAutoSplit: T.boolean().optional(),
|
|
3809
3809
|
autoSplitThreshold: T.number().optional(),
|
|
3810
3810
|
url: T.string().url().optional(),
|
|
@@ -3861,36 +3861,36 @@ const Ln = T.object({
|
|
|
3861
3861
|
reason: "Selected node type is not supported"
|
|
3862
3862
|
};
|
|
3863
3863
|
};
|
|
3864
|
-
var
|
|
3865
|
-
class
|
|
3864
|
+
var E, Qe, ie, wr, De;
|
|
3865
|
+
class ea {
|
|
3866
3866
|
constructor({
|
|
3867
3867
|
auth: e,
|
|
3868
3868
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
3869
3869
|
} = {}) {
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3870
|
+
tt(this, ie);
|
|
3871
|
+
tt(this, E);
|
|
3872
|
+
tt(this, Qe);
|
|
3873
|
+
gt(this, Qe, t), e && (this.auth = e);
|
|
3874
3874
|
}
|
|
3875
3875
|
hasAuth() {
|
|
3876
|
-
return !!
|
|
3876
|
+
return !!A(this, E);
|
|
3877
3877
|
}
|
|
3878
3878
|
set auth(e) {
|
|
3879
|
-
|
|
3879
|
+
gt(this, E, e);
|
|
3880
3880
|
}
|
|
3881
3881
|
get headers() {
|
|
3882
3882
|
const e = {
|
|
3883
3883
|
"Content-Type": "application/json"
|
|
3884
3884
|
};
|
|
3885
|
-
return
|
|
3885
|
+
return A(this, E) && (e.Authorization = `Bearer ${A(this, E).token}`, "teamId" in A(this, E) && (e["X-Team-Id"] = A(this, E).teamId)), e;
|
|
3886
3886
|
}
|
|
3887
3887
|
generateCode(n) {
|
|
3888
3888
|
return C(this, arguments, function* (e, t = {}, s) {
|
|
3889
3889
|
var c;
|
|
3890
3890
|
const a = Vn(e.settings);
|
|
3891
|
-
e.figmaToken && (yield
|
|
3891
|
+
e.figmaToken && (yield Se(this, ie, wr).call(this, e.fileKey, e.figmaToken, e.nodesId, { allowAutoSelectFirstNode: (c = a.allowAutoSelectFirstNode) != null ? c : !0 }, s));
|
|
3892
3892
|
let i = e.tracking;
|
|
3893
|
-
|
|
3893
|
+
A(this, E) && "userId" in A(this, E) && A(this, E).userId && (i != null && i.externalId || (i = { externalId: A(this, E).userId }));
|
|
3894
3894
|
const o = {
|
|
3895
3895
|
tracking: i,
|
|
3896
3896
|
fileKey: e.fileKey,
|
|
@@ -3917,13 +3917,13 @@ class Qn {
|
|
|
3917
3917
|
codegenSettings: a.codegenSettings,
|
|
3918
3918
|
webhookUrl: e.webhookUrl
|
|
3919
3919
|
};
|
|
3920
|
-
return
|
|
3920
|
+
return Se(this, ie, De).call(this, "/v1/codegen", o, t, "codegen", s);
|
|
3921
3921
|
});
|
|
3922
3922
|
}
|
|
3923
3923
|
generateCodeFromWebsite(n) {
|
|
3924
3924
|
return C(this, arguments, function* (e, t = {}, s) {
|
|
3925
3925
|
let a = e.tracking;
|
|
3926
|
-
|
|
3926
|
+
A(this, E) && "userId" in A(this, E) && A(this, E).userId && (a != null && a.externalId || (a = { externalId: A(this, E).userId }));
|
|
3927
3927
|
let i;
|
|
3928
3928
|
if (e.mhtml)
|
|
3929
3929
|
i = {
|
|
@@ -3953,7 +3953,61 @@ class Qn {
|
|
|
3953
3953
|
}
|
|
3954
3954
|
}
|
|
3955
3955
|
};
|
|
3956
|
-
return
|
|
3956
|
+
return Se(this, ie, De).call(this, "/v1/l2c", o, t, "l2c", s);
|
|
3957
|
+
});
|
|
3958
|
+
}
|
|
3959
|
+
/**
|
|
3960
|
+
* Generates code from a text prompt using AI.
|
|
3961
|
+
*
|
|
3962
|
+
* This method sends a prompt to the Anima API and generates code based on the description provided.
|
|
3963
|
+
* It supports real-time streaming of the generation process through Server-Sent Events (SSE).
|
|
3964
|
+
*
|
|
3965
|
+
* @param params - The parameters for code generation
|
|
3966
|
+
* @param params.prompt - The text prompt describing what code to generate
|
|
3967
|
+
* @param params.settings - Code generation settings (framework, language, styling, etc.)
|
|
3968
|
+
* @param params.assetsStorage - Optional asset storage configuration
|
|
3969
|
+
* @param params.tracking - Optional tracking information
|
|
3970
|
+
* @param params.webhookUrl - Optional webhook URL for completion notification
|
|
3971
|
+
* @param handler - Event handler for processing SSE messages during generation
|
|
3972
|
+
* @param signal - Optional AbortSignal to cancel the request
|
|
3973
|
+
* @returns Promise resolving to AnimaSDKResult with generated files and metadata
|
|
3974
|
+
*
|
|
3975
|
+
* @example
|
|
3976
|
+
* ```typescript
|
|
3977
|
+
* const result = await anima.generateCodeFromPrompt({
|
|
3978
|
+
* prompt: "Create a login form with email and password fields",
|
|
3979
|
+
* settings: {
|
|
3980
|
+
* framework: "react",
|
|
3981
|
+
* language: "typescript",
|
|
3982
|
+
* styling: "tailwind"
|
|
3983
|
+
* }
|
|
3984
|
+
* }, {
|
|
3985
|
+
* onStart: ({ sessionId }) => console.log("Started:", sessionId),
|
|
3986
|
+
* onGeneratingCode: ({ progress }) => console.log("Progress:", progress),
|
|
3987
|
+
* onCodegenCompleted: () => console.log("Generation completed!")
|
|
3988
|
+
* });
|
|
3989
|
+
* ```
|
|
3990
|
+
*/
|
|
3991
|
+
generateCodeFromPrompt(n) {
|
|
3992
|
+
return C(this, arguments, function* (e, t = {}, s) {
|
|
3993
|
+
var o;
|
|
3994
|
+
let a = e.tracking;
|
|
3995
|
+
A(this, E) && "userId" in A(this, E) && A(this, E).userId && (a != null && a.externalId || (a = { externalId: A(this, E).userId }));
|
|
3996
|
+
const i = {
|
|
3997
|
+
tracking: a,
|
|
3998
|
+
assetsStorage: e.assetsStorage,
|
|
3999
|
+
params: u({
|
|
4000
|
+
prompt: e.prompt,
|
|
4001
|
+
conventions: {
|
|
4002
|
+
language: e.settings.language,
|
|
4003
|
+
framework: e.settings.framework,
|
|
4004
|
+
styling: e.settings.styling,
|
|
4005
|
+
uiLibrary: e.settings.uiLibrary
|
|
4006
|
+
}
|
|
4007
|
+
}, (o = e.settings.codegenSettings) != null ? o : {}),
|
|
4008
|
+
webhookUrl: e.webhookUrl
|
|
4009
|
+
};
|
|
4010
|
+
return console.log("P2C Request Body:", JSON.stringify(i, null, 2)), Se(this, ie, De).call(this, "/v1/p2c", i, t, "p2c", s);
|
|
3957
4011
|
});
|
|
3958
4012
|
}
|
|
3959
4013
|
/**
|
|
@@ -3962,21 +4016,21 @@ class Qn {
|
|
|
3962
4016
|
generateLink2Code(n) {
|
|
3963
4017
|
return C(this, arguments, function* (e, t = {}, s) {
|
|
3964
4018
|
let a = e.tracking;
|
|
3965
|
-
|
|
4019
|
+
A(this, E) && "userId" in A(this, E) && A(this, E).userId && (a != null && a.externalId || (a = { externalId: A(this, E).userId }));
|
|
3966
4020
|
const i = {
|
|
3967
4021
|
tracking: a,
|
|
3968
4022
|
assetsStorage: e.assetsStorage,
|
|
3969
4023
|
params: e.params
|
|
3970
4024
|
};
|
|
3971
|
-
return
|
|
4025
|
+
return Se(this, ie, De).call(this, "/v1/l2c", i, t, "l2c", s);
|
|
3972
4026
|
});
|
|
3973
4027
|
}
|
|
3974
4028
|
}
|
|
3975
|
-
|
|
4029
|
+
E = new WeakMap(), Qe = new WeakMap(), ie = new WeakSet(), wr = function(e, t, s, n, a) {
|
|
3976
4030
|
return C(this, null, function* () {
|
|
3977
4031
|
let i;
|
|
3978
4032
|
try {
|
|
3979
|
-
i = yield
|
|
4033
|
+
i = yield Os({
|
|
3980
4034
|
fileKey: e,
|
|
3981
4035
|
authToken: t,
|
|
3982
4036
|
params: {
|
|
@@ -3995,17 +4049,17 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
|
|
|
3995
4049
|
(d) => !d.isValid
|
|
3996
4050
|
);
|
|
3997
4051
|
if (c)
|
|
3998
|
-
throw new
|
|
4052
|
+
throw new ye({
|
|
3999
4053
|
name: "Task Crashed",
|
|
4000
4054
|
reason: c.reason
|
|
4001
4055
|
});
|
|
4002
4056
|
});
|
|
4003
|
-
},
|
|
4057
|
+
}, De = function(e, t, s, n, a) {
|
|
4004
4058
|
return C(this, null, function* () {
|
|
4005
|
-
var v, j, M, F, z,
|
|
4059
|
+
var v, j, M, F, z, re, me, ce, V, de;
|
|
4006
4060
|
if (this.hasAuth() === !1)
|
|
4007
4061
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
4008
|
-
const i = {}, o = yield fetch(`${
|
|
4062
|
+
const i = {}, o = yield fetch(`${A(this, Qe)}${e}`, {
|
|
4009
4063
|
method: "POST",
|
|
4010
4064
|
headers: g(u({}, this.headers), {
|
|
4011
4065
|
Accept: "text/event-stream"
|
|
@@ -4014,29 +4068,32 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
|
|
|
4014
4068
|
signal: a
|
|
4015
4069
|
});
|
|
4016
4070
|
if (!o.ok) {
|
|
4017
|
-
const
|
|
4018
|
-
let
|
|
4071
|
+
const Te = yield o.text();
|
|
4072
|
+
let B;
|
|
4019
4073
|
try {
|
|
4020
|
-
|
|
4021
|
-
} catch (
|
|
4074
|
+
B = JSON.parse(Te);
|
|
4075
|
+
} catch (O) {
|
|
4022
4076
|
}
|
|
4023
|
-
throw ((v =
|
|
4077
|
+
throw ((v = B == null ? void 0 : B.error) == null ? void 0 : v.name) === "ZodError" ? (console.log(
|
|
4078
|
+
"Zod validation error:",
|
|
4079
|
+
JSON.stringify(B.error.issues, null, 2)
|
|
4080
|
+
), new ye({
|
|
4024
4081
|
name: "HTTP error from Anima API",
|
|
4025
4082
|
reason: "Invalid body payload",
|
|
4026
|
-
detail:
|
|
4083
|
+
detail: B.error.issues,
|
|
4027
4084
|
status: o.status
|
|
4028
|
-
}) : typeof
|
|
4029
|
-
name: `Error "${
|
|
4085
|
+
})) : typeof B == "object" ? new ye({
|
|
4086
|
+
name: `Error "${B}"`,
|
|
4030
4087
|
reason: "Unknown",
|
|
4031
4088
|
status: o.status
|
|
4032
|
-
}) : new
|
|
4089
|
+
}) : new ye({
|
|
4033
4090
|
name: "HTTP error from Anima API",
|
|
4034
|
-
reason:
|
|
4091
|
+
reason: Te,
|
|
4035
4092
|
status: o.status
|
|
4036
4093
|
});
|
|
4037
4094
|
}
|
|
4038
4095
|
if (!o.body)
|
|
4039
|
-
throw new
|
|
4096
|
+
throw new ye({
|
|
4040
4097
|
name: "Stream Error",
|
|
4041
4098
|
reason: "Response body is null",
|
|
4042
4099
|
status: o.status
|
|
@@ -4045,19 +4102,19 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
|
|
|
4045
4102
|
let f = "";
|
|
4046
4103
|
try {
|
|
4047
4104
|
for (; ; ) {
|
|
4048
|
-
const { done:
|
|
4049
|
-
if (
|
|
4105
|
+
const { done: Te, value: B } = yield c.read();
|
|
4106
|
+
if (Te)
|
|
4050
4107
|
break;
|
|
4051
|
-
f += d.decode(
|
|
4052
|
-
const
|
|
4108
|
+
f += d.decode(B, { stream: !0 });
|
|
4109
|
+
const O = f.split(`
|
|
4053
4110
|
`);
|
|
4054
|
-
f =
|
|
4055
|
-
for (const
|
|
4056
|
-
if (!(!
|
|
4111
|
+
f = O.pop() || "";
|
|
4112
|
+
for (const ge of O)
|
|
4113
|
+
if (!(!ge.trim() || ge.startsWith(":")) && ge.startsWith("data: ")) {
|
|
4057
4114
|
let k;
|
|
4058
4115
|
try {
|
|
4059
|
-
k = JSON.parse(
|
|
4060
|
-
} catch (
|
|
4116
|
+
k = JSON.parse(ge.slice(6));
|
|
4117
|
+
} catch (D) {
|
|
4061
4118
|
continue;
|
|
4062
4119
|
}
|
|
4063
4120
|
switch (k.type) {
|
|
@@ -4080,11 +4137,11 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
|
|
|
4080
4137
|
break;
|
|
4081
4138
|
}
|
|
4082
4139
|
case "assets_list": {
|
|
4083
|
-
i.assets = k.payload.assets, typeof s == "function" ? s(k) : (
|
|
4140
|
+
i.assets = k.payload.assets, typeof s == "function" ? s(k) : (re = s.onAssetsList) == null || re.call(s, k.payload);
|
|
4084
4141
|
break;
|
|
4085
4142
|
}
|
|
4086
4143
|
case "figma_metadata": {
|
|
4087
|
-
n === "codegen" && (i.figmaFileName = k.figmaFileName, i.figmaSelectedFrameName = k.figmaSelectedFrameName, typeof s == "function" ? s(k) : (
|
|
4144
|
+
n === "codegen" && (i.figmaFileName = k.figmaFileName, i.figmaSelectedFrameName = k.figmaSelectedFrameName, typeof s == "function" ? s(k) : (me = s.onFigmaMetadata) == null || me.call(s, {
|
|
4088
4145
|
figmaFileName: k.figmaFileName,
|
|
4089
4146
|
figmaSelectedFrameName: k.figmaSelectedFrameName
|
|
4090
4147
|
}));
|
|
@@ -4098,38 +4155,39 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
|
|
|
4098
4155
|
});
|
|
4099
4156
|
break;
|
|
4100
4157
|
}
|
|
4158
|
+
case "progress_messages_updated": {
|
|
4159
|
+
typeof s == "function" ? s(k) : (V = s.onProgressMessagesUpdated) == null || V.call(
|
|
4160
|
+
s,
|
|
4161
|
+
k.payload.progressMessages
|
|
4162
|
+
);
|
|
4163
|
+
break;
|
|
4164
|
+
}
|
|
4101
4165
|
case "codegen_completed":
|
|
4102
4166
|
case "generation_completed": {
|
|
4103
|
-
typeof s == "function" ? s(k) : (
|
|
4167
|
+
typeof s == "function" ? s(k) : (de = s.onCodegenCompleted) == null || de.call(s);
|
|
4104
4168
|
break;
|
|
4105
4169
|
}
|
|
4106
4170
|
case "error":
|
|
4107
|
-
throw new
|
|
4171
|
+
throw new ye({
|
|
4108
4172
|
name: k.payload.errorName,
|
|
4109
4173
|
reason: k.payload.reason
|
|
4110
4174
|
});
|
|
4111
|
-
case "done":
|
|
4112
|
-
if (!i.files)
|
|
4113
|
-
throw new de({
|
|
4114
|
-
name: "Invalid response",
|
|
4115
|
-
reason: "No code generated"
|
|
4116
|
-
});
|
|
4175
|
+
case "done":
|
|
4117
4176
|
return i.tokenUsage = k.payload.tokenUsage, i.sessionId = k.payload.sessionId, i;
|
|
4118
|
-
}
|
|
4119
4177
|
}
|
|
4120
4178
|
}
|
|
4121
4179
|
}
|
|
4122
4180
|
} finally {
|
|
4123
4181
|
c.cancel();
|
|
4124
4182
|
}
|
|
4125
|
-
throw new
|
|
4183
|
+
throw new ye({
|
|
4126
4184
|
name: "Connection",
|
|
4127
4185
|
reason: "Connection closed before the 'done' message",
|
|
4128
4186
|
status: 500
|
|
4129
4187
|
});
|
|
4130
4188
|
});
|
|
4131
4189
|
};
|
|
4132
|
-
const
|
|
4190
|
+
const ta = (r) => {
|
|
4133
4191
|
var e;
|
|
4134
4192
|
if (!r)
|
|
4135
4193
|
return [!1, "", ""];
|
|
@@ -4145,7 +4203,7 @@ const ea = (r) => {
|
|
|
4145
4203
|
} catch (t) {
|
|
4146
4204
|
return [!1, "", ""];
|
|
4147
4205
|
}
|
|
4148
|
-
},
|
|
4206
|
+
}, ra = ({
|
|
4149
4207
|
fileKey: r,
|
|
4150
4208
|
nodeId: e,
|
|
4151
4209
|
duplicate: t
|
|
@@ -4153,12 +4211,12 @@ const ea = (r) => {
|
|
|
4153
4211
|
const s = new URL("https://www.figma.com");
|
|
4154
4212
|
return s.pathname = `design/${r}`, t && (s.pathname = `${s.pathname}/dummy/duplicate`), e && s.searchParams.set("node-id", e.replace(":", "-")), s;
|
|
4155
4213
|
};
|
|
4156
|
-
class
|
|
4214
|
+
class sa extends Error {
|
|
4157
4215
|
constructor(e, t) {
|
|
4158
4216
|
super(e), this.response = t;
|
|
4159
4217
|
}
|
|
4160
4218
|
}
|
|
4161
|
-
const
|
|
4219
|
+
const na = ({
|
|
4162
4220
|
files: r,
|
|
4163
4221
|
screenPath: e = "src/screens"
|
|
4164
4222
|
}) => {
|
|
@@ -4207,7 +4265,7 @@ function zn(r, e) {
|
|
|
4207
4265
|
function Bn(r, e) {
|
|
4208
4266
|
return Object.keys(r).filter((t) => t.startsWith(e));
|
|
4209
4267
|
}
|
|
4210
|
-
function
|
|
4268
|
+
function ht(r, e, t) {
|
|
4211
4269
|
return new ReadableStream({
|
|
4212
4270
|
start(s) {
|
|
4213
4271
|
t.call(r, e, (n) => {
|
|
@@ -4235,12 +4293,8 @@ function Pt(r, e, t) {
|
|
|
4235
4293
|
}
|
|
4236
4294
|
});
|
|
4237
4295
|
}
|
|
4238
|
-
const qn = (r, e) =>
|
|
4239
|
-
|
|
4240
|
-
e,
|
|
4241
|
-
r.generateCode
|
|
4242
|
-
);
|
|
4243
|
-
function $t(r) {
|
|
4296
|
+
const qn = (r, e) => ht(r, e, r.generateCode);
|
|
4297
|
+
function pt(r) {
|
|
4244
4298
|
return C(this, null, function* () {
|
|
4245
4299
|
var i, o, c, d;
|
|
4246
4300
|
const [e, t] = r.tee(), s = yield e.getReader().read();
|
|
@@ -4274,52 +4328,49 @@ data: ${JSON.stringify(
|
|
|
4274
4328
|
});
|
|
4275
4329
|
});
|
|
4276
4330
|
}
|
|
4277
|
-
const
|
|
4331
|
+
const aa = (r, e) => C(void 0, null, function* () {
|
|
4278
4332
|
const t = qn(r, e);
|
|
4279
|
-
return
|
|
4280
|
-
}), Hn = (r, e) =>
|
|
4281
|
-
r,
|
|
4282
|
-
e,
|
|
4283
|
-
r.generateCodeFromWebsite
|
|
4284
|
-
), aa = (r, e) => C(void 0, null, function* () {
|
|
4333
|
+
return pt(t);
|
|
4334
|
+
}), Hn = (r, e) => ht(r, e, r.generateCodeFromWebsite), ia = (r, e) => C(void 0, null, function* () {
|
|
4285
4335
|
const t = Hn(r, e);
|
|
4286
|
-
return
|
|
4287
|
-
}), Jn = (r, e) =>
|
|
4288
|
-
r,
|
|
4289
|
-
e,
|
|
4290
|
-
r.generateLink2Code
|
|
4291
|
-
), ia = (r, e) => C(void 0, null, function* () {
|
|
4336
|
+
return pt(t);
|
|
4337
|
+
}), Jn = (r, e) => ht(r, e, r.generateCodeFromPrompt), oa = (r, e) => C(void 0, null, function* () {
|
|
4292
4338
|
const t = Jn(r, e);
|
|
4293
|
-
return
|
|
4339
|
+
return pt(t);
|
|
4340
|
+
}), Gn = (r, e) => ht(r, e, r.generateLink2Code), ca = (r, e) => C(void 0, null, function* () {
|
|
4341
|
+
const t = Gn(r, e);
|
|
4342
|
+
return pt(t);
|
|
4294
4343
|
});
|
|
4295
4344
|
export {
|
|
4296
|
-
|
|
4297
|
-
|
|
4345
|
+
ea as Anima,
|
|
4346
|
+
ye as CodegenError,
|
|
4298
4347
|
Ar as FigmaTokenIssue,
|
|
4299
|
-
|
|
4348
|
+
Or as NotFound,
|
|
4300
4349
|
Cr as RateLimitExceeded,
|
|
4301
|
-
|
|
4302
|
-
|
|
4350
|
+
Ir as RequestTooLarge,
|
|
4351
|
+
sa as ResponseError,
|
|
4303
4352
|
jr as UnknownFigmaApiException,
|
|
4304
|
-
|
|
4353
|
+
oa as createCodeFromPromptResponseEventStream,
|
|
4354
|
+
Jn as createCodeFromPromptStream,
|
|
4355
|
+
ia as createCodeFromWebsiteResponseEventStream,
|
|
4305
4356
|
Hn as createCodeFromWebsiteStream,
|
|
4306
|
-
|
|
4357
|
+
aa as createCodegenResponseEventStream,
|
|
4307
4358
|
qn as createCodegenStream,
|
|
4308
|
-
|
|
4309
|
-
|
|
4359
|
+
ca as createLink2CodeResponseEventStream,
|
|
4360
|
+
Gn as createLink2CodeStream,
|
|
4310
4361
|
ur as findChildrenNode,
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4362
|
+
ra as formatToFigmaLink,
|
|
4363
|
+
Yn as getFigmaApiErrorType,
|
|
4364
|
+
Os as getFigmaFile,
|
|
4365
|
+
Qn as getFileNodes,
|
|
4366
|
+
na as getRelatedScreenFiles,
|
|
4316
4367
|
Zr as isFigmaTokenIssue,
|
|
4317
4368
|
Un as isNodeCodegenCompatible,
|
|
4318
4369
|
Nr as isNotFound,
|
|
4319
4370
|
Rr as isRateLimitExceeded,
|
|
4320
4371
|
Mr as isRequestTooLarge,
|
|
4321
|
-
|
|
4322
|
-
|
|
4372
|
+
Xn as isUnknownFigmaApiException,
|
|
4373
|
+
ta as isValidFigmaUrl,
|
|
4323
4374
|
Vn as validateSettings,
|
|
4324
4375
|
nr as wrapFigmaApiError
|
|
4325
4376
|
};
|