@animaapp/anima-sdk-react 0.6.32 → 0.6.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +614 -612
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,44 +10,44 @@ var _r = (n, e, t) => e in n ? ks(n, e, { enumerable: !0, configurable: !0, writ
|
|
|
10
10
|
Os.call(e, t) && _r(n, t, e[t]);
|
|
11
11
|
return n;
|
|
12
12
|
}, br = (n, e) => xs(n, Es(e));
|
|
13
|
-
var
|
|
14
|
-
var a = (
|
|
13
|
+
var Ze = (n, e, t) => new Promise((r, s) => {
|
|
14
|
+
var a = (c) => {
|
|
15
15
|
try {
|
|
16
|
-
o(t.next(
|
|
17
|
-
} catch (
|
|
18
|
-
s(
|
|
16
|
+
o(t.next(c));
|
|
17
|
+
} catch (u) {
|
|
18
|
+
s(u);
|
|
19
19
|
}
|
|
20
|
-
}, i = (
|
|
20
|
+
}, i = (c) => {
|
|
21
21
|
try {
|
|
22
|
-
o(t.throw(
|
|
23
|
-
} catch (
|
|
24
|
-
s(
|
|
22
|
+
o(t.throw(c));
|
|
23
|
+
} catch (u) {
|
|
24
|
+
s(u);
|
|
25
25
|
}
|
|
26
|
-
}, o = (
|
|
26
|
+
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
27
27
|
o((t = t.apply(n, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import Dt, { useState as Ts, useCallback as Bt, createContext as As, useEffect as Cs, useLayoutEffect as Rs, useContext as js, useRef as
|
|
30
|
-
var Zs = Object.defineProperty,
|
|
29
|
+
import Dt, { useState as Ts, useCallback as Bt, createContext as As, useEffect as Cs, useLayoutEffect as Rs, useContext as js, useRef as qe, useMemo as Ns, useDebugValue as Is } from "react";
|
|
30
|
+
var Zs = Object.defineProperty, Ls = Object.defineProperties, Ps = Object.getOwnPropertyDescriptors, wr = Object.getOwnPropertySymbols, Ms = Object.prototype.hasOwnProperty, Ds = Object.prototype.propertyIsEnumerable, kr = (n, e, t) => e in n ? Zs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, d = (n, e) => {
|
|
31
31
|
for (var t in e || (e = {}))
|
|
32
32
|
Ms.call(e, t) && kr(n, t, e[t]);
|
|
33
33
|
if (wr)
|
|
34
34
|
for (var t of wr(e))
|
|
35
35
|
Ds.call(e, t) && kr(n, t, e[t]);
|
|
36
36
|
return n;
|
|
37
|
-
}, S = (n, e) =>
|
|
38
|
-
var a = (
|
|
37
|
+
}, S = (n, e) => Ls(n, Ps(e)), xe = (n, e, t) => new Promise((r, s) => {
|
|
38
|
+
var a = (c) => {
|
|
39
39
|
try {
|
|
40
|
-
o(t.next(
|
|
41
|
-
} catch (
|
|
42
|
-
s(
|
|
40
|
+
o(t.next(c));
|
|
41
|
+
} catch (u) {
|
|
42
|
+
s(u);
|
|
43
43
|
}
|
|
44
|
-
}, i = (
|
|
44
|
+
}, i = (c) => {
|
|
45
45
|
try {
|
|
46
|
-
o(t.throw(
|
|
47
|
-
} catch (
|
|
48
|
-
s(
|
|
46
|
+
o(t.throw(c));
|
|
47
|
+
} catch (u) {
|
|
48
|
+
s(u);
|
|
49
49
|
}
|
|
50
|
-
}, o = (
|
|
50
|
+
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
51
51
|
o((t = t.apply(n, e)).next());
|
|
52
52
|
});
|
|
53
53
|
class fn extends Error {
|
|
@@ -122,22 +122,22 @@ var Js = Object.defineProperty, Xs = Object.defineProperties, Ys = Object.getOwn
|
|
|
122
122
|
for (var t of xr(e))
|
|
123
123
|
ea.call(e, t) && Sr(n, t, e[t]);
|
|
124
124
|
return n;
|
|
125
|
-
}, nr = (n, e) => Xs(n, Ys(e)), rr = (n, e, t) => e.has(n) || Hr("Cannot " + t), I = (n, e, t) => (rr(n, e, "read from private field"), t ? t.call(n) : e.get(n)), le = (n, e, t) => e.has(n) ? Hr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t),
|
|
126
|
-
var a = (
|
|
125
|
+
}, nr = (n, e) => Xs(n, Ys(e)), rr = (n, e, t) => e.has(n) || Hr("Cannot " + t), I = (n, e, t) => (rr(n, e, "read from private field"), t ? t.call(n) : e.get(n)), le = (n, e, t) => e.has(n) ? Hr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Y = (n, e, t, r) => (rr(n, e, "write to private field"), e.set(n, t), t), be = (n, e, t) => (rr(n, e, "access private method"), t), z = (n, e, t) => new Promise((r, s) => {
|
|
126
|
+
var a = (c) => {
|
|
127
127
|
try {
|
|
128
|
-
o(t.next(
|
|
129
|
-
} catch (
|
|
130
|
-
s(
|
|
128
|
+
o(t.next(c));
|
|
129
|
+
} catch (u) {
|
|
130
|
+
s(u);
|
|
131
131
|
}
|
|
132
|
-
}, i = (
|
|
132
|
+
}, i = (c) => {
|
|
133
133
|
try {
|
|
134
|
-
o(t.throw(
|
|
135
|
-
} catch (
|
|
136
|
-
s(
|
|
134
|
+
o(t.throw(c));
|
|
135
|
+
} catch (u) {
|
|
136
|
+
s(u);
|
|
137
137
|
}
|
|
138
|
-
}, o = (
|
|
138
|
+
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
139
139
|
o((t = t.apply(n, e)).next());
|
|
140
|
-
}), ta = (n, e, t) => (e = n[Er("asyncIterator")]) ? e.call(n) : (n = n[Er("iterator")](), e = {}, t = (r, s) => (s = n[r]) && (e[r] = (a) => new Promise((i, o,
|
|
140
|
+
}), ta = (n, e, t) => (e = n[Er("asyncIterator")]) ? e.call(n) : (n = n[Er("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), na = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
141
141
|
function ra(n) {
|
|
142
142
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
143
143
|
}
|
|
@@ -147,7 +147,7 @@ function aa() {
|
|
|
147
147
|
(function(t, r) {
|
|
148
148
|
n.exports = r();
|
|
149
149
|
})(sa, function() {
|
|
150
|
-
var t = typeof Promise == "function", r = typeof self == "object" ? self : na, s = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined",
|
|
150
|
+
var t = typeof Promise == "function", r = typeof self == "object" ? self : na, s = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", f = s && typeof Symbol.iterator != "undefined", p = s && typeof Symbol.toStringTag != "undefined", w = i && typeof Set.prototype.entries == "function", _ = a && typeof Map.prototype.entries == "function", b = w && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = _ && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), v = f && typeof Array.prototype[Symbol.iterator] == "function", h = v && Object.getPrototypeOf([][Symbol.iterator]()), x = f && typeof String.prototype[Symbol.iterator] == "function", P = x && Object.getPrototypeOf(""[Symbol.iterator]()), V = 8, $ = -1;
|
|
151
151
|
function q(M) {
|
|
152
152
|
var Z = typeof M;
|
|
153
153
|
if (Z !== "object")
|
|
@@ -178,18 +178,18 @@ function aa() {
|
|
|
178
178
|
return "HTMLTableHeaderCellElement";
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
var
|
|
182
|
-
if (typeof
|
|
183
|
-
return
|
|
184
|
-
var
|
|
185
|
-
return
|
|
181
|
+
var ce = p && M[Symbol.toStringTag];
|
|
182
|
+
if (typeof ce == "string")
|
|
183
|
+
return ce;
|
|
184
|
+
var L = Object.getPrototypeOf(M);
|
|
185
|
+
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 === m ? "Map Iterator" : i && L === b ? "Set Iterator" : v && L === h ? "Array Iterator" : x && L === P ? "String Iterator" : L === null ? "Object" : Object.prototype.toString.call(M).slice(V, $);
|
|
186
186
|
}
|
|
187
187
|
return q;
|
|
188
188
|
});
|
|
189
189
|
}(Tn)), Tn.exports;
|
|
190
190
|
}
|
|
191
191
|
var ia = aa();
|
|
192
|
-
const oa = /* @__PURE__ */ ra(ia), sr = typeof Buffer != "undefined",
|
|
192
|
+
const oa = /* @__PURE__ */ ra(ia), sr = typeof Buffer != "undefined", ca = sr && typeof Buffer.from != "undefined", ua = sr ? (
|
|
193
193
|
/**
|
|
194
194
|
* is value is Buffer?
|
|
195
195
|
*
|
|
@@ -210,7 +210,7 @@ const oa = /* @__PURE__ */ ra(ia), sr = typeof Buffer != "undefined", ua = sr &&
|
|
|
210
210
|
function() {
|
|
211
211
|
return !1;
|
|
212
212
|
}
|
|
213
|
-
), da =
|
|
213
|
+
), da = ca ? (
|
|
214
214
|
/**
|
|
215
215
|
* copy Buffer
|
|
216
216
|
*
|
|
@@ -245,8 +245,8 @@ const oa = /* @__PURE__ */ ra(ia), sr = typeof Buffer != "undefined", ua = sr &&
|
|
|
245
245
|
return n;
|
|
246
246
|
}
|
|
247
247
|
);
|
|
248
|
-
function
|
|
249
|
-
return
|
|
248
|
+
function ut(n) {
|
|
249
|
+
return ua(n) ? "Buffer" : oa(n);
|
|
250
250
|
}
|
|
251
251
|
const la = /* @__PURE__ */ new Set([
|
|
252
252
|
"Arguments",
|
|
@@ -256,7 +256,7 @@ const la = /* @__PURE__ */ new Set([
|
|
|
256
256
|
"Set"
|
|
257
257
|
]);
|
|
258
258
|
function ha(n, e, t = null) {
|
|
259
|
-
switch (t ||
|
|
259
|
+
switch (t || ut(n)) {
|
|
260
260
|
case "Arguments":
|
|
261
261
|
case "Array":
|
|
262
262
|
case "Object":
|
|
@@ -271,7 +271,7 @@ function An(n) {
|
|
|
271
271
|
return la.has(n);
|
|
272
272
|
}
|
|
273
273
|
function Tr(n, e, t, r = null) {
|
|
274
|
-
switch (r ||
|
|
274
|
+
switch (r || ut(n)) {
|
|
275
275
|
case "Arguments":
|
|
276
276
|
case "Array":
|
|
277
277
|
case "Object":
|
|
@@ -311,10 +311,10 @@ function ka(n) {
|
|
|
311
311
|
function xa(n) {
|
|
312
312
|
return new String(n);
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ce(n, e) {
|
|
315
315
|
return pn[e].from ? pn[e].from(n) : new pn[e](n);
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function te(n) {
|
|
318
318
|
return n;
|
|
319
319
|
}
|
|
320
320
|
function Ar() {
|
|
@@ -341,33 +341,33 @@ const Ta = /* @__PURE__ */ new Map([
|
|
|
341
341
|
["String", xa],
|
|
342
342
|
// typed arrays
|
|
343
343
|
// TODO: pass bound function
|
|
344
|
-
["Float32Array",
|
|
345
|
-
["Float64Array",
|
|
346
|
-
["Int16Array",
|
|
347
|
-
["Int32Array",
|
|
348
|
-
["Int8Array",
|
|
349
|
-
["Uint16Array",
|
|
350
|
-
["Uint32Array",
|
|
351
|
-
["Uint8Array",
|
|
352
|
-
["Uint8ClampedArray",
|
|
344
|
+
["Float32Array", Ce],
|
|
345
|
+
["Float64Array", Ce],
|
|
346
|
+
["Int16Array", Ce],
|
|
347
|
+
["Int32Array", Ce],
|
|
348
|
+
["Int8Array", Ce],
|
|
349
|
+
["Uint16Array", Ce],
|
|
350
|
+
["Uint32Array", Ce],
|
|
351
|
+
["Uint8Array", Ce],
|
|
352
|
+
["Uint8ClampedArray", Ce],
|
|
353
353
|
// shallow copy
|
|
354
|
-
["Array Iterator",
|
|
355
|
-
["Map Iterator",
|
|
356
|
-
["Promise",
|
|
357
|
-
["Set Iterator",
|
|
358
|
-
["String Iterator",
|
|
359
|
-
["function",
|
|
360
|
-
["global",
|
|
354
|
+
["Array Iterator", te],
|
|
355
|
+
["Map Iterator", te],
|
|
356
|
+
["Promise", te],
|
|
357
|
+
["Set Iterator", te],
|
|
358
|
+
["String Iterator", te],
|
|
359
|
+
["function", te],
|
|
360
|
+
["global", te],
|
|
361
361
|
// NOTE: WeakMap and WeakSet cannot get entries
|
|
362
|
-
["WeakMap",
|
|
363
|
-
["WeakSet",
|
|
362
|
+
["WeakMap", te],
|
|
363
|
+
["WeakSet", te],
|
|
364
364
|
// primitives
|
|
365
|
-
["boolean",
|
|
366
|
-
["null",
|
|
367
|
-
["number",
|
|
368
|
-
["string",
|
|
369
|
-
["symbol",
|
|
370
|
-
["undefined",
|
|
365
|
+
["boolean", te],
|
|
366
|
+
["null", te],
|
|
367
|
+
["number", te],
|
|
368
|
+
["string", te],
|
|
369
|
+
["symbol", te],
|
|
370
|
+
["undefined", te],
|
|
371
371
|
// collections
|
|
372
372
|
// NOTE: return empty value, because recursively copy later.
|
|
373
373
|
["Arguments", Ar],
|
|
@@ -390,7 +390,7 @@ function Aa() {
|
|
|
390
390
|
}
|
|
391
391
|
function Cn(n, e = null, t = Aa) {
|
|
392
392
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
393
|
-
const r = e ||
|
|
393
|
+
const r = e || ut(n), s = Ta.get(r);
|
|
394
394
|
if (r === "Object") {
|
|
395
395
|
const a = t(n, r);
|
|
396
396
|
if (a !== void 0)
|
|
@@ -407,14 +407,14 @@ function pt(n, e = {}) {
|
|
|
407
407
|
customizer: t
|
|
408
408
|
// TODO: max depth
|
|
409
409
|
// depth = Infinity,
|
|
410
|
-
} = e, r =
|
|
410
|
+
} = e, r = ut(n);
|
|
411
411
|
if (!An(r))
|
|
412
412
|
return Rn(n, null, null, null);
|
|
413
413
|
const s = Cn(n, r, t), a = new WeakMap([[n, s]]), i = new WeakSet([n]);
|
|
414
414
|
return Rn(n, s, a, i);
|
|
415
415
|
}
|
|
416
416
|
function Rn(n, e, t, r, s) {
|
|
417
|
-
const a =
|
|
417
|
+
const a = ut(n), i = Cn(n, a);
|
|
418
418
|
if (!An(a))
|
|
419
419
|
return i;
|
|
420
420
|
let o;
|
|
@@ -431,17 +431,17 @@ function Rn(n, e, t, r, s) {
|
|
|
431
431
|
o = n.keys();
|
|
432
432
|
break;
|
|
433
433
|
}
|
|
434
|
-
for (let
|
|
435
|
-
const
|
|
436
|
-
if (r.has(
|
|
437
|
-
Tr(e,
|
|
434
|
+
for (let c of o) {
|
|
435
|
+
const u = ha(n, c, a);
|
|
436
|
+
if (r.has(u))
|
|
437
|
+
Tr(e, c, t.get(u), a);
|
|
438
438
|
else {
|
|
439
|
-
const f =
|
|
440
|
-
An(f) && (t.set(
|
|
439
|
+
const f = ut(u), p = Cn(u, f);
|
|
440
|
+
An(f) && (t.set(u, p), r.add(u)), Tr(
|
|
441
441
|
e,
|
|
442
|
-
|
|
442
|
+
c,
|
|
443
443
|
Rn(
|
|
444
|
-
|
|
444
|
+
u,
|
|
445
445
|
p,
|
|
446
446
|
t,
|
|
447
447
|
r
|
|
@@ -453,26 +453,26 @@ function Rn(n, e, t, r, s) {
|
|
|
453
453
|
return e;
|
|
454
454
|
}
|
|
455
455
|
const Ca = (n) => new Promise((e) => setTimeout(e, n));
|
|
456
|
-
var Ht,
|
|
456
|
+
var Ht, ze, Gt, jn, Gr;
|
|
457
457
|
class Ra {
|
|
458
458
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
459
|
-
le(this, jn), le(this, Ht), le(this,
|
|
459
|
+
le(this, jn), le(this, Ht), le(this, ze), le(this, Gt), Y(this, Ht, e), Y(this, Gt, t), Y(this, ze, 0);
|
|
460
460
|
}
|
|
461
461
|
run() {
|
|
462
462
|
return z(this, null, function* () {
|
|
463
463
|
try {
|
|
464
464
|
return yield I(this, Gt).call(this);
|
|
465
465
|
} catch (e) {
|
|
466
|
-
if (
|
|
466
|
+
if (Y(this, ze, I(this, ze) + 1), I(this, ze) > I(this, Ht))
|
|
467
467
|
throw console.error("Max attempts reached"), e;
|
|
468
|
-
const t =
|
|
468
|
+
const t = be(this, jn, Gr).call(this);
|
|
469
469
|
return yield Ca(t), yield this.run();
|
|
470
470
|
}
|
|
471
471
|
});
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
Ht = /* @__PURE__ */ new WeakMap(),
|
|
475
|
-
return I(this,
|
|
474
|
+
Ht = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), Gt = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakSet(), Gr = function() {
|
|
475
|
+
return I(this, ze) * 1e3 * 1.5;
|
|
476
476
|
};
|
|
477
477
|
function ja() {
|
|
478
478
|
return typeof CompressionStream != "undefined";
|
|
@@ -509,10 +509,10 @@ class Za extends Error {
|
|
|
509
509
|
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)
|
|
510
510
|
for (const [i, o] of Object.entries(s))
|
|
511
511
|
if (typeof Headers != "undefined" && o instanceof Headers) {
|
|
512
|
-
const
|
|
513
|
-
o.forEach((
|
|
514
|
-
|
|
515
|
-
}), this.causeProperties[i] =
|
|
512
|
+
const c = {};
|
|
513
|
+
o.forEach((u, f) => {
|
|
514
|
+
c[f] = u;
|
|
515
|
+
}), this.causeProperties[i] = c;
|
|
516
516
|
} else
|
|
517
517
|
this.causeProperties[i] = o;
|
|
518
518
|
const a = this.causeProperties.body;
|
|
@@ -543,7 +543,7 @@ class mt extends Error {
|
|
|
543
543
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
class
|
|
546
|
+
class La extends Error {
|
|
547
547
|
constructor(e) {
|
|
548
548
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
549
549
|
}
|
|
@@ -562,11 +562,11 @@ function Jr() {
|
|
|
562
562
|
function Nn() {
|
|
563
563
|
return Math.floor(Date.now() / 1e3).toString();
|
|
564
564
|
}
|
|
565
|
-
const
|
|
566
|
-
var
|
|
565
|
+
const Pa = 5 * 60 * 1e3, Ma = 1 * 1e3;
|
|
566
|
+
var Be, se, ve, In, Zn, yt;
|
|
567
567
|
class Da {
|
|
568
568
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
569
|
-
le(this,
|
|
569
|
+
le(this, ve), le(this, Be), le(this, se), this.baseAddress = t, Y(this, Be, e), Y(this, se, {}), this.plugins = [];
|
|
570
570
|
}
|
|
571
571
|
get headers() {
|
|
572
572
|
throw new Error("Missing implementation");
|
|
@@ -578,79 +578,79 @@ class Da {
|
|
|
578
578
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
579
579
|
}
|
|
580
580
|
withOptions(e = {}) {
|
|
581
|
-
return
|
|
581
|
+
return Y(this, se, e), this;
|
|
582
582
|
}
|
|
583
583
|
get(e) {
|
|
584
584
|
return z(this, arguments, function* (t, r = {}) {
|
|
585
585
|
const { overrideBaseAddress: s, overrideDefaultHeaders: a } = r, i = s != null ? s : this.baseAddress;
|
|
586
586
|
let o = a != null ? a : this.headers;
|
|
587
|
-
const
|
|
588
|
-
return
|
|
587
|
+
const c = pt(I(this, se));
|
|
588
|
+
return Y(this, se, {}), c.extraHeaders && (o = ie(ie({}, o), c.extraHeaders)), c.requestValidation && (o = nr(ie({}, o), { "X-Request-Nonce": Jr(), "X-Request-Timestamp": Nn() })), c.async ? yield be(this, ve, Zn).call(this, `${i}${t}`, c.async, { headers: o }) : yield be(this, ve, In).call(this, `${i}${t}`, c, { headers: o });
|
|
589
589
|
});
|
|
590
590
|
}
|
|
591
591
|
post(e, t) {
|
|
592
592
|
return z(this, arguments, function* (r, s, a = {}) {
|
|
593
|
-
const i = pt(I(this,
|
|
594
|
-
return
|
|
593
|
+
const i = pt(I(this, se));
|
|
594
|
+
return Y(this, se, {}), be(this, ve, yt).call(this, r, "POST", s, a, i);
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
put(e, t) {
|
|
598
598
|
return z(this, arguments, function* (r, s, a = {}) {
|
|
599
|
-
const i = pt(I(this,
|
|
600
|
-
return
|
|
599
|
+
const i = pt(I(this, se));
|
|
600
|
+
return Y(this, se, {}), be(this, ve, yt).call(this, r, "PUT", s, a, i);
|
|
601
601
|
});
|
|
602
602
|
}
|
|
603
603
|
delete(e, t) {
|
|
604
604
|
return z(this, arguments, function* (r, s, a = {}) {
|
|
605
|
-
const i = pt(I(this,
|
|
606
|
-
return
|
|
605
|
+
const i = pt(I(this, se));
|
|
606
|
+
return Y(this, se, {}), be(this, ve, yt).call(this, r, "DELETE", s, a, i);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
patch(e, t) {
|
|
610
610
|
return z(this, arguments, function* (r, s, a = {}) {
|
|
611
|
-
const i = pt(I(this,
|
|
612
|
-
return
|
|
611
|
+
const i = pt(I(this, se));
|
|
612
|
+
return Y(this, se, {}), be(this, ve, yt).call(this, r, "PATCH", s, a, i);
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
|
|
616
|
+
Be = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakSet(), In = function(n, e, t) {
|
|
617
617
|
return z(this, null, function* () {
|
|
618
618
|
const r = () => z(this, null, function* () {
|
|
619
|
-
var
|
|
619
|
+
var c, u;
|
|
620
620
|
try {
|
|
621
|
-
return yield I(this,
|
|
621
|
+
return yield I(this, Be).call(this, n, ie(ie({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
622
622
|
} catch (f) {
|
|
623
|
-
throw f instanceof Error && f.name === "AbortError" ? new mt({ canceled: (
|
|
623
|
+
throw f instanceof Error && f.name === "AbortError" ? new mt({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : f;
|
|
624
624
|
}
|
|
625
|
-
}), { headers: s } = t != null ? t : {}, a = (
|
|
625
|
+
}), { headers: s } = t != null ? t : {}, a = (c, u) => {
|
|
626
626
|
var f, p;
|
|
627
|
-
return ((f =
|
|
628
|
-
}, i = (
|
|
629
|
-
var
|
|
630
|
-
if (!
|
|
631
|
-
const p = yield
|
|
627
|
+
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(u)) || ((p = c == null ? void 0 : c.headersObject) == null ? void 0 : p[u]) || "";
|
|
628
|
+
}, i = (c) => z(this, null, function* () {
|
|
629
|
+
var u;
|
|
630
|
+
if (!c.ok) {
|
|
631
|
+
const p = yield c.text().catch();
|
|
632
632
|
throw new Cr({
|
|
633
633
|
url: n,
|
|
634
|
-
method: (
|
|
635
|
-
statusCode:
|
|
634
|
+
method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
|
|
635
|
+
statusCode: c.status,
|
|
636
636
|
requestHeaders: s,
|
|
637
|
-
responseHeaders:
|
|
637
|
+
responseHeaders: c.headers,
|
|
638
638
|
body: p
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
642
642
|
try {
|
|
643
|
-
const p = a(
|
|
643
|
+
const p = a(c, "x-response-nonce"), w = s == null ? void 0 : s["X-Request-Nonce"];
|
|
644
644
|
if (!p || p !== w)
|
|
645
645
|
throw new mn("Response nonce mismatch");
|
|
646
|
-
const _ = Number(a(
|
|
646
|
+
const _ = Number(a(c, "x-response-timestamp")), b = Number(Nn()), m = 60 * 60 * 24;
|
|
647
647
|
if (isNaN(_) || Math.abs(b - _) > m)
|
|
648
648
|
throw new mn("Invalid response timestamp");
|
|
649
649
|
} catch (p) {
|
|
650
650
|
const w = p instanceof Error ? p.message : "Request validation failed";
|
|
651
651
|
throw new mn(w);
|
|
652
652
|
}
|
|
653
|
-
let f = yield
|
|
653
|
+
let f = yield c.text();
|
|
654
654
|
try {
|
|
655
655
|
f = JSON.parse(f);
|
|
656
656
|
} catch (p) {
|
|
@@ -658,11 +658,11 @@ ze = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
658
658
|
return f;
|
|
659
659
|
});
|
|
660
660
|
if (e.retry) {
|
|
661
|
-
const
|
|
661
|
+
const c = yield new Ra({
|
|
662
662
|
maxAttempts: e.retry,
|
|
663
663
|
func: r
|
|
664
664
|
}).run();
|
|
665
|
-
return yield i(
|
|
665
|
+
return yield i(c);
|
|
666
666
|
}
|
|
667
667
|
const o = yield r();
|
|
668
668
|
return yield i(o);
|
|
@@ -674,11 +674,11 @@ ze = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
674
674
|
onProgress: a,
|
|
675
675
|
abortSignal: i,
|
|
676
676
|
pollingInterval: o = () => Ma,
|
|
677
|
-
maxTimeout:
|
|
678
|
-
} = e,
|
|
677
|
+
maxTimeout: c = Pa
|
|
678
|
+
} = e, u = `${n}/async`, f = `${n}/async/job`;
|
|
679
679
|
let p;
|
|
680
680
|
try {
|
|
681
|
-
p = yield I(this,
|
|
681
|
+
p = yield I(this, Be).call(this, u, ie(ie({}, t), i && { signal: i }));
|
|
682
682
|
} catch (b) {
|
|
683
683
|
throw b instanceof Error && b.name === "AbortError" ? new mt({ canceled: (r = i == null ? void 0 : i.aborted) != null ? r : !1 }) : b;
|
|
684
684
|
}
|
|
@@ -699,30 +699,30 @@ ze = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
699
699
|
return new Promise((b, m) => z(this, null, function* () {
|
|
700
700
|
const v = setTimeout(() => {
|
|
701
701
|
m(new Error("Job timed out"));
|
|
702
|
-
},
|
|
702
|
+
}, c), h = (x = 0) => z(this, null, function* () {
|
|
703
703
|
if (i != null && i.aborted) {
|
|
704
|
-
clearTimeout(v), I(this,
|
|
704
|
+
clearTimeout(v), I(this, Be).call(this, `${f}/${_}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
705
705
|
m(new mt({ canceled: !0 }));
|
|
706
|
-
}).catch((
|
|
706
|
+
}).catch((P) => {
|
|
707
707
|
m(new mt({ canceled: !1 }));
|
|
708
708
|
});
|
|
709
709
|
return;
|
|
710
710
|
}
|
|
711
711
|
try {
|
|
712
|
-
const
|
|
713
|
-
if (
|
|
712
|
+
const P = yield (yield I(this, Be).call(this, `${f}/${_}`, { headers: this.headers })).json();
|
|
713
|
+
if (P.status === "success") {
|
|
714
714
|
clearTimeout(v);
|
|
715
|
-
const V =
|
|
715
|
+
const V = P.response_json;
|
|
716
716
|
b(V);
|
|
717
|
-
} else if (
|
|
718
|
-
clearTimeout(v), m(new
|
|
717
|
+
} else if (P.status === "failed")
|
|
718
|
+
clearTimeout(v), m(new La(P.response_json));
|
|
719
719
|
else {
|
|
720
|
-
a && a(
|
|
720
|
+
a && a(P.response_json);
|
|
721
721
|
const V = o(x);
|
|
722
722
|
setTimeout(() => h(x + 1), V);
|
|
723
723
|
}
|
|
724
|
-
} catch (
|
|
725
|
-
m(
|
|
724
|
+
} catch (P) {
|
|
725
|
+
m(P);
|
|
726
726
|
}
|
|
727
727
|
});
|
|
728
728
|
h();
|
|
@@ -731,14 +731,14 @@ ze = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
731
731
|
}, yt = function(n, e, t, r, s) {
|
|
732
732
|
return z(this, null, function* () {
|
|
733
733
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = r, o = a != null ? a : this.baseAddress;
|
|
734
|
-
let
|
|
735
|
-
s.extraHeaders && (
|
|
736
|
-
let
|
|
737
|
-
return typeof FormData != "undefined" && t instanceof FormData ? delete
|
|
734
|
+
let c = i != null ? i : this.headers;
|
|
735
|
+
s.extraHeaders && (c = ie(ie({}, c), s.extraHeaders)), s.requestValidation && (c = nr(ie({}, c), { "X-Request-Nonce": Jr(), "X-Request-Timestamp": Nn() }));
|
|
736
|
+
let u = t;
|
|
737
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (u = r.skipBodyJsonStringify ? t : JSON.stringify(t), s.compress && ja() && (c["Content-Encoding"] = "gzip", u = yield Na(u))), s.async ? yield be(this, ve, Zn).call(this, `${o}${n}`, s.async, {
|
|
738
738
|
method: e,
|
|
739
|
-
headers:
|
|
740
|
-
body:
|
|
741
|
-
}) : yield
|
|
739
|
+
headers: c,
|
|
740
|
+
body: u
|
|
741
|
+
}) : yield be(this, ve, In).call(this, `${o}${n}`, s, { method: e, headers: c, body: u });
|
|
742
742
|
});
|
|
743
743
|
};
|
|
744
744
|
const Rr = (n, e, t, r) => n instanceof mt ? n : new Za({ resource: e, api: String(t), args: r, cause: n }), yn = (n, e) => new Proxy(e, {
|
|
@@ -746,9 +746,9 @@ const Rr = (n, e, t, r) => n instanceof mt ? n : new Za({ resource: e, api: Stri
|
|
|
746
746
|
return (...s) => {
|
|
747
747
|
var a;
|
|
748
748
|
for (const o of n.plugins) {
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
751
|
-
return
|
|
749
|
+
const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api: r, args: s });
|
|
750
|
+
if (c !== void 0)
|
|
751
|
+
return c;
|
|
752
752
|
}
|
|
753
753
|
let i;
|
|
754
754
|
try {
|
|
@@ -765,7 +765,7 @@ const Rr = (n, e, t, r) => n instanceof mt ? n : new Za({ resource: e, api: Stri
|
|
|
765
765
|
var gt;
|
|
766
766
|
class $a {
|
|
767
767
|
constructor(e) {
|
|
768
|
-
le(this, gt), this.resourceName = "Files",
|
|
768
|
+
le(this, gt), this.resourceName = "Files", Y(this, gt, e);
|
|
769
769
|
}
|
|
770
770
|
get(e) {
|
|
771
771
|
return z(this, arguments, function* ({ fileKey: t, params: r = {} }) {
|
|
@@ -788,10 +788,10 @@ const Fa = (n, e, t) => {
|
|
|
788
788
|
const r = e.sort();
|
|
789
789
|
return `${n}-${r.join("-")}-${t}`;
|
|
790
790
|
}, Wa = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
791
|
-
var
|
|
791
|
+
var _e, Ln, Xr;
|
|
792
792
|
class Va {
|
|
793
793
|
constructor(e) {
|
|
794
|
-
le(this,
|
|
794
|
+
le(this, Ln), le(this, _e), this.resourceName = "Images", Y(this, _e, e);
|
|
795
795
|
}
|
|
796
796
|
/**
|
|
797
797
|
* Return the URL for the _layer_ images for the given nodes.
|
|
@@ -799,29 +799,29 @@ class Va {
|
|
|
799
799
|
*/
|
|
800
800
|
get(e) {
|
|
801
801
|
return z(this, arguments, function* ({ fileKey: t, nodeIds: r, format: s = "jpg", scale: a }) {
|
|
802
|
-
const i = Fa(t, r, s), o = I(this,
|
|
802
|
+
const i = Fa(t, r, s), o = I(this, _e).cache.images.entries.get(i);
|
|
803
803
|
if (Wa(o))
|
|
804
804
|
return o.result;
|
|
805
|
-
o && I(this,
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
808
|
-
return
|
|
809
|
-
const
|
|
810
|
-
I(this,
|
|
805
|
+
o && I(this, _e).cache.images.entries.delete(i);
|
|
806
|
+
const c = I(this, _e).cache.images.pendingRequests.get(i);
|
|
807
|
+
if (c)
|
|
808
|
+
return c;
|
|
809
|
+
const u = be(this, Ln, Xr).call(this, i, t, r, s, a);
|
|
810
|
+
I(this, _e).cache.images.pendingRequests.set(i, u);
|
|
811
811
|
try {
|
|
812
|
-
return yield
|
|
812
|
+
return yield u;
|
|
813
813
|
} finally {
|
|
814
|
-
I(this,
|
|
814
|
+
I(this, _e).cache.images.pendingRequests.delete(i);
|
|
815
815
|
}
|
|
816
816
|
});
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
|
-
|
|
819
|
+
_e = /* @__PURE__ */ new WeakMap(), Ln = /* @__PURE__ */ new WeakSet(), Xr = function(n, e, t, r, s) {
|
|
820
820
|
return z(this, null, function* () {
|
|
821
|
-
const a = yield I(this,
|
|
821
|
+
const a = yield I(this, _e).get(
|
|
822
822
|
`v1/images/${e}?ids=${t}&format=${r}${s ? `&scale=${s}` : ""}`
|
|
823
823
|
);
|
|
824
|
-
return I(this,
|
|
824
|
+
return I(this, _e).cache.images.entries.set(n, {
|
|
825
825
|
result: a,
|
|
826
826
|
ts: Date.now()
|
|
827
827
|
}), a;
|
|
@@ -830,7 +830,7 @@ ve = /* @__PURE__ */ new WeakMap(), Pn = /* @__PURE__ */ new WeakSet(), Xr = fun
|
|
|
830
830
|
var Jt;
|
|
831
831
|
class Ua {
|
|
832
832
|
constructor(e) {
|
|
833
|
-
le(this, Jt), this.resourceName = "Nodes",
|
|
833
|
+
le(this, Jt), this.resourceName = "Nodes", Y(this, Jt, e);
|
|
834
834
|
}
|
|
835
835
|
get(e) {
|
|
836
836
|
return z(this, arguments, function* ({ fileKey: t, nodeIds: r, params: s = {} }) {
|
|
@@ -844,13 +844,13 @@ class Ua {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
Jt = /* @__PURE__ */ new WeakMap();
|
|
847
|
-
var
|
|
847
|
+
var Le;
|
|
848
848
|
class Ka extends Da {
|
|
849
849
|
constructor({
|
|
850
850
|
baseAddress: e = "https://api.figma.com/",
|
|
851
851
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
852
852
|
} = {}) {
|
|
853
|
-
super({ fetch: t, baseAddress: e }), le(this,
|
|
853
|
+
super({ fetch: t, baseAddress: e }), le(this, Le, ""), this.cache = {
|
|
854
854
|
images: {
|
|
855
855
|
entries: /* @__PURE__ */ new Map(),
|
|
856
856
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
@@ -860,20 +860,20 @@ class Ka extends Da {
|
|
|
860
860
|
set token(e) {
|
|
861
861
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
862
862
|
throw new Error("Invalid Figma access token");
|
|
863
|
-
|
|
863
|
+
Y(this, Le, e);
|
|
864
864
|
}
|
|
865
865
|
get token() {
|
|
866
|
-
return I(this,
|
|
866
|
+
return I(this, Le);
|
|
867
867
|
}
|
|
868
868
|
get headers() {
|
|
869
869
|
const e = {
|
|
870
870
|
"Content-Type": "application/json"
|
|
871
871
|
};
|
|
872
|
-
return I(this,
|
|
872
|
+
return I(this, Le).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = I(this, Le) : I(this, Le).startsWith("figu_") && (e.Authorization = `Bearer ${I(this, Le)}`), e;
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
|
-
|
|
876
|
-
const qa = (n) =>
|
|
875
|
+
Le = /* @__PURE__ */ new WeakMap();
|
|
876
|
+
const qa = (n) => xe(void 0, [n], function* ({
|
|
877
877
|
fileKey: e,
|
|
878
878
|
authToken: t,
|
|
879
879
|
figmaRestApi: r = new Ka(),
|
|
@@ -928,10 +928,10 @@ var R;
|
|
|
928
928
|
}
|
|
929
929
|
n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
930
930
|
})(R || (R = {}));
|
|
931
|
-
var
|
|
931
|
+
var Pn;
|
|
932
932
|
(function(n) {
|
|
933
933
|
n.mergeShapes = (e, t) => d(d({}, e), t);
|
|
934
|
-
})(
|
|
934
|
+
})(Pn || (Pn = {}));
|
|
935
935
|
const g = R.arrayToEnum([
|
|
936
936
|
"string",
|
|
937
937
|
"nan",
|
|
@@ -953,7 +953,7 @@ const g = R.arrayToEnum([
|
|
|
953
953
|
"never",
|
|
954
954
|
"map",
|
|
955
955
|
"set"
|
|
956
|
-
]),
|
|
956
|
+
]), je = (n) => {
|
|
957
957
|
switch (typeof n) {
|
|
958
958
|
case "undefined":
|
|
959
959
|
return g.undefined;
|
|
@@ -1019,10 +1019,10 @@ class oe extends Error {
|
|
|
1019
1019
|
else if (i.path.length === 0)
|
|
1020
1020
|
r._errors.push(t(i));
|
|
1021
1021
|
else {
|
|
1022
|
-
let o = r,
|
|
1023
|
-
for (;
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1022
|
+
let o = r, c = 0;
|
|
1023
|
+
for (; c < i.path.length; ) {
|
|
1024
|
+
const u = i.path[c];
|
|
1025
|
+
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++;
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
1028
|
};
|
|
@@ -1125,9 +1125,9 @@ const en = (n) => {
|
|
|
1125
1125
|
message: s.message
|
|
1126
1126
|
});
|
|
1127
1127
|
let o = "";
|
|
1128
|
-
const
|
|
1129
|
-
for (const
|
|
1130
|
-
o =
|
|
1128
|
+
const c = r.filter((u) => !!u).slice().reverse();
|
|
1129
|
+
for (const u of c)
|
|
1130
|
+
o = u(i, { data: e, defaultError: o }).message;
|
|
1131
1131
|
return S(d({}, s), {
|
|
1132
1132
|
path: a,
|
|
1133
1133
|
message: o
|
|
@@ -1151,7 +1151,7 @@ function y(n, e) {
|
|
|
1151
1151
|
});
|
|
1152
1152
|
n.common.issues.push(r);
|
|
1153
1153
|
}
|
|
1154
|
-
class
|
|
1154
|
+
class Q {
|
|
1155
1155
|
constructor() {
|
|
1156
1156
|
this.value = "valid";
|
|
1157
1157
|
}
|
|
@@ -1171,7 +1171,7 @@ class Y {
|
|
|
1171
1171
|
return { status: e.value, value: r };
|
|
1172
1172
|
}
|
|
1173
1173
|
static mergeObjectAsync(e, t) {
|
|
1174
|
-
return
|
|
1174
|
+
return xe(this, null, function* () {
|
|
1175
1175
|
const r = [];
|
|
1176
1176
|
for (const s of t) {
|
|
1177
1177
|
const a = yield s.key, i = yield s.value;
|
|
@@ -1180,7 +1180,7 @@ class Y {
|
|
|
1180
1180
|
value: i
|
|
1181
1181
|
});
|
|
1182
1182
|
}
|
|
1183
|
-
return
|
|
1183
|
+
return Q.mergeObjectSync(e, r);
|
|
1184
1184
|
});
|
|
1185
1185
|
}
|
|
1186
1186
|
static mergeObjectSync(e, t) {
|
|
@@ -1196,7 +1196,7 @@ class Y {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
const O = Object.freeze({
|
|
1198
1198
|
status: "aborted"
|
|
1199
|
-
}), tn = (n) => ({ status: "dirty", value: n }),
|
|
1199
|
+
}), tn = (n) => ({ status: "dirty", value: n }), re = (n) => ({ status: "valid", value: n }), Mn = (n) => n.status === "aborted", Dn = (n) => n.status === "dirty", Je = (n) => n.status === "valid", Et = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
1200
1200
|
function nn(n, e, t, r) {
|
|
1201
1201
|
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");
|
|
1202
1202
|
return e.get(n);
|
|
@@ -1210,7 +1210,7 @@ var k;
|
|
|
1210
1210
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1211
1211
|
})(k || (k = {}));
|
|
1212
1212
|
var vt, _t;
|
|
1213
|
-
class
|
|
1213
|
+
class Ee {
|
|
1214
1214
|
constructor(e, t, r, s) {
|
|
1215
1215
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
|
|
1216
1216
|
}
|
|
@@ -1219,7 +1219,7 @@ class xe {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
const jr = (n, e) => {
|
|
1222
|
-
if (
|
|
1222
|
+
if (Je(e))
|
|
1223
1223
|
return { success: !0, data: e.value };
|
|
1224
1224
|
if (!n.common.issues.length)
|
|
1225
1225
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1240,9 +1240,9 @@ function T(n) {
|
|
|
1240
1240
|
if (e && (t || r))
|
|
1241
1241
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1242
1242
|
return e ? { errorMap: e, description: s } : { errorMap: (a, i) => {
|
|
1243
|
-
var o,
|
|
1244
|
-
const { message:
|
|
1245
|
-
return a.code === "invalid_enum_value" ? { message:
|
|
1243
|
+
var o, c;
|
|
1244
|
+
const { message: u } = n;
|
|
1245
|
+
return a.code === "invalid_enum_value" ? { message: u != null ? u : i.defaultError } : typeof i.data == "undefined" ? { message: (o = u != null ? u : r) !== null && o !== void 0 ? o : i.defaultError } : a.code !== "invalid_type" ? { message: i.defaultError } : { message: (c = u != null ? u : t) !== null && c !== void 0 ? c : i.defaultError };
|
|
1246
1246
|
}, description: s };
|
|
1247
1247
|
}
|
|
1248
1248
|
class A {
|
|
@@ -1250,13 +1250,13 @@ class A {
|
|
|
1250
1250
|
return this._def.description;
|
|
1251
1251
|
}
|
|
1252
1252
|
_getType(e) {
|
|
1253
|
-
return
|
|
1253
|
+
return je(e.data);
|
|
1254
1254
|
}
|
|
1255
1255
|
_getOrReturnCtx(e, t) {
|
|
1256
1256
|
return t || {
|
|
1257
1257
|
common: e.parent.common,
|
|
1258
1258
|
data: e.data,
|
|
1259
|
-
parsedType:
|
|
1259
|
+
parsedType: je(e.data),
|
|
1260
1260
|
schemaErrorMap: this._def.errorMap,
|
|
1261
1261
|
path: e.path,
|
|
1262
1262
|
parent: e.parent
|
|
@@ -1264,11 +1264,11 @@ class A {
|
|
|
1264
1264
|
}
|
|
1265
1265
|
_processInputParams(e) {
|
|
1266
1266
|
return {
|
|
1267
|
-
status: new
|
|
1267
|
+
status: new Q(),
|
|
1268
1268
|
ctx: {
|
|
1269
1269
|
common: e.parent.common,
|
|
1270
1270
|
data: e.data,
|
|
1271
|
-
parsedType:
|
|
1271
|
+
parsedType: je(e.data),
|
|
1272
1272
|
schemaErrorMap: this._def.errorMap,
|
|
1273
1273
|
path: e.path,
|
|
1274
1274
|
parent: e.parent
|
|
@@ -1303,7 +1303,7 @@ class A {
|
|
|
1303
1303
|
schemaErrorMap: this._def.errorMap,
|
|
1304
1304
|
parent: null,
|
|
1305
1305
|
data: e,
|
|
1306
|
-
parsedType:
|
|
1306
|
+
parsedType: je(e)
|
|
1307
1307
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1308
1308
|
return jr(s, a);
|
|
1309
1309
|
}
|
|
@@ -1318,12 +1318,12 @@ class A {
|
|
|
1318
1318
|
schemaErrorMap: this._def.errorMap,
|
|
1319
1319
|
parent: null,
|
|
1320
1320
|
data: e,
|
|
1321
|
-
parsedType:
|
|
1321
|
+
parsedType: je(e)
|
|
1322
1322
|
};
|
|
1323
1323
|
if (!this["~standard"].async)
|
|
1324
1324
|
try {
|
|
1325
1325
|
const a = this._parseSync({ data: e, path: [], parent: s });
|
|
1326
|
-
return
|
|
1326
|
+
return Je(a) ? {
|
|
1327
1327
|
value: a.value
|
|
1328
1328
|
} : {
|
|
1329
1329
|
issues: s.common.issues
|
|
@@ -1334,14 +1334,14 @@ class A {
|
|
|
1334
1334
|
async: !0
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
-
return this._parseAsync({ data: e, path: [], parent: s }).then((a) =>
|
|
1337
|
+
return this._parseAsync({ data: e, path: [], parent: s }).then((a) => Je(a) ? {
|
|
1338
1338
|
value: a.value
|
|
1339
1339
|
} : {
|
|
1340
1340
|
issues: s.common.issues
|
|
1341
1341
|
});
|
|
1342
1342
|
}
|
|
1343
1343
|
parseAsync(e, t) {
|
|
1344
|
-
return
|
|
1344
|
+
return xe(this, null, function* () {
|
|
1345
1345
|
const r = yield this.safeParseAsync(e, t);
|
|
1346
1346
|
if (r.success)
|
|
1347
1347
|
return r.data;
|
|
@@ -1349,7 +1349,7 @@ class A {
|
|
|
1349
1349
|
});
|
|
1350
1350
|
}
|
|
1351
1351
|
safeParseAsync(e, t) {
|
|
1352
|
-
return
|
|
1352
|
+
return xe(this, null, function* () {
|
|
1353
1353
|
const r = {
|
|
1354
1354
|
common: {
|
|
1355
1355
|
issues: [],
|
|
@@ -1360,7 +1360,7 @@ class A {
|
|
|
1360
1360
|
schemaErrorMap: this._def.errorMap,
|
|
1361
1361
|
parent: null,
|
|
1362
1362
|
data: e,
|
|
1363
|
-
parsedType:
|
|
1363
|
+
parsedType: je(e)
|
|
1364
1364
|
}, s = this._parse({ data: e, path: r.path, parent: r }), a = yield Et(s) ? s : Promise.resolve(s);
|
|
1365
1365
|
return jr(r, a);
|
|
1366
1366
|
});
|
|
@@ -1371,7 +1371,7 @@ class A {
|
|
|
1371
1371
|
const i = e(s), o = () => a.addIssue(d({
|
|
1372
1372
|
code: l.custom
|
|
1373
1373
|
}, r(s)));
|
|
1374
|
-
return typeof Promise != "undefined" && i instanceof Promise ? i.then((
|
|
1374
|
+
return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
1375
1375
|
});
|
|
1376
1376
|
}
|
|
1377
1377
|
refinement(e, t) {
|
|
@@ -1395,10 +1395,10 @@ class A {
|
|
|
1395
1395
|
};
|
|
1396
1396
|
}
|
|
1397
1397
|
optional() {
|
|
1398
|
-
return
|
|
1398
|
+
return ke.create(this, this._def);
|
|
1399
1399
|
}
|
|
1400
1400
|
nullable() {
|
|
1401
|
-
return
|
|
1401
|
+
return Ve.create(this, this._def);
|
|
1402
1402
|
}
|
|
1403
1403
|
nullish() {
|
|
1404
1404
|
return this.nullable().optional();
|
|
@@ -1438,7 +1438,7 @@ class A {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
catch(e) {
|
|
1440
1440
|
const t = typeof e == "function" ? e : () => e;
|
|
1441
|
-
return new
|
|
1441
|
+
return new Lt(S(d({}, T(this._def)), {
|
|
1442
1442
|
innerType: this,
|
|
1443
1443
|
catchValue: t,
|
|
1444
1444
|
typeName: E.ZodCatch
|
|
@@ -1454,7 +1454,7 @@ class A {
|
|
|
1454
1454
|
return $t.create(this, e);
|
|
1455
1455
|
}
|
|
1456
1456
|
readonly() {
|
|
1457
|
-
return
|
|
1457
|
+
return Pt.create(this);
|
|
1458
1458
|
}
|
|
1459
1459
|
isOptional() {
|
|
1460
1460
|
return this.safeParse(void 0).success;
|
|
@@ -1465,7 +1465,7 @@ class A {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
const Ga = /^c[^\s-]{8,}$/i, Ja = /^[0-9a-z]+$/, Xa = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ya = /^[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, Qa = /^[a-z0-9_-]{21}$/i, ei = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ti = /^[-+]?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)?)??$/, ni = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ri = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1467
1467
|
let gn;
|
|
1468
|
-
const si = /^(?:(?: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])$/, ai = /^(?:(?: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])$/, ii = /^(([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]))$/, oi = /^(([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])$/,
|
|
1468
|
+
const si = /^(?:(?: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])$/, ai = /^(?:(?: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])$/, ii = /^(([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]))$/, oi = /^(([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])$/, ci = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ui = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, es = "((\\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])))", di = new RegExp(`^${es}$`);
|
|
1469
1469
|
function ts(n) {
|
|
1470
1470
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1471
1471
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
@@ -1504,7 +1504,7 @@ class pe extends A {
|
|
|
1504
1504
|
received: s.parsedType
|
|
1505
1505
|
}), O;
|
|
1506
1506
|
}
|
|
1507
|
-
const t = new
|
|
1507
|
+
const t = new Q();
|
|
1508
1508
|
let r;
|
|
1509
1509
|
for (const s of this._def.checks)
|
|
1510
1510
|
if (s.kind === "min")
|
|
@@ -1638,11 +1638,11 @@ class pe extends A {
|
|
|
1638
1638
|
validation: "cidr",
|
|
1639
1639
|
code: l.invalid_string,
|
|
1640
1640
|
message: s.message
|
|
1641
|
-
}), t.dirty()) : s.kind === "base64" ?
|
|
1641
|
+
}), t.dirty()) : s.kind === "base64" ? ci.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
1642
1642
|
validation: "base64",
|
|
1643
1643
|
code: l.invalid_string,
|
|
1644
1644
|
message: s.message
|
|
1645
|
-
}), t.dirty()) : s.kind === "base64url" ?
|
|
1645
|
+
}), t.dirty()) : s.kind === "base64url" ? ui.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
1646
1646
|
validation: "base64url",
|
|
1647
1647
|
code: l.invalid_string,
|
|
1648
1648
|
message: s.message
|
|
@@ -1869,7 +1869,7 @@ function mi(n, e) {
|
|
|
1869
1869
|
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(".", ""));
|
|
1870
1870
|
return a % i / Math.pow(10, s);
|
|
1871
1871
|
}
|
|
1872
|
-
class
|
|
1872
|
+
class $e extends A {
|
|
1873
1873
|
constructor() {
|
|
1874
1874
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1875
1875
|
}
|
|
@@ -1883,7 +1883,7 @@ class De extends A {
|
|
|
1883
1883
|
}), O;
|
|
1884
1884
|
}
|
|
1885
1885
|
let t;
|
|
1886
|
-
const r = new
|
|
1886
|
+
const r = new Q();
|
|
1887
1887
|
for (const s of this._def.checks)
|
|
1888
1888
|
s.kind === "int" ? R.isInteger(e.data) || (t = this._getOrReturnCtx(e, t), y(t, {
|
|
1889
1889
|
code: l.invalid_type,
|
|
@@ -1927,7 +1927,7 @@ class De extends A {
|
|
|
1927
1927
|
return this.setLimit("max", e, !1, k.toString(t));
|
|
1928
1928
|
}
|
|
1929
1929
|
setLimit(e, t, r, s) {
|
|
1930
|
-
return new
|
|
1930
|
+
return new $e(S(d({}, this._def), {
|
|
1931
1931
|
checks: [
|
|
1932
1932
|
...this._def.checks,
|
|
1933
1933
|
{
|
|
@@ -1940,7 +1940,7 @@ class De extends A {
|
|
|
1940
1940
|
}));
|
|
1941
1941
|
}
|
|
1942
1942
|
_addCheck(e) {
|
|
1943
|
-
return new
|
|
1943
|
+
return new $e(S(d({}, this._def), {
|
|
1944
1944
|
checks: [...this._def.checks, e]
|
|
1945
1945
|
}));
|
|
1946
1946
|
}
|
|
@@ -2033,12 +2033,12 @@ class De extends A {
|
|
|
2033
2033
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
|
-
|
|
2036
|
+
$e.create = (n) => new $e(d({
|
|
2037
2037
|
checks: [],
|
|
2038
2038
|
typeName: E.ZodNumber,
|
|
2039
2039
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
2040
2040
|
}, T(n)));
|
|
2041
|
-
class
|
|
2041
|
+
class Fe extends A {
|
|
2042
2042
|
constructor() {
|
|
2043
2043
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2044
2044
|
}
|
|
@@ -2052,7 +2052,7 @@ class $e extends A {
|
|
|
2052
2052
|
if (this._getType(e) !== g.bigint)
|
|
2053
2053
|
return this._getInvalidInput(e);
|
|
2054
2054
|
let t;
|
|
2055
|
-
const r = new
|
|
2055
|
+
const r = new Q();
|
|
2056
2056
|
for (const s of this._def.checks)
|
|
2057
2057
|
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (t = this._getOrReturnCtx(e, t), y(t, {
|
|
2058
2058
|
code: l.too_small,
|
|
@@ -2094,7 +2094,7 @@ class $e extends A {
|
|
|
2094
2094
|
return this.setLimit("max", e, !1, k.toString(t));
|
|
2095
2095
|
}
|
|
2096
2096
|
setLimit(e, t, r, s) {
|
|
2097
|
-
return new
|
|
2097
|
+
return new Fe(S(d({}, this._def), {
|
|
2098
2098
|
checks: [
|
|
2099
2099
|
...this._def.checks,
|
|
2100
2100
|
{
|
|
@@ -2107,7 +2107,7 @@ class $e extends A {
|
|
|
2107
2107
|
}));
|
|
2108
2108
|
}
|
|
2109
2109
|
_addCheck(e) {
|
|
2110
|
-
return new
|
|
2110
|
+
return new Fe(S(d({}, this._def), {
|
|
2111
2111
|
checks: [...this._def.checks, e]
|
|
2112
2112
|
}));
|
|
2113
2113
|
}
|
|
@@ -2163,9 +2163,9 @@ class $e extends A {
|
|
|
2163
2163
|
return e;
|
|
2164
2164
|
}
|
|
2165
2165
|
}
|
|
2166
|
-
|
|
2166
|
+
Fe.create = (n) => {
|
|
2167
2167
|
var e;
|
|
2168
|
-
return new
|
|
2168
|
+
return new Fe(d({
|
|
2169
2169
|
checks: [],
|
|
2170
2170
|
typeName: E.ZodBigInt,
|
|
2171
2171
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
|
|
@@ -2181,14 +2181,14 @@ class St extends A {
|
|
|
2181
2181
|
received: t.parsedType
|
|
2182
2182
|
}), O;
|
|
2183
2183
|
}
|
|
2184
|
-
return
|
|
2184
|
+
return re(e.data);
|
|
2185
2185
|
}
|
|
2186
2186
|
}
|
|
2187
2187
|
St.create = (n) => new St(d({
|
|
2188
2188
|
typeName: E.ZodBoolean,
|
|
2189
2189
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
2190
2190
|
}, T(n)));
|
|
2191
|
-
class
|
|
2191
|
+
class Xe extends A {
|
|
2192
2192
|
_parse(e) {
|
|
2193
2193
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== g.date) {
|
|
2194
2194
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2204,7 +2204,7 @@ class Je extends A {
|
|
|
2204
2204
|
code: l.invalid_date
|
|
2205
2205
|
}), O;
|
|
2206
2206
|
}
|
|
2207
|
-
const t = new
|
|
2207
|
+
const t = new Q();
|
|
2208
2208
|
let r;
|
|
2209
2209
|
for (const s of this._def.checks)
|
|
2210
2210
|
s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r), y(r, {
|
|
@@ -2228,7 +2228,7 @@ class Je extends A {
|
|
|
2228
2228
|
};
|
|
2229
2229
|
}
|
|
2230
2230
|
_addCheck(e) {
|
|
2231
|
-
return new
|
|
2231
|
+
return new Xe(S(d({}, this._def), {
|
|
2232
2232
|
checks: [...this._def.checks, e]
|
|
2233
2233
|
}));
|
|
2234
2234
|
}
|
|
@@ -2259,7 +2259,7 @@ class Je extends A {
|
|
|
2259
2259
|
return e != null ? new Date(e) : null;
|
|
2260
2260
|
}
|
|
2261
2261
|
}
|
|
2262
|
-
|
|
2262
|
+
Xe.create = (n) => new Xe(d({
|
|
2263
2263
|
checks: [],
|
|
2264
2264
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
2265
2265
|
typeName: E.ZodDate
|
|
@@ -2274,7 +2274,7 @@ class rn extends A {
|
|
|
2274
2274
|
received: t.parsedType
|
|
2275
2275
|
}), O;
|
|
2276
2276
|
}
|
|
2277
|
-
return
|
|
2277
|
+
return re(e.data);
|
|
2278
2278
|
}
|
|
2279
2279
|
}
|
|
2280
2280
|
rn.create = (n) => new rn(d({
|
|
@@ -2290,7 +2290,7 @@ class Ot extends A {
|
|
|
2290
2290
|
received: t.parsedType
|
|
2291
2291
|
}), O;
|
|
2292
2292
|
}
|
|
2293
|
-
return
|
|
2293
|
+
return re(e.data);
|
|
2294
2294
|
}
|
|
2295
2295
|
}
|
|
2296
2296
|
Ot.create = (n) => new Ot(d({
|
|
@@ -2306,7 +2306,7 @@ class Tt extends A {
|
|
|
2306
2306
|
received: t.parsedType
|
|
2307
2307
|
}), O;
|
|
2308
2308
|
}
|
|
2309
|
-
return
|
|
2309
|
+
return re(e.data);
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
2312
|
Tt.create = (n) => new Tt(d({
|
|
@@ -2317,24 +2317,24 @@ class lt extends A {
|
|
|
2317
2317
|
super(...arguments), this._any = !0;
|
|
2318
2318
|
}
|
|
2319
2319
|
_parse(e) {
|
|
2320
|
-
return
|
|
2320
|
+
return re(e.data);
|
|
2321
2321
|
}
|
|
2322
2322
|
}
|
|
2323
2323
|
lt.create = (n) => new lt(d({
|
|
2324
2324
|
typeName: E.ZodAny
|
|
2325
2325
|
}, T(n)));
|
|
2326
|
-
class
|
|
2326
|
+
class Ge extends A {
|
|
2327
2327
|
constructor() {
|
|
2328
2328
|
super(...arguments), this._unknown = !0;
|
|
2329
2329
|
}
|
|
2330
2330
|
_parse(e) {
|
|
2331
|
-
return
|
|
2331
|
+
return re(e.data);
|
|
2332
2332
|
}
|
|
2333
2333
|
}
|
|
2334
|
-
|
|
2334
|
+
Ge.create = (n) => new Ge(d({
|
|
2335
2335
|
typeName: E.ZodUnknown
|
|
2336
2336
|
}, T(n)));
|
|
2337
|
-
class
|
|
2337
|
+
class Ie extends A {
|
|
2338
2338
|
_parse(e) {
|
|
2339
2339
|
const t = this._getOrReturnCtx(e);
|
|
2340
2340
|
return y(t, {
|
|
@@ -2344,7 +2344,7 @@ class Ne extends A {
|
|
|
2344
2344
|
}), O;
|
|
2345
2345
|
}
|
|
2346
2346
|
}
|
|
2347
|
-
|
|
2347
|
+
Ie.create = (n) => new Ie(d({
|
|
2348
2348
|
typeName: E.ZodNever
|
|
2349
2349
|
}, T(n)));
|
|
2350
2350
|
class sn extends A {
|
|
@@ -2357,7 +2357,7 @@ class sn extends A {
|
|
|
2357
2357
|
received: t.parsedType
|
|
2358
2358
|
}), O;
|
|
2359
2359
|
}
|
|
2360
|
-
return
|
|
2360
|
+
return re(e.data);
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
2363
|
sn.create = (n) => new sn(d({
|
|
@@ -2399,9 +2399,9 @@ class me extends A {
|
|
|
2399
2399
|
exact: !1,
|
|
2400
2400
|
message: s.maxLength.message
|
|
2401
2401
|
}), r.dirty()), t.common.async)
|
|
2402
|
-
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new
|
|
2403
|
-
const a = [...t.data].map((i, o) => s.type._parseSync(new
|
|
2404
|
-
return
|
|
2402
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new Ee(t, i, t.path, o)))).then((i) => Q.mergeArray(r, i));
|
|
2403
|
+
const a = [...t.data].map((i, o) => s.type._parseSync(new Ee(t, i, t.path, o)));
|
|
2404
|
+
return Q.mergeArray(r, a);
|
|
2405
2405
|
}
|
|
2406
2406
|
get element() {
|
|
2407
2407
|
return this._def.type;
|
|
@@ -2437,14 +2437,14 @@ function nt(n) {
|
|
|
2437
2437
|
const e = {};
|
|
2438
2438
|
for (const t in n.shape) {
|
|
2439
2439
|
const r = n.shape[t];
|
|
2440
|
-
e[t] =
|
|
2440
|
+
e[t] = ke.create(nt(r));
|
|
2441
2441
|
}
|
|
2442
2442
|
return new U(S(d({}, n._def), {
|
|
2443
2443
|
shape: () => e
|
|
2444
2444
|
}));
|
|
2445
2445
|
} else return n instanceof me ? new me(S(d({}, n._def), {
|
|
2446
2446
|
type: nt(n.element)
|
|
2447
|
-
})) : n instanceof
|
|
2447
|
+
})) : n instanceof ke ? ke.create(nt(n.unwrap())) : n instanceof Ve ? Ve.create(nt(n.unwrap())) : n instanceof Se ? Se.create(n.items.map((e) => nt(e))) : n;
|
|
2448
2448
|
}
|
|
2449
2449
|
class U extends A {
|
|
2450
2450
|
constructor() {
|
|
@@ -2458,66 +2458,66 @@ class U extends A {
|
|
|
2458
2458
|
}
|
|
2459
2459
|
_parse(e) {
|
|
2460
2460
|
if (this._getType(e) !== g.object) {
|
|
2461
|
-
const
|
|
2462
|
-
return y(
|
|
2461
|
+
const c = this._getOrReturnCtx(e);
|
|
2462
|
+
return y(c, {
|
|
2463
2463
|
code: l.invalid_type,
|
|
2464
2464
|
expected: g.object,
|
|
2465
|
-
received:
|
|
2465
|
+
received: c.parsedType
|
|
2466
2466
|
}), O;
|
|
2467
2467
|
}
|
|
2468
2468
|
const { status: t, ctx: r } = this._processInputParams(e), { shape: s, keys: a } = this._getCached(), i = [];
|
|
2469
|
-
if (!(this._def.catchall instanceof
|
|
2470
|
-
for (const
|
|
2471
|
-
a.includes(
|
|
2469
|
+
if (!(this._def.catchall instanceof Ie && this._def.unknownKeys === "strip"))
|
|
2470
|
+
for (const c in r.data)
|
|
2471
|
+
a.includes(c) || i.push(c);
|
|
2472
2472
|
const o = [];
|
|
2473
|
-
for (const
|
|
2474
|
-
const
|
|
2473
|
+
for (const c of a) {
|
|
2474
|
+
const u = s[c], f = r.data[c];
|
|
2475
2475
|
o.push({
|
|
2476
|
-
key: { status: "valid", value:
|
|
2477
|
-
value:
|
|
2478
|
-
alwaysSet:
|
|
2476
|
+
key: { status: "valid", value: c },
|
|
2477
|
+
value: u._parse(new Ee(r, f, r.path, c)),
|
|
2478
|
+
alwaysSet: c in r.data
|
|
2479
2479
|
});
|
|
2480
2480
|
}
|
|
2481
|
-
if (this._def.catchall instanceof
|
|
2482
|
-
const
|
|
2483
|
-
if (
|
|
2484
|
-
for (const
|
|
2481
|
+
if (this._def.catchall instanceof Ie) {
|
|
2482
|
+
const c = this._def.unknownKeys;
|
|
2483
|
+
if (c === "passthrough")
|
|
2484
|
+
for (const u of i)
|
|
2485
2485
|
o.push({
|
|
2486
|
-
key: { status: "valid", value:
|
|
2487
|
-
value: { status: "valid", value: r.data[
|
|
2486
|
+
key: { status: "valid", value: u },
|
|
2487
|
+
value: { status: "valid", value: r.data[u] }
|
|
2488
2488
|
});
|
|
2489
|
-
else if (
|
|
2489
|
+
else if (c === "strict")
|
|
2490
2490
|
i.length > 0 && (y(r, {
|
|
2491
2491
|
code: l.unrecognized_keys,
|
|
2492
2492
|
keys: i
|
|
2493
2493
|
}), t.dirty());
|
|
2494
|
-
else if (
|
|
2494
|
+
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2495
2495
|
} else {
|
|
2496
|
-
const
|
|
2497
|
-
for (const
|
|
2498
|
-
const f = r.data[
|
|
2496
|
+
const c = this._def.catchall;
|
|
2497
|
+
for (const u of i) {
|
|
2498
|
+
const f = r.data[u];
|
|
2499
2499
|
o.push({
|
|
2500
|
-
key: { status: "valid", value:
|
|
2501
|
-
value:
|
|
2502
|
-
new
|
|
2500
|
+
key: { status: "valid", value: u },
|
|
2501
|
+
value: c._parse(
|
|
2502
|
+
new Ee(r, f, r.path, u)
|
|
2503
2503
|
//, ctx.child(key), value, getParsedType(value)
|
|
2504
2504
|
),
|
|
2505
|
-
alwaysSet:
|
|
2505
|
+
alwaysSet: u in r.data
|
|
2506
2506
|
});
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
|
-
return r.common.async ? Promise.resolve().then(() =>
|
|
2510
|
-
const
|
|
2511
|
-
for (const
|
|
2512
|
-
const f = yield
|
|
2513
|
-
|
|
2509
|
+
return r.common.async ? Promise.resolve().then(() => xe(this, null, function* () {
|
|
2510
|
+
const c = [];
|
|
2511
|
+
for (const u of o) {
|
|
2512
|
+
const f = yield u.key, p = yield u.value;
|
|
2513
|
+
c.push({
|
|
2514
2514
|
key: f,
|
|
2515
2515
|
value: p,
|
|
2516
|
-
alwaysSet:
|
|
2516
|
+
alwaysSet: u.alwaysSet
|
|
2517
2517
|
});
|
|
2518
2518
|
}
|
|
2519
|
-
return
|
|
2520
|
-
})).then((
|
|
2519
|
+
return c;
|
|
2520
|
+
})).then((c) => Q.mergeObjectSync(t, c)) : Q.mergeObjectSync(t, o);
|
|
2521
2521
|
}
|
|
2522
2522
|
get shape() {
|
|
2523
2523
|
return this._def.shape();
|
|
@@ -2528,11 +2528,11 @@ class U extends A {
|
|
|
2528
2528
|
}), e !== void 0 ? {
|
|
2529
2529
|
errorMap: (t, r) => {
|
|
2530
2530
|
var s, a, i, o;
|
|
2531
|
-
const
|
|
2531
|
+
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;
|
|
2532
2532
|
return t.code === "unrecognized_keys" ? {
|
|
2533
|
-
message: (o = k.errToObj(e).message) !== null && o !== void 0 ? o :
|
|
2533
|
+
message: (o = k.errToObj(e).message) !== null && o !== void 0 ? o : c
|
|
2534
2534
|
} : {
|
|
2535
|
-
message:
|
|
2535
|
+
message: c
|
|
2536
2536
|
};
|
|
2537
2537
|
}
|
|
2538
2538
|
} : {}));
|
|
@@ -2684,7 +2684,7 @@ class U extends A {
|
|
|
2684
2684
|
t[r] = this.shape[r];
|
|
2685
2685
|
else {
|
|
2686
2686
|
let s = this.shape[r];
|
|
2687
|
-
for (; s instanceof
|
|
2687
|
+
for (; s instanceof ke; )
|
|
2688
2688
|
s = s._def.innerType;
|
|
2689
2689
|
t[r] = s;
|
|
2690
2690
|
}
|
|
@@ -2699,19 +2699,19 @@ class U extends A {
|
|
|
2699
2699
|
U.create = (n, e) => new U(d({
|
|
2700
2700
|
shape: () => n,
|
|
2701
2701
|
unknownKeys: "strip",
|
|
2702
|
-
catchall:
|
|
2702
|
+
catchall: Ie.create(),
|
|
2703
2703
|
typeName: E.ZodObject
|
|
2704
2704
|
}, T(e)));
|
|
2705
2705
|
U.strictCreate = (n, e) => new U(d({
|
|
2706
2706
|
shape: () => n,
|
|
2707
2707
|
unknownKeys: "strict",
|
|
2708
|
-
catchall:
|
|
2708
|
+
catchall: Ie.create(),
|
|
2709
2709
|
typeName: E.ZodObject
|
|
2710
2710
|
}, T(e)));
|
|
2711
2711
|
U.lazycreate = (n, e) => new U(d({
|
|
2712
2712
|
shape: n,
|
|
2713
2713
|
unknownKeys: "strip",
|
|
2714
|
-
catchall:
|
|
2714
|
+
catchall: Ie.create(),
|
|
2715
2715
|
typeName: E.ZodObject
|
|
2716
2716
|
}, T(e)));
|
|
2717
2717
|
class At extends A {
|
|
@@ -2731,7 +2731,7 @@ class At extends A {
|
|
|
2731
2731
|
}), O;
|
|
2732
2732
|
}
|
|
2733
2733
|
if (t.common.async)
|
|
2734
|
-
return Promise.all(r.map((a) =>
|
|
2734
|
+
return Promise.all(r.map((a) => xe(this, null, function* () {
|
|
2735
2735
|
const i = S(d({}, t), {
|
|
2736
2736
|
common: S(d({}, t.common), {
|
|
2737
2737
|
issues: []
|
|
@@ -2750,24 +2750,24 @@ class At extends A {
|
|
|
2750
2750
|
{
|
|
2751
2751
|
let a;
|
|
2752
2752
|
const i = [];
|
|
2753
|
-
for (const
|
|
2754
|
-
const
|
|
2753
|
+
for (const c of r) {
|
|
2754
|
+
const u = S(d({}, t), {
|
|
2755
2755
|
common: S(d({}, t.common), {
|
|
2756
2756
|
issues: []
|
|
2757
2757
|
}),
|
|
2758
2758
|
parent: null
|
|
2759
|
-
}), f =
|
|
2759
|
+
}), f = c._parseSync({
|
|
2760
2760
|
data: t.data,
|
|
2761
2761
|
path: t.path,
|
|
2762
|
-
parent:
|
|
2762
|
+
parent: u
|
|
2763
2763
|
});
|
|
2764
2764
|
if (f.status === "valid")
|
|
2765
2765
|
return f;
|
|
2766
|
-
f.status === "dirty" && !a && (a = { result: f, ctx:
|
|
2766
|
+
f.status === "dirty" && !a && (a = { result: f, ctx: u }), u.common.issues.length && i.push(u.common.issues);
|
|
2767
2767
|
}
|
|
2768
2768
|
if (a)
|
|
2769
2769
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2770
|
-
const o = i.map((
|
|
2770
|
+
const o = i.map((c) => new oe(c));
|
|
2771
2771
|
return y(t, {
|
|
2772
2772
|
code: l.invalid_union,
|
|
2773
2773
|
unionErrors: o
|
|
@@ -2782,8 +2782,8 @@ At.create = (n, e) => new At(d({
|
|
|
2782
2782
|
options: n,
|
|
2783
2783
|
typeName: E.ZodUnion
|
|
2784
2784
|
}, T(e)));
|
|
2785
|
-
const Pe = (n) => n instanceof jt ? Pe(n.schema) : n instanceof ye ? Pe(n.innerType()) : n instanceof Nt ? [n.value] : n instanceof
|
|
2786
|
-
class
|
|
2785
|
+
const Pe = (n) => n instanceof jt ? Pe(n.schema) : n instanceof ye ? Pe(n.innerType()) : n instanceof Nt ? [n.value] : n instanceof We ? n.options : n instanceof It ? R.objectValues(n.enum) : n instanceof Zt ? Pe(n._def.innerType) : n instanceof Ot ? [void 0] : n instanceof Tt ? [null] : n instanceof ke ? [void 0, ...Pe(n.unwrap())] : n instanceof Ve ? [null, ...Pe(n.unwrap())] : n instanceof ar || n instanceof Pt ? Pe(n.unwrap()) : n instanceof Lt ? Pe(n._def.innerType) : [];
|
|
2786
|
+
class un extends A {
|
|
2787
2787
|
_parse(e) {
|
|
2788
2788
|
const { ctx: t } = this._processInputParams(e);
|
|
2789
2789
|
if (t.parsedType !== g.object)
|
|
@@ -2836,7 +2836,7 @@ class cn extends A {
|
|
|
2836
2836
|
s.set(o, a);
|
|
2837
2837
|
}
|
|
2838
2838
|
}
|
|
2839
|
-
return new
|
|
2839
|
+
return new un(d({
|
|
2840
2840
|
typeName: E.ZodDiscriminatedUnion,
|
|
2841
2841
|
discriminator: e,
|
|
2842
2842
|
options: t,
|
|
@@ -2845,16 +2845,16 @@ class cn extends A {
|
|
|
2845
2845
|
}
|
|
2846
2846
|
}
|
|
2847
2847
|
function $n(n, e) {
|
|
2848
|
-
const t =
|
|
2848
|
+
const t = je(n), r = je(e);
|
|
2849
2849
|
if (n === e)
|
|
2850
2850
|
return { valid: !0, data: n };
|
|
2851
2851
|
if (t === g.object && r === g.object) {
|
|
2852
2852
|
const s = R.objectKeys(e), a = R.objectKeys(n).filter((o) => s.indexOf(o) !== -1), i = d(d({}, n), e);
|
|
2853
2853
|
for (const o of a) {
|
|
2854
|
-
const
|
|
2855
|
-
if (!
|
|
2854
|
+
const c = $n(n[o], e[o]);
|
|
2855
|
+
if (!c.valid)
|
|
2856
2856
|
return { valid: !1 };
|
|
2857
|
-
i[o] =
|
|
2857
|
+
i[o] = c.data;
|
|
2858
2858
|
}
|
|
2859
2859
|
return { valid: !0, data: i };
|
|
2860
2860
|
} else if (t === g.array && r === g.array) {
|
|
@@ -2862,10 +2862,10 @@ function $n(n, e) {
|
|
|
2862
2862
|
return { valid: !1 };
|
|
2863
2863
|
const s = [];
|
|
2864
2864
|
for (let a = 0; a < n.length; a++) {
|
|
2865
|
-
const i = n[a], o = e[a],
|
|
2866
|
-
if (!
|
|
2865
|
+
const i = n[a], o = e[a], c = $n(i, o);
|
|
2866
|
+
if (!c.valid)
|
|
2867
2867
|
return { valid: !1 };
|
|
2868
|
-
s.push(
|
|
2868
|
+
s.push(c.data);
|
|
2869
2869
|
}
|
|
2870
2870
|
return { valid: !0, data: s };
|
|
2871
2871
|
} else return t === g.date && r === g.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
@@ -2907,7 +2907,7 @@ Ct.create = (n, e, t) => new Ct(d({
|
|
|
2907
2907
|
right: e,
|
|
2908
2908
|
typeName: E.ZodIntersection
|
|
2909
2909
|
}, T(t)));
|
|
2910
|
-
class
|
|
2910
|
+
class Se extends A {
|
|
2911
2911
|
_parse(e) {
|
|
2912
2912
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2913
2913
|
if (r.parsedType !== g.array)
|
|
@@ -2933,23 +2933,23 @@ class Ee extends A {
|
|
|
2933
2933
|
}), t.dirty());
|
|
2934
2934
|
const s = [...r.data].map((a, i) => {
|
|
2935
2935
|
const o = this._def.items[i] || this._def.rest;
|
|
2936
|
-
return o ? o._parse(new
|
|
2936
|
+
return o ? o._parse(new Ee(r, a, r.path, i)) : null;
|
|
2937
2937
|
}).filter((a) => !!a);
|
|
2938
|
-
return r.common.async ? Promise.all(s).then((a) =>
|
|
2938
|
+
return r.common.async ? Promise.all(s).then((a) => Q.mergeArray(t, a)) : Q.mergeArray(t, s);
|
|
2939
2939
|
}
|
|
2940
2940
|
get items() {
|
|
2941
2941
|
return this._def.items;
|
|
2942
2942
|
}
|
|
2943
2943
|
rest(e) {
|
|
2944
|
-
return new
|
|
2944
|
+
return new Se(S(d({}, this._def), {
|
|
2945
2945
|
rest: e
|
|
2946
2946
|
}));
|
|
2947
2947
|
}
|
|
2948
2948
|
}
|
|
2949
|
-
|
|
2949
|
+
Se.create = (n, e) => {
|
|
2950
2950
|
if (!Array.isArray(n))
|
|
2951
2951
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2952
|
-
return new
|
|
2952
|
+
return new Se(d({
|
|
2953
2953
|
items: n,
|
|
2954
2954
|
typeName: E.ZodTuple,
|
|
2955
2955
|
rest: null
|
|
@@ -2973,11 +2973,11 @@ class Rt extends A {
|
|
|
2973
2973
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2974
2974
|
for (const o in r.data)
|
|
2975
2975
|
s.push({
|
|
2976
|
-
key: a._parse(new
|
|
2977
|
-
value: i._parse(new
|
|
2976
|
+
key: a._parse(new Ee(r, o, r.path, o)),
|
|
2977
|
+
value: i._parse(new Ee(r, r.data[o], r.path, o)),
|
|
2978
2978
|
alwaysSet: o in r.data
|
|
2979
2979
|
});
|
|
2980
|
-
return r.common.async ?
|
|
2980
|
+
return r.common.async ? Q.mergeObjectAsync(t, s) : Q.mergeObjectSync(t, s);
|
|
2981
2981
|
}
|
|
2982
2982
|
get element() {
|
|
2983
2983
|
return this._def.valueType;
|
|
@@ -3009,28 +3009,28 @@ class an extends A {
|
|
|
3009
3009
|
expected: g.map,
|
|
3010
3010
|
received: r.parsedType
|
|
3011
3011
|
}), O;
|
|
3012
|
-
const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o,
|
|
3013
|
-
key: s._parse(new
|
|
3014
|
-
value: a._parse(new
|
|
3012
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], u) => ({
|
|
3013
|
+
key: s._parse(new Ee(r, o, r.path, [u, "key"])),
|
|
3014
|
+
value: a._parse(new Ee(r, c, r.path, [u, "value"]))
|
|
3015
3015
|
}));
|
|
3016
3016
|
if (r.common.async) {
|
|
3017
3017
|
const o = /* @__PURE__ */ new Map();
|
|
3018
|
-
return Promise.resolve().then(() =>
|
|
3019
|
-
for (const
|
|
3020
|
-
const
|
|
3021
|
-
if (
|
|
3018
|
+
return Promise.resolve().then(() => xe(this, null, function* () {
|
|
3019
|
+
for (const c of i) {
|
|
3020
|
+
const u = yield c.key, f = yield c.value;
|
|
3021
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
3022
3022
|
return O;
|
|
3023
|
-
(
|
|
3023
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
3024
3024
|
}
|
|
3025
3025
|
return { status: t.value, value: o };
|
|
3026
3026
|
}));
|
|
3027
3027
|
} else {
|
|
3028
3028
|
const o = /* @__PURE__ */ new Map();
|
|
3029
|
-
for (const
|
|
3030
|
-
const
|
|
3031
|
-
if (
|
|
3029
|
+
for (const c of i) {
|
|
3030
|
+
const u = c.key, f = c.value;
|
|
3031
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
3032
3032
|
return O;
|
|
3033
|
-
(
|
|
3033
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
3034
3034
|
}
|
|
3035
3035
|
return { status: t.value, value: o };
|
|
3036
3036
|
}
|
|
@@ -3041,7 +3041,7 @@ an.create = (n, e, t) => new an(d({
|
|
|
3041
3041
|
keyType: n,
|
|
3042
3042
|
typeName: E.ZodMap
|
|
3043
3043
|
}, T(t)));
|
|
3044
|
-
class
|
|
3044
|
+
class Ye extends A {
|
|
3045
3045
|
_parse(e) {
|
|
3046
3046
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
3047
3047
|
if (r.parsedType !== g.set)
|
|
@@ -3067,25 +3067,25 @@ class Xe extends A {
|
|
|
3067
3067
|
message: s.maxSize.message
|
|
3068
3068
|
}), t.dirty());
|
|
3069
3069
|
const a = this._def.valueType;
|
|
3070
|
-
function i(
|
|
3071
|
-
const
|
|
3072
|
-
for (const f of
|
|
3070
|
+
function i(c) {
|
|
3071
|
+
const u = /* @__PURE__ */ new Set();
|
|
3072
|
+
for (const f of c) {
|
|
3073
3073
|
if (f.status === "aborted")
|
|
3074
3074
|
return O;
|
|
3075
|
-
f.status === "dirty" && t.dirty(),
|
|
3075
|
+
f.status === "dirty" && t.dirty(), u.add(f.value);
|
|
3076
3076
|
}
|
|
3077
|
-
return { status: t.value, value:
|
|
3077
|
+
return { status: t.value, value: u };
|
|
3078
3078
|
}
|
|
3079
|
-
const o = [...r.data.values()].map((
|
|
3080
|
-
return r.common.async ? Promise.all(o).then((
|
|
3079
|
+
const o = [...r.data.values()].map((c, u) => a._parse(new Ee(r, c, r.path, u)));
|
|
3080
|
+
return r.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3081
3081
|
}
|
|
3082
3082
|
min(e, t) {
|
|
3083
|
-
return new
|
|
3083
|
+
return new Ye(S(d({}, this._def), {
|
|
3084
3084
|
minSize: { value: e, message: k.toString(t) }
|
|
3085
3085
|
}));
|
|
3086
3086
|
}
|
|
3087
3087
|
max(e, t) {
|
|
3088
|
-
return new
|
|
3088
|
+
return new Ye(S(d({}, this._def), {
|
|
3089
3089
|
maxSize: { value: e, message: k.toString(t) }
|
|
3090
3090
|
}));
|
|
3091
3091
|
}
|
|
@@ -3096,7 +3096,7 @@ class Xe extends A {
|
|
|
3096
3096
|
return this.min(1, e);
|
|
3097
3097
|
}
|
|
3098
3098
|
}
|
|
3099
|
-
|
|
3099
|
+
Ye.create = (n, e) => new Ye(d({
|
|
3100
3100
|
valueType: n,
|
|
3101
3101
|
minSize: null,
|
|
3102
3102
|
maxSize: null,
|
|
@@ -3114,7 +3114,7 @@ class ot extends A {
|
|
|
3114
3114
|
expected: g.function,
|
|
3115
3115
|
received: t.parsedType
|
|
3116
3116
|
}), O;
|
|
3117
|
-
function r(o,
|
|
3117
|
+
function r(o, c) {
|
|
3118
3118
|
return en({
|
|
3119
3119
|
data: o,
|
|
3120
3120
|
path: t.path,
|
|
@@ -3123,14 +3123,14 @@ class ot extends A {
|
|
|
3123
3123
|
t.schemaErrorMap,
|
|
3124
3124
|
Qt(),
|
|
3125
3125
|
dt
|
|
3126
|
-
].filter((
|
|
3126
|
+
].filter((u) => !!u),
|
|
3127
3127
|
issueData: {
|
|
3128
3128
|
code: l.invalid_arguments,
|
|
3129
|
-
argumentsError:
|
|
3129
|
+
argumentsError: c
|
|
3130
3130
|
}
|
|
3131
3131
|
});
|
|
3132
3132
|
}
|
|
3133
|
-
function s(o,
|
|
3133
|
+
function s(o, c) {
|
|
3134
3134
|
return en({
|
|
3135
3135
|
data: o,
|
|
3136
3136
|
path: t.path,
|
|
@@ -3139,33 +3139,33 @@ class ot extends A {
|
|
|
3139
3139
|
t.schemaErrorMap,
|
|
3140
3140
|
Qt(),
|
|
3141
3141
|
dt
|
|
3142
|
-
].filter((
|
|
3142
|
+
].filter((u) => !!u),
|
|
3143
3143
|
issueData: {
|
|
3144
3144
|
code: l.invalid_return_type,
|
|
3145
|
-
returnTypeError:
|
|
3145
|
+
returnTypeError: c
|
|
3146
3146
|
}
|
|
3147
3147
|
});
|
|
3148
3148
|
}
|
|
3149
3149
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
3150
3150
|
if (this._def.returns instanceof ht) {
|
|
3151
3151
|
const o = this;
|
|
3152
|
-
return
|
|
3153
|
-
return
|
|
3154
|
-
const
|
|
3155
|
-
throw
|
|
3152
|
+
return re(function(...c) {
|
|
3153
|
+
return xe(this, null, function* () {
|
|
3154
|
+
const u = new oe([]), f = yield o._def.args.parseAsync(c, a).catch((w) => {
|
|
3155
|
+
throw u.addIssue(r(c, w)), u;
|
|
3156
3156
|
}), p = yield Reflect.apply(i, this, f);
|
|
3157
3157
|
return yield o._def.returns._def.type.parseAsync(p, a).catch((w) => {
|
|
3158
|
-
throw
|
|
3158
|
+
throw u.addIssue(s(p, w)), u;
|
|
3159
3159
|
});
|
|
3160
3160
|
});
|
|
3161
3161
|
});
|
|
3162
3162
|
} else {
|
|
3163
3163
|
const o = this;
|
|
3164
|
-
return
|
|
3165
|
-
const
|
|
3166
|
-
if (!
|
|
3167
|
-
throw new oe([r(
|
|
3168
|
-
const f = Reflect.apply(i, this,
|
|
3164
|
+
return re(function(...c) {
|
|
3165
|
+
const u = o._def.args.safeParse(c, a);
|
|
3166
|
+
if (!u.success)
|
|
3167
|
+
throw new oe([r(c, u.error)]);
|
|
3168
|
+
const f = Reflect.apply(i, this, u.data), p = o._def.returns.safeParse(f, a);
|
|
3169
3169
|
if (!p.success)
|
|
3170
3170
|
throw new oe([s(f, p.error)]);
|
|
3171
3171
|
return p.data;
|
|
@@ -3180,7 +3180,7 @@ class ot extends A {
|
|
|
3180
3180
|
}
|
|
3181
3181
|
args(...e) {
|
|
3182
3182
|
return new ot(S(d({}, this._def), {
|
|
3183
|
-
args:
|
|
3183
|
+
args: Se.create(e).rest(Ge.create())
|
|
3184
3184
|
}));
|
|
3185
3185
|
}
|
|
3186
3186
|
returns(e) {
|
|
@@ -3196,8 +3196,8 @@ class ot extends A {
|
|
|
3196
3196
|
}
|
|
3197
3197
|
static create(e, t, r) {
|
|
3198
3198
|
return new ot(d({
|
|
3199
|
-
args: e ||
|
|
3200
|
-
returns: t ||
|
|
3199
|
+
args: e || Se.create([]).rest(Ge.create()),
|
|
3200
|
+
returns: t || Ge.create(),
|
|
3201
3201
|
typeName: E.ZodFunction
|
|
3202
3202
|
}, T(r)));
|
|
3203
3203
|
}
|
|
@@ -3236,12 +3236,12 @@ Nt.create = (n, e) => new Nt(d({
|
|
|
3236
3236
|
typeName: E.ZodLiteral
|
|
3237
3237
|
}, T(e)));
|
|
3238
3238
|
function rs(n, e) {
|
|
3239
|
-
return new
|
|
3239
|
+
return new We(d({
|
|
3240
3240
|
values: n,
|
|
3241
3241
|
typeName: E.ZodEnum
|
|
3242
3242
|
}, T(e)));
|
|
3243
3243
|
}
|
|
3244
|
-
class
|
|
3244
|
+
class We extends A {
|
|
3245
3245
|
constructor() {
|
|
3246
3246
|
super(...arguments), vt.set(this, void 0);
|
|
3247
3247
|
}
|
|
@@ -3262,7 +3262,7 @@ class Fe extends A {
|
|
|
3262
3262
|
options: r
|
|
3263
3263
|
}), O;
|
|
3264
3264
|
}
|
|
3265
|
-
return
|
|
3265
|
+
return re(e.data);
|
|
3266
3266
|
}
|
|
3267
3267
|
get options() {
|
|
3268
3268
|
return this._def.values;
|
|
@@ -3286,14 +3286,14 @@ class Fe extends A {
|
|
|
3286
3286
|
return e;
|
|
3287
3287
|
}
|
|
3288
3288
|
extract(e, t = this._def) {
|
|
3289
|
-
return
|
|
3289
|
+
return We.create(e, d(d({}, this._def), t));
|
|
3290
3290
|
}
|
|
3291
3291
|
exclude(e, t = this._def) {
|
|
3292
|
-
return
|
|
3292
|
+
return We.create(this.options.filter((r) => !e.includes(r)), d(d({}, this._def), t));
|
|
3293
3293
|
}
|
|
3294
3294
|
}
|
|
3295
3295
|
vt = /* @__PURE__ */ new WeakMap();
|
|
3296
|
-
|
|
3296
|
+
We.create = rs;
|
|
3297
3297
|
class It extends A {
|
|
3298
3298
|
constructor() {
|
|
3299
3299
|
super(...arguments), _t.set(this, void 0);
|
|
@@ -3316,7 +3316,7 @@ class It extends A {
|
|
|
3316
3316
|
options: s
|
|
3317
3317
|
}), O;
|
|
3318
3318
|
}
|
|
3319
|
-
return
|
|
3319
|
+
return re(e.data);
|
|
3320
3320
|
}
|
|
3321
3321
|
get enum() {
|
|
3322
3322
|
return this._def.values;
|
|
@@ -3340,7 +3340,7 @@ class ht extends A {
|
|
|
3340
3340
|
received: t.parsedType
|
|
3341
3341
|
}), O;
|
|
3342
3342
|
const r = t.parsedType === g.promise ? t.data : Promise.resolve(t.data);
|
|
3343
|
-
return
|
|
3343
|
+
return re(r.then((s) => this._def.type.parseAsync(s, {
|
|
3344
3344
|
path: t.path,
|
|
3345
3345
|
errorMap: t.common.contextualErrorMap
|
|
3346
3346
|
})));
|
|
@@ -3369,15 +3369,15 @@ class ye extends A {
|
|
|
3369
3369
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
3370
3370
|
const i = s.transform(r.data, a);
|
|
3371
3371
|
if (r.common.async)
|
|
3372
|
-
return Promise.resolve(i).then((o) =>
|
|
3372
|
+
return Promise.resolve(i).then((o) => xe(this, null, function* () {
|
|
3373
3373
|
if (t.value === "aborted")
|
|
3374
3374
|
return O;
|
|
3375
|
-
const
|
|
3375
|
+
const c = yield this._def.schema._parseAsync({
|
|
3376
3376
|
data: o,
|
|
3377
3377
|
path: r.path,
|
|
3378
3378
|
parent: r
|
|
3379
3379
|
});
|
|
3380
|
-
return
|
|
3380
|
+
return c.status === "aborted" ? O : c.status === "dirty" || t.value === "dirty" ? tn(c.value) : c;
|
|
3381
3381
|
}));
|
|
3382
3382
|
{
|
|
3383
3383
|
if (t.value === "aborted")
|
|
@@ -3392,10 +3392,10 @@ class ye extends A {
|
|
|
3392
3392
|
}
|
|
3393
3393
|
if (s.type === "refinement") {
|
|
3394
3394
|
const i = (o) => {
|
|
3395
|
-
const
|
|
3395
|
+
const c = s.refinement(o, a);
|
|
3396
3396
|
if (r.common.async)
|
|
3397
|
-
return Promise.resolve(
|
|
3398
|
-
if (
|
|
3397
|
+
return Promise.resolve(c);
|
|
3398
|
+
if (c instanceof Promise)
|
|
3399
3399
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3400
3400
|
return o;
|
|
3401
3401
|
};
|
|
@@ -3416,14 +3416,14 @@ class ye extends A {
|
|
|
3416
3416
|
path: r.path,
|
|
3417
3417
|
parent: r
|
|
3418
3418
|
});
|
|
3419
|
-
if (!
|
|
3419
|
+
if (!Je(i))
|
|
3420
3420
|
return i;
|
|
3421
3421
|
const o = s.transform(i.value, a);
|
|
3422
3422
|
if (o instanceof Promise)
|
|
3423
3423
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3424
3424
|
return { status: t.value, value: o };
|
|
3425
3425
|
} else
|
|
3426
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) =>
|
|
3426
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => Je(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
3427
3427
|
R.assertNever(s);
|
|
3428
3428
|
}
|
|
3429
3429
|
}
|
|
@@ -3437,27 +3437,27 @@ ye.createWithPreprocess = (n, e, t) => new ye(d({
|
|
|
3437
3437
|
effect: { type: "preprocess", transform: n },
|
|
3438
3438
|
typeName: E.ZodEffects
|
|
3439
3439
|
}, T(t)));
|
|
3440
|
-
class
|
|
3440
|
+
class ke extends A {
|
|
3441
3441
|
_parse(e) {
|
|
3442
|
-
return this._getType(e) === g.undefined ?
|
|
3442
|
+
return this._getType(e) === g.undefined ? re(void 0) : this._def.innerType._parse(e);
|
|
3443
3443
|
}
|
|
3444
3444
|
unwrap() {
|
|
3445
3445
|
return this._def.innerType;
|
|
3446
3446
|
}
|
|
3447
3447
|
}
|
|
3448
|
-
|
|
3448
|
+
ke.create = (n, e) => new ke(d({
|
|
3449
3449
|
innerType: n,
|
|
3450
3450
|
typeName: E.ZodOptional
|
|
3451
3451
|
}, T(e)));
|
|
3452
|
-
class
|
|
3452
|
+
class Ve extends A {
|
|
3453
3453
|
_parse(e) {
|
|
3454
|
-
return this._getType(e) === g.null ?
|
|
3454
|
+
return this._getType(e) === g.null ? re(null) : this._def.innerType._parse(e);
|
|
3455
3455
|
}
|
|
3456
3456
|
unwrap() {
|
|
3457
3457
|
return this._def.innerType;
|
|
3458
3458
|
}
|
|
3459
3459
|
}
|
|
3460
|
-
|
|
3460
|
+
Ve.create = (n, e) => new Ve(d({
|
|
3461
3461
|
innerType: n,
|
|
3462
3462
|
typeName: E.ZodNullable
|
|
3463
3463
|
}, T(e)));
|
|
@@ -3480,7 +3480,7 @@ Zt.create = (n, e) => new Zt(d({
|
|
|
3480
3480
|
typeName: E.ZodDefault,
|
|
3481
3481
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3482
3482
|
}, T(e)));
|
|
3483
|
-
class
|
|
3483
|
+
class Lt extends A {
|
|
3484
3484
|
_parse(e) {
|
|
3485
3485
|
const { ctx: t } = this._processInputParams(e), r = S(d({}, t), {
|
|
3486
3486
|
common: S(d({}, t.common), {
|
|
@@ -3513,7 +3513,7 @@ class Pt extends A {
|
|
|
3513
3513
|
return this._def.innerType;
|
|
3514
3514
|
}
|
|
3515
3515
|
}
|
|
3516
|
-
|
|
3516
|
+
Lt.create = (n, e) => new Lt(d({
|
|
3517
3517
|
innerType: n,
|
|
3518
3518
|
typeName: E.ZodCatch,
|
|
3519
3519
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
@@ -3552,7 +3552,7 @@ class $t extends A {
|
|
|
3552
3552
|
_parse(e) {
|
|
3553
3553
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
3554
3554
|
if (r.common.async)
|
|
3555
|
-
return
|
|
3555
|
+
return xe(this, null, function* () {
|
|
3556
3556
|
const s = yield this._def.in._parseAsync({
|
|
3557
3557
|
data: r.data,
|
|
3558
3558
|
path: r.path,
|
|
@@ -3588,16 +3588,16 @@ class $t extends A {
|
|
|
3588
3588
|
});
|
|
3589
3589
|
}
|
|
3590
3590
|
}
|
|
3591
|
-
class
|
|
3591
|
+
class Pt extends A {
|
|
3592
3592
|
_parse(e) {
|
|
3593
|
-
const t = this._def.innerType._parse(e), r = (s) => (
|
|
3593
|
+
const t = this._def.innerType._parse(e), r = (s) => (Je(s) && (s.value = Object.freeze(s.value)), s);
|
|
3594
3594
|
return Et(t) ? t.then((s) => r(s)) : r(t);
|
|
3595
3595
|
}
|
|
3596
3596
|
unwrap() {
|
|
3597
3597
|
return this._def.innerType;
|
|
3598
3598
|
}
|
|
3599
3599
|
}
|
|
3600
|
-
|
|
3600
|
+
Pt.create = (n, e) => new Pt(d({
|
|
3601
3601
|
innerType: n,
|
|
3602
3602
|
typeName: E.ZodReadonly
|
|
3603
3603
|
}, T(e)));
|
|
@@ -3610,16 +3610,16 @@ function ss(n, e = {}, t) {
|
|
|
3610
3610
|
var a, i;
|
|
3611
3611
|
const o = n(r);
|
|
3612
3612
|
if (o instanceof Promise)
|
|
3613
|
-
return o.then((
|
|
3614
|
-
var
|
|
3615
|
-
if (!
|
|
3616
|
-
const p = Nr(e, r), w = (f = (
|
|
3613
|
+
return o.then((c) => {
|
|
3614
|
+
var u, f;
|
|
3615
|
+
if (!c) {
|
|
3616
|
+
const p = Nr(e, r), w = (f = (u = p.fatal) !== null && u !== void 0 ? u : t) !== null && f !== void 0 ? f : !0;
|
|
3617
3617
|
s.addIssue(S(d({ code: "custom" }, p), { fatal: w }));
|
|
3618
3618
|
}
|
|
3619
3619
|
});
|
|
3620
3620
|
if (!o) {
|
|
3621
|
-
const
|
|
3622
|
-
s.addIssue(S(d({ code: "custom" },
|
|
3621
|
+
const c = Nr(e, r), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3622
|
+
s.addIssue(S(d({ code: "custom" }, c), { fatal: u }));
|
|
3623
3623
|
}
|
|
3624
3624
|
}) : lt.create();
|
|
3625
3625
|
}
|
|
@@ -3632,14 +3632,14 @@ var E;
|
|
|
3632
3632
|
})(E || (E = {}));
|
|
3633
3633
|
const vi = (n, e = {
|
|
3634
3634
|
message: `Input not instance of ${n.name}`
|
|
3635
|
-
}) => ss((t) => t instanceof n, e), as = pe.create, is =
|
|
3635
|
+
}) => ss((t) => t instanceof n, e), as = pe.create, is = $e.create, _i = on.create, bi = Fe.create, os = St.create, wi = Xe.create, ki = rn.create, xi = Ot.create, Ei = Tt.create, Si = lt.create, Oi = Ge.create, Ti = Ie.create, Ai = sn.create, Ci = me.create, Ri = U.create, ji = U.strictCreate, Ni = At.create, Ii = un.create, Zi = Ct.create, Li = Se.create, Pi = Rt.create, Mi = an.create, Di = Ye.create, $i = ot.create, Fi = jt.create, Wi = Nt.create, Vi = We.create, Ui = It.create, Ki = ht.create, Ir = ye.create, qi = ke.create, zi = Ve.create, Bi = ye.createWithPreprocess, Hi = $t.create, Gi = () => as().optional(), Ji = () => is().optional(), Xi = () => os().optional(), Yi = {
|
|
3636
3636
|
string: (n) => pe.create(S(d({}, n), { coerce: !0 })),
|
|
3637
|
-
number: (n) =>
|
|
3637
|
+
number: (n) => $e.create(S(d({}, n), { coerce: !0 })),
|
|
3638
3638
|
boolean: (n) => St.create(S(d({}, n), {
|
|
3639
3639
|
coerce: !0
|
|
3640
3640
|
})),
|
|
3641
|
-
bigint: (n) =>
|
|
3642
|
-
date: (n) =>
|
|
3641
|
+
bigint: (n) => Fe.create(S(d({}, n), { coerce: !0 })),
|
|
3642
|
+
date: (n) => Xe.create(S(d({}, n), { coerce: !0 }))
|
|
3643
3643
|
}, Qi = O;
|
|
3644
3644
|
var N = /* @__PURE__ */ Object.freeze({
|
|
3645
3645
|
__proto__: null,
|
|
@@ -3649,62 +3649,62 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3649
3649
|
makeIssue: en,
|
|
3650
3650
|
EMPTY_PATH: Ha,
|
|
3651
3651
|
addIssueToContext: y,
|
|
3652
|
-
ParseStatus:
|
|
3652
|
+
ParseStatus: Q,
|
|
3653
3653
|
INVALID: O,
|
|
3654
3654
|
DIRTY: tn,
|
|
3655
|
-
OK:
|
|
3655
|
+
OK: re,
|
|
3656
3656
|
isAborted: Mn,
|
|
3657
3657
|
isDirty: Dn,
|
|
3658
|
-
isValid:
|
|
3658
|
+
isValid: Je,
|
|
3659
3659
|
isAsync: Et,
|
|
3660
3660
|
get util() {
|
|
3661
3661
|
return R;
|
|
3662
3662
|
},
|
|
3663
3663
|
get objectUtil() {
|
|
3664
|
-
return
|
|
3664
|
+
return Pn;
|
|
3665
3665
|
},
|
|
3666
3666
|
ZodParsedType: g,
|
|
3667
|
-
getParsedType:
|
|
3667
|
+
getParsedType: je,
|
|
3668
3668
|
ZodType: A,
|
|
3669
3669
|
datetimeRegex: ns,
|
|
3670
3670
|
ZodString: pe,
|
|
3671
|
-
ZodNumber:
|
|
3672
|
-
ZodBigInt:
|
|
3671
|
+
ZodNumber: $e,
|
|
3672
|
+
ZodBigInt: Fe,
|
|
3673
3673
|
ZodBoolean: St,
|
|
3674
|
-
ZodDate:
|
|
3674
|
+
ZodDate: Xe,
|
|
3675
3675
|
ZodSymbol: rn,
|
|
3676
3676
|
ZodUndefined: Ot,
|
|
3677
3677
|
ZodNull: Tt,
|
|
3678
3678
|
ZodAny: lt,
|
|
3679
|
-
ZodUnknown:
|
|
3680
|
-
ZodNever:
|
|
3679
|
+
ZodUnknown: Ge,
|
|
3680
|
+
ZodNever: Ie,
|
|
3681
3681
|
ZodVoid: sn,
|
|
3682
3682
|
ZodArray: me,
|
|
3683
3683
|
ZodObject: U,
|
|
3684
3684
|
ZodUnion: At,
|
|
3685
|
-
ZodDiscriminatedUnion:
|
|
3685
|
+
ZodDiscriminatedUnion: un,
|
|
3686
3686
|
ZodIntersection: Ct,
|
|
3687
|
-
ZodTuple:
|
|
3687
|
+
ZodTuple: Se,
|
|
3688
3688
|
ZodRecord: Rt,
|
|
3689
3689
|
ZodMap: an,
|
|
3690
|
-
ZodSet:
|
|
3690
|
+
ZodSet: Ye,
|
|
3691
3691
|
ZodFunction: ot,
|
|
3692
3692
|
ZodLazy: jt,
|
|
3693
3693
|
ZodLiteral: Nt,
|
|
3694
|
-
ZodEnum:
|
|
3694
|
+
ZodEnum: We,
|
|
3695
3695
|
ZodNativeEnum: It,
|
|
3696
3696
|
ZodPromise: ht,
|
|
3697
3697
|
ZodEffects: ye,
|
|
3698
3698
|
ZodTransformer: ye,
|
|
3699
|
-
ZodOptional:
|
|
3700
|
-
ZodNullable:
|
|
3699
|
+
ZodOptional: ke,
|
|
3700
|
+
ZodNullable: Ve,
|
|
3701
3701
|
ZodDefault: Zt,
|
|
3702
|
-
ZodCatch:
|
|
3702
|
+
ZodCatch: Lt,
|
|
3703
3703
|
ZodNaN: on,
|
|
3704
3704
|
BRAND: yi,
|
|
3705
3705
|
ZodBranded: ar,
|
|
3706
3706
|
ZodPipeline: $t,
|
|
3707
|
-
ZodReadonly:
|
|
3707
|
+
ZodReadonly: Pt,
|
|
3708
3708
|
custom: ss,
|
|
3709
3709
|
Schema: A,
|
|
3710
3710
|
ZodSchema: A,
|
|
@@ -3741,13 +3741,13 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3741
3741
|
pipeline: Hi,
|
|
3742
3742
|
preprocess: Bi,
|
|
3743
3743
|
promise: Ki,
|
|
3744
|
-
record:
|
|
3744
|
+
record: Pi,
|
|
3745
3745
|
set: Di,
|
|
3746
3746
|
strictObject: ji,
|
|
3747
3747
|
string: as,
|
|
3748
3748
|
symbol: ki,
|
|
3749
3749
|
transformer: Ir,
|
|
3750
|
-
tuple:
|
|
3750
|
+
tuple: Li,
|
|
3751
3751
|
undefined: xi,
|
|
3752
3752
|
union: Ni,
|
|
3753
3753
|
unknown: Oi,
|
|
@@ -3814,11 +3814,11 @@ function eo(n) {
|
|
|
3814
3814
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
3815
3815
|
);
|
|
3816
3816
|
const { onEvent: e = vn, onError: t = vn, onRetry: r = vn, onComment: s } = n;
|
|
3817
|
-
let a = "", i = !0, o,
|
|
3817
|
+
let a = "", i = !0, o, c = "", u = "";
|
|
3818
3818
|
function f(m) {
|
|
3819
3819
|
const v = i ? m.replace(/^\xEF\xBB\xBF/, "") : m, [h, x] = to(`${a}${v}`);
|
|
3820
|
-
for (const
|
|
3821
|
-
p(
|
|
3820
|
+
for (const P of h)
|
|
3821
|
+
p(P);
|
|
3822
3822
|
a = x, i = !1;
|
|
3823
3823
|
}
|
|
3824
3824
|
function p(m) {
|
|
@@ -3832,8 +3832,8 @@ function eo(n) {
|
|
|
3832
3832
|
}
|
|
3833
3833
|
const v = m.indexOf(":");
|
|
3834
3834
|
if (v !== -1) {
|
|
3835
|
-
const h = m.slice(0, v), x = m[v + 1] === " " ? 2 : 1,
|
|
3836
|
-
w(h,
|
|
3835
|
+
const h = m.slice(0, v), x = m[v + 1] === " " ? 2 : 1, P = m.slice(v + x);
|
|
3836
|
+
w(h, P, m);
|
|
3837
3837
|
return;
|
|
3838
3838
|
}
|
|
3839
3839
|
w(m, "", m);
|
|
@@ -3841,10 +3841,10 @@ function eo(n) {
|
|
|
3841
3841
|
function w(m, v, h) {
|
|
3842
3842
|
switch (m) {
|
|
3843
3843
|
case "event":
|
|
3844
|
-
|
|
3844
|
+
u = v;
|
|
3845
3845
|
break;
|
|
3846
3846
|
case "data":
|
|
3847
|
-
|
|
3847
|
+
c = `${c}${v}
|
|
3848
3848
|
`;
|
|
3849
3849
|
break;
|
|
3850
3850
|
case "id":
|
|
@@ -3870,17 +3870,17 @@ function eo(n) {
|
|
|
3870
3870
|
}
|
|
3871
3871
|
}
|
|
3872
3872
|
function _() {
|
|
3873
|
-
|
|
3873
|
+
c.length > 0 && e({
|
|
3874
3874
|
id: o,
|
|
3875
|
-
event:
|
|
3875
|
+
event: u || void 0,
|
|
3876
3876
|
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
3877
3877
|
// then remove the last character from the data buffer.
|
|
3878
|
-
data:
|
|
3879
|
-
`) ?
|
|
3880
|
-
}), o = void 0,
|
|
3878
|
+
data: c.endsWith(`
|
|
3879
|
+
`) ? c.slice(0, -1) : c
|
|
3880
|
+
}), o = void 0, c = "", u = "";
|
|
3881
3881
|
}
|
|
3882
3882
|
function b(m = {}) {
|
|
3883
|
-
a && m.consume && p(a), i = !0, o = void 0,
|
|
3883
|
+
a && m.consume && p(a), i = !0, o = void 0, c = "", u = "", a = "";
|
|
3884
3884
|
}
|
|
3885
3885
|
return { feed: f, reset: b };
|
|
3886
3886
|
}
|
|
@@ -3902,7 +3902,7 @@ function to(n) {
|
|
|
3902
3902
|
}
|
|
3903
3903
|
return [e, t];
|
|
3904
3904
|
}
|
|
3905
|
-
class
|
|
3905
|
+
class Lr extends Event {
|
|
3906
3906
|
/**
|
|
3907
3907
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
3908
3908
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -3927,7 +3927,7 @@ class Pr extends Event {
|
|
|
3927
3927
|
* @returns A string representation of the error
|
|
3928
3928
|
*/
|
|
3929
3929
|
[Symbol.for("nodejs.util.inspect.custom")](e, t, r) {
|
|
3930
|
-
return r(
|
|
3930
|
+
return r(Pr(this), t);
|
|
3931
3931
|
}
|
|
3932
3932
|
/**
|
|
3933
3933
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -3941,7 +3941,7 @@ class Pr extends Event {
|
|
|
3941
3941
|
* @returns A string representation of the error
|
|
3942
3942
|
*/
|
|
3943
3943
|
[Symbol.for("Deno.customInspect")](e, t) {
|
|
3944
|
-
return e(
|
|
3944
|
+
return e(Pr(this), t);
|
|
3945
3945
|
}
|
|
3946
3946
|
}
|
|
3947
3947
|
function no(n) {
|
|
@@ -3951,7 +3951,7 @@ function no(n) {
|
|
|
3951
3951
|
function Fn(n) {
|
|
3952
3952
|
return n instanceof Error ? "errors" in n && Array.isArray(n.errors) ? n.errors.map(Fn).join(", ") : "cause" in n && n.cause instanceof Error ? `${n}: ${Fn(n.cause)}` : n.message : `${n}`;
|
|
3953
3953
|
}
|
|
3954
|
-
function
|
|
3954
|
+
function Pr(n) {
|
|
3955
3955
|
return {
|
|
3956
3956
|
type: n.type,
|
|
3957
3957
|
message: n.message,
|
|
@@ -3961,62 +3961,62 @@ function Lr(n) {
|
|
|
3961
3961
|
timeStamp: n.timeStamp
|
|
3962
3962
|
};
|
|
3963
3963
|
}
|
|
3964
|
-
var
|
|
3964
|
+
var cs = (n) => {
|
|
3965
3965
|
throw TypeError(n);
|
|
3966
|
-
}, ir = (n, e, t) => e.has(n) ||
|
|
3966
|
+
}, ir = (n, e, t) => e.has(n) || cs("Cannot " + t), C = (n, e, t) => (ir(n, e, "read from private field"), t ? t.call(n) : e.get(n)), H = (n, e, t) => e.has(n) ? cs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), W = (n, e, t, r) => (ir(n, e, "write to private field"), e.set(n, t), t), Re = (n, e, t) => (ir(n, e, "access private method"), t), ae, He, rt, Xt, cn, kt, it, xt, Me, st, ct, at, bt, fe, Wn, Vn, Un, Mr, Kn, qn, wt, zn, Bn;
|
|
3967
3967
|
class Yt extends EventTarget {
|
|
3968
3968
|
constructor(e, t) {
|
|
3969
3969
|
var r, s;
|
|
3970
|
-
super(), H(this, fe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, H(this,
|
|
3970
|
+
super(), H(this, fe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, H(this, ae), H(this, He), H(this, rt), H(this, Xt), H(this, cn), H(this, kt), H(this, it), H(this, xt, null), H(this, Me), H(this, st), H(this, ct, null), H(this, at, null), H(this, bt, null), H(this, Vn, (a) => Ze(this, null, function* () {
|
|
3971
3971
|
var i;
|
|
3972
3972
|
C(this, st).reset();
|
|
3973
|
-
const { body: o, redirected:
|
|
3974
|
-
if (
|
|
3975
|
-
|
|
3973
|
+
const { body: o, redirected: c, status: u, headers: f } = a;
|
|
3974
|
+
if (u === 204) {
|
|
3975
|
+
Re(this, fe, wt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
3976
3976
|
return;
|
|
3977
3977
|
}
|
|
3978
|
-
if (
|
|
3979
|
-
|
|
3978
|
+
if (c ? W(this, rt, new URL(a.url)) : W(this, rt, void 0), u !== 200) {
|
|
3979
|
+
Re(this, fe, wt).call(this, `Non-200 status code (${u})`, u);
|
|
3980
3980
|
return;
|
|
3981
3981
|
}
|
|
3982
3982
|
if (!(f.get("content-type") || "").startsWith("text/event-stream")) {
|
|
3983
|
-
|
|
3983
|
+
Re(this, fe, wt).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
3984
3984
|
return;
|
|
3985
3985
|
}
|
|
3986
|
-
if (C(this,
|
|
3986
|
+
if (C(this, ae) === this.CLOSED)
|
|
3987
3987
|
return;
|
|
3988
|
-
W(this,
|
|
3988
|
+
W(this, ae, this.OPEN);
|
|
3989
3989
|
const p = new Event("open");
|
|
3990
3990
|
if ((i = C(this, bt)) == null || i.call(this, p), this.dispatchEvent(p), typeof o != "object" || !o || !("getReader" in o)) {
|
|
3991
|
-
|
|
3991
|
+
Re(this, fe, wt).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
3992
3992
|
return;
|
|
3993
3993
|
}
|
|
3994
3994
|
const w = new TextDecoder(), _ = o.getReader();
|
|
3995
3995
|
let b = !0;
|
|
3996
3996
|
do {
|
|
3997
3997
|
const { done: m, value: v } = yield _.read();
|
|
3998
|
-
v && C(this, st).feed(w.decode(v, { stream: !m })), m && (b = !1, C(this, st).reset(),
|
|
3998
|
+
v && C(this, st).feed(w.decode(v, { stream: !m })), m && (b = !1, C(this, st).reset(), Re(this, fe, zn).call(this));
|
|
3999
3999
|
} while (b);
|
|
4000
4000
|
})), H(this, Un, (a) => {
|
|
4001
|
-
W(this,
|
|
4001
|
+
W(this, Me, void 0), !(a.name === "AbortError" || a.type === "aborted") && Re(this, fe, zn).call(this, Fn(a));
|
|
4002
4002
|
}), H(this, Kn, (a) => {
|
|
4003
4003
|
typeof a.id == "string" && W(this, xt, a.id);
|
|
4004
4004
|
const i = new MessageEvent(a.event || "message", {
|
|
4005
4005
|
data: a.data,
|
|
4006
|
-
origin: C(this, rt) ? C(this, rt).origin : C(this,
|
|
4006
|
+
origin: C(this, rt) ? C(this, rt).origin : C(this, He).origin,
|
|
4007
4007
|
lastEventId: a.id || ""
|
|
4008
4008
|
});
|
|
4009
4009
|
C(this, at) && (!a.event || a.event === "message") && C(this, at).call(this, i), this.dispatchEvent(i);
|
|
4010
4010
|
}), H(this, qn, (a) => {
|
|
4011
4011
|
W(this, kt, a);
|
|
4012
4012
|
}), H(this, Bn, () => {
|
|
4013
|
-
W(this, it, void 0), C(this,
|
|
4013
|
+
W(this, it, void 0), C(this, ae) === this.CONNECTING && Re(this, fe, Wn).call(this);
|
|
4014
4014
|
});
|
|
4015
4015
|
try {
|
|
4016
4016
|
if (e instanceof URL)
|
|
4017
|
-
W(this,
|
|
4017
|
+
W(this, He, e);
|
|
4018
4018
|
else if (typeof e == "string")
|
|
4019
|
-
W(this,
|
|
4019
|
+
W(this, He, new URL(e, ro()));
|
|
4020
4020
|
else
|
|
4021
4021
|
throw new Error("Invalid URL");
|
|
4022
4022
|
} catch (a) {
|
|
@@ -4025,7 +4025,7 @@ class Yt extends EventTarget {
|
|
|
4025
4025
|
W(this, st, eo({
|
|
4026
4026
|
onEvent: C(this, Kn),
|
|
4027
4027
|
onRetry: C(this, qn)
|
|
4028
|
-
})), W(this,
|
|
4028
|
+
})), W(this, ae, this.CONNECTING), W(this, kt, 3e3), W(this, cn, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), W(this, Xt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Re(this, fe, Wn).call(this);
|
|
4029
4029
|
}
|
|
4030
4030
|
/**
|
|
4031
4031
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -4038,7 +4038,7 @@ class Yt extends EventTarget {
|
|
|
4038
4038
|
* @public
|
|
4039
4039
|
*/
|
|
4040
4040
|
get readyState() {
|
|
4041
|
-
return C(this,
|
|
4041
|
+
return C(this, ae);
|
|
4042
4042
|
}
|
|
4043
4043
|
/**
|
|
4044
4044
|
* Returns the URL providing the event stream.
|
|
@@ -4048,7 +4048,7 @@ class Yt extends EventTarget {
|
|
|
4048
4048
|
* @public
|
|
4049
4049
|
*/
|
|
4050
4050
|
get url() {
|
|
4051
|
-
return C(this,
|
|
4051
|
+
return C(this, He).href;
|
|
4052
4052
|
}
|
|
4053
4053
|
/**
|
|
4054
4054
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -4060,10 +4060,10 @@ class Yt extends EventTarget {
|
|
|
4060
4060
|
}
|
|
4061
4061
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
4062
4062
|
get onerror() {
|
|
4063
|
-
return C(this,
|
|
4063
|
+
return C(this, ct);
|
|
4064
4064
|
}
|
|
4065
4065
|
set onerror(e) {
|
|
4066
|
-
W(this,
|
|
4066
|
+
W(this, ct, e);
|
|
4067
4067
|
}
|
|
4068
4068
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
4069
4069
|
get onmessage() {
|
|
@@ -4095,16 +4095,16 @@ class Yt extends EventTarget {
|
|
|
4095
4095
|
* @public
|
|
4096
4096
|
*/
|
|
4097
4097
|
close() {
|
|
4098
|
-
C(this, it) && clearTimeout(C(this, it)), C(this,
|
|
4098
|
+
C(this, it) && clearTimeout(C(this, it)), C(this, ae) !== this.CLOSED && (C(this, Me) && C(this, Me).abort(), W(this, ae, this.CLOSED), W(this, Me, void 0));
|
|
4099
4099
|
}
|
|
4100
4100
|
}
|
|
4101
|
-
|
|
4101
|
+
ae = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakMap(), cn = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakMap(), Me = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), ct = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakSet(), /**
|
|
4102
4102
|
* Connect to the given URL and start receiving events
|
|
4103
4103
|
*
|
|
4104
4104
|
* @internal
|
|
4105
4105
|
*/
|
|
4106
4106
|
Wn = function() {
|
|
4107
|
-
W(this,
|
|
4107
|
+
W(this, ae, this.CONNECTING), W(this, Me, new AbortController()), C(this, cn)(C(this, He), Re(this, fe, Mr).call(this)).then(C(this, Vn)).catch(C(this, Un));
|
|
4108
4108
|
}, Vn = /* @__PURE__ */ new WeakMap(), Un = /* @__PURE__ */ new WeakMap(), /**
|
|
4109
4109
|
* Get request options for the `fetch()` request
|
|
4110
4110
|
*
|
|
@@ -4120,7 +4120,7 @@ Mr = function() {
|
|
|
4120
4120
|
redirect: "follow",
|
|
4121
4121
|
headers: B({ Accept: "text/event-stream" }, C(this, xt) ? { "Last-Event-ID": C(this, xt) } : void 0),
|
|
4122
4122
|
cache: "no-store",
|
|
4123
|
-
signal: (n = C(this,
|
|
4123
|
+
signal: (n = C(this, Me)) == null ? void 0 : n.signal
|
|
4124
4124
|
};
|
|
4125
4125
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
4126
4126
|
}, Kn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -4132,9 +4132,9 @@ Mr = function() {
|
|
|
4132
4132
|
*/
|
|
4133
4133
|
wt = function(n, e) {
|
|
4134
4134
|
var t;
|
|
4135
|
-
C(this,
|
|
4136
|
-
const r = new
|
|
4137
|
-
(t = C(this,
|
|
4135
|
+
C(this, ae) !== this.CLOSED && W(this, ae, this.CLOSED);
|
|
4136
|
+
const r = new Lr("error", { code: e, message: n });
|
|
4137
|
+
(t = C(this, ct)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
4138
4138
|
}, /**
|
|
4139
4139
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
4140
4140
|
*
|
|
@@ -4144,11 +4144,11 @@ wt = function(n, e) {
|
|
|
4144
4144
|
*/
|
|
4145
4145
|
zn = function(n, e) {
|
|
4146
4146
|
var t;
|
|
4147
|
-
if (C(this,
|
|
4147
|
+
if (C(this, ae) === this.CLOSED)
|
|
4148
4148
|
return;
|
|
4149
|
-
W(this,
|
|
4150
|
-
const r = new
|
|
4151
|
-
(t = C(this,
|
|
4149
|
+
W(this, ae, this.CONNECTING);
|
|
4150
|
+
const r = new Lr("error", { code: e, message: n });
|
|
4151
|
+
(t = C(this, ct)) == null || t.call(this, r), this.dispatchEvent(r), W(this, it, setTimeout(C(this, Bn), C(this, kt)));
|
|
4152
4152
|
}, Bn = /* @__PURE__ */ new WeakMap(), /**
|
|
4153
4153
|
* ReadyState representing an EventSource currently trying to connect
|
|
4154
4154
|
*
|
|
@@ -4175,7 +4175,7 @@ const so = (n) => {
|
|
|
4175
4175
|
for (let s = 0; s < r; s++)
|
|
4176
4176
|
e += String.fromCharCode(t[s]);
|
|
4177
4177
|
return btoa(e);
|
|
4178
|
-
},
|
|
4178
|
+
}, us = {
|
|
4179
4179
|
status: "idle",
|
|
4180
4180
|
error: null,
|
|
4181
4181
|
result: null,
|
|
@@ -4194,12 +4194,12 @@ const so = (n) => {
|
|
|
4194
4194
|
} : {
|
|
4195
4195
|
filePath: n.filePath.replace(/^\//, ""),
|
|
4196
4196
|
referencePath: n.referencePath === "/" ? "" : n.referencePath
|
|
4197
|
-
}, ao = (n, e, t, r) =>
|
|
4198
|
-
var
|
|
4199
|
-
const s = structuredClone(
|
|
4197
|
+
}, ao = (n, e, t, r) => Ze(void 0, null, function* () {
|
|
4198
|
+
var u, f, p;
|
|
4199
|
+
const s = structuredClone(us);
|
|
4200
4200
|
s.status = "pending", r(B({}, s));
|
|
4201
4201
|
const a = structuredClone(t);
|
|
4202
|
-
if (((
|
|
4202
|
+
if (((u = t.assetsStorage) == null ? void 0 : u.strategy) === "local") {
|
|
4203
4203
|
const { referencePath: w } = $r(
|
|
4204
4204
|
t.assetsStorage
|
|
4205
4205
|
);
|
|
@@ -4214,7 +4214,7 @@ const so = (n) => {
|
|
|
4214
4214
|
method: e,
|
|
4215
4215
|
body: JSON.stringify(t)
|
|
4216
4216
|
})), i)
|
|
4217
|
-
}),
|
|
4217
|
+
}), c = new Promise((w, _) => {
|
|
4218
4218
|
const b = {};
|
|
4219
4219
|
o.addEventListener("start", (v) => {
|
|
4220
4220
|
const h = JSON.parse(v.data);
|
|
@@ -4265,20 +4265,22 @@ const so = (n) => {
|
|
|
4265
4265
|
b.assets = h.payload.assets;
|
|
4266
4266
|
});
|
|
4267
4267
|
let m = 0;
|
|
4268
|
-
o.addEventListener("error", (v) =>
|
|
4269
|
-
var q, M, Z,
|
|
4268
|
+
o.addEventListener("error", (v) => Ze(void 0, null, function* () {
|
|
4269
|
+
var q, M, Z, ce, L, Oe, ge;
|
|
4270
4270
|
const h = yield i;
|
|
4271
4271
|
if (!h.ok) {
|
|
4272
|
-
let
|
|
4272
|
+
let G = "";
|
|
4273
4273
|
try {
|
|
4274
|
-
|
|
4275
|
-
|
|
4274
|
+
G = yield h.text();
|
|
4275
|
+
const ue = JSON.parse(G);
|
|
4276
|
+
(q = ue == null ? void 0 : ue.payload) != null && q.message && (G = ue.payload.message);
|
|
4277
|
+
} catch (ue) {
|
|
4276
4278
|
}
|
|
4277
4279
|
_(
|
|
4278
4280
|
new fn({
|
|
4279
4281
|
name: "Request failed",
|
|
4280
4282
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4281
|
-
reason:
|
|
4283
|
+
reason: G,
|
|
4282
4284
|
status: h.status
|
|
4283
4285
|
})
|
|
4284
4286
|
), o.close();
|
|
@@ -4288,22 +4290,22 @@ const so = (n) => {
|
|
|
4288
4290
|
`Experienced error during code generation (attempt ${m + 1} / ${Dr})`,
|
|
4289
4291
|
v
|
|
4290
4292
|
);
|
|
4291
|
-
let x,
|
|
4293
|
+
let x, P = !1;
|
|
4292
4294
|
if (v instanceof MessageEvent)
|
|
4293
4295
|
try {
|
|
4294
4296
|
x = JSON.parse(v.data);
|
|
4295
|
-
} catch (
|
|
4297
|
+
} catch (G) {
|
|
4296
4298
|
}
|
|
4297
|
-
(((
|
|
4299
|
+
(((M = x == null ? void 0 : x.payload) == null ? void 0 : M.name) === "Task Crashed" || ((Z = x == null ? void 0 : x.payload) == null ? void 0 : Z.name) === "TimeoutError" || ((ce = x == null ? void 0 : x.payload) == null ? void 0 : ce.name) === "Error" || ((L = x == null ? void 0 : x.payload) == null ? void 0 : L.name) === "Unknown error") && (P = !0);
|
|
4298
4300
|
const V = new fn({
|
|
4299
|
-
name: (
|
|
4300
|
-
reason: (
|
|
4301
|
+
name: (Oe = x == null ? void 0 : x.payload.name) != null ? Oe : "Unknown error",
|
|
4302
|
+
reason: (ge = x == null ? void 0 : x.payload.message) != null ? ge : "Unknown",
|
|
4301
4303
|
status: x == null ? void 0 : x.payload.status,
|
|
4302
4304
|
detail: x == null ? void 0 : x.payload.detail
|
|
4303
4305
|
});
|
|
4304
4306
|
m++;
|
|
4305
4307
|
let $ = !1;
|
|
4306
|
-
m > Dr ? (console.error("Experienced too many errors, terminating request"), $ = !0) :
|
|
4308
|
+
m > Dr ? (console.error("Experienced too many errors, terminating request"), $ = !0) : P && (console.error("Experienced unrecoverable error, terminating request"), $ = !0), $ && (s.status = "error", s.error = V, r(B({}, s)), w({
|
|
4307
4309
|
result: null,
|
|
4308
4310
|
error: V
|
|
4309
4311
|
}));
|
|
@@ -4313,11 +4315,11 @@ const so = (n) => {
|
|
|
4313
4315
|
});
|
|
4314
4316
|
});
|
|
4315
4317
|
try {
|
|
4316
|
-
const { result: w, error: _ } = yield
|
|
4318
|
+
const { result: w, error: _ } = yield c, b = structuredClone(w);
|
|
4317
4319
|
if (((f = a.assetsStorage) == null ? void 0 : f.strategy) === "local" && ((p = b == null ? void 0 : b.assets) != null && p.length)) {
|
|
4318
4320
|
const { filePath: m } = $r(
|
|
4319
4321
|
a.assetsStorage
|
|
4320
|
-
), v = b.assets.map((x) =>
|
|
4322
|
+
), v = b.assets.map((x) => Ze(void 0, null, function* () {
|
|
4321
4323
|
const V = yield (yield fetch(x.url)).arrayBuffer();
|
|
4322
4324
|
return {
|
|
4323
4325
|
assetName: x.name,
|
|
@@ -4325,10 +4327,10 @@ const so = (n) => {
|
|
|
4325
4327
|
};
|
|
4326
4328
|
})), h = yield Promise.allSettled(v);
|
|
4327
4329
|
for (const x of h) {
|
|
4328
|
-
const
|
|
4330
|
+
const P = {};
|
|
4329
4331
|
if (x.status === "fulfilled") {
|
|
4330
4332
|
const { assetName: V, base64: $ } = x.value;
|
|
4331
|
-
|
|
4333
|
+
P[V] = $;
|
|
4332
4334
|
const q = m ? `${m}/${V}` : V;
|
|
4333
4335
|
b.files[q] = {
|
|
4334
4336
|
content: $,
|
|
@@ -4345,7 +4347,7 @@ const so = (n) => {
|
|
|
4345
4347
|
url: n,
|
|
4346
4348
|
method: e = "POST"
|
|
4347
4349
|
}) => {
|
|
4348
|
-
const [t, r] = Ts(
|
|
4350
|
+
const [t, r] = Ts(us);
|
|
4349
4351
|
return {
|
|
4350
4352
|
getCode: Bt(
|
|
4351
4353
|
(a) => ao(n, e, a, r),
|
|
@@ -4383,19 +4385,19 @@ function io() {
|
|
|
4383
4385
|
var _ = w(), b = r({ inst: { value: _, getSnapshot: w } }), m = b[0].inst, v = b[1];
|
|
4384
4386
|
return a(
|
|
4385
4387
|
function() {
|
|
4386
|
-
m.value = _, m.getSnapshot = w,
|
|
4388
|
+
m.value = _, m.getSnapshot = w, c(m) && v({ inst: m });
|
|
4387
4389
|
},
|
|
4388
4390
|
[p, _, w]
|
|
4389
4391
|
), s(
|
|
4390
4392
|
function() {
|
|
4391
|
-
return
|
|
4392
|
-
|
|
4393
|
+
return c(m) && v({ inst: m }), p(function() {
|
|
4394
|
+
c(m) && v({ inst: m });
|
|
4393
4395
|
});
|
|
4394
4396
|
},
|
|
4395
4397
|
[p]
|
|
4396
4398
|
), i(_), _;
|
|
4397
4399
|
}
|
|
4398
|
-
function
|
|
4400
|
+
function c(p) {
|
|
4399
4401
|
var w = p.getSnapshot;
|
|
4400
4402
|
p = p.value;
|
|
4401
4403
|
try {
|
|
@@ -4405,10 +4407,10 @@ function io() {
|
|
|
4405
4407
|
return !0;
|
|
4406
4408
|
}
|
|
4407
4409
|
}
|
|
4408
|
-
function
|
|
4410
|
+
function u(p, w) {
|
|
4409
4411
|
return w();
|
|
4410
4412
|
}
|
|
4411
|
-
var f = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ?
|
|
4413
|
+
var f = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? u : o;
|
|
4412
4414
|
return _n.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : f, _n;
|
|
4413
4415
|
}
|
|
4414
4416
|
var bn = {};
|
|
@@ -4442,7 +4444,7 @@ function oo() {
|
|
|
4442
4444
|
inst: { value: m, getSnapshot: b }
|
|
4443
4445
|
});
|
|
4444
4446
|
var h = v[0].inst, x = v[1];
|
|
4445
|
-
return
|
|
4447
|
+
return c(
|
|
4446
4448
|
function() {
|
|
4447
4449
|
h.value = m, h.getSnapshot = b, t(h) && x({ inst: h });
|
|
4448
4450
|
},
|
|
@@ -4454,7 +4456,7 @@ function oo() {
|
|
|
4454
4456
|
});
|
|
4455
4457
|
},
|
|
4456
4458
|
[_]
|
|
4457
|
-
),
|
|
4459
|
+
), u(m), m;
|
|
4458
4460
|
}
|
|
4459
4461
|
function t(_) {
|
|
4460
4462
|
var b = _.getSnapshot;
|
|
@@ -4470,15 +4472,15 @@ function oo() {
|
|
|
4470
4472
|
return b();
|
|
4471
4473
|
}
|
|
4472
4474
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
4473
|
-
var s = Dt, a = typeof Object.is == "function" ? Object.is : n, i = s.useState, o = s.useEffect,
|
|
4475
|
+
var s = Dt, a = typeof Object.is == "function" ? Object.is : n, i = s.useState, o = s.useEffect, c = s.useLayoutEffect, u = s.useDebugValue, f = !1, p = !1, w = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? r : e;
|
|
4474
4476
|
bn.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : w, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
4475
4477
|
}()), bn;
|
|
4476
4478
|
}
|
|
4477
4479
|
var Vr;
|
|
4478
|
-
function
|
|
4480
|
+
function co() {
|
|
4479
4481
|
return Vr || (Vr = 1, process.env.NODE_ENV === "production" ? Kt.exports = io() : Kt.exports = oo()), Kt.exports;
|
|
4480
4482
|
}
|
|
4481
|
-
var
|
|
4483
|
+
var uo = co();
|
|
4482
4484
|
const ds = 0, ls = 1, hs = 2, Ur = 3;
|
|
4483
4485
|
var Kr = Object.prototype.hasOwnProperty;
|
|
4484
4486
|
function Hn(n, e) {
|
|
@@ -4501,12 +4503,12 @@ function Hn(n, e) {
|
|
|
4501
4503
|
}
|
|
4502
4504
|
return n !== n && e !== e;
|
|
4503
4505
|
}
|
|
4504
|
-
const
|
|
4505
|
-
},
|
|
4506
|
+
const Ne = /* @__PURE__ */ new WeakMap(), De = () => {
|
|
4507
|
+
}, ne = (
|
|
4506
4508
|
/*#__NOINLINE__*/
|
|
4507
|
-
|
|
4508
|
-
), Gn = Object, j = (n) => n ===
|
|
4509
|
-
const t =
|
|
4509
|
+
De()
|
|
4510
|
+
), Gn = Object, j = (n) => n === ne, we = (n) => typeof n == "function", Ue = (n, e) => B(B({}, n), e), fs = (n) => we(n.then), wn = {}, qt = {}, or = "undefined", Ft = typeof window != or, Jn = typeof document != or, lo = Ft && "Deno" in window, ho = () => Ft && typeof window.requestAnimationFrame != or, ps = (n, e) => {
|
|
4511
|
+
const t = Ne.get(n);
|
|
4510
4512
|
return [
|
|
4511
4513
|
// Getter
|
|
4512
4514
|
() => !j(e) && n.get(e) || wn,
|
|
@@ -4514,7 +4516,7 @@ const je = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
4514
4516
|
(r) => {
|
|
4515
4517
|
if (!j(e)) {
|
|
4516
4518
|
const s = n.get(e);
|
|
4517
|
-
e in qt || (qt[e] = s), t[5](e,
|
|
4519
|
+
e in qt || (qt[e] = s), t[5](e, Ue(s, r), s || wn);
|
|
4518
4520
|
}
|
|
4519
4521
|
},
|
|
4520
4522
|
// Subscriber
|
|
@@ -4528,8 +4530,8 @@ const fo = () => Xn, [Yn, Qn] = Ft && window.addEventListener ? [
|
|
|
4528
4530
|
window.addEventListener.bind(window),
|
|
4529
4531
|
window.removeEventListener.bind(window)
|
|
4530
4532
|
] : [
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
+
De,
|
|
4534
|
+
De
|
|
4533
4535
|
], po = () => {
|
|
4534
4536
|
const n = Jn && document.visibilityState;
|
|
4535
4537
|
return j(n) || n !== "hidden";
|
|
@@ -4575,8 +4577,8 @@ const er = (n) => {
|
|
|
4575
4577
|
} else
|
|
4576
4578
|
a = t ? n.toJSON() : e == "symbol" ? n.toString() : e == "string" ? JSON.stringify(n) : "" + n;
|
|
4577
4579
|
return a;
|
|
4578
|
-
},
|
|
4579
|
-
if (
|
|
4580
|
+
}, cr = (n) => {
|
|
4581
|
+
if (we(n))
|
|
4580
4582
|
try {
|
|
4581
4583
|
n = n();
|
|
4582
4584
|
} catch (t) {
|
|
@@ -4591,8 +4593,8 @@ const er = (n) => {
|
|
|
4591
4593
|
let wo = 0;
|
|
4592
4594
|
const tr = () => ++wo;
|
|
4593
4595
|
function ms(...n) {
|
|
4594
|
-
return
|
|
4595
|
-
const [e, t, r, s] = n, a =
|
|
4596
|
+
return Ze(this, null, function* () {
|
|
4597
|
+
const [e, t, r, s] = n, a = Ue({
|
|
4596
4598
|
populateCache: !0,
|
|
4597
4599
|
throwOnError: !0
|
|
4598
4600
|
}, typeof s == "boolean" ? {
|
|
@@ -4600,9 +4602,9 @@ function ms(...n) {
|
|
|
4600
4602
|
} : s || {});
|
|
4601
4603
|
let i = a.populateCache;
|
|
4602
4604
|
const o = a.rollbackOnError;
|
|
4603
|
-
let
|
|
4604
|
-
const
|
|
4605
|
-
if (
|
|
4605
|
+
let c = a.optimisticData;
|
|
4606
|
+
const u = (w) => typeof o == "function" ? o(w) : o !== !1, f = a.throwOnError;
|
|
4607
|
+
if (we(t)) {
|
|
4606
4608
|
const w = t, _ = [], b = e.keys();
|
|
4607
4609
|
for (const m of b)
|
|
4608
4610
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -4611,12 +4613,12 @@ function ms(...n) {
|
|
|
4611
4613
|
}
|
|
4612
4614
|
return p(t);
|
|
4613
4615
|
function p(w) {
|
|
4614
|
-
return
|
|
4615
|
-
const [_] =
|
|
4616
|
+
return Ze(this, null, function* () {
|
|
4617
|
+
const [_] = cr(w);
|
|
4616
4618
|
if (!_) return;
|
|
4617
|
-
const [b, m] = ps(e, _), [v, h, x,
|
|
4618
|
-
const
|
|
4619
|
-
return (
|
|
4619
|
+
const [b, m] = ps(e, _), [v, h, x, P] = Ne.get(e), V = () => {
|
|
4620
|
+
const G = v[_];
|
|
4621
|
+
return (we(a.revalidate) ? a.revalidate(b().data, w) : a.revalidate !== !1) && (delete x[_], delete P[_], G && G[0]) ? G[0](hs).then(() => b().data) : b().data;
|
|
4620
4622
|
};
|
|
4621
4623
|
if (n.length < 3)
|
|
4622
4624
|
return V();
|
|
@@ -4626,43 +4628,43 @@ function ms(...n) {
|
|
|
4626
4628
|
M,
|
|
4627
4629
|
0
|
|
4628
4630
|
];
|
|
4629
|
-
const Z = !j(
|
|
4630
|
-
if (Z && (
|
|
4631
|
-
data:
|
|
4632
|
-
_c:
|
|
4633
|
-
})),
|
|
4631
|
+
const Z = !j(c), ce = b(), L = ce.data, Oe = ce._c, ge = j(Oe) ? L : Oe;
|
|
4632
|
+
if (Z && (c = we(c) ? c(ge, L) : c, m({
|
|
4633
|
+
data: c,
|
|
4634
|
+
_c: ge
|
|
4635
|
+
})), we($))
|
|
4634
4636
|
try {
|
|
4635
|
-
$ = $(
|
|
4636
|
-
} catch (
|
|
4637
|
-
q =
|
|
4637
|
+
$ = $(ge);
|
|
4638
|
+
} catch (G) {
|
|
4639
|
+
q = G;
|
|
4638
4640
|
}
|
|
4639
4641
|
if ($ && fs($))
|
|
4640
|
-
if ($ = yield $.catch((
|
|
4641
|
-
q =
|
|
4642
|
+
if ($ = yield $.catch((G) => {
|
|
4643
|
+
q = G;
|
|
4642
4644
|
}), M !== h[_][0]) {
|
|
4643
4645
|
if (q) throw q;
|
|
4644
4646
|
return $;
|
|
4645
|
-
} else q && Z &&
|
|
4646
|
-
data:
|
|
4647
|
-
_c:
|
|
4647
|
+
} else q && Z && u(q) && (i = !0, m({
|
|
4648
|
+
data: ge,
|
|
4649
|
+
_c: ne
|
|
4648
4650
|
}));
|
|
4649
4651
|
if (i && !q)
|
|
4650
|
-
if (
|
|
4651
|
-
const
|
|
4652
|
+
if (we(i)) {
|
|
4653
|
+
const G = i($, ge);
|
|
4652
4654
|
m({
|
|
4653
|
-
data:
|
|
4654
|
-
error:
|
|
4655
|
-
_c:
|
|
4655
|
+
data: G,
|
|
4656
|
+
error: ne,
|
|
4657
|
+
_c: ne
|
|
4656
4658
|
});
|
|
4657
4659
|
} else
|
|
4658
4660
|
m({
|
|
4659
4661
|
data: $,
|
|
4660
|
-
error:
|
|
4661
|
-
_c:
|
|
4662
|
+
error: ne,
|
|
4663
|
+
_c: ne
|
|
4662
4664
|
});
|
|
4663
4665
|
if (h[_][1] = tr(), Promise.resolve(V()).then(() => {
|
|
4664
4666
|
m({
|
|
4665
|
-
_c:
|
|
4667
|
+
_c: ne
|
|
4666
4668
|
});
|
|
4667
4669
|
}), q) {
|
|
4668
4670
|
if (f) throw q;
|
|
@@ -4677,56 +4679,56 @@ const Br = (n, e) => {
|
|
|
4677
4679
|
for (const t in n)
|
|
4678
4680
|
n[t][0] && n[t][0](e);
|
|
4679
4681
|
}, ko = (n, e) => {
|
|
4680
|
-
if (!
|
|
4681
|
-
const t =
|
|
4682
|
-
let a =
|
|
4682
|
+
if (!Ne.has(n)) {
|
|
4683
|
+
const t = Ue(vo, e), r = /* @__PURE__ */ Object.create(null), s = ms.bind(ne, n);
|
|
4684
|
+
let a = De;
|
|
4683
4685
|
const i = /* @__PURE__ */ Object.create(null), o = (f, p) => {
|
|
4684
4686
|
const w = i[f] || [];
|
|
4685
4687
|
return i[f] = w, w.push(p), () => w.splice(w.indexOf(p), 1);
|
|
4686
|
-
},
|
|
4688
|
+
}, c = (f, p, w) => {
|
|
4687
4689
|
n.set(f, p);
|
|
4688
4690
|
const _ = i[f];
|
|
4689
4691
|
if (_)
|
|
4690
4692
|
for (const b of _)
|
|
4691
4693
|
b(p, w);
|
|
4692
|
-
},
|
|
4693
|
-
if (!
|
|
4694
|
+
}, u = () => {
|
|
4695
|
+
if (!Ne.has(n) && (Ne.set(n, [
|
|
4694
4696
|
r,
|
|
4695
4697
|
/* @__PURE__ */ Object.create(null),
|
|
4696
4698
|
/* @__PURE__ */ Object.create(null),
|
|
4697
4699
|
/* @__PURE__ */ Object.create(null),
|
|
4698
4700
|
s,
|
|
4699
|
-
|
|
4701
|
+
c,
|
|
4700
4702
|
o
|
|
4701
4703
|
]), !Mt)) {
|
|
4702
|
-
const f = t.initFocus(setTimeout.bind(
|
|
4704
|
+
const f = t.initFocus(setTimeout.bind(ne, Br.bind(ne, r, ds))), p = t.initReconnect(setTimeout.bind(ne, Br.bind(ne, r, ls)));
|
|
4703
4705
|
a = () => {
|
|
4704
|
-
f && f(), p && p(),
|
|
4706
|
+
f && f(), p && p(), Ne.delete(n);
|
|
4705
4707
|
};
|
|
4706
4708
|
}
|
|
4707
4709
|
};
|
|
4708
|
-
return
|
|
4710
|
+
return u(), [
|
|
4709
4711
|
n,
|
|
4710
4712
|
s,
|
|
4711
|
-
|
|
4713
|
+
u,
|
|
4712
4714
|
a
|
|
4713
4715
|
];
|
|
4714
4716
|
}
|
|
4715
4717
|
return [
|
|
4716
4718
|
n,
|
|
4717
|
-
|
|
4719
|
+
Ne.get(n)[4]
|
|
4718
4720
|
];
|
|
4719
4721
|
}, xo = (n, e, t, r, s) => {
|
|
4720
4722
|
const a = t.errorRetryCount, i = s.retryCount, o = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * t.errorRetryInterval;
|
|
4721
4723
|
!j(a) && i > a || setTimeout(r, o, s);
|
|
4722
|
-
}, Eo = Hn, [ys, So] = ko(/* @__PURE__ */ new Map()), Oo =
|
|
4724
|
+
}, Eo = Hn, [ys, So] = ko(/* @__PURE__ */ new Map()), Oo = Ue(
|
|
4723
4725
|
{
|
|
4724
4726
|
// events
|
|
4725
|
-
onLoadingSlow:
|
|
4726
|
-
onSuccess:
|
|
4727
|
-
onError:
|
|
4727
|
+
onLoadingSlow: De,
|
|
4728
|
+
onSuccess: De,
|
|
4729
|
+
onError: De,
|
|
4728
4730
|
onErrorRetry: xo,
|
|
4729
|
-
onDiscarded:
|
|
4731
|
+
onDiscarded: De,
|
|
4730
4732
|
// switches
|
|
4731
4733
|
revalidateOnFocus: !0,
|
|
4732
4734
|
revalidateOnReconnect: !0,
|
|
@@ -4747,15 +4749,15 @@ const Br = (n, e) => {
|
|
|
4747
4749
|
// use web preset by default
|
|
4748
4750
|
go
|
|
4749
4751
|
), To = (n, e) => {
|
|
4750
|
-
const t =
|
|
4752
|
+
const t = Ue(n, e);
|
|
4751
4753
|
if (e) {
|
|
4752
4754
|
const { use: r, fallback: s } = n, { use: a, fallback: i } = e;
|
|
4753
|
-
r && a && (t.use = r.concat(a)), s && i && (t.fallback =
|
|
4755
|
+
r && a && (t.use = r.concat(a)), s && i && (t.fallback = Ue(s, i));
|
|
4754
4756
|
}
|
|
4755
4757
|
return t;
|
|
4756
4758
|
}, Ao = As({}), Co = "$inf$", gs = Ft && window.__SWR_DEVTOOLS_USE__, Ro = gs ? window.__SWR_DEVTOOLS_USE__ : [], jo = () => {
|
|
4757
4759
|
gs && (window.__SWR_DEVTOOLS_REACT__ = Dt);
|
|
4758
|
-
}, No = (n) =>
|
|
4760
|
+
}, No = (n) => we(n[1]) ? [
|
|
4759
4761
|
n[0],
|
|
4760
4762
|
n[1],
|
|
4761
4763
|
n[2] || {}
|
|
@@ -4763,19 +4765,19 @@ const Br = (n, e) => {
|
|
|
4763
4765
|
n[0],
|
|
4764
4766
|
null,
|
|
4765
4767
|
(n[1] === null ? n[2] : n[1]) || {}
|
|
4766
|
-
], Io = () =>
|
|
4767
|
-
const [i] =
|
|
4768
|
+
], Io = () => Ue(Oo, js(Ao)), Zo = (n) => (e, t, r) => n(e, t && ((...a) => {
|
|
4769
|
+
const [i] = cr(e), [, , , o] = Ne.get(ys);
|
|
4768
4770
|
if (i.startsWith(Co))
|
|
4769
4771
|
return t(...a);
|
|
4770
|
-
const
|
|
4771
|
-
return j(
|
|
4772
|
-
}), r),
|
|
4772
|
+
const c = o[i];
|
|
4773
|
+
return j(c) ? t(...a) : (delete o[i], c);
|
|
4774
|
+
}), r), Lo = Ro.concat(Zo), Po = (n) => function(...t) {
|
|
4773
4775
|
const r = Io(), [s, a, i] = No(t), o = To(r, i);
|
|
4774
|
-
let
|
|
4775
|
-
const { use:
|
|
4776
|
+
let c = n;
|
|
4777
|
+
const { use: u } = o, f = (u || []).concat(Lo);
|
|
4776
4778
|
for (let p = f.length; p--; )
|
|
4777
|
-
|
|
4778
|
-
return
|
|
4779
|
+
c = f[p](c);
|
|
4780
|
+
return c(s, a || o.fetcher || null, o);
|
|
4779
4781
|
}, Mo = (n, e, t) => {
|
|
4780
4782
|
const r = e[n] || (e[n] = []);
|
|
4781
4783
|
return r.push(t), () => {
|
|
@@ -4806,9 +4808,9 @@ const Sn = Dt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
4806
4808
|
}), On = {
|
|
4807
4809
|
dedupe: !0
|
|
4808
4810
|
}, Do = (n, e, t) => {
|
|
4809
|
-
const { cache: r, compare: s, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale:
|
|
4810
|
-
for (const
|
|
4811
|
-
const K =
|
|
4811
|
+
const { cache: r, compare: s, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: f, refreshWhenOffline: p, keepPreviousData: w } = t, [_, b, m, v] = Ne.get(r), [h, x] = cr(n), P = qe(!1), V = qe(!1), $ = qe(h), q = qe(e), M = qe(t), Z = () => M.current, ce = () => Z().isVisible() && Z().isOnline(), [L, Oe, ge, G] = ps(r, h), ue = qe({}).current, Wt = j(i) ? j(t.fallback) ? ne : t.fallback[h] : i, ur = (F, D) => {
|
|
4812
|
+
for (const X in ue) {
|
|
4813
|
+
const K = X;
|
|
4812
4814
|
if (K === "data") {
|
|
4813
4815
|
if (!s(F[K], D[K]) && (!j(F[K]) || !s(Ut, D[K])))
|
|
4814
4816
|
return !1;
|
|
@@ -4817,72 +4819,72 @@ const Sn = Dt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
4817
4819
|
}
|
|
4818
4820
|
return !0;
|
|
4819
4821
|
}, dr = Ns(() => {
|
|
4820
|
-
const F = !h || !e ? !1 : j(o) ? Z().isPaused() || a ? !1 :
|
|
4821
|
-
const
|
|
4822
|
-
return delete
|
|
4822
|
+
const F = !h || !e ? !1 : j(o) ? Z().isPaused() || a ? !1 : c !== !1 : o, D = (ee) => {
|
|
4823
|
+
const Te = Ue(ee);
|
|
4824
|
+
return delete Te._k, F ? B({
|
|
4823
4825
|
isValidating: !0,
|
|
4824
4826
|
isLoading: !0
|
|
4825
|
-
},
|
|
4826
|
-
},
|
|
4827
|
-
let
|
|
4827
|
+
}, Te) : Te;
|
|
4828
|
+
}, X = L(), K = G(), he = D(X), tt = X === K ? he : D(K);
|
|
4829
|
+
let J = he;
|
|
4828
4830
|
return [
|
|
4829
4831
|
() => {
|
|
4830
|
-
const
|
|
4831
|
-
return
|
|
4832
|
+
const ee = D(L());
|
|
4833
|
+
return ur(ee, J) ? (J.data = ee.data, J.isLoading = ee.isLoading, J.isValidating = ee.isValidating, J.error = ee.error, J) : (J = ee, ee);
|
|
4832
4834
|
},
|
|
4833
4835
|
() => tt
|
|
4834
4836
|
];
|
|
4835
4837
|
}, [
|
|
4836
4838
|
r,
|
|
4837
4839
|
h
|
|
4838
|
-
]), Qe =
|
|
4839
|
-
(F) =>
|
|
4840
|
-
|
|
4840
|
+
]), Qe = uo.useSyncExternalStore(Bt(
|
|
4841
|
+
(F) => ge(h, (D, X) => {
|
|
4842
|
+
ur(X, D) || F();
|
|
4841
4843
|
}),
|
|
4842
4844
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4843
4845
|
[
|
|
4844
4846
|
r,
|
|
4845
4847
|
h
|
|
4846
4848
|
]
|
|
4847
|
-
), dr[0], dr[1]), lr = !
|
|
4848
|
-
(F) =>
|
|
4849
|
+
), dr[0], dr[1]), lr = !P.current, vs = _[h] && _[h].length > 0, et = Qe.data, Ke = j(et) ? Wt && fs(Wt) ? Sn(Wt) : Wt : et, Vt = Qe.error, dn = qe(Ke), Ut = w ? j(et) ? j(dn.current) ? Ke : dn.current : et : Ke, hr = vs && !j(Vt) ? !1 : lr && !j(o) ? o : Z().isPaused() ? !1 : a ? j(Ke) ? !1 : c : j(Ke) || c, fr = !!(h && e && lr && hr), _s = j(Qe.isValidating) ? fr : Qe.isValidating, bs = j(Qe.isLoading) ? fr : Qe.isLoading, ft = Bt(
|
|
4850
|
+
(F) => Ze(void 0, null, function* () {
|
|
4849
4851
|
const D = q.current;
|
|
4850
4852
|
if (!h || !D || V.current || Z().isPaused())
|
|
4851
4853
|
return !1;
|
|
4852
|
-
let
|
|
4853
|
-
const tt = F || {},
|
|
4854
|
+
let X, K, he = !0;
|
|
4855
|
+
const tt = F || {}, J = !m[h] || !tt.dedupe, ee = () => qr ? !V.current && h === $.current && P.current : h === $.current, Te = {
|
|
4854
4856
|
isValidating: !1,
|
|
4855
4857
|
isLoading: !1
|
|
4856
4858
|
}, mr = () => {
|
|
4857
|
-
|
|
4859
|
+
Oe(Te);
|
|
4858
4860
|
}, yr = () => {
|
|
4859
4861
|
const de = m[h];
|
|
4860
4862
|
de && de[1] === K && delete m[h];
|
|
4861
4863
|
}, gr = {
|
|
4862
4864
|
isValidating: !0
|
|
4863
4865
|
};
|
|
4864
|
-
j(
|
|
4866
|
+
j(L().data) && (gr.isLoading = !0);
|
|
4865
4867
|
try {
|
|
4866
|
-
if (
|
|
4867
|
-
he &&
|
|
4868
|
+
if (J && (Oe(gr), t.loadingTimeout && j(L().data) && setTimeout(() => {
|
|
4869
|
+
he && ee() && Z().onLoadingSlow(h, t);
|
|
4868
4870
|
}, t.loadingTimeout), m[h] = [
|
|
4869
4871
|
D(x),
|
|
4870
4872
|
tr()
|
|
4871
|
-
]), [
|
|
4872
|
-
return
|
|
4873
|
-
|
|
4873
|
+
]), [X, K] = m[h], X = yield X, J && setTimeout(yr, t.dedupingInterval), !m[h] || m[h][1] !== K)
|
|
4874
|
+
return J && ee() && Z().onDiscarded(h), !1;
|
|
4875
|
+
Te.error = ne;
|
|
4874
4876
|
const de = b[h];
|
|
4875
4877
|
if (!j(de) && // case 1
|
|
4876
4878
|
(K <= de[0] || // case 2
|
|
4877
4879
|
K <= de[1] || // case 3
|
|
4878
4880
|
de[1] === 0))
|
|
4879
|
-
return mr(),
|
|
4880
|
-
const
|
|
4881
|
-
|
|
4881
|
+
return mr(), J && ee() && Z().onDiscarded(h), !1;
|
|
4882
|
+
const Ae = L().data;
|
|
4883
|
+
Te.data = s(Ae, X) ? Ae : X, J && ee() && Z().onSuccess(X, h, t);
|
|
4882
4884
|
} catch (de) {
|
|
4883
4885
|
yr();
|
|
4884
|
-
const
|
|
4885
|
-
|
|
4886
|
+
const Ae = Z(), { shouldRetryOnError: ln } = Ae;
|
|
4887
|
+
Ae.isPaused() || (Te.error = de, J && ee() && (Ae.onError(de, h, Ae), (ln === !0 || we(ln) && ln(de)) && (!Z().revalidateOnFocus || !Z().revalidateOnReconnect || ce()) && Ae.onErrorRetry(de, h, Ae, (ws) => {
|
|
4886
4888
|
const hn = _[h];
|
|
4887
4889
|
hn && hn[0] && hn[0](Ur, ws);
|
|
4888
4890
|
}, {
|
|
@@ -4917,15 +4919,15 @@ const Sn = Dt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
4917
4919
|
q.current = e, M.current = t, j(et) || (dn.current = et);
|
|
4918
4920
|
}), kn(() => {
|
|
4919
4921
|
if (!h) return;
|
|
4920
|
-
const F = ft.bind(
|
|
4922
|
+
const F = ft.bind(ne, On);
|
|
4921
4923
|
let D = 0;
|
|
4922
4924
|
Z().revalidateOnFocus && (D = Date.now() + Z().focusThrottleInterval);
|
|
4923
4925
|
const K = Mo(h, _, (he, tt = {}) => {
|
|
4924
4926
|
if (he == ds) {
|
|
4925
|
-
const
|
|
4926
|
-
Z().revalidateOnFocus &&
|
|
4927
|
+
const J = Date.now();
|
|
4928
|
+
Z().revalidateOnFocus && J > D && ce() && (D = J + Z().focusThrottleInterval, F());
|
|
4927
4929
|
} else if (he == ls)
|
|
4928
|
-
Z().revalidateOnReconnect &&
|
|
4930
|
+
Z().revalidateOnReconnect && ce() && F();
|
|
4929
4931
|
else {
|
|
4930
4932
|
if (he == hs)
|
|
4931
4933
|
return ft();
|
|
@@ -4933,9 +4935,9 @@ const Sn = Dt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
4933
4935
|
return ft(tt);
|
|
4934
4936
|
}
|
|
4935
4937
|
});
|
|
4936
|
-
return V.current = !1, $.current = h,
|
|
4938
|
+
return V.current = !1, $.current = h, P.current = !0, Oe({
|
|
4937
4939
|
_k: x
|
|
4938
|
-
}), hr && (j(
|
|
4940
|
+
}), hr && (j(Ke) || Mt ? F() : _o(F)), () => {
|
|
4939
4941
|
V.current = !0, K();
|
|
4940
4942
|
};
|
|
4941
4943
|
}, [
|
|
@@ -4943,21 +4945,21 @@ const Sn = Dt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
4943
4945
|
]), kn(() => {
|
|
4944
4946
|
let F;
|
|
4945
4947
|
function D() {
|
|
4946
|
-
const K =
|
|
4947
|
-
K && F !== -1 && (F = setTimeout(
|
|
4948
|
+
const K = we(u) ? u(L().data) : u;
|
|
4949
|
+
K && F !== -1 && (F = setTimeout(X, K));
|
|
4948
4950
|
}
|
|
4949
|
-
function
|
|
4950
|
-
!
|
|
4951
|
+
function X() {
|
|
4952
|
+
!L().error && (f || Z().isVisible()) && (p || Z().isOnline()) ? ft(On).then(D) : D();
|
|
4951
4953
|
}
|
|
4952
4954
|
return D(), () => {
|
|
4953
4955
|
F && (clearTimeout(F), F = -1);
|
|
4954
4956
|
};
|
|
4955
4957
|
}, [
|
|
4956
|
-
|
|
4958
|
+
u,
|
|
4957
4959
|
f,
|
|
4958
4960
|
p,
|
|
4959
4961
|
h
|
|
4960
|
-
]), Is(Ut), a && j(
|
|
4962
|
+
]), Is(Ut), a && j(Ke) && h) {
|
|
4961
4963
|
if (!qr && Mt)
|
|
4962
4964
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
4963
4965
|
q.current = e, M.current = t, V.current = !1;
|
|
@@ -4975,19 +4977,19 @@ const Sn = Dt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
4975
4977
|
return {
|
|
4976
4978
|
mutate: pr,
|
|
4977
4979
|
get data() {
|
|
4978
|
-
return
|
|
4980
|
+
return ue.data = !0, Ut;
|
|
4979
4981
|
},
|
|
4980
4982
|
get error() {
|
|
4981
|
-
return
|
|
4983
|
+
return ue.error = !0, Vt;
|
|
4982
4984
|
},
|
|
4983
4985
|
get isValidating() {
|
|
4984
|
-
return
|
|
4986
|
+
return ue.isValidating = !0, _s;
|
|
4985
4987
|
},
|
|
4986
4988
|
get isLoading() {
|
|
4987
|
-
return
|
|
4989
|
+
return ue.isLoading = !0, bs;
|
|
4988
4990
|
}
|
|
4989
4991
|
};
|
|
4990
|
-
}, $o =
|
|
4992
|
+
}, $o = Po(Do), Ko = ({
|
|
4991
4993
|
fileKey: n,
|
|
4992
4994
|
authToken: e,
|
|
4993
4995
|
enabled: t = !0,
|
|
@@ -5014,7 +5016,7 @@ const Sn = Dt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5014
5016
|
};
|
|
5015
5017
|
export {
|
|
5016
5018
|
ao as createJob,
|
|
5017
|
-
|
|
5019
|
+
us as initialProgress,
|
|
5018
5020
|
Uo as useAnimaCodegen,
|
|
5019
5021
|
Ko as useFigmaFile
|
|
5020
5022
|
};
|