@animaapp/anima-sdk 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14,63 +14,67 @@ 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 G = (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, r) => (Mt(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t);
18
- var F = (n, e, t) => new Promise((r, s) => {
17
+ var X = (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 P = (n, e, t) => new Promise((s, r) => {
19
19
  var a = (c) => {
20
20
  try {
21
21
  o(t.next(c));
22
22
  } catch (u) {
23
- s(u);
23
+ r(u);
24
24
  }
25
25
  }, i = (c) => {
26
26
  try {
27
27
  o(t.throw(c));
28
28
  } catch (u) {
29
- s(u);
29
+ r(u);
30
30
  }
31
- }, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
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 Ae extends Error {
35
- constructor({ name: e, reason: t, status: r }) {
36
- super(), this.name = `[Codegen Error] ${e}`, this.message = t, this.status = r;
34
+ const gn = (n) => Object.entries(n).reduce(
35
+ (e, [t, s]) => (e[t] = { content: s.code, isBinary: !1 }, e),
36
+ {}
37
+ );
38
+ class Ee extends Error {
39
+ constructor({ name: e, reason: t, status: s }) {
40
+ super(), this.name = `[Codegen Error] ${e}`, this.message = t, this.status = s;
37
41
  }
38
42
  }
39
43
  var x;
40
44
  (function(n) {
41
- n.assertEqual = (s) => s;
42
- function e(s) {
45
+ n.assertEqual = (r) => r;
46
+ function e(r) {
43
47
  }
44
48
  n.assertIs = e;
45
- function t(s) {
49
+ function t(r) {
46
50
  throw new Error();
47
51
  }
48
- n.assertNever = t, n.arrayToEnum = (s) => {
52
+ n.assertNever = t, n.arrayToEnum = (r) => {
49
53
  const a = {};
50
- for (const i of s)
54
+ for (const i of r)
51
55
  a[i] = i;
52
56
  return a;
53
- }, n.getValidEnumValues = (s) => {
54
- const a = n.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
57
+ }, n.getValidEnumValues = (r) => {
58
+ const a = n.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), i = {};
55
59
  for (const o of a)
56
- i[o] = s[o];
60
+ i[o] = r[o];
57
61
  return n.objectValues(i);
58
- }, n.objectValues = (s) => n.objectKeys(s).map(function(a) {
59
- return s[a];
60
- }), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
62
+ }, n.objectValues = (r) => n.objectKeys(r).map(function(a) {
63
+ return r[a];
64
+ }), n.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
61
65
  const a = [];
62
- for (const i in s)
63
- Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
66
+ for (const i in r)
67
+ Object.prototype.hasOwnProperty.call(r, i) && a.push(i);
64
68
  return a;
65
- }, n.find = (s, a) => {
66
- for (const i of s)
69
+ }, n.find = (r, a) => {
70
+ for (const i of r)
67
71
  if (a(i))
68
72
  return i;
69
- }, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
70
- function r(s, a = " | ") {
71
- return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
73
+ }, n.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && isFinite(r) && Math.floor(r) === r;
74
+ function s(r, a = " | ") {
75
+ return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
72
76
  }
73
- n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
77
+ n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
74
78
  })(x || (x = {}));
75
79
  var ht;
76
80
  (function(n) {
@@ -97,7 +101,7 @@ const p = x.arrayToEnum([
97
101
  "never",
98
102
  "map",
99
103
  "set"
100
- ]), se = (n) => {
104
+ ]), oe = (n) => {
101
105
  switch (typeof n) {
102
106
  case "undefined":
103
107
  return p.undefined;
@@ -135,16 +139,16 @@ const p = x.arrayToEnum([
135
139
  "invalid_intersection_types",
136
140
  "not_multiple_of",
137
141
  "not_finite"
138
- ]), gn = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
139
- class z extends Error {
142
+ ]), vn = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
143
+ class U extends Error {
140
144
  get errors() {
141
145
  return this.issues;
142
146
  }
143
147
  constructor(e) {
144
- super(), this.issues = [], this.addIssue = (r) => {
145
- this.issues = [...this.issues, r];
146
- }, this.addIssues = (r = []) => {
147
- this.issues = [...this.issues, ...r];
148
+ super(), this.issues = [], this.addIssue = (s) => {
149
+ this.issues = [...this.issues, s];
150
+ }, this.addIssues = (s = []) => {
151
+ this.issues = [...this.issues, ...s];
148
152
  };
149
153
  const t = new.target.prototype;
150
154
  Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
@@ -152,28 +156,28 @@ class z extends Error {
152
156
  format(e) {
153
157
  const t = e || function(a) {
154
158
  return a.message;
155
- }, r = { _errors: [] }, s = (a) => {
159
+ }, s = { _errors: [] }, r = (a) => {
156
160
  for (const i of a.issues)
157
161
  if (i.code === "invalid_union")
158
- i.unionErrors.map(s);
162
+ i.unionErrors.map(r);
159
163
  else if (i.code === "invalid_return_type")
160
- s(i.returnTypeError);
164
+ r(i.returnTypeError);
161
165
  else if (i.code === "invalid_arguments")
162
- s(i.argumentsError);
166
+ r(i.argumentsError);
163
167
  else if (i.path.length === 0)
164
- r._errors.push(t(i));
168
+ s._errors.push(t(i));
165
169
  else {
166
- let o = r, c = 0;
170
+ let o = s, c = 0;
167
171
  for (; c < i.path.length; ) {
168
172
  const u = i.path[c];
169
173
  c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
170
174
  }
171
175
  }
172
176
  };
173
- return s(this), r;
177
+ return r(this), s;
174
178
  }
175
179
  static assert(e) {
176
- if (!(e instanceof z))
180
+ if (!(e instanceof U))
177
181
  throw new Error(`Not a ZodError: ${e}`);
178
182
  }
179
183
  toString() {
@@ -186,17 +190,17 @@ class z extends Error {
186
190
  return this.issues.length === 0;
187
191
  }
188
192
  flatten(e = (t) => t.message) {
189
- const t = {}, r = [];
190
- for (const s of this.issues)
191
- s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : r.push(e(s));
192
- return { formErrors: r, fieldErrors: t };
193
+ const t = {}, s = [];
194
+ for (const r of this.issues)
195
+ r.path.length > 0 ? (t[r.path[0]] = t[r.path[0]] || [], t[r.path[0]].push(e(r))) : s.push(e(r));
196
+ return { formErrors: s, fieldErrors: t };
193
197
  }
194
198
  get formErrors() {
195
199
  return this.flatten();
196
200
  }
197
201
  }
198
- z.create = (n) => new z(n);
199
- const xe = (n, e) => {
202
+ U.create = (n) => new U(n);
203
+ const ke = (n, e) => {
200
204
  let t;
201
205
  switch (n.code) {
202
206
  case l.invalid_type:
@@ -252,33 +256,33 @@ const xe = (n, e) => {
252
256
  }
253
257
  return { message: t };
254
258
  };
255
- let qt = xe;
256
- function vn(n) {
259
+ let qt = ke;
260
+ function _n(n) {
257
261
  qt = n;
258
262
  }
259
263
  function Qe() {
260
264
  return qt;
261
265
  }
262
266
  const et = (n) => {
263
- const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], i = y(d({}, s), {
267
+ const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = y(d({}, r), {
264
268
  path: a
265
269
  });
266
- if (s.message !== void 0)
267
- return y(d({}, s), {
270
+ if (r.message !== void 0)
271
+ return y(d({}, r), {
268
272
  path: a,
269
- message: s.message
273
+ message: r.message
270
274
  });
271
275
  let o = "";
272
- const c = r.filter((u) => !!u).slice().reverse();
276
+ const c = s.filter((u) => !!u).slice().reverse();
273
277
  for (const u of c)
274
278
  o = u(i, { data: e, defaultError: o }).message;
275
- return y(d({}, s), {
279
+ return y(d({}, r), {
276
280
  path: a,
277
281
  message: o
278
282
  });
279
- }, _n = [];
283
+ }, bn = [];
280
284
  function f(n, e) {
281
- const t = Qe(), r = et({
285
+ const t = Qe(), s = et({
282
286
  issueData: e,
283
287
  data: n.data,
284
288
  path: n.path,
@@ -289,11 +293,11 @@ function f(n, e) {
289
293
  // then schema-bound map if available
290
294
  t,
291
295
  // then global override map
292
- t === xe ? void 0 : xe
296
+ t === ke ? void 0 : ke
293
297
  // then global default map
294
- ].filter((s) => !!s)
298
+ ].filter((r) => !!r)
295
299
  });
296
- n.common.issues.push(r);
300
+ n.common.issues.push(s);
297
301
  }
298
302
  class I {
299
303
  constructor() {
@@ -306,46 +310,46 @@ class I {
306
310
  this.value !== "aborted" && (this.value = "aborted");
307
311
  }
308
312
  static mergeArray(e, t) {
309
- const r = [];
310
- for (const s of t) {
311
- if (s.status === "aborted")
313
+ const s = [];
314
+ for (const r of t) {
315
+ if (r.status === "aborted")
312
316
  return v;
313
- s.status === "dirty" && e.dirty(), r.push(s.value);
317
+ r.status === "dirty" && e.dirty(), s.push(r.value);
314
318
  }
315
- return { status: e.value, value: r };
319
+ return { status: e.value, value: s };
316
320
  }
317
321
  static mergeObjectAsync(e, t) {
318
- return F(this, null, function* () {
319
- const r = [];
320
- for (const s of t) {
321
- const a = yield s.key, i = yield s.value;
322
- r.push({
322
+ return P(this, null, function* () {
323
+ const s = [];
324
+ for (const r of t) {
325
+ const a = yield r.key, i = yield r.value;
326
+ s.push({
323
327
  key: a,
324
328
  value: i
325
329
  });
326
330
  }
327
- return I.mergeObjectSync(e, r);
331
+ return I.mergeObjectSync(e, s);
328
332
  });
329
333
  }
330
334
  static mergeObjectSync(e, t) {
331
- const r = {};
332
- for (const s of t) {
333
- const { key: a, value: i } = s;
335
+ const s = {};
336
+ for (const r of t) {
337
+ const { key: a, value: i } = r;
334
338
  if (a.status === "aborted" || i.status === "aborted")
335
339
  return v;
336
- a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || s.alwaysSet) && (r[a.value] = i.value);
340
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || r.alwaysSet) && (s[a.value] = i.value);
337
341
  }
338
- return { status: e.value, value: r };
342
+ return { status: e.value, value: s };
339
343
  }
340
344
  }
341
345
  const v = Object.freeze({
342
346
  status: "aborted"
343
- }), be = (n) => ({ status: "dirty", value: n }), M = (n) => ({ status: "valid", value: n }), pt = (n) => n.status === "aborted", mt = (n) => n.status === "dirty", ye = (n) => n.status === "valid", Re = (n) => typeof Promise != "undefined" && n instanceof Promise;
344
- function tt(n, e, t, r) {
347
+ }), we = (n) => ({ status: "dirty", value: n }), M = (n) => ({ status: "valid", value: n }), pt = (n) => n.status === "aborted", mt = (n) => n.status === "dirty", ge = (n) => n.status === "valid", Ze = (n) => typeof Promise != "undefined" && n instanceof Promise;
348
+ function tt(n, e, t, s) {
345
349
  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
350
  return e.get(n);
347
351
  }
348
- function Ht(n, e, t, r, s) {
352
+ function Ht(n, e, t, s, r) {
349
353
  if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
350
354
  return e.set(n, t), t;
351
355
  }
@@ -353,17 +357,17 @@ var m;
353
357
  (function(n) {
354
358
  n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
355
359
  })(m || (m = {}));
356
- var Oe, Ce;
357
- class ee {
358
- constructor(e, t, r, s) {
359
- this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
360
+ var Ce, Ne;
361
+ class ne {
362
+ constructor(e, t, s, r) {
363
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
360
364
  }
361
365
  get path() {
362
366
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
363
367
  }
364
368
  }
365
369
  const Pt = (n, e) => {
366
- if (ye(e))
370
+ if (ge(e))
367
371
  return { success: !0, data: e.value };
368
372
  if (!n.common.issues.length)
369
373
  throw new Error("Validation failed but no issues detected.");
@@ -372,7 +376,7 @@ const Pt = (n, e) => {
372
376
  get error() {
373
377
  if (this._error)
374
378
  return this._error;
375
- const t = new z(n.common.issues);
379
+ const t = new U(n.common.issues);
376
380
  return this._error = t, this._error;
377
381
  }
378
382
  };
@@ -380,27 +384,27 @@ const Pt = (n, e) => {
380
384
  function b(n) {
381
385
  if (!n)
382
386
  return {};
383
- const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = n;
384
- if (e && (t || r))
387
+ const { errorMap: e, invalid_type_error: t, required_error: s, description: r } = n;
388
+ if (e && (t || s))
385
389
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
386
- return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
390
+ return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
387
391
  var c, u;
388
392
  const { message: h } = n;
389
- return i.code === "invalid_enum_value" ? { message: h != null ? h : o.defaultError } : typeof o.data == "undefined" ? { message: (c = h != null ? h : r) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = h != null ? h : t) !== null && u !== void 0 ? u : o.defaultError };
390
- }, description: s };
393
+ return i.code === "invalid_enum_value" ? { message: h != null ? h : o.defaultError } : typeof o.data == "undefined" ? { message: (c = h != null ? h : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = h != null ? h : t) !== null && u !== void 0 ? u : o.defaultError };
394
+ }, description: r };
391
395
  }
392
396
  class w {
393
397
  get description() {
394
398
  return this._def.description;
395
399
  }
396
400
  _getType(e) {
397
- return se(e.data);
401
+ return oe(e.data);
398
402
  }
399
403
  _getOrReturnCtx(e, t) {
400
404
  return t || {
401
405
  common: e.parent.common,
402
406
  data: e.data,
403
- parsedType: se(e.data),
407
+ parsedType: oe(e.data),
404
408
  schemaErrorMap: this._def.errorMap,
405
409
  path: e.path,
406
410
  parent: e.parent
@@ -412,7 +416,7 @@ class w {
412
416
  ctx: {
413
417
  common: e.parent.common,
414
418
  data: e.data,
415
- parsedType: se(e.data),
419
+ parsedType: oe(e.data),
416
420
  schemaErrorMap: this._def.errorMap,
417
421
  path: e.path,
418
422
  parent: e.parent
@@ -421,7 +425,7 @@ class w {
421
425
  }
422
426
  _parseSync(e) {
423
427
  const t = this._parse(e);
424
- if (Re(t))
428
+ if (Ze(t))
425
429
  throw new Error("Synchronous parse encountered promise.");
426
430
  return t;
427
431
  }
@@ -430,30 +434,30 @@ class w {
430
434
  return Promise.resolve(t);
431
435
  }
432
436
  parse(e, t) {
433
- const r = this.safeParse(e, t);
434
- if (r.success)
435
- return r.data;
436
- throw r.error;
437
+ const s = this.safeParse(e, t);
438
+ if (s.success)
439
+ return s.data;
440
+ throw s.error;
437
441
  }
438
442
  safeParse(e, t) {
439
- var r;
440
- const s = {
443
+ var s;
444
+ const r = {
441
445
  common: {
442
446
  issues: [],
443
- async: (r = t == null ? void 0 : t.async) !== null && r !== void 0 ? r : !1,
447
+ async: (s = t == null ? void 0 : t.async) !== null && s !== void 0 ? s : !1,
444
448
  contextualErrorMap: t == null ? void 0 : t.errorMap
445
449
  },
446
450
  path: (t == null ? void 0 : t.path) || [],
447
451
  schemaErrorMap: this._def.errorMap,
448
452
  parent: null,
449
453
  data: e,
450
- parsedType: se(e)
451
- }, a = this._parseSync({ data: e, path: s.path, parent: s });
452
- return Pt(s, a);
454
+ parsedType: oe(e)
455
+ }, a = this._parseSync({ data: e, path: r.path, parent: r });
456
+ return Pt(r, a);
453
457
  }
454
458
  "~validate"(e) {
455
- var t, r;
456
- const s = {
459
+ var t, s;
460
+ const r = {
457
461
  common: {
458
462
  issues: [],
459
463
  async: !!this["~standard"].async
@@ -462,39 +466,39 @@ class w {
462
466
  schemaErrorMap: this._def.errorMap,
463
467
  parent: null,
464
468
  data: e,
465
- parsedType: se(e)
469
+ parsedType: oe(e)
466
470
  };
467
471
  if (!this["~standard"].async)
468
472
  try {
469
- const a = this._parseSync({ data: e, path: [], parent: s });
470
- return ye(a) ? {
473
+ const a = this._parseSync({ data: e, path: [], parent: r });
474
+ return ge(a) ? {
471
475
  value: a.value
472
476
  } : {
473
- issues: s.common.issues
477
+ issues: r.common.issues
474
478
  };
475
479
  } catch (a) {
476
- !((r = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || r === void 0) && r.includes("encountered") && (this["~standard"].async = !0), s.common = {
480
+ !((s = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || s === void 0) && s.includes("encountered") && (this["~standard"].async = !0), r.common = {
477
481
  issues: [],
478
482
  async: !0
479
483
  };
480
484
  }
481
- return this._parseAsync({ data: e, path: [], parent: s }).then((a) => ye(a) ? {
485
+ return this._parseAsync({ data: e, path: [], parent: r }).then((a) => ge(a) ? {
482
486
  value: a.value
483
487
  } : {
484
- issues: s.common.issues
488
+ issues: r.common.issues
485
489
  });
486
490
  }
487
491
  parseAsync(e, t) {
488
- return F(this, null, function* () {
489
- const r = yield this.safeParseAsync(e, t);
490
- if (r.success)
491
- return r.data;
492
- throw r.error;
492
+ return P(this, null, function* () {
493
+ const s = yield this.safeParseAsync(e, t);
494
+ if (s.success)
495
+ return s.data;
496
+ throw s.error;
493
497
  });
494
498
  }
495
499
  safeParseAsync(e, t) {
496
- return F(this, null, function* () {
497
- const r = {
500
+ return P(this, null, function* () {
501
+ const s = {
498
502
  common: {
499
503
  issues: [],
500
504
  contextualErrorMap: t == null ? void 0 : t.errorMap,
@@ -504,25 +508,25 @@ class w {
504
508
  schemaErrorMap: this._def.errorMap,
505
509
  parent: null,
506
510
  data: e,
507
- parsedType: se(e)
508
- }, s = this._parse({ data: e, path: r.path, parent: r }), a = yield Re(s) ? s : Promise.resolve(s);
509
- return Pt(r, a);
511
+ parsedType: oe(e)
512
+ }, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Ze(r) ? r : Promise.resolve(r);
513
+ return Pt(s, a);
510
514
  });
511
515
  }
512
516
  refine(e, t) {
513
- const r = (s) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(s) : t;
514
- return this._refinement((s, a) => {
515
- const i = e(s), o = () => a.addIssue(d({
517
+ const s = (r) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(r) : t;
518
+ return this._refinement((r, a) => {
519
+ const i = e(r), o = () => a.addIssue(d({
516
520
  code: l.custom
517
- }, r(s)));
521
+ }, s(r)));
518
522
  return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
519
523
  });
520
524
  }
521
525
  refinement(e, t) {
522
- return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
526
+ return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
523
527
  }
524
528
  _refinement(e) {
525
- return new J({
529
+ return new G({
526
530
  schema: this,
527
531
  typeName: g.ZodEffects,
528
532
  effect: { type: "refinement", refinement: e }
@@ -539,28 +543,28 @@ class w {
539
543
  };
540
544
  }
541
545
  optional() {
542
- return Q.create(this, this._def);
546
+ return te.create(this, this._def);
543
547
  }
544
548
  nullable() {
545
- return fe.create(this, this._def);
549
+ return he.create(this, this._def);
546
550
  }
547
551
  nullish() {
548
552
  return this.nullable().optional();
549
553
  }
550
554
  array() {
551
- return H.create(this);
555
+ return J.create(this);
552
556
  }
553
557
  promise() {
554
- return Te.create(this, this._def);
558
+ return Se.create(this, this._def);
555
559
  }
556
560
  or(e) {
557
- return $e.create([this, e], this._def);
561
+ return Le.create([this, e], this._def);
558
562
  }
559
563
  and(e) {
560
564
  return Fe.create(this, e, this._def);
561
565
  }
562
566
  transform(e) {
563
- return new J(y(d({}, b(this._def)), {
567
+ return new G(y(d({}, b(this._def)), {
564
568
  schema: this,
565
569
  typeName: g.ZodEffects,
566
570
  effect: { type: "transform", transform: e }
@@ -568,7 +572,7 @@ class w {
568
572
  }
569
573
  default(e) {
570
574
  const t = typeof e == "function" ? e : () => e;
571
- return new Ue(y(d({}, b(this._def)), {
575
+ return new Be(y(d({}, b(this._def)), {
572
576
  innerType: this,
573
577
  defaultValue: t,
574
578
  typeName: g.ZodDefault
@@ -582,7 +586,7 @@ class w {
582
586
  }
583
587
  catch(e) {
584
588
  const t = typeof e == "function" ? e : () => e;
585
- return new Be(y(d({}, b(this._def)), {
589
+ return new We(y(d({}, b(this._def)), {
586
590
  innerType: this,
587
591
  catchValue: t,
588
592
  typeName: g.ZodCatch
@@ -595,10 +599,10 @@ class w {
595
599
  }));
596
600
  }
597
601
  pipe(e) {
598
- return He.create(this, e);
602
+ return Je.create(this, e);
599
603
  }
600
604
  readonly() {
601
- return We.create(this);
605
+ return qe.create(this);
602
606
  }
603
607
  isOptional() {
604
608
  return this.safeParse(void 0).success;
@@ -607,14 +611,14 @@ class w {
607
611
  return this.safeParse(null).success;
608
612
  }
609
613
  }
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})+$";
614
+ const wn = /^c[^\s-]{8,}$/i, xn = /^[0-9a-z]+$/, kn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Tn = /^[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, Sn = /^[a-z0-9_-]{21}$/i, An = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, En = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, On = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Cn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
611
615
  let dt;
612
- const Cn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Nn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, jn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, In = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Mn = new RegExp(`^${Jt}$`);
616
+ const Nn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, jn = /^(?:(?: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])$/, In = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Rn = /^(([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])$/, Zn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Mn = /^([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])))", Pn = new RegExp(`^${Jt}$`);
613
617
  function Gt(n) {
614
618
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
615
619
  return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
616
620
  }
617
- function Pn(n) {
621
+ function $n(n) {
618
622
  return new RegExp(`^${Gt(n)}$`);
619
623
  }
620
624
  function Kt(n) {
@@ -622,23 +626,23 @@ function Kt(n) {
622
626
  const t = [];
623
627
  return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
624
628
  }
625
- function $n(n, e) {
626
- return !!((e === "v4" || !e) && Cn.test(n) || (e === "v6" || !e) && jn.test(n));
629
+ function Ln(n, e) {
630
+ return !!((e === "v4" || !e) && Nn.test(n) || (e === "v6" || !e) && In.test(n));
627
631
  }
628
632
  function Fn(n, e) {
629
- if (!Sn.test(n))
633
+ if (!An.test(n))
630
634
  return !1;
631
635
  try {
632
- const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
633
- return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
636
+ const [t] = n.split("."), s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(s));
637
+ return !(typeof r != "object" || r === null || !r.typ || !r.alg || e && r.alg !== e);
634
638
  } catch (t) {
635
639
  return !1;
636
640
  }
637
641
  }
638
642
  function Dn(n, e) {
639
- return !!((e === "v4" || !e) && Nn.test(n) || (e === "v6" || !e) && In.test(n));
643
+ return !!((e === "v4" || !e) && jn.test(n) || (e === "v6" || !e) && Rn.test(n));
640
644
  }
641
- class q extends w {
645
+ class H extends w {
642
646
  _parse(e) {
643
647
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
644
648
  const a = this._getOrReturnCtx(e);
@@ -648,159 +652,159 @@ class q extends w {
648
652
  received: a.parsedType
649
653
  }), v;
650
654
  }
651
- const r = new I();
652
- let s;
655
+ const s = new I();
656
+ let r;
653
657
  for (const a of this._def.checks)
654
658
  if (a.kind === "min")
655
- e.data.length < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
659
+ e.data.length < a.value && (r = this._getOrReturnCtx(e, r), f(r, {
656
660
  code: l.too_small,
657
661
  minimum: a.value,
658
662
  type: "string",
659
663
  inclusive: !0,
660
664
  exact: !1,
661
665
  message: a.message
662
- }), r.dirty());
666
+ }), s.dirty());
663
667
  else if (a.kind === "max")
664
- e.data.length > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
668
+ e.data.length > a.value && (r = this._getOrReturnCtx(e, r), f(r, {
665
669
  code: l.too_big,
666
670
  maximum: a.value,
667
671
  type: "string",
668
672
  inclusive: !0,
669
673
  exact: !1,
670
674
  message: a.message
671
- }), r.dirty());
675
+ }), s.dirty());
672
676
  else if (a.kind === "length") {
673
677
  const i = e.data.length > a.value, o = e.data.length < a.value;
674
- (i || o) && (s = this._getOrReturnCtx(e, s), i ? f(s, {
678
+ (i || o) && (r = this._getOrReturnCtx(e, r), i ? f(r, {
675
679
  code: l.too_big,
676
680
  maximum: a.value,
677
681
  type: "string",
678
682
  inclusive: !0,
679
683
  exact: !0,
680
684
  message: a.message
681
- }) : o && f(s, {
685
+ }) : o && f(r, {
682
686
  code: l.too_small,
683
687
  minimum: a.value,
684
688
  type: "string",
685
689
  inclusive: !0,
686
690
  exact: !0,
687
691
  message: a.message
688
- }), r.dirty());
692
+ }), s.dirty());
689
693
  } else if (a.kind === "email")
690
- En.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
694
+ On.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
691
695
  validation: "email",
692
696
  code: l.invalid_string,
693
697
  message: a.message
694
- }), r.dirty());
698
+ }), s.dirty());
695
699
  else if (a.kind === "emoji")
696
- dt || (dt = new RegExp(On, "u")), dt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
700
+ dt || (dt = new RegExp(Cn, "u")), dt.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
697
701
  validation: "emoji",
698
702
  code: l.invalid_string,
699
703
  message: a.message
700
- }), r.dirty());
704
+ }), s.dirty());
701
705
  else if (a.kind === "uuid")
702
- kn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
706
+ Tn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
703
707
  validation: "uuid",
704
708
  code: l.invalid_string,
705
709
  message: a.message
706
- }), r.dirty());
710
+ }), s.dirty());
707
711
  else if (a.kind === "nanoid")
708
- Tn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
712
+ Sn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
709
713
  validation: "nanoid",
710
714
  code: l.invalid_string,
711
715
  message: a.message
712
- }), r.dirty());
716
+ }), s.dirty());
713
717
  else if (a.kind === "cuid")
714
- bn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
718
+ wn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
715
719
  validation: "cuid",
716
720
  code: l.invalid_string,
717
721
  message: a.message
718
- }), r.dirty());
722
+ }), s.dirty());
719
723
  else if (a.kind === "cuid2")
720
- wn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
724
+ xn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
721
725
  validation: "cuid2",
722
726
  code: l.invalid_string,
723
727
  message: a.message
724
- }), r.dirty());
728
+ }), s.dirty());
725
729
  else if (a.kind === "ulid")
726
- xn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
730
+ kn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
727
731
  validation: "ulid",
728
732
  code: l.invalid_string,
729
733
  message: a.message
730
- }), r.dirty());
734
+ }), s.dirty());
731
735
  else if (a.kind === "url")
732
736
  try {
733
737
  new URL(e.data);
734
738
  } catch (i) {
735
- s = this._getOrReturnCtx(e, s), f(s, {
739
+ r = this._getOrReturnCtx(e, r), f(r, {
736
740
  validation: "url",
737
741
  code: l.invalid_string,
738
742
  message: a.message
739
- }), r.dirty();
743
+ }), s.dirty();
740
744
  }
741
- else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
745
+ else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
742
746
  validation: "regex",
743
747
  code: l.invalid_string,
744
748
  message: a.message
745
- }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), f(s, {
749
+ }), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), f(r, {
746
750
  code: l.invalid_string,
747
751
  validation: { includes: a.value, position: a.position },
748
752
  message: a.message
749
- }), r.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
753
+ }), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (r = this._getOrReturnCtx(e, r), f(r, {
750
754
  code: l.invalid_string,
751
755
  validation: { startsWith: a.value },
752
756
  message: a.message
753
- }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
757
+ }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), f(r, {
754
758
  code: l.invalid_string,
755
759
  validation: { endsWith: a.value },
756
760
  message: a.message
757
- }), r.dirty()) : a.kind === "datetime" ? Kt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
761
+ }), s.dirty()) : a.kind === "datetime" ? Kt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
758
762
  code: l.invalid_string,
759
763
  validation: "datetime",
760
764
  message: a.message
761
- }), r.dirty()) : a.kind === "date" ? Mn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
765
+ }), s.dirty()) : a.kind === "date" ? Pn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
762
766
  code: l.invalid_string,
763
767
  validation: "date",
764
768
  message: a.message
765
- }), r.dirty()) : a.kind === "time" ? Pn(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
769
+ }), s.dirty()) : a.kind === "time" ? $n(a).test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
766
770
  code: l.invalid_string,
767
771
  validation: "time",
768
772
  message: a.message
769
- }), r.dirty()) : a.kind === "duration" ? An.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
773
+ }), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
770
774
  validation: "duration",
