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