@animaapp/anima-sdk 0.2.2 → 0.2.4
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 +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +654 -646
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anima.ts +8 -0
- package/src/settings.ts +4 -0
- package/src/types.ts +36 -34
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var mn = Object.prototype.hasOwnProperty, yn = Object.prototype.propertyIsEnumer
|
|
|
5
5
|
var Zt = (n) => {
|
|
6
6
|
throw TypeError(n);
|
|
7
7
|
};
|
|
8
|
-
var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t,
|
|
8
|
+
var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, u = (n, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
10
|
mn.call(e, t) && Rt(n, t, e[t]);
|
|
11
11
|
if (jt)
|
|
@@ -14,24 +14,24 @@ 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 K = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ot = (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), ct = (n, e, t, s) => (Mt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
|
|
18
|
+
var F = (n, e, t) => new Promise((s, r) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
22
|
-
} catch (
|
|
23
|
-
r(
|
|
22
|
+
} catch (d) {
|
|
23
|
+
r(d);
|
|
24
24
|
}
|
|
25
25
|
}, i = (c) => {
|
|
26
26
|
try {
|
|
27
27
|
o(t.throw(c));
|
|
28
|
-
} catch (
|
|
29
|
-
r(
|
|
28
|
+
} catch (d) {
|
|
29
|
+
r(d);
|
|
30
30
|
}
|
|
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 Oe 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
|
}
|
|
@@ -72,10 +72,10 @@ var x;
|
|
|
72
72
|
}
|
|
73
73
|
n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
74
74
|
})(x || (x = {}));
|
|
75
|
-
var
|
|
75
|
+
var ht;
|
|
76
76
|
(function(n) {
|
|
77
|
-
n.mergeShapes = (e, t) =>
|
|
78
|
-
})(
|
|
77
|
+
n.mergeShapes = (e, t) => u(u({}, e), t);
|
|
78
|
+
})(ht || (ht = {}));
|
|
79
79
|
const p = x.arrayToEnum([
|
|
80
80
|
"string",
|
|
81
81
|
"nan",
|
|
@@ -97,7 +97,7 @@ const p = x.arrayToEnum([
|
|
|
97
97
|
"never",
|
|
98
98
|
"map",
|
|
99
99
|
"set"
|
|
100
|
-
]),
|
|
100
|
+
]), ie = (n) => {
|
|
101
101
|
switch (typeof n) {
|
|
102
102
|
case "undefined":
|
|
103
103
|
return p.undefined;
|
|
@@ -165,8 +165,8 @@ class U extends Error {
|
|
|
165
165
|
else {
|
|
166
166
|
let o = s, c = 0;
|
|
167
167
|
for (; c < i.path.length; ) {
|
|
168
|
-
const
|
|
169
|
-
c === i.path.length - 1 ? (o[
|
|
168
|
+
const d = i.path[c];
|
|
169
|
+
c === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], c++;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
};
|
|
@@ -196,7 +196,7 @@ class U extends Error {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
U.create = (n) => new U(n);
|
|
199
|
-
const
|
|
199
|
+
const Te = (n, e) => {
|
|
200
200
|
let t;
|
|
201
201
|
switch (n.code) {
|
|
202
202
|
case l.invalid_type:
|
|
@@ -252,33 +252,33 @@ const ke = (n, e) => {
|
|
|
252
252
|
}
|
|
253
253
|
return { message: t };
|
|
254
254
|
};
|
|
255
|
-
let qt =
|
|
255
|
+
let qt = Te;
|
|
256
256
|
function vn(n) {
|
|
257
257
|
qt = n;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Qe() {
|
|
260
260
|
return qt;
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = y(
|
|
262
|
+
const et = (n) => {
|
|
263
|
+
const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = y(u({}, r), {
|
|
264
264
|
path: a
|
|
265
265
|
});
|
|
266
266
|
if (r.message !== void 0)
|
|
267
|
-
return y(
|
|
267
|
+
return y(u({}, r), {
|
|
268
268
|
path: a,
|
|
269
269
|
message: r.message
|
|
270
270
|
});
|
|
271
271
|
let o = "";
|
|
272
|
-
const c = s.filter((
|
|
273
|
-
for (const
|
|
274
|
-
o =
|
|
275
|
-
return y(
|
|
272
|
+
const c = s.filter((d) => !!d).slice().reverse();
|
|
273
|
+
for (const d of c)
|
|
274
|
+
o = d(i, { data: e, defaultError: o }).message;
|
|
275
|
+
return y(u({}, r), {
|
|
276
276
|
path: a,
|
|
277
277
|
message: o
|
|
278
278
|
});
|
|
279
279
|
}, _n = [];
|
|
280
280
|
function h(n, e) {
|
|
281
|
-
const t =
|
|
281
|
+
const t = Qe(), s = et({
|
|
282
282
|
issueData: e,
|
|
283
283
|
data: n.data,
|
|
284
284
|
path: n.path,
|
|
@@ -289,13 +289,13 @@ 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 === Te ? void 0 : Te
|
|
293
293
|
// then global default map
|
|
294
294
|
].filter((r) => !!r)
|
|
295
295
|
});
|
|
296
296
|
n.common.issues.push(s);
|
|
297
297
|
}
|
|
298
|
-
class
|
|
298
|
+
class R {
|
|
299
299
|
constructor() {
|
|
300
300
|
this.value = "valid";
|
|
301
301
|
}
|
|
@@ -315,7 +315,7 @@ class j {
|
|
|
315
315
|
return { status: e.value, value: s };
|
|
316
316
|
}
|
|
317
317
|
static mergeObjectAsync(e, t) {
|
|
318
|
-
return
|
|
318
|
+
return F(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;
|
|
@@ -324,7 +324,7 @@ class j {
|
|
|
324
324
|
value: i
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
|
-
return
|
|
327
|
+
return R.mergeObjectSync(e, s);
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
static mergeObjectSync(e, t) {
|
|
@@ -340,8 +340,8 @@ class j {
|
|
|
340
340
|
}
|
|
341
341
|
const v = Object.freeze({
|
|
342
342
|
status: "aborted"
|
|
343
|
-
}),
|
|
344
|
-
function
|
|
343
|
+
}), xe = (n) => ({ status: "dirty", value: n }), $ = (n) => ({ status: "valid", value: n }), pt = (n) => n.status === "aborted", mt = (n) => n.status === "dirty", ge = (n) => n.status === "valid", Me = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
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);
|
|
347
347
|
}
|
|
@@ -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 Ie, Ne;
|
|
357
|
+
class te {
|
|
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
|
}
|
|
@@ -384,9 +384,9 @@ function b(n) {
|
|
|
384
384
|
if (e && (t || s))
|
|
385
385
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
386
386
|
return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
|
|
387
|
-
var c,
|
|
387
|
+
var c, d;
|
|
388
388
|
const { message: f } = n;
|
|
389
|
-
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (
|
|
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
392
|
class w {
|
|
@@ -394,13 +394,13 @@ class w {
|
|
|
394
394
|
return this._def.description;
|
|
395
395
|
}
|
|
396
396
|
_getType(e) {
|
|
397
|
-
return
|
|
397
|
+
return ie(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: ie(e.data),
|
|
404
404
|
schemaErrorMap: this._def.errorMap,
|
|
405
405
|
path: e.path,
|
|
406
406
|
parent: e.parent
|
|
@@ -408,11 +408,11 @@ class w {
|
|
|
408
408
|
}
|
|
409
409
|
_processInputParams(e) {
|
|
410
410
|
return {
|
|
411
|
-
status: new
|
|
411
|
+
status: new R(),
|
|
412
412
|
ctx: {
|
|
413
413
|
common: e.parent.common,
|
|
414
414
|
data: e.data,
|
|
415
|
-
parsedType:
|
|
415
|
+
parsedType: ie(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 (Me(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: ie(e)
|
|
451
451
|
}, a = this._parseSync({ data: e, path: r.path, parent: r });
|
|
452
452
|
return $t(r, a);
|
|
453
453
|
}
|
|
@@ -462,7 +462,7 @@ class w {
|
|
|
462
462
|
schemaErrorMap: this._def.errorMap,
|
|
463
463
|
parent: null,
|
|
464
464
|
data: e,
|
|
465
|
-
parsedType:
|
|
465
|
+
parsedType: ie(e)
|
|
466
466
|
};
|
|
467
467
|
if (!this["~standard"].async)
|
|
468
468
|
try {
|
|
@@ -485,7 +485,7 @@ class w {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
parseAsync(e, t) {
|
|
488
|
-
return
|
|
488
|
+
return F(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 F(this, null, function* () {
|
|
497
497
|
const s = {
|
|
498
498
|
common: {
|
|
499
499
|
issues: [],
|
|
@@ -504,15 +504,15 @@ 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: ie(e)
|
|
508
|
+
}, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Me(r) ? r : Promise.resolve(r);
|
|
509
509
|
return $t(s, a);
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
refine(e, t) {
|
|
513
513
|
const s = (r) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(r) : t;
|
|
514
514
|
return this._refinement((r, a) => {
|
|
515
|
-
const i = e(r), o = () => a.addIssue(
|
|
515
|
+
const i = e(r), o = () => a.addIssue(u({
|
|
516
516
|
code: l.custom
|
|
517
517
|
}, s(r)));
|
|
518
518
|
return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
@@ -539,7 +539,7 @@ class w {
|
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
541
|
optional() {
|
|
542
|
-
return
|
|
542
|
+
return ee.create(this, this._def);
|
|
543
543
|
}
|
|
544
544
|
nullable() {
|
|
545
545
|
return he.create(this, this._def);
|
|
@@ -551,16 +551,16 @@ class w {
|
|
|
551
551
|
return J.create(this);
|
|
552
552
|
}
|
|
553
553
|
promise() {
|
|
554
|
-
return
|
|
554
|
+
return Ae.create(this, this._def);
|
|
555
555
|
}
|
|
556
556
|
or(e) {
|
|
557
|
-
return
|
|
557
|
+
return Le.create([this, e], this._def);
|
|
558
558
|
}
|
|
559
559
|
and(e) {
|
|
560
|
-
return
|
|
560
|
+
return De.create(this, e, this._def);
|
|
561
561
|
}
|
|
562
562
|
transform(e) {
|
|
563
|
-
return new G(y(
|
|
563
|
+
return new G(y(u({}, b(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 Be(y(u({}, b(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
|
}, b(this._def)));
|
|
582
582
|
}
|
|
583
583
|
catch(e) {
|
|
584
584
|
const t = typeof e == "function" ? e : () => e;
|
|
585
|
-
return new
|
|
585
|
+
return new qe(y(u({}, b(this._def)), {
|
|
586
586
|
innerType: this,
|
|
587
587
|
catchValue: t,
|
|
588
588
|
typeName: g.ZodCatch
|
|
@@ -590,15 +590,15 @@ class w {
|
|
|
590
590
|
}
|
|
591
591
|
describe(e) {
|
|
592
592
|
const t = this.constructor;
|
|
593
|
-
return new t(y(
|
|
593
|
+
return new t(y(u({}, this._def), {
|
|
594
594
|
description: e
|
|
595
595
|
}));
|
|
596
596
|
}
|
|
597
597
|
pipe(e) {
|
|
598
|
-
return
|
|
598
|
+
return Ge.create(this, e);
|
|
599
599
|
}
|
|
600
600
|
readonly() {
|
|
601
|
-
return
|
|
601
|
+
return He.create(this);
|
|
602
602
|
}
|
|
603
603
|
isOptional() {
|
|
604
604
|
return this.safeParse(void 0).success;
|
|
@@ -607,8 +607,8 @@ class w {
|
|
|
607
607
|
return this.safeParse(null).success;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
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-_]*$/,
|
|
611
|
-
let
|
|
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-_]*$/, An = /^[-+]?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)?)??$/, En = /^(?!\.)(?!.*\.\.)([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 ut;
|
|
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";
|
|
@@ -648,7 +648,7 @@ class H extends w {
|
|
|
648
648
|
received: a.parsedType
|
|
649
649
|
}), v;
|
|
650
650
|
}
|
|
651
|
-
const s = new
|
|
651
|
+
const s = new R();
|
|
652
652
|
let r;
|
|
653
653
|
for (const a of this._def.checks)
|
|
654
654
|
if (a.kind === "min")
|
|
@@ -687,13 +687,13 @@ class H extends w {
|
|
|
687
687
|
message: a.message
|
|
688
688
|
}), s.dirty());
|
|
689
689
|
} else if (a.kind === "email")
|
|
690
|
-
|
|
690
|
+
En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
691
691
|
validation: "email",
|
|
692
692
|
code: l.invalid_string,
|
|
693
693
|
message: a.message
|
|
694
694
|
}), s.dirty());
|
|
695
695
|
else if (a.kind === "emoji")
|
|
696
|
-
|
|
696
|
+
ut || (ut = new RegExp(On, "u")), ut.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
|
|
@@ -766,7 +766,7 @@ class H extends w {
|
|
|
766
766
|
code: l.invalid_string,
|
|
767
767
|
validation: "time",
|
|
768
768
|
message: a.message
|
|
769
|
-
}), s.dirty()) : a.kind === "duration" ?
|
|
769
|
+
}), s.dirty()) : a.kind === "duration" ? An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
770
770
|
validation: "duration",
|
|
771
771
|
code: l.invalid_string,
|
|
772
772
|
message: a.message
|
|
@@ -794,56 +794,56 @@ class H extends w {
|
|
|
794
794
|
return { status: s.value, value: e.data };
|
|
795
795
|
}
|
|
796
796
|
_regex(e, t, s) {
|
|
797
|
-
return this.refinement((r) => e.test(r),
|
|
797
|
+
return this.refinement((r) => e.test(r), u({
|
|
798
798
|
validation: t,
|
|
799
799
|
code: l.invalid_string
|
|
800
800
|
}, m.errToObj(s)));
|
|
801
801
|
}
|
|
802
802
|
_addCheck(e) {
|
|
803
|
-
return new H(y(
|
|
803
|
+
return new H(y(u({}, this._def), {
|
|
804
804
|
checks: [...this._def.checks, e]
|
|
805
805
|
}));
|
|
806
806
|
}
|
|
807
807
|
email(e) {
|
|
808
|
-
return this._addCheck(
|
|
808
|
+
return this._addCheck(u({ kind: "email" }, m.errToObj(e)));
|
|
809
809
|
}
|
|
810
810
|
url(e) {
|
|
811
|
-
return this._addCheck(
|
|
811
|
+
return this._addCheck(u({ kind: "url" }, m.errToObj(e)));
|
|
812
812
|
}
|
|
813
813
|
emoji(e) {
|
|
814
|
-
return this._addCheck(
|
|
814
|
+
return this._addCheck(u({ kind: "emoji" }, m.errToObj(e)));
|
|
815
815
|
}
|
|
816
816
|
uuid(e) {
|
|
817
|
-
return this._addCheck(
|
|
817
|
+
return this._addCheck(u({ kind: "uuid" }, m.errToObj(e)));
|
|
818
818
|
}
|
|
819
819
|
nanoid(e) {
|
|
820
|
-
return this._addCheck(
|
|
820
|
+
return this._addCheck(u({ kind: "nanoid" }, m.errToObj(e)));
|
|
821
821
|
}
|
|
822
822
|
cuid(e) {
|
|
823
|
-
return this._addCheck(
|
|
823
|
+
return this._addCheck(u({ kind: "cuid" }, m.errToObj(e)));
|
|
824
824
|
}
|
|
825
825
|
cuid2(e) {
|
|
826
|
-
return this._addCheck(
|
|
826
|
+
return this._addCheck(u({ kind: "cuid2" }, m.errToObj(e)));
|
|
827
827
|
}
|
|
828
828
|
ulid(e) {
|
|
829
|
-
return this._addCheck(
|
|
829
|
+
return this._addCheck(u({ kind: "ulid" }, m.errToObj(e)));
|
|
830
830
|
}
|
|
831
831
|
base64(e) {
|
|
832
|
-
return this._addCheck(
|
|
832
|
+
return this._addCheck(u({ kind: "base64" }, m.errToObj(e)));
|
|
833
833
|
}
|
|
834
834
|
base64url(e) {
|
|
835
|
-
return this._addCheck(
|
|
835
|
+
return this._addCheck(u({
|
|
836
836
|
kind: "base64url"
|
|
837
837
|
}, m.errToObj(e)));
|
|
838
838
|
}
|
|
839
839
|
jwt(e) {
|
|
840
|
-
return this._addCheck(
|
|
840
|
+
return this._addCheck(u({ kind: "jwt" }, m.errToObj(e)));
|
|
841
841
|
}
|
|
842
842
|
ip(e) {
|
|
843
|
-
return this._addCheck(
|
|
843
|
+
return this._addCheck(u({ kind: "ip" }, m.errToObj(e)));
|
|
844
844
|
}
|
|
845
845
|
cidr(e) {
|
|
846
|
-
return this._addCheck(
|
|
846
|
+
return this._addCheck(u({ kind: "cidr" }, m.errToObj(e)));
|
|
847
847
|
}
|
|
848
848
|
datetime(e) {
|
|
849
849
|
var t, s;
|
|
@@ -853,7 +853,7 @@ class H extends w {
|
|
|
853
853
|
offset: !1,
|
|
854
854
|
local: !1,
|
|
855
855
|
message: e
|
|
856
|
-
}) : this._addCheck(
|
|
856
|
+
}) : this._addCheck(u({
|
|
857
857
|
kind: "datetime",
|
|
858
858
|
precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision,
|
|
859
859
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
@@ -868,53 +868,53 @@ class H extends w {
|
|
|
868
868
|
kind: "time",
|
|
869
869
|
precision: null,
|
|
870
870
|
message: e
|
|
871
|
-
}) : this._addCheck(
|
|
871
|
+
}) : this._addCheck(u({
|
|
872
872
|
kind: "time",
|
|
873
873
|
precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision
|
|
874
874
|
}, m.errToObj(e == null ? void 0 : e.message)));
|
|
875
875
|
}
|
|
876
876
|
duration(e) {
|
|
877
|
-
return this._addCheck(
|
|
877
|
+
return this._addCheck(u({ kind: "duration" }, m.errToObj(e)));
|
|
878
878
|
}
|
|
879
879
|
regex(e, t) {
|
|
880
|
-
return this._addCheck(
|
|
880
|
+
return this._addCheck(u({
|
|
881
881
|
kind: "regex",
|
|
882
882
|
regex: e
|
|
883
883
|
}, m.errToObj(t)));
|
|
884
884
|
}
|
|
885
885
|
includes(e, t) {
|
|
886
|
-
return this._addCheck(
|
|
886
|
+
return this._addCheck(u({
|
|
887
887
|
kind: "includes",
|
|
888
888
|
value: e,
|
|
889
889
|
position: t == null ? void 0 : t.position
|
|
890
890
|
}, m.errToObj(t == null ? void 0 : t.message)));
|
|
891
891
|
}
|
|
892
892
|
startsWith(e, t) {
|
|
893
|
-
return this._addCheck(
|
|
893
|
+
return this._addCheck(u({
|
|
894
894
|
kind: "startsWith",
|
|
895
895
|
value: e
|
|
896
896
|
}, m.errToObj(t)));
|
|
897
897
|
}
|
|
898
898
|
endsWith(e, t) {
|
|
899
|
-
return this._addCheck(
|
|
899
|
+
return this._addCheck(u({
|
|
900
900
|
kind: "endsWith",
|
|
901
901
|
value: e
|
|
902
902
|
}, m.errToObj(t)));
|
|
903
903
|
}
|
|
904
904
|
min(e, t) {
|
|
905
|
-
return this._addCheck(
|
|
905
|
+
return this._addCheck(u({
|
|
906
906
|
kind: "min",
|
|
907
907
|
value: e
|
|
908
908
|
}, m.errToObj(t)));
|
|
909
909
|
}
|
|
910
910
|
max(e, t) {
|
|
911
|
-
return this._addCheck(
|
|
911
|
+
return this._addCheck(u({
|
|
912
912
|
kind: "max",
|
|
913
913
|
value: e
|
|
914
914
|
}, m.errToObj(t)));
|
|
915
915
|
}
|
|
916
916
|
length(e, t) {
|
|
917
|
-
return this._addCheck(
|
|
917
|
+
return this._addCheck(u({
|
|
918
918
|
kind: "length",
|
|
919
919
|
value: e
|
|
920
920
|
}, m.errToObj(t)));
|
|
@@ -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 H(y(
|
|
929
|
+
return new H(y(u({}, this._def), {
|
|
930
930
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
931
931
|
}));
|
|
932
932
|
}
|
|
933
933
|
toLowerCase() {
|
|
934
|
-
return new H(y(
|
|
934
|
+
return new H(y(u({}, this._def), {
|
|
935
935
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
936
936
|
}));
|
|
937
937
|
}
|
|
938
938
|
toUpperCase() {
|
|
939
|
-
return new H(y(
|
|
939
|
+
return new H(y(u({}, this._def), {
|
|
940
940
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
941
941
|
}));
|
|
942
942
|
}
|
|
@@ -1003,7 +1003,7 @@ class H extends w {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
H.create = (n) => {
|
|
1005
1005
|
var e;
|
|
1006
|
-
return new H(
|
|
1006
|
+
return new H(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
|
|
@@ -1013,7 +1013,7 @@ 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 de extends w {
|
|
1017
1017
|
constructor() {
|
|
1018
1018
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1019
1019
|
}
|
|
@@ -1027,7 +1027,7 @@ class ue extends w {
|
|
|
1027
1027
|
}), v;
|
|
1028
1028
|
}
|
|
1029
1029
|
let s;
|
|
1030
|
-
const r = new
|
|
1030
|
+
const r = new R();
|
|
1031
1031
|
for (const a of this._def.checks)
|
|
1032
1032
|
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1033
1033
|
code: l.invalid_type,
|
|
@@ -1071,7 +1071,7 @@ class ue 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 de(y(u({}, this._def), {
|
|
1075
1075
|
checks: [
|
|
1076
1076
|
...this._def.checks,
|
|
1077
1077
|
{
|
|
@@ -1084,7 +1084,7 @@ class ue extends w {
|
|
|
1084
1084
|
}));
|
|
1085
1085
|
}
|
|
1086
1086
|
_addCheck(e) {
|
|
1087
|
-
return new
|
|
1087
|
+
return new de(y(u({}, this._def), {
|
|
1088
1088
|
checks: [...this._def.checks, e]
|
|
1089
1089
|
}));
|
|
1090
1090
|
}
|
|
@@ -1177,7 +1177,7 @@ class ue extends w {
|
|
|
1177
1177
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
|
-
|
|
1180
|
+
de.create = (n) => new de(u({
|
|
1181
1181
|
checks: [],
|
|
1182
1182
|
typeName: g.ZodNumber,
|
|
1183
1183
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
@@ -1196,7 +1196,7 @@ class le extends w {
|
|
|
1196
1196
|
if (this._getType(e) !== p.bigint)
|
|
1197
1197
|
return this._getInvalidInput(e);
|
|
1198
1198
|
let s;
|
|
1199
|
-
const r = new
|
|
1199
|
+
const r = new R();
|
|
1200
1200
|
for (const a of this._def.checks)
|
|
1201
1201
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1202
1202
|
code: l.too_small,
|
|
@@ -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 le(y(
|
|
1241
|
+
return new le(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 le(y(
|
|
1254
|
+
return new le(y(u({}, this._def), {
|
|
1255
1255
|
checks: [...this._def.checks, e]
|
|
1256
1256
|
}));
|
|
1257
1257
|
}
|
|
@@ -1309,13 +1309,13 @@ class le extends w {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
le.create = (n) => {
|
|
1311
1311
|
var e;
|
|
1312
|
-
return new le(
|
|
1312
|
+
return new le(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
|
}, b(n)));
|
|
1317
1317
|
};
|
|
1318
|
-
class
|
|
1318
|
+
class $e extends w {
|
|
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);
|
|
@@ -1325,10 +1325,10 @@ class Me extends w {
|
|
|
1325
1325
|
received: s.parsedType
|
|
1326
1326
|
}), v;
|
|
1327
1327
|
}
|
|
1328
|
-
return
|
|
1328
|
+
return $(e.data);
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
|
-
|
|
1331
|
+
$e.create = (n) => new $e(u({
|
|
1332
1332
|
typeName: g.ZodBoolean,
|
|
1333
1333
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
1334
1334
|
}, b(n)));
|
|
@@ -1348,7 +1348,7 @@ class ve extends w {
|
|
|
1348
1348
|
code: l.invalid_date
|
|
1349
1349
|
}), v;
|
|
1350
1350
|
}
|
|
1351
|
-
const s = new
|
|
1351
|
+
const s = new R();
|
|
1352
1352
|
let r;
|
|
1353
1353
|
for (const a of this._def.checks)
|
|
1354
1354
|
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
@@ -1372,7 +1372,7 @@ class ve extends w {
|
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
1374
|
_addCheck(e) {
|
|
1375
|
-
return new ve(y(
|
|
1375
|
+
return new ve(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
|
-
ve.create = (n) => new ve(
|
|
1406
|
+
ve.create = (n) => new ve(u({
|
|
1407
1407
|
checks: [],
|
|
1408
1408
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1409
1409
|
typeName: g.ZodDate
|
|
1410
1410
|
}, b(n)));
|
|
1411
|
-
class
|
|
1411
|
+
class nt extends w {
|
|
1412
1412
|
_parse(e) {
|
|
1413
1413
|
if (this._getType(e) !== p.symbol) {
|
|
1414
1414
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1418,13 +1418,13 @@ class tt extends w {
|
|
|
1418
1418
|
received: s.parsedType
|
|
1419
1419
|
}), v;
|
|
1420
1420
|
}
|
|
1421
|
-
return
|
|
1421
|
+
return $(e.data);
|
|
1422
1422
|
}
|
|
1423
1423
|
}
|
|
1424
|
-
|
|
1424
|
+
nt.create = (n) => new nt(u({
|
|
1425
1425
|
typeName: g.ZodSymbol
|
|
1426
1426
|
}, b(n)));
|
|
1427
|
-
class
|
|
1427
|
+
class Pe extends w {
|
|
1428
1428
|
_parse(e) {
|
|
1429
1429
|
if (this._getType(e) !== p.undefined) {
|
|
1430
1430
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1434,13 +1434,13 @@ class $e extends w {
|
|
|
1434
1434
|
received: s.parsedType
|
|
1435
1435
|
}), v;
|
|
1436
1436
|
}
|
|
1437
|
-
return
|
|
1437
|
+
return $(e.data);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
|
|
1440
|
+
Pe.create = (n) => new Pe(u({
|
|
1441
1441
|
typeName: g.ZodUndefined
|
|
1442
1442
|
}, b(n)));
|
|
1443
|
-
class
|
|
1443
|
+
class Fe extends w {
|
|
1444
1444
|
_parse(e) {
|
|
1445
1445
|
if (this._getType(e) !== p.null) {
|
|
1446
1446
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1450,21 +1450,21 @@ class Pe extends w {
|
|
|
1450
1450
|
received: s.parsedType
|
|
1451
1451
|
}), v;
|
|
1452
1452
|
}
|
|
1453
|
-
return
|
|
1453
|
+
return $(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
|
|
1456
|
+
Fe.create = (n) => new Fe(u({
|
|
1457
1457
|
typeName: g.ZodNull
|
|
1458
1458
|
}, b(n)));
|
|
1459
|
-
class
|
|
1459
|
+
class Se extends w {
|
|
1460
1460
|
constructor() {
|
|
1461
1461
|
super(...arguments), this._any = !0;
|
|
1462
1462
|
}
|
|
1463
1463
|
_parse(e) {
|
|
1464
|
-
return
|
|
1464
|
+
return $(e.data);
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
|
|
1467
|
+
Se.create = (n) => new Se(u({
|
|
1468
1468
|
typeName: g.ZodAny
|
|
1469
1469
|
}, b(n)));
|
|
1470
1470
|
class ye extends w {
|
|
@@ -1472,13 +1472,13 @@ class ye extends w {
|
|
|
1472
1472
|
super(...arguments), this._unknown = !0;
|
|
1473
1473
|
}
|
|
1474
1474
|
_parse(e) {
|
|
1475
|
-
return
|
|
1475
|
+
return $(e.data);
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
1478
|
-
ye.create = (n) => new ye(
|
|
1478
|
+
ye.create = (n) => new ye(u({
|
|
1479
1479
|
typeName: g.ZodUnknown
|
|
1480
1480
|
}, b(n)));
|
|
1481
|
-
class
|
|
1481
|
+
class oe extends w {
|
|
1482
1482
|
_parse(e) {
|
|
1483
1483
|
const t = this._getOrReturnCtx(e);
|
|
1484
1484
|
return h(t, {
|
|
@@ -1488,10 +1488,10 @@ class ce extends w {
|
|
|
1488
1488
|
}), v;
|
|
1489
1489
|
}
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1491
|
+
oe.create = (n) => new oe(u({
|
|
1492
1492
|
typeName: g.ZodNever
|
|
1493
1493
|
}, b(n)));
|
|
1494
|
-
class
|
|
1494
|
+
class st extends w {
|
|
1495
1495
|
_parse(e) {
|
|
1496
1496
|
if (this._getType(e) !== p.undefined) {
|
|
1497
1497
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1501,10 +1501,10 @@ class nt extends w {
|
|
|
1501
1501
|
received: s.parsedType
|
|
1502
1502
|
}), v;
|
|
1503
1503
|
}
|
|
1504
|
-
return
|
|
1504
|
+
return $(e.data);
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
|
-
|
|
1507
|
+
st.create = (n) => new st(u({
|
|
1508
1508
|
typeName: g.ZodVoid
|
|
1509
1509
|
}, b(n)));
|
|
1510
1510
|
class J extends w {
|
|
@@ -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
|
|
1548
|
-
return
|
|
1546
|
+
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new te(t, i, t.path, o)))).then((i) => R.mergeArray(s, i));
|
|
1547
|
+
const a = [...t.data].map((i, o) => r.type._parseSync(new te(t, i, t.path, o)));
|
|
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 J(y(
|
|
1554
|
+
return new J(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 J(y(
|
|
1559
|
+
return new J(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 J(y(
|
|
1564
|
+
return new J(y(u({}, this._def), {
|
|
1565
1565
|
exactLength: { value: e, message: m.toString(t) }
|
|
1566
1566
|
}));
|
|
1567
1567
|
}
|
|
@@ -1569,26 +1569,26 @@ class J extends w {
|
|
|
1569
1569
|
return this.min(1, e);
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
J.create = (n, e) => new J(
|
|
1572
|
+
J.create = (n, e) => new J(u({
|
|
1573
1573
|
type: n,
|
|
1574
1574
|
minLength: null,
|
|
1575
1575
|
maxLength: null,
|
|
1576
1576
|
exactLength: null,
|
|
1577
1577
|
typeName: g.ZodArray
|
|
1578
1578
|
}, b(e)));
|
|
1579
|
-
function
|
|
1579
|
+
function we(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] = ee.create(we(s));
|
|
1585
1585
|
}
|
|
1586
|
-
return new S(y(
|
|
1586
|
+
return new S(y(u({}, n._def), {
|
|
1587
1587
|
shape: () => e
|
|
1588
1588
|
}));
|
|
1589
|
-
} else return n instanceof J ? new J(y(
|
|
1590
|
-
type:
|
|
1591
|
-
})) : n instanceof
|
|
1589
|
+
} else return n instanceof J ? new J(y(u({}, n._def), {
|
|
1590
|
+
type: we(n.element)
|
|
1591
|
+
})) : n instanceof ee ? ee.create(we(n.unwrap())) : n instanceof he ? he.create(we(n.unwrap())) : n instanceof ne ? ne.create(n.items.map((e) => we(e))) : n;
|
|
1592
1592
|
}
|
|
1593
1593
|
class S extends w {
|
|
1594
1594
|
constructor() {
|
|
@@ -1602,72 +1602,72 @@ class S extends w {
|
|
|
1602
1602
|
}
|
|
1603
1603
|
_parse(e) {
|
|
1604
1604
|
if (this._getType(e) !== p.object) {
|
|
1605
|
-
const
|
|
1606
|
-
return h(
|
|
1605
|
+
const d = this._getOrReturnCtx(e);
|
|
1606
|
+
return h(d, {
|
|
1607
1607
|
code: l.invalid_type,
|
|
1608
1608
|
expected: p.object,
|
|
1609
|
-
received:
|
|
1609
|
+
received: d.parsedType
|
|
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
|
|
1614
|
-
for (const
|
|
1615
|
-
i.includes(
|
|
1613
|
+
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
1614
|
+
for (const d in r.data)
|
|
1615
|
+
i.includes(d) || o.push(d);
|
|
1616
1616
|
const c = [];
|
|
1617
|
-
for (const
|
|
1618
|
-
const f = a[
|
|
1617
|
+
for (const d of i) {
|
|
1618
|
+
const f = a[d], _ = r.data[d];
|
|
1619
1619
|
c.push({
|
|
1620
|
-
key: { status: "valid", value:
|
|
1621
|
-
value: f._parse(new
|
|
1622
|
-
alwaysSet:
|
|
1620
|
+
key: { status: "valid", value: d },
|
|
1621
|
+
value: f._parse(new te(r, _, r.path, d)),
|
|
1622
|
+
alwaysSet: d in r.data
|
|
1623
1623
|
});
|
|
1624
1624
|
}
|
|
1625
|
-
if (this._def.catchall instanceof
|
|
1626
|
-
const
|
|
1627
|
-
if (
|
|
1625
|
+
if (this._def.catchall instanceof oe) {
|
|
1626
|
+
const d = this._def.unknownKeys;
|
|
1627
|
+
if (d === "passthrough")
|
|
1628
1628
|
for (const f of o)
|
|
1629
1629
|
c.push({
|
|
1630
1630
|
key: { status: "valid", value: f },
|
|
1631
1631
|
value: { status: "valid", value: r.data[f] }
|
|
1632
1632
|
});
|
|
1633
|
-
else if (
|
|
1633
|
+
else if (d === "strict")
|
|
1634
1634
|
o.length > 0 && (h(r, {
|
|
1635
1635
|
code: l.unrecognized_keys,
|
|
1636
1636
|
keys: o
|
|
1637
1637
|
}), s.dirty());
|
|
1638
|
-
else if (
|
|
1638
|
+
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1639
1639
|
} else {
|
|
1640
|
-
const
|
|
1640
|
+
const d = this._def.catchall;
|
|
1641
1641
|
for (const f of o) {
|
|
1642
1642
|
const _ = r.data[f];
|
|
1643
1643
|
c.push({
|
|
1644
1644
|
key: { status: "valid", value: f },
|
|
1645
|
-
value:
|
|
1646
|
-
new
|
|
1645
|
+
value: d._parse(
|
|
1646
|
+
new te(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(() =>
|
|
1654
|
-
const
|
|
1653
|
+
return r.common.async ? Promise.resolve().then(() => F(this, null, function* () {
|
|
1654
|
+
const d = [];
|
|
1655
1655
|
for (const f of c) {
|
|
1656
|
-
const _ = yield f.key,
|
|
1657
|
-
|
|
1656
|
+
const _ = yield f.key, I = yield f.value;
|
|
1657
|
+
d.push({
|
|
1658
1658
|
key: _,
|
|
1659
|
-
value:
|
|
1659
|
+
value: I,
|
|
1660
1660
|
alwaysSet: f.alwaysSet
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
1663
|
-
return
|
|
1664
|
-
})).then((
|
|
1663
|
+
return d;
|
|
1664
|
+
})).then((d) => R.mergeObjectSync(s, d)) : R.mergeObjectSync(s, c);
|
|
1665
1665
|
}
|
|
1666
1666
|
get shape() {
|
|
1667
1667
|
return this._def.shape();
|
|
1668
1668
|
}
|
|
1669
1669
|
strict(e) {
|
|
1670
|
-
return m.errToObj, new S(
|
|
1670
|
+
return m.errToObj, new S(u(y(u({}, this._def), {
|
|
1671
1671
|
unknownKeys: "strict"
|
|
1672
1672
|
}), e !== void 0 ? {
|
|
1673
1673
|
errorMap: (t, s) => {
|
|
@@ -1682,12 +1682,12 @@ class S extends w {
|
|
|
1682
1682
|
} : {}));
|
|
1683
1683
|
}
|
|
1684
1684
|
strip() {
|
|
1685
|
-
return new S(y(
|
|
1685
|
+
return new S(y(u({}, this._def), {
|
|
1686
1686
|
unknownKeys: "strip"
|
|
1687
1687
|
}));
|
|
1688
1688
|
}
|
|
1689
1689
|
passthrough() {
|
|
1690
|
-
return new S(y(
|
|
1690
|
+
return new S(y(u({}, this._def), {
|
|
1691
1691
|
unknownKeys: "passthrough"
|
|
1692
1692
|
}));
|
|
1693
1693
|
}
|
|
@@ -1709,8 +1709,8 @@ class S extends w {
|
|
|
1709
1709
|
// }) as any;
|
|
1710
1710
|
// };
|
|
1711
1711
|
extend(e) {
|
|
1712
|
-
return new S(y(
|
|
1713
|
-
shape: () =>
|
|
1712
|
+
return new S(y(u({}, this._def), {
|
|
1713
|
+
shape: () => u(u({}, this._def.shape()), e)
|
|
1714
1714
|
}));
|
|
1715
1715
|
}
|
|
1716
1716
|
/**
|
|
@@ -1722,7 +1722,7 @@ class S extends w {
|
|
|
1722
1722
|
return new S({
|
|
1723
1723
|
unknownKeys: e._def.unknownKeys,
|
|
1724
1724
|
catchall: e._def.catchall,
|
|
1725
|
-
shape: () =>
|
|
1725
|
+
shape: () => u(u({}, this._def.shape()), e._def.shape()),
|
|
1726
1726
|
typeName: g.ZodObject
|
|
1727
1727
|
});
|
|
1728
1728
|
}
|
|
@@ -1786,7 +1786,7 @@ class S extends w {
|
|
|
1786
1786
|
// return merged;
|
|
1787
1787
|
// }
|
|
1788
1788
|
catchall(e) {
|
|
1789
|
-
return new S(y(
|
|
1789
|
+
return new S(y(u({}, this._def), {
|
|
1790
1790
|
catchall: e
|
|
1791
1791
|
}));
|
|
1792
1792
|
}
|
|
@@ -1794,7 +1794,7 @@ class S extends w {
|
|
|
1794
1794
|
const t = {};
|
|
1795
1795
|
return x.objectKeys(e).forEach((s) => {
|
|
1796
1796
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
1797
|
-
}), new S(y(
|
|
1797
|
+
}), new S(y(u({}, this._def), {
|
|
1798
1798
|
shape: () => t
|
|
1799
1799
|
}));
|
|
1800
1800
|
}
|
|
@@ -1802,7 +1802,7 @@ class S extends w {
|
|
|
1802
1802
|
const t = {};
|
|
1803
1803
|
return x.objectKeys(this.shape).forEach((s) => {
|
|
1804
1804
|
e[s] || (t[s] = this.shape[s]);
|
|
1805
|
-
}), new S(y(
|
|
1805
|
+
}), new S(y(u({}, this._def), {
|
|
1806
1806
|
shape: () => t
|
|
1807
1807
|
}));
|
|
1808
1808
|
}
|
|
@@ -1810,14 +1810,14 @@ class S extends w {
|
|
|
1810
1810
|
* @deprecated
|
|
1811
1811
|
*/
|
|
1812
1812
|
deepPartial() {
|
|
1813
|
-
return
|
|
1813
|
+
return we(this);
|
|
1814
1814
|
}
|
|
1815
1815
|
partial(e) {
|
|
1816
1816
|
const t = {};
|
|
1817
1817
|
return x.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
|
-
}), new S(y(
|
|
1820
|
+
}), new S(y(u({}, this._def), {
|
|
1821
1821
|
shape: () => t
|
|
1822
1822
|
}));
|
|
1823
1823
|
}
|
|
@@ -1828,11 +1828,11 @@ class S extends w {
|
|
|
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 ee; )
|
|
1832
1832
|
a = a._def.innerType;
|
|
1833
1833
|
t[s] = a;
|
|
1834
1834
|
}
|
|
1835
|
-
}), new S(y(
|
|
1835
|
+
}), new S(y(u({}, this._def), {
|
|
1836
1836
|
shape: () => t
|
|
1837
1837
|
}));
|
|
1838
1838
|
}
|
|
@@ -1840,25 +1840,25 @@ class S extends w {
|
|
|
1840
1840
|
return Xt(x.objectKeys(this.shape));
|
|
1841
1841
|
}
|
|
1842
1842
|
}
|
|
1843
|
-
S.create = (n, e) => new S(
|
|
1843
|
+
S.create = (n, e) => new S(u({
|
|
1844
1844
|
shape: () => n,
|
|
1845
1845
|
unknownKeys: "strip",
|
|
1846
|
-
catchall:
|
|
1846
|
+
catchall: oe.create(),
|
|
1847
1847
|
typeName: g.ZodObject
|
|
1848
1848
|
}, b(e)));
|
|
1849
|
-
S.strictCreate = (n, e) => new S(
|
|
1849
|
+
S.strictCreate = (n, e) => new S(u({
|
|
1850
1850
|
shape: () => n,
|
|
1851
1851
|
unknownKeys: "strict",
|
|
1852
|
-
catchall:
|
|
1852
|
+
catchall: oe.create(),
|
|
1853
1853
|
typeName: g.ZodObject
|
|
1854
1854
|
}, b(e)));
|
|
1855
|
-
S.lazycreate = (n, e) => new S(
|
|
1855
|
+
S.lazycreate = (n, e) => new S(u({
|
|
1856
1856
|
shape: n,
|
|
1857
1857
|
unknownKeys: "strip",
|
|
1858
|
-
catchall:
|
|
1858
|
+
catchall: oe.create(),
|
|
1859
1859
|
typeName: g.ZodObject
|
|
1860
1860
|
}, b(e)));
|
|
1861
|
-
class
|
|
1861
|
+
class Le extends w {
|
|
1862
1862
|
_parse(e) {
|
|
1863
1863
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1864
1864
|
function r(a) {
|
|
@@ -1875,9 +1875,9 @@ class Fe extends w {
|
|
|
1875
1875
|
}), v;
|
|
1876
1876
|
}
|
|
1877
1877
|
if (t.common.async)
|
|
1878
|
-
return Promise.all(s.map((a) =>
|
|
1879
|
-
const i = y(
|
|
1880
|
-
common: y(
|
|
1878
|
+
return Promise.all(s.map((a) => F(this, null, function* () {
|
|
1879
|
+
const i = y(u({}, t), {
|
|
1880
|
+
common: y(u({}, t.common), {
|
|
1881
1881
|
issues: []
|
|
1882
1882
|
}),
|
|
1883
1883
|
parent: null
|
|
@@ -1895,19 +1895,19 @@ class Fe extends w {
|
|
|
1895
1895
|
let a;
|
|
1896
1896
|
const i = [];
|
|
1897
1897
|
for (const c of s) {
|
|
1898
|
-
const
|
|
1899
|
-
common: y(
|
|
1898
|
+
const d = y(u({}, t), {
|
|
1899
|
+
common: y(u({}, t.common), {
|
|
1900
1900
|
issues: []
|
|
1901
1901
|
}),
|
|
1902
1902
|
parent: null
|
|
1903
1903
|
}), f = c._parseSync({
|
|
1904
1904
|
data: t.data,
|
|
1905
1905
|
path: t.path,
|
|
1906
|
-
parent:
|
|
1906
|
+
parent: d
|
|
1907
1907
|
});
|
|
1908
1908
|
if (f.status === "valid")
|
|
1909
1909
|
return f;
|
|
1910
|
-
f.status === "dirty" && !a && (a = { result: f, ctx:
|
|
1910
|
+
f.status === "dirty" && !a && (a = { result: f, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
1911
1911
|
}
|
|
1912
1912
|
if (a)
|
|
1913
1913
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
@@ -1922,12 +1922,12 @@ class Fe extends w {
|
|
|
1922
1922
|
return this._def.options;
|
|
1923
1923
|
}
|
|
1924
1924
|
}
|
|
1925
|
-
|
|
1925
|
+
Le.create = (n, e) => new Le(u({
|
|
1926
1926
|
options: n,
|
|
1927
1927
|
typeName: g.ZodUnion
|
|
1928
1928
|
}, b(e)));
|
|
1929
|
-
const
|
|
1930
|
-
class
|
|
1929
|
+
const ae = (n) => n instanceof Ue ? ae(n.schema) : n instanceof G ? ae(n.innerType()) : n instanceof ze ? [n.value] : n instanceof fe ? n.options : n instanceof We ? x.objectValues(n.enum) : n instanceof Be ? ae(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof Fe ? [null] : n instanceof ee ? [void 0, ...ae(n.unwrap())] : n instanceof he ? [null, ...ae(n.unwrap())] : n instanceof At || n instanceof He ? ae(n.unwrap()) : n instanceof qe ? ae(n._def.innerType) : [];
|
|
1930
|
+
class it extends w {
|
|
1931
1931
|
_parse(e) {
|
|
1932
1932
|
const { ctx: t } = this._processInputParams(e);
|
|
1933
1933
|
if (t.parsedType !== p.object)
|
|
@@ -1971,7 +1971,7 @@ class at 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 = ae(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) {
|
|
@@ -1980,7 +1980,7 @@ class at extends w {
|
|
|
1980
1980
|
r.set(o, a);
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
|
-
return new
|
|
1983
|
+
return new it(u({
|
|
1984
1984
|
typeName: g.ZodDiscriminatedUnion,
|
|
1985
1985
|
discriminator: e,
|
|
1986
1986
|
options: t,
|
|
@@ -1988,14 +1988,14 @@ class at extends w {
|
|
|
1988
1988
|
}, b(s)));
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
|
-
function
|
|
1992
|
-
const t =
|
|
1991
|
+
function yt(n, e) {
|
|
1992
|
+
const t = ie(n), s = ie(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 = x.objectKeys(e), a = x.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i =
|
|
1996
|
+
const r = x.objectKeys(e), a = x.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 = yt(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 mt(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 = yt(i, o);
|
|
2010
2010
|
if (!c.valid)
|
|
2011
2011
|
return { valid: !1 };
|
|
2012
2012
|
r.push(c.data);
|
|
@@ -2014,13 +2014,13 @@ function mt(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 De extends w {
|
|
2018
2018
|
_parse(e) {
|
|
2019
2019
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2020
|
-
if (
|
|
2020
|
+
if (pt(a) || pt(i))
|
|
2021
2021
|
return v;
|
|
2022
|
-
const o =
|
|
2023
|
-
return o.valid ? ((
|
|
2022
|
+
const o = yt(a.value, i.value);
|
|
2023
|
+
return o.valid ? ((mt(a) || mt(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 Le extends w {
|
|
|
2046
2046
|
}));
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
|
-
|
|
2049
|
+
De.create = (n, e, t) => new De(u({
|
|
2050
2050
|
left: n,
|
|
2051
2051
|
right: e,
|
|
2052
2052
|
typeName: g.ZodIntersection
|
|
2053
2053
|
}, b(t)));
|
|
2054
|
-
class
|
|
2054
|
+
class ne extends w {
|
|
2055
2055
|
_parse(e) {
|
|
2056
2056
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2057
2057
|
if (s.parsedType !== p.array)
|
|
@@ -2077,29 +2077,29 @@ class se 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 te(s, i, s.path, o)) : null;
|
|
2081
2081
|
}).filter((i) => !!i);
|
|
2082
|
-
return s.common.async ? Promise.all(a).then((i) =>
|
|
2082
|
+
return s.common.async ? Promise.all(a).then((i) => R.mergeArray(t, i)) : R.mergeArray(t, a);
|
|
2083
2083
|
}
|
|
2084
2084
|
get items() {
|
|
2085
2085
|
return this._def.items;
|
|
2086
2086
|
}
|
|
2087
2087
|
rest(e) {
|
|
2088
|
-
return new
|
|
2088
|
+
return new ne(y(u({}, this._def), {
|
|
2089
2089
|
rest: e
|
|
2090
2090
|
}));
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
|
|
2093
|
+
ne.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 ne(u({
|
|
2097
2097
|
items: n,
|
|
2098
2098
|
typeName: g.ZodTuple,
|
|
2099
2099
|
rest: null
|
|
2100
2100
|
}, b(e)));
|
|
2101
2101
|
};
|
|
2102
|
-
class
|
|
2102
|
+
class Ve extends w {
|
|
2103
2103
|
get keySchema() {
|
|
2104
2104
|
return this._def.keyType;
|
|
2105
2105
|
}
|
|
@@ -2117,28 +2117,28 @@ class De 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 te(s, o, s.path, o)),
|
|
2121
|
+
value: i._parse(new te(s, s.data[o], s.path, o)),
|
|
2122
2122
|
alwaysSet: o in s.data
|
|
2123
2123
|
});
|
|
2124
|
-
return s.common.async ?
|
|
2124
|
+
return s.common.async ? R.mergeObjectAsync(t, r) : R.mergeObjectSync(t, r);
|
|
2125
2125
|
}
|
|
2126
2126
|
get element() {
|
|
2127
2127
|
return this._def.valueType;
|
|
2128
2128
|
}
|
|
2129
2129
|
static create(e, t, s) {
|
|
2130
|
-
return t instanceof w ? new
|
|
2130
|
+
return t instanceof w ? new Ve(u({
|
|
2131
2131
|
keyType: e,
|
|
2132
2132
|
valueType: t,
|
|
2133
2133
|
typeName: g.ZodRecord
|
|
2134
|
-
}, b(s))) : new
|
|
2134
|
+
}, b(s))) : new Ve(u({
|
|
2135
2135
|
keyType: H.create(),
|
|
2136
2136
|
valueType: e,
|
|
2137
2137
|
typeName: g.ZodRecord
|
|
2138
2138
|
}, b(t)));
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
2141
|
-
class
|
|
2141
|
+
class rt extends w {
|
|
2142
2142
|
get keySchema() {
|
|
2143
2143
|
return this._def.keyType;
|
|
2144
2144
|
}
|
|
@@ -2153,34 +2153,34 @@ class st extends w {
|
|
|
2153
2153
|
expected: p.map,
|
|
2154
2154
|
received: s.parsedType
|
|
2155
2155
|
}), v;
|
|
2156
|
-
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c],
|
|
2157
|
-
key: r._parse(new
|
|
2158
|
-
value: a._parse(new
|
|
2156
|
+
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
|
|
2157
|
+
key: r._parse(new te(s, o, s.path, [d, "key"])),
|
|
2158
|
+
value: a._parse(new te(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(() => F(this, null, function* () {
|
|
2163
2163
|
for (const c of i) {
|
|
2164
|
-
const
|
|
2165
|
-
if (
|
|
2164
|
+
const d = yield c.key, f = yield c.value;
|
|
2165
|
+
if (d.status === "aborted" || f.status === "aborted")
|
|
2166
2166
|
return v;
|
|
2167
|
-
(
|
|
2167
|
+
(d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
|
|
2168
2168
|
}
|
|
2169
2169
|
return { status: t.value, value: o };
|
|
2170
2170
|
}));
|
|
2171
2171
|
} else {
|
|
2172
2172
|
const o = /* @__PURE__ */ new Map();
|
|
2173
2173
|
for (const c of i) {
|
|
2174
|
-
const
|
|
2175
|
-
if (
|
|
2174
|
+
const d = c.key, f = c.value;
|
|
2175
|
+
if (d.status === "aborted" || f.status === "aborted")
|
|
2176
2176
|
return v;
|
|
2177
|
-
(
|
|
2177
|
+
(d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
|
|
2178
2178
|
}
|
|
2179
2179
|
return { status: t.value, value: o };
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
2182
|
}
|
|
2183
|
-
|
|
2183
|
+
rt.create = (n, e, t) => new rt(u({
|
|
2184
2184
|
valueType: e,
|
|
2185
2185
|
keyType: n,
|
|
2186
2186
|
typeName: g.ZodMap
|
|
@@ -2212,24 +2212,24 @@ class _e extends w {
|
|
|
2212
2212
|
}), t.dirty());
|
|
2213
2213
|
const a = this._def.valueType;
|
|
2214
2214
|
function i(c) {
|
|
2215
|
-
const
|
|
2215
|
+
const d = /* @__PURE__ */ new Set();
|
|
2216
2216
|
for (const f of c) {
|
|
2217
2217
|
if (f.status === "aborted")
|
|
2218
2218
|
return v;
|
|
2219
|
-
f.status === "dirty" && t.dirty(),
|
|
2219
|
+
f.status === "dirty" && t.dirty(), d.add(f.value);
|
|
2220
2220
|
}
|
|
2221
|
-
return { status: t.value, value:
|
|
2221
|
+
return { status: t.value, value: d };
|
|
2222
2222
|
}
|
|
2223
|
-
const o = [...s.data.values()].map((c,
|
|
2223
|
+
const o = [...s.data.values()].map((c, d) => a._parse(new te(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 _e(y(
|
|
2227
|
+
return new _e(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 _e(y(
|
|
2232
|
+
return new _e(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
|
-
_e.create = (n, e) => new _e(
|
|
2243
|
+
_e.create = (n, e) => new _e(u({
|
|
2244
2244
|
valueType: n,
|
|
2245
2245
|
minSize: null,
|
|
2246
2246
|
maxSize: null,
|
|
2247
2247
|
typeName: g.ZodSet
|
|
2248
2248
|
}, b(e)));
|
|
2249
|
-
class
|
|
2249
|
+
class ke extends w {
|
|
2250
2250
|
constructor() {
|
|
2251
2251
|
super(...arguments), this.validate = this.implement;
|
|
2252
2252
|
}
|
|
@@ -2259,15 +2259,15 @@ class xe extends w {
|
|
|
2259
2259
|
received: t.parsedType
|
|
2260
2260
|
}), v;
|
|
2261
2261
|
function s(o, c) {
|
|
2262
|
-
return
|
|
2262
|
+
return et({
|
|
2263
2263
|
data: o,
|
|
2264
2264
|
path: t.path,
|
|
2265
2265
|
errorMaps: [
|
|
2266
2266
|
t.common.contextualErrorMap,
|
|
2267
2267
|
t.schemaErrorMap,
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
].filter((
|
|
2268
|
+
Qe(),
|
|
2269
|
+
Te
|
|
2270
|
+
].filter((d) => !!d),
|
|
2271
2271
|
issueData: {
|
|
2272
2272
|
code: l.invalid_arguments,
|
|
2273
2273
|
argumentsError: c
|
|
@@ -2275,15 +2275,15 @@ class xe extends w {
|
|
|
2275
2275
|
});
|
|
2276
2276
|
}
|
|
2277
2277
|
function r(o, c) {
|
|
2278
|
-
return
|
|
2278
|
+
return et({
|
|
2279
2279
|
data: o,
|
|
2280
2280
|
path: t.path,
|
|
2281
2281
|
errorMaps: [
|
|
2282
2282
|
t.common.contextualErrorMap,
|
|
2283
2283
|
t.schemaErrorMap,
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
].filter((
|
|
2284
|
+
Qe(),
|
|
2285
|
+
Te
|
|
2286
|
+
].filter((d) => !!d),
|
|
2287
2287
|
issueData: {
|
|
2288
2288
|
code: l.invalid_return_type,
|
|
2289
2289
|
returnTypeError: c
|
|
@@ -2291,25 +2291,25 @@ class xe 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 Ae) {
|
|
2295
2295
|
const o = this;
|
|
2296
|
-
return
|
|
2297
|
-
return
|
|
2298
|
-
const
|
|
2299
|
-
throw
|
|
2296
|
+
return $(function(...c) {
|
|
2297
|
+
return F(this, null, function* () {
|
|
2298
|
+
const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((E) => {
|
|
2299
|
+
throw d.addIssue(s(c, E)), d;
|
|
2300
2300
|
}), _ = yield Reflect.apply(i, this, f);
|
|
2301
|
-
return yield o._def.returns._def.type.parseAsync(_, a).catch((
|
|
2302
|
-
throw
|
|
2301
|
+
return yield o._def.returns._def.type.parseAsync(_, a).catch((E) => {
|
|
2302
|
+
throw d.addIssue(r(_, E)), d;
|
|
2303
2303
|
});
|
|
2304
2304
|
});
|
|
2305
2305
|
});
|
|
2306
2306
|
} else {
|
|
2307
2307
|
const o = this;
|
|
2308
|
-
return
|
|
2309
|
-
const
|
|
2310
|
-
if (!
|
|
2311
|
-
throw new U([s(c,
|
|
2312
|
-
const f = Reflect.apply(i, this,
|
|
2308
|
+
return $(function(...c) {
|
|
2309
|
+
const d = o._def.args.safeParse(c, a);
|
|
2310
|
+
if (!d.success)
|
|
2311
|
+
throw new U([s(c, d.error)]);
|
|
2312
|
+
const f = Reflect.apply(i, this, d.data), _ = o._def.returns.safeParse(f, a);
|
|
2313
2313
|
if (!_.success)
|
|
2314
2314
|
throw new U([r(f, _.error)]);
|
|
2315
2315
|
return _.data;
|
|
@@ -2323,12 +2323,12 @@ class xe extends w {
|
|
|
2323
2323
|
return this._def.returns;
|
|
2324
2324
|
}
|
|
2325
2325
|
args(...e) {
|
|
2326
|
-
return new
|
|
2327
|
-
args:
|
|
2326
|
+
return new ke(y(u({}, this._def), {
|
|
2327
|
+
args: ne.create(e).rest(ye.create())
|
|
2328
2328
|
}));
|
|
2329
2329
|
}
|
|
2330
2330
|
returns(e) {
|
|
2331
|
-
return new
|
|
2331
|
+
return new ke(y(u({}, this._def), {
|
|
2332
2332
|
returns: e
|
|
2333
2333
|
}));
|
|
2334
2334
|
}
|
|
@@ -2339,14 +2339,14 @@ class xe extends w {
|
|
|
2339
2339
|
return this.parse(e);
|
|
2340
2340
|
}
|
|
2341
2341
|
static create(e, t, s) {
|
|
2342
|
-
return new
|
|
2343
|
-
args: e ||
|
|
2342
|
+
return new ke(u({
|
|
2343
|
+
args: e || ne.create([]).rest(ye.create()),
|
|
2344
2344
|
returns: t || ye.create(),
|
|
2345
2345
|
typeName: g.ZodFunction
|
|
2346
2346
|
}, b(s)));
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
class
|
|
2349
|
+
class Ue extends w {
|
|
2350
2350
|
get schema() {
|
|
2351
2351
|
return this._def.getter();
|
|
2352
2352
|
}
|
|
@@ -2355,11 +2355,11 @@ class Ve extends w {
|
|
|
2355
2355
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
2358
|
-
|
|
2358
|
+
Ue.create = (n, e) => new Ue(u({
|
|
2359
2359
|
getter: n,
|
|
2360
2360
|
typeName: g.ZodLazy
|
|
2361
2361
|
}, b(e)));
|
|
2362
|
-
class
|
|
2362
|
+
class ze extends w {
|
|
2363
2363
|
_parse(e) {
|
|
2364
2364
|
if (e.data !== this._def.value) {
|
|
2365
2365
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2375,19 +2375,19 @@ class Ue extends w {
|
|
|
2375
2375
|
return this._def.value;
|
|
2376
2376
|
}
|
|
2377
2377
|
}
|
|
2378
|
-
|
|
2378
|
+
ze.create = (n, e) => new ze(u({
|
|
2379
2379
|
value: n,
|
|
2380
2380
|
typeName: g.ZodLiteral
|
|
2381
2381
|
}, b(e)));
|
|
2382
2382
|
function Xt(n, e) {
|
|
2383
|
-
return new fe(
|
|
2383
|
+
return new fe(u({
|
|
2384
2384
|
values: n,
|
|
2385
2385
|
typeName: g.ZodEnum
|
|
2386
2386
|
}, b(e)));
|
|
2387
2387
|
}
|
|
2388
2388
|
class fe extends w {
|
|
2389
2389
|
constructor() {
|
|
2390
|
-
super(...arguments),
|
|
2390
|
+
super(...arguments), Ie.set(this, void 0);
|
|
2391
2391
|
}
|
|
2392
2392
|
_parse(e) {
|
|
2393
2393
|
if (typeof e.data != "string") {
|
|
@@ -2398,7 +2398,7 @@ class fe extends w {
|
|
|
2398
2398
|
code: l.invalid_type
|
|
2399
2399
|
}), v;
|
|
2400
2400
|
}
|
|
2401
|
-
if (
|
|
2401
|
+
if (tt(this, Ie) || Ht(this, Ie, new Set(this._def.values)), !tt(this, Ie).has(e.data)) {
|
|
2402
2402
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2403
2403
|
return h(t, {
|
|
2404
2404
|
received: t.data,
|
|
@@ -2406,7 +2406,7 @@ class fe extends w {
|
|
|
2406
2406
|
options: s
|
|
2407
2407
|
}), v;
|
|
2408
2408
|
}
|
|
2409
|
-
return
|
|
2409
|
+
return $(e.data);
|
|
2410
2410
|
}
|
|
2411
2411
|
get options() {
|
|
2412
2412
|
return this._def.values;
|
|
@@ -2430,17 +2430,17 @@ class fe extends w {
|
|
|
2430
2430
|
return e;
|
|
2431
2431
|
}
|
|
2432
2432
|
extract(e, t = this._def) {
|
|
2433
|
-
return fe.create(e,
|
|
2433
|
+
return fe.create(e, u(u({}, this._def), t));
|
|
2434
2434
|
}
|
|
2435
2435
|
exclude(e, t = this._def) {
|
|
2436
|
-
return fe.create(this.options.filter((s) => !e.includes(s)),
|
|
2436
|
+
return fe.create(this.options.filter((s) => !e.includes(s)), u(u({}, this._def), t));
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
|
|
2439
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
2440
2440
|
fe.create = Xt;
|
|
2441
|
-
class
|
|
2441
|
+
class We extends w {
|
|
2442
2442
|
constructor() {
|
|
2443
|
-
super(...arguments),
|
|
2443
|
+
super(...arguments), Ne.set(this, void 0);
|
|
2444
2444
|
}
|
|
2445
2445
|
_parse(e) {
|
|
2446
2446
|
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
@@ -2452,7 +2452,7 @@ class ze extends w {
|
|
|
2452
2452
|
code: l.invalid_type
|
|
2453
2453
|
}), v;
|
|
2454
2454
|
}
|
|
2455
|
-
if (
|
|
2455
|
+
if (tt(this, Ne) || Ht(this, Ne, new Set(x.getValidEnumValues(this._def.values))), !tt(this, Ne).has(e.data)) {
|
|
2456
2456
|
const r = x.objectValues(t);
|
|
2457
2457
|
return h(s, {
|
|
2458
2458
|
received: s.data,
|
|
@@ -2460,18 +2460,18 @@ class ze extends w {
|
|
|
2460
2460
|
options: r
|
|
2461
2461
|
}), v;
|
|
2462
2462
|
}
|
|
2463
|
-
return
|
|
2463
|
+
return $(e.data);
|
|
2464
2464
|
}
|
|
2465
2465
|
get enum() {
|
|
2466
2466
|
return this._def.values;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2469
|
+
Ne = /* @__PURE__ */ new WeakMap();
|
|
2470
|
+
We.create = (n, e) => new We(u({
|
|
2471
2471
|
values: n,
|
|
2472
2472
|
typeName: g.ZodNativeEnum
|
|
2473
2473
|
}, b(e)));
|
|
2474
|
-
class
|
|
2474
|
+
class Ae extends w {
|
|
2475
2475
|
unwrap() {
|
|
2476
2476
|
return this._def.type;
|
|
2477
2477
|
}
|
|
@@ -2484,13 +2484,13 @@ class Se extends w {
|
|
|
2484
2484
|
received: t.parsedType
|
|
2485
2485
|
}), v;
|
|
2486
2486
|
const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
2487
|
-
return
|
|
2487
|
+
return $(s.then((r) => this._def.type.parseAsync(r, {
|
|
2488
2488
|
path: t.path,
|
|
2489
2489
|
errorMap: t.common.contextualErrorMap
|
|
2490
2490
|
})));
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
|
-
|
|
2493
|
+
Ae.create = (n, e) => new Ae(u({
|
|
2494
2494
|
type: n,
|
|
2495
2495
|
typeName: g.ZodPromise
|
|
2496
2496
|
}, b(e)));
|
|
@@ -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) => F(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" ? xe(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" ? xe(o.value) : o;
|
|
2535
2535
|
}
|
|
2536
2536
|
}
|
|
2537
2537
|
if (r.type === "refinement") {
|
|
@@ -2571,41 +2571,41 @@ class G extends w {
|
|
|
2571
2571
|
x.assertNever(r);
|
|
2572
2572
|
}
|
|
2573
2573
|
}
|
|
2574
|
-
G.create = (n, e, t) => new G(
|
|
2574
|
+
G.create = (n, e, t) => new G(u({
|
|
2575
2575
|
schema: n,
|
|
2576
2576
|
typeName: g.ZodEffects,
|
|
2577
2577
|
effect: e
|
|
2578
2578
|
}, b(t)));
|
|
2579
|
-
G.createWithPreprocess = (n, e, t) => new G(
|
|
2579
|
+
G.createWithPreprocess = (n, e, t) => new G(u({
|
|
2580
2580
|
schema: e,
|
|
2581
2581
|
effect: { type: "preprocess", transform: n },
|
|
2582
2582
|
typeName: g.ZodEffects
|
|
2583
2583
|
}, b(t)));
|
|
2584
|
-
class
|
|
2584
|
+
class ee extends w {
|
|
2585
2585
|
_parse(e) {
|
|
2586
|
-
return this._getType(e) === p.undefined ?
|
|
2586
|
+
return this._getType(e) === p.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
2587
2587
|
}
|
|
2588
2588
|
unwrap() {
|
|
2589
2589
|
return this._def.innerType;
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
|
-
|
|
2592
|
+
ee.create = (n, e) => new ee(u({
|
|
2593
2593
|
innerType: n,
|
|
2594
2594
|
typeName: g.ZodOptional
|
|
2595
2595
|
}, b(e)));
|
|
2596
2596
|
class he extends w {
|
|
2597
2597
|
_parse(e) {
|
|
2598
|
-
return this._getType(e) === p.null ?
|
|
2598
|
+
return this._getType(e) === p.null ? $(null) : this._def.innerType._parse(e);
|
|
2599
2599
|
}
|
|
2600
2600
|
unwrap() {
|
|
2601
2601
|
return this._def.innerType;
|
|
2602
2602
|
}
|
|
2603
2603
|
}
|
|
2604
|
-
he.create = (n, e) => new he(
|
|
2604
|
+
he.create = (n, e) => new he(u({
|
|
2605
2605
|
innerType: n,
|
|
2606
2606
|
typeName: g.ZodNullable
|
|
2607
2607
|
}, b(e)));
|
|
2608
|
-
class
|
|
2608
|
+
class Be extends w {
|
|
2609
2609
|
_parse(e) {
|
|
2610
2610
|
const { ctx: t } = this._processInputParams(e);
|
|
2611
2611
|
let s = t.data;
|
|
@@ -2619,23 +2619,23 @@ class We extends w {
|
|
|
2619
2619
|
return this._def.innerType;
|
|
2620
2620
|
}
|
|
2621
2621
|
}
|
|
2622
|
-
|
|
2622
|
+
Be.create = (n, e) => new Be(u({
|
|
2623
2623
|
innerType: n,
|
|
2624
2624
|
typeName: g.ZodDefault,
|
|
2625
2625
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
2626
2626
|
}, b(e)));
|
|
2627
|
-
class
|
|
2627
|
+
class qe extends w {
|
|
2628
2628
|
_parse(e) {
|
|
2629
|
-
const { ctx: t } = this._processInputParams(e), s = y(
|
|
2630
|
-
common: y(
|
|
2629
|
+
const { ctx: t } = this._processInputParams(e), s = y(u({}, t), {
|
|
2630
|
+
common: y(u({}, t.common), {
|
|
2631
2631
|
issues: []
|
|
2632
2632
|
})
|
|
2633
2633
|
}), r = this._def.innerType._parse({
|
|
2634
2634
|
data: s.data,
|
|
2635
2635
|
path: s.path,
|
|
2636
|
-
parent:
|
|
2636
|
+
parent: u({}, s)
|
|
2637
2637
|
});
|
|
2638
|
-
return
|
|
2638
|
+
return Me(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 Be extends w {
|
|
|
2657
2657
|
return this._def.innerType;
|
|
2658
2658
|
}
|
|
2659
2659
|
}
|
|
2660
|
-
|
|
2660
|
+
qe.create = (n, e) => new qe(u({
|
|
2661
2661
|
innerType: n,
|
|
2662
2662
|
typeName: g.ZodCatch,
|
|
2663
2663
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
2664
2664
|
}, b(e)));
|
|
2665
|
-
class
|
|
2665
|
+
class at extends w {
|
|
2666
2666
|
_parse(e) {
|
|
2667
2667
|
if (this._getType(e) !== p.nan) {
|
|
2668
2668
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2675,11 +2675,11 @@ class rt extends w {
|
|
|
2675
2675
|
return { status: "valid", value: e.data };
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
2678
|
-
|
|
2678
|
+
at.create = (n) => new at(u({
|
|
2679
2679
|
typeName: g.ZodNaN
|
|
2680
2680
|
}, b(n)));
|
|
2681
2681
|
const Vn = Symbol("zod_brand");
|
|
2682
|
-
class
|
|
2682
|
+
class At extends w {
|
|
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 St extends w {
|
|
|
2692
2692
|
return this._def.type;
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
|
-
class
|
|
2695
|
+
class Ge extends w {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2698
2698
|
if (s.common.async)
|
|
2699
|
-
return
|
|
2699
|
+
return F(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(), xe(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 Je extends w {
|
|
|
2725
2725
|
}
|
|
2726
2726
|
}
|
|
2727
2727
|
static create(e, t) {
|
|
2728
|
-
return new
|
|
2728
|
+
return new Ge({
|
|
2729
2729
|
in: e,
|
|
2730
2730
|
out: t,
|
|
2731
2731
|
typeName: g.ZodPipeline
|
|
2732
2732
|
});
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
|
-
class
|
|
2735
|
+
class He extends w {
|
|
2736
2736
|
_parse(e) {
|
|
2737
2737
|
const t = this._def.innerType._parse(e), s = (r) => (ge(r) && (r.value = Object.freeze(r.value)), r);
|
|
2738
|
-
return
|
|
2738
|
+
return Me(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
|
+
He.create = (n, e) => new He(u({
|
|
2745
2745
|
innerType: n,
|
|
2746
2746
|
typeName: g.ZodReadonly
|
|
2747
2747
|
}, b(e)));
|
|
2748
2748
|
function Yt(n, e = {}, t) {
|
|
2749
|
-
return n ?
|
|
2749
|
+
return n ? Se.create().superRefine((s, r) => {
|
|
2750
2750
|
var a, i;
|
|
2751
2751
|
if (!n(s)) {
|
|
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,
|
|
2753
|
-
r.addIssue(y(
|
|
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
|
+
r.addIssue(y(u({ code: "custom" }, d), { fatal: c }));
|
|
2754
2754
|
}
|
|
2755
|
-
}) :
|
|
2755
|
+
}) : Se.create();
|
|
2756
2756
|
}
|
|
2757
2757
|
const Un = {
|
|
2758
2758
|
object: S.lazycreate
|
|
@@ -2763,79 +2763,79 @@ 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 = H.create, en =
|
|
2767
|
-
string: (n) => H.create(y(
|
|
2768
|
-
number: (n) =>
|
|
2769
|
-
boolean: (n) =>
|
|
2766
|
+
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = de.create, Wn = at.create, Bn = le.create, tn = $e.create, qn = ve.create, Hn = nt.create, Jn = Pe.create, Gn = Fe.create, Kn = Se.create, Xn = ye.create, Yn = oe.create, Qn = st.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = it.create, as = De.create, is = ne.create, os = Ve.create, cs = rt.create, us = _e.create, ds = ke.create, ls = Ue.create, fs = ze.create, hs = fe.create, ps = We.create, ms = Ae.create, Pt = G.create, ys = ee.create, gs = he.create, vs = G.createWithPreprocess, _s = Ge.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
|
|
2767
|
+
string: (n) => H.create(y(u({}, n), { coerce: !0 })),
|
|
2768
|
+
number: (n) => de.create(y(u({}, n), { coerce: !0 })),
|
|
2769
|
+
boolean: (n) => $e.create(y(u({}, n), {
|
|
2770
2770
|
coerce: !0
|
|
2771
2771
|
})),
|
|
2772
|
-
bigint: (n) => le.create(y(
|
|
2773
|
-
date: (n) => ve.create(y(
|
|
2772
|
+
bigint: (n) => le.create(y(u({}, n), { coerce: !0 })),
|
|
2773
|
+
date: (n) => ve.create(y(u({}, n), { coerce: !0 }))
|
|
2774
2774
|
}, Ts = v;
|
|
2775
|
-
var
|
|
2775
|
+
var N = /* @__PURE__ */ Object.freeze({
|
|
2776
2776
|
__proto__: null,
|
|
2777
|
-
defaultErrorMap:
|
|
2777
|
+
defaultErrorMap: Te,
|
|
2778
2778
|
setErrorMap: vn,
|
|
2779
|
-
getErrorMap:
|
|
2780
|
-
makeIssue:
|
|
2779
|
+
getErrorMap: Qe,
|
|
2780
|
+
makeIssue: et,
|
|
2781
2781
|
EMPTY_PATH: _n,
|
|
2782
2782
|
addIssueToContext: h,
|
|
2783
|
-
ParseStatus:
|
|
2783
|
+
ParseStatus: R,
|
|
2784
2784
|
INVALID: v,
|
|
2785
|
-
DIRTY:
|
|
2786
|
-
OK:
|
|
2787
|
-
isAborted:
|
|
2788
|
-
isDirty:
|
|
2785
|
+
DIRTY: xe,
|
|
2786
|
+
OK: $,
|
|
2787
|
+
isAborted: pt,
|
|
2788
|
+
isDirty: mt,
|
|
2789
2789
|
isValid: ge,
|
|
2790
|
-
isAsync:
|
|
2790
|
+
isAsync: Me,
|
|
2791
2791
|
get util() {
|
|
2792
2792
|
return x;
|
|
2793
2793
|
},
|
|
2794
2794
|
get objectUtil() {
|
|
2795
|
-
return
|
|
2795
|
+
return ht;
|
|
2796
2796
|
},
|
|
2797
2797
|
ZodParsedType: p,
|
|
2798
|
-
getParsedType:
|
|
2798
|
+
getParsedType: ie,
|
|
2799
2799
|
ZodType: w,
|
|
2800
2800
|
datetimeRegex: Kt,
|
|
2801
2801
|
ZodString: H,
|
|
2802
|
-
ZodNumber:
|
|
2802
|
+
ZodNumber: de,
|
|
2803
2803
|
ZodBigInt: le,
|
|
2804
|
-
ZodBoolean:
|
|
2804
|
+
ZodBoolean: $e,
|
|
2805
2805
|
ZodDate: ve,
|
|
2806
|
-
ZodSymbol:
|
|
2807
|
-
ZodUndefined:
|
|
2808
|
-
ZodNull:
|
|
2809
|
-
ZodAny:
|
|
2806
|
+
ZodSymbol: nt,
|
|
2807
|
+
ZodUndefined: Pe,
|
|
2808
|
+
ZodNull: Fe,
|
|
2809
|
+
ZodAny: Se,
|
|
2810
2810
|
ZodUnknown: ye,
|
|
2811
|
-
ZodNever:
|
|
2812
|
-
ZodVoid:
|
|
2811
|
+
ZodNever: oe,
|
|
2812
|
+
ZodVoid: st,
|
|
2813
2813
|
ZodArray: J,
|
|
2814
2814
|
ZodObject: S,
|
|
2815
|
-
ZodUnion:
|
|
2816
|
-
ZodDiscriminatedUnion:
|
|
2817
|
-
ZodIntersection:
|
|
2818
|
-
ZodTuple:
|
|
2819
|
-
ZodRecord:
|
|
2820
|
-
ZodMap:
|
|
2815
|
+
ZodUnion: Le,
|
|
2816
|
+
ZodDiscriminatedUnion: it,
|
|
2817
|
+
ZodIntersection: De,
|
|
2818
|
+
ZodTuple: ne,
|
|
2819
|
+
ZodRecord: Ve,
|
|
2820
|
+
ZodMap: rt,
|
|
2821
2821
|
ZodSet: _e,
|
|
2822
|
-
ZodFunction:
|
|
2823
|
-
ZodLazy:
|
|
2824
|
-
ZodLiteral:
|
|
2822
|
+
ZodFunction: ke,
|
|
2823
|
+
ZodLazy: Ue,
|
|
2824
|
+
ZodLiteral: ze,
|
|
2825
2825
|
ZodEnum: fe,
|
|
2826
|
-
ZodNativeEnum:
|
|
2827
|
-
ZodPromise:
|
|
2826
|
+
ZodNativeEnum: We,
|
|
2827
|
+
ZodPromise: Ae,
|
|
2828
2828
|
ZodEffects: G,
|
|
2829
2829
|
ZodTransformer: G,
|
|
2830
|
-
ZodOptional:
|
|
2830
|
+
ZodOptional: ee,
|
|
2831
2831
|
ZodNullable: he,
|
|
2832
|
-
ZodDefault:
|
|
2833
|
-
ZodCatch:
|
|
2834
|
-
ZodNaN:
|
|
2832
|
+
ZodDefault: Be,
|
|
2833
|
+
ZodCatch: qe,
|
|
2834
|
+
ZodNaN: at,
|
|
2835
2835
|
BRAND: Vn,
|
|
2836
|
-
ZodBranded:
|
|
2837
|
-
ZodPipeline:
|
|
2838
|
-
ZodReadonly:
|
|
2836
|
+
ZodBranded: At,
|
|
2837
|
+
ZodPipeline: Ge,
|
|
2838
|
+
ZodReadonly: He,
|
|
2839
2839
|
custom: Yt,
|
|
2840
2840
|
Schema: w,
|
|
2841
2841
|
ZodSchema: w,
|
|
@@ -2852,7 +2852,7 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
2852
2852
|
discriminatedUnion: rs,
|
|
2853
2853
|
effect: Pt,
|
|
2854
2854
|
enum: hs,
|
|
2855
|
-
function:
|
|
2855
|
+
function: ds,
|
|
2856
2856
|
instanceof: zn,
|
|
2857
2857
|
intersection: as,
|
|
2858
2858
|
lazy: ls,
|
|
@@ -2873,7 +2873,7 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
2873
2873
|
preprocess: vs,
|
|
2874
2874
|
promise: ms,
|
|
2875
2875
|
record: os,
|
|
2876
|
-
set:
|
|
2876
|
+
set: us,
|
|
2877
2877
|
strictObject: ns,
|
|
2878
2878
|
string: Qt,
|
|
2879
2879
|
symbol: Hn,
|
|
@@ -2888,14 +2888,14 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
2888
2888
|
quotelessJson: gn,
|
|
2889
2889
|
ZodError: U
|
|
2890
2890
|
});
|
|
2891
|
-
const Ss =
|
|
2892
|
-
language:
|
|
2891
|
+
const Ss = N.object({
|
|
2892
|
+
language: N.enum(["typescript", "javascript"]).optional()
|
|
2893
2893
|
}).and(
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
framework:
|
|
2897
|
-
model:
|
|
2898
|
-
styling:
|
|
2894
|
+
N.union([
|
|
2895
|
+
N.object({
|
|
2896
|
+
framework: N.literal("react"),
|
|
2897
|
+
model: N.string().optional(),
|
|
2898
|
+
styling: N.enum([
|
|
2899
2899
|
"plain_css",
|
|
2900
2900
|
"css_modules",
|
|
2901
2901
|
"styled_components",
|
|
@@ -2904,17 +2904,19 @@ const Ss = P.object({
|
|
|
2904
2904
|
"scss",
|
|
2905
2905
|
"inline_styles"
|
|
2906
2906
|
]),
|
|
2907
|
-
uiLibrary:
|
|
2908
|
-
enableUILibraryTheming:
|
|
2909
|
-
enableCompactStructure:
|
|
2907
|
+
uiLibrary: N.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
2908
|
+
enableUILibraryTheming: N.boolean().optional(),
|
|
2909
|
+
enableCompactStructure: N.boolean().optional(),
|
|
2910
|
+
enableAutoSplit: N.boolean().optional(),
|
|
2911
|
+
autoSplitThreshold: N.number().optional()
|
|
2910
2912
|
}),
|
|
2911
|
-
|
|
2912
|
-
framework:
|
|
2913
|
-
styling:
|
|
2914
|
-
enableTranslation:
|
|
2913
|
+
N.object({
|
|
2914
|
+
framework: N.literal("html"),
|
|
2915
|
+
styling: N.enum(["plain_css", "inline_styles"]),
|
|
2916
|
+
enableTranslation: N.boolean().optional()
|
|
2915
2917
|
})
|
|
2916
2918
|
])
|
|
2917
|
-
),
|
|
2919
|
+
), As = (n) => {
|
|
2918
2920
|
const e = Ss.safeParse(n);
|
|
2919
2921
|
if (e.success === !1) {
|
|
2920
2922
|
const t = new Error("Invalid codegen settings");
|
|
@@ -2922,36 +2924,36 @@ const Ss = P.object({
|
|
|
2922
2924
|
}
|
|
2923
2925
|
return e.data;
|
|
2924
2926
|
};
|
|
2925
|
-
var
|
|
2927
|
+
var z, Je;
|
|
2926
2928
|
class Zr {
|
|
2927
2929
|
constructor({
|
|
2928
2930
|
auth: e,
|
|
2929
2931
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
2930
2932
|
} = {}) {
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2933
|
+
ot(this, z);
|
|
2934
|
+
ot(this, Je);
|
|
2935
|
+
ct(this, Je, t), e && (this.auth = e);
|
|
2934
2936
|
}
|
|
2935
2937
|
hasAuth() {
|
|
2936
|
-
return !!
|
|
2938
|
+
return !!K(this, z);
|
|
2937
2939
|
}
|
|
2938
2940
|
set auth(e) {
|
|
2939
|
-
|
|
2941
|
+
ct(this, z, e);
|
|
2940
2942
|
}
|
|
2941
2943
|
get headers() {
|
|
2942
2944
|
const e = {
|
|
2943
2945
|
"Content-Type": "application/json"
|
|
2944
2946
|
};
|
|
2945
|
-
return
|
|
2947
|
+
return K(this, z) && (e.Authorization = `Bearer ${K(this, z).token}`, "teamId" in K(this, z) && (e["X-Team-Id"] = K(this, z).teamId), "userId" in K(this, z) && K(this, z).userId && (e["X-User-Id"] = K(this, z).userId)), e;
|
|
2946
2948
|
}
|
|
2947
2949
|
generateCode(s) {
|
|
2948
|
-
return
|
|
2949
|
-
var f, _,
|
|
2950
|
+
return F(this, arguments, function* (e, t = {}) {
|
|
2951
|
+
var f, _, I, E, O, Z, B, se;
|
|
2950
2952
|
if (this.hasAuth() === !1)
|
|
2951
2953
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
2952
|
-
const r = {}, a =
|
|
2954
|
+
const r = {}, a = As(e.settings), i = yield fetch(`${K(this, Je)}/v1/codegen`, {
|
|
2953
2955
|
method: "POST",
|
|
2954
|
-
headers: y(
|
|
2956
|
+
headers: y(u({}, this.headers), {
|
|
2955
2957
|
Accept: "text/event-stream"
|
|
2956
2958
|
}),
|
|
2957
2959
|
body: JSON.stringify({
|
|
@@ -2966,95 +2968,101 @@ class Zr {
|
|
|
2966
2968
|
uiLibrary: a.uiLibrary,
|
|
2967
2969
|
enableTranslation: a.enableTranslation,
|
|
2968
2970
|
enableUILibraryTheming: a.enableUILibraryTheming,
|
|
2969
|
-
enableCompactStructure: a.enableCompactStructure
|
|
2971
|
+
enableCompactStructure: a.enableCompactStructure,
|
|
2972
|
+
enableAutoSplit: a.enableAutoSplit,
|
|
2973
|
+
autoSplitThreshold: a.autoSplitThreshold
|
|
2970
2974
|
})
|
|
2971
2975
|
});
|
|
2972
2976
|
if (!i.ok) {
|
|
2973
|
-
let
|
|
2977
|
+
let q;
|
|
2974
2978
|
try {
|
|
2975
|
-
|
|
2976
|
-
} catch (
|
|
2977
|
-
|
|
2979
|
+
q = (yield i.json()).message || `HTTP error! status: ${i.status}`;
|
|
2980
|
+
} catch (P) {
|
|
2981
|
+
q = `HTTP error! status: ${i.status}`;
|
|
2978
2982
|
}
|
|
2979
|
-
throw new
|
|
2983
|
+
throw new Oe({
|
|
2980
2984
|
name: "HTTP Error",
|
|
2981
|
-
reason:
|
|
2985
|
+
reason: q,
|
|
2982
2986
|
status: i.status
|
|
2983
2987
|
});
|
|
2984
2988
|
}
|
|
2985
2989
|
if (!i.body)
|
|
2986
|
-
throw new
|
|
2990
|
+
throw new Oe({
|
|
2987
2991
|
name: "Stream Error",
|
|
2988
2992
|
reason: "Response body is null",
|
|
2989
2993
|
status: i.status
|
|
2990
2994
|
});
|
|
2991
2995
|
const o = i.body.getReader(), c = new TextDecoder();
|
|
2992
|
-
let
|
|
2996
|
+
let d = "";
|
|
2993
2997
|
try {
|
|
2994
2998
|
for (; ; ) {
|
|
2995
|
-
const { done:
|
|
2996
|
-
if (
|
|
2999
|
+
const { done: q, value: P } = yield o.read();
|
|
3000
|
+
if (q)
|
|
2997
3001
|
break;
|
|
2998
|
-
|
|
2999
|
-
const
|
|
3002
|
+
d += c.decode(P, { stream: !0 });
|
|
3003
|
+
const ce = d.split(`
|
|
3000
3004
|
`);
|
|
3001
|
-
|
|
3002
|
-
for (const
|
|
3003
|
-
if (!(!
|
|
3004
|
-
let
|
|
3005
|
+
d = ce.pop() || "";
|
|
3006
|
+
for (const be of ce)
|
|
3007
|
+
if (!(!be.trim() || be.startsWith(":")) && be.startsWith("data: ")) {
|
|
3008
|
+
let k;
|
|
3005
3009
|
try {
|
|
3006
|
-
|
|
3007
|
-
} catch (
|
|
3010
|
+
k = JSON.parse(be.slice(6));
|
|
3011
|
+
} catch (C) {
|
|
3008
3012
|
continue;
|
|
3009
3013
|
}
|
|
3010
|
-
switch (
|
|
3014
|
+
switch (k.type) {
|
|
3015
|
+
case "queueing": {
|
|
3016
|
+
typeof t == "function" ? t(k) : (f = t.onQueueing) == null || f.call(t);
|
|
3017
|
+
break;
|
|
3018
|
+
}
|
|
3011
3019
|
case "start": {
|
|
3012
|
-
r.sessionId =
|
|
3020
|
+
r.sessionId = k.sessionId, typeof t == "function" ? t(k) : (_ = t.onStart) == null || _.call(t, { sessionId: k.sessionId });
|
|
3013
3021
|
break;
|
|
3014
3022
|
}
|
|
3015
3023
|
case "pre_codegen": {
|
|
3016
|
-
typeof t == "function" ? t(
|
|
3024
|
+
typeof t == "function" ? t(k) : (I = t.onPreCodegen) == null || I.call(t, { message: k.message });
|
|
3017
3025
|
break;
|
|
3018
3026
|
}
|
|
3019
3027
|
case "assets_uploaded": {
|
|
3020
|
-
typeof t == "function" ? t(
|
|
3028
|
+
typeof t == "function" ? t(k) : (E = t.onAssetsUploaded) == null || E.call(t);
|
|
3021
3029
|
break;
|
|
3022
3030
|
}
|
|
3023
3031
|
case "assets_list": {
|
|
3024
|
-
r.assets =
|
|
3032
|
+
r.assets = k.payload.assets, typeof t == "function" ? t(k) : (O = t.onAssetsList) == null || O.call(t, k.payload);
|
|
3025
3033
|
break;
|
|
3026
3034
|
}
|
|
3027
3035
|
case "figma_metadata": {
|
|
3028
|
-
r.figmaFileName =
|
|
3029
|
-
figmaFileName:
|
|
3030
|
-
figmaSelectedFrameName:
|
|
3036
|
+
r.figmaFileName = k.figmaFileName, r.figmaSelectedFrameName = k.figmaSelectedFrameName, typeof t == "function" ? t(k) : (Z = t.onFigmaMetadata) == null || Z.call(t, {
|
|
3037
|
+
figmaFileName: k.figmaFileName,
|
|
3038
|
+
figmaSelectedFrameName: k.figmaSelectedFrameName
|
|
3031
3039
|
});
|
|
3032
3040
|
break;
|
|
3033
3041
|
}
|
|
3034
3042
|
case "generating_code": {
|
|
3035
|
-
|
|
3036
|
-
status:
|
|
3037
|
-
progress:
|
|
3038
|
-
files:
|
|
3043
|
+
k.payload.status === "success" && (r.files = k.payload.files), typeof t == "function" ? t(k) : (B = t.onGeneratingCode) == null || B.call(t, {
|
|
3044
|
+
status: k.payload.status,
|
|
3045
|
+
progress: k.payload.progress,
|
|
3046
|
+
files: k.payload.files
|
|
3039
3047
|
});
|
|
3040
3048
|
break;
|
|
3041
3049
|
}
|
|
3042
3050
|
case "codegen_completed": {
|
|
3043
|
-
typeof t == "function" ? t(
|
|
3051
|
+
typeof t == "function" ? t(k) : (se = t.onCodegenCompleted) == null || se.call(t);
|
|
3044
3052
|
break;
|
|
3045
3053
|
}
|
|
3046
3054
|
case "error":
|
|
3047
|
-
throw new
|
|
3048
|
-
name:
|
|
3049
|
-
reason:
|
|
3055
|
+
throw new Oe({
|
|
3056
|
+
name: k.payload.errorName,
|
|
3057
|
+
reason: k.payload.reason
|
|
3050
3058
|
});
|
|
3051
3059
|
case "done": {
|
|
3052
3060
|
if (!r.files)
|
|
3053
|
-
throw new
|
|
3061
|
+
throw new Oe({
|
|
3054
3062
|
name: "Invalid response",
|
|
3055
3063
|
reason: "No files found"
|
|
3056
3064
|
});
|
|
3057
|
-
return r.tokenUsage =
|
|
3065
|
+
return r.tokenUsage = k.payload.tokenUsage, r;
|
|
3058
3066
|
}
|
|
3059
3067
|
}
|
|
3060
3068
|
}
|
|
@@ -3062,7 +3070,7 @@ class Zr {
|
|
|
3062
3070
|
} finally {
|
|
3063
3071
|
o.cancel();
|
|
3064
3072
|
}
|
|
3065
|
-
throw new
|
|
3073
|
+
throw new Oe({
|
|
3066
3074
|
name: "Connection",
|
|
3067
3075
|
reason: "Connection closed before the 'done' message",
|
|
3068
3076
|
status: 500
|
|
@@ -3070,7 +3078,7 @@ class Zr {
|
|
|
3070
3078
|
});
|
|
3071
3079
|
}
|
|
3072
3080
|
}
|
|
3073
|
-
|
|
3081
|
+
z = new WeakMap(), Je = new WeakMap();
|
|
3074
3082
|
const Mr = (n) => {
|
|
3075
3083
|
var e;
|
|
3076
3084
|
if (!n)
|
|
@@ -3104,12 +3112,12 @@ const Fr = ({
|
|
|
3104
3112
|
function r(a) {
|
|
3105
3113
|
if (s.has(a) || !n[a])
|
|
3106
3114
|
return;
|
|
3107
|
-
s.add(a), t[a] = n[a],
|
|
3115
|
+
s.add(a), t[a] = n[a], Es(n[a].content).forEach((o) => {
|
|
3108
3116
|
try {
|
|
3109
3117
|
const c = Os(a, o);
|
|
3110
3118
|
if (c.startsWith("src/")) {
|
|
3111
|
-
const
|
|
3112
|
-
Cs(n,
|
|
3119
|
+
const d = c.split("/").slice(0, -1).join("/");
|
|
3120
|
+
Cs(n, d).forEach((_) => {
|
|
3113
3121
|
s.has(_) || r(_);
|
|
3114
3122
|
});
|
|
3115
3123
|
}
|
|
@@ -3125,7 +3133,7 @@ const Fr = ({
|
|
|
3125
3133
|
a.startsWith(e) ? r(a) : a.startsWith("src/") || (t[a] = i);
|
|
3126
3134
|
}), t;
|
|
3127
3135
|
};
|
|
3128
|
-
function
|
|
3136
|
+
function Es(n) {
|
|
3129
3137
|
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
|
|
3130
3138
|
let r;
|
|
3131
3139
|
for (; (r = e.exec(n)) !== null; )
|
|
@@ -3191,74 +3199,74 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
|
|
|
3191
3199
|
for (var t of Ft(e))
|
|
3192
3200
|
Us.call(e, t) && Dt(n, t, e[t]);
|
|
3193
3201
|
return n;
|
|
3194
|
-
}, Et = (n, e) => Ls(n, Ds(e)),
|
|
3202
|
+
}, Et = (n, e) => Ls(n, Ds(e)), Ot = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (Ot(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (Ot(n, e, "write to private field"), e.set(n, t), t), Q = (n, e, t) => (Ot(n, e, "access private method"), t), A = (n, e, t) => new Promise((s, r) => {
|
|
3195
3203
|
var a = (c) => {
|
|
3196
3204
|
try {
|
|
3197
3205
|
o(t.next(c));
|
|
3198
|
-
} catch (
|
|
3199
|
-
r(
|
|
3206
|
+
} catch (d) {
|
|
3207
|
+
r(d);
|
|
3200
3208
|
}
|
|
3201
3209
|
}, i = (c) => {
|
|
3202
3210
|
try {
|
|
3203
3211
|
o(t.throw(c));
|
|
3204
|
-
} catch (
|
|
3205
|
-
r(
|
|
3212
|
+
} catch (d) {
|
|
3213
|
+
r(d);
|
|
3206
3214
|
}
|
|
3207
3215
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
3208
3216
|
o((t = t.apply(n, e)).next());
|
|
3209
|
-
}), zs = (n, e, t) => (e = n[Lt("asyncIterator")]) ? e.call(n) : (n = n[Lt("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((
|
|
3217
|
+
}), zs = (n, e, t) => (e = n[Lt("asyncIterator")]) ? e.call(n) : (n = n[Lt("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((d) => i({ value: d, done: c }), o)))), t("next"), t("return"), e), Ws = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
3210
3218
|
function Bs(n) {
|
|
3211
3219
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
3212
3220
|
}
|
|
3213
|
-
var
|
|
3221
|
+
var gt = { exports: {} }, qs = gt.exports, Vt;
|
|
3214
3222
|
function Hs() {
|
|
3215
3223
|
return Vt || (Vt = 1, function(n, e) {
|
|
3216
3224
|
(function(t, s) {
|
|
3217
3225
|
n.exports = s();
|
|
3218
3226
|
})(qs, function() {
|
|
3219
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined",
|
|
3220
|
-
function
|
|
3221
|
-
var It = typeof
|
|
3227
|
+
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", E = a && typeof Map.prototype.entries == "function", O = I && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), Z = E && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", se = B && Object.getPrototypeOf([][Symbol.iterator]()), q = f && typeof String.prototype[Symbol.iterator] == "function", P = q && Object.getPrototypeOf(""[Symbol.iterator]()), ce = 8, be = -1;
|
|
3228
|
+
function k(C) {
|
|
3229
|
+
var It = typeof C;
|
|
3222
3230
|
if (It !== "object")
|
|
3223
3231
|
return It;
|
|
3224
|
-
if (
|
|
3232
|
+
if (C === null)
|
|
3225
3233
|
return "null";
|
|
3226
|
-
if (
|
|
3234
|
+
if (C === s)
|
|
3227
3235
|
return "global";
|
|
3228
|
-
if (Array.isArray(
|
|
3236
|
+
if (Array.isArray(C) && (_ === !1 || !(Symbol.toStringTag in C)))
|
|
3229
3237
|
return "Array";
|
|
3230
3238
|
if (typeof window == "object" && window !== null) {
|
|
3231
|
-
if (typeof window.location == "object" &&
|
|
3239
|
+
if (typeof window.location == "object" && C === window.location)
|
|
3232
3240
|
return "Location";
|
|
3233
|
-
if (typeof window.document == "object" &&
|
|
3241
|
+
if (typeof window.document == "object" && C === window.document)
|
|
3234
3242
|
return "Document";
|
|
3235
3243
|
if (typeof window.navigator == "object") {
|
|
3236
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
3244
|
+
if (typeof window.navigator.mimeTypes == "object" && C === window.navigator.mimeTypes)
|
|
3237
3245
|
return "MimeTypeArray";
|
|
3238
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
3246
|
+
if (typeof window.navigator.plugins == "object" && C === window.navigator.plugins)
|
|
3239
3247
|
return "PluginArray";
|
|
3240
3248
|
}
|
|
3241
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
3242
|
-
if (
|
|
3249
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && C instanceof window.HTMLElement) {
|
|
3250
|
+
if (C.tagName === "BLOCKQUOTE")
|
|
3243
3251
|
return "HTMLQuoteElement";
|
|
3244
|
-
if (
|
|
3252
|
+
if (C.tagName === "TD")
|
|
3245
3253
|
return "HTMLTableDataCellElement";
|
|
3246
|
-
if (
|
|
3254
|
+
if (C.tagName === "TH")
|
|
3247
3255
|
return "HTMLTableHeaderCellElement";
|
|
3248
3256
|
}
|
|
3249
3257
|
}
|
|
3250
|
-
var Nt = _ &&
|
|
3258
|
+
var Nt = _ && C[Symbol.toStringTag];
|
|
3251
3259
|
if (typeof Nt == "string")
|
|
3252
3260
|
return Nt;
|
|
3253
|
-
var D = Object.getPrototypeOf(
|
|
3254
|
-
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" :
|
|
3261
|
+
var D = Object.getPrototypeOf(C);
|
|
3262
|
+
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : d && D === DataView.prototype ? "DataView" : a && D === Z ? "Map Iterator" : i && D === O ? "Set Iterator" : B && D === se ? "Array Iterator" : q && D === P ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(C).slice(ce, be);
|
|
3255
3263
|
}
|
|
3256
|
-
return
|
|
3264
|
+
return k;
|
|
3257
3265
|
});
|
|
3258
|
-
}(
|
|
3266
|
+
}(gt)), gt.exports;
|
|
3259
3267
|
}
|
|
3260
3268
|
var Js = Hs();
|
|
3261
|
-
const Gs = /* @__PURE__ */ Bs(Js),
|
|
3269
|
+
const Gs = /* @__PURE__ */ Bs(Js), Ct = typeof Buffer != "undefined", Ks = Ct && typeof Buffer.from != "undefined", Xs = Ct ? (
|
|
3262
3270
|
/**
|
|
3263
3271
|
* is value is Buffer?
|
|
3264
3272
|
*
|
|
@@ -3289,7 +3297,7 @@ const Gs = /* @__PURE__ */ Bs(Js), Ot = typeof Buffer != "undefined", Ks = Ot &&
|
|
|
3289
3297
|
function(n) {
|
|
3290
3298
|
return Buffer.from(n);
|
|
3291
3299
|
}
|
|
3292
|
-
) :
|
|
3300
|
+
) : Ct ? (
|
|
3293
3301
|
/**
|
|
3294
3302
|
* copy Buffer
|
|
3295
3303
|
*
|
|
@@ -3336,7 +3344,7 @@ function er(n, e, t = null) {
|
|
|
3336
3344
|
return e;
|
|
3337
3345
|
}
|
|
3338
3346
|
}
|
|
3339
|
-
function
|
|
3347
|
+
function vt(n) {
|
|
3340
3348
|
return Qs.has(n);
|
|
3341
3349
|
}
|
|
3342
3350
|
function Ut(n, e, t, s = null) {
|
|
@@ -3371,19 +3379,19 @@ function or(n) {
|
|
|
3371
3379
|
function cr(n) {
|
|
3372
3380
|
return new Date(n.getTime());
|
|
3373
3381
|
}
|
|
3374
|
-
function
|
|
3382
|
+
function ur(n) {
|
|
3375
3383
|
return new Number(n);
|
|
3376
3384
|
}
|
|
3377
|
-
function
|
|
3385
|
+
function dr(n) {
|
|
3378
3386
|
return new RegExp(n.source, n.flags);
|
|
3379
3387
|
}
|
|
3380
3388
|
function lr(n) {
|
|
3381
3389
|
return new String(n);
|
|
3382
3390
|
}
|
|
3383
|
-
function
|
|
3391
|
+
function re(n, e) {
|
|
3384
3392
|
return dt[e].from ? dt[e].from(n) : new dt[e](n);
|
|
3385
3393
|
}
|
|
3386
|
-
function
|
|
3394
|
+
function M(n) {
|
|
3387
3395
|
return n;
|
|
3388
3396
|
}
|
|
3389
3397
|
function zt() {
|
|
@@ -3405,38 +3413,38 @@ const mr = /* @__PURE__ */ new Map([
|
|
|
3405
3413
|
["Buffer", or],
|
|
3406
3414
|
["DataView", ir],
|
|
3407
3415
|
["Date", cr],
|
|
3408
|
-
["Number",
|
|
3409
|
-
["RegExp",
|
|
3416
|
+
["Number", ur],
|
|
3417
|
+
["RegExp", dr],
|
|
3410
3418
|
["String", lr],
|
|
3411
3419
|
// typed arrays
|
|
3412
3420
|
// TODO: pass bound function
|
|
3413
|
-
["Float32Array",
|
|
3414
|
-
["Float64Array",
|
|
3415
|
-
["Int16Array",
|
|
3416
|
-
["Int32Array",
|
|
3417
|
-
["Int8Array",
|
|
3418
|
-
["Uint16Array",
|
|
3419
|
-
["Uint32Array",
|
|
3420
|
-
["Uint8Array",
|
|
3421
|
-
["Uint8ClampedArray",
|
|
3421
|
+
["Float32Array", re],
|
|
3422
|
+
["Float64Array", re],
|
|
3423
|
+
["Int16Array", re],
|
|
3424
|
+
["Int32Array", re],
|
|
3425
|
+
["Int8Array", re],
|
|
3426
|
+
["Uint16Array", re],
|
|
3427
|
+
["Uint32Array", re],
|
|
3428
|
+
["Uint8Array", re],
|
|
3429
|
+
["Uint8ClampedArray", re],
|
|
3422
3430
|
// shallow copy
|
|
3423
|
-
["Array Iterator",
|
|
3424
|
-
["Map Iterator",
|
|
3425
|
-
["Promise",
|
|
3426
|
-
["Set Iterator",
|
|
3427
|
-
["String Iterator",
|
|
3428
|
-
["function",
|
|
3429
|
-
["global",
|
|
3431
|
+
["Array Iterator", M],
|
|
3432
|
+
["Map Iterator", M],
|
|
3433
|
+
["Promise", M],
|
|
3434
|
+
["Set Iterator", M],
|
|
3435
|
+
["String Iterator", M],
|
|
3436
|
+
["function", M],
|
|
3437
|
+
["global", M],
|
|
3430
3438
|
// NOTE: WeakMap and WeakSet cannot get entries
|
|
3431
|
-
["WeakMap",
|
|
3432
|
-
["WeakSet",
|
|
3439
|
+
["WeakMap", M],
|
|
3440
|
+
["WeakSet", M],
|
|
3433
3441
|
// primitives
|
|
3434
|
-
["boolean",
|
|
3435
|
-
["null",
|
|
3436
|
-
["number",
|
|
3437
|
-
["string",
|
|
3438
|
-
["symbol",
|
|
3439
|
-
["undefined",
|
|
3442
|
+
["boolean", M],
|
|
3443
|
+
["null", M],
|
|
3444
|
+
["number", M],
|
|
3445
|
+
["string", M],
|
|
3446
|
+
["symbol", M],
|
|
3447
|
+
["undefined", M],
|
|
3440
3448
|
// collections
|
|
3441
3449
|
// NOTE: return empty value, because recursively copy later.
|
|
3442
3450
|
["Arguments", zt],
|
|
@@ -3457,7 +3465,7 @@ const mr = /* @__PURE__ */ new Map([
|
|
|
3457
3465
|
]);
|
|
3458
3466
|
function yr() {
|
|
3459
3467
|
}
|
|
3460
|
-
function
|
|
3468
|
+
function _t(n, e = null, t = yr) {
|
|
3461
3469
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
3462
3470
|
const s = e || Ee(n), r = mr.get(s);
|
|
3463
3471
|
if (s === "Object") {
|
|
@@ -3467,7 +3475,7 @@ function vt(n, e = null, t = yr) {
|
|
|
3467
3475
|
}
|
|
3468
3476
|
return r ? r(n, s) : n;
|
|
3469
3477
|
}
|
|
3470
|
-
function
|
|
3478
|
+
function Ce(n, e = {}) {
|
|
3471
3479
|
typeof e == "function" && (e = {
|
|
3472
3480
|
customizer: e
|
|
3473
3481
|
});
|
|
@@ -3477,14 +3485,14 @@ function Oe(n, e = {}) {
|
|
|
3477
3485
|
// TODO: max depth
|
|
3478
3486
|
// depth = Infinity,
|
|
3479
3487
|
} = e, s = Ee(n);
|
|
3480
|
-
if (!
|
|
3481
|
-
return
|
|
3482
|
-
const r =
|
|
3483
|
-
return
|
|
3484
|
-
}
|
|
3485
|
-
function
|
|
3486
|
-
const a = Ee(n), i =
|
|
3487
|
-
if (!
|
|
3488
|
+
if (!vt(s))
|
|
3489
|
+
return bt(n, null, null, null);
|
|
3490
|
+
const r = _t(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
|
|
3491
|
+
return bt(n, r, a, i);
|
|
3492
|
+
}
|
|
3493
|
+
function bt(n, e, t, s, r) {
|
|
3494
|
+
const a = Ee(n), i = _t(n, a);
|
|
3495
|
+
if (!vt(a))
|
|
3488
3496
|
return i;
|
|
3489
3497
|
let o;
|
|
3490
3498
|
switch (a) {
|
|
@@ -3501,16 +3509,16 @@ function _t(n, e, t, s, r) {
|
|
|
3501
3509
|
break;
|
|
3502
3510
|
}
|
|
3503
3511
|
for (let c of o) {
|
|
3504
|
-
const
|
|
3505
|
-
if (s.has(
|
|
3506
|
-
Ut(e, c, t.get(
|
|
3512
|
+
const d = er(n, c, a);
|
|
3513
|
+
if (s.has(d))
|
|
3514
|
+
Ut(e, c, t.get(d), a);
|
|
3507
3515
|
else {
|
|
3508
|
-
const f = Ee(
|
|
3509
|
-
|
|
3516
|
+
const f = Ee(d), _ = _t(d, f);
|
|
3517
|
+
vt(f) && (t.set(d, _), s.add(d)), Ut(
|
|
3510
3518
|
e,
|
|
3511
3519
|
c,
|
|
3512
|
-
|
|
3513
|
-
|
|
3520
|
+
bt(
|
|
3521
|
+
d,
|
|
3514
3522
|
_,
|
|
3515
3523
|
t,
|
|
3516
3524
|
s
|
|
@@ -3522,32 +3530,32 @@ function _t(n, e, t, s, r) {
|
|
|
3522
3530
|
return e;
|
|
3523
3531
|
}
|
|
3524
3532
|
const gr = (n) => new Promise((e) => setTimeout(e, n));
|
|
3525
|
-
var
|
|
3533
|
+
var Ke, pe, Xe, wt, cn;
|
|
3526
3534
|
class vr {
|
|
3527
3535
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
3528
|
-
|
|
3536
|
+
W(this, wt), W(this, Ke), W(this, pe), W(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, pe, 0);
|
|
3529
3537
|
}
|
|
3530
3538
|
run() {
|
|
3531
|
-
return
|
|
3539
|
+
return A(this, null, function* () {
|
|
3532
3540
|
try {
|
|
3533
|
-
return yield
|
|
3541
|
+
return yield T(this, Xe).call(this);
|
|
3534
3542
|
} catch (e) {
|
|
3535
|
-
if (
|
|
3543
|
+
if (j(this, pe, T(this, pe) + 1), T(this, pe) > T(this, Ke))
|
|
3536
3544
|
throw console.error("Max attempts reached"), e;
|
|
3537
|
-
const t =
|
|
3545
|
+
const t = Q(this, wt, cn).call(this);
|
|
3538
3546
|
return yield gr(t), yield this.run();
|
|
3539
3547
|
}
|
|
3540
3548
|
});
|
|
3541
3549
|
}
|
|
3542
3550
|
}
|
|
3543
|
-
|
|
3544
|
-
return
|
|
3551
|
+
Ke = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(), cn = function() {
|
|
3552
|
+
return T(this, pe) * 1e3 * 1.5;
|
|
3545
3553
|
};
|
|
3546
3554
|
function _r() {
|
|
3547
3555
|
return typeof CompressionStream != "undefined";
|
|
3548
3556
|
}
|
|
3549
3557
|
function br(n) {
|
|
3550
|
-
return
|
|
3558
|
+
return A(this, null, function* () {
|
|
3551
3559
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
3552
3560
|
try {
|
|
3553
3561
|
for (var s = zs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
@@ -3568,7 +3576,7 @@ function br(n) {
|
|
|
3568
3576
|
});
|
|
3569
3577
|
}
|
|
3570
3578
|
function wr(n) {
|
|
3571
|
-
return
|
|
3579
|
+
return A(this, null, function* () {
|
|
3572
3580
|
const e = yield new Blob(n).arrayBuffer();
|
|
3573
3581
|
return new Uint8Array(e);
|
|
3574
3582
|
});
|
|
@@ -3579,8 +3587,8 @@ class xr extends Error {
|
|
|
3579
3587
|
for (const [i, o] of Object.entries(r))
|
|
3580
3588
|
if (typeof Headers != "undefined" && o instanceof Headers) {
|
|
3581
3589
|
const c = {};
|
|
3582
|
-
o.forEach((
|
|
3583
|
-
c[f] =
|
|
3590
|
+
o.forEach((d, f) => {
|
|
3591
|
+
c[f] = d;
|
|
3584
3592
|
}), this.causeProperties[i] = c;
|
|
3585
3593
|
} else
|
|
3586
3594
|
this.causeProperties[i] = o;
|
|
@@ -3606,7 +3614,7 @@ class Wt extends Error {
|
|
|
3606
3614
|
}
|
|
3607
3615
|
}
|
|
3608
3616
|
}
|
|
3609
|
-
class
|
|
3617
|
+
class je extends Error {
|
|
3610
3618
|
constructor(e = {}) {
|
|
3611
3619
|
const { canceled: t = !1 } = e;
|
|
3612
3620
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
@@ -3617,25 +3625,25 @@ class kr extends Error {
|
|
|
3617
3625
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
3618
3626
|
}
|
|
3619
3627
|
}
|
|
3620
|
-
class
|
|
3628
|
+
class lt extends Error {
|
|
3621
3629
|
constructor(e) {
|
|
3622
3630
|
super(e), this.name = "Request Validation Error";
|
|
3623
3631
|
}
|
|
3624
3632
|
}
|
|
3625
|
-
function
|
|
3633
|
+
function un() {
|
|
3626
3634
|
return Array.from(
|
|
3627
3635
|
{ length: 32 },
|
|
3628
3636
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
3629
3637
|
).join("");
|
|
3630
3638
|
}
|
|
3631
|
-
function
|
|
3639
|
+
function xt() {
|
|
3632
3640
|
return Math.floor(Date.now() / 1e3).toString();
|
|
3633
3641
|
}
|
|
3634
3642
|
const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
|
|
3635
|
-
var me,
|
|
3636
|
-
class
|
|
3643
|
+
var me, L, X, kt, Tt, Re;
|
|
3644
|
+
class Ar {
|
|
3637
3645
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
3638
|
-
|
|
3646
|
+
W(this, X), W(this, me), W(this, L), this.baseAddress = t, j(this, me, e), j(this, L, {}), this.plugins = [];
|
|
3639
3647
|
}
|
|
3640
3648
|
get headers() {
|
|
3641
3649
|
throw new Error("Missing implementation");
|
|
@@ -3647,60 +3655,60 @@ class Er {
|
|
|
3647
3655
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
3648
3656
|
}
|
|
3649
3657
|
withOptions(e = {}) {
|
|
3650
|
-
return
|
|
3658
|
+
return j(this, L, e), this;
|
|
3651
3659
|
}
|
|
3652
3660
|
get(e) {
|
|
3653
|
-
return
|
|
3661
|
+
return A(this, arguments, function* (t, s = {}) {
|
|
3654
3662
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
3655
3663
|
let o = a != null ? a : this.headers;
|
|
3656
|
-
const c =
|
|
3657
|
-
return
|
|
3664
|
+
const c = Ce(T(this, L));
|
|
3665
|
+
return j(this, L, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Et(V({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() })), c.async ? yield Q(this, X, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, kt).call(this, `${i}${t}`, c, { headers: o });
|
|
3658
3666
|
});
|
|
3659
3667
|
}
|
|
3660
3668
|
post(e, t) {
|
|
3661
|
-
return
|
|
3662
|
-
const i =
|
|
3663
|
-
return
|
|
3669
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
3670
|
+
const i = Ce(T(this, L));
|
|
3671
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "POST", r, a, i);
|
|
3664
3672
|
});
|
|
3665
3673
|
}
|
|
3666
3674
|
put(e, t) {
|
|
3667
|
-
return
|
|
3668
|
-
const i =
|
|
3669
|
-
return
|
|
3675
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
3676
|
+
const i = Ce(T(this, L));
|
|
3677
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "PUT", r, a, i);
|
|
3670
3678
|
});
|
|
3671
3679
|
}
|
|
3672
3680
|
delete(e, t) {
|
|
3673
|
-
return
|
|
3674
|
-
const i =
|
|
3675
|
-
return
|
|
3681
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
3682
|
+
const i = Ce(T(this, L));
|
|
3683
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "DELETE", r, a, i);
|
|
3676
3684
|
});
|
|
3677
3685
|
}
|
|
3678
3686
|
patch(e, t) {
|
|
3679
|
-
return
|
|
3680
|
-
const i =
|
|
3681
|
-
return
|
|
3687
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
3688
|
+
const i = Ce(T(this, L));
|
|
3689
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "PATCH", r, a, i);
|
|
3682
3690
|
});
|
|
3683
3691
|
}
|
|
3684
3692
|
}
|
|
3685
|
-
me = /* @__PURE__ */ new WeakMap(),
|
|
3686
|
-
return
|
|
3687
|
-
const s = () =>
|
|
3688
|
-
var c,
|
|
3693
|
+
me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), kt = function(n, e, t) {
|
|
3694
|
+
return A(this, null, function* () {
|
|
3695
|
+
const s = () => A(this, null, function* () {
|
|
3696
|
+
var c, d;
|
|
3689
3697
|
try {
|
|
3690
|
-
return yield
|
|
3698
|
+
return yield T(this, me).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
3691
3699
|
} catch (f) {
|
|
3692
|
-
throw f instanceof Error && f.name === "AbortError" ? new
|
|
3700
|
+
throw f instanceof Error && f.name === "AbortError" ? new je({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
|
|
3693
3701
|
}
|
|
3694
|
-
}), { headers: r } = t != null ? t : {}, a = (c,
|
|
3702
|
+
}), { headers: r } = t != null ? t : {}, a = (c, d) => {
|
|
3695
3703
|
var f, _;
|
|
3696
|
-
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(
|
|
3697
|
-
}, i = (c) =>
|
|
3698
|
-
var
|
|
3704
|
+
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[d]) || "";
|
|
3705
|
+
}, i = (c) => A(this, null, function* () {
|
|
3706
|
+
var d;
|
|
3699
3707
|
if (!c.ok) {
|
|
3700
3708
|
const _ = yield c.text().catch();
|
|
3701
3709
|
throw new Wt({
|
|
3702
3710
|
url: n,
|
|
3703
|
-
method: (
|
|
3711
|
+
method: (d = t == null ? void 0 : t.method) != null ? d : "GET",
|
|
3704
3712
|
statusCode: c.status,
|
|
3705
3713
|
requestHeaders: r,
|
|
3706
3714
|
responseHeaders: c.headers,
|
|
@@ -3709,15 +3717,15 @@ me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3709
3717
|
}
|
|
3710
3718
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
3711
3719
|
try {
|
|
3712
|
-
const _ = a(c, "x-response-nonce"),
|
|
3713
|
-
if (!_ || _ !==
|
|
3714
|
-
throw new
|
|
3715
|
-
const
|
|
3716
|
-
if (isNaN(
|
|
3717
|
-
throw new
|
|
3720
|
+
const _ = a(c, "x-response-nonce"), I = r == null ? void 0 : r["X-Request-Nonce"];
|
|
3721
|
+
if (!_ || _ !== I)
|
|
3722
|
+
throw new lt("Response nonce mismatch");
|
|
3723
|
+
const E = Number(a(c, "x-response-timestamp")), O = Number(xt()), Z = 60 * 60 * 24;
|
|
3724
|
+
if (isNaN(E) || Math.abs(O - E) > Z)
|
|
3725
|
+
throw new lt("Invalid response timestamp");
|
|
3718
3726
|
} catch (_) {
|
|
3719
|
-
const
|
|
3720
|
-
throw new
|
|
3727
|
+
const I = _ instanceof Error ? _.message : "Request validation failed";
|
|
3728
|
+
throw new lt(I);
|
|
3721
3729
|
}
|
|
3722
3730
|
let f = yield c.text();
|
|
3723
3731
|
try {
|
|
@@ -3736,20 +3744,20 @@ me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3736
3744
|
const o = yield s();
|
|
3737
3745
|
return yield i(o);
|
|
3738
3746
|
});
|
|
3739
|
-
},
|
|
3740
|
-
return
|
|
3747
|
+
}, Tt = function(n, e, t) {
|
|
3748
|
+
return A(this, null, function* () {
|
|
3741
3749
|
var s, r;
|
|
3742
3750
|
const {
|
|
3743
3751
|
onProgress: a,
|
|
3744
3752
|
abortSignal: i,
|
|
3745
3753
|
pollingInterval: o = () => Sr,
|
|
3746
3754
|
maxTimeout: c = Tr
|
|
3747
|
-
} = e,
|
|
3755
|
+
} = e, d = `${n}/async`, f = `${n}/async/job`;
|
|
3748
3756
|
let _;
|
|
3749
3757
|
try {
|
|
3750
|
-
_ = yield
|
|
3758
|
+
_ = yield T(this, me).call(this, d, V(V({}, t), i && { signal: i }));
|
|
3751
3759
|
} catch (O) {
|
|
3752
|
-
throw O instanceof Error && O.name === "AbortError" ? new
|
|
3760
|
+
throw O instanceof Error && O.name === "AbortError" ? new je({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : O;
|
|
3753
3761
|
}
|
|
3754
3762
|
if (!_.ok) {
|
|
3755
3763
|
const O = yield _.text().catch();
|
|
@@ -3762,55 +3770,55 @@ me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3762
3770
|
body: O
|
|
3763
3771
|
});
|
|
3764
3772
|
}
|
|
3765
|
-
const
|
|
3766
|
-
if (!
|
|
3773
|
+
const I = yield _.json(), { job_id: E } = I;
|
|
3774
|
+
if (!E)
|
|
3767
3775
|
throw new Error("Job ID not found in response");
|
|
3768
|
-
return new Promise((O,
|
|
3769
|
-
const
|
|
3770
|
-
|
|
3771
|
-
}, c),
|
|
3776
|
+
return new Promise((O, Z) => A(this, null, function* () {
|
|
3777
|
+
const B = setTimeout(() => {
|
|
3778
|
+
Z(new Error("Job timed out"));
|
|
3779
|
+
}, c), se = (q = 0) => A(this, null, function* () {
|
|
3772
3780
|
if (i != null && i.aborted) {
|
|
3773
|
-
clearTimeout(
|
|
3774
|
-
|
|
3775
|
-
}).catch((
|
|
3776
|
-
|
|
3781
|
+
clearTimeout(B), T(this, me).call(this, `${f}/${E}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
3782
|
+
Z(new je({ canceled: !0 }));
|
|
3783
|
+
}).catch((P) => {
|
|
3784
|
+
Z(new je({ canceled: !1 }));
|
|
3777
3785
|
});
|
|
3778
3786
|
return;
|
|
3779
3787
|
}
|
|
3780
3788
|
try {
|
|
3781
|
-
const
|
|
3782
|
-
if (
|
|
3783
|
-
clearTimeout(
|
|
3784
|
-
const
|
|
3785
|
-
O(
|
|
3786
|
-
} else if (
|
|
3787
|
-
clearTimeout(
|
|
3789
|
+
const P = yield (yield T(this, me).call(this, `${f}/${E}`, { headers: this.headers })).json();
|
|
3790
|
+
if (P.status === "success") {
|
|
3791
|
+
clearTimeout(B);
|
|
3792
|
+
const ce = P.response_json;
|
|
3793
|
+
O(ce);
|
|
3794
|
+
} else if (P.status === "failed")
|
|
3795
|
+
clearTimeout(B), Z(new kr(P.response_json));
|
|
3788
3796
|
else {
|
|
3789
|
-
a && a(
|
|
3790
|
-
const
|
|
3791
|
-
setTimeout(() =>
|
|
3797
|
+
a && a(P.response_json);
|
|
3798
|
+
const ce = o(q);
|
|
3799
|
+
setTimeout(() => se(q + 1), ce);
|
|
3792
3800
|
}
|
|
3793
|
-
} catch (
|
|
3794
|
-
|
|
3801
|
+
} catch (P) {
|
|
3802
|
+
Z(P);
|
|
3795
3803
|
}
|
|
3796
3804
|
});
|
|
3797
|
-
|
|
3805
|
+
se();
|
|
3798
3806
|
}));
|
|
3799
3807
|
});
|
|
3800
|
-
},
|
|
3801
|
-
return
|
|
3808
|
+
}, Re = function(n, e, t, s, r) {
|
|
3809
|
+
return A(this, null, function* () {
|
|
3802
3810
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
3803
3811
|
let c = i != null ? i : this.headers;
|
|
3804
|
-
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce":
|
|
3805
|
-
let
|
|
3806
|
-
return r.compress && _r() && (c["Content-Encoding"] = "gzip",
|
|
3812
|
+
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() }));
|
|
3813
|
+
let d = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
3814
|
+
return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield Q(this, X, Tt).call(this, `${o}${n}`, r.async, {
|
|
3807
3815
|
method: e,
|
|
3808
3816
|
headers: c,
|
|
3809
|
-
body:
|
|
3810
|
-
}) : yield
|
|
3817
|
+
body: d
|
|
3818
|
+
}) : yield Q(this, X, kt).call(this, `${o}${n}`, r, { method: e, headers: c, body: d });
|
|
3811
3819
|
});
|
|
3812
3820
|
};
|
|
3813
|
-
const Bt = (n, e, t, s) => n instanceof
|
|
3821
|
+
const Bt = (n, e, t, s) => n instanceof je ? n : new xr({ resource: e, api: String(t), args: s, cause: n }), ft = (n, e) => new Proxy(e, {
|
|
3814
3822
|
get(t, s) {
|
|
3815
3823
|
return (...r) => {
|
|
3816
3824
|
var a;
|
|
@@ -3831,118 +3839,118 @@ const Bt = (n, e, t, s) => n instanceof Ne ? n : new xr({ resource: e, api: Stri
|
|
|
3831
3839
|
};
|
|
3832
3840
|
}
|
|
3833
3841
|
});
|
|
3834
|
-
var
|
|
3835
|
-
class
|
|
3842
|
+
var Ze;
|
|
3843
|
+
class Er {
|
|
3836
3844
|
constructor(e) {
|
|
3837
|
-
|
|
3845
|
+
W(this, Ze), this.resourceName = "Files", j(this, Ze, e);
|
|
3838
3846
|
}
|
|
3839
3847
|
get(e) {
|
|
3840
|
-
return
|
|
3848
|
+
return A(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
3841
3849
|
const r = new URLSearchParams(V({
|
|
3842
3850
|
plugin_data: "857346721138427857"
|
|
3843
3851
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
3844
|
-
return yield
|
|
3852
|
+
return yield T(this, Ze).get(a);
|
|
3845
3853
|
});
|
|
3846
3854
|
}
|
|
3847
3855
|
getImageFills(e) {
|
|
3848
|
-
return
|
|
3856
|
+
return A(this, arguments, function* ({ fileKey: t }) {
|
|
3849
3857
|
var s, r;
|
|
3850
3858
|
const a = `v1/files/${t}/images`;
|
|
3851
|
-
return (r = (s = (yield
|
|
3859
|
+
return (r = (s = (yield T(this, Ze).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
3852
3860
|
});
|
|
3853
3861
|
}
|
|
3854
3862
|
}
|
|
3855
|
-
|
|
3863
|
+
Ze = /* @__PURE__ */ new WeakMap();
|
|
3856
3864
|
const Or = (n, e, t) => {
|
|
3857
3865
|
const s = e.sort();
|
|
3858
3866
|
return `${n}-${s.join("-")}-${t}`;
|
|
3859
3867
|
}, Cr = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
3860
|
-
var
|
|
3868
|
+
var Y, St, dn;
|
|
3861
3869
|
class Ir {
|
|
3862
3870
|
constructor(e) {
|
|
3863
|
-
|
|
3871
|
+
W(this, St), W(this, Y), this.resourceName = "Images", j(this, Y, e);
|
|
3864
3872
|
}
|
|
3865
3873
|
/**
|
|
3866
3874
|
* Return the URL for the _layer_ images for the given nodes.
|
|
3867
3875
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
3868
3876
|
*/
|
|
3869
3877
|
get(e) {
|
|
3870
|
-
return
|
|
3871
|
-
const i = Or(t, s, r), o =
|
|
3878
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
3879
|
+
const i = Or(t, s, r), o = T(this, Y).cache.images.entries.get(i);
|
|
3872
3880
|
if (Cr(o))
|
|
3873
3881
|
return o.result;
|
|
3874
|
-
o &&
|
|
3875
|
-
const c =
|
|
3882
|
+
o && T(this, Y).cache.images.entries.delete(i);
|
|
3883
|
+
const c = T(this, Y).cache.images.pendingRequests.get(i);
|
|
3876
3884
|
if (c)
|
|
3877
3885
|
return c;
|
|
3878
|
-
const
|
|
3879
|
-
|
|
3886
|
+
const d = Q(this, St, dn).call(this, i, t, s, r, a);
|
|
3887
|
+
T(this, Y).cache.images.pendingRequests.set(i, d);
|
|
3880
3888
|
try {
|
|
3881
|
-
return yield
|
|
3889
|
+
return yield d;
|
|
3882
3890
|
} finally {
|
|
3883
|
-
|
|
3891
|
+
T(this, Y).cache.images.pendingRequests.delete(i);
|
|
3884
3892
|
}
|
|
3885
3893
|
});
|
|
3886
3894
|
}
|
|
3887
3895
|
}
|
|
3888
|
-
|
|
3889
|
-
return
|
|
3890
|
-
const a = yield
|
|
3896
|
+
Y = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), dn = function(n, e, t, s, r) {
|
|
3897
|
+
return A(this, null, function* () {
|
|
3898
|
+
const a = yield T(this, Y).get(
|
|
3891
3899
|
`v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
3892
3900
|
);
|
|
3893
|
-
return
|
|
3901
|
+
return T(this, Y).cache.images.entries.set(n, {
|
|
3894
3902
|
result: a,
|
|
3895
3903
|
ts: Date.now()
|
|
3896
3904
|
}), a;
|
|
3897
3905
|
});
|
|
3898
3906
|
};
|
|
3899
|
-
var
|
|
3907
|
+
var Ye;
|
|
3900
3908
|
class Nr {
|
|
3901
3909
|
constructor(e) {
|
|
3902
|
-
|
|
3910
|
+
W(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
|
|
3903
3911
|
}
|
|
3904
3912
|
get(e) {
|
|
3905
|
-
return
|
|
3913
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
3906
3914
|
const a = Et(V({}, r), {
|
|
3907
3915
|
ids: s.join(",")
|
|
3908
3916
|
}), i = new URLSearchParams(V({
|
|
3909
3917
|
plugin_data: "857346721138427857"
|
|
3910
3918
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
3911
|
-
return yield
|
|
3919
|
+
return yield T(this, Ye).get(o);
|
|
3912
3920
|
});
|
|
3913
3921
|
}
|
|
3914
3922
|
}
|
|
3915
|
-
|
|
3916
|
-
var
|
|
3917
|
-
class ln extends
|
|
3923
|
+
Ye = /* @__PURE__ */ new WeakMap();
|
|
3924
|
+
var ue;
|
|
3925
|
+
class ln extends Ar {
|
|
3918
3926
|
constructor({
|
|
3919
3927
|
baseAddress: e = "https://api.figma.com/",
|
|
3920
3928
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
3921
3929
|
} = {}) {
|
|
3922
|
-
super({ fetch: t, baseAddress: e }),
|
|
3930
|
+
super({ fetch: t, baseAddress: e }), W(this, ue, ""), this.cache = {
|
|
3923
3931
|
images: {
|
|
3924
3932
|
entries: /* @__PURE__ */ new Map(),
|
|
3925
3933
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
3926
3934
|
}
|
|
3927
|
-
}, this.files =
|
|
3935
|
+
}, this.files = ft(this, new Er(this)), this.nodes = ft(this, new Nr(this)), this.images = ft(this, new Ir(this));
|
|
3928
3936
|
}
|
|
3929
3937
|
set token(e) {
|
|
3930
3938
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
3931
3939
|
throw new Error("Invalid Figma access token");
|
|
3932
|
-
|
|
3940
|
+
j(this, ue, e);
|
|
3933
3941
|
}
|
|
3934
3942
|
get token() {
|
|
3935
|
-
return
|
|
3943
|
+
return T(this, ue);
|
|
3936
3944
|
}
|
|
3937
3945
|
get headers() {
|
|
3938
3946
|
const e = {
|
|
3939
3947
|
"Content-Type": "application/json"
|
|
3940
3948
|
};
|
|
3941
|
-
return
|
|
3949
|
+
return T(this, ue).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = T(this, ue) : T(this, ue).startsWith("figu_") && (e.Authorization = `Bearer ${T(this, ue)}`), e;
|
|
3942
3950
|
}
|
|
3943
3951
|
}
|
|
3944
|
-
|
|
3945
|
-
const Vr = (r) =>
|
|
3952
|
+
ue = /* @__PURE__ */ new WeakMap();
|
|
3953
|
+
const Vr = (r) => F(void 0, [r], function* ({
|
|
3946
3954
|
fileKey: n,
|
|
3947
3955
|
authToken: e,
|
|
3948
3956
|
figmaRestApi: t = new ln(),
|
|
@@ -3957,7 +3965,7 @@ const Vr = (r) => $(void 0, [r], function* ({
|
|
|
3957
3965
|
} catch (a) {
|
|
3958
3966
|
throw console.error(a), a;
|
|
3959
3967
|
}
|
|
3960
|
-
}), Ur = (a) =>
|
|
3968
|
+
}), Ur = (a) => F(void 0, [a], function* ({
|
|
3961
3969
|
fileKey: n,
|
|
3962
3970
|
authToken: e,
|
|
3963
3971
|
nodeIds: t,
|
|
@@ -3969,7 +3977,7 @@ const Vr = (r) => $(void 0, [r], function* ({
|
|
|
3969
3977
|
return (yield s.nodes.get({
|
|
3970
3978
|
fileKey: n,
|
|
3971
3979
|
nodeIds: t,
|
|
3972
|
-
params:
|
|
3980
|
+
params: u({}, r)
|
|
3973
3981
|
})).nodes;
|
|
3974
3982
|
} catch (i) {
|
|
3975
3983
|
return Ps(i, n);
|
|
@@ -3999,26 +4007,26 @@ const Vr = (r) => $(void 0, [r], function* ({
|
|
|
3999
4007
|
}), t.close();
|
|
4000
4008
|
});
|
|
4001
4009
|
}
|
|
4002
|
-
}), zr = (n, e) =>
|
|
4003
|
-
var c,
|
|
4010
|
+
}), zr = (n, e) => F(void 0, null, function* () {
|
|
4011
|
+
var c, d, f, _, I, E, O;
|
|
4004
4012
|
const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
4005
|
-
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (
|
|
4013
|
+
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))
|
|
4006
4014
|
return new Response(JSON.stringify(a.value), {
|
|
4007
|
-
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (
|
|
4015
|
+
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (E = (I = a.value) == null ? void 0 : I.payload) == null ? void 0 : E.status) != null ? O : 500,
|
|
4008
4016
|
headers: {
|
|
4009
4017
|
"Content-Type": "application/json"
|
|
4010
4018
|
}
|
|
4011
4019
|
});
|
|
4012
4020
|
const i = new TextEncoder(), o = r.pipeThrough(
|
|
4013
4021
|
new TransformStream({
|
|
4014
|
-
transform(
|
|
4015
|
-
const
|
|
4022
|
+
transform(Z, B) {
|
|
4023
|
+
const se = `event: ${Z.type}
|
|
4016
4024
|
data: ${JSON.stringify(
|
|
4017
|
-
|
|
4025
|
+
Z
|
|
4018
4026
|
)}
|
|
4019
4027
|
|
|
4020
4028
|
`;
|
|
4021
|
-
|
|
4029
|
+
B.enqueue(i.encode(se));
|
|
4022
4030
|
}
|
|
4023
4031
|
})
|
|
4024
4032
|
);
|
|
@@ -4033,7 +4041,7 @@ data: ${JSON.stringify(
|
|
|
4033
4041
|
});
|
|
4034
4042
|
export {
|
|
4035
4043
|
Zr as Anima,
|
|
4036
|
-
|
|
4044
|
+
Oe as CodegenError,
|
|
4037
4045
|
Is as FigmaTokenIssue,
|
|
4038
4046
|
js as NotFound,
|
|
4039
4047
|
Ns as RateLimitExceeded,
|
|
@@ -4052,6 +4060,6 @@ export {
|
|
|
4052
4060
|
Ms as isRateLimitExceeded,
|
|
4053
4061
|
Lr as isUnknownFigmaApiException,
|
|
4054
4062
|
Mr as isValidFigmaUrl,
|
|
4055
|
-
|
|
4063
|
+
As as validateSettings
|
|
4056
4064
|
};
|
|
4057
4065
|
//# sourceMappingURL=index.js.map
|