771
775
  code: l.invalid_string,
772
776
  message: a.message
773
- }), r.dirty()) : a.kind === "ip" ? $n(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
777
+ }), s.dirty()) : a.kind === "ip" ? Ln(e.data, a.version) || (r = this._getOrReturnCtx(e, r), f(r, {
774
778
  validation: "ip",
775
779
  code: l.invalid_string,
776
780
  message: a.message
777
- }), r.dirty()) : a.kind === "jwt" ? Fn(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
781
+ }), s.dirty()) : a.kind === "jwt" ? Fn(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), f(r, {
778
782
  validation: "jwt",
779
783
  code: l.invalid_string,
780
784
  message: a.message
781
- }), r.dirty()) : a.kind === "cidr" ? Dn(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
785
+ }), s.dirty()) : a.kind === "cidr" ? Dn(e.data, a.version) || (r = this._getOrReturnCtx(e, r), f(r, {
782
786
  validation: "cidr",
783
787
  code: l.invalid_string,
784
788
  message: a.message
785
- }), r.dirty()) : a.kind === "base64" ? Rn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
789
+ }), s.dirty()) : a.kind === "base64" ? Zn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
786
790
  validation: "base64",
787
791
  code: l.invalid_string,
788
792
  message: a.message
789
- }), r.dirty()) : a.kind === "base64url" ? Zn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
793
+ }), s.dirty()) : a.kind === "base64url" ? Mn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
790
794
  validation: "base64url",
791
795
  code: l.invalid_string,
792
796
  message: a.message
793
- }), r.dirty()) : x.assertNever(a);
794
- return { status: r.value, value: e.data };
797
+ }), s.dirty()) : x.assertNever(a);
798
+ return { status: s.value, value: e.data };
795
799
  }
