@animaapp/anima-sdk 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +12 -14
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +539 -535
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anima.ts +8 -4
- package/src/types.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writ
|
|
|
14
14
|
return n;
|
|
15
15
|
}, y = (n, e) => hn(n, pn(e));
|
|
16
16
|
var Mt = (n, e, t) => e.has(n) || Zt("Cannot " + t);
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var B = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ct = (n, e, t) => e.has(n) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ut = (n, e, t, s) => (Mt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
|
|
18
|
+
var P = (n, e, t) => new Promise((s, r) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
@@ -31,12 +31,12 @@ var F = (n, e, t) => new Promise((s, r) => {
|
|
|
31
31
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
32
|
o((t = t.apply(n, e)).next());
|
|
33
33
|
});
|
|
34
|
-
class
|
|
34
|
+
class Ae extends Error {
|
|
35
35
|
constructor({ name: e, reason: t, status: s }) {
|
|
36
36
|
super(), this.name = `[Codegen Error] ${e}`, this.message = t, this.status = s;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
var
|
|
39
|
+
var k;
|
|
40
40
|
(function(n) {
|
|
41
41
|
n.assertEqual = (r) => r;
|
|
42
42
|
function e(r) {
|
|
@@ -71,12 +71,12 @@ var x;
|
|
|
71
71
|
return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
72
72
|
}
|
|
73
73
|
n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
74
|
-
})(
|
|
75
|
-
var
|
|
74
|
+
})(k || (k = {}));
|
|
75
|
+
var pt;
|
|
76
76
|
(function(n) {
|
|
77
77
|
n.mergeShapes = (e, t) => u(u({}, e), t);
|
|
78
|
-
})(
|
|
79
|
-
const p =
|
|
78
|
+
})(pt || (pt = {}));
|
|
79
|
+
const p = k.arrayToEnum([
|
|
80
80
|
"string",
|
|
81
81
|
"nan",
|
|
82
82
|
"number",
|
|
@@ -97,7 +97,7 @@ const p = x.arrayToEnum([
|
|
|
97
97
|
"never",
|
|
98
98
|
"map",
|
|
99
99
|
"set"
|
|
100
|
-
]),
|
|
100
|
+
]), ae = (n) => {
|
|
101
101
|
switch (typeof n) {
|
|
102
102
|
case "undefined":
|
|
103
103
|
return p.undefined;
|
|
@@ -118,7 +118,7 @@ const p = x.arrayToEnum([
|
|
|
118
118
|
default:
|
|
119
119
|
return p.unknown;
|
|
120
120
|
}
|
|
121
|
-
}, l =
|
|
121
|
+
}, l = k.arrayToEnum([
|
|
122
122
|
"invalid_type",
|
|
123
123
|
"invalid_literal",
|
|
124
124
|
"custom",
|
|
@@ -180,7 +180,7 @@ class U extends Error {
|
|
|
180
180
|
return this.message;
|
|
181
181
|
}
|
|
182
182
|
get message() {
|
|
183
|
-
return JSON.stringify(this.issues,
|
|
183
|
+
return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
|
|
184
184
|
}
|
|
185
185
|
get isEmpty() {
|
|
186
186
|
return this.issues.length === 0;
|
|
@@ -196,26 +196,26 @@ class U extends Error {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
U.create = (n) => new U(n);
|
|
199
|
-
const
|
|
199
|
+
const ke = (n, e) => {
|
|
200
200
|
let t;
|
|
201
201
|
switch (n.code) {
|
|
202
202
|
case l.invalid_type:
|
|
203
203
|
n.received === p.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
204
204
|
break;
|
|
205
205
|
case l.invalid_literal:
|
|
206
|
-
t = `Invalid literal value, expected ${JSON.stringify(n.expected,
|
|
206
|
+
t = `Invalid literal value, expected ${JSON.stringify(n.expected, k.jsonStringifyReplacer)}`;
|
|
207
207
|
break;
|
|
208
208
|
case l.unrecognized_keys:
|
|
209
|
-
t = `Unrecognized key(s) in object: ${
|
|
209
|
+
t = `Unrecognized key(s) in object: ${k.joinValues(n.keys, ", ")}`;
|
|
210
210
|
break;
|
|
211
211
|
case l.invalid_union:
|
|
212
212
|
t = "Invalid input";
|
|
213
213
|
break;
|
|
214
214
|
case l.invalid_union_discriminator:
|
|
215
|
-
t = `Invalid discriminator value. Expected ${
|
|
215
|
+
t = `Invalid discriminator value. Expected ${k.joinValues(n.options)}`;
|
|
216
216
|
break;
|
|
217
217
|
case l.invalid_enum_value:
|
|
218
|
-
t = `Invalid enum value. Expected ${
|
|
218
|
+
t = `Invalid enum value. Expected ${k.joinValues(n.options)}, received '${n.received}'`;
|
|
219
219
|
break;
|
|
220
220
|
case l.invalid_arguments:
|
|
221
221
|
t = "Invalid function arguments";
|
|
@@ -227,7 +227,7 @@ const Te = (n, e) => {
|
|
|
227
227
|
t = "Invalid date";
|
|
228
228
|
break;
|
|
229
229
|
case l.invalid_string:
|
|
230
|
-
typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` :
|
|
230
|
+
typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : k.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
|
|
231
231
|
break;
|
|
232
232
|
case l.too_small:
|
|
233
233
|
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
|
|
@@ -248,11 +248,11 @@ const Te = (n, e) => {
|
|
|
248
248
|
t = "Number must be finite";
|
|
249
249
|
break;
|
|
250
250
|
default:
|
|
251
|
-
t = e.defaultError,
|
|
251
|
+
t = e.defaultError, k.assertNever(n);
|
|
252
252
|
}
|
|
253
253
|
return { message: t };
|
|
254
254
|
};
|
|
255
|
-
let qt =
|
|
255
|
+
let qt = ke;
|
|
256
256
|
function vn(n) {
|
|
257
257
|
qt = n;
|
|
258
258
|
}
|
|
@@ -289,7 +289,7 @@ function h(n, e) {
|
|
|
289
289
|
// then schema-bound map if available
|
|
290
290
|
t,
|
|
291
291
|
// then global override map
|
|
292
|
-
t ===
|
|
292
|
+
t === ke ? void 0 : ke
|
|
293
293
|
// then global default map
|
|
294
294
|
].filter((r) => !!r)
|
|
295
295
|
});
|
|
@@ -315,7 +315,7 @@ class R {
|
|
|
315
315
|
return { status: e.value, value: s };
|
|
316
316
|
}
|
|
317
317
|
static mergeObjectAsync(e, t) {
|
|
318
|
-
return
|
|
318
|
+
return P(this, null, function* () {
|
|
319
319
|
const s = [];
|
|
320
320
|
for (const r of t) {
|
|
321
321
|
const a = yield r.key, i = yield r.value;
|
|
@@ -340,7 +340,7 @@ class R {
|
|
|
340
340
|
}
|
|
341
341
|
const v = Object.freeze({
|
|
342
342
|
status: "aborted"
|
|
343
|
-
}),
|
|
343
|
+
}), we = (n) => ({ status: "dirty", value: n }), $ = (n) => ({ status: "valid", value: n }), mt = (n) => n.status === "aborted", yt = (n) => n.status === "dirty", ye = (n) => n.status === "valid", Ze = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
344
344
|
function tt(n, e, t, s) {
|
|
345
345
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
346
346
|
return e.get(n);
|
|
@@ -353,8 +353,8 @@ var m;
|
|
|
353
353
|
(function(n) {
|
|
354
354
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
355
355
|
})(m || (m = {}));
|
|
356
|
-
var
|
|
357
|
-
class
|
|
356
|
+
var Ce, Ie;
|
|
357
|
+
class Q {
|
|
358
358
|
constructor(e, t, s, r) {
|
|
359
359
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
|
|
360
360
|
}
|
|
@@ -363,7 +363,7 @@ class te {
|
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
const $t = (n, e) => {
|
|
366
|
-
if (
|
|
366
|
+
if (ye(e))
|
|
367
367
|
return { success: !0, data: e.value };
|
|
368
368
|
if (!n.common.issues.length)
|
|
369
369
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -377,7 +377,7 @@ const $t = (n, e) => {
|
|
|
377
377
|
}
|
|
378
378
|
};
|
|
379
379
|
};
|
|
380
|
-
function
|
|
380
|
+
function w(n) {
|
|
381
381
|
if (!n)
|
|
382
382
|
return {};
|
|
383
383
|
const { errorMap: e, invalid_type_error: t, required_error: s, description: r } = n;
|
|
@@ -389,18 +389,18 @@ function b(n) {
|
|
|
389
389
|
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = f != null ? f : t) !== null && d !== void 0 ? d : o.defaultError };
|
|
390
390
|
}, description: r };
|
|
391
391
|
}
|
|
392
|
-
class
|
|
392
|
+
class x {
|
|
393
393
|
get description() {
|
|
394
394
|
return this._def.description;
|
|
395
395
|
}
|
|
396
396
|
_getType(e) {
|
|
397
|
-
return
|
|
397
|
+
return ae(e.data);
|
|
398
398
|
}
|
|
399
399
|
_getOrReturnCtx(e, t) {
|
|
400
400
|
return t || {
|
|
401
401
|
common: e.parent.common,
|
|
402
402
|
data: e.data,
|
|
403
|
-
parsedType:
|
|
403
|
+
parsedType: ae(e.data),
|
|
404
404
|
schemaErrorMap: this._def.errorMap,
|
|
405
405
|
path: e.path,
|
|
406
406
|
parent: e.parent
|
|
@@ -412,7 +412,7 @@ class w {
|
|
|
412
412
|
ctx: {
|
|
413
413
|
common: e.parent.common,
|
|
414
414
|
data: e.data,
|
|
415
|
-
parsedType:
|
|
415
|
+
parsedType: ae(e.data),
|
|
416
416
|
schemaErrorMap: this._def.errorMap,
|
|
417
417
|
path: e.path,
|
|
418
418
|
parent: e.parent
|
|
@@ -421,7 +421,7 @@ class w {
|
|
|
421
421
|
}
|
|
422
422
|
_parseSync(e) {
|
|
423
423
|
const t = this._parse(e);
|
|
424
|
-
if (
|
|
424
|
+
if (Ze(t))
|
|
425
425
|
throw new Error("Synchronous parse encountered promise.");
|
|
426
426
|
return t;
|
|
427
427
|
}
|
|
@@ -447,7 +447,7 @@ class w {
|
|
|
447
447
|
schemaErrorMap: this._def.errorMap,
|
|
448
448
|
parent: null,
|
|
449
449
|
data: e,
|
|
450
|
-
parsedType:
|
|
450
|
+
parsedType: ae(e)
|
|
451
451
|
}, a = this._parseSync({ data: e, path: r.path, parent: r });
|
|
452
452
|
return $t(r, a);
|
|
453
453
|
}
|
|
@@ -462,12 +462,12 @@ class w {
|
|
|
462
462
|
schemaErrorMap: this._def.errorMap,
|
|
463
463
|
parent: null,
|
|
464
464
|
data: e,
|
|
465
|
-
parsedType:
|
|
465
|
+
parsedType: ae(e)
|
|
466
466
|
};
|
|
467
467
|
if (!this["~standard"].async)
|
|
468
468
|
try {
|
|
469
469
|
const a = this._parseSync({ data: e, path: [], parent: r });
|
|
470
|
-
return
|
|
470
|
+
return ye(a) ? {
|
|
471
471
|
value: a.value
|
|
472
472
|
} : {
|
|
473
473
|
issues: r.common.issues
|
|
@@ -478,14 +478,14 @@ class w {
|
|
|
478
478
|
async: !0
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
-
return this._parseAsync({ data: e, path: [], parent: r }).then((a) =>
|
|
481
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((a) => ye(a) ? {
|
|
482
482
|
value: a.value
|
|
483
483
|
} : {
|
|
484
484
|
issues: r.common.issues
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
parseAsync(e, t) {
|
|
488
|
-
return
|
|
488
|
+
return P(this, null, function* () {
|
|
489
489
|
const s = yield this.safeParseAsync(e, t);
|
|
490
490
|
if (s.success)
|
|
491
491
|
return s.data;
|
|
@@ -493,7 +493,7 @@ class w {
|
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
safeParseAsync(e, t) {
|
|
496
|
-
return
|
|
496
|
+
return P(this, null, function* () {
|
|
497
497
|
const s = {
|
|
498
498
|
common: {
|
|
499
499
|
issues: [],
|
|
@@ -504,8 +504,8 @@ class w {
|
|
|
504
504
|
schemaErrorMap: this._def.errorMap,
|
|
505
505
|
parent: null,
|
|
506
506
|
data: e,
|
|
507
|
-
parsedType:
|
|
508
|
-
}, r = this._parse({ data: e, path: s.path, parent: s }), a = yield
|
|
507
|
+
parsedType: ae(e)
|
|
508
|
+
}, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Ze(r) ? r : Promise.resolve(r);
|
|
509
509
|
return $t(s, a);
|
|
510
510
|
});
|
|
511
511
|
}
|
|
@@ -522,7 +522,7 @@ class w {
|
|
|
522
522
|
return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
|
|
523
523
|
}
|
|
524
524
|
_refinement(e) {
|
|
525
|
-
return new
|
|
525
|
+
return new J({
|
|
526
526
|
schema: this,
|
|
527
527
|
typeName: g.ZodEffects,
|
|
528
528
|
effect: { type: "refinement", refinement: e }
|
|
@@ -539,28 +539,28 @@ class w {
|
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
541
|
optional() {
|
|
542
|
-
return
|
|
542
|
+
return Y.create(this, this._def);
|
|
543
543
|
}
|
|
544
544
|
nullable() {
|
|
545
|
-
return
|
|
545
|
+
return fe.create(this, this._def);
|
|
546
546
|
}
|
|
547
547
|
nullish() {
|
|
548
548
|
return this.nullable().optional();
|
|
549
549
|
}
|
|
550
550
|
array() {
|
|
551
|
-
return
|
|
551
|
+
return H.create(this);
|
|
552
552
|
}
|
|
553
553
|
promise() {
|
|
554
|
-
return
|
|
554
|
+
return Se.create(this, this._def);
|
|
555
555
|
}
|
|
556
556
|
or(e) {
|
|
557
|
-
return
|
|
557
|
+
return Fe.create([this, e], this._def);
|
|
558
558
|
}
|
|
559
559
|
and(e) {
|
|
560
|
-
return
|
|
560
|
+
return Le.create(this, e, this._def);
|
|
561
561
|
}
|
|
562
562
|
transform(e) {
|
|
563
|
-
return new
|
|
563
|
+
return new J(y(u({}, w(this._def)), {
|
|
564
564
|
schema: this,
|
|
565
565
|
typeName: g.ZodEffects,
|
|
566
566
|
effect: { type: "transform", transform: e }
|
|
@@ -568,21 +568,21 @@ class w {
|
|
|
568
568
|
}
|
|
569
569
|
default(e) {
|
|
570
570
|
const t = typeof e == "function" ? e : () => e;
|
|
571
|
-
return new
|
|
571
|
+
return new We(y(u({}, w(this._def)), {
|
|
572
572
|
innerType: this,
|
|
573
573
|
defaultValue: t,
|
|
574
574
|
typeName: g.ZodDefault
|
|
575
575
|
}));
|
|
576
576
|
}
|
|
577
577
|
brand() {
|
|
578
|
-
return new
|
|
578
|
+
return new At(u({
|
|
579
579
|
typeName: g.ZodBranded,
|
|
580
580
|
type: this
|
|
581
|
-
},
|
|
581
|
+
}, w(this._def)));
|
|
582
582
|
}
|
|
583
583
|
catch(e) {
|
|
584
584
|
const t = typeof e == "function" ? e : () => e;
|
|
585
|
-
return new
|
|
585
|
+
return new Be(y(u({}, w(this._def)), {
|
|
586
586
|
innerType: this,
|
|
587
587
|
catchValue: t,
|
|
588
588
|
typeName: g.ZodCatch
|
|
@@ -595,10 +595,10 @@ class w {
|
|
|
595
595
|
}));
|
|
596
596
|
}
|
|
597
597
|
pipe(e) {
|
|
598
|
-
return
|
|
598
|
+
return Je.create(this, e);
|
|
599
599
|
}
|
|
600
600
|
readonly() {
|
|
601
|
-
return
|
|
601
|
+
return qe.create(this);
|
|
602
602
|
}
|
|
603
603
|
isOptional() {
|
|
604
604
|
return this.safeParse(void 0).success;
|
|
@@ -608,7 +608,7 @@ class w {
|
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, En = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, An = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
611
|
-
let
|
|
611
|
+
let dt;
|
|
612
612
|
const Cn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, In = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Nn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, jn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Mn = new RegExp(`^${Jt}$`);
|
|
613
613
|
function Gt(n) {
|
|
614
614
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
@@ -638,7 +638,7 @@ function Fn(n, e) {
|
|
|
638
638
|
function Ln(n, e) {
|
|
639
639
|
return !!((e === "v4" || !e) && In.test(n) || (e === "v6" || !e) && jn.test(n));
|
|
640
640
|
}
|
|
641
|
-
class
|
|
641
|
+
class q extends x {
|
|
642
642
|
_parse(e) {
|
|
643
643
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
644
644
|
const a = this._getOrReturnCtx(e);
|
|
@@ -693,7 +693,7 @@ class H extends w {
|
|
|
693
693
|
message: a.message
|
|
694
694
|
}), s.dirty());
|
|
695
695
|
else if (a.kind === "emoji")
|
|
696
|
-
|
|
696
|
+
dt || (dt = new RegExp(On, "u")), dt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
697
697
|
validation: "emoji",
|
|
698
698
|
code: l.invalid_string,
|
|
699
699
|
message: a.message
|
|
@@ -790,7 +790,7 @@ class H extends w {
|
|
|
790
790
|
validation: "base64url",
|
|
791
791
|
code: l.invalid_string,
|
|
792
792
|
message: a.message
|
|
793
|
-
}), s.dirty()) :
|
|
793
|
+
}), s.dirty()) : k.assertNever(a);
|
|
794
794
|
return { status: s.value, value: e.data };
|
|
795
795
|
}
|
|
796
796
|
_regex(e, t, s) {
|
|
@@ -800,7 +800,7 @@ class H extends w {
|
|
|
800
800
|
}, m.errToObj(s)));
|
|
801
801
|
}
|
|
802
802
|
_addCheck(e) {
|
|
803
|
-
return new
|
|
803
|
+
return new q(y(u({}, this._def), {
|
|
804
804
|
checks: [...this._def.checks, e]
|
|
805
805
|
}));
|
|
806
806
|
}
|
|
@@ -926,17 +926,17 @@ class H extends w {
|
|
|
926
926
|
return this.min(1, m.errToObj(e));
|
|
927
927
|
}
|
|
928
928
|
trim() {
|
|
929
|
-
return new
|
|
929
|
+
return new q(y(u({}, this._def), {
|
|
930
930
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
931
931
|
}));
|
|
932
932
|
}
|
|
933
933
|
toLowerCase() {
|
|
934
|
-
return new
|
|
934
|
+
return new q(y(u({}, this._def), {
|
|
935
935
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
936
936
|
}));
|
|
937
937
|
}
|
|
938
938
|
toUpperCase() {
|
|
939
|
-
return new
|
|
939
|
+
return new q(y(u({}, this._def), {
|
|
940
940
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
941
941
|
}));
|
|
942
942
|
}
|
|
@@ -1001,19 +1001,19 @@ class H extends w {
|
|
|
1001
1001
|
return e;
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1004
|
+
q.create = (n) => {
|
|
1005
1005
|
var e;
|
|
1006
|
-
return new
|
|
1006
|
+
return new q(u({
|
|
1007
1007
|
checks: [],
|
|
1008
1008
|
typeName: g.ZodString,
|
|
1009
1009
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
|
|
1010
|
-
},
|
|
1010
|
+
}, w(n)));
|
|
1011
1011
|
};
|
|
1012
1012
|
function Dn(n, e) {
|
|
1013
1013
|
const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = parseInt(n.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
|
|
1014
1014
|
return a % i / Math.pow(10, r);
|
|
1015
1015
|
}
|
|
1016
|
-
class
|
|
1016
|
+
class ue extends x {
|
|
1017
1017
|
constructor() {
|
|
1018
1018
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1019
1019
|
}
|
|
@@ -1029,7 +1029,7 @@ class de extends w {
|
|
|
1029
1029
|
let s;
|
|
1030
1030
|
const r = new R();
|
|
1031
1031
|
for (const a of this._def.checks)
|
|
1032
|
-
a.kind === "int" ?
|
|
1032
|
+
a.kind === "int" ? k.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1033
1033
|
code: l.invalid_type,
|
|
1034
1034
|
expected: "integer",
|
|
1035
1035
|
received: "float",
|
|
@@ -1055,7 +1055,7 @@ class de extends w {
|
|
|
1055
1055
|
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1056
1056
|
code: l.not_finite,
|
|
1057
1057
|
message: a.message
|
|
1058
|
-
}), r.dirty()) :
|
|
1058
|
+
}), r.dirty()) : k.assertNever(a);
|
|
1059
1059
|
return { status: r.value, value: e.data };
|
|
1060
1060
|
}
|
|
1061
1061
|
gte(e, t) {
|
|
@@ -1071,7 +1071,7 @@ class de extends w {
|
|
|
1071
1071
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1072
1072
|
}
|
|
1073
1073
|
setLimit(e, t, s, r) {
|
|
1074
|
-
return new
|
|
1074
|
+
return new ue(y(u({}, this._def), {
|
|
1075
1075
|
checks: [
|
|
1076
1076
|
...this._def.checks,
|
|
1077
1077
|
{
|
|
@@ -1084,7 +1084,7 @@ class de extends w {
|
|
|
1084
1084
|
}));
|
|
1085
1085
|
}
|
|
1086
1086
|
_addCheck(e) {
|
|
1087
|
-
return new
|
|
1087
|
+
return new ue(y(u({}, this._def), {
|
|
1088
1088
|
checks: [...this._def.checks, e]
|
|
1089
1089
|
}));
|
|
1090
1090
|
}
|
|
@@ -1165,7 +1165,7 @@ class de extends w {
|
|
|
1165
1165
|
return e;
|
|
1166
1166
|
}
|
|
1167
1167
|
get isInt() {
|
|
1168
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1168
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
|
|
1169
1169
|
}
|
|
1170
1170
|
get isFinite() {
|
|
1171
1171
|
let e = null, t = null;
|
|
@@ -1177,12 +1177,12 @@ class de extends w {
|
|
|
1177
1177
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
|
-
|
|
1180
|
+
ue.create = (n) => new ue(u({
|
|
1181
1181
|
checks: [],
|
|
1182
1182
|
typeName: g.ZodNumber,
|
|
1183
1183
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
1184
|
-
},
|
|
1185
|
-
class
|
|
1184
|
+
}, w(n)));
|
|
1185
|
+
class de extends x {
|
|
1186
1186
|
constructor() {
|
|
1187
1187
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1188
1188
|
}
|
|
@@ -1214,7 +1214,7 @@ class le extends w {
|
|
|
1214
1214
|
code: l.not_multiple_of,
|
|
1215
1215
|
multipleOf: a.value,
|
|
1216
1216
|
message: a.message
|
|
1217
|
-
}), r.dirty()) :
|
|
1217
|
+
}), r.dirty()) : k.assertNever(a);
|
|
1218
1218
|
return { status: r.value, value: e.data };
|
|
1219
1219
|
}
|
|
1220
1220
|
_getInvalidInput(e) {
|
|
@@ -1238,7 +1238,7 @@ class le extends w {
|
|
|
1238
1238
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1239
1239
|
}
|
|
1240
1240
|
setLimit(e, t, s, r) {
|
|
1241
|
-
return new
|
|
1241
|
+
return new de(y(u({}, this._def), {
|
|
1242
1242
|
checks: [
|
|
1243
1243
|
...this._def.checks,
|
|
1244
1244
|
{
|
|
@@ -1251,7 +1251,7 @@ class le extends w {
|
|
|
1251
1251
|
}));
|
|
1252
1252
|
}
|
|
1253
1253
|
_addCheck(e) {
|
|
1254
|
-
return new
|
|
1254
|
+
return new de(y(u({}, this._def), {
|
|
1255
1255
|
checks: [...this._def.checks, e]
|
|
1256
1256
|
}));
|
|
1257
1257
|
}
|
|
@@ -1307,15 +1307,15 @@ class le extends w {
|
|
|
1307
1307
|
return e;
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
|
-
|
|
1310
|
+
de.create = (n) => {
|
|
1311
1311
|
var e;
|
|
1312
|
-
return new
|
|
1312
|
+
return new de(u({
|
|
1313
1313
|
checks: [],
|
|
1314
1314
|
typeName: g.ZodBigInt,
|
|
1315
1315
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
|
|
1316
|
-
},
|
|
1316
|
+
}, w(n)));
|
|
1317
1317
|
};
|
|
1318
|
-
class
|
|
1318
|
+
class Me extends x {
|
|
1319
1319
|
_parse(e) {
|
|
1320
1320
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1321
1321
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1328,11 +1328,11 @@ class $e extends w {
|
|
|
1328
1328
|
return $(e.data);
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
|
-
|
|
1331
|
+
Me.create = (n) => new Me(u({
|
|
1332
1332
|
typeName: g.ZodBoolean,
|
|
1333
1333
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
1334
|
-
},
|
|
1335
|
-
class
|
|
1334
|
+
}, w(n)));
|
|
1335
|
+
class ge extends x {
|
|
1336
1336
|
_parse(e) {
|
|
1337
1337
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1338
1338
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1365,14 +1365,14 @@ class ve extends w {
|
|
|
1365
1365
|
exact: !1,
|
|
1366
1366
|
maximum: a.value,
|
|
1367
1367
|
type: "date"
|
|
1368
|
-
}), s.dirty()) :
|
|
1368
|
+
}), s.dirty()) : k.assertNever(a);
|
|
1369
1369
|
return {
|
|
1370
1370
|
status: s.value,
|
|
1371
1371
|
value: new Date(e.data.getTime())
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
1374
|
_addCheck(e) {
|
|
1375
|
-
return new
|
|
1375
|
+
return new ge(y(u({}, this._def), {
|
|
1376
1376
|
checks: [...this._def.checks, e]
|
|
1377
1377
|
}));
|
|
1378
1378
|
}
|
|
@@ -1403,12 +1403,12 @@ class ve extends w {
|
|
|
1403
1403
|
return e != null ? new Date(e) : null;
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1406
|
+
ge.create = (n) => new ge(u({
|
|
1407
1407
|
checks: [],
|
|
1408
1408
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1409
1409
|
typeName: g.ZodDate
|
|
1410
|
-
},
|
|
1411
|
-
class nt extends
|
|
1410
|
+
}, w(n)));
|
|
1411
|
+
class nt extends x {
|
|
1412
1412
|
_parse(e) {
|
|
1413
1413
|
if (this._getType(e) !== p.symbol) {
|
|
1414
1414
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1423,8 +1423,8 @@ class nt extends w {
|
|
|
1423
1423
|
}
|
|
1424
1424
|
nt.create = (n) => new nt(u({
|
|
1425
1425
|
typeName: g.ZodSymbol
|
|
1426
|
-
},
|
|
1427
|
-
class
|
|
1426
|
+
}, w(n)));
|
|
1427
|
+
class $e extends x {
|
|
1428
1428
|
_parse(e) {
|
|
1429
1429
|
if (this._getType(e) !== p.undefined) {
|
|
1430
1430
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1437,10 +1437,10 @@ class Pe extends w {
|
|
|
1437
1437
|
return $(e.data);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
|
|
1440
|
+
$e.create = (n) => new $e(u({
|
|
1441
1441
|
typeName: g.ZodUndefined
|
|
1442
|
-
},
|
|
1443
|
-
class
|
|
1442
|
+
}, w(n)));
|
|
1443
|
+
class Pe extends x {
|
|
1444
1444
|
_parse(e) {
|
|
1445
1445
|
if (this._getType(e) !== p.null) {
|
|
1446
1446
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1453,10 +1453,10 @@ class Fe extends w {
|
|
|
1453
1453
|
return $(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
|
|
1456
|
+
Pe.create = (n) => new Pe(u({
|
|
1457
1457
|
typeName: g.ZodNull
|
|
1458
|
-
},
|
|
1459
|
-
class
|
|
1458
|
+
}, w(n)));
|
|
1459
|
+
class Te extends x {
|
|
1460
1460
|
constructor() {
|
|
1461
1461
|
super(...arguments), this._any = !0;
|
|
1462
1462
|
}
|
|
@@ -1464,10 +1464,10 @@ class Se extends w {
|
|
|
1464
1464
|
return $(e.data);
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
|
|
1467
|
+
Te.create = (n) => new Te(u({
|
|
1468
1468
|
typeName: g.ZodAny
|
|
1469
|
-
},
|
|
1470
|
-
class
|
|
1469
|
+
}, w(n)));
|
|
1470
|
+
class me extends x {
|
|
1471
1471
|
constructor() {
|
|
1472
1472
|
super(...arguments), this._unknown = !0;
|
|
1473
1473
|
}
|
|
@@ -1475,10 +1475,10 @@ class ye extends w {
|
|
|
1475
1475
|
return $(e.data);
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
1478
|
-
|
|
1478
|
+
me.create = (n) => new me(u({
|
|
1479
1479
|
typeName: g.ZodUnknown
|
|
1480
|
-
},
|
|
1481
|
-
class
|
|
1480
|
+
}, w(n)));
|
|
1481
|
+
class ie extends x {
|
|
1482
1482
|
_parse(e) {
|
|
1483
1483
|
const t = this._getOrReturnCtx(e);
|
|
1484
1484
|
return h(t, {
|
|
@@ -1488,10 +1488,10 @@ class oe extends w {
|
|
|
1488
1488
|
}), v;
|
|
1489
1489
|
}
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1491
|
+
ie.create = (n) => new ie(u({
|
|
1492
1492
|
typeName: g.ZodNever
|
|
1493
|
-
},
|
|
1494
|
-
class st extends
|
|
1493
|
+
}, w(n)));
|
|
1494
|
+
class st extends x {
|
|
1495
1495
|
_parse(e) {
|
|
1496
1496
|
if (this._getType(e) !== p.undefined) {
|
|
1497
1497
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1506,8 +1506,8 @@ class st extends w {
|
|
|
1506
1506
|
}
|
|
1507
1507
|
st.create = (n) => new st(u({
|
|
1508
1508
|
typeName: g.ZodVoid
|
|
1509
|
-
},
|
|
1510
|
-
class
|
|
1509
|
+
}, w(n)));
|
|
1510
|
+
class H extends x {
|
|
1511
1511
|
_parse(e) {
|
|
1512
1512
|
const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
|
|
1513
1513
|
if (t.parsedType !== p.array)
|
|
@@ -1543,25 +1543,25 @@ class J extends w {
|
|
|
1543
1543
|
exact: !1,
|
|
1544
1544
|
message: r.maxLength.message
|
|
1545
1545
|
}), s.dirty()), t.common.async)
|
|
1546
|
-
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new
|
|
1547
|
-
const a = [...t.data].map((i, o) => r.type._parseSync(new
|
|
1546
|
+
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new Q(t, i, t.path, o)))).then((i) => R.mergeArray(s, i));
|
|
1547
|
+
const a = [...t.data].map((i, o) => r.type._parseSync(new Q(t, i, t.path, o)));
|
|
1548
1548
|
return R.mergeArray(s, a);
|
|
1549
1549
|
}
|
|
1550
1550
|
get element() {
|
|
1551
1551
|
return this._def.type;
|
|
1552
1552
|
}
|
|
1553
1553
|
min(e, t) {
|
|
1554
|
-
return new
|
|
1554
|
+
return new H(y(u({}, this._def), {
|
|
1555
1555
|
minLength: { value: e, message: m.toString(t) }
|
|
1556
1556
|
}));
|
|
1557
1557
|
}
|
|
1558
1558
|
max(e, t) {
|
|
1559
|
-
return new
|
|
1559
|
+
return new H(y(u({}, this._def), {
|
|
1560
1560
|
maxLength: { value: e, message: m.toString(t) }
|
|
1561
1561
|
}));
|
|
1562
1562
|
}
|
|
1563
1563
|
length(e, t) {
|
|
1564
|
-
return new
|
|
1564
|
+
return new H(y(u({}, this._def), {
|
|
1565
1565
|
exactLength: { value: e, message: m.toString(t) }
|
|
1566
1566
|
}));
|
|
1567
1567
|
}
|
|
@@ -1569,35 +1569,35 @@ class J extends w {
|
|
|
1569
1569
|
return this.min(1, e);
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
|
|
1572
|
+
H.create = (n, e) => new H(u({
|
|
1573
1573
|
type: n,
|
|
1574
1574
|
minLength: null,
|
|
1575
1575
|
maxLength: null,
|
|
1576
1576
|
exactLength: null,
|
|
1577
1577
|
typeName: g.ZodArray
|
|
1578
|
-
},
|
|
1579
|
-
function
|
|
1578
|
+
}, w(e)));
|
|
1579
|
+
function be(n) {
|
|
1580
1580
|
if (n instanceof S) {
|
|
1581
1581
|
const e = {};
|
|
1582
1582
|
for (const t in n.shape) {
|
|
1583
1583
|
const s = n.shape[t];
|
|
1584
|
-
e[t] =
|
|
1584
|
+
e[t] = Y.create(be(s));
|
|
1585
1585
|
}
|
|
1586
1586
|
return new S(y(u({}, n._def), {
|
|
1587
1587
|
shape: () => e
|
|
1588
1588
|
}));
|
|
1589
|
-
} else return n instanceof
|
|
1590
|
-
type:
|
|
1591
|
-
})) : n instanceof
|
|
1589
|
+
} else return n instanceof H ? new H(y(u({}, n._def), {
|
|
1590
|
+
type: be(n.element)
|
|
1591
|
+
})) : n instanceof Y ? Y.create(be(n.unwrap())) : n instanceof fe ? fe.create(be(n.unwrap())) : n instanceof ee ? ee.create(n.items.map((e) => be(e))) : n;
|
|
1592
1592
|
}
|
|
1593
|
-
class S extends
|
|
1593
|
+
class S extends x {
|
|
1594
1594
|
constructor() {
|
|
1595
1595
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1596
1596
|
}
|
|
1597
1597
|
_getCached() {
|
|
1598
1598
|
if (this._cached !== null)
|
|
1599
1599
|
return this._cached;
|
|
1600
|
-
const e = this._def.shape(), t =
|
|
1600
|
+
const e = this._def.shape(), t = k.objectKeys(e);
|
|
1601
1601
|
return this._cached = { shape: e, keys: t };
|
|
1602
1602
|
}
|
|
1603
1603
|
_parse(e) {
|
|
@@ -1610,7 +1610,7 @@ class S extends w {
|
|
|
1610
1610
|
}), v;
|
|
1611
1611
|
}
|
|
1612
1612
|
const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1613
|
-
if (!(this._def.catchall instanceof
|
|
1613
|
+
if (!(this._def.catchall instanceof ie && this._def.unknownKeys === "strip"))
|
|
1614
1614
|
for (const d in r.data)
|
|
1615
1615
|
i.includes(d) || o.push(d);
|
|
1616
1616
|
const c = [];
|
|
@@ -1618,11 +1618,11 @@ class S extends w {
|
|
|
1618
1618
|
const f = a[d], _ = r.data[d];
|
|
1619
1619
|
c.push({
|
|
1620
1620
|
key: { status: "valid", value: d },
|
|
1621
|
-
value: f._parse(new
|
|
1621
|
+
value: f._parse(new Q(r, _, r.path, d)),
|
|
1622
1622
|
alwaysSet: d in r.data
|
|
1623
1623
|
});
|
|
1624
1624
|
}
|
|
1625
|
-
if (this._def.catchall instanceof
|
|
1625
|
+
if (this._def.catchall instanceof ie) {
|
|
1626
1626
|
const d = this._def.unknownKeys;
|
|
1627
1627
|
if (d === "passthrough")
|
|
1628
1628
|
for (const f of o)
|
|
@@ -1643,20 +1643,20 @@ class S extends w {
|
|
|
1643
1643
|
c.push({
|
|
1644
1644
|
key: { status: "valid", value: f },
|
|
1645
1645
|
value: d._parse(
|
|
1646
|
-
new
|
|
1646
|
+
new Q(r, _, r.path, f)
|
|
1647
1647
|
//, ctx.child(key), value, getParsedType(value)
|
|
1648
1648
|
),
|
|
1649
1649
|
alwaysSet: f in r.data
|
|
1650
1650
|
});
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
|
-
return r.common.async ? Promise.resolve().then(() =>
|
|
1653
|
+
return r.common.async ? Promise.resolve().then(() => P(this, null, function* () {
|
|
1654
1654
|
const d = [];
|
|
1655
1655
|
for (const f of c) {
|
|
1656
|
-
const _ = yield f.key,
|
|
1656
|
+
const _ = yield f.key, I = yield f.value;
|
|
1657
1657
|
d.push({
|
|
1658
1658
|
key: _,
|
|
1659
|
-
value:
|
|
1659
|
+
value: I,
|
|
1660
1660
|
alwaysSet: f.alwaysSet
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
@@ -1792,7 +1792,7 @@ class S extends w {
|
|
|
1792
1792
|
}
|
|
1793
1793
|
pick(e) {
|
|
1794
1794
|
const t = {};
|
|
1795
|
-
return
|
|
1795
|
+
return k.objectKeys(e).forEach((s) => {
|
|
1796
1796
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
1797
1797
|
}), new S(y(u({}, this._def), {
|
|
1798
1798
|
shape: () => t
|
|
@@ -1800,7 +1800,7 @@ class S extends w {
|
|
|
1800
1800
|
}
|
|
1801
1801
|
omit(e) {
|
|
1802
1802
|
const t = {};
|
|
1803
|
-
return
|
|
1803
|
+
return k.objectKeys(this.shape).forEach((s) => {
|
|
1804
1804
|
e[s] || (t[s] = this.shape[s]);
|
|
1805
1805
|
}), new S(y(u({}, this._def), {
|
|
1806
1806
|
shape: () => t
|
|
@@ -1810,11 +1810,11 @@ class S extends w {
|
|
|
1810
1810
|
* @deprecated
|
|
1811
1811
|
*/
|
|
1812
1812
|
deepPartial() {
|
|
1813
|
-
return
|
|
1813
|
+
return be(this);
|
|
1814
1814
|
}
|
|
1815
1815
|
partial(e) {
|
|
1816
1816
|
const t = {};
|
|
1817
|
-
return
|
|
1817
|
+
return k.objectKeys(this.shape).forEach((s) => {
|
|
1818
1818
|
const r = this.shape[s];
|
|
1819
1819
|
e && !e[s] ? t[s] = r : t[s] = r.optional();
|
|
1820
1820
|
}), new S(y(u({}, this._def), {
|
|
@@ -1823,12 +1823,12 @@ class S extends w {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
required(e) {
|
|
1825
1825
|
const t = {};
|
|
1826
|
-
return
|
|
1826
|
+
return k.objectKeys(this.shape).forEach((s) => {
|
|
1827
1827
|
if (e && !e[s])
|
|
1828
1828
|
t[s] = this.shape[s];
|
|
1829
1829
|
else {
|
|
1830
1830
|
let a = this.shape[s];
|
|
1831
|
-
for (; a instanceof
|
|
1831
|
+
for (; a instanceof Y; )
|
|
1832
1832
|
a = a._def.innerType;
|
|
1833
1833
|
t[s] = a;
|
|
1834
1834
|
}
|
|
@@ -1837,28 +1837,28 @@ class S extends w {
|
|
|
1837
1837
|
}));
|
|
1838
1838
|
}
|
|
1839
1839
|
keyof() {
|
|
1840
|
-
return Xt(
|
|
1840
|
+
return Xt(k.objectKeys(this.shape));
|
|
1841
1841
|
}
|
|
1842
1842
|
}
|
|
1843
1843
|
S.create = (n, e) => new S(u({
|
|
1844
1844
|
shape: () => n,
|
|
1845
1845
|
unknownKeys: "strip",
|
|
1846
|
-
catchall:
|
|
1846
|
+
catchall: ie.create(),
|
|
1847
1847
|
typeName: g.ZodObject
|
|
1848
|
-
},
|
|
1848
|
+
}, w(e)));
|
|
1849
1849
|
S.strictCreate = (n, e) => new S(u({
|
|
1850
1850
|
shape: () => n,
|
|
1851
1851
|
unknownKeys: "strict",
|
|
1852
|
-
catchall:
|
|
1852
|
+
catchall: ie.create(),
|
|
1853
1853
|
typeName: g.ZodObject
|
|
1854
|
-
},
|
|
1854
|
+
}, w(e)));
|
|
1855
1855
|
S.lazycreate = (n, e) => new S(u({
|
|
1856
1856
|
shape: n,
|
|
1857
1857
|
unknownKeys: "strip",
|
|
1858
|
-
catchall:
|
|
1858
|
+
catchall: ie.create(),
|
|
1859
1859
|
typeName: g.ZodObject
|
|
1860
|
-
},
|
|
1861
|
-
class
|
|
1860
|
+
}, w(e)));
|
|
1861
|
+
class Fe extends x {
|
|
1862
1862
|
_parse(e) {
|
|
1863
1863
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1864
1864
|
function r(a) {
|
|
@@ -1875,7 +1875,7 @@ class Le extends w {
|
|
|
1875
1875
|
}), v;
|
|
1876
1876
|
}
|
|
1877
1877
|
if (t.common.async)
|
|
1878
|
-
return Promise.all(s.map((a) =>
|
|
1878
|
+
return Promise.all(s.map((a) => P(this, null, function* () {
|
|
1879
1879
|
const i = y(u({}, t), {
|
|
1880
1880
|
common: y(u({}, t.common), {
|
|
1881
1881
|
issues: []
|
|
@@ -1922,12 +1922,12 @@ class Le extends w {
|
|
|
1922
1922
|
return this._def.options;
|
|
1923
1923
|
}
|
|
1924
1924
|
}
|
|
1925
|
-
|
|
1925
|
+
Fe.create = (n, e) => new Fe(u({
|
|
1926
1926
|
options: n,
|
|
1927
1927
|
typeName: g.ZodUnion
|
|
1928
|
-
},
|
|
1929
|
-
const
|
|
1930
|
-
class it extends
|
|
1928
|
+
}, w(e)));
|
|
1929
|
+
const re = (n) => n instanceof Ve ? re(n.schema) : n instanceof J ? re(n.innerType()) : n instanceof Ue ? [n.value] : n instanceof le ? n.options : n instanceof ze ? k.objectValues(n.enum) : n instanceof We ? re(n._def.innerType) : n instanceof $e ? [void 0] : n instanceof Pe ? [null] : n instanceof Y ? [void 0, ...re(n.unwrap())] : n instanceof fe ? [null, ...re(n.unwrap())] : n instanceof At || n instanceof qe ? re(n.unwrap()) : n instanceof Be ? re(n._def.innerType) : [];
|
|
1930
|
+
class it extends x {
|
|
1931
1931
|
_parse(e) {
|
|
1932
1932
|
const { ctx: t } = this._processInputParams(e);
|
|
1933
1933
|
if (t.parsedType !== p.object)
|
|
@@ -1971,7 +1971,7 @@ class it extends w {
|
|
|
1971
1971
|
static create(e, t, s) {
|
|
1972
1972
|
const r = /* @__PURE__ */ new Map();
|
|
1973
1973
|
for (const a of t) {
|
|
1974
|
-
const i =
|
|
1974
|
+
const i = re(a.shape[e]);
|
|
1975
1975
|
if (!i.length)
|
|
1976
1976
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1977
1977
|
for (const o of i) {
|
|
@@ -1985,17 +1985,17 @@ class it extends w {
|
|
|
1985
1985
|
discriminator: e,
|
|
1986
1986
|
options: t,
|
|
1987
1987
|
optionsMap: r
|
|
1988
|
-
},
|
|
1988
|
+
}, w(s)));
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
|
-
function
|
|
1992
|
-
const t =
|
|
1991
|
+
function gt(n, e) {
|
|
1992
|
+
const t = ae(n), s = ae(e);
|
|
1993
1993
|
if (n === e)
|
|
1994
1994
|
return { valid: !0, data: n };
|
|
1995
1995
|
if (t === p.object && s === p.object) {
|
|
1996
|
-
const r =
|
|
1996
|
+
const r = k.objectKeys(e), a = k.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = u(u({}, n), e);
|
|
1997
1997
|
for (const o of a) {
|
|
1998
|
-
const c =
|
|
1998
|
+
const c = gt(n[o], e[o]);
|
|
1999
1999
|
if (!c.valid)
|
|
2000
2000
|
return { valid: !1 };
|
|
2001
2001
|
i[o] = c.data;
|
|
@@ -2006,7 +2006,7 @@ function yt(n, e) {
|
|
|
2006
2006
|
return { valid: !1 };
|
|
2007
2007
|
const r = [];
|
|
2008
2008
|
for (let a = 0; a < n.length; a++) {
|
|
2009
|
-
const i = n[a], o = e[a], c =
|
|
2009
|
+
const i = n[a], o = e[a], c = gt(i, o);
|
|
2010
2010
|
if (!c.valid)
|
|
2011
2011
|
return { valid: !1 };
|
|
2012
2012
|
r.push(c.data);
|
|
@@ -2014,13 +2014,13 @@ function yt(n, e) {
|
|
|
2014
2014
|
return { valid: !0, data: r };
|
|
2015
2015
|
} else return t === p.date && s === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2016
2016
|
}
|
|
2017
|
-
class
|
|
2017
|
+
class Le extends x {
|
|
2018
2018
|
_parse(e) {
|
|
2019
2019
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2020
|
-
if (
|
|
2020
|
+
if (mt(a) || mt(i))
|
|
2021
2021
|
return v;
|
|
2022
|
-
const o =
|
|
2023
|
-
return o.valid ? ((
|
|
2022
|
+
const o = gt(a.value, i.value);
|
|
2023
|
+
return o.valid ? ((yt(a) || yt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2024
2024
|
code: l.invalid_intersection_types
|
|
2025
2025
|
}), v);
|
|
2026
2026
|
};
|
|
@@ -2046,12 +2046,12 @@ class De extends w {
|
|
|
2046
2046
|
}));
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
|
-
|
|
2049
|
+
Le.create = (n, e, t) => new Le(u({
|
|
2050
2050
|
left: n,
|
|
2051
2051
|
right: e,
|
|
2052
2052
|
typeName: g.ZodIntersection
|
|
2053
|
-
},
|
|
2054
|
-
class
|
|
2053
|
+
}, w(t)));
|
|
2054
|
+
class ee extends x {
|
|
2055
2055
|
_parse(e) {
|
|
2056
2056
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2057
2057
|
if (s.parsedType !== p.array)
|
|
@@ -2077,7 +2077,7 @@ class ne extends w {
|
|
|
2077
2077
|
}), t.dirty());
|
|
2078
2078
|
const a = [...s.data].map((i, o) => {
|
|
2079
2079
|
const c = this._def.items[o] || this._def.rest;
|
|
2080
|
-
return c ? c._parse(new
|
|
2080
|
+
return c ? c._parse(new Q(s, i, s.path, o)) : null;
|
|
2081
2081
|
}).filter((i) => !!i);
|
|
2082
2082
|
return s.common.async ? Promise.all(a).then((i) => R.mergeArray(t, i)) : R.mergeArray(t, a);
|
|
2083
2083
|
}
|
|
@@ -2085,21 +2085,21 @@ class ne extends w {
|
|
|
2085
2085
|
return this._def.items;
|
|
2086
2086
|
}
|
|
2087
2087
|
rest(e) {
|
|
2088
|
-
return new
|
|
2088
|
+
return new ee(y(u({}, this._def), {
|
|
2089
2089
|
rest: e
|
|
2090
2090
|
}));
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
|
|
2093
|
+
ee.create = (n, e) => {
|
|
2094
2094
|
if (!Array.isArray(n))
|
|
2095
2095
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2096
|
-
return new
|
|
2096
|
+
return new ee(u({
|
|
2097
2097
|
items: n,
|
|
2098
2098
|
typeName: g.ZodTuple,
|
|
2099
2099
|
rest: null
|
|
2100
|
-
},
|
|
2100
|
+
}, w(e)));
|
|
2101
2101
|
};
|
|
2102
|
-
class
|
|
2102
|
+
class De extends x {
|
|
2103
2103
|
get keySchema() {
|
|
2104
2104
|
return this._def.keyType;
|
|
2105
2105
|
}
|
|
@@ -2117,8 +2117,8 @@ class Ve extends w {
|
|
|
2117
2117
|
const r = [], a = this._def.keyType, i = this._def.valueType;
|
|
2118
2118
|
for (const o in s.data)
|
|
2119
2119
|
r.push({
|
|
2120
|
-
key: a._parse(new
|
|
2121
|
-
value: i._parse(new
|
|
2120
|
+
key: a._parse(new Q(s, o, s.path, o)),
|
|
2121
|
+
value: i._parse(new Q(s, s.data[o], s.path, o)),
|
|
2122
2122
|
alwaysSet: o in s.data
|
|
2123
2123
|
});
|
|
2124
2124
|
return s.common.async ? R.mergeObjectAsync(t, r) : R.mergeObjectSync(t, r);
|
|
@@ -2127,18 +2127,18 @@ class Ve extends w {
|
|
|
2127
2127
|
return this._def.valueType;
|
|
2128
2128
|
}
|
|
2129
2129
|
static create(e, t, s) {
|
|
2130
|
-
return t instanceof
|
|
2130
|
+
return t instanceof x ? new De(u({
|
|
2131
2131
|
keyType: e,
|
|
2132
2132
|
valueType: t,
|
|
2133
2133
|
typeName: g.ZodRecord
|
|
2134
|
-
},
|
|
2135
|
-
keyType:
|
|
2134
|
+
}, w(s))) : new De(u({
|
|
2135
|
+
keyType: q.create(),
|
|
2136
2136
|
valueType: e,
|
|
2137
2137
|
typeName: g.ZodRecord
|
|
2138
|
-
},
|
|
2138
|
+
}, w(t)));
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
2141
|
-
class rt extends
|
|
2141
|
+
class rt extends x {
|
|
2142
2142
|
get keySchema() {
|
|
2143
2143
|
return this._def.keyType;
|
|
2144
2144
|
}
|
|
@@ -2154,12 +2154,12 @@ class rt extends w {
|
|
|
2154
2154
|
received: s.parsedType
|
|
2155
2155
|
}), v;
|
|
2156
2156
|
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
|
|
2157
|
-
key: r._parse(new
|
|
2158
|
-
value: a._parse(new
|
|
2157
|
+
key: r._parse(new Q(s, o, s.path, [d, "key"])),
|
|
2158
|
+
value: a._parse(new Q(s, c, s.path, [d, "value"]))
|
|
2159
2159
|
}));
|
|
2160
2160
|
if (s.common.async) {
|
|
2161
2161
|
const o = /* @__PURE__ */ new Map();
|
|
2162
|
-
return Promise.resolve().then(() =>
|
|
2162
|
+
return Promise.resolve().then(() => P(this, null, function* () {
|
|
2163
2163
|
for (const c of i) {
|
|
2164
2164
|
const d = yield c.key, f = yield c.value;
|
|
2165
2165
|
if (d.status === "aborted" || f.status === "aborted")
|
|
@@ -2184,8 +2184,8 @@ rt.create = (n, e, t) => new rt(u({
|
|
|
2184
2184
|
valueType: e,
|
|
2185
2185
|
keyType: n,
|
|
2186
2186
|
typeName: g.ZodMap
|
|
2187
|
-
},
|
|
2188
|
-
class
|
|
2187
|
+
}, w(t)));
|
|
2188
|
+
class ve extends x {
|
|
2189
2189
|
_parse(e) {
|
|
2190
2190
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2191
2191
|
if (s.parsedType !== p.set)
|
|
@@ -2220,16 +2220,16 @@ class _e extends w {
|
|
|
2220
2220
|
}
|
|
2221
2221
|
return { status: t.value, value: d };
|
|
2222
2222
|
}
|
|
2223
|
-
const o = [...s.data.values()].map((c, d) => a._parse(new
|
|
2223
|
+
const o = [...s.data.values()].map((c, d) => a._parse(new Q(s, c, s.path, d)));
|
|
2224
2224
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
2225
2225
|
}
|
|
2226
2226
|
min(e, t) {
|
|
2227
|
-
return new
|
|
2227
|
+
return new ve(y(u({}, this._def), {
|
|
2228
2228
|
minSize: { value: e, message: m.toString(t) }
|
|
2229
2229
|
}));
|
|
2230
2230
|
}
|
|
2231
2231
|
max(e, t) {
|
|
2232
|
-
return new
|
|
2232
|
+
return new ve(y(u({}, this._def), {
|
|
2233
2233
|
maxSize: { value: e, message: m.toString(t) }
|
|
2234
2234
|
}));
|
|
2235
2235
|
}
|
|
@@ -2240,13 +2240,13 @@ class _e extends w {
|
|
|
2240
2240
|
return this.min(1, e);
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
|
-
|
|
2243
|
+
ve.create = (n, e) => new ve(u({
|
|
2244
2244
|
valueType: n,
|
|
2245
2245
|
minSize: null,
|
|
2246
2246
|
maxSize: null,
|
|
2247
2247
|
typeName: g.ZodSet
|
|
2248
|
-
},
|
|
2249
|
-
class
|
|
2248
|
+
}, w(e)));
|
|
2249
|
+
class xe extends x {
|
|
2250
2250
|
constructor() {
|
|
2251
2251
|
super(...arguments), this.validate = this.implement;
|
|
2252
2252
|
}
|
|
@@ -2266,7 +2266,7 @@ class ke extends w {
|
|
|
2266
2266
|
t.common.contextualErrorMap,
|
|
2267
2267
|
t.schemaErrorMap,
|
|
2268
2268
|
Qe(),
|
|
2269
|
-
|
|
2269
|
+
ke
|
|
2270
2270
|
].filter((d) => !!d),
|
|
2271
2271
|
issueData: {
|
|
2272
2272
|
code: l.invalid_arguments,
|
|
@@ -2282,7 +2282,7 @@ class ke extends w {
|
|
|
2282
2282
|
t.common.contextualErrorMap,
|
|
2283
2283
|
t.schemaErrorMap,
|
|
2284
2284
|
Qe(),
|
|
2285
|
-
|
|
2285
|
+
ke
|
|
2286
2286
|
].filter((d) => !!d),
|
|
2287
2287
|
issueData: {
|
|
2288
2288
|
code: l.invalid_return_type,
|
|
@@ -2291,10 +2291,10 @@ class ke extends w {
|
|
|
2291
2291
|
});
|
|
2292
2292
|
}
|
|
2293
2293
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2294
|
-
if (this._def.returns instanceof
|
|
2294
|
+
if (this._def.returns instanceof Se) {
|
|
2295
2295
|
const o = this;
|
|
2296
2296
|
return $(function(...c) {
|
|
2297
|
-
return
|
|
2297
|
+
return P(this, null, function* () {
|
|
2298
2298
|
const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((A) => {
|
|
2299
2299
|
throw d.addIssue(s(c, A)), d;
|
|
2300
2300
|
}), _ = yield Reflect.apply(i, this, f);
|
|
@@ -2323,12 +2323,12 @@ class ke extends w {
|
|
|
2323
2323
|
return this._def.returns;
|
|
2324
2324
|
}
|
|
2325
2325
|
args(...e) {
|
|
2326
|
-
return new
|
|
2327
|
-
args:
|
|
2326
|
+
return new xe(y(u({}, this._def), {
|
|
2327
|
+
args: ee.create(e).rest(me.create())
|
|
2328
2328
|
}));
|
|
2329
2329
|
}
|
|
2330
2330
|
returns(e) {
|
|
2331
|
-
return new
|
|
2331
|
+
return new xe(y(u({}, this._def), {
|
|
2332
2332
|
returns: e
|
|
2333
2333
|
}));
|
|
2334
2334
|
}
|
|
@@ -2339,14 +2339,14 @@ class ke extends w {
|
|
|
2339
2339
|
return this.parse(e);
|
|
2340
2340
|
}
|
|
2341
2341
|
static create(e, t, s) {
|
|
2342
|
-
return new
|
|
2343
|
-
args: e ||
|
|
2344
|
-
returns: t ||
|
|
2342
|
+
return new xe(u({
|
|
2343
|
+
args: e || ee.create([]).rest(me.create()),
|
|
2344
|
+
returns: t || me.create(),
|
|
2345
2345
|
typeName: g.ZodFunction
|
|
2346
|
-
},
|
|
2346
|
+
}, w(s)));
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
class
|
|
2349
|
+
class Ve extends x {
|
|
2350
2350
|
get schema() {
|
|
2351
2351
|
return this._def.getter();
|
|
2352
2352
|
}
|
|
@@ -2355,11 +2355,11 @@ class Ue extends w {
|
|
|
2355
2355
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
2358
|
-
|
|
2358
|
+
Ve.create = (n, e) => new Ve(u({
|
|
2359
2359
|
getter: n,
|
|
2360
2360
|
typeName: g.ZodLazy
|
|
2361
|
-
},
|
|
2362
|
-
class
|
|
2361
|
+
}, w(e)));
|
|
2362
|
+
class Ue extends x {
|
|
2363
2363
|
_parse(e) {
|
|
2364
2364
|
if (e.data !== this._def.value) {
|
|
2365
2365
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2375,30 +2375,30 @@ class ze extends w {
|
|
|
2375
2375
|
return this._def.value;
|
|
2376
2376
|
}
|
|
2377
2377
|
}
|
|
2378
|
-
|
|
2378
|
+
Ue.create = (n, e) => new Ue(u({
|
|
2379
2379
|
value: n,
|
|
2380
2380
|
typeName: g.ZodLiteral
|
|
2381
|
-
},
|
|
2381
|
+
}, w(e)));
|
|
2382
2382
|
function Xt(n, e) {
|
|
2383
|
-
return new
|
|
2383
|
+
return new le(u({
|
|
2384
2384
|
values: n,
|
|
2385
2385
|
typeName: g.ZodEnum
|
|
2386
|
-
},
|
|
2386
|
+
}, w(e)));
|
|
2387
2387
|
}
|
|
2388
|
-
class
|
|
2388
|
+
class le extends x {
|
|
2389
2389
|
constructor() {
|
|
2390
|
-
super(...arguments),
|
|
2390
|
+
super(...arguments), Ce.set(this, void 0);
|
|
2391
2391
|
}
|
|
2392
2392
|
_parse(e) {
|
|
2393
2393
|
if (typeof e.data != "string") {
|
|
2394
2394
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2395
2395
|
return h(t, {
|
|
2396
|
-
expected:
|
|
2396
|
+
expected: k.joinValues(s),
|
|
2397
2397
|
received: t.parsedType,
|
|
2398
2398
|
code: l.invalid_type
|
|
2399
2399
|
}), v;
|
|
2400
2400
|
}
|
|
2401
|
-
if (tt(this,
|
|
2401
|
+
if (tt(this, Ce) || Ht(this, Ce, new Set(this._def.values)), !tt(this, Ce).has(e.data)) {
|
|
2402
2402
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2403
2403
|
return h(t, {
|
|
2404
2404
|
received: t.data,
|
|
@@ -2430,30 +2430,30 @@ class fe extends w {
|
|
|
2430
2430
|
return e;
|
|
2431
2431
|
}
|
|
2432
2432
|
extract(e, t = this._def) {
|
|
2433
|
-
return
|
|
2433
|
+
return le.create(e, u(u({}, this._def), t));
|
|
2434
2434
|
}
|
|
2435
2435
|
exclude(e, t = this._def) {
|
|
2436
|
-
return
|
|
2436
|
+
return le.create(this.options.filter((s) => !e.includes(s)), u(u({}, this._def), t));
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
class
|
|
2439
|
+
Ce = /* @__PURE__ */ new WeakMap();
|
|
2440
|
+
le.create = Xt;
|
|
2441
|
+
class ze extends x {
|
|
2442
2442
|
constructor() {
|
|
2443
|
-
super(...arguments),
|
|
2443
|
+
super(...arguments), Ie.set(this, void 0);
|
|
2444
2444
|
}
|
|
2445
2445
|
_parse(e) {
|
|
2446
|
-
const t =
|
|
2446
|
+
const t = k.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2447
2447
|
if (s.parsedType !== p.string && s.parsedType !== p.number) {
|
|
2448
|
-
const r =
|
|
2448
|
+
const r = k.objectValues(t);
|
|
2449
2449
|
return h(s, {
|
|
2450
|
-
expected:
|
|
2450
|
+
expected: k.joinValues(r),
|
|
2451
2451
|
received: s.parsedType,
|
|
2452
2452
|
code: l.invalid_type
|
|
2453
2453
|
}), v;
|
|
2454
2454
|
}
|
|
2455
|
-
if (tt(this,
|
|
2456
|
-
const r =
|
|
2455
|
+
if (tt(this, Ie) || Ht(this, Ie, new Set(k.getValidEnumValues(this._def.values))), !tt(this, Ie).has(e.data)) {
|
|
2456
|
+
const r = k.objectValues(t);
|
|
2457
2457
|
return h(s, {
|
|
2458
2458
|
received: s.data,
|
|
2459
2459
|
code: l.invalid_enum_value,
|
|
@@ -2466,12 +2466,12 @@ class We extends w {
|
|
|
2466
2466
|
return this._def.values;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2469
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
2470
|
+
ze.create = (n, e) => new ze(u({
|
|
2471
2471
|
values: n,
|
|
2472
2472
|
typeName: g.ZodNativeEnum
|
|
2473
|
-
},
|
|
2474
|
-
class
|
|
2473
|
+
}, w(e)));
|
|
2474
|
+
class Se extends x {
|
|
2475
2475
|
unwrap() {
|
|
2476
2476
|
return this._def.type;
|
|
2477
2477
|
}
|
|
@@ -2490,11 +2490,11 @@ class Ee extends w {
|
|
|
2490
2490
|
})));
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
|
-
|
|
2493
|
+
Se.create = (n, e) => new Se(u({
|
|
2494
2494
|
type: n,
|
|
2495
2495
|
typeName: g.ZodPromise
|
|
2496
|
-
},
|
|
2497
|
-
class
|
|
2496
|
+
}, w(e)));
|
|
2497
|
+
class J extends x {
|
|
2498
2498
|
innerType() {
|
|
2499
2499
|
return this._def.schema;
|
|
2500
2500
|
}
|
|
@@ -2513,7 +2513,7 @@ class G extends w {
|
|
|
2513
2513
|
if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
|
|
2514
2514
|
const i = r.transform(s.data, a);
|
|
2515
2515
|
if (s.common.async)
|
|
2516
|
-
return Promise.resolve(i).then((o) =>
|
|
2516
|
+
return Promise.resolve(i).then((o) => P(this, null, function* () {
|
|
2517
2517
|
if (t.value === "aborted")
|
|
2518
2518
|
return v;
|
|
2519
2519
|
const c = yield this._def.schema._parseAsync({
|
|
@@ -2521,7 +2521,7 @@ class G extends w {
|
|
|
2521
2521
|
path: s.path,
|
|
2522
2522
|
parent: s
|
|
2523
2523
|
});
|
|
2524
|
-
return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ?
|
|
2524
|
+
return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? we(c.value) : c;
|
|
2525
2525
|
}));
|
|
2526
2526
|
{
|
|
2527
2527
|
if (t.value === "aborted")
|
|
@@ -2531,7 +2531,7 @@ class G extends w {
|
|
|
2531
2531
|
path: s.path,
|
|
2532
2532
|
parent: s
|
|
2533
2533
|
});
|
|
2534
|
-
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ?
|
|
2534
|
+
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? we(o.value) : o;
|
|
2535
2535
|
}
|
|
2536
2536
|
}
|
|
2537
2537
|
if (r.type === "refinement") {
|
|
@@ -2560,28 +2560,28 @@ class G extends w {
|
|
|
2560
2560
|
path: s.path,
|
|
2561
2561
|
parent: s
|
|
2562
2562
|
});
|
|
2563
|
-
if (!
|
|
2563
|
+
if (!ye(i))
|
|
2564
2564
|
return i;
|
|
2565
2565
|
const o = r.transform(i.value, a);
|
|
2566
2566
|
if (o instanceof Promise)
|
|
2567
2567
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2568
2568
|
return { status: t.value, value: o };
|
|
2569
2569
|
} else
|
|
2570
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) =>
|
|
2571
|
-
|
|
2570
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => ye(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2571
|
+
k.assertNever(r);
|
|
2572
2572
|
}
|
|
2573
2573
|
}
|
|
2574
|
-
|
|
2574
|
+
J.create = (n, e, t) => new J(u({
|
|
2575
2575
|
schema: n,
|
|
2576
2576
|
typeName: g.ZodEffects,
|
|
2577
2577
|
effect: e
|
|
2578
|
-
},
|
|
2579
|
-
|
|
2578
|
+
}, w(t)));
|
|
2579
|
+
J.createWithPreprocess = (n, e, t) => new J(u({
|
|
2580
2580
|
schema: e,
|
|
2581
2581
|
effect: { type: "preprocess", transform: n },
|
|
2582
2582
|
typeName: g.ZodEffects
|
|
2583
|
-
},
|
|
2584
|
-
class
|
|
2583
|
+
}, w(t)));
|
|
2584
|
+
class Y extends x {
|
|
2585
2585
|
_parse(e) {
|
|
2586
2586
|
return this._getType(e) === p.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
2587
2587
|
}
|
|
@@ -2589,11 +2589,11 @@ class ee extends w {
|
|
|
2589
2589
|
return this._def.innerType;
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
|
-
|
|
2592
|
+
Y.create = (n, e) => new Y(u({
|
|
2593
2593
|
innerType: n,
|
|
2594
2594
|
typeName: g.ZodOptional
|
|
2595
|
-
},
|
|
2596
|
-
class
|
|
2595
|
+
}, w(e)));
|
|
2596
|
+
class fe extends x {
|
|
2597
2597
|
_parse(e) {
|
|
2598
2598
|
return this._getType(e) === p.null ? $(null) : this._def.innerType._parse(e);
|
|
2599
2599
|
}
|
|
@@ -2601,11 +2601,11 @@ class he extends w {
|
|
|
2601
2601
|
return this._def.innerType;
|
|
2602
2602
|
}
|
|
2603
2603
|
}
|
|
2604
|
-
|
|
2604
|
+
fe.create = (n, e) => new fe(u({
|
|
2605
2605
|
innerType: n,
|
|
2606
2606
|
typeName: g.ZodNullable
|
|
2607
|
-
},
|
|
2608
|
-
class
|
|
2607
|
+
}, w(e)));
|
|
2608
|
+
class We extends x {
|
|
2609
2609
|
_parse(e) {
|
|
2610
2610
|
const { ctx: t } = this._processInputParams(e);
|
|
2611
2611
|
let s = t.data;
|
|
@@ -2619,12 +2619,12 @@ class Be extends w {
|
|
|
2619
2619
|
return this._def.innerType;
|
|
2620
2620
|
}
|
|
2621
2621
|
}
|
|
2622
|
-
|
|
2622
|
+
We.create = (n, e) => new We(u({
|
|
2623
2623
|
innerType: n,
|
|
2624
2624
|
typeName: g.ZodDefault,
|
|
2625
2625
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
2626
|
-
},
|
|
2627
|
-
class
|
|
2626
|
+
}, w(e)));
|
|
2627
|
+
class Be extends x {
|
|
2628
2628
|
_parse(e) {
|
|
2629
2629
|
const { ctx: t } = this._processInputParams(e), s = y(u({}, t), {
|
|
2630
2630
|
common: y(u({}, t.common), {
|
|
@@ -2635,7 +2635,7 @@ class qe extends w {
|
|
|
2635
2635
|
path: s.path,
|
|
2636
2636
|
parent: u({}, s)
|
|
2637
2637
|
});
|
|
2638
|
-
return
|
|
2638
|
+
return Ze(r) ? r.then((a) => ({
|
|
2639
2639
|
status: "valid",
|
|
2640
2640
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2641
2641
|
get error() {
|
|
@@ -2657,12 +2657,12 @@ class qe extends w {
|
|
|
2657
2657
|
return this._def.innerType;
|
|
2658
2658
|
}
|
|
2659
2659
|
}
|
|
2660
|
-
|
|
2660
|
+
Be.create = (n, e) => new Be(u({
|
|
2661
2661
|
innerType: n,
|
|
2662
2662
|
typeName: g.ZodCatch,
|
|
2663
2663
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
2664
|
-
},
|
|
2665
|
-
class at extends
|
|
2664
|
+
}, w(e)));
|
|
2665
|
+
class at extends x {
|
|
2666
2666
|
_parse(e) {
|
|
2667
2667
|
if (this._getType(e) !== p.nan) {
|
|
2668
2668
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2677,9 +2677,9 @@ class at extends w {
|
|
|
2677
2677
|
}
|
|
2678
2678
|
at.create = (n) => new at(u({
|
|
2679
2679
|
typeName: g.ZodNaN
|
|
2680
|
-
},
|
|
2680
|
+
}, w(n)));
|
|
2681
2681
|
const Vn = Symbol("zod_brand");
|
|
2682
|
-
class
|
|
2682
|
+
class At extends x {
|
|
2683
2683
|
_parse(e) {
|
|
2684
2684
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2685
2685
|
return this._def.type._parse({
|
|
@@ -2692,17 +2692,17 @@ class Et extends w {
|
|
|
2692
2692
|
return this._def.type;
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
|
-
class
|
|
2695
|
+
class Je extends x {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2698
2698
|
if (s.common.async)
|
|
2699
|
-
return
|
|
2699
|
+
return P(this, null, function* () {
|
|
2700
2700
|
const a = yield this._def.in._parseAsync({
|
|
2701
2701
|
data: s.data,
|
|
2702
2702
|
path: s.path,
|
|
2703
2703
|
parent: s
|
|
2704
2704
|
});
|
|
2705
|
-
return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(),
|
|
2705
|
+
return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), we(a.value)) : this._def.out._parseAsync({
|
|
2706
2706
|
data: a.value,
|
|
2707
2707
|
path: s.path,
|
|
2708
2708
|
parent: s
|
|
@@ -2725,34 +2725,34 @@ class Ge extends w {
|
|
|
2725
2725
|
}
|
|
2726
2726
|
}
|
|
2727
2727
|
static create(e, t) {
|
|
2728
|
-
return new
|
|
2728
|
+
return new Je({
|
|
2729
2729
|
in: e,
|
|
2730
2730
|
out: t,
|
|
2731
2731
|
typeName: g.ZodPipeline
|
|
2732
2732
|
});
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
|
-
class
|
|
2735
|
+
class qe extends x {
|
|
2736
2736
|
_parse(e) {
|
|
2737
|
-
const t = this._def.innerType._parse(e), s = (r) => (
|
|
2738
|
-
return
|
|
2737
|
+
const t = this._def.innerType._parse(e), s = (r) => (ye(r) && (r.value = Object.freeze(r.value)), r);
|
|
2738
|
+
return Ze(t) ? t.then((r) => s(r)) : s(t);
|
|
2739
2739
|
}
|
|
2740
2740
|
unwrap() {
|
|
2741
2741
|
return this._def.innerType;
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
|
-
|
|
2744
|
+
qe.create = (n, e) => new qe(u({
|
|
2745
2745
|
innerType: n,
|
|
2746
2746
|
typeName: g.ZodReadonly
|
|
2747
|
-
},
|
|
2747
|
+
}, w(e)));
|
|
2748
2748
|
function Yt(n, e = {}, t) {
|
|
2749
|
-
return n ?
|
|
2749
|
+
return n ? Te.create().superRefine((s, r) => {
|
|
2750
2750
|
var a, i;
|
|
2751
2751
|
if (!n(s)) {
|
|
2752
2752
|
const o = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, c = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
|
|
2753
2753
|
r.addIssue(y(u({ code: "custom" }, d), { fatal: c }));
|
|
2754
2754
|
}
|
|
2755
|
-
}) :
|
|
2755
|
+
}) : Te.create();
|
|
2756
2756
|
}
|
|
2757
2757
|
const Un = {
|
|
2758
2758
|
object: S.lazycreate
|
|
@@ -2763,18 +2763,18 @@ var g;
|
|
|
2763
2763
|
})(g || (g = {}));
|
|
2764
2764
|
const zn = (n, e = {
|
|
2765
2765
|
message: `Input not instance of ${n.name}`
|
|
2766
|
-
}) => Yt((t) => t instanceof n, e), Qt =
|
|
2767
|
-
string: (n) =>
|
|
2768
|
-
number: (n) =>
|
|
2769
|
-
boolean: (n) =>
|
|
2766
|
+
}) => Yt((t) => t instanceof n, e), Qt = q.create, en = ue.create, Wn = at.create, Bn = de.create, tn = Me.create, qn = ge.create, Hn = nt.create, Jn = $e.create, Gn = Pe.create, Kn = Te.create, Xn = me.create, Yn = ie.create, Qn = st.create, es = H.create, ts = S.create, ns = S.strictCreate, ss = Fe.create, rs = it.create, as = Le.create, is = ee.create, os = De.create, cs = rt.create, us = ve.create, ds = xe.create, ls = Ve.create, fs = Ue.create, hs = le.create, ps = ze.create, ms = Se.create, Pt = J.create, ys = Y.create, gs = fe.create, vs = J.createWithPreprocess, _s = Je.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
|
|
2767
|
+
string: (n) => q.create(y(u({}, n), { coerce: !0 })),
|
|
2768
|
+
number: (n) => ue.create(y(u({}, n), { coerce: !0 })),
|
|
2769
|
+
boolean: (n) => Me.create(y(u({}, n), {
|
|
2770
2770
|
coerce: !0
|
|
2771
2771
|
})),
|
|
2772
|
-
bigint: (n) =>
|
|
2773
|
-
date: (n) =>
|
|
2772
|
+
bigint: (n) => de.create(y(u({}, n), { coerce: !0 })),
|
|
2773
|
+
date: (n) => ge.create(y(u({}, n), { coerce: !0 }))
|
|
2774
2774
|
}, Ts = v;
|
|
2775
|
-
var
|
|
2775
|
+
var C = /* @__PURE__ */ Object.freeze({
|
|
2776
2776
|
__proto__: null,
|
|
2777
|
-
defaultErrorMap:
|
|
2777
|
+
defaultErrorMap: ke,
|
|
2778
2778
|
setErrorMap: vn,
|
|
2779
2779
|
getErrorMap: Qe,
|
|
2780
2780
|
makeIssue: et,
|
|
@@ -2782,63 +2782,63 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
2782
2782
|
addIssueToContext: h,
|
|
2783
2783
|
ParseStatus: R,
|
|
2784
2784
|
INVALID: v,
|
|
2785
|
-
DIRTY:
|
|
2785
|
+
DIRTY: we,
|
|
2786
2786
|
OK: $,
|
|
2787
|
-
isAborted:
|
|
2788
|
-
isDirty:
|
|
2789
|
-
isValid:
|
|
2790
|
-
isAsync:
|
|
2787
|
+
isAborted: mt,
|
|
2788
|
+
isDirty: yt,
|
|
2789
|
+
isValid: ye,
|
|
2790
|
+
isAsync: Ze,
|
|
2791
2791
|
get util() {
|
|
2792
|
-
return
|
|
2792
|
+
return k;
|
|
2793
2793
|
},
|
|
2794
2794
|
get objectUtil() {
|
|
2795
|
-
return
|
|
2795
|
+
return pt;
|
|
2796
2796
|
},
|
|
2797
2797
|
ZodParsedType: p,
|
|
2798
|
-
getParsedType:
|
|
2799
|
-
ZodType:
|
|
2798
|
+
getParsedType: ae,
|
|
2799
|
+
ZodType: x,
|
|
2800
2800
|
datetimeRegex: Kt,
|
|
2801
|
-
ZodString:
|
|
2802
|
-
ZodNumber:
|
|
2803
|
-
ZodBigInt:
|
|
2804
|
-
ZodBoolean:
|
|
2805
|
-
ZodDate:
|
|
2801
|
+
ZodString: q,
|
|
2802
|
+
ZodNumber: ue,
|
|
2803
|
+
ZodBigInt: de,
|
|
2804
|
+
ZodBoolean: Me,
|
|
2805
|
+
ZodDate: ge,
|
|
2806
2806
|
ZodSymbol: nt,
|
|
2807
|
-
ZodUndefined:
|
|
2808
|
-
ZodNull:
|
|
2809
|
-
ZodAny:
|
|
2810
|
-
ZodUnknown:
|
|
2811
|
-
ZodNever:
|
|
2807
|
+
ZodUndefined: $e,
|
|
2808
|
+
ZodNull: Pe,
|
|
2809
|
+
ZodAny: Te,
|
|
2810
|
+
ZodUnknown: me,
|
|
2811
|
+
ZodNever: ie,
|
|
2812
2812
|
ZodVoid: st,
|
|
2813
|
-
ZodArray:
|
|
2813
|
+
ZodArray: H,
|
|
2814
2814
|
ZodObject: S,
|
|
2815
|
-
ZodUnion:
|
|
2815
|
+
ZodUnion: Fe,
|
|
2816
2816
|
ZodDiscriminatedUnion: it,
|
|
2817
|
-
ZodIntersection:
|
|
2818
|
-
ZodTuple:
|
|
2819
|
-
ZodRecord:
|
|
2817
|
+
ZodIntersection: Le,
|
|
2818
|
+
ZodTuple: ee,
|
|
2819
|
+
ZodRecord: De,
|
|
2820
2820
|
ZodMap: rt,
|
|
2821
|
-
ZodSet:
|
|
2822
|
-
ZodFunction:
|
|
2823
|
-
ZodLazy:
|
|
2824
|
-
ZodLiteral:
|
|
2825
|
-
ZodEnum:
|
|
2826
|
-
ZodNativeEnum:
|
|
2827
|
-
ZodPromise:
|
|
2828
|
-
ZodEffects:
|
|
2829
|
-
ZodTransformer:
|
|
2830
|
-
ZodOptional:
|
|
2831
|
-
ZodNullable:
|
|
2832
|
-
ZodDefault:
|
|
2833
|
-
ZodCatch:
|
|
2821
|
+
ZodSet: ve,
|
|
2822
|
+
ZodFunction: xe,
|
|
2823
|
+
ZodLazy: Ve,
|
|
2824
|
+
ZodLiteral: Ue,
|
|
2825
|
+
ZodEnum: le,
|
|
2826
|
+
ZodNativeEnum: ze,
|
|
2827
|
+
ZodPromise: Se,
|
|
2828
|
+
ZodEffects: J,
|
|
2829
|
+
ZodTransformer: J,
|
|
2830
|
+
ZodOptional: Y,
|
|
2831
|
+
ZodNullable: fe,
|
|
2832
|
+
ZodDefault: We,
|
|
2833
|
+
ZodCatch: Be,
|
|
2834
2834
|
ZodNaN: at,
|
|
2835
2835
|
BRAND: Vn,
|
|
2836
|
-
ZodBranded:
|
|
2837
|
-
ZodPipeline:
|
|
2838
|
-
ZodReadonly:
|
|
2836
|
+
ZodBranded: At,
|
|
2837
|
+
ZodPipeline: Je,
|
|
2838
|
+
ZodReadonly: qe,
|
|
2839
2839
|
custom: Yt,
|
|
2840
|
-
Schema:
|
|
2841
|
-
ZodSchema:
|
|
2840
|
+
Schema: x,
|
|
2841
|
+
ZodSchema: x,
|
|
2842
2842
|
late: Un,
|
|
2843
2843
|
get ZodFirstPartyTypeKind() {
|
|
2844
2844
|
return g;
|
|
@@ -2888,15 +2888,15 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
2888
2888
|
quotelessJson: gn,
|
|
2889
2889
|
ZodError: U
|
|
2890
2890
|
});
|
|
2891
|
-
const Ss =
|
|
2892
|
-
language:
|
|
2893
|
-
disableMarkedForExport:
|
|
2891
|
+
const Ss = C.object({
|
|
2892
|
+
language: C.enum(["typescript", "javascript"]).optional(),
|
|
2893
|
+
disableMarkedForExport: C.boolean().optional()
|
|
2894
2894
|
}).and(
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
framework:
|
|
2898
|
-
model:
|
|
2899
|
-
styling:
|
|
2895
|
+
C.union([
|
|
2896
|
+
C.object({
|
|
2897
|
+
framework: C.literal("react"),
|
|
2898
|
+
model: C.string().optional(),
|
|
2899
|
+
styling: C.enum([
|
|
2900
2900
|
"plain_css",
|
|
2901
2901
|
"css_modules",
|
|
2902
2902
|
"styled_components",
|
|
@@ -2905,16 +2905,16 @@ const Ss = I.object({
|
|
|
2905
2905
|
"scss",
|
|
2906
2906
|
"inline_styles"
|
|
2907
2907
|
]),
|
|
2908
|
-
uiLibrary:
|
|
2909
|
-
enableUILibraryTheming:
|
|
2910
|
-
enableCompactStructure:
|
|
2911
|
-
enableAutoSplit:
|
|
2912
|
-
autoSplitThreshold:
|
|
2908
|
+
uiLibrary: C.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
2909
|
+
enableUILibraryTheming: C.boolean().optional(),
|
|
2910
|
+
enableCompactStructure: C.boolean().optional(),
|
|
2911
|
+
enableAutoSplit: C.boolean().optional(),
|
|
2912
|
+
autoSplitThreshold: C.number().optional()
|
|
2913
2913
|
}),
|
|
2914
|
-
|
|
2915
|
-
framework:
|
|
2916
|
-
styling:
|
|
2917
|
-
enableTranslation:
|
|
2914
|
+
C.object({
|
|
2915
|
+
framework: C.literal("html"),
|
|
2916
|
+
styling: C.enum(["plain_css", "inline_styles"]),
|
|
2917
|
+
enableTranslation: C.boolean().optional()
|
|
2918
2918
|
})
|
|
2919
2919
|
])
|
|
2920
2920
|
), Es = (n) => {
|
|
@@ -2925,39 +2925,43 @@ const Ss = I.object({
|
|
|
2925
2925
|
}
|
|
2926
2926
|
return e.data;
|
|
2927
2927
|
};
|
|
2928
|
-
var
|
|
2928
|
+
var D, He;
|
|
2929
2929
|
class Zr {
|
|
2930
2930
|
constructor({
|
|
2931
2931
|
auth: e,
|
|
2932
2932
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
2933
2933
|
} = {}) {
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2934
|
+
ct(this, D);
|
|
2935
|
+
ct(this, He);
|
|
2936
|
+
ut(this, He, t), e && (this.auth = e);
|
|
2937
2937
|
}
|
|
2938
2938
|
hasAuth() {
|
|
2939
|
-
return !!
|
|
2939
|
+
return !!B(this, D);
|
|
2940
2940
|
}
|
|
2941
2941
|
set auth(e) {
|
|
2942
|
-
|
|
2942
|
+
ut(this, D, e);
|
|
2943
2943
|
}
|
|
2944
2944
|
get headers() {
|
|
2945
2945
|
const e = {
|
|
2946
2946
|
"Content-Type": "application/json"
|
|
2947
2947
|
};
|
|
2948
|
-
return
|
|
2948
|
+
return B(this, D) && (e.Authorization = `Bearer ${B(this, D).token}`, "teamId" in B(this, D) && (e["X-Team-Id"] = B(this, D).teamId)), e;
|
|
2949
2949
|
}
|
|
2950
2950
|
generateCode(s) {
|
|
2951
|
-
return
|
|
2952
|
-
var
|
|
2951
|
+
return P(this, arguments, function* (e, t = {}) {
|
|
2952
|
+
var _, I, A, O, Z, W, te, oe;
|
|
2953
2953
|
if (this.hasAuth() === !1)
|
|
2954
2954
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
2955
|
-
const r = {}, a = Es(e.settings)
|
|
2955
|
+
const r = {}, a = Es(e.settings);
|
|
2956
|
+
let i = e.tracking;
|
|
2957
|
+
B(this, D) && "userId" in B(this, D) && B(this, D).userId && (i != null && i.externalId || (i = { externalId: B(this, D).userId }));
|
|
2958
|
+
const o = yield fetch(`${B(this, He)}/v1/codegen`, {
|
|
2956
2959
|
method: "POST",
|
|
2957
2960
|
headers: y(u({}, this.headers), {
|
|
2958
2961
|
Accept: "text/event-stream"
|
|
2959
2962
|
}),
|
|
2960
2963
|
body: JSON.stringify({
|
|
2964
|
+
tracking: e.tracking,
|
|
2961
2965
|
fileKey: e.fileKey,
|
|
2962
2966
|
figmaToken: e.figmaToken,
|
|
2963
2967
|
nodesId: e.nodesId,
|
|
@@ -2975,104 +2979,104 @@ class Zr {
|
|
|
2975
2979
|
disableMarkedForExport: a.disableMarkedForExport
|
|
2976
2980
|
})
|
|
2977
2981
|
});
|
|
2978
|
-
if (!
|
|
2979
|
-
let
|
|
2982
|
+
if (!o.ok) {
|
|
2983
|
+
let N;
|
|
2980
2984
|
try {
|
|
2981
|
-
|
|
2982
|
-
} catch (
|
|
2983
|
-
|
|
2985
|
+
N = (yield o.json()).message || `HTTP error! status: ${o.status}`;
|
|
2986
|
+
} catch (ne) {
|
|
2987
|
+
N = `HTTP error! status: ${o.status}`;
|
|
2984
2988
|
}
|
|
2985
|
-
throw new
|
|
2989
|
+
throw new Ae({
|
|
2986
2990
|
name: "HTTP Error",
|
|
2987
|
-
reason:
|
|
2988
|
-
status:
|
|
2991
|
+
reason: N,
|
|
2992
|
+
status: o.status
|
|
2989
2993
|
});
|
|
2990
2994
|
}
|
|
2991
|
-
if (!
|
|
2992
|
-
throw new
|
|
2995
|
+
if (!o.body)
|
|
2996
|
+
throw new Ae({
|
|
2993
2997
|
name: "Stream Error",
|
|
2994
2998
|
reason: "Response body is null",
|
|
2995
|
-
status:
|
|
2999
|
+
status: o.status
|
|
2996
3000
|
});
|
|
2997
|
-
const
|
|
2998
|
-
let
|
|
3001
|
+
const c = o.body.getReader(), d = new TextDecoder();
|
|
3002
|
+
let f = "";
|
|
2999
3003
|
try {
|
|
3000
3004
|
for (; ; ) {
|
|
3001
|
-
const { done:
|
|
3002
|
-
if (
|
|
3005
|
+
const { done: N, value: ne } = yield c.read();
|
|
3006
|
+
if (N)
|
|
3003
3007
|
break;
|
|
3004
|
-
|
|
3005
|
-
const
|
|
3008
|
+
f += d.decode(ne, { stream: !0 });
|
|
3009
|
+
const Ge = f.split(`
|
|
3006
3010
|
`);
|
|
3007
|
-
|
|
3008
|
-
for (const
|
|
3009
|
-
if (!(!
|
|
3010
|
-
let
|
|
3011
|
+
f = Ge.pop() || "";
|
|
3012
|
+
for (const _e of Ge)
|
|
3013
|
+
if (!(!_e.trim() || _e.startsWith(":")) && _e.startsWith("data: ")) {
|
|
3014
|
+
let b;
|
|
3011
3015
|
try {
|
|
3012
|
-
|
|
3013
|
-
} catch (
|
|
3016
|
+
b = JSON.parse(_e.slice(6));
|
|
3017
|
+
} catch (ot) {
|
|
3014
3018
|
continue;
|
|
3015
3019
|
}
|
|
3016
|
-
switch (
|
|
3020
|
+
switch (b.type) {
|
|
3017
3021
|
case "queueing": {
|
|
3018
|
-
typeof t == "function" ? t(
|
|
3022
|
+
typeof t == "function" ? t(b) : (_ = t.onQueueing) == null || _.call(t);
|
|
3019
3023
|
break;
|
|
3020
3024
|
}
|
|
3021
3025
|
case "start": {
|
|
3022
|
-
r.sessionId =
|
|
3026
|
+
r.sessionId = b.sessionId, typeof t == "function" ? t(b) : (I = t.onStart) == null || I.call(t, { sessionId: b.sessionId });
|
|
3023
3027
|
break;
|
|
3024
3028
|
}
|
|
3025
3029
|
case "pre_codegen": {
|
|
3026
|
-
typeof t == "function" ? t(
|
|
3030
|
+
typeof t == "function" ? t(b) : (A = t.onPreCodegen) == null || A.call(t, { message: b.message });
|
|
3027
3031
|
break;
|
|
3028
3032
|
}
|
|
3029
3033
|
case "assets_uploaded": {
|
|
3030
|
-
typeof t == "function" ? t(
|
|
3034
|
+
typeof t == "function" ? t(b) : (O = t.onAssetsUploaded) == null || O.call(t);
|
|
3031
3035
|
break;
|
|
3032
3036
|
}
|
|
3033
3037
|
case "assets_list": {
|
|
3034
|
-
r.assets =
|
|
3038
|
+
r.assets = b.payload.assets, typeof t == "function" ? t(b) : (Z = t.onAssetsList) == null || Z.call(t, b.payload);
|
|
3035
3039
|
break;
|
|
3036
3040
|
}
|
|
3037
3041
|
case "figma_metadata": {
|
|
3038
|
-
r.figmaFileName =
|
|
3039
|
-
figmaFileName:
|
|
3040
|
-
figmaSelectedFrameName:
|
|
3042
|
+
r.figmaFileName = b.figmaFileName, r.figmaSelectedFrameName = b.figmaSelectedFrameName, typeof t == "function" ? t(b) : (W = t.onFigmaMetadata) == null || W.call(t, {
|
|
3043
|
+
figmaFileName: b.figmaFileName,
|
|
3044
|
+
figmaSelectedFrameName: b.figmaSelectedFrameName
|
|
3041
3045
|
});
|
|
3042
3046
|
break;
|
|
3043
3047
|
}
|
|
3044
3048
|
case "generating_code": {
|
|
3045
|
-
|
|
3046
|
-
status:
|
|
3047
|
-
progress:
|
|
3048
|
-
files:
|
|
3049
|
+
b.payload.status === "success" && (r.files = b.payload.files), typeof t == "function" ? t(b) : (te = t.onGeneratingCode) == null || te.call(t, {
|
|
3050
|
+
status: b.payload.status,
|
|
3051
|
+
progress: b.payload.progress,
|
|
3052
|
+
files: b.payload.files
|
|
3049
3053
|
});
|
|
3050
3054
|
break;
|
|
3051
3055
|
}
|
|
3052
3056
|
case "codegen_completed": {
|
|
3053
|
-
typeof t == "function" ? t(
|
|
3057
|
+
typeof t == "function" ? t(b) : (oe = t.onCodegenCompleted) == null || oe.call(t);
|
|
3054
3058
|
break;
|
|
3055
3059
|
}
|
|
3056
3060
|
case "error":
|
|
3057
|
-
throw new
|
|
3058
|
-
name:
|
|
3059
|
-
reason:
|
|
3061
|
+
throw new Ae({
|
|
3062
|
+
name: b.payload.errorName,
|
|
3063
|
+
reason: b.payload.reason
|
|
3060
3064
|
});
|
|
3061
3065
|
case "done": {
|
|
3062
3066
|
if (!r.files)
|
|
3063
|
-
throw new
|
|
3067
|
+
throw new Ae({
|
|
3064
3068
|
name: "Invalid response",
|
|
3065
3069
|
reason: "No files found"
|
|
3066
3070
|
});
|
|
3067
|
-
return r.tokenUsage =
|
|
3071
|
+
return r.tokenUsage = b.payload.tokenUsage, r;
|
|
3068
3072
|
}
|
|
3069
3073
|
}
|
|
3070
3074
|
}
|
|
3071
3075
|
}
|
|
3072
3076
|
} finally {
|
|
3073
|
-
|
|
3077
|
+
c.cancel();
|
|
3074
3078
|
}
|
|
3075
|
-
throw new
|
|
3079
|
+
throw new Ae({
|
|
3076
3080
|
name: "Connection",
|
|
3077
3081
|
reason: "Connection closed before the 'done' message",
|
|
3078
3082
|
status: 500
|
|
@@ -3080,7 +3084,7 @@ class Zr {
|
|
|
3080
3084
|
});
|
|
3081
3085
|
}
|
|
3082
3086
|
}
|
|
3083
|
-
|
|
3087
|
+
D = new WeakMap(), He = new WeakMap();
|
|
3084
3088
|
const Mr = (n) => {
|
|
3085
3089
|
var e;
|
|
3086
3090
|
if (!n)
|
|
@@ -3201,7 +3205,7 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
|
|
|
3201
3205
|
for (var t of Ft(e))
|
|
3202
3206
|
Us.call(e, t) && Dt(n, t, e[t]);
|
|
3203
3207
|
return n;
|
|
3204
|
-
},
|
|
3208
|
+
}, Ot = (n, e) => Ls(n, Ds(e)), Ct = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (Ct(n, e, "read from private field"), t ? t.call(n) : e.get(n)), z = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (Ct(n, e, "write to private field"), e.set(n, t), t), X = (n, e, t) => (Ct(n, e, "access private method"), t), E = (n, e, t) => new Promise((s, r) => {
|
|
3205
3209
|
var a = (c) => {
|
|
3206
3210
|
try {
|
|
3207
3211
|
o(t.next(c));
|
|
@@ -3220,55 +3224,55 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
|
|
|
3220
3224
|
function Bs(n) {
|
|
3221
3225
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
3222
3226
|
}
|
|
3223
|
-
var
|
|
3227
|
+
var vt = { exports: {} }, qs = vt.exports, Vt;
|
|
3224
3228
|
function Hs() {
|
|
3225
3229
|
return Vt || (Vt = 1, function(n, e) {
|
|
3226
3230
|
(function(t, s) {
|
|
3227
3231
|
n.exports = s();
|
|
3228
3232
|
})(qs, function() {
|
|
3229
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined",
|
|
3230
|
-
function
|
|
3231
|
-
var
|
|
3232
|
-
if (
|
|
3233
|
-
return
|
|
3234
|
-
if (
|
|
3233
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", I = i && typeof Set.prototype.entries == "function", A = a && typeof Map.prototype.entries == "function", O = I && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), Z = A && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), W = f && typeof Array.prototype[Symbol.iterator] == "function", te = W && Object.getPrototypeOf([][Symbol.iterator]()), oe = f && typeof String.prototype[Symbol.iterator] == "function", N = oe && Object.getPrototypeOf(""[Symbol.iterator]()), ne = 8, Ge = -1;
|
|
3234
|
+
function _e(b) {
|
|
3235
|
+
var ot = typeof b;
|
|
3236
|
+
if (ot !== "object")
|
|
3237
|
+
return ot;
|
|
3238
|
+
if (b === null)
|
|
3235
3239
|
return "null";
|
|
3236
|
-
if (
|
|
3240
|
+
if (b === s)
|
|
3237
3241
|
return "global";
|
|
3238
|
-
if (Array.isArray(
|
|
3242
|
+
if (Array.isArray(b) && (_ === !1 || !(Symbol.toStringTag in b)))
|
|
3239
3243
|
return "Array";
|
|
3240
3244
|
if (typeof window == "object" && window !== null) {
|
|
3241
|
-
if (typeof window.location == "object" &&
|
|
3245
|
+
if (typeof window.location == "object" && b === window.location)
|
|
3242
3246
|
return "Location";
|
|
3243
|
-
if (typeof window.document == "object" &&
|
|
3247
|
+
if (typeof window.document == "object" && b === window.document)
|
|
3244
3248
|
return "Document";
|
|
3245
3249
|
if (typeof window.navigator == "object") {
|
|
3246
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
3250
|
+
if (typeof window.navigator.mimeTypes == "object" && b === window.navigator.mimeTypes)
|
|
3247
3251
|
return "MimeTypeArray";
|
|
3248
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
3252
|
+
if (typeof window.navigator.plugins == "object" && b === window.navigator.plugins)
|
|
3249
3253
|
return "PluginArray";
|
|
3250
3254
|
}
|
|
3251
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
3252
|
-
if (
|
|
3255
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && b instanceof window.HTMLElement) {
|
|
3256
|
+
if (b.tagName === "BLOCKQUOTE")
|
|
3253
3257
|
return "HTMLQuoteElement";
|
|
3254
|
-
if (
|
|
3258
|
+
if (b.tagName === "TD")
|
|
3255
3259
|
return "HTMLTableDataCellElement";
|
|
3256
|
-
if (
|
|
3260
|
+
if (b.tagName === "TH")
|
|
3257
3261
|
return "HTMLTableHeaderCellElement";
|
|
3258
3262
|
}
|
|
3259
3263
|
}
|
|
3260
|
-
var Nt = _ &&
|
|
3264
|
+
var Nt = _ && b[Symbol.toStringTag];
|
|
3261
3265
|
if (typeof Nt == "string")
|
|
3262
3266
|
return Nt;
|
|
3263
|
-
var
|
|
3264
|
-
return
|
|
3267
|
+
var L = Object.getPrototypeOf(b);
|
|
3268
|
+
return L === RegExp.prototype ? "RegExp" : L === Date.prototype ? "Date" : t && L === Promise.prototype ? "Promise" : i && L === Set.prototype ? "Set" : a && L === Map.prototype ? "Map" : c && L === WeakSet.prototype ? "WeakSet" : o && L === WeakMap.prototype ? "WeakMap" : d && L === DataView.prototype ? "DataView" : a && L === Z ? "Map Iterator" : i && L === O ? "Set Iterator" : W && L === te ? "Array Iterator" : oe && L === N ? "String Iterator" : L === null ? "Object" : Object.prototype.toString.call(b).slice(ne, Ge);
|
|
3265
3269
|
}
|
|
3266
|
-
return
|
|
3270
|
+
return _e;
|
|
3267
3271
|
});
|
|
3268
|
-
}(
|
|
3272
|
+
}(vt)), vt.exports;
|
|
3269
3273
|
}
|
|
3270
3274
|
var Js = Hs();
|
|
3271
|
-
const Gs = /* @__PURE__ */ Bs(Js),
|
|
3275
|
+
const Gs = /* @__PURE__ */ Bs(Js), It = typeof Buffer != "undefined", Ks = It && typeof Buffer.from != "undefined", Xs = It ? (
|
|
3272
3276
|
/**
|
|
3273
3277
|
* is value is Buffer?
|
|
3274
3278
|
*
|
|
@@ -3299,7 +3303,7 @@ const Gs = /* @__PURE__ */ Bs(Js), Ct = typeof Buffer != "undefined", Ks = Ct &&
|
|
|
3299
3303
|
function(n) {
|
|
3300
3304
|
return Buffer.from(n);
|
|
3301
3305
|
}
|
|
3302
|
-
) :
|
|
3306
|
+
) : It ? (
|
|
3303
3307
|
/**
|
|
3304
3308
|
* copy Buffer
|
|
3305
3309
|
*
|
|
@@ -3324,7 +3328,7 @@ const Gs = /* @__PURE__ */ Bs(Js), Ct = typeof Buffer != "undefined", Ks = Ct &&
|
|
|
3324
3328
|
return n;
|
|
3325
3329
|
}
|
|
3326
3330
|
);
|
|
3327
|
-
function
|
|
3331
|
+
function Ee(n) {
|
|
3328
3332
|
return Xs(n) ? "Buffer" : Gs(n);
|
|
3329
3333
|
}
|
|
3330
3334
|
const Qs = /* @__PURE__ */ new Set([
|
|
@@ -3335,7 +3339,7 @@ const Qs = /* @__PURE__ */ new Set([
|
|
|
3335
3339
|
"Set"
|
|
3336
3340
|
]);
|
|
3337
3341
|
function er(n, e, t = null) {
|
|
3338
|
-
switch (t ||
|
|
3342
|
+
switch (t || Ee(n)) {
|
|
3339
3343
|
case "Arguments":
|
|
3340
3344
|
case "Array":
|
|
3341
3345
|
case "Object":
|
|
@@ -3346,11 +3350,11 @@ function er(n, e, t = null) {
|
|
|
3346
3350
|
return e;
|
|
3347
3351
|
}
|
|
3348
3352
|
}
|
|
3349
|
-
function
|
|
3353
|
+
function _t(n) {
|
|
3350
3354
|
return Qs.has(n);
|
|
3351
3355
|
}
|
|
3352
3356
|
function Ut(n, e, t, s = null) {
|
|
3353
|
-
switch (s ||
|
|
3357
|
+
switch (s || Ee(n)) {
|
|
3354
3358
|
case "Arguments":
|
|
3355
3359
|
case "Array":
|
|
3356
3360
|
case "Object":
|
|
@@ -3365,7 +3369,7 @@ function Ut(n, e, t, s = null) {
|
|
|
3365
3369
|
}
|
|
3366
3370
|
return n;
|
|
3367
3371
|
}
|
|
3368
|
-
const tr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, nr = typeof global != "undefined" && global !== null && global.Object === Object && global, sr = typeof self != "undefined" && self !== null && self.Object === Object && self,
|
|
3372
|
+
const tr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, nr = typeof global != "undefined" && global !== null && global.Object === Object && global, sr = typeof self != "undefined" && self !== null && self.Object === Object && self, lt = tr || nr || sr || Function("return this")();
|
|
3369
3373
|
function rr(n) {
|
|
3370
3374
|
return n.slice(0);
|
|
3371
3375
|
}
|
|
@@ -3390,8 +3394,8 @@ function dr(n) {
|
|
|
3390
3394
|
function lr(n) {
|
|
3391
3395
|
return new String(n);
|
|
3392
3396
|
}
|
|
3393
|
-
function
|
|
3394
|
-
return
|
|
3397
|
+
function se(n, e) {
|
|
3398
|
+
return lt[e].from ? lt[e].from(n) : new lt[e](n);
|
|
3395
3399
|
}
|
|
3396
3400
|
function M(n) {
|
|
3397
3401
|
return n;
|
|
@@ -3420,15 +3424,15 @@ const mr = /* @__PURE__ */ new Map([
|
|
|
3420
3424
|
["String", lr],
|
|
3421
3425
|
// typed arrays
|
|
3422
3426
|
// TODO: pass bound function
|
|
3423
|
-
["Float32Array",
|
|
3424
|
-
["Float64Array",
|
|
3425
|
-
["Int16Array",
|
|
3426
|
-
["Int32Array",
|
|
3427
|
-
["Int8Array",
|
|
3428
|
-
["Uint16Array",
|
|
3429
|
-
["Uint32Array",
|
|
3430
|
-
["Uint8Array",
|
|
3431
|
-
["Uint8ClampedArray",
|
|
3427
|
+
["Float32Array", se],
|
|
3428
|
+
["Float64Array", se],
|
|
3429
|
+
["Int16Array", se],
|
|
3430
|
+
["Int32Array", se],
|
|
3431
|
+
["Int8Array", se],
|
|
3432
|
+
["Uint16Array", se],
|
|
3433
|
+
["Uint32Array", se],
|
|
3434
|
+
["Uint8Array", se],
|
|
3435
|
+
["Uint8ClampedArray", se],
|
|
3432
3436
|
// shallow copy
|
|
3433
3437
|
["Array Iterator", M],
|
|
3434
3438
|
["Map Iterator", M],
|
|
@@ -3467,9 +3471,9 @@ const mr = /* @__PURE__ */ new Map([
|
|
|
3467
3471
|
]);
|
|
3468
3472
|
function yr() {
|
|
3469
3473
|
}
|
|
3470
|
-
function
|
|
3474
|
+
function bt(n, e = null, t = yr) {
|
|
3471
3475
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
3472
|
-
const s = e ||
|
|
3476
|
+
const s = e || Ee(n), r = mr.get(s);
|
|
3473
3477
|
if (s === "Object") {
|
|
3474
3478
|
const a = t(n, s);
|
|
3475
3479
|
if (a !== void 0)
|
|
@@ -3477,7 +3481,7 @@ function _t(n, e = null, t = yr) {
|
|
|
3477
3481
|
}
|
|
3478
3482
|
return r ? r(n, s) : n;
|
|
3479
3483
|
}
|
|
3480
|
-
function
|
|
3484
|
+
function Oe(n, e = {}) {
|
|
3481
3485
|
typeof e == "function" && (e = {
|
|
3482
3486
|
customizer: e
|
|
3483
3487
|
});
|
|
@@ -3486,15 +3490,15 @@ function Ce(n, e = {}) {
|
|
|
3486
3490
|
customizer: t
|
|
3487
3491
|
// TODO: max depth
|
|
3488
3492
|
// depth = Infinity,
|
|
3489
|
-
} = e, s =
|
|
3490
|
-
if (!
|
|
3491
|
-
return
|
|
3492
|
-
const r =
|
|
3493
|
-
return
|
|
3494
|
-
}
|
|
3495
|
-
function
|
|
3496
|
-
const a =
|
|
3497
|
-
if (!
|
|
3493
|
+
} = e, s = Ee(n);
|
|
3494
|
+
if (!_t(s))
|
|
3495
|
+
return wt(n, null, null, null);
|
|
3496
|
+
const r = bt(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
|
|
3497
|
+
return wt(n, r, a, i);
|
|
3498
|
+
}
|
|
3499
|
+
function wt(n, e, t, s, r) {
|
|
3500
|
+
const a = Ee(n), i = bt(n, a);
|
|
3501
|
+
if (!_t(a))
|
|
3498
3502
|
return i;
|
|
3499
3503
|
let o;
|
|
3500
3504
|
switch (a) {
|
|
@@ -3515,11 +3519,11 @@ function bt(n, e, t, s, r) {
|
|
|
3515
3519
|
if (s.has(d))
|
|
3516
3520
|
Ut(e, c, t.get(d), a);
|
|
3517
3521
|
else {
|
|
3518
|
-
const f =
|
|
3519
|
-
|
|
3522
|
+
const f = Ee(d), _ = bt(d, f);
|
|
3523
|
+
_t(f) && (t.set(d, _), s.add(d)), Ut(
|
|
3520
3524
|
e,
|
|
3521
3525
|
c,
|
|
3522
|
-
|
|
3526
|
+
wt(
|
|
3523
3527
|
d,
|
|
3524
3528
|
_,
|
|
3525
3529
|
t,
|
|
@@ -3532,26 +3536,26 @@ function bt(n, e, t, s, r) {
|
|
|
3532
3536
|
return e;
|
|
3533
3537
|
}
|
|
3534
3538
|
const gr = (n) => new Promise((e) => setTimeout(e, n));
|
|
3535
|
-
var Ke,
|
|
3539
|
+
var Ke, he, Xe, xt, cn;
|
|
3536
3540
|
class vr {
|
|
3537
3541
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
3538
|
-
|
|
3542
|
+
z(this, xt), z(this, Ke), z(this, he), z(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, he, 0);
|
|
3539
3543
|
}
|
|
3540
3544
|
run() {
|
|
3541
3545
|
return E(this, null, function* () {
|
|
3542
3546
|
try {
|
|
3543
3547
|
return yield T(this, Xe).call(this);
|
|
3544
3548
|
} catch (e) {
|
|
3545
|
-
if (j(this,
|
|
3549
|
+
if (j(this, he, T(this, he) + 1), T(this, he) > T(this, Ke))
|
|
3546
3550
|
throw console.error("Max attempts reached"), e;
|
|
3547
|
-
const t =
|
|
3551
|
+
const t = X(this, xt, cn).call(this);
|
|
3548
3552
|
return yield gr(t), yield this.run();
|
|
3549
3553
|
}
|
|
3550
3554
|
});
|
|
3551
3555
|
}
|
|
3552
3556
|
}
|
|
3553
|
-
Ke = /* @__PURE__ */ new WeakMap(),
|
|
3554
|
-
return T(this,
|
|
3557
|
+
Ke = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakSet(), cn = function() {
|
|
3558
|
+
return T(this, he) * 1e3 * 1.5;
|
|
3555
3559
|
};
|
|
3556
3560
|
function _r() {
|
|
3557
3561
|
return typeof CompressionStream != "undefined";
|
|
@@ -3616,7 +3620,7 @@ class Wt extends Error {
|
|
|
3616
3620
|
}
|
|
3617
3621
|
}
|
|
3618
3622
|
}
|
|
3619
|
-
class
|
|
3623
|
+
class Ne extends Error {
|
|
3620
3624
|
constructor(e = {}) {
|
|
3621
3625
|
const { canceled: t = !1 } = e;
|
|
3622
3626
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
@@ -3627,7 +3631,7 @@ class kr extends Error {
|
|
|
3627
3631
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
3628
3632
|
}
|
|
3629
3633
|
}
|
|
3630
|
-
class
|
|
3634
|
+
class ft extends Error {
|
|
3631
3635
|
constructor(e) {
|
|
3632
3636
|
super(e), this.name = "Request Validation Error";
|
|
3633
3637
|
}
|
|
@@ -3638,14 +3642,14 @@ function un() {
|
|
|
3638
3642
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
3639
3643
|
).join("");
|
|
3640
3644
|
}
|
|
3641
|
-
function
|
|
3645
|
+
function kt() {
|
|
3642
3646
|
return Math.floor(Date.now() / 1e3).toString();
|
|
3643
3647
|
}
|
|
3644
3648
|
const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
|
|
3645
|
-
var
|
|
3649
|
+
var pe, F, G, Tt, St, je;
|
|
3646
3650
|
class Er {
|
|
3647
3651
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
3648
|
-
|
|
3652
|
+
z(this, G), z(this, pe), z(this, F), this.baseAddress = t, j(this, pe, e), j(this, F, {}), this.plugins = [];
|
|
3649
3653
|
}
|
|
3650
3654
|
get headers() {
|
|
3651
3655
|
throw new Error("Missing implementation");
|
|
@@ -3657,49 +3661,49 @@ class Er {
|
|
|
3657
3661
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
3658
3662
|
}
|
|
3659
3663
|
withOptions(e = {}) {
|
|
3660
|
-
return j(this,
|
|
3664
|
+
return j(this, F, e), this;
|
|
3661
3665
|
}
|
|
3662
3666
|
get(e) {
|
|
3663
3667
|
return E(this, arguments, function* (t, s = {}) {
|
|
3664
3668
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
3665
3669
|
let o = a != null ? a : this.headers;
|
|
3666
|
-
const c =
|
|
3667
|
-
return j(this,
|
|
3670
|
+
const c = Oe(T(this, F));
|
|
3671
|
+
return j(this, F, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Ot(V({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": kt() })), c.async ? yield X(this, G, St).call(this, `${i}${t}`, c.async, { headers: o }) : yield X(this, G, Tt).call(this, `${i}${t}`, c, { headers: o });
|
|
3668
3672
|
});
|
|
3669
3673
|
}
|
|
3670
3674
|
post(e, t) {
|
|
3671
3675
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3672
|
-
const i =
|
|
3673
|
-
return j(this,
|
|
3676
|
+
const i = Oe(T(this, F));
|
|
3677
|
+
return j(this, F, {}), X(this, G, je).call(this, s, "POST", r, a, i);
|
|
3674
3678
|
});
|
|
3675
3679
|
}
|
|
3676
3680
|
put(e, t) {
|
|
3677
3681
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3678
|
-
const i =
|
|
3679
|
-
return j(this,
|
|
3682
|
+
const i = Oe(T(this, F));
|
|
3683
|
+
return j(this, F, {}), X(this, G, je).call(this, s, "PUT", r, a, i);
|
|
3680
3684
|
});
|
|
3681
3685
|
}
|
|
3682
3686
|
delete(e, t) {
|
|
3683
3687
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3684
|
-
const i =
|
|
3685
|
-
return j(this,
|
|
3688
|
+
const i = Oe(T(this, F));
|
|
3689
|
+
return j(this, F, {}), X(this, G, je).call(this, s, "DELETE", r, a, i);
|
|
3686
3690
|
});
|
|
3687
3691
|
}
|
|
3688
3692
|
patch(e, t) {
|
|
3689
3693
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3690
|
-
const i =
|
|
3691
|
-
return j(this,
|
|
3694
|
+
const i = Oe(T(this, F));
|
|
3695
|
+
return j(this, F, {}), X(this, G, je).call(this, s, "PATCH", r, a, i);
|
|
3692
3696
|
});
|
|
3693
3697
|
}
|
|
3694
3698
|
}
|
|
3695
|
-
|
|
3699
|
+
pe = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakSet(), Tt = function(n, e, t) {
|
|
3696
3700
|
return E(this, null, function* () {
|
|
3697
3701
|
const s = () => E(this, null, function* () {
|
|
3698
3702
|
var c, d;
|
|
3699
3703
|
try {
|
|
3700
|
-
return yield T(this,
|
|
3704
|
+
return yield T(this, pe).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
3701
3705
|
} catch (f) {
|
|
3702
|
-
throw f instanceof Error && f.name === "AbortError" ? new
|
|
3706
|
+
throw f instanceof Error && f.name === "AbortError" ? new Ne({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
|
|
3703
3707
|
}
|
|
3704
3708
|
}), { headers: r } = t != null ? t : {}, a = (c, d) => {
|
|
3705
3709
|
var f, _;
|
|
@@ -3719,15 +3723,15 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3719
3723
|
}
|
|
3720
3724
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
3721
3725
|
try {
|
|
3722
|
-
const _ = a(c, "x-response-nonce"),
|
|
3723
|
-
if (!_ || _ !==
|
|
3724
|
-
throw new
|
|
3725
|
-
const A = Number(a(c, "x-response-timestamp")), O = Number(
|
|
3726
|
+
const _ = a(c, "x-response-nonce"), I = r == null ? void 0 : r["X-Request-Nonce"];
|
|
3727
|
+
if (!_ || _ !== I)
|
|
3728
|
+
throw new ft("Response nonce mismatch");
|
|
3729
|
+
const A = Number(a(c, "x-response-timestamp")), O = Number(kt()), Z = 60 * 60 * 24;
|
|
3726
3730
|
if (isNaN(A) || Math.abs(O - A) > Z)
|
|
3727
|
-
throw new
|
|
3731
|
+
throw new ft("Invalid response timestamp");
|
|
3728
3732
|
} catch (_) {
|
|
3729
|
-
const
|
|
3730
|
-
throw new
|
|
3733
|
+
const I = _ instanceof Error ? _.message : "Request validation failed";
|
|
3734
|
+
throw new ft(I);
|
|
3731
3735
|
}
|
|
3732
3736
|
let f = yield c.text();
|
|
3733
3737
|
try {
|
|
@@ -3746,7 +3750,7 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3746
3750
|
const o = yield s();
|
|
3747
3751
|
return yield i(o);
|
|
3748
3752
|
});
|
|
3749
|
-
},
|
|
3753
|
+
}, St = function(n, e, t) {
|
|
3750
3754
|
return E(this, null, function* () {
|
|
3751
3755
|
var s, r;
|
|
3752
3756
|
const {
|
|
@@ -3757,9 +3761,9 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3757
3761
|
} = e, d = `${n}/async`, f = `${n}/async/job`;
|
|
3758
3762
|
let _;
|
|
3759
3763
|
try {
|
|
3760
|
-
_ = yield T(this,
|
|
3764
|
+
_ = yield T(this, pe).call(this, d, V(V({}, t), i && { signal: i }));
|
|
3761
3765
|
} catch (O) {
|
|
3762
|
-
throw O instanceof Error && O.name === "AbortError" ? new
|
|
3766
|
+
throw O instanceof Error && O.name === "AbortError" ? new Ne({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : O;
|
|
3763
3767
|
}
|
|
3764
3768
|
if (!_.ok) {
|
|
3765
3769
|
const O = yield _.text().catch();
|
|
@@ -3772,55 +3776,55 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3772
3776
|
body: O
|
|
3773
3777
|
});
|
|
3774
3778
|
}
|
|
3775
|
-
const
|
|
3779
|
+
const I = yield _.json(), { job_id: A } = I;
|
|
3776
3780
|
if (!A)
|
|
3777
3781
|
throw new Error("Job ID not found in response");
|
|
3778
3782
|
return new Promise((O, Z) => E(this, null, function* () {
|
|
3779
|
-
const
|
|
3783
|
+
const W = setTimeout(() => {
|
|
3780
3784
|
Z(new Error("Job timed out"));
|
|
3781
|
-
}, c),
|
|
3785
|
+
}, c), te = (oe = 0) => E(this, null, function* () {
|
|
3782
3786
|
if (i != null && i.aborted) {
|
|
3783
|
-
clearTimeout(
|
|
3784
|
-
Z(new
|
|
3785
|
-
}).catch((
|
|
3786
|
-
Z(new
|
|
3787
|
+
clearTimeout(W), T(this, pe).call(this, `${f}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
3788
|
+
Z(new Ne({ canceled: !0 }));
|
|
3789
|
+
}).catch((N) => {
|
|
3790
|
+
Z(new Ne({ canceled: !1 }));
|
|
3787
3791
|
});
|
|
3788
3792
|
return;
|
|
3789
3793
|
}
|
|
3790
3794
|
try {
|
|
3791
|
-
const
|
|
3792
|
-
if (
|
|
3793
|
-
clearTimeout(
|
|
3794
|
-
const
|
|
3795
|
-
O(
|
|
3796
|
-
} else if (
|
|
3797
|
-
clearTimeout(
|
|
3795
|
+
const N = yield (yield T(this, pe).call(this, `${f}/${A}`, { headers: this.headers })).json();
|
|
3796
|
+
if (N.status === "success") {
|
|
3797
|
+
clearTimeout(W);
|
|
3798
|
+
const ne = N.response_json;
|
|
3799
|
+
O(ne);
|
|
3800
|
+
} else if (N.status === "failed")
|
|
3801
|
+
clearTimeout(W), Z(new kr(N.response_json));
|
|
3798
3802
|
else {
|
|
3799
|
-
a && a(
|
|
3800
|
-
const
|
|
3801
|
-
setTimeout(() =>
|
|
3803
|
+
a && a(N.response_json);
|
|
3804
|
+
const ne = o(oe);
|
|
3805
|
+
setTimeout(() => te(oe + 1), ne);
|
|
3802
3806
|
}
|
|
3803
|
-
} catch (
|
|
3804
|
-
Z(
|
|
3807
|
+
} catch (N) {
|
|
3808
|
+
Z(N);
|
|
3805
3809
|
}
|
|
3806
3810
|
});
|
|
3807
|
-
|
|
3811
|
+
te();
|
|
3808
3812
|
}));
|
|
3809
3813
|
});
|
|
3810
|
-
},
|
|
3814
|
+
}, je = function(n, e, t, s, r) {
|
|
3811
3815
|
return E(this, null, function* () {
|
|
3812
3816
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
3813
3817
|
let c = i != null ? i : this.headers;
|
|
3814
|
-
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c =
|
|
3818
|
+
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Ot(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": kt() }));
|
|
3815
3819
|
let d = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
3816
|
-
return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield
|
|
3820
|
+
return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield X(this, G, St).call(this, `${o}${n}`, r.async, {
|
|
3817
3821
|
method: e,
|
|
3818
3822
|
headers: c,
|
|
3819
3823
|
body: d
|
|
3820
|
-
}) : yield
|
|
3824
|
+
}) : yield X(this, G, Tt).call(this, `${o}${n}`, r, { method: e, headers: c, body: d });
|
|
3821
3825
|
});
|
|
3822
3826
|
};
|
|
3823
|
-
const Bt = (n, e, t, s) => n instanceof
|
|
3827
|
+
const Bt = (n, e, t, s) => n instanceof Ne ? n : new xr({ resource: e, api: String(t), args: s, cause: n }), ht = (n, e) => new Proxy(e, {
|
|
3824
3828
|
get(t, s) {
|
|
3825
3829
|
return (...r) => {
|
|
3826
3830
|
var a;
|
|
@@ -3841,36 +3845,36 @@ const Bt = (n, e, t, s) => n instanceof je ? n : new xr({ resource: e, api: Stri
|
|
|
3841
3845
|
};
|
|
3842
3846
|
}
|
|
3843
3847
|
});
|
|
3844
|
-
var
|
|
3848
|
+
var Re;
|
|
3845
3849
|
class Ar {
|
|
3846
3850
|
constructor(e) {
|
|
3847
|
-
|
|
3851
|
+
z(this, Re), this.resourceName = "Files", j(this, Re, e);
|
|
3848
3852
|
}
|
|
3849
3853
|
get(e) {
|
|
3850
3854
|
return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
3851
3855
|
const r = new URLSearchParams(V({
|
|
3852
3856
|
plugin_data: "857346721138427857"
|
|
3853
3857
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
3854
|
-
return yield T(this,
|
|
3858
|
+
return yield T(this, Re).get(a);
|
|
3855
3859
|
});
|
|
3856
3860
|
}
|
|
3857
3861
|
getImageFills(e) {
|
|
3858
3862
|
return E(this, arguments, function* ({ fileKey: t }) {
|
|
3859
3863
|
var s, r;
|
|
3860
3864
|
const a = `v1/files/${t}/images`;
|
|
3861
|
-
return (r = (s = (yield T(this,
|
|
3865
|
+
return (r = (s = (yield T(this, Re).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
3862
3866
|
});
|
|
3863
3867
|
}
|
|
3864
3868
|
}
|
|
3865
|
-
|
|
3869
|
+
Re = /* @__PURE__ */ new WeakMap();
|
|
3866
3870
|
const Or = (n, e, t) => {
|
|
3867
3871
|
const s = e.sort();
|
|
3868
3872
|
return `${n}-${s.join("-")}-${t}`;
|
|
3869
3873
|
}, Cr = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
3870
|
-
var
|
|
3874
|
+
var K, Et, dn;
|
|
3871
3875
|
class Ir {
|
|
3872
3876
|
constructor(e) {
|
|
3873
|
-
|
|
3877
|
+
z(this, Et), z(this, K), this.resourceName = "Images", j(this, K, e);
|
|
3874
3878
|
}
|
|
3875
3879
|
/**
|
|
3876
3880
|
* Return the URL for the _layer_ images for the given nodes.
|
|
@@ -3878,29 +3882,29 @@ class Ir {
|
|
|
3878
3882
|
*/
|
|
3879
3883
|
get(e) {
|
|
3880
3884
|
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
3881
|
-
const i = Or(t, s, r), o = T(this,
|
|
3885
|
+
const i = Or(t, s, r), o = T(this, K).cache.images.entries.get(i);
|
|
3882
3886
|
if (Cr(o))
|
|
3883
3887
|
return o.result;
|
|
3884
|
-
o && T(this,
|
|
3885
|
-
const c = T(this,
|
|
3888
|
+
o && T(this, K).cache.images.entries.delete(i);
|
|
3889
|
+
const c = T(this, K).cache.images.pendingRequests.get(i);
|
|
3886
3890
|
if (c)
|
|
3887
3891
|
return c;
|
|
3888
|
-
const d =
|
|
3889
|
-
T(this,
|
|
3892
|
+
const d = X(this, Et, dn).call(this, i, t, s, r, a);
|
|
3893
|
+
T(this, K).cache.images.pendingRequests.set(i, d);
|
|
3890
3894
|
try {
|
|
3891
3895
|
return yield d;
|
|
3892
3896
|
} finally {
|
|
3893
|
-
T(this,
|
|
3897
|
+
T(this, K).cache.images.pendingRequests.delete(i);
|
|
3894
3898
|
}
|
|
3895
3899
|
});
|
|
3896
3900
|
}
|
|
3897
3901
|
}
|
|
3898
|
-
|
|
3902
|
+
K = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakSet(), dn = function(n, e, t, s, r) {
|
|
3899
3903
|
return E(this, null, function* () {
|
|
3900
|
-
const a = yield T(this,
|
|
3904
|
+
const a = yield T(this, K).get(
|
|
3901
3905
|
`v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
3902
3906
|
);
|
|
3903
|
-
return T(this,
|
|
3907
|
+
return T(this, K).cache.images.entries.set(n, {
|
|
3904
3908
|
result: a,
|
|
3905
3909
|
ts: Date.now()
|
|
3906
3910
|
}), a;
|
|
@@ -3909,11 +3913,11 @@ Y = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), dn = func
|
|
|
3909
3913
|
var Ye;
|
|
3910
3914
|
class Nr {
|
|
3911
3915
|
constructor(e) {
|
|
3912
|
-
|
|
3916
|
+
z(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
|
|
3913
3917
|
}
|
|
3914
3918
|
get(e) {
|
|
3915
3919
|
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
3916
|
-
const a =
|
|
3920
|
+
const a = Ot(V({}, r), {
|
|
3917
3921
|
ids: s.join(",")
|
|
3918
3922
|
}), i = new URLSearchParams(V({
|
|
3919
3923
|
plugin_data: "857346721138427857"
|
|
@@ -3923,36 +3927,36 @@ class Nr {
|
|
|
3923
3927
|
}
|
|
3924
3928
|
}
|
|
3925
3929
|
Ye = /* @__PURE__ */ new WeakMap();
|
|
3926
|
-
var
|
|
3930
|
+
var ce;
|
|
3927
3931
|
class ln extends Er {
|
|
3928
3932
|
constructor({
|
|
3929
3933
|
baseAddress: e = "https://api.figma.com/",
|
|
3930
3934
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
3931
3935
|
} = {}) {
|
|
3932
|
-
super({ fetch: t, baseAddress: e }),
|
|
3936
|
+
super({ fetch: t, baseAddress: e }), z(this, ce, ""), this.cache = {
|
|
3933
3937
|
images: {
|
|
3934
3938
|
entries: /* @__PURE__ */ new Map(),
|
|
3935
3939
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
3936
3940
|
}
|
|
3937
|
-
}, this.files =
|
|
3941
|
+
}, this.files = ht(this, new Ar(this)), this.nodes = ht(this, new Nr(this)), this.images = ht(this, new Ir(this));
|
|
3938
3942
|
}
|
|
3939
3943
|
set token(e) {
|
|
3940
3944
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
3941
3945
|
throw new Error("Invalid Figma access token");
|
|
3942
|
-
j(this,
|
|
3946
|
+
j(this, ce, e);
|
|
3943
3947
|
}
|
|
3944
3948
|
get token() {
|
|
3945
|
-
return T(this,
|
|
3949
|
+
return T(this, ce);
|
|
3946
3950
|
}
|
|
3947
3951
|
get headers() {
|
|
3948
3952
|
const e = {
|
|
3949
3953
|
"Content-Type": "application/json"
|
|
3950
3954
|
};
|
|
3951
|
-
return T(this,
|
|
3955
|
+
return T(this, ce).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = T(this, ce) : T(this, ce).startsWith("figu_") && (e.Authorization = `Bearer ${T(this, ce)}`), e;
|
|
3952
3956
|
}
|
|
3953
3957
|
}
|
|
3954
|
-
|
|
3955
|
-
const Vr = (r) =>
|
|
3958
|
+
ce = /* @__PURE__ */ new WeakMap();
|
|
3959
|
+
const Vr = (r) => P(void 0, [r], function* ({
|
|
3956
3960
|
fileKey: n,
|
|
3957
3961
|
authToken: e,
|
|
3958
3962
|
figmaRestApi: t = new ln(),
|
|
@@ -3967,7 +3971,7 @@ const Vr = (r) => F(void 0, [r], function* ({
|
|
|
3967
3971
|
} catch (a) {
|
|
3968
3972
|
throw console.error(a), a;
|
|
3969
3973
|
}
|
|
3970
|
-
}), Ur = (a) =>
|
|
3974
|
+
}), Ur = (a) => P(void 0, [a], function* ({
|
|
3971
3975
|
fileKey: n,
|
|
3972
3976
|
authToken: e,
|
|
3973
3977
|
nodeIds: t,
|
|
@@ -4009,26 +4013,26 @@ const Vr = (r) => F(void 0, [r], function* ({
|
|
|
4009
4013
|
}), t.close();
|
|
4010
4014
|
});
|
|
4011
4015
|
}
|
|
4012
|
-
}), zr = (n, e) =>
|
|
4013
|
-
var c, d, f, _,
|
|
4016
|
+
}), zr = (n, e) => P(void 0, null, function* () {
|
|
4017
|
+
var c, d, f, _, I, A, O;
|
|
4014
4018
|
const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
4015
4019
|
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (d = a.value) == null ? void 0 : d.payload) != null && f.status))
|
|
4016
4020
|
return new Response(JSON.stringify(a.value), {
|
|
4017
|
-
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (
|
|
4021
|
+
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (I = a.value) == null ? void 0 : I.payload) == null ? void 0 : A.status) != null ? O : 500,
|
|
4018
4022
|
headers: {
|
|
4019
4023
|
"Content-Type": "application/json"
|
|
4020
4024
|
}
|
|
4021
4025
|
});
|
|
4022
4026
|
const i = new TextEncoder(), o = r.pipeThrough(
|
|
4023
4027
|
new TransformStream({
|
|
4024
|
-
transform(Z,
|
|
4025
|
-
const
|
|
4028
|
+
transform(Z, W) {
|
|
4029
|
+
const te = `event: ${Z.type}
|
|
4026
4030
|
data: ${JSON.stringify(
|
|
4027
4031
|
Z
|
|
4028
4032
|
)}
|
|
4029
4033
|
|
|
4030
4034
|
`;
|
|
4031
|
-
|
|
4035
|
+
W.enqueue(i.encode(te));
|
|
4032
4036
|
}
|
|
4033
4037
|
})
|
|
4034
4038
|
);
|
|
@@ -4043,7 +4047,7 @@ data: ${JSON.stringify(
|
|
|
4043
4047
|
});
|
|
4044
4048
|
export {
|
|
4045
4049
|
Zr as Anima,
|
|
4046
|
-
|
|
4050
|
+
Ae as CodegenError,
|
|
4047
4051
|
Is as FigmaTokenIssue,
|
|
4048
4052
|
js as NotFound,
|
|
4049
4053
|
Ns as RateLimitExceeded,
|