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