@animaapp/anima-sdk-react 0.6.17 → 0.6.20
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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +580 -569
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,15 +2,15 @@ var ia = Object.defineProperty, oa = Object.defineProperties;
|
|
|
2
2
|
var ca = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var zs = Object.getOwnPropertySymbols;
|
|
4
4
|
var ua = Object.prototype.hasOwnProperty, da = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var Bs = (t, e, n) => e in t ? ia(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Be = (t, e) => {
|
|
6
6
|
for (var n in e || (e = {}))
|
|
7
|
-
ua.call(e, n) &&
|
|
7
|
+
ua.call(e, n) && Bs(t, n, e[n]);
|
|
8
8
|
if (zs)
|
|
9
9
|
for (var n of zs(e))
|
|
10
|
-
da.call(e, n) &&
|
|
10
|
+
da.call(e, n) && Bs(t, n, e[n]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, Ks = (t, e) => oa(t, ca(e));
|
|
13
|
+
var je = (t, e, n) => new Promise((s, r) => {
|
|
14
14
|
var a = (c) => {
|
|
15
15
|
try {
|
|
16
16
|
o(n.next(c));
|
|
@@ -26,7 +26,7 @@ var Ie = (t, e, n) => new Promise((s, r) => {
|
|
|
26
26
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
27
27
|
o((n = n.apply(t, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import Gt, { useState as la, useCallback as rn, createContext as fa, useEffect as ha, useLayoutEffect as pa, useContext as ma, useRef as
|
|
29
|
+
import Gt, { useState as la, useCallback as rn, createContext as fa, useEffect as ha, useLayoutEffect as pa, useContext as ma, useRef as Ke, useMemo as ya, useDebugValue as ga } from "react";
|
|
30
30
|
const va = (t) => {
|
|
31
31
|
let e = "";
|
|
32
32
|
const n = new Uint8Array(t), s = n.byteLength;
|
|
@@ -34,14 +34,14 @@ const va = (t) => {
|
|
|
34
34
|
e += String.fromCharCode(n[r]);
|
|
35
35
|
return btoa(e);
|
|
36
36
|
};
|
|
37
|
-
var _a = Object.defineProperty, ba = Object.defineProperties, wa = Object.getOwnPropertyDescriptors, qs = Object.getOwnPropertySymbols, ka = Object.prototype.hasOwnProperty,
|
|
37
|
+
var _a = Object.defineProperty, ba = Object.defineProperties, wa = Object.getOwnPropertyDescriptors, qs = Object.getOwnPropertySymbols, ka = Object.prototype.hasOwnProperty, Ea = Object.prototype.propertyIsEnumerable, Hs = (t, e, n) => e in t ? _a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, d = (t, e) => {
|
|
38
38
|
for (var n in e || (e = {}))
|
|
39
39
|
ka.call(e, n) && Hs(t, n, e[n]);
|
|
40
40
|
if (qs)
|
|
41
41
|
for (var n of qs(e))
|
|
42
|
-
|
|
42
|
+
Ea.call(e, n) && Hs(t, n, e[n]);
|
|
43
43
|
return t;
|
|
44
|
-
},
|
|
44
|
+
}, x = (t, e) => ba(t, wa(e)), Ee = (t, e, n) => new Promise((s, r) => {
|
|
45
45
|
var a = (c) => {
|
|
46
46
|
try {
|
|
47
47
|
o(n.next(c));
|
|
@@ -67,14 +67,14 @@ class Gs extends Error {
|
|
|
67
67
|
super(), this.name = e, this.message = n, this.detail = r, this.status = s;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const xa = "Figma Token Issue";
|
|
71
71
|
class Sa extends Error {
|
|
72
72
|
constructor({
|
|
73
73
|
fileKey: e,
|
|
74
74
|
reason: n,
|
|
75
75
|
cause: s
|
|
76
76
|
}) {
|
|
77
|
-
super(
|
|
77
|
+
super(xa), this.fileKey = e, this.reason = n, this.cause = s;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
const Oa = "Rate Limit Exceeded";
|
|
@@ -96,12 +96,12 @@ class Ra extends Error {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
const Pa = "Unknown Figma API Exception";
|
|
99
|
-
class
|
|
99
|
+
class ja extends Error {
|
|
100
100
|
constructor({ fileKey: e, cause: n }) {
|
|
101
101
|
super(Pa), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = n;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const Ia = (t, e) => {
|
|
105
105
|
var n;
|
|
106
106
|
if (((n = t == null ? void 0 : t.cause) == null ? void 0 : n.message) === "Fetch Error") {
|
|
107
107
|
const { err: s, status: r } = t.cause.body;
|
|
@@ -118,7 +118,7 @@ const ja = (t, e) => {
|
|
|
118
118
|
if (r === 400 && s.includes("Request too large"))
|
|
119
119
|
return new Ca({ fileKey: e, cause: t });
|
|
120
120
|
}
|
|
121
|
-
return new
|
|
121
|
+
return new ja({ fileKey: e, cause: t });
|
|
122
122
|
};
|
|
123
123
|
var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwnPropertyDescriptors, Js = Object.getOwnPropertySymbols, La = Object.prototype.hasOwnProperty, $a = Object.prototype.propertyIsEnumerable, Xs = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), Tr = (t) => {
|
|
124
124
|
throw TypeError(t);
|
|
@@ -129,7 +129,7 @@ var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwn
|
|
|
129
129
|
for (var n of Js(e))
|
|
130
130
|
$a.call(e, n) && Ys(t, n, e[n]);
|
|
131
131
|
return t;
|
|
132
|
-
}, Ts = (t, e) => Da(t, Ma(e)), As = (t, e, n) => e.has(t) || Tr("Cannot " + n),
|
|
132
|
+
}, Ts = (t, e) => Da(t, Ma(e)), As = (t, e, n) => e.has(t) || Tr("Cannot " + n), I = (t, e, n) => (As(t, e, "read from private field"), n ? n.call(t) : e.get(t)), le = (t, e, n) => e.has(t) ? Tr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), X = (t, e, n, s) => (As(t, e, "write to private field"), e.set(t, n), n), be = (t, e, n) => (As(t, e, "access private method"), n), K = (t, e, n) => new Promise((s, r) => {
|
|
133
133
|
var a = (c) => {
|
|
134
134
|
try {
|
|
135
135
|
o(n.next(c));
|
|
@@ -145,17 +145,17 @@ var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwn
|
|
|
145
145
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
146
146
|
o((n = n.apply(t, e)).next());
|
|
147
147
|
}), Fa = (t, e, n) => (e = t[Xs("asyncIterator")]) ? e.call(t) : (t = t[Xs("iterator")](), e = {}, n = (s, r) => (r = t[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(t, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), n("next"), n("return"), e), Wa = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
148
|
-
function
|
|
148
|
+
function Va(t) {
|
|
149
149
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
150
150
|
}
|
|
151
|
-
var
|
|
151
|
+
var Kn = { exports: {} }, Ua = Kn.exports, Qs;
|
|
152
152
|
function za() {
|
|
153
153
|
return Qs || (Qs = 1, function(t, e) {
|
|
154
154
|
(function(n, s) {
|
|
155
155
|
t.exports = s();
|
|
156
|
-
})(
|
|
157
|
-
var n = typeof Promise == "function", s = typeof self == "object" ? self : Wa, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", p = r && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", g = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = g && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()),
|
|
158
|
-
function
|
|
156
|
+
})(Ua, function() {
|
|
157
|
+
var n = typeof Promise == "function", s = typeof self == "object" ? self : Wa, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", p = r && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", g = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = g && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), v = h && typeof Array.prototype[Symbol.iterator] == "function", l = v && Object.getPrototypeOf([][Symbol.iterator]()), A = h && typeof String.prototype[Symbol.iterator] == "function", j = A && Object.getPrototypeOf(""[Symbol.iterator]()), B = 8, Z = -1;
|
|
158
|
+
function U(D) {
|
|
159
159
|
var M = typeof D;
|
|
160
160
|
if (M !== "object")
|
|
161
161
|
return M;
|
|
@@ -189,14 +189,14 @@ function za() {
|
|
|
189
189
|
if (typeof G == "string")
|
|
190
190
|
return G;
|
|
191
191
|
var $ = Object.getPrototypeOf(D);
|
|
192
|
-
return $ === RegExp.prototype ? "RegExp" : $ === Date.prototype ? "Date" : n && $ === Promise.prototype ? "Promise" : i && $ === Set.prototype ? "Set" : a && $ === Map.prototype ? "Map" : c && $ === WeakSet.prototype ? "WeakSet" : o && $ === WeakMap.prototype ? "WeakMap" : u && $ === DataView.prototype ? "DataView" : a && $ === m ? "Map Iterator" : i && $ === b ? "Set Iterator" :
|
|
192
|
+
return $ === RegExp.prototype ? "RegExp" : $ === Date.prototype ? "Date" : n && $ === Promise.prototype ? "Promise" : i && $ === Set.prototype ? "Set" : a && $ === Map.prototype ? "Map" : c && $ === WeakSet.prototype ? "WeakSet" : o && $ === WeakMap.prototype ? "WeakMap" : u && $ === DataView.prototype ? "DataView" : a && $ === m ? "Map Iterator" : i && $ === b ? "Set Iterator" : v && $ === l ? "Array Iterator" : A && $ === j ? "String Iterator" : $ === null ? "Object" : Object.prototype.toString.call(D).slice(B, Z);
|
|
193
193
|
}
|
|
194
|
-
return
|
|
194
|
+
return U;
|
|
195
195
|
});
|
|
196
|
-
}(
|
|
196
|
+
}(Kn)), Kn.exports;
|
|
197
197
|
}
|
|
198
|
-
var
|
|
199
|
-
const
|
|
198
|
+
var Ba = za();
|
|
199
|
+
const Ka = /* @__PURE__ */ Va(Ba), Cs = typeof Buffer != "undefined", qa = Cs && typeof Buffer.from != "undefined", Ha = Cs ? (
|
|
200
200
|
/**
|
|
201
201
|
* is value is Buffer?
|
|
202
202
|
*
|
|
@@ -253,7 +253,7 @@ const Ba = /* @__PURE__ */ Ua(Ka), Cs = typeof Buffer != "undefined", qa = Cs &&
|
|
|
253
253
|
}
|
|
254
254
|
);
|
|
255
255
|
function mt(t) {
|
|
256
|
-
return Ha(t) ? "Buffer" :
|
|
256
|
+
return Ha(t) ? "Buffer" : Ka(t);
|
|
257
257
|
}
|
|
258
258
|
const Ja = /* @__PURE__ */ new Set([
|
|
259
259
|
"Arguments",
|
|
@@ -466,11 +466,11 @@ class mi {
|
|
|
466
466
|
le(this, Jn), le(this, an), le(this, He), le(this, on), X(this, an, e), X(this, on, n), X(this, He, 0);
|
|
467
467
|
}
|
|
468
468
|
run() {
|
|
469
|
-
return
|
|
469
|
+
return K(this, null, function* () {
|
|
470
470
|
try {
|
|
471
|
-
return yield
|
|
471
|
+
return yield I(this, on).call(this);
|
|
472
472
|
} catch (e) {
|
|
473
|
-
if (X(this, He,
|
|
473
|
+
if (X(this, He, I(this, He) + 1), I(this, He) > I(this, an))
|
|
474
474
|
throw console.error("Max attempts reached"), e;
|
|
475
475
|
const n = be(this, Jn, Ar).call(this);
|
|
476
476
|
return yield pi(n), yield this.run();
|
|
@@ -479,13 +479,13 @@ class mi {
|
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
an = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakSet(), Ar = function() {
|
|
482
|
-
return
|
|
482
|
+
return I(this, He) * 1e3 * 1.5;
|
|
483
483
|
};
|
|
484
484
|
function yi() {
|
|
485
485
|
return typeof CompressionStream != "undefined";
|
|
486
486
|
}
|
|
487
487
|
function gi(t) {
|
|
488
|
-
return
|
|
488
|
+
return K(this, null, function* () {
|
|
489
489
|
const e = new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")), n = [];
|
|
490
490
|
try {
|
|
491
491
|
for (var s = Fa(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
@@ -506,7 +506,7 @@ function gi(t) {
|
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
function vi(t) {
|
|
509
|
-
return
|
|
509
|
+
return K(this, null, function* () {
|
|
510
510
|
const e = yield new Blob(t).arrayBuffer();
|
|
511
511
|
return new Uint8Array(e);
|
|
512
512
|
});
|
|
@@ -544,7 +544,7 @@ class nr extends Error {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
class
|
|
547
|
+
class Et extends Error {
|
|
548
548
|
constructor(e = {}) {
|
|
549
549
|
const { canceled: n = !1 } = e;
|
|
550
550
|
super("Abort Error"), this.name = "Abort Error", this.canceled = n;
|
|
@@ -570,8 +570,8 @@ function Xn() {
|
|
|
570
570
|
return Math.floor(Date.now() / 1e3).toString();
|
|
571
571
|
}
|
|
572
572
|
const wi = 5 * 60 * 1e3, ki = 1 * 1e3;
|
|
573
|
-
var Ge, se, ve, Yn, Qn,
|
|
574
|
-
class
|
|
573
|
+
var Ge, se, ve, Yn, Qn, xt;
|
|
574
|
+
class Ei {
|
|
575
575
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: n }) {
|
|
576
576
|
le(this, ve), le(this, Ge), le(this, se), this.baseAddress = n, X(this, Ge, e), X(this, se, {}), this.plugins = [];
|
|
577
577
|
}
|
|
@@ -588,51 +588,51 @@ class xi {
|
|
|
588
588
|
return X(this, se, e), this;
|
|
589
589
|
}
|
|
590
590
|
get(e) {
|
|
591
|
-
return
|
|
591
|
+
return K(this, arguments, function* (n, s = {}) {
|
|
592
592
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
593
593
|
let o = a != null ? a : this.headers;
|
|
594
|
-
const c = kt(
|
|
594
|
+
const c = kt(I(this, se));
|
|
595
595
|
return X(this, se, {}), c.extraHeaders && (o = ie(ie({}, o), c.extraHeaders)), c.requestValidation && (o = Ts(ie({}, o), { "X-Request-Nonce": Cr(), "X-Request-Timestamp": Xn() })), c.async ? yield be(this, ve, Qn).call(this, `${i}${n}`, c.async, { headers: o }) : yield be(this, ve, Yn).call(this, `${i}${n}`, c, { headers: o });
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
post(e, n) {
|
|
599
|
-
return
|
|
600
|
-
const i = kt(
|
|
601
|
-
return X(this, se, {}), be(this, ve,
|
|
599
|
+
return K(this, arguments, function* (s, r, a = {}) {
|
|
600
|
+
const i = kt(I(this, se));
|
|
601
|
+
return X(this, se, {}), be(this, ve, xt).call(this, s, "POST", r, a, i);
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
put(e, n) {
|
|
605
|
-
return
|
|
606
|
-
const i = kt(
|
|
607
|
-
return X(this, se, {}), be(this, ve,
|
|
605
|
+
return K(this, arguments, function* (s, r, a = {}) {
|
|
606
|
+
const i = kt(I(this, se));
|
|
607
|
+
return X(this, se, {}), be(this, ve, xt).call(this, s, "PUT", r, a, i);
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
delete(e, n) {
|
|
611
|
-
return
|
|
612
|
-
const i = kt(
|
|
613
|
-
return X(this, se, {}), be(this, ve,
|
|
611
|
+
return K(this, arguments, function* (s, r, a = {}) {
|
|
612
|
+
const i = kt(I(this, se));
|
|
613
|
+
return X(this, se, {}), be(this, ve, xt).call(this, s, "DELETE", r, a, i);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
616
|
patch(e, n) {
|
|
617
|
-
return
|
|
618
|
-
const i = kt(
|
|
619
|
-
return X(this, se, {}), be(this, ve,
|
|
617
|
+
return K(this, arguments, function* (s, r, a = {}) {
|
|
618
|
+
const i = kt(I(this, se));
|
|
619
|
+
return X(this, se, {}), be(this, ve, xt).call(this, s, "PATCH", r, a, i);
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
Ge = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakSet(), Yn = function(t, e, n) {
|
|
624
|
-
return
|
|
625
|
-
const s = () =>
|
|
624
|
+
return K(this, null, function* () {
|
|
625
|
+
const s = () => K(this, null, function* () {
|
|
626
626
|
var c, u;
|
|
627
627
|
try {
|
|
628
|
-
return yield
|
|
628
|
+
return yield I(this, Ge).call(this, t, ie(ie({}, n), e.abortSignal && { signal: e.abortSignal }));
|
|
629
629
|
} catch (h) {
|
|
630
|
-
throw h instanceof Error && h.name === "AbortError" ? new
|
|
630
|
+
throw h instanceof Error && h.name === "AbortError" ? new Et({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : h;
|
|
631
631
|
}
|
|
632
632
|
}), { headers: r } = n != null ? n : {}, a = (c, u) => {
|
|
633
633
|
var h, p;
|
|
634
634
|
return ((h = c == null ? void 0 : c.headers) == null ? void 0 : h.get(u)) || ((p = c == null ? void 0 : c.headersObject) == null ? void 0 : p[u]) || "";
|
|
635
|
-
}, i = (c) =>
|
|
635
|
+
}, i = (c) => K(this, null, function* () {
|
|
636
636
|
var u;
|
|
637
637
|
if (!c.ok) {
|
|
638
638
|
const p = yield c.text().catch();
|
|
@@ -675,7 +675,7 @@ Ge = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
675
675
|
return yield i(o);
|
|
676
676
|
});
|
|
677
677
|
}, Qn = function(t, e, n) {
|
|
678
|
-
return
|
|
678
|
+
return K(this, null, function* () {
|
|
679
679
|
var s, r;
|
|
680
680
|
const {
|
|
681
681
|
onProgress: a,
|
|
@@ -685,9 +685,9 @@ Ge = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
685
685
|
} = e, u = `${t}/async`, h = `${t}/async/job`;
|
|
686
686
|
let p;
|
|
687
687
|
try {
|
|
688
|
-
p = yield
|
|
688
|
+
p = yield I(this, Ge).call(this, u, ie(ie({}, n), i && { signal: i }));
|
|
689
689
|
} catch (b) {
|
|
690
|
-
throw b instanceof Error && b.name === "AbortError" ? new
|
|
690
|
+
throw b instanceof Error && b.name === "AbortError" ? new Et({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : b;
|
|
691
691
|
}
|
|
692
692
|
if (!p.ok) {
|
|
693
693
|
const b = yield p.text().catch();
|
|
@@ -703,40 +703,40 @@ Ge = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
703
703
|
const k = yield p.json(), { job_id: g } = k;
|
|
704
704
|
if (!g)
|
|
705
705
|
throw new Error("Job ID not found in response");
|
|
706
|
-
return new Promise((b, m) =>
|
|
707
|
-
const
|
|
706
|
+
return new Promise((b, m) => K(this, null, function* () {
|
|
707
|
+
const v = setTimeout(() => {
|
|
708
708
|
m(new Error("Job timed out"));
|
|
709
|
-
}, c), l = (
|
|
709
|
+
}, c), l = (A = 0) => K(this, null, function* () {
|
|
710
710
|
if (i != null && i.aborted) {
|
|
711
|
-
clearTimeout(
|
|
712
|
-
m(new
|
|
713
|
-
}).catch((
|
|
714
|
-
m(new
|
|
711
|
+
clearTimeout(v), I(this, Ge).call(this, `${h}/${g}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
712
|
+
m(new Et({ canceled: !0 }));
|
|
713
|
+
}).catch((j) => {
|
|
714
|
+
m(new Et({ canceled: !1 }));
|
|
715
715
|
});
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
try {
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
721
|
-
clearTimeout(
|
|
722
|
-
const
|
|
723
|
-
b(
|
|
724
|
-
} else if (
|
|
725
|
-
clearTimeout(
|
|
719
|
+
const j = yield (yield I(this, Ge).call(this, `${h}/${g}`, { headers: this.headers })).json();
|
|
720
|
+
if (j.status === "success") {
|
|
721
|
+
clearTimeout(v);
|
|
722
|
+
const B = j.response_json;
|
|
723
|
+
b(B);
|
|
724
|
+
} else if (j.status === "failed")
|
|
725
|
+
clearTimeout(v), m(new bi(j.response_json));
|
|
726
726
|
else {
|
|
727
|
-
a && a(
|
|
728
|
-
const
|
|
729
|
-
setTimeout(() => l(
|
|
727
|
+
a && a(j.response_json);
|
|
728
|
+
const B = o(A);
|
|
729
|
+
setTimeout(() => l(A + 1), B);
|
|
730
730
|
}
|
|
731
|
-
} catch (
|
|
732
|
-
m(
|
|
731
|
+
} catch (j) {
|
|
732
|
+
m(j);
|
|
733
733
|
}
|
|
734
734
|
});
|
|
735
735
|
l();
|
|
736
736
|
}));
|
|
737
737
|
});
|
|
738
|
-
},
|
|
739
|
-
return
|
|
738
|
+
}, xt = function(t, e, n, s, r) {
|
|
739
|
+
return K(this, null, function* () {
|
|
740
740
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
741
741
|
let c = i != null ? i : this.headers;
|
|
742
742
|
r.extraHeaders && (c = ie(ie({}, c), r.extraHeaders)), r.requestValidation && (c = Ts(ie({}, c), { "X-Request-Nonce": Cr(), "X-Request-Timestamp": Xn() }));
|
|
@@ -748,7 +748,7 @@ Ge = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
748
748
|
}) : yield be(this, ve, Yn).call(this, `${o}${t}`, r, { method: e, headers: c, body: u });
|
|
749
749
|
});
|
|
750
750
|
};
|
|
751
|
-
const sr = (t, e, n, s) => t instanceof
|
|
751
|
+
const sr = (t, e, n, s) => t instanceof Et ? t : new _i({ resource: e, api: String(n), args: s, cause: t }), jn = (t, e) => new Proxy(e, {
|
|
752
752
|
get(n, s) {
|
|
753
753
|
return (...r) => {
|
|
754
754
|
var a;
|
|
@@ -770,23 +770,23 @@ const sr = (t, e, n, s) => t instanceof xt ? t : new _i({ resource: e, api: Stri
|
|
|
770
770
|
}
|
|
771
771
|
});
|
|
772
772
|
var St;
|
|
773
|
-
class
|
|
773
|
+
class xi {
|
|
774
774
|
constructor(e) {
|
|
775
775
|
le(this, St), this.resourceName = "Files", X(this, St, e);
|
|
776
776
|
}
|
|
777
777
|
get(e) {
|
|
778
|
-
return
|
|
778
|
+
return K(this, arguments, function* ({ fileKey: n, params: s = {} }) {
|
|
779
779
|
const r = new URLSearchParams(ie({
|
|
780
780
|
plugin_data: "857346721138427857"
|
|
781
781
|
}, s)).toString(), a = `v1/files/${n}?${r}`;
|
|
782
|
-
return yield
|
|
782
|
+
return yield I(this, St).get(a);
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
785
|
getImageFills(e) {
|
|
786
|
-
return
|
|
786
|
+
return K(this, arguments, function* ({ fileKey: n }) {
|
|
787
787
|
var s, r;
|
|
788
788
|
const a = `v1/files/${n}/images`;
|
|
789
|
-
return (r = (s = (yield
|
|
789
|
+
return (r = (s = (yield I(this, St).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
792
|
}
|
|
@@ -805,30 +805,30 @@ class Ti {
|
|
|
805
805
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
806
806
|
*/
|
|
807
807
|
get(e) {
|
|
808
|
-
return
|
|
809
|
-
const i = Si(n, s, r), o =
|
|
808
|
+
return K(this, arguments, function* ({ fileKey: n, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
809
|
+
const i = Si(n, s, r), o = I(this, _e).cache.images.entries.get(i);
|
|
810
810
|
if (Oi(o))
|
|
811
811
|
return o.result;
|
|
812
|
-
o &&
|
|
813
|
-
const c =
|
|
812
|
+
o && I(this, _e).cache.images.entries.delete(i);
|
|
813
|
+
const c = I(this, _e).cache.images.pendingRequests.get(i);
|
|
814
814
|
if (c)
|
|
815
815
|
return c;
|
|
816
816
|
const u = be(this, es, Nr).call(this, i, n, s, r, a);
|
|
817
|
-
|
|
817
|
+
I(this, _e).cache.images.pendingRequests.set(i, u);
|
|
818
818
|
try {
|
|
819
819
|
return yield u;
|
|
820
820
|
} finally {
|
|
821
|
-
|
|
821
|
+
I(this, _e).cache.images.pendingRequests.delete(i);
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
_e = /* @__PURE__ */ new WeakMap(), es = /* @__PURE__ */ new WeakSet(), Nr = function(t, e, n, s, r) {
|
|
827
|
-
return
|
|
828
|
-
const a = yield
|
|
827
|
+
return K(this, null, function* () {
|
|
828
|
+
const a = yield I(this, _e).get(
|
|
829
829
|
`v1/images/${e}?ids=${n}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
830
830
|
);
|
|
831
|
-
return
|
|
831
|
+
return I(this, _e).cache.images.entries.set(t, {
|
|
832
832
|
result: a,
|
|
833
833
|
ts: Date.now()
|
|
834
834
|
}), a;
|
|
@@ -840,47 +840,47 @@ class Ai {
|
|
|
840
840
|
le(this, cn), this.resourceName = "Nodes", X(this, cn, e);
|
|
841
841
|
}
|
|
842
842
|
get(e) {
|
|
843
|
-
return
|
|
843
|
+
return K(this, arguments, function* ({ fileKey: n, nodeIds: s, params: r = {} }) {
|
|
844
844
|
const a = Ts(ie({}, r), {
|
|
845
845
|
ids: s.join(",")
|
|
846
846
|
}), i = new URLSearchParams(ie({
|
|
847
847
|
plugin_data: "857346721138427857"
|
|
848
848
|
}, a)).toString(), o = `v1/files/${n}/nodes?${i}`;
|
|
849
|
-
return yield
|
|
849
|
+
return yield I(this, cn).get(o);
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
cn = /* @__PURE__ */ new WeakMap();
|
|
854
|
-
var
|
|
855
|
-
class Ci extends
|
|
854
|
+
var Ie;
|
|
855
|
+
class Ci extends Ei {
|
|
856
856
|
constructor({
|
|
857
857
|
baseAddress: e = "https://api.figma.com/",
|
|
858
858
|
fetch: n = globalThis.fetch.bind(globalThis)
|
|
859
859
|
} = {}) {
|
|
860
|
-
super({ fetch: n, baseAddress: e }), le(this,
|
|
860
|
+
super({ fetch: n, baseAddress: e }), le(this, Ie, ""), this.cache = {
|
|
861
861
|
images: {
|
|
862
862
|
entries: /* @__PURE__ */ new Map(),
|
|
863
863
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
864
864
|
}
|
|
865
|
-
}, this.files =
|
|
865
|
+
}, this.files = jn(this, new xi(this)), this.nodes = jn(this, new Ai(this)), this.images = jn(this, new Ti(this));
|
|
866
866
|
}
|
|
867
867
|
set token(e) {
|
|
868
868
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
869
869
|
throw new Error("Invalid Figma access token");
|
|
870
|
-
X(this,
|
|
870
|
+
X(this, Ie, e);
|
|
871
871
|
}
|
|
872
872
|
get token() {
|
|
873
|
-
return
|
|
873
|
+
return I(this, Ie);
|
|
874
874
|
}
|
|
875
875
|
get headers() {
|
|
876
876
|
const e = {
|
|
877
877
|
"Content-Type": "application/json"
|
|
878
878
|
};
|
|
879
|
-
return
|
|
879
|
+
return I(this, Ie).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = I(this, Ie) : I(this, Ie).startsWith("figu_") && (e.Authorization = `Bearer ${I(this, Ie)}`), e;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
|
|
883
|
-
const Ni = (t) =>
|
|
882
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
883
|
+
const Ni = (t) => Ee(void 0, [t], function* ({
|
|
884
884
|
fileKey: e,
|
|
885
885
|
authToken: n,
|
|
886
886
|
figmaRestApi: s = new Ci(),
|
|
@@ -896,7 +896,7 @@ const Ni = (t) => xe(void 0, [t], function* ({
|
|
|
896
896
|
params: r
|
|
897
897
|
});
|
|
898
898
|
} catch (i) {
|
|
899
|
-
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i),
|
|
899
|
+
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), Ia(i, e));
|
|
900
900
|
}
|
|
901
901
|
});
|
|
902
902
|
var N;
|
|
@@ -939,7 +939,7 @@ var ts;
|
|
|
939
939
|
(function(t) {
|
|
940
940
|
t.mergeShapes = (e, n) => d(d({}, e), n);
|
|
941
941
|
})(ts || (ts = {}));
|
|
942
|
-
const
|
|
942
|
+
const _ = N.arrayToEnum([
|
|
943
943
|
"string",
|
|
944
944
|
"nan",
|
|
945
945
|
"number",
|
|
@@ -963,23 +963,23 @@ const v = N.arrayToEnum([
|
|
|
963
963
|
]), Ne = (t) => {
|
|
964
964
|
switch (typeof t) {
|
|
965
965
|
case "undefined":
|
|
966
|
-
return
|
|
966
|
+
return _.undefined;
|
|
967
967
|
case "string":
|
|
968
|
-
return
|
|
968
|
+
return _.string;
|
|
969
969
|
case "number":
|
|
970
|
-
return isNaN(t) ?
|
|
970
|
+
return isNaN(t) ? _.nan : _.number;
|
|
971
971
|
case "boolean":
|
|
972
|
-
return
|
|
972
|
+
return _.boolean;
|
|
973
973
|
case "function":
|
|
974
|
-
return
|
|
974
|
+
return _.function;
|
|
975
975
|
case "bigint":
|
|
976
|
-
return
|
|
976
|
+
return _.bigint;
|
|
977
977
|
case "symbol":
|
|
978
|
-
return
|
|
978
|
+
return _.symbol;
|
|
979
979
|
case "object":
|
|
980
|
-
return Array.isArray(t) ?
|
|
980
|
+
return Array.isArray(t) ? _.array : t === null ? _.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? _.promise : typeof Map != "undefined" && t instanceof Map ? _.map : typeof Set != "undefined" && t instanceof Set ? _.set : typeof Date != "undefined" && t instanceof Date ? _.date : _.object;
|
|
981
981
|
default:
|
|
982
|
-
return
|
|
982
|
+
return _.unknown;
|
|
983
983
|
}
|
|
984
984
|
}, f = N.arrayToEnum([
|
|
985
985
|
"invalid_type",
|
|
@@ -1063,7 +1063,7 @@ const yt = (t, e) => {
|
|
|
1063
1063
|
let n;
|
|
1064
1064
|
switch (t.code) {
|
|
1065
1065
|
case f.invalid_type:
|
|
1066
|
-
t.received ===
|
|
1066
|
+
t.received === _.undefined ? n = "Required" : n = `Expected ${t.expected}, received ${t.received}`;
|
|
1067
1067
|
break;
|
|
1068
1068
|
case f.invalid_literal:
|
|
1069
1069
|
n = `Invalid literal value, expected ${JSON.stringify(t.expected, N.jsonStringifyReplacer)}`;
|
|
@@ -1123,11 +1123,11 @@ function ln() {
|
|
|
1123
1123
|
return Rr;
|
|
1124
1124
|
}
|
|
1125
1125
|
const fn = (t) => {
|
|
1126
|
-
const { data: e, path: n, errorMaps: s, issueData: r } = t, a = [...n, ...r.path || []], i =
|
|
1126
|
+
const { data: e, path: n, errorMaps: s, issueData: r } = t, a = [...n, ...r.path || []], i = x(d({}, r), {
|
|
1127
1127
|
path: a
|
|
1128
1128
|
});
|
|
1129
1129
|
if (r.message !== void 0)
|
|
1130
|
-
return
|
|
1130
|
+
return x(d({}, r), {
|
|
1131
1131
|
path: a,
|
|
1132
1132
|
message: r.message
|
|
1133
1133
|
});
|
|
@@ -1135,11 +1135,11 @@ const fn = (t) => {
|
|
|
1135
1135
|
const c = s.filter((u) => !!u).slice().reverse();
|
|
1136
1136
|
for (const u of c)
|
|
1137
1137
|
o = u(i, { data: e, defaultError: o }).message;
|
|
1138
|
-
return
|
|
1138
|
+
return x(d({}, r), {
|
|
1139
1139
|
path: a,
|
|
1140
1140
|
message: o
|
|
1141
1141
|
});
|
|
1142
|
-
},
|
|
1142
|
+
}, ji = [];
|
|
1143
1143
|
function y(t, e) {
|
|
1144
1144
|
const n = ln(), s = fn({
|
|
1145
1145
|
issueData: e,
|
|
@@ -1178,7 +1178,7 @@ class Y {
|
|
|
1178
1178
|
return { status: e.value, value: s };
|
|
1179
1179
|
}
|
|
1180
1180
|
static mergeObjectAsync(e, n) {
|
|
1181
|
-
return
|
|
1181
|
+
return Ee(this, null, function* () {
|
|
1182
1182
|
const s = [];
|
|
1183
1183
|
for (const r of n) {
|
|
1184
1184
|
const a = yield r.key, i = yield r.value;
|
|
@@ -1217,7 +1217,7 @@ var w;
|
|
|
1217
1217
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1218
1218
|
})(w || (w = {}));
|
|
1219
1219
|
var Ot, Tt;
|
|
1220
|
-
class
|
|
1220
|
+
class xe {
|
|
1221
1221
|
constructor(e, n, s, r) {
|
|
1222
1222
|
this._cachedPath = [], this.parent = e, this.data = n, this._path = s, this._key = r;
|
|
1223
1223
|
}
|
|
@@ -1348,7 +1348,7 @@ class T {
|
|
|
1348
1348
|
});
|
|
1349
1349
|
}
|
|
1350
1350
|
parseAsync(e, n) {
|
|
1351
|
-
return
|
|
1351
|
+
return Ee(this, null, function* () {
|
|
1352
1352
|
const s = yield this.safeParseAsync(e, n);
|
|
1353
1353
|
if (s.success)
|
|
1354
1354
|
return s.data;
|
|
@@ -1356,7 +1356,7 @@ class T {
|
|
|
1356
1356
|
});
|
|
1357
1357
|
}
|
|
1358
1358
|
safeParseAsync(e, n) {
|
|
1359
|
-
return
|
|
1359
|
+
return Ee(this, null, function* () {
|
|
1360
1360
|
const s = {
|
|
1361
1361
|
common: {
|
|
1362
1362
|
issues: [],
|
|
@@ -1387,7 +1387,7 @@ class T {
|
|
|
1387
1387
|
_refinement(e) {
|
|
1388
1388
|
return new ge({
|
|
1389
1389
|
schema: this,
|
|
1390
|
-
typeName:
|
|
1390
|
+
typeName: E.ZodEffects,
|
|
1391
1391
|
effect: { type: "refinement", refinement: e }
|
|
1392
1392
|
});
|
|
1393
1393
|
}
|
|
@@ -1423,37 +1423,37 @@ class T {
|
|
|
1423
1423
|
return Mt.create(this, e, this._def);
|
|
1424
1424
|
}
|
|
1425
1425
|
transform(e) {
|
|
1426
|
-
return new ge(
|
|
1426
|
+
return new ge(x(d({}, O(this._def)), {
|
|
1427
1427
|
schema: this,
|
|
1428
|
-
typeName:
|
|
1428
|
+
typeName: E.ZodEffects,
|
|
1429
1429
|
effect: { type: "transform", transform: e }
|
|
1430
1430
|
}));
|
|
1431
1431
|
}
|
|
1432
1432
|
default(e) {
|
|
1433
1433
|
const n = typeof e == "function" ? e : () => e;
|
|
1434
|
-
return new
|
|
1434
|
+
return new Vt(x(d({}, O(this._def)), {
|
|
1435
1435
|
innerType: this,
|
|
1436
1436
|
defaultValue: n,
|
|
1437
|
-
typeName:
|
|
1437
|
+
typeName: E.ZodDefault
|
|
1438
1438
|
}));
|
|
1439
1439
|
}
|
|
1440
1440
|
brand() {
|
|
1441
1441
|
return new Ns(d({
|
|
1442
|
-
typeName:
|
|
1442
|
+
typeName: E.ZodBranded,
|
|
1443
1443
|
type: this
|
|
1444
1444
|
}, O(this._def)));
|
|
1445
1445
|
}
|
|
1446
1446
|
catch(e) {
|
|
1447
1447
|
const n = typeof e == "function" ? e : () => e;
|
|
1448
|
-
return new
|
|
1448
|
+
return new Ut(x(d({}, O(this._def)), {
|
|
1449
1449
|
innerType: this,
|
|
1450
1450
|
catchValue: n,
|
|
1451
|
-
typeName:
|
|
1451
|
+
typeName: E.ZodCatch
|
|
1452
1452
|
}));
|
|
1453
1453
|
}
|
|
1454
1454
|
describe(e) {
|
|
1455
1455
|
const n = this.constructor;
|
|
1456
|
-
return new n(
|
|
1456
|
+
return new n(x(d({}, this._def), {
|
|
1457
1457
|
description: e
|
|
1458
1458
|
}));
|
|
1459
1459
|
}
|
|
@@ -1470,23 +1470,23 @@ class T {
|
|
|
1470
1470
|
return this.safeParse(null).success;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
const
|
|
1474
|
-
let
|
|
1475
|
-
const
|
|
1476
|
-
function
|
|
1473
|
+
const Ii = /^c[^\s-]{8,}$/i, Zi = /^[0-9a-z]+$/, Di = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Mi = /^[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, Li = /^[a-z0-9_-]{21}$/i, $i = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fi = /^[-+]?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)?)??$/, Wi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Vi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1474
|
+
let In;
|
|
1475
|
+
const Ui = /^(?:(?: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])$/, zi = /^(?:(?: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])$/, Bi = /^(([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]))$/, Ki = /^(([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])$/, qi = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Hi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, jr = "((\\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])))", Gi = new RegExp(`^${jr}$`);
|
|
1476
|
+
function Ir(t) {
|
|
1477
1477
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1478
1478
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1479
1479
|
}
|
|
1480
1480
|
function Ji(t) {
|
|
1481
|
-
return new RegExp(`^${
|
|
1481
|
+
return new RegExp(`^${Ir(t)}$`);
|
|
1482
1482
|
}
|
|
1483
1483
|
function Zr(t) {
|
|
1484
|
-
let e = `${
|
|
1484
|
+
let e = `${jr}T${Ir(t)}`;
|
|
1485
1485
|
const n = [];
|
|
1486
1486
|
return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
|
|
1487
1487
|
}
|
|
1488
1488
|
function Xi(t, e) {
|
|
1489
|
-
return !!((e === "v4" || !e) &&
|
|
1489
|
+
return !!((e === "v4" || !e) && Ui.test(t) || (e === "v6" || !e) && Bi.test(t));
|
|
1490
1490
|
}
|
|
1491
1491
|
function Yi(t, e) {
|
|
1492
1492
|
if (!$i.test(t))
|
|
@@ -1499,15 +1499,15 @@ function Yi(t, e) {
|
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
1501
|
function Qi(t, e) {
|
|
1502
|
-
return !!((e === "v4" || !e) && zi.test(t) || (e === "v6" || !e) &&
|
|
1502
|
+
return !!((e === "v4" || !e) && zi.test(t) || (e === "v6" || !e) && Ki.test(t));
|
|
1503
1503
|
}
|
|
1504
1504
|
class me extends T {
|
|
1505
1505
|
_parse(e) {
|
|
1506
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
1506
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== _.string) {
|
|
1507
1507
|
const r = this._getOrReturnCtx(e);
|
|
1508
1508
|
return y(r, {
|
|
1509
1509
|
code: f.invalid_type,
|
|
1510
|
-
expected:
|
|
1510
|
+
expected: _.string,
|
|
1511
1511
|
received: r.parsedType
|
|
1512
1512
|
}), S;
|
|
1513
1513
|
}
|
|
@@ -1556,7 +1556,7 @@ class me extends T {
|
|
|
1556
1556
|
message: r.message
|
|
1557
1557
|
}), n.dirty());
|
|
1558
1558
|
else if (r.kind === "emoji")
|
|
1559
|
-
|
|
1559
|
+
In || (In = new RegExp(Vi, "u")), In.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1560
1560
|
validation: "emoji",
|
|
1561
1561
|
code: f.invalid_string,
|
|
1562
1562
|
message: r.message
|
|
@@ -1574,7 +1574,7 @@ class me extends T {
|
|
|
1574
1574
|
message: r.message
|
|
1575
1575
|
}), n.dirty());
|
|
1576
1576
|
else if (r.kind === "cuid")
|
|
1577
|
-
|
|
1577
|
+
Ii.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1578
1578
|
validation: "cuid",
|
|
1579
1579
|
code: f.invalid_string,
|
|
1580
1580
|
message: r.message
|
|
@@ -1663,7 +1663,7 @@ class me extends T {
|
|
|
1663
1663
|
}, w.errToObj(s)));
|
|
1664
1664
|
}
|
|
1665
1665
|
_addCheck(e) {
|
|
1666
|
-
return new me(
|
|
1666
|
+
return new me(x(d({}, this._def), {
|
|
1667
1667
|
checks: [...this._def.checks, e]
|
|
1668
1668
|
}));
|
|
1669
1669
|
}
|
|
@@ -1789,17 +1789,17 @@ class me extends T {
|
|
|
1789
1789
|
return this.min(1, w.errToObj(e));
|
|
1790
1790
|
}
|
|
1791
1791
|
trim() {
|
|
1792
|
-
return new me(
|
|
1792
|
+
return new me(x(d({}, this._def), {
|
|
1793
1793
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1794
1794
|
}));
|
|
1795
1795
|
}
|
|
1796
1796
|
toLowerCase() {
|
|
1797
|
-
return new me(
|
|
1797
|
+
return new me(x(d({}, this._def), {
|
|
1798
1798
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1799
1799
|
}));
|
|
1800
1800
|
}
|
|
1801
1801
|
toUpperCase() {
|
|
1802
|
-
return new me(
|
|
1802
|
+
return new me(x(d({}, this._def), {
|
|
1803
1803
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1804
1804
|
}));
|
|
1805
1805
|
}
|
|
@@ -1868,7 +1868,7 @@ me.create = (t) => {
|
|
|
1868
1868
|
var e;
|
|
1869
1869
|
return new me(d({
|
|
1870
1870
|
checks: [],
|
|
1871
|
-
typeName:
|
|
1871
|
+
typeName: E.ZodString,
|
|
1872
1872
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
1873
1873
|
}, O(t)));
|
|
1874
1874
|
};
|
|
@@ -1881,11 +1881,11 @@ class Le extends T {
|
|
|
1881
1881
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1882
1882
|
}
|
|
1883
1883
|
_parse(e) {
|
|
1884
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1884
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== _.number) {
|
|
1885
1885
|
const r = this._getOrReturnCtx(e);
|
|
1886
1886
|
return y(r, {
|
|
1887
1887
|
code: f.invalid_type,
|
|
1888
|
-
expected:
|
|
1888
|
+
expected: _.number,
|
|
1889
1889
|
received: r.parsedType
|
|
1890
1890
|
}), S;
|
|
1891
1891
|
}
|
|
@@ -1934,7 +1934,7 @@ class Le extends T {
|
|
|
1934
1934
|
return this.setLimit("max", e, !1, w.toString(n));
|
|
1935
1935
|
}
|
|
1936
1936
|
setLimit(e, n, s, r) {
|
|
1937
|
-
return new Le(
|
|
1937
|
+
return new Le(x(d({}, this._def), {
|
|
1938
1938
|
checks: [
|
|
1939
1939
|
...this._def.checks,
|
|
1940
1940
|
{
|
|
@@ -1947,7 +1947,7 @@ class Le extends T {
|
|
|
1947
1947
|
}));
|
|
1948
1948
|
}
|
|
1949
1949
|
_addCheck(e) {
|
|
1950
|
-
return new Le(
|
|
1950
|
+
return new Le(x(d({}, this._def), {
|
|
1951
1951
|
checks: [...this._def.checks, e]
|
|
1952
1952
|
}));
|
|
1953
1953
|
}
|
|
@@ -2042,7 +2042,7 @@ class Le extends T {
|
|
|
2042
2042
|
}
|
|
2043
2043
|
Le.create = (t) => new Le(d({
|
|
2044
2044
|
checks: [],
|
|
2045
|
-
typeName:
|
|
2045
|
+
typeName: E.ZodNumber,
|
|
2046
2046
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2047
2047
|
}, O(t)));
|
|
2048
2048
|
class $e extends T {
|
|
@@ -2056,7 +2056,7 @@ class $e extends T {
|
|
|
2056
2056
|
} catch (r) {
|
|
2057
2057
|
return this._getInvalidInput(e);
|
|
2058
2058
|
}
|
|
2059
|
-
if (this._getType(e) !==
|
|
2059
|
+
if (this._getType(e) !== _.bigint)
|
|
2060
2060
|
return this._getInvalidInput(e);
|
|
2061
2061
|
let n;
|
|
2062
2062
|
const s = new Y();
|
|
@@ -2084,7 +2084,7 @@ class $e extends T {
|
|
|
2084
2084
|
const n = this._getOrReturnCtx(e);
|
|
2085
2085
|
return y(n, {
|
|
2086
2086
|
code: f.invalid_type,
|
|
2087
|
-
expected:
|
|
2087
|
+
expected: _.bigint,
|
|
2088
2088
|
received: n.parsedType
|
|
2089
2089
|
}), S;
|
|
2090
2090
|
}
|
|
@@ -2101,7 +2101,7 @@ class $e extends T {
|
|
|
2101
2101
|
return this.setLimit("max", e, !1, w.toString(n));
|
|
2102
2102
|
}
|
|
2103
2103
|
setLimit(e, n, s, r) {
|
|
2104
|
-
return new $e(
|
|
2104
|
+
return new $e(x(d({}, this._def), {
|
|
2105
2105
|
checks: [
|
|
2106
2106
|
...this._def.checks,
|
|
2107
2107
|
{
|
|
@@ -2114,7 +2114,7 @@ class $e extends T {
|
|
|
2114
2114
|
}));
|
|
2115
2115
|
}
|
|
2116
2116
|
_addCheck(e) {
|
|
2117
|
-
return new $e(
|
|
2117
|
+
return new $e(x(d({}, this._def), {
|
|
2118
2118
|
checks: [...this._def.checks, e]
|
|
2119
2119
|
}));
|
|
2120
2120
|
}
|
|
@@ -2174,34 +2174,34 @@ $e.create = (t) => {
|
|
|
2174
2174
|
var e;
|
|
2175
2175
|
return new $e(d({
|
|
2176
2176
|
checks: [],
|
|
2177
|
-
typeName:
|
|
2177
|
+
typeName: E.ZodBigInt,
|
|
2178
2178
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
2179
2179
|
}, O(t)));
|
|
2180
2180
|
};
|
|
2181
|
-
class
|
|
2181
|
+
class jt extends T {
|
|
2182
2182
|
_parse(e) {
|
|
2183
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
2183
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== _.boolean) {
|
|
2184
2184
|
const n = this._getOrReturnCtx(e);
|
|
2185
2185
|
return y(n, {
|
|
2186
2186
|
code: f.invalid_type,
|
|
2187
|
-
expected:
|
|
2187
|
+
expected: _.boolean,
|
|
2188
2188
|
received: n.parsedType
|
|
2189
2189
|
}), S;
|
|
2190
2190
|
}
|
|
2191
2191
|
return ne(e.data);
|
|
2192
2192
|
}
|
|
2193
2193
|
}
|
|
2194
|
-
|
|
2195
|
-
typeName:
|
|
2194
|
+
jt.create = (t) => new jt(d({
|
|
2195
|
+
typeName: E.ZodBoolean,
|
|
2196
2196
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2197
2197
|
}, O(t)));
|
|
2198
2198
|
class Qe extends T {
|
|
2199
2199
|
_parse(e) {
|
|
2200
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
2200
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== _.date) {
|
|
2201
2201
|
const r = this._getOrReturnCtx(e);
|
|
2202
2202
|
return y(r, {
|
|
2203
2203
|
code: f.invalid_type,
|
|
2204
|
-
expected:
|
|
2204
|
+
expected: _.date,
|
|
2205
2205
|
received: r.parsedType
|
|
2206
2206
|
}), S;
|
|
2207
2207
|
}
|
|
@@ -2235,7 +2235,7 @@ class Qe extends T {
|
|
|
2235
2235
|
};
|
|
2236
2236
|
}
|
|
2237
2237
|
_addCheck(e) {
|
|
2238
|
-
return new Qe(
|
|
2238
|
+
return new Qe(x(d({}, this._def), {
|
|
2239
2239
|
checks: [...this._def.checks, e]
|
|
2240
2240
|
}));
|
|
2241
2241
|
}
|
|
@@ -2269,15 +2269,15 @@ class Qe extends T {
|
|
|
2269
2269
|
Qe.create = (t) => new Qe(d({
|
|
2270
2270
|
checks: [],
|
|
2271
2271
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
2272
|
-
typeName:
|
|
2272
|
+
typeName: E.ZodDate
|
|
2273
2273
|
}, O(t)));
|
|
2274
2274
|
class mn extends T {
|
|
2275
2275
|
_parse(e) {
|
|
2276
|
-
if (this._getType(e) !==
|
|
2276
|
+
if (this._getType(e) !== _.symbol) {
|
|
2277
2277
|
const n = this._getOrReturnCtx(e);
|
|
2278
2278
|
return y(n, {
|
|
2279
2279
|
code: f.invalid_type,
|
|
2280
|
-
expected:
|
|
2280
|
+
expected: _.symbol,
|
|
2281
2281
|
received: n.parsedType
|
|
2282
2282
|
}), S;
|
|
2283
2283
|
}
|
|
@@ -2285,31 +2285,31 @@ class mn extends T {
|
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
2287
|
mn.create = (t) => new mn(d({
|
|
2288
|
-
typeName:
|
|
2288
|
+
typeName: E.ZodSymbol
|
|
2289
2289
|
}, O(t)));
|
|
2290
|
-
class
|
|
2290
|
+
class It extends T {
|
|
2291
2291
|
_parse(e) {
|
|
2292
|
-
if (this._getType(e) !==
|
|
2292
|
+
if (this._getType(e) !== _.undefined) {
|
|
2293
2293
|
const n = this._getOrReturnCtx(e);
|
|
2294
2294
|
return y(n, {
|
|
2295
2295
|
code: f.invalid_type,
|
|
2296
|
-
expected:
|
|
2296
|
+
expected: _.undefined,
|
|
2297
2297
|
received: n.parsedType
|
|
2298
2298
|
}), S;
|
|
2299
2299
|
}
|
|
2300
2300
|
return ne(e.data);
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
|
-
|
|
2304
|
-
typeName:
|
|
2303
|
+
It.create = (t) => new It(d({
|
|
2304
|
+
typeName: E.ZodUndefined
|
|
2305
2305
|
}, O(t)));
|
|
2306
2306
|
class Zt extends T {
|
|
2307
2307
|
_parse(e) {
|
|
2308
|
-
if (this._getType(e) !==
|
|
2308
|
+
if (this._getType(e) !== _.null) {
|
|
2309
2309
|
const n = this._getOrReturnCtx(e);
|
|
2310
2310
|
return y(n, {
|
|
2311
2311
|
code: f.invalid_type,
|
|
2312
|
-
expected:
|
|
2312
|
+
expected: _.null,
|
|
2313
2313
|
received: n.parsedType
|
|
2314
2314
|
}), S;
|
|
2315
2315
|
}
|
|
@@ -2317,7 +2317,7 @@ class Zt extends T {
|
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
2319
|
Zt.create = (t) => new Zt(d({
|
|
2320
|
-
typeName:
|
|
2320
|
+
typeName: E.ZodNull
|
|
2321
2321
|
}, O(t)));
|
|
2322
2322
|
class gt extends T {
|
|
2323
2323
|
constructor() {
|
|
@@ -2328,7 +2328,7 @@ class gt extends T {
|
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
2330
|
gt.create = (t) => new gt(d({
|
|
2331
|
-
typeName:
|
|
2331
|
+
typeName: E.ZodAny
|
|
2332
2332
|
}, O(t)));
|
|
2333
2333
|
class Xe extends T {
|
|
2334
2334
|
constructor() {
|
|
@@ -2339,28 +2339,28 @@ class Xe extends T {
|
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
2341
|
Xe.create = (t) => new Xe(d({
|
|
2342
|
-
typeName:
|
|
2342
|
+
typeName: E.ZodUnknown
|
|
2343
2343
|
}, O(t)));
|
|
2344
2344
|
class Pe extends T {
|
|
2345
2345
|
_parse(e) {
|
|
2346
2346
|
const n = this._getOrReturnCtx(e);
|
|
2347
2347
|
return y(n, {
|
|
2348
2348
|
code: f.invalid_type,
|
|
2349
|
-
expected:
|
|
2349
|
+
expected: _.never,
|
|
2350
2350
|
received: n.parsedType
|
|
2351
2351
|
}), S;
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
2354
|
Pe.create = (t) => new Pe(d({
|
|
2355
|
-
typeName:
|
|
2355
|
+
typeName: E.ZodNever
|
|
2356
2356
|
}, O(t)));
|
|
2357
2357
|
class yn extends T {
|
|
2358
2358
|
_parse(e) {
|
|
2359
|
-
if (this._getType(e) !==
|
|
2359
|
+
if (this._getType(e) !== _.undefined) {
|
|
2360
2360
|
const n = this._getOrReturnCtx(e);
|
|
2361
2361
|
return y(n, {
|
|
2362
2362
|
code: f.invalid_type,
|
|
2363
|
-
expected:
|
|
2363
|
+
expected: _.void,
|
|
2364
2364
|
received: n.parsedType
|
|
2365
2365
|
}), S;
|
|
2366
2366
|
}
|
|
@@ -2368,15 +2368,15 @@ class yn extends T {
|
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
2370
|
yn.create = (t) => new yn(d({
|
|
2371
|
-
typeName:
|
|
2371
|
+
typeName: E.ZodVoid
|
|
2372
2372
|
}, O(t)));
|
|
2373
2373
|
class ye extends T {
|
|
2374
2374
|
_parse(e) {
|
|
2375
2375
|
const { ctx: n, status: s } = this._processInputParams(e), r = this._def;
|
|
2376
|
-
if (n.parsedType !==
|
|
2376
|
+
if (n.parsedType !== _.array)
|
|
2377
2377
|
return y(n, {
|
|
2378
2378
|
code: f.invalid_type,
|
|
2379
|
-
expected:
|
|
2379
|
+
expected: _.array,
|
|
2380
2380
|
received: n.parsedType
|
|
2381
2381
|
}), S;
|
|
2382
2382
|
if (r.exactLength !== null) {
|
|
@@ -2406,25 +2406,25 @@ class ye extends T {
|
|
|
2406
2406
|
exact: !1,
|
|
2407
2407
|
message: r.maxLength.message
|
|
2408
2408
|
}), s.dirty()), n.common.async)
|
|
2409
|
-
return Promise.all([...n.data].map((i, o) => r.type._parseAsync(new
|
|
2410
|
-
const a = [...n.data].map((i, o) => r.type._parseSync(new
|
|
2409
|
+
return Promise.all([...n.data].map((i, o) => r.type._parseAsync(new xe(n, i, n.path, o)))).then((i) => Y.mergeArray(s, i));
|
|
2410
|
+
const a = [...n.data].map((i, o) => r.type._parseSync(new xe(n, i, n.path, o)));
|
|
2411
2411
|
return Y.mergeArray(s, a);
|
|
2412
2412
|
}
|
|
2413
2413
|
get element() {
|
|
2414
2414
|
return this._def.type;
|
|
2415
2415
|
}
|
|
2416
2416
|
min(e, n) {
|
|
2417
|
-
return new ye(
|
|
2417
|
+
return new ye(x(d({}, this._def), {
|
|
2418
2418
|
minLength: { value: e, message: w.toString(n) }
|
|
2419
2419
|
}));
|
|
2420
2420
|
}
|
|
2421
2421
|
max(e, n) {
|
|
2422
|
-
return new ye(
|
|
2422
|
+
return new ye(x(d({}, this._def), {
|
|
2423
2423
|
maxLength: { value: e, message: w.toString(n) }
|
|
2424
2424
|
}));
|
|
2425
2425
|
}
|
|
2426
2426
|
length(e, n) {
|
|
2427
|
-
return new ye(
|
|
2427
|
+
return new ye(x(d({}, this._def), {
|
|
2428
2428
|
exactLength: { value: e, message: w.toString(n) }
|
|
2429
2429
|
}));
|
|
2430
2430
|
}
|
|
@@ -2437,23 +2437,23 @@ ye.create = (t, e) => new ye(d({
|
|
|
2437
2437
|
minLength: null,
|
|
2438
2438
|
maxLength: null,
|
|
2439
2439
|
exactLength: null,
|
|
2440
|
-
typeName:
|
|
2440
|
+
typeName: E.ZodArray
|
|
2441
2441
|
}, O(e)));
|
|
2442
2442
|
function ct(t) {
|
|
2443
|
-
if (t instanceof
|
|
2443
|
+
if (t instanceof V) {
|
|
2444
2444
|
const e = {};
|
|
2445
2445
|
for (const n in t.shape) {
|
|
2446
2446
|
const s = t.shape[n];
|
|
2447
2447
|
e[n] = ke.create(ct(s));
|
|
2448
2448
|
}
|
|
2449
|
-
return new
|
|
2449
|
+
return new V(x(d({}, t._def), {
|
|
2450
2450
|
shape: () => e
|
|
2451
2451
|
}));
|
|
2452
|
-
} else return t instanceof ye ? new ye(
|
|
2452
|
+
} else return t instanceof ye ? new ye(x(d({}, t._def), {
|
|
2453
2453
|
type: ct(t.element)
|
|
2454
2454
|
})) : t instanceof ke ? ke.create(ct(t.unwrap())) : t instanceof We ? We.create(ct(t.unwrap())) : t instanceof Se ? Se.create(t.items.map((e) => ct(e))) : t;
|
|
2455
2455
|
}
|
|
2456
|
-
class
|
|
2456
|
+
class V extends T {
|
|
2457
2457
|
constructor() {
|
|
2458
2458
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2459
2459
|
}
|
|
@@ -2464,11 +2464,11 @@ class U extends T {
|
|
|
2464
2464
|
return this._cached = { shape: e, keys: n };
|
|
2465
2465
|
}
|
|
2466
2466
|
_parse(e) {
|
|
2467
|
-
if (this._getType(e) !==
|
|
2467
|
+
if (this._getType(e) !== _.object) {
|
|
2468
2468
|
const c = this._getOrReturnCtx(e);
|
|
2469
2469
|
return y(c, {
|
|
2470
2470
|
code: f.invalid_type,
|
|
2471
|
-
expected:
|
|
2471
|
+
expected: _.object,
|
|
2472
2472
|
received: c.parsedType
|
|
2473
2473
|
}), S;
|
|
2474
2474
|
}
|
|
@@ -2481,7 +2481,7 @@ class U extends T {
|
|
|
2481
2481
|
const u = r[c], h = s.data[c];
|
|
2482
2482
|
o.push({
|
|
2483
2483
|
key: { status: "valid", value: c },
|
|
2484
|
-
value: u._parse(new
|
|
2484
|
+
value: u._parse(new xe(s, h, s.path, c)),
|
|
2485
2485
|
alwaysSet: c in s.data
|
|
2486
2486
|
});
|
|
2487
2487
|
}
|
|
@@ -2506,14 +2506,14 @@ class U extends T {
|
|
|
2506
2506
|
o.push({
|
|
2507
2507
|
key: { status: "valid", value: u },
|
|
2508
2508
|
value: c._parse(
|
|
2509
|
-
new
|
|
2509
|
+
new xe(s, h, s.path, u)
|
|
2510
2510
|
//, ctx.child(key), value, getParsedType(value)
|
|
2511
2511
|
),
|
|
2512
2512
|
alwaysSet: u in s.data
|
|
2513
2513
|
});
|
|
2514
2514
|
}
|
|
2515
2515
|
}
|
|
2516
|
-
return s.common.async ? Promise.resolve().then(() =>
|
|
2516
|
+
return s.common.async ? Promise.resolve().then(() => Ee(this, null, function* () {
|
|
2517
2517
|
const c = [];
|
|
2518
2518
|
for (const u of o) {
|
|
2519
2519
|
const h = yield u.key, p = yield u.value;
|
|
@@ -2530,7 +2530,7 @@ class U extends T {
|
|
|
2530
2530
|
return this._def.shape();
|
|
2531
2531
|
}
|
|
2532
2532
|
strict(e) {
|
|
2533
|
-
return w.errToObj, new
|
|
2533
|
+
return w.errToObj, new V(d(x(d({}, this._def), {
|
|
2534
2534
|
unknownKeys: "strict"
|
|
2535
2535
|
}), e !== void 0 ? {
|
|
2536
2536
|
errorMap: (n, s) => {
|
|
@@ -2545,12 +2545,12 @@ class U extends T {
|
|
|
2545
2545
|
} : {}));
|
|
2546
2546
|
}
|
|
2547
2547
|
strip() {
|
|
2548
|
-
return new
|
|
2548
|
+
return new V(x(d({}, this._def), {
|
|
2549
2549
|
unknownKeys: "strip"
|
|
2550
2550
|
}));
|
|
2551
2551
|
}
|
|
2552
2552
|
passthrough() {
|
|
2553
|
-
return new
|
|
2553
|
+
return new V(x(d({}, this._def), {
|
|
2554
2554
|
unknownKeys: "passthrough"
|
|
2555
2555
|
}));
|
|
2556
2556
|
}
|
|
@@ -2572,7 +2572,7 @@ class U extends T {
|
|
|
2572
2572
|
// }) as any;
|
|
2573
2573
|
// };
|
|
2574
2574
|
extend(e) {
|
|
2575
|
-
return new
|
|
2575
|
+
return new V(x(d({}, this._def), {
|
|
2576
2576
|
shape: () => d(d({}, this._def.shape()), e)
|
|
2577
2577
|
}));
|
|
2578
2578
|
}
|
|
@@ -2582,11 +2582,11 @@ class U extends T {
|
|
|
2582
2582
|
* upgrade if you are experiencing issues.
|
|
2583
2583
|
*/
|
|
2584
2584
|
merge(e) {
|
|
2585
|
-
return new
|
|
2585
|
+
return new V({
|
|
2586
2586
|
unknownKeys: e._def.unknownKeys,
|
|
2587
2587
|
catchall: e._def.catchall,
|
|
2588
2588
|
shape: () => d(d({}, this._def.shape()), e._def.shape()),
|
|
2589
|
-
typeName:
|
|
2589
|
+
typeName: E.ZodObject
|
|
2590
2590
|
});
|
|
2591
2591
|
}
|
|
2592
2592
|
// merge<
|
|
@@ -2649,7 +2649,7 @@ class U extends T {
|
|
|
2649
2649
|
// return merged;
|
|
2650
2650
|
// }
|
|
2651
2651
|
catchall(e) {
|
|
2652
|
-
return new
|
|
2652
|
+
return new V(x(d({}, this._def), {
|
|
2653
2653
|
catchall: e
|
|
2654
2654
|
}));
|
|
2655
2655
|
}
|
|
@@ -2657,7 +2657,7 @@ class U extends T {
|
|
|
2657
2657
|
const n = {};
|
|
2658
2658
|
return N.objectKeys(e).forEach((s) => {
|
|
2659
2659
|
e[s] && this.shape[s] && (n[s] = this.shape[s]);
|
|
2660
|
-
}), new
|
|
2660
|
+
}), new V(x(d({}, this._def), {
|
|
2661
2661
|
shape: () => n
|
|
2662
2662
|
}));
|
|
2663
2663
|
}
|
|
@@ -2665,7 +2665,7 @@ class U extends T {
|
|
|
2665
2665
|
const n = {};
|
|
2666
2666
|
return N.objectKeys(this.shape).forEach((s) => {
|
|
2667
2667
|
e[s] || (n[s] = this.shape[s]);
|
|
2668
|
-
}), new
|
|
2668
|
+
}), new V(x(d({}, this._def), {
|
|
2669
2669
|
shape: () => n
|
|
2670
2670
|
}));
|
|
2671
2671
|
}
|
|
@@ -2680,7 +2680,7 @@ class U extends T {
|
|
|
2680
2680
|
return N.objectKeys(this.shape).forEach((s) => {
|
|
2681
2681
|
const r = this.shape[s];
|
|
2682
2682
|
e && !e[s] ? n[s] = r : n[s] = r.optional();
|
|
2683
|
-
}), new
|
|
2683
|
+
}), new V(x(d({}, this._def), {
|
|
2684
2684
|
shape: () => n
|
|
2685
2685
|
}));
|
|
2686
2686
|
}
|
|
@@ -2695,7 +2695,7 @@ class U extends T {
|
|
|
2695
2695
|
r = r._def.innerType;
|
|
2696
2696
|
n[s] = r;
|
|
2697
2697
|
}
|
|
2698
|
-
}), new
|
|
2698
|
+
}), new V(x(d({}, this._def), {
|
|
2699
2699
|
shape: () => n
|
|
2700
2700
|
}));
|
|
2701
2701
|
}
|
|
@@ -2703,23 +2703,23 @@ class U extends T {
|
|
|
2703
2703
|
return Dr(N.objectKeys(this.shape));
|
|
2704
2704
|
}
|
|
2705
2705
|
}
|
|
2706
|
-
|
|
2706
|
+
V.create = (t, e) => new V(d({
|
|
2707
2707
|
shape: () => t,
|
|
2708
2708
|
unknownKeys: "strip",
|
|
2709
2709
|
catchall: Pe.create(),
|
|
2710
|
-
typeName:
|
|
2710
|
+
typeName: E.ZodObject
|
|
2711
2711
|
}, O(e)));
|
|
2712
|
-
|
|
2712
|
+
V.strictCreate = (t, e) => new V(d({
|
|
2713
2713
|
shape: () => t,
|
|
2714
2714
|
unknownKeys: "strict",
|
|
2715
2715
|
catchall: Pe.create(),
|
|
2716
|
-
typeName:
|
|
2716
|
+
typeName: E.ZodObject
|
|
2717
2717
|
}, O(e)));
|
|
2718
|
-
|
|
2718
|
+
V.lazycreate = (t, e) => new V(d({
|
|
2719
2719
|
shape: t,
|
|
2720
2720
|
unknownKeys: "strip",
|
|
2721
2721
|
catchall: Pe.create(),
|
|
2722
|
-
typeName:
|
|
2722
|
+
typeName: E.ZodObject
|
|
2723
2723
|
}, O(e)));
|
|
2724
2724
|
class Dt extends T {
|
|
2725
2725
|
_parse(e) {
|
|
@@ -2738,9 +2738,9 @@ class Dt extends T {
|
|
|
2738
2738
|
}), S;
|
|
2739
2739
|
}
|
|
2740
2740
|
if (n.common.async)
|
|
2741
|
-
return Promise.all(s.map((a) =>
|
|
2742
|
-
const i =
|
|
2743
|
-
common:
|
|
2741
|
+
return Promise.all(s.map((a) => Ee(this, null, function* () {
|
|
2742
|
+
const i = x(d({}, n), {
|
|
2743
|
+
common: x(d({}, n.common), {
|
|
2744
2744
|
issues: []
|
|
2745
2745
|
}),
|
|
2746
2746
|
parent: null
|
|
@@ -2758,8 +2758,8 @@ class Dt extends T {
|
|
|
2758
2758
|
let a;
|
|
2759
2759
|
const i = [];
|
|
2760
2760
|
for (const c of s) {
|
|
2761
|
-
const u =
|
|
2762
|
-
common:
|
|
2761
|
+
const u = x(d({}, n), {
|
|
2762
|
+
common: x(d({}, n.common), {
|
|
2763
2763
|
issues: []
|
|
2764
2764
|
}),
|
|
2765
2765
|
parent: null
|
|
@@ -2787,16 +2787,16 @@ class Dt extends T {
|
|
|
2787
2787
|
}
|
|
2788
2788
|
Dt.create = (t, e) => new Dt(d({
|
|
2789
2789
|
options: t,
|
|
2790
|
-
typeName:
|
|
2790
|
+
typeName: E.ZodUnion
|
|
2791
2791
|
}, O(e)));
|
|
2792
|
-
const Ze = (t) => t instanceof $t ? Ze(t.schema) : t instanceof ge ? Ze(t.innerType()) : t instanceof Ft ? [t.value] : t instanceof Fe ? t.options : t instanceof Wt ? N.objectValues(t.enum) : t instanceof
|
|
2793
|
-
class
|
|
2792
|
+
const Ze = (t) => t instanceof $t ? Ze(t.schema) : t instanceof ge ? Ze(t.innerType()) : t instanceof Ft ? [t.value] : t instanceof Fe ? t.options : t instanceof Wt ? N.objectValues(t.enum) : t instanceof Vt ? Ze(t._def.innerType) : t instanceof It ? [void 0] : t instanceof Zt ? [null] : t instanceof ke ? [void 0, ...Ze(t.unwrap())] : t instanceof We ? [null, ...Ze(t.unwrap())] : t instanceof Ns || t instanceof zt ? Ze(t.unwrap()) : t instanceof Ut ? Ze(t._def.innerType) : [];
|
|
2793
|
+
class En extends T {
|
|
2794
2794
|
_parse(e) {
|
|
2795
2795
|
const { ctx: n } = this._processInputParams(e);
|
|
2796
|
-
if (n.parsedType !==
|
|
2796
|
+
if (n.parsedType !== _.object)
|
|
2797
2797
|
return y(n, {
|
|
2798
2798
|
code: f.invalid_type,
|
|
2799
|
-
expected:
|
|
2799
|
+
expected: _.object,
|
|
2800
2800
|
received: n.parsedType
|
|
2801
2801
|
}), S;
|
|
2802
2802
|
const s = this.discriminator, r = n.data[s], a = this.optionsMap.get(r);
|
|
@@ -2843,8 +2843,8 @@ class xn extends T {
|
|
|
2843
2843
|
r.set(o, a);
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
|
-
return new
|
|
2847
|
-
typeName:
|
|
2846
|
+
return new En(d({
|
|
2847
|
+
typeName: E.ZodDiscriminatedUnion,
|
|
2848
2848
|
discriminator: e,
|
|
2849
2849
|
options: n,
|
|
2850
2850
|
optionsMap: r
|
|
@@ -2855,7 +2855,7 @@ function rs(t, e) {
|
|
|
2855
2855
|
const n = Ne(t), s = Ne(e);
|
|
2856
2856
|
if (t === e)
|
|
2857
2857
|
return { valid: !0, data: t };
|
|
2858
|
-
if (n ===
|
|
2858
|
+
if (n === _.object && s === _.object) {
|
|
2859
2859
|
const r = N.objectKeys(e), a = N.objectKeys(t).filter((o) => r.indexOf(o) !== -1), i = d(d({}, t), e);
|
|
2860
2860
|
for (const o of a) {
|
|
2861
2861
|
const c = rs(t[o], e[o]);
|
|
@@ -2864,7 +2864,7 @@ function rs(t, e) {
|
|
|
2864
2864
|
i[o] = c.data;
|
|
2865
2865
|
}
|
|
2866
2866
|
return { valid: !0, data: i };
|
|
2867
|
-
} else if (n ===
|
|
2867
|
+
} else if (n === _.array && s === _.array) {
|
|
2868
2868
|
if (t.length !== e.length)
|
|
2869
2869
|
return { valid: !1 };
|
|
2870
2870
|
const r = [];
|
|
@@ -2875,7 +2875,7 @@ function rs(t, e) {
|
|
|
2875
2875
|
r.push(c.data);
|
|
2876
2876
|
}
|
|
2877
2877
|
return { valid: !0, data: r };
|
|
2878
|
-
} else return n ===
|
|
2878
|
+
} else return n === _.date && s === _.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
2879
2879
|
}
|
|
2880
2880
|
class Mt extends T {
|
|
2881
2881
|
_parse(e) {
|
|
@@ -2912,15 +2912,15 @@ class Mt extends T {
|
|
|
2912
2912
|
Mt.create = (t, e, n) => new Mt(d({
|
|
2913
2913
|
left: t,
|
|
2914
2914
|
right: e,
|
|
2915
|
-
typeName:
|
|
2915
|
+
typeName: E.ZodIntersection
|
|
2916
2916
|
}, O(n)));
|
|
2917
2917
|
class Se extends T {
|
|
2918
2918
|
_parse(e) {
|
|
2919
2919
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2920
|
-
if (s.parsedType !==
|
|
2920
|
+
if (s.parsedType !== _.array)
|
|
2921
2921
|
return y(s, {
|
|
2922
2922
|
code: f.invalid_type,
|
|
2923
|
-
expected:
|
|
2923
|
+
expected: _.array,
|
|
2924
2924
|
received: s.parsedType
|
|
2925
2925
|
}), S;
|
|
2926
2926
|
if (s.data.length < this._def.items.length)
|
|
@@ -2940,7 +2940,7 @@ class Se extends T {
|
|
|
2940
2940
|
}), n.dirty());
|
|
2941
2941
|
const r = [...s.data].map((a, i) => {
|
|
2942
2942
|
const o = this._def.items[i] || this._def.rest;
|
|
2943
|
-
return o ? o._parse(new
|
|
2943
|
+
return o ? o._parse(new xe(s, a, s.path, i)) : null;
|
|
2944
2944
|
}).filter((a) => !!a);
|
|
2945
2945
|
return s.common.async ? Promise.all(r).then((a) => Y.mergeArray(n, a)) : Y.mergeArray(n, r);
|
|
2946
2946
|
}
|
|
@@ -2948,7 +2948,7 @@ class Se extends T {
|
|
|
2948
2948
|
return this._def.items;
|
|
2949
2949
|
}
|
|
2950
2950
|
rest(e) {
|
|
2951
|
-
return new Se(
|
|
2951
|
+
return new Se(x(d({}, this._def), {
|
|
2952
2952
|
rest: e
|
|
2953
2953
|
}));
|
|
2954
2954
|
}
|
|
@@ -2958,7 +2958,7 @@ Se.create = (t, e) => {
|
|
|
2958
2958
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2959
2959
|
return new Se(d({
|
|
2960
2960
|
items: t,
|
|
2961
|
-
typeName:
|
|
2961
|
+
typeName: E.ZodTuple,
|
|
2962
2962
|
rest: null
|
|
2963
2963
|
}, O(e)));
|
|
2964
2964
|
};
|
|
@@ -2971,17 +2971,17 @@ class Lt extends T {
|
|
|
2971
2971
|
}
|
|
2972
2972
|
_parse(e) {
|
|
2973
2973
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2974
|
-
if (s.parsedType !==
|
|
2974
|
+
if (s.parsedType !== _.object)
|
|
2975
2975
|
return y(s, {
|
|
2976
2976
|
code: f.invalid_type,
|
|
2977
|
-
expected:
|
|
2977
|
+
expected: _.object,
|
|
2978
2978
|
received: s.parsedType
|
|
2979
2979
|
}), S;
|
|
2980
2980
|
const r = [], a = this._def.keyType, i = this._def.valueType;
|
|
2981
2981
|
for (const o in s.data)
|
|
2982
2982
|
r.push({
|
|
2983
|
-
key: a._parse(new
|
|
2984
|
-
value: i._parse(new
|
|
2983
|
+
key: a._parse(new xe(s, o, s.path, o)),
|
|
2984
|
+
value: i._parse(new xe(s, s.data[o], s.path, o)),
|
|
2985
2985
|
alwaysSet: o in s.data
|
|
2986
2986
|
});
|
|
2987
2987
|
return s.common.async ? Y.mergeObjectAsync(n, r) : Y.mergeObjectSync(n, r);
|
|
@@ -2993,11 +2993,11 @@ class Lt extends T {
|
|
|
2993
2993
|
return n instanceof T ? new Lt(d({
|
|
2994
2994
|
keyType: e,
|
|
2995
2995
|
valueType: n,
|
|
2996
|
-
typeName:
|
|
2996
|
+
typeName: E.ZodRecord
|
|
2997
2997
|
}, O(s))) : new Lt(d({
|
|
2998
2998
|
keyType: me.create(),
|
|
2999
2999
|
valueType: e,
|
|
3000
|
-
typeName:
|
|
3000
|
+
typeName: E.ZodRecord
|
|
3001
3001
|
}, O(n)));
|
|
3002
3002
|
}
|
|
3003
3003
|
}
|
|
@@ -3010,19 +3010,19 @@ class gn extends T {
|
|
|
3010
3010
|
}
|
|
3011
3011
|
_parse(e) {
|
|
3012
3012
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
3013
|
-
if (s.parsedType !==
|
|
3013
|
+
if (s.parsedType !== _.map)
|
|
3014
3014
|
return y(s, {
|
|
3015
3015
|
code: f.invalid_type,
|
|
3016
|
-
expected:
|
|
3016
|
+
expected: _.map,
|
|
3017
3017
|
received: s.parsedType
|
|
3018
3018
|
}), S;
|
|
3019
3019
|
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
|
|
3020
|
-
key: r._parse(new
|
|
3021
|
-
value: a._parse(new
|
|
3020
|
+
key: r._parse(new xe(s, o, s.path, [u, "key"])),
|
|
3021
|
+
value: a._parse(new xe(s, c, s.path, [u, "value"]))
|
|
3022
3022
|
}));
|
|
3023
3023
|
if (s.common.async) {
|
|
3024
3024
|
const o = /* @__PURE__ */ new Map();
|
|
3025
|
-
return Promise.resolve().then(() =>
|
|
3025
|
+
return Promise.resolve().then(() => Ee(this, null, function* () {
|
|
3026
3026
|
for (const c of i) {
|
|
3027
3027
|
const u = yield c.key, h = yield c.value;
|
|
3028
3028
|
if (u.status === "aborted" || h.status === "aborted")
|
|
@@ -3046,15 +3046,15 @@ class gn extends T {
|
|
|
3046
3046
|
gn.create = (t, e, n) => new gn(d({
|
|
3047
3047
|
valueType: e,
|
|
3048
3048
|
keyType: t,
|
|
3049
|
-
typeName:
|
|
3049
|
+
typeName: E.ZodMap
|
|
3050
3050
|
}, O(n)));
|
|
3051
3051
|
class et extends T {
|
|
3052
3052
|
_parse(e) {
|
|
3053
3053
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
3054
|
-
if (s.parsedType !==
|
|
3054
|
+
if (s.parsedType !== _.set)
|
|
3055
3055
|
return y(s, {
|
|
3056
3056
|
code: f.invalid_type,
|
|
3057
|
-
expected:
|
|
3057
|
+
expected: _.set,
|
|
3058
3058
|
received: s.parsedType
|
|
3059
3059
|
}), S;
|
|
3060
3060
|
const r = this._def;
|
|
@@ -3083,16 +3083,16 @@ class et extends T {
|
|
|
3083
3083
|
}
|
|
3084
3084
|
return { status: n.value, value: u };
|
|
3085
3085
|
}
|
|
3086
|
-
const o = [...s.data.values()].map((c, u) => a._parse(new
|
|
3086
|
+
const o = [...s.data.values()].map((c, u) => a._parse(new xe(s, c, s.path, u)));
|
|
3087
3087
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3088
3088
|
}
|
|
3089
3089
|
min(e, n) {
|
|
3090
|
-
return new et(
|
|
3090
|
+
return new et(x(d({}, this._def), {
|
|
3091
3091
|
minSize: { value: e, message: w.toString(n) }
|
|
3092
3092
|
}));
|
|
3093
3093
|
}
|
|
3094
3094
|
max(e, n) {
|
|
3095
|
-
return new et(
|
|
3095
|
+
return new et(x(d({}, this._def), {
|
|
3096
3096
|
maxSize: { value: e, message: w.toString(n) }
|
|
3097
3097
|
}));
|
|
3098
3098
|
}
|
|
@@ -3107,7 +3107,7 @@ et.create = (t, e) => new et(d({
|
|
|
3107
3107
|
valueType: t,
|
|
3108
3108
|
minSize: null,
|
|
3109
3109
|
maxSize: null,
|
|
3110
|
-
typeName:
|
|
3110
|
+
typeName: E.ZodSet
|
|
3111
3111
|
}, O(e)));
|
|
3112
3112
|
class ht extends T {
|
|
3113
3113
|
constructor() {
|
|
@@ -3115,10 +3115,10 @@ class ht extends T {
|
|
|
3115
3115
|
}
|
|
3116
3116
|
_parse(e) {
|
|
3117
3117
|
const { ctx: n } = this._processInputParams(e);
|
|
3118
|
-
if (n.parsedType !==
|
|
3118
|
+
if (n.parsedType !== _.function)
|
|
3119
3119
|
return y(n, {
|
|
3120
3120
|
code: f.invalid_type,
|
|
3121
|
-
expected:
|
|
3121
|
+
expected: _.function,
|
|
3122
3122
|
received: n.parsedType
|
|
3123
3123
|
}), S;
|
|
3124
3124
|
function s(o, c) {
|
|
@@ -3157,7 +3157,7 @@ class ht extends T {
|
|
|
3157
3157
|
if (this._def.returns instanceof vt) {
|
|
3158
3158
|
const o = this;
|
|
3159
3159
|
return ne(function(...c) {
|
|
3160
|
-
return
|
|
3160
|
+
return Ee(this, null, function* () {
|
|
3161
3161
|
const u = new oe([]), h = yield o._def.args.parseAsync(c, a).catch((k) => {
|
|
3162
3162
|
throw u.addIssue(s(c, k)), u;
|
|
3163
3163
|
}), p = yield Reflect.apply(i, this, h);
|
|
@@ -3186,12 +3186,12 @@ class ht extends T {
|
|
|
3186
3186
|
return this._def.returns;
|
|
3187
3187
|
}
|
|
3188
3188
|
args(...e) {
|
|
3189
|
-
return new ht(
|
|
3189
|
+
return new ht(x(d({}, this._def), {
|
|
3190
3190
|
args: Se.create(e).rest(Xe.create())
|
|
3191
3191
|
}));
|
|
3192
3192
|
}
|
|
3193
3193
|
returns(e) {
|
|
3194
|
-
return new ht(
|
|
3194
|
+
return new ht(x(d({}, this._def), {
|
|
3195
3195
|
returns: e
|
|
3196
3196
|
}));
|
|
3197
3197
|
}
|
|
@@ -3205,7 +3205,7 @@ class ht extends T {
|
|
|
3205
3205
|
return new ht(d({
|
|
3206
3206
|
args: e || Se.create([]).rest(Xe.create()),
|
|
3207
3207
|
returns: n || Xe.create(),
|
|
3208
|
-
typeName:
|
|
3208
|
+
typeName: E.ZodFunction
|
|
3209
3209
|
}, O(s)));
|
|
3210
3210
|
}
|
|
3211
3211
|
}
|
|
@@ -3220,7 +3220,7 @@ class $t extends T {
|
|
|
3220
3220
|
}
|
|
3221
3221
|
$t.create = (t, e) => new $t(d({
|
|
3222
3222
|
getter: t,
|
|
3223
|
-
typeName:
|
|
3223
|
+
typeName: E.ZodLazy
|
|
3224
3224
|
}, O(e)));
|
|
3225
3225
|
class Ft extends T {
|
|
3226
3226
|
_parse(e) {
|
|
@@ -3240,12 +3240,12 @@ class Ft extends T {
|
|
|
3240
3240
|
}
|
|
3241
3241
|
Ft.create = (t, e) => new Ft(d({
|
|
3242
3242
|
value: t,
|
|
3243
|
-
typeName:
|
|
3243
|
+
typeName: E.ZodLiteral
|
|
3244
3244
|
}, O(e)));
|
|
3245
3245
|
function Dr(t, e) {
|
|
3246
3246
|
return new Fe(d({
|
|
3247
3247
|
values: t,
|
|
3248
|
-
typeName:
|
|
3248
|
+
typeName: E.ZodEnum
|
|
3249
3249
|
}, O(e)));
|
|
3250
3250
|
}
|
|
3251
3251
|
class Fe extends T {
|
|
@@ -3307,7 +3307,7 @@ class Wt extends T {
|
|
|
3307
3307
|
}
|
|
3308
3308
|
_parse(e) {
|
|
3309
3309
|
const n = N.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3310
|
-
if (s.parsedType !==
|
|
3310
|
+
if (s.parsedType !== _.string && s.parsedType !== _.number) {
|
|
3311
3311
|
const r = N.objectValues(n);
|
|
3312
3312
|
return y(s, {
|
|
3313
3313
|
expected: N.joinValues(r),
|
|
@@ -3332,7 +3332,7 @@ class Wt extends T {
|
|
|
3332
3332
|
Tt = /* @__PURE__ */ new WeakMap();
|
|
3333
3333
|
Wt.create = (t, e) => new Wt(d({
|
|
3334
3334
|
values: t,
|
|
3335
|
-
typeName:
|
|
3335
|
+
typeName: E.ZodNativeEnum
|
|
3336
3336
|
}, O(e)));
|
|
3337
3337
|
class vt extends T {
|
|
3338
3338
|
unwrap() {
|
|
@@ -3340,13 +3340,13 @@ class vt extends T {
|
|
|
3340
3340
|
}
|
|
3341
3341
|
_parse(e) {
|
|
3342
3342
|
const { ctx: n } = this._processInputParams(e);
|
|
3343
|
-
if (n.parsedType !==
|
|
3343
|
+
if (n.parsedType !== _.promise && n.common.async === !1)
|
|
3344
3344
|
return y(n, {
|
|
3345
3345
|
code: f.invalid_type,
|
|
3346
|
-
expected:
|
|
3346
|
+
expected: _.promise,
|
|
3347
3347
|
received: n.parsedType
|
|
3348
3348
|
}), S;
|
|
3349
|
-
const s = n.parsedType ===
|
|
3349
|
+
const s = n.parsedType === _.promise ? n.data : Promise.resolve(n.data);
|
|
3350
3350
|
return ne(s.then((r) => this._def.type.parseAsync(r, {
|
|
3351
3351
|
path: n.path,
|
|
3352
3352
|
errorMap: n.common.contextualErrorMap
|
|
@@ -3355,14 +3355,14 @@ class vt extends T {
|
|
|
3355
3355
|
}
|
|
3356
3356
|
vt.create = (t, e) => new vt(d({
|
|
3357
3357
|
type: t,
|
|
3358
|
-
typeName:
|
|
3358
|
+
typeName: E.ZodPromise
|
|
3359
3359
|
}, O(e)));
|
|
3360
3360
|
class ge extends T {
|
|
3361
3361
|
innerType() {
|
|
3362
3362
|
return this._def.schema;
|
|
3363
3363
|
}
|
|
3364
3364
|
sourceType() {
|
|
3365
|
-
return this._def.schema._def.typeName ===
|
|
3365
|
+
return this._def.schema._def.typeName === E.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3366
3366
|
}
|
|
3367
3367
|
_parse(e) {
|
|
3368
3368
|
const { status: n, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
|
|
@@ -3376,7 +3376,7 @@ class ge extends T {
|
|
|
3376
3376
|
if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
|
|
3377
3377
|
const i = r.transform(s.data, a);
|
|
3378
3378
|
if (s.common.async)
|
|
3379
|
-
return Promise.resolve(i).then((o) =>
|
|
3379
|
+
return Promise.resolve(i).then((o) => Ee(this, null, function* () {
|
|
3380
3380
|
if (n.value === "aborted")
|
|
3381
3381
|
return S;
|
|
3382
3382
|
const c = yield this._def.schema._parseAsync({
|
|
@@ -3436,17 +3436,17 @@ class ge extends T {
|
|
|
3436
3436
|
}
|
|
3437
3437
|
ge.create = (t, e, n) => new ge(d({
|
|
3438
3438
|
schema: t,
|
|
3439
|
-
typeName:
|
|
3439
|
+
typeName: E.ZodEffects,
|
|
3440
3440
|
effect: e
|
|
3441
3441
|
}, O(n)));
|
|
3442
3442
|
ge.createWithPreprocess = (t, e, n) => new ge(d({
|
|
3443
3443
|
schema: e,
|
|
3444
3444
|
effect: { type: "preprocess", transform: t },
|
|
3445
|
-
typeName:
|
|
3445
|
+
typeName: E.ZodEffects
|
|
3446
3446
|
}, O(n)));
|
|
3447
3447
|
class ke extends T {
|
|
3448
3448
|
_parse(e) {
|
|
3449
|
-
return this._getType(e) ===
|
|
3449
|
+
return this._getType(e) === _.undefined ? ne(void 0) : this._def.innerType._parse(e);
|
|
3450
3450
|
}
|
|
3451
3451
|
unwrap() {
|
|
3452
3452
|
return this._def.innerType;
|
|
@@ -3454,11 +3454,11 @@ class ke extends T {
|
|
|
3454
3454
|
}
|
|
3455
3455
|
ke.create = (t, e) => new ke(d({
|
|
3456
3456
|
innerType: t,
|
|
3457
|
-
typeName:
|
|
3457
|
+
typeName: E.ZodOptional
|
|
3458
3458
|
}, O(e)));
|
|
3459
3459
|
class We extends T {
|
|
3460
3460
|
_parse(e) {
|
|
3461
|
-
return this._getType(e) ===
|
|
3461
|
+
return this._getType(e) === _.null ? ne(null) : this._def.innerType._parse(e);
|
|
3462
3462
|
}
|
|
3463
3463
|
unwrap() {
|
|
3464
3464
|
return this._def.innerType;
|
|
@@ -3466,13 +3466,13 @@ class We extends T {
|
|
|
3466
3466
|
}
|
|
3467
3467
|
We.create = (t, e) => new We(d({
|
|
3468
3468
|
innerType: t,
|
|
3469
|
-
typeName:
|
|
3469
|
+
typeName: E.ZodNullable
|
|
3470
3470
|
}, O(e)));
|
|
3471
|
-
class
|
|
3471
|
+
class Vt extends T {
|
|
3472
3472
|
_parse(e) {
|
|
3473
3473
|
const { ctx: n } = this._processInputParams(e);
|
|
3474
3474
|
let s = n.data;
|
|
3475
|
-
return n.parsedType ===
|
|
3475
|
+
return n.parsedType === _.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
3476
3476
|
data: s,
|
|
3477
3477
|
path: n.path,
|
|
3478
3478
|
parent: n
|
|
@@ -3482,15 +3482,15 @@ class Ut extends T {
|
|
|
3482
3482
|
return this._def.innerType;
|
|
3483
3483
|
}
|
|
3484
3484
|
}
|
|
3485
|
-
|
|
3485
|
+
Vt.create = (t, e) => new Vt(d({
|
|
3486
3486
|
innerType: t,
|
|
3487
|
-
typeName:
|
|
3487
|
+
typeName: E.ZodDefault,
|
|
3488
3488
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3489
3489
|
}, O(e)));
|
|
3490
|
-
class
|
|
3490
|
+
class Ut extends T {
|
|
3491
3491
|
_parse(e) {
|
|
3492
|
-
const { ctx: n } = this._processInputParams(e), s =
|
|
3493
|
-
common:
|
|
3492
|
+
const { ctx: n } = this._processInputParams(e), s = x(d({}, n), {
|
|
3493
|
+
common: x(d({}, n.common), {
|
|
3494
3494
|
issues: []
|
|
3495
3495
|
})
|
|
3496
3496
|
}), r = this._def.innerType._parse({
|
|
@@ -3520,18 +3520,18 @@ class Vt extends T {
|
|
|
3520
3520
|
return this._def.innerType;
|
|
3521
3521
|
}
|
|
3522
3522
|
}
|
|
3523
|
-
|
|
3523
|
+
Ut.create = (t, e) => new Ut(d({
|
|
3524
3524
|
innerType: t,
|
|
3525
|
-
typeName:
|
|
3525
|
+
typeName: E.ZodCatch,
|
|
3526
3526
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3527
3527
|
}, O(e)));
|
|
3528
3528
|
class vn extends T {
|
|
3529
3529
|
_parse(e) {
|
|
3530
|
-
if (this._getType(e) !==
|
|
3530
|
+
if (this._getType(e) !== _.nan) {
|
|
3531
3531
|
const n = this._getOrReturnCtx(e);
|
|
3532
3532
|
return y(n, {
|
|
3533
3533
|
code: f.invalid_type,
|
|
3534
|
-
expected:
|
|
3534
|
+
expected: _.nan,
|
|
3535
3535
|
received: n.parsedType
|
|
3536
3536
|
}), S;
|
|
3537
3537
|
}
|
|
@@ -3539,7 +3539,7 @@ class vn extends T {
|
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
3541
3541
|
vn.create = (t) => new vn(d({
|
|
3542
|
-
typeName:
|
|
3542
|
+
typeName: E.ZodNaN
|
|
3543
3543
|
}, O(t)));
|
|
3544
3544
|
const to = Symbol("zod_brand");
|
|
3545
3545
|
class Ns extends T {
|
|
@@ -3559,7 +3559,7 @@ class Jt extends T {
|
|
|
3559
3559
|
_parse(e) {
|
|
3560
3560
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
3561
3561
|
if (s.common.async)
|
|
3562
|
-
return
|
|
3562
|
+
return Ee(this, null, function* () {
|
|
3563
3563
|
const r = yield this._def.in._parseAsync({
|
|
3564
3564
|
data: s.data,
|
|
3565
3565
|
path: s.path,
|
|
@@ -3591,7 +3591,7 @@ class Jt extends T {
|
|
|
3591
3591
|
return new Jt({
|
|
3592
3592
|
in: e,
|
|
3593
3593
|
out: n,
|
|
3594
|
-
typeName:
|
|
3594
|
+
typeName: E.ZodPipeline
|
|
3595
3595
|
});
|
|
3596
3596
|
}
|
|
3597
3597
|
}
|
|
@@ -3606,7 +3606,7 @@ class zt extends T {
|
|
|
3606
3606
|
}
|
|
3607
3607
|
zt.create = (t, e) => new zt(d({
|
|
3608
3608
|
innerType: t,
|
|
3609
|
-
typeName:
|
|
3609
|
+
typeName: E.ZodReadonly
|
|
3610
3610
|
}, O(e)));
|
|
3611
3611
|
function ar(t, e) {
|
|
3612
3612
|
const n = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
|
|
@@ -3621,40 +3621,40 @@ function Mr(t, e = {}, n) {
|
|
|
3621
3621
|
var u, h;
|
|
3622
3622
|
if (!c) {
|
|
3623
3623
|
const p = ar(e, s), k = (h = (u = p.fatal) !== null && u !== void 0 ? u : n) !== null && h !== void 0 ? h : !0;
|
|
3624
|
-
r.addIssue(
|
|
3624
|
+
r.addIssue(x(d({ code: "custom" }, p), { fatal: k }));
|
|
3625
3625
|
}
|
|
3626
3626
|
});
|
|
3627
3627
|
if (!o) {
|
|
3628
3628
|
const c = ar(e, s), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : n) !== null && i !== void 0 ? i : !0;
|
|
3629
|
-
r.addIssue(
|
|
3629
|
+
r.addIssue(x(d({ code: "custom" }, c), { fatal: u }));
|
|
3630
3630
|
}
|
|
3631
3631
|
}) : gt.create();
|
|
3632
3632
|
}
|
|
3633
3633
|
const no = {
|
|
3634
|
-
object:
|
|
3634
|
+
object: V.lazycreate
|
|
3635
3635
|
};
|
|
3636
|
-
var
|
|
3636
|
+
var E;
|
|
3637
3637
|
(function(t) {
|
|
3638
3638
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3639
|
-
})(
|
|
3639
|
+
})(E || (E = {}));
|
|
3640
3640
|
const so = (t, e = {
|
|
3641
3641
|
message: `Input not instance of ${t.name}`
|
|
3642
|
-
}) => Mr((n) => n instanceof t, e), Lr = me.create, $r = Le.create, ro = vn.create, ao = $e.create, Fr =
|
|
3643
|
-
string: (t) => me.create(
|
|
3644
|
-
number: (t) => Le.create(
|
|
3645
|
-
boolean: (t) =>
|
|
3642
|
+
}) => Mr((n) => n instanceof t, e), Lr = me.create, $r = Le.create, ro = vn.create, ao = $e.create, Fr = jt.create, io = Qe.create, oo = mn.create, co = It.create, uo = Zt.create, lo = gt.create, fo = Xe.create, ho = Pe.create, po = yn.create, mo = ye.create, yo = V.create, go = V.strictCreate, vo = Dt.create, _o = En.create, bo = Mt.create, wo = Se.create, ko = Lt.create, Eo = gn.create, xo = et.create, So = ht.create, Oo = $t.create, To = Ft.create, Ao = Fe.create, Co = Wt.create, No = vt.create, ir = ge.create, Ro = ke.create, Po = We.create, jo = ge.createWithPreprocess, Io = Jt.create, Zo = () => Lr().optional(), Do = () => $r().optional(), Mo = () => Fr().optional(), Lo = {
|
|
3643
|
+
string: (t) => me.create(x(d({}, t), { coerce: !0 })),
|
|
3644
|
+
number: (t) => Le.create(x(d({}, t), { coerce: !0 })),
|
|
3645
|
+
boolean: (t) => jt.create(x(d({}, t), {
|
|
3646
3646
|
coerce: !0
|
|
3647
3647
|
})),
|
|
3648
|
-
bigint: (t) => $e.create(
|
|
3649
|
-
date: (t) => Qe.create(
|
|
3648
|
+
bigint: (t) => $e.create(x(d({}, t), { coerce: !0 })),
|
|
3649
|
+
date: (t) => Qe.create(x(d({}, t), { coerce: !0 }))
|
|
3650
3650
|
}, $o = S;
|
|
3651
|
-
var
|
|
3651
|
+
var P = /* @__PURE__ */ Object.freeze({
|
|
3652
3652
|
__proto__: null,
|
|
3653
3653
|
defaultErrorMap: yt,
|
|
3654
3654
|
setErrorMap: Pi,
|
|
3655
3655
|
getErrorMap: ln,
|
|
3656
3656
|
makeIssue: fn,
|
|
3657
|
-
EMPTY_PATH:
|
|
3657
|
+
EMPTY_PATH: ji,
|
|
3658
3658
|
addIssueToContext: y,
|
|
3659
3659
|
ParseStatus: Y,
|
|
3660
3660
|
INVALID: S,
|
|
@@ -3670,26 +3670,26 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3670
3670
|
get objectUtil() {
|
|
3671
3671
|
return ts;
|
|
3672
3672
|
},
|
|
3673
|
-
ZodParsedType:
|
|
3673
|
+
ZodParsedType: _,
|
|
3674
3674
|
getParsedType: Ne,
|
|
3675
3675
|
ZodType: T,
|
|
3676
3676
|
datetimeRegex: Zr,
|
|
3677
3677
|
ZodString: me,
|
|
3678
3678
|
ZodNumber: Le,
|
|
3679
3679
|
ZodBigInt: $e,
|
|
3680
|
-
ZodBoolean:
|
|
3680
|
+
ZodBoolean: jt,
|
|
3681
3681
|
ZodDate: Qe,
|
|
3682
3682
|
ZodSymbol: mn,
|
|
3683
|
-
ZodUndefined:
|
|
3683
|
+
ZodUndefined: It,
|
|
3684
3684
|
ZodNull: Zt,
|
|
3685
3685
|
ZodAny: gt,
|
|
3686
3686
|
ZodUnknown: Xe,
|
|
3687
3687
|
ZodNever: Pe,
|
|
3688
3688
|
ZodVoid: yn,
|
|
3689
3689
|
ZodArray: ye,
|
|
3690
|
-
ZodObject:
|
|
3690
|
+
ZodObject: V,
|
|
3691
3691
|
ZodUnion: Dt,
|
|
3692
|
-
ZodDiscriminatedUnion:
|
|
3692
|
+
ZodDiscriminatedUnion: En,
|
|
3693
3693
|
ZodIntersection: Mt,
|
|
3694
3694
|
ZodTuple: Se,
|
|
3695
3695
|
ZodRecord: Lt,
|
|
@@ -3705,8 +3705,8 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3705
3705
|
ZodTransformer: ge,
|
|
3706
3706
|
ZodOptional: ke,
|
|
3707
3707
|
ZodNullable: We,
|
|
3708
|
-
ZodDefault:
|
|
3709
|
-
ZodCatch:
|
|
3708
|
+
ZodDefault: Vt,
|
|
3709
|
+
ZodCatch: Ut,
|
|
3710
3710
|
ZodNaN: vn,
|
|
3711
3711
|
BRAND: to,
|
|
3712
3712
|
ZodBranded: Ns,
|
|
@@ -3717,7 +3717,7 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3717
3717
|
ZodSchema: T,
|
|
3718
3718
|
late: no,
|
|
3719
3719
|
get ZodFirstPartyTypeKind() {
|
|
3720
|
-
return
|
|
3720
|
+
return E;
|
|
3721
3721
|
},
|
|
3722
3722
|
coerce: Lo,
|
|
3723
3723
|
any: lo,
|
|
@@ -3733,7 +3733,7 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3733
3733
|
intersection: bo,
|
|
3734
3734
|
lazy: Oo,
|
|
3735
3735
|
literal: To,
|
|
3736
|
-
map:
|
|
3736
|
+
map: Eo,
|
|
3737
3737
|
nan: ro,
|
|
3738
3738
|
nativeEnum: Co,
|
|
3739
3739
|
never: ho,
|
|
@@ -3745,11 +3745,11 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3745
3745
|
onumber: Do,
|
|
3746
3746
|
optional: Ro,
|
|
3747
3747
|
ostring: Zo,
|
|
3748
|
-
pipeline:
|
|
3749
|
-
preprocess:
|
|
3748
|
+
pipeline: Io,
|
|
3749
|
+
preprocess: jo,
|
|
3750
3750
|
promise: No,
|
|
3751
3751
|
record: ko,
|
|
3752
|
-
set:
|
|
3752
|
+
set: xo,
|
|
3753
3753
|
strictObject: go,
|
|
3754
3754
|
string: Lr,
|
|
3755
3755
|
symbol: oo,
|
|
@@ -3764,16 +3764,18 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3764
3764
|
quotelessJson: Ri,
|
|
3765
3765
|
ZodError: oe
|
|
3766
3766
|
});
|
|
3767
|
-
|
|
3768
|
-
language:
|
|
3769
|
-
disableMarkedForExport:
|
|
3770
|
-
allowAutoSelectFirstNode:
|
|
3767
|
+
P.object({
|
|
3768
|
+
language: P.enum(["typescript", "javascript"]).optional(),
|
|
3769
|
+
disableMarkedForExport: P.boolean().optional(),
|
|
3770
|
+
allowAutoSelectFirstNode: P.boolean().optional().default(!0),
|
|
3771
|
+
enableDisplayDataId: P.boolean().optional(),
|
|
3772
|
+
enableDisplayDataName: P.boolean().optional()
|
|
3771
3773
|
}).and(
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
framework:
|
|
3775
|
-
model:
|
|
3776
|
-
styling:
|
|
3774
|
+
P.union([
|
|
3775
|
+
P.object({
|
|
3776
|
+
framework: P.literal("react"),
|
|
3777
|
+
model: P.string().optional(),
|
|
3778
|
+
styling: P.enum([
|
|
3777
3779
|
"plain_css",
|
|
3778
3780
|
"css_modules",
|
|
3779
3781
|
"styled_components",
|
|
@@ -3782,27 +3784,27 @@ I.object({
|
|
|
3782
3784
|
"scss",
|
|
3783
3785
|
"inline_styles"
|
|
3784
3786
|
]),
|
|
3785
|
-
uiLibrary:
|
|
3786
|
-
responsivePages:
|
|
3787
|
-
|
|
3788
|
-
name:
|
|
3789
|
-
framesId:
|
|
3787
|
+
uiLibrary: P.enum(["mui", "antd", "radix", "shadcn", "clean_react"]).optional(),
|
|
3788
|
+
responsivePages: P.array(
|
|
3789
|
+
P.object({
|
|
3790
|
+
name: P.string(),
|
|
3791
|
+
framesId: P.array(P.string())
|
|
3790
3792
|
})
|
|
3791
3793
|
).optional(),
|
|
3792
|
-
enableUILibraryTheming:
|
|
3793
|
-
enableCompactStructure:
|
|
3794
|
-
enableDisplayScreenModelId:
|
|
3795
|
-
enableGeneratePackageLock:
|
|
3796
|
-
enableAnimationsPreset:
|
|
3797
|
-
enableAutoSplit:
|
|
3798
|
-
autoSplitThreshold:
|
|
3799
|
-
url:
|
|
3800
|
-
codegenSettings:
|
|
3794
|
+
enableUILibraryTheming: P.boolean().optional(),
|
|
3795
|
+
enableCompactStructure: P.boolean().optional(),
|
|
3796
|
+
enableDisplayScreenModelId: P.boolean().optional(),
|
|
3797
|
+
enableGeneratePackageLock: P.boolean().optional(),
|
|
3798
|
+
enableAnimationsPreset: P.boolean().optional(),
|
|
3799
|
+
enableAutoSplit: P.boolean().optional(),
|
|
3800
|
+
autoSplitThreshold: P.number().optional(),
|
|
3801
|
+
url: P.string().url().optional(),
|
|
3802
|
+
codegenSettings: P.record(P.unknown()).optional()
|
|
3801
3803
|
}),
|
|
3802
|
-
|
|
3803
|
-
framework:
|
|
3804
|
-
styling:
|
|
3805
|
-
enableTranslation:
|
|
3804
|
+
P.object({
|
|
3805
|
+
framework: P.literal("html"),
|
|
3806
|
+
styling: P.enum(["plain_css", "inline_styles", "tailwind"]),
|
|
3807
|
+
enableTranslation: P.boolean().optional()
|
|
3806
3808
|
})
|
|
3807
3809
|
])
|
|
3808
3810
|
);
|
|
@@ -3821,10 +3823,10 @@ function Fo(t) {
|
|
|
3821
3823
|
const { onEvent: e = Zn, onError: n = Zn, onRetry: s = Zn, onComment: r } = t;
|
|
3822
3824
|
let a = "", i = !0, o, c = "", u = "";
|
|
3823
3825
|
function h(m) {
|
|
3824
|
-
const
|
|
3825
|
-
for (const
|
|
3826
|
-
p(
|
|
3827
|
-
a =
|
|
3826
|
+
const v = i ? m.replace(/^\xEF\xBB\xBF/, "") : m, [l, A] = Wo(`${a}${v}`);
|
|
3827
|
+
for (const j of l)
|
|
3828
|
+
p(j);
|
|
3829
|
+
a = A, i = !1;
|
|
3828
3830
|
}
|
|
3829
3831
|
function p(m) {
|
|
3830
3832
|
if (m === "") {
|
|
@@ -3835,31 +3837,31 @@ function Fo(t) {
|
|
|
3835
3837
|
r && r(m.slice(m.startsWith(": ") ? 2 : 1));
|
|
3836
3838
|
return;
|
|
3837
3839
|
}
|
|
3838
|
-
const
|
|
3839
|
-
if (
|
|
3840
|
-
const l = m.slice(0,
|
|
3841
|
-
k(l,
|
|
3840
|
+
const v = m.indexOf(":");
|
|
3841
|
+
if (v !== -1) {
|
|
3842
|
+
const l = m.slice(0, v), A = m[v + 1] === " " ? 2 : 1, j = m.slice(v + A);
|
|
3843
|
+
k(l, j, m);
|
|
3842
3844
|
return;
|
|
3843
3845
|
}
|
|
3844
3846
|
k(m, "", m);
|
|
3845
3847
|
}
|
|
3846
|
-
function k(m,
|
|
3848
|
+
function k(m, v, l) {
|
|
3847
3849
|
switch (m) {
|
|
3848
3850
|
case "event":
|
|
3849
|
-
u =
|
|
3851
|
+
u = v;
|
|
3850
3852
|
break;
|
|
3851
3853
|
case "data":
|
|
3852
|
-
c = `${c}${
|
|
3854
|
+
c = `${c}${v}
|
|
3853
3855
|
`;
|
|
3854
3856
|
break;
|
|
3855
3857
|
case "id":
|
|
3856
|
-
o =
|
|
3858
|
+
o = v.includes("\0") ? void 0 : v;
|
|
3857
3859
|
break;
|
|
3858
3860
|
case "retry":
|
|
3859
|
-
/^\d+$/.test(
|
|
3860
|
-
new or(`Invalid \`retry\` value: "${
|
|
3861
|
+
/^\d+$/.test(v) ? s(parseInt(v, 10)) : n(
|
|
3862
|
+
new or(`Invalid \`retry\` value: "${v}"`, {
|
|
3861
3863
|
type: "invalid-retry",
|
|
3862
|
-
value:
|
|
3864
|
+
value: v,
|
|
3863
3865
|
line: l
|
|
3864
3866
|
})
|
|
3865
3867
|
);
|
|
@@ -3868,7 +3870,7 @@ function Fo(t) {
|
|
|
3868
3870
|
n(
|
|
3869
3871
|
new or(
|
|
3870
3872
|
`Unknown field "${m.length > 20 ? `${m.slice(0, 20)}…` : m}"`,
|
|
3871
|
-
{ type: "unknown-field", field: m, value:
|
|
3873
|
+
{ type: "unknown-field", field: m, value: v, line: l }
|
|
3872
3874
|
)
|
|
3873
3875
|
);
|
|
3874
3876
|
break;
|
|
@@ -3949,7 +3951,7 @@ class cr extends Event {
|
|
|
3949
3951
|
return e(ur(this), n);
|
|
3950
3952
|
}
|
|
3951
3953
|
}
|
|
3952
|
-
function
|
|
3954
|
+
function Vo(t) {
|
|
3953
3955
|
const e = globalThis.DOMException;
|
|
3954
3956
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
3955
3957
|
}
|
|
@@ -3968,13 +3970,13 @@ function ur(t) {
|
|
|
3968
3970
|
}
|
|
3969
3971
|
var Wr = (t) => {
|
|
3970
3972
|
throw TypeError(t);
|
|
3971
|
-
}, Rs = (t, e, n) => e.has(t) || Wr("Cannot " + n),
|
|
3973
|
+
}, Rs = (t, e, n) => e.has(t) || Wr("Cannot " + n), C = (t, e, n) => (Rs(t, e, "read from private field"), n ? n.call(t) : e.get(t)), q = (t, e, n) => e.has(t) ? Wr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), W = (t, e, n, s) => (Rs(t, e, "write to private field"), e.set(t, n), n), Ce = (t, e, n) => (Rs(t, e, "access private method"), n), re, Je, ut, un, _n, Nt, ft, Rt, De, dt, pt, lt, At, pe, is, os, cs, dr, us, ds, Ct, ls, fs;
|
|
3972
3974
|
class dn extends EventTarget {
|
|
3973
3975
|
constructor(e, n) {
|
|
3974
3976
|
var s, r;
|
|
3975
|
-
super(), q(this, pe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, re), q(this, Je), q(this, ut), q(this, un), q(this, _n), q(this, Nt), q(this, ft), q(this, Rt, null), q(this, De), q(this, dt), q(this, pt, null), q(this, lt, null), q(this, At, null), q(this, os, (a) =>
|
|
3977
|
+
super(), q(this, pe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, re), q(this, Je), q(this, ut), q(this, un), q(this, _n), q(this, Nt), q(this, ft), q(this, Rt, null), q(this, De), q(this, dt), q(this, pt, null), q(this, lt, null), q(this, At, null), q(this, os, (a) => je(this, null, function* () {
|
|
3976
3978
|
var i;
|
|
3977
|
-
|
|
3979
|
+
C(this, dt).reset();
|
|
3978
3980
|
const { body: o, redirected: c, status: u, headers: h } = a;
|
|
3979
3981
|
if (u === 204) {
|
|
3980
3982
|
Ce(this, pe, Ct).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
@@ -3988,19 +3990,19 @@ class dn extends EventTarget {
|
|
|
3988
3990
|
Ce(this, pe, Ct).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
3989
3991
|
return;
|
|
3990
3992
|
}
|
|
3991
|
-
if (
|
|
3993
|
+
if (C(this, re) === this.CLOSED)
|
|
3992
3994
|
return;
|
|
3993
3995
|
W(this, re, this.OPEN);
|
|
3994
3996
|
const p = new Event("open");
|
|
3995
|
-
if ((i =
|
|
3997
|
+
if ((i = C(this, At)) == null || i.call(this, p), this.dispatchEvent(p), typeof o != "object" || !o || !("getReader" in o)) {
|
|
3996
3998
|
Ce(this, pe, Ct).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
3997
3999
|
return;
|
|
3998
4000
|
}
|
|
3999
4001
|
const k = new TextDecoder(), g = o.getReader();
|
|
4000
4002
|
let b = !0;
|
|
4001
4003
|
do {
|
|
4002
|
-
const { done: m, value:
|
|
4003
|
-
|
|
4004
|
+
const { done: m, value: v } = yield g.read();
|
|
4005
|
+
v && C(this, dt).feed(k.decode(v, { stream: !m })), m && (b = !1, C(this, dt).reset(), Ce(this, pe, ls).call(this));
|
|
4004
4006
|
} while (b);
|
|
4005
4007
|
})), q(this, cs, (a) => {
|
|
4006
4008
|
W(this, De, void 0), !(a.name === "AbortError" || a.type === "aborted") && Ce(this, pe, ls).call(this, as(a));
|
|
@@ -4008,28 +4010,28 @@ class dn extends EventTarget {
|
|
|
4008
4010
|
typeof a.id == "string" && W(this, Rt, a.id);
|
|
4009
4011
|
const i = new MessageEvent(a.event || "message", {
|
|
4010
4012
|
data: a.data,
|
|
4011
|
-
origin:
|
|
4013
|
+
origin: C(this, ut) ? C(this, ut).origin : C(this, Je).origin,
|
|
4012
4014
|
lastEventId: a.id || ""
|
|
4013
4015
|
});
|
|
4014
|
-
|
|
4016
|
+
C(this, lt) && (!a.event || a.event === "message") && C(this, lt).call(this, i), this.dispatchEvent(i);
|
|
4015
4017
|
}), q(this, ds, (a) => {
|
|
4016
4018
|
W(this, Nt, a);
|
|
4017
4019
|
}), q(this, fs, () => {
|
|
4018
|
-
W(this, ft, void 0),
|
|
4020
|
+
W(this, ft, void 0), C(this, re) === this.CONNECTING && Ce(this, pe, is).call(this);
|
|
4019
4021
|
});
|
|
4020
4022
|
try {
|
|
4021
4023
|
if (e instanceof URL)
|
|
4022
4024
|
W(this, Je, e);
|
|
4023
4025
|
else if (typeof e == "string")
|
|
4024
|
-
W(this, Je, new URL(e,
|
|
4026
|
+
W(this, Je, new URL(e, Uo()));
|
|
4025
4027
|
else
|
|
4026
4028
|
throw new Error("Invalid URL");
|
|
4027
4029
|
} catch (a) {
|
|
4028
|
-
throw
|
|
4030
|
+
throw Vo("An invalid or illegal string was specified");
|
|
4029
4031
|
}
|
|
4030
4032
|
W(this, dt, Fo({
|
|
4031
|
-
onEvent:
|
|
4032
|
-
onRetry:
|
|
4033
|
+
onEvent: C(this, us),
|
|
4034
|
+
onRetry: C(this, ds)
|
|
4033
4035
|
})), W(this, re, this.CONNECTING), W(this, Nt, 3e3), W(this, _n, (s = n == null ? void 0 : n.fetch) != null ? s : globalThis.fetch), W(this, un, (r = n == null ? void 0 : n.withCredentials) != null ? r : !1), Ce(this, pe, is).call(this);
|
|
4034
4036
|
}
|
|
4035
4037
|
/**
|
|
@@ -4043,7 +4045,7 @@ class dn extends EventTarget {
|
|
|
4043
4045
|
* @public
|
|
4044
4046
|
*/
|
|
4045
4047
|
get readyState() {
|
|
4046
|
-
return
|
|
4048
|
+
return C(this, re);
|
|
4047
4049
|
}
|
|
4048
4050
|
/**
|
|
4049
4051
|
* Returns the URL providing the event stream.
|
|
@@ -4053,7 +4055,7 @@ class dn extends EventTarget {
|
|
|
4053
4055
|
* @public
|
|
4054
4056
|
*/
|
|
4055
4057
|
get url() {
|
|
4056
|
-
return
|
|
4058
|
+
return C(this, Je).href;
|
|
4057
4059
|
}
|
|
4058
4060
|
/**
|
|
4059
4061
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -4061,25 +4063,25 @@ class dn extends EventTarget {
|
|
|
4061
4063
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
4062
4064
|
*/
|
|
4063
4065
|
get withCredentials() {
|
|
4064
|
-
return
|
|
4066
|
+
return C(this, un);
|
|
4065
4067
|
}
|
|
4066
4068
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
4067
4069
|
get onerror() {
|
|
4068
|
-
return
|
|
4070
|
+
return C(this, pt);
|
|
4069
4071
|
}
|
|
4070
4072
|
set onerror(e) {
|
|
4071
4073
|
W(this, pt, e);
|
|
4072
4074
|
}
|
|
4073
4075
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
4074
4076
|
get onmessage() {
|
|
4075
|
-
return
|
|
4077
|
+
return C(this, lt);
|
|
4076
4078
|
}
|
|
4077
4079
|
set onmessage(e) {
|
|
4078
4080
|
W(this, lt, e);
|
|
4079
4081
|
}
|
|
4080
4082
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
4081
4083
|
get onopen() {
|
|
4082
|
-
return
|
|
4084
|
+
return C(this, At);
|
|
4083
4085
|
}
|
|
4084
4086
|
set onopen(e) {
|
|
4085
4087
|
W(this, At, e);
|
|
@@ -4100,7 +4102,7 @@ class dn extends EventTarget {
|
|
|
4100
4102
|
* @public
|
|
4101
4103
|
*/
|
|
4102
4104
|
close() {
|
|
4103
|
-
|
|
4105
|
+
C(this, ft) && clearTimeout(C(this, ft)), C(this, re) !== this.CLOSED && (C(this, De) && C(this, De).abort(), W(this, re, this.CLOSED), W(this, De, void 0));
|
|
4104
4106
|
}
|
|
4105
4107
|
}
|
|
4106
4108
|
re = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Nt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakSet(), /**
|
|
@@ -4109,7 +4111,7 @@ re = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), ut = /*
|
|
|
4109
4111
|
* @internal
|
|
4110
4112
|
*/
|
|
4111
4113
|
is = function() {
|
|
4112
|
-
W(this, re, this.CONNECTING), W(this, De, new AbortController()),
|
|
4114
|
+
W(this, re, this.CONNECTING), W(this, De, new AbortController()), C(this, _n)(C(this, Je), Ce(this, pe, dr).call(this)).then(C(this, os)).catch(C(this, cs));
|
|
4113
4115
|
}, os = /* @__PURE__ */ new WeakMap(), cs = /* @__PURE__ */ new WeakMap(), /**
|
|
4114
4116
|
* Get request options for the `fetch()` request
|
|
4115
4117
|
*
|
|
@@ -4123,9 +4125,9 @@ dr = function() {
|
|
|
4123
4125
|
// [spec] …will have their mode set to "cors"…
|
|
4124
4126
|
mode: "cors",
|
|
4125
4127
|
redirect: "follow",
|
|
4126
|
-
headers:
|
|
4128
|
+
headers: Be({ Accept: "text/event-stream" }, C(this, Rt) ? { "Last-Event-ID": C(this, Rt) } : void 0),
|
|
4127
4129
|
cache: "no-store",
|
|
4128
|
-
signal: (t =
|
|
4130
|
+
signal: (t = C(this, De)) == null ? void 0 : t.signal
|
|
4129
4131
|
};
|
|
4130
4132
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
4131
4133
|
}, us = /* @__PURE__ */ new WeakMap(), ds = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -4137,9 +4139,9 @@ dr = function() {
|
|
|
4137
4139
|
*/
|
|
4138
4140
|
Ct = function(t, e) {
|
|
4139
4141
|
var n;
|
|
4140
|
-
|
|
4142
|
+
C(this, re) !== this.CLOSED && W(this, re, this.CLOSED);
|
|
4141
4143
|
const s = new cr("error", { code: e, message: t });
|
|
4142
|
-
(n =
|
|
4144
|
+
(n = C(this, pt)) == null || n.call(this, s), this.dispatchEvent(s);
|
|
4143
4145
|
}, /**
|
|
4144
4146
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
4145
4147
|
*
|
|
@@ -4149,11 +4151,11 @@ Ct = function(t, e) {
|
|
|
4149
4151
|
*/
|
|
4150
4152
|
ls = function(t, e) {
|
|
4151
4153
|
var n;
|
|
4152
|
-
if (
|
|
4154
|
+
if (C(this, re) === this.CLOSED)
|
|
4153
4155
|
return;
|
|
4154
4156
|
W(this, re, this.CONNECTING);
|
|
4155
4157
|
const s = new cr("error", { code: e, message: t });
|
|
4156
|
-
(n =
|
|
4158
|
+
(n = C(this, pt)) == null || n.call(this, s), this.dispatchEvent(s), W(this, ft, setTimeout(C(this, fs), C(this, Nt)));
|
|
4157
4159
|
}, fs = /* @__PURE__ */ new WeakMap(), /**
|
|
4158
4160
|
* ReadyState representing an EventSource currently trying to connect
|
|
4159
4161
|
*
|
|
@@ -4170,11 +4172,11 @@ dn.OPEN = 1, /**
|
|
|
4170
4172
|
* @public
|
|
4171
4173
|
*/
|
|
4172
4174
|
dn.CLOSED = 2;
|
|
4173
|
-
function
|
|
4175
|
+
function Uo() {
|
|
4174
4176
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
4175
4177
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
4176
4178
|
}
|
|
4177
|
-
var
|
|
4179
|
+
var Vr = Symbol.for("immer-nothing"), lr = Symbol.for("immer-draftable"), ce = Symbol.for("immer-state"), zo = process.env.NODE_ENV !== "production" ? [
|
|
4178
4180
|
// All error codes, starting by 0:
|
|
4179
4181
|
function(t) {
|
|
4180
4182
|
return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
|
|
@@ -4220,35 +4222,35 @@ function bt(t) {
|
|
|
4220
4222
|
}
|
|
4221
4223
|
function tt(t) {
|
|
4222
4224
|
var e;
|
|
4223
|
-
return t ?
|
|
4225
|
+
return t ? Ur(t) || Array.isArray(t) || !!t[lr] || !!((e = t.constructor) != null && e[lr]) || Sn(t) || On(t) : !1;
|
|
4224
4226
|
}
|
|
4225
|
-
var
|
|
4226
|
-
function
|
|
4227
|
+
var Bo = Object.prototype.constructor.toString();
|
|
4228
|
+
function Ur(t) {
|
|
4227
4229
|
if (!t || typeof t != "object")
|
|
4228
4230
|
return !1;
|
|
4229
4231
|
const e = _t(t);
|
|
4230
4232
|
if (e === null)
|
|
4231
4233
|
return !0;
|
|
4232
4234
|
const n = Object.hasOwnProperty.call(e, "constructor") && e.constructor;
|
|
4233
|
-
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) ===
|
|
4235
|
+
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Bo;
|
|
4234
4236
|
}
|
|
4235
4237
|
function bn(t, e) {
|
|
4236
|
-
|
|
4238
|
+
xn(t) === 0 ? Reflect.ownKeys(t).forEach((n) => {
|
|
4237
4239
|
e(n, t[n], t);
|
|
4238
4240
|
}) : t.forEach((n, s) => e(s, n, t));
|
|
4239
4241
|
}
|
|
4240
|
-
function
|
|
4242
|
+
function xn(t) {
|
|
4241
4243
|
const e = t[ce];
|
|
4242
4244
|
return e ? e.type_ : Array.isArray(t) ? 1 : Sn(t) ? 2 : On(t) ? 3 : 0;
|
|
4243
4245
|
}
|
|
4244
4246
|
function hs(t, e) {
|
|
4245
|
-
return
|
|
4247
|
+
return xn(t) === 2 ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
4246
4248
|
}
|
|
4247
4249
|
function zr(t, e, n) {
|
|
4248
|
-
const s =
|
|
4250
|
+
const s = xn(t);
|
|
4249
4251
|
s === 2 ? t.set(e, n) : s === 3 ? t.add(n) : t[e] = n;
|
|
4250
4252
|
}
|
|
4251
|
-
function
|
|
4253
|
+
function Ko(t, e) {
|
|
4252
4254
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
4253
4255
|
}
|
|
4254
4256
|
function Sn(t) {
|
|
@@ -4267,7 +4269,7 @@ function ps(t, e) {
|
|
|
4267
4269
|
return new Set(t);
|
|
4268
4270
|
if (Array.isArray(t))
|
|
4269
4271
|
return Array.prototype.slice.call(t);
|
|
4270
|
-
const n =
|
|
4272
|
+
const n = Ur(t);
|
|
4271
4273
|
if (e === !0 || e === "class_only" && !n) {
|
|
4272
4274
|
const s = Object.getOwnPropertyDescriptors(t);
|
|
4273
4275
|
delete s[ce];
|
|
@@ -4286,13 +4288,13 @@ function ps(t, e) {
|
|
|
4286
4288
|
} else {
|
|
4287
4289
|
const s = _t(t);
|
|
4288
4290
|
if (s !== null && n)
|
|
4289
|
-
return
|
|
4291
|
+
return Be({}, t);
|
|
4290
4292
|
const r = Object.create(s);
|
|
4291
4293
|
return Object.assign(r, t);
|
|
4292
4294
|
}
|
|
4293
4295
|
}
|
|
4294
|
-
function
|
|
4295
|
-
return Tn(t) || bt(t) || !tt(t) || (
|
|
4296
|
+
function Bt(t, e = !1) {
|
|
4297
|
+
return Tn(t) || bt(t) || !tt(t) || (xn(t) > 1 && (t.set = t.add = t.clear = t.delete = qo), Object.freeze(t), e && Object.entries(t).forEach(([n, s]) => Bt(s, !0))), t;
|
|
4296
4298
|
}
|
|
4297
4299
|
function qo() {
|
|
4298
4300
|
ae(2);
|
|
@@ -4305,9 +4307,9 @@ function nt(t) {
|
|
|
4305
4307
|
const e = Ho[t];
|
|
4306
4308
|
return e || ae(0, t), e;
|
|
4307
4309
|
}
|
|
4308
|
-
var
|
|
4309
|
-
function
|
|
4310
|
-
return
|
|
4310
|
+
var Kt;
|
|
4311
|
+
function Br() {
|
|
4312
|
+
return Kt;
|
|
4311
4313
|
}
|
|
4312
4314
|
function Go(t, e) {
|
|
4313
4315
|
return {
|
|
@@ -4327,10 +4329,10 @@ function ms(t) {
|
|
|
4327
4329
|
ys(t), t.drafts_.forEach(Jo), t.drafts_ = null;
|
|
4328
4330
|
}
|
|
4329
4331
|
function ys(t) {
|
|
4330
|
-
t ===
|
|
4332
|
+
t === Kt && (Kt = t.parent_);
|
|
4331
4333
|
}
|
|
4332
4334
|
function hr(t) {
|
|
4333
|
-
return
|
|
4335
|
+
return Kt = Go(Kt, t);
|
|
4334
4336
|
}
|
|
4335
4337
|
function Jo(t) {
|
|
4336
4338
|
const e = t[ce];
|
|
@@ -4344,7 +4346,7 @@ function pr(t, e) {
|
|
|
4344
4346
|
t,
|
|
4345
4347
|
e.patches_,
|
|
4346
4348
|
e.inversePatches_
|
|
4347
|
-
)) : t = wn(e, n, []), ms(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !==
|
|
4349
|
+
)) : t = wn(e, n, []), ms(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== Vr ? t : void 0;
|
|
4348
4350
|
}
|
|
4349
4351
|
function wn(t, e, n) {
|
|
4350
4352
|
if (Tn(e))
|
|
@@ -4391,13 +4393,13 @@ function mr(t, e, n, s, r, a, i) {
|
|
|
4391
4393
|
}
|
|
4392
4394
|
}
|
|
4393
4395
|
function kn(t, e, n = !1) {
|
|
4394
|
-
!t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ &&
|
|
4396
|
+
!t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && Bt(e, n);
|
|
4395
4397
|
}
|
|
4396
4398
|
function Xo(t, e) {
|
|
4397
4399
|
const n = Array.isArray(t), s = {
|
|
4398
4400
|
type_: n ? 1 : 0,
|
|
4399
4401
|
// Track which produce call this is associated with.
|
|
4400
|
-
scope_: e ? e.scope_ :
|
|
4402
|
+
scope_: e ? e.scope_ : Br(),
|
|
4401
4403
|
// True for both shallow and deep changes.
|
|
4402
4404
|
modified_: !1,
|
|
4403
4405
|
// Used during finalization.
|
|
@@ -4439,14 +4441,14 @@ var Ps = {
|
|
|
4439
4441
|
return Reflect.ownKeys(qe(t));
|
|
4440
4442
|
},
|
|
4441
4443
|
set(t, e, n) {
|
|
4442
|
-
const s =
|
|
4444
|
+
const s = Kr(qe(t), e);
|
|
4443
4445
|
if (s != null && s.set)
|
|
4444
4446
|
return s.set.call(t.draft_, n), !0;
|
|
4445
4447
|
if (!t.modified_) {
|
|
4446
4448
|
const r = Dn(qe(t), e), a = r == null ? void 0 : r[ce];
|
|
4447
4449
|
if (a && a.base_ === n)
|
|
4448
4450
|
return t.copy_[e] = n, t.assigned_[e] = !1, !0;
|
|
4449
|
-
if (
|
|
4451
|
+
if (Ko(n, r) && (n !== void 0 || hs(t.base_, e)))
|
|
4450
4452
|
return !0;
|
|
4451
4453
|
Mn(t), gs(t);
|
|
4452
4454
|
}
|
|
@@ -4495,14 +4497,14 @@ function Dn(t, e) {
|
|
|
4495
4497
|
}
|
|
4496
4498
|
function Yo(t, e, n) {
|
|
4497
4499
|
var r;
|
|
4498
|
-
const s =
|
|
4500
|
+
const s = Kr(e, n);
|
|
4499
4501
|
return s ? "value" in s ? s.value : (
|
|
4500
4502
|
// This is a very special case, if the prop is a getter defined by the
|
|
4501
4503
|
// prototype, we should invoke it with the draft as context!
|
|
4502
4504
|
(r = s.get) == null ? void 0 : r.call(t.draft_)
|
|
4503
4505
|
) : void 0;
|
|
4504
4506
|
}
|
|
4505
|
-
function
|
|
4507
|
+
function Kr(t, e) {
|
|
4506
4508
|
if (!(e in t))
|
|
4507
4509
|
return;
|
|
4508
4510
|
let n = _t(t);
|
|
@@ -4545,7 +4547,7 @@ var Qo = class {
|
|
|
4545
4547
|
}
|
|
4546
4548
|
return fr(a, s), pr(r, a);
|
|
4547
4549
|
} else if (!e || typeof e != "object") {
|
|
4548
|
-
if (r = n(e), r === void 0 && (r = e), r ===
|
|
4550
|
+
if (r = n(e), r === void 0 && (r = e), r === Vr && (r = void 0), this.autoFreeze_ && Bt(r, !0), s) {
|
|
4549
4551
|
const a = [], i = [];
|
|
4550
4552
|
nt("Patches").generateReplacementPatches_(e, r, a, i), s(a, i);
|
|
4551
4553
|
}
|
|
@@ -4607,7 +4609,7 @@ var Qo = class {
|
|
|
4607
4609
|
};
|
|
4608
4610
|
function vs(t, e) {
|
|
4609
4611
|
const n = Sn(t) ? nt("MapSet").proxyMap_(t, e) : On(t) ? nt("MapSet").proxySet_(t, e) : Xo(t, e);
|
|
4610
|
-
return (e ? e.scope_ :
|
|
4612
|
+
return (e ? e.scope_ : Br()).drafts_.push(n), n;
|
|
4611
4613
|
}
|
|
4612
4614
|
function ec(t) {
|
|
4613
4615
|
return bt(t) || ae(10, t), qr(t);
|
|
@@ -4638,16 +4640,17 @@ ue.createDraft.bind(ue);
|
|
|
4638
4640
|
ue.finishDraft.bind(ue);
|
|
4639
4641
|
function nc(t) {
|
|
4640
4642
|
var e = la(function() {
|
|
4641
|
-
return
|
|
4643
|
+
return Bt(typeof t == "function" ? t() : t, !0);
|
|
4642
4644
|
}), n = e[1];
|
|
4643
4645
|
return [e[0], rn(function(s) {
|
|
4644
|
-
n(typeof s == "function" ? tc(s) :
|
|
4646
|
+
n(typeof s == "function" ? tc(s) : Bt(s));
|
|
4645
4647
|
}, [])];
|
|
4646
4648
|
}
|
|
4647
4649
|
const yr = 10, gr = {
|
|
4648
4650
|
status: "idle",
|
|
4649
4651
|
error: null,
|
|
4650
4652
|
result: null,
|
|
4653
|
+
progressMessages: [],
|
|
4651
4654
|
tasks: {
|
|
4652
4655
|
fetchDesign: { status: "pending" },
|
|
4653
4656
|
codeGeneration: { status: "pending", progress: 0 },
|
|
@@ -4666,7 +4669,7 @@ const yr = 10, gr = {
|
|
|
4666
4669
|
}) => {
|
|
4667
4670
|
const [n, s] = nc(gr);
|
|
4668
4671
|
return {
|
|
4669
|
-
getCode: (a) =>
|
|
4672
|
+
getCode: (a) => je(void 0, null, function* () {
|
|
4670
4673
|
var h, p, k;
|
|
4671
4674
|
s((g) => {
|
|
4672
4675
|
g.status = "pending", g.error = null, g.result = null, g.tasks = gr.tasks;
|
|
@@ -4683,84 +4686,91 @@ const yr = 10, gr = {
|
|
|
4683
4686
|
}
|
|
4684
4687
|
let o;
|
|
4685
4688
|
const c = new dn(t, {
|
|
4686
|
-
fetch: (g, b) => (o = fetch(g,
|
|
4689
|
+
fetch: (g, b) => (o = fetch(g, Ks(Be({}, b), {
|
|
4687
4690
|
method: e,
|
|
4688
4691
|
body: JSON.stringify(a)
|
|
4689
4692
|
})), o)
|
|
4690
4693
|
}), u = new Promise((g) => {
|
|
4691
4694
|
const b = {};
|
|
4692
|
-
c.addEventListener("start", (
|
|
4693
|
-
const l = JSON.parse(
|
|
4694
|
-
b.sessionId = l.sessionId, s((
|
|
4695
|
-
|
|
4695
|
+
c.addEventListener("start", (v) => {
|
|
4696
|
+
const l = JSON.parse(v.data);
|
|
4697
|
+
b.sessionId = l.sessionId, s((A) => {
|
|
4698
|
+
A.tasks.fetchDesign.status = "running";
|
|
4696
4699
|
});
|
|
4697
|
-
}), c.addEventListener("pre_codegen", (
|
|
4700
|
+
}), c.addEventListener("pre_codegen", (v) => {
|
|
4698
4701
|
JSON.parse(
|
|
4699
|
-
|
|
4700
|
-
).message === "Anima model built" && s((
|
|
4701
|
-
|
|
4702
|
+
v.data
|
|
4703
|
+
).message === "Anima model built" && s((A) => {
|
|
4704
|
+
A.tasks.fetchDesign.status = "finished", A.tasks.codeGeneration.status = "running", A.tasks.uploadAssets.status = "running";
|
|
4702
4705
|
});
|
|
4703
|
-
}), c.addEventListener("figma_metadata", (
|
|
4706
|
+
}), c.addEventListener("figma_metadata", (v) => {
|
|
4704
4707
|
const l = JSON.parse(
|
|
4705
|
-
|
|
4708
|
+
v.data
|
|
4706
4709
|
);
|
|
4707
4710
|
b.figmaFileName = l.figmaFileName, b.figmaSelectedFrameName = l.figmaSelectedFrameName;
|
|
4708
4711
|
}), c.addEventListener("aborted", () => {
|
|
4709
|
-
const
|
|
4712
|
+
const v = new Gs({ name: "Aborted", reason: "Unknown" });
|
|
4710
4713
|
s((l) => {
|
|
4711
|
-
l.status = "aborted", l.result = null, l.error =
|
|
4714
|
+
l.status = "aborted", l.result = null, l.error = v;
|
|
4712
4715
|
}), g({
|
|
4713
4716
|
result: null,
|
|
4714
|
-
error:
|
|
4717
|
+
error: v
|
|
4715
4718
|
});
|
|
4716
|
-
}), c.addEventListener("generating_code", (
|
|
4719
|
+
}), c.addEventListener("generating_code", (v) => {
|
|
4717
4720
|
const l = JSON.parse(
|
|
4718
|
-
|
|
4721
|
+
v.data
|
|
4719
4722
|
);
|
|
4720
|
-
l.payload.status === "success" && (b.files = l.payload.files), s((
|
|
4721
|
-
|
|
4723
|
+
l.payload.status === "success" && (b.files = l.payload.files), s((A) => {
|
|
4724
|
+
A.tasks.codeGeneration.progress = l.payload.progress, A.tasks.codeGeneration.status = "running";
|
|
4725
|
+
});
|
|
4726
|
+
}), c.addEventListener("progress_messages_updated", (v) => {
|
|
4727
|
+
const l = JSON.parse(
|
|
4728
|
+
v.data
|
|
4729
|
+
);
|
|
4730
|
+
s((A) => {
|
|
4731
|
+
A.progressMessages = l.payload.progressMessages;
|
|
4722
4732
|
});
|
|
4723
4733
|
}), c.addEventListener("codegen_completed", () => {
|
|
4724
|
-
s((
|
|
4725
|
-
|
|
4734
|
+
s((v) => {
|
|
4735
|
+
v.tasks.codeGeneration.status = "finished";
|
|
4726
4736
|
});
|
|
4727
4737
|
}), c.addEventListener("generation_completed", () => {
|
|
4728
|
-
s((
|
|
4729
|
-
|
|
4738
|
+
s((v) => {
|
|
4739
|
+
v.tasks.codeGeneration.status = "finished";
|
|
4730
4740
|
});
|
|
4731
4741
|
}), c.addEventListener("assets_uploaded", () => {
|
|
4732
|
-
s((
|
|
4733
|
-
|
|
4742
|
+
s((v) => {
|
|
4743
|
+
v.tasks.uploadAssets.status = "finished";
|
|
4734
4744
|
});
|
|
4735
|
-
}), c.addEventListener("assets_list", (
|
|
4745
|
+
}), c.addEventListener("assets_list", (v) => {
|
|
4736
4746
|
const l = JSON.parse(
|
|
4737
|
-
|
|
4747
|
+
v.data
|
|
4738
4748
|
);
|
|
4739
4749
|
b.assets = l.payload.assets;
|
|
4740
4750
|
});
|
|
4741
4751
|
let m = 0;
|
|
4742
|
-
c.addEventListener("error", (
|
|
4743
|
-
var
|
|
4752
|
+
c.addEventListener("error", (v) => je(void 0, null, function* () {
|
|
4753
|
+
var U, D, M;
|
|
4744
4754
|
console.warn(
|
|
4745
4755
|
`Experienced error during code generation (attempt ${m + 1} / ${yr})`,
|
|
4746
|
-
|
|
4756
|
+
v
|
|
4747
4757
|
);
|
|
4748
|
-
let l,
|
|
4758
|
+
let l, A, j = !1;
|
|
4749
4759
|
try {
|
|
4750
|
-
if (
|
|
4751
|
-
l = JSON.parse(
|
|
4760
|
+
if (v instanceof MessageEvent)
|
|
4761
|
+
l = JSON.parse(v.data);
|
|
4752
4762
|
else {
|
|
4753
4763
|
const G = yield o;
|
|
4754
|
-
|
|
4764
|
+
A = G.status;
|
|
4755
4765
|
try {
|
|
4756
4766
|
l = yield G.json();
|
|
4757
4767
|
} catch ($) {
|
|
4758
4768
|
}
|
|
4759
4769
|
}
|
|
4760
|
-
(((
|
|
4770
|
+
(((U = l == null ? void 0 : l.payload) == null ? void 0 : U.name) === "Task Crashed" || A === 429) && (j = !0);
|
|
4761
4771
|
} catch (G) {
|
|
4762
4772
|
}
|
|
4763
|
-
const
|
|
4773
|
+
const B = new Gs({
|
|
4764
4774
|
name: (D = l == null ? void 0 : l.payload.name) != null ? D : "Unknown error",
|
|
4765
4775
|
reason: (M = l == null ? void 0 : l.payload.message) != null ? M : "Unknown",
|
|
4766
4776
|
status: l == null ? void 0 : l.payload.status,
|
|
@@ -4768,39 +4778,39 @@ const yr = 10, gr = {
|
|
|
4768
4778
|
});
|
|
4769
4779
|
m++;
|
|
4770
4780
|
let Z = !1;
|
|
4771
|
-
m > yr ? (console.error("Experienced too many errors, terminating request"), Z = !0) :
|
|
4772
|
-
G.status = "error", G.error =
|
|
4781
|
+
m > yr ? (console.error("Experienced too many errors, terminating request"), Z = !0) : j && (console.error("Experienced unrecoverable error, terminating request"), Z = !0), Z && (s((G) => {
|
|
4782
|
+
G.status = "error", G.error = B;
|
|
4773
4783
|
}), g({
|
|
4774
4784
|
result: null,
|
|
4775
|
-
error:
|
|
4785
|
+
error: B
|
|
4776
4786
|
}));
|
|
4777
|
-
})), c.addEventListener("done", (
|
|
4778
|
-
const l = JSON.parse(
|
|
4779
|
-
b.tokenUsage = l.payload.tokenUsage, b.sessionId = l.payload.sessionId, s((
|
|
4780
|
-
|
|
4787
|
+
})), c.addEventListener("done", (v) => {
|
|
4788
|
+
const l = JSON.parse(v.data);
|
|
4789
|
+
b.tokenUsage = l.payload.tokenUsage, b.sessionId = l.payload.sessionId, s((A) => {
|
|
4790
|
+
A.status = "success", A.result = b;
|
|
4781
4791
|
}), g({ result: b, error: null });
|
|
4782
4792
|
});
|
|
4783
4793
|
});
|
|
4784
4794
|
try {
|
|
4785
4795
|
const { result: g, error: b } = yield u, m = structuredClone(g);
|
|
4786
4796
|
if (((p = i.assetsStorage) == null ? void 0 : p.strategy) === "local" && ((k = m == null ? void 0 : m.assets) != null && k.length)) {
|
|
4787
|
-
const { filePath:
|
|
4797
|
+
const { filePath: v } = vr(
|
|
4788
4798
|
i.assetsStorage
|
|
4789
|
-
), l = m.assets.map((
|
|
4790
|
-
const Z = yield (yield fetch(
|
|
4799
|
+
), l = m.assets.map((j) => je(void 0, null, function* () {
|
|
4800
|
+
const Z = yield (yield fetch(j.url)).arrayBuffer();
|
|
4791
4801
|
return {
|
|
4792
|
-
assetName:
|
|
4802
|
+
assetName: j.name,
|
|
4793
4803
|
base64: va(Z)
|
|
4794
4804
|
};
|
|
4795
|
-
})),
|
|
4796
|
-
for (const
|
|
4797
|
-
const
|
|
4798
|
-
if (
|
|
4799
|
-
const { assetName: Z, base64:
|
|
4800
|
-
|
|
4801
|
-
const D =
|
|
4805
|
+
})), A = yield Promise.allSettled(l);
|
|
4806
|
+
for (const j of A) {
|
|
4807
|
+
const B = {};
|
|
4808
|
+
if (j.status === "fulfilled") {
|
|
4809
|
+
const { assetName: Z, base64: U } = j.value;
|
|
4810
|
+
B[Z] = U;
|
|
4811
|
+
const D = v ? `${v}/${Z}` : Z;
|
|
4802
4812
|
m.files[D] = {
|
|
4803
|
-
content:
|
|
4813
|
+
content: U,
|
|
4804
4814
|
isBinary: !0
|
|
4805
4815
|
};
|
|
4806
4816
|
}
|
|
@@ -4812,6 +4822,7 @@ const yr = 10, gr = {
|
|
|
4812
4822
|
}
|
|
4813
4823
|
}),
|
|
4814
4824
|
status: n.status,
|
|
4825
|
+
progressMessages: n.progressMessages,
|
|
4815
4826
|
tasks: n.tasks,
|
|
4816
4827
|
error: n.error,
|
|
4817
4828
|
result: n.result
|
|
@@ -4837,16 +4848,16 @@ function sc() {
|
|
|
4837
4848
|
}
|
|
4838
4849
|
var n = typeof Object.is == "function" ? Object.is : e, s = t.useState, r = t.useEffect, a = t.useLayoutEffect, i = t.useDebugValue;
|
|
4839
4850
|
function o(p, k) {
|
|
4840
|
-
var g = k(), b = s({ inst: { value: g, getSnapshot: k } }), m = b[0].inst,
|
|
4851
|
+
var g = k(), b = s({ inst: { value: g, getSnapshot: k } }), m = b[0].inst, v = b[1];
|
|
4841
4852
|
return a(
|
|
4842
4853
|
function() {
|
|
4843
|
-
m.value = g, m.getSnapshot = k, c(m) &&
|
|
4854
|
+
m.value = g, m.getSnapshot = k, c(m) && v({ inst: m });
|
|
4844
4855
|
},
|
|
4845
4856
|
[p, g, k]
|
|
4846
4857
|
), r(
|
|
4847
4858
|
function() {
|
|
4848
|
-
return c(m) &&
|
|
4849
|
-
c(m) &&
|
|
4859
|
+
return c(m) && v({ inst: m }), p(function() {
|
|
4860
|
+
c(m) && v({ inst: m });
|
|
4850
4861
|
});
|
|
4851
4862
|
},
|
|
4852
4863
|
[p]
|
|
@@ -4890,24 +4901,24 @@ function rc() {
|
|
|
4890
4901
|
));
|
|
4891
4902
|
var m = b();
|
|
4892
4903
|
if (!p) {
|
|
4893
|
-
var
|
|
4894
|
-
a(m,
|
|
4904
|
+
var v = b();
|
|
4905
|
+
a(m, v) || (console.error(
|
|
4895
4906
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
4896
4907
|
), p = !0);
|
|
4897
4908
|
}
|
|
4898
|
-
|
|
4909
|
+
v = i({
|
|
4899
4910
|
inst: { value: m, getSnapshot: b }
|
|
4900
4911
|
});
|
|
4901
|
-
var l =
|
|
4912
|
+
var l = v[0].inst, A = v[1];
|
|
4902
4913
|
return c(
|
|
4903
4914
|
function() {
|
|
4904
|
-
l.value = m, l.getSnapshot = b, n(l) &&
|
|
4915
|
+
l.value = m, l.getSnapshot = b, n(l) && A({ inst: l });
|
|
4905
4916
|
},
|
|
4906
4917
|
[g, m, b]
|
|
4907
4918
|
), o(
|
|
4908
4919
|
function() {
|
|
4909
|
-
return n(l) &&
|
|
4910
|
-
n(l) &&
|
|
4920
|
+
return n(l) && A({ inst: l }), g(function() {
|
|
4921
|
+
n(l) && A({ inst: l });
|
|
4911
4922
|
});
|
|
4912
4923
|
},
|
|
4913
4924
|
[g]
|
|
@@ -4919,7 +4930,7 @@ function rc() {
|
|
|
4919
4930
|
try {
|
|
4920
4931
|
var m = b();
|
|
4921
4932
|
return !a(g, m);
|
|
4922
|
-
} catch (
|
|
4933
|
+
} catch (v) {
|
|
4923
4934
|
return !0;
|
|
4924
4935
|
}
|
|
4925
4936
|
}
|
|
@@ -4937,7 +4948,7 @@ function ac() {
|
|
|
4937
4948
|
}
|
|
4938
4949
|
var ic = ac();
|
|
4939
4950
|
const Hr = 0, Gr = 1, Jr = 2, kr = 3;
|
|
4940
|
-
var
|
|
4951
|
+
var Er = Object.prototype.hasOwnProperty;
|
|
4941
4952
|
function _s(t, e) {
|
|
4942
4953
|
var n, s;
|
|
4943
4954
|
if (t === e) return !0;
|
|
@@ -4952,7 +4963,7 @@ function _s(t, e) {
|
|
|
4952
4963
|
if (!n || typeof t == "object") {
|
|
4953
4964
|
s = 0;
|
|
4954
4965
|
for (n in t)
|
|
4955
|
-
if (
|
|
4966
|
+
if (Er.call(t, n) && ++s && !Er.call(e, n) || !(n in e) || !_s(t[n], e[n])) return !1;
|
|
4956
4967
|
return Object.keys(e).length === s;
|
|
4957
4968
|
}
|
|
4958
4969
|
}
|
|
@@ -4962,7 +4973,7 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
4962
4973
|
}, te = (
|
|
4963
4974
|
/*#__NOINLINE__*/
|
|
4964
4975
|
Me()
|
|
4965
|
-
), bs = Object, R = (t) => t === te, we = (t) => typeof t == "function",
|
|
4976
|
+
), bs = Object, R = (t) => t === te, we = (t) => typeof t == "function", Ve = (t, e) => Be(Be({}, t), e), Xr = (t) => we(t.then), Fn = {}, nn = {}, js = "undefined", Xt = typeof window != js, ws = typeof document != js, oc = Xt && "Deno" in window, cc = () => Xt && typeof window.requestAnimationFrame != js, Yr = (t, e) => {
|
|
4966
4977
|
const n = Re.get(t);
|
|
4967
4978
|
return [
|
|
4968
4979
|
// Getter
|
|
@@ -4971,7 +4982,7 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
4971
4982
|
(s) => {
|
|
4972
4983
|
if (!R(e)) {
|
|
4973
4984
|
const r = t.get(e);
|
|
4974
|
-
e in nn || (nn[e] = r), n[5](e,
|
|
4985
|
+
e in nn || (nn[e] = r), n[5](e, Ve(r, s), r || Fn);
|
|
4975
4986
|
}
|
|
4976
4987
|
},
|
|
4977
4988
|
// Subscriber
|
|
@@ -4981,7 +4992,7 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
4981
4992
|
];
|
|
4982
4993
|
};
|
|
4983
4994
|
let ks = !0;
|
|
4984
|
-
const uc = () => ks, [
|
|
4995
|
+
const uc = () => ks, [Es, xs] = Xt && window.addEventListener ? [
|
|
4985
4996
|
window.addEventListener.bind(window),
|
|
4986
4997
|
window.removeEventListener.bind(window)
|
|
4987
4998
|
] : [
|
|
@@ -4990,16 +5001,16 @@ const uc = () => ks, [xs, Es] = Xt && window.addEventListener ? [
|
|
|
4990
5001
|
], dc = () => {
|
|
4991
5002
|
const t = ws && document.visibilityState;
|
|
4992
5003
|
return R(t) || t !== "hidden";
|
|
4993
|
-
}, lc = (t) => (ws && document.addEventListener("visibilitychange", t),
|
|
4994
|
-
ws && document.removeEventListener("visibilitychange", t),
|
|
5004
|
+
}, lc = (t) => (ws && document.addEventListener("visibilitychange", t), Es("focus", t), () => {
|
|
5005
|
+
ws && document.removeEventListener("visibilitychange", t), xs("focus", t);
|
|
4995
5006
|
}), fc = (t) => {
|
|
4996
5007
|
const e = () => {
|
|
4997
5008
|
ks = !0, t();
|
|
4998
5009
|
}, n = () => {
|
|
4999
5010
|
ks = !1;
|
|
5000
5011
|
};
|
|
5001
|
-
return
|
|
5002
|
-
|
|
5012
|
+
return Es("online", e), Es("offline", n), () => {
|
|
5013
|
+
xs("online", e), xs("offline", n);
|
|
5003
5014
|
};
|
|
5004
5015
|
}, hc = {
|
|
5005
5016
|
isOnline: uc,
|
|
@@ -5007,13 +5018,13 @@ const uc = () => ks, [xs, Es] = Xt && window.addEventListener ? [
|
|
|
5007
5018
|
}, pc = {
|
|
5008
5019
|
initFocus: lc,
|
|
5009
5020
|
initReconnect: fc
|
|
5010
|
-
},
|
|
5021
|
+
}, xr = !Gt.useId, Ht = !Xt || oc, mc = (t) => cc() ? window.requestAnimationFrame(t) : setTimeout(t, 1), Wn = Ht ? ha : pa, Vn = typeof navigator != "undefined" && navigator.connection, Sr = !Ht && Vn && ([
|
|
5011
5022
|
"slow-2g",
|
|
5012
5023
|
"2g"
|
|
5013
|
-
].includes(
|
|
5024
|
+
].includes(Vn.effectiveType) || Vn.saveData), sn = /* @__PURE__ */ new WeakMap(), Un = (t, e) => bs.prototype.toString.call(t) === `[object ${e}]`;
|
|
5014
5025
|
let yc = 0;
|
|
5015
5026
|
const Ss = (t) => {
|
|
5016
|
-
const e = typeof t, n =
|
|
5027
|
+
const e = typeof t, n = Un(t, "Date"), s = Un(t, "RegExp"), r = Un(t, "Object");
|
|
5017
5028
|
let a, i;
|
|
5018
5029
|
if (bs(t) === t && !n && !s) {
|
|
5019
5030
|
if (a = sn.get(t), a) return a;
|
|
@@ -5032,7 +5043,7 @@ const Ss = (t) => {
|
|
|
5032
5043
|
} else
|
|
5033
5044
|
a = n ? t.toJSON() : e == "symbol" ? t.toString() : e == "string" ? JSON.stringify(t) : "" + t;
|
|
5034
5045
|
return a;
|
|
5035
|
-
},
|
|
5046
|
+
}, Is = (t) => {
|
|
5036
5047
|
if (we(t))
|
|
5037
5048
|
try {
|
|
5038
5049
|
t = t();
|
|
@@ -5048,8 +5059,8 @@ const Ss = (t) => {
|
|
|
5048
5059
|
let gc = 0;
|
|
5049
5060
|
const Os = () => ++gc;
|
|
5050
5061
|
function Qr(...t) {
|
|
5051
|
-
return
|
|
5052
|
-
const [e, n, s, r] = t, a =
|
|
5062
|
+
return je(this, null, function* () {
|
|
5063
|
+
const [e, n, s, r] = t, a = Ve({
|
|
5053
5064
|
populateCache: !0,
|
|
5054
5065
|
throwOnError: !0
|
|
5055
5066
|
}, typeof r == "boolean" ? {
|
|
@@ -5068,44 +5079,44 @@ function Qr(...t) {
|
|
|
5068
5079
|
}
|
|
5069
5080
|
return p(n);
|
|
5070
5081
|
function p(k) {
|
|
5071
|
-
return
|
|
5072
|
-
const [g] =
|
|
5082
|
+
return je(this, null, function* () {
|
|
5083
|
+
const [g] = Is(k);
|
|
5073
5084
|
if (!g) return;
|
|
5074
|
-
const [b, m] = Yr(e, g), [
|
|
5075
|
-
const fe =
|
|
5076
|
-
return (we(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete
|
|
5085
|
+
const [b, m] = Yr(e, g), [v, l, A, j] = Re.get(e), B = () => {
|
|
5086
|
+
const fe = v[g];
|
|
5087
|
+
return (we(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete A[g], delete j[g], fe && fe[0]) ? fe[0](Jr).then(() => b().data) : b().data;
|
|
5077
5088
|
};
|
|
5078
5089
|
if (t.length < 3)
|
|
5079
|
-
return
|
|
5080
|
-
let Z = s,
|
|
5090
|
+
return B();
|
|
5091
|
+
let Z = s, U;
|
|
5081
5092
|
const D = Os();
|
|
5082
5093
|
l[g] = [
|
|
5083
5094
|
D,
|
|
5084
5095
|
0
|
|
5085
5096
|
];
|
|
5086
|
-
const M = !R(c), G = b(), $ = G.data, st = G._c,
|
|
5087
|
-
if (M && (c = we(c) ? c(
|
|
5097
|
+
const M = !R(c), G = b(), $ = G.data, st = G._c, Ue = R(st) ? $ : st;
|
|
5098
|
+
if (M && (c = we(c) ? c(Ue, $) : c, m({
|
|
5088
5099
|
data: c,
|
|
5089
|
-
_c:
|
|
5100
|
+
_c: Ue
|
|
5090
5101
|
})), we(Z))
|
|
5091
5102
|
try {
|
|
5092
|
-
Z = Z(
|
|
5103
|
+
Z = Z(Ue);
|
|
5093
5104
|
} catch (fe) {
|
|
5094
|
-
|
|
5105
|
+
U = fe;
|
|
5095
5106
|
}
|
|
5096
5107
|
if (Z && Xr(Z))
|
|
5097
5108
|
if (Z = yield Z.catch((fe) => {
|
|
5098
|
-
|
|
5109
|
+
U = fe;
|
|
5099
5110
|
}), D !== l[g][0]) {
|
|
5100
|
-
if (
|
|
5111
|
+
if (U) throw U;
|
|
5101
5112
|
return Z;
|
|
5102
|
-
} else
|
|
5103
|
-
data:
|
|
5113
|
+
} else U && M && u(U) && (i = !0, m({
|
|
5114
|
+
data: Ue,
|
|
5104
5115
|
_c: te
|
|
5105
5116
|
}));
|
|
5106
|
-
if (i && !
|
|
5117
|
+
if (i && !U)
|
|
5107
5118
|
if (we(i)) {
|
|
5108
|
-
const fe = i(Z,
|
|
5119
|
+
const fe = i(Z, Ue);
|
|
5109
5120
|
m({
|
|
5110
5121
|
data: fe,
|
|
5111
5122
|
error: te,
|
|
@@ -5117,12 +5128,12 @@ function Qr(...t) {
|
|
|
5117
5128
|
error: te,
|
|
5118
5129
|
_c: te
|
|
5119
5130
|
});
|
|
5120
|
-
if (l[g][1] = Os(), Promise.resolve(
|
|
5131
|
+
if (l[g][1] = Os(), Promise.resolve(B()).then(() => {
|
|
5121
5132
|
m({
|
|
5122
5133
|
_c: te
|
|
5123
5134
|
});
|
|
5124
|
-
}),
|
|
5125
|
-
if (h) throw
|
|
5135
|
+
}), U) {
|
|
5136
|
+
if (h) throw U;
|
|
5126
5137
|
return;
|
|
5127
5138
|
}
|
|
5128
5139
|
return Z;
|
|
@@ -5135,7 +5146,7 @@ const Or = (t, e) => {
|
|
|
5135
5146
|
t[n][0] && t[n][0](e);
|
|
5136
5147
|
}, vc = (t, e) => {
|
|
5137
5148
|
if (!Re.has(t)) {
|
|
5138
|
-
const n =
|
|
5149
|
+
const n = Ve(pc, e), s = /* @__PURE__ */ Object.create(null), r = Qr.bind(te, t);
|
|
5139
5150
|
let a = Me;
|
|
5140
5151
|
const i = /* @__PURE__ */ Object.create(null), o = (h, p) => {
|
|
5141
5152
|
const k = i[h] || [];
|
|
@@ -5176,7 +5187,7 @@ const Or = (t, e) => {
|
|
|
5176
5187
|
}, _c = (t, e, n, s, r) => {
|
|
5177
5188
|
const a = n.errorRetryCount, i = r.retryCount, o = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * n.errorRetryInterval;
|
|
5178
5189
|
!R(a) && i > a || setTimeout(s, o, r);
|
|
5179
|
-
}, bc = _s, [ea, wc] = vc(/* @__PURE__ */ new Map()), kc =
|
|
5190
|
+
}, bc = _s, [ea, wc] = vc(/* @__PURE__ */ new Map()), kc = Ve(
|
|
5180
5191
|
{
|
|
5181
5192
|
// events
|
|
5182
5193
|
onLoadingSlow: Me,
|
|
@@ -5203,14 +5214,14 @@ const Or = (t, e) => {
|
|
|
5203
5214
|
},
|
|
5204
5215
|
// use web preset by default
|
|
5205
5216
|
hc
|
|
5206
|
-
),
|
|
5207
|
-
const n =
|
|
5217
|
+
), Ec = (t, e) => {
|
|
5218
|
+
const n = Ve(t, e);
|
|
5208
5219
|
if (e) {
|
|
5209
5220
|
const { use: s, fallback: r } = t, { use: a, fallback: i } = e;
|
|
5210
|
-
s && a && (n.use = s.concat(a)), r && i && (n.fallback =
|
|
5221
|
+
s && a && (n.use = s.concat(a)), r && i && (n.fallback = Ve(r, i));
|
|
5211
5222
|
}
|
|
5212
5223
|
return n;
|
|
5213
|
-
},
|
|
5224
|
+
}, xc = fa({}), Sc = "$inf$", ta = Xt && window.__SWR_DEVTOOLS_USE__, Oc = ta ? window.__SWR_DEVTOOLS_USE__ : [], Tc = () => {
|
|
5214
5225
|
ta && (window.__SWR_DEVTOOLS_REACT__ = Gt);
|
|
5215
5226
|
}, Ac = (t) => we(t[1]) ? [
|
|
5216
5227
|
t[0],
|
|
@@ -5220,20 +5231,20 @@ const Or = (t, e) => {
|
|
|
5220
5231
|
t[0],
|
|
5221
5232
|
null,
|
|
5222
5233
|
(t[1] === null ? t[2] : t[1]) || {}
|
|
5223
|
-
], Cc = () =>
|
|
5224
|
-
const [i] =
|
|
5234
|
+
], Cc = () => Ve(kc, ma(xc)), Nc = (t) => (e, n, s) => t(e, n && ((...a) => {
|
|
5235
|
+
const [i] = Is(e), [, , , o] = Re.get(ea);
|
|
5225
5236
|
if (i.startsWith(Sc))
|
|
5226
5237
|
return n(...a);
|
|
5227
5238
|
const c = o[i];
|
|
5228
5239
|
return R(c) ? n(...a) : (delete o[i], c);
|
|
5229
5240
|
}), s), Rc = Oc.concat(Nc), Pc = (t) => function(...n) {
|
|
5230
|
-
const s = Cc(), [r, a, i] = Ac(n), o =
|
|
5241
|
+
const s = Cc(), [r, a, i] = Ac(n), o = Ec(s, i);
|
|
5231
5242
|
let c = t;
|
|
5232
5243
|
const { use: u } = o, h = (u || []).concat(Rc);
|
|
5233
5244
|
for (let p = h.length; p--; )
|
|
5234
5245
|
c = h[p](c);
|
|
5235
5246
|
return c(r, a || o.fetcher || null, o);
|
|
5236
|
-
},
|
|
5247
|
+
}, jc = (t, e, n) => {
|
|
5237
5248
|
const s = e[t] || (e[t] = []);
|
|
5238
5249
|
return s.push(n), () => {
|
|
5239
5250
|
const r = s.indexOf(n);
|
|
@@ -5260,10 +5271,10 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5260
5271
|
t.status = "rejected", t.reason = e;
|
|
5261
5272
|
}), t;
|
|
5262
5273
|
}
|
|
5263
|
-
}),
|
|
5274
|
+
}), Bn = {
|
|
5264
5275
|
dedupe: !0
|
|
5265
|
-
},
|
|
5266
|
-
const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [g, b, m,
|
|
5276
|
+
}, Ic = (t, e, n) => {
|
|
5277
|
+
const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [g, b, m, v] = Re.get(s), [l, A] = Is(t), j = Ke(!1), B = Ke(!1), Z = Ke(l), U = Ke(e), D = Ke(n), M = () => D.current, G = () => M().isVisible() && M().isOnline(), [$, st, Ue, fe] = Yr(s, l), rt = Ke({}).current, Yt = R(i) ? R(n.fallback) ? te : n.fallback[l] : i, Zs = (F, L) => {
|
|
5267
5278
|
for (const J in rt) {
|
|
5268
5279
|
const z = J;
|
|
5269
5280
|
if (z === "data") {
|
|
@@ -5275,8 +5286,8 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5275
5286
|
return !0;
|
|
5276
5287
|
}, Ds = ya(() => {
|
|
5277
5288
|
const F = !l || !e ? !1 : R(o) ? M().isPaused() || a ? !1 : c !== !1 : o, L = (Q) => {
|
|
5278
|
-
const Oe =
|
|
5279
|
-
return delete Oe._k, F ?
|
|
5289
|
+
const Oe = Ve(Q);
|
|
5290
|
+
return delete Oe._k, F ? Be({
|
|
5280
5291
|
isValidating: !0,
|
|
5281
5292
|
isLoading: !0
|
|
5282
5293
|
}, Oe) : Oe;
|
|
@@ -5293,7 +5304,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5293
5304
|
s,
|
|
5294
5305
|
l
|
|
5295
5306
|
]), at = ic.useSyncExternalStore(rn(
|
|
5296
|
-
(F) =>
|
|
5307
|
+
(F) => Ue(l, (L, J) => {
|
|
5297
5308
|
Zs(J, L) || F();
|
|
5298
5309
|
}),
|
|
5299
5310
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -5301,31 +5312,31 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5301
5312
|
s,
|
|
5302
5313
|
l
|
|
5303
5314
|
]
|
|
5304
|
-
), Ds[0], Ds[1]), Ms = !
|
|
5305
|
-
(F) =>
|
|
5306
|
-
const L =
|
|
5307
|
-
if (!l || !L ||
|
|
5315
|
+
), Ds[0], Ds[1]), Ms = !j.current, na = g[l] && g[l].length > 0, it = at.data, ze = R(it) ? Yt && Xr(Yt) ? zn(Yt) : Yt : it, Qt = at.error, An = Ke(ze), en = k ? R(it) ? R(An.current) ? ze : An.current : it : ze, Ls = na && !R(Qt) ? !1 : Ms && !R(o) ? o : M().isPaused() ? !1 : a ? R(ze) ? !1 : c : R(ze) || c, $s = !!(l && e && Ms && Ls), sa = R(at.isValidating) ? $s : at.isValidating, ra = R(at.isLoading) ? $s : at.isLoading, wt = rn(
|
|
5316
|
+
(F) => je(void 0, null, function* () {
|
|
5317
|
+
const L = U.current;
|
|
5318
|
+
if (!l || !L || B.current || M().isPaused())
|
|
5308
5319
|
return !1;
|
|
5309
5320
|
let J, z, he = !0;
|
|
5310
|
-
const ot = F || {}, H = !m[l] || !ot.dedupe, Q = () =>
|
|
5321
|
+
const ot = F || {}, H = !m[l] || !ot.dedupe, Q = () => xr ? !B.current && l === Z.current && j.current : l === Z.current, Oe = {
|
|
5311
5322
|
isValidating: !1,
|
|
5312
5323
|
isLoading: !1
|
|
5313
5324
|
}, Ws = () => {
|
|
5314
5325
|
st(Oe);
|
|
5315
|
-
},
|
|
5326
|
+
}, Vs = () => {
|
|
5316
5327
|
const de = m[l];
|
|
5317
5328
|
de && de[1] === z && delete m[l];
|
|
5318
|
-
},
|
|
5329
|
+
}, Us = {
|
|
5319
5330
|
isValidating: !0
|
|
5320
5331
|
};
|
|
5321
|
-
R($().data) && (
|
|
5332
|
+
R($().data) && (Us.isLoading = !0);
|
|
5322
5333
|
try {
|
|
5323
|
-
if (H && (st(
|
|
5334
|
+
if (H && (st(Us), n.loadingTimeout && R($().data) && setTimeout(() => {
|
|
5324
5335
|
he && Q() && M().onLoadingSlow(l, n);
|
|
5325
5336
|
}, n.loadingTimeout), m[l] = [
|
|
5326
|
-
L(
|
|
5337
|
+
L(A),
|
|
5327
5338
|
Os()
|
|
5328
|
-
]), [J, z] = m[l], J = yield J, H && setTimeout(
|
|
5339
|
+
]), [J, z] = m[l], J = yield J, H && setTimeout(Vs, n.dedupingInterval), !m[l] || m[l][1] !== z)
|
|
5329
5340
|
return H && Q() && M().onDiscarded(l), !1;
|
|
5330
5341
|
Oe.error = te;
|
|
5331
5342
|
const de = b[l];
|
|
@@ -5337,7 +5348,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5337
5348
|
const Te = $().data;
|
|
5338
5349
|
Oe.data = r(Te, J) ? Te : J, H && Q() && M().onSuccess(J, l, n);
|
|
5339
5350
|
} catch (de) {
|
|
5340
|
-
|
|
5351
|
+
Vs();
|
|
5341
5352
|
const Te = M(), { shouldRetryOnError: Cn } = Te;
|
|
5342
5353
|
Te.isPaused() || (Oe.error = de, H && Q() && (Te.onError(de, l, Te), (Cn === !0 || we(Cn) && Cn(de)) && (!M().revalidateOnFocus || !M().revalidateOnReconnect || G()) && Te.onErrorRetry(de, l, Te, (aa) => {
|
|
5343
5354
|
const Nn = g[l];
|
|
@@ -5371,13 +5382,13 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5371
5382
|
[]
|
|
5372
5383
|
);
|
|
5373
5384
|
if (Wn(() => {
|
|
5374
|
-
|
|
5385
|
+
U.current = e, D.current = n, R(it) || (An.current = it);
|
|
5375
5386
|
}), Wn(() => {
|
|
5376
5387
|
if (!l) return;
|
|
5377
|
-
const F = wt.bind(te,
|
|
5388
|
+
const F = wt.bind(te, Bn);
|
|
5378
5389
|
let L = 0;
|
|
5379
5390
|
M().revalidateOnFocus && (L = Date.now() + M().focusThrottleInterval);
|
|
5380
|
-
const z =
|
|
5391
|
+
const z = jc(l, g, (he, ot = {}) => {
|
|
5381
5392
|
if (he == Hr) {
|
|
5382
5393
|
const H = Date.now();
|
|
5383
5394
|
M().revalidateOnFocus && H > L && G() && (L = H + M().focusThrottleInterval, F());
|
|
@@ -5390,10 +5401,10 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5390
5401
|
return wt(ot);
|
|
5391
5402
|
}
|
|
5392
5403
|
});
|
|
5393
|
-
return
|
|
5394
|
-
_k:
|
|
5404
|
+
return B.current = !1, Z.current = l, j.current = !0, st({
|
|
5405
|
+
_k: A
|
|
5395
5406
|
}), Ls && (R(ze) || Ht ? F() : mc(F)), () => {
|
|
5396
|
-
|
|
5407
|
+
B.current = !0, z();
|
|
5397
5408
|
};
|
|
5398
5409
|
}, [
|
|
5399
5410
|
l
|
|
@@ -5404,7 +5415,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5404
5415
|
z && F !== -1 && (F = setTimeout(J, z));
|
|
5405
5416
|
}
|
|
5406
5417
|
function J() {
|
|
5407
|
-
!$().error && (h || M().isVisible()) && (p || M().isOnline()) ? wt(
|
|
5418
|
+
!$().error && (h || M().isVisible()) && (p || M().isOnline()) ? wt(Bn).then(L) : L();
|
|
5408
5419
|
}
|
|
5409
5420
|
return L(), () => {
|
|
5410
5421
|
F && (clearTimeout(F), F = -1);
|
|
@@ -5415,16 +5426,16 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5415
5426
|
p,
|
|
5416
5427
|
l
|
|
5417
5428
|
]), ga(en), a && R(ze) && l) {
|
|
5418
|
-
if (!
|
|
5429
|
+
if (!xr && Ht)
|
|
5419
5430
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
5420
|
-
|
|
5421
|
-
const F =
|
|
5431
|
+
U.current = e, D.current = n, B.current = !1;
|
|
5432
|
+
const F = v[l];
|
|
5422
5433
|
if (!R(F)) {
|
|
5423
5434
|
const L = Fs(F);
|
|
5424
5435
|
zn(L);
|
|
5425
5436
|
}
|
|
5426
5437
|
if (R(Qt)) {
|
|
5427
|
-
const L = wt(
|
|
5438
|
+
const L = wt(Bn);
|
|
5428
5439
|
R(en) || (L.status = "fulfilled", L.value = !0), zn(L);
|
|
5429
5440
|
} else
|
|
5430
5441
|
throw Qt;
|
|
@@ -5444,7 +5455,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5444
5455
|
return rt.isLoading = !0, ra;
|
|
5445
5456
|
}
|
|
5446
5457
|
};
|
|
5447
|
-
}, Zc = Pc(
|
|
5458
|
+
}, Zc = Pc(Ic), Fc = ({
|
|
5448
5459
|
fileKey: t,
|
|
5449
5460
|
authToken: e,
|
|
5450
5461
|
enabled: n = !0,
|