@marimo-team/islands 0.14.11-dev7 → 0.14.11-dev72
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/{ConnectedDataExplorerComponent-VTfcqOZN.js → ConnectedDataExplorerComponent-CDia3Uq3.js} +4 -4
- package/dist/{ImageComparisonComponent-b5udtUaG.js → ImageComparisonComponent-D8GDn93y.js} +1 -1
- package/dist/{VegaLite-CZ2MktvJ.js → VegaLite-B0DAcE_0.js} +6799 -7018
- package/dist/{_baseUniq-Dxs4JH0Y.js → _baseUniq-C0VlTHW8.js} +48 -48
- package/dist/{any-language-editor-CPmAtELv.js → any-language-editor-DPcbYqjc.js} +1 -1
- package/dist/{architectureDiagram-IEHRJDOE-CP88TKjC.js → architectureDiagram-NQ2NVSRB-C2Ajtpmz.js} +897 -894
- package/dist/assets/{save-worker-BIDtxCd1.js → save-worker-fI5ofStJ.js} +1040 -1405
- package/dist/assets/worker-BLUAwPAO.js +3790 -0
- package/dist/assets/worker-BldghCZh.js +3752 -0
- package/dist/{blockDiagram-JOT3LUYC-C2rusulX.js → blockDiagram-PHRCVELO-xrhIbibO.js} +534 -522
- package/dist/{c4Diagram-VJAJSXHY-CE4R-Yj-.js → c4Diagram-6F6E4RAY-B9M8UZ5C.js} +4 -4
- package/dist/{channel-BTOPiHD4.js → channel-D3Z57-L0.js} +1 -1
- package/dist/{chunk-4BMEZGHF-BGr1mHPI.js → chunk-353BL4L5-B8RJflA2.js} +1 -1
- package/dist/{chunk-D6G4REZN-B3t5XG_V.js → chunk-67H74DCK-DjF3P_6n.js} +1 -1
- package/dist/chunk-6OLS64BW-DwBPGTBy.js +1383 -0
- package/dist/{chunk-XZIHB7SX-Bb6YfyvK.js → chunk-AACKK3MU-BNqFtiBq.js} +1 -1
- package/dist/chunk-BFAMUDN2-C7-45IWl.js +8 -0
- package/dist/chunk-E2GYISFI-D6ZMZ5f1.js +19 -0
- package/dist/{chunk-A2AXSNBT-BNYLnU9D.js → chunk-QEP2MXWD-ThQxWRcu.js} +30 -27
- package/dist/chunk-SKB7J2MH-DSRt4RR9.js +20 -0
- package/dist/{classDiagram-GIVACNV2-BGu4avYg.js → classDiagram-BGRH5UQR-Dhwtv8yj.js} +2 -2
- package/dist/{classDiagram-v2-COTLJTTW-BGu4avYg.js → classDiagram-v2-O24JOBDK-Dhwtv8yj.js} +2 -2
- package/dist/{clone-gdQZ-8A5.js → clone-CdbI6pj6.js} +1 -1
- package/dist/{dagre-OKDRZEBW-B4FgIhBO.js → dagre-FFZHY6LT-D2JmeFTB.js} +8 -8
- package/dist/data-grid-overlay-editor-CKgEMxxc.js +105 -0
- package/dist/diagram-3EMPZRKU-JHPbiJCi.js +313 -0
- package/dist/diagram-5UYTHUR4-eEJi5-6t.js +137 -0
- package/dist/{diagram-SSKATNLV-DYldQ1nJ.js → diagram-ZTM2IBQH-D88l5hnm.js} +3 -3
- package/dist/{erDiagram-Q7BY3M3F-Bn1YCXnZ.js → erDiagram-R3QVA2FD-BGlTaWTV.js} +6 -5
- package/dist/{flowDiagram-4HSFHLVR-Cv6sE3SQ.js → flowDiagram-PKI6S5ZS-CQVcnZSd.js} +283 -278
- package/dist/{ganttDiagram-APWFNJXF-CCEsgCwo.js → ganttDiagram-EK5VF46D-CkFx0RaP.js} +459 -445
- package/dist/{gitGraphDiagram-7IBYFJ6S-CXgtNvZc.js → gitGraphDiagram-GW3U2K7C-D-gRVxCj.js} +35 -35
- package/dist/glide-data-editor-BLSOKrmw.js +12893 -0
- package/dist/{graph-N78OoukA.js → graph-Dz3qJaaG.js} +3 -3
- package/dist/{index-DLWDWxiI.js → index-Bxfs9Hk_.js} +6 -3
- package/dist/{index-s-KrzpFz.js → index-CDGjWl9n.js} +4 -4
- package/dist/{index-B6r1oHeS.js → index-CaY3iMRr.js} +1 -1
- package/dist/{index-BTWM953l.js → index-DwK5Y7p2.js} +3 -3
- package/dist/index-pBmAzQJl.js +235 -0
- package/dist/{infoDiagram-PH2N3AL5-DqyXVVcE.js → infoDiagram-RLU2ROGC-DtDTKm7d.js} +5 -3
- package/dist/journeyDiagram-EWQZEKCU-Bf6s-6jc.js +836 -0
- package/dist/{kanban-definition-NDS4AKOZ-CwEmTRTQ.js → kanban-definition-ILFWEQ3N-DAtyajgG.js} +41 -39
- package/dist/{layout-ClDNXAo5.js → layout-C2EoBYrV.js} +35 -35
- package/dist/{linear-lyO559qg.js → linear-D6CkH6Kj.js} +25 -25
- package/dist/{main-DGt3HrKs.js → main-ZWGPaFnn.js} +55759 -55421
- package/dist/main.js +2 -2
- package/dist/{mermaid-q6_P6X8T.js → mermaid-CzkcAUDB.js} +4925 -4853
- package/dist/{min-ByCW12IZ.js → min-Bo5Qh008.js} +24 -24
- package/dist/{mindmap-definition-ALO5MXBD-ixE8jD_p.js → mindmap-definition-CZNETY7S-CqwLUoQ1.js} +3 -3
- package/dist/number-overlay-editor-mhiEvTMk.js +599 -0
- package/dist/{pieDiagram-IB7DONF6-CmGcPA5S.js → pieDiagram-NIOCPIFQ-BVoanLni.js} +3 -3
- package/dist/{quadrantDiagram-7GDLP6J5-BcuouniC.js → quadrantDiagram-2OG54O6I-C_U4EVXZ.js} +2 -2
- package/dist/{react-plotly-CKjey4TC.js → react-plotly-DY4XU5-Q.js} +1 -1
- package/dist/{requirementDiagram-KVF5MWMF-CpADntW_.js → requirementDiagram-SO3GGRV7-B_IuYu5S.js} +5 -4
- package/dist/{sankeyDiagram-QLVOVGJD-RiHM-gc1.js → sankeyDiagram-4UZDY2LN-DHDmWj2L.js} +11 -11
- package/dist/{sequenceDiagram-X6HHIX6F-zjDlErjG.js → sequenceDiagram-ZIKVLSP4-B0FsKMNg.js} +151 -149
- package/dist/{slides-component-D-T7V3Um.js → slides-component-CQ1m__jq.js} +969 -962
- package/dist/stateDiagram-XX37X6EN-CVOR_WQQ.js +264 -0
- package/dist/{stateDiagram-v2-YXO3MK2T-hmq0VkWg.js → stateDiagram-v2-GD6S3NHB-BDaP6oYI.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{time-CySBB51c.js → time-95e914-x.js} +2 -2
- package/dist/{timeline-definition-BDJGKUSR-BFWD7bgu.js → timeline-definition-RI47OAVP-Bc7rrp3P.js} +99 -102
- package/dist/{radar-MK3ICKWK-DD-wL37j.js → treemap-FKARHQ26-DFP3Gxy8.js} +2469 -2330
- package/dist/{vega-component-D8e5IG1f.js → vega-component-C6HtQfwj.js} +19 -19
- package/dist/{xychartDiagram-VJFVF3MP-BO6y-mli.js → xychartDiagram-H2YORKM3-sWRpcEy4.js} +409 -375
- package/package.json +45 -44
- package/dist/assets/worker-BcyuOSTi.js +0 -4117
- package/dist/assets/worker-Dz6PPEGc.js +0 -4115
- package/dist/chunk-AEK57VVT-BjKsSzf4.js +0 -1416
- package/dist/chunk-RZ5BOZE2-BQRA6_lz.js +0 -24
- package/dist/data-editor-LPDyjTPa.js +0 -32933
- package/dist/diagram-VNBRO52H-BtnkOAZg.js +0 -126
- package/dist/journeyDiagram-U35MCT3I-7reCe8rl.js +0 -809
- package/dist/stateDiagram-DGXRK772-DwIrysh_.js +0 -271
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
var Yt = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
2
|
+
var tn = Yt((sn, Ue) => {
|
|
3
|
+
const Xt = 1e10, Gt = 1e3;
|
|
4
|
+
function me(t, e) {
|
|
5
5
|
const r = t.map((n) => `"${n}"`).join(", ");
|
|
6
6
|
return new Error(`This RPC instance cannot ${e} because the transport did not provide one or more of these methods: ${r}`);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Kt(t = {}) {
|
|
9
9
|
let e = {};
|
|
10
|
-
function r(
|
|
11
|
-
e =
|
|
10
|
+
function r(m) {
|
|
11
|
+
e = m;
|
|
12
12
|
}
|
|
13
13
|
let n = {};
|
|
14
|
-
function s(
|
|
15
|
-
n.unregisterHandler && n.unregisterHandler(), n =
|
|
14
|
+
function s(m) {
|
|
15
|
+
n.unregisterHandler && n.unregisterHandler(), n = m, n.registerHandler?.(Jt);
|
|
16
16
|
}
|
|
17
17
|
let a;
|
|
18
|
-
function i(
|
|
19
|
-
if (typeof
|
|
20
|
-
a =
|
|
18
|
+
function i(m) {
|
|
19
|
+
if (typeof m == "function") {
|
|
20
|
+
a = m;
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
a = (
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
throw new Error(`The requested method has no handler: ${
|
|
30
|
-
return
|
|
23
|
+
a = (x, E) => {
|
|
24
|
+
const T = m[x];
|
|
25
|
+
if (T)
|
|
26
|
+
return T(E);
|
|
27
|
+
const I = m._;
|
|
28
|
+
if (!I)
|
|
29
|
+
throw new Error(`The requested method has no handler: ${x}`);
|
|
30
|
+
return I(x, E);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const { maxRequestTime: o =
|
|
33
|
+
const { maxRequestTime: o = Gt } = t;
|
|
34
34
|
t.transport && s(t.transport), t.requestHandler && i(t.requestHandler), t._debugHooks && r(t._debugHooks);
|
|
35
35
|
let d = 0;
|
|
36
|
-
function
|
|
37
|
-
return d <=
|
|
36
|
+
function u() {
|
|
37
|
+
return d <= Xt ? ++d : d = 0;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
function
|
|
41
|
-
const E =
|
|
42
|
-
return new Promise((
|
|
39
|
+
const h = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
|
|
40
|
+
function S(m, ...x) {
|
|
41
|
+
const E = x[0];
|
|
42
|
+
return new Promise((T, I) => {
|
|
43
43
|
if (!n.send)
|
|
44
|
-
throw
|
|
45
|
-
const
|
|
44
|
+
throw me(["send"], "make requests");
|
|
45
|
+
const Z = u(), Xe = {
|
|
46
46
|
type: "request",
|
|
47
|
-
id:
|
|
48
|
-
method:
|
|
47
|
+
id: Z,
|
|
48
|
+
method: m,
|
|
49
49
|
params: E
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, o)), e.onSend?.(
|
|
51
|
+
h.set(Z, { resolve: T, reject: I }), o !== 1 / 0 && b.set(Z, setTimeout(() => {
|
|
52
|
+
b.delete(Z), I(new Error("RPC request timed out."));
|
|
53
|
+
}, o)), e.onSend?.(Xe), n.send(Xe);
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
const A = new Proxy(
|
|
57
|
-
get: (
|
|
58
|
-
}),
|
|
59
|
-
function
|
|
60
|
-
const E =
|
|
56
|
+
const A = new Proxy(S, {
|
|
57
|
+
get: (m, x, E) => x in m ? Reflect.get(m, x, E) : (T) => S(x, T)
|
|
58
|
+
}), $ = A;
|
|
59
|
+
function pe(m, ...x) {
|
|
60
|
+
const E = x[0];
|
|
61
61
|
if (!n.send)
|
|
62
|
-
throw
|
|
63
|
-
const
|
|
62
|
+
throw me(["send"], "send messages");
|
|
63
|
+
const T = {
|
|
64
64
|
type: "message",
|
|
65
|
-
id:
|
|
65
|
+
id: m,
|
|
66
66
|
payload: E
|
|
67
67
|
};
|
|
68
|
-
e.onSend?.(
|
|
68
|
+
e.onSend?.(T), n.send(T);
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
get: (
|
|
72
|
-
}),
|
|
73
|
-
function
|
|
70
|
+
const Je = new Proxy(pe, {
|
|
71
|
+
get: (m, x, E) => x in m ? Reflect.get(m, x, E) : (T) => pe(x, T)
|
|
72
|
+
}), Ye = Je, H = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Set();
|
|
73
|
+
function Bt(m, x) {
|
|
74
74
|
if (!n.registerHandler)
|
|
75
|
-
throw
|
|
76
|
-
if (
|
|
77
|
-
|
|
75
|
+
throw me(["registerHandler"], "register message listeners");
|
|
76
|
+
if (m === "*") {
|
|
77
|
+
Te.add(x);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
H.has(m) || H.set(m, /* @__PURE__ */ new Set()), H.get(m)?.add(x);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
if (
|
|
84
|
-
|
|
82
|
+
function Wt(m, x) {
|
|
83
|
+
if (m === "*") {
|
|
84
|
+
Te.delete(x);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
H.get(m)?.delete(x), H.get(m)?.size === 0 && H.delete(m);
|
|
88
88
|
}
|
|
89
|
-
async function
|
|
90
|
-
if (e.onReceive?.(
|
|
89
|
+
async function Jt(m) {
|
|
90
|
+
if (e.onReceive?.(m), !("type" in m))
|
|
91
91
|
throw new Error("Message does not contain a type.");
|
|
92
|
-
if (
|
|
92
|
+
if (m.type === "request") {
|
|
93
93
|
if (!n.send || !a)
|
|
94
|
-
throw
|
|
95
|
-
const { id:
|
|
96
|
-
let
|
|
94
|
+
throw me(["send", "requestHandler"], "handle requests");
|
|
95
|
+
const { id: x, method: E, params: T } = m;
|
|
96
|
+
let I;
|
|
97
97
|
try {
|
|
98
|
-
|
|
98
|
+
I = {
|
|
99
99
|
type: "response",
|
|
100
|
-
id:
|
|
100
|
+
id: x,
|
|
101
101
|
success: !0,
|
|
102
|
-
payload: await a(E,
|
|
102
|
+
payload: await a(E, T)
|
|
103
103
|
};
|
|
104
|
-
} catch (
|
|
105
|
-
if (!(
|
|
106
|
-
throw
|
|
107
|
-
|
|
104
|
+
} catch (Z) {
|
|
105
|
+
if (!(Z instanceof Error))
|
|
106
|
+
throw Z;
|
|
107
|
+
I = {
|
|
108
108
|
type: "response",
|
|
109
|
-
id:
|
|
109
|
+
id: x,
|
|
110
110
|
success: !1,
|
|
111
|
-
error:
|
|
111
|
+
error: Z.message
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
e.onSend?.(
|
|
114
|
+
e.onSend?.(I), n.send(I);
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const { resolve: E, reject:
|
|
121
|
-
|
|
117
|
+
if (m.type === "response") {
|
|
118
|
+
const x = b.get(m.id);
|
|
119
|
+
x != null && clearTimeout(x);
|
|
120
|
+
const { resolve: E, reject: T } = h.get(m.id) ?? {};
|
|
121
|
+
m.success ? E?.(m.payload) : T?.(new Error(m.error));
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
if (
|
|
125
|
-
for (const E of
|
|
126
|
-
E(
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
124
|
+
if (m.type === "message") {
|
|
125
|
+
for (const E of Te)
|
|
126
|
+
E(m.id, m.payload);
|
|
127
|
+
const x = H.get(m.id);
|
|
128
|
+
if (!x)
|
|
129
129
|
return;
|
|
130
|
-
for (const E of
|
|
131
|
-
E(
|
|
130
|
+
for (const E of x)
|
|
131
|
+
E(m.payload);
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
throw new Error(`Unexpected RPC message type: ${
|
|
134
|
+
throw new Error(`Unexpected RPC message type: ${m.type}`);
|
|
135
135
|
}
|
|
136
136
|
return {
|
|
137
137
|
setTransport: s,
|
|
138
138
|
setRequestHandler: i,
|
|
139
139
|
request: A,
|
|
140
|
-
requestProxy:
|
|
141
|
-
send:
|
|
142
|
-
sendProxy:
|
|
143
|
-
addMessageListener:
|
|
144
|
-
removeMessageListener:
|
|
145
|
-
proxy: { send:
|
|
140
|
+
requestProxy: $,
|
|
141
|
+
send: Je,
|
|
142
|
+
sendProxy: Ye,
|
|
143
|
+
addMessageListener: Bt,
|
|
144
|
+
removeMessageListener: Wt,
|
|
145
|
+
proxy: { send: Ye, request: $ },
|
|
146
146
|
_setDebugHooks: r
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
return
|
|
149
|
+
function Qt(t) {
|
|
150
|
+
return Kt(t);
|
|
151
151
|
}
|
|
152
|
-
const
|
|
153
|
-
function
|
|
152
|
+
const mt = "[transport-id]";
|
|
153
|
+
function er(t, e) {
|
|
154
154
|
const { transportId: r } = e;
|
|
155
|
-
return r != null ? { [
|
|
155
|
+
return r != null ? { [mt]: r, data: t } : t;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function tr(t, e) {
|
|
158
158
|
const { transportId: r, filter: n } = e, s = n?.();
|
|
159
159
|
if (r != null && s != null)
|
|
160
160
|
throw new Error("Cannot use both `transportId` and `filter` at the same time");
|
|
161
161
|
let a = t;
|
|
162
162
|
if (r) {
|
|
163
|
-
if (t[
|
|
163
|
+
if (t[mt] !== r)
|
|
164
164
|
return [!0];
|
|
165
165
|
a = t.data;
|
|
166
166
|
}
|
|
167
167
|
return s === !1 ? [!0] : [!1, a];
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function rr(t, e = {}) {
|
|
170
170
|
const { transportId: r, filter: n, remotePort: s } = e, a = t, i = s ?? t;
|
|
171
171
|
let o;
|
|
172
172
|
return {
|
|
173
173
|
send(d) {
|
|
174
|
-
i.postMessage(
|
|
174
|
+
i.postMessage(er(d, { transportId: r }));
|
|
175
175
|
},
|
|
176
176
|
registerHandler(d) {
|
|
177
|
-
o = (
|
|
178
|
-
const
|
|
177
|
+
o = (u) => {
|
|
178
|
+
const h = u.data, [b, S] = tr(h, {
|
|
179
179
|
transportId: r,
|
|
180
|
-
filter: () => n?.(
|
|
180
|
+
filter: () => n?.(u)
|
|
181
181
|
});
|
|
182
|
-
|
|
182
|
+
b || d(S);
|
|
183
183
|
}, a.addEventListener("message", o);
|
|
184
184
|
},
|
|
185
185
|
unregisterHandler() {
|
|
@@ -187,13 +187,13 @@ var rs = pr((as, mt) => {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return
|
|
190
|
+
function nr(t) {
|
|
191
|
+
return rr(self, t);
|
|
192
192
|
}
|
|
193
|
-
const
|
|
193
|
+
const ae = {
|
|
194
194
|
NOOP: () => {
|
|
195
195
|
}
|
|
196
|
-
},
|
|
196
|
+
}, yt = (t, e) => {
|
|
197
197
|
const r = `[${t}]`;
|
|
198
198
|
return {
|
|
199
199
|
debug: (...n) => e.debug(r, ...n),
|
|
@@ -201,10 +201,10 @@ var rs = pr((as, mt) => {
|
|
|
201
201
|
warn: (...n) => e.warn(r, ...n),
|
|
202
202
|
error: (...n) => e.error(r, ...n),
|
|
203
203
|
trace: (...n) => e.trace(r, ...n),
|
|
204
|
-
get: (n) =>
|
|
205
|
-
disabled: (n = !0) => n ?
|
|
204
|
+
get: (n) => yt(`${t}.${n}`, e),
|
|
205
|
+
disabled: (n = !0) => n ? _e : e
|
|
206
206
|
};
|
|
207
|
-
},
|
|
207
|
+
}, ve = {
|
|
208
208
|
debug: (...t) => {
|
|
209
209
|
console.debug(...t);
|
|
210
210
|
},
|
|
@@ -220,24 +220,25 @@ var rs = pr((as, mt) => {
|
|
|
220
220
|
trace: (...t) => {
|
|
221
221
|
console.trace(...t);
|
|
222
222
|
},
|
|
223
|
-
get: (t) =>
|
|
224
|
-
disabled: (t = !0) => t ?
|
|
225
|
-
},
|
|
226
|
-
debug: () =>
|
|
227
|
-
log: () =>
|
|
228
|
-
warn: () =>
|
|
229
|
-
error: () =>
|
|
230
|
-
trace: () =>
|
|
231
|
-
get: () =>
|
|
232
|
-
disabled: () =>
|
|
223
|
+
get: (t) => yt(t, ve),
|
|
224
|
+
disabled: (t = !0) => t ? _e : ve
|
|
225
|
+
}, _e = {
|
|
226
|
+
debug: () => ae.NOOP,
|
|
227
|
+
log: () => ae.NOOP,
|
|
228
|
+
warn: () => ae.NOOP,
|
|
229
|
+
error: () => ae.NOOP,
|
|
230
|
+
trace: () => ae.NOOP,
|
|
231
|
+
get: () => _e,
|
|
232
|
+
disabled: () => _e
|
|
233
233
|
};
|
|
234
|
-
function
|
|
235
|
-
return typeof window < "u" && window.Logger ||
|
|
234
|
+
function sr() {
|
|
235
|
+
return typeof window < "u" && window.Logger || ve;
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
var
|
|
237
|
+
const de = sr(), Ae = (t) => new TextDecoder().decode(t);
|
|
238
|
+
var w;
|
|
239
239
|
(function(t) {
|
|
240
|
-
t.assertEqual = (s) =>
|
|
240
|
+
t.assertEqual = (s) => {
|
|
241
|
+
};
|
|
241
242
|
function e(s) {
|
|
242
243
|
}
|
|
243
244
|
t.assertIs = e;
|
|
@@ -265,21 +266,21 @@ var rs = pr((as, mt) => {
|
|
|
265
266
|
for (const i of s)
|
|
266
267
|
if (a(i))
|
|
267
268
|
return i;
|
|
268
|
-
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
269
|
+
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
|
|
269
270
|
function n(s, a = " | ") {
|
|
270
271
|
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
271
272
|
}
|
|
272
273
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
273
|
-
})(
|
|
274
|
-
var
|
|
274
|
+
})(w || (w = {}));
|
|
275
|
+
var Ge;
|
|
275
276
|
(function(t) {
|
|
276
277
|
t.mergeShapes = (e, r) => ({
|
|
277
278
|
...e,
|
|
278
279
|
...r
|
|
279
280
|
// second overwrites first
|
|
280
281
|
});
|
|
281
|
-
})(
|
|
282
|
-
const
|
|
282
|
+
})(Ge || (Ge = {}));
|
|
283
|
+
const f = w.arrayToEnum([
|
|
283
284
|
"string",
|
|
284
285
|
"nan",
|
|
285
286
|
"number",
|
|
@@ -300,28 +301,28 @@ var rs = pr((as, mt) => {
|
|
|
300
301
|
"never",
|
|
301
302
|
"map",
|
|
302
303
|
"set"
|
|
303
|
-
]),
|
|
304
|
+
]), L = (t) => {
|
|
304
305
|
switch (typeof t) {
|
|
305
306
|
case "undefined":
|
|
306
|
-
return
|
|
307
|
+
return f.undefined;
|
|
307
308
|
case "string":
|
|
308
|
-
return
|
|
309
|
+
return f.string;
|
|
309
310
|
case "number":
|
|
310
|
-
return isNaN(t) ?
|
|
311
|
+
return Number.isNaN(t) ? f.nan : f.number;
|
|
311
312
|
case "boolean":
|
|
312
|
-
return
|
|
313
|
+
return f.boolean;
|
|
313
314
|
case "function":
|
|
314
|
-
return
|
|
315
|
+
return f.function;
|
|
315
316
|
case "bigint":
|
|
316
|
-
return
|
|
317
|
+
return f.bigint;
|
|
317
318
|
case "symbol":
|
|
318
|
-
return
|
|
319
|
+
return f.symbol;
|
|
319
320
|
case "object":
|
|
320
|
-
return Array.isArray(t) ?
|
|
321
|
+
return Array.isArray(t) ? f.array : t === null ? f.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? f.promise : typeof Map < "u" && t instanceof Map ? f.map : typeof Set < "u" && t instanceof Set ? f.set : typeof Date < "u" && t instanceof Date ? f.date : f.object;
|
|
321
322
|
default:
|
|
322
|
-
return
|
|
323
|
+
return f.unknown;
|
|
323
324
|
}
|
|
324
|
-
},
|
|
325
|
+
}, c = w.arrayToEnum([
|
|
325
326
|
"invalid_type",
|
|
326
327
|
"invalid_literal",
|
|
327
328
|
"custom",
|
|
@@ -338,8 +339,8 @@ var rs = pr((as, mt) => {
|
|
|
338
339
|
"invalid_intersection_types",
|
|
339
340
|
"not_multiple_of",
|
|
340
341
|
"not_finite"
|
|
341
|
-
])
|
|
342
|
-
class
|
|
342
|
+
]);
|
|
343
|
+
class F extends Error {
|
|
343
344
|
get errors() {
|
|
344
345
|
return this.issues;
|
|
345
346
|
}
|
|
@@ -368,22 +369,22 @@ var rs = pr((as, mt) => {
|
|
|
368
369
|
else {
|
|
369
370
|
let o = n, d = 0;
|
|
370
371
|
for (; d < i.path.length; ) {
|
|
371
|
-
const
|
|
372
|
-
d === i.path.length - 1 ? (o[
|
|
372
|
+
const u = i.path[d];
|
|
373
|
+
d === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(r(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], d++;
|
|
373
374
|
}
|
|
374
375
|
}
|
|
375
376
|
};
|
|
376
377
|
return s(this), n;
|
|
377
378
|
}
|
|
378
379
|
static assert(e) {
|
|
379
|
-
if (!(e instanceof
|
|
380
|
+
if (!(e instanceof F))
|
|
380
381
|
throw new Error(`Not a ZodError: ${e}`);
|
|
381
382
|
}
|
|
382
383
|
toString() {
|
|
383
384
|
return this.message;
|
|
384
385
|
}
|
|
385
386
|
get message() {
|
|
386
|
-
return JSON.stringify(this.issues,
|
|
387
|
+
return JSON.stringify(this.issues, w.jsonStringifyReplacer, 2);
|
|
387
388
|
}
|
|
388
389
|
get isEmpty() {
|
|
389
390
|
return this.issues.length === 0;
|
|
@@ -391,78 +392,79 @@ var rs = pr((as, mt) => {
|
|
|
391
392
|
flatten(e = (r) => r.message) {
|
|
392
393
|
const r = {}, n = [];
|
|
393
394
|
for (const s of this.issues)
|
|
394
|
-
s.path.length > 0
|
|
395
|
+
if (s.path.length > 0) {
|
|
396
|
+
const a = s.path[0];
|
|
397
|
+
r[a] = r[a] || [], r[a].push(e(s));
|
|
398
|
+
} else
|
|
399
|
+
n.push(e(s));
|
|
395
400
|
return { formErrors: n, fieldErrors: r };
|
|
396
401
|
}
|
|
397
402
|
get formErrors() {
|
|
398
403
|
return this.flatten();
|
|
399
404
|
}
|
|
400
405
|
}
|
|
401
|
-
|
|
402
|
-
const
|
|
406
|
+
F.create = (t) => new F(t);
|
|
407
|
+
const Ie = (t, e) => {
|
|
403
408
|
let r;
|
|
404
409
|
switch (t.code) {
|
|
405
|
-
case
|
|
406
|
-
t.received ===
|
|
410
|
+
case c.invalid_type:
|
|
411
|
+
t.received === f.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
|
|
407
412
|
break;
|
|
408
|
-
case
|
|
409
|
-
r = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
413
|
+
case c.invalid_literal:
|
|
414
|
+
r = `Invalid literal value, expected ${JSON.stringify(t.expected, w.jsonStringifyReplacer)}`;
|
|
410
415
|
break;
|
|
411
|
-
case
|
|
412
|
-
r = `Unrecognized key(s) in object: ${
|
|
416
|
+
case c.unrecognized_keys:
|
|
417
|
+
r = `Unrecognized key(s) in object: ${w.joinValues(t.keys, ", ")}`;
|
|
413
418
|
break;
|
|
414
|
-
case
|
|
419
|
+
case c.invalid_union:
|
|
415
420
|
r = "Invalid input";
|
|
416
421
|
break;
|
|
417
|
-
case
|
|
418
|
-
r = `Invalid discriminator value. Expected ${
|
|
422
|
+
case c.invalid_union_discriminator:
|
|
423
|
+
r = `Invalid discriminator value. Expected ${w.joinValues(t.options)}`;
|
|
419
424
|
break;
|
|
420
|
-
case
|
|
421
|
-
r = `Invalid enum value. Expected ${
|
|
425
|
+
case c.invalid_enum_value:
|
|
426
|
+
r = `Invalid enum value. Expected ${w.joinValues(t.options)}, received '${t.received}'`;
|
|
422
427
|
break;
|
|
423
|
-
case
|
|
428
|
+
case c.invalid_arguments:
|
|
424
429
|
r = "Invalid function arguments";
|
|
425
430
|
break;
|
|
426
|
-
case
|
|
431
|
+
case c.invalid_return_type:
|
|
427
432
|
r = "Invalid function return type";
|
|
428
433
|
break;
|
|
429
|
-
case
|
|
434
|
+
case c.invalid_date:
|
|
430
435
|
r = "Invalid date";
|
|
431
436
|
break;
|
|
432
|
-
case
|
|
433
|
-
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` :
|
|
437
|
+
case c.invalid_string:
|
|
438
|
+
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : w.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
|
|
434
439
|
break;
|
|
435
|
-
case
|
|
436
|
-
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
|
|
440
|
+
case c.too_small:
|
|
441
|
+
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
|
|
437
442
|
break;
|
|
438
|
-
case
|
|
443
|
+
case c.too_big:
|
|
439
444
|
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : r = "Invalid input";
|
|
440
445
|
break;
|
|
441
|
-
case
|
|
446
|
+
case c.custom:
|
|
442
447
|
r = "Invalid input";
|
|
443
448
|
break;
|
|
444
|
-
case
|
|
449
|
+
case c.invalid_intersection_types:
|
|
445
450
|
r = "Intersection results could not be merged";
|
|
446
451
|
break;
|
|
447
|
-
case
|
|
452
|
+
case c.not_multiple_of:
|
|
448
453
|
r = `Number must be a multiple of ${t.multipleOf}`;
|
|
449
454
|
break;
|
|
450
|
-
case
|
|
455
|
+
case c.not_finite:
|
|
451
456
|
r = "Number must be finite";
|
|
452
457
|
break;
|
|
453
458
|
default:
|
|
454
|
-
r = e.defaultError,
|
|
459
|
+
r = e.defaultError, w.assertNever(t);
|
|
455
460
|
}
|
|
456
461
|
return { message: r };
|
|
457
462
|
};
|
|
458
|
-
let
|
|
459
|
-
function
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
function ze() {
|
|
463
|
-
return At;
|
|
463
|
+
let ar = Ie;
|
|
464
|
+
function ir() {
|
|
465
|
+
return ar;
|
|
464
466
|
}
|
|
465
|
-
const
|
|
467
|
+
const or = (t) => {
|
|
466
468
|
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], i = {
|
|
467
469
|
...s,
|
|
468
470
|
path: a
|
|
@@ -474,17 +476,17 @@ var rs = pr((as, mt) => {
|
|
|
474
476
|
message: s.message
|
|
475
477
|
};
|
|
476
478
|
let o = "";
|
|
477
|
-
const d = n.filter((
|
|
478
|
-
for (const
|
|
479
|
-
o =
|
|
479
|
+
const d = n.filter((u) => !!u).slice().reverse();
|
|
480
|
+
for (const u of d)
|
|
481
|
+
o = u(i, { data: e, defaultError: o }).message;
|
|
480
482
|
return {
|
|
481
483
|
...s,
|
|
482
484
|
path: a,
|
|
483
485
|
message: o
|
|
484
486
|
};
|
|
485
|
-
}
|
|
486
|
-
function
|
|
487
|
-
const r =
|
|
487
|
+
};
|
|
488
|
+
function l(t, e) {
|
|
489
|
+
const r = ir(), n = or({
|
|
488
490
|
issueData: e,
|
|
489
491
|
data: t.data,
|
|
490
492
|
path: t.path,
|
|
@@ -495,13 +497,13 @@ var rs = pr((as, mt) => {
|
|
|
495
497
|
// then schema-bound map if available
|
|
496
498
|
r,
|
|
497
499
|
// then global override map
|
|
498
|
-
r ===
|
|
500
|
+
r === Ie ? void 0 : Ie
|
|
499
501
|
// then global default map
|
|
500
502
|
].filter((s) => !!s)
|
|
501
503
|
});
|
|
502
504
|
t.common.issues.push(n);
|
|
503
505
|
}
|
|
504
|
-
class
|
|
506
|
+
class R {
|
|
505
507
|
constructor() {
|
|
506
508
|
this.value = "valid";
|
|
507
509
|
}
|
|
@@ -529,7 +531,7 @@ var rs = pr((as, mt) => {
|
|
|
529
531
|
value: i
|
|
530
532
|
});
|
|
531
533
|
}
|
|
532
|
-
return
|
|
534
|
+
return R.mergeObjectSync(e, n);
|
|
533
535
|
}
|
|
534
536
|
static mergeObjectSync(e, r) {
|
|
535
537
|
const n = {};
|
|
@@ -544,30 +546,21 @@ var rs = pr((as, mt) => {
|
|
|
544
546
|
}
|
|
545
547
|
const y = Object.freeze({
|
|
546
548
|
status: "aborted"
|
|
547
|
-
}),
|
|
548
|
-
|
|
549
|
-
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
550
|
-
return e.get(t);
|
|
551
|
-
}
|
|
552
|
-
function Ct(t, e, r, n, s) {
|
|
553
|
-
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
554
|
-
return e.set(t, r), r;
|
|
555
|
-
}
|
|
556
|
-
var h;
|
|
549
|
+
}), ce = (t) => ({ status: "dirty", value: t }), C = (t) => ({ status: "valid", value: t }), Ke = (t) => t.status === "aborted", Qe = (t) => t.status === "dirty", te = (t) => t.status === "valid", ke = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
550
|
+
var p;
|
|
557
551
|
(function(t) {
|
|
558
552
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
559
|
-
})(
|
|
560
|
-
|
|
561
|
-
class M {
|
|
553
|
+
})(p || (p = {}));
|
|
554
|
+
class q {
|
|
562
555
|
constructor(e, r, n, s) {
|
|
563
556
|
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
|
|
564
557
|
}
|
|
565
558
|
get path() {
|
|
566
|
-
return this._cachedPath.length || (this._key
|
|
559
|
+
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
567
560
|
}
|
|
568
561
|
}
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
562
|
+
const et = (t, e) => {
|
|
563
|
+
if (te(e))
|
|
571
564
|
return { success: !0, data: e.value };
|
|
572
565
|
if (!t.common.issues.length)
|
|
573
566
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -576,7 +569,7 @@ var rs = pr((as, mt) => {
|
|
|
576
569
|
get error() {
|
|
577
570
|
if (this._error)
|
|
578
571
|
return this._error;
|
|
579
|
-
const r = new
|
|
572
|
+
const r = new F(t.common.issues);
|
|
580
573
|
return this._error = r, this._error;
|
|
581
574
|
}
|
|
582
575
|
};
|
|
@@ -588,23 +581,22 @@ var rs = pr((as, mt) => {
|
|
|
588
581
|
if (e && (r || n))
|
|
589
582
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
590
583
|
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
return i.code === "invalid_enum_value" ? { message: l ?? o.defaultError } : typeof o.data > "u" ? { message: (d = l ?? n) !== null && d !== void 0 ? d : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = l ?? r) !== null && c !== void 0 ? c : o.defaultError };
|
|
584
|
+
const { message: d } = t;
|
|
585
|
+
return i.code === "invalid_enum_value" ? { message: d ?? o.defaultError } : typeof o.data > "u" ? { message: d ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: d ?? r ?? o.defaultError };
|
|
594
586
|
}, description: s };
|
|
595
587
|
}
|
|
596
|
-
class
|
|
588
|
+
class k {
|
|
597
589
|
get description() {
|
|
598
590
|
return this._def.description;
|
|
599
591
|
}
|
|
600
592
|
_getType(e) {
|
|
601
|
-
return
|
|
593
|
+
return L(e.data);
|
|
602
594
|
}
|
|
603
595
|
_getOrReturnCtx(e, r) {
|
|
604
596
|
return r || {
|
|
605
597
|
common: e.parent.common,
|
|
606
598
|
data: e.data,
|
|
607
|
-
parsedType:
|
|
599
|
+
parsedType: L(e.data),
|
|
608
600
|
schemaErrorMap: this._def.errorMap,
|
|
609
601
|
path: e.path,
|
|
610
602
|
parent: e.parent
|
|
@@ -612,11 +604,11 @@ var rs = pr((as, mt) => {
|
|
|
612
604
|
}
|
|
613
605
|
_processInputParams(e) {
|
|
614
606
|
return {
|
|
615
|
-
status: new
|
|
607
|
+
status: new R(),
|
|
616
608
|
ctx: {
|
|
617
609
|
common: e.parent.common,
|
|
618
610
|
data: e.data,
|
|
619
|
-
parsedType:
|
|
611
|
+
parsedType: L(e.data),
|
|
620
612
|
schemaErrorMap: this._def.errorMap,
|
|
621
613
|
path: e.path,
|
|
622
614
|
parent: e.parent
|
|
@@ -625,7 +617,7 @@ var rs = pr((as, mt) => {
|
|
|
625
617
|
}
|
|
626
618
|
_parseSync(e) {
|
|
627
619
|
const r = this._parse(e);
|
|
628
|
-
if (
|
|
620
|
+
if (ke(r))
|
|
629
621
|
throw new Error("Synchronous parse encountered promise.");
|
|
630
622
|
return r;
|
|
631
623
|
}
|
|
@@ -640,24 +632,22 @@ var rs = pr((as, mt) => {
|
|
|
640
632
|
throw n.error;
|
|
641
633
|
}
|
|
642
634
|
safeParse(e, r) {
|
|
643
|
-
|
|
644
|
-
const s = {
|
|
635
|
+
const n = {
|
|
645
636
|
common: {
|
|
646
637
|
issues: [],
|
|
647
|
-
async:
|
|
638
|
+
async: r?.async ?? !1,
|
|
648
639
|
contextualErrorMap: r?.errorMap
|
|
649
640
|
},
|
|
650
641
|
path: r?.path || [],
|
|
651
642
|
schemaErrorMap: this._def.errorMap,
|
|
652
643
|
parent: null,
|
|
653
644
|
data: e,
|
|
654
|
-
parsedType:
|
|
655
|
-
},
|
|
656
|
-
return
|
|
645
|
+
parsedType: L(e)
|
|
646
|
+
}, s = this._parseSync({ data: e, path: n.path, parent: n });
|
|
647
|
+
return et(n, s);
|
|
657
648
|
}
|
|
658
649
|
"~validate"(e) {
|
|
659
|
-
|
|
660
|
-
const s = {
|
|
650
|
+
const r = {
|
|
661
651
|
common: {
|
|
662
652
|
issues: [],
|
|
663
653
|
async: !!this["~standard"].async
|
|
@@ -666,26 +656,26 @@ var rs = pr((as, mt) => {
|
|
|
666
656
|
schemaErrorMap: this._def.errorMap,
|
|
667
657
|
parent: null,
|
|
668
658
|
data: e,
|
|
669
|
-
parsedType:
|
|
659
|
+
parsedType: L(e)
|
|
670
660
|
};
|
|
671
661
|
if (!this["~standard"].async)
|
|
672
662
|
try {
|
|
673
|
-
const
|
|
674
|
-
return
|
|
675
|
-
value:
|
|
663
|
+
const n = this._parseSync({ data: e, path: [], parent: r });
|
|
664
|
+
return te(n) ? {
|
|
665
|
+
value: n.value
|
|
676
666
|
} : {
|
|
677
|
-
issues:
|
|
667
|
+
issues: r.common.issues
|
|
678
668
|
};
|
|
679
|
-
} catch (
|
|
680
|
-
|
|
669
|
+
} catch (n) {
|
|
670
|
+
n?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), r.common = {
|
|
681
671
|
issues: [],
|
|
682
672
|
async: !0
|
|
683
673
|
};
|
|
684
674
|
}
|
|
685
|
-
return this._parseAsync({ data: e, path: [], parent:
|
|
686
|
-
value:
|
|
675
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((n) => te(n) ? {
|
|
676
|
+
value: n.value
|
|
687
677
|
} : {
|
|
688
|
-
issues:
|
|
678
|
+
issues: r.common.issues
|
|
689
679
|
});
|
|
690
680
|
}
|
|
691
681
|
async parseAsync(e, r) {
|
|
@@ -705,15 +695,15 @@ var rs = pr((as, mt) => {
|
|
|
705
695
|
schemaErrorMap: this._def.errorMap,
|
|
706
696
|
parent: null,
|
|
707
697
|
data: e,
|
|
708
|
-
parsedType:
|
|
709
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
710
|
-
return
|
|
698
|
+
parsedType: L(e)
|
|
699
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ke(s) ? s : Promise.resolve(s));
|
|
700
|
+
return et(n, a);
|
|
711
701
|
}
|
|
712
702
|
refine(e, r) {
|
|
713
703
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
714
704
|
return this._refinement((s, a) => {
|
|
715
705
|
const i = e(s), o = () => a.addIssue({
|
|
716
|
-
code:
|
|
706
|
+
code: c.custom,
|
|
717
707
|
...n(s)
|
|
718
708
|
});
|
|
719
709
|
return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
@@ -723,9 +713,9 @@ var rs = pr((as, mt) => {
|
|
|
723
713
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
|
|
724
714
|
}
|
|
725
715
|
_refinement(e) {
|
|
726
|
-
return new
|
|
716
|
+
return new ne({
|
|
727
717
|
schema: this,
|
|
728
|
-
typeName:
|
|
718
|
+
typeName: g.ZodEffects,
|
|
729
719
|
effect: { type: "refinement", refinement: e }
|
|
730
720
|
});
|
|
731
721
|
}
|
|
@@ -740,57 +730,57 @@ var rs = pr((as, mt) => {
|
|
|
740
730
|
};
|
|
741
731
|
}
|
|
742
732
|
optional() {
|
|
743
|
-
return
|
|
733
|
+
return V.create(this, this._def);
|
|
744
734
|
}
|
|
745
735
|
nullable() {
|
|
746
|
-
return
|
|
736
|
+
return se.create(this, this._def);
|
|
747
737
|
}
|
|
748
738
|
nullish() {
|
|
749
739
|
return this.nullable().optional();
|
|
750
740
|
}
|
|
751
741
|
array() {
|
|
752
|
-
return
|
|
742
|
+
return P.create(this);
|
|
753
743
|
}
|
|
754
744
|
promise() {
|
|
755
|
-
return
|
|
745
|
+
return Se.create(this, this._def);
|
|
756
746
|
}
|
|
757
747
|
or(e) {
|
|
758
|
-
return
|
|
748
|
+
return xe.create([this, e], this._def);
|
|
759
749
|
}
|
|
760
750
|
and(e) {
|
|
761
|
-
return
|
|
751
|
+
return be.create(this, e, this._def);
|
|
762
752
|
}
|
|
763
753
|
transform(e) {
|
|
764
|
-
return new
|
|
754
|
+
return new ne({
|
|
765
755
|
...v(this._def),
|
|
766
756
|
schema: this,
|
|
767
|
-
typeName:
|
|
757
|
+
typeName: g.ZodEffects,
|
|
768
758
|
effect: { type: "transform", transform: e }
|
|
769
759
|
});
|
|
770
760
|
}
|
|
771
761
|
default(e) {
|
|
772
762
|
const r = typeof e == "function" ? e : () => e;
|
|
773
|
-
return new
|
|
763
|
+
return new je({
|
|
774
764
|
...v(this._def),
|
|
775
765
|
innerType: this,
|
|
776
766
|
defaultValue: r,
|
|
777
|
-
typeName:
|
|
767
|
+
typeName: g.ZodDefault
|
|
778
768
|
});
|
|
779
769
|
}
|
|
780
770
|
brand() {
|
|
781
|
-
return new
|
|
782
|
-
typeName:
|
|
771
|
+
return new Cr({
|
|
772
|
+
typeName: g.ZodBranded,
|
|
783
773
|
type: this,
|
|
784
774
|
...v(this._def)
|
|
785
775
|
});
|
|
786
776
|
}
|
|
787
777
|
catch(e) {
|
|
788
778
|
const r = typeof e == "function" ? e : () => e;
|
|
789
|
-
return new
|
|
779
|
+
return new $e({
|
|
790
780
|
...v(this._def),
|
|
791
781
|
innerType: this,
|
|
792
782
|
catchValue: r,
|
|
793
|
-
typeName:
|
|
783
|
+
typeName: g.ZodCatch
|
|
794
784
|
});
|
|
795
785
|
}
|
|
796
786
|
describe(e) {
|
|
@@ -801,10 +791,10 @@ var rs = pr((as, mt) => {
|
|
|
801
791
|
});
|
|
802
792
|
}
|
|
803
793
|
pipe(e) {
|
|
804
|
-
return
|
|
794
|
+
return ze.create(this, e);
|
|
805
795
|
}
|
|
806
796
|
readonly() {
|
|
807
|
-
return
|
|
797
|
+
return Fe.create(this);
|
|
808
798
|
}
|
|
809
799
|
isOptional() {
|
|
810
800
|
return this.safeParse(void 0).success;
|
|
@@ -813,53 +803,58 @@ var rs = pr((as, mt) => {
|
|
|
813
803
|
return this.safeParse(null).success;
|
|
814
804
|
}
|
|
815
805
|
}
|
|
816
|
-
const
|
|
817
|
-
let
|
|
818
|
-
const
|
|
819
|
-
function
|
|
820
|
-
let e = "
|
|
821
|
-
|
|
806
|
+
const dr = /^c[^\s-]{8,}$/i, cr = /^[0-9a-z]+$/, ur = /^[0-9A-HJKMNP-TV-Z]{26}$/i, lr = /^[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, fr = /^[a-z0-9_-]{21}$/i, hr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, pr = /^[-+]?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)?)??$/, mr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, yr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
807
|
+
let Ne;
|
|
808
|
+
const gr = /^(?:(?: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])$/, vr = /^(?:(?: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])$/, _r = /^(([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]))$/, kr = /^(([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])$/, wr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, xr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, gt = "((\\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])))", br = new RegExp(`^${gt}$`);
|
|
809
|
+
function vt(t) {
|
|
810
|
+
let e = "[0-5]\\d";
|
|
811
|
+
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
812
|
+
const r = t.precision ? "+" : "?";
|
|
813
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
|
|
822
814
|
}
|
|
823
|
-
function
|
|
824
|
-
return new RegExp(`^${
|
|
815
|
+
function Sr(t) {
|
|
816
|
+
return new RegExp(`^${vt(t)}$`);
|
|
825
817
|
}
|
|
826
|
-
function
|
|
827
|
-
let e = `${
|
|
818
|
+
function Or(t) {
|
|
819
|
+
let e = `${gt}T${vt(t)}`;
|
|
828
820
|
const r = [];
|
|
829
821
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
830
822
|
}
|
|
831
|
-
function
|
|
832
|
-
return !!((e === "v4" || !e) &&
|
|
823
|
+
function Er(t, e) {
|
|
824
|
+
return !!((e === "v4" || !e) && gr.test(t) || (e === "v6" || !e) && _r.test(t));
|
|
833
825
|
}
|
|
834
|
-
function
|
|
835
|
-
if (!
|
|
826
|
+
function Tr(t, e) {
|
|
827
|
+
if (!hr.test(t))
|
|
836
828
|
return !1;
|
|
837
829
|
try {
|
|
838
|
-
const [r] = t.split(".")
|
|
839
|
-
|
|
830
|
+
const [r] = t.split(".");
|
|
831
|
+
if (!r)
|
|
832
|
+
return !1;
|
|
833
|
+
const n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(n));
|
|
834
|
+
return !(typeof s != "object" || s === null || "typ" in s && s?.typ !== "JWT" || !s.alg || e && s.alg !== e);
|
|
840
835
|
} catch {
|
|
841
836
|
return !1;
|
|
842
837
|
}
|
|
843
838
|
}
|
|
844
|
-
function
|
|
845
|
-
return !!((e === "v4" || !e) &&
|
|
839
|
+
function Nr(t, e) {
|
|
840
|
+
return !!((e === "v4" || !e) && vr.test(t) || (e === "v6" || !e) && kr.test(t));
|
|
846
841
|
}
|
|
847
|
-
class
|
|
842
|
+
class D extends k {
|
|
848
843
|
_parse(e) {
|
|
849
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
844
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
850
845
|
const a = this._getOrReturnCtx(e);
|
|
851
|
-
return
|
|
852
|
-
code:
|
|
853
|
-
expected:
|
|
846
|
+
return l(a, {
|
|
847
|
+
code: c.invalid_type,
|
|
848
|
+
expected: f.string,
|
|
854
849
|
received: a.parsedType
|
|
855
850
|
}), y;
|
|
856
851
|
}
|
|
857
|
-
const n = new
|
|
852
|
+
const n = new R();
|
|
858
853
|
let s;
|
|
859
854
|
for (const a of this._def.checks)
|
|
860
855
|
if (a.kind === "min")
|
|
861
|
-
e.data.length < a.value && (s = this._getOrReturnCtx(e, s),
|
|
862
|
-
code:
|
|
856
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
857
|
+
code: c.too_small,
|
|
863
858
|
minimum: a.value,
|
|
864
859
|
type: "string",
|
|
865
860
|
inclusive: !0,
|
|
@@ -867,8 +862,8 @@ var rs = pr((as, mt) => {
|
|
|
867
862
|
message: a.message
|
|
868
863
|
}), n.dirty());
|
|
869
864
|
else if (a.kind === "max")
|
|
870
|
-
e.data.length > a.value && (s = this._getOrReturnCtx(e, s),
|
|
871
|
-
code:
|
|
865
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
866
|
+
code: c.too_big,
|
|
872
867
|
maximum: a.value,
|
|
873
868
|
type: "string",
|
|
874
869
|
inclusive: !0,
|
|
@@ -877,15 +872,15 @@ var rs = pr((as, mt) => {
|
|
|
877
872
|
}), n.dirty());
|
|
878
873
|
else if (a.kind === "length") {
|
|
879
874
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
880
|
-
(i || o) && (s = this._getOrReturnCtx(e, s), i ?
|
|
881
|
-
code:
|
|
875
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
876
|
+
code: c.too_big,
|
|
882
877
|
maximum: a.value,
|
|
883
878
|
type: "string",
|
|
884
879
|
inclusive: !0,
|
|
885
880
|
exact: !0,
|
|
886
881
|
message: a.message
|
|
887
|
-
}) : o &&
|
|
888
|
-
code:
|
|
882
|
+
}) : o && l(s, {
|
|
883
|
+
code: c.too_small,
|
|
889
884
|
minimum: a.value,
|
|
890
885
|
type: "string",
|
|
891
886
|
inclusive: !0,
|
|
@@ -893,169 +888,168 @@ var rs = pr((as, mt) => {
|
|
|
893
888
|
message: a.message
|
|
894
889
|
}), n.dirty());
|
|
895
890
|
} else if (a.kind === "email")
|
|
896
|
-
|
|
891
|
+
mr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
897
892
|
validation: "email",
|
|
898
|
-
code:
|
|
893
|
+
code: c.invalid_string,
|
|
899
894
|
message: a.message
|
|
900
895
|
}), n.dirty());
|
|
901
896
|
else if (a.kind === "emoji")
|
|
902
|
-
|
|
897
|
+
Ne || (Ne = new RegExp(yr, "u")), Ne.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
903
898
|
validation: "emoji",
|
|
904
|
-
code:
|
|
899
|
+
code: c.invalid_string,
|
|
905
900
|
message: a.message
|
|
906
901
|
}), n.dirty());
|
|
907
902
|
else if (a.kind === "uuid")
|
|
908
|
-
|
|
903
|
+
lr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
909
904
|
validation: "uuid",
|
|
910
|
-
code:
|
|
905
|
+
code: c.invalid_string,
|
|
911
906
|
message: a.message
|
|
912
907
|
}), n.dirty());
|
|
913
908
|
else if (a.kind === "nanoid")
|
|
914
|
-
|
|
909
|
+
fr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
915
910
|
validation: "nanoid",
|
|
916
|
-
code:
|
|
911
|
+
code: c.invalid_string,
|
|
917
912
|
message: a.message
|
|
918
913
|
}), n.dirty());
|
|
919
914
|
else if (a.kind === "cuid")
|
|
920
|
-
|
|
915
|
+
dr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
921
916
|
validation: "cuid",
|
|
922
|
-
code:
|
|
917
|
+
code: c.invalid_string,
|
|
923
918
|
message: a.message
|
|
924
919
|
}), n.dirty());
|
|
925
920
|
else if (a.kind === "cuid2")
|
|
926
|
-
|
|
921
|
+
cr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
927
922
|
validation: "cuid2",
|
|
928
|
-
code:
|
|
923
|
+
code: c.invalid_string,
|
|
929
924
|
message: a.message
|
|
930
925
|
}), n.dirty());
|
|
931
926
|
else if (a.kind === "ulid")
|
|
932
|
-
|
|
927
|
+
ur.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
933
928
|
validation: "ulid",
|
|
934
|
-
code:
|
|
929
|
+
code: c.invalid_string,
|
|
935
930
|
message: a.message
|
|
936
931
|
}), n.dirty());
|
|
937
932
|
else if (a.kind === "url")
|
|
938
933
|
try {
|
|
939
934
|
new URL(e.data);
|
|
940
935
|
} catch {
|
|
941
|
-
s = this._getOrReturnCtx(e, s),
|
|
936
|
+
s = this._getOrReturnCtx(e, s), l(s, {
|
|
942
937
|
validation: "url",
|
|
943
|
-
code:
|
|
938
|
+
code: c.invalid_string,
|
|
944
939
|
message: a.message
|
|
945
940
|
}), n.dirty();
|
|
946
941
|
}
|
|
947
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
942
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
948
943
|
validation: "regex",
|
|
949
|
-
code:
|
|
944
|
+
code: c.invalid_string,
|
|
950
945
|
message: a.message
|
|
951
|
-
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s),
|
|
952
|
-
code:
|
|
946
|
+
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
947
|
+
code: c.invalid_string,
|
|
953
948
|
validation: { includes: a.value, position: a.position },
|
|
954
949
|
message: a.message
|
|
955
|
-
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
956
|
-
code:
|
|
950
|
+
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
951
|
+
code: c.invalid_string,
|
|
957
952
|
validation: { startsWith: a.value },
|
|
958
953
|
message: a.message
|
|
959
|
-
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
960
|
-
code:
|
|
954
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
955
|
+
code: c.invalid_string,
|
|
961
956
|
validation: { endsWith: a.value },
|
|
962
957
|
message: a.message
|
|
963
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
964
|
-
code:
|
|
958
|
+
}), n.dirty()) : a.kind === "datetime" ? Or(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
959
|
+
code: c.invalid_string,
|
|
965
960
|
validation: "datetime",
|
|
966
961
|
message: a.message
|
|
967
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
968
|
-
code:
|
|
962
|
+
}), n.dirty()) : a.kind === "date" ? br.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
963
|
+
code: c.invalid_string,
|
|
969
964
|
validation: "date",
|
|
970
965
|
message: a.message
|
|
971
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
972
|
-
code:
|
|
966
|
+
}), n.dirty()) : a.kind === "time" ? Sr(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
967
|
+
code: c.invalid_string,
|
|
973
968
|
validation: "time",
|
|
974
969
|
message: a.message
|
|
975
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
970
|
+
}), n.dirty()) : a.kind === "duration" ? pr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
976
971
|
validation: "duration",
|
|
977
|
-
code:
|
|
972
|
+
code: c.invalid_string,
|
|
978
973
|
message: a.message
|
|
979
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
974
|
+
}), n.dirty()) : a.kind === "ip" ? Er(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
980
975
|
validation: "ip",
|
|
981
|
-
code:
|
|
976
|
+
code: c.invalid_string,
|
|
982
977
|
message: a.message
|
|
983
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
978
|
+
}), n.dirty()) : a.kind === "jwt" ? Tr(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
984
979
|
validation: "jwt",
|
|
985
|
-
code:
|
|
980
|
+
code: c.invalid_string,
|
|
986
981
|
message: a.message
|
|
987
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
982
|
+
}), n.dirty()) : a.kind === "cidr" ? Nr(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
988
983
|
validation: "cidr",
|
|
989
|
-
code:
|
|
984
|
+
code: c.invalid_string,
|
|
990
985
|
message: a.message
|
|
991
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
986
|
+
}), n.dirty()) : a.kind === "base64" ? wr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
992
987
|
validation: "base64",
|
|
993
|
-
code:
|
|
988
|
+
code: c.invalid_string,
|
|
994
989
|
message: a.message
|
|
995
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
990
|
+
}), n.dirty()) : a.kind === "base64url" ? xr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
996
991
|
validation: "base64url",
|
|
997
|
-
code:
|
|
992
|
+
code: c.invalid_string,
|
|
998
993
|
message: a.message
|
|
999
|
-
}), n.dirty()) :
|
|
994
|
+
}), n.dirty()) : w.assertNever(a);
|
|
1000
995
|
return { status: n.value, value: e.data };
|
|
1001
996
|
}
|
|
1002
997
|
_regex(e, r, n) {
|
|
1003
998
|
return this.refinement((s) => e.test(s), {
|
|
1004
999
|
validation: r,
|
|
1005
|
-
code:
|
|
1006
|
-
...
|
|
1000
|
+
code: c.invalid_string,
|
|
1001
|
+
...p.errToObj(n)
|
|
1007
1002
|
});
|
|
1008
1003
|
}
|
|
1009
1004
|
_addCheck(e) {
|
|
1010
|
-
return new
|
|
1005
|
+
return new D({
|
|
1011
1006
|
...this._def,
|
|
1012
1007
|
checks: [...this._def.checks, e]
|
|
1013
1008
|
});
|
|
1014
1009
|
}
|
|
1015
1010
|
email(e) {
|
|
1016
|
-
return this._addCheck({ kind: "email", ...
|
|
1011
|
+
return this._addCheck({ kind: "email", ...p.errToObj(e) });
|
|
1017
1012
|
}
|
|
1018
1013
|
url(e) {
|
|
1019
|
-
return this._addCheck({ kind: "url", ...
|
|
1014
|
+
return this._addCheck({ kind: "url", ...p.errToObj(e) });
|
|
1020
1015
|
}
|
|
1021
1016
|
emoji(e) {
|
|
1022
|
-
return this._addCheck({ kind: "emoji", ...
|
|
1017
|
+
return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
|
|
1023
1018
|
}
|
|
1024
1019
|
uuid(e) {
|
|
1025
|
-
return this._addCheck({ kind: "uuid", ...
|
|
1020
|
+
return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
|
|
1026
1021
|
}
|
|
1027
1022
|
nanoid(e) {
|
|
1028
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
1023
|
+
return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
|
|
1029
1024
|
}
|
|
1030
1025
|
cuid(e) {
|
|
1031
|
-
return this._addCheck({ kind: "cuid", ...
|
|
1026
|
+
return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
|
|
1032
1027
|
}
|
|
1033
1028
|
cuid2(e) {
|
|
1034
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
1029
|
+
return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
|
|
1035
1030
|
}
|
|
1036
1031
|
ulid(e) {
|
|
1037
|
-
return this._addCheck({ kind: "ulid", ...
|
|
1032
|
+
return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
|
|
1038
1033
|
}
|
|
1039
1034
|
base64(e) {
|
|
1040
|
-
return this._addCheck({ kind: "base64", ...
|
|
1035
|
+
return this._addCheck({ kind: "base64", ...p.errToObj(e) });
|
|
1041
1036
|
}
|
|
1042
1037
|
base64url(e) {
|
|
1043
1038
|
return this._addCheck({
|
|
1044
1039
|
kind: "base64url",
|
|
1045
|
-
...
|
|
1040
|
+
...p.errToObj(e)
|
|
1046
1041
|
});
|
|
1047
1042
|
}
|
|
1048
1043
|
jwt(e) {
|
|
1049
|
-
return this._addCheck({ kind: "jwt", ...
|
|
1044
|
+
return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
|
|
1050
1045
|
}
|
|
1051
1046
|
ip(e) {
|
|
1052
|
-
return this._addCheck({ kind: "ip", ...
|
|
1047
|
+
return this._addCheck({ kind: "ip", ...p.errToObj(e) });
|
|
1053
1048
|
}
|
|
1054
1049
|
cidr(e) {
|
|
1055
|
-
return this._addCheck({ kind: "cidr", ...
|
|
1050
|
+
return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
|
|
1056
1051
|
}
|
|
1057
1052
|
datetime(e) {
|
|
1058
|
-
var r, n;
|
|
1059
1053
|
return typeof e == "string" ? this._addCheck({
|
|
1060
1054
|
kind: "datetime",
|
|
1061
1055
|
precision: null,
|
|
@@ -1065,9 +1059,9 @@ var rs = pr((as, mt) => {
|
|
|
1065
1059
|
}) : this._addCheck({
|
|
1066
1060
|
kind: "datetime",
|
|
1067
1061
|
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
1068
|
-
offset:
|
|
1069
|
-
local:
|
|
1070
|
-
...
|
|
1062
|
+
offset: e?.offset ?? !1,
|
|
1063
|
+
local: e?.local ?? !1,
|
|
1064
|
+
...p.errToObj(e?.message)
|
|
1071
1065
|
});
|
|
1072
1066
|
}
|
|
1073
1067
|
date(e) {
|
|
@@ -1081,17 +1075,17 @@ var rs = pr((as, mt) => {
|
|
|
1081
1075
|
}) : this._addCheck({
|
|
1082
1076
|
kind: "time",
|
|
1083
1077
|
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
1084
|
-
...
|
|
1078
|
+
...p.errToObj(e?.message)
|
|
1085
1079
|
});
|
|
1086
1080
|
}
|
|
1087
1081
|
duration(e) {
|
|
1088
|
-
return this._addCheck({ kind: "duration", ...
|
|
1082
|
+
return this._addCheck({ kind: "duration", ...p.errToObj(e) });
|
|
1089
1083
|
}
|
|
1090
1084
|
regex(e, r) {
|
|
1091
1085
|
return this._addCheck({
|
|
1092
1086
|
kind: "regex",
|
|
1093
1087
|
regex: e,
|
|
1094
|
-
...
|
|
1088
|
+
...p.errToObj(r)
|
|
1095
1089
|
});
|
|
1096
1090
|
}
|
|
1097
1091
|
includes(e, r) {
|
|
@@ -1099,64 +1093,64 @@ var rs = pr((as, mt) => {
|
|
|
1099
1093
|
kind: "includes",
|
|
1100
1094
|
value: e,
|
|
1101
1095
|
position: r?.position,
|
|
1102
|
-
...
|
|
1096
|
+
...p.errToObj(r?.message)
|
|
1103
1097
|
});
|
|
1104
1098
|
}
|
|
1105
1099
|
startsWith(e, r) {
|
|
1106
1100
|
return this._addCheck({
|
|
1107
1101
|
kind: "startsWith",
|
|
1108
1102
|
value: e,
|
|
1109
|
-
...
|
|
1103
|
+
...p.errToObj(r)
|
|
1110
1104
|
});
|
|
1111
1105
|
}
|
|
1112
1106
|
endsWith(e, r) {
|
|
1113
1107
|
return this._addCheck({
|
|
1114
1108
|
kind: "endsWith",
|
|
1115
1109
|
value: e,
|
|
1116
|
-
...
|
|
1110
|
+
...p.errToObj(r)
|
|
1117
1111
|
});
|
|
1118
1112
|
}
|
|
1119
1113
|
min(e, r) {
|
|
1120
1114
|
return this._addCheck({
|
|
1121
1115
|
kind: "min",
|
|
1122
1116
|
value: e,
|
|
1123
|
-
...
|
|
1117
|
+
...p.errToObj(r)
|
|
1124
1118
|
});
|
|
1125
1119
|
}
|
|
1126
1120
|
max(e, r) {
|
|
1127
1121
|
return this._addCheck({
|
|
1128
1122
|
kind: "max",
|
|
1129
1123
|
value: e,
|
|
1130
|
-
...
|
|
1124
|
+
...p.errToObj(r)
|
|
1131
1125
|
});
|
|
1132
1126
|
}
|
|
1133
1127
|
length(e, r) {
|
|
1134
1128
|
return this._addCheck({
|
|
1135
1129
|
kind: "length",
|
|
1136
1130
|
value: e,
|
|
1137
|
-
...
|
|
1131
|
+
...p.errToObj(r)
|
|
1138
1132
|
});
|
|
1139
1133
|
}
|
|
1140
1134
|
/**
|
|
1141
1135
|
* Equivalent to `.min(1)`
|
|
1142
1136
|
*/
|
|
1143
1137
|
nonempty(e) {
|
|
1144
|
-
return this.min(1,
|
|
1138
|
+
return this.min(1, p.errToObj(e));
|
|
1145
1139
|
}
|
|
1146
1140
|
trim() {
|
|
1147
|
-
return new
|
|
1141
|
+
return new D({
|
|
1148
1142
|
...this._def,
|
|
1149
1143
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1150
1144
|
});
|
|
1151
1145
|
}
|
|
1152
1146
|
toLowerCase() {
|
|
1153
|
-
return new
|
|
1147
|
+
return new D({
|
|
1154
1148
|
...this._def,
|
|
1155
1149
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1156
1150
|
});
|
|
1157
1151
|
}
|
|
1158
1152
|
toUpperCase() {
|
|
1159
|
-
return new
|
|
1153
|
+
return new D({
|
|
1160
1154
|
...this._def,
|
|
1161
1155
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1162
1156
|
});
|
|
@@ -1222,78 +1216,75 @@ var rs = pr((as, mt) => {
|
|
|
1222
1216
|
return e;
|
|
1223
1217
|
}
|
|
1224
1218
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
function Br(t, e) {
|
|
1235
|
-
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = parseInt(t.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
1236
|
-
return a % i / Math.pow(10, s);
|
|
1219
|
+
D.create = (t) => new D({
|
|
1220
|
+
checks: [],
|
|
1221
|
+
typeName: g.ZodString,
|
|
1222
|
+
coerce: t?.coerce ?? !1,
|
|
1223
|
+
...v(t)
|
|
1224
|
+
});
|
|
1225
|
+
function Rr(t, e) {
|
|
1226
|
+
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = Number.parseInt(t.toFixed(s).replace(".", "")), i = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
1227
|
+
return a % i / 10 ** s;
|
|
1237
1228
|
}
|
|
1238
|
-
class
|
|
1229
|
+
class le extends k {
|
|
1239
1230
|
constructor() {
|
|
1240
1231
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1241
1232
|
}
|
|
1242
1233
|
_parse(e) {
|
|
1243
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1234
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
1244
1235
|
const a = this._getOrReturnCtx(e);
|
|
1245
|
-
return
|
|
1246
|
-
code:
|
|
1247
|
-
expected:
|
|
1236
|
+
return l(a, {
|
|
1237
|
+
code: c.invalid_type,
|
|
1238
|
+
expected: f.number,
|
|
1248
1239
|
received: a.parsedType
|
|
1249
1240
|
}), y;
|
|
1250
1241
|
}
|
|
1251
1242
|
let n;
|
|
1252
|
-
const s = new
|
|
1243
|
+
const s = new R();
|
|
1253
1244
|
for (const a of this._def.checks)
|
|
1254
|
-
a.kind === "int" ?
|
|
1255
|
-
code:
|
|
1245
|
+
a.kind === "int" ? w.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1246
|
+
code: c.invalid_type,
|
|
1256
1247
|
expected: "integer",
|
|
1257
1248
|
received: "float",
|
|
1258
1249
|
message: a.message
|
|
1259
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1260
|
-
code:
|
|
1250
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1251
|
+
code: c.too_small,
|
|
1261
1252
|
minimum: a.value,
|
|
1262
1253
|
type: "number",
|
|
1263
1254
|
inclusive: a.inclusive,
|
|
1264
1255
|
exact: !1,
|
|
1265
1256
|
message: a.message
|
|
1266
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1267
|
-
code:
|
|
1257
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1258
|
+
code: c.too_big,
|
|
1268
1259
|
maximum: a.value,
|
|
1269
1260
|
type: "number",
|
|
1270
1261
|
inclusive: a.inclusive,
|
|
1271
1262
|
exact: !1,
|
|
1272
1263
|
message: a.message
|
|
1273
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1274
|
-
code:
|
|
1264
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Rr(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1265
|
+
code: c.not_multiple_of,
|
|
1275
1266
|
multipleOf: a.value,
|
|
1276
1267
|
message: a.message
|
|
1277
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
1278
|
-
code:
|
|
1268
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1269
|
+
code: c.not_finite,
|
|
1279
1270
|
message: a.message
|
|
1280
|
-
}), s.dirty()) :
|
|
1271
|
+
}), s.dirty()) : w.assertNever(a);
|
|
1281
1272
|
return { status: s.value, value: e.data };
|
|
1282
1273
|
}
|
|
1283
1274
|
gte(e, r) {
|
|
1284
|
-
return this.setLimit("min", e, !0,
|
|
1275
|
+
return this.setLimit("min", e, !0, p.toString(r));
|
|
1285
1276
|
}
|
|
1286
1277
|
gt(e, r) {
|
|
1287
|
-
return this.setLimit("min", e, !1,
|
|
1278
|
+
return this.setLimit("min", e, !1, p.toString(r));
|
|
1288
1279
|
}
|
|
1289
1280
|
lte(e, r) {
|
|
1290
|
-
return this.setLimit("max", e, !0,
|
|
1281
|
+
return this.setLimit("max", e, !0, p.toString(r));
|
|
1291
1282
|
}
|
|
1292
1283
|
lt(e, r) {
|
|
1293
|
-
return this.setLimit("max", e, !1,
|
|
1284
|
+
return this.setLimit("max", e, !1, p.toString(r));
|
|
1294
1285
|
}
|
|
1295
1286
|
setLimit(e, r, n, s) {
|
|
1296
|
-
return new
|
|
1287
|
+
return new le({
|
|
1297
1288
|
...this._def,
|
|
1298
1289
|
checks: [
|
|
1299
1290
|
...this._def.checks,
|
|
@@ -1301,13 +1292,13 @@ var rs = pr((as, mt) => {
|
|
|
1301
1292
|
kind: e,
|
|
1302
1293
|
value: r,
|
|
1303
1294
|
inclusive: n,
|
|
1304
|
-
message:
|
|
1295
|
+
message: p.toString(s)
|
|
1305
1296
|
}
|
|
1306
1297
|
]
|
|
1307
1298
|
});
|
|
1308
1299
|
}
|
|
1309
1300
|
_addCheck(e) {
|
|
1310
|
-
return new
|
|
1301
|
+
return new le({
|
|
1311
1302
|
...this._def,
|
|
1312
1303
|
checks: [...this._def.checks, e]
|
|
1313
1304
|
});
|
|
@@ -1315,7 +1306,7 @@ var rs = pr((as, mt) => {
|
|
|
1315
1306
|
int(e) {
|
|
1316
1307
|
return this._addCheck({
|
|
1317
1308
|
kind: "int",
|
|
1318
|
-
message:
|
|
1309
|
+
message: p.toString(e)
|
|
1319
1310
|
});
|
|
1320
1311
|
}
|
|
1321
1312
|
positive(e) {
|
|
@@ -1323,7 +1314,7 @@ var rs = pr((as, mt) => {
|
|
|
1323
1314
|
kind: "min",
|
|
1324
1315
|
value: 0,
|
|
1325
1316
|
inclusive: !1,
|
|
1326
|
-
message:
|
|
1317
|
+
message: p.toString(e)
|
|
1327
1318
|
});
|
|
1328
1319
|
}
|
|
1329
1320
|
negative(e) {
|
|
@@ -1331,7 +1322,7 @@ var rs = pr((as, mt) => {
|
|
|
1331
1322
|
kind: "max",
|
|
1332
1323
|
value: 0,
|
|
1333
1324
|
inclusive: !1,
|
|
1334
|
-
message:
|
|
1325
|
+
message: p.toString(e)
|
|
1335
1326
|
});
|
|
1336
1327
|
}
|
|
1337
1328
|
nonpositive(e) {
|
|
@@ -1339,7 +1330,7 @@ var rs = pr((as, mt) => {
|
|
|
1339
1330
|
kind: "max",
|
|
1340
1331
|
value: 0,
|
|
1341
1332
|
inclusive: !0,
|
|
1342
|
-
message:
|
|
1333
|
+
message: p.toString(e)
|
|
1343
1334
|
});
|
|
1344
1335
|
}
|
|
1345
1336
|
nonnegative(e) {
|
|
@@ -1347,20 +1338,20 @@ var rs = pr((as, mt) => {
|
|
|
1347
1338
|
kind: "min",
|
|
1348
1339
|
value: 0,
|
|
1349
1340
|
inclusive: !0,
|
|
1350
|
-
message:
|
|
1341
|
+
message: p.toString(e)
|
|
1351
1342
|
});
|
|
1352
1343
|
}
|
|
1353
1344
|
multipleOf(e, r) {
|
|
1354
1345
|
return this._addCheck({
|
|
1355
1346
|
kind: "multipleOf",
|
|
1356
1347
|
value: e,
|
|
1357
|
-
message:
|
|
1348
|
+
message: p.toString(r)
|
|
1358
1349
|
});
|
|
1359
1350
|
}
|
|
1360
1351
|
finite(e) {
|
|
1361
1352
|
return this._addCheck({
|
|
1362
1353
|
kind: "finite",
|
|
1363
|
-
message:
|
|
1354
|
+
message: p.toString(e)
|
|
1364
1355
|
});
|
|
1365
1356
|
}
|
|
1366
1357
|
safe(e) {
|
|
@@ -1368,12 +1359,12 @@ var rs = pr((as, mt) => {
|
|
|
1368
1359
|
kind: "min",
|
|
1369
1360
|
inclusive: !0,
|
|
1370
1361
|
value: Number.MIN_SAFE_INTEGER,
|
|
1371
|
-
message:
|
|
1362
|
+
message: p.toString(e)
|
|
1372
1363
|
})._addCheck({
|
|
1373
1364
|
kind: "max",
|
|
1374
1365
|
inclusive: !0,
|
|
1375
1366
|
value: Number.MAX_SAFE_INTEGER,
|
|
1376
|
-
message:
|
|
1367
|
+
message: p.toString(e)
|
|
1377
1368
|
});
|
|
1378
1369
|
}
|
|
1379
1370
|
get minValue() {
|
|
@@ -1389,7 +1380,7 @@ var rs = pr((as, mt) => {
|
|
|
1389
1380
|
return e;
|
|
1390
1381
|
}
|
|
1391
1382
|
get isInt() {
|
|
1392
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1383
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && w.isInteger(e.value));
|
|
1393
1384
|
}
|
|
1394
1385
|
get isFinite() {
|
|
1395
1386
|
let e = null, r = null;
|
|
@@ -1401,13 +1392,13 @@ var rs = pr((as, mt) => {
|
|
|
1401
1392
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1402
1393
|
}
|
|
1403
1394
|
}
|
|
1404
|
-
|
|
1395
|
+
le.create = (t) => new le({
|
|
1405
1396
|
checks: [],
|
|
1406
|
-
typeName:
|
|
1397
|
+
typeName: g.ZodNumber,
|
|
1407
1398
|
coerce: t?.coerce || !1,
|
|
1408
1399
|
...v(t)
|
|
1409
1400
|
});
|
|
1410
|
-
class
|
|
1401
|
+
class fe extends k {
|
|
1411
1402
|
constructor() {
|
|
1412
1403
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1413
1404
|
}
|
|
@@ -1418,52 +1409,52 @@ var rs = pr((as, mt) => {
|
|
|
1418
1409
|
} catch {
|
|
1419
1410
|
return this._getInvalidInput(e);
|
|
1420
1411
|
}
|
|
1421
|
-
if (this._getType(e) !==
|
|
1412
|
+
if (this._getType(e) !== f.bigint)
|
|
1422
1413
|
return this._getInvalidInput(e);
|
|
1423
1414
|
let n;
|
|
1424
|
-
const s = new
|
|
1415
|
+
const s = new R();
|
|
1425
1416
|
for (const a of this._def.checks)
|
|
1426
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1427
|
-
code:
|
|
1417
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1418
|
+
code: c.too_small,
|
|
1428
1419
|
type: "bigint",
|
|
1429
1420
|
minimum: a.value,
|
|
1430
1421
|
inclusive: a.inclusive,
|
|
1431
1422
|
message: a.message
|
|
1432
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1433
|
-
code:
|
|
1423
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1424
|
+
code: c.too_big,
|
|
1434
1425
|
type: "bigint",
|
|
1435
1426
|
maximum: a.value,
|
|
1436
1427
|
inclusive: a.inclusive,
|
|
1437
1428
|
message: a.message
|
|
1438
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
1439
|
-
code:
|
|
1429
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1430
|
+
code: c.not_multiple_of,
|
|
1440
1431
|
multipleOf: a.value,
|
|
1441
1432
|
message: a.message
|
|
1442
|
-
}), s.dirty()) :
|
|
1433
|
+
}), s.dirty()) : w.assertNever(a);
|
|
1443
1434
|
return { status: s.value, value: e.data };
|
|
1444
1435
|
}
|
|
1445
1436
|
_getInvalidInput(e) {
|
|
1446
1437
|
const r = this._getOrReturnCtx(e);
|
|
1447
|
-
return
|
|
1448
|
-
code:
|
|
1449
|
-
expected:
|
|
1438
|
+
return l(r, {
|
|
1439
|
+
code: c.invalid_type,
|
|
1440
|
+
expected: f.bigint,
|
|
1450
1441
|
received: r.parsedType
|
|
1451
1442
|
}), y;
|
|
1452
1443
|
}
|
|
1453
1444
|
gte(e, r) {
|
|
1454
|
-
return this.setLimit("min", e, !0,
|
|
1445
|
+
return this.setLimit("min", e, !0, p.toString(r));
|
|
1455
1446
|
}
|
|
1456
1447
|
gt(e, r) {
|
|
1457
|
-
return this.setLimit("min", e, !1,
|
|
1448
|
+
return this.setLimit("min", e, !1, p.toString(r));
|
|
1458
1449
|
}
|
|
1459
1450
|
lte(e, r) {
|
|
1460
|
-
return this.setLimit("max", e, !0,
|
|
1451
|
+
return this.setLimit("max", e, !0, p.toString(r));
|
|
1461
1452
|
}
|
|
1462
1453
|
lt(e, r) {
|
|
1463
|
-
return this.setLimit("max", e, !1,
|
|
1454
|
+
return this.setLimit("max", e, !1, p.toString(r));
|
|
1464
1455
|
}
|
|
1465
1456
|
setLimit(e, r, n, s) {
|
|
1466
|
-
return new
|
|
1457
|
+
return new fe({
|
|
1467
1458
|
...this._def,
|
|
1468
1459
|
checks: [
|
|
1469
1460
|
...this._def.checks,
|
|
@@ -1471,13 +1462,13 @@ var rs = pr((as, mt) => {
|
|
|
1471
1462
|
kind: e,
|
|
1472
1463
|
value: r,
|
|
1473
1464
|
inclusive: n,
|
|
1474
|
-
message:
|
|
1465
|
+
message: p.toString(s)
|
|
1475
1466
|
}
|
|
1476
1467
|
]
|
|
1477
1468
|
});
|
|
1478
1469
|
}
|
|
1479
1470
|
_addCheck(e) {
|
|
1480
|
-
return new
|
|
1471
|
+
return new fe({
|
|
1481
1472
|
...this._def,
|
|
1482
1473
|
checks: [...this._def.checks, e]
|
|
1483
1474
|
});
|
|
@@ -1487,7 +1478,7 @@ var rs = pr((as, mt) => {
|
|
|
1487
1478
|
kind: "min",
|
|
1488
1479
|
value: BigInt(0),
|
|
1489
1480
|
inclusive: !1,
|
|
1490
|
-
message:
|
|
1481
|
+
message: p.toString(e)
|
|
1491
1482
|
});
|
|
1492
1483
|
}
|
|
1493
1484
|
negative(e) {
|
|
@@ -1495,7 +1486,7 @@ var rs = pr((as, mt) => {
|
|
|
1495
1486
|
kind: "max",
|
|
1496
1487
|
value: BigInt(0),
|
|
1497
1488
|
inclusive: !1,
|
|
1498
|
-
message:
|
|
1489
|
+
message: p.toString(e)
|
|
1499
1490
|
});
|
|
1500
1491
|
}
|
|
1501
1492
|
nonpositive(e) {
|
|
@@ -1503,7 +1494,7 @@ var rs = pr((as, mt) => {
|
|
|
1503
1494
|
kind: "max",
|
|
1504
1495
|
value: BigInt(0),
|
|
1505
1496
|
inclusive: !0,
|
|
1506
|
-
message:
|
|
1497
|
+
message: p.toString(e)
|
|
1507
1498
|
});
|
|
1508
1499
|
}
|
|
1509
1500
|
nonnegative(e) {
|
|
@@ -1511,14 +1502,14 @@ var rs = pr((as, mt) => {
|
|
|
1511
1502
|
kind: "min",
|
|
1512
1503
|
value: BigInt(0),
|
|
1513
1504
|
inclusive: !0,
|
|
1514
|
-
message:
|
|
1505
|
+
message: p.toString(e)
|
|
1515
1506
|
});
|
|
1516
1507
|
}
|
|
1517
1508
|
multipleOf(e, r) {
|
|
1518
1509
|
return this._addCheck({
|
|
1519
1510
|
kind: "multipleOf",
|
|
1520
1511
|
value: e,
|
|
1521
|
-
message:
|
|
1512
|
+
message: p.toString(r)
|
|
1522
1513
|
});
|
|
1523
1514
|
}
|
|
1524
1515
|
get minValue() {
|
|
@@ -1534,74 +1525,71 @@ var rs = pr((as, mt) => {
|
|
|
1534
1525
|
return e;
|
|
1535
1526
|
}
|
|
1536
1527
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
});
|
|
1545
|
-
};
|
|
1546
|
-
class Te extends _ {
|
|
1528
|
+
fe.create = (t) => new fe({
|
|
1529
|
+
checks: [],
|
|
1530
|
+
typeName: g.ZodBigInt,
|
|
1531
|
+
coerce: t?.coerce ?? !1,
|
|
1532
|
+
...v(t)
|
|
1533
|
+
});
|
|
1534
|
+
class tt extends k {
|
|
1547
1535
|
_parse(e) {
|
|
1548
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1536
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1549
1537
|
const n = this._getOrReturnCtx(e);
|
|
1550
|
-
return
|
|
1551
|
-
code:
|
|
1552
|
-
expected:
|
|
1538
|
+
return l(n, {
|
|
1539
|
+
code: c.invalid_type,
|
|
1540
|
+
expected: f.boolean,
|
|
1553
1541
|
received: n.parsedType
|
|
1554
1542
|
}), y;
|
|
1555
1543
|
}
|
|
1556
|
-
return
|
|
1544
|
+
return C(e.data);
|
|
1557
1545
|
}
|
|
1558
1546
|
}
|
|
1559
|
-
|
|
1560
|
-
typeName:
|
|
1547
|
+
tt.create = (t) => new tt({
|
|
1548
|
+
typeName: g.ZodBoolean,
|
|
1561
1549
|
coerce: t?.coerce || !1,
|
|
1562
1550
|
...v(t)
|
|
1563
1551
|
});
|
|
1564
|
-
class
|
|
1552
|
+
class we extends k {
|
|
1565
1553
|
_parse(e) {
|
|
1566
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1554
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1567
1555
|
const a = this._getOrReturnCtx(e);
|
|
1568
|
-
return
|
|
1569
|
-
code:
|
|
1570
|
-
expected:
|
|
1556
|
+
return l(a, {
|
|
1557
|
+
code: c.invalid_type,
|
|
1558
|
+
expected: f.date,
|
|
1571
1559
|
received: a.parsedType
|
|
1572
1560
|
}), y;
|
|
1573
1561
|
}
|
|
1574
|
-
if (isNaN(e.data.getTime())) {
|
|
1562
|
+
if (Number.isNaN(e.data.getTime())) {
|
|
1575
1563
|
const a = this._getOrReturnCtx(e);
|
|
1576
|
-
return
|
|
1577
|
-
code:
|
|
1564
|
+
return l(a, {
|
|
1565
|
+
code: c.invalid_date
|
|
1578
1566
|
}), y;
|
|
1579
1567
|
}
|
|
1580
|
-
const n = new
|
|
1568
|
+
const n = new R();
|
|
1581
1569
|
let s;
|
|
1582
1570
|
for (const a of this._def.checks)
|
|
1583
|
-
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1584
|
-
code:
|
|
1571
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1572
|
+
code: c.too_small,
|
|
1585
1573
|
message: a.message,
|
|
1586
1574
|
inclusive: !0,
|
|
1587
1575
|
exact: !1,
|
|
1588
1576
|
minimum: a.value,
|
|
1589
1577
|
type: "date"
|
|
1590
|
-
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1591
|
-
code:
|
|
1578
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1579
|
+
code: c.too_big,
|
|
1592
1580
|
message: a.message,
|
|
1593
1581
|
inclusive: !0,
|
|
1594
1582
|
exact: !1,
|
|
1595
1583
|
maximum: a.value,
|
|
1596
1584
|
type: "date"
|
|
1597
|
-
}), n.dirty()) :
|
|
1585
|
+
}), n.dirty()) : w.assertNever(a);
|
|
1598
1586
|
return {
|
|
1599
1587
|
status: n.value,
|
|
1600
1588
|
value: new Date(e.data.getTime())
|
|
1601
1589
|
};
|
|
1602
1590
|
}
|
|
1603
1591
|
_addCheck(e) {
|
|
1604
|
-
return new
|
|
1592
|
+
return new we({
|
|
1605
1593
|
...this._def,
|
|
1606
1594
|
checks: [...this._def.checks, e]
|
|
1607
1595
|
});
|
|
@@ -1610,14 +1598,14 @@ var rs = pr((as, mt) => {
|
|
|
1610
1598
|
return this._addCheck({
|
|
1611
1599
|
kind: "min",
|
|
1612
1600
|
value: e.getTime(),
|
|
1613
|
-
message:
|
|
1601
|
+
message: p.toString(r)
|
|
1614
1602
|
});
|
|
1615
1603
|
}
|
|
1616
1604
|
max(e, r) {
|
|
1617
1605
|
return this._addCheck({
|
|
1618
1606
|
kind: "max",
|
|
1619
1607
|
value: e.getTime(),
|
|
1620
|
-
message:
|
|
1608
|
+
message: p.toString(r)
|
|
1621
1609
|
});
|
|
1622
1610
|
}
|
|
1623
1611
|
get minDate() {
|
|
@@ -1633,131 +1621,131 @@ var rs = pr((as, mt) => {
|
|
|
1633
1621
|
return e != null ? new Date(e) : null;
|
|
1634
1622
|
}
|
|
1635
1623
|
}
|
|
1636
|
-
|
|
1624
|
+
we.create = (t) => new we({
|
|
1637
1625
|
checks: [],
|
|
1638
1626
|
coerce: t?.coerce || !1,
|
|
1639
|
-
typeName:
|
|
1627
|
+
typeName: g.ZodDate,
|
|
1640
1628
|
...v(t)
|
|
1641
1629
|
});
|
|
1642
|
-
class
|
|
1630
|
+
class rt extends k {
|
|
1643
1631
|
_parse(e) {
|
|
1644
|
-
if (this._getType(e) !==
|
|
1632
|
+
if (this._getType(e) !== f.symbol) {
|
|
1645
1633
|
const n = this._getOrReturnCtx(e);
|
|
1646
|
-
return
|
|
1647
|
-
code:
|
|
1648
|
-
expected:
|
|
1634
|
+
return l(n, {
|
|
1635
|
+
code: c.invalid_type,
|
|
1636
|
+
expected: f.symbol,
|
|
1649
1637
|
received: n.parsedType
|
|
1650
1638
|
}), y;
|
|
1651
1639
|
}
|
|
1652
|
-
return
|
|
1640
|
+
return C(e.data);
|
|
1653
1641
|
}
|
|
1654
1642
|
}
|
|
1655
|
-
|
|
1656
|
-
typeName:
|
|
1643
|
+
rt.create = (t) => new rt({
|
|
1644
|
+
typeName: g.ZodSymbol,
|
|
1657
1645
|
...v(t)
|
|
1658
1646
|
});
|
|
1659
|
-
class
|
|
1647
|
+
class nt extends k {
|
|
1660
1648
|
_parse(e) {
|
|
1661
|
-
if (this._getType(e) !==
|
|
1649
|
+
if (this._getType(e) !== f.undefined) {
|
|
1662
1650
|
const n = this._getOrReturnCtx(e);
|
|
1663
|
-
return
|
|
1664
|
-
code:
|
|
1665
|
-
expected:
|
|
1651
|
+
return l(n, {
|
|
1652
|
+
code: c.invalid_type,
|
|
1653
|
+
expected: f.undefined,
|
|
1666
1654
|
received: n.parsedType
|
|
1667
1655
|
}), y;
|
|
1668
1656
|
}
|
|
1669
|
-
return
|
|
1657
|
+
return C(e.data);
|
|
1670
1658
|
}
|
|
1671
1659
|
}
|
|
1672
|
-
|
|
1673
|
-
typeName:
|
|
1660
|
+
nt.create = (t) => new nt({
|
|
1661
|
+
typeName: g.ZodUndefined,
|
|
1674
1662
|
...v(t)
|
|
1675
1663
|
});
|
|
1676
|
-
class
|
|
1664
|
+
class st extends k {
|
|
1677
1665
|
_parse(e) {
|
|
1678
|
-
if (this._getType(e) !==
|
|
1666
|
+
if (this._getType(e) !== f.null) {
|
|
1679
1667
|
const n = this._getOrReturnCtx(e);
|
|
1680
|
-
return
|
|
1681
|
-
code:
|
|
1682
|
-
expected:
|
|
1668
|
+
return l(n, {
|
|
1669
|
+
code: c.invalid_type,
|
|
1670
|
+
expected: f.null,
|
|
1683
1671
|
received: n.parsedType
|
|
1684
1672
|
}), y;
|
|
1685
1673
|
}
|
|
1686
|
-
return
|
|
1674
|
+
return C(e.data);
|
|
1687
1675
|
}
|
|
1688
1676
|
}
|
|
1689
|
-
|
|
1690
|
-
typeName:
|
|
1677
|
+
st.create = (t) => new st({
|
|
1678
|
+
typeName: g.ZodNull,
|
|
1691
1679
|
...v(t)
|
|
1692
1680
|
});
|
|
1693
|
-
class
|
|
1681
|
+
class at extends k {
|
|
1694
1682
|
constructor() {
|
|
1695
1683
|
super(...arguments), this._any = !0;
|
|
1696
1684
|
}
|
|
1697
1685
|
_parse(e) {
|
|
1698
|
-
return
|
|
1686
|
+
return C(e.data);
|
|
1699
1687
|
}
|
|
1700
1688
|
}
|
|
1701
|
-
|
|
1702
|
-
typeName:
|
|
1689
|
+
at.create = (t) => new at({
|
|
1690
|
+
typeName: g.ZodAny,
|
|
1703
1691
|
...v(t)
|
|
1704
1692
|
});
|
|
1705
|
-
class
|
|
1693
|
+
class it extends k {
|
|
1706
1694
|
constructor() {
|
|
1707
1695
|
super(...arguments), this._unknown = !0;
|
|
1708
1696
|
}
|
|
1709
1697
|
_parse(e) {
|
|
1710
|
-
return
|
|
1698
|
+
return C(e.data);
|
|
1711
1699
|
}
|
|
1712
1700
|
}
|
|
1713
|
-
|
|
1714
|
-
typeName:
|
|
1701
|
+
it.create = (t) => new it({
|
|
1702
|
+
typeName: g.ZodUnknown,
|
|
1715
1703
|
...v(t)
|
|
1716
1704
|
});
|
|
1717
|
-
class
|
|
1705
|
+
class U extends k {
|
|
1718
1706
|
_parse(e) {
|
|
1719
1707
|
const r = this._getOrReturnCtx(e);
|
|
1720
|
-
return
|
|
1721
|
-
code:
|
|
1722
|
-
expected:
|
|
1708
|
+
return l(r, {
|
|
1709
|
+
code: c.invalid_type,
|
|
1710
|
+
expected: f.never,
|
|
1723
1711
|
received: r.parsedType
|
|
1724
1712
|
}), y;
|
|
1725
1713
|
}
|
|
1726
1714
|
}
|
|
1727
|
-
|
|
1728
|
-
typeName:
|
|
1715
|
+
U.create = (t) => new U({
|
|
1716
|
+
typeName: g.ZodNever,
|
|
1729
1717
|
...v(t)
|
|
1730
1718
|
});
|
|
1731
|
-
class
|
|
1719
|
+
class ot extends k {
|
|
1732
1720
|
_parse(e) {
|
|
1733
|
-
if (this._getType(e) !==
|
|
1721
|
+
if (this._getType(e) !== f.undefined) {
|
|
1734
1722
|
const n = this._getOrReturnCtx(e);
|
|
1735
|
-
return
|
|
1736
|
-
code:
|
|
1737
|
-
expected:
|
|
1723
|
+
return l(n, {
|
|
1724
|
+
code: c.invalid_type,
|
|
1725
|
+
expected: f.void,
|
|
1738
1726
|
received: n.parsedType
|
|
1739
1727
|
}), y;
|
|
1740
1728
|
}
|
|
1741
|
-
return
|
|
1729
|
+
return C(e.data);
|
|
1742
1730
|
}
|
|
1743
1731
|
}
|
|
1744
|
-
|
|
1745
|
-
typeName:
|
|
1732
|
+
ot.create = (t) => new ot({
|
|
1733
|
+
typeName: g.ZodVoid,
|
|
1746
1734
|
...v(t)
|
|
1747
1735
|
});
|
|
1748
|
-
class
|
|
1736
|
+
class P extends k {
|
|
1749
1737
|
_parse(e) {
|
|
1750
1738
|
const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
|
|
1751
|
-
if (r.parsedType !==
|
|
1752
|
-
return
|
|
1753
|
-
code:
|
|
1754
|
-
expected:
|
|
1739
|
+
if (r.parsedType !== f.array)
|
|
1740
|
+
return l(r, {
|
|
1741
|
+
code: c.invalid_type,
|
|
1742
|
+
expected: f.array,
|
|
1755
1743
|
received: r.parsedType
|
|
1756
1744
|
}), y;
|
|
1757
1745
|
if (s.exactLength !== null) {
|
|
1758
1746
|
const i = r.data.length > s.exactLength.value, o = r.data.length < s.exactLength.value;
|
|
1759
|
-
(i || o) && (
|
|
1760
|
-
code: i ?
|
|
1747
|
+
(i || o) && (l(r, {
|
|
1748
|
+
code: i ? c.too_big : c.too_small,
|
|
1761
1749
|
minimum: o ? s.exactLength.value : void 0,
|
|
1762
1750
|
maximum: i ? s.exactLength.value : void 0,
|
|
1763
1751
|
type: "array",
|
|
@@ -1766,175 +1754,174 @@ var rs = pr((as, mt) => {
|
|
|
1766
1754
|
message: s.exactLength.message
|
|
1767
1755
|
}), n.dirty());
|
|
1768
1756
|
}
|
|
1769
|
-
if (s.minLength !== null && r.data.length < s.minLength.value && (
|
|
1770
|
-
code:
|
|
1757
|
+
if (s.minLength !== null && r.data.length < s.minLength.value && (l(r, {
|
|
1758
|
+
code: c.too_small,
|
|
1771
1759
|
minimum: s.minLength.value,
|
|
1772
1760
|
type: "array",
|
|
1773
1761
|
inclusive: !0,
|
|
1774
1762
|
exact: !1,
|
|
1775
1763
|
message: s.minLength.message
|
|
1776
|
-
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (
|
|
1777
|
-
code:
|
|
1764
|
+
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (l(r, {
|
|
1765
|
+
code: c.too_big,
|
|
1778
1766
|
maximum: s.maxLength.value,
|
|
1779
1767
|
type: "array",
|
|
1780
1768
|
inclusive: !0,
|
|
1781
1769
|
exact: !1,
|
|
1782
1770
|
message: s.maxLength.message
|
|
1783
1771
|
}), n.dirty()), r.common.async)
|
|
1784
|
-
return Promise.all([...r.data].map((i, o) => s.type._parseAsync(new
|
|
1785
|
-
const a = [...r.data].map((i, o) => s.type._parseSync(new
|
|
1786
|
-
return
|
|
1772
|
+
return Promise.all([...r.data].map((i, o) => s.type._parseAsync(new q(r, i, r.path, o)))).then((i) => R.mergeArray(n, i));
|
|
1773
|
+
const a = [...r.data].map((i, o) => s.type._parseSync(new q(r, i, r.path, o)));
|
|
1774
|
+
return R.mergeArray(n, a);
|
|
1787
1775
|
}
|
|
1788
1776
|
get element() {
|
|
1789
1777
|
return this._def.type;
|
|
1790
1778
|
}
|
|
1791
1779
|
min(e, r) {
|
|
1792
|
-
return new
|
|
1780
|
+
return new P({
|
|
1793
1781
|
...this._def,
|
|
1794
|
-
minLength: { value: e, message:
|
|
1782
|
+
minLength: { value: e, message: p.toString(r) }
|
|
1795
1783
|
});
|
|
1796
1784
|
}
|
|
1797
1785
|
max(e, r) {
|
|
1798
|
-
return new
|
|
1786
|
+
return new P({
|
|
1799
1787
|
...this._def,
|
|
1800
|
-
maxLength: { value: e, message:
|
|
1788
|
+
maxLength: { value: e, message: p.toString(r) }
|
|
1801
1789
|
});
|
|
1802
1790
|
}
|
|
1803
1791
|
length(e, r) {
|
|
1804
|
-
return new
|
|
1792
|
+
return new P({
|
|
1805
1793
|
...this._def,
|
|
1806
|
-
exactLength: { value: e, message:
|
|
1794
|
+
exactLength: { value: e, message: p.toString(r) }
|
|
1807
1795
|
});
|
|
1808
1796
|
}
|
|
1809
1797
|
nonempty(e) {
|
|
1810
1798
|
return this.min(1, e);
|
|
1811
1799
|
}
|
|
1812
1800
|
}
|
|
1813
|
-
|
|
1801
|
+
P.create = (t, e) => new P({
|
|
1814
1802
|
type: t,
|
|
1815
1803
|
minLength: null,
|
|
1816
1804
|
maxLength: null,
|
|
1817
1805
|
exactLength: null,
|
|
1818
|
-
typeName:
|
|
1806
|
+
typeName: g.ZodArray,
|
|
1819
1807
|
...v(e)
|
|
1820
1808
|
});
|
|
1821
|
-
function
|
|
1822
|
-
if (t instanceof
|
|
1809
|
+
function X(t) {
|
|
1810
|
+
if (t instanceof O) {
|
|
1823
1811
|
const e = {};
|
|
1824
1812
|
for (const r in t.shape) {
|
|
1825
1813
|
const n = t.shape[r];
|
|
1826
|
-
e[r] =
|
|
1814
|
+
e[r] = V.create(X(n));
|
|
1827
1815
|
}
|
|
1828
|
-
return new
|
|
1816
|
+
return new O({
|
|
1829
1817
|
...t._def,
|
|
1830
1818
|
shape: () => e
|
|
1831
1819
|
});
|
|
1832
|
-
} else return t instanceof
|
|
1820
|
+
} else return t instanceof P ? new P({
|
|
1833
1821
|
...t._def,
|
|
1834
|
-
type:
|
|
1835
|
-
}) : t instanceof
|
|
1822
|
+
type: X(t.element)
|
|
1823
|
+
}) : t instanceof V ? V.create(X(t.unwrap())) : t instanceof se ? se.create(X(t.unwrap())) : t instanceof Y ? Y.create(t.items.map((e) => X(e))) : t;
|
|
1836
1824
|
}
|
|
1837
|
-
class
|
|
1825
|
+
class O extends k {
|
|
1838
1826
|
constructor() {
|
|
1839
1827
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1840
1828
|
}
|
|
1841
1829
|
_getCached() {
|
|
1842
1830
|
if (this._cached !== null)
|
|
1843
1831
|
return this._cached;
|
|
1844
|
-
const e = this._def.shape(), r =
|
|
1845
|
-
return this._cached = { shape: e, keys: r };
|
|
1832
|
+
const e = this._def.shape(), r = w.objectKeys(e);
|
|
1833
|
+
return this._cached = { shape: e, keys: r }, this._cached;
|
|
1846
1834
|
}
|
|
1847
1835
|
_parse(e) {
|
|
1848
|
-
if (this._getType(e) !==
|
|
1849
|
-
const
|
|
1850
|
-
return
|
|
1851
|
-
code:
|
|
1852
|
-
expected:
|
|
1853
|
-
received:
|
|
1836
|
+
if (this._getType(e) !== f.object) {
|
|
1837
|
+
const u = this._getOrReturnCtx(e);
|
|
1838
|
+
return l(u, {
|
|
1839
|
+
code: c.invalid_type,
|
|
1840
|
+
expected: f.object,
|
|
1841
|
+
received: u.parsedType
|
|
1854
1842
|
}), y;
|
|
1855
1843
|
}
|
|
1856
1844
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1857
|
-
if (!(this._def.catchall instanceof
|
|
1858
|
-
for (const
|
|
1859
|
-
i.includes(
|
|
1845
|
+
if (!(this._def.catchall instanceof U && this._def.unknownKeys === "strip"))
|
|
1846
|
+
for (const u in s.data)
|
|
1847
|
+
i.includes(u) || o.push(u);
|
|
1860
1848
|
const d = [];
|
|
1861
|
-
for (const
|
|
1862
|
-
const
|
|
1849
|
+
for (const u of i) {
|
|
1850
|
+
const h = a[u], b = s.data[u];
|
|
1863
1851
|
d.push({
|
|
1864
|
-
key: { status: "valid", value:
|
|
1865
|
-
value:
|
|
1866
|
-
alwaysSet:
|
|
1852
|
+
key: { status: "valid", value: u },
|
|
1853
|
+
value: h._parse(new q(s, b, s.path, u)),
|
|
1854
|
+
alwaysSet: u in s.data
|
|
1867
1855
|
});
|
|
1868
1856
|
}
|
|
1869
|
-
if (this._def.catchall instanceof
|
|
1870
|
-
const
|
|
1871
|
-
if (
|
|
1872
|
-
for (const
|
|
1857
|
+
if (this._def.catchall instanceof U) {
|
|
1858
|
+
const u = this._def.unknownKeys;
|
|
1859
|
+
if (u === "passthrough")
|
|
1860
|
+
for (const h of o)
|
|
1873
1861
|
d.push({
|
|
1874
|
-
key: { status: "valid", value:
|
|
1875
|
-
value: { status: "valid", value: s.data[
|
|
1862
|
+
key: { status: "valid", value: h },
|
|
1863
|
+
value: { status: "valid", value: s.data[h] }
|
|
1876
1864
|
});
|
|
1877
|
-
else if (
|
|
1878
|
-
o.length > 0 && (
|
|
1879
|
-
code:
|
|
1865
|
+
else if (u === "strict")
|
|
1866
|
+
o.length > 0 && (l(s, {
|
|
1867
|
+
code: c.unrecognized_keys,
|
|
1880
1868
|
keys: o
|
|
1881
1869
|
}), n.dirty());
|
|
1882
|
-
else if (
|
|
1870
|
+
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1883
1871
|
} else {
|
|
1884
|
-
const
|
|
1885
|
-
for (const
|
|
1886
|
-
const
|
|
1872
|
+
const u = this._def.catchall;
|
|
1873
|
+
for (const h of o) {
|
|
1874
|
+
const b = s.data[h];
|
|
1887
1875
|
d.push({
|
|
1888
|
-
key: { status: "valid", value:
|
|
1889
|
-
value:
|
|
1890
|
-
new
|
|
1876
|
+
key: { status: "valid", value: h },
|
|
1877
|
+
value: u._parse(
|
|
1878
|
+
new q(s, b, s.path, h)
|
|
1891
1879
|
//, ctx.child(key), value, getParsedType(value)
|
|
1892
1880
|
),
|
|
1893
|
-
alwaysSet:
|
|
1881
|
+
alwaysSet: h in s.data
|
|
1894
1882
|
});
|
|
1895
1883
|
}
|
|
1896
1884
|
}
|
|
1897
1885
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1898
|
-
const
|
|
1899
|
-
for (const
|
|
1900
|
-
const
|
|
1901
|
-
|
|
1902
|
-
key:
|
|
1903
|
-
value:
|
|
1904
|
-
alwaysSet:
|
|
1886
|
+
const u = [];
|
|
1887
|
+
for (const h of d) {
|
|
1888
|
+
const b = await h.key, S = await h.value;
|
|
1889
|
+
u.push({
|
|
1890
|
+
key: b,
|
|
1891
|
+
value: S,
|
|
1892
|
+
alwaysSet: h.alwaysSet
|
|
1905
1893
|
});
|
|
1906
1894
|
}
|
|
1907
|
-
return
|
|
1908
|
-
}).then((
|
|
1895
|
+
return u;
|
|
1896
|
+
}).then((u) => R.mergeObjectSync(n, u)) : R.mergeObjectSync(n, d);
|
|
1909
1897
|
}
|
|
1910
1898
|
get shape() {
|
|
1911
1899
|
return this._def.shape();
|
|
1912
1900
|
}
|
|
1913
1901
|
strict(e) {
|
|
1914
|
-
return
|
|
1902
|
+
return p.errToObj, new O({
|
|
1915
1903
|
...this._def,
|
|
1916
1904
|
unknownKeys: "strict",
|
|
1917
1905
|
...e !== void 0 ? {
|
|
1918
1906
|
errorMap: (r, n) => {
|
|
1919
|
-
|
|
1920
|
-
const d = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, r, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1907
|
+
const s = this._def.errorMap?.(r, n).message ?? n.defaultError;
|
|
1921
1908
|
return r.code === "unrecognized_keys" ? {
|
|
1922
|
-
message:
|
|
1909
|
+
message: p.errToObj(e).message ?? s
|
|
1923
1910
|
} : {
|
|
1924
|
-
message:
|
|
1911
|
+
message: s
|
|
1925
1912
|
};
|
|
1926
1913
|
}
|
|
1927
1914
|
} : {}
|
|
1928
1915
|
});
|
|
1929
1916
|
}
|
|
1930
1917
|
strip() {
|
|
1931
|
-
return new
|
|
1918
|
+
return new O({
|
|
1932
1919
|
...this._def,
|
|
1933
1920
|
unknownKeys: "strip"
|
|
1934
1921
|
});
|
|
1935
1922
|
}
|
|
1936
1923
|
passthrough() {
|
|
1937
|
-
return new
|
|
1924
|
+
return new O({
|
|
1938
1925
|
...this._def,
|
|
1939
1926
|
unknownKeys: "passthrough"
|
|
1940
1927
|
});
|
|
@@ -1957,7 +1944,7 @@ var rs = pr((as, mt) => {
|
|
|
1957
1944
|
// }) as any;
|
|
1958
1945
|
// };
|
|
1959
1946
|
extend(e) {
|
|
1960
|
-
return new
|
|
1947
|
+
return new O({
|
|
1961
1948
|
...this._def,
|
|
1962
1949
|
shape: () => ({
|
|
1963
1950
|
...this._def.shape(),
|
|
@@ -1971,14 +1958,14 @@ var rs = pr((as, mt) => {
|
|
|
1971
1958
|
* upgrade if you are experiencing issues.
|
|
1972
1959
|
*/
|
|
1973
1960
|
merge(e) {
|
|
1974
|
-
return new
|
|
1961
|
+
return new O({
|
|
1975
1962
|
unknownKeys: e._def.unknownKeys,
|
|
1976
1963
|
catchall: e._def.catchall,
|
|
1977
1964
|
shape: () => ({
|
|
1978
1965
|
...this._def.shape(),
|
|
1979
1966
|
...e._def.shape()
|
|
1980
1967
|
}),
|
|
1981
|
-
typeName:
|
|
1968
|
+
typeName: g.ZodObject
|
|
1982
1969
|
});
|
|
1983
1970
|
}
|
|
1984
1971
|
// merge<
|
|
@@ -2041,25 +2028,25 @@ var rs = pr((as, mt) => {
|
|
|
2041
2028
|
// return merged;
|
|
2042
2029
|
// }
|
|
2043
2030
|
catchall(e) {
|
|
2044
|
-
return new
|
|
2031
|
+
return new O({
|
|
2045
2032
|
...this._def,
|
|
2046
2033
|
catchall: e
|
|
2047
2034
|
});
|
|
2048
2035
|
}
|
|
2049
2036
|
pick(e) {
|
|
2050
2037
|
const r = {};
|
|
2051
|
-
|
|
2038
|
+
for (const n of w.objectKeys(e))
|
|
2052
2039
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
2053
|
-
|
|
2040
|
+
return new O({
|
|
2054
2041
|
...this._def,
|
|
2055
2042
|
shape: () => r
|
|
2056
2043
|
});
|
|
2057
2044
|
}
|
|
2058
2045
|
omit(e) {
|
|
2059
2046
|
const r = {};
|
|
2060
|
-
|
|
2047
|
+
for (const n of w.objectKeys(this.shape))
|
|
2061
2048
|
e[n] || (r[n] = this.shape[n]);
|
|
2062
|
-
|
|
2049
|
+
return new O({
|
|
2063
2050
|
...this._def,
|
|
2064
2051
|
shape: () => r
|
|
2065
2052
|
});
|
|
@@ -2068,60 +2055,61 @@ var rs = pr((as, mt) => {
|
|
|
2068
2055
|
* @deprecated
|
|
2069
2056
|
*/
|
|
2070
2057
|
deepPartial() {
|
|
2071
|
-
return
|
|
2058
|
+
return X(this);
|
|
2072
2059
|
}
|
|
2073
2060
|
partial(e) {
|
|
2074
2061
|
const r = {};
|
|
2075
|
-
|
|
2062
|
+
for (const n of w.objectKeys(this.shape)) {
|
|
2076
2063
|
const s = this.shape[n];
|
|
2077
2064
|
e && !e[n] ? r[n] = s : r[n] = s.optional();
|
|
2078
|
-
}
|
|
2065
|
+
}
|
|
2066
|
+
return new O({
|
|
2079
2067
|
...this._def,
|
|
2080
2068
|
shape: () => r
|
|
2081
2069
|
});
|
|
2082
2070
|
}
|
|
2083
2071
|
required(e) {
|
|
2084
2072
|
const r = {};
|
|
2085
|
-
|
|
2073
|
+
for (const n of w.objectKeys(this.shape))
|
|
2086
2074
|
if (e && !e[n])
|
|
2087
2075
|
r[n] = this.shape[n];
|
|
2088
2076
|
else {
|
|
2089
2077
|
let a = this.shape[n];
|
|
2090
|
-
for (; a instanceof
|
|
2078
|
+
for (; a instanceof V; )
|
|
2091
2079
|
a = a._def.innerType;
|
|
2092
2080
|
r[n] = a;
|
|
2093
2081
|
}
|
|
2094
|
-
|
|
2082
|
+
return new O({
|
|
2095
2083
|
...this._def,
|
|
2096
2084
|
shape: () => r
|
|
2097
2085
|
});
|
|
2098
2086
|
}
|
|
2099
2087
|
keyof() {
|
|
2100
|
-
return
|
|
2088
|
+
return _t(w.objectKeys(this.shape));
|
|
2101
2089
|
}
|
|
2102
2090
|
}
|
|
2103
|
-
|
|
2091
|
+
O.create = (t, e) => new O({
|
|
2104
2092
|
shape: () => t,
|
|
2105
2093
|
unknownKeys: "strip",
|
|
2106
|
-
catchall:
|
|
2107
|
-
typeName:
|
|
2094
|
+
catchall: U.create(),
|
|
2095
|
+
typeName: g.ZodObject,
|
|
2108
2096
|
...v(e)
|
|
2109
2097
|
});
|
|
2110
|
-
|
|
2098
|
+
O.strictCreate = (t, e) => new O({
|
|
2111
2099
|
shape: () => t,
|
|
2112
2100
|
unknownKeys: "strict",
|
|
2113
|
-
catchall:
|
|
2114
|
-
typeName:
|
|
2101
|
+
catchall: U.create(),
|
|
2102
|
+
typeName: g.ZodObject,
|
|
2115
2103
|
...v(e)
|
|
2116
2104
|
});
|
|
2117
|
-
|
|
2105
|
+
O.lazycreate = (t, e) => new O({
|
|
2118
2106
|
shape: t,
|
|
2119
2107
|
unknownKeys: "strip",
|
|
2120
|
-
catchall:
|
|
2121
|
-
typeName:
|
|
2108
|
+
catchall: U.create(),
|
|
2109
|
+
typeName: g.ZodObject,
|
|
2122
2110
|
...v(e)
|
|
2123
2111
|
});
|
|
2124
|
-
class
|
|
2112
|
+
class xe extends k {
|
|
2125
2113
|
_parse(e) {
|
|
2126
2114
|
const { ctx: r } = this._processInputParams(e), n = this._def.options;
|
|
2127
2115
|
function s(a) {
|
|
@@ -2131,9 +2119,9 @@ var rs = pr((as, mt) => {
|
|
|
2131
2119
|
for (const o of a)
|
|
2132
2120
|
if (o.result.status === "dirty")
|
|
2133
2121
|
return r.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2134
|
-
const i = a.map((o) => new
|
|
2135
|
-
return
|
|
2136
|
-
code:
|
|
2122
|
+
const i = a.map((o) => new F(o.ctx.common.issues));
|
|
2123
|
+
return l(r, {
|
|
2124
|
+
code: c.invalid_union,
|
|
2137
2125
|
unionErrors: i
|
|
2138
2126
|
}), y;
|
|
2139
2127
|
}
|
|
@@ -2160,27 +2148,27 @@ var rs = pr((as, mt) => {
|
|
|
2160
2148
|
let a;
|
|
2161
2149
|
const i = [];
|
|
2162
2150
|
for (const d of n) {
|
|
2163
|
-
const
|
|
2151
|
+
const u = {
|
|
2164
2152
|
...r,
|
|
2165
2153
|
common: {
|
|
2166
2154
|
...r.common,
|
|
2167
2155
|
issues: []
|
|
2168
2156
|
},
|
|
2169
2157
|
parent: null
|
|
2170
|
-
},
|
|
2158
|
+
}, h = d._parseSync({
|
|
2171
2159
|
data: r.data,
|
|
2172
2160
|
path: r.path,
|
|
2173
|
-
parent:
|
|
2161
|
+
parent: u
|
|
2174
2162
|
});
|
|
2175
|
-
if (
|
|
2176
|
-
return
|
|
2177
|
-
|
|
2163
|
+
if (h.status === "valid")
|
|
2164
|
+
return h;
|
|
2165
|
+
h.status === "dirty" && !a && (a = { result: h, ctx: u }), u.common.issues.length && i.push(u.common.issues);
|
|
2178
2166
|
}
|
|
2179
2167
|
if (a)
|
|
2180
2168
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2181
|
-
const o = i.map((d) => new
|
|
2182
|
-
return
|
|
2183
|
-
code:
|
|
2169
|
+
const o = i.map((d) => new F(d));
|
|
2170
|
+
return l(r, {
|
|
2171
|
+
code: c.invalid_union,
|
|
2184
2172
|
unionErrors: o
|
|
2185
2173
|
}), y;
|
|
2186
2174
|
}
|
|
@@ -2189,108 +2177,45 @@ var rs = pr((as, mt) => {
|
|
|
2189
2177
|
return this._def.options;
|
|
2190
2178
|
}
|
|
2191
2179
|
}
|
|
2192
|
-
|
|
2180
|
+
xe.create = (t, e) => new xe({
|
|
2193
2181
|
options: t,
|
|
2194
|
-
typeName:
|
|
2182
|
+
typeName: g.ZodUnion,
|
|
2195
2183
|
...v(e)
|
|
2196
2184
|
});
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
_parse(e) {
|
|
2200
|
-
const { ctx: r } = this._processInputParams(e);
|
|
2201
|
-
if (r.parsedType !== p.object)
|
|
2202
|
-
return f(r, {
|
|
2203
|
-
code: u.invalid_type,
|
|
2204
|
-
expected: p.object,
|
|
2205
|
-
received: r.parsedType
|
|
2206
|
-
}), y;
|
|
2207
|
-
const n = this.discriminator, s = r.data[n], a = this.optionsMap.get(s);
|
|
2208
|
-
return a ? r.common.async ? a._parseAsync({
|
|
2209
|
-
data: r.data,
|
|
2210
|
-
path: r.path,
|
|
2211
|
-
parent: r
|
|
2212
|
-
}) : a._parseSync({
|
|
2213
|
-
data: r.data,
|
|
2214
|
-
path: r.path,
|
|
2215
|
-
parent: r
|
|
2216
|
-
}) : (f(r, {
|
|
2217
|
-
code: u.invalid_union_discriminator,
|
|
2218
|
-
options: Array.from(this.optionsMap.keys()),
|
|
2219
|
-
path: [n]
|
|
2220
|
-
}), y);
|
|
2221
|
-
}
|
|
2222
|
-
get discriminator() {
|
|
2223
|
-
return this._def.discriminator;
|
|
2224
|
-
}
|
|
2225
|
-
get options() {
|
|
2226
|
-
return this._def.options;
|
|
2227
|
-
}
|
|
2228
|
-
get optionsMap() {
|
|
2229
|
-
return this._def.optionsMap;
|
|
2230
|
-
}
|
|
2231
|
-
/**
|
|
2232
|
-
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
2233
|
-
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
2234
|
-
* have a different value for each object in the union.
|
|
2235
|
-
* @param discriminator the name of the discriminator property
|
|
2236
|
-
* @param types an array of object schemas
|
|
2237
|
-
* @param params
|
|
2238
|
-
*/
|
|
2239
|
-
static create(e, r, n) {
|
|
2240
|
-
const s = /* @__PURE__ */ new Map();
|
|
2241
|
-
for (const a of r) {
|
|
2242
|
-
const i = U(a.shape[e]);
|
|
2243
|
-
if (!i.length)
|
|
2244
|
-
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2245
|
-
for (const o of i) {
|
|
2246
|
-
if (s.has(o))
|
|
2247
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
2248
|
-
s.set(o, a);
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
return new Xe({
|
|
2252
|
-
typeName: m.ZodDiscriminatedUnion,
|
|
2253
|
-
discriminator: e,
|
|
2254
|
-
options: r,
|
|
2255
|
-
optionsMap: s,
|
|
2256
|
-
...v(n)
|
|
2257
|
-
});
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
function dt(t, e) {
|
|
2261
|
-
const r = z(t), n = z(e);
|
|
2185
|
+
function Pe(t, e) {
|
|
2186
|
+
const r = L(t), n = L(e);
|
|
2262
2187
|
if (t === e)
|
|
2263
2188
|
return { valid: !0, data: t };
|
|
2264
|
-
if (r ===
|
|
2265
|
-
const s =
|
|
2189
|
+
if (r === f.object && n === f.object) {
|
|
2190
|
+
const s = w.objectKeys(e), a = w.objectKeys(t).filter((o) => s.indexOf(o) !== -1), i = { ...t, ...e };
|
|
2266
2191
|
for (const o of a) {
|
|
2267
|
-
const d =
|
|
2192
|
+
const d = Pe(t[o], e[o]);
|
|
2268
2193
|
if (!d.valid)
|
|
2269
2194
|
return { valid: !1 };
|
|
2270
2195
|
i[o] = d.data;
|
|
2271
2196
|
}
|
|
2272
2197
|
return { valid: !0, data: i };
|
|
2273
|
-
} else if (r ===
|
|
2198
|
+
} else if (r === f.array && n === f.array) {
|
|
2274
2199
|
if (t.length !== e.length)
|
|
2275
2200
|
return { valid: !1 };
|
|
2276
2201
|
const s = [];
|
|
2277
2202
|
for (let a = 0; a < t.length; a++) {
|
|
2278
|
-
const i = t[a], o = e[a], d =
|
|
2203
|
+
const i = t[a], o = e[a], d = Pe(i, o);
|
|
2279
2204
|
if (!d.valid)
|
|
2280
2205
|
return { valid: !1 };
|
|
2281
2206
|
s.push(d.data);
|
|
2282
2207
|
}
|
|
2283
2208
|
return { valid: !0, data: s };
|
|
2284
|
-
} else return r ===
|
|
2209
|
+
} else return r === f.date && n === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
2285
2210
|
}
|
|
2286
|
-
class
|
|
2211
|
+
class be extends k {
|
|
2287
2212
|
_parse(e) {
|
|
2288
2213
|
const { status: r, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2289
|
-
if (
|
|
2214
|
+
if (Ke(a) || Ke(i))
|
|
2290
2215
|
return y;
|
|
2291
|
-
const o =
|
|
2292
|
-
return o.valid ? ((
|
|
2293
|
-
code:
|
|
2216
|
+
const o = Pe(a.value, i.value);
|
|
2217
|
+
return o.valid ? ((Qe(a) || Qe(i)) && r.dirty(), { status: r.value, value: o.data }) : (l(n, {
|
|
2218
|
+
code: c.invalid_intersection_types
|
|
2294
2219
|
}), y);
|
|
2295
2220
|
};
|
|
2296
2221
|
return n.common.async ? Promise.all([
|
|
@@ -2315,31 +2240,31 @@ var rs = pr((as, mt) => {
|
|
|
2315
2240
|
}));
|
|
2316
2241
|
}
|
|
2317
2242
|
}
|
|
2318
|
-
|
|
2243
|
+
be.create = (t, e, r) => new be({
|
|
2319
2244
|
left: t,
|
|
2320
2245
|
right: e,
|
|
2321
|
-
typeName:
|
|
2246
|
+
typeName: g.ZodIntersection,
|
|
2322
2247
|
...v(r)
|
|
2323
2248
|
});
|
|
2324
|
-
class
|
|
2249
|
+
class Y extends k {
|
|
2325
2250
|
_parse(e) {
|
|
2326
2251
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2327
|
-
if (n.parsedType !==
|
|
2328
|
-
return
|
|
2329
|
-
code:
|
|
2330
|
-
expected:
|
|
2252
|
+
if (n.parsedType !== f.array)
|
|
2253
|
+
return l(n, {
|
|
2254
|
+
code: c.invalid_type,
|
|
2255
|
+
expected: f.array,
|
|
2331
2256
|
received: n.parsedType
|
|
2332
2257
|
}), y;
|
|
2333
2258
|
if (n.data.length < this._def.items.length)
|
|
2334
|
-
return
|
|
2335
|
-
code:
|
|
2259
|
+
return l(n, {
|
|
2260
|
+
code: c.too_small,
|
|
2336
2261
|
minimum: this._def.items.length,
|
|
2337
2262
|
inclusive: !0,
|
|
2338
2263
|
exact: !1,
|
|
2339
2264
|
type: "array"
|
|
2340
2265
|
}), y;
|
|
2341
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
2342
|
-
code:
|
|
2266
|
+
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
2267
|
+
code: c.too_big,
|
|
2343
2268
|
maximum: this._def.items.length,
|
|
2344
2269
|
inclusive: !0,
|
|
2345
2270
|
exact: !1,
|
|
@@ -2347,72 +2272,31 @@ var rs = pr((as, mt) => {
|
|
|
2347
2272
|
}), r.dirty());
|
|
2348
2273
|
const a = [...n.data].map((i, o) => {
|
|
2349
2274
|
const d = this._def.items[o] || this._def.rest;
|
|
2350
|
-
return d ? d._parse(new
|
|
2275
|
+
return d ? d._parse(new q(n, i, n.path, o)) : null;
|
|
2351
2276
|
}).filter((i) => !!i);
|
|
2352
|
-
return n.common.async ? Promise.all(a).then((i) =>
|
|
2277
|
+
return n.common.async ? Promise.all(a).then((i) => R.mergeArray(r, i)) : R.mergeArray(r, a);
|
|
2353
2278
|
}
|
|
2354
2279
|
get items() {
|
|
2355
2280
|
return this._def.items;
|
|
2356
2281
|
}
|
|
2357
2282
|
rest(e) {
|
|
2358
|
-
return new
|
|
2283
|
+
return new Y({
|
|
2359
2284
|
...this._def,
|
|
2360
2285
|
rest: e
|
|
2361
2286
|
});
|
|
2362
2287
|
}
|
|
2363
2288
|
}
|
|
2364
|
-
|
|
2289
|
+
Y.create = (t, e) => {
|
|
2365
2290
|
if (!Array.isArray(t))
|
|
2366
2291
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2367
|
-
return new
|
|
2292
|
+
return new Y({
|
|
2368
2293
|
items: t,
|
|
2369
|
-
typeName:
|
|
2294
|
+
typeName: g.ZodTuple,
|
|
2370
2295
|
rest: null,
|
|
2371
2296
|
...v(e)
|
|
2372
2297
|
});
|
|
2373
2298
|
};
|
|
2374
|
-
class
|
|
2375
|
-
get keySchema() {
|
|
2376
|
-
return this._def.keyType;
|
|
2377
|
-
}
|
|
2378
|
-
get valueSchema() {
|
|
2379
|
-
return this._def.valueType;
|
|
2380
|
-
}
|
|
2381
|
-
_parse(e) {
|
|
2382
|
-
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2383
|
-
if (n.parsedType !== p.object)
|
|
2384
|
-
return f(n, {
|
|
2385
|
-
code: u.invalid_type,
|
|
2386
|
-
expected: p.object,
|
|
2387
|
-
received: n.parsedType
|
|
2388
|
-
}), y;
|
|
2389
|
-
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2390
|
-
for (const o in n.data)
|
|
2391
|
-
s.push({
|
|
2392
|
-
key: a._parse(new M(n, o, n.path, o)),
|
|
2393
|
-
value: i._parse(new M(n, n.data[o], n.path, o)),
|
|
2394
|
-
alwaysSet: o in n.data
|
|
2395
|
-
});
|
|
2396
|
-
return n.common.async ? O.mergeObjectAsync(r, s) : O.mergeObjectSync(r, s);
|
|
2397
|
-
}
|
|
2398
|
-
get element() {
|
|
2399
|
-
return this._def.valueType;
|
|
2400
|
-
}
|
|
2401
|
-
static create(e, r, n) {
|
|
2402
|
-
return r instanceof _ ? new Re({
|
|
2403
|
-
keyType: e,
|
|
2404
|
-
valueType: r,
|
|
2405
|
-
typeName: m.ZodRecord,
|
|
2406
|
-
...v(n)
|
|
2407
|
-
}) : new Re({
|
|
2408
|
-
keyType: P.create(),
|
|
2409
|
-
valueType: e,
|
|
2410
|
-
typeName: m.ZodRecord,
|
|
2411
|
-
...v(r)
|
|
2412
|
-
});
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
class Je extends _ {
|
|
2299
|
+
class dt extends k {
|
|
2416
2300
|
get keySchema() {
|
|
2417
2301
|
return this._def.keyType;
|
|
2418
2302
|
}
|
|
@@ -2421,64 +2305,64 @@ var rs = pr((as, mt) => {
|
|
|
2421
2305
|
}
|
|
2422
2306
|
_parse(e) {
|
|
2423
2307
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2424
|
-
if (n.parsedType !==
|
|
2425
|
-
return
|
|
2426
|
-
code:
|
|
2427
|
-
expected:
|
|
2308
|
+
if (n.parsedType !== f.map)
|
|
2309
|
+
return l(n, {
|
|
2310
|
+
code: c.invalid_type,
|
|
2311
|
+
expected: f.map,
|
|
2428
2312
|
received: n.parsedType
|
|
2429
2313
|
}), y;
|
|
2430
|
-
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, d],
|
|
2431
|
-
key: s._parse(new
|
|
2432
|
-
value: a._parse(new
|
|
2314
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, d], u) => ({
|
|
2315
|
+
key: s._parse(new q(n, o, n.path, [u, "key"])),
|
|
2316
|
+
value: a._parse(new q(n, d, n.path, [u, "value"]))
|
|
2433
2317
|
}));
|
|
2434
2318
|
if (n.common.async) {
|
|
2435
2319
|
const o = /* @__PURE__ */ new Map();
|
|
2436
2320
|
return Promise.resolve().then(async () => {
|
|
2437
2321
|
for (const d of i) {
|
|
2438
|
-
const
|
|
2439
|
-
if (
|
|
2322
|
+
const u = await d.key, h = await d.value;
|
|
2323
|
+
if (u.status === "aborted" || h.status === "aborted")
|
|
2440
2324
|
return y;
|
|
2441
|
-
(
|
|
2325
|
+
(u.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(u.value, h.value);
|
|
2442
2326
|
}
|
|
2443
2327
|
return { status: r.value, value: o };
|
|
2444
2328
|
});
|
|
2445
2329
|
} else {
|
|
2446
2330
|
const o = /* @__PURE__ */ new Map();
|
|
2447
2331
|
for (const d of i) {
|
|
2448
|
-
const
|
|
2449
|
-
if (
|
|
2332
|
+
const u = d.key, h = d.value;
|
|
2333
|
+
if (u.status === "aborted" || h.status === "aborted")
|
|
2450
2334
|
return y;
|
|
2451
|
-
(
|
|
2335
|
+
(u.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(u.value, h.value);
|
|
2452
2336
|
}
|
|
2453
2337
|
return { status: r.value, value: o };
|
|
2454
2338
|
}
|
|
2455
2339
|
}
|
|
2456
2340
|
}
|
|
2457
|
-
|
|
2341
|
+
dt.create = (t, e, r) => new dt({
|
|
2458
2342
|
valueType: e,
|
|
2459
2343
|
keyType: t,
|
|
2460
|
-
typeName:
|
|
2344
|
+
typeName: g.ZodMap,
|
|
2461
2345
|
...v(r)
|
|
2462
2346
|
});
|
|
2463
|
-
class
|
|
2347
|
+
class he extends k {
|
|
2464
2348
|
_parse(e) {
|
|
2465
2349
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2466
|
-
if (n.parsedType !==
|
|
2467
|
-
return
|
|
2468
|
-
code:
|
|
2469
|
-
expected:
|
|
2350
|
+
if (n.parsedType !== f.set)
|
|
2351
|
+
return l(n, {
|
|
2352
|
+
code: c.invalid_type,
|
|
2353
|
+
expected: f.set,
|
|
2470
2354
|
received: n.parsedType
|
|
2471
2355
|
}), y;
|
|
2472
2356
|
const s = this._def;
|
|
2473
|
-
s.minSize !== null && n.data.size < s.minSize.value && (
|
|
2474
|
-
code:
|
|
2357
|
+
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2358
|
+
code: c.too_small,
|
|
2475
2359
|
minimum: s.minSize.value,
|
|
2476
2360
|
type: "set",
|
|
2477
2361
|
inclusive: !0,
|
|
2478
2362
|
exact: !1,
|
|
2479
2363
|
message: s.minSize.message
|
|
2480
|
-
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (
|
|
2481
|
-
code:
|
|
2364
|
+
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2365
|
+
code: c.too_big,
|
|
2482
2366
|
maximum: s.maxSize.value,
|
|
2483
2367
|
type: "set",
|
|
2484
2368
|
inclusive: !0,
|
|
@@ -2487,27 +2371,27 @@ var rs = pr((as, mt) => {
|
|
|
2487
2371
|
}), r.dirty());
|
|
2488
2372
|
const a = this._def.valueType;
|
|
2489
2373
|
function i(d) {
|
|
2490
|
-
const
|
|
2491
|
-
for (const
|
|
2492
|
-
if (
|
|
2374
|
+
const u = /* @__PURE__ */ new Set();
|
|
2375
|
+
for (const h of d) {
|
|
2376
|
+
if (h.status === "aborted")
|
|
2493
2377
|
return y;
|
|
2494
|
-
|
|
2378
|
+
h.status === "dirty" && r.dirty(), u.add(h.value);
|
|
2495
2379
|
}
|
|
2496
|
-
return { status: r.value, value:
|
|
2380
|
+
return { status: r.value, value: u };
|
|
2497
2381
|
}
|
|
2498
|
-
const o = [...n.data.values()].map((d,
|
|
2382
|
+
const o = [...n.data.values()].map((d, u) => a._parse(new q(n, d, n.path, u)));
|
|
2499
2383
|
return n.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
|
|
2500
2384
|
}
|
|
2501
2385
|
min(e, r) {
|
|
2502
|
-
return new
|
|
2386
|
+
return new he({
|
|
2503
2387
|
...this._def,
|
|
2504
|
-
minSize: { value: e, message:
|
|
2388
|
+
minSize: { value: e, message: p.toString(r) }
|
|
2505
2389
|
});
|
|
2506
2390
|
}
|
|
2507
2391
|
max(e, r) {
|
|
2508
|
-
return new
|
|
2392
|
+
return new he({
|
|
2509
2393
|
...this._def,
|
|
2510
|
-
maxSize: { value: e, message:
|
|
2394
|
+
maxSize: { value: e, message: p.toString(r) }
|
|
2511
2395
|
});
|
|
2512
2396
|
}
|
|
2513
2397
|
size(e, r) {
|
|
@@ -2517,115 +2401,14 @@ var rs = pr((as, mt) => {
|
|
|
2517
2401
|
return this.min(1, e);
|
|
2518
2402
|
}
|
|
2519
2403
|
}
|
|
2520
|
-
|
|
2404
|
+
he.create = (t, e) => new he({
|
|
2521
2405
|
valueType: t,
|
|
2522
2406
|
minSize: null,
|
|
2523
2407
|
maxSize: null,
|
|
2524
|
-
typeName:
|
|
2408
|
+
typeName: g.ZodSet,
|
|
2525
2409
|
...v(e)
|
|
2526
2410
|
});
|
|
2527
|
-
class
|
|
2528
|
-
constructor() {
|
|
2529
|
-
super(...arguments), this.validate = this.implement;
|
|
2530
|
-
}
|
|
2531
|
-
_parse(e) {
|
|
2532
|
-
const { ctx: r } = this._processInputParams(e);
|
|
2533
|
-
if (r.parsedType !== p.function)
|
|
2534
|
-
return f(r, {
|
|
2535
|
-
code: u.invalid_type,
|
|
2536
|
-
expected: p.function,
|
|
2537
|
-
received: r.parsedType
|
|
2538
|
-
}), y;
|
|
2539
|
-
function n(o, d) {
|
|
2540
|
-
return qe({
|
|
2541
|
-
data: o,
|
|
2542
|
-
path: r.path,
|
|
2543
|
-
errorMaps: [
|
|
2544
|
-
r.common.contextualErrorMap,
|
|
2545
|
-
r.schemaErrorMap,
|
|
2546
|
-
ze(),
|
|
2547
|
-
pe
|
|
2548
|
-
].filter((c) => !!c),
|
|
2549
|
-
issueData: {
|
|
2550
|
-
code: u.invalid_arguments,
|
|
2551
|
-
argumentsError: d
|
|
2552
|
-
}
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
function s(o, d) {
|
|
2556
|
-
return qe({
|
|
2557
|
-
data: o,
|
|
2558
|
-
path: r.path,
|
|
2559
|
-
errorMaps: [
|
|
2560
|
-
r.common.contextualErrorMap,
|
|
2561
|
-
r.schemaErrorMap,
|
|
2562
|
-
ze(),
|
|
2563
|
-
pe
|
|
2564
|
-
].filter((c) => !!c),
|
|
2565
|
-
issueData: {
|
|
2566
|
-
code: u.invalid_return_type,
|
|
2567
|
-
returnTypeError: d
|
|
2568
|
-
}
|
|
2569
|
-
});
|
|
2570
|
-
}
|
|
2571
|
-
const a = { errorMap: r.common.contextualErrorMap }, i = r.data;
|
|
2572
|
-
if (this._def.returns instanceof me) {
|
|
2573
|
-
const o = this;
|
|
2574
|
-
return R(async function(...d) {
|
|
2575
|
-
const c = new C([]), l = await o._def.args.parseAsync(d, a).catch((A) => {
|
|
2576
|
-
throw c.addIssue(n(d, A)), c;
|
|
2577
|
-
}), w = await Reflect.apply(i, this, l);
|
|
2578
|
-
return await o._def.returns._def.type.parseAsync(w, a).catch((A) => {
|
|
2579
|
-
throw c.addIssue(s(w, A)), c;
|
|
2580
|
-
});
|
|
2581
|
-
});
|
|
2582
|
-
} else {
|
|
2583
|
-
const o = this;
|
|
2584
|
-
return R(function(...d) {
|
|
2585
|
-
const c = o._def.args.safeParse(d, a);
|
|
2586
|
-
if (!c.success)
|
|
2587
|
-
throw new C([n(d, c.error)]);
|
|
2588
|
-
const l = Reflect.apply(i, this, c.data), w = o._def.returns.safeParse(l, a);
|
|
2589
|
-
if (!w.success)
|
|
2590
|
-
throw new C([s(l, w.error)]);
|
|
2591
|
-
return w.data;
|
|
2592
|
-
});
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
parameters() {
|
|
2596
|
-
return this._def.args;
|
|
2597
|
-
}
|
|
2598
|
-
returnType() {
|
|
2599
|
-
return this._def.returns;
|
|
2600
|
-
}
|
|
2601
|
-
args(...e) {
|
|
2602
|
-
return new fe({
|
|
2603
|
-
...this._def,
|
|
2604
|
-
args: L.create(e).rest(re.create())
|
|
2605
|
-
});
|
|
2606
|
-
}
|
|
2607
|
-
returns(e) {
|
|
2608
|
-
return new fe({
|
|
2609
|
-
...this._def,
|
|
2610
|
-
returns: e
|
|
2611
|
-
});
|
|
2612
|
-
}
|
|
2613
|
-
implement(e) {
|
|
2614
|
-
return this.parse(e);
|
|
2615
|
-
}
|
|
2616
|
-
strictImplement(e) {
|
|
2617
|
-
return this.parse(e);
|
|
2618
|
-
}
|
|
2619
|
-
static create(e, r, n) {
|
|
2620
|
-
return new fe({
|
|
2621
|
-
args: e || L.create([]).rest(re.create()),
|
|
2622
|
-
returns: r || re.create(),
|
|
2623
|
-
typeName: m.ZodFunction,
|
|
2624
|
-
...v(n)
|
|
2625
|
-
});
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
class Ae extends _ {
|
|
2411
|
+
class ct extends k {
|
|
2629
2412
|
get schema() {
|
|
2630
2413
|
return this._def.getter();
|
|
2631
2414
|
}
|
|
@@ -2634,18 +2417,18 @@ var rs = pr((as, mt) => {
|
|
|
2634
2417
|
return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
|
|
2635
2418
|
}
|
|
2636
2419
|
}
|
|
2637
|
-
|
|
2420
|
+
ct.create = (t, e) => new ct({
|
|
2638
2421
|
getter: t,
|
|
2639
|
-
typeName:
|
|
2422
|
+
typeName: g.ZodLazy,
|
|
2640
2423
|
...v(e)
|
|
2641
2424
|
});
|
|
2642
|
-
class
|
|
2425
|
+
class ut extends k {
|
|
2643
2426
|
_parse(e) {
|
|
2644
2427
|
if (e.data !== this._def.value) {
|
|
2645
2428
|
const r = this._getOrReturnCtx(e);
|
|
2646
|
-
return
|
|
2429
|
+
return l(r, {
|
|
2647
2430
|
received: r.data,
|
|
2648
|
-
code:
|
|
2431
|
+
code: c.invalid_literal,
|
|
2649
2432
|
expected: this._def.value
|
|
2650
2433
|
}), y;
|
|
2651
2434
|
}
|
|
@@ -2655,40 +2438,37 @@ var rs = pr((as, mt) => {
|
|
|
2655
2438
|
return this._def.value;
|
|
2656
2439
|
}
|
|
2657
2440
|
}
|
|
2658
|
-
|
|
2441
|
+
ut.create = (t, e) => new ut({
|
|
2659
2442
|
value: t,
|
|
2660
|
-
typeName:
|
|
2443
|
+
typeName: g.ZodLiteral,
|
|
2661
2444
|
...v(e)
|
|
2662
2445
|
});
|
|
2663
|
-
function
|
|
2664
|
-
return new
|
|
2446
|
+
function _t(t, e) {
|
|
2447
|
+
return new re({
|
|
2665
2448
|
values: t,
|
|
2666
|
-
typeName:
|
|
2449
|
+
typeName: g.ZodEnum,
|
|
2667
2450
|
...v(e)
|
|
2668
2451
|
});
|
|
2669
2452
|
}
|
|
2670
|
-
class
|
|
2671
|
-
constructor() {
|
|
2672
|
-
super(...arguments), we.set(this, void 0);
|
|
2673
|
-
}
|
|
2453
|
+
class re extends k {
|
|
2674
2454
|
_parse(e) {
|
|
2675
2455
|
if (typeof e.data != "string") {
|
|
2676
2456
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2677
|
-
return
|
|
2678
|
-
expected:
|
|
2457
|
+
return l(r, {
|
|
2458
|
+
expected: w.joinValues(n),
|
|
2679
2459
|
received: r.parsedType,
|
|
2680
|
-
code:
|
|
2460
|
+
code: c.invalid_type
|
|
2681
2461
|
}), y;
|
|
2682
2462
|
}
|
|
2683
|
-
if (
|
|
2463
|
+
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2684
2464
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2685
|
-
return
|
|
2465
|
+
return l(r, {
|
|
2686
2466
|
received: r.data,
|
|
2687
|
-
code:
|
|
2467
|
+
code: c.invalid_enum_value,
|
|
2688
2468
|
options: n
|
|
2689
2469
|
}), y;
|
|
2690
2470
|
}
|
|
2691
|
-
return
|
|
2471
|
+
return C(e.data);
|
|
2692
2472
|
}
|
|
2693
2473
|
get options() {
|
|
2694
2474
|
return this._def.values;
|
|
@@ -2712,89 +2492,84 @@ var rs = pr((as, mt) => {
|
|
|
2712
2492
|
return e;
|
|
2713
2493
|
}
|
|
2714
2494
|
extract(e, r = this._def) {
|
|
2715
|
-
return
|
|
2495
|
+
return re.create(e, {
|
|
2716
2496
|
...this._def,
|
|
2717
2497
|
...r
|
|
2718
2498
|
});
|
|
2719
2499
|
}
|
|
2720
2500
|
exclude(e, r = this._def) {
|
|
2721
|
-
return
|
|
2501
|
+
return re.create(this.options.filter((n) => !e.includes(n)), {
|
|
2722
2502
|
...this._def,
|
|
2723
2503
|
...r
|
|
2724
2504
|
});
|
|
2725
2505
|
}
|
|
2726
2506
|
}
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
class Ie extends _ {
|
|
2730
|
-
constructor() {
|
|
2731
|
-
super(...arguments), be.set(this, void 0);
|
|
2732
|
-
}
|
|
2507
|
+
re.create = _t;
|
|
2508
|
+
class lt extends k {
|
|
2733
2509
|
_parse(e) {
|
|
2734
|
-
const r =
|
|
2735
|
-
if (n.parsedType !==
|
|
2736
|
-
const s =
|
|
2737
|
-
return
|
|
2738
|
-
expected:
|
|
2510
|
+
const r = w.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2511
|
+
if (n.parsedType !== f.string && n.parsedType !== f.number) {
|
|
2512
|
+
const s = w.objectValues(r);
|
|
2513
|
+
return l(n, {
|
|
2514
|
+
expected: w.joinValues(s),
|
|
2739
2515
|
received: n.parsedType,
|
|
2740
|
-
code:
|
|
2516
|
+
code: c.invalid_type
|
|
2741
2517
|
}), y;
|
|
2742
2518
|
}
|
|
2743
|
-
if (
|
|
2744
|
-
const s =
|
|
2745
|
-
return
|
|
2519
|
+
if (this._cache || (this._cache = new Set(w.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2520
|
+
const s = w.objectValues(r);
|
|
2521
|
+
return l(n, {
|
|
2746
2522
|
received: n.data,
|
|
2747
|
-
code:
|
|
2523
|
+
code: c.invalid_enum_value,
|
|
2748
2524
|
options: s
|
|
2749
2525
|
}), y;
|
|
2750
2526
|
}
|
|
2751
|
-
return
|
|
2527
|
+
return C(e.data);
|
|
2752
2528
|
}
|
|
2753
2529
|
get enum() {
|
|
2754
2530
|
return this._def.values;
|
|
2755
2531
|
}
|
|
2756
2532
|
}
|
|
2757
|
-
|
|
2758
|
-
Ie.create = (t, e) => new Ie({
|
|
2533
|
+
lt.create = (t, e) => new lt({
|
|
2759
2534
|
values: t,
|
|
2760
|
-
typeName:
|
|
2535
|
+
typeName: g.ZodNativeEnum,
|
|
2761
2536
|
...v(e)
|
|
2762
2537
|
});
|
|
2763
|
-
class
|
|
2538
|
+
class Se extends k {
|
|
2764
2539
|
unwrap() {
|
|
2765
2540
|
return this._def.type;
|
|
2766
2541
|
}
|
|
2767
2542
|
_parse(e) {
|
|
2768
2543
|
const { ctx: r } = this._processInputParams(e);
|
|
2769
|
-
if (r.parsedType !==
|
|
2770
|
-
return
|
|
2771
|
-
code:
|
|
2772
|
-
expected:
|
|
2544
|
+
if (r.parsedType !== f.promise && r.common.async === !1)
|
|
2545
|
+
return l(r, {
|
|
2546
|
+
code: c.invalid_type,
|
|
2547
|
+
expected: f.promise,
|
|
2773
2548
|
received: r.parsedType
|
|
2774
2549
|
}), y;
|
|
2775
|
-
const n = r.parsedType ===
|
|
2776
|
-
return
|
|
2550
|
+
const n = r.parsedType === f.promise ? r.data : Promise.resolve(r.data);
|
|
2551
|
+
return C(n.then((s) => this._def.type.parseAsync(s, {
|
|
2777
2552
|
path: r.path,
|
|
2778
2553
|
errorMap: r.common.contextualErrorMap
|
|
2779
2554
|
})));
|
|
2780
2555
|
}
|
|
2781
2556
|
}
|
|
2782
|
-
|
|
2557
|
+
Se.create = (t, e) => new Se({
|
|
2783
2558
|
type: t,
|
|
2784
|
-
typeName:
|
|
2559
|
+
typeName: g.ZodPromise,
|
|
2785
2560
|
...v(e)
|
|
2786
2561
|
});
|
|
2787
|
-
class
|
|
2562
|
+
class ne extends k {
|
|
2788
2563
|
innerType() {
|
|
2789
2564
|
return this._def.schema;
|
|
2790
2565
|
}
|
|
2791
2566
|
sourceType() {
|
|
2792
|
-
return this._def.schema._def.typeName ===
|
|
2567
|
+
return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2793
2568
|
}
|
|
2794
2569
|
_parse(e) {
|
|
2795
2570
|
const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2796
2571
|
addIssue: (i) => {
|
|
2797
|
-
|
|
2572
|
+
l(n, i), i.fatal ? r.abort() : r.dirty();
|
|
2798
2573
|
},
|
|
2799
2574
|
get path() {
|
|
2800
2575
|
return n.path;
|
|
@@ -2811,7 +2586,7 @@ var rs = pr((as, mt) => {
|
|
|
2811
2586
|
path: n.path,
|
|
2812
2587
|
parent: n
|
|
2813
2588
|
});
|
|
2814
|
-
return d.status === "aborted" ? y : d.status === "dirty" || r.value === "dirty" ?
|
|
2589
|
+
return d.status === "aborted" ? y : d.status === "dirty" || r.value === "dirty" ? ce(d.value) : d;
|
|
2815
2590
|
});
|
|
2816
2591
|
{
|
|
2817
2592
|
if (r.value === "aborted")
|
|
@@ -2821,7 +2596,7 @@ var rs = pr((as, mt) => {
|
|
|
2821
2596
|
path: n.path,
|
|
2822
2597
|
parent: n
|
|
2823
2598
|
});
|
|
2824
|
-
return o.status === "aborted" ? y : o.status === "dirty" || r.value === "dirty" ?
|
|
2599
|
+
return o.status === "aborted" ? y : o.status === "dirty" || r.value === "dirty" ? ce(o.value) : o;
|
|
2825
2600
|
}
|
|
2826
2601
|
}
|
|
2827
2602
|
if (s.type === "refinement") {
|
|
@@ -2850,60 +2625,63 @@ var rs = pr((as, mt) => {
|
|
|
2850
2625
|
path: n.path,
|
|
2851
2626
|
parent: n
|
|
2852
2627
|
});
|
|
2853
|
-
if (!
|
|
2854
|
-
return
|
|
2628
|
+
if (!te(i))
|
|
2629
|
+
return y;
|
|
2855
2630
|
const o = s.transform(i.value, a);
|
|
2856
2631
|
if (o instanceof Promise)
|
|
2857
2632
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2858
2633
|
return { status: r.value, value: o };
|
|
2859
2634
|
} else
|
|
2860
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
2861
|
-
|
|
2635
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => te(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({
|
|
2636
|
+
status: r.value,
|
|
2637
|
+
value: o
|
|
2638
|
+
})) : y);
|
|
2639
|
+
w.assertNever(s);
|
|
2862
2640
|
}
|
|
2863
2641
|
}
|
|
2864
|
-
|
|
2642
|
+
ne.create = (t, e, r) => new ne({
|
|
2865
2643
|
schema: t,
|
|
2866
|
-
typeName:
|
|
2644
|
+
typeName: g.ZodEffects,
|
|
2867
2645
|
effect: e,
|
|
2868
2646
|
...v(r)
|
|
2869
2647
|
});
|
|
2870
|
-
|
|
2648
|
+
ne.createWithPreprocess = (t, e, r) => new ne({
|
|
2871
2649
|
schema: e,
|
|
2872
2650
|
effect: { type: "preprocess", transform: t },
|
|
2873
|
-
typeName:
|
|
2651
|
+
typeName: g.ZodEffects,
|
|
2874
2652
|
...v(r)
|
|
2875
2653
|
});
|
|
2876
|
-
class
|
|
2654
|
+
class V extends k {
|
|
2877
2655
|
_parse(e) {
|
|
2878
|
-
return this._getType(e) ===
|
|
2656
|
+
return this._getType(e) === f.undefined ? C(void 0) : this._def.innerType._parse(e);
|
|
2879
2657
|
}
|
|
2880
2658
|
unwrap() {
|
|
2881
2659
|
return this._def.innerType;
|
|
2882
2660
|
}
|
|
2883
2661
|
}
|
|
2884
|
-
|
|
2662
|
+
V.create = (t, e) => new V({
|
|
2885
2663
|
innerType: t,
|
|
2886
|
-
typeName:
|
|
2664
|
+
typeName: g.ZodOptional,
|
|
2887
2665
|
...v(e)
|
|
2888
2666
|
});
|
|
2889
|
-
class
|
|
2667
|
+
class se extends k {
|
|
2890
2668
|
_parse(e) {
|
|
2891
|
-
return this._getType(e) ===
|
|
2669
|
+
return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(e);
|
|
2892
2670
|
}
|
|
2893
2671
|
unwrap() {
|
|
2894
2672
|
return this._def.innerType;
|
|
2895
2673
|
}
|
|
2896
2674
|
}
|
|
2897
|
-
|
|
2675
|
+
se.create = (t, e) => new se({
|
|
2898
2676
|
innerType: t,
|
|
2899
|
-
typeName:
|
|
2677
|
+
typeName: g.ZodNullable,
|
|
2900
2678
|
...v(e)
|
|
2901
2679
|
});
|
|
2902
|
-
class
|
|
2680
|
+
class je extends k {
|
|
2903
2681
|
_parse(e) {
|
|
2904
2682
|
const { ctx: r } = this._processInputParams(e);
|
|
2905
2683
|
let n = r.data;
|
|
2906
|
-
return r.parsedType ===
|
|
2684
|
+
return r.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
2907
2685
|
data: n,
|
|
2908
2686
|
path: r.path,
|
|
2909
2687
|
parent: r
|
|
@@ -2913,13 +2691,13 @@ var rs = pr((as, mt) => {
|
|
|
2913
2691
|
return this._def.innerType;
|
|
2914
2692
|
}
|
|
2915
2693
|
}
|
|
2916
|
-
|
|
2694
|
+
je.create = (t, e) => new je({
|
|
2917
2695
|
innerType: t,
|
|
2918
|
-
typeName:
|
|
2696
|
+
typeName: g.ZodDefault,
|
|
2919
2697
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2920
2698
|
...v(e)
|
|
2921
2699
|
});
|
|
2922
|
-
class
|
|
2700
|
+
class $e extends k {
|
|
2923
2701
|
_parse(e) {
|
|
2924
2702
|
const { ctx: r } = this._processInputParams(e), n = {
|
|
2925
2703
|
...r,
|
|
@@ -2934,11 +2712,11 @@ var rs = pr((as, mt) => {
|
|
|
2934
2712
|
...n
|
|
2935
2713
|
}
|
|
2936
2714
|
});
|
|
2937
|
-
return
|
|
2715
|
+
return ke(s) ? s.then((a) => ({
|
|
2938
2716
|
status: "valid",
|
|
2939
2717
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2940
2718
|
get error() {
|
|
2941
|
-
return new
|
|
2719
|
+
return new F(n.common.issues);
|
|
2942
2720
|
},
|
|
2943
2721
|
input: n.data
|
|
2944
2722
|
})
|
|
@@ -2946,7 +2724,7 @@ var rs = pr((as, mt) => {
|
|
|
2946
2724
|
status: "valid",
|
|
2947
2725
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2948
2726
|
get error() {
|
|
2949
|
-
return new
|
|
2727
|
+
return new F(n.common.issues);
|
|
2950
2728
|
},
|
|
2951
2729
|
input: n.data
|
|
2952
2730
|
})
|
|
@@ -2956,31 +2734,30 @@ var rs = pr((as, mt) => {
|
|
|
2956
2734
|
return this._def.innerType;
|
|
2957
2735
|
}
|
|
2958
2736
|
}
|
|
2959
|
-
|
|
2737
|
+
$e.create = (t, e) => new $e({
|
|
2960
2738
|
innerType: t,
|
|
2961
|
-
typeName:
|
|
2739
|
+
typeName: g.ZodCatch,
|
|
2962
2740
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2963
2741
|
...v(e)
|
|
2964
2742
|
});
|
|
2965
|
-
class
|
|
2743
|
+
class ft extends k {
|
|
2966
2744
|
_parse(e) {
|
|
2967
|
-
if (this._getType(e) !==
|
|
2745
|
+
if (this._getType(e) !== f.nan) {
|
|
2968
2746
|
const n = this._getOrReturnCtx(e);
|
|
2969
|
-
return
|
|
2970
|
-
code:
|
|
2971
|
-
expected:
|
|
2747
|
+
return l(n, {
|
|
2748
|
+
code: c.invalid_type,
|
|
2749
|
+
expected: f.nan,
|
|
2972
2750
|
received: n.parsedType
|
|
2973
2751
|
}), y;
|
|
2974
2752
|
}
|
|
2975
2753
|
return { status: "valid", value: e.data };
|
|
2976
2754
|
}
|
|
2977
2755
|
}
|
|
2978
|
-
|
|
2979
|
-
typeName:
|
|
2756
|
+
ft.create = (t) => new ft({
|
|
2757
|
+
typeName: g.ZodNaN,
|
|
2980
2758
|
...v(t)
|
|
2981
2759
|
});
|
|
2982
|
-
|
|
2983
|
-
class yt extends _ {
|
|
2760
|
+
class Cr extends k {
|
|
2984
2761
|
_parse(e) {
|
|
2985
2762
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
2986
2763
|
return this._def.type._parse({
|
|
@@ -2993,7 +2770,7 @@ var rs = pr((as, mt) => {
|
|
|
2993
2770
|
return this._def.type;
|
|
2994
2771
|
}
|
|
2995
2772
|
}
|
|
2996
|
-
class
|
|
2773
|
+
class ze extends k {
|
|
2997
2774
|
_parse(e) {
|
|
2998
2775
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2999
2776
|
if (n.common.async)
|
|
@@ -3003,7 +2780,7 @@ var rs = pr((as, mt) => {
|
|
|
3003
2780
|
path: n.path,
|
|
3004
2781
|
parent: n
|
|
3005
2782
|
});
|
|
3006
|
-
return a.status === "aborted" ? y : a.status === "dirty" ? (r.dirty(),
|
|
2783
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (r.dirty(), ce(a.value)) : this._def.out._parseAsync({
|
|
3007
2784
|
data: a.value,
|
|
3008
2785
|
path: n.path,
|
|
3009
2786
|
parent: n
|
|
@@ -3026,201 +2803,59 @@ var rs = pr((as, mt) => {
|
|
|
3026
2803
|
}
|
|
3027
2804
|
}
|
|
3028
2805
|
static create(e, r) {
|
|
3029
|
-
return new
|
|
2806
|
+
return new ze({
|
|
3030
2807
|
in: e,
|
|
3031
2808
|
out: r,
|
|
3032
|
-
typeName:
|
|
2809
|
+
typeName: g.ZodPipeline
|
|
3033
2810
|
});
|
|
3034
2811
|
}
|
|
3035
2812
|
}
|
|
3036
|
-
class
|
|
2813
|
+
class Fe extends k {
|
|
3037
2814
|
_parse(e) {
|
|
3038
|
-
const r = this._def.innerType._parse(e), n = (s) => (
|
|
3039
|
-
return
|
|
2815
|
+
const r = this._def.innerType._parse(e), n = (s) => (te(s) && (s.value = Object.freeze(s.value)), s);
|
|
2816
|
+
return ke(r) ? r.then((s) => n(s)) : n(r);
|
|
3040
2817
|
}
|
|
3041
2818
|
unwrap() {
|
|
3042
2819
|
return this._def.innerType;
|
|
3043
2820
|
}
|
|
3044
2821
|
}
|
|
3045
|
-
|
|
2822
|
+
Fe.create = (t, e) => new Fe({
|
|
3046
2823
|
innerType: t,
|
|
3047
|
-
typeName:
|
|
2824
|
+
typeName: g.ZodReadonly,
|
|
3048
2825
|
...v(e)
|
|
3049
2826
|
});
|
|
3050
|
-
|
|
3051
|
-
const r = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
|
|
3052
|
-
return typeof r == "string" ? { message: r } : r;
|
|
3053
|
-
}
|
|
3054
|
-
function $t(t, e = {}, r) {
|
|
3055
|
-
return t ? he.create().superRefine((n, s) => {
|
|
3056
|
-
var a, i;
|
|
3057
|
-
const o = t(n);
|
|
3058
|
-
if (o instanceof Promise)
|
|
3059
|
-
return o.then((d) => {
|
|
3060
|
-
var c, l;
|
|
3061
|
-
if (!d) {
|
|
3062
|
-
const w = Tt(e, n), x = (l = (c = w.fatal) !== null && c !== void 0 ? c : r) !== null && l !== void 0 ? l : !0;
|
|
3063
|
-
s.addIssue({ code: "custom", ...w, fatal: x });
|
|
3064
|
-
}
|
|
3065
|
-
});
|
|
3066
|
-
if (!o) {
|
|
3067
|
-
const d = Tt(e, n), c = (i = (a = d.fatal) !== null && a !== void 0 ? a : r) !== null && i !== void 0 ? i : !0;
|
|
3068
|
-
s.addIssue({ code: "custom", ...d, fatal: c });
|
|
3069
|
-
}
|
|
3070
|
-
}) : he.create();
|
|
3071
|
-
}
|
|
3072
|
-
const Jr = {
|
|
3073
|
-
object: S.lazycreate
|
|
3074
|
-
};
|
|
3075
|
-
var m;
|
|
2827
|
+
var g;
|
|
3076
2828
|
(function(t) {
|
|
3077
2829
|
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";
|
|
3078
|
-
})(
|
|
3079
|
-
const
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
setErrorMap: Tr,
|
|
3095
|
-
getErrorMap: ze,
|
|
3096
|
-
makeIssue: qe,
|
|
3097
|
-
EMPTY_PATH: Sr,
|
|
3098
|
-
addIssueToContext: f,
|
|
3099
|
-
ParseStatus: O,
|
|
3100
|
-
INVALID: y,
|
|
3101
|
-
DIRTY: le,
|
|
3102
|
-
OK: R,
|
|
3103
|
-
isAborted: it,
|
|
3104
|
-
isDirty: ot,
|
|
3105
|
-
isValid: ne,
|
|
3106
|
-
isAsync: xe,
|
|
3107
|
-
get util() {
|
|
3108
|
-
return b;
|
|
3109
|
-
},
|
|
3110
|
-
get objectUtil() {
|
|
3111
|
-
return at;
|
|
3112
|
-
},
|
|
3113
|
-
ZodParsedType: p,
|
|
3114
|
-
getParsedType: z,
|
|
3115
|
-
ZodType: _,
|
|
3116
|
-
datetimeRegex: Zt,
|
|
3117
|
-
ZodString: P,
|
|
3118
|
-
ZodNumber: W,
|
|
3119
|
-
ZodBigInt: J,
|
|
3120
|
-
ZodBoolean: Te,
|
|
3121
|
-
ZodDate: se,
|
|
3122
|
-
ZodSymbol: Be,
|
|
3123
|
-
ZodUndefined: Se,
|
|
3124
|
-
ZodNull: Ee,
|
|
3125
|
-
ZodAny: he,
|
|
3126
|
-
ZodUnknown: re,
|
|
3127
|
-
ZodNever: q,
|
|
3128
|
-
ZodVoid: We,
|
|
3129
|
-
ZodArray: Z,
|
|
3130
|
-
ZodObject: S,
|
|
3131
|
-
ZodUnion: Oe,
|
|
3132
|
-
ZodDiscriminatedUnion: Xe,
|
|
3133
|
-
ZodIntersection: Ne,
|
|
3134
|
-
ZodTuple: L,
|
|
3135
|
-
ZodRecord: Re,
|
|
3136
|
-
ZodMap: Je,
|
|
3137
|
-
ZodSet: ae,
|
|
3138
|
-
ZodFunction: fe,
|
|
3139
|
-
ZodLazy: Ae,
|
|
3140
|
-
ZodLiteral: Ce,
|
|
3141
|
-
ZodEnum: Y,
|
|
3142
|
-
ZodNativeEnum: Ie,
|
|
3143
|
-
ZodPromise: me,
|
|
3144
|
-
ZodEffects: j,
|
|
3145
|
-
ZodTransformer: j,
|
|
3146
|
-
ZodOptional: F,
|
|
3147
|
-
ZodNullable: K,
|
|
3148
|
-
ZodDefault: Pe,
|
|
3149
|
-
ZodCatch: Ze,
|
|
3150
|
-
ZodNaN: Ye,
|
|
3151
|
-
BRAND: Wr,
|
|
3152
|
-
ZodBranded: yt,
|
|
3153
|
-
ZodPipeline: $e,
|
|
3154
|
-
ZodReadonly: je,
|
|
3155
|
-
custom: $t,
|
|
3156
|
-
Schema: _,
|
|
3157
|
-
ZodSchema: _,
|
|
3158
|
-
late: Jr,
|
|
3159
|
-
get ZodFirstPartyTypeKind() {
|
|
3160
|
-
return m;
|
|
3161
|
-
},
|
|
3162
|
-
coerce: An,
|
|
3163
|
-
any: rn,
|
|
3164
|
-
array: on,
|
|
3165
|
-
bigint: Gr,
|
|
3166
|
-
boolean: Lt,
|
|
3167
|
-
date: Xr,
|
|
3168
|
-
discriminatedUnion: ln,
|
|
3169
|
-
effect: St,
|
|
3170
|
-
enum: wn,
|
|
3171
|
-
function: gn,
|
|
3172
|
-
instanceof: Yr,
|
|
3173
|
-
intersection: fn,
|
|
3174
|
-
lazy: vn,
|
|
3175
|
-
literal: _n,
|
|
3176
|
-
map: mn,
|
|
3177
|
-
nan: Kr,
|
|
3178
|
-
nativeEnum: bn,
|
|
3179
|
-
never: sn,
|
|
3180
|
-
null: tn,
|
|
3181
|
-
nullable: Tn,
|
|
3182
|
-
number: Mt,
|
|
3183
|
-
object: dn,
|
|
3184
|
-
oboolean: Rn,
|
|
3185
|
-
onumber: Nn,
|
|
3186
|
-
optional: xn,
|
|
3187
|
-
ostring: On,
|
|
3188
|
-
pipeline: En,
|
|
3189
|
-
preprocess: Sn,
|
|
3190
|
-
promise: kn,
|
|
3191
|
-
record: hn,
|
|
3192
|
-
set: yn,
|
|
3193
|
-
strictObject: cn,
|
|
3194
|
-
string: Ft,
|
|
3195
|
-
symbol: Qr,
|
|
3196
|
-
transformer: St,
|
|
3197
|
-
tuple: pn,
|
|
3198
|
-
undefined: en,
|
|
3199
|
-
union: un,
|
|
3200
|
-
unknown: nn,
|
|
3201
|
-
void: an,
|
|
3202
|
-
NEVER: Cn,
|
|
3203
|
-
ZodIssueCode: u,
|
|
3204
|
-
quotelessJson: xr,
|
|
3205
|
-
ZodError: C
|
|
2830
|
+
})(g || (g = {}));
|
|
2831
|
+
const kt = D.create;
|
|
2832
|
+
U.create;
|
|
2833
|
+
P.create;
|
|
2834
|
+
const wt = O.create;
|
|
2835
|
+
xe.create;
|
|
2836
|
+
be.create;
|
|
2837
|
+
Y.create;
|
|
2838
|
+
re.create;
|
|
2839
|
+
Se.create;
|
|
2840
|
+
V.create;
|
|
2841
|
+
se.create;
|
|
2842
|
+
const Ze = wt({
|
|
2843
|
+
detail: kt()
|
|
2844
|
+
}), xt = wt({
|
|
2845
|
+
error: kt()
|
|
3206
2846
|
});
|
|
3207
|
-
|
|
3208
|
-
detail: Ke.string()
|
|
3209
|
-
}), Dt = Ke.object({
|
|
3210
|
-
error: Ke.string()
|
|
3211
|
-
});
|
|
3212
|
-
function In(t) {
|
|
2847
|
+
function Ar(t) {
|
|
3213
2848
|
if (!t)
|
|
3214
2849
|
return "Unknown error";
|
|
3215
2850
|
if (t instanceof Error) {
|
|
3216
|
-
const e =
|
|
3217
|
-
return e.success ? e.data.detail :
|
|
2851
|
+
const e = Ze.safeParse(t.cause);
|
|
2852
|
+
return e.success ? e.data.detail : Ir(t.message);
|
|
3218
2853
|
}
|
|
3219
2854
|
if (typeof t == "object") {
|
|
3220
|
-
const e =
|
|
2855
|
+
const e = Ze.safeParse(t);
|
|
3221
2856
|
if (e.success)
|
|
3222
2857
|
return e.data.detail;
|
|
3223
|
-
const r =
|
|
2858
|
+
const r = xt.safeParse(t);
|
|
3224
2859
|
if (r.success)
|
|
3225
2860
|
return r.data.error;
|
|
3226
2861
|
}
|
|
@@ -3230,60 +2865,60 @@ var rs = pr((as, mt) => {
|
|
|
3230
2865
|
return String(t);
|
|
3231
2866
|
}
|
|
3232
2867
|
}
|
|
3233
|
-
function
|
|
3234
|
-
const e =
|
|
2868
|
+
function Ir(t) {
|
|
2869
|
+
const e = Pr(t);
|
|
3235
2870
|
if (!e)
|
|
3236
2871
|
return t;
|
|
3237
|
-
const r =
|
|
2872
|
+
const r = Ze.safeParse(e);
|
|
3238
2873
|
if (r.success)
|
|
3239
2874
|
return r.data.detail;
|
|
3240
|
-
const n =
|
|
2875
|
+
const n = xt.safeParse(e);
|
|
3241
2876
|
return n.success ? n.data.error : t;
|
|
3242
2877
|
}
|
|
3243
|
-
function
|
|
2878
|
+
function Pr(t) {
|
|
3244
2879
|
try {
|
|
3245
2880
|
return JSON.parse(t);
|
|
3246
2881
|
} catch {
|
|
3247
2882
|
return t;
|
|
3248
2883
|
}
|
|
3249
2884
|
}
|
|
3250
|
-
const
|
|
3251
|
-
function
|
|
2885
|
+
const jr = "marimo-transport";
|
|
2886
|
+
function ue(t) {
|
|
3252
2887
|
return t.FS;
|
|
3253
2888
|
}
|
|
3254
|
-
const
|
|
3255
|
-
NOTEBOOK_FILENAME:
|
|
3256
|
-
HOME_DIR:
|
|
2889
|
+
const ie = "notebook.py", oe = "/marimo", M = {
|
|
2890
|
+
NOTEBOOK_FILENAME: ie,
|
|
2891
|
+
HOME_DIR: oe,
|
|
3257
2892
|
createHomeDir: (t) => {
|
|
3258
|
-
const e =
|
|
2893
|
+
const e = ue(t);
|
|
3259
2894
|
try {
|
|
3260
|
-
e.mkdirTree(
|
|
2895
|
+
e.mkdirTree(oe);
|
|
3261
2896
|
} catch {
|
|
3262
2897
|
}
|
|
3263
|
-
e.chdir(
|
|
2898
|
+
e.chdir(oe);
|
|
3264
2899
|
},
|
|
3265
2900
|
mountFS: (t) => {
|
|
3266
|
-
|
|
2901
|
+
ue(t).mount(t.FS.filesystems.IDBFS, { root: "." }, oe);
|
|
3267
2902
|
},
|
|
3268
2903
|
populateFilesToMemory: async (t) => {
|
|
3269
|
-
await
|
|
2904
|
+
await ht(t, !0);
|
|
3270
2905
|
},
|
|
3271
2906
|
persistFilesToRemote: async (t) => {
|
|
3272
|
-
await
|
|
2907
|
+
await ht(t, !1);
|
|
3273
2908
|
},
|
|
3274
2909
|
readNotebook: (t) => {
|
|
3275
|
-
const e =
|
|
3276
|
-
return
|
|
2910
|
+
const e = ue(t), r = `${oe}/${ie}`;
|
|
2911
|
+
return Ae(e.readFile(r));
|
|
3277
2912
|
},
|
|
3278
2913
|
initNotebookCode: (t) => {
|
|
3279
|
-
const { pyodide: e, filename: r, code: n } = t, s =
|
|
2914
|
+
const { pyodide: e, filename: r, code: n } = t, s = ue(e), a = (i) => {
|
|
3280
2915
|
try {
|
|
3281
|
-
return
|
|
2916
|
+
return Ae(s.readFile(i));
|
|
3282
2917
|
} catch {
|
|
3283
2918
|
return null;
|
|
3284
2919
|
}
|
|
3285
2920
|
};
|
|
3286
|
-
if (r && r !==
|
|
2921
|
+
if (r && r !== ie) {
|
|
3287
2922
|
const i = a(r);
|
|
3288
2923
|
if (i)
|
|
3289
2924
|
return {
|
|
@@ -3291,15 +2926,15 @@ var rs = pr((as, mt) => {
|
|
|
3291
2926
|
filename: r
|
|
3292
2927
|
};
|
|
3293
2928
|
}
|
|
3294
|
-
return s.writeFile(
|
|
2929
|
+
return s.writeFile(ie, n), {
|
|
3295
2930
|
code: n,
|
|
3296
|
-
filename:
|
|
2931
|
+
filename: ie
|
|
3297
2932
|
};
|
|
3298
2933
|
}
|
|
3299
2934
|
};
|
|
3300
|
-
function
|
|
2935
|
+
function ht(t, e) {
|
|
3301
2936
|
return new Promise((r, n) => {
|
|
3302
|
-
|
|
2937
|
+
ue(t).syncfs(e, (s) => {
|
|
3303
2938
|
if (s instanceof Error) {
|
|
3304
2939
|
n(s);
|
|
3305
2940
|
return;
|
|
@@ -3308,30 +2943,30 @@ var rs = pr((as, mt) => {
|
|
|
3308
2943
|
});
|
|
3309
2944
|
});
|
|
3310
2945
|
}
|
|
3311
|
-
var $
|
|
2946
|
+
var $r = Object.defineProperty, _ = (t, e) => $r(t, "name", { value: e, configurable: !0 }), bt = ((t) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(t, { get: (e, r) => (typeof require < "u" ? require : e)[r] }) : t)(function(t) {
|
|
3312
2947
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
3313
2948
|
throw new Error('Dynamic require of "' + t + '" is not supported');
|
|
3314
2949
|
});
|
|
3315
|
-
function
|
|
2950
|
+
function St(t) {
|
|
3316
2951
|
return !isNaN(parseFloat(t)) && isFinite(t);
|
|
3317
2952
|
}
|
|
3318
|
-
|
|
3319
|
-
function
|
|
2953
|
+
_(St, "_isNumber");
|
|
2954
|
+
function z(t) {
|
|
3320
2955
|
return t.charAt(0).toUpperCase() + t.substring(1);
|
|
3321
2956
|
}
|
|
3322
|
-
|
|
3323
|
-
function
|
|
2957
|
+
_(z, "_capitalize");
|
|
2958
|
+
function Ee(t) {
|
|
3324
2959
|
return function() {
|
|
3325
2960
|
return this[t];
|
|
3326
2961
|
};
|
|
3327
2962
|
}
|
|
3328
|
-
|
|
3329
|
-
var
|
|
3330
|
-
function
|
|
3331
|
-
if (t) for (var e = 0; e <
|
|
2963
|
+
_(Ee, "_getter");
|
|
2964
|
+
var G = ["isConstructor", "isEval", "isNative", "isToplevel"], K = ["columnNumber", "lineNumber"], Q = ["fileName", "functionName", "source"], Fr = ["args"], Zr = ["evalOrigin"], ye = G.concat(K, Q, Fr, Zr);
|
|
2965
|
+
function N(t) {
|
|
2966
|
+
if (t) for (var e = 0; e < ye.length; e++) t[ye[e]] !== void 0 && this["set" + z(ye[e])](t[ye[e]]);
|
|
3332
2967
|
}
|
|
3333
|
-
|
|
3334
|
-
|
|
2968
|
+
_(N, "StackFrame");
|
|
2969
|
+
N.prototype = { getArgs: function() {
|
|
3335
2970
|
return this.args;
|
|
3336
2971
|
}, setArgs: function(t) {
|
|
3337
2972
|
if (Object.prototype.toString.call(t) !== "[object Array]") throw new TypeError("Args must be an Array");
|
|
@@ -3339,48 +2974,48 @@ var rs = pr((as, mt) => {
|
|
|
3339
2974
|
}, getEvalOrigin: function() {
|
|
3340
2975
|
return this.evalOrigin;
|
|
3341
2976
|
}, setEvalOrigin: function(t) {
|
|
3342
|
-
if (t instanceof
|
|
3343
|
-
else if (t instanceof Object) this.evalOrigin = new
|
|
2977
|
+
if (t instanceof N) this.evalOrigin = t;
|
|
2978
|
+
else if (t instanceof Object) this.evalOrigin = new N(t);
|
|
3344
2979
|
else throw new TypeError("Eval Origin must be an Object or StackFrame");
|
|
3345
2980
|
}, toString: function() {
|
|
3346
2981
|
var t = this.getFileName() || "", e = this.getLineNumber() || "", r = this.getColumnNumber() || "", n = this.getFunctionName() || "";
|
|
3347
2982
|
return this.getIsEval() ? t ? "[eval] (" + t + ":" + e + ":" + r + ")" : "[eval]:" + e + ":" + r : n ? n + " (" + t + ":" + e + ":" + r + ")" : t + ":" + e + ":" + r;
|
|
3348
2983
|
} };
|
|
3349
|
-
|
|
2984
|
+
N.fromString = _(function(t) {
|
|
3350
2985
|
var e = t.indexOf("("), r = t.lastIndexOf(")"), n = t.substring(0, e), s = t.substring(e + 1, r).split(","), a = t.substring(r + 1);
|
|
3351
|
-
if (a.indexOf("@") === 0) var i = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a, ""), o = i[1], d = i[2],
|
|
3352
|
-
return new
|
|
2986
|
+
if (a.indexOf("@") === 0) var i = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a, ""), o = i[1], d = i[2], u = i[3];
|
|
2987
|
+
return new N({ functionName: n, args: s || void 0, fileName: o, lineNumber: d || void 0, columnNumber: u || void 0 });
|
|
3353
2988
|
}, "StackFrame$$fromString");
|
|
3354
|
-
for (
|
|
2989
|
+
for (B = 0; B < G.length; B++) N.prototype["get" + z(G[B])] = Ee(G[B]), N.prototype["set" + z(G[B])] = /* @__PURE__ */ function(t) {
|
|
3355
2990
|
return function(e) {
|
|
3356
2991
|
this[t] = !!e;
|
|
3357
2992
|
};
|
|
3358
|
-
}(
|
|
3359
|
-
var
|
|
3360
|
-
for (
|
|
2993
|
+
}(G[B]);
|
|
2994
|
+
var B;
|
|
2995
|
+
for (W = 0; W < K.length; W++) N.prototype["get" + z(K[W])] = Ee(K[W]), N.prototype["set" + z(K[W])] = /* @__PURE__ */ function(t) {
|
|
3361
2996
|
return function(e) {
|
|
3362
|
-
if (!
|
|
2997
|
+
if (!St(e)) throw new TypeError(t + " must be a Number");
|
|
3363
2998
|
this[t] = Number(e);
|
|
3364
2999
|
};
|
|
3365
|
-
}(
|
|
3366
|
-
var
|
|
3367
|
-
for (
|
|
3000
|
+
}(K[W]);
|
|
3001
|
+
var W;
|
|
3002
|
+
for (J = 0; J < Q.length; J++) N.prototype["get" + z(Q[J])] = Ee(Q[J]), N.prototype["set" + z(Q[J])] = /* @__PURE__ */ function(t) {
|
|
3368
3003
|
return function(e) {
|
|
3369
3004
|
this[t] = String(e);
|
|
3370
3005
|
};
|
|
3371
|
-
}(
|
|
3372
|
-
var
|
|
3373
|
-
function
|
|
3006
|
+
}(Q[J]);
|
|
3007
|
+
var J, Re = N;
|
|
3008
|
+
function Ot() {
|
|
3374
3009
|
var t = /^\s*at .*(\S+:\d+|\(native\))/m, e = /^(eval@)?(\[native code])?$/;
|
|
3375
|
-
return { parse:
|
|
3010
|
+
return { parse: _(function(r) {
|
|
3376
3011
|
if (r.stack && r.stack.match(t)) return this.parseV8OrIE(r);
|
|
3377
3012
|
if (r.stack) return this.parseFFOrSafari(r);
|
|
3378
3013
|
throw new Error("Cannot parse given Error object");
|
|
3379
|
-
}, "ErrorStackParser$$parse"), extractLocation:
|
|
3014
|
+
}, "ErrorStackParser$$parse"), extractLocation: _(function(r) {
|
|
3380
3015
|
if (r.indexOf(":") === -1) return [r];
|
|
3381
3016
|
var n = /(.+?)(?::(\d+))?(?::(\d+))?$/, s = n.exec(r.replace(/[()]/g, ""));
|
|
3382
3017
|
return [s[1], s[2] || void 0, s[3] || void 0];
|
|
3383
|
-
}, "ErrorStackParser$$extractLocation"), parseV8OrIE:
|
|
3018
|
+
}, "ErrorStackParser$$extractLocation"), parseV8OrIE: _(function(r) {
|
|
3384
3019
|
var n = r.stack.split(`
|
|
3385
3020
|
`).filter(function(s) {
|
|
3386
3021
|
return !!s.match(t);
|
|
@@ -3389,67 +3024,67 @@ var rs = pr((as, mt) => {
|
|
|
3389
3024
|
s.indexOf("(eval ") > -1 && (s = s.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
|
|
3390
3025
|
var a = s.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), i = a.match(/ (\(.+\)$)/);
|
|
3391
3026
|
a = i ? a.replace(i[0], "") : a;
|
|
3392
|
-
var o = this.extractLocation(i ? i[1] : a), d = i && a || void 0,
|
|
3393
|
-
return new
|
|
3027
|
+
var o = this.extractLocation(i ? i[1] : a), d = i && a || void 0, u = ["eval", "<anonymous>"].indexOf(o[0]) > -1 ? void 0 : o[0];
|
|
3028
|
+
return new Re({ functionName: d, fileName: u, lineNumber: o[1], columnNumber: o[2], source: s });
|
|
3394
3029
|
}, this);
|
|
3395
|
-
}, "ErrorStackParser$$parseV8OrIE"), parseFFOrSafari:
|
|
3030
|
+
}, "ErrorStackParser$$parseV8OrIE"), parseFFOrSafari: _(function(r) {
|
|
3396
3031
|
var n = r.stack.split(`
|
|
3397
3032
|
`).filter(function(s) {
|
|
3398
3033
|
return !s.match(e);
|
|
3399
3034
|
}, this);
|
|
3400
3035
|
return n.map(function(s) {
|
|
3401
|
-
if (s.indexOf(" > eval") > -1 && (s = s.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), s.indexOf("@") === -1 && s.indexOf(":") === -1) return new
|
|
3036
|
+
if (s.indexOf(" > eval") > -1 && (s = s.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), s.indexOf("@") === -1 && s.indexOf(":") === -1) return new Re({ functionName: s });
|
|
3402
3037
|
var a = /((.*".+"[^@]*)?[^@]*)(?:@)/, i = s.match(a), o = i && i[1] ? i[1] : void 0, d = this.extractLocation(s.replace(a, ""));
|
|
3403
|
-
return new
|
|
3038
|
+
return new Re({ functionName: o, fileName: d[0], lineNumber: d[1], columnNumber: d[2], source: s });
|
|
3404
3039
|
}, this);
|
|
3405
3040
|
}, "ErrorStackParser$$parseFFOrSafari") };
|
|
3406
3041
|
}
|
|
3407
|
-
|
|
3408
|
-
var
|
|
3042
|
+
_(Ot, "ErrorStackParser");
|
|
3043
|
+
var Lr = new Ot(), Mr = Lr, j = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && !process.browser, Et = j && typeof Ue < "u" && typeof Ue.exports < "u" && typeof bt < "u" && typeof __dirname < "u", Dr = j && !Et, Vr = typeof Deno < "u", Tt = !j && !Vr, qr = Tt && typeof window == "object" && typeof document == "object" && typeof document.createElement == "function" && "sessionStorage" in window && typeof importScripts != "function", Ur = Tt && typeof importScripts == "function" && typeof self == "object";
|
|
3409
3044
|
typeof navigator == "object" && typeof navigator.userAgent == "string" && navigator.userAgent.indexOf("Chrome") == -1 && navigator.userAgent.indexOf("Safari") > -1;
|
|
3410
|
-
var
|
|
3411
|
-
async function
|
|
3412
|
-
if (!
|
|
3413
|
-
let t =
|
|
3045
|
+
var Nt, Le, Rt, pt, He;
|
|
3046
|
+
async function Be() {
|
|
3047
|
+
if (!j || (Nt = (await import("./__vite-browser-external-CPvbk0mb.js")).default, pt = await import("./__vite-browser-external-CPvbk0mb.js"), He = await import("./__vite-browser-external-CPvbk0mb.js"), Rt = (await import("./__vite-browser-external-CPvbk0mb.js")).default, Le = await import("./__vite-browser-external-CPvbk0mb.js"), We = Le.sep, typeof bt < "u")) return;
|
|
3048
|
+
let t = pt, e = await import("./__vite-browser-external-CPvbk0mb.js"), r = await import("./__vite-browser-external-CPvbk0mb.js"), n = await import("./__vite-browser-external-CPvbk0mb.js"), s = { fs: t, crypto: e, ws: r, child_process: n };
|
|
3414
3049
|
globalThis.require = function(a) {
|
|
3415
3050
|
return s[a];
|
|
3416
3051
|
};
|
|
3417
3052
|
}
|
|
3418
|
-
|
|
3419
|
-
function
|
|
3420
|
-
return
|
|
3053
|
+
_(Be, "initNodeModules");
|
|
3054
|
+
function Ct(t, e) {
|
|
3055
|
+
return Le.resolve(e || ".", t);
|
|
3421
3056
|
}
|
|
3422
|
-
|
|
3423
|
-
function
|
|
3057
|
+
_(Ct, "node_resolvePath");
|
|
3058
|
+
function At(t, e) {
|
|
3424
3059
|
return e === void 0 && (e = location), new URL(t, e).toString();
|
|
3425
3060
|
}
|
|
3426
|
-
|
|
3427
|
-
var
|
|
3428
|
-
|
|
3429
|
-
var
|
|
3430
|
-
|
|
3431
|
-
function
|
|
3432
|
-
return t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? { response: fetch(t) } : { binary:
|
|
3061
|
+
_(At, "browser_resolvePath");
|
|
3062
|
+
var Me;
|
|
3063
|
+
j ? Me = Ct : Me = At;
|
|
3064
|
+
var We;
|
|
3065
|
+
j || (We = "/");
|
|
3066
|
+
function It(t, e) {
|
|
3067
|
+
return t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? { response: fetch(t) } : { binary: He.readFile(t).then((r) => new Uint8Array(r.buffer, r.byteOffset, r.byteLength)) };
|
|
3433
3068
|
}
|
|
3434
|
-
|
|
3435
|
-
function
|
|
3069
|
+
_(It, "node_getBinaryResponse");
|
|
3070
|
+
function Pt(t, e) {
|
|
3436
3071
|
let r = new URL(t, location);
|
|
3437
3072
|
return { response: fetch(r, e ? { integrity: e } : {}) };
|
|
3438
3073
|
}
|
|
3439
|
-
|
|
3440
|
-
var
|
|
3441
|
-
|
|
3442
|
-
async function
|
|
3443
|
-
let { response: r, binary: n } =
|
|
3074
|
+
_(Pt, "browser_getBinaryResponse");
|
|
3075
|
+
var Oe;
|
|
3076
|
+
j ? Oe = It : Oe = Pt;
|
|
3077
|
+
async function jt(t, e) {
|
|
3078
|
+
let { response: r, binary: n } = Oe(t, e);
|
|
3444
3079
|
if (n) return n;
|
|
3445
3080
|
let s = await r;
|
|
3446
3081
|
if (!s.ok) throw new Error(`Failed to load '${t}': request failed.`);
|
|
3447
3082
|
return new Uint8Array(await s.arrayBuffer());
|
|
3448
3083
|
}
|
|
3449
|
-
|
|
3450
|
-
var
|
|
3451
|
-
if (
|
|
3452
|
-
else if (
|
|
3084
|
+
_(jt, "loadBinaryFile");
|
|
3085
|
+
var ge;
|
|
3086
|
+
if (qr) ge = _(async (t) => await import(t), "loadScript");
|
|
3087
|
+
else if (Ur) ge = _(async (t) => {
|
|
3453
3088
|
try {
|
|
3454
3089
|
globalThis.importScripts(t);
|
|
3455
3090
|
} catch (e) {
|
|
@@ -3457,68 +3092,68 @@ var rs = pr((as, mt) => {
|
|
|
3457
3092
|
else throw e;
|
|
3458
3093
|
}
|
|
3459
3094
|
}, "loadScript");
|
|
3460
|
-
else if (
|
|
3095
|
+
else if (j) ge = $t;
|
|
3461
3096
|
else throw new Error("Cannot determine runtime environment");
|
|
3462
|
-
async function
|
|
3463
|
-
t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ?
|
|
3464
|
-
}
|
|
3465
|
-
|
|
3466
|
-
async function
|
|
3467
|
-
if (
|
|
3468
|
-
await
|
|
3469
|
-
let e = await
|
|
3097
|
+
async function $t(t) {
|
|
3098
|
+
t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? Rt.runInThisContext(await (await fetch(t)).text()) : await import(Nt.pathToFileURL(t).href);
|
|
3099
|
+
}
|
|
3100
|
+
_($t, "nodeLoadScript");
|
|
3101
|
+
async function Ft(t) {
|
|
3102
|
+
if (j) {
|
|
3103
|
+
await Be();
|
|
3104
|
+
let e = await He.readFile(t, { encoding: "utf8" });
|
|
3470
3105
|
return JSON.parse(e);
|
|
3471
3106
|
} else return await (await fetch(t)).json();
|
|
3472
3107
|
}
|
|
3473
|
-
|
|
3474
|
-
async function
|
|
3475
|
-
if (
|
|
3108
|
+
_(Ft, "loadLockFile");
|
|
3109
|
+
async function Zt() {
|
|
3110
|
+
if (Et) return __dirname;
|
|
3476
3111
|
let t;
|
|
3477
3112
|
try {
|
|
3478
3113
|
throw new Error();
|
|
3479
3114
|
} catch (n) {
|
|
3480
3115
|
t = n;
|
|
3481
3116
|
}
|
|
3482
|
-
let e =
|
|
3483
|
-
if (
|
|
3117
|
+
let e = Mr.parse(t)[0].fileName;
|
|
3118
|
+
if (j && !e.startsWith("file://") && (e = `file://${e}`), Dr) {
|
|
3484
3119
|
let n = await import("./__vite-browser-external-CPvbk0mb.js");
|
|
3485
3120
|
return (await import("./__vite-browser-external-CPvbk0mb.js")).fileURLToPath(n.dirname(e));
|
|
3486
3121
|
}
|
|
3487
|
-
let r = e.lastIndexOf(
|
|
3122
|
+
let r = e.lastIndexOf(We);
|
|
3488
3123
|
if (r === -1) throw new Error("Could not extract indexURL path from pyodide module location");
|
|
3489
3124
|
return e.slice(0, r);
|
|
3490
3125
|
}
|
|
3491
|
-
|
|
3492
|
-
function
|
|
3126
|
+
_(Zt, "calculateDirname");
|
|
3127
|
+
function Lt(t) {
|
|
3493
3128
|
let e = t.FS, r = t.FS.filesystems.MEMFS, n = t.PATH, s = { DIR_MODE: 16895, FILE_MODE: 33279, mount: function(a) {
|
|
3494
3129
|
if (!a.opts.fileSystemHandle) throw new Error("opts.fileSystemHandle is required");
|
|
3495
3130
|
return r.mount.apply(null, arguments);
|
|
3496
3131
|
}, syncfs: async (a, i, o) => {
|
|
3497
3132
|
try {
|
|
3498
|
-
let d = s.getLocalSet(a),
|
|
3499
|
-
await s.reconcile(a,
|
|
3133
|
+
let d = s.getLocalSet(a), u = await s.getRemoteSet(a), h = i ? u : d, b = i ? d : u;
|
|
3134
|
+
await s.reconcile(a, h, b), o(null);
|
|
3500
3135
|
} catch (d) {
|
|
3501
3136
|
o(d);
|
|
3502
3137
|
}
|
|
3503
3138
|
}, getLocalSet: (a) => {
|
|
3504
3139
|
let i = /* @__PURE__ */ Object.create(null);
|
|
3505
|
-
function o(
|
|
3506
|
-
return
|
|
3140
|
+
function o(h) {
|
|
3141
|
+
return h !== "." && h !== "..";
|
|
3507
3142
|
}
|
|
3508
|
-
|
|
3509
|
-
function d(
|
|
3510
|
-
return (
|
|
3143
|
+
_(o, "isRealDir");
|
|
3144
|
+
function d(h) {
|
|
3145
|
+
return (b) => n.join2(h, b);
|
|
3511
3146
|
}
|
|
3512
|
-
|
|
3513
|
-
let
|
|
3514
|
-
for (;
|
|
3515
|
-
let
|
|
3516
|
-
e.isDir(
|
|
3147
|
+
_(d, "toAbsolute");
|
|
3148
|
+
let u = e.readdir(a.mountpoint).filter(o).map(d(a.mountpoint));
|
|
3149
|
+
for (; u.length; ) {
|
|
3150
|
+
let h = u.pop(), b = e.stat(h);
|
|
3151
|
+
e.isDir(b.mode) && u.push.apply(u, e.readdir(h).filter(o).map(d(h))), i[h] = { timestamp: b.mtime, mode: b.mode };
|
|
3517
3152
|
}
|
|
3518
3153
|
return { type: "local", entries: i };
|
|
3519
3154
|
}, getRemoteSet: async (a) => {
|
|
3520
|
-
let i = /* @__PURE__ */ Object.create(null), o = await
|
|
3521
|
-
for (let [d,
|
|
3155
|
+
let i = /* @__PURE__ */ Object.create(null), o = await zr(a.opts.fileSystemHandle);
|
|
3156
|
+
for (let [d, u] of o) d !== "." && (i[n.join2(a.mountpoint, d)] = { timestamp: u.kind === "file" ? new Date((await u.getFile()).lastModified) : /* @__PURE__ */ new Date(), mode: u.kind === "file" ? s.FILE_MODE : s.DIR_MODE });
|
|
3522
3157
|
return { type: "remote", entries: i, handles: o };
|
|
3523
3158
|
}, loadLocalEntry: (a) => {
|
|
3524
3159
|
let i = e.lookupPath(a).node, o = e.stat(a);
|
|
@@ -3542,50 +3177,50 @@ var rs = pr((as, mt) => {
|
|
|
3542
3177
|
throw new Error("unknown kind: " + a.kind);
|
|
3543
3178
|
}
|
|
3544
3179
|
}, storeRemoteEntry: async (a, i, o) => {
|
|
3545
|
-
let d = a.get(n.dirname(i)),
|
|
3546
|
-
if (
|
|
3547
|
-
let
|
|
3548
|
-
await
|
|
3180
|
+
let d = a.get(n.dirname(i)), u = e.isFile(o.mode) ? await d.getFileHandle(n.basename(i), { create: !0 }) : await d.getDirectoryHandle(n.basename(i), { create: !0 });
|
|
3181
|
+
if (u.kind === "file") {
|
|
3182
|
+
let h = await u.createWritable();
|
|
3183
|
+
await h.write(o.contents), await h.close();
|
|
3549
3184
|
}
|
|
3550
|
-
a.set(i,
|
|
3185
|
+
a.set(i, u);
|
|
3551
3186
|
}, removeRemoteEntry: async (a, i) => {
|
|
3552
3187
|
await a.get(n.dirname(i)).removeEntry(n.basename(i)), a.delete(i);
|
|
3553
3188
|
}, reconcile: async (a, i, o) => {
|
|
3554
|
-
let d = 0,
|
|
3555
|
-
Object.keys(i.entries).forEach(function(
|
|
3556
|
-
let A = i.entries[
|
|
3557
|
-
(
|
|
3558
|
-
}),
|
|
3559
|
-
let
|
|
3560
|
-
if (Object.keys(o.entries).forEach(function(
|
|
3561
|
-
i.entries[
|
|
3562
|
-
}),
|
|
3563
|
-
let
|
|
3564
|
-
for (let
|
|
3565
|
-
let A = n.normalize(
|
|
3189
|
+
let d = 0, u = [];
|
|
3190
|
+
Object.keys(i.entries).forEach(function(S) {
|
|
3191
|
+
let A = i.entries[S], $ = o.entries[S];
|
|
3192
|
+
(!$ || e.isFile(A.mode) && A.timestamp.getTime() > $.timestamp.getTime()) && (u.push(S), d++);
|
|
3193
|
+
}), u.sort();
|
|
3194
|
+
let h = [];
|
|
3195
|
+
if (Object.keys(o.entries).forEach(function(S) {
|
|
3196
|
+
i.entries[S] || (h.push(S), d++);
|
|
3197
|
+
}), h.sort().reverse(), !d) return;
|
|
3198
|
+
let b = i.type === "remote" ? i.handles : o.handles;
|
|
3199
|
+
for (let S of u) {
|
|
3200
|
+
let A = n.normalize(S.replace(a.mountpoint, "/")).substring(1);
|
|
3566
3201
|
if (o.type === "local") {
|
|
3567
|
-
let
|
|
3568
|
-
s.storeLocalEntry(
|
|
3202
|
+
let $ = b.get(A), pe = await s.loadRemoteEntry($);
|
|
3203
|
+
s.storeLocalEntry(S, pe);
|
|
3569
3204
|
} else {
|
|
3570
|
-
let
|
|
3571
|
-
await s.storeRemoteEntry(
|
|
3205
|
+
let $ = s.loadLocalEntry(S);
|
|
3206
|
+
await s.storeRemoteEntry(b, A, $);
|
|
3572
3207
|
}
|
|
3573
3208
|
}
|
|
3574
|
-
for (let
|
|
3209
|
+
for (let S of h) if (o.type === "local") s.removeLocalEntry(S);
|
|
3575
3210
|
else {
|
|
3576
|
-
let A = n.normalize(
|
|
3577
|
-
await s.removeRemoteEntry(
|
|
3211
|
+
let A = n.normalize(S.replace(a.mountpoint, "/")).substring(1);
|
|
3212
|
+
await s.removeRemoteEntry(b, A);
|
|
3578
3213
|
}
|
|
3579
3214
|
} };
|
|
3580
3215
|
t.FS.filesystems.NATIVEFS_ASYNC = s;
|
|
3581
3216
|
}
|
|
3582
|
-
|
|
3583
|
-
var
|
|
3217
|
+
_(Lt, "initializeNativeFS");
|
|
3218
|
+
var zr = _(async (t) => {
|
|
3584
3219
|
let e = [];
|
|
3585
3220
|
async function r(s) {
|
|
3586
3221
|
for await (let a of s.values()) e.push(a), a.kind === "directory" && await r(a);
|
|
3587
3222
|
}
|
|
3588
|
-
|
|
3223
|
+
_(r, "collect"), await r(t);
|
|
3589
3224
|
let n = /* @__PURE__ */ new Map();
|
|
3590
3225
|
n.set(".", t);
|
|
3591
3226
|
for (let s of e) {
|
|
@@ -3594,14 +3229,14 @@ var rs = pr((as, mt) => {
|
|
|
3594
3229
|
}
|
|
3595
3230
|
return n;
|
|
3596
3231
|
}, "getFsHandles");
|
|
3597
|
-
function
|
|
3598
|
-
let e = { noImageDecoding: !0, noAudioDecoding: !0, noWasmDecoding: !1, preRun:
|
|
3232
|
+
function Mt(t) {
|
|
3233
|
+
let e = { noImageDecoding: !0, noAudioDecoding: !0, noWasmDecoding: !1, preRun: zt(t), quit(r, n) {
|
|
3599
3234
|
throw e.exited = { status: r, toThrow: n }, n;
|
|
3600
|
-
}, print: t.stdout, printErr: t.stderr, thisProgram: t._sysExecutable, arguments: t.args, API: { config: t }, locateFile: (r) => t.indexURL + r, instantiateWasm:
|
|
3235
|
+
}, print: t.stdout, printErr: t.stderr, thisProgram: t._sysExecutable, arguments: t.args, API: { config: t }, locateFile: (r) => t.indexURL + r, instantiateWasm: Ht(t.indexURL) };
|
|
3601
3236
|
return e;
|
|
3602
3237
|
}
|
|
3603
|
-
|
|
3604
|
-
function
|
|
3238
|
+
_(Mt, "createSettings");
|
|
3239
|
+
function Dt(t) {
|
|
3605
3240
|
return function(e) {
|
|
3606
3241
|
let r = "/";
|
|
3607
3242
|
try {
|
|
@@ -3612,14 +3247,14 @@ var rs = pr((as, mt) => {
|
|
|
3612
3247
|
e.FS.chdir(t);
|
|
3613
3248
|
};
|
|
3614
3249
|
}
|
|
3615
|
-
|
|
3616
|
-
function
|
|
3250
|
+
_(Dt, "createHomeDirectory");
|
|
3251
|
+
function Vt(t) {
|
|
3617
3252
|
return function(e) {
|
|
3618
3253
|
Object.assign(e.ENV, t);
|
|
3619
3254
|
};
|
|
3620
3255
|
}
|
|
3621
|
-
|
|
3622
|
-
function
|
|
3256
|
+
_(Vt, "setEnvironment");
|
|
3257
|
+
function qt(t) {
|
|
3623
3258
|
return t ? [async (e) => {
|
|
3624
3259
|
e.addRunDependency("fsInitHook");
|
|
3625
3260
|
try {
|
|
@@ -3629,9 +3264,9 @@ var rs = pr((as, mt) => {
|
|
|
3629
3264
|
}
|
|
3630
3265
|
}] : [];
|
|
3631
3266
|
}
|
|
3632
|
-
|
|
3633
|
-
function
|
|
3634
|
-
let e =
|
|
3267
|
+
_(qt, "callFsInitHook");
|
|
3268
|
+
function Ut(t) {
|
|
3269
|
+
let e = jt(t);
|
|
3635
3270
|
return async (r) => {
|
|
3636
3271
|
let n = r._py_version_major(), s = r._py_version_minor();
|
|
3637
3272
|
r.FS.mkdirTree("/lib"), r.API.sitePackages = `/lib/python${n}.${s}/site-packages`, r.FS.mkdirTree(r.API.sitePackages), r.addRunDependency("install-stdlib");
|
|
@@ -3645,15 +3280,15 @@ var rs = pr((as, mt) => {
|
|
|
3645
3280
|
}
|
|
3646
3281
|
};
|
|
3647
3282
|
}
|
|
3648
|
-
|
|
3649
|
-
function
|
|
3283
|
+
_(Ut, "installStdlib");
|
|
3284
|
+
function zt(t) {
|
|
3650
3285
|
let e;
|
|
3651
|
-
return t.stdLibURL != null ? e = t.stdLibURL : e = t.indexURL + "python_stdlib.zip", [...
|
|
3286
|
+
return t.stdLibURL != null ? e = t.stdLibURL : e = t.indexURL + "python_stdlib.zip", [...qt(t.fsInit), Ut(e), Dt(t.env.HOME), Vt(t.env), Lt];
|
|
3652
3287
|
}
|
|
3653
|
-
|
|
3654
|
-
function
|
|
3288
|
+
_(zt, "getFileSystemInitializationFuncs");
|
|
3289
|
+
function Ht(t) {
|
|
3655
3290
|
if (typeof WasmOffsetConverter < "u") return;
|
|
3656
|
-
let { binary: e, response: r } =
|
|
3291
|
+
let { binary: e, response: r } = Oe(t + "pyodide.asm.wasm");
|
|
3657
3292
|
return function(n, s) {
|
|
3658
3293
|
return async function() {
|
|
3659
3294
|
try {
|
|
@@ -3667,42 +3302,42 @@ var rs = pr((as, mt) => {
|
|
|
3667
3302
|
}(), {};
|
|
3668
3303
|
};
|
|
3669
3304
|
}
|
|
3670
|
-
|
|
3671
|
-
var
|
|
3672
|
-
async function
|
|
3305
|
+
_(Ht, "getInstantiateWasmFunc");
|
|
3306
|
+
var De = "0.27.7";
|
|
3307
|
+
async function Ve(t = {}) {
|
|
3673
3308
|
var e, r;
|
|
3674
|
-
await
|
|
3675
|
-
let n = t.indexURL || await
|
|
3676
|
-
n =
|
|
3677
|
-
let s = { fullStdLib: !1, jsglobals: globalThis, stdin: globalThis.prompt ? globalThis.prompt : void 0, lockFileURL: n + "pyodide-lock.json", args: [], env: {}, packageCacheDir: n, packages: [], enableRunUntilComplete: !
|
|
3309
|
+
await Be();
|
|
3310
|
+
let n = t.indexURL || await Zt();
|
|
3311
|
+
n = Me(n), n.endsWith("/") || (n += "/"), t.indexURL = n;
|
|
3312
|
+
let s = { fullStdLib: !1, jsglobals: globalThis, stdin: globalThis.prompt ? globalThis.prompt : void 0, lockFileURL: n + "pyodide-lock.json", args: [], env: {}, packageCacheDir: n, packages: [], enableRunUntilComplete: !0, checkAPIVersion: !0, BUILD_ID: "e94377f5ce7dcf67e0417b69a0016733c2cfb6b4622ee8c490a6f17eb58e863b" }, a = Object.assign(s, t);
|
|
3678
3313
|
(e = a.env).HOME ?? (e.HOME = "/home/pyodide"), (r = a.env).PYTHONINSPECT ?? (r.PYTHONINSPECT = "1");
|
|
3679
|
-
let i =
|
|
3680
|
-
if (o.lockFilePromise =
|
|
3681
|
-
let
|
|
3682
|
-
await
|
|
3314
|
+
let i = Mt(a), o = i.API;
|
|
3315
|
+
if (o.lockFilePromise = Ft(a.lockFileURL), typeof _createPyodideModule != "function") {
|
|
3316
|
+
let S = `${a.indexURL}pyodide.asm.js`;
|
|
3317
|
+
await ge(S);
|
|
3683
3318
|
}
|
|
3684
3319
|
let d;
|
|
3685
3320
|
if (t._loadSnapshot) {
|
|
3686
|
-
let
|
|
3687
|
-
ArrayBuffer.isView(
|
|
3321
|
+
let S = await t._loadSnapshot;
|
|
3322
|
+
ArrayBuffer.isView(S) ? d = S : d = new Uint8Array(S), i.noInitialRun = !0, i.INITIAL_MEMORY = d.length;
|
|
3688
3323
|
}
|
|
3689
|
-
let
|
|
3324
|
+
let u = await _createPyodideModule(i);
|
|
3690
3325
|
if (i.exited) throw i.exited.toThrow;
|
|
3691
|
-
if (t.pyproxyToStringRepr && o.setPyProxyToStringMethod(!0), o.version !==
|
|
3692
|
-
|
|
3326
|
+
if (t.pyproxyToStringRepr && o.setPyProxyToStringMethod(!0), o.version !== De && a.checkAPIVersion) throw new Error(`Pyodide version does not match: '${De}' <==> '${o.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);
|
|
3327
|
+
u.locateFile = (S) => {
|
|
3693
3328
|
throw new Error("Didn't expect to load any more file_packager files!");
|
|
3694
3329
|
};
|
|
3695
|
-
let
|
|
3696
|
-
d && (
|
|
3697
|
-
let
|
|
3698
|
-
return o.sys.path.insert(0,
|
|
3330
|
+
let h;
|
|
3331
|
+
d && (h = o.restoreSnapshot(d));
|
|
3332
|
+
let b = o.finalizeBootstrap(h, t._snapshotDeserializer);
|
|
3333
|
+
return o.sys.path.insert(0, ""), b.version.includes("dev") || o.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${b.version}/full/`), o._pyodide.set_excepthook(), await o.packageIndexReady, o.initializeStreams(a.stdin, a.stdout, a.stderr), b;
|
|
3699
3334
|
}
|
|
3700
|
-
|
|
3701
|
-
function
|
|
3335
|
+
_(Ve, "loadPyodide");
|
|
3336
|
+
function Hr(t, e) {
|
|
3702
3337
|
if (!t)
|
|
3703
3338
|
throw new Error(e);
|
|
3704
3339
|
}
|
|
3705
|
-
class
|
|
3340
|
+
class Br {
|
|
3706
3341
|
spans = [];
|
|
3707
3342
|
startSpan(e, r = {}) {
|
|
3708
3343
|
const n = {
|
|
@@ -3742,23 +3377,23 @@ var rs = pr((as, mt) => {
|
|
|
3742
3377
|
logSpans() {
|
|
3743
3378
|
}
|
|
3744
3379
|
}
|
|
3745
|
-
const
|
|
3746
|
-
globalThis.t =
|
|
3747
|
-
const
|
|
3748
|
-
class
|
|
3380
|
+
const ee = new Br();
|
|
3381
|
+
globalThis.t = ee;
|
|
3382
|
+
const Wr = !1;
|
|
3383
|
+
class Jr {
|
|
3749
3384
|
pyodide = null;
|
|
3750
3385
|
get requirePyodide() {
|
|
3751
|
-
return
|
|
3386
|
+
return Hr(this.pyodide, "Pyodide not loaded"), this.pyodide;
|
|
3752
3387
|
}
|
|
3753
3388
|
async bootstrap(e) {
|
|
3754
3389
|
return await this.loadPyodideAndPackages(e);
|
|
3755
3390
|
}
|
|
3756
3391
|
async loadPyodideAndPackages(e) {
|
|
3757
|
-
if (!
|
|
3392
|
+
if (!Ve)
|
|
3758
3393
|
throw new Error("loadPyodide is not defined");
|
|
3759
|
-
const r =
|
|
3394
|
+
const r = ee.startSpan("loadPyodide");
|
|
3760
3395
|
try {
|
|
3761
|
-
const n = await
|
|
3396
|
+
const n = await Ve({
|
|
3762
3397
|
// Perf: These get loaded while pyodide is being bootstrapped
|
|
3763
3398
|
packages: [
|
|
3764
3399
|
"micropip",
|
|
@@ -3768,7 +3403,7 @@ var rs = pr((as, mt) => {
|
|
|
3768
3403
|
"narwhals",
|
|
3769
3404
|
"packaging"
|
|
3770
3405
|
],
|
|
3771
|
-
_makeSnapshot:
|
|
3406
|
+
_makeSnapshot: Wr,
|
|
3772
3407
|
lockFileURL: `https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,
|
|
3773
3408
|
// Without this, this fails in Firefox with
|
|
3774
3409
|
// `Could not extract indexURL path from pyodide module`
|
|
@@ -3777,12 +3412,12 @@ var rs = pr((as, mt) => {
|
|
|
3777
3412
|
});
|
|
3778
3413
|
return this.pyodide = n, r.end("ok"), n;
|
|
3779
3414
|
} catch (n) {
|
|
3780
|
-
throw
|
|
3415
|
+
throw de.error("Failed to load Pyodide", n), n;
|
|
3781
3416
|
}
|
|
3782
3417
|
}
|
|
3783
3418
|
async mountFilesystem(e) {
|
|
3784
|
-
const r =
|
|
3785
|
-
return
|
|
3419
|
+
const r = ee.startSpan("mountFilesystem");
|
|
3420
|
+
return M.createHomeDir(this.requirePyodide), M.mountFS(this.requirePyodide), await M.populateFilesToMemory(this.requirePyodide), r.end("ok"), M.initNotebookCode({
|
|
3786
3421
|
pyodide: this.requirePyodide,
|
|
3787
3422
|
code: e.code,
|
|
3788
3423
|
filename: e.filename
|
|
@@ -3793,7 +3428,7 @@ var rs = pr((as, mt) => {
|
|
|
3793
3428
|
self.messenger = {
|
|
3794
3429
|
callback: s
|
|
3795
3430
|
}, self.query_params = a, self.user_config = i;
|
|
3796
|
-
const o =
|
|
3431
|
+
const o = ee.startSpan("startSession.runPython"), d = n || M.NOTEBOOK_FILENAME, [u, h, b] = this.requirePyodide.runPython(
|
|
3797
3432
|
`
|
|
3798
3433
|
print("[py] Starting marimo...")
|
|
3799
3434
|
import asyncio
|
|
@@ -3821,8 +3456,8 @@ var rs = pr((as, mt) => {
|
|
|
3821
3456
|
bridge, init, packages`
|
|
3822
3457
|
);
|
|
3823
3458
|
o.end();
|
|
3824
|
-
const
|
|
3825
|
-
return this.loadNotebookDeps(r,
|
|
3459
|
+
const S = new Set(b.toJs());
|
|
3460
|
+
return this.loadNotebookDeps(r, S).then(() => h(i.runtime.auto_instantiate)), u;
|
|
3826
3461
|
}
|
|
3827
3462
|
async loadNotebookDeps(e, r) {
|
|
3828
3463
|
const n = this.requirePyodide;
|
|
@@ -3836,11 +3471,11 @@ ${e}`, e = `import jedi
|
|
|
3836
3471
|
${e}`, e = `import pyodide_http
|
|
3837
3472
|
${e}`;
|
|
3838
3473
|
const s = [...r];
|
|
3839
|
-
let a =
|
|
3474
|
+
let a = ee.startSpan("pyodide.loadPackage");
|
|
3840
3475
|
await n.loadPackagesFromImports(e, {
|
|
3841
|
-
errorCallback:
|
|
3842
|
-
messageCallback:
|
|
3843
|
-
}), a.end(), a =
|
|
3476
|
+
errorCallback: de.error,
|
|
3477
|
+
messageCallback: de.log
|
|
3478
|
+
}), a.end(), a = ee.startSpan("micropip.install");
|
|
3844
3479
|
const i = s.filter(
|
|
3845
3480
|
(o) => !n.loadedPackages[o]
|
|
3846
3481
|
);
|
|
@@ -3853,57 +3488,57 @@ ${e}`;
|
|
|
3853
3488
|
print("Loading from micropip:", missing)
|
|
3854
3489
|
await micropip.install(missing)
|
|
3855
3490
|
`).catch((o) => {
|
|
3856
|
-
|
|
3491
|
+
de.error("Failed to load packages from micropip", o);
|
|
3857
3492
|
}), a.end();
|
|
3858
3493
|
}
|
|
3859
3494
|
}
|
|
3860
|
-
async function
|
|
3495
|
+
async function Yr(t) {
|
|
3861
3496
|
try {
|
|
3862
3497
|
return await import(
|
|
3863
3498
|
/* @vite-ignore */
|
|
3864
3499
|
`/wasm/controller.js?version=${t}`
|
|
3865
3500
|
);
|
|
3866
3501
|
} catch {
|
|
3867
|
-
return new
|
|
3502
|
+
return new Jr();
|
|
3868
3503
|
}
|
|
3869
3504
|
}
|
|
3870
|
-
const
|
|
3871
|
-
function
|
|
3872
|
-
return t.includes("dev") &&
|
|
3505
|
+
const Xr = !1;
|
|
3506
|
+
function Gr(t) {
|
|
3507
|
+
return t.includes("dev") && Xr ? "dev" : `v${De}`;
|
|
3873
3508
|
}
|
|
3874
|
-
async function
|
|
3509
|
+
async function Kr() {
|
|
3875
3510
|
try {
|
|
3876
|
-
const t =
|
|
3511
|
+
const t = en(), e = Gr(t), r = await Yr(t);
|
|
3877
3512
|
self.controller = r, self.pyodide = await r.bootstrap({
|
|
3878
3513
|
version: t,
|
|
3879
3514
|
pyodideVersion: e
|
|
3880
3515
|
}), await r.mountFilesystem?.({
|
|
3881
3516
|
code: "",
|
|
3882
3517
|
filename: null
|
|
3883
|
-
}),
|
|
3518
|
+
}), qe.send.initialized({});
|
|
3884
3519
|
} catch (t) {
|
|
3885
|
-
|
|
3520
|
+
de.error("Error bootstrapping", t), qe.send.initializedError({ error: Ar(t) });
|
|
3886
3521
|
}
|
|
3887
3522
|
}
|
|
3888
|
-
const
|
|
3889
|
-
readFile: async (t) => (await
|
|
3890
|
-
readNotebook: async () => (await
|
|
3523
|
+
const Ce = Kr(), Qr = {
|
|
3524
|
+
readFile: async (t) => (await Ce, Ae(self.pyodide.FS.readFile(t))),
|
|
3525
|
+
readNotebook: async () => (await Ce, M.readNotebook(self.pyodide)),
|
|
3891
3526
|
saveNotebook: async (t) => {
|
|
3892
|
-
await
|
|
3527
|
+
await Ce, await self.pyodide.runPython(`
|
|
3893
3528
|
from marimo._pyodide.bootstrap import save_file
|
|
3894
3529
|
|
|
3895
3530
|
save_file
|
|
3896
|
-
`)(JSON.stringify(t),
|
|
3531
|
+
`)(JSON.stringify(t), M.NOTEBOOK_FILENAME), await M.persistFilesToRemote(self.pyodide);
|
|
3897
3532
|
}
|
|
3898
|
-
},
|
|
3899
|
-
transport:
|
|
3900
|
-
transportId:
|
|
3533
|
+
}, qe = Qt({
|
|
3534
|
+
transport: nr({
|
|
3535
|
+
transportId: jr
|
|
3901
3536
|
}),
|
|
3902
|
-
requestHandler:
|
|
3537
|
+
requestHandler: Qr
|
|
3903
3538
|
});
|
|
3904
|
-
|
|
3905
|
-
function
|
|
3539
|
+
qe.send("ready", {});
|
|
3540
|
+
function en() {
|
|
3906
3541
|
return self.name;
|
|
3907
3542
|
}
|
|
3908
3543
|
});
|
|
3909
|
-
export default
|
|
3544
|
+
export default tn();
|