796
- _regex(e, t, r) {
797
- return this.refinement((s) => e.test(s), d({
800
+ _regex(e, t, s) {
801
+ return this.refinement((r) => e.test(r), d({
798
802
  validation: t,
799
803
  code: l.invalid_string
800
- }, m.errToObj(r)));
804
+ }, m.errToObj(s)));
801
805
  }
802
806
  _addCheck(e) {
803
- return new q(y(d({}, this._def), {
807
+ return new H(y(d({}, this._def), {
804
808
  checks: [...this._def.checks, e]
805
809
  }));
806
810
  }
@@ -846,7 +850,7 @@ class q extends w {
846
850
  return this._addCheck(d({ kind: "cidr" }, m.errToObj(e)));
847
851
  }
848
852
  datetime(e) {
849
- var t, r;
853
+ var t, s;
850
854
  return typeof e == "string" ? this._addCheck({
851
855
  kind: "datetime",
852
856
  precision: null,
@@ -857,7 +861,7 @@ class q extends w {
857
861
  kind: "datetime",
858
862
  precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision,
859
863
  offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
860
- local: (r = e == null ? void 0 : e.local) !== null && r !== void 0 ? r : !1
864
+ local: (s = e == null ? void 0 : e.local) !== null && s !== void 0 ? s : !1
861
865
  }, m.errToObj(e == null ? void 0 : e.message)));
862
866
  }
863
867
  date(e) {
@@ -926,17 +930,17 @@ class q extends w {
926
930
  return this.min(1, m.errToObj(e));
927
931
  }
928
932
  trim() {
929
- return new q(y(d({}, this._def), {
933
+ return new H(y(d({}, this._def), {
930
934
  checks: [...this._def.checks, { kind: "trim" }]
931
935
  }));
932
936
  }
933
937
  toLowerCase() {
934
- return new q(y(d({}, this._def), {
938
+ return new H(y(d({}, this._def), {
935
939
  checks: [...this._def.checks, { kind: "toLowerCase" }]
936
940
  }));
937
941
  }
938
942
  toUpperCase() {
939
- return new q(y(d({}, this._def), {
943
+ return new H(y(d({}, this._def), {
940
944
  checks: [...this._def.checks, { kind: "toUpperCase" }]
941
945
  }));
942
946
  }
@@ -1001,19 +1005,19 @@ class q extends w {
1001
1005
  return e;
1002
1006
  }
1003
1007
  }
1004
- q.create = (n) => {
1008
+ H.create = (n) => {
1005
1009
  var e;
1006
- return new q(d({
1010
+ return new H(d({
1007
1011
  checks: [],
1008
1012
  typeName: g.ZodString,
1009
1013
  coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
1010
1014
  }, b(n)));
1011
1015
  };
1012
- function Ln(n, e) {
1013
- const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = parseInt(n.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
1014
- return a % i / Math.pow(10, s);
1016
+ function Vn(n, e) {
1017
+ const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = parseInt(n.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
1018
+ return a % i / Math.pow(10, r);
1015
1019
  }
1016
- class de extends w {
1020
+ class ue extends w {
1017
1021
  constructor() {
1018
1022
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1019
1023
  }
@@ -1026,37 +1030,37 @@ class de extends w {
1026
1030
  received: a.parsedType
1027
1031
  }), v;
1028
1032
  }
1029
- let r;
1030
- const s = new I();
1033
+ let s;
1034
+ const r = new I();
1031
1035
  for (const a of this._def.checks)
1032
- a.kind === "int" ? x.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1036
+ a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1033
1037
  code: l.invalid_type,
1034
1038
  expected: "integer",
1035
1039
  received: "float",
1036
1040
  message: a.message
1037
- }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1041
+ }), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), f(s, {
1038
1042
  code: l.too_small,
1039
1043
  minimum: a.value,
1040
1044
  type: "number",
1041
1045
  inclusive: a.inclusive,
1042
1046
  exact: !1,
1043
1047
  message: a.message
1044
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1048
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), f(s, {
1045
1049
  code: l.too_big,
1046
1050
  maximum: a.value,
1047
1051
  type: "number",
1048
1052
  inclusive: a.inclusive,
1049
1053
  exact: !1,
1050
1054
  message: a.message
1051
- }), s.dirty()) : a.kind === "multipleOf" ? Ln(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), f(r, {
1055
+ }), r.dirty()) : a.kind === "multipleOf" ? Vn(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), f(s, {
1052
1056
  code: l.not_multiple_of,
1053
1057
  multipleOf: a.value,
1054
1058
  message: a.message
1055
- }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1059
+ }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1056
1060
  code: l.not_finite,
1057
1061
  message: a.message
1058
- }), s.dirty()) : x.assertNever(a);
1059
- return { status: s.value, value: e.data };
1062
+ }), r.dirty()) : x.assertNever(a);
1063
+ return { status: r.value, value: e.data };
1060
1064
  }
1061
1065
  gte(e, t) {
1062
1066
  return this.setLimit("min", e, !0, m.toString(t));
@@ -1070,21 +1074,21 @@ class de extends w {
1070
1074
  lt(e, t) {
1071
1075
  return this.setLimit("max", e, !1, m.toString(t));
1072
1076
  }
1073
- setLimit(e, t, r, s) {
1074
- return new de(y(d({}, this._def), {
1077
+ setLimit(e, t, s, r) {
1078
+ return new ue(y(d({}, this._def), {
1075
1079
  checks: [
1076
1080
  ...this._def.checks,
1077
1081
  {
1078
1082
  kind: e,
1079
1083
  value: t,
1080
- inclusive: r,
1081
- message: m.toString(s)
1084
+ inclusive: s,
1085
+ message: m.toString(r)
1082
1086
  }
1083
1087
  ]
1084
1088
  }));
1085
1089
  }
1086
1090
  _addCheck(e) {
1087
- return new de(y(d({}, this._def), {
1091
+ return new ue(y(d({}, this._def), {
1088
1092
  checks: [...this._def.checks, e]
1089
1093
  }));
1090
1094
  }
@@ -1169,20 +1173,20 @@ class de extends w {
1169
1173
  }
1170
1174
  get isFinite() {
1171
1175
  let e = null, t = null;
1172
- for (const r of this._def.checks) {
1173
- if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
1176
+ for (const s of this._def.checks) {
1177
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1174
1178
  return !0;
1175
- r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
1179
+ s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1176
1180
  }
1177
1181
  return Number.isFinite(t) && Number.isFinite(e);
1178
1182
  }
1179
1183
  }
1180
- de.create = (n) => new de(d({
1184
+ ue.create = (n) => new ue(d({
1181
1185
  checks: [],
1182
1186
  typeName: g.ZodNumber,
1183
1187
  coerce: (n == null ? void 0 : n.coerce) || !1
1184
1188
  }, b(n)));
1185
- class ue extends w {
1189
+ class le extends w {
1186
1190
  constructor() {
1187
1191
  super(...arguments), this.min = this.gte, this.max = this.lte;
1188
1192
  }
@@ -1195,27 +1199,27 @@ class ue extends w {
1195
1199
  }
1196
1200
  if (this._getType(e) !== p.bigint)
1197
1201
  return this._getInvalidInput(e);
1198
- let r;
1199
- const s = new I();
1202
+ let s;
1203
+ const r = new I();
1200
1204
  for (const a of this._def.checks)
1201
- a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1205
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), f(s, {
1202
1206
  code: l.too_small,
1203
1207
  type: "bigint",
1204
1208
  minimum: a.value,
1205
1209
  inclusive: a.inclusive,
1206
1210
  message: a.message
1207
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1211
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), f(s, {
1208
1212
  code: l.too_big,
1209
1213
  type: "bigint",
1210
1214
  maximum: a.value,
1211
1215
  inclusive: a.inclusive,
1212
1216
  message: a.message
1213
- }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), f(r, {
1217
+ }), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), f(s, {
1214
1218
  code: l.not_multiple_of,
1215
1219
  multipleOf: a.value,
1216
1220
  message: a.message
1217
- }), s.dirty()) : x.assertNever(a);
1218
- return { status: s.value, value: e.data };
1221
+ }), r.dirty()) : x.assertNever(a);
1222
+ return { status: r.value, value: e.data };
1219
1223
  }
1220
1224
  _getInvalidInput(e) {
1221
1225
  const t = this._getOrReturnCtx(e);
@@ -1237,21 +1241,21 @@ class ue extends w {
1237
1241
  lt(e, t) {
1238
1242
  return this.setLimit("max", e, !1, m.toString(t));
1239
1243
  }
1240
- setLimit(e, t, r, s) {
1241
- return new ue(y(d({}, this._def), {
1244
+ setLimit(e, t, s, r) {
1245
+ return new le(y(d({}, this._def), {
1242
1246
  checks: [
1243
1247
  ...this._def.checks,
1244
1248
  {
1245
1249
  kind: e,
1246
1250
  value: t,
1247
- inclusive: r,
1248
- message: m.toString(s)
1251
+ inclusive: s,
1252
+ message: m.toString(r)
1249
1253
  }
1250
1254
  ]
1251
1255
  }));
1252
1256
  }
1253
1257
  _addCheck(e) {
1254
- return new ue(y(d({}, this._def), {
1258
+ return new le(y(d({}, this._def), {
1255
1259
  checks: [...this._def.checks, e]
1256
1260
  }));
1257
1261
  }
@@ -1307,32 +1311,32 @@ class ue extends w {
1307
1311
  return e;
1308
1312
  }
1309
1313
  }
1310
- ue.create = (n) => {
1314
+ le.create = (n) => {
1311
1315
  var e;
1312
- return new ue(d({
1316
+ return new le(d({
1313
1317
  checks: [],
1314
1318
  typeName: g.ZodBigInt,
1315
1319
  coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
1316
1320
  }, b(n)));
1317
1321
  };
1318
- class Ze extends w {
1322
+ class Me extends w {
1319
1323
  _parse(e) {
1320
1324
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
1321
- const r = this._getOrReturnCtx(e);
1322
- return f(r, {
1325
+ const s = this._getOrReturnCtx(e);
1326
+ return f(s, {
1323
1327
  code: l.invalid_type,
1324
1328
  expected: p.boolean,
1325
- received: r.parsedType
1329
+ received: s.parsedType
1326
1330
  }), v;
1327
1331
  }
1328
1332
  return M(e.data);
1329
1333
  }
1330
1334
  }
1331
- Ze.create = (n) => new Ze(d({
1335
+ Me.create = (n) => new Me(d({
1332
1336
  typeName: g.ZodBoolean,
1333
1337
  coerce: (n == null ? void 0 : n.coerce) || !1
1334
1338
  }, b(n)));
1335
- class ge extends w {
1339
+ class ve extends w {
1336
1340
  _parse(e) {
1337
1341
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
1338
1342
  const a = this._getOrReturnCtx(e);
@@ -1348,31 +1352,31 @@ class ge extends w {
1348
1352
  code: l.invalid_date
1349
1353
  }), v;
1350
1354
  }
1351
- const r = new I();
1352
- let s;
1355
+ const s = new I();
1356
+ let r;
1353
1357
  for (const a of this._def.checks)
1354
- a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1358
+ a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), f(r, {
1355
1359
  code: l.too_small,
1356
1360
  message: a.message,
1357
1361
  inclusive: !0,
1358
1362
  exact: !1,
1359
1363
  minimum: a.value,
1360
1364
  type: "date"
1361
- }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1365
+ }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), f(r, {
1362
1366
  code: l.too_big,
1363
1367
  message: a.message,
1364
1368
  inclusive: !0,
1365
1369
  exact: !1,
1366
1370
  maximum: a.value,
1367
1371
  type: "date"
1368
- }), r.dirty()) : x.assertNever(a);
1372
+ }), s.dirty()) : x.assertNever(a);
1369
1373
  return {
1370
- status: r.value,
1374
+ status: s.value,
1371
1375
  value: new Date(e.data.getTime())
1372
1376
  };
1373
1377
  }
1374
1378
  _addCheck(e) {
1375
- return new ge(y(d({}, this._def), {
1379
+ return new ve(y(d({}, this._def), {
1376
1380
  checks: [...this._def.checks, e]
1377
1381
  }));
1378
1382
  }
@@ -1403,7 +1407,7 @@ class ge extends w {
1403
1407
  return e != null ? new Date(e) : null;
1404
1408
  }
1405
1409
  }
1406
- ge.create = (n) => new ge(d({
1410
+ ve.create = (n) => new ve(d({
1407
1411
  checks: [],
1408
1412
  coerce: (n == null ? void 0 : n.coerce) || !1,
1409
1413
  typeName: g.ZodDate
@@ -1411,11 +1415,11 @@ ge.create = (n) => new ge(d({
1411
1415
  class nt extends w {
1412
1416
  _parse(e) {
1413
1417
  if (this._getType(e) !== p.symbol) {
1414
- const r = this._getOrReturnCtx(e);
1415
- return f(r, {
1418
+ const s = this._getOrReturnCtx(e);
1419
+ return f(s, {
1416
1420
  code: l.invalid_type,
1417
1421
  expected: p.symbol,
1418
- received: r.parsedType
1422
+ received: s.parsedType
1419
1423
  }), v;
1420
1424
  }
1421
1425
  return M(e.data);
@@ -1424,39 +1428,39 @@ class nt extends w {
1424
1428
  nt.create = (n) => new nt(d({
1425
1429
  typeName: g.ZodSymbol
1426
1430
  }, b(n)));
1427
- class Me extends w {
1431
+ class Pe extends w {
1428
1432
  _parse(e) {
1429
1433
  if (this._getType(e) !== p.undefined) {
1430
- const r = this._getOrReturnCtx(e);
1431
- return f(r, {
1434
+ const s = this._getOrReturnCtx(e);
1435
+ return f(s, {
1432
1436
  code: l.invalid_type,
1433
1437
  expected: p.undefined,
1434
- received: r.parsedType
1438
+ received: s.parsedType
1435
1439
  }), v;
1436
1440
  }
1437
1441
  return M(e.data);
1438
1442
  }
1439
1443
  }
1440
- Me.create = (n) => new Me(d({
1444
+ Pe.create = (n) => new Pe(d({
1441
1445
  typeName: g.ZodUndefined
1442
1446
  }, b(n)));
1443
- class Pe extends w {
1447
+ class $e extends w {
1444
1448
  _parse(e) {
1445
1449
  if (this._getType(e) !== p.null) {
1446
- const r = this._getOrReturnCtx(e);
1447
- return f(r, {
1450
+ const s = this._getOrReturnCtx(e);
1451
+ return f(s, {
1448
1452
  code: l.invalid_type,
1449
1453
  expected: p.null,
1450
- received: r.parsedType
1454
+ received: s.parsedType
1451
1455
  }), v;
1452
1456
  }
1453
1457
  return M(e.data);
1454
1458
  }
1455
1459
  }
1456
- Pe.create = (n) => new Pe(d({
1460
+ $e.create = (n) => new $e(d({
1457
1461
  typeName: g.ZodNull
1458
1462
  }, b(n)));
1459
- class ke extends w {
1463
+ class Te extends w {
1460
1464
  constructor() {
1461
1465
  super(...arguments), this._any = !0;
1462
1466
  }
@@ -1464,10 +1468,10 @@ class ke extends w {
1464
1468
  return M(e.data);
1465
1469
  }
1466
1470
  }
1467
- ke.create = (n) => new ke(d({
1471
+ Te.create = (n) => new Te(d({
1468
1472
  typeName: g.ZodAny
1469
1473
  }, b(n)));
1470
- class me extends w {
1474
+ class ye extends w {
1471
1475
  constructor() {
1472
1476
  super(...arguments), this._unknown = !0;
1473
1477
  }
@@ -1475,10 +1479,10 @@ class me extends w {
1475
1479
  return M(e.data);
1476
1480
  }
1477
1481
  }
1478
- me.create = (n) => new me(d({
1482
+ ye.create = (n) => new ye(d({
1479
1483
  typeName: g.ZodUnknown
1480
1484
  }, b(n)));
1481
- class ae extends w {
1485
+ class ce extends w {
1482
1486
  _parse(e) {
1483
1487
  const t = this._getOrReturnCtx(e);
1484
1488
  return f(t, {
@@ -1488,80 +1492,80 @@ class ae extends w {
1488
1492
  }), v;
1489
1493
  }
1490
1494
  }
1491
- ae.create = (n) => new ae(d({
1495
+ ce.create = (n) => new ce(d({
1492
1496
  typeName: g.ZodNever
1493
1497
  }, b(n)));
1494
- class rt extends w {
1498
+ class st extends w {
1495
1499
  _parse(e) {
1496
1500
  if (this._getType(e) !== p.undefined) {
1497
- const r = this._getOrReturnCtx(e);
1498
- return f(r, {
1501
+ const s = this._getOrReturnCtx(e);
1502
+ return f(s, {
1499
1503
  code: l.invalid_type,
1500
1504
  expected: p.void,
1501
- received: r.parsedType
1505
+ received: s.parsedType
1502
1506
  }), v;
1503
1507
  }
1504
1508
  return M(e.data);
1505
1509
  }
1506
1510
  }
1507
- rt.create = (n) => new rt(d({
1511
+ st.create = (n) => new st(d({
1508
1512
  typeName: g.ZodVoid
1509
1513
  }, b(n)));
1510
- class H extends w {
1514
+ class J extends w {
1511
1515
  _parse(e) {
1512
- const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
1516
+ const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
1513
1517
  if (t.parsedType !== p.array)
1514
1518
  return f(t, {
1515
1519
  code: l.invalid_type,
1516
1520
  expected: p.array,
1517
1521
  received: t.parsedType
1518
1522
  }), v;
1519
- if (s.exactLength !== null) {
1520
- const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1523
+ if (r.exactLength !== null) {
1524
+ const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
1521
1525
  (i || o) && (f(t, {
1522
1526
  code: i ? l.too_big : l.too_small,
1523
- minimum: o ? s.exactLength.value : void 0,
1524
- maximum: i ? s.exactLength.value : void 0,
1527
+ minimum: o ? r.exactLength.value : void 0,
1528
+ maximum: i ? r.exactLength.value : void 0,
1525
1529
  type: "array",
1526
1530
  inclusive: !0,
1527
1531
  exact: !0,
1528
- message: s.exactLength.message
1529
- }), r.dirty());
1532
+ message: r.exactLength.message
1533
+ }), s.dirty());
1530
1534
  }
1531
- if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
1535
+ if (r.minLength !== null && t.data.length < r.minLength.value && (f(t, {
1532
1536
  code: l.too_small,
1533
- minimum: s.minLength.value,
1537
+ minimum: r.minLength.value,
1534
1538
  type: "array",
1535
1539
  inclusive: !0,
1536
1540
  exact: !1,
1537
- message: s.minLength.message
1538
- }), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
1541
+ message: r.minLength.message
1542
+ }), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (f(t, {
1539
1543
  code: l.too_big,
1540
- maximum: s.maxLength.value,
1544
+ maximum: r.maxLength.value,
1541
1545
  type: "array",
1542
1546
  inclusive: !0,
1543
1547
  exact: !1,
1544
- message: s.maxLength.message
1545
- }), r.dirty()), t.common.async)
1546
- return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new ee(t, i, t.path, o)))).then((i) => I.mergeArray(r, i));
1547
- const a = [...t.data].map((i, o) => s.type._parseSync(new ee(t, i, t.path, o)));
1548
- return I.mergeArray(r, a);
1548
+ message: r.maxLength.message
1549
+ }), s.dirty()), t.common.async)
1550
+ return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new ne(t, i, t.path, o)))).then((i) => I.mergeArray(s, i));
1551
+ const a = [...t.data].map((i, o) => r.type._parseSync(new ne(t, i, t.path, o)));
1552
+ return I.mergeArray(s, a);
1549
1553
  }
1550
1554
  get element() {
1551
1555
  return this._def.type;
1552
1556
  }
1553
1557
  min(e, t) {
1554
- return new H(y(d({}, this._def), {
1558
+ return new J(y(d({}, this._def), {
1555
1559
  minLength: { value: e, message: m.toString(t) }
1556
1560
  }));
1557
1561
  }
1558
1562
  max(e, t) {
1559
- return new H(y(d({}, this._def), {
1563
+ return new J(y(d({}, this._def), {
1560
1564
  maxLength: { value: e, message: m.toString(t) }
1561
1565
  }));
1562
1566
  }
1563
1567
  length(e, t) {
1564
- return new H(y(d({}, this._def), {
1568
+ return new J(y(d({}, this._def), {
1565
1569
  exactLength: { value: e, message: m.toString(t) }
1566
1570
  }));
1567
1571
  }
@@ -1569,26 +1573,26 @@ class H extends w {
1569
1573
  return this.min(1, e);
1570
1574
  }
1571
1575
  }
1572
- H.create = (n, e) => new H(d({
1576
+ J.create = (n, e) => new J(d({
1573
1577
  type: n,
1574
1578
  minLength: null,
1575
1579
  maxLength: null,
1576
1580
  exactLength: null,
1577
1581
  typeName: g.ZodArray
1578
1582
  }, b(e)));
1579
- function _e(n) {
1583
+ function be(n) {
1580
1584
  if (n instanceof S) {
1581
1585
  const e = {};
1582
1586
  for (const t in n.shape) {
1583
- const r = n.shape[t];
1584
- e[t] = Q.create(_e(r));
1587
+ const s = n.shape[t];
1588
+ e[t] = te.create(be(s));
1585
1589
  }
1586
1590
  return new S(y(d({}, n._def), {
1587
1591
  shape: () => e
1588
1592
  }));
1589
- } else return n instanceof H ? new H(y(d({}, n._def), {
1590
- type: _e(n.element)
1591
- })) : n instanceof Q ? Q.create(_e(n.unwrap())) : n instanceof fe ? fe.create(_e(n.unwrap())) : n instanceof te ? te.create(n.items.map((e) => _e(e))) : n;
1593
+ } else return n instanceof J ? new J(y(d({}, n._def), {
1594
+ type: be(n.element)
1595
+ })) : n instanceof te ? te.create(be(n.unwrap())) : n instanceof he ? he.create(be(n.unwrap())) : n instanceof se ? se.create(n.items.map((e) => be(e))) : n;
1592
1596
  }
1593
1597
  class S extends w {
1594
1598
  constructor() {
@@ -1609,59 +1613,59 @@ class S extends w {
1609
1613
  received: u.parsedType
1610
1614
  }), v;
1611
1615
  }
1612
- const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1613
- if (!(this._def.catchall instanceof ae && this._def.unknownKeys === "strip"))
1614
- for (const u in s.data)
1616
+ const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1617
+ if (!(this._def.catchall instanceof ce && this._def.unknownKeys === "strip"))
1618
+ for (const u in r.data)
1615
1619
  i.includes(u) || o.push(u);
1616
1620
  const c = [];
1617
1621
  for (const u of i) {
1618
- const h = a[u], _ = s.data[u];
1622
+ const h = a[u], _ = r.data[u];
1619
1623
  c.push({
1620
1624
  key: { status: "valid", value: u },
1621
- value: h._parse(new ee(s, _, s.path, u)),
1622
- alwaysSet: u in s.data
1625
+ value: h._parse(new ne(r, _, r.path, u)),
1626
+ alwaysSet: u in r.data
1623
1627
  });
1624
1628
  }
1625
- if (this._def.catchall instanceof ae) {
1629
+ if (this._def.catchall instanceof ce) {
1626
1630
  const u = this._def.unknownKeys;
1627
1631
  if (u === "passthrough")
1628
1632
  for (const h of o)
1629
1633
  c.push({
1630
1634
  key: { status: "valid", value: h },
1631
- value: { status: "valid", value: s.data[h] }
1635
+ value: { status: "valid", value: r.data[h] }
1632
1636
  });
1633
1637
  else if (u === "strict")
1634
- o.length > 0 && (f(s, {
1638
+ o.length > 0 && (f(r, {
1635
1639
  code: l.unrecognized_keys,
1636
1640
  keys: o
1637
- }), r.dirty());
1641
+ }), s.dirty());
1638
1642
  else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1639
1643
  } else {
1640
1644
  const u = this._def.catchall;
1641
1645
  for (const h of o) {
1642
- const _ = s.data[h];
1646
+ const _ = r.data[h];
1643
1647
  c.push({
1644
1648
  key: { status: "valid", value: h },
1645
1649
  value: u._parse(
1646
- new ee(s, _, s.path, h)
1650
+ new ne(r, _, r.path, h)
1647
1651
  //, ctx.child(key), value, getParsedType(value)
1648
1652
  ),
1649
- alwaysSet: h in s.data
1653
+ alwaysSet: h in r.data
1650
1654
  });
1651
1655
  }
1652
1656
  }
1653
- return s.common.async ? Promise.resolve().then(() => F(this, null, function* () {
1657
+ return r.common.async ? Promise.resolve().then(() => P(this, null, function* () {
1654
1658
  const u = [];
1655
1659
  for (const h of c) {
1656
- const _ = yield h.key, C = yield h.value;
1660
+ const _ = yield h.key, N = yield h.value;
1657
1661
  u.push({
1658
1662
  key: _,
1659
- value: C,
1663
+ value: N,
1660
1664
  alwaysSet: h.alwaysSet
1661
1665
  });
1662
1666
  }
1663
1667
  return u;
1664
- })).then((u) => I.mergeObjectSync(r, u)) : I.mergeObjectSync(r, c);
1668
+ })).then((u) => I.mergeObjectSync(s, u)) : I.mergeObjectSync(s, c);
1665
1669
  }
1666
1670
  get shape() {
1667
1671
  return this._def.shape();
@@ -1670,9 +1674,9 @@ class S extends w {
1670
1674
  return m.errToObj, new S(d(y(d({}, this._def), {
1671
1675
  unknownKeys: "strict"
1672
1676
  }), e !== void 0 ? {
1673
- errorMap: (t, r) => {
1674
- var s, a, i, o;
1675
- const c = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, r).message) !== null && i !== void 0 ? i : r.defaultError;
1677
+ errorMap: (t, s) => {
1678
+ var r, a, i, o;
1679
+ const c = (i = (a = (r = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(r, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
1676
1680
  return t.code === "unrecognized_keys" ? {
1677
1681
  message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : c
1678
1682
  } : {
@@ -1792,16 +1796,16 @@ class S extends w {
1792
1796
  }
1793
1797
  pick(e) {
1794
1798
  const t = {};
1795
- return x.objectKeys(e).forEach((r) => {
1796
- e[r] && this.shape[r] && (t[r] = this.shape[r]);
1799
+ return x.objectKeys(e).forEach((s) => {
1800
+ e[s] && this.shape[s] && (t[s] = this.shape[s]);
1797
1801
  }), new S(y(d({}, this._def), {
1798
1802
  shape: () => t
1799
1803
  }));
1800
1804
  }
1801
1805
  omit(e) {
1802
1806
  const t = {};
1803
- return x.objectKeys(this.shape).forEach((r) => {
1804
- e[r] || (t[r] = this.shape[r]);
1807
+ return x.objectKeys(this.shape).forEach((s) => {
1808
+ e[s] || (t[s] = this.shape[s]);
1805
1809
  }), new S(y(d({}, this._def), {
1806
1810
  shape: () => t
1807
1811
  }));
@@ -1810,27 +1814,27 @@ class S extends w {
1810
1814
  * @deprecated
1811
1815
  */
1812
1816
  deepPartial() {
1813
- return _e(this);
1817
+ return be(this);
1814
1818
  }
1815
1819
  partial(e) {
1816
1820
  const t = {};
1817
- return x.objectKeys(this.shape).forEach((r) => {
1818
- const s = this.shape[r];
1819
- e && !e[r] ? t[r] = s : t[r] = s.optional();
1821
+ return x.objectKeys(this.shape).forEach((s) => {
1822
+ const r = this.shape[s];
1823
+ e && !e[s] ? t[s] = r : t[s] = r.optional();
1820
1824
  }), new S(y(d({}, this._def), {
1821
1825
  shape: () => t
1822
1826
  }));
1823
1827
  }
1824
1828
  required(e) {
1825
1829
  const t = {};
1826
- return x.objectKeys(this.shape).forEach((r) => {
1827
- if (e && !e[r])
1828
- t[r] = this.shape[r];
1830
+ return x.objectKeys(this.shape).forEach((s) => {
1831
+ if (e && !e[s])
1832
+ t[s] = this.shape[s];
1829
1833
  else {
1830
- let a = this.shape[r];
1831
- for (; a instanceof Q; )
1834
+ let a = this.shape[s];
1835
+ for (; a instanceof te; )
1832
1836
  a = a._def.innerType;
1833
- t[r] = a;
1837
+ t[s] = a;
1834
1838
  }
1835
1839
  }), new S(y(d({}, this._def), {
1836
1840
  shape: () => t
@@ -1843,39 +1847,39 @@ class S extends w {
1843
1847
  S.create = (n, e) => new S(d({
1844
1848
  shape: () => n,
1845
1849
  unknownKeys: "strip",
1846
- catchall: ae.create(),
1850
+ catchall: ce.create(),
1847
1851
  typeName: g.ZodObject
1848
1852
  }, b(e)));
1849
1853
  S.strictCreate = (n, e) => new S(d({
1850
1854
  shape: () => n,
1851
1855
  unknownKeys: "strict",
1852
- catchall: ae.create(),
1856
+ catchall: ce.create(),
1853
1857
  typeName: g.ZodObject
1854
1858
  }, b(e)));
1855
1859
  S.lazycreate = (n, e) => new S(d({
1856
1860
  shape: n,
1857
1861
  unknownKeys: "strip",
1858
- catchall: ae.create(),
1862
+ catchall: ce.create(),
1859
1863
  typeName: g.ZodObject
1860
1864
  }, b(e)));
1861
- class $e extends w {
1865
+ class Le extends w {
1862
1866
  _parse(e) {
1863
- const { ctx: t } = this._processInputParams(e), r = this._def.options;
1864
- function s(a) {
1867
+ const { ctx: t } = this._processInputParams(e), s = this._def.options;
1868
+ function r(a) {
1865
1869
  for (const o of a)
1866
1870
  if (o.result.status === "valid")
1867
1871
  return o.result;
1868
1872
  for (const o of a)
1869
1873
  if (o.result.status === "dirty")
1870
1874
  return t.common.issues.push(...o.ctx.common.issues), o.result;
1871
- const i = a.map((o) => new z(o.ctx.common.issues));
1875
+ const i = a.map((o) => new U(o.ctx.common.issues));
1872
1876
  return f(t, {
1873
1877
  code: l.invalid_union,
1874
1878
  unionErrors: i
1875
1879
  }), v;
1876
1880
  }
1877
1881
  if (t.common.async)
1878
- return Promise.all(r.map((a) => F(this, null, function* () {
1882
+ return Promise.all(s.map((a) => P(this, null, function* () {
1879
1883
  const i = y(d({}, t), {
1880
1884
  common: y(d({}, t.common), {
1881
1885
  issues: []
@@ -1890,11 +1894,11 @@ class $e extends w {
1890
1894
  }),
1891
1895
  ctx: i
1892
1896
  };
1893
- }))).then(s);
1897
+ }))).then(r);
1894
1898
  {
1895
1899
  let a;
1896
1900
  const i = [];
1897
- for (const c of r) {
1901
+ for (const c of s) {
1898
1902
  const u = y(d({}, t), {
1899
1903
  common: y(d({}, t.common), {
1900
1904
  issues: []
@@ -1911,7 +1915,7 @@ class $e extends w {
1911
1915
  }
1912
1916
  if (a)
1913
1917
  return t.common.issues.push(...a.ctx.common.issues), a.result;
1914
- const o = i.map((c) => new z(c));
1918
+ const o = i.map((c) => new U(c));
1915
1919
  return f(t, {
1916
1920
  code: l.invalid_union,
1917
1921
  unionErrors: o
@@ -1922,11 +1926,11 @@ class $e extends w {
1922
1926
  return this._def.options;
1923
1927
  }
1924
1928
  }
1925
- $e.create = (n, e) => new $e(d({
1929
+ Le.create = (n, e) => new Le(d({
1926
1930
  options: n,
1927
1931
  typeName: g.ZodUnion
1928
1932
  }, b(e)));
1929
- const re = (n) => n instanceof Le ? re(n.schema) : n instanceof J ? re(n.innerType()) : n instanceof Ve ? [n.value] : n instanceof le ? n.options : n instanceof ze ? x.objectValues(n.enum) : n instanceof Ue ? re(n._def.innerType) : n instanceof Me ? [void 0] : n instanceof Pe ? [null] : n instanceof Q ? [void 0, ...re(n.unwrap())] : n instanceof fe ? [null, ...re(n.unwrap())] : n instanceof At || n instanceof We ? re(n.unwrap()) : n instanceof Be ? re(n._def.innerType) : [];
1933
+ const ie = (n) => n instanceof Ve ? ie(n.schema) : n instanceof G ? ie(n.innerType()) : n instanceof Ue ? [n.value] : n instanceof fe ? n.options : n instanceof ze ? x.objectValues(n.enum) : n instanceof Be ? ie(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof $e ? [null] : n instanceof te ? [void 0, ...ie(n.unwrap())] : n instanceof he ? [null, ...ie(n.unwrap())] : n instanceof At || n instanceof qe ? ie(n.unwrap()) : n instanceof We ? ie(n._def.innerType) : [];
1930
1934
  class it extends w {
1931
1935
  _parse(e) {
1932
1936
  const { ctx: t } = this._processInputParams(e);
@@ -1936,7 +1940,7 @@ class it extends w {
1936
1940
  expected: p.object,
1937
1941
  received: t.parsedType
1938
1942
  }), v;
1939
- const r = this.discriminator, s = t.data[r], a = this.optionsMap.get(s);
1943
+ const s = this.discriminator, r = t.data[s], a = this.optionsMap.get(r);
1940
1944
  return a ? t.common.async ? a._parseAsync({
1941
1945
  data: t.data,
1942
1946
  path: t.path,
@@ -1948,7 +1952,7 @@ class it extends w {
1948
1952
  }) : (f(t, {
1949
1953
  code: l.invalid_union_discriminator,
1950
1954
  options: Array.from(this.optionsMap.keys()),
1951
- path: [r]
1955
+ path: [s]
1952
1956
  }), v);
1953
1957
  }
1954
1958
  get discriminator() {
@@ -1968,32 +1972,32 @@ class it extends w {
1968
1972
  * @param types an array of object schemas
1969
1973
  * @param params
1970
1974
  */
1971
- static create(e, t, r) {
1972
- const s = /* @__PURE__ */ new Map();
1975
+ static create(e, t, s) {
1976
+ const r = /* @__PURE__ */ new Map();
1973
1977
  for (const a of t) {
1974
- const i = re(a.shape[e]);
1978
+ const i = ie(a.shape[e]);
1975
1979
  if (!i.length)
1976
1980
  throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1977
1981
  for (const o of i) {
1978
- if (s.has(o))
1982
+ if (r.has(o))
1979
1983
  throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
1980
- s.set(o, a);
1984
+ r.set(o, a);
1981
1985
  }
1982
1986
  }
1983
1987
  return new it(d({
1984
1988
  typeName: g.ZodDiscriminatedUnion,
1985
1989
  discriminator: e,
1986
1990
  options: t,
1987
- optionsMap: s
1988
- }, b(r)));
1991
+ optionsMap: r
1992
+ }, b(s)));
1989
1993
  }
1990
1994
  }
1991
1995
  function yt(n, e) {
1992
- const t = se(n), r = se(e);
1996
+ const t = oe(n), s = oe(e);
1993
1997
  if (n === e)
1994
1998
  return { valid: !0, data: n };
1995
- if (t === p.object && r === p.object) {
1996
- const s = x.objectKeys(e), a = x.objectKeys(n).filter((o) => s.indexOf(o) !== -1), i = d(d({}, n), e);
1999
+ if (t === p.object && s === p.object) {
2000
+ const r = x.objectKeys(e), a = x.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = d(d({}, n), e);
1997
2001
  for (const o of a) {
1998
2002
  const c = yt(n[o], e[o]);
1999
2003
  if (!c.valid)
@@ -2001,48 +2005,48 @@ function yt(n, e) {
2001
2005
  i[o] = c.data;
2002
2006
  }
2003
2007
  return { valid: !0, data: i };
2004
- } else if (t === p.array && r === p.array) {
2008
+ } else if (t === p.array && s === p.array) {
2005
2009
  if (n.length !== e.length)
2006
2010
  return { valid: !1 };
2007
- const s = [];
2011
+ const r = [];
2008
2012
  for (let a = 0; a < n.length; a++) {
2009
2013
  const i = n[a], o = e[a], c = yt(i, o);
2010
2014
  if (!c.valid)
2011
2015
  return { valid: !1 };
2012
- s.push(c.data);
2016
+ r.push(c.data);
2013
2017
  }
2014
- return { valid: !0, data: s };
2015
- } else return t === p.date && r === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2018
+ return { valid: !0, data: r };
2019
+ } else return t === p.date && s === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2016
2020
  }
2017
2021
  class Fe extends w {
2018
2022
  _parse(e) {
2019
- const { status: t, ctx: r } = this._processInputParams(e), s = (a, i) => {
2023
+ const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
2020
2024
  if (pt(a) || pt(i))
2021
2025
  return v;
2022
2026
  const o = yt(a.value, i.value);
2023
- return o.valid ? ((mt(a) || mt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(r, {
2027
+ return o.valid ? ((mt(a) || mt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(s, {
2024
2028
  code: l.invalid_intersection_types
2025
2029
  }), v);
2026
2030
  };
2027
- return r.common.async ? Promise.all([
2031
+ return s.common.async ? Promise.all([
2028
2032
  this._def.left._parseAsync({
2029
- data: r.data,
2030
- path: r.path,
2031
- parent: r
2033
+ data: s.data,
2034
+ path: s.path,
2035
+ parent: s
2032
2036
  }),
2033
2037
  this._def.right._parseAsync({
2034
- data: r.data,
2035
- path: r.path,
2036
- parent: r
2038
+ data: s.data,
2039
+ path: s.path,
2040
+ parent: s
2037
2041
  })
2038
- ]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
2039
- data: r.data,
2040
- path: r.path,
2041
- parent: r
2042
+ ]).then(([a, i]) => r(a, i)) : r(this._def.left._parseSync({
2043
+ data: s.data,
2044
+ path: s.path,
2045
+ parent: s
2042
2046
  }), this._def.right._parseSync({
2043
- data: r.data,
2044
- path: r.path,
2045
- parent: r
2047
+ data: s.data,
2048
+ path: s.path,
2049
+ parent: s
2046
2050
  }));
2047
2051
  }
2048
2052
  }
@@ -2051,49 +2055,49 @@ Fe.create = (n, e, t) => new Fe(d({
2051
2055
  right: e,
2052
2056
  typeName: g.ZodIntersection
2053
2057
  }, b(t)));
2054
- class te extends w {
2058
+ class se extends w {
2055
2059
  _parse(e) {
2056
- const { status: t, ctx: r } = this._processInputParams(e);
2057
- if (r.parsedType !== p.array)
2058
- return f(r, {
2060
+ const { status: t, ctx: s } = this._processInputParams(e);
2061
+ if (s.parsedType !== p.array)
2062
+ return f(s, {
2059
2063
  code: l.invalid_type,
2060
2064
  expected: p.array,
2061
- received: r.parsedType
2065
+ received: s.parsedType
2062
2066
  }), v;
2063
- if (r.data.length < this._def.items.length)
2064
- return f(r, {
2067
+ if (s.data.length < this._def.items.length)
2068
+ return f(s, {
2065
2069
  code: l.too_small,
2066
2070
  minimum: this._def.items.length,
2067
2071
  inclusive: !0,
2068
2072
  exact: !1,
2069
2073
  type: "array"
2070
2074
  }), v;
2071
- !this._def.rest && r.data.length > this._def.items.length && (f(r, {
2075
+ !this._def.rest && s.data.length > this._def.items.length && (f(s, {
2072
2076
  code: l.too_big,
2073
2077
  maximum: this._def.items.length,
2074
2078
  inclusive: !0,
2075
2079
  exact: !1,
2076
2080
  type: "array"
2077
2081
  }), t.dirty());
2078
- const a = [...r.data].map((i, o) => {
2082
+ const a = [...s.data].map((i, o) => {
2079
2083
  const c = this._def.items[o] || this._def.rest;
2080
- return c ? c._parse(new ee(r, i, r.path, o)) : null;
2084
+ return c ? c._parse(new ne(s, i, s.path, o)) : null;
2081
2085
  }).filter((i) => !!i);
2082
- return r.common.async ? Promise.all(a).then((i) => I.mergeArray(t, i)) : I.mergeArray(t, a);
2086
+ return s.common.async ? Promise.all(a).then((i) => I.mergeArray(t, i)) : I.mergeArray(t, a);
2083
2087
  }
2084
2088
  get items() {
2085
2089
  return this._def.items;
2086
2090
  }
2087
2091
  rest(e) {
2088
- return new te(y(d({}, this._def), {
2092
+ return new se(y(d({}, this._def), {
2089
2093
  rest: e
2090
2094
  }));
2091
2095
  }
2092
2096
  }
2093
- te.create = (n, e) => {
2097
+ se.create = (n, e) => {
2094
2098
  if (!Array.isArray(n))
2095
2099
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2096
- return new te(d({
2100
+ return new se(d({
2097
2101
  items: n,
2098
2102
  typeName: g.ZodTuple,
2099
2103
  rest: null
@@ -2107,38 +2111,38 @@ class De extends w {
2107
2111
  return this._def.valueType;
2108
2112
  }
2109
2113
  _parse(e) {
2110
- const { status: t, ctx: r } = this._processInputParams(e);
2111
- if (r.parsedType !== p.object)
2112
- return f(r, {
2114
+ const { status: t, ctx: s } = this._processInputParams(e);
2115
+ if (s.parsedType !== p.object)
2116
+ return f(s, {
2113
2117
  code: l.invalid_type,
2114
2118
  expected: p.object,
2115
- received: r.parsedType
2119
+ received: s.parsedType
2116
2120
  }), v;
2117
- const s = [], a = this._def.keyType, i = this._def.valueType;
2118
- for (const o in r.data)
2119
- s.push({
2120
- key: a._parse(new ee(r, o, r.path, o)),
2121
- value: i._parse(new ee(r, r.data[o], r.path, o)),
2122
- alwaysSet: o in r.data
2121
+ const r = [], a = this._def.keyType, i = this._def.valueType;
2122
+ for (const o in s.data)
2123
+ r.push({
2124
+ key: a._parse(new ne(s, o, s.path, o)),
2125
+ value: i._parse(new ne(s, s.data[o], s.path, o)),
2126
+ alwaysSet: o in s.data
2123
2127
  });
2124
- return r.common.async ? I.mergeObjectAsync(t, s) : I.mergeObjectSync(t, s);
2128
+ return s.common.async ? I.mergeObjectAsync(t, r) : I.mergeObjectSync(t, r);
2125
2129
  }
2126
2130
  get element() {
2127
2131
  return this._def.valueType;
2128
2132
  }
2129
- static create(e, t, r) {
2133
+ static create(e, t, s) {
2130
2134
  return t instanceof w ? new De(d({
2131
2135
  keyType: e,
2132
2136
  valueType: t,
2133
2137
  typeName: g.ZodRecord
2134
- }, b(r))) : new De(d({
2135
- keyType: q.create(),
2138
+ }, b(s))) : new De(d({
2139
+ keyType: H.create(),
2136
2140
  valueType: e,
2137
2141
  typeName: g.ZodRecord
2138
2142
  }, b(t)));
2139
2143
  }
2140
2144
  }
2141
- class st extends w {
2145
+ class rt extends w {
2142
2146
  get keySchema() {
2143
2147
  return this._def.keyType;
2144
2148
  }
@@ -2146,20 +2150,20 @@ class st extends w {
2146
2150
  return this._def.valueType;
2147
2151
  }
2148
2152
  _parse(e) {
2149
- const { status: t, ctx: r } = this._processInputParams(e);
2150
- if (r.parsedType !== p.map)
2151
- return f(r, {
2153
+ const { status: t, ctx: s } = this._processInputParams(e);
2154
+ if (s.parsedType !== p.map)
2155
+ return f(s, {
2152
2156
  code: l.invalid_type,
2153
2157
  expected: p.map,
2154
- received: r.parsedType
2158
+ received: s.parsedType
2155
2159
  }), v;
2156
- const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], u) => ({
2157
- key: s._parse(new ee(r, o, r.path, [u, "key"])),
2158
- value: a._parse(new ee(r, c, r.path, [u, "value"]))
2160
+ const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
2161
+ key: r._parse(new ne(s, o, s.path, [u, "key"])),
2162
+ value: a._parse(new ne(s, c, s.path, [u, "value"]))
2159
2163
  }));
2160
- if (r.common.async) {
2164
+ if (s.common.async) {
2161
2165
  const o = /* @__PURE__ */ new Map();
2162
- return Promise.resolve().then(() => F(this, null, function* () {
2166
+ return Promise.resolve().then(() => P(this, null, function* () {
2163
2167
  for (const c of i) {
2164
2168
  const u = yield c.key, h = yield c.value;
2165
2169
  if (u.status === "aborted" || h.status === "aborted")
@@ -2180,35 +2184,35 @@ class st extends w {
2180
2184
  }
2181
2185
  }
2182
2186
  }
2183
- st.create = (n, e, t) => new st(d({
2187
+ rt.create = (n, e, t) => new rt(d({
2184
2188
  valueType: e,
2185
2189
  keyType: n,
2186
2190
  typeName: g.ZodMap
2187
2191
  }, b(t)));
2188
- class ve extends w {
2192
+ class _e extends w {
2189
2193
  _parse(e) {
2190
- const { status: t, ctx: r } = this._processInputParams(e);
2191
- if (r.parsedType !== p.set)
2192
- return f(r, {
2194
+ const { status: t, ctx: s } = this._processInputParams(e);
2195
+ if (s.parsedType !== p.set)
2196
+ return f(s, {
2193
2197
  code: l.invalid_type,
2194
2198
  expected: p.set,
2195
- received: r.parsedType
2199
+ received: s.parsedType
2196
2200
  }), v;
2197
- const s = this._def;
2198
- s.minSize !== null && r.data.size < s.minSize.value && (f(r, {
2201
+ const r = this._def;
2202
+ r.minSize !== null && s.data.size < r.minSize.value && (f(s, {
2199
2203
  code: l.too_small,
2200
- minimum: s.minSize.value,
2204
+ minimum: r.minSize.value,
2201
2205
  type: "set",
2202
2206
  inclusive: !0,
2203
2207
  exact: !1,
2204
- message: s.minSize.message
2205
- }), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (f(r, {
2208
+ message: r.minSize.message
2209
+ }), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (f(s, {
2206
2210
  code: l.too_big,
2207
- maximum: s.maxSize.value,
2211
+ maximum: r.maxSize.value,
2208
2212
  type: "set",
2209
2213
  inclusive: !0,
2210
2214
  exact: !1,
2211
- message: s.maxSize.message
2215
+ message: r.maxSize.message
2212
2216
  }), t.dirty());
2213
2217
  const a = this._def.valueType;
2214
2218
  function i(c) {
@@ -2220,16 +2224,16 @@ class ve extends w {
2220
2224
  }
2221
2225
  return { status: t.value, value: u };
2222
2226
  }
2223
- const o = [...r.data.values()].map((c, u) => a._parse(new ee(r, c, r.path, u)));
2224
- return r.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2227
+ const o = [...s.data.values()].map((c, u) => a._parse(new ne(s, c, s.path, u)));
2228
+ return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2225
2229
  }
2226
2230
  min(e, t) {
2227
- return new ve(y(d({}, this._def), {
2231
+ return new _e(y(d({}, this._def), {
2228
2232
  minSize: { value: e, message: m.toString(t) }
2229
2233
  }));
2230
2234
  }
2231
2235
  max(e, t) {
2232
- return new ve(y(d({}, this._def), {
2236
+ return new _e(y(d({}, this._def), {
2233
2237
  maxSize: { value: e, message: m.toString(t) }
2234
2238
  }));
2235
2239
  }
@@ -2240,13 +2244,13 @@ class ve extends w {
2240
2244
  return this.min(1, e);
2241
2245
  }
2242
2246
  }
2243
- ve.create = (n, e) => new ve(d({
2247
+ _e.create = (n, e) => new _e(d({
2244
2248
  valueType: n,
2245
2249
  minSize: null,
2246
2250
  maxSize: null,
2247
2251
  typeName: g.ZodSet
2248
2252
  }, b(e)));
2249
- class we extends w {
2253
+ class xe extends w {
2250
2254
  constructor() {
2251
2255
  super(...arguments), this.validate = this.implement;
2252
2256
  }
@@ -2258,7 +2262,7 @@ class we extends w {
2258
2262
  expected: p.function,
2259
2263
  received: t.parsedType
2260
2264
  }), v;
2261
- function r(o, c) {
2265
+ function s(o, c) {
2262
2266
  return et({
2263
2267
  data: o,
2264
2268
  path: t.path,
@@ -2266,7 +2270,7 @@ class we extends w {
2266
2270
  t.common.contextualErrorMap,
2267
2271
  t.schemaErrorMap,
2268
2272
  Qe(),
2269
- xe
2273
+ ke
2270
2274
  ].filter((u) => !!u),
2271
2275
  issueData: {
2272
2276
  code: l.invalid_arguments,
@@ -2274,7 +2278,7 @@ class we extends w {
2274
2278
  }
2275
2279
  });
2276
2280
  }
2277
- function s(o, c) {
2281
+ function r(o, c) {
2278
2282
  return et({
2279
2283
  data: o,
2280
2284
  path: t.path,
@@ -2282,7 +2286,7 @@ class we extends w {
2282
2286
  t.common.contextualErrorMap,
2283
2287
  t.schemaErrorMap,
2284
2288
  Qe(),
2285
- xe
2289
+ ke
2286
2290
  ].filter((u) => !!u),
2287
2291
  issueData: {
2288
2292
  code: l.invalid_return_type,
@@ -2291,15 +2295,15 @@ class we extends w {
2291
2295
  });
2292
2296
  }
2293
2297
  const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2294
- if (this._def.returns instanceof Te) {
2298
+ if (this._def.returns instanceof Se) {
2295
2299
  const o = this;
2296
2300
  return M(function(...c) {
2297
- return F(this, null, function* () {
2298
- const u = new z([]), h = yield o._def.args.parseAsync(c, a).catch((E) => {
2299
- throw u.addIssue(r(c, E)), u;
2301
+ return P(this, null, function* () {
2302
+ const u = new U([]), h = yield o._def.args.parseAsync(c, a).catch((O) => {
2303
+ throw u.addIssue(s(c, O)), u;
2300
2304
  }), _ = yield Reflect.apply(i, this, h);
2301
- return yield o._def.returns._def.type.parseAsync(_, a).catch((E) => {
2302
- throw u.addIssue(s(_, E)), u;
2305
+ return yield o._def.returns._def.type.parseAsync(_, a).catch((O) => {
2306
+ throw u.addIssue(r(_, O)), u;
2303
2307
  });
2304
2308
  });
2305
2309
  });
@@ -2308,10 +2312,10 @@ class we extends w {
2308
2312
  return M(function(...c) {
2309
2313
  const u = o._def.args.safeParse(c, a);
2310
2314
  if (!u.success)
2311
- throw new z([r(c, u.error)]);
2315
+ throw new U([s(c, u.error)]);
2312
2316
  const h = Reflect.apply(i, this, u.data), _ = o._def.returns.safeParse(h, a);
2313
2317
  if (!_.success)
2314
- throw new z([s(h, _.error)]);
2318
+ throw new U([r(h, _.error)]);
2315
2319
  return _.data;
2316
2320
  });
2317
2321
  }
@@ -2323,12 +2327,12 @@ class we extends w {
2323
2327
  return this._def.returns;
2324
2328
  }
2325
2329
  args(...e) {
2326
- return new we(y(d({}, this._def), {
2327
- args: te.create(e).rest(me.create())
2330
+ return new xe(y(d({}, this._def), {
2331
+ args: se.create(e).rest(ye.create())
2328
2332
  }));
2329
2333
  }
2330
2334
  returns(e) {
2331
- return new we(y(d({}, this._def), {
2335
+ return new xe(y(d({}, this._def), {
2332
2336
  returns: e
2333
2337
  }));
2334
2338
  }
@@ -2338,15 +2342,15 @@ class we extends w {
2338
2342
  strictImplement(e) {
2339
2343
  return this.parse(e);
2340
2344
  }
2341
- static create(e, t, r) {
2342
- return new we(d({
2343
- args: e || te.create([]).rest(me.create()),
2344
- returns: t || me.create(),
2345
+ static create(e, t, s) {
2346
+ return new xe(d({
2347
+ args: e || se.create([]).rest(ye.create()),
2348
+ returns: t || ye.create(),
2345
2349
  typeName: g.ZodFunction
2346
- }, b(r)));
2350
+ }, b(s)));
2347
2351
  }
2348
2352
  }
2349
- class Le extends w {
2353
+ class Ve extends w {
2350
2354
  get schema() {
2351
2355
  return this._def.getter();
2352
2356
  }
@@ -2355,11 +2359,11 @@ class Le extends w {
2355
2359
  return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2356
2360
  }
2357
2361
  }
2358
- Le.create = (n, e) => new Le(d({
2362
+ Ve.create = (n, e) => new Ve(d({
2359
2363
  getter: n,
2360
2364
  typeName: g.ZodLazy
2361
2365
  }, b(e)));
2362
- class Ve extends w {
2366
+ class Ue extends w {
2363
2367
  _parse(e) {
2364
2368
  if (e.data !== this._def.value) {
2365
2369
  const t = this._getOrReturnCtx(e);
@@ -2375,35 +2379,35 @@ class Ve extends w {
2375
2379
  return this._def.value;
2376
2380
  }
2377
2381
  }
2378
- Ve.create = (n, e) => new Ve(d({
2382
+ Ue.create = (n, e) => new Ue(d({
2379
2383
  value: n,
2380
2384
  typeName: g.ZodLiteral
2381
2385
  }, b(e)));
2382
2386
  function Xt(n, e) {
2383
- return new le(d({
2387
+ return new fe(d({
2384
2388
  values: n,
2385
2389
  typeName: g.ZodEnum
2386
2390
  }, b(e)));
2387
2391
  }
2388
- class le extends w {
2392
+ class fe extends w {
2389
2393
  constructor() {
2390
- super(...arguments), Oe.set(this, void 0);
2394
+ super(...arguments), Ce.set(this, void 0);
2391
2395
  }
2392
2396
  _parse(e) {
2393
2397
  if (typeof e.data != "string") {
2394
- const t = this._getOrReturnCtx(e), r = this._def.values;
2398
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2395
2399
  return f(t, {
2396
- expected: x.joinValues(r),
2400
+ expected: x.joinValues(s),
2397
2401
  received: t.parsedType,
2398
2402
  code: l.invalid_type
2399
2403
  }), v;
2400
2404
  }
2401
- if (tt(this, Oe) || Ht(this, Oe, new Set(this._def.values)), !tt(this, Oe).has(e.data)) {
2402
- const t = this._getOrReturnCtx(e), r = this._def.values;
2405
+ if (tt(this, Ce) || Ht(this, Ce, new Set(this._def.values)), !tt(this, Ce).has(e.data)) {
2406
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2403
2407
  return f(t, {
2404
2408
  received: t.data,
2405
2409
  code: l.invalid_enum_value,
2406
- options: r
2410
+ options: s
2407
2411
  }), v;
2408
2412
  }
2409
2413
  return M(e.data);
@@ -2430,34 +2434,34 @@ class le extends w {
2430
2434
  return e;
2431
2435
  }
2432
2436
  extract(e, t = this._def) {
2433
- return le.create(e, d(d({}, this._def), t));
2437
+ return fe.create(e, d(d({}, this._def), t));
2434
2438
  }
2435
2439
  exclude(e, t = this._def) {
2436
- return le.create(this.options.filter((r) => !e.includes(r)), d(d({}, this._def), t));
2440
+ return fe.create(this.options.filter((s) => !e.includes(s)), d(d({}, this._def), t));
2437
2441
  }
2438
2442
  }
2439
- Oe = /* @__PURE__ */ new WeakMap();
2440
- le.create = Xt;
2443
+ Ce = /* @__PURE__ */ new WeakMap();
2444
+ fe.create = Xt;
2441
2445
  class ze extends w {
2442
2446
  constructor() {
2443
- super(...arguments), Ce.set(this, void 0);
2447
+ super(...arguments), Ne.set(this, void 0);
2444
2448
  }
2445
2449
  _parse(e) {
2446
- const t = x.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2447
- if (r.parsedType !== p.string && r.parsedType !== p.number) {
2448
- const s = x.objectValues(t);
2449
- return f(r, {
2450
- expected: x.joinValues(s),
2451
- received: r.parsedType,
2450
+ const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2451
+ if (s.parsedType !== p.string && s.parsedType !== p.number) {
2452
+ const r = x.objectValues(t);
2453
+ return f(s, {
2454
+ expected: x.joinValues(r),
2455
+ received: s.parsedType,
2452
2456
  code: l.invalid_type
2453
2457
  }), v;
2454
2458
  }
2455
- if (tt(this, Ce) || Ht(this, Ce, new Set(x.getValidEnumValues(this._def.values))), !tt(this, Ce).has(e.data)) {
2456
- const s = x.objectValues(t);
2457
- return f(r, {
2458
- received: r.data,
2459
+ if (tt(this, Ne) || Ht(this, Ne, new Set(x.getValidEnumValues(this._def.values))), !tt(this, Ne).has(e.data)) {
2460
+ const r = x.objectValues(t);
2461
+ return f(s, {
2462
+ received: s.data,
2459
2463
  code: l.invalid_enum_value,
2460
- options: s
2464
+ options: r
2461
2465
  }), v;
2462
2466
  }
2463
2467
  return M(e.data);
@@ -2466,12 +2470,12 @@ class ze extends w {
2466
2470
  return this._def.values;
2467
2471
  }
2468
2472
  }
2469
- Ce = /* @__PURE__ */ new WeakMap();
2473
+ Ne = /* @__PURE__ */ new WeakMap();
2470
2474
  ze.create = (n, e) => new ze(d({
2471
2475
  values: n,
2472
2476
  typeName: g.ZodNativeEnum
2473
2477
  }, b(e)));
2474
- class Te extends w {
2478
+ class Se extends w {
2475
2479
  unwrap() {
2476
2480
  return this._def.type;
2477
2481
  }
@@ -2483,18 +2487,18 @@ class Te extends w {
2483
2487
  expected: p.promise,
2484
2488
  received: t.parsedType
2485
2489
  }), v;
2486
- const r = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
2487
- return M(r.then((s) => this._def.type.parseAsync(s, {
2490
+ const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
2491
+ return M(s.then((r) => this._def.type.parseAsync(r, {
2488
2492
  path: t.path,
2489
2493
  errorMap: t.common.contextualErrorMap
2490
2494
  })));
2491
2495
  }
2492
2496
  }
2493
- Te.create = (n, e) => new Te(d({
2497
+ Se.create = (n, e) => new Se(d({
2494
2498
  type: n,
2495
2499
  typeName: g.ZodPromise
2496
2500
  }, b(e)));
2497
- class J extends w {
2501
+ class G extends w {
2498
2502
  innerType() {
2499
2503
  return this._def.schema;
2500
2504
  }
@@ -2502,86 +2506,86 @@ class J extends w {
2502
2506
  return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2503
2507
  }
2504
2508
  _parse(e) {
2505
- const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
2509
+ const { status: t, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
2506
2510
  addIssue: (i) => {
2507
- f(r, i), i.fatal ? t.abort() : t.dirty();
2511
+ f(s, i), i.fatal ? t.abort() : t.dirty();
2508
2512
  },
2509
2513
  get path() {
2510
- return r.path;
2514
+ return s.path;
2511
2515
  }
2512
2516
  };
2513
- if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2514
- const i = s.transform(r.data, a);
2515
- if (r.common.async)
2516
- return Promise.resolve(i).then((o) => F(this, null, function* () {
2517
+ if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
2518
+ const i = r.transform(s.data, a);
2519
+ if (s.common.async)
2520
+ return Promise.resolve(i).then((o) => P(this, null, function* () {
2517
2521
  if (t.value === "aborted")
2518
2522
  return v;
2519
2523
  const c = yield this._def.schema._parseAsync({
2520
2524
  data: o,
2521
- path: r.path,
2522
- parent: r
2525
+ path: s.path,
2526
+ parent: s
2523
2527
  });
2524
- return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? be(c.value) : c;
2528
+ return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? we(c.value) : c;
2525
2529
  }));
2526
2530
  {
2527
2531
  if (t.value === "aborted")
2528
2532
  return v;
2529
2533
  const o = this._def.schema._parseSync({
2530
2534
  data: i,
2531
- path: r.path,
2532
- parent: r
2535
+ path: s.path,
2536
+ parent: s
2533
2537
  });
2534
- return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? be(o.value) : o;
2538
+ return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? we(o.value) : o;
2535
2539
  }
2536
2540
  }
2537
- if (s.type === "refinement") {
2541
+ if (r.type === "refinement") {
2538
2542
  const i = (o) => {
2539
- const c = s.refinement(o, a);
2540
- if (r.common.async)
2543
+ const c = r.refinement(o, a);
2544
+ if (s.common.async)
2541
2545
  return Promise.resolve(c);
2542
2546
  if (c instanceof Promise)
2543
2547
  throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2544
2548
  return o;
2545
2549
  };
2546
- if (r.common.async === !1) {
2550
+ if (s.common.async === !1) {
2547
2551
  const o = this._def.schema._parseSync({
2548
- data: r.data,
2549
- path: r.path,
2550
- parent: r
2552
+ data: s.data,
2553
+ path: s.path,
2554
+ parent: s
2551
2555
  });
2552
2556
  return o.status === "aborted" ? v : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2553
2557
  } else
2554
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? v : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2558
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? v : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2555
2559
  }
2556
- if (s.type === "transform")
2557
- if (r.common.async === !1) {
2560
+ if (r.type === "transform")
2561
+ if (s.common.async === !1) {
2558
2562
  const i = this._def.schema._parseSync({
2559
- data: r.data,
2560
- path: r.path,
2561
- parent: r
2563
+ data: s.data,
2564
+ path: s.path,
2565
+ parent: s
2562
2566
  });
2563
- if (!ye(i))
2567
+ if (!ge(i))
2564
2568
  return i;
2565
- const o = s.transform(i.value, a);
2569
+ const o = r.transform(i.value, a);
2566
2570
  if (o instanceof Promise)
2567
2571
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2568
2572
  return { status: t.value, value: o };
2569
2573
  } else
2570
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => ye(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2571
- x.assertNever(s);
2574
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => ge(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2575
+ x.assertNever(r);
2572
2576
  }
2573
2577
  }
2574
- J.create = (n, e, t) => new J(d({
2578
+ G.create = (n, e, t) => new G(d({
2575
2579
  schema: n,
2576
2580
  typeName: g.ZodEffects,
2577
2581
  effect: e
2578
2582
  }, b(t)));
2579
- J.createWithPreprocess = (n, e, t) => new J(d({
2583
+ G.createWithPreprocess = (n, e, t) => new G(d({
2580
2584
  schema: e,
2581
2585
  effect: { type: "preprocess", transform: n },
2582
2586
  typeName: g.ZodEffects
2583
2587
  }, b(t)));
2584
- class Q extends w {
2588
+ class te extends w {
2585
2589
  _parse(e) {
2586
2590
  return this._getType(e) === p.undefined ? M(void 0) : this._def.innerType._parse(e);
2587
2591
  }
@@ -2589,11 +2593,11 @@ class Q extends w {
2589
2593
  return this._def.innerType;
2590
2594
  }
2591
2595
  }
2592
- Q.create = (n, e) => new Q(d({
2596
+ te.create = (n, e) => new te(d({
2593
2597
  innerType: n,
2594
2598
  typeName: g.ZodOptional
2595
2599
  }, b(e)));
2596
- class fe extends w {
2600
+ class he extends w {
2597
2601
  _parse(e) {
2598
2602
  return this._getType(e) === p.null ? M(null) : this._def.innerType._parse(e);
2599
2603
  }
@@ -2601,16 +2605,16 @@ class fe extends w {
2601
2605
  return this._def.innerType;
2602
2606
  }
2603
2607
  }
2604
- fe.create = (n, e) => new fe(d({
2608
+ he.create = (n, e) => new he(d({
2605
2609
  innerType: n,
2606
2610
  typeName: g.ZodNullable
2607
2611
  }, b(e)));
2608
- class Ue extends w {
2612
+ class Be extends w {
2609
2613
  _parse(e) {
2610
2614
  const { ctx: t } = this._processInputParams(e);
2611
- let r = t.data;
2612
- return t.parsedType === p.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
2613
- data: r,
2615
+ let s = t.data;
2616
+ return t.parsedType === p.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2617
+ data: s,
2614
2618
  path: t.path,
2615
2619
  parent: t
2616
2620
  });
@@ -2619,37 +2623,37 @@ class Ue extends w {
2619
2623
  return this._def.innerType;
2620
2624
  }
2621
2625
  }
2622
- Ue.create = (n, e) => new Ue(d({
2626
+ Be.create = (n, e) => new Be(d({
2623
2627
  innerType: n,
2624
2628
  typeName: g.ZodDefault,
2625
2629
  defaultValue: typeof e.default == "function" ? e.default : () => e.default
2626
2630
  }, b(e)));
2627
- class Be extends w {
2631
+ class We extends w {
2628
2632
  _parse(e) {
2629
- const { ctx: t } = this._processInputParams(e), r = y(d({}, t), {
2633
+ const { ctx: t } = this._processInputParams(e), s = y(d({}, t), {
2630
2634
  common: y(d({}, t.common), {
2631
2635
  issues: []
2632
2636
  })
2633
- }), s = this._def.innerType._parse({
2634
- data: r.data,
2635
- path: r.path,
2636
- parent: d({}, r)
2637
+ }), r = this._def.innerType._parse({
2638
+ data: s.data,
2639
+ path: s.path,
2640
+ parent: d({}, s)
2637
2641
  });
2638
- return Re(s) ? s.then((a) => ({
2642
+ return Ze(r) ? r.then((a) => ({
2639
2643
  status: "valid",
2640
2644
  value: a.status === "valid" ? a.value : this._def.catchValue({
2641
2645
  get error() {
2642
- return new z(r.common.issues);
2646
+ return new U(s.common.issues);
2643
2647
  },
2644
- input: r.data
2648
+ input: s.data
2645
2649
  })
2646
2650
  })) : {
2647
2651
  status: "valid",
2648
- value: s.status === "valid" ? s.value : this._def.catchValue({
2652
+ value: r.status === "valid" ? r.value : this._def.catchValue({
2649
2653
  get error() {
2650
- return new z(r.common.issues);
2654
+ return new U(s.common.issues);
2651
2655
  },
2652
- input: r.data
2656
+ input: s.data
2653
2657
  })
2654
2658
  };
2655
2659
  }
@@ -2657,7 +2661,7 @@ class Be extends w {
2657
2661
  return this._def.innerType;
2658
2662
  }
2659
2663
  }
2660
- Be.create = (n, e) => new Be(d({
2664
+ We.create = (n, e) => new We(d({
2661
2665
  innerType: n,
2662
2666
  typeName: g.ZodCatch,
2663
2667
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
@@ -2665,11 +2669,11 @@ Be.create = (n, e) => new Be(d({
2665
2669
  class at extends w {
2666
2670
  _parse(e) {
2667
2671
  if (this._getType(e) !== p.nan) {
2668
- const r = this._getOrReturnCtx(e);
2669
- return f(r, {
2672
+ const s = this._getOrReturnCtx(e);
2673
+ return f(s, {
2670
2674
  code: l.invalid_type,
2671
2675
  expected: p.nan,
2672
- received: r.parsedType
2676
+ received: s.parsedType
2673
2677
  }), v;
2674
2678
  }
2675
2679
  return { status: "valid", value: e.data };
@@ -2678,12 +2682,12 @@ class at extends w {
2678
2682
  at.create = (n) => new at(d({
2679
2683
  typeName: g.ZodNaN
2680
2684
  }, b(n)));
2681
- const Vn = Symbol("zod_brand");
2685
+ const Un = Symbol("zod_brand");
2682
2686
  class At extends w {
2683
2687
  _parse(e) {
2684
- const { ctx: t } = this._processInputParams(e), r = t.data;
2688
+ const { ctx: t } = this._processInputParams(e), s = t.data;
2685
2689
  return this._def.type._parse({
2686
- data: r,
2690
+ data: s,
2687
2691
  path: t.path,
2688
2692
  parent: t
2689
2693
  });
@@ -2692,67 +2696,67 @@ class At extends w {
2692
2696
  return this._def.type;
2693
2697
  }
2694
2698
  }
2695
- class He extends w {
2699
+ class Je extends w {
2696
2700
  _parse(e) {
2697
- const { status: t, ctx: r } = this._processInputParams(e);
2698
- if (r.common.async)
2699
- return F(this, null, function* () {
2701
+ const { status: t, ctx: s } = this._processInputParams(e);
2702
+ if (s.common.async)
2703
+ return P(this, null, function* () {
2700
2704
  const a = yield this._def.in._parseAsync({
2701
- data: r.data,
2702
- path: r.path,
2703
- parent: r
2705
+ data: s.data,
2706
+ path: s.path,
2707
+ parent: s
2704
2708
  });
2705
- return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), be(a.value)) : this._def.out._parseAsync({
2709
+ return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), we(a.value)) : this._def.out._parseAsync({
2706
2710
  data: a.value,
2707
- path: r.path,
2708
- parent: r
2711
+ path: s.path,
2712
+ parent: s
2709
2713
  });
2710
2714
  });
2711
2715
  {
2712
- const s = this._def.in._parseSync({
2713
- data: r.data,
2714
- path: r.path,
2715
- parent: r
2716
+ const r = this._def.in._parseSync({
2717
+ data: s.data,
2718
+ path: s.path,
2719
+ parent: s
2716
2720
  });
2717
- return s.status === "aborted" ? v : s.status === "dirty" ? (t.dirty(), {
2721
+ return r.status === "aborted" ? v : r.status === "dirty" ? (t.dirty(), {
2718
2722
  status: "dirty",
2719
- value: s.value
2723
+ value: r.value
2720
2724
  }) : this._def.out._parseSync({
2721
- data: s.value,
2722
- path: r.path,
2723
- parent: r
2725
+ data: r.value,
2726
+ path: s.path,
2727
+ parent: s
2724
2728
  });
2725
2729
  }
2726
2730
  }
2727
2731
  static create(e, t) {
2728
- return new He({
2732
+ return new Je({
2729
2733
  in: e,
2730
2734
  out: t,
2731
2735
  typeName: g.ZodPipeline
2732
2736
  });
2733
2737
  }
2734
2738
  }
2735
- class We extends w {
2739
+ class qe extends w {
2736
2740
  _parse(e) {
2737
- const t = this._def.innerType._parse(e), r = (s) => (ye(s) && (s.value = Object.freeze(s.value)), s);
2738
- return Re(t) ? t.then((s) => r(s)) : r(t);
2741
+ const t = this._def.innerType._parse(e), s = (r) => (ge(r) && (r.value = Object.freeze(r.value)), r);
2742
+ return Ze(t) ? t.then((r) => s(r)) : s(t);
2739
2743
  }
2740
2744
  unwrap() {
2741
2745
  return this._def.innerType;
2742
2746
  }
2743
2747
  }
2744
- We.create = (n, e) => new We(d({
2748
+ qe.create = (n, e) => new qe(d({
2745
2749
  innerType: n,
2746
2750
  typeName: g.ZodReadonly
2747
2751
  }, b(e)));
2748
2752
  function Yt(n, e = {}, t) {
2749
- return n ? ke.create().superRefine((r, s) => {
2753
+ return n ? Te.create().superRefine((s, r) => {
2750
2754
  var a, i;
2751
- if (!n(r)) {
2752
- const o = typeof e == "function" ? e(r) : typeof e == "string" ? { message: e } : e, c = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, u = typeof o == "string" ? { message: o } : o;
2753
- s.addIssue(y(d({ code: "custom" }, u), { fatal: c }));
2755
+ if (!n(s)) {
2756
+ 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, u = typeof o == "string" ? { message: o } : o;
2757
+ r.addIssue(y(d({ code: "custom" }, u), { fatal: c }));
2754
2758
  }
2755
- }) : ke.create();
2759
+ }) : Te.create();
2756
2760
  }
2757
2761
  const zn = {
2758
2762
  object: S.lazycreate
@@ -2761,33 +2765,33 @@ var g;
2761
2765
  (function(n) {
2762
2766
  n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
2763
2767
  })(g || (g = {}));
2764
- const Un = (n, e = {
2768
+ const Bn = (n, e = {
2765
2769
  message: `Input not instance of ${n.name}`
2766
- }) => Yt((t) => t instanceof n, e), Qt = q.create, en = de.create, Bn = at.create, Wn = ue.create, tn = Ze.create, qn = ge.create, Hn = nt.create, Jn = Me.create, Gn = Pe.create, Kn = ke.create, Xn = me.create, Yn = ae.create, Qn = rt.create, er = H.create, tr = S.create, nr = S.strictCreate, rr = $e.create, sr = it.create, ar = Fe.create, ir = te.create, or = De.create, cr = st.create, dr = ve.create, ur = we.create, lr = Le.create, fr = Ve.create, hr = le.create, pr = ze.create, mr = Te.create, $t = J.create, yr = Q.create, gr = fe.create, vr = J.createWithPreprocess, _r = He.create, br = () => Qt().optional(), wr = () => en().optional(), xr = () => tn().optional(), kr = {
2767
- string: (n) => q.create(y(d({}, n), { coerce: !0 })),
2768
- number: (n) => de.create(y(d({}, n), { coerce: !0 })),
2769
- boolean: (n) => Ze.create(y(d({}, n), {
2770
+ }) => Yt((t) => t instanceof n, e), Qt = H.create, en = ue.create, Wn = at.create, qn = le.create, tn = Me.create, Hn = ve.create, Jn = nt.create, Gn = Pe.create, Kn = $e.create, Xn = Te.create, Yn = ye.create, Qn = ce.create, es = st.create, ts = J.create, ns = S.create, ss = S.strictCreate, rs = Le.create, as = it.create, is = Fe.create, os = se.create, cs = De.create, ds = rt.create, us = _e.create, ls = xe.create, fs = Ve.create, hs = Ue.create, ps = fe.create, ms = ze.create, ys = Se.create, $t = G.create, gs = te.create, vs = he.create, _s = G.createWithPreprocess, bs = Je.create, ws = () => Qt().optional(), xs = () => en().optional(), ks = () => tn().optional(), Ts = {
2771
+ string: (n) => H.create(y(d({}, n), { coerce: !0 })),
2772
+ number: (n) => ue.create(y(d({}, n), { coerce: !0 })),
2773
+ boolean: (n) => Me.create(y(d({}, n), {
2770
2774
  coerce: !0
2771
2775
  })),
2772
- bigint: (n) => ue.create(y(d({}, n), { coerce: !0 })),
2773
- date: (n) => ge.create(y(d({}, n), { coerce: !0 }))
2774
- }, Tr = v;
2775
- var W = /* @__PURE__ */ Object.freeze({
2776
+ bigint: (n) => le.create(y(d({}, n), { coerce: !0 })),
2777
+ date: (n) => ve.create(y(d({}, n), { coerce: !0 }))
2778
+ }, Ss = v;
2779
+ var D = /* @__PURE__ */ Object.freeze({
2776
2780
  __proto__: null,
2777
- defaultErrorMap: xe,
2778
- setErrorMap: vn,
2781
+ defaultErrorMap: ke,
2782
+ setErrorMap: _n,
2779
2783
  getErrorMap: Qe,
2780
2784
  makeIssue: et,
2781
- EMPTY_PATH: _n,
2785
+ EMPTY_PATH: bn,
2782
2786
  addIssueToContext: f,
2783
2787
  ParseStatus: I,
2784
2788
  INVALID: v,
2785
- DIRTY: be,
2789
+ DIRTY: we,
2786
2790
  OK: M,
2787
2791
  isAborted: pt,
2788
2792
  isDirty: mt,
2789
- isValid: ye,
2790
- isAsync: Re,
2793
+ isValid: ge,
2794
+ isAsync: Ze,
2791
2795
  get util() {
2792
2796
  return x;
2793
2797
  },
@@ -2795,47 +2799,47 @@ var W = /* @__PURE__ */ Object.freeze({
2795
2799
  return ht;
2796
2800
  },
2797
2801
  ZodParsedType: p,
2798
- getParsedType: se,
2802
+ getParsedType: oe,
2799
2803
  ZodType: w,
2800
2804
  datetimeRegex: Kt,
2801
- ZodString: q,
2802
- ZodNumber: de,
2803
- ZodBigInt: ue,
2804
- ZodBoolean: Ze,
2805
- ZodDate: ge,
2805
+ ZodString: H,
2806
+ ZodNumber: ue,
2807
+ ZodBigInt: le,
2808
+ ZodBoolean: Me,
2809
+ ZodDate: ve,
2806
2810
  ZodSymbol: nt,
2807
- ZodUndefined: Me,
2808
- ZodNull: Pe,
2809
- ZodAny: ke,
2810
- ZodUnknown: me,
2811
- ZodNever: ae,
2812
- ZodVoid: rt,
2813
- ZodArray: H,
2811
+ ZodUndefined: Pe,
2812
+ ZodNull: $e,
2813
+ ZodAny: Te,
2814
+ ZodUnknown: ye,
2815
+ ZodNever: ce,
2816
+ ZodVoid: st,
2817
+ ZodArray: J,
2814
2818
  ZodObject: S,
2815
- ZodUnion: $e,
2819
+ ZodUnion: Le,
2816
2820
  ZodDiscriminatedUnion: it,
2817
2821
  ZodIntersection: Fe,
2818
- ZodTuple: te,
2822
+ ZodTuple: se,
2819
2823
  ZodRecord: De,
2820
- ZodMap: st,
2821
- ZodSet: ve,
2822
- ZodFunction: we,
2823
- ZodLazy: Le,
2824
- ZodLiteral: Ve,
2825
- ZodEnum: le,
2824
+ ZodMap: rt,
2825
+ ZodSet: _e,
2826
+ ZodFunction: xe,
2827
+ ZodLazy: Ve,
2828
+ ZodLiteral: Ue,
2829
+ ZodEnum: fe,
2826
2830
  ZodNativeEnum: ze,
2827
- ZodPromise: Te,
2828
- ZodEffects: J,
2829
- ZodTransformer: J,
2830
- ZodOptional: Q,
2831
- ZodNullable: fe,
2832
- ZodDefault: Ue,
2833
- ZodCatch: Be,
2831
+ ZodPromise: Se,
2832
+ ZodEffects: G,
2833
+ ZodTransformer: G,
2834
+ ZodOptional: te,
2835
+ ZodNullable: he,
2836
+ ZodDefault: Be,
2837
+ ZodCatch: We,
2834
2838
  ZodNaN: at,
2835
- BRAND: Vn,
2839
+ BRAND: Un,
2836
2840
  ZodBranded: At,
2837
- ZodPipeline: He,
2838
- ZodReadonly: We,
2841
+ ZodPipeline: Je,
2842
+ ZodReadonly: qe,
2839
2843
  custom: Yt,
2840
2844
  Schema: w,
2841
2845
  ZodSchema: w,
@@ -2843,58 +2847,59 @@ var W = /* @__PURE__ */ Object.freeze({
2843
2847
  get ZodFirstPartyTypeKind() {
2844
2848
  return g;
2845
2849
  },
2846
- coerce: kr,
2847
- any: Kn,
2848
- array: er,
2849
- bigint: Wn,
2850
+ coerce: Ts,
2851
+ any: Xn,
2852
+ array: ts,
2853
+ bigint: qn,
2850
2854
  boolean: tn,
2851
- date: qn,
2852
- discriminatedUnion: sr,
2855
+ date: Hn,
2856
+ discriminatedUnion: as,
2853
2857
  effect: $t,
2854
- enum: hr,
2855
- function: ur,
2856
- instanceof: Un,
2857
- intersection: ar,
2858
- lazy: lr,
2859
- literal: fr,
2860
- map: cr,
2861
- nan: Bn,
2862
- nativeEnum: pr,
2863
- never: Yn,
2864
- null: Gn,
2865
- nullable: gr,
2858
+ enum: ps,
2859
+ function: ls,
2860
+ instanceof: Bn,
2861
+ intersection: is,
2862
+ lazy: fs,
2863
+ literal: hs,
2864
+ map: ds,
2865
+ nan: Wn,
2866
+ nativeEnum: ms,
2867
+ never: Qn,
2868
+ null: Kn,
2869
+ nullable: vs,
2866
2870
  number: en,
2867
- object: tr,
2868
- oboolean: xr,
2869
- onumber: wr,
2870
- optional: yr,
2871
- ostring: br,
2872
- pipeline: _r,
2873
- preprocess: vr,
2874
- promise: mr,
2875
- record: or,
2876
- set: dr,
2877
- strictObject: nr,
2871
+ object: ns,
2872
+ oboolean: ks,
2873
+ onumber: xs,
2874
+ optional: gs,
2875
+ ostring: ws,
2876
+ pipeline: bs,
2877
+ preprocess: _s,
2878
+ promise: ys,
2879
+ record: cs,
2880
+ set: us,
2881
+ strictObject: ss,
2878
2882
  string: Qt,
2879
- symbol: Hn,
2883
+ symbol: Jn,
2880
2884
  transformer: $t,
2881
- tuple: ir,
2882
- undefined: Jn,
2883
- union: rr,
2884
- unknown: Xn,
2885
- void: Qn,
2886
- NEVER: Tr,
2885
+ tuple: os,
2886
+ undefined: Gn,
2887
+ union: rs,
2888
+ unknown: Yn,
2889
+ void: es,
2890
+ NEVER: Ss,
2887
2891
  ZodIssueCode: l,
2888
- quotelessJson: gn,
2889
- ZodError: z
2892
+ quotelessJson: vn,
2893
+ ZodError: U
2890
2894
  });
2891
- const Sr = W.object({
2892
- language: W.enum(["typescript", "javascript"]).optional()
2895
+ const As = D.object({
2896
+ language: D.enum(["typescript", "javascript"]).optional()
2893
2897
  }).and(
2894
- W.union([
2895
- W.object({
2896
- framework: W.literal("react"),
2897
- styling: W.enum([
2898
+ D.union([
2899
+ D.object({
2900
+ framework: D.literal("react"),
2901
+ model: D.string().optional(),
2902
+ styling: D.enum([
2898
2903
  "plain_css",
2899
2904
  "css_modules",
2900
2905
  "styled_components",
@@ -2903,53 +2908,51 @@ const Sr = W.object({
2903
2908
  "scss",
2904
2909
  "inline_styles"
2905
2910
  ]),
2906
- uiLibrary: W.enum(["mui", "antd", "radix", "shadcn"]).optional()
2911
+ uiLibrary: D.enum(["mui", "antd", "radix", "shadcn"]).optional(),
2912
+ enableUILibraryTheming: D.boolean().optional()
2907
2913
  }),
2908
- W.object({
2909
- framework: W.literal("html"),
2910
- styling: W.enum(["plain_css", "inline_styles"]),
2911
- enableTranslation: W.boolean().optional()
2914
+ D.object({
2915
+ framework: D.literal("html"),
2916
+ styling: D.enum(["plain_css", "inline_styles"]),
2917
+ enableTranslation: D.boolean().optional()
2912
2918
  })
2913
2919
  ])
2914
- ), Ar = (n) => {
2915
- const e = Sr.safeParse(n);
2920
+ ), Es = (n) => {
2921
+ const e = As.safeParse(n);
2916
2922
  if (e.success === !1) {
2917
2923
  const t = new Error("Invalid codegen settings");
2918
2924
  throw t.cause = e.error, t;
2919
2925
  }
2920
2926
  return e.data;
2921
- }, Er = (n) => Object.entries(n).reduce(
2922
- (e, [t, r]) => (e[t] = { content: r.code, isBinary: !1 }, e),
2923
- {}
2924
- );
2925
- var U, qe;
2926
- class Is {
2927
+ };
2928
+ var B, He;
2929
+ class Ir {
2927
2930
  constructor({
2928
2931
  auth: e,
2929
2932
  apiBaseAddress: t = "https://public-api.animaapp.com"
2930
2933
  } = {}) {
2931
- ot(this, U);
2932
- ot(this, qe);
2933
- ct(this, qe, t), e && (this.auth = e);
2934
+ ot(this, B);
2935
+ ot(this, He);
2936
+ ct(this, He, t), e && (this.auth = e);
2934
2937
  }
2935
2938
  hasAuth() {
2936
- return !!G(this, U);
2939
+ return !!X(this, B);
2937
2940
  }
2938
2941
  set auth(e) {
2939
- ct(this, U, e);
2942
+ ct(this, B, e);
2940
2943
  }
2941
2944
  get headers() {
2942
2945
  const e = {
2943
2946
  "Content-Type": "application/json"
2944
2947
  };
2945
- return G(this, U) && (e.Authorization = `Bearer ${G(this, U).token}`, "teamId" in G(this, U) && (e["X-Team-Id"] = G(this, U).teamId), "userId" in G(this, U) && G(this, U).userId && (e["X-User-Id"] = G(this, U).userId)), e;
2948
+ return X(this, B) && (e.Authorization = `Bearer ${X(this, B).token}`, "teamId" in X(this, B) && (e["X-Team-Id"] = X(this, B).teamId), "userId" in X(this, B) && X(this, B).userId && (e["X-User-Id"] = X(this, B).userId)), e;
2946
2949
  }
2947
- generateCode(r) {
2948
- return F(this, arguments, function* (e, t = {}) {
2949
- var h, _, C, E, O, P;
2950
+ generateCode(s) {
2951
+ return P(this, arguments, function* (e, t = {}) {
2952
+ var h, _, N, O, C, R, q;
2950
2953
  if (this.hasAuth() === !1)
2951
2954
  throw new Error('It needs to set "auth" before calling this method.');
2952
- const s = {}, a = Ar(e.settings), i = yield fetch(`${G(this, qe)}/v1/codegen`, {
2955
+ const r = {}, a = Es(e.settings), i = yield fetch(`${X(this, He)}/v1/codegen`, {
2953
2956
  method: "POST",
2954
2957
  headers: y(d({}, this.headers), {
2955
2958
  Accept: "text/event-stream"
@@ -2958,28 +2961,31 @@ class Is {
2958
2961
  fileKey: e.fileKey,
2959
2962
  figmaToken: e.figmaToken,
2960
2963
  nodesId: e.nodesId,
2964
+ assetsStorage: e.assetsStorage,
2961
2965
  language: a.language,
2966
+ model: a.model,
2962
2967
  framework: a.framework,
2963
2968
  styling: a.styling,
2964
2969
  uiLibrary: a.uiLibrary,
2965
- enableTranslation: a.enableTranslation
2970
+ enableTranslation: a.enableTranslation,
2971
+ enableUILibraryTheming: a.enableUILibraryTheming
2966
2972
  })
2967
2973
  });
2968
2974
  if (!i.ok) {
2969
- let $;
2975
+ let z;
2970
2976
  try {
2971
- $ = (yield i.json()).message || `HTTP error! status: ${i.status}`;
2972
- } catch (ie) {
2973
- $ = `HTTP error! status: ${i.status}`;
2977
+ z = (yield i.json()).message || `HTTP error! status: ${i.status}`;
2978
+ } catch (re) {
2979
+ z = `HTTP error! status: ${i.status}`;
2974
2980
  }
2975
- throw new Ae({
2981
+ throw new Ee({
2976
2982
  name: "HTTP Error",
2977
- reason: $,
2983
+ reason: z,
2978
2984
  status: i.status
2979
2985
  });
2980
2986
  }
2981
2987
  if (!i.body)
2982
- throw new Ae({
2988
+ throw new Ee({
2983
2989
  name: "Stream Error",
2984
2990
  reason: "Response body is null",
2985
2991
  status: i.status
@@ -2988,24 +2994,24 @@ class Is {
2988
2994
  let u = "";
2989
2995
  try {
2990
2996
  for (; ; ) {
2991
- const { done: $, value: ie } = yield o.read();
2992
- if ($)
2997
+ const { done: z, value: re } = yield o.read();
2998
+ if (z)
2993
2999
  break;
2994
- u += c.decode(ie, { stream: !0 });
2995
- const oe = u.split(`
3000
+ u += c.decode(re, { stream: !0 });
3001
+ const L = u.split(`
2996
3002
  `);
2997
- u = oe.pop() || "";
2998
- for (const R of oe)
2999
- if (!(!R.trim() || R.startsWith(":")) && R.startsWith("data: ")) {
3003
+ u = L.pop() || "";
3004
+ for (const K of L)
3005
+ if (!(!K.trim() || K.startsWith(":")) && K.startsWith("data: ")) {
3000
3006
  let T;
3001
3007
  try {
3002
- T = JSON.parse(R.slice(6));
3003
- } catch (Je) {
3008
+ T = JSON.parse(K.slice(6));
3009
+ } catch (Ge) {
3004
3010
  continue;
3005
3011
  }
3006
3012
  switch (T.type) {
3007
3013
  case "start": {
3008
- s.sessionId = T.sessionId, typeof t == "function" ? t(T) : (h = t.onStart) == null || h.call(t, { sessionId: T.sessionId });
3014
+ r.sessionId = T.sessionId, typeof t == "function" ? t(T) : (h = t.onStart) == null || h.call(t, { sessionId: T.sessionId });
3009
3015
  break;
3010
3016
  }
3011
3017
  case "pre_codegen": {
@@ -3013,41 +3019,45 @@ class Is {
3013
3019
  break;
3014
3020
  }
3015
3021
  case "assets_uploaded": {
3016
- typeof t == "function" ? t(T) : (C = t.onAssetsUploaded) == null || C.call(t);
3022
+ typeof t == "function" ? t(T) : (N = t.onAssetsUploaded) == null || N.call(t);
3023
+ break;
3024
+ }
3025
+ case "assets_list": {
3026
+ r.assets = T.payload.assets, typeof t == "function" ? t(T) : (O = t.onAssetsList) == null || O.call(t, T.payload);
3017
3027
  break;
3018
3028
  }
3019
3029
  case "figma_metadata": {
3020
- s.figmaFileName = T.figmaFileName, s.figmaSelectedFrameName = T.figmaSelectedFrameName, typeof t == "function" ? t(T) : (E = t.onFigmaMetadata) == null || E.call(t, {
3030
+ r.figmaFileName = T.figmaFileName, r.figmaSelectedFrameName = T.figmaSelectedFrameName, typeof t == "function" ? t(T) : (C = t.onFigmaMetadata) == null || C.call(t, {
3021
3031
  figmaFileName: T.figmaFileName,
3022
3032
  figmaSelectedFrameName: T.figmaSelectedFrameName
3023
3033
  });
3024
3034
  break;
3025
3035
  }
3026
3036
  case "generating_code": {
3027
- const Je = T.payload.files, Ge = Er(Je);
3028
- T.payload.status === "success" && (s.files = Ge), typeof t == "function" ? t(T) : (O = t.onGeneratingCode) == null || O.call(t, {
3037
+ const Ge = T.payload.files, E = gn(Ge);
3038
+ T.payload.status === "success" && (r.files = E), typeof t == "function" ? t(T) : (R = t.onGeneratingCode) == null || R.call(t, {
3029
3039
  status: T.payload.status,
3030
3040
  progress: T.payload.progress,
3031
- files: Ge
3041
+ files: E
3032
3042
  });
3033
3043
  break;
3034
3044
  }
3035
3045
  case "codegen_completed": {
3036
- typeof t == "function" ? t(T) : (P = t.onCodegenCompleted) == null || P.call(t);
3046
+ typeof t == "function" ? t(T) : (q = t.onCodegenCompleted) == null || q.call(t);
3037
3047
  break;
3038
3048
  }
3039
3049
  case "error":
3040
- throw new Ae({
3050
+ throw new Ee({
3041
3051
  name: T.payload.errorName,
3042
3052
  reason: T.payload.reason
3043
3053
  });
3044
3054
  case "done": {
3045
- if (!s.files)
3046
- throw new Ae({
3055
+ if (!r.files)
3056
+ throw new Ee({
3047
3057
  name: "Invalid response",
3048
3058
  reason: "No files found"
3049
3059
  });
3050
- return s;
3060
+ return r;
3051
3061
  }
3052
3062
  }
3053
3063
  }
@@ -3055,7 +3065,7 @@ class Is {
3055
3065
  } finally {
3056
3066
  o.cancel();
3057
3067
  }
3058
- throw new Ae({
3068
+ throw new Ee({
3059
3069
  name: "Connection",
3060
3070
  reason: "Connection closed before the 'done' message",
3061
3071
  status: 500
@@ -3063,140 +3073,140 @@ class Is {
3063
3073
  });
3064
3074
  }
3065
3075
  }
3066
- U = new WeakMap(), qe = new WeakMap();
3067
- const Rs = (n) => {
3076
+ B = new WeakMap(), He = new WeakMap();
3077
+ const Rr = (n) => {
3068
3078
  var e;
3069
3079
  if (!n)
3070
3080
  return [!1, "", ""];
3071
3081
  try {
3072
- const t = new URL(n), r = t.pathname;
3082
+ const t = new URL(n), s = t.pathname;
3073
3083
  if (t.origin !== "https://www.figma.com")
3074
3084
  return [!1, "", ""];
3075
- const s = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), a = r.split("/")[2];
3076
- return [(r.startsWith("/file/") && t.searchParams.get("type") !== "whiteboard" || r.startsWith("/design/")) && a.length === 22, a, s];
3085
+ const r = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), a = s.split("/")[2];
3086
+ return [(s.startsWith("/file/") && t.searchParams.get("type") !== "whiteboard" || s.startsWith("/design/")) && a.length === 22, a, r];
3077
3087
  } catch (t) {
3078
3088
  return [!1, "", ""];
3079
3089
  }
3080
- }, Zs = ({
3090
+ }, Zr = ({
3081
3091
  fileKey: n,
3082
3092
  nodeId: e
3083
3093
  }) => {
3084
3094
  const t = new URL("https://www.figma.com");
3085
3095
  return t.pathname = `design/${n}`, e && t.searchParams.set("node-id", e.replace(":", "-")), t;
3086
3096
  }, nn = "Figma Token Issue";
3087
- class Or extends Error {
3097
+ class Os extends Error {
3088
3098
  constructor({ fileKey: e, reason: t }) {
3089
3099
  super(nn), this.fileKey = e, this.reason = t;
3090
3100
  }
3091
3101
  }
3092
- const rn = "Rate Limit Exceeded";
3093
- class Cr extends Error {
3102
+ const sn = "Rate Limit Exceeded";
3103
+ class Cs extends Error {
3094
3104
  constructor({ fileKey: e }) {
3095
- super(rn), this.fileKey = e;
3105
+ super(sn), this.fileKey = e;
3096
3106
  }
3097
3107
  }
3098
- const sn = "Not Found";
3099
- class Nr extends Error {
3108
+ const rn = "Not Found";
3109
+ class Ns extends Error {
3100
3110
  constructor({ fileKey: e }) {
3101
- super(sn), this.fileKey = e;
3111
+ super(rn), this.fileKey = e;
3102
3112
  }
3103
3113
  }
3104
- const jr = (n) => n.message === sn, an = "Unknown Figma API Exception";
3105
- class Ir extends Error {
3114
+ const js = (n) => n.message === rn, an = "Unknown Figma API Exception";
3115
+ class Is extends Error {
3106
3116
  constructor({ fileKey: e, cause: t }) {
3107
3117
  super(an), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
3108
3118
  }
3109
3119
  }
3110
- const Ms = (n) => n.message === an, Rr = (n) => n.message === rn, Zr = (n) => [nn, ...[
3120
+ const Mr = (n) => n.message === an, Rs = (n) => n.message === sn, Zs = (n) => [nn, ...[
3111
3121
  "Invalid Figma token",
3112
3122
  "Figma token expired"
3113
3123
  ]].includes(
3114
3124
  n.message
3115
- ), Mr = (n, e) => {
3116
- var r, s;
3117
- const t = ((r = n == null ? void 0 : n.cause) == null ? void 0 : r.body) || n.body;
3118
- throw (t == null ? void 0 : t.status) === 403 ? new Or({
3125
+ ), Ms = (n, e) => {
3126
+ var s, r;
3127
+ const t = ((s = n == null ? void 0 : n.cause) == null ? void 0 : s.body) || n.body;
3128
+ throw (t == null ? void 0 : t.status) === 403 ? new Os({
3119
3129
  fileKey: e,
3120
- reason: ((s = n == null ? void 0 : n.cause) == null ? void 0 : s.body) || n.body
3121
- }) : (t == null ? void 0 : t.status) === 429 ? new Cr({ fileKey: e }) : (t == null ? void 0 : t.status) === 404 ? new Nr({ fileKey: e }) : new Ir({ fileKey: e, cause: n });
3122
- }, Ps = (n) => jr(n) ? "NotFound" : Rr(n) ? "RateLimitExceeded" : Zr(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
3123
- var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, Dr = Object.prototype.hasOwnProperty, Lr = Object.prototype.propertyIsEnumerable, Dt = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), on = (n) => {
3130
+ reason: ((r = n == null ? void 0 : n.cause) == null ? void 0 : r.body) || n.body
3131
+ }) : (t == null ? void 0 : t.status) === 429 ? new Cs({ fileKey: e }) : (t == null ? void 0 : t.status) === 404 ? new Ns({ fileKey: e }) : new Is({ fileKey: e, cause: n });
3132
+ }, Pr = (n) => js(n) ? "NotFound" : Rs(n) ? "RateLimitExceeded" : Zs(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
3133
+ var Ps = Object.defineProperty, $s = Object.defineProperties, Ls = Object.getOwnPropertyDescriptors, Lt = Object.getOwnPropertySymbols, Fs = Object.prototype.hasOwnProperty, Ds = Object.prototype.propertyIsEnumerable, Ft = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), on = (n) => {
3124
3134
  throw TypeError(n);
3125
- }, Lt = (n, e, t) => e in n ? Pr(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, V = (n, e) => {
3135
+ }, Dt = (n, e, t) => e in n ? Ps(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, V = (n, e) => {
3126
3136
  for (var t in e || (e = {}))
3127
- Dr.call(e, t) && Lt(n, t, e[t]);
3128
- if (Ft)
3129
- for (var t of Ft(e))
3130
- Lr.call(e, t) && Lt(n, t, e[t]);
3137
+ Fs.call(e, t) && Dt(n, t, e[t]);
3138
+ if (Lt)
3139
+ for (var t of Lt(e))
3140
+ Ds.call(e, t) && Dt(n, t, e[t]);
3131
3141
  return n;
3132
- }, Et = (n, e) => $r(n, Fr(e)), Ot = (n, e, t) => e.has(n) || on("Cannot " + t), k = (n, e, t) => (Ot(n, e, "read from private field"), t ? t.call(n) : e.get(n)), B = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, r) => (Ot(n, e, "write to private field"), e.set(n, t), t), Y = (n, e, t) => (Ot(n, e, "access private method"), t), A = (n, e, t) => new Promise((r, s) => {
3142
+ }, Et = (n, e) => $s(n, Ls(e)), Ot = (n, e, t) => e.has(n) || on("Cannot " + t), k = (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), ee = (n, e, t) => (Ot(n, e, "access private method"), t), A = (n, e, t) => new Promise((s, r) => {
3133
3143
  var a = (c) => {
3134
3144
  try {
3135
3145
  o(t.next(c));
3136
3146
  } catch (u) {
3137
- s(u);
3147
+ r(u);
3138
3148
  }
3139
3149
  }, i = (c) => {
3140
3150
  try {
3141
3151
  o(t.throw(c));
3142
3152
  } catch (u) {
3143
- s(u);
3153
+ r(u);
3144
3154
  }
3145
- }, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
3155
+ }, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
3146
3156
  o((t = t.apply(n, e)).next());
3147
- }), Vr = (n, e, t) => (e = n[Dt("asyncIterator")]) ? e.call(n) : (n = n[Dt("iterator")](), e = {}, t = (r, s) => (s = n[r]) && (e[r] = (a) => new Promise((i, o, c) => (a = s.call(n, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), zr = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
3148
- function Ur(n) {
3157
+ }), Vs = (n, e, t) => (e = n[Ft("asyncIterator")]) ? e.call(n) : (n = n[Ft("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), Us = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
3158
+ function zs(n) {
3149
3159
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
3150
3160
  }
3151
- var gt = { exports: {} }, Br = gt.exports, Vt;
3152
- function Wr() {
3161
+ var gt = { exports: {} }, Bs = gt.exports, Vt;
3162
+ function Ws() {
3153
3163
  return Vt || (Vt = 1, function(n, e) {
3154
- (function(t, r) {
3155
- n.exports = r();
3156
- })(Br, function() {
3157
- var t = typeof Promise == "function", r = typeof self == "object" ? self : zr, s = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = s && typeof Symbol.iterator != "undefined", _ = s && typeof Symbol.toStringTag != "undefined", C = i && typeof Set.prototype.entries == "function", E = a && typeof Map.prototype.entries == "function", O = C && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), P = E && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), $ = h && typeof Array.prototype[Symbol.iterator] == "function", ie = $ && Object.getPrototypeOf([][Symbol.iterator]()), oe = h && typeof String.prototype[Symbol.iterator] == "function", R = oe && Object.getPrototypeOf(""[Symbol.iterator]()), T = 8, Je = -1;
3158
- function Ge(N) {
3159
- var Nt = typeof N;
3164
+ (function(t, s) {
3165
+ n.exports = s();
3166
+ })(Bs, function() {
3167
+ var t = typeof Promise == "function", s = typeof self == "object" ? self : Us, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", N = i && typeof Set.prototype.entries == "function", O = a && typeof Map.prototype.entries == "function", C = N && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), R = O && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), q = h && typeof Array.prototype[Symbol.iterator] == "function", z = q && Object.getPrototypeOf([][Symbol.iterator]()), re = h && typeof String.prototype[Symbol.iterator] == "function", L = re && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, T = -1;
3168
+ function Ge(E) {
3169
+ var Nt = typeof E;
3160
3170
  if (Nt !== "object")
3161
3171
  return Nt;
3162
- if (N === null)
3172
+ if (E === null)
3163
3173
  return "null";
3164
- if (N === r)
3174
+ if (E === s)
3165
3175
  return "global";
3166
- if (Array.isArray(N) && (_ === !1 || !(Symbol.toStringTag in N)))
3176
+ if (Array.isArray(E) && (_ === !1 || !(Symbol.toStringTag in E)))
3167
3177
  return "Array";
3168
3178
  if (typeof window == "object" && window !== null) {
3169
- if (typeof window.location == "object" && N === window.location)
3179
+ if (typeof window.location == "object" && E === window.location)
3170
3180
  return "Location";
3171
- if (typeof window.document == "object" && N === window.document)
3181
+ if (typeof window.document == "object" && E === window.document)
3172
3182
  return "Document";
3173
3183
  if (typeof window.navigator == "object") {
3174
- if (typeof window.navigator.mimeTypes == "object" && N === window.navigator.mimeTypes)
3184
+ if (typeof window.navigator.mimeTypes == "object" && E === window.navigator.mimeTypes)
3175
3185
  return "MimeTypeArray";
3176
- if (typeof window.navigator.plugins == "object" && N === window.navigator.plugins)
3186
+ if (typeof window.navigator.plugins == "object" && E === window.navigator.plugins)
3177
3187
  return "PluginArray";
3178
3188
  }
3179
- if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && N instanceof window.HTMLElement) {
3180
- if (N.tagName === "BLOCKQUOTE")
3189
+ if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && E instanceof window.HTMLElement) {
3190
+ if (E.tagName === "BLOCKQUOTE")
3181
3191
  return "HTMLQuoteElement";
3182
- if (N.tagName === "TD")
3192
+ if (E.tagName === "TD")
3183
3193
  return "HTMLTableDataCellElement";
3184
- if (N.tagName === "TH")
3194
+ if (E.tagName === "TH")
3185
3195
  return "HTMLTableHeaderCellElement";
3186
3196
  }
3187
3197
  }
3188
- var jt = _ && N[Symbol.toStringTag];
3198
+ var jt = _ && E[Symbol.toStringTag];
3189
3199
  if (typeof jt == "string")
3190
3200
  return jt;
3191
- var L = Object.getPrototypeOf(N);
3192
- return L === RegExp.prototype ? "RegExp" : L === Date.prototype ? "Date" : t && L === Promise.prototype ? "Promise" : i && L === Set.prototype ? "Set" : a && L === Map.prototype ? "Map" : c && L === WeakSet.prototype ? "WeakSet" : o && L === WeakMap.prototype ? "WeakMap" : u && L === DataView.prototype ? "DataView" : a && L === P ? "Map Iterator" : i && L === O ? "Set Iterator" : $ && L === ie ? "Array Iterator" : oe && L === R ? "String Iterator" : L === null ? "Object" : Object.prototype.toString.call(N).slice(T, Je);
3201
+ var F = Object.getPrototypeOf(E);
3202
+ return F === RegExp.prototype ? "RegExp" : F === Date.prototype ? "Date" : t && F === Promise.prototype ? "Promise" : i && F === Set.prototype ? "Set" : a && F === Map.prototype ? "Map" : c && F === WeakSet.prototype ? "WeakSet" : o && F === WeakMap.prototype ? "WeakMap" : u && F === DataView.prototype ? "DataView" : a && F === R ? "Map Iterator" : i && F === C ? "Set Iterator" : q && F === z ? "Array Iterator" : re && F === L ? "String Iterator" : F === null ? "Object" : Object.prototype.toString.call(E).slice(K, T);
3193
3203
  }
3194
3204
  return Ge;
3195
3205
  });
3196
3206
  }(gt)), gt.exports;
3197
3207
  }
3198
- var qr = Wr();
3199
- const Hr = /* @__PURE__ */ Ur(qr), Ct = typeof Buffer != "undefined", Jr = Ct && typeof Buffer.from != "undefined", Gr = Ct ? (
3208
+ var qs = Ws();
3209
+ const Hs = /* @__PURE__ */ zs(qs), Ct = typeof Buffer != "undefined", Js = Ct && typeof Buffer.from != "undefined", Gs = Ct ? (
3200
3210
  /**
3201
3211
  * is value is Buffer?
3202
3212
  *
@@ -3217,7 +3227,7 @@ const Hr = /* @__PURE__ */ Ur(qr), Ct = typeof Buffer != "undefined", Jr = Ct &&
3217
3227
  function() {
3218
3228
  return !1;
3219
3229
  }
3220
- ), Kr = Jr ? (
3230
+ ), Ks = Js ? (
3221
3231
  /**
3222
3232
  * copy Buffer
3223
3233
  *
@@ -3252,18 +3262,18 @@ const Hr = /* @__PURE__ */ Ur(qr), Ct = typeof Buffer != "undefined", Jr = Ct &&
3252
3262
  return n;
3253
3263
  }
3254
3264
  );
3255
- function Se(n) {
3256
- return Gr(n) ? "Buffer" : Hr(n);
3265
+ function Ae(n) {
3266
+ return Gs(n) ? "Buffer" : Hs(n);
3257
3267
  }
3258
- const Xr = /* @__PURE__ */ new Set([
3268
+ const Xs = /* @__PURE__ */ new Set([
3259
3269
  "Arguments",
3260
3270
  "Array",
3261
3271
  "Map",
3262
3272
  "Object",
3263
3273
  "Set"
3264
3274
  ]);
3265
- function Yr(n, e, t = null) {
3266
- switch (t || Se(n)) {
3275
+ function Ys(n, e, t = null) {
3276
+ switch (t || Ae(n)) {
3267
3277
  case "Arguments":
3268
3278
  case "Array":
3269
3279
  case "Object":
@@ -3275,10 +3285,10 @@ function Yr(n, e, t = null) {
3275
3285
  }
3276
3286
  }
3277
3287
  function vt(n) {
3278
- return Xr.has(n);
3288
+ return Xs.has(n);
3279
3289
  }
3280
- function zt(n, e, t, r = null) {
3281
- switch (r || Se(n)) {
3290
+ function Ut(n, e, t, s = null) {
3291
+ switch (s || Ae(n)) {
3282
3292
  case "Arguments":
3283
3293
  case "Array":
3284
3294
  case "Object":
@@ -3293,70 +3303,70 @@ function zt(n, e, t, r = null) {
3293
3303
  }
3294
3304
  return n;
3295
3305
  }
3296
- const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self, ut = Qr || es || ts || Function("return this")();
3297
- function ns(n) {
3306
+ const Qs = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, er = typeof global != "undefined" && global !== null && global.Object === Object && global, tr = typeof self != "undefined" && self !== null && self.Object === Object && self, ut = Qs || er || tr || Function("return this")();
3307
+ function nr(n) {
3298
3308
  return n.slice(0);
3299
3309
  }
3300
- function rs(n) {
3310
+ function sr(n) {
3301
3311
  return new Boolean(n.valueOf());
3302
3312
  }
3303
- function ss(n) {
3313
+ function rr(n) {
3304
3314
  return new DataView(n.buffer);
3305
3315
  }
3306
- function as(n) {
3307
- return Kr(n);
3316
+ function ar(n) {
3317
+ return Ks(n);
3308
3318
  }
3309
- function is(n) {
3319
+ function ir(n) {
3310
3320
  return new Date(n.getTime());
3311
3321
  }
3312
- function os(n) {
3322
+ function or(n) {
3313
3323
  return new Number(n);
3314
3324
  }
3315
- function cs(n) {
3325
+ function cr(n) {
3316
3326
  return new RegExp(n.source, n.flags);
3317
3327
  }
3318
- function ds(n) {
3328
+ function dr(n) {
3319
3329
  return new String(n);
3320
3330
  }
3321
- function ne(n, e) {
3331
+ function ae(n, e) {
3322
3332
  return ut[e].from ? ut[e].from(n) : new ut[e](n);
3323
3333
  }
3324
3334
  function Z(n) {
3325
3335
  return n;
3326
3336
  }
3327
- function Ut() {
3337
+ function zt() {
3328
3338
  return [];
3329
3339
  }
3330
- function us() {
3340
+ function ur() {
3331
3341
  return /* @__PURE__ */ new Map();
3332
3342
  }
3333
- function ls() {
3343
+ function lr() {
3334
3344
  return {};
3335
3345
  }
3336
- function fs() {
3346
+ function fr() {
3337
3347
  return /* @__PURE__ */ new Set();
3338
3348
  }
3339
- const hs = /* @__PURE__ */ new Map([
3349
+ const hr = /* @__PURE__ */ new Map([
3340
3350
  // deep copy
3341
- ["ArrayBuffer", ns],
3342
- ["Boolean", rs],
3343
- ["Buffer", as],
3344
- ["DataView", ss],
3345
- ["Date", is],
3346
- ["Number", os],
3347
- ["RegExp", cs],
3348
- ["String", ds],
3351
+ ["ArrayBuffer", nr],
3352
+ ["Boolean", sr],
3353
+ ["Buffer", ar],
3354
+ ["DataView", rr],
3355
+ ["Date", ir],
3356
+ ["Number", or],
3357
+ ["RegExp", cr],
3358
+ ["String", dr],
3349
3359
  // typed arrays
3350
3360
  // TODO: pass bound function
3351
- ["Float32Array", ne],
3352
- ["Float64Array", ne],
3353
- ["Int16Array", ne],
3354
- ["Int32Array", ne],
3355
- ["Int8Array", ne],
3356
- ["Uint16Array", ne],
3357
- ["Uint32Array", ne],
3358
- ["Uint8Array", ne],
3359
- ["Uint8ClampedArray", ne],
3361
+ ["Float32Array", ae],
3362
+ ["Float64Array", ae],
3363
+ ["Int16Array", ae],
3364
+ ["Int32Array", ae],
3365
+ ["Int8Array", ae],
3366
+ ["Uint16Array", ae],
3367
+ ["Uint32Array", ae],
3368
+ ["Uint8Array", ae],
3369
+ ["Uint8ClampedArray", ae],
3360
3370
  // shallow copy
3361
3371
  ["Array Iterator", Z],
3362
3372
  ["Map Iterator", Z],
@@ -3377,11 +3387,11 @@ const hs = /* @__PURE__ */ new Map([
3377
3387
  ["undefined", Z],
3378
3388
  // collections
3379
3389
  // NOTE: return empty value, because recursively copy later.
3380
- ["Arguments", Ut],
3381
- ["Array", Ut],
3382
- ["Map", us],
3383
- ["Object", ls],
3384
- ["Set", fs]
3390
+ ["Arguments", zt],
3391
+ ["Array", zt],
3392
+ ["Map", ur],
3393
+ ["Object", lr],
3394
+ ["Set", fr]
3385
3395
  // NOTE: type-detect returns following types
3386
3396
  // 'Location'
3387
3397
  // 'Document'
@@ -3393,19 +3403,19 @@ const hs = /* @__PURE__ */ new Map([
3393
3403
  // TODO: is type-detect never return 'object'?
3394
3404
  // 'object'
3395
3405
  ]);
3396
- function ps() {
3406
+ function pr() {
3397
3407
  }
3398
- function _t(n, e = null, t = ps) {
3408
+ function _t(n, e = null, t = pr) {
3399
3409
  arguments.length === 2 && typeof e == "function" && (t = e, e = null);
3400
- const r = e || Se(n), s = hs.get(r);
3401
- if (r === "Object") {
3402
- const a = t(n, r);
3410
+ const s = e || Ae(n), r = hr.get(s);
3411
+ if (s === "Object") {
3412
+ const a = t(n, s);
3403
3413
  if (a !== void 0)
3404
3414
  return a;
3405
3415
  }
3406
- return s ? s(n, r) : n;
3416
+ return r ? r(n, s) : n;
3407
3417
  }
3408
- function Ee(n, e = {}) {
3418
+ function Oe(n, e = {}) {
3409
3419
  typeof e == "function" && (e = {
3410
3420
  customizer: e
3411
3421
  });
@@ -3414,14 +3424,14 @@ function Ee(n, e = {}) {
3414
3424
  customizer: t
3415
3425
  // TODO: max depth
3416
3426
  // depth = Infinity,
3417
- } = e, r = Se(n);
3418
- if (!vt(r))
3427
+ } = e, s = Ae(n);
3428
+ if (!vt(s))
3419
3429
  return bt(n, null, null, null);
3420
- const s = _t(n, r, t), a = new WeakMap([[n, s]]), i = new WeakSet([n]);
3421
- return bt(n, s, a, i);
3430
+ const r = _t(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
3431
+ return bt(n, r, a, i);
3422
3432
  }
3423
- function bt(n, e, t, r, s) {
3424
- const a = Se(n), i = _t(n, a);
3433
+ function bt(n, e, t, s, r) {
3434
+ const a = Ae(n), i = _t(n, a);
3425
3435
  if (!vt(a))
3426
3436
  return i;
3427
3437
  let o;
@@ -3439,19 +3449,19 @@ function bt(n, e, t, r, s) {
3439
3449
  break;
3440
3450
  }
3441
3451
  for (let c of o) {
3442
- const u = Yr(n, c, a);
3443
- if (r.has(u))
3444
- zt(e, c, t.get(u), a);
3452
+ const u = Ys(n, c, a);
3453
+ if (s.has(u))
3454
+ Ut(e, c, t.get(u), a);
3445
3455
  else {
3446
- const h = Se(u), _ = _t(u, h);
3447
- vt(h) && (t.set(u, _), r.add(u)), zt(
3456
+ const h = Ae(u), _ = _t(u, h);
3457
+ vt(h) && (t.set(u, _), s.add(u)), Ut(
3448
3458
  e,
3449
3459
  c,
3450
3460
  bt(
3451
3461
  u,
3452
3462
  _,
3453
3463
  t,
3454
- r
3464
+ s
3455
3465
  ),
3456
3466
  a
3457
3467
  );
@@ -3459,36 +3469,36 @@ function bt(n, e, t, r, s) {
3459
3469
  }
3460
3470
  return e;
3461
3471
  }
3462
- const ms = (n) => new Promise((e) => setTimeout(e, n));
3463
- var Ke, he, Xe, wt, cn;
3464
- class ys {
3472
+ const mr = (n) => new Promise((e) => setTimeout(e, n));
3473
+ var Ke, pe, Xe, wt, cn;
3474
+ class yr {
3465
3475
  constructor({ maxAttempts: e = 3, func: t }) {
3466
- B(this, wt), B(this, Ke), B(this, he), B(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, he, 0);
3476
+ W(this, wt), W(this, Ke), W(this, pe), W(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, pe, 0);
3467
3477
  }
3468
3478
  run() {
3469
3479
  return A(this, null, function* () {
3470
3480
  try {
3471
3481
  return yield k(this, Xe).call(this);
3472
3482
  } catch (e) {
3473
- if (j(this, he, k(this, he) + 1), k(this, he) > k(this, Ke))
3483
+ if (j(this, pe, k(this, pe) + 1), k(this, pe) > k(this, Ke))
3474
3484
  throw console.error("Max attempts reached"), e;
3475
- const t = Y(this, wt, cn).call(this);
3476
- return yield ms(t), yield this.run();
3485
+ const t = ee(this, wt, cn).call(this);
3486
+ return yield mr(t), yield this.run();
3477
3487
  }
3478
3488
  });
3479
3489
  }
3480
3490
  }
3481
- Ke = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(), cn = function() {
3482
- return k(this, he) * 1e3 * 1.5;
3491
+ Ke = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(), cn = function() {
3492
+ return k(this, pe) * 1e3 * 1.5;
3483
3493
  };
3484
- function gs() {
3494
+ function gr() {
3485
3495
  return typeof CompressionStream != "undefined";
3486
3496
  }
3487
- function vs(n) {
3497
+ function vr(n) {
3488
3498
  return A(this, null, function* () {
3489
3499
  const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
3490
3500
  try {
3491
- for (var r = Vr(e), s, a, i; s = !(a = yield r.next()).done; s = !1) {
3501
+ for (var s = Vs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
3492
3502
  const o = a.value;
3493
3503
  t.push(o);
3494
3504
  }
@@ -3496,25 +3506,25 @@ function vs(n) {
3496
3506
  i = [o];
3497
3507
  } finally {
3498
3508
  try {
3499
- s && (a = r.return) && (yield a.call(r));
3509
+ r && (a = s.return) && (yield a.call(s));
3500
3510
  } finally {
3501
3511
  if (i)
3502
3512
  throw i[0];
3503
3513
  }
3504
3514
  }
3505
- return yield _s(t);
3515
+ return yield _r(t);
3506
3516
  });
3507
3517
  }
3508
- function _s(n) {
3518
+ function _r(n) {
3509
3519
  return A(this, null, function* () {
3510
3520
  const e = yield new Blob(n).arrayBuffer();
3511
3521
  return new Uint8Array(e);
3512
3522
  });
3513
3523
  }
3514
- class bs extends Error {
3515
- constructor({ resource: e, api: t, args: r, cause: s }) {
3516
- if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause = s, this.args = r, s instanceof Error)
3517
- for (const [i, o] of Object.entries(s))
3524
+ class br extends Error {
3525
+ constructor({ resource: e, api: t, args: s, cause: r }) {
3526
+ if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause = r, this.args = s, r instanceof Error)
3527
+ for (const [i, o] of Object.entries(r))
3518
3528
  if (typeof Headers != "undefined" && o instanceof Headers) {
3519
3529
  const c = {};
3520
3530
  o.forEach((u, h) => {
@@ -3530,12 +3540,12 @@ class Bt extends Error {
3530
3540
  constructor({
3531
3541
  url: e,
3532
3542
  method: t,
3533
- statusCode: r,
3534
- requestHeaders: s,
3543
+ statusCode: s,
3544
+ requestHeaders: r,
3535
3545
  responseHeaders: a,
3536
3546
  body: i
3537
3547
  }) {
3538
- if (super("Fetch Error"), this.name = "Fetch Error", this.url = e, this.method = t, this.statusNumber = r, this.requestHeaders = s, this.responseHeaders = a, i)
3548
+ if (super("Fetch Error"), this.name = "Fetch Error", this.url = e, this.method = t, this.statusNumber = s, this.requestHeaders = r, this.responseHeaders = a, i)
3539
3549
  try {
3540
3550
  const o = JSON.parse(i);
3541
3551
  this.body = o;
@@ -3544,13 +3554,13 @@ class Bt extends Error {
3544
3554
  }
3545
3555
  }
3546
3556
  }
3547
- class Ne extends Error {
3557
+ class je extends Error {
3548
3558
  constructor(e = {}) {
3549
3559
  const { canceled: t = !1 } = e;
3550
3560
  super("Abort Error"), this.name = "Abort Error", this.canceled = t;
3551
3561
  }
3552
3562
  }
3553
- class ws extends Error {
3563
+ class wr extends Error {
3554
3564
  constructor(e) {
3555
3565
  super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
3556
3566
  }
@@ -3569,11 +3579,11 @@ function dn() {
3569
3579
  function xt() {
3570
3580
  return Math.floor(Date.now() / 1e3).toString();
3571
3581
  }
3572
- const xs = 5 * 60 * 1e3, ks = 1 * 1e3;
3573
- var pe, D, K, kt, Tt, je;
3574
- class Ts {
3582
+ const xr = 5 * 60 * 1e3, kr = 1 * 1e3;
3583
+ var me, $, Y, kt, Tt, Ie;
3584
+ class Tr {
3575
3585
  constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
3576
- B(this, K), B(this, pe), B(this, D), this.baseAddress = t, j(this, pe, e), j(this, D, {}), this.plugins = [];
3586
+ W(this, Y), W(this, me), W(this, $), this.baseAddress = t, j(this, me, e), j(this, $, {}), this.plugins = [];
3577
3587
  }
3578
3588
  get headers() {
3579
3589
  throw new Error("Missing implementation");
@@ -3585,51 +3595,51 @@ class Ts {
3585
3595
  this.plugins = this.plugins.filter((t) => t.name !== e);
3586
3596
  }
3587
3597
  withOptions(e = {}) {
3588
- return j(this, D, e), this;
3598
+ return j(this, $, e), this;
3589
3599
  }
3590
3600
  get(e) {
3591
- return A(this, arguments, function* (t, r = {}) {
3592
- const { overrideBaseAddress: s, overrideDefaultHeaders: a } = r, i = s != null ? s : this.baseAddress;
3601
+ return A(this, arguments, function* (t, s = {}) {
3602
+ const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
3593
3603
  let o = a != null ? a : this.headers;
3594
- const c = Ee(k(this, D));
3595
- return j(this, D, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Et(V({}, o), { "X-Request-Nonce": dn(), "X-Request-Timestamp": xt() })), c.async ? yield Y(this, K, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield Y(this, K, kt).call(this, `${i}${t}`, c, { headers: o });
3604
+ const c = Oe(k(this, $));
3605
+ return j(this, $, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Et(V({}, o), { "X-Request-Nonce": dn(), "X-Request-Timestamp": xt() })), c.async ? yield ee(this, Y, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield ee(this, Y, kt).call(this, `${i}${t}`, c, { headers: o });
3596
3606
  });
3597
3607
  }
3598
3608
  post(e, t) {
3599
- return A(this, arguments, function* (r, s, a = {}) {
3600
- const i = Ee(k(this, D));
3601
- return j(this, D, {}), Y(this, K, je).call(this, r, "POST", s, a, i);
3609
+ return A(this, arguments, function* (s, r, a = {}) {
3610
+ const i = Oe(k(this, $));
3611
+ return j(this, $, {}), ee(this, Y, Ie).call(this, s, "POST", r, a, i);
3602
3612
  });
3603
3613
  }
3604
3614
  put(e, t) {
3605
- return A(this, arguments, function* (r, s, a = {}) {
3606
- const i = Ee(k(this, D));
3607
- return j(this, D, {}), Y(this, K, je).call(this, r, "PUT", s, a, i);
3615
+ return A(this, arguments, function* (s, r, a = {}) {
3616
+ const i = Oe(k(this, $));
3617
+ return j(this, $, {}), ee(this, Y, Ie).call(this, s, "PUT", r, a, i);
3608
3618
  });
3609
3619
  }
3610
3620
  delete(e, t) {
3611
- return A(this, arguments, function* (r, s, a = {}) {
3612
- const i = Ee(k(this, D));
3613
- return j(this, D, {}), Y(this, K, je).call(this, r, "DELETE", s, a, i);
3621
+ return A(this, arguments, function* (s, r, a = {}) {
3622
+ const i = Oe(k(this, $));
3623
+ return j(this, $, {}), ee(this, Y, Ie).call(this, s, "DELETE", r, a, i);
3614
3624
  });
3615
3625
  }
3616
3626
  patch(e, t) {
3617
- return A(this, arguments, function* (r, s, a = {}) {
3618
- const i = Ee(k(this, D));
3619
- return j(this, D, {}), Y(this, K, je).call(this, r, "PATCH", s, a, i);
3627
+ return A(this, arguments, function* (s, r, a = {}) {
3628
+ const i = Oe(k(this, $));
3629
+ return j(this, $, {}), ee(this, Y, Ie).call(this, s, "PATCH", r, a, i);
3620
3630
  });
3621
3631
  }
3622
3632
  }
3623
- pe = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakSet(), kt = function(n, e, t) {
3633
+ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), kt = function(n, e, t) {
3624
3634
  return A(this, null, function* () {
3625
- const r = () => A(this, null, function* () {
3635
+ const s = () => A(this, null, function* () {
3626
3636
  var c, u;
3627
3637
  try {
3628
- return yield k(this, pe).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
3638
+ return yield k(this, me).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
3629
3639
  } catch (h) {
3630
- throw h instanceof Error && h.name === "AbortError" ? new Ne({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : h;
3640
+ throw h instanceof Error && h.name === "AbortError" ? new je({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : h;
3631
3641
  }
3632
- }), { headers: s } = t != null ? t : {}, a = (c, u) => {
3642
+ }), { headers: r } = t != null ? t : {}, a = (c, u) => {
3633
3643
  var h, _;
3634
3644
  return ((h = c == null ? void 0 : c.headers) == null ? void 0 : h.get(u)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[u]) || "";
3635
3645
  }, i = (c) => A(this, null, function* () {
@@ -3640,22 +3650,22 @@ pe = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), K = /* @_
3640
3650
  url: n,
3641
3651
  method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
3642
3652
  statusCode: c.status,
3643
- requestHeaders: s,
3653
+ requestHeaders: r,
3644
3654
  responseHeaders: c.headers,
3645
3655
  body: _
3646
3656
  });
3647
3657
  }
3648
3658
  if (e.requestValidation && process.env.UI_TESTS !== !0)
3649
3659
  try {
3650
- const _ = a(c, "x-response-nonce"), C = s == null ? void 0 : s["X-Request-Nonce"];
3651
- if (!_ || _ !== C)
3660
+ const _ = a(c, "x-response-nonce"), N = r == null ? void 0 : r["X-Request-Nonce"];
3661
+ if (!_ || _ !== N)
3652
3662
  throw new lt("Response nonce mismatch");
3653
- const E = Number(a(c, "x-response-timestamp")), O = Number(xt()), P = 60 * 60 * 24;
3654
- if (isNaN(E) || Math.abs(O - E) > P)
3663
+ const O = Number(a(c, "x-response-timestamp")), C = Number(xt()), R = 60 * 60 * 24;
3664
+ if (isNaN(O) || Math.abs(C - O) > R)
3655
3665
  throw new lt("Invalid response timestamp");
3656
3666
  } catch (_) {
3657
- const C = _ instanceof Error ? _.message : "Request validation failed";
3658
- throw new lt(C);
3667
+ const N = _ instanceof Error ? _.message : "Request validation failed";
3668
+ throw new lt(N);
3659
3669
  }
3660
3670
  let h = yield c.text();
3661
3671
  try {
@@ -3665,184 +3675,184 @@ pe = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), K = /* @_
3665
3675
  return h;
3666
3676
  });
3667
3677
  if (e.retry) {
3668
- const c = yield new ys({
3678
+ const c = yield new yr({
3669
3679
  maxAttempts: e.retry,
3670
- func: r
3680
+ func: s
3671
3681
  }).run();
3672
3682
  return yield i(c);
3673
3683
  }
3674
- const o = yield r();
3684
+ const o = yield s();
3675
3685
  return yield i(o);
3676
3686
  });
3677
3687
  }, Tt = function(n, e, t) {
3678
3688
  return A(this, null, function* () {
3679
- var r, s;
3689
+ var s, r;
3680
3690
  const {
3681
3691
  onProgress: a,
3682
3692
  abortSignal: i,
3683
- pollingInterval: o = () => ks,
3684
- maxTimeout: c = xs
3693
+ pollingInterval: o = () => kr,
3694
+ maxTimeout: c = xr
3685
3695
  } = e, u = `${n}/async`, h = `${n}/async/job`;
3686
3696
  let _;
3687
3697
  try {
3688
- _ = yield k(this, pe).call(this, u, V(V({}, t), i && { signal: i }));
3689
- } catch (O) {
3690
- throw O instanceof Error && O.name === "AbortError" ? new Ne({ canceled: (r = i == null ? void 0 : i.aborted) != null ? r : !1 }) : O;
3698
+ _ = yield k(this, me).call(this, u, V(V({}, t), i && { signal: i }));
3699
+ } catch (C) {
3700
+ throw C instanceof Error && C.name === "AbortError" ? new je({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : C;
3691
3701
  }
3692
3702
  if (!_.ok) {
3693
- const O = yield _.text().catch();
3703
+ const C = yield _.text().catch();
3694
3704
  throw new Bt({
3695
3705
  url: n,
3696
- method: (s = t == null ? void 0 : t.method) != null ? s : "GET",
3706
+ method: (r = t == null ? void 0 : t.method) != null ? r : "GET",
3697
3707
  statusCode: _.status,
3698
3708
  requestHeaders: this.headers,
3699
3709
  responseHeaders: _.headers,
3700
- body: O
3710
+ body: C
3701
3711
  });
3702
3712
  }
3703
- const C = yield _.json(), { job_id: E } = C;
3704
- if (!E)
3713
+ const N = yield _.json(), { job_id: O } = N;
3714
+ if (!O)
3705
3715
  throw new Error("Job ID not found in response");
3706
- return new Promise((O, P) => A(this, null, function* () {
3707
- const $ = setTimeout(() => {
3708
- P(new Error("Job timed out"));
3709
- }, c), ie = (oe = 0) => A(this, null, function* () {
3716
+ return new Promise((C, R) => A(this, null, function* () {
3717
+ const q = setTimeout(() => {
3718
+ R(new Error("Job timed out"));
3719
+ }, c), z = (re = 0) => A(this, null, function* () {
3710
3720
  if (i != null && i.aborted) {
3711
- clearTimeout($), k(this, pe).call(this, `${h}/${E}/cancel`, { method: "POST", headers: this.headers }).then(() => {
3712
- P(new Ne({ canceled: !0 }));
3713
- }).catch((R) => {
3714
- P(new Ne({ canceled: !1 }));
3721
+ clearTimeout(q), k(this, me).call(this, `${h}/${O}/cancel`, { method: "POST", headers: this.headers }).then(() => {
3722
+ R(new je({ canceled: !0 }));
3723
+ }).catch((L) => {
3724
+ R(new je({ canceled: !1 }));
3715
3725
  });
3716
3726
  return;
3717
3727
  }
3718
3728
  try {
3719
- const R = yield (yield k(this, pe).call(this, `${h}/${E}`, { headers: this.headers })).json();
3720
- if (R.status === "success") {
3721
- clearTimeout($);
3722
- const T = R.response_json;
3723
- O(T);
3724
- } else if (R.status === "failed")
3725
- clearTimeout($), P(new ws(R.response_json));
3729
+ const L = yield (yield k(this, me).call(this, `${h}/${O}`, { headers: this.headers })).json();
3730
+ if (L.status === "success") {
3731
+ clearTimeout(q);
3732
+ const K = L.response_json;
3733
+ C(K);
3734
+ } else if (L.status === "failed")
3735
+ clearTimeout(q), R(new wr(L.response_json));
3726
3736
  else {
3727
- a && a(R.response_json);
3728
- const T = o(oe);
3729
- setTimeout(() => ie(oe + 1), T);
3737
+ a && a(L.response_json);
3738
+ const K = o(re);
3739
+ setTimeout(() => z(re + 1), K);
3730
3740
  }
3731
- } catch (R) {
3732
- P(R);
3741
+ } catch (L) {
3742
+ R(L);
3733
3743
  }
3734
3744
  });
3735
- ie();
3745
+ z();
3736
3746
  }));
3737
3747
  });
3738
- }, je = function(n, e, t, r, s) {
3748
+ }, Ie = function(n, e, t, s, r) {
3739
3749
  return A(this, null, function* () {
3740
- const { overrideBaseAddress: a, overrideDefaultHeaders: i } = r, o = a != null ? a : this.baseAddress;
3750
+ const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
3741
3751
  let c = i != null ? i : this.headers;
3742
- s.extraHeaders && (c = V(V({}, c), s.extraHeaders)), s.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce": dn(), "X-Request-Timestamp": xt() }));
3743
- let u = r.skipBodyJsonStringify ? t : JSON.stringify(t);
3744
- return s.compress && gs() && (c["Content-Encoding"] = "gzip", u = yield vs(u)), s.async ? yield Y(this, K, Tt).call(this, `${o}${n}`, s.async, {
3752
+ r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce": dn(), "X-Request-Timestamp": xt() }));
3753
+ let u = s.skipBodyJsonStringify ? t : JSON.stringify(t);
3754
+ return r.compress && gr() && (c["Content-Encoding"] = "gzip", u = yield vr(u)), r.async ? yield ee(this, Y, Tt).call(this, `${o}${n}`, r.async, {
3745
3755
  method: e,
3746
3756
  headers: c,
3747
3757
  body: u
3748
- }) : yield Y(this, K, kt).call(this, `${o}${n}`, s, { method: e, headers: c, body: u });
3758
+ }) : yield ee(this, Y, kt).call(this, `${o}${n}`, r, { method: e, headers: c, body: u });
3749
3759
  });
3750
3760
  };
3751
- const Wt = (n, e, t, r) => n instanceof Ne ? n : new bs({ resource: e, api: String(t), args: r, cause: n }), ft = (n, e) => new Proxy(e, {
3752
- get(t, r) {
3753
- return (...s) => {
3761
+ const Wt = (n, e, t, s) => n instanceof je ? n : new br({ resource: e, api: String(t), args: s, cause: n }), ft = (n, e) => new Proxy(e, {
3762
+ get(t, s) {
3763
+ return (...r) => {
3754
3764
  var a;
3755
3765
  for (const o of n.plugins) {
3756
- const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api: r, args: s });
3766
+ const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api: s, args: r });
3757
3767
  if (c !== void 0)
3758
3768
  return c;
3759
3769
  }
3760
3770
  let i;
3761
3771
  try {
3762
- i = t[r](...s);
3772
+ i = t[s](...r);
3763
3773
  } catch (o) {
3764
- throw Wt(o, t.resourceName, r, s);
3774
+ throw Wt(o, t.resourceName, s, r);
3765
3775
  }
3766
3776
  return i instanceof Promise ? i.catch((o) => {
3767
- throw Wt(o, t.resourceName, r, s);
3777
+ throw Wt(o, t.resourceName, s, r);
3768
3778
  }) : i;
3769
3779
  };
3770
3780
  }
3771
3781
  });
3772
- var Ie;
3773
- class Ss {
3782
+ var Re;
3783
+ class Sr {
3774
3784
  constructor(e) {
3775
- B(this, Ie), this.resourceName = "Files", j(this, Ie, e);
3785
+ W(this, Re), this.resourceName = "Files", j(this, Re, e);
3776
3786
  }
3777
3787
  get(e) {
3778
- return A(this, arguments, function* ({ fileKey: t, params: r = {} }) {
3779
- const s = new URLSearchParams(V({
3788
+ return A(this, arguments, function* ({ fileKey: t, params: s = {} }) {
3789
+ const r = new URLSearchParams(V({
3780
3790
  plugin_data: "857346721138427857"
3781
- }, r)).toString(), a = `v1/files/${t}?${s}`;
3782
- return yield k(this, Ie).get(a);
3791
+ }, s)).toString(), a = `v1/files/${t}?${r}`;
3792
+ return yield k(this, Re).get(a);
3783
3793
  });
3784
3794
  }
3785
3795
  getImageFills(e) {
3786
3796
  return A(this, arguments, function* ({ fileKey: t }) {
3787
- var r, s;
3797
+ var s, r;
3788
3798
  const a = `v1/files/${t}/images`;
3789
- return (s = (r = (yield k(this, Ie).get(a)).meta) == null ? void 0 : r.images) != null ? s : {};
3799
+ return (r = (s = (yield k(this, Re).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
3790
3800
  });
3791
3801
  }
3792
3802
  }
3793
- Ie = /* @__PURE__ */ new WeakMap();
3794
- const As = (n, e, t) => {
3795
- const r = e.sort();
3796
- return `${n}-${r.join("-")}-${t}`;
3797
- }, Es = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
3798
- var X, St, un;
3799
- class Os {
3803
+ Re = /* @__PURE__ */ new WeakMap();
3804
+ const Ar = (n, e, t) => {
3805
+ const s = e.sort();
3806
+ return `${n}-${s.join("-")}-${t}`;
3807
+ }, Er = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
3808
+ var Q, St, un;
3809
+ class Or {
3800
3810
  constructor(e) {
3801
- B(this, St), B(this, X), this.resourceName = "Images", j(this, X, e);
3811
+ W(this, St), W(this, Q), this.resourceName = "Images", j(this, Q, e);
3802
3812
  }
3803
3813
  /**
3804
3814
  * Return the URL for the _layer_ images for the given nodes.
3805
3815
  * Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
3806
3816
  */
3807
3817
  get(e) {
3808
- return A(this, arguments, function* ({ fileKey: t, nodeIds: r, format: s = "jpg", scale: a }) {
3809
- const i = As(t, r, s), o = k(this, X).cache.images.entries.get(i);
3810
- if (Es(o))
3818
+ return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
3819
+ const i = Ar(t, s, r), o = k(this, Q).cache.images.entries.get(i);
3820
+ if (Er(o))
3811
3821
  return o.result;
3812
- o && k(this, X).cache.images.entries.delete(i);
3813
- const c = k(this, X).cache.images.pendingRequests.get(i);
3822
+ o && k(this, Q).cache.images.entries.delete(i);
3823
+ const c = k(this, Q).cache.images.pendingRequests.get(i);
3814
3824
  if (c)
3815
3825
  return c;
3816
- const u = Y(this, St, un).call(this, i, t, r, s, a);
3817
- k(this, X).cache.images.pendingRequests.set(i, u);
3826
+ const u = ee(this, St, un).call(this, i, t, s, r, a);
3827
+ k(this, Q).cache.images.pendingRequests.set(i, u);
3818
3828
  try {
3819
3829
  return yield u;
3820
3830
  } finally {
3821
- k(this, X).cache.images.pendingRequests.delete(i);
3831
+ k(this, Q).cache.images.pendingRequests.delete(i);
3822
3832
  }
3823
3833
  });
3824
3834
  }
3825
3835
  }
3826
- X = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), un = function(n, e, t, r, s) {
3836
+ Q = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), un = function(n, e, t, s, r) {
3827
3837
  return A(this, null, function* () {
3828
- const a = yield k(this, X).get(
3829
- `v1/images/${e}?ids=${t}&format=${r}${s ? `&scale=${s}` : ""}`
3838
+ const a = yield k(this, Q).get(
3839
+ `v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
3830
3840
  );
3831
- return k(this, X).cache.images.entries.set(n, {
3841
+ return k(this, Q).cache.images.entries.set(n, {
3832
3842
  result: a,
3833
3843
  ts: Date.now()
3834
3844
  }), a;
3835
3845
  });
3836
3846
  };
3837
3847
  var Ye;
3838
- class Cs {
3848
+ class Cr {
3839
3849
  constructor(e) {
3840
- B(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
3850
+ W(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
3841
3851
  }
3842
3852
  get(e) {
3843
- return A(this, arguments, function* ({ fileKey: t, nodeIds: r, params: s = {} }) {
3844
- const a = Et(V({}, s), {
3845
- ids: r.join(",")
3853
+ return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
3854
+ const a = Et(V({}, r), {
3855
+ ids: s.join(",")
3846
3856
  }), i = new URLSearchParams(V({
3847
3857
  plugin_data: "857346721138427857"
3848
3858
  }, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
@@ -3851,110 +3861,110 @@ class Cs {
3851
3861
  }
3852
3862
  }
3853
3863
  Ye = /* @__PURE__ */ new WeakMap();
3854
- var ce;
3855
- class ln extends Ts {
3864
+ var de;
3865
+ class ln extends Tr {
3856
3866
  constructor({
3857
3867
  baseAddress: e = "https://api.figma.com/",
3858
3868
  fetch: t = globalThis.fetch.bind(globalThis)
3859
3869
  } = {}) {
3860
- super({ fetch: t, baseAddress: e }), B(this, ce, ""), this.cache = {
3870
+ super({ fetch: t, baseAddress: e }), W(this, de, ""), this.cache = {
3861
3871
  images: {
3862
3872
  entries: /* @__PURE__ */ new Map(),
3863
3873
  pendingRequests: /* @__PURE__ */ new Map()
3864
3874
  }
3865
- }, this.files = ft(this, new Ss(this)), this.nodes = ft(this, new Cs(this)), this.images = ft(this, new Os(this));
3875
+ }, this.files = ft(this, new Sr(this)), this.nodes = ft(this, new Cr(this)), this.images = ft(this, new Or(this));
3866
3876
  }
3867
3877
  set token(e) {
3868
3878
  if (!e.startsWith("figd_") && !e.startsWith("figu_"))
3869
3879
  throw new Error("Invalid Figma access token");
3870
- j(this, ce, e);
3880
+ j(this, de, e);
3871
3881
  }
3872
3882
  get token() {
3873
- return k(this, ce);
3883
+ return k(this, de);
3874
3884
  }
3875
3885
  get headers() {
3876
3886
  const e = {
3877
3887
  "Content-Type": "application/json"
3878
3888
  };
3879
- return k(this, ce).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = k(this, ce) : k(this, ce).startsWith("figu_") && (e.Authorization = `Bearer ${k(this, ce)}`), e;
3889
+ return k(this, de).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = k(this, de) : k(this, de).startsWith("figu_") && (e.Authorization = `Bearer ${k(this, de)}`), e;
3880
3890
  }
3881
3891
  }
3882
- ce = /* @__PURE__ */ new WeakMap();
3883
- const $s = (s) => F(void 0, [s], function* ({
3892
+ de = /* @__PURE__ */ new WeakMap();
3893
+ const $r = (r) => P(void 0, [r], function* ({
3884
3894
  fileKey: n,
3885
3895
  authToken: e,
3886
3896
  figmaRestApi: t = new ln(),
3887
- params: r = {}
3897
+ params: s = {}
3888
3898
  }) {
3889
3899
  e && (t.token = e);
3890
3900
  try {
3891
3901
  return yield t.files.get({
3892
3902
  fileKey: n,
3893
- params: r
3903
+ params: s
3894
3904
  });
3895
3905
  } catch (a) {
3896
3906
  throw console.error(a), a;
3897
3907
  }
3898
- }), Fs = (a) => F(void 0, [a], function* ({
3908
+ }), Lr = (a) => P(void 0, [a], function* ({
3899
3909
  fileKey: n,
3900
3910
  authToken: e,
3901
3911
  nodeIds: t,
3902
- figmaRestApi: r = new ln(),
3903
- params: s = {}
3912
+ figmaRestApi: s = new ln(),
3913
+ params: r = {}
3904
3914
  }) {
3905
- e && (r.token = e);
3915
+ e && (s.token = e);
3906
3916
  try {
3907
- return (yield r.nodes.get({
3917
+ return (yield s.nodes.get({
3908
3918
  fileKey: n,
3909
3919
  nodeIds: t,
3910
- params: d({}, s)
3920
+ params: d({}, r)
3911
3921
  })).nodes;
3912
3922
  } catch (i) {
3913
- return Mr(i, n);
3923
+ return Ms(i, n);
3914
3924
  }
3915
- }), Ns = (n, e) => new ReadableStream({
3925
+ }), Nr = (n, e) => new ReadableStream({
3916
3926
  start(t) {
3917
- n.generateCode(e, (r) => {
3918
- r.type === "error" ? (console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"), t.enqueue({
3927
+ n.generateCode(e, (s) => {
3928
+ s.type === "error" ? (console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"), t.enqueue({
3919
3929
  type: "error",
3920
- payload: { message: r.payload.reason }
3921
- })) : t.enqueue(r), (r.type === "aborted" || r.type === "error") && t.close();
3922
- }).then((r) => {
3930
+ payload: { message: s.payload.reason }
3931
+ })) : t.enqueue(s), (s.type === "aborted" || s.type === "error") && t.close();
3932
+ }).then((s) => {
3923
3933
  t.enqueue({ type: "done" }), t.close();
3924
- }).catch((r) => {
3934
+ }).catch((s) => {
3925
3935
  t.enqueue({
3926
3936
  type: "error",
3927
3937
  payload: {
3928
- message: "message" in r ? r.message : "Unknown",
3929
- status: "status" in r ? r.status : void 0
3938
+ message: "message" in s ? s.message : "Unknown",
3939
+ status: "status" in s ? s.status : void 0
3930
3940
  }
3931
3941
  }), t.close();
3932
3942
  });
3933
3943
  }
3934
- }), Ds = (n, e) => F(void 0, null, function* () {
3935
- var o, c, u, h, _, C, E;
3936
- const t = Ns(n, e), [r, s] = t.tee(), a = yield r.getReader().read();
3937
- if (a.done || !a.value || ((o = a.value) == null ? void 0 : o.type) === "error" && ((u = (c = a.value) == null ? void 0 : c.payload) != null && u.status))
3944
+ }), Fr = (n, e) => P(void 0, null, function* () {
3945
+ var c, u, h, _, N, O, C;
3946
+ const t = Nr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
3947
+ if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((h = (u = a.value) == null ? void 0 : u.payload) != null && h.status))
3938
3948
  return new Response(JSON.stringify(a.value), {
3939
- status: ((h = a.value) == null ? void 0 : h.type) === "error" && (E = (C = (_ = a.value) == null ? void 0 : _.payload) == null ? void 0 : C.status) != null ? E : 500,
3949
+ status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (C = (O = (N = a.value) == null ? void 0 : N.payload) == null ? void 0 : O.status) != null ? C : 500,
3940
3950
  headers: {
3941
3951
  "Content-Type": "application/json"
3942
3952
  }
3943
3953
  });
3944
- const i = s.pipeThrough(
3954
+ const i = new TextEncoder(), o = r.pipeThrough(
3945
3955
  new TransformStream({
3946
- transform(O, P) {
3947
- const $ = `event: ${O.type}
3956
+ transform(R, q) {
3957
+ const z = `event: ${R.type}
3948
3958
  data: ${JSON.stringify(
3949
- O
3959
+ R
3950
3960
  )}
3951
3961
 
3952
3962
  `;
3953
- P.enqueue($);
3963
+ q.enqueue(i.encode(z));
3954
3964
  }
3955
3965
  })
3956
3966
  );
3957
- return new Response(i, {
3967
+ return new Response(o, {
3958
3968
  status: 200,
3959
3969
  headers: {
3960
3970
  "Content-Type": "text/event-stream; charset=utf-8",
@@ -3964,25 +3974,25 @@ data: ${JSON.stringify(
3964
3974
  });
3965
3975
  });
3966
3976
  export {
3967
- Is as Anima,
3968
- Ae as CodegenError,
3969
- Or as FigmaTokenIssue,
3970
- Nr as NotFound,
3971
- Cr as RateLimitExceeded,
3972
- Ir as UnknownFigmaApiException,
3973
- Er as convertCodegenFilesToAnimaFiles,
3974
- Ds as createCodegenResponseEventStream,
3975
- Ns as createCodegenStream,
3976
- Zs as formatToFigmaLink,
3977
- Ps as getFigmaApiErrorType,
3978
- $s as getFigmaFile,
3979
- Fs as getFileNodes,
3980
- Mr as handleFigmaApiError,
3981
- Zr as isFigmaTokenIssue,
3982
- jr as isNotFound,
3983
- Rr as isRateLimitExceeded,
3984
- Ms as isUnknownFigmaApiException,
3985
- Rs as isValidFigmaUrl,
3986
- Ar as validateSettings
3977
+ Ir as Anima,
3978
+ Ee as CodegenError,
3979
+ Os as FigmaTokenIssue,
3980
+ Ns as NotFound,
3981
+ Cs as RateLimitExceeded,
3982
+ Is as UnknownFigmaApiException,
3983
+ gn as convertCodegenFilesToAnimaFiles,
3984
+ Fr as createCodegenResponseEventStream,
3985
+ Nr as createCodegenStream,
3986
+ Zr as formatToFigmaLink,
3987
+ Pr as getFigmaApiErrorType,
3988
+ $r as getFigmaFile,
3989
+ Lr as getFileNodes,
3990
+ Ms as handleFigmaApiError,
3991
+ Zs as isFigmaTokenIssue,
3992
+ js as isNotFound,
3993
+ Rs as isRateLimitExceeded,
3994
+ Mr as isUnknownFigmaApiException,
3995
+ Rr as isValidFigmaUrl,
3996
+ Es as validateSettings
3987
3997
  };
3988
3998
  //# sourceMappingURL=index.js